pi-roundtable-web 0.29.0 → 0.29.2

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 (242) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/chunk-account-dq0nhfvj.js +1 -0
  3. package/dist/{chunk-action-menu-q5y7xpry.js → chunk-action-menu-37zgbhje.js} +1 -1
  4. package/dist/chunk-agent-yqe6reej.js +1 -0
  5. package/dist/chunk-arranged-rooms-sx6xg9df.js +1 -0
  6. package/dist/chunk-attachments-3vbj05g5.js +102 -0
  7. package/dist/chunk-bulk-actions-6pehrsgb.js +1 -0
  8. package/dist/chunk-character-creator-bg3tdc8p.js +225 -0
  9. package/dist/chunk-codeeditor-102wa9bj.js +2 -0
  10. package/dist/chunk-confirm-ghxga720.js +1 -0
  11. package/dist/chunk-connectors-0jzzren3.js +37 -0
  12. package/dist/chunk-conversations-3276jq4q.js +1 -0
  13. package/dist/chunk-council-sheet-7m884s44.js +2 -0
  14. package/dist/chunk-council-view-rkzcxeg8.js +1 -0
  15. package/dist/{chunk-drag-7873fvzw.js → chunk-drag-sw692nr3.js} +1 -1
  16. package/dist/chunk-entry-mb6jd983.js +1 -0
  17. package/dist/chunk-folder-list-g7st6p1e.js +1 -0
  18. package/dist/chunk-folds-rb1b069h.js +1 -0
  19. package/dist/chunk-gate-3rxxyfev.js +1 -0
  20. package/dist/chunk-host-icons-cyj62pwp.js +1 -0
  21. package/dist/chunk-host-picture-9wnhqckv.js +1 -0
  22. package/dist/chunk-host-state-b858k3p8.js +1 -0
  23. package/dist/chunk-host-ui-j6wvj0pe.js +1 -0
  24. package/dist/{chunk-index-gj3n4dh5.js → chunk-index-0qzqzp6t.js} +2 -2
  25. package/dist/{chunk-index-7k5895sn.js → chunk-index-0t68az7d.js} +3 -3
  26. package/dist/chunk-index-0xdptr30.js +2 -0
  27. package/dist/{chunk-index-bjeg3e2j.js → chunk-index-1tkzdy4s.js} +2 -2
  28. package/dist/chunk-index-2s48qyrs.js +2 -0
  29. package/dist/chunk-index-33cqx9v2.js +2 -0
  30. package/dist/chunk-index-36m3knsk.js +2 -0
  31. package/dist/{chunk-index-r0hk9kyd.js → chunk-index-50syrmaq.js} +2 -2
  32. package/dist/{chunk-index-4krm48hm.js → chunk-index-50w6yq2d.js} +1 -1
  33. package/dist/{chunk-index-4jnn2g09.js → chunk-index-5fyqxh0r.js} +2 -2
  34. package/dist/chunk-index-5x3h176v.js +2 -0
  35. package/dist/{chunk-index-y6p8j3zv.js → chunk-index-6cs1wvhy.js} +1 -1
  36. package/dist/{chunk-index-aycxt14t.js → chunk-index-6m25qpa7.js} +2 -2
  37. package/dist/{chunk-index-35zqk1zr.js → chunk-index-6nja2vd8.js} +2 -2
  38. package/dist/{chunk-index-teyx2hz7.js → chunk-index-6q3dx093.js} +2 -2
  39. package/dist/{chunk-index-7c9fn21n.js → chunk-index-6ycrvwzs.js} +2 -2
  40. package/dist/{chunk-index-5ssncptg.js → chunk-index-6yfcfcc8.js} +2 -2
  41. package/dist/{chunk-index-rr73h4kc.js → chunk-index-7gk2sdf4.js} +3 -3
  42. package/dist/{chunk-index-h2a42p6s.js → chunk-index-7p31pda8.js} +19 -3
  43. package/dist/chunk-index-91wnf1k9.js +1 -0
  44. package/dist/chunk-index-9ehqccfe.js +2 -0
  45. package/dist/chunk-index-ar1x9fhw.js +2 -0
  46. package/dist/chunk-index-axw4wkqq.js +2 -0
  47. package/dist/chunk-index-b5patef1.js +2 -0
  48. package/dist/chunk-index-d941ae7c.js +2 -0
  49. package/dist/chunk-index-dagc92hw.js +2 -0
  50. package/dist/chunk-index-ddssgba9.js +2 -0
  51. package/dist/chunk-index-dpgn7kzp.js +2 -0
  52. package/dist/{chunk-index-zdzzf3fp.js → chunk-index-e8535c4h.js} +2 -2
  53. package/dist/{chunk-index-e46652wf.js → chunk-index-edjyj761.js} +1 -1
  54. package/dist/chunk-index-eez0kbk4.js +2 -0
  55. package/dist/chunk-index-ekp5mmvp.js +2 -0
  56. package/dist/{chunk-index-pcbkp62w.js → chunk-index-eyythjdx.js} +2 -2
  57. package/dist/chunk-index-fdg2qd3f.js +2 -0
  58. package/dist/chunk-index-g0sdxjxr.js +2 -0
  59. package/dist/{chunk-index-cttrqfm8.js → chunk-index-gmbk3sra.js} +1 -1
  60. package/dist/chunk-index-hsc9yz2x.js +2 -0
  61. package/dist/{chunk-index-a8c0ap8g.js → chunk-index-jrj09r5c.js} +2 -2
  62. package/dist/chunk-index-kvztbfqj.js +2 -0
  63. package/dist/{chunk-index-f4gqzfkv.js → chunk-index-m7wzrmcd.js} +2 -2
  64. package/dist/chunk-index-m8bv51r9.js +2 -0
  65. package/dist/{chunk-index-amspdq2j.js → chunk-index-mey1p7h8.js} +3 -3
  66. package/dist/{chunk-index-4re5prfp.js → chunk-index-mzw7nmkc.js} +2 -2
  67. package/dist/{chunk-index-en5dm1zv.js → chunk-index-n2v2bz8d.js} +2 -2
  68. package/dist/chunk-index-nncy9wxw.js +2 -0
  69. package/dist/chunk-index-p2e7rwac.js +2 -0
  70. package/dist/chunk-index-p98tt12y.js +2 -0
  71. package/dist/chunk-index-qdtmetsy.js +120 -0
  72. package/dist/{chunk-index-pfs6rm6w.js → chunk-index-qedt9szy.js} +2 -2
  73. package/dist/{chunk-index-evhaaqzk.js → chunk-index-qk7rp7fk.js} +11 -11
  74. package/dist/{chunk-index-hef4gwtb.js → chunk-index-qq86fxda.js} +2 -2
  75. package/dist/{chunk-index-v6h43553.js → chunk-index-qw9a7ken.js} +2 -2
  76. package/dist/chunk-index-s356ybxk.js +50 -0
  77. package/dist/{chunk-index-rtz4936v.js → chunk-index-sk8cvb4e.js} +3 -3
  78. package/dist/{chunk-index-3tjmyd1h.js → chunk-index-syxwqhry.js} +2 -2
  79. package/dist/{chunk-index-1652v386.css → chunk-index-t7csmbpy.css} +1 -1
  80. package/dist/{chunk-index-haac6nbt.js → chunk-index-tasbd41t.js} +2 -2
  81. package/dist/chunk-index-vxqzavgz.js +2 -0
  82. package/dist/chunk-index-x5xq9g9a.js +3 -0
  83. package/dist/chunk-index-xx0kecz9.js +2 -0
  84. package/dist/{chunk-index-q33ppq0j.js → chunk-index-y1xv3dxs.js} +100 -4
  85. package/dist/{chunk-index-ntt3em2k.js → chunk-index-yn1vvxj2.js} +1 -1
  86. package/dist/chunk-lang-css-rwkzd784.js +1 -0
  87. package/dist/{chunk-lang-dockerfile-2p7e3ssz.js → chunk-lang-dockerfile-e87ssppx.js} +1 -1
  88. package/dist/{chunk-lang-go-zxp9k517.js → chunk-lang-go-kbcbn346.js} +2 -2
  89. package/dist/chunk-lang-html-zhngbs9v.js +1 -0
  90. package/dist/chunk-lang-javascript-bk2s6a56.js +1 -0
  91. package/dist/{chunk-lang-json-zmym50rg.js → chunk-lang-json-4pe1fv7e.js} +1 -1
  92. package/dist/{chunk-lang-markdown-ww2kcs85.js → chunk-lang-markdown-67cm3tjx.js} +5 -5
  93. package/dist/{chunk-lang-python-ng1zdtd4.js → chunk-lang-python-mnfhcvww.js} +2 -2
  94. package/dist/{chunk-lang-rust-6ynhxjdd.js → chunk-lang-rust-e4a9s76x.js} +1 -1
  95. package/dist/{chunk-lang-shell-39t9bz2s.js → chunk-lang-shell-43nea8tq.js} +1 -1
  96. package/dist/{chunk-lang-sql-w875ejpg.js → chunk-lang-sql-28364npv.js} +2 -2
  97. package/dist/{chunk-lang-toml-b8ckgkg5.js → chunk-lang-toml-a83hr7bw.js} +1 -1
  98. package/dist/chunk-lang-typescript-r5npc6zf.js +1 -0
  99. package/dist/{chunk-lang-xml-bz91cjp1.js → chunk-lang-xml-2hv5xc8n.js} +1 -1
  100. package/dist/{chunk-lang-yaml-g9zy0tdv.js → chunk-lang-yaml-vw22drt8.js} +1 -1
  101. package/dist/chunk-layout-actions-rw5myg2t.js +1 -0
  102. package/dist/chunk-menu-items-q0hy5kzd.js +1 -0
  103. package/dist/chunk-mode-toggle-yk2t0tcy.js +1 -0
  104. package/dist/{chunk-note-row-314py1pp.js → chunk-note-row-c0trzayj.js} +33 -4
  105. package/dist/chunk-notes-0xcmm938.js +1 -0
  106. package/dist/chunk-notice-bell-f9nhxg71.js +1 -0
  107. package/dist/{chunk-notices-mtn7pg1z.js → chunk-notices-gkaqncqz.js} +1 -1
  108. package/dist/chunk-onboarding-fkq9ptcw.js +1 -0
  109. package/dist/chunk-overview-yssxbg0d.js +1 -0
  110. package/dist/chunk-palette-w6qbr7zp.js +1 -0
  111. package/dist/chunk-placement-items-wcwy91mp.js +1 -0
  112. package/dist/chunk-profile-9sjgayrx.js +1 -0
  113. package/dist/chunk-prompt-history-kn42sf8y.js +1 -0
  114. package/dist/chunk-prompts-824fwgvh.js +1 -0
  115. package/dist/chunk-room-confirms-hvs9tra4.js +1 -0
  116. package/dist/{chunk-room-menu-1m2c2ekt.js → chunk-room-menu-pkd0487m.js} +1 -1
  117. package/dist/chunk-rooms-menu-button-w5hfhsfv.js +1 -0
  118. package/dist/chunk-schedules-m9mn68gt.js +1 -0
  119. package/dist/{chunk-seat-menu-m2n9nvv0.js → chunk-seat-menu-3tdcr44t.js} +1 -1
  120. package/dist/chunk-section-fold-g0tx68cj.js +1 -0
  121. package/dist/chunk-settings-18qmhcyr.js +1 -0
  122. package/dist/chunk-sheet-hosts-tsppnmvv.js +29 -0
  123. package/dist/chunk-shortcut-help-wnm0cm8n.js +26 -0
  124. package/dist/chunk-shortcuts-qee393s5.js +1 -0
  125. package/dist/chunk-skill-editor-pryntvpr.js +8 -0
  126. package/dist/chunk-skills-sap3rysr.js +1 -0
  127. package/dist/chunk-start-over-line-azexcxj1.js +16 -0
  128. package/dist/chunk-switcher-list-6hacxjfe.js +1 -0
  129. package/dist/{chunk-tab-dot-gkpe06q8.js → chunk-tab-dot-h0eskhrt.js} +1 -1
  130. package/dist/{chunk-table-av3kh3tt.js → chunk-table-jtn49c2m.js} +1 -1
  131. package/dist/chunk-table2d-vy4w4r5k.js +1 -0
  132. package/dist/{chunk-table3d-rsvajx7r.js → chunk-table3d-0a62jerb.js} +22 -22
  133. package/dist/chunk-thread-actions-31scmndt.js +1 -0
  134. package/dist/{chunk-thread-cards-grzszfha.js → chunk-thread-cards-mwxzy02t.js} +1 -1
  135. package/dist/chunk-thread-list-52mx2m9p.js +227 -0
  136. package/dist/chunk-transcript-p5q2m795.js +1 -0
  137. package/dist/chunk-waiting-chip-wvkbsnw5.js +32 -0
  138. package/dist/chunk-waiting-s7nm3q0p.js +1 -0
  139. package/dist/chunk-where-j99f8pb8.js +1 -0
  140. package/dist/chunk-workspace-ne2nkf4h.js +586 -0
  141. package/dist/chunk-zh-tw-vm5d0w6j.js +1 -0
  142. package/dist/index.html +1 -1
  143. package/dist/sw.js +1 -1
  144. package/package.json +2 -2
  145. package/src/api-types.ts +12 -0
  146. package/src/app/app.ts +7 -0
  147. package/src/app/card-log.ts +10 -2
  148. package/src/app/protocol.ts +18 -0
  149. package/src/app/queued-delivery.ts +107 -0
  150. package/src/app/queued-frames.ts +115 -0
  151. package/src/app/room-log.ts +39 -7
  152. package/src/app/routes.ts +97 -5
  153. package/src/app/socket.ts +12 -2
  154. package/src/app/surface.ts +37 -6
  155. package/src/app/zip.ts +124 -0
  156. package/src/auth/sessions.ts +9 -1
  157. package/src/host/cards.ts +10 -3
  158. package/src/host/stored-json.ts +23 -0
  159. package/src/i18n/zh-tw.ts +14 -0
  160. package/src/notices/mount.ts +1 -0
  161. package/src/notices/store.ts +9 -1
  162. package/src/web-plugin.ts +4 -1
  163. package/dist/chunk-account-9616x405.js +0 -1
  164. package/dist/chunk-agent-x74xezyt.js +0 -1
  165. package/dist/chunk-arranged-rooms-9prq46vh.js +0 -1
  166. package/dist/chunk-bulk-actions-5dc4m9ad.js +0 -1
  167. package/dist/chunk-character-creator-wf02eg0h.js +0 -1
  168. package/dist/chunk-codeeditor-239ss6a2.js +0 -2
  169. package/dist/chunk-confirm-bhrx9195.js +0 -1
  170. package/dist/chunk-connectors-k77pd9by.js +0 -37
  171. package/dist/chunk-conversations-ftcpaqw1.js +0 -1
  172. package/dist/chunk-council-sheet-a5e6tspr.js +0 -2
  173. package/dist/chunk-council-view-6593rqbr.js +0 -1
  174. package/dist/chunk-entry-5zmjxadx.js +0 -1
  175. package/dist/chunk-folder-list-h9hmbm8e.js +0 -1
  176. package/dist/chunk-folds-vxq86t1s.js +0 -1
  177. package/dist/chunk-gate-fa6za28z.js +0 -1
  178. package/dist/chunk-host-icons-y6frbzqt.js +0 -1
  179. package/dist/chunk-host-picture-fqg55rbr.js +0 -1
  180. package/dist/chunk-host-state-65tdhkyq.js +0 -1
  181. package/dist/chunk-host-ui-233kz7qp.js +0 -1
  182. package/dist/chunk-index-2c00zf3z.js +0 -2
  183. package/dist/chunk-index-2dhrqvba.js +0 -2
  184. package/dist/chunk-index-2s4bkrz3.js +0 -2
  185. package/dist/chunk-index-2ypaqwjy.js +0 -2
  186. package/dist/chunk-index-39qq37j5.js +0 -2
  187. package/dist/chunk-index-4eag6s50.js +0 -2
  188. package/dist/chunk-index-57teqgct.js +0 -2
  189. package/dist/chunk-index-93f3e06v.js +0 -2
  190. package/dist/chunk-index-9m9v1p7s.js +0 -2
  191. package/dist/chunk-index-a8nqn3y0.js +0 -3
  192. package/dist/chunk-index-am7ghh75.js +0 -120
  193. package/dist/chunk-index-amxa2bn3.js +0 -2
  194. package/dist/chunk-index-dajanzxc.js +0 -1
  195. package/dist/chunk-index-e2eeckhh.js +0 -2
  196. package/dist/chunk-index-ek98d2rn.js +0 -2
  197. package/dist/chunk-index-gp4chnp3.js +0 -2
  198. package/dist/chunk-index-mg96sqpk.js +0 -2
  199. package/dist/chunk-index-nsya88fn.js +0 -1
  200. package/dist/chunk-index-pgxgq61x.js +0 -2
  201. package/dist/chunk-index-smz90j6p.js +0 -2
  202. package/dist/chunk-index-vzqwn3wp.js +0 -2
  203. package/dist/chunk-index-wt2asefx.js +0 -50
  204. package/dist/chunk-index-x4tq9btg.js +0 -2
  205. package/dist/chunk-index-yvcdg5hh.js +0 -2
  206. package/dist/chunk-index-zeqfnkty.js +0 -2
  207. package/dist/chunk-index-zpwb8mkk.js +0 -2
  208. package/dist/chunk-lang-css-avzhvm72.js +0 -1
  209. package/dist/chunk-lang-html-red02gep.js +0 -1
  210. package/dist/chunk-lang-javascript-n33kmjcx.js +0 -1
  211. package/dist/chunk-lang-typescript-qf8acbb2.js +0 -1
  212. package/dist/chunk-layout-actions-fyzzzeyp.js +0 -1
  213. package/dist/chunk-menu-items-yvnk3vds.js +0 -1
  214. package/dist/chunk-mode-toggle-ccv271hm.js +0 -1
  215. package/dist/chunk-notes-4rnrddzw.js +0 -1
  216. package/dist/chunk-notice-bell-z9wgamnz.js +0 -1
  217. package/dist/chunk-onboarding-f3hhxgg4.js +0 -1
  218. package/dist/chunk-overview-qmepntrr.js +0 -1
  219. package/dist/chunk-palette-edkn1ypq.js +0 -1
  220. package/dist/chunk-placement-items-trsa5t23.js +0 -1
  221. package/dist/chunk-profile-pwfq0wns.js +0 -1
  222. package/dist/chunk-prompt-history-xp9hmeqt.js +0 -1
  223. package/dist/chunk-prompts-a56qvytg.js +0 -1
  224. package/dist/chunk-room-confirms-gqpkz4h0.js +0 -1
  225. package/dist/chunk-rooms-menu-button-tcvda1gq.js +0 -1
  226. package/dist/chunk-schedules-kwnw7p8v.js +0 -1
  227. package/dist/chunk-sheet-hosts-pr8xktyq.js +0 -29
  228. package/dist/chunk-shortcut-help-sbvrds1m.js +0 -26
  229. package/dist/chunk-shortcuts-8705p7q3.js +0 -1
  230. package/dist/chunk-skill-editor-7xy09sq1.js +0 -8
  231. package/dist/chunk-skills-cnc25x7q.js +0 -1
  232. package/dist/chunk-start-over-line-97zdd9pb.js +0 -16
  233. package/dist/chunk-switcher-list-ehsn2wsk.js +0 -1
  234. package/dist/chunk-table2d-5x3jptp9.js +0 -1
  235. package/dist/chunk-thread-actions-7xtkegwm.js +0 -1
  236. package/dist/chunk-thread-list-9bjjac3j.js +0 -217
  237. package/dist/chunk-transcript-t5szb8r0.js +0 -1
  238. package/dist/chunk-waiting-chip-d8b6a0p8.js +0 -28
  239. package/dist/chunk-waiting-ts3kxjvv.js +0 -1
  240. package/dist/chunk-where-3d3ncsa5.js +0 -1
  241. package/dist/chunk-workspace-ct6hvn0z.js +0 -578
  242. package/dist/chunk-zh-tw-v9v1eerm.js +0 -1
@@ -0,0 +1,586 @@
1
+ import{p,On,E,Te,s,A,Pe,R,a,r,t,c,g,e,n,o,S,Qi,X,ur,fe,h,l,f,x,m,k,P,_,oe,Me,Re}from"./chunk-index-s356ybxk.js";import{D}from"./chunk-index-6cs1wvhy.js";import{Ee}from"./chunk-index-sk8cvb4e.js";import{H}from"./chunk-index-9ehqccfe.js";import{C}from"./chunk-index-e8535c4h.js";import{Y}from"./chunk-index-d941ae7c.js";function dt(i,d,u){let[v,w]=r();s(()=>{if(!i)return;let N=(b)=>b.preventDefault(),O=(b)=>{if(b.button!==0||b.metaKey||b.ctrlKey||b.shiftKey||b.altKey)return;let W=b.target instanceof Element?b.target.closest("a"):null;if(!W||W.target||W.hasAttribute("download"))return;if(d.current?.contains(W))return;b.preventDefault(),b.stopPropagation(),w({kind:"link",anchor:W})},L=Qi((b)=>w({kind:"navigate",proceed:b}));return window.addEventListener("beforeunload",N),document.addEventListener("click",O,!0),()=>{L(),window.removeEventListener("beforeunload",N),document.removeEventListener("click",O,!0)}},[i,d]);let y=E(()=>w(void 0),[]),T=E(()=>{let N=v;if(u(),w(void 0),N?.kind==="link")setTimeout(()=>N.anchor.click(),0);else if(N?.kind==="navigate")N.proceed()},[v,u]);return{leaving:v,stay:y,leave:T}}var de=(i)=>`workspace/${encodeURIComponent(i)}`,xe=(i)=>`path=${encodeURIComponent(i)}`,_e=(i)=>({body:JSON.stringify(i)});function Ue(i){if(!(i instanceof fe)||i.status!==409)return;let d=i.body;return d?.conflict==="changed"||d?.conflict==="gone"||d?.conflict==="exists"?d:void 0}var q={roots:()=>h("workspace"),list:(i,d)=>h(`${de(i)}/list?${xe(d)}`),file:(i,d)=>h(`${de(i)}/file?${xe(d)}`),save:(i,d,u,v)=>h(`${de(i)}/file?${xe(d)}`,{method:"PUT",..._e({text:u,baseHash:v})}),create:(i,d,u,v)=>h(`${de(i)}/new?${xe(d)}`,{method:"POST",..._e({kind:u,...v===void 0?{}:{text:v}})}),rename:(i,d,u)=>h(`${de(i)}/rename`,{method:"POST",..._e({from:d,to:u})}),remove:(i,d)=>h(`${de(i)}/entry?${xe(d)}`,{method:"DELETE"}),trash:(i)=>h(`${de(i)}/trash`),restore:(i,d)=>h(`${de(i)}/trash/${encodeURIComponent(d)}/restore`,{method:"POST"}),purge:(i,d)=>h(`${de(i)}/trash/${encodeURIComponent(d)}`,{method:"DELETE"})},we=(i,d,u=!1)=>`api/${de(i)}/raw?${xe(d)}${u?"&download=1":""}`;var We=(i)=>i.split("/").filter(Boolean),ve=(i)=>We(i).slice(0,-1).join("/"),Ne=(i,d)=>i?`${i}/${d}`:d,ze=(i)=>`${i.root}:${i.path}${i.dir&&i.path?"/":""}`;function lt(i){if(!i)return;let d=i.indexOf(":");if(d<1)return;let u=i.slice(d+1);return{root:i.slice(0,d),path:u.replace(/\/+$/,""),dir:u===""||u.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:hover:not(:disabled) {
207
+ background: var(--surface-2);
208
+ }
209
+
210
+ .ws-twist svg {
211
+ transition: transform var(--dur-fast) var(--ease-out);
212
+ }
213
+
214
+ .ws-twist[aria-expanded="true"] svg {
215
+ transform: rotate(90deg);
216
+ }
217
+
218
+ /* ── A folder ───────────────────────────────────────────────────────────────────────────────────── */
219
+
220
+ .ws-dir {
221
+ padding: var(--space-2) var(--space-3)
222
+ calc(var(--space-6) + var(--safe-bottom));
223
+ display: flex;
224
+ flex-direction: column;
225
+ gap: var(--space-3);
226
+ }
227
+
228
+ /* 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. */
229
+ .ws-listing {
230
+ display: flex;
231
+ flex-direction: column;
232
+ gap: var(--space-3);
233
+ transition: opacity var(--dur-fast) var(--ease-out) 150ms;
234
+ }
235
+
236
+ .ws-listing[data-pending] {
237
+ opacity: 0.55;
238
+ }
239
+
240
+ .ws-rows {
241
+ list-style: none;
242
+ margin: 0;
243
+ padding: 0;
244
+ display: flex;
245
+ flex-direction: column;
246
+ }
247
+
248
+ .ws-row {
249
+ display: flex;
250
+ align-items: center;
251
+ border-bottom: 1px solid var(--border);
252
+ }
253
+
254
+ .ws-row[data-quiet] {
255
+ opacity: 0.6;
256
+ }
257
+
258
+ .ws-row-link {
259
+ flex: 1;
260
+ min-width: 0;
261
+ display: flex;
262
+ align-items: center;
263
+ gap: var(--space-3);
264
+ min-height: 3rem;
265
+ padding: var(--space-2) var(--space-1);
266
+ color: var(--text);
267
+ text-decoration: none;
268
+ }
269
+
270
+ .ws-row-link[data-off] {
271
+ color: var(--muted);
272
+ }
273
+
274
+ a.ws-row-link:hover {
275
+ background: var(--surface-2);
276
+ }
277
+
278
+ .ws-row-icon {
279
+ flex: none;
280
+ color: var(--muted);
281
+ }
282
+
283
+ .ws-row-main {
284
+ min-width: 0;
285
+ display: flex;
286
+ flex-direction: column;
287
+ }
288
+
289
+ .ws-row-main strong {
290
+ overflow: hidden;
291
+ text-overflow: ellipsis;
292
+ white-space: nowrap;
293
+ font-weight: var(--weight-medium);
294
+ }
295
+
296
+ /* ── A file ─────────────────────────────────────────────────────────────────────────────────────── */
297
+
298
+ .ws-file {
299
+ flex: 1;
300
+ min-height: 0;
301
+ min-width: 0;
302
+ display: flex;
303
+ flex-direction: column;
304
+ }
305
+
306
+ .ws-file-head {
307
+ flex: none;
308
+ display: flex;
309
+ align-items: center;
310
+ gap: var(--space-3);
311
+ flex-wrap: wrap;
312
+ padding: var(--space-2) var(--space-3);
313
+ border-bottom: 1px solid var(--border);
314
+ background: var(--surface);
315
+ }
316
+
317
+ .ws-file-title {
318
+ flex: 1;
319
+ min-width: 8rem;
320
+ display: flex;
321
+ flex-direction: column;
322
+ }
323
+
324
+ .ws-file-title strong {
325
+ overflow: hidden;
326
+ text-overflow: ellipsis;
327
+ white-space: nowrap;
328
+ }
329
+
330
+ .ws-actions {
331
+ flex: none;
332
+ display: flex;
333
+ align-items: center;
334
+ gap: var(--space-2);
335
+ }
336
+
337
+ .ws-banner {
338
+ flex: none;
339
+ display: flex;
340
+ align-items: center;
341
+ gap: var(--space-2);
342
+ flex-wrap: wrap;
343
+ padding: var(--space-2) var(--space-3);
344
+ background: var(--warn-soft);
345
+ color: var(--warn);
346
+ border-bottom: 1px solid var(--warn);
347
+ font-size: var(--text-sm);
348
+ }
349
+
350
+ .ws-banner-text {
351
+ flex: 1;
352
+ min-width: 10rem;
353
+ }
354
+
355
+ .ws-view {
356
+ flex: 1;
357
+ min-height: 0;
358
+ display: flex;
359
+ flex-direction: column;
360
+ background: var(--code-bg);
361
+ }
362
+
363
+ .ws-editor {
364
+ flex: 1;
365
+ min-height: 0;
366
+ display: flex;
367
+ flex-direction: column;
368
+ background: var(--code-bg);
369
+ }
370
+
371
+ .ws-editor .cm-editor {
372
+ flex: 1;
373
+ min-height: 0;
374
+ }
375
+
376
+ /* Editor font is 16px on a phone so a focus does not zoom the page; 13px beside a mouse. */
377
+ .ws-editor {
378
+ --code-size: 16px;
379
+ }
380
+
381
+ @media (min-width: 720px) {
382
+ .ws-editor {
383
+ --code-size: 13px;
384
+ }
385
+ }
386
+
387
+ /* Before the editor's code has arrived, and where it cannot load, the text is shown plainly. */
388
+ .ws-plain {
389
+ flex: 1;
390
+ margin: 0;
391
+ padding: var(--space-3);
392
+ overflow: auto;
393
+ font-family: var(--font-mono);
394
+ font-size: var(--code-size);
395
+ line-height: 1.55;
396
+ color: var(--code-fg);
397
+ tab-size: 2;
398
+ }
399
+
400
+ .ws-media {
401
+ flex: 1;
402
+ min-height: 0;
403
+ display: flex;
404
+ flex-direction: column;
405
+ }
406
+
407
+ .ws-image {
408
+ display: grid;
409
+ place-items: center;
410
+ padding: var(--space-4);
411
+ overflow: auto;
412
+ background-color: var(--surface-2);
413
+ background-image:
414
+ linear-gradient(
415
+ 45deg,
416
+ var(--surface-3, var(--border)) 25%,
417
+ transparent 25%,
418
+ transparent 75%,
419
+ var(--surface-3, var(--border)) 75%
420
+ ),
421
+ linear-gradient(
422
+ 45deg,
423
+ var(--surface-3, var(--border)) 25%,
424
+ transparent 25%,
425
+ transparent 75%,
426
+ var(--surface-3, var(--border)) 75%
427
+ );
428
+ background-size: 16px 16px;
429
+ background-position:
430
+ 0 0,
431
+ 8px 8px;
432
+ }
433
+
434
+ .ws-image-toggle {
435
+ display: grid;
436
+ place-items: center;
437
+ max-width: 100%;
438
+ max-height: 100%;
439
+ padding: 0;
440
+ border: 0;
441
+ background: none;
442
+ cursor: zoom-in;
443
+ }
444
+
445
+ .ws-image-toggle:hover:not(:disabled) {
446
+ background: none;
447
+ }
448
+
449
+ .ws-image[data-actual] .ws-image-toggle {
450
+ max-width: none;
451
+ max-height: none;
452
+ cursor: zoom-out;
453
+ }
454
+
455
+ .ws-image img {
456
+ max-width: 100%;
457
+ max-height: 100%;
458
+ object-fit: contain;
459
+ }
460
+
461
+ .ws-image[data-actual] img {
462
+ max-width: none;
463
+ max-height: none;
464
+ }
465
+
466
+ .ws-pdf-frame {
467
+ gap: var(--space-2);
468
+ }
469
+
470
+ .ws-pdf {
471
+ flex: 1;
472
+ min-height: 0;
473
+ width: 100%;
474
+ border: 0;
475
+ background: var(--surface-2);
476
+ }
477
+
478
+ .ws-media-actions {
479
+ display: flex;
480
+ flex-wrap: wrap;
481
+ gap: var(--space-3);
482
+ padding: var(--space-2) var(--space-4);
483
+ }
484
+
485
+ .ws-sound,
486
+ .ws-film {
487
+ align-items: center;
488
+ justify-content: center;
489
+ padding: var(--space-4);
490
+ background: var(--surface-2);
491
+ }
492
+
493
+ .ws-sound audio,
494
+ .ws-film video {
495
+ width: 100%;
496
+ max-height: 100%;
497
+ }
498
+
499
+ .ws-card-icon {
500
+ color: var(--muted, inherit);
501
+ }
502
+
503
+ .ws-card {
504
+ margin: var(--space-4);
505
+ display: flex;
506
+ flex-direction: column;
507
+ align-items: flex-start;
508
+ gap: var(--space-3);
509
+ }
510
+
511
+ .ws-card p {
512
+ margin: 0;
513
+ }
514
+
515
+ .button-link {
516
+ display: inline-flex;
517
+ align-items: center;
518
+ gap: var(--space-2);
519
+ min-height: 2.5rem;
520
+ padding: 0 var(--space-4);
521
+ border-radius: var(--radius);
522
+ background: var(--accent);
523
+ color: var(--on-accent);
524
+ text-decoration: none;
525
+ font-weight: var(--weight-medium);
526
+ }
527
+
528
+ /* The bar of the phone's editor: above the keyboard, whose height the layout already follows. */
529
+ .ws-editbar {
530
+ flex: none;
531
+ display: flex;
532
+ gap: var(--space-2);
533
+ overflow-x: auto;
534
+ padding: var(--space-2) var(--space-3)
535
+ calc(var(--space-2) + var(--safe-bottom));
536
+ border-top: 1px solid var(--border);
537
+ background: var(--surface);
538
+ }
539
+
540
+ .ws-editbar button {
541
+ flex: none;
542
+ min-height: var(--touch);
543
+ min-width: var(--touch);
544
+ }
545
+
546
+ /* ── Looks ──────────────────────────────────────────────────────────────────────────────────────── */
547
+
548
+ [data-look="camelot"] .ws-head,
549
+ [data-look="camelot"] .ws-file-head {
550
+ border-bottom-color: var(--gold-soft);
551
+ box-shadow: 0 1px 0 color-mix(in srgb, var(--gold) 38%, transparent);
552
+ }
553
+
554
+ [data-look="camelot"] .ws-tree {
555
+ background: var(--surface);
556
+ border-right-color: var(--gold-soft);
557
+ }
558
+
559
+ [data-look="camelot"] .ws-tree-row[data-selected] a {
560
+ background: var(--gold-wash);
561
+ color: var(--accent-ink);
562
+ }
563
+
564
+ /* Rune bullets for the folders of the Camelot tree. */
565
+ [data-look="camelot"] .ws-tree-row a svg,
566
+ [data-look="camelot"] .ws-row-icon {
567
+ color: var(--gold);
568
+ }
569
+
570
+ [data-look="camelot"] .ws-view {
571
+ margin: var(--space-2) var(--space-3) var(--space-3);
572
+ border: 1px solid color-mix(in srgb, var(--gold) 34%, var(--border));
573
+ border-radius: var(--radius);
574
+ overflow: hidden;
575
+ }
576
+
577
+ [data-look="camelot"] .ws-crumbs a[aria-current="page"] {
578
+ background: var(--gold-wash);
579
+ }
580
+
581
+ @media (prefers-reduced-motion: reduce) {
582
+ .ws-twist svg {
583
+ transition: none;
584
+ }
585
+ }
586
+ `;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:d,size:u=20,className:v}=i;if(!Ct(d))return e(o,{name:d,size:u,...v?{className:v}:{}});return e("svg",{viewBox:"0 0 24 24",width:u,height:u,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...v?{className:v}:{},children:e("path",{d:ut[d]})})}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(o,{name:"download",size:18}),t("Download")]})]})}function Ge(i){let d=i.name.lastIndexOf("."),u=d>0?i.name.slice(d+1).toUpperCase():"";return n("div",{className:"card ws-card",children:[e("span",{className:"ws-card-icon","aria-hidden":"true",children:e(o,{name:"file",size:32})}),e("strong",{children:i.name}),e("span",{className:"meta",children:[u,Me(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:d,root:u,path:v,name:w,bytes:y,phone:T,onFacts:N}=i,[O,L]=r(!1),[b,W]=r(!1);s(()=>(L(!1),W(!1),N(void 0),()=>N(void 0)),[u,v]);let I=we(u,v);if(O)return e(Ge,{root:u,path:v,name:w,bytes:y,message:t("This browser cannot show this file.")});switch(d){case"image":return e("div",{className:"ws-media ws-image","data-actual":b||void 0,children:e("button",{type:"button",className:"ws-image-toggle","aria-label":b?t("Fit to window"):t("Show at full size"),title:b?t("Fit to window"):t("Show at full size"),onClick:()=>W((F)=>!F),children:e("img",{src:I,alt:w,onLoad:(F)=>{let{naturalWidth:te,naturalHeight:Z}=F.currentTarget;N(te>0?`${te} × ${Z}`:void 0)},onError:()=>L(!0)})})});case"pdf":return Et(T)?n("div",{className:"ws-media ws-pdf-frame",children:[e("iframe",{className:"ws-pdf",src:I,title:w}),e(Ze,{root:u,path:v,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(o,{name:"file",size:32})}),e("strong",{children:w}),n("span",{className:"meta",children:["PDF · ",Me(y)]}),e(Ze,{root:u,path:v,name:w,open:!0})]})});case"audio":return e("div",{className:"ws-media ws-sound",children:e("audio",{controls:!0,preload:"metadata",src:I,onError:()=>L(!0)})});case"video":return e("div",{className:"ws-media ws-film",children:e("video",{controls:!0,playsInline:!0,preload:"metadata",src:I,onLoadedMetadata:(F)=>{let{videoWidth:te,videoHeight:Z}=F.currentTarget;N(te>0?`${te} × ${Z}`:void 0)},onError:()=>L(!0)})})}}var St={"read-only-root":c("this place is read-only"),"git-dir":c("inside .git"),trash:c("in the trash"),symlink:c("a link"),binary:c("binary file"),"too-large":c("too large"),"not-utf8":c("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,d){try{let u=localStorage.getItem(i);return u===null?d:JSON.parse(u)}catch{return d}}function Be(i,d){try{localStorage.setItem(i,JSON.stringify(d))}catch{}}var De=On({rev:0,bump:()=>{return}});Y("workspace",ct);var Ce=new Map,Rt=200;function Tt(i,d){Ce.delete(i),Ce.set(i,d);let u=Ce.keys().next().value;if(Ce.size>Rt&&u!==void 0)Ce.delete(u)}function ht(i,d,u=!0){let{rev:v}=Te(De),[w,y]=r(0),[T,N]=r({key:"",root:i,path:d}),O=`${i}:${d}`;if(s(()=>{let b=()=>y((W)=>W+1);return window.addEventListener("focus",b),()=>window.removeEventListener("focus",b)},[]),s(()=>{if(!u)return;let b=!0;return q.list(i,d).then((W)=>{if(Tt(O,W),b)N({key:O,root:i,path:d,data:W})},(W)=>b&&N({key:O,root:i,path:d,error:l(W)})),()=>{b=!1}},[i,d,u,v,w]),T.key===O)return{data:T.data,error:T.error,at:T};let L=Ce.get(O);if(L)return{data:L,at:{root:i,path:d}};if(T.data)return{data:T.data,at:T,pending:!0};return{}}var Se=(i)=>S("workspace",ze(i));function tt(i,d,u){let v=Ne(d,u.name);if(u.kind==="dir")return{root:i,path:v,dir:!0};if(u.kind==="file")return{root:i,path:v,dir:!1};if(u.kind==="symlink"&&u.inside)return{root:i,path:v,dir:u.target==="dir"};return}function Lt(i){let d=We(i.path),u=a(null);return s(()=>{u.current?.scrollIntoView?.({inline:"end",block:"nearest"})},[i.path]),n("nav",{className:"ws-crumbs","aria-label":t("Path"),children:[e("a",{ref:d.length===0?u:void 0,href:Se({root:i.root.id,path:"",dir:!0}),"aria-current":d.length===0?"page":void 0,children:Qe(i.root)}),d.map((v,w)=>{let y=d.slice(0,w+1).join("/"),T=w===d.length-1;return e("a",{ref:T?u:void 0,href:Se({root:i.root.id,path:y,dir:!0}),"aria-current":T?"page":void 0,children:v},y)})]})}function wt(i){let{data:d,error:u,pending:v}=ht(i.root,i.path);if(u)return e("p",{className:"ws-tree-note",children:u});if(!d||v)return e("p",{className:"ws-tree-note",children:"…"});if(d.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:[d.entries.map((w)=>{let y=tt(i.root,i.path,w),T=Ne(i.path,w.name),N=y?.dir===!0,O=N&&i.open.has(T),L=i.current?.root===i.root&&i.current.path===T&&i.current.dir===N;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:[N?e("button",{type:"button",className:"ws-twist","aria-expanded":O,"aria-label":t("Show or hide {name}",{name:w.name}),onClick:()=>i.toggle(T),children:e(o,{name:"chevron",size:14})}):e("span",{className:"ws-twist"}),y?n("a",{href:Se(y),title:w.name,children:[e(be,{name:N?"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(o,{name:"file",size:15}),e("span",{className:"ws-tree-label",children:w.name})]})]}),O?e(wt,{root:i.root,path:T,depth:i.depth+1,open:i.open,toggle:i.toggle,current:i.current}):null]},w.name)}),d.truncated?e("li",{className:"ws-tree-note",children:t("Only the first 2,000 items are listed")}):null]})}function Wt(i){let{data:d,error:u,at:v,pending:w}=ht(i.root.id,i.path),{timeZone:y}=_(),T=a(null),N=v?.root??i.root.id,O=v?.path??i.path;if(Pe(()=>{T.current?.closest(".ws-main")?.scrollTo?.(0,0)},[N,O]),u)return e(m,{message:u});if(!d)return e(x,{});if(d.missing)return e(k,{children:t("No files yet")});if(d.entries.length===0)return e(k,{children:t("This folder is empty")});return n("div",{ref:T,className:"ws-listing","data-pending":w||void 0,"aria-busy":w||void 0,inert:w||void 0,children:[e("ul",{className:"ws-rows",children:d.entries.map((L)=>{let b=tt(N,O,L),W=n(g,{children:[e(be,{name:b?.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"):[b?.dir?void 0:Me(L.size),oe(new Date(L.mtimeMs).toISOString(),y)].filter(Boolean).join(" · ")})]})]});return n("li",{className:"ws-row","data-quiet":gt.has(L.name)||void 0,children:[b?e("a",{className:"ws-row-link",href:Se(b),children:W}):e("span",{className:"ws-row-link","data-off":!0,children:W}),i.root.writable||b?e("button",{type:"button",className:"icon-button","aria-label":t("Actions for {name}",{name:L.name}),onClick:()=>i.onMenu(L),children:e(o,{name:"menu"})}):null]},L.name)})}),d.truncated?e("p",{className:"meta",children:t("Only the first 2,000 items are listed")}):null]})}function zt(i){let{timeZone:d}=_(),{bump:u}=Te(De),{root:v,path:w}=i,[y,T]=r(),[N,O]=r(),[L,b]=r("read"),[W,I]=r(!1),[F,te]=r(!1),[Z,je]=r(()=>et(pt,i.phone)),[$e,ne]=r(!1),[Le,ke]=r(),[V,K]=r(!1),[G,ue]=r(!1),[Oe,qe]=r(!1),[me,le]=r(),[B,pe]=r(),[ye,Ie]=r(),ge=a(null),U=a(void 0),M=a(null),ie=a(y);ie.current=y;let J=a(L);J.current=L;let Q=We(w).at(-1)??w,Fe=y?.text!==void 0,Ve=Fe&&(y?.media===void 0||V),nt=E(async()=>{let z=await q.file(v.id,w);return T(z),z},[v.id,w]);s(()=>{let z=!0;return q.file(v.id,w).then((j)=>z&&T(j),(j)=>z&&O(l(j))),()=>{z=!1}},[v.id,w]);let Xe=dt(W,M,()=>{let z=ie.current;if(z?.text!==void 0)U.current?.replace(z.text,z.eol);I(!1),b("read")});s(()=>{if(!W)return;let z=document.title;return document.title=`• ${z}`,()=>{document.title=z}},[W]);let Ae=E(async(z,j)=>{let ce=ie.current,ee=U.current;if(!ce||!ee||F)return;let ae=j===void 0?ee.snapshot():void 0,Ke=j??ee.text();te(!0);try{let re=await q.save(v.id,w,Ke,z??ce.hash);ee.markSaved(ae),I(ee.dirty()),le(void 0),T({...ce,hash:re.hash,size:re.size,mtimeMs:re.mtimeMs,text:Ke}),f(t("Saved")),u()}catch(re){let se=Ue(re);if(se)pe({kind:se.conflict==="gone"?"gone":"changed",...se.current?{hash:se.current.hash}:{},text:Ke});else f(l(re),"danger")}finally{te(!1)}},[v.id,w,F,u]),at=a(Ae);at.current=Ae;let he=E(async()=>{try{let z=await nt();if(z.text!==void 0)U.current?.replace(z.text,z.eol);I(!1),le(void 0),pe(void 0)}catch(z){f(l(z),"danger")}},[nt]),vt=a(he);vt.current=he;let Ye=E(()=>{if(U.current?.dirty()){ot(!0);return}b("read")},[]),[bt,ot]=r(!1),rt=a(Ye);rt.current=Ye,s(()=>{if(!Ve||!ge.current)return;let z=ie.current;if(!z||z.text===void 0)return;let j=!1,ce;return (p("102wa9bj"),import("./chunk-codeeditor-102wa9bj.js")).then(async({createEditor:ee})=>{if(j||!ge.current)return;let ae=await ee({parent:ge.current,text:z.text??"",eol:z.eol,language:z.language,editable:!1,wrap:Z,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:()=>I(ae.dirty()),onSave:()=>{if(J.current==="edit"&&ae.dirty())at.current()},onEscape:()=>{if(J.current==="edit")rt.current()}});if(j){ae.destroy();return}ce=ae,U.current=ae,ue(!0)}).catch((ee)=>{if(console.warn("the editor failed to load",ee),!j)qe(!0)}),()=>{j=!0,ce?.destroy(),U.current=void 0,ue(!1)}},[Ve,v.id,w]),s(()=>{if(!G)return;let z=L==="edit"&&y?.editable===!0;if(U.current?.setEditable(z),z)U.current?.focus()},[L,G,y?.editable]),s(()=>{if(!G)return;U.current?.setWrap(Z),Be(pt,Z)},[Z,G]);let it=y!==void 0;if(s(()=>{if(!it)return;let z=!1,j=async()=>{if(z||document.visibilityState==="hidden")return;let ae=ie.current;if(!ae)return;z=!0;try{let re=(await q.list(v.id,ve(w))).entries.find((xt)=>xt.name===Q);if(!re){le("gone");return}if(re.kind==="symlink")return;if(re.size===ae.size&&re.mtimeMs===ae.mtimeMs)return;if(J.current==="edit"&&U.current?.dirty()){le("changed");return}let se=await q.file(v.id,w);if(se.hash!==ae.hash){if(T(se),se.text!==void 0)U.current?.replace(se.text,se.eol)}le(void 0)}catch{}finally{z=!1}},ce=setInterval(()=>void j(),5000),ee=()=>void j();return window.addEventListener("focus",ee),document.addEventListener("visibilitychange",ee),()=>{clearInterval(ce),window.removeEventListener("focus",ee),document.removeEventListener("visibilitychange",ee)}},[it,v.id,w,Q]),N)return e("div",{className:"ws-file",children:e(m,{message:N})});if(!y)return e("div",{className:"ws-file",children:e(x,{})});let st=y.reason,kt=!y.editable?e(P,{tone:"warn",children:t("Read only: {reason}",{reason:st?t(St[st]):""})}):null,He=L==="edit",yt=n("div",{className:"ws-actions",children:[y.editable&&!He?e("button",{type:"button",onClick:()=>{K(!0),b("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:()=>ne(!0),children:e(o,{name:"menu"})})]});return n("div",{className:"ws-file",ref:M,children:[n("header",{className:"ws-file-head",children:[n("div",{className:"ws-file-title",children:[n("strong",{children:[W?"• ":"",Q]}),n("span",{className:"meta",children:[Me(y.size),Le?` · ${Le}`:""," ·"," ",oe(new Date(y.mtimeMs).toISOString(),d)]})]}),kt,yt]}),me?n("div",{className:"ws-banner",role:"status",children:[e("span",{className:"ws-banner-text",children:me==="gone"?t("This file is gone"):t("A knight is changing this file")}),me==="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:()=>le(void 0),children:t("Keep editing")})]}):null]}):null,e("div",{className:"ws-view",children:y.media&&!Ve?e(mt,{media:y.media,root:v.id,path:w,name:Q,bytes:y.size,phone:i.phone,onFacts:ke}):Ve?e("div",{ref:ge,className:"ws-editor","data-editing":He||void 0,children:!G?e("pre",{className:"ws-plain","aria-busy":!Oe,children:y.text}):null}):e(Ge,{root:v.id,path:w,name:Q,bytes:y.size,message:y.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:()=>U.current?.undo(),children:t("Undo")}),e("button",{type:"button",className:"secondary",onClick:()=>U.current?.redo(),children:t("Redo")}),e("button",{type:"button",className:"secondary",onClick:()=>U.current?.find(),children:t("Find")}),e("button",{type:"button",className:"secondary",onClick:()=>U.current?.tab(),children:t("Tab")})]}):null,e(C,{open:$e,title:Q,onClose:()=>ne(!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((z)=>!z),ne(!1)},children:e("span",{className:"menu-text",children:e("strong",{children:Z?t("Do not wrap lines"):t("Wrap lines")})})})}):null,e("li",{children:n("a",{className:"menu-item menu-link",href:we(v.id,w,!0),download:Q,onClick:()=>ne(!1),children:[e("span",{className:"menu-icon",children:e(o,{name:"download"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Download")})})]})}),e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{ne(!1),he()},children:[e("span",{className:"menu-icon",children:e(o,{name:"refresh"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Reload")})})]})})]})})}),e(H,{open:B!==void 0,title:B?.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:B?.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(B?.text??"").then(()=>f(t("Copied")))},children:t("Copy my text")}),B?.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(!B)return;if(B.kind==="gone"){let z=B.text;pe(void 0),q.create(v.id,w,"file",z).then(async()=>{await he(),u()}).catch((j)=>f(l(j),"danger"));return}Ie({hash:B.hash??"",text:B.text}),pe(void 0)},children:B?.kind==="gone"?t("Save mine as a new file"):t("Save mine anyway")})]})]})}),e(D,{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 q.save(v.id,w,ye.text,ye.hash),await he(),f(t("Saved")),u()},children:e("p",{children:t("The file has been changed since you opened it. Saving yours writes over those changes.")})}),e(D,{open:bt,title:t("Unsaved changes, leave?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:()=>ot(!1),onConfirm:async()=>{if(y.text!==void 0)U.current?.replace(y.text,y.eol);I(!1),b("read")},children:e("p",{children:t("Your edits to {name} have not been saved.",{name:Q})})}),e(D,{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:Q})})})]})}function Mt(i){let{ask:d}=i,[u,v]=r(""),[w,y]=r(),[T,N]=r(!1),O=A();s(()=>{v(d?.kind==="rename"?d.name:""),y(void 0)},[d]);let L=d?.kind==="rename"?t("Rename"):d?.kind==="dir"?t("New folder"):t("New file"),b=async(W)=>{if(W.preventDefault(),!d)return;let I=u.trim();if(!I||I.includes("/")){y(t("Use a name without slashes."));return}N(!0),y(void 0);try{if(d.kind==="rename"){let F=Ne(ve(d.path),I);await q.rename(i.root.id,d.path,F),f(t("Renamed")),i.onDone()}else{let F=Ne(d.dir,I);await q.create(i.root.id,F,d.kind),f(t("Created")),i.onDone({root:i.root.id,path:F,dir:d.kind==="dir"})}}catch(F){let te=Ue(F);y(te?.conflict==="exists"?t("Something with that name is already there."):l(F))}finally{N(!1)}};return e(H,{open:d!==void 0,title:L,onClose:i.onClose,children:n("form",{className:"stack",onSubmit:b,children:[e("label",{htmlFor:O,children:t("Name")}),e("input",{id:O,value:u,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,onChange:(W)=>v(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:T||!u.trim(),children:d?.kind==="rename"?t("Rename"):t("Create")})]})]})})}function Dt(i){let{bump:d,rev:u}=Te(De),[v,w]=r(),[y,T]=r(),[N,O]=r(),{timeZone:L}=_();return s(()=>{if(!i.open)return;let b=!0;return q.trash(i.root.id).then((W)=>b&&w(W.items),(W)=>b&&T(l(W))),()=>{b=!1}},[i.open,i.root.id,u]),n(H,{open:i.open,title:t("Trash"),onClose:i.onClose,children:[n("div",{className:"stack",children:[y?e(m,{message:y}):null,!v&&!y?e(x,{}):null,v?.length===0?e(k,{children:t("The trash is empty")}):null,e("ul",{className:"ws-rows",children:v?.map((b)=>n("li",{className:"ws-row",children:[n("span",{className:"ws-row-link","data-off":!0,children:[e(be,{name:b.kind==="dir"?"folder":"file",size:20,className:"ws-row-icon"}),n("span",{className:"ws-row-main",children:[e("strong",{children:b.path}),e("span",{className:"meta",children:oe(b.deletedAt,L)})]})]}),e("button",{type:"button",className:"secondary",onClick:async()=>{try{await q.restore(i.root.id,b.id),f(t("Restored")),d()}catch(W){let I=Ue(W);f(I?I.conflict==="exists"?t("Something with that name is already there."):t("The folder it was in is gone."):l(W),"danger")}},children:t("Restore")}),e("button",{type:"button",className:"icon-button danger-icon","aria-label":t("Delete {name} for good",{name:b.name}),onClick:()=>O(b),children:e(o,{name:"trash"})})]},b.id))})]}),e(D,{open:N!==void 0,title:t("Delete for good?"),confirmLabel:t("Delete for good"),tone:"danger",onClose:()=>O(void 0),onConfirm:async()=>{if(!N)return;await q.purge(i.root.id,N.id),d()},children:e("p",{children:t("“{name}” will be removed and cannot be brought back.",{name:N?.path??""})})})]})}function kn(){let i=ur(),d=!Re("(min-width: 720px)"),[u,v]=r(0),w=E(()=>v((M)=>M+1),[]),y=R(()=>({rev:u,bump:w}),[u,w]),[T,N]=r(),[O,L]=r();s(()=>{q.roots().then((M)=>N(M.roots),(M)=>L(l(M)))},[]);let[b,W]=r(()=>et(ft,280)),[I,F]=r(),[te,Z]=r(),[je,$e]=r(!1),[ne,Le]=r(),ke=lt(i.key),V=T?.find((M)=>M.id===ke?.root)??(d?void 0:T?.[0]),K=V?ke&&ke.root===V.id?ke:{root:V.id,path:"",dir:!0}:void 0,G=V?.id,ue=K?.path,Oe=K?.dir,[qe,me]=r(new Set);s(()=>{if(!G)return;me(new Set(et(Je(G),[])))},[G]);let le=E((M)=>{if(!G)return;me((ie)=>{let J=new Set(ie);if(J.has(M))J.delete(M);else J.add(M);return Be(Je(G),[...J]),J})},[G]);if(s(()=>{if(!G||ue===void 0||d)return;let M=We(Oe?ue:ve(ue)),ie=M.map((J,Q)=>M.slice(0,Q+1).join("/"));me((J)=>{if(ie.every((Fe)=>J.has(Fe)))return J;let Q=new Set([...J,...ie]);return Be(Je(G),[...Q]),Q})},[G,ue,Oe,d]),O)return e(m,{message:O});if(!T)return e(x,{});if(T.length===0)return e(k,{children:t("No files yet")});if(!V||!K)return e(De.Provider,{value:y,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:T.map((M)=>e("li",{children:n("a",{className:"menu-item menu-link",href:Se({root:M.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(M)}),M.writable?null:e("span",{className:"meta",children:t("Read only")})]}),e(o,{name:"chevron",size:16})]})},M.id))})]})});let B=K.dir?K.path:ve(K.path),pe=K.path===""?{root:V.id,path:"",dir:!0}:{root:V.id,path:ve(K.path),dir:!0},ye=n("header",{className:"ws-head",children:[d?e("a",{className:"icon-button","aria-label":t("Back"),href:K.path===""?S("workspace"):Se(pe),children:e(o,{name:"back"})}):e(Ee,{chip:!0,className:"ws-root-picker","aria-label":t("Place"),value:V.id,onChange:(M)=>X("workspace",ze({root:M.target.value,path:"",dir:!0})),children:T.map((M)=>e("option",{value:M.id,children:Qe(M)},M.id))}),e(Lt,{root:V,path:K.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:()=>Z({kind:"file",dir:B}),children:e(be,{name:"file-plus"})}),e("button",{type:"button",className:"icon-button","aria-label":t("New folder"),title:t("New folder"),onClick:()=>Z({kind:"dir",dir:B}),children:e(be,{name:"folder-plus"})}),e("button",{type:"button",className:"icon-button","aria-label":t("Trash"),title:t("Trash"),onClick:()=>$e(!0),children:e(o,{name:"trash"})})]}):null]}),Ie=K.dir?e("div",{className:"ws-dir",children:e(Wt,{root:V,path:K.path,onMenu:(M)=>F(M)})}):e(zt,{root:V,path:K.path,phone:d},`${V.id}:${K.path}`),ge=I?tt(V.id,B,I):void 0,U=I?Ne(B,I.name):"";return n(De.Provider,{value:y,children:[n("div",{className:"ws-page ws","data-wide":!d||void 0,style:{"--ws-tree":`${b}px`},children:[ye,n("div",{className:"ws-body",children:[!d?n(g,{children:[e("aside",{className:"ws-tree","aria-label":t("Folders"),children:e(wt,{root:V.id,path:"",depth:0,open:qe,toggle:le,current:K})}),e($t,{width:b,onChange:(M)=>{W(M),Be(ft,M)}})]}):null,e("section",{className:"ws-main",children:Ie})]})]}),e(C,{open:I!==void 0,title:I?.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,U,!0),download:I?.name,onClick:()=>F(void 0),children:[e("span",{className:"menu-icon",children:e(o,{name:"download"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Download")})})]})}):null,V.writable&&I?n(g,{children:[e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{Z({kind:"rename",path:U,name:I.name}),F(void 0)},children:[e("span",{className:"menu-icon",children:e(o,{name:"notes"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Rename")})})]})}),e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{Le({path:U,name:I.name}),F(void 0)},children:[e("span",{className:"menu-icon",children:e(o,{name:"trash"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Delete")})})]})})]}):null]})}),e(Mt,{root:V,ask:te,onClose:()=>Z(void 0),onDone:(M)=>{if(Z(void 0),w(),M)X("workspace",ze(M))}}),e(Dt,{root:V,open:je,onClose:()=>$e(!1)}),e(D,{open:ne!==void 0,title:t("Move to the trash?"),confirmLabel:t("Delete"),tone:"danger",onClose:()=>Le(void 0),onConfirm:async()=>{if(!ne)return;if(await q.remove(V.id,ne.path),f(t("Moved to the trash")),w(),!K.dir&&(K.path===ne.path||K.path.startsWith(`${ne.path}/`)))X("workspace",ze({root:V.id,path:ve(K.path),dir:!0}))},children:e("p",{children:t("“{name}” goes to the trash, where you can bring it back.",{name:ne?.name??""})})})]})}function $t(i){let v=(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(v(i.width-16));if(w.key==="ArrowRight")i.onChange(v(i.width+16))},onPointerDown:(w)=>{let y=w.clientX,T=i.width,N=w.currentTarget;N.setPointerCapture(w.pointerId);let O=(b)=>i.onChange(v(T+b.clientX-y)),L=()=>{N.removeEventListener("pointermove",O),N.removeEventListener("pointerup",L)};N.addEventListener("pointermove",O),N.addEventListener("pointerup",L)}})}export{kn as WorkspacePage};