pi-roundtable-web 0.27.1 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +25 -9
  3. package/dist/chunk-account-9616x405.js +1 -0
  4. package/dist/chunk-action-menu-q5y7xpry.js +1 -0
  5. package/dist/chunk-agent-x74xezyt.js +1 -0
  6. package/dist/chunk-arranged-rooms-9prq46vh.js +1 -0
  7. package/dist/chunk-bulk-actions-5dc4m9ad.js +1 -0
  8. package/dist/chunk-character-creator-wf02eg0h.js +1 -0
  9. package/dist/chunk-codeeditor-239ss6a2.js +2 -0
  10. package/dist/chunk-confirm-bhrx9195.js +1 -0
  11. package/dist/chunk-connectors-k77pd9by.js +37 -0
  12. package/dist/chunk-conversations-ftcpaqw1.js +1 -0
  13. package/dist/chunk-council-sheet-a5e6tspr.js +2 -0
  14. package/dist/chunk-council-view-6593rqbr.js +1 -0
  15. package/dist/chunk-drag-7873fvzw.js +1 -0
  16. package/dist/chunk-entry-5zmjxadx.js +1 -0
  17. package/dist/chunk-folder-list-h9hmbm8e.js +1 -0
  18. package/dist/chunk-folds-vxq86t1s.js +1 -0
  19. package/dist/chunk-gate-fa6za28z.js +1 -0
  20. package/dist/chunk-host-icons-y6frbzqt.js +1 -0
  21. package/dist/chunk-host-picture-fqg55rbr.js +1 -0
  22. package/dist/chunk-host-state-65tdhkyq.js +1 -0
  23. package/dist/chunk-host-ui-233kz7qp.js +1 -0
  24. package/dist/{chunk-index-j4x9dq30.css → chunk-index-1652v386.css} +1 -1
  25. package/dist/chunk-index-2c00zf3z.js +2 -0
  26. package/dist/chunk-index-2dhrqvba.js +2 -0
  27. package/dist/chunk-index-2s4bkrz3.js +2 -0
  28. package/dist/chunk-index-2ypaqwjy.js +2 -0
  29. package/dist/{chunk-index-k0z507h3.js → chunk-index-35zqk1zr.js} +2 -2
  30. package/dist/chunk-index-39qq37j5.js +2 -0
  31. package/dist/{chunk-index-j7pgphx3.js → chunk-index-3tjmyd1h.js} +2 -2
  32. package/dist/chunk-index-4eag6s50.js +2 -0
  33. package/dist/chunk-index-4jnn2g09.js +2 -0
  34. package/dist/{chunk-index-y60x5jbh.js → chunk-index-4krm48hm.js} +1 -1
  35. package/dist/{chunk-index-w42rcbx1.js → chunk-index-4re5prfp.js} +2 -2
  36. package/dist/chunk-index-57teqgct.js +2 -0
  37. package/dist/{chunk-index-3d8s3565.js → chunk-index-5ssncptg.js} +2 -2
  38. package/dist/{chunk-index-yrmqcay4.js → chunk-index-7c9fn21n.js} +2 -2
  39. package/dist/chunk-index-7k5895sn.js +14 -0
  40. package/dist/chunk-index-93f3e06v.js +2 -0
  41. package/dist/chunk-index-9m9v1p7s.js +2 -0
  42. package/dist/chunk-index-a8c0ap8g.js +2 -0
  43. package/dist/chunk-index-a8nqn3y0.js +3 -0
  44. package/dist/chunk-index-am7ghh75.js +120 -0
  45. package/dist/chunk-index-amspdq2j.js +4 -0
  46. package/dist/chunk-index-amxa2bn3.js +2 -0
  47. package/dist/{chunk-index-nsvwbjfe.js → chunk-index-aycxt14t.js} +2 -2
  48. package/dist/{chunk-index-n05yw5wd.js → chunk-index-bjeg3e2j.js} +2 -2
  49. package/dist/chunk-index-cttrqfm8.js +2 -0
  50. package/dist/chunk-index-dajanzxc.js +1 -0
  51. package/dist/chunk-index-e2eeckhh.js +2 -0
  52. package/dist/chunk-index-e46652wf.js +2 -0
  53. package/dist/chunk-index-ek98d2rn.js +2 -0
  54. package/dist/{chunk-index-f500nw4w.js → chunk-index-en5dm1zv.js} +2 -2
  55. package/dist/chunk-index-evhaaqzk.js +13 -0
  56. package/dist/chunk-index-f4gqzfkv.js +2 -0
  57. package/dist/{chunk-index-ak6ecqy3.js → chunk-index-gj3n4dh5.js} +2 -2
  58. package/dist/chunk-index-gp4chnp3.js +2 -0
  59. package/dist/{chunk-index-af4ebmkr.js → chunk-index-h2a42p6s.js} +3 -3
  60. package/dist/{chunk-index-4z4chg7v.js → chunk-index-haac6nbt.js} +2 -2
  61. package/dist/{chunk-index-3pnvpppa.js → chunk-index-hef4gwtb.js} +2 -2
  62. package/dist/chunk-index-mg96sqpk.js +2 -0
  63. package/dist/chunk-index-nsya88fn.js +1 -0
  64. package/dist/{chunk-index-ben4gv45.js → chunk-index-ntt3em2k.js} +1 -1
  65. package/dist/chunk-index-pcbkp62w.js +2 -0
  66. package/dist/chunk-index-pfs6rm6w.js +2 -0
  67. package/dist/chunk-index-pgxgq61x.js +2 -0
  68. package/dist/{chunk-index-9z13jw6q.js → chunk-index-q33ppq0j.js} +3 -3
  69. package/dist/chunk-index-r0hk9kyd.js +47 -0
  70. package/dist/{chunk-index-0ye10vk3.js → chunk-index-rr73h4kc.js} +3 -3
  71. package/dist/{chunk-index-983dmeaa.js → chunk-index-rtz4936v.js} +3 -3
  72. package/dist/chunk-index-smz90j6p.js +2 -0
  73. package/dist/chunk-index-teyx2hz7.js +2 -0
  74. package/dist/{chunk-index-sm7m4fej.js → chunk-index-v6h43553.js} +2 -2
  75. package/dist/chunk-index-vzqwn3wp.js +2 -0
  76. package/dist/chunk-index-wt2asefx.js +50 -0
  77. package/dist/chunk-index-x4tq9btg.js +2 -0
  78. package/dist/chunk-index-y6p8j3zv.js +2 -0
  79. package/dist/chunk-index-yvcdg5hh.js +2 -0
  80. package/dist/{chunk-index-afrhnrxj.js → chunk-index-zdzzf3fp.js} +2 -2
  81. package/dist/chunk-index-zeqfnkty.js +2 -0
  82. package/dist/chunk-index-zpwb8mkk.js +2 -0
  83. package/dist/chunk-lang-css-avzhvm72.js +1 -0
  84. package/dist/{chunk-lang-dockerfile-cnwqn660.js → chunk-lang-dockerfile-2p7e3ssz.js} +1 -1
  85. package/dist/{chunk-lang-go-yy6kgsxv.js → chunk-lang-go-zxp9k517.js} +3 -3
  86. package/dist/chunk-lang-html-red02gep.js +1 -0
  87. package/dist/chunk-lang-javascript-n33kmjcx.js +1 -0
  88. package/dist/chunk-lang-json-zmym50rg.js +1 -0
  89. package/dist/chunk-lang-markdown-ww2kcs85.js +6 -0
  90. package/dist/chunk-lang-python-ng1zdtd4.js +3 -0
  91. package/dist/chunk-lang-rust-6ynhxjdd.js +1 -0
  92. package/dist/{chunk-lang-shell-1rpgtepw.js → chunk-lang-shell-39t9bz2s.js} +1 -1
  93. package/dist/chunk-lang-sql-w875ejpg.js +2 -0
  94. package/dist/{chunk-lang-toml-tbj7467c.js → chunk-lang-toml-b8ckgkg5.js} +1 -1
  95. package/dist/chunk-lang-typescript-qf8acbb2.js +1 -0
  96. package/dist/chunk-lang-xml-bz91cjp1.js +1 -0
  97. package/dist/chunk-lang-yaml-g9zy0tdv.js +1 -0
  98. package/dist/chunk-layout-actions-fyzzzeyp.js +1 -0
  99. package/dist/chunk-menu-items-yvnk3vds.js +1 -0
  100. package/dist/chunk-mode-toggle-ccv271hm.js +1 -0
  101. package/dist/chunk-note-row-314py1pp.js +204 -0
  102. package/dist/chunk-notes-4rnrddzw.js +1 -0
  103. package/dist/chunk-notice-bell-z9wgamnz.js +1 -0
  104. package/dist/chunk-notices-mtn7pg1z.js +1 -0
  105. package/dist/chunk-onboarding-f3hhxgg4.js +1 -0
  106. package/dist/chunk-overview-qmepntrr.js +1 -0
  107. package/dist/chunk-palette-edkn1ypq.js +1 -0
  108. package/dist/chunk-placement-items-trsa5t23.js +1 -0
  109. package/dist/chunk-profile-pwfq0wns.js +1 -0
  110. package/dist/chunk-prompt-history-xp9hmeqt.js +1 -0
  111. package/dist/chunk-prompts-a56qvytg.js +1 -0
  112. package/dist/chunk-room-confirms-gqpkz4h0.js +1 -0
  113. package/dist/chunk-room-menu-1m2c2ekt.js +1 -0
  114. package/dist/chunk-rooms-menu-button-tcvda1gq.js +1 -0
  115. package/dist/chunk-schedules-kwnw7p8v.js +1 -0
  116. package/dist/{chunk-seat-menu-kwtjnpjj.js → chunk-seat-menu-m2n9nvv0.js} +1 -1
  117. package/dist/chunk-sheet-hosts-pr8xktyq.js +29 -0
  118. package/dist/{chunk-shortcut-help-g5cpqjjj.js → chunk-shortcut-help-sbvrds1m.js} +2 -2
  119. package/dist/chunk-shortcuts-8705p7q3.js +1 -0
  120. package/dist/chunk-skill-editor-7xy09sq1.js +8 -0
  121. package/dist/chunk-skills-cnc25x7q.js +1 -0
  122. package/dist/chunk-start-over-line-97zdd9pb.js +16 -0
  123. package/dist/chunk-switcher-list-ehsn2wsk.js +1 -0
  124. package/dist/{chunk-tab-dot-yse6wcfp.js → chunk-tab-dot-gkpe06q8.js} +1 -1
  125. package/dist/chunk-table-av3kh3tt.js +1 -0
  126. package/dist/chunk-table2d-5x3jptp9.js +1 -0
  127. package/dist/chunk-table3d-rsvajx7r.js +4220 -0
  128. package/dist/chunk-thread-actions-7xtkegwm.js +1 -0
  129. package/dist/{chunk-thread-cards-36rckyg7.js → chunk-thread-cards-grzszfha.js} +1 -1
  130. package/dist/chunk-thread-list-9bjjac3j.js +217 -0
  131. package/dist/chunk-transcript-t5szb8r0.js +1 -0
  132. package/dist/chunk-waiting-chip-d8b6a0p8.js +28 -0
  133. package/dist/chunk-waiting-ts3kxjvv.js +1 -0
  134. package/dist/chunk-where-3d3ncsa5.js +1 -0
  135. package/dist/chunk-workspace-ct6hvn0z.js +578 -0
  136. package/dist/chunk-zh-tw-v9v1eerm.js +1 -0
  137. package/dist/index.html +1 -1
  138. package/dist/sw.js +1 -1
  139. package/package.json +3 -3
  140. package/src/api-types.ts +137 -1
  141. package/src/app/app.ts +4 -7
  142. package/src/app/desk.ts +19 -4
  143. package/src/app/room-log.ts +66 -18
  144. package/src/app/rooms.ts +45 -7
  145. package/src/app/routes.ts +86 -11
  146. package/src/app/skill-doc-routes.ts +12 -2
  147. package/src/app/skill-group-routes.ts +126 -0
  148. package/src/app/surface.ts +26 -2
  149. package/src/app/team-routes.ts +3 -7
  150. package/src/authz.ts +2 -0
  151. package/src/cleanup-api.ts +9 -2
  152. package/src/connector-manage-api.ts +257 -0
  153. package/src/console-api.ts +60 -2
  154. package/src/features.ts +91 -0
  155. package/src/host/reads.ts +10 -1
  156. package/src/i18n/zh-tw.ts +137 -5
  157. package/src/push/channel.ts +1 -0
  158. package/src/web-plugin.ts +8 -1
  159. package/dist/chunk-account-83crfbn4.js +0 -1
  160. package/dist/chunk-action-menu-qw7h03x0.js +0 -1
  161. package/dist/chunk-agent-t1632ktv.js +0 -1
  162. package/dist/chunk-arranged-rooms-sb6tbsxw.js +0 -1
  163. package/dist/chunk-bulk-actions-v1g2bzk7.js +0 -1
  164. package/dist/chunk-character-creator-ye69w0kx.js +0 -1
  165. package/dist/chunk-codeeditor-5j6abj8k.js +0 -2
  166. package/dist/chunk-confirm-x8w877bz.js +0 -1
  167. package/dist/chunk-connectors-t7qbc6nk.js +0 -1
  168. package/dist/chunk-conversations-kmt6qzym.js +0 -1
  169. package/dist/chunk-council-sheet-bxvn7vza.js +0 -2
  170. package/dist/chunk-drag-03zgvd66.js +0 -1
  171. package/dist/chunk-entry-y5vwp5e5.js +0 -1
  172. package/dist/chunk-folder-list-h3vnjzpb.js +0 -1
  173. package/dist/chunk-folds-a3e22m7x.js +0 -1
  174. package/dist/chunk-gate-qzephvdv.js +0 -1
  175. package/dist/chunk-group-scene-w1ycabrm.js +0 -1
  176. package/dist/chunk-group-table-9nvmja8w.js +0 -1
  177. package/dist/chunk-host-icons-fccg3b2d.js +0 -1
  178. package/dist/chunk-host-picture-jaqz127q.js +0 -1
  179. package/dist/chunk-host-state-r01v1ywg.js +0 -1
  180. package/dist/chunk-host-ui-n54mh5af.js +0 -1
  181. package/dist/chunk-index-0a81da8z.js +0 -2
  182. package/dist/chunk-index-1kwp3spy.js +0 -2
  183. package/dist/chunk-index-47vq85ye.js +0 -2
  184. package/dist/chunk-index-5zmswz4s.js +0 -2
  185. package/dist/chunk-index-64rsz6pf.js +0 -2
  186. package/dist/chunk-index-6vcs0h0m.js +0 -2
  187. package/dist/chunk-index-6xqz6mg2.js +0 -2
  188. package/dist/chunk-index-83v0c9x6.js +0 -2
  189. package/dist/chunk-index-8xd6anam.js +0 -2
  190. package/dist/chunk-index-b73y2gc0.js +0 -47
  191. package/dist/chunk-index-bhqczxr3.js +0 -2
  192. package/dist/chunk-index-c44p8q87.js +0 -2
  193. package/dist/chunk-index-cbqhzf40.js +0 -13
  194. package/dist/chunk-index-db8zh8e6.js +0 -2
  195. package/dist/chunk-index-dvfkb699.js +0 -2
  196. package/dist/chunk-index-e02ddp46.js +0 -1
  197. package/dist/chunk-index-ebg48jgy.js +0 -2
  198. package/dist/chunk-index-ek5mek4j.js +0 -14
  199. package/dist/chunk-index-em7vndrb.js +0 -2
  200. package/dist/chunk-index-eq161yvp.js +0 -4
  201. package/dist/chunk-index-f5x2srr0.js +0 -2
  202. package/dist/chunk-index-fg42egv9.js +0 -50
  203. package/dist/chunk-index-h3v1d3nt.js +0 -2
  204. package/dist/chunk-index-kbgykazq.js +0 -2
  205. package/dist/chunk-index-n8ghdvxb.js +0 -2
  206. package/dist/chunk-index-p5jcwjx8.js +0 -2
  207. package/dist/chunk-index-qfgkfq86.js +0 -2
  208. package/dist/chunk-index-rcwdqn50.js +0 -7
  209. package/dist/chunk-index-s72hmse6.js +0 -2
  210. package/dist/chunk-index-sv9qpmhv.js +0 -1
  211. package/dist/chunk-index-x4enmj72.js +0 -2
  212. package/dist/chunk-index-xevnf9ew.js +0 -2
  213. package/dist/chunk-index-xx8jq73q.js +0 -2
  214. package/dist/chunk-index-ypkgw7gq.js +0 -2
  215. package/dist/chunk-lang-css-y9133ktr.js +0 -1
  216. package/dist/chunk-lang-html-r2xmryek.js +0 -1
  217. package/dist/chunk-lang-javascript-1r6wd177.js +0 -1
  218. package/dist/chunk-lang-json-dx56g11y.js +0 -1
  219. package/dist/chunk-lang-markdown-fpcf2dfq.js +0 -6
  220. package/dist/chunk-lang-python-zzp95955.js +0 -3
  221. package/dist/chunk-lang-rust-214fh7sp.js +0 -1
  222. package/dist/chunk-lang-sql-vvp46hpj.js +0 -2
  223. package/dist/chunk-lang-typescript-y5w4tt4g.js +0 -1
  224. package/dist/chunk-lang-xml-tbcqmedk.js +0 -1
  225. package/dist/chunk-lang-yaml-jh56t3sv.js +0 -1
  226. package/dist/chunk-layout-actions-8dzvysym.js +0 -1
  227. package/dist/chunk-menu-items-3jhya205.js +0 -2
  228. package/dist/chunk-mode-toggle-js49gvpd.js +0 -1
  229. package/dist/chunk-note-row-kv061030.js +0 -75
  230. package/dist/chunk-notes-sdkqz5hr.js +0 -1
  231. package/dist/chunk-notice-bell-r012f2zy.js +0 -1
  232. package/dist/chunk-notices-h4rk1zxc.js +0 -1
  233. package/dist/chunk-onboarding-a18cvkph.js +0 -1
  234. package/dist/chunk-overview-ynaqn4fp.js +0 -1
  235. package/dist/chunk-palette-jm79gb5q.js +0 -1
  236. package/dist/chunk-placement-items-mwm9q1zn.js +0 -1
  237. package/dist/chunk-profile-ajw6pp4r.js +0 -1
  238. package/dist/chunk-prompt-history-zcfvr3r8.js +0 -1
  239. package/dist/chunk-prompts-m5rzdk24.js +0 -1
  240. package/dist/chunk-room-confirms-ftsj15ja.js +0 -1
  241. package/dist/chunk-room-menu-b9ktw9pw.js +0 -1
  242. package/dist/chunk-rooms-menu-button-qe62t6nx.js +0 -1
  243. package/dist/chunk-schedules-t8yxnf8q.js +0 -1
  244. package/dist/chunk-sheet-hosts-yj5wszgj.js +0 -1
  245. package/dist/chunk-shortcuts-9ft5sqdw.js +0 -1
  246. package/dist/chunk-skill-editor-xdfq2708.js +0 -8
  247. package/dist/chunk-skills-9wa4mwdc.js +0 -1
  248. package/dist/chunk-switcher-list-vpg6wvtw.js +0 -1
  249. package/dist/chunk-table-1y76m54h.js +0 -1
  250. package/dist/chunk-table2d-g57vr6h0.js +0 -1
  251. package/dist/chunk-table3d-cv6069hy.js +0 -4220
  252. package/dist/chunk-thread-actions-xjhpdjk7.js +0 -1
  253. package/dist/chunk-thread-list-fd6agz77.js +0 -217
  254. package/dist/chunk-transcript-5nfn3r35.js +0 -1
  255. package/dist/chunk-where-ha8pc3cg.js +0 -1
  256. package/dist/chunk-workspace-e85twv32.js +0 -578
  257. package/dist/chunk-zh-tw-z5p5mpph.js +0 -1
@@ -0,0 +1,578 @@
1
+ import{p,dn,E,ke,o,L,Ne,C,a,r,t,u,g,e,n,s,x,vi,X,Hi,fe,h,l,f,v,m,k,T,_,re,Le,Ce}from"./chunk-index-wt2asefx.js";import{D}from"./chunk-index-y6p8j3zv.js";import{Te}from"./chunk-index-rtz4936v.js";import{ne}from"./chunk-index-57teqgct.js";import{se}from"./chunk-index-amxa2bn3.js";import{R}from"./chunk-index-zdzzf3fp.js";function dt(i,d,c){let[b,w]=r();o(()=>{if(!i)return;let S=(y)=>y.preventDefault(),I=(y)=>{if(y.button!==0||y.metaKey||y.ctrlKey||y.shiftKey||y.altKey)return;let M=y.target instanceof Element?y.target.closest("a"):null;if(!M||M.target||M.hasAttribute("download"))return;if(d.current?.contains(M))return;y.preventDefault(),y.stopPropagation(),w({kind:"link",anchor:M})},z=vi((y)=>w({kind:"navigate",proceed:y}));return window.addEventListener("beforeunload",S),document.addEventListener("click",I,!0),()=>{z(),window.removeEventListener("beforeunload",S),document.removeEventListener("click",I,!0)}},[i,d]);let N=E(()=>w(void 0),[]),W=E(()=>{let S=b;if(c(),w(void 0),S?.kind==="link")setTimeout(()=>S.anchor.click(),0);else if(S?.kind==="navigate")S.proceed()},[b,c]);return{leaving:b,stay:N,leave:W}}var de=(i)=>`workspace/${encodeURIComponent(i)}`,Ee=(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 j={roots:()=>h("workspace"),list:(i,d)=>h(`${de(i)}/list?${Ee(d)}`),file:(i,d)=>h(`${de(i)}/file?${Ee(d)}`),save:(i,d,c,b)=>h(`${de(i)}/file?${Ee(d)}`,{method:"PUT",..._e({text:c,baseHash:b})}),create:(i,d,c,b)=>h(`${de(i)}/new?${Ee(d)}`,{method:"POST",..._e({kind:c,...b===void 0?{}:{text:b}})}),rename:(i,d,c)=>h(`${de(i)}/rename`,{method:"POST",..._e({from:d,to:c})}),remove:(i,d)=>h(`${de(i)}/entry?${Ee(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,c=!1)=>`api/${de(i)}/raw?${Ee(d)}${c?"&download=1":""}`;var Me=(i)=>i.split("/").filter(Boolean),ve=(i)=>Me(i).slice(0,-1).join("/"),Se=(i,d)=>i?`${i}/${d}`:d,De=(i)=>`${i.root}:${i.path}${i.dir&&i.path?"/":""}`;function lt(i){if(!i)return;let d=i.indexOf(":");if(d<1)return;let c=i.slice(d+1);return{root:i.slice(0,d),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:d,size:c=20,className:b}=i;if(!Ct(d))return e(s,{name:d,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[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(s,{name:"download",size:18}),t("Download")]})]})}function Ge(i){let d=i.name.lastIndexOf("."),c=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(s,{name:"file",size:32})}),e("strong",{children:i.name}),e("span",{className:"meta",children:[c,Le(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:c,path:b,name:w,bytes:N,phone:W,onFacts:S}=i,[I,z]=r(!1),[y,M]=r(!1);o(()=>(z(!1),M(!1),S(void 0),()=>S(void 0)),[c,b]);let F=we(c,b);if(I)return e(Ge,{root:c,path:b,name:w,bytes:N,message:t("This browser cannot show this file.")});switch(d){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:()=>M((V)=>!V),children:e("img",{src:F,alt:w,onLoad:(V)=>{let{naturalWidth:Q,naturalHeight:q}=V.currentTarget;S(Q>0?`${Q} × ${q}`:void 0)},onError:()=>z(!0)})})});case"pdf":return Et(W)?n("div",{className:"ws-media ws-pdf-frame",children:[e("iframe",{className:"ws-pdf",src:F,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 · ",Le(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:F,onError:()=>z(!0)})});case"video":return e("div",{className:"ws-media ws-film",children:e("video",{controls:!0,playsInline:!0,preload:"metadata",src:F,onLoadedMetadata:(V)=>{let{videoWidth:Q,videoHeight:q}=V.currentTarget;S(Q>0?`${Q} × ${q}`:void 0)},onError:()=>z(!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,d){try{let c=localStorage.getItem(i);return c===null?d:JSON.parse(c)}catch{return d}}function Be(i,d){try{localStorage.setItem(i,JSON.stringify(d))}catch{}}var $e=dn({rev:0,bump:()=>{return}});se("workspace",ct);var Re=new Map,Rt=200;function Tt(i,d){Re.delete(i),Re.set(i,d);let c=Re.keys().next().value;if(Re.size>Rt&&c!==void 0)Re.delete(c)}function ht(i,d,c=!0){let{rev:b}=ke($e),[w,N]=r(0),[W,S]=r({key:"",root:i,path:d}),I=`${i}:${d}`;if(o(()=>{let y=()=>N((M)=>M+1);return window.addEventListener("focus",y),()=>window.removeEventListener("focus",y)},[]),o(()=>{if(!c)return;let y=!0;return j.list(i,d).then((M)=>{if(Tt(I,M),y)S({key:I,root:i,path:d,data:M})},(M)=>y&&S({key:I,root:i,path:d,error:l(M)})),()=>{y=!1}},[i,d,c,b,w]),W.key===I)return{data:W.data,error:W.error,at:W};let z=Re.get(I);if(z)return{data:z,at:{root:i,path:d}};if(W.data)return{data:W.data,at:W,pending:!0};return{}}var We=(i)=>x("workspace",De(i));function tt(i,d,c){let b=Se(d,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 d=Me(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:d.length===0?c:void 0,href:We({root:i.root.id,path:"",dir:!0}),"aria-current":d.length===0?"page":void 0,children:Qe(i.root)}),d.map((b,w)=>{let N=d.slice(0,w+1).join("/"),W=w===d.length-1;return e("a",{ref:W?c:void 0,href:We({root:i.root.id,path:N,dir:!0}),"aria-current":W?"page":void 0,children:b},N)})]})}function wt(i){let{data:d,error:c,pending:b}=ht(i.root,i.path);if(c)return e("p",{className:"ws-tree-note",children:c});if(!d||b)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 N=tt(i.root,i.path,w),W=Se(i.path,w.name),S=N?.dir===!0,I=S&&i.open.has(W),z=i.current?.root===i.root&&i.current.path===W&&i.current.dir===S;return n("li",{children:[n("div",{className:"ws-tree-row","data-selected":z||void 0,"data-quiet":gt.has(w.name)||void 0,style:{paddingLeft:`${0.25+i.depth*0.875}rem`},children:[S?e("button",{type:"button",className:"ws-twist","aria-expanded":I,"aria-label":t("Show or hide {name}",{name:w.name}),onClick:()=>i.toggle(W),children:e(s,{name:"chevron",size:14})}):e("span",{className:"ws-twist"}),N?n("a",{href:We(N),title:w.name,children:[e(be,{name:S?"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})]})]}),I?e(wt,{root:i.root,path:W,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:c,at:b,pending:w}=ht(i.root.id,i.path),{timeZone:N}=_(),W=a(null),S=b?.root??i.root.id,I=b?.path??i.path;if(Ne(()=>{W.current?.closest(".ws-main")?.scrollTo?.(0,0)},[S,I]),c)return e(m,{message:c});if(!d)return e(v,{});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:W,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((z)=>{let y=tt(S,I,z),M=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:z.name}),e("span",{className:"meta",children:z.kind==="symlink"&&z.inside===!1?t("Outside the workspace"):z.kind==="other"?t("Not a regular file"):[y?.dir?void 0:Le(z.size),re(new Date(z.mtimeMs).toISOString(),N)].filter(Boolean).join(" · ")})]})]});return n("li",{className:"ws-row","data-quiet":gt.has(z.name)||void 0,children:[y?e("a",{className:"ws-row-link",href:We(y),children:M}):e("span",{className:"ws-row-link","data-off":!0,children:M}),i.root.writable||y?e("button",{type:"button",className:"icon-button","aria-label":t("Actions for {name}",{name:z.name}),onClick:()=>i.onMenu(z),children:e(s,{name:"menu"})}):null]},z.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:c}=ke($e),{root:b,path:w}=i,[N,W]=r(),[S,I]=r(),[z,y]=r("read"),[M,F]=r(!1),[V,Q]=r(!1),[q,je]=r(()=>et(pt,i.phone)),[Oe,ee]=r(!1),[ze,ye]=r(),[A,H]=r(!1),[Y,ue]=r(!1),[Pe,qe]=r(!1),[me,le]=r(),[U,pe]=r(),[xe,Ie]=r(),ge=a(null),K=a(void 0),P=a(null),oe=a(N);oe.current=N;let Z=a(z);Z.current=z;let G=Me(w).at(-1)??w,Fe=N?.text!==void 0,Ve=Fe&&(N?.media===void 0||A),nt=E(async()=>{let O=await j.file(b.id,w);return W(O),O},[b.id,w]);o(()=>{let O=!0;return j.file(b.id,w).then((B)=>O&&W(B),(B)=>O&&I(l(B))),()=>{O=!1}},[b.id,w]);let Xe=dt(M,P,()=>{let O=oe.current;if(O?.text!==void 0)K.current?.replace(O.text,O.eol);F(!1),y("read")});o(()=>{if(!M)return;let O=document.title;return document.title=`• ${O}`,()=>{document.title=O}},[M]);let Ae=E(async(O,B)=>{let ce=oe.current,J=K.current;if(!ce||!J||V)return;let te=B===void 0?J.snapshot():void 0,Ke=B??J.text();Q(!0);try{let ae=await j.save(b.id,w,Ke,O??ce.hash);J.markSaved(te),F(J.dirty()),le(void 0),W({...ce,hash:ae.hash,size:ae.size,mtimeMs:ae.mtimeMs,text:Ke}),f(t("Saved")),c()}catch(ae){let ie=Ue(ae);if(ie)pe({kind:ie.conflict==="gone"?"gone":"changed",...ie.current?{hash:ie.current.hash}:{},text:Ke});else f(l(ae),"danger")}finally{Q(!1)}},[b.id,w,V,c]),at=a(Ae);at.current=Ae;let he=E(async()=>{try{let O=await nt();if(O.text!==void 0)K.current?.replace(O.text,O.eol);F(!1),le(void 0),pe(void 0)}catch(O){f(l(O),"danger")}},[nt]),vt=a(he);vt.current=he;let Ye=E(()=>{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 O=oe.current;if(!O||O.text===void 0)return;let B=!1,ce;return (p("239ss6a2"),import("./chunk-codeeditor-239ss6a2.js")).then(async({createEditor:J})=>{if(B||!ge.current)return;let te=await J({parent:ge.current,text:O.text??"",eol:O.eol,language:O.language,editable:!1,wrap:q,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:()=>F(te.dirty()),onSave:()=>{if(Z.current==="edit"&&te.dirty())at.current()},onEscape:()=>{if(Z.current==="edit")ot.current()}});if(B){te.destroy();return}ce=te,K.current=te,ue(!0)}).catch((J)=>{if(console.warn("the editor failed to load",J),!B)qe(!0)}),()=>{B=!0,ce?.destroy(),K.current=void 0,ue(!1)}},[Ve,b.id,w]),o(()=>{if(!Y)return;let O=z==="edit"&&N?.editable===!0;if(K.current?.setEditable(O),O)K.current?.focus()},[z,Y,N?.editable]),o(()=>{if(!Y)return;K.current?.setWrap(q),Be(pt,q)},[q,Y]);let it=N!==void 0;if(o(()=>{if(!it)return;let O=!1,B=async()=>{if(O||document.visibilityState==="hidden")return;let te=oe.current;if(!te)return;O=!0;try{let ae=(await j.list(b.id,ve(w))).entries.find((xt)=>xt.name===G);if(!ae){le("gone");return}if(ae.kind==="symlink")return;if(ae.size===te.size&&ae.mtimeMs===te.mtimeMs)return;if(Z.current==="edit"&&K.current?.dirty()){le("changed");return}let ie=await j.file(b.id,w);if(ie.hash!==te.hash){if(W(ie),ie.text!==void 0)K.current?.replace(ie.text,ie.eol)}le(void 0)}catch{}finally{O=!1}},ce=setInterval(()=>void B(),5000),J=()=>void B();return window.addEventListener("focus",J),document.addEventListener("visibilitychange",J),()=>{clearInterval(ce),window.removeEventListener("focus",J),document.removeEventListener("visibilitychange",J)}},[it,b.id,w,G]),S)return e("div",{className:"ws-file",children:e(m,{message:S})});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=z==="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:V||!M,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:P,children:[n("header",{className:"ws-file-head",children:[n("div",{className:"ws-file-title",children:[n("strong",{children:[M?"• ":"",G]}),n("span",{className:"meta",children:[Le(N.size),ze?` · ${ze}`:""," ·"," ",re(new Date(N.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:N.media&&!Ve?e(mt,{media:N.media,root:b.id,path:w,name:G,bytes:N.size,phone:i.phone,onFacts:ye}):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:V||!M,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((O)=>!O),ee(!1)},children:e("span",{className:"menu-text",children:e("strong",{children:q?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(ne,{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 O=U.text;pe(void 0),j.create(b.id,w,"file",O).then(async()=>{await he(),c()}).catch((B)=>f(l(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(D,{open:xe!==void 0,title:t("Replace the knight's changes?"),confirmLabel:t("Save mine anyway"),tone:"danger",onClose:()=>Ie(void 0),onConfirm:async()=>{if(!xe)return;await j.save(b.id,w,xe.text,xe.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(D,{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);F(!1),y("read")},children:e("p",{children:t("Your edits to {name} have not been saved.",{name:G})})}),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:G})})})]})}function Mt(i){let{ask:d}=i,[c,b]=r(""),[w,N]=r(),[W,S]=r(!1),I=L();o(()=>{b(d?.kind==="rename"?d.name:""),N(void 0)},[d]);let z=d?.kind==="rename"?t("Rename"):d?.kind==="dir"?t("New folder"):t("New file"),y=async(M)=>{if(M.preventDefault(),!d)return;let F=c.trim();if(!F||F.includes("/")){N(t("Use a name without slashes."));return}S(!0),N(void 0);try{if(d.kind==="rename"){let V=Se(ve(d.path),F);await j.rename(i.root.id,d.path,V),f(t("Renamed")),i.onDone()}else{let V=Se(d.dir,F);await j.create(i.root.id,V,d.kind),f(t("Created")),i.onDone({root:i.root.id,path:V,dir:d.kind==="dir"})}}catch(V){let Q=Ue(V);N(Q?.conflict==="exists"?t("Something with that name is already there."):l(V))}finally{S(!1)}};return e(ne,{open:d!==void 0,title:z,onClose:i.onClose,children:n("form",{className:"stack",onSubmit:y,children:[e("label",{htmlFor:I,children:t("Name")}),e("input",{id:I,value:c,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,onChange:(M)=>b(M.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:W||!c.trim(),children:d?.kind==="rename"?t("Rename"):t("Create")})]})]})})}function Dt(i){let{bump:d,rev:c}=ke($e),[b,w]=r(),[N,W]=r(),[S,I]=r(),{timeZone:z}=_();return o(()=>{if(!i.open)return;let y=!0;return j.trash(i.root.id).then((M)=>y&&w(M.items),(M)=>y&&W(l(M))),()=>{y=!1}},[i.open,i.root.id,c]),n(ne,{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,z)})]})]}),e("button",{type:"button",className:"secondary",onClick:async()=>{try{await j.restore(i.root.id,y.id),f(t("Restored")),d()}catch(M){let F=Ue(M);f(F?F.conflict==="exists"?t("Something with that name is already there."):t("The folder it was in is gone."):l(M),"danger")}},children:t("Restore")}),e("button",{type:"button",className:"icon-button danger-icon","aria-label":t("Delete {name} for good",{name:y.name}),onClick:()=>I(y),children:e(s,{name:"trash"})})]},y.id))})]}),e(D,{open:S!==void 0,title:t("Delete for good?"),confirmLabel:t("Delete for good"),tone:"danger",onClose:()=>I(void 0),onConfirm:async()=>{if(!S)return;await j.purge(i.root.id,S.id),d()},children:e("p",{children:t("“{name}” will be removed and cannot be brought back.",{name:S?.path??""})})})]})}function yn(){let i=Hi(),d=!Ce("(min-width: 720px)"),[c,b]=r(0),w=E(()=>b((P)=>P+1),[]),N=C(()=>({rev:c,bump:w}),[c,w]),[W,S]=r(),[I,z]=r();o(()=>{j.roots().then((P)=>S(P.roots),(P)=>z(l(P)))},[]);let[y,M]=r(()=>et(ft,280)),[F,V]=r(),[Q,q]=r(),[je,Oe]=r(!1),[ee,ze]=r(),ye=lt(i.key),A=W?.find((P)=>P.id===ye?.root)??(d?void 0:W?.[0]),H=A?ye&&ye.root===A.id?ye:{root:A.id,path:"",dir:!0}:void 0,Y=A?.id,ue=H?.path,Pe=H?.dir,[qe,me]=r(new Set);o(()=>{if(!Y)return;me(new Set(et(Je(Y),[])))},[Y]);let le=E((P)=>{if(!Y)return;me((oe)=>{let Z=new Set(oe);if(Z.has(P))Z.delete(P);else Z.add(P);return Be(Je(Y),[...Z]),Z})},[Y]);if(o(()=>{if(!Y||ue===void 0||d)return;let P=Me(Pe?ue:ve(ue)),oe=P.map((Z,G)=>P.slice(0,G+1).join("/"));me((Z)=>{if(oe.every((Fe)=>Z.has(Fe)))return Z;let G=new Set([...Z,...oe]);return Be(Je(Y),[...G]),G})},[Y,ue,Pe,d]),I)return e(m,{message:I});if(!W)return e(v,{});if(W.length===0)return e(k,{children:t("No files yet")});if(!A||!H)return e($e.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:W.map((P)=>e("li",{children:n("a",{className:"menu-item menu-link",href:We({root:P.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(P)}),P.writable?null:e("span",{className:"meta",children:t("Read only")})]}),e(s,{name:"chevron",size:16})]})},P.id))})]})});let U=H.dir?H.path:ve(H.path),pe=H.path===""?{root:A.id,path:"",dir:!0}:{root:A.id,path:ve(H.path),dir:!0},xe=n("header",{className:"ws-head",children:[d?e("a",{className:"icon-button","aria-label":t("Back"),href:H.path===""?x("workspace"):We(pe),children:e(s,{name:"back"})}):e(Te,{chip:!0,className:"ws-root-picker","aria-label":t("Place"),value:A.id,onChange:(P)=>X("workspace",De({root:P.target.value,path:"",dir:!0})),children:W.map((P)=>e("option",{value:P.id,children:Qe(P)},P.id))}),e(Lt,{root:A,path:H.path}),A.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:()=>q({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:()=>q({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:A,path:H.path,onMenu:(P)=>V(P)})}):e(zt,{root:A,path:H.path,phone:d},`${A.id}:${H.path}`),ge=F?tt(A.id,U,F):void 0,K=F?Se(U,F.name):"";return n($e.Provider,{value:N,children:[n("div",{className:"ws-page ws","data-wide":!d||void 0,style:{"--ws-tree":`${y}px`},children:[xe,n("div",{className:"ws-body",children:[!d?n(g,{children:[e("aside",{className:"ws-tree","aria-label":t("Folders"),children:e(wt,{root:A.id,path:"",depth:0,open:qe,toggle:le,current:H})}),e($t,{width:y,onChange:(P)=>{M(P),Be(ft,P)}})]}):null,e("section",{className:"ws-main",children:Ie})]})]}),e(R,{open:F!==void 0,title:F?.name??"",onClose:()=>V(void 0),children:n("ul",{className:"more-list",children:[ge&&!ge.dir?e("li",{children:n("a",{className:"menu-item menu-link",href:we(A.id,K,!0),download:F?.name,onClick:()=>V(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,A.writable&&F?n(g,{children:[e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{q({kind:"rename",path:K,name:F.name}),V(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:()=>{ze({path:K,name:F.name}),V(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:A,ask:Q,onClose:()=>q(void 0),onDone:(P)=>{if(q(void 0),w(),P)X("workspace",De(P))}}),e(Dt,{root:A,open:je,onClose:()=>Oe(!1)}),e(D,{open:ee!==void 0,title:t("Move to the trash?"),confirmLabel:t("Delete"),tone:"danger",onClose:()=>ze(void 0),onConfirm:async()=>{if(!ee)return;if(await j.remove(A.id,ee.path),f(t("Moved to the trash")),w(),!H.dir&&(H.path===ee.path||H.path.startsWith(`${ee.path}/`)))X("workspace",De({root:A.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,W=i.width,S=w.currentTarget;S.setPointerCapture(w.pointerId);let I=(y)=>i.onChange(b(W+y.clientX-N)),z=()=>{S.removeEventListener("pointermove",I),S.removeEventListener("pointerup",z)};S.addEventListener("pointermove",I),S.addEventListener("pointerup",z)}})}export{yn as WorkspacePage};