pi-roundtable-web 0.26.0 → 0.26.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 (198) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +23 -7
  3. package/dist/chunk-account-ghq105t4.js +1 -0
  4. package/dist/{chunk-action-menu-rm5cyqkj.js → chunk-action-menu-me0g9qsc.js} +1 -1
  5. package/dist/{chunk-agent-b017vswv.js → chunk-agent-rdv7ekrt.js} +1 -1
  6. package/dist/chunk-arranged-rooms-81rqhx9x.js +1 -0
  7. package/dist/chunk-character-creator-bd426yjw.js +1 -0
  8. package/dist/chunk-codeeditor-ajhgd33t.js +2 -0
  9. package/dist/chunk-confirm-p3mts8mx.js +1 -0
  10. package/dist/{chunk-connectors-hrm06nx8.js → chunk-connectors-bkv3xn83.js} +1 -1
  11. package/dist/{chunk-conversations-e26rrf01.js → chunk-conversations-0e0vbxwr.js} +1 -1
  12. package/dist/{chunk-drag-v41gx2mc.js → chunk-drag-peyb8t0k.js} +1 -1
  13. package/dist/{chunk-entry-jxxb3ath.js → chunk-entry-mv7q8br0.js} +1 -1
  14. package/dist/chunk-folder-list-era3tksh.js +1 -0
  15. package/dist/chunk-folds-hvws0bd5.js +1 -0
  16. package/dist/{chunk-gate-8k61stsc.js → chunk-gate-hc7dd0fx.js} +1 -1
  17. package/dist/chunk-group-scene-dkbpmbh5.js +1 -0
  18. package/dist/chunk-group-table-fqmxgdfw.js +1 -0
  19. package/dist/chunk-host-icons-4xde9ntk.js +1 -0
  20. package/dist/chunk-host-picture-014yzk20.js +1 -0
  21. package/dist/chunk-host-state-t56e5sdy.js +1 -0
  22. package/dist/chunk-host-ui-p1zy9nmp.js +1 -0
  23. package/dist/chunk-index-0fmmvgee.js +2 -0
  24. package/dist/chunk-index-0q15ysrb.js +1 -0
  25. package/dist/chunk-index-0xh24y25.js +2 -0
  26. package/dist/chunk-index-2yebd9tb.js +426 -0
  27. package/dist/chunk-index-4t0r3t3b.js +2 -0
  28. package/dist/chunk-index-5yzfrf7b.js +138 -0
  29. package/dist/{chunk-index-2d0kg096.js → chunk-index-6twb7ccd.js} +2 -2
  30. package/dist/chunk-index-73gh7kgr.js +920 -0
  31. package/dist/chunk-index-7xffskfa.js +8 -0
  32. package/dist/chunk-index-aqw7cy5j.js +1 -0
  33. package/dist/{chunk-index-d1prgfbp.js → chunk-index-b6ca02e8.js} +2 -2
  34. package/dist/chunk-index-b8nvhcx5.js +2 -0
  35. package/dist/{chunk-index-014rjv9k.js → chunk-index-cvbdf2ca.js} +2 -2
  36. package/dist/chunk-index-czdketze.js +2 -0
  37. package/dist/{chunk-index-y8rnq8zf.js → chunk-index-dt9775ka.js} +3 -3
  38. package/dist/chunk-index-eg55mqqe.js +1 -0
  39. package/dist/{chunk-index-xgkd15n3.js → chunk-index-gr6e0hse.js} +1 -1
  40. package/dist/chunk-index-gyary7np.js +13 -0
  41. package/dist/chunk-index-j214tczc.js +1 -0
  42. package/dist/chunk-index-jd6632ef.js +2 -0
  43. package/dist/chunk-index-jw7dtshr.js +2 -0
  44. package/dist/{chunk-index-wnjp6wv0.js → chunk-index-k7t14rwa.js} +2 -2
  45. package/dist/{chunk-index-c07p8k0x.js → chunk-index-kwcx62wb.js} +3 -3
  46. package/dist/{chunk-index-hby0ap91.js → chunk-index-m7fvw92f.js} +2 -2
  47. package/dist/chunk-index-mmg788a1.js +2 -0
  48. package/dist/chunk-index-mq0dacwr.js +2 -0
  49. package/dist/chunk-index-p53ak25v.js +2 -0
  50. package/dist/{chunk-index-rhtvcbsq.js → chunk-index-pk1yxkv4.js} +2 -2
  51. package/dist/{chunk-index-2stynxw6.css → chunk-index-rbcz9jd4.css} +1 -1
  52. package/dist/{chunk-index-km40bhsz.js → chunk-index-rmxbdmn2.js} +2 -2
  53. package/dist/chunk-index-rnxj3z8k.js +2 -0
  54. package/dist/{chunk-index-hssjbr1k.js → chunk-index-snzzfhk3.js} +2 -2
  55. package/dist/chunk-index-v3bmr0nw.js +2 -0
  56. package/dist/{chunk-index-awx6nnta.js → chunk-index-vcyzwtk2.js} +1 -1
  57. package/dist/{chunk-index-nqfkwkfp.js → chunk-index-w2j3njb6.js} +2 -2
  58. package/dist/{chunk-index-e5sd30xy.js → chunk-index-w31c4yjv.js} +2 -2
  59. package/dist/chunk-index-wrm8w165.js +2 -0
  60. package/dist/chunk-index-xh0mg9cw.js +2 -0
  61. package/dist/chunk-index-ybtvvx85.js +2 -0
  62. package/dist/{chunk-index-dhpt8qr9.js → chunk-index-yzsgsvnp.js} +2 -2
  63. package/dist/{chunk-index-66nskrdj.js → chunk-index-z9x4cnzf.js} +2 -2
  64. package/dist/chunk-index-zrvg23jd.js +2 -0
  65. package/dist/chunk-index-zynq0b0w.js +50 -0
  66. package/dist/chunk-lang-css-88v3hp3d.js +1 -0
  67. package/dist/{chunk-lang-dockerfile-hrav55t7.js → chunk-lang-dockerfile-k728ewsf.js} +1 -1
  68. package/dist/{chunk-lang-go-x9ahv6e5.js → chunk-lang-go-wjwgay4v.js} +2 -2
  69. package/dist/chunk-lang-html-07d47es4.js +1 -0
  70. package/dist/chunk-lang-javascript-fmhhgzwd.js +1 -0
  71. package/dist/{chunk-lang-json-hsemyd0r.js → chunk-lang-json-7gd89mvs.js} +1 -1
  72. package/dist/{chunk-lang-markdown-zkwb4c9n.js → chunk-lang-markdown-b6qbe8bt.js} +5 -5
  73. package/dist/{chunk-lang-python-tewx7006.js → chunk-lang-python-3v56y31b.js} +2 -2
  74. package/dist/{chunk-lang-rust-0ydx84s1.js → chunk-lang-rust-kh0z74d1.js} +1 -1
  75. package/dist/{chunk-lang-shell-gq1tmdz4.js → chunk-lang-shell-9zv0zvbx.js} +1 -1
  76. package/dist/{chunk-lang-sql-xt1qyycg.js → chunk-lang-sql-yw6bf3t7.js} +2 -2
  77. package/dist/{chunk-lang-toml-0hamc5fc.js → chunk-lang-toml-tg1r96nq.js} +1 -1
  78. package/dist/chunk-lang-typescript-etjjvr2g.js +1 -0
  79. package/dist/{chunk-lang-xml-wf6h5pt2.js → chunk-lang-xml-ev1mndd4.js} +1 -1
  80. package/dist/{chunk-lang-yaml-7vk521h1.js → chunk-lang-yaml-fz5qpb3r.js} +1 -1
  81. package/dist/chunk-layout-actions-48ecgtkg.js +1 -0
  82. package/dist/{chunk-menu-items-1n9qargb.js → chunk-menu-items-1epy3h0t.js} +2 -2
  83. package/dist/chunk-mode-toggle-fxmfxsa4.js +1 -0
  84. package/dist/chunk-note-row-kd0fy7ee.js +75 -0
  85. package/dist/{chunk-notes-t15bh04m.js → chunk-notes-yb8f057c.js} +1 -1
  86. package/dist/chunk-notice-bell-wr4f1rph.js +1 -0
  87. package/dist/chunk-notices-x07da5bb.js +1 -0
  88. package/dist/chunk-onboarding-csrkbh9z.js +1 -0
  89. package/dist/{chunk-overview-km5vq375.js → chunk-overview-avc2d30t.js} +1 -1
  90. package/dist/{chunk-palette-a8txdgd0.js → chunk-palette-9nhp95bz.js} +1 -1
  91. package/dist/chunk-placement-items-q694dpgk.js +1 -0
  92. package/dist/chunk-profile-6qemf3m7.js +1 -0
  93. package/dist/{chunk-prompt-history-wm9dsy6s.js → chunk-prompt-history-7enzp2p3.js} +1 -1
  94. package/dist/chunk-prompts-nv6mrn0q.js +1 -0
  95. package/dist/chunk-room-confirms-zz7n61y7.js +1 -0
  96. package/dist/{chunk-room-menu-2tm2xtfx.js → chunk-room-menu-rr6nzap1.js} +1 -1
  97. package/dist/{chunk-rooms-menu-button-wxnsxjwc.js → chunk-rooms-menu-button-zbtwj47d.js} +1 -1
  98. package/dist/chunk-schedules-rw57nr0m.js +1 -0
  99. package/dist/{chunk-seat-menu-d3npdtx1.js → chunk-seat-menu-ys5v9abz.js} +1 -1
  100. package/dist/chunk-sheet-hosts-jhvaacst.js +1 -0
  101. package/dist/chunk-skill-editor-sz8an8qr.js +8 -0
  102. package/dist/{chunk-skills-shkdwes8.js → chunk-skills-tnr1h16h.js} +1 -1
  103. package/dist/chunk-switcher-list-17enhrse.js +1 -0
  104. package/dist/chunk-tab-dot-r6brdbmw.js +1 -0
  105. package/dist/chunk-table-r12cja6p.js +1 -0
  106. package/dist/chunk-table-seats-g3t392zz.js +1 -0
  107. package/dist/{chunk-table2d-n26b7gd0.js → chunk-table2d-p3ezsdcj.js} +1 -1
  108. package/dist/{chunk-table3d-8aysyf56.js → chunk-table3d-4x2n2b00.js} +20 -20
  109. package/dist/chunk-thread-actions-qc6ezkha.js +1 -0
  110. package/dist/chunk-transcript-n2s6dher.js +1 -0
  111. package/dist/chunk-where-f3scdydc.js +1 -0
  112. package/dist/chunk-workspace-xs023bxm.js +1 -0
  113. package/dist/chunk-zh-tw-efvmk3fd.js +1 -0
  114. package/dist/index.html +1 -1
  115. package/dist/sw.js +1 -1
  116. package/package.json +2 -2
  117. package/src/api-types.ts +58 -3
  118. package/src/app/app.ts +5 -0
  119. package/src/app/room-log.ts +16 -4
  120. package/src/app/rooms.ts +39 -0
  121. package/src/app/routes.ts +44 -2
  122. package/src/app/socket.ts +45 -9
  123. package/src/app/threads.ts +31 -2
  124. package/src/auth/authenticator.ts +10 -4
  125. package/src/auth/login-page.ts +4 -2
  126. package/src/auth/oidc-pages.ts +2 -0
  127. package/src/auth/oidc.ts +39 -1
  128. package/src/authz.ts +2 -1
  129. package/src/console-server.ts +32 -6
  130. package/src/host/cards.ts +18 -5
  131. package/src/host/context.ts +72 -25
  132. package/src/host/forms.ts +3 -0
  133. package/src/host/frames.ts +8 -1
  134. package/src/host/host-app.ts +6 -4
  135. package/src/host/host-routes.ts +36 -3
  136. package/src/host/room-views.ts +6 -6
  137. package/src/host/rooms-service.ts +16 -1
  138. package/src/host/views.ts +3 -0
  139. package/src/i18n/zh-tw.ts +9 -2
  140. package/src/index.ts +15 -1
  141. package/src/options.ts +36 -0
  142. package/src/page-presentation.ts +47 -2
  143. package/src/pwa.ts +32 -4
  144. package/src/web-app.ts +47 -3
  145. package/src/web-plugin.ts +20 -9
  146. package/dist/chunk-account-hw49gd0d.js +0 -1
  147. package/dist/chunk-arranged-rooms-q5v3dm1r.js +0 -1
  148. package/dist/chunk-character-creator-5dxcvd16.js +0 -1
  149. package/dist/chunk-codeeditor-pyt09fwg.js +0 -2
  150. package/dist/chunk-confirm-521yqmta.js +0 -1
  151. package/dist/chunk-folder-list-b97xk12b.js +0 -1
  152. package/dist/chunk-folds-b8q7eags.js +0 -1
  153. package/dist/chunk-group-scene-dx6wt19m.js +0 -1
  154. package/dist/chunk-group-table-e4jr8r3a.js +0 -1
  155. package/dist/chunk-host-state-g7e7c0k5.js +0 -1
  156. package/dist/chunk-host-ui-x7k6n07v.js +0 -939
  157. package/dist/chunk-index-2qd81wbx.js +0 -2
  158. package/dist/chunk-index-459drsft.js +0 -2
  159. package/dist/chunk-index-4mfj596y.js +0 -2
  160. package/dist/chunk-index-bbsytycb.js +0 -2
  161. package/dist/chunk-index-cq1e9xdz.js +0 -2
  162. package/dist/chunk-index-g351921r.js +0 -1
  163. package/dist/chunk-index-k2qq1gdj.js +0 -2
  164. package/dist/chunk-index-ke9ynm0n.js +0 -2
  165. package/dist/chunk-index-kpscvg85.js +0 -2
  166. package/dist/chunk-index-m0d100mg.js +0 -2
  167. package/dist/chunk-index-mb72snk9.js +0 -2
  168. package/dist/chunk-index-mjqqver5.js +0 -4
  169. package/dist/chunk-index-nwqk447w.js +0 -2
  170. package/dist/chunk-index-pcfhpm8v.js +0 -302
  171. package/dist/chunk-index-q8h8xzbm.js +0 -2
  172. package/dist/chunk-index-r5vszgfs.js +0 -2
  173. package/dist/chunk-index-rjv7vrwd.js +0 -13
  174. package/dist/chunk-index-v23m38p6.js +0 -50
  175. package/dist/chunk-index-va0g7d88.js +0 -1
  176. package/dist/chunk-index-z3k18atc.js +0 -2
  177. package/dist/chunk-lang-css-6bepqpnx.js +0 -1
  178. package/dist/chunk-lang-html-8jc72zt4.js +0 -1
  179. package/dist/chunk-lang-javascript-2p2qtbnf.js +0 -1
  180. package/dist/chunk-lang-typescript-82xf7z2e.js +0 -1
  181. package/dist/chunk-layout-actions-zh7bezk7.js +0 -1
  182. package/dist/chunk-notice-bell-w3y0h0sr.js +0 -1
  183. package/dist/chunk-notices-fa3g7qze.js +0 -1
  184. package/dist/chunk-onboarding-34v3nr17.js +0 -1
  185. package/dist/chunk-placement-items-wgaxsbvs.js +0 -1
  186. package/dist/chunk-profile-ypxdbsk1.js +0 -1
  187. package/dist/chunk-prompts-7mhhq7zs.js +0 -1
  188. package/dist/chunk-room-confirms-t11a1gsw.js +0 -1
  189. package/dist/chunk-schedules-2ft6xxyw.js +0 -1
  190. package/dist/chunk-sheet-hosts-vngvp7wv.js +0 -1
  191. package/dist/chunk-skill-editor-65n2hsq4.js +0 -8
  192. package/dist/chunk-switcher-list-g6hhmr1t.js +0 -1
  193. package/dist/chunk-table-1b6bsq2y.js +0 -1
  194. package/dist/chunk-table-seats-vy1qhdks.js +0 -1
  195. package/dist/chunk-transcript-355faceq.js +0 -1
  196. package/dist/chunk-where-j5qdt8a4.js +0 -1
  197. package/dist/chunk-workspace-vrbs6zx1.js +0 -1
  198. package/dist/chunk-zh-tw-zeg600bk.js +0 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,45 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.26.1] - 2026-10-30
9
+
10
+ ### Added
11
+
12
+ - `HostCard.keep`: a card the host still wants (a ticket's pinned card while the ticket is open) survives its kind's `retention.textDays` sweep for as long as `card` or `updateCard` passes `keep: true`; `updateCard` without it makes the card ordinary again. Adds the migration `web-host-cards-keep` (a `keep` column).
13
+ - `WebApp.rooms.context(room, { limit?, messageChars? })`: a host room's recent messages as the channel-context block `CHANNEL_CONTEXT.read` gives a turn, for a host that starts a turn from a room's `send` hook and has no addressing message. It marks nothing handed over, so a retry reads the same.
14
+ - `auth.onSessionVerified(principalId)` for `oidc`: called when a request or an open socket proves a live session, at most once per session every five minutes, so a host can count a person who only has the app open as present. It is not awaited; an error it throws is logged and never fails the request.
15
+ - Typing `@AI` as the first word of the box works as the toggle, in a host room that offers both ways and in an agent or group room that offers the `@AI` switch for notes. The word counts in any case when a space, a colon, a comma or the end of the text follows it. While it is there the switch shows on and locked, and it returns to the person's own setting when the token is deleted; the page sends the message with an explicit `mode: "turn"` and cuts the leading token (and the space, colon or comma after it) from the text. Only typing counts: `@AI` later in the text, inside an address such as `a@ai.com` or a word such as `@AIX`, in pasted or dropped text, in a restored draft or in a quote is plain text and the message goes as the switch says. This is the page's shorthand only; the server never reads a message's text for it, so a `note` frame whose text starts with `@AI` stays a note, and only an explicit `mode: "turn"` from a viewer who may send turns starts one. `Composer.onSend` gets a third argument, whether the person addressed the agent, and `Composer` takes `onAddressed`; `ModeToggle` takes `locked`. Rooms without the switch are unchanged.
16
+ - Internal notes in an agent or group room: an agent or group room that more than one person reads (the host has more than one owner) gets an `@AI` switch on the composer, on by default. Off, the message is an internal note: it is stored in the room's log with its author, shown live to every other owner and in the history with the author's name and picture and an "Internal note" marker (zh-TW has its own wording), and never given to the agent: no turn runs, it is not in the agent's session, and it is not in any channel context. The server says which rooms take notes: `RoomView.notes` is `true` on the agent and group rooms of a host with more than one owner, absent otherwise, so the page does not guess. A note is a `send` frame with `mode: "note"` (the frame the host rooms already use); a stored note carries `RoomMessage.note: true` (additive column `web_room_messages.note`, migration `web-room-messages-note`). A host with one owner behaves exactly as before: no switch, no new field in the room list or the history, and a `note` frame is still refused as `bad_frame`. The fixture takes `FIXTURE_OWNERS=2` to try it with Ada and Bob.
17
+ - The package entry exports the host-facing API: `WEB_APP` and the types `WebApp`, `HostRoomKind`, `HostPage`, `HostCard`, `Viewer`, `OpenTarget`, `ActionResult`, `LinkProver`, `OnboardingStep` and `Notices`, so a host plugin no longer mirrors them.
18
+ - The `description` option, and `<meta name="description">`, `og:title`, `og:description` and `og:image` on the page, so a search result and a link preview have a title, a line and the mark. Without `description` a line is derived from `title`.
19
+ - `<mount>/icons/mark.svg`, the round-table mark.
20
+ - The tab shows a small red dot on its icon, top-right with a white ring, while anything waits (cards waiting, notices, unread messages), and the title leads with `(N) `. The dotted icon is drawn in the browser from the page's own icon, so a host's `icons.dir` keeps its look; Safari ignores a changed tab icon, so there the title's count is the signal. It is a lazy chunk that loads after the first paint. Unread messages now count in the title too, not only cards.
21
+
22
+ ### Changed
23
+
24
+ - README and the `Notices.raise` doc: a notice's `tag` is the dedupe key, the push tag and the acknowledgement key, visible to the people the notice is for; put no private id in it.
25
+ - A host may name the `table` pane for a member or an admin (`panes: { owner, admin?, member }`, with that tier's `rooms` pane too; the default lists still leave it out). Their table seats the host rooms their kinds let them list, newest first, not agents: the agent rooms stay the owners'. A seat is lit by its room's own `activity` and cards, which reach a socket only for a room the person may read now, and a tap opens the room's page, where the kind's `access` decides what they may write and press. There is no dialogue box, seat menu or "Who's at the table" sheet for them, and no new route. `overview`, `workspace`, `skills` and `connectors` stay owners-only. The owners' table is unchanged.
26
+ - Following a host room now also sends the follower the room's `activity` frame when a turn is already running, so a seat does not wait for the next change to show it.
27
+ - `HostRoomKind.buttons` may return a promise, for a host whose rights source is async.
28
+ - README: `WebApp.rooms`, `.notices`, `.pages`, `.onboarding` and `.push` throw until the plugin started; `notices.onAck` is available only after start.
29
+ - An ordinary folder is a light section header (chevron, name, count, ⋯), left-aligned like the Home and Pinned labels, not the boxed grey card, which stays for the archive. A folded folder shows a small overlapping stack of the pictures of its first four rooms and, when it holds more, how many more (`+2`).
30
+ - An owner can take a finished dispatch thread off the room list: a remove button on each finished row, and "Clear all" in the fold of a room's finished threads. The thread leaves the list for every owner and every open page at once; it is hidden, not deleted, and stays readable by its address and through the links in its room. An open thread cannot be removed (409). The mark is the new column `web_threads.dismissed_at` (migration `web-threads-dismissed`, additive). Routes: `POST api/rooms/<thread>/dismiss`, `POST api/rooms/<room>/dismiss-threads`, and `GET api/rooms/<thread>` for the view of a thread the list does not carry (owners only, like the rest of `api/rooms`).
31
+ - `HostPage.icon` and `HostRoomKind.icon`: an optional name from the console's own icon set (`HOST_ICONS`, type `HostIconName`, exported): `chat`, `link`, `activity`, `users`, `megaphone`, `qr`, `settings`, `bell`, `file`, `list`, `shield`, `lock`, `sparkle`. A page's icon shows in the navigation (the list icon stays the default), a kind's beside its section in the room list. A name outside the set is dropped and the default shows. `ConfigView.pages[].icon` and `.kinds[].icon` carry it. The new glyphs load only when a page names one.
32
+ - A host room where a viewer may send both a note and a turn shows one `@AI` toggle over the composer's bar instead of the two chips "Note" and "Ask the agent": off sends a note for the room's people only, on sends a turn the agent answers, and the box's hint follows ("Write an internal note…" / "Ask AI…", never naming the room as a recipient, in every shipped locale). The toggle stands in the composer's column (it sat at the pane's edge on a wide screen) and is at least 44 px high. A room open to one way only shows that way's hint and no toggle. `Composer` takes `placeholder` and `above`, and `ModeToggle` is a piece of its own, for any room that offers the choice.
33
+ - `HostRoomKind.sendWording`: a kind may word the toggle (`turn.label`) and each way's hint (`note.placeholder`, `turn.placeholder`); text only, a label cut to 40 characters and a placeholder to 100. `HostRoomView.wording` carries it.
34
+
35
+ ### Fixed
36
+
37
+ - Without a session only the icons the page, the manifest and the sign-in pages link answer (`192.png`, `512.png`, `maskable-512.png`, `apple-180.png`, `badge-96.png`, `mark.svg`, `mark-maskable.svg`); another file a host keeps in `icons.dir` stays behind the sign-in.
38
+ - In an agent or group room that more than one owner reads, every owner message was drawn as the viewer's own (right-aligned, accent bubble), so Bob saw Ada's messages as his. A message is the viewer's own only when its author's principal (`RoomMessage.principalId`, which the server already stores and sends on owner messages) is the viewer's; another owner's message is drawn as someone else's, with that person's name and picture, as in host rooms. A message stored without a principal is the viewer's only where one owner reads the room; where several do, it is drawn as an owner nobody can name, never as the viewer's. A room one owner reads draws exactly as before.
39
+ - A folder's header no longer turns into an unreadable light fill with white text when the pointer rests on it (on a phone the highlight stuck after a tap), and its title is left-aligned, not centered. The base rule `button:hover:not(:disabled)` out-specified the header's own style; its hover, press and keyboard focus now tint the label and keep its text colour in every look and scheme.
40
+ - A row of the room list that is held and dragged on an iPhone now lifts and reorders. iOS Safari lets a page stop a finger's scroll only if a non-passive `touchmove` listener existed when the finger went down; the lift added its own after the hold, so the first move scrolled the page and the browser cancelled the drag. While a row that can be lifted is on the page, a no-op non-passive `touchmove` listener is now held.
41
+ - The plain room list (no pin and no folder yet) keeps Agents and Groups by latest activity, as the arranged list and the drawer do. Before, it kept the order the server listed them in, so a room you had just talked to did not move up, even after a reload.
42
+ - Under path routing the manifest and the home-screen icon links come after the page's base, so a page opened at a room's URL (`<mount>/room/<key>`) still finds them.
43
+ - The page now has a tab icon: the round-table mark, linked as `rel="icon"` on the app, the sign-in page and the sign-in flow's pages, so a browser no longer asks the site root for `/favicon.ico` and gets a 404. A host's own `icons.dir` is kept (add a `mark.svg` to it to replace the SVG too).
44
+ - The manifest and the icons answer without a session in `oidc` and `password` mode, so the sign-in page and a link preview have an icon. They were redirected to the sign-in. Nothing else below the mount is open.
45
+ - The served page carries the host's `title` in `<title>` from the first byte; it said `Console` until the script ran.
46
+
8
47
  ## [0.26.0] - 2026-10-30
9
48
 
10
49
  The core peer range is now `>=0.26.0 <0.27.0`.
package/README.md CHANGED
@@ -178,7 +178,7 @@ The owners arrange the room list together: one layout for the whole app, kept on
178
178
  | Where | What it does |
179
179
  |---|---|
180
180
  | A room's menu (long press, right click, or the Menu key; the **⋯** beside a row in arrange mode; or the **⋯** in the room's header) | **Pin** or **Unpin**, **Move to folder…** (a sheet with the folders, Ungrouped and **New folder…**), and **Move up** or **Move down** within the pinned list or the folder. |
181
- | A folder's header | Fold or unfold it (kept per device in `localStorage`, `roundtable-console:folders-collapsed`; the folder that holds the open room shows open, and a folded folder still shows its rooms' waiting cards and working dots). Its **⋯** (or a long press, right click or the Menu key) offers **Rename**, **Mute the whole folder** or **Unmute the whole folder**, **Move up**, **Move down** and **Delete folder** (after a question; its rooms move to Ungrouped, no room is deleted). A bell-slash shows when every room in it is muted, a fainter one when some are. |
181
+ | A folder's header | A light section header (chevron, name, count, ⋯). Fold or unfold it (kept per device in `localStorage`, `roundtable-console:folders-collapsed`; the folder that holds the open room shows open, and a folded folder still shows a small stack of its rooms' pictures, then how many more, and its rooms' waiting cards and working dots). Its **⋯** (or a long press, right click or the Menu key) offers **Rename**, **Mute the whole folder** or **Unmute the whole folder**, **Move up**, **Move down** and **Delete folder** (after a question; its rooms move to Ungrouped, no room is deleted). A bell-slash shows when every room in it is muted, a fainter one when some are. |
182
182
  | The list's **⋯** | **Add a folder**, and **Arrange**, which shows a **⋯** beside every row and a bar to add a folder until **Done**. |
183
183
  | A room row or a folder header, held or dragged | A finger that rests on a row lifts it (a short vibration where the phone has one); dragging then reorders it within its list, moves it into another folder, the pinned list or Ungrouped, and a folded folder opens after the finger rests on it. A held folder header moves the whole folder among the folders. The rows make room as you drag, the list scrolls near its edges, the place it lands is outlined, and Escape or a drop outside every list puts everything back. Letting go without moving opens the row's menu as before. A mouse lifts a row once it moves with the button down. A touch within 32 px of a screen edge never lifts a row (the system keeps that edge), so the menu is the way there. While a row is lifted the lists keep their order, so a message that arrives does not move rows under the finger, and the pinned list and empty folders show as places to drop even when they hold nothing yet. On Android the browser's own long press (its `contextmenu`, at about 400 ms) counts as the hold. Ungrouped is ordered by activity, so a row dragged within it goes back; pin it or put it in a folder to place it. The lift code is a chunk of its own that loads on the first press. |
184
184
 
@@ -222,6 +222,8 @@ Every agent is drawn as its composed character (`pi-roundtable/characters`). The
222
222
 
223
223
  The `table` pane is a council hall: a ring of tall dark-wood podiums, one for each active agent whose room is not muted (the coordinator first) and one low lip at the near edge for you, under torches, banners and a stained-glass window, around a glowing rune circle. The hall is drawn in the characters' own flat, outlined style (a stepped tone gradient and a dark line round every shape, no photographic textures). Dark is the hall at night, light the same hall by day; the Modern and Camelot looks change the banners and the trim, not the hall. Each agent stands behind its podium as a waist-up standee: the character without its frame, cut out with a thin light rim, a dark line and a visible board thickness, turning to the camera within limits. A seat's state comes from the same rules as the room list (`sleepy` sits as `idle`): a thinking seat shows a "…" badge and bobs, a seat with a card waiting a gold "!", a speaking seat has a light on its podium and the concept art's three gold emphasis strokes beside its head; a change of face redraws that one picture once it has stood for 300 ms. More than twelve agents show twelve and a "+N" podium that opens the list.
224
224
 
225
+ This section describes the owners' table. A member or an admin is served the table only when the host names it for their tier, and theirs seats host rooms instead of agents: see [What each tier is served](#what-each-tier-is-served).
226
+
225
227
  - **Cameras.** The overview stands behind your podium, raised. A drag or swipe turns it round the ring and snaps to a podium; the wheel or a pinch moves in on the podium across the ring and back out. A close-up of a speaker stands low inside the ring, tilted a little, with thin speed lines flashing for 400 ms on a new speaker. A turn follows the ring the shorter way and takes 450 to 650 ms. A swipe never starts within 32 px of the screen's edge. Under `prefers-reduced-motion` the camera cuts, with no speed lines, bob or flicker.
226
228
  - **Talking in the scene.** A tap on a podium (or on its name, a button over the plate) turns the camera to that agent and slides up a dialogue box on the agent's own room: a nameplate tab in the agent's color with its picture, the line being said (Markdown, typed out while it streams, a tap shows it whole), the cards waiting for an answer, and the room's own message box, with its unsent text kept per room. **Log** opens the room's whole message list as a sheet over the scene. The address is `#/table/<agent>` (the agent's name or the key of its room): Back returns to the whole ring, a link opens the scene at that agent, and an address that names nobody seated goes back to `#/table`.
227
229
  - **Names.** A seat's name is a button laid over its podium's nameplate, at least 12 px on the screen at any distance, in a font stack that carries Chinese (`system-ui`, PingFang TC, Noto Sans TC, Microsoft JhengHei); the podium's own plate is lettered the same way. The seat's full name and state are its accessible name. Where the names stand over each other (many seats on a phone) the agents are also listed as buttons under the scene.
@@ -316,8 +318,9 @@ A member's socket receives nothing from an agent room, neither as it happens nor
316
318
 
317
319
  ### What each tier is served
318
320
 
319
- `panes` takes a list for the owners and, with `admission: "access"`, `{ owner, admin?, member }` to choose per tier. The default gives a member `rooms` (the host's own rooms only), `conversations`, `notes`, `schedules` and `profile`, of those the host serves; an admin's list is the member's unless given. A member is never served `overview`, `table`, `workspace`, `skills` or `connectors`, and naming one for them stops the start.
321
+ `panes` takes a list for the owners and, with `admission: "access"`, `{ owner, admin?, member }` to choose per tier. The default gives a member `rooms` (the host's own rooms only), `conversations`, `notes`, `schedules` and `profile`, of those the host serves; an admin's list is the member's unless given. A member is never served `overview`, `workspace`, `skills` or `connectors`, and naming one for them stops the start. `table` is the one pane whose name a host may give a member or an admin (it needs that tier's `rooms` pane, and the owners' list must have it too): the default lists leave it out, so it is served only where the host names it.
320
322
 
323
+ - **The round table for members and admins**: the agent rooms are the owners', so a member's or an admin's table seats none of them. It seats the host rooms of every kind they may list (`GET api/host/<kind>`, the same lists and the same kind `access` as their room list, so a room the kind does not give them is no seat), newest first, in the same ring and the same looks. No new route is added: the table asks only for those lists. A seat is lit from its room's own frames, which the page follows by `subscribe` for the seats the scene draws (at most twelve), and a follow is answered only for a room the person may read now: `activity` (thinking, working, a turn already running when they follow) and the cards are addressed to the room's readers, as they are in the room, and a room they may not read sends nothing, however they ask. A room that asks for something in the kind's list (`attention`) sits as waiting. A tap on a seat opens that room's own page, where what the person may write (a note, a turn to the agent, or nothing) and press is decided by the kind's `access` as everywhere else, so the table has no dialogue box, no seat menu and no **Who's at the table** sheet for them (those mute and arrange agent rooms, which are the owners'), and an address `#/table/<seat>` goes back to the whole ring. The "+N" podium opens the room list. The table sends the person nothing of the overview, the files pane, the skills or the presence of the team, and the owners' view is unchanged.
321
324
  - **Conversations**: a member lists and reads only the private conversations the registry records as theirs, found by the registry; `exclude(key, record)` is asked on every list and every transcript read.
322
325
  - **Notes**: their own only. Asking for another person's is `403`. The pane is left out, with a warning, when the host keeps no memory (`MEMORY`); naming it with none is an error.
323
326
  - **Schedules**: their own, whichever of the 0.8 and the current id the schedule names them by; an owner sees every schedule.
@@ -337,7 +340,9 @@ The app is a progressive web app, installable on a phone, tablet or desktop and
337
340
 
338
341
  - `<mount>/manifest.webmanifest` is generated for the mount: its `id`, `start_url` and `scope` are all `<mount>/`, `display` is `standalone`, the name is `title`, and the theme and splash colors follow `appearance.look`. The page links it with `crossorigin="use-credentials"`, so a proxy such as Cloudflare Access that sets a cookie sees it.
339
342
  - `<mount>/sw.js` is the service worker, served `no-cache` and scoped to the mount. It precaches the page's hashed assets and `index.html`, serves assets cache-first and navigations network-first with the cached shell as the offline fallback. It never touches `api/`, `auth/`, `login`, `files/` or `avatars/`, and returns a redirect (a proxy's login) as it came. It caches the shell only, never data, so a shared device keeps nothing after you log out. The round table's 3D scene and the files pane's editor and languages are fetched the first time they are needed and are not precached.
340
- - `<mount>/icons/` serves `192.png`, `512.png`, `maskable-512.png`, `apple-180.png` and `badge-96.png`. The package ships a set; `icons.dir` replaces it with a directory that has the same five names.
343
+ - `<mount>/icons/` serves `192.png`, `512.png`, `maskable-512.png`, `apple-180.png` and `badge-96.png`, and `mark.svg`, the round-table mark. The package ships a set; `icons.dir` replaces it with a directory that has the same five PNG names, and `mark.svg` too if it should be the tab icon.
344
+ - The tab icon is the round-table mark by default. The page, the sign-in page and the pages of the sign-in flow link `<mount>/icons/mark.svg` (when the icon directory has it) and `<mount>/icons/192.png` as `rel="icon"`, so the browser does not ask the site root for `/favicon.ico`. The page also carries `og:title`, `og:description` and `og:image` (`<origin><mount>/icons/512.png`) for link previews.
345
+ - The manifest and the icons answer without a session, in every `auth` mode: they are the same for everyone, and a sign-in page and a link preview need them before anyone has signed in. Nothing else below the mount does.
341
346
 
342
347
  To install: open the page over HTTPS in Chrome, Edge or Safari and use the browser's Install option, or press **Install the app** in Settings where the browser offers it.
343
348
  On iPhone and iPad use Share, then Add to Home Screen, and open the app from the home screen: iOS allows notifications only to an installed app.
@@ -379,6 +384,8 @@ Setup:
379
384
 
380
385
  A notice is something that waits on one person, such as a customer's message or a card to approve. A host raises one with `Notices.raise({ tag, people, title, open, urgency?, via? })` and takes it back with `Notices.resolve(tag)`; `renotify` adds people to an open one. `open` names exactly where a tap goes: `{ room, message? }` (the room, scrolled to that message) or `{ page, query? }`. A notice appears in the bell, with a count on the app icon where the device allows it, and is pushed according to its `urgency`: a normal one waits in the bell during the person's quiet hours, an urgent one rings and stays on screen until dealt with. `via` narrows a notice to named transports (see `push.transports`).
381
386
 
387
+ The `tag` is the notice's dedupe key, the tag of its push and the key of its acknowledgement, so it is not secret from the people the notice is for: their browser sees it. Do not put an id that those people should not see in it (a customer's or a group's id); use a hash or a counter of your own instead.
388
+
382
389
  Tapping a notification or a bell row opens exactly that room or page, whether the app is open (its window comes forward and goes there) or closed (a new window opens at the address; a signed-out person signs in and lands there). A device reports when a notice arrived and when it was opened, which is how the app knows a test notification reached the device.
383
390
 
384
391
  The profile page (`profile`) shows the person's name, picture and tier, the accounts they linked and the ones they can link or unlink, **Shown as** (which linked account names them in the app, or Automatic), and their own quiet hours with a test notification. An account that the host's configuration links cannot be unlinked there.
@@ -500,6 +507,8 @@ A verifier may vouch for members as well as owners, through a proxy that lets th
500
507
 
501
508
  `reauthHours` makes the provider vouch again: past it, the next page load does a silent round trip that refreshes the stored facts and roles, a provider that wants the person sends them through a normal sign-in, and a request to the API or the socket on such a session is answered `401` until then. `storeClaims` keeps the named `id_token` claims with the session, replaced at each sign-in, for a sender that needs, say, a mailbox address.
502
509
 
510
+ `onSessionVerified(principalId)` is called when a request or an open socket proves a live session, at most once per session every five minutes. Use it to count who is present: a host that keeps a linked chat account only while its web person is active can note the person there, even when they only have the app open and call nothing of the host's. It is not awaited, and an error it throws is logged and never fails the request.
511
+
503
512
  ### Upgrading from 0.8
504
513
 
505
514
  The core [Migrating to 0.9](../../docs/migration-0.9.md) guide covers backfill, rollback, and the principal isolation boundary.
@@ -676,7 +685,8 @@ Every option is checked when the plugin is created, so a bad setting stops the h
676
685
  | `push` | on, with an `https` origin | Web Push; its keys are in the table below, and [Notifications](#notifications) describes the whole. |
677
686
  | `icons` | the package's own | `{ dir }`: a directory of the five install icons, see [Install on a device](#install-on-a-device). |
678
687
  | `appearance` | `{ look: "modern" }` | `{ look }`: `modern` or `camelot`. The page's default look and the manifest's splash colors; the owner can switch it in the app. |
679
- | `title` | `Roundtable` | The page's heading, title and the installed app's name. |
688
+ | `title` | `Roundtable` | The page's heading, `<title>` (set in the served HTML, so a tab and a search result have it before the script runs), `og:title` and the installed app's name. |
689
+ | `description` | a line derived from `title` | The page's `<meta name="description">` and `og:description`, for search results and link previews. |
680
690
  | `presentation` | English | `{ locale, messages }`: locale controls dates and document language, and `zh-TW` also selects the [built-in Traditional Chinese wording](#presentation-and-built-in-zh-tw); English source strings are dictionary keys for labels, descriptions, confirmations, and API errors. |
681
691
  | `features` | none | Trusted host integrations, or a factory receiving public plugin setup context; see [Host feature ports](#host-feature-ports). |
682
692
  | `relayNotes` | the remote MCP note | Text that an outside agent's relayed message begins with, taken off before the owner's words are shown. Set it to the same value as the `relayNote` of [pi-roundtable-mcp][mcp] when you changed that one. |
@@ -705,6 +715,7 @@ The `auth` keys:
705
715
  | `auth.endSession` | `false` | `oidc` only: whether Log out also signs out at the provider. |
706
716
  | `auth.reauthHours` | never | `oidc` only: ask the provider again after this many hours of one session. |
707
717
  | `auth.storeClaims` | none | `oidc` only: `id_token` claims kept with the session. |
718
+ | `auth.onSessionVerified` | none | `oidc` only: `(principalId) => void`, called when a request or socket proves a live session (once per session per five minutes). |
708
719
 
709
720
  The `push` keys:
710
721
 
@@ -832,14 +843,19 @@ app.registerRoomKind({ kind: "inbox", label: "Support inbox", list, access, head
832
843
  app.registerPage({ id: "mailboxes", label: "Mailboxes", place: "settings", visible, view, act });
833
844
  ```
834
845
 
846
+ The host-facing types are exported from the package entry: `WEB_APP`, `WebApp`, `HostRoomKind`, `HostPage`, `HostCard`, `Viewer`, `OpenTarget`, `ActionResult`, `LinkProver`, `OnboardingStep` and `Notices`. Keep the `WebApp` object and read `app.rooms`, `.notices`, `.pages`, `.onboarding` and `.push` when you use them: they throw until the web plugin has started, so copying one in `setup` crashes the boot (`registerRoomKind` and `registerPage` work in `setup`). `notices.onAck` can be attached only after start.
847
+
835
848
  A room's key is `<surface>:<kind>.<id>`, with an id of 8 to 64 letters, digits, `-` or `_`. The kind name is lower case and none of `agent`, `group`, `thread` or `home`. Everything is checked when the web service starts.
836
849
 
837
850
  - **Access is the host's, asked every time.** `access(viewer, id)` answers `{ read, send, act }` for each read, frame, send, card answer, upload and file; `undefined` makes the room, its messages and its files a `404` for that person. `send` is `note` (a message for the room's people), `turn` (a message the room's agent answers), both, or neither; `act` lets them press buttons and run actions. `list(viewer, { filter, cursor })` returns the rooms the person may open, and `undefined` hides the kind. `changed(room)` and `accessChanged(principalId)` on `app.rooms` tell the app a header, a list or a person's access may differ.
838
851
  - **Who wrote what.** A host posts with `app.rooms.post(room, { author: { kind, name, label?, principalId?, picture? }, text, files?, reference? })`. The author kinds are `external` (someone outside, shown with the host's label such as "Customer"; plain text with links), `member`, `assistant` (an agent partner; Markdown, raw HTML shown as text) and `notice` (a line of the room's own, such as "Assigned to Mel"; Markdown). `reference` is the host's own id, unique per room, and `byReference` finds it again; `edit` and `remove` change a message. An import may give an earlier `at`, kept within retention.
839
- - **Cards.** `app.rooms.card(room, { title, body, tone?, state?, links?, buttons? })` puts a card in the room; `updateCard` replaces it by id. A button calls the kind's `act(viewer, id, { action, card }, input)`; a button may carry a `form` (text, textarea, url, select with `initial` and `search`, multiselect), and its input is checked against the form on the server before `act` runs. `act` answers `{ ok: true, notice?, open?, url? }` or `{ ok: false, error, field? }`; `open` is a room (with a message) or a page (with a query). Buttons show only while the card's `state` is `open`, and `buttons(viewer, id, card)` may narrow which ones a person sees. A card's `links` are `https` or a path of this origin. Approval and question cards of the room's agent follow the agent's own prompt scope, never `access` or `buttons`.
852
+ - **Recent messages.** `app.rooms.context(room, { limit?, messageChars? })` gives the room's recent messages as the same block `CHANNEL_CONTEXT.read` gives a turn (`{ messages, text }`): what was said since the assistant last posted, the newest `limit` of it (default 15, at most 100), an outsider's words marked `external`, notices left out; `undefined` when there is nothing, and a room that is not one of a registered kind throws. Use it when a turn starts from a room's `send` hook, where no message addressed the assistant. It marks nothing handed over, so a retry of the turn reads the same messages.
853
+ - **Cards.** `app.rooms.card(room, { title, body, tone?, state?, links?, buttons? })` puts a card in the room; `updateCard` replaces it by id. A button calls the kind's `act(viewer, id, { action, card }, input)`; a button may carry a `form` (text, textarea, url, select with `initial` and `search`, multiselect), and its input is checked against the form on the server before `act` runs. `act` answers `{ ok: true, notice?, open?, url? }` or `{ ok: false, error, field? }`; `open` is a room (with a message) or a page (with a query). Buttons show only while the card's `state` is `open`, and `buttons(viewer, id, card)` (sync or async, so it can ask the host's own rights source) may narrow which ones a person sees. A card's `links` are `https` or a path of this origin. Approval and question cards of the room's agent follow the agent's own prompt scope, never `access` or `buttons`.
854
+ - **Writing.** Where a viewer may send both a `note` and a `turn`, the room shows one `@AI` toggle over the composer's bar: off sends a note (for the room's people only), on sends a turn (the agent answers). The box's hint follows the toggle, "Write an internal note…" or "Ask AI…" (the box never names the room as a recipient), and a room remembers the way the person last wrote in. A viewer who may send one way only has no toggle and the hint of that way. A kind words it with `sendWording: { note?: { placeholder }, turn?: { label, placeholder } }`; `turn.label` replaces `@AI` on the toggle. Only text is taken: a label is cut to 40 characters and a placeholder to 100, and a value that is not text is dropped. Typing `@AI` as the first word of the box (any case, followed by a space, a colon, a comma or the end of the text) does the same as turning the toggle on: the toggle shows on, and locked, while the box starts with it and returns to the person's own setting when the token is deleted, and the page sends the message as an explicit `mode: "turn"` with that leading token (and the space, colon or comma after it) cut from the text. Only typing counts: `@AI` later in the text, inside an address such as `a@ai.com` or a longer word, in pasted or dropped text, in a restored draft or in a quote is plain text and the message stays as the toggle says. The same holds in an agent or group room that offers the switch for notes. It is the page's shorthand only: the server never reads a message's text for it, so a `note` frame whose text starts with `@AI` stays a note, and only a frame with an explicit `mode: "turn"` from a viewer who may send turns starts one. A room without the toggle takes `@AI` as plain text.
855
+ - **Icons.** A page or a kind may give `icon`, one of `HOST_ICONS` (type `HostIconName`, both exported by the package): `chat`, `link`, `activity`, `users`, `megaphone`, `qr`, `settings`, `bell`, `file`, `list`, `shield`, `lock` and `sparkle`. A page's icon shows in the navigation (without one, a list); a kind's shows beside its section in the room list (without one, none). A name outside the list shows the default. The glyphs the first page does not draw load only when a page names one, so the first load does not grow.
840
856
  - **Links and pictures.** `app.rooms.link(room, messageId?)` gives the same-origin address that opens a room and highlights a message (`<mount>/room/<key>?message=<id>` with `routing: "path"`, `<mount>/#/room/<key>?message=<id>` with hash routing). `![alt](file:<id>)` in a card, a page or an assistant or notice message shows an image the host saved with `saveFile` (rooms) or `app.pages.saveAsset` (pages): PNG, JPEG or WebP whose bytes prove it, served only to those who may see the room or page. Anything else is shown as text.
841
857
  - **Pages.** A page is at `<mount>/p/<id>` and is built from sections: Markdown, a list of rows (each may open a link and carry buttons), a form with an action, and a card. `place` is `main` (the navigation), `settings` (the Settings pane) or `hidden`. `visible(viewer)` is asked on every fetch and action; a page that is not visible is a `404`. `app.pages.changed(id?)` sends the viewers who may see it a `page_changed` frame and their page fetches the view again.
842
- - **Retention.** A kind's `retention: { textDays, fileDays }` deletes its messages, author names, host cards and files that old, counted from each message's `at`. Without it nothing is deleted.
858
+ - **Retention.** A kind's `retention: { textDays, fileDays }` deletes its messages, author names, host cards and files that old, counted from each message's `at` (a card's from when it was first posted). Without it nothing is deleted. A card the host still wants, such as a ticket's pinned card while the ticket is open, carries `keep: true` in `card` and `updateCard`: the sweep skips it for as long as the host passes `keep: true`, and `updateCard` without it makes the card an ordinary one again.
843
859
  - **Read marks.** The page tells the app how far a person has read (the newest message in view, at most once a second, never while the page is hidden). The app keeps one cursor per person and room, for host rooms and agent rooms alike (among owners), and computes each room's `unread` from it; the list and the drawer show the count, an attention dot where the host sets `attention`, and the room opens with a "new messages" divider where the person stopped. Under each message the people who have read up to it are named: "Seen by 2", with their pictures; a person's own mark is not shown to them.
844
860
  - **The page is lazy.** The room, the lists and the pages load as separate chunks when first opened, so the app's first load is the same size as before.
845
861
 
@@ -850,7 +866,7 @@ The `rooms` pane's page and any client of your own talk to the host in this prot
850
866
  - Page to server: `hello {visible, focus?}`, `visibility`, `focus {room?}`, `send {id, room, text, uploads?}`, `stop {room}`, `approval {prompt, approved}`, `answer {prompt, answer}`, `answers {prompt, answers, note?}`, `cancel {prompt}`; for a host room also `subscribe {room}`, `unsubscribe {room}`, `act {id, room, action, card?, input?}` and `read {room, upTo}`.
851
867
  - Server to page: `ready {protocol, principal, name, uploads: {perMessage, maxBytes}}` (then every open card), `accepted`, `refused {id?, prompt?, code}` (`id` names a refused `send`, `prompt` a refused answer to a card), `message`, `progress` (only for the focused room), `activity {room, typing, stoppable, phase?, agent?, outcome?}` (`phase` is `working` during a tool call and `thinking` otherwise; `agent` names the member speaking in a group round; `outcome` is `done` or `failed` and comes only on the frame where `typing` turns false), `presence {agents: {<name>: {busy}}}` (after `ready` and when it changes; `busy` includes work in Discord channels), `edited` (a stored message changed its text, such as a thread's start line once the thread exists), `prompt`, `prompt_closed {prompt, outcome, note?, by?, answer?, closedAt?}`, `mode`, `auto_approved`, `changed`.
852
868
  - REST under `<mount>/api/`: `session`, `rooms`, `rooms/<key>/messages?before=&limit=` (`{messages, more, cards}`: the cards of the room that opened within the page's span, from the first message's time on, or from the beginning when `more` is false, and before the first message of the next page), `PUT rooms/<key>/mode`, `PUT rooms/<key>/mute` (body `{muted: boolean}`; the room's push is off for every owner while true; a waiting card still pushes), `PUT rooms/<key>/pin` (body `{pinned: boolean, before?: key | null}`) and `PUT rooms/<key>/folder` (body `{folder: id | null, before?: key | null}`; `before` is the room it goes before, none or an unknown room for the end; `400` for Home and a dispatch thread, `404` for an unknown room or folder), `POST folders` (body `{name}`, `201`), `PATCH folders/<id>` (body `{name?, before?: id | null}`), `DELETE folders/<id>`, `PUT folders/<id>/mute` (body `{muted: boolean}`; answers `{muted, rooms}`), all of which answer with the whole layout `{pins, folders}` (except the mute), and `GET rooms` answering `{rooms, pins, folders}`, `POST rooms/<key>/start-over`, `POST uploads`, `DELETE uploads/<id>`, `files/<id>`, `schedules` (`GET`, and `DELETE schedules/<id>`), `agents/<name>` (`GET`, `PATCH`), `GET agents/<name>/prompt-history` (`{versions}`, newest first), `GET prompts` (`{documents}`), `GET` and `PUT prompts/<id>` (body `{text, base}`; `409 {error, conflict, current}` when `base` is not the text in force), `POST prompts/<id>/revert` (body `{base}`; the same `409`), `GET prompts/<id>/history`, `GET` and `PUT skill-docs/<name>` (body `{text, baseHash}`; `409` with `current`), `POST skill-docs` (body `{text}`; `201`), `GET skill-docs/<name>/history`, `PUT agents/<name>/character` (body `{character}`, at most 4 KiB; `400 {error, field}` for a look that is not a character), `POST agents` (body `{name, displayName, prompt, model?, thinking?, task?, character?, skills?}`; `201` with the profile; `400` for what the agent server refuses, `{error, field}` for a look), `POST agents/<name>/archive`, `POST agents/<name>/restore` (the profile), `DELETE agents/<name>` (an archived agent only; `400` for an active one), `GET` and `PUT agents/<name>/skills` (`{skills: [{name, description?, source, builtin, carried, missing?}]}`; the body of `PUT` is `{add?, remove?}`, one change that an unknown or built-in name refuses whole; `404` when the host has no skills), `POST groups` (body `{name, displayName, members, host?}`; `201`), `GET`, `PATCH` (`{displayName?, members?, host?}`) and `DELETE groups/<name>`, `POST groups/<name>/archive` and `POST groups/<name>/restore`, `GET archive` (`{entries}`: the archived agents and groups), `models`, `workspace` (the [files pane](#the-files-pane)'s calls), and for push `GET push/key`, `GET`, `POST` and `DELETE push/subscriptions` and `DELETE push/subscriptions/<id>`. The agents' pictures are at `<mount>/avatars/<hash>.png`.
853
- - Beside the API: `<mount>/manifest.webmanifest`, `<mount>/sw.js`, `<mount>/icons/<name>.png`, `<mount>/theme-init.js`, and in password mode `<mount>/login`, `POST <mount>/auth/login` and `POST <mount>/auth/logout`.
869
+ - Beside the API: `<mount>/manifest.webmanifest`, `<mount>/sw.js`, `<mount>/icons/<name>.png` (and `mark.svg`), `<mount>/theme-init.js`, and in password mode `<mount>/login`, `POST <mount>/auth/login` and `POST <mount>/auth/logout`.
854
870
 
855
871
  A room key from a page must be one of the app's rooms whose agent or group exists; every other key, Discord's included, is refused. Every write needs an owner, whose tier is read again, and REST writes also need the console's `Origin`. A card can be answered by any owner, except a card that is the speaker's alone, which only the speaker's principal answers. After `cardGraceSeconds` (default 120) a turn goes on without the answer and the card stays open for a day; an answer then starts a new turn in the room. The types are in `src/api-types.ts`.
856
872
 
@@ -0,0 +1 @@
1
+ import{h,M,w,e,x}from"./chunk-index-zynq0b0w.js";var a={profile:w(()=>(h("6qemf3m7"),import("./chunk-profile-6qemf3m7.js")).then((o)=>({default:o.ProfilePage}))),notices:w(()=>(h("x07da5bb"),import("./chunk-notices-x07da5bb.js")).then((o)=>({default:o.NoticesPage}))),onboarding:w(()=>(h("csrkbh9z"),import("./chunk-onboarding-csrkbh9z.js")).then((o)=>({default:o.OnboardingPage})))};function n({pane:o}){let t=a[o];return t?e(M,{fallback:e(x,{}),children:e(t,{})}):null}export{n as default};
@@ -1 +1 @@
1
- import{a,ft,o,r,p,e,n,s,Kt,jr}from"./chunk-index-v23m38p6.js";import{I}from"./chunk-index-awx6nnta.js";var k=()=>typeof matchMedia==="function"&&matchMedia("(max-width: 719px)").matches,x={rtMenu:!0},g=()=>Boolean(window.history.state?.rtMenu),E=8,y=(t)=>t?.isConnected?t:null;function b(t){return t.items.map((u)=>n("button",{type:"button",role:u.checked===void 0?"menuitem":"menuitemcheckbox",...u.checked===void 0?{}:{"aria-checked":u.checked},className:"menu-item menu-link","data-tone":u.tone,onClick:()=>t.onChoose(u),children:[u.icon?e("span",{className:"menu-icon","data-tone":u.tone,children:e(s,{name:u.icon,size:18})}):null,e("span",{className:"menu-text",children:e("strong",{children:u.label})}),u.checked?e(s,{name:"check",size:18,className:"menu-check"}):null]},u.id))}function H({menu:t}){let u=o(void 0);if(t)u.current=t;let c=u.current,m=o(!1),v=o(void 0),h=t?.serial;return a(()=>{if(h===void 0)return;return window.history.pushState(x,"",window.location.href),m.current=!0,()=>{if(m.current)m.current=!1,window.history.back()}},[h]),a(()=>{let f=()=>{if(!m.current||g())return;m.current=!1,Kt();let M=v.current;v.current=void 0,M?.()};return window.addEventListener("popstate",f),()=>window.removeEventListener("popstate",f)},[]),e(I,{open:t!==void 0,title:c?.title??"",onClose:Kt,restoreFocus:()=>y(c?.source??null),children:c?e("div",{className:"menu action-items",role:"menu","aria-label":c.title,children:e(b,{items:c.items,onChoose:(f)=>{if(!m.current){Kt(),f.run();return}v.current=f.run,window.history.back()}})}):null})}function T({menu:t}){let u=o(null),[c,m]=r(t.at),{source:v}=t,h=(i)=>{y(v)?.focus(),Kt(),i?.()},f=o(h);f.current=h,ft(()=>{let i=u.current;if(!i)return;let d=i.getBoundingClientRect();m({x:Math.max(E,Math.min(t.at.x,window.innerWidth-d.width-E)),y:Math.max(E,Math.min(t.at.y,window.innerHeight-d.height-E))}),i.querySelector('[role^="menuitem"]')?.focus()},[t.serial]),a(()=>{let i=(l)=>{if(l.target instanceof Node&&u.current?.contains(l.target))return;Kt()},d=()=>Kt();return document.addEventListener("pointerdown",i,!0),document.addEventListener("wheel",i,{capture:!0,passive:!0}),document.addEventListener("touchmove",i,{capture:!0,passive:!0}),window.addEventListener("resize",d),()=>{document.removeEventListener("pointerdown",i,!0),document.removeEventListener("wheel",i,!0),document.removeEventListener("touchmove",i,!0),window.removeEventListener("resize",d)}},[]);let M=(i)=>{let d=[...u.current?.querySelectorAll('[role^="menuitem"]')??[]],l=d.indexOf(document.activeElement),w=(L)=>{i.preventDefault(),d[(L+d.length)%d.length]?.focus()};switch(i.key){case"Escape":i.preventDefault(),i.stopPropagation(),f.current();return;case"ArrowDown":return w(l+1);case"ArrowUp":return w(l<0?-1:l-1);case"Tab":return w(i.shiftKey?l<0?-1:l-1:l+1);case"Home":return w(0);case"End":return w(-1)}};return e("div",{ref:u,className:"action-popover",role:"menu","aria-label":t.title,tabIndex:-1,style:{left:`${c.x}px`,top:`${c.y}px`},onKeyDown:M,children:e(b,{items:t.items,onChoose:(i)=>h(i.run)})})}function O(){let t=jr(),u=o(void 0);if(t&&u.current?.serial!==t.serial)u.current={serial:t.serial,sheet:k()};let c=Boolean(t&&u.current?.sheet);return n(p,{children:[e(H,{menu:c?t:void 0}),t&&!c?e(T,{menu:t},t.serial):null]})}export{O as ActionMenuHost};
1
+ import{a,yt,o,r,m,e,n,s,an,hs}from"./chunk-index-zynq0b0w.js";import{I}from"./chunk-index-vcyzwtk2.js";var k=()=>typeof matchMedia==="function"&&matchMedia("(max-width: 719px)").matches,x={rtMenu:!0},g=()=>Boolean(window.history.state?.rtMenu),E=8,y=(t)=>t?.isConnected?t:null;function b(t){return t.items.map((u)=>n("button",{type:"button",role:u.checked===void 0?"menuitem":"menuitemcheckbox",...u.checked===void 0?{}:{"aria-checked":u.checked},className:"menu-item menu-link","data-tone":u.tone,onClick:()=>t.onChoose(u),children:[u.icon?e("span",{className:"menu-icon","data-tone":u.tone,children:e(s,{name:u.icon,size:18})}):null,e("span",{className:"menu-text",children:e("strong",{children:u.label})}),u.checked?e(s,{name:"check",size:18,className:"menu-check"}):null]},u.id))}function H({menu:t}){let u=o(void 0);if(t)u.current=t;let c=u.current,f=o(!1),v=o(void 0),p=t?.serial;return a(()=>{if(p===void 0)return;return window.history.pushState(x,"",window.location.href),f.current=!0,()=>{if(f.current)f.current=!1,window.history.back()}},[p]),a(()=>{let h=()=>{if(!f.current||g())return;f.current=!1,an();let M=v.current;v.current=void 0,M?.()};return window.addEventListener("popstate",h),()=>window.removeEventListener("popstate",h)},[]),e(I,{open:t!==void 0,title:c?.title??"",onClose:an,restoreFocus:()=>y(c?.source??null),children:c?e("div",{className:"menu action-items",role:"menu","aria-label":c.title,children:e(b,{items:c.items,onChoose:(h)=>{if(!f.current){an(),h.run();return}v.current=h.run,window.history.back()}})}):null})}function T({menu:t}){let u=o(null),[c,f]=r(t.at),{source:v}=t,p=(i)=>{y(v)?.focus(),an(),i?.()},h=o(p);h.current=p,yt(()=>{let i=u.current;if(!i)return;let d=i.getBoundingClientRect();f({x:Math.max(E,Math.min(t.at.x,window.innerWidth-d.width-E)),y:Math.max(E,Math.min(t.at.y,window.innerHeight-d.height-E))}),i.querySelector('[role^="menuitem"]')?.focus()},[t.serial]),a(()=>{let i=(l)=>{if(l.target instanceof Node&&u.current?.contains(l.target))return;an()},d=()=>an();return document.addEventListener("pointerdown",i,!0),document.addEventListener("wheel",i,{capture:!0,passive:!0}),document.addEventListener("touchmove",i,{capture:!0,passive:!0}),window.addEventListener("resize",d),()=>{document.removeEventListener("pointerdown",i,!0),document.removeEventListener("wheel",i,!0),document.removeEventListener("touchmove",i,!0),window.removeEventListener("resize",d)}},[]);let M=(i)=>{let d=[...u.current?.querySelectorAll('[role^="menuitem"]')??[]],l=d.indexOf(document.activeElement),w=(L)=>{i.preventDefault(),d[(L+d.length)%d.length]?.focus()};switch(i.key){case"Escape":i.preventDefault(),i.stopPropagation(),h.current();return;case"ArrowDown":return w(l+1);case"ArrowUp":return w(l<0?-1:l-1);case"Tab":return w(i.shiftKey?l<0?-1:l-1:l+1);case"Home":return w(0);case"End":return w(-1)}};return e("div",{ref:u,className:"action-popover",role:"menu","aria-label":t.title,tabIndex:-1,style:{left:`${c.x}px`,top:`${c.y}px`},onKeyDown:M,children:e(b,{items:t.items,onChoose:(i)=>p(i.run)})})}function O(){let t=hs(),u=o(void 0);if(t&&u.current?.serial!==t.serial)u.current={serial:t.serial,sheet:k()};let c=Boolean(t&&u.current?.sheet);return n(m,{children:[e(H,{menu:c?t:void 0}),t&&!c?e(T,{menu:t},t.serial):null]})}export{O as ActionMenuHost};
@@ -1 +1 @@
1
- import{a,e,K,d,v,Fe}from"./chunk-index-v23m38p6.js";function g({name:o}){let i=d((t)=>t.listed),r=d((t)=>Object.values(t.rooms).find((m)=>m.view?.kind==="agent"&&m.view.name===o)?.view?.key,o);return a(()=>{if(r)K("room",r,{replace:!0}),Fe(o);else if(i)K("rooms",void 0,{replace:!0})},[r,i,o]),e("div",{className:"page",children:e(v,{})})}export{g as AgentPage};
1
+ import{a,e,K,d,x,Ye}from"./chunk-index-zynq0b0w.js";function g({name:o}){let i=d((t)=>t.listed),r=d((t)=>Object.values(t.rooms).find((m)=>m.view?.kind==="agent"&&m.view.name===o)?.view?.key,o);return a(()=>{if(r)K("room",r,{replace:!0}),Ye(o);else if(i)K("rooms",void 0,{replace:!0})},[r,i,o]),e("div",{className:"page",children:e(x,{})})}export{g as AgentPage};
@@ -0,0 +1 @@
1
+ import{h,M,w,J,A,o,t,m,e,n,s,Ie,d,_,k,ye,Bt,ln,ne,Mi,Kn,ur,Tn,Jn,dr}from"./chunk-index-zynq0b0w.js";import{Me}from"./chunk-index-wrm8w165.js";import{In,Dn,Un,Xt}from"./chunk-index-2yebd9tb.js";import{Ln}from"./chunk-index-4t0r3t3b.js";import{Rt}from"./chunk-index-zrvg23jd.js";In();var O=w(()=>(h("era3tksh"),import("./chunk-folder-list-era3tksh.js")).then((a)=>({default:a.FolderList}))),Z=J(function(c){let{view:r}=c,p=Xt(()=>Bt(r.key),r.home?void 0:Dn(r.key));return e(ur,{...c,press:p,item:{...r.home?{}:{"data-drop-item":"","data-key":r.key},...c.arranging?{"data-arranging":""}:{}},after:c.arranging?e("button",{type:"button",className:"icon-button row-more","aria-haspopup":"menu","aria-label":t("Room menu"),onClick:(u)=>{let g=u.currentTarget;Bt(r.key).then((i)=>{if(!i)return;let y=g.getBoundingClientRect();ye({...i,at:{x:y.left,y:y.bottom},via:"key",source:g})},()=>{return})},children:e(s,{name:"more",size:18})}):null})});function P(a){let{now:c}=ne(),{timeZone:r}=k(),p=Tn(a.rooms);return e("ul",{className:"room-list",children:p.map(({key:u,...g})=>{let i=a.threads[u];return e(Z,{...g,active:u===a.active,now:c,timeZone:r,arranging:a.arranging,...i?{threads:e(Jn,{open:i.open,closed:i.closed,active:a.active,parent:u})}:{}},u)})})}function v(a){let r=Tn(a.rooms).length===0;if(r&&a.zone?.kind!=="pinned")return null;return n("section",{className:"stack",...r?{"data-empty":""}:{},...a.zone?{"data-drop-zone":a.zone.kind,"data-zone-id":a.zone.id}:{},children:[e("h2",{className:"section-title",children:a.title}),r?null:e(P,{rooms:a.rooms,threads:a.threads,active:a.active,arranging:a.arranging})]})}function re(a){let c=Boolean(k().kinds?.length),r=d((l)=>JSON.stringify({listed:l.listed,...Rt(l,(K)=>Ie(l,K))})),p=Un(),u=o(r);if(!p)u.current=r;let g=u.current,{listed:i,...y}=A(()=>JSON.parse(g),[g]),{home:z,pinned:S,folders:N,restAgents:T,restGroups:D,rest:C,threads:L,orphans:f}=y,R=Mi(),F=z.length+S.length+C.length===0&&N.every((l)=>l.rooms.length===0)&&f.open.length+f.closed.length===0,b={threads:L,active:a.active,arranging:R};return n("div",{className:"page","data-column":a.active?"":void 0,"data-drop-root":"",children:[n("header",{className:"page-head",children:[e("h1",{children:t("Rooms")}),n("div",{className:"actions",children:[n("button",{type:"button",className:"header-button search-button",onClick:a.onSearch,children:[e(s,{name:"search",size:16}),e("span",{children:t("Find a room")}),e("kbd",{children:"⌘K"})]}),i?e("button",{type:"button",className:"header-button icon-button","aria-haspopup":"menu","aria-label":t("Folders and order"),onClick:(l)=>Ln(l.currentTarget),children:e(s,{name:"more",size:18})}):null,e("button",{type:"button",className:"header-button icon-button","aria-label":t("Add"),"aria-haspopup":"menu",onClick:(l)=>ln(l.currentTarget),children:e(s,{name:"plus"})})]})]}),R?n("div",{className:"arrange-bar",children:[n("button",{type:"button",className:"secondary",onClick:()=>Me({kind:"new"}),children:[e(s,{name:"plus",size:16}),e("span",{children:t("Add a folder")})]}),e("button",{type:"button",onClick:()=>Kn(!1),children:t("Done")})]}):null,i&&F&&!c?e(_,{children:t("No rooms yet. Rooms appear when the team has an agent.")}):null,!i?n("div",{className:"stack","aria-busy":"true",children:[e("div",{className:"skeleton"}),e("div",{className:"skeleton"}),e("div",{className:"skeleton"})]}):null,e(v,{title:t("Home"),rooms:z,...b}),e(v,{title:t("Pinned"),rooms:S,zone:{kind:"pinned",id:"pinned"},...b}),N.length>0?e("div",{className:"stack folder-list","data-folder-list":"",children:e(M,{fallback:e("div",{className:"skeleton","aria-busy":"true"}),children:e(O,{folders:N,active:a.active,listed:i,rooms:(l)=>e(P,{rooms:l,threads:L,active:a.active,arranging:R})})})}):null,N.length>0?e(v,{title:t("Ungrouped"),rooms:C,zone:{kind:"rest",id:"rest"},...b}):n(m,{children:[e(v,{title:t("Agents"),rooms:T,zone:{kind:"rest",id:"rest-agents"},...b}),e(v,{title:t("Groups"),rooms:D,zone:{kind:"rest",id:"rest-groups"},...b})]}),f.open.length+f.closed.length>0?n("section",{className:"stack",children:[e("h2",{className:"section-title",children:t("Dispatch threads")}),e(Jn,{open:f.open,closed:f.closed,active:a.active})]}):null,e(dr,{active:a.active})]})}export{re as ArrangedRoomsPage};
@@ -0,0 +1 @@
1
+ import{Ue,Ft,F,ei,dn}from"./chunk-index-z9x4cnzf.js";import{J,tr,a,D,A,o,r,t,c,m,e,n,Zn,oe,y,u,O,cn,de,Ve,Te}from"./chunk-index-zynq0b0w.js";import{j}from"./chunk-index-w31c4yjv.js";import{I}from"./chunk-index-vcyzwtk2.js";var fe={"hat.none":"No hat","hat.goggcap":"Leather cap","hat.tallcap":"Burgundian felt cap","hat.softcap":"Soft cap","hat.hardhat":"Iron skullcap","hat.fcap":"Hunter's cap","hat.winghelm":"Winged helm","hat.helm":"Helm","hat.mortar":"Biretta","hat.beret":"Chaperon","hat.goggles":"Pointed cap","hat.tricorn":"Pilgrim hat","hat.sailor":"Straw hat","hat.kettle":"Kettle hat","hat.cavalier":"Feathered hat","hat.toque":"Linen cook's cap","hair.none":"No hair","beard.none":"No beard","accessory.none":"No accessory","prop.beads":"Prayer beads","prop.marotte":"Marotte","prop.map":"Chart","prop.flask":"Alchemist's phial","prop.telescope":"Astrolabe","prop.wrench":"Dividers","outfit.surplice":"Surplice","outfit.overalls":"Work jerkin","outfit.armor":"Mail hauberk","outfit.apron":"Smith's apron","outfit.chef":"Cook's tunic","outfit.coat":"Doublet","outfit.vest":"Pourpoint","outfit.sailor":"Mariner's tunic","hair.bob":"Bob","hair.bun":"Bun","hair.ponytail":"Ponytail"},Y=(i)=>i.charAt(0).toUpperCase()+i.slice(1);function S(i,l){let h=`character.${i}.${l}`,b=t(h);if(b!==h)return b;if(i==="class")return F.classes[l]?.label??Y(l);return fe[`${i}.${l}`]??Y(l)}function Z(i){let l=`character.jobs.${i}`,h=t(l);return h!==l?h:F.classes[i]?.jobs??""}var z=[{field:"hat",title:c("Hat"),ids:F.hats},{field:"outfit",title:c("Outfit"),ids:F.outfits},{field:"prop",title:c("Prop"),ids:F.props},{field:"hair",title:c("Hair"),ids:F.hair},{field:"beard",title:c("Beard"),ids:["none",...F.beards]},{field:"accessory",title:c("Accessory"),ids:["none",...F.accessories]}],me=new Set(["class","colors","palette","build","skin","hairColor",...z.map((i)=>i.field)]),re=Object.keys(F.palettes),ee={idle:c("Idle"),thinking:c("Thinking"),working:c("Working"),waiting:c("Waiting for you"),done:c("Done"),error:c("Error"),sleepy:c("Sleepy")},he={slim:c("Slim"),regular:c("Regular"),stout:c("Stout")};function W(i){return{class:i.class,outfit:i.outfit,hat:i.hat,prop:i.prop,hair:i.hair,beard:i.beard,accessory:i.accessory,build:i.build,skin:i.skin,hairColor:i.hairColor,colors:{...i.colors}}}var te=(i)=>JSON.stringify(W(i)),k=(i)=>i[Math.floor(Math.random()*i.length)];function be(){return{class:k(Ue),outfit:k(F.outfits),hat:k(F.hats),prop:k(F.props),hair:k(F.hair),beard:k(["none",...F.beards]),accessory:k(["none",...F.accessories]),build:k(["slim","regular","stout"]),skin:k([0,1,2,3,4,5]),hairColor:k(F.hairColors),palette:k(re)}}var ie=J(function(l){return n("button",{type:"button",className:"creator-tile","aria-pressed":l.pressed,title:l.hint?`${l.label} — ${l.hint}`:l.label,onClick:l.onPick,...l.data,children:[e(de,{spec:l.spec,size:l.size,live:!1}),e("span",{children:l.label})]})});function ge(i,l,h){let b=JSON.stringify({...i,[l]:0});return A(()=>h.map((d)=>({...i,[l]:d})),[b,l,h])}function pe(){let i=o(null),[l,h]=r();return a(()=>{let b=i.current;if(!b)return;let d=()=>{let v=b.scrollLeft>1,P=b.scrollLeft+b.clientWidth<b.scrollWidth-1;h(v&&P?"both":P?"end":v?"start":void 0)};d(),b.addEventListener("scroll",d,{passive:!0});let g=typeof ResizeObserver>"u"?void 0:new ResizeObserver(d);return g?.observe(b),()=>{b.removeEventListener("scroll",d),g?.disconnect()}},[]),[i,l]}function ye(i){let{part:l}=i,h=ge(i.shown,l.field,l.ids),[b,d]=pe();return e("div",{className:"creator-strip",ref:b,"data-more":d,children:l.ids.map((g,v)=>e(ie,{data:{[`data-${l.field}`]:g},spec:h[v],size:44,label:S(l.field,g),pressed:i.draft[l.field]===g,onPick:()=>i.onPick(g)},g))})}function M(i){return e("button",{type:"button",className:"creator-swatch","aria-pressed":i.pressed,"aria-label":i.label,title:i.label,style:{background:i.background},onClick:i.onPick,...i.data})}function N(i){return n("div",{className:"creator-field","data-field":i.field,children:[i.title?e("h3",{children:i.title}):null,i.children,i.error?e("p",{className:"field-error",role:"alert",children:i.error}):null]})}function Me(i){let[l,h]=r(i.character),b=tr(l),[d,g]=r({}),[v,P]=r(!1),[T,ne]=r("idle"),[U,E]=r(),[R,_]=r(),G=Te("(max-width: 719px)"),V=o(null),B=D(),se=Ve(l),le=cn(),L=te(l)!==te(i.character);a(()=>h(i.character),[i.character]),a(()=>{if(!L||i.onPick)return;let s=(p)=>p.preventDefault(),f=(p)=>{if(p.button!==0||p.metaKey||p.ctrlKey||p.shiftKey||p.altKey)return;let w=p.target instanceof Element?p.target.closest("a"):null;if(!w||w.target||w.hasAttribute("download"))return;if(V.current?.contains(w))return;p.preventDefault(),p.stopPropagation(),E({kind:"link",anchor:w})},K=Zn((p)=>E({kind:"navigate",proceed:p}));return window.addEventListener("beforeunload",s),document.addEventListener("click",f,!0),()=>{K(),window.removeEventListener("beforeunload",s),document.removeEventListener("click",f,!0)}},[L,i.onPick]);let C=(s)=>{g({}),h((f)=>ei(s,f))},ce=async()=>{if(i.onPick){i.onPick(W(l),l);return}P(!0),g({});try{let s=await y.setCharacter(i.name,W(l));i.onSaved?.(s),O(t("Saved."))}catch(s){let f=s instanceof oe&&s.field?s.field.split(".")[0]:void 0,K=f&&me.has(f)?f:"*";g({[K]:u(s)})}finally{P(!1)}},ue=async()=>{let s=U;if(h(i.character),g({}),s?.kind==="link")setTimeout(()=>s.anchor.click(),0);else if(s?.kind==="navigate")s.proceed()},q=e(N,{field:"class",title:t("Class"),error:d.class,children:e("div",{className:"creator-grid",children:Ue.map((s)=>e(ke,{id:s,base:b,pressed:l.class===s,onPick:()=>C({class:s,colors:l.colors})},s))})}),x=n(N,{field:"colors",title:t("Colors"),error:d.colors??d.palette,children:[n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Palette")}),re.map((s)=>{let f=F.palettes[s];return e(M,{data:{"data-palette":s},label:S("palette",s),pressed:l.palette===s,background:`linear-gradient(135deg, ${f.primary} 52%, ${f.trim} 52%)`,onPick:()=>C({palette:s})},s)})]}),e("div",{className:"creator-custom",children:["primary","secondary","trim"].map((s)=>n("label",{children:[e("span",{children:s==="primary"?t("Primary (the accent)"):s==="secondary"?t("Secondary"):t("Trim")}),e("input",{type:"color",value:l.colors[s],onChange:(f)=>C({colors:{[s]:f.target.value}})})]},s))})]}),Q=z.map((s)=>e(N,{field:s.field,title:t(s.title),error:d[s.field],children:e(ye,{part:s,draft:l,shown:b,onPick:(f)=>C({[s.field]:f})})},s.field)),X=n(m,{children:[e(N,{field:"build",title:t("Build"),error:d.build,children:n("fieldset",{className:"segmented",children:[e("legend",{className:"visually-hidden",children:t("Build")}),["slim","regular","stout"].map((s)=>n("label",{"data-checked":l.build===s,children:[e("input",{type:"radio",name:`${B}-build`,checked:l.build===s,onChange:()=>C({build:s})}),ae(s)]},s))]})}),e(N,{field:"skin",title:t("Skin tone"),error:d.skin,children:n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Skin tone")}),(le??F.skins).map((s,f)=>e(M,{data:{"data-skin":String(f)},label:t("Skin tone {n}",{n:f+1}),pressed:l.skin===f,background:s,onPick:()=>C({skin:f})},f))]})}),e(N,{field:"hairColor",title:t("Hair color"),error:d.hairColor,children:n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Hair color")}),F.hairColors.map((s,f)=>e(M,{data:{"data-hair-color":s},label:t("Hair color {n}",{n:f+1}),pressed:l.hairColor===s,background:s,onPick:()=>C({hairColor:s})},s)),e("input",{type:"color","aria-label":t("Hair color"),value:l.hairColor,onChange:(s)=>C({hairColor:s.target.value})})]})})]}),H=[{id:"class",title:t("Class"),summary:S("class",l.class),error:d.class,node:q},{id:"colors",title:t("Colors"),summary:l.palette?S("palette",l.palette):l.colors.primary,error:d.colors??d.palette,node:x},...z.map((s,f)=>({id:s.field,title:t(s.title),summary:S(s.field,l[s.field]),error:d[s.field],node:Q[f]})),{id:"body",title:t("Body"),summary:ae(l.build),error:d.build??d.skin??d.hairColor,node:X}];return n("form",{ref:V,className:"creator",style:se,"aria-labelledby":B,onSubmit:(s)=>{if(s.preventDefault(),(L||i.onPick)&&!v)ce()},children:[e("h2",{id:B,className:"visually-hidden",children:t("Character of {name}",{name:i.displayName})}),n("div",{className:"creator-preview",children:[e(de,{spec:l,name:i.name,state:T,size:176,label:t("{name}, {state}",{name:i.displayName,state:t(ee[T])})}),e("button",{type:"button",className:"secondary","data-action":"cycle",onClick:()=>ne((s)=>Ft[(Ft.indexOf(s)+1)%Ft.length]??"idle"),children:t("Preview states")}),e("span",{className:"meta","aria-live":"polite",children:t(ee[T])})]}),n("div",{className:"creator-body",children:[d["*"]?e("p",{className:"field-error",role:"alert","data-field":"*",children:d["*"]}):null,G?e("ul",{className:"creator-sections",children:H.map((s)=>e("li",{children:n("button",{type:"button",className:"creator-section secondary",onClick:()=>_(s.id),children:[e("strong",{children:s.title}),e("span",{className:"meta",children:s.summary}),s.error?e("span",{className:"field-error",role:"alert",children:s.error}):null]})},s.id))}):n(m,{children:[q,x,Q,X]}),n("div",{className:"actions creator-actions",children:[e("button",{type:"button",className:"secondary","data-action":"suggest",onClick:()=>{g({}),h(dn({name:i.name,displayName:i.displayName,prompt:i.prompt}))},children:t("Suggest from role")}),e("button",{type:"button",className:"secondary","data-action":"randomize",onClick:()=>C(be()),children:t("Randomize")}),e("button",{type:"button",className:"secondary","data-action":"cancel",onClick:()=>{if(i.onCancel)i.onCancel();else if(L)E({kind:"cancel"})},children:t("Cancel")}),e("button",{type:"submit","data-action":"save",disabled:!L&&!i.onPick||v,children:v?t("Saving…"):i.onPick?t("Use this look"):t("Save")})]})]}),e(I,{open:G&&R!==void 0,title:H.find((s)=>s.id===R)?.title??"",onClose:()=>_(void 0),children:e("div",{className:"stack",children:H.find((s)=>s.id===R)?.node})}),e(j,{open:U!==void 0,title:t("Discard your changes?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:()=>E(void 0),onConfirm:ue,children:e("p",{children:t("The new look for {name} has not been saved.",{name:i.displayName})})})]})}var ae=(i)=>t(he[i]);function ke(i){let l=i.base.colors,h=A(()=>ei({class:i.id,colors:l}),[i.id,l]);return e(ie,{data:{"data-class":i.id},spec:h,size:56,label:S("class",i.id),hint:Z(i.id),pressed:i.pressed,onPick:i.onPick})}export{Me as CharacterCreator};
@@ -0,0 +1,2 @@
1
+ import{U,fe,ii,Rr,ri,it,he,l,v,we,Ae,At,$e,q,re,se,z,ht,pt,Ne,pe,E,ee,_e,g,xt,Er,Cr,Ar,si,En,$r,Nr,Lr,Xr,T,i,C,Fe,Lt,$n,Ii,hn,pn,Dr,Ur,st}from"./chunk-index-gyary7np.js";import{h}from"./chunk-index-zynq0b0w.js";var nn=(e)=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Ce(e.state,n.from);return r.line?rn(e):r.block?ln(e):!1};function be(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=e(t,n);if(!o)return!1;return r(n.update(o)),!0}}var rn=be(an,0);var on=be(Ye,0);var ln=be((e,t)=>Ye(e,t,cn(t)),0);function Ce(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}var V=50;function sn(e,{open:t,close:n},r,o){let s=e.sliceDoc(r-V,r),c=e.sliceDoc(o,o+V),a=/\s*$/.exec(s)[0].length,u=/^\s*/.exec(c)[0].length,d=s.length-a;if(s.slice(d-t.length,d)==t&&c.slice(u,u+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:o+u,margin:u&&1}};let f,m;if(o-r<=2*V)f=m=e.sliceDoc(r,o);else f=e.sliceDoc(r,r+V),m=e.sliceDoc(o-V,o);let p=/^\s*/.exec(f)[0].length,D=/\s*$/.exec(m)[0].length,M=m.length-D-n.length;if(f.slice(p,p+t.length)==t&&m.slice(M,M+n.length)==n)return{open:{pos:r+p+t.length,margin:/\s/.test(f.charAt(p+t.length))?1:0},close:{pos:o-D-n.length,margin:/\s/.test(m.charAt(M-1))?1:0}};return null}function cn(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),o=n.to<=r.to?r:e.doc.lineAt(n.to);if(o.from>r.from&&o.from==n.to)o=n.to==r.to+1?r:e.doc.lineAt(n.to-1);let s=t.length-1;if(s>=0&&t[s].to>r.from)t[s].to=o.to;else t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return t}function Ye(e,t,n=t.selection.ranges){let r=n.map((s)=>Ce(t,s.from).block);if(!r.every((s)=>s))return null;let o=n.map((s,c)=>sn(t,r[c],s.from,s.to));if(e!=2&&!o.every((s)=>s))return{changes:t.changes(n.map((s,c)=>{if(o[c])return[];return[{from:s.from,insert:r[c].open+" "},{from:s.to,insert:" "+r[c].close}]}))};else if(e!=1&&o.some((s)=>s)){let s=[];for(let c=0,a;c<o.length;c++)if(a=o[c]){let u=r[c],{open:d,close:f}=a;s.push({from:d.pos-u.open.length,to:d.pos+d.margin},{from:f.pos-f.margin,to:f.pos+u.close.length})}return{changes:s}}return null}function an(e,t,n=t.selection.ranges){let r=[],o=-1;e:for(let{from:s,to:c}of n){let a=r.length,u=1e9,d;for(let f=s;f<=c;){let m=t.doc.lineAt(f);if(d==null){if(d=Ce(t,m.from).line,!d)continue e}if(m.from>o&&(s==c||c>m.from)){o=m.from;let p=/^\s*/.exec(m.text)[0].length,D=p==m.length,M=m.text.slice(p,p+d.length)==d?p:-1;if(p<m.text.length&&p<u)u=p;r.push({line:m,comment:M,token:d,indent:p,empty:D,single:!1})}f=m.to+1}if(u<1e9){for(let f=a;f<r.length;f++)if(r[f].indent<r[f].line.text.length)r[f].indent=u}if(r.length==a+1)r[a].single=!0}if(e!=2&&r.some((s)=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:u,indent:d,empty:f,single:m}of r)if(m||!f)s.push({from:a.from+d,insert:u+" "});let c=t.changes(s);return{changes:c,selection:t.selection.map(c,1)}}else if(e!=1&&r.some((s)=>s.comment>=0)){let s=[];for(let{line:c,comment:a,token:u}of r)if(a>=0){let d=c.from+a,f=d+u.length;if(c.text[f-c.from]==" ")f++;s.push({from:d,to:f})}return{changes:s}}return null}var Se=$e.define(),un=$e.define(),fn=v.define(),Ze=v.define({combine(e){return ht(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,o)=>t(r,o)||n(r,o)})}}),et=we.define({create(){return B.empty},update(e,t){let n=t.state.facet(Ze),r=t.annotation(Se);if(r){let u=x.fromTransaction(t,r.selection),d=r.side,f=d==0?e.undone:e.done;if(u)f=Q(f,f.length,n.minDepth,u);else f=rt(f,t.startState.selection);return new B(d==0?r.rest:f,d==0?f:r.rest)}let o=t.annotation(un);if(o=="full"||o=="before")e=e.isolate();if(t.annotation(re.addToHistory)===!1)return!t.changes.empty?e.addMapping(t.changes.desc):e;let s=x.fromTransaction(t),c=t.annotation(re.time),a=t.annotation(re.userEvent);if(s)e=e.addChanges(s,c,a,n,t);else if(t.selection)e=e.addSelection(t.startState.selection,c,a,n.newGroupDelay);if(o=="full"||o=="after")e=e.isolate();return e},toJSON(e){return{done:e.done.map((t)=>t.toJSON()),undone:e.undone.map((t)=>t.toJSON())}},fromJSON(e){return new B(e.done.map(x.fromJSON),e.undone.map(x.fromJSON))}});function tt(e={}){return[et,Ze.of(e),g.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?X:t.inputType=="historyRedo"?G:null;if(!r)return!1;return t.preventDefault(),r(n)}})]}function j(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let o=n.field(et,!1);if(!o)return!1;let s=o.pop(e,n,t);if(!s)return!1;return r(s),!0}}var X=j(0,!1),G=j(1,!1),dn=j(0,!0),mn=j(1,!0);class x{constructor(e,t,n,r,o){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new x(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((r)=>r.toJSON())}}static fromJSON(e){return new x(e.changes&&he.fromJSON(e.changes),[],e.mapped&&it.fromJSON(e.mapped),e.startSelection&&l.fromJSON(e.startSelection),e.selectionsAfter.map(l.fromJSON))}static fromTransaction(e,t){let n=k;for(let r of e.startState.facet(fn)){let o=r(e);if(o.length)n=n.concat(o)}if(!n.length&&e.changes.empty)return null;return new x(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,k)}static selection(e){return new x(void 0,k,void 0,void 0,e)}}function Q(e,t,n,r){let o=t+1>n+20?t-n-1:0,s=e.slice(o,t);return s.push(r),s}function gn(e,t){let n=[],r=!1;return e.iterChangedRanges((o,s)=>n.push(o,s)),t.iterChangedRanges((o,s,c,a)=>{for(let u=0;u<n.length;){let d=n[u++],f=n[u++];if(a>=d&&c<=f)r=!0}}),r}function yn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function nt(e,t){return!e.length?t:!t.length?e:e.concat(t)}var k=[],xn=200;function rt(e,t){if(!e.length)return[x.selection([t])];else{let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-xn));if(r.length&&r[r.length-1].eq(t))return e;return r.push(t),Q(e,e.length-1,1e9,n.setSelAfter(r))}}function Sn(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function xe(e,t){if(!e.length)return e;let n=e.length,r=k;while(n){let o=kn(e[n-1],t,r);if(o.changes&&!o.changes.empty||o.effects.length){let s=e.slice(0,n);return s[n-1]=o,s}else t=o.mapped,n--,r=o.selectionsAfter}return r.length?[x.selection(r)]:k}function kn(e,t,n){let r=nt(e.selectionsAfter.length?e.selectionsAfter.map((a)=>a.map(t)):k,n);if(!e.changes)return x.selection(r);let o=e.changes.map(t),s=t.mapDesc(e.changes,!0),c=e.mapped?e.mapped.composeDesc(s):s;return new x(o,q.mapEffects(e.effects,t),c,e.startSelection.map(s),r)}var vn=/^(input\.type|delete)($|\.)/;class B{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new B(this.done,this.undone):this}addChanges(e,t,n,r,o){let s=this.done,c=s[s.length-1];if(c&&c.changes&&!c.changes.empty&&e.changes&&(!n||vn.test(n))&&(!c.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,gn(c.changes,e.changes))||n=="input.type.compose"))s=Q(s,s.length-1,r.minDepth,new x(e.changes.compose(c.changes),nt(q.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,k));else s=Q(s,s.length,r.minDepth,e);return new B(s,k,t,n)}addSelection(e,t,n,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:k;if(o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&yn(o[o.length-1],e))return this;return new B(rt(this.done,e),this.undone,t,n)}addMapping(e){return new B(xe(this.done,e),xe(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let o=r[r.length-1],s=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):t.selection);if(n&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:Se.of({side:e,rest:Sn(r),selection:s}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});else if(!o.changes)return null;else{let c=r.length==1?k:r.slice(0,r.length-1);if(o.mapped)c=xe(c,o.mapped);return t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:Se.of({side:e,rest:c,selection:s}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}}}B.empty=new B(k,k);var ot=[{key:"Mod-z",run:X,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:G,preventDefault:!0},{linux:"Ctrl-Shift-z",run:G,preventDefault:!0},{key:"Mod-u",run:dn,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:mn,preventDefault:!0}];function F(e,t){return l.create(e.ranges.map(t),e.mainIndex)}function A(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function L({state:e,dispatch:t},n){let r=F(e.selection,n);if(r.eq(e.selection,!0))return!1;return t(A(e,r)),!0}function Y(e,t){return l.cursor(t?e.to:e.from)}function lt(e,t){return L(e,(n)=>n.empty?e.moveByChar(n,t):Y(n,t))}function y(e){return e.textDirectionAt(e.state.selection.main.head)==ee.LTR}var ct=(e)=>lt(e,!y(e)),at=(e)=>lt(e,y(e));function ut(e,t){return L(e,(n)=>n.empty?e.moveByGroup(n,t):Y(n,t))}var bn=(e)=>ut(e,!y(e)),Cn=(e)=>ut(e,y(e));var no=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function Mn(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Z(e,t,n){let r=C(e).resolveInner(t.head),o=n?T.closedBy:T.openedBy;for(let u=t.head;;){let d=n?r.childAfter(u):r.childBefore(u);if(!d)break;if(Mn(e,d,o))r=d;else u=n?d.to:d.from}let s=r.type.prop(o),c,a;if(s&&(c=n?st(e,r.from,1):st(e,r.to,-1))&&c.matched)a=n?c.end.to:c.end.from;else a=n?r.to:r.from;return l.cursor(a,n?-1:1)}var An=(e)=>L(e,(t)=>Z(e.state,t,!y(e))),Ln=(e)=>L(e,(t)=>Z(e.state,t,y(e)));function ft(e,t){return L(e,(n)=>{if(!n.empty)return Y(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}var dt=(e)=>ft(e,!1),mt=(e)=>ft(e,!0);function gt(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,o;if(t){for(let s of e.state.facet(g.scrollMargins)){let c=s(e);if(c===null||c===void 0?void 0:c.top)n=Math.max(c===null||c===void 0?void 0:c.top,n);if(c===null||c===void 0?void 0:c.bottom)r=Math.max(c===null||c===void 0?void 0:c.bottom,r)}o=e.scrollDOM.clientHeight-n-r}else o=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,o-5)}}function yt(e,t){let n=gt(e),{state:r}=e,o=F(r.selection,(c)=>c.empty?e.moveVertically(c,t,n.height):Y(c,t));if(o.eq(r.selection))return!1;let s;if(n.selfScroll){let c=e.coordsAtPos(r.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),u=a.top+n.marginTop,d=a.bottom-n.marginBottom;if(c&&c.top>u&&c.bottom<d)s=g.scrollIntoView(o.main.head,{y:"start",yMargin:c.top-u})}return e.dispatch(A(r,o),{effects:s}),!0}var Ue=(e)=>yt(e,!1),ke=(e)=>yt(e,!0);function w(e,t,n){let r=e.lineBlockAt(t.head),o=e.moveToLineBoundary(t,n);if(o.head==t.head&&o.head!=(n?r.to:r.from))o=e.moveToLineBoundary(t,n,!1);if(!n&&o.head==r.from&&r.length){let s=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;if(s&&t.head!=r.from+s)o=l.cursor(r.from+s)}return o}var Bn=(e)=>L(e,(t)=>w(e,t,!0)),Dn=(e)=>L(e,(t)=>w(e,t,!1)),Tn=(e)=>L(e,(t)=>w(e,t,!y(e))),wn=(e)=>L(e,(t)=>w(e,t,y(e))),Wn=(e)=>L(e,(t)=>e.moveToLineBoundary(t,!1,!1)),Rn=(e)=>L(e,(t)=>e.moveToLineBoundary(t,!0,!1));function On(e,t,n){let r=!1,o=F(e.selection,(s)=>{let c=st(e,s.head,-1)||st(e,s.head,1)||s.head>0&&st(e,s.head-1,1)||s.head<e.doc.length&&st(e,s.head+1,-1);if(!c||!c.end)return s;r=!0;let a=c.start.from==s.head?c.end.to:c.end.from;return n?l.range(s.anchor,a):l.cursor(a)});if(!r)return!1;return t(A(e,o)),!0}var Fn=({state:e,dispatch:t})=>On(e,t,!1);function b(e,t,n){let r=F(e.state.selection,(o)=>{if(o.undirectional&&o.head>=o.anchor!=t)o=l.range(o.head,o.anchor);let s=n(o);return l.range(o.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});if(r.eq(e.state.selection))return!1;return e.dispatch(A(e.state,r)),!0}function St(e,t){return b(e,t,(n)=>e.moveByChar(n,t))}var kt=(e)=>St(e,!y(e)),vt=(e)=>St(e,y(e));function bt(e,t){return b(e,t,(n)=>e.moveByGroup(n,t))}var In=(e)=>bt(e,!y(e)),Pn=(e)=>bt(e,y(e));var Nn=(e)=>{let t=!y(e);return b(e,t,(n)=>Z(e.state,n,t))},qn=(e)=>{let t=y(e);return b(e,t,(n)=>Z(e.state,n,t))};function Ct(e,t){return b(e,t,(n)=>e.moveVertically(n,t))}var Mt=(e)=>Ct(e,!1),Bt=(e)=>Ct(e,!0);function Dt(e,t){return b(e,t,(n)=>e.moveVertically(n,t,gt(e).height))}var ze=(e)=>Dt(e,!1),Je=(e)=>Dt(e,!0),Vn=(e)=>b(e,!0,(t)=>w(e,t,!0)),Gn=(e)=>b(e,!1,(t)=>w(e,t,!1)),Un=(e)=>{let t=!y(e);return b(e,t,(n)=>w(e,n,t))},zn=(e)=>{let t=y(e);return b(e,t,(n)=>w(e,n,t))},_n=(e)=>b(e,!1,(t)=>l.cursor(e.lineBlockAt(t.head).from)),Jn=(e)=>b(e,!0,(t)=>l.cursor(e.lineBlockAt(t.head).to)),Ke=({state:e,dispatch:t})=>(t(A(e,{anchor:0})),!0),He=({state:e,dispatch:t})=>(t(A(e,{anchor:e.doc.length})),!0),Qe=({state:e,dispatch:t})=>(t(A(e,{anchor:e.selection.main.anchor,head:0})),!0),je=({state:e,dispatch:t})=>(t(A(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Kn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Hn=({state:e,dispatch:t})=>{let n=te(e).map(({from:r,to:o})=>l.undirectionalRange(r,Math.min(o+1,e.doc.length)));return t(e.update({selection:l.create(n),userEvent:"select"})),!0},Qn=({state:e,dispatch:t})=>{let n=F(e.selection,(r)=>{let o=C(e),s=o.resolveStack(r.from,1);if(r.empty){let c=o.resolveStack(r.from,-1);if(c.node.from>=s.node.from&&c.node.to<=s.node.to)s=c}for(let c=s;c;c=c.next){let{node:a}=c;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&c.next)return l.undirectionalRange(a.from,a.to)}return r});if(n.eq(e.selection))return!1;return t(A(e,n)),!0};function Et(e,t){let{state:n}=e,r=n.selection,o=n.selection.ranges.slice();for(let s of n.selection.ranges){let c=n.doc.lineAt(s.head);if(t?c.to<e.state.doc.length:c.from>0)for(let a=s;;){let u=e.moveVertically(a,t);if(u.head<c.from||u.head>c.to){if(!o.some((d)=>d.head==u.head))o.push(u);break}else if(u.head==a.head)break;else a=u}}if(o.length==r.ranges.length)return!1;return e.dispatch(A(n,l.create(o,o.length-1))),!0}var jn=(e)=>Et(e,!1),Xn=(e)=>Et(e,!0),Yn=({state:e,dispatch:t})=>{let n=e.selection,r=null;if(n.ranges.length>1)r=l.create([n.main]);else if(!n.main.empty)r=l.create([l.cursor(n.main.head)]);if(!r)return!1;return t(A(e,r)),!0};function _(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,o=r.changeByRange((s)=>{let{from:c,to:a}=s;if(c==a){let u=t(s);if(u<c)n="delete.backward",u=H(e,u,!1);else if(u>c)n="delete.forward",u=H(e,u,!0);c=Math.min(c,u),a=Math.max(a,u)}else c=H(e,c,!1),a=H(e,a,!0);return c==a?{range:s}:{changes:{from:c,to:a},range:l.cursor(c,c<s.head?-1:1)}});if(o.changes.empty)return!1;return e.dispatch(r.update(o,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?g.announce.of(r.phrase("Selection deleted")):void 0})),!0}function H(e,t,n){if(e instanceof g)for(let r of e.state.facet(g.atomicRanges).map((o)=>o(e)))r.between(t,t,(o,s)=>{if(o<t&&s>t)t=n?s:o});return t}var Tt=(e,t,n)=>_(e,(r)=>{let o=r.from,{state:s}=e,c=s.doc.lineAt(o),a,u;if(n&&!t&&o>c.from&&o<c.from+200&&!/[^ \t]/.test(a=c.text.slice(0,o-c.from))){if(a[a.length-1]=="\t")return o-1;let d=Ne(a,s.tabSize),f=d%Lt(s)||Lt(s);for(let m=0;m<f&&a[a.length-1-m]==" ";m++)o--;u=o}else if(u=fe(c.text,o-c.from,t,t)+c.from,u==o&&c.number!=(t?s.doc.lines:1))u+=t?1:-1;else if(!t&&/[\ufe00-\ufe0f]/.test(c.text.slice(u-c.from,o-c.from)))u=fe(c.text,u-c.from,!1,!1)+c.from;return u}),ve=(e)=>Tt(e,!1,!0);var wt=(e)=>Tt(e,!0,!1),Wt=(e,t)=>_(e,(n)=>{let r=n.head,{state:o}=e,s=o.doc.lineAt(r),c=o.charCategorizer(r);for(let a=null;;){if(r==(t?s.to:s.from)){if(r==n.head&&s.number!=(t?o.doc.lines:1))r+=t?1:-1;break}let u=fe(s.text,r-s.from,t)+s.from,d=s.text.slice(Math.min(r,u)-s.from,Math.max(r,u)-s.from),f=c(d);if(a!=null&&f!=a)break;if(d!=" "||r!=n.head)a=f;r=u}return r}),Rt=(e)=>Wt(e,!1),Zn=(e)=>Wt(e,!0);var er=(e)=>_(e,(t)=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var tr=(e)=>_(e,(t)=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),nr=(e)=>_(e,(t)=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var rr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((r)=>({changes:{from:r.from,to:r.to,insert:U.of(["",""])},range:l.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},or=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((r)=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let o=r.from,s=e.doc.lineAt(o),c=o==s.from?o-1:fe(s.text,o-s.from,!1)+s.from,a=o==s.to?o+1:fe(s.text,o-s.from,!0)+s.from;return{changes:{from:c,to:a,insert:e.doc.slice(o,a).append(e.doc.slice(c,o))},range:l.cursor(a)}});if(n.changes.empty)return!1;return t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0};function te(e){let t=[],n=-1;for(let r of e.selection.ranges){let o=e.doc.lineAt(r.from),s=e.doc.lineAt(r.to);if(!r.empty&&r.to==s.from)s=e.doc.lineAt(r.to-1);if(n>=o.number){let c=t[t.length-1];c.to=s.to,c.ranges.push(r)}else t.push({from:o.from,to:s.to,ranges:[r]});n=s.number+1}return t}function Ot(e,t,n){if(e.readOnly)return!1;let r=[],o=[];for(let s of te(e)){if(n?s.to==e.doc.length:s.from==0)continue;let c=e.doc.lineAt(n?s.to+1:s.from-1),a=c.length+1;if(n){r.push({from:s.to,to:c.to},{from:s.from,insert:c.text+e.lineBreak});for(let u of s.ranges)o.push(l.range(Math.min(e.doc.length,u.anchor+a),Math.min(e.doc.length,u.head+a)))}else{r.push({from:c.from,to:s.from},{from:s.to,insert:e.lineBreak+c.text});for(let u of s.ranges)o.push(l.range(u.anchor-a,u.head-a))}}if(!r.length)return!1;return t(e.update({changes:r,scrollIntoView:!0,selection:l.create(o,e.selection.mainIndex),userEvent:"move.line"})),!0}var lr=({state:e,dispatch:t})=>Ot(e,t,!1),ir=({state:e,dispatch:t})=>Ot(e,t,!0);function Ft(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of te(e))if(n)r.push({from:s.from,insert:e.doc.slice(s.from,s.to)+e.lineBreak});else r.push({from:s.to,insert:e.lineBreak+e.doc.slice(s.from,s.to)});let o=e.changes(r);return t(e.update({changes:o,selection:e.selection.map(o,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var sr=({state:e,dispatch:t})=>Ft(e,t,!1),cr=({state:e,dispatch:t})=>Ft(e,t,!0),ar=(e)=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(te(t).map(({from:o,to:s})=>{if(o>0)o--;else if(s<t.doc.length)s++;return{from:o,to:s}})),r=F(t.selection,(o)=>{let s=void 0;if(e.lineWrapping){let c=e.lineBlockAt(o.head),a=e.coordsAtPos(o.head,o.assoc||1);if(a)s=c.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2}return e.moveVertically(o,!0,s)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function ur(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=C(e).resolveInner(t),r=n.childBefore(t),o=n.childAfter(t),s;if(r&&o&&r.to<=t&&o.from>=t&&(s=r.type.prop(T.closedBy))&&s.indexOf(o.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(o.from).from&&!/\S/.test(e.sliceDoc(r.to,o.from)))return{from:r.to,to:o.from};return null}var Xe=It(!1),hr=It(!0);function It(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange((o)=>{let{from:s,to:c}=o,a=t.doc.lineAt(s),u=!e&&s==c&&ur(t,s);if(e)s=c=(c<=a.to?a:t.doc.lineAt(c)).to;let d=new hn(t,{simulateBreak:s,simulateDoubleBreak:!!u}),f=Ii(d,s);if(f==null)f=Ne(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize);while(c<a.to&&/\s/.test(a.text[c-a.from]))c++;if(u)({from:s,to:c}=u);else if(s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s)))s=a.from;let m=["",$n(t,f)];if(u)m.push($n(t,d.lineIndent(a.from,-1)));return{changes:{from:s,to:c,insert:U.of(m)},range:l.cursor(s+1+m[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Me(e,t){let n=-1;return e.changeByRange((r)=>{let o=[];for(let c=r.from;c<=r.to;){let a=e.doc.lineAt(c);if(a.number>n&&(r.empty||r.to>a.from))t(a,o,r),n=a.number;c=a.to+1}let s=e.changes(o);return{changes:o,range:l.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}var fr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new hn(e,{overrideIndentation:(s)=>{let c=n[s];return c==null?-1:c}}),o=Me(e,(s,c,a)=>{let u=Ii(r,s.from);if(u==null)return;if(!/\S/.test(s.text))u=0;let d=/^\s*/.exec(s.text)[0],f=$n(e,u);if(d!=f||a.from<s.from+d.length)n[s.from]=u,c.push({from:s.from,to:s.from+d.length,insert:f})});if(!o.changes.empty)t(e.update(o,{userEvent:"indent"}));return!0},ne=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(Me(e,(n,r)=>{r.push({from:n.from,insert:e.facet(Fe)})}),{userEvent:"input.indent"})),!0},Pt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(Me(e,(n,r)=>{let o=/^\s*/.exec(n.text)[0];if(!o)return;let s=Ne(o,e.tabSize),c=0,a=$n(e,Math.max(0,s-Lt(e)));while(c<o.length&&c<a.length&&o.charCodeAt(c)==a.charCodeAt(c))c++;r.push({from:n.from+c,to:n.from+o.length,insert:a.slice(c)})}),{userEvent:"delete.dedent"})),!0},dr=(e)=>(e.setTabFocusMode(),!0);var mr=[{key:"Ctrl-b",run:ct,shift:kt,preventDefault:!0},{key:"Ctrl-f",run:at,shift:vt},{key:"Ctrl-p",run:dt,shift:Mt},{key:"Ctrl-n",run:mt,shift:Bt},{key:"Ctrl-a",run:Wn,shift:_n},{key:"Ctrl-e",run:Rn,shift:Jn},{key:"Ctrl-d",run:wt},{key:"Ctrl-h",run:ve},{key:"Ctrl-k",run:er},{key:"Ctrl-Alt-h",run:Rt},{key:"Ctrl-o",run:rr},{key:"Ctrl-t",run:or},{key:"Ctrl-v",run:ke}],pr=[{key:"ArrowLeft",run:ct,shift:kt,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:bn,shift:In,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Tn,shift:Un,preventDefault:!0},{key:"ArrowRight",run:at,shift:vt,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Cn,shift:Pn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:wn,shift:zn,preventDefault:!0},{key:"ArrowUp",run:dt,shift:Mt,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Ke,shift:Qe},{mac:"Ctrl-ArrowUp",run:Ue,shift:ze},{key:"ArrowDown",run:mt,shift:Bt,preventDefault:!0},{mac:"Cmd-ArrowDown",run:He,shift:je},{mac:"Ctrl-ArrowDown",run:ke,shift:Je},{key:"PageUp",run:Ue,shift:ze},{key:"PageDown",run:ke,shift:Je},{key:"Home",run:Dn,shift:Gn,preventDefault:!0},{key:"Mod-Home",run:Ke,shift:Qe},{key:"End",run:Bn,shift:Vn,preventDefault:!0},{key:"Mod-End",run:He,shift:je},{key:"Enter",run:Xe,shift:Xe},{key:"Mod-a",run:Kn},{key:"Backspace",run:ve,shift:ve,preventDefault:!0},{key:"Delete",run:wt,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Rt,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Zn,preventDefault:!0},{mac:"Mod-Backspace",run:tr,preventDefault:!0},{mac:"Mod-Delete",run:nr,preventDefault:!0}].concat(mr.map((e)=>({mac:e.key,run:e.run,shift:e.shift}))),Nt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:An,shift:Nn},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Ln,shift:qn},{key:"Alt-ArrowUp",run:lr},{key:"Shift-Alt-ArrowUp",run:sr},{key:"Alt-ArrowDown",run:ir},{key:"Shift-Alt-ArrowDown",run:cr},{key:"Mod-Alt-ArrowUp",run:jn},{key:"Mod-Alt-ArrowDown",run:Xn},{key:"Escape",run:Yn},{key:"Mod-Enter",run:hr},{key:"Alt-l",mac:"Ctrl-l",run:Hn},{key:"Mod-i",run:Qn,preventDefault:!0},{key:"Mod-[",run:Pt},{key:"Mod-]",run:ne},{key:"Mod-Alt-\\",run:fr},{key:"Shift-Mod-k",run:ar},{key:"Shift-Mod-\\",run:Fn},{key:"Mod-/",run:nn},{key:"Alt-A",mac:"Ctrl-A",run:on},{key:"Ctrl-m",mac:"Shift-Alt-m",run:dr}].concat(pr),qt={key:"Tab",run:ne,shift:Pt};var Vt=typeof String.prototype.normalize=="function"?(e)=>e.normalize("NFKD"):(e)=>e;class R{constructor(e,t,n=0,r=e.length,o,s){this.test=s,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=o?(c)=>o(Vt(c)):Vt,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ii(this.buffer,this.bufferPos)}next(){while(this.matches.length)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Rr(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ri(e);let r=this.normalize(t);if(r.length)for(let o=0,s=n,c=!0;;o++){let a=r.charCodeAt(o),u=this.match(a,s,c,this.bufferPos+this.bufferStart,o==r.length-1);if(u)return this.value=u,this;if(o==r.length-1)break;if(c&&o<t.length&&t.charCodeAt(o)==a)s++;else c=!1}}}match(e,t,n,r,o){let s=null;for(let c=0;c<this.matches.length;){let a=this.matches[c],u=!1;if(this.query.charCodeAt(a.index)==e)if(a.index==this.query.length-1)s={from:a.from,to:r,precise:o&&a.precise};else a.index++,u=!0;if(u)c++;else this.matches.splice(c,1)}if(this.query.charCodeAt(0)==e)if(this.query.length==1)s={from:t,to:r,precise:n&&o};else this.matches.push({from:t,index:1,precise:n});if(s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart))s=null;return s}}if(typeof Symbol<"u")R.prototype[Symbol.iterator]=function(){return this};var zt={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Ee="gm"+(/x/.unicode==null?"":"u");class Te{constructor(e,t,n,r=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=zt,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new We(e,t,n,r,o);this.re=new RegExp(t,Ee+((n===null||n===void 0?void 0:n.ignoreCase)?"i":"")),this.test=n===null||n===void 0?void 0:n.test,this.iter=e.iter();let s=e.lineAt(r);this.curLineStart=s.from,this.matchPos=ce(e,r),this.getLine(this.curLineStart)}getLine(e){if(this.iter.next(e),this.iter.lineBreak)this.curLine="";else{if(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to)this.curLine=this.curLine.slice(0,this.to-this.curLineStart);this.iter.next()}}nextLine(){if(this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to)this.curLine="";else this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=ce(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length)this.nextLine();if((n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}var Le=new WeakMap;class N{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=Le.get(e);if(!r||r.from>=n||r.to<=t){let c=new N(t,e.sliceString(t,n));return Le.set(e,c),c}if(r.from==t&&r.to==n)return r;let{text:o,from:s}=r;if(s>t)o=e.sliceString(t,s)+o,s=t;if(r.to<n)o+=e.sliceString(r.to,n);return Le.set(e,new N(s,o)),new N(t,o.slice(t-s,n-s))}}class We{constructor(e,t,n,r,o){this.text=e,this.to=o,this.done=!1,this.value=zt,this.matchPos=ce(e,r),this.re=new RegExp(t,Ee+((n===null||n===void 0?void 0:n.ignoreCase)?"i":"")),this.test=n===null||n===void 0?void 0:n.test,this.flat=N.get(e,r,this.chunkEnd(r+5000))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e)this.re.lastIndex=e+1,t=this.re.exec(this.flat.text);if(t){let n=this.flat.from+t.index,r=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this.matchPos=ce(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=N.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}if(typeof Symbol<"u")Te.prototype[Symbol.iterator]=We.prototype[Symbol.iterator]=function(){return this};function gr(e){try{return new RegExp(e,Ee),!0}catch(t){return!1}}function ce(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;while(t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344)t++;return t}var yr=(e)=>{let t=Nr(e,"cm-goto-line");if(t){let c=t.dom.querySelector("input[type=text]");if(c)c.select();return!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:o,result:s}=$r(e,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:n.phrase("go")});return s.then((c)=>{let a=c&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(c.elements.line.value);if(!a){e.dispatch({effects:o});return}let u=n.doc.lineAt(n.selection.main.head),[,d,f,m,p]=a,D=m?+m.slice(1):0,M=f?+f:u.number;if(f&&p){let ye=M/100;if(d)ye=ye*(d=="-"?-1:1)+u.number/n.doc.lines;M=Math.round(n.doc.lines*ye)}else if(f&&d)M=M*(d=="-"?-1:1)+u.number;let Ve=n.doc.line(Math.max(1,Math.min(n.doc.lines,M))),Ge=l.cursor(Ve.from+Math.max(0,Math.min(D,Ve.length)));e.dispatch({effects:[o,g.scrollIntoView(Ge.from,{y:"center"})],selection:Ge})}),!0},xr={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},_t=v.define({combine(e){return ht(e,xr,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Jt(e){let t=[Mr,br];if(e)t.push(_t.of(e));return t}var Sr=E.mark({class:"cm-selectionMatch"}),kr=E.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Gt(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=se.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=se.Word)}function vr(e,t,n,r){return e(t.sliceDoc(n,n+1))==se.Word&&e(t.sliceDoc(r-1,r))==se.Word}var br=_e.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){if(e.selectionSet||e.docChanged||e.viewportChanged)this.decorations=this.getDeco(e.view)}getDeco(e){let t=e.state.facet(_t),{state:n}=e,r=n.selection;if(r.ranges.length>1)return E.none;let o=r.main,s,c=null;if(o.empty){if(!t.highlightWordAroundCursor)return E.none;let u=n.wordAt(o.head);if(!u)return E.none;c=n.charCategorizer(o.head),s=n.sliceDoc(u.from,u.to)}else{let u=o.to-o.from;if(u<t.minSelectionLength||u>200)return E.none;if(t.wholeWords){if(s=n.sliceDoc(o.from,o.to),c=n.charCategorizer(o.head),!(Gt(c,n,o.from,o.to)&&vr(c,n,o.from,o.to)))return E.none}else if(s=n.sliceDoc(o.from,o.to),!s)return E.none}let a=[];for(let u of e.visibleRanges){let d=new R(n.doc,s,u.from,u.to);while(!d.next().done){let{from:f,to:m}=d.value;if(!c||Gt(c,n,f,m)){if(o.empty&&f<=o.from&&m>=o.to)a.push(kr.range(f,m));else if(f>=o.to||m<=o.from)a.push(Sr.range(f,m));if(a.length>t.maxMatches)return E.none}}}return E.set(a)}},{decorations:(e)=>e.decorations}),Mr=g.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Br=({state:e,dispatch:t})=>{let{selection:n}=e,r=l.create(n.ranges.map((o)=>e.wordAt(o.head)||l.cursor(o.head)),n.mainIndex);if(r.eq(n))return!1;return t(e.update({selection:r})),!0};function Tr(e,t){let{main:n,ranges:r}=e.selection,o=e.wordAt(n.head),s=o&&o.from==n.from&&o.to==n.to;for(let c=!1,a=new R(e.doc,t,r[r.length-1].to);;)if(a.next(),a.done){if(c)return null;a=new R(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),c=!0}else{if(c&&r.some((u)=>u.from==a.value.from))continue;if(s){let u=e.wordAt(a.value.from);if(!u||u.from!=a.value.from||u.to!=a.value.to)continue}return a.value}}var wr=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some((s)=>s.from===s.to))return Br({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some((s)=>e.sliceDoc(s.from,s.to)!=r))return!1;let o=Tr(e,r);if(!o)return!1;return t(e.update({selection:e.selection.addRange(l.range(o.from,o.to),!1),effects:g.scrollIntoView(o.to)})),!0},O=v.define({combine(e){return ht(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:(t)=>new Zt(t),scrollToMatch:(t)=>g.scrollIntoView(t)})}});function $t(e){return e?[O.of(e),De]:De}class Re{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||gr(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?`
2
+ `:n=="r"?"\r":n=="t"?"\t":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Ht(this):new Kt(this)}getCursor(e,t=0,n){let r=e.doc?e:z.create({doc:e});if(n==null)n=r.doc.length;return this.regexp?P(this,r,t,n):I(this,r,t,n)}}class Oe{constructor(e){this.spec=e}}function Wr(e,t,n){return(r,o,s,c)=>{if(n&&!n(r,o,s,c))return!1;let a=r>=c&&o<=c+s.length?s.slice(r-c,o-c):t.doc.sliceString(r,o);return e(a,t,r,o)}}function I(e,t,n,r){let o;if(e.wholeWord)o=Or(t.doc,t.charCategorizer(t.selection.main.head));if(e.test)o=Wr(e.test,t,o);return new R(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:(s)=>s.toLowerCase(),o)}function Or(e,t){return(n,r,o,s)=>{if(s>n||s+o.length<r)s=Math.max(0,n-2),o=e.sliceString(s,Math.min(e.length,r+2));return(t(ae(o,n-s))!=se.Word||t(ue(o,n-s))!=se.Word)&&(t(ue(o,r-s))!=se.Word||t(ae(o,r-s))!=se.Word)}}class Kt extends Oe{constructor(e){super(e)}nextMatch(e,t,n){let r=I(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let o=Math.min(e.doc.length,t+this.spec.unquoted.length);r=I(this.spec,e,0,o).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let o=Math.max(t,r-1e4-this.spec.unquoted.length),s=I(this.spec,e,o,r),c=null;while(!s.nextOverlapping().done)c=s.value;if(c)return c;if(o==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);if(!r)r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length);return r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=I(this.spec,e,0,e.doc.length),r=[];while(!n.next().done){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let o=I(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));while(!o.next().done)r(o.value.from,o.value.to)}}function Fr(e,t,n){return(r,o,s)=>(!n||n(r,o,s))&&e(s[0],t,r,o)}function P(e,t,n,r){let o;if(e.wholeWord)o=Ir(t.charCategorizer(t.selection.main.head));if(e.test)o=Fr(e.test,t,o);return new Te(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:o},n,r)}function ae(e,t){return e.slice(fe(e,t,!1),t)}function ue(e,t){return e.slice(t,fe(e,t))}function Ir(e){return(t,n,r)=>!r[0].length||(e(ae(r.input,r.index))!=se.Word||e(ue(r.input,r.index))!=se.Word)&&(e(ue(r.input,r.index+r[0].length))!=se.Word||e(ae(r.input,r.index+r[0].length))!=se.Word)}class Ht extends Oe{nextMatch(e,t,n){let r=P(this.spec,e,n,e.doc.length).next();if(r.done)r=P(this.spec,e,0,t).next();return r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let o=Math.max(t,n-r*1e4),s=P(this.spec,e,o,n),c=null;while(!s.next().done)c=s.value;if(c&&(o==t||c.from>o+10))return c;if(o==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let r=n.length;r>0;r--){let o=+n.slice(0,r);if(o>0&&o<e.match.length)return e.match[o]+n.slice(r)}return t})}matchAll(e,t){let n=P(this.spec,e,0,e.doc.length),r=[];while(!n.next().done){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let o=P(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));while(!o.next().done)r(o.value.from,o.value.to)}}var J=q.define(),Ie=q.define(),W=we.define({create(e){return new ie(Be(e).create(),null)},update(e,t){for(let n of t.effects)if(n.is(J))e=new ie(n.value.create(),e.panel);else if(n.is(Ie))e=new ie(e.query,n.value?Pe:null);return e},provide:(e)=>En.from(e,(t)=>t.panel)});class ie{constructor(e,t){this.query=e,this.panel=t}}var Pr=E.mark({class:"cm-searchMatch"}),qr=E.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Vr=_e.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(W))}update(e){let t=e.state.field(W);if(t!=e.startState.field(W)||e.docChanged||e.selectionSet||e.viewportChanged)this.decorations=this.highlight(t)}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return E.none;let{view:n}=this,r=new pt;for(let o=0,s=n.visibleRanges,c=s.length;o<c;o++){let{from:a,to:u}=s[o];while(o<c-1&&u>s[o+1].from-500)u=s[++o].to;e.highlight(n.state,a,u,(d,f)=>{let m=n.state.selection.ranges.some((p)=>p.from==d&&p.to==f);r.add(d,f,m?qr:Pr)})}return r.finish()}},{decorations:(e)=>e.decorations});function K(e){return(t)=>{let n=t.state.field(W,!1);return n&&n.query.spec.valid?e(t,n):ge(t)}}var de=K((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let o=l.single(r.from,r.to),s=e.state.facet(O);return e.dispatch({selection:o,effects:[qe(e,r),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),jt(e),!0}),me=K((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,o=t.prevMatch(n,r,r);if(!o)return!1;let s=l.single(o.from,o.to),c=e.state.facet(O);return e.dispatch({selection:s,effects:[qe(e,o),c.scrollToMatch(s.main,e)],userEvent:"select.search"}),jt(e),!0}),Gr=K((e,{query:t})=>{let n=t.matchAll(e.state,1000);if(!n||!n.length)return!1;return e.dispatch({selection:l.create(n.map((r)=>l.range(r.from,r.to))),userEvent:"select.search.matches"}),!0}),zr=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:o}=n.main,s=[],c=0;for(let a=new R(e.doc,e.sliceDoc(r,o));!a.next().done;){if(s.length>1000)return!1;if(a.value.from==r)c=s.length;s.push(l.range(a.value.from,a.value.to))}return t(e.update({selection:l.create(s,c),userEvent:"select.search.matches"})),!0},Ut=K((e,{query:t})=>{let{state:n}=e,{from:r,to:o}=n.selection.main;if(n.readOnly)return!1;let s=t.nextMatch(n,r,r);if(!s)return!1;let c=s,a=[],u,d,f=[];if(!c.precise)c=t.nextMatch(n,c.from,c.to);else if(c.from==r&&c.to==o)d=n.toText(t.getReplacement(c)),a.push({from:c.from,to:c.to,insert:d}),c=t.nextMatch(n,c.from,c.to),f.push(g.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."));let m=e.state.changes(a);if(c)u=l.single(c.from,c.to).map(m),f.push(qe(e,c)),f.push(n.facet(O).scrollToMatch(u.main,e));return e.dispatch({changes:m,selection:u,effects:f,userEvent:"input.replace"}),!0}),_r=K((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let o of t.matchAll(e.state,1e9)){let{from:s,to:c,precise:a}=o;if(a)n.push({from:s,to:c,insert:t.getReplacement(o)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:g.announce.of(r),userEvent:"input.replace.all"}),!0});function Pe(e){return e.state.facet(O).createPanel(e)}function Be(e,t){var n,r,o,s,c;let a=e.selection.main,u=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!u)return t;let d=e.facet(O);return new Re({search:((n=t===null||t===void 0?void 0:t.literal)!==null&&n!==void 0?n:d.literal)?u:u.replace(/\n/g,"\\n"),caseSensitive:(r=t===null||t===void 0?void 0:t.caseSensitive)!==null&&r!==void 0?r:d.caseSensitive,literal:(o=t===null||t===void 0?void 0:t.literal)!==null&&o!==void 0?o:d.literal,regexp:(s=t===null||t===void 0?void 0:t.regexp)!==null&&s!==void 0?s:d.regexp,wholeWord:(c=t===null||t===void 0?void 0:t.wholeWord)!==null&&c!==void 0?c:d.wholeWord})}function Qt(e){let t=si(e,Pe);return t&&t.dom.querySelector("[main-field]")}function jt(e){let t=Qt(e);if(t&&t==e.root.activeElement)t.select()}var ge=(e)=>{let t=e.state.field(W,!1);if(t&&t.panel){let n=Qt(e);if(n&&n!=e.root.activeElement){let r=Be(e.state,t.query.spec);if(r.valid)e.dispatch({effects:J.of(r)});n.focus(),n.select()}}else e.dispatch({effects:[Ie.of(!0),t?J.of(Be(e.state,t.query.spec)):q.appendConfig.of(De)]});return!0},Xt=(e)=>{let t=e.state.field(W,!1);if(!t||!t.panel)return!1;let n=si(e,Pe);if(n&&n.dom.contains(e.root.activeElement))e.focus();return e.dispatch({effects:Ie.of(!1)}),!0},Yt=[{key:"Mod-f",run:ge,scope:"editor search-panel"},{key:"F3",run:de,shift:me,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:de,shift:me,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Xt,scope:"editor search-panel"},{key:"Mod-Shift-l",run:zr},{key:"Mod-Alt-g",run:yr},{key:"Mod-d",run:wr,preventDefault:!0}];class Zt{constructor(e){this.view=e;let t=this.query=e.state.field(W).query.spec;this.commit=this.commit.bind(this),this.searchField=pe("input",{value:t.search,placeholder:S(e,"Find"),"aria-label":S(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=pe("input",{value:t.replace,placeholder:S(e,"Replace"),"aria-label":S(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=pe("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=pe("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=pe("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(r,o,s){return pe("button",{class:"cm-button",name:r,onclick:o,type:"button"},s)}this.dom=pe("div",{onkeydown:(r)=>this.keydown(r),class:"cm-search"},[this.searchField,n("next",()=>de(e),[S(e,"next")]),n("prev",()=>me(e),[S(e,"previous")]),n("select",()=>Gr(e),[S(e,"all")]),pe("label",null,[this.caseField,S(e,"match case")]),pe("label",null,[this.reField,S(e,"regexp")]),pe("label",null,[this.wordField,S(e,"by word")]),...e.state.readOnly?[]:[pe("br"),this.replaceField,n("replace",()=>Ut(e),[S(e,"replace")]),n("replaceAll",()=>_r(e),[S(e,"replace all")])],pe("button",{name:"close",onclick:()=>Xt(e),"aria-label":S(e,"close"),type:"button"},["×"])])}commit(){let e=new Re({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});if(!e.eq(this.query))this.query=e,this.view.dispatch({effects:J.of(e)})}keydown(e){if(Er(this.view,e,"search-panel"))e.preventDefault();else if(e.keyCode==13&&e.target==this.searchField)e.preventDefault(),(e.shiftKey?me:de)(this.view);else if(e.keyCode==13&&e.target==this.replaceField)e.preventDefault(),Ut(this.view)}update(e){for(let t of e.transactions)for(let n of t.effects)if(n.is(J)&&!n.value.eq(this.query))this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(O).top}}function S(e,t){return e.state.phrase(t)}var oe=30,le=/[\s\.,:;?!]/;function qe(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),o=e.state.doc.lineAt(n).to,s=Math.max(r.from,t-oe),c=Math.min(o,n+oe),a=e.state.sliceDoc(s,c);if(s!=r.from){for(let u=0;u<oe;u++)if(!le.test(a[u+1])&&le.test(a[u])){a=a.slice(u);break}}if(c!=o){for(let u=a.length-1;u>a.length-oe;u--)if(!le.test(a[u-1])&&le.test(a[u])){a=a.slice(0,u);break}}return g.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${r.number}.`)}var Jr=g.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),De=[W,Ae.low(Vr),Jr];var Kr=g.theme({"&":{color:"var(--code-fg)",backgroundColor:"var(--code-bg)",height:"100%",fontSize:"var(--code-size, 13px)"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"var(--font-mono)",lineHeight:"1.55",overflow:"auto"},".cm-content":{caretColor:"var(--code-fg)",padding:"0.5rem 0"},".cm-line":{padding:"0 0.75rem"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--code-fg)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--code-selection)"},".cm-activeLine":{backgroundColor:"var(--code-active-line)"},".cm-gutters":{backgroundColor:"var(--code-gutter-bg)",color:"var(--code-gutter)",border:"none",borderRight:"1px solid var(--border)"},".cm-activeLineGutter":{backgroundColor:"var(--code-active-line)",color:"var(--code-fg)"},".cm-lineNumbers .cm-gutterElement":{padding:"0 0.5rem 0 0.5rem",minWidth:"2.25rem"},".cm-matchingBracket, .cm-nonmatchingBracket":{backgroundColor:"var(--code-selection)",outline:"1px solid var(--border-strong)"},".cm-searchMatch":{backgroundColor:"var(--warn-soft)",outline:"1px solid var(--warn)"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"var(--accent-soft)",outline:"1px solid var(--accent)"},".cm-panels":{backgroundColor:"var(--surface-2)",color:"var(--text)",borderColor:"var(--border)",fontFamily:"var(--font)"},".cm-panels-top":{borderBottom:"1px solid var(--border)"},".cm-panel.cm-search":{padding:"0.5rem 2rem 0.5rem 0.5rem"},".cm-panel.cm-search input, .cm-panel.cm-search button, .cm-panel.cm-search label":{fontSize:"0.875rem"},".cm-panel.cm-search input[type=text]":{backgroundColor:"var(--surface)",color:"var(--text)",border:"1px solid var(--control-border)",borderRadius:"var(--radius-sm)",padding:"0.25rem 0.5rem"},".cm-panel.cm-search button":{backgroundColor:"var(--surface-3)",color:"var(--text)",border:"1px solid var(--border-strong)",borderRadius:"var(--radius-sm)",backgroundImage:"none",padding:"0.25rem 0.625rem"},".cm-panel.cm-search [name=close]":{color:"var(--muted)"}}),Hr=pn.define([{tag:[i.keyword,i.modifier,i.operatorKeyword,i.controlKeyword],color:"var(--code-keyword)"},{tag:[i.string,i.regexp,i.special(i.string),i.inserted],color:"var(--code-string)"},{tag:[i.number,i.bool,i.null,i.atom,i.literal],color:"var(--code-number)"},{tag:[i.comment,i.lineComment,i.blockComment,i.docComment],color:"var(--code-comment)",fontStyle:"italic"},{tag:[i.typeName,i.className,i.namespace,i.tagName,i.standard(i.tagName)],color:"var(--code-type)"},{tag:[i.function(i.variableName),i.function(i.propertyName),i.definition(i.variableName),i.labelName],color:"var(--code-function)"},{tag:[i.meta,i.processingInstruction,i.annotation,i.attributeName,i.propertyName,i.heading],color:"var(--code-meta)"},{tag:i.heading,fontWeight:"bold"},{tag:i.strong,fontWeight:"bold"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.strikethrough,textDecoration:"line-through"},{tag:i.link,color:"var(--code-function)",textDecoration:"underline"},{tag:i.url,color:"var(--code-function)"},{tag:i.invalid,color:"var(--danger)"},{tag:i.deleted,color:"var(--danger)"}]),en=[Kr,Dr(Hr)];var Qr={typescript:()=>(h("etjjvr2g"),import("./chunk-lang-typescript-etjjvr2g.js")),javascript:()=>(h("fmhhgzwd"),import("./chunk-lang-javascript-fmhhgzwd.js")),json:()=>(h("7gd89mvs"),import("./chunk-lang-json-7gd89mvs.js")),markdown:()=>(h("b6qbe8bt"),import("./chunk-lang-markdown-b6qbe8bt.js")),css:()=>(h("88v3hp3d"),import("./chunk-lang-css-88v3hp3d.js")),html:()=>(h("07d47es4"),import("./chunk-lang-html-07d47es4.js")),python:()=>(h("3v56y31b"),import("./chunk-lang-python-3v56y31b.js")),yaml:()=>(h("fz5qpb3r"),import("./chunk-lang-yaml-fz5qpb3r.js")),go:()=>(h("wjwgay4v"),import("./chunk-lang-go-wjwgay4v.js")),rust:()=>(h("kh0z74d1"),import("./chunk-lang-rust-kh0z74d1.js")),sql:()=>(h("yw6bf3t7"),import("./chunk-lang-sql-yw6bf3t7.js")),xml:()=>(h("ev1mndd4"),import("./chunk-lang-xml-ev1mndd4.js")),shell:()=>(h("9zv0zvbx"),import("./chunk-lang-shell-9zv0zvbx.js")),toml:()=>(h("tg1r96nq"),import("./chunk-lang-toml-tg1r96nq.js")),dockerfile:()=>(h("k728ewsf"),import("./chunk-lang-dockerfile-k728ewsf.js"))};async function tn(e){if(e==="plain")return;try{return(await Qr[e]()).language()}catch(t){console.warn("a language for the editor failed to load",t);return}}function jr(e){if(typeof e.attachShadow!=="function"||typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in Document.prototype))return{parent:e,root:void 0};let t=e.shadowRoot??e.attachShadow({mode:"open"}),n=new CSSStyleSheet;return n.replaceSync(":host{display:flex;flex-direction:column;min-height:0}.cm-editor{flex:1;min-height:0}"),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],{parent:t,root:t}}async function vo(e){let t=new At,n=new At,r=new At,o=await tn(e.language),s=(m)=>[z.readOnly.of(!m),g.editable.of(m)],c={editable:e.editable,wrap:e.wrap,language:o??[]},a,u=(m)=>[Lr(),Ar(),Xr(),tt(),Cr(),Ur(),Jt(),$t({top:!0}),Fe.of(" "),z.phrases.of(e.phrases),en,xt.of([{key:"Mod-s",preventDefault:!0,run:()=>(e.onSave(),!0)},{key:"Escape",run:()=>(e.onEscape(),!0)},qt,...Yt,...ot,...Nt]),z.lineSeparator.of(m),t.of(s(c.editable)),n.of(c.wrap?g.lineWrapping:[]),r.of(c.language),g.updateListener.of((p)=>{if(p.docChanged)e.onChange()})],d=jr(e.parent),f=new g({parent:d.parent,root:d.root,state:z.create({doc:e.text,extensions:u(e.eol)})});return a=f.state.doc,{text:()=>f.state.doc.sliceString(0,void 0,f.state.lineBreak),dirty:()=>a===void 0||!f.state.doc.eq(a),snapshot:()=>f.state.doc,markSaved:(m)=>{a=m??f.state.doc},replace:(m,p)=>{let D=f.scrollDOM.scrollTop;f.setState(z.create({doc:m,extensions:u(p)})),a=f.state.doc,f.scrollDOM.scrollTop=D},setEditable:(m)=>{c.editable=m,f.dispatch({effects:t.reconfigure(s(m))})},setWrap:(m)=>{c.wrap=m,f.dispatch({effects:n.reconfigure(m?g.lineWrapping:[])})},setLanguage:async(m)=>{c.language=await tn(m)??[],f.dispatch({effects:r.reconfigure(c.language)})},undo:()=>{X(f)},redo:()=>{G(f)},find:()=>{ge(f)},tab:()=>{ne(f)},focus:()=>f.focus(),scrollTop:()=>f.scrollDOM.scrollTop,scrollTo:(m)=>{f.scrollDOM.scrollTop=m},destroy:()=>f.destroy()}}export{vo as createEditor};
@@ -0,0 +1 @@
1
+ import{j}from"./chunk-index-w31c4yjv.js";import"./chunk-index-vcyzwtk2.js";export{j as Confirm};
@@ -1 +1 @@
1
- import{t,p,e,n,y,v,h,_,P,k}from"./chunk-index-v23m38p6.js";import{Oe}from"./chunk-index-xgkd15n3.js";function g(){let{connectorAdminUrl:o}=k(),{data:r,error:s}=Oe(()=>y.connectors(),"connectors");return n("section",{className:"stack",children:[n("div",{className:"card-head",children:[n("div",{children:[e("h2",{children:t("Connectors")}),e("p",{className:"hint",children:t("Upstream MCP gateways and virtual servers used by the assistant.")})]}),o?e("a",{href:o,target:"_blank",rel:"noreferrer",children:t("Open connector admin")}):null]}),s?e(h,{message:s}):null,!r&&!s?e(v,{}):null,r?n(p,{children:[e("h3",{children:t("Upstream gateways")}),r.gateways.length===0?e(_,{children:t("No gateways.")}):null,r.gateways.map((a)=>e("article",{className:"card",children:n("div",{className:"card-head",children:[e("strong",{children:a.name}),e(P,{children:a.enabled?t("Enabled"):t("Disabled")}),e(P,{tone:a.reachable?"plain":"warn",children:a.reachable?t("Reachable"):t("Unreachable")}),e(P,{children:t("{count} tools",{count:a.tools})})]})},a.name)),e("h3",{children:t("Virtual servers")}),r.servers.length===0?e(_,{children:t("No virtual servers.")}):null,r.servers.map((a)=>n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:a.name}),e(P,{children:t("{count} tools",{count:a.tools.length})})]}),n("p",{children:[t("Used by"),": ",a.usedBy.join(", ")||t("None")]}),n("details",{children:[e("summary",{children:t("Tool list")}),e("ul",{children:a.tools.map((l)=>e("li",{children:l},l))})]})]},a.name))]}):null]})}export{g as ConnectorsPage};
1
+ import{t,m,e,n,y,x,p,_,P,k}from"./chunk-index-zynq0b0w.js";import{Oe}from"./chunk-index-gr6e0hse.js";function g(){let{connectorAdminUrl:o}=k(),{data:r,error:s}=Oe(()=>y.connectors(),"connectors");return n("section",{className:"stack",children:[n("div",{className:"card-head",children:[n("div",{children:[e("h2",{children:t("Connectors")}),e("p",{className:"hint",children:t("Upstream MCP gateways and virtual servers used by the assistant.")})]}),o?e("a",{href:o,target:"_blank",rel:"noreferrer",children:t("Open connector admin")}):null]}),s?e(p,{message:s}):null,!r&&!s?e(x,{}):null,r?n(m,{children:[e("h3",{children:t("Upstream gateways")}),r.gateways.length===0?e(_,{children:t("No gateways.")}):null,r.gateways.map((a)=>e("article",{className:"card",children:n("div",{className:"card-head",children:[e("strong",{children:a.name}),e(P,{children:a.enabled?t("Enabled"):t("Disabled")}),e(P,{tone:a.reachable?"plain":"warn",children:a.reachable?t("Reachable"):t("Unreachable")}),e(P,{children:t("{count} tools",{count:a.tools})})]})},a.name)),e("h3",{children:t("Virtual servers")}),r.servers.length===0?e(_,{children:t("No virtual servers.")}):null,r.servers.map((a)=>n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:a.name}),e(P,{children:t("{count} tools",{count:a.tools.length})})]}),n("p",{children:[t("Used by"),": ",a.usedBy.join(", ")||t("None")]}),n("details",{children:[e("summary",{children:t("Tool list")}),e("ul",{children:a.tools.map((l)=>e("li",{children:l},l))})]})]},a.name))]}):null]})}export{g as ConnectorsPage};
@@ -1 +1 @@
1
- import{t,c,p,e,n,x,y,v,h,_,P,k,Ne,te,_e,Wt,qn,ne}from"./chunk-index-v23m38p6.js";import{Oe}from"./chunk-index-xgkd15n3.js";var u=[{kind:"owner",title:c("Owner channels"),note:c("Direct messages and channels where the owner talks to the assistant.")},{kind:"agent",title:c("Agent channels"),note:c("The agent server's one-to-one channels.")},{kind:"group",title:c("Group channels"),note:c("The agent server's group channels.")},{kind:"outside",title:c("Outside agents"),note:c("Conversations an agent outside Discord holds over MCP.")},{kind:"plugin",title:c("Plugin conversations"),note:c("Conversations a plugin runs, such as a web chat, as the host recorded them.")}];function A(){let{timeZone:o}=k(),{now:i}=ne(),{data:s,error:a}=Oe(()=>y.conversations(),"conversations"),m=s?.conversations;if(!m)return a?e(h,{message:a}):e(v,{});return n(p,{children:[a?e(h,{message:a}):null,u.map((r)=>{let d=m.filter((l)=>l.kind===r.kind);return n("section",{className:"stack",children:[e("h2",{children:t(r.title)}),e("p",{className:"hint",children:t(r.note)}),d.length===0?e(_,{children:t("None stored.")}):null,d.map((l)=>e(g,{item:l,now:i,timeZone:o},l.key))]},r.kind)})]})}function g(o){let{item:i}=o,s=Wt(i.channel,i.id),a=qn(i);return n("a",{className:"card card-link",href:x("conversations",i.key),children:[n("div",{className:"card-head",children:[e("strong",{children:a}),i.busy>0?e(P,{tone:"busy",children:t("running")}):null,i.liveBytes===0?e(P,{children:t("archived only")}):null]}),n("p",{className:"meta",children:[(i.kind==="outside"||i.kind==="plugin")&&i.startedAt?`${t("Started")} ${te(i.startedAt,o.timeZone)} · `:s.detail?`${s.detail} · `:"",i.principal?`${i.visibility==="private"?t("Private to {name}",{name:i.principal.name}):t("Shared · {name}",{name:i.principal.name})} · `:"",t("Last active")," ",Ne(i.lastActive,o.now,o.timeZone)," ·"," ",_e(i.liveBytes)," ·"," ",t("{count} archived",{count:i.archives})]})]})}export{A as ConversationsPage};
1
+ import{t,c,m,e,n,S,y,x,p,_,P,k,De,te,ke,tn,Hn,ne}from"./chunk-index-zynq0b0w.js";import{Oe}from"./chunk-index-gr6e0hse.js";var u=[{kind:"owner",title:c("Owner channels"),note:c("Direct messages and channels where the owner talks to the assistant.")},{kind:"agent",title:c("Agent channels"),note:c("The agent server's one-to-one channels.")},{kind:"group",title:c("Group channels"),note:c("The agent server's group channels.")},{kind:"outside",title:c("Outside agents"),note:c("Conversations an agent outside Discord holds over MCP.")},{kind:"plugin",title:c("Plugin conversations"),note:c("Conversations a plugin runs, such as a web chat, as the host recorded them.")}];function Z(){let{timeZone:o}=k(),{now:i}=ne(),{data:s,error:a}=Oe(()=>y.conversations(),"conversations"),d=s?.conversations;if(!d)return a?e(p,{message:a}):e(x,{});return n(m,{children:[a?e(p,{message:a}):null,u.map((r)=>{let h=d.filter((l)=>l.kind===r.kind);return n("section",{className:"stack",children:[e("h2",{children:t(r.title)}),e("p",{className:"hint",children:t(r.note)}),h.length===0?e(_,{children:t("None stored.")}):null,h.map((l)=>e(g,{item:l,now:i,timeZone:o},l.key))]},r.kind)})]})}function g(o){let{item:i}=o,s=tn(i.channel,i.id),a=Hn(i);return n("a",{className:"card card-link",href:S("conversations",i.key),children:[n("div",{className:"card-head",children:[e("strong",{children:a}),i.busy>0?e(P,{tone:"busy",children:t("running")}):null,i.liveBytes===0?e(P,{children:t("archived only")}):null]}),n("p",{className:"meta",children:[(i.kind==="outside"||i.kind==="plugin")&&i.startedAt?`${t("Started")} ${te(i.startedAt,o.timeZone)} · `:s.detail?`${s.detail} · `:"",i.principal?`${i.visibility==="private"?t("Private to {name}",{name:i.principal.name}):t("Shared · {name}",{name:i.principal.name})} · `:"",t("Last active")," ",De(i.lastActive,o.now,o.timeZone)," ·"," ",ke(i.liveBytes)," ·"," ",t("{count} archived",{count:i.archives})]})]})}export{Z as ConversationsPage};
@@ -1 +1 @@
1
- import{Bi}from"./chunk-index-v23m38p6.js";import{Ei}from"./chunk-index-pcfhpm8v.js";import{cs,ds,fr,hr,fs,hs}from"./chunk-index-4mfj596y.js";var ne=Bi,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}};Ei(!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=cs(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?hr(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?fr(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()}))},hs)}}}else if(d)clearTimeout(d.timer),d=void 0}else{let o=ds(R,B,u,e);q=o?{type:"folder",before:o.before}:{type:"cancel"};let M=h.findIndex((m)=>m.key===u),E=o?hr(h.map((m)=>m.key),u,o.before):M,s=fr(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=fs(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(Ei(!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{ar}from"./chunk-index-zynq0b0w.js";import{Zi}from"./chunk-index-2yebd9tb.js";import{_s,Ts,_r,kr,Ps,Qs}from"./chunk-index-mmg788a1.js";var ne=ar,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}};Zi(!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=_s(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?kr(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?_r(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()}))},Qs)}}}else if(d)clearTimeout(d.timer),d=void 0}else{let o=Ts(R,B,u,e);q=o?{type:"folder",before:o.before}:{type:"cancel"};let M=h.findIndex((m)=>m.key===u),E=o?kr(h.map((m)=>m.key),u,o.before):M,s=_r(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=Ps(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(Zi(!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 +1 @@
1
- import{At}from"./chunk-index-k2qq1gdj.js";import{O}from"./chunk-index-v23m38p6.js";function C(){try{let c=document.createElement("canvas");return!!(c.getContext("webgl2")||c.getContext("webgl"))}catch{return!1}}function H(c,n){return[c,n.includes("?")?n.slice(n.indexOf("?")):""].some((r)=>{let d=new URLSearchParams(r).get("nogl");return d!==null&&d!=="0"&&d!=="false"})}async function B(c,n,g){let r=n.variant==="compact",d=n.labels??At,l=new Map,T=(e)=>{l.clear();for(let t of e)l.set(t.id,{...t})};T(n.seats);let m={t:n.theme,s:n.scheme},a=null,o=document.createElement("div");o.className="rt-table",o.dataset.variant=r?"compact":"full";let f=document.createElement("div");f.className="rt-table-stage",o.appendChild(f);let i=null,h=!1,L=()=>!r&&(Boolean(n.listBelow)||h);c.appendChild(o);let u=new Map,S=()=>{if(!L()){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",()=>{let b=l.get(s);if(b)n.onSeatClick({id:b.id,name:b.name})}),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}))};S();let E=(e)=>{h=!e,S(),n.onNames?.(e)},p=async()=>{let{createTable2D:e}=await (O("n26b7gd0"),import("./chunk-table2d-n26b7gd0.js"));a=e(f,{...n,theme:m.t,scheme:m.s,seats:[...l.values()]}),E(!0)},M=async()=>{let{createTable3D:e}=await (O("8aysyf56"),import("./chunk-table3d-8aysyf56.js"));a=e(f,{...n,theme:m.t,scheme:m.s,seats:[...l.values()],onNames:E},()=>{a?.dispose(),p()})};if(r||g==="svg"||g!=="webgl"&&(H(location.search,location.hash)||!C()))await p();else try{await M()}catch{await p()}let y,w=n.onSeatMenu;if(w&&!r){let{attachSeatMenu:e}=await (O("d3npdtx1"),import("./chunk-seat-menu-d3npdtx1.js"));y=e(o,(t,s,b)=>{let A=t instanceof Element?t.closest("[data-seat]")?.dataset.seat:void 0,v=l.get(A??a?.seatAt?.(s,b)??"");return v?{id:v.id,name:v.name}:void 0},w)}return{get kind(){return a.kind},setTheme(e,t){m={t:e,s:t},a.setTheme(e,t)},setSeats(e){T(e),S(),a.setSeats(e)},setState(e,t){let s=l.get(e);if(s)s.state=t;S(),a.setState(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(){y?.(),a?.dispose(),o.remove()}}}export{B as mountRoundTable};
1
+ import{Dt}from"./chunk-index-jw7dtshr.js";import{h}from"./chunk-index-zynq0b0w.js";function H(){try{let c=document.createElement("canvas");return!!(c.getContext("webgl2")||c.getContext("webgl"))}catch{return!1}}function x(c,n){return[c,n.includes("?")?n.slice(n.indexOf("?")):""].some((r)=>{let d=new URLSearchParams(r).get("nogl");return d!==null&&d!=="0"&&d!=="false"})}async function I(c,n,g){let r=n.variant==="compact",d=n.labels??Dt,l=new Map,T=(e)=>{l.clear();for(let t of e)l.set(t.id,{...t})};T(n.seats);let m={t:n.theme,s:n.scheme},a=null,o=document.createElement("div");o.className="rt-table",o.dataset.variant=r?"compact":"full";let f=document.createElement("div");f.className="rt-table-stage",o.appendChild(f);let i=null,E=!1,M=()=>!r&&(Boolean(n.listBelow)||E);c.appendChild(o);let u=new Map,S=()=>{if(!M()){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",()=>{let b=l.get(s);if(b)n.onSeatClick({id:b.id,name:b.name})}),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}))};S();let y=(e)=>{E=!e,S(),n.onNames?.(e)},p=async()=>{let{createTable2D:e}=await (h("p3ezsdcj"),import("./chunk-table2d-p3ezsdcj.js"));a=e(f,{...n,theme:m.t,scheme:m.s,seats:[...l.values()]}),y(!0)},A=async()=>{let{createTable3D:e}=await (h("4x2n2b00"),import("./chunk-table3d-4x2n2b00.js"));a=e(f,{...n,theme:m.t,scheme:m.s,seats:[...l.values()],onNames:y},()=>{a?.dispose(),p()})};if(r||g==="svg"||g!=="webgl"&&(x(location.search,location.hash)||!H()))await p();else try{await A()}catch{await p()}let w,L=n.onSeatMenu;if(L&&!r){let{attachSeatMenu:e}=await (h("ys5v9abz"),import("./chunk-seat-menu-ys5v9abz.js"));w=e(o,(t,s,b)=>{let C=t instanceof Element?t.closest("[data-seat]")?.dataset.seat:void 0,v=l.get(C??a?.seatAt?.(s,b)??"");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){T(e),S(),a.setSeats(e)},setState(e,t){let s=l.get(e);if(s)s.state=t;S(),a.setState(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(){w?.(),a?.dispose(),o.remove()}}}export{I as mountRoundTable};
@@ -0,0 +1 @@
1
+ import{h,a,D,t,xe,m,e,n,s,dt,d,ye,vt,Ri,Ei}from"./chunk-index-zynq0b0w.js";import{qi,Bi,Fi,Gi}from"./chunk-index-j214tczc.js";import{Xt}from"./chunk-index-2yebd9tb.js";import{ni}from"./chunk-index-zrvg23jd.js";var v=()=>(h("48ecgtkg"),import("./chunk-layout-actions-48ecgtkg.js")),y=(r)=>(h("q694dpgk"),import("./chunk-placement-items-q694dpgk.js")).then((o)=>o.folderMenu(r)),F=(r)=>({mode:"folder",key:r,item:(o)=>o.closest("[data-folder-block]"),root:(o)=>o.closest("[data-folder-block]")?.parentElement??null,onDrop:(o)=>{if(o.type==="folder")v().then((i)=>i.placeFolderBefore(r,o.before))},open:Fi});function k(r){let{id:o,name:i}=r,c=qi().has(o),l=r.holdsActive||!c,u=D(),b=Xt(()=>y(o),F(o)),N=(f)=>{y(o).then((g)=>{if(!g)return;let p=f.getBoundingClientRect();ye({...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":o,"data-drop-zone":"folder","data-zone-id":o,"data-folder":o,"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":u,"aria-label":l?t("Collapse {name}",{name:i}):t("Expand {name}",{name:i}),onClick:()=>Bi(o),children:[e(s,{name:"chevron",size:16,className:"folder-chevron","data-open":l||void 0}),e("strong",{children:i}),e("span",{className:"meta",children:xe(r.count,"{count} room","{count} rooms")}),l?null:r.stack]}),r.muted==="none"?null:e(s,{name:"bell-off",size:14,className:"muted-mark","data-partial":r.muted==="some"||void 0,role:"img","aria-hidden":!1,"aria-label":r.muted==="all"?t("Notifications are off"):t("Some notifications are off")}),l?null:r.summary,e("button",{type:"button",className:"icon-button folder-more","aria-haspopup":"menu","aria-label":t("Folder menu"),onClick:(f)=>N(f.currentTarget),children:e(s,{name:"more",size:18})})]}),e("div",{id:u,className:"folder-body",hidden:!l,children:l?r.count===0?e("p",{className:"meta folder-empty",children:t("No rooms in this folder yet.")}):r.children:null})]})}var R=4;function S(r){let o=r.rooms.slice(0,R),i=d((l)=>o.map((u)=>l.rooms[u]?.view),o.join(",")),c=r.rooms.length-o.length;return n("span",{className:"folder-stack","aria-hidden":"true",children:[i.map((l)=>l?e("span",{className:"folder-stack-item",children:e(vt,{view:l,size:28})},l.key):null),c>0?n("span",{className:"folder-stack-more",children:["+",c]}):null]})}function M(r){let o=d((i)=>({waiting:r.rooms.reduce((c,l)=>c+dt(i,l),0),typing:r.rooms.some((c)=>i.rooms[c]?.typing)}),r.rooms.join(","));return n(m,{children:[o.typing?e(Ri,{}):null,o.waiting?e(Ei,{count:o.waiting}):null]})}function w(r){return d((o)=>ni(r,(i)=>o.rooms[i]?.view?.muted===!0),r.join(","))}function Q(r){let o=r.folders.map((i)=>i.id).join(",");return a(()=>{if(r.listed)Gi(o?o.split(","):[])},[r.listed,o]),e(m,{children:r.folders.map((i)=>e(C,{folder:i,...r},i.id))})}function C(r){let{folder:o}=r,i=w(o.rooms);return e(k,{id:o.id,name:o.name,count:o.rooms.length,holdsActive:r.active!==void 0&&o.rooms.includes(r.active),muted:i,summary:e(M,{rooms:o.rooms}),stack:e(S,{rooms:o.rooms}),children:r.rooms(o.rooms)})}export{Q as FolderList};
@@ -0,0 +1 @@
1
+ import{qi,Bi,Fi,Gi}from"./chunk-index-j214tczc.js";export{Fi as expandFolder,Gi as pruneCollapsed,Bi as toggleCollapsed,qi as useCollapsed};
@@ -1 +1 @@
1
- import{t,e,n,s,x}from"./chunk-index-v23m38p6.js";import{dn,Ut}from"./chunk-index-hssjbr1k.js";function l({steps:p}){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:p.map((a)=>e("li",{children:n("a",{className:"menu-item menu-link",href:x(a.open.page),children:[n("span",{className:"menu-text",children:[e("strong",{children:dn(a)}),Ut(a)?e("span",{className:"meta",children:Ut(a)}):null]}),e(s,{name:"chevron",size:16})]})},a.id))})]})}export{l as GatePage};
1
+ import{t,e,n,s,S}from"./chunk-index-zynq0b0w.js";import{On,Wt}from"./chunk-index-snzzfhk3.js";function l({steps:p}){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:p.map((a)=>e("li",{children:n("a",{className:"menu-item menu-link",href:S(a.open.page),children:[n("span",{className:"menu-text",children:[e("strong",{children:On(a)}),Wt(a)?e("span",{className:"meta",children:Wt(a)}):null]}),e(s,{name:"chevron",size:16})]})},a.id))})]})}export{l as GatePage};
@@ -0,0 +1 @@
1
+ import{r,e,n}from"./chunk-index-zynq0b0w.js";import"./chunk-index-yzsgsvnp.js";import"./chunk-index-0fmmvgee.js";import"./chunk-index-rnxj3z8k.js";import{Ut}from"./chunk-index-7xffskfa.js";import{qr,Br,Ui,Xn}from"./chunk-index-b6ca02e8.js";import"./chunk-index-vcyzwtk2.js";function b(i){let{roomKey:o,members:m}=i,{line:s}=Ui(o),[l,a]=r(),u=Br(qr(s,m),s?.id,l),t=(f)=>a({lineId:s?.id,member:f});return n("div",{className:"table-frame room-scene","data-focused":"",children:[e(Ut,{members:m,groupRoom:o,variant:"full",focus:u,onFocus:t,onSeat:t}),e(Xn,{roomKey:o,open:!0,streams:!1})]})}export{b as GroupScene};
@@ -0,0 +1 @@
1
+ import{nr,t,m,e,n,s,d,We}from"./chunk-index-zynq0b0w.js";import"./chunk-index-yzsgsvnp.js";import"./chunk-index-0fmmvgee.js";import"./chunk-index-rnxj3z8k.js";import{Ut}from"./chunk-index-7xffskfa.js";var i=(o,a)=>a?nr(o,a):o;function T(o){let a=d((c)=>c.rooms[o.roomKey]?.view),r=We();if(!a||a.kind!=="group")return null;let l=a.members??[];return n(m,{children:[n("button",{type:"button",className:"icon-button group-table-button","aria-label":t("Table"),"aria-pressed":o.scene,onClick:()=>o.onScene(!o.scene),children:[e(s,{name:"table"}),e("span",{className:"group-table-label",children:t("Table")})]}),r==="camelot"&&!o.scene?i(e("div",{className:"group-strip",children:e(Ut,{members:l,groupRoom:o.roomKey,variant:"compact"})}),o.slot):null]})}export{T as GroupTable};
@@ -0,0 +1 @@
1
+ import"./chunk-index-eg55mqqe.js";
@@ -0,0 +1 @@
1
+ import{Ke}from"./chunk-index-73gh7kgr.js";export{Ke as HostPicture};
@@ -0,0 +1 @@
1
+ import{fr,Qe,hr,pr,mr,Ci,Ai,Or,qs}from"./chunk-index-rnxj3z8k.js";export{Or as keepCards,Ai as keepReads,mr as noCards,pr as noReads,qs as onFrame,Ci as seedUnread,fr as subscribeHost,hr as totalUnread,Qe as useHost};