pi-roundtable-web 0.26.1 → 0.26.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +10 -6
  3. package/dist/chunk-account-nhpd9j90.js +1 -0
  4. package/dist/chunk-action-menu-ec9jqtxq.js +1 -0
  5. package/dist/chunk-agent-d1xfrawq.js +1 -0
  6. package/dist/chunk-arranged-rooms-bga8yk2v.js +1 -0
  7. package/dist/{chunk-character-creator-bd426yjw.js → chunk-character-creator-k67f77w5.js} +1 -1
  8. package/dist/{chunk-codeeditor-ajhgd33t.js → chunk-codeeditor-jm2sm333.js} +2 -2
  9. package/dist/chunk-confirm-wc5xraev.js +1 -0
  10. package/dist/chunk-connectors-mhnw6d79.js +1 -0
  11. package/dist/chunk-conversations-yjyq4g1y.js +1 -0
  12. package/dist/{chunk-drag-peyb8t0k.js → chunk-drag-nyq52ck7.js} +1 -1
  13. package/dist/chunk-entry-red1597w.js +1 -0
  14. package/dist/chunk-folder-list-x56y26yq.js +1 -0
  15. package/dist/chunk-folds-3p7s2nvx.js +1 -0
  16. package/dist/{chunk-gate-hc7dd0fx.js → chunk-gate-h41bv4y9.js} +1 -1
  17. package/dist/chunk-group-scene-7eb6jyev.js +1 -0
  18. package/dist/chunk-group-table-rca48kt0.js +1 -0
  19. package/dist/chunk-host-icons-x318gjqp.js +1 -0
  20. package/dist/chunk-host-picture-xswcakgy.js +1 -0
  21. package/dist/chunk-host-state-bpahvk54.js +1 -0
  22. package/dist/chunk-host-ui-tsbwwk38.js +1 -0
  23. package/dist/{chunk-index-m7fvw92f.js → chunk-index-029209sy.js} +2 -2
  24. package/dist/chunk-index-066vzexw.js +2 -0
  25. package/dist/chunk-index-0h4h76kw.js +2 -0
  26. package/dist/{chunk-index-eg55mqqe.js → chunk-index-0n6ja7my.js} +1 -1
  27. package/dist/{chunk-index-gyary7np.js → chunk-index-0xj30mzw.js} +11 -11
  28. package/dist/{chunk-index-pk1yxkv4.js → chunk-index-1f0j335v.js} +2 -2
  29. package/dist/chunk-index-2f5nfekb.js +8 -0
  30. package/dist/chunk-index-31ays46f.js +2 -0
  31. package/dist/{chunk-index-zrvg23jd.js → chunk-index-43k1rjmx.js} +2 -2
  32. package/dist/chunk-index-4gk88a0x.js +4 -0
  33. package/dist/chunk-index-4jf4jvfd.css +1 -0
  34. package/dist/chunk-index-4mf29sbx.js +2 -0
  35. package/dist/chunk-index-51n20yhb.js +2 -0
  36. package/dist/{chunk-index-cvbdf2ca.js → chunk-index-6tpr6r6d.js} +2 -2
  37. package/dist/{chunk-index-w31c4yjv.js → chunk-index-7bbqtdce.js} +1 -1
  38. package/dist/chunk-index-84v7j6vh.js +50 -0
  39. package/dist/chunk-index-8f9jer8r.js +2 -0
  40. package/dist/chunk-index-91z3g774.js +1 -0
  41. package/dist/{chunk-index-yzsgsvnp.js → chunk-index-934zgd18.js} +2 -2
  42. package/dist/{chunk-index-vcyzwtk2.js → chunk-index-9nents16.js} +2 -2
  43. package/dist/chunk-index-9w0sar6s.js +2 -0
  44. package/dist/chunk-index-a768zmp6.js +2 -0
  45. package/dist/{chunk-index-w2j3njb6.js → chunk-index-b7jjca66.js} +2 -2
  46. package/dist/chunk-index-c5x70d9g.js +2 -0
  47. package/dist/chunk-index-cmxs5y22.js +42 -0
  48. package/dist/chunk-index-cwc1vvpw.js +2 -0
  49. package/dist/chunk-index-d85x96q0.js +2 -0
  50. package/dist/chunk-index-datrrs6b.js +2 -0
  51. package/dist/chunk-index-dep2e3f3.js +2 -0
  52. package/dist/{chunk-index-rnxj3z8k.js → chunk-index-dtste2ed.js} +2 -2
  53. package/dist/{chunk-index-czdketze.js → chunk-index-ewj52be9.js} +2 -2
  54. package/dist/{chunk-index-2yebd9tb.js → chunk-index-f3b5nch2.js} +4 -4
  55. package/dist/{chunk-index-rmxbdmn2.js → chunk-index-frwa2fmc.js} +2 -2
  56. package/dist/chunk-index-grkczq2c.js +2 -0
  57. package/dist/chunk-index-gzvkpe3e.js +2 -0
  58. package/dist/{chunk-index-73gh7kgr.js → chunk-index-kfv996qe.js} +3 -3
  59. package/dist/{chunk-index-5yzfrf7b.js → chunk-index-kw85ajap.js} +3 -3
  60. package/dist/chunk-index-satam151.js +2 -0
  61. package/dist/{chunk-index-dt9775ka.js → chunk-index-smw1n2pt.js} +5 -5
  62. package/dist/chunk-index-th43f690.js +2 -0
  63. package/dist/chunk-index-ths2hxpe.js +1 -0
  64. package/dist/{chunk-index-k7t14rwa.js → chunk-index-tmx30r1w.js} +2 -2
  65. package/dist/{chunk-index-snzzfhk3.js → chunk-index-y00wke93.js} +2 -2
  66. package/dist/chunk-index-y4sqmenv.js +2 -0
  67. package/dist/{chunk-index-z9x4cnzf.js → chunk-index-yrhbhmxz.js} +2 -2
  68. package/dist/chunk-index-zd76pr2k.js +2 -0
  69. package/dist/chunk-lang-css-fa7c0zfj.js +1 -0
  70. package/dist/{chunk-lang-dockerfile-k728ewsf.js → chunk-lang-dockerfile-46rk929v.js} +1 -1
  71. package/dist/{chunk-lang-go-wjwgay4v.js → chunk-lang-go-qb0qdpg7.js} +3 -3
  72. package/dist/chunk-lang-html-47mf2y0v.js +1 -0
  73. package/dist/chunk-lang-javascript-d32qrvxz.js +1 -0
  74. package/dist/{chunk-lang-json-7gd89mvs.js → chunk-lang-json-1q4fp694.js} +1 -1
  75. package/dist/{chunk-lang-markdown-b6qbe8bt.js → chunk-lang-markdown-5w7t28wa.js} +5 -5
  76. package/dist/{chunk-lang-python-3v56y31b.js → chunk-lang-python-3dq0p4rf.js} +2 -2
  77. package/dist/{chunk-lang-rust-kh0z74d1.js → chunk-lang-rust-70pa0agr.js} +1 -1
  78. package/dist/{chunk-lang-shell-9zv0zvbx.js → chunk-lang-shell-4pxt7hf4.js} +1 -1
  79. package/dist/{chunk-lang-sql-yw6bf3t7.js → chunk-lang-sql-kgcbh2a9.js} +2 -2
  80. package/dist/{chunk-lang-toml-tg1r96nq.js → chunk-lang-toml-99t95pab.js} +1 -1
  81. package/dist/chunk-lang-typescript-4k1d8z7s.js +1 -0
  82. package/dist/{chunk-lang-xml-ev1mndd4.js → chunk-lang-xml-mnbv9yfa.js} +1 -1
  83. package/dist/{chunk-lang-yaml-fz5qpb3r.js → chunk-lang-yaml-2by9g1dy.js} +1 -1
  84. package/dist/chunk-layout-actions-cgghzj1w.js +1 -0
  85. package/dist/chunk-menu-items-24cfwawa.js +2 -0
  86. package/dist/chunk-mode-toggle-v4baz3r1.js +1 -0
  87. package/dist/{chunk-note-row-kd0fy7ee.js → chunk-note-row-72n6cqyk.js} +2 -2
  88. package/dist/chunk-notes-83s3tsey.js +1 -0
  89. package/dist/chunk-notice-bell-a4ty5h1p.js +1 -0
  90. package/dist/chunk-notices-evny44be.js +1 -0
  91. package/dist/chunk-onboarding-q1avjbrx.js +1 -0
  92. package/dist/chunk-overview-42h45ehd.js +1 -0
  93. package/dist/chunk-palette-e44qepmh.js +1 -0
  94. package/dist/chunk-placement-items-v466t0sv.js +1 -0
  95. package/dist/chunk-profile-bqcgkgk4.js +1 -0
  96. package/dist/chunk-prompt-history-hgbtcn4b.js +1 -0
  97. package/dist/chunk-prompts-czs8y6r1.js +1 -0
  98. package/dist/chunk-room-confirms-h8cdj3ng.js +1 -0
  99. package/dist/chunk-room-menu-7s0feajw.js +1 -0
  100. package/dist/chunk-rooms-menu-button-gawqvpsr.js +1 -0
  101. package/dist/{chunk-schedules-rw57nr0m.js → chunk-schedules-zba7krac.js} +1 -1
  102. package/dist/{chunk-seat-menu-ys5v9abz.js → chunk-seat-menu-ca5p4e9q.js} +1 -1
  103. package/dist/chunk-sheet-hosts-ssbz6hf2.js +1 -0
  104. package/dist/chunk-skill-editor-n0y9pd90.js +8 -0
  105. package/dist/chunk-skills-ea4vb2s4.js +1 -0
  106. package/dist/chunk-switcher-list-pj5csqr9.js +1 -0
  107. package/dist/{chunk-tab-dot-r6brdbmw.js → chunk-tab-dot-4tkpxqeh.js} +1 -1
  108. package/dist/chunk-table-j8nmtdnn.js +1 -0
  109. package/dist/chunk-table-seats-qeytqe0m.js +1 -0
  110. package/dist/chunk-table2d-18y029k9.js +1 -0
  111. package/dist/chunk-table3d-q2s31ae0.js +4220 -0
  112. package/dist/chunk-thread-actions-w3eadnh7.js +1 -0
  113. package/dist/chunk-thread-cards-fbpky3c9.js +1 -0
  114. package/dist/chunk-thread-list-pghe84be.js +1 -0
  115. package/dist/chunk-transcript-eqzxgqys.js +1 -0
  116. package/dist/chunk-where-ygyr4jdj.js +1 -0
  117. package/dist/chunk-workspace-h0p32ygy.js +578 -0
  118. package/dist/chunk-zh-tw-k6xx1hp2.js +1 -0
  119. package/dist/index.html +1 -2
  120. package/dist/sw.js +1 -1
  121. package/package.json +2 -2
  122. package/src/api-types.ts +5 -0
  123. package/src/app/api-http.ts +1 -1
  124. package/src/app/routes.ts +53 -1
  125. package/src/app/surface-threads.ts +1 -1
  126. package/src/app/surface.ts +2 -1
  127. package/src/app/threads.ts +20 -0
  128. package/src/auth/authenticator.ts +8 -1
  129. package/src/auth/sessions.ts +10 -3
  130. package/src/i18n/zh-tw.ts +96 -79
  131. package/src/options.ts +1 -1
  132. package/src/web-plugin.ts +12 -1
  133. package/dist/chunk-account-ghq105t4.js +0 -1
  134. package/dist/chunk-action-menu-me0g9qsc.js +0 -1
  135. package/dist/chunk-agent-rdv7ekrt.js +0 -1
  136. package/dist/chunk-arranged-rooms-81rqhx9x.js +0 -1
  137. package/dist/chunk-confirm-p3mts8mx.js +0 -1
  138. package/dist/chunk-connectors-bkv3xn83.js +0 -1
  139. package/dist/chunk-conversations-0e0vbxwr.js +0 -1
  140. package/dist/chunk-entry-mv7q8br0.js +0 -1
  141. package/dist/chunk-folder-list-era3tksh.js +0 -1
  142. package/dist/chunk-folds-hvws0bd5.js +0 -1
  143. package/dist/chunk-group-scene-dkbpmbh5.js +0 -1
  144. package/dist/chunk-group-table-fqmxgdfw.js +0 -1
  145. package/dist/chunk-host-icons-4xde9ntk.js +0 -1
  146. package/dist/chunk-host-picture-014yzk20.js +0 -1
  147. package/dist/chunk-host-state-t56e5sdy.js +0 -1
  148. package/dist/chunk-host-ui-p1zy9nmp.js +0 -1
  149. package/dist/chunk-index-0fmmvgee.js +0 -2
  150. package/dist/chunk-index-0xh24y25.js +0 -2
  151. package/dist/chunk-index-4t0r3t3b.js +0 -2
  152. package/dist/chunk-index-6twb7ccd.js +0 -2
  153. package/dist/chunk-index-7xffskfa.js +0 -8
  154. package/dist/chunk-index-aqw7cy5j.js +0 -1
  155. package/dist/chunk-index-b6ca02e8.js +0 -2
  156. package/dist/chunk-index-b8nvhcx5.js +0 -2
  157. package/dist/chunk-index-gr6e0hse.js +0 -2
  158. package/dist/chunk-index-j214tczc.js +0 -1
  159. package/dist/chunk-index-jd6632ef.js +0 -2
  160. package/dist/chunk-index-jw7dtshr.js +0 -2
  161. package/dist/chunk-index-kwcx62wb.js +0 -4
  162. package/dist/chunk-index-mmg788a1.js +0 -2
  163. package/dist/chunk-index-mq0dacwr.js +0 -2
  164. package/dist/chunk-index-p53ak25v.js +0 -2
  165. package/dist/chunk-index-rbcz9jd4.css +0 -1
  166. package/dist/chunk-index-v3bmr0nw.js +0 -2
  167. package/dist/chunk-index-wrm8w165.js +0 -2
  168. package/dist/chunk-index-xh0mg9cw.js +0 -2
  169. package/dist/chunk-index-ybtvvx85.js +0 -2
  170. package/dist/chunk-index-zynq0b0w.js +0 -50
  171. package/dist/chunk-lang-css-88v3hp3d.js +0 -1
  172. package/dist/chunk-lang-html-07d47es4.js +0 -1
  173. package/dist/chunk-lang-javascript-fmhhgzwd.js +0 -1
  174. package/dist/chunk-lang-typescript-etjjvr2g.js +0 -1
  175. package/dist/chunk-layout-actions-48ecgtkg.js +0 -1
  176. package/dist/chunk-menu-items-1epy3h0t.js +0 -2
  177. package/dist/chunk-mode-toggle-fxmfxsa4.js +0 -1
  178. package/dist/chunk-notes-yb8f057c.js +0 -1
  179. package/dist/chunk-notice-bell-wr4f1rph.js +0 -1
  180. package/dist/chunk-notices-x07da5bb.js +0 -1
  181. package/dist/chunk-onboarding-csrkbh9z.js +0 -1
  182. package/dist/chunk-overview-avc2d30t.js +0 -1
  183. package/dist/chunk-palette-9nhp95bz.js +0 -1
  184. package/dist/chunk-placement-items-q694dpgk.js +0 -1
  185. package/dist/chunk-profile-6qemf3m7.js +0 -1
  186. package/dist/chunk-prompt-history-7enzp2p3.js +0 -1
  187. package/dist/chunk-prompts-nv6mrn0q.js +0 -1
  188. package/dist/chunk-room-confirms-zz7n61y7.js +0 -1
  189. package/dist/chunk-room-menu-rr6nzap1.js +0 -1
  190. package/dist/chunk-rooms-menu-button-zbtwj47d.js +0 -1
  191. package/dist/chunk-sheet-hosts-jhvaacst.js +0 -1
  192. package/dist/chunk-skill-editor-sz8an8qr.js +0 -8
  193. package/dist/chunk-skills-tnr1h16h.js +0 -1
  194. package/dist/chunk-switcher-list-17enhrse.js +0 -1
  195. package/dist/chunk-table-r12cja6p.js +0 -1
  196. package/dist/chunk-table-seats-g3t392zz.js +0 -1
  197. package/dist/chunk-table2d-p3ezsdcj.js +0 -1
  198. package/dist/chunk-table3d-4x2n2b00.js +0 -4220
  199. package/dist/chunk-thread-actions-qc6ezkha.js +0 -1
  200. package/dist/chunk-transcript-n2s6dher.js +0 -1
  201. package/dist/chunk-where-f3scdydc.js +0 -1
  202. package/dist/chunk-workspace-xs023bxm.js +0 -1
  203. package/dist/chunk-zh-tw-efvmk3fd.js +0 -1
@@ -0,0 +1 @@
1
+ import{Yi,Ys,Hi}from"./chunk-index-4mf29sbx.js";export{Hi as clearFinished,Yi as dismissThread,Ys as dismissThreads};
@@ -0,0 +1 @@
1
+ import{t,Se,fe,dn,Cs,Cn,$i}from"./chunk-index-84v7j6vh.js";import{Yi,Hi}from"./chunk-index-4mf29sbx.js";import{ir}from"./chunk-index-a768zmp6.js";var E=12,R=24,y=180,L=150,C=100,w=".thread-card",h=".thread-group",g=(e)=>e instanceof Element?e.closest(w):null,B=(e)=>e.closest("li"),m=(e)=>e.dataset.closed==="",I=(e)=>new Promise((i)=>setTimeout(i,e));function X(e){return[...e.closest(h)?.querySelectorAll(`${w}[data-closed]`)??[]].flatMap((n)=>n.dataset.thread?[n.dataset.thread]:[])}function q(e){let i=B(e);if(delete e.dataset.armed,e.style.transition="",e.style.transform="",e.style.opacity="",i)i.style.transition="",i.style.height="",i.style.marginBottom="",i.style.opacity=""}async function F(e){let i=B(e);if(!i||Se())return;e.dataset.leaving="",e.style.transition=`transform ${y}ms var(--ease-out), opacity ${y}ms var(--ease-out)`,e.style.transform="translate3d(110%, 0, 0)",e.style.opacity="0",await I(y),i.style.height=`${i.offsetHeight}px`,i.getBoundingClientRect(),i.style.transition=`height ${L}ms var(--ease-out), margin-bottom ${L}ms var(--ease-out)`,i.style.height="0px",i.style.marginBottom="calc(var(--space-1) * -1)",await I(L)}function _(e){let i=[...e.closest(h)?.querySelectorAll(`${w} .thread-link`)??[]],n=e.querySelector(".thread-link"),o=n?i.indexOf(n):-1;if(document.activeElement&&!e.contains(document.activeElement))return;(i[o+1]??i[o-1]??e.closest(h)?.querySelector("summary"))?.closest("a, summary")?.focus()}async function T(e){let i=e.dataset.thread;if(!i||!m(e)||e.dataset.leaving!==void 0)return;if(_(e),await F(e),!await Yi(i))q(e);delete e.dataset.leaving}function M(e,i,n){let o=[];if(m(e))o.push({id:"clear",label:t("Clear this thread"),icon:"trash",tone:"danger",run:()=>T(e)});let l=X(e),f=e.closest(h)?.dataset.parent||void 0;if(l.length>0)o.push({id:"clear-all",label:t("Clear all finished"),icon:"trash",tone:"danger",run:()=>Hi(f,l)});fe({title:e.querySelector(".thread-title")?.textContent??"",items:o,at:i,via:n,source:e.querySelector(".thread-link")??e})}var O=(e)=>{if(e.cancelable)e.preventDefault()};function W(e,i){let n=e.at(-1);if(!n||i-n.t>C)return 0;let o=e.find((l)=>n.t-l.t<=C);if(!o||n.t<=o.t)return 0;return(n.x-o.x)/(n.t-o.t)}function z(e){let i=ir(),n,o=!1,l=()=>{n?.press.cancel(),window.removeEventListener("touchmove",O),n=void 0},f=(s)=>{if(o=!1,s.pointerType==="mouse"||!s.isPrimary)return;let r=g(s.target);if(!r||s.target.closest(".thread-more"))return;l();let a={x:s.clientX,y:s.clientY},c=new dn((d)=>{if(o=!0,typeof navigator.vibrate==="function")navigator.vibrate(10);if(n)n.state="reject";v(r),M(r,d,"hold")});c.begin(a.x,a.y),n={id:s.pointerId,card:r,origin:a,press:c,swipes:!Cn(a.x,window.innerWidth),state:"wait",offset:0,samples:[{x:a.x,t:s.timeStamp}]}},v=(s)=>{if(s.dataset.leaving!==void 0)return;delete s.dataset.armed,s.style.transition=`transform ${Se()?0:y}ms var(--ease-out)`,s.style.transform=""},x=(s)=>{if(!n||n.id!==s.pointerId)return;let{card:r}=n,a=s.clientX-n.origin.x,c=s.clientY-n.origin.y;if(n.state==="wait"){n.press.move(s.clientX,s.clientY);let p=Math.abs(a);if(!n.swipes)return;if(p>=E&&p>Cs*Math.abs(c)){if(n.state=a>0?"drag":"reject",n.state==="drag")n.press.cancel(),r.style.transition="none",window.addEventListener("touchmove",O,{passive:!1})}else if(Math.abs(c)>=E)n.state="reject";if(n.state!=="drag")return}if(n.state!=="drag")return;let d=Math.max(0,a-E),u=r.offsetWidth||1;if(n.offset=m(r)?Math.min(d,u):Math.min(R,d*0.3),n.samples.push({x:s.clientX,t:s.timeStamp}),r.style.transform=`translate3d(${n.offset}px, 0, 0)`,m(r))if($i(n.offset/u,0))r.dataset.armed="";else delete r.dataset.armed},H=(s)=>{if(!n||n.id!==s.pointerId)return;let{card:r,state:a,offset:c,samples:d}=n,u=n.press.end();if(l(),u)o=!0;if(a!=="drag")return;o=!0;let p=r.offsetWidth||1,A=W(d,s.timeStamp);if(m(r)&&c>E&&$i(c/p,A))T(r);else v(r)},b=(s)=>{if(!n||n.id!==s.pointerId)return;let{card:r,state:a}=n;if(l(),a==="drag")v(r)},S=(s)=>{let r=g(s.target);if(!r)return;if(s.preventDefault(),o)return;n?.press.cancel(),M(r,{x:s.clientX,y:s.clientY},"contextmenu")},P=(s)=>{o=!1;let r=g(s.target);if(!r)return;if(s.key==="Delete"&&m(r))s.preventDefault(),T(r);else if(s.key==="ContextMenu"||s.key==="F10"&&s.shiftKey){s.preventDefault();let a=r.getBoundingClientRect();M(r,{x:a.left+Math.min(a.width/2,48),y:a.top+24},"key")}},k=(s)=>{if(!o)return;o=!1,s.preventDefault(),s.stopPropagation()},D=(s)=>{if(g(s.target))s.preventDefault()};return e.addEventListener("pointerdown",f),e.addEventListener("pointermove",x),e.addEventListener("pointerup",H),e.addEventListener("pointercancel",b),e.addEventListener("contextmenu",S),e.addEventListener("keydown",P),e.addEventListener("click",k,!0),e.addEventListener("dragstart",D),()=>{l(),i(),e.removeEventListener("pointerdown",f),e.removeEventListener("pointermove",x),e.removeEventListener("pointerup",H),e.removeEventListener("pointercancel",b),e.removeEventListener("contextmenu",S),e.removeEventListener("keydown",P),e.removeEventListener("click",k,!0),e.removeEventListener("dragstart",D)}}export{z as attachThreadCards,M as openCardMenu};
@@ -0,0 +1 @@
1
+ import{f,J,o,a,t,ne,e,n,s,x,u,_,Pe,te,Ri,We,gn,$n,Nn,Wt}from"./chunk-index-84v7j6vh.js";var b=J(function(i){let{view:m,parent:p}=i,c=Ri(m.key),h=Boolean(m.closed);return n("li",{className:"thread-item",children:[h?n("span",{className:"thread-reveal","aria-hidden":"true",children:[e(s,{name:"trash",size:18}),t("Clear")]}):null,n("div",{className:"thread-card","data-hold":"row","data-thread":m.key,"data-closed":h?"":void 0,style:c,children:[n("a",{className:"thread-link",href:x("room",m.key),"aria-current":i.active?"page":void 0,children:[p?e(We,{view:p,size:36}):e(s,{name:"conversations",size:20,className:"thread-row-icon"}),n("span",{className:"thread-card-main",children:[n("span",{className:"thread-card-top",children:[e("strong",{className:"thread-title",children:m.displayName}),e(gn,{room:m.key}),e("span",{className:"room-row-time",children:i.at?Pe(i.at,i.now,i.timeZone):""})]}),n("span",{className:"thread-card-meta",children:[i.typing?e($n,{}):null,e("span",{className:h?"badge":"badge badge-accent",children:h?t("Finished"):t("In progress")}),i.waiting?e(Nn,{count:i.waiting}):null]})]})]}),h?e("button",{type:"button",className:"thread-more","aria-haspopup":"menu","aria-label":t("More actions for {name}",{name:m.displayName}),onClick:(v)=>{let g=v.currentTarget,y=g.closest(".thread-card"),r=g.getBoundingClientRect();if(y)(f("fbpky3c9"),import("./chunk-thread-cards-fbpky3c9.js")).then((l)=>l.openCardMenu(y,{x:r.right,y:r.bottom},"key"))},children:e(s,{name:"more",size:18})}):null]})]})});function k(d){let{now:i}=te(),{timeZone:m}=_(),p=Wt(d.open),c=Wt(d.closed),h=u((r)=>d.parent?r.rooms[d.parent]?.view:void 0,d.parent??""),v=a(null),g=p.length+c.length>0;if(o(()=>{let r=v.current;if(!g||!r)return;let l=!1,N;return (f("fbpky3c9"),import("./chunk-thread-cards-fbpky3c9.js")).then((w)=>{if(!l)N=w.attachThreadCards(r)}),()=>{l=!0,N?.()}},[g]),!g)return null;let y=({key:r,...l})=>e(b,{...l,active:r===d.active,now:i,timeZone:m,parent:h},r);return n("div",{className:"thread-group",ref:v,"data-parent":d.parent,children:[p.length?e("ul",{className:"thread-list","aria-label":t("Dispatch threads"),children:p.map(y)}):null,c.length?n("div",{className:"thread-finished",children:[n("details",{className:"thread-closed",...c.some((r)=>r.key===d.active)?{open:!0}:{},children:[e("summary",{children:ne(c.length,"{count} finished thread","{count} finished threads")}),e("ul",{className:"thread-list",children:c.map(y)})]}),e("button",{type:"button",className:"thread-clear",onClick:()=>(f("w3eadnh7"),import("./chunk-thread-actions-w3eadnh7.js")).then((r)=>r.clearFinished(d.parent,c.map((l)=>l.key))),children:t("Clear finished")})]}):null]})}export{k as default};
@@ -0,0 +1 @@
1
+ import{o,A,a,r,t,c,g,e,n,x,O,S,m,k,P,_,ie,si}from"./chunk-index-84v7j6vh.js";import{ye}from"./chunk-index-th43f690.js";import{De}from"./chunk-index-cmxs5y22.js";function U({conversationKey:s}){let[p,v]=r(),u=A(),d=a(!1),{data:i,error:h}=ye(()=>O.transcript(s,p),`${s}|${p??""}`);o(()=>{if(i&&!d.current)d.current=!0,window.scrollTo(0,document.body.scrollHeight)},[i]);let y=n("a",{className:"back",href:x("conversations"),children:["← ",t("Conversations")]});if(!i)return n(g,{children:[y,h?e(m,{message:h}):e(S,{})]});let{conversation:f}=i,N=f.kind==="outside"?t("Outside AI client · {id}",{id:f.id.slice(0,8)}):si(f);return n(g,{children:[y,n("section",{className:"stack",children:[n("div",{className:"card-head",children:[e("h2",{children:N}),f.busy>0?e(P,{tone:"busy",children:t("running")}):null]}),i.archives.length>0?n("label",{className:"inline",htmlFor:u,children:[t("Showing")," ",n(De,{id:u,value:p??"",onChange:(l)=>{d.current=!1,v(l.target.value||void 0)},children:[e("option",{value:"",children:t("Current conversation")}),i.archives.map((l)=>e("option",{value:l,children:t("Archived {name}",{name:l})},l))]})]}):null,h?e(m,{message:h}):null,i.truncated?e("p",{className:"hint",children:t("This conversation is longer than the console reads; the oldest entries are not shown.")}):null,i.entries.length===0?e(k,{children:t("Nothing to show.")}):null,e("ol",{className:"transcript",children:i.entries.map((l,T)=>e(w,{entry:l},T))})]})]})}function w({entry:s}){let{timeZone:p}=_(),v=s.at?ie(s.at,p):"";if(s.role==="tool")return e("li",{className:"entry entry-tool",children:n("details",{children:[n("summary",{children:[s.failed?t("Tool failed"):t("Tool result"),s.tool?` · ${s.tool}`:""]}),e("pre",{children:s.text||t("(empty)")})]})});return n("li",{className:`entry entry-${s.role}`,children:[n("div",{className:"entry-head",children:[e("span",{className:"role",children:t(E[s.role])}),e("span",{className:"meta",children:v})]}),s.text?e("p",{className:"text",children:s.text}):null,s.calls?.map((u,d)=>n("code",{className:"call",children:[u.name," ",u.preview]},d))]})}var E={user:c("User"),assistant:c("Knight"),tool:c("Tool"),compaction:c("Summary of earlier conversation")};export{U as TranscriptPage};
@@ -0,0 +1 @@
1
+ import{Pn,ur}from"./chunk-index-934zgd18.js";export{Pn as currentQuery,ur as followUrl};
@@ -0,0 +1,578 @@
1
+ import{f,nn,z,be,o,A,Fe,N,a,r,t,c,g,e,n,s,x,ni,K,Ti,le,h,d,p,S,m,k,P,_,ie,Qe,Me}from"./chunk-index-84v7j6vh.js";import{j}from"./chunk-index-7bbqtdce.js";import{gi,De}from"./chunk-index-cmxs5y22.js";import{de}from"./chunk-index-grkczq2c.js";import{D}from"./chunk-index-9nents16.js";function st(i,l,u){let[v,w]=r();o(()=>{if(!i)return;let C=(b)=>b.preventDefault(),M=(b)=>{if(b.button!==0||b.metaKey||b.ctrlKey||b.shiftKey||b.altKey)return;let T=b.target instanceof Element?b.target.closest("a"):null;if(!T||T.target||T.hasAttribute("download"))return;if(l.current?.contains(T))return;b.preventDefault(),b.stopPropagation(),w({kind:"link",anchor:T})},R=ni((b)=>w({kind:"navigate",proceed:b}));return window.addEventListener("beforeunload",C),document.addEventListener("click",M,!0),()=>{R(),window.removeEventListener("beforeunload",C),document.removeEventListener("click",M,!0)}},[i,l]);let y=z(()=>w(void 0),[]),E=z(()=>{let C=v;if(u(),w(void 0),C?.kind==="link")setTimeout(()=>C.anchor.click(),0);else if(C?.kind==="navigate")C.proceed()},[v,u]);return{leaving:v,stay:y,leave:E}}var oe=(i)=>`workspace/${encodeURIComponent(i)}`,xe=(i)=>`path=${encodeURIComponent(i)}`,Xe=(i)=>({body:JSON.stringify(i)});function He(i){if(!(i instanceof le)||i.status!==409)return;let l=i.body;return l?.conflict==="changed"||l?.conflict==="gone"||l?.conflict==="exists"?l:void 0}var q={roots:()=>h("workspace"),list:(i,l)=>h(`${oe(i)}/list?${xe(l)}`),file:(i,l)=>h(`${oe(i)}/file?${xe(l)}`),save:(i,l,u,v)=>h(`${oe(i)}/file?${xe(l)}`,{method:"PUT",...Xe({text:u,baseHash:v})}),create:(i,l,u,v)=>h(`${oe(i)}/new?${xe(l)}`,{method:"POST",...Xe({kind:u,...v===void 0?{}:{text:v}})}),rename:(i,l,u)=>h(`${oe(i)}/rename`,{method:"POST",...Xe({from:l,to:u})}),remove:(i,l)=>h(`${oe(i)}/entry?${xe(l)}`,{method:"DELETE"}),trash:(i)=>h(`${oe(i)}/trash`),restore:(i,l)=>h(`${oe(i)}/trash/${encodeURIComponent(l)}/restore`,{method:"POST"}),purge:(i,l)=>h(`${oe(i)}/trash/${encodeURIComponent(l)}`,{method:"DELETE"})},he=(i,l,u=!1)=>`api/${oe(i)}/raw?${xe(l)}${u?"&download=1":""}`;var Re=(i)=>i.split("/").filter(Boolean),we=(i)=>Re(i).slice(0,-1).join("/"),Ne=(i,l)=>i?`${i}/${l}`:l,Te=(i)=>`${i.root}:${i.path}${i.dir&&i.path?"/":""}`;function dt(i){if(!i)return;let l=i.indexOf(":");if(l<1)return;let u=i.slice(l+1);return{root:i.slice(0,l),path:u.replace(/\/+$/,""),dir:u===""||u.endsWith("/")}}var lt=`/*
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 ct={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"},Nt=(i)=>(i in ct);function ve(i){let{name:l,size:u=20,className:v}=i;if(!Nt(l))return e(s,{name:l,size:u,...v?{className:v}:{}});return e("svg",{viewBox:"0 0 24 24",width:u,height:u,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...v?{className:v}:{},children:e("path",{d:ct[l]})})}function Ye(i){return n("div",{className:"ws-media-actions",children:[i.open?e("a",{className:"button-link",href:he(i.root,i.path),target:"_blank",rel:"noopener",children:t("Open")}):null,n("a",{className:"button-link",href:he(i.root,i.path,!0),download:i.name,children:[e(s,{name:"download",size:18}),t("Download")]})]})}function _e(i){let l=i.name.lastIndexOf("."),u=l>0?i.name.slice(l+1).toUpperCase():"";return n("div",{className:"card ws-card",children:[e("span",{className:"ws-card-icon","aria-hidden":"true",children:e(s,{name:"file",size:32})}),e("strong",{children:i.name}),e("span",{className:"meta",children:[u,Qe(i.bytes)].filter(Boolean).join(" · ")}),e("p",{children:i.message}),e(Ye,{root:i.root,path:i.path,name:i.name})]})}var Ct=(i)=>!i&&navigator.pdfViewerEnabled!==!1;function ut(i){let{media:l,root:u,path:v,name:w,bytes:y,phone:E,onFacts:C}=i,[M,R]=r(!1),[b,T]=r(!1);o(()=>(R(!1),T(!1),C(void 0),()=>C(void 0)),[u,v]);let O=he(u,v);if(M)return e(_e,{root:u,path:v,name:w,bytes:y,message:t("This browser cannot show this file.")});switch(l){case"image":return e("div",{className:"ws-media ws-image","data-actual":b||void 0,children:e("button",{type:"button",className:"ws-image-toggle","aria-label":b?t("Fit to window"):t("Show at full size"),title:b?t("Fit to window"):t("Show at full size"),onClick:()=>T((I)=>!I),children:e("img",{src:O,alt:w,onLoad:(I)=>{let{naturalWidth:Q,naturalHeight:X}=I.currentTarget;C(Q>0?`${Q} × ${X}`:void 0)},onError:()=>R(!0)})})});case"pdf":return Ct(E)?n("div",{className:"ws-media ws-pdf-frame",children:[e("iframe",{className:"ws-pdf",src:O,title:w}),e(Ye,{root:u,path:v,name:w,open:!0})]}):e("div",{className:"ws-media",children:n("div",{className:"card ws-card",children:[e("span",{className:"ws-card-icon","aria-hidden":"true",children:e(s,{name:"file",size:32})}),e("strong",{children:w}),n("span",{className:"meta",children:["PDF · ",Qe(y)]}),e(Ye,{root:u,path:v,name:w,open:!0})]})});case"audio":return e("div",{className:"ws-media ws-sound",children:e("audio",{controls:!0,preload:"metadata",src:O,onError:()=>R(!0)})});case"video":return e("div",{className:"ws-media ws-film",children:e("video",{controls:!0,playsInline:!0,preload:"metadata",src:O,onLoadedMetadata:(I)=>{let{videoWidth:Q,videoHeight:X}=I.currentTarget;C(Q>0?`${Q} × ${X}`:void 0)},onError:()=>R(!0)})})}}var Et={"read-only-root":c("this place is read-only"),"git-dir":c("inside .git"),trash:c("in the trash"),symlink:c("a link"),binary:c("binary file"),"too-large":c("too large"),"not-utf8":c("not UTF-8")};function Ge(i){if(i.id==="agents")return t("Knights' workspace");if(i.id==="scratch")return t("Scratch");return i.label}var pt=new Set([".git","node_modules"]),Ze=(i)=>`roundtable.workspace.open.${i}`,mt="roundtable.workspace.tree",ft="roundtable.workspace.wrap";function Je(i,l){try{let u=localStorage.getItem(i);return u===null?l:JSON.parse(u)}catch{return l}}function Ke(i,l){try{localStorage.setItem(i,JSON.stringify(l))}catch{}}var Le=nn({rev:0,bump:()=>{return}});gi("workspace",lt);var Ce=new Map,St=200;function Rt(i,l){Ce.delete(i),Ce.set(i,l);let u=Ce.keys().next().value;if(Ce.size>St&&u!==void 0)Ce.delete(u)}function gt(i,l,u=!0){let{rev:v}=be(Le),[w,y]=r(0),[E,C]=r({key:"",root:i,path:l}),M=`${i}:${l}`;if(o(()=>{let b=()=>y((T)=>T+1);return window.addEventListener("focus",b),()=>window.removeEventListener("focus",b)},[]),o(()=>{if(!u)return;let b=!0;return q.list(i,l).then((T)=>{if(Rt(M,T),b)C({key:M,root:i,path:l,data:T})},(T)=>b&&C({key:M,root:i,path:l,error:d(T)})),()=>{b=!1}},[i,l,u,v,w]),E.key===M)return{data:E.data,error:E.error,at:E};let R=Ce.get(M);if(R)return{data:R,at:{root:i,path:l}};if(E.data)return{data:E.data,at:E,pending:!0};return{}}var Ee=(i)=>x("workspace",Te(i));function et(i,l,u){let v=Ne(l,u.name);if(u.kind==="dir")return{root:i,path:v,dir:!0};if(u.kind==="file")return{root:i,path:v,dir:!1};if(u.kind==="symlink"&&u.inside)return{root:i,path:v,dir:u.target==="dir"};return}function Tt(i){let l=Re(i.path),u=a(null);return o(()=>{u.current?.scrollIntoView?.({inline:"end",block:"nearest"})},[i.path]),n("nav",{className:"ws-crumbs","aria-label":t("Path"),children:[e("a",{ref:l.length===0?u:void 0,href:Ee({root:i.root.id,path:"",dir:!0}),"aria-current":l.length===0?"page":void 0,children:Ge(i.root)}),l.map((v,w)=>{let y=l.slice(0,w+1).join("/"),E=w===l.length-1;return e("a",{ref:E?u:void 0,href:Ee({root:i.root.id,path:y,dir:!0}),"aria-current":E?"page":void 0,children:v},y)})]})}function ht(i){let{data:l,error:u,pending:v}=gt(i.root,i.path);if(u)return e("p",{className:"ws-tree-note",children:u});if(!l||v)return e("p",{className:"ws-tree-note",children:"…"});if(l.entries.length===0)return e("p",{className:"ws-tree-note",children:t("This folder is empty")});return n("ul",{className:"ws-tree-list","data-depth":i.depth,children:[l.entries.map((w)=>{let y=et(i.root,i.path,w),E=Ne(i.path,w.name),C=y?.dir===!0,M=C&&i.open.has(E),R=i.current?.root===i.root&&i.current.path===E&&i.current.dir===C;return n("li",{children:[n("div",{className:"ws-tree-row","data-selected":R||void 0,"data-quiet":pt.has(w.name)||void 0,style:{paddingLeft:`${0.25+i.depth*0.875}rem`},children:[C?e("button",{type:"button",className:"ws-twist","aria-expanded":M,"aria-label":t("Show or hide {name}",{name:w.name}),onClick:()=>i.toggle(E),children:e(s,{name:"chevron",size:14})}):e("span",{className:"ws-twist"}),y?n("a",{href:Ee(y),title:w.name,children:[e(ve,{name:C?"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})]})]}),M?e(ht,{root:i.root,path:E,depth:i.depth+1,open:i.open,toggle:i.toggle,current:i.current}):null]},w.name)}),l.truncated?e("li",{className:"ws-tree-note",children:t("Only the first 2,000 items are listed")}):null]})}function Lt(i){let{data:l,error:u,at:v,pending:w}=gt(i.root.id,i.path),{timeZone:y}=_(),E=a(null),C=v?.root??i.root.id,M=v?.path??i.path;if(Fe(()=>{E.current?.closest(".ws-main")?.scrollTo?.(0,0)},[C,M]),u)return e(m,{message:u});if(!l)return e(S,{});if(l.missing)return e(k,{children:t("No files yet")});if(l.entries.length===0)return e(k,{children:t("This folder is empty")});return n("div",{ref:E,className:"ws-listing","data-pending":w||void 0,"aria-busy":w||void 0,inert:w||void 0,children:[e("ul",{className:"ws-rows",children:l.entries.map((R)=>{let b=et(C,M,R),T=n(g,{children:[e(ve,{name:b?.dir?"folder":"file",size:20,className:"ws-row-icon"}),n("span",{className:"ws-row-main",children:[e("strong",{children:R.name}),e("span",{className:"meta",children:R.kind==="symlink"&&R.inside===!1?t("Outside the workspace"):R.kind==="other"?t("Not a regular file"):[b?.dir?void 0:Qe(R.size),ie(new Date(R.mtimeMs).toISOString(),y)].filter(Boolean).join(" · ")})]})]});return n("li",{className:"ws-row","data-quiet":pt.has(R.name)||void 0,children:[b?e("a",{className:"ws-row-link",href:Ee(b),children:T}):e("span",{className:"ws-row-link","data-off":!0,children:T}),i.root.writable||b?e("button",{type:"button",className:"icon-button","aria-label":t("Actions for {name}",{name:R.name}),onClick:()=>i.onMenu(R),children:e(s,{name:"menu"})}):null]},R.name)})}),l.truncated?e("p",{className:"meta",children:t("Only the first 2,000 items are listed")}):null]})}function Wt(i){let{timeZone:l}=_(),{bump:u}=be(Le),{root:v,path:w}=i,[y,E]=r(),[C,M]=r(),[R,b]=r("read"),[T,O]=r(!1),[I,Q]=r(!1),[X,Ue]=r(()=>Je(ft,i.phone)),[We,ee]=r(!1),[Se,ke]=r(),[F,V]=r(!1),[Y,ue]=r(!1),[ze,Be]=r(!1),[me,se]=r(),[U,fe]=r(),[ye,$e]=r(),pe=a(null),H=a(void 0),W=a(null),ae=a(y);ae.current=y;let Z=a(R);Z.current=R;let G=Re(w).at(-1)??w,Oe=y?.text!==void 0,Pe=Oe&&(y?.media===void 0||F),tt=z(async()=>{let L=await q.file(v.id,w);return E(L),L},[v.id,w]);o(()=>{let L=!0;return q.file(v.id,w).then((B)=>L&&E(B),(B)=>L&&M(d(B))),()=>{L=!1}},[v.id,w]);let je=st(T,W,()=>{let L=ae.current;if(L?.text!==void 0)H.current?.replace(L.text,L.eol);O(!1),b("read")});o(()=>{if(!T)return;let L=document.title;return document.title=`• ${L}`,()=>{document.title=L}},[T]);let Ie=z(async(L,B)=>{let ce=ae.current,J=H.current;if(!ce||!J||I)return;let te=B===void 0?J.snapshot():void 0,Ae=B??J.text();Q(!0);try{let ne=await q.save(v.id,w,Ae,L??ce.hash);J.markSaved(te),O(J.dirty()),se(void 0),E({...ce,hash:ne.hash,size:ne.size,mtimeMs:ne.mtimeMs,text:Ae}),p(t("Saved")),u()}catch(ne){let re=He(ne);if(re)fe({kind:re.conflict==="gone"?"gone":"changed",...re.current?{hash:re.current.hash}:{},text:Ae});else p(d(ne),"danger")}finally{Q(!1)}},[v.id,w,I,u]),nt=a(Ie);nt.current=Ie;let ge=z(async()=>{try{let L=await tt();if(L.text!==void 0)H.current?.replace(L.text,L.eol);O(!1),se(void 0),fe(void 0)}catch(L){p(d(L),"danger")}},[tt]),wt=a(ge);wt.current=ge;let qe=z(()=>{if(H.current?.dirty()){at(!0);return}b("read")},[]),[vt,at]=r(!1),rt=a(qe);rt.current=qe,o(()=>{if(!Pe||!pe.current)return;let L=ae.current;if(!L||L.text===void 0)return;let B=!1,ce;return (f("jm2sm333"),import("./chunk-codeeditor-jm2sm333.js")).then(async({createEditor:J})=>{if(B||!pe.current)return;let te=await J({parent:pe.current,text:L.text??"",eol:L.eol,language:L.language,editable:!1,wrap:X,phrases:{Find:t("Find"),Replace:t("Replace"),next:t("next"),previous:t("previous"),all:t("all"),"match case":t("match case"),regexp:t("regexp"),"by word":t("by word"),replace:t("replace"),"replace all":t("replace all"),close:t("close")},onChange:()=>O(te.dirty()),onSave:()=>{if(Z.current==="edit"&&te.dirty())nt.current()},onEscape:()=>{if(Z.current==="edit")rt.current()}});if(B){te.destroy();return}ce=te,H.current=te,ue(!0)}).catch((J)=>{if(console.warn("the editor failed to load",J),!B)Be(!0)}),()=>{B=!0,ce?.destroy(),H.current=void 0,ue(!1)}},[Pe,v.id,w]),o(()=>{if(!Y)return;let L=R==="edit"&&y?.editable===!0;if(H.current?.setEditable(L),L)H.current?.focus()},[R,Y,y?.editable]),o(()=>{if(!Y)return;H.current?.setWrap(X),Ke(ft,X)},[X,Y]);let ot=y!==void 0;if(o(()=>{if(!ot)return;let L=!1,B=async()=>{if(L||document.visibilityState==="hidden")return;let te=ae.current;if(!te)return;L=!0;try{let ne=(await q.list(v.id,we(w))).entries.find((yt)=>yt.name===G);if(!ne){se("gone");return}if(ne.kind==="symlink")return;if(ne.size===te.size&&ne.mtimeMs===te.mtimeMs)return;if(Z.current==="edit"&&H.current?.dirty()){se("changed");return}let re=await q.file(v.id,w);if(re.hash!==te.hash){if(E(re),re.text!==void 0)H.current?.replace(re.text,re.eol)}se(void 0)}catch{}finally{L=!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)}},[ot,v.id,w,G]),C)return e("div",{className:"ws-file",children:e(m,{message:C})});if(!y)return e("div",{className:"ws-file",children:e(S,{})});let it=y.reason,bt=!y.editable?e(P,{tone:"warn",children:t("Read only: {reason}",{reason:it?t(Et[it]):""})}):null,Ve=R==="edit",kt=n("div",{className:"ws-actions",children:[y.editable&&!Ve?e("button",{type:"button",onClick:()=>{V(!0),b("edit")},children:t("Edit")}):null,Ve?n(g,{children:[e("button",{type:"button",disabled:I||!T,onClick:()=>void Ie(),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:()=>ee(!0),children:e(s,{name:"menu"})})]});return n("div",{className:"ws-file",ref:W,children:[n("header",{className:"ws-file-head",children:[n("div",{className:"ws-file-title",children:[n("strong",{children:[T?"• ":"",G]}),n("span",{className:"meta",children:[Qe(y.size),Se?` · ${Se}`:""," ·"," ",ie(new Date(y.mtimeMs).toISOString(),l)]})]}),bt,kt]}),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 ge(),children:t("Reload (discard my edits)")}),e("button",{type:"button",className:"secondary",onClick:()=>se(void 0),children:t("Keep editing")})]}):null]}):null,e("div",{className:"ws-view",children:y.media&&!Pe?e(ut,{media:y.media,root:v.id,path:w,name:G,bytes:y.size,phone:i.phone,onFacts:ke}):Pe?e("div",{ref:pe,className:"ws-editor","data-editing":Ve||void 0,children:!Y?e("pre",{className:"ws-plain","aria-busy":!ze,children:y.text}):null}):e(_e,{root:v.id,path:w,name:G,bytes:y.size,message:y.tooLarge?t("This file is too large to show here."):t("This file is not text, so it cannot be shown here.")})}),i.phone&&Ve?n("div",{className:"ws-editbar",role:"toolbar","aria-label":t("Editing"),children:[e("button",{type:"button",disabled:I||!T,onClick:()=>void Ie(),children:t("Save")}),e("button",{type:"button",className:"secondary",onClick:()=>H.current?.undo(),children:t("Undo")}),e("button",{type:"button",className:"secondary",onClick:()=>H.current?.redo(),children:t("Redo")}),e("button",{type:"button",className:"secondary",onClick:()=>H.current?.find(),children:t("Find")}),e("button",{type:"button",className:"secondary",onClick:()=>H.current?.tab(),children:t("Tab")})]}):null,e(D,{open:We,title:G,onClose:()=>ee(!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((L)=>!L),ee(!1)},children:e("span",{className:"menu-text",children:e("strong",{children:X?t("Do not wrap lines"):t("Wrap lines")})})})}):null,e("li",{children:n("a",{className:"menu-item menu-link",href:he(v.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),ge()},children:[e("span",{className:"menu-icon",children:e(s,{name:"refresh"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Reload")})})]})})]})})}),e(de,{open:U!==void 0,title:U?.kind==="gone"?t("This file is gone"):t("This file changed while you were editing"),onClose:()=>fe(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(()=>p(t("Copied")))},children:t("Copy my text")}),U?.kind==="changed"?e("button",{type:"button",className:"secondary",onClick:()=>void ge(),children:t("Reload (discard my edits)")}):null,e("button",{type:"button",className:"danger",onClick:()=>{if(!U)return;if(U.kind==="gone"){let L=U.text;fe(void 0),q.create(v.id,w,"file",L).then(async()=>{await ge(),u()}).catch((B)=>p(d(B),"danger"));return}$e({hash:U.hash??"",text:U.text}),fe(void 0)},children:U?.kind==="gone"?t("Save mine as a new file"):t("Save mine anyway")})]})]})}),e(j,{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 q.save(v.id,w,ye.text,ye.hash),await ge(),p(t("Saved")),u()},children:e("p",{children:t("The file has been changed since you opened it. Saving yours writes over those changes.")})}),e(j,{open:vt,title:t("Unsaved changes, leave?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:()=>at(!1),onConfirm:async()=>{if(y.text!==void 0)H.current?.replace(y.text,y.eol);O(!1),b("read")},children:e("p",{children:t("Your edits to {name} have not been saved.",{name:G})})}),e(j,{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:G})})})]})}function zt(i){let{ask:l}=i,[u,v]=r(""),[w,y]=r(),[E,C]=r(!1),M=A();o(()=>{v(l?.kind==="rename"?l.name:""),y(void 0)},[l]);let R=l?.kind==="rename"?t("Rename"):l?.kind==="dir"?t("New folder"):t("New file"),b=async(T)=>{if(T.preventDefault(),!l)return;let O=u.trim();if(!O||O.includes("/")){y(t("Use a name without slashes."));return}C(!0),y(void 0);try{if(l.kind==="rename"){let I=Ne(we(l.path),O);await q.rename(i.root.id,l.path,I),p(t("Renamed")),i.onDone()}else{let I=Ne(l.dir,O);await q.create(i.root.id,I,l.kind),p(t("Created")),i.onDone({root:i.root.id,path:I,dir:l.kind==="dir"})}}catch(I){let Q=He(I);y(Q?.conflict==="exists"?t("Something with that name is already there."):d(I))}finally{C(!1)}};return e(de,{open:l!==void 0,title:R,onClose:i.onClose,children:n("form",{className:"stack",onSubmit:b,children:[e("label",{htmlFor:M,children:t("Name")}),e("input",{id:M,value:u,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,onChange:(T)=>v(T.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:E||!u.trim(),children:l?.kind==="rename"?t("Rename"):t("Create")})]})]})})}function Mt(i){let{bump:l,rev:u}=be(Le),[v,w]=r(),[y,E]=r(),[C,M]=r(),{timeZone:R}=_();return o(()=>{if(!i.open)return;let b=!0;return q.trash(i.root.id).then((T)=>b&&w(T.items),(T)=>b&&E(d(T))),()=>{b=!1}},[i.open,i.root.id,u]),n(de,{open:i.open,title:t("Trash"),onClose:i.onClose,children:[n("div",{className:"stack",children:[y?e(m,{message:y}):null,!v&&!y?e(S,{}):null,v?.length===0?e(k,{children:t("The trash is empty")}):null,e("ul",{className:"ws-rows",children:v?.map((b)=>n("li",{className:"ws-row",children:[n("span",{className:"ws-row-link","data-off":!0,children:[e(ve,{name:b.kind==="dir"?"folder":"file",size:20,className:"ws-row-icon"}),n("span",{className:"ws-row-main",children:[e("strong",{children:b.path}),e("span",{className:"meta",children:ie(b.deletedAt,R)})]})]}),e("button",{type:"button",className:"secondary",onClick:async()=>{try{await q.restore(i.root.id,b.id),p(t("Restored")),l()}catch(T){let O=He(T);p(O?O.conflict==="exists"?t("Something with that name is already there."):t("The folder it was in is gone."):d(T),"danger")}},children:t("Restore")}),e("button",{type:"button",className:"icon-button danger-icon","aria-label":t("Delete {name} for good",{name:b.name}),onClick:()=>M(b),children:e(s,{name:"trash"})})]},b.id))})]}),e(j,{open:C!==void 0,title:t("Delete for good?"),confirmLabel:t("Delete for good"),tone:"danger",onClose:()=>M(void 0),onConfirm:async()=>{if(!C)return;await q.purge(i.root.id,C.id),l()},children:e("p",{children:t("“{name}” will be removed and cannot be brought back.",{name:C?.path??""})})})]})}function kn(){let i=Ti(),l=!Me("(min-width: 720px)"),[u,v]=r(0),w=z(()=>v((W)=>W+1),[]),y=N(()=>({rev:u,bump:w}),[u,w]),[E,C]=r(),[M,R]=r();o(()=>{q.roots().then((W)=>C(W.roots),(W)=>R(d(W)))},[]);let[b,T]=r(()=>Je(mt,280)),[O,I]=r(),[Q,X]=r(),[Ue,We]=r(!1),[ee,Se]=r(),ke=dt(i.key),F=E?.find((W)=>W.id===ke?.root)??(l?void 0:E?.[0]),V=F?ke&&ke.root===F.id?ke:{root:F.id,path:"",dir:!0}:void 0,Y=F?.id,ue=V?.path,ze=V?.dir,[Be,me]=r(new Set);o(()=>{if(!Y)return;me(new Set(Je(Ze(Y),[])))},[Y]);let se=z((W)=>{if(!Y)return;me((ae)=>{let Z=new Set(ae);if(Z.has(W))Z.delete(W);else Z.add(W);return Ke(Ze(Y),[...Z]),Z})},[Y]);if(o(()=>{if(!Y||ue===void 0||l)return;let W=Re(ze?ue:we(ue)),ae=W.map((Z,G)=>W.slice(0,G+1).join("/"));me((Z)=>{if(ae.every((Oe)=>Z.has(Oe)))return Z;let G=new Set([...Z,...ae]);return Ke(Ze(Y),[...G]),G})},[Y,ue,ze,l]),M)return e(m,{message:M});if(!E)return e(S,{});if(E.length===0)return e(k,{children:t("No files yet")});if(!F||!V)return e(Le.Provider,{value:y,children:n("div",{className:"page ws-page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Files")})}),e("ul",{className:"more-list",children:E.map((W)=>e("li",{children:n("a",{className:"menu-item menu-link",href:Ee({root:W.id,path:"",dir:!0}),children:[e("span",{className:"menu-icon",children:e(ve,{name:"folder"})}),n("span",{className:"menu-text",children:[e("strong",{children:Ge(W)}),W.writable?null:e("span",{className:"meta",children:t("Read only")})]}),e(s,{name:"chevron",size:16})]})},W.id))})]})});let U=V.dir?V.path:we(V.path),fe=V.path===""?{root:F.id,path:"",dir:!0}:{root:F.id,path:we(V.path),dir:!0},ye=n("header",{className:"ws-head",children:[l?e("a",{className:"icon-button","aria-label":t("Back"),href:V.path===""?x("workspace"):Ee(fe),children:e(s,{name:"back"})}):e(De,{chip:!0,className:"ws-root-picker","aria-label":t("Place"),value:F.id,onChange:(W)=>K("workspace",Te({root:W.target.value,path:"",dir:!0})),children:E.map((W)=>e("option",{value:W.id,children:Ge(W)},W.id))}),e(Tt,{root:F,path:V.path}),F.writable?n("div",{className:"ws-head-actions",children:[e("button",{type:"button",className:"icon-button","aria-label":t("New file"),title:t("New file"),onClick:()=>X({kind:"file",dir:U}),children:e(ve,{name:"file-plus"})}),e("button",{type:"button",className:"icon-button","aria-label":t("New folder"),title:t("New folder"),onClick:()=>X({kind:"dir",dir:U}),children:e(ve,{name:"folder-plus"})}),e("button",{type:"button",className:"icon-button","aria-label":t("Trash"),title:t("Trash"),onClick:()=>We(!0),children:e(s,{name:"trash"})})]}):null]}),$e=V.dir?e("div",{className:"ws-dir",children:e(Lt,{root:F,path:V.path,onMenu:(W)=>I(W)})}):e(Wt,{root:F,path:V.path,phone:l},`${F.id}:${V.path}`),pe=O?et(F.id,U,O):void 0,H=O?Ne(U,O.name):"";return n(Le.Provider,{value:y,children:[n("div",{className:"ws-page ws","data-wide":!l||void 0,style:{"--ws-tree":`${b}px`},children:[ye,n("div",{className:"ws-body",children:[!l?n(g,{children:[e("aside",{className:"ws-tree","aria-label":t("Folders"),children:e(ht,{root:F.id,path:"",depth:0,open:Be,toggle:se,current:V})}),e(Dt,{width:b,onChange:(W)=>{T(W),Ke(mt,W)}})]}):null,e("section",{className:"ws-main",children:$e})]})]}),e(D,{open:O!==void 0,title:O?.name??"",onClose:()=>I(void 0),children:n("ul",{className:"more-list",children:[pe&&!pe.dir?e("li",{children:n("a",{className:"menu-item menu-link",href:he(F.id,H,!0),download:O?.name,onClick:()=>I(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,F.writable&&O?n(g,{children:[e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{X({kind:"rename",path:H,name:O.name}),I(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:H,name:O.name}),I(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(zt,{root:F,ask:Q,onClose:()=>X(void 0),onDone:(W)=>{if(X(void 0),w(),W)K("workspace",Te(W))}}),e(Mt,{root:F,open:Ue,onClose:()=>We(!1)}),e(j,{open:ee!==void 0,title:t("Move to the trash?"),confirmLabel:t("Delete"),tone:"danger",onClose:()=>Se(void 0),onConfirm:async()=>{if(!ee)return;if(await q.remove(F.id,ee.path),p(t("Moved to the trash")),w(),!V.dir&&(V.path===ee.path||V.path.startsWith(`${ee.path}/`)))K("workspace",Te({root:F.id,path:we(V.path),dir:!0}))},children:e("p",{children:t("“{name}” goes to the trash, where you can bring it back.",{name:ee?.name??""})})})]})}function Dt(i){let v=(w)=>Math.min(560,Math.max(180,w));return e("div",{className:"ws-resizer",role:"separator","aria-orientation":"vertical","aria-valuenow":i.width,"aria-valuemin":180,"aria-valuemax":560,"aria-label":t("Resize the folder list"),tabIndex:0,onKeyDown:(w)=>{if(w.key==="ArrowLeft")i.onChange(v(i.width-16));if(w.key==="ArrowRight")i.onChange(v(i.width+16))},onPointerDown:(w)=>{let y=w.clientX,E=i.width,C=w.currentTarget;C.setPointerCapture(w.pointerId);let M=(b)=>i.onChange(v(E+b.clientX-y)),R=()=>{C.removeEventListener("pointermove",M),C.removeEventListener("pointerup",R)};C.addEventListener("pointermove",M),C.addEventListener("pointerup",R)}})}export{kn as WorkspacePage};