pi-roundtable-web 0.27.0 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/chunk-account-83crfbn4.js +1 -0
  3. package/dist/{chunk-action-menu-zh2n0ahf.js → chunk-action-menu-qw7h03x0.js} +1 -1
  4. package/dist/{chunk-agent-ynm2tcbx.js → chunk-agent-t1632ktv.js} +1 -1
  5. package/dist/{chunk-arranged-rooms-qnz8vese.js → chunk-arranged-rooms-sb6tbsxw.js} +1 -1
  6. package/dist/{chunk-bulk-actions-pr0mw0kc.js → chunk-bulk-actions-v1g2bzk7.js} +1 -1
  7. package/dist/{chunk-character-creator-caj4pmg4.js → chunk-character-creator-ye69w0kx.js} +1 -1
  8. package/dist/{chunk-codeeditor-dga6s78p.js → chunk-codeeditor-5j6abj8k.js} +1 -1
  9. package/dist/chunk-confirm-x8w877bz.js +1 -0
  10. package/dist/{chunk-connectors-j79ze3j1.js → chunk-connectors-t7qbc6nk.js} +1 -1
  11. package/dist/{chunk-conversations-2farn72g.js → chunk-conversations-kmt6qzym.js} +1 -1
  12. package/dist/{chunk-council-sheet-s9sz1bzf.js → chunk-council-sheet-bxvn7vza.js} +1 -1
  13. package/dist/{chunk-drag-45e8222r.js → chunk-drag-03zgvd66.js} +1 -1
  14. package/dist/{chunk-entry-q11n47h9.js → chunk-entry-y5vwp5e5.js} +1 -1
  15. package/dist/{chunk-folder-list-4gcj7g7h.js → chunk-folder-list-h3vnjzpb.js} +1 -1
  16. package/dist/{chunk-folds-ten4ykfw.js → chunk-folds-a3e22m7x.js} +1 -1
  17. package/dist/{chunk-gate-kcv1a4t0.js → chunk-gate-qzephvdv.js} +1 -1
  18. package/dist/chunk-group-scene-w1ycabrm.js +1 -0
  19. package/dist/{chunk-group-table-t458kdgn.js → chunk-group-table-9nvmja8w.js} +1 -1
  20. package/dist/chunk-host-icons-fccg3b2d.js +1 -0
  21. package/dist/chunk-host-picture-jaqz127q.js +1 -0
  22. package/dist/{chunk-host-state-7mdve7cb.js → chunk-host-state-r01v1ywg.js} +1 -1
  23. package/dist/{chunk-host-ui-bdgwa6sf.js → chunk-host-ui-n54mh5af.js} +1 -1
  24. package/dist/{chunk-index-ffbrm6tr.js → chunk-index-0ye10vk3.js} +1 -1
  25. package/dist/{chunk-index-b8cpvr7y.js → chunk-index-1kwp3spy.js} +1 -1
  26. package/dist/{chunk-index-kbrg32sx.js → chunk-index-3pnvpppa.js} +1 -1
  27. package/dist/{chunk-index-f6q0stqx.js → chunk-index-47vq85ye.js} +1 -1
  28. package/dist/{chunk-index-2t30xwed.js → chunk-index-4z4chg7v.js} +1 -1
  29. package/dist/{chunk-index-cdctnw71.js → chunk-index-5zmswz4s.js} +1 -1
  30. package/dist/{chunk-index-6bkcq9ka.js → chunk-index-6vcs0h0m.js} +1 -1
  31. package/dist/{chunk-index-j4kk1m59.js → chunk-index-6xqz6mg2.js} +1 -1
  32. package/dist/{chunk-index-02vfshtt.js → chunk-index-83v0c9x6.js} +1 -1
  33. package/dist/{chunk-index-aamhjg5n.js → chunk-index-8xd6anam.js} +1 -1
  34. package/dist/{chunk-index-31x6krbs.js → chunk-index-983dmeaa.js} +1 -1
  35. package/dist/{chunk-index-xxeb2xp0.js → chunk-index-9z13jw6q.js} +2 -2
  36. package/dist/{chunk-index-q7g62sgm.js → chunk-index-af4ebmkr.js} +1 -1
  37. package/dist/{chunk-index-8d81qy69.js → chunk-index-afrhnrxj.js} +1 -1
  38. package/dist/{chunk-index-zyvwhxga.js → chunk-index-ben4gv45.js} +1 -1
  39. package/dist/{chunk-index-t998yg8y.js → chunk-index-c44p8q87.js} +1 -1
  40. package/dist/{chunk-index-92zgb7my.js → chunk-index-db8zh8e6.js} +1 -1
  41. package/dist/{chunk-index-dnjftvtq.js → chunk-index-dvfkb699.js} +1 -1
  42. package/dist/{chunk-index-g3wrs02w.js → chunk-index-e02ddp46.js} +1 -1
  43. package/dist/{chunk-index-pefwfm26.js → chunk-index-em7vndrb.js} +1 -1
  44. package/dist/{chunk-index-tk4se135.js → chunk-index-eq161yvp.js} +1 -1
  45. package/dist/{chunk-index-xq84gg8w.js → chunk-index-f500nw4w.js} +1 -1
  46. package/dist/{chunk-index-12zyshae.js → chunk-index-f5x2srr0.js} +1 -1
  47. package/dist/{chunk-index-2e4am3hw.js → chunk-index-fg42egv9.js} +4 -4
  48. package/dist/{chunk-index-msqhgvfx.js → chunk-index-h3v1d3nt.js} +1 -1
  49. package/dist/{chunk-index-2fdns8tn.js → chunk-index-j7pgphx3.js} +1 -1
  50. package/dist/{chunk-index-ac1ktr56.js → chunk-index-k0z507h3.js} +1 -1
  51. package/dist/chunk-index-kbgykazq.js +2 -0
  52. package/dist/{chunk-index-0w4bfjb5.js → chunk-index-n05yw5wd.js} +1 -1
  53. package/dist/{chunk-index-18pgxxw3.js → chunk-index-n8ghdvxb.js} +1 -1
  54. package/dist/{chunk-index-rh0x9rzf.js → chunk-index-nsvwbjfe.js} +1 -1
  55. package/dist/{chunk-index-jgzygbt8.js → chunk-index-p5jcwjx8.js} +1 -1
  56. package/dist/{chunk-index-kb3w11mn.js → chunk-index-rcwdqn50.js} +2 -2
  57. package/dist/chunk-index-s72hmse6.js +2 -0
  58. package/dist/{chunk-index-5bfqek1d.js → chunk-index-xevnf9ew.js} +1 -1
  59. package/dist/{chunk-index-pyfx77cj.js → chunk-index-xx8jq73q.js} +1 -1
  60. package/dist/{chunk-index-e2dqjde8.js → chunk-index-y60x5jbh.js} +1 -1
  61. package/dist/{chunk-index-dj0tbfyb.js → chunk-index-ypkgw7gq.js} +1 -1
  62. package/dist/{chunk-index-g1awv7rk.js → chunk-index-yrmqcay4.js} +1 -1
  63. package/dist/chunk-layout-actions-8dzvysym.js +1 -0
  64. package/dist/{chunk-menu-items-bza16bw6.js → chunk-menu-items-3jhya205.js} +1 -1
  65. package/dist/chunk-mode-toggle-js49gvpd.js +1 -0
  66. package/dist/{chunk-note-row-6fmhrdng.js → chunk-note-row-kv061030.js} +2 -2
  67. package/dist/{chunk-notes-wv0e6ssf.js → chunk-notes-sdkqz5hr.js} +1 -1
  68. package/dist/{chunk-notice-bell-9z27epd2.js → chunk-notice-bell-r012f2zy.js} +1 -1
  69. package/dist/{chunk-notices-fte9f196.js → chunk-notices-h4rk1zxc.js} +1 -1
  70. package/dist/{chunk-onboarding-c5twahc3.js → chunk-onboarding-a18cvkph.js} +1 -1
  71. package/dist/{chunk-overview-k4ccprax.js → chunk-overview-ynaqn4fp.js} +1 -1
  72. package/dist/{chunk-palette-9rbp2fab.js → chunk-palette-jm79gb5q.js} +1 -1
  73. package/dist/chunk-placement-items-mwm9q1zn.js +1 -0
  74. package/dist/{chunk-profile-s7r7fcvz.js → chunk-profile-ajw6pp4r.js} +1 -1
  75. package/dist/{chunk-prompt-history-hf296e7v.js → chunk-prompt-history-zcfvr3r8.js} +1 -1
  76. package/dist/{chunk-prompts-c8s0nhkm.js → chunk-prompts-m5rzdk24.js} +1 -1
  77. package/dist/chunk-room-confirms-ftsj15ja.js +1 -0
  78. package/dist/{chunk-room-menu-7h4jym2b.js → chunk-room-menu-b9ktw9pw.js} +1 -1
  79. package/dist/{chunk-rooms-menu-button-pgtaanb6.js → chunk-rooms-menu-button-qe62t6nx.js} +1 -1
  80. package/dist/{chunk-schedules-mbnwcxpc.js → chunk-schedules-t8yxnf8q.js} +1 -1
  81. package/dist/{chunk-seat-menu-r0k0eawr.js → chunk-seat-menu-kwtjnpjj.js} +1 -1
  82. package/dist/{chunk-sheet-hosts-a5dfevy9.js → chunk-sheet-hosts-yj5wszgj.js} +1 -1
  83. package/dist/{chunk-shortcut-help-a6pkjcq7.js → chunk-shortcut-help-g5cpqjjj.js} +1 -1
  84. package/dist/{chunk-shortcuts-cgt87jkz.js → chunk-shortcuts-9ft5sqdw.js} +1 -1
  85. package/dist/{chunk-skill-editor-67yk4x7t.js → chunk-skill-editor-xdfq2708.js} +1 -1
  86. package/dist/{chunk-skills-rewemey4.js → chunk-skills-9wa4mwdc.js} +1 -1
  87. package/dist/{chunk-switcher-list-t8rbay2y.js → chunk-switcher-list-vpg6wvtw.js} +1 -1
  88. package/dist/{chunk-tab-dot-vr11dfrw.js → chunk-tab-dot-yse6wcfp.js} +1 -1
  89. package/dist/{chunk-table-52nh0azk.js → chunk-table-1y76m54h.js} +1 -1
  90. package/dist/{chunk-table3d-rp0w6kt4.js → chunk-table3d-cv6069hy.js} +1 -1
  91. package/dist/chunk-thread-actions-xjhpdjk7.js +1 -0
  92. package/dist/{chunk-thread-cards-c2mrp2gj.js → chunk-thread-cards-36rckyg7.js} +1 -1
  93. package/dist/{chunk-thread-list-0071q455.js → chunk-thread-list-fd6agz77.js} +2 -2
  94. package/dist/{chunk-transcript-789yqysq.js → chunk-transcript-5nfn3r35.js} +1 -1
  95. package/dist/chunk-where-ha8pc3cg.js +1 -0
  96. package/dist/{chunk-workspace-wr1qrtsh.js → chunk-workspace-e85twv32.js} +2 -2
  97. package/dist/index.html +1 -1
  98. package/dist/sw.js +1 -1
  99. package/package.json +2 -2
  100. package/dist/chunk-account-1ecx5kt7.js +0 -1
  101. package/dist/chunk-confirm-g76v5d9r.js +0 -1
  102. package/dist/chunk-group-scene-12ghcvzd.js +0 -1
  103. package/dist/chunk-host-icons-h1k9k96a.js +0 -1
  104. package/dist/chunk-host-picture-3p0wzn3v.js +0 -1
  105. package/dist/chunk-index-j0m16cj1.js +0 -2
  106. package/dist/chunk-index-v6smgw77.js +0 -2
  107. package/dist/chunk-layout-actions-y73mpsh1.js +0 -1
  108. package/dist/chunk-mode-toggle-nj9gnt3b.js +0 -1
  109. package/dist/chunk-placement-items-me598wsb.js +0 -1
  110. package/dist/chunk-room-confirms-ga2sbvhc.js +0 -1
  111. package/dist/chunk-thread-actions-qcxt1y1g.js +0 -1
  112. package/dist/chunk-where-hmwmme9e.js +0 -1
@@ -1 +1 @@
1
- import{h,Q,S,X,s,N,M,a,r,t,c,m,e,n,o,D,u,ce,O,d,f,w,g,_,gn,zo,Io,Re,Oi,Vo,ue,Ln}from"./chunk-index-2e4am3hw.js";import{vo}from"./chunk-index-dj0tbfyb.js";import{K}from"./chunk-index-jgzygbt8.js";import"./chunk-index-j4kk1m59.js";import"./chunk-index-pyfx77cj.js";import"./chunk-index-e2dqjde8.js";import{lr}from"./chunk-index-aamhjg5n.js";import{xn}from"./chunk-index-b73y2gc0.js";import{Ut}from"./chunk-index-xq84gg8w.js";import{Ne,mt}from"./chunk-index-tk4se135.js";import{qt}from"./chunk-index-2fdns8tn.js";import{qe}from"./chunk-index-31x6krbs.js";import"./chunk-index-v6smgw77.js";import{L}from"./chunk-index-8d81qy69.js";import{Jt}from"./chunk-index-92zgb7my.js";import{ee,Te}from"./chunk-index-cdctnw71.js";import"./chunk-index-j0m16cj1.js";import"./chunk-index-g1awv7rk.js";var xe=S(()=>(h("hf296e7v"),import("./chunk-prompt-history-hf296e7v.js")).then((l)=>({default:l.HistorySheet}))),Fe=S(()=>(h("caj4pmg4"),import("./chunk-character-creator-caj4pmg4.js")).then((l)=>({default:l.CharacterCreator}))),Oe=["default","off","minimal","low","medium","high","xhigh"],ve={default:c("Default"),off:c("Off"),minimal:c("Minimal"),low:c("Low"),medium:c("Medium"),high:c("High"),xhigh:c("Very high")},G="default",be=(l)=>l.model===void 0?t("Default model ({current})",{current:l.effective.model}):t("Default model (server setting)"),$e=c("Automatic"),le=(l)=>l==="auto"?t($e):t(ve[l]??l),he=(l)=>({displayName:l.displayName,prompt:l.prompt,model:l.model??G,thinking:l.thinking??G});function ge(l,p){return{...p.displayName!==l.displayName?{displayName:p.displayName}:{},...p.prompt!==l.prompt?{prompt:p.prompt}:{},...p.model!==(l.model??G)?{model:p.model}:{},...p.thinking!==(l.thinking??G)?{thinking:p.thinking}:{}}}function ye(){let l=Io(),p=a(l);if(l)p.current=l;let i=p.current,k=l!==void 0;if(s(()=>{if(!k)return;let C=window.location.href,I=()=>{if(window.location.href!==C)gn()};return window.addEventListener("popstate",I),window.addEventListener("hashchange",I),()=>{window.removeEventListener("popstate",I),window.removeEventListener("hashchange",I)}},[k]),!i)return null;return e(L,{open:l!==void 0,title:t("Edit knight"),size:"wide",onClose:gn,children:e(Ve,{name:i.name,opened:i.id},i.name)})}function Ve({name:l,opened:p}){let[i,k]=r(),[C,I]=r([]),[A,V]=r(),[E,x]=r(),[v,R]=r(!1),[H,z]=r(!1),[te,J]=r(!1),[B,j]=r(!1),ae=Ln(i?.room??""),q=a(null),W=i!==void 0,U=u((y)=>i?y.rooms[i.room]?.view?.muted===!0:!1,i?.room??""),[ne,F]=r(!1),oe=u((y)=>i?y.rooms[i.room]?.view?.coordinator===!0:!1,i?.room??""),Y=N(),Z=N(),P=N();s(()=>{if(!W||!zo()?.look)return;q.current?.scrollIntoView({block:"start"}),q.current?.focus({preventScroll:!0})},[W,p]);let b=a({});b.current={profile:i,draft:E},s(()=>{let y=!0;return Promise.all([O.agent(l),O.models()]).then(([re,Pe])=>{if(!y)return;let{profile:fe,draft:ie}=b.current,He=fe&&ie&&Object.keys(ge(fe,ie)).length>0;k(re),I(Pe.models),x(He?ie:he(re))},(re)=>y&&V(d(re))),()=>{y=!1}},[l,p]);let T=M(()=>i&&E?ge(i,E):{},[i,E]);if(A)return e(g,{message:A});if(!i||!E)return e(w,{});let de=Object.keys(T).length>0,De=Array.from(new Set([G,...C,E.model])),Ie=be(i),pe=async()=>{R(!0);try{let y=await O.updateAgent(l,T);k(y),x(he(y)),z(!1),f(t("Saved."))}catch(y){f(d(y),"danger")}finally{R(!1)}};return n("div",{className:"stack agent-sheet",children:[n("header",{className:"profile-head",children:[e(ue,{spec:i.character,name:i.name,size:72,state:ae,label:i.displayName}),n("div",{children:[e("h3",{children:i.displayName}),e("p",{className:"meta",children:t("Runs on {model}, thinking {thinking}",{model:i.effective.model,thinking:le(i.effective.thinking)})})]})]}),e("ul",{className:"menu",children:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:P,children:[e("span",{className:"menu-icon",children:e(o,{name:U?"bell-off":"bell"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Notifications")}),e("span",{className:"meta",children:t("Push this room's posts to every owner's devices. A card that waits for you is always pushed.")})]}),e(qt,{id:P,checked:!U,label:t("Notifications"),busy:ne,onChange:async(y)=>{F(!0),await Jt(i.room,!y),F(!1)}})]})})}),H?e(Be,{profile:i,draft:E,saving:v,onBack:()=>z(!1),onSave:pe}):n("form",{className:"stack form",onSubmit:(y)=>{if(y.preventDefault(),!de)return;if(T.prompt!==void 0)z(!0);else pe()},children:[n("label",{htmlFor:Z,children:[t("Name"),e("input",{id:Z,value:E.displayName,onChange:(y)=>x({...E,displayName:y.target.value})})]}),n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:Y,children:t("Prompt")}),n("span",{className:"field-tools",children:[n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>j(!0),children:[e(o,{name:"reset",size:16}),t("History")]}),n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>J(!0),children:[e(Ge,{}),t("Full screen")]})]})]}),e("textarea",{id:Y,rows:8,value:E.prompt,onChange:(y)=>x({...E,prompt:y.target.value})})]}),e(Ut,{label:t("Model"),value:E.model,onChange:(y)=>x({...E,model:y}),options:De.map((y)=>({value:y,label:y===G?Ie:y}))}),e(Ut,{label:t("Thinking level"),value:E.thinking,onChange:(y)=>x({...E,thinking:y}),options:Oe.map((y)=>({value:y,label:t(ve[y])}))}),e("div",{className:"actions",children:e("button",{type:"submit",disabled:!de||v,children:v?t("Saving…"):T.prompt!==void 0?t("Review changes"):t("Save")})})]}),e(ze,{name:l,opened:p}),n("section",{className:"card stack",ref:q,tabIndex:-1,children:[e("h3",{children:t("Look")}),e("p",{className:"meta",children:t("Class, colors and parts. The picture here, in the rooms and in Discord all follow it.")}),e(Q,{fallback:e(w,{}),children:e(Fe,{name:i.name,displayName:i.displayName,prompt:i.prompt,character:i.character,onSaved:(y)=>k(y)})})]}),oe?null:n("section",{className:"card stack",children:[e("h3",{children:t("Archive")}),e("p",{className:"meta",children:t("An archived knight stops answering and its schedules are cancelled. Its history is kept, and you can restore it from Archived.")}),e("div",{className:"actions",children:e("button",{type:"button",className:"danger",onClick:()=>{gn(),Re({kind:"archive",room:i.room,name:i.displayName})},children:t("Archive {name}",{name:i.displayName})})})]}),B?e(Q,{fallback:null,children:e(xe,{open:B,title:t("History of the prompt"),load:async()=>(await Ne.agentPromptHistory(l)).versions.map((y)=>({id:y.id,text:y.text,previous:y.previous,by:y.by,at:y.at})),onUse:(y)=>{x({...E,prompt:y}),j(!1)},onClose:()=>j(!1)})}):null,e(L,{open:te,title:t("Prompt"),size:"full",onClose:()=>J(!1),children:e("textarea",{className:"prompt-full","aria-label":t("Prompt"),value:E.prompt,onChange:(y)=>x({...E,prompt:y.target.value})})})]})}function ze({name:l,opened:p}){let[i,k]=r(),[C,I]=r(),[A,V]=r(),E=N();if(s(()=>{let v=!0;return ee.skills(l).then((R)=>v&&k(R),(R)=>{if(v&&!(R instanceof ce&&R.status===404))V(d(R))}),()=>{v=!1}},[l,p]),A)return e(g,{message:A});if(!i)return null;let x=async(v,R)=>{I(v);try{k(await ee.setSkills(l,R?{add:[v]}:{remove:[v]}))}catch(H){f(d(H),"danger")}finally{I(void 0)}};return n("section",{className:"card stack","aria-label":t("Skills"),children:[e("h3",{children:t("Skills")}),e("p",{className:"meta",children:t("What the knight can load when a task calls for it. It applies from its next turn.")}),e("ul",{className:"menu",children:i.skills.map((v,R)=>{let H=`${E}-${R}`;return e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:H,children:[n("span",{className:"menu-text",children:[e("strong",{children:v.name}),e("span",{className:"meta",children:v.missing?t("Its file cannot be read."):v.builtin?t("Built in: every knight carries it."):v.description??""})]}),e(qt,{id:H,checked:v.carried,label:v.name,busy:C===v.name,disabled:v.builtin,onChange:(z)=>x(v.name,z)})]})},v.name)})})]})}var Ge=()=>e("svg",{viewBox:"0 0 24 24",width:16,height:16,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e("path",{d:"M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"})});function Be(l){let{profile:p,draft:i}=l,k=a(null);s(()=>k.current?.focus(),[]);let C=[];if(i.displayName!==p.displayName)C.push({label:t("Name"),before:p.displayName,after:i.displayName});let I=(A)=>A===G?be(p):A;if(i.model!==(p.model??G))C.push({label:t("Model"),before:I(p.model??G),after:I(i.model)});if(i.thinking!==(p.thinking??G))C.push({label:t("Thinking level"),before:le(p.thinking??G),after:le(i.thinking)});return n("section",{ref:k,className:"stack review",tabIndex:-1,"aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),C.length?e("ul",{className:"review-fields",children:C.map((A)=>n("li",{children:[e("strong",{children:A.label}),e("span",{className:"review-before",children:A.before}),e("span",{"aria-hidden":"true",children:"→"}),e("span",{className:"review-after",children:A.after})]},A.label))}):null,e(mt,{label:t("Prompt"),before:p.prompt,after:i.prompt}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:l.saving,onClick:l.onBack,children:t("Back to editing")}),e("button",{type:"button",disabled:l.saving,onClick:l.onSave,children:l.saving?t("Saving…"):t("Save")})]})]})}function Ke(l){let p=l.filter((C)=>C.parent!==void 0),i=l.filter((C)=>C.parent===void 0),k=new Set(i.map((C)=>C.name));return[...i.flatMap((C)=>[C,...p.filter((I)=>I.parent===C.name)]),...p.filter((C)=>!k.has(C.parent??""))]}function ke(){let[l,p]=r(),[i,k]=r(),[C,I]=r(),[A,V]=r(),E=X(async()=>{try{p((await ee.archive()).entries),k(void 0)}catch(v){k(d(v))}},[]);s(()=>{E()},[E]);let x=async(v)=>{I(v.name);try{if(v.kind==="agent")await ee.restoreAgent(v.name);else await ee.restoreGroup(v.name);await Te(),f(t("Restored {name}.",{name:v.displayName})),await E()}catch(R){f(d(R),"danger")}finally{I(void 0)}};if(i&&!l)return e(g,{message:i});if(!l)return e(w,{});return n("div",{className:"stack",children:[e("p",{className:"meta",children:t("Archived knights and groups no longer answer. Their history is kept until you delete them.")}),l.length===0?e(_,{children:t("Nothing is archived.")}):null,e("ul",{className:"menu",children:Ke(l).map((v)=>n("li",{className:"menu-item","data-helper":v.parent??void 0,style:v.parent?{paddingLeft:"var(--space-6)"}:void 0,children:[e("span",{className:"menu-icon",children:e(o,{name:v.kind==="agent"?"profile":"rooms"})}),n("span",{className:"menu-text",children:[e("strong",{children:v.displayName}),n("span",{className:"meta",children:[v.parent?t("Temp knight of {name}",{name:v.parent}):v.kind==="agent"?t("Knight"):t("Group")," ","· ",v.name]})]}),e("button",{type:"button",className:"secondary compact",disabled:C===v.name,onClick:()=>x(v),children:t("Restore")}),e("button",{type:"button",className:"compact danger",disabled:C===v.name,onClick:()=>V(v),children:t("Delete")})]},`${v.kind}:${v.name}`))}),e(K,{open:A!==void 0,title:t("Delete {name}?",{name:A?.displayName??""}),confirmLabel:t("Delete"),tone:"danger",onClose:()=>V(void 0),onConfirm:async()=>{if(!A)return;if(A.kind==="agent")await ee.deleteAgent(A.name);else await ee.deleteGroup(A.name);await Te(),f(t("Deleted {name}.",{name:A.displayName})),await E()},children:e("p",{children:t("{name} and its messages in this app are deleted for good, and the name can be used again. This cannot be undone.",{name:A?.displayName??""})})})]})}var we=/^[a-z0-9-]{1,32}$/,Se=2,Ce=8,se="\x00";function Ue(){let l=u((p)=>p.order.flatMap((i)=>{let k=p.rooms[i]?.view;return k?.kind==="agent"&&!k.helper?[`${k.name}${se}${k.displayName}`]:[]}).join(`${se}${se}`));return M(()=>l===""?[]:l.split(`${se}${se}`).map((p)=>{let[i="",k=""]=p.split(se);return{name:i,displayName:k}}),[l])}function Ae(l){let p=Ue(),[i,k]=r(),[C,I]=r(),[A,V]=r(""),[E,x]=r(""),[v,R]=r(!1),[H,z]=r([]),[te,J]=r(""),[B,j]=r(!1),[ae,q]=r(l.name===void 0),W=N(),U=N();s(()=>{let P=l.name;if(P===void 0)return;let b=!0;return ee.group(P).then((T)=>{if(!b)return;k(T),V(T.displayName),z(T.members),J(T.host),q(!0)},(T)=>b&&I(d(T))),()=>{b=!1}},[l.name]);let ne=(P)=>p.find((b)=>b.name===P)?.displayName??P,F=H.includes(te)?te:H[0]??"",oe=i===void 0?!0:A.trim()!==i.displayName||H.join(",")!==i.members.join(",")||F!==i.host,Y=A.trim()!==""&&H.length>=Se&&H.length<=Ce&&(i!==void 0||we.test(E));if(C&&!ae)return e(g,{message:C});if(!ae)return e(w,{});let Z=async()=>{j(!0),I(void 0);try{if(i){await ee.updateGroup(i.name,{...A.trim()!==i.displayName?{displayName:A.trim()}:{},...H.join(",")!==i.members.join(",")?{members:H}:{},...F!==i.host?{host:F}:{}}),await Te(),f(t("Saved.")),l.onDone();return}let P=await ee.createGroup({name:E,displayName:A.trim(),members:H,host:F});await Te(),f(t("Made {name}.",{name:P.displayName})),l.onDone(),D("room",P.room)}catch(P){I(d(P))}finally{j(!1)}};return n("form",{className:"stack form",onSubmit:(P)=>{if(P.preventDefault(),Y&&oe&&!B)Z()},children:[n("label",{htmlFor:W,children:[t("Name"),e("input",{id:W,value:A,autoComplete:"off",onChange:(P)=>{if(V(P.target.value),!i&&!v)x(P.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32))}})]}),i?null:n("label",{htmlFor:U,children:[t("Permanent name"),e("input",{id:U,value:E,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":E!==""&&!we.test(E),onChange:(P)=>{R(!0),x(P.target.value)}}),e("span",{className:"meta",children:t("Lowercase letters, digits and dashes, up to 32. It names the room and cannot be changed.")})]}),n("fieldset",{className:"field",children:[e("legend",{children:t("Members")}),e("span",{className:"meta",children:t("Pick 2 to 8 knights. They take turns in the order picked.")}),e("ul",{className:"menu",children:p.map((P)=>{let b=H.includes(P.name);return e("li",{children:n("label",{className:"menu-item menu-toggle",children:[e("input",{type:"checkbox",checked:b,disabled:!b&&H.length>=Ce,onChange:()=>z(b?H.filter((T)=>T!==P.name):[...H,P.name])}),e("span",{className:"menu-text",children:e("strong",{children:P.displayName})})]})},P.name)})})]}),H.length>=Se?e(Ut,{label:t("Host"),value:F,onChange:J,options:H.map((P)=>({value:P,label:ne(P)}))}):null,C?e(g,{message:C}):null,n("div",{className:"actions",children:[i?e("button",{type:"button",className:"danger",onClick:()=>{l.onDone(),Re({kind:"archive",room:i.room,name:i.displayName})},children:t("Archive group")}):null,e("button",{type:"submit",disabled:!Y||!oe||B,children:B?t("Saving…"):i?t("Save"):t("Make group")})]})]})}var je=S(()=>(h("caj4pmg4"),import("./chunk-character-creator-caj4pmg4.js")).then((l)=>({default:l.CharacterCreator}))),Ee=/^[a-z0-9-]{1,32}$/,me="default";function _e(l){let p=[];for(let i of l){let k=i.indexOf("/"),C=k>0?i.slice(0,k):"",I=p.find((A)=>A.provider===C&&C!=="");if(I)I.models.push(i);else p.push({provider:C,models:[i]})}return p}var We=(l)=>l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32);function Me({onDone:l}){let[p,i]=r(""),[k,C]=r(""),[I,A]=r(!1),[V,E]=r(""),[x,v]=r(me),[R,H]=r(""),[z,te]=r(),[J,B]=r(!1),[j,ae]=r([]),[q,W]=r(),[U,ne]=r(!1),F=[N(),N(),N(),N(),N()];s(()=>{let b=!0;return O.models().then((T)=>b&&ae(T.models),()=>{return}),()=>{b=!1}},[]);let oe=M(()=>xn({name:k,displayName:p,prompt:V}),[k,p,V]),Y=z?.spec??oe,Z=Ee.test(k)&&p.trim()!==""&&V.trim()!=="";if(J)return e(Q,{fallback:e(w,{}),children:e(je,{name:k||"new",displayName:p,prompt:V,character:Y,onPick:(b,T)=>{te({input:b,spec:T}),B(!1)},onCancel:()=>B(!1)})});let P=async()=>{ne(!0),W(void 0);try{let b={name:k,displayName:p.trim(),prompt:V,...x!==me?{model:x}:{},...R.trim()?{task:R.trim()}:{},...z?{character:z.input}:{}},T=await ee.createAgent(b);await Te(),f(t("Made {name}.",{name:T.displayName})),l(),D("room",T.room)}catch(b){W(b instanceof ce&&b.field?`${b.field}: ${d(b)}`:d(b))}finally{ne(!1)}};return n("form",{className:"stack form",onSubmit:(b)=>{if(b.preventDefault(),Z&&!U)P()},children:[n("label",{htmlFor:F[0],children:[t("Name"),e("input",{id:F[0],value:p,autoComplete:"off",onChange:(b)=>{if(i(b.target.value),!I)C(We(b.target.value))}})]}),n("label",{htmlFor:F[1],children:[t("Permanent name"),e("input",{id:F[1],value:k,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":k!==""&&!Ee.test(k),onChange:(b)=>{A(!0),C(b.target.value)}}),e("span",{className:"meta",children:t("Lowercase letters, digits and dashes, up to 32. It names the room and cannot be changed.")})]}),n("label",{htmlFor:F[2],children:[t("Prompt"),e("textarea",{id:F[2],rows:6,value:V,onChange:(b)=>E(b.target.value)}),e("span",{className:"meta",children:t("Its job, its sources, its limits and how it reports.")})]}),n("label",{htmlFor:F[4],children:[t("Model"),n(qe,{id:F[4],value:x,onChange:(b)=>v(b.target.value),children:[e("option",{value:me,children:t("Default model")}),_e(j).map((b)=>b.provider===""?b.models.map((T)=>e("option",{value:T,children:T},T)):e("optgroup",{label:b.provider,children:b.models.map((T)=>e("option",{value:T,children:T},T))},b.provider))]})]}),n("label",{htmlFor:F[3],children:[t("Opening task"),e("textarea",{id:F[3],rows:3,value:R,onChange:(b)=>H(b.target.value)}),e("span",{className:"meta",children:t("Optional. The knight starts on it as soon as it is made.")})]}),n("div",{className:"profile-head",children:[e(ue,{spec:Y,name:k||"new",size:72,label:p}),n("div",{children:[e("strong",{children:t("Look")}),e("span",{className:"meta",children:z?t("Your look"):t("Suggested from its role")}),e("button",{type:"button",className:"secondary compact",onClick:()=>B(!0),children:t("Choose a look")})]})]}),q?e(g,{message:q}):null,e("div",{className:"actions",children:e("button",{type:"submit",disabled:!Z||U,children:U?t("Making…"):t("Make knight")})})]})}var Xe=(l)=>l.kind==="new-agent"?t("New knight"):l.kind==="archive"?t("Archived"):l.name===void 0?t("New group"):t("Edit group");function Le(){let l=Vo(),p=a(l);if(l)p.current=l;let i=p.current,k=l!==void 0;if(s(()=>{if(!k)return;let C=window.location.href,I=()=>{if(window.location.href!==C)Oi()};return window.addEventListener("popstate",I),window.addEventListener("hashchange",I),()=>{window.removeEventListener("popstate",I),window.removeEventListener("hashchange",I)}},[k]),!i)return null;return e(L,{open:l!==void 0,title:Xe(i),size:"wide",onClose:Oi,children:e("div",{className:"stack agent-sheet",children:i.kind==="new-agent"?e(Me,{onDone:Oi}):i.kind==="archive"?e(ke,{}):e(Ae,{...i.name===void 0?{}:{name:i.name},onDone:Oi})},i.id)})}var Ye=S(()=>(h("a6pkjcq7"),import("./chunk-shortcut-help-a6pkjcq7.js")));function Je(){let l=vo(),p=a(!1);if(l)p.current=!0;if(!p.current)return null;return e(Q,{fallback:null,children:e(Ye,{open:l})})}function ga(){return n(m,{children:[e(lr,{}),e(ye,{}),e(Le,{}),e(Je,{})]})}export{ga as SheetHosts};
1
+ import{h,Q,S,X,s,N,M,a,r,t,c,m,e,n,o,D,u,ce,O,d,f,w,g,_,gn,zo,Io,Re,Oi,Vo,ue,Ln}from"./chunk-index-fg42egv9.js";import{vo}from"./chunk-index-ypkgw7gq.js";import{K}from"./chunk-index-p5jcwjx8.js";import"./chunk-index-6xqz6mg2.js";import"./chunk-index-xx8jq73q.js";import"./chunk-index-y60x5jbh.js";import{lr}from"./chunk-index-8xd6anam.js";import{xn}from"./chunk-index-b73y2gc0.js";import{Ut}from"./chunk-index-f500nw4w.js";import{Ne,mt}from"./chunk-index-eq161yvp.js";import{qt}from"./chunk-index-j7pgphx3.js";import{qe}from"./chunk-index-983dmeaa.js";import"./chunk-index-s72hmse6.js";import{L}from"./chunk-index-afrhnrxj.js";import{Jt}from"./chunk-index-db8zh8e6.js";import{ee,Te}from"./chunk-index-5zmswz4s.js";import"./chunk-index-kbgykazq.js";import"./chunk-index-yrmqcay4.js";var xe=S(()=>(h("zcfvr3r8"),import("./chunk-prompt-history-zcfvr3r8.js")).then((l)=>({default:l.HistorySheet}))),Fe=S(()=>(h("ye69w0kx"),import("./chunk-character-creator-ye69w0kx.js")).then((l)=>({default:l.CharacterCreator}))),Oe=["default","off","minimal","low","medium","high","xhigh"],ve={default:c("Default"),off:c("Off"),minimal:c("Minimal"),low:c("Low"),medium:c("Medium"),high:c("High"),xhigh:c("Very high")},G="default",be=(l)=>l.model===void 0?t("Default model ({current})",{current:l.effective.model}):t("Default model (server setting)"),$e=c("Automatic"),le=(l)=>l==="auto"?t($e):t(ve[l]??l),he=(l)=>({displayName:l.displayName,prompt:l.prompt,model:l.model??G,thinking:l.thinking??G});function ge(l,p){return{...p.displayName!==l.displayName?{displayName:p.displayName}:{},...p.prompt!==l.prompt?{prompt:p.prompt}:{},...p.model!==(l.model??G)?{model:p.model}:{},...p.thinking!==(l.thinking??G)?{thinking:p.thinking}:{}}}function ye(){let l=Io(),p=a(l);if(l)p.current=l;let i=p.current,k=l!==void 0;if(s(()=>{if(!k)return;let C=window.location.href,I=()=>{if(window.location.href!==C)gn()};return window.addEventListener("popstate",I),window.addEventListener("hashchange",I),()=>{window.removeEventListener("popstate",I),window.removeEventListener("hashchange",I)}},[k]),!i)return null;return e(L,{open:l!==void 0,title:t("Edit knight"),size:"wide",onClose:gn,children:e(Ve,{name:i.name,opened:i.id},i.name)})}function Ve({name:l,opened:p}){let[i,k]=r(),[C,I]=r([]),[A,V]=r(),[E,x]=r(),[v,R]=r(!1),[H,z]=r(!1),[te,J]=r(!1),[B,j]=r(!1),ae=Ln(i?.room??""),q=a(null),W=i!==void 0,U=u((y)=>i?y.rooms[i.room]?.view?.muted===!0:!1,i?.room??""),[ne,F]=r(!1),oe=u((y)=>i?y.rooms[i.room]?.view?.coordinator===!0:!1,i?.room??""),Y=N(),Z=N(),P=N();s(()=>{if(!W||!zo()?.look)return;q.current?.scrollIntoView({block:"start"}),q.current?.focus({preventScroll:!0})},[W,p]);let b=a({});b.current={profile:i,draft:E},s(()=>{let y=!0;return Promise.all([O.agent(l),O.models()]).then(([re,Pe])=>{if(!y)return;let{profile:fe,draft:ie}=b.current,He=fe&&ie&&Object.keys(ge(fe,ie)).length>0;k(re),I(Pe.models),x(He?ie:he(re))},(re)=>y&&V(d(re))),()=>{y=!1}},[l,p]);let T=M(()=>i&&E?ge(i,E):{},[i,E]);if(A)return e(g,{message:A});if(!i||!E)return e(w,{});let de=Object.keys(T).length>0,De=Array.from(new Set([G,...C,E.model])),Ie=be(i),pe=async()=>{R(!0);try{let y=await O.updateAgent(l,T);k(y),x(he(y)),z(!1),f(t("Saved."))}catch(y){f(d(y),"danger")}finally{R(!1)}};return n("div",{className:"stack agent-sheet",children:[n("header",{className:"profile-head",children:[e(ue,{spec:i.character,name:i.name,size:72,state:ae,label:i.displayName}),n("div",{children:[e("h3",{children:i.displayName}),e("p",{className:"meta",children:t("Runs on {model}, thinking {thinking}",{model:i.effective.model,thinking:le(i.effective.thinking)})})]})]}),e("ul",{className:"menu",children:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:P,children:[e("span",{className:"menu-icon",children:e(o,{name:U?"bell-off":"bell"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Notifications")}),e("span",{className:"meta",children:t("Push this room's posts to every owner's devices. A card that waits for you is always pushed.")})]}),e(qt,{id:P,checked:!U,label:t("Notifications"),busy:ne,onChange:async(y)=>{F(!0),await Jt(i.room,!y),F(!1)}})]})})}),H?e(Be,{profile:i,draft:E,saving:v,onBack:()=>z(!1),onSave:pe}):n("form",{className:"stack form",onSubmit:(y)=>{if(y.preventDefault(),!de)return;if(T.prompt!==void 0)z(!0);else pe()},children:[n("label",{htmlFor:Z,children:[t("Name"),e("input",{id:Z,value:E.displayName,onChange:(y)=>x({...E,displayName:y.target.value})})]}),n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:Y,children:t("Prompt")}),n("span",{className:"field-tools",children:[n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>j(!0),children:[e(o,{name:"reset",size:16}),t("History")]}),n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>J(!0),children:[e(Ge,{}),t("Full screen")]})]})]}),e("textarea",{id:Y,rows:8,value:E.prompt,onChange:(y)=>x({...E,prompt:y.target.value})})]}),e(Ut,{label:t("Model"),value:E.model,onChange:(y)=>x({...E,model:y}),options:De.map((y)=>({value:y,label:y===G?Ie:y}))}),e(Ut,{label:t("Thinking level"),value:E.thinking,onChange:(y)=>x({...E,thinking:y}),options:Oe.map((y)=>({value:y,label:t(ve[y])}))}),e("div",{className:"actions",children:e("button",{type:"submit",disabled:!de||v,children:v?t("Saving…"):T.prompt!==void 0?t("Review changes"):t("Save")})})]}),e(ze,{name:l,opened:p}),n("section",{className:"card stack",ref:q,tabIndex:-1,children:[e("h3",{children:t("Look")}),e("p",{className:"meta",children:t("Class, colors and parts. The picture here, in the rooms and in Discord all follow it.")}),e(Q,{fallback:e(w,{}),children:e(Fe,{name:i.name,displayName:i.displayName,prompt:i.prompt,character:i.character,onSaved:(y)=>k(y)})})]}),oe?null:n("section",{className:"card stack",children:[e("h3",{children:t("Archive")}),e("p",{className:"meta",children:t("An archived knight stops answering and its schedules are cancelled. Its history is kept, and you can restore it from Archived.")}),e("div",{className:"actions",children:e("button",{type:"button",className:"danger",onClick:()=>{gn(),Re({kind:"archive",room:i.room,name:i.displayName})},children:t("Archive {name}",{name:i.displayName})})})]}),B?e(Q,{fallback:null,children:e(xe,{open:B,title:t("History of the prompt"),load:async()=>(await Ne.agentPromptHistory(l)).versions.map((y)=>({id:y.id,text:y.text,previous:y.previous,by:y.by,at:y.at})),onUse:(y)=>{x({...E,prompt:y}),j(!1)},onClose:()=>j(!1)})}):null,e(L,{open:te,title:t("Prompt"),size:"full",onClose:()=>J(!1),children:e("textarea",{className:"prompt-full","aria-label":t("Prompt"),value:E.prompt,onChange:(y)=>x({...E,prompt:y.target.value})})})]})}function ze({name:l,opened:p}){let[i,k]=r(),[C,I]=r(),[A,V]=r(),E=N();if(s(()=>{let v=!0;return ee.skills(l).then((R)=>v&&k(R),(R)=>{if(v&&!(R instanceof ce&&R.status===404))V(d(R))}),()=>{v=!1}},[l,p]),A)return e(g,{message:A});if(!i)return null;let x=async(v,R)=>{I(v);try{k(await ee.setSkills(l,R?{add:[v]}:{remove:[v]}))}catch(H){f(d(H),"danger")}finally{I(void 0)}};return n("section",{className:"card stack","aria-label":t("Skills"),children:[e("h3",{children:t("Skills")}),e("p",{className:"meta",children:t("What the knight can load when a task calls for it. It applies from its next turn.")}),e("ul",{className:"menu",children:i.skills.map((v,R)=>{let H=`${E}-${R}`;return e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:H,children:[n("span",{className:"menu-text",children:[e("strong",{children:v.name}),e("span",{className:"meta",children:v.missing?t("Its file cannot be read."):v.builtin?t("Built in: every knight carries it."):v.description??""})]}),e(qt,{id:H,checked:v.carried,label:v.name,busy:C===v.name,disabled:v.builtin,onChange:(z)=>x(v.name,z)})]})},v.name)})})]})}var Ge=()=>e("svg",{viewBox:"0 0 24 24",width:16,height:16,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e("path",{d:"M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"})});function Be(l){let{profile:p,draft:i}=l,k=a(null);s(()=>k.current?.focus(),[]);let C=[];if(i.displayName!==p.displayName)C.push({label:t("Name"),before:p.displayName,after:i.displayName});let I=(A)=>A===G?be(p):A;if(i.model!==(p.model??G))C.push({label:t("Model"),before:I(p.model??G),after:I(i.model)});if(i.thinking!==(p.thinking??G))C.push({label:t("Thinking level"),before:le(p.thinking??G),after:le(i.thinking)});return n("section",{ref:k,className:"stack review",tabIndex:-1,"aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),C.length?e("ul",{className:"review-fields",children:C.map((A)=>n("li",{children:[e("strong",{children:A.label}),e("span",{className:"review-before",children:A.before}),e("span",{"aria-hidden":"true",children:"→"}),e("span",{className:"review-after",children:A.after})]},A.label))}):null,e(mt,{label:t("Prompt"),before:p.prompt,after:i.prompt}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:l.saving,onClick:l.onBack,children:t("Back to editing")}),e("button",{type:"button",disabled:l.saving,onClick:l.onSave,children:l.saving?t("Saving…"):t("Save")})]})]})}function Ke(l){let p=l.filter((C)=>C.parent!==void 0),i=l.filter((C)=>C.parent===void 0),k=new Set(i.map((C)=>C.name));return[...i.flatMap((C)=>[C,...p.filter((I)=>I.parent===C.name)]),...p.filter((C)=>!k.has(C.parent??""))]}function ke(){let[l,p]=r(),[i,k]=r(),[C,I]=r(),[A,V]=r(),E=X(async()=>{try{p((await ee.archive()).entries),k(void 0)}catch(v){k(d(v))}},[]);s(()=>{E()},[E]);let x=async(v)=>{I(v.name);try{if(v.kind==="agent")await ee.restoreAgent(v.name);else await ee.restoreGroup(v.name);await Te(),f(t("Restored {name}.",{name:v.displayName})),await E()}catch(R){f(d(R),"danger")}finally{I(void 0)}};if(i&&!l)return e(g,{message:i});if(!l)return e(w,{});return n("div",{className:"stack",children:[e("p",{className:"meta",children:t("Archived knights and groups no longer answer. Their history is kept until you delete them.")}),l.length===0?e(_,{children:t("Nothing is archived.")}):null,e("ul",{className:"menu",children:Ke(l).map((v)=>n("li",{className:"menu-item","data-helper":v.parent??void 0,style:v.parent?{paddingLeft:"var(--space-6)"}:void 0,children:[e("span",{className:"menu-icon",children:e(o,{name:v.kind==="agent"?"profile":"rooms"})}),n("span",{className:"menu-text",children:[e("strong",{children:v.displayName}),n("span",{className:"meta",children:[v.parent?t("Temp knight of {name}",{name:v.parent}):v.kind==="agent"?t("Knight"):t("Group")," ","· ",v.name]})]}),e("button",{type:"button",className:"secondary compact",disabled:C===v.name,onClick:()=>x(v),children:t("Restore")}),e("button",{type:"button",className:"compact danger",disabled:C===v.name,onClick:()=>V(v),children:t("Delete")})]},`${v.kind}:${v.name}`))}),e(K,{open:A!==void 0,title:t("Delete {name}?",{name:A?.displayName??""}),confirmLabel:t("Delete"),tone:"danger",onClose:()=>V(void 0),onConfirm:async()=>{if(!A)return;if(A.kind==="agent")await ee.deleteAgent(A.name);else await ee.deleteGroup(A.name);await Te(),f(t("Deleted {name}.",{name:A.displayName})),await E()},children:e("p",{children:t("{name} and its messages in this app are deleted for good, and the name can be used again. This cannot be undone.",{name:A?.displayName??""})})})]})}var we=/^[a-z0-9-]{1,32}$/,Se=2,Ce=8,se="\x00";function Ue(){let l=u((p)=>p.order.flatMap((i)=>{let k=p.rooms[i]?.view;return k?.kind==="agent"&&!k.helper?[`${k.name}${se}${k.displayName}`]:[]}).join(`${se}${se}`));return M(()=>l===""?[]:l.split(`${se}${se}`).map((p)=>{let[i="",k=""]=p.split(se);return{name:i,displayName:k}}),[l])}function Ae(l){let p=Ue(),[i,k]=r(),[C,I]=r(),[A,V]=r(""),[E,x]=r(""),[v,R]=r(!1),[H,z]=r([]),[te,J]=r(""),[B,j]=r(!1),[ae,q]=r(l.name===void 0),W=N(),U=N();s(()=>{let P=l.name;if(P===void 0)return;let b=!0;return ee.group(P).then((T)=>{if(!b)return;k(T),V(T.displayName),z(T.members),J(T.host),q(!0)},(T)=>b&&I(d(T))),()=>{b=!1}},[l.name]);let ne=(P)=>p.find((b)=>b.name===P)?.displayName??P,F=H.includes(te)?te:H[0]??"",oe=i===void 0?!0:A.trim()!==i.displayName||H.join(",")!==i.members.join(",")||F!==i.host,Y=A.trim()!==""&&H.length>=Se&&H.length<=Ce&&(i!==void 0||we.test(E));if(C&&!ae)return e(g,{message:C});if(!ae)return e(w,{});let Z=async()=>{j(!0),I(void 0);try{if(i){await ee.updateGroup(i.name,{...A.trim()!==i.displayName?{displayName:A.trim()}:{},...H.join(",")!==i.members.join(",")?{members:H}:{},...F!==i.host?{host:F}:{}}),await Te(),f(t("Saved.")),l.onDone();return}let P=await ee.createGroup({name:E,displayName:A.trim(),members:H,host:F});await Te(),f(t("Made {name}.",{name:P.displayName})),l.onDone(),D("room",P.room)}catch(P){I(d(P))}finally{j(!1)}};return n("form",{className:"stack form",onSubmit:(P)=>{if(P.preventDefault(),Y&&oe&&!B)Z()},children:[n("label",{htmlFor:W,children:[t("Name"),e("input",{id:W,value:A,autoComplete:"off",onChange:(P)=>{if(V(P.target.value),!i&&!v)x(P.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32))}})]}),i?null:n("label",{htmlFor:U,children:[t("Permanent name"),e("input",{id:U,value:E,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":E!==""&&!we.test(E),onChange:(P)=>{R(!0),x(P.target.value)}}),e("span",{className:"meta",children:t("Lowercase letters, digits and dashes, up to 32. It names the room and cannot be changed.")})]}),n("fieldset",{className:"field",children:[e("legend",{children:t("Members")}),e("span",{className:"meta",children:t("Pick 2 to 8 knights. They take turns in the order picked.")}),e("ul",{className:"menu",children:p.map((P)=>{let b=H.includes(P.name);return e("li",{children:n("label",{className:"menu-item menu-toggle",children:[e("input",{type:"checkbox",checked:b,disabled:!b&&H.length>=Ce,onChange:()=>z(b?H.filter((T)=>T!==P.name):[...H,P.name])}),e("span",{className:"menu-text",children:e("strong",{children:P.displayName})})]})},P.name)})})]}),H.length>=Se?e(Ut,{label:t("Host"),value:F,onChange:J,options:H.map((P)=>({value:P,label:ne(P)}))}):null,C?e(g,{message:C}):null,n("div",{className:"actions",children:[i?e("button",{type:"button",className:"danger",onClick:()=>{l.onDone(),Re({kind:"archive",room:i.room,name:i.displayName})},children:t("Archive group")}):null,e("button",{type:"submit",disabled:!Y||!oe||B,children:B?t("Saving…"):i?t("Save"):t("Make group")})]})]})}var je=S(()=>(h("ye69w0kx"),import("./chunk-character-creator-ye69w0kx.js")).then((l)=>({default:l.CharacterCreator}))),Ee=/^[a-z0-9-]{1,32}$/,me="default";function _e(l){let p=[];for(let i of l){let k=i.indexOf("/"),C=k>0?i.slice(0,k):"",I=p.find((A)=>A.provider===C&&C!=="");if(I)I.models.push(i);else p.push({provider:C,models:[i]})}return p}var We=(l)=>l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32);function Me({onDone:l}){let[p,i]=r(""),[k,C]=r(""),[I,A]=r(!1),[V,E]=r(""),[x,v]=r(me),[R,H]=r(""),[z,te]=r(),[J,B]=r(!1),[j,ae]=r([]),[q,W]=r(),[U,ne]=r(!1),F=[N(),N(),N(),N(),N()];s(()=>{let b=!0;return O.models().then((T)=>b&&ae(T.models),()=>{return}),()=>{b=!1}},[]);let oe=M(()=>xn({name:k,displayName:p,prompt:V}),[k,p,V]),Y=z?.spec??oe,Z=Ee.test(k)&&p.trim()!==""&&V.trim()!=="";if(J)return e(Q,{fallback:e(w,{}),children:e(je,{name:k||"new",displayName:p,prompt:V,character:Y,onPick:(b,T)=>{te({input:b,spec:T}),B(!1)},onCancel:()=>B(!1)})});let P=async()=>{ne(!0),W(void 0);try{let b={name:k,displayName:p.trim(),prompt:V,...x!==me?{model:x}:{},...R.trim()?{task:R.trim()}:{},...z?{character:z.input}:{}},T=await ee.createAgent(b);await Te(),f(t("Made {name}.",{name:T.displayName})),l(),D("room",T.room)}catch(b){W(b instanceof ce&&b.field?`${b.field}: ${d(b)}`:d(b))}finally{ne(!1)}};return n("form",{className:"stack form",onSubmit:(b)=>{if(b.preventDefault(),Z&&!U)P()},children:[n("label",{htmlFor:F[0],children:[t("Name"),e("input",{id:F[0],value:p,autoComplete:"off",onChange:(b)=>{if(i(b.target.value),!I)C(We(b.target.value))}})]}),n("label",{htmlFor:F[1],children:[t("Permanent name"),e("input",{id:F[1],value:k,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":k!==""&&!Ee.test(k),onChange:(b)=>{A(!0),C(b.target.value)}}),e("span",{className:"meta",children:t("Lowercase letters, digits and dashes, up to 32. It names the room and cannot be changed.")})]}),n("label",{htmlFor:F[2],children:[t("Prompt"),e("textarea",{id:F[2],rows:6,value:V,onChange:(b)=>E(b.target.value)}),e("span",{className:"meta",children:t("Its job, its sources, its limits and how it reports.")})]}),n("label",{htmlFor:F[4],children:[t("Model"),n(qe,{id:F[4],value:x,onChange:(b)=>v(b.target.value),children:[e("option",{value:me,children:t("Default model")}),_e(j).map((b)=>b.provider===""?b.models.map((T)=>e("option",{value:T,children:T},T)):e("optgroup",{label:b.provider,children:b.models.map((T)=>e("option",{value:T,children:T},T))},b.provider))]})]}),n("label",{htmlFor:F[3],children:[t("Opening task"),e("textarea",{id:F[3],rows:3,value:R,onChange:(b)=>H(b.target.value)}),e("span",{className:"meta",children:t("Optional. The knight starts on it as soon as it is made.")})]}),n("div",{className:"profile-head",children:[e(ue,{spec:Y,name:k||"new",size:72,label:p}),n("div",{children:[e("strong",{children:t("Look")}),e("span",{className:"meta",children:z?t("Your look"):t("Suggested from its role")}),e("button",{type:"button",className:"secondary compact",onClick:()=>B(!0),children:t("Choose a look")})]})]}),q?e(g,{message:q}):null,e("div",{className:"actions",children:e("button",{type:"submit",disabled:!Z||U,children:U?t("Making…"):t("Make knight")})})]})}var Xe=(l)=>l.kind==="new-agent"?t("New knight"):l.kind==="archive"?t("Archived"):l.name===void 0?t("New group"):t("Edit group");function Le(){let l=Vo(),p=a(l);if(l)p.current=l;let i=p.current,k=l!==void 0;if(s(()=>{if(!k)return;let C=window.location.href,I=()=>{if(window.location.href!==C)Oi()};return window.addEventListener("popstate",I),window.addEventListener("hashchange",I),()=>{window.removeEventListener("popstate",I),window.removeEventListener("hashchange",I)}},[k]),!i)return null;return e(L,{open:l!==void 0,title:Xe(i),size:"wide",onClose:Oi,children:e("div",{className:"stack agent-sheet",children:i.kind==="new-agent"?e(Me,{onDone:Oi}):i.kind==="archive"?e(ke,{}):e(Ae,{...i.name===void 0?{}:{name:i.name},onDone:Oi})},i.id)})}var Ye=S(()=>(h("g5cpqjjj"),import("./chunk-shortcut-help-g5cpqjjj.js")));function Je(){let l=vo(),p=a(!1);if(l)p.current=!0;if(!p.current)return null;return e(Q,{fallback:null,children:e(Ye,{open:l})})}function ga(){return n(m,{children:[e(lr,{}),e(ye,{}),e(Le,{}),e(Je,{})]})}export{ga as SheetHosts};
@@ -1,4 +1,4 @@
1
- import{t,e,n}from"./chunk-index-2e4am3hw.js";import{Kn,So}from"./chunk-index-dj0tbfyb.js";import{on}from"./chunk-index-31x6krbs.js";import{L}from"./chunk-index-8d81qy69.js";var l=`
1
+ import{t,e,n}from"./chunk-index-fg42egv9.js";import{Kn,So}from"./chunk-index-ypkgw7gq.js";import{on}from"./chunk-index-983dmeaa.js";import{L}from"./chunk-index-afrhnrxj.js";var l=`
2
2
  .shortcut-list {
3
3
  display: grid;
4
4
  grid-template-columns: max-content minmax(0, 1fr);
@@ -1 +1 @@
1
- import{ui,v,D,ke,y,nt,St}from"./chunk-index-2e4am3hw.js";import{fr}from"./chunk-index-g3wrs02w.js";import{jr}from"./chunk-index-kbrg32sx.js";import{bo,Kn,xo}from"./chunk-index-dj0tbfyb.js";import{ot}from"./chunk-index-g1awv7rk.js";function m(e,t){let{collapsed:o,expanded:r,current:s}=t,n=ot(e,t.at),a=[],c=(i,d)=>{a.push({key:i,shown:d});let f=n.threads[i];if(!f)return;for(let l of f.open)a.push({key:l,shown:d});for(let l of f.closed)a.push({key:l,shown:d&&(r.has(l)||l===s)})};for(let i of n.home)c(i,!0);for(let i of n.pinned)c(i,!0);for(let i of n.folders){let d=!o.has(i.id)||s!==void 0&&i.rooms.includes(s);for(let f of i.rooms)c(f,d)}let u=n.folders.length>0?n.rest:[...n.restAgents,...n.restGroups];for(let i of u)c(i,!0);let{orphans:p}=n;for(let i of p.open)a.push({key:i,shown:!0});for(let i of p.closed)a.push({key:i,shown:r.has(i)||i===s});return a}function h(e,t,o,r){let s=o===1?-1:e.length;if(t!==void 0){if(s=e.findIndex((n)=>n.key===t),s<0)return}for(let n=s+o;n>=0&&n<e.length;n+=o){let a=e[n];if(a&&r(a))return a.key}return}var w=new Set(["","text","search","url","tel","email","password","number","date","datetime-local","month","time","week"]);function S(e){if(!(e instanceof HTMLElement))return;if(e instanceof HTMLTextAreaElement)return e;if(e instanceof HTMLSelectElement)return e;if(e instanceof HTMLInputElement)return w.has(e.type)?e:void 0;return e.closest('[contenteditable]:not([contenteditable="false"])')?e:void 0}function b(e,t){if(e instanceof HTMLSelectElement)return!1;if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){if(e.value==="")return!0;let{selectionStart:n,selectionEnd:a}=e;if(n===null||a===null||n!==a)return!1;return t?n===0:n===e.value.length}if((e.textContent??"")==="")return!0;let o=window.getSelection();if(!o||o.rangeCount===0||!o.isCollapsed)return!1;let r=o.getRangeAt(0),s=document.createRange();if(s.selectNodeContents(e),t)s.setEnd(r.startContainer,r.startOffset);else s.setStart(r.endContainer,r.endOffset);return s.toString()===""}function k(e){if(e.defaultPrevented||nt(e))return;let{key:t}=e;if(t==="Escape")return e.altKey||e.ctrlKey||e.metaKey?void 0:"escape";if(e.altKey&&!e.ctrlKey&&!e.metaKey){if(t!=="ArrowUp"&&t!=="ArrowDown")return;let o=t==="ArrowUp",r=S(e.target);if(r&&!b(r,o))return;if(e.shiftKey)return o?"previous-unread":"next-unread";return o?"previous":"next"}if(t==="?"&&!e.ctrlKey&&!e.metaKey&&!e.repeat)return S(e.target)?void 0:"help";return}function x(){let e=new Set;for(let t of document.querySelectorAll("details.thread-closed[open] [data-thread]"))if(t.dataset.thread)e.add(t.dataset.thread);return e}var g=()=>document.querySelector('dialog[open], .action-popover, .switcher:not([data-state="closed"])')!==null;function E(e,t=12){let o=v("room",e),r=[...document.querySelectorAll('.room-row[aria-current="page"], .thread-link[aria-current="page"]')].find((s)=>s.getAttribute("href")===o);if(r)r.scrollIntoView?.({block:"nearest"});else if(t>0)requestAnimationFrame(()=>E(e,t-1))}function T(e,t){let o=y.getState(),r=ui(),s=r.pane==="room"?r.key:void 0,n=m(o,{at:(u)=>ke(o,u),collapsed:fr(),expanded:x(),current:s});if(r.pane==="room"&&!n.some((u)=>u.key===s))return;let c=h(n,s,e,t?(u)=>jr(u.key)>0:(u)=>u.shown);if(c===void 0)return;D("room",c),E(c)}function H(e){if(document.querySelector(".action-popover")){e.preventDefault(),St();return}if(document.querySelector("dialog[open]"))return;let t=document.activeElement;if(t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&w.has(t.type))e.preventDefault(),t.blur()}function K(e,t){switch(e){case"escape":H(t);break;case"help":if(t.preventDefault(),xo())Kn();else if(!g())bo();break;default:if(g())break;t.preventDefault(),T(e.startsWith("previous")?-1:1,e.endsWith("unread"))}}function P(){let e=(t)=>{let o=k(t);if(o)K(o,t)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}export{P as startShortcuts};
1
+ import{ui,v,D,ke,y,nt,St}from"./chunk-index-fg42egv9.js";import{fr}from"./chunk-index-e02ddp46.js";import{jr}from"./chunk-index-3pnvpppa.js";import{bo,Kn,xo}from"./chunk-index-ypkgw7gq.js";import{ot}from"./chunk-index-yrmqcay4.js";function m(e,t){let{collapsed:o,expanded:r,current:s}=t,n=ot(e,t.at),a=[],c=(i,d)=>{a.push({key:i,shown:d});let f=n.threads[i];if(!f)return;for(let l of f.open)a.push({key:l,shown:d});for(let l of f.closed)a.push({key:l,shown:d&&(r.has(l)||l===s)})};for(let i of n.home)c(i,!0);for(let i of n.pinned)c(i,!0);for(let i of n.folders){let d=!o.has(i.id)||s!==void 0&&i.rooms.includes(s);for(let f of i.rooms)c(f,d)}let u=n.folders.length>0?n.rest:[...n.restAgents,...n.restGroups];for(let i of u)c(i,!0);let{orphans:p}=n;for(let i of p.open)a.push({key:i,shown:!0});for(let i of p.closed)a.push({key:i,shown:r.has(i)||i===s});return a}function h(e,t,o,r){let s=o===1?-1:e.length;if(t!==void 0){if(s=e.findIndex((n)=>n.key===t),s<0)return}for(let n=s+o;n>=0&&n<e.length;n+=o){let a=e[n];if(a&&r(a))return a.key}return}var w=new Set(["","text","search","url","tel","email","password","number","date","datetime-local","month","time","week"]);function S(e){if(!(e instanceof HTMLElement))return;if(e instanceof HTMLTextAreaElement)return e;if(e instanceof HTMLSelectElement)return e;if(e instanceof HTMLInputElement)return w.has(e.type)?e:void 0;return e.closest('[contenteditable]:not([contenteditable="false"])')?e:void 0}function b(e,t){if(e instanceof HTMLSelectElement)return!1;if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){if(e.value==="")return!0;let{selectionStart:n,selectionEnd:a}=e;if(n===null||a===null||n!==a)return!1;return t?n===0:n===e.value.length}if((e.textContent??"")==="")return!0;let o=window.getSelection();if(!o||o.rangeCount===0||!o.isCollapsed)return!1;let r=o.getRangeAt(0),s=document.createRange();if(s.selectNodeContents(e),t)s.setEnd(r.startContainer,r.startOffset);else s.setStart(r.endContainer,r.endOffset);return s.toString()===""}function k(e){if(e.defaultPrevented||nt(e))return;let{key:t}=e;if(t==="Escape")return e.altKey||e.ctrlKey||e.metaKey?void 0:"escape";if(e.altKey&&!e.ctrlKey&&!e.metaKey){if(t!=="ArrowUp"&&t!=="ArrowDown")return;let o=t==="ArrowUp",r=S(e.target);if(r&&!b(r,o))return;if(e.shiftKey)return o?"previous-unread":"next-unread";return o?"previous":"next"}if(t==="?"&&!e.ctrlKey&&!e.metaKey&&!e.repeat)return S(e.target)?void 0:"help";return}function x(){let e=new Set;for(let t of document.querySelectorAll("details.thread-closed[open] [data-thread]"))if(t.dataset.thread)e.add(t.dataset.thread);return e}var g=()=>document.querySelector('dialog[open], .action-popover, .switcher:not([data-state="closed"])')!==null;function E(e,t=12){let o=v("room",e),r=[...document.querySelectorAll('.room-row[aria-current="page"], .thread-link[aria-current="page"]')].find((s)=>s.getAttribute("href")===o);if(r)r.scrollIntoView?.({block:"nearest"});else if(t>0)requestAnimationFrame(()=>E(e,t-1))}function T(e,t){let o=y.getState(),r=ui(),s=r.pane==="room"?r.key:void 0,n=m(o,{at:(u)=>ke(o,u),collapsed:fr(),expanded:x(),current:s});if(r.pane==="room"&&!n.some((u)=>u.key===s))return;let c=h(n,s,e,t?(u)=>jr(u.key)>0:(u)=>u.shown);if(c===void 0)return;D("room",c),E(c)}function H(e){if(document.querySelector(".action-popover")){e.preventDefault(),St();return}if(document.querySelector("dialog[open]"))return;let t=document.activeElement;if(t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&w.has(t.type))e.preventDefault(),t.blur()}function K(e,t){switch(e){case"escape":H(t);break;case"help":if(t.preventDefault(),xo())Kn();else if(!g())bo();break;default:if(g())break;t.preventDefault(),T(e.startsWith("previous")?-1:1,e.endsWith("unread"))}}function P(){let e=(t)=>{let o=k(t);if(o)K(o,t)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}export{P as startShortcuts};
@@ -1,4 +1,4 @@
1
- import{h,Q,S,s,N,r,t,m,e,n,o,ce,d,f,w,g}from"./chunk-index-2e4am3hw.js";import{Ne,mt}from"./chunk-index-tk4se135.js";import{L}from"./chunk-index-8d81qy69.js";var M=S(()=>(h("hf296e7v"),import("./chunk-prompt-history-hf296e7v.js")).then((c)=>({default:c.HistorySheet}))),B=`---
1
+ import{h,Q,S,s,N,r,t,m,e,n,o,ce,d,f,w,g}from"./chunk-index-fg42egv9.js";import{Ne,mt}from"./chunk-index-eq161yvp.js";import{L}from"./chunk-index-afrhnrxj.js";var M=S(()=>(h("zcfvr3r8"),import("./chunk-prompt-history-zcfvr3r8.js")).then((c)=>({default:c.HistorySheet}))),B=`---
2
2
  name: my-skill
3
3
  description: "Use when "
4
4
  ---
@@ -1 +1 @@
1
- import{h,vr,Q,S,s,r,t,m,e,n,o,O,d,w,g,_,P,Gt,Rt}from"./chunk-index-2e4am3hw.js";import{be}from"./chunk-index-5bfqek1d.js";import{he}from"./chunk-index-v6smgw77.js";import"./chunk-index-8d81qy69.js";function N({source:i}){return e("div",{className:"prose document",children:e(Gt,{remarkPlugins:[Rt],components:{a:({href:a,children:c})=>a&&/^https?:\/\//.test(a)?e("a",{href:a,target:"_blank",rel:"noreferrer",children:c}):e("span",{children:c}),img:({alt:a})=>e("span",{children:a}),pre:({children:a})=>e("div",{className:"code-block",children:e("pre",{children:a})}),table:({children:a})=>e("div",{className:"table-wrap",children:e("table",{children:a})})},children:i})})}var v=S(()=>(h("67yk4x7t"),import("./chunk-skill-editor-67yk4x7t.js")).then((i)=>({default:i.SkillEditor})));function j(){let[i,a]=r(0),{data:c,error:l}=be(()=>O.skills(),`skills:${i}`),[f,y]=r(),[p,k]=r();s(()=>{O.session().then(y,()=>{return})},[]);let b=f?.skillEdit===!0;return n("section",{className:"stack",children:[n("div",{className:"card-head",children:[e("h2",{children:t("Skills")}),b?n("button",{type:"button",className:"secondary",onClick:()=>k({name:void 0}),children:[e(o,{name:"plus",size:16}),t("New skill")]}):null]}),e("p",{className:"hint",children:b?t("Registered skills and their carriers. A skill a knight wrote can be edited here; the others are read-only."):t("Registered skills and their carriers; ask a knight on Discord to edit their contents.")}),l?e(g,{message:l}):null,!c&&!l?e(w,{}):null,c?.length===0?e(_,{children:t("No skills.")}):null,c?.map((u)=>e(D,{skill:u,onEdit:b&&u.source.kind==="written"?()=>k({name:u.name}):void 0},`${u.name}:${i}`)),p?e(Q,{fallback:null,children:e(v,{name:p.name,onSaved:()=>a((u)=>u+1),onClose:()=>k(void 0)},p.name??"")}):null]})}function E(i){switch(i.kind){case"builtin":return t("Built in with the release; it changes with the release.");case"package":return t("From the package {package}; it changes when the package is upgraded.",{package:i.package});case"linked":return t("Linked from {repo}; change it in its repository.",{repo:`${i.repo}:${i.path}`});default:return}}function D({skill:i,onEdit:a}){let[c,l]=r(!1),[f,y]=r(),[p,k]=r(),b=i.source.kind==="builtin"?t("Built-in"):i.source.kind==="written"?t("Knight-written"):i.source.kind==="package"?i.source.package:`${i.source.repo}:${i.source.path}`;return n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:i.name}),e(P,{children:b}),i.missing?e(P,{tone:"warn",children:t("File missing")}):n(m,{children:[a?e("button",{type:"button",className:"secondary",onClick:a,children:t("Edit")}):null,e("button",{type:"button",className:"secondary",onClick:()=>{if(l(!0),!f)k(void 0),O.skill(i.name).then(y).catch((u)=>k(d(u)))},children:"SKILL.md"})]})]}),e("p",{children:i.missing??i.description}),i.source.kind!=="written"?n("p",{className:"hint skill-lock",children:[e(o,{name:"lock",size:14}),e("span",{children:E(i.source)})]}):null,n("p",{className:"hint",children:[t("Carriers"),":"," ",i.source.kind==="builtin"?t("All knights"):i.carriers.join(", ")||t("None")]}),i.groups.length?n("p",{className:"hint",children:[t("Groups"),": ",i.groups.join(", ")]}):null,e(he,{open:c,title:i.name,size:"wide",onClose:()=>l(!1),children:p?e(g,{message:p}):!f?e(w,{}):e(V,{title:i.name,detail:f})})]})}function V({title:i,detail:a}){let c=a.metadata.filter((l)=>!(l.key==="name"&&l.value===i));return n("div",{className:"skill-document",children:[c.length?e("dl",{className:"skill-meta",children:c.map((l)=>n(vr,{children:[e("dt",{children:l.key}),e("dd",{children:l.value})]},l.key))}):null,e(N,{source:a.body})]})}export{j as SkillsPage};
1
+ import{h,vr,Q,S,s,r,t,m,e,n,o,O,d,w,g,_,P,Gt,Rt}from"./chunk-index-fg42egv9.js";import{be}from"./chunk-index-xevnf9ew.js";import{he}from"./chunk-index-s72hmse6.js";import"./chunk-index-afrhnrxj.js";function N({source:i}){return e("div",{className:"prose document",children:e(Gt,{remarkPlugins:[Rt],components:{a:({href:a,children:c})=>a&&/^https?:\/\//.test(a)?e("a",{href:a,target:"_blank",rel:"noreferrer",children:c}):e("span",{children:c}),img:({alt:a})=>e("span",{children:a}),pre:({children:a})=>e("div",{className:"code-block",children:e("pre",{children:a})}),table:({children:a})=>e("div",{className:"table-wrap",children:e("table",{children:a})})},children:i})})}var v=S(()=>(h("xdfq2708"),import("./chunk-skill-editor-xdfq2708.js")).then((i)=>({default:i.SkillEditor})));function j(){let[i,a]=r(0),{data:c,error:l}=be(()=>O.skills(),`skills:${i}`),[f,y]=r(),[p,k]=r();s(()=>{O.session().then(y,()=>{return})},[]);let b=f?.skillEdit===!0;return n("section",{className:"stack",children:[n("div",{className:"card-head",children:[e("h2",{children:t("Skills")}),b?n("button",{type:"button",className:"secondary",onClick:()=>k({name:void 0}),children:[e(o,{name:"plus",size:16}),t("New skill")]}):null]}),e("p",{className:"hint",children:b?t("Registered skills and their carriers. A skill a knight wrote can be edited here; the others are read-only."):t("Registered skills and their carriers; ask a knight on Discord to edit their contents.")}),l?e(g,{message:l}):null,!c&&!l?e(w,{}):null,c?.length===0?e(_,{children:t("No skills.")}):null,c?.map((u)=>e(D,{skill:u,onEdit:b&&u.source.kind==="written"?()=>k({name:u.name}):void 0},`${u.name}:${i}`)),p?e(Q,{fallback:null,children:e(v,{name:p.name,onSaved:()=>a((u)=>u+1),onClose:()=>k(void 0)},p.name??"")}):null]})}function E(i){switch(i.kind){case"builtin":return t("Built in with the release; it changes with the release.");case"package":return t("From the package {package}; it changes when the package is upgraded.",{package:i.package});case"linked":return t("Linked from {repo}; change it in its repository.",{repo:`${i.repo}:${i.path}`});default:return}}function D({skill:i,onEdit:a}){let[c,l]=r(!1),[f,y]=r(),[p,k]=r(),b=i.source.kind==="builtin"?t("Built-in"):i.source.kind==="written"?t("Knight-written"):i.source.kind==="package"?i.source.package:`${i.source.repo}:${i.source.path}`;return n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:i.name}),e(P,{children:b}),i.missing?e(P,{tone:"warn",children:t("File missing")}):n(m,{children:[a?e("button",{type:"button",className:"secondary",onClick:a,children:t("Edit")}):null,e("button",{type:"button",className:"secondary",onClick:()=>{if(l(!0),!f)k(void 0),O.skill(i.name).then(y).catch((u)=>k(d(u)))},children:"SKILL.md"})]})]}),e("p",{children:i.missing??i.description}),i.source.kind!=="written"?n("p",{className:"hint skill-lock",children:[e(o,{name:"lock",size:14}),e("span",{children:E(i.source)})]}):null,n("p",{className:"hint",children:[t("Carriers"),":"," ",i.source.kind==="builtin"?t("All knights"):i.carriers.join(", ")||t("None")]}),i.groups.length?n("p",{className:"hint",children:[t("Groups"),": ",i.groups.join(", ")]}):null,e(he,{open:c,title:i.name,size:"wide",onClose:()=>l(!1),children:p?e(g,{message:p}):!f?e(w,{}):e(V,{title:i.name,detail:f})})]})}function V({title:i,detail:a}){let c=a.metadata.filter((l)=>!(l.key==="name"&&l.value===i));return n("div",{className:"skill-document",children:[c.length?e("dl",{className:"skill-meta",children:c.map((l)=>n(vr,{children:[e("dt",{children:l.key}),e("dd",{children:l.value})]},l.key))}):null,e(N,{source:a.body})]})}export{j as SkillsPage};
@@ -1 +1 @@
1
- import{M,a,r,t,te,m,e,n,o,v,D,gt,ke,u,nt,Wt,On,We,Xe,Yt}from"./chunk-index-2e4am3hw.js";import{si}from"./chunk-index-02vfshtt.js";import{ii}from"./chunk-index-ak6ecqy3.js";import{ri,oi}from"./chunk-index-xxeb2xp0.js";import{Bt}from"./chunk-index-12zyshae.js";import{Ts}from"./chunk-index-g1awv7rk.js";ri();function b(){let l=u((c)=>JSON.stringify(Ts(c,(s)=>ke(c,s),(s)=>gt(c,s)>0,!0).map((s)=>({id:s.id,...s.title===void 0?{}:{title:s.title},entries:s.keys.map((h)=>({key:h,name:c.rooms[h]?.view?.displayName??h,waiting:gt(c,h)>0}))})))),d=si(),y=a(l);if(!d)y.current=l;let f=y.current;return M(()=>JSON.parse(f),[f])}function k(l){let{key:d,name:y}=l.entry,f=u((i)=>i.rooms[d]),c=u((i)=>gt(i,d)),s=f?.view,h=We(s?.character),g=Bt(()=>Wt(d,l.onLeave),l.liftable&&!s?.home?oi(d):void 0);if(!s)return null;return e("li",{...l.liftable&&!s.home?{"data-drop-item":"","data-key":d}:{},children:n("a",{className:"switcher-row",...g,href:v("room",d),"aria-current":d===l.current?"page":void 0,style:h,onClick:(i)=>{if(i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey)return;i.preventDefault(),l.onPick(d)},children:[n("span",{className:"switcher-picture",children:[e(Xe,{view:s,size:40}),c?e("span",{className:"switcher-dot","aria-hidden":"true"}):null]}),n("span",{className:"switcher-name",children:[e("strong",{children:y}),f?.typing?n("span",{className:"switcher-working",children:[n("span",{className:"typing","aria-hidden":"true",children:[e("i",{}),e("i",{}),e("i",{})]}),t("Working")]}):null]}),e(Yt,{room:d}),c?e("span",{className:"badge badge-warn",children:te(c,"{count} card waiting","{count} cards waiting")}):null,s.muted?n("span",{className:"switcher-mode","data-mode":"muted",title:t("Notifications are off"),children:[e(o,{name:"bell-off",size:14}),e("span",{className:"visually-hidden",children:t("Notifications are off")})]}):null,f?.mode.yolo?n("span",{className:"switcher-mode","data-mode":"yolo",title:t("Yolo"),children:[e(o,{name:"bolt",size:14}),e("span",{className:"visually-hidden",children:t("Yolo")})]}):null,f?.mode.longRunning?n("span",{className:"switcher-mode","data-mode":"long",title:t("Long-running"),children:[e(o,{name:"timer",size:14}),e("span",{className:"visually-hidden",children:t("Long-running")})]}):null]})})}function Y(l){let[d,y]=r(""),f=b(),c=f.map((i)=>({...i,entries:i.entries.filter((p)=>ii(d,p.name)!==void 0)})).filter((i)=>i.entries.length>0||d===""),s=(i)=>l.close(i===l.current?void 0:()=>D("room",i)),h=f.some((i)=>i.id!=="waiting"&&i.id!=="home"&&i.id!=="rest"&&(i.id!=="pinned"||i.entries.length>0))?t("Ungrouped"):t("Rooms"),g=c.filter((i)=>i.entries.length>0).length>1;return n(m,{children:[n("div",{className:"switcher-search",children:[e(o,{name:"search",size:16}),e("input",{type:"search",value:d,placeholder:t("Find a room"),"aria-label":t("Find a room"),enterKeyHint:"go",autoComplete:"off",onChange:(i)=>y(i.target.value),onKeyDown:(i)=>{let p=c.flatMap((w)=>w.entries)[0];if(i.key==="Enter"&&p&&!nt(i.nativeEvent))s(p.key)}}),e("button",{type:"button",className:"icon-button switcher-add","aria-label":t("Add"),"aria-haspopup":"menu",onClick:(i)=>On(i.currentTarget,l.close),children:e(o,{name:"plus"})})]}),e("div",{className:"switcher-scroll","data-drop-root":"",children:c.map((i)=>{let p=i.id==="waiting",w=i.id==="pinned"?"pinned":i.id==="rest"?"rest":p||i.id==="home"?void 0:"folder";return n("section",{"aria-label":p?t("Waiting for you"):i.id==="home"?t("Home"):i.id==="pinned"?t("Pinned"):i.id==="rest"?h:i.title??t("Rooms"),...i.entries.length===0?{"data-empty":""}:{},...w?{"data-drop-zone":w,"data-zone-id":i.id,...w==="folder"?{"data-folder":i.id}:{}}:{},children:[p?e("h2",{className:"switcher-heading","data-waiting":"",children:t("Waiting for you")}):g||i.entries.length===0?e("h2",{className:"switcher-heading",children:i.id==="home"?t("Home"):i.id==="pinned"?t("Pinned"):i.id==="rest"?h:i.title}):null,e("ul",{className:"switcher-list",children:i.entries.map((N)=>e(k,{entry:N,current:l.current,onPick:s,onLeave:l.close,liftable:!p&&i.id!=="home"},N.key))})]},i.id)})})]})}export{Y as SwitcherList};
1
+ import{M,a,r,t,te,m,e,n,o,v,D,gt,ke,u,nt,Wt,On,We,Xe,Yt}from"./chunk-index-fg42egv9.js";import{si}from"./chunk-index-83v0c9x6.js";import{ii}from"./chunk-index-ak6ecqy3.js";import{ri,oi}from"./chunk-index-9z13jw6q.js";import{Bt}from"./chunk-index-f5x2srr0.js";import{Ts}from"./chunk-index-yrmqcay4.js";ri();function b(){let l=u((c)=>JSON.stringify(Ts(c,(s)=>ke(c,s),(s)=>gt(c,s)>0,!0).map((s)=>({id:s.id,...s.title===void 0?{}:{title:s.title},entries:s.keys.map((h)=>({key:h,name:c.rooms[h]?.view?.displayName??h,waiting:gt(c,h)>0}))})))),d=si(),y=a(l);if(!d)y.current=l;let f=y.current;return M(()=>JSON.parse(f),[f])}function k(l){let{key:d,name:y}=l.entry,f=u((i)=>i.rooms[d]),c=u((i)=>gt(i,d)),s=f?.view,h=We(s?.character),g=Bt(()=>Wt(d,l.onLeave),l.liftable&&!s?.home?oi(d):void 0);if(!s)return null;return e("li",{...l.liftable&&!s.home?{"data-drop-item":"","data-key":d}:{},children:n("a",{className:"switcher-row",...g,href:v("room",d),"aria-current":d===l.current?"page":void 0,style:h,onClick:(i)=>{if(i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey)return;i.preventDefault(),l.onPick(d)},children:[n("span",{className:"switcher-picture",children:[e(Xe,{view:s,size:40}),c?e("span",{className:"switcher-dot","aria-hidden":"true"}):null]}),n("span",{className:"switcher-name",children:[e("strong",{children:y}),f?.typing?n("span",{className:"switcher-working",children:[n("span",{className:"typing","aria-hidden":"true",children:[e("i",{}),e("i",{}),e("i",{})]}),t("Working")]}):null]}),e(Yt,{room:d}),c?e("span",{className:"badge badge-warn",children:te(c,"{count} card waiting","{count} cards waiting")}):null,s.muted?n("span",{className:"switcher-mode","data-mode":"muted",title:t("Notifications are off"),children:[e(o,{name:"bell-off",size:14}),e("span",{className:"visually-hidden",children:t("Notifications are off")})]}):null,f?.mode.yolo?n("span",{className:"switcher-mode","data-mode":"yolo",title:t("Yolo"),children:[e(o,{name:"bolt",size:14}),e("span",{className:"visually-hidden",children:t("Yolo")})]}):null,f?.mode.longRunning?n("span",{className:"switcher-mode","data-mode":"long",title:t("Long-running"),children:[e(o,{name:"timer",size:14}),e("span",{className:"visually-hidden",children:t("Long-running")})]}):null]})})}function Y(l){let[d,y]=r(""),f=b(),c=f.map((i)=>({...i,entries:i.entries.filter((p)=>ii(d,p.name)!==void 0)})).filter((i)=>i.entries.length>0||d===""),s=(i)=>l.close(i===l.current?void 0:()=>D("room",i)),h=f.some((i)=>i.id!=="waiting"&&i.id!=="home"&&i.id!=="rest"&&(i.id!=="pinned"||i.entries.length>0))?t("Ungrouped"):t("Rooms"),g=c.filter((i)=>i.entries.length>0).length>1;return n(m,{children:[n("div",{className:"switcher-search",children:[e(o,{name:"search",size:16}),e("input",{type:"search",value:d,placeholder:t("Find a room"),"aria-label":t("Find a room"),enterKeyHint:"go",autoComplete:"off",onChange:(i)=>y(i.target.value),onKeyDown:(i)=>{let p=c.flatMap((w)=>w.entries)[0];if(i.key==="Enter"&&p&&!nt(i.nativeEvent))s(p.key)}}),e("button",{type:"button",className:"icon-button switcher-add","aria-label":t("Add"),"aria-haspopup":"menu",onClick:(i)=>On(i.currentTarget,l.close),children:e(o,{name:"plus"})})]}),e("div",{className:"switcher-scroll","data-drop-root":"",children:c.map((i)=>{let p=i.id==="waiting",w=i.id==="pinned"?"pinned":i.id==="rest"?"rest":p||i.id==="home"?void 0:"folder";return n("section",{"aria-label":p?t("Waiting for you"):i.id==="home"?t("Home"):i.id==="pinned"?t("Pinned"):i.id==="rest"?h:i.title??t("Rooms"),...i.entries.length===0?{"data-empty":""}:{},...w?{"data-drop-zone":w,"data-zone-id":i.id,...w==="folder"?{"data-folder":i.id}:{}}:{},children:[p?e("h2",{className:"switcher-heading","data-waiting":"",children:t("Waiting for you")}):g||i.entries.length===0?e("h2",{className:"switcher-heading",children:i.id==="home"?t("Home"):i.id==="pinned"?t("Pinned"):i.id==="rest"?h:i.title}):null,e("ul",{className:"switcher-list",children:i.entries.map((N)=>e(k,{entry:N,current:l.current,onPick:s,onLeave:l.close,liftable:!p&&i.id!=="home"},N.key))})]},i.id)})})]})}export{Y as SwitcherList};
@@ -1 +1 @@
1
- import{y,Go,Ki}from"./chunk-index-2e4am3hw.js";import{Hr,Kr}from"./chunk-index-kbrg32sx.js";import{Xi,Po}from"./chunk-index-ac1ktr56.js";import"./chunk-index-msqhgvfx.js";var c=64;async function m(s){let a=new Image;a.src=s,await a.decode();let r=document.createElement("canvas");r.width=r.height=c;let t=r.getContext("2d");if(!t)throw Error("the page has no 2d canvas");t.drawImage(a,0,0,c,c);let i=c*0.175,o=c-i-2,e=i+2;return t.fillStyle="#ffffff",t.beginPath(),t.arc(o,e,i+2.5,0,Math.PI*2),t.fill(),t.fillStyle="#ef4444",t.beginPath(),t.arc(o,e,i,0,Math.PI*2),t.fill(),r.toDataURL("image/png")}var u=()=>[...document.head.querySelectorAll('link[rel~="icon"]')];function g(s){let a=new Map,r=!1,t=0,i=(e)=>{if(e.dataset.plainHref===void 0)return;if(e.setAttribute("href",e.dataset.plainHref),e.dataset.plainType)e.type=e.dataset.plainType;else e.removeAttribute("type");if(e.dataset.plainSizes)e.setAttribute("sizes",e.dataset.plainSizes);else e.removeAttribute("sizes");delete e.dataset.plainHref,delete e.dataset.plainType,delete e.dataset.plainSizes},o=async()=>{let e=++t,p=s.count()>0;if(p===r)return;if(!p){for(let n of u())i(n);r=!1;return}let l=u(),d=(l.find((n)=>n.dataset.plainHref===void 0&&n.type==="image/png")??l[0])?.href;if(!d)return;let f=a.get(d);if(!f)f=s.render(d),a.set(d,f);let b=await f.catch((n)=>{a.delete(d),console.warn("the tab icon's dot failed to draw",n);return});if(!b||e!==t)return;for(let n of u()){if(n.dataset.plainHref===void 0)n.dataset.plainHref=n.getAttribute("href")??"",n.dataset.plainType=n.type,n.dataset.plainSizes=n.getAttribute("sizes")??"";n.href=b,n.type="image/png",n.removeAttribute("sizes")}r=!0};s.subscribe(()=>void o()),o()}function H(){let s=()=>Xi().badge+Kr(),a=()=>Go(s());g({count:()=>Ki(y.getState())+s(),subscribe:(r)=>{let t=()=>{a(),r()};y.subscribe(t),Po(t),Hr(t)},render:m}),a()}export{H as startPageTabDot};
1
+ import{y,Go,Ki}from"./chunk-index-fg42egv9.js";import{Hr,Kr}from"./chunk-index-3pnvpppa.js";import{Xi,Po}from"./chunk-index-k0z507h3.js";import"./chunk-index-h3v1d3nt.js";var c=64;async function m(s){let a=new Image;a.src=s,await a.decode();let r=document.createElement("canvas");r.width=r.height=c;let t=r.getContext("2d");if(!t)throw Error("the page has no 2d canvas");t.drawImage(a,0,0,c,c);let i=c*0.175,o=c-i-2,e=i+2;return t.fillStyle="#ffffff",t.beginPath(),t.arc(o,e,i+2.5,0,Math.PI*2),t.fill(),t.fillStyle="#ef4444",t.beginPath(),t.arc(o,e,i,0,Math.PI*2),t.fill(),r.toDataURL("image/png")}var u=()=>[...document.head.querySelectorAll('link[rel~="icon"]')];function g(s){let a=new Map,r=!1,t=0,i=(e)=>{if(e.dataset.plainHref===void 0)return;if(e.setAttribute("href",e.dataset.plainHref),e.dataset.plainType)e.type=e.dataset.plainType;else e.removeAttribute("type");if(e.dataset.plainSizes)e.setAttribute("sizes",e.dataset.plainSizes);else e.removeAttribute("sizes");delete e.dataset.plainHref,delete e.dataset.plainType,delete e.dataset.plainSizes},o=async()=>{let e=++t,p=s.count()>0;if(p===r)return;if(!p){for(let n of u())i(n);r=!1;return}let l=u(),d=(l.find((n)=>n.dataset.plainHref===void 0&&n.type==="image/png")??l[0])?.href;if(!d)return;let f=a.get(d);if(!f)f=s.render(d),a.set(d,f);let b=await f.catch((n)=>{a.delete(d),console.warn("the tab icon's dot failed to draw",n);return});if(!b||e!==t)return;for(let n of u()){if(n.dataset.plainHref===void 0)n.dataset.plainHref=n.getAttribute("href")??"",n.dataset.plainType=n.type,n.dataset.plainSizes=n.getAttribute("sizes")??"";n.href=b,n.type="image/png",n.removeAttribute("sizes")}r=!0};s.subscribe(()=>void o()),o()}function H(){let s=()=>Xi().badge+Kr(),a=()=>Go(s());g({count:()=>Ki(y.getState())+s(),subscribe:(r)=>{let t=()=>{a(),r()};y.subscribe(t),Po(t),Hr(t)},render:m}),a()}export{H as startPageTabDot};
@@ -1 +1 @@
1
- import{h,Q,S,ve,s,r,t,e,n,D,u,et,pe,qo}from"./chunk-index-2e4am3hw.js";import"./chunk-index-2t30xwed.js";import"./chunk-index-18pgxxw3.js";import"./chunk-index-kbrg32sx.js";import{Mn,ei,wo,$i,ti,Vt}from"./chunk-index-kb3w11mn.js";import"./chunk-index-64rsz6pf.js";import{Ei,Ci}from"./chunk-index-t998yg8y.js";import"./chunk-index-8d81qy69.js";import{es,xi,ts}from"./chunk-index-dnjftvtq.js";var x=S(()=>(h("s9sz1bzf"),import("./chunk-council-sheet-s9sz1bzf.js")).then((o)=>({default:o.CouncilSheet})));function A(o,i,b,c,d){qo(o,i).then((m)=>{if(m)pe({...m,at:b,via:c,source:d})},()=>{return})}function P(){return wo((ve(et)?.kinds??[]).map((o)=>o.kind)),null}function V({focus:o}){let[i,b]=r(),c=$i(void 0),d=Mn(),m=d.loaded&&c.length===0;return s(()=>{if(o&&d.loaded)D("table",void 0,{replace:!0})},[o,d.loaded]),n("div",{className:"table-page",children:[n("header",{className:"page-head",children:[e("h1",{children:t("Round table")}),n("div",{className:"table-tools",children:[i?.kind==="webgl"?e("button",{type:"button",className:"secondary",onClick:()=>i.focus(null),children:t("Reset view")}):null,e("button",{type:"button",className:"secondary",onClick:()=>D("rooms"),children:t("All rooms")})]})]}),n("div",{className:"table-frame",children:[m?n("div",{className:"table-empty-state",children:[e("strong",{children:t("The table is empty")}),e("p",{className:"meta",children:t("There are no rooms to seat yet.")})]}):e(Vt,{onHandle:b,onSeat:(a)=>{let l=c.find((f)=>f.name===a);if(l)D("room",l.key)},onFocus:(a)=>{let l=c.find((f)=>f.name===a);if(l)D("room",l.key)}}),e(P,{})]})]})}function F({named:o}){let[i,b]=r(),c=xi(),d=es(),m=u((p)=>p.listed),a=ts(c,d,o),l=a?.members??[],f=$i(l),g=ti(),{focus:R,look:y}=Ei(a?.key??"",l),[w,k]=r(!1),[H,M]=r(!1),v=()=>{M(!0),k(!0)},C=o===void 0||c.some(G(o));s(()=>{if(o!==void 0&&m&&!C)D("table",void 0,{replace:!0})},[o,m,C]);let N=f.length>0;return n("div",{className:"table-page","data-focused":N||void 0,children:[n("header",{className:"page-head",children:[e("h1",{children:t("Round table")}),n("div",{className:"table-tools",children:[i?.kind==="webgl"?e("button",{type:"button",className:"secondary",onClick:()=>y(null),children:t("Reset view")}):null,g.length>0?e("button",{type:"button",className:"secondary council-chip","aria-haspopup":"dialog",onClick:v,children:a?t("Council: {name} ▾",{name:a.displayName}):t("Pick who sits")}):null]})]}),a&&N?e(Ci,{roomKey:a.key,members:l,focus:R,onLook:y,streams:!0,onHandle:b,onSeatMenu:(p)=>{let T=f.find((E)=>E.name===p.id);if(T)A(T.key,a.key,p.at,p.via,p.source)}}):e("div",{className:"table-frame",children:n("div",{className:"table-empty-state",children:[e("strong",{children:a?t("The council is empty"):t("No council yet")}),e("p",{className:"meta",children:a?t("Every member of this council is gone. Edit who sits."):t("A council is a group of up to {max} knights who answer in turn. Pick who sits.",{max:8})}),g.length>0?e("button",{type:"button",onClick:v,children:a?t("Edit this council"):t("Pick who sits")}):null]})}),H?e(Q,{fallback:null,children:e(x,{open:w,onClose:()=>k(!1),council:a})}):null]})}var G=(o)=>(i)=>i.key===o||i.name===o;function Y({focus:o}){return ei()?e(V,{focus:o}):e(F,{named:o})}export{Y as TablePage};
1
+ import{h,Q,S,ve,s,r,t,e,n,D,u,et,pe,qo}from"./chunk-index-fg42egv9.js";import"./chunk-index-4z4chg7v.js";import"./chunk-index-n8ghdvxb.js";import"./chunk-index-3pnvpppa.js";import{Mn,ei,wo,$i,ti,Vt}from"./chunk-index-rcwdqn50.js";import"./chunk-index-64rsz6pf.js";import{Ei,Ci}from"./chunk-index-c44p8q87.js";import"./chunk-index-afrhnrxj.js";import{es,xi,ts}from"./chunk-index-dvfkb699.js";var x=S(()=>(h("bxvn7vza"),import("./chunk-council-sheet-bxvn7vza.js")).then((o)=>({default:o.CouncilSheet})));function A(o,i,b,c,d){qo(o,i).then((m)=>{if(m)pe({...m,at:b,via:c,source:d})},()=>{return})}function P(){return wo((ve(et)?.kinds??[]).map((o)=>o.kind)),null}function V({focus:o}){let[i,b]=r(),c=$i(void 0),d=Mn(),m=d.loaded&&c.length===0;return s(()=>{if(o&&d.loaded)D("table",void 0,{replace:!0})},[o,d.loaded]),n("div",{className:"table-page",children:[n("header",{className:"page-head",children:[e("h1",{children:t("Round table")}),n("div",{className:"table-tools",children:[i?.kind==="webgl"?e("button",{type:"button",className:"secondary",onClick:()=>i.focus(null),children:t("Reset view")}):null,e("button",{type:"button",className:"secondary",onClick:()=>D("rooms"),children:t("All rooms")})]})]}),n("div",{className:"table-frame",children:[m?n("div",{className:"table-empty-state",children:[e("strong",{children:t("The table is empty")}),e("p",{className:"meta",children:t("There are no rooms to seat yet.")})]}):e(Vt,{onHandle:b,onSeat:(a)=>{let l=c.find((f)=>f.name===a);if(l)D("room",l.key)},onFocus:(a)=>{let l=c.find((f)=>f.name===a);if(l)D("room",l.key)}}),e(P,{})]})]})}function F({named:o}){let[i,b]=r(),c=xi(),d=es(),m=u((p)=>p.listed),a=ts(c,d,o),l=a?.members??[],f=$i(l),g=ti(),{focus:R,look:y}=Ei(a?.key??"",l),[w,k]=r(!1),[H,M]=r(!1),v=()=>{M(!0),k(!0)},C=o===void 0||c.some(G(o));s(()=>{if(o!==void 0&&m&&!C)D("table",void 0,{replace:!0})},[o,m,C]);let N=f.length>0;return n("div",{className:"table-page","data-focused":N||void 0,children:[n("header",{className:"page-head",children:[e("h1",{children:t("Round table")}),n("div",{className:"table-tools",children:[i?.kind==="webgl"?e("button",{type:"button",className:"secondary",onClick:()=>y(null),children:t("Reset view")}):null,g.length>0?e("button",{type:"button",className:"secondary council-chip","aria-haspopup":"dialog",onClick:v,children:a?t("Council: {name} ▾",{name:a.displayName}):t("Pick who sits")}):null]})]}),a&&N?e(Ci,{roomKey:a.key,members:l,focus:R,onLook:y,streams:!0,onHandle:b,onSeatMenu:(p)=>{let T=f.find((E)=>E.name===p.id);if(T)A(T.key,a.key,p.at,p.via,p.source)}}):e("div",{className:"table-frame",children:n("div",{className:"table-empty-state",children:[e("strong",{children:a?t("The council is empty"):t("No council yet")}),e("p",{className:"meta",children:a?t("Every member of this council is gone. Edit who sits."):t("A council is a group of up to {max} knights who answer in turn. Pick who sits.",{max:8})}),g.length>0?e("button",{type:"button",onClick:v,children:a?t("Edit this council"):t("Pick who sits")}):null]})}),H?e(Q,{fallback:null,children:e(x,{open:w,onClose:()=>k(!1),council:a})}):null]})}var G=(o)=>(i)=>i.key===o||i.name===o;function Y({focus:o}){return ei()?e(V,{focus:o}):e(F,{named:o})}export{Y as TablePage};