vite-hub 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1149) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +178 -26
  3. package/dist/_internal/agent/eve.d.ts +1 -0
  4. package/dist/_internal/agent/eve.js +2 -0
  5. package/dist/_internal/agent/invocations.d.ts +2 -0
  6. package/dist/_internal/agent/invocations.js +88 -0
  7. package/dist/_internal/agent/operations.d.ts +1 -0
  8. package/dist/_internal/agent/operations.js +2 -0
  9. package/dist/_internal/agent/runtime/invocations-dev.d.ts +1 -0
  10. package/dist/_internal/agent/runtime/invocations-dev.js +2 -0
  11. package/dist/_internal/agent/runtime/process.d.ts +1 -0
  12. package/dist/_internal/agent/runtime/process.js +2 -0
  13. package/dist/_internal/agent/server/registry.d.ts +1 -0
  14. package/dist/_internal/agent/server/registry.js +2 -0
  15. package/dist/_internal/auth/runtime/console.d.ts +1 -0
  16. package/dist/_internal/auth/runtime/console.js +2 -0
  17. package/dist/_internal/blob/operations.d.ts +1 -0
  18. package/dist/_internal/blob/operations.js +2 -0
  19. package/dist/_internal/comments/operations.d.ts +1 -0
  20. package/dist/_internal/comments/operations.js +2 -0
  21. package/dist/_internal/comments/runtime/console.d.ts +1 -0
  22. package/dist/_internal/comments/runtime/console.js +2 -0
  23. package/dist/_internal/content/operations.d.ts +1 -0
  24. package/dist/_internal/content/operations.js +2 -0
  25. package/dist/_internal/content/runtime/console.d.ts +1 -0
  26. package/dist/_internal/content/runtime/console.js +2 -0
  27. package/dist/_internal/database/runtime/state.d.ts +5 -0
  28. package/dist/_internal/database/runtime/state.js +7 -0
  29. package/dist/_internal/email/operations.d.ts +1 -0
  30. package/dist/_internal/email/operations.js +2 -0
  31. package/dist/_internal/email/runtime/console.d.ts +1 -0
  32. package/dist/_internal/email/runtime/console.js +2 -0
  33. package/dist/_internal/kv/operations.d.ts +1 -0
  34. package/dist/_internal/kv/operations.js +2 -0
  35. package/dist/_internal/kv/runtime/disabled-upstash.d.ts +2 -3
  36. package/dist/_internal/kv/runtime/disabled-upstash.js +2 -1
  37. package/dist/_internal/queue/operations.d.ts +1 -0
  38. package/dist/_internal/queue/operations.js +2 -0
  39. package/dist/_internal/rate-limit/operations.d.ts +1 -0
  40. package/dist/_internal/rate-limit/operations.js +2 -0
  41. package/dist/_internal/sandbox/task/runtime/state.d.ts +1 -0
  42. package/dist/_internal/sandbox/task/runtime/state.js +2 -0
  43. package/dist/_internal/schedule/operations.d.ts +1 -0
  44. package/dist/_internal/schedule/operations.js +2 -0
  45. package/dist/_internal/schedule/runtime/kv.d.ts +1 -0
  46. package/dist/_internal/schedule/runtime/kv.js +2 -0
  47. package/dist/_internal/task/operations.d.ts +5 -0
  48. package/dist/_internal/task/operations.js +2 -0
  49. package/dist/_internal/workflow/operations.d.ts +1 -0
  50. package/dist/_internal/workflow/operations.js +2 -0
  51. package/dist/_internal/workflow/runtime/cloudflare-runner.d.ts +1 -0
  52. package/dist/_internal/workflow/runtime/cloudflare-runner.js +2 -0
  53. package/dist/_internal/workflow/runtime/cloudflare-vite.d.ts +1 -0
  54. package/dist/_internal/workflow/runtime/cloudflare-vite.js +2 -0
  55. package/dist/_internal/workflow/runtime/vercel-vite.d.ts +1 -0
  56. package/dist/_internal/workflow/runtime/vercel-vite.js +2 -0
  57. package/dist/_internal/workspace/operations.d.ts +1 -0
  58. package/dist/_internal/workspace/operations.js +2 -0
  59. package/dist/access-BhTe9yuV.js +516 -0
  60. package/dist/access-CBqnsYdj.d.ts +130 -0
  61. package/dist/agent/capabilities.d.ts +24 -1
  62. package/dist/agent/capabilities.js +56 -1
  63. package/dist/agent/invocations/d1.d.ts +1 -0
  64. package/dist/agent/invocations/d1.js +2 -0
  65. package/dist/agent/invocations/database.d.ts +2 -0
  66. package/dist/agent/invocations/database.js +91 -0
  67. package/dist/agent/invocations/sqlite.d.ts +1 -0
  68. package/dist/agent/invocations/sqlite.js +2 -0
  69. package/dist/agent/mcp.d.ts +1 -0
  70. package/dist/agent/mcp.js +2 -0
  71. package/dist/agent/observability.d.ts +1 -0
  72. package/dist/agent/observability.js +2 -0
  73. package/dist/agent/process-host.d.ts +1 -0
  74. package/dist/agent/process-host.js +2 -0
  75. package/dist/agent/runtime/process.d.ts +1 -0
  76. package/dist/agent/runtime/process.js +2 -0
  77. package/dist/agent/server/github.d.ts +1 -0
  78. package/dist/agent/server/github.js +2 -0
  79. package/dist/agent/vite.d.ts +1 -0
  80. package/dist/agent/vite.js +2 -0
  81. package/dist/agent/vue.d.ts +1 -0
  82. package/dist/agent/vue.js +2 -0
  83. package/dist/agent-invocations.post-CFKMEy-h.js +432 -0
  84. package/dist/agent.d.ts +12 -1
  85. package/dist/agent.js +49 -1
  86. package/dist/agents-BNmuN4Qa.d.ts +99 -0
  87. package/dist/agents-CVehuMFA.js +118 -0
  88. package/dist/auth/console-runtime.d.ts +1 -0
  89. package/dist/auth/console-runtime.js +2 -0
  90. package/dist/auth/console.d.ts +1 -0
  91. package/dist/auth/console.js +2 -0
  92. package/dist/auth/presets.d.ts +1 -0
  93. package/dist/auth/presets.js +2 -0
  94. package/dist/auth/vue.d.ts +1 -0
  95. package/dist/auth/vue.js +2 -0
  96. package/dist/auth-BSSM-qh0.js +700 -0
  97. package/dist/auth-CG8tmgH7.d.ts +106 -0
  98. package/dist/auth-cloudflare-access-CE8xUzhY.d.ts +50 -0
  99. package/dist/auth-inline-config--vlclzm3.js +18 -0
  100. package/dist/auth-inline-config-R6q_4Iwo.d.ts +30 -0
  101. package/dist/auth-path-B7Ssonj-.js +49 -0
  102. package/dist/bin.d.ts +1 -1
  103. package/dist/bin.js +346 -7
  104. package/dist/blob/client.d.ts +1 -0
  105. package/dist/blob/client.js +2 -0
  106. package/dist/blob/media.d.ts +1 -0
  107. package/dist/blob/media.js +2 -0
  108. package/dist/blob/vue.d.ts +1 -0
  109. package/dist/blob/vue.js +2 -0
  110. package/dist/blob-D9v5Djxw.d.ts +7 -0
  111. package/dist/browser/actions.d.ts +1 -0
  112. package/dist/browser/actions.js +2 -0
  113. package/dist/channels/server.d.ts +1 -0
  114. package/dist/channels/server.js +2 -0
  115. package/dist/channels.d.ts +1 -0
  116. package/dist/channels.js +2 -0
  117. package/dist/cloudflare-env-CIZCKabz.js +70 -0
  118. package/dist/cloudflare-prerender.mjs +24 -0
  119. package/dist/cloudflare-types.d.ts +1 -0
  120. package/dist/comments/anchor.d.ts +1 -0
  121. package/dist/comments/anchor.js +2 -0
  122. package/dist/comments/client.d.ts +1 -0
  123. package/dist/comments/client.js +2 -0
  124. package/dist/comments/database/postgres.d.ts +1 -0
  125. package/dist/comments/database/postgres.js +2 -0
  126. package/dist/comments/database.d.ts +1 -0
  127. package/dist/comments/database.js +2 -0
  128. package/dist/comments/realtime.d.ts +1 -0
  129. package/dist/comments/realtime.js +2 -0
  130. package/dist/comments/rpc.d.ts +1 -0
  131. package/dist/comments/rpc.js +2 -0
  132. package/dist/comments/runtime/auth.d.ts +1 -0
  133. package/dist/comments/runtime/auth.js +2 -0
  134. package/dist/comments/runtime.d.ts +1 -0
  135. package/dist/comments/runtime.js +2 -0
  136. package/dist/comments/server.d.ts +1 -0
  137. package/dist/comments/server.js +2 -0
  138. package/dist/comments-overlay/loader.BcGn0Hsk.js +1 -0
  139. package/dist/comments-overlay/overlay.D7vmaSrE.js +2 -0
  140. package/dist/comments.d.ts +1 -0
  141. package/dist/comments.js +2 -0
  142. package/dist/connections/agent.d.ts +1 -0
  143. package/dist/connections/agent.js +2 -0
  144. package/dist/connections/chatgpt.d.ts +1 -0
  145. package/dist/connections/chatgpt.js +2 -0
  146. package/dist/connections/google.d.ts +1 -0
  147. package/dist/connections/google.js +2 -0
  148. package/dist/connections/http.d.ts +1 -0
  149. package/dist/connections/http.js +2 -0
  150. package/dist/connections/server.d.ts +1 -0
  151. package/dist/connections/server.js +2 -0
  152. package/dist/connections.d.ts +1 -0
  153. package/dist/connections.js +2 -0
  154. package/dist/console/auth-client.d.ts +8 -0
  155. package/dist/console/auth-client.js +6 -0
  156. package/dist/console/auth-cloudflare-access.d.ts +2 -0
  157. package/dist/console/auth-cloudflare-access.js +116 -0
  158. package/dist/console/auth-inline.d.ts +6 -0
  159. package/dist/console/auth-inline.js +107 -0
  160. package/dist/console/auth.d.ts +2 -0
  161. package/dist/console/auth.js +2 -0
  162. package/dist/console/runtime/client/appearance.d.ts +62 -0
  163. package/dist/console/runtime/client/appearance.js +87 -0
  164. package/dist/console/runtime/client/auth-management.ts +81 -0
  165. package/dist/console/runtime/client/blob-media.d.ts +46 -0
  166. package/dist/console/runtime/client/blob-media.js +257 -0
  167. package/dist/console/runtime/client/build.d.ts +14 -0
  168. package/dist/console/runtime/client/build.js +68 -0
  169. package/dist/console/runtime/client/connections-management.d.ts +68 -0
  170. package/dist/console/runtime/client/connections-management.js +201 -0
  171. package/dist/console/runtime/client/documents.d.ts +430 -0
  172. package/dist/console/runtime/client/documents.js +501 -0
  173. package/dist/console/runtime/client/editor.d.ts +82 -0
  174. package/dist/console/runtime/client/editor.js +248 -0
  175. package/dist/console/runtime/client/env-groups.d.ts +28 -0
  176. package/dist/console/runtime/client/env-groups.js +39 -0
  177. package/dist/console/runtime/client/env-management.d.ts +20 -0
  178. package/dist/console/runtime/client/env-management.js +84 -0
  179. package/dist/console/runtime/client/env-status.d.ts +6 -0
  180. package/dist/console/runtime/client/env-status.js +10 -0
  181. package/dist/console/runtime/client/format.d.ts +32 -0
  182. package/dist/console/runtime/client/format.js +109 -0
  183. package/dist/console/runtime/client/invocation-deletion.d.ts +17 -0
  184. package/dist/console/runtime/client/invocation-deletion.js +25 -0
  185. package/dist/console/runtime/client/invocation.d.ts +28 -0
  186. package/dist/console/runtime/client/invocation.js +81 -0
  187. package/dist/console/runtime/client/live.d.ts +69 -0
  188. package/dist/console/runtime/client/live.js +165 -0
  189. package/dist/console/runtime/client/mcp.d.ts +9 -0
  190. package/dist/console/runtime/client/mcp.js +14 -0
  191. package/dist/console/runtime/client/media-library.d.ts +207 -0
  192. package/dist/console/runtime/client/media-library.js +243 -0
  193. package/dist/console/runtime/client/media-uploads.d.ts +33 -0
  194. package/dist/console/runtime/client/media-uploads.js +97 -0
  195. package/dist/console/runtime/client/media.d.ts +73 -0
  196. package/dist/console/runtime/client/media.js +13 -0
  197. package/dist/console/runtime/client/operation-view.d.ts +17 -0
  198. package/dist/console/runtime/client/operation-view.js +85 -0
  199. package/dist/console/runtime/client/presence.d.ts +102 -0
  200. package/dist/console/runtime/client/presence.js +269 -0
  201. package/dist/console/runtime/client/preview.d.ts +78 -0
  202. package/dist/console/runtime/client/preview.js +115 -0
  203. package/dist/console/runtime/client/problem.d.ts +19 -0
  204. package/dist/console/runtime/client/problem.js +59 -0
  205. package/dist/console/runtime/client/publish.d.ts +12 -0
  206. package/dist/console/runtime/client/publish.js +18 -0
  207. package/dist/console/runtime/client/rate-limit.d.ts +36 -0
  208. package/dist/console/runtime/client/rate-limit.js +96 -0
  209. package/dist/console/runtime/client/read-only.d.ts +9 -0
  210. package/dist/console/runtime/client/read-only.js +12 -0
  211. package/dist/console/runtime/client/request.d.ts +76 -0
  212. package/dist/console/runtime/client/request.js +471 -0
  213. package/dist/console/runtime/client/schedule-run.d.ts +13 -0
  214. package/dist/console/runtime/client/schedule-run.js +47 -0
  215. package/dist/console/runtime/client/schema-form.d.ts +2 -0
  216. package/dist/console/runtime/client/schema-form.js +296 -0
  217. package/dist/console/runtime/client/sections.d.ts +26 -0
  218. package/dist/console/runtime/client/sections.js +84 -0
  219. package/dist/console/runtime/client/sign-in.d.ts +21 -0
  220. package/dist/console/runtime/client/sign-in.js +16 -0
  221. package/dist/console/runtime/client/time.d.ts +30 -0
  222. package/dist/console/runtime/client/time.js +106 -0
  223. package/dist/console/runtime/client/toast.d.ts +39 -0
  224. package/dist/console/runtime/client/toast.js +35 -0
  225. package/dist/console/runtime/client/workflow.d.ts +20 -0
  226. package/dist/console/runtime/client/workflow.js +79 -0
  227. package/dist/console/runtime/components/console-agent-list.ts +61 -0
  228. package/dist/console/runtime/components/console-app.vue +1755 -0
  229. package/dist/console/runtime/components/console-auth-action.vue +239 -0
  230. package/dist/console/runtime/components/console-auth-activity.vue +166 -0
  231. package/dist/console/runtime/components/console-auth-chart.vue +102 -0
  232. package/dist/console/runtime/components/console-auth-detail.vue +406 -0
  233. package/dist/console/runtime/components/console-auth-event-list.vue +79 -0
  234. package/dist/console/runtime/components/console-auth-event-setup.vue +39 -0
  235. package/dist/console/runtime/components/console-auth-overview.vue +107 -0
  236. package/dist/console/runtime/components/console-auth-user-events.vue +65 -0
  237. package/dist/console/runtime/components/console-auth.vue +649 -0
  238. package/dist/console/runtime/components/console-blob-detail.vue +93 -0
  239. package/dist/console/runtime/components/console-blob.vue +146 -0
  240. package/dist/console/runtime/components/console-comark-component.vue +108 -0
  241. package/dist/console/runtime/components/console-connect-agent.vue +59 -0
  242. package/dist/console/runtime/components/console-connection-state.vue +43 -0
  243. package/dist/console/runtime/components/console-connection.ts +18 -0
  244. package/dist/console/runtime/components/console-connections-activity.vue +76 -0
  245. package/dist/console/runtime/components/console-connections-approvals.vue +169 -0
  246. package/dist/console/runtime/components/console-connections-details.vue +295 -0
  247. package/dist/console/runtime/components/console-connections.vue +296 -0
  248. package/dist/console/runtime/components/console-database-model.ts +264 -0
  249. package/dist/console/runtime/components/console-database.vue +634 -0
  250. package/dist/console/runtime/components/console-definitions.vue +506 -0
  251. package/dist/console/runtime/components/console-document-dashboard.vue +492 -0
  252. package/dist/console/runtime/components/console-document-diff.vue +43 -0
  253. package/dist/console/runtime/components/console-document-editor.vue +2605 -0
  254. package/dist/console/runtime/components/console-document-history.vue +118 -0
  255. package/dist/console/runtime/components/console-document-list.vue +577 -0
  256. package/dist/console/runtime/components/console-document-preview.vue +422 -0
  257. package/dist/console/runtime/components/console-document-settings.vue +108 -0
  258. package/dist/console/runtime/components/console-documents.vue +480 -0
  259. package/dist/console/runtime/components/console-env-access.vue +151 -0
  260. package/dist/console/runtime/components/console-env-activity.vue +89 -0
  261. package/dist/console/runtime/components/console-env-details.vue +68 -0
  262. package/dist/console/runtime/components/console-env-managed.vue +203 -0
  263. package/dist/console/runtime/components/console-env.vue +301 -0
  264. package/dist/console/runtime/components/console-frame.vue +255 -0
  265. package/dist/console/runtime/components/console-home.vue +627 -0
  266. package/dist/console/runtime/components/console-invocation-composer.vue +159 -0
  267. package/dist/console/runtime/components/console-kv.vue +537 -0
  268. package/dist/console/runtime/components/console-loading.vue +28 -0
  269. package/dist/console/runtime/components/console-mark.vue +5 -0
  270. package/dist/console/runtime/components/console-markdown-editor.vue +705 -0
  271. package/dist/console/runtime/components/console-media-browser.vue +986 -0
  272. package/dist/console/runtime/components/console-media-crops.vue +167 -0
  273. package/dist/console/runtime/components/console-media-detail.vue +282 -0
  274. package/dist/console/runtime/components/console-media-dialog.vue +74 -0
  275. package/dist/console/runtime/components/console-media-field.vue +185 -0
  276. package/dist/console/runtime/components/console-media-focal.vue +137 -0
  277. package/dist/console/runtime/components/console-media-library.vue +125 -0
  278. package/dist/console/runtime/components/console-media-move.vue +160 -0
  279. package/dist/console/runtime/components/console-media-picker.vue +167 -0
  280. package/dist/console/runtime/components/console-media-uploads.vue +72 -0
  281. package/dist/console/runtime/components/console-new-chat.ts +27 -0
  282. package/dist/console/runtime/components/console-operation-view.vue +114 -0
  283. package/dist/console/runtime/components/console-page-header.vue +50 -0
  284. package/dist/console/runtime/components/console-page-toolbar.vue +28 -0
  285. package/dist/console/runtime/components/console-presence-avatars.vue +73 -0
  286. package/dist/console/runtime/components/console-property-list.vue +36 -0
  287. package/dist/console/runtime/components/console-property-row.vue +58 -0
  288. package/dist/console/runtime/components/console-rail.vue +392 -0
  289. package/dist/console/runtime/components/console-rate-limit.vue +167 -0
  290. package/dist/console/runtime/components/console-relative-time.vue +74 -0
  291. package/dist/console/runtime/components/console-schema-field.vue +504 -0
  292. package/dist/console/runtime/components/console-schema-form.vue +77 -0
  293. package/dist/console/runtime/components/console-schema-list.vue +158 -0
  294. package/dist/console/runtime/components/console-search.vue +851 -0
  295. package/dist/console/runtime/components/console-section-icon.vue +21 -0
  296. package/dist/console/runtime/components/console-seo-panel.vue +261 -0
  297. package/dist/console/runtime/components/console-session-actions.vue +160 -0
  298. package/dist/console/runtime/components/console-session-bootstrap.ts +112 -0
  299. package/dist/console/runtime/components/console-session-cancel.vue +90 -0
  300. package/dist/console/runtime/components/console-session-code-language.ts +32 -0
  301. package/dist/console/runtime/components/console-session-code-preview.vue +94 -0
  302. package/dist/console/runtime/components/console-session-inspector.vue +763 -0
  303. package/dist/console/runtime/components/console-session-loading.vue +116 -0
  304. package/dist/console/runtime/components/console-session-navbar.vue +159 -0
  305. package/dist/console/runtime/components/console-session-trace-model.ts +414 -0
  306. package/dist/console/runtime/components/console-session-trace.vue +693 -0
  307. package/dist/console/runtime/components/console-session.css +1745 -0
  308. package/dist/console/runtime/components/console-setup-hint.vue +20 -0
  309. package/dist/console/runtime/components/console-state.vue +165 -0
  310. package/dist/console/runtime/components/console-status.vue +25 -0
  311. package/dist/console/runtime/components/console-toaster.vue +66 -0
  312. package/dist/console/runtime/components/console-usage-chart.vue +208 -0
  313. package/dist/console/runtime/components/console-usage-model-detail.vue +144 -0
  314. package/dist/console/runtime/components/console-usage-model.ts +368 -0
  315. package/dist/console/runtime/components/console-usage-share-bar.vue +48 -0
  316. package/dist/console/runtime/components/console-usage.vue +879 -0
  317. package/dist/console/runtime/components/console-value.vue +35 -0
  318. package/dist/console/runtime/components/console-workflow-actions.vue +183 -0
  319. package/dist/console/runtime/components/console-workspace-file.ts +12 -0
  320. package/dist/console/runtime/components/console-workspace-history.vue +77 -0
  321. package/dist/console/runtime/components/console-wrap.ts +10 -0
  322. package/dist/console/runtime/components/invocation/agent-capability-inspector.ts +166 -0
  323. package/dist/console/runtime/components/invocation/agent-invocation-list.ts +276 -0
  324. package/dist/console/runtime/components/invocation/agent-invocation-timeline.ts +120 -0
  325. package/dist/console/runtime/components/invocation/agent-invocation.ts +1968 -0
  326. package/dist/console/runtime/components/invocation/index.ts +8 -0
  327. package/dist/console/runtime/components/invocation/internal/brand-icons.ts +65 -0
  328. package/dist/console/runtime/components/invocation/internal/channel-icon.ts +51 -0
  329. package/dist/console/runtime/components/invocation/internal/invocation-activity.ts +663 -0
  330. package/dist/console/runtime/components/invocation/internal/invocation-brand.ts +148 -0
  331. package/dist/console/runtime/components/invocation/internal/invocation-conversation.ts +162 -0
  332. package/dist/console/runtime/components/invocation/internal/payload-text.ts +29 -0
  333. package/dist/console/runtime/components/invocation/internal/runtime-type.ts +61 -0
  334. package/dist/console/runtime/components/invocation/internal/url.ts +8 -0
  335. package/dist/console/runtime/components/invocation/invocation-display.ts +56 -0
  336. package/dist/console/runtime/components/invocation/invocation.css +2748 -0
  337. package/dist/console/runtime/components/invocation/nuxt/AgentInvocation.ts +1 -0
  338. package/dist/console/runtime/components/invocation/nuxt/AgentInvocationInspector.ts +1 -0
  339. package/dist/console/runtime/components/invocation/nuxt/AgentInvocationList.ts +1 -0
  340. package/dist/console/runtime/components/invocation/types.ts +89 -0
  341. package/dist/console/runtime/console-route.d.ts +16 -0
  342. package/dist/console/runtime/console-route.js +49 -0
  343. package/dist/console/runtime/definitions.d.ts +2 -0
  344. package/dist/console/runtime/definitions.js +294 -0
  345. package/dist/console/runtime/page/loader.js +22 -0
  346. package/dist/console/runtime/public/console/assets/console-app-CUTwptGe.css +1 -0
  347. package/dist/console/runtime/public/console/assets/console-auth-B_XoOPaB.css +1 -0
  348. package/dist/console/runtime/public/console/assets/console-database-BbZ7J_Mh.css +1 -0
  349. package/dist/console/runtime/public/console/assets/console-documents-BV1adqXa.css +1 -0
  350. package/dist/console/runtime/public/console/assets/console-home-DYNL7OZH.css +1 -0
  351. package/dist/console/runtime/public/console/assets/console-logs-BJxR8DcR.css +1 -0
  352. package/dist/console/runtime/public/console/assets/console-media-browser-Dqm8kLKS.css +1 -0
  353. package/dist/console/runtime/public/console/assets/console-search-DnK-eWOO.css +1 -0
  354. package/dist/console/runtime/public/console/assets/katex-BztabbvB.css +1 -0
  355. package/dist/console/runtime/public/console/chunks/Alert-A44KLyli.js +111 -0
  356. package/dist/console/runtime/public/console/chunks/Button-B-5IVAVN.js +1 -0
  357. package/dist/console/runtime/public/console/chunks/Checkbox-B6MMrqB7.js +1 -0
  358. package/dist/console/runtime/public/console/chunks/DashboardSidebar-D1tMg0lD.js +1 -0
  359. package/dist/console/runtime/public/console/chunks/Empty-DSuwpzRi.js +1 -0
  360. package/dist/console/runtime/public/console/chunks/FormField-C1QuQLPv.js +1 -0
  361. package/dist/console/runtime/public/console/chunks/Icon-DDNuGxPl.js +1 -0
  362. package/dist/console/runtime/public/console/chunks/Modal-BCfHPiul.js +1 -0
  363. package/dist/console/runtime/public/console/chunks/Popover-BIzgqwDJ.js +1 -0
  364. package/dist/console/runtime/public/console/chunks/RovingFocusItem-BQiInss6.js +1 -0
  365. package/dist/console/runtime/public/console/chunks/Select-CLtjSqJ4.js +1 -0
  366. package/dist/console/runtime/public/console/chunks/Slideover-CHzYTMLO.js +1 -0
  367. package/dist/console/runtime/public/console/chunks/Switch-0VgVgteh.js +1 -0
  368. package/dist/console/runtime/public/console/chunks/Table-dr_6Rarq.js +4 -0
  369. package/dist/console/runtime/public/console/chunks/Tabs-BbKlHRNF.js +1 -0
  370. package/dist/console/runtime/public/console/chunks/Textarea-DEoHK30I.js +1 -0
  371. package/dist/console/runtime/public/console/chunks/abap-CLvhMVsD.js +1 -0
  372. package/dist/console/runtime/public/console/chunks/actionscript-3-Cs6JJXT5.js +1 -0
  373. package/dist/console/runtime/public/console/chunks/ada-X3Y2mlq2.js +1 -0
  374. package/dist/console/runtime/public/console/chunks/ahk-DwADkxyd.js +1 -0
  375. package/dist/console/runtime/public/console/chunks/ahk2-_6rzW9BS.js +1 -0
  376. package/dist/console/runtime/public/console/chunks/andromeeda-BASpqCeJ-vGVdxbeo.js +1 -0
  377. package/dist/console/runtime/public/console/chunks/andromeeda-vGVdxbeo.js +1 -0
  378. package/dist/console/runtime/public/console/chunks/angular-html-_r0QlJAV.js +1 -0
  379. package/dist/console/runtime/public/console/chunks/angular-ts-BdSNcv2x.js +1 -0
  380. package/dist/console/runtime/public/console/chunks/apache-U0d_L8uA.js +1 -0
  381. package/dist/console/runtime/public/console/chunks/apex-KFGFyKwG.js +1 -0
  382. package/dist/console/runtime/public/console/chunks/apl-CD0B-dgl.js +1 -0
  383. package/dist/console/runtime/public/console/chunks/applescript-CCn79oCD.js +1 -0
  384. package/dist/console/runtime/public/console/chunks/ara-4CJ0cIlV.js +1 -0
  385. package/dist/console/runtime/public/console/chunks/asciidoc-SCjQUq34.js +1 -0
  386. package/dist/console/runtime/public/console/chunks/asm-Cmm7eHzH.js +1 -0
  387. package/dist/console/runtime/public/console/chunks/astro-BuBCLsVb.js +1 -0
  388. package/dist/console/runtime/public/console/chunks/aurora-x-CDeNXAV0.js +1 -0
  389. package/dist/console/runtime/public/console/chunks/aurora-x-DugsLcii-CDeNXAV0.js +1 -0
  390. package/dist/console/runtime/public/console/chunks/awk-BWXHIvNe.js +1 -0
  391. package/dist/console/runtime/public/console/chunks/ayu-dark-BT3qdi3o-DluEY0Gj.js +1 -0
  392. package/dist/console/runtime/public/console/chunks/ayu-dark-DluEY0Gj.js +1 -0
  393. package/dist/console/runtime/public/console/chunks/ayu-light-BVZyHoh9-C3h-C4tm.js +1 -0
  394. package/dist/console/runtime/public/console/chunks/ayu-light-C3h-C4tm.js +1 -0
  395. package/dist/console/runtime/public/console/chunks/ayu-mirage-Bqwy1Gya.js +1 -0
  396. package/dist/console/runtime/public/console/chunks/ayu-mirage-XFwUVZQZ-Bqwy1Gya.js +1 -0
  397. package/dist/console/runtime/public/console/chunks/ballerina-B7ZEbQpA.js +1 -0
  398. package/dist/console/runtime/public/console/chunks/bat-qdxAdBWQ.js +1 -0
  399. package/dist/console/runtime/public/console/chunks/beancount-C2IN4Vk8.js +1 -0
  400. package/dist/console/runtime/public/console/chunks/berry-DKpUyyne.js +1 -0
  401. package/dist/console/runtime/public/console/chunks/bibtex-Ci_nEsc7.js +1 -0
  402. package/dist/console/runtime/public/console/chunks/bicep-CUHmPFLl.js +1 -0
  403. package/dist/console/runtime/public/console/chunks/bird2-CYIUgYqB.js +1 -0
  404. package/dist/console/runtime/public/console/chunks/blade-3tdbLOEu.js +1 -0
  405. package/dist/console/runtime/public/console/chunks/bsl-_VjlB9mv.js +1 -0
  406. package/dist/console/runtime/public/console/chunks/c-C1MtNG6h.js +1 -0
  407. package/dist/console/runtime/public/console/chunks/c3-D0apG41V.js +1 -0
  408. package/dist/console/runtime/public/console/chunks/cadence-CQ2zXKGN.js +1 -0
  409. package/dist/console/runtime/public/console/chunks/cairo-DLTphjLi.js +1 -0
  410. package/dist/console/runtime/public/console/chunks/catppuccin-frappe-C9Q5zVZY.js +1 -0
  411. package/dist/console/runtime/public/console/chunks/catppuccin-frappe-D20KODDN-C9Q5zVZY.js +1 -0
  412. package/dist/console/runtime/public/console/chunks/catppuccin-latte-CtsyrtPq.js +1 -0
  413. package/dist/console/runtime/public/console/chunks/catppuccin-latte-eGLVHIUJ-CtsyrtPq.js +1 -0
  414. package/dist/console/runtime/public/console/chunks/catppuccin-macchiato-R8nAf1vR.js +1 -0
  415. package/dist/console/runtime/public/console/chunks/catppuccin-macchiato-bQGch4PY-R8nAf1vR.js +1 -0
  416. package/dist/console/runtime/public/console/chunks/catppuccin-mocha-Bes8-0Mr-DjuaAJKi.js +1 -0
  417. package/dist/console/runtime/public/console/chunks/catppuccin-mocha-DjuaAJKi.js +1 -0
  418. package/dist/console/runtime/public/console/chunks/chapel-BzgYECs1.js +1 -0
  419. package/dist/console/runtime/public/console/chunks/clarity-CtfBBspg.js +1 -0
  420. package/dist/console/runtime/public/console/chunks/clojure-DqKBuwfJ.js +1 -0
  421. package/dist/console/runtime/public/console/chunks/cmake-Bj61d0ZC.js +1 -0
  422. package/dist/console/runtime/public/console/chunks/cobol-DObdkphG.js +1 -0
  423. package/dist/console/runtime/public/console/chunks/code-view-J4OsgEdh-B89t0LaT.js +2 -0
  424. package/dist/console/runtime/public/console/chunks/codeowners-C8r90Shi.js +1 -0
  425. package/dist/console/runtime/public/console/chunks/codeql-oeQT6MSM.js +1 -0
  426. package/dist/console/runtime/public/console/chunks/coffee-C94_xO1a.js +1 -0
  427. package/dist/console/runtime/public/console/chunks/common-lisp-Cv5bFMCO.js +1 -0
  428. package/dist/console/runtime/public/console/chunks/console-app-C50IIheA.js +85 -0
  429. package/dist/console/runtime/public/console/chunks/console-auth-D4zc7Haw.js +2 -0
  430. package/dist/console/runtime/public/console/chunks/console-blob-CAJwJy4D.js +1 -0
  431. package/dist/console/runtime/public/console/chunks/console-channels-DZQwinKY.js +1 -0
  432. package/dist/console/runtime/public/console/chunks/console-connections-Buk5WGxr.js +6 -0
  433. package/dist/console/runtime/public/console/chunks/console-database-CKc8H8FN.js +1 -0
  434. package/dist/console/runtime/public/console/chunks/console-definitions-NriWGCYI.js +1 -0
  435. package/dist/console/runtime/public/console/chunks/console-documents-BnBRfM_7.js +314 -0
  436. package/dist/console/runtime/public/console/chunks/console-env-CLmYhbox.js +1 -0
  437. package/dist/console/runtime/public/console/chunks/console-home-smb5yMSF.js +2 -0
  438. package/dist/console/runtime/public/console/chunks/console-kv-B1tLQHM9.js +1 -0
  439. package/dist/console/runtime/public/console/chunks/console-logs-CjxEiek5.js +1 -0
  440. package/dist/console/runtime/public/console/chunks/console-media-browser-o4BQu9KZ.js +1 -0
  441. package/dist/console/runtime/public/console/chunks/console-operation-view-CGxpuMSQ.js +1 -0
  442. package/dist/console/runtime/public/console/chunks/console-page-header-DDAcJBpl.js +1 -0
  443. package/dist/console/runtime/public/console/chunks/console-page-toolbar-CvYwaKTR.js +1 -0
  444. package/dist/console/runtime/public/console/chunks/console-property-list-96rL7wos.js +1 -0
  445. package/dist/console/runtime/public/console/chunks/console-relative-time-RB6-yiul.js +1 -0
  446. package/dist/console/runtime/public/console/chunks/console-search-D4EVLUeN.js +5 -0
  447. package/dist/console/runtime/public/console/chunks/console-setup-hint-8TRzgkby.js +1 -0
  448. package/dist/console/runtime/public/console/chunks/console-status-DH5NgNAQ.js +1 -0
  449. package/dist/console/runtime/public/console/chunks/coq-CGaSfhwR.js +1 -0
  450. package/dist/console/runtime/public/console/chunks/core-CD3So4L1.js +12 -0
  451. package/dist/console/runtime/public/console/chunks/cpp-DMjdIJj9.js +1 -0
  452. package/dist/console/runtime/public/console/chunks/crystal-Czr8rWWf.js +1 -0
  453. package/dist/console/runtime/public/console/chunks/csharp-dmMxLVLW.js +1 -0
  454. package/dist/console/runtime/public/console/chunks/css-B6l3ejVl.js +1 -0
  455. package/dist/console/runtime/public/console/chunks/css-BDmUYLyz.js +1 -0
  456. package/dist/console/runtime/public/console/chunks/csv-Dx-8-gkx.js +1 -0
  457. package/dist/console/runtime/public/console/chunks/cue-CE9AQfxI.js +1 -0
  458. package/dist/console/runtime/public/console/chunks/cypher-ClKdZ_lG.js +1 -0
  459. package/dist/console/runtime/public/console/chunks/d-qD-0Kul2.js +1 -0
  460. package/dist/console/runtime/public/console/chunks/dark-plus-BGuiqa1B-Cs2F2srj.js +1 -0
  461. package/dist/console/runtime/public/console/chunks/dark-plus-Cs2F2srj.js +1 -0
  462. package/dist/console/runtime/public/console/chunks/dart-CHZY9Xhz.js +1 -0
  463. package/dist/console/runtime/public/console/chunks/dax-BkyTk9wS.js +1 -0
  464. package/dist/console/runtime/public/console/chunks/defu-DSJ9I3OW.js +1 -0
  465. package/dist/console/runtime/public/console/chunks/desktop-Dlh5hvp9.js +1 -0
  466. package/dist/console/runtime/public/console/chunks/diff-woXpYk--.js +1 -0
  467. package/dist/console/runtime/public/console/chunks/dist-Cfws9tG7.js +1 -0
  468. package/dist/console/runtime/public/console/chunks/docker-sj3NF4m5.js +1 -0
  469. package/dist/console/runtime/public/console/chunks/dockerfile-C147k2YT.js +1 -0
  470. package/dist/console/runtime/public/console/chunks/dotenv-CuH5my32.js +1 -0
  471. package/dist/console/runtime/public/console/chunks/dracula-0CVA2XY5-BHWKrbxM.js +1 -0
  472. package/dist/console/runtime/public/console/chunks/dracula-BHWKrbxM.js +1 -0
  473. package/dist/console/runtime/public/console/chunks/dracula-soft-5eyTD99u.js +1 -0
  474. package/dist/console/runtime/public/console/chunks/dracula-soft-Dk9bpbVU-5eyTD99u.js +1 -0
  475. package/dist/console/runtime/public/console/chunks/dream-maker-DW3nJb8Q.js +1 -0
  476. package/dist/console/runtime/public/console/chunks/edge-D8F7z1FE.js +1 -0
  477. package/dist/console/runtime/public/console/chunks/elixir-DH2VBix4.js +1 -0
  478. package/dist/console/runtime/public/console/chunks/elm-D2qVkg3B.js +1 -0
  479. package/dist/console/runtime/public/console/chunks/emacs-lisp-DR2vtWaj.js +1 -0
  480. package/dist/console/runtime/public/console/chunks/engine-compile-DS_05kfr.js +141 -0
  481. package/dist/console/runtime/public/console/chunks/engine-javascript-Dymre4AG.js +1 -0
  482. package/dist/console/runtime/public/console/chunks/env-management-CNydNlRX.js +1 -0
  483. package/dist/console/runtime/public/console/chunks/erb-B_-2w0Bg.js +1 -0
  484. package/dist/console/runtime/public/console/chunks/erlang-Cphh6RMH.js +1 -0
  485. package/dist/console/runtime/public/console/chunks/everforest-dark-CRjTbhh5-sB-x3p7T.js +1 -0
  486. package/dist/console/runtime/public/console/chunks/everforest-dark-sB-x3p7T.js +1 -0
  487. package/dist/console/runtime/public/console/chunks/everforest-light-CEeYFLn8-Df2xbC6M.js +1 -0
  488. package/dist/console/runtime/public/console/chunks/everforest-light-Df2xbC6M.js +1 -0
  489. package/dist/console/runtime/public/console/chunks/fennel-DQxkIbk2.js +1 -0
  490. package/dist/console/runtime/public/console/chunks/field-a8AvhnKh-Da49LBBi.js +1 -0
  491. package/dist/console/runtime/public/console/chunks/file-tree-2PXztdQ7.js +1266 -0
  492. package/dist/console/runtime/public/console/chunks/fish-BJitypiv.js +1 -0
  493. package/dist/console/runtime/public/console/chunks/fluent-C03EYrpw.js +1 -0
  494. package/dist/console/runtime/public/console/chunks/format-Bm0hCiYP.js +1 -0
  495. package/dist/console/runtime/public/console/chunks/fortran-fixed-form-DEKoE2YW.js +1 -0
  496. package/dist/console/runtime/public/console/chunks/fortran-free-form-CYNrtFtB.js +1 -0
  497. package/dist/console/runtime/public/console/chunks/fsharp-D13ZGOAj.js +1 -0
  498. package/dist/console/runtime/public/console/chunks/gdresource-xMC7jr7x.js +1 -0
  499. package/dist/console/runtime/public/console/chunks/gdscript-DYvRD3hg.js +1 -0
  500. package/dist/console/runtime/public/console/chunks/gdshader-CBce3t8t.js +1 -0
  501. package/dist/console/runtime/public/console/chunks/genie-CV2tkWYe.js +1 -0
  502. package/dist/console/runtime/public/console/chunks/gherkin-DExj1W_8.js +1 -0
  503. package/dist/console/runtime/public/console/chunks/git-commit-BSykSTBG.js +1 -0
  504. package/dist/console/runtime/public/console/chunks/git-rebase-CNMiHM3o.js +1 -0
  505. package/dist/console/runtime/public/console/chunks/github-dark-BXgKmOw_-C-LZuMrd.js +1 -0
  506. package/dist/console/runtime/public/console/chunks/github-dark-C-LZuMrd.js +1 -0
  507. package/dist/console/runtime/public/console/chunks/github-dark-default-DXG-b-1a.js +1 -0
  508. package/dist/console/runtime/public/console/chunks/github-dark-default-Dk3Gj2bt.js +1 -0
  509. package/dist/console/runtime/public/console/chunks/github-dark-default-DzJQXksd-DXG-b-1a.js +1 -0
  510. package/dist/console/runtime/public/console/chunks/github-dark-dimmed-B1pEmGtS-Bx1FflLF.js +1 -0
  511. package/dist/console/runtime/public/console/chunks/github-dark-dimmed-Bx1FflLF.js +1 -0
  512. package/dist/console/runtime/public/console/chunks/github-dark-high-contrast-B_tTalzw.js +1 -0
  513. package/dist/console/runtime/public/console/chunks/github-dark-high-contrast-BkHIa6jc-B_tTalzw.js +1 -0
  514. package/dist/console/runtime/public/console/chunks/github-light-BKRlUbaB-EUqPIrTm.js +1 -0
  515. package/dist/console/runtime/public/console/chunks/github-light-EUqPIrTm.js +1 -0
  516. package/dist/console/runtime/public/console/chunks/github-light-default-BU3eYkzs-BXViO-2h.js +1 -0
  517. package/dist/console/runtime/public/console/chunks/github-light-default-BXViO-2h.js +1 -0
  518. package/dist/console/runtime/public/console/chunks/github-light-default-CC-h3suv.js +1 -0
  519. package/dist/console/runtime/public/console/chunks/github-light-high-contrast-B3MumDcI-B68TUdTA.js +1 -0
  520. package/dist/console/runtime/public/console/chunks/github-light-high-contrast-B68TUdTA.js +1 -0
  521. package/dist/console/runtime/public/console/chunks/gleam-CSRkHgEL.js +1 -0
  522. package/dist/console/runtime/public/console/chunks/glimmer-js-CwoxQgjc.js +1 -0
  523. package/dist/console/runtime/public/console/chunks/glimmer-ts-DpQshMGP.js +1 -0
  524. package/dist/console/runtime/public/console/chunks/glsl-vvkIs2ij.js +1 -0
  525. package/dist/console/runtime/public/console/chunks/gn-CAXYAgV-.js +1 -0
  526. package/dist/console/runtime/public/console/chunks/gnuplot-7GGW24-e.js +1 -0
  527. package/dist/console/runtime/public/console/chunks/go-rLFTqkRN.js +1 -0
  528. package/dist/console/runtime/public/console/chunks/graphql-ChhlowTj.js +1 -0
  529. package/dist/console/runtime/public/console/chunks/groovy-CacY0gHj.js +1 -0
  530. package/dist/console/runtime/public/console/chunks/gruvbox-dark-hard-B0ecF443-C820rvS2.js +1 -0
  531. package/dist/console/runtime/public/console/chunks/gruvbox-dark-hard-C820rvS2.js +1 -0
  532. package/dist/console/runtime/public/console/chunks/gruvbox-dark-medium-BPjhmG05.js +1 -0
  533. package/dist/console/runtime/public/console/chunks/gruvbox-dark-medium-BQnpC39k-BPjhmG05.js +1 -0
  534. package/dist/console/runtime/public/console/chunks/gruvbox-dark-soft-DFZUgESr-MrdJrrXF.js +1 -0
  535. package/dist/console/runtime/public/console/chunks/gruvbox-dark-soft-MrdJrrXF.js +1 -0
  536. package/dist/console/runtime/public/console/chunks/gruvbox-light-hard-BC_s9l72.js +1 -0
  537. package/dist/console/runtime/public/console/chunks/gruvbox-light-hard-CuB_LOJr-BC_s9l72.js +1 -0
  538. package/dist/console/runtime/public/console/chunks/gruvbox-light-medium-BAWPOn9u.js +1 -0
  539. package/dist/console/runtime/public/console/chunks/gruvbox-light-medium-idDHgxjs-BAWPOn9u.js +1 -0
  540. package/dist/console/runtime/public/console/chunks/gruvbox-light-soft-BSMLrYjP.js +1 -0
  541. package/dist/console/runtime/public/console/chunks/gruvbox-light-soft-CfWH49MY-BSMLrYjP.js +1 -0
  542. package/dist/console/runtime/public/console/chunks/hack--5hWxtov.js +1 -0
  543. package/dist/console/runtime/public/console/chunks/haml-DOOWKVAn.js +1 -0
  544. package/dist/console/runtime/public/console/chunks/handlebars-CrRNKWA2.js +1 -0
  545. package/dist/console/runtime/public/console/chunks/haskell-D8IpX4py.js +1 -0
  546. package/dist/console/runtime/public/console/chunks/haxe-C8oCnwJJ.js +1 -0
  547. package/dist/console/runtime/public/console/chunks/hcl-Dh228itO.js +1 -0
  548. package/dist/console/runtime/public/console/chunks/hjson-CxZEssPk.js +1 -0
  549. package/dist/console/runtime/public/console/chunks/hlsl-Cvrh5tZx.js +1 -0
  550. package/dist/console/runtime/public/console/chunks/horizon-CE9ld1lL.js +1 -0
  551. package/dist/console/runtime/public/console/chunks/horizon-bright-Ba6M8QSV-DSNQnXHK.js +1 -0
  552. package/dist/console/runtime/public/console/chunks/horizon-bright-DSNQnXHK.js +1 -0
  553. package/dist/console/runtime/public/console/chunks/horizon-h92C5OlZ-CE9ld1lL.js +1 -0
  554. package/dist/console/runtime/public/console/chunks/houston-CsvMBhTu.js +1 -0
  555. package/dist/console/runtime/public/console/chunks/houston-EQnPegWq-CsvMBhTu.js +1 -0
  556. package/dist/console/runtime/public/console/chunks/html-DrTLqG4V.js +1 -0
  557. package/dist/console/runtime/public/console/chunks/html-DwfkhSwv.js +1 -0
  558. package/dist/console/runtime/public/console/chunks/html-derivative-JoBPPO4R.js +1 -0
  559. package/dist/console/runtime/public/console/chunks/http-DKXz4J4h.js +1 -0
  560. package/dist/console/runtime/public/console/chunks/hurl-m2MDTJJI.js +1 -0
  561. package/dist/console/runtime/public/console/chunks/hxml-Dcm88srW.js +1 -0
  562. package/dist/console/runtime/public/console/chunks/hy-CZbG8q4J.js +1 -0
  563. package/dist/console/runtime/public/console/chunks/icons-CDKEwnTx.js +1 -0
  564. package/dist/console/runtime/public/console/chunks/imba-DsUTQ-LC.js +1 -0
  565. package/dist/console/runtime/public/console/chunks/ini-B5eOa1yu.js +1 -0
  566. package/dist/console/runtime/public/console/chunks/java-DJ6V61UG.js +1 -0
  567. package/dist/console/runtime/public/console/chunks/javascript-DOney_iy.js +1 -0
  568. package/dist/console/runtime/public/console/chunks/javascript-DhBmaPc1.js +1 -0
  569. package/dist/console/runtime/public/console/chunks/jinja-CywE_Am-.js +1 -0
  570. package/dist/console/runtime/public/console/chunks/jison-D8DWHhWo.js +1 -0
  571. package/dist/console/runtime/public/console/chunks/json-B6nR7qG1.js +1 -0
  572. package/dist/console/runtime/public/console/chunks/json-D0JmQrvp.js +1 -0
  573. package/dist/console/runtime/public/console/chunks/json5-BR5RXkoi.js +1 -0
  574. package/dist/console/runtime/public/console/chunks/jsonc-CYpm1nAK.js +1 -0
  575. package/dist/console/runtime/public/console/chunks/jsonc-D4AqO_oZ.js +1 -0
  576. package/dist/console/runtime/public/console/chunks/jsonl-CmCQp5Yx.js +1 -0
  577. package/dist/console/runtime/public/console/chunks/jsonnet-CJTPZ8u_.js +1 -0
  578. package/dist/console/runtime/public/console/chunks/jssm-DXw9l8Rf.js +1 -0
  579. package/dist/console/runtime/public/console/chunks/jsx-Dro3SMhn.js +1 -0
  580. package/dist/console/runtime/public/console/chunks/jsx-_Ptt0Qo0.js +1 -0
  581. package/dist/console/runtime/public/console/chunks/julia-CruTRp58.js +1 -0
  582. package/dist/console/runtime/public/console/chunks/just-aBPtXuIr.js +1 -0
  583. package/dist/console/runtime/public/console/chunks/kanagawa-dragon-Bozd7klA.js +1 -0
  584. package/dist/console/runtime/public/console/chunks/kanagawa-dragon-DgDvwi3B-Bozd7klA.js +1 -0
  585. package/dist/console/runtime/public/console/chunks/kanagawa-lotus-BgoQro20-BmuOG9ZW.js +1 -0
  586. package/dist/console/runtime/public/console/chunks/kanagawa-lotus-BmuOG9ZW.js +1 -0
  587. package/dist/console/runtime/public/console/chunks/kanagawa-wave-BML5mF2J.js +1 -0
  588. package/dist/console/runtime/public/console/chunks/kanagawa-wave-DgXEowHs-BML5mF2J.js +1 -0
  589. package/dist/console/runtime/public/console/chunks/katex-CF6MVAvO.js +257 -0
  590. package/dist/console/runtime/public/console/chunks/kdl-CsD5j6eV.js +1 -0
  591. package/dist/console/runtime/public/console/chunks/kotlin-DhhofPvG.js +1 -0
  592. package/dist/console/runtime/public/console/chunks/kusto-C7mF5XQf.js +1 -0
  593. package/dist/console/runtime/public/console/chunks/laserwave-C_8bwKvT.js +1 -0
  594. package/dist/console/runtime/public/console/chunks/laserwave-IxBH_3yW-C_8bwKvT.js +1 -0
  595. package/dist/console/runtime/public/console/chunks/latex-DV9xWg1U.js +1 -0
  596. package/dist/console/runtime/public/console/chunks/lean-CewbzKMR.js +1 -0
  597. package/dist/console/runtime/public/console/chunks/less-DVTAwKKz.js +1 -0
  598. package/dist/console/runtime/public/console/chunks/light-plus-DVQuIRkW.js +1 -0
  599. package/dist/console/runtime/public/console/chunks/light-plus-S8JBx6is-DVQuIRkW.js +1 -0
  600. package/dist/console/runtime/public/console/chunks/liquid-B62JT9qD.js +1 -0
  601. package/dist/console/runtime/public/console/chunks/llvm-DqHOMS-s.js +1 -0
  602. package/dist/console/runtime/public/console/chunks/log-BNLmms1o.js +1 -0
  603. package/dist/console/runtime/public/console/chunks/logo-Cluzi2Zq.js +1 -0
  604. package/dist/console/runtime/public/console/chunks/lua-939mH6Rk.js +1 -0
  605. package/dist/console/runtime/public/console/chunks/luau-VGWVLoqX.js +1 -0
  606. package/dist/console/runtime/public/console/chunks/make-Dixweg8N.js +1 -0
  607. package/dist/console/runtime/public/console/chunks/make-PPdVpZzp.js +1 -0
  608. package/dist/console/runtime/public/console/chunks/markdown-BK4fiefF.js +1 -0
  609. package/dist/console/runtime/public/console/chunks/markdown-BYOwaDjH.js +1 -0
  610. package/dist/console/runtime/public/console/chunks/marko-BjHTe8yB.js +1 -0
  611. package/dist/console/runtime/public/console/chunks/material-theme-Bm3Qr25_.js +1 -0
  612. package/dist/console/runtime/public/console/chunks/material-theme-D1f3HBq--Bm3Qr25_.js +1 -0
  613. package/dist/console/runtime/public/console/chunks/material-theme-darker-2IIEA8gg.js +1 -0
  614. package/dist/console/runtime/public/console/chunks/material-theme-darker-ExzYhT0j-2IIEA8gg.js +1 -0
  615. package/dist/console/runtime/public/console/chunks/material-theme-lighter-D6gH9nnA-uhdI0v04.js +1 -0
  616. package/dist/console/runtime/public/console/chunks/material-theme-lighter-uhdI0v04.js +1 -0
  617. package/dist/console/runtime/public/console/chunks/material-theme-ocean-CHQ94UKr.js +1 -0
  618. package/dist/console/runtime/public/console/chunks/material-theme-ocean-D1w5BPAa-CHQ94UKr.js +1 -0
  619. package/dist/console/runtime/public/console/chunks/material-theme-palenight-B5W6OYN7.js +1 -0
  620. package/dist/console/runtime/public/console/chunks/material-theme-palenight-CkqWmVpF-B5W6OYN7.js +1 -0
  621. package/dist/console/runtime/public/console/chunks/matlab-D7qyCx1q.js +1 -0
  622. package/dist/console/runtime/public/console/chunks/mdc-Dsg_kn4_.js +1 -0
  623. package/dist/console/runtime/public/console/chunks/mdx-DQZ5AkYe.js +1 -0
  624. package/dist/console/runtime/public/console/chunks/mdx-l4Hs_llf.js +1 -0
  625. package/dist/console/runtime/public/console/chunks/mermaid-BxpfTIzt.js +1 -0
  626. package/dist/console/runtime/public/console/chunks/min-dark-BSWPekZh.js +1 -0
  627. package/dist/console/runtime/public/console/chunks/min-dark-npsJH98j-BSWPekZh.js +1 -0
  628. package/dist/console/runtime/public/console/chunks/min-light-DDpmG2fV.js +1 -0
  629. package/dist/console/runtime/public/console/chunks/min-light-DUk1XsVt-DDpmG2fV.js +1 -0
  630. package/dist/console/runtime/public/console/chunks/mipsasm-BMqwQI7S.js +1 -0
  631. package/dist/console/runtime/public/console/chunks/mojo-fg40_ntQ.js +1 -0
  632. package/dist/console/runtime/public/console/chunks/monokai-BscAjiQZ.js +1 -0
  633. package/dist/console/runtime/public/console/chunks/monokai-CfFRWUNl-BscAjiQZ.js +1 -0
  634. package/dist/console/runtime/public/console/chunks/moonbit-D9W784E_.js +1 -0
  635. package/dist/console/runtime/public/console/chunks/move-BYnGhZoM.js +1 -0
  636. package/dist/console/runtime/public/console/chunks/narrat-_X_XdTYD.js +1 -0
  637. package/dist/console/runtime/public/console/chunks/nextflow-CSgcYZcx.js +1 -0
  638. package/dist/console/runtime/public/console/chunks/nextflow-groovy-D7IRt6Pp.js +1 -0
  639. package/dist/console/runtime/public/console/chunks/nginx-H6FvQZhW.js +1 -0
  640. package/dist/console/runtime/public/console/chunks/night-owl-BS7V-av_-DhmEMT88.js +1 -0
  641. package/dist/console/runtime/public/console/chunks/night-owl-DhmEMT88.js +1 -0
  642. package/dist/console/runtime/public/console/chunks/night-owl-light-CZtRawYE-eJ-hLW7d.js +1 -0
  643. package/dist/console/runtime/public/console/chunks/night-owl-light-eJ-hLW7d.js +1 -0
  644. package/dist/console/runtime/public/console/chunks/nim-C7z2AtKH.js +1 -0
  645. package/dist/console/runtime/public/console/chunks/nix-IvuFDN5E.js +1 -0
  646. package/dist/console/runtime/public/console/chunks/nord-BFh54Nqz-Cb4Vim4T.js +1 -0
  647. package/dist/console/runtime/public/console/chunks/nord-Cb4Vim4T.js +1 -0
  648. package/dist/console/runtime/public/console/chunks/nsis-CjNLYCLg.js +1 -0
  649. package/dist/console/runtime/public/console/chunks/nushell--0fT3PI1.js +1 -0
  650. package/dist/console/runtime/public/console/chunks/objective-c-D1A_Heim.js +1 -0
  651. package/dist/console/runtime/public/console/chunks/objective-cpp-BsSzOQcm.js +1 -0
  652. package/dist/console/runtime/public/console/chunks/ocaml-O90oeIOV.js +1 -0
  653. package/dist/console/runtime/public/console/chunks/odin-B1RWQWA5.js +1 -0
  654. package/dist/console/runtime/public/console/chunks/one-dark-pro-C6YyR8OD.js +1 -0
  655. package/dist/console/runtime/public/console/chunks/one-dark-pro-zDovGosB-C6YyR8OD.js +1 -0
  656. package/dist/console/runtime/public/console/chunks/one-light-D7Lr4KcI.js +1 -0
  657. package/dist/console/runtime/public/console/chunks/one-light-gmHK3iK6-D7Lr4KcI.js +1 -0
  658. package/dist/console/runtime/public/console/chunks/openscad-BUDT5pXO.js +1 -0
  659. package/dist/console/runtime/public/console/chunks/org-DYUOjVHR.js +1 -0
  660. package/dist/console/runtime/public/console/chunks/pascal-4ZHwLPI5.js +1 -0
  661. package/dist/console/runtime/public/console/chunks/patch-diff-CD7Eu2gO.js +1 -0
  662. package/dist/console/runtime/public/console/chunks/perl-BAFITj1w.js +1 -0
  663. package/dist/console/runtime/public/console/chunks/php-C1opCiHJ.js +1 -0
  664. package/dist/console/runtime/public/console/chunks/pierre-code-view-T7V67hwT-XcPks0Ko.js +168 -0
  665. package/dist/console/runtime/public/console/chunks/pierre-dark-DDWDl8g6-CpLgRqie.js +1 -0
  666. package/dist/console/runtime/public/console/chunks/pierre-dark-protanopia-deuteranopia-C35UMuvO-B35FxJx-.js +1 -0
  667. package/dist/console/runtime/public/console/chunks/pierre-dark-soft-Bb-4-biO-kZQmAZld.js +1 -0
  668. package/dist/console/runtime/public/console/chunks/pierre-dark-tritanopia-CIJISGWF-CpjhbsIL.js +1 -0
  669. package/dist/console/runtime/public/console/chunks/pierre-dark-vibrant-8oZzB3gw-CpQYzh95.js +1 -0
  670. package/dist/console/runtime/public/console/chunks/pierre-light-CWhW4NrH-CoaEpmwp.js +1 -0
  671. package/dist/console/runtime/public/console/chunks/pierre-light-protanopia-deuteranopia-u0U7N4Hn-0fSaH845.js +1 -0
  672. package/dist/console/runtime/public/console/chunks/pierre-light-soft-BCU6fuhO-lWLdNTOI.js +1 -0
  673. package/dist/console/runtime/public/console/chunks/pierre-light-tritanopia-3c8Yx3co-CEbqgOJL.js +1 -0
  674. package/dist/console/runtime/public/console/chunks/pierre-light-vibrant-Cwh332o_-D80Fkn33.js +1 -0
  675. package/dist/console/runtime/public/console/chunks/pkl-ot-7Btpt.js +1 -0
  676. package/dist/console/runtime/public/console/chunks/plastic-DQwYfKfQ.js +1 -0
  677. package/dist/console/runtime/public/console/chunks/plastic-DtdaCjub-DQwYfKfQ.js +1 -0
  678. package/dist/console/runtime/public/console/chunks/plsql-DGHpHOYJ.js +1 -0
  679. package/dist/console/runtime/public/console/chunks/po-BiJDBrnU.js +1 -0
  680. package/dist/console/runtime/public/console/chunks/poimandres-DRFjx7u4.js +1 -0
  681. package/dist/console/runtime/public/console/chunks/poimandres-Hdda6aHK-DRFjx7u4.js +1 -0
  682. package/dist/console/runtime/public/console/chunks/polar-C7UOKdEL.js +1 -0
  683. package/dist/console/runtime/public/console/chunks/postcss-BXeXVLqQ.js +1 -0
  684. package/dist/console/runtime/public/console/chunks/powerquery-DNMTfnFr.js +1 -0
  685. package/dist/console/runtime/public/console/chunks/powershell-QtSnmXcu.js +1 -0
  686. package/dist/console/runtime/public/console/chunks/preload-helper-uBIymjUX.js +1 -0
  687. package/dist/console/runtime/public/console/chunks/presence-BGvCcBvS.js +1 -0
  688. package/dist/console/runtime/public/console/chunks/prisma-DMgNhnYS.js +1 -0
  689. package/dist/console/runtime/public/console/chunks/prolog-iXnhIJG7.js +1 -0
  690. package/dist/console/runtime/public/console/chunks/proto-DB4EqR-F.js +1 -0
  691. package/dist/console/runtime/public/console/chunks/pug-ChIfOLQs.js +1 -0
  692. package/dist/console/runtime/public/console/chunks/puppet-CDv2pdJW.js +1 -0
  693. package/dist/console/runtime/public/console/chunks/purescript-9MfHhQsQ.js +1 -0
  694. package/dist/console/runtime/public/console/chunks/python-gzcpVVnB.js +1 -0
  695. package/dist/console/runtime/public/console/chunks/qml-BAjZcRJm.js +1 -0
  696. package/dist/console/runtime/public/console/chunks/qmldir-DCQb3MpD.js +1 -0
  697. package/dist/console/runtime/public/console/chunks/qss-Fe1Jh2GI.js +1 -0
  698. package/dist/console/runtime/public/console/chunks/r-CnJIyxn2.js +1 -0
  699. package/dist/console/runtime/public/console/chunks/racket-DcIDlBhZ.js +1 -0
  700. package/dist/console/runtime/public/console/chunks/raku-B3gFvitq.js +1 -0
  701. package/dist/console/runtime/public/console/chunks/razor-Bk3VGUqz.js +1 -0
  702. package/dist/console/runtime/public/console/chunks/rbs-C0MpOrj4.js +1 -0
  703. package/dist/console/runtime/public/console/chunks/read-only-DJWK7nHC.js +1 -0
  704. package/dist/console/runtime/public/console/chunks/red-CYlAq2b0.js +1 -0
  705. package/dist/console/runtime/public/console/chunks/red-VqZFRByZ-CYlAq2b0.js +1 -0
  706. package/dist/console/runtime/public/console/chunks/reg-CRGYupPL.js +1 -0
  707. package/dist/console/runtime/public/console/chunks/regexp-CF4aByxb.js +1 -0
  708. package/dist/console/runtime/public/console/chunks/rel-BtDbiS_P.js +1 -0
  709. package/dist/console/runtime/public/console/chunks/riscv-Ckw8ddFX.js +1 -0
  710. package/dist/console/runtime/public/console/chunks/rolldown-runtime-DK3Fl9T5.js +1 -0
  711. package/dist/console/runtime/public/console/chunks/ron-VUp2lXgN.js +1 -0
  712. package/dist/console/runtime/public/console/chunks/rose-pine-DiTkEueR-aMsaMD1D.js +1 -0
  713. package/dist/console/runtime/public/console/chunks/rose-pine-aMsaMD1D.js +1 -0
  714. package/dist/console/runtime/public/console/chunks/rose-pine-dawn-8PwUyIlP.js +1 -0
  715. package/dist/console/runtime/public/console/chunks/rose-pine-dawn-tfo5y2X0-8PwUyIlP.js +1 -0
  716. package/dist/console/runtime/public/console/chunks/rose-pine-moon-C0gON9XN-DO-qXg-I.js +1 -0
  717. package/dist/console/runtime/public/console/chunks/rose-pine-moon-DO-qXg-I.js +1 -0
  718. package/dist/console/runtime/public/console/chunks/rosmsg-CAekHB0j.js +1 -0
  719. package/dist/console/runtime/public/console/chunks/rst-D8R3YvuX.js +1 -0
  720. package/dist/console/runtime/public/console/chunks/ruby-BDvumEf2.js +1 -0
  721. package/dist/console/runtime/public/console/chunks/rust-DpiIf5JO.js +1 -0
  722. package/dist/console/runtime/public/console/chunks/sas-CDxiwfn1.js +1 -0
  723. package/dist/console/runtime/public/console/chunks/sass-DXrisJhu.js +1 -0
  724. package/dist/console/runtime/public/console/chunks/scala-BiFt_7mu.js +1 -0
  725. package/dist/console/runtime/public/console/chunks/scheme-DQCgrYNe.js +1 -0
  726. package/dist/console/runtime/public/console/chunks/scss-BPiS1nMZ.js +1 -0
  727. package/dist/console/runtime/public/console/chunks/scss-DuikUNMR.js +1 -0
  728. package/dist/console/runtime/public/console/chunks/sdbl-bTVj8UrX.js +1 -0
  729. package/dist/console/runtime/public/console/chunks/sections-aIkyV8J9.js +8 -0
  730. package/dist/console/runtime/public/console/chunks/shaderlab-TOUzSsQk.js +1 -0
  731. package/dist/console/runtime/public/console/chunks/shellscript-CgLkv1T0.js +1 -0
  732. package/dist/console/runtime/public/console/chunks/shellscript-DStN_0YR.js +1 -0
  733. package/dist/console/runtime/public/console/chunks/shellsession-C_5QA7eC.js +1 -0
  734. package/dist/console/runtime/public/console/chunks/slack-dark-DnToyrRv.js +1 -0
  735. package/dist/console/runtime/public/console/chunks/slack-dark-v8P_eXr6-DnToyrRv.js +1 -0
  736. package/dist/console/runtime/public/console/chunks/slack-ochin-B2OO5cIa.js +1 -0
  737. package/dist/console/runtime/public/console/chunks/slack-ochin-D8SyEdKz-B2OO5cIa.js +1 -0
  738. package/dist/console/runtime/public/console/chunks/smalltalk-BHpQb5nM.js +1 -0
  739. package/dist/console/runtime/public/console/chunks/smithy-Dgaz7aur.js +1 -0
  740. package/dist/console/runtime/public/console/chunks/snazzy-light-4G7pJPwS.js +1 -0
  741. package/dist/console/runtime/public/console/chunks/snazzy-light-BtkQkvXb-4G7pJPwS.js +1 -0
  742. package/dist/console/runtime/public/console/chunks/solarized-dark-B8nAdMfM-b97czJOk.js +1 -0
  743. package/dist/console/runtime/public/console/chunks/solarized-dark-b97czJOk.js +1 -0
  744. package/dist/console/runtime/public/console/chunks/solarized-light-B-3F1INj-DFPxpIYQ.js +1 -0
  745. package/dist/console/runtime/public/console/chunks/solarized-light-DFPxpIYQ.js +1 -0
  746. package/dist/console/runtime/public/console/chunks/solidity-Bj7E1mRn.js +1 -0
  747. package/dist/console/runtime/public/console/chunks/soy-Drvj0-hN.js +1 -0
  748. package/dist/console/runtime/public/console/chunks/sparql-D_iOobhT.js +1 -0
  749. package/dist/console/runtime/public/console/chunks/splunk-BC2Px7Mm.js +1 -0
  750. package/dist/console/runtime/public/console/chunks/sql-7uki0mN6.js +1 -0
  751. package/dist/console/runtime/public/console/chunks/sql-DvnUxQaA.js +1 -0
  752. package/dist/console/runtime/public/console/chunks/ssh-config-BgfXC-Er.js +1 -0
  753. package/dist/console/runtime/public/console/chunks/stata-5ekhIp_w.js +1 -0
  754. package/dist/console/runtime/public/console/chunks/stylus-B6D30XZt.js +1 -0
  755. package/dist/console/runtime/public/console/chunks/surrealql-BggsF-oc.js +1 -0
  756. package/dist/console/runtime/public/console/chunks/svelte-BOzpv3zx.js +1 -0
  757. package/dist/console/runtime/public/console/chunks/swift-CyEgAFGc.js +1 -0
  758. package/dist/console/runtime/public/console/chunks/synthwave-84-DcsXCF_c-nFMaYfgc.js +1 -0
  759. package/dist/console/runtime/public/console/chunks/synthwave-84-nFMaYfgc.js +1 -0
  760. package/dist/console/runtime/public/console/chunks/system-verilog-Dh5ihWbf.js +1 -0
  761. package/dist/console/runtime/public/console/chunks/systemd-BxMlprV5.js +1 -0
  762. package/dist/console/runtime/public/console/chunks/talonscript-CohzipZa.js +1 -0
  763. package/dist/console/runtime/public/console/chunks/tasl-DMoTqEGO.js +1 -0
  764. package/dist/console/runtime/public/console/chunks/tcl-CZd0xW_V.js +1 -0
  765. package/dist/console/runtime/public/console/chunks/templ-fdyF5dsr.js +1 -0
  766. package/dist/console/runtime/public/console/chunks/terraform-DswuEJGm.js +1 -0
  767. package/dist/console/runtime/public/console/chunks/tex-DHA47n0s.js +1 -0
  768. package/dist/console/runtime/public/console/chunks/tokyo-night-Bvpqduda-oM2G3aXe.js +1 -0
  769. package/dist/console/runtime/public/console/chunks/tokyo-night-oM2G3aXe.js +1 -0
  770. package/dist/console/runtime/public/console/chunks/toml-CcmNWLt0.js +1 -0
  771. package/dist/console/runtime/public/console/chunks/ts-tags-FylMzM_u.js +1 -0
  772. package/dist/console/runtime/public/console/chunks/tsv-sltzmVWM.js +1 -0
  773. package/dist/console/runtime/public/console/chunks/tsx-B8qh6jDH.js +1 -0
  774. package/dist/console/runtime/public/console/chunks/tsx-Ge9e86uq.js +1 -0
  775. package/dist/console/runtime/public/console/chunks/turtle-ByJddavk.js +1 -0
  776. package/dist/console/runtime/public/console/chunks/twig-r9Dsv_Ri.js +1 -0
  777. package/dist/console/runtime/public/console/chunks/typescript-C2Eu6twH.js +1 -0
  778. package/dist/console/runtime/public/console/chunks/typescript-CiUCm0l2.js +1 -0
  779. package/dist/console/runtime/public/console/chunks/typespec-BGhR2SqG.js +1 -0
  780. package/dist/console/runtime/public/console/chunks/typst-BCkRs6d9.js +1 -0
  781. package/dist/console/runtime/public/console/chunks/url-uI6JSUZP.js +4 -0
  782. package/dist/console/runtime/public/console/chunks/useForwardScopeId-mJ8JPuYU.js +1 -0
  783. package/dist/console/runtime/public/console/chunks/usePortal-BqI7uIRp.js +3 -0
  784. package/dist/console/runtime/public/console/chunks/v-DBj4K9d_.js +1 -0
  785. package/dist/console/runtime/public/console/chunks/vala-zf12oZj6.js +1 -0
  786. package/dist/console/runtime/public/console/chunks/vb-DOwzaHZ0.js +1 -0
  787. package/dist/console/runtime/public/console/chunks/verilog-B2gwz-sJ.js +1 -0
  788. package/dist/console/runtime/public/console/chunks/vesper-CfxmMOy3-DdrHHSXu.js +1 -0
  789. package/dist/console/runtime/public/console/chunks/vesper-DdrHHSXu.js +1 -0
  790. package/dist/console/runtime/public/console/chunks/vhdl-BroJfC0k.js +1 -0
  791. package/dist/console/runtime/public/console/chunks/viml-DvXPmvsu.js +1 -0
  792. package/dist/console/runtime/public/console/chunks/vitesse-black-D9-_1mjV-fwtXNY1n.js +1 -0
  793. package/dist/console/runtime/public/console/chunks/vitesse-black-fwtXNY1n.js +1 -0
  794. package/dist/console/runtime/public/console/chunks/vitesse-dark-BZCL-v6S.js +1 -0
  795. package/dist/console/runtime/public/console/chunks/vitesse-dark-DlSMLlr9-BZCL-v6S.js +1 -0
  796. package/dist/console/runtime/public/console/chunks/vitesse-light-KRWWWztf-VbXTXTou.js +1 -0
  797. package/dist/console/runtime/public/console/chunks/vitesse-light-VbXTXTou.js +1 -0
  798. package/dist/console/runtime/public/console/chunks/vue-Bc1L0ruR.js +3 -0
  799. package/dist/console/runtime/public/console/chunks/vue-CGPRTtAM.js +1 -0
  800. package/dist/console/runtime/public/console/chunks/vue-CHGs_ru8.js +1 -0
  801. package/dist/console/runtime/public/console/chunks/vue-html-CU_0vU6P.js +1 -0
  802. package/dist/console/runtime/public/console/chunks/vue-vine-BrC7uwb8.js +1 -0
  803. package/dist/console/runtime/public/console/chunks/vueuse-DCpBt1pZ.js +4 -0
  804. package/dist/console/runtime/public/console/chunks/vyper-CgoNMtux.js +1 -0
  805. package/dist/console/runtime/public/console/chunks/wasm-BnjxR4X6.js +1 -0
  806. package/dist/console/runtime/public/console/chunks/wasm-ByWQv1Qj.js +1 -0
  807. package/dist/console/runtime/public/console/chunks/wenyan-C8pVoKbM.js +1 -0
  808. package/dist/console/runtime/public/console/chunks/wgsl-BsKzXJz4.js +1 -0
  809. package/dist/console/runtime/public/console/chunks/wikitext-ClFFjSW2.js +1 -0
  810. package/dist/console/runtime/public/console/chunks/wit-DdvCle-K.js +1 -0
  811. package/dist/console/runtime/public/console/chunks/wolfram-DLL8P-h_.js +1 -0
  812. package/dist/console/runtime/public/console/chunks/xml-Bx1i6T7B.js +1 -0
  813. package/dist/console/runtime/public/console/chunks/xsl-DR5M53i7.js +1 -0
  814. package/dist/console/runtime/public/console/chunks/yaml-CZmR-Icd.js +1 -0
  815. package/dist/console/runtime/public/console/chunks/yaml-a9wqVlBt.js +1 -0
  816. package/dist/console/runtime/public/console/chunks/zenscript-BnlCZFoB.js +1 -0
  817. package/dist/console/runtime/public/console/chunks/zig-CMLA9XwU.js +1 -0
  818. package/dist/console/runtime/public/console/console-QjK_HKoM.css +2 -0
  819. package/dist/console/runtime/public/console/console-j0_7kmR5.js +21 -0
  820. package/dist/console/runtime/public/console/page-tool-Cji0S8q-.js +1 -0
  821. package/dist/console/runtime/public/skills/index.json +46 -0
  822. package/dist/console/runtime/public/skills/vitehub/SKILL.md +88 -0
  823. package/dist/console/runtime/public/skills/vitehub/agents/openai.yaml +4 -0
  824. package/dist/console/runtime/public/skills/vitehub/references/agent-definitions.md +36 -0
  825. package/dist/console/runtime/public/skills/vitehub/references/capabilities-authority.md +30 -0
  826. package/dist/console/runtime/public/skills/vitehub/references/channels-triggers.md +26 -0
  827. package/dist/console/runtime/public/skills/vitehub/references/framework-composition.md +29 -0
  828. package/dist/console/runtime/public/skills/vitehub/references/preview-contract.md +36 -0
  829. package/dist/console/runtime/public/skills/vitehub/references/primitives/auth.md +16 -0
  830. package/dist/console/runtime/public/skills/vitehub/references/primitives/blob.md +13 -0
  831. package/dist/console/runtime/public/skills/vitehub/references/primitives/browser.md +17 -0
  832. package/dist/console/runtime/public/skills/vitehub/references/primitives/cache.md +13 -0
  833. package/dist/console/runtime/public/skills/vitehub/references/primitives/channels.md +13 -0
  834. package/dist/console/runtime/public/skills/vitehub/references/primitives/connections.md +16 -0
  835. package/dist/console/runtime/public/skills/vitehub/references/primitives/content.md +13 -0
  836. package/dist/console/runtime/public/skills/vitehub/references/primitives/database.md +13 -0
  837. package/dist/console/runtime/public/skills/vitehub/references/primitives/email.md +13 -0
  838. package/dist/console/runtime/public/skills/vitehub/references/primitives/env.md +13 -0
  839. package/dist/console/runtime/public/skills/vitehub/references/primitives/kv.md +13 -0
  840. package/dist/console/runtime/public/skills/vitehub/references/primitives/markdown-template.md +13 -0
  841. package/dist/console/runtime/public/skills/vitehub/references/primitives/queue.md +16 -0
  842. package/dist/console/runtime/public/skills/vitehub/references/primitives/rate-limit.md +13 -0
  843. package/dist/console/runtime/public/skills/vitehub/references/primitives/realtime.md +19 -0
  844. package/dist/console/runtime/public/skills/vitehub/references/primitives/sandbox-task.md +13 -0
  845. package/dist/console/runtime/public/skills/vitehub/references/primitives/sandbox.md +13 -0
  846. package/dist/console/runtime/public/skills/vitehub/references/primitives/schedule.md +13 -0
  847. package/dist/console/runtime/public/skills/vitehub/references/primitives/shell.md +13 -0
  848. package/dist/console/runtime/public/skills/vitehub/references/primitives/source.md +13 -0
  849. package/dist/console/runtime/public/skills/vitehub/references/primitives/workflow.md +13 -0
  850. package/dist/console/runtime/public/skills/vitehub/references/primitives/workspace.md +13 -0
  851. package/dist/console/runtime/public/skills/vitehub/references/project-patterns.md +19 -0
  852. package/dist/console/runtime/public/skills/vitehub/references/project-shapes.md +61 -0
  853. package/dist/console/runtime/public/skills/vitehub/references/proof-recovery.md +29 -0
  854. package/dist/console/runtime/public/skills/vitehub/references/sandboxes-hosts.md +17 -0
  855. package/dist/console/runtime/public/skills/vitehub/references/schedules-workflows-invocations.md +28 -0
  856. package/dist/console/runtime/public/skills/vitehub/references/server-primitives.md +39 -0
  857. package/dist/console/runtime/public/skills/vitehub/references/workspaces-sources-access.md +26 -0
  858. package/dist/console/runtime/rpc.d.ts +36 -0
  859. package/dist/console/runtime/rpc.js +4 -0
  860. package/dist/console/runtime/sections.d.ts +2 -0
  861. package/dist/console/runtime/sections.js +351 -0
  862. package/dist/console/runtime/server/agents.get.d.ts +17 -0
  863. package/dist/console/runtime/server/agents.get.js +23 -0
  864. package/dist/console/runtime/server/auth-manage.d.ts +7 -0
  865. package/dist/console/runtime/server/auth-manage.js +155 -0
  866. package/dist/console/runtime/server/blob.d.ts +2 -0
  867. package/dist/console/runtime/server/blob.js +19 -0
  868. package/dist/console/runtime/server/channel-replay.d.ts +11 -0
  869. package/dist/console/runtime/server/channel-replay.js +80 -0
  870. package/dist/console/runtime/server/client.get.d.ts +3 -0
  871. package/dist/console/runtime/server/client.get.js +11 -0
  872. package/dist/console/runtime/server/database.d.ts +2 -0
  873. package/dist/console/runtime/server/database.get.d.ts +70 -0
  874. package/dist/console/runtime/server/database.get.js +223 -0
  875. package/dist/console/runtime/server/database.js +18 -0
  876. package/dist/console/runtime/server/definitions.d.ts +2 -0
  877. package/dist/console/runtime/server/definitions.get.d.ts +11 -0
  878. package/dist/console/runtime/server/definitions.get.js +70 -0
  879. package/dist/console/runtime/server/definitions.js +97 -0
  880. package/dist/console/runtime/server/documents.d.ts +2 -0
  881. package/dist/console/runtime/server/documents.js +111 -0
  882. package/dist/console/runtime/server/env-manage.d.ts +5 -0
  883. package/dist/console/runtime/server/env-manage.js +10 -0
  884. package/dist/console/runtime/server/env.d.ts +18 -0
  885. package/dist/console/runtime/server/env.get.d.ts +9 -0
  886. package/dist/console/runtime/server/env.get.js +29 -0
  887. package/dist/console/runtime/server/env.js +42 -0
  888. package/dist/console/runtime/server/invocation-capabilities.get.d.ts +10 -0
  889. package/dist/console/runtime/server/invocation-capabilities.get.js +22 -0
  890. package/dist/console/runtime/server/invocation-workspace.get.d.ts +42 -0
  891. package/dist/console/runtime/server/invocation-workspace.get.js +243 -0
  892. package/dist/console/runtime/server/invocation.get.d.ts +47 -0
  893. package/dist/console/runtime/server/invocation.get.js +153 -0
  894. package/dist/console/runtime/server/invocations.get.d.ts +8 -0
  895. package/dist/console/runtime/server/invocations.get.js +227 -0
  896. package/dist/console/runtime/server/logs.get.d.ts +13 -0
  897. package/dist/console/runtime/server/logs.get.js +45 -0
  898. package/dist/console/runtime/server/mcp-authorization-server.d.ts +11 -0
  899. package/dist/console/runtime/server/mcp-authorization-server.js +71 -0
  900. package/dist/console/runtime/server/mcp-discovery.d.ts +7 -0
  901. package/dist/console/runtime/server/mcp-discovery.js +20 -0
  902. package/dist/console/runtime/server/mcp-metadata.d.ts +11 -0
  903. package/dist/console/runtime/server/mcp-metadata.js +54 -0
  904. package/dist/console/runtime/server/mcp.d.ts +16 -0
  905. package/dist/console/runtime/server/mcp.js +364 -0
  906. package/dist/console/runtime/server/page-session.d.ts +2 -0
  907. package/dist/console/runtime/server/page-session.js +5 -0
  908. package/dist/console/runtime/server/page.get.d.ts +4 -0
  909. package/dist/console/runtime/server/page.get.js +49 -0
  910. package/dist/console/runtime/server/rpc.d.ts +22 -0
  911. package/dist/console/runtime/server/rpc.js +215 -0
  912. package/dist/console/runtime/server/schedule-run.d.ts +36 -0
  913. package/dist/console/runtime/server/schedule-run.js +213 -0
  914. package/dist/console/runtime/server/search.get.d.ts +9 -0
  915. package/dist/console/runtime/server/search.get.js +103 -0
  916. package/dist/console/runtime/server/sections.d.ts +4 -0
  917. package/dist/console/runtime/server/sections.get.d.ts +22 -0
  918. package/dist/console/runtime/server/sections.get.js +27 -0
  919. package/dist/console/runtime/server/sections.js +4 -0
  920. package/dist/console/runtime/server/sign-in.d.ts +5 -0
  921. package/dist/console/runtime/server/sign-in.js +11 -0
  922. package/dist/console/runtime/server/status.get.d.ts +13 -0
  923. package/dist/console/runtime/server/status.get.js +40 -0
  924. package/dist/console/runtime/server/usage.get.d.ts +7 -0
  925. package/dist/console/runtime/server/usage.get.js +99 -0
  926. package/dist/console/server.d.ts +22 -0
  927. package/dist/console/server.js +34 -0
  928. package/dist/console/ui.d.ts +201 -0
  929. package/dist/console/ui.js +3215 -0
  930. package/dist/console.d.ts +5 -0
  931. package/dist/console.js +4 -0
  932. package/dist/content/client.d.ts +1 -0
  933. package/dist/content/client.js +2 -0
  934. package/dist/content/database.d.ts +1 -0
  935. package/dist/content/database.js +2 -0
  936. package/dist/content/editor.d.ts +1 -0
  937. package/dist/content/editor.js +2 -0
  938. package/dist/content/presets/cms.d.ts +2 -0
  939. package/dist/content/presets/cms.js +2 -0
  940. package/dist/content/realtime.d.ts +1 -0
  941. package/dist/content/realtime.js +2 -0
  942. package/dist/content.d.ts +2 -0
  943. package/dist/content.js +3 -0
  944. package/dist/database-DLPk6HVu.d.ts +7 -0
  945. package/dist/database-hyYo7JVD.d.ts +11 -0
  946. package/dist/definitions-BJGSpYGa.d.ts +209 -0
  947. package/dist/definitions-Y0pIwSQm.d.ts +19 -0
  948. package/dist/diagnostics-YTWM3K3t.js +74 -0
  949. package/dist/diagnostics-lT85pbVx.d.ts +6 -0
  950. package/dist/doctor.d.ts +8 -0
  951. package/dist/doctor.js +417 -0
  952. package/dist/document-metadata-nXusaMSq.js +6 -0
  953. package/dist/documents-BRt3-fIu.d.ts +72 -0
  954. package/dist/env/auth.d.ts +1 -0
  955. package/dist/env/auth.js +2 -0
  956. package/dist/env/bridge.d.ts +1 -0
  957. package/dist/env/bridge.js +2 -0
  958. package/dist/env/database.d.ts +1 -0
  959. package/dist/env/database.js +2 -0
  960. package/dist/env/http.d.ts +1 -0
  961. package/dist/env/http.js +2 -0
  962. package/dist/env/provider.d.ts +1 -0
  963. package/dist/env/provider.js +2 -0
  964. package/dist/env/seal.d.ts +1 -0
  965. package/dist/env/seal.js +2 -0
  966. package/dist/env.d.ts +1 -0
  967. package/dist/error-diagnostics-n7V-_SPy.js +160 -0
  968. package/dist/error-diagnostics.ts +162 -0
  969. package/dist/gateways.d.ts +1 -0
  970. package/dist/gateways.js +2 -0
  971. package/dist/h3-v1-request-DDGXJ9E7.js +166 -0
  972. package/dist/index-CWk5rJOo.d.ts +247 -0
  973. package/dist/index.d.ts +3 -44
  974. package/dist/index.js +1 -1
  975. package/dist/internal-Ca7DYHpa.js +311 -0
  976. package/dist/internal-VvXn0bX4.d.ts +25 -0
  977. package/dist/invocations-DkjhdkpT.js +1151 -0
  978. package/dist/invocations-TvN9ux06.d.ts +47 -0
  979. package/dist/logs/host.d.ts +6 -0
  980. package/dist/logs/host.js +16 -0
  981. package/dist/logs/memory.d.ts +18 -0
  982. package/dist/logs/memory.js +85 -0
  983. package/dist/logs/source.d.ts +57 -0
  984. package/dist/logs/source.js +57 -0
  985. package/dist/logs.d.ts +4 -0
  986. package/dist/logs.js +4 -0
  987. package/dist/loopback-DAr1IFQP.js +43 -0
  988. package/dist/markdown-template/file.d.ts +1 -0
  989. package/dist/markdown-template/file.js +2 -0
  990. package/dist/media-BBybn3NP.js +512 -0
  991. package/dist/nuxt.d.ts +15 -14
  992. package/dist/nuxt.js +1156 -25
  993. package/dist/operation-contributions-BXHKgT_w.d.ts +18 -0
  994. package/dist/operations-4uDh4zah.js +38 -0
  995. package/dist/operations-7RHOMAHT.js +455 -0
  996. package/dist/operations-Bgklf9hM.d.ts +149 -0
  997. package/dist/operations-CwqEItfA.js +468 -0
  998. package/dist/operations.d.ts +2 -0
  999. package/dist/operations.js +2 -0
  1000. package/dist/owned-paths-BnjT0FhU.js +15 -0
  1001. package/dist/package-BsfDnNm8.js +1119 -0
  1002. package/dist/page-tools-B3g4CQ5c.js +402 -0
  1003. package/dist/page-tools-C5dufxVz.d.ts +16 -0
  1004. package/dist/page-tools-shared-D-amu6sx.js +53 -0
  1005. package/dist/presets/babysitter/server.d.ts +1 -0
  1006. package/dist/presets/babysitter/server.js +2 -0
  1007. package/dist/presets/babysitter.d.ts +1 -0
  1008. package/dist/presets/babysitter.js +2 -0
  1009. package/dist/presets/labeller.d.ts +1 -0
  1010. package/dist/presets/labeller.js +2 -0
  1011. package/dist/presets/workspace.d.ts +2 -0
  1012. package/dist/presets/workspace.js +2 -0
  1013. package/dist/project-registry-BT7RcCcQ.js +39 -0
  1014. package/dist/realtime/server.d.ts +1 -0
  1015. package/dist/realtime/server.js +2 -0
  1016. package/dist/realtime/vue.d.ts +1 -0
  1017. package/dist/realtime/vue.js +2 -0
  1018. package/dist/realtime.d.ts +1 -0
  1019. package/dist/realtime.js +2 -0
  1020. package/dist/registry-dSdI2Oa3.js +142 -0
  1021. package/dist/request-BT6g-Fwf.js +326 -0
  1022. package/dist/request-DOvvVgpI.d.ts +52 -0
  1023. package/dist/retention-DBXuVtQL.js +257 -0
  1024. package/dist/rolldown-runtime-8H4AJuhK.js +14 -0
  1025. package/dist/runtime/h3.d.ts +2 -0
  1026. package/dist/runtime/h3.js +2 -0
  1027. package/dist/runtime/node.d.ts +1 -0
  1028. package/dist/runtime/node.js +2 -0
  1029. package/dist/runtime-DPqC3MTX.js +60 -0
  1030. package/dist/sandbox/ssh.d.ts +1 -0
  1031. package/dist/sandbox/ssh.js +2 -0
  1032. package/dist/sandbox/task.d.ts +1 -0
  1033. package/dist/sandbox/task.js +2 -0
  1034. package/dist/scan-module-TmHMoGKw.js +148 -0
  1035. package/dist/schedule/runtime/kv.d.ts +1 -0
  1036. package/dist/schedule/runtime/kv.js +2 -0
  1037. package/dist/schema-form-C-fy3xaU.d.ts +79 -0
  1038. package/dist/secret-DrgWMRms.js +47 -0
  1039. package/dist/sections-BVtKNenQ.js +108 -0
  1040. package/dist/sections-C985LlW2.d.ts +31 -0
  1041. package/dist/sections-Drj-o4_z.d.ts +141 -0
  1042. package/dist/source/client.d.ts +1 -0
  1043. package/dist/source/client.js +2 -0
  1044. package/dist/source/file.d.ts +1 -0
  1045. package/dist/source/file.js +2 -0
  1046. package/dist/source/files.d.ts +1 -0
  1047. package/dist/source/files.js +2 -0
  1048. package/dist/source/github.d.ts +1 -0
  1049. package/dist/source/github.js +2 -0
  1050. package/dist/source/glob.d.ts +1 -0
  1051. package/dist/source/glob.js +2 -0
  1052. package/dist/source/markdown.d.ts +1 -0
  1053. package/dist/source/markdown.js +2 -0
  1054. package/dist/source/mcp.d.ts +1 -0
  1055. package/dist/source/mcp.js +2 -0
  1056. package/dist/source/server.d.ts +1 -0
  1057. package/dist/source/server.js +2 -0
  1058. package/dist/source/vite.d.ts +7 -0
  1059. package/dist/source/vite.js +20 -0
  1060. package/dist/source.d.ts +2 -1
  1061. package/dist/source.js +1 -0
  1062. package/dist/src-CaqWiza-.js +7910 -0
  1063. package/dist/task.d.ts +3 -0
  1064. package/dist/task.js +2 -0
  1065. package/dist/types-BsuwNk3q.js +256 -0
  1066. package/dist/ui/attachment.d.ts +1 -0
  1067. package/dist/ui/attachment.js +2 -0
  1068. package/dist/ui/avatar-stack.d.ts +1 -0
  1069. package/dist/ui/avatar-stack.js +2 -0
  1070. package/dist/ui/bubble.d.ts +1 -0
  1071. package/dist/ui/bubble.js +2 -0
  1072. package/dist/ui/chat-message.d.ts +1 -0
  1073. package/dist/ui/chat-message.js +2 -0
  1074. package/dist/ui/chat-session.d.ts +1 -0
  1075. package/dist/ui/chat-session.js +2 -0
  1076. package/dist/ui/chat.d.ts +1 -0
  1077. package/dist/ui/chat.js +2 -0
  1078. package/dist/ui/code-block.d.ts +1 -0
  1079. package/dist/ui/code-block.js +2 -0
  1080. package/dist/ui/code-view.d.ts +1 -0
  1081. package/dist/ui/code-view.js +2 -0
  1082. package/dist/ui/comments.d.ts +1 -0
  1083. package/dist/ui/comments.js +2 -0
  1084. package/dist/ui/connection-status.d.ts +1 -0
  1085. package/dist/ui/connection-status.js +2 -0
  1086. package/dist/ui/file-diff.d.ts +1 -0
  1087. package/dist/ui/file-diff.js +2 -0
  1088. package/dist/ui/file-tree.d.ts +1 -0
  1089. package/dist/ui/file-tree.js +2 -0
  1090. package/dist/ui/file-view.d.ts +1 -0
  1091. package/dist/ui/file-view.js +2 -0
  1092. package/dist/ui/headless.d.ts +1 -0
  1093. package/dist/ui/headless.js +2 -0
  1094. package/dist/ui/markdown.d.ts +1 -0
  1095. package/dist/ui/markdown.js +2 -0
  1096. package/dist/ui/marker.d.ts +1 -0
  1097. package/dist/ui/marker.js +2 -0
  1098. package/dist/ui/message-parts.d.ts +1 -0
  1099. package/dist/ui/message-parts.js +2 -0
  1100. package/dist/ui/message.d.ts +1 -0
  1101. package/dist/ui/message.js +2 -0
  1102. package/dist/ui/multi-file-diff.d.ts +1 -0
  1103. package/dist/ui/multi-file-diff.js +2 -0
  1104. package/dist/ui/nuxt.d.ts +3 -0
  1105. package/dist/ui/nuxt.js +3 -0
  1106. package/dist/ui/patch-diff.d.ts +1 -0
  1107. package/dist/ui/patch-diff.js +2 -0
  1108. package/dist/ui/prompt-input.d.ts +1 -0
  1109. package/dist/ui/prompt-input.js +2 -0
  1110. package/dist/ui/styles.css +2662 -0
  1111. package/dist/ui/sync-status.d.ts +1 -0
  1112. package/dist/ui/sync-status.js +2 -0
  1113. package/dist/ui/tool-list.d.ts +1 -0
  1114. package/dist/ui/tool-list.js +2 -0
  1115. package/dist/ui/trace-run.d.ts +1 -0
  1116. package/dist/ui/trace-run.js +2 -0
  1117. package/dist/ui/trace.d.ts +1 -0
  1118. package/dist/ui/trace.js +2 -0
  1119. package/dist/ui/unresolved-file.d.ts +1 -0
  1120. package/dist/ui/unresolved-file.js +2 -0
  1121. package/dist/ui/vite.d.ts +3 -0
  1122. package/dist/ui/vite.js +3 -0
  1123. package/dist/ui.d.ts +1 -0
  1124. package/dist/ui.js +2 -0
  1125. package/dist/usage-CoQXs5nW.d.ts +22 -0
  1126. package/dist/workspace/blob-database.d.ts +1 -0
  1127. package/dist/workspace/blob-database.js +2 -0
  1128. package/package.json +1356 -139
  1129. package/dist/_internal/sandbox/runtime/state.d.ts +0 -1
  1130. package/dist/_internal/sandbox/runtime/state.js +0 -2
  1131. package/dist/_internal/schedule/runtime/driver.d.ts +0 -1
  1132. package/dist/_internal/schedule/runtime/driver.js +0 -2
  1133. package/dist/agent/harness/local-sandbox.d.ts +0 -1
  1134. package/dist/agent/harness/local-sandbox.js +0 -2
  1135. package/dist/box.d.ts +0 -1
  1136. package/dist/box.js +0 -2
  1137. package/dist/email/drivers/smtp.d.ts +0 -1
  1138. package/dist/email/drivers/smtp.js +0 -2
  1139. package/dist/schedule/runtime/driver.d.ts +0 -1
  1140. package/dist/schedule/runtime/driver.js +0 -2
  1141. package/dist/shell/providers/cloudflare.d.ts +0 -1
  1142. package/dist/shell/providers/cloudflare.js +0 -2
  1143. package/dist/src-o6zB-soj.js +0 -1135
  1144. package/dist/workspace/collections/client.d.ts +0 -1
  1145. package/dist/workspace/collections/client.js +0 -2
  1146. package/dist/workspace/collections.d.ts +0 -1
  1147. package/dist/workspace/collections.js +0 -2
  1148. package/dist/workspace/publish.d.ts +0 -1
  1149. package/dist/workspace/publish.js +0 -2
@@ -0,0 +1,2605 @@
1
+ <script setup lang="ts">
2
+ import { Time, today } from "@internationalized/date";
3
+ import { computed, markRaw, nextTick, onBeforeUnmount, onMounted, provide, ref, shallowRef, watch } from "vue";
4
+ import { AvatarStack, ConnectionStatus, ConnectionStatusIndicator, ConnectionStatusLabel } from "@vite-hub/ui";
5
+ import { onBeforeRouteLeave, onBeforeRouteUpdate, useRoute, useRouter } from "vue-router";
6
+
7
+ import {
8
+ consoleDocumentSlug,
9
+ consoleDocumentHasBody,
10
+ consoleDocumentScheduleHint,
11
+ consoleDocumentScheduleLabel,
12
+ consoleDocumentScheduleTone,
13
+ consoleDocumentStateColor,
14
+ consoleDocumentStateLabel,
15
+ consoleErrorMessage,
16
+ consoleFieldIssues,
17
+ consoleFixFieldsLabel,
18
+ consoleHintText,
19
+ consoleLeaseHolder,
20
+ consoleListQueryFor,
21
+ consolePublishedConflicts,
22
+ consolePublishMismatches,
23
+ consoleRevisionLabel,
24
+ consoleSeoFallbacks,
25
+ consoleSeoField,
26
+ consoleDocumentFolders,
27
+ consoleSingularLabel,
28
+ isConsoleConflict,
29
+ isConsoleDocumentId,
30
+ consoleLocalScheduleTime,
31
+ stableConsoleJSON,
32
+ } from "../client/documents"
33
+ import {
34
+ compactConsoleFieldValues,
35
+ consoleSchemaDefaults,
36
+ describeConsoleSchemaFields,
37
+ groupConsoleFieldIssues,
38
+ humanizeConsoleFieldIssues,
39
+ } from "../client/schema-form";
40
+ import { splitConsoleFrontmatter } from "../client/editor";
41
+ import { useConsoleLiveDocument } from "../client/live";
42
+ import { consoleClockTime, consoleLiveDefinition, consoleLiveLabel, consoleLiveUnavailable, consoleTabSession, useConsoleDocumentPresence } from "../client/presence";
43
+ import { clearConsoleLocalDraft, consolePreviewUrl, consolePreviewWidth, readConsoleLocalDraft, writeConsoleLocalDraft } from "../client/preview";
44
+ import { useConsoleToast } from "../client/toast";
45
+ import ConsoleDocumentDiff from "./console-document-diff.vue";
46
+ import ConsoleDocumentHistory from "./console-document-history.vue";
47
+ import ConsoleDocumentPreview from "./console-document-preview.vue";
48
+ import ConsoleSchemaForm from "./console-schema-form.vue";
49
+ import ConsoleMarkdownEditor from "./console-markdown-editor.vue";
50
+ import ConsoleLoading from "./console-loading.vue";
51
+ import ConsoleState from "./console-state.vue";
52
+ import ConsolePropertyRow from "./console-property-row.vue";
53
+ import ConsolePageHeader from "./console-page-header.vue";
54
+ import ConsolePresenceAvatars from "./console-presence-avatars.vue";
55
+ import ConsoleRelativeTime from "./console-relative-time.vue";
56
+ import ConsoleSeoPanel from "./console-seo-panel.vue";
57
+ import ConsoleStatus from "./console-status.vue";
58
+
59
+ import type { CalendarDate } from "@internationalized/date";
60
+ import type { RouteLocationRaw } from "vue-router";
61
+
62
+ import type { ConsoleDocument, ConsoleDocumentCollection, ConsoleDocumentRevision, ConsoleDocumentSchedule, ConsoleDocumentsClient, ConsoleDocumentState, ConsoleRawDocument } from "../client/documents";
63
+ import type { ConsoleDocumentSetup } from "../definitions";
64
+ import type { ConsoleLivePerson, ConsoleLiveReset } from "../client/live";
65
+ import type { ConsoleLocalVersion, ConsolePreviewView, ConsolePreviewViewport } from "../client/preview";
66
+
67
+ /**
68
+ * Edits one document as a page: a large title, the fields as property rows, then the body. Drafts save on their own
69
+ * one second after typing stops, and ⌘S saves at once. Every save sends the digest of the version the editor read, so
70
+ * a save never overwrites a newer version: a conflict pauses saving and offers a comparison. Invalid fields come back
71
+ * from the owner validators and show inline. JSON and YAML documents have no body, so the property rows are the page.
72
+ * A singleton, such as site settings, has no list: it starts from its defaults before its first save.
73
+ */
74
+ const props = defineProps<{
75
+ changes: number;
76
+ client: ConsoleDocumentsClient;
77
+ collection: ConsoleDocumentCollection;
78
+ /** Undefined for a new document. */
79
+ documentId?: string;
80
+ /** Where Back leads instead of the collection list, such as the Settings page for a singleton. */
81
+ parent?: { label: string, to: RouteLocationRaw };
82
+ /** What the project lacks, such as a runner for scheduled publishes. */
83
+ setup?: ConsoleDocumentSetup;
84
+ }>();
85
+
86
+ const emit = defineEmits<{ changed: [] }>();
87
+
88
+ interface Version {
89
+ body: string;
90
+ data: Record<string, unknown>;
91
+ }
92
+
93
+ /** How long typing must pause before the draft saves. */
94
+ const autosaveDelay = 1_000;
95
+
96
+ const route = useRoute();
97
+ const router = useRouter();
98
+ const toast = useConsoleToast();
99
+ const creating = computed(() => props.documentId === undefined);
100
+ const single = computed(() => props.collection.kind === "singleton");
101
+ const hasBody = computed(() => consoleDocumentHasBody(props.collection));
102
+ const fields = computed(() => describeConsoleSchemaFields(props.collection.schema));
103
+ const noun = computed(() => consoleSingularLabel(props.collection));
104
+ // A singleton is named by its label, so every field, a `title` too, is a property row.
105
+ const titleField = computed(() => (single.value ? undefined : fields.value.find(field => field.name === props.collection.titleField && field.kind === "string")));
106
+ // A `seo()` field gets its own group of rows, with counters and previews, under the other properties.
107
+ const seoField = computed(() => consoleSeoField(props.collection.schema));
108
+
109
+ const loading = ref(!creating.value);
110
+ const loadError = ref<unknown>();
111
+ /** The version the editor read: the last loaded or saved document. Null for a new or deleted document. */
112
+ const base = ref<ConsoleDocument | null>(null);
113
+ const state = ref<ConsoleDocumentState | undefined>();
114
+ /** The scheduled publish of this document, as the owner reported it on load. */
115
+ const schedule = ref<ConsoleDocumentSchedule | undefined>();
116
+ const scheduleOpen = ref(false);
117
+ const scheduleDate = shallowRef<CalendarDate>();
118
+ const scheduleTime = shallowRef(new Time(9, 0));
119
+ const scheduling = ref(false);
120
+ const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
121
+ const draft = ref<Version>({ body: "", data: creating.value || single.value ? consoleSchemaDefaults(props.collection.schema) : {} });
122
+ const newId = ref("");
123
+ const idEdited = ref(false);
124
+ const saving = ref(false);
125
+ const publishing = ref(false);
126
+ /** When this editor last saved, for `Saved 3s ago`. */
127
+ const savedAt = ref<string>();
128
+ /** Why the last save failed, when the failure is not a field issue or a conflict. */
129
+ const saveError = ref<string>();
130
+ const fieldErrors = ref<Record<string, string[]>>({});
131
+ /** A save that met a newer version. Saving stays paused until someone resolves it. */
132
+ const conflict = ref<{ mine: Version, theirs: ConsoleDocument | null }>();
133
+ const conflictOpen = ref(false);
134
+ const deleteOpen = ref(false);
135
+ const deleting = ref(false);
136
+ const historyOpen = ref(false);
137
+ const revisions = ref<ConsoleDocumentRevision[]>([]);
138
+ const revisionsCursor = ref<string>();
139
+ const revisionsLoading = ref(false);
140
+ const revisionsError = ref<unknown>();
141
+ const revisionsLoadedAt = ref(Date.now());
142
+ /** A revision as stored, next to the saved draft. Stored files show even when they no longer validate. */
143
+ const preview = ref<{ current: ConsoleRawDocument | null, document: ConsoleRawDocument | null, revision: ConsoleDocumentRevision }>();
144
+ const previewLoading = ref(false);
145
+ const restoring = ref(false);
146
+ /**
147
+ * The version on the site, when it changed after this draft started from it. `published` is its digest, or null when the
148
+ * site deleted it. In Local only, `shared` is the shared draft that Publish shared draft reviewed and compares instead.
149
+ */
150
+ const siteConflict = ref<{ site: ConsoleDocument | null, published: string | null, shared?: ConsoleDocument }>();
151
+ const siteConflictOpen = ref(false);
152
+ const siteConflictLoading = ref(false);
153
+ const siteConflictError = ref<string>();
154
+ /** The reviewed shared draft that the open comparison is for, kept while the site read fails so Retry compares it again. */
155
+ const siteConflictShared = ref<ConsoleDocument>();
156
+ const resolvingSite = ref(false);
157
+ const bodyEditor = ref<InstanceType<typeof ConsoleMarkdownEditor>>();
158
+ const titleInput = ref<HTMLTextAreaElement>();
159
+ /** Rich edits the page; Source shows the stored file, with the body editable as Markdown. */
160
+ const mode = ref<"rich" | "source">("rich");
161
+ /** The stored file of the draft, for Source. */
162
+ const storedFile = ref<string>();
163
+ const outline = ref<Array<{ id: string, level: number, pos: number, text: string }>>([]);
164
+ let mounted = true;
165
+ /** `changed` events this editor sent. The section echoes them back through `changes`, which must not reload the page. */
166
+ let ownChanges = 0;
167
+ let autosaveTimer: ReturnType<typeof setTimeout> | undefined;
168
+ let saveQueued = false;
169
+
170
+ const canWrite = computed(() => props.collection.access.write);
171
+ const canPublish = computed(() => props.collection.access.publish);
172
+
173
+ /**
174
+ * Collaborative or Local only. Collaborative edits save to the shared draft, in the live room where Content installs
175
+ * it. Local-only edits stay in this tab: they never save, never reach the room, and survive a reload. Apply saves
176
+ * them over the shared draft they started from, and Discard drops them. Publish always publishes the shared draft.
177
+ */
178
+ const editing = ref<"shared" | "local">("shared");
179
+ const local = computed(() => editing.value === "local");
180
+ /** The shared draft digest that the local edits started from, and the version they started as. */
181
+ const localBase = ref<string | null>(null);
182
+ const localStart = ref<ConsoleLocalVersion>();
183
+ const localStorageFailed = ref(false);
184
+ const localExitOpen = ref(false);
185
+ const applyingLocal = ref(false);
186
+ /** A shared draft newer than the one the local edits started from, met while applying them. */
187
+ /**
188
+ * What a refused Apply found: the newer shared draft, null when the shared draft is gone, or why it could not be read.
189
+ * A failed read is not a deletion, so it never offers to create the draft again.
190
+ */
191
+ const localConflict = ref<{ theirs: ConsoleDocument | null } | { failed: string }>();
192
+ const readingConflict = ref(false);
193
+ const sharedPublishOpen = ref(false);
194
+ const sharedPublish = ref<{ draft: ConsoleDocument | null, site: ConsoleDocument | null }>();
195
+ const sharedPublishLoading = ref(false);
196
+ if (!creating.value && props.documentId !== undefined && canWrite.value) {
197
+ const stored = readConsoleLocalDraft(window.sessionStorage, props.collection.name, props.documentId);
198
+ if (stored) {
199
+ editing.value = "local";
200
+ localBase.value = stored.base;
201
+ localStart.value = stored.start;
202
+ draft.value = clone(stored.version);
203
+ }
204
+ }
205
+
206
+ /**
207
+ * Presence and the edit lease. The first edit claims the lease while keystrokes stay on screen; saving waits for the
208
+ * answer. Another tab that holds it makes this one read-only until the user takes over.
209
+ */
210
+ const session = useConsoleDocumentPresence({
211
+ client: props.client,
212
+ collection: props.collection.name,
213
+ documentId: () => (creating.value ? undefined : props.documentId),
214
+ // Local-only edits need no lease, so a holder opens no dialog for them.
215
+ canWrite: () => canWrite.value && !local.value,
216
+ // While this page joins or edits in the live room, the room holds the lease for it.
217
+ live: () => Boolean(liveRoom.value),
218
+ onDigest: onRemoteDigest,
219
+ });
220
+ const leaseMode = session.mode;
221
+ const { dialogOpen: leaseDialogOpen, holder: leaseHolder, others: sessionOthers, presence: sessionPresence, unreachable: sessionUnreachable } = session;
222
+
223
+ /**
224
+ * Live co-editing. Where Content installs it, a saved Markdown document opens its Realtime room: fields and body sync as
225
+ * people type, carets and focused fields show who is where, and the room saves the draft and holds the edit lease for
226
+ * everyone in it. The page edits alone, with the lease, when the codec cannot keep the body or the room does not answer.
227
+ */
228
+ const liveDefinition = consoleLiveDefinition(props.setup);
229
+ const liveFallback = ref<"document" | "unreachable">();
230
+ const liveRoom = computed(() => {
231
+ if (!liveDefinition || !hasBody.value || creating.value || liveFallback.value || local.value || props.documentId === undefined) return undefined;
232
+ return single.value ? props.collection.name : `${props.collection.name}/${props.documentId}`;
233
+ });
234
+ const live = liveDefinition
235
+ ? useConsoleLiveDocument({
236
+ definition: liveDefinition,
237
+ room: () => liveRoom.value,
238
+ components: () => props.collection.components,
239
+ user: () => sessionPresence.value?.user,
240
+ onReset: onLiveReset,
241
+ })
242
+ : undefined;
243
+ /** This tab edits through the live room now. */
244
+ const liveActive = computed(() => Boolean(live?.ready.value && liveRoom.value));
245
+ const liveOthers = computed<ConsoleLivePerson[]>(() => (liveActive.value ? live?.others.value ?? [] : []));
246
+ /** The room connection. A drop shorter than the delay of `ConnectionStatus` still reads as Live. */
247
+ const liveStatus = computed(() => live?.status.value ?? "connecting");
248
+ /** The room document, provider, and identity for the body editor. A reset mounts the editor again for the new room. */
249
+ const liveBinding = computed(() => {
250
+ const document = live?.document.value;
251
+ const provider = live?.provider.value;
252
+ const user = live?.identity.value;
253
+ return liveActive.value && document && provider && user ? markRaw({ document, provider, user }) : undefined;
254
+ });
255
+ const liveEpoch = ref(0);
256
+ /** Live editing is installed but this page edits alone: say so where it matters, when someone else is here. */
257
+ const liveUnavailableReason = computed(() => {
258
+ if (!hasBody.value || creating.value) return undefined;
259
+ const live = props.setup?.live;
260
+ if (live && "unavailable" in live) return live.unavailable;
261
+ if (liveFallback.value === "unreachable") return "The live session did not answer. Saves still refuse to overwrite a newer version.";
262
+ return undefined;
263
+ });
264
+ /** Edits a reset dropped, for "Copy your unsaved edits". */
265
+ const liveUnsaved = ref<{ body: string, fields: Record<string, unknown> }>();
266
+ /** Until when a reset comes from this tab's own restore, which needs no notice. */
267
+ let ownResetUntil = 0;
268
+
269
+ if (live) {
270
+ // A body the codec cannot keep opens read-only in the room: edit it alone, in Source, under the single-editor lease.
271
+ watch(live.readOnlyReason, (reason) => {
272
+ if (reason === "document") liveFallback.value = "document";
273
+ });
274
+ // A room that does not answer within a few seconds leaves the page to one editor at a time.
275
+ let joinTimer: ReturnType<typeof setTimeout> | undefined;
276
+ watch(liveRoom, (room) => {
277
+ clearTimeout(joinTimer);
278
+ if (room) joinTimer = setTimeout(() => {
279
+ if (!live.ready.value && liveRoom.value === room) liveFallback.value = "unreachable";
280
+ }, 8_000);
281
+ }, { immediate: true });
282
+ onBeforeUnmount(() => clearTimeout(joinTimer));
283
+ watch(live.document, () => liveEpoch.value++);
284
+ // Room fields show in the property rows; the draft watcher writes local edits back, field by field.
285
+ watch(() => live.fields.value, (fields) => {
286
+ if (!fields || !liveActive.value) return;
287
+ if (stableConsoleJSON(compact(fields)) === stableConsoleJSON(compact(draft.value.data))) return;
288
+ draft.value = { ...draft.value, data: clone(fields) };
289
+ });
290
+ // Each room save: the time, the field issues, the History list, and the state of the document.
291
+ watch(() => live.saveStatus.value?.savedAt, (at, before) => {
292
+ if (!at || at === before || !liveActive.value) return;
293
+ savedAt.value = at;
294
+ void refreshState();
295
+ notifyChanged();
296
+ if (revisions.value.length || historyOpen.value || panel.value === "history") void loadRevisions();
297
+ });
298
+ watch(() => live.issues.value, (issues) => {
299
+ if (!liveActive.value || !live.saveStatus.value?.savedAt) return;
300
+ const fieldIssues = issues.filter(issue => issue.field !== undefined && issue.field !== "body").map(issue => ({ field: issue.field, message: issue.message, path: issue.path ?? [] }));
301
+ fieldErrors.value = groupConsoleFieldIssues(humanizeConsoleFieldIssues(fields.value, fieldIssues));
302
+ errorSnapshot = Object.fromEntries(Object.entries(draft.value.data).map(([name, value]) => [name, stableConsoleJSON(value ?? null)]));
303
+ });
304
+ }
305
+
306
+ /** The stored copy changed outside the room, such as an Agent save or a restore. The room reloaded it. */
307
+ function onLiveReset(reset: ConsoleLiveReset): void {
308
+ if (Date.now() < ownResetUntil || reset.reason !== "source-changed") return;
309
+ const what = single.value ? "page" : noun.value.toLowerCase();
310
+ if (!reset.unsaved) {
311
+ toast.show({ title: `This ${what} was updated` });
312
+ return;
313
+ }
314
+ liveUnsaved.value = reset.unsaved;
315
+ toast.show({ action: { label: "Copy your unsaved edits", onClick: () => void copyLiveUnsaved() }, title: `This ${what} changed while you typed` });
316
+ }
317
+
318
+ async function copyLiveUnsaved(): Promise<void> {
319
+ const unsaved = liveUnsaved.value;
320
+ if (!unsaved) return;
321
+ try {
322
+ await navigator.clipboard.writeText(unsaved.body);
323
+ toast.show({ title: "Your edits copied" });
324
+ }
325
+ catch {
326
+ toast.error("Couldn't copy. Select the text and copy it.");
327
+ }
328
+ }
329
+
330
+ /** The field a focused element edits: the top-level field of its property row, or the title. */
331
+ function focusedField(target: EventTarget | null): string | undefined {
332
+ const row = target instanceof Element ? target.closest("[data-vitehub-field]") : null;
333
+ const control = row?.getAttribute("data-vitehub-field") ?? (target instanceof Element ? target.id : "");
334
+ return fields.value.map(field => field.name).find(name => {
335
+ const id = `field-${name.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
336
+ return control === id || control.startsWith(`${id}-`);
337
+ });
338
+ }
339
+
340
+ function onFieldFocus(event: FocusEvent): void {
341
+ const field = focusedField(event.target);
342
+ previewHighlight.value = field;
343
+ if (liveActive.value) live?.focus(field);
344
+ }
345
+
346
+ function onFieldBlur(event: FocusEvent): void {
347
+ if (focusedField(event.relatedTarget)) return;
348
+ previewHighlight.value = undefined;
349
+ if (liveActive.value) live?.focus(undefined);
350
+ }
351
+
352
+ /** Who else focuses each field, keyed by the id of its control, for avatars on the property rows. */
353
+ const fieldPeople = computed(() => {
354
+ const byControl: Record<string, ConsoleLivePerson[]> = {};
355
+ for (const person of liveOthers.value) {
356
+ if (!person.focus) continue;
357
+ (byControl[`field-${person.focus.replace(/[^a-zA-Z0-9_-]/g, "-")}`] ??= []).push(person);
358
+ }
359
+ return byControl;
360
+ });
361
+ provide("vitehubFieldPeople", fieldPeople);
362
+ /** Sessions are on, but this tab cannot check them: a failed request, or an owner without the sessions table. */
363
+ const sessionsUnchecked = computed(() => !creating.value && (sessionUnreachable.value || sessionPresence.value?.available === false));
364
+ /** The one line under the header that says who holds the lease and what this tab can do about it. */
365
+ const leaseBanner = computed<{ icon: string, text: string } | undefined>(() => {
366
+ if (!canWrite.value || creating.value || local.value) return;
367
+ const name = holderName.value;
368
+ if (leaseMode.value === "blocked") {
369
+ if (holderLive.value) return { icon: "i-lucide-users", text: `Read-only · ${name}` };
370
+ return { icon: "i-lucide-lock", text: name === "You" ? "Read-only · You're editing this in another tab" : `Read-only · ${name} is editing` };
371
+ }
372
+ if (leaseMode.value === "taken") {
373
+ const savedTime = consoleClockTime(savedAt.value ?? base.value?.updatedAt);
374
+ const by = name === "You" ? "Your other tab took over" : `${name} took over`;
375
+ return { icon: "i-lucide-user-round-pen", text: savedTime ? `${by} · Your changes up to ${savedTime} are saved` : by };
376
+ }
377
+ if (leaseMode.value === "left") return { icon: "i-lucide-lock-open", text: name === "You" ? "Your other tab stopped editing" : `${name} stopped editing` };
378
+ });
379
+ const holderName = computed(() => {
380
+ const holder = session.holder.value;
381
+ if (holder?.kind === "live") return consoleLiveLabel(holder);
382
+ return session.ownOtherTab.value ? "You" : holder?.user.name ?? "Someone";
383
+ });
384
+ const holderLive = computed(() => session.holder.value?.kind === "live");
385
+ /** In Local only, who holds the lease that Apply needs, while another tab edits the shared draft. */
386
+ const localLeaseHolder = computed(() => {
387
+ const holder = sessionPresence.value?.holder;
388
+ if (!local.value || !holder || holder.self || holder.kind === "live" || leaseMode.value === "editing") return;
389
+ const name = holder.user.id === sessionPresence.value?.user?.id ? "You" : holder.user.name;
390
+ return name === "You" ? "Your other tab is editing the shared draft." : `${name} is editing the shared draft.`;
391
+ });
392
+ /** Saves another tab refused while it held the lease. Their edits stay on screen. */
393
+ const refusedEdits = ref(0);
394
+ /** Whether this tab may change the document now: write access, and no other tab holds the lease. */
395
+ const editable = computed(() => canWrite.value && (local.value || creating.value || leaseMode.value === "free" || leaseMode.value === "editing"));
396
+ const leaseCompareOpen = ref(false);
397
+ const leaseCompare = ref<{ mine: Version, theirs: ConsoleDocument | null }>();
398
+ // A collection with several globs offers a folder for each. The id starts with the folder below the one that all globs share.
399
+ const folders = computed(() => consoleDocumentFolders(props.collection));
400
+ const folderIndex = ref(0);
401
+ const folderPrefix = computed(() => folders.value[folderIndex.value]?.prefix ?? "");
402
+ const id = computed(() => (creating.value ? (newId.value.trim() ? `${folderPrefix.value}${newId.value.trim()}` : "") : props.documentId!));
403
+ const savedVersion = computed<Version>(() => (base.value ? { body: base.value.body, data: base.value.data } : { body: "", data: consoleSchemaDefaults(props.collection.schema) }));
404
+ const dirty = computed(() => {
405
+ // The live room saves on its own, and local-only edits never save: nothing waits on this tab.
406
+ if (liveActive.value || local.value) return false;
407
+ if (creating.value) return Boolean(newId.value.trim()) || stableConsoleJSON(compact(draft.value.data)) !== stableConsoleJSON(compact(savedVersion.value.data)) || Boolean(draft.value.body.trim());
408
+ // A singleton that does not exist yet is dirty once it differs from its defaults.
409
+ if (!base.value) return single.value && state.value !== "deleted" && stableConsoleJSON(compact(draft.value.data)) !== stableConsoleJSON(compact(savedVersion.value.data));
410
+ // The editor writes canonical Markdown, which can drop a trailing newline that the stored file has.
411
+ return draft.value.body.trimEnd() !== base.value.body.trimEnd() || dataDirty.value;
412
+ });
413
+ /**
414
+ * The shared draft that the local edits started from is gone, such as when another editor deleted it. The local edits
415
+ * stay on screen with Copy, Apply, and Discard: Apply compares before it creates the document again.
416
+ */
417
+ const sharedGone = computed(() => local.value && !loading.value && !base.value && !loadError.value);
418
+ /** Local-only edits differ from the version they started as. */
419
+ const localChanged = computed(() => {
420
+ const start = localStart.value;
421
+ if (!local.value || !start) return false;
422
+ return draft.value.body.trimEnd() !== start.body.trimEnd() || stableConsoleJSON(compact(draft.value.data)) !== stableConsoleJSON(compact(start.data));
423
+ });
424
+ /** Someone saved the shared draft after the local edits started from it. Apply then asks before overwriting. */
425
+ const sharedMoved = computed(() => local.value && !loading.value && Boolean(base.value) && base.value!.digest !== localBase.value);
426
+ const dataDirty = computed(() => Boolean(base.value) && stableConsoleJSON(compact(draft.value.data)) !== stableConsoleJSON(compact(base.value!.data)));
427
+ // Local-only edits keep the editor open when the shared draft is gone, so they are never hidden behind these states.
428
+ const deleted = computed(() => !creating.value && !loading.value && !base.value && !local.value && state.value === "deleted");
429
+ // A singleton that was never saved opens with its defaults instead.
430
+ const missing = computed(() => !single.value && !creating.value && !loading.value && !base.value && !local.value && !loadError.value && state.value !== "deleted");
431
+ // Local-only edits do not need a shared save, but removing the iframe still needs the page tools' exit guard.
432
+ watch(() => dirty.value || localChanged.value || sharedGone.value, value => {
433
+ if (window.parent !== window) window.parent.postMessage({ type: "vitehub:dirty", dirty: value }, location.origin);
434
+ }, { immediate: true });
435
+ onBeforeUnmount(() => {
436
+ if (window.parent !== window) window.parent.postMessage({ type: "vitehub:dirty", dirty: false }, location.origin);
437
+ });
438
+
439
+ // Without a shared draft, Local only has nothing to publish: Apply or Discard the local edits first.
440
+ const publishable = computed(() => canPublish.value && !creating.value && !sharedGone.value && (dirty.value || state.value === "draft" || state.value === "changed" || state.value === "deleted"));
441
+ const title = computed(() => {
442
+ if (single.value) return props.collection.label;
443
+ const value = titleField.value ? draft.value.data[titleField.value.name] : undefined;
444
+ return String(value) === value && value.trim() ? value : creating.value ? `New ${noun.value.toLowerCase()}` : props.documentId!;
445
+ });
446
+ // The stored file name, such as `hello.md` or `settings.json`, for history and conflict comparisons.
447
+ const fileExtension = computed(() => /\.[\w-]+$/.exec(props.collection.path)?.[0] ?? ".md");
448
+ const fileName = computed(() => base.value?.path.split("/").pop() ?? `${id.value}${fileExtension.value}`);
449
+ const errorCount = computed(() => Object.values(fieldErrors.value).reduce((count, messages) => count + messages.length, 0));
450
+ const idError = computed(() => (creating.value && newId.value && !isConsoleDocumentId(newId.value.trim()) ? "Id can use letters, numbers, dashes, and slashes, such as hello-world or 2026/launch." : fieldErrors.value[""]?.join(" ")));
451
+ /**
452
+ * Drafts save on their own once they exist. A new document waits for Create, since its id names the file. A singleton
453
+ * has a fixed file, so its first edit creates it.
454
+ */
455
+ const autosaves = computed(() => !liveActive.value && !local.value && canWrite.value && !creating.value && (Boolean(base.value) || (single.value && state.value !== "deleted")) && !conflict.value && !publishing.value && !restoring.value && session.mayWrite.value);
456
+ const sourceParts = computed(() => (storedFile.value === undefined ? undefined : splitConsoleFrontmatter(storedFile.value)));
457
+
458
+ // "Saving…" shows only when a save takes longer than 200ms, then stays at least 400ms, so fast saves do not flicker.
459
+ const savingVisible = ref(false);
460
+ let savingShowTimer: ReturnType<typeof setTimeout> | undefined;
461
+ let savingHideTimer: ReturnType<typeof setTimeout> | undefined;
462
+ let savingShownAt = 0;
463
+ watch(saving, (value) => {
464
+ clearTimeout(savingShowTimer);
465
+ clearTimeout(savingHideTimer);
466
+ if (value) {
467
+ savingShowTimer = setTimeout(() => {
468
+ savingVisible.value = true;
469
+ savingShownAt = Date.now();
470
+ }, 200);
471
+ return;
472
+ }
473
+ if (savingVisible.value) savingHideTimer = setTimeout(() => (savingVisible.value = false), Math.max(0, 400 - (Date.now() - savingShownAt)));
474
+ });
475
+
476
+ type HeaderAction = "conflict" | "fields" | "retry" | "site";
477
+ /**
478
+ * One status for the header. Problems come first and each one is a button that leads to the fix. Pending edits keep
479
+ * the last save time: they save within a second, so the header does not flicker while someone types.
480
+ */
481
+ const headerStatus = computed<{ action?: HeaderAction, label: string, pending?: boolean, savedAt?: string, tone: "error" | "neutral" | "success" | "warning" } | undefined>(() => {
482
+ if (publishing.value) return { label: "Publishing…", pending: true, tone: "neutral" };
483
+ if (applyingLocal.value) return { label: "Applying…", pending: true, tone: "neutral" };
484
+ if (savingVisible.value) return { label: "Saving…", pending: true, tone: "neutral" };
485
+ if (local.value) return { label: localChanged.value ? "Local edits · not saved" : "Local only", tone: localChanged.value ? "warning" : "neutral" };
486
+ if (liveActive.value && live) {
487
+ if (live.saveStatus.value?.error) return { action: "retry", label: "Not saved · retry", tone: "error" };
488
+ if (errorCount.value) return { action: "fields", label: `${errorCount.value === 1 ? "1 field needs" : `${errorCount.value} fields need`} attention`, tone: "error" };
489
+ if (base.value?.conflict) return { action: "site", label: "Changed on the site too", tone: "warning" };
490
+ if (!state.value) return undefined;
491
+ return { label: consoleDocumentStateLabel(state.value), savedAt: live.saveStatus.value?.savedAt ?? savedAt.value ?? base.value?.updatedAt ?? undefined, tone: consoleDocumentStateColor(state.value) };
492
+ }
493
+ if (conflict.value) return { action: "conflict", label: "Not saved · newer version", tone: "error" };
494
+ if (errorCount.value) return { action: "fields", label: `${errorCount.value === 1 ? "1 field needs" : `${errorCount.value} fields need`} attention`, tone: "error" };
495
+ if (saveError.value && dirty.value) return { action: "retry", label: "Not saved · retry", tone: "error" };
496
+ if (base.value?.conflict) return { action: "site", label: "Changed on the site too", tone: "warning" };
497
+ if (creating.value) return dirty.value ? { label: "Not created yet", tone: "neutral" } : undefined;
498
+ if (!state.value) return single.value && !base.value && !loading.value ? { label: "Not saved yet", tone: "neutral" } : undefined;
499
+ const label = dirty.value && !autosaves.value ? "Unsaved" : consoleDocumentStateLabel(state.value);
500
+ return { label, savedAt: savedAt.value ?? base.value?.updatedAt ?? undefined, tone: dirty.value && !autosaves.value ? "warning" : consoleDocumentStateColor(state.value) };
501
+ });
502
+
503
+ function notifyChanged(): void {
504
+ ownChanges++;
505
+ emit("changed");
506
+ }
507
+
508
+ function updateSeo(value: Record<string, unknown> | undefined): void {
509
+ if (!seoField.value) return;
510
+ const data = { ...draft.value.data };
511
+ if (value === undefined) delete data[seoField.value.name];
512
+ else data[seoField.value.name] = value;
513
+ draft.value = { ...draft.value, data };
514
+ }
515
+
516
+ function compact(data: Record<string, unknown>): Record<string, unknown> {
517
+ return compactConsoleFieldValues(fields.value, data);
518
+ }
519
+
520
+ function clone<T>(value: T): T {
521
+ return JSON.parse(JSON.stringify(value));
522
+ }
523
+
524
+ /** Back leads to the parent page, or to the collection list. A singleton has no list. */
525
+ const back = computed(() => props.parent ?? (single.value ? undefined : { label: props.collection.label, to: listRoute() }));
526
+
527
+ function listRoute() {
528
+ return { name: route.name ?? undefined, params: { collection: props.collection.name, document: [] }, query: consoleListQueryFor(props.collection.name) };
529
+ }
530
+
531
+ function documentRoute(documentId: string) {
532
+ return { name: route.name ?? undefined, params: { collection: props.collection.name, document: documentId.split("/") }, query: {} };
533
+ }
534
+
535
+ /** Digests this editor already showed. A presence answer that crossed a save names an older one and is ignored. */
536
+ const seenDigests = new Set<string>();
537
+
538
+ function accept(document: ConsoleDocument): void {
539
+ seenDigests.add(document.digest);
540
+ base.value = document;
541
+ state.value = document.state;
542
+ schedule.value = document.schedule;
543
+ draft.value = { body: document.body, data: clone(document.data) };
544
+ showSavedIssues(document);
545
+ }
546
+
547
+ /**
548
+ * A draft saved in progress comes back with its field issues. They show inline like any other issue, autosave keeps
549
+ * going, and Publish waits until they are fixed.
550
+ */
551
+ function showSavedIssues(document: ConsoleDocument): void {
552
+ if (!document.issues?.length) {
553
+ fieldErrors.value = {};
554
+ return;
555
+ }
556
+ fieldErrors.value = groupConsoleFieldIssues(humanizeConsoleFieldIssues(fields.value, document.issues));
557
+ errorSnapshot = Object.fromEntries(Object.entries(document.data).map(([name, value]) => [name, stableConsoleJSON(value ?? null)]));
558
+ errorBody = document.body;
559
+ }
560
+
561
+ async function load(): Promise<void> {
562
+ if (creating.value) return;
563
+ loading.value = true;
564
+ loadError.value = undefined;
565
+ try {
566
+ const document = await props.client.get(props.collection.name, props.documentId!);
567
+ // In a live room the fields and body come from the room, and local-only edits stay on screen. Only the stored
568
+ // version and its state come from here.
569
+ if (document && (liveActive.value || local.value)) {
570
+ takeState(document);
571
+ return;
572
+ }
573
+ // Someone typed while the document loaded: keep their edits and the version they started from.
574
+ if (document && base.value && dirty.value) return;
575
+ if (document) accept(document);
576
+ else {
577
+ base.value = null;
578
+ // Local-only edits stay on screen and in storage when the shared draft is gone, such as a deleted singleton.
579
+ if (single.value && !local.value) draft.value = { body: "", data: consoleSchemaDefaults(props.collection.schema) };
580
+ // A document removed from the draft is still listed as deleted while it stays published.
581
+ const listed = await props.client.list(props.collection.name, { filter: { id: props.documentId! }, limit: 1, state: "deleted" });
582
+ state.value = listed.items[0]?.state;
583
+ schedule.value = listed.items[0]?.schedule;
584
+ }
585
+ loadError.value = undefined;
586
+ }
587
+ catch (error) {
588
+ loadError.value = error;
589
+ }
590
+ finally {
591
+ loading.value = false;
592
+ }
593
+ }
594
+
595
+ /** The stored version, its state, and its schedule, without the fields and body on screen. */
596
+ function takeState(document: ConsoleDocument): void {
597
+ seenDigests.add(document.digest);
598
+ base.value = document;
599
+ state.value = document.state;
600
+ schedule.value = document.schedule;
601
+ }
602
+
603
+ /**
604
+ * Reads the shared draft again under local-only edits, such as after someone saved or deleted it. Unlike `load()`, it
605
+ * keeps the editor mounted, so the keystrokes that the body editor has not written yet stay.
606
+ */
607
+ async function refreshShared(): Promise<void> {
608
+ if (creating.value || props.documentId === undefined) return;
609
+ try {
610
+ const document = await props.client.get(props.collection.name, props.documentId);
611
+ if (!local.value) return;
612
+ if (document) takeState(document);
613
+ else base.value = null;
614
+ }
615
+ catch {
616
+ // The next presence answer tries again.
617
+ }
618
+ }
619
+
620
+ /** Reads the stored version again after a room save, so Publish names the digest the room saved. */
621
+ async function refreshState(): Promise<void> {
622
+ if (creating.value) return;
623
+ try {
624
+ const document = await props.client.get(props.collection.name, props.documentId!);
625
+ if (document) takeState(document);
626
+ }
627
+ catch {
628
+ // The next room save tries again.
629
+ }
630
+ }
631
+
632
+ /** The draft digest that the last room save of this tab stored. A read after it can already show a newer draft. */
633
+ let roomSaved: string | null = null;
634
+
635
+ /** Saves the live room now, such as for ⌘S or before Publish. Resolves whether the stored version is current. */
636
+ async function saveLive(): Promise<boolean> {
637
+ if (!live) return false;
638
+ saving.value = true;
639
+ saveError.value = undefined;
640
+ try {
641
+ roomSaved = await live.save();
642
+ await refreshState();
643
+ return true;
644
+ }
645
+ catch (error) {
646
+ saveError.value = consoleErrorMessage(error, "The request failed.");
647
+ toast.error("Couldn't save. Try again.", { label: "Retry", onClick: () => void saveLive() });
648
+ return false;
649
+ }
650
+ finally {
651
+ saving.value = false;
652
+ }
653
+ }
654
+
655
+ /** Focuses the first invalid field, in page order. */
656
+ async function focusFirstInvalid(): Promise<void> {
657
+ await nextTick();
658
+ const target = document.querySelector<HTMLElement>(".vitehub-document-editor [aria-invalid='true']");
659
+ target?.focus({ preventScroll: true });
660
+ target?.scrollIntoView({ block: "center", behavior: "instant" });
661
+ }
662
+
663
+ // Each field keeps its server issue until someone changes that field.
664
+ let errorSnapshot: Record<string, string> = {};
665
+ /** The body when the owner validators last rejected the draft. Autosave retries once the body or a field changes. */
666
+ let errorBody = "";
667
+ watch(newId, (value) => {
668
+ if (fieldErrors.value[""] && isConsoleDocumentId(value.trim())) {
669
+ const next = { ...fieldErrors.value };
670
+ delete next[""];
671
+ fieldErrors.value = next;
672
+ }
673
+ });
674
+ watch(() => draft.value.data, (data) => {
675
+ if (!errorCount.value) return;
676
+ const next = Object.fromEntries(Object.entries(fieldErrors.value).filter(([path]) => {
677
+ const name = path.split(".")[0] ?? "";
678
+ return !name || stableConsoleJSON(data[name] ?? null) === errorSnapshot[name];
679
+ }));
680
+ if (Object.keys(next).length !== Object.keys(fieldErrors.value).length) fieldErrors.value = next;
681
+ }, { deep: true });
682
+
683
+ /**
684
+ * Saves the draft. An autosave never moves focus or opens a dialog: invalid fields and conflicts show in the header
685
+ * and inline, and saving pauses until the next edit or until someone resolves the conflict.
686
+ */
687
+ async function save(options: { auto?: boolean, ifDigest?: string | null } = {}): Promise<void> {
688
+ if (!canWrite.value) return;
689
+ if (liveActive.value) {
690
+ await saveLive();
691
+ return;
692
+ }
693
+ // ⌘S during a save, such as an autosave in flight, saves again right after it.
694
+ if (saving.value) {
695
+ if (!options.auto) saveQueued = true;
696
+ return;
697
+ }
698
+ clearTimeout(autosaveTimer);
699
+ await bodyEditor.value?.commit();
700
+ if (creating.value && !isConsoleDocumentId(id.value)) {
701
+ fieldErrors.value = { "": [id.value ? "Id can use letters, numbers, dashes, and slashes." : "Id is required."] };
702
+ errorSnapshot = {};
703
+ await focusFirstInvalid();
704
+ return;
705
+ }
706
+ // The first save of this tab waits for the lease. A refused claim opens the dialog and keeps the edits on screen.
707
+ if (!creating.value && !session.mayWrite.value && !(await session.claim())) return;
708
+ saving.value = true;
709
+ const failedBefore = Boolean(saveError.value);
710
+ saveError.value = undefined;
711
+ const sent: Version = { body: draft.value.body, data: compact(draft.value.data) };
712
+ try {
713
+ const saved = await props.client.save(props.collection.name, id.value, {
714
+ ...sent,
715
+ ifDigest: options.ifDigest !== undefined ? options.ifDigest : base.value?.digest ?? null,
716
+ session: consoleTabSession,
717
+ });
718
+ refusedEdits.value = 0;
719
+ conflict.value = undefined;
720
+ conflictOpen.value = false;
721
+ // Keep edits made while the save was running.
722
+ const editedDuringSave = draft.value.body !== sent.body || stableConsoleJSON(compact(draft.value.data)) !== stableConsoleJSON(sent.data);
723
+ seenDigests.add(saved.digest);
724
+ base.value = saved;
725
+ state.value = saved.state;
726
+ if (!editedDuringSave) draft.value = { body: saved.body === sent.body ? draft.value.body : saved.body, data: clone(saved.data) };
727
+ showSavedIssues(saved);
728
+ savedAt.value = new Date().toISOString();
729
+ notifyChanged();
730
+ // A pending schedule publishes the draft it reviewed. This save moved the draft, so that run will publish nothing.
731
+ if (schedule.value?.status === "pending" && scheduleWarned !== schedule.value.id) {
732
+ scheduleWarned = schedule.value.id;
733
+ toast.show({ title: "Draft changed after scheduling. Cancel the schedule and schedule again to publish this version." });
734
+ }
735
+ // The saved document opens at its own route. The history state tells the new editor when it saved.
736
+ if (creating.value) await router.replace({ ...documentRoute(saved.id), state: { vitehubDocumentSavedAt: savedAt.value } });
737
+ if (revisions.value.length || historyOpen.value || panel.value === "history") void loadRevisions();
738
+ if (mode.value === "source") void loadStoredFile();
739
+ }
740
+ catch (error) {
741
+ const issues = consoleFieldIssues(error);
742
+ if (consoleLeaseHolder(error)) {
743
+ // Another tab took the lease. The banner says who, keeps the edits, and offers Copy and Take back.
744
+ refusedEdits.value++;
745
+ await session.refresh();
746
+ if (leaseMode.value === "free" || leaseMode.value === "editing") leaseMode.value = "taken";
747
+ }
748
+ else if (issues) {
749
+ fieldErrors.value = groupConsoleFieldIssues(humanizeConsoleFieldIssues(fields.value, issues));
750
+ errorSnapshot = Object.fromEntries(Object.entries(draft.value.data).map(([name, value]) => [name, stableConsoleJSON(value ?? null)]));
751
+ errorBody = sent.body;
752
+ if (!options.auto) await focusFirstInvalid();
753
+ }
754
+ else if (isConsoleConflict(error)) {
755
+ const theirs = await props.client.get(props.collection.name, id.value).catch(() => null);
756
+ conflict.value = { mine: sent, theirs };
757
+ const compare = () => {
758
+ conflictOpen.value = true;
759
+ };
760
+ if (options.auto) toast.error("Someone saved a newer version. Saving is paused.", { label: "Compare", onClick: compare });
761
+ else compare();
762
+ }
763
+ else {
764
+ saveError.value = consoleErrorMessage(error, "The request failed.");
765
+ // One toast per failure streak, so an autosave that keeps failing does not stack toasts.
766
+ if (!options.auto || !failedBefore) toast.error("Couldn't save. Try again.", { label: "Retry", onClick: () => save() });
767
+ }
768
+ }
769
+ finally {
770
+ saving.value = false;
771
+ }
772
+ if (saveQueued) {
773
+ saveQueued = false;
774
+ if (dirty.value) return await save();
775
+ }
776
+ // Edits made during the save, or a failed autosave that someone edited past, save on the next pause.
777
+ if (dirty.value && !saveError.value) scheduleAutosave();
778
+ }
779
+
780
+ /** The draft digest of each presence answer. A clean page reloads what another tab saved; a dirty one keeps the conflict flow. */
781
+ function onRemoteDigest(digest: string | null): void {
782
+ // A live room reloads its people itself.
783
+ if (liveActive.value) return;
784
+ // Local-only edits stay on screen. The stored version updates, so Apply knows the shared draft moved or is gone.
785
+ if (local.value) {
786
+ if (!loading.value && (base.value?.digest ?? null) !== digest) void refreshShared();
787
+ return;
788
+ }
789
+ if (creating.value || loading.value || saving.value || publishing.value || restoring.value || dirty.value) return;
790
+ if ((base.value?.digest ?? null) === digest) return;
791
+ if (!base.value && digest === null) return;
792
+ if (digest !== null && seenDigests.has(digest)) return;
793
+ const viewing = leaseMode.value === "free";
794
+ const before = base.value?.digest;
795
+ void load().then(() => {
796
+ if (base.value?.digest === before) return;
797
+ notifyChanged();
798
+ if (viewing && !dirty.value) toast.show({ title: `This ${single.value ? "page" : noun.value.toLowerCase()} was updated` });
799
+ });
800
+ }
801
+
802
+ /** Read-only from the dialog: edits typed before the claim answered are dropped. */
803
+ function openReadOnly(): void {
804
+ session.readOnly();
805
+ if (dirty.value && !creating.value) draft.value = { body: savedVersion.value.body, data: clone(savedVersion.value.data) };
806
+ }
807
+
808
+ /** Takes the lease from its holder, then saves edits that waited for it. */
809
+ async function takeOver(): Promise<void> {
810
+ if (!(await session.takeover())) {
811
+ toast.error("Couldn't take over. Try again.");
812
+ return;
813
+ }
814
+ refusedEdits.value = 0;
815
+ if (dirty.value) await save();
816
+ }
817
+
818
+ /** Joins the live room that holds the lease, after this tab could not reach it before. */
819
+ function joinLive(): void {
820
+ leaseDialogOpen.value = false;
821
+ session.resume();
822
+ liveFallback.value = undefined;
823
+ }
824
+
825
+ /** After the holder left: read their last save, then edit on the next keystroke. */
826
+ async function reloadAndEdit(): Promise<void> {
827
+ session.resume();
828
+ await load();
829
+ }
830
+
831
+ /** Compares the version the other tab saved with the one on screen. */
832
+ async function compareWithHolder(): Promise<void> {
833
+ const theirs = await props.client.get(props.collection.name, id.value).catch(() => null);
834
+ leaseCompare.value = { mine: { body: draft.value.body, data: compact(draft.value.data) }, theirs };
835
+ leaseCompareOpen.value = true;
836
+ }
837
+
838
+ /** Copies the edits another tab refused, so nothing typed is lost. */
839
+ async function copyUnsaved(): Promise<void> {
840
+ const text = hasBody.value ? draft.value.body : JSON.stringify(compact(draft.value.data), null, 2);
841
+ try {
842
+ await navigator.clipboard.writeText(text);
843
+ toast.show({ title: "Your edits copied" });
844
+ }
845
+ catch {
846
+ toast.error("Couldn't copy. Select the text and copy it.");
847
+ }
848
+ }
849
+
850
+ /** Copies the local edits as the stored file would hold them: the fields as JSON, then the body. */
851
+ async function copyLocal(): Promise<void> {
852
+ const data = JSON.stringify(compact(draft.value.data), null, 2);
853
+ try {
854
+ await navigator.clipboard.writeText(hasBody.value ? `${data}\n\n${draft.value.body}` : data);
855
+ toast.show({ title: "Your local edits copied" });
856
+ }
857
+ catch {
858
+ toast.error("Couldn't copy. Select the text and copy it.");
859
+ }
860
+ }
861
+
862
+ /** Resolves once no save is running, such as an autosave that started just before a publish. */
863
+ function settled(): Promise<void> {
864
+ if (!saving.value) return Promise.resolve();
865
+ return new Promise(resolve => {
866
+ const stop = watch(saving, (value) => {
867
+ if (value) return;
868
+ stop();
869
+ resolve();
870
+ });
871
+ });
872
+ }
873
+
874
+ function scheduleAutosave(): void {
875
+ clearTimeout(autosaveTimer);
876
+ if (!autosaves.value) return;
877
+ autosaveTimer = setTimeout(() => {
878
+ if (!dirty.value || !autosaves.value) return;
879
+ // A field the owner validators rejected stays rejected until someone changes it.
880
+ if (errorCount.value && !dataChangedSinceErrors()) return;
881
+ void save({ auto: true });
882
+ }, autosaveDelay);
883
+ }
884
+
885
+ function dataChangedSinceErrors(): boolean {
886
+ return Object.entries(errorSnapshot).some(([name, value]) => stableConsoleJSON(draft.value.data[name] ?? null) !== value) || draft.value.body !== errorBody;
887
+ }
888
+
889
+ watch(draft, () => {
890
+ if (local.value) {
891
+ keepLocal();
892
+ return;
893
+ }
894
+ if (liveActive.value) {
895
+ live?.writeFields(compact(draft.value.data));
896
+ return;
897
+ }
898
+ if (!dirty.value) return;
899
+ if (!creating.value) {
900
+ session.input();
901
+ // The first edit claims the lease. Keystrokes stay on screen while the claim answers.
902
+ if (!session.mayWrite.value && leaseMode.value === "free") void session.claim().then((held) => {
903
+ if (held) scheduleAutosave();
904
+ });
905
+ }
906
+ scheduleAutosave();
907
+ }, { deep: true });
908
+
909
+ function keepMine(): void {
910
+ if (!conflict.value) return;
911
+ const theirs = conflict.value.theirs;
912
+ // Overwrite only the version just compared. Another save in the meantime conflicts again.
913
+ void save({ ifDigest: theirs?.digest ?? null });
914
+ }
915
+
916
+ function useTheirs(): void {
917
+ if (!conflict.value) return;
918
+ const theirs = conflict.value.theirs;
919
+ conflict.value = undefined;
920
+ conflictOpen.value = false;
921
+ if (theirs) accept(theirs);
922
+ else void load();
923
+ }
924
+
925
+ /**
926
+ * Publishes the draft on screen. Pending edits save first, and the publish names the digest of that save, so a save
927
+ * from someone else in between fails the publish instead of publishing their draft unseen.
928
+ */
929
+ async function publish(): Promise<void> {
930
+ if (!canPublish.value || publishing.value || errorCount.value) return;
931
+ // Local-only edits are not part of a publish. The person reviews the shared draft that would go live instead.
932
+ if (local.value) {
933
+ await openSharedPublish();
934
+ return;
935
+ }
936
+ // The site changed after this draft started from it. Publishing would erase that change, so compare first.
937
+ if (base.value?.conflict) {
938
+ await openSiteConflict();
939
+ return;
940
+ }
941
+ clearTimeout(autosaveTimer);
942
+ await bodyEditor.value?.commit();
943
+ await settled();
944
+ // Publish exactly what the room holds now: save it, then name that digest.
945
+ if (liveActive.value && !(await saveLive())) return;
946
+ if (liveActive.value && errorCount.value) return;
947
+ if (dirty.value) {
948
+ await save();
949
+ if (dirty.value || conflict.value || errorCount.value || saveError.value) return;
950
+ }
951
+ const before = state.value;
952
+ const removing = deleted.value;
953
+ publishing.value = true;
954
+ if (!removing) state.value = "published";
955
+ try {
956
+ // Publish exactly the draft on screen. A deleted document has no draft to expect.
957
+ const result = await props.client.publish(props.collection.name, [{ digest: base.value?.digest ?? null, id: id.value }]);
958
+ const pullRequest = result.pullRequest;
959
+ if (result.documents.length && pullRequest) toast.show({ action: { label: "Open pull request", onClick: () => void window.open(pullRequest.url, "_blank", "noopener") }, title: `Pull request #${pullRequest.number} opened. The changes go live when it merges.` });
960
+ else if (result.documents.length) toast.show({ title: removing ? `${noun.value} removed from the site` : "Changes published" });
961
+ notifyChanged();
962
+ previewReloads.value++;
963
+ if (removing) await router.replace(listRoute());
964
+ // Edits made while publishing stay on screen and save as the next draft.
965
+ else if (!dirty.value) await load();
966
+ }
967
+ catch (error) {
968
+ state.value = before;
969
+ const issues = consoleFieldIssues(error);
970
+ if (consolePublishedConflicts(error)) {
971
+ // The site changed after the draft started from it, for example in Git. Nothing was published.
972
+ await load();
973
+ await openSiteConflict();
974
+ }
975
+ else if (consolePublishMismatches(error)) {
976
+ // Someone saved after this editor loaded. Show their draft so it is reviewed before it is published.
977
+ await load();
978
+ toast.error("Someone saved a newer draft. Review it, then publish again.");
979
+ }
980
+ else if (issues) {
981
+ fieldErrors.value = groupConsoleFieldIssues(humanizeConsoleFieldIssues(fields.value, issues));
982
+ errorSnapshot = Object.fromEntries(Object.entries(draft.value.data).map(([name, value]) => [name, stableConsoleJSON(value ?? null)]));
983
+ errorBody = draft.value.body;
984
+ toast.error("This draft no longer validates. Fix it, then publish.");
985
+ await focusFirstInvalid();
986
+ }
987
+ else toast.error(`Couldn't publish. ${consoleErrorMessage(error, "Try again.")}`, { label: "Retry", onClick: publish });
988
+ }
989
+ finally {
990
+ publishing.value = false;
991
+ }
992
+ if (dirty.value) scheduleAutosave();
993
+ }
994
+
995
+ /** Keeps the local-only edits in this tab's session storage, so a reload keeps them. */
996
+ function keepLocal(): void {
997
+ if (!local.value || !localStart.value || props.documentId === undefined) return;
998
+ localStorageFailed.value = !writeConsoleLocalDraft(window.sessionStorage, props.collection.name, props.documentId, {
999
+ base: localBase.value,
1000
+ start: localStart.value,
1001
+ version: { body: draft.value.body, data: clone(draft.value.data) },
1002
+ });
1003
+ }
1004
+
1005
+ /**
1006
+ * Edits in this tab only. Shared edits on screen save first, so the local edits start from the stored shared draft and
1007
+ * Apply can tell when someone else saved after it.
1008
+ */
1009
+ async function startLocal(): Promise<void> {
1010
+ if (local.value || !canWrite.value || creating.value || !base.value) return;
1011
+ clearTimeout(autosaveTimer);
1012
+ await bodyEditor.value?.commit();
1013
+ await settled();
1014
+ const inRoom = liveActive.value;
1015
+ if (inRoom && !(await saveLive())) return;
1016
+ if (!inRoom && dirty.value) {
1017
+ await save();
1018
+ if (dirty.value || conflict.value || saveError.value) return;
1019
+ }
1020
+ // The local edits start from the version the room saved, fields and body, and name the digest the room save returned.
1021
+ // When someone saved or deleted the draft after the room save, the read shows their version under another digest:
1022
+ // Apply then compares instead of overwriting it. Typing after the room took its save stays on screen as a local edit:
1023
+ // the fields come from the room, the body from its editor.
1024
+ const saved = base.value;
1025
+ if (!saved) return;
1026
+ const savedDigest = inRoom ? roomSaved : saved.digest;
1027
+ const start: Version = inRoom ? { body: saved.body, data: clone(saved.data) } : { body: draft.value.body, data: clone(draft.value.data) };
1028
+ const onScreen: Version = { body: (inRoom ? await bodyEditor.value?.markdown() : undefined) ?? start.body, data: clone(draft.value.data) };
1029
+ localBase.value = savedDigest;
1030
+ localStart.value = clone(start);
1031
+ draft.value = onScreen;
1032
+ editing.value = "local";
1033
+ keepLocal();
1034
+ // Local edits need no lease: report as a viewer, so other people keep editing the shared draft.
1035
+ if (leaseMode.value === "editing") {
1036
+ session.resume();
1037
+ void session.refresh();
1038
+ }
1039
+ }
1040
+
1041
+ /** Back to Collaborative. Changed local edits, or the only copy of a deleted draft, ask before discarding. */
1042
+ async function requestShared(): Promise<void> {
1043
+ if (!local.value) return;
1044
+ await bodyEditor.value?.commit();
1045
+ if (localChanged.value || sharedGone.value) {
1046
+ localExitOpen.value = true;
1047
+ return;
1048
+ }
1049
+ void discardLocal();
1050
+ }
1051
+
1052
+ function setEditing(next: "shared" | "local"): void {
1053
+ if (next === "local") void startLocal();
1054
+ else void requestShared();
1055
+ }
1056
+
1057
+ function endLocal(): void {
1058
+ if (props.documentId !== undefined) clearConsoleLocalDraft(window.sessionStorage, props.collection.name, props.documentId);
1059
+ localExitOpen.value = false;
1060
+ localConflict.value = undefined;
1061
+ localStart.value = undefined;
1062
+ editing.value = "shared";
1063
+ session.resume();
1064
+ }
1065
+
1066
+ /** Drops the local edits and shows the shared draft again. */
1067
+ async function discardLocal(): Promise<void> {
1068
+ endLocal();
1069
+ base.value = null;
1070
+ await load();
1071
+ }
1072
+
1073
+ /**
1074
+ * Saves the local edits over the shared draft they started from. When someone saved the shared draft since, nothing is
1075
+ * saved and the comparison opens; `ifDigest` then names the newer draft that the person compared.
1076
+ */
1077
+ async function applyLocal(ifDigest: string | null = localBase.value): Promise<void> {
1078
+ if (!local.value || applyingLocal.value || props.documentId === undefined) return;
1079
+ await bodyEditor.value?.commit();
1080
+ // A live room holds the lease for everyone in it, so the save passes that lease; a single editor's lease still refuses it.
1081
+ const roomFor = Boolean(liveDefinition && hasBody.value && !liveFallback.value);
1082
+ // Apply asks for the lease even after this tab opened read-only or its holder left. The server still refuses it while
1083
+ // another tab edits, and the person then sees who and can apply again.
1084
+ if (!roomFor && !(await session.acquire())) {
1085
+ refuseLocal(() => void applyLocal(ifDigest));
1086
+ return;
1087
+ }
1088
+ applyingLocal.value = true;
1089
+ // Typing goes on during the request. Only this version is applied; later edits stay local and in session storage.
1090
+ const sent: Version = { body: draft.value.body, data: compact(draft.value.data) };
1091
+ try {
1092
+ const saved = await props.client.save(props.collection.name, props.documentId, {
1093
+ ...sent,
1094
+ ifDigest,
1095
+ session: consoleTabSession,
1096
+ ...(roomFor ? { live: true } : {}),
1097
+ });
1098
+ await bodyEditor.value?.commit();
1099
+ const editedDuringApply = draft.value.body !== sent.body || stableConsoleJSON(compact(draft.value.data)) !== stableConsoleJSON(sent.data);
1100
+ if (editedDuringApply) {
1101
+ // Stay in Local only, now on top of the saved shared draft, so the newer edits are neither lost nor shared.
1102
+ takeState(saved);
1103
+ showSavedIssues(saved);
1104
+ localExitOpen.value = false;
1105
+ localConflict.value = undefined;
1106
+ localBase.value = saved.digest;
1107
+ localStart.value = { body: saved.body, data: clone(saved.data) };
1108
+ keepLocal();
1109
+ }
1110
+ else {
1111
+ endLocal();
1112
+ accept(saved);
1113
+ }
1114
+ savedAt.value = new Date().toISOString();
1115
+ notifyChanged();
1116
+ toast.show({ title: editedDuringApply ? "Local edits saved to the shared draft. Edits made since stay local." : "Local edits saved to the shared draft" });
1117
+ if (revisions.value.length || historyOpen.value || panel.value === "history") void loadRevisions();
1118
+ }
1119
+ catch (error) {
1120
+ const issues = consoleFieldIssues(error);
1121
+ if (isConsoleConflict(error)) {
1122
+ localExitOpen.value = false;
1123
+ await readLocalConflict();
1124
+ }
1125
+ else if (issues) {
1126
+ fieldErrors.value = groupConsoleFieldIssues(humanizeConsoleFieldIssues(fields.value, issues));
1127
+ errorSnapshot = Object.fromEntries(Object.entries(draft.value.data).map(([name, value]) => [name, stableConsoleJSON(value ?? null)]));
1128
+ localExitOpen.value = false;
1129
+ await focusFirstInvalid();
1130
+ }
1131
+ else if (consoleLeaseHolder(error)) toast.error("Someone else is editing. Your local edits stay here. Try again when they stop.");
1132
+ else toast.error(`Couldn't apply. ${consoleErrorMessage(error, "Try again.")}`, { label: "Retry", onClick: () => void applyLocal(ifDigest) });
1133
+ }
1134
+ finally {
1135
+ applyingLocal.value = false;
1136
+ viewLocally();
1137
+ }
1138
+ }
1139
+
1140
+ /** Reads the shared draft that refused an Apply, to compare it with the local edits. The local edits and their base stay. */
1141
+ async function readLocalConflict(): Promise<void> {
1142
+ if (props.documentId === undefined) return;
1143
+ readingConflict.value = true;
1144
+ try {
1145
+ const theirs = await props.client.get(props.collection.name, props.documentId);
1146
+ if (local.value) localConflict.value = { theirs };
1147
+ }
1148
+ catch (error) {
1149
+ if (local.value) localConflict.value = { failed: consoleErrorMessage(error, "The request failed.") };
1150
+ }
1151
+ finally {
1152
+ readingConflict.value = false;
1153
+ }
1154
+ }
1155
+
1156
+ /** Says why a save from Local only did not run, and offers to try again. The local edits stay on screen and in storage. */
1157
+ function refuseLocal(retry: () => void): void {
1158
+ const holder = localLeaseHolder.value;
1159
+ toast.error(holder ? `${holder} Your local edits stay here. Try again when they stop.` : "Couldn't get the edit lock. Your local edits stay here.", { label: "Retry", onClick: retry });
1160
+ }
1161
+
1162
+ /** Local edits need no lease: after a save from Local only, this tab reports as a viewer again. */
1163
+ function viewLocally(): void {
1164
+ if (local.value && leaseMode.value === "editing") {
1165
+ session.resume();
1166
+ void session.refresh();
1167
+ }
1168
+ }
1169
+
1170
+ /** Loads the shared draft and the site version, so the person sees what Publish would put live. */
1171
+ async function openSharedPublish(): Promise<void> {
1172
+ if (props.documentId === undefined) return;
1173
+ sharedPublishOpen.value = true;
1174
+ sharedPublish.value = undefined;
1175
+ sharedPublishLoading.value = true;
1176
+ try {
1177
+ const [draftDocument, site] = await Promise.all([
1178
+ props.client.get(props.collection.name, props.documentId),
1179
+ props.client.get(props.collection.name, props.documentId, "published"),
1180
+ ]);
1181
+ sharedPublish.value = { draft: draftDocument, site };
1182
+ if (draftDocument) takeState(draftDocument);
1183
+ }
1184
+ catch (error) {
1185
+ sharedPublishOpen.value = false;
1186
+ toast.error(`Couldn't load the shared draft. ${consoleErrorMessage(error, "Try again.")}`);
1187
+ }
1188
+ finally {
1189
+ sharedPublishLoading.value = false;
1190
+ }
1191
+ }
1192
+
1193
+ /** Publishes exactly the shared draft that the dialog showed. The local edits stay in this tab. */
1194
+ async function publishShared(): Promise<void> {
1195
+ const reviewed = sharedPublish.value;
1196
+ if (!reviewed?.draft || publishing.value || props.documentId === undefined) return;
1197
+ if (reviewed.draft.conflict) {
1198
+ sharedPublishOpen.value = false;
1199
+ await openSiteConflict(reviewed.draft);
1200
+ return;
1201
+ }
1202
+ publishing.value = true;
1203
+ try {
1204
+ const result = await props.client.publish(props.collection.name, [{ digest: reviewed.draft.digest, id: props.documentId }]);
1205
+ sharedPublishOpen.value = false;
1206
+ // With `publish: "pr"` the store opens a pull request: nothing is live until it merges.
1207
+ const pullRequest = result.pullRequest;
1208
+ if (pullRequest) toast.show({ action: { label: "Open pull request", onClick: () => void window.open(pullRequest.url, "_blank", "noopener") }, title: `Pull request #${pullRequest.number} opened. The shared draft goes live when it merges. Your local edits are still here.` });
1209
+ else toast.show({ title: "Shared draft published. Your local edits are still here." });
1210
+ notifyChanged();
1211
+ previewReloads.value++;
1212
+ await refreshShared();
1213
+ }
1214
+ catch (error) {
1215
+ if (consolePublishMismatches(error) || consolePublishedConflicts(error)) {
1216
+ toast.error("The shared draft changed while you reviewed it. Review it again.");
1217
+ await openSharedPublish();
1218
+ }
1219
+ else if (consoleFieldIssues(error)) toast.error("The shared draft has invalid fields. Fix them in Collaborative, then publish.");
1220
+ else toast.error(`Couldn't publish. ${consoleErrorMessage(error, "Try again.")}`);
1221
+ }
1222
+ finally {
1223
+ publishing.value = false;
1224
+ }
1225
+ }
1226
+
1227
+ const scheduleAt = computed(() => (scheduleDate.value ? consoleLocalScheduleTime(scheduleDate.value.toString(), scheduleTime.value.toString()) : undefined));
1228
+ const scheduleInPast = computed(() => scheduleAt.value !== undefined && Date.parse(scheduleAt.value) <= Date.now());
1229
+ const scheduleMinDate = computed(() => today(timeZone));
1230
+ const scheduleHint = computed(() => (schedule.value ? consoleDocumentScheduleHint(schedule.value, props.setup) : ""));
1231
+ // Schedule… is off when nothing would run the schedule; the menu names the fix and links to its docs.
1232
+ const publishMenu = computed(() => {
1233
+ const runner = props.setup?.schedule;
1234
+ const scheduleItem = {
1235
+ label: "Schedule…",
1236
+ icon: "i-lucide-calendar-clock",
1237
+ disabled: Boolean(runner) || Boolean(schedule.value && schedule.value.status !== "failed"),
1238
+ ...(runner ? { description: consoleHintText(runner.message) } : {}),
1239
+ onSelect: openSchedule,
1240
+ };
1241
+ return runner?.docs
1242
+ ? [[scheduleItem], [{ label: "Set up scheduling", icon: "i-lucide-book-open", to: runner.docs, target: "_blank" }]]
1243
+ : [[scheduleItem]];
1244
+ });
1245
+ // Warn once per schedule when an edit makes the scheduled publish fail.
1246
+ let scheduleWarned: string | undefined;
1247
+
1248
+ /** Saves pending edits first, like Publish, so the schedule covers exactly the draft on screen. */
1249
+ async function openSchedule(): Promise<void> {
1250
+ if (props.setup?.schedule) return;
1251
+ clearTimeout(autosaveTimer);
1252
+ await bodyEditor.value?.commit();
1253
+ await settled();
1254
+ if (liveActive.value && !(await saveLive())) return;
1255
+ if (dirty.value) {
1256
+ await save();
1257
+ if (dirty.value || conflict.value || errorCount.value || saveError.value) return;
1258
+ }
1259
+ // Default to tomorrow at the last chosen time, in the browser time zone.
1260
+ scheduleDate.value = today(timeZone).add({ days: 1 });
1261
+ scheduleOpen.value = true;
1262
+ }
1263
+
1264
+ /** Schedules exactly the draft on screen, like `publish`, for a later time. */
1265
+ async function scheduleDraft(): Promise<void> {
1266
+ if (!canPublish.value || dirty.value || scheduling.value || !scheduleAt.value || scheduleInPast.value) return;
1267
+ scheduling.value = true;
1268
+ try {
1269
+ const scheduled = await props.client.schedule(props.collection.name, scheduleAt.value, [{ digest: base.value?.digest ?? null, id: id.value }]);
1270
+ schedule.value = { at: scheduled.at, id: scheduled.id, status: scheduled.status };
1271
+ scheduleOpen.value = false;
1272
+ toast.show({ title: consoleDocumentScheduleLabel(scheduled) });
1273
+ notifyChanged();
1274
+ }
1275
+ catch (error) {
1276
+ scheduleOpen.value = false;
1277
+ if (consolePublishMismatches(error)) {
1278
+ await load();
1279
+ toast.error("Someone saved a newer draft. Review it, then schedule again.");
1280
+ }
1281
+ else toast.error(`Couldn't schedule. ${consoleErrorMessage(error, "Try again.")}`);
1282
+ }
1283
+ finally {
1284
+ scheduling.value = false;
1285
+ }
1286
+ }
1287
+
1288
+ async function unscheduleDraft(): Promise<void> {
1289
+ if (!schedule.value) return;
1290
+ const failed = schedule.value.status === "failed";
1291
+ try {
1292
+ await props.client.unschedule(props.collection.name, schedule.value.id);
1293
+ schedule.value = undefined;
1294
+ toast.show({ title: failed ? "Failed schedule dismissed" : "Schedule cancelled" });
1295
+ notifyChanged();
1296
+ }
1297
+ catch (error) {
1298
+ toast.error(`Couldn't cancel the schedule. ${consoleErrorMessage(error, "Try again.")}`);
1299
+ void load();
1300
+ }
1301
+ }
1302
+
1303
+ async function remove(): Promise<void> {
1304
+ clearTimeout(autosaveTimer);
1305
+ await settled();
1306
+ if (!base.value) return;
1307
+ if (!(await session.claim())) {
1308
+ deleteOpen.value = false;
1309
+ return;
1310
+ }
1311
+ // In a live room, delete what the room saved last; the room then reloads it as deleted.
1312
+ const inRoom = liveActive.value;
1313
+ if (inRoom && !(await saveLive())) return;
1314
+ const removed = { id: id.value, revision: base.value.revision };
1315
+ const { client, collection } = props;
1316
+ deleting.value = true;
1317
+ try {
1318
+ if (inRoom) ownResetUntil = Date.now() + 10_000;
1319
+ await client.remove(collection.name, removed.id, base.value.digest, consoleTabSession, inRoom);
1320
+ deleteOpen.value = false;
1321
+ base.value = null;
1322
+ notifyChanged();
1323
+ await router.replace(listRoute());
1324
+ // Undo puts the saved version back and opens it again.
1325
+ toast.show({
1326
+ action: {
1327
+ label: "Undo",
1328
+ onClick: async () => {
1329
+ try {
1330
+ await client.restore(collection.name, removed.id, removed.revision, null);
1331
+ await router.push(documentRoute(removed.id));
1332
+ }
1333
+ catch {
1334
+ toast.error(`Couldn't restore the ${noun.value.toLowerCase()}. Try again from History.`);
1335
+ }
1336
+ },
1337
+ },
1338
+ title: `${noun.value} deleted`,
1339
+ });
1340
+ }
1341
+ catch (error) {
1342
+ deleteOpen.value = false;
1343
+ toast.error(isConsoleConflict(error) ? `This ${noun.value.toLowerCase()} changed since you opened it. Reload, then delete it.` : "Couldn't delete. Try again.");
1344
+ }
1345
+ finally {
1346
+ deleting.value = false;
1347
+ }
1348
+ }
1349
+
1350
+ async function loadRevisions(more = false): Promise<void> {
1351
+ if (creating.value) return;
1352
+ revisionsLoading.value = true;
1353
+ try {
1354
+ const result = await props.client.revisions(props.collection.name, id.value, more ? revisionsCursor.value : undefined);
1355
+ revisions.value = more ? [...revisions.value, ...result.revisions] : result.revisions;
1356
+ revisionsCursor.value = result.cursor;
1357
+ revisionsLoadedAt.value = Date.now();
1358
+ revisionsError.value = undefined;
1359
+ }
1360
+ catch (error) {
1361
+ revisionsError.value = error;
1362
+ }
1363
+ finally {
1364
+ revisionsLoading.value = false;
1365
+ }
1366
+ }
1367
+
1368
+ async function openRevision(revision: ConsoleDocumentRevision): Promise<void> {
1369
+ historyOpen.value = true;
1370
+ previewLoading.value = true;
1371
+ preview.value = { current: null, document: null, revision };
1372
+ try {
1373
+ const [document, current] = await Promise.all([
1374
+ props.client.raw(props.collection.name, id.value, revision.id),
1375
+ props.client.raw(props.collection.name, id.value),
1376
+ ]);
1377
+ preview.value = { current, document, revision };
1378
+ }
1379
+ catch {
1380
+ toast.error("Couldn't open this version. Try again.");
1381
+ preview.value = undefined;
1382
+ }
1383
+ finally {
1384
+ previewLoading.value = false;
1385
+ }
1386
+ }
1387
+
1388
+ /**
1389
+ * Restores the previewed version without asking first: the toast offers Undo, which puts back the saved version and
1390
+ * any unsaved edits from before the restore.
1391
+ */
1392
+ async function restore(): Promise<void> {
1393
+ if (!preview.value?.document) return;
1394
+ if (!(await session.claim())) return;
1395
+ clearTimeout(autosaveTimer);
1396
+ await bodyEditor.value?.commit();
1397
+ await settled();
1398
+ // In a live room, restore over what the room saved last. Everyone in the room then reloads the restored version.
1399
+ const inRoom = liveActive.value;
1400
+ if (inRoom && !(await saveLive())) return;
1401
+ const before = { document: base.value, unsaved: dirty.value ? clone(draft.value) : undefined };
1402
+ const { client, collection } = props;
1403
+ const documentId = id.value;
1404
+ restoring.value = true;
1405
+ try {
1406
+ if (inRoom) ownResetUntil = Date.now() + 10_000;
1407
+ const restored = await client.restore(collection.name, documentId, preview.value.revision.id, base.value?.digest ?? null, consoleTabSession, inRoom);
1408
+ if (inRoom) takeState(restored);
1409
+ else accept(restored);
1410
+ savedAt.value = new Date().toISOString();
1411
+ preview.value = undefined;
1412
+ historyOpen.value = false;
1413
+ notifyChanged();
1414
+ void loadRevisions();
1415
+ toast.show({
1416
+ action: {
1417
+ label: "Undo",
1418
+ onClick: async () => {
1419
+ try {
1420
+ const current = mounted ? base.value?.digest ?? restored.digest : restored.digest;
1421
+ if (inRoom) ownResetUntil = Date.now() + 10_000;
1422
+ if (before.document) {
1423
+ const reverted = await client.restore(collection.name, documentId, before.document.revision, current, inRoom ? consoleTabSession : undefined, inRoom);
1424
+ if (mounted && inRoom) takeState(reverted);
1425
+ else if (mounted) accept(reverted);
1426
+ }
1427
+ else {
1428
+ await client.remove(collection.name, documentId, current, inRoom ? consoleTabSession : undefined, inRoom);
1429
+ if (mounted) {
1430
+ base.value = null;
1431
+ state.value = "deleted";
1432
+ }
1433
+ }
1434
+ if (mounted && before.unsaved) draft.value = before.unsaved;
1435
+ notifyChanged();
1436
+ }
1437
+ catch {
1438
+ toast.error("Couldn't undo the restore. Pick the earlier version in History.");
1439
+ }
1440
+ },
1441
+ },
1442
+ title: "Version restored",
1443
+ });
1444
+ }
1445
+ catch (error) {
1446
+ toast.error(isConsoleConflict(error) ? `This ${noun.value.toLowerCase()} changed since you opened it. Reload, then restore.` : "Couldn't restore. Try again.");
1447
+ }
1448
+ finally {
1449
+ restoring.value = false;
1450
+ }
1451
+ }
1452
+
1453
+ async function loadStoredFile(): Promise<void> {
1454
+ if (creating.value || !base.value) {
1455
+ storedFile.value = undefined;
1456
+ return;
1457
+ }
1458
+ try {
1459
+ storedFile.value = (await props.client.raw(props.collection.name, id.value))?.text;
1460
+ }
1461
+ catch {
1462
+ storedFile.value = undefined;
1463
+ }
1464
+ }
1465
+
1466
+ // Write pending body edits first, so a shortcut pressed right after typing still saves them.
1467
+ async function saveFromShortcut(): Promise<void> {
1468
+ await bodyEditor.value?.commit();
1469
+ if (dirty.value || conflict.value) await save();
1470
+ }
1471
+
1472
+ async function changeMode(next: "rich" | "source"): Promise<void> {
1473
+ if (next === "source") await bodyEditor.value?.commit();
1474
+ mode.value = next;
1475
+ }
1476
+
1477
+ function toggleMode(): void {
1478
+ void changeMode(mode.value === "rich" ? "source" : "rich");
1479
+ }
1480
+
1481
+ async function onModeKeydown(event: KeyboardEvent): Promise<void> {
1482
+ if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"].includes(event.key)) return;
1483
+ event.preventDefault();
1484
+ const group = event.currentTarget instanceof Element ? event.currentTarget.closest('[role="radiogroup"]') : null;
1485
+ await changeMode(event.key === "Home" ? "rich" : event.key === "End" ? "source" : mode.value === "rich" ? "source" : "rich");
1486
+ await nextTick();
1487
+ group?.querySelector<HTMLButtonElement>('[aria-checked="true"]')?.focus();
1488
+ }
1489
+
1490
+ function onKeydown(event: KeyboardEvent): void {
1491
+ if (!(event.metaKey || event.ctrlKey) || event.altKey) return;
1492
+ if (event.key.toLowerCase() === "s") {
1493
+ event.preventDefault();
1494
+ void saveFromShortcut();
1495
+ }
1496
+ if (event.key === "/" && !creating.value && hasBody.value) {
1497
+ event.preventDefault();
1498
+ toggleMode();
1499
+ }
1500
+ }
1501
+
1502
+ function onBeforeUnload(event: BeforeUnloadEvent): void {
1503
+ // Local-only edits survive a reload of this tab, but not closing it.
1504
+ if (!dirty.value && !localChanged.value && !sharedGone.value) return;
1505
+ event.preventDefault();
1506
+ }
1507
+
1508
+ function onHeaderAction(action: HeaderAction | undefined): void {
1509
+ if (action === "conflict") conflictOpen.value = true;
1510
+ if (action === "fields") void focusFirstInvalid();
1511
+ if (action === "retry") void save();
1512
+ if (action === "site") void openSiteConflict();
1513
+ }
1514
+
1515
+ /**
1516
+ * Shows the version on the site next to the draft, so the person chooses before a publish erases either. In Local only
1517
+ * the comparison is with `shared`, the shared draft that was reviewed, and never with the local edits on screen.
1518
+ */
1519
+ async function openSiteConflict(shared?: ConsoleDocument): Promise<void> {
1520
+ if (siteConflictLoading.value) return;
1521
+ if (local.value && !shared) {
1522
+ await openSharedPublish();
1523
+ return;
1524
+ }
1525
+ siteConflictOpen.value = true;
1526
+ siteConflict.value = undefined;
1527
+ siteConflictShared.value = shared;
1528
+ siteConflictError.value = undefined;
1529
+ siteConflictLoading.value = true;
1530
+ try {
1531
+ const site = await props.client.get(props.collection.name, id.value, "published");
1532
+ // Only a successful read confirms the version (or its absence) that the person can acknowledge.
1533
+ siteConflict.value = { site, published: site?.digest ?? null, ...(shared ? { shared } : {}) };
1534
+ }
1535
+ catch (error) {
1536
+ siteConflictError.value = `Couldn't load the site version. ${consoleErrorMessage(error, "Try again.")}`;
1537
+ }
1538
+ finally {
1539
+ siteConflictLoading.value = false;
1540
+ }
1541
+ }
1542
+
1543
+ /**
1544
+ * Saves the draft over the site version that the person compared: theirs with "Use the site version", or the draft on
1545
+ * screen with "Keep my draft". The next publish then replaces the site version with it. A newer save from someone
1546
+ * else, or another change on the site, fails the save and opens the comparison again.
1547
+ */
1548
+ async function resolveSiteConflict(choice: "site" | "draft"): Promise<void> {
1549
+ const compared = siteConflict.value;
1550
+ if (!compared || !base.value || resolvingSite.value) return;
1551
+ if (compared.shared) {
1552
+ await resolveSharedSiteConflict(choice, compared.site, compared.published, compared.shared);
1553
+ return;
1554
+ }
1555
+ // The local edits on screen are never a draft to keep here. Apply is the only way they save.
1556
+ if (local.value) {
1557
+ siteConflictOpen.value = false;
1558
+ return;
1559
+ }
1560
+ if (!(await session.claim())) return;
1561
+ clearTimeout(autosaveTimer);
1562
+ await bodyEditor.value?.commit();
1563
+ await settled();
1564
+ const inRoom = liveActive.value;
1565
+ if (inRoom && !(await saveLive())) return;
1566
+ const version: Version = choice === "site" && compared.site
1567
+ ? { body: compared.site.body, data: compact(compared.site.data) }
1568
+ : { body: draft.value.body, data: compact(draft.value.data) };
1569
+ resolvingSite.value = true;
1570
+ try {
1571
+ if (inRoom) ownResetUntil = Date.now() + 10_000;
1572
+ const saved = await props.client.save(props.collection.name, id.value, {
1573
+ ...version,
1574
+ ifDigest: base.value.digest,
1575
+ ifPublishedDigest: compared.published,
1576
+ session: consoleTabSession,
1577
+ ...(inRoom ? { live: true } : {}),
1578
+ });
1579
+ if (inRoom) takeState(saved);
1580
+ else accept(saved);
1581
+ siteConflictOpen.value = false;
1582
+ siteConflict.value = undefined;
1583
+ savedAt.value = new Date().toISOString();
1584
+ notifyChanged();
1585
+ toast.show({ title: choice === "site" ? "Draft matches the site again." : "Draft kept. Publishing it replaces the site version." });
1586
+ }
1587
+ catch (error) {
1588
+ if (isConsoleConflict(error)) {
1589
+ await load();
1590
+ toast.error("It changed again while you compared. Compare the latest versions.");
1591
+ if (base.value?.conflict) await openSiteConflict();
1592
+ }
1593
+ else toast.error(`Couldn't save. ${consoleErrorMessage(error, "Try again.")}`);
1594
+ }
1595
+ finally {
1596
+ resolvingSite.value = false;
1597
+ }
1598
+ }
1599
+
1600
+ /**
1601
+ * Resolves the site conflict of the reviewed shared draft in Local only. The save holds the site version or that shared
1602
+ * draft as it was reviewed, never the local edits, and names both digests: a newer shared save or another site change
1603
+ * fails it and the review opens again. The local edits stay in this tab; Apply then compares them with the new draft.
1604
+ */
1605
+ async function resolveSharedSiteConflict(choice: "site" | "draft", site: ConsoleDocument | null, published: string | null, shared: ConsoleDocument): Promise<void> {
1606
+ if (!local.value || props.documentId === undefined) return;
1607
+ const source = choice === "site" && site ? site : shared;
1608
+ // As in Apply: a live room holds the lease for everyone in it; otherwise this tab claims the lease for the save.
1609
+ const roomFor = Boolean(liveDefinition && hasBody.value && !liveFallback.value);
1610
+ if (!roomFor && !(await session.acquire())) {
1611
+ refuseLocal(() => void resolveSharedSiteConflict(choice, site, published, shared));
1612
+ return;
1613
+ }
1614
+ resolvingSite.value = true;
1615
+ try {
1616
+ const saved = await props.client.save(props.collection.name, props.documentId, {
1617
+ body: source.body,
1618
+ data: compact(source.data),
1619
+ ifDigest: shared.digest,
1620
+ ifPublishedDigest: published,
1621
+ session: consoleTabSession,
1622
+ ...(roomFor ? { live: true } : {}),
1623
+ });
1624
+ takeState(saved);
1625
+ siteConflictOpen.value = false;
1626
+ siteConflict.value = undefined;
1627
+ notifyChanged();
1628
+ previewReloads.value++;
1629
+ toast.show({ title: choice === "site" ? "The shared draft matches the site again. Your local edits are still here." : "Shared draft kept. Review it, then publish." });
1630
+ if (choice === "draft") await openSharedPublish();
1631
+ }
1632
+ catch (error) {
1633
+ if (isConsoleConflict(error)) {
1634
+ siteConflictOpen.value = false;
1635
+ siteConflict.value = undefined;
1636
+ toast.error("The shared draft or the site changed while you compared. Review it again.");
1637
+ await openSharedPublish();
1638
+ }
1639
+ else if (consoleLeaseHolder(error)) toast.error("Someone else is editing. Your local edits stay here. Try again when they stop.");
1640
+ else toast.error(`Couldn't save. ${consoleErrorMessage(error, "Try again.")}`);
1641
+ }
1642
+ finally {
1643
+ resolvingSite.value = false;
1644
+ viewLocally();
1645
+ }
1646
+ }
1647
+
1648
+ // Title: a large borderless field. Enter moves to the body, as in Notion.
1649
+ function resizeTitle(): void {
1650
+ const input = titleInput.value;
1651
+ if (!input) return;
1652
+ input.style.height = "auto";
1653
+ input.style.height = `${input.scrollHeight}px`;
1654
+ }
1655
+
1656
+ function onTitleInput(event: Event): void {
1657
+ if (!titleField.value || !(event.target instanceof HTMLTextAreaElement)) return;
1658
+ const value = event.target.value.replace(/\r?\n/g, " ");
1659
+ draft.value = { ...draft.value, data: { ...draft.value.data, [titleField.value.name]: value } };
1660
+ resizeTitle();
1661
+ }
1662
+
1663
+ function onTitleKeydown(event: KeyboardEvent): void {
1664
+ const input = event.target;
1665
+ if (!(input instanceof HTMLTextAreaElement)) return;
1666
+ if (event.key === "Enter" && !event.isComposing && !(event.metaKey || event.ctrlKey)) {
1667
+ event.preventDefault();
1668
+ bodyEditor.value?.focus("start");
1669
+ }
1670
+ if (event.key === "ArrowDown" && input.selectionStart === input.value.length) {
1671
+ event.preventDefault();
1672
+ bodyEditor.value?.focus("start");
1673
+ }
1674
+ }
1675
+
1676
+ // Side browser: the page of the document, kept open in the URL as `?preview`. Its width is kept per browser.
1677
+ const previewUrl = computed(() => consolePreviewUrl(base.value?.url, window.location.origin));
1678
+ const previewOpen = computed(() => route.query.preview !== undefined && !creating.value && Boolean(previewUrl.value));
1679
+ const previewView = ref<ConsolePreviewView>("draft");
1680
+ const previewViewport = ref<ConsolePreviewViewport>("desktop");
1681
+ const previewReloads = ref(0);
1682
+ /** The field focused in the editor, outlined in the page. */
1683
+ const previewHighlight = ref<string>();
1684
+ const previewWidthKey = "vitehub:console:preview-width";
1685
+ const previewWidth = ref(Number(window.localStorage.getItem(previewWidthKey)) || 560);
1686
+ const splitRoot = ref<HTMLElement>();
1687
+ /** Wide screens show the preview next to the editor; small ones show it over the editor. */
1688
+ const wideQuery = window.matchMedia("(min-width: 1024px)");
1689
+ const wide = ref(wideQuery.matches);
1690
+ const onWideChange = (event: MediaQueryListEvent) => (wide.value = event.matches);
1691
+ wideQuery.addEventListener("change", onWideChange);
1692
+ onBeforeUnmount(() => wideQuery.removeEventListener("change", onWideChange));
1693
+ /** The live room body, read from the editor, since `v-model` does not follow it in a room. */
1694
+ const liveBody = ref<string>();
1695
+ let liveBodyTimer: ReturnType<typeof setTimeout> | undefined;
1696
+ let liveBodyRead = 0;
1697
+ onBeforeUnmount(() => clearTimeout(liveBodyTimer));
1698
+ // The body is read only while the preview is open. Closing forgets it, and opening reads the room editor again, so a
1699
+ // body typed while the preview was closed never shows as an older one. A new room or document also starts over.
1700
+ watch([liveActive, previewOpen, liveEpoch, () => props.documentId], () => {
1701
+ clearTimeout(liveBodyTimer);
1702
+ liveBodyRead++;
1703
+ liveBody.value = undefined;
1704
+ if (liveActive.value && previewOpen.value) void readLiveBody();
1705
+ });
1706
+
1707
+ function setPreview(open: boolean): void {
1708
+ const query = { ...route.query };
1709
+ if (open) query.preview = null;
1710
+ else delete query.preview;
1711
+ void router.replace({ query });
1712
+ }
1713
+
1714
+ /** What the draft view renders: the fields and body on screen, saved or not. */
1715
+ const previewDocument = computed(() => ({
1716
+ collection: props.collection.name,
1717
+ id: id.value,
1718
+ data: compact(draft.value.data),
1719
+ ...(hasBody.value ? { body: liveActive.value ? liveBody.value ?? base.value?.body ?? "" : draft.value.body } : {}),
1720
+ }));
1721
+ /** Top-level text fields, which change in place in the page while this tab can edit. */
1722
+ const previewTextFields = computed(() => (editable.value ? fields.value.filter(field => field.kind === "string" || field.kind === "text").map(field => field.name) : []));
1723
+
1724
+ function onBodyChange(): void {
1725
+ if (!liveActive.value || !previewOpen.value) return;
1726
+ clearTimeout(liveBodyTimer);
1727
+ liveBodyTimer = setTimeout(() => void readLiveBody(), 250);
1728
+ }
1729
+
1730
+ /** Reads the room body from the editor. A read that a newer read, the preview closing, or a new room overtook is dropped. */
1731
+ async function readLiveBody(): Promise<void> {
1732
+ const read = ++liveBodyRead;
1733
+ const markdown = await bodyEditor.value?.markdown();
1734
+ if (markdown === null || markdown === undefined || read !== liveBodyRead) return;
1735
+ liveBody.value = markdown;
1736
+ }
1737
+
1738
+ /**
1739
+ * A click on a field in the page. A text field is edited in the page, so the editor only shows its row; any other
1740
+ * field gets focus in the editor.
1741
+ */
1742
+ async function onPreviewSelect(field: string): Promise<void> {
1743
+ if (!wide.value) return;
1744
+ const inPlace = previewTextFields.value.includes(field);
1745
+ if (field === "body") {
1746
+ if (!inPlace) bodyEditor.value?.focus("start");
1747
+ return;
1748
+ }
1749
+ if (titleField.value?.name === field && mode.value === "rich") {
1750
+ titleInput.value?.scrollIntoView({ block: "nearest" });
1751
+ if (!inPlace) titleInput.value?.focus({ preventScroll: true });
1752
+ return;
1753
+ }
1754
+ if (mode.value !== "rich") await changeMode("rich");
1755
+ await nextTick();
1756
+ const row = document.querySelector<HTMLElement>(`.vitehub-document-editor [data-vitehub-field="field-${field.replace(/[^a-zA-Z0-9_-]/g, "-")}"]`);
1757
+ if (!row) return;
1758
+ row.scrollIntoView({ block: "center" });
1759
+ row.animate([{ backgroundColor: "color-mix(in oklab, var(--ui-primary) 14%, transparent)" }, { backgroundColor: "transparent" }], { duration: 1200, easing: "ease-out" });
1760
+ if (!inPlace) row.querySelector<HTMLElement>("input, textarea, select, button, [contenteditable='true']")?.focus({ preventScroll: true });
1761
+ }
1762
+
1763
+ /** Text typed in the page, written to the field like typing in the editor. */
1764
+ function onPreviewEdit(field: string, value: string): void {
1765
+ if (!editable.value || !previewTextFields.value.includes(field)) return;
1766
+ draft.value = { ...draft.value, data: { ...draft.value.data, [field]: value } };
1767
+ if (titleField.value?.name === field) void nextTick(resizeTitle);
1768
+ }
1769
+
1770
+ function setPreviewWidth(width: number): void {
1771
+ const total = splitRoot.value?.clientWidth ?? window.innerWidth;
1772
+ previewWidth.value = consolePreviewWidth(width, total);
1773
+ window.localStorage.setItem(previewWidthKey, String(previewWidth.value));
1774
+ }
1775
+
1776
+ const resizing = ref(false);
1777
+ function onSplitterPointerDown(event: PointerEvent): void {
1778
+ if (event.button !== 0 || !(event.currentTarget instanceof HTMLElement)) return;
1779
+ event.preventDefault();
1780
+ const handle = event.currentTarget;
1781
+ handle.setPointerCapture(event.pointerId);
1782
+ resizing.value = true;
1783
+ const right = splitRoot.value?.getBoundingClientRect().right ?? window.innerWidth;
1784
+ const move = (next: PointerEvent) => setPreviewWidth(right - next.clientX);
1785
+ const stop = () => {
1786
+ resizing.value = false;
1787
+ handle.removeEventListener("pointermove", move);
1788
+ handle.removeEventListener("pointerup", stop);
1789
+ handle.removeEventListener("pointercancel", stop);
1790
+ };
1791
+ handle.addEventListener("pointermove", move);
1792
+ handle.addEventListener("pointerup", stop);
1793
+ handle.addEventListener("pointercancel", stop);
1794
+ }
1795
+
1796
+ /** Arrows move the divider, Shift moves it further, Home makes the preview widest, End narrowest. */
1797
+ function onSplitterKeydown(event: KeyboardEvent): void {
1798
+ const step = event.shiftKey ? 96 : 32;
1799
+ const total = splitRoot.value?.clientWidth ?? window.innerWidth;
1800
+ const next = { ArrowLeft: previewWidth.value + step, ArrowRight: previewWidth.value - step, Home: total, End: 0 }[event.key];
1801
+ if (next === undefined) return;
1802
+ event.preventDefault();
1803
+ setPreviewWidth(next);
1804
+ }
1805
+
1806
+ const editingItems = computed(() => [[
1807
+ {
1808
+ label: "Collaborative",
1809
+ description: liveDefinition && hasBody.value ? "Edit the shared draft with everyone. It saves as you type." : "Edit the shared draft. It saves as you type.",
1810
+ icon: "i-lucide-users",
1811
+ type: "checkbox" as const,
1812
+ checked: !local.value,
1813
+ onUpdateChecked: () => setEditing("shared"),
1814
+ },
1815
+ {
1816
+ label: "Local only",
1817
+ description: "Edits stay in this tab and save nowhere until you apply them.",
1818
+ icon: "i-lucide-laptop",
1819
+ type: "checkbox" as const,
1820
+ checked: local.value,
1821
+ onUpdateChecked: () => setEditing("local"),
1822
+ },
1823
+ ]]);
1824
+
1825
+ // Right rail: Outline or History, kept in the URL as `?panel=history`.
1826
+ const panel = computed<"history" | "outline" | undefined>(() => (route.query.panel === "history" || route.query.panel === "outline" ? route.query.panel : undefined));
1827
+ function setPanel(next: "history" | "outline" | undefined): void {
1828
+ const query = { ...route.query };
1829
+ if (next) query.panel = next;
1830
+ else delete query.panel;
1831
+ void router.replace({ query });
1832
+ }
1833
+ function openHistory(): void {
1834
+ if (window.matchMedia("(min-width: 1024px)").matches) setPanel("history");
1835
+ else historyOpen.value = true;
1836
+ }
1837
+
1838
+ // The id follows the title until someone edits the id.
1839
+ watch(() => (titleField.value ? draft.value.data[titleField.value.name] : undefined), (value) => {
1840
+ if (creating.value && !idEdited.value) newId.value = consoleDocumentSlug(String(value ?? ""));
1841
+ void nextTick(resizeTitle);
1842
+ });
1843
+ watch(historyOpen, (open) => {
1844
+ if (open && !revisions.value.length) void loadRevisions();
1845
+ if (!open) preview.value = undefined;
1846
+ });
1847
+ watch(panel, (value) => {
1848
+ if (value === "history") void loadRevisions();
1849
+ }, { immediate: true });
1850
+ watch(mode, (value) => {
1851
+ if (value === "source") void loadStoredFile();
1852
+ });
1853
+ watch(() => props.changes, (next, previous) => {
1854
+ const own = Math.min(ownChanges, next - previous);
1855
+ ownChanges -= own;
1856
+ if (next - previous - own <= 0) return;
1857
+ // Local only keeps its editor mounted, so a body edit that is still serializing, such as during the exit, stays.
1858
+ if (local.value) void refreshShared();
1859
+ else if (!dirty.value && !creating.value && !saving.value && !publishing.value) void load();
1860
+ });
1861
+
1862
+ async function beforeLeaveDocument(): Promise<false | undefined> {
1863
+ await bodyEditor.value?.commit();
1864
+ // Leaving would remove this editor's unload guard while its local edits still live only in sessionStorage.
1865
+ if (localChanged.value || sharedGone.value) {
1866
+ localExitOpen.value = true;
1867
+ return false;
1868
+ }
1869
+ if (!dirty.value) return;
1870
+ // A pending autosave finishes before leaving. Anything that cannot save asks first.
1871
+ await settled();
1872
+ if (dirty.value && autosaves.value) await save({ auto: true });
1873
+ if (dirty.value && !window.confirm(creating.value ? "Leave without creating this document?" : "Leave without saving? Your changes will be lost.")) return false;
1874
+ }
1875
+ onBeforeRouteLeave(beforeLeaveDocument);
1876
+ onBeforeRouteUpdate((to, from) => {
1877
+ // The document, collection list and other documents share a route record.
1878
+ if (local.value && to.path !== from.path) return beforeLeaveDocument();
1879
+ });
1880
+ onMounted(() => {
1881
+ window.addEventListener("keydown", onKeydown);
1882
+ window.addEventListener("beforeunload", onBeforeUnload);
1883
+ const saved: unknown = window.history.state?.vitehubDocumentSavedAt;
1884
+ if (String(saved) === saved) savedAt.value = saved;
1885
+ void load().then(() => nextTick(resizeTitle));
1886
+ // A new document starts at its title.
1887
+ if (creating.value) void nextTick(() => titleInput.value?.focus());
1888
+ });
1889
+ onBeforeUnmount(() => {
1890
+ mounted = false;
1891
+ clearTimeout(savingShowTimer);
1892
+ clearTimeout(savingHideTimer);
1893
+ clearTimeout(autosaveTimer);
1894
+ window.removeEventListener("keydown", onKeydown);
1895
+ window.removeEventListener("beforeunload", onBeforeUnload);
1896
+ });
1897
+
1898
+ const menuItems = computed(() => [[
1899
+ ...(!creating.value ? [{ label: "History", icon: "i-lucide-history", onSelect: openHistory }] : []),
1900
+ ...(!creating.value && hasBody.value ? [{ label: mode.value === "rich" ? "View source" : "Edit rich text", icon: "i-lucide-file-code", kbds: ["meta", "/"], onSelect: toggleMode }] : []),
1901
+ ...(canPublish.value && schedule.value
1902
+ ? [{ label: schedule.value.status === "failed" ? "Dismiss failed schedule" : "Cancel schedule", icon: "i-lucide-calendar-x", onSelect: () => void unscheduleDraft() }]
1903
+ : []),
1904
+ { label: "Copy id", icon: "i-lucide-copy", onSelect: () => void navigator.clipboard?.writeText(id.value) },
1905
+ ...(base.value ? [{ label: "Copy path", icon: "i-lucide-folder", onSelect: () => void navigator.clipboard?.writeText(base.value!.path) }] : []),
1906
+ ], ...(editable.value && !local.value && base.value && !single.value ? [[{ label: "Delete", icon: "i-lucide-trash-2", color: "error" as const, onSelect: () => (deleteOpen.value = true) }]] : [])]);
1907
+ </script>
1908
+
1909
+ <template>
1910
+ <!-- Two columns, each with its own header: the editor with its page header, and the side browser with its toolbar. -->
1911
+ <div ref="splitRoot" class="relative flex min-h-0 flex-1">
1912
+ <div class="flex min-w-0 flex-1 flex-col">
1913
+ <!-- A singleton named like its page, such as Settings, shows the name once. -->
1914
+ <ConsolePageHeader :title="title" :back="back" :trail="back && back.label !== title ? [back] : []">
1915
+ <template v-if="schedule" #title-trailing>
1916
+ <UTooltip :text="scheduleHint" :content="{ side: 'bottom' }">
1917
+ <ConsoleStatus class="shrink-0" :tone="consoleDocumentScheduleTone(schedule)" :label="consoleDocumentScheduleLabel(schedule)" />
1918
+ </UTooltip>
1919
+ </template>
1920
+ <template #right>
1921
+ <template v-if="liveActive">
1922
+ <AvatarStack v-if="liveOthers.length" class="me-1" :people="liveOthers" :max="4" size="sm" variant="outline" />
1923
+ <UTooltip text="Everyone here edits together. The draft saves a few seconds after typing stops." :content="{ side: 'bottom' }">
1924
+ <ConnectionStatus class="me-1 hidden sm:inline-flex" :status="liveStatus">
1925
+ <ConnectionStatusIndicator />
1926
+ <ConnectionStatusLabel v-slot="{ state }">{{ state === "connected" ? "Live" : state === "reconnecting" ? "Reconnecting…" : "Connecting…" }}</ConnectionStatusLabel>
1927
+ </ConnectionStatus>
1928
+ </UTooltip>
1929
+ </template>
1930
+ <ConsolePresenceAvatars v-else-if="sessionOthers.length" class="me-1" :sessions="sessionOthers" :user="sessionPresence?.user" />
1931
+ <UTooltip v-if="!liveActive && liveUnavailableReason && sessionOthers.length" :text="liveUnavailableReason" :content="{ side: 'bottom' }">
1932
+ <span class="me-1 hidden lg:inline-flex"><ConsoleStatus :label="consoleLiveUnavailable" /></span>
1933
+ </UTooltip>
1934
+ <UTooltip v-if="sessionsUnchecked" :text="sessionPresence?.reason ?? 'The Console could not reach the server. Saves still refuse to overwrite a newer version.'" :content="{ side: 'bottom' }">
1935
+ <span class="me-1 hidden lg:inline-flex"><ConsoleStatus label="Can't check who else is editing" /></span>
1936
+ </UTooltip>
1937
+ <span class="me-1 inline-flex" role="status" aria-live="polite">
1938
+ <button
1939
+ v-if="headerStatus?.action && !savingVisible"
1940
+ type="button"
1941
+ class="rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2"
1942
+ @click="onHeaderAction(headerStatus.action)"
1943
+ >
1944
+ <ConsoleStatus :label="headerStatus.label" :tone="headerStatus.tone" class="underline decoration-dotted underline-offset-4 hover:text-highlighted" />
1945
+ </button>
1946
+ <UTooltip v-else-if="headerStatus" :text="creating ? 'Create saves the first draft' : 'Drafts save as you type. ⌘S saves now.'" :content="{ side: 'bottom' }">
1947
+ <ConsoleStatus :label="headerStatus.label" :tone="headerStatus.tone" :pending="headerStatus.pending">
1948
+ {{ headerStatus.label }}<template v-if="headerStatus.savedAt">
1949
+ · <ConsoleRelativeTime :value="headerStatus.savedAt" prefix="Saved" seconds />
1950
+ </template>
1951
+ </ConsoleStatus>
1952
+ </UTooltip>
1953
+ </span>
1954
+ <UDropdownMenu
1955
+ v-if="canWrite && (base || local) && !creating && !missing && !deleted && !loadError"
1956
+ :items="editingItems"
1957
+ :content="{ align: 'end' }"
1958
+ :ui="{ content: 'w-72', itemDescription: 'whitespace-normal!' }"
1959
+ >
1960
+ <UButton
1961
+ size="sm"
1962
+ variant="ghost"
1963
+ :color="local ? 'warning' : 'neutral'"
1964
+ :icon="local ? 'i-lucide-laptop' : 'i-lucide-users'"
1965
+ trailing-icon="i-lucide-chevron-down"
1966
+ :aria-label="`Editing: ${local ? 'Local only' : 'Collaborative'}`"
1967
+ :loading="applyingLocal"
1968
+ >
1969
+ <span class="hidden sm:inline">{{ local ? "Local only" : "Collaborative" }}</span>
1970
+ </UButton>
1971
+ </UDropdownMenu>
1972
+ <UTooltip v-if="base && !creating && !missing" :text="previewUrl ? 'Preview the page' : 'Set url on the collection to preview its pages'" :content="{ side: 'bottom' }">
1973
+ <UButton
1974
+ variant="ghost"
1975
+ size="sm"
1976
+ icon="i-lucide-app-window"
1977
+ aria-label="Preview the page"
1978
+ :aria-pressed="previewOpen"
1979
+ :disabled="!previewUrl"
1980
+ :active="previewOpen"
1981
+ active-variant="soft"
1982
+ @click="setPreview(!previewOpen)"
1983
+ />
1984
+ </UTooltip>
1985
+ <div
1986
+ v-if="hasBody && !creating && !loading && !missing && !deleted && !loadError"
1987
+ class="hidden items-center rounded-md p-0.5 ring-1 ring-default ring-inset"
1988
+ :class="previewOpen ? '' : 'md:flex'"
1989
+ role="radiogroup"
1990
+ aria-label="Editing mode"
1991
+ >
1992
+ <UTooltip v-for="option in [{ label: 'Rich', value: 'rich' }, { label: 'Source', value: 'source' }] as const" :key="option.value" :text="option.value === 'rich' ? 'Edit as a page' : 'The stored Markdown file'" :kbds="['meta', '/']">
1993
+ <button
1994
+ type="button"
1995
+ role="radio"
1996
+ class="h-6 rounded-[4px] px-2 text-xs focus-visible:outline-2"
1997
+ :class="mode === option.value ? 'bg-elevated text-highlighted' : 'text-muted hover:text-highlighted'"
1998
+ :aria-checked="mode === option.value"
1999
+ :tabindex="mode === option.value ? 0 : -1"
2000
+ @click="changeMode(option.value)"
2001
+ @keydown="onModeKeydown"
2002
+ >
2003
+ {{ option.label }}
2004
+ </button>
2005
+ </UTooltip>
2006
+ </div>
2007
+ <UButton v-if="creating && canWrite" size="sm" label="Create" :loading="saving" @click="save()" />
2008
+ <!-- A split button: Publish now, or Schedule… from the arrow. A deleted document publishes its deletion now only. -->
2009
+ <UFieldGroup v-else-if="publishable" size="sm">
2010
+ <UTooltip :text="errorCount ? consoleFixFieldsLabel(errorCount) : undefined" :disabled="!errorCount" :content="{ side: 'bottom' }">
2011
+ <UButton
2012
+ :label="state === 'deleted' ? 'Publish deletion' : local ? 'Publish shared draft' : 'Publish'"
2013
+ :loading="publishing"
2014
+ :disabled="Boolean(conflict) || scheduling || Boolean(errorCount)"
2015
+ :aria-description="errorCount ? consoleFixFieldsLabel(errorCount) : undefined"
2016
+ @click="publish"
2017
+ />
2018
+ </UTooltip>
2019
+ <UDropdownMenu
2020
+ v-if="state !== 'deleted' && !local"
2021
+ :items="publishMenu"
2022
+ :content="{ align: 'end' }"
2023
+ :ui="{ content: 'max-w-72', itemDescription: 'whitespace-normal!' }"
2024
+ >
2025
+ <UButton icon="i-lucide-chevron-down" aria-label="More publish options" :disabled="Boolean(conflict) || publishing || Boolean(errorCount)" :loading="scheduling" class="border-s border-(--ui-bg)/25" />
2026
+ </UDropdownMenu>
2027
+ </UFieldGroup>
2028
+ <UTooltip v-if="!creating && !missing" text="Outline and history" :content="{ side: 'bottom' }">
2029
+ <UButton
2030
+ class="hidden lg:inline-flex"
2031
+ variant="ghost"
2032
+ size="sm"
2033
+ icon="i-lucide-panel-right"
2034
+ aria-label="Toggle the side panel"
2035
+ :active="Boolean(panel)"
2036
+ active-variant="soft"
2037
+ @click="setPanel(panel ? undefined : hasBody ? 'outline' : 'history')"
2038
+ />
2039
+ </UTooltip>
2040
+ <UDropdownMenu v-if="!missing" :items="menuItems" :content="{ align: 'end' }">
2041
+ <UButton variant="ghost" size="sm" icon="i-lucide-ellipsis" aria-label="More actions" />
2042
+ </UDropdownMenu>
2043
+ </template>
2044
+ </ConsolePageHeader>
2045
+
2046
+ <p class="sr-only" role="status">{{ loading ? 'Loading document…' : '' }}</p>
2047
+ <div class="flex min-h-0 flex-1">
2048
+ <div class="vitehub-document-editor min-h-0 min-w-0 flex-1 overflow-y-auto" :aria-busy="loading">
2049
+ <ConsoleState
2050
+ v-if="loadError"
2051
+ class="m-4"
2052
+ :title="`Couldn't open this ${noun.toLowerCase()}`"
2053
+ :error="loadError"
2054
+ :retry="load"
2055
+ />
2056
+ <ConsoleLoading v-else-if="loading" label="Loading document…" />
2057
+ <UEmpty
2058
+ v-else-if="missing"
2059
+ class="py-16"
2060
+ variant="naked"
2061
+ icon="i-lucide-file-question"
2062
+ :title="`This ${noun.toLowerCase()} does not exist`"
2063
+ description="It may have been deleted and published, or the id is wrong."
2064
+ :actions="[{ label: `Back to ${collection.label}`, to: listRoute() }]"
2065
+ />
2066
+ <UEmpty
2067
+ v-else-if="deleted"
2068
+ class="py-16"
2069
+ variant="naked"
2070
+ icon="i-lucide-file-x"
2071
+ title="Deleted from the draft"
2072
+ description="It stays on the published site until you publish the deletion. Open History to restore an earlier version."
2073
+ :actions="[{ label: 'History', icon: 'i-lucide-history', color: 'neutral', variant: 'outline', onClick: () => (historyOpen = true) }]"
2074
+ />
2075
+ <article v-else class="mx-auto w-full max-w-[52rem] px-6 pt-10 pb-8 sm:px-16 sm:pt-14">
2076
+ <div v-if="local" class="mb-6 grid gap-1.5 rounded-md bg-warning/5 px-3 py-2 text-[13px] ring-1 ring-warning/30 ring-inset" role="status" aria-live="polite">
2077
+ <div class="flex flex-wrap items-center gap-x-3 gap-y-1.5">
2078
+ <UIcon name="i-lucide-laptop" class="size-4 shrink-0 text-warning" aria-hidden="true" />
2079
+ <span class="min-w-0 flex-1 text-default">Local only · Your edits stay in this tab. Nobody sees them, and nothing saves until you apply them.</span>
2080
+ <UButton v-if="sharedGone" size="xs" color="neutral" variant="ghost" label="Copy" icon="i-lucide-copy" aria-label="Copy your local edits" @click="copyLocal" />
2081
+ <UButton size="xs" color="neutral" variant="ghost" label="Discard…" :disabled="(!localChanged && !sharedGone) || applyingLocal" @click="localExitOpen = true" />
2082
+ <UButton size="xs" color="neutral" variant="outline" label="Apply to shared draft" :disabled="!localChanged && !sharedGone" :loading="applyingLocal" @click="applyLocal()" />
2083
+ </div>
2084
+ <p v-if="sharedGone" class="ps-7 text-default">
2085
+ The shared draft was deleted after your local edits started. They are still here. Copy them, apply them to create the {{ single ? "page" : noun.toLowerCase() }} again after a comparison, or discard them.
2086
+ </p>
2087
+ <p v-if="localLeaseHolder" class="ps-7 text-muted">{{ localLeaseHolder }} Apply when they stop.</p>
2088
+ <p v-if="sharedMoved" class="ps-7 text-muted">Someone saved the shared draft after your local edits started. Apply compares them before it saves.</p>
2089
+ <p v-if="localStorageFailed" class="ps-7 text-error">This tab can't keep your local edits after a reload. Apply or copy them before you leave.</p>
2090
+ </div>
2091
+ <div v-if="leaseBanner" class="mb-6 grid gap-1.5 rounded-md px-3 py-2 text-[13px] ring-1 ring-default ring-inset" role="status" aria-live="polite">
2092
+ <div class="flex flex-wrap items-center gap-x-3 gap-y-1.5">
2093
+ <UIcon :name="leaseBanner.icon" class="size-4 shrink-0 text-muted" aria-hidden="true" />
2094
+ <span class="min-w-0 flex-1 text-default">{{ leaseBanner.text }}</span>
2095
+ <template v-if="leaseMode === 'blocked'">
2096
+ <UButton v-if="holderLive && liveDefinition" size="xs" color="neutral" variant="outline" label="Join" @click="joinLive" />
2097
+ <UButton v-else-if="!holderLive" size="xs" color="neutral" variant="outline" label="Take over" @click="takeOver" />
2098
+ </template>
2099
+ <template v-else-if="leaseMode === 'taken'">
2100
+ <UButton size="xs" color="neutral" variant="ghost" label="Compare" @click="compareWithHolder" />
2101
+ <UButton size="xs" color="neutral" variant="outline" label="Take back" @click="takeOver" />
2102
+ </template>
2103
+ <UButton v-else-if="leaseMode === 'left'" size="xs" color="neutral" variant="outline" label="Reload and edit" @click="reloadAndEdit" />
2104
+ </div>
2105
+ <div v-if="leaseMode === 'taken' && refusedEdits" class="flex items-center gap-3 ps-7 text-muted">
2106
+ <span class="flex-1">{{ refusedEdits === 1 ? "1 edit wasn't saved" : `${refusedEdits} edits weren't saved` }}</span>
2107
+ <UButton size="xs" color="neutral" variant="ghost" icon="i-lucide-copy" label="Copy" @click="copyUnsaved" />
2108
+ </div>
2109
+ </div>
2110
+ <p v-if="!canWrite" class="mb-6 flex items-center gap-2 text-[13px] text-muted">
2111
+ <UIcon name="i-lucide-lock" class="size-4 shrink-0" aria-hidden="true" />
2112
+ Read-only. You can read drafts of this collection but not change them.
2113
+ </p>
2114
+
2115
+ <template v-if="mode === 'rich'">
2116
+ <h1 v-if="single" class="mb-4 text-[32px]/[40px] font-semibold tracking-[-0.04rem] text-highlighted">{{ collection.label }}</h1>
2117
+ <div v-else-if="titleField" class="mb-4">
2118
+ <label :for="`field-${titleField.name}`" class="sr-only">{{ titleField.label }}</label>
2119
+ <textarea
2120
+ :id="`field-${titleField.name}`"
2121
+ ref="titleInput"
2122
+ :value="String(draft.data[titleField.name] ?? '')"
2123
+ rows="1"
2124
+ class="block w-full resize-none overflow-hidden rounded-sm bg-transparent text-[32px]/[40px] font-semibold tracking-[-0.04rem] text-highlighted outline-none placeholder:text-dimmed focus-visible:outline-none disabled:cursor-default"
2125
+ :placeholder="`${noun} title`"
2126
+ :disabled="!editable"
2127
+ :aria-invalid="fieldErrors[titleField.name] ? 'true' : undefined"
2128
+ :aria-describedby="fieldErrors[titleField.name] ? `field-${titleField.name}-error` : undefined"
2129
+ @input="onTitleInput"
2130
+ @keydown="onTitleKeydown"
2131
+ @focus="onFieldFocus"
2132
+ @blur="onFieldBlur"
2133
+ />
2134
+ <span v-if="fieldPeople[`field-${titleField.name}`]" class="-mt-1" role="img" :aria-label="fieldPeople[`field-${titleField.name}`]!.map(person => `${person.name} is editing this field`).join(', ')">
2135
+ <AvatarStack aria-hidden="true" :style="{ '--vh-avatar-size': '1rem' }" :people="fieldPeople[`field-${titleField.name}`]!" variant="outline" />
2136
+ </span>
2137
+ <p v-if="fieldErrors[titleField.name]" :id="`field-${titleField.name}-error`" class="mt-1 text-xs text-error">{{ fieldErrors[titleField.name]!.join(" ") }}</p>
2138
+ </div>
2139
+
2140
+ <ConsoleSchemaForm
2141
+ v-model="draft.data"
2142
+ :schema="collection.schema"
2143
+ :exclude="[titleField?.name, seoField?.name].filter(name => name !== undefined)"
2144
+ :errors="fieldErrors"
2145
+ :disabled="!editable"
2146
+ :unfolded="!hasBody"
2147
+ @submit="saveFromShortcut"
2148
+ @focusin="onFieldFocus"
2149
+ @focusout="onFieldBlur"
2150
+ >
2151
+ <ConsolePropertyRow v-if="creating && folders.length > 1" icon="i-lucide-folder" label="Folder" control="field-folder">
2152
+ <USelect
2153
+ id="field-folder"
2154
+ v-model="folderIndex"
2155
+ class="w-full"
2156
+ variant="ghost"
2157
+ :items="folders.map((entry, index) => ({ label: entry.folder || '/', value: index }))"
2158
+ :ui="{ base: 'font-mono text-xs' }"
2159
+ />
2160
+ </ConsolePropertyRow>
2161
+ <ConsolePropertyRow v-if="creating" icon="i-lucide-file" label="Id" control="field-id" :error="idError" :missing="!newId.trim() && !idError">
2162
+ <UInput
2163
+ id="field-id"
2164
+ v-model="newId"
2165
+ class="w-full"
2166
+ variant="ghost"
2167
+ placeholder="hello-world"
2168
+ :ui="{ base: 'bg-transparent hover:bg-transparent focus:bg-transparent ring-0 hover:ring-1 hover:ring-inset hover:ring-(--ui-border) focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-(--ui-border-accented) font-mono text-xs', trailing: 'pe-2' }"
2169
+ :aria-invalid="idError ? 'true' : undefined"
2170
+ :aria-describedby="idError ? 'field-id-error' : 'field-id-hint'"
2171
+ @update:model-value="idEdited = true"
2172
+ >
2173
+ <template #trailing>
2174
+ <span id="field-id-hint" class="text-xs text-dimmed">{{ idEdited ? `${folders[folderIndex]?.folder ?? ''}${newId || '…'}${fileExtension}` : "From the title" }}</span>
2175
+ </template>
2176
+ </UInput>
2177
+ </ConsolePropertyRow>
2178
+ <ConsolePropertyRow v-else-if="base" icon="i-lucide-file" label="File">
2179
+ <span class="flex h-8 min-w-0 items-center px-2.5 font-mono text-xs text-muted" :title="base.path">
2180
+ <span class="truncate">{{ base.path }}</span>
2181
+ </span>
2182
+ </ConsolePropertyRow>
2183
+ </ConsoleSchemaForm>
2184
+
2185
+ <ConsoleSeoPanel
2186
+ v-if="seoField"
2187
+ :model-value="draft.data[seoField.name] as Record<string, unknown> | undefined"
2188
+ :name="seoField.name"
2189
+ :schema="seoField.schema"
2190
+ :hint="seoField.hint"
2191
+ :fallbacks="consoleSeoFallbacks(draft.data, collection.titleField, base?.url)"
2192
+ :errors="fieldErrors"
2193
+ :disabled="!editable"
2194
+ @update:model-value="updateSeo"
2195
+ />
2196
+
2197
+ <hr v-if="hasBody" class="my-6 border-default">
2198
+ </template>
2199
+
2200
+ <section v-else class="mb-4 grid gap-3" aria-label="Stored file">
2201
+ <div class="flex items-center gap-2 text-xs text-muted">
2202
+ <UIcon name="i-lucide-file-code" class="size-4 shrink-0" aria-hidden="true" />
2203
+ <span class="font-mono text-highlighted">{{ base?.path }}</span>
2204
+ <span class="ms-auto">{{ liveActive ? "Read-only during a live session. Edit in Rich." : dataDirty ? "Fields are saving…" : "Fields are read-only here. Edit them in Rich." }}</span>
2205
+ </div>
2206
+ <pre
2207
+ v-if="sourceParts?.frontmatter"
2208
+ class="overflow-x-auto rounded-md bg-elevated/50 px-4 py-3 font-mono text-[13px]/6 text-muted select-text"
2209
+ aria-label="Frontmatter, read-only"
2210
+ >{{ sourceParts.frontmatter.trimEnd() }}</pre>
2211
+ </section>
2212
+
2213
+ <!-- Live: the body is the room. Each new room seed mounts a new editor. -->
2214
+ <ConsoleMarkdownEditor
2215
+ v-if="hasBody && liveBinding"
2216
+ v-show="mode === 'rich'"
2217
+ :key="`live-${liveEpoch}`"
2218
+ ref="bodyEditor"
2219
+ :model-value="draft.body"
2220
+ :live="liveBinding"
2221
+ :active="mode === 'rich'"
2222
+ :collection="collection.name"
2223
+ :components="collection.components"
2224
+ :document-id="id"
2225
+ :disabled="!editable || Boolean(live?.readOnlyReason.value)"
2226
+ label="Body"
2227
+ @change="onBodyChange"
2228
+ @outline="outline = $event"
2229
+ />
2230
+ <div v-else-if="hasBody && liveRoom" v-show="mode === 'rich'" class="flex min-h-[40vh] items-start gap-2 text-[13px] text-muted" role="status">
2231
+ <UIcon name="i-lucide-loader-circle" class="mt-0.5 size-4 animate-spin" aria-hidden="true" />
2232
+ Joining the live session…
2233
+ </div>
2234
+ <ConsoleMarkdownEditor
2235
+ v-else-if="hasBody"
2236
+ v-show="mode === 'rich'"
2237
+ ref="bodyEditor"
2238
+ v-model="draft.body"
2239
+ :active="mode === 'rich'"
2240
+ :collection="collection.name"
2241
+ :components="collection.components"
2242
+ :document-id="creating ? undefined : id"
2243
+ :disabled="!editable"
2244
+ label="Body"
2245
+ @outline="outline = $event"
2246
+ />
2247
+ <pre
2248
+ v-if="hasBody && mode === 'source' && liveActive"
2249
+ class="min-h-80 overflow-x-auto font-mono text-[13px] leading-6 whitespace-pre-wrap text-muted select-text"
2250
+ aria-label="Markdown body as last saved, read-only"
2251
+ >{{ sourceParts?.body ?? draft.body }}</pre>
2252
+ <UTextarea
2253
+ v-else-if="hasBody && mode === 'source'"
2254
+ v-model="draft.body"
2255
+ :disabled="!editable"
2256
+ autoresize
2257
+ :rows="16"
2258
+ variant="none"
2259
+ class="w-full"
2260
+ :ui="{ base: 'min-h-80 p-0 font-mono text-[13px] leading-6' }"
2261
+ aria-label="Markdown body"
2262
+ />
2263
+ </article>
2264
+ </div>
2265
+
2266
+ <aside v-if="panel && !creating && !missing" class="hidden w-72 shrink-0 flex-col border-s border-default lg:flex" aria-label="Side panel">
2267
+ <div class="flex h-11 shrink-0 items-center gap-1 border-b border-default px-2">
2268
+ <UButton
2269
+ v-for="option in (hasBody ? [{ label: 'Outline', value: 'outline' }, { label: 'History', value: 'history' }] as const : [{ label: 'History', value: 'history' }] as const)"
2270
+ :key="option.value"
2271
+ size="xs"
2272
+ variant="ghost"
2273
+ :label="option.label"
2274
+ :active="panel === option.value"
2275
+ active-variant="soft"
2276
+ :aria-pressed="panel === option.value"
2277
+ @click="setPanel(option.value)"
2278
+ />
2279
+ <UButton class="ms-auto" size="xs" variant="ghost" icon="i-lucide-x" aria-label="Close the side panel" @click="setPanel(undefined)" />
2280
+ </div>
2281
+ <div class="min-h-0 flex-1 overflow-y-auto p-2">
2282
+ <nav v-if="panel === 'outline'" aria-label="Outline">
2283
+ <p v-if="!outline.length" class="px-2 py-1.5 text-xs text-muted">Headings in the body show here.</p>
2284
+ <ol v-else class="grid">
2285
+ <li v-for="heading in outline" :key="`${heading.pos}`">
2286
+ <button
2287
+ type="button"
2288
+ class="block w-full truncate rounded-md py-1 pe-2 text-left text-[13px] text-muted hover:bg-elevated/60 hover:text-highlighted focus-visible:outline-2"
2289
+ :style="{ paddingInlineStart: `${0.5 + (heading.level - 1) * 0.75}rem` }"
2290
+ @click="bodyEditor?.scrollTo(heading.pos)"
2291
+ >
2292
+ {{ heading.text }}
2293
+ </button>
2294
+ </li>
2295
+ </ol>
2296
+ </nav>
2297
+ <ConsoleDocumentHistory
2298
+ v-else
2299
+ :revisions="revisions"
2300
+ :cursor="revisionsCursor"
2301
+ :loading="revisionsLoading"
2302
+ :error="revisionsError"
2303
+ :loaded-at="revisionsLoadedAt"
2304
+ :selected="historyOpen ? preview?.revision.id : undefined"
2305
+ @open="openRevision"
2306
+ @more="loadRevisions(true)"
2307
+ />
2308
+ </div>
2309
+ </aside>
2310
+ </div>
2311
+ </div>
2312
+
2313
+ <template v-if="previewOpen && previewUrl && base">
2314
+ <div
2315
+ v-if="wide"
2316
+ class="group relative z-10 -mx-1 w-2 shrink-0 cursor-col-resize touch-none focus-visible:outline-none"
2317
+ role="separator"
2318
+ aria-orientation="vertical"
2319
+ aria-label="Resize the preview"
2320
+ aria-controls="vitehub-document-preview"
2321
+ :aria-valuenow="previewWidth"
2322
+ :aria-valuemin="320"
2323
+ :aria-valuetext="`Preview ${previewWidth} pixels wide`"
2324
+ tabindex="0"
2325
+ @pointerdown="onSplitterPointerDown"
2326
+ @keydown="onSplitterKeydown"
2327
+ >
2328
+ <div class="mx-auto h-full w-px bg-(--ui-border) transition-colors group-hover:bg-(--ui-border-accented) group-focus-visible:w-0.5 group-focus-visible:bg-primary" :class="resizing ? 'w-0.5 bg-primary' : ''" />
2329
+ </div>
2330
+ <ConsoleDocumentPreview
2331
+ id="vitehub-document-preview"
2332
+ v-model:view="previewView"
2333
+ v-model:viewport="previewViewport"
2334
+ :class="wide ? 'shrink-0' : 'absolute inset-0 z-20'"
2335
+ :style="wide ? { width: `${previewWidth}px` } : undefined"
2336
+ :client="client"
2337
+ :collection="collection"
2338
+ :document-id="id"
2339
+ :url="previewUrl"
2340
+ :document="previewDocument"
2341
+ :text-fields="previewTextFields"
2342
+ :local="local"
2343
+ :highlight="previewHighlight"
2344
+ :reloads="previewReloads"
2345
+ :overlay="!wide"
2346
+ @close="setPreview(false)"
2347
+ @select="onPreviewSelect"
2348
+ @edit="onPreviewEdit"
2349
+ />
2350
+ <!-- While the divider moves, the page must not take the pointer. -->
2351
+ <div v-if="resizing" class="absolute inset-0 z-30 cursor-col-resize" />
2352
+ </template>
2353
+ </div>
2354
+
2355
+ <UModal
2356
+ :open="conflictOpen && Boolean(conflict)"
2357
+ :title="`This ${noun.toLowerCase()} changed since you opened it`"
2358
+ description="Someone saved a newer version, so saving paused. Compare it with yours, then choose which one to keep."
2359
+ :ui="{ content: 'sm:max-w-3xl' }"
2360
+ @update:open="(open) => { if (!open) conflictOpen = false }"
2361
+ >
2362
+ <template #body>
2363
+ <div v-if="conflict" class="grid gap-3">
2364
+ <p class="text-xs text-muted">
2365
+ <span class="font-medium text-highlighted">Removed lines</span> are in the saved version,
2366
+ <span class="font-medium text-highlighted">added lines</span> are yours.
2367
+ <template v-if="!conflict.theirs"> The saved version deleted this {{ noun.toLowerCase() }}.</template>
2368
+ </p>
2369
+ <ConsoleDocumentDiff :before="conflict.theirs ? { body: conflict.theirs.body, data: conflict.theirs.data } : null" :after="conflict.mine" :format="collection.format" :name="fileName" />
2370
+ </div>
2371
+ </template>
2372
+ <template #footer>
2373
+ <div class="flex w-full flex-wrap justify-end gap-2">
2374
+ <UButton variant="ghost" label="Keep editing" @click="conflictOpen = false" />
2375
+ <UButton variant="outline" label="Load theirs" @click="useTheirs" />
2376
+ <UButton color="error" label="Overwrite with mine" :loading="saving" @click="keepMine" />
2377
+ </div>
2378
+ </template>
2379
+ </UModal>
2380
+
2381
+ <UModal
2382
+ :open="localExitOpen"
2383
+ title="Apply your local edits?"
2384
+ description="Collaborative edits the shared draft. Save your local edits to it first, or discard them."
2385
+ :ui="{ content: 'sm:max-w-3xl' }"
2386
+ @update:open="(open) => { if (!open) localExitOpen = false }"
2387
+ >
2388
+ <template #body>
2389
+ <ConsoleDocumentDiff v-if="localStart" :before="localStart" :after="{ body: draft.body, data: compact(draft.data) }" :format="collection.format" :name="fileName" />
2390
+ </template>
2391
+ <template #footer>
2392
+ <div class="flex w-full flex-wrap justify-end gap-2">
2393
+ <UButton variant="ghost" label="Keep editing locally" @click="localExitOpen = false" />
2394
+ <UButton color="error" variant="outline" label="Discard local edits" :disabled="applyingLocal" @click="discardLocal" />
2395
+ <UButton label="Apply to shared draft" :loading="applyingLocal" @click="applyLocal()" />
2396
+ </div>
2397
+ </template>
2398
+ </UModal>
2399
+
2400
+ <UModal
2401
+ :open="Boolean(localConflict)"
2402
+ :title="localConflict && 'failed' in localConflict ? 'Couldn\'t read the shared draft' : localConflict && !localConflict.theirs ? 'The shared draft was deleted' : 'The shared draft changed'"
2403
+ :description="localConflict && 'failed' in localConflict
2404
+ ? 'Someone changed the shared draft after your local edits started from it, so nothing was saved. Read it again to compare. Your local edits stay here.'
2405
+ : localConflict && !localConflict.theirs
2406
+ ? 'Someone deleted the shared draft after your local edits started from it, so nothing was saved. Create it again from your local edits, or keep them here.'
2407
+ : 'Someone saved the shared draft after your local edits started from it, so nothing was saved. Compare them, then choose.'"
2408
+ :ui="{ content: 'sm:max-w-3xl' }"
2409
+ @update:open="(open) => { if (!open) localConflict = undefined }"
2410
+ >
2411
+ <template #body>
2412
+ <p v-if="localConflict && 'failed' in localConflict" class="text-sm text-error" role="alert">
2413
+ {{ localConflict.failed }}
2414
+ </p>
2415
+ <div v-else-if="localConflict" class="grid gap-3">
2416
+ <p class="text-xs text-muted">
2417
+ <span class="font-medium text-highlighted">Removed lines</span> are in the shared draft,
2418
+ <span class="font-medium text-highlighted">added lines</span> are your local edits.
2419
+ </p>
2420
+ <ConsoleDocumentDiff :before="localConflict.theirs ? { body: localConflict.theirs.body, data: localConflict.theirs.data } : null" :after="{ body: draft.body, data: compact(draft.data) }" :format="collection.format" :name="fileName" />
2421
+ </div>
2422
+ </template>
2423
+ <template #footer>
2424
+ <div class="flex w-full flex-wrap justify-end gap-2">
2425
+ <UButton variant="ghost" label="Keep editing locally" @click="localConflict = undefined" />
2426
+ <UButton v-if="localConflict && 'failed' in localConflict" label="Retry" :loading="readingConflict" @click="readLocalConflict" />
2427
+ <template v-else-if="localConflict">
2428
+ <UButton variant="outline" label="Discard mine" :disabled="applyingLocal" @click="discardLocal" />
2429
+ <UButton color="error" :label="localConflict.theirs ? 'Overwrite with mine' : 'Create again from mine'" :loading="applyingLocal" @click="applyLocal(localConflict.theirs?.digest ?? null)" />
2430
+ </template>
2431
+ </div>
2432
+ </template>
2433
+ </UModal>
2434
+
2435
+ <UModal
2436
+ :open="sharedPublishOpen"
2437
+ title="Publish the shared draft?"
2438
+ description="This publishes the shared draft that everyone edits. Your local edits are not part of it and stay in this tab."
2439
+ :ui="{ content: 'sm:max-w-3xl' }"
2440
+ @update:open="(open) => { if (!open) sharedPublishOpen = false }"
2441
+ >
2442
+ <template #body>
2443
+ <ConsoleLoading v-if="sharedPublishLoading" label="Loading the shared draft…" />
2444
+ <div v-else-if="sharedPublish" class="grid gap-3">
2445
+ <p class="text-xs text-muted">
2446
+ <span class="font-medium text-highlighted">Removed lines</span> are on the site,
2447
+ <span class="font-medium text-highlighted">added lines</span> are the shared draft.
2448
+ </p>
2449
+ <ConsoleDocumentDiff
2450
+ :before="sharedPublish.site ? { body: sharedPublish.site.body, data: sharedPublish.site.data } : null"
2451
+ :after="sharedPublish.draft ? { body: sharedPublish.draft.body, data: sharedPublish.draft.data } : null"
2452
+ :format="collection.format"
2453
+ :name="fileName"
2454
+ />
2455
+ </div>
2456
+ </template>
2457
+ <template #footer>
2458
+ <div class="flex w-full justify-end gap-2">
2459
+ <UButton variant="ghost" label="Cancel" @click="sharedPublishOpen = false" />
2460
+ <UButton label="Publish shared draft" :disabled="!sharedPublish?.draft" :loading="publishing" @click="publishShared" />
2461
+ </div>
2462
+ </template>
2463
+ </UModal>
2464
+
2465
+ <UModal
2466
+ :open="siteConflictOpen"
2467
+ title="This page also changed on the site"
2468
+ description="It changed on the site after your draft started from it, for example with a Git commit. Publishing your draft would erase that change, so nothing was published. Compare them and choose what to keep."
2469
+ :ui="{ content: 'sm:max-w-3xl' }"
2470
+ @update:open="(open) => { if (!open) siteConflictOpen = false }"
2471
+ >
2472
+ <template #body>
2473
+ <ConsoleLoading v-if="siteConflictLoading" label="Loading the site version…" />
2474
+ <div v-else-if="siteConflictError" class="grid justify-items-start gap-3">
2475
+ <p role="alert" class="text-sm text-muted">{{ siteConflictError }}</p>
2476
+ <UButton variant="outline" label="Retry" @click="openSiteConflict(siteConflictShared)" />
2477
+ </div>
2478
+ <div v-else-if="siteConflict" class="grid gap-3">
2479
+ <p class="text-xs text-muted">
2480
+ <span class="font-medium text-highlighted">Removed lines</span> are on the site,
2481
+ <span class="font-medium text-highlighted">added lines</span> are {{ siteConflict.shared ? "the shared draft. Your local edits are not part of it" : "your draft" }}.
2482
+ <template v-if="!siteConflict.site"> The site no longer has this {{ noun.toLowerCase() }}. Keep {{ siteConflict.shared ? "the shared" : "your" }} draft to publish it again.</template>
2483
+ </p>
2484
+ <ConsoleDocumentDiff
2485
+ :before="siteConflict.site ? { body: siteConflict.site.body, data: siteConflict.site.data } : null"
2486
+ :after="siteConflict.shared ? { body: siteConflict.shared.body, data: compact(siteConflict.shared.data) } : { body: draft.body, data: compact(draft.data) }"
2487
+ :format="collection.format"
2488
+ :name="fileName"
2489
+ />
2490
+ </div>
2491
+ </template>
2492
+ <template #footer>
2493
+ <div class="flex w-full flex-wrap justify-end gap-2">
2494
+ <UButton variant="ghost" label="Keep editing" @click="siteConflictOpen = false" />
2495
+ <UButton v-if="siteConflict?.site" variant="outline" label="Use the site version" :loading="resolvingSite" @click="resolveSiteConflict('site')" />
2496
+ <UButton :label="siteConflict?.shared ? 'Keep the shared draft' : 'Keep my draft'" :disabled="!siteConflict" :loading="resolvingSite" @click="resolveSiteConflict('draft')" />
2497
+ </div>
2498
+ </template>
2499
+ </UModal>
2500
+
2501
+ <UModal
2502
+ :open="leaseDialogOpen"
2503
+ :title="holderLive ? holderName : holderName === 'You' ? 'You\'re editing this in another tab' : `${holderName} is editing this page`"
2504
+ :description="holderLive
2505
+ ? (liveDefinition ? 'Join to edit together. Everyone\'s edits save to the draft.' : 'Open it read-only until the live session ends.')
2506
+ : holderName === 'You' ? 'Open it read-only here, or take over from the other tab. Everything you saved stays in history.' : `Open it read-only, or take over. Everything ${holderName} saved stays in history.`"
2507
+ @update:open="(open) => { if (!open) openReadOnly() }"
2508
+ >
2509
+ <template v-if="leaseHolder?.since || liveUnavailableReason" #body>
2510
+ <p v-if="leaseHolder?.since" class="text-[13px] text-muted tabular-nums">{{ holderLive ? "Live since" : "Editing since" }} {{ consoleClockTime(leaseHolder.since) }}</p>
2511
+ <p v-if="liveUnavailableReason && !holderLive" class="mt-1 text-xs text-dimmed">{{ consoleLiveUnavailable }}</p>
2512
+ </template>
2513
+ <template #footer>
2514
+ <div class="flex w-full justify-end gap-2">
2515
+ <UButton color="neutral" variant="outline" label="Open read-only" @click="openReadOnly" />
2516
+ <UButton v-if="canWrite && holderLive && liveDefinition" color="neutral" label="Join" @click="joinLive" />
2517
+ <UButton v-else-if="canWrite && !holderLive" color="neutral" label="Take over" @click="takeOver" />
2518
+ </div>
2519
+ </template>
2520
+ </UModal>
2521
+
2522
+ <UModal
2523
+ :open="leaseCompareOpen && Boolean(leaseCompare)"
2524
+ :title="`${holderName === 'You' ? 'Your other tab' : holderName} took over`"
2525
+ description="Removed lines are in their saved version, added lines are on your screen."
2526
+ :ui="{ content: 'sm:max-w-3xl' }"
2527
+ @update:open="(open) => { if (!open) leaseCompareOpen = false }"
2528
+ >
2529
+ <template #body>
2530
+ <ConsoleDocumentDiff v-if="leaseCompare" :before="leaseCompare.theirs ? { body: leaseCompare.theirs.body, data: leaseCompare.theirs.data } : null" :after="leaseCompare.mine" :format="collection.format" :name="fileName" />
2531
+ </template>
2532
+ <template #footer>
2533
+ <div class="flex w-full justify-end gap-2">
2534
+ <UButton color="neutral" variant="ghost" label="Close" @click="leaseCompareOpen = false" />
2535
+ <UButton color="neutral" variant="outline" icon="i-lucide-copy" label="Copy mine" @click="copyUnsaved" />
2536
+ </div>
2537
+ </template>
2538
+ </UModal>
2539
+
2540
+ <UModal
2541
+ v-model:open="scheduleOpen"
2542
+ title="Schedule publishing"
2543
+ :description="`Publish this draft of ${title} later. Saving it again before then makes the schedule fail instead of publishing changes nobody reviewed.`"
2544
+ >
2545
+ <template #body>
2546
+ <div class="flex flex-wrap items-end gap-3">
2547
+ <UFormField label="Date" :ui="{ label: 'text-xs' }">
2548
+ <UInputDate v-model="scheduleDate" :min-value="scheduleMinDate" class="w-40" aria-label="Publish date" />
2549
+ </UFormField>
2550
+ <UFormField label="Time" :ui="{ label: 'text-xs' }">
2551
+ <UInputTime v-model="scheduleTime" :hour-cycle="24" class="w-24" aria-label="Publish time" />
2552
+ </UFormField>
2553
+ <span class="pb-2 text-xs text-dimmed">{{ timeZone }}</span>
2554
+ </div>
2555
+ <p v-if="scheduleInPast" class="mt-2 text-xs text-error">Choose a time in the future.</p>
2556
+ </template>
2557
+ <template #footer>
2558
+ <div class="flex w-full justify-end gap-2">
2559
+ <UButton variant="ghost" label="Cancel" @click="scheduleOpen = false" />
2560
+ <UButton label="Schedule" :disabled="!scheduleAt || scheduleInPast" :loading="scheduling" @click="scheduleDraft" />
2561
+ </div>
2562
+ </template>
2563
+ </UModal>
2564
+
2565
+ <UModal v-model:open="deleteOpen" :title="`Delete this ${noun.toLowerCase()}?`" :description="`${title} is removed from the draft. It stays on the published site until you publish the deletion, and History can restore it.`">
2566
+ <template #footer>
2567
+ <div class="flex w-full justify-end gap-2">
2568
+ <UButton variant="ghost" label="Cancel" @click="deleteOpen = false" />
2569
+ <UButton color="error" label="Delete" :loading="deleting" @click="remove" />
2570
+ </div>
2571
+ </template>
2572
+ </UModal>
2573
+
2574
+ <USlideover v-model:open="historyOpen" title="History" :description="`Saves and publishes of ${id}`" :ui="{ content: 'sm:max-w-xl', footer: 'justify-end' }">
2575
+ <template #body>
2576
+ <div v-if="preview" class="grid gap-3">
2577
+ <div class="flex items-center gap-2">
2578
+ <UButton variant="ghost" size="xs" icon="i-lucide-arrow-left" label="All versions" @click="preview = undefined" />
2579
+ </div>
2580
+ <div>
2581
+ <p class="text-sm font-medium text-highlighted">
2582
+ {{ consoleRevisionLabel(preview.revision) }} <ConsoleRelativeTime :value="preview.revision.createdAt" /><template v-if="preview.revision.author"> by {{ preview.revision.author }}</template>
2583
+ </p>
2584
+ <p class="text-xs text-muted">Compared with the saved draft.</p>
2585
+ </div>
2586
+ <div v-if="previewLoading" class="flex justify-center py-8"><UIcon name="i-lucide-loader-circle" class="size-4 animate-spin text-muted" /></div>
2587
+ <p v-else-if="!preview.document" class="text-xs text-muted">The {{ noun.toLowerCase() }} does not exist in this version.</p>
2588
+ <ConsoleDocumentDiff v-else :before="preview.current?.text ?? null" :after="preview.document.text" :format="collection.format" :name="fileName" />
2589
+ </div>
2590
+ <ConsoleDocumentHistory
2591
+ v-else
2592
+ :revisions="revisions"
2593
+ :cursor="revisionsCursor"
2594
+ :loading="revisionsLoading"
2595
+ :error="revisionsError"
2596
+ :loaded-at="revisionsLoadedAt"
2597
+ @open="openRevision"
2598
+ @more="loadRevisions(true)"
2599
+ />
2600
+ </template>
2601
+ <template v-if="preview?.document && editable && !local" #footer>
2602
+ <UButton icon="i-lucide-rotate-ccw" label="Restore this version" :loading="restoring" @click="restore" />
2603
+ </template>
2604
+ </USlideover>
2605
+ </template>