pi-roundtable-web 0.30.1 → 0.30.4

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 (192) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/chunk-account-xz99gxg8.js +1 -0
  3. package/dist/{chunk-action-menu-a1vy1se2.js → chunk-action-menu-fsxjfeaq.js} +1 -1
  4. package/dist/{chunk-agent-adfz539q.js → chunk-agent-bq536p6g.js} +1 -1
  5. package/dist/chunk-arranged-rooms-y2q330yg.js +1 -0
  6. package/dist/{chunk-attachments-hbnh1rvq.js → chunk-attachments-s1z9jggf.js} +2 -2
  7. package/dist/chunk-bulk-actions-je4qp745.js +1 -0
  8. package/dist/{chunk-character-creator-26fptwb3.js → chunk-character-creator-x8grfnwr.js} +2 -2
  9. package/dist/{chunk-codeeditor-429q64dw.js → chunk-codeeditor-3vh4q5af.js} +2 -2
  10. package/dist/{chunk-command-menu-qfpnv4xs.js → chunk-command-menu-2etjx0c7.js} +2 -2
  11. package/dist/chunk-confirm-wn14ffh3.js +1 -0
  12. package/dist/{chunk-connectors-04zaaz71.js → chunk-connectors-zxn3tbnv.js} +2 -2
  13. package/dist/{chunk-conversations-q87kx9w8.js → chunk-conversations-2w67mmvv.js} +1 -1
  14. package/dist/{chunk-council-sheet-zt24kn9f.js → chunk-council-sheet-b4b04w9y.js} +2 -2
  15. package/dist/chunk-council-view-wem4vdqc.js +1 -0
  16. package/dist/{chunk-drag-2vacsw42.js → chunk-drag-r9x782vs.js} +1 -1
  17. package/dist/{chunk-entry-71pd652j.js → chunk-entry-bq3j0xby.js} +1 -1
  18. package/dist/chunk-folder-list-bbn6ctsf.js +1 -0
  19. package/dist/chunk-folds-55w643e1.js +1 -0
  20. package/dist/{chunk-gate-2gpw5rte.js → chunk-gate-d8deb600.js} +1 -1
  21. package/dist/chunk-host-icons-knmx5qa0.js +1 -0
  22. package/dist/chunk-host-picture-42n2n9gp.js +1 -0
  23. package/dist/chunk-host-state-az2ka7rs.js +1 -0
  24. package/dist/chunk-host-ui-1s0xyghd.js +1 -0
  25. package/dist/chunk-index-0xq8m6nw.js +2 -0
  26. package/dist/chunk-index-1k6n0hh9.js +2 -0
  27. package/dist/{chunk-index-04ndj4hg.js → chunk-index-1kvnezap.js} +1 -1
  28. package/dist/{chunk-index-fq7hgc2n.js → chunk-index-25ewnkkb.js} +1 -1
  29. package/dist/chunk-index-3c4wvjkj.js +2 -0
  30. package/dist/chunk-index-4fyrpzwf.js +2 -0
  31. package/dist/{chunk-index-8d5r201w.js → chunk-index-50r5h98m.js} +1 -1
  32. package/dist/{chunk-index-0cnvzj8b.js → chunk-index-5j6m33d2.js} +1 -1
  33. package/dist/chunk-index-5x86qy8d.js +2 -0
  34. package/dist/{chunk-index-r1g24er0.js → chunk-index-63qqjbs8.js} +2 -2
  35. package/dist/{chunk-index-g086dss5.js → chunk-index-6btfp80d.js} +3 -3
  36. package/dist/{chunk-index-dqt0s3cq.js → chunk-index-6r61x1d2.js} +2 -2
  37. package/dist/{chunk-index-5rv9r0m6.js → chunk-index-711j3dpr.js} +2 -2
  38. package/dist/{chunk-index-s2ksy9pa.js → chunk-index-7379m5yw.js} +2 -2
  39. package/dist/{chunk-index-xzey5tdw.js → chunk-index-7wksnc48.js} +2 -2
  40. package/dist/{chunk-index-t7csmbpy.css → chunk-index-96bv2xfw.css} +1 -1
  41. package/dist/{chunk-index-ndhwytvz.js → chunk-index-9hb4042t.js} +1 -1
  42. package/dist/{chunk-index-bz4y6vne.js → chunk-index-9smnxvd0.js} +2 -2
  43. package/dist/{chunk-index-mec7bz30.js → chunk-index-ab60h2c5.js} +1 -1
  44. package/dist/{chunk-index-pz6926p5.js → chunk-index-apbknsyg.js} +2 -2
  45. package/dist/{chunk-index-ne8v2rxx.js → chunk-index-b093s676.js} +12 -12
  46. package/dist/chunk-index-b5924bb7.js +2 -0
  47. package/dist/chunk-index-bdf7gs56.js +2 -0
  48. package/dist/chunk-index-d0vznz2x.js +2 -0
  49. package/dist/{chunk-index-6e9nmad3.js → chunk-index-de5x85yn.js} +2 -2
  50. package/dist/chunk-index-e6z5kyz8.js +2 -0
  51. package/dist/chunk-index-evmzrr8e.js +2 -0
  52. package/dist/chunk-index-fdv6mepk.js +2 -0
  53. package/dist/chunk-index-ff8vzfgq.js +2 -0
  54. package/dist/chunk-index-hd7k712z.js +2 -0
  55. package/dist/{chunk-index-1pgm1gy4.js → chunk-index-hrpmm09c.js} +2 -2
  56. package/dist/{chunk-index-st18ee4w.js → chunk-index-htdkpbrd.js} +17 -17
  57. package/dist/{chunk-index-vxn4zws9.js → chunk-index-jsgs2gmq.js} +3 -3
  58. package/dist/{chunk-index-1ysj78e4.js → chunk-index-kjxva289.js} +1 -1
  59. package/dist/{chunk-index-g7w60s9y.js → chunk-index-kkcx4bns.js} +2 -2
  60. package/dist/{chunk-index-pp00qvdb.js → chunk-index-kvvmxbyh.js} +1 -1
  61. package/dist/{chunk-index-c035z7b4.js → chunk-index-mcb21c5a.js} +2 -2
  62. package/dist/chunk-index-n1w5rpxz.js +2 -0
  63. package/dist/{chunk-index-m7er2xt6.js → chunk-index-n7187vns.js} +2 -2
  64. package/dist/{chunk-index-435pq3gd.js → chunk-index-nk38jsgf.js} +1 -1
  65. package/dist/chunk-index-q6txr5q7.js +2 -0
  66. package/dist/{chunk-index-g1t5rfbe.js → chunk-index-r868k92r.js} +3 -3
  67. package/dist/{chunk-index-ry2p6s1f.js → chunk-index-rj8cvc66.js} +1 -1
  68. package/dist/{chunk-index-tn797j5g.js → chunk-index-rny986v2.js} +1 -1
  69. package/dist/{chunk-index-awc03q99.js → chunk-index-s6a9rvgd.js} +2 -2
  70. package/dist/{chunk-index-jzkr4hc2.js → chunk-index-sjt00y5k.js} +2 -2
  71. package/dist/{chunk-index-qzss6deb.js → chunk-index-sp35q2ay.js} +1 -1
  72. package/dist/{chunk-index-pcb3mskd.js → chunk-index-t9an6yb2.js} +2 -2
  73. package/dist/{chunk-index-0kwxrths.js → chunk-index-tc8s2rz3.js} +1 -1
  74. package/dist/chunk-index-tn9qzrj2.js +2 -0
  75. package/dist/{chunk-index-6y114be2.js → chunk-index-vgn794d7.js} +2 -2
  76. package/dist/{chunk-index-6gj4xkf7.js → chunk-index-vvxr0vz8.js} +1 -1
  77. package/dist/{chunk-index-9q2psqsq.js → chunk-index-w0vfwqck.js} +2 -2
  78. package/dist/{chunk-index-6j75embz.js → chunk-index-w1rarv3r.js} +2 -2
  79. package/dist/chunk-index-xfr1byr9.js +1 -0
  80. package/dist/{chunk-index-smvd91qx.js → chunk-index-xj1960qj.js} +2 -2
  81. package/dist/chunk-index-xwnkf825.js +2 -0
  82. package/dist/{chunk-index-cx9f5fae.js → chunk-index-y37ffyvy.js} +3 -3
  83. package/dist/{chunk-index-tqrjr37v.js → chunk-index-yrr5wvja.js} +2 -2
  84. package/dist/{chunk-index-2k2jvegd.js → chunk-index-z1fvb2kq.js} +3 -3
  85. package/dist/chunk-index-zwfdwgnb.js +138 -0
  86. package/dist/chunk-lang-css-nt7ezre4.js +1 -0
  87. package/dist/{chunk-lang-dockerfile-9rc0adjw.js → chunk-lang-dockerfile-4422dqj4.js} +1 -1
  88. package/dist/{chunk-lang-go-t47kg9n0.js → chunk-lang-go-1n73q49t.js} +1 -1
  89. package/dist/chunk-lang-html-p4yg906g.js +1 -0
  90. package/dist/chunk-lang-javascript-yqkd14sv.js +1 -0
  91. package/dist/{chunk-lang-json-y33kawwg.js → chunk-lang-json-zm1ts7s7.js} +1 -1
  92. package/dist/{chunk-lang-markdown-2c2sqc4z.js → chunk-lang-markdown-3cv6a1mc.js} +2 -2
  93. package/dist/{chunk-lang-python-ymasvj52.js → chunk-lang-python-ba7s8q8w.js} +1 -1
  94. package/dist/{chunk-lang-rust-qcg53mkn.js → chunk-lang-rust-gx2hj5cw.js} +1 -1
  95. package/dist/{chunk-lang-shell-996wb0dk.js → chunk-lang-shell-ec7k63jq.js} +1 -1
  96. package/dist/{chunk-lang-sql-60rh2y3y.js → chunk-lang-sql-svdp20tw.js} +1 -1
  97. package/dist/{chunk-lang-toml-q1yzt70y.js → chunk-lang-toml-nj3sefw0.js} +1 -1
  98. package/dist/chunk-lang-typescript-84y9c0f8.js +1 -0
  99. package/dist/{chunk-lang-xml-k2a92cm3.js → chunk-lang-xml-jzdsx03j.js} +1 -1
  100. package/dist/{chunk-lang-yaml-qp3asq06.js → chunk-lang-yaml-deh87m32.js} +1 -1
  101. package/dist/chunk-layout-actions-x0xxb5da.js +1 -0
  102. package/dist/{chunk-mention-menu-ag4gpcrb.js → chunk-mention-menu-b1k1tm6b.js} +1 -1
  103. package/dist/chunk-menu-items-2meta18j.js +1 -0
  104. package/dist/chunk-mode-toggle-7a44994f.js +1 -0
  105. package/dist/{chunk-note-row-wt0e0xgx.js → chunk-note-row-pab6wtf0.js} +3 -3
  106. package/dist/{chunk-notes-jd0ftn0y.js → chunk-notes-m0sjp2ct.js} +1 -1
  107. package/dist/{chunk-notice-bell-b71028rq.js → chunk-notice-bell-s15pgaw3.js} +1 -1
  108. package/dist/chunk-notices-zs8xg8v8.js +1 -0
  109. package/dist/{chunk-onboarding-fzz1x8vk.js → chunk-onboarding-sddzxrw5.js} +1 -1
  110. package/dist/{chunk-overview-whbzyq7x.js → chunk-overview-gkf6vfks.js} +1 -1
  111. package/dist/chunk-palette-m6bkdz1w.js +1 -0
  112. package/dist/chunk-placement-items-cb66mx65.js +1 -0
  113. package/dist/{chunk-profile-t5kyp6dt.js → chunk-profile-mvj96kv6.js} +1 -1
  114. package/dist/{chunk-prompt-history-cpejc2ce.js → chunk-prompt-history-mffm0c56.js} +1 -1
  115. package/dist/{chunk-prompts-am1gv3rx.js → chunk-prompts-26ey03ak.js} +1 -1
  116. package/dist/chunk-room-confirms-1j8qfyj9.js +1 -0
  117. package/dist/{chunk-room-menu-6swnygxx.js → chunk-room-menu-6myvrac1.js} +1 -1
  118. package/dist/chunk-rooms-menu-button-3cnm8wdd.js +1 -0
  119. package/dist/{chunk-schedules-y982gtmy.js → chunk-schedules-gjfm0x30.js} +1 -1
  120. package/dist/{chunk-seat-menu-2zhkhhav.js → chunk-seat-menu-neps7phz.js} +1 -1
  121. package/dist/chunk-section-fold-pgrjf74t.js +1 -0
  122. package/dist/{chunk-settings-p7rnj58y.js → chunk-settings-aa212bna.js} +1 -1
  123. package/dist/{chunk-sheet-hosts-n4y4b923.js → chunk-sheet-hosts-xwtaf228.js} +2 -2
  124. package/dist/{chunk-shortcut-help-nsspdnr8.js → chunk-shortcut-help-aaat3wrh.js} +2 -2
  125. package/dist/{chunk-shortcuts-2jsfcp8d.js → chunk-shortcuts-wt9x6qd6.js} +1 -1
  126. package/dist/{chunk-skill-editor-641sd772.js → chunk-skill-editor-4jkr948n.js} +2 -2
  127. package/dist/{chunk-skills-4h0sg7n3.js → chunk-skills-87rvtwt1.js} +1 -1
  128. package/dist/{chunk-start-over-line-en9pph7r.js → chunk-start-over-line-59zn5ekf.js} +2 -2
  129. package/dist/chunk-switcher-list-43n1vf29.js +1 -0
  130. package/dist/{chunk-tab-dot-jrv4g9we.js → chunk-tab-dot-773bfgn1.js} +1 -1
  131. package/dist/chunk-table-1ghv10s7.js +1 -0
  132. package/dist/{chunk-table2d-k4z439nt.js → chunk-table2d-4k5n9dxy.js} +1 -1
  133. package/dist/{chunk-table3d-9d3rwkwv.js → chunk-table3d-cwmxe12d.js} +21 -21
  134. package/dist/chunk-thread-actions-dd9ah02w.js +1 -0
  135. package/dist/{chunk-thread-cards-6tftqnrw.js → chunk-thread-cards-qs242xk1.js} +1 -1
  136. package/dist/{chunk-thread-list-wzwzbxx5.js → chunk-thread-list-qxymkzs9.js} +2 -2
  137. package/dist/{chunk-transcript-d9sfpsde.js → chunk-transcript-sjra3d3m.js} +1 -1
  138. package/dist/{chunk-waiting-chip-pq7cgh62.js → chunk-waiting-chip-yq3485cq.js} +2 -2
  139. package/dist/chunk-waiting-xmy1cyk1.js +1 -0
  140. package/dist/chunk-where-m6ss9smq.js +1 -0
  141. package/dist/{chunk-workspace-tb29dr0g.js → chunk-workspace-jt68gwza.js} +2 -2
  142. package/dist/index.html +1 -1
  143. package/dist/sw.js +1 -1
  144. package/package.json +2 -2
  145. package/dist/chunk-account-95rkb2fp.js +0 -1
  146. package/dist/chunk-arranged-rooms-xjpg0rtg.js +0 -1
  147. package/dist/chunk-bulk-actions-m38vtkan.js +0 -1
  148. package/dist/chunk-confirm-t08tacqd.js +0 -1
  149. package/dist/chunk-council-view-m3660jv4.js +0 -1
  150. package/dist/chunk-folder-list-rpccjz2c.js +0 -1
  151. package/dist/chunk-folds-qb9a87bf.js +0 -1
  152. package/dist/chunk-host-icons-vhhks1vc.js +0 -1
  153. package/dist/chunk-host-picture-b8wne78x.js +0 -1
  154. package/dist/chunk-host-state-j9d5bfng.js +0 -1
  155. package/dist/chunk-host-ui-zy96k6pv.js +0 -1
  156. package/dist/chunk-index-0pghg70x.js +0 -2
  157. package/dist/chunk-index-20h87yfa.js +0 -2
  158. package/dist/chunk-index-2srjhjvg.js +0 -2
  159. package/dist/chunk-index-2ywap2mg.js +0 -2
  160. package/dist/chunk-index-4e5nhm4v.js +0 -2
  161. package/dist/chunk-index-4ehy2d04.js +0 -2
  162. package/dist/chunk-index-5n8npdch.js +0 -2
  163. package/dist/chunk-index-8k1ccvmx.js +0 -1
  164. package/dist/chunk-index-90f1mkn7.js +0 -138
  165. package/dist/chunk-index-90tq8g68.js +0 -2
  166. package/dist/chunk-index-92p9wmrg.js +0 -2
  167. package/dist/chunk-index-a36h36x0.js +0 -2
  168. package/dist/chunk-index-dafr7y87.js +0 -2
  169. package/dist/chunk-index-fnmtztjx.js +0 -2
  170. package/dist/chunk-index-pmtgrd3x.js +0 -2
  171. package/dist/chunk-index-qjqxs7c3.js +0 -2
  172. package/dist/chunk-index-r9yg1hpr.js +0 -2
  173. package/dist/chunk-index-w51vgeed.js +0 -2
  174. package/dist/chunk-index-wk3w90nq.js +0 -2
  175. package/dist/chunk-lang-css-6t2q4xw4.js +0 -1
  176. package/dist/chunk-lang-html-c6p22v5m.js +0 -1
  177. package/dist/chunk-lang-javascript-m57t19pw.js +0 -1
  178. package/dist/chunk-lang-typescript-7gcbrhbd.js +0 -1
  179. package/dist/chunk-layout-actions-6vm38ver.js +0 -1
  180. package/dist/chunk-menu-items-fk3m74y3.js +0 -1
  181. package/dist/chunk-mode-toggle-zy1wgyc7.js +0 -1
  182. package/dist/chunk-notices-qhghsyh5.js +0 -1
  183. package/dist/chunk-palette-dgf96b8y.js +0 -1
  184. package/dist/chunk-placement-items-e0bfeqj4.js +0 -1
  185. package/dist/chunk-room-confirms-a3m74jfg.js +0 -1
  186. package/dist/chunk-rooms-menu-button-ret11jfe.js +0 -1
  187. package/dist/chunk-section-fold-h1fpkayc.js +0 -1
  188. package/dist/chunk-switcher-list-pr884et3.js +0 -1
  189. package/dist/chunk-table-g56wwdmh.js +0 -1
  190. package/dist/chunk-thread-actions-y30fzpje.js +0 -1
  191. package/dist/chunk-waiting-emww5evj.js +0 -1
  192. package/dist/chunk-where-e7we9q52.js +0 -1
@@ -1 +1 @@
1
- import{p,r,t,g,e,n,s,x,u,_,Ke,Xt,ye}from"./chunk-index-st18ee4w.js";import{Ue}from"./chunk-index-pmtgrd3x.js";import"./chunk-index-8d5r201w.js";import{bt}from"./chunk-index-90tq8g68.js";import{Mt}from"./chunk-index-fq7hgc2n.js";import{A}from"./chunk-index-04ndj4hg.js";import{Ht}from"./chunk-index-2srjhjvg.js";var h="room-menu-yolo",N="room-menu-long",b="room-menu-mute";function P(a){let[l,m]=r(!1),i=_().app?.modes!==!1,f=u((o)=>o.rooms[a.room]?.view?.home===!1,a.room),c=u((o)=>o.pins.includes(a.room),a.room),d=a.mode??{yolo:!1,longRunning:!1},k=async(o)=>{m(!0),await Xt(a.room,{longRunning:o}),m(!1)};return e(A,{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:x("room",a.parent),onClick:a.onClose,children:[e("span",{className:"menu-icon",children:e(s,{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(s,{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:b,children:[e("span",{className:"menu-icon",children:e(s,{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(Mt,{id:b,checked:!a.muted,label:t("Notifications"),onChange:async(o)=>{m(!0),await Ht(a.room,!o),m(!1)},busy:l})]})}),a.readOnly||!i?null:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:h,children:[e("span",{className:"menu-icon","data-tone":"yolo",children:e(s,{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(Mt,{id:h,checked:d.yolo,label:t("Yolo mode"),onChange:(o)=>{if(o)a.onAskYolo();else m(!0),Xt(a.room,{yolo:!1}).then(()=>m(!1))},busy:l})]})}),a.readOnly||!i?null:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:N,children:[e("span",{className:"menu-icon","data-tone":"long",children:e(s,{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(Mt,{id:N,checked:d.longRunning,label:t("Long-running mode"),onChange:k,busy:l})]})}),a.agent?e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),Ke(a.agent)},children:[e("span",{className:"menu-icon",children:e(s,{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(s,{name:"chevron",size:16})]})}):null,a.agent?e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),Ke(a.agent,{skills:!0})},children:[e("span",{className:"menu-icon",children:e(s,{name:"skills"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Skills")}),e("span",{className:"meta",children:t("Choose the skills this knight carries.")})]}),e(s,{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(),bt({kind:"group",name:a.group})},children:[e("span",{className:"menu-icon",children:e(s,{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(s,{name:"chevron",size:16})]})}):null,a.onEditCouncil?e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),a.onEditCouncil?.()},children:[e("span",{className:"menu-icon",children:e(s,{name:"table"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Edit this council")}),e("span",{className:"meta",children:t("Who sits, or another council")})]}),e(s,{name:"chevron",size:16})]})}):null,a.readOnly||!f?null:n(g,{children:[e("li",{children:n("button",{type:"button",className:"menu-item menu-link",onClick:()=>{a.onClose(),(p("6vm38ver"),import("./chunk-layout-actions-6vm38ver.js")).then((o)=>o.pinRoom(a.room,!c))},children:[e("span",{className:"menu-icon",children:e(s,{name:"pin"})}),n("span",{className:"menu-text",children:[e("strong",{children:c?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(),Ue({kind:"move",room:a.room})},children:[e("span",{className:"menu-icon",children:e(s,{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(s,{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(s,{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(),ye({kind:"archive",room:a.room,name:a.displayName??""})},children:[e("span",{className:"menu-icon","data-tone":"danger",children:e(s,{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{P as RoomMenu};
1
+ import{p,r,t,g,e,n,s,x,l,_,Ke,Xt,ye}from"./chunk-index-htdkpbrd.js";import{Ue}from"./chunk-index-5x86qy8d.js";import"./chunk-index-50r5h98m.js";import{bt}from"./chunk-index-fdv6mepk.js";import{Mt}from"./chunk-index-25ewnkkb.js";import{A}from"./chunk-index-1kvnezap.js";import{Ht}from"./chunk-index-4fyrpzwf.js";var h="room-menu-yolo",N="room-menu-long",b="room-menu-mute";function P(a){let[i,m]=r(!1),u=_().app?.modes!==!1,f=l((o)=>o.rooms[a.room]?.view?.home===!1,a.room),c=l((o)=>o.pins.includes(a.room),a.room),d=a.mode??{yolo:!1,longRunning:!1},k=async(o)=>{m(!0),await Xt(a.room,{longRunning:o}),m(!1)};return e(A,{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:x("room",a.parent),onClick:a.onClose,children:[e("span",{className:"menu-icon",children:e(s,{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(s,{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:b,children:[e("span",{className:"menu-icon",children:e(s,{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(Mt,{id:b,checked:!a.muted,label:t("Notifications"),onChange:async(o)=>{m(!0),await Ht(a.room,!o),m(!1)},busy:i})]})}),a.readOnly||!u?null:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:h,children:[e("span",{className:"menu-icon","data-tone":"yolo",children:e(s,{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(Mt,{id:h,checked:d.yolo,label:t("Yolo mode"),onChange:(o)=>{if(o)a.onAskYolo();else m(!0),Xt(a.room,{yolo:!1}).then(()=>m(!1))},busy:i})]})}),a.readOnly||!u?null:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:N,children:[e("span",{className:"menu-icon","data-tone":"long",children:e(s,{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(Mt,{id:N,checked:d.longRunning,label:t("Long-running mode"),onChange:k,busy:i})]})}),a.agent?e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),Ke(a.agent)},children:[e("span",{className:"menu-icon",children:e(s,{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(s,{name:"chevron",size:16})]})}):null,a.agent?e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),Ke(a.agent,{skills:!0})},children:[e("span",{className:"menu-icon",children:e(s,{name:"skills"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Skills")}),e("span",{className:"meta",children:t("Choose the skills this knight carries.")})]}),e(s,{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(),bt({kind:"group",name:a.group})},children:[e("span",{className:"menu-icon",children:e(s,{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(s,{name:"chevron",size:16})]})}):null,a.onEditCouncil?e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),a.onEditCouncil?.()},children:[e("span",{className:"menu-icon",children:e(s,{name:"table"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Edit this council")}),e("span",{className:"meta",children:t("Who sits, or another council")})]}),e(s,{name:"chevron",size:16})]})}):null,a.readOnly||!f?null:n(g,{children:[e("li",{children:n("button",{type:"button",className:"menu-item menu-link",onClick:()=>{a.onClose(),(p("x0xxb5da"),import("./chunk-layout-actions-x0xxb5da.js")).then((o)=>o.pinRoom(a.room,!c))},children:[e("span",{className:"menu-icon",children:e(s,{name:"pin"})}),n("span",{className:"menu-text",children:[e("strong",{children:c?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(),Ue({kind:"move",room:a.room})},children:[e("span",{className:"menu-icon",children:e(s,{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(s,{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(s,{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(),ye({kind:"archive",room:a.room,name:a.displayName??""})},children:[e("span",{className:"menu-icon","data-tone":"danger",children:e(s,{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{P as RoomMenu};
@@ -0,0 +1 @@
1
+ import{t,e,s,l}from"./chunk-index-htdkpbrd.js";import"./chunk-index-50r5h98m.js";import"./chunk-index-hrpmm09c.js";import"./chunk-index-5x86qy8d.js";import{bi}from"./chunk-index-hd7k712z.js";import"./chunk-index-b5924bb7.js";import"./chunk-index-711j3dpr.js";function r(){if(!l((o)=>o.listed))return null;return e("button",{type:"button",className:"header-button icon-button","aria-haspopup":"menu","aria-label":t("Folders and order"),onClick:(o)=>bi(o.currentTarget),children:e(s,{name:"more",size:18})})}export{r as default};
@@ -1 +1 @@
1
- import{r,t,c,e,n,s,x,y,f,S,m,k,Q,_,oe}from"./chunk-index-st18ee4w.js";import{D}from"./chunk-index-1ysj78e4.js";import{ke}from"./chunk-index-0cnvzj8b.js";import"./chunk-index-04ndj4hg.js";var h={mon:c("Mon"),tue:c("Tue"),wed:c("Wed"),thu:c("Thu"),fri:c("Fri"),sat:c("Sat"),sun:c("Sun")};function w(d){if(typeof d!=="object"||d===null)return"";let o=d,i=typeof o.time==="string"?o.time:"";switch(o.kind){case"once":return t("Once on {date} at {time}",{date:String(o.date??""),time:i});case"every":return Number(o.everyDays)===1?t("Every day at {time}",{time:i}):t("Every {count} days at {time}",{count:Number(o.everyDays),time:i});case"weekly":{let l=Array.isArray(o.weekdays)?o.weekdays.map((u)=>t(h[String(u)]??String(u))).join(t(", ")):"";return t("{days} at {time}",{days:l,time:i})}default:return""}}function V(){let{timeZone:d}=_(),[o,i]=r(0),[l,u]=r(),{data:p,error:g}=ke(()=>y.schedules(),`schedules:${o}`);return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Schedules")})}),g?e(m,{message:g}):null,!p&&!g?e(S,{}):null,p&&p.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:p?.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(Q,{children:a.lastStatus}):null]}),n("p",{className:"meta",children:[w(a.recurrence)," ·"," ",t("next {when}",{when:oe(a.nextRun,d)})]}),e("p",{className:"schedule-prompt",children:a.prompt}),n("p",{className:"meta",children:[a.room?e("a",{href:x("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(s,{name:"trash"})})]},a.id))}),e(D,{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 y.cancelSchedule(l.id),i((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{V as SchedulesPage};
1
+ import{r,t,u,e,n,s,x,y,f,S,m,k,Q,_,oe}from"./chunk-index-htdkpbrd.js";import{D}from"./chunk-index-kjxva289.js";import{ke}from"./chunk-index-5j6m33d2.js";import"./chunk-index-1kvnezap.js";var h={mon:u("Mon"),tue:u("Tue"),wed:u("Wed"),thu:u("Thu"),fri:u("Fri"),sat:u("Sat"),sun:u("Sun")};function w(c){if(typeof c!=="object"||c===null)return"";let o=c,i=typeof o.time==="string"?o.time:"";switch(o.kind){case"once":return t("Once on {date} at {time}",{date:String(o.date??""),time:i});case"every":return Number(o.everyDays)===1?t("Every day at {time}",{time:i}):t("Every {count} days at {time}",{count:Number(o.everyDays),time:i});case"weekly":{let l=Array.isArray(o.weekdays)?o.weekdays.map((d)=>t(h[String(d)]??String(d))).join(t(", ")):"";return t("{days} at {time}",{days:l,time:i})}default:return""}}function V(){let{timeZone:c}=_(),[o,i]=r(0),[l,d]=r(),{data:p,error:g}=ke(()=>y.schedules(),`schedules:${o}`);return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Schedules")})}),g?e(m,{message:g}):null,!p&&!g?e(S,{}):null,p&&p.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:p?.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(Q,{children:a.lastStatus}):null]}),n("p",{className:"meta",children:[w(a.recurrence)," ·"," ",t("next {when}",{when:oe(a.nextRun,c)})]}),e("p",{className:"schedule-prompt",children:a.prompt}),n("p",{className:"meta",children:[a.room?e("a",{href:x("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(s,{name:"trash"})})]},a.id))}),e(D,{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 y.cancelSchedule(l.id),i((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{V as SchedulesPage};
@@ -1 +1 @@
1
- import{Pn}from"./chunk-index-st18ee4w.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 Pn((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{Pn}from"./chunk-index-htdkpbrd.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 Pn((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{fr,hr}from"./chunk-index-y37ffyvy.js";import"./chunk-index-50r5h98m.js";import"./chunk-index-hrpmm09c.js";export{fr as FoldToggle,hr as default};
@@ -1 +1 @@
1
- import{T,b,E,o,r,t,c,g,e,n,s,x,u,y,l,f,_,Or,ni,Hs,ct,Be}from"./chunk-index-st18ee4w.js";import{Si}from"./chunk-index-g7w60s9y.js";import{hn,ds,ki,Fn}from"./chunk-index-bz4y6vne.js";var C;if(typeof window<"u")window.addEventListener("beforeinstallprompt",(d)=>{d.preventDefault(),C=d});var A=()=>typeof matchMedia==="function"&&(matchMedia("(display-mode: standalone)").matches||navigator.standalone===!0),z=[{value:"system",label:c("System"),icon:"system"},{value:"light",label:c("Light"),icon:"sun"},{value:"dark",label:c("Dark"),icon:"moon"}],D=[{value:"modern",label:c("Modern"),hint:c("Plain and neutral, with round avatars.")},{value:"camelot",label:c("Camelot"),hint:c("Parchment by day, night castle by night, gold rules, shield avatars and wax seals.")}];function H({enabled:d,quietHours:p}){let[m,k]=r(),[v,h]=r([]),[N,I]=r(),[w,P]=r(!1),a=E(async()=>{k(await hn()),I(await ds()),h((await y.pushDevices()).devices)},[]);if(o(()=>{if(d)a().catch(()=>k("unsupported"))},[d,a]),!d)return null;let S=async(i)=>{P(!0);try{await i()}catch(L){f(L instanceof Error&&L.message==="permission"?t("Notifications were not allowed. Allow them in the browser's site settings."):l(L),"danger")}finally{await a().catch(()=>{return}),P(!1)}};return n("section",{className:"card stack",children:[e("h2",{children:t("Notifications")}),e("p",{className:"meta",children:m==="unsupported"?t("This browser cannot get push notifications. On iPhone and iPad, install the app from Share, Add to Home Screen, and open it from there."):m==="blocked"?t("Notifications are blocked for this site. Allow them in the browser's site settings."):t("Get a notification on this device when a card waits for you or a knight reports on its own, while the app is not open.")}),p?e("p",{className:"meta",children:t("Quiet hours, {start} to {end} ({zone}): no notification for a knight's report or a notice. A card waiting for you still notifies. The server sets the hours.",{start:p.start,end:p.end,zone:p.timeZone})}):null,m==="off"||m==="on"?e("div",{className:"actions",children:e("button",{type:"button",className:m==="on"?"secondary":void 0,disabled:w,onClick:()=>S(m==="on"?Fn:ki),children:m==="on"?t("Turn off on this device"):t("Turn on for this device")})}):null,v.length>0?e("ul",{className:"stack",children:v.map((i)=>n("li",{className:"card-head",children:[n("span",{children:[i.label??t("Device"),i.id===N?` (${t("this device")})`:""]}),e("button",{type:"button",className:"secondary",disabled:w,onClick:()=>S(async()=>{if(i.id===N)await Fn();else await y.removePushDevice(i.id)}),children:t("Remove")})]},i.id))}):null]})}var M=b(()=>Be().then((d)=>({default:d.HostSettingsPages})));function X(){let{preference:d}=ni(),p=ct(),m=_(),k=m.look??"modern",v=u((a)=>a.principal),[h,N]=r(),[I,w]=r(C!==void 0);o(()=>{y.session().then(N,()=>{return});let a=()=>w(!0);return window.addEventListener("beforeinstallprompt",a),()=>window.removeEventListener("beforeinstallprompt",a)},[]);let P=A();return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Settings")})}),m.pages?.some((a)=>a.place==="settings")?e(T,{fallback:null,children:e(M,{})}):null,n("section",{className:"card stack",children:[e("h2",{children:t("Appearance")}),n("fieldset",{className:"segmented segmented-wide",children:[e("legend",{className:"visually-hidden",children:t("Color scheme")}),z.map((a)=>n("label",{"data-checked":d===a.value,children:[e("input",{type:"radio",name:"theme",checked:d===a.value,onChange:(S)=>{let i=S.target.getBoundingClientRect();Or(a.value,{x:i.left+i.width/2,y:i.top+i.height/2})}}),e(s,{name:a.icon,size:18}),t(a.label)]},a.value))]}),n("fieldset",{className:"segmented segmented-wide",children:[e("legend",{className:"visually-hidden",children:t("Look")}),D.map((a)=>n("label",{"data-checked":p===a.value,children:[e("input",{type:"radio",name:"look",checked:p===a.value,onChange:()=>Hs(a.value===k?void 0:a.value)}),n("span",{className:"look-swatch","data-swatch":a.value,"aria-hidden":"true",children:[e("i",{}),e("i",{}),e("i",{})]}),t(a.label)]},a.value))]}),e("p",{className:"meta",children:t(D.find((a)=>a.value===p)?.hint??"")})]}),n("section",{className:"card stack",children:[e("h2",{children:t("Install")}),P?e("p",{className:"meta",children:t("This page is installed on this device.")}):I?n(g,{children:[e("p",{className:"meta",children:t("Install it to open from your home screen or dock, in its own window.")}),e("div",{className:"actions",children:n("button",{type:"button",onClick:async()=>{await C?.prompt(),C=void 0,w(!1)},children:[e(s,{name:"download",size:16}),t("Install the app")]})})]}):e("p",{className:"meta",children:t("To install it, use your browser's Install option, or on iPhone and iPad, Share and then Add to Home Screen.")})]}),h?.prompts?n("section",{className:"card stack",children:[e("h2",{children:t("Main prompts")}),e("ul",{className:"menu",children:e("li",{children:n("a",{className:"menu-item menu-link",href:x("prompts"),children:[n("span",{className:"menu-text",children:[e("strong",{children:t("Edit the main prompts")}),e("span",{className:"meta",children:t("The texts the main knight and the other knights start from, with a diff to read before you save and a way back to the file's text.")})]}),e(s,{name:"chevron",size:16})]})})})]}):null,e(H,{enabled:h?.push===!0,quietHours:h?.quietHours}),n("section",{className:"card stack",children:[e("h2",{children:t("Account")}),e("p",{className:"meta",children:v?t("Signed in as {name}.",{name:v.name}):h?t("Signed in as {name}.",{name:h.principal.name}):""}),h?e(Si,{auth:h.auth}):null]})]})}export{X as SettingsPage};
1
+ import{T,b,E,o,r,t,u,g,e,n,s,x,l,y,c,f,_,yr,ni,Ks,ct,Be}from"./chunk-index-htdkpbrd.js";import{wi}from"./chunk-index-kkcx4bns.js";import{hn,hs,_i,Fn}from"./chunk-index-9smnxvd0.js";var C;if(typeof window<"u")window.addEventListener("beforeinstallprompt",(d)=>{d.preventDefault(),C=d});var A=()=>typeof matchMedia==="function"&&(matchMedia("(display-mode: standalone)").matches||navigator.standalone===!0),z=[{value:"system",label:u("System"),icon:"system"},{value:"light",label:u("Light"),icon:"sun"},{value:"dark",label:u("Dark"),icon:"moon"}],D=[{value:"modern",label:u("Modern"),hint:u("Plain and neutral, with round avatars.")},{value:"camelot",label:u("Camelot"),hint:u("Parchment by day, night castle by night, gold rules, shield avatars and wax seals.")}];function H({enabled:d,quietHours:p}){let[m,k]=r(),[v,h]=r([]),[N,I]=r(),[w,P]=r(!1),a=E(async()=>{k(await hn()),I(await hs()),h((await y.pushDevices()).devices)},[]);if(o(()=>{if(d)a().catch(()=>k("unsupported"))},[d,a]),!d)return null;let S=async(i)=>{P(!0);try{await i()}catch(L){f(L instanceof Error&&L.message==="permission"?t("Notifications were not allowed. Allow them in the browser's site settings."):c(L),"danger")}finally{await a().catch(()=>{return}),P(!1)}};return n("section",{className:"card stack",children:[e("h2",{children:t("Notifications")}),e("p",{className:"meta",children:m==="unsupported"?t("This browser cannot get push notifications. On iPhone and iPad, install the app from Share, Add to Home Screen, and open it from there."):m==="blocked"?t("Notifications are blocked for this site. Allow them in the browser's site settings."):t("Get a notification on this device when a card waits for you or a knight reports on its own, while the app is not open.")}),p?e("p",{className:"meta",children:t("Quiet hours, {start} to {end} ({zone}): no notification for a knight's report or a notice. A card waiting for you still notifies. The server sets the hours.",{start:p.start,end:p.end,zone:p.timeZone})}):null,m==="off"||m==="on"?e("div",{className:"actions",children:e("button",{type:"button",className:m==="on"?"secondary":void 0,disabled:w,onClick:()=>S(m==="on"?Fn:_i),children:m==="on"?t("Turn off on this device"):t("Turn on for this device")})}):null,v.length>0?e("ul",{className:"stack",children:v.map((i)=>n("li",{className:"card-head",children:[n("span",{children:[i.label??t("Device"),i.id===N?` (${t("this device")})`:""]}),e("button",{type:"button",className:"secondary",disabled:w,onClick:()=>S(async()=>{if(i.id===N)await Fn();else await y.removePushDevice(i.id)}),children:t("Remove")})]},i.id))}):null]})}var M=b(()=>Be().then((d)=>({default:d.HostSettingsPages})));function X(){let{preference:d}=ni(),p=ct(),m=_(),k=m.look??"modern",v=l((a)=>a.principal),[h,N]=r(),[I,w]=r(C!==void 0);o(()=>{y.session().then(N,()=>{return});let a=()=>w(!0);return window.addEventListener("beforeinstallprompt",a),()=>window.removeEventListener("beforeinstallprompt",a)},[]);let P=A();return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Settings")})}),m.pages?.some((a)=>a.place==="settings")?e(T,{fallback:null,children:e(M,{})}):null,n("section",{className:"card stack",children:[e("h2",{children:t("Appearance")}),n("fieldset",{className:"segmented segmented-wide",children:[e("legend",{className:"visually-hidden",children:t("Color scheme")}),z.map((a)=>n("label",{"data-checked":d===a.value,children:[e("input",{type:"radio",name:"theme",checked:d===a.value,onChange:(S)=>{let i=S.target.getBoundingClientRect();yr(a.value,{x:i.left+i.width/2,y:i.top+i.height/2})}}),e(s,{name:a.icon,size:18}),t(a.label)]},a.value))]}),n("fieldset",{className:"segmented segmented-wide",children:[e("legend",{className:"visually-hidden",children:t("Look")}),D.map((a)=>n("label",{"data-checked":p===a.value,children:[e("input",{type:"radio",name:"look",checked:p===a.value,onChange:()=>Ks(a.value===k?void 0:a.value)}),n("span",{className:"look-swatch","data-swatch":a.value,"aria-hidden":"true",children:[e("i",{}),e("i",{}),e("i",{})]}),t(a.label)]},a.value))]}),e("p",{className:"meta",children:t(D.find((a)=>a.value===p)?.hint??"")})]}),n("section",{className:"card stack",children:[e("h2",{children:t("Install")}),P?e("p",{className:"meta",children:t("This page is installed on this device.")}):I?n(g,{children:[e("p",{className:"meta",children:t("Install it to open from your home screen or dock, in its own window.")}),e("div",{className:"actions",children:n("button",{type:"button",onClick:async()=>{await C?.prompt(),C=void 0,w(!1)},children:[e(s,{name:"download",size:16}),t("Install the app")]})})]}):e("p",{className:"meta",children:t("To install it, use your browser's Install option, or on iPhone and iPad, Share and then Add to Home Screen.")})]}),h?.prompts?n("section",{className:"card stack",children:[e("h2",{children:t("Main prompts")}),e("ul",{className:"menu",children:e("li",{children:n("a",{className:"menu-item menu-link",href:x("prompts"),children:[n("span",{className:"menu-text",children:[e("strong",{children:t("Edit the main prompts")}),e("span",{className:"meta",children:t("The texts the main knight and the other knights start from, with a diff to read before you save and a way back to the file's text.")})]}),e(s,{name:"chevron",size:16})]})})})]}):null,e(H,{enabled:h?.push===!0,quietHours:h?.quietHours}),n("section",{className:"card stack",children:[e("h2",{children:t("Account")}),e("p",{className:"meta",children:v?t("Signed in as {name}.",{name:v.name}):h?t("Signed in as {name}.",{name:h.principal.name}):""}),h?e(wi,{auth:h.auth}):null]})]})}export{X as SettingsPage};
@@ -1,4 +1,4 @@
1
- import{p,T,b,E,o,R,C,a,r,t,c,g,e,n,s,X,u,fe,y,l,f,S,m,k,_,Te,Qn,ho,Ks,ye,he,Cn,te,tt,ri}from"./chunk-index-st18ee4w.js";import{is}from"./chunk-index-2ywap2mg.js";import{D}from"./chunk-index-1ysj78e4.js";import{no,Vs,qs,io,Fs}from"./chunk-index-4ehy2d04.js";import{bs,Hr,vs}from"./chunk-index-0pghg70x.js";import"./chunk-index-pmtgrd3x.js";import"./chunk-index-fnmtztjx.js";import"./chunk-index-8d5r201w.js";import{Dr}from"./chunk-index-6y114be2.js";import"./chunk-index-1pgm1gy4.js";import"./chunk-index-r1g24er0.js";import"./chunk-index-dqt0s3cq.js";import{Ci,Ms}from"./chunk-index-90tq8g68.js";import{Zn}from"./chunk-index-g1t5rfbe.js";import{Nn}from"./chunk-index-s2ksy9pa.js";import{pn,rr,Br,or}from"./chunk-index-92p9wmrg.js";import{de}from"./chunk-index-tn797j5g.js";import{yt}from"./chunk-index-0kwxrths.js";import{Zt}from"./chunk-index-ry2p6s1f.js";import{Mt}from"./chunk-index-fq7hgc2n.js";import{Ee}from"./chunk-index-g086dss5.js";import{H}from"./chunk-index-a36h36x0.js";import{A}from"./chunk-index-04ndj4hg.js";import"./chunk-index-w51vgeed.js";import{Ht}from"./chunk-index-2srjhjvg.js";import{B}from"./chunk-index-fw6kawhw.js";import"./chunk-index-dafr7y87.js";import{re,Ie}from"./chunk-index-pp00qvdb.js";import"./chunk-index-5rv9r0m6.js";import"./chunk-index-20h87yfa.js";import"./chunk-index-9q2psqsq.js";var je=b(()=>(p("cpejc2ce"),import("./chunk-prompt-history-cpejc2ce.js")).then((i)=>({default:i.HistorySheet}))),Ke=b(()=>(p("26fptwb3"),import("./chunk-character-creator-26fptwb3.js")).then((i)=>({default:i.CharacterCreator}))),Qe=["default","off","minimal","low","medium","high","xhigh"],Se={default:c("Default"),off:c("Off"),minimal:c("Minimal"),low:c("Low"),medium:c("Medium"),high:c("High"),xhigh:c("Very high")},Z="default",Ce=(i)=>i.model===void 0?t("Default model ({current})",{current:i.effective.model}):t("Default model (server setting)"),Ue=c("Automatic"),pe=(i)=>i==="auto"?t(Ue):t(Se[i]??i),Ne=(i)=>({displayName:i.displayName,prompt:i.prompt,model:i.model??Z,thinking:i.thinking??Z});function we(i,h){return{...h.displayName!==i.displayName?{displayName:h.displayName}:{},...h.prompt!==i.prompt?{prompt:h.prompt}:{},...h.model!==(i.model??Z)?{model:h.model}:{},...h.thinking!==(i.thinking??Z)?{thinking:h.thinking}:{}}}function Ae(){let i=Ks(),h=a(i);if(i)h.current=i;let d=h.current,N=i!==void 0;if(o(()=>{if(!N)return;let w=window.location.href,v=()=>{if(window.location.href!==w)Qn()};return window.addEventListener("popstate",v),window.addEventListener("hashchange",v),()=>{window.removeEventListener("popstate",v),window.removeEventListener("hashchange",v)}},[N]),!d)return null;return e(A,{open:i!==void 0,title:t("Edit knight"),size:"wide",onClose:Qn,children:e(qe,{name:d.name,opened:d.id},d.name)})}function qe({name:i,opened:h}){let[d,N]=r(),[w,v]=r([]),[I,W]=r(),[L,z]=r(),[G,U]=r(!1),[x,M]=r(!1),[V,j]=r(!1),[Q,Y]=r(!1),se=ri(d?.room??""),ee=a(null),ne=d!==void 0,J=u((F)=>d?F.rooms[d.room]?.view?.muted===!0:!1,d?.room??""),[ie,q]=r(!1),le=u((F)=>d?F.rooms[d.room]?.view?.coordinator===!0:!1,d?.room??""),oe=R(),ae=R(),O=R();o(()=>{if(!ne||!ho()?.look)return;ee.current?.scrollIntoView({block:"start"}),ee.current?.focus({preventScroll:!0})},[ne,h]);let P=a({});P.current={profile:d,draft:L},o(()=>{let F=!0;return Promise.all([y.agent(i),y.models()]).then(([ce,We])=>{if(!F)return;let{profile:ke,draft:ue}=P.current,_e=ke&&ue&&Object.keys(we(ke,ue)).length>0;N(ce),v(We.models),z(_e?ue:Ne(ce))},(ce)=>F&&W(l(ce))),()=>{F=!1}},[i,h]);let K=C(()=>d&&L?we(d,L):{},[d,L]);if(I)return e(m,{message:I});if(!d||!L)return e(S,{});let ve=Object.keys(K).length>0,ze=Array.from(new Set([Z,...w,L.model])),Be=Ce(d),be=async()=>{U(!0);try{let F=await y.updateAgent(i,K);N(F),z(Ne(F)),M(!1),f(t("Saved."))}catch(F){f(l(F),"danger")}finally{U(!1)}};return n("div",{className:"stack agent-sheet",children:[n("header",{className:"profile-head",children:[e(he,{spec:d.character,name:d.name,size:72,state:se,label:d.displayName}),n("div",{children:[e("h3",{children:d.displayName}),e("p",{className:"meta",children:t("Runs on {model}, thinking {thinking}",{model:d.effective.model,thinking:pe(d.effective.thinking)})})]})]}),e("ul",{className:"menu",children:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:O,children:[e("span",{className:"menu-icon",children:e(s,{name:J?"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(Mt,{id:O,checked:!J,label:t("Notifications"),busy:ie,onChange:async(F)=>{q(!0),await Ht(d.room,!F),q(!1)}})]})})}),x?e(Je,{profile:d,draft:L,saving:G,onBack:()=>M(!1),onSave:be}):n("form",{className:"stack form",onSubmit:(F)=>{if(F.preventDefault(),!ve)return;if(K.prompt!==void 0)M(!0);else be()},children:[n("label",{htmlFor:ae,children:[t("Name"),e("input",{id:ae,value:L.displayName,onChange:(F)=>z({...L,displayName:F.target.value})})]}),n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:oe,children:t("Prompt")}),n("span",{className:"field-tools",children:[n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>Y(!0),children:[e(s,{name:"reset",size:16}),t("History")]}),n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>j(!0),children:[e(Ye,{}),t("Full screen")]})]})]}),e("textarea",{id:oe,rows:8,value:L.prompt,onChange:(F)=>z({...L,prompt:F.target.value})})]}),e(Zt,{label:t("Model"),value:L.model,onChange:(F)=>z({...L,model:F}),options:ze.map((F)=>({value:F,label:F===Z?Be:F}))}),e(Zt,{label:t("Thinking level"),value:L.thinking,onChange:(F)=>z({...L,thinking:F}),options:Qe.map((F)=>({value:F,label:t(Se[F])}))}),e("div",{className:"actions",children:e("button",{type:"submit",disabled:!ve||G,children:G?t("Saving…"):K.prompt!==void 0?t("Review changes"):t("Save")})})]}),e(Ze,{name:i,opened:h}),n("section",{className:"card stack",ref:ee,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(T,{fallback:e(S,{}),children:e(Ke,{name:d.name,displayName:d.displayName,prompt:d.prompt,character:d.character,onSaved:(F)=>N(F)})})]}),le?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:()=>{Qn(),ye({kind:"archive",room:d.room,name:d.displayName})},children:t("Archive {name}",{name:d.displayName})})})]}),Q?e(T,{fallback:null,children:e(je,{open:Q,title:t("History of the prompt"),load:async()=>(await de.agentPromptHistory(i)).versions.map((F)=>({id:F.id,text:F.text,previous:F.previous,by:F.by,at:F.at})),onUse:(F)=>{z({...L,prompt:F}),Y(!1)},onClose:()=>Y(!1)})}):null,e(A,{open:V,title:t("Prompt"),size:"full",onClose:()=>j(!1),children:e("textarea",{className:"prompt-full","aria-label":t("Prompt"),value:L.prompt,onChange:(F)=>z({...L,prompt:F.target.value})})})]})}function Ze({name:i,opened:h}){let[d,N]=r(),[w,v]=r(),[I,W]=r(),L=R(),z=a(null),G=d!==void 0;if(o(()=>{if(!G||!ho()?.skills)return;z.current?.scrollIntoView({block:"start"}),z.current?.focus({preventScroll:!0})},[G,h]),o(()=>{let M=!0;return re.skills(i).then((V)=>M&&N(V),(V)=>{if(M&&!(V instanceof fe&&V.status===404))W(l(V))}),()=>{M=!1}},[i,h]),I)return e(m,{message:I});if(!d)return null;let U=()=>re.skills(i).then(N,(M)=>{f(l(M),"danger")}),x=async(M,V)=>{v(M);try{N(await re.setSkills(i,V?{add:[M]}:{remove:[M]}))}catch(j){f(l(j),"danger")}finally{v(void 0)}};return n("section",{className:"card stack","aria-label":t("Skills"),ref:z,tabIndex:-1,children:[e("h3",{children:t("Skills ({count})",{count:d.skills.filter((M)=>M.carried).length})}),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:d.skills.map((M,V)=>{let j=`${L}-${V}`;return e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:j,children:[n("span",{className:"menu-text",children:[e("strong",{children:M.name}),e("span",{className:"meta",children:M.missing?t("Its file cannot be read."):M.builtin?t("Built in: every knight carries it."):M.description??""})]}),e(Mt,{id:j,checked:M.carried,label:M.name,busy:w===M.name,disabled:M.builtin,onChange:(Q)=>x(M.name,Q)})]})},M.name)})}),e(Xe,{name:i,view:d,onApplied:U})]})}function Xe({name:i,view:h,onApplied:d}){let[N,w]=r(),[v,I]=r(),W=R();if(o(()=>{let x=!0;return de.skillGroups().then((M)=>x&&w(M.groups),()=>{return}),()=>{x=!1}},[]),!N?.length)return null;let L=new Set(h.skills.filter((x)=>x.carried).map((x)=>x.name)),z=new Set(h.skills.filter((x)=>x.builtin).map((x)=>x.name)),G=(x)=>x.skills.filter((M)=>!L.has(M)),U=(x)=>x.skills.filter((M)=>L.has(M)&&!z.has(M));return n("div",{className:"stack skill-apply",children:[e("h4",{children:t("Skill groups")}),e("p",{className:"meta",children:t("Switching a group on switches on its skills this knight lacks; switching it off switches off its skills, built-in ones excepted.")}),e("ul",{className:"menu",children:N.map((x,M)=>{let V=G(x),j=V.length===0;return e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:`${W}-group-${M}`,children:[n("span",{className:"menu-text",children:[e("strong",{children:x.name}),e("span",{className:"meta",children:j?t("Carries all of it."):t("Lacks {count}: {skills}",{count:V.length,skills:V.join(", ")})})]}),e(Mt,{id:`${W}-group-${M}`,checked:j,label:t("Skill group {name}",{name:x.name}),disabled:j&&U(x).length===0,onChange:(Q)=>I({group:x,on:Q})})]})},x.name)})}),e(D,{open:v!==void 0,title:v?.on?t("Switch this skill group on?"):t("Switch this skill group off?"),confirmLabel:v?.on?t("Switch on"):t("Switch off"),tone:v?.on?"primary":"danger",onClose:()=>I(void 0),onConfirm:async()=>{if(!v)return;let{added:x,removed:M}=await de.applySkillGroup(v.group.name,i,v.on);f(x.length?t("Switched on: {skills}",{skills:x.join(", ")}):M.length?t("Switched off: {skills}",{skills:M.join(", ")}):t("Nothing changed for {name}.",{name:v.group.name})),d()},children:e("p",{children:v?v.on?t("{agent} will also carry: {skills}.",{agent:i,skills:G(v.group).join(", ")}):t("{agent} will no longer carry: {skills}.",{agent:i,skills:U(v.group).join(", ")}):null})})]})}var Ye=()=>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 Je(i){let{profile:h,draft:d}=i,N=a(null);o(()=>N.current?.focus(),[]);let w=[];if(d.displayName!==h.displayName)w.push({label:t("Name"),before:h.displayName,after:d.displayName});let v=(I)=>I===Z?Ce(h):I;if(d.model!==(h.model??Z))w.push({label:t("Model"),before:v(h.model??Z),after:v(d.model)});if(d.thinking!==(h.thinking??Z))w.push({label:t("Thinking level"),before:pe(h.thinking??Z),after:pe(d.thinking)});return n("section",{ref:N,className:"stack review",tabIndex:-1,"aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),w.length?e("ul",{className:"review-fields",children:w.map((I)=>n("li",{children:[e("strong",{children:I.label}),e("span",{className:"review-before",children:I.before}),e("span",{"aria-hidden":"true",children:"→"}),e("span",{className:"review-after",children:I.after})]},I.label))}):null,e(yt,{label:t("Prompt"),before:h.prompt,after:d.prompt}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:i.saving,onClick:i.onBack,children:t("Back to editing")}),e("button",{type:"button",disabled:i.saving,onClick:i.onSave,children:i.saving?t("Saving…"):t("Save")})]})]})}var et=300000;function xe(){let i=qs(),[h,d]=r(i);if(i&&i!==h)d(i);if(!h)return null;return e(A,{open:i!==void 0,title:t("Archived conversation"),size:"wide",onClose:Vs,children:e(nt,{room:h.room,until:h.until},`${h.room}:${h.until}`)})}function nt(i){B("archived-log",".archived-log .messages { padding: 0; }");let{timeZone:h}=_(),d=tt(),[N,w]=r(),[v,I]=r(!1),[W,L]=r(),[z,G]=r(!1),{room:U,until:x}=i;o(()=>{let V=!0;return no.page(U,x).then((j)=>{if(!V)return;w(j.messages),I(j.more)},(j)=>{if(V)L(l(j))}),()=>{V=!1}},[U,x]);let M=async()=>{let V=N?.[0];if(!V||z)return;G(!0);try{let j=await no.page(U,x,V.id);w((Q)=>[...j.messages,...Q??[]]),I(j.more)}catch(j){L(l(j))}G(!1)};if(W)return e(m,{message:W});if(!N)return e(S,{});if(N.length===0)return e(k,{children:t("The archived conversation has no messages.")});return n("div",{className:"archived-log",children:[v?e("button",{type:"button",className:"secondary older",disabled:z,onClick:M,children:z?t("Loading…"):t("Load earlier messages")}):null,e("ol",{className:"messages",children:N.map((V,j)=>{let Q=N[j-1],Y=!Q||Q.kind!==V.kind||Q.author!==V.author||Date.parse(V.at)-Date.parse(Q.at)>et;return e(Cn,{message:V,character:V.agent?d[V.agent]:void 0,header:Y,enter:!1,unread:!1,timeZone:h,quotable:!1},V.id)})})]})}function ot(i){let{message:h}=i,[d,N]=r(h.text),w=a(null);o(()=>{w.current?.focus(),w.current?.setSelectionRange(d.length,d.length)},[d.length]);let v=d.trim(),I=v===""&&h.files.length===0;return n("form",{className:"stack",onSubmit:(L)=>{if(L.preventDefault(),I)return;if(v!==h.text)bs(h,v);i.onClose()},children:[e("div",{className:"field",children:e("textarea",{ref:w,className:"queued-edit-text",rows:6,value:d,"aria-label":t("Edit"),onChange:(L)=>N(L.target.value)})}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:i.onClose,children:t("Cancel")}),e("button",{type:"submit",disabled:I,children:t("Save")})]})]})}function Me(){let i=vs(),h=a(void 0);if(i)h.current=i;let d=h.current;if(!d)return null;return e(H,{open:i!==void 0,title:t("Edit"),onClose:Hr,children:e(ot,{message:d,onClose:Hr},d.id)})}var at=`
1
+ import{p,T,b,E,o,R,C,a,r,t,u,g,e,n,s,X,l,fe,y,c,f,S,m,k,_,Te,Qn,po,ea,ye,he,Cn,te,tt,ri}from"./chunk-index-htdkpbrd.js";import{rs}from"./chunk-index-tn9qzrj2.js";import{D}from"./chunk-index-kjxva289.js";import{io,Bs,Fs,ro,Zs}from"./chunk-index-e6z5kyz8.js";import{xs,jr,Ss}from"./chunk-index-xwnkf825.js";import"./chunk-index-5x86qy8d.js";import"./chunk-index-d0vznz2x.js";import"./chunk-index-50r5h98m.js";import{Ur}from"./chunk-index-vgn794d7.js";import"./chunk-index-hrpmm09c.js";import"./chunk-index-63qqjbs8.js";import"./chunk-index-6r61x1d2.js";import{Ei,Cs}from"./chunk-index-fdv6mepk.js";import{Zn}from"./chunk-index-r868k92r.js";import{Nn}from"./chunk-index-7379m5yw.js";import{pn,or,Fr,sr}from"./chunk-index-1k6n0hh9.js";import{de}from"./chunk-index-rny986v2.js";import{yt}from"./chunk-index-tc8s2rz3.js";import{Zt}from"./chunk-index-rj8cvc66.js";import{Mt}from"./chunk-index-25ewnkkb.js";import{Ae}from"./chunk-index-6btfp80d.js";import{H}from"./chunk-index-evmzrr8e.js";import{A}from"./chunk-index-1kvnezap.js";import"./chunk-index-3c4wvjkj.js";import{Ht}from"./chunk-index-4fyrpzwf.js";import{B}from"./chunk-index-fw6kawhw.js";import"./chunk-index-b5924bb7.js";import{re,Ie}from"./chunk-index-kvvmxbyh.js";import"./chunk-index-711j3dpr.js";import"./chunk-index-n1w5rpxz.js";import"./chunk-index-w0vfwqck.js";var je=b(()=>(p("mffm0c56"),import("./chunk-prompt-history-mffm0c56.js")).then((i)=>({default:i.HistorySheet}))),Ke=b(()=>(p("x8grfnwr"),import("./chunk-character-creator-x8grfnwr.js")).then((i)=>({default:i.CharacterCreator}))),Qe=["default","off","minimal","low","medium","high","xhigh"],Se={default:u("Default"),off:u("Off"),minimal:u("Minimal"),low:u("Low"),medium:u("Medium"),high:u("High"),xhigh:u("Very high")},Z="default",Ce=(i)=>i.model===void 0?t("Default model ({current})",{current:i.effective.model}):t("Default model (server setting)"),Ue=u("Automatic"),pe=(i)=>i==="auto"?t(Ue):t(Se[i]??i),Ne=(i)=>({displayName:i.displayName,prompt:i.prompt,model:i.model??Z,thinking:i.thinking??Z});function we(i,h){return{...h.displayName!==i.displayName?{displayName:h.displayName}:{},...h.prompt!==i.prompt?{prompt:h.prompt}:{},...h.model!==(i.model??Z)?{model:h.model}:{},...h.thinking!==(i.thinking??Z)?{thinking:h.thinking}:{}}}function Ee(){let i=ea(),h=a(i);if(i)h.current=i;let d=h.current,N=i!==void 0;if(o(()=>{if(!N)return;let w=window.location.href,v=()=>{if(window.location.href!==w)Qn()};return window.addEventListener("popstate",v),window.addEventListener("hashchange",v),()=>{window.removeEventListener("popstate",v),window.removeEventListener("hashchange",v)}},[N]),!d)return null;return e(A,{open:i!==void 0,title:t("Edit knight"),size:"wide",onClose:Qn,children:e(qe,{name:d.name,opened:d.id},d.name)})}function qe({name:i,opened:h}){let[d,N]=r(),[w,v]=r([]),[I,W]=r(),[L,z]=r(),[G,U]=r(!1),[x,M]=r(!1),[V,j]=r(!1),[Q,Y]=r(!1),se=ri(d?.room??""),ee=a(null),ne=d!==void 0,J=l((F)=>d?F.rooms[d.room]?.view?.muted===!0:!1,d?.room??""),[ie,q]=r(!1),le=l((F)=>d?F.rooms[d.room]?.view?.coordinator===!0:!1,d?.room??""),oe=R(),ae=R(),O=R();o(()=>{if(!ne||!po()?.look)return;ee.current?.scrollIntoView({block:"start"}),ee.current?.focus({preventScroll:!0})},[ne,h]);let P=a({});P.current={profile:d,draft:L},o(()=>{let F=!0;return Promise.all([y.agent(i),y.models()]).then(([ce,We])=>{if(!F)return;let{profile:ke,draft:ue}=P.current,_e=ke&&ue&&Object.keys(we(ke,ue)).length>0;N(ce),v(We.models),z(_e?ue:Ne(ce))},(ce)=>F&&W(c(ce))),()=>{F=!1}},[i,h]);let K=C(()=>d&&L?we(d,L):{},[d,L]);if(I)return e(m,{message:I});if(!d||!L)return e(S,{});let ve=Object.keys(K).length>0,ze=Array.from(new Set([Z,...w,L.model])),Be=Ce(d),be=async()=>{U(!0);try{let F=await y.updateAgent(i,K);N(F),z(Ne(F)),M(!1),f(t("Saved."))}catch(F){f(c(F),"danger")}finally{U(!1)}};return n("div",{className:"stack agent-sheet",children:[n("header",{className:"profile-head",children:[e(he,{spec:d.character,name:d.name,size:72,state:se,label:d.displayName}),n("div",{children:[e("h3",{children:d.displayName}),e("p",{className:"meta",children:t("Runs on {model}, thinking {thinking}",{model:d.effective.model,thinking:pe(d.effective.thinking)})})]})]}),e("ul",{className:"menu",children:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:O,children:[e("span",{className:"menu-icon",children:e(s,{name:J?"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(Mt,{id:O,checked:!J,label:t("Notifications"),busy:ie,onChange:async(F)=>{q(!0),await Ht(d.room,!F),q(!1)}})]})})}),x?e(Je,{profile:d,draft:L,saving:G,onBack:()=>M(!1),onSave:be}):n("form",{className:"stack form",onSubmit:(F)=>{if(F.preventDefault(),!ve)return;if(K.prompt!==void 0)M(!0);else be()},children:[n("label",{htmlFor:ae,children:[t("Name"),e("input",{id:ae,value:L.displayName,onChange:(F)=>z({...L,displayName:F.target.value})})]}),n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:oe,children:t("Prompt")}),n("span",{className:"field-tools",children:[n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>Y(!0),children:[e(s,{name:"reset",size:16}),t("History")]}),n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>j(!0),children:[e(Ye,{}),t("Full screen")]})]})]}),e("textarea",{id:oe,rows:8,value:L.prompt,onChange:(F)=>z({...L,prompt:F.target.value})})]}),e(Zt,{label:t("Model"),value:L.model,onChange:(F)=>z({...L,model:F}),options:ze.map((F)=>({value:F,label:F===Z?Be:F}))}),e(Zt,{label:t("Thinking level"),value:L.thinking,onChange:(F)=>z({...L,thinking:F}),options:Qe.map((F)=>({value:F,label:t(Se[F])}))}),e("div",{className:"actions",children:e("button",{type:"submit",disabled:!ve||G,children:G?t("Saving…"):K.prompt!==void 0?t("Review changes"):t("Save")})})]}),e(Ze,{name:i,opened:h}),n("section",{className:"card stack",ref:ee,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(T,{fallback:e(S,{}),children:e(Ke,{name:d.name,displayName:d.displayName,prompt:d.prompt,character:d.character,onSaved:(F)=>N(F)})})]}),le?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:()=>{Qn(),ye({kind:"archive",room:d.room,name:d.displayName})},children:t("Archive {name}",{name:d.displayName})})})]}),Q?e(T,{fallback:null,children:e(je,{open:Q,title:t("History of the prompt"),load:async()=>(await de.agentPromptHistory(i)).versions.map((F)=>({id:F.id,text:F.text,previous:F.previous,by:F.by,at:F.at})),onUse:(F)=>{z({...L,prompt:F}),Y(!1)},onClose:()=>Y(!1)})}):null,e(A,{open:V,title:t("Prompt"),size:"full",onClose:()=>j(!1),children:e("textarea",{className:"prompt-full","aria-label":t("Prompt"),value:L.prompt,onChange:(F)=>z({...L,prompt:F.target.value})})})]})}function Ze({name:i,opened:h}){let[d,N]=r(),[w,v]=r(),[I,W]=r(),L=R(),z=a(null),G=d!==void 0;if(o(()=>{if(!G||!po()?.skills)return;z.current?.scrollIntoView({block:"start"}),z.current?.focus({preventScroll:!0})},[G,h]),o(()=>{let M=!0;return re.skills(i).then((V)=>M&&N(V),(V)=>{if(M&&!(V instanceof fe&&V.status===404))W(c(V))}),()=>{M=!1}},[i,h]),I)return e(m,{message:I});if(!d)return null;let U=()=>re.skills(i).then(N,(M)=>{f(c(M),"danger")}),x=async(M,V)=>{v(M);try{N(await re.setSkills(i,V?{add:[M]}:{remove:[M]}))}catch(j){f(c(j),"danger")}finally{v(void 0)}};return n("section",{className:"card stack","aria-label":t("Skills"),ref:z,tabIndex:-1,children:[e("h3",{children:t("Skills ({count})",{count:d.skills.filter((M)=>M.carried).length})}),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:d.skills.map((M,V)=>{let j=`${L}-${V}`;return e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:j,children:[n("span",{className:"menu-text",children:[e("strong",{children:M.name}),e("span",{className:"meta",children:M.missing?t("Its file cannot be read."):M.builtin?t("Built in: every knight carries it."):M.description??""})]}),e(Mt,{id:j,checked:M.carried,label:M.name,busy:w===M.name,disabled:M.builtin,onChange:(Q)=>x(M.name,Q)})]})},M.name)})}),e(Xe,{name:i,view:d,onApplied:U})]})}function Xe({name:i,view:h,onApplied:d}){let[N,w]=r(),[v,I]=r(),W=R();if(o(()=>{let x=!0;return de.skillGroups().then((M)=>x&&w(M.groups),()=>{return}),()=>{x=!1}},[]),!N?.length)return null;let L=new Set(h.skills.filter((x)=>x.carried).map((x)=>x.name)),z=new Set(h.skills.filter((x)=>x.builtin).map((x)=>x.name)),G=(x)=>x.skills.filter((M)=>!L.has(M)),U=(x)=>x.skills.filter((M)=>L.has(M)&&!z.has(M));return n("div",{className:"stack skill-apply",children:[e("h4",{children:t("Skill groups")}),e("p",{className:"meta",children:t("Switching a group on switches on its skills this knight lacks; switching it off switches off its skills, built-in ones excepted.")}),e("ul",{className:"menu",children:N.map((x,M)=>{let V=G(x),j=V.length===0;return e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:`${W}-group-${M}`,children:[n("span",{className:"menu-text",children:[e("strong",{children:x.name}),e("span",{className:"meta",children:j?t("Carries all of it."):t("Lacks {count}: {skills}",{count:V.length,skills:V.join(", ")})})]}),e(Mt,{id:`${W}-group-${M}`,checked:j,label:t("Skill group {name}",{name:x.name}),disabled:j&&U(x).length===0,onChange:(Q)=>I({group:x,on:Q})})]})},x.name)})}),e(D,{open:v!==void 0,title:v?.on?t("Switch this skill group on?"):t("Switch this skill group off?"),confirmLabel:v?.on?t("Switch on"):t("Switch off"),tone:v?.on?"primary":"danger",onClose:()=>I(void 0),onConfirm:async()=>{if(!v)return;let{added:x,removed:M}=await de.applySkillGroup(v.group.name,i,v.on);f(x.length?t("Switched on: {skills}",{skills:x.join(", ")}):M.length?t("Switched off: {skills}",{skills:M.join(", ")}):t("Nothing changed for {name}.",{name:v.group.name})),d()},children:e("p",{children:v?v.on?t("{agent} will also carry: {skills}.",{agent:i,skills:G(v.group).join(", ")}):t("{agent} will no longer carry: {skills}.",{agent:i,skills:U(v.group).join(", ")}):null})})]})}var Ye=()=>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 Je(i){let{profile:h,draft:d}=i,N=a(null);o(()=>N.current?.focus(),[]);let w=[];if(d.displayName!==h.displayName)w.push({label:t("Name"),before:h.displayName,after:d.displayName});let v=(I)=>I===Z?Ce(h):I;if(d.model!==(h.model??Z))w.push({label:t("Model"),before:v(h.model??Z),after:v(d.model)});if(d.thinking!==(h.thinking??Z))w.push({label:t("Thinking level"),before:pe(h.thinking??Z),after:pe(d.thinking)});return n("section",{ref:N,className:"stack review",tabIndex:-1,"aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),w.length?e("ul",{className:"review-fields",children:w.map((I)=>n("li",{children:[e("strong",{children:I.label}),e("span",{className:"review-before",children:I.before}),e("span",{"aria-hidden":"true",children:"→"}),e("span",{className:"review-after",children:I.after})]},I.label))}):null,e(yt,{label:t("Prompt"),before:h.prompt,after:d.prompt}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:i.saving,onClick:i.onBack,children:t("Back to editing")}),e("button",{type:"button",disabled:i.saving,onClick:i.onSave,children:i.saving?t("Saving…"):t("Save")})]})]})}var et=300000;function xe(){let i=Fs(),[h,d]=r(i);if(i&&i!==h)d(i);if(!h)return null;return e(A,{open:i!==void 0,title:t("Archived conversation"),size:"wide",onClose:Bs,children:e(nt,{room:h.room,until:h.until},`${h.room}:${h.until}`)})}function nt(i){B("archived-log",".archived-log .messages { padding: 0; }");let{timeZone:h}=_(),d=tt(),[N,w]=r(),[v,I]=r(!1),[W,L]=r(),[z,G]=r(!1),{room:U,until:x}=i;o(()=>{let V=!0;return io.page(U,x).then((j)=>{if(!V)return;w(j.messages),I(j.more)},(j)=>{if(V)L(c(j))}),()=>{V=!1}},[U,x]);let M=async()=>{let V=N?.[0];if(!V||z)return;G(!0);try{let j=await io.page(U,x,V.id);w((Q)=>[...j.messages,...Q??[]]),I(j.more)}catch(j){L(c(j))}G(!1)};if(W)return e(m,{message:W});if(!N)return e(S,{});if(N.length===0)return e(k,{children:t("The archived conversation has no messages.")});return n("div",{className:"archived-log",children:[v?e("button",{type:"button",className:"secondary older",disabled:z,onClick:M,children:z?t("Loading…"):t("Load earlier messages")}):null,e("ol",{className:"messages",children:N.map((V,j)=>{let Q=N[j-1],Y=!Q||Q.kind!==V.kind||Q.author!==V.author||Date.parse(V.at)-Date.parse(Q.at)>et;return e(Cn,{message:V,character:V.agent?d[V.agent]:void 0,header:Y,enter:!1,unread:!1,timeZone:h,quotable:!1},V.id)})})]})}function ot(i){let{message:h}=i,[d,N]=r(h.text),w=a(null);o(()=>{w.current?.focus(),w.current?.setSelectionRange(d.length,d.length)},[d.length]);let v=d.trim(),I=v===""&&h.files.length===0;return n("form",{className:"stack",onSubmit:(L)=>{if(L.preventDefault(),I)return;if(v!==h.text)xs(h,v);i.onClose()},children:[e("div",{className:"field",children:e("textarea",{ref:w,className:"queued-edit-text",rows:6,value:d,"aria-label":t("Edit"),onChange:(L)=>N(L.target.value)})}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:i.onClose,children:t("Cancel")}),e("button",{type:"submit",disabled:I,children:t("Save")})]})]})}function Me(){let i=Ss(),h=a(void 0);if(i)h.current=i;let d=h.current;if(!d)return null;return e(H,{open:i!==void 0,title:t("Edit"),onClose:jr,children:e(ot,{message:d,onClose:jr},d.id)})}var at=`
2
2
  .sheet:has(.select-text) {
3
3
  -webkit-user-select: none;
4
4
  user-select: none;
@@ -26,4 +26,4 @@ import{p,T,b,E,o,R,C,a,r,t,c,g,e,n,s,X,u,fe,y,l,f,S,m,k,_,Te,Qn,ho,Ks,ye,he,Cn,t
26
26
  gap: var(--space-2);
27
27
  margin-top: var(--space-3);
28
28
  }
29
- `;function Le(){let i=Fs(),[h,d]=r(i);if(i&&i!==h)d(i);if(!h)return null;return B("select-text",at),n(A,{open:i!==void 0,title:t("Select text"),size:"full",onClose:io,children:[e("p",{className:"hint",children:h.author}),e("pre",{className:"select-text",children:h.text}),n("div",{className:"select-text-actions",children:[e("button",{type:"button",className:"secondary",onClick:io,children:t("Close")}),e("button",{type:"button",onClick:()=>Zn(h.text),children:t("Copy all")})]})]})}function st(i){let h=i.filter((w)=>w.parent!==void 0),d=i.filter((w)=>w.parent===void 0),N=new Set(d.map((w)=>w.name));return[...d.flatMap((w)=>[w,...h.filter((v)=>v.parent===w.name)]),...h.filter((w)=>!N.has(w.parent??""))]}function De(){let[i,h]=r(),[d,N]=r(),[w,v]=r(),[I,W]=r(),L=E(async()=>{try{h((await re.archive()).entries),N(void 0)}catch(G){N(l(G))}},[]);o(()=>{L()},[L]);let z=async(G)=>{v(G.name);try{if(G.kind==="agent")await re.restoreAgent(G.name);else await re.restoreGroup(G.name);await Ie(),f(t("Restored {name}.",{name:G.displayName})),await L()}catch(U){f(l(U),"danger")}finally{v(void 0)}};if(d&&!i)return e(m,{message:d});if(!i)return e(S,{});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.")}),i.length===0?e(k,{children:t("Nothing is archived.")}):null,e("ul",{className:"menu",children:st(i).map((G)=>n("li",{className:"menu-item","data-helper":G.parent??void 0,style:G.parent?{paddingLeft:"var(--space-6)"}:void 0,children:[e("span",{className:"menu-icon",children:e(s,{name:G.kind==="agent"?"profile":"rooms"})}),n("span",{className:"menu-text",children:[e("strong",{children:G.displayName}),n("span",{className:"meta",children:[G.parent?t("Temp knight of {name}",{name:G.parent}):G.kind==="agent"?t("Knight"):t("Group")," ","· ",G.name]})]}),e("button",{type:"button",className:"secondary compact",disabled:w===G.name,onClick:()=>z(G),children:t("Restore")}),e("button",{type:"button",className:"compact danger",disabled:w===G.name,onClick:()=>W(G),children:t("Delete")})]},`${G.kind}:${G.name}`))}),e(D,{open:I!==void 0,title:t("Delete {name}?",{name:I?.displayName??""}),confirmLabel:t("Delete"),tone:"danger",onClose:()=>W(void 0),onConfirm:async()=>{if(!I)return;if(I.kind==="agent")await re.deleteAgent(I.name);else await re.deleteGroup(I.name);await Ie(),f(t("Deleted {name}.",{name:I.displayName})),await L()},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:I?.displayName??""})})})]})}var He=/^[a-z0-9-]{1,32}$/,Re=2,Pe=8,me="\x00";function rt(){let i=u((h)=>h.order.flatMap((d)=>{let N=h.rooms[d]?.view;return N?.kind==="agent"&&!N.helper?[`${N.name}${me}${N.displayName}`]:[]}).join(`${me}${me}`));return C(()=>i===""?[]:i.split(`${me}${me}`).map((h)=>{let[d="",N=""]=h.split(me);return{name:d,displayName:N}}),[i])}function $e(i){let h=rt(),[d,N]=r(),[w,v]=r(),[I,W]=r(""),[L,z]=r(""),[G,U]=r(!1),[x,M]=r([]),[V,j]=r(""),[Q,Y]=r(!1),[se,ee]=r(i.name===void 0),ne=R(),J=R();o(()=>{let O=i.name;if(O===void 0)return;let P=!0;return re.group(O).then((K)=>{if(!P)return;N(K),W(K.displayName),M(K.members),j(K.host),ee(!0)},(K)=>P&&v(l(K))),()=>{P=!1}},[i.name]);let ie=(O)=>h.find((P)=>P.name===O)?.displayName??O,q=x.includes(V)?V:x[0]??"",le=d===void 0?!0:I.trim()!==d.displayName||x.join(",")!==d.members.join(",")||q!==d.host,oe=I.trim()!==""&&x.length>=Re&&x.length<=Pe&&(d!==void 0||He.test(L));if(w&&!se)return e(m,{message:w});if(!se)return e(S,{});let ae=async()=>{Y(!0),v(void 0);try{if(d){await re.updateGroup(d.name,{...I.trim()!==d.displayName?{displayName:I.trim()}:{},...x.join(",")!==d.members.join(",")?{members:x}:{},...q!==d.host?{host:q}:{}}),await Ie(),f(t("Saved.")),i.onDone();return}let O=await re.createGroup({name:L,displayName:I.trim(),members:x,host:q});await Ie(),f(t("Made {name}.",{name:O.displayName})),i.onDone(),X("room",O.room)}catch(O){v(l(O))}finally{Y(!1)}};return n("form",{className:"stack form",onSubmit:(O)=>{if(O.preventDefault(),oe&&le&&!Q)ae()},children:[n("label",{htmlFor:ne,children:[t("Name"),e("input",{id:ne,value:I,autoComplete:"off",onChange:(O)=>{if(W(O.target.value),!d&&!G)z(O.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32))}})]}),d?null:n("label",{htmlFor:J,children:[t("Permanent name"),e("input",{id:J,value:L,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":L!==""&&!He.test(L),onChange:(O)=>{U(!0),z(O.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:h.map((O)=>{let P=x.includes(O.name);return e("li",{children:n("label",{className:"menu-item menu-toggle",children:[e("input",{type:"checkbox",checked:P,disabled:!P&&x.length>=Pe,onChange:()=>M(P?x.filter((K)=>K!==O.name):[...x,O.name])}),e("span",{className:"menu-text",children:e("strong",{children:O.displayName})})]})},O.name)})})]}),x.length>=Re?e(Zt,{label:t("Host"),value:q,onChange:j,options:x.map((O)=>({value:O,label:ie(O)}))}):null,w?e(m,{message:w}):null,n("div",{className:"actions",children:[d?e("button",{type:"button",className:"danger",onClick:()=>{i.onDone(),ye({kind:"archive",room:d.room,name:d.displayName})},children:t("Archive group")}):null,e("button",{type:"submit",disabled:!oe||!le||Q,children:Q?t("Saving…"):d?t("Save"):t("Make group")})]})]})}var it=b(()=>(p("26fptwb3"),import("./chunk-character-creator-26fptwb3.js")).then((i)=>({default:i.CharacterCreator}))),Fe=/^[a-z0-9-]{1,32}$/,ge="default";function lt(i){let h=[];for(let d of i){let N=d.indexOf("/"),w=N>0?d.slice(0,N):"",v=h.find((I)=>I.provider===w&&w!=="");if(v)v.models.push(d);else h.push({provider:w,models:[d]})}return h}var mt=(i)=>i.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32);function Ge({onDone:i}){let[h,d]=r(""),[N,w]=r(""),[v,I]=r(!1),[W,L]=r(""),[z,G]=r(ge),[U,x]=r(""),[M,V]=r(),[j,Q]=r(!1),[Y,se]=r([]),[ee,ne]=r(),[J,ie]=r(!1),q=[R(),R(),R(),R(),R()];o(()=>{let P=!0;return y.models().then((K)=>P&&se(K.models),()=>{return}),()=>{P=!1}},[]);let le=C(()=>Nn({name:N,displayName:h,prompt:W}),[N,h,W]),oe=M?.spec??le,ae=Fe.test(N)&&h.trim()!==""&&W.trim()!=="";if(j)return e(T,{fallback:e(S,{}),children:e(it,{name:N||"new",displayName:h,prompt:W,character:oe,onPick:(P,K)=>{V({input:P,spec:K}),Q(!1)},onCancel:()=>Q(!1)})});let O=async()=>{ie(!0),ne(void 0);try{let P={name:N,displayName:h.trim(),prompt:W,...z!==ge?{model:z}:{},...U.trim()?{task:U.trim()}:{},...M?{character:M.input}:{}},K=await re.createAgent(P);await Ie(),f(t("Made {name}.",{name:K.displayName})),i(),X("room",K.room)}catch(P){ne(P instanceof fe&&P.field?`${P.field}: ${l(P)}`:l(P))}finally{ie(!1)}};return n("form",{className:"stack form",onSubmit:(P)=>{if(P.preventDefault(),ae&&!J)O()},children:[n("label",{htmlFor:q[0],children:[t("Name"),e("input",{id:q[0],value:h,autoComplete:"off",onChange:(P)=>{if(d(P.target.value),!v)w(mt(P.target.value))}})]}),n("label",{htmlFor:q[1],children:[t("Permanent name"),e("input",{id:q[1],value:N,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":N!==""&&!Fe.test(N),onChange:(P)=>{I(!0),w(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("label",{htmlFor:q[2],children:[t("Prompt"),e("textarea",{id:q[2],rows:6,value:W,onChange:(P)=>L(P.target.value)}),e("span",{className:"meta",children:t("Its job, its sources, its limits and how it reports.")})]}),n("label",{htmlFor:q[4],children:[t("Model"),n(Ee,{id:q[4],value:z,onChange:(P)=>G(P.target.value),children:[e("option",{value:ge,children:t("Default model")}),lt(Y).map((P)=>P.provider===""?P.models.map((K)=>e("option",{value:K,children:K},K)):e("optgroup",{label:P.provider,children:P.models.map((K)=>e("option",{value:K,children:K},K))},P.provider))]})]}),n("label",{htmlFor:q[3],children:[t("Opening task"),e("textarea",{id:q[3],rows:3,value:U,onChange:(P)=>x(P.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(he,{spec:oe,name:N||"new",size:72,label:h}),n("div",{children:[e("strong",{children:t("Look")}),e("span",{className:"meta",children:M?t("Your look"):t("Suggested from its role")}),e("button",{type:"button",className:"secondary compact",onClick:()=>Q(!0),children:t("Choose a look")})]})]}),ee?e(m,{message:ee}):null,e("div",{className:"actions",children:e("button",{type:"submit",disabled:!ae||J,children:J?t("Making…"):t("Make knight")})})]})}var ct=(i)=>i.kind==="new-agent"?t("New knight"):i.kind==="archive"?t("Archived"):i.name===void 0?t("New group"):t("Edit group");function Ve(){let i=Ms(),h=a(i);if(i)h.current=i;let d=h.current,N=i!==void 0;if(o(()=>{if(!N)return;let w=window.location.href,v=()=>{if(window.location.href!==w)Ci()};return window.addEventListener("popstate",v),window.addEventListener("hashchange",v),()=>{window.removeEventListener("popstate",v),window.removeEventListener("hashchange",v)}},[N]),!d)return null;return e(A,{open:i!==void 0,title:ct(d),size:"wide",onClose:Ci,children:e("div",{className:"stack agent-sheet",children:d.kind==="new-agent"?e(Ge,{onDone:Ci}):d.kind==="archive"?e(De,{}):e($e,{...d.name===void 0?{}:{name:d.name},onDone:Ci})},d.id)})}function Oe(){let i=Br(),h=a(!1);if(i)h.current=!0;return h.current?e(ut,{open:i}):null}function ut({open:i}){let h=_(),{now:d}=te(),N=u((v)=>pn(v).map(({id:I,card:W})=>{let L=v.rooms[W.room]?.view,z=L?.parent?v.rooms[L.parent]?.view:void 0;return{id:I,room:z?`${z.displayName} › ${L?.displayName??""}`:L?.displayName??W.room,title:W.frame.title,at:W.frame.at}})),w=N.length===0;return o(()=>{if(i&&w)rr()},[i,w]),e(A,{open:i&&!w,title:t("Cards waiting"),onClose:rr,children:e("ul",{className:"waiting-list",children:N.map((v)=>e("li",{children:n("button",{type:"button",onClick:()=>or(v.id),children:[e("strong",{children:v.title}),n("span",{className:"meta",children:[v.room,v.at?` · ${Te(v.at,d,h.timeZone)}`:""]})]})},v.id))})})}var dt=b(()=>(p("nsspdnr8"),import("./chunk-shortcut-help-nsspdnr8.js")));function pt(){let i=is(),h=a(!1);if(i)h.current=!0;if(!h.current)return null;return e(T,{fallback:null,children:e(dt,{open:i})})}function To(){return n(g,{children:[e(Dr,{}),e(Me,{}),e(Ae,{}),e(Ve,{}),e(xe,{}),e(Le,{}),e(Oe,{}),e(pt,{})]})}export{To as SheetHosts};
29
+ `;function Le(){let i=Zs(),[h,d]=r(i);if(i&&i!==h)d(i);if(!h)return null;return B("select-text",at),n(A,{open:i!==void 0,title:t("Select text"),size:"full",onClose:ro,children:[e("p",{className:"hint",children:h.author}),e("pre",{className:"select-text",children:h.text}),n("div",{className:"select-text-actions",children:[e("button",{type:"button",className:"secondary",onClick:ro,children:t("Close")}),e("button",{type:"button",onClick:()=>Zn(h.text),children:t("Copy all")})]})]})}function st(i){let h=i.filter((w)=>w.parent!==void 0),d=i.filter((w)=>w.parent===void 0),N=new Set(d.map((w)=>w.name));return[...d.flatMap((w)=>[w,...h.filter((v)=>v.parent===w.name)]),...h.filter((w)=>!N.has(w.parent??""))]}function De(){let[i,h]=r(),[d,N]=r(),[w,v]=r(),[I,W]=r(),L=E(async()=>{try{h((await re.archive()).entries),N(void 0)}catch(G){N(c(G))}},[]);o(()=>{L()},[L]);let z=async(G)=>{v(G.name);try{if(G.kind==="agent")await re.restoreAgent(G.name);else await re.restoreGroup(G.name);await Ie(),f(t("Restored {name}.",{name:G.displayName})),await L()}catch(U){f(c(U),"danger")}finally{v(void 0)}};if(d&&!i)return e(m,{message:d});if(!i)return e(S,{});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.")}),i.length===0?e(k,{children:t("Nothing is archived.")}):null,e("ul",{className:"menu",children:st(i).map((G)=>n("li",{className:"menu-item","data-helper":G.parent??void 0,style:G.parent?{paddingLeft:"var(--space-6)"}:void 0,children:[e("span",{className:"menu-icon",children:e(s,{name:G.kind==="agent"?"profile":"rooms"})}),n("span",{className:"menu-text",children:[e("strong",{children:G.displayName}),n("span",{className:"meta",children:[G.parent?t("Temp knight of {name}",{name:G.parent}):G.kind==="agent"?t("Knight"):t("Group")," ","· ",G.name]})]}),e("button",{type:"button",className:"secondary compact",disabled:w===G.name,onClick:()=>z(G),children:t("Restore")}),e("button",{type:"button",className:"compact danger",disabled:w===G.name,onClick:()=>W(G),children:t("Delete")})]},`${G.kind}:${G.name}`))}),e(D,{open:I!==void 0,title:t("Delete {name}?",{name:I?.displayName??""}),confirmLabel:t("Delete"),tone:"danger",onClose:()=>W(void 0),onConfirm:async()=>{if(!I)return;if(I.kind==="agent")await re.deleteAgent(I.name);else await re.deleteGroup(I.name);await Ie(),f(t("Deleted {name}.",{name:I.displayName})),await L()},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:I?.displayName??""})})})]})}var He=/^[a-z0-9-]{1,32}$/,Re=2,Pe=8,me="\x00";function rt(){let i=l((h)=>h.order.flatMap((d)=>{let N=h.rooms[d]?.view;return N?.kind==="agent"&&!N.helper?[`${N.name}${me}${N.displayName}`]:[]}).join(`${me}${me}`));return C(()=>i===""?[]:i.split(`${me}${me}`).map((h)=>{let[d="",N=""]=h.split(me);return{name:d,displayName:N}}),[i])}function $e(i){let h=rt(),[d,N]=r(),[w,v]=r(),[I,W]=r(""),[L,z]=r(""),[G,U]=r(!1),[x,M]=r([]),[V,j]=r(""),[Q,Y]=r(!1),[se,ee]=r(i.name===void 0),ne=R(),J=R();o(()=>{let O=i.name;if(O===void 0)return;let P=!0;return re.group(O).then((K)=>{if(!P)return;N(K),W(K.displayName),M(K.members),j(K.host),ee(!0)},(K)=>P&&v(c(K))),()=>{P=!1}},[i.name]);let ie=(O)=>h.find((P)=>P.name===O)?.displayName??O,q=x.includes(V)?V:x[0]??"",le=d===void 0?!0:I.trim()!==d.displayName||x.join(",")!==d.members.join(",")||q!==d.host,oe=I.trim()!==""&&x.length>=Re&&x.length<=Pe&&(d!==void 0||He.test(L));if(w&&!se)return e(m,{message:w});if(!se)return e(S,{});let ae=async()=>{Y(!0),v(void 0);try{if(d){await re.updateGroup(d.name,{...I.trim()!==d.displayName?{displayName:I.trim()}:{},...x.join(",")!==d.members.join(",")?{members:x}:{},...q!==d.host?{host:q}:{}}),await Ie(),f(t("Saved.")),i.onDone();return}let O=await re.createGroup({name:L,displayName:I.trim(),members:x,host:q});await Ie(),f(t("Made {name}.",{name:O.displayName})),i.onDone(),X("room",O.room)}catch(O){v(c(O))}finally{Y(!1)}};return n("form",{className:"stack form",onSubmit:(O)=>{if(O.preventDefault(),oe&&le&&!Q)ae()},children:[n("label",{htmlFor:ne,children:[t("Name"),e("input",{id:ne,value:I,autoComplete:"off",onChange:(O)=>{if(W(O.target.value),!d&&!G)z(O.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32))}})]}),d?null:n("label",{htmlFor:J,children:[t("Permanent name"),e("input",{id:J,value:L,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":L!==""&&!He.test(L),onChange:(O)=>{U(!0),z(O.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:h.map((O)=>{let P=x.includes(O.name);return e("li",{children:n("label",{className:"menu-item menu-toggle",children:[e("input",{type:"checkbox",checked:P,disabled:!P&&x.length>=Pe,onChange:()=>M(P?x.filter((K)=>K!==O.name):[...x,O.name])}),e("span",{className:"menu-text",children:e("strong",{children:O.displayName})})]})},O.name)})})]}),x.length>=Re?e(Zt,{label:t("Host"),value:q,onChange:j,options:x.map((O)=>({value:O,label:ie(O)}))}):null,w?e(m,{message:w}):null,n("div",{className:"actions",children:[d?e("button",{type:"button",className:"danger",onClick:()=>{i.onDone(),ye({kind:"archive",room:d.room,name:d.displayName})},children:t("Archive group")}):null,e("button",{type:"submit",disabled:!oe||!le||Q,children:Q?t("Saving…"):d?t("Save"):t("Make group")})]})]})}var it=b(()=>(p("x8grfnwr"),import("./chunk-character-creator-x8grfnwr.js")).then((i)=>({default:i.CharacterCreator}))),Fe=/^[a-z0-9-]{1,32}$/,ge="default";function lt(i){let h=[];for(let d of i){let N=d.indexOf("/"),w=N>0?d.slice(0,N):"",v=h.find((I)=>I.provider===w&&w!=="");if(v)v.models.push(d);else h.push({provider:w,models:[d]})}return h}var mt=(i)=>i.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32);function Ge({onDone:i}){let[h,d]=r(""),[N,w]=r(""),[v,I]=r(!1),[W,L]=r(""),[z,G]=r(ge),[U,x]=r(""),[M,V]=r(),[j,Q]=r(!1),[Y,se]=r([]),[ee,ne]=r(),[J,ie]=r(!1),q=[R(),R(),R(),R(),R()];o(()=>{let P=!0;return y.models().then((K)=>P&&se(K.models),()=>{return}),()=>{P=!1}},[]);let le=C(()=>Nn({name:N,displayName:h,prompt:W}),[N,h,W]),oe=M?.spec??le,ae=Fe.test(N)&&h.trim()!==""&&W.trim()!=="";if(j)return e(T,{fallback:e(S,{}),children:e(it,{name:N||"new",displayName:h,prompt:W,character:oe,onPick:(P,K)=>{V({input:P,spec:K}),Q(!1)},onCancel:()=>Q(!1)})});let O=async()=>{ie(!0),ne(void 0);try{let P={name:N,displayName:h.trim(),prompt:W,...z!==ge?{model:z}:{},...U.trim()?{task:U.trim()}:{},...M?{character:M.input}:{}},K=await re.createAgent(P);await Ie(),f(t("Made {name}.",{name:K.displayName})),i(),X("room",K.room)}catch(P){ne(P instanceof fe&&P.field?`${P.field}: ${c(P)}`:c(P))}finally{ie(!1)}};return n("form",{className:"stack form",onSubmit:(P)=>{if(P.preventDefault(),ae&&!J)O()},children:[n("label",{htmlFor:q[0],children:[t("Name"),e("input",{id:q[0],value:h,autoComplete:"off",onChange:(P)=>{if(d(P.target.value),!v)w(mt(P.target.value))}})]}),n("label",{htmlFor:q[1],children:[t("Permanent name"),e("input",{id:q[1],value:N,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":N!==""&&!Fe.test(N),onChange:(P)=>{I(!0),w(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("label",{htmlFor:q[2],children:[t("Prompt"),e("textarea",{id:q[2],rows:6,value:W,onChange:(P)=>L(P.target.value)}),e("span",{className:"meta",children:t("Its job, its sources, its limits and how it reports.")})]}),n("label",{htmlFor:q[4],children:[t("Model"),n(Ae,{id:q[4],value:z,onChange:(P)=>G(P.target.value),children:[e("option",{value:ge,children:t("Default model")}),lt(Y).map((P)=>P.provider===""?P.models.map((K)=>e("option",{value:K,children:K},K)):e("optgroup",{label:P.provider,children:P.models.map((K)=>e("option",{value:K,children:K},K))},P.provider))]})]}),n("label",{htmlFor:q[3],children:[t("Opening task"),e("textarea",{id:q[3],rows:3,value:U,onChange:(P)=>x(P.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(he,{spec:oe,name:N||"new",size:72,label:h}),n("div",{children:[e("strong",{children:t("Look")}),e("span",{className:"meta",children:M?t("Your look"):t("Suggested from its role")}),e("button",{type:"button",className:"secondary compact",onClick:()=>Q(!0),children:t("Choose a look")})]})]}),ee?e(m,{message:ee}):null,e("div",{className:"actions",children:e("button",{type:"submit",disabled:!ae||J,children:J?t("Making…"):t("Make knight")})})]})}var ct=(i)=>i.kind==="new-agent"?t("New knight"):i.kind==="archive"?t("Archived"):i.name===void 0?t("New group"):t("Edit group");function Ve(){let i=Cs(),h=a(i);if(i)h.current=i;let d=h.current,N=i!==void 0;if(o(()=>{if(!N)return;let w=window.location.href,v=()=>{if(window.location.href!==w)Ei()};return window.addEventListener("popstate",v),window.addEventListener("hashchange",v),()=>{window.removeEventListener("popstate",v),window.removeEventListener("hashchange",v)}},[N]),!d)return null;return e(A,{open:i!==void 0,title:ct(d),size:"wide",onClose:Ei,children:e("div",{className:"stack agent-sheet",children:d.kind==="new-agent"?e(Ge,{onDone:Ei}):d.kind==="archive"?e(De,{}):e($e,{...d.name===void 0?{}:{name:d.name},onDone:Ei})},d.id)})}function Oe(){let i=Fr(),h=a(!1);if(i)h.current=!0;return h.current?e(ut,{open:i}):null}function ut({open:i}){let h=_(),{now:d}=te(),N=l((v)=>pn(v).map(({id:I,card:W})=>{let L=v.rooms[W.room]?.view,z=L?.parent?v.rooms[L.parent]?.view:void 0;return{id:I,room:z?`${z.displayName} › ${L?.displayName??""}`:L?.displayName??W.room,title:W.frame.title,at:W.frame.at}})),w=N.length===0;return o(()=>{if(i&&w)or()},[i,w]),e(A,{open:i&&!w,title:t("Cards waiting"),onClose:or,children:e("ul",{className:"waiting-list",children:N.map((v)=>e("li",{children:n("button",{type:"button",onClick:()=>sr(v.id),children:[e("strong",{children:v.title}),n("span",{className:"meta",children:[v.room,v.at?` · ${Te(v.at,d,h.timeZone)}`:""]})]})},v.id))})})}var dt=b(()=>(p("aaat3wrh"),import("./chunk-shortcut-help-aaat3wrh.js")));function pt(){let i=rs(),h=a(!1);if(i)h.current=!0;if(!h.current)return null;return e(T,{fallback:null,children:e(dt,{open:i})})}function To(){return n(g,{children:[e(Ur,{}),e(Me,{}),e(Ee,{}),e(Ve,{}),e(xe,{}),e(Le,{}),e(Oe,{}),e(pt,{})]})}export{To as SheetHosts};
@@ -1,4 +1,4 @@
1
- import{t,e,n}from"./chunk-index-st18ee4w.js";import{yi,os}from"./chunk-index-2ywap2mg.js";import{A}from"./chunk-index-04ndj4hg.js";import{B}from"./chunk-index-fw6kawhw.js";var l=`
1
+ import{t,e,n}from"./chunk-index-htdkpbrd.js";import{yi,ss}from"./chunk-index-tn9qzrj2.js";import{A}from"./chunk-index-1kvnezap.js";import{B}from"./chunk-index-fw6kawhw.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-st18ee4w.js";import{yi,os}from"./chunk-index-2yw
23
23
  text-align: center;
24
24
  font-size: var(--text-sm);
25
25
  }
26
- `;function r(){let a=os(),s=a?"⌥":"Alt",o=a?"⌘":"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:[o,"K"],label:t("Find a room")},{keys:["Esc"],label:t("Close the open menu or sheet, or leave the message box")},{keys:["↑"],label:t("Edit your latest message that is still waiting, from an empty message box")},{keys:["/clear"],label:t("In a message box, start the open room over (also /new)")},{keys:["?"],label:t("Show these shortcuts")}]}function i({open:a}){return B("shortcut-help",l),e(A,{open:a,title:t("Keyboard shortcuts"),onClose:yi,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((o)=>e("kbd",{children:o},o))}),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 a=ss(),s=a?"⌥":"Alt",o=a?"⌘":"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:[o,"K"],label:t("Find a room")},{keys:["Esc"],label:t("Close the open menu or sheet, or leave the message box")},{keys:["↑"],label:t("Edit your latest message that is still waiting, from an empty message box")},{keys:["/clear"],label:t("In a message box, start the open room over (also /new)")},{keys:["?"],label:t("Show these shortcuts")}]}function i({open:a}){return B("shortcut-help",l),e(A,{open:a,title:t("Keyboard shortcuts"),onClose:yi,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((o)=>e("kbd",{children:o},o))}),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{Kn,x,X,Me,Xe,O,Ve,_t,Ae,mo}from"./chunk-index-st18ee4w.js";import{Er}from"./chunk-index-1pgm1gy4.js";import{Pi,Qi}from"./chunk-index-0pghg70x.js";import{ns,yi,rs}from"./chunk-index-2ywap2mg.js";import{ut}from"./chunk-index-9q2psqsq.js";function y(e,t){let{collapsed:n,expanded:r,current:s}=t,o=ut(e,t.at),u=[],c=(i,f)=>{u.push({key:i,shown:f});let l=o.threads[i];if(!l)return;for(let d of l.open)u.push({key:d,shown:f});for(let d of l.closed)u.push({key:d,shown:f&&(r.has(d)||d===s)})};for(let i of o.home)c(i,!0);let a=(i,f)=>{let l=n.has(i);for(let d of f)c(d,!l||d===s||t.stays?.(d)===!0)};a(Ae("pinned"),o.pinned);for(let i of o.folders)a(i.id,i.rooms);if(o.folders.length>0)a(Ae("rest"),o.rest);else a(Ae("agents"),o.restAgents),a(Ae("groups"),o.restGroups);let{orphans:m}=o;for(let i of m.open)u.push({key:i,shown:!0});for(let i of m.closed)u.push({key:i,shown:r.has(i)||i===s});return u}function h(e,t,n,r){let s=n===1?-1:e.length;if(t!==void 0){if(s=e.findIndex((o)=>o.key===t),s<0)return}for(let o=s+n;o>=0&&o<e.length;o+=n){let u=e[o];if(u&&r(u))return u.key}return}var S=new Set(["","text","search","url","tel","email","password","number","date","datetime-local","month","time","week"]);function g(e){if(!(e instanceof HTMLElement))return;if(e instanceof HTMLTextAreaElement)return e;if(e instanceof HTMLSelectElement)return e;if(e instanceof HTMLInputElement)return S.has(e.type)?e:void 0;return e.closest('[contenteditable]:not([contenteditable="false"])')?e:void 0}function E(e,t){if(e instanceof HTMLSelectElement)return!1;if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){if(e.value==="")return!0;let{selectionStart:o,selectionEnd:u}=e;if(o===null||u===null||o!==u)return!1;return t?o===0:o===e.value.length}if((e.textContent??"")==="")return!0;let n=window.getSelection();if(!n||n.rangeCount===0||!n.isCollapsed)return!1;let r=n.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 b(){let e=Kn();if(e.pane!=="room"||e.key===void 0)return;return(O.getState().rooms[e.key]?.messages??[]).findLast(Pi)}var k=(e)=>e instanceof HTMLTextAreaElement&&e.closest(".composer")!==null&&e.value===""&&!e.readOnly;function T(e){if(e.defaultPrevented||Ve(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 n=t==="ArrowUp",r=g(e.target);if(r&&!E(r,n))return;if(e.shiftKey)return n?"previous-unread":"next-unread";return n?"previous":"next"}if(t==="ArrowUp"&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.repeat)return k(e.target)&&b()?"edit-queued":void 0;if(t==="?"&&!e.ctrlKey&&!e.metaKey&&!e.repeat)return g(e.target)?void 0:"help";return}function K(){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 p=()=>document.querySelector('dialog[open], .action-popover, .switcher:not([data-state="closed"])')!==null;function w(e,t=12){let n=x("room",e),r=[...document.querySelectorAll('.room-row[aria-current="page"], .thread-link[aria-current="page"]')].find((s)=>s.getAttribute("href")===n);if(r)r.scrollIntoView?.({block:"nearest"});else if(t>0)requestAnimationFrame(()=>w(e,t-1))}function H(e,t){let n=O.getState(),r=Kn(),s=r.pane==="room"?r.key:void 0,o=y(n,{at:(a)=>Xe(n,a),collapsed:mo(),stays:(a)=>Me(n,a)>0||Er(a)>0,expanded:K(),current:s});if(r.pane==="room"&&!o.some((a)=>a.key===s))return;let c=h(o,s,e,t?(a)=>Er(a.key)>0:(a)=>a.shown);if(c===void 0)return;X("room",c),w(c)}function L(e){if(document.querySelector(".action-popover")){e.preventDefault(),_t();return}if(document.querySelector("dialog[open]"))return;let t=document.activeElement;if(t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&S.has(t.type))e.preventDefault(),t.blur()}function A(e,t){switch(e){case"escape":L(t);break;case"help":if(t.preventDefault(),rs())yi();else if(!p())ns();break;case"edit-queued":{if(p())break;let n=b();if(!n)break;t.preventDefault(),Qi(n);break}default:if(p())break;t.preventDefault(),H(e.startsWith("previous")?-1:1,e.endsWith("unread"))}}function V(){let e=(t)=>{let n=T(t);if(n)A(n,t)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}export{V as startShortcuts};
1
+ import{Kn,x,X,Me,ze,O,Ve,_t,$e,go}from"./chunk-index-htdkpbrd.js";import{Ar}from"./chunk-index-hrpmm09c.js";import{Qi,Mi}from"./chunk-index-xwnkf825.js";import{is,yi,os}from"./chunk-index-tn9qzrj2.js";import{ut}from"./chunk-index-w0vfwqck.js";function y(e,t){let{collapsed:n,expanded:r,current:s}=t,o=ut(e,t.at),u=[],c=(i,f)=>{u.push({key:i,shown:f});let l=o.threads[i];if(!l)return;for(let d of l.open)u.push({key:d,shown:f});for(let d of l.closed)u.push({key:d,shown:f&&(r.has(d)||d===s)})};for(let i of o.home)c(i,!0);let a=(i,f)=>{let l=n.has(i);for(let d of f)c(d,!l||d===s||t.stays?.(d)===!0)};a($e("pinned"),o.pinned);for(let i of o.folders)a(i.id,i.rooms);if(o.folders.length>0)a($e("rest"),o.rest);else a($e("agents"),o.restAgents),a($e("groups"),o.restGroups);let{orphans:m}=o;for(let i of m.open)u.push({key:i,shown:!0});for(let i of m.closed)u.push({key:i,shown:r.has(i)||i===s});return u}function h(e,t,n,r){let s=n===1?-1:e.length;if(t!==void 0){if(s=e.findIndex((o)=>o.key===t),s<0)return}for(let o=s+n;o>=0&&o<e.length;o+=n){let u=e[o];if(u&&r(u))return u.key}return}var S=new Set(["","text","search","url","tel","email","password","number","date","datetime-local","month","time","week"]);function g(e){if(!(e instanceof HTMLElement))return;if(e instanceof HTMLTextAreaElement)return e;if(e instanceof HTMLSelectElement)return e;if(e instanceof HTMLInputElement)return S.has(e.type)?e:void 0;return e.closest('[contenteditable]:not([contenteditable="false"])')?e:void 0}function E(e,t){if(e instanceof HTMLSelectElement)return!1;if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){if(e.value==="")return!0;let{selectionStart:o,selectionEnd:u}=e;if(o===null||u===null||o!==u)return!1;return t?o===0:o===e.value.length}if((e.textContent??"")==="")return!0;let n=window.getSelection();if(!n||n.rangeCount===0||!n.isCollapsed)return!1;let r=n.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 b(){let e=Kn();if(e.pane!=="room"||e.key===void 0)return;return(O.getState().rooms[e.key]?.messages??[]).findLast(Qi)}var k=(e)=>e instanceof HTMLTextAreaElement&&e.closest(".composer")!==null&&e.value===""&&!e.readOnly;function T(e){if(e.defaultPrevented||Ve(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 n=t==="ArrowUp",r=g(e.target);if(r&&!E(r,n))return;if(e.shiftKey)return n?"previous-unread":"next-unread";return n?"previous":"next"}if(t==="ArrowUp"&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.repeat)return k(e.target)&&b()?"edit-queued":void 0;if(t==="?"&&!e.ctrlKey&&!e.metaKey&&!e.repeat)return g(e.target)?void 0:"help";return}function K(){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 p=()=>document.querySelector('dialog[open], .action-popover, .switcher:not([data-state="closed"])')!==null;function w(e,t=12){let n=x("room",e),r=[...document.querySelectorAll('.room-row[aria-current="page"], .thread-link[aria-current="page"]')].find((s)=>s.getAttribute("href")===n);if(r)r.scrollIntoView?.({block:"nearest"});else if(t>0)requestAnimationFrame(()=>w(e,t-1))}function H(e,t){let n=O.getState(),r=Kn(),s=r.pane==="room"?r.key:void 0,o=y(n,{at:(a)=>ze(n,a),collapsed:go(),stays:(a)=>Me(n,a)>0||Ar(a)>0,expanded:K(),current:s});if(r.pane==="room"&&!o.some((a)=>a.key===s))return;let c=h(o,s,e,t?(a)=>Ar(a.key)>0:(a)=>a.shown);if(c===void 0)return;X("room",c),w(c)}function L(e){if(document.querySelector(".action-popover")){e.preventDefault(),_t();return}if(document.querySelector("dialog[open]"))return;let t=document.activeElement;if(t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&S.has(t.type))e.preventDefault(),t.blur()}function A(e,t){switch(e){case"escape":L(t);break;case"help":if(t.preventDefault(),os())yi();else if(!p())is();break;case"edit-queued":{if(p())break;let n=b();if(!n)break;t.preventDefault(),Mi(n);break}default:if(p())break;t.preventDefault(),H(e.startsWith("previous")?-1:1,e.endsWith("unread"))}}function V(){let e=(t)=>{let n=T(t);if(n)A(n,t)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}export{V as startShortcuts};
@@ -1,8 +1,8 @@
1
- import{p,T,b,o,R,r,t,g,e,n,s,fe,l,f,S,m}from"./chunk-index-st18ee4w.js";import{de}from"./chunk-index-tn797j5g.js";import{yt}from"./chunk-index-0kwxrths.js";import{A}from"./chunk-index-04ndj4hg.js";var B=b(()=>(p("cpejc2ce"),import("./chunk-prompt-history-cpejc2ce.js")).then((d)=>({default:d.HistorySheet}))),O=`---
1
+ import{p,T,b,o,R,r,t,g,e,n,s,fe,c,f,S,m}from"./chunk-index-htdkpbrd.js";import{de}from"./chunk-index-rny986v2.js";import{yt}from"./chunk-index-tc8s2rz3.js";import{A}from"./chunk-index-1kvnezap.js";var B=b(()=>(p("mffm0c56"),import("./chunk-prompt-history-mffm0c56.js")).then((d)=>({default:d.HistorySheet}))),O=`---
2
2
  name: my-skill
3
3
  description: "Use when "
4
4
  ---
5
5
 
6
6
  # My skill
7
7
 
8
- `;function _(d){let{name:u}=d,[i,w]=r(),[h,v]=r(u?"":O),[y,I]=r(),[z,k]=r(!1),[C,x]=r(!1),[U,D]=r(!1),[H,N]=r(!1),L=R();o(()=>{if(!u)return;let a=!0;return de.skillDocument(u).then((c)=>{if(!a)return;w(c),v(c.text)},(c)=>a&&I(l(c))),()=>{a=!1}},[u]);let E=i?.text??"",V=h!==E,F=u!==void 0&&!i&&!y,K=async()=>{x(!0);try{if(i){let a=await de.saveSkillDocument(i.name,{text:h,baseHash:i.hash});w(a),v(a.text),k(!1),D(!1),f(t("Saved.")),d.onSaved()}else await de.createSkillDocument({text:h}),f(t("Skill created.")),d.onSaved(),d.onClose()}catch(a){if(a instanceof fe&&a.status===409){let{current:c}=a.body;w(c),D(!0)}else f(l(a),"danger")}finally{x(!1)}};return n(A,{open:!0,title:u??t("New skill"),size:"full",onClose:d.onClose,children:[y?e(m,{message:y}):null,F?e(S,{}):null,i&&!i.writable?e(m,{message:t("This skill cannot be edited here.")}):null,!F&&!y&&(!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")}),U?e(m,{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(yt,{label:"SKILL.md",before:E,after:h}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:C,onClick:()=>k(!1),children:t("Back to editing")}),e("button",{type:"button",disabled:C,onClick:K,children:C?t("Saving…"):i?t("Save"):t("Create skill")})]})]}):n(g,{children:[n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:L,children:"SKILL.md"}),i?e("span",{className:"field-tools",children:n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>N(!0),children:[e(s,{name:"reset",size:16}),t("History")]})}):null]}),e("textarea",{id:L,className:"prompt-full",spellCheck:!1,value:h,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:!V||!h.trim(),onClick:()=>k(!0),children:t("Review changes")})})]}),H&&i?e(T,{fallback:null,children:e(B,{open:H,title:t("History of {name}",{name:i.name}),load:async()=>{let{versions:a}=await de.skillHistory(i.name);return a.map((c,M)=>({id:c.id,text:c.text,previous:a[M+1]?.text??"",by:c.by,at:c.at}))},onUse:(a)=>{v(a),k(!1),N(!1)},onClose:()=>N(!1)})}):null]}):null]})}export{_ as SkillEditor};
8
+ `;function _(d){let{name:u}=d,[i,w]=r(),[h,v]=r(u?"":O),[y,I]=r(),[z,k]=r(!1),[C,x]=r(!1),[U,D]=r(!1),[H,N]=r(!1),L=R();o(()=>{if(!u)return;let a=!0;return de.skillDocument(u).then((l)=>{if(!a)return;w(l),v(l.text)},(l)=>a&&I(c(l))),()=>{a=!1}},[u]);let E=i?.text??"",V=h!==E,F=u!==void 0&&!i&&!y,K=async()=>{x(!0);try{if(i){let a=await de.saveSkillDocument(i.name,{text:h,baseHash:i.hash});w(a),v(a.text),k(!1),D(!1),f(t("Saved.")),d.onSaved()}else await de.createSkillDocument({text:h}),f(t("Skill created.")),d.onSaved(),d.onClose()}catch(a){if(a instanceof fe&&a.status===409){let{current:l}=a.body;w(l),D(!0)}else f(c(a),"danger")}finally{x(!1)}};return n(A,{open:!0,title:u??t("New skill"),size:"full",onClose:d.onClose,children:[y?e(m,{message:y}):null,F?e(S,{}):null,i&&!i.writable?e(m,{message:t("This skill cannot be edited here.")}):null,!F&&!y&&(!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")}),U?e(m,{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(yt,{label:"SKILL.md",before:E,after:h}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:C,onClick:()=>k(!1),children:t("Back to editing")}),e("button",{type:"button",disabled:C,onClick:K,children:C?t("Saving…"):i?t("Save"):t("Create skill")})]})]}):n(g,{children:[n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:L,children:"SKILL.md"}),i?e("span",{className:"field-tools",children:n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>N(!0),children:[e(s,{name:"reset",size:16}),t("History")]})}):null]}),e("textarea",{id:L,className:"prompt-full",spellCheck:!1,value:h,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:!V||!h.trim(),onClick:()=>k(!0),children:t("Review changes")})})]}),H&&i?e(T,{fallback:null,children:e(B,{open:H,title:t("History of {name}",{name:i.name}),load:async()=>{let{versions:a}=await de.skillHistory(i.name);return a.map((l,M)=>({id:l.id,text:l.text,previous:a[M+1]?.text??"",by:l.by,at:l.at}))},onUse:(a)=>{v(a),k(!1),N(!1)},onClose:()=>N(!1)})}):null]}):null]})}export{_ as SkillEditor};
@@ -1 +1 @@
1
- import{p,so,T,b,o,r,t,g,e,n,s,y,l,f,S,m,k,Q,tn,$t}from"./chunk-index-st18ee4w.js";import{D}from"./chunk-index-1ysj78e4.js";import{cn}from"./chunk-index-5n8npdch.js";import{ke}from"./chunk-index-0cnvzj8b.js";import{de}from"./chunk-index-tn797j5g.js";import{H}from"./chunk-index-a36h36x0.js";import"./chunk-index-04ndj4hg.js";function x({source:a}){return e("div",{className:"prose document",children:e(tn,{remarkPlugins:[$t],components:{a:({href:i,children:d})=>i&&/^https?:\/\//.test(i)?e("a",{href:i,target:"_blank",rel:"noreferrer",children:d}):e("span",{children:d}),img:({alt:i})=>e("span",{children:i}),pre:({children:i})=>e("div",{className:"code-block",children:e("pre",{children:i})}),table:({children:i})=>e("div",{className:"table-wrap",children:e("table",{children:i})})},children:a})})}function B(a){let{data:i,error:d,reload:c}=cn(()=>de.skillGroups()),[N,u]=r(),[v,V]=r(),h=()=>{c(),a.onChanged()};return n("section",{className:"stack","aria-label":t("Skill groups"),children:[n("div",{className:"card-head",children:[e("h2",{children:t("Skill groups")}),n("button",{type:"button",className:"secondary",onClick:()=>u({group:void 0}),children:[e(s,{name:"plus",size:16}),t("New group")]})]}),e("p",{className:"hint",children:t("A group lists skills to switch on for a knight in one step, from the knight's sheet. Knights carry the skills, not the group.")}),d?e(m,{message:d}):null,!i&&!d?e(S,{}):null,i?.groups.length===0?e(k,{children:t("No skill groups.")}):null,i?.groups.map((w)=>n("article",{className:"card skill-group",children:[n("div",{className:"card-head",children:[e("strong",{children:w.name}),e("button",{type:"button",className:"secondary",onClick:()=>u({group:w}),children:t("Edit")}),e("button",{type:"button",className:"secondary",onClick:()=>V(w),children:t("Delete")})]}),e("p",{children:w.description}),n("p",{className:"hint",children:[t("Skills"),": ",w.skills.join(", ")||t("None")]})]},w.name)),e(H,{open:N!==void 0,title:N?.group?t("Edit {name}",{name:N.group.name}):t("New skill group"),onClose:()=>u(void 0),children:N?e(A,{group:N.group,catalog:a.catalog,onCancel:()=>u(void 0),onDone:()=>{u(void 0),h()}},N.group?.name??""):null}),e(D,{open:v!==void 0,title:t("Delete this skill group?"),confirmLabel:t("Delete group"),tone:"danger",onClose:()=>V(void 0),onConfirm:async()=>{if(!v)return;await de.deleteSkillGroup(v.name),f(t("Deleted {name}.",{name:v.name})),h()},children:e("p",{children:t("{name} will be deleted. Its skills stay, and so does every knight that carries them.",{name:v?.name??""})})})]})}function A(a){let[i,d]=r(a.group?.name??""),[c,N]=r(a.group?.description??""),[u,v]=r(a.group?.skills??[]),[V,h]=r(),[w,G]=r(!1);return n("form",{className:"stack",onSubmit:async(E)=>{E.preventDefault(),G(!0),h(void 0);try{let L=a.group?.name;await de.saveSkillGroup(i.trim(),{description:c,skills:[...a.catalog.map((F)=>F.name).filter((F)=>u.includes(F)),...u.filter((F)=>!a.catalog.some((z)=>z.name===F))],...L?{from:L}:{}}),f(t("Saved {name}.",{name:i.trim()})),a.onDone()}catch(L){h(l(L))}finally{G(!1)}},autoComplete:"off",children:[n("label",{children:[t("Name"),e("input",{value:i,maxLength:64,placeholder:"coding",required:!0,onChange:(E)=>d(E.target.value)}),e("span",{className:"meta",children:t("Lowercase letters, digits and single hyphens, up to 64.")})]}),n("label",{children:[t("Description"),e("textarea",{value:c,maxLength:1000,rows:2,required:!0,onChange:(E)=>N(E.target.value)})]}),n("fieldset",{className:"field",children:[e("legend",{children:t("Skills")}),e("ul",{className:"menu",children:a.catalog.map((E)=>{let L=u.includes(E.name);return e("li",{children:n("label",{className:"menu-item menu-toggle",children:[e("input",{type:"checkbox",checked:L,onChange:()=>v(L?u.filter((F)=>F!==E.name):[...u,E.name])}),n("span",{className:"menu-text",children:[e("strong",{children:E.name}),E.description?e("span",{className:"meta",children:E.description}):null]})]})},E.name)})})]}),V?e(m,{message:V}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:w,onClick:a.onCancel,children:t("Cancel")}),e("button",{type:"submit",disabled:w,children:t("Save group")})]})]})}var I=b(()=>(p("641sd772"),import("./chunk-skill-editor-641sd772.js")).then((a)=>({default:a.SkillEditor})));function we(){let[a,i]=r(0),{data:d,error:c}=ke(()=>y.skills(),`skills:${a}`),[N,u]=r(),[v,V]=r(),[h,w]=r();o(()=>{y.session().then(u,()=>{return})},[]);let G=N?.skillEdit===!0;return n("section",{className:"stack",children:[n("div",{className:"card-head",children:[e("h2",{children:t("Skills")}),G?n("button",{type:"button",className:"secondary",onClick:()=>V({name:void 0}),children:[e(s,{name:"plus",size:16}),t("New skill")]}):null]}),e("p",{className:"hint",children:G?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.")}),c?e(m,{message:c}):null,!d&&!c?e(S,{}):null,d?.length===0?e(k,{children:t("No skills.")}):null,d?.map((C)=>e(R,{skill:C,onEdit:G&&C.source.kind==="written"?()=>V({name:C.name}):void 0,onDelete:G&&C.source.kind==="written"?()=>w(C):void 0},`${C.name}:${a}`)),G?e(B,{catalog:d??[],onChanged:()=>i((C)=>C+1)}):null,v?e(T,{fallback:null,children:e(I,{name:v.name,onSaved:()=>i((C)=>C+1),onClose:()=>V(void 0)},v.name??"")}):null,e(D,{open:h!==void 0,title:t("Delete this skill?"),confirmLabel:t("Delete skill"),tone:"danger",onClose:()=>w(void 0),onConfirm:async()=>{if(!h)return;await de.deleteSkillDocument(h.name),i((C)=>C+1),f(t("Deleted {name}.",{name:h.name}))},children:h?e(M,{skill:h}):null})]})}function M({skill:a}){return n(g,{children:[e("p",{children:a.carriers.length?t("{name} will be deleted and taken from the knights that carry it: {carriers}.",{name:a.name,carriers:a.carriers.join(", ")}):t("{name} will be deleted. No knight carries it.",{name:a.name})}),a.groups.length?e("p",{children:t("It also leaves the skill groups {groups}.",{groups:a.groups.join(", ")})}):null,e("p",{children:t("This cannot be undone.")})]})}function O(a){switch(a.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:a.package});case"linked":return t("Linked from {repo}; change it in its repository.",{repo:`${a.repo}:${a.path}`});default:return}}function R({skill:a,onEdit:i,onDelete:d}){let[c,N]=r(!1),[u,v]=r(),[V,h]=r(),w=a.source.kind==="builtin"?t("Built-in"):a.source.kind==="written"?t("Knight-written"):a.source.kind==="package"?a.source.package:`${a.source.repo}:${a.source.path}`;return n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:a.name}),e(Q,{children:w}),a.missing?e(Q,{tone:"warn",children:t("File missing")}):n(g,{children:[i?e("button",{type:"button",className:"secondary",onClick:i,children:t("Edit")}):null,e("button",{type:"button",className:"secondary",onClick:()=>{if(N(!0),!u)h(void 0),y.skill(a.name).then(v).catch((G)=>h(l(G)))},children:"SKILL.md"})]}),d?e("button",{type:"button",className:"secondary",onClick:d,children:t("Delete")}):null]}),e("p",{children:a.missing??a.description}),a.source.kind!=="written"?n("p",{className:"hint skill-lock",children:[e(s,{name:"lock",size:14}),e("span",{children:O(a.source)})]}):null,n("p",{className:"hint",children:[t("Carriers"),":"," ",a.source.kind==="builtin"?t("All knights"):a.carriers.join(", ")||t("None")]}),a.groups.length?n("p",{className:"hint",children:[t("Groups"),": ",a.groups.join(", ")]}):null,e(H,{open:c,title:a.name,size:"wide",onClose:()=>N(!1),children:V?e(m,{message:V}):!u?e(S,{}):e(K,{title:a.name,detail:u})})]})}function K({title:a,detail:i}){let d=i.metadata.filter((c)=>!(c.key==="name"&&c.value===a));return n("div",{className:"skill-document",children:[d.length?e("dl",{className:"skill-meta",children:d.map((c)=>n(so,{children:[e("dt",{children:c.key}),e("dd",{children:c.value})]},c.key))}):null,e(x,{source:i.body})]})}export{we as SkillsPage};
1
+ import{p,ao,T,b,o,r,t,g,e,n,s,y,c,f,S,m,k,Q,tn,$t}from"./chunk-index-htdkpbrd.js";import{D}from"./chunk-index-kjxva289.js";import{cn}from"./chunk-index-0xq8m6nw.js";import{ke}from"./chunk-index-5j6m33d2.js";import{de}from"./chunk-index-rny986v2.js";import{H}from"./chunk-index-evmzrr8e.js";import"./chunk-index-1kvnezap.js";function x({source:a}){return e("div",{className:"prose document",children:e(tn,{remarkPlugins:[$t],components:{a:({href:i,children:l})=>i&&/^https?:\/\//.test(i)?e("a",{href:i,target:"_blank",rel:"noreferrer",children:l}):e("span",{children:l}),img:({alt:i})=>e("span",{children:i}),pre:({children:i})=>e("div",{className:"code-block",children:e("pre",{children:i})}),table:({children:i})=>e("div",{className:"table-wrap",children:e("table",{children:i})})},children:a})})}function B(a){let{data:i,error:l,reload:d}=cn(()=>de.skillGroups()),[N,u]=r(),[v,V]=r(),h=()=>{d(),a.onChanged()};return n("section",{className:"stack","aria-label":t("Skill groups"),children:[n("div",{className:"card-head",children:[e("h2",{children:t("Skill groups")}),n("button",{type:"button",className:"secondary",onClick:()=>u({group:void 0}),children:[e(s,{name:"plus",size:16}),t("New group")]})]}),e("p",{className:"hint",children:t("A group lists skills to switch on for a knight in one step, from the knight's sheet. Knights carry the skills, not the group.")}),l?e(m,{message:l}):null,!i&&!l?e(S,{}):null,i?.groups.length===0?e(k,{children:t("No skill groups.")}):null,i?.groups.map((w)=>n("article",{className:"card skill-group",children:[n("div",{className:"card-head",children:[e("strong",{children:w.name}),e("button",{type:"button",className:"secondary",onClick:()=>u({group:w}),children:t("Edit")}),e("button",{type:"button",className:"secondary",onClick:()=>V(w),children:t("Delete")})]}),e("p",{children:w.description}),n("p",{className:"hint",children:[t("Skills"),": ",w.skills.join(", ")||t("None")]})]},w.name)),e(H,{open:N!==void 0,title:N?.group?t("Edit {name}",{name:N.group.name}):t("New skill group"),onClose:()=>u(void 0),children:N?e(A,{group:N.group,catalog:a.catalog,onCancel:()=>u(void 0),onDone:()=>{u(void 0),h()}},N.group?.name??""):null}),e(D,{open:v!==void 0,title:t("Delete this skill group?"),confirmLabel:t("Delete group"),tone:"danger",onClose:()=>V(void 0),onConfirm:async()=>{if(!v)return;await de.deleteSkillGroup(v.name),f(t("Deleted {name}.",{name:v.name})),h()},children:e("p",{children:t("{name} will be deleted. Its skills stay, and so does every knight that carries them.",{name:v?.name??""})})})]})}function A(a){let[i,l]=r(a.group?.name??""),[d,N]=r(a.group?.description??""),[u,v]=r(a.group?.skills??[]),[V,h]=r(),[w,G]=r(!1);return n("form",{className:"stack",onSubmit:async(E)=>{E.preventDefault(),G(!0),h(void 0);try{let L=a.group?.name;await de.saveSkillGroup(i.trim(),{description:d,skills:[...a.catalog.map((F)=>F.name).filter((F)=>u.includes(F)),...u.filter((F)=>!a.catalog.some((z)=>z.name===F))],...L?{from:L}:{}}),f(t("Saved {name}.",{name:i.trim()})),a.onDone()}catch(L){h(c(L))}finally{G(!1)}},autoComplete:"off",children:[n("label",{children:[t("Name"),e("input",{value:i,maxLength:64,placeholder:"coding",required:!0,onChange:(E)=>l(E.target.value)}),e("span",{className:"meta",children:t("Lowercase letters, digits and single hyphens, up to 64.")})]}),n("label",{children:[t("Description"),e("textarea",{value:d,maxLength:1000,rows:2,required:!0,onChange:(E)=>N(E.target.value)})]}),n("fieldset",{className:"field",children:[e("legend",{children:t("Skills")}),e("ul",{className:"menu",children:a.catalog.map((E)=>{let L=u.includes(E.name);return e("li",{children:n("label",{className:"menu-item menu-toggle",children:[e("input",{type:"checkbox",checked:L,onChange:()=>v(L?u.filter((F)=>F!==E.name):[...u,E.name])}),n("span",{className:"menu-text",children:[e("strong",{children:E.name}),E.description?e("span",{className:"meta",children:E.description}):null]})]})},E.name)})})]}),V?e(m,{message:V}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:w,onClick:a.onCancel,children:t("Cancel")}),e("button",{type:"submit",disabled:w,children:t("Save group")})]})]})}var I=b(()=>(p("4jkr948n"),import("./chunk-skill-editor-4jkr948n.js")).then((a)=>({default:a.SkillEditor})));function we(){let[a,i]=r(0),{data:l,error:d}=ke(()=>y.skills(),`skills:${a}`),[N,u]=r(),[v,V]=r(),[h,w]=r();o(()=>{y.session().then(u,()=>{return})},[]);let G=N?.skillEdit===!0;return n("section",{className:"stack",children:[n("div",{className:"card-head",children:[e("h2",{children:t("Skills")}),G?n("button",{type:"button",className:"secondary",onClick:()=>V({name:void 0}),children:[e(s,{name:"plus",size:16}),t("New skill")]}):null]}),e("p",{className:"hint",children:G?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.")}),d?e(m,{message:d}):null,!l&&!d?e(S,{}):null,l?.length===0?e(k,{children:t("No skills.")}):null,l?.map((C)=>e(R,{skill:C,onEdit:G&&C.source.kind==="written"?()=>V({name:C.name}):void 0,onDelete:G&&C.source.kind==="written"?()=>w(C):void 0},`${C.name}:${a}`)),G?e(B,{catalog:l??[],onChanged:()=>i((C)=>C+1)}):null,v?e(T,{fallback:null,children:e(I,{name:v.name,onSaved:()=>i((C)=>C+1),onClose:()=>V(void 0)},v.name??"")}):null,e(D,{open:h!==void 0,title:t("Delete this skill?"),confirmLabel:t("Delete skill"),tone:"danger",onClose:()=>w(void 0),onConfirm:async()=>{if(!h)return;await de.deleteSkillDocument(h.name),i((C)=>C+1),f(t("Deleted {name}.",{name:h.name}))},children:h?e(M,{skill:h}):null})]})}function M({skill:a}){return n(g,{children:[e("p",{children:a.carriers.length?t("{name} will be deleted and taken from the knights that carry it: {carriers}.",{name:a.name,carriers:a.carriers.join(", ")}):t("{name} will be deleted. No knight carries it.",{name:a.name})}),a.groups.length?e("p",{children:t("It also leaves the skill groups {groups}.",{groups:a.groups.join(", ")})}):null,e("p",{children:t("This cannot be undone.")})]})}function O(a){switch(a.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:a.package});case"linked":return t("Linked from {repo}; change it in its repository.",{repo:`${a.repo}:${a.path}`});default:return}}function R({skill:a,onEdit:i,onDelete:l}){let[d,N]=r(!1),[u,v]=r(),[V,h]=r(),w=a.source.kind==="builtin"?t("Built-in"):a.source.kind==="written"?t("Knight-written"):a.source.kind==="package"?a.source.package:`${a.source.repo}:${a.source.path}`;return n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:a.name}),e(Q,{children:w}),a.missing?e(Q,{tone:"warn",children:t("File missing")}):n(g,{children:[i?e("button",{type:"button",className:"secondary",onClick:i,children:t("Edit")}):null,e("button",{type:"button",className:"secondary",onClick:()=>{if(N(!0),!u)h(void 0),y.skill(a.name).then(v).catch((G)=>h(c(G)))},children:"SKILL.md"})]}),l?e("button",{type:"button",className:"secondary",onClick:l,children:t("Delete")}):null]}),e("p",{children:a.missing??a.description}),a.source.kind!=="written"?n("p",{className:"hint skill-lock",children:[e(s,{name:"lock",size:14}),e("span",{children:O(a.source)})]}):null,n("p",{className:"hint",children:[t("Carriers"),":"," ",a.source.kind==="builtin"?t("All knights"):a.carriers.join(", ")||t("None")]}),a.groups.length?n("p",{className:"hint",children:[t("Groups"),": ",a.groups.join(", ")]}):null,e(H,{open:d,title:a.name,size:"wide",onClose:()=>N(!1),children:V?e(m,{message:V}):!u?e(S,{}):e(K,{title:a.name,detail:u})})]})}function K({title:a,detail:i}){let l=i.metadata.filter((d)=>!(d.key==="name"&&d.value===a));return n("div",{className:"skill-document",children:[l.length?e("dl",{className:"skill-meta",children:l.map((d)=>n(ao,{children:[e("dt",{children:d.key}),e("dd",{children:d.value})]},d.key))}):null,e(x,{source:i.body})]})}export{we as SkillsPage};
@@ -1,4 +1,4 @@
1
- import{t,g,e,n,s,u}from"./chunk-index-st18ee4w.js";import{Us}from"./chunk-index-4ehy2d04.js";import{B}from"./chunk-index-fw6kawhw.js";var l=`
1
+ import{t,g,e,n,s,l}from"./chunk-index-htdkpbrd.js";import{qs}from"./chunk-index-e6z5kyz8.js";import{B}from"./chunk-index-fw6kawhw.js";var p=`
2
2
  .line.start-over {
3
3
  flex-wrap: wrap;
4
4
  margin-top: var(--space-4);
@@ -13,4 +13,4 @@ import{t,g,e,n,s,u}from"./chunk-index-st18ee4w.js";import{Us}from"./chunk-index-
13
13
  margin-top: var(--space-6);
14
14
  font-size: var(--text-sm);
15
15
  }
16
- `;function p(a){B("start-over",l);let{message:o}=a,i=u((m)=>{let r=m.rooms[o.room];return r?.messages.at(-1)?.id===o.id&&r.pending.length===0&&r.live.length===0});return n(g,{children:[n("li",{className:"line start-over","data-enter":a.enter||void 0,children:[e(s,{name:"reset",size:14}),e("span",{children:t("Conversation started over")}),e("button",{type:"button",className:"link-button",onClick:()=>Us(o.room,o.id),children:t("View the archived conversation")})]}),i?e("li",{className:"line start-over-empty",children:e("span",{children:t("No messages yet. Say hello.")})}):null]})}export{p as default};
16
+ `;function c(a){B("start-over",p);let{message:o}=a,i=l((m)=>{let r=m.rooms[o.room];return r?.messages.at(-1)?.id===o.id&&r.pending.length===0&&r.live.length===0});return n(g,{children:[n("li",{className:"line start-over","data-enter":a.enter||void 0,children:[e(s,{name:"reset",size:14}),e("span",{children:t("Conversation started over")}),e("button",{type:"button",className:"link-button",onClick:()=>qs(o.room,o.id),children:t("View the archived conversation")})]}),i?e("li",{className:"line start-over-empty",children:e("span",{children:t("No messages yet. Say hello.")})}):null]})}export{c as default};
@@ -0,0 +1 @@
1
+ import{C,a,r,t,F,g,e,n,s,x,X,Me,ze,l,Ve,rn,Mn,et,$e,It,Ne,on}from"./chunk-index-htdkpbrd.js";import{me}from"./chunk-index-hrpmm09c.js";import{Li}from"./chunk-index-q6txr5q7.js";import"./chunk-index-50r5h98m.js";import{bn,fr}from"./chunk-index-y37ffyvy.js";import{$i}from"./chunk-index-w1rarv3r.js";import{Ni}from"./chunk-index-ff8vzfgq.js";import{Jt}from"./chunk-index-n7187vns.js";import{wa}from"./chunk-index-w0vfwqck.js";bn();var L=(o)=>o==="pinned"||o==="rest"?$e(o):o==="waiting"||o==="home"?void 0:o;function S(){let o=l((u)=>JSON.stringify(wa(u,(d)=>ze(u,d),(d)=>Me(u,d)>0,!0).map((d)=>({id:d.id,...d.title===void 0?{}:{title:d.title},entries:d.keys.map((w)=>({key:w,name:u.rooms[w]?.view?.displayName??w,waiting:Me(u,w)>0}))})))),c=Li(),p=a(o);if(!c)p.current=o;let h=p.current;return C(()=>JSON.parse(h),[h])}function K(o){let{key:c,name:p}=o.entry,h=l((m)=>m.rooms[c]),u=l((m)=>Me(m,c)),d=h?.view,w=et(d?.character),b=Jt(()=>rn(c,o.onLeave),o.liftable&&!d?.home?Ni(c):void 0);if(!d)return null;return e("li",{...o.liftable&&!d.home?{"data-drop-item":"","data-key":c}:{},children:n("a",{className:"switcher-row",...b,href:x("room",c),"aria-current":c===o.current?"page":void 0,style:w,onClick:(m)=>{if(m.button!==0||m.metaKey||m.ctrlKey||m.shiftKey||m.altKey)return;m.preventDefault(),o.onPick(c)},children:[n("span",{className:"switcher-picture",children:[e(Ne,{view:d,size:40}),u?e("span",{className:"switcher-dot","aria-hidden":"true"}):null]}),n("span",{className:"switcher-name",children:[e("strong",{children:p}),h?.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(on,{room:c}),u?e("span",{className:"badge badge-warn",children:F(u,"{count} card waiting","{count} cards waiting")}):null,d.muted?n("span",{className:"switcher-mode","data-mode":"muted",title:t("Notifications are off"),children:[e(s,{name:"bell-off",size:14}),e("span",{className:"visually-hidden",children:t("Notifications are off")})]}):null,h?.mode.yolo?n("span",{className:"switcher-mode","data-mode":"yolo",title:t("Yolo"),children:[e(s,{name:"bolt",size:14}),e("span",{className:"visually-hidden",children:t("Yolo")})]}):null,h?.mode.longRunning?n("span",{className:"switcher-mode","data-mode":"long",title:t("Long-running"),children:[e(s,{name:"timer",size:14}),e("span",{className:"visually-hidden",children:t("Long-running")})]}):null]})})}function _(o){let[c,p]=r(""),h=S(),u=It(),d=me((i)=>i.unread),w=h.map((i)=>({...i,entries:i.entries.filter((f)=>$i(c,f.name)!==void 0)})).filter((i)=>i.entries.length>0||c===""),b=w.filter((i)=>i.entries.length>0).length>1,m=w.map((i)=>{let f=L(i.id),y=b&&c===""&&f!==void 0&&i.entries.length>0&&u.has(f);return{...i,fold:f,folded:y,total:i.entries.length,entries:y?i.entries.filter((N)=>N.key===o.current||N.waiting||(d[N.key]??0)>0):i.entries}}),k=(i)=>o.close(i===o.current?void 0:()=>X("room",i)),z=h.some((i)=>i.id!=="waiting"&&i.id!=="home"&&i.id!=="rest"&&(i.id!=="pinned"||i.entries.length>0))?t("Ungrouped"):t("Rooms"),v=(i)=>i.id==="home"?t("Home"):i.id==="pinned"?t("Pinned"):i.id==="rest"?z:i.title??t("Rooms");return n(g,{children:[n("div",{className:"switcher-search",children:[e(s,{name:"search",size:16}),e("input",{type:"search",value:c,placeholder:t("Find a room"),"aria-label":t("Find a room"),enterKeyHint:"go",autoComplete:"off",onChange:(i)=>p(i.target.value),onKeyDown:(i)=>{let f=m.flatMap((y)=>y.entries)[0];if(i.key==="Enter"&&f&&!Ve(i.nativeEvent))k(f.key)}}),e("button",{type:"button",className:"icon-button switcher-add","aria-label":t("Add"),"aria-haspopup":"menu",onClick:(i)=>Mn(i.currentTarget,o.close),children:e(s,{name:"plus"})})]}),e("div",{className:"switcher-scroll","data-drop-root":"",children:m.map((i)=>{let f=i.id==="waiting",y=i.id==="pinned"?"pinned":i.id==="rest"?"rest":f||i.id==="home"?void 0:"folder";return n("section",{"aria-label":f?t("Waiting for you"):v(i),...i.total===0?{"data-empty":""}:{},...y?{"data-drop-zone":y,"data-zone-id":i.id,...y==="folder"?{"data-folder":i.id}:{}}:{},children:[f?e("h2",{className:"switcher-heading","data-waiting":"",children:t("Waiting for you")}):b||i.total===0?e("h2",{className:"switcher-heading",children:i.fold&&i.total>0?e(fr,{id:i.fold,name:v(i),open:!i.folded,controls:`switcher-body-${i.id}`,count:i.folded?i.total:void 0}):v(i)}):null,e("ul",{className:"switcher-list",id:`switcher-body-${i.id}`,children:i.entries.map((N)=>e(K,{entry:N,current:o.current,onPick:k,onLeave:o.close,liftable:!f&&i.id!=="home"},N.key))})]},i.id)})})]})}export{_ as SwitcherList};
@@ -1 +1 @@
1
- import{O,oa,si}from"./chunk-index-st18ee4w.js";import{Ro,Co}from"./chunk-index-1pgm1gy4.js";import{ir,ls}from"./chunk-index-smvd91qx.js";import"./chunk-index-435pq3gd.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 T(){let s=()=>ir().badge+Co(),a=()=>oa(s());g({count:()=>si(O.getState())+s(),subscribe:(r)=>{let t=()=>{a(),r()};O.subscribe(t),ls(t),Ro(t)},render:m}),a()}export{T as startPageTabDot};
1
+ import{O,aa,si}from"./chunk-index-htdkpbrd.js";import{Co,Eo}from"./chunk-index-hrpmm09c.js";import{rr,us}from"./chunk-index-xj1960qj.js";import"./chunk-index-nk38jsgf.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 T(){let s=()=>rr().badge+Eo(),a=()=>aa(s());g({count:()=>si(O.getState())+s(),subscribe:(r)=>{let t=()=>{a(),r()};O.subscribe(t),us(t),Co(t)},render:m}),a()}export{T as startPageTabDot};
@@ -0,0 +1 @@
1
+ import{Qe,o,r,t,e,n,s,X,l,lt}from"./chunk-index-htdkpbrd.js";import{er,Un,vi,as,dn,xi,Vn,tr,Vr}from"./chunk-index-zwfdwgnb.js";import"./chunk-index-fdv6mepk.js";import"./chunk-index-t9an6yb2.js";import"./chunk-index-bdf7gs56.js";import"./chunk-index-hrpmm09c.js";import"./chunk-index-63qqjbs8.js";import"./chunk-index-1kvnezap.js";import{ws,Ri,ks}from"./chunk-index-3c4wvjkj.js";er();function y(){return as((Qe(lt)?.kinds??[]).map((a)=>a.kind)),null}function v({focus:a}){let[c,p]=r(),u=dn(void 0),i=Un(),b=i.loaded&&u.length===0;return o(()=>{if(a&&i.loaded)X("table",void 0,{replace:!0})},[a,i.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:[c?.kind==="webgl"?e("button",{type:"button",className:"icon-button","aria-label":t("Reset view"),title:t("Reset view"),onClick:()=>c.focus(null),children:e(s,{name:"reset"})}):null,e("button",{type:"button",className:"secondary",onClick:()=>X("rooms"),children:t("All rooms")})]})]}),n("div",{className:"table-frame",children:[b?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(Vn,{onHandle:p,onSeat:(f)=>{let m=u.find((d)=>d.name===f);if(m)X("room",m.key)},onFocus:(f)=>{let m=u.find((d)=>d.name===f);if(m)X("room",m.key)}}),e(y,{})]})]})}function N({named:a}){let c=Ri(),p=ws(),u=l((g)=>g.listed),i=ks(c,p,a),b=xi(),{ask:f,sheet:m}=tr(i),d=a===void 0||c.some(k(a));o(()=>{if(a!==void 0&&u&&!d)X("table",void 0,{replace:!0})},[a,u,d]);let h=n("div",{className:"table-empty-state",children:[e("strong",{children:i?t("The council is empty"):t("No council yet")}),e("p",{className:"meta",children:i?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.",{max:8})}),b.length>0?e("button",{type:"button",onClick:f,children:i?t("Edit this council"):t("Pick who sits")}):null]});if(i)return n("section",{className:"room council-page",children:[e(Vr,{roomKey:i.key,empty:h}),m]});return n("div",{className:"table-page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Round table")})}),e("div",{className:"table-frame",children:h}),m]})}var k=(a)=>(c)=>c.key===a||c.name===a;function F({focus:a}){return vi()?e(v,{focus:a}):e(N,{named:a})}export{F as TablePage};
@@ -1 +1 @@
1
- import{Gn,Zr,Wr,Rt,mn,gn,Ti,Os}from"./chunk-index-pz6926p5.js";import"./chunk-index-r1g24er0.js";import{Et,Wt}from"./chunk-index-0xdptr30.js";var ye="http://www.w3.org/2000/svg",t=(d,s={},y)=>{let k=document.createElementNS(ye,d);for(let[S,G]of Object.entries(s))k.setAttribute(S,String(G));return y?.appendChild(k),k},ne=(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)}`},xe=0;function we(d,s){let y=s||d<=6?1:2;return{rows:y,perRow:Math.max(1,Math.ceil(d/y))}}function Ee(d,s){let y=`t2d${++xe}`,k=window.matchMedia("(prefers-reduced-motion: reduce)"),S=s.reducedMotion==="auto"||s.reducedMotion===void 0?k.matches:s.reducedMotion,G=s.labels??Wt,{theme:z,scheme:q}=s,v=[],B=new Map,A=new Map,R=new Map,N=new Map,C=s.focus??null,E=document.createElement("div");E.className="t2d";let m=t("svg",{role:"group","aria-label":G.table});if(E.appendChild(m),getComputedStyle(d).position==="static")d.style.position="relative";d.appendChild(E);function ie(e,r,a){let o=Math.max(1.6,a*0.022),u=o+Math.max(1.2,a*0.014),l=t("filter",{id:`${y}-rim`,x:"-15%",y:"-15%",width:"130%",height:"130%"},e);t("feMorphology",{in:"SourceAlpha",operator:"dilate",radius:u,result:"far"},l),t("feFlood",{"flood-color":r.ink,result:"ink"},l),t("feComposite",{in:"ink",in2:"far",operator:"in",result:"line"},l),t("feMorphology",{in:"SourceAlpha",operator:"dilate",radius:o,result:"near"},l),t("feFlood",{"flood-color":r.paper,result:"paper"},l),t("feComposite",{in:"paper",in2:"near",operator:"in",result:"rim"},l);let c=t("feMerge",{},l);for(let b of["line","rim","SourceGraphic"])t("feMergeNode",{in:b},c)}function x(){let e=Gn(z,q);E.classList.toggle("reduced",S),E.classList.toggle("focus",C!==null),E.classList.toggle("dim",v.some((i)=>R.get(i.id)==="speaking"));let r=s.variant==="compact",a=Math.max(d.clientWidth,200),o=Math.max(d.clientHeight,r?60:200);m.setAttribute("viewBox",`0 0 ${a} ${o}`),m.replaceChildren();let u=Math.max(v.length,1),{rows:l,perRow:c}=we(u,r);t("rect",{width:a,height:o,fill:e.css.bg},m);let b=t("defs",{},m),T=a/2,O=r?o*0.82:o*0.62;if(t("ellipse",{cx:T,cy:O,rx:a*0.47,ry:r?o*0.2:o*0.34,fill:e.css.floor,stroke:e.ink,"stroke-width":2},m),!r)t("ellipse",{cx:T,cy:O,rx:a*0.3,ry:o*0.2,fill:"none",stroke:e.css.ring,"stroke-width":3,opacity:e.night?0.9:0.7},m);let I=a/c,V=r?o*0.95:o/(l+0.6),se=r?(o*0.92-6)/1.54:132,g=Math.max(46,Math.min(I*0.94,132,V*1.05,se)),h=g*0.72,n=g*1.05;ie(b,e,n),v.forEach((i,w)=>{let M=t("radialGradient",{id:`${y}-h${w}`},b);t("stop",{offset:0,"stop-color":i.color,"stop-opacity":0.95},M),t("stop",{offset:1,"stop-color":i.color,"stop-opacity":0},M)});let ae=(i)=>{if(r)return o*0.92;return l===1?o*0.62:o*(0.46+i*0.3)};if(v.forEach((i,w)=>{let M=Math.floor(w/c),le=Math.min(c,u-M*c),ce=w-M*c,de=a/le*(ce+0.5),fe=ae(M),F=R.get(i.id)??"idle",f=t("g",{class:"seat","data-seat":i.id,"data-state":F,...C===i.id?{"data-focus":""}:{},transform:`translate(${de.toFixed(1)} ${fe.toFixed(1)})`,tabindex:s.listBelow?-1:0,role:"button","aria-label":G.seat(i.name,F),color:e.css.text,...s.listBelow?{"aria-hidden":"true"}:{}},m);t("ellipse",{cx:0,cy:3,rx:g*0.55,ry:g*0.1,fill:"#000",opacity:0.35},f),t("ellipse",{class:"halo",cx:0,cy:-h-n*0.35,rx:n*0.8,ry:n*0.8,fill:`url(#${y}-h${w})`},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:i.color,opacity:0.2},f);let _=t("g",{class:"lift"},f),Z=B.get(i.id);if(Z){let p={x:-n/2,y:-h-n*0.78,width:n,height:n*0.88,filter:`url(#${y}-rim)`};t("image",{href:ne(Z),...p,...i.dim?{opacity:0.55}:{}},_);let oe=A.get(i.id);if(F==="speaking"&&oe&&!S){let he=t("image",{class:"talk",href:ne(oe),...p,opacity:0},_),{frames:ue,seconds:pe}=Os(w);t("animate",{attributeName:"opacity",values:ue.join(";"),dur:`${pe.toFixed(3)}s`,calcMode:"discrete",repeatCount:"indefinite"},he)}}else{t("circle",{cx:0,cy:-h-n*0.3,r:n*0.3,fill:i.color,stroke:e.ink,"stroke-width":2},_);let p=t("text",{x:0,y:-h-n*0.3+n*0.1,"text-anchor":"middle","font-size":n*0.3,"font-weight":700,fill:"#fff","font-family":Rt},_);p.textContent=Array.from(i.name)[0]?.toUpperCase()??"?"}let J=h*0.22;t("path",{d:`M ${-g*0.5} ${-h} L ${g*0.5} ${-h} L ${g*0.42} 0 L ${-g*0.42} 0 Z`,fill:e.wood,stroke:e.ink,"stroke-width":2,"stroke-linejoin":"round"},f),t("rect",{x:-g*0.54,y:-h-J*0.2,width:g*1.08,height:J,rx:2,fill:e.woodLight,stroke:e.ink,"stroke-width":2},f);let L=Math.max(11,Math.min(15,g*0.14)),j=Math.min(Math.max(g*0.9,L*5.5+14),Math.max(g*0.9,i.name.length*L*0.62+18),I*0.98),me=L+8;t("rect",{class:"plate",x:-j/2,y:-h*0.78,width:j,height:me,rx:3,fill:e.gold,stroke:e.ink,"stroke-width":2},f);let ge=t("text",{x:0,y:-h*0.78+L+1.5,"text-anchor":"middle","font-size":L,"font-weight":700,"font-family":Rt,fill:e.plateInk},f),Q=N.get(i.id);ge.textContent=Wr(Q?`${Q} ${i.name}`:i.name,(j-8)/L);let ee=t("g",{class:"badge"},t("g",{transform:`translate(${n*0.4} ${-h-n*0.78})`},f)),D=F==="done",P=F==="error",U=e.gold;if(D)U=Zr.done;else if(P)U=Zr.error;t("circle",{r:n*0.15,fill:U,stroke:e.ink,"stroke-width":2},ee);let W=t("text",{x:0,y:n*0.06,"text-anchor":"middle","font-size":n*0.2,"font-weight":800,"font-family":Rt,fill:D||P?"#fff":e.ink},ee);if(W.textContent="!",D)W.textContent="✓";else if(P)W.textContent="✕";let te=t("g",{class:"orbit"},f);t("circle",{cx:n*0.4,cy:-h-n*0.5,r:n*0.05,fill:i.color},te),t("circle",{cx:-n*0.4,cy:-h-n*0.5,r:n*0.035,fill:i.color,opacity:0.6},te),f.addEventListener("click",(p)=>s.onSeatClick({id:i.id,name:i.name,at:Et(p,f)})),f.addEventListener("keydown",(p)=>{if(p.key==="Enter"||p.key===" ")p.preventDefault(),s.onSeatClick({id:i.id,name:i.name,at:Et({clientX:0,clientY:0,detail:0},f)})})}),!r){let i=Math.min(a*0.34,190),w=o-6;t("rect",{x:T-i/2,y:w-22,width:i,height:22,rx:4,fill:e.wood,stroke:e.ink,"stroke-width":2},m);let M=t("text",{x:T,y:w-7,"text-anchor":"middle","font-size":12,"font-weight":700,"font-family":Rt,fill:e.gold},m);M.textContent=Wr(s.ownerName??"You",12)}}let H=new Set,re=(e,r)=>{if(e.mode==="cut")return;let a=Gn(z,q),o=(u,l)=>{let c=setTimeout(()=>{H.delete(c),u()},l);H.add(c)};for(let u of e.joining){let l=[...m.querySelectorAll("g.seat[data-seat]")].find((c)=>c.getAttribute("data-seat")===u);if(!l)continue;l.classList.add("seat-in"),l.prepend(t("ellipse",{class:"seat-ring",rx:44,ry:12,cy:4,stroke:a.css.ring})),o(()=>{l.classList.remove("seat-in"),l.querySelector(".seat-ring")?.remove()},gn)}for(let u of e.leaving){let l=r.get(u);if(!l)continue;let c=l.cloneNode(!0);c.classList.add("seat-out");for(let b of["data-seat","tabindex","role","aria-label"])c.removeAttribute(b);c.setAttribute("aria-hidden","true");for(let[b,[T,O,I]]of[[-26,-24,20],[24,-20,22],[0,-52,24],[-4,-4,26]].entries()){let V=t("circle",{class:"puff",cx:T,cy:O,r:I,fill:a.paper,stroke:a.ink,"stroke-width":3},c);V.style.animationDelay=`${b*40}ms`}m.appendChild(c),o(()=>c.remove(),mn)}},Y=new ResizeObserver(x);Y.observe(d);let X=()=>{if(s.reducedMotion==="auto"||s.reducedMotion===void 0)K.setReducedMotion(k.matches)};k.addEventListener("change",X);let K={kind:"svg",setTheme(e,r){z=e,q=r,x()},setSeats(e){let r=v.map((o)=>o.id),a=new Map([...m.querySelectorAll("g.seat[data-seat]")].map((o)=>[o.getAttribute("data-seat")??"",o]));v=e;for(let o of e){if(R.set(o.id,o.state??"idle"),o.avatarSvg)B.set(o.id,o.avatarSvg);if(o.talkSvg)A.set(o.id,o.talkSvg);else A.delete(o.id)}if(x(),r.length>0||a.size>0)re(Ti(r,e.map((o)=>o.id),S),a)},setState(e,r){if(R.get(e)===r)return;R.set(e,r),x()},setMark(e,r){if((N.get(e)??null)===r)return;if(r===null)N.delete(e);else N.set(e,r);x()},setAvatar(e,r,a){if(B.set(e,r),a)A.set(e,a);else A.delete(e);return x(),Promise.resolve()},setReducedMotion(e){S=e,x()},resetCamera(){C=null,x(),s.onFocus?.(null)},focus(e){if(e===C)return;C=e,x()},focused:()=>C,getStats(){return{kind:"svg",fps:0,frameMs:0,frameMsMax:0,drawCalls:0,triangles:0,textures:0,geometries:0,dpr:1,lowPower:!1,reduced:S,loop:"idle",seats:v.length,renders:0}},dispose(){for(let e of H)clearTimeout(e);H.clear(),Y.disconnect(),k.removeEventListener("change",X),E.remove()}};return K.setSeats(s.seats),K}export{Ee as createTable2D};
1
+ import{Gn,Wr,Yr,Rt,mn,gn,Pi,bs}from"./chunk-index-apbknsyg.js";import"./chunk-index-63qqjbs8.js";import{Et,Wt}from"./chunk-index-0xdptr30.js";var ye="http://www.w3.org/2000/svg",t=(d,s={},y)=>{let k=document.createElementNS(ye,d);for(let[S,G]of Object.entries(s))k.setAttribute(S,String(G));return y?.appendChild(k),k},ne=(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)}`},xe=0;function we(d,s){let y=s||d<=6?1:2;return{rows:y,perRow:Math.max(1,Math.ceil(d/y))}}function Ee(d,s){let y=`t2d${++xe}`,k=window.matchMedia("(prefers-reduced-motion: reduce)"),S=s.reducedMotion==="auto"||s.reducedMotion===void 0?k.matches:s.reducedMotion,G=s.labels??Wt,{theme:z,scheme:q}=s,v=[],B=new Map,A=new Map,R=new Map,N=new Map,C=s.focus??null,E=document.createElement("div");E.className="t2d";let m=t("svg",{role:"group","aria-label":G.table});if(E.appendChild(m),getComputedStyle(d).position==="static")d.style.position="relative";d.appendChild(E);function ie(e,r,a){let o=Math.max(1.6,a*0.022),u=o+Math.max(1.2,a*0.014),l=t("filter",{id:`${y}-rim`,x:"-15%",y:"-15%",width:"130%",height:"130%"},e);t("feMorphology",{in:"SourceAlpha",operator:"dilate",radius:u,result:"far"},l),t("feFlood",{"flood-color":r.ink,result:"ink"},l),t("feComposite",{in:"ink",in2:"far",operator:"in",result:"line"},l),t("feMorphology",{in:"SourceAlpha",operator:"dilate",radius:o,result:"near"},l),t("feFlood",{"flood-color":r.paper,result:"paper"},l),t("feComposite",{in:"paper",in2:"near",operator:"in",result:"rim"},l);let c=t("feMerge",{},l);for(let b of["line","rim","SourceGraphic"])t("feMergeNode",{in:b},c)}function x(){let e=Gn(z,q);E.classList.toggle("reduced",S),E.classList.toggle("focus",C!==null),E.classList.toggle("dim",v.some((i)=>R.get(i.id)==="speaking"));let r=s.variant==="compact",a=Math.max(d.clientWidth,200),o=Math.max(d.clientHeight,r?60:200);m.setAttribute("viewBox",`0 0 ${a} ${o}`),m.replaceChildren();let u=Math.max(v.length,1),{rows:l,perRow:c}=we(u,r);t("rect",{width:a,height:o,fill:e.css.bg},m);let b=t("defs",{},m),T=a/2,O=r?o*0.82:o*0.62;if(t("ellipse",{cx:T,cy:O,rx:a*0.47,ry:r?o*0.2:o*0.34,fill:e.css.floor,stroke:e.ink,"stroke-width":2},m),!r)t("ellipse",{cx:T,cy:O,rx:a*0.3,ry:o*0.2,fill:"none",stroke:e.css.ring,"stroke-width":3,opacity:e.night?0.9:0.7},m);let I=a/c,V=r?o*0.95:o/(l+0.6),se=r?(o*0.92-6)/1.54:132,g=Math.max(46,Math.min(I*0.94,132,V*1.05,se)),h=g*0.72,n=g*1.05;ie(b,e,n),v.forEach((i,w)=>{let M=t("radialGradient",{id:`${y}-h${w}`},b);t("stop",{offset:0,"stop-color":i.color,"stop-opacity":0.95},M),t("stop",{offset:1,"stop-color":i.color,"stop-opacity":0},M)});let ae=(i)=>{if(r)return o*0.92;return l===1?o*0.62:o*(0.46+i*0.3)};if(v.forEach((i,w)=>{let M=Math.floor(w/c),le=Math.min(c,u-M*c),ce=w-M*c,de=a/le*(ce+0.5),fe=ae(M),F=R.get(i.id)??"idle",f=t("g",{class:"seat","data-seat":i.id,"data-state":F,...C===i.id?{"data-focus":""}:{},transform:`translate(${de.toFixed(1)} ${fe.toFixed(1)})`,tabindex:s.listBelow?-1:0,role:"button","aria-label":G.seat(i.name,F),color:e.css.text,...s.listBelow?{"aria-hidden":"true"}:{}},m);t("ellipse",{cx:0,cy:3,rx:g*0.55,ry:g*0.1,fill:"#000",opacity:0.35},f),t("ellipse",{class:"halo",cx:0,cy:-h-n*0.35,rx:n*0.8,ry:n*0.8,fill:`url(#${y}-h${w})`},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:i.color,opacity:0.2},f);let _=t("g",{class:"lift"},f),Z=B.get(i.id);if(Z){let p={x:-n/2,y:-h-n*0.78,width:n,height:n*0.88,filter:`url(#${y}-rim)`};t("image",{href:ne(Z),...p,...i.dim?{opacity:0.55}:{}},_);let oe=A.get(i.id);if(F==="speaking"&&oe&&!S){let he=t("image",{class:"talk",href:ne(oe),...p,opacity:0},_),{frames:ue,seconds:pe}=bs(w);t("animate",{attributeName:"opacity",values:ue.join(";"),dur:`${pe.toFixed(3)}s`,calcMode:"discrete",repeatCount:"indefinite"},he)}}else{t("circle",{cx:0,cy:-h-n*0.3,r:n*0.3,fill:i.color,stroke:e.ink,"stroke-width":2},_);let p=t("text",{x:0,y:-h-n*0.3+n*0.1,"text-anchor":"middle","font-size":n*0.3,"font-weight":700,fill:"#fff","font-family":Rt},_);p.textContent=Array.from(i.name)[0]?.toUpperCase()??"?"}let J=h*0.22;t("path",{d:`M ${-g*0.5} ${-h} L ${g*0.5} ${-h} L ${g*0.42} 0 L ${-g*0.42} 0 Z`,fill:e.wood,stroke:e.ink,"stroke-width":2,"stroke-linejoin":"round"},f),t("rect",{x:-g*0.54,y:-h-J*0.2,width:g*1.08,height:J,rx:2,fill:e.woodLight,stroke:e.ink,"stroke-width":2},f);let L=Math.max(11,Math.min(15,g*0.14)),j=Math.min(Math.max(g*0.9,L*5.5+14),Math.max(g*0.9,i.name.length*L*0.62+18),I*0.98),me=L+8;t("rect",{class:"plate",x:-j/2,y:-h*0.78,width:j,height:me,rx:3,fill:e.gold,stroke:e.ink,"stroke-width":2},f);let ge=t("text",{x:0,y:-h*0.78+L+1.5,"text-anchor":"middle","font-size":L,"font-weight":700,"font-family":Rt,fill:e.plateInk},f),Q=N.get(i.id);ge.textContent=Yr(Q?`${Q} ${i.name}`:i.name,(j-8)/L);let ee=t("g",{class:"badge"},t("g",{transform:`translate(${n*0.4} ${-h-n*0.78})`},f)),D=F==="done",P=F==="error",U=e.gold;if(D)U=Wr.done;else if(P)U=Wr.error;t("circle",{r:n*0.15,fill:U,stroke:e.ink,"stroke-width":2},ee);let W=t("text",{x:0,y:n*0.06,"text-anchor":"middle","font-size":n*0.2,"font-weight":800,"font-family":Rt,fill:D||P?"#fff":e.ink},ee);if(W.textContent="!",D)W.textContent="✓";else if(P)W.textContent="✕";let te=t("g",{class:"orbit"},f);t("circle",{cx:n*0.4,cy:-h-n*0.5,r:n*0.05,fill:i.color},te),t("circle",{cx:-n*0.4,cy:-h-n*0.5,r:n*0.035,fill:i.color,opacity:0.6},te),f.addEventListener("click",(p)=>s.onSeatClick({id:i.id,name:i.name,at:Et(p,f)})),f.addEventListener("keydown",(p)=>{if(p.key==="Enter"||p.key===" ")p.preventDefault(),s.onSeatClick({id:i.id,name:i.name,at:Et({clientX:0,clientY:0,detail:0},f)})})}),!r){let i=Math.min(a*0.34,190),w=o-6;t("rect",{x:T-i/2,y:w-22,width:i,height:22,rx:4,fill:e.wood,stroke:e.ink,"stroke-width":2},m);let M=t("text",{x:T,y:w-7,"text-anchor":"middle","font-size":12,"font-weight":700,"font-family":Rt,fill:e.gold},m);M.textContent=Yr(s.ownerName??"You",12)}}let H=new Set,re=(e,r)=>{if(e.mode==="cut")return;let a=Gn(z,q),o=(u,l)=>{let c=setTimeout(()=>{H.delete(c),u()},l);H.add(c)};for(let u of e.joining){let l=[...m.querySelectorAll("g.seat[data-seat]")].find((c)=>c.getAttribute("data-seat")===u);if(!l)continue;l.classList.add("seat-in"),l.prepend(t("ellipse",{class:"seat-ring",rx:44,ry:12,cy:4,stroke:a.css.ring})),o(()=>{l.classList.remove("seat-in"),l.querySelector(".seat-ring")?.remove()},gn)}for(let u of e.leaving){let l=r.get(u);if(!l)continue;let c=l.cloneNode(!0);c.classList.add("seat-out");for(let b of["data-seat","tabindex","role","aria-label"])c.removeAttribute(b);c.setAttribute("aria-hidden","true");for(let[b,[T,O,I]]of[[-26,-24,20],[24,-20,22],[0,-52,24],[-4,-4,26]].entries()){let V=t("circle",{class:"puff",cx:T,cy:O,r:I,fill:a.paper,stroke:a.ink,"stroke-width":3},c);V.style.animationDelay=`${b*40}ms`}m.appendChild(c),o(()=>c.remove(),mn)}},Y=new ResizeObserver(x);Y.observe(d);let X=()=>{if(s.reducedMotion==="auto"||s.reducedMotion===void 0)K.setReducedMotion(k.matches)};k.addEventListener("change",X);let K={kind:"svg",setTheme(e,r){z=e,q=r,x()},setSeats(e){let r=v.map((o)=>o.id),a=new Map([...m.querySelectorAll("g.seat[data-seat]")].map((o)=>[o.getAttribute("data-seat")??"",o]));v=e;for(let o of e){if(R.set(o.id,o.state??"idle"),o.avatarSvg)B.set(o.id,o.avatarSvg);if(o.talkSvg)A.set(o.id,o.talkSvg);else A.delete(o.id)}if(x(),r.length>0||a.size>0)re(Pi(r,e.map((o)=>o.id),S),a)},setState(e,r){if(R.get(e)===r)return;R.set(e,r),x()},setMark(e,r){if((N.get(e)??null)===r)return;if(r===null)N.delete(e);else N.set(e,r);x()},setAvatar(e,r,a){if(B.set(e,r),a)A.set(e,a);else A.delete(e);return x(),Promise.resolve()},setReducedMotion(e){S=e,x()},resetCamera(){C=null,x(),s.onFocus?.(null)},focus(e){if(e===C)return;C=e,x()},focused:()=>C,getStats(){return{kind:"svg",fps:0,frameMs:0,frameMsMax:0,drawCalls:0,triangles:0,textures:0,geometries:0,dpr:1,lowPower:!1,reduced:S,loop:"idle",seats:v.length,renders:0}},dispose(){for(let e of H)clearTimeout(e);H.clear(),Y.disconnect(),k.removeEventListener("change",X),E.remove()}};return K.setSeats(s.seats),K}export{Ee as createTable2D};