pi-roundtable-web 0.29.0 → 0.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/chunk-account-66e6ezdq.js +1 -0
  3. package/dist/{chunk-action-menu-q5y7xpry.js → chunk-action-menu-ap5xn7bf.js} +1 -1
  4. package/dist/{chunk-agent-x74xezyt.js → chunk-agent-sapt5qhn.js} +1 -1
  5. package/dist/chunk-arranged-rooms-n6bk696f.js +1 -0
  6. package/dist/chunk-attachments-p5v9gqyt.js +102 -0
  7. package/dist/chunk-bulk-actions-aze4ewc4.js +1 -0
  8. package/dist/chunk-character-creator-m7tw20ef.js +225 -0
  9. package/dist/{chunk-codeeditor-239ss6a2.js → chunk-codeeditor-yy6pq8mv.js} +2 -2
  10. package/dist/chunk-confirm-0cajsfhk.js +1 -0
  11. package/dist/chunk-connectors-tw0tbm21.js +37 -0
  12. package/dist/chunk-conversations-wkm23m5r.js +1 -0
  13. package/dist/{chunk-council-sheet-a5e6tspr.js → chunk-council-sheet-mz7s23nq.js} +2 -2
  14. package/dist/chunk-council-view-zgvzxtgn.js +1 -0
  15. package/dist/{chunk-drag-7873fvzw.js → chunk-drag-d1bpy8w6.js} +1 -1
  16. package/dist/{chunk-entry-5zmjxadx.js → chunk-entry-7zr5b1fp.js} +1 -1
  17. package/dist/{chunk-folder-list-h9hmbm8e.js → chunk-folder-list-bs4eh3g9.js} +1 -1
  18. package/dist/chunk-folds-eez1q41c.js +1 -0
  19. package/dist/{chunk-gate-fa6za28z.js → chunk-gate-dt91egcd.js} +1 -1
  20. package/dist/chunk-host-icons-nfe2t8tk.js +1 -0
  21. package/dist/chunk-host-picture-4rtswxwa.js +1 -0
  22. package/dist/chunk-host-state-1vxzmmq6.js +1 -0
  23. package/dist/chunk-host-ui-x38bf0et.js +1 -0
  24. package/dist/{chunk-index-4re5prfp.js → chunk-index-0h99xcs3.js} +2 -2
  25. package/dist/{chunk-index-5ssncptg.js → chunk-index-1kb8tv4v.js} +2 -2
  26. package/dist/chunk-index-24cggw6k.js +50 -0
  27. package/dist/chunk-index-2g8xtwqg.js +2 -0
  28. package/dist/chunk-index-3n38xe7m.js +2 -0
  29. package/dist/{chunk-index-en5dm1zv.js → chunk-index-3tksdmx7.js} +2 -2
  30. package/dist/{chunk-index-rr73h4kc.js → chunk-index-4a1tdadd.js} +3 -3
  31. package/dist/{chunk-index-f4gqzfkv.js → chunk-index-53fwc7sc.js} +2 -2
  32. package/dist/chunk-index-55ps4x5n.js +2 -0
  33. package/dist/{chunk-index-4krm48hm.js → chunk-index-5j1v2q7w.js} +1 -1
  34. package/dist/chunk-index-5w6tb7p0.js +2 -0
  35. package/dist/{chunk-index-y6p8j3zv.js → chunk-index-6btdp13p.js} +1 -1
  36. package/dist/chunk-index-6m7dwsmv.js +1 -0
  37. package/dist/{chunk-index-7c9fn21n.js → chunk-index-6rdywten.js} +2 -2
  38. package/dist/{chunk-index-gj3n4dh5.js → chunk-index-6s2pqwna.js} +2 -2
  39. package/dist/{chunk-index-r0hk9kyd.js → chunk-index-7mrkq793.js} +2 -2
  40. package/dist/chunk-index-7xcbpeqz.js +2 -0
  41. package/dist/chunk-index-88wh5eyj.js +2 -0
  42. package/dist/{chunk-index-ntt3em2k.js → chunk-index-8pbwr3rs.js} +1 -1
  43. package/dist/{chunk-index-bjeg3e2j.js → chunk-index-8wpvj7k5.js} +2 -2
  44. package/dist/chunk-index-97dcp1vh.js +1 -0
  45. package/dist/chunk-index-a7e6rhxy.js +2 -0
  46. package/dist/{chunk-index-4eag6s50.js → chunk-index-bxf8eq1s.js} +2 -2
  47. package/dist/chunk-index-c8gm1crh.js +120 -0
  48. package/dist/{chunk-index-4jnn2g09.js → chunk-index-ce7hsda9.js} +2 -2
  49. package/dist/chunk-index-cfesmk1f.js +2 -0
  50. package/dist/{chunk-index-zdzzf3fp.js → chunk-index-cmzvq3nf.js} +1 -1
  51. package/dist/{chunk-index-35zqk1zr.js → chunk-index-d4mx2vvf.js} +2 -2
  52. package/dist/chunk-index-d74tpnkd.js +2 -0
  53. package/dist/chunk-index-d941ae7c.js +2 -0
  54. package/dist/{chunk-index-rtz4936v.js → chunk-index-dr0jr7d3.js} +3 -3
  55. package/dist/{chunk-index-pcbkp62w.js → chunk-index-en728705.js} +2 -2
  56. package/dist/chunk-index-fb3kzyyp.js +2 -0
  57. package/dist/{chunk-index-a8c0ap8g.js → chunk-index-ffnd0jcj.js} +2 -2
  58. package/dist/chunk-index-fn6305vn.js +3 -0
  59. package/dist/{chunk-index-evhaaqzk.js → chunk-index-gdh7wsd5.js} +11 -11
  60. package/dist/{chunk-index-3tjmyd1h.js → chunk-index-m76gdwnk.js} +1 -1
  61. package/dist/chunk-index-mr391t49.js +2 -0
  62. package/dist/chunk-index-n3khm9fq.js +2 -0
  63. package/dist/{chunk-index-93f3e06v.js → chunk-index-nn4w6a04.js} +2 -2
  64. package/dist/{chunk-index-hef4gwtb.js → chunk-index-nr275sa7.js} +2 -2
  65. package/dist/{chunk-index-cttrqfm8.js → chunk-index-prq011b6.js} +1 -1
  66. package/dist/{chunk-index-h2a42p6s.js → chunk-index-q4k9vk04.js} +17 -1
  67. package/dist/chunk-index-rgdaec7y.js +2 -0
  68. package/dist/chunk-index-rjs1can6.js +2 -0
  69. package/dist/chunk-index-s4a8e4qm.js +2 -0
  70. package/dist/{chunk-index-q33ppq0j.js → chunk-index-sz381vda.js} +3 -3
  71. package/dist/{chunk-index-1652v386.css → chunk-index-t7csmbpy.css} +1 -1
  72. package/dist/{chunk-index-amspdq2j.js → chunk-index-v9jqyr1f.js} +1 -1
  73. package/dist/{chunk-index-e46652wf.js → chunk-index-vpq2cj14.js} +1 -1
  74. package/dist/chunk-index-vsaggfns.js +2 -0
  75. package/dist/{chunk-index-7k5895sn.js → chunk-index-w17wgjby.js} +3 -3
  76. package/dist/{chunk-index-teyx2hz7.js → chunk-index-wgrx2ybn.js} +2 -2
  77. package/dist/chunk-index-wsv46y9p.js +2 -0
  78. package/dist/{chunk-index-v6h43553.js → chunk-index-xbj816p0.js} +2 -2
  79. package/dist/{chunk-index-aycxt14t.js → chunk-index-yr758n6t.js} +2 -2
  80. package/dist/{chunk-index-pfs6rm6w.js → chunk-index-ysv36nbk.js} +2 -2
  81. package/dist/{chunk-index-haac6nbt.js → chunk-index-ze9p4npm.js} +2 -2
  82. package/dist/chunk-index-zfdvyrjt.js +2 -0
  83. package/dist/chunk-lang-css-3h22se37.js +1 -0
  84. package/dist/{chunk-lang-dockerfile-2p7e3ssz.js → chunk-lang-dockerfile-y24eejnh.js} +1 -1
  85. package/dist/{chunk-lang-go-zxp9k517.js → chunk-lang-go-qzgv1161.js} +2 -2
  86. package/dist/chunk-lang-html-9rvrmmpg.js +1 -0
  87. package/dist/chunk-lang-javascript-4kv8s3tk.js +1 -0
  88. package/dist/{chunk-lang-json-zmym50rg.js → chunk-lang-json-99v80v88.js} +1 -1
  89. package/dist/{chunk-lang-markdown-ww2kcs85.js → chunk-lang-markdown-gn8he877.js} +4 -4
  90. package/dist/{chunk-lang-python-ng1zdtd4.js → chunk-lang-python-prsw4p4k.js} +2 -2
  91. package/dist/{chunk-lang-rust-6ynhxjdd.js → chunk-lang-rust-g6xqta16.js} +1 -1
  92. package/dist/{chunk-lang-shell-39t9bz2s.js → chunk-lang-shell-dmpnzc6w.js} +1 -1
  93. package/dist/{chunk-lang-sql-w875ejpg.js → chunk-lang-sql-wz7ca27b.js} +2 -2
  94. package/dist/{chunk-lang-toml-b8ckgkg5.js → chunk-lang-toml-160prtq4.js} +1 -1
  95. package/dist/chunk-lang-typescript-mp0yw903.js +1 -0
  96. package/dist/{chunk-lang-xml-bz91cjp1.js → chunk-lang-xml-9htkz2dd.js} +1 -1
  97. package/dist/{chunk-lang-yaml-g9zy0tdv.js → chunk-lang-yaml-08749wd5.js} +1 -1
  98. package/dist/chunk-layout-actions-tdx896xf.js +1 -0
  99. package/dist/chunk-menu-items-trhybv1g.js +1 -0
  100. package/dist/chunk-mode-toggle-4dtfphq4.js +1 -0
  101. package/dist/chunk-note-row-28e5x7n8.js +233 -0
  102. package/dist/chunk-notes-5nkayhw8.js +1 -0
  103. package/dist/chunk-notice-bell-xz8a04am.js +1 -0
  104. package/dist/{chunk-notices-mtn7pg1z.js → chunk-notices-d0cwvk27.js} +1 -1
  105. package/dist/{chunk-onboarding-f3hhxgg4.js → chunk-onboarding-zs4rtea9.js} +1 -1
  106. package/dist/{chunk-overview-qmepntrr.js → chunk-overview-9sb3ywa8.js} +1 -1
  107. package/dist/{chunk-palette-edkn1ypq.js → chunk-palette-5sfhrv4x.js} +1 -1
  108. package/dist/chunk-placement-items-e2neja55.js +1 -0
  109. package/dist/{chunk-profile-pwfq0wns.js → chunk-profile-jffhtpqf.js} +1 -1
  110. package/dist/{chunk-prompt-history-xp9hmeqt.js → chunk-prompt-history-1jz2gk3v.js} +1 -1
  111. package/dist/{chunk-prompts-a56qvytg.js → chunk-prompts-0t30ttd0.js} +1 -1
  112. package/dist/chunk-room-confirms-6595921h.js +1 -0
  113. package/dist/{chunk-room-menu-1m2c2ekt.js → chunk-room-menu-hwkjyxwe.js} +1 -1
  114. package/dist/chunk-rooms-menu-button-k0eq1tcr.js +1 -0
  115. package/dist/{chunk-schedules-kwnw7p8v.js → chunk-schedules-e12y8fw2.js} +1 -1
  116. package/dist/{chunk-seat-menu-m2n9nvv0.js → chunk-seat-menu-n2bcw0mf.js} +1 -1
  117. package/dist/chunk-sheet-hosts-myvm2vhd.js +29 -0
  118. package/dist/chunk-shortcut-help-434sqnxc.js +26 -0
  119. package/dist/chunk-shortcuts-mjxph0g7.js +1 -0
  120. package/dist/chunk-skill-editor-98492yrt.js +8 -0
  121. package/dist/chunk-skills-mfv8ppfh.js +1 -0
  122. package/dist/chunk-start-over-line-m526193z.js +16 -0
  123. package/dist/{chunk-switcher-list-ehsn2wsk.js → chunk-switcher-list-5ngjar24.js} +1 -1
  124. package/dist/{chunk-tab-dot-gkpe06q8.js → chunk-tab-dot-tzjkahj5.js} +1 -1
  125. package/dist/{chunk-table-av3kh3tt.js → chunk-table-xbtbex2z.js} +1 -1
  126. package/dist/{chunk-table2d-5x3jptp9.js → chunk-table2d-61bvrykm.js} +1 -1
  127. package/dist/{chunk-table3d-rsvajx7r.js → chunk-table3d-5a7vbgyj.js} +24 -24
  128. package/dist/chunk-thread-actions-bf6vf2mt.js +1 -0
  129. package/dist/{chunk-thread-cards-grzszfha.js → chunk-thread-cards-n0n603vf.js} +1 -1
  130. package/dist/chunk-thread-list-7bkdn51x.js +227 -0
  131. package/dist/{chunk-transcript-t5szb8r0.js → chunk-transcript-8ztrkt6g.js} +1 -1
  132. package/dist/chunk-waiting-chip-y83c90v3.js +32 -0
  133. package/dist/chunk-waiting-s273kcgz.js +1 -0
  134. package/dist/chunk-where-jr791gzj.js +1 -0
  135. package/dist/chunk-workspace-dw71mshw.js +586 -0
  136. package/dist/chunk-zh-tw-vm5d0w6j.js +1 -0
  137. package/dist/index.html +1 -1
  138. package/dist/sw.js +1 -1
  139. package/package.json +2 -2
  140. package/src/api-types.ts +12 -0
  141. package/src/app/app.ts +7 -0
  142. package/src/app/card-log.ts +10 -2
  143. package/src/app/protocol.ts +18 -0
  144. package/src/app/queued-delivery.ts +107 -0
  145. package/src/app/queued-frames.ts +115 -0
  146. package/src/app/room-log.ts +39 -7
  147. package/src/app/routes.ts +97 -5
  148. package/src/app/socket.ts +12 -2
  149. package/src/app/surface.ts +37 -6
  150. package/src/app/zip.ts +124 -0
  151. package/src/auth/sessions.ts +9 -1
  152. package/src/host/cards.ts +10 -3
  153. package/src/host/stored-json.ts +23 -0
  154. package/src/i18n/zh-tw.ts +14 -0
  155. package/src/notices/mount.ts +1 -0
  156. package/src/notices/store.ts +9 -1
  157. package/src/web-plugin.ts +4 -1
  158. package/dist/chunk-account-9616x405.js +0 -1
  159. package/dist/chunk-arranged-rooms-9prq46vh.js +0 -1
  160. package/dist/chunk-bulk-actions-5dc4m9ad.js +0 -1
  161. package/dist/chunk-character-creator-wf02eg0h.js +0 -1
  162. package/dist/chunk-confirm-bhrx9195.js +0 -1
  163. package/dist/chunk-connectors-k77pd9by.js +0 -37
  164. package/dist/chunk-conversations-ftcpaqw1.js +0 -1
  165. package/dist/chunk-council-view-6593rqbr.js +0 -1
  166. package/dist/chunk-folds-vxq86t1s.js +0 -1
  167. package/dist/chunk-host-icons-y6frbzqt.js +0 -1
  168. package/dist/chunk-host-picture-fqg55rbr.js +0 -1
  169. package/dist/chunk-host-state-65tdhkyq.js +0 -1
  170. package/dist/chunk-host-ui-233kz7qp.js +0 -1
  171. package/dist/chunk-index-2c00zf3z.js +0 -2
  172. package/dist/chunk-index-2dhrqvba.js +0 -2
  173. package/dist/chunk-index-2s4bkrz3.js +0 -2
  174. package/dist/chunk-index-2ypaqwjy.js +0 -2
  175. package/dist/chunk-index-39qq37j5.js +0 -2
  176. package/dist/chunk-index-57teqgct.js +0 -2
  177. package/dist/chunk-index-9m9v1p7s.js +0 -2
  178. package/dist/chunk-index-a8nqn3y0.js +0 -3
  179. package/dist/chunk-index-am7ghh75.js +0 -120
  180. package/dist/chunk-index-amxa2bn3.js +0 -2
  181. package/dist/chunk-index-dajanzxc.js +0 -1
  182. package/dist/chunk-index-e2eeckhh.js +0 -2
  183. package/dist/chunk-index-ek98d2rn.js +0 -2
  184. package/dist/chunk-index-gp4chnp3.js +0 -2
  185. package/dist/chunk-index-mg96sqpk.js +0 -2
  186. package/dist/chunk-index-nsya88fn.js +0 -1
  187. package/dist/chunk-index-smz90j6p.js +0 -2
  188. package/dist/chunk-index-vzqwn3wp.js +0 -2
  189. package/dist/chunk-index-wt2asefx.js +0 -50
  190. package/dist/chunk-index-x4tq9btg.js +0 -2
  191. package/dist/chunk-index-yvcdg5hh.js +0 -2
  192. package/dist/chunk-index-zeqfnkty.js +0 -2
  193. package/dist/chunk-index-zpwb8mkk.js +0 -2
  194. package/dist/chunk-lang-css-avzhvm72.js +0 -1
  195. package/dist/chunk-lang-html-red02gep.js +0 -1
  196. package/dist/chunk-lang-javascript-n33kmjcx.js +0 -1
  197. package/dist/chunk-lang-typescript-qf8acbb2.js +0 -1
  198. package/dist/chunk-layout-actions-fyzzzeyp.js +0 -1
  199. package/dist/chunk-menu-items-yvnk3vds.js +0 -1
  200. package/dist/chunk-mode-toggle-ccv271hm.js +0 -1
  201. package/dist/chunk-note-row-314py1pp.js +0 -204
  202. package/dist/chunk-notes-4rnrddzw.js +0 -1
  203. package/dist/chunk-notice-bell-z9wgamnz.js +0 -1
  204. package/dist/chunk-placement-items-trsa5t23.js +0 -1
  205. package/dist/chunk-room-confirms-gqpkz4h0.js +0 -1
  206. package/dist/chunk-rooms-menu-button-tcvda1gq.js +0 -1
  207. package/dist/chunk-sheet-hosts-pr8xktyq.js +0 -29
  208. package/dist/chunk-shortcut-help-sbvrds1m.js +0 -26
  209. package/dist/chunk-shortcuts-8705p7q3.js +0 -1
  210. package/dist/chunk-skill-editor-7xy09sq1.js +0 -8
  211. package/dist/chunk-skills-cnc25x7q.js +0 -1
  212. package/dist/chunk-start-over-line-97zdd9pb.js +0 -16
  213. package/dist/chunk-thread-actions-7xtkegwm.js +0 -1
  214. package/dist/chunk-thread-list-9bjjac3j.js +0 -217
  215. package/dist/chunk-waiting-chip-d8b6a0p8.js +0 -28
  216. package/dist/chunk-waiting-ts3kxjvv.js +0 -1
  217. package/dist/chunk-where-3d3ncsa5.js +0 -1
  218. package/dist/chunk-workspace-ct6hvn0z.js +0 -578
  219. package/dist/chunk-zh-tw-v9v1eerm.js +0 -1
@@ -0,0 +1,586 @@
1
+ import{p,hn,E,_e,o,L,Te,C,a,r,t,u,g,e,n,s,S,xi,X,er,fe,h,l,f,v,m,k,Q,_,oe,Pe,Qe}from"./chunk-index-24cggw6k.js";import{D}from"./chunk-index-6btdp13p.js";import{Re}from"./chunk-index-dr0jr7d3.js";import{H}from"./chunk-index-s4a8e4qm.js";import{R}from"./chunk-index-cmzvq3nf.js";import{Y}from"./chunk-index-d941ae7c.js";function dt(i,d,c){let[b,w]=r();o(()=>{if(!i)return;let N=(y)=>y.preventDefault(),P=(y)=>{if(y.button!==0||y.metaKey||y.ctrlKey||y.shiftKey||y.altKey)return;let z=y.target instanceof Element?y.target.closest("a"):null;if(!z||z.target||z.hasAttribute("download"))return;if(d.current?.contains(z))return;y.preventDefault(),y.stopPropagation(),w({kind:"link",anchor:z})},W=xi((y)=>w({kind:"navigate",proceed:y}));return window.addEventListener("beforeunload",N),document.addEventListener("click",P,!0),()=>{W(),window.removeEventListener("beforeunload",N),document.removeEventListener("click",P,!0)}},[i,d]);let x=E(()=>w(void 0),[]),T=E(()=>{let N=b;if(c(),w(void 0),N?.kind==="link")setTimeout(()=>N.anchor.click(),0);else if(N?.kind==="navigate")N.proceed()},[b,c]);return{leaving:b,stay:x,leave:T}}var de=(i)=>`workspace/${encodeURIComponent(i)}`,xe=(i)=>`path=${encodeURIComponent(i)}`,Xe=(i)=>({body:JSON.stringify(i)});function He(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?${xe(d)}`),file:(i,d)=>h(`${de(i)}/file?${xe(d)}`),save:(i,d,c,b)=>h(`${de(i)}/file?${xe(d)}`,{method:"PUT",...Xe({text:c,baseHash:b})}),create:(i,d,c,b)=>h(`${de(i)}/new?${xe(d)}`,{method:"POST",...Xe({kind:c,...b===void 0?{}:{text:b}})}),rename:(i,d,c)=>h(`${de(i)}/rename`,{method:"POST",...Xe({from:d,to:c})}),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,c=!1)=>`api/${de(i)}/raw?${xe(d)}${c?"&download=1":""}`;var Le=(i)=>i.split("/").filter(Boolean),ve=(i)=>Le(i).slice(0,-1).join("/"),Ne=(i,d)=>i?`${i}/${d}`:d,We=(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: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: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 Ye(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 Ze(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,Pe(i.bytes)].filter(Boolean).join(" · ")}),e("p",{children:i.message}),e(Ye,{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:x,phone:T,onFacts:N}=i,[P,W]=r(!1),[y,z]=r(!1);o(()=>(W(!1),z(!1),N(void 0),()=>N(void 0)),[c,b]);let I=we(c,b);if(P)return e(Ze,{root:c,path:b,name:w,bytes:x,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:()=>z((F)=>!F),children:e("img",{src:I,alt:w,onLoad:(F)=>{let{naturalWidth:te,naturalHeight:q}=F.currentTarget;N(te>0?`${te} × ${q}`:void 0)},onError:()=>W(!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(Ye,{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 · ",Pe(x)]}),e(Ye,{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:I,onError:()=>W(!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:q}=F.currentTarget;N(te>0?`${te} × ${q}`:void 0)},onError:()=>W(!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 Je(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"]),Ge=(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 Ke(i,d){try{localStorage.setItem(i,JSON.stringify(d))}catch{}}var ze=hn({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 c=Ce.keys().next().value;if(Ce.size>Rt&&c!==void 0)Ce.delete(c)}function ht(i,d,c=!0){let{rev:b}=_e(ze),[w,x]=r(0),[T,N]=r({key:"",root:i,path:d}),P=`${i}:${d}`;if(o(()=>{let y=()=>x((z)=>z+1);return window.addEventListener("focus",y),()=>window.removeEventListener("focus",y)},[]),o(()=>{if(!c)return;let y=!0;return j.list(i,d).then((z)=>{if(Tt(P,z),y)N({key:P,root:i,path:d,data:z})},(z)=>y&&N({key:P,root:i,path:d,error:l(z)})),()=>{y=!1}},[i,d,c,b,w]),T.key===P)return{data:T.data,error:T.error,at:T};let W=Ce.get(P);if(W)return{data:W,at:{root:i,path:d}};if(T.data)return{data:T.data,at:T,pending:!0};return{}}var Ee=(i)=>S("workspace",We(i));function tt(i,d,c){let b=Ne(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=Le(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:Ee({root:i.root.id,path:"",dir:!0}),"aria-current":d.length===0?"page":void 0,children:Je(i.root)}),d.map((b,w)=>{let x=d.slice(0,w+1).join("/"),T=w===d.length-1;return e("a",{ref:T?c:void 0,href:Ee({root:i.root.id,path:x,dir:!0}),"aria-current":T?"page":void 0,children:b},x)})]})}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 x=tt(i.root,i.path,w),T=Ne(i.path,w.name),N=x?.dir===!0,P=N&&i.open.has(T),W=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":W||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":P,"aria-label":t("Show or hide {name}",{name:w.name}),onClick:()=>i.toggle(T),children:e(s,{name:"chevron",size:14})}):e("span",{className:"ws-twist"}),x?n("a",{href:Ee(x),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(s,{name:"file",size:15}),e("span",{className:"ws-tree-label",children:w.name})]})]}),P?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:c,at:b,pending:w}=ht(i.root.id,i.path),{timeZone:x}=_(),T=a(null),N=b?.root??i.root.id,P=b?.path??i.path;if(Te(()=>{T.current?.closest(".ws-main")?.scrollTo?.(0,0)},[N,P]),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: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((W)=>{let y=tt(N,P,W),z=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:W.name}),e("span",{className:"meta",children:W.kind==="symlink"&&W.inside===!1?t("Outside the workspace"):W.kind==="other"?t("Not a regular file"):[y?.dir?void 0:Pe(W.size),oe(new Date(W.mtimeMs).toISOString(),x)].filter(Boolean).join(" · ")})]})]});return n("li",{className:"ws-row","data-quiet":gt.has(W.name)||void 0,children:[y?e("a",{className:"ws-row-link",href:Ee(y),children:z}):e("span",{className:"ws-row-link","data-off":!0,children:z}),i.root.writable||y?e("button",{type:"button",className:"icon-button","aria-label":t("Actions for {name}",{name:W.name}),onClick:()=>i.onMenu(W),children:e(s,{name:"menu"})}):null]},W.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}=_e(ze),{root:b,path:w}=i,[x,T]=r(),[N,P]=r(),[W,y]=r("read"),[z,I]=r(!1),[F,te]=r(!1),[q,Ue]=r(()=>et(pt,i.phone)),[Me,ne]=r(!1),[Se,ke]=r(),[V,A]=r(!1),[Z,ue]=r(!1),[De,Be]=r(!1),[me,le]=r(),[U,pe]=r(),[ye,$e]=r(),ge=a(null),K=a(void 0),O=a(null),ie=a(x);ie.current=x;let G=a(W);G.current=W;let J=Le(w).at(-1)??w,Oe=x?.text!==void 0,Ie=Oe&&(x?.media===void 0||V),nt=E(async()=>{let M=await j.file(b.id,w);return T(M),M},[b.id,w]);o(()=>{let M=!0;return j.file(b.id,w).then((B)=>M&&T(B),(B)=>M&&P(l(B))),()=>{M=!1}},[b.id,w]);let je=dt(z,O,()=>{let M=ie.current;if(M?.text!==void 0)K.current?.replace(M.text,M.eol);I(!1),y("read")});o(()=>{if(!z)return;let M=document.title;return document.title=`• ${M}`,()=>{document.title=M}},[z]);let Fe=E(async(M,B)=>{let ce=ie.current,ee=K.current;if(!ce||!ee||F)return;let ae=B===void 0?ee.snapshot():void 0,Ae=B??ee.text();te(!0);try{let re=await j.save(b.id,w,Ae,M??ce.hash);ee.markSaved(ae),I(ee.dirty()),le(void 0),T({...ce,hash:re.hash,size:re.size,mtimeMs:re.mtimeMs,text:Ae}),f(t("Saved")),c()}catch(re){let se=He(re);if(se)pe({kind:se.conflict==="gone"?"gone":"changed",...se.current?{hash:se.current.hash}:{},text:Ae});else f(l(re),"danger")}finally{te(!1)}},[b.id,w,F,c]),at=a(Fe);at.current=Fe;let he=E(async()=>{try{let M=await nt();if(M.text!==void 0)K.current?.replace(M.text,M.eol);I(!1),le(void 0),pe(void 0)}catch(M){f(l(M),"danger")}},[nt]),vt=a(he);vt.current=he;let qe=E(()=>{if(K.current?.dirty()){ot(!0);return}y("read")},[]),[bt,ot]=r(!1),rt=a(qe);rt.current=qe,o(()=>{if(!Ie||!ge.current)return;let M=ie.current;if(!M||M.text===void 0)return;let B=!1,ce;return (p("yy6pq8mv"),import("./chunk-codeeditor-yy6pq8mv.js")).then(async({createEditor:ee})=>{if(B||!ge.current)return;let ae=await ee({parent:ge.current,text:M.text??"",eol:M.eol,language:M.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:()=>I(ae.dirty()),onSave:()=>{if(G.current==="edit"&&ae.dirty())at.current()},onEscape:()=>{if(G.current==="edit")rt.current()}});if(B){ae.destroy();return}ce=ae,K.current=ae,ue(!0)}).catch((ee)=>{if(console.warn("the editor failed to load",ee),!B)Be(!0)}),()=>{B=!0,ce?.destroy(),K.current=void 0,ue(!1)}},[Ie,b.id,w]),o(()=>{if(!Z)return;let M=W==="edit"&&x?.editable===!0;if(K.current?.setEditable(M),M)K.current?.focus()},[W,Z,x?.editable]),o(()=>{if(!Z)return;K.current?.setWrap(q),Ke(pt,q)},[q,Z]);let it=x!==void 0;if(o(()=>{if(!it)return;let M=!1,B=async()=>{if(M||document.visibilityState==="hidden")return;let ae=ie.current;if(!ae)return;M=!0;try{let re=(await j.list(b.id,ve(w))).entries.find((xt)=>xt.name===J);if(!re){le("gone");return}if(re.kind==="symlink")return;if(re.size===ae.size&&re.mtimeMs===ae.mtimeMs)return;if(G.current==="edit"&&K.current?.dirty()){le("changed");return}let se=await j.file(b.id,w);if(se.hash!==ae.hash){if(T(se),se.text!==void 0)K.current?.replace(se.text,se.eol)}le(void 0)}catch{}finally{M=!1}},ce=setInterval(()=>void B(),5000),ee=()=>void B();return window.addEventListener("focus",ee),document.addEventListener("visibilitychange",ee),()=>{clearInterval(ce),window.removeEventListener("focus",ee),document.removeEventListener("visibilitychange",ee)}},[it,b.id,w,J]),N)return e("div",{className:"ws-file",children:e(m,{message:N})});if(!x)return e("div",{className:"ws-file",children:e(v,{})});let st=x.reason,kt=!x.editable?e(Q,{tone:"warn",children:t("Read only: {reason}",{reason:st?t(St[st]):""})}):null,Ve=W==="edit",yt=n("div",{className:"ws-actions",children:[x.editable&&!Ve?e("button",{type:"button",onClick:()=>{A(!0),y("edit")},children:t("Edit")}):null,Ve?n(g,{children:[e("button",{type:"button",disabled:F||!z,onClick:()=>void Fe(),children:t("Save")}),e("button",{type:"button",className:"secondary",onClick:qe,children:t("Cancel")})]}):null,e("button",{type:"button",className:"icon-button","aria-label":t("File menu"),onClick:()=>ne(!0),children:e(s,{name:"menu"})})]});return n("div",{className:"ws-file",ref:O,children:[n("header",{className:"ws-file-head",children:[n("div",{className:"ws-file-title",children:[n("strong",{children:[z?"• ":"",J]}),n("span",{className:"meta",children:[Pe(x.size),Se?` · ${Se}`:""," ·"," ",oe(new Date(x.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:x.media&&!Ie?e(mt,{media:x.media,root:b.id,path:w,name:J,bytes:x.size,phone:i.phone,onFacts:ke}):Ie?e("div",{ref:ge,className:"ws-editor","data-editing":Ve||void 0,children:!Z?e("pre",{className:"ws-plain","aria-busy":!De,children:x.text}):null}):e(Ze,{root:b.id,path:w,name:J,bytes:x.size,message:x.tooLarge?t("This file is too large to show here."):t("This file is not text, so it cannot be shown here.")})}),i.phone&&Ve?n("div",{className:"ws-editbar",role:"toolbar","aria-label":t("Editing"),children:[e("button",{type:"button",disabled:F||!z,onClick:()=>void Fe(),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:Me,title:J,onClose:()=>ne(!1),children:e("div",{className:"stack",children:n("ul",{className:"more-list",children:[Oe?e("li",{children:e("button",{type:"button",className:"menu-item",onClick:()=>{Ue((M)=>!M),ne(!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:J,onClick:()=>ne(!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:()=>{ne(!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(H,{open:U!==void 0,title:U?.kind==="gone"?t("This file is gone"):t("This file changed while you were editing"),onClose:()=>pe(void 0),children:n("div",{className:"stack",children:[e("p",{children:U?.kind==="gone"?t("Someone deleted it. Your text has not been saved."):t("Your text has not been saved. What should happen to it?")}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:()=>{navigator.clipboard?.writeText(U?.text??"").then(()=>f(t("Copied")))},children:t("Copy my text")}),U?.kind==="changed"?e("button",{type:"button",className:"secondary",onClick:()=>void he(),children:t("Reload (discard my edits)")}):null,e("button",{type:"button",className:"danger",onClick:()=>{if(!U)return;if(U.kind==="gone"){let M=U.text;pe(void 0),j.create(b.id,w,"file",M).then(async()=>{await he(),c()}).catch((B)=>f(l(B),"danger"));return}$e({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:ye!==void 0,title:t("Replace the knight's changes?"),confirmLabel:t("Save mine anyway"),tone:"danger",onClose:()=>$e(void 0),onConfirm:async()=>{if(!ye)return;await j.save(b.id,w,ye.text,ye.hash),await he(),f(t("Saved")),c()},children:e("p",{children:t("The file has been changed since you opened it. Saving yours writes over those changes.")})}),e(D,{open:bt,title:t("Unsaved changes, leave?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:()=>ot(!1),onConfirm:async()=>{if(x.text!==void 0)K.current?.replace(x.text,x.eol);I(!1),y("read")},children:e("p",{children:t("Your edits to {name} have not been saved.",{name:J})})}),e(D,{open:je.leaving!==void 0,title:t("Unsaved changes, leave?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:je.stay,onConfirm:async()=>je.leave(),children:e("p",{children:t("Your edits to {name} have not been saved.",{name:J})})})]})}function Mt(i){let{ask:d}=i,[c,b]=r(""),[w,x]=r(),[T,N]=r(!1),P=L();o(()=>{b(d?.kind==="rename"?d.name:""),x(void 0)},[d]);let W=d?.kind==="rename"?t("Rename"):d?.kind==="dir"?t("New folder"):t("New file"),y=async(z)=>{if(z.preventDefault(),!d)return;let I=c.trim();if(!I||I.includes("/")){x(t("Use a name without slashes."));return}N(!0),x(void 0);try{if(d.kind==="rename"){let F=Ne(ve(d.path),I);await j.rename(i.root.id,d.path,F),f(t("Renamed")),i.onDone()}else{let F=Ne(d.dir,I);await j.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=He(F);x(te?.conflict==="exists"?t("Something with that name is already there."):l(F))}finally{N(!1)}};return e(H,{open:d!==void 0,title:W,onClose:i.onClose,children:n("form",{className:"stack",onSubmit:y,children:[e("label",{htmlFor:P,children:t("Name")}),e("input",{id:P,value:c,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,onChange:(z)=>b(z.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||!c.trim(),children:d?.kind==="rename"?t("Rename"):t("Create")})]})]})})}function Dt(i){let{bump:d,rev:c}=_e(ze),[b,w]=r(),[x,T]=r(),[N,P]=r(),{timeZone:W}=_();return o(()=>{if(!i.open)return;let y=!0;return j.trash(i.root.id).then((z)=>y&&w(z.items),(z)=>y&&T(l(z))),()=>{y=!1}},[i.open,i.root.id,c]),n(H,{open:i.open,title:t("Trash"),onClose:i.onClose,children:[n("div",{className:"stack",children:[x?e(m,{message:x}):null,!b&&!x?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:oe(y.deletedAt,W)})]})]}),e("button",{type:"button",className:"secondary",onClick:async()=>{try{await j.restore(i.root.id,y.id),f(t("Restored")),d()}catch(z){let I=He(z);f(I?I.conflict==="exists"?t("Something with that name is already there."):t("The folder it was in is gone."):l(z),"danger")}},children:t("Restore")}),e("button",{type:"button",className:"icon-button danger-icon","aria-label":t("Delete {name} for good",{name:y.name}),onClick:()=>P(y),children:e(s,{name:"trash"})})]},y.id))})]}),e(D,{open:N!==void 0,title:t("Delete for good?"),confirmLabel:t("Delete for good"),tone:"danger",onClose:()=>P(void 0),onConfirm:async()=>{if(!N)return;await j.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 yn(){let i=er(),d=!Qe("(min-width: 720px)"),[c,b]=r(0),w=E(()=>b((O)=>O+1),[]),x=C(()=>({rev:c,bump:w}),[c,w]),[T,N]=r(),[P,W]=r();o(()=>{j.roots().then((O)=>N(O.roots),(O)=>W(l(O)))},[]);let[y,z]=r(()=>et(ft,280)),[I,F]=r(),[te,q]=r(),[Ue,Me]=r(!1),[ne,Se]=r(),ke=lt(i.key),V=T?.find((O)=>O.id===ke?.root)??(d?void 0:T?.[0]),A=V?ke&&ke.root===V.id?ke:{root:V.id,path:"",dir:!0}:void 0,Z=V?.id,ue=A?.path,De=A?.dir,[Be,me]=r(new Set);o(()=>{if(!Z)return;me(new Set(et(Ge(Z),[])))},[Z]);let le=E((O)=>{if(!Z)return;me((ie)=>{let G=new Set(ie);if(G.has(O))G.delete(O);else G.add(O);return Ke(Ge(Z),[...G]),G})},[Z]);if(o(()=>{if(!Z||ue===void 0||d)return;let O=Le(De?ue:ve(ue)),ie=O.map((G,J)=>O.slice(0,J+1).join("/"));me((G)=>{if(ie.every((Oe)=>G.has(Oe)))return G;let J=new Set([...G,...ie]);return Ke(Ge(Z),[...J]),J})},[Z,ue,De,d]),P)return e(m,{message:P});if(!T)return e(v,{});if(T.length===0)return e(k,{children:t("No files yet")});if(!V||!A)return e(ze.Provider,{value:x,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((O)=>e("li",{children:n("a",{className:"menu-item menu-link",href:Ee({root:O.id,path:"",dir:!0}),children:[e("span",{className:"menu-icon",children:e(be,{name:"folder"})}),n("span",{className:"menu-text",children:[e("strong",{children:Je(O)}),O.writable?null:e("span",{className:"meta",children:t("Read only")})]}),e(s,{name:"chevron",size:16})]})},O.id))})]})});let U=A.dir?A.path:ve(A.path),pe=A.path===""?{root:V.id,path:"",dir:!0}:{root:V.id,path:ve(A.path),dir:!0},ye=n("header",{className:"ws-head",children:[d?e("a",{className:"icon-button","aria-label":t("Back"),href:A.path===""?S("workspace"):Ee(pe),children:e(s,{name:"back"})}):e(Re,{chip:!0,className:"ws-root-picker","aria-label":t("Place"),value:V.id,onChange:(O)=>X("workspace",We({root:O.target.value,path:"",dir:!0})),children:T.map((O)=>e("option",{value:O.id,children:Je(O)},O.id))}),e(Lt,{root:V,path:A.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:()=>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:()=>Me(!0),children:e(s,{name:"trash"})})]}):null]}),$e=A.dir?e("div",{className:"ws-dir",children:e(Wt,{root:V,path:A.path,onMenu:(O)=>F(O)})}):e(zt,{root:V,path:A.path,phone:d},`${V.id}:${A.path}`),ge=I?tt(V.id,U,I):void 0,K=I?Ne(U,I.name):"";return n(ze.Provider,{value:x,children:[n("div",{className:"ws-page ws","data-wide":!d||void 0,style:{"--ws-tree":`${y}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:Be,toggle:le,current:A})}),e($t,{width:y,onChange:(O)=>{z(O),Ke(ft,O)}})]}):null,e("section",{className:"ws-main",children:$e})]})]}),e(R,{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,K,!0),download:I?.name,onClick:()=>F(void 0),children:[e("span",{className:"menu-icon",children:e(s,{name:"download"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Download")})})]})}):null,V.writable&&I?n(g,{children:[e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{q({kind:"rename",path:K,name:I.name}),F(void 0)},children:[e("span",{className:"menu-icon",children:e(s,{name:"notes"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Rename")})})]})}),e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{Se({path:K,name:I.name}),F(void 0)},children:[e("span",{className:"menu-icon",children:e(s,{name:"trash"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Delete")})})]})})]}):null]})}),e(Mt,{root:V,ask:te,onClose:()=>q(void 0),onDone:(O)=>{if(q(void 0),w(),O)X("workspace",We(O))}}),e(Dt,{root:V,open:Ue,onClose:()=>Me(!1)}),e(D,{open:ne!==void 0,title:t("Move to the trash?"),confirmLabel:t("Delete"),tone:"danger",onClose:()=>Se(void 0),onConfirm:async()=>{if(!ne)return;if(await j.remove(V.id,ne.path),f(t("Moved to the trash")),w(),!A.dir&&(A.path===ne.path||A.path.startsWith(`${ne.path}/`)))X("workspace",We({root:V.id,path:ve(A.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 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 x=w.clientX,T=i.width,N=w.currentTarget;N.setPointerCapture(w.pointerId);let P=(y)=>i.onChange(b(T+y.clientX-x)),W=()=>{N.removeEventListener("pointermove",P),N.removeEventListener("pointerup",W)};N.addEventListener("pointermove",P),N.addEventListener("pointerup",W)}})}export{yn as WorkspacePage};