pi-roundtable-web 0.28.0 → 0.29.1

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 (236) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +4 -4
  3. package/dist/chunk-account-66e6ezdq.js +1 -0
  4. package/dist/{chunk-action-menu-qpp9bdxh.js → chunk-action-menu-ap5xn7bf.js} +1 -1
  5. package/dist/chunk-agent-sapt5qhn.js +1 -0
  6. package/dist/chunk-arranged-rooms-n6bk696f.js +1 -0
  7. package/dist/chunk-attachments-p5v9gqyt.js +102 -0
  8. package/dist/chunk-bulk-actions-aze4ewc4.js +1 -0
  9. package/dist/chunk-character-creator-m7tw20ef.js +225 -0
  10. package/dist/{chunk-codeeditor-jgj32247.js → chunk-codeeditor-yy6pq8mv.js} +2 -2
  11. package/dist/chunk-confirm-0cajsfhk.js +1 -0
  12. package/dist/chunk-connectors-tw0tbm21.js +37 -0
  13. package/dist/chunk-conversations-wkm23m5r.js +1 -0
  14. package/dist/chunk-council-sheet-mz7s23nq.js +2 -0
  15. package/dist/chunk-council-view-zgvzxtgn.js +1 -0
  16. package/dist/{chunk-drag-04qfef58.js → chunk-drag-d1bpy8w6.js} +1 -1
  17. package/dist/{chunk-entry-mws704mc.js → chunk-entry-7zr5b1fp.js} +1 -1
  18. package/dist/chunk-folder-list-bs4eh3g9.js +1 -0
  19. package/dist/chunk-folds-eez1q41c.js +1 -0
  20. package/dist/{chunk-gate-vxetvn8t.js → chunk-gate-dt91egcd.js} +1 -1
  21. package/dist/chunk-host-icons-nfe2t8tk.js +1 -0
  22. package/dist/chunk-host-picture-4rtswxwa.js +1 -0
  23. package/dist/chunk-host-state-1vxzmmq6.js +1 -0
  24. package/dist/chunk-host-ui-x38bf0et.js +1 -0
  25. package/dist/{chunk-index-zj0gjcvr.js → chunk-index-0h99xcs3.js} +2 -2
  26. package/dist/{chunk-index-e2gy763y.js → chunk-index-1kb8tv4v.js} +2 -2
  27. package/dist/chunk-index-24cggw6k.js +50 -0
  28. package/dist/chunk-index-2g8xtwqg.js +2 -0
  29. package/dist/chunk-index-3n38xe7m.js +2 -0
  30. package/dist/{chunk-index-n0cmnwd2.js → chunk-index-3tksdmx7.js} +2 -2
  31. package/dist/{chunk-index-2822z600.js → chunk-index-4a1tdadd.js} +3 -3
  32. package/dist/{chunk-index-2syyyjnq.js → chunk-index-53fwc7sc.js} +2 -2
  33. package/dist/chunk-index-55ps4x5n.js +2 -0
  34. package/dist/{chunk-index-q5fyrtx4.js → chunk-index-5j1v2q7w.js} +1 -1
  35. package/dist/chunk-index-5w6tb7p0.js +2 -0
  36. package/dist/chunk-index-6btdp13p.js +2 -0
  37. package/dist/chunk-index-6m7dwsmv.js +1 -0
  38. package/dist/{chunk-index-20xgx0k2.js → chunk-index-6rdywten.js} +2 -2
  39. package/dist/{chunk-index-3gfbhmpb.js → chunk-index-6s2pqwna.js} +2 -2
  40. package/dist/{chunk-index-fepsbhr6.js → chunk-index-7mrkq793.js} +2 -2
  41. package/dist/chunk-index-7xcbpeqz.js +2 -0
  42. package/dist/chunk-index-88wh5eyj.js +2 -0
  43. package/dist/{chunk-index-6cg8xp1c.js → chunk-index-8pbwr3rs.js} +1 -1
  44. package/dist/{chunk-index-jc3r4qam.js → chunk-index-8wpvj7k5.js} +2 -2
  45. package/dist/chunk-index-97dcp1vh.js +1 -0
  46. package/dist/chunk-index-a7e6rhxy.js +2 -0
  47. package/dist/{chunk-index-2tr41qht.js → chunk-index-bxf8eq1s.js} +2 -2
  48. package/dist/chunk-index-c8gm1crh.js +120 -0
  49. package/dist/{chunk-index-2y8r4s4f.js → chunk-index-ce7hsda9.js} +2 -2
  50. package/dist/chunk-index-cfesmk1f.js +2 -0
  51. package/dist/{chunk-index-m81362sc.js → chunk-index-cmzvq3nf.js} +1 -1
  52. package/dist/{chunk-index-7qd604rq.js → chunk-index-d4mx2vvf.js} +1 -1
  53. package/dist/chunk-index-d74tpnkd.js +2 -0
  54. package/dist/chunk-index-d941ae7c.js +2 -0
  55. package/dist/{chunk-index-e35v554x.js → chunk-index-dr0jr7d3.js} +3 -3
  56. package/dist/chunk-index-en728705.js +2 -0
  57. package/dist/chunk-index-fb3kzyyp.js +2 -0
  58. package/dist/{chunk-index-3yy10a5h.js → chunk-index-ffnd0jcj.js} +2 -2
  59. package/dist/chunk-index-fn6305vn.js +3 -0
  60. package/dist/{chunk-index-zcfr8jdv.js → chunk-index-gdh7wsd5.js} +12 -12
  61. package/dist/{chunk-index-2hvn2kte.js → chunk-index-m76gdwnk.js} +2 -2
  62. package/dist/chunk-index-mr391t49.js +2 -0
  63. package/dist/chunk-index-n3khm9fq.js +2 -0
  64. package/dist/{chunk-index-sm7kfb07.js → chunk-index-nn4w6a04.js} +2 -2
  65. package/dist/{chunk-index-gwkhs8s3.js → chunk-index-nr275sa7.js} +2 -2
  66. package/dist/{chunk-index-x60n1me6.js → chunk-index-pgxgq61x.js} +2 -2
  67. package/dist/chunk-index-prq011b6.js +2 -0
  68. package/dist/{chunk-index-v9gbt5tz.js → chunk-index-q4k9vk04.js} +19 -3
  69. package/dist/chunk-index-rgdaec7y.js +2 -0
  70. package/dist/chunk-index-rjs1can6.js +2 -0
  71. package/dist/chunk-index-s4a8e4qm.js +2 -0
  72. package/dist/{chunk-index-s9p27f9b.js → chunk-index-sz381vda.js} +3 -3
  73. package/dist/{chunk-index-5hbq6g2e.css → chunk-index-t7csmbpy.css} +1 -1
  74. package/dist/{chunk-index-rgf4rvns.js → chunk-index-v9jqyr1f.js} +3 -3
  75. package/dist/{chunk-index-rsd8rftk.js → chunk-index-vpq2cj14.js} +2 -2
  76. package/dist/chunk-index-vsaggfns.js +2 -0
  77. package/dist/{chunk-index-p7jkr7gv.js → chunk-index-w17wgjby.js} +5 -5
  78. package/dist/{chunk-index-c7dbvkrq.js → chunk-index-wgrx2ybn.js} +2 -2
  79. package/dist/chunk-index-wsv46y9p.js +2 -0
  80. package/dist/{chunk-index-4t6vnwap.js → chunk-index-xbj816p0.js} +2 -2
  81. package/dist/{chunk-index-s53bxwkk.js → chunk-index-yr758n6t.js} +2 -2
  82. package/dist/{chunk-index-5t2jkecy.js → chunk-index-ysv36nbk.js} +2 -2
  83. package/dist/{chunk-index-zt19fdmc.js → chunk-index-ze9p4npm.js} +2 -2
  84. package/dist/chunk-index-zfdvyrjt.js +2 -0
  85. package/dist/chunk-lang-css-3h22se37.js +1 -0
  86. package/dist/{chunk-lang-dockerfile-n4bt8jbt.js → chunk-lang-dockerfile-y24eejnh.js} +1 -1
  87. package/dist/{chunk-lang-go-9k4y107e.js → chunk-lang-go-qzgv1161.js} +3 -3
  88. package/dist/chunk-lang-html-9rvrmmpg.js +1 -0
  89. package/dist/chunk-lang-javascript-4kv8s3tk.js +1 -0
  90. package/dist/{chunk-lang-json-hr12bzs1.js → chunk-lang-json-99v80v88.js} +1 -1
  91. package/dist/{chunk-lang-markdown-ttzcpgkg.js → chunk-lang-markdown-gn8he877.js} +4 -4
  92. package/dist/{chunk-lang-python-ntj8maem.js → chunk-lang-python-prsw4p4k.js} +2 -2
  93. package/dist/{chunk-lang-rust-gv8y859d.js → chunk-lang-rust-g6xqta16.js} +1 -1
  94. package/dist/{chunk-lang-shell-5zzs09b7.js → chunk-lang-shell-dmpnzc6w.js} +1 -1
  95. package/dist/{chunk-lang-sql-6vmze4pg.js → chunk-lang-sql-wz7ca27b.js} +2 -2
  96. package/dist/{chunk-lang-toml-tt0d4rw9.js → chunk-lang-toml-160prtq4.js} +1 -1
  97. package/dist/chunk-lang-typescript-mp0yw903.js +1 -0
  98. package/dist/{chunk-lang-xml-r2sbqnjv.js → chunk-lang-xml-9htkz2dd.js} +1 -1
  99. package/dist/{chunk-lang-yaml-ex31qbph.js → chunk-lang-yaml-08749wd5.js} +1 -1
  100. package/dist/chunk-layout-actions-tdx896xf.js +1 -0
  101. package/dist/chunk-menu-items-trhybv1g.js +1 -0
  102. package/dist/chunk-mode-toggle-4dtfphq4.js +1 -0
  103. package/dist/{chunk-note-row-40ypghn9.js → chunk-note-row-28e5x7n8.js} +33 -4
  104. package/dist/chunk-notes-5nkayhw8.js +1 -0
  105. package/dist/chunk-notice-bell-xz8a04am.js +1 -0
  106. package/dist/{chunk-notices-tefx93s6.js → chunk-notices-d0cwvk27.js} +1 -1
  107. package/dist/chunk-onboarding-zs4rtea9.js +1 -0
  108. package/dist/{chunk-overview-zrx3bpwf.js → chunk-overview-9sb3ywa8.js} +1 -1
  109. package/dist/chunk-palette-5sfhrv4x.js +1 -0
  110. package/dist/chunk-placement-items-e2neja55.js +1 -0
  111. package/dist/{chunk-profile-tyb48b79.js → chunk-profile-jffhtpqf.js} +1 -1
  112. package/dist/chunk-prompt-history-1jz2gk3v.js +1 -0
  113. package/dist/chunk-prompts-0t30ttd0.js +1 -0
  114. package/dist/chunk-room-confirms-6595921h.js +1 -0
  115. package/dist/{chunk-room-menu-ha1evv71.js → chunk-room-menu-hwkjyxwe.js} +1 -1
  116. package/dist/chunk-rooms-menu-button-k0eq1tcr.js +1 -0
  117. package/dist/{chunk-schedules-a5pewkhd.js → chunk-schedules-e12y8fw2.js} +1 -1
  118. package/dist/{chunk-seat-menu-eh3ymmks.js → chunk-seat-menu-n2bcw0mf.js} +1 -1
  119. package/dist/chunk-sheet-hosts-myvm2vhd.js +29 -0
  120. package/dist/chunk-shortcut-help-434sqnxc.js +26 -0
  121. package/dist/chunk-shortcuts-mjxph0g7.js +1 -0
  122. package/dist/chunk-skill-editor-98492yrt.js +8 -0
  123. package/dist/chunk-skills-mfv8ppfh.js +1 -0
  124. package/dist/chunk-start-over-line-m526193z.js +16 -0
  125. package/dist/{chunk-switcher-list-dtfh87zy.js → chunk-switcher-list-5ngjar24.js} +1 -1
  126. package/dist/{chunk-tab-dot-qd640mjr.js → chunk-tab-dot-tzjkahj5.js} +1 -1
  127. package/dist/chunk-table-xbtbex2z.js +1 -0
  128. package/dist/{chunk-table2d-5nrhfwft.js → chunk-table2d-61bvrykm.js} +1 -1
  129. package/dist/{chunk-table3d-5cb66d99.js → chunk-table3d-5a7vbgyj.js} +172 -172
  130. package/dist/chunk-thread-actions-bf6vf2mt.js +1 -0
  131. package/dist/{chunk-thread-cards-kgt22sbp.js → chunk-thread-cards-n0n603vf.js} +1 -1
  132. package/dist/chunk-thread-list-7bkdn51x.js +227 -0
  133. package/dist/{chunk-transcript-a0p3vwh6.js → chunk-transcript-8ztrkt6g.js} +1 -1
  134. package/dist/chunk-waiting-chip-y83c90v3.js +32 -0
  135. package/dist/chunk-waiting-s273kcgz.js +1 -0
  136. package/dist/chunk-where-jr791gzj.js +1 -0
  137. package/dist/chunk-workspace-dw71mshw.js +586 -0
  138. package/dist/chunk-zh-tw-vm5d0w6j.js +1 -0
  139. package/dist/index.html +1 -1
  140. package/dist/sw.js +1 -1
  141. package/package.json +3 -3
  142. package/src/api-types.ts +51 -0
  143. package/src/app/app.ts +7 -0
  144. package/src/app/card-log.ts +10 -2
  145. package/src/app/protocol.ts +18 -0
  146. package/src/app/queued-delivery.ts +107 -0
  147. package/src/app/queued-frames.ts +115 -0
  148. package/src/app/room-log.ts +39 -7
  149. package/src/app/rooms.ts +30 -2
  150. package/src/app/routes.ts +123 -7
  151. package/src/app/skill-group-routes.ts +126 -0
  152. package/src/app/socket.ts +12 -2
  153. package/src/app/surface.ts +37 -6
  154. package/src/app/zip.ts +124 -0
  155. package/src/auth/sessions.ts +9 -1
  156. package/src/authz.ts +1 -0
  157. package/src/host/cards.ts +10 -3
  158. package/src/host/stored-json.ts +23 -0
  159. package/src/i18n/zh-tw.ts +45 -2
  160. package/src/notices/mount.ts +1 -0
  161. package/src/notices/store.ts +9 -1
  162. package/src/push/channel.ts +1 -0
  163. package/src/web-plugin.ts +5 -1
  164. package/dist/chunk-account-678dgbww.js +0 -1
  165. package/dist/chunk-agent-x0yvvdq2.js +0 -1
  166. package/dist/chunk-arranged-rooms-6rdkk8t1.js +0 -1
  167. package/dist/chunk-bulk-actions-zbwdaxtc.js +0 -1
  168. package/dist/chunk-character-creator-215psy17.js +0 -1
  169. package/dist/chunk-confirm-2pzrt272.js +0 -1
  170. package/dist/chunk-connectors-zha2d834.js +0 -37
  171. package/dist/chunk-conversations-fb071rez.js +0 -1
  172. package/dist/chunk-council-sheet-k5fycefd.js +0 -2
  173. package/dist/chunk-folder-list-qxhmczwv.js +0 -1
  174. package/dist/chunk-folds-b7asegfs.js +0 -1
  175. package/dist/chunk-group-scene-63yhh1mh.js +0 -1
  176. package/dist/chunk-group-table-zy4hmgk3.js +0 -1
  177. package/dist/chunk-host-icons-tyktazzz.js +0 -1
  178. package/dist/chunk-host-picture-ebhejn2k.js +0 -1
  179. package/dist/chunk-host-state-wajep0yr.js +0 -1
  180. package/dist/chunk-host-ui-pc9r24e3.js +0 -1
  181. package/dist/chunk-index-1af8vsyb.js +0 -2
  182. package/dist/chunk-index-254701sm.js +0 -3
  183. package/dist/chunk-index-31m1b2f5.js +0 -2
  184. package/dist/chunk-index-5vatmakn.js +0 -2
  185. package/dist/chunk-index-6yra9kdq.js +0 -2
  186. package/dist/chunk-index-9bdstf8t.js +0 -2
  187. package/dist/chunk-index-acj4xxgq.js +0 -100
  188. package/dist/chunk-index-aexy023z.js +0 -2
  189. package/dist/chunk-index-amxa2bn3.js +0 -2
  190. package/dist/chunk-index-bef0fc2m.js +0 -2
  191. package/dist/chunk-index-c6tphrjr.js +0 -1
  192. package/dist/chunk-index-cn49mawx.js +0 -50
  193. package/dist/chunk-index-gcmmwh8t.js +0 -2
  194. package/dist/chunk-index-h2vhv4kh.js +0 -2
  195. package/dist/chunk-index-h9ccz1r3.js +0 -2
  196. package/dist/chunk-index-n0ejy0wd.js +0 -2
  197. package/dist/chunk-index-nkdg1dfz.js +0 -7
  198. package/dist/chunk-index-qxynr1hf.js +0 -2
  199. package/dist/chunk-index-r7fdgzy1.js +0 -2
  200. package/dist/chunk-index-sdcpf5dp.js +0 -2
  201. package/dist/chunk-index-sw9r4aa4.js +0 -2
  202. package/dist/chunk-index-t5bmsqqd.js +0 -1
  203. package/dist/chunk-index-v8mma5np.js +0 -2
  204. package/dist/chunk-index-vsfsv8hd.js +0 -2
  205. package/dist/chunk-index-wxft0aqb.js +0 -2
  206. package/dist/chunk-index-zvvwxkev.js +0 -2
  207. package/dist/chunk-lang-css-7q1dtpgm.js +0 -1
  208. package/dist/chunk-lang-html-xgvba8rn.js +0 -1
  209. package/dist/chunk-lang-javascript-vgxmgd0a.js +0 -1
  210. package/dist/chunk-lang-typescript-2v652sh5.js +0 -1
  211. package/dist/chunk-layout-actions-bfqtg71d.js +0 -1
  212. package/dist/chunk-menu-items-rztgekfj.js +0 -1
  213. package/dist/chunk-mode-toggle-m5kgb7c7.js +0 -1
  214. package/dist/chunk-notes-a8nqffbf.js +0 -1
  215. package/dist/chunk-notice-bell-rdnfmtf2.js +0 -1
  216. package/dist/chunk-onboarding-wvh0s3vg.js +0 -1
  217. package/dist/chunk-palette-5xtdvy9a.js +0 -1
  218. package/dist/chunk-placement-items-rgyrktvy.js +0 -1
  219. package/dist/chunk-prompt-history-wv0vdsjv.js +0 -1
  220. package/dist/chunk-prompts-75hgb0t0.js +0 -1
  221. package/dist/chunk-room-confirms-bcvhpcry.js +0 -1
  222. package/dist/chunk-rooms-menu-button-ej3a2hyc.js +0 -1
  223. package/dist/chunk-sheet-hosts-d5zbwbbr.js +0 -29
  224. package/dist/chunk-shortcut-help-bh9ntk9s.js +0 -26
  225. package/dist/chunk-shortcuts-6em0atk9.js +0 -1
  226. package/dist/chunk-skill-editor-e43mwz01.js +0 -8
  227. package/dist/chunk-skills-vp107wrp.js +0 -1
  228. package/dist/chunk-start-over-line-xd1v2p0g.js +0 -16
  229. package/dist/chunk-table-svb2xhfd.js +0 -1
  230. package/dist/chunk-thread-actions-926eab0w.js +0 -1
  231. package/dist/chunk-thread-list-j2v1pqkz.js +0 -217
  232. package/dist/chunk-waiting-cdyz7r1g.js +0 -1
  233. package/dist/chunk-waiting-chip-58ttx9av.js +0 -28
  234. package/dist/chunk-where-9jp6g029.js +0 -1
  235. package/dist/chunk-workspace-d34njy4p.js +0 -578
  236. package/dist/chunk-zh-tw-y3jb20wc.js +0 -1
@@ -1,578 +0,0 @@
1
- import{p,dn,A,Se,o,z,$e,C,a,r,t,u,g,e,n,s,x,Oi,I,Zi,de,h,d,f,v,m,k,T,_,re,Ne,Ce}from"./chunk-index-cn49mawx.js";import{q}from"./chunk-index-qxynr1hf.js";import{Te}from"./chunk-index-e35v554x.js";import{ie}from"./chunk-index-sw9r4aa4.js";import{se}from"./chunk-index-amxa2bn3.js";import{R}from"./chunk-index-m81362sc.js";function dt(i,l,c){let[b,w]=r();o(()=>{if(!i)return;let E=(y)=>y.preventDefault(),O=(y)=>{if(y.button!==0||y.metaKey||y.ctrlKey||y.shiftKey||y.altKey)return;let W=y.target instanceof Element?y.target.closest("a"):null;if(!W||W.target||W.hasAttribute("download"))return;if(l.current?.contains(W))return;y.preventDefault(),y.stopPropagation(),w({kind:"link",anchor:W})},L=Oi((y)=>w({kind:"navigate",proceed:y}));return window.addEventListener("beforeunload",E),document.addEventListener("click",O,!0),()=>{L(),window.removeEventListener("beforeunload",E),document.removeEventListener("click",O,!0)}},[i,l]);let N=A(()=>w(void 0),[]),S=A(()=>{let E=b;if(c(),w(void 0),E?.kind==="link")setTimeout(()=>E.anchor.click(),0);else if(E?.kind==="navigate")E.proceed()},[b,c]);return{leaving:b,stay:N,leave:S}}var le=(i)=>`workspace/${encodeURIComponent(i)}`,xe=(i)=>`path=${encodeURIComponent(i)}`,_e=(i)=>({body:JSON.stringify(i)});function Ue(i){if(!(i instanceof de)||i.status!==409)return;let l=i.body;return l?.conflict==="changed"||l?.conflict==="gone"||l?.conflict==="exists"?l:void 0}var j={roots:()=>h("workspace"),list:(i,l)=>h(`${le(i)}/list?${xe(l)}`),file:(i,l)=>h(`${le(i)}/file?${xe(l)}`),save:(i,l,c,b)=>h(`${le(i)}/file?${xe(l)}`,{method:"PUT",..._e({text:c,baseHash:b})}),create:(i,l,c,b)=>h(`${le(i)}/new?${xe(l)}`,{method:"POST",..._e({kind:c,...b===void 0?{}:{text:b}})}),rename:(i,l,c)=>h(`${le(i)}/rename`,{method:"POST",..._e({from:l,to:c})}),remove:(i,l)=>h(`${le(i)}/entry?${xe(l)}`,{method:"DELETE"}),trash:(i)=>h(`${le(i)}/trash`),restore:(i,l)=>h(`${le(i)}/trash/${encodeURIComponent(l)}/restore`,{method:"POST"}),purge:(i,l)=>h(`${le(i)}/trash/${encodeURIComponent(l)}`,{method:"DELETE"})},we=(i,l,c=!1)=>`api/${le(i)}/raw?${xe(l)}${c?"&download=1":""}`;var ze=(i)=>i.split("/").filter(Boolean),ve=(i)=>ze(i).slice(0,-1).join("/"),Ee=(i,l)=>i?`${i}/${l}`:l,Me=(i)=>`${i.root}:${i.path}${i.dir&&i.path?"/":""}`;function lt(i){if(!i)return;let l=i.indexOf(":");if(l<1)return;let c=i.slice(l+1);return{root:i.slice(0,l),path:c.replace(/\/+$/,""),dir:c===""||c.endsWith("/")}}var ct=`/*
2
- * The files pane: roots, a tree, breadcrumbs, a folder's rows, and a file in the editor. Colors
3
- * are the page's tokens and the --code-* set (tokens.css, styles/camelot.css), so a look or a
4
- * light/dark switch recolors it with nothing rebuilt. Only transform and opacity ever move.
5
- */
6
-
7
- .ws-page {
8
- display: flex;
9
- flex-direction: column;
10
- min-height: 0;
11
- flex: 1;
12
- }
13
-
14
- .ws {
15
- height: 100%;
16
- }
17
-
18
- /* ── Header and breadcrumbs ─────────────────────────────────────────────────────────────────────── */
19
-
20
- .ws-head {
21
- display: flex;
22
- align-items: center;
23
- gap: var(--space-2);
24
- min-height: var(--touch);
25
- padding: var(--space-1) var(--space-3);
26
- border-bottom: 1px solid var(--border);
27
- background: var(--surface);
28
- }
29
-
30
- .ws-root-picker {
31
- width: auto;
32
- min-width: 9rem;
33
- max-width: 14rem;
34
- flex: none;
35
- }
36
-
37
- .ws-crumbs {
38
- flex: 1;
39
- min-width: 0;
40
- display: flex;
41
- align-items: center;
42
- gap: var(--space-1);
43
- overflow-x: auto;
44
- scrollbar-width: none;
45
- white-space: nowrap;
46
- font-size: var(--text-sm);
47
- -webkit-overflow-scrolling: touch;
48
- }
49
-
50
- .ws-crumbs::-webkit-scrollbar {
51
- display: none;
52
- }
53
-
54
- .ws-crumbs a {
55
- flex: none;
56
- display: inline-flex;
57
- align-items: center;
58
- min-height: 2rem;
59
- padding: 0 var(--space-3);
60
- border-radius: var(--radius-full);
61
- background: var(--surface-2);
62
- color: var(--text);
63
- text-decoration: none;
64
- max-width: 14rem;
65
- overflow: hidden;
66
- text-overflow: ellipsis;
67
- }
68
-
69
- .ws-crumbs a[aria-current="page"] {
70
- background: var(--accent-soft);
71
- color: var(--accent-ink);
72
- font-weight: var(--weight-medium);
73
- }
74
-
75
- .ws-crumbs a:hover {
76
- background: var(--surface-3);
77
- }
78
-
79
- .ws-crumbs a + a::before {
80
- content: "/";
81
- margin-right: var(--space-2);
82
- color: var(--muted);
83
- }
84
-
85
- .ws-head-actions {
86
- flex: none;
87
- display: flex;
88
- gap: 0;
89
- }
90
-
91
- /* ── Body: tree and main ────────────────────────────────────────────────────────────────────────── */
92
-
93
- .ws-body {
94
- flex: 1;
95
- min-height: 0;
96
- display: flex;
97
- }
98
-
99
- .ws-main {
100
- flex: 1;
101
- min-width: 0;
102
- min-height: 0;
103
- display: flex;
104
- flex-direction: column;
105
- overflow: auto;
106
- }
107
-
108
- .ws-tree {
109
- flex: none;
110
- width: var(--ws-tree, 280px);
111
- overflow: auto;
112
- padding: var(--space-2) 0;
113
- border-right: 1px solid var(--border);
114
- background: var(--surface);
115
- font-size: var(--text-sm);
116
- }
117
-
118
- .ws-resizer {
119
- flex: none;
120
- width: 6px;
121
- margin-left: -3px;
122
- margin-right: -3px;
123
- z-index: 1;
124
- cursor: col-resize;
125
- touch-action: none;
126
- }
127
-
128
- .ws-resizer:hover,
129
- .ws-resizer:focus-visible {
130
- background: var(--accent-soft);
131
- outline: none;
132
- }
133
-
134
- .ws-tree-list {
135
- list-style: none;
136
- margin: 0;
137
- padding: 0;
138
- }
139
-
140
- .ws-tree-row {
141
- display: flex;
142
- align-items: center;
143
- min-height: 1.875rem;
144
- padding-right: var(--space-2);
145
- }
146
-
147
- .ws-tree-row a,
148
- .ws-tree-off {
149
- flex: 1;
150
- min-width: 0;
151
- display: flex;
152
- align-items: center;
153
- gap: var(--space-2);
154
- min-height: 1.75rem;
155
- padding: 0 var(--space-2);
156
- border-radius: var(--radius-sm);
157
- color: var(--text);
158
- text-decoration: none;
159
- }
160
-
161
- .ws-tree-label {
162
- overflow: hidden;
163
- text-overflow: ellipsis;
164
- white-space: nowrap;
165
- }
166
-
167
- .ws-tree-row a:hover {
168
- background: var(--surface-2);
169
- }
170
-
171
- .ws-tree-row[data-selected] a {
172
- background: var(--accent-soft);
173
- color: var(--accent-ink);
174
- }
175
-
176
- .ws-tree-row[data-quiet] {
177
- opacity: 0.6;
178
- }
179
-
180
- .ws-tree-off {
181
- color: var(--muted);
182
- cursor: not-allowed;
183
- }
184
-
185
- .ws-tree-note {
186
- margin: 0;
187
- padding: var(--space-1) var(--space-3);
188
- color: var(--muted);
189
- font-size: var(--text-xs);
190
- }
191
-
192
- .ws-twist {
193
- flex: none;
194
- display: inline-grid;
195
- place-items: center;
196
- width: 1.5rem;
197
- min-width: 1.5rem;
198
- height: 1.5rem;
199
- min-height: 1.5rem;
200
- padding: 0;
201
- border: none;
202
- background: transparent;
203
- color: var(--muted);
204
- }
205
-
206
- .ws-twist svg {
207
- transition: transform var(--dur-fast) var(--ease-out);
208
- }
209
-
210
- .ws-twist[aria-expanded="true"] svg {
211
- transform: rotate(90deg);
212
- }
213
-
214
- /* ── A folder ───────────────────────────────────────────────────────────────────────────────────── */
215
-
216
- .ws-dir {
217
- padding: var(--space-2) var(--space-3)
218
- calc(var(--space-6) + var(--safe-bottom));
219
- display: flex;
220
- flex-direction: column;
221
- gap: var(--space-3);
222
- }
223
-
224
- /* The folder on show: while the next one is fetched it stays, dimmed after a beat, so a quick switch shows no change at all. */
225
- .ws-listing {
226
- display: flex;
227
- flex-direction: column;
228
- gap: var(--space-3);
229
- transition: opacity var(--dur-fast) var(--ease-out) 150ms;
230
- }
231
-
232
- .ws-listing[data-pending] {
233
- opacity: 0.55;
234
- }
235
-
236
- .ws-rows {
237
- list-style: none;
238
- margin: 0;
239
- padding: 0;
240
- display: flex;
241
- flex-direction: column;
242
- }
243
-
244
- .ws-row {
245
- display: flex;
246
- align-items: center;
247
- border-bottom: 1px solid var(--border);
248
- }
249
-
250
- .ws-row[data-quiet] {
251
- opacity: 0.6;
252
- }
253
-
254
- .ws-row-link {
255
- flex: 1;
256
- min-width: 0;
257
- display: flex;
258
- align-items: center;
259
- gap: var(--space-3);
260
- min-height: 3rem;
261
- padding: var(--space-2) var(--space-1);
262
- color: var(--text);
263
- text-decoration: none;
264
- }
265
-
266
- .ws-row-link[data-off] {
267
- color: var(--muted);
268
- }
269
-
270
- a.ws-row-link:hover {
271
- background: var(--surface-2);
272
- }
273
-
274
- .ws-row-icon {
275
- flex: none;
276
- color: var(--muted);
277
- }
278
-
279
- .ws-row-main {
280
- min-width: 0;
281
- display: flex;
282
- flex-direction: column;
283
- }
284
-
285
- .ws-row-main strong {
286
- overflow: hidden;
287
- text-overflow: ellipsis;
288
- white-space: nowrap;
289
- font-weight: var(--weight-medium);
290
- }
291
-
292
- /* ── A file ─────────────────────────────────────────────────────────────────────────────────────── */
293
-
294
- .ws-file {
295
- flex: 1;
296
- min-height: 0;
297
- min-width: 0;
298
- display: flex;
299
- flex-direction: column;
300
- }
301
-
302
- .ws-file-head {
303
- flex: none;
304
- display: flex;
305
- align-items: center;
306
- gap: var(--space-3);
307
- flex-wrap: wrap;
308
- padding: var(--space-2) var(--space-3);
309
- border-bottom: 1px solid var(--border);
310
- background: var(--surface);
311
- }
312
-
313
- .ws-file-title {
314
- flex: 1;
315
- min-width: 8rem;
316
- display: flex;
317
- flex-direction: column;
318
- }
319
-
320
- .ws-file-title strong {
321
- overflow: hidden;
322
- text-overflow: ellipsis;
323
- white-space: nowrap;
324
- }
325
-
326
- .ws-actions {
327
- flex: none;
328
- display: flex;
329
- align-items: center;
330
- gap: var(--space-2);
331
- }
332
-
333
- .ws-banner {
334
- flex: none;
335
- display: flex;
336
- align-items: center;
337
- gap: var(--space-2);
338
- flex-wrap: wrap;
339
- padding: var(--space-2) var(--space-3);
340
- background: var(--warn-soft);
341
- color: var(--warn);
342
- border-bottom: 1px solid var(--warn);
343
- font-size: var(--text-sm);
344
- }
345
-
346
- .ws-banner-text {
347
- flex: 1;
348
- min-width: 10rem;
349
- }
350
-
351
- .ws-view {
352
- flex: 1;
353
- min-height: 0;
354
- display: flex;
355
- flex-direction: column;
356
- background: var(--code-bg);
357
- }
358
-
359
- .ws-editor {
360
- flex: 1;
361
- min-height: 0;
362
- display: flex;
363
- flex-direction: column;
364
- background: var(--code-bg);
365
- }
366
-
367
- .ws-editor .cm-editor {
368
- flex: 1;
369
- min-height: 0;
370
- }
371
-
372
- /* Editor font is 16px on a phone so a focus does not zoom the page; 13px beside a mouse. */
373
- .ws-editor {
374
- --code-size: 16px;
375
- }
376
-
377
- @media (min-width: 720px) {
378
- .ws-editor {
379
- --code-size: 13px;
380
- }
381
- }
382
-
383
- /* Before the editor's code has arrived, and where it cannot load, the text is shown plainly. */
384
- .ws-plain {
385
- flex: 1;
386
- margin: 0;
387
- padding: var(--space-3);
388
- overflow: auto;
389
- font-family: var(--font-mono);
390
- font-size: var(--code-size);
391
- line-height: 1.55;
392
- color: var(--code-fg);
393
- tab-size: 2;
394
- }
395
-
396
- .ws-media {
397
- flex: 1;
398
- min-height: 0;
399
- display: flex;
400
- flex-direction: column;
401
- }
402
-
403
- .ws-image {
404
- display: grid;
405
- place-items: center;
406
- padding: var(--space-4);
407
- overflow: auto;
408
- background-color: var(--surface-2);
409
- background-image:
410
- linear-gradient(
411
- 45deg,
412
- var(--surface-3, var(--border)) 25%,
413
- transparent 25%,
414
- transparent 75%,
415
- var(--surface-3, var(--border)) 75%
416
- ),
417
- linear-gradient(
418
- 45deg,
419
- var(--surface-3, var(--border)) 25%,
420
- transparent 25%,
421
- transparent 75%,
422
- var(--surface-3, var(--border)) 75%
423
- );
424
- background-size: 16px 16px;
425
- background-position:
426
- 0 0,
427
- 8px 8px;
428
- }
429
-
430
- .ws-image-toggle {
431
- display: grid;
432
- place-items: center;
433
- max-width: 100%;
434
- max-height: 100%;
435
- padding: 0;
436
- border: 0;
437
- background: none;
438
- cursor: zoom-in;
439
- }
440
-
441
- .ws-image[data-actual] .ws-image-toggle {
442
- max-width: none;
443
- max-height: none;
444
- cursor: zoom-out;
445
- }
446
-
447
- .ws-image img {
448
- max-width: 100%;
449
- max-height: 100%;
450
- object-fit: contain;
451
- }
452
-
453
- .ws-image[data-actual] img {
454
- max-width: none;
455
- max-height: none;
456
- }
457
-
458
- .ws-pdf-frame {
459
- gap: var(--space-2);
460
- }
461
-
462
- .ws-pdf {
463
- flex: 1;
464
- min-height: 0;
465
- width: 100%;
466
- border: 0;
467
- background: var(--surface-2);
468
- }
469
-
470
- .ws-media-actions {
471
- display: flex;
472
- flex-wrap: wrap;
473
- gap: var(--space-3);
474
- padding: var(--space-2) var(--space-4);
475
- }
476
-
477
- .ws-sound,
478
- .ws-film {
479
- align-items: center;
480
- justify-content: center;
481
- padding: var(--space-4);
482
- background: var(--surface-2);
483
- }
484
-
485
- .ws-sound audio,
486
- .ws-film video {
487
- width: 100%;
488
- max-height: 100%;
489
- }
490
-
491
- .ws-card-icon {
492
- color: var(--muted, inherit);
493
- }
494
-
495
- .ws-card {
496
- margin: var(--space-4);
497
- display: flex;
498
- flex-direction: column;
499
- align-items: flex-start;
500
- gap: var(--space-3);
501
- }
502
-
503
- .ws-card p {
504
- margin: 0;
505
- }
506
-
507
- .button-link {
508
- display: inline-flex;
509
- align-items: center;
510
- gap: var(--space-2);
511
- min-height: 2.5rem;
512
- padding: 0 var(--space-4);
513
- border-radius: var(--radius);
514
- background: var(--accent);
515
- color: var(--on-accent);
516
- text-decoration: none;
517
- font-weight: var(--weight-medium);
518
- }
519
-
520
- /* The bar of the phone's editor: above the keyboard, whose height the layout already follows. */
521
- .ws-editbar {
522
- flex: none;
523
- display: flex;
524
- gap: var(--space-2);
525
- overflow-x: auto;
526
- padding: var(--space-2) var(--space-3)
527
- calc(var(--space-2) + var(--safe-bottom));
528
- border-top: 1px solid var(--border);
529
- background: var(--surface);
530
- }
531
-
532
- .ws-editbar button {
533
- flex: none;
534
- min-height: var(--touch);
535
- min-width: var(--touch);
536
- }
537
-
538
- /* ── Looks ──────────────────────────────────────────────────────────────────────────────────────── */
539
-
540
- [data-look="camelot"] .ws-head,
541
- [data-look="camelot"] .ws-file-head {
542
- border-bottom-color: var(--gold-soft);
543
- box-shadow: 0 1px 0 color-mix(in srgb, var(--gold) 38%, transparent);
544
- }
545
-
546
- [data-look="camelot"] .ws-tree {
547
- background: var(--surface);
548
- border-right-color: var(--gold-soft);
549
- }
550
-
551
- [data-look="camelot"] .ws-tree-row[data-selected] a {
552
- background: var(--gold-wash);
553
- color: var(--accent-ink);
554
- }
555
-
556
- /* Rune bullets for the folders of the Camelot tree. */
557
- [data-look="camelot"] .ws-tree-row a svg,
558
- [data-look="camelot"] .ws-row-icon {
559
- color: var(--gold);
560
- }
561
-
562
- [data-look="camelot"] .ws-view {
563
- margin: var(--space-2) var(--space-3) var(--space-3);
564
- border: 1px solid color-mix(in srgb, var(--gold) 34%, var(--border));
565
- border-radius: var(--radius);
566
- overflow: hidden;
567
- }
568
-
569
- [data-look="camelot"] .ws-crumbs a[aria-current="page"] {
570
- background: var(--gold-wash);
571
- }
572
-
573
- @media (prefers-reduced-motion: reduce) {
574
- .ws-twist svg {
575
- transition: none;
576
- }
577
- }
578
- `;var ut={folder:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z","folder-plus":"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7ZM12 10v6M9 13h6","file-plus":"M6 3h9l4 4v14H6zM14 3v5h5M12 12v6M9 15h6"},Ct=(i)=>(i in ut);function be(i){let{name:l,size:c=20,className:b}=i;if(!Ct(l))return e(s,{name:l,size:c,...b?{className:b}:{}});return e("svg",{viewBox:"0 0 24 24",width:c,height:c,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...b?{className:b}:{},children:e("path",{d:ut[l]})})}function Ze(i){return n("div",{className:"ws-media-actions",children:[i.open?e("a",{className:"button-link",href:we(i.root,i.path),target:"_blank",rel:"noopener",children:t("Open")}):null,n("a",{className:"button-link",href:we(i.root,i.path,!0),download:i.name,children:[e(s,{name:"download",size:18}),t("Download")]})]})}function Ge(i){let l=i.name.lastIndexOf("."),c=l>0?i.name.slice(l+1).toUpperCase():"";return n("div",{className:"card ws-card",children:[e("span",{className:"ws-card-icon","aria-hidden":"true",children:e(s,{name:"file",size:32})}),e("strong",{children:i.name}),e("span",{className:"meta",children:[c,Ne(i.bytes)].filter(Boolean).join(" · ")}),e("p",{children:i.message}),e(Ze,{root:i.root,path:i.path,name:i.name})]})}var Et=(i)=>!i&&navigator.pdfViewerEnabled!==!1;function mt(i){let{media:l,root:c,path:b,name:w,bytes:N,phone:S,onFacts:E}=i,[O,L]=r(!1),[y,W]=r(!1);o(()=>(L(!1),W(!1),E(void 0),()=>E(void 0)),[c,b]);let P=we(c,b);if(O)return e(Ge,{root:c,path:b,name:w,bytes:N,message:t("This browser cannot show this file.")});switch(l){case"image":return e("div",{className:"ws-media ws-image","data-actual":y||void 0,children:e("button",{type:"button",className:"ws-image-toggle","aria-label":y?t("Fit to window"):t("Show at full size"),title:y?t("Fit to window"):t("Show at full size"),onClick:()=>W((F)=>!F),children:e("img",{src:P,alt:w,onLoad:(F)=>{let{naturalWidth:Q,naturalHeight:X}=F.currentTarget;E(Q>0?`${Q} × ${X}`:void 0)},onError:()=>L(!0)})})});case"pdf":return Et(S)?n("div",{className:"ws-media ws-pdf-frame",children:[e("iframe",{className:"ws-pdf",src:P,title:w}),e(Ze,{root:c,path:b,name:w,open:!0})]}):e("div",{className:"ws-media",children:n("div",{className:"card ws-card",children:[e("span",{className:"ws-card-icon","aria-hidden":"true",children:e(s,{name:"file",size:32})}),e("strong",{children:w}),n("span",{className:"meta",children:["PDF · ",Ne(N)]}),e(Ze,{root:c,path:b,name:w,open:!0})]})});case"audio":return e("div",{className:"ws-media ws-sound",children:e("audio",{controls:!0,preload:"metadata",src:P,onError:()=>L(!0)})});case"video":return e("div",{className:"ws-media ws-film",children:e("video",{controls:!0,playsInline:!0,preload:"metadata",src:P,onLoadedMetadata:(F)=>{let{videoWidth:Q,videoHeight:X}=F.currentTarget;E(Q>0?`${Q} × ${X}`:void 0)},onError:()=>L(!0)})})}}var St={"read-only-root":u("this place is read-only"),"git-dir":u("inside .git"),trash:u("in the trash"),symlink:u("a link"),binary:u("binary file"),"too-large":u("too large"),"not-utf8":u("not UTF-8")};function Qe(i){if(i.id==="agents")return t("Knights' workspace");if(i.id==="scratch")return t("Scratch");return i.label}var gt=new Set([".git","node_modules"]),Je=(i)=>`roundtable.workspace.open.${i}`,ft="roundtable.workspace.tree",pt="roundtable.workspace.wrap";function et(i,l){try{let c=localStorage.getItem(i);return c===null?l:JSON.parse(c)}catch{return l}}function Be(i,l){try{localStorage.setItem(i,JSON.stringify(l))}catch{}}var De=dn({rev:0,bump:()=>{return}});se("workspace",ct);var Re=new Map,Rt=200;function Tt(i,l){Re.delete(i),Re.set(i,l);let c=Re.keys().next().value;if(Re.size>Rt&&c!==void 0)Re.delete(c)}function ht(i,l,c=!0){let{rev:b}=Se(De),[w,N]=r(0),[S,E]=r({key:"",root:i,path:l}),O=`${i}:${l}`;if(o(()=>{let y=()=>N((W)=>W+1);return window.addEventListener("focus",y),()=>window.removeEventListener("focus",y)},[]),o(()=>{if(!c)return;let y=!0;return j.list(i,l).then((W)=>{if(Tt(O,W),y)E({key:O,root:i,path:l,data:W})},(W)=>y&&E({key:O,root:i,path:l,error:d(W)})),()=>{y=!1}},[i,l,c,b,w]),S.key===O)return{data:S.data,error:S.error,at:S};let L=Re.get(O);if(L)return{data:L,at:{root:i,path:l}};if(S.data)return{data:S.data,at:S,pending:!0};return{}}var Le=(i)=>x("workspace",Me(i));function tt(i,l,c){let b=Ee(l,c.name);if(c.kind==="dir")return{root:i,path:b,dir:!0};if(c.kind==="file")return{root:i,path:b,dir:!1};if(c.kind==="symlink"&&c.inside)return{root:i,path:b,dir:c.target==="dir"};return}function Lt(i){let l=ze(i.path),c=a(null);return o(()=>{c.current?.scrollIntoView?.({inline:"end",block:"nearest"})},[i.path]),n("nav",{className:"ws-crumbs","aria-label":t("Path"),children:[e("a",{ref:l.length===0?c:void 0,href:Le({root:i.root.id,path:"",dir:!0}),"aria-current":l.length===0?"page":void 0,children:Qe(i.root)}),l.map((b,w)=>{let N=l.slice(0,w+1).join("/"),S=w===l.length-1;return e("a",{ref:S?c:void 0,href:Le({root:i.root.id,path:N,dir:!0}),"aria-current":S?"page":void 0,children:b},N)})]})}function wt(i){let{data:l,error:c,pending:b}=ht(i.root,i.path);if(c)return e("p",{className:"ws-tree-note",children:c});if(!l||b)return e("p",{className:"ws-tree-note",children:"…"});if(l.entries.length===0)return e("p",{className:"ws-tree-note",children:t("This folder is empty")});return n("ul",{className:"ws-tree-list","data-depth":i.depth,children:[l.entries.map((w)=>{let N=tt(i.root,i.path,w),S=Ee(i.path,w.name),E=N?.dir===!0,O=E&&i.open.has(S),L=i.current?.root===i.root&&i.current.path===S&&i.current.dir===E;return n("li",{children:[n("div",{className:"ws-tree-row","data-selected":L||void 0,"data-quiet":gt.has(w.name)||void 0,style:{paddingLeft:`${0.25+i.depth*0.875}rem`},children:[E?e("button",{type:"button",className:"ws-twist","aria-expanded":O,"aria-label":t("Show or hide {name}",{name:w.name}),onClick:()=>i.toggle(S),children:e(s,{name:"chevron",size:14})}):e("span",{className:"ws-twist"}),N?n("a",{href:Le(N),title:w.name,children:[e(be,{name:E?"folder":"file",size:15}),e("span",{className:"ws-tree-label",children:w.name})]}):n("span",{className:"ws-tree-off",title:w.inside===!1?t("Outside the workspace"):"",children:[e(s,{name:"file",size:15}),e("span",{className:"ws-tree-label",children:w.name})]})]}),O?e(wt,{root:i.root,path:S,depth:i.depth+1,open:i.open,toggle:i.toggle,current:i.current}):null]},w.name)}),l.truncated?e("li",{className:"ws-tree-note",children:t("Only the first 2,000 items are listed")}):null]})}function Wt(i){let{data:l,error:c,at:b,pending:w}=ht(i.root.id,i.path),{timeZone:N}=_(),S=a(null),E=b?.root??i.root.id,O=b?.path??i.path;if($e(()=>{S.current?.closest(".ws-main")?.scrollTo?.(0,0)},[E,O]),c)return e(m,{message:c});if(!l)return e(v,{});if(l.missing)return e(k,{children:t("No files yet")});if(l.entries.length===0)return e(k,{children:t("This folder is empty")});return n("div",{ref:S,className:"ws-listing","data-pending":w||void 0,"aria-busy":w||void 0,inert:w||void 0,children:[e("ul",{className:"ws-rows",children:l.entries.map((L)=>{let y=tt(E,O,L),W=n(g,{children:[e(be,{name:y?.dir?"folder":"file",size:20,className:"ws-row-icon"}),n("span",{className:"ws-row-main",children:[e("strong",{children:L.name}),e("span",{className:"meta",children:L.kind==="symlink"&&L.inside===!1?t("Outside the workspace"):L.kind==="other"?t("Not a regular file"):[y?.dir?void 0:Ne(L.size),re(new Date(L.mtimeMs).toISOString(),N)].filter(Boolean).join(" · ")})]})]});return n("li",{className:"ws-row","data-quiet":gt.has(L.name)||void 0,children:[y?e("a",{className:"ws-row-link",href:Le(y),children:W}):e("span",{className:"ws-row-link","data-off":!0,children:W}),i.root.writable||y?e("button",{type:"button",className:"icon-button","aria-label":t("Actions for {name}",{name:L.name}),onClick:()=>i.onMenu(L),children:e(s,{name:"menu"})}):null]},L.name)})}),l.truncated?e("p",{className:"meta",children:t("Only the first 2,000 items are listed")}):null]})}function zt(i){let{timeZone:l}=_(),{bump:c}=Se(De),{root:b,path:w}=i,[N,S]=r(),[E,O]=r(),[L,y]=r("read"),[W,P]=r(!1),[F,Q]=r(!1),[X,je]=r(()=>et(pt,i.phone)),[Oe,ee]=r(!1),[We,ke]=r(),[V,H]=r(!1),[Y,me]=r(!1),[Pe,qe]=r(!1),[fe,ce]=r(),[U,pe]=r(),[ye,Ie]=r(),ge=a(null),K=a(void 0),D=a(null),ae=a(N);ae.current=N;let Z=a(L);Z.current=L;let G=ze(w).at(-1)??w,Fe=N?.text!==void 0,Ve=Fe&&(N?.media===void 0||V),nt=A(async()=>{let M=await j.file(b.id,w);return S(M),M},[b.id,w]);o(()=>{let M=!0;return j.file(b.id,w).then((B)=>M&&S(B),(B)=>M&&O(d(B))),()=>{M=!1}},[b.id,w]);let Xe=dt(W,D,()=>{let M=ae.current;if(M?.text!==void 0)K.current?.replace(M.text,M.eol);P(!1),y("read")});o(()=>{if(!W)return;let M=document.title;return document.title=`• ${M}`,()=>{document.title=M}},[W]);let Ae=A(async(M,B)=>{let ue=ae.current,J=K.current;if(!ue||!J||F)return;let te=B===void 0?J.snapshot():void 0,Ke=B??J.text();Q(!0);try{let ne=await j.save(b.id,w,Ke,M??ue.hash);J.markSaved(te),P(J.dirty()),ce(void 0),S({...ue,hash:ne.hash,size:ne.size,mtimeMs:ne.mtimeMs,text:Ke}),f(t("Saved")),c()}catch(ne){let oe=Ue(ne);if(oe)pe({kind:oe.conflict==="gone"?"gone":"changed",...oe.current?{hash:oe.current.hash}:{},text:Ke});else f(d(ne),"danger")}finally{Q(!1)}},[b.id,w,F,c]),at=a(Ae);at.current=Ae;let he=A(async()=>{try{let M=await nt();if(M.text!==void 0)K.current?.replace(M.text,M.eol);P(!1),ce(void 0),pe(void 0)}catch(M){f(d(M),"danger")}},[nt]),vt=a(he);vt.current=he;let Ye=A(()=>{if(K.current?.dirty()){rt(!0);return}y("read")},[]),[bt,rt]=r(!1),ot=a(Ye);ot.current=Ye,o(()=>{if(!Ve||!ge.current)return;let M=ae.current;if(!M||M.text===void 0)return;let B=!1,ue;return (p("jgj32247"),import("./chunk-codeeditor-jgj32247.js")).then(async({createEditor:J})=>{if(B||!ge.current)return;let te=await J({parent:ge.current,text:M.text??"",eol:M.eol,language:M.language,editable:!1,wrap:X,phrases:{Find:t("Find"),Replace:t("Replace"),next:t("next"),previous:t("previous"),all:t("all"),"match case":t("match case"),regexp:t("regexp"),"by word":t("by word"),replace:t("replace"),"replace all":t("replace all"),close:t("close")},onChange:()=>P(te.dirty()),onSave:()=>{if(Z.current==="edit"&&te.dirty())at.current()},onEscape:()=>{if(Z.current==="edit")ot.current()}});if(B){te.destroy();return}ue=te,K.current=te,me(!0)}).catch((J)=>{if(console.warn("the editor failed to load",J),!B)qe(!0)}),()=>{B=!0,ue?.destroy(),K.current=void 0,me(!1)}},[Ve,b.id,w]),o(()=>{if(!Y)return;let M=L==="edit"&&N?.editable===!0;if(K.current?.setEditable(M),M)K.current?.focus()},[L,Y,N?.editable]),o(()=>{if(!Y)return;K.current?.setWrap(X),Be(pt,X)},[X,Y]);let it=N!==void 0;if(o(()=>{if(!it)return;let M=!1,B=async()=>{if(M||document.visibilityState==="hidden")return;let te=ae.current;if(!te)return;M=!0;try{let ne=(await j.list(b.id,ve(w))).entries.find((xt)=>xt.name===G);if(!ne){ce("gone");return}if(ne.kind==="symlink")return;if(ne.size===te.size&&ne.mtimeMs===te.mtimeMs)return;if(Z.current==="edit"&&K.current?.dirty()){ce("changed");return}let oe=await j.file(b.id,w);if(oe.hash!==te.hash){if(S(oe),oe.text!==void 0)K.current?.replace(oe.text,oe.eol)}ce(void 0)}catch{}finally{M=!1}},ue=setInterval(()=>void B(),5000),J=()=>void B();return window.addEventListener("focus",J),document.addEventListener("visibilitychange",J),()=>{clearInterval(ue),window.removeEventListener("focus",J),document.removeEventListener("visibilitychange",J)}},[it,b.id,w,G]),E)return e("div",{className:"ws-file",children:e(m,{message:E})});if(!N)return e("div",{className:"ws-file",children:e(v,{})});let st=N.reason,kt=!N.editable?e(T,{tone:"warn",children:t("Read only: {reason}",{reason:st?t(St[st]):""})}):null,He=L==="edit",yt=n("div",{className:"ws-actions",children:[N.editable&&!He?e("button",{type:"button",onClick:()=>{H(!0),y("edit")},children:t("Edit")}):null,He?n(g,{children:[e("button",{type:"button",disabled:F||!W,onClick:()=>void Ae(),children:t("Save")}),e("button",{type:"button",className:"secondary",onClick:Ye,children:t("Cancel")})]}):null,e("button",{type:"button",className:"icon-button","aria-label":t("File menu"),onClick:()=>ee(!0),children:e(s,{name:"menu"})})]});return n("div",{className:"ws-file",ref:D,children:[n("header",{className:"ws-file-head",children:[n("div",{className:"ws-file-title",children:[n("strong",{children:[W?"• ":"",G]}),n("span",{className:"meta",children:[Ne(N.size),We?` · ${We}`:""," ·"," ",re(new Date(N.mtimeMs).toISOString(),l)]})]}),kt,yt]}),fe?n("div",{className:"ws-banner",role:"status",children:[e("span",{className:"ws-banner-text",children:fe==="gone"?t("This file is gone"):t("A knight is changing this file")}),fe==="changed"?n(g,{children:[e("button",{type:"button",className:"secondary",onClick:()=>void he(),children:t("Reload (discard my edits)")}),e("button",{type:"button",className:"secondary",onClick:()=>ce(void 0),children:t("Keep editing")})]}):null]}):null,e("div",{className:"ws-view",children:N.media&&!Ve?e(mt,{media:N.media,root:b.id,path:w,name:G,bytes:N.size,phone:i.phone,onFacts:ke}):Ve?e("div",{ref:ge,className:"ws-editor","data-editing":He||void 0,children:!Y?e("pre",{className:"ws-plain","aria-busy":!Pe,children:N.text}):null}):e(Ge,{root:b.id,path:w,name:G,bytes:N.size,message:N.tooLarge?t("This file is too large to show here."):t("This file is not text, so it cannot be shown here.")})}),i.phone&&He?n("div",{className:"ws-editbar",role:"toolbar","aria-label":t("Editing"),children:[e("button",{type:"button",disabled:F||!W,onClick:()=>void Ae(),children:t("Save")}),e("button",{type:"button",className:"secondary",onClick:()=>K.current?.undo(),children:t("Undo")}),e("button",{type:"button",className:"secondary",onClick:()=>K.current?.redo(),children:t("Redo")}),e("button",{type:"button",className:"secondary",onClick:()=>K.current?.find(),children:t("Find")}),e("button",{type:"button",className:"secondary",onClick:()=>K.current?.tab(),children:t("Tab")})]}):null,e(R,{open:Oe,title:G,onClose:()=>ee(!1),children:e("div",{className:"stack",children:n("ul",{className:"more-list",children:[Fe?e("li",{children:e("button",{type:"button",className:"menu-item",onClick:()=>{je((M)=>!M),ee(!1)},children:e("span",{className:"menu-text",children:e("strong",{children:X?t("Do not wrap lines"):t("Wrap lines")})})})}):null,e("li",{children:n("a",{className:"menu-item menu-link",href:we(b.id,w,!0),download:G,onClick:()=>ee(!1),children:[e("span",{className:"menu-icon",children:e(s,{name:"download"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Download")})})]})}),e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{ee(!1),he()},children:[e("span",{className:"menu-icon",children:e(s,{name:"refresh"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Reload")})})]})})]})})}),e(ie,{open:U!==void 0,title:U?.kind==="gone"?t("This file is gone"):t("This file changed while you were editing"),onClose:()=>pe(void 0),children:n("div",{className:"stack",children:[e("p",{children:U?.kind==="gone"?t("Someone deleted it. Your text has not been saved."):t("Your text has not been saved. What should happen to it?")}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:()=>{navigator.clipboard?.writeText(U?.text??"").then(()=>f(t("Copied")))},children:t("Copy my text")}),U?.kind==="changed"?e("button",{type:"button",className:"secondary",onClick:()=>void he(),children:t("Reload (discard my edits)")}):null,e("button",{type:"button",className:"danger",onClick:()=>{if(!U)return;if(U.kind==="gone"){let M=U.text;pe(void 0),j.create(b.id,w,"file",M).then(async()=>{await he(),c()}).catch((B)=>f(d(B),"danger"));return}Ie({hash:U.hash??"",text:U.text}),pe(void 0)},children:U?.kind==="gone"?t("Save mine as a new file"):t("Save mine anyway")})]})]})}),e(q,{open:ye!==void 0,title:t("Replace the knight's changes?"),confirmLabel:t("Save mine anyway"),tone:"danger",onClose:()=>Ie(void 0),onConfirm:async()=>{if(!ye)return;await j.save(b.id,w,ye.text,ye.hash),await he(),f(t("Saved")),c()},children:e("p",{children:t("The file has been changed since you opened it. Saving yours writes over those changes.")})}),e(q,{open:bt,title:t("Unsaved changes, leave?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:()=>rt(!1),onConfirm:async()=>{if(N.text!==void 0)K.current?.replace(N.text,N.eol);P(!1),y("read")},children:e("p",{children:t("Your edits to {name} have not been saved.",{name:G})})}),e(q,{open:Xe.leaving!==void 0,title:t("Unsaved changes, leave?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:Xe.stay,onConfirm:async()=>Xe.leave(),children:e("p",{children:t("Your edits to {name} have not been saved.",{name:G})})})]})}function Mt(i){let{ask:l}=i,[c,b]=r(""),[w,N]=r(),[S,E]=r(!1),O=z();o(()=>{b(l?.kind==="rename"?l.name:""),N(void 0)},[l]);let L=l?.kind==="rename"?t("Rename"):l?.kind==="dir"?t("New folder"):t("New file"),y=async(W)=>{if(W.preventDefault(),!l)return;let P=c.trim();if(!P||P.includes("/")){N(t("Use a name without slashes."));return}E(!0),N(void 0);try{if(l.kind==="rename"){let F=Ee(ve(l.path),P);await j.rename(i.root.id,l.path,F),f(t("Renamed")),i.onDone()}else{let F=Ee(l.dir,P);await j.create(i.root.id,F,l.kind),f(t("Created")),i.onDone({root:i.root.id,path:F,dir:l.kind==="dir"})}}catch(F){let Q=Ue(F);N(Q?.conflict==="exists"?t("Something with that name is already there."):d(F))}finally{E(!1)}};return e(ie,{open:l!==void 0,title:L,onClose:i.onClose,children:n("form",{className:"stack",onSubmit:y,children:[e("label",{htmlFor:O,children:t("Name")}),e("input",{id:O,value:c,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,onChange:(W)=>b(W.target.value)}),w?e(m,{message:w}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:i.onClose,children:t("Cancel")}),e("button",{type:"submit",disabled:S||!c.trim(),children:l?.kind==="rename"?t("Rename"):t("Create")})]})]})})}function Dt(i){let{bump:l,rev:c}=Se(De),[b,w]=r(),[N,S]=r(),[E,O]=r(),{timeZone:L}=_();return o(()=>{if(!i.open)return;let y=!0;return j.trash(i.root.id).then((W)=>y&&w(W.items),(W)=>y&&S(d(W))),()=>{y=!1}},[i.open,i.root.id,c]),n(ie,{open:i.open,title:t("Trash"),onClose:i.onClose,children:[n("div",{className:"stack",children:[N?e(m,{message:N}):null,!b&&!N?e(v,{}):null,b?.length===0?e(k,{children:t("The trash is empty")}):null,e("ul",{className:"ws-rows",children:b?.map((y)=>n("li",{className:"ws-row",children:[n("span",{className:"ws-row-link","data-off":!0,children:[e(be,{name:y.kind==="dir"?"folder":"file",size:20,className:"ws-row-icon"}),n("span",{className:"ws-row-main",children:[e("strong",{children:y.path}),e("span",{className:"meta",children:re(y.deletedAt,L)})]})]}),e("button",{type:"button",className:"secondary",onClick:async()=>{try{await j.restore(i.root.id,y.id),f(t("Restored")),l()}catch(W){let P=Ue(W);f(P?P.conflict==="exists"?t("Something with that name is already there."):t("The folder it was in is gone."):d(W),"danger")}},children:t("Restore")}),e("button",{type:"button",className:"icon-button danger-icon","aria-label":t("Delete {name} for good",{name:y.name}),onClick:()=>O(y),children:e(s,{name:"trash"})})]},y.id))})]}),e(q,{open:E!==void 0,title:t("Delete for good?"),confirmLabel:t("Delete for good"),tone:"danger",onClose:()=>O(void 0),onConfirm:async()=>{if(!E)return;await j.purge(i.root.id,E.id),l()},children:e("p",{children:t("“{name}” will be removed and cannot be brought back.",{name:E?.path??""})})})]})}function yn(){let i=Zi(),l=!Ce("(min-width: 720px)"),[c,b]=r(0),w=A(()=>b((D)=>D+1),[]),N=C(()=>({rev:c,bump:w}),[c,w]),[S,E]=r(),[O,L]=r();o(()=>{j.roots().then((D)=>E(D.roots),(D)=>L(d(D)))},[]);let[y,W]=r(()=>et(ft,280)),[P,F]=r(),[Q,X]=r(),[je,Oe]=r(!1),[ee,We]=r(),ke=lt(i.key),V=S?.find((D)=>D.id===ke?.root)??(l?void 0:S?.[0]),H=V?ke&&ke.root===V.id?ke:{root:V.id,path:"",dir:!0}:void 0,Y=V?.id,me=H?.path,Pe=H?.dir,[qe,fe]=r(new Set);o(()=>{if(!Y)return;fe(new Set(et(Je(Y),[])))},[Y]);let ce=A((D)=>{if(!Y)return;fe((ae)=>{let Z=new Set(ae);if(Z.has(D))Z.delete(D);else Z.add(D);return Be(Je(Y),[...Z]),Z})},[Y]);if(o(()=>{if(!Y||me===void 0||l)return;let D=ze(Pe?me:ve(me)),ae=D.map((Z,G)=>D.slice(0,G+1).join("/"));fe((Z)=>{if(ae.every((Fe)=>Z.has(Fe)))return Z;let G=new Set([...Z,...ae]);return Be(Je(Y),[...G]),G})},[Y,me,Pe,l]),O)return e(m,{message:O});if(!S)return e(v,{});if(S.length===0)return e(k,{children:t("No files yet")});if(!V||!H)return e(De.Provider,{value:N,children:n("div",{className:"page ws-page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Files")})}),e("ul",{className:"more-list",children:S.map((D)=>e("li",{children:n("a",{className:"menu-item menu-link",href:Le({root:D.id,path:"",dir:!0}),children:[e("span",{className:"menu-icon",children:e(be,{name:"folder"})}),n("span",{className:"menu-text",children:[e("strong",{children:Qe(D)}),D.writable?null:e("span",{className:"meta",children:t("Read only")})]}),e(s,{name:"chevron",size:16})]})},D.id))})]})});let U=H.dir?H.path:ve(H.path),pe=H.path===""?{root:V.id,path:"",dir:!0}:{root:V.id,path:ve(H.path),dir:!0},ye=n("header",{className:"ws-head",children:[l?e("a",{className:"icon-button","aria-label":t("Back"),href:H.path===""?x("workspace"):Le(pe),children:e(s,{name:"back"})}):e(Te,{chip:!0,className:"ws-root-picker","aria-label":t("Place"),value:V.id,onChange:(D)=>I("workspace",Me({root:D.target.value,path:"",dir:!0})),children:S.map((D)=>e("option",{value:D.id,children:Qe(D)},D.id))}),e(Lt,{root:V,path:H.path}),V.writable?n("div",{className:"ws-head-actions",children:[e("button",{type:"button",className:"icon-button","aria-label":t("New file"),title:t("New file"),onClick:()=>X({kind:"file",dir:U}),children:e(be,{name:"file-plus"})}),e("button",{type:"button",className:"icon-button","aria-label":t("New folder"),title:t("New folder"),onClick:()=>X({kind:"dir",dir:U}),children:e(be,{name:"folder-plus"})}),e("button",{type:"button",className:"icon-button","aria-label":t("Trash"),title:t("Trash"),onClick:()=>Oe(!0),children:e(s,{name:"trash"})})]}):null]}),Ie=H.dir?e("div",{className:"ws-dir",children:e(Wt,{root:V,path:H.path,onMenu:(D)=>F(D)})}):e(zt,{root:V,path:H.path,phone:l},`${V.id}:${H.path}`),ge=P?tt(V.id,U,P):void 0,K=P?Ee(U,P.name):"";return n(De.Provider,{value:N,children:[n("div",{className:"ws-page ws","data-wide":!l||void 0,style:{"--ws-tree":`${y}px`},children:[ye,n("div",{className:"ws-body",children:[!l?n(g,{children:[e("aside",{className:"ws-tree","aria-label":t("Folders"),children:e(wt,{root:V.id,path:"",depth:0,open:qe,toggle:ce,current:H})}),e($t,{width:y,onChange:(D)=>{W(D),Be(ft,D)}})]}):null,e("section",{className:"ws-main",children:Ie})]})]}),e(R,{open:P!==void 0,title:P?.name??"",onClose:()=>F(void 0),children:n("ul",{className:"more-list",children:[ge&&!ge.dir?e("li",{children:n("a",{className:"menu-item menu-link",href:we(V.id,K,!0),download:P?.name,onClick:()=>F(void 0),children:[e("span",{className:"menu-icon",children:e(s,{name:"download"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Download")})})]})}):null,V.writable&&P?n(g,{children:[e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{X({kind:"rename",path:K,name:P.name}),F(void 0)},children:[e("span",{className:"menu-icon",children:e(s,{name:"notes"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Rename")})})]})}),e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{We({path:K,name:P.name}),F(void 0)},children:[e("span",{className:"menu-icon",children:e(s,{name:"trash"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Delete")})})]})})]}):null]})}),e(Mt,{root:V,ask:Q,onClose:()=>X(void 0),onDone:(D)=>{if(X(void 0),w(),D)I("workspace",Me(D))}}),e(Dt,{root:V,open:je,onClose:()=>Oe(!1)}),e(q,{open:ee!==void 0,title:t("Move to the trash?"),confirmLabel:t("Delete"),tone:"danger",onClose:()=>We(void 0),onConfirm:async()=>{if(!ee)return;if(await j.remove(V.id,ee.path),f(t("Moved to the trash")),w(),!H.dir&&(H.path===ee.path||H.path.startsWith(`${ee.path}/`)))I("workspace",Me({root:V.id,path:ve(H.path),dir:!0}))},children:e("p",{children:t("“{name}” goes to the trash, where you can bring it back.",{name:ee?.name??""})})})]})}function $t(i){let b=(w)=>Math.min(560,Math.max(180,w));return e("div",{className:"ws-resizer",role:"separator","aria-orientation":"vertical","aria-valuenow":i.width,"aria-valuemin":180,"aria-valuemax":560,"aria-label":t("Resize the folder list"),tabIndex:0,onKeyDown:(w)=>{if(w.key==="ArrowLeft")i.onChange(b(i.width-16));if(w.key==="ArrowRight")i.onChange(b(i.width+16))},onPointerDown:(w)=>{let N=w.clientX,S=i.width,E=w.currentTarget;E.setPointerCapture(w.pointerId);let O=(y)=>i.onChange(b(S+y.clientX-N)),L=()=>{E.removeEventListener("pointermove",O),E.removeEventListener("pointerup",L)};E.addEventListener("pointermove",O),E.addEventListener("pointerup",L)}})}export{yn as WorkspacePage};