pi-roundtable-web 0.26.3 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +18 -11
  3. package/dist/chunk-account-1ecx5kt7.js +1 -0
  4. package/dist/chunk-action-menu-zh2n0ahf.js +1 -0
  5. package/dist/chunk-agent-ynm2tcbx.js +1 -0
  6. package/dist/chunk-arranged-rooms-qnz8vese.js +1 -0
  7. package/dist/chunk-bulk-actions-pr0mw0kc.js +1 -0
  8. package/dist/chunk-character-creator-caj4pmg4.js +1 -0
  9. package/dist/{chunk-codeeditor-6xavqntt.js → chunk-codeeditor-dga6s78p.js} +2 -2
  10. package/dist/chunk-confirm-g76v5d9r.js +1 -0
  11. package/dist/{chunk-connectors-7xqsg5q5.js → chunk-connectors-j79ze3j1.js} +1 -1
  12. package/dist/{chunk-conversations-zc4mv6vj.js → chunk-conversations-2farn72g.js} +1 -1
  13. package/dist/chunk-council-sheet-s9sz1bzf.js +2 -0
  14. package/dist/{chunk-drag-0mefcvp3.js → chunk-drag-45e8222r.js} +1 -1
  15. package/dist/chunk-entry-q11n47h9.js +1 -0
  16. package/dist/chunk-folder-list-4gcj7g7h.js +1 -0
  17. package/dist/chunk-folds-ten4ykfw.js +1 -0
  18. package/dist/{chunk-gate-86r8a2vf.js → chunk-gate-kcv1a4t0.js} +1 -1
  19. package/dist/chunk-group-scene-12ghcvzd.js +1 -0
  20. package/dist/chunk-group-table-t458kdgn.js +1 -0
  21. package/dist/chunk-host-icons-h1k9k96a.js +1 -0
  22. package/dist/chunk-host-picture-3p0wzn3v.js +1 -0
  23. package/dist/chunk-host-state-7mdve7cb.js +1 -0
  24. package/dist/chunk-host-ui-bdgwa6sf.js +1 -0
  25. package/dist/chunk-index-02vfshtt.js +2 -0
  26. package/dist/chunk-index-0a81da8z.js +2 -0
  27. package/dist/{chunk-index-8eexybcx.js → chunk-index-0w4bfjb5.js} +2 -2
  28. package/dist/{chunk-index-1fn8q4ps.js → chunk-index-12zyshae.js} +2 -2
  29. package/dist/chunk-index-18pgxxw3.js +2 -0
  30. package/dist/chunk-index-2e4am3hw.js +50 -0
  31. package/dist/{chunk-index-agrvqf5b.js → chunk-index-2fdns8tn.js} +2 -2
  32. package/dist/{chunk-index-84wbc80d.js → chunk-index-2t30xwed.js} +2 -2
  33. package/dist/{chunk-index-jq970hsd.js → chunk-index-31x6krbs.js} +3 -3
  34. package/dist/{chunk-index-eh0wb6g0.js → chunk-index-3d8s3565.js} +2 -2
  35. package/dist/chunk-index-5bfqek1d.js +2 -0
  36. package/dist/chunk-index-64rsz6pf.js +2 -0
  37. package/dist/chunk-index-6bkcq9ka.js +2 -0
  38. package/dist/{chunk-index-47yspxa4.js → chunk-index-8d81qy69.js} +1 -1
  39. package/dist/chunk-index-92zgb7my.js +2 -0
  40. package/dist/chunk-index-aamhjg5n.js +2 -0
  41. package/dist/{chunk-index-r1v895tj.js → chunk-index-ac1ktr56.js} +2 -2
  42. package/dist/{chunk-index-hc0dgmrs.js → chunk-index-ak6ecqy3.js} +2 -2
  43. package/dist/{chunk-index-eyc2rkq5.js → chunk-index-b73y2gc0.js} +2 -2
  44. package/dist/chunk-index-b8cpvr7y.js +2 -0
  45. package/dist/{chunk-index-3aa5czxj.js → chunk-index-bhqczxr3.js} +2 -2
  46. package/dist/{chunk-index-6c8mewwy.js → chunk-index-cbqhzf40.js} +12 -12
  47. package/dist/chunk-index-cdctnw71.js +2 -0
  48. package/dist/chunk-index-dj0tbfyb.js +2 -0
  49. package/dist/chunk-index-dnjftvtq.js +2 -0
  50. package/dist/chunk-index-e2dqjde8.js +1 -0
  51. package/dist/{chunk-index-tsxsy4qs.js → chunk-index-ebg48jgy.js} +2 -2
  52. package/dist/{chunk-index-rcxz5w5d.js → chunk-index-ek5mek4j.js} +3 -3
  53. package/dist/chunk-index-f6q0stqx.js +2 -0
  54. package/dist/{chunk-index-67p2sc14.js → chunk-index-ffbrm6tr.js} +3 -3
  55. package/dist/chunk-index-g1awv7rk.js +2 -0
  56. package/dist/chunk-index-g3wrs02w.js +1 -0
  57. package/dist/chunk-index-j0m16cj1.js +2 -0
  58. package/dist/chunk-index-j4kk1m59.js +2 -0
  59. package/dist/chunk-index-j4x9dq30.css +1 -0
  60. package/dist/{chunk-index-3wbyq10m.js → chunk-index-jgzygbt8.js} +1 -1
  61. package/dist/chunk-index-kb3w11mn.js +7 -0
  62. package/dist/{chunk-index-raf772z6.js → chunk-index-kbrg32sx.js} +2 -2
  63. package/dist/chunk-index-msqhgvfx.js +2 -0
  64. package/dist/chunk-index-pefwfm26.js +2 -0
  65. package/dist/chunk-index-pyfx77cj.js +2 -0
  66. package/dist/{chunk-index-30vw4nhh.js → chunk-index-q7g62sgm.js} +3 -3
  67. package/dist/chunk-index-qfgkfq86.js +2 -0
  68. package/dist/chunk-index-rh0x9rzf.js +2 -0
  69. package/dist/{chunk-index-m65cv329.js → chunk-index-sm7m4fej.js} +2 -2
  70. package/dist/chunk-index-sv9qpmhv.js +1 -0
  71. package/dist/chunk-index-t998yg8y.js +2 -0
  72. package/dist/{chunk-index-e90kztkx.js → chunk-index-tk4se135.js} +3 -3
  73. package/dist/chunk-index-v6smgw77.js +2 -0
  74. package/dist/chunk-index-w42rcbx1.js +2 -0
  75. package/dist/chunk-index-x4enmj72.js +2 -0
  76. package/dist/chunk-index-xq84gg8w.js +2 -0
  77. package/dist/{chunk-index-gt42wjby.js → chunk-index-xxeb2xp0.js} +3 -3
  78. package/dist/{chunk-index-hczrjnky.js → chunk-index-zyvwhxga.js} +1 -1
  79. package/dist/chunk-lang-css-y9133ktr.js +1 -0
  80. package/dist/{chunk-lang-dockerfile-tjxsnhr9.js → chunk-lang-dockerfile-cnwqn660.js} +1 -1
  81. package/dist/{chunk-lang-go-drmfa25k.js → chunk-lang-go-yy6kgsxv.js} +2 -2
  82. package/dist/chunk-lang-html-r2xmryek.js +1 -0
  83. package/dist/chunk-lang-javascript-1r6wd177.js +1 -0
  84. package/dist/{chunk-lang-json-790swysy.js → chunk-lang-json-dx56g11y.js} +1 -1
  85. package/dist/{chunk-lang-markdown-483dkxcq.js → chunk-lang-markdown-fpcf2dfq.js} +5 -5
  86. package/dist/{chunk-lang-python-v9s40bzj.js → chunk-lang-python-zzp95955.js} +2 -2
  87. package/dist/{chunk-lang-rust-z4gry1bf.js → chunk-lang-rust-214fh7sp.js} +1 -1
  88. package/dist/{chunk-lang-shell-egsvk8rj.js → chunk-lang-shell-1rpgtepw.js} +1 -1
  89. package/dist/{chunk-lang-sql-75j3denr.js → chunk-lang-sql-vvp46hpj.js} +2 -2
  90. package/dist/{chunk-lang-toml-7dbjvhex.js → chunk-lang-toml-tbj7467c.js} +1 -1
  91. package/dist/chunk-lang-typescript-y5w4tt4g.js +1 -0
  92. package/dist/{chunk-lang-xml-jg1sv4h2.js → chunk-lang-xml-tbcqmedk.js} +1 -1
  93. package/dist/{chunk-lang-yaml-g3v7s5je.js → chunk-lang-yaml-jh56t3sv.js} +1 -1
  94. package/dist/chunk-layout-actions-y73mpsh1.js +1 -0
  95. package/dist/chunk-menu-items-bza16bw6.js +2 -0
  96. package/dist/chunk-mode-toggle-nj9gnt3b.js +1 -0
  97. package/dist/chunk-note-row-6fmhrdng.js +75 -0
  98. package/dist/chunk-notes-wv0e6ssf.js +1 -0
  99. package/dist/{chunk-notice-bell-jehad6sx.js → chunk-notice-bell-9z27epd2.js} +1 -1
  100. package/dist/{chunk-notices-prqkv7ge.js → chunk-notices-fte9f196.js} +1 -1
  101. package/dist/chunk-onboarding-c5twahc3.js +1 -0
  102. package/dist/{chunk-overview-2j1s6kqg.js → chunk-overview-k4ccprax.js} +1 -1
  103. package/dist/{chunk-palette-4qt6ewem.js → chunk-palette-9rbp2fab.js} +1 -1
  104. package/dist/chunk-placement-items-me598wsb.js +1 -0
  105. package/dist/{chunk-profile-pfzyc04p.js → chunk-profile-s7r7fcvz.js} +1 -1
  106. package/dist/{chunk-prompt-history-2bcp2rky.js → chunk-prompt-history-hf296e7v.js} +1 -1
  107. package/dist/chunk-prompts-c8s0nhkm.js +1 -0
  108. package/dist/chunk-room-confirms-ga2sbvhc.js +1 -0
  109. package/dist/chunk-room-menu-7h4jym2b.js +1 -0
  110. package/dist/chunk-rooms-menu-button-pgtaanb6.js +1 -0
  111. package/dist/{chunk-schedules-64h9gfwn.js → chunk-schedules-mbnwcxpc.js} +1 -1
  112. package/dist/{chunk-seat-menu-vrpc40v9.js → chunk-seat-menu-r0k0eawr.js} +1 -1
  113. package/dist/chunk-sheet-hosts-a5dfevy9.js +1 -0
  114. package/dist/{chunk-shortcut-help-bdbkdcs9.js → chunk-shortcut-help-a6pkjcq7.js} +2 -2
  115. package/dist/{chunk-shortcuts-qft33r8t.js → chunk-shortcuts-cgt87jkz.js} +1 -1
  116. package/dist/chunk-skill-editor-67yk4x7t.js +8 -0
  117. package/dist/chunk-skills-rewemey4.js +1 -0
  118. package/dist/chunk-switcher-list-t8rbay2y.js +1 -0
  119. package/dist/{chunk-tab-dot-1p68ybf8.js → chunk-tab-dot-vr11dfrw.js} +1 -1
  120. package/dist/chunk-table-52nh0azk.js +1 -0
  121. package/dist/chunk-table2d-g57vr6h0.js +1 -0
  122. package/dist/chunk-table3d-rp0w6kt4.js +4220 -0
  123. package/dist/chunk-thread-actions-qcxt1y1g.js +1 -0
  124. package/dist/{chunk-thread-cards-t794fp4d.js → chunk-thread-cards-c2mrp2gj.js} +1 -1
  125. package/dist/chunk-thread-list-0071q455.js +217 -0
  126. package/dist/{chunk-transcript-km4e3aey.js → chunk-transcript-789yqysq.js} +1 -1
  127. package/dist/chunk-where-hmwmme9e.js +1 -0
  128. package/dist/{chunk-workspace-d064v56e.js → chunk-workspace-wr1qrtsh.js} +2 -2
  129. package/dist/chunk-zh-tw-z5p5mpph.js +1 -0
  130. package/dist/index.html +1 -1
  131. package/dist/sw.js +1 -1
  132. package/package.json +3 -3
  133. package/src/api-types.ts +51 -0
  134. package/src/app/app.ts +38 -4
  135. package/src/app/helper-routes.ts +106 -0
  136. package/src/app/rooms.ts +18 -3
  137. package/src/app/routes.ts +20 -0
  138. package/src/app/surface.ts +18 -1
  139. package/src/app/team-routes.ts +21 -1
  140. package/src/i18n/zh-tw.ts +46 -9
  141. package/dist/chunk-account-hck7mhf8.js +0 -1
  142. package/dist/chunk-action-menu-beqh40k6.js +0 -1
  143. package/dist/chunk-agent-znnth24t.js +0 -1
  144. package/dist/chunk-arranged-rooms-wfakrddk.js +0 -1
  145. package/dist/chunk-bulk-actions-c4tkvk9g.js +0 -1
  146. package/dist/chunk-character-creator-qwcsdytw.js +0 -1
  147. package/dist/chunk-confirm-z95j9jt3.js +0 -1
  148. package/dist/chunk-entry-hrt97qed.js +0 -1
  149. package/dist/chunk-folder-list-nemtqbnc.js +0 -1
  150. package/dist/chunk-folds-xpg9qcwf.js +0 -1
  151. package/dist/chunk-group-scene-g24kxz6f.js +0 -1
  152. package/dist/chunk-group-table-851jm8ef.js +0 -1
  153. package/dist/chunk-host-icons-23zhqpmc.js +0 -1
  154. package/dist/chunk-host-picture-8tnh2wam.js +0 -1
  155. package/dist/chunk-host-state-j41sp065.js +0 -1
  156. package/dist/chunk-host-ui-cje7a9t9.js +0 -1
  157. package/dist/chunk-index-3k7sdph2.js +0 -1
  158. package/dist/chunk-index-4jf4jvfd.css +0 -1
  159. package/dist/chunk-index-4s1qj9we.js +0 -2
  160. package/dist/chunk-index-5fz5e1ct.js +0 -2
  161. package/dist/chunk-index-azrnzgev.js +0 -2
  162. package/dist/chunk-index-c2ag3qw2.js +0 -2
  163. package/dist/chunk-index-efgm0066.js +0 -2
  164. package/dist/chunk-index-fe0m5mht.js +0 -2
  165. package/dist/chunk-index-hrtyanda.js +0 -2
  166. package/dist/chunk-index-j479p62w.js +0 -2
  167. package/dist/chunk-index-kankja6p.js +0 -50
  168. package/dist/chunk-index-kb44jp50.js +0 -2
  169. package/dist/chunk-index-mnwdbb4n.js +0 -2
  170. package/dist/chunk-index-n6zrc05a.js +0 -2
  171. package/dist/chunk-index-n93wqszt.js +0 -8
  172. package/dist/chunk-index-nrexxkar.js +0 -2
  173. package/dist/chunk-index-pgxgq61x.js +0 -2
  174. package/dist/chunk-index-q5vzjqr5.js +0 -2
  175. package/dist/chunk-index-qqwk157d.js +0 -2
  176. package/dist/chunk-index-r3tqhew8.js +0 -2
  177. package/dist/chunk-index-rg9vh59e.js +0 -1
  178. package/dist/chunk-index-sxq69p1f.js +0 -2
  179. package/dist/chunk-index-taq2psr6.js +0 -2
  180. package/dist/chunk-index-wc83vb0a.js +0 -2
  181. package/dist/chunk-index-xbs8q4kn.js +0 -2
  182. package/dist/chunk-index-xxbveevc.js +0 -2
  183. package/dist/chunk-index-zx6yka30.js +0 -2
  184. package/dist/chunk-lang-css-yrc25qk9.js +0 -1
  185. package/dist/chunk-lang-html-rwe8epvf.js +0 -1
  186. package/dist/chunk-lang-javascript-d6x6qjtg.js +0 -1
  187. package/dist/chunk-lang-typescript-1rv9vdcz.js +0 -1
  188. package/dist/chunk-layout-actions-6assr93n.js +0 -1
  189. package/dist/chunk-menu-items-9szcza00.js +0 -2
  190. package/dist/chunk-mode-toggle-bzbq7ycq.js +0 -1
  191. package/dist/chunk-note-row-g20h11pm.js +0 -75
  192. package/dist/chunk-notes-gc8bssxn.js +0 -1
  193. package/dist/chunk-onboarding-mdtc2mb7.js +0 -1
  194. package/dist/chunk-placement-items-2eect825.js +0 -1
  195. package/dist/chunk-prompts-052mb05y.js +0 -1
  196. package/dist/chunk-room-confirms-asvmjh5s.js +0 -1
  197. package/dist/chunk-room-menu-dm2r2hk6.js +0 -1
  198. package/dist/chunk-rooms-menu-button-32hemzxc.js +0 -1
  199. package/dist/chunk-sheet-hosts-jaqx490x.js +0 -1
  200. package/dist/chunk-skill-editor-z3dx2895.js +0 -8
  201. package/dist/chunk-skills-4jfcv39n.js +0 -1
  202. package/dist/chunk-switcher-list-xysjd4tw.js +0 -1
  203. package/dist/chunk-table-0v4q4dx3.js +0 -1
  204. package/dist/chunk-table-seats-f683hx8k.js +0 -1
  205. package/dist/chunk-table2d-1a6atjhj.js +0 -1
  206. package/dist/chunk-table3d-k0ffeffj.js +0 -4220
  207. package/dist/chunk-thread-actions-4rpfg4fq.js +0 -1
  208. package/dist/chunk-thread-list-1pcygpka.js +0 -1
  209. package/dist/chunk-where-phjwqggy.js +0 -1
  210. package/dist/chunk-zh-tw-qf18hcxc.js +0 -1
@@ -1 +1 @@
1
- import{X,s,a,r,t,c,g,e,n,o,O,u,w,m,P,qi}from"./chunk-index-kankja6p.js";import{K}from"./chunk-index-3wbyq10m.js";import"./chunk-index-0q15ysrb.js";import"./chunk-index-47yspxa4.js";import{ce}from"./chunk-index-c2ag3qw2.js";var T=3000;function B({profile:i}){return n("div",{className:"who",children:[i.picture?e("img",{className:"who-picture",src:`api/people/${encodeURIComponent(i.principal)}/picture`,alt:""}):e("span",{className:"who-initial","aria-hidden":"true",children:Array.from(i.name)[0]??"?"}),n("div",{className:"stack",children:[e("strong",{children:i.name}),i.tier?n("span",{className:"meta",children:[e(o,{name:"shield",size:14})," ",t(F[i.tier])]}):null]})]})}function R({link:i,labels:C,changed:d}){let[l,p]=r(),[f,k]=r(!1),[L,V]=r(),[y,b]=r(!1),N=i.pending!==void 0||l!==void 0,q=a(void 0);s(()=>{if(!N||i.linked)return;return q.current=setInterval(()=>{ce.links().then((v)=>{let I=v.links.find((A)=>A.provider===i.provider);if(I)d(I)},()=>{return})},T),()=>clearInterval(q.current)},[N,i.linked,i.provider,d]);let S=async(v)=>{k(!0),V(void 0);try{await v()}catch(I){V(u(I))}finally{k(!1)}},h=i.blockedBy.length>0;return n("li",{className:"card stack",children:[n("div",{className:"card-head",children:[e("strong",{children:i.label}),i.linked?n("span",{className:"meta",children:[e(o,{name:"check",size:14})," ",t("Linked"),i.linked.displayName?` · ${i.linked.displayName}`:""]}):i.step==="required"?e(P,{tone:"warn",children:t("Required")}):i.step==="nudge"?e(P,{children:t("Recommended")}):null]}),L?e(m,{message:L}):null,i.linked?i.linked.locked?e("p",{className:"meta",children:t("The server's configuration links this account.")}):n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:f,onClick:()=>b(!0),children:t("Unlink")}),e(K,{open:y,title:t("Unlink {name}?",{name:i.label}),confirmLabel:t("Unlink"),tone:"danger",onClose:()=>b(!1),onConfirm:async()=>{d(await ce.unlink(i.provider)),p(void 0)},children:e("p",{children:t("The app will no longer know this account is yours. You can link it again later.")})})]}):N?n("div",{className:"stack",children:[l?n(g,{children:[e("p",{children:l.instructions}),e("p",{className:"meta",children:t("Your code")}),e("code",{className:"link-code",children:l.code}),e("p",{className:"meta",children:t("The code works until {time}.",{time:new Date(l.expiresAt).toLocaleTimeString()})})]}):e("p",{className:"meta",children:t("A code is waiting to be used.")}),i.pending?.redeemedBy?n("p",{children:[e(o,{name:"check",size:14})," ",t("{name} used the code. Confirm that this is you.",{name:i.pending.redeemedBy.displayName})]}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:f,onClick:()=>S(async()=>{d(await ce.cancelLink(i.provider)),p(void 0)}),children:t("Cancel")}),e("button",{type:"button",disabled:f,onClick:()=>S(async()=>{let v=l?.request??i.pending?.request;if(!v)return;d(await ce.confirmLink(i.provider,v)),p(void 0)}),children:t("I did it")})]})]}):n("div",{className:"stack",children:[h?e("p",{className:"meta",children:t("Link {name} first.",{name:i.blockedBy.map((v)=>C[v]??v).join(", ")})}):null,e("div",{className:"actions",children:e("button",{type:"button",disabled:f||h,onClick:()=>S(async()=>{p(await ce.issueLink(i.provider)),d((await ce.links()).links.find((v)=>v.provider===i.provider)??i)}),children:t("Link")})})]})]})}function E(){let i=Intl.DateTimeFormat().resolvedOptions().timeZone,[C,d]=r(),[l,p]=r({start:"22:00",end:"07:00"}),[f,k]=r(!1),[L,V]=r(!1),[y,b]=r(),[N,q]=r();s(()=>{ce.pushPrefs().then((h)=>{if(d(h.quiet),h.quiet)p(h.quiet);k(!0)},()=>k(!0))},[]);let S=async(h)=>{V(!0),q(void 0),b(void 0);try{await h()}catch(v){q(u(v))}finally{V(!1)}};if(!f)return null;return n("section",{className:"card stack",children:[e("h2",{children:t("Notifications")}),e("p",{className:"meta",children:t("In your quiet hours a normal notice waits in the bell instead of ringing your phone. An urgent one still rings.")}),n("div",{className:"quiet-row",children:[n("label",{children:[t("From")," ",e("input",{type:"time",value:l.start,onChange:(h)=>p({...l,start:h.target.value})})]}),n("label",{children:[t("To")," ",e("input",{type:"time",value:l.end,onChange:(h)=>p({...l,end:h.target.value})})]}),e("span",{className:"meta",children:i})]}),N?e(m,{message:N}):null,y?e("p",{className:"meta",children:y}):null,n("div",{className:"actions",children:[C?e("button",{type:"button",className:"secondary",disabled:L,onClick:()=>S(async()=>{await ce.setPushPrefs(null),d(void 0)}),children:t("Turn off quiet hours")}):null,e("button",{type:"button",className:"secondary",disabled:L,onClick:()=>S(async()=>{await ce.pushTest(),b(t("A test notification is on its way."))}),children:t("Send a test notification")}),e("button",{type:"button",disabled:L||l.start===l.end,onClick:()=>S(async()=>{let h=await ce.setPushPrefs({...l,timeZone:i});d(h.quiet)}),children:t("Save")})]})]})}function z({profile:i,changed:C}){let[d,l]=r();if(i.sources.length===0)return null;let p=async(f)=>{l(void 0);try{C(await ce.chooseSource(f))}catch(k){l(u(k))}};return n("section",{className:"card stack",children:[e("h2",{children:t("Shown as")}),e("p",{className:"meta",children:t("The name and picture of this account are what others see in the app.")}),n("fieldset",{className:"choice",children:[e("legend",{className:"visually-hidden",children:t("Shown as")}),n("label",{children:[e("input",{type:"radio",name:"shown-as",checked:i.source===void 0,onChange:()=>p(null)}),t("Automatic")]}),i.sources.map((f)=>n("label",{children:[e("input",{type:"radio",name:"shown-as",checked:i.source===f.provider,onChange:()=>p(f.provider)}),t(f.label)]},f.provider))]}),d?e(m,{message:d}):null]})}function W(){let[i,C]=r(),[d,l]=r(),[p,f]=r(),[k,L]=r();s(()=>{O.session().then(C,(y)=>L(u(y))),ce.profile().then(l,()=>{return}),ce.links().then(f,()=>{return})},[]);let V=X((y)=>{f((b)=>b?{links:b.links.map((N)=>N.provider===y.provider?y:N)}:b),ce.profile().then(l,()=>{return})},[]);if(k)return e(m,{message:k});if(!i)return e(w,{});return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Profile")})}),n("section",{className:"card stack",children:[e("h2",{children:t("Account")}),d?e(B,{profile:d}):e("p",{className:"meta",children:t("Signed in as {name}.",{name:i.principal.name})}),e(qi,{auth:i.auth})]}),p&&p.links.length>0?n("section",{className:"stack",children:[e("h2",{children:t("Your accounts")}),e("ul",{className:"stack notices",children:p.links.map((y)=>e(R,{link:y,labels:Object.fromEntries(p.links.map((b)=>[b.provider,b.label])),changed:V},y.provider))})]}):null,d?e(z,{profile:d,changed:l}):null,i.push?e(E,{}):null]})}var F={owner:c("Owner"),admin:c("Admin"),member:c("Member")};export{W as ProfilePage};
1
+ import{X,s,a,r,t,c,m,e,n,o,O,d,w,g,P,ji}from"./chunk-index-2e4am3hw.js";import{K}from"./chunk-index-jgzygbt8.js";import"./chunk-index-0q15ysrb.js";import"./chunk-index-8d81qy69.js";import{de}from"./chunk-index-msqhgvfx.js";var T=3000;function B({profile:i}){return n("div",{className:"who",children:[i.picture?e("img",{className:"who-picture",src:`api/people/${encodeURIComponent(i.principal)}/picture`,alt:""}):e("span",{className:"who-initial","aria-hidden":"true",children:Array.from(i.name)[0]??"?"}),n("div",{className:"stack",children:[e("strong",{children:i.name}),i.tier?n("span",{className:"meta",children:[e(o,{name:"shield",size:14})," ",t(F[i.tier])]}):null]})]})}function R({link:i,labels:C,changed:u}){let[l,p]=r(),[f,k]=r(!1),[L,V]=r(),[y,b]=r(!1),N=i.pending!==void 0||l!==void 0,q=a(void 0);s(()=>{if(!N||i.linked)return;return q.current=setInterval(()=>{de.links().then((v)=>{let I=v.links.find((A)=>A.provider===i.provider);if(I)u(I)},()=>{return})},T),()=>clearInterval(q.current)},[N,i.linked,i.provider,u]);let S=async(v)=>{k(!0),V(void 0);try{await v()}catch(I){V(d(I))}finally{k(!1)}},h=i.blockedBy.length>0;return n("li",{className:"card stack",children:[n("div",{className:"card-head",children:[e("strong",{children:i.label}),i.linked?n("span",{className:"meta",children:[e(o,{name:"check",size:14})," ",t("Linked"),i.linked.displayName?` · ${i.linked.displayName}`:""]}):i.step==="required"?e(P,{tone:"warn",children:t("Required")}):i.step==="nudge"?e(P,{children:t("Recommended")}):null]}),L?e(g,{message:L}):null,i.linked?i.linked.locked?e("p",{className:"meta",children:t("The server's configuration links this account.")}):n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:f,onClick:()=>b(!0),children:t("Unlink")}),e(K,{open:y,title:t("Unlink {name}?",{name:i.label}),confirmLabel:t("Unlink"),tone:"danger",onClose:()=>b(!1),onConfirm:async()=>{u(await de.unlink(i.provider)),p(void 0)},children:e("p",{children:t("The app will no longer know this account is yours. You can link it again later.")})})]}):N?n("div",{className:"stack",children:[l?n(m,{children:[e("p",{children:l.instructions}),e("p",{className:"meta",children:t("Your code")}),e("code",{className:"link-code",children:l.code}),e("p",{className:"meta",children:t("The code works until {time}.",{time:new Date(l.expiresAt).toLocaleTimeString()})})]}):e("p",{className:"meta",children:t("A code is waiting to be used.")}),i.pending?.redeemedBy?n("p",{children:[e(o,{name:"check",size:14})," ",t("{name} used the code. Confirm that this is you.",{name:i.pending.redeemedBy.displayName})]}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:f,onClick:()=>S(async()=>{u(await de.cancelLink(i.provider)),p(void 0)}),children:t("Cancel")}),e("button",{type:"button",disabled:f,onClick:()=>S(async()=>{let v=l?.request??i.pending?.request;if(!v)return;u(await de.confirmLink(i.provider,v)),p(void 0)}),children:t("I did it")})]})]}):n("div",{className:"stack",children:[h?e("p",{className:"meta",children:t("Link {name} first.",{name:i.blockedBy.map((v)=>C[v]??v).join(", ")})}):null,e("div",{className:"actions",children:e("button",{type:"button",disabled:f||h,onClick:()=>S(async()=>{p(await de.issueLink(i.provider)),u((await de.links()).links.find((v)=>v.provider===i.provider)??i)}),children:t("Link")})})]})]})}function E(){let i=Intl.DateTimeFormat().resolvedOptions().timeZone,[C,u]=r(),[l,p]=r({start:"22:00",end:"07:00"}),[f,k]=r(!1),[L,V]=r(!1),[y,b]=r(),[N,q]=r();s(()=>{de.pushPrefs().then((h)=>{if(u(h.quiet),h.quiet)p(h.quiet);k(!0)},()=>k(!0))},[]);let S=async(h)=>{V(!0),q(void 0),b(void 0);try{await h()}catch(v){q(d(v))}finally{V(!1)}};if(!f)return null;return n("section",{className:"card stack",children:[e("h2",{children:t("Notifications")}),e("p",{className:"meta",children:t("In your quiet hours a normal notice waits in the bell instead of ringing your phone. An urgent one still rings.")}),n("div",{className:"quiet-row",children:[n("label",{children:[t("From")," ",e("input",{type:"time",value:l.start,onChange:(h)=>p({...l,start:h.target.value})})]}),n("label",{children:[t("To")," ",e("input",{type:"time",value:l.end,onChange:(h)=>p({...l,end:h.target.value})})]}),e("span",{className:"meta",children:i})]}),N?e(g,{message:N}):null,y?e("p",{className:"meta",children:y}):null,n("div",{className:"actions",children:[C?e("button",{type:"button",className:"secondary",disabled:L,onClick:()=>S(async()=>{await de.setPushPrefs(null),u(void 0)}),children:t("Turn off quiet hours")}):null,e("button",{type:"button",className:"secondary",disabled:L,onClick:()=>S(async()=>{await de.pushTest(),b(t("A test notification is on its way."))}),children:t("Send a test notification")}),e("button",{type:"button",disabled:L||l.start===l.end,onClick:()=>S(async()=>{let h=await de.setPushPrefs({...l,timeZone:i});u(h.quiet)}),children:t("Save")})]})]})}function z({profile:i,changed:C}){let[u,l]=r();if(i.sources.length===0)return null;let p=async(f)=>{l(void 0);try{C(await de.chooseSource(f))}catch(k){l(d(k))}};return n("section",{className:"card stack",children:[e("h2",{children:t("Shown as")}),e("p",{className:"meta",children:t("The name and picture of this account are what others see in the app.")}),n("fieldset",{className:"choice",children:[e("legend",{className:"visually-hidden",children:t("Shown as")}),n("label",{children:[e("input",{type:"radio",name:"shown-as",checked:i.source===void 0,onChange:()=>p(null)}),t("Automatic")]}),i.sources.map((f)=>n("label",{children:[e("input",{type:"radio",name:"shown-as",checked:i.source===f.provider,onChange:()=>p(f.provider)}),t(f.label)]},f.provider))]}),u?e(g,{message:u}):null]})}function W(){let[i,C]=r(),[u,l]=r(),[p,f]=r(),[k,L]=r();s(()=>{O.session().then(C,(y)=>L(d(y))),de.profile().then(l,()=>{return}),de.links().then(f,()=>{return})},[]);let V=X((y)=>{f((b)=>b?{links:b.links.map((N)=>N.provider===y.provider?y:N)}:b),de.profile().then(l,()=>{return})},[]);if(k)return e(g,{message:k});if(!i)return e(w,{});return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Profile")})}),n("section",{className:"card stack",children:[e("h2",{children:t("Account")}),u?e(B,{profile:u}):e("p",{className:"meta",children:t("Signed in as {name}.",{name:i.principal.name})}),e(ji,{auth:i.auth})]}),p&&p.links.length>0?n("section",{className:"stack",children:[e("h2",{children:t("Your accounts")}),e("ul",{className:"stack notices",children:p.links.map((y)=>e(R,{link:y,labels:Object.fromEntries(p.links.map((b)=>[b.provider,b.label])),changed:V},y.provider))})]}):null,u?e(z,{profile:u,changed:l}):null,i.push?e(E,{}):null]})}var F={owner:c("Owner"),admin:c("Admin"),member:c("Member")};export{W as ProfilePage};
@@ -1 +1 @@
1
- import{s,r,t,e,n,u,w,m,k,P,_,ie}from"./chunk-index-kankja6p.js";import{ht}from"./chunk-index-e90kztkx.js";import{L}from"./chunk-index-47yspxa4.js";function T(a){let{open:c,load:v}=a,{timeZone:y}=_(),[i,p]=r(),[d,g]=r(),[h,b]=r();s(()=>{if(!c)return;let o=!0;return p(void 0),g(void 0),b(void 0),v().then((f)=>o&&p(f),(f)=>o&&g(u(f))),()=>{o=!1}},[c]);let l=i?.find((o)=>o.id===h);return e(L,{open:c,title:a.title,size:"wide",onClose:a.onClose,children:n("div",{className:"stack history",children:[d?e(m,{message:d}):null,!i&&!d?e(w,{}):null,i?.length===0?e(k,{children:t("No changes have been kept yet.")}):null,i&&i.length>0?e("ul",{className:"menu",children:i.map((o)=>e("li",{children:n("button",{type:"button",className:"menu-item","aria-pressed":o.id===h,onClick:()=>b(o.id),children:[n("span",{className:"menu-text",children:[e("strong",{children:o.by}),e("span",{className:"meta",children:ie(o.at,y)})]}),o.revert?e(P,{children:t("Back to the file version")}):null]})},o.id))}):null,l?n("section",{className:"stack","aria-label":t("This change"),children:[e(ht,{label:t("This change"),before:l.previous,after:l.text}),e("p",{className:"meta",children:t("It goes into the editor, where you read it over and save it to put it in force.")}),e("div",{className:"actions",children:e("button",{type:"button",onClick:()=>a.onUse(l.text),children:t("Use this text")})})]}):null]})})}export{T as HistorySheet};
1
+ import{s,r,t,e,n,d,w,g,_,P,k,re}from"./chunk-index-2e4am3hw.js";import{mt}from"./chunk-index-tk4se135.js";import{L}from"./chunk-index-8d81qy69.js";function T(a){let{open:m,load:v}=a,{timeZone:y}=k(),[i,f]=r(),[u,p]=r(),[h,b]=r();s(()=>{if(!m)return;let o=!0;return f(void 0),p(void 0),b(void 0),v().then((c)=>o&&f(c),(c)=>o&&p(d(c))),()=>{o=!1}},[m]);let l=i?.find((o)=>o.id===h);return e(L,{open:m,title:a.title,size:"wide",onClose:a.onClose,children:n("div",{className:"stack history",children:[u?e(g,{message:u}):null,!i&&!u?e(w,{}):null,i?.length===0?e(_,{children:t("No changes have been kept yet.")}):null,i&&i.length>0?e("ul",{className:"menu",children:i.map((o)=>e("li",{children:n("button",{type:"button",className:"menu-item","aria-pressed":o.id===h,onClick:()=>b(o.id),children:[n("span",{className:"menu-text",children:[e("strong",{children:o.by}),e("span",{className:"meta",children:re(o.at,y)})]}),o.revert?e(P,{children:t("Back to the file version")}):null]})},o.id))}):null,l?n("section",{className:"stack","aria-label":t("This change"),children:[e(mt,{label:t("This change"),before:l.previous,after:l.text}),e("p",{className:"meta",children:t("It goes into the editor, where you read it over and save it to put it in force.")}),e("div",{className:"actions",children:e("button",{type:"button",onClick:()=>a.onUse(l.text),children:t("Use this text")})})]}):null]})})}export{T as HistorySheet};
@@ -0,0 +1 @@
1
+ import{h,Q,S,X,s,N,r,t,c,m,e,n,o,ce,d,f,w,g,_,P,k,re}from"./chunk-index-2e4am3hw.js";import{Ne,mt}from"./chunk-index-tk4se135.js";import{L}from"./chunk-index-8d81qy69.js";var G={"Shared prompt":c("Shared prompt"),"Guest prompt":c("Guest prompt"),"The base every knight's prompt starts with, the main knight's included.":c("The base every knight's prompt starts with, the main knight's included."),"Used instead of the shared prompt when the person speaking is not the owner.":c("Used instead of the shared prompt when the person speaking is not the owner.")},C=(l)=>t(G[l]??l);var M=S(()=>(h("hf296e7v"),import("./chunk-prompt-history-hf296e7v.js")).then((l)=>({default:l.HistorySheet}))),O=S(()=>(h("g76v5d9r"),import("./chunk-confirm-g76v5d9r.js")).then((l)=>({default:l.Confirm})));function pe(){let{timeZone:l}=k(),[R,i]=r(),[u,y]=r(),[v,x]=r(),E=X(()=>{Ne.prompts().then((p)=>i(p.documents),(p)=>y(d(p)))},[]);return s(E,[E]),n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Main prompts")})}),e("p",{className:"hint",children:t("The texts the main knight and the other knights start from. A text you save here replaces the one from the file from the next turn on, until you go back to the file's.")}),u?e(g,{message:u}):null,!R&&!u?e(w,{}):null,R?.length===0?e(_,{children:t("No prompts to edit.")}):null,R?.map((p)=>n("article",{className:"card stack",children:[n("div",{className:"card-head",children:[e("strong",{children:C(p.label)}),p.differs?e(P,{tone:"warn",children:t("Differs from the file version")}):null,p.broken?e(P,{tone:"warn",children:t("File version cannot be read")}):null]}),p.description?e("p",{children:C(p.description)}):null,p.override?e("p",{className:"hint",children:t("Set by {name}, {time}",{name:p.override.by,time:re(p.override.at,l)})}):null,e("div",{className:"actions",children:e("button",{type:"button",onClick:()=>x(p.id),children:t("Edit")})})]},p.id)),v?e(Z,{id:v,onClose:()=>{x(void 0),E()}}):null]})}function Z({id:l,onClose:R}){let[i,u]=r(),[y,v]=r(""),[x,E]=r(),[p,T]=r(!1),[B,D]=r(!1),[V,H]=r(!1),[F,z]=r(!1),A=N();s(()=>{let a=!0;return Ne.prompt(l).then((b)=>{if(!a)return;u(b),v(b.text)},(b)=>a&&E(d(b))),()=>{a=!1}},[l]);let I=async()=>{if(!i)return;D(!0);try{let a=await Ne.savePrompt(l,{text:y,base:i.text});u(a),v(a.text),T(!1),f(t("Saved."))}catch(a){if(a instanceof ce&&a.status===409){let{current:b}=a.body;u(b),f(a.message,"danger")}else f(d(a),"danger")}finally{D(!1)}},U=i!==void 0&&y!==i.text;return n(L,{open:!0,title:i?C(i.label):t("Main prompts"),size:"full",onClose:R,children:[x?e(g,{message:x}):null,!i&&!x?e(w,{}):null,i?.broken?e(g,{message:t("The file version of this prompt cannot be read, so it cannot be changed here until it can: {reason}",{reason:i.broken})}):null,i&&!i.broken?n("div",{className:"stack",children:[i.differs?e("p",{className:"hint",children:e(P,{tone:"warn",children:t("Differs from the file version")})}):null,p?n("section",{className:"stack review","aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),e(mt,{label:t("Prompt"),before:i.text,after:y}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:B,onClick:()=>T(!1),children:t("Back to editing")}),e("button",{type:"button",disabled:B,onClick:I,children:B?t("Saving…"):t("Save")})]})]}):n(m,{children:[n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:A,children:t("Prompt")}),e("span",{className:"field-tools",children:n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>H(!0),children:[e(o,{name:"reset",size:16}),t("History")]})})]}),e("textarea",{id:A,className:"prompt-full",value:y,maxLength:i.maxChars,onChange:(a)=>v(a.target.value)})]}),n("div",{className:"actions",children:[i.override?e("button",{type:"button",className:"secondary",onClick:()=>z(!0),children:t("Revert to the file version")}):null,e("button",{type:"button",disabled:!U||!y.trim(),onClick:()=>T(!0),children:t("Review changes")})]})]}),V?e(Q,{fallback:null,children:e(M,{open:V,title:t("History of {name}",{name:C(i.label)}),load:async()=>(await Ne.promptHistory(l)).versions.map((a)=>({id:a.id,text:a.text,previous:a.previous,by:a.by,at:a.at,revert:a.action==="revert"})),onUse:(a)=>{v(a),T(!1),H(!1)},onClose:()=>H(!1)})}):null,F?e(Q,{fallback:null,children:e(O,{open:F,title:t("Revert {name} to the file version?",{name:C(i.label)}),confirmLabel:t("Revert to the file version"),tone:"danger",onConfirm:async()=>{try{let a=await Ne.revertPrompt(l,{base:i.text});u(a),v(a.text),T(!1),f(t("Back to the file version."))}catch(a){if(!(a instanceof ce&&a.status===409))throw a;let{current:b}=a.body;u(b),f(a.message,"danger")}},onClose:()=>z(!1),children:e("p",{children:t("The text you saved is dropped and the text from the file applies from the next turn. It stays in the history, so you can bring it back.")})})}):null]}):null]})}export{pe as PromptsPage};
@@ -0,0 +1 @@
1
+ import{lr}from"./chunk-index-aamhjg5n.js";import"./chunk-index-v6smgw77.js";import"./chunk-index-jgzygbt8.js";import"./chunk-index-8d81qy69.js";import"./chunk-index-pyfx77cj.js";import"./chunk-index-j4kk1m59.js";import"./chunk-index-cdctnw71.js";import"./chunk-index-e2dqjde8.js";import"./chunk-index-j0m16cj1.js";import"./chunk-index-g1awv7rk.js";export{lr as RoomConfirmHost};
@@ -0,0 +1 @@
1
+ import{h,r,t,m,e,n,o,v,u,k,rt,Et,Re,wt}from"./chunk-index-2e4am3hw.js";import{Ce}from"./chunk-index-j4kk1m59.js";import"./chunk-index-e2dqjde8.js";import{qt}from"./chunk-index-2fdns8tn.js";import{L}from"./chunk-index-8d81qy69.js";import{Jt}from"./chunk-index-92zgb7my.js";var p="room-menu-yolo",N="room-menu-long",f="room-menu-mute";function T(a){let[i,l]=r(!1),c=k().app?.modes!==!1,b=u((s)=>s.rooms[a.room]?.view?.home===!1,a.room),d=u((s)=>s.pins.includes(a.room),a.room),g=a.mode??{yolo:!1,longRunning:!1},y=async(s)=>{l(!0),await Et(a.room,{longRunning:s}),l(!1)};return e(L,{open:a.open,title:t("Room menu"),onClose:a.onClose,children:n("ul",{className:"menu",children:[a.readOnly?e("li",{children:a.parent?n("a",{className:"menu-item menu-link",href:v("room",a.parent),onClick:a.onClose,children:[e("span",{className:"menu-icon",children:e(o,{name:"rooms"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Open the parent room")}),e("span",{className:"meta",children:t("Reply to the knight that started this thread.")})]}),e(o,{name:"chevron",size:16})]}):e("p",{className:"meta",children:t("A thread has no settings.")})}):null,a.readOnly?null:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:f,children:[e("span",{className:"menu-icon",children:e(o,{name:a.muted?"bell-off":"bell"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Notifications")}),e("span",{className:"meta",children:t("Push this room's posts to every owner's devices. A card that waits for you is always pushed.")})]}),e(qt,{id:f,checked:!a.muted,label:t("Notifications"),onChange:async(s)=>{l(!0),await Jt(a.room,!s),l(!1)},busy:i})]})}),a.readOnly||!c?null:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:p,children:[e("span",{className:"menu-icon","data-tone":"yolo",children:e(o,{name:"bolt"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Yolo mode")}),e("span",{className:"meta",children:t("Approve held actions in this room without asking. Risky ones still ask.")})]}),e(qt,{id:p,checked:g.yolo,label:t("Yolo mode"),onChange:(s)=>{if(s)a.onAskYolo();else l(!0),Et(a.room,{yolo:!1}).then(()=>l(!1))},busy:i})]})}),a.readOnly||!c?null:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:N,children:[e("span",{className:"menu-icon","data-tone":"long",children:e(o,{name:"timer"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Long-running mode")}),e("span",{className:"meta",children:t("Let turns go on past their time limit, up to the host's cap. Questions still wait for you.")})]}),e(qt,{id:N,checked:g.longRunning,label:t("Long-running mode"),onChange:y,busy:i})]})}),a.agent?e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),rt(a.agent)},children:[e("span",{className:"menu-icon",children:e(o,{name:"profile"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Edit knight")}),e("span",{className:"meta",children:t("Name, prompt, model and picture")})]}),e(o,{name:"chevron",size:16})]})}):null,a.group?e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),wt({kind:"group",name:a.group})},children:[e("span",{className:"menu-icon",children:e(o,{name:"profile"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Edit group")}),e("span",{className:"meta",children:t("Name, members and host")})]}),e(o,{name:"chevron",size:16})]})}):null,a.readOnly||!b?null:n(m,{children:[e("li",{children:n("button",{type:"button",className:"menu-item menu-link",onClick:()=>{a.onClose(),(h("y73mpsh1"),import("./chunk-layout-actions-y73mpsh1.js")).then((s)=>s.pinRoom(a.room,!d))},children:[e("span",{className:"menu-icon",children:e(o,{name:"pin"})}),n("span",{className:"menu-text",children:[e("strong",{children:d?t("Unpin"):t("Pin")}),e("span",{className:"meta",children:t("Keep this room at the top of the list.")})]})]})}),e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),Ce({kind:"move",room:a.room})},children:[e("span",{className:"menu-icon",children:e(o,{name:"folder"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Move to folder…")}),e("span",{className:"meta",children:t("Put this room in a folder, or take it out.")})]}),e(o,{name:"chevron",size:16})]})})]}),a.readOnly?null:e("li",{children:n("button",{type:"button",className:"menu-item menu-link",onClick:a.onAskStartOver,children:[e("span",{className:"menu-icon","data-tone":"danger",children:e(o,{name:"reset"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Start over")}),e("span",{className:"meta",children:t("Archive this conversation and begin a new one. Memory stays.")})]})]})}),a.readOnly||a.coordinator?null:e("li",{children:n("button",{type:"button",className:"menu-item menu-link",onClick:()=>{a.onClose(),Re({kind:"archive",room:a.room,name:a.displayName??""})},children:[e("span",{className:"menu-icon","data-tone":"danger",children:e(o,{name:"archive"})}),n("span",{className:"menu-text",children:[e("strong",{children:a.group?t("Archive group"):t("Archive knight")}),e("span",{className:"meta",children:t("It stops answering. The history is kept and it can be restored.")})]})]})})]})})}export{T as RoomMenu};
@@ -0,0 +1 @@
1
+ import{t,e,o,u}from"./chunk-index-2e4am3hw.js";import"./chunk-index-e2dqjde8.js";import"./chunk-index-kbrg32sx.js";import"./chunk-index-j4kk1m59.js";import{Jn}from"./chunk-index-pefwfm26.js";import"./chunk-index-b8cpvr7y.js";import"./chunk-index-rh0x9rzf.js";function n(){if(!u((r)=>r.listed))return null;return e("button",{type:"button",className:"header-button icon-button","aria-haspopup":"menu","aria-label":t("Folders and order"),onClick:(r)=>Jn(r.currentTarget),children:e(o,{name:"more",size:18})})}export{n as default};
@@ -1 +1 @@
1
- import{r,t,c,e,n,o,v,O,p,w,m,k,P,_,ie}from"./chunk-index-kankja6p.js";import{K}from"./chunk-index-3wbyq10m.js";import{ye}from"./chunk-index-wc83vb0a.js";import"./chunk-index-47yspxa4.js";var g={mon:c("Mon"),tue:c("Tue"),wed:c("Wed"),thu:c("Thu"),fri:c("Fri"),sat:c("Sat"),sun:c("Sun")};function h(d){if(typeof d!=="object"||d===null)return"";let i=d,s=typeof i.time==="string"?i.time:"";switch(i.kind){case"once":return t("Once on {date} at {time}",{date:String(i.date??""),time:s});case"every":return Number(i.everyDays)===1?t("Every day at {time}",{time:s}):t("Every {count} days at {time}",{count:Number(i.everyDays),time:s});case"weekly":{let l=Array.isArray(i.weekdays)?i.weekdays.map((u)=>t(g[String(u)]??String(u))).join(t(", ")):"";return t("{days} at {time}",{days:l,time:s})}default:return""}}function L(){let{timeZone:d}=_(),[i,s]=r(0),[l,u]=r(),{data:f,error:y}=ye(()=>O.schedules(),`schedules:${i}`);return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Schedules")})}),y?e(m,{message:y}):null,!f&&!y?e(w,{}):null,f&&f.schedules.length===0?e(k,{children:t("Nothing is scheduled. Ask a knight to remind you or to run something later.")}):null,e("ul",{className:"schedule-list",children:f?.schedules.map((a)=>n("li",{className:"card schedule",children:[n("div",{className:"schedule-main",children:[n("div",{className:"card-head",children:[e("strong",{children:a.title}),a.lastStatus?e(P,{children:a.lastStatus}):null]}),n("p",{className:"meta",children:[h(a.recurrence)," ·"," ",t("next {when}",{when:ie(a.nextRun,d)})]}),e("p",{className:"schedule-prompt",children:a.prompt}),n("p",{className:"meta",children:[a.room?e("a",{href:v("room",a.room),children:a.label}):a.label," ","· ",t("set by {name}",{name:a.createdBy})]})]}),e("button",{type:"button",className:"icon-button danger-icon","aria-label":t("Cancel {title}",{title:a.title}),onClick:()=>u(a),children:e(o,{name:"trash"})})]},a.id))}),e(K,{open:l!==void 0,title:t("Cancel this schedule?"),confirmLabel:t("Cancel schedule"),tone:"danger",onClose:()=>u(void 0),onConfirm:async()=>{if(!l)return;await O.cancelSchedule(l.id),s((a)=>a+1),p(t("Schedule cancelled."))},children:e("p",{children:t("“{title}” will not run again. Runs that already happened stay in the conversation.",{title:l?.title??""})})})]})}export{L as SchedulesPage};
1
+ import{r,t,c,e,n,o,v,O,f,w,g,_,P,k,re}from"./chunk-index-2e4am3hw.js";import{K}from"./chunk-index-jgzygbt8.js";import{be}from"./chunk-index-5bfqek1d.js";import"./chunk-index-8d81qy69.js";var y={mon:c("Mon"),tue:c("Tue"),wed:c("Wed"),thu:c("Thu"),fri:c("Fri"),sat:c("Sat"),sun:c("Sun")};function h(m){if(typeof m!=="object"||m===null)return"";let i=m,s=typeof i.time==="string"?i.time:"";switch(i.kind){case"once":return t("Once on {date} at {time}",{date:String(i.date??""),time:s});case"every":return Number(i.everyDays)===1?t("Every day at {time}",{time:s}):t("Every {count} days at {time}",{count:Number(i.everyDays),time:s});case"weekly":{let l=Array.isArray(i.weekdays)?i.weekdays.map((d)=>t(y[String(d)]??String(d))).join(t(", ")):"";return t("{days} at {time}",{days:l,time:s})}default:return""}}function L(){let{timeZone:m}=k(),[i,s]=r(0),[l,d]=r(),{data:u,error:p}=be(()=>O.schedules(),`schedules:${i}`);return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Schedules")})}),p?e(g,{message:p}):null,!u&&!p?e(w,{}):null,u&&u.schedules.length===0?e(_,{children:t("Nothing is scheduled. Ask a knight to remind you or to run something later.")}):null,e("ul",{className:"schedule-list",children:u?.schedules.map((a)=>n("li",{className:"card schedule",children:[n("div",{className:"schedule-main",children:[n("div",{className:"card-head",children:[e("strong",{children:a.title}),a.lastStatus?e(P,{children:a.lastStatus}):null]}),n("p",{className:"meta",children:[h(a.recurrence)," ·"," ",t("next {when}",{when:re(a.nextRun,m)})]}),e("p",{className:"schedule-prompt",children:a.prompt}),n("p",{className:"meta",children:[a.room?e("a",{href:v("room",a.room),children:a.label}):a.label," ","· ",t("set by {name}",{name:a.createdBy})]})]}),e("button",{type:"button",className:"icon-button danger-icon","aria-label":t("Cancel {title}",{title:a.title}),onClick:()=>d(a),children:e(o,{name:"trash"})})]},a.id))}),e(K,{open:l!==void 0,title:t("Cancel this schedule?"),confirmLabel:t("Cancel schedule"),tone:"danger",onClose:()=>d(void 0),onConfirm:async()=>{if(!l)return;await O.cancelSchedule(l.id),s((a)=>a+1),f(t("Schedule cancelled."))},children:e("p",{children:t("“{title}” will not run again. Runs that already happened stay in the conversation.",{title:l?.title??""})})})]})}export{L as SchedulesPage};
@@ -1 +1 @@
1
- import{hn}from"./chunk-index-kankja6p.js";function M(t,l,d,g){let r,a=-1,i=!1,f=(e)=>e instanceof Element?e.closest("button, [data-seat]")??t:t,o=()=>{r?.cancel(),r=void 0,a=-1},p=(e)=>{if(i=!1,e.pointerType==="mouse"||!e.isPrimary)return;o();let n=l(e.target,e.clientX,e.clientY);if(!n)return;let u=f(e.target);a=e.pointerId,r=new hn((s)=>{if(i=!0,typeof navigator.vibrate==="function")navigator.vibrate(10);d({...n,at:s,via:"hold",source:u})},g),r.begin(e.clientX,e.clientY)},m=(e)=>{if(e.pointerId===a&&r&&!i){if(!r.move(e.clientX,e.clientY))o()}},c=(e)=>{if(e.pointerId===a)o()},E=(e)=>{let n=l(e.target,e.clientX,e.clientY);if(!n)return;if(e.preventDefault(),i)return;o(),d({...n,at:{x:e.clientX,y:e.clientY},via:"contextmenu",source:f(e.target)})},v=(e)=>{if(i=!1,e.key!=="ContextMenu"&&!(e.key==="F10"&&e.shiftKey))return;let n=l(e.target,-1,-1);if(!n)return;e.preventDefault();let u=f(e.target),s=u.getBoundingClientRect();d({...n,at:{x:s.left+Math.min(s.width/2,48),y:s.top+24},via:"key",source:u})},L=(e)=>{if(!i)return;i=!1,e.preventDefault(),e.stopPropagation()};return t.addEventListener("pointerdown",p),t.addEventListener("pointermove",m),t.addEventListener("pointerup",c),t.addEventListener("pointercancel",c),t.addEventListener("contextmenu",E),t.addEventListener("keydown",v),t.addEventListener("click",L,!0),()=>{o(),t.removeEventListener("pointerdown",p),t.removeEventListener("pointermove",m),t.removeEventListener("pointerup",c),t.removeEventListener("pointercancel",c),t.removeEventListener("contextmenu",E),t.removeEventListener("keydown",v),t.removeEventListener("click",L,!0)}}export{M as attachSeatMenu};
1
+ import{mn}from"./chunk-index-2e4am3hw.js";function M(t,l,d,g){let r,a=-1,i=!1,f=(e)=>e instanceof Element?e.closest("button, [data-seat]")??t:t,o=()=>{r?.cancel(),r=void 0,a=-1},p=(e)=>{if(i=!1,e.pointerType==="mouse"||!e.isPrimary)return;o();let n=l(e.target,e.clientX,e.clientY);if(!n)return;let u=f(e.target);a=e.pointerId,r=new mn((s)=>{if(i=!0,typeof navigator.vibrate==="function")navigator.vibrate(10);d({...n,at:s,via:"hold",source:u})},g),r.begin(e.clientX,e.clientY)},m=(e)=>{if(e.pointerId===a&&r&&!i){if(!r.move(e.clientX,e.clientY))o()}},c=(e)=>{if(e.pointerId===a)o()},E=(e)=>{let n=l(e.target,e.clientX,e.clientY);if(!n)return;if(e.preventDefault(),i)return;o(),d({...n,at:{x:e.clientX,y:e.clientY},via:"contextmenu",source:f(e.target)})},v=(e)=>{if(i=!1,e.key!=="ContextMenu"&&!(e.key==="F10"&&e.shiftKey))return;let n=l(e.target,-1,-1);if(!n)return;e.preventDefault();let u=f(e.target),s=u.getBoundingClientRect();d({...n,at:{x:s.left+Math.min(s.width/2,48),y:s.top+24},via:"key",source:u})},L=(e)=>{if(!i)return;i=!1,e.preventDefault(),e.stopPropagation()};return t.addEventListener("pointerdown",p),t.addEventListener("pointermove",m),t.addEventListener("pointerup",c),t.addEventListener("pointercancel",c),t.addEventListener("contextmenu",E),t.addEventListener("keydown",v),t.addEventListener("click",L,!0),()=>{o(),t.removeEventListener("pointerdown",p),t.removeEventListener("pointermove",m),t.removeEventListener("pointerup",c),t.removeEventListener("pointercancel",c),t.removeEventListener("contextmenu",E),t.removeEventListener("keydown",v),t.removeEventListener("click",L,!0)}}export{M as attachSeatMenu};
@@ -0,0 +1 @@
1
+ import{h,Q,S,X,s,N,M,a,r,t,c,m,e,n,o,D,u,ce,O,d,f,w,g,_,gn,zo,Io,Re,Oi,Vo,ue,Ln}from"./chunk-index-2e4am3hw.js";import{vo}from"./chunk-index-dj0tbfyb.js";import{K}from"./chunk-index-jgzygbt8.js";import"./chunk-index-j4kk1m59.js";import"./chunk-index-pyfx77cj.js";import"./chunk-index-e2dqjde8.js";import{lr}from"./chunk-index-aamhjg5n.js";import{xn}from"./chunk-index-b73y2gc0.js";import{Ut}from"./chunk-index-xq84gg8w.js";import{Ne,mt}from"./chunk-index-tk4se135.js";import{qt}from"./chunk-index-2fdns8tn.js";import{qe}from"./chunk-index-31x6krbs.js";import"./chunk-index-v6smgw77.js";import{L}from"./chunk-index-8d81qy69.js";import{Jt}from"./chunk-index-92zgb7my.js";import{ee,Te}from"./chunk-index-cdctnw71.js";import"./chunk-index-j0m16cj1.js";import"./chunk-index-g1awv7rk.js";var xe=S(()=>(h("hf296e7v"),import("./chunk-prompt-history-hf296e7v.js")).then((l)=>({default:l.HistorySheet}))),Fe=S(()=>(h("caj4pmg4"),import("./chunk-character-creator-caj4pmg4.js")).then((l)=>({default:l.CharacterCreator}))),Oe=["default","off","minimal","low","medium","high","xhigh"],ve={default:c("Default"),off:c("Off"),minimal:c("Minimal"),low:c("Low"),medium:c("Medium"),high:c("High"),xhigh:c("Very high")},G="default",be=(l)=>l.model===void 0?t("Default model ({current})",{current:l.effective.model}):t("Default model (server setting)"),$e=c("Automatic"),le=(l)=>l==="auto"?t($e):t(ve[l]??l),he=(l)=>({displayName:l.displayName,prompt:l.prompt,model:l.model??G,thinking:l.thinking??G});function ge(l,p){return{...p.displayName!==l.displayName?{displayName:p.displayName}:{},...p.prompt!==l.prompt?{prompt:p.prompt}:{},...p.model!==(l.model??G)?{model:p.model}:{},...p.thinking!==(l.thinking??G)?{thinking:p.thinking}:{}}}function ye(){let l=Io(),p=a(l);if(l)p.current=l;let i=p.current,k=l!==void 0;if(s(()=>{if(!k)return;let C=window.location.href,I=()=>{if(window.location.href!==C)gn()};return window.addEventListener("popstate",I),window.addEventListener("hashchange",I),()=>{window.removeEventListener("popstate",I),window.removeEventListener("hashchange",I)}},[k]),!i)return null;return e(L,{open:l!==void 0,title:t("Edit knight"),size:"wide",onClose:gn,children:e(Ve,{name:i.name,opened:i.id},i.name)})}function Ve({name:l,opened:p}){let[i,k]=r(),[C,I]=r([]),[A,V]=r(),[E,x]=r(),[v,R]=r(!1),[H,z]=r(!1),[te,J]=r(!1),[B,j]=r(!1),ae=Ln(i?.room??""),q=a(null),W=i!==void 0,U=u((y)=>i?y.rooms[i.room]?.view?.muted===!0:!1,i?.room??""),[ne,F]=r(!1),oe=u((y)=>i?y.rooms[i.room]?.view?.coordinator===!0:!1,i?.room??""),Y=N(),Z=N(),P=N();s(()=>{if(!W||!zo()?.look)return;q.current?.scrollIntoView({block:"start"}),q.current?.focus({preventScroll:!0})},[W,p]);let b=a({});b.current={profile:i,draft:E},s(()=>{let y=!0;return Promise.all([O.agent(l),O.models()]).then(([re,Pe])=>{if(!y)return;let{profile:fe,draft:ie}=b.current,He=fe&&ie&&Object.keys(ge(fe,ie)).length>0;k(re),I(Pe.models),x(He?ie:he(re))},(re)=>y&&V(d(re))),()=>{y=!1}},[l,p]);let T=M(()=>i&&E?ge(i,E):{},[i,E]);if(A)return e(g,{message:A});if(!i||!E)return e(w,{});let de=Object.keys(T).length>0,De=Array.from(new Set([G,...C,E.model])),Ie=be(i),pe=async()=>{R(!0);try{let y=await O.updateAgent(l,T);k(y),x(he(y)),z(!1),f(t("Saved."))}catch(y){f(d(y),"danger")}finally{R(!1)}};return n("div",{className:"stack agent-sheet",children:[n("header",{className:"profile-head",children:[e(ue,{spec:i.character,name:i.name,size:72,state:ae,label:i.displayName}),n("div",{children:[e("h3",{children:i.displayName}),e("p",{className:"meta",children:t("Runs on {model}, thinking {thinking}",{model:i.effective.model,thinking:le(i.effective.thinking)})})]})]}),e("ul",{className:"menu",children:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:P,children:[e("span",{className:"menu-icon",children:e(o,{name:U?"bell-off":"bell"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Notifications")}),e("span",{className:"meta",children:t("Push this room's posts to every owner's devices. A card that waits for you is always pushed.")})]}),e(qt,{id:P,checked:!U,label:t("Notifications"),busy:ne,onChange:async(y)=>{F(!0),await Jt(i.room,!y),F(!1)}})]})})}),H?e(Be,{profile:i,draft:E,saving:v,onBack:()=>z(!1),onSave:pe}):n("form",{className:"stack form",onSubmit:(y)=>{if(y.preventDefault(),!de)return;if(T.prompt!==void 0)z(!0);else pe()},children:[n("label",{htmlFor:Z,children:[t("Name"),e("input",{id:Z,value:E.displayName,onChange:(y)=>x({...E,displayName:y.target.value})})]}),n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:Y,children:t("Prompt")}),n("span",{className:"field-tools",children:[n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>j(!0),children:[e(o,{name:"reset",size:16}),t("History")]}),n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>J(!0),children:[e(Ge,{}),t("Full screen")]})]})]}),e("textarea",{id:Y,rows:8,value:E.prompt,onChange:(y)=>x({...E,prompt:y.target.value})})]}),e(Ut,{label:t("Model"),value:E.model,onChange:(y)=>x({...E,model:y}),options:De.map((y)=>({value:y,label:y===G?Ie:y}))}),e(Ut,{label:t("Thinking level"),value:E.thinking,onChange:(y)=>x({...E,thinking:y}),options:Oe.map((y)=>({value:y,label:t(ve[y])}))}),e("div",{className:"actions",children:e("button",{type:"submit",disabled:!de||v,children:v?t("Saving…"):T.prompt!==void 0?t("Review changes"):t("Save")})})]}),e(ze,{name:l,opened:p}),n("section",{className:"card stack",ref:q,tabIndex:-1,children:[e("h3",{children:t("Look")}),e("p",{className:"meta",children:t("Class, colors and parts. The picture here, in the rooms and in Discord all follow it.")}),e(Q,{fallback:e(w,{}),children:e(Fe,{name:i.name,displayName:i.displayName,prompt:i.prompt,character:i.character,onSaved:(y)=>k(y)})})]}),oe?null:n("section",{className:"card stack",children:[e("h3",{children:t("Archive")}),e("p",{className:"meta",children:t("An archived knight stops answering and its schedules are cancelled. Its history is kept, and you can restore it from Archived.")}),e("div",{className:"actions",children:e("button",{type:"button",className:"danger",onClick:()=>{gn(),Re({kind:"archive",room:i.room,name:i.displayName})},children:t("Archive {name}",{name:i.displayName})})})]}),B?e(Q,{fallback:null,children:e(xe,{open:B,title:t("History of the prompt"),load:async()=>(await Ne.agentPromptHistory(l)).versions.map((y)=>({id:y.id,text:y.text,previous:y.previous,by:y.by,at:y.at})),onUse:(y)=>{x({...E,prompt:y}),j(!1)},onClose:()=>j(!1)})}):null,e(L,{open:te,title:t("Prompt"),size:"full",onClose:()=>J(!1),children:e("textarea",{className:"prompt-full","aria-label":t("Prompt"),value:E.prompt,onChange:(y)=>x({...E,prompt:y.target.value})})})]})}function ze({name:l,opened:p}){let[i,k]=r(),[C,I]=r(),[A,V]=r(),E=N();if(s(()=>{let v=!0;return ee.skills(l).then((R)=>v&&k(R),(R)=>{if(v&&!(R instanceof ce&&R.status===404))V(d(R))}),()=>{v=!1}},[l,p]),A)return e(g,{message:A});if(!i)return null;let x=async(v,R)=>{I(v);try{k(await ee.setSkills(l,R?{add:[v]}:{remove:[v]}))}catch(H){f(d(H),"danger")}finally{I(void 0)}};return n("section",{className:"card stack","aria-label":t("Skills"),children:[e("h3",{children:t("Skills")}),e("p",{className:"meta",children:t("What the knight can load when a task calls for it. It applies from its next turn.")}),e("ul",{className:"menu",children:i.skills.map((v,R)=>{let H=`${E}-${R}`;return e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:H,children:[n("span",{className:"menu-text",children:[e("strong",{children:v.name}),e("span",{className:"meta",children:v.missing?t("Its file cannot be read."):v.builtin?t("Built in: every knight carries it."):v.description??""})]}),e(qt,{id:H,checked:v.carried,label:v.name,busy:C===v.name,disabled:v.builtin,onChange:(z)=>x(v.name,z)})]})},v.name)})})]})}var Ge=()=>e("svg",{viewBox:"0 0 24 24",width:16,height:16,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e("path",{d:"M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"})});function Be(l){let{profile:p,draft:i}=l,k=a(null);s(()=>k.current?.focus(),[]);let C=[];if(i.displayName!==p.displayName)C.push({label:t("Name"),before:p.displayName,after:i.displayName});let I=(A)=>A===G?be(p):A;if(i.model!==(p.model??G))C.push({label:t("Model"),before:I(p.model??G),after:I(i.model)});if(i.thinking!==(p.thinking??G))C.push({label:t("Thinking level"),before:le(p.thinking??G),after:le(i.thinking)});return n("section",{ref:k,className:"stack review",tabIndex:-1,"aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),C.length?e("ul",{className:"review-fields",children:C.map((A)=>n("li",{children:[e("strong",{children:A.label}),e("span",{className:"review-before",children:A.before}),e("span",{"aria-hidden":"true",children:"→"}),e("span",{className:"review-after",children:A.after})]},A.label))}):null,e(mt,{label:t("Prompt"),before:p.prompt,after:i.prompt}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:l.saving,onClick:l.onBack,children:t("Back to editing")}),e("button",{type:"button",disabled:l.saving,onClick:l.onSave,children:l.saving?t("Saving…"):t("Save")})]})]})}function Ke(l){let p=l.filter((C)=>C.parent!==void 0),i=l.filter((C)=>C.parent===void 0),k=new Set(i.map((C)=>C.name));return[...i.flatMap((C)=>[C,...p.filter((I)=>I.parent===C.name)]),...p.filter((C)=>!k.has(C.parent??""))]}function ke(){let[l,p]=r(),[i,k]=r(),[C,I]=r(),[A,V]=r(),E=X(async()=>{try{p((await ee.archive()).entries),k(void 0)}catch(v){k(d(v))}},[]);s(()=>{E()},[E]);let x=async(v)=>{I(v.name);try{if(v.kind==="agent")await ee.restoreAgent(v.name);else await ee.restoreGroup(v.name);await Te(),f(t("Restored {name}.",{name:v.displayName})),await E()}catch(R){f(d(R),"danger")}finally{I(void 0)}};if(i&&!l)return e(g,{message:i});if(!l)return e(w,{});return n("div",{className:"stack",children:[e("p",{className:"meta",children:t("Archived knights and groups no longer answer. Their history is kept until you delete them.")}),l.length===0?e(_,{children:t("Nothing is archived.")}):null,e("ul",{className:"menu",children:Ke(l).map((v)=>n("li",{className:"menu-item","data-helper":v.parent??void 0,style:v.parent?{paddingLeft:"var(--space-6)"}:void 0,children:[e("span",{className:"menu-icon",children:e(o,{name:v.kind==="agent"?"profile":"rooms"})}),n("span",{className:"menu-text",children:[e("strong",{children:v.displayName}),n("span",{className:"meta",children:[v.parent?t("Temp knight of {name}",{name:v.parent}):v.kind==="agent"?t("Knight"):t("Group")," ","· ",v.name]})]}),e("button",{type:"button",className:"secondary compact",disabled:C===v.name,onClick:()=>x(v),children:t("Restore")}),e("button",{type:"button",className:"compact danger",disabled:C===v.name,onClick:()=>V(v),children:t("Delete")})]},`${v.kind}:${v.name}`))}),e(K,{open:A!==void 0,title:t("Delete {name}?",{name:A?.displayName??""}),confirmLabel:t("Delete"),tone:"danger",onClose:()=>V(void 0),onConfirm:async()=>{if(!A)return;if(A.kind==="agent")await ee.deleteAgent(A.name);else await ee.deleteGroup(A.name);await Te(),f(t("Deleted {name}.",{name:A.displayName})),await E()},children:e("p",{children:t("{name} and its messages in this app are deleted for good, and the name can be used again. This cannot be undone.",{name:A?.displayName??""})})})]})}var we=/^[a-z0-9-]{1,32}$/,Se=2,Ce=8,se="\x00";function Ue(){let l=u((p)=>p.order.flatMap((i)=>{let k=p.rooms[i]?.view;return k?.kind==="agent"&&!k.helper?[`${k.name}${se}${k.displayName}`]:[]}).join(`${se}${se}`));return M(()=>l===""?[]:l.split(`${se}${se}`).map((p)=>{let[i="",k=""]=p.split(se);return{name:i,displayName:k}}),[l])}function Ae(l){let p=Ue(),[i,k]=r(),[C,I]=r(),[A,V]=r(""),[E,x]=r(""),[v,R]=r(!1),[H,z]=r([]),[te,J]=r(""),[B,j]=r(!1),[ae,q]=r(l.name===void 0),W=N(),U=N();s(()=>{let P=l.name;if(P===void 0)return;let b=!0;return ee.group(P).then((T)=>{if(!b)return;k(T),V(T.displayName),z(T.members),J(T.host),q(!0)},(T)=>b&&I(d(T))),()=>{b=!1}},[l.name]);let ne=(P)=>p.find((b)=>b.name===P)?.displayName??P,F=H.includes(te)?te:H[0]??"",oe=i===void 0?!0:A.trim()!==i.displayName||H.join(",")!==i.members.join(",")||F!==i.host,Y=A.trim()!==""&&H.length>=Se&&H.length<=Ce&&(i!==void 0||we.test(E));if(C&&!ae)return e(g,{message:C});if(!ae)return e(w,{});let Z=async()=>{j(!0),I(void 0);try{if(i){await ee.updateGroup(i.name,{...A.trim()!==i.displayName?{displayName:A.trim()}:{},...H.join(",")!==i.members.join(",")?{members:H}:{},...F!==i.host?{host:F}:{}}),await Te(),f(t("Saved.")),l.onDone();return}let P=await ee.createGroup({name:E,displayName:A.trim(),members:H,host:F});await Te(),f(t("Made {name}.",{name:P.displayName})),l.onDone(),D("room",P.room)}catch(P){I(d(P))}finally{j(!1)}};return n("form",{className:"stack form",onSubmit:(P)=>{if(P.preventDefault(),Y&&oe&&!B)Z()},children:[n("label",{htmlFor:W,children:[t("Name"),e("input",{id:W,value:A,autoComplete:"off",onChange:(P)=>{if(V(P.target.value),!i&&!v)x(P.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32))}})]}),i?null:n("label",{htmlFor:U,children:[t("Permanent name"),e("input",{id:U,value:E,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":E!==""&&!we.test(E),onChange:(P)=>{R(!0),x(P.target.value)}}),e("span",{className:"meta",children:t("Lowercase letters, digits and dashes, up to 32. It names the room and cannot be changed.")})]}),n("fieldset",{className:"field",children:[e("legend",{children:t("Members")}),e("span",{className:"meta",children:t("Pick 2 to 8 knights. They take turns in the order picked.")}),e("ul",{className:"menu",children:p.map((P)=>{let b=H.includes(P.name);return e("li",{children:n("label",{className:"menu-item menu-toggle",children:[e("input",{type:"checkbox",checked:b,disabled:!b&&H.length>=Ce,onChange:()=>z(b?H.filter((T)=>T!==P.name):[...H,P.name])}),e("span",{className:"menu-text",children:e("strong",{children:P.displayName})})]})},P.name)})})]}),H.length>=Se?e(Ut,{label:t("Host"),value:F,onChange:J,options:H.map((P)=>({value:P,label:ne(P)}))}):null,C?e(g,{message:C}):null,n("div",{className:"actions",children:[i?e("button",{type:"button",className:"danger",onClick:()=>{l.onDone(),Re({kind:"archive",room:i.room,name:i.displayName})},children:t("Archive group")}):null,e("button",{type:"submit",disabled:!Y||!oe||B,children:B?t("Saving…"):i?t("Save"):t("Make group")})]})]})}var je=S(()=>(h("caj4pmg4"),import("./chunk-character-creator-caj4pmg4.js")).then((l)=>({default:l.CharacterCreator}))),Ee=/^[a-z0-9-]{1,32}$/,me="default";function _e(l){let p=[];for(let i of l){let k=i.indexOf("/"),C=k>0?i.slice(0,k):"",I=p.find((A)=>A.provider===C&&C!=="");if(I)I.models.push(i);else p.push({provider:C,models:[i]})}return p}var We=(l)=>l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32);function Me({onDone:l}){let[p,i]=r(""),[k,C]=r(""),[I,A]=r(!1),[V,E]=r(""),[x,v]=r(me),[R,H]=r(""),[z,te]=r(),[J,B]=r(!1),[j,ae]=r([]),[q,W]=r(),[U,ne]=r(!1),F=[N(),N(),N(),N(),N()];s(()=>{let b=!0;return O.models().then((T)=>b&&ae(T.models),()=>{return}),()=>{b=!1}},[]);let oe=M(()=>xn({name:k,displayName:p,prompt:V}),[k,p,V]),Y=z?.spec??oe,Z=Ee.test(k)&&p.trim()!==""&&V.trim()!=="";if(J)return e(Q,{fallback:e(w,{}),children:e(je,{name:k||"new",displayName:p,prompt:V,character:Y,onPick:(b,T)=>{te({input:b,spec:T}),B(!1)},onCancel:()=>B(!1)})});let P=async()=>{ne(!0),W(void 0);try{let b={name:k,displayName:p.trim(),prompt:V,...x!==me?{model:x}:{},...R.trim()?{task:R.trim()}:{},...z?{character:z.input}:{}},T=await ee.createAgent(b);await Te(),f(t("Made {name}.",{name:T.displayName})),l(),D("room",T.room)}catch(b){W(b instanceof ce&&b.field?`${b.field}: ${d(b)}`:d(b))}finally{ne(!1)}};return n("form",{className:"stack form",onSubmit:(b)=>{if(b.preventDefault(),Z&&!U)P()},children:[n("label",{htmlFor:F[0],children:[t("Name"),e("input",{id:F[0],value:p,autoComplete:"off",onChange:(b)=>{if(i(b.target.value),!I)C(We(b.target.value))}})]}),n("label",{htmlFor:F[1],children:[t("Permanent name"),e("input",{id:F[1],value:k,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":k!==""&&!Ee.test(k),onChange:(b)=>{A(!0),C(b.target.value)}}),e("span",{className:"meta",children:t("Lowercase letters, digits and dashes, up to 32. It names the room and cannot be changed.")})]}),n("label",{htmlFor:F[2],children:[t("Prompt"),e("textarea",{id:F[2],rows:6,value:V,onChange:(b)=>E(b.target.value)}),e("span",{className:"meta",children:t("Its job, its sources, its limits and how it reports.")})]}),n("label",{htmlFor:F[4],children:[t("Model"),n(qe,{id:F[4],value:x,onChange:(b)=>v(b.target.value),children:[e("option",{value:me,children:t("Default model")}),_e(j).map((b)=>b.provider===""?b.models.map((T)=>e("option",{value:T,children:T},T)):e("optgroup",{label:b.provider,children:b.models.map((T)=>e("option",{value:T,children:T},T))},b.provider))]})]}),n("label",{htmlFor:F[3],children:[t("Opening task"),e("textarea",{id:F[3],rows:3,value:R,onChange:(b)=>H(b.target.value)}),e("span",{className:"meta",children:t("Optional. The knight starts on it as soon as it is made.")})]}),n("div",{className:"profile-head",children:[e(ue,{spec:Y,name:k||"new",size:72,label:p}),n("div",{children:[e("strong",{children:t("Look")}),e("span",{className:"meta",children:z?t("Your look"):t("Suggested from its role")}),e("button",{type:"button",className:"secondary compact",onClick:()=>B(!0),children:t("Choose a look")})]})]}),q?e(g,{message:q}):null,e("div",{className:"actions",children:e("button",{type:"submit",disabled:!Z||U,children:U?t("Making…"):t("Make knight")})})]})}var Xe=(l)=>l.kind==="new-agent"?t("New knight"):l.kind==="archive"?t("Archived"):l.name===void 0?t("New group"):t("Edit group");function Le(){let l=Vo(),p=a(l);if(l)p.current=l;let i=p.current,k=l!==void 0;if(s(()=>{if(!k)return;let C=window.location.href,I=()=>{if(window.location.href!==C)Oi()};return window.addEventListener("popstate",I),window.addEventListener("hashchange",I),()=>{window.removeEventListener("popstate",I),window.removeEventListener("hashchange",I)}},[k]),!i)return null;return e(L,{open:l!==void 0,title:Xe(i),size:"wide",onClose:Oi,children:e("div",{className:"stack agent-sheet",children:i.kind==="new-agent"?e(Me,{onDone:Oi}):i.kind==="archive"?e(ke,{}):e(Ae,{...i.name===void 0?{}:{name:i.name},onDone:Oi})},i.id)})}var Ye=S(()=>(h("a6pkjcq7"),import("./chunk-shortcut-help-a6pkjcq7.js")));function Je(){let l=vo(),p=a(!1);if(l)p.current=!0;if(!p.current)return null;return e(Q,{fallback:null,children:e(Ye,{open:l})})}function ga(){return n(m,{children:[e(lr,{}),e(ye,{}),e(Le,{}),e(Je,{})]})}export{ga as SheetHosts};
@@ -1,4 +1,4 @@
1
- import{t,e,n}from"./chunk-index-kankja6p.js";import{Zn,fo}from"./chunk-index-n6zrc05a.js";import{tn}from"./chunk-index-jq970hsd.js";import{L}from"./chunk-index-47yspxa4.js";var l=`
1
+ import{t,e,n}from"./chunk-index-2e4am3hw.js";import{Kn,So}from"./chunk-index-dj0tbfyb.js";import{on}from"./chunk-index-31x6krbs.js";import{L}from"./chunk-index-8d81qy69.js";var l=`
2
2
  .shortcut-list {
3
3
  display: grid;
4
4
  grid-template-columns: max-content minmax(0, 1fr);
@@ -23,4 +23,4 @@ import{t,e,n}from"./chunk-index-kankja6p.js";import{Zn,fo}from"./chunk-index-n6z
23
23
  text-align: center;
24
24
  font-size: var(--text-sm);
25
25
  }
26
- `;function r(){let o=fo(),s=o?"⌥":"Alt",a=o?"⌘":"Ctrl";return[{keys:[s,"↑"],label:t("Previous room")},{keys:[s,"↓"],label:t("Next room")},{keys:[s,"Shift","↑"],label:t("Previous room with unread messages")},{keys:[s,"Shift","↓"],label:t("Next room with unread messages")},{keys:[a,"K"],label:t("Find a room")},{keys:["Esc"],label:t("Close the open menu or sheet, or leave the message box")},{keys:["?"],label:t("Show these shortcuts")}]}function i({open:o}){return tn("shortcut-help",l),e(L,{open:o,title:t("Keyboard shortcuts"),onClose:Zn,children:n("div",{className:"stack",children:[e("dl",{className:"shortcut-list",children:r().map((s)=>n("div",{style:{display:"contents"},children:[e("dt",{children:s.keys.map((a)=>e("kbd",{children:a},a))}),e("dd",{children:s.label})]},s.label))}),e("p",{className:"meta",children:t("In a message box the arrow shortcuts switch rooms only when it is empty or the caret is at its very start (up) or very end (down).")})]})})}export{i as default};
26
+ `;function r(){let o=So(),s=o?"⌥":"Alt",a=o?"⌘":"Ctrl";return[{keys:[s,"↑"],label:t("Previous room")},{keys:[s,"↓"],label:t("Next room")},{keys:[s,"Shift","↑"],label:t("Previous room with unread messages")},{keys:[s,"Shift","↓"],label:t("Next room with unread messages")},{keys:[a,"K"],label:t("Find a room")},{keys:["Esc"],label:t("Close the open menu or sheet, or leave the message box")},{keys:["?"],label:t("Show these shortcuts")}]}function i({open:o}){return on("shortcut-help",l),e(L,{open:o,title:t("Keyboard shortcuts"),onClose:Kn,children:n("div",{className:"stack",children:[e("dl",{className:"shortcut-list",children:r().map((s)=>n("div",{style:{display:"contents"},children:[e("dt",{children:s.keys.map((a)=>e("kbd",{children:a},a))}),e("dd",{children:s.label})]},s.label))}),e("p",{className:"meta",children:t("In a message box the arrow shortcuts switch rooms only when it is empty or the caret is at its very start (up) or very end (down).")})]})})}export{i as default};
@@ -1 +1 @@
1
- import{oi,v,F,_e,y,Je,kt}from"./chunk-index-kankja6p.js";import{rr}from"./chunk-index-rg9vh59e.js";import{Ur}from"./chunk-index-raf772z6.js";import{lo,Zn,uo}from"./chunk-index-n6zrc05a.js";import{it}from"./chunk-index-nrexxkar.js";function m(e,t){let{collapsed:o,expanded:r,current:s}=t,n=it(e,t.at),a=[],c=(i,d)=>{a.push({key:i,shown:d});let f=n.threads[i];if(!f)return;for(let l of f.open)a.push({key:l,shown:d});for(let l of f.closed)a.push({key:l,shown:d&&(r.has(l)||l===s)})};for(let i of n.home)c(i,!0);for(let i of n.pinned)c(i,!0);for(let i of n.folders){let d=!o.has(i.id)||s!==void 0&&i.rooms.includes(s);for(let f of i.rooms)c(f,d)}let u=n.folders.length>0?n.rest:[...n.restAgents,...n.restGroups];for(let i of u)c(i,!0);let{orphans:p}=n;for(let i of p.open)a.push({key:i,shown:!0});for(let i of p.closed)a.push({key:i,shown:r.has(i)||i===s});return a}function h(e,t,o,r){let s=o===1?-1:e.length;if(t!==void 0){if(s=e.findIndex((n)=>n.key===t),s<0)return}for(let n=s+o;n>=0&&n<e.length;n+=o){let a=e[n];if(a&&r(a))return a.key}return}var w=new Set(["","text","search","url","tel","email","password","number","date","datetime-local","month","time","week"]);function S(e){if(!(e instanceof HTMLElement))return;if(e instanceof HTMLTextAreaElement)return e;if(e instanceof HTMLSelectElement)return e;if(e instanceof HTMLInputElement)return w.has(e.type)?e:void 0;return e.closest('[contenteditable]:not([contenteditable="false"])')?e:void 0}function b(e,t){if(e instanceof HTMLSelectElement)return!1;if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){if(e.value==="")return!0;let{selectionStart:n,selectionEnd:a}=e;if(n===null||a===null||n!==a)return!1;return t?n===0:n===e.value.length}if((e.textContent??"")==="")return!0;let o=window.getSelection();if(!o||o.rangeCount===0||!o.isCollapsed)return!1;let r=o.getRangeAt(0),s=document.createRange();if(s.selectNodeContents(e),t)s.setEnd(r.startContainer,r.startOffset);else s.setStart(r.endContainer,r.endOffset);return s.toString()===""}function k(e){if(e.defaultPrevented||Je(e))return;let{key:t}=e;if(t==="Escape")return e.altKey||e.ctrlKey||e.metaKey?void 0:"escape";if(e.altKey&&!e.ctrlKey&&!e.metaKey){if(t!=="ArrowUp"&&t!=="ArrowDown")return;let o=t==="ArrowUp",r=S(e.target);if(r&&!b(r,o))return;if(e.shiftKey)return o?"previous-unread":"next-unread";return o?"previous":"next"}if(t==="?"&&!e.ctrlKey&&!e.metaKey&&!e.repeat)return S(e.target)?void 0:"help";return}function x(){let e=new Set;for(let t of document.querySelectorAll("details.thread-closed[open] [data-thread]"))if(t.dataset.thread)e.add(t.dataset.thread);return e}var g=()=>document.querySelector('dialog[open], .action-popover, .switcher:not([data-state="closed"])')!==null;function E(e,t=12){let o=v("room",e),r=[...document.querySelectorAll('.room-row[aria-current="page"], .thread-link[aria-current="page"]')].find((s)=>s.getAttribute("href")===o);if(r)r.scrollIntoView?.({block:"nearest"});else if(t>0)requestAnimationFrame(()=>E(e,t-1))}function T(e,t){let o=y.getState(),r=oi(),s=r.pane==="room"?r.key:void 0,n=m(o,{at:(u)=>_e(o,u),collapsed:rr(),expanded:x(),current:s});if(r.pane==="room"&&!n.some((u)=>u.key===s))return;let c=h(n,s,e,t?(u)=>Ur(u.key)>0:(u)=>u.shown);if(c===void 0)return;F("room",c),E(c)}function H(e){if(document.querySelector(".action-popover")){e.preventDefault(),kt();return}if(document.querySelector("dialog[open]"))return;let t=document.activeElement;if(t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&w.has(t.type))e.preventDefault(),t.blur()}function K(e,t){switch(e){case"escape":H(t);break;case"help":if(t.preventDefault(),uo())Zn();else if(!g())lo();break;default:if(g())break;t.preventDefault(),T(e.startsWith("previous")?-1:1,e.endsWith("unread"))}}function P(){let e=(t)=>{let o=k(t);if(o)K(o,t)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}export{P as startShortcuts};
1
+ import{ui,v,D,ke,y,nt,St}from"./chunk-index-2e4am3hw.js";import{fr}from"./chunk-index-g3wrs02w.js";import{jr}from"./chunk-index-kbrg32sx.js";import{bo,Kn,xo}from"./chunk-index-dj0tbfyb.js";import{ot}from"./chunk-index-g1awv7rk.js";function m(e,t){let{collapsed:o,expanded:r,current:s}=t,n=ot(e,t.at),a=[],c=(i,d)=>{a.push({key:i,shown:d});let f=n.threads[i];if(!f)return;for(let l of f.open)a.push({key:l,shown:d});for(let l of f.closed)a.push({key:l,shown:d&&(r.has(l)||l===s)})};for(let i of n.home)c(i,!0);for(let i of n.pinned)c(i,!0);for(let i of n.folders){let d=!o.has(i.id)||s!==void 0&&i.rooms.includes(s);for(let f of i.rooms)c(f,d)}let u=n.folders.length>0?n.rest:[...n.restAgents,...n.restGroups];for(let i of u)c(i,!0);let{orphans:p}=n;for(let i of p.open)a.push({key:i,shown:!0});for(let i of p.closed)a.push({key:i,shown:r.has(i)||i===s});return a}function h(e,t,o,r){let s=o===1?-1:e.length;if(t!==void 0){if(s=e.findIndex((n)=>n.key===t),s<0)return}for(let n=s+o;n>=0&&n<e.length;n+=o){let a=e[n];if(a&&r(a))return a.key}return}var w=new Set(["","text","search","url","tel","email","password","number","date","datetime-local","month","time","week"]);function S(e){if(!(e instanceof HTMLElement))return;if(e instanceof HTMLTextAreaElement)return e;if(e instanceof HTMLSelectElement)return e;if(e instanceof HTMLInputElement)return w.has(e.type)?e:void 0;return e.closest('[contenteditable]:not([contenteditable="false"])')?e:void 0}function b(e,t){if(e instanceof HTMLSelectElement)return!1;if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){if(e.value==="")return!0;let{selectionStart:n,selectionEnd:a}=e;if(n===null||a===null||n!==a)return!1;return t?n===0:n===e.value.length}if((e.textContent??"")==="")return!0;let o=window.getSelection();if(!o||o.rangeCount===0||!o.isCollapsed)return!1;let r=o.getRangeAt(0),s=document.createRange();if(s.selectNodeContents(e),t)s.setEnd(r.startContainer,r.startOffset);else s.setStart(r.endContainer,r.endOffset);return s.toString()===""}function k(e){if(e.defaultPrevented||nt(e))return;let{key:t}=e;if(t==="Escape")return e.altKey||e.ctrlKey||e.metaKey?void 0:"escape";if(e.altKey&&!e.ctrlKey&&!e.metaKey){if(t!=="ArrowUp"&&t!=="ArrowDown")return;let o=t==="ArrowUp",r=S(e.target);if(r&&!b(r,o))return;if(e.shiftKey)return o?"previous-unread":"next-unread";return o?"previous":"next"}if(t==="?"&&!e.ctrlKey&&!e.metaKey&&!e.repeat)return S(e.target)?void 0:"help";return}function x(){let e=new Set;for(let t of document.querySelectorAll("details.thread-closed[open] [data-thread]"))if(t.dataset.thread)e.add(t.dataset.thread);return e}var g=()=>document.querySelector('dialog[open], .action-popover, .switcher:not([data-state="closed"])')!==null;function E(e,t=12){let o=v("room",e),r=[...document.querySelectorAll('.room-row[aria-current="page"], .thread-link[aria-current="page"]')].find((s)=>s.getAttribute("href")===o);if(r)r.scrollIntoView?.({block:"nearest"});else if(t>0)requestAnimationFrame(()=>E(e,t-1))}function T(e,t){let o=y.getState(),r=ui(),s=r.pane==="room"?r.key:void 0,n=m(o,{at:(u)=>ke(o,u),collapsed:fr(),expanded:x(),current:s});if(r.pane==="room"&&!n.some((u)=>u.key===s))return;let c=h(n,s,e,t?(u)=>jr(u.key)>0:(u)=>u.shown);if(c===void 0)return;D("room",c),E(c)}function H(e){if(document.querySelector(".action-popover")){e.preventDefault(),St();return}if(document.querySelector("dialog[open]"))return;let t=document.activeElement;if(t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&w.has(t.type))e.preventDefault(),t.blur()}function K(e,t){switch(e){case"escape":H(t);break;case"help":if(t.preventDefault(),xo())Kn();else if(!g())bo();break;default:if(g())break;t.preventDefault(),T(e.startsWith("previous")?-1:1,e.endsWith("unread"))}}function P(){let e=(t)=>{let o=k(t);if(o)K(o,t)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}export{P as startShortcuts};
@@ -0,0 +1,8 @@
1
+ import{h,Q,S,s,N,r,t,m,e,n,o,ce,d,f,w,g}from"./chunk-index-2e4am3hw.js";import{Ne,mt}from"./chunk-index-tk4se135.js";import{L}from"./chunk-index-8d81qy69.js";var M=S(()=>(h("hf296e7v"),import("./chunk-prompt-history-hf296e7v.js")).then((c)=>({default:c.HistorySheet}))),B=`---
2
+ name: my-skill
3
+ description: "Use when "
4
+ ---
5
+
6
+ # My skill
7
+
8
+ `;function _(c){let{name:u}=c,[i,k]=r(),[p,v]=r(u?"":B),[b,R]=r(),[z,y]=r(!1),[C,D]=r(!1),[A,H]=r(!1),[T,x]=r(!1),E=N();s(()=>{if(!u)return;let a=!0;return Ne.skillDocument(u).then((l)=>{if(!a)return;k(l),v(l.text)},(l)=>a&&R(d(l))),()=>{a=!1}},[u]);let F=i?.text??"",U=p!==F,I=u!==void 0&&!i&&!b,V=async()=>{D(!0);try{if(i){let a=await Ne.saveSkillDocument(i.name,{text:p,baseHash:i.hash});k(a),v(a.text),y(!1),H(!1),f(t("Saved.")),c.onSaved()}else await Ne.createSkillDocument({text:p}),f(t("Skill created.")),c.onSaved(),c.onClose()}catch(a){if(a instanceof ce&&a.status===409){let{current:l}=a.body;k(l),H(!0)}else f(d(a),"danger")}finally{D(!1)}};return n(L,{open:!0,title:u??t("New skill"),size:"full",onClose:c.onClose,children:[b?e(g,{message:b}):null,I?e(w,{}):null,i&&!i.writable?e(g,{message:t("This skill cannot be edited here.")}):null,!I&&!b&&(!i||i.writable)?n("div",{className:"stack",children:[z?n("section",{className:"stack review","aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),A?e(g,{message:t("This skill changed while you were editing it. The changes below are against the version there now; save again to replace it, or go back to edit.")}):null,e(mt,{label:"SKILL.md",before:F,after:p}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:C,onClick:()=>y(!1),children:t("Back to editing")}),e("button",{type:"button",disabled:C,onClick:V,children:C?t("Saving…"):i?t("Save"):t("Create skill")})]})]}):n(m,{children:[n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:E,children:"SKILL.md"}),i?e("span",{className:"field-tools",children:n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>x(!0),children:[e(o,{name:"reset",size:16}),t("History")]})}):null]}),e("textarea",{id:E,className:"prompt-full",spellCheck:!1,value:p,onChange:(a)=>v(a.target.value)}),e("p",{className:"meta",children:t("Frontmatter holds the name, which cannot change, and a description that starts with “Use when”. The rest is the skill.")})]}),e("div",{className:"actions",children:e("button",{type:"button",disabled:!U||!p.trim(),onClick:()=>y(!0),children:t("Review changes")})})]}),T&&i?e(Q,{fallback:null,children:e(M,{open:T,title:t("History of {name}",{name:i.name}),load:async()=>{let{versions:a}=await Ne.skillHistory(i.name);return a.map((l,K)=>({id:l.id,text:l.text,previous:a[K+1]?.text??"",by:l.by,at:l.at}))},onUse:(a)=>{v(a),y(!1),x(!1)},onClose:()=>x(!1)})}):null]}):null]})}export{_ as SkillEditor};
@@ -0,0 +1 @@
1
+ import{h,vr,Q,S,s,r,t,m,e,n,o,O,d,w,g,_,P,Gt,Rt}from"./chunk-index-2e4am3hw.js";import{be}from"./chunk-index-5bfqek1d.js";import{he}from"./chunk-index-v6smgw77.js";import"./chunk-index-8d81qy69.js";function N({source:i}){return e("div",{className:"prose document",children:e(Gt,{remarkPlugins:[Rt],components:{a:({href:a,children:c})=>a&&/^https?:\/\//.test(a)?e("a",{href:a,target:"_blank",rel:"noreferrer",children:c}):e("span",{children:c}),img:({alt:a})=>e("span",{children:a}),pre:({children:a})=>e("div",{className:"code-block",children:e("pre",{children:a})}),table:({children:a})=>e("div",{className:"table-wrap",children:e("table",{children:a})})},children:i})})}var v=S(()=>(h("67yk4x7t"),import("./chunk-skill-editor-67yk4x7t.js")).then((i)=>({default:i.SkillEditor})));function j(){let[i,a]=r(0),{data:c,error:l}=be(()=>O.skills(),`skills:${i}`),[f,y]=r(),[p,k]=r();s(()=>{O.session().then(y,()=>{return})},[]);let b=f?.skillEdit===!0;return n("section",{className:"stack",children:[n("div",{className:"card-head",children:[e("h2",{children:t("Skills")}),b?n("button",{type:"button",className:"secondary",onClick:()=>k({name:void 0}),children:[e(o,{name:"plus",size:16}),t("New skill")]}):null]}),e("p",{className:"hint",children:b?t("Registered skills and their carriers. A skill a knight wrote can be edited here; the others are read-only."):t("Registered skills and their carriers; ask a knight on Discord to edit their contents.")}),l?e(g,{message:l}):null,!c&&!l?e(w,{}):null,c?.length===0?e(_,{children:t("No skills.")}):null,c?.map((u)=>e(D,{skill:u,onEdit:b&&u.source.kind==="written"?()=>k({name:u.name}):void 0},`${u.name}:${i}`)),p?e(Q,{fallback:null,children:e(v,{name:p.name,onSaved:()=>a((u)=>u+1),onClose:()=>k(void 0)},p.name??"")}):null]})}function E(i){switch(i.kind){case"builtin":return t("Built in with the release; it changes with the release.");case"package":return t("From the package {package}; it changes when the package is upgraded.",{package:i.package});case"linked":return t("Linked from {repo}; change it in its repository.",{repo:`${i.repo}:${i.path}`});default:return}}function D({skill:i,onEdit:a}){let[c,l]=r(!1),[f,y]=r(),[p,k]=r(),b=i.source.kind==="builtin"?t("Built-in"):i.source.kind==="written"?t("Knight-written"):i.source.kind==="package"?i.source.package:`${i.source.repo}:${i.source.path}`;return n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:i.name}),e(P,{children:b}),i.missing?e(P,{tone:"warn",children:t("File missing")}):n(m,{children:[a?e("button",{type:"button",className:"secondary",onClick:a,children:t("Edit")}):null,e("button",{type:"button",className:"secondary",onClick:()=>{if(l(!0),!f)k(void 0),O.skill(i.name).then(y).catch((u)=>k(d(u)))},children:"SKILL.md"})]})]}),e("p",{children:i.missing??i.description}),i.source.kind!=="written"?n("p",{className:"hint skill-lock",children:[e(o,{name:"lock",size:14}),e("span",{children:E(i.source)})]}):null,n("p",{className:"hint",children:[t("Carriers"),":"," ",i.source.kind==="builtin"?t("All knights"):i.carriers.join(", ")||t("None")]}),i.groups.length?n("p",{className:"hint",children:[t("Groups"),": ",i.groups.join(", ")]}):null,e(he,{open:c,title:i.name,size:"wide",onClose:()=>l(!1),children:p?e(g,{message:p}):!f?e(w,{}):e(V,{title:i.name,detail:f})})]})}function V({title:i,detail:a}){let c=a.metadata.filter((l)=>!(l.key==="name"&&l.value===i));return n("div",{className:"skill-document",children:[c.length?e("dl",{className:"skill-meta",children:c.map((l)=>n(vr,{children:[e("dt",{children:l.key}),e("dd",{children:l.value})]},l.key))}):null,e(N,{source:a.body})]})}export{j as SkillsPage};
@@ -0,0 +1 @@
1
+ import{M,a,r,t,te,m,e,n,o,v,D,gt,ke,u,nt,Wt,On,We,Xe,Yt}from"./chunk-index-2e4am3hw.js";import{si}from"./chunk-index-02vfshtt.js";import{ii}from"./chunk-index-ak6ecqy3.js";import{ri,oi}from"./chunk-index-xxeb2xp0.js";import{Bt}from"./chunk-index-12zyshae.js";import{Ts}from"./chunk-index-g1awv7rk.js";ri();function b(){let l=u((c)=>JSON.stringify(Ts(c,(s)=>ke(c,s),(s)=>gt(c,s)>0,!0).map((s)=>({id:s.id,...s.title===void 0?{}:{title:s.title},entries:s.keys.map((h)=>({key:h,name:c.rooms[h]?.view?.displayName??h,waiting:gt(c,h)>0}))})))),d=si(),y=a(l);if(!d)y.current=l;let f=y.current;return M(()=>JSON.parse(f),[f])}function k(l){let{key:d,name:y}=l.entry,f=u((i)=>i.rooms[d]),c=u((i)=>gt(i,d)),s=f?.view,h=We(s?.character),g=Bt(()=>Wt(d,l.onLeave),l.liftable&&!s?.home?oi(d):void 0);if(!s)return null;return e("li",{...l.liftable&&!s.home?{"data-drop-item":"","data-key":d}:{},children:n("a",{className:"switcher-row",...g,href:v("room",d),"aria-current":d===l.current?"page":void 0,style:h,onClick:(i)=>{if(i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey)return;i.preventDefault(),l.onPick(d)},children:[n("span",{className:"switcher-picture",children:[e(Xe,{view:s,size:40}),c?e("span",{className:"switcher-dot","aria-hidden":"true"}):null]}),n("span",{className:"switcher-name",children:[e("strong",{children:y}),f?.typing?n("span",{className:"switcher-working",children:[n("span",{className:"typing","aria-hidden":"true",children:[e("i",{}),e("i",{}),e("i",{})]}),t("Working")]}):null]}),e(Yt,{room:d}),c?e("span",{className:"badge badge-warn",children:te(c,"{count} card waiting","{count} cards waiting")}):null,s.muted?n("span",{className:"switcher-mode","data-mode":"muted",title:t("Notifications are off"),children:[e(o,{name:"bell-off",size:14}),e("span",{className:"visually-hidden",children:t("Notifications are off")})]}):null,f?.mode.yolo?n("span",{className:"switcher-mode","data-mode":"yolo",title:t("Yolo"),children:[e(o,{name:"bolt",size:14}),e("span",{className:"visually-hidden",children:t("Yolo")})]}):null,f?.mode.longRunning?n("span",{className:"switcher-mode","data-mode":"long",title:t("Long-running"),children:[e(o,{name:"timer",size:14}),e("span",{className:"visually-hidden",children:t("Long-running")})]}):null]})})}function Y(l){let[d,y]=r(""),f=b(),c=f.map((i)=>({...i,entries:i.entries.filter((p)=>ii(d,p.name)!==void 0)})).filter((i)=>i.entries.length>0||d===""),s=(i)=>l.close(i===l.current?void 0:()=>D("room",i)),h=f.some((i)=>i.id!=="waiting"&&i.id!=="home"&&i.id!=="rest"&&(i.id!=="pinned"||i.entries.length>0))?t("Ungrouped"):t("Rooms"),g=c.filter((i)=>i.entries.length>0).length>1;return n(m,{children:[n("div",{className:"switcher-search",children:[e(o,{name:"search",size:16}),e("input",{type:"search",value:d,placeholder:t("Find a room"),"aria-label":t("Find a room"),enterKeyHint:"go",autoComplete:"off",onChange:(i)=>y(i.target.value),onKeyDown:(i)=>{let p=c.flatMap((w)=>w.entries)[0];if(i.key==="Enter"&&p&&!nt(i.nativeEvent))s(p.key)}}),e("button",{type:"button",className:"icon-button switcher-add","aria-label":t("Add"),"aria-haspopup":"menu",onClick:(i)=>On(i.currentTarget,l.close),children:e(o,{name:"plus"})})]}),e("div",{className:"switcher-scroll","data-drop-root":"",children:c.map((i)=>{let p=i.id==="waiting",w=i.id==="pinned"?"pinned":i.id==="rest"?"rest":p||i.id==="home"?void 0:"folder";return n("section",{"aria-label":p?t("Waiting for you"):i.id==="home"?t("Home"):i.id==="pinned"?t("Pinned"):i.id==="rest"?h:i.title??t("Rooms"),...i.entries.length===0?{"data-empty":""}:{},...w?{"data-drop-zone":w,"data-zone-id":i.id,...w==="folder"?{"data-folder":i.id}:{}}:{},children:[p?e("h2",{className:"switcher-heading","data-waiting":"",children:t("Waiting for you")}):g||i.entries.length===0?e("h2",{className:"switcher-heading",children:i.id==="home"?t("Home"):i.id==="pinned"?t("Pinned"):i.id==="rest"?h:i.title}):null,e("ul",{className:"switcher-list",children:i.entries.map((N)=>e(k,{entry:N,current:l.current,onPick:s,onLeave:l.close,liftable:!p&&i.id!=="home"},N.key))})]},i.id)})})]})}export{Y as SwitcherList};
@@ -1 +1 @@
1
- import{y,Zo,Bi}from"./chunk-index-kankja6p.js";import{Dr,Vr}from"./chunk-index-raf772z6.js";import{Pi,yo}from"./chunk-index-r1v895tj.js";import"./chunk-index-c2ag3qw2.js";var c=64;async function m(s){let a=new Image;a.src=s,await a.decode();let r=document.createElement("canvas");r.width=r.height=c;let t=r.getContext("2d");if(!t)throw Error("the page has no 2d canvas");t.drawImage(a,0,0,c,c);let i=c*0.175,o=c-i-2,e=i+2;return t.fillStyle="#ffffff",t.beginPath(),t.arc(o,e,i+2.5,0,Math.PI*2),t.fill(),t.fillStyle="#ef4444",t.beginPath(),t.arc(o,e,i,0,Math.PI*2),t.fill(),r.toDataURL("image/png")}var u=()=>[...document.head.querySelectorAll('link[rel~="icon"]')];function g(s){let a=new Map,r=!1,t=0,i=(e)=>{if(e.dataset.plainHref===void 0)return;if(e.setAttribute("href",e.dataset.plainHref),e.dataset.plainType)e.type=e.dataset.plainType;else e.removeAttribute("type");if(e.dataset.plainSizes)e.setAttribute("sizes",e.dataset.plainSizes);else e.removeAttribute("sizes");delete e.dataset.plainHref,delete e.dataset.plainType,delete e.dataset.plainSizes},o=async()=>{let e=++t,p=s.count()>0;if(p===r)return;if(!p){for(let n of u())i(n);r=!1;return}let l=u(),d=(l.find((n)=>n.dataset.plainHref===void 0&&n.type==="image/png")??l[0])?.href;if(!d)return;let f=a.get(d);if(!f)f=s.render(d),a.set(d,f);let b=await f.catch((n)=>{a.delete(d),console.warn("the tab icon's dot failed to draw",n);return});if(!b||e!==t)return;for(let n of u()){if(n.dataset.plainHref===void 0)n.dataset.plainHref=n.getAttribute("href")??"",n.dataset.plainType=n.type,n.dataset.plainSizes=n.getAttribute("sizes")??"";n.href=b,n.type="image/png",n.removeAttribute("sizes")}r=!0};s.subscribe(()=>void o()),o()}function H(){let s=()=>Pi().badge+Vr(),a=()=>Zo(s());g({count:()=>Bi(y.getState())+s(),subscribe:(r)=>{let t=()=>{a(),r()};y.subscribe(t),yo(t),Dr(t)},render:m}),a()}export{H as startPageTabDot};
1
+ import{y,Go,Ki}from"./chunk-index-2e4am3hw.js";import{Hr,Kr}from"./chunk-index-kbrg32sx.js";import{Xi,Po}from"./chunk-index-ac1ktr56.js";import"./chunk-index-msqhgvfx.js";var c=64;async function m(s){let a=new Image;a.src=s,await a.decode();let r=document.createElement("canvas");r.width=r.height=c;let t=r.getContext("2d");if(!t)throw Error("the page has no 2d canvas");t.drawImage(a,0,0,c,c);let i=c*0.175,o=c-i-2,e=i+2;return t.fillStyle="#ffffff",t.beginPath(),t.arc(o,e,i+2.5,0,Math.PI*2),t.fill(),t.fillStyle="#ef4444",t.beginPath(),t.arc(o,e,i,0,Math.PI*2),t.fill(),r.toDataURL("image/png")}var u=()=>[...document.head.querySelectorAll('link[rel~="icon"]')];function g(s){let a=new Map,r=!1,t=0,i=(e)=>{if(e.dataset.plainHref===void 0)return;if(e.setAttribute("href",e.dataset.plainHref),e.dataset.plainType)e.type=e.dataset.plainType;else e.removeAttribute("type");if(e.dataset.plainSizes)e.setAttribute("sizes",e.dataset.plainSizes);else e.removeAttribute("sizes");delete e.dataset.plainHref,delete e.dataset.plainType,delete e.dataset.plainSizes},o=async()=>{let e=++t,p=s.count()>0;if(p===r)return;if(!p){for(let n of u())i(n);r=!1;return}let l=u(),d=(l.find((n)=>n.dataset.plainHref===void 0&&n.type==="image/png")??l[0])?.href;if(!d)return;let f=a.get(d);if(!f)f=s.render(d),a.set(d,f);let b=await f.catch((n)=>{a.delete(d),console.warn("the tab icon's dot failed to draw",n);return});if(!b||e!==t)return;for(let n of u()){if(n.dataset.plainHref===void 0)n.dataset.plainHref=n.getAttribute("href")??"",n.dataset.plainType=n.type,n.dataset.plainSizes=n.getAttribute("sizes")??"";n.href=b,n.type="image/png",n.removeAttribute("sizes")}r=!0};s.subscribe(()=>void o()),o()}function H(){let s=()=>Xi().badge+Kr(),a=()=>Go(s());g({count:()=>Ki(y.getState())+s(),subscribe:(r)=>{let t=()=>{a(),r()};y.subscribe(t),Po(t),Hr(t)},render:m}),a()}export{H as startPageTabDot};
@@ -0,0 +1 @@
1
+ import{h,Q,S,ve,s,r,t,e,n,D,u,et,pe,qo}from"./chunk-index-2e4am3hw.js";import"./chunk-index-2t30xwed.js";import"./chunk-index-18pgxxw3.js";import"./chunk-index-kbrg32sx.js";import{Mn,ei,wo,$i,ti,Vt}from"./chunk-index-kb3w11mn.js";import"./chunk-index-64rsz6pf.js";import{Ei,Ci}from"./chunk-index-t998yg8y.js";import"./chunk-index-8d81qy69.js";import{es,xi,ts}from"./chunk-index-dnjftvtq.js";var x=S(()=>(h("s9sz1bzf"),import("./chunk-council-sheet-s9sz1bzf.js")).then((o)=>({default:o.CouncilSheet})));function A(o,i,b,c,d){qo(o,i).then((m)=>{if(m)pe({...m,at:b,via:c,source:d})},()=>{return})}function P(){return wo((ve(et)?.kinds??[]).map((o)=>o.kind)),null}function V({focus:o}){let[i,b]=r(),c=$i(void 0),d=Mn(),m=d.loaded&&c.length===0;return s(()=>{if(o&&d.loaded)D("table",void 0,{replace:!0})},[o,d.loaded]),n("div",{className:"table-page",children:[n("header",{className:"page-head",children:[e("h1",{children:t("Round table")}),n("div",{className:"table-tools",children:[i?.kind==="webgl"?e("button",{type:"button",className:"secondary",onClick:()=>i.focus(null),children:t("Reset view")}):null,e("button",{type:"button",className:"secondary",onClick:()=>D("rooms"),children:t("All rooms")})]})]}),n("div",{className:"table-frame",children:[m?n("div",{className:"table-empty-state",children:[e("strong",{children:t("The table is empty")}),e("p",{className:"meta",children:t("There are no rooms to seat yet.")})]}):e(Vt,{onHandle:b,onSeat:(a)=>{let l=c.find((f)=>f.name===a);if(l)D("room",l.key)},onFocus:(a)=>{let l=c.find((f)=>f.name===a);if(l)D("room",l.key)}}),e(P,{})]})]})}function F({named:o}){let[i,b]=r(),c=xi(),d=es(),m=u((p)=>p.listed),a=ts(c,d,o),l=a?.members??[],f=$i(l),g=ti(),{focus:R,look:y}=Ei(a?.key??"",l),[w,k]=r(!1),[H,M]=r(!1),v=()=>{M(!0),k(!0)},C=o===void 0||c.some(G(o));s(()=>{if(o!==void 0&&m&&!C)D("table",void 0,{replace:!0})},[o,m,C]);let N=f.length>0;return n("div",{className:"table-page","data-focused":N||void 0,children:[n("header",{className:"page-head",children:[e("h1",{children:t("Round table")}),n("div",{className:"table-tools",children:[i?.kind==="webgl"?e("button",{type:"button",className:"secondary",onClick:()=>y(null),children:t("Reset view")}):null,g.length>0?e("button",{type:"button",className:"secondary council-chip","aria-haspopup":"dialog",onClick:v,children:a?t("Council: {name} ▾",{name:a.displayName}):t("Pick who sits")}):null]})]}),a&&N?e(Ci,{roomKey:a.key,members:l,focus:R,onLook:y,streams:!0,onHandle:b,onSeatMenu:(p)=>{let T=f.find((E)=>E.name===p.id);if(T)A(T.key,a.key,p.at,p.via,p.source)}}):e("div",{className:"table-frame",children:n("div",{className:"table-empty-state",children:[e("strong",{children:a?t("The council is empty"):t("No council yet")}),e("p",{className:"meta",children:a?t("Every member of this council is gone. Edit who sits."):t("A council is a group of up to {max} knights who answer in turn. Pick who sits.",{max:8})}),g.length>0?e("button",{type:"button",onClick:v,children:a?t("Edit this council"):t("Pick who sits")}):null]})}),H?e(Q,{fallback:null,children:e(x,{open:w,onClose:()=>k(!1),council:a})}):null]})}var G=(o)=>(i)=>i.key===o||i.name===o;function Y({focus:o}){return ei()?e(V,{focus:o}):e(F,{named:o})}export{Y as TablePage};
@@ -0,0 +1 @@
1
+ import{Cn,yr,br,Pt,an,ln,ai}from"./chunk-index-w42rcbx1.js";import"./chunk-index-64rsz6pf.js";import{Mt,Ft}from"./chunk-index-0a81da8z.js";var de="http://www.w3.org/2000/svg",t=(d,s={},p)=>{let x=document.createElementNS(de,d);for(let[E,R]of Object.entries(s))x.setAttribute(E,String(R));return p?.appendChild(x),x},fe=(d)=>{let s=/<svg[^>]*\swidth=/.test(d)?d:d.replace("<svg",'<svg width="256" height="256"');return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`},me=0;function he(d,s){let p=s||d<=6?1:2;return{rows:p,perRow:Math.max(1,Math.ceil(d/p))}}function we(d,s){let p=`t2d${++me}`,x=window.matchMedia("(prefers-reduced-motion: reduce)"),E=s.reducedMotion==="auto"||s.reducedMotion===void 0?x.matches:s.reducedMotion,R=s.labels??Ft,{theme:I,scheme:_}=s,M=[],z=new Map,A=new Map,G=new Map,T=s.focus??null,S=document.createElement("div");S.className="t2d";let m=t("svg",{role:"group","aria-label":R.table});if(S.appendChild(m),getComputedStyle(d).position==="static")d.style.position="relative";d.appendChild(S);function te(e,i,c){let o=Math.max(1.6,c*0.022),g=o+Math.max(1.2,c*0.014),a=t("filter",{id:`${p}-rim`,x:"-15%",y:"-15%",width:"130%",height:"130%"},e);t("feMorphology",{in:"SourceAlpha",operator:"dilate",radius:g,result:"far"},a),t("feFlood",{"flood-color":i.ink,result:"ink"},a),t("feComposite",{in:"ink",in2:"far",operator:"in",result:"line"},a),t("feMorphology",{in:"SourceAlpha",operator:"dilate",radius:o,result:"near"},a),t("feFlood",{"flood-color":i.paper,result:"paper"},a),t("feComposite",{in:"paper",in2:"near",operator:"in",result:"rim"},a);let l=t("feMerge",{},a);for(let w of["line","rim","SourceGraphic"])t("feMergeNode",{in:w},l)}function y(){let e=Cn(I,_);S.classList.toggle("reduced",E),S.classList.toggle("focus",T!==null),S.classList.toggle("dim",M.some((r)=>A.get(r.id)==="speaking"));let i=s.variant==="compact",c=Math.max(d.clientWidth,200),o=Math.max(d.clientHeight,i?60:200);m.setAttribute("viewBox",`0 0 ${c} ${o}`),m.replaceChildren();let g=Math.max(M.length,1),{rows:a,perRow:l}=he(g,i);t("rect",{width:c,height:o,fill:e.css.bg},m);let w=t("defs",{},m),C=c/2,F=i?o*0.82:o*0.62;if(t("ellipse",{cx:C,cy:F,rx:c*0.47,ry:i?o*0.2:o*0.34,fill:e.css.floor,stroke:e.ink,"stroke-width":2},m),!i)t("ellipse",{cx:C,cy:F,rx:c*0.3,ry:o*0.2,fill:"none",stroke:e.css.ring,"stroke-width":3,opacity:e.night?0.9:0.7},m);let H=c/l,B=i?o*0.95:o/(a+0.6),h=Math.max(46,Math.min(H*0.94,132,B*1.05)),u=h*0.72,n=h*1.05;te(w,e,n),M.forEach((r,b)=>{let k=t("radialGradient",{id:`${p}-h${b}`},w);t("stop",{offset:0,"stop-color":r.color,"stop-opacity":0.95},k),t("stop",{offset:1,"stop-color":r.color,"stop-opacity":0},k)});let ne=(r)=>{if(i)return o*0.92;return a===1?o*0.62:o*(0.46+r*0.3)};if(M.forEach((r,b)=>{let k=Math.floor(b/l),re=Math.min(l,g-k*l),ie=b-k*l,se=c/re*(ie+0.5),ae=ne(k),O=A.get(r.id)??"idle",f=t("g",{class:"seat","data-seat":r.id,"data-state":O,...T===r.id?{"data-focus":""}:{},transform:`translate(${se.toFixed(1)} ${ae.toFixed(1)})`,tabindex:s.listBelow?-1:0,role:"button","aria-label":R.seat(r.name,O),color:e.css.text,...s.listBelow?{"aria-hidden":"true"}:{}},m);t("ellipse",{cx:0,cy:3,rx:h*0.55,ry:h*0.1,fill:"#000",opacity:0.35},f),t("ellipse",{class:"halo",cx:0,cy:-u-n*0.35,rx:n*0.8,ry:n*0.8,fill:`url(#${p}-h${b})`},f),t("polygon",{class:"beam",points:`${-n*0.12},${-n*2.1} ${n*0.12},${-n*2.1} ${n*0.5},0 ${-n*0.5},0`,fill:r.color,opacity:0.2},f);let K=t("g",{class:"lift"},f),X=z.get(r.id);if(X)t("image",{href:fe(X),x:-n/2,y:-u-n*0.78,width:n,height:n*0.88,filter:`url(#${p}-rim)`,...r.dim?{opacity:0.55}:{}},K);else{t("circle",{cx:0,cy:-u-n*0.3,r:n*0.3,fill:r.color,stroke:e.ink,"stroke-width":2},K);let v=t("text",{x:0,y:-u-n*0.3+n*0.1,"text-anchor":"middle","font-size":n*0.3,"font-weight":700,fill:"#fff","font-family":Pt},K);v.textContent=Array.from(r.name)[0]?.toUpperCase()??"?"}let Z=u*0.22;t("path",{d:`M ${-h*0.5} ${-u} L ${h*0.5} ${-u} L ${h*0.42} 0 L ${-h*0.42} 0 Z`,fill:e.wood,stroke:e.ink,"stroke-width":2,"stroke-linejoin":"round"},f),t("rect",{x:-h*0.54,y:-u-Z*0.2,width:h*1.08,height:Z,rx:2,fill:e.woodLight,stroke:e.ink,"stroke-width":2},f);let L=Math.max(11,Math.min(15,h*0.14)),V=Math.min(Math.max(h*0.9,L*5.5+14),Math.max(h*0.9,r.name.length*L*0.62+18),H*0.98),le=L+8;t("rect",{class:"plate",x:-V/2,y:-u*0.78,width:V,height:le,rx:3,fill:e.gold,stroke:e.ink,"stroke-width":2},f);let ce=t("text",{x:0,y:-u*0.78+L+1.5,"text-anchor":"middle","font-size":L,"font-weight":700,"font-family":Pt,fill:e.plateInk},f),J=G.get(r.id);ce.textContent=br(J?`${J} ${r.name}`:r.name,(V-8)/L);let Q=t("g",{class:"badge"},t("g",{transform:`translate(${n*0.4} ${-u-n*0.78})`},f)),D=O==="done",P=O==="error",U=e.gold;if(D)U=yr.done;else if(P)U=yr.error;t("circle",{r:n*0.15,fill:U,stroke:e.ink,"stroke-width":2},Q);let W=t("text",{x:0,y:n*0.06,"text-anchor":"middle","font-size":n*0.2,"font-weight":800,"font-family":Pt,fill:D||P?"#fff":e.ink},Q);if(W.textContent="!",D)W.textContent="✓";else if(P)W.textContent="✕";let ee=t("g",{class:"orbit"},f);t("circle",{cx:n*0.4,cy:-u-n*0.5,r:n*0.05,fill:r.color},ee),t("circle",{cx:-n*0.4,cy:-u-n*0.5,r:n*0.035,fill:r.color,opacity:0.6},ee),f.addEventListener("click",(v)=>s.onSeatClick({id:r.id,name:r.name,at:Mt(v,f)})),f.addEventListener("keydown",(v)=>{if(v.key==="Enter"||v.key===" ")v.preventDefault(),s.onSeatClick({id:r.id,name:r.name,at:Mt({clientX:0,clientY:0,detail:0},f)})})}),!i){let r=Math.min(c*0.34,190),b=o-6;t("rect",{x:C-r/2,y:b-22,width:r,height:22,rx:4,fill:e.wood,stroke:e.ink,"stroke-width":2},m);let k=t("text",{x:C,y:b-7,"text-anchor":"middle","font-size":12,"font-weight":700,"font-family":Pt,fill:e.gold},m);k.textContent=br(s.ownerName??"You",12)}}let N=new Set,oe=(e,i)=>{if(e.mode==="cut")return;let c=Cn(I,_),o=(g,a)=>{let l=setTimeout(()=>{N.delete(l),g()},a);N.add(l)};for(let g of e.joining){let a=[...m.querySelectorAll("g.seat[data-seat]")].find((l)=>l.getAttribute("data-seat")===g);if(!a)continue;a.classList.add("seat-in"),a.prepend(t("ellipse",{class:"seat-ring",rx:44,ry:12,cy:4,stroke:c.css.ring})),o(()=>{a.classList.remove("seat-in"),a.querySelector(".seat-ring")?.remove()},ln)}for(let g of e.leaving){let a=i.get(g);if(!a)continue;let l=a.cloneNode(!0);l.classList.add("seat-out");for(let w of["data-seat","tabindex","role","aria-label"])l.removeAttribute(w);l.setAttribute("aria-hidden","true");for(let[w,[C,F,H]]of[[-26,-24,20],[24,-20,22],[0,-52,24],[-4,-4,26]].entries()){let B=t("circle",{class:"puff",cx:C,cy:F,r:H,fill:c.paper,stroke:c.ink,"stroke-width":3},l);B.style.animationDelay=`${w*40}ms`}m.appendChild(l),o(()=>l.remove(),an)}},Y=new ResizeObserver(y);Y.observe(d);let j=()=>{if(s.reducedMotion==="auto"||s.reducedMotion===void 0)q.setReducedMotion(x.matches)};x.addEventListener("change",j);let q={kind:"svg",setTheme(e,i){I=e,_=i,y()},setSeats(e){let i=M.map((o)=>o.id),c=new Map([...m.querySelectorAll("g.seat[data-seat]")].map((o)=>[o.getAttribute("data-seat")??"",o]));M=e;for(let o of e)if(A.set(o.id,o.state??"idle"),o.avatarSvg)z.set(o.id,o.avatarSvg);if(y(),i.length>0||c.size>0)oe(ai(i,e.map((o)=>o.id),E),c)},setState(e,i){if(A.get(e)===i)return;A.set(e,i),y()},setMark(e,i){if((G.get(e)??null)===i)return;if(i===null)G.delete(e);else G.set(e,i);y()},setAvatar(e,i){return z.set(e,i),y(),Promise.resolve()},setReducedMotion(e){E=e,y()},resetCamera(){T=null,y(),s.onFocus?.(null)},focus(e){if(e===T)return;T=e,y()},focused:()=>T,getStats(){return{kind:"svg",fps:0,frameMs:0,frameMsMax:0,drawCalls:0,triangles:0,textures:0,geometries:0,dpr:1,lowPower:!1,reduced:E,loop:"idle",seats:M.length,renders:0}},dispose(){for(let e of N)clearTimeout(e);N.clear(),Y.disconnect(),x.removeEventListener("change",j),S.remove()}};return q.setSeats(s.seats),q}export{we as createTable2D};