@mountaya/studio-react 0.0.0-stage → 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 (976) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/LICENCE.fr.txt +280 -0
  3. package/LICENSE.txt +262 -0
  4. package/README.md +1087 -2
  5. package/THIRD-PARTY-NOTICES.txt +149 -0
  6. package/dist/chunk--VSQcEs_.cjs +26 -0
  7. package/dist/chunk--VSQcEs_.cjs.map +1 -0
  8. package/dist/chunk-0qoALFfx.cjs +454 -0
  9. package/dist/chunk-0qoALFfx.cjs.map +1 -0
  10. package/dist/chunk-0sHgX8We.cjs +97 -0
  11. package/dist/chunk-0sHgX8We.cjs.map +1 -0
  12. package/dist/chunk-4D4as_tP.js +16 -0
  13. package/dist/chunk-4D4as_tP.js.map +1 -0
  14. package/dist/chunk-6LM6wuIg.cjs +13 -0
  15. package/dist/chunk-6LM6wuIg.cjs.map +1 -0
  16. package/dist/chunk-6VpwF-77.js +7 -0
  17. package/dist/chunk-6VpwF-77.js.map +1 -0
  18. package/dist/chunk-6v2fJIDh.cjs +28 -0
  19. package/dist/chunk-6v2fJIDh.cjs.map +1 -0
  20. package/dist/chunk-Af0f-OjN.js +71 -0
  21. package/dist/chunk-Af0f-OjN.js.map +1 -0
  22. package/dist/chunk-B-QQkaWk.js +91 -0
  23. package/dist/chunk-B-QQkaWk.js.map +1 -0
  24. package/dist/chunk-B1lX5w6I.cjs +181 -0
  25. package/dist/chunk-B1lX5w6I.cjs.map +1 -0
  26. package/dist/chunk-B2gsz9OJ.js +19 -0
  27. package/dist/chunk-B2gsz9OJ.js.map +1 -0
  28. package/dist/chunk-B38srE2R.d.cts +3976 -0
  29. package/dist/chunk-B3HdxIq7.js +69 -0
  30. package/dist/chunk-B3HdxIq7.js.map +1 -0
  31. package/dist/chunk-B3UCX3Wd.js +30 -0
  32. package/dist/chunk-B3UCX3Wd.js.map +1 -0
  33. package/dist/chunk-B3mMYMtz.cjs +88 -0
  34. package/dist/chunk-B3mMYMtz.cjs.map +1 -0
  35. package/dist/chunk-B7D0neNQ.cjs +47 -0
  36. package/dist/chunk-B7D0neNQ.cjs.map +1 -0
  37. package/dist/chunk-B7UzNwmm.cjs +115 -0
  38. package/dist/chunk-B7UzNwmm.cjs.map +1 -0
  39. package/dist/chunk-B7d3NIaH.js +55 -0
  40. package/dist/chunk-B7d3NIaH.js.map +1 -0
  41. package/dist/chunk-B8ONCPFQ.cjs +70 -0
  42. package/dist/chunk-B8ONCPFQ.cjs.map +1 -0
  43. package/dist/chunk-B8QgG-RT.js +2232 -0
  44. package/dist/chunk-B8QgG-RT.js.map +1 -0
  45. package/dist/chunk-B8ZpXH0_.cjs +64 -0
  46. package/dist/chunk-B8ZpXH0_.cjs.map +1 -0
  47. package/dist/chunk-B8mS5bGc.cjs +112 -0
  48. package/dist/chunk-B8mS5bGc.cjs.map +1 -0
  49. package/dist/chunk-B9EkHHSU.js +40 -0
  50. package/dist/chunk-B9EkHHSU.js.map +1 -0
  51. package/dist/chunk-BA0PWNyn.js +234 -0
  52. package/dist/chunk-BA0PWNyn.js.map +1 -0
  53. package/dist/chunk-BAWE1gqe.js +60 -0
  54. package/dist/chunk-BAWE1gqe.js.map +1 -0
  55. package/dist/chunk-BAe9m2Yp.d.cts +963 -0
  56. package/dist/chunk-BDJCk6ml.js +19 -0
  57. package/dist/chunk-BDJCk6ml.js.map +1 -0
  58. package/dist/chunk-BFI2CR6j.cjs +381 -0
  59. package/dist/chunk-BFI2CR6j.cjs.map +1 -0
  60. package/dist/chunk-BIIJXiiS.js +40 -0
  61. package/dist/chunk-BIIJXiiS.js.map +1 -0
  62. package/dist/chunk-BJAn10wR.js +54 -0
  63. package/dist/chunk-BJAn10wR.js.map +1 -0
  64. package/dist/chunk-BLxPxx5p.js +1641 -0
  65. package/dist/chunk-BLxPxx5p.js.map +1 -0
  66. package/dist/chunk-BNSJoNwO.cjs +377 -0
  67. package/dist/chunk-BNSJoNwO.cjs.map +1 -0
  68. package/dist/chunk-BNTshA5u.js +304 -0
  69. package/dist/chunk-BNTshA5u.js.map +1 -0
  70. package/dist/chunk-BO_yHMn2.js +7 -0
  71. package/dist/chunk-BO_yHMn2.js.map +1 -0
  72. package/dist/chunk-BOpIVklq.cjs +23 -0
  73. package/dist/chunk-BOpIVklq.cjs.map +1 -0
  74. package/dist/chunk-BP8bHGiE.cjs +12 -0
  75. package/dist/chunk-BP8bHGiE.cjs.map +1 -0
  76. package/dist/chunk-BPsgx3c7.js +56 -0
  77. package/dist/chunk-BPsgx3c7.js.map +1 -0
  78. package/dist/chunk-BQkKY_kf.js +44 -0
  79. package/dist/chunk-BQkKY_kf.js.map +1 -0
  80. package/dist/chunk-BQoAEKyJ.js +193 -0
  81. package/dist/chunk-BQoAEKyJ.js.map +1 -0
  82. package/dist/chunk-BRuLc45I.cjs +21 -0
  83. package/dist/chunk-BRuLc45I.cjs.map +1 -0
  84. package/dist/chunk-BSnrqsA8.cjs +56 -0
  85. package/dist/chunk-BSnrqsA8.cjs.map +1 -0
  86. package/dist/chunk-BTDBomKm.cjs +80 -0
  87. package/dist/chunk-BTDBomKm.cjs.map +1 -0
  88. package/dist/chunk-BVogYy0R.js +375 -0
  89. package/dist/chunk-BVogYy0R.js.map +1 -0
  90. package/dist/chunk-BWITLmlf.js +6 -0
  91. package/dist/chunk-BWITLmlf.js.map +1 -0
  92. package/dist/chunk-BXUrvYqd.d.cts +112 -0
  93. package/dist/chunk-BXUrvYqd.d.ts +112 -0
  94. package/dist/chunk-BYzQfFFV.js +54 -0
  95. package/dist/chunk-BYzQfFFV.js.map +1 -0
  96. package/dist/chunk-BZCKMlN8.js +35 -0
  97. package/dist/chunk-BZCKMlN8.js.map +1 -0
  98. package/dist/chunk-BalPERFX.js +13 -0
  99. package/dist/chunk-BalPERFX.js.map +1 -0
  100. package/dist/chunk-Bb5SAw6T.cjs +72 -0
  101. package/dist/chunk-Bb5SAw6T.cjs.map +1 -0
  102. package/dist/chunk-BbQyoetL.cjs +269 -0
  103. package/dist/chunk-BbQyoetL.cjs.map +1 -0
  104. package/dist/chunk-BdepwGey.js +600 -0
  105. package/dist/chunk-BdepwGey.js.map +1 -0
  106. package/dist/chunk-BeB57TnZ.js +29 -0
  107. package/dist/chunk-BeB57TnZ.js.map +1 -0
  108. package/dist/chunk-BecxET4U.cjs +26 -0
  109. package/dist/chunk-BecxET4U.cjs.map +1 -0
  110. package/dist/chunk-Bfuu_B7M.js +16 -0
  111. package/dist/chunk-Bfuu_B7M.js.map +1 -0
  112. package/dist/chunk-Bh4xSiDO.js +93 -0
  113. package/dist/chunk-Bh4xSiDO.js.map +1 -0
  114. package/dist/chunk-BhLItb06.js +10 -0
  115. package/dist/chunk-BhLItb06.js.map +1 -0
  116. package/dist/chunk-BhelUZ4P.js +30 -0
  117. package/dist/chunk-BhelUZ4P.js.map +1 -0
  118. package/dist/chunk-BiMRpOwB.cjs +342 -0
  119. package/dist/chunk-BiMRpOwB.cjs.map +1 -0
  120. package/dist/chunk-Bj3ium6N.cjs +22 -0
  121. package/dist/chunk-Bj3ium6N.cjs.map +1 -0
  122. package/dist/chunk-BjQzK3c3.cjs +59 -0
  123. package/dist/chunk-BjQzK3c3.cjs.map +1 -0
  124. package/dist/chunk-BkvNTXo7.cjs +15 -0
  125. package/dist/chunk-BkvNTXo7.cjs.map +1 -0
  126. package/dist/chunk-BmJDHIlZ.cjs +50 -0
  127. package/dist/chunk-BmJDHIlZ.cjs.map +1 -0
  128. package/dist/chunk-BmztanwN.cjs +13 -0
  129. package/dist/chunk-BmztanwN.cjs.map +1 -0
  130. package/dist/chunk-Bnci-ej8.cjs +262 -0
  131. package/dist/chunk-Bnci-ej8.cjs.map +1 -0
  132. package/dist/chunk-BoOw05B0.js +24 -0
  133. package/dist/chunk-BoOw05B0.js.map +1 -0
  134. package/dist/chunk-BqPxk-8w.cjs +95 -0
  135. package/dist/chunk-BqPxk-8w.cjs.map +1 -0
  136. package/dist/chunk-Br_1h4WD.cjs +15 -0
  137. package/dist/chunk-Br_1h4WD.cjs.map +1 -0
  138. package/dist/chunk-BtmcBZXU.js +13 -0
  139. package/dist/chunk-BtmcBZXU.js.map +1 -0
  140. package/dist/chunk-BvaNI_86.js +11 -0
  141. package/dist/chunk-BvaNI_86.js.map +1 -0
  142. package/dist/chunk-BvoYNlF5.js +145 -0
  143. package/dist/chunk-BvoYNlF5.js.map +1 -0
  144. package/dist/chunk-BwnCGe7J.js +268 -0
  145. package/dist/chunk-BwnCGe7J.js.map +1 -0
  146. package/dist/chunk-BxpaOkyq.cjs +310 -0
  147. package/dist/chunk-BxpaOkyq.cjs.map +1 -0
  148. package/dist/chunk-BybRyFen.cjs +65 -0
  149. package/dist/chunk-BybRyFen.cjs.map +1 -0
  150. package/dist/chunk-C-9wXKm5.cjs +83 -0
  151. package/dist/chunk-C-9wXKm5.cjs.map +1 -0
  152. package/dist/chunk-C-hV-Usi.js +7 -0
  153. package/dist/chunk-C-hV-Usi.js.map +1 -0
  154. package/dist/chunk-C06UWdDq.js +100 -0
  155. package/dist/chunk-C06UWdDq.js.map +1 -0
  156. package/dist/chunk-C1NzDn7y.cjs +35 -0
  157. package/dist/chunk-C1NzDn7y.cjs.map +1 -0
  158. package/dist/chunk-C2zEVNM1.js +20 -0
  159. package/dist/chunk-C2zEVNM1.js.map +1 -0
  160. package/dist/chunk-C3ftwoOp.js +6 -0
  161. package/dist/chunk-C3ftwoOp.js.map +1 -0
  162. package/dist/chunk-C5ZETobm.js +17 -0
  163. package/dist/chunk-C5ZETobm.js.map +1 -0
  164. package/dist/chunk-C5oCIViv.js +98 -0
  165. package/dist/chunk-C5oCIViv.js.map +1 -0
  166. package/dist/chunk-C60kC4oZ.cjs +114 -0
  167. package/dist/chunk-C60kC4oZ.cjs.map +1 -0
  168. package/dist/chunk-C6Mr3Z8L.js +59 -0
  169. package/dist/chunk-C6Mr3Z8L.js.map +1 -0
  170. package/dist/chunk-C6cBmVch.js +119 -0
  171. package/dist/chunk-C6cBmVch.js.map +1 -0
  172. package/dist/chunk-C6vKd7KP.cjs +519 -0
  173. package/dist/chunk-C6vKd7KP.cjs.map +1 -0
  174. package/dist/chunk-C7NizUxN.js +21 -0
  175. package/dist/chunk-C7NizUxN.js.map +1 -0
  176. package/dist/chunk-C93yeTAD.js +91 -0
  177. package/dist/chunk-C93yeTAD.js.map +1 -0
  178. package/dist/chunk-CByZU6Hx.cjs +90 -0
  179. package/dist/chunk-CByZU6Hx.cjs.map +1 -0
  180. package/dist/chunk-CCNIPIJB.cjs +25 -0
  181. package/dist/chunk-CCNIPIJB.cjs.map +1 -0
  182. package/dist/chunk-CEDKBew2.js +15 -0
  183. package/dist/chunk-CEDKBew2.js.map +1 -0
  184. package/dist/chunk-CI2PEZIK.js +147 -0
  185. package/dist/chunk-CI2PEZIK.js.map +1 -0
  186. package/dist/chunk-CIjPAYuo.cjs +268 -0
  187. package/dist/chunk-CIjPAYuo.cjs.map +1 -0
  188. package/dist/chunk-CJyqD6Ib.js +518 -0
  189. package/dist/chunk-CJyqD6Ib.js.map +1 -0
  190. package/dist/chunk-CNFF8fiL.js +38 -0
  191. package/dist/chunk-CNFF8fiL.js.map +1 -0
  192. package/dist/chunk-CNFoFzhK.cjs +50 -0
  193. package/dist/chunk-CNFoFzhK.cjs.map +1 -0
  194. package/dist/chunk-CQAuAPOE.cjs +63 -0
  195. package/dist/chunk-CQAuAPOE.cjs.map +1 -0
  196. package/dist/chunk-CR46E73M.js +50 -0
  197. package/dist/chunk-CR46E73M.js.map +1 -0
  198. package/dist/chunk-CSq4CbT1.js +86 -0
  199. package/dist/chunk-CSq4CbT1.js.map +1 -0
  200. package/dist/chunk-CT6i9_8G.cjs +31 -0
  201. package/dist/chunk-CT6i9_8G.cjs.map +1 -0
  202. package/dist/chunk-CUKEOil1.cjs +108 -0
  203. package/dist/chunk-CUKEOil1.cjs.map +1 -0
  204. package/dist/chunk-CWxPV2vI.js +111 -0
  205. package/dist/chunk-CWxPV2vI.js.map +1 -0
  206. package/dist/chunk-CXap-mFu.js +50 -0
  207. package/dist/chunk-CXap-mFu.js.map +1 -0
  208. package/dist/chunk-CYx1vTOG.d.ts +69 -0
  209. package/dist/chunk-CZOXtOQp.js +261 -0
  210. package/dist/chunk-CZOXtOQp.js.map +1 -0
  211. package/dist/chunk-CZSBVyE9.js +68 -0
  212. package/dist/chunk-CZSBVyE9.js.map +1 -0
  213. package/dist/chunk-C_NZdnA3.cjs +57 -0
  214. package/dist/chunk-C_NZdnA3.cjs.map +1 -0
  215. package/dist/chunk-C_k4SxhD.js +245 -0
  216. package/dist/chunk-C_k4SxhD.js.map +1 -0
  217. package/dist/chunk-CaTeIppS.cjs +115 -0
  218. package/dist/chunk-CaTeIppS.cjs.map +1 -0
  219. package/dist/chunk-CaUCI-WV.cjs +69 -0
  220. package/dist/chunk-CaUCI-WV.cjs.map +1 -0
  221. package/dist/chunk-CblkEI9o.js +19 -0
  222. package/dist/chunk-CblkEI9o.js.map +1 -0
  223. package/dist/chunk-CcXeCiEQ.js +70 -0
  224. package/dist/chunk-CcXeCiEQ.js.map +1 -0
  225. package/dist/chunk-Ce4D2B8W.cjs +49 -0
  226. package/dist/chunk-Ce4D2B8W.cjs.map +1 -0
  227. package/dist/chunk-CetxbYL1.js +66 -0
  228. package/dist/chunk-CetxbYL1.js.map +1 -0
  229. package/dist/chunk-ClfU9elo.js +68 -0
  230. package/dist/chunk-ClfU9elo.js.map +1 -0
  231. package/dist/chunk-CmNHE_Un.cjs +4 -0
  232. package/dist/chunk-Cmb_XLfd.js +82 -0
  233. package/dist/chunk-Cmb_XLfd.js.map +1 -0
  234. package/dist/chunk-Cp26IdF1.js +72 -0
  235. package/dist/chunk-Cp26IdF1.js.map +1 -0
  236. package/dist/chunk-CsBkSCbR.cjs +92 -0
  237. package/dist/chunk-CsBkSCbR.cjs.map +1 -0
  238. package/dist/chunk-CsnIpELM.js +31 -0
  239. package/dist/chunk-CsnIpELM.js.map +1 -0
  240. package/dist/chunk-CsnJv55G.cjs +36 -0
  241. package/dist/chunk-CsnJv55G.cjs.map +1 -0
  242. package/dist/chunk-CsxHDVHF.cjs +68 -0
  243. package/dist/chunk-CsxHDVHF.cjs.map +1 -0
  244. package/dist/chunk-Cv1FyWmK.js +670 -0
  245. package/dist/chunk-Cv1FyWmK.js.map +1 -0
  246. package/dist/chunk-CwXRQ-3X.cjs +2238 -0
  247. package/dist/chunk-CwXRQ-3X.cjs.map +1 -0
  248. package/dist/chunk-CxC9GaSV.js +6 -0
  249. package/dist/chunk-CxC9GaSV.js.map +1 -0
  250. package/dist/chunk-CyDQK1JF.js +22 -0
  251. package/dist/chunk-CyDQK1JF.js.map +1 -0
  252. package/dist/chunk-CyFo-C-X.js +341 -0
  253. package/dist/chunk-CyFo-C-X.js.map +1 -0
  254. package/dist/chunk-CzGWcm8C.cjs +109 -0
  255. package/dist/chunk-CzGWcm8C.cjs.map +1 -0
  256. package/dist/chunk-D0Cmheqq.cjs +25 -0
  257. package/dist/chunk-D0Cmheqq.cjs.map +1 -0
  258. package/dist/chunk-D0VevtWq.cjs +13 -0
  259. package/dist/chunk-D0VevtWq.cjs.map +1 -0
  260. package/dist/chunk-D1HIZ09h.d.cts +22 -0
  261. package/dist/chunk-D1HIZ09h.d.ts +22 -0
  262. package/dist/chunk-D1PwxEEq.cjs +281 -0
  263. package/dist/chunk-D1PwxEEq.cjs.map +1 -0
  264. package/dist/chunk-D2BipKyx.d.cts +69 -0
  265. package/dist/chunk-D4g36nrI.d.ts +963 -0
  266. package/dist/chunk-D5vZKs5k.js +85 -0
  267. package/dist/chunk-D5vZKs5k.js.map +1 -0
  268. package/dist/chunk-D7XBi__G.js +17 -0
  269. package/dist/chunk-D7XBi__G.js.map +1 -0
  270. package/dist/chunk-D8TsKfym.cjs +35 -0
  271. package/dist/chunk-D8TsKfym.cjs.map +1 -0
  272. package/dist/chunk-D8r50zRF.cjs +4 -0
  273. package/dist/chunk-DAAlHzRS.js +2 -0
  274. package/dist/chunk-DBY6OSNP.js +13 -0
  275. package/dist/chunk-DBY6OSNP.js.map +1 -0
  276. package/dist/chunk-DBfZJAh3.js +146 -0
  277. package/dist/chunk-DBfZJAh3.js.map +1 -0
  278. package/dist/chunk-DBpF1Eur.cjs +69 -0
  279. package/dist/chunk-DBpF1Eur.cjs.map +1 -0
  280. package/dist/chunk-DCvhBL80.js +9 -0
  281. package/dist/chunk-DCvhBL80.js.map +1 -0
  282. package/dist/chunk-DDNoqMiU.cjs +12 -0
  283. package/dist/chunk-DDNoqMiU.cjs.map +1 -0
  284. package/dist/chunk-DEpLX45Z.cjs +25 -0
  285. package/dist/chunk-DEpLX45Z.cjs.map +1 -0
  286. package/dist/chunk-DFw3I0U0.cjs +19 -0
  287. package/dist/chunk-DFw3I0U0.cjs.map +1 -0
  288. package/dist/chunk-DJOkmY4u.cjs +36 -0
  289. package/dist/chunk-DJOkmY4u.cjs.map +1 -0
  290. package/dist/chunk-DJQsem2x.js +1128 -0
  291. package/dist/chunk-DJQsem2x.js.map +1 -0
  292. package/dist/chunk-DKNcYR4L.cjs +71 -0
  293. package/dist/chunk-DKNcYR4L.cjs.map +1 -0
  294. package/dist/chunk-DL4Q5WpP.cjs +19 -0
  295. package/dist/chunk-DL4Q5WpP.cjs.map +1 -0
  296. package/dist/chunk-DLt13wEh.js +279 -0
  297. package/dist/chunk-DLt13wEh.js.map +1 -0
  298. package/dist/chunk-DPvFDS5n.cjs +31 -0
  299. package/dist/chunk-DPvFDS5n.cjs.map +1 -0
  300. package/dist/chunk-DQ4l6EDZ.js +1728 -0
  301. package/dist/chunk-DQ4l6EDZ.js.map +1 -0
  302. package/dist/chunk-DQ_X9yhT.cjs +21 -0
  303. package/dist/chunk-DQ_X9yhT.cjs.map +1 -0
  304. package/dist/chunk-DQbbL87b.cjs +57 -0
  305. package/dist/chunk-DQbbL87b.cjs.map +1 -0
  306. package/dist/chunk-DRphChLx.js +15 -0
  307. package/dist/chunk-DRphChLx.js.map +1 -0
  308. package/dist/chunk-DSsTHBp4.js +62 -0
  309. package/dist/chunk-DSsTHBp4.js.map +1 -0
  310. package/dist/chunk-DVI59otQ.js +20 -0
  311. package/dist/chunk-DVI59otQ.js.map +1 -0
  312. package/dist/chunk-DVN4tYVL.cjs +235 -0
  313. package/dist/chunk-DVN4tYVL.cjs.map +1 -0
  314. package/dist/chunk-DWxCDSxn.cjs +36 -0
  315. package/dist/chunk-DWxCDSxn.cjs.map +1 -0
  316. package/dist/chunk-DXMaeZs_.cjs +135 -0
  317. package/dist/chunk-DXMaeZs_.cjs.map +1 -0
  318. package/dist/chunk-D_dPThBm.js +44 -0
  319. package/dist/chunk-D_dPThBm.js.map +1 -0
  320. package/dist/chunk-DbW3lF5Y.cjs +55 -0
  321. package/dist/chunk-DbW3lF5Y.cjs.map +1 -0
  322. package/dist/chunk-Dc0Robe4.cjs +254 -0
  323. package/dist/chunk-Dc0Robe4.cjs.map +1 -0
  324. package/dist/chunk-DcLLI7B1.cjs +16 -0
  325. package/dist/chunk-DcLLI7B1.cjs.map +1 -0
  326. package/dist/chunk-Dd9K8OSs.js +73 -0
  327. package/dist/chunk-Dd9K8OSs.js.map +1 -0
  328. package/dist/chunk-DeFJnC-Q.js +52 -0
  329. package/dist/chunk-DeFJnC-Q.js.map +1 -0
  330. package/dist/chunk-DeggaLXL.cjs +109 -0
  331. package/dist/chunk-DeggaLXL.cjs.map +1 -0
  332. package/dist/chunk-DetGuqR8.cjs +12 -0
  333. package/dist/chunk-DetGuqR8.cjs.map +1 -0
  334. package/dist/chunk-Df761BAX.cjs +4 -0
  335. package/dist/chunk-DfQZch7H.cjs +60 -0
  336. package/dist/chunk-DfQZch7H.cjs.map +1 -0
  337. package/dist/chunk-DhwoAmi8.cjs +77 -0
  338. package/dist/chunk-DhwoAmi8.cjs.map +1 -0
  339. package/dist/chunk-DkH1DKxi.cjs +66 -0
  340. package/dist/chunk-DkH1DKxi.cjs.map +1 -0
  341. package/dist/chunk-DkjkI8F5.cjs +150 -0
  342. package/dist/chunk-DkjkI8F5.cjs.map +1 -0
  343. package/dist/chunk-DlaVYkP2.cjs +23 -0
  344. package/dist/chunk-DlaVYkP2.cjs.map +1 -0
  345. package/dist/chunk-DlcsA1GQ.js +6 -0
  346. package/dist/chunk-DlcsA1GQ.js.map +1 -0
  347. package/dist/chunk-DmBkJhi_.js +8 -0
  348. package/dist/chunk-DmBkJhi_.js.map +1 -0
  349. package/dist/chunk-DnXjnOQ1.cjs +42 -0
  350. package/dist/chunk-DnXjnOQ1.cjs.map +1 -0
  351. package/dist/chunk-DrG9yz7c.js +509 -0
  352. package/dist/chunk-DrG9yz7c.js.map +1 -0
  353. package/dist/chunk-DsTU_5Be.js +96 -0
  354. package/dist/chunk-DsTU_5Be.js.map +1 -0
  355. package/dist/chunk-DsXj9iLu.cjs +1827 -0
  356. package/dist/chunk-DsXj9iLu.cjs.map +1 -0
  357. package/dist/chunk-DteUy52S.js +45 -0
  358. package/dist/chunk-DteUy52S.js.map +1 -0
  359. package/dist/chunk-DtvsE56k.cjs +12 -0
  360. package/dist/chunk-DtvsE56k.cjs.map +1 -0
  361. package/dist/chunk-DuD5YqoE.cjs +99 -0
  362. package/dist/chunk-DuD5YqoE.cjs.map +1 -0
  363. package/dist/chunk-DvrtQ0Y0.js +51 -0
  364. package/dist/chunk-DvrtQ0Y0.js.map +1 -0
  365. package/dist/chunk-DwUFwDV2.js +144 -0
  366. package/dist/chunk-DwUFwDV2.js.map +1 -0
  367. package/dist/chunk-Dy59Tdfm.cjs +67 -0
  368. package/dist/chunk-Dy59Tdfm.cjs.map +1 -0
  369. package/dist/chunk-DyJupG9U.cjs +74 -0
  370. package/dist/chunk-DyJupG9U.cjs.map +1 -0
  371. package/dist/chunk-DzCbinPo.js +9 -0
  372. package/dist/chunk-DzCbinPo.js.map +1 -0
  373. package/dist/chunk-GgcOmaXu.cjs +137 -0
  374. package/dist/chunk-GgcOmaXu.cjs.map +1 -0
  375. package/dist/chunk-GnVcZTQv.cjs +50 -0
  376. package/dist/chunk-GnVcZTQv.cjs.map +1 -0
  377. package/dist/chunk-JDLVWYk5.cjs +22 -0
  378. package/dist/chunk-JDLVWYk5.cjs.map +1 -0
  379. package/dist/chunk-NA04sFmY.js +2 -0
  380. package/dist/chunk-NqIZvB2L.js +44 -0
  381. package/dist/chunk-NqIZvB2L.js.map +1 -0
  382. package/dist/chunk-OGNas_Mn.cjs +654 -0
  383. package/dist/chunk-OGNas_Mn.cjs.map +1 -0
  384. package/dist/chunk-PeexRooj.cjs +12 -0
  385. package/dist/chunk-PeexRooj.cjs.map +1 -0
  386. package/dist/chunk-QUjeQKsz.js +26 -0
  387. package/dist/chunk-QUjeQKsz.js.map +1 -0
  388. package/dist/chunk-S0jc_E9W.cjs +62 -0
  389. package/dist/chunk-S0jc_E9W.cjs.map +1 -0
  390. package/dist/chunk-TLRG-UaM.js +453 -0
  391. package/dist/chunk-TLRG-UaM.js.map +1 -0
  392. package/dist/chunk-TYmd7TzW.cjs +68 -0
  393. package/dist/chunk-TYmd7TzW.cjs.map +1 -0
  394. package/dist/chunk-TlHnQSY_.js +250 -0
  395. package/dist/chunk-TlHnQSY_.js.map +1 -0
  396. package/dist/chunk-Vba_029j.js +36 -0
  397. package/dist/chunk-Vba_029j.js.map +1 -0
  398. package/dist/chunk-Vp0uJb7O.cjs +92 -0
  399. package/dist/chunk-Vp0uJb7O.cjs.map +1 -0
  400. package/dist/chunk-WPGdcwtf.cjs +15 -0
  401. package/dist/chunk-WPGdcwtf.cjs.map +1 -0
  402. package/dist/chunk-WUipjqNN.cjs +158 -0
  403. package/dist/chunk-WUipjqNN.cjs.map +1 -0
  404. package/dist/chunk-Y-zyJ0-m.js +6 -0
  405. package/dist/chunk-Y-zyJ0-m.js.map +1 -0
  406. package/dist/chunk-ZIIlDASG.js +94 -0
  407. package/dist/chunk-ZIIlDASG.js.map +1 -0
  408. package/dist/chunk-ZLDg2I1Z.js +6 -0
  409. package/dist/chunk-ZLDg2I1Z.js.map +1 -0
  410. package/dist/chunk-_jSTl9gW.cjs +1129 -0
  411. package/dist/chunk-_jSTl9gW.cjs.map +1 -0
  412. package/dist/chunk-b5CqEoo1.cjs +599 -0
  413. package/dist/chunk-b5CqEoo1.cjs.map +1 -0
  414. package/dist/chunk-bA-2OGXv.d.ts +3977 -0
  415. package/dist/chunk-bvwC3n0z.cjs +12 -0
  416. package/dist/chunk-bvwC3n0z.cjs.map +1 -0
  417. package/dist/chunk-cMQzXXQq.js +67 -0
  418. package/dist/chunk-cMQzXXQq.js.map +1 -0
  419. package/dist/chunk-cTRnGhbF.cjs +177 -0
  420. package/dist/chunk-cTRnGhbF.cjs.map +1 -0
  421. package/dist/chunk-dHKPMJ4D.js +85 -0
  422. package/dist/chunk-dHKPMJ4D.js.map +1 -0
  423. package/dist/chunk-d_BOXcT5.js +9 -0
  424. package/dist/chunk-d_BOXcT5.js.map +1 -0
  425. package/dist/chunk-ea1IbBcA.js +66 -0
  426. package/dist/chunk-ea1IbBcA.js.map +1 -0
  427. package/dist/chunk-f-dHVrF3.js +293 -0
  428. package/dist/chunk-f-dHVrF3.js.map +1 -0
  429. package/dist/chunk-h7Z5mAV_.cjs +41 -0
  430. package/dist/chunk-h7Z5mAV_.cjs.map +1 -0
  431. package/dist/chunk-jSgMzVr1.js +35 -0
  432. package/dist/chunk-jSgMzVr1.js.map +1 -0
  433. package/dist/chunk-kYE5SZgs.cjs +252 -0
  434. package/dist/chunk-kYE5SZgs.cjs.map +1 -0
  435. package/dist/chunk-lEnNKG6x.cjs +285 -0
  436. package/dist/chunk-lEnNKG6x.cjs.map +1 -0
  437. package/dist/chunk-lcml1N1G.js +11 -0
  438. package/dist/chunk-lcml1N1G.js.map +1 -0
  439. package/dist/chunk-nBK0qBXt.js +68 -0
  440. package/dist/chunk-nBK0qBXt.js.map +1 -0
  441. package/dist/chunk-njoANlUr.cjs +41 -0
  442. package/dist/chunk-njoANlUr.cjs.map +1 -0
  443. package/dist/chunk-nwutfrnH.cjs +430 -0
  444. package/dist/chunk-nwutfrnH.cjs.map +1 -0
  445. package/dist/chunk-o1EKuTLo.js +56 -0
  446. package/dist/chunk-o1EKuTLo.js.map +1 -0
  447. package/dist/chunk-oMFOZSQM.cjs +52 -0
  448. package/dist/chunk-oMFOZSQM.cjs.map +1 -0
  449. package/dist/chunk-pb64dLGD.cjs +682 -0
  450. package/dist/chunk-pb64dLGD.cjs.map +1 -0
  451. package/dist/chunk-s7kBzSlt.js +2 -0
  452. package/dist/chunk-uhXxE8xV.cjs +32 -0
  453. package/dist/chunk-uhXxE8xV.cjs.map +1 -0
  454. package/dist/chunk-vGzpsUSM.cjs +110 -0
  455. package/dist/chunk-vGzpsUSM.cjs.map +1 -0
  456. package/dist/chunk-vN_Di8Af.cjs +1890 -0
  457. package/dist/chunk-vN_Di8Af.cjs.map +1 -0
  458. package/dist/chunk-veLShVmw.js +41 -0
  459. package/dist/chunk-veLShVmw.js.map +1 -0
  460. package/dist/chunk-wTf5jOFv.js +253 -0
  461. package/dist/chunk-wTf5jOFv.js.map +1 -0
  462. package/dist/chunk-yO-Ek9RH.cjs +17 -0
  463. package/dist/chunk-yO-Ek9RH.cjs.map +1 -0
  464. package/dist/chunk-ye5UUSFw.js +280 -0
  465. package/dist/chunk-ye5UUSFw.js.map +1 -0
  466. package/dist/copilot/index.cjs +10 -0
  467. package/dist/copilot/index.d.cts +62 -0
  468. package/dist/copilot/index.d.ts +62 -0
  469. package/dist/copilot/index.js +4 -0
  470. package/dist/embed/index.cjs +1653 -0
  471. package/dist/embed/index.cjs.map +1 -0
  472. package/dist/embed/index.d.cts +291 -0
  473. package/dist/embed/index.d.ts +291 -0
  474. package/dist/embed/index.js +1643 -0
  475. package/dist/embed/index.js.map +1 -0
  476. package/dist/headless/index.cjs +126 -0
  477. package/dist/headless/index.d.cts +4 -0
  478. package/dist/headless/index.d.ts +4 -0
  479. package/dist/headless/index.js +29 -0
  480. package/dist/import/index.cjs +403 -0
  481. package/dist/import/index.cjs.map +1 -0
  482. package/dist/import/index.d.cts +160 -0
  483. package/dist/import/index.d.ts +160 -0
  484. package/dist/import/index.js +393 -0
  485. package/dist/import/index.js.map +1 -0
  486. package/dist/index.cjs +8991 -0
  487. package/dist/index.cjs.map +1 -0
  488. package/dist/index.d.cts +4847 -0
  489. package/dist/index.d.ts +4847 -0
  490. package/dist/index.js +8768 -0
  491. package/dist/index.js.map +1 -0
  492. package/dist/map/index.cjs +36 -0
  493. package/dist/map/index.d.cts +2 -0
  494. package/dist/map/index.d.ts +2 -0
  495. package/dist/map/index.js +2 -0
  496. package/dist/styles.css +14684 -0
  497. package/dist/testing/index.cjs +398 -0
  498. package/dist/testing/index.cjs.map +1 -0
  499. package/dist/testing/index.d.cts +302 -0
  500. package/dist/testing/index.d.ts +302 -0
  501. package/dist/testing/index.js +382 -0
  502. package/dist/testing/index.js.map +1 -0
  503. package/dist/video/index.cjs +8 -0
  504. package/dist/video/index.d.cts +122 -0
  505. package/dist/video/index.d.ts +122 -0
  506. package/dist/video/index.js +2 -0
  507. package/package.json +226 -4
  508. package/src/agent/components/ActivityRow.tsx +226 -0
  509. package/src/agent/components/AgentEntityIndicator.tsx +67 -0
  510. package/src/agent/components/AgentMarkdown.tsx +530 -0
  511. package/src/agent/components/ChatComposer.tsx +161 -0
  512. package/src/agent/components/ChatTranscript.tsx +1358 -0
  513. package/src/agent/components/CopilotPanel.tsx +415 -0
  514. package/src/agent/components/CopilotStates.tsx +238 -0
  515. package/src/agent/components/CopilotTranscript.tsx +191 -0
  516. package/src/agent/components/MessageFeedback.tsx +100 -0
  517. package/src/agent/hooks/useAgentChatTransport.ts +61 -0
  518. package/src/agent/hooks/useAgentErrorCopy.ts +27 -0
  519. package/src/agent/hooks/useCopilotOpen.ts +68 -0
  520. package/src/agent/providers/AgentThreadsProvider.tsx +360 -0
  521. package/src/agent/providers/PromptPanelConversation.tsx +135 -0
  522. package/src/agent/rules/drawnNode.ts +24 -0
  523. package/src/alerts/components/MapAlerts.tsx +127 -0
  524. package/src/cache/hooks/useStudioCache.ts +40 -0
  525. package/src/cache/rules/studioCache.ts +145 -0
  526. package/src/collab/components/PeerEntityIndicator.tsx +150 -0
  527. package/src/collab/components/PresenceRoster.tsx +113 -0
  528. package/src/collab/components/peerLock.tsx +59 -0
  529. package/src/collab/hooks/useCollabOrganizationId.ts +24 -0
  530. package/src/collab/hooks/usePeerLockLabel.ts +41 -0
  531. package/src/collections/components/CollectionFormModal.tsx +280 -0
  532. package/src/collections/components/CollectionMultiSelect.tsx +640 -0
  533. package/src/collections/components/EditCollectionModal.tsx +114 -0
  534. package/src/collections/components/ManageCollectionsModal.tsx +692 -0
  535. package/src/collections/components/NewCollectionModal.tsx +87 -0
  536. package/src/collections/components/ShareCollectionModal.tsx +150 -0
  537. package/src/collections/hooks/useEntityCollections.ts +126 -0
  538. package/src/collections/hooks/useEveryPage.ts +33 -0
  539. package/src/controls/components/MapControlTooltip.tsx +84 -0
  540. package/src/controls/components/PoiOverlayMenu.tsx +342 -0
  541. package/src/controls/components/StudioControls.tsx +278 -0
  542. package/src/controls/rules/constants.ts +34 -0
  543. package/src/copilot/hooks/useStudioCopilotInset.ts +39 -0
  544. package/src/copilot/index.ts +29 -0
  545. package/src/directions/components/DirectionsModal.tsx +447 -0
  546. package/src/directions/components/directionsPdf.tsx +549 -0
  547. package/src/embed/components/DefaultViewControl.tsx +159 -0
  548. package/src/embed/components/EmbedBaseMapPicker.tsx +107 -0
  549. package/src/embed/components/EmbedCodeSection.tsx +329 -0
  550. package/src/embed/components/EmbedColumnsSection.tsx +167 -0
  551. package/src/embed/components/EmbedConfigForm.tsx +239 -0
  552. package/src/embed/components/EmbedElementSwitcher.tsx +85 -0
  553. package/src/embed/components/EmbedFieldControl.tsx +488 -0
  554. package/src/embed/components/EmbedGeneralSection.tsx +279 -0
  555. package/src/embed/components/EmbedKeyPanel.tsx +138 -0
  556. package/src/embed/components/EmbedSnippetCode.tsx +154 -0
  557. package/src/embed/components/EmbedStage.tsx +505 -0
  558. package/src/embed/components/EmbedTablePreview.tsx +134 -0
  559. package/src/embed/components/EmbedThemePicker.tsx +74 -0
  560. package/src/embed/components/EmbedTintPicker.tsx +76 -0
  561. package/src/embed/components/EmbedWizard.tsx +1031 -0
  562. package/src/embed/hooks/useEmbedCode.ts +170 -0
  563. package/src/embed/hooks/useEmbedCollectionItineraries.ts +42 -0
  564. package/src/embed/hooks/useEmbedLayerOptions.ts +75 -0
  565. package/src/embed/hooks/useEmbedPreviewCamera.ts +169 -0
  566. package/src/embed/index.ts +42 -0
  567. package/src/fullscreen/components/FullscreenHeader.tsx +77 -0
  568. package/src/fullscreen/components/FullscreenModal.tsx +80 -0
  569. package/src/fullscreen/components/WizardLayout.tsx +129 -0
  570. package/src/guards/components/AgentDrivingGuard.tsx +59 -0
  571. package/src/guards/components/UnsavedEditsGuard.tsx +210 -0
  572. package/src/guards/hooks/useReportUnsavedForm.ts +34 -0
  573. package/src/guards/hooks/useUnsavedEditsGuard.ts +44 -0
  574. package/src/headless/hooks/useAgentDriving.ts +21 -0
  575. package/src/headless/hooks/useBeginSegmentEdit.ts +89 -0
  576. package/src/headless/hooks/useBeginWaypointEdit.ts +74 -0
  577. package/src/headless/hooks/useCapabilitySet.ts +65 -0
  578. package/src/headless/hooks/useCollabResources.ts +148 -0
  579. package/src/headless/hooks/useCollectionScope.ts +37 -0
  580. package/src/headless/hooks/useEditActions.ts +250 -0
  581. package/src/headless/hooks/useEscapeKey.ts +43 -0
  582. package/src/headless/hooks/useInlineRename.ts +276 -0
  583. package/src/headless/hooks/useLiveAwareSegments.ts +88 -0
  584. package/src/headless/hooks/useLiveAwareWaypoints.ts +39 -0
  585. package/src/headless/hooks/useMapHoveredRow.ts +76 -0
  586. package/src/headless/hooks/usePlatformViewer.ts +452 -0
  587. package/src/headless/hooks/usePluginSlot.ts +235 -0
  588. package/src/headless/hooks/useRowEmphasis.ts +66 -0
  589. package/src/headless/hooks/useSegmentList.ts +428 -0
  590. package/src/headless/hooks/useSegmentRow.ts +370 -0
  591. package/src/headless/hooks/useSegmentRowActions.ts +267 -0
  592. package/src/headless/hooks/useShallowSelector.ts +145 -0
  593. package/src/headless/hooks/useStableMembers.ts +74 -0
  594. package/src/headless/hooks/useStoreSlice.ts +52 -0
  595. package/src/headless/hooks/useStreetViewCorridor.ts +120 -0
  596. package/src/headless/hooks/useStudioApi.ts +18 -0
  597. package/src/headless/hooks/useStudioDispatch.ts +180 -0
  598. package/src/headless/hooks/useStudioDispatchCount.ts +147 -0
  599. package/src/headless/hooks/useStudioDispatchUnsafe.ts +111 -0
  600. package/src/headless/hooks/useStudioEntitlement.ts +29 -0
  601. package/src/headless/hooks/useStudioFailureAlert.ts +67 -0
  602. package/src/headless/hooks/useStudioObserve.ts +38 -0
  603. package/src/headless/hooks/useStudioPreferences.ts +8 -0
  604. package/src/headless/hooks/useStudioSignedIn.ts +12 -0
  605. package/src/headless/hooks/useStudioStore.ts +72 -0
  606. package/src/headless/hooks/useStudioUnits.ts +23 -0
  607. package/src/headless/hooks/useStudioUrl.ts +24 -0
  608. package/src/headless/hooks/useStudioUserId.ts +5 -0
  609. package/src/headless/hooks/useStudioVerbHeld.ts +43 -0
  610. package/src/headless/hooks/useStudioViewer.ts +19 -0
  611. package/src/headless/hooks/useStudioViewerEntitlement.ts +40 -0
  612. package/src/headless/hooks/useStudioViewerItineraryLimit.ts +34 -0
  613. package/src/headless/hooks/useStudioViewerPreferences.ts +44 -0
  614. package/src/headless/hooks/useStudioViewerUnits.ts +50 -0
  615. package/src/headless/hooks/useStudioViewerUserId.ts +23 -0
  616. package/src/headless/hooks/useUiStore.ts +91 -0
  617. package/src/headless/hooks/useUiStoreShallow.ts +43 -0
  618. package/src/headless/hooks/useWaypointDetailsDialog.ts +52 -0
  619. package/src/headless/hooks/useWaypointList.ts +89 -0
  620. package/src/headless/hooks/useWaypointRow.ts +229 -0
  621. package/src/headless/hooks/useWaypointRowActions.ts +166 -0
  622. package/src/headless/index.ts +287 -0
  623. package/src/headless/providers/billingGate.tsx +129 -0
  624. package/src/headless/providers/copilot.tsx +155 -0
  625. package/src/headless/providers/mountayaStudio.tsx +127 -0
  626. package/src/headless/providers/navigationBlocker.tsx +91 -0
  627. package/src/headless/providers/notify.tsx +36 -0
  628. package/src/headless/providers/organizations.tsx +267 -0
  629. package/src/headless/providers/plugins.tsx +173 -0
  630. package/src/headless/providers/studio.tsx +1296 -0
  631. package/src/headless/providers/studioStrings.tsx +243 -0
  632. package/src/headless/rules/inputMethod.ts +19 -0
  633. package/src/hooks/useAgreementLimits.ts +165 -0
  634. package/src/hooks/useLayerCatalogOptions.ts +106 -0
  635. package/src/host/components/MountayaStudioHost.tsx +1018 -0
  636. package/src/host/hooks/useEmbeddedStudio.ts +24 -0
  637. package/src/host/hooks/useItineraryActivation.ts +126 -0
  638. package/src/host/hooks/useMemberGrants.ts +51 -0
  639. package/src/host/hooks/useStudioHostSurfaces.ts +100 -0
  640. package/src/host/hooks/useStudioPluginBinding.ts +133 -0
  641. package/src/host/hooks/useStudioSessionHeld.ts +111 -0
  642. package/src/host/hooks/useStudioToolBus.ts +127 -0
  643. package/src/host/hooks/useStudioToolContext.ts +175 -0
  644. package/src/host/providers/hostRegistry.tsx +144 -0
  645. package/src/host/providers/hostSurface.tsx +47 -0
  646. package/src/host/providers/hostVideo.tsx +73 -0
  647. package/src/import/components/DraftEntityList.tsx +298 -0
  648. package/src/import/components/FileDropInput.tsx +261 -0
  649. package/src/import/components/FileDropzone.tsx +97 -0
  650. package/src/import/components/ImportItineraryContent.tsx +133 -0
  651. package/src/import/components/ImportPreviewLegend.tsx +50 -0
  652. package/src/import/components/ImportPrimer.tsx +113 -0
  653. package/src/import/index.ts +32 -0
  654. package/src/import/providers/ImportRoutingGuideProvider.tsx +319 -0
  655. package/src/import/rules/routingGuidePictures.ts +20 -0
  656. package/src/index.ts +594 -0
  657. package/src/internal/components/Glyph.tsx +34 -0
  658. package/src/internal/components/MarkerGlyph.tsx +23 -0
  659. package/src/internal/components/MountayaMark.tsx +142 -0
  660. package/src/internal/hooks/useTextOverflow.ts +90 -0
  661. package/src/internal/providers/studioEditorRoot.tsx +42 -0
  662. package/src/internal/rules/editorRoot.ts +9 -0
  663. package/src/internal/rules/missingSeam.ts +32 -0
  664. package/src/itinerary/components/ActivityGuideModal.tsx +345 -0
  665. package/src/itinerary/components/ActivitySelect.tsx +204 -0
  666. package/src/itinerary/components/AddWaypointButton.tsx +151 -0
  667. package/src/itinerary/components/AscentInput.tsx +65 -0
  668. package/src/itinerary/components/Characteristics.tsx +129 -0
  669. package/src/itinerary/components/CursorReadout.tsx +66 -0
  670. package/src/itinerary/components/DistanceInput.tsx +67 -0
  671. package/src/itinerary/components/DraftProvenanceBanner.tsx +79 -0
  672. package/src/itinerary/components/DuplicateItineraryModal.tsx +341 -0
  673. package/src/itinerary/components/EditorSaveFooter.tsx +424 -0
  674. package/src/itinerary/components/ItineraryActionsMenu.tsx +655 -0
  675. package/src/itinerary/components/ItineraryForm.tsx +887 -0
  676. package/src/itinerary/components/ItineraryHeaderIdentity.tsx +121 -0
  677. package/src/itinerary/components/ItineraryHeaderMeta.tsx +68 -0
  678. package/src/itinerary/components/ItineraryHeaderTitle.tsx +88 -0
  679. package/src/itinerary/components/ItineraryIdentityFields.tsx +153 -0
  680. package/src/itinerary/components/ItineraryProfilePanel.tsx +619 -0
  681. package/src/itinerary/components/ItineraryProfileSheet.tsx +219 -0
  682. package/src/itinerary/components/ItinerarySubHeader.tsx +236 -0
  683. package/src/itinerary/components/PendingProfile.tsx +142 -0
  684. package/src/itinerary/components/PlaceCard.tsx +35 -0
  685. package/src/itinerary/components/PlaceMark.tsx +76 -0
  686. package/src/itinerary/components/ProfileAnalysisBars.tsx +84 -0
  687. package/src/itinerary/components/ProfileBar.tsx +215 -0
  688. package/src/itinerary/components/ProfileHeaderControls.tsx +116 -0
  689. package/src/itinerary/components/ProfileHeaderFigures.tsx +119 -0
  690. package/src/itinerary/components/ProfilePaceControl.tsx +97 -0
  691. package/src/itinerary/components/ProfileStat.tsx +76 -0
  692. package/src/itinerary/components/ProfileStatStrip.tsx +38 -0
  693. package/src/itinerary/components/RoadAccessModal.tsx +76 -0
  694. package/src/itinerary/components/RouteTypeControl.tsx +73 -0
  695. package/src/itinerary/components/SegmentGroupModal.tsx +312 -0
  696. package/src/itinerary/components/SegmentGroupRangePicker.tsx +228 -0
  697. package/src/itinerary/components/StagingCreateFooter.tsx +185 -0
  698. package/src/itinerary/components/StudioItineraryProfile.tsx +620 -0
  699. package/src/itinerary/components/SuggestForm.tsx +256 -0
  700. package/src/itinerary/components/SuggestFormActions.tsx +124 -0
  701. package/src/itinerary/components/SuggestionResultRow.tsx +98 -0
  702. package/src/itinerary/components/SuggestionResultsList.tsx +85 -0
  703. package/src/itinerary/components/WaypointAmenityPicker.tsx +105 -0
  704. package/src/itinerary/components/WaypointDetailFields.tsx +604 -0
  705. package/src/itinerary/components/WaypointDetailsModal.tsx +134 -0
  706. package/src/itinerary/components/WaypointDetailsRows.tsx +707 -0
  707. package/src/itinerary/components/WaypointDetailsView.tsx +389 -0
  708. package/src/itinerary/components/WaypointIconCircle.tsx +211 -0
  709. package/src/itinerary/components/WaypointIconPicker.tsx +82 -0
  710. package/src/itinerary/components/WaypointMarkers.tsx +293 -0
  711. package/src/itinerary/components/WaypointPreviewCard.tsx +56 -0
  712. package/src/itinerary/components/WaypointSectionNav.tsx +151 -0
  713. package/src/itinerary/components/WaypointSwitcher.tsx +143 -0
  714. package/src/itinerary/components/WaypointWorkbench.tsx +263 -0
  715. package/src/itinerary/hooks/useDuplicateDraft.ts +205 -0
  716. package/src/itinerary/hooks/useDuplicateSource.ts +69 -0
  717. package/src/itinerary/hooks/useFriendlyNameBanks.ts +26 -0
  718. package/src/itinerary/hooks/useItineraryEditable.ts +89 -0
  719. package/src/itinerary/hooks/useItineraryPace.ts +104 -0
  720. package/src/itinerary/hooks/useItinerarySubject.ts +117 -0
  721. package/src/itinerary/hooks/useOpenItineraryEditable.ts +39 -0
  722. package/src/itinerary/hooks/useProfileOverlay.tsx +61 -0
  723. package/src/itinerary/hooks/useProfileSeries.ts +95 -0
  724. package/src/itinerary/hooks/useProfileVisibility.ts +149 -0
  725. package/src/itinerary/hooks/useSeedDraftOrganization.ts +85 -0
  726. package/src/itinerary/hooks/useSegmentGroupSave.ts +143 -0
  727. package/src/itinerary/hooks/useStartFromSuggestion.ts +63 -0
  728. package/src/itinerary/hooks/useStudioItinerary.ts +35 -0
  729. package/src/itinerary/hooks/useSuggestionPin.ts +36 -0
  730. package/src/itinerary/hooks/useWaypointCardWords.ts +51 -0
  731. package/src/itinerary/hooks/useWaypointCreateFollowUp.ts +158 -0
  732. package/src/itinerary/hooks/useWaypointDetailsEditor.ts +280 -0
  733. package/src/itinerary/hooks/useWaypointSectionEntries.ts +114 -0
  734. package/src/itinerary/providers/ActivityGuideProvider.tsx +113 -0
  735. package/src/itinerary/providers/ItineraryViewProvider.tsx +146 -0
  736. package/src/itinerary/rules/amenityGlyphs.ts +25 -0
  737. package/src/itinerary/rules/cursorReadoutData.ts +34 -0
  738. package/src/itinerary/rules/profileCursor.ts +11 -0
  739. package/src/itinerary/rules/profileModel.ts +98 -0
  740. package/src/itinerary/rules/shownFocus.ts +11 -0
  741. package/src/itinerary/rules/waypointGlyphs.ts +42 -0
  742. package/src/itinerary/stores/profileHover.ts +54 -0
  743. package/src/lists/components/AddSegmentButton.tsx +240 -0
  744. package/src/lists/components/EditActions.tsx +153 -0
  745. package/src/lists/components/EditorListSection.tsx +117 -0
  746. package/src/lists/components/EditorSegmentRow.tsx +458 -0
  747. package/src/lists/components/ItineraryAddSegmentButton.tsx +66 -0
  748. package/src/lists/components/ItinerarySegmentList.tsx +301 -0
  749. package/src/lists/components/ItineraryWaypointList.tsx +257 -0
  750. package/src/lists/components/SegmentList.tsx +549 -0
  751. package/src/lists/components/SegmentSeam.tsx +292 -0
  752. package/src/lists/components/WaypointList.tsx +233 -0
  753. package/src/map/components/ContextMenuPopup.tsx +913 -0
  754. package/src/map/components/MapAnchoredPopup.tsx +285 -0
  755. package/src/map/components/SegmentViaPopup.tsx +133 -0
  756. package/src/map/hooks/useAccessRestrictions.ts +25 -0
  757. package/src/map/hooks/useEmbedConstraints.ts +359 -0
  758. package/src/map/hooks/useEmbedDisplaySeed.ts +61 -0
  759. package/src/map/hooks/useEmbedReady.ts +137 -0
  760. package/src/map/hooks/useHeldTileSources.ts +65 -0
  761. package/src/map/hooks/useSegmentColor.ts +24 -0
  762. package/src/map/hooks/useSpecificationLayers.ts +25 -0
  763. package/src/map/hooks/useStudioConstraints.ts +135 -0
  764. package/src/map/hooks/useStudioContextMenu.ts +34 -0
  765. package/src/map/hooks/useStudioContextMenuWaypoint.ts +119 -0
  766. package/src/map/hooks/useStudioEditCommitReporter.ts +56 -0
  767. package/src/map/hooks/useStudioEditEngine.ts +271 -0
  768. package/src/map/hooks/useStudioEnrichment.ts +117 -0
  769. package/src/map/hooks/useStudioItinerarySelection.ts +484 -0
  770. package/src/map/hooks/useStudioLayersScope.ts +34 -0
  771. package/src/map/hooks/useStudioMapBindings.ts +178 -0
  772. package/src/map/hooks/useStudioMapEditSeams.ts +161 -0
  773. package/src/map/hooks/useStudioMapSync.ts +127 -0
  774. package/src/map/hooks/useStudioOverlay.ts +75 -0
  775. package/src/map/hooks/useStudioOverlayWithdrawal.ts +52 -0
  776. package/src/map/hooks/useStudioOverlaysEntitled.ts +12 -0
  777. package/src/map/hooks/useStudioPeerDrafts.ts +126 -0
  778. package/src/map/hooks/useStudioPoiLayers.ts +110 -0
  779. package/src/map/hooks/useStudioPreviewSync.ts +205 -0
  780. package/src/map/hooks/useStudioSegmentEditing.ts +239 -0
  781. package/src/map/hooks/useStudioSegmentViaPrompt.ts +38 -0
  782. package/src/map/hooks/useStudioSplitPicking.ts +411 -0
  783. package/src/map/hooks/useStudioSuggestionPicking.ts +178 -0
  784. package/src/map/hooks/useStudioTimestamp.ts +226 -0
  785. package/src/map/hooks/useStudioUrlState.ts +340 -0
  786. package/src/map/hooks/useStudioWaypointEditing.ts +251 -0
  787. package/src/map/hooks/useStudioZoneEditing.ts +260 -0
  788. package/src/map/hooks/useStudioZoneOriginPicking.ts +129 -0
  789. package/src/map/hooks/useStudioZoneSelection.ts +240 -0
  790. package/src/map/hooks/useTileLayers.ts +33 -0
  791. package/src/map/index.ts +67 -0
  792. package/src/map/rules/editKeyboard.ts +216 -0
  793. package/src/map/rules/editTooltip.ts +222 -0
  794. package/src/map/rules/nearerEscape.ts +107 -0
  795. package/src/map/rules/poiGlyphs.ts +40 -0
  796. package/src/modals/components/AppModal.tsx +280 -0
  797. package/src/modals/components/ConfirmModal.tsx +223 -0
  798. package/src/modals/components/ExportModal.tsx +538 -0
  799. package/src/modals/components/LocationPermissionModal.tsx +129 -0
  800. package/src/modals/components/ModalFooter.tsx +187 -0
  801. package/src/modals/hooks/useConfirmGate.tsx +209 -0
  802. package/src/modals/hooks/useDiscardGuard.tsx +168 -0
  803. package/src/panels/components/EditShortcutHint.tsx +115 -0
  804. package/src/panels/components/FloatingOverlay.tsx +243 -0
  805. package/src/panels/components/GlyphPickerGrid.tsx +84 -0
  806. package/src/panels/components/PanelRouter.tsx +133 -0
  807. package/src/panels/components/PickerCard.tsx +108 -0
  808. package/src/panels/components/RadioOptionCard.tsx +116 -0
  809. package/src/panels/components/SidenavContentBody.tsx +56 -0
  810. package/src/panels/components/SidenavContentFooter.tsx +27 -0
  811. package/src/panels/components/SidenavContentHeader.tsx +172 -0
  812. package/src/panels/components/SidenavFormActions.tsx +96 -0
  813. package/src/panels/components/StudioFormStack.tsx +44 -0
  814. package/src/panels/components/StudioHeader.tsx +117 -0
  815. package/src/panels/components/StudioLayersPanel.tsx +909 -0
  816. package/src/panels/components/StudioPreferencesPanel.tsx +199 -0
  817. package/src/panels/rules/studioHeader.ts +68 -0
  818. package/src/plugins/components/PluginBoundary.tsx +62 -0
  819. package/src/plugins/components/PluginContextMenuActions.tsx +73 -0
  820. package/src/plugins/components/PluginControls.tsx +101 -0
  821. package/src/plugins/components/PluginHeldView.tsx +77 -0
  822. package/src/plugins/components/PluginMenuItems.tsx +63 -0
  823. package/src/plugins/components/PluginProfileHeader.tsx +71 -0
  824. package/src/plugins/components/PluginProfilePlot.tsx +134 -0
  825. package/src/plugins/components/PluginSlotItems.tsx +55 -0
  826. package/src/primitives/components/ActivityIcon.tsx +106 -0
  827. package/src/primitives/components/AllowlistField.tsx +508 -0
  828. package/src/primitives/components/CopyIconButton.tsx +80 -0
  829. package/src/primitives/components/DateTimeInput.tsx +133 -0
  830. package/src/primitives/components/DateTimePickerField.tsx +110 -0
  831. package/src/primitives/components/DescriptiveMenuItem.tsx +80 -0
  832. package/src/primitives/components/DialogSubject.tsx +102 -0
  833. package/src/primitives/components/DisabledMenuItem.tsx +45 -0
  834. package/src/primitives/components/DisabledReason.tsx +34 -0
  835. package/src/primitives/components/EmptyState.tsx +186 -0
  836. package/src/primitives/components/ErrorAlert.tsx +35 -0
  837. package/src/primitives/components/ErrorBoundary.tsx +55 -0
  838. package/src/primitives/components/FieldLabel.tsx +34 -0
  839. package/src/primitives/components/FormErrorAlert.tsx +33 -0
  840. package/src/primitives/components/GroupLabelledBy.tsx +31 -0
  841. package/src/primitives/components/LanguageSelect.tsx +139 -0
  842. package/src/primitives/components/ListSkeleton.tsx +64 -0
  843. package/src/primitives/components/MarqueeText.tsx +61 -0
  844. package/src/primitives/components/OrganizationScopeItem.tsx +146 -0
  845. package/src/primitives/components/OrganizationSelect.tsx +149 -0
  846. package/src/primitives/components/PointField.tsx +75 -0
  847. package/src/primitives/components/PrivacyControl.tsx +127 -0
  848. package/src/primitives/components/RenameInput.tsx +159 -0
  849. package/src/primitives/components/RequiredLabelWithHelp.tsx +76 -0
  850. package/src/primitives/components/SegmentIcon.tsx +43 -0
  851. package/src/primitives/components/SegmentIconLabel.tsx +37 -0
  852. package/src/primitives/components/SpeedInput.tsx +222 -0
  853. package/src/primitives/components/StudioSectionBoundary.tsx +56 -0
  854. package/src/primitives/components/StudioSegmentedControl.tsx +23 -0
  855. package/src/primitives/components/UnitPickerField.tsx +62 -0
  856. package/src/primitives/components/UnitPickerGrid.tsx +71 -0
  857. package/src/primitives/components/WarningAlert.tsx +34 -0
  858. package/src/primitives/hooks/useCompactLayout.ts +30 -0
  859. package/src/primitives/hooks/useSpeedControlLabel.ts +28 -0
  860. package/src/primitives/rules/activityBadge.ts +87 -0
  861. package/src/publication/components/PublicationBadge.tsx +42 -0
  862. package/src/publication/components/PublicationDot.tsx +31 -0
  863. package/src/publication/components/PublicationNotice.tsx +115 -0
  864. package/src/publication/components/PublicationSettledPill.tsx +43 -0
  865. package/src/publication/components/PublicationStatus.tsx +52 -0
  866. package/src/publication/components/UnpublishedPanel.tsx +133 -0
  867. package/src/publication/hooks/usePublicationHint.ts +235 -0
  868. package/src/publication/hooks/usePublishAct.ts +101 -0
  869. package/src/publication/hooks/usePublishItinerary.ts +27 -0
  870. package/src/publication/hooks/usePublishZone.ts +27 -0
  871. package/src/publication/hooks/usePublishableScope.ts +23 -0
  872. package/src/publication/hooks/usePublishedItinerary.ts +83 -0
  873. package/src/rows/components/ReadOnlySegmentRow.tsx +155 -0
  874. package/src/rows/components/RouteMetricLine.tsx +90 -0
  875. package/src/rows/components/RowMetadata.tsx +92 -0
  876. package/src/rows/components/SegmentRow.tsx +381 -0
  877. package/src/rows/components/SegmentRowActions.tsx +187 -0
  878. package/src/rows/components/SegmentRowBody.tsx +197 -0
  879. package/src/rows/components/StudioToggleRow.tsx +71 -0
  880. package/src/rows/components/SuggestionList.tsx +100 -0
  881. package/src/rows/components/SuggestionRowLayout.tsx +164 -0
  882. package/src/rows/components/WaypointRow.tsx +176 -0
  883. package/src/rows/components/WaypointRowLayout.tsx +279 -0
  884. package/src/rows/components/lockChrome.tsx +106 -0
  885. package/src/rules/menuActions.ts +149 -0
  886. package/src/rules/sizing.ts +127 -0
  887. package/src/rules/studioConfig.ts +719 -0
  888. package/src/search/components/CategoryTabs.tsx +136 -0
  889. package/src/search/components/ResultRow.tsx +242 -0
  890. package/src/search/components/ResultsList.tsx +182 -0
  891. package/src/search/components/SearchInput.tsx +100 -0
  892. package/src/search/components/SearchTab.tsx +614 -0
  893. package/src/sections/components/RailSwitcher.tsx +179 -0
  894. package/src/sections/components/SectionCard.tsx +48 -0
  895. package/src/sections/components/SectionHead.tsx +42 -0
  896. package/src/sections/components/SectionTabs.tsx +231 -0
  897. package/src/segments/components/SegmentColorCircle.tsx +118 -0
  898. package/src/segments/components/SegmentColorPicker.tsx +134 -0
  899. package/src/segments/components/SegmentModeControl.tsx +118 -0
  900. package/src/segments/components/SegmentRowMenu.tsx +449 -0
  901. package/src/segments/components/SegmentRowPopover.tsx +163 -0
  902. package/src/segments/components/SegmentSelect.tsx +116 -0
  903. package/src/segments/components/SegmentSpeedControl.tsx +299 -0
  904. package/src/share/components/ShareLinkManage.tsx +699 -0
  905. package/src/share/components/ShareModal.tsx +182 -0
  906. package/src/share/components/ShareSheet.tsx +178 -0
  907. package/src/share/components/ShareViewModal.tsx +131 -0
  908. package/src/share/hooks/useCanManageShareLink.ts +51 -0
  909. package/src/studio/components/MountayaStudio.tsx +1170 -0
  910. package/src/studio/components/MountayaStudioViewer.tsx +775 -0
  911. package/src/studio/hooks/useEmbeddedStudioConfig.ts +60 -0
  912. package/src/studio/hooks/useViewerActivation.ts +47 -0
  913. package/src/studio/hooks/useViewerCollectionSpecification.ts +58 -0
  914. package/src/studio/hooks/useViewerEmbedConfig.ts +74 -0
  915. package/src/studio/hooks/useViewerFraming.ts +211 -0
  916. package/src/studio/hooks/useViewerMapBindings.ts +109 -0
  917. package/src/styles.css +3994 -0
  918. package/src/testing/collections.ts +40 -0
  919. package/src/testing/hostRegistry.tsx +109 -0
  920. package/src/testing/index.ts +65 -0
  921. package/src/testing/itinerary.ts +297 -0
  922. package/src/testing/mountayaClient.tsx +218 -0
  923. package/src/testing/viewer.tsx +171 -0
  924. package/src/theme/components/StudioPortalScope.tsx +130 -0
  925. package/src/theme/hooks/useResolvedStudioTheme.ts +37 -0
  926. package/src/theme/rules/density.ts +157 -0
  927. package/src/theme/rules/mountayaStudioTheme.ts +114 -0
  928. package/src/theme/rules/passwordManager.ts +20 -0
  929. package/src/theme/rules/tokenStyle.ts +18 -0
  930. package/src/theme/rules/tokens.ts +71 -0
  931. package/src/theme/rules/tone.ts +34 -0
  932. package/src/theme/rules/zIndex.ts +40 -0
  933. package/src/video/components/CameraStep.tsx +82 -0
  934. package/src/video/components/DirectingScrim.tsx +28 -0
  935. package/src/video/components/DirectorChat.tsx +79 -0
  936. package/src/video/components/FormatStep.tsx +487 -0
  937. package/src/video/components/ModeCards.tsx +141 -0
  938. package/src/video/components/PlanNumberField.tsx +54 -0
  939. package/src/video/components/PreviewControls.tsx +212 -0
  940. package/src/video/components/PreviewStage.tsx +319 -0
  941. package/src/video/components/PreviewSurface.tsx +247 -0
  942. package/src/video/components/PreviewWatermark.tsx +77 -0
  943. package/src/video/components/ProfileOverlayCanvas.tsx +195 -0
  944. package/src/video/components/ProfileStep.tsx +254 -0
  945. package/src/video/components/RecordProgress.tsx +117 -0
  946. package/src/video/components/ReviewStep.tsx +244 -0
  947. package/src/video/components/ShotList.tsx +452 -0
  948. package/src/video/components/VideoExportWizard.tsx +827 -0
  949. package/src/video/components/WizardDirectingIndicator.tsx +57 -0
  950. package/src/video/components/WizardFooter.tsx +112 -0
  951. package/src/video/hooks/usePreviewPlanRefresh.ts +91 -0
  952. package/src/video/hooks/useVideoItinerarySubject.ts +18 -0
  953. package/src/video/hooks/useVideoOrganizationId.ts +30 -0
  954. package/src/video/hooks/useVideoPreviewSeed.ts +203 -0
  955. package/src/video/hooks/useVideoProfileSeed.ts +53 -0
  956. package/src/video/hooks/useVideoPublication.ts +29 -0
  957. package/src/video/hooks/useVideoRouteReady.ts +52 -0
  958. package/src/video/hooks/useVideoRouteSync.ts +100 -0
  959. package/src/video/hooks/useVideoTileTransform.ts +88 -0
  960. package/src/video/index.ts +24 -0
  961. package/src/video/providers/DirectorChatProvider.tsx +293 -0
  962. package/src/video/rules/changeTo.ts +20 -0
  963. package/src/zone/components/ZoneActionsMenu.tsx +305 -0
  964. package/src/zone/components/ZoneAvailabilityFields.tsx +98 -0
  965. package/src/zone/components/ZoneForm.tsx +622 -0
  966. package/src/zone/components/ZoneInheritedContext.tsx +70 -0
  967. package/src/zone/components/ZoneLevelSelect.tsx +86 -0
  968. package/src/zone/components/ZoneMetadataFields.tsx +89 -0
  969. package/src/zone/components/ZoneMethodSelect.tsx +90 -0
  970. package/src/zone/components/ZoneModeSelect.tsx +98 -0
  971. package/src/zone/components/ZoneRangeInput.tsx +129 -0
  972. package/src/zone/components/ZoneReachabilityFields.tsx +120 -0
  973. package/src/zone/components/ZoneSubHeader.tsx +188 -0
  974. package/src/zone/components/ZoneVisibility.tsx +94 -0
  975. package/src/zone/hooks/useStudioReachabilityStart.ts +79 -0
  976. package/src/zone/hooks/useStudioZonesBrowsed.ts +32 -0
@@ -0,0 +1,1358 @@
1
+ import { Box, Button, Group, List, Loader, Paper, ScrollArea, Stack, Text } from "@mantine/core";
2
+ import type { CSSProperties, ReactElement, ReactNode, RefObject } from "react";
3
+ import {
4
+ Children,
5
+ createContext,
6
+ isValidElement,
7
+ lazy,
8
+ memo,
9
+ Suspense,
10
+ use,
11
+ useCallback,
12
+ useDeferredValue,
13
+ useEffect,
14
+ useLayoutEffect,
15
+ useMemo,
16
+ useRef,
17
+ } from "react";
18
+
19
+ import { inDevelopment } from "@mountaya/elements";
20
+ import type {
21
+ PendingConfirmation,
22
+ QuestionEntry,
23
+ SuggestionCardCandidate,
24
+ SuggestionsEntry,
25
+ TranscriptEntry,
26
+ } from "@mountaya/elements/agent";
27
+ import { isPinnedToBottom } from "@mountaya/elements/agent";
28
+ import { MountayaElementsError } from "@mountaya/elements/errors";
29
+ import {
30
+ formatDistance,
31
+ formatDuration,
32
+ formatElevation,
33
+ type UnitFormatOptions,
34
+ } from "@mountaya/elements/profile";
35
+ import { SUGGESTION_MAX_KEPT } from "@mountaya/studio";
36
+
37
+ import { useStudioScopedStrings } from "../../headless/providers/studioStrings.js";
38
+ import { Glyph } from "../../internal/components/Glyph.js";
39
+ import { ErrorAlert } from "../../primitives/components/ErrorAlert.js";
40
+ import { WarningAlert } from "../../primitives/components/WarningAlert.js";
41
+ import { SuggestionList } from "../../rows/components/SuggestionList.js";
42
+ import {
43
+ SuggestionRowLayout,
44
+ SuggestionRowPin,
45
+ } from "../../rows/components/SuggestionRowLayout.js";
46
+ import { iconSizes } from "../../rules/sizing.js";
47
+ import { ActivityRow } from "./ActivityRow.js";
48
+ import { MessageFeedback, type MessageRating } from "./MessageFeedback.js";
49
+
50
+ /** The sections these words come from: this module's own, and the parts it mounts. */
51
+ const SECTIONS = ["prompt"] as const;
52
+
53
+ /**
54
+ * AgentMarkdown is code-split: it pulls react-markdown + remark-gfm, a chain only
55
+ * the assistant turns need, so the chunk loads the first time a reply renders
56
+ * rather than riding the statically imported chat surfaces. React.lazy needs a
57
+ * default export, so the named component export is adapted here at the single
58
+ * mount site: the ONE lazy site both the co-pilot panel and the video director
59
+ * share, so neither surface's initial chunk ever pulls the markdown chain.
60
+ * While the chunk loads, the Suspense fallback shows the same plain text, so the
61
+ * first streamed reply is never blank.
62
+ */
63
+ const AgentMarkdown = lazy(() =>
64
+ import("./AgentMarkdown.js").then((module) => ({ default: module.AgentMarkdown })),
65
+ );
66
+
67
+ /**
68
+ * userTurnStyle right-aligns a user turn's bubble and caps its width, so the
69
+ * reader's own words read as a distinct chat bubble rather than a full-width block;
70
+ * Mantine has no per-item alignment shortcut on Stack. Hoisted so each streamed
71
+ * token reuses the object rather than rebuilding it per entry.
72
+ */
73
+ const userTurnStyle = { alignSelf: "flex-end", maxWidth: "85%" } satisfies CSSProperties;
74
+
75
+ /**
76
+ * agentTurnStyle lets every agent-side turn (a markdown reply, an error alert, a
77
+ * tool-activity row, the thinking indicator, the confirmation card) span the
78
+ * transcript's full column width. The assistant's prose then reads at full width for
79
+ * legibility (the way a chat renders assistant text), while the user bubble stays
80
+ * capped and right-aligned so the two speakers stay visually distinct. Mantine has
81
+ * no per-item alignment shortcut on Stack. Hoisted so each streamed token reuses the
82
+ * object rather than rebuilding it per entry.
83
+ */
84
+ const agentTurnStyle = { alignSelf: "stretch" } satisfies CSSProperties;
85
+
86
+ /**
87
+ * QuestionsSlotProps carry the question capability: the handler that sends a picked
88
+ * option's label as the user's reply and settles the card.
89
+ */
90
+ export interface QuestionsSlotProps {
91
+ /** Sends the picked option's label as the reader's reply, and settles the question's card. */
92
+ readonly onAnswer: (entryId: string, label: string) => void;
93
+ }
94
+
95
+ /**
96
+ * SuggestionsSlotProps carry the route-suggestion capability: the pick handler (the
97
+ * host stages the chosen route as an editable draft with its segment open, settles
98
+ * the card, and sends the card-composed label as the user's reply), the hover/focus
99
+ * preview, the pin and the pins the live suggest session holds (a pinned candidate
100
+ * comes back in the next batch, the way the suggestions panel's pin works), the
101
+ * "different options" request, the seed the map is currently previewing (that row
102
+ * reads selected, taken from the live suggest session so the card and the map agree),
103
+ * whether the session has a request out (the picked row shows a loader and the card's
104
+ * other rows go inert for its duration), and the reader's unit format the metric lines
105
+ * are rendered in.
106
+ *
107
+ * Every field is required, because they are one capability rather than independent
108
+ * options: a surface that can stage a route can preview and pin one, knows its own
109
+ * session state, and knows its reader's units. Letting any of them be omitted is how a
110
+ * card ends up quietly rendering half of itself.
111
+ */
112
+ export interface SuggestionsSlotProps {
113
+ /** Stages the picked route as an editable draft, and sends the card's label as the reply. */
114
+ readonly onSelect: (entryId: string, seed: number, label: string) => void;
115
+ /** Paints one candidate route on the map, as a row is hovered or focused. */
116
+ readonly onPreview: (candidateSeed: number) => void;
117
+ /** Asks the run for different options. */
118
+ readonly onRequestMore: () => void;
119
+ /** Pins or unpins one candidate, by its seed, so the next batch keeps or drops it. */
120
+ readonly onToggle: (candidateSeed: number) => void;
121
+ /**
122
+ * The live suggest session's candidates, each seed to whether it is pinned. A row whose seed
123
+ * is absent belongs to a batch the session no longer holds, and its pin takes no change.
124
+ */
125
+ readonly pins: ReadonlyMap<number, boolean>;
126
+ /** The seed the map previews, whose row reads selected, or null. */
127
+ readonly previewedSeed: number | null;
128
+ /** Whether the suggest session has a request out, which holds the card's rows inert. */
129
+ readonly staging: boolean;
130
+ /** The reader's units, which the candidates' metric lines are written in. */
131
+ readonly unitFormat: UnitFormatOptions;
132
+ }
133
+
134
+ /**
135
+ * FeedbackSlotProps carry the rating capability: the recorder, which names an
136
+ * assistant message by its zero-based index among the run's replies, and the ratings
137
+ * already recorded under those same indexes.
138
+ */
139
+ interface FeedbackSlotProps {
140
+ /** Records a rating of the reply at a zero-based index among the run's replies. */
141
+ readonly onRate: (messageIndex: number, rating: MessageRating) => void;
142
+ /** The ratings already recorded, by the same indexes. */
143
+ readonly ratings: Readonly<Record<number, MessageRating>>;
144
+ }
145
+
146
+ /**
147
+ * ConfirmationsSlotProps carry the in-chat destructive-tool approval: the decision
148
+ * the run is parked on (null while it is not waiting on one) and the resolver that
149
+ * settles it.
150
+ */
151
+ interface ConfirmationsSlotProps {
152
+ /** Settles the parked decision with the reader's answer. */
153
+ readonly onResolve: (approved: boolean) => void;
154
+ /** The decision the run is parked on, or null while it waits on none. */
155
+ readonly pending: PendingConfirmation | null;
156
+ }
157
+
158
+ /**
159
+ * Confirmations mounts the in-chat approval a run parks on before it will call a
160
+ * destructive tool.
161
+ *
162
+ * Like every slot it renders nothing where it is written: ChatTranscript reads its
163
+ * props off the element. A slot is a declaration of what this surface can do, not a
164
+ * place in the layout.
165
+ */
166
+ const Confirmations = (_props: ConfirmationsSlotProps): null => null;
167
+
168
+ /**
169
+ * Feedback mounts the thumbs under every settled assistant reply.
170
+ *
171
+ * It is the one slot whose absence is not an error: feedback is an adornment on a
172
+ * turn every surface already renders, not a turn kind of its own, so a surface that
173
+ * does not collect ratings simply shows no thumbs. The co-pilot mounts it only once
174
+ * its run has an id, since a rating names a run.
175
+ */
176
+ const Feedback = (_props: FeedbackSlotProps): null => null;
177
+
178
+ /**
179
+ * Questions mounts the structured-question turn: the assistant asks, its options
180
+ * render as buttons, and a tap sends the label as the reply.
181
+ */
182
+ const Questions = (_props: QuestionsSlotProps): null => null;
183
+
184
+ /**
185
+ * Suggestions mounts the route-candidate turn: a generated batch renders as the
186
+ * conversation's own suggestions list, hover previews a route on the map and a tap
187
+ * stages it for editing.
188
+ */
189
+ const Suggestions = (_props: SuggestionsSlotProps): null => null;
190
+
191
+ /**
192
+ * QuestionsSlotContext publishes the mounted question capability to every question
193
+ * card, so the entry loop hands a card its entry and nothing else. Undefined means
194
+ * the surface mounted no {@link Questions} slot, which is what makes a question turn
195
+ * on that surface a contract error rather than a card that renders read-only.
196
+ */
197
+ const QuestionsSlotContext = createContext<QuestionsSlotProps | undefined>(undefined);
198
+
199
+ /**
200
+ * SuggestionsSlotContext publishes the mounted route-suggestion capability to every
201
+ * suggestions card. It is deliberately its OWN context rather than a field on a
202
+ * combined one: `previewedSeed` moves on every hover, and a shared value would drag
203
+ * every question card and every thumbs pair through that re-render for a highlight
204
+ * none of them show.
205
+ */
206
+ const SuggestionsSlotContext = createContext<SuggestionsSlotProps | undefined>(undefined);
207
+
208
+ /**
209
+ * TranscriptSlots is the set of capabilities one surface mounted, read off the slot
210
+ * elements it passed as children. An absent field is an absent capability: the
211
+ * transcript never substitutes a default for one.
212
+ */
213
+ interface TranscriptSlots {
214
+ confirmations?: ConfirmationsSlotProps | undefined;
215
+ feedback?: FeedbackSlotProps | undefined;
216
+ questions?: QuestionsSlotProps | undefined;
217
+ suggestions?: SuggestionsSlotProps | undefined;
218
+ }
219
+
220
+ /**
221
+ * isSlot narrows one child of ChatTranscript to a given slot element, so that slot's
222
+ * props are read at their declared type with no cast: matching on the slot
223
+ * component's own identity is what guarantees the shape. Object.is compares the two
224
+ * without asking TypeScript to relate a generic component to React's own element-type
225
+ * union, which it cannot.
226
+ */
227
+ const isSlot = <P,>(node: ReactNode, slot: (props: P) => null): node is ReactElement<P> =>
228
+ isValidElement(node) && Object.is(node.type, slot);
229
+
230
+ /**
231
+ * readSlots collects the capabilities a surface mounted. Anything that is not a slot
232
+ * element is ignored, so a caller may render a slot conditionally (the co-pilot mounts
233
+ * feedback only once its run has an id) and the `null` that leaves behind costs
234
+ * nothing.
235
+ */
236
+ const readSlots = (children: ReactNode): TranscriptSlots => {
237
+ const slots: TranscriptSlots = {};
238
+
239
+ Children.forEach(children, (child) => {
240
+ if (isSlot(child, Confirmations)) {
241
+ slots.confirmations = child.props;
242
+ } else if (isSlot(child, Feedback)) {
243
+ slots.feedback = child.props;
244
+ } else if (isSlot(child, Questions)) {
245
+ slots.questions = child.props;
246
+ } else if (isSlot(child, Suggestions)) {
247
+ slots.suggestions = child.props;
248
+ }
249
+ });
250
+
251
+ return slots;
252
+ };
253
+
254
+ /**
255
+ * sameSlotProps compares two slot prop records field by field. A slot's props are a
256
+ * flat bag of the surface's own values and callbacks, so field identity is exactly
257
+ * the right grain: it is what tells "the same surface, re-rendered" apart from "the
258
+ * surface changed something".
259
+ */
260
+ const sameSlotProps = <P extends object>(previous: P | undefined, next: P | undefined): boolean => {
261
+ if (previous === undefined || next === undefined) {
262
+ return previous === next;
263
+ }
264
+
265
+ // Object.keys answers string[]; the keys are P's own, read off a P.
266
+ const keys = Object.keys(previous) as (keyof P)[];
267
+
268
+ return (
269
+ keys.length === Object.keys(next).length &&
270
+ keys.every((key) => Object.is(previous[key], next[key]))
271
+ );
272
+ };
273
+
274
+ /**
275
+ * useSlot latches one slot's props so the context value built from them keeps its
276
+ * identity for as long as the surface's own values do.
277
+ *
278
+ * This is the load-bearing half of the slot API. JSX rebuilds a slot element's props
279
+ * object on every render of the surface, so publishing it straight into context would
280
+ * hand every consumer a new value on every streamed token, and a context change
281
+ * re-renders a consumer even when React.memo would have held it on its props. The
282
+ * memoized question and suggestion cards would then be rebuilt on each token of an
283
+ * unrelated turn, which is precisely the cost they are memoized to avoid.
284
+ *
285
+ * The latch is the same shape as zustand's useShallow: a pure last-value cache,
286
+ * recomputed and compared from the current props on every render, so a render React
287
+ * discards can only ever leave behind a different reference holding the same field
288
+ * values.
289
+ */
290
+ const useSlot = <P extends object>(next: P | undefined): P | undefined => {
291
+ const latched = useRef<P | undefined>(undefined);
292
+ if (!sameSlotProps(latched.current, next)) {
293
+ latched.current = next;
294
+ }
295
+
296
+ return latched.current;
297
+ };
298
+
299
+ /**
300
+ * warningLineKeys pairs each warning line with a stable React key.
301
+ *
302
+ * The key is the line's text plus how many times that text has already appeared, which is what
303
+ * identifies a line in a list that is appended to once and never reordered or filtered. The
304
+ * wire array is carried verbatim, so two retrieved skills promising the same criterion produce
305
+ * the same sentence twice: the text alone is not a key, and a bare index only approximates one.
306
+ */
307
+ const warningLineKeys = (lines: readonly string[]): Array<[string, string]> => {
308
+ const seen = new Map<string, number>();
309
+
310
+ return lines.map((line) => {
311
+ const occurrence = seen.get(line) ?? 0;
312
+ seen.set(line, occurrence + 1);
313
+
314
+ return [`${line}#${occurrence}`, line];
315
+ });
316
+ };
317
+
318
+ /**
319
+ * missingSlot answers a turn kind whose slot the surface never mounted.
320
+ *
321
+ * In development it throws, and that is the point of the slot API: the alternative, rendering the
322
+ * card read-only because its handler happens to be absent, is a degradation nobody notices until
323
+ * a user reports that tapping an option does nothing. Every studio chat surface is mounted inside
324
+ * StudioSectionBoundary, so the throw surfaces as that panel's retry card and a console trace
325
+ * and never takes the route down.
326
+ *
327
+ * In production it renders nothing for that one turn and lets the rest of the conversation
328
+ * stand: throwing there would trade a missing card for a blanked conversation, a worse failure
329
+ * than the one it reports. {@link inDevelopment} decides which of the two a page is.
330
+ *
331
+ * @param role The role of the turn that has no slot.
332
+ * @param slot The name of the slot that turn needs, as it is written after `ChatTranscript.`.
333
+ * @returns `null`, the nothing a production page renders for that turn.
334
+ * @throws {MountayaElementsError} In development, naming the turn and the slot to mount.
335
+ */
336
+ const missingSlot = (role: string, slot: string): null => {
337
+ if (inDevelopment()) {
338
+ throw new MountayaElementsError(
339
+ `ChatTranscript received a "${role}" turn but no <ChatTranscript.${slot}> slot is mounted. Mount the slot on this surface, or stop its bus producing that turn kind.`,
340
+ );
341
+ }
342
+
343
+ return null;
344
+ };
345
+
346
+ /**
347
+ * ConfirmationCardProps carry the destructive action the agent is waiting on: the
348
+ * tool `name` interpolated into the localized title, an optional human `summary` of
349
+ * what it does, and the approve/deny handlers wired to the surface's in-chat
350
+ * confirmation resolver.
351
+ */
352
+ interface ConfirmationCardProps {
353
+ name: string;
354
+ onApprove: () => void;
355
+ onDeny: () => void;
356
+ summary: string | null;
357
+ }
358
+
359
+ /**
360
+ * ConfirmationCard is the in-chat approval prompt for a destructive tool the agent
361
+ * wants to run: an assistant-aligned bordered card that stands in for the thinking
362
+ * dots while the run awaits the user's decision (the agent is waiting on the user,
363
+ * not thinking). It is deliberately NOT a modal (a chat surface must never raise a
364
+ * fullscreen dialog while it works), so the approval lives in the conversation. The
365
+ * destructive treatment (a red filled Approve) follows the studio's confirm convention
366
+ * since these prompts exist only for destructive tools. It focuses the safe Deny
367
+ * action on mount so a keyboard user lands on the non-destructive choice; the
368
+ * transcript's own log region announces its arrival, and the focus move puts the
369
+ * card under the reader's cursor besides. The decision unmounts the card, so the
370
+ * host returns focus to that log region rather than letting it fall to <body>.
371
+ */
372
+ const ConfirmationCard = ({ name, onApprove, onDeny, summary }: ConfirmationCardProps) => {
373
+ const words = useStudioScopedStrings(SECTIONS);
374
+ const denyRef = useRef<HTMLButtonElement>(null);
375
+
376
+ // Land keyboard focus on the safe choice the moment the card appears, so the
377
+ // destructive Approve is never the default target.
378
+ useEffect(() => {
379
+ denyRef.current?.focus();
380
+ }, []);
381
+
382
+ return (
383
+ <Paper p="sm" withBorder>
384
+ <Stack>
385
+ <Text fw={500}>{words.prompt.confirmTitle(name)}</Text>
386
+ {summary ? <Text c="dimmed">{summary}</Text> : null}
387
+ <Group justify="flex-end">
388
+ <Button onClick={onDeny} ref={denyRef} variant="default">
389
+ {words.prompt.confirmDeny}
390
+ </Button>
391
+ <Button color="red" onClick={onApprove} variant="filled">
392
+ {words.prompt.confirmApprove}
393
+ </Button>
394
+ </Group>
395
+ </Stack>
396
+ </Paper>
397
+ );
398
+ };
399
+
400
+ /**
401
+ * QuestionCardProps carry one structured question to render. That is the whole prop
402
+ * list: the answer handler is the surface's Questions capability, read off the slot
403
+ * context, so a card cannot be mounted on a surface that has no way to reply.
404
+ */
405
+ interface QuestionCardProps {
406
+ entry: QuestionEntry;
407
+ }
408
+
409
+ /**
410
+ * QuestionCardBase renders the assistant's structured question: the question with
411
+ * its options as full-width buttons the user picks from, so answering is one
412
+ * tap instead of typing the choice back. Picking an option sends its label as
413
+ * the user's reply through the ordinary send path; the card then settles inert
414
+ * with the pick marked, and stays in the history as the record of what was
415
+ * asked and chosen. A question superseded by a typed reply settles with no
416
+ * pick. It is deliberately NOT a modal, exactly like the confirmation card: the
417
+ * conversation is where the agent asks and the user answers.
418
+ *
419
+ * Its options are words, not entities: tapping one says something, and that is
420
+ * the whole contract. Route candidates are the other kind of choice (a pick
421
+ * there has to stage a route), and they render through the suggestions card below,
422
+ * off the live suggest session rather than off anything the model retyped.
423
+ *
424
+ * Memoized as {@link QuestionCard}: a question entry is a stable object the
425
+ * moment it lands, so re-rendering it costs a full option list for nothing every
426
+ * time a sibling turn streams a token.
427
+ */
428
+ const QuestionCardBase = ({ entry }: QuestionCardProps) => {
429
+ const words = useStudioScopedStrings(SECTIONS);
430
+ const slot = use(QuestionsSlotContext);
431
+
432
+ // The slot contract is stated here, where the capability is consumed, so there is
433
+ // exactly one check and the option handler below needs no optional call.
434
+ if (slot === undefined) {
435
+ return missingSlot(entry.role, "Questions");
436
+ }
437
+
438
+ // A settled card renders inert. It reports through `aria-disabled` +
439
+ // `data-disabled` rather than the native attribute, which would take the option
440
+ // away from the keyboard at the worst moment: the button the user just activated
441
+ // settles the card under their own focus, and a natively disabled control drops
442
+ // that focus to <body>, leaving the settled card unreachable, so the record of
443
+ // what was asked and chosen can no longer be read back. Mantine styles
444
+ // `data-disabled` exactly as `:disabled`, so the treatment is the same; the press
445
+ // guard replaces the one thing the native attribute did enforce.
446
+ const inert = entry.settled;
447
+
448
+ return (
449
+ <Paper p="sm" withBorder>
450
+ <Stack gap="xs">
451
+ <Text fw={500}>{entry.question}</Text>
452
+ {entry.options.map((option) => {
453
+ const picked = entry.selected === option.label;
454
+
455
+ return (
456
+ <Button
457
+ aria-disabled={inert}
458
+ className={"mtya-chat-option-row"}
459
+ data-disabled={inert || undefined}
460
+ fullWidth
461
+ h="auto"
462
+ justify="flex-start"
463
+ key={option.label}
464
+ leftSection={picked ? <Glyph name="check" size={iconSizes.sm} /> : undefined}
465
+ onClick={() => {
466
+ if (!inert) {
467
+ slot.onAnswer(entry.id, option.label);
468
+ }
469
+ }}
470
+ py="xs"
471
+ variant="default"
472
+ >
473
+ <Stack className={"mtya-chat-option-body"} gap={0}>
474
+ <Text fw={500} size="sm">
475
+ {option.label}
476
+ </Text>
477
+ {option.description ? (
478
+ <Text c="dimmed" size="xs">
479
+ {option.description}
480
+ </Text>
481
+ ) : null}
482
+ </Stack>
483
+ </Button>
484
+ );
485
+ })}
486
+ {entry.settled ? null : (
487
+ <Text c="dimmed" size="xs">
488
+ {words.prompt.questionCaption}
489
+ </Text>
490
+ )}
491
+ </Stack>
492
+ </Paper>
493
+ );
494
+ };
495
+
496
+ const QuestionCard = memo(QuestionCardBase);
497
+
498
+ /**
499
+ * SuggestionsCardRowProps carry one candidate of a suggestions card and the states it renders
500
+ * in, each derived by the card from its entry and its slot, so a row re-renders only when its
501
+ * own state moves (a hover moves the preview across two rows, not every row of every card).
502
+ */
503
+ interface SuggestionsCardRowProps {
504
+ /** Whether this row's pick is the one landing, which shows its loader. */
505
+ readonly busy: boolean;
506
+ /** The candidate, as the card's entry snapshotted it. */
507
+ readonly candidate: SuggestionCardCandidate;
508
+ /** Whether the card settled on this candidate, which marks it as the pick. */
509
+ readonly chosen: boolean;
510
+ /** The id of the card, which a pick names. */
511
+ readonly entryId: string;
512
+ /** Whether the row takes no action: its card is settled, or a pick is landing. */
513
+ readonly inert: boolean;
514
+ /** Paints the candidate on the map, by its seed. */
515
+ readonly onPreview: (candidateSeed: number) => void;
516
+ /** Stages the candidate, and sends the pick's label as the reply. */
517
+ readonly onSelect: (entryId: string, seed: number, label: string) => void;
518
+ /** Pins or unpins the candidate, by its seed. */
519
+ readonly onToggle: (candidateSeed: number) => void;
520
+ /** The candidate's pin as the live session holds it, or undefined where it holds no such candidate. */
521
+ readonly pinned: boolean | undefined;
522
+ /** Whether the session holds as many pins as a set keeps, which disables an unpinned pin. */
523
+ readonly pinsFull: boolean;
524
+ /** The candidate's place on the card, from one, which its name and its pick message read. */
525
+ readonly position: number;
526
+ /** Whether this candidate is the one the map previews, or the card's pick. */
527
+ readonly selected: boolean;
528
+ /** Whether the card is settled, which drops the pins and marks the pick instead. */
529
+ readonly settled: boolean;
530
+ /** The reader's units, which the metric line is written in. */
531
+ readonly unitFormat: UnitFormatOptions;
532
+ }
533
+
534
+ /**
535
+ * SuggestionsCardRowBase is one candidate of a suggestions card, in the row the suggestions
536
+ * panel offers its candidates in ({@link SuggestionRowLayout}): the same swatch, metric line,
537
+ * spacing, selected edge and pin, so a candidate offered in the panel and the same candidate
538
+ * offered in the conversation read as one thing.
539
+ *
540
+ * What differs is the click, because the conversation has no footer to commit a pick: hovering
541
+ * or focusing the row previews the route on the map exactly as in the panel, and a click on its
542
+ * metric line picks it. The pin is the panel's pin, offered while the card is open; once the card
543
+ * settles the pin gives way to the check that marks the pick.
544
+ *
545
+ * Memoized as {@link SuggestionsCardRow}: every row formats a distance, an ascent and a
546
+ * duration, and the card it sits in re-renders on every hover.
547
+ */
548
+ const SuggestionsCardRowBase = ({
549
+ busy,
550
+ candidate,
551
+ chosen,
552
+ entryId,
553
+ inert,
554
+ onPreview,
555
+ onSelect,
556
+ onToggle,
557
+ pinned,
558
+ pinsFull,
559
+ position,
560
+ selected,
561
+ settled,
562
+ unitFormat,
563
+ }: SuggestionsCardRowProps) => {
564
+ const words = useStudioScopedStrings(SECTIONS);
565
+
566
+ // A flat route carries no ascent, so the ↗ caption and its separator drop out, exactly as
567
+ // in the panel's rows.
568
+ const distance = formatDistance(candidate.distanceMeters, unitFormat);
569
+ const ascent =
570
+ candidate.ascentMeters > 0 ? formatElevation(candidate.ascentMeters, unitFormat) : "";
571
+ const duration = formatDuration(candidate.durationSeconds, unitFormat);
572
+
573
+ // The pick's label IS the user's message: it reads back exactly what the row showed, so the
574
+ // conversation records the choice the way the user saw it (and the run reads the same
575
+ // metrics the user compared).
576
+ const metrics = [distance, ascent ? `↗ ${ascent}` : "", duration]
577
+ .filter((part) => part.length > 0)
578
+ .join(" · ");
579
+ const pickLabel = metrics
580
+ ? words.prompt.suggestionsPickMessage(position, metrics)
581
+ : words.prompt.suggestionsPickMessageBare(position);
582
+
583
+ const { seed } = candidate;
584
+ const pick = useCallback(() => {
585
+ onSelect(entryId, seed, pickLabel);
586
+ }, [entryId, onSelect, pickLabel, seed]);
587
+ const preview = useCallback(() => {
588
+ onPreview(seed);
589
+ }, [onPreview, seed]);
590
+ const toggle = useCallback(() => {
591
+ onToggle(seed);
592
+ }, [onToggle, seed]);
593
+
594
+ return (
595
+ <SuggestionRowLayout
596
+ ascent={ascent}
597
+ busy={busy}
598
+ color={candidate.color}
599
+ distance={distance}
600
+ duration={duration}
601
+ inert={inert}
602
+ label={words.prompt.suggestionsRowAria(position)}
603
+ onBodyClick={pick}
604
+ onPreview={preview}
605
+ selected={selected}
606
+ >
607
+ {settled ? (
608
+ chosen ? (
609
+ <Glyph name="check" size={iconSizes.sm} />
610
+ ) : null
611
+ ) : (
612
+ // A pin the live session holds no candidate for (a batch it no longer shows) takes no
613
+ // change, and neither does an unpinned one once the session holds as many as it keeps.
614
+ <SuggestionRowPin
615
+ checked={pinned === true}
616
+ disabled={inert || pinned === undefined || (pinned === false && pinsFull)}
617
+ label={words.prompt.suggestionsPinAria}
618
+ onToggle={toggle}
619
+ />
620
+ )}
621
+ </SuggestionRowLayout>
622
+ );
623
+ };
624
+
625
+ const SuggestionsCardRow = memo(SuggestionsCardRowBase);
626
+
627
+ /**
628
+ * SuggestionsCardProps carry one generated route-candidate batch to render. That is
629
+ * the whole prop list: everything the rows need to be picked, previewed, pinned,
630
+ * regenerated and formatted is the surface's Suggestions capability, read off the slot
631
+ * context.
632
+ */
633
+ interface SuggestionsCardProps {
634
+ entry: SuggestionsEntry;
635
+ }
636
+
637
+ /**
638
+ * SuggestionsCardBase renders a generated route-candidate batch in the frame the suggestions
639
+ * panel offers its candidates in ({@link SuggestionList}): the dimmed label with the pin hint
640
+ * in its info tooltip and the candidate count, over the bordered box of rows (see
641
+ * {@link SuggestionsCardRow}). Clicking a row confirms the pick: the host stages that route as
642
+ * an editable draft with its segment open for editing, and the card settles inert with the pick
643
+ * marked, staying in the history as the record of what was chosen. A batch superseded by a typed
644
+ * reply or a regenerate settles with no pick.
645
+ *
646
+ * Under the frame, while the card is open, sit what only the conversation has: the caption
647
+ * saying a click picks (in the panel a click previews, and the footer commits), and the quiet
648
+ * action that asks the run for a different batch without the user having to type it. It is
649
+ * deliberately NOT a modal and NOT a side panel: the conversation is where the co-pilot suggests
650
+ * and the user decides.
651
+ *
652
+ * Memoized as {@link SuggestionsCard}: a settled batch is a stable entry, and re-rendering it
653
+ * on every streamed token of an unrelated turn would rebuild every one of its rows. The
654
+ * `unitFormat` on its slot has to be a stable reference for that to hold, and useStudioUnits
655
+ * memoizes its result for exactly this.
656
+ */
657
+ const SuggestionsCardBase = ({ entry }: SuggestionsCardProps) => {
658
+ const words = useStudioScopedStrings(SECTIONS);
659
+ const slot = use(SuggestionsSlotContext);
660
+
661
+ // The slot contract is stated here, where the capability is consumed, so there is
662
+ // exactly one check and the rows below need no optional calls.
663
+ if (slot === undefined) {
664
+ return missingSlot(entry.role, "Suggestions");
665
+ }
666
+
667
+ const { onSelect, onPreview, onRequestMore, onToggle, pins, previewedSeed, staging, unitFormat } =
668
+ slot;
669
+ const { settled } = entry;
670
+
671
+ let pinnedCount = 0;
672
+ for (const pinned of pins.values()) {
673
+ if (pinned) {
674
+ pinnedCount += 1;
675
+ }
676
+ }
677
+ const pinsFull = pinnedCount >= SUGGESTION_MAX_KEPT;
678
+
679
+ return (
680
+ <Stack gap="xs">
681
+ <SuggestionList
682
+ count={entry.candidates.length}
683
+ hint={words.prompt.suggestionsHint}
684
+ title={words.prompt.suggestionsTitle}
685
+ >
686
+ {entry.candidates.map((candidate, index) => (
687
+ <SuggestionsCardRow
688
+ // While the pick applies, the picked row (which the hover or focus preview just
689
+ // made the previewed one) shows the loader, and every row goes inert for the
690
+ // length of it, so the card reads as busy on the one route the user chose.
691
+ busy={!settled && staging && previewedSeed === candidate.seed}
692
+ candidate={candidate}
693
+ chosen={entry.chosenSeed === candidate.seed}
694
+ entryId={entry.id}
695
+ // A decided card, and every row while a pick is landing, render inert: a second
696
+ // pick while the first is landing would apply two routes to one itinerary, and a
697
+ // decided card that still previewed on hover would drive the map off a batch
698
+ // decided turns ago.
699
+ inert={settled || staging}
700
+ key={candidate.seed}
701
+ onPreview={onPreview}
702
+ onSelect={onSelect}
703
+ onToggle={onToggle}
704
+ pinned={pins.get(candidate.seed)}
705
+ pinsFull={pinsFull}
706
+ position={index + 1}
707
+ // The previewed row carries the edge the panel's selected row paints, so the row
708
+ // and the line drawn on the map agree at a glance; a settled card singles out its
709
+ // pick the same way.
710
+ selected={
711
+ settled ? entry.chosenSeed === candidate.seed : previewedSeed === candidate.seed
712
+ }
713
+ settled={settled}
714
+ unitFormat={unitFormat}
715
+ />
716
+ ))}
717
+ </SuggestionList>
718
+ {settled ? null : (
719
+ // Stacked, not side by side: the panel is narrow enough that a caption
720
+ // sharing a row with the button would clip the button's label.
721
+ <Stack align="flex-start" gap="xxs">
722
+ <Text c="dimmed" size="xs">
723
+ {words.prompt.suggestionsCaption}
724
+ </Text>
725
+ <Button
726
+ disabled={staging}
727
+ onClick={onRequestMore}
728
+ px={0}
729
+ size="compact-xs"
730
+ variant="subtle"
731
+ >
732
+ {words.prompt.suggestionsMore}
733
+ </Button>
734
+ </Stack>
735
+ )}
736
+ </Stack>
737
+ );
738
+ };
739
+
740
+ const SuggestionsCard = memo(SuggestionsCardBase);
741
+
742
+ /**
743
+ * ChatTranscriptProps carry one conversation to render: its role-structured
744
+ * `entries`, the live `running` flag the thinking indicator trails on, an optional
745
+ * `emptyHint` shown before the first turn (both surfaces pass one; omitted, an empty
746
+ * transcript renders nothing) whose vertical inset `emptyHintInset` a surface tunes, an
747
+ * optional `maxHeight` that bounds the scroller (the director's rail chat) instead of the
748
+ * full-height fill (the co-pilot panel), and the capability slots this surface mounts as
749
+ * `children`.
750
+ *
751
+ * `entries` and `running` are props rather than slots because they are the data every
752
+ * chat surface has. Everything a particular TURN KIND needs is a slot instead, so a
753
+ * surface declares what it can do once and no card has to branch on whether its
754
+ * handler happens to have been passed.
755
+ */
756
+ interface ChatTranscriptProps {
757
+ /**
758
+ * The capability slots this surface mounts: `ChatTranscript.Questions`,
759
+ * `.Suggestions`, `.Feedback`, `.Confirmations`, in any order. They render nothing
760
+ * where they are written (the transcript reads their props and publishes them to
761
+ * the turn bodies), and anything that is not a slot is ignored, so a slot may be
762
+ * mounted conditionally.
763
+ */
764
+ readonly children?: ReactNode;
765
+ /** The line shown before the first turn. Omitted, an empty transcript renders nothing. */
766
+ readonly emptyHint?: string | undefined;
767
+ /**
768
+ * The empty hint's vertical inset, as a spacing step of the studio's theme. The co-pilot
769
+ * panel tightens it so the hint aligns with its ask bar (its transcript region already insets
770
+ * the top); the director's rail chat keeps the default breathing room, having no padded
771
+ * region.
772
+ * @default "sm"
773
+ */
774
+ readonly emptyHintInset?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | undefined;
775
+ /** The conversation's turns, oldest first. */
776
+ readonly entries: readonly TranscriptEntry[];
777
+ /**
778
+ * The scroller's maximum height in pixels. Stated, the transcript grows to it and scrolls
779
+ * past it. Omitted, the transcript fills the height its parent gives it.
780
+ */
781
+ readonly maxHeight?: number | undefined;
782
+ /** Whether a turn is streaming, which is what the thinking indicator trails on. */
783
+ readonly running: boolean;
784
+ }
785
+
786
+ /** What {@link useFollowToBottom} hands the scroller it follows. */
787
+ interface FollowToBottom {
788
+ /** The scroller's scroll handler, which is what tells a reader moving up from content growing. */
789
+ readonly trackScroll: () => void;
790
+ /** The scroll viewport the follow reads and writes. */
791
+ readonly viewportRef: RefObject<HTMLDivElement | null>;
792
+ }
793
+
794
+ /**
795
+ * useFollowToBottom keeps a transcript's newest line in view while its reader is at the bottom,
796
+ * and leaves a reader who scrolled up where they are.
797
+ *
798
+ * Its three arguments are read by nothing in its body: they are what schedules the follow, after
799
+ * a turn lands, after a confirmation card appears or clears, and on every commit of a running
800
+ * stream.
801
+ *
802
+ * @param entries The entries on screen, a new array per committed update.
803
+ * @param pendingConfirmation The confirmation card showing, or null.
804
+ * @param running Whether a turn is streaming.
805
+ */
806
+ const useFollowToBottom = (
807
+ entries: readonly TranscriptEntry[],
808
+ pendingConfirmation: PendingConfirmation | null,
809
+ running: boolean,
810
+ ): FollowToBottom => {
811
+ // The scroll viewport, so new content can follow to the bottom without the reader
812
+ // having to chase it. Whether to follow lives in a ref (never a render input):
813
+ // it starts pinned (a chat opens on its latest turn), drops to false the moment
814
+ // the reader scrolls up to revisit earlier turns, and re-arms when they return to
815
+ // the bottom, so a streaming reply keeps the newest line in view yet never yanks
816
+ // someone away from the history they are reading.
817
+ const viewportRef = useRef<HTMLDivElement>(null);
818
+ const pinnedRef = useRef(true);
819
+
820
+ // The animation frame the follow to the bottom is scheduled into, while one is: the
821
+ // commits a fast stream makes within one frame share it (see the follow below).
822
+ const followFrameRef = useRef<number | null>(null);
823
+
824
+ // The offset the viewport was last known pinned at, written by the follow and by a scroll
825
+ // that finds the reader at the bottom, and null until one of them has. While a follow is
826
+ // scheduled, a scroll from here or below it is the content growing under the reader rather
827
+ // than the reader moving up.
828
+ const pinnedTopRef = useRef<number | null>(null);
829
+
830
+ // A browser dispatches a frame's scroll events before its animation frame callbacks, so
831
+ // the event the last follow's own write queued can arrive after a commit grew the reply
832
+ // and before the frame that follows it. It measures the growth, not the reader, so while
833
+ // a follow is scheduled only a move up from where the viewport was last pinned unpins it.
834
+ const trackScroll = useCallback(() => {
835
+ const viewport = viewportRef.current;
836
+ if (!viewport) {
837
+ return;
838
+ }
839
+
840
+ const pinnedTop = pinnedTopRef.current;
841
+ const heldForFollow =
842
+ pinnedRef.current &&
843
+ followFrameRef.current !== null &&
844
+ pinnedTop !== null &&
845
+ viewport.scrollTop >= pinnedTop;
846
+ pinnedRef.current = heldForFollow || isPinnedToBottom(viewport);
847
+ if (pinnedRef.current) {
848
+ pinnedTopRef.current = viewport.scrollTop;
849
+ }
850
+ }, []);
851
+
852
+ // Follow new content to the bottom while the reader is pinned there. Keyed on the
853
+ // deferred entries (a fresh array per committed update, so it fires on each
854
+ // streamed commit), the run flag, and the confirmation card, since each changes
855
+ // the content height. The jump is instant (a smooth scroll would queue a backlog
856
+ // of animations under a fast token stream) and gated on `pinnedRef` so a reader
857
+ // who scrolled up is left where they are.
858
+ //
859
+ // The commit only SCHEDULES the jump, into the next animation frame, and a frame
860
+ // already scheduled takes every commit after it. Reading the height is a layout, and
861
+ // read in the commit it forces one per commit, where a fast stream commits more than
862
+ // once a frame; read in the frame it is one read, folded into the layout the browser
863
+ // makes before it paints anyway. The frame is scheduled from a layout effect, so it is
864
+ // the frame that paints the new content: a passive effect would let the browser paint
865
+ // the taller content at the old offset first, and a streamed reply would visibly settle
866
+ // one frame low and then jump.
867
+ //
868
+ // The three values in the dependency list are read by NOTHING in the body, and that is the
869
+ // point: the body reads refs, so the list is what SCHEDULES the re-pin, after a turn lands,
870
+ // after a confirmation card appears or clears, and on every commit of a running stream. The
871
+ // exhaustive list is EMPTY, and an effect with an empty list runs once on mount and never
872
+ // follows the content again, which is the opposite of what a re-pin is for.
873
+ useLayoutEffect(() => {
874
+ if (followFrameRef.current !== null) {
875
+ return;
876
+ }
877
+
878
+ followFrameRef.current = requestAnimationFrame(() => {
879
+ followFrameRef.current = null;
880
+ const viewport = viewportRef.current;
881
+ if (viewport && pinnedRef.current) {
882
+ viewport.scrollTop = viewport.scrollHeight;
883
+ pinnedTopRef.current = viewport.scrollTop;
884
+ }
885
+ });
886
+ // oxlint-disable-next-line mountaya/no-extra-effect-deps -- the list schedules, it does not read.
887
+ }, [entries, pendingConfirmation, running]);
888
+
889
+ // A frame still scheduled when the transcript unmounts would reach for a viewport that is
890
+ // gone; it is cancelled with the transcript.
891
+ useEffect(
892
+ () => () => {
893
+ if (followFrameRef.current !== null) {
894
+ cancelAnimationFrame(followFrameRef.current);
895
+ followFrameRef.current = null;
896
+ }
897
+ },
898
+ [],
899
+ );
900
+
901
+ return { trackScroll, viewportRef };
902
+ };
903
+
904
+ /** TranscriptTurnProps carry one turn of the conversation and what its thumbs read. */
905
+ interface TranscriptTurnProps {
906
+ /** The turn. */
907
+ readonly entry: TranscriptEntry;
908
+ /** The rating capability, latched by {@link useSlot}, or undefined where none is mounted. */
909
+ readonly feedback: FeedbackSlotProps | undefined;
910
+ /** The reply's number as the run numbers it, or undefined for a turn that is no reply. */
911
+ readonly messageIndex: number | undefined;
912
+ /** Whether a turn is streaming: an earlier reply's thumbs are inert for the run's span. */
913
+ readonly running: boolean;
914
+ /** Whether this turn is the reply still streaming, which takes no thumbs yet. */
915
+ readonly streaming: boolean;
916
+ }
917
+
918
+ /**
919
+ * TranscriptTurnBase draws one turn: its body by its kind, and the thumbs under a settled reply.
920
+ *
921
+ * It is memoized, and every prop is a primitive, an entry the store keeps by identity until it
922
+ * changes, or a latched slot, so a token committed on the streaming reply renders that reply and
923
+ * no other turn of the list.
924
+ */
925
+ const TranscriptTurnBase = ({
926
+ entry,
927
+ feedback,
928
+ messageIndex,
929
+ running,
930
+ streaming,
931
+ }: TranscriptTurnProps) => {
932
+ const words = useStudioScopedStrings(SECTIONS);
933
+
934
+ return (
935
+ // mantine:exempt (see userTurnStyle and agentTurnStyle): role-aligned
936
+ // placement (the user bubble right, every agent turn full-width). The
937
+ // turn class layers on the wrap + min-width:0 that keep a long token
938
+ // contained.
939
+ <Box
940
+ className={"mtya-chat-turn"}
941
+ style={entry.role === "user" ? userTurnStyle : agentTurnStyle}
942
+ >
943
+ {entry.role === "user" ? (
944
+ // The user turn reads as a soft right-aligned bubble (the radius and
945
+ // wrap live in the userBubble class), rendering its words verbatim.
946
+ <Text
947
+ bg="var(--mantine-color-default-hover)"
948
+ className={"mtya-chat-user-bubble"}
949
+ px="sm"
950
+ py="xs"
951
+ >
952
+ {entry.content}
953
+ </Text>
954
+ ) : entry.role === "error" ? (
955
+ // The assistant's failure reads as its reply to that turn: the shared
956
+ // error alert carries the already-localized (or provider-forwarded)
957
+ // message in the assistant's lane.
958
+ <ErrorAlert>{entry.content}</ErrorAlert>
959
+ ) : entry.role === "activity" ? (
960
+ // The tool action is a permanent, collapsible row at its place in the
961
+ // conversation, so nothing the run did flashes and vanishes.
962
+ <ActivityRow entry={entry} />
963
+ ) : entry.role === "question" ? (
964
+ // The assistant asked the user to pick: the options render as
965
+ // buttons, a tap sends the label as the reply, and the settled
966
+ // card stays in the history as the record of what was chosen. The
967
+ // card reads the answer handler off the Questions slot.
968
+ <QuestionCard entry={entry} />
969
+ ) : entry.role === "suggestions" ? (
970
+ // The run generated route candidates: they render in the
971
+ // suggestions panel's own list (hover previews a route on the
972
+ // map, a tap stages it for editing, a pin keeps it for the next
973
+ // batch), and the settled card stays in the history as the record
974
+ // of what was offered and chosen. The card reads the pick, preview,
975
+ // pin, regenerate and unit format off the Suggestions slot.
976
+ <SuggestionsCard entry={entry} />
977
+ ) : entry.role === "warning" ? (
978
+ // The run answered, and the workspace does not back part of the
979
+ // claim. Orange, not red: the run has not failed, it is handing the
980
+ // user grounds for scepticism about the reply above. The criterion
981
+ // sentences render verbatim, since they were authored for the user.
982
+ <WarningAlert title={words.prompt.checksUnmetTitle}>
983
+ {entry.lines.length === 1 ? (
984
+ <Text size="sm">{entry.lines[0]}</Text>
985
+ ) : (
986
+ <List size="sm">
987
+ {/* Keyed by the line's own OCCURRENCE, which is what identifies it
988
+ here: the list is appended to once and never reordered or
989
+ filtered, and the wire array is carried verbatim (two retrieved
990
+ skills that promise the same criterion produce the same sentence
991
+ twice), so the sentence alone is not a key. */}
992
+ {warningLineKeys(entry.lines).map(([key, line]) => (
993
+ <List.Item key={key}>{line}</List.Item>
994
+ ))}
995
+ </List>
996
+ )}
997
+ </WarningAlert>
998
+ ) : (
999
+ // The assistant turn renders its markdown source. The fallback shows
1000
+ // the same plain text while the markdown chunk loads, so the first
1001
+ // streamed reply is never blank, and streaming stays lossless.
1002
+ <Suspense fallback={<Text>{entry.content}</Text>}>
1003
+ <AgentMarkdown content={entry.content} />
1004
+ </Suspense>
1005
+ )}
1006
+ {feedback !== undefined && messageIndex !== undefined && !streaming ? (
1007
+ // Only a SETTLED reply is rateable: thumbs under a turn still
1008
+ // streaming would ask for a verdict on a sentence that is not
1009
+ // finished yet. Every other reply keeps its thumbs mounted but inert
1010
+ // for the run's duration, since the run owns the surface until it settles.
1011
+ // `running` is this chat's own run state, so the director chat locks
1012
+ // on its run and the co-pilot on its own.
1013
+ //
1014
+ // The slot's own handler is passed straight through, with the index
1015
+ // riding as a prop: an arrow closing over the index here would hand the
1016
+ // memoized pair a fresh identity on every streamed token, which is the
1017
+ // whole cost the memo exists to avoid.
1018
+ <MessageFeedback
1019
+ disabled={running}
1020
+ messageIndex={messageIndex}
1021
+ onRate={feedback.onRate}
1022
+ rating={feedback.ratings[messageIndex]}
1023
+ />
1024
+ ) : null}
1025
+ </Box>
1026
+ );
1027
+ };
1028
+
1029
+ const TranscriptTurn = memo(TranscriptTurnBase);
1030
+
1031
+ /** TranscriptFootProps carry what trails the last turn. */
1032
+ interface TranscriptFootProps {
1033
+ /** The confirmation the run is parked on, or null. */
1034
+ readonly pendingConfirmation: PendingConfirmation | null;
1035
+ /** Settles that confirmation with the reader's decision. */
1036
+ readonly resolveConfirmation: (approved: boolean) => void;
1037
+ /** Whether a turn is streaming. */
1038
+ readonly running: boolean;
1039
+ }
1040
+
1041
+ /**
1042
+ * TranscriptFoot is what trails the last turn: the in-chat approval while the run waits on the
1043
+ * reader, the thinking dots while it runs, and nothing at rest.
1044
+ */
1045
+ const TranscriptFoot = ({
1046
+ pendingConfirmation,
1047
+ resolveConfirmation,
1048
+ running,
1049
+ }: TranscriptFootProps) => {
1050
+ const words = useStudioScopedStrings(SECTIONS);
1051
+
1052
+ if (pendingConfirmation) {
1053
+ return (
1054
+ // mantine:exempt (see agentTurnStyle): the approval card stands in for
1055
+ // the thinking dots in the assistant's lane while the run waits on the
1056
+ // user's decision (the agent is waiting, not thinking).
1057
+ <Box className={"mtya-chat-turn"} style={agentTurnStyle}>
1058
+ <ConfirmationCard
1059
+ name={pendingConfirmation.name}
1060
+ onApprove={() => resolveConfirmation(true)}
1061
+ onDeny={() => resolveConfirmation(false)}
1062
+ summary={pendingConfirmation.summary}
1063
+ />
1064
+ </Box>
1065
+ );
1066
+ }
1067
+
1068
+ if (!running) {
1069
+ return null;
1070
+ }
1071
+
1072
+ return (
1073
+ // mantine:exempt (see agentTurnStyle): the pending-reply indicator sits
1074
+ // in the assistant's lane at the left, where the reply's first line will
1075
+ // land, so it reads as the assistant composing its next message rather
1076
+ // than a stray glyph. It is a pure typing indicator (the permanent
1077
+ // activity rows above carry what the run is doing), kept calm with a muted
1078
+ // dot color and a little breathing room. Its arrival is an addition to the
1079
+ // scroller's log region, which announces it; a live region of its own would
1080
+ // nest inside that one and duplicate the announcement.
1081
+ //
1082
+ // The `thinking` class carries its reduced-motion guard. The theme's
1083
+ // respectReducedMotion covers Mantine's JS transitions, not the raw CSS
1084
+ // keyframes the dots loader animates on, and this loader has no static
1085
+ // variant, so the CSS stops the pulse and leaves the three dots standing,
1086
+ // which is what keeps the "composing" signal for a reader who asked for
1087
+ // less motion rather than removing it.
1088
+ <Box className={`${"mtya-chat-turn"} ${"mtya-chat-thinking"}`} py="xxs" style={agentTurnStyle}>
1089
+ <Loader
1090
+ aria-label={words.prompt.thinking}
1091
+ color="gray"
1092
+ role="img"
1093
+ size={iconSizes.xs}
1094
+ type="dots"
1095
+ />
1096
+ </Box>
1097
+ );
1098
+ };
1099
+
1100
+ /** TranscriptScrollerProps carry the conversation's scroller and the follow it is wired to. */
1101
+ interface TranscriptScrollerProps extends FollowToBottom {
1102
+ /** The turns. */
1103
+ readonly children: ReactNode;
1104
+ /** The scroller's maximum height in pixels, or undefined to fill the parent's height. */
1105
+ readonly maxHeight: number | undefined;
1106
+ /** Whether a turn is streaming, which holds the live region's announcement. */
1107
+ readonly running: boolean;
1108
+ /** The log region, which a decided confirmation returns focus to. */
1109
+ readonly scrollerRef: RefObject<HTMLDivElement | null>;
1110
+ }
1111
+
1112
+ /**
1113
+ * TranscriptScroller is the conversation's scroller, in both footprints: the co-pilot panel
1114
+ * fills its parent's height (the flex space between header and composer), the director's rail
1115
+ * chat bounds itself with Autosize so the wizard rail keeps its rhythm.
1116
+ *
1117
+ * It is also the conversation's ONLY live region. Every turn lands inside it, so the log covers
1118
+ * each one as an addition; a card declaring its own polite region would nest inside this one,
1119
+ * and nested live regions announce twice or garble the pair into one run-on utterance.
1120
+ *
1121
+ * `additions` alone, never `additions text`: a streamed reply mutates the text of one node
1122
+ * hundreds of times, and with `text` in the set every one of those mutations would be an
1123
+ * announceable change, the reader hearing the answer re-read at itself token by token.
1124
+ * `aria-busy` carries the reply-complete boundary instead: assistive tech holds its
1125
+ * announcement while the region is busy and speaks once the flag clears.
1126
+ *
1127
+ * The residual: without `text`, growing one entry in place produces no additions event at
1128
+ * all, so the clearing `aria-busy` is the only thing that marks the answer. Fully correct is a
1129
+ * separate visually-hidden `aria-live="polite"` region carrying only the settled reply, with
1130
+ * this scroller demoted to `aria-live="off"`. That splits the announcement from the scroll
1131
+ * container and belongs with the structural change that gives the transcript a second region
1132
+ * to own.
1133
+ */
1134
+ const TranscriptScroller = ({
1135
+ children,
1136
+ maxHeight,
1137
+ running,
1138
+ scrollerRef,
1139
+ trackScroll,
1140
+ viewportRef,
1141
+ }: TranscriptScrollerProps) => {
1142
+ const words = useStudioScopedStrings(SECTIONS);
1143
+ const scrollerProps = {
1144
+ "aria-busy": running,
1145
+ "aria-label": words.prompt.transcriptLabel,
1146
+ "aria-live": "polite" as const,
1147
+ "aria-relevant": "additions" as const,
1148
+ onScrollPositionChange: trackScroll,
1149
+ ref: scrollerRef,
1150
+ role: "log",
1151
+ // Vertical-only scroll: the viewport clips the horizontal axis
1152
+ // (overflow-x: hidden), so even if some future turn slipped a wide child
1153
+ // past the content-level wrap/scroll guards, it degrades to a clipped edge
1154
+ // rather than surfacing a panel-level horizontal scrollbar.
1155
+ scrollbars: "y" as const,
1156
+ // The log region takes focus after an in-chat confirmation is decided (see
1157
+ // resolveConfirmation), so it must be focusable, but only programmatically:
1158
+ // a positive tabIndex would put a scroll container in the tab order between
1159
+ // the conversation's own controls.
1160
+ tabIndex: -1,
1161
+ type: "hover" as const,
1162
+ viewportRef,
1163
+ };
1164
+
1165
+ if (maxHeight !== undefined) {
1166
+ return (
1167
+ <ScrollArea.Autosize {...scrollerProps} mah={maxHeight}>
1168
+ {children}
1169
+ </ScrollArea.Autosize>
1170
+ );
1171
+ }
1172
+
1173
+ return (
1174
+ <ScrollArea {...scrollerProps} h="100%">
1175
+ {children}
1176
+ </ScrollArea>
1177
+ );
1178
+ };
1179
+
1180
+ /**
1181
+ * ChatTranscriptRoot is the transcript itself: see {@link ChatTranscript} for what it renders
1182
+ * and why. A turn is drawn by {@link TranscriptTurn}, what trails the last one by
1183
+ * {@link TranscriptFoot}, the scroller by {@link TranscriptScroller}, and the scroll follow by
1184
+ * {@link useFollowToBottom}.
1185
+ */
1186
+ const ChatTranscriptRoot = ({
1187
+ children,
1188
+ emptyHint,
1189
+ emptyHintInset = "sm",
1190
+ entries,
1191
+ maxHeight,
1192
+ running,
1193
+ }: ChatTranscriptProps) => {
1194
+ // The capabilities this surface mounted, latched so each one keeps its identity
1195
+ // for as long as the surface's own values do (see useSlot).
1196
+ const mounted = readSlots(children);
1197
+ const confirmations = useSlot(mounted.confirmations);
1198
+ const feedback = useSlot(mounted.feedback);
1199
+ const questions = useSlot(mounted.questions);
1200
+ const suggestions = useSlot(mounted.suggestions);
1201
+
1202
+ const pendingConfirmation = confirmations?.pending ?? null;
1203
+
1204
+ // The streamed turn is non-urgent: every accumulated token rebuilds the
1205
+ // transcript array (and the running assistant entry). Deferring lets React
1206
+ // coalesce the rapid token bursts and render the latest committed transcript
1207
+ // off the urgent path, keeping a sibling composer input responsive while
1208
+ // the assistant streams. The full text always lives in the store, so the
1209
+ // deferred value loses no tokens: it converges to the latest accumulation.
1210
+ const deferredEntries = useDeferredValue(entries);
1211
+
1212
+ const follow = useFollowToBottom(deferredEntries, pendingConfirmation, running);
1213
+
1214
+ // The scroller's own element: the log region, which is the root, not the viewport.
1215
+ // A decided confirmation returns focus here (see below), so it carries tabIndex={-1}
1216
+ // to be focusable without joining the tab order.
1217
+ const scrollerRef = useRef<HTMLDivElement>(null);
1218
+
1219
+ // Deciding the approval unmounts the card the reader's focus is sitting on (the
1220
+ // Deny button the card focused on mount), and a removed element takes its focus to
1221
+ // <body>, stranding a keyboard user at the top of the document with nothing to
1222
+ // resume from. Focus moves to the log region instead: it is the conversation
1223
+ // itself, which is exactly where the run's response to the decision arrives.
1224
+ const onResolve = confirmations?.onResolve;
1225
+ const resolveConfirmation = useCallback(
1226
+ (approved: boolean) => {
1227
+ onResolve?.(approved);
1228
+ scrollerRef.current?.focus();
1229
+ },
1230
+ [onResolve],
1231
+ );
1232
+
1233
+ // Assistant replies numbered as the RUN numbers them, so a rating names the same
1234
+ // message the backend will see. The run's own index (carried on the turn itself, set
1235
+ // when its `message` event completed the reply) wins wherever it reported one. The
1236
+ // local count is a fallback: after a reload mid-run it restarts at zero while the
1237
+ // conversation is already several answers in. It is derived from the entry list rather
1238
+ // than the array position, because activity rows and errors share the transcript.
1239
+ //
1240
+ // Keyed on the DEFERRED entries, never the live ones: these numbers address the rows
1241
+ // actually on screen.
1242
+ const assistantIndexes = useMemo(() => {
1243
+ const indexes = new Map<string, number>();
1244
+ let next = 0;
1245
+ for (const entry of deferredEntries) {
1246
+ if (entry.role === "assistant") {
1247
+ indexes.set(entry.id, entry.messageIndex ?? next);
1248
+ next += 1;
1249
+ }
1250
+ }
1251
+
1252
+ return indexes;
1253
+ }, [deferredEntries]);
1254
+
1255
+ // The reply a run streams is the last reply that answers the last thing the reader said.
1256
+ // Between the reader's message and the first token of its answer, the last reply on screen
1257
+ // is the settled one before, which keeps its thumbs.
1258
+ const streamingId = useMemo(() => {
1259
+ const last = deferredEntries.findLast(
1260
+ (entry) => entry.role === "assistant" || entry.role === "user",
1261
+ );
1262
+
1263
+ return last?.role === "assistant" ? last.id : undefined;
1264
+ }, [deferredEntries]);
1265
+
1266
+ const turns =
1267
+ deferredEntries.length === 0 && !running ? (
1268
+ // Before the first turn: the caller's quiet hint (the co-pilot invites a first
1269
+ // prompt; the director invites the first shot direction), or nothing at all when
1270
+ // a caller omits it, at the caller's own vertical inset.
1271
+ emptyHint ? (
1272
+ <Text c="dimmed" py={emptyHintInset}>
1273
+ {emptyHint}
1274
+ </Text>
1275
+ ) : null
1276
+ ) : (
1277
+ <Stack gap="sm">
1278
+ {deferredEntries.map((entry) => (
1279
+ <TranscriptTurn
1280
+ entry={entry}
1281
+ feedback={feedback}
1282
+ // The entry id is stable across token accumulation (assistant turns)
1283
+ // and across settle (activity rows keyed by the tool call id), so a
1284
+ // row keeps its key as it grows or settles.
1285
+ key={entry.id}
1286
+ messageIndex={assistantIndexes.get(entry.id)}
1287
+ running={running}
1288
+ streaming={running && entry.id === streamingId}
1289
+ />
1290
+ ))}
1291
+ <TranscriptFoot
1292
+ pendingConfirmation={pendingConfirmation}
1293
+ resolveConfirmation={resolveConfirmation}
1294
+ running={running}
1295
+ />
1296
+ </Stack>
1297
+ );
1298
+
1299
+ // The two turn-kind capabilities are published here rather than plumbed through the
1300
+ // entry loop, so each card reads only its own: a hover that moves `previewedSeed`
1301
+ // re-renders the suggestions cards and leaves every question card and thumbs pair
1302
+ // untouched. Both values are latched (see useSlot), so an unchanged surface hands
1303
+ // the same reference on every streamed token and both memos hold.
1304
+ return (
1305
+ <TranscriptScroller
1306
+ maxHeight={maxHeight}
1307
+ running={running}
1308
+ scrollerRef={scrollerRef}
1309
+ trackScroll={follow.trackScroll}
1310
+ viewportRef={follow.viewportRef}
1311
+ >
1312
+ <QuestionsSlotContext value={questions}>
1313
+ <SuggestionsSlotContext value={suggestions}>{turns}</SuggestionsSlotContext>
1314
+ </QuestionsSlotContext>
1315
+ </TranscriptScroller>
1316
+ );
1317
+ };
1318
+
1319
+ /**
1320
+ * ChatTranscript renders a role-structured AI conversation: the presentational
1321
+ * core the studio co-pilot's `<CopilotTranscript>` and the video wizard's director
1322
+ * chat both mount, so the two surfaces share one turn grammar: a user turn as a
1323
+ * right-aligned soft bubble, an assistant reply as full-width markdown, an
1324
+ * assistant-side error as a full-width error alert (the failure reads as the reply
1325
+ * to the turn that failed), and every agent tool action as a permanent,
1326
+ * collapsible activity row at its chronological position, so nothing the run did
1327
+ * flashes and vanishes. While the run streams, a pure typing indicator (a dots
1328
+ * loader) trails the entries as the pending reply; when the run instead waits on
1329
+ * the user to approve a destructive tool, an in-chat confirmation card stands in
1330
+ * for the dots (the agent is waiting on the user, not thinking) so the approval
1331
+ * never becomes a fullscreen modal.
1332
+ *
1333
+ * It is a compound component. The conversation itself (`entries` and `running`)
1334
+ * arrives as props, because that is the data every chat surface has. Everything a
1335
+ * particular turn kind needs arrives as a SLOT the surface mounts as a child:
1336
+ * `CopilotTranscript` mounts every slot, and the video director's chat mounts none.
1337
+ *
1338
+ * A slot is a capability, and its absence is a fact about the surface: the video
1339
+ * director's bus holds camera verbs only, so its runs cannot ask a question or suggest
1340
+ * a route and it mounts neither slot. Expressing that by passing no handler is a branch
1341
+ * in every card, and the branch renders the card READ-ONLY, a silent degradation
1342
+ * nobody notices until a user reports that tapping an option does nothing. The turn
1343
+ * kind's body demands its slot and says so: loudly in development, and by dropping
1344
+ * that one turn in production, where blanking a conversation would be the worse
1345
+ * failure.
1346
+ *
1347
+ * The streamed turn is deferred (React coalesces rapid token bursts off the urgent
1348
+ * path so a sibling composer stays responsive), and new content follows to the
1349
+ * bottom on its own while the reader sits at the latest turn; scrolling up to read
1350
+ * history pauses that follow until they return to the bottom. It holds no
1351
+ * conversation state: the caller's store owns the entries, and this renders them.
1352
+ */
1353
+ export const ChatTranscript = Object.assign(ChatTranscriptRoot, {
1354
+ Confirmations,
1355
+ Feedback,
1356
+ Questions,
1357
+ Suggestions,
1358
+ });