pi-roundtable-web 0.26.3 → 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 (210) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +18 -11
  3. package/dist/chunk-account-83crfbn4.js +1 -0
  4. package/dist/chunk-action-menu-qw7h03x0.js +1 -0
  5. package/dist/chunk-agent-t1632ktv.js +1 -0
  6. package/dist/chunk-arranged-rooms-sb6tbsxw.js +1 -0
  7. package/dist/chunk-bulk-actions-v1g2bzk7.js +1 -0
  8. package/dist/chunk-character-creator-ye69w0kx.js +1 -0
  9. package/dist/{chunk-codeeditor-6xavqntt.js → chunk-codeeditor-5j6abj8k.js} +2 -2
  10. package/dist/chunk-confirm-x8w877bz.js +1 -0
  11. package/dist/{chunk-connectors-7xqsg5q5.js → chunk-connectors-t7qbc6nk.js} +1 -1
  12. package/dist/{chunk-conversations-zc4mv6vj.js → chunk-conversations-kmt6qzym.js} +1 -1
  13. package/dist/chunk-council-sheet-bxvn7vza.js +2 -0
  14. package/dist/{chunk-drag-0mefcvp3.js → chunk-drag-03zgvd66.js} +1 -1
  15. package/dist/chunk-entry-y5vwp5e5.js +1 -0
  16. package/dist/chunk-folder-list-h3vnjzpb.js +1 -0
  17. package/dist/chunk-folds-a3e22m7x.js +1 -0
  18. package/dist/{chunk-gate-86r8a2vf.js → chunk-gate-qzephvdv.js} +1 -1
  19. package/dist/chunk-group-scene-w1ycabrm.js +1 -0
  20. package/dist/chunk-group-table-9nvmja8w.js +1 -0
  21. package/dist/chunk-host-icons-fccg3b2d.js +1 -0
  22. package/dist/chunk-host-picture-jaqz127q.js +1 -0
  23. package/dist/chunk-host-state-r01v1ywg.js +1 -0
  24. package/dist/chunk-host-ui-n54mh5af.js +1 -0
  25. package/dist/chunk-index-0a81da8z.js +2 -0
  26. package/dist/{chunk-index-67p2sc14.js → chunk-index-0ye10vk3.js} +3 -3
  27. package/dist/chunk-index-1kwp3spy.js +2 -0
  28. package/dist/{chunk-index-eh0wb6g0.js → chunk-index-3d8s3565.js} +2 -2
  29. package/dist/{chunk-index-raf772z6.js → chunk-index-3pnvpppa.js} +2 -2
  30. package/dist/chunk-index-47vq85ye.js +2 -0
  31. package/dist/{chunk-index-84wbc80d.js → chunk-index-4z4chg7v.js} +2 -2
  32. package/dist/chunk-index-5zmswz4s.js +2 -0
  33. package/dist/chunk-index-64rsz6pf.js +2 -0
  34. package/dist/chunk-index-6vcs0h0m.js +2 -0
  35. package/dist/chunk-index-6xqz6mg2.js +2 -0
  36. package/dist/chunk-index-83v0c9x6.js +2 -0
  37. package/dist/chunk-index-8xd6anam.js +2 -0
  38. package/dist/{chunk-index-jq970hsd.js → chunk-index-983dmeaa.js} +3 -3
  39. package/dist/{chunk-index-gt42wjby.js → chunk-index-9z13jw6q.js} +3 -3
  40. package/dist/{chunk-index-30vw4nhh.js → chunk-index-af4ebmkr.js} +3 -3
  41. package/dist/{chunk-index-47yspxa4.js → chunk-index-afrhnrxj.js} +1 -1
  42. package/dist/{chunk-index-hc0dgmrs.js → chunk-index-ak6ecqy3.js} +2 -2
  43. package/dist/{chunk-index-eyc2rkq5.js → chunk-index-b73y2gc0.js} +2 -2
  44. package/dist/{chunk-index-hczrjnky.js → chunk-index-ben4gv45.js} +1 -1
  45. package/dist/{chunk-index-3aa5czxj.js → chunk-index-bhqczxr3.js} +2 -2
  46. package/dist/chunk-index-c44p8q87.js +2 -0
  47. package/dist/{chunk-index-6c8mewwy.js → chunk-index-cbqhzf40.js} +12 -12
  48. package/dist/chunk-index-db8zh8e6.js +2 -0
  49. package/dist/chunk-index-dvfkb699.js +2 -0
  50. package/dist/chunk-index-e02ddp46.js +1 -0
  51. package/dist/{chunk-index-tsxsy4qs.js → chunk-index-ebg48jgy.js} +2 -2
  52. package/dist/{chunk-index-rcxz5w5d.js → chunk-index-ek5mek4j.js} +3 -3
  53. package/dist/chunk-index-em7vndrb.js +2 -0
  54. package/dist/{chunk-index-e90kztkx.js → chunk-index-eq161yvp.js} +3 -3
  55. package/dist/chunk-index-f500nw4w.js +2 -0
  56. package/dist/{chunk-index-1fn8q4ps.js → chunk-index-f5x2srr0.js} +2 -2
  57. package/dist/chunk-index-fg42egv9.js +50 -0
  58. package/dist/chunk-index-h3v1d3nt.js +2 -0
  59. package/dist/chunk-index-j4x9dq30.css +1 -0
  60. package/dist/{chunk-index-agrvqf5b.js → chunk-index-j7pgphx3.js} +2 -2
  61. package/dist/{chunk-index-r1v895tj.js → chunk-index-k0z507h3.js} +2 -2
  62. package/dist/chunk-index-kbgykazq.js +2 -0
  63. package/dist/{chunk-index-8eexybcx.js → chunk-index-n05yw5wd.js} +2 -2
  64. package/dist/chunk-index-n8ghdvxb.js +2 -0
  65. package/dist/chunk-index-nsvwbjfe.js +2 -0
  66. package/dist/{chunk-index-3wbyq10m.js → chunk-index-p5jcwjx8.js} +1 -1
  67. package/dist/chunk-index-qfgkfq86.js +2 -0
  68. package/dist/chunk-index-rcwdqn50.js +7 -0
  69. package/dist/chunk-index-s72hmse6.js +2 -0
  70. package/dist/{chunk-index-m65cv329.js → chunk-index-sm7m4fej.js} +2 -2
  71. package/dist/chunk-index-sv9qpmhv.js +1 -0
  72. package/dist/chunk-index-w42rcbx1.js +2 -0
  73. package/dist/chunk-index-x4enmj72.js +2 -0
  74. package/dist/chunk-index-xevnf9ew.js +2 -0
  75. package/dist/chunk-index-xx8jq73q.js +2 -0
  76. package/dist/chunk-index-y60x5jbh.js +1 -0
  77. package/dist/chunk-index-ypkgw7gq.js +2 -0
  78. package/dist/chunk-index-yrmqcay4.js +2 -0
  79. package/dist/chunk-lang-css-y9133ktr.js +1 -0
  80. package/dist/{chunk-lang-dockerfile-tjxsnhr9.js → chunk-lang-dockerfile-cnwqn660.js} +1 -1
  81. package/dist/{chunk-lang-go-drmfa25k.js → chunk-lang-go-yy6kgsxv.js} +2 -2
  82. package/dist/chunk-lang-html-r2xmryek.js +1 -0
  83. package/dist/chunk-lang-javascript-1r6wd177.js +1 -0
  84. package/dist/{chunk-lang-json-790swysy.js → chunk-lang-json-dx56g11y.js} +1 -1
  85. package/dist/{chunk-lang-markdown-483dkxcq.js → chunk-lang-markdown-fpcf2dfq.js} +5 -5
  86. package/dist/{chunk-lang-python-v9s40bzj.js → chunk-lang-python-zzp95955.js} +2 -2
  87. package/dist/{chunk-lang-rust-z4gry1bf.js → chunk-lang-rust-214fh7sp.js} +1 -1
  88. package/dist/{chunk-lang-shell-egsvk8rj.js → chunk-lang-shell-1rpgtepw.js} +1 -1
  89. package/dist/{chunk-lang-sql-75j3denr.js → chunk-lang-sql-vvp46hpj.js} +2 -2
  90. package/dist/{chunk-lang-toml-7dbjvhex.js → chunk-lang-toml-tbj7467c.js} +1 -1
  91. package/dist/chunk-lang-typescript-y5w4tt4g.js +1 -0
  92. package/dist/{chunk-lang-xml-jg1sv4h2.js → chunk-lang-xml-tbcqmedk.js} +1 -1
  93. package/dist/{chunk-lang-yaml-g3v7s5je.js → chunk-lang-yaml-jh56t3sv.js} +1 -1
  94. package/dist/chunk-layout-actions-8dzvysym.js +1 -0
  95. package/dist/chunk-menu-items-3jhya205.js +2 -0
  96. package/dist/chunk-mode-toggle-js49gvpd.js +1 -0
  97. package/dist/chunk-note-row-kv061030.js +75 -0
  98. package/dist/chunk-notes-sdkqz5hr.js +1 -0
  99. package/dist/{chunk-notice-bell-jehad6sx.js → chunk-notice-bell-r012f2zy.js} +1 -1
  100. package/dist/{chunk-notices-prqkv7ge.js → chunk-notices-h4rk1zxc.js} +1 -1
  101. package/dist/chunk-onboarding-a18cvkph.js +1 -0
  102. package/dist/{chunk-overview-2j1s6kqg.js → chunk-overview-ynaqn4fp.js} +1 -1
  103. package/dist/{chunk-palette-4qt6ewem.js → chunk-palette-jm79gb5q.js} +1 -1
  104. package/dist/chunk-placement-items-mwm9q1zn.js +1 -0
  105. package/dist/{chunk-profile-pfzyc04p.js → chunk-profile-ajw6pp4r.js} +1 -1
  106. package/dist/{chunk-prompt-history-2bcp2rky.js → chunk-prompt-history-zcfvr3r8.js} +1 -1
  107. package/dist/chunk-prompts-m5rzdk24.js +1 -0
  108. package/dist/chunk-room-confirms-ftsj15ja.js +1 -0
  109. package/dist/chunk-room-menu-b9ktw9pw.js +1 -0
  110. package/dist/chunk-rooms-menu-button-qe62t6nx.js +1 -0
  111. package/dist/{chunk-schedules-64h9gfwn.js → chunk-schedules-t8yxnf8q.js} +1 -1
  112. package/dist/{chunk-seat-menu-vrpc40v9.js → chunk-seat-menu-kwtjnpjj.js} +1 -1
  113. package/dist/chunk-sheet-hosts-yj5wszgj.js +1 -0
  114. package/dist/{chunk-shortcut-help-bdbkdcs9.js → chunk-shortcut-help-g5cpqjjj.js} +2 -2
  115. package/dist/{chunk-shortcuts-qft33r8t.js → chunk-shortcuts-9ft5sqdw.js} +1 -1
  116. package/dist/chunk-skill-editor-xdfq2708.js +8 -0
  117. package/dist/chunk-skills-9wa4mwdc.js +1 -0
  118. package/dist/chunk-switcher-list-vpg6wvtw.js +1 -0
  119. package/dist/{chunk-tab-dot-1p68ybf8.js → chunk-tab-dot-yse6wcfp.js} +1 -1
  120. package/dist/chunk-table-1y76m54h.js +1 -0
  121. package/dist/chunk-table2d-g57vr6h0.js +1 -0
  122. package/dist/chunk-table3d-cv6069hy.js +4220 -0
  123. package/dist/chunk-thread-actions-xjhpdjk7.js +1 -0
  124. package/dist/{chunk-thread-cards-t794fp4d.js → chunk-thread-cards-36rckyg7.js} +1 -1
  125. package/dist/chunk-thread-list-fd6agz77.js +217 -0
  126. package/dist/{chunk-transcript-km4e3aey.js → chunk-transcript-5nfn3r35.js} +1 -1
  127. package/dist/chunk-where-ha8pc3cg.js +1 -0
  128. package/dist/{chunk-workspace-d064v56e.js → chunk-workspace-e85twv32.js} +2 -2
  129. package/dist/chunk-zh-tw-z5p5mpph.js +1 -0
  130. package/dist/index.html +1 -1
  131. package/dist/sw.js +1 -1
  132. package/package.json +3 -3
  133. package/src/api-types.ts +51 -0
  134. package/src/app/app.ts +38 -4
  135. package/src/app/helper-routes.ts +106 -0
  136. package/src/app/rooms.ts +18 -3
  137. package/src/app/routes.ts +20 -0
  138. package/src/app/surface.ts +18 -1
  139. package/src/app/team-routes.ts +21 -1
  140. package/src/i18n/zh-tw.ts +46 -9
  141. package/dist/chunk-account-hck7mhf8.js +0 -1
  142. package/dist/chunk-action-menu-beqh40k6.js +0 -1
  143. package/dist/chunk-agent-znnth24t.js +0 -1
  144. package/dist/chunk-arranged-rooms-wfakrddk.js +0 -1
  145. package/dist/chunk-bulk-actions-c4tkvk9g.js +0 -1
  146. package/dist/chunk-character-creator-qwcsdytw.js +0 -1
  147. package/dist/chunk-confirm-z95j9jt3.js +0 -1
  148. package/dist/chunk-entry-hrt97qed.js +0 -1
  149. package/dist/chunk-folder-list-nemtqbnc.js +0 -1
  150. package/dist/chunk-folds-xpg9qcwf.js +0 -1
  151. package/dist/chunk-group-scene-g24kxz6f.js +0 -1
  152. package/dist/chunk-group-table-851jm8ef.js +0 -1
  153. package/dist/chunk-host-icons-23zhqpmc.js +0 -1
  154. package/dist/chunk-host-picture-8tnh2wam.js +0 -1
  155. package/dist/chunk-host-state-j41sp065.js +0 -1
  156. package/dist/chunk-host-ui-cje7a9t9.js +0 -1
  157. package/dist/chunk-index-3k7sdph2.js +0 -1
  158. package/dist/chunk-index-4jf4jvfd.css +0 -1
  159. package/dist/chunk-index-4s1qj9we.js +0 -2
  160. package/dist/chunk-index-5fz5e1ct.js +0 -2
  161. package/dist/chunk-index-azrnzgev.js +0 -2
  162. package/dist/chunk-index-c2ag3qw2.js +0 -2
  163. package/dist/chunk-index-efgm0066.js +0 -2
  164. package/dist/chunk-index-fe0m5mht.js +0 -2
  165. package/dist/chunk-index-hrtyanda.js +0 -2
  166. package/dist/chunk-index-j479p62w.js +0 -2
  167. package/dist/chunk-index-kankja6p.js +0 -50
  168. package/dist/chunk-index-kb44jp50.js +0 -2
  169. package/dist/chunk-index-mnwdbb4n.js +0 -2
  170. package/dist/chunk-index-n6zrc05a.js +0 -2
  171. package/dist/chunk-index-n93wqszt.js +0 -8
  172. package/dist/chunk-index-nrexxkar.js +0 -2
  173. package/dist/chunk-index-pgxgq61x.js +0 -2
  174. package/dist/chunk-index-q5vzjqr5.js +0 -2
  175. package/dist/chunk-index-qqwk157d.js +0 -2
  176. package/dist/chunk-index-r3tqhew8.js +0 -2
  177. package/dist/chunk-index-rg9vh59e.js +0 -1
  178. package/dist/chunk-index-sxq69p1f.js +0 -2
  179. package/dist/chunk-index-taq2psr6.js +0 -2
  180. package/dist/chunk-index-wc83vb0a.js +0 -2
  181. package/dist/chunk-index-xbs8q4kn.js +0 -2
  182. package/dist/chunk-index-xxbveevc.js +0 -2
  183. package/dist/chunk-index-zx6yka30.js +0 -2
  184. package/dist/chunk-lang-css-yrc25qk9.js +0 -1
  185. package/dist/chunk-lang-html-rwe8epvf.js +0 -1
  186. package/dist/chunk-lang-javascript-d6x6qjtg.js +0 -1
  187. package/dist/chunk-lang-typescript-1rv9vdcz.js +0 -1
  188. package/dist/chunk-layout-actions-6assr93n.js +0 -1
  189. package/dist/chunk-menu-items-9szcza00.js +0 -2
  190. package/dist/chunk-mode-toggle-bzbq7ycq.js +0 -1
  191. package/dist/chunk-note-row-g20h11pm.js +0 -75
  192. package/dist/chunk-notes-gc8bssxn.js +0 -1
  193. package/dist/chunk-onboarding-mdtc2mb7.js +0 -1
  194. package/dist/chunk-placement-items-2eect825.js +0 -1
  195. package/dist/chunk-prompts-052mb05y.js +0 -1
  196. package/dist/chunk-room-confirms-asvmjh5s.js +0 -1
  197. package/dist/chunk-room-menu-dm2r2hk6.js +0 -1
  198. package/dist/chunk-rooms-menu-button-32hemzxc.js +0 -1
  199. package/dist/chunk-sheet-hosts-jaqx490x.js +0 -1
  200. package/dist/chunk-skill-editor-z3dx2895.js +0 -8
  201. package/dist/chunk-skills-4jfcv39n.js +0 -1
  202. package/dist/chunk-switcher-list-xysjd4tw.js +0 -1
  203. package/dist/chunk-table-0v4q4dx3.js +0 -1
  204. package/dist/chunk-table-seats-f683hx8k.js +0 -1
  205. package/dist/chunk-table2d-1a6atjhj.js +0 -1
  206. package/dist/chunk-table3d-k0ffeffj.js +0 -4220
  207. package/dist/chunk-thread-actions-4rpfg4fq.js +0 -1
  208. package/dist/chunk-thread-list-1pcygpka.js +0 -1
  209. package/dist/chunk-where-phjwqggy.js +0 -1
  210. package/dist/chunk-zh-tw-qf18hcxc.js +0 -1
@@ -0,0 +1,2 @@
1
+ import{s,N,M,r,t,m,e,n,D,d,f,g,Xe}from"./chunk-index-fg42egv9.js";import"./chunk-index-64rsz6pf.js";import"./chunk-index-4z4chg7v.js";import"./chunk-index-n8ghdvxb.js";import"./chunk-index-3pnvpppa.js";import{ti}from"./chunk-index-rcwdqn50.js";import{Ut}from"./chunk-index-f500nw4w.js";import{L}from"./chunk-index-afrhnrxj.js";import{Kt,Dn,qr,xi,ns,is,rs,os,ss}from"./chunk-index-dvfkb699.js";import{ee,Te}from"./chunk-index-5zmswz4s.js";function Q(i){let{view:a}=i;return e("li",{children:n("button",{type:"button",className:"menu-item council-row","aria-current":i.current||void 0,onClick:i.onPick,children:[e(Xe,{view:a,size:40}),n("span",{className:"menu-text",children:[e("strong",{children:a.displayName}),e("span",{className:"meta",children:t("{count} knights",{count:a.members?.length??0})})]})]})})}function W(i){let{council:a}=i,w=xi(),u=ti(),[v,A]=r([]),[y,O]=r(),[H,S]=r(""),[G,I]=r(!1),[P,j]=r(""),[p,C]=r(!1),[z,x]=r(),E=N(),R=a?.name,T=a?.members?.join(`
2
+ `);s(()=>{if(!i.open)return;if(x(void 0),I(a===void 0),j(""),C(!1),O(void 0),S(""),A(a?[...a.members??[]]:ns(u)),!R)return;let o=!0;return ee.group(R).then((l)=>{if(!o)return;O(l),S(l.host)},()=>{return}),()=>{o=!1}},[i.open,R,T]);let U=M(()=>new Set(u.map((o)=>o.name)),[u]),_=u.find((o)=>o.home)?.name,c=rs(v,(o)=>U.has(o)),b=os(c,H||void 0,_),X=(o)=>u.find((l)=>l.name===o)?.displayName??o,F=c.length>=Kt,k=c.length>=Dn,q=a===void 0||c.join(",")!==(a.members??[]).join(",")||y!==void 0&&b!==y.host,B=async(o)=>{C(!0),x(void 0);try{await o(),await Te()}catch(l){return x(d(l)),C(!1),!1}return C(!1),!0},J=async()=>{if(!a)return;if(!await B(async()=>{await ee.updateGroup(a.name,{...c.join(",")!==(a.members??[]).join(",")?{members:c}:{},...y&&b!==y.host?{host:b}:{}})}))return;f(t("Saved.")),i.onClose()},K=async()=>{let o=P.trim();if(o==="")return;let l=new Set([...u.map((V)=>V.name),...w.map((V)=>V.name)]),h;if(!await B(async()=>{h=await ee.createGroup({name:ss(o,l),displayName:o,members:c,host:b})})||!h)return;qr(h.room),D("table",h.name,{replace:!0}),f(t("Made {name}.",{name:h.displayName})),i.onClose()};return n("div",{className:"stack council-sheet",children:[w.length>0?n("section",{className:"stack","aria-label":t("Councils"),children:[e("h3",{children:t("Councils")}),e("ul",{className:"menu",children:w.map((o)=>e(Q,{view:o,current:o.key===a?.key,onPick:()=>{qr(o.key),D("table",o.name,{replace:!0}),i.onClose()}},o.key))})]}):null,n("fieldset",{className:"field council-pick",children:[e("legend",{children:a?t("Edit this council"):t("Pick who sits")}),n("span",{className:"meta council-count","aria-live":"polite",children:[t("{count} of {max} picked",{count:c.length,max:Kt}),F?` · ${t("At most {max} knights",{max:Kt})}`:""]}),e("ul",{className:"menu",children:u.map((o)=>{let l=v.includes(o.name);return e("li",{children:n("label",{className:"menu-item menu-toggle seat-row",children:[e("input",{type:"checkbox",checked:l,disabled:!l&&F,onChange:()=>A(is(v,o.name,Kt))}),e(Xe,{view:o,size:32}),e("span",{className:"menu-text",children:e("strong",{children:o.displayName})})]})},o.key)})})]}),k?e(Ut,{label:t("Host"),value:b,onChange:S,options:c.map((o)=>({value:o,label:X(o)}))}):e("span",{className:"meta",children:t("A council needs at least {min} knights.",{min:Dn})}),G?n("label",{htmlFor:E,children:[t("Council name"),e("input",{id:E,value:P,autoComplete:"off",onChange:(o)=>j(o.target.value)})]}):null,z?e(g,{message:z}):null,e("div",{className:"actions",children:a&&!G?n(m,{children:[e("button",{type:"button",className:"secondary",disabled:!k||p,onClick:()=>I(!0),children:t("Save as a new council")}),e("button",{type:"button",disabled:!k||!q||p,onClick:J,children:p?t("Saving…"):t("Done")})]}):e("button",{type:"button",disabled:!k||P.trim()===""||p,onClick:K,children:p?t("Saving…"):a?t("Save as a new council"):t("Make council")})})]})}function de(i){return e(L,{open:i.open,title:t("Council"),onClose:i.onClose,size:"default",children:e(W,{open:i.open,council:i.council,onClose:i.onClose})})}export{de as CouncilSheet};
@@ -1 +1 @@
1
- import{xr}from"./chunk-index-kankja6p.js";import{cr}from"./chunk-index-azrnzgev.js";import{Ho,Ko,Lr,Xr,Jo,es}from"./chunk-index-4s1qj9we.js";var ne=xr,re=(a)=>{for(let n=a;n;n=n.parentElement){let{overflowY:l}=getComputedStyle(n);if((l==="auto"||l==="scroll")&&n.scrollHeight>n.clientHeight)return n}return document.scrollingElement??document.documentElement};function se(a){let{item:n,root:l,key:u,mode:C}=a,c=re(l),O=c===document.scrollingElement||c===document.documentElement,k=()=>O?0:c.getBoundingClientRect().top,X=()=>O?window.innerHeight:c.clientHeight,x=(e)=>e-k()+c.scrollTop,p=(e)=>{let t=e.getBoundingClientRect();return{top:x(t.top),height:t.height}},y=document.createElement("div");y.className="drop-line",y.setAttribute("aria-hidden","true");let z=[],P=[],g=[],h=[],R=[],B={top:0,bottom:0},D=()=>{let e=[...l.querySelectorAll("[data-drop-item], [data-folder-block]")].map((t)=>[t,t.style.transform]);for(let[t]of e)t.style.removeProperty("transform");try{j()}finally{for(let[t,r]of e)if(r)t.style.transform=r}},j=()=>{if(C==="room"){P=[...l.querySelectorAll("[data-drop-zone]")],z=P.map((t)=>{let{top:r,height:H}=p(t);return{id:t.dataset.zoneId??"",kind:t.dataset.dropZone,...t.dataset.folder?{folder:t.dataset.folder}:{},top:r,bottom:r+H,items:t.dataset.collapsed===void 0?[...t.querySelectorAll("[data-drop-item]")].map((o)=>({key:o.dataset.key??"",...p(o)})):[]}});return}g=[...l.querySelectorAll(":scope > [data-folder-block]")],h=g.map((t)=>({key:t.dataset.key??"",...p(t)})),R=g.map((t)=>({key:t.dataset.key??"",...p(t.querySelector("[data-folder-head]")??t)}));let e=p(l);B={top:e.top,bottom:e.top+e.height}};cr(!0);let G=n.getBoundingClientRect().top;n.setAttribute("data-lifted",""),l.setAttribute("data-reordering","");let F=n.getBoundingClientRect().top-G;if(F)c.scrollTop+=F;D();let J=x(a.y),I={x:0,y:a.y},Z=!1,f=0,w,d,q={type:"cancel"};try{n.setPointerCapture(a.pointerId)}catch{}let _=()=>{f=0;let e=x(I.y),t=e-J;if(Math.abs(t)>ne)Z=!0;n.style.transform=`translate3d(0, ${t}px, 0)`;let r;if(C==="room"){let o=Ho(z,u,e);q=o?{type:"room",drop:o}:{type:"cancel"};let M=o?z.indexOf(o.zone):-1;r=P[M];let E=r?.contains(n)??!1,s=o?o.zone.items:[],m=E?[...r.querySelectorAll("[data-drop-item]")]:[],v=s.findIndex((i)=>i.key===u),W=o?Xr(s.map((i)=>i.key),u,o.before):0,ee=s.length>1?Math.max(0,(s[1]?.top??0)-(s[0]?.top??0)-(s[0]?.height??0)):0,U=E&&v>=0?Lr(s,v,W,ee):[];for(let i of document.querySelectorAll("[data-drop-item]:not([data-lifted])"))i.style.removeProperty("transform");if(m.forEach((i,A)=>{if(U[A])i.style.transform=`translate3d(0, ${U[A]}px, 0)`}),r&&o&&!E){let i=o.before===null?void 0:o.zone.items.find((oe)=>oe.key===o.before),A=p(r).top,te=i?i.top-A:o.zone.items.length?p(r).height:0;y.style.top=`${te}px`,r.append(y)}else y.remove();if(o?.zone.kind==="folder"&&o.zone.items.length===0&&r?.dataset.collapsed!==void 0){if(d?.zone!==o.zone.id){if(d)clearTimeout(d.timer);let i=o.zone.folder??"";d={zone:o.zone.id,timer:setTimeout(()=>{a.open(i),requestAnimationFrame(()=>requestAnimationFrame(()=>{D(),L()}))},es)}}}else if(d)clearTimeout(d.timer),d=void 0}else{let o=Ko(R,B,u,e);q=o?{type:"folder",before:o.before}:{type:"cancel"};let M=h.findIndex((m)=>m.key===u),E=o?Xr(h.map((m)=>m.key),u,o.before):M,s=Lr(h,M,E,12);g.forEach((m,v)=>{if(m!==n)m.style.transform=s[v]?`translate3d(0, ${s[v]}px, 0)`:""})}if(r!==w)w?.removeAttribute("data-drop-target"),r?.setAttribute("data-drop-target",""),w=r;let H=Jo(I.y,k(),k()+X());if(H)c.scrollTop+=H,L()},L=()=>{if(!f)f=requestAnimationFrame(_)},b=(e)=>{Q(),a.done(e)},S=(e)=>e.pointerId===a.pointerId,K=(e)=>{if(!S(e))return;e.stopPropagation(),e.preventDefault(),I={x:e.clientX,y:e.clientY},L()},N=(e)=>{if(!S(e))return;if(e.stopPropagation(),f)cancelAnimationFrame(f),_();b(Z?q:{type:"tap"})},V=(e)=>{if(S(e))b({type:"cancel"})},Y=(e)=>{if(e.key!=="Escape")return;e.preventDefault(),e.stopPropagation(),b({type:"cancel"})},T=(e)=>e.preventDefault();function Q(){if(cr(!1),window.removeEventListener("pointermove",K,!0),window.removeEventListener("pointerup",N,!0),window.removeEventListener("pointercancel",V,!0),window.removeEventListener("keydown",Y,!0),window.removeEventListener("touchmove",T,!0),window.removeEventListener("contextmenu",T,!0),f)cancelAnimationFrame(f);if(d)clearTimeout(d.timer);w?.removeAttribute("data-drop-target"),y.remove(),n.removeAttribute("data-lifted"),n.style.removeProperty("transform"),l.removeAttribute("data-reordering");for(let e of l.querySelectorAll("[data-drop-item], [data-folder-block]"))e.style.removeProperty("transform");try{n.releasePointerCapture(a.pointerId)}catch{}}return window.addEventListener("pointermove",K,!0),window.addEventListener("pointerup",N,!0),window.addEventListener("pointercancel",V,!0),window.addEventListener("keydown",Y,!0),window.addEventListener("touchmove",T,{capture:!0,passive:!1}),window.addEventListener("contextmenu",T,!0),L(),()=>b({type:"cancel"})}export{se as lift};
1
+ import{Tr}from"./chunk-index-fg42egv9.js";import{Or}from"./chunk-index-83v0c9x6.js";import{Yo,jo,Ur,Vr,Ko,Jo}from"./chunk-index-qfgkfq86.js";var ne=Tr,re=(a)=>{for(let n=a;n;n=n.parentElement){let{overflowY:l}=getComputedStyle(n);if((l==="auto"||l==="scroll")&&n.scrollHeight>n.clientHeight)return n}return document.scrollingElement??document.documentElement};function se(a){let{item:n,root:l,key:u,mode:C}=a,c=re(l),O=c===document.scrollingElement||c===document.documentElement,k=()=>O?0:c.getBoundingClientRect().top,X=()=>O?window.innerHeight:c.clientHeight,x=(e)=>e-k()+c.scrollTop,p=(e)=>{let t=e.getBoundingClientRect();return{top:x(t.top),height:t.height}},y=document.createElement("div");y.className="drop-line",y.setAttribute("aria-hidden","true");let z=[],P=[],g=[],h=[],R=[],B={top:0,bottom:0},D=()=>{let e=[...l.querySelectorAll("[data-drop-item], [data-folder-block]")].map((t)=>[t,t.style.transform]);for(let[t]of e)t.style.removeProperty("transform");try{j()}finally{for(let[t,r]of e)if(r)t.style.transform=r}},j=()=>{if(C==="room"){P=[...l.querySelectorAll("[data-drop-zone]")],z=P.map((t)=>{let{top:r,height:H}=p(t);return{id:t.dataset.zoneId??"",kind:t.dataset.dropZone,...t.dataset.folder?{folder:t.dataset.folder}:{},top:r,bottom:r+H,items:t.dataset.collapsed===void 0?[...t.querySelectorAll("[data-drop-item]")].map((o)=>({key:o.dataset.key??"",...p(o)})):[]}});return}g=[...l.querySelectorAll(":scope > [data-folder-block]")],h=g.map((t)=>({key:t.dataset.key??"",...p(t)})),R=g.map((t)=>({key:t.dataset.key??"",...p(t.querySelector("[data-folder-head]")??t)}));let e=p(l);B={top:e.top,bottom:e.top+e.height}};Or(!0);let G=n.getBoundingClientRect().top;n.setAttribute("data-lifted",""),l.setAttribute("data-reordering","");let F=n.getBoundingClientRect().top-G;if(F)c.scrollTop+=F;D();let J=x(a.y),I={x:0,y:a.y},Z=!1,f=0,w,d,q={type:"cancel"};try{n.setPointerCapture(a.pointerId)}catch{}let _=()=>{f=0;let e=x(I.y),t=e-J;if(Math.abs(t)>ne)Z=!0;n.style.transform=`translate3d(0, ${t}px, 0)`;let r;if(C==="room"){let o=Yo(z,u,e);q=o?{type:"room",drop:o}:{type:"cancel"};let M=o?z.indexOf(o.zone):-1;r=P[M];let E=r?.contains(n)??!1,s=o?o.zone.items:[],m=E?[...r.querySelectorAll("[data-drop-item]")]:[],v=s.findIndex((i)=>i.key===u),W=o?Vr(s.map((i)=>i.key),u,o.before):0,ee=s.length>1?Math.max(0,(s[1]?.top??0)-(s[0]?.top??0)-(s[0]?.height??0)):0,U=E&&v>=0?Ur(s,v,W,ee):[];for(let i of document.querySelectorAll("[data-drop-item]:not([data-lifted])"))i.style.removeProperty("transform");if(m.forEach((i,A)=>{if(U[A])i.style.transform=`translate3d(0, ${U[A]}px, 0)`}),r&&o&&!E){let i=o.before===null?void 0:o.zone.items.find((oe)=>oe.key===o.before),A=p(r).top,te=i?i.top-A:o.zone.items.length?p(r).height:0;y.style.top=`${te}px`,r.append(y)}else y.remove();if(o?.zone.kind==="folder"&&o.zone.items.length===0&&r?.dataset.collapsed!==void 0){if(d?.zone!==o.zone.id){if(d)clearTimeout(d.timer);let i=o.zone.folder??"";d={zone:o.zone.id,timer:setTimeout(()=>{a.open(i),requestAnimationFrame(()=>requestAnimationFrame(()=>{D(),L()}))},Jo)}}}else if(d)clearTimeout(d.timer),d=void 0}else{let o=jo(R,B,u,e);q=o?{type:"folder",before:o.before}:{type:"cancel"};let M=h.findIndex((m)=>m.key===u),E=o?Vr(h.map((m)=>m.key),u,o.before):M,s=Ur(h,M,E,12);g.forEach((m,v)=>{if(m!==n)m.style.transform=s[v]?`translate3d(0, ${s[v]}px, 0)`:""})}if(r!==w)w?.removeAttribute("data-drop-target"),r?.setAttribute("data-drop-target",""),w=r;let H=Ko(I.y,k(),k()+X());if(H)c.scrollTop+=H,L()},L=()=>{if(!f)f=requestAnimationFrame(_)},b=(e)=>{Q(),a.done(e)},S=(e)=>e.pointerId===a.pointerId,K=(e)=>{if(!S(e))return;e.stopPropagation(),e.preventDefault(),I={x:e.clientX,y:e.clientY},L()},N=(e)=>{if(!S(e))return;if(e.stopPropagation(),f)cancelAnimationFrame(f),_();b(Z?q:{type:"tap"})},V=(e)=>{if(S(e))b({type:"cancel"})},Y=(e)=>{if(e.key!=="Escape")return;e.preventDefault(),e.stopPropagation(),b({type:"cancel"})},T=(e)=>e.preventDefault();function Q(){if(Or(!1),window.removeEventListener("pointermove",K,!0),window.removeEventListener("pointerup",N,!0),window.removeEventListener("pointercancel",V,!0),window.removeEventListener("keydown",Y,!0),window.removeEventListener("touchmove",T,!0),window.removeEventListener("contextmenu",T,!0),f)cancelAnimationFrame(f);if(d)clearTimeout(d.timer);w?.removeAttribute("data-drop-target"),y.remove(),n.removeAttribute("data-lifted"),n.style.removeProperty("transform"),l.removeAttribute("data-reordering");for(let e of l.querySelectorAll("[data-drop-item], [data-folder-block]"))e.style.removeProperty("transform");try{n.releasePointerCapture(a.pointerId)}catch{}}return window.addEventListener("pointermove",K,!0),window.addEventListener("pointerup",N,!0),window.addEventListener("pointercancel",V,!0),window.addEventListener("keydown",Y,!0),window.addEventListener("touchmove",T,{capture:!0,passive:!1}),window.addEventListener("contextmenu",T,!0),L(),()=>b({type:"cancel"})}export{se as lift};
@@ -0,0 +1 @@
1
+ import{Mt,Ft}from"./chunk-index-0a81da8z.js";import{h}from"./chunk-index-fg42egv9.js";function H(){try{let r=document.createElement("canvas");return!!(r.getContext("webgl2")||r.getContext("webgl"))}catch{return!1}}function x(r,n){return[r,n.includes("?")?n.slice(n.indexOf("?")):""].some((c)=>{let d=new URLSearchParams(c).get("nogl");return d!==null&&d!=="0"&&d!=="false"})}async function I(r,n,S){let c=n.variant==="compact",d=n.labels??Ft,l=new Map,E=(e)=>{l.clear();for(let t of e)l.set(t.id,{...t})};E(n.seats);let m={t:n.theme,s:n.scheme},a=null,o=document.createElement("div");o.className="rt-table",o.dataset.variant=c?"compact":"full";let f=document.createElement("div");f.className="rt-table-stage",o.appendChild(f);let i=null,y=!1,A=()=>!c&&(Boolean(n.listBelow)||y);r.appendChild(o);let u=new Map,g=()=>{if(!A()){i?.remove(),i=null,u.clear(),delete o.dataset.list;return}if(!i)i=document.createElement("ul"),i.className="rt-table-list",i.setAttribute("aria-label",d.table),o.appendChild(i),o.dataset.list="";for(let e of[...u.keys()])if(!l.has(e))u.delete(e);for(let e of l.values()){let t=u.get(e.id);if(!t){t=document.createElement("button"),t.type="button",t.dataset.seat=e.id;let s=e.id;t.addEventListener("click",(p)=>{let b=l.get(s);if(b)n.onSeatClick({id:b.id,name:b.name,at:Mt(p,p.currentTarget)})}),u.set(e.id,t)}t.textContent=d.seat(e.name,e.state??"idle"),t.style.setProperty("--seat",e.color)}i.replaceChildren(...[...l.values()].map((e)=>{let t=document.createElement("li"),s=u.get(e.id);if(s)t.appendChild(s);return t}))};g();let w=(e)=>{y=!e,g(),n.onNames?.(e)},T=async()=>{let{createTable2D:e}=await (h("g57vr6h0"),import("./chunk-table2d-g57vr6h0.js"));a=e(f,{...n,theme:m.t,scheme:m.s,seats:[...l.values()]}),w(!0)},C=async()=>{let{createTable3D:e}=await (h("cv6069hy"),import("./chunk-table3d-cv6069hy.js"));a=e(f,{...n,theme:m.t,scheme:m.s,seats:[...l.values()],onNames:w},()=>{a?.dispose(),T()})};if(c||S==="svg"||S!=="webgl"&&(x(location.search,location.hash)||!H()))await T();else try{await C()}catch{await T()}let M,L=n.onSeatMenu;if(L&&!c){let{attachSeatMenu:e}=await (h("kwtjnpjj"),import("./chunk-seat-menu-kwtjnpjj.js"));M=e(o,(t,s,p)=>{let b=t instanceof Element?t.closest("[data-seat]")?.dataset.seat:void 0,v=l.get(b??a?.seatAt?.(s,p)??"");return v?{id:v.id,name:v.name}:void 0},L)}return{get kind(){return a.kind},setTheme(e,t){m={t:e,s:t},a.setTheme(e,t)},setSeats(e){E(e),g(),a.setSeats(e)},setState(e,t){let s=l.get(e);if(s)s.state=t;g(),a.setState(e,t)},setMark:(e,t)=>a.setMark(e,t),setAvatar(e,t){let s=l.get(e);if(s)s.avatarSvg=t;return a.setAvatar(e,t)},setReducedMotion:(e)=>a.setReducedMotion(e),resetCamera:()=>a.resetCamera(),focus:(e,t)=>a.focus(e,t),focused:()=>a.focused(),seatAt:(e,t)=>a.seatAt?.(e,t)??null,getStats:()=>a.getStats(),dispose(){M?.(),a?.dispose(),o.remove()}}}export{I as mountRoundTable};
@@ -0,0 +1 @@
1
+ import{h,s,N,t,te,m,e,n,o,gt,u,pe,Xe,In,vn}from"./chunk-index-fg42egv9.js";import{dr,hr,pr,mr}from"./chunk-index-e02ddp46.js";import"./chunk-index-y60x5jbh.js";import{Bt}from"./chunk-index-f5x2srr0.js";import{Ti}from"./chunk-index-yrmqcay4.js";var F=()=>(h("8dzvysym"),import("./chunk-layout-actions-8dzvysym.js")),y=(a)=>(h("mwm9q1zn"),import("./chunk-placement-items-mwm9q1zn.js")).then((r)=>r.folderMenu(a)),R=(a)=>({mode:"folder",key:a,item:(r)=>r.closest("[data-folder-block]"),root:(r)=>r.closest("[data-folder-block]")?.parentElement??null,onDrop:(r)=>{if(r.type==="folder")F().then((i)=>i.placeFolderBefore(a,r.before))},open:pr});function k(a){let{id:r,name:i}=a,d=dr().has(r),l=a.holdsActive||!d,c=N(),b=Bt(()=>y(r),R(r)),v=(f)=>{y(r).then((g)=>{if(!g)return;let p=f.getBoundingClientRect();pe({...g,at:{x:p.left,y:p.bottom},via:"key",source:f})},()=>{return})};return n("section",{className:"folder","aria-label":i,"data-folder-block":"","data-key":r,"data-drop-zone":"folder","data-zone-id":r,"data-folder":r,"data-collapsed":l?void 0:"",children:[n("header",{className:"folder-head","data-folder-head":"",...b,children:[n("button",{type:"button",className:"folder-toggle","aria-expanded":l,"aria-controls":c,"aria-label":l?t("Collapse {name}",{name:i}):t("Expand {name}",{name:i}),onClick:()=>hr(r),children:[e(o,{name:"chevron",size:16,className:"folder-chevron","data-open":l||void 0}),e("strong",{children:i}),e("span",{className:"meta",children:te(a.count,"{count} room","{count} rooms")}),l?null:a.stack]}),a.muted==="none"?null:e(o,{name:"bell-off",size:14,className:"muted-mark","data-partial":a.muted==="some"||void 0,role:"img","aria-hidden":!1,"aria-label":a.muted==="all"?t("Notifications are off"):t("Some notifications are off")}),l?null:a.summary,e("button",{type:"button",className:"icon-button folder-more","aria-haspopup":"menu","aria-label":t("Folder menu"),onClick:(f)=>v(f.currentTarget),children:e(o,{name:"more",size:18})})]}),e("div",{id:c,className:"folder-body",hidden:!l,children:l?a.count===0?e("p",{className:"meta folder-empty",children:t("No rooms in this folder yet.")}):a.children:null})]})}var S=4;function M(a){let r=a.rooms.slice(0,S),i=u((l)=>r.map((c)=>l.rooms[c]?.view),r.join(",")),d=a.rooms.length-r.length;return n("span",{className:"folder-stack","aria-hidden":"true",children:[i.map((l)=>l?e("span",{className:"folder-stack-item",children:e(Xe,{view:l,size:28})},l.key):null),d>0?n("span",{className:"folder-stack-more",children:["+",d]}):null]})}function w(a){let r=u((i)=>({waiting:a.rooms.reduce((d,l)=>d+gt(i,l),0),typing:a.rooms.some((d)=>i.rooms[d]?.typing)}),a.rooms.join(","));return n(m,{children:[r.typing?e(In,{}):null,r.waiting?e(vn,{count:r.waiting}):null]})}function C(a){return u((r)=>Ti(a,(i)=>r.rooms[i]?.view?.muted===!0),a.join(","))}function Q(a){let r=a.folders.map((i)=>i.id).join(",");return s(()=>{if(a.listed)mr(r?r.split(","):[])},[a.listed,r]),e(m,{children:a.folders.map((i)=>e(B,{folder:i,...a},i.id))})}function B(a){let{folder:r}=a,i=C(r.rooms);return e(k,{id:r.id,name:r.name,count:r.rooms.length,holdsActive:a.active!==void 0&&r.rooms.includes(a.active),muted:i,summary:e(w,{rooms:r.rooms}),stack:e(M,{rooms:r.rooms}),children:a.rooms(r.rooms)})}export{Q as FolderList};
@@ -0,0 +1 @@
1
+ import{dr,fr,hr,pr,mr}from"./chunk-index-e02ddp46.js";export{fr as collapsedNow,pr as expandFolder,mr as pruneCollapsed,hr as toggleCollapsed,dr as useCollapsed};
@@ -1 +1 @@
1
- import{t,e,n,o,v}from"./chunk-index-kankja6p.js";import{Pn,nn}from"./chunk-index-8eexybcx.js";function l({steps:s}){return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Finish setting up")})}),e("p",{className:"meta",children:t("These steps come first. The rest of the app opens when they are done.")}),e("ul",{className:"menu",children:s.map((a)=>e("li",{children:n("a",{className:"menu-item menu-link",href:v(a.open.page),children:[n("span",{className:"menu-text",children:[e("strong",{children:Pn(a)}),nn(a)?e("span",{className:"meta",children:nn(a)}):null]}),e(o,{name:"chevron",size:16})]})},a.id))})]})}export{l as GatePage};
1
+ import{t,e,n,o,v}from"./chunk-index-fg42egv9.js";import{En,sn}from"./chunk-index-n05yw5wd.js";function l({steps:s}){return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Finish setting up")})}),e("p",{className:"meta",children:t("These steps come first. The rest of the app opens when they are done.")}),e("ul",{className:"menu",children:s.map((a)=>e("li",{children:n("a",{className:"menu-item menu-link",href:v(a.open.page),children:[n("span",{className:"menu-text",children:[e("strong",{children:En(a)}),sn(a)?e("span",{className:"meta",children:sn(a)}):null]}),e(o,{name:"chevron",size:16})]})},a.id))})]})}export{l as GatePage};
@@ -0,0 +1 @@
1
+ import{Ei,Ci,As}from"./chunk-index-c44p8q87.js";import"./chunk-index-rcwdqn50.js";import"./chunk-index-n8ghdvxb.js";import"./chunk-index-4z4chg7v.js";import"./chunk-index-afrhnrxj.js";import"./chunk-index-64rsz6pf.js";import"./chunk-index-3pnvpppa.js";export{As as GroupScene,Ci as GroupStage,Ei as useGroupFocus};
@@ -0,0 +1 @@
1
+ import{Sr,t,m,e,n,o,u,it}from"./chunk-index-fg42egv9.js";import"./chunk-index-4z4chg7v.js";import"./chunk-index-n8ghdvxb.js";import"./chunk-index-3pnvpppa.js";import{Vt}from"./chunk-index-rcwdqn50.js";import"./chunk-index-64rsz6pf.js";var s=(a,r)=>r?Sr(a,r):a;function T(a){let r=u((i)=>i.rooms[a.roomKey]?.view),l=it();if(!r||r.kind!=="group")return null;let c=r.members??[];return n(m,{children:[n("button",{type:"button",className:"icon-button group-table-button","aria-label":t("Table"),"aria-pressed":a.scene,onClick:()=>a.onScene(!a.scene),children:[e(o,{name:"table"}),e("span",{className:"group-table-label",children:t("Table")})]}),l==="camelot"&&!a.scene?s(e("div",{className:"group-strip",children:e(Vt,{members:c,groupRoom:a.roomKey,variant:"compact"})}),a.slot):null]})}export{T as GroupTable};
@@ -0,0 +1 @@
1
+ import"./chunk-index-ben4gv45.js";
@@ -0,0 +1 @@
1
+ import{at}from"./chunk-index-af4ebmkr.js";export{at as HostPicture};
@@ -0,0 +1 @@
1
+ import{Hr,Ae,jr,Kr,Jr,eo,to,nn,nr,no,zs}from"./chunk-index-3pnvpppa.js";export{no as keepCards,nr as keepReads,to as noCards,eo as noReads,zs as onFrame,nn as seedUnread,Hr as subscribeHost,Kr as totalUnread,Jr as unreadCounts,jr as unreadOf,Ae as useHost};
@@ -0,0 +1 @@
1
+ import{J,X,s,N,Qe,M,a,r,t,te,m,e,n,o,v,hi,y,u,ce,d,f,w,g,_,P,Gt,$n,Rt,k,kr,_e,Zt,Vi,hn,pn,Ct,ne,bn,He,Pr,Ee}from"./chunk-index-fg42egv9.js";import{Rn}from"./chunk-index-4z4chg7v.js";import{Ni,To,Be,Li}from"./chunk-index-n8ghdvxb.js";import{K}from"./chunk-index-p5jcwjx8.js";import{Ae,eo,to,nn,nr,no}from"./chunk-index-3pnvpppa.js";import{st,at}from"./chunk-index-af4ebmkr.js";import{ur}from"./chunk-index-0ye10vk3.js";import"./chunk-index-ben4gv45.js";import{qe}from"./chunk-index-983dmeaa.js";import{he}from"./chunk-index-s72hmse6.js";import"./chunk-index-afrhnrxj.js";function Je(l){let i={};for(let c of l)if(c.type==="multiselect")i[c.name]=[...xe(c.initial)];else i[c.name]=xe(c.initial)[0]??"";return i}var xe=(l)=>l===void 0?[]:typeof l==="string"?[l]:[...l];function je(l,i){let c={};for(let p of l){let H=i[p.name];if(H===void 0||H===""||H.length===0)continue;c[p.name]=H}return c}function Ke(l){let{field:i,value:c}=l,[p,H]=r(""),A=i.search?i.options.filter((h)=>h.label.toLowerCase().includes(p.trim().toLowerCase())):i.options,E=i.search?e("input",{type:"search",value:p,placeholder:t("Search…"),"aria-label":t("Search {name}",{name:i.label}),onChange:(h)=>H(h.target.value)}):null;if(i.type==="select")return n(m,{children:[E,n(qe,{id:l.id,value:String(c),required:i.required===!0,"aria-describedby":l.described,...i.search?{size:6}:{},onChange:(h)=>l.onChange(h.target.value),children:[i.required?null:e("option",{value:"",children:t("None")}),A.map((h)=>e("option",{value:h.value,children:h.label},h.value))]})]});let b=new Set(Array.isArray(c)?c:[]);return n(m,{children:[E,e("fieldset",{"aria-describedby":l.described,children:A.map((h)=>n("label",{children:[e("input",{type:"checkbox",checked:b.has(h.value),onChange:(C)=>{let R=new Set(b);if(C.target.checked)R.add(h.value);else R.delete(h.value);l.onChange(i.options.filter((I)=>R.has(I.value)).map((I)=>I.value))}}),h.label]},h.value))})]})}function et(l){let{field:i,value:c}=l,p=N(),H="hint"in i?i.hint:void 0,A=l.error||H?`${p}-note`:void 0,E;if("options"in i)E=e(Ke,{field:i,id:p,value:c,described:A,onChange:l.onChange});else if(i.type==="textarea")E=e("textarea",{id:p,rows:5,value:String(c),maxLength:i.max??8000,required:i.required===!0,"aria-describedby":A,onChange:(b)=>l.onChange(b.target.value)});else E=e("input",{id:p,type:i.type==="url"?"url":"text",value:String(c),maxLength:i.max??500,required:i.required===!0,"aria-describedby":A,onChange:(b)=>l.onChange(b.target.value)});return n("div",{className:"host-field",children:[i.type==="multiselect"?e("span",{className:"field-label",children:i.label}):e("label",{htmlFor:p,children:i.label}),E,l.error||H?e("span",{id:`${p}-note`,className:l.error?"field-error":"hint",role:l.error?"alert":void 0,children:l.error??H}):null]})}function ue(l){let{spec:i}=l,[c,p]=r(()=>Je(i.fields)),[H,A]=r(!1),[E,b]=r();return n("form",{className:"host-form",onSubmit:async(C)=>{if(C.preventDefault(),H)return;A(!0),b(void 0);try{b(await l.onSubmit(je(i.fields,c)))}catch(R){b({error:d(R)})}finally{A(!1)}},children:[i.fields.map((C)=>e(et,{field:C,value:c[C.name]??"",error:E?.field===C.name?E.error:void 0,onChange:(R)=>p((I)=>({...I,[C.name]:R}))},C.name)),E&&!i.fields.some((C)=>C.name===E.field)?e(g,{message:E.error}):null,n("div",{className:"actions",children:[l.onCancel?e("button",{type:"button",className:"secondary",disabled:H,onClick:l.onCancel,children:t("Cancel")}):null,e("button",{type:"submit",disabled:H,children:i.submit})]})]})}function tt(l){if(!l.ok)return{error:Ni(l.error),...l.field?{field:l.field}:{}};if(l.notice)f(l.notice);if(l.open)Li(l.open);return}function re(l){let[i,c]=r(),[p,H]=r(!1),A=async(b,h)=>tt(await l.run(b,h)),E=async(b)=>{if(b.form||b.confirm){c(b);return}H(!0);try{let h=await A(b,{});if(h)f(h.error,"danger")}catch(h){f(d(h),"danger")}finally{H(!1)}};if(l.actions.length===0)return null;return n("div",{className:l.className??"host-actions",children:[l.actions.map((b)=>e("button",{type:"button",className:b.style==="danger"?"danger":b.style==="secondary"?"secondary":"",disabled:p,onClick:()=>E(b),children:b.label},b.id)),i?.form?e(he,{open:!0,title:i.form.title,onClose:()=>c(void 0),children:e(ue,{spec:i.form,onCancel:()=>c(void 0),onSubmit:async(b)=>{let h=await A(i,b);if(!h)c(void 0);return h}})}):i?e(K,{open:!0,title:i.label,confirmLabel:i.label,tone:i.style==="danger"?"danger":"primary",onConfirm:async()=>{let b=await A(i,{});if(b)throw Error(b.error)},onClose:()=>c(void 0),children:e("p",{children:i.confirm})}):null]})}var Ie=/^file:([A-Za-z0-9_-]{1,64})$/;function Ve(l){let i=URL.parse(l,document.baseURI);return i!==null&&i.origin===window.location.origin}function nt({id:l,alt:i}){return e("img",{className:"file-image",src:`api/files/${encodeURIComponent(l)}`,alt:i,loading:"lazy",decoding:"async",onError:(c)=>{let p=document.createElement("span");p.textContent=i||t("Image"),c.currentTarget.replaceWith(p)}})}var ee=J(function({source:i}){return e("div",{className:"prose",children:e(Gt,{remarkPlugins:[Rt],urlTransform:(c)=>Ie.test(c)?c:$n(c),components:{a:({href:c,children:p})=>c&&/^https?:\/\//.test(c)&&!Ve(c)?e("a",{href:c,target:"_blank",rel:"noreferrer noopener",children:p}):c&&Ve(c)?e("a",{href:c,children:p}):e("span",{children:p}),img:({src:c,alt:p})=>{let H=typeof c==="string"?Ie.exec(c):null;return H?.[1]?e(nt,{id:H[1],alt:p??""}):e("span",{children:p})},pre:kr,table:({children:c})=>e("div",{className:"table-wrap",children:e("table",{children:c})})},children:i})})});function rt(l){switch(l??"open"){case"working":return t("Working…");case"done":return t("Done");case"superseded":return t("Replaced");case"expired":return t("Expired");default:return""}}var we=(l)=>(l.state??"open")==="open";function ie(l){let{card:i}=l,c=rt(i.state);return n("article",{className:"host-card","data-tone":i.tone??"note","data-state":i.state??"open",children:[n("header",{children:[e("h3",{children:i.title}),c?e(P,{tone:i.state==="working"?"busy":"plain",children:c}):null]}),i.body?e(ee,{source:i.body}):null,i.links?.length?e("div",{className:"host-card-links",children:i.links.map((p)=>e("a",{href:p.url,...p.url.startsWith("/")?{}:{target:"_blank",rel:"noreferrer noopener"},children:p.label},`${p.url}`))}):null,we(i)&&i.buttons?.length?e(re,{actions:i.buttons,run:l.run}):null]})}st();function ot(){let[l,i]=r(()=>Rn().toString());return s(()=>{let c=()=>i(Rn().toString());return window.addEventListener("popstate",c),window.addEventListener("hashchange",c),()=>{window.removeEventListener("popstate",c),window.removeEventListener("hashchange",c)}},[]),l}function it(l){if(!l.ok)return{error:Ni(l.error),...l.field?{field:l.field}:{}};if(l.notice)f(l.notice);if(l.open)Li(l.open);return}function lt(l){let{section:i}=l;switch(i.kind){case"markdown":return e(ee,{source:i.text});case"card":return e(ie,{card:i.card,run:l.run});case"form":return n("section",{className:"stack",children:[e("h2",{className:"section-title",children:i.form.title}),e(ue,{spec:i.form,onSubmit:(c)=>l.submit(i.action,c)})]});case"list":return n("section",{className:"stack",children:[i.title?e("h2",{className:"section-title",children:i.title}):null,i.rows.length===0?e(_,{children:t("Nothing here.")}):null,e("ul",{className:"host-list",children:dt(i.rows).map(([c,p])=>n("li",{children:[p.attention?e("span",{className:"attention-dot",role:"img","aria-label":t("Needs attention")}):null,n("div",{className:"host-list-main",children:[p.open?e("a",{href:p.open,...p.open.startsWith("/")?{}:{target:"_blank",rel:"noreferrer noopener"},children:p.title}):e("strong",{children:p.title}),p.subtitle?e("span",{children:p.subtitle}):null]}),p.actions?.length?e(re,{actions:p.actions,run:l.run}):null]},c))})]})}}function ct({routeKey:l}){let i=l??"",c=ot(),p=Ae((R)=>R.pages[i]??0),[H,A]=r(0),[E,b]=r({});s(()=>{let R=!0;return Be.page(i,Object.fromEntries(new URLSearchParams(c))).then((I)=>R&&b({page:I}),(I)=>{if(!R)return;let V=I instanceof ce&&I.status===404;b((O)=>({...V||!O.page?{}:{page:O.page},error:d(I),gone:V}))}),()=>{R=!1}},[i,c,p,H]);let h=async(R,I)=>{let V=await Be.pageAct(i,{action:R,input:I}),O=it(V);if(!O)A((x)=>x+1);return O},C=async(R,I)=>{let V=await Be.pageAct(i,{action:R.id,input:I});if(V.ok)A((O)=>O+1);return V};if(E.gone)return e("div",{className:"page",children:e(_,{children:t("This page is not available.")})});if(!E.page)return e("div",{className:"page",children:E.error?e(g,{message:E.error}):e(w,{})});return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:E.page.title})}),E.error?e(g,{message:E.error}):null,E.page.sections.map((R,I)=>e(lt,{section:R,run:C,submit:h},I))]})}function dt(l){let i=new Map;return l.map((c)=>{let p=i.get(c.title)??0;return i.set(c.title,p+1),[`${c.title}:${p}`,c]})}var ut=/https?:\/\/[^\s<>"']+/g,mt=/[.,;:!?)\]}\u3001\u3002\uff0c\uff1b\uff1a\uff01\uff1f\uff09\u300d\u300f]+$/;function ft(l){let i=l.replace(mt,""),c=URL.parse(i);return c&&(c.protocol==="https:"||c.protocol==="http:")?i:""}function Oe({text:l}){let i=[],c=0;for(let p of l.matchAll(ut)){let H=ft(p[0]);if(H==="")continue;let A=p.index;if(A>c)i.push(l.slice(c,A));i.push(e("a",{href:H,target:"_blank",rel:"noreferrer noopener",children:H},`${A}`)),c=A+H.length}if(c<l.length)i.push(l.slice(c));return e("span",{className:"plain",children:i})}var Pe=J(function(i){let{message:c}=i,p=c.authorKind??"external";if(p==="notice")return n("li",{className:"host-notice","data-mid":c.id,"data-highlight":i.highlighted||void 0,"data-enter":i.enter||void 0,children:[e(o,{name:"bell",size:14}),e(ee,{source:c.text}),e("time",{dateTime:c.at,children:Zt(c.at,i.timeZone)})]});let H=p==="member"&&c.principalId!==void 0&&c.principalId===i.me;return n("li",{className:"message","data-mid":c.id,"data-author":p,"data-mine":H||void 0,"data-header":i.header||void 0,"data-enter":i.enter||void 0,"data-unread":i.unread||void 0,"data-highlight":i.highlighted||void 0,children:[H?null:e("span",{className:"message-avatar",children:i.header?e(at,{picture:c.picture,name:c.author}):null}),n("div",{className:"message-main",children:[i.header?n("div",{className:"message-meta",children:[e("strong",{children:c.author}),c.authorLabel?e("span",{className:"label-chip",children:c.authorLabel}):null,e("time",{dateTime:c.at,children:Zt(c.at,i.timeZone)})]}):null,n("div",{className:"bubble",children:[c.text?p==="assistant"?e(ee,{source:c.text}):e(Oe,{text:c.text}):null,e(Ct,{files:c.files}),c.expiredFiles?e("p",{className:"message-expired",children:te(c.expiredFiles,"{count} file was removed","{count} files were removed")}):null]}),c.edited?e("span",{className:"message-edited",children:t("edited")}):null]})]})});var pt=1500,gt=96,me=new Set,ke=new Map;function ht(l){if(document.visibilityState!=="visible")return!1;return!l||l.scrollHeight-l.scrollTop-l.clientHeight<gt}function ze(l){if(!(l instanceof Element))return;let i=l.closest("[data-unread][data-mid]");return i?Number(i.dataset.mid):void 0}function De(l){let{room:i,scroller:c,messages:p,began:H,enterAfter:A,me:E,shared:b}=l,h=a({seen:void 0,watched:new Set}),[,C]=r(0),R=ke.get(i)??me;if(A!==void 0&&p){let T=h.current;T.seen??=A;let F=ht(c.current),U=T.seen;for(let L of p){if(L.id<=T.seen)continue;if(F)T.watched.add(L.id);U=Math.max(U,L.id)}T.seen=U}let I=M(()=>{if(H===void 0||A===void 0||!p)return me;let T=new Set;for(let F of p){if(F.id===0||F.id<=H)continue;if(F.kind==="system"||F.note)continue;if(F.authorKind==="notice")continue;if(F.principalId===void 0?F.kind==="owner"&&!b:F.principalId===E)continue;if(h.current.watched.has(F.id)||R.has(F.id))continue;T.add(F.id)}return T.size===0?me:T},[p,H,A,E,b,R]),V=X((T)=>{let F=ke.get(i)??me;if(F.has(T))return;ke.set(i,new Set(F).add(T)),C((U)=>U+1)},[i]),O=I.size>0;s(()=>{let T=c.current;if(!T||!O)return;let F=(L)=>{if(L.pointerType==="touch")return;let D=ze(L.target);if(D!==void 0)V(D)},U=(L)=>{let D=ze(L.target);if(D!==void 0)V(D)};return T.addEventListener("pointerover",F,{passive:!0}),T.addEventListener("focusin",U,{passive:!0}),T.addEventListener("click",U,{passive:!0}),()=>{T.removeEventListener("pointerover",F),T.removeEventListener("focusin",U),T.removeEventListener("click",U)}},[c,V,O]);let x=a(new Map),z=[...I].join(",");return s(()=>{let T=c.current,F=x.current;for(let[B,G]of F)if(!I.has(B))clearTimeout(G),F.delete(B);if(!T||!O||typeof IntersectionObserver!=="function"||!matchMedia("(pointer: coarse)").matches)return;let U=(B)=>{let G=F.get(B);if(G===void 0)return;clearTimeout(G),F.delete(B)},L=new IntersectionObserver((B)=>{for(let G of B){let j=Number(G.target.dataset.mid),ae=G.rootBounds;if(!(G.isIntersecting&&(G.intersectionRatio>=0.5||ae!==null&&G.intersectionRect.height>=ae.height*0.5))){U(j);continue}if(F.has(j))continue;F.set(j,setTimeout(()=>{if(F.delete(j),document.visibilityState==="visible")V(j)},pt))}},{root:T,threshold:[0,0.25,0.5,0.75,1]}),D=[...T.querySelectorAll("[data-unread][data-mid]")];for(let B of D)L.observe(B);let Q=()=>{if(document.visibilityState!=="visible")return;for(let B of D)L.unobserve(B),L.observe(B)};return document.addEventListener("visibilitychange",Q),()=>{document.removeEventListener("visibilitychange",Q),L.disconnect()}},[c,V,O,z]),s(()=>{let T=x.current;return()=>{for(let F of T.values())clearTimeout(F);T.clear()}},[]),I}st();var bt=3;function yt({marks:l}){let[i,c]=r(!1);return n("li",{className:"seen",children:[n("button",{type:"button",className:"seen-toggle","aria-expanded":i,onClick:()=>c((p)=>!p),children:[l.slice(0,bt).map((p)=>e(at,{picture:{principal:p.principal},name:p.name,size:16},p.principal)),e("span",{children:t("Seen by {count}",{count:l.length})})]}),i?e("span",{className:"seen-names",children:l.map((p)=>p.name).join(t(", "))}):null]})}function vt(l,i){let c=Ee(),p=u((H)=>H.connects);s(()=>{let H=i.current;if(!H)return;let A=0,E=0,b,h,C=()=>{if(h=void 0,document.visibilityState!=="visible")return;let V=H.getBoundingClientRect(),O=0;for(let z of H.querySelectorAll("[data-mid]")){let T=z.getBoundingClientRect();if(T.bottom>V.top&&T.top<V.bottom-4)O=Math.max(O,Number(z.dataset.mid))}if(O<=A)return;let x=E+1000-Date.now();if(x>0){clearTimeout(b),b=setTimeout(R,x);return}if(c.send({type:"read",room:l,upTo:O}))A=O,E=Date.now()},R=()=>{if(h===void 0)h=requestAnimationFrame(C)};H.addEventListener("scroll",R,{passive:!0}),document.addEventListener("visibilitychange",R),window.addEventListener("resize",R);let I=new MutationObserver(R);return I.observe(H,{childList:!0,subtree:!0}),R(),()=>{if(H.removeEventListener("scroll",R),document.removeEventListener("visibilitychange",R),window.removeEventListener("resize",R),I.disconnect(),clearTimeout(b),h!==void 0)cancelAnimationFrame(h)}},[c,l,i,p])}function fe(l){let{roomKey:i}=l;vt(i,l.scroller);let c=u((R)=>R.principal?.id),p=u((R)=>R.rooms[i]?.messages),H=Ae((R)=>R.reads[i]??eo),A=Ae((R)=>R.cursor[i]),E=a(void 0);if(E.current===void 0&&A!==void 0)E.current=A;let b=u((R)=>R.rooms[i]?.view?.notes===!0),h=De({room:i,scroller:l.scroller,messages:p,began:E.current,enterAfter:l.enterAfter,me:c,shared:l.host===!0||b}),C=M(()=>{let I=(p??[]).filter((x)=>x.kind!=="system"),V=E.current===void 0?void 0:I.find((x)=>x.id>(E.current??0)&&(x.principalId===void 0||x.principalId!==c))?.id,O=new Map;for(let x of H){if(x.principal===c)continue;let z=I.findLast((T)=>T.id<=x.upTo);if(z)O.set(z.id,[...O.get(z.id)??[],x])}return{before:(x)=>x.id===V?e("li",{className:"new-divider",children:e("span",{children:t("New messages")})}):null,after:(x)=>{let z=O.get(x.id);return z?e(yt,{marks:z}):null},unread:(x)=>h.has(x.id),...l.host?{message:(x,z)=>x.kind==="system"&&x.authorKind===void 0?void 0:e(Pe,{message:x,header:z.header,enter:z.enter,unread:z.unread,timeZone:z.timeZone,me:c,highlighted:l.highlight===x.id})}:{}}},[p,H,c,l.host,l.highlight,h]);return e(bn,{roomKey:i,enterAfter:l.enterAfter,quotable:l.quotable,decor:C})}st();var wt=20,kt=2600,Ue;function Nt(l,i,c){let p=u((b)=>b.connects),H=Ae((b)=>b.rooms[l]??0),[A,E]=r({view:void 0,error:void 0,gone:!1});return s(()=>{let b=!0;return Be.open(i,c).then((h)=>{if(!b)return;y.dispatch({type:"history_loaded",room:l,messages:h.messages,more:h.more,older:!1}),nr(l,h.reads,h.cursor),no(l,h.cards),E({view:h,error:void 0,gone:!1})},(h)=>{if(!b)return;let C=h instanceof ce&&h.status===404;E((R)=>({view:C?void 0:R.view,error:d(h),gone:C}))}),()=>{b=!1}},[l,i,c,p,H]),A}function Ht(l){let{header:i}=l;return n(m,{children:[i.banner?e("p",{className:"host-banner","data-tone":i.banner.tone,role:"status",children:i.banner.text}):null,i.fields.length?e("dl",{className:"host-head-fields",children:i.fields.map((c)=>n("div",{children:[e("dt",{children:c.label}),e("dd",{children:c.link?e("a",{href:c.link,...c.link.startsWith("/")?{}:{target:"_blank",rel:"noreferrer noopener"},children:c.value}):c.value})]},`${c.label}:${c.value}`))}):null,e(re,{className:"host-actions bar",actions:i.actions,run:l.run})]})}function At(l){let i=Ae((C)=>C.cards[l.room]??to),c=He("(min-width: 720px) and (min-height: 760px)"),[p,H]=r();if(i.length===0)return null;let A=i.filter((C)=>we(C)||C.state==="working"),E=i.filter((C)=>!A.includes(C)),b=p??(c&&A.length>0),h=A[0];return n("div",{className:"host-cards","data-open":b||void 0,children:[n("button",{type:"button",className:"host-cards-toggle","aria-expanded":b,onClick:()=>H(!b),children:[e(o,{name:"chevron",size:14}),h?n("span",{children:[e("strong",{children:te(A.length,"{count} card waiting","{count} cards waiting")}),`: ${h.title}`]}):e("span",{children:t("Earlier cards ({count})",{count:E.length})})]}),b?n("div",{className:"host-cards-body",children:[A.map((C)=>e(ie,{card:C,run:l.run(C.id)},C.id)),E.length?n("details",{className:"host-cards-older",children:[e("summary",{children:t("Earlier cards ({count})",{count:E.length})}),E.map((C)=>e(ie,{card:C,run:l.run(C.id)},C.id))]}):null]}):null]})}function Et({roomKey:l}){let i=Ee(),c=To(l),p=c?.kind??"",H=c?.id??"",{view:A,error:E,gone:b}=Nt(l,p,H),h=u((S)=>S.rooms[l]),C=u((S)=>S.limits),R=u((S)=>S.connects),I=u((S)=>S.connection==="open"),V=a(null),O=a(null),{away:x,onScroll:z,onGrow:T,toEnd:F}=Pr(V),[U,L]=r(!1),[D,Q]=r(),[B,G]=r(Ue),[j,ae]=r(!1),[Re,Se]=r(),ge=a(void 0),oe=a(void 0),W=A!==void 0;if(s(()=>{if(!c||b||!W)return;return i.send({type:"subscribe",room:l}),i.focus(l),()=>{i.focus(void 0),i.send({type:"unsubscribe",room:l})}},[i,l,R,b,W]),W&&ge.current===void 0)ge.current=h?.messages.at(-1)?.id??0;Qe(()=>{if(W)F(!1)},[W]),Qe(()=>{let S=V.current;if(S&&oe.current!==void 0)S.scrollTop+=S.scrollHeight-oe.current,oe.current=void 0},[h?.messages[0]?.id]),s(()=>{let S=O.current;if(!S||typeof ResizeObserver>"u")return;let q=new ResizeObserver(T);return q.observe(S),()=>q.disconnect()},[T]);let be=X(async()=>{let S=y.getState().rooms[l]?.messages[0];if(!S)return!1;let q=await Be.older(p,H,S.id,hi);return y.dispatch({type:"history_loaded",room:l,messages:q.messages,more:q.more,older:!0}),nr(l,q.reads,void 0),q.more},[l,p,H]),le=a(void 0);s(()=>{let S=()=>{let q=Number(Rn().get("message"));le.current=Number.isSafeInteger(q)&&q>0?q:void 0};return S(),window.addEventListener("popstate",S),()=>window.removeEventListener("popstate",S)},[]);let ye=h?.messages[0]?.id,Le=h?.more===!0;s(()=>{let S=le.current,q=V.current;if(!W||S===void 0||!q)return;let Z=q.querySelector(`[data-mid="${S}"]`);if(Z){le.current=void 0,Z.scrollIntoView({block:"center"}),Se(S),requestAnimationFrame(()=>q.dispatchEvent(new Event("scroll"))),setTimeout(()=>Se(void 0),kt);return}if(ye!==void 0&&S<ye&&Le){let se=0;(async()=>{if(se+=1,!await be().catch(()=>!1)||se>=wt)le.current=void 0})()}},[W,ye,Le,h?.messages.length,be]);let Ce=(S,q={},Z)=>Be.act(p,H,{action:S.id,...Z===void 0?{}:{card:Z},input:q}),We=(S,q)=>Ce(S,q),Ze=(S)=>(q,Z)=>Ce(q,Z,S);if(b||!W&&!E&&!c)return e("section",{className:"room",children:n("div",{className:"page",children:[e(_,{children:t("This room is not available.")}),e("a",{className:"back",href:v("rooms"),children:t("Back to rooms")})]})});let Y=A?.access.send??[],ve=Y.length>1,Te=ve&&j,Me=B&&Y.includes(B)?B:Y.includes("turn")?"turn":Y[0],Fe=Te||Me==="turn",Ye=Fe?A?.wording?.turn?.placeholder??t("Ask AI…"):A?.wording?.note?.placeholder??t("Write an internal note…"),de=A?.header.title??l,Xe=h?.messages??[];return n("section",{className:"room",onDragOver:(S)=>{if(Y.length&&S.dataTransfer.types.includes("Files"))S.preventDefault()},onDrop:(S)=>{if(!Y.length||!S.dataTransfer.files.length)return;S.preventDefault(),Q([...S.dataTransfer.files])},children:[n("header",{className:"room-head",children:[e("a",{className:"icon-button room-back",href:v("rooms"),"aria-label":t("Back to rooms"),children:e(o,{name:"back"})}),e(at,{name:de,size:40}),n("div",{className:"room-title",children:[e("h1",{children:de}),e("span",{className:"room-status","data-working":h?.typing||void 0,children:h?.typing?t("Working…"):t("Host room")})]})]}),!I?n("div",{className:"offline-banner",role:"status",children:[e("span",{className:"spinner","aria-hidden":"true"}),t("Reconnecting… messages wait here until it is back.")]}):null,A?e(Ht,{header:A.header,run:We}):null,e("div",{className:"room-scroll",ref:V,onScroll:z,children:n("div",{className:"room-content",ref:O,children:[E?e(g,{message:E}):null,!W&&!E?e(w,{}):null,h?.more?e("button",{type:"button",className:"secondary older",disabled:U,onClick:async()=>{L(!0),oe.current=V.current?.scrollHeight;try{await be()}catch(S){oe.current=void 0,f(d(S),"danger")}finally{L(!1)}},children:U?t("Loading…"):t("Load earlier messages")}):null,W&&Xe.length===0?e(_,{children:t("No messages yet.")}):null,e(fe,{roomKey:l,enterAfter:ge.current,quotable:!1,scroller:V,host:!0,highlight:Re}),h?.typing?e(pn,{name:de,progress:h.progress}):null]})}),x?n("button",{type:"button",className:"to-end",onClick:()=>F(!0),children:[e(o,{name:"send",size:16,style:{transform:"rotate(180deg)"}}),t("Latest")]}):null,A?e(At,{room:l,run:Ze}):null,A&&Y.length===0?e("p",{className:"room-note",children:t("You can read this room but not write in it.")}):null,A&&Y.length>0?e(m,{children:e(hn,{draftKey:l,name:de,placeholder:Ye,onAddressed:ae,...ve?{above:e(ur,{on:Fe,label:A?.wording?.turn?.label??t("@AI"),...Te?{locked:t("The message starts with @AI, so the knight answers.")}:{},onChange:(S)=>{let q=S?"turn":"note";Ue=q,G(q)}})}:{},limits:C,stoppable:Boolean(h?.stoppable),onSend:(S,q,Z)=>{if(ve&&Z){let se=Vi(S);i.say(l,se===""&&q.length===0?S:se,q,"turn")}else i.say(l,S,q,Me);F(!0)},onStop:()=>i.send({type:"stop",room:l}),...D?{incoming:D,onIncomingTaken:()=>Q(void 0)}:{}},l)}):null]})}st();function pe({room:l}){let i=Ae((c)=>c.unread[l]??0);if(i<=0)return null;return e("span",{className:"unread-mark",role:"img","aria-label":te(i,"{count} unread message","{count} unread messages"),children:i>99?"99+":i})}st();var St=6,Lt=250;function Ne(l){let{kind:i}=l,{timeZone:c}=k(),{now:p}=ne(),H=u((L)=>L.connects),A=Ae((L)=>L.lists[i]??0),[E,b]=r(""),[h,C]=r(""),[R,I]=r(),[V,O]=r(),[x,z]=r(),[T,F]=r(!1);s(()=>{let L=setTimeout(()=>C(E.trim()),Lt);return()=>clearTimeout(L)},[E]),s(()=>{let L=!0;return Be.list(i,h||void 0).then((D)=>{if(!L)return;nn(Object.fromEntries(D.rooms.map((Q)=>[Q.key,Q.unread??0]))),I(D.rooms),O(D.cursor),z(void 0)},(D)=>L&&z(d(D))),()=>{L=!1}},[i,h,H,A]);let U=async()=>{if(!V||T)return;F(!0);try{let L=await Be.list(i,h||void 0,V);nn(Object.fromEntries(L.rooms.map((D)=>[D.key,D.unread??0]))),I((D)=>[...D??[],...L.rooms]),O(L.cursor)}catch(L){z(d(L))}finally{F(!1)}};return n("section",{className:"stack",children:[n("h2",{className:"section-title",children:[l.icon?e(o,{name:l.icon,size:14,className:"section-icon"}):null,l.label]}),R&&(R.length>=St||h||E)?e("input",{type:"search",className:"kind-filter",value:E,placeholder:t("Search {name}",{name:l.label}),"aria-label":t("Search {name}",{name:l.label}),onChange:(L)=>b(L.target.value)}):null,x?e(g,{message:x}):null,!R&&!x?n("div",{className:"stack","aria-busy":"true",children:[e("div",{className:"skeleton"}),e("div",{className:"skeleton"})]}):null,R&&R.length===0?e(_,{children:h?t("Nothing matches."):t("No rooms yet.")}):null,R&&R.length>0?e("ul",{className:"room-list",children:R.map((L)=>e("li",{children:n("a",{className:"room-row",href:v("room",L.key),"aria-current":L.key===l.active?"page":void 0,children:[n("span",{className:"kind-row-picture",children:[e(at,{picture:L.picture,name:L.title,size:44}),L.attention?e("span",{className:"attention-dot",role:"img","aria-label":t("Needs attention")}):null]}),n("span",{className:"room-row-main",children:[n("span",{className:"room-row-top",children:[e("strong",{children:L.title}),e(pe,{room:L.key}),e("span",{className:"room-row-time",children:L.lastAt?_e(L.lastAt,p,c):""})]}),e("span",{className:"room-row-preview",children:e("span",{children:L.subtitle??""})})]}),e(o,{name:"chevron",size:16,className:"room-row-chevron"})]})},L.key))}):null,V?e("button",{type:"button",className:"secondary",disabled:T,onClick:U,children:T?t("Loading…"):t("Show more")}):null]})}function $e(l){return l.kinds.map((i)=>e(Ne,{kind:i.kind,label:i.label,...i.icon?{icon:i.icon}:{},active:l.active},i.kind))}function Ge(){let l=(k().pages??[]).filter((i)=>i.place==="settings");if(l.length===0)return null;return n("section",{className:"card stack",children:[e("h2",{children:t("More settings")}),l.map((i)=>n("a",{className:"menu-item menu-link",href:v("p",i.id),children:[e("span",{className:"menu-text",children:e("strong",{children:i.label})}),e(o,{name:"chevron",size:16})]},i.id))]})}export{$e as HostKinds,ct as HostPage,Et as HostRoomPage,Ge as HostSettingsPages,fe as ReadLog,pe as UnreadMark};
@@ -0,0 +1,2 @@
1
+ function Mt(e,n){if(e.detail!==0&&(e.clientX!==0||e.clientY!==0))return{x:e.clientX,y:e.clientY};let t=n.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}var Ft={table:"Round table",seat:(e,n)=>`${e} (${n})`};
2
+ export{Mt,Ft};
@@ -1,4 +1,4 @@
1
- import{e,n}from"./chunk-index-kankja6p.js";var r=!1;function a(){if(r||typeof document>"u")return;if(r=!0,typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in Document.prototype)try{let o=new CSSStyleSheet;o.replaceSync(`
1
+ import{e,n}from"./chunk-index-fg42egv9.js";var r=!1;function a(){if(r||typeof document>"u")return;if(r=!0,typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in Document.prototype)try{let o=new CSSStyleSheet;o.replaceSync(`
2
2
  /* One choice of how to write, in the composer's column over the bar, wherever the pane is wide. */
3
3
  .mode-toggle {
4
4
  display: inline-flex;
@@ -134,5 +134,5 @@ import{e,n}from"./chunk-index-kankja6p.js";var r=!1;function a(){if(r||typeof do
134
134
  background: var(--bg);
135
135
  transform: translateX(0.9rem);
136
136
  }
137
- `,document.head.append(t)}a();function nr(t){return n("button",{type:"button",role:"switch","aria-checked":t.on,className:"mode-toggle",disabled:t.locked!==void 0,title:t.locked,onClick:()=>t.onChange(!t.on),children:[e("span",{className:"mode-toggle-track","aria-hidden":"true"}),t.label]})}
138
- export{nr};
137
+ `,document.head.append(t)}a();function ur(t){return n("button",{type:"button",role:"switch","aria-checked":t.on,className:"mode-toggle",disabled:t.locked!==void 0,title:t.locked,onClick:()=>t.onChange(!t.on),children:[e("span",{className:"mode-toggle-track","aria-hidden":"true"}),t.label]})}
138
+ export{ur};
@@ -0,0 +1,2 @@
1
+ import{h,t}from"./chunk-index-fg42egv9.js";import{Jr}from"./chunk-index-3pnvpppa.js";import{_i,ys,bs}from"./chunk-index-nsvwbjfe.js";function Wr(e){let n=Jr();if(!e)return n;let r=new Set([...e,...ys(e)]);return Object.fromEntries(Object.entries(n).filter(([s])=>r.has(s)))}var i=()=>(h("v1g2bzk7"),import("./chunk-bulk-actions-v1g2bzk7.js"));function ki(e){let n=[];if(Object.keys(Wr(e)).length>0)n.push({id:"read-all",label:t("Mark all as read"),icon:"check",run:()=>{i().then((r)=>r.markAllRead(e))}});if(_i(e).size>0)n.push({id:"clear-finished",label:t("Clear all finished threads"),icon:"trash",tone:"danger",run:()=>{i().then((r)=>r.clearAllFinished(e))}});return n.push(...Yr(e)),n}function Yr(e){if(bs(e).size===0)return[];return[{id:"clear-helpers",label:t("Clear finished temp knights"),icon:"trash",tone:"danger",run:()=>{i().then((n)=>n.clearFinishedHelpers(e))}}]}
2
+ export{Wr,ki,Yr};
@@ -1,2 +1,2 @@
1
- import{ro,T,ae,xt,M,I,Pt}from"./chunk-index-6c8mewwy.js";class P{constructor(t,e,s,i,h,r,n,o,l,f=0,a){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=l,this.lookAhead=f,this.parent=a}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new P(t,[],e,s,s,0,[],0,i?new w(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),n=h.dynamicPrecedence(i);if(n)this.score+=n;if(s==0){if(i<h.minRepeatTerm&&this.reducePos<this.pos)this.reducePos=this.pos;if(this.pushState(h.getGoto(this.state,i,!0),this.reducePos),i<h.minRepeatTerm)this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0);this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(s-1)*3-(t&262144?6:0),l=o?this.stack[o-2]:this.p.ranges[0].from;if(i<h.minRepeatTerm&&l==this.reducePos&&this.reducePos<this.pos)this.reducePos=this.pos;let f=this.reducePos-l;if(f>=2000&&!((e=this.p.parser.nodeSet.types[i])===null||e===void 0?void 0:e.isAnonymous)){if(l==this.p.lastBigReductionStart)this.p.bigReductionCount++,this.p.lastBigReductionSize=f;else if(this.p.lastBigReductionSize<f)this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=f}let a=o?this.stack[o-1]:0,d=this.bufferBase+this.buffer.length-a;if(i<h.minRepeatTerm||t&131072){let u=h.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,l,u,d+4,!0)}if(t&262144)this.state=this.stack[o];else{let u=this.stack[o-3];this.state=h.getGoto(u,i,!0)}while(this.stack.length>o)this.stack.pop();this.reduceContext(i,l)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this.buffer.length;if(r>0&&this.buffer[r-4]==0&&this.buffer[r-1]>-1){if(e==s)return;if(this.buffer[r-2]>=e){this.buffer[r-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n){while(r>0&&this.buffer[r-2]>s)if(this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4)i-=4}}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i;let n=r.stateFlag(h,1);if(!n&&(i>s||e<=r.maxNode))this.reducePos=i;if(this.pushState(h,n?s:Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode)this.buffer.push(e,s,i,4)}else if(this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode)this.buffer.push(e,s,i,4)}apply(t,e,s,i){if(t&65536)this.reduce(t);else this.shift(t,e,s,i)}useNode(t,e,s){let i=this.p.reused.length-1;if(i<0||this.p.reused[i]!=t)this.p.reused.push(t),i++;let h=this.reducePos=this.pos=s+t.length;if(this.pushState(e,s),this.buffer.push(i,s,h,-1),this.curContext)this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;if(e&&t.buffer[e-4]==0)e-=4;while(e>0&&t.buffer[e-2]>t.reducePos)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;while(t&&i==t.bufferBase)t=t.parent;return new P(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;if(s)this.storeNode(t,this.pos,e,4);this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new B(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;h<e.length;h+=2)if((r=e[h+1])!=this.state&&this.p.parser.hasAction(r,t))i.push(e[h],r);if(this.stack.length<120)for(let h=0;i.length<8&&h<e.length;h+=2){let r=e[h+1];if(!i.some((n,o)=>o&1&&n==r))i.push(e[h],r)}e=i}let s=[];for(let i=0;i<e.length&&s.length<4;i+=2){let h=e[i+1];if(h==this.state)continue;let r=this.split();r.pushState(h,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[i],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(e.includes(i))return;return e.push(i),t.allActions(i,(r)=>{if(r&393216);else if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,l=this.stack.length-n*3;if(l>=0&&t.getGoto(this.stack[l],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){while(!this.p.parser.stateFlag(this.state,2))if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){if(this.curContext)this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){if(this.curContext)this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;if(t<0||this.buffer[t]!=-3)this.storeNode(this.curContext.hash,this.reducePos,this.reducePos,-3,!0)}emitLookAhead(){let t=this.buffer.length-1;if(t<0||this.buffer[t]!=-4)this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new w(this.curContext.tracker,t);if(e.hash!=this.curContext.hash)this.emitContext();this.curContext=e}}setLookAhead(t){if(t<=this.lookAhead)return!1;return this.emitLookAhead(),this.lookAhead=t,!0}close(){if(this.curContext&&this.curContext.tracker.strict)this.emitContext();if(this.lookAhead>0)this.emitLookAhead()}}class w{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class B{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;if(s==0){if(this.stack==this.start.stack)this.stack=this.stack.slice();this.stack.push(this.state,0,0),this.base+=3}else this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class S{constructor(t,e,s){if(this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0)this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new S(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;if(t!=null)this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){if(this.index-=4,this.pos-=4,this.index==0)this.maybeNext()}fork(){return new S(this.stack,this.pos,this.index)}}function x(t,e=Uint16Array){if(typeof t!="string")return t;let s=null;for(let i=0,h=0;i<t.length;){let r=0;for(;;){let n=t.charCodeAt(i++),o=!1;if(n==126){r=65535;break}if(n>=92)n--;if(n>=34)n--;let l=n-32;if(l>=46)l-=46,o=!0;if(r+=l,o)break;r*=46}if(s)s[h++]=r;else s=new e(r)}return s}class b{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}var y=new b;class O{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=y,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;while(h<s.from){if(!i)return null;let r=this.ranges[--i];h-=s.from-r.to,s=r}while(e<0?h>s.to:h>=s.to){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e<this.chunk.length)s=this.pos+t,i=this.chunk.charCodeAt(e);else{let h=this.resolveOffset(t,1);if(h==null)return-1;if(s=h,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let r=this.rangeIndex,n=this.range;while(n.to<=s)n=this.ranges[++r];if(this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>n.to)this.chunk2=this.chunk2.slice(0,n.to-s);i=this.chunk2.charCodeAt(0)}}if(s>=this.token.lookAhead)this.token.lookAhead=s+1;return i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s<this.token.start)throw RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){if(this.chunkOff>=this.chunk.length){if(this.getChunk(),this.chunkOff==this.chunk.length)return this.next=-1}return this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){this.chunkOff+=t;while(this.pos+t>=this.range.to){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}if(this.pos+=t,this.pos>=this.token.lookAhead)this.token.lookAhead=this.pos+1;return this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e)this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1;else this.token=y;if(this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;while(t<this.range.from)this.range=this.ranges[--this.rangeIndex];while(t>=this.range.to)this.range=this.ranges[++this.rangeIndex];if(t>=this.chunkPos&&t<this.chunkPos+this.chunk.length)this.chunkOff=t-this.chunkPos;else this.chunk="",this.chunkOff=0;this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;if(i.to>t)s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e))}return s}}class m{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;F(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}m.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class ct{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?x(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(F(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(!h)i++;if(r==null)break;t.reset(r,t.token)}if(i)t.reset(s,t.token),t.acceptToken(this.elseToken,i)}}ct.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class R{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function F(t,e,s,i,h,r){let n=0,o=1<<i,{dialect:l}=s.p.parser;t:for(;;){if((o&t[n])==0)break;let f=t[n+1];for(let c=n+3;c<f;c+=2)if((t[c+1]&o)>0){let g=t[c];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||H(g,e.token.value,h,r))){e.acceptToken(g);break}}let a=e.next,d=0,u=t[n+2];if(e.next<0&&u>d&&t[f+u*3-3]==65535){n=t[f+u*3-1];continue t}for(;d<u;){let c=d+u>>1,g=f+c+(c<<1),_=t[g],G=t[g+1]||65536;if(a<_)u=c;else if(a>=G)d=c+1;else{n=t[g+2],e.advance();continue t}}break}}function C(t,e,s){for(let i=e,h;(h=t[i])!=65535;i++)if(h==s)return i-e;return-1}function H(t,e,s,i){let h=C(s,i,e);return h<0||C(s,i,t)<h}var p=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),v=null;function N(t,e,s){let i=t.cursor(M.IncludeAnonymous);i.moveTo(e);for(;;)if(!(s<0?i.childBefore(e):i.childAfter(e)))for(;;){if((s<0?i.to<e:i.from>e)&&!i.type.isError)return s<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(t.length,Math.max(i.from+1,e+25));if(s<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return s<0?0:t.length}}class L{constructor(t,e){this.fragments=t,this.minRepeat=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){this.safeFrom=t.openStart?N(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?N(t.tree,t.to+t.offset,-1)-t.offset:t.to;while(this.trees.length)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;while(this.fragment&&this.safeTo<=t)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],i=this.index[e];if(i==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let h=s.children[i],r=this.start[e]+s.positions[i];if(r>t)return this.nextStart=r,null;if(h instanceof I){let n=r>this.lastRepeatPos&&h.type.id>=this.minRepeat;if(r==t||n){let o=r+h.length,l;if(r>=this.safeFrom&&o<=this.safeTo&&(!(l=h.prop(T.lookAhead))||o+l<this.fragment.to)){if(n)this.lastRepeat=h,this.lastRepeatPos=r;if(r==t)return h}else if(r==t)return null}if(this.index[e]++,r+h.length>=Math.max(this.safeFrom,t))this.trees.push(h),this.start.push(r),this.index.push(0)}else this.index[e]++,this.nextStart=r+h.length}}}class j{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((s)=>new b)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let l=0;l<h.length;l++){if((1<<l&r)==0)continue;let f=h[l],a=this.tokens[l];if(s&&!f.fallback)continue;if(f.contextual||a.start!=t.pos||a.mask!=r||a.context!=n)this.updateCachedToken(a,f,t),a.mask=r,a.context=n;if(a.lookAhead>a.end+25)o=Math.max(a.lookAhead,o);if(a.value!=0){let d=e;if(a.extended>-1)e=this.addActions(t,a.extended,a.end,e);if(e=this.addActions(t,a.value,a.end,e),!f.extend){if(s=a,e>d)break}}}while(this.actions.length>e)this.actions.pop();if(o)t.setLookAhead(o);if(!s&&t.pos==this.stream.end)s=new b,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e);return this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new b,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r<h.specialized.length;r++)if(h.specialized[r]==t.value){let n=h.specializers[r](this.stream.read(t.start,t.end),s);if(n>=0&&s.p.parser.dialect.allows(n>>1)){if((n&1)==0)t.value=n>>1;else t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;h<i;h+=3)if(this.actions[h]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:h}=t,{parser:r}=t.p,{data:n}=r;for(let o=0;o<2;o++)for(let l=r.stateSlot(h,o?2:1);;l+=3){if(n[l]==65535)if(n[l+1]==1)l=k(n,l+2);else{if(i==0&&n[l+1]==2)i=this.putAction(k(n,l+2),e,s,i);break}if(n[l]==e)i=this.putAction(k(n,l+1),e,s,i)}return i}}class E{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new O(e,i),this.tokens=new j(t,this.stream),this.topTerm=t.top[1];let{from:h}=i[0];this.stacks=[P.start(this,t.top[0],h)],this.fragments=s.length&&this.stream.end-h>t.bufferLength*4?new L(s,t.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;while(r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<t.length;r++){let n=t[r];for(;;){if(this.tokens.mainToken=null,n.pos>e)s.push(n);else if(this.advanceStack(n,s,t))continue;else{if(!i)i=[],h=[];i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}break}}if(!s.length){let r=i&&W(i);if(r){if(p)console.log("Finish with "+this.stackID(r));return this.stackToTree(r)}if(this.parser.strict){if(p&&i)console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none"));throw SyntaxError("No parse at "+e)}if(!this.recovering)this.recovering=5}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r){if(p)console.log("Force-finish "+this.stackID(r));return this.stackToTree(r.forceAll())}}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r){s.sort((n,o)=>o.score-n.score);while(s.length>r)s.pop()}if(s.some((n)=>n.reducePos>e))this.recovering--}else if(s.length>1){t:for(let r=0;r<s.length-1;r++){let n=s[r];for(let o=r+1;o<s.length;o++){let l=s[o];if(n.sameState(l)||n.buffer.length>500&&l.buffer.length>500)if((n.score-l.score||n.buffer.length-l.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}if(s.length>12)s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)if(s[r].pos<this.minStackPos)this.minStackPos=s[r].pos;return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw RangeError("Can't move stoppedAt forward");this.stoppedAt=t}tryReuse(t,e,s,i){if(!s)return null;let h=t.curContext&&t.curContext.tracker.strict,r=h?t.curContext.hash:0;for(;s;){let n=this.parser.nodeSet.types[s.type.id]!=s.type?-1:this.parser.getGoto(t.state,s.type.id);if(n>-1&&s.length&&(!h||(s.prop(T.contextHash)||0)==r))return t.useNode(s,n,e),s;if(s.children.length==0||s.positions[0]>0)break;let o=s.children[0];if(o instanceof I&&(!i||o.type.id>=this.parser.minRepeatTerm))s=o;else break}return null}advanceStack(t,e,s){let i=t.pos,{parser:h}=this,r=p?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let l=t.reducePos<i&&t.buffer.length&&t.buffer[t.buffer.length-2]<=t.reducePos&&this.fragments.lastRepeatPos==t.reducePos&&this.tryReuse(t,t.reducePos,this.fragments.lastRepeat,!0)||this.tryReuse(t,i,this.fragments.nodeAt(i),!1);if(l){if(p)console.log(r+this.stackID(t)+` (via reuse of ${h.getName(l.type.id)})`);return!0}}let n=h.stateSlot(t.state,4);if(n>0){if(t.reduce(n),p)console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`);return!0}if(t.stack.length>=8400)while(t.stack.length>6000&&t.forceReduce());let o=this.tokens.getActions(t);for(let l=0;l<o.length;){let f=o[l++],a=o[l++],d=o[l++],u=l==o.length||!s,c=u?t:t.split(),g=this.tokens.mainToken;if(c.apply(f,a,g?g.start:c.pos,d),p)console.log(r+this.stackID(c)+` (via ${(f&65536)==0?"shift":`reduce of ${h.getName(f&65535)}`} for ${h.getName(a)} @ ${i}${c==t?"":", split"})`);if(u)return!0;else if(c.pos>i)e.push(c);else s.push(c)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return z(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r<<1],l=e[(r<<1)+1],f=p?this.stackID(n)+" -> ":"";if(n.deadEnd){if(h)continue;if(h=!0,n.restart(),p)console.log(f+this.stackID(n)+" (restarted)");if(this.advanceFully(n,s))continue}let a=n.split(),d=f;for(let u=0;u<10&&a.forceReduce();u++){if(p)console.log(d+this.stackID(a)+" (via force-reduce)");if(this.advanceFully(a,s))break;if(p)d=this.stackID(a)+" -> "}for(let u of n.recoverByInsert(o)){if(p)console.log(f+this.stackID(u)+" (via recover-insert)");this.advanceFully(u,s)}if(this.stream.end>n.pos){if(l==n.pos)l++,o=0;if(n.recoverByDelete(o,l),p)console.log(f+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`);z(n,s)}else if(!i||i.score<a.score)i=a}return i}stackToTree(t){return t.close(),I.build({buffer:S.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(v||(v=new WeakMap)).get(t);if(!e)v.set(t,e=String.fromCodePoint(this.nextStackID++));return e+t}}function z(t,e){for(let s=0;s<e.length;s++){let i=e[s];if(i.pos==t.pos&&i.sameState(t)){if(e[s].score<t.score)e[s]=t;return}}e.push(t)}class U{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||this.disabled[t]==0}}var A=(t)=>t;class ve{constructor(t){this.start=t.start,this.shift=t.shift||A,this.reduce=t.reduce||A,this.reuse=t.reuse||A,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class Z extends Pt{constructor(t){super();if(this.wrappers=[],t.version!=14)throw RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let s=Object.keys(t.topRules).map((n)=>t.topRules[n][1]),i=[];for(let n=0;n<e.length;n++)i.push([]);function h(n,o,l){i[n].push([o,o.deserialize(String(l))])}if(t.nodeProps)for(let n of t.nodeProps){let o=n[0];if(typeof o=="string")o=T[o];for(let l=1;l<n.length;){let f=n[l++];if(f>=0)h(f,o,n[l++]);else{let a=n[l+-f];for(let d=-f;d>0;d--)h(n[l++],o,a);l++}}}if(this.nodeSet=new xt(e.map((n,o)=>ae.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources)this.nodeSet=this.nodeSet.extend(...t.propSources);this.strict=!1,this.bufferLength=ro;let r=x(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;n<this.specializerSpecs.length;n++)this.specialized[n]=this.specializerSpecs[n].term;this.specializers=this.specializerSpecs.map(D),this.states=x(t.states,Uint32Array),this.data=x(t.stateData),this.goto=x(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map((n)=>typeof n=="number"?new m(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new E(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let l=h+(r>>1);h<l;h++)if(i[h]==t)return o;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let h=this.stateSlot(t,i?2:1),r;;h+=3){if((r=s[h])==65535)if(s[h+1]==1)r=s[h=k(s,h+2)];else if(s[h+1]==2)return k(s,h+2);else break;if(r==e||r==0)return k(s,h+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,(s)=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=k(this.data,h+2);else break;i=e(k(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=k(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];if(!e.some((h,r)=>r&1&&h==i))e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(Z.prototype),this);if(t.props)e.nodeSet=this.nodeSet.extend(...t.props);if(t.top){let s=this.topRules[t.top];if(!s)throw RangeError(`Invalid top rule name ${t.top}`);e.top=s}if(t.tokenizers)e.tokenizers=this.tokenizers.map((s)=>{let i=t.tokenizers.find((h)=>h.from==s);return i?i.to:s});if(t.specializers)e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find((n)=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=D(r),r});if(t.contextTracker)e.context=t.contextTracker;if(t.dialect)e.dialect=this.parseDialect(t.dialect);if(t.strict!=null)e.strict=t.strict;if(t.wrap)e.wrappers=e.wrappers.concat(t.wrap);if(t.bufferLength!=null)e.bufferLength=t.bufferLength;return e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);if(r>=0)s[r]=!0}let i=null;for(let h=0;h<e.length;h++)if(!s[h])for(let r=this.dialects[e[h]],n;(n=this.data[r++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new U(t,s,i)}static deserialize(t){return new Z(t)}}function k(t,e){return t[e]|t[e+1]<<16}function W(t){let e=null;for(let s of t){let i=s.p.stoppedAt;if((s.pos==s.p.stream.end||i!=null&&s.pos>i)&&s.p.parser.stateFlag(s.state,2)&&(!e||e.score<s.score))e=s}return e}function D(t){if(t.external){let e=t.extend?1:0;return(s,i)=>t.external(s,i)<<1|e}return t.get}
2
- export{ct,R,ve,Z};
1
+ import{mo,T,le,vt,R,I,_t}from"./chunk-index-cbqhzf40.js";class P{constructor(t,e,s,i,h,r,n,o,l,f=0,a){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=l,this.lookAhead=f,this.parent=a}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new P(t,[],e,s,s,0,[],0,i?new w(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),n=h.dynamicPrecedence(i);if(n)this.score+=n;if(s==0){if(i<h.minRepeatTerm&&this.reducePos<this.pos)this.reducePos=this.pos;if(this.pushState(h.getGoto(this.state,i,!0),this.reducePos),i<h.minRepeatTerm)this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0);this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(s-1)*3-(t&262144?6:0),l=o?this.stack[o-2]:this.p.ranges[0].from;if(i<h.minRepeatTerm&&l==this.reducePos&&this.reducePos<this.pos)this.reducePos=this.pos;let f=this.reducePos-l;if(f>=2000&&!((e=this.p.parser.nodeSet.types[i])===null||e===void 0?void 0:e.isAnonymous)){if(l==this.p.lastBigReductionStart)this.p.bigReductionCount++,this.p.lastBigReductionSize=f;else if(this.p.lastBigReductionSize<f)this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=f}let a=o?this.stack[o-1]:0,d=this.bufferBase+this.buffer.length-a;if(i<h.minRepeatTerm||t&131072){let u=h.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,l,u,d+4,!0)}if(t&262144)this.state=this.stack[o];else{let u=this.stack[o-3];this.state=h.getGoto(u,i,!0)}while(this.stack.length>o)this.stack.pop();this.reduceContext(i,l)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this.buffer.length;if(r>0&&this.buffer[r-4]==0&&this.buffer[r-1]>-1){if(e==s)return;if(this.buffer[r-2]>=e){this.buffer[r-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n){while(r>0&&this.buffer[r-2]>s)if(this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4)i-=4}}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i;let n=r.stateFlag(h,1);if(!n&&(i>s||e<=r.maxNode))this.reducePos=i;if(this.pushState(h,n?s:Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode)this.buffer.push(e,s,i,4)}else if(this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode)this.buffer.push(e,s,i,4)}apply(t,e,s,i){if(t&65536)this.reduce(t);else this.shift(t,e,s,i)}useNode(t,e,s){let i=this.p.reused.length-1;if(i<0||this.p.reused[i]!=t)this.p.reused.push(t),i++;let h=this.reducePos=this.pos=s+t.length;if(this.pushState(e,s),this.buffer.push(i,s,h,-1),this.curContext)this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;if(e&&t.buffer[e-4]==0)e-=4;while(e>0&&t.buffer[e-2]>t.reducePos)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;while(t&&i==t.bufferBase)t=t.parent;return new P(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;if(s)this.storeNode(t,this.pos,e,4);this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new B(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;h<e.length;h+=2)if((r=e[h+1])!=this.state&&this.p.parser.hasAction(r,t))i.push(e[h],r);if(this.stack.length<120)for(let h=0;i.length<8&&h<e.length;h+=2){let r=e[h+1];if(!i.some((n,o)=>o&1&&n==r))i.push(e[h],r)}e=i}let s=[];for(let i=0;i<e.length&&s.length<4;i+=2){let h=e[i+1];if(h==this.state)continue;let r=this.split();r.pushState(h,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[i],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(e.includes(i))return;return e.push(i),t.allActions(i,(r)=>{if(r&393216);else if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,l=this.stack.length-n*3;if(l>=0&&t.getGoto(this.stack[l],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){while(!this.p.parser.stateFlag(this.state,2))if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){if(this.curContext)this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){if(this.curContext)this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;if(t<0||this.buffer[t]!=-3)this.storeNode(this.curContext.hash,this.reducePos,this.reducePos,-3,!0)}emitLookAhead(){let t=this.buffer.length-1;if(t<0||this.buffer[t]!=-4)this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new w(this.curContext.tracker,t);if(e.hash!=this.curContext.hash)this.emitContext();this.curContext=e}}setLookAhead(t){if(t<=this.lookAhead)return!1;return this.emitLookAhead(),this.lookAhead=t,!0}close(){if(this.curContext&&this.curContext.tracker.strict)this.emitContext();if(this.lookAhead>0)this.emitLookAhead()}}class w{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class B{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;if(s==0){if(this.stack==this.start.stack)this.stack=this.stack.slice();this.stack.push(this.state,0,0),this.base+=3}else this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class S{constructor(t,e,s){if(this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0)this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new S(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;if(t!=null)this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){if(this.index-=4,this.pos-=4,this.index==0)this.maybeNext()}fork(){return new S(this.stack,this.pos,this.index)}}function x(t,e=Uint16Array){if(typeof t!="string")return t;let s=null;for(let i=0,h=0;i<t.length;){let r=0;for(;;){let n=t.charCodeAt(i++),o=!1;if(n==126){r=65535;break}if(n>=92)n--;if(n>=34)n--;let l=n-32;if(l>=46)l-=46,o=!0;if(r+=l,o)break;r*=46}if(s)s[h++]=r;else s=new e(r)}return s}class b{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}var y=new b;class O{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=y,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;while(h<s.from){if(!i)return null;let r=this.ranges[--i];h-=s.from-r.to,s=r}while(e<0?h>s.to:h>=s.to){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e<this.chunk.length)s=this.pos+t,i=this.chunk.charCodeAt(e);else{let h=this.resolveOffset(t,1);if(h==null)return-1;if(s=h,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let r=this.rangeIndex,n=this.range;while(n.to<=s)n=this.ranges[++r];if(this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>n.to)this.chunk2=this.chunk2.slice(0,n.to-s);i=this.chunk2.charCodeAt(0)}}if(s>=this.token.lookAhead)this.token.lookAhead=s+1;return i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s<this.token.start)throw RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){if(this.chunkOff>=this.chunk.length){if(this.getChunk(),this.chunkOff==this.chunk.length)return this.next=-1}return this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){this.chunkOff+=t;while(this.pos+t>=this.range.to){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}if(this.pos+=t,this.pos>=this.token.lookAhead)this.token.lookAhead=this.pos+1;return this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e)this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1;else this.token=y;if(this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;while(t<this.range.from)this.range=this.ranges[--this.rangeIndex];while(t>=this.range.to)this.range=this.ranges[++this.rangeIndex];if(t>=this.chunkPos&&t<this.chunkPos+this.chunk.length)this.chunkOff=t-this.chunkPos;else this.chunk="",this.chunkOff=0;this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;if(i.to>t)s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e))}return s}}class m{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;F(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}m.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class dt{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?x(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(F(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(!h)i++;if(r==null)break;t.reset(r,t.token)}if(i)t.reset(s,t.token),t.acceptToken(this.elseToken,i)}}dt.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class E{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function F(t,e,s,i,h,r){let n=0,o=1<<i,{dialect:l}=s.p.parser;t:for(;;){if((o&t[n])==0)break;let f=t[n+1];for(let c=n+3;c<f;c+=2)if((t[c+1]&o)>0){let g=t[c];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||H(g,e.token.value,h,r))){e.acceptToken(g);break}}let a=e.next,d=0,u=t[n+2];if(e.next<0&&u>d&&t[f+u*3-3]==65535){n=t[f+u*3-1];continue t}for(;d<u;){let c=d+u>>1,g=f+c+(c<<1),_=t[g],G=t[g+1]||65536;if(a<_)u=c;else if(a>=G)d=c+1;else{n=t[g+2],e.advance();continue t}}break}}function C(t,e,s){for(let i=e,h;(h=t[i])!=65535;i++)if(h==s)return i-e;return-1}function H(t,e,s,i){let h=C(s,i,e);return h<0||C(s,i,t)<h}var p=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),v=null;function N(t,e,s){let i=t.cursor(R.IncludeAnonymous);i.moveTo(e);for(;;)if(!(s<0?i.childBefore(e):i.childAfter(e)))for(;;){if((s<0?i.to<e:i.from>e)&&!i.type.isError)return s<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(t.length,Math.max(i.from+1,e+25));if(s<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return s<0?0:t.length}}class M{constructor(t,e){this.fragments=t,this.minRepeat=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){this.safeFrom=t.openStart?N(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?N(t.tree,t.to+t.offset,-1)-t.offset:t.to;while(this.trees.length)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;while(this.fragment&&this.safeTo<=t)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],i=this.index[e];if(i==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let h=s.children[i],r=this.start[e]+s.positions[i];if(r>t)return this.nextStart=r,null;if(h instanceof I){let n=r>this.lastRepeatPos&&h.type.id>=this.minRepeat;if(r==t||n){let o=r+h.length,l;if(r>=this.safeFrom&&o<=this.safeTo&&(!(l=h.prop(T.lookAhead))||o+l<this.fragment.to)){if(n)this.lastRepeat=h,this.lastRepeatPos=r;if(r==t)return h}else if(r==t)return null}if(this.index[e]++,r+h.length>=Math.max(this.safeFrom,t))this.trees.push(h),this.start.push(r),this.index.push(0)}else this.index[e]++,this.nextStart=r+h.length}}}class L{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((s)=>new b)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let l=0;l<h.length;l++){if((1<<l&r)==0)continue;let f=h[l],a=this.tokens[l];if(s&&!f.fallback)continue;if(f.contextual||a.start!=t.pos||a.mask!=r||a.context!=n)this.updateCachedToken(a,f,t),a.mask=r,a.context=n;if(a.lookAhead>a.end+25)o=Math.max(a.lookAhead,o);if(a.value!=0){let d=e;if(a.extended>-1)e=this.addActions(t,a.extended,a.end,e);if(e=this.addActions(t,a.value,a.end,e),!f.extend){if(s=a,e>d)break}}}while(this.actions.length>e)this.actions.pop();if(o)t.setLookAhead(o);if(!s&&t.pos==this.stream.end)s=new b,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e);return this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new b,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r<h.specialized.length;r++)if(h.specialized[r]==t.value){let n=h.specializers[r](this.stream.read(t.start,t.end),s);if(n>=0&&s.p.parser.dialect.allows(n>>1)){if((n&1)==0)t.value=n>>1;else t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;h<i;h+=3)if(this.actions[h]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:h}=t,{parser:r}=t.p,{data:n}=r;for(let o=0;o<2;o++)for(let l=r.stateSlot(h,o?2:1);;l+=3){if(n[l]==65535)if(n[l+1]==1)l=k(n,l+2);else{if(i==0&&n[l+1]==2)i=this.putAction(k(n,l+2),e,s,i);break}if(n[l]==e)i=this.putAction(k(n,l+1),e,s,i)}return i}}class j{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new O(e,i),this.tokens=new L(t,this.stream),this.topTerm=t.top[1];let{from:h}=i[0];this.stacks=[P.start(this,t.top[0],h)],this.fragments=s.length&&this.stream.end-h>t.bufferLength*4?new M(s,t.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;while(r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<t.length;r++){let n=t[r];for(;;){if(this.tokens.mainToken=null,n.pos>e)s.push(n);else if(this.advanceStack(n,s,t))continue;else{if(!i)i=[],h=[];i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}break}}if(!s.length){let r=i&&W(i);if(r){if(p)console.log("Finish with "+this.stackID(r));return this.stackToTree(r)}if(this.parser.strict){if(p&&i)console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none"));throw SyntaxError("No parse at "+e)}if(!this.recovering)this.recovering=5}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r){if(p)console.log("Force-finish "+this.stackID(r));return this.stackToTree(r.forceAll())}}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r){s.sort((n,o)=>o.score-n.score);while(s.length>r)s.pop()}if(s.some((n)=>n.reducePos>e))this.recovering--}else if(s.length>1){t:for(let r=0;r<s.length-1;r++){let n=s[r];for(let o=r+1;o<s.length;o++){let l=s[o];if(n.sameState(l)||n.buffer.length>500&&l.buffer.length>500)if((n.score-l.score||n.buffer.length-l.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}if(s.length>12)s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)if(s[r].pos<this.minStackPos)this.minStackPos=s[r].pos;return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw RangeError("Can't move stoppedAt forward");this.stoppedAt=t}tryReuse(t,e,s,i){if(!s)return null;let h=t.curContext&&t.curContext.tracker.strict,r=h?t.curContext.hash:0;for(;s;){let n=this.parser.nodeSet.types[s.type.id]!=s.type?-1:this.parser.getGoto(t.state,s.type.id);if(n>-1&&s.length&&(!h||(s.prop(T.contextHash)||0)==r))return t.useNode(s,n,e),s;if(s.children.length==0||s.positions[0]>0)break;let o=s.children[0];if(o instanceof I&&(!i||o.type.id>=this.parser.minRepeatTerm))s=o;else break}return null}advanceStack(t,e,s){let i=t.pos,{parser:h}=this,r=p?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let l=t.reducePos<i&&t.buffer.length&&t.buffer[t.buffer.length-2]<=t.reducePos&&this.fragments.lastRepeatPos==t.reducePos&&this.tryReuse(t,t.reducePos,this.fragments.lastRepeat,!0)||this.tryReuse(t,i,this.fragments.nodeAt(i),!1);if(l){if(p)console.log(r+this.stackID(t)+` (via reuse of ${h.getName(l.type.id)})`);return!0}}let n=h.stateSlot(t.state,4);if(n>0){if(t.reduce(n),p)console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`);return!0}if(t.stack.length>=8400)while(t.stack.length>6000&&t.forceReduce());let o=this.tokens.getActions(t);for(let l=0;l<o.length;){let f=o[l++],a=o[l++],d=o[l++],u=l==o.length||!s,c=u?t:t.split(),g=this.tokens.mainToken;if(c.apply(f,a,g?g.start:c.pos,d),p)console.log(r+this.stackID(c)+` (via ${(f&65536)==0?"shift":`reduce of ${h.getName(f&65535)}`} for ${h.getName(a)} @ ${i}${c==t?"":", split"})`);if(u)return!0;else if(c.pos>i)e.push(c);else s.push(c)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return z(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r<<1],l=e[(r<<1)+1],f=p?this.stackID(n)+" -> ":"";if(n.deadEnd){if(h)continue;if(h=!0,n.restart(),p)console.log(f+this.stackID(n)+" (restarted)");if(this.advanceFully(n,s))continue}let a=n.split(),d=f;for(let u=0;u<10&&a.forceReduce();u++){if(p)console.log(d+this.stackID(a)+" (via force-reduce)");if(this.advanceFully(a,s))break;if(p)d=this.stackID(a)+" -> "}for(let u of n.recoverByInsert(o)){if(p)console.log(f+this.stackID(u)+" (via recover-insert)");this.advanceFully(u,s)}if(this.stream.end>n.pos){if(l==n.pos)l++,o=0;if(n.recoverByDelete(o,l),p)console.log(f+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`);z(n,s)}else if(!i||i.score<a.score)i=a}return i}stackToTree(t){return t.close(),I.build({buffer:S.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(v||(v=new WeakMap)).get(t);if(!e)v.set(t,e=String.fromCodePoint(this.nextStackID++));return e+t}}function z(t,e){for(let s=0;s<e.length;s++){let i=e[s];if(i.pos==t.pos&&i.sameState(t)){if(e[s].score<t.score)e[s]=t;return}}e.push(t)}class U{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||this.disabled[t]==0}}var A=(t)=>t;class xe{constructor(t){this.start=t.start,this.shift=t.shift||A,this.reduce=t.reduce||A,this.reuse=t.reuse||A,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class Z extends _t{constructor(t){super();if(this.wrappers=[],t.version!=14)throw RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let s=Object.keys(t.topRules).map((n)=>t.topRules[n][1]),i=[];for(let n=0;n<e.length;n++)i.push([]);function h(n,o,l){i[n].push([o,o.deserialize(String(l))])}if(t.nodeProps)for(let n of t.nodeProps){let o=n[0];if(typeof o=="string")o=T[o];for(let l=1;l<n.length;){let f=n[l++];if(f>=0)h(f,o,n[l++]);else{let a=n[l+-f];for(let d=-f;d>0;d--)h(n[l++],o,a);l++}}}if(this.nodeSet=new vt(e.map((n,o)=>le.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources)this.nodeSet=this.nodeSet.extend(...t.propSources);this.strict=!1,this.bufferLength=mo;let r=x(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;n<this.specializerSpecs.length;n++)this.specialized[n]=this.specializerSpecs[n].term;this.specializers=this.specializerSpecs.map(D),this.states=x(t.states,Uint32Array),this.data=x(t.stateData),this.goto=x(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map((n)=>typeof n=="number"?new m(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new j(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let l=h+(r>>1);h<l;h++)if(i[h]==t)return o;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let h=this.stateSlot(t,i?2:1),r;;h+=3){if((r=s[h])==65535)if(s[h+1]==1)r=s[h=k(s,h+2)];else if(s[h+1]==2)return k(s,h+2);else break;if(r==e||r==0)return k(s,h+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,(s)=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=k(this.data,h+2);else break;i=e(k(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=k(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];if(!e.some((h,r)=>r&1&&h==i))e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(Z.prototype),this);if(t.props)e.nodeSet=this.nodeSet.extend(...t.props);if(t.top){let s=this.topRules[t.top];if(!s)throw RangeError(`Invalid top rule name ${t.top}`);e.top=s}if(t.tokenizers)e.tokenizers=this.tokenizers.map((s)=>{let i=t.tokenizers.find((h)=>h.from==s);return i?i.to:s});if(t.specializers)e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find((n)=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=D(r),r});if(t.contextTracker)e.context=t.contextTracker;if(t.dialect)e.dialect=this.parseDialect(t.dialect);if(t.strict!=null)e.strict=t.strict;if(t.wrap)e.wrappers=e.wrappers.concat(t.wrap);if(t.bufferLength!=null)e.bufferLength=t.bufferLength;return e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);if(r>=0)s[r]=!0}let i=null;for(let h=0;h<e.length;h++)if(!s[h])for(let r=this.dialects[e[h]],n;(n=this.data[r++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new U(t,s,i)}static deserialize(t){return new Z(t)}}function k(t,e){return t[e]|t[e+1]<<16}function W(t){let e=null;for(let s of t){let i=s.p.stoppedAt;if((s.pos==s.p.stream.end||i!=null&&s.pos>i)&&s.p.parser.stateFlag(s.state,2)&&(!e||e.score<s.score))e=s}return e}function D(t){if(t.external){let e=t.extend?1:0;return(s,i)=>t.external(s,i)<<1|e}return t.get}
2
+ export{dt,E,xe,Z};
@@ -1,2 +1,2 @@
1
- import{y,U}from"./chunk-index-kankja6p.js";var t={unread:{},reads:{},cursor:{},cards:{},rooms:{},lists:{},pages:{}},{emit:R,use:b,subscribe:Dr}=U();function s(e){t={...t,...e},R()}var Ce=(e)=>b(()=>e(t)),Ur=(e)=>t.unread[e]??0,Vr=()=>Object.values(t.unread).reduce((e,r)=>e+r,0);function qr(){return Object.fromEntries(Object.entries(t.unread).filter(([,e])=>e>0))}var d=[],Br=d,Fr=d;function l(e,r){return e.kind!=="system"&&e.id!==0&&(e.principalId===void 0||e.principalId!==r)}var f=(e)=>y.getState().focus===e&&document.visibilityState==="visible";function Jt(e){let r={...t.unread};for(let[o,n]of Object.entries(e))r[o]=n;s({unread:r})}var p=new WeakSet;function g(){let e;for(let[r,o]of Object.entries(y.getState().rooms)){let n=o.view;if(!n||p.has(n))continue;p.add(n),e??={...t.unread},e[r]=n.unread??0}if(e)s({unread:e})}y.subscribe(g);g();function Zi(e,r,o){let n={};if(r)n.reads={...t.reads,[e]:r};if(o!==void 0&&o>(t.cursor[e]??0))n.cursor={...t.cursor,[e]:o};if(n.reads||n.cursor)s(n)}function Gr(e,r){s({cards:{...t.cards,[e]:r}})}var i=(e,r)=>({...e,[r]:(e[r]??0)+1});function vs(e){switch(e.type){case"message":case"host_message":{let r=y.getState().principal?.id;if(!l(e.message,r)||f(e.room))return;s({unread:{...t.unread,[e.room]:(t.unread[e.room]??0)+1}});return}case"read":{let{room:r,principal:o,upTo:n}=e;if(o===y.getState().principal?.id){let a=(y.getState().rooms[r]?.messages??[]).filter((u)=>u.id>n&&l(u,o)).length;s({unread:{...t.unread,[r]:a},cursor:{...t.cursor,[r]:Math.max(n,t.cursor[r]??0)}});return}let m=(t.reads[r]??d).filter((a)=>a.principal!==o),c=t.reads[r]?.find((a)=>a.principal===o);if(c&&c.upTo>=n)return;s({reads:{...t.reads,[r]:[...m,{principal:o,name:e.name,upTo:n,at:e.at}]}});return}case"host_card":{let r=(t.cards[e.room]??d).filter((o)=>o.id!==e.card.id);s({cards:{...t.cards,[e.room]:[...r,e.card].sort((o,n)=>o.at<n.at?-1:o.at>n.at?1:0)}});return}case"room_changed":s({rooms:i(t.rooms,e.room)});return;case"list_changed":s({lists:i(t.lists,e.kind)});return;case"page_changed":s({pages:i(t.pages,e.page)});return;default:return}}
2
- export{Dr,Ce,Ur,Vr,qr,Br,Fr,Jt,Zi,Gr,vs};
1
+ import{y,V}from"./chunk-index-fg42egv9.js";var t={unread:{},reads:{},cursor:{},cards:{},rooms:{},lists:{},pages:{}},{emit:R,use:b,subscribe:Hr}=V();function s(e){t={...t,...e},R()}var Ae=(e)=>b(()=>e(t)),jr=(e)=>t.unread[e]??0,Kr=()=>Object.values(t.unread).reduce((e,r)=>e+r,0);function Jr(){return Object.fromEntries(Object.entries(t.unread).filter(([,e])=>e>0))}var d=[],eo=d,to=d;function l(e,r){return e.kind!=="system"&&e.id!==0&&(e.principalId===void 0||e.principalId!==r)}var f=(e)=>y.getState().focus===e&&document.visibilityState==="visible";function nn(e){let r={...t.unread};for(let[o,n]of Object.entries(e))r[o]=n;s({unread:r})}var p=new WeakSet;function g(){let e;for(let[r,o]of Object.entries(y.getState().rooms)){let n=o.view;if(!n||p.has(n))continue;p.add(n),e??={...t.unread},e[r]=n.unread??0}if(e)s({unread:e})}y.subscribe(g);g();function nr(e,r,o){let n={};if(r)n.reads={...t.reads,[e]:r};if(o!==void 0&&o>(t.cursor[e]??0))n.cursor={...t.cursor,[e]:o};if(n.reads||n.cursor)s(n)}function no(e,r){s({cards:{...t.cards,[e]:r}})}var i=(e,r)=>({...e,[r]:(e[r]??0)+1});function zs(e){switch(e.type){case"message":case"host_message":{let r=y.getState().principal?.id;if(!l(e.message,r)||f(e.room))return;s({unread:{...t.unread,[e.room]:(t.unread[e.room]??0)+1}});return}case"read":{let{room:r,principal:o,upTo:n}=e;if(o===y.getState().principal?.id){let a=(y.getState().rooms[r]?.messages??[]).filter((u)=>u.id>n&&l(u,o)).length;s({unread:{...t.unread,[r]:a},cursor:{...t.cursor,[r]:Math.max(n,t.cursor[r]??0)}});return}let m=(t.reads[r]??d).filter((a)=>a.principal!==o),c=t.reads[r]?.find((a)=>a.principal===o);if(c&&c.upTo>=n)return;s({reads:{...t.reads,[r]:[...m,{principal:o,name:e.name,upTo:n,at:e.at}]}});return}case"host_card":{let r=(t.cards[e.room]??d).filter((o)=>o.id!==e.card.id);s({cards:{...t.cards,[e.room]:[...r,e.card].sort((o,n)=>o.at<n.at?-1:o.at>n.at?1:0)}});return}case"room_changed":s({rooms:i(t.rooms,e.room)});return;case"list_changed":s({lists:i(t.lists,e.kind)});return;case"page_changed":s({pages:i(t.pages,e.page)});return;default:return}}
2
+ export{Hr,Ae,jr,Kr,Jr,eo,to,nn,nr,no,zs};
@@ -0,0 +1,2 @@
1
+ import{h,t,y}from"./chunk-index-fg42egv9.js";import{Ce}from"./chunk-index-6xqz6mg2.js";import{ki}from"./chunk-index-1kwp3spy.js";import{_n}from"./chunk-index-kbgykazq.js";import{je}from"./chunk-index-x4enmj72.js";import{Nt,Ti}from"./chunk-index-yrmqcay4.js";var s=(e)=>e(),m=()=>(h("8dzvysym"),import("./chunk-layout-actions-8dzvysym.js"));function Br(e,l=s){let o=Nt(_n(),e),d=o.kind==="pinned",i=[{id:"pin",label:d?t("Unpin"):t("Pin"),icon:"pin",run:()=>{m().then((r)=>r.pinRoom(e,!d))}},{id:"move",label:t("Move to folder…"),icon:"folder",run:()=>l(()=>Ce({kind:"move",room:e}))}];if(o.kind==="rest")return i;if(je(o.siblings,e,"up"))i.push({id:"up",label:t("Move up"),icon:"up",run:()=>{m().then((r)=>r.nudgeRoom(e,"up"))}});if(je(o.siblings,e,"down"))i.push({id:"down",label:t("Move down"),icon:"down",run:()=>{m().then((r)=>r.nudgeRoom(e,"down"))}});return i}function Xs(e){let l=y.getState(),o=l.folders.find((n)=>n.id===e);if(!o)return;let d=_n().folders.find((n)=>n.id===e)?.rooms??[],i=Ti(d,(n)=>l.rooms[n]?.view?.muted===!0)==="all",r=l.folders.map((n)=>n.id),u=[{id:"rename",label:t("Rename"),icon:"edit",run:()=>Ce({kind:"rename",id:e,name:o.name})}];if(d.length>0)u.push({id:"mute",label:i?t("Unmute the whole folder"):t("Mute the whole folder"),icon:i?"bell":"bell-off",run:()=>{m().then((n)=>n.muteFolder(e,!i))}});if(u.push(...ki(d)),je(r,e,"up"))u.push({id:"up",label:t("Move up"),icon:"up",run:()=>{m().then((n)=>n.nudgeFolder(e,"up"))}});if(je(r,e,"down"))u.push({id:"down",label:t("Move down"),icon:"down",run:()=>{m().then((n)=>n.nudgeFolder(e,"down"))}});return u.push({id:"delete",label:t("Delete folder"),icon:"trash",tone:"danger",run:()=>Ce({kind:"delete",id:e,name:o.name})}),{title:o.name,items:u}}
2
+ export{Br,Xs};
@@ -1,2 +1,2 @@
1
- import{yr}from"./chunk-index-kankja6p.js";function Tn(){if(yr()!==void 0)return new URLSearchParams(window.location.search);let n=window.location.hash,t=n.indexOf("?");return new URLSearchParams(t<0?"":n.slice(t+1))}function tr(n){if(n.origin!==window.location.origin)return!1;let t=yr();if(t){if(n.pathname!==t&&!n.pathname.startsWith(`${t}/`))return!1;return window.history.pushState(null,"",n),window.dispatchEvent(new PopStateEvent("popstate")),!0}if(n.pathname!==window.location.pathname)return!1;return window.location.hash=n.hash,!0}
2
- export{Tn,tr};
1
+ import{wr}from"./chunk-index-fg42egv9.js";function Rn(){if(wr()!==void 0)return new URLSearchParams(window.location.search);let n=window.location.hash,t=n.indexOf("?");return new URLSearchParams(t<0?"":n.slice(t+1))}function cr(n){if(n.origin!==window.location.origin)return!1;let t=wr();if(t){if(n.pathname!==t&&!n.pathname.startsWith(`${t}/`))return!1;return window.history.pushState(null,"",n),window.dispatchEvent(new PopStateEvent("popstate")),!0}if(n.pathname!==window.location.pathname)return!1;return window.location.hash=n.hash,!0}
2
+ export{Rn,cr};
@@ -0,0 +1,2 @@
1
+ import{y,p,O}from"./chunk-index-fg42egv9.js";var r=(e,o,i)=>p(e,{method:o,...i===void 0?{}:{body:JSON.stringify(i)}}),t=(e)=>encodeURIComponent(e),ee={createAgent:(e)=>r("agents","POST",e),archiveAgent:(e)=>r(`agents/${t(e)}/archive`,"POST"),restoreAgent:(e)=>r(`agents/${t(e)}/restore`,"POST"),deleteAgent:(e)=>r(`agents/${t(e)}`,"DELETE"),skills:(e)=>p(`agents/${t(e)}/skills`),setSkills:(e,o)=>r(`agents/${t(e)}/skills`,"PUT",o),archive:()=>p("archive"),createGroup:(e)=>r("groups","POST",e),group:(e)=>p(`groups/${t(e)}`),updateGroup:(e,o)=>r(`groups/${t(e)}`,"PATCH",o),archiveGroup:(e)=>r(`groups/${t(e)}/archive`,"POST"),restoreGroup:(e)=>r(`groups/${t(e)}/restore`,"POST"),deleteGroup:(e)=>r(`groups/${t(e)}`,"DELETE")};async function Te(){let e=await O.rooms();y.dispatch({type:"rooms_loaded",rooms:e.rooms})}
2
+ export{ee,Te};
@@ -0,0 +1,2 @@
1
+ var en=Math.PI*2,wn=8;function kn(n){let t=((n+Math.PI)%en+en)%en-Math.PI;return t===-Math.PI?Math.PI:t}var Un=(n,t)=>kn(t-n);function tr(n){let t=Math.min(Math.max(n,0),8);return{count:1+t,seated:t}}var y=0.62,E=(n)=>Math.min(en/Math.max(n,1),y),tn=(n,t)=>n===0?0:kn(Math.PI+(n-t/2)*E(t)),$t=(n)=>Math.max(4.2,2.6/(2*Math.sin(E(n)/2)));function z(n,t){let o=0,e=Number.POSITIVE_INFINITY;for(let r=0;r<t;r+=1){let u=Math.abs(Un(n,tn(r,t)));if(u<e-0.000000001)e=u,o=r}return o}var Fr=(n,t)=>tn(z(n,t),t);function ls(n,t){if(t.seated===0)return;let o=kn(n+Math.PI),e,r=Number.POSITIVE_INFINITY;for(let u=1;u<=t.seated;u+=1){let s=Math.abs(Un(o,tn(u,t.count)));if(s<r-0.000000001)r=s,e=u}return e}var x=1.65,R=1.06,T=44,N=390,v=4.8,p=0.07,d=3;function H(n,t,o){let{position:e,target:r}=Gr(n),u=S([r[0]-e[0],r[1]-e[1],r[2]-e[2]]),s=S(P(u,[0,1,0])),i=P(s,u),m=[o[0]-e[0],o[1]-e[1],o[2]-e[2]],a=h(m,u),c=Math.tan(Zr(n.fov,t)*Math.PI/360),l=a>0.000001?a:Number.NaN;return{x:h(m,s)/(l*c*t),y:h(m,i)/(l*c),depth:a}}var h=(n,t)=>n[0]*t[0]+n[1]*t[1]+n[2]*t[2],P=(n,t)=>[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]],S=(n)=>{let t=Math.hypot(n[0],n[1],n[2])||1;return[n[0]/t,n[1]/t,n[2]/t]};function Y(n){let t=$t(n),o=[];for(let e=1;e<n;e+=1){let r=tn(e,n),u=Math.cos(r),s=-Math.sin(r);for(let i of[-1,1])for(let m of[0,v])o.push([Math.sin(r)*t+u*i*x,m,Math.cos(r)*t+s*i*x])}return o}function A(n,t,o,e=p,r=e){let u=1-r,s=1-e;return o.every((i)=>{let m=H(n,t,i);return Math.abs(m.x)<=u&&Math.abs(m.y)<=s})}var Ot=2.9,D=0.7,X=0.2,O=0.8;function cs(n,t,o){let e=o[0]-n[0],r=o[2]-n[2],u=Math.hypot(e,r)||1,s=r/u,i=-e/u,m=Ot*D/2,a=Ot*t,c=n[1]+a/2-a*X,l=n[1]+a/2-a*O,M=[];for(let f of[-1,1])for(let k of[c,l])M.push([n[0]+s*f*m,k,n[2]+i*f*m]);return M}function w(n){let t=$t(n),o=[];for(let e=1;e<n;e+=1){let r=tn(e,n);o.push([Math.sin(r)*t,R,Math.cos(r)*t])}return o}function g(n,t){return{...n,r:n.lookR+(n.r-n.lookR)*t,y:n.lookY+(n.y-n.lookY)*t}}function Vn(n,t,o=1.6,e=N){let r=$t(t),u={az:n,r:r+4.4,y:4.4+r*0.1,aim:0,lookR:-1.6,lookY:2.5,roll:0,fov:46};if(!(o>0))return u;let s=Y(t),i=w(t),m=p+T/(Math.max(e,1)/2);for(let a=1;a<=d;a+=0.02){let c=g(u,a);if(A(c,o,s)&&A(c,o,i,p,m))return c}return g(u,d)}function us(n,t){let o=$t(t),e=0.18;return{az:kn(n+0.18),r:Math.max(o-3.9,0.5),y:1.8,aim:-0.18,lookR:o+0.1,lookY:1.7,roll:-0.16,fov:58}}var b=(n,t,o)=>n+(t-n)*o;function ds(n,t,o){return{az:kn(n.az+Un(n.az,t.az)*o),r:b(n.r,t.r,o),y:b(n.y,t.y,o),aim:b(n.aim,t.aim,o),lookR:b(n.lookR,t.lookR,o),lookY:b(n.lookY,t.lookY,o),roll:b(n.roll,t.roll,o),fov:b(n.fov,t.fov,o)}}var wi=(n)=>{let t=Math.min(1,Math.max(0,n));return t<0.5?4*t*t*t:1-(-2*t+2)**3/2},fs=(n)=>{let t=Math.min(1,Math.max(0,n)),o=(u,s,i)=>3*(1-u)*(1-u)*u*s+3*(1-u)*u*u*i+u*u*u,e=0,r=1;for(let u=0;u<24;u++){let s=(e+r)/2;if(o(s,0.7,0.84)<t)e=s;else r=s}return o((e+r)/2,0,0)},F=420,I=450,V=650;function hs(n,t,o,e=!1){if(o)return{ms:0,cut:!0};if(e)return{ms:F,cut:!1,dive:!0};let r=Math.abs(Un(n.az,t.az))/Math.PI;return{ms:Math.round(I+(V-I)*r),cut:!1}}function Gr(n){let t=n.az+n.aim;return{position:[Math.sin(n.az)*n.r,n.y,Math.cos(n.az)*n.r],target:[Math.sin(t)*n.lookR,n.lookY,Math.cos(t)*n.lookR]}}function ps(n,t){let o=tn(n,t),e=$t(t);return{x:Math.sin(o)*e,z:Math.cos(o)*e,yaw:o+Math.PI}}var ms=(n,t)=>-n/Math.max(t,1)*(Math.PI/2),_=32;function gs(n,t,o,e){let r=(u,s,i)=>u-s<_||i-u<_;return r(n,0,e.width)||r(t,0,e.height)||r(n,o.left,o.left+o.width)||r(t,o.top,o.top+o.height)}function Os(n,t){if(Math.abs(n)<0.000001)return"none";if(n<0)return t?"none":"in";return t?"out":"none"}function Zr(n,t){if(!(t>0)||t>=1.2)return n;return Math.min(n*(1+(1.2-t)*0.55),95)}
2
+ export{en,wn,kn,Un,tr,tn,$t,Fr,ls,Ot,cs,Vn,us,ds,wi,fs,hs,Gr,ps,ms,gs,Os,Zr};
@@ -0,0 +1,2 @@
1
+ import{t,te,y,p,O,d,f}from"./chunk-index-fg42egv9.js";import{_i}from"./chunk-index-nsvwbjfe.js";var Sn={dismissAllFinished:(e)=>p("rooms/dismiss-finished-threads",{method:"POST",body:JSON.stringify({rooms:e})}),archiveFinishedHelpers:(e)=>p("rooms/archive-finished-helpers",{method:"POST",body:JSON.stringify(e?{rooms:e}:{})}),restoreHelpers:(e)=>p("rooms/restore-helpers",{method:"POST",body:JSON.stringify({names:e})}),readAll:(e)=>p("rooms/read-all",{method:"POST",body:JSON.stringify({rooms:e})}),unreadAll:(e)=>p("rooms/read-all",{method:"POST",body:JSON.stringify({restore:e})})};var a=()=>y.dispatch({type:"changed"});async function h(e){try{await e()}catch(s){f(d(s),"danger")}a()}async function u(e,s,r,n){try{await s()}catch(i){return f(d(i),"danger"),a(),!1}return y.dispatch({type:"threads_dismissed",rooms:[...e]}),f(r,"info",{label:t("Undo"),run:()=>void h(n)}),!0}function Nr(e){let s=y.getState().rooms[e]?.view?.displayName??e;return u([e],()=>O.dismissThread(e),t("Cleared “{name}”",{name:s}),()=>O.undismissThread(e))}function A(e,s){return u(s,()=>e?O.dismissThreads(e):Promise.all(s.map((r)=>O.dismissThread(r))),te(s.length,"Cleared {count} finished thread","Cleared {count} finished threads"),()=>e?O.undismissThreads(e,s):Promise.all(s.map((r)=>O.undismissThread(r))))}var T=(e)=>Promise.all(Object.entries(e).flatMap(([s,r])=>Array.from({length:Math.ceil(r.length/o)},(n,i)=>O.undismissThreads(s,r.slice(i*o,(i+1)*o))))),o=100,c=500;async function P(e){let s={},r=0;try{for(let i=0;i<e.length;i+=c){let l=await Sn.dismissAllFinished(e.slice(i,i+c));r+=l.dismissed;for(let[m,g]of Object.entries(l.threads))s[m]=[...s[m]??[],...g]}}catch(i){f(d(i),"danger")}let n=Object.values(s).flat();if(n.length===0)return a(),r>0;return y.dispatch({type:"threads_dismissed",rooms:n}),f(te(n.length,"Cleared {count} finished thread","Cleared {count} finished threads"),"info",{label:t("Undo"),run:()=>void h(()=>T(s))}),!0}async function Lr(e){let s=_i(e);if(s.size===0)return;await P([...s.keys()])}async function Xr(e,s){if(s.length===0)return;await A(e,s)}
2
+ export{Sn,Nr,Lr,Xr};
@@ -0,0 +1,2 @@
1
+ import{V}from"./chunk-index-fg42egv9.js";var e,{emit:o,use:n}=V();function Ce(i){e=i,o()}function Si(){if(!e)return;e=void 0,o()}var as=()=>n(()=>e);
2
+ export{Ce,Si,as};
@@ -0,0 +1,2 @@
1
+ import{V}from"./chunk-index-fg42egv9.js";var o=!1,{emit:e,use:i}=V(),si=()=>i(()=>o);function Or(t){if(o===t)return;o=t,e()}
2
+ export{si,Or};
@@ -0,0 +1,2 @@
1
+ import{s,a,r,t,m,e,n,o,ui,D,ke,u,O,f,gn,Do,Uo}from"./chunk-index-fg42egv9.js";import{K}from"./chunk-index-p5jcwjx8.js";import{Ce,Si,as}from"./chunk-index-6xqz6mg2.js";import{jt,er,zr,Ir,Dr}from"./chunk-index-xx8jq73q.js";import{he}from"./chunk-index-s72hmse6.js";import{ee,Te}from"./chunk-index-5zmswz4s.js";import{vs,je,ro}from"./chunk-index-x4enmj72.js";import{ot,Nt}from"./chunk-index-yrmqcay4.js";function A(i){let{room:d}=i,l=u((c)=>{let k=ot(c,(h)=>ke(c,h)),v=Nt(k,d),y=v.kind==="rest"?[]:v.siblings;return{name:c.rooms[d]?.view?.displayName??d,folder:v.kind==="folder"?v.folder:"",pinned:v.kind==="pinned",canUp:je(y,d,"up")!==void 0,canDown:je(y,d,"down")!==void 0}},d),p=u((c)=>c.folders),g=(c)=>{i.onClose(),jt(d,c)},C=l.folder===""&&!l.pinned;return n("div",{className:"stack",children:[e("p",{className:"meta",children:l.name}),n("fieldset",{children:[e("legend",{className:"visually-hidden",children:t("Move to folder…")}),n("ul",{className:"menu",children:[e("li",{children:n("label",{className:"menu-item menu-link",children:[e("input",{type:"radio",name:"move-folder",checked:C,onChange:()=>g(null)}),e("span",{className:"menu-icon",children:e(o,{name:"rooms",size:18})}),e("span",{className:"menu-text",children:e("strong",{children:t("Ungrouped")})})]})}),p.map((c)=>e("li",{children:n("label",{className:"menu-item menu-link",children:[e("input",{type:"radio",name:"move-folder",checked:l.folder===c.id,onChange:()=>g(c.id)}),e("span",{className:"menu-icon",children:e(o,{name:"folder",size:18})}),e("span",{className:"menu-text",children:e("strong",{children:c.name})})]})},c.id)),e("li",{children:n("button",{type:"button",className:"menu-item menu-link",onClick:()=>Ce({kind:"new",room:d}),children:[e("span",{className:"menu-icon",children:e(o,{name:"plus",size:18})}),e("span",{className:"menu-text",children:e("strong",{children:t("New folder…")})})]})})]})]}),l.canUp||l.canDown?n("ul",{className:"menu",children:[l.canUp?e("li",{children:n("button",{type:"button",className:"menu-item menu-link",onClick:()=>{i.onClose(),er(d,"up")},children:[e("span",{className:"menu-icon",children:e(o,{name:"up",size:18})}),e("span",{className:"menu-text",children:e("strong",{children:t("Move up")})})]})}):null,l.canDown?e("li",{children:n("button",{type:"button",className:"menu-item menu-link",onClick:()=>{i.onClose(),er(d,"down")},children:[e("span",{className:"menu-icon",children:e(o,{name:"down",size:18})}),e("span",{className:"menu-text",children:e("strong",{children:t("Move down")})})]})}):null]}):null]})}function F(i){return e(he,{open:i.open,title:t("Move to folder…"),onClose:i.onClose,children:e(A,{room:i.room,onClose:i.onClose})})}function x(i){let{ask:d}=i,[l,p]=r(d.kind==="rename"?d.name:""),[g,C]=r(),[c,k]=r(!1),v=a(null);return s(()=>v.current?.focus(),[]),n("form",{className:"stack",onSubmit:async(h)=>{h.preventDefault();let b;try{b=ro(l)}catch{C(t("Give the folder a name of 1 to 40 characters."));return}k(!0),C(void 0);let w;if(d.kind==="rename")w=await Ir(d.id,b,C)!==void 0;else{let N=await zr(b,C);if(w=N!==void 0,N&&d.room)await jt(d.room,N)}if(k(!1),w)i.onClose()},children:[n("div",{className:"field",children:[e("label",{className:"field-label",htmlFor:"folder-name",children:t("Folder name")}),e("input",{id:"folder-name",type:"text",ref:v,value:l,autoComplete:"off",enterKeyHint:"done",maxLength:vs*2,"aria-invalid":g?!0:void 0,onChange:(h)=>p(h.target.value)}),g?e("p",{className:"field-error",role:"alert",children:g}):null]}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:c,onClick:i.onClose,children:t("Cancel")}),e("button",{type:"submit",disabled:c,children:d.kind==="rename"?t("Rename"):t("Create")})]})]})}function R(){let i=as(),d=a(void 0);if(i)d.current=i;let l=d.current;if(!l)return null;let p=l.kind==="new"||l.kind==="rename";return n(m,{children:[p?e(he,{open:i?.kind==="new"||i?.kind==="rename",title:l.kind==="rename"?t("Rename folder"):t("Add a folder"),onClose:Si,children:e(x,{ask:l,onClose:Si})}):null,l.kind==="delete"?e(K,{open:i?.kind==="delete",title:t("Delete folder"),confirmLabel:t("Delete folder"),tone:"danger",onClose:Si,onConfirm:async()=>{let g="";if(!await Dr(l.id,(c)=>{g=c}))throw Error(g)},children:e("p",{children:t("Delete the folder {name}? Its rooms move to Ungrouped; no room is deleted.",{name:l.name})})}):null,l.kind==="move"?e(F,{open:i?.kind==="move",room:l.room,onClose:Si}):null]})}function E(i){return n(K,{open:i.open,title:t("Turn on yolo mode?"),confirmLabel:t("Turn on yolo mode"),tone:"yolo",...i.restoreFocus?{restoreFocus:i.restoreFocus}:{},onClose:i.onClose,onConfirm:async()=>{await O.setMode(i.room,{yolo:!0})},children:[e("p",{children:t("In this room, the knight's held actions are approved for you, without a card, as soon as they come up.")}),e("p",{children:t("Risky classes still ask: running as another user, deleting files, force pushes, disk, service and firewall changes, and anything that names its own approvers. The host can add more.")}),e("p",{children:t("Every approval it makes is written into the conversation, and a banner stays up while yolo mode is on.")})]})}function M(i){return e(K,{open:i.open,title:t("Start over {name}?",{name:i.name}),confirmLabel:t("Start over"),tone:"danger",...i.restoreFocus?{restoreFocus:i.restoreFocus}:{},onClose:i.onClose,onConfirm:async()=>{await O.startRoomOver(i.room)},children:e("p",{children:t("The current conversation is archived and the next message begins a new one. Long-term memory is kept. A turn that is running finishes first.")})})}function S(i){return e(K,{open:i.open,title:t("Archive {name}?",{name:i.name}),confirmLabel:t("Archive"),tone:"danger",...i.restoreFocus?{restoreFocus:i.restoreFocus}:{},onClose:i.onClose,onConfirm:async()=>{let d=i.room.indexOf("."),l=i.room.slice(d+1);if(i.room.slice(0,d).endsWith(":group"))await ee.archiveGroup(l);else await ee.archiveAgent(l);if(gn(),await Te(),f(t("Archived {name}.",{name:i.name})),ui().key===i.room)D("rooms")},children:e("p",{children:t("{name} stops answering and its schedules are cancelled. A group loses it as a member. The history is kept, and Archived in the room list restores it.",{name:i.name})})})}function lr(){return n(m,{children:[e(L,{}),e(R,{})]})}function L(){let i=Uo(),d=a(void 0);if(i)d.current=i;let l=d.current;if(!l)return null;let p={room:l.room,name:l.name,restoreFocus:l.restoreFocus,onClose:Do};return n(m,{children:[e(E,{open:i?.kind==="yolo",...p}),e(M,{open:i?.kind==="start-over",...p}),e(S,{open:i?.kind==="archive",...p})]})}
2
+ export{lr};
@@ -1,4 +1,4 @@
1
- import{e,n,o}from"./chunk-index-kankja6p.js";var l=new Set;function tn(s,i){if(l.has(s)||typeof document>"u")return;if(l.add(s),typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in Document.prototype)try{let r=new CSSStyleSheet;r.replaceSync(i),document.adoptedStyleSheets=[...document.adoptedStyleSheets,r];return}catch{}let t=document.createElement("style");t.textContent=i,document.head.append(t)}var a=`
1
+ import{e,n,o}from"./chunk-index-fg42egv9.js";var l=new WeakMap;function on(s,i){if(typeof document>"u")return;let t=l.get(document)??new Set;if(t.has(s))return;if(l.set(document,t.add(s)),typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in Document.prototype)try{let c=new CSSStyleSheet;c.replaceSync(i),document.adoptedStyleSheets=[...document.adoptedStyleSheets,c];return}catch{}let r=document.createElement("style");r.textContent=i,document.head.append(r)}var a=`
2
2
  /* A drop-down: the inputs' box with the one chevron of the icon set, turned to point down. */
3
3
  .select {
4
4
  position: relative;
@@ -38,5 +38,5 @@ import{e,n,o}from"./chunk-index-kankja6p.js";var l=new Set;function tn(s,i){if(l
38
38
  font-size: 1rem;
39
39
  }
40
40
  }
41
- `;function Ue({chip:s,className:i,...t}){if((t.size??1)>1||t.multiple===!0)return e("select",{className:i,...t});return tn("select",a),n("span",{className:i?`select ${i}`:"select","data-chip":s||void 0,children:[e("select",{...t}),e(o,{name:"chevron",size:16})]})}
42
- export{tn,Ue};
41
+ `;function qe({chip:s,className:i,...t}){if((t.size??1)>1||t.multiple===!0)return e("select",{className:i,...t});return on("select",a),n("span",{className:i?`select ${i}`:"select","data-chip":s||void 0,children:[e("select",{...t}),e(o,{name:"chevron",size:16})]})}
42
+ export{on,qe};
@@ -1,4 +1,4 @@
1
- import{h}from"./chunk-index-kankja6p.js";var r=!1;function Jn(){if(r||typeof document>"u")return;if(r=!0,typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in Document.prototype)try{let e=new CSSStyleSheet;e.replaceSync(`
1
+ import{h}from"./chunk-index-fg42egv9.js";var r=!1;function ri(){if(r||typeof document>"u")return;if(r=!0,typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in Document.prototype)try{let e=new CSSStyleSheet;e.replaceSync(`
2
2
  .folder-body[hidden] {
3
3
  display: none;
4
4
  }
@@ -422,5 +422,5 @@ import{h}from"./chunk-index-kankja6p.js";var r=!1;function Jn(){if(r||typeof doc
422
422
  transition: none;
423
423
  }
424
424
  }
425
- `,document.head.append(t)}var a=()=>(h("6assr93n"),import("./chunk-layout-actions-6assr93n.js")),ei=(t)=>({mode:"room",key:t,item:(e)=>e.closest("[data-drop-item]"),root:(e)=>e.closest("[data-drop-root]"),onDrop:(e)=>{if(e.type==="room")a().then((o)=>o.dropRoom(t,e.drop))},open:(e)=>void (h("xpg9qcwf"),import("./chunk-folds-xpg9qcwf.js")).then((o)=>o.expandFolder(e))});
426
- export{Jn,ei};
425
+ `,document.head.append(t)}var a=()=>(h("8dzvysym"),import("./chunk-layout-actions-8dzvysym.js")),oi=(t)=>({mode:"room",key:t,item:(e)=>e.closest("[data-drop-item]"),root:(e)=>e.closest("[data-drop-root]"),onDrop:(e)=>{if(e.type==="room")a().then((o)=>o.dropRoom(t,e.drop))},open:(e)=>void (h("a3e22m7x"),import("./chunk-folds-a3e22m7x.js")).then((o)=>o.expandFolder(e))});
426
+ export{ri,oi};
@@ -1,4 +1,4 @@
1
- import{r,e}from"./chunk-index-kankja6p.js";var d=!1;function rt(){if(d||typeof document>"u")return;if(d=!0,typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in Document.prototype)try{let t=new CSSStyleSheet;t.replaceSync(`
1
+ import{r,e}from"./chunk-index-fg42egv9.js";var d=!1;function st(){if(d||typeof document>"u")return;if(d=!0,typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in Document.prototype)try{let t=new CSSStyleSheet;t.replaceSync(`
2
2
  .hpic {
3
3
  flex: none;
4
4
  display: inline-grid;
@@ -948,5 +948,5 @@ import{r,e}from"./chunk-index-kankja6p.js";var d=!1;function rt(){if(d||typeof d
948
948
  right: -1px;
949
949
  box-shadow: 0 0 0 2px var(--surface);
950
950
  }
951
- `,document.head.append(a)}rt();function p(a){if(!a)return;if("file"in a)return`api/files/${encodeURIComponent(a.file)}`;if("principal"in a)return`api/people/${encodeURIComponent(a.principal)}/picture`;return}function f(a){let t=a.trim().split(/\s+/).filter(Boolean),o=[...t[0]??"?"][0]??"?";if(/[\u3400-\u9fff]/.test(o))return o;let i=t.length>1?[...t.at(-1)??""][0]:void 0;return`${o}${i??""}`.toUpperCase()}function h(a){let t=0;for(let o of a)t=(t*31+(o.codePointAt(0)??0))%360;return`hsl(${t} 42% 40%)`}function ot(a){let[t,o]=r(!1),i=a.size??32,n=t?void 0:p(a.picture),s=a.picture&&"initials"in a.picture?a.picture:void 0,l=s?.initials??f(a.name),c=s?.color??h(a.name);return e("span",{className:"hpic",style:{width:i,height:i,fontSize:Math.round(i*0.4),...n?{}:{background:c}},children:n?e("img",{src:n,alt:"",loading:"lazy",decoding:"async",onError:()=>o(!0)}):e("span",{"aria-hidden":"true",children:l})})}
952
- export{rt,ot};
951
+ `,document.head.append(a)}st();function p(a){if(!a)return;if("file"in a)return`api/files/${encodeURIComponent(a.file)}`;if("principal"in a)return`api/people/${encodeURIComponent(a.principal)}/picture`;return}function f(a){let t=a.trim().split(/\s+/).filter(Boolean),o=[...t[0]??"?"][0]??"?";if(/[\u3400-\u9fff]/.test(o))return o;let i=t.length>1?[...t.at(-1)??""][0]:void 0;return`${o}${i??""}`.toUpperCase()}function h(a){let t=0;for(let o of a)t=(t*31+(o.codePointAt(0)??0))%360;return`hsl(${t} 42% 40%)`}function at(a){let[t,o]=r(!1),i=a.size??32,n=t?void 0:p(a.picture),s=a.picture&&"initials"in a.picture?a.picture:void 0,l=s?.initials??f(a.name),c=s?.color??h(a.name);return e("span",{className:"hpic",style:{width:i,height:i,fontSize:Math.round(i*0.4),...n?{}:{background:c}},children:n?e("img",{src:n,alt:"",loading:"lazy",decoding:"async",onError:()=>o(!0)}):e("span",{"aria-hidden":"true",children:l})})}
952
+ export{st,at};
@@ -1,2 +1,2 @@
1
- import{X,s,a,t,e,n,o,Se}from"./chunk-index-kankja6p.js";var C=96,S=0.6,T=220,N=()=>typeof matchMedia==="function"&&matchMedia("(max-width: 719px)").matches;function L(i){let u=a(null),g=a(void 0),{open:h,onClose:P}=i,E=a(i.restoreFocus);E.current=i.restoreFocus;let m=a(!1),p=a(!1),M=X(()=>{let r=u.current;if(r?.open)r.close();if(E.current?.()?.focus(),m.current=!1,p.current)p.current=!1;else P()},[P]),d=X(()=>{let r=u.current;if(!r||m.current)return;if(m.current=!0,Se()){M();return}r.dataset.state="closing",r.style.removeProperty("transform"),setTimeout(M,T)},[M]);s(()=>{let r=u.current;if(!r)return;if(h&&!r.open)r.dataset.state="opening",r.showModal(),requestAnimationFrame(()=>requestAnimationFrame(()=>{r.dataset.state="open"}));if(!h&&r.open&&!m.current)p.current=!0,d()},[h,d]);let b=(r)=>{if(!N())return;if(r.target instanceof Element&&r.target.closest("button, a"))return;g.current={y:r.clientY,at:r.timeStamp,dy:0},r.currentTarget.setPointerCapture(r.pointerId);let c=u.current;if(c)c.dataset.dragging="true"},v=(r)=>{let c=g.current,l=u.current;if(!c||!l)return;let f=Math.max(0,r.clientY-c.y);c.dy=f,l.style.transform=`translate3d(0, ${f}px, 0)`,l.style.setProperty("--sheet-progress",String(1-Math.min(1,f/400)))},y=(r)=>{let c=g.current,l=u.current;if(g.current=void 0,!c||!l)return;delete l.dataset.dragging;let f=c.dy/Math.max(1,r.timeStamp-c.at);if(c.dy>C||f>S){d();return}l.style.removeProperty("transform"),l.style.removeProperty("--sheet-progress")};return n("dialog",{ref:u,className:i.variant==="palette"?"sheet palette":i.size==="wide"?"sheet wide":i.size==="full"?"sheet full":"sheet","aria-label":i.title,onCancel:(r)=>{if(r.target!==r.currentTarget)return;r.preventDefault(),d()},onClick:(r)=>{if(r.target===r.currentTarget)d()},onClose:(r)=>{if(r.target!==r.currentTarget)return;if(!m.current)P()},children:[e("div",{className:"sheet-grab",onPointerDown:b,onPointerMove:v,onPointerUp:y,onPointerCancel:y,children:e("span",{className:"sheet-handle"})}),i.variant==="palette"?null:n("div",{className:"sheet-head",onPointerDown:b,onPointerMove:v,onPointerUp:y,onPointerCancel:y,children:[e("h2",{title:i.title,children:i.title}),e("button",{type:"button",className:"icon-button","aria-label":t("Close"),onClick:d,children:e(o,{name:"close"})})]}),e("div",{className:"sheet-body",children:h?i.children:null})]})}
1
+ import{X,s,a,t,e,n,o,Le}from"./chunk-index-fg42egv9.js";var C=96,S=0.6,T=220,N=()=>typeof matchMedia==="function"&&matchMedia("(max-width: 719px)").matches;function L(i){let u=a(null),g=a(void 0),{open:h,onClose:P}=i,E=a(i.restoreFocus);E.current=i.restoreFocus;let m=a(!1),p=a(!1),M=X(()=>{let r=u.current;if(r?.open)r.close();if(E.current?.()?.focus(),m.current=!1,p.current)p.current=!1;else P()},[P]),d=X(()=>{let r=u.current;if(!r||m.current)return;if(m.current=!0,Le()){M();return}r.dataset.state="closing",r.style.removeProperty("transform"),setTimeout(M,T)},[M]);s(()=>{let r=u.current;if(!r)return;if(h&&!r.open)r.dataset.state="opening",r.showModal(),requestAnimationFrame(()=>requestAnimationFrame(()=>{r.dataset.state="open"}));if(!h&&r.open&&!m.current)p.current=!0,d()},[h,d]);let b=(r)=>{if(!N())return;if(r.target instanceof Element&&r.target.closest("button, a"))return;g.current={y:r.clientY,at:r.timeStamp,dy:0},r.currentTarget.setPointerCapture(r.pointerId);let c=u.current;if(c)c.dataset.dragging="true"},v=(r)=>{let c=g.current,l=u.current;if(!c||!l)return;let f=Math.max(0,r.clientY-c.y);c.dy=f,l.style.transform=`translate3d(0, ${f}px, 0)`,l.style.setProperty("--sheet-progress",String(1-Math.min(1,f/400)))},y=(r)=>{let c=g.current,l=u.current;if(g.current=void 0,!c||!l)return;delete l.dataset.dragging;let f=c.dy/Math.max(1,r.timeStamp-c.at);if(c.dy>C||f>S){d();return}l.style.removeProperty("transform"),l.style.removeProperty("--sheet-progress")};return n("dialog",{ref:u,className:i.variant==="palette"?"sheet palette":i.size==="wide"?"sheet wide":i.size==="full"?"sheet full":"sheet","aria-label":i.title,onCancel:(r)=>{if(r.target!==r.currentTarget)return;r.preventDefault(),d()},onClick:(r)=>{if(r.target===r.currentTarget)d()},onClose:(r)=>{if(r.target!==r.currentTarget)return;if(!m.current)P()},children:[e("div",{className:"sheet-grab",onPointerDown:b,onPointerMove:v,onPointerUp:y,onPointerCancel:y,children:e("span",{className:"sheet-handle"})}),i.variant==="palette"?null:n("div",{className:"sheet-head",onPointerDown:b,onPointerMove:v,onPointerUp:y,onPointerCancel:y,children:[e("h2",{title:i.title,children:i.title}),e("button",{type:"button",className:"icon-button","aria-label":t("Close"),onClick:d,children:e(o,{name:"close"})})]}),e("div",{className:"sheet-body",children:h?i.children:null})]})}
2
2
  export{L};
@@ -1,2 +1,2 @@
1
- function Kn(c,a){let o=c.toLowerCase().replace(/\s+/g,"");if(o==="")return 0;let n=a.toLowerCase(),s=0,t=0,r=0;for(let f of o){let e=n.indexOf(f,t);if(e<0)return;let i=e===0||/[\s\-_./:]/.test(n[e-1]??"");r=e===t?r+1:0,s+=1+(i?4:0)+r*2-Math.min(e-t,6)*0.2,t=e+1}return s-n.length*0.02}
2
- export{Kn};
1
+ function ii(c,a){let o=c.toLowerCase().replace(/\s+/g,"");if(o==="")return 0;let n=a.toLowerCase(),s=0,t=0,r=0;for(let f of o){let e=n.indexOf(f,t);if(e<0)return;let i=e===0||/[\s\-_./:]/.test(n[e-1]??"");r=e===t?r+1:0,s+=1+(i?4:0)+r*2-Math.min(e-t,6)*0.2,t=e+1}return s-n.length*0.02}
2
+ export{ii};