pi-straw-boss 0.51.2 → 0.52.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 (56) hide show
  1. package/NOTICE.md +4 -0
  2. package/README.md +12 -2
  3. package/README.zh-TW.md +12 -2
  4. package/dist/gui/assets/ask-BfqyWFHL.js +1 -0
  5. package/dist/gui/assets/chat-D9vJ2VgW.js +2 -0
  6. package/dist/gui/assets/drawer-2puVMQ4G.js +1 -0
  7. package/dist/gui/assets/index-DJZ9byyE.js +2 -0
  8. package/dist/gui/assets/index-DQK3T09k.css +1 -0
  9. package/dist/gui/assets/intel-CM0tcjrN.js +2 -0
  10. package/dist/gui/assets/{lanwait-B-jTJF9p.js → lanwait-D5EZzX1l.js} +1 -1
  11. package/dist/gui/assets/layer-B3XpK4A2.js +2 -0
  12. package/dist/gui/assets/{lightbox-Dx0VQahC.js → lightbox-B3w6hWOU.js} +1 -1
  13. package/dist/gui/assets/link-YtWMk0cL.js +1 -0
  14. package/dist/gui/assets/markdown-DvbY97ID.js +6 -0
  15. package/dist/gui/assets/pair-DW_7sagw.js +3 -0
  16. package/dist/gui/assets/{picker-G3V6FLYR.js → picker-DEtTrAnj.js} +1 -1
  17. package/dist/gui/assets/{server-oEgl0Axr.js → server-AlsOr8Yc.js} +2 -2
  18. package/dist/gui/assets/{settings-YSyrC2gU.js → settings-GqUawN7V.js} +2 -2
  19. package/dist/gui/assets/{spawn-Y7s7F5uV.js → spawn-BE3dB0IA.js} +1 -1
  20. package/dist/gui/assets/{trust-BnQ5IXn3.js → trust-C5SvajAB.js} +1 -1
  21. package/dist/gui/assets/{unit_count-DP2XmoZl.js → unit_count-Cu9Tq-Ca.js} +1 -1
  22. package/dist/gui/assets/views-Cdt6yzVx.js +2 -0
  23. package/dist/gui/assets/zenchunk-1xuaV6wt.js +2 -0
  24. package/dist/gui/assets/zenchunk-Bt2ak7sc.css +1 -0
  25. package/dist/gui/assets/zenwith-yFc77iTn.js +7 -0
  26. package/dist/gui/index.html +7 -2
  27. package/dist/server/cli.mjs +113 -29
  28. package/dist/server/main.mjs +470 -331
  29. package/package.json +1 -1
  30. package/prompts/main.md +1 -2
  31. package/prompts/planning.md +5 -5
  32. package/src/answerpane.ts +119 -0
  33. package/src/boss.ts +2 -2
  34. package/src/control.ts +11 -4
  35. package/src/dialogs.ts +3 -3
  36. package/src/gui.ts +4 -3
  37. package/src/handover.ts +1 -1
  38. package/src/host.ts +1 -1
  39. package/src/keys.ts +11 -0
  40. package/src/mirror.ts +32 -18
  41. package/src/owners.ts +11 -3
  42. package/src/server/cli.ts +1 -1
  43. package/src/server/guihost.ts +6 -4
  44. package/src/server/guiprefs.ts +13 -1
  45. package/src/towerprompt/look.ts +98 -0
  46. package/src/towerprompt/messages.ts +23 -14
  47. package/src/towerprompt/prompt.ts +42 -19
  48. package/dist/gui/assets/ask-DU5vqYJB.js +0 -1
  49. package/dist/gui/assets/chat-CptJZXYe.js +0 -2
  50. package/dist/gui/assets/drawer-B1TRzURa.js +0 -1
  51. package/dist/gui/assets/index-DoNA2F-7.css +0 -1
  52. package/dist/gui/assets/index-VmVZ0zwr.js +0 -1
  53. package/dist/gui/assets/layer-CT-_hdeu.js +0 -3
  54. package/dist/gui/assets/link-C5IYv9vw.js +0 -1
  55. package/dist/gui/assets/pair-CqfTj-jY.js +0 -3
  56. package/dist/gui/assets/views-BCNu4NjL.js +0 -13
package/NOTICE.md CHANGED
@@ -60,3 +60,7 @@ The GUI's sounds come from [Kenney](https://kenney.nl) (www.kenney.nl), released
60
60
  ## BIP-39 English word list (`src/link/bip39-english.ts`)
61
61
 
62
62
  Straw Link's safety words are drawn from the BIP-39 English word list (2048 words), copied unchanged from [`bip-0039/english.txt`](https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt) in the bitcoin/bips repository (sha256 `2f5eed53a4727b4bf8880d8f3f199efc90e58503646d9ff8eff3a2ed3b24dbda`). BIP-39, "Mnemonic code for generating deterministic keys", is by Marek Palatinus, Pavol Rusnak, Aaron Voisine, and Sean Bowe, and its header names the MIT license. The word list is part of Straw Link's protocol, so another implementation has to use the same list.
63
+
64
+ ## Zen view lines
65
+
66
+ The short lines under the Zen view's idle circle (`gui/zenlines.ts`) are one sentence or less each, shown with their source. Their sources, with the book, page, or chapter of each, are named in the comment above every entry: Thich Nhat Hanh, *Peace Is Every Step* (Bantam, 1991; 橡實文化 for the Chinese); Tara Brach and Mindful.org (mindful.org); Sharon Salzberg (sharonsalzberg.com); 華人正念減壓中心 (mindfulness.com.tw); 陳德中 and 台灣正念工坊 (Firstory). A Chinese line marked `zh: our translation`, and an English line marked `en: our translation`, are ours.
package/README.md CHANGED
@@ -18,6 +18,16 @@ English | [繁體中文](https://github.com/wayne930242/pi-straw-boss/blob/main/
18
18
 
19
19
  <p align="center"><sub>A unit's comms, a question you can answer from the browser, the Geek view, the settings page where each device picks its view, and the same page on a phone.</sub></p>
20
20
 
21
+ **Zen** is the third view, for the hours when you are answering the net rather than steering it. When something waits for you, the page shows that one thing alone: no map, no count of what else is queued. When you answer, cancel, or skip it (Maybe later), a breath of a pause follows, then the next. When nothing waits, it keeps the session you last talked to beside you, its live log and its composer; and with no session to keep, a breathing circle and a short line on mindfulness. One Esc cancels the question on the page, or skips the card when it cannot be cancelled; Esc twice (or the corner menu's last row) goes back to Standard. The corner menu also holds the language, the view, and the sound and volume, and the button beside it takes the page to full screen. Set it as the default with `/boss gui view zen`, or pick it on a device's settings page. Sounds and music come later.
22
+
23
+ <p align="center"><img src="docs/gui-zen-item.png" width="49%" alt="The Zen view with one item: a robot_hand question from ops-main on an ink-dark page, its choices as large buttons and Maybe later below"> <img src="docs/gui-zen-idle.png" width="49%" alt="The Zen view when nothing waits: the last session you talked to, its live log and its composer"></p>
24
+
25
+ <p align="center"><img src="docs/gui-zen-alone.png" width="49%" alt="The Zen view with nothing waiting and no session to keep: a breathing circle and a line on mindfulness"> <img src="docs/gui-zen-menu.png" width="49%" alt="The Zen view's corner menu open over an item: language, view, sound and volume, and the way back to Standard"></p>
26
+
27
+ <p align="center"><img src="docs/gui-phone-zen-item.png" width="220" alt="The Zen view on a phone with one item: the question and its choices fill the screen"> <img src="docs/gui-phone-zen-idle.png" width="220" alt="The Zen view on a phone when nothing waits: the last session's log and composer"> <img src="docs/gui-phone-zen-menu.png" width="220" alt="The Zen view's corner menu on a phone"></p>
28
+
29
+ <p align="center"><sub>Zen: one item at a time, the companion session when nothing waits, a breathing circle when there is no session, the corner menu, and the same on a phone.</sub></p>
30
+
21
31
  ![Herdr with pi-straw-boss: the sidebar's net view of every workspace, tower, main agent, and subagent, beside a main agent at work](docs/herdr-window.png)
22
32
 
23
33
  <p align="center"><sub>Herdr with the net view in its sidebar.</sub></p>
@@ -36,7 +46,7 @@ Run a few agents on the same project and they start stepping on each other: two
36
46
  - **A work board.** A main's board fills itself from its todo list and its name (`board_set` overrides it); allies see only an auto entry's name and progress (`<name> (3/5)`), never its task text; towers read every main's entry (`board_read`), on this computer and, with Straw Link, on teammates' computers, so a tower routes work knowing where each main stands ([how](docs/how-it-works.md#the-work-board)).
37
47
  - **A tower closes the mains it opened.** A main a tower opened for a request reports to the sender and to the tower, and the tower closes it (`boss_close_main`) when nothing is running in it ([how](docs/how-it-works.md#closing-an-opened-main)).
38
48
  - **A digest for the tower**: joins, subagent launches, and renames in its workspace since its last run, read into its next run once and cleared ([how](docs/how-it-works.md#the-towers-digest)).
39
- - **A browser view** of the whole net, `/boss gui`: every workspace as a base with its tower, agents, and subagents, animated and read-only. Click a base to zoom in, click a unit to read its chat as a live comms log; units that wait on you queue up as alerts, and Space opens the next one, F enlarges the top dialog, and Escape closes it (none of them while you type); a question is answered from the keyboard too: arrows choose, Tab moves between questions, and Enter confirms and goes on. A switch in the header's settings (the gear) raises a system notification, and another plays a sound, when a unit waits on you, fails, or finishes; finished units wait in a list of their own, cleared one by one or all at once, and a finished subagent on the map is dismissed one by one or all at once (Dismiss finished, beside the location). A unit's comms show its background monitors, and one that fails or goes quiet raises a notice (a quiet entry under the header's Notices button; only a unit waiting on you raises the prominent alert); a unit that is idle while a subagent of it works, or while a monitor of it runs, shows as commanding with a glow, and one that only waits on a running monitor shows its note in red. On a desktop a unit's terminal takes your keyboard once you click into it. It reads in English or Traditional Chinese, following your browser, with a language menu in the header's settings. + New base, the last card on the map, opens a base in a folder you pick with one member and no tower. A base without a tower takes more members (+ Member on the base adds one in a new tab, on a squad beside that squad), and its tower opens by the rules above; a base with a tower takes new mains (+ Main, on the base or in the tower's comms), each in a tab of its own. In a session's composer, a file pasted, dropped, or picked with + (20 MB at most) is stored in a private temp folder and its path goes into the message. × closes a base, a squad, or (in its view) a unit after a confirmation: each agent quits pi as `/quit` would, then its pane, tab, or workspace closes; nothing closes if one of them refuses. Each opening form takes an optional first message; the folder is picked in Finder-style columns (with New folder, and the base named after the folder by default), staying inside your home folder and skipping hidden folders (on Windows also the ones with the Hidden or System attribute, such as AppData and the old profile links), and while the unit opens a deploy panel shows the real steps (create, start, join the net, deliver the first message) with each step's clock, and names the step and the reason when one fails. A pi that must confirm project trust before it starts (a folder with `.pi/` settings, extensions, skills, or MCP servers) asks in the GUI as an alert too, with the folder, what trusting would load, and Trust, Trust this time, or Don't trust (the terminal can answer as well, and the first answer counts; a paired phone may answer; the deploy panel of an opening shows it inline).
49
+ - **A browser view** of the whole net, `/boss gui`: every workspace as a base with its tower, agents, and subagents, animated and read-only. Click a base to zoom in, click a unit to read its chat as a live comms log; units that wait on you queue up as alerts, and Space opens the next one, F enlarges the top dialog, and Escape closes it (none of them while you type); a question is answered from the keyboard too: arrows choose, Tab moves between questions, and Enter confirms and goes on. A switch in the header's settings (the gear) raises a system notification, and another plays a sound, when a unit waits on you, fails, or finishes; finished units wait in a list of their own, cleared one by one or all at once, and a finished subagent on the map is dismissed one by one or all at once (Dismiss finished, beside the location). A unit's comms show its background monitors, and one that fails or goes quiet raises a notice (a quiet entry under the header's Notices button; only a unit waiting on you raises the prominent alert); a unit that is idle while a subagent of it works, or while a monitor of it runs, shows as commanding with a glow, and one that only waits on a running monitor shows its note in red. On a desktop a unit's terminal takes your keyboard once you click into it. An answer that leaves its next step in a terminal (robot_hand's prompt and pane choices) opens that terminal for you. It reads in English or Traditional Chinese, following your browser, with a language menu in the header's settings. + New base, the last card on the map, opens a base in a folder you pick with one member and no tower. A base without a tower takes more members (+ Member on the base adds one in a new tab, on a squad beside that squad), and its tower opens by the rules above; a base with a tower takes new mains (+ Main, on the base or in the tower's comms), each in a tab of its own. In a session's composer, a file pasted, dropped, or picked with + (20 MB at most) is stored in a private temp folder and its path goes into the message. × closes a base, a squad, or (in its view) a unit after a confirmation: each agent quits pi as `/quit` would, then its pane, tab, or workspace closes; nothing closes if one of them refuses. Each opening form takes an optional first message; the folder is picked in Finder-style columns (with New folder, and the base named after the folder by default), staying inside your home folder and skipping hidden folders (on Windows also the ones with the Hidden or System attribute, such as AppData and the old profile links), and while the unit opens a deploy panel shows the real steps (create, start, join the net, deliver the first message) with each step's clock, and names the step and the reason when one fails. A pi that must confirm project trust before it starts (a folder with `.pi/` settings, extensions, skills, or MCP servers) asks in the GUI as an alert too, with the folder, what trusting would load, and Trust, Trust this time, or Don't trust (the terminal can answer as well, and the first answer counts; a paired phone may answer; the deploy panel of an opening shows it inline).
40
50
  - **Broadcast** to a tab, a workspace, every tower (a workspace without one, through its mains or members), or every session.
41
51
  - **Tidy tabs.** When a pi starts in a tab or quits out of it, the tab's panes are made equal again, so workers split off one by one don't leave a chain of halves.
42
52
  - **Stranded subagents are asked to report.** A subagent that stays open after finishing, while the pi that launched it was restarted and no longer receives its result, is asked once over intercom to send its final report there ([how it works](docs/how-it-works.md#orphaned-subagents)).
@@ -115,7 +125,7 @@ The tower only routes and coordinates, so it can run a lighter model: set `tower
115
125
  | `/boss gui`, `/boss gui stop`, `/boss gui rotate` | Open the net in the browser (any session, joins nothing); stop its GUI, from any session. The GUI is served by the sb server, one per machine, so it does not depend on which pi session runs: `/boss gui` starts the server when none runs and prints the URL, and a server that went down comes back when any pi session starts or looks (or from `cli.mjs up`). The URL carries a random token that is kept across a restart, an upgrade, a crash, a reboot, and a `/boss gui stop` followed by `/boss gui` (on the same port, in `gui-secrets.json`), so a page left open reconnects by itself and a phone stays paired. A new token comes only from `/boss gui rotate` (after a confirm; it unpairs every phone and opens the new address), a missing or corrupt `gui-secrets.json`, or a port that was taken at the next start: the old address then answers 403 and a phone scans the QR code again. Keeping the token has a cost you chose: another account on this machine that binds the port during a crash or restart gap sees what an open page sends; rotate after a gap you do not trust. With `STRAW_BOSS_DESK=1` (a desk shell shows the page itself) it opens no browser and the page leaves out Phone & devices and Stash. Only `/boss gui stop` keeps the GUI stopped, until the next `/boss gui` or `cli.mjs up`; `/boss stash` and `/boss close all` do not start a stopped GUI. The settings page's Server section (this computer's page only) shows the server's state, restarts it, and shows its log. Type into a session from its comms view, or work its terminal with the key pad under the terminal tile, or on a desktop by clicking into it and typing; answer a waiting `robot_hand` selector, `ask_user_question` questionnaire, or pi-code hook confirmation there or in its alert (so can any extension's `select` and `confirm`, also from a paired device; other dialogs show read-only, to answer in the terminal; `secret_drop` always takes its secret in the terminal, never on a page, local or over the tailnet, because pi-intercom identities are self-reported). Documents a session shows with [pi-herdr-doc-review](https://www.npmjs.com/package/pi-herdr-doc-review) 0.4.0 or newer open beside its comms: HTML in a sandboxed frame whose form answers the agent, text read-only. |
116
126
  | `/boss gui devices`, `/boss gui unpair <id\|all>` | List the paired phones (id, label, Tailscale or Wi-Fi, when paired and last seen) and unpair one (an id or the start of one) or all of them (after a confirm). The address does not change; `/boss gui rotate` is the one that gives a new address. |
117
127
  | `/boss gui lan`, `/boss gui lan off`, `/boss gui lan reset` | Reach the GUI from a phone on the same Wi-Fi, without Tailscale. It is off until you turn it on. This computer makes its own certificate, after showing you the risk: anyone who copies its key from this computer could pose to your phones as private-network sites (your router's page, a NAS) until you remove it from each phone. So use it on your phone's hotspot, or on a Wi-Fi that connects the phone directly to this computer. Each phone installs the certificate once (AirDrop or Quick Share it from the computer, and check it as the screen says), then pairs by QR code or typed code, and you allow each new phone on the computer by typing the number it shows. [How it works](docs/how-it-works.md#browser-view). |
118
- | `/boss gui view`, `/boss gui view auto\|standard\|geek` | Show or set the GUI's default view. A device on Auto (the page's default) shows it; a device that chose Standard or Geek in its settings keeps its choice, and with the default on `auto` a device follows its screen's contrast setting. Open pages switch at once, and a new page paints it on its first frame (the Geek view and the settings page are pictured at the top). Only this command sets it: no page, paired phone included, can. Showing it (no value) only reads: it starts no server, so one stopped on purpose stays down. |
128
+ | `/boss gui view`, `/boss gui view auto\|standard\|geek\|zen` | Show or set the GUI's default view. A device on Auto (the page's default) shows it; a device that chose Standard or Geek in its settings keeps its choice, and with the default on `auto` a device follows its screen's contrast setting. Open pages switch at once, and a new page paints it on its first frame (the Geek view, the Zen view, and the settings page are pictured at the top). Only this command sets it: no page, paired phone included, can. Showing it (no value) only reads: it starts no server, so one stopped on purpose stays down. |
119
129
  | `/boss gui remote`, `/boss gui remote off` | Reach the GUI from your phone over your tailnet (`tailscale serve`, never Funnel): pair by QR code (or, in an installed app, by the short code shown beside it), and a phone stays paired (90 days from its last use, `remote off` included) until you unpair it in the settings page's Phone & devices section or the GUI gets a new token (a pairing belongs to the token, which a restart keeps; `/boss gui rotate`, a lost `gui-secrets.json`, or a taken port makes a new one and the old pairings are cleared); remote access stays on across a restart or a new server until `remote off`, and a paired phone keeps working after a restart; after a new token a phone pairs again: in the browser by scanning the QR code, in an installed app by typing the pairing code (see below); off removes only its own serve entry. The serve entry points at a second loopback listener of the sb server's GUI, so a request is remote because of the listener it arrived on, whatever headers it carries. The page installs as an app (Add to Home Screen, or Chrome's Install) with a fixed entry, `https://<this machine>.<tailnet>.ts.net:8443/sb-app/`, as its start URL (a token-free address on the tailnet listener only): open with a pairing, it leads to the current page; open without one (after a new token, or on iOS, where the app keeps cookies of its own and scanning the QR in Safari never reaches it), it shows eight boxes for the **pairing code** that `/boss gui remote` prints under the QR (and the Phone & devices section shows beside it), one character per box (a paste fills them all). The code is 8 characters, shown as two groups of four (`ABCD EFGH`; no hyphen to type), works once within ten minutes, and is void after five wrong tries until you ask this computer for a new one. An app installed before this entry existed opens its old address, which now leads to the entry as well. |
120
130
  | `node dist/server/cli.mjs up --dir <folder> --label <name>` (a shell, not a pi command) | The desk steps of `up`, for a shell that shows the page itself (straw-boss-desk): with `STRAW_BOSS_DESK=1` set in the environment of `herdr server` and of this command, it installs Herdr's pi integration when it is not current, makes the shell's home base (a workspace in the folder, recorded in `desk.json` and found again by its workspace id), has the sb server stand in for its tower, waits for the GUI, and prints one JSON line with `url`, `workspace`, `pane`, `tower`, `created`, and `integration`. Idempotent: a second run opens nothing. Without the switch it exits 2. See [Desk mode](docs/how-it-works.md#desk-mode-up---dir). |
121
131
 
package/README.zh-TW.md CHANGED
@@ -18,6 +18,16 @@
18
18
 
19
19
  <p align="center"><sub>單位的通訊畫面、可以直接在瀏覽器回答的問題、極客檢視、每個裝置自選檢視的設定頁,以及同一個頁面在手機上的樣子。</sub></p>
20
20
 
21
+ **禪(Zen)** 是第三種檢視,給你在回應這張網、而不是指揮它的時候用。有東西在等你時,整個畫面只放那一件事:沒有地圖,也不顯示還排著幾件。你回答、取消或跳過(「晚點再說」)之後,會有一次呼吸般的停頓,再換下一件。沒有東西在等時,畫面留著你最近談過的那個 session,有它的即時紀錄和輸入框;連這樣的 session 都沒有時,就只有一個呼吸的圓圈和一句正念的話。按一次 Esc 會取消畫面上的問題,不能取消的卡片則是跳過;連按兩次 Esc(或選單最後一列)回到標準檢視。右上角的選單還有語言、檢視、音效與音量,旁邊的按鈕可以讓頁面全螢幕。用 `/boss gui view zen` 把它設成預設,或在裝置的設定頁自己選。音效和音樂之後才會加入。
22
+
23
+ <p align="center"><img src="docs/gui-zen-item.png" width="49%" alt="禪檢視裡的一件待辦:墨色畫面上是 ops-main 的 robot_hand 問題,選項是大按鈕,下方有「晚點再說」"> <img src="docs/gui-zen-idle.png" width="49%" alt="沒有東西在等時的禪檢視:最近談過的 session,有它的即時紀錄和輸入框"></p>
24
+
25
+ <p align="center"><img src="docs/gui-zen-alone.png" width="49%" alt="沒有東西在等、也沒有 session 可陪的禪檢視:一個呼吸的圓圈和一句正念的話"> <img src="docs/gui-zen-menu.png" width="49%" alt="在待辦上打開右上角選單的禪檢視:語言、檢視、音效與音量,以及回到標準檢視"></p>
26
+
27
+ <p align="center"><img src="docs/gui-phone-zen-item.png" width="220" alt="手機上的禪檢視,一件待辦:問題和選項佔滿畫面"> <img src="docs/gui-phone-zen-idle.png" width="220" alt="沒有東西在等時,手機上的禪檢視:最近談過的 session 的紀錄和輸入框"> <img src="docs/gui-phone-zen-menu.png" width="220" alt="手機上打開右上角選單的禪檢視"></p>
28
+
29
+ <p align="center"><sub>禪:一次一件待辦、沒東西等時陪著的 session、沒有 session 時的呼吸圓圈、右上角選單,以及同樣的畫面在手機上的樣子。</sub></p>
30
+
21
31
  ![裝了 pi-straw-boss 的 Herdr:側邊欄的網路檢視列出每個工作區、塔台、主智慧體和子智慧體,旁邊是一個正在工作的主智慧體](docs/herdr-window.png)
22
32
 
23
33
  <p align="center"><sub>側邊欄開著網路檢視的 Herdr。</sub></p>
@@ -36,7 +46,7 @@
36
46
  - **工作看板。** 主智慧體的看板由它的待辦清單和名稱自動填入(`board_set` 可覆寫);塔台讀每個主智慧體的項目(`board_read`),本機的,加上 Straw Link 團隊中隊友電腦上的,這樣塔台分派工作時知道各主智慧體做到哪([細節](docs/how-it-works.md#the-work-board))。
37
47
  - **塔台會關掉自己開的主智慧體。** 塔台替請求開出的主智慧體做完後,向發話者和那座塔台各回報一次;塔台確認裡面沒有東西在跑,就用 `boss_close_main` 把它關掉([細節](docs/how-it-works.md#closing-an-opened-main),英文)。
38
48
  - **給塔台的摘要**:自塔台上一輪以來,工作區裡有誰加入、啟動了哪些子智慧體、誰改了名字;塔台下一輪會讀進來一次,讀完就清掉([細節](docs/how-it-works.md#the-towers-digest))。
39
- - **瀏覽器畫面** `/boss gui` 看得到整張網:每個工作區是一座基地,裡面有塔台、智慧體和子智慧體,畫面會動,但只能看。點基地可以放大,點單位可以把它的對話當成即時通訊紀錄來讀;在等你回覆的單位會排成警示,按空白鍵開下一則,按 F 放大最上面的對話框,按 Esc 關掉它(打字時都不會觸發);回答問題也可以只用鍵盤:方向鍵選項目,Tab 換題,Enter 確認並跳到下一題。頂端齒輪「設定」裡有兩個開關:單位在等你、出錯或完成時,一個會跳系統通知,一個會播音效;已完成的單位另外排在自己的清單裡,可以一個一個清,也可以一次全清;地圖上已結束的子智慧體也可以一個一個移除,或用位置列旁的「移除已完成」一次全移除。單位的通訊畫面也會列出它在背景跑的 Monitor,出錯或太久沒輸出的 Monitor 會列進標頭的「通知」(只有在等你回答的單位才會跳出醒目的警示,出錯和完成都只是安靜的通知);自己閒置、但它的子智慧體在工作或等待,或它的 Monitor 還在跑的單位,會顯示成帶光暈的「指揮中」;只在等 Monitor 跑完的單位,備註會用紅字顯示「監看中」。在桌面上點進單位的終端機,就能直接用鍵盤操作它。畫面有英文和正體中文,預設跟隨瀏覽器語言,也可以從頂端「設定」裡的語言選單切換。地圖最後一張「+新基地」會在選定的資料夾開一座基地,裡面先有一位成員、沒有塔台。沒有塔台的基地只能加成員(基地上的「+成員」開在新分頁,小隊上的開在該小隊旁),等成員自己升格時才會開塔台;有塔台的基地只能加主智慧體(「+主智慧體」,各開在自己的分頁)。在 session 的輸入框貼上、拖進或用「+」選的檔案(最多 20 MB)會存到私有的暫存資料夾,路徑放進訊息。開啟表單都可以先填第一句指令;資料夾選擇只能在家目錄以下,也不會列出點開頭的資料夾。
49
+ - **瀏覽器畫面** `/boss gui` 看得到整張網:每個工作區是一座基地,裡面有塔台、智慧體和子智慧體,畫面會動,但只能看。點基地可以放大,點單位可以把它的對話當成即時通訊紀錄來讀;在等你回覆的單位會排成警示,按空白鍵開下一則,按 F 放大最上面的對話框,按 Esc 關掉它(打字時都不會觸發);回答問題也可以只用鍵盤:方向鍵選項目,Tab 換題,Enter 確認並跳到下一題。頂端齒輪「設定」裡有兩個開關:單位在等你、出錯或完成時,一個會跳系統通知,一個會播音效;已完成的單位另外排在自己的清單裡,可以一個一個清,也可以一次全清;地圖上已結束的子智慧體也可以一個一個移除,或用位置列旁的「移除已完成」一次全移除。單位的通訊畫面也會列出它在背景跑的 Monitor,出錯或太久沒輸出的 Monitor 會列進標頭的「通知」(只有在等你回答的單位才會跳出醒目的警示,出錯和完成都只是安靜的通知);自己閒置、但它的子智慧體在工作或等待,或它的 Monitor 還在跑的單位,會顯示成帶光暈的「指揮中」;只在等 Monitor 跑完的單位,備註會用紅字顯示「監看中」。在桌面上點進單位的終端機,就能直接用鍵盤操作它。如果一個答案的下一步要在終端機進行(robot_hand 的「放進提示列」和開新 pane 的選項),畫面會直接替你打開那個終端機。畫面有英文和正體中文,預設跟隨瀏覽器語言,也可以從頂端「設定」裡的語言選單切換。地圖最後一張「+新基地」會在選定的資料夾開一座基地,裡面先有一位成員、沒有塔台。沒有塔台的基地只能加成員(基地上的「+成員」開在新分頁,小隊上的開在該小隊旁),等成員自己升格時才會開塔台;有塔台的基地只能加主智慧體(「+主智慧體」,各開在自己的分頁)。在 session 的輸入框貼上、拖進或用「+」選的檔案(最多 20 MB)會存到私有的暫存資料夾,路徑放進訊息。開啟表單都可以先填第一句指令;資料夾選擇只能在家目錄以下,也不會列出點開頭的資料夾。
40
50
  - **廣播**給一個分頁、一個工作區、所有塔台(沒有塔台的工作區改送主智慧體或成員),或所有 session。
41
51
  - **分頁保持整齊。** pi 在分頁裡啟動或結束時,分頁裡的 pane 會重新平均分配,一個一個切出來的 worker 就不會留下一長串對半切的窄 pane。
42
52
  - **斷線的子智慧體會被提醒回報。** 子智慧體做完後還開著,但開出它的 pi 已經重開、收不到它的結果時,它會收到一則 intercom,請它把最終報告送回去,只會送一次([運作方式](docs/how-it-works.md#orphaned-subagents))。
@@ -111,7 +121,7 @@ pi install npm:pi-straw-boss
111
121
  | `/boss gui`、`/boss gui stop`、`/boss gui rotate` | 在瀏覽器開啟網(任何 session 都能開,不會加入任何東西);停止它的伺服器,在哪個 session 都可以。整台機器只跑一個伺服器,網址會保留(見下):開它的 session `/reload` 之後會重開(網址不變);跑它的 session 結束時(關掉 pane、離開 pi、當機),另一個還開著的 session 會在幾秒內重開它(網址不變)(塔台優先;pi-straw-boss 版本比伺服器舊的 session 要等約六秒才接手,直到下一個較新的 session 再接回去);之後才啟動的 session 也會把停著的伺服器重開,即使所有 session 都離開過或機器重開機;版本較新的 session 會接手,但開著的頁面不會自動換成新版:它會顯示「這個網址已失效」,要用 `/boss gui` 重開。網址裡的 token 會跨過重啟保留:伺服器重啟、升級、當機、重開機,或 `/boss gui stop` 之後再 `/boss gui`,都沿用同一個 token(存在 `gui-secrets.json`,連同埠號),開著的分頁會自行重新連線,手機仍維持配對。只有 `/boss gui rotate`(會先確認;換新 token 與 CSRF 密鑰、解除所有手機的配對並開啟新網址)、`gui-secrets.json` 遺失或損毀,或下次啟動時埠號被占用,才會換新 token:舊網址回 403,手機要重新掃 QR code。保留 token 的代價是你選擇接受的:當機或重啟的空檔裡,這台機器上其他帳號若搶先佔用該埠,會看到開著的頁面送出的內容;對空檔不放心時請 rotate。設了 `STRAW_BOSS_DESK=1`(桌面殼自己顯示頁面)時,它不會開瀏覽器,頁面也不顯示設定頁的「手機與裝置」與 Stash。只有 `/boss gui stop` 會讓它維持停止,直到下一次 `/boss gui`;`/boss stash` 和 `/boss close all` 不會把停著的伺服器重開。可以在通訊畫面直接打字給某個 session,或用終端機畫面下方的按鍵面板操作它的終端機,在桌面上也可以點進終端機直接打字;在等回覆的 `robot_hand` 選單、`ask_user_question` 問卷或 pi-code 的 hook 確認,可以在那裡或它的警示裡作答(任何 extension 的 `select` 和 `confirm` 也可以,`confirm` 也可以從配對的裝置作答;其他對話框只能看,要回到終端機回答;`secret_drop` 的機密一律在終端機輸入,任何頁面(本機或 tailnet)都不接受,因為 pi-intercom 的身分是自己申報的,無法驗證)。session 用 [pi-herdr-doc-review](https://www.npmjs.com/package/pi-herdr-doc-review) 0.4.0 以上顯示的文件,會開在它的通訊畫面旁邊:HTML 放在沙箱框架裡,表單送出的答案會傳給智慧體;純文字只能讀。 |
112
122
  | `/boss gui devices`、`/boss gui unpair <id\|all>` | 列出已配對的手機(id、標籤、Tailscale 或 Wi-Fi、配對與最後使用時間),並解除配對一支(給 id 或 id 的開頭)或全部(先確認)。網址不會變;要換網址是 `/boss gui rotate`。 |
113
123
  | `/boss server logs [n]` | 顯示 sb 伺服器記錄的最後 `n` 行(預設與上限都是 200),和 `boss_server` 工具的 `logs` 相同。 |
114
- | `/boss gui view`、`/boss gui view auto\|standard\|geek` | 顯示或設定 GUI 的預設檢視。設定頁維持「自動」的裝置會顯示這個預設;自己選了標準或極客的裝置保留自己的選擇;預設為 `auto` 時,裝置依自己螢幕的對比設定。已開啟的頁面立即切換,新開的頁面第一個畫面就是預設檢視(頂端有極客檢視和設定頁的截圖)。只有這個指令能設定:任何頁面(包括已配對的手機)都不行。 |
124
+ | `/boss gui view`、`/boss gui view auto\|standard\|geek\|zen` | 顯示或設定 GUI 的預設檢視。設定頁維持「自動」的裝置會顯示這個預設;自己選了標準或極客的裝置保留自己的選擇;預設為 `auto` 時,裝置依自己螢幕的對比設定。已開啟的頁面立即切換,新開的頁面第一個畫面就是預設檢視(頂端有極客檢視、禪檢視和設定頁的截圖)。只有這個指令能設定:任何頁面(包括已配對的手機)都不行。 |
115
125
  | `/boss gui remote`、`/boss gui remote off` | 透過你的 tailnet 用手機連 GUI(`tailscale serve`,絕不用 Funnel):掃 QR code 配對(已安裝的 app 則輸入 QR 旁邊顯示的短配對碼),手機配對後的紀錄會保留(從最後一次使用起算 90 天,重啟與 `remote off` 都不影響),直到你在設定頁的「手機與裝置」區解除配對;遠端存取在 stop、`/reload`、換新伺服器之後仍會保持開啟,直到 `remote off`;伺服器重啟後 token 不變,已配對的手機照常使用;GUI 換新 token(`/boss gui rotate`、`gui-secrets.json` 遺失,或埠號被占用)時,舊的配對全部清除(cookie 綁在舊 token 的路徑上),手機要重新配對:瀏覽器掃 QR code,已安裝的 app 輸入配對碼(見下);關閉時只移除它自己的 serve 設定。serve 指向 GUI 伺服器的第二個 loopback 監聽埠,請求算不算遠端取決於它進來的監聽埠,不看它帶什麼標頭。頁面可以安裝成 app(加入主畫面,或 Chrome 的「安裝」):app 的起始網址是固定入口 `https://<這台機器>.<tailnet>.ts.net:8443/sb-app/`(沒有 token,只在 tailnet 監聽埠上):已配對時它會帶你到目前的頁面;沒有配對時(換新 token 後,或 iOS 上 app 有自己的 cookie、在 Safari 掃 QR code 永遠到不了 app),它會顯示 8 個輸入格,輸入 `/boss gui remote` 在 QR code 下方印出的**配對碼**(設定頁的「手機與裝置」區也顯示在 QR code 旁),每格一個字元(貼上整組會自動填滿)。配對碼 8 個字元,顯示成兩組各四個(`ABCD EFGH`,不需要輸入連字號),十分鐘內只能用一次,輸錯五次後作廢,要在這台電腦上重新取得新的才能再試。在這個入口出現之前安裝的 app,舊網址現在也會導向入口。 |
116
126
  | `node dist/server/cli.mjs up --dir <資料夾> --label <名稱>`(給外殼程式用,不是 pi 指令) | `up` 的桌面步驟,給自己顯示頁面的外殼程式(straw-boss-desk)使用:在啟動 `herdr server` 與執行這個指令的環境都設了 `STRAW_BOSS_DESK=1` 時,它會在 Herdr 的 pi 整合不是最新時安裝,建立外殼的家基地(在該資料夾開一個工作區,記在 `desk.json`,之後以工作區 id 找回),讓 sb server 代替這個工作區的塔台,等 GUI 起來,最後印出一行 JSON,內有 `url`、`workspace`、`pane`、`tower`、`created`、`integration`。重複執行不會多開東西;沒設這個開關時以代碼 2 結束。詳見[桌面模式](docs/how-it-works.md#desk-mode-up---dir)。 |
117
127
 
@@ -0,0 +1 @@
1
+ import{t as e}from"./runtime-ZX6HkxDa.js";import{a as t,i as n,n as r,r as i,t as a}from"./sending-aEpvzoz2.js";import{$ as o,Ht as s,St as c,t as l}from"./index-DJZ9byyE.js";var u=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在終端機中回答。`:`Answer it in the terminal.`),d=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在終端機中回答。`:`Answer them in the terminal.`),f=((t={},n={})=>(n.locale??e())===`zh-TW`?`下方還有 ▾`:`More below ▾`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`也可以自己輸入答案。`:`It also takes your own words.`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`可以複選。`:`It takes several choices.`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`已取消。`:`Cancelled.`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`選擇`:`Choices`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`瀏覽器拒絕存取剪貼簿。`:`The browser refused the clipboard.`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`已複製到這台裝置的剪貼簿。`:`Copied to this device's clipboard.`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`複製指令`:`Copy command`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個選項有預覽;請在終端機中查看。`:`It has a preview; see it in the terminal.`),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註`:`Note`),S=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註(選填)`:`Note (optional)`),C=e=>`Opened while ${e?.tool} was running; it may not be about that call.`,w=e=>`在 ${e?.tool} 執行時開啟,不一定與該呼叫有關。`,T=((t,n={})=>(n.locale??e())===`zh-TW`?w(t):C(t)),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`選項`:`Options`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`另一個答案沒有被採用;這個可以送出。`:`The other answer was not taken; this one can go.`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`你的答案`:`Your own answer`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`或自己輸入答案`:`Or type your own answer`),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`問題已變更,請重新閱讀。`:`The question changed; read it again.`),j=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 讀不懂這個答案。`:`The session could not read that answer.`),M=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個答案不符合問題。`:`That answer does not fit the question.`),N=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 拒絕了這個答案。`:`The session refused that answer.`),P=((t={},n={})=>(n.locale??e())===`zh-TW`?`安全考量,遠端不支援輸入機密。請到執行 GUI 的那台電腦的終端機中回答。`:`For security, entering a secret is not supported remotely. Answer it in the terminal on the computer the GUI runs on.`),ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`機密內容只能在終端機輸入,這裡不接受。請到執行 GUI 的那台電腦的終端機中回答。`:`A secret is entered in the terminal only, not here. Answer it in the terminal on the computer the GUI runs on.`),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`送出答案`:`Send answer`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示終端機`:`Show terminal`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中關閉。`:`It was dismissed in the terminal.`),R=((t={},n={})=>(n.locale??e())===`zh-TW`?`它已不再開啟。`:`It is no longer open.`),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中回答。`:`It was already answered in the terminal.`),B=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框。`:`It waits on a dialog.`),V={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};function H(e,t,n,r,i){let{q:a}=n,o=r[a],s=V[e]??0,c=e===`ArrowUp`,l=c||e===`ArrowDown`,u=()=>({to:r.map((e,t)=>({q:(a+1+t)%r.length,part:`opt`})).find(e=>e.q!==a&&!i[e.q])??`send`});if(e===`Tab`)return t?n.part===`opt`&&a>0?{to:{q:a-1,part:`opt`}}:void 0:a<r.length-1?{to:{q:a+1,part:`opt`}}:void 0;if(!t){if(n.part===`opt`){let t=n.o+s;if(s)return t>=0&&t<o.options?{to:{q:a,part:`opt`,o:t},...o.multiple?{}:{pick:t}}:{to:s>0&&o.own?{q:a,part:`own`}:n};if(e===`Enter`||e===` `&&!o.multiple)return{...u(),...o.multiple?{}:{pick:n.o}}}else if(n.part===`own`){if(e===`Enter`)return u();if(l)return{to:c?{q:a,part:`opt`,o:o.options-1}:{q:a,part:`note`}}}else if(c)return{to:{q:a,part:`own`}}}}function U(e,t,n){let r=e=>Math.max(0,e.opts.findIndex(e=>e.getAttribute(`aria-checked`)===`true`)),i=(e,t)=>e.opts.forEach((e,n)=>e.setAttribute(`tabindex`,n===t?`0`:`-1`)),a=e=>{for(let[n,r]of t.entries()){let t=r.opts.indexOf(e);if(t>=0)return{q:n,part:`opt`,o:t};if(e===r.own||e===r.note)return{q:n,part:e===r.own?`own`:`note`}}};t.forEach(e=>i(e,r(e)));let o=e=>{let n=a(e.target);n?.part===`opt`&&i(t[n.q],n.o)};e.addEventListener(`focusin`,o),e.addEventListener(`click`,o);let s=!1;return e.addEventListener(`keydown`,e=>{let i=a(e.target);if(!i||e.ctrlKey||e.altKey||e.metaKey||e.isComposing)return;let o=e.target;if(i.part!==`opt`&&(e.key===`ArrowUp`?o.selectionStart!==0:e.key===`ArrowDown`&&o.selectionEnd!==o.value.length))return;let c=H(e.key,e.shiftKey,i,t.map(e=>({options:e.opts.length,multiple:e.multiple,own:!!e.own})),t.map(e=>e.answered()));if(!c||(e.preventDefault(),e.repeat&&[`Enter`,` `].includes(e.key)))return;if(s=e.key===` `,c.pick!==void 0){let e=t[i.q].opts[c.pick];e.getAttribute(`aria-checked`)!==`true`&&e.click()}let l=c.to===`send`?void 0:t[c.to.q],u=c.to===`send`?n():c.to.part===`opt`?l.opts[c.to.o??r(l)]:c.to.part===`own`?l.own:l.note;u&&!u.disabled&&u.focus()}),e.addEventListener(`keyup`,e=>s&&e.key===` `&&(s=!1,e.preventDefault())),()=>t[0]?.opts[r(t[0])]}var W=e=>e.multiple?m():e.freeform&&e.options.length?p():``,G=(e,t)=>o(`div`,{class:`ask-one`},e.header&&o(`b`,{class:`ask-head`},e.header),o(`p`,{class:`ask-q`},e.question),e.context&&o(`div`,{class:`ask-ctx`},e.context),e.options.length>0&&o(`ol`,{class:`ask-opts`,"aria-label":E()},...e.options.map(e=>o(`li`,{class:`ask-opt`},o(`b`,null,e.title),e.description&&o(`small`,null,e.description)))),t&&W(e)&&o(`small`,{class:`ask-how`},W(e))),K=e=>e.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\p{Cf}]/gu,`�`),q=e=>(e.select?.choices??[]).map((e,t)=>({...e,i:t})),J=(e,t,n)=>({...e.size?{choices:[...e].sort((e,t)=>e-t)}:{},...t.trim()?{text:t}:{},...n.trim()?{note:n}:{}}),Y=(e,t,n)=>({dialog:e.dialog,digest:e.digest,answerId:n,...t}),X=(e,t)=>({dialog:e.dialog,digest:e.digest,answerId:t,cancel:!0}),Z=(e,t)=>e.cancel===!0&&!(t&&e.select?.choices.every(e=>e.hereOnly)),Q={digest:A,"not-allowed":M,malformed:j};function te(e,i=!1){let{outcome:a,reason:o,by:s}=e.body;return a===`accepted`?[`ok`,i?h():n()]:a===`stale`?[`error`,s===`local`?z():s===`cancel`?L():R()]:a===`rejected`?[`error`,(Object.hasOwn(Q,String(o))?Q[String(o)]:N)()]:a===`busy`?[`error`,t()]:a===`unknown`||e.status===504?[`error`,r(),!0]:[`error`,o??c({status:e.status})]}var ne=e=>[`accepted`,`stale`,`busy`,`unknown`].includes(String(e.body.outcome))||e.status===504,$=e=>e.answer?`d\n${e.answer.dialog}\n${e.answer.digest}`:`c\n${e.callId}\n${e.why??``}`;function re(e){if(e.dataset.cued)return;e.dataset.cued=`1`;let t=()=>{e.toggleAttribute(`data-more`,e.scrollHeight-e.scrollTop-e.clientHeight>4);for(let t of e.querySelectorAll(`.ask-acts`))t.dataset.cue=f()};for(let n of[`scroll`,`input`])e.addEventListener(n,t,{passive:!0});typeof ResizeObserver<`u`&&new ResizeObserver(t).observe(e),typeof MutationObserver<`u`&&new MutationObserver(t).observe(e,{childList:!0,subtree:!0,characterData:!0}),typeof requestAnimationFrame<`u`&&requestAnimationFrame(t)}function ie(e,t,n=location.hostname!==`127.0.0.1`,c,f,p=I){let m,h,C,w=!1,A=!1,j;for(let e of[`focusin`,`pointerdown`])document.addEventListener(e,e=>h&&!h.el.contains(e.target)&&(h.lost=void 0));let M=(e,t,n,...r)=>(e.dataset.tone=t,e.replaceChildren(n,...r)),N=()=>{if(!h)return;let e=document.activeElement;e&&e!==document.body&&e!==h.lost&&(h.lost=void 0),h.controls.forEach(e=>e.disabled=!w||A||h.done),h.send&&(h.send.disabled=!w||A||h.done||!h.pick()),e&&h.el.contains(e)&&e.disabled&&(h.lost=e);let t=h.lost;t&&!t.disabled&&h.el.contains(t)&&(!document.activeElement||document.activeElement===document.body)&&(t.focus(),h.lost=void 0)};async function L(e,n){[e.sending,A,e.spell]=[!0,!0,!1],N(),M(e.note,``,a());let s=await t(`answer`,n).catch(()=>void 0),u=o(`button`,{type:`button`,class:`cmp-link`},i());u.onclick=()=>void L(e,n);let[d,p,m]=s?te(s,n.cancel===!0):[`error`,r(),!0];[e.done,e.sending,A,e.busy]=[!s||ne(s),!1,!1,s?.body.outcome===`busy`],M(e.note,d,p,...m?[u]:[]);let h=s?.body.outcome===`accepted`?s.body.then:void 0,g=h&&l(h,c);g&&M(e.note,d,`${p} ${g}`),N(),e.note.scrollIntoView?.({block:`nearest`}),f&&s?.body.outcome===`accepted`&&setTimeout(()=>f(!!h&&!g),h&&!g?0:1200)}let R=(e,t,n,r,i)=>{let a=o(`button`,{type:`button`,class:`ask-opt`,role:e,"aria-checked":`false`},o(`b`,i?{"data-n":String(i)}:null,t),...n.filter(Boolean).map(e=>o(`small`,null,e)));return a.onclick=r,a};function z(e,t){let r,i=q(t).map(e=>R(`radio`,K(e.label),[e.note&&K(e.note)],()=>(r=e.i,i.forEach((n,r)=>n.setAttribute(`aria-checked`,String(q(t)[r].i===e.i))),N()),e.i+1)),a=t.select?.copy!==void 0&&o(`button`,{type:`button`,class:`cmp-link`},y());a&&(a.disabled=!navigator.clipboard,a.onclick=()=>void navigator.clipboard.writeText(t.select.copy).then(()=>M(e.note,`ok`,v()),()=>M(e.note,`error`,_())));let s=i.filter((e,r)=>!(n&&q(t)[r].hereOnly));return i.forEach(e=>!s.includes(e)&&(e.disabled=!0)),e.pick=()=>r===void 0?void 0:{choice:r},e.first=U(e.el,[{opts:i,multiple:!1,answered:()=>r!==void 0}],()=>e.send),e.controls=s,[o(`pre`,{class:`ask-title`},K(t.select.title)),o(`div`,{class:`ask-opts`,role:`radiogroup`,"aria-label":g()},...i),o(`div`,{class:`ask-acts`},e.send,e.cancel,a)]}function V(e,t){let n=t.questions.map(()=>({picks:new Set,text:o(`textarea`,{rows:`1`,maxlength:`8192`,class:`ask-own`,placeholder:k(),"aria-label":O()}),note:o(`input`,{type:`text`,maxlength:`2048`,class:`ask-own ask-memo`,placeholder:S(),"aria-label":x()})})),r=[],i=t.questions.map((t,i)=>{let a=n[i],s=t.multiple?`checkbox`:`radio`,c=t.options.map((e,n)=>R(s,e.title,[e.description,e.preview&&b()],()=>{t.multiple||(a.picks.clear(),a.text.value=``),a.picks.has(n)?a.picks.delete(n):a.picks.add(n),c.forEach((e,t)=>e.setAttribute(`aria-checked`,String(a.picks.has(t)))),N()}));return a.text.oninput=()=>(t.multiple||(a.picks.clear(),c.forEach(e=>e.setAttribute(`aria-checked`,`false`))),N()),e.controls.push(...c,a.text,a.note),r.push({opts:c,multiple:!!t.multiple,own:a.text,note:a.note,answered:()=>a.picks.size>0||a.text.value.trim()!==``}),o(`div`,{class:`ask-one`},t.header&&o(`b`,{class:`ask-head`},t.header),o(`p`,{class:`ask-q`},t.question),o(`div`,{class:`ask-opts`,role:t.multiple?`group`:`radiogroup`,"aria-label":E()},...c),a.text,a.note)});return e.pick=()=>n.every(e=>e.picks.size||e.text.value.trim())?{answers:n.map(e=>J(e.picks,e.text.value,e.note.value))}:void 0,e.first=U(e.el,r,()=>e.send),[...i,o(`div`,{class:`ask-acts`},e.send,e.cancel)]}function H(e){let t=e.asks??(e.ask?[e.ask]:[]),r=t.length>1,i=e.answer,a={key:$(e),el:o(`section`,{class:`ask`}),note:o(`p`,{class:`ask-note`,role:`status`,"aria-live":`polite`}),controls:[],pick:()=>void 0,done:!1,sending:!1};i&&((a.send=o(`button`,{type:`button`,class:`ask-send`},F())).onclick=()=>void(a.pick()&&L(a,Y(i,a.pick(),crypto.randomUUID()))));let l=e.tool===`secret_drop`;i&&!l&&Z(i,n)&&((a.cancel=o(`button`,{type:`button`,class:`ask-cancel`},s())).onclick=()=>void L(a,X(i,crypto.randomUUID())));let f=o(`p`,{class:`ask-term`},e.why&&t.length?e.why:`${r?d():u()} ${r||!t[0]?``:W(t[0])}`.trim()),m=c&&e.tool!==`secret_drop`&&o(`button`,{type:`button`,class:`cmp-link`},p());m&&(m.onclick=c);let h=e.answer?.twin&&e.tool&&e.tool!==`dialog`?[o(`p`,{class:`ask-why`},T({tool:e.tool}))]:[];return a.el.append(...h,...i&&!l?i.select?z(a,i):V(a,i):[...t.length?t.map(e=>G(e,r)):[o(`p`,{class:`ask-why`},l?n?P():ee():e.why??B())],o(`div`,{class:`ask-acts`},l?o(`p`,{class:`ask-term`},u()):f,m)],a.note),a.cancel&&a.controls.push(a.cancel),a}let Q=(t,n)=>{let r=document.activeElement;h&&h!==n&&(h.focus=h.el.contains(r)?r:void 0),[m,h,C]=[t,n,n?.send?n:C],e.replaceChildren(...n?[n.el]:[]),n&&re(n.el),N(),n?.focus&&(!document.activeElement||document.activeElement===document.body)&&n.focus.focus()};return{enter(){let e=h&&!h.done?h.first?.():void 0;return!!(e&&!e.disabled&&(e.focus(),1))},cancel(){let e=h&&!h.done?h.cancel:void 0;return!!(e&&!e.disabled&&(e.click(),1))},sending:()=>A,update(e,t){w=t,e&&(j=void clearTimeout(j)),!e&&(h?.done||h?.sending)?j??=setTimeout(()=>(j=void 0,Q()),6e3):e?h&&($(e)===h.key||!e.answer&&(h.done||h.sending)&&e.callId===m?.callId)?((h.busy||h.sending)&&!e.answer?h.spell=!0:h.busy&&h.spell&&e.answer&&([h.done,h.busy]=[!1,!1],M(h.note,``,D())),m=e):Q(e,C?.key===$(e)&&!C.done?C:H(e)):Q(),N()}}}export{ie as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-DQK3T09k.css"])))=>i.map(i=>d[i]);
2
+ import{t as e}from"./runtime-ZX6HkxDa.js";import{c as t,l as n,s as r,u as i}from"./zenwith-yFc77iTn.js";import{n as a,t as o}from"./markdown-DvbY97ID.js";import{$ as s,T as c,f as l,g as u,k as d,r as f,tt as ee}from"./index-DJZ9byyE.js";var te=((t={},n={})=>(n.locale??e())===`zh-TW`?`可能已被當機的 run 處理過:動手前先確認。`:`A run that crashed may already have handled this: check before acting.`),ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`分支摘要`:`branch summary`),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`通訊紀錄`:`Comms log`),p=e=>`context compacted · ${e?.tokens} tokens summarized`,m=e=>`上下文已壓縮 · 摘要了 ${e?.tokens} tokens`,ie=((t,n={})=>(n.locale??e())===`zh-TW`?m(t):p(t)),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`…(於 1 MB 截斷)`:`… (cut at 1 MB)`),h=e=>`exit ${e?.code}`,g=e=>`結束碼 ${e?.code}`,oe=((t,n={})=>(n.locale??e())===`zh-TW`?g(t):h(t)),_=e=>`Image ${e?.n}`,v=e=>`圖片 ${e?.n}`,se=((t,n={})=>(n.locale??e())===`zh-TW`?v(t):_(t)),ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`圖片無法讀取`:`Image unavailable`),y=e=>`${e?.count} image(s)`,b=e=>`${e?.count} 張圖片`,le=((t,n={})=>(n.locale??e())===`zh-TW`?b(t):y(t)),ue=((t={},n={})=>(n.locale??e())===`zh-TW`?`收到`:`incoming`),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`跳到最新`:`jump to latest`),S=e=>`${e?.count} new`,C=e=>`${e?.count} 則新訊息`,w=((t,n={})=>(n.locale??e())===`zh-TW`?C(t):S(t)),de=((t={},n={})=>(n.locale??e())===`zh-TW`?`還沒有通訊。`:`No transmissions yet.`),fe=((t={},n={})=>(n.locale??e())===`zh-TW`?`通知`:`notice`),pe=((t={},n={})=>(n.locale??e())===`zh-TW`?`細節`:`details`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`表單回覆`:`form answers`),me=((t={},n={})=>(n.locale??e())===`zh-TW`?`訊息,來自`:`message from`),E=e=>`answer from ${e?.from}`,D=e=>`${e?.from} 的回答`,he=((t,n={})=>(n.locale??e())===`zh-TW`?D(t):E(t)),O=e=>`request from ${e?.from}`,k=e=>`${e?.from} 的請求`,ge=((t,n={})=>(n.locale??e())===`zh-TW`?k(t):O(t)),A=e=>`message from ${e?.from}`,j=e=>`${e?.from} 的訊息`,_e=((t,n={})=>(n.locale??e())===`zh-TW`?j(t):A(t)),M=e=>`reply to your ask from ${e?.from}`,N=e=>`${e?.from} 回覆了你的詢問`,ve=((t,n={})=>(n.locale??e())===`zh-TW`?N(t):M(t)),P=((t={},n={})=>(n.locale??e())===`zh-TW`?`記憶`:`memory`),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`監看`:`monitor`),ye=((t={},n={})=>(n.locale??e())===`zh-TW`?`本機`:`this computer`),be=((t={},n={})=>(n.locale??e())===`zh-TW`?`隊友`:`teammate`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`提問,來自`:`question from`),xe=((t={},n={})=>(n.locale??e())===`zh-TW`?`回報,來自`:`report from`),Se=((t={},n={})=>(n.locale??e())===`zh-TW`?`sb server 的通知`:`notice from the sb server`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`狀態:`:`status of`),R=((t={},n={})=>(n.locale??e())===`zh-TW`?`Straw Link 訊息`:`Straw Link message`),Ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`喚醒鬧鐘`:`wake-up call`),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`塔台事件`:`tower event`),we=((t={},n={})=>(n.locale??e())===`zh-TW`?`在旁開啟`:`open beside`),B=e=>`Open image ${e?.n}`,V=e=>`打開圖片 ${e?.n}`,Te=((t,n={})=>(n.locale??e())===`zh-TW`?V(t):B(t)),H=e=>`show all (${e?.size})`,U=e=>`顯示全部(${e?.size})`,Ee=((t,n={})=>(n.locale??e())===`zh-TW`?U(t):H(t)),De=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示全部參數`:`show all arguments`),W=e=>`◇ thought · ${e?.count} chars`,Oe=e=>`◇ 思考 · ${e?.count} 字元`,ke=((t,n={})=>(n.locale??e())===`zh-TW`?Oe(t):W(t)),Ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`◇ 思考 · 已遮蔽`:`◇ thought · redacted`),je=((t={},n={})=>(n.locale??e())===`zh-TW`?`這座塔台正在待命。有訊息進來時,sb server 會喚醒它跑一個 run;你在這裡送出的第一則訊息就會啟動它。`:`This tower stands by. The sb server wakes it for a run when a message arrives; your first message here starts that run.`),Me=((t={},n={})=>(n.locale??e())===`zh-TW`?`無法取得`:`unavailable`),Ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`你`:`you`);function Pe(){let e=!0,t=0;return{get pinned(){return e},scrolled(n){e=n,n&&(t=0)},hold:()=>void(e=!1),arrived(n){return e||(t+=n),e},jump:()=>void(e=!0,t=0),button:n=>e&&!n?void 0:t&&!n?w({count:t}):x()}}async function Fe(e,t,n,r){let i=()=>e.items.some(e=>e.id===n);for(;!i()&&e.before;)r(e.prepend(await t.older(e.before)));return i()?!0:(r(e.reset(await t.latest())),!1)}function Ie(e=600){let t=[],n,r=!1,i=new Set,a=new Map,o=new Map,s=e=>e.forEach(e=>(i.delete(e.id),e.tools?.forEach(e=>(o.delete(e.id),a.delete(e.id)))));function c(e,t){let n=[];for(let r of e)i.has(r.id)||(i.add(r.id),r.kind===`result`&&r.callId?(a.set(r.callId,r),o.has(r.callId)&&t.add(o.get(r.callId))):(r.tools?.forEach(e=>o.set(e.id,r.id)),n.push(r)));return n}let l=e=>({rebuild:!1,added:[],touched:[],dropped:[],front:!1,...e});return{get items(){return t},get before(){return n},get detached(){return r},result:e=>a.get(e),reset(e){return[t,n,r]=[[],e.before,!1],i.clear(),a.clear(),o.clear(),t=c(e.items,new Set),l({rebuild:!0,added:t})},append(i){if(r)return l({});let a=new Set,o=c(i,a);t.push(...o);let u=t.length>e?t.splice(0,t.length-e):[];return s(u),u.length&&(n=t[0].id),l({added:o,touched:[...a],dropped:u.map(e=>e.id)})},prepend(i){let a=new Set,o=c(i.items,a);t.unshift(...o),n=i.before;let u=t.length>e?t.splice(e):[];return s(u),u.length&&(r=!0),l({added:o,touched:[...a],dropped:u.map(e=>e.id),front:!0})}}}var Le=e=>u(e.role),Re=e=>e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1}):``,ze=e=>e>=1024?`${(e/1024).toFixed(e>=10240?0:1)} KB`:`${e} B`,Be={intercom_message:me,subagent_result:xe,subagent_ping:I,subagent_status:L,"pi-loop-monitor":F,"memory-context":P,"doc-review":T,"straw-tower":z,"straw-link":R},G=e=>{let t=l(`<span class="ava"><svg><use/></svg></span>`);return t.querySelector(`use`).setAttribute(`href`,`#i-${f[e]??e}`),t};function Ve(e){let t=[],n=0;for(let r of e.matchAll(/https?:\/\/[^\s<>)\]]+/g))t.push(e.slice(n,r.index),s(`a`,{href:r[0],rel:`noopener noreferrer`,target:`_blank`},r[0])),n=r.index+r[0].length;return[...t,e.slice(n)]}function K(e,l,{who:u,link:f,docFor:p}){let m=Ie(),h=new Map,g=new Set,_=()=>g.forEach(e=>e.button.isConnected?(e.shown=!0,e.button.hidden=!e.paths.some(e=>p?.(e))):e.shown&&g.delete(e)),v=s(`div`,{class:`chat-list`}),y=s(`div`,{class:`chat-top`}),b=s(`div`,{class:`chat-live`}),x=s(`div`,{class:`chat-end`}),S=s(`button`,{class:`chat-pill`,type:`button`,hidden:``}),C=s(`p`,{class:`chat-empty`},de()),w=s(`div`,{class:`chat-scroll`,tabindex:`-1`,"aria-label":re()},y,v,b,x);e.replaceChildren(w,S);let T=Pe(),E=!1,D=!1,O,k,A=0,j=!1,M,N=()=>j||M!==void 0,P=()=>(clearTimeout(M),M=setTimeout(()=>(M=void 0,T.pinned&&!m.detached&&I()),250)),F=(e=T.button(m.detached))=>(S.hidden=!e,S.textContent=e??``),I=()=>(T.jump(),k=void 0,w.scrollTop=w.scrollHeight,F());async function xe(e){E=!0;let t=await Fe(m,l,e,e=>(q(e),X(e))).finally(()=>E=!1),n=h.get(e);if(O===e){if(!t||!n)return I();T.hold(),k=n,n.scrollIntoView({block:`center`}),ee(n,`lit`),clearTimeout(A),A=window.setTimeout(()=>(k=void 0,n.classList.remove(`lit`)),2e3),F()}}let L=()=>O?void xe(O):I(),R=(e,t,n,r)=>{e.disabled=!0,l.entry(n).then(n=>{let i=n&&r(n);if(i===void 0)return void(e.textContent=Me());t.textContent=i,e.remove()},()=>e.textContent=Me())};function z(e,t=0){if(!t||!l.pic)return null;let n=Array.from({length:t},(t,n)=>l.pic(e,n));return s(`div`,{class:`pics`},...n.map((e,t)=>{let r=s(`img`,{src:e,alt:se({n:t+1}),loading:`lazy`,decoding:`async`}),i=s(`button`,{type:`button`,class:`pic`,"aria-label":Te({n:t+1})},r);return r.addEventListener(`error`,()=>i.replaceWith(s(`em`,{class:`pic-gone`},ce()))),i.addEventListener(`click`,()=>void c(async()=>{let{lightbox:e}=await import(`./lightbox-B3w6hWOU.js`);return{lightbox:e}},__vite__mapDeps([0]),import.meta.url).then(({lightbox:e})=>e(n,t))),i}))}function B(e,t){let n=m.result(e.id),r=s(`pre`,{class:`out`},n?.text??``),i=s(`pre`,{class:`args`},e.args??``),a=e.cut?s(`button`,{class:`more`,type:`button`},De()):null;a?.addEventListener(`click`,()=>R(a,i,t,t=>(e=>e&&`${e.args??``}${e.cut?`\n${ae()}`:``}`)(t.tools?.find(t=>t.id===e.id))));let o=n?.more?s(`button`,{class:`more`,type:`button`},Ee({size:ze(n.bytes??0)})):null;o?.addEventListener(`click`,()=>R(o,r,n.id,e=>e.text));let c=e.name===`show_doc`&&p?s(`button`,{class:`more open`,type:`button`,hidden:``},we()):null;c?.addEventListener(`click`,t=>(t.preventDefault(),e.summary.split(`, `).forEach(e=>p?.(e)?.()))),c&&g.add({paths:e.summary.split(`, `),button:c}),c&&queueMicrotask(_);let l=s(`details`,{class:`act`},s(`summary`,{"data-mark":n?n.isError?`error`:`done`:`working`},s(`b`,{class:`badge`}),s(`code`,null,e.name),s(`span`,{class:`sum`},e.summary),c),i,a,n&&s(`div`,{class:`result`},n.images?s(`em`,null,le({count:n.images})):null,r,o)),u=n&&z(n.id,n.images);return u?[l,u]:[l]}let V=e=>s(`time`,null,Re(e.at)),H=(e,t,n,r)=>s(`article`,{class:`tx you`},s(`header`,null,V(e),s(`b`,null,Ne()),G(`user`)),s(`div`,{class:`bubble`,title:r},n?s(`small`,{class:`boss-flag`},te()):null,...Ve(t),z(e.id,e.images))),U=(e,t,n,r={})=>s(`article`,{class:`tx sys`},s(`details`,{class:`notice`},s(`summary`,null,G(`comms`),s(`em`,null,ue()),...t,V(e)),r.crashed?s(`small`,{class:`boss-flag`},te()):null,s(`pre`,null,n),r.raw?s(`details`,{class:`notice-raw`},s(`summary`,null,pe()),s(`pre`,{class:`raw`},r.raw)):null)),W=e=>{let t=i(e);return[me(),` `,t.name&&f(t.name)||t.name,t.id?` (${t.id})`:``,` · `,ye()]},Oe=e=>e.kind===`link`?[{ask:ge,reply:ve,answer:he,message:_e}[e.what]({from:e.from}),` · `,be()]:e.kind===`intercom`?W(e.from):[e.kind===`server`?Se():Ce()];function K(e){switch(e.kind){case`user`:{let t=u().service?n(e.text):void 0;if(t)return U(e,t.kind===`intercom`?W(t.from):[t.kind===`server`?Se():Ce()],e.text??``);let i=u().service?r(e.text):void 0;return H(e,i?i.body:e.text??``,i?.crashed,i?e.text??``:``)}case`assistant`:{let t=u(),n=s(`pre`,{class:`thought-text`}),r=e.thought?s(`button`,{class:`thought`,type:`button`},e.thought<0?Ae():ke({count:e.thought.toLocaleString()})):null;return e.thought&&e.thought>0&&r?.addEventListener(`click`,()=>R(r,n,e.id,e=>e.thoughtText)),s(`article`,{class:`tx in`},G(t.role),s(`div`,{class:`tx-body`},s(`header`,null,s(`b`,null,Le(t)),e.model?s(`span`,null,e.model):null,V(e),e.stop?s(`span`,{class:`stop`,"data-mark":`error`},e.stop):null),r,n,e.text?s(`div`,{class:`md`},o(a(e.text))):null,e.error?s(`p`,{class:`fault`},e.error):null,...(e.tools??[]).flatMap(t=>B(t,e.id))))}case`bash`:return s(`article`,{class:`tx sys`},s(`details`,{class:`act`},s(`summary`,{"data-mark":e.exit?`error`:`done`},s(`b`,{class:`badge`}),s(`code`,null,`shell`),s(`span`,{class:`sum`},`! ${e.command}`),e.exit?s(`span`,{class:`stop`,"data-mark":`error`},oe({code:e.exit})):null),e.text?s(`pre`,{class:`out`},e.text):null));case`notice`:{let n=t(e);return n?.kind===`boss`&&u().service?H(e,n.body,n.crashed,e.text??``):n&&n.kind!==`boss`?U(e,Oe(n),n.body,n.kind===`link`?{raw:n.raw}:{crashed:n.crashed}):U(e,[Be[e.type??``]?.()??e.type??fe(),` `,e.from&&f(e.from)||(e.from??``)],e.text??``)}case`divider`:return s(`article`,{class:`tx rule`},s(`details`,null,s(`summary`,null,e.type===`compaction`?ie({tokens:(e.tokens??0).toLocaleString()}):ne()),s(`pre`,null,e.text??``)));default:return s(`article`,{class:`tx note`},e.text??``,` `,V(e))}}function q(e){e.rebuild&&(h.clear(),v.replaceChildren());for(let t of e.dropped)h.get(t)?.remove(),h.delete(t);let t=e.added.map(e=>(h.set(e.id,K(e)),h.get(e.id)));e.front?v.prepend(...t):v.append(...t),D&&!e.front&&!e.rebuild&&t.forEach(e=>(e.classList.add(`fresh`),e.dataset.born=String(Date.now()))),C.remove();let n=u().service;C.textContent=n?.state===`standing`&&!n.run?je():de(),m.items.length||v.append(C),y.hidden=!m.before,He()}let J=[],Y=new Map;function He(){let e=new Set;for(let t of J){let n=Date.parse(t.startedAt),r=m.items.findIndex(e=>e.at!==void 0&&Date.parse(e.at)>=n);if(r===0&&m.before)continue;let i=r<0?``:m.items[r].id,a=JSON.stringify([i,d(t)]),o=Y.get(t.id);if(e.add(t.id),o&&o.sig===a&&o.el.isConnected)continue;o?.el.remove();let c=d(t),l=s(`article`,{class:`tx rule conv-rule`},s(`div`,null,s(`b`,null,c.title),c.ended?s(`small`,null,c.ended):null));Y.set(t.id,{el:l,sig:a});let u=i?h.get(i):void 0;u?u.before(l):v.append(l)}for(let[t,n]of Y)e.has(t)||(n.el.remove(),Y.delete(t))}let X=e=>e.touched.forEach(e=>{let t=h.get(e),n=m.items.find(t=>t.id===e);if(t&&n){let r=K(n);t.classList.contains(`fresh`)&&Date.now()-Number(t.dataset.born??0)<400&&r.classList.add(`fresh`),t.replaceWith(r),h.set(e,r)}}),Ue=async()=>{if(!E&&m.before&&D){E=!0;try{let e=w.scrollHeight,t=m.prepend(await l.older(m.before));q(t),X(t),w.scrollTop+=w.scrollHeight-e}finally{E=!1}m.before&&w.clientHeight&&y.getBoundingClientRect().bottom>=w.getBoundingClientRect().top&&Ue()}};S.addEventListener(`click`,()=>{O=void 0,m.detached?l.latest().then(e=>(q(m.reset(e)),I())):I()});let Z=[new IntersectionObserver(e=>e.some(e=>e.isIntersecting)&&void Ue(),{root:w}),new IntersectionObserver(e=>w.clientHeight&&(T.scrolled(e.at(-1).isIntersecting),F()),{root:w,rootMargin:`0px 0px 67px`})],Q,We=()=>(Q??(Z[0].observe(y),Z[1].observe(x)),clearTimeout(Q),Q=setTimeout(()=>(Q=void 0,Z.forEach(e=>e.disconnect())),600));w.addEventListener(`scroll`,()=>(We(),!j&&M!==void 0&&P()),{passive:!0}),w.addEventListener(`touchstart`,()=>(j=!0,clearTimeout(M),M=void 0),{passive:!0});for(let e of[`touchend`,`touchcancel`])w.addEventListener(e,()=>(j=!1,P()),{passive:!0});for(let e of[`wheel`,`touchstart`,`pointerdown`,`keydown`])w.addEventListener(e,()=>k=O=void 0,{passive:!0});let $=new ResizeObserver(()=>N()?void 0:T.pinned&&!m.detached?w.scrollTop=w.scrollHeight:k?.scrollIntoView({block:`center`}));return $.observe(v),$.observe(w),{log:w,docs:_,runs(e){JSON.stringify(e)!==JSON.stringify(J)&&(J=e,He())},apply(e){if(e.reset)q(m.reset({items:e.items??[],before:e.before})),D=!0,L();else if(e.items?.length){let t=m.append(e.items);q(t),X(t),T.arrived(t.added.length)&&!m.detached&&!N()?I():F()}},reveal(e){O=e,D&&L()},setLive(e,t){b.dataset.mark=t,b.lastChild?.textContent!==e&&b.replaceChildren(...e?[s(`b`,{class:`badge`}),s(`span`,null,e)]:[])}}}export{K as mountChat,se as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./open_main_title-Ccbha5pD.js";import{n,t as r}from"./unit_count-Cu9Tq-Ca.js";import{$ as i,C as a,S as o,_ as s,a as c,dt as l,f as u,g as d,h as f,o as p,s as m,u as h,v as g,w as _,y as v}from"./index-DJZ9byyE.js";var y=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉清單`:`Close the list`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`切換到其他單位`:`Switch to a unit`),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`回到主地圖`:`Back to the map`),S=((t={},n={})=>(n.locale??e())===`zh-TW`?`所有單位`:`All units`),C=((t={},n={})=>(n.locale??e())===`zh-TW`?`指揮中`:`commanding`),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`已結束`:`ended`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`錯誤`:`error`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`閒置`:`idle`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`無狀態`:`unknown`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`等待`:`waiting`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`工作中`:`working`),A=.4;function j(e,t,n){let[r,i]=[Math.abs(e),Math.abs(t)];return Math.max(r,i)<10?`wait`:r>=1.7*i&&(n?e<0:e>0)?`drag`:`pass`}var M=(e,t,n)=>Math.abs(n)>=.45?n>0:e>=t*A,N=(e,t)=>t||e.some(e=>e.editable||e.sink||e.scrollsX||[`input`,`textarea`,`select`].includes(e.tag));function P(e){let t=e,n=getComputedStyle(e).overflowX;return{tag:e.tagName.toLowerCase(),editable:t.isContentEditable,sink:e.matches(`.composer, .term-sink`),scrollsX:(n===`auto`||n===`scroll`)&&e.scrollWidth>e.clientWidth+1}}var F=e=>{let t=[];for(let n=e;n;n=n.parentElement)t.push(P(n));return t},I={working:k,waiting:O,idle:E,done:w,error:T,unknown:D,commanding:C},L=(e,t,n)=>(t?w:I[e])({},n&&{locale:n}),R=(e,t)=>t.flatMap(t=>[t,...t.subs.map(e=>({...e,sub:!0}))].map(t=>({id:t.key,key:t.key,ws:e,name:t.name,role:t.role,mark:t.mark,note:t.note,ended:!!t.ended,sub:`sub`in t,control:!!t.control})));function z(e){return e.bases.flatMap(e=>{let t=[{id:`tower`,rows:e.tower?R(e.id,[{...e.tower,role:`tower`}]):[]},...e.tabs.map(t=>({id:t.id,label:l({label:t.label}),rows:R(e.id,t.units)})),{id:`outside`,label:n(),rows:R(e.id,e.outside)}].filter(e=>e.rows.length);return t.length?[{id:e.id,label:e.label,mark:e.mark,groups:t}]:[]})}var B=e=>e.role===`main`&&e.mark===`idle`,V=e=>e.reduce((e,t)=>(t.sub?e.at(-1)?.subs.push(t):e.push({...t,subs:[]}),e),[]),H=()=>u(`<div class="unit"><div class="card"><a class="hit"></a>${c}<div class="meta"><span class="name"></span><span class="line"><em class="role"></em><b class="dstate"></b><span class="note"></span></span></div><button type="button" class="quit-btn" data-close="unit" hidden></button></div><div class="subs"></div></div>`),U=()=>u(`<div class="unit tower-row"><div class="trow"><a class="tower-go">${c}<span class="meta"><span class="name"></span><span class="line"><em class="role"></em><b class="dstate"></b></span></span></a><button type="button" class="pair-btn tower-add"></button></div><div class="subs"></div></div>`),W=()=>u(`<section class="dbase"><h3><a></a><small></small></h3><div class="dgroups"></div></section>`),G=()=>u(`<div class="dgroup"><h4></h4><div class="drows"></div></div>`),K=()=>matchMedia(`(max-width: 640px)`).matches;function q(e=()=>!1){let n=i(`div`,{class:`drawer-body`}),c=i(`button`,{type:`button`,class:`x`,"aria-label":y()},`×`),l=i(`a`,{class:`drawer-map`},x()),u=i(`button`,{type:`button`,class:`pair-btn`,"data-close":`dismiss-all`,hidden:``}),C=i(`div`,{class:`drawer-sweep`,hidden:``},u);p(l,{view:`map`});let w=i(`aside`,{class:`drawer`,"aria-label":b()},i(`header`,null,i(`b`,null,S()),c),n,i(`footer`,{class:`drawer-foot`},C,l)),T=i(`div`,{class:`drawer-veil`});document.body.append(T,w);let E,D,O=!1,k=0,A=0,P,I=()=>{_(u,E??{bases:[]}),C.hidden=u.hidden;let e=(t,n)=>{p(t.querySelector(`.hit`),{view:`session`,ws:n.ws,key:n.key}),t.querySelector(`.hit`).setAttribute(`aria-label`,`${n.name}: ${L(n.mark,n.ended)}`),t.classList.toggle(`current`,n.key===D),t.toggleAttribute(`data-dismiss`,n.role===`subagent`&&n.ended),t.dataset.key=n.key,f(t,n.mark),h(t.querySelector(`.plate`),n.role,n.mark),v(t,`.name`,n.name),v(t,`.role`,d(n.role)),v(t,`.dstate`,L(n.mark,n.ended)),s(t,`.note`,n.note,n.mark,n.note?void 0:``);let r=t.querySelector(`:scope > .card > .quit-btn`);B(n)?o(r,n):r.hidden=!0,g(t.querySelector(`.subs`),n.subs??[],H,e)},i=(n,r)=>{let i=n.querySelector(`.tower-go`),a=n.querySelector(`.tower-add`),o=E?.bases.find(e=>e.id===r.ws);p(i,{view:`session`,ws:r.ws,key:r.key}),i.setAttribute(`aria-label`,`${r.name}: ${L(r.mark,r.ended)}`),n.classList.toggle(`current`,r.key===D),n.dataset.key=r.key,f(n,r.mark),h(i.querySelector(`.plate`),`tower`,r.mark),v(i,`.name`,r.name),v(i,`.role`,d(`tower`)),v(i,`.dstate`,L(r.mark,r.ended)),a.hidden=!o,o&&(m(a,o),a.setAttribute(`aria-label`,t({base:o.label}))),g(n.querySelector(`.subs`),r.subs,H,e)};g(n,z(E??{bases:[]}),W,(t,n)=>{f(t,n.mark),v(t,`h3 a`,n.label),p(t.querySelector(`h3 a`),{view:`workspace`,ws:n.id}),v(t,`small`,r({count:n.groups.reduce((e,t)=>e+t.rows.length,0)})),g(t.querySelector(`.dgroups`),n.groups,G,(t,n)=>{v(t,`h4`,n.label??``),t.querySelector(`h4`).toggleAttribute(`hidden`,!n.label),n.id===`tower`?g(t.querySelector(`.drows`),V(n.rows),U,i):g(t.querySelector(`.drows`),V(n.rows),H,e)})})},R=e=>{k=Math.max(0,Math.min(A,e)),w.style.setProperty(`--dx`,`${k}px`),T.style.opacity=String(A?k/A:0),T.style.pointerEvents=k>0?`auto`:`none`},q=e=>{O=e,w.classList.toggle(`on`,e),w.inert=!e,document.documentElement.classList.remove(`drawer-drag`),R(e?A:0)},J=()=>{A=w.offsetWidth,I(),w.classList.add(`on`),document.documentElement.classList.add(`drawer-drag`)};w.inert=!0,document.addEventListener(`touchstart`,t=>{let n=t.target,r=w.contains(n)||n===T;if(P=void 0,!K()||e()||t.touches.length!==1||document.querySelector(`dialog.sheet[open], dialog.lightbox[open], [popover]:popover-open`)||(O?!r:N(F(n),!!getSelection()?.toString())))return;let i=t.touches[0],a=O?n.closest(`.unit[data-dismiss] > .card`)??void 0:void 0;P={x0:i.clientX,y0:i.clientY,mode:`wait`,was:O,base:k,last:i.clientX,at:performance.now(),v:0,card:a}},{passive:!0}),document.addEventListener(`touchmove`,e=>{if(!P||P.mode===`pass`)return;let t=e.touches[0],n=t.clientX-P.x0,r=t.clientY-P.y0;if(P.mode===`wait`){let e=j(n,r,P.was);if(e===`wait`)return;if(e===`pass`&&P.card&&j(n,r,!1)===`drag`)P.mode=`card`,P.card.classList.add(`swiping`);else if(e===`pass`)return void(P.mode=`pass`);else P.mode=`drag`,J()}e.preventDefault();let i=performance.now();if(P.v=(t.clientX-P.last)/Math.max(1,i-P.at),[P.last,P.at]=[t.clientX,i],P.mode!==`card`)return R(P.base+n);let a=Math.max(0,n);P.card.style.setProperty(`--sx`,`${a}px`),P.card.style.setProperty(`--so`,String(1-a/P.card.offsetWidth))},{passive:!1});let Y=(e,t)=>{e.classList.remove(`swiping`),e.style.removeProperty(`--sx`),e.style.removeProperty(`--so`),t&&(e.classList.add(`gone`),a({key:e.parentElement.dataset.key}).then(t=>t||e.classList.remove(`gone`)))},X=e=>{let t=P;P=void 0,t?.mode===`drag`&&q(M(k,A,t.v)),t?.mode===`card`&&Y(t.card,e.type===`touchend`&&M(Math.max(0,t.last-t.x0),t.card.offsetWidth,t.v))};return document.addEventListener(`touchend`,X),document.addEventListener(`touchcancel`,X),T.addEventListener(`click`,()=>q(!1)),w.addEventListener(`click`,e=>e.target.closest(`a[data-route], button[data-open], .x`)&&q(!1)),document.addEventListener(`keydown`,e=>O&&e.key===`Escape`&&(e.preventDefault(),q(!1)),!0),document.addEventListener(`sb-drawer`,()=>(O||J(),q(!O))),{net(e){E=e,O&&I()},route(e){D=e.view===`session`?e.key:void 0,l.toggleAttribute(`aria-current`,e.view===`map`),O&&I()}}}export{q as mountDrawer};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./zenchunk-Bt2ak7sc.css"])))=>i.map(i=>d[i]);
2
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{i as t,n,r,t as i}from"./runtime-ZX6HkxDa.js";var a=`sb.view`,o={geek:`#000000`,zen:`#14110e`},s=e=>e===`standard`||e===`geek`||e===`zen`?e:`auto`,c=(e,t=`auto`)=>t===`auto`?e?`geek`:`standard`:t,l=(e,t,n=`auto`)=>e===`auto`?c(t,n):e;function u(){return{root:document.documentElement,meta:document.querySelector(`meta[name="theme-color"]`),server:document.querySelector(`meta[name="sb-view"]`),media:matchMedia(`(prefers-contrast: more)`),storage:localStorage}}function d(e=u()){let t=[],n=[],r=e.meta?.content??``,i=()=>{try{return s(e.storage.getItem(a))}catch{return`auto`}},c=i(),d=s(e.server?.content),f;function p(n){let i=l(c,e.media.matches,d),a=i===`zen`&&e.root.dataset.zenAway!==void 0?`standard`:i;e.root.dataset.view=a,e.meta&&(e.meta.content=a===`standard`?r:o[a]);let s=n===`pick`||n===`follow`&&f!==void 0&&f!==i;if(f=i,s)for(let e of t)e(i,n)}return p(),e.media.addEventListener(`change`,()=>p(`follow`)),{choice:()=>c,view:()=>l(c,e.media.matches,d),server:()=>d,setServer(e){let t=s(typeof e==`string`?e:void 0);if(t!==d){d=t;for(let e of n)e(d);p(`follow`)}},set(t){c=t;try{e.storage.setItem(a,t)}catch{}p(`pick`)},refresh:()=>p(),reread(){c=i(),p(`pick`)},onChange:e=>void t.push(e),onServer:e=>void n.push(e)}}function f(e,t,n){let r=[...e.querySelectorAll(`button[data-choice]`)],i=r.find(e=>e.dataset.choice===`auto`),a=()=>{i&&n&&(i.textContent=n(t.server())),e.dataset&&e.toggleAttribute(`data-following`,t.server()!==`auto`)};a(),t.onServer(a);let o=()=>r.forEach(e=>e.setAttribute(`aria-pressed`,String(e.dataset.choice===t.choice())));for(let e of r)e.addEventListener(`click`,()=>(t.set(s(e.dataset.choice)),o()));addEventListener(`storage`,e=>e.key===`sb.view`&&(t.reread(),o())),o()}function p(e,t,n){let r=()=>e.hidden=t.view()!==`zen`||n.dataset.zenAway===void 0;return t.onChange(r),e.addEventListener(`click`,()=>(delete n.dataset.zenAway,t.reread(),r())),r(),r}function m(e,t,n){let r=t===`zen`;switch(e.on){case`pick`:return{away:!1,settings:n.settings,leaveSettings:r&&n.settings};case`follow`:return{away:r?n.settings?!0:n.away:!1,settings:n.settings,leaveSettings:!1};case`leave`:return{away:!0,settings:n.settings,leaveSettings:!1};case`back`:return{away:!1,settings:n.settings,leaveSettings:!1};case`route`:return{away:r?e.settings:n.away,settings:e.settings,leaveSettings:!1}}}function ee(e){let t=()=>({away:e.root.dataset.zenAway!==void 0,settings:e.settings()});function n(n){let r=t(),i=m(n,e.view.view(),r);i.away?e.root.dataset.zenAway=``:delete e.root.dataset.zenAway,e.view.refresh(),e.draw(),i.leaveSettings&&e.leaveSettings()}return e.view.onChange((e,t)=>n({on:t})),{leave:()=>n({on:`leave`}),back:()=>n({on:`back`}),route:e=>n({on:`route`,settings:e})}}var h=e=>`${e?.n}d`,te=e=>`${e?.n} 天`,ne=((e,t={})=>(t.locale??i())===`zh-TW`?te(e):h(e)),re=e=>`${e?.n}h`,ie=e=>`${e?.n} 小時`,ae=((e,t={})=>(t.locale??i())===`zh-TW`?ie(e):re(e)),oe=e=>`${e?.n}m`,se=e=>`${e?.n} 分`,ce=((e,t={})=>(t.locale??i())===`zh-TW`?se(e):oe(e)),le=e=>`${e?.n}s`,ue=e=>`${e?.n} 秒`,de=((e,t={})=>(t.locale??i())===`zh-TW`?ue(e):le(e)),fe=((e={},t={})=>(t.locale??i())===`zh-TW`?`警示`:`Alerts`),pe=((e={},t={})=>(t.locale??i())===`zh-TW`?`所有基地`:`all bases`),me=e=>`ally run · ${e?.device}`,he=e=>`隊友 run · ${e?.device}`,ge=((e,t={})=>(t.locale??i())===`zh-TW`?he(e):me(e)),_e=((e={},t={})=>(t.locale??i())===`zh-TW`?`唯讀查看這個隊友 run 的通訊`:`Read this ally run's comms (read only)`),ve=((e={},t={})=>(t.locale??i())===`zh-TW`?`還看不到它的通訊:尚未取得這個 run 的工作階段檔`:`Its comms are not shown yet: the run's session file is not known`);function ye(e,t,n,r){if(typeof t!=`string`||n!==void 0&&!r)return new e(t,n);let i=ye;if(n!==void 0){let r=i.prototypeKeys??=new Set([`constructor`,`__defineGetter__`,`__defineSetter__`,`hasOwnProperty`,`__lookupGetter__`,`__lookupSetter__`,`isPrototypeOf`,`propertyIsEnumerable`,`toString`,`valueOf`,`__proto__`,`toLocaleString`]);if(Object.getOwnPropertyNames(Object.prototype).some(e=>!r.has(e)))return new e(t,n)}let a=[];for(let r of Object.keys(n??{}).sort()){let i=n[r];if(i!==void 0){if(i!==null&&![`string`,`number`,`boolean`].includes(typeof i)||typeof i==`number`&&!Number.isFinite(i))return new e(t,n);a.push([r,i])}}let o=JSON.stringify([t,a]),s=i.caches??=new WeakMap,c=s.get(e);if(c||(c=new Map,s.set(e,c)),c.has(o))return c.get(o);let l=new e(t,n);if(c.size>=256){let e=c.keys().next().value;e!==void 0&&c.delete(e)}return c.set(o,l),l}function g(e,t,n,r=!1){return ye(Intl.PluralRules,e,n,r).select(Number(t)-Number(n?.offset??0))}var be=e=>{let t=g(`en`,e?.count,{},!0);return t===`one`?`${e?.count} ally run`:t===`other`?`${e?.count} ally runs`:`ally_runs`},xe=e=>`${e?.count} 個隊友 run`,Se=((e,t={})=>(t.locale??i())===`zh-TW`?xe(e):be(e)),Ce=e=>`${e?.team} · teammate`,we=e=>`${e?.team} · 隊友`,Te=((e,t={})=>(t.locale??i())===`zh-TW`?we(e):Ce(e)),Ee=((e={},t={})=>(t.locale??i())===`zh-TW`?`返回`:`Back`),De=((e={},t={})=>(t.locale??i())===`zh-TW`?``:`.`),Oe=((e={},t={})=>(t.locale??i())===`zh-TW`?`最後更新:`:`Last update`),ke=e=>`Disconnected. Gave up after ${e?.tries} tries; it reconnects when you return to this tab.`,Ae=e=>`連線中斷。重試 ${e?.tries} 次後放棄;回到此分頁時會重新連線。`,je=((e,t={})=>(t.locale??i())===`zh-TW`?Ae(e):ke(e)),Me=e=>`The server is up but cannot read the net: ${e?.problem}`,Ne=e=>`伺服器正常,但讀不到網:${e?.problem}`,Pe=((e,t={})=>(t.locale??i())===`zh-TW`?Ne(e):Me(e)),Fe=((e={},t={})=>(t.locale??i())===`zh-TW`?`與稻草網的連線中斷,正在重新連線…畫面顯示的是最後已知狀態。`:`Disconnected from the straw net. Reconnecting… The view shows the last known state.`),Ie=e=>`Disconnected from the straw net. Reconnecting (try ${e?.attempt})… The view shows the last known state.`,Le=e=>`與稻草網的連線中斷,正在重新連線(第 ${e?.attempt} 次)…畫面顯示的是最後已知狀態。`,Re=((e,t={})=>(t.locale??i())===`zh-TW`?Le(e):Ie(e)),ze=((e={},t={})=>(t.locale??i())===`zh-TW`?`這個網址在這裡無法使用(sb server 可能重新啟動過,或連結已過期):在這台電腦請開啟 /boss gui;在手機請重新掃描新的 QR code。`:`This address does not work here (the sb server may have restarted, or the link expired): on this computer open /boss gui; on a phone scan a new QR code.`),Be=((e={},t={})=>(t.locale??i())===`zh-TW`?`Straw Net:所有基地`:`Straw Net: all bases`),Ve=((e={},t={})=>(t.locale??i())===`zh-TW`?`取消`:`Cancel`),He=((e={},t={})=>(t.locale??i())===`zh-TW`?`關閉`:`Close`),Ue=e=>`Quit base ${e?.name}`,We=e=>`關掉基地 ${e?.name}`,Ge=((e,t={})=>(t.locale??i())===`zh-TW`?We(e):Ue(e)),Ke=e=>`Quit base ${e?.name}? Every agent in it and its tower quit. Nothing quits while anything running would be lost.`,qe=e=>`要關掉基地 ${e?.name} 嗎?裡面所有 agent 和塔台都會退出。有會遺失的東西時什麼都不關。`,Je=((e,t={})=>(t.locale??i())===`zh-TW`?qe(e):Ke(e)),Ye=e=>`Quit squad ${e?.name}`,Xe=e=>`關掉小隊 ${e?.name}`,Ze=((e,t={})=>(t.locale??i())===`zh-TW`?Xe(e):Ye(e)),Qe=e=>`Quit squad ${e?.name}? Every agent in it quits.`,$e=e=>`要關掉小隊 ${e?.name} 嗎?裡面所有 agent 都會退出。`,et=((e,t={})=>(t.locale??i())===`zh-TW`?$e(e):Qe(e)),tt=e=>`Quit the tower ${e?.name}? The base's mains become members again.`,nt=e=>`要關掉塔台 ${e?.name} 嗎?這個基地的主智慧體都會降格成成員。`,rt=((e,t={})=>(t.locale??i())===`zh-TW`?nt(e):tt(e)),it=e=>`Quit ${e?.name}`,at=e=>`關掉 ${e?.name}`,ot=((e,t={})=>(t.locale??i())===`zh-TW`?at(e):it(e)),st=e=>`Quit ${e?.name}? It quits pi and its pane closes.`,ct=e=>`要關掉 ${e?.name} 嗎?它會退出 pi,窗格也會關掉。`,lt=((e,t={})=>(t.locale??i())===`zh-TW`?ct(e):st(e)),ut=((e={},t={})=>(t.locale??i())===`zh-TW`?`連線中…`:`Connecting…`),dt=((e={},t={})=>(t.locale??i())===`zh-TW`?`重新連線中…`:`Reconnecting…`),ft=((e={},t={})=>(t.locale??i())===`zh-TW`?`重試`:`Try again`),pt=e=>`control tower · ${e?.state}`,mt=e=>`塔台 · ${e?.state}`,ht=((e,t={})=>(t.locale??i())===`zh-TW`?mt(e):pt(e)),gt=e=>`hard cap ${e?.time}`,_t=e=>`上限 ${e?.time}`,vt=((e,t={})=>(t.locale??i())===`zh-TW`?_t(e):gt(e)),yt=((e={},t={})=>(t.locale??i())===`zh-TW`?`收尾中`:`closing`),bt=e=>`Boss conversation · new session · ${e?.time}`,xt=e=>`老闆對話・新的工作階段・${e?.time}`,St=((e,t={})=>(t.locale??i())===`zh-TW`?xt(e):bt(e)),Ct=e=>`Boss conversation · resumed · ${e?.time}`,wt=e=>`老闆對話・接續・${e?.time}`,Tt=((e,t={})=>(t.locale??i())===`zh-TW`?wt(e):Ct(e)),Et=e=>`ended ${e?.time}`,Dt=e=>`${e?.time} 結束`,Ot=((e,t={})=>(t.locale??i())===`zh-TW`?Dt(e):Et(e)),kt=e=>`waiting for you; it ends at ${e?.time} if you stay quiet`,At=e=>`等你說話;你若不說話,${e?.time} 結束`,jt=((e,t={})=>(t.locale??i())===`zh-TW`?At(e):kt(e)),Mt=((e={},t={})=>(t.locale??i())===`zh-TW`?`新的工作階段`:`new session`),Nt=e=>`new session · ${e?.why}`,Pt=e=>`新的工作階段・${e?.why}`,Ft=((e,t={})=>(t.locale??i())===`zh-TW`?Pt(e):Nt(e)),It=e=>`resumed session · boss turns: ${e?.turns}`,Lt=e=>`接續舊工作階段・老闆輪數 ${e?.turns}`,Rt=((e,t={})=>(t.locale??i())===`zh-TW`?Lt(e):It(e)),zt=((e={},t={})=>(t.locale??i())===`zh-TW`?`老闆對話・收尾中`:`boss conversation · closing`),Bt=e=>`boss conversation · waiting for you · ends after ${e?.minutes} min idle`,Vt=e=>`老闆對話・等你說話・閒置 ${e?.minutes} 分鐘後結束`,Ht=((e,t={})=>(t.locale??i())===`zh-TW`?Vt(e):Bt(e)),Ut=e=>`boss conversation · ends after ${e?.minutes} min idle`,Wt=e=>`老闆對話・閒置 ${e?.minutes} 分鐘後結束`,Gt=((e,t={})=>(t.locale??i())===`zh-TW`?Wt(e):Ut(e)),Kt=e=>`working; it ends after ${e?.minutes} min idle`,qt=e=>`處理中;閒置 ${e?.minutes} 分鐘後結束`,Jt=((e,t={})=>(t.locale??i())===`zh-TW`?qt(e):Kt(e)),Yt=((e={},t={})=>(t.locale??i())===`zh-TW`?`圖示來自 game-icons.net(Lorc、Delapouite),CC BY 3.0。`:`Icons from game-icons.net by Lorc and Delapouite, CC BY 3.0.`),Xt=((e={},t={})=>(t.locale??i())===`zh-TW`?`移除`:`Dismiss`),Zt=e=>`Dismiss finished (${e?.count})`,Qt=e=>`移除已完成(${e?.count})`,$t=((e,t={})=>(t.locale??i())===`zh-TW`?Qt(e):Zt(e)),en=e=>`Dismiss ${e?.name}`,tn=e=>`從畫面移除 ${e?.name}`,nn=((e,t={})=>(t.locale??i())===`zh-TW`?tn(e):en(e)),rn=((e={},t={})=>(t.locale??i())===`zh-TW`?`文件`:`Documents`),an=((e={},t={})=>(t.locale??i())===`zh-TW`?`總塔台`:`head tower`),on=((e={},t={})=>(t.locale??i())===`zh-TW`?`語言`:`Language`),sn=e=>`${e?.label} (${e?.short}) asks you to confirm a ${e?.tool} call from its tower ${e?.tower}, which acts on a message you sent`,cn=e=>`${e?.label}(${e?.short})請你確認它的塔台 ${e?.tower} 的一次 ${e?.tool} 呼叫,該塔台正在處理你送出的訊息`,ln=((e,t={})=>(t.locale??i())===`zh-TW`?cn(e):sn(e)),un=e=>`${e?.label} (${e?.short}) asks you to confirm a ${e?.tool} call from its tower`,dn=e=>`${e?.label}(${e?.short})請你確認它塔台的一次 ${e?.tool} 呼叫`,fn=((e,t={})=>(t.locale??i())===`zh-TW`?dn(e):un(e)),pn=e=>`Team ${e?.team} stopped: ${e?.reason}`,mn=e=>`團隊 ${e?.team} 已停止:${e?.reason}`,hn=((e,t={})=>(t.locale??i())===`zh-TW`?mn(e):pn(e)),gn=e=>{let t=g(`en`,e?.count,{},!0);return t===`one`?`${e?.count} message has waited more than 10 minutes for an idle tower in team ${e?.team}`:t===`other`?`${e?.count} messages have waited more than 10 minutes for an idle tower in team ${e?.team}`:`link_a_held`},_n=e=>`團隊 ${e?.team} 有 ${e?.count} 則訊息已等了超過 10 分鐘,塔台一直不閒`,vn=((e,t={})=>(t.locale??i())===`zh-TW`?_n(e):gn(e)),yn=e=>{let t=g(`en`,e?.count,{},!0);return t===`one`?`${e?.count} message waits in the inbox of team ${e?.team}: no tower is open on its project`:t===`other`?`${e?.count} messages wait in the inbox of team ${e?.team}: no tower is open on its project`:`link_a_inbox`},bn=e=>`團隊 ${e?.team} 的收件匣有 ${e?.count} 則訊息在等:專案上沒有開著的塔台`,xn=((e,t={})=>(t.locale??i())===`zh-TW`?bn(e):yn(e)),Sn=e=>`${e?.label} (${e?.short}) asks to join team ${e?.team}`,Cn=e=>`${e?.label}(${e?.short})要求加入團隊 ${e?.team}`,wn=((e,t={})=>(t.locale??i())===`zh-TW`?Cn(e):Sn(e)),Tn=e=>`${e?.label} (${e?.short}), an unattended device, asks to join team ${e?.team}`,En=e=>`${e?.label}(${e?.short})是無人值守的裝置,要求加入團隊 ${e?.team}`,Dn=((e,t={})=>(t.locale??i())===`zh-TW`?En(e):Tn(e)),On=e=>`${e?.label} (${e?.short}) shows another roster than this computer in team ${e?.team}; the relay may be showing different rosters`,kn=e=>`團隊 ${e?.team} 中,${e?.label}(${e?.short})顯示的名冊和這台電腦不同;中繼站可能對不同人顯示不同名冊`,An=((e,t={})=>(t.locale??i())===`zh-TW`?kn(e):On(e)),jn=e=>{let t=g(`en`,e?.count,{},!0);return t===`one`?`${e?.count} Straw Link message has waited more than 10 minutes in the inbox of team ${e?.team} for an ally run. Look at the tower's card on the map: a held tower or a refused start keeps it waiting.`:t===`other`?`${e?.count} Straw Link messages have waited more than 10 minutes in the inbox of team ${e?.team} for an ally run. Look at the tower's card on the map: a held tower or a refused start keeps them waiting.`:`link_a_served`},Mn=e=>`團隊 ${e?.team} 的收件匣有 ${e?.count} 則 Straw Link 訊息等隊友 run 接手已超過 10 分鐘。請看地圖上塔台的卡片:塔台已暫停或 run 啟動被拒,都會讓它們一直等。`,Nn=((e,t={})=>(t.locale??i())===`zh-TW`?Mn(e):jn(e)),Pn=e=>`The relay of team ${e?.team} has been unreachable for ${e?.minutes} minutes`,Fn=e=>`團隊 ${e?.team} 的中繼站已經 ${e?.minutes} 分鐘連不上`,In=((e,t={})=>(t.locale??i())===`zh-TW`?Fn(e):Pn(e)),Ln=e=>`Link ${e?.count}`,Rn=e=>`連線 ${e?.count}`,zn=((e,t={})=>(t.locale??i())===`zh-TW`?Rn(e):Ln(e)),Bn=((e={},t={})=>(t.locale??i())===`zh-TW`?`Straw Link 通知`:`Straw Link notices`),Vn=((e={},t={})=>(t.locale??i())===`zh-TW`?`允許`:`Allow`),Hn=((e={},t={})=>(t.locale??i())===`zh-TW`?`連線中`:`connecting`),Un=((e={},t={})=>(t.locale??i())===`zh-TW`?`拒絕`:`Deny`),Wn=((e={},t={})=>(t.locale??i())===`zh-TW`?`即時`:`live`),Gn=((e={},t={})=>(t.locale??i())===`zh-TW`?`尚未見到`:`not seen yet`),Kn=((e={},t={})=>(t.locale??i())===`zh-TW`?`離線`:`offline`),qn=((e={},t={})=>(t.locale??i())===`zh-TW`?`在線`:`online`),Jn=((e={},t={})=>(t.locale??i())===`zh-TW`?`開啟團隊`:`Open Teams`),Yn=((e={},t={})=>(t.locale??i())===`zh-TW`?`重新連線中`:`reconnecting`),Xn=((e={},t={})=>(t.locale??i())===`zh-TW`?`查看`:`Review`),Zn=e=>`seen ${e?.ago} ago`,Qn=e=>`${e?.ago}前見到`,$n=((e,t={})=>(t.locale??i())===`zh-TW`?Qn(e):Zn(e)),er=((e={},t={})=>(t.locale??i())===`zh-TW`?`查看塔台`:`Show towers`),tr=((e={},t={})=>(t.locale??i())===`zh-TW`?`正體中文`:`English`),nr=((e={},t={})=>(t.locale??i())===`zh-TW`?`位置`:`Location`),rr=e=>`${e?.name} is commanding`,ir=e=>`${e?.name} 指揮中`,ar=((e,t={})=>(t.locale??i())===`zh-TW`?ir(e):rr(e)),or=e=>`${e?.name} finished`,sr=e=>`${e?.name} 已完成`,cr=((e,t={})=>(t.locale??i())===`zh-TW`?sr(e):or(e)),lr=e=>`${e?.name} hit an error`,ur=e=>`${e?.name} 發生錯誤`,dr=((e,t={})=>(t.locale??i())===`zh-TW`?ur(e):lr(e)),fr=e=>`${e?.name} went idle`,pr=e=>`${e?.name} 轉為閒置`,mr=((e,t={})=>(t.locale??i())===`zh-TW`?pr(e):fr(e)),hr=e=>`${e?.name} joined`,gr=e=>`${e?.name} 加入`,_r=((e,t={})=>(t.locale??i())===`zh-TW`?gr(e):hr(e)),vr=e=>`${e?.name} left`,yr=e=>`${e?.name} 離開`,br=((e,t={})=>(t.locale??i())===`zh-TW`?yr(e):vr(e)),xr=e=>`${e?.name} lost its status`,Sr=e=>`${e?.name} 失去狀態`,Cr=((e,t={})=>(t.locale??i())===`zh-TW`?Sr(e):xr(e)),wr=e=>`${e?.name} is waiting on a question`,Tr=e=>`${e?.name} 正在等待回答`,Er=((e,t={})=>(t.locale??i())===`zh-TW`?Tr(e):wr(e)),Dr=e=>`${e?.name} started working`,Or=e=>`${e?.name} 開始工作`,kr=((e,t={})=>(t.locale??i())===`zh-TW`?Or(e):Dr(e)),Ar=((e={},t={})=>(t.locale??i())===`zh-TW`?`指揮中`:`commanding`),jr=((e={},t={})=>(t.locale??i())===`zh-TW`?`已完成`:`finished`),Mr=((e={},t={})=>(t.locale??i())===`zh-TW`?`錯誤`:`error`),Nr=((e={},t={})=>(t.locale??i())===`zh-TW`?`閒置`:`idle`),Pr=((e={},t={})=>(t.locale??i())===`zh-TW`?`待命`:`standing by`),Fr=((e={},t={})=>(t.locale??i())===`zh-TW`?`無狀態`:`no status`),Ir=((e={},t={})=>(t.locale??i())===`zh-TW`?`等待回答`:`waiting on a question`),Lr=((e={},t={})=>(t.locale??i())===`zh-TW`?`工作中`:`working`),Rr=((e={},t={})=>(t.locale??i())===`zh-TW`?`你的原話`:`your words`),zr=((e={},t={})=>(t.locale??i())===`zh-TW`?`塔台提議,你確認`:`proposed by the tower, confirmed by you`),Br=((e={},t={})=>(t.locale??i())===`zh-TW`?`塔台自己的備註`:`the tower's note`),Vr=((e={},t={})=>(t.locale??i())===`zh-TW`?`確認`:`Confirm`),Hr=e=>`${e?.standing} standing · ${e?.decisions} decisions · ${e?.waits} waits`,Ur=e=>`${e?.standing} 常駐指示・${e?.decisions} 決定・${e?.waits} 等待`,Wr=((e,t={})=>(t.locale??i())===`zh-TW`?Ur(e):Hr(e)),Gr=e=>`${e?.standing} standing · ${e?.decisions} decisions · ${e?.waits} waits · ${e?.proposals} to confirm`,Kr=e=>`${e?.standing} 常駐指示・${e?.decisions} 決定・${e?.waits} 等待・${e?.proposals} 則待你確認`,qr=((e,t={})=>(t.locale??i())===`zh-TW`?Kr(e):Gr(e)),Jr=e=>`The tower proposes a decision: ${e?.text}`,Yr=e=>`塔台提議一項決定:${e?.text}`,Xr=((e,t={})=>(t.locale??i())===`zh-TW`?Yr(e):Jr(e)),Zr=e=>`The tower proposes a standing instruction: ${e?.text}`,Qr=e=>`塔台提議一則常駐指示:${e?.text}`,$r=((e,t={})=>(t.locale??i())===`zh-TW`?Qr(e):Zr(e)),ei=e=>`The tower proposes to retire ${e?.id}: ${e?.text}`,ti=e=>`塔台提議撤掉 ${e?.id}:${e?.text}`,ni=((e,t={})=>(t.locale??i())===`zh-TW`?ti(e):ei(e)),ri=((e={},t={})=>(t.locale??i())===`zh-TW`?`駁回`:`Reject`),ii=((e={},t={})=>(t.locale??i())===`zh-TW`?`你讀到記憶之後它又有變動,所以重新顯示了。請再試一次。`:`The memory changed since you read it, so it is shown again. Try once more.`),ai=e=>`waits for ${e?.who}`,oi=e=>`等 ${e?.who}`,si=((e,t={})=>(t.locale??i())===`zh-TW`?oi(e):ai(e)),ci=e=>`answered? a message came from ${e?.who}`,li=e=>`可能已回覆:${e?.who} 來了一則訊息`,ui=((e,t={})=>(t.locale??i())===`zh-TW`?li(e):ci(e)),di=((e={},t={})=>(t.locale??i())===`zh-TW`?`等你決定`:`waits for you`),fi=((e={},t={})=>(t.locale??i())===`zh-TW`?`已過 7 天而失效`:`expired after 7 days`),pi=e=>`resolved: ${e?.outcome}`,mi=e=>`已處理:${e?.outcome}`,hi=((e,t={})=>(t.locale??i())===`zh-TW`?mi(e):pi(e)),gi=((e={},t={})=>(t.locale??i())===`zh-TW`?`更多`:`More`),_i=e=>`More actions for ${e?.name}`,vi=e=>`「${e?.name}」的更多動作`,yi=((e,t={})=>(t.locale??i())===`zh-TW`?vi(e):_i(e)),bi=((e={},t={})=>(t.locale??i())===`zh-TW`?`地圖總覽`:`Overview of the map`),xi=e=>`Monitor failed: ${e?.what}`,Si=e=>`Monitor 出錯:${e?.what}`,Ci=((e,t={})=>(t.locale??i())===`zh-TW`?Si(e):xi(e)),wi=e=>`Monitor went quiet and stopped: ${e?.what}`,Ti=e=>`Monitor 太久沒輸出,已停止:${e?.what}`,Ei=((e,t={})=>(t.locale??i())===`zh-TW`?Ti(e):wi(e)),Di=((e={},t={})=>(t.locale??i())===`zh-TW`?`從未`:`never`),Oi=((e={},t={})=>(t.locale??i())===`zh-TW`?`+新基地`:`+ New base`),ki=((e={},t={})=>(t.locale??i())===`zh-TW`?`沒有執行中的智慧體`:`no agent running`),Ai=((e={},t={})=>(t.locale??i())===`zh-TW`?`無警示`:`no alerts`),_=((e={},t={})=>(t.locale??i())===`zh-TW`?`伺服器沒有回應。`:`The server did not answer.`),ji=((e={},t={})=>(t.locale??i())===`zh-TW`?`尚無塔台`:`no tower yet`),Mi=((e={},t={})=>(t.locale??i())===`zh-TW`?`監看中`:`Watching a monitor`),Ni=((e={},t={})=>(t.locale??i())===`zh-TW`?`思考中`:`thinking`),Pi=e=>`Finished ${e?.note}`,Fi=e=>`完成了 ${e?.note}`,Ii=((e,t={})=>(t.locale??i())===`zh-TW`?Fi(e):Pi(e)),Li=e=>`Failed ${e?.note}`,Ri=e=>`出錯了 ${e?.note}`,zi=((e,t={})=>(t.locale??i())===`zh-TW`?Ri(e):Li(e)),Bi=e=>`Waiting on you ${e?.note}`,Vi=e=>`等你回答 ${e?.note}`,Hi=((e,t={})=>(t.locale??i())===`zh-TW`?Vi(e):Bi(e)),Ui=((e={},t={})=>(t.locale??i())===`zh-TW`?`+主智慧體`:`+ Main`),Wi=((e={},t={})=>(t.locale??i())===`zh-TW`?`+成員`:`+ Member`),Gi=((e={},t={})=>(t.locale??i())===`zh-TW`?`前哨`:`Outposts`),Ki=((e={},t={})=>(t.locale??i())===`zh-TW`?`Herdr 開了新窗格,請到 Herdr 裡接著做。`:`A pane opened in Herdr; carry on there.`),qi=((e={},t={})=>(t.locale??i())===`zh-TW`?`Herdr 窗格`:`Herdr pane`),Ji=((e={},t={})=>(t.locale??i())===`zh-TW`?`接回`:`Pop`),Yi=e=>`Pop ${e?.name}`,Xi=e=>`接回 ${e?.name}`,Zi=((e,t={})=>(t.locale??i())===`zh-TW`?Xi(e):Yi(e)),Qi=((e={},t={})=>(t.locale??i())===`zh-TW`?`伺服器送來的快照,頁面無法讀取`:`the server sent a snapshot the page cannot read`),$i=((e={},t={})=>(t.locale??i())===`zh-TW`?`伺服器回報了頁面無法讀取的問題`:`the server reported a problem the page cannot read`),v=((e={},t={})=>(t.locale??i())===`zh-TW`?`關掉`:`Quit`),ea=((e={},t={})=>(t.locale??i())===`zh-TW`?`關掉塔台`:`Quit tower`),ta=e=>`Refused (${e?.status}).`,na=e=>`已拒絕(${e?.status})。`,y=((e,t={})=>(t.locale??i())===`zh-TW`?na(e):ta(e)),ra=((e={},t={})=>(t.locale??i())===`zh-TW`?`提醒`:`Remind`),ia=((e={},t={})=>(t.locale??i())===`zh-TW`?`點一下允許瀏覽器通知`:`Press to allow browser notifications`),aa=((e={},t={})=>(t.locale??i())===`zh-TW`?`瀏覽器已封鎖通知,要到網站設定裡允許`:`The browser blocks notifications; allow them in the site settings`),oa=((e={},t={})=>(t.locale??i())===`zh-TW`?`提醒已關`:`Reminders off`),sa=((e={},t={})=>(t.locale??i())===`zh-TW`?`提醒已開:分頁不在前景時,單位等你回答、完成或出錯會跳系統通知`:`Reminders on: while the page is in the background, a unit waiting on you, finishing, or failing raises a system notification`),ca=((e={},t={})=>(t.locale??i())===`zh-TW`?`這個瀏覽器不支援通知`:`This browser has no notifications`),la=((e={},t={})=>(t.locale??i())===`zh-TW`?`隊友 run`:`ally run`),ua=((e={},t={})=>(t.locale??i())===`zh-TW`?`主智慧體`:`main`),da=((e={},t={})=>(t.locale??i())===`zh-TW`?`成員`:`member`),fa=((e={},t={})=>(t.locale??i())===`zh-TW`?`前哨`:`outpost`),pa=((e={},t={})=>(t.locale??i())===`zh-TW`?`未編入`:`unaligned`),ma=((e={},t={})=>(t.locale??i())===`zh-TW`?`事件 run`:`event run`),ha=((e={},t={})=>(t.locale??i(),`session`)),ga=((e={},t={})=>(t.locale??i())===`zh-TW`?`子智慧體`:`subagent`),_a=((e={},t={})=>(t.locale??i())===`zh-TW`?`塔台`:`tower`),va=((e={},t={})=>(t.locale??i())===`zh-TW`?`這台裝置`:`This device`),ya=((e={},t={})=>(t.locale??i())===`zh-TW`?`這些選擇只留在這台裝置的這個瀏覽器。`:`These choices stay on this device, in this browser.`),ba=((e={},t={})=>(t.locale??i())===`zh-TW`?`手機與裝置`:`Phone & devices`),xa=((e={},t={})=>(t.locale??i())===`zh-TW`?`伺服器`:`Server`),Sa=((e={},t={})=>(t.locale??i())===`zh-TW`?`團隊`:`Teams`),Ca=((e={},t={})=>(t.locale??i())===`zh-TW`?`設定`:`Settings`),wa=((e={},t={})=>(t.locale??i())===`zh-TW`?`音效`:`Sound`),Ta=((e={},t={})=>(t.locale??i())===`zh-TW`?`音效:開關、音量與試聽`:`Sounds: on or off, volume, and a try`),Ea=((e={},t={})=>(t.locale??i())===`zh-TW`?`▶ 試聽`:`▶ Try`),Da=((e={},t={})=>(t.locale??i())===`zh-TW`?`音量`:`Volume`),Oa=((e={},t={})=>(t.locale??i())===`zh-TW`?`收起`:`Stash`),ka=e=>`Stash base ${e?.name}`,Aa=e=>`收起基地 ${e?.name}`,ja=((e,t={})=>(t.locale??i())===`zh-TW`?Aa(e):ka(e)),Ma=e=>`Stash base ${e?.name}? Its tower, mains, and members quit and come back with Pop. Nothing is stashed while anything running would be lost.`,Na=e=>`要收起基地 ${e?.name} 嗎?塔台、主智慧體和成員會結束,之後可以用「接回」叫回來。有會遺失的東西時不會收。`,Pa=((e,t={})=>(t.locale??i())===`zh-TW`?Na(e):Ma(e)),Fa=e=>`Stashed (${e?.count})`,Ia=e=>`已收起(${e?.count})`,La=((e,t={})=>(t.locale??i())===`zh-TW`?Ia(e):Fa(e)),Ra=((e={},t={})=>(t.locale??i())===`zh-TW`?`智慧體`:`Agents`),za=((e={},t={})=>(t.locale??i())===`zh-TW`?`基地`:`Bases`),Ba=((e={},t={})=>(t.locale??i())===`zh-TW`?`指揮中`:`Commanding`),Va=((e={},t={})=>(t.locale??i())===`zh-TW`?`等待中`:`Waiting`),Ha=((e={},t={})=>(t.locale??i())===`zh-TW`?`工作中`:`Working`),Ua=((e={},t={})=>(t.locale??i())===`zh-TW`?`待允許`:`Allow?`),Wa=((e={},t={})=>(t.locale??i())===`zh-TW`?`被擋`:`Blocked`),Ga=((e={},t={})=>(t.locale??i())===`zh-TW`?`關`:`Off`),Ka=((e={},t={})=>(t.locale??i())===`zh-TW`?`開`:`On`),qa=((e={},t={})=>(t.locale??i())===`zh-TW`?`狀態`:`States`),Ja=e=>`tab ${e?.label}`,Ya=e=>`分頁 ${e?.label}`,Xa=((e,t={})=>(t.locale??i())===`zh-TW`?Ya(e):Ja(e)),Za=((e={},t={})=>(t.locale??i())===`zh-TW`?`即時網況 · 通訊`:`live net · comms`),Qa=((e={},t={})=>(t.locale??i())===`zh-TW`?`網路活動`:`Net activity`),$a=((e={},t={})=>(t.locale??i())===`zh-TW`?`伺服器啟動後還沒有動靜`:`Nothing has happened since the server started`),eo=((e={},t={})=>(t.locale??i())===`zh-TW`?`現在`:`now`),to=e=>`${e?.count} events in 30 min`,no=e=>`近 30 分鐘 ${e?.count} 筆`,ro=((e,t={})=>(t.locale??i())===`zh-TW`?no(e):to(e)),io=((e={},t={})=>(t.locale??i())===`zh-TW`?`網的總計`:`Net totals`),ao=e=>`The tower refused it: ${e?.reason}`,oo=e=>`塔台拒絕了:${e?.reason}`,so=((e,t={})=>(t.locale??i())===`zh-TW`?oo(e):ao(e)),co=((e={},t={})=>(t.locale??i())===`zh-TW`?`回覆`:`Answer`),lo=((e={},t={})=>(t.locale??i())===`zh-TW`?`重新送達`:`Deliver again`),uo=((e={},t={})=>(t.locale??i())===`zh-TW`?`捨棄`:`Drop`),fo=((e={},t={})=>(t.locale??i())===`zh-TW`?`沒有這則已擱置的事件。`:`No such parked event.`),po=((e={},t={})=>(t.locale??i())===`zh-TW`?`sb server 沒有替這個工作區執行塔台。`:`The sb server runs no tower for this workspace.`),mo=e=>{let t=g(`en`,e?.count,{},!0);return t===`one`?`${e?.count} failed run lately`:t===`other`?`${e?.count} failed runs lately`:`tower_failures`},ho=e=>`近來有 ${e?.count} 次 run 失敗`,go=((e,t={})=>(t.locale??i())===`zh-TW`?ho(e):mo(e)),_o=((e={},t={})=>(t.locale??i())===`zh-TW`?`上一次 run 當機`:`last run crashed`),vo=((e={},t={})=>(t.locale??i())===`zh-TW`?`上一次 run 已結束`:`last run quit`),yo=((e={},t={})=>(t.locale??i())===`zh-TW`?`上一次 run 逾時`:`last run timed out`),bo=e=>`An event was parked after two runs crashed with it: ${e?.what}`,xo=e=>`有一則事件在兩個 run 都當機後被擱置:${e?.what}`,So=((e,t={})=>(t.locale??i())===`zh-TW`?xo(e):bo(e)),Co=((e={},t={})=>(t.locale??i())===`zh-TW`?`run 一再當機或逾時,所以塔台不再自動喚醒。佇列仍保留;按重試,或由老闆送一則訊息,就會再喚醒它。`:`Runs crashed or timed out again and again, so the tower stops waking. The queue is kept; Retry, or a message from the boss, wakes it again.`),wo=((e={},t={})=>(t.locale??i())===`zh-TW`?`常駐窗格不在它自己的 shell:裡面有巢狀 shell 或程式在跑。請先離開它,再按重試`:`The standing pane is not at its own shell: a nested shell or a program runs there. Leave it, then press Retry`),To=e=>`The tower types nothing in the standing pane: ${e?.reason}`,Eo=e=>`塔台不在常駐窗格輸入任何東西:${e?.reason}`,Do=((e,t={})=>(t.locale??i())===`zh-TW`?Eo(e):To(e)),Oo=((e={},t={})=>(t.locale??i())===`zh-TW`?`重試`:`Retry`),ko=e=>`A run could not start: ${e?.reason}`,Ao=e=>`run 無法啟動:${e?.reason}`,jo=((e,t={})=>(t.locale??i())===`zh-TW`?Ao(e):ko(e)),Mo=((e={},t={})=>(t.locale??i())===`zh-TW`?`塔台無法檢查常駐窗格裡有沒有你的程式,所以不在那裡輸入任何東西;窗格空出來後請按重試`:`The tower could not check the standing pane for a program of yours, so it types nothing there; press Retry when it is free`),No=e=>`Parked: ${e?.kind} from ${e?.from}: ${e?.first}`,Po=e=>`已擱置:${e?.kind},來自 ${e?.from}:${e?.first}`,Fo=((e,t={})=>(t.locale??i())===`zh-TW`?Po(e):No(e)),Io=e=>`Parked: ${e?.kind}: ${e?.first}`,Lo=e=>`已擱置:${e?.kind}:${e?.first}`,Ro=((e,t={})=>(t.locale??i())===`zh-TW`?Lo(e):Io(e)),zo=e=>{let t=g(`en`,e?.count,{},!0);return t===`one`?`${e?.count} message queued`:t===`other`?`${e?.count} messages queued`:`tower_queued`},Bo=e=>`${e?.count} 則排隊中`,Vo=((e,t={})=>(t.locale??i())===`zh-TW`?Bo(e):zo(e)),Ho=e=>`ally run · ${e?.device}`,Uo=e=>`隊友 run · ${e?.device}`,Wo=((e,t={})=>(t.locale??i())===`zh-TW`?Uo(e):Ho(e)),Go=((e={},t={})=>(t.locale??i())===`zh-TW`?`收工中`:`closing`),Ko=((e={},t={})=>(t.locale??i())===`zh-TW`?`已暫停`:`held`),qo=((e={},t={})=>(t.locale??i())===`zh-TW`?`喚醒中`:`waking`),Jo=e=>`Waits for you: ${e?.text}`,Yo=e=>`等你決定:${e?.text}`,Xo=((e,t={})=>(t.locale??i())===`zh-TW`?Yo(e):Jo(e)),Zo=((e={},t={})=>(t.locale??i())===`zh-TW`?`處理中…`:`Working…`),Qo=((e={},t={})=>(t.locale??i())===`zh-TW`?`有智慧體等你同意,才能載入資料夾的設定`:`An agent needs your OK to load a folder's settings`),$o=((e={},t={})=>(t.locale??i())===`zh-TW`?`連不上伺服器。`:`The server could not be reached.`),es=e=>`using ${e?.tool}`,ts=e=>`使用 ${e?.tool}`,ns=((e,t={})=>(t.locale??i())===`zh-TW`?ts(e):es(e)),rs=((e={},t={})=>(t.locale??i())===`zh-TW`?`自動`:`Auto`),is=e=>`Follow server (${e?.view})`,as=e=>`跟隨伺服器(${e?.view})`,os=((e,t={})=>(t.locale??i())===`zh-TW`?as(e):is(e)),ss=((e={},t={})=>(t.locale??i())===`zh-TW`?`極客`:`Geek`),cs=((e={},t={})=>(t.locale??i())===`zh-TW`?`檢視`:`View`),ls=((e={},t={})=>(t.locale??i())===`zh-TW`?`標準`:`Standard`),us=((e={},t={})=>(t.locale??i())===`zh-TW`?`自動:跟隨伺服器設定的檢視(/boss gui view);伺服器沒設定時,系統要求較高對比就用極客檢視。標準、極客與禪依你在這台裝置的選擇`:`Auto follows the view the server sets (/boss gui view); with none set, it is Geek when your system asks for more contrast. Standard, Geek, and Zen stay as you choose on this device`),ds=((e={},t={})=>(t.locale??i())===`zh-TW`?`禪`:`Zen`),fs=((e={},t={})=>(t.locale??i())===`zh-TW`?`禪`:`Zen`),ps=((e={},t={})=>(t.locale??i())===`zh-TW`?`回到禪`:`Back to Zen`),ms=`sb-locale`;function hs(e){let n=/^zh\b/i.test(e)&&(/-(hant|tw|hk|mo)\b/i.test(e)?`zh-TW`:/-(hans|cn|sg|my)\b/i.test(e)?`zh-CN`:void 0);return t(e)??(n?t(n):void 0)??t(e.split(`-`)[0])}function gs(e,n){return t(e)??n.map(hs).find(Boolean)??`en`}var _s={brand_label:Be,menu_more:gi,tagline:Za,totals_label:io,stat_bases:za,stat_agents:Ra,stat_working:Ha,stat_waiting:Va,stat_commanding:Ba,mark_commanding:Ar,alerts:fe,no_alerts:Ai,link_connecting:Hn,connect_connecting:ut,connect_retry:ft,location:nr,all_bases:pe,documents:rn,timeline:Qa,states:qa,mark_working:Lr,mark_waiting:Ir,mark_idle:Nr,mark_done:jr,mark_error:Mr,credit:Yt,language:on,view_label:cs,view_auto:rs,view_standard:ls,view_geek:ss,view_zen:ds,zen_back:fs,zen_back_title:ps,view_title:us,settings:Ca,new_base:Oi,back:Ee,remind:ra,sound:wa,sound_volume:Da,sound_try:Ea,sound_title:Ta,set_device:va,set_device_note:ya,set_phone:ba,set_teams:Sa,set_server:xa};Object.keys(_s);function vs(e,t=localStorage,n=()=>location.reload()){try{t.setItem(ms,e)}catch{return!1}return n(),!0}var ys=()=>n.map(e=>({id:e,name:tr({},{locale:e})}));function bs(){let e=null;try{e=localStorage.getItem(ms)}catch{}let t=gs(e,navigator.languages??[navigator.language]);r(()=>t),document.documentElement.lang=t;let i={m:(e,t)=>e.textContent=t,mLabel:(e,t)=>e.setAttribute(`aria-label`,t),mTitle:(e,t)=>e.title=t,mEmpty:(e,t)=>e.dataset.empty=t};for(let e of document.querySelectorAll(`[data-m], [data-m-label], [data-m-title], [data-m-empty]`))for(let[t,n]of Object.entries(i))e.dataset[t]&&n(e,_s[e.dataset[t]]?.()??e.dataset[t]);let a=document.getElementById(`lang`);a.replaceChildren(...n.map(e=>new Option(tr({},{locale:e}),e,!1,e===t))),a.onchange=()=>vs(a.value)||(a.value=t)}var xs=e=>e===`auto`?rs():os({view:e===`geek`?ss():e===`zen`?ds():ls()}),Ss=new Set,Cs=e=>e.unit??e.key,ws=e=>e.mark===`waiting`||e.pending?0:1;function Ts(e,t){let n=new Map;for(let r of e.bases)for(let e of[...r.tower?[{...r.tower,role:`tower`},...r.tower.subs]:[],...[...r.tabs.flatMap(e=>e.units),...r.outside].flatMap(e=>[e,...e.subs])]){n.set(e.key,{key:e.key,ws:r.id,name:e.name,role:e.role,mark:e.mark,note:e.note,at:t,since:e.since,pending:e.pending,closed:!e.control||!!e.ended});for(let i of e.monitors??[])(i.status===`error`||i.status===`stale`)&&(a=>n.set(a,{key:a,unit:e.key,ws:r.id,name:e.name,role:e.role,mark:`error`,note:`monitor:${i.status}:${i.what}`,at:t}))(`${e.key}\u001fmonitor:${i.id}:${i.at}`)}for(let r of e.trust??[])r.opening&&Ss.has(r.opening)||(e=>n.set(e,{key:e,ws:``,name:r.folder.split(/[\\/]/).filter(Boolean).at(-1)??r.folder,role:r.agents[0]?.role??`none`,mark:`waiting`,at:t,since:r.agents.length?Math.min(...r.agents.map(e=>e.at)):void 0,trust:r}))(`trust\u001f${r.folder}\u001f${r.digest}`);return n}function Es(e,t){return[...t.values()].filter(t=>{let n=e?.get(t.key);return ws(t)===0?!n||ws(n)!==0||n.mark!==t.mark:e!==void 0&&n?.mark!==t.mark&&(t.mark===`error`||t.mark===`done`)})}var Ds=e=>e.state===`live`?void 0:e.state,Os={connecting:ut,reconnecting:dt,offline:e=>je({tries:e.attempt-1}),replaced:ze},ks=[`click`,`dblclick`,`auxclick`,`contextmenu`,`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`keydown`,`keyup`,`keypress`,`submit`,`dragstart`],As=new Set([`click`,`dblclick`,`auxclick`,`contextmenu`,`submit`]),b=e=>document.getElementById(e),js=()=>({win:window,dialog:b(`connect`),text:b(`connect-text`),retry:b(`connect-retry`),reload:b(`connect-reload`),guarded:[document.querySelector(`.shell`),b(`dock`),b(`zen`)]});function Ms(e,t=js()){let{win:n,dialog:r,text:i,guarded:a}=t,o,s=!1,c=!1,l=()=>{c=!0,r.close(),c=!1},u=()=>{s||=(r.open&&l(),r.showModal(),!0);for(let e of a)e.inert=!0},d=()=>{for(let e of a)e.inert=!1;r.open&&l(),s=!1};r.addEventListener(`cancel`,e=>e.preventDefault()),r.addEventListener(`close`,()=>{c||r.open||(s=!1,o&&u())});for(let e of ks)n.addEventListener(e,t=>{!o||r.contains(t.target)||t.target?.closest?.(`dialog:modal`)||(t.stopPropagation(),As.has(e)&&t.preventDefault())},!0),r.addEventListener(e,e=>e.stopPropagation());return t.reload?.remove(),t.retry.addEventListener(`click`,e),e=>{if(o=Ds(e),!o)return d();r.dataset.state=o,i.textContent=Os[o](e),t.retry.hidden=o!==`offline`,u()}}var Ns=`input, textarea, select, [role=textbox], [role=combobox], [role=listbox], .term-scroll`,Ps=`button, a, summary, [role=button], [role=link]`,Fs=`.ask-opt, [role=radio], [role=checkbox]`,Is=`dialog.sheet[open], dialog.lightbox[open], [popover]:popover-open`;function Ls(e,t,n=!1){if(t||e.defaultPrevented||e.isComposing||e.ctrlKey||e.altKey||e.metaKey)return;let r=e.target;if(!(r?.isContentEditable||r?.closest?.(Ns))){if(e.key===`f`||e.key===`F`)return`zoom`;if(e.key===` `&&!r?.closest?.(Fs)&&(n||!r?.closest?.(Ps)))return`next`}}function Rs(e,t=()=>document.querySelector(Is)!==null,n=window){let r,i=!1,a=null;n.addEventListener(`pointerdown`,()=>i=!0,!0),n.addEventListener(`focusin`,e=>a=i?e.target:null,!0),n.addEventListener(`keydown`,n=>{let o=n.target===a;i=!1;let s=Ls(n,t(),o);if(s){if(n.repeat)return r===s?n.preventDefault():void 0;e(s)&&(r=s,n.preventDefault())}}),n.addEventListener(`keyup`,e=>{r===`next`&&e.key===` `&&e.preventDefault(),r=void 0})}var zs=(...e)=>e.filter(e=>e!==!1&&e!=null),Bs=(e,t)=>(e.classList.add(t),e.classList.toggle(`flip`));function x(e,t,...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t??{}))r.setAttribute(e,n);return r.append(...zs(...n)),r}var S=e=>String(e??``);function Vs(e){let t=e.data,n=e.teamName;switch(e.kind){case`join-request`:return t.unattended?Dn({label:S(t.label),short:S(t.short),team:n}):wn({label:S(t.label),short:S(t.short),team:n});case`confirm`:return t.tower?ln({label:S(t.label),short:S(t.short),tool:S(t.tool),tower:S(t.tower)}):fn({label:S(t.label),short:S(t.short),tool:S(t.tool)});case`fork`:return hn({team:n,reason:S(t.reason)});case`mismatch`:return An({label:S(t.label),short:S(t.short),team:n});case`unreachable`:return In({team:n,minutes:S(t.minutes)});case`inbox`:return xn({count:Number(t.count)||0,team:n});case`held`:return vn({count:Number(t.count)||0,team:n});case`served`:return Nn({count:Number(t.count)||0,team:n})}}var Hs=e=>{let t={error:0,warning:1,info:2};return[...e].sort((e,n)=>t[e.level]-t[n.level])};function Us(e){let t=Math.max(0,Math.ceil(e/1e3)),n=e=>String(e).padStart(2,`0`);return t>=3600?`${Math.floor(t/3600)}:${n(Math.floor(t/60)%60)}:${n(t%60)}`:`${Math.floor(t/60)}:${n(t%60)}`}function Ws(e,t){if(e===null)return Gn();if(t)return qn();let n=Math.floor(e/1e3);return $n({ago:n<3600?ce({n:String(Math.max(1,Math.floor(n/60)))}):n<86400?ae({n:String(Math.floor(n/3600))}):ne({n:String(Math.floor(n/86400))})})}function Gs(e){return e.online?e.tower===`blocked`?`waiting`:e.tower===`working`?`working`:e.tower===`unknown`?`unknown`:`idle`:`unknown`}function Ks(e){switch(e){case`working`:return Lr();case`blocked`:return Ir();case`idle`:return Nr();case`done`:return jr();case`unknown`:return Fr();default:return e}}var qs=e({get:()=>Zs,post:()=>Xs,sendFile:()=>Ys}),Js=()=>document.querySelector(`meta[name="sb-csrf"]`)?.content??``,Ys=(e,t)=>fetch(`api/${e}`,{method:`POST`,cache:`no-store`,headers:{"content-type":`application/octet-stream`,"x-sb-name":encodeURIComponent(t.name||`pasted`),"x-sb-csrf":Js()},body:t}).then(async e=>({ok:e.ok,status:e.status,body:await e.json().catch(()=>({}))})),Xs=(e,t)=>fetch(`api/${e}`,{method:`POST`,cache:`no-store`,headers:{"content-type":`application/json`,"x-sb-csrf":Js()},body:JSON.stringify(t)}).then(async e=>({ok:e.ok,status:e.status,body:await e.json().catch(()=>({}))})),Zs=e=>fetch(`api/${e}`,{cache:`no-store`}).then(async e=>({ok:e.ok,status:e.status,body:await e.json().catch(()=>({}))})),Qs=3e4,$s=[`pointermove`,`pointerdown`,`keydown`,`wheel`,`touchstart`];function ec(e=document.documentElement){if(matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=Date.now(),n,r=()=>e.dataset.view===`geek`,i=()=>{let a=t+Qs-Date.now();a>0?n=setTimeout(i,a):(n=void 0,r()||e.toggleAttribute(`data-calm`,!0))},a=()=>{t=Date.now(),n===void 0&&(e.toggleAttribute(`data-calm`,!1),r()||(n=setTimeout(i,Qs)))};for(let e of $s)addEventListener(e,a,{capture:!0,passive:!0});document.addEventListener(`visibilitychange`,()=>document.hidden||a()),a()}var tc=0,nc=`button:not([disabled]):not([hidden]), a[href]:not([hidden])`;function rc(e,t){e.id||=`menu-${++tc}`;let n=t?yi({name:t}):gi();return x(`button`,{type:`button`,class:`pair-btn menu-btn`,popovertarget:e.id,"aria-haspopup":`true`,"aria-label":n,title:n},`⋯`)}function ic(e,t,n=``){let r=x(`div`,{class:`menu-pop hud-pop`,popover:`auto`,role:`group`,"aria-label":t?yi({name:t}):gi()},...e);return x(`span`,{class:`menu ${n}`.trim()},rc(r,t),r)}function ac(e){let t=document.createComment(``);e.replaceWith(t);let n=ic([e]);return t.replaceWith(n),n}function oc(e,t){let n=yi({name:t});for(let t of[e.querySelector(`.menu-btn`),e.querySelector(`.menu-pop`)])t&&t.getAttribute(`aria-label`)!==n&&t.setAttribute(`aria-label`,n);e.querySelector(`.menu-btn`)?.setAttribute(`title`,n)}function sc(e,t,n={width:innerWidth,height:innerHeight}){let r=t.getBoundingClientRect(),i=e.offsetWidth,a=e.offsetHeight,o=r.bottom+8+a<=n.height-8||r.top-8-a<8;e.style.top=`${Math.max(8,o?r.bottom+8:r.top-8-a)}px`,e.style.left=`${Math.max(8,Math.min(r.right-i,n.width-i-8))}px`}function cc(e,t,n){if(e.length){if(n===`Home`)return e[0];if(n===`End`)return e.at(-1);if(n===`ArrowDown`)return e[(t+1)%e.length];if(n===`ArrowUp`)return e[(t<0?0:t-1+e.length)%e.length]}}var lc=e=>e instanceof Element?e.closest(`.menu-pop`):null,uc=e=>document.querySelector(`[popovertarget="${CSS.escape(e.id)}"]`);function dc(){document.addEventListener(`toggle`,e=>{let t=lc(e.target);if(!t||e.newState!==`open`)return;let n=uc(t);n&&sc(t,n),t.querySelector(nc)?.focus({preventScroll:!0})},!0),document.addEventListener(`keydown`,e=>{let t=lc(e.target);if(!t||!t.matches(`:popover-open`))return;if(e.key===`Escape`)return void(e.preventDefault(),t.hidePopover(),uc(t)?.focus());let n=[...t.querySelectorAll(nc)],r=cc(n,n.indexOf(document.activeElement),e.key);r&&(e.preventDefault(),r.focus())}),document.addEventListener(`click`,e=>{let t=lc(e.target),n=e.target instanceof Element?e.target.closest(`button, a`):null;t&&n&&t.contains(n)&&!n.hasAttribute(`popovertarget`)&&!n.hasAttribute(`data-menu-keep`)&&t.matches(`:popover-open`)&&t.hidePopover()})}var fc=e=>e.route.view===`map`?``:e.route.ws;function pc(e,t){for(let n of e?.bases??[]){if(n.tower?.key===t)return{u:{key:t,name:n.tower.name,role:`tower`,mark:n.tower.mark,control:n.tower.control,pending:n.tower.pending,queued:n.tower.queued,monitors:n.tower.monitors,service:n.tower.service,docs:n.tower.docs,docsCut:n.tower.docsCut,subs:n.tower.subs},base:n};for(let[e,r]of[...n.tabs.map(e=>[e.label,e.units]),[void 0,n.outside],[void 0,n.tower?.subs??[]]])for(let i of r){if(i.key===t)return{u:i,base:n,squad:e};let r=i.subs.find(e=>e.key===t);if(r)return{u:r,base:n,squad:e,launcher:i}}}}var mc=e=>e?.u.role===`tower`&&e.base.tower?.key===e.u.key?e.base:void 0,C=(e,t)=>(t?t!==`live`:!e)||!(!e?.ended||e.control);function hc(e,t,n){return n?`readonly`:C(e,t)?t===`recent`||e?.ended?`closed`:`none`:`live`}function gc(e){if(e.route.view!==`session`)return;let t=e.route.key,n=pc(e.net,t),r=n?.u;return{key:t,hit:n,u:r,mk:r?.mark??`unknown`,state:e.info?.state,name:r?.name??e.info?.name??t}}var _c=[`phone`,`wifi`,`teams`,`server`],vc=e=>{try{return decodeURIComponent(e)}catch{return e}},yc=e=>/^\.+$/.test(e)?e.replaceAll(`.`,`%2E`):encodeURIComponent(e);function bc(e){let[t,n]=e.split(`#`)[0].split(`?`),[r,i,a,o]=t.replace(/^\/+|\/+$/g,``).split(`/`).map(vc);if(r===`settings`)return _c.includes(i)?{view:`settings`,section:i}:{view:`settings`};if(r!==`w`||!i)return{view:`map`};if(a!==`s`||!o)return{view:`workspace`,ws:i};let s=new URLSearchParams(n).get(`at`);return s?{view:`session`,ws:i,key:o,at:s}:{view:`session`,ws:i,key:o}}var w=e=>e.view===`map`?``:e.view===`settings`?e.section?`settings/${e.section}`:`settings`:e.view===`workspace`?`w/${yc(e.ws)}`:`w/${yc(e.ws)}/s/${yc(e.key)}${e.at?`?at=${encodeURIComponent(e.at)}`:``}`,xc=e=>e.view===`session`?{view:`workspace`,ws:e.ws}:{view:`map`},T=e=>e.view===`settings`?{view:`map`}:e,Sc=e=>e.view===`session`?e.key:e.view===`workspace`?`w:${e.ws}`:null,Cc=e=>Math.max(0,e?.depth||0);function wc(e,t=new URL(document.baseURI).pathname){let n=()=>bc(location.pathname.slice(t.length)+location.search),r={route:n,href:e=>w(e)||`./`,go(n){let r=t+w(n);location.pathname+location.search!==r&&history.pushState({depth:Cc(history.state)+1},``,r),e(n)}};return addEventListener(`popstate`,()=>e(n())),document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[data-route]`);!t||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),t.hasAttribute(`data-back`)&&Cc(history.state)>0?history.back():r.go(bc(t.getAttribute(`data-route`))))}),r}function Tc(e,t,n){let r=n?.allyRuns??[],i=JSON.stringify([t,r.map(e=>[e.id,e.label,e.key])]);e.dataset.sig!==i&&(e.dataset.sig=i,e.hidden=!r.length,e.replaceChildren(...r.length>1?[x(`b`,null,Se({count:r.length}))]:[],...r.map(e=>{let n=ge({device:e.label});if(!e.key)return x(`span`,{class:`ally-chip`,title:ve()},n);let r=w({view:`session`,ws:t,key:e.key});return x(`a`,{class:`ally-chip`,href:r||`./`,"data-route":r,title:_e()},n)})))}var Ec=(e,t)=>e.allyRuns.length===1?Wo({device:e.allyRuns[0].label},t):e.allyRuns.length>1?Se({count:e.allyRuns.length},t):la({},t),E=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1}),Dc=e=>Math.max(1,Math.round(e.idleMs/6e4)),Oc=(e,t)=>e.closing?zt({},t):(e.idle?Ht:Gt)({minutes:Dc(e)},t);function kc(e,t){return{began:e.resumed?Rt({turns:e.turns},t):e.why?Ft({why:e.why},t):Mt({},t),...e.why?{why:e.why}:{},now:e.closing?yt({},t):e.idle&&e.idleAt?jt({time:E(e.idleAt)},t):Jt({minutes:Dc(e)},t),cap:vt({time:E(e.capAt)},t)}}function Ac(e,t){return{title:(e.resumed?Tt:St)({time:E(e.startedAt)},t),...e.endedAt?{ended:[Ot({time:E(e.endedAt)},t),e.note].filter(Boolean).join(` · `)}:{}}}function jc(e,t,n,r){if(!e)return n(t);switch(e.state){case`held`:return Ko({},r);case`waking`:return qo({},r);case`closing`:return Go({},r);case`running`:return e.run?.kind===`ally`?Ec(e,r):e.conversation&&t!==`waiting`?Oc(e.conversation,r):n(t);case`standing`:return t===`idle`?e.allyRuns.length?Ec(e,r):Pr({},r):n(t)}}var Mc={crashed:e=>_o({},e),timeout:e=>yo({},e),quit:e=>vo({},e)};function Nc(e,t){if(!e||e.run)return;let n=Object.hasOwn(Mc,e.lastRun?.outcome??``)?Mc[e.lastRun.outcome](t):void 0;return n&&[n,e.crashes?go({count:e.crashes},t):``].filter(Boolean).join(` · `)}var Pc=(e,t,n,r)=>[jc(e,t,n,r),Nc(e,r)].filter(Boolean).join(` · `),Fc=(e,t)=>e?.queued?Vo({count:e.queued},t):void 0,Ic=`A run could not start: `,Lc=`The tower could not check the standing pane for a program of yours, so it types nothing there; press Retry when it is free`,Rc=`The standing pane is not at its own shell: a nested shell or a program runs there. Leave it, then press Retry`,zc=`The tower types nothing in the standing pane: `,Bc=`An event was parked after two runs crashed with it: `;function Vc(e,t){return(e.kind===`settings`||e.kind===`start`)&&e.text.startsWith(Ic)?jo({reason:e.text.slice(23)},t):e.kind===`start`&&e.text===Lc?Mo({},t):e.kind===`start`&&e.text===Rc?wo({},t):e.kind===`start`&&e.text.startsWith(zc)?Do({reason:e.text.slice(46)},t):e.kind===`loop`?Co({},t):e.kind===`late`&&e.text.startsWith(Bc)?So({what:e.text.slice(52)},t):e.text}function Hc(e,t){return[...(e?.notices??[]).filter(e=>!e.id.startsWith(`parked-`)).map(e=>({id:e.id,level:e.level,text:Vc(e,t),actions:e.kind===`loop`||e.kind===`start`&&e.id===`start`?[`retry`]:[]})),...(e?.memory?.bossWaits??[]).map(e=>({id:`wait-${e.id}`,level:`warning`,text:Xo({text:e.text},t),actions:[`answer`]})),...(e?.memory?.proposals??[]).map(n=>({id:`proposal-${n.id}`,level:`warning`,text:qc(n,t),proposal:n.id,rev:e.memory.rev,actions:[`confirm`,`reject`]})),...e?.memory?.problem?[{id:`memory-unreadable`,level:`warning`,text:e.memory.problem,actions:[]}]:[],...(e?.parked??[]).map(e=>({id:`parked-${e.id}`,level:`warning`,text:e.from?Fo({kind:e.kind,from:e.from,first:e.first},t):Ro({kind:e.kind,first:e.first},t),event:e.id,actions:[`deliver`,`drop`]}))]}function Uc(e,t){if(!(e.status<400)){if(e.body.reason===`No such parked event`)return fo({},t);if(e.body.reason?.startsWith(`The sb server stands in for no tower`))return po({},t)}}async function Wc(e,t,n,r=1200){let i=e.textContent;e.disabled=!0,e.textContent=Zo(),t(void 0);try{let e=await n();e.ok?r&&await new Promise(e=>setTimeout(e,r)):t(so({reason:Uc(e)??e.body.reason??e.body.error??String(e.status)}))}catch{t(so({reason:$o()}))}finally{e.disabled=!1,e.textContent=i}}var Gc={standing:12,decision:24};function Kc(e){let t=e=>e.state===`resolved`||e.state===`expired`;return{standing:e.filter(e=>e.kind===`standing`),decisions:e.filter(e=>e.kind===`decision`).reverse(),waits:e.filter(e=>e.kind===`wait`).sort((e,n)=>Number(t(e))-Number(t(n)))}}var qc=(e,t)=>e.op===`retire`?ni({id:e.target??``,text:e.text},t):(e.kind===`standing`?$r:Xr)({text:e.text},t),Jc=(e,t)=>e.proposals.length?qr({standing:e.standing,decisions:e.decisions,waits:e.waits,proposals:e.proposals.length},t):Wr({standing:e.standing,decisions:e.decisions,waits:e.waits},t);function Yc(e,t){return[e.kind===`wait`?Br({},t):e.via===`proposal`?zr({},t):Rr({},t),e.kind===`wait`?e.for===`boss`?di({},t):si({who:e.on??``},t):void 0,e.state===`answered`?ui({who:e.on??``},t):e.state===`resolved`?hi({outcome:e.outcome??``},t):e.state===`expired`?fi({},t):void 0].filter(Boolean).join(` · `)}function Xc(e,t){return e.body.error===`rev`?ii({},t):String(e.body.reason??e.body.error??e.status)}var Zc={retry:Oo,deliver:lo,drop:uo,answer:co,confirm:Vr,reject:ri};function Qc(e,t,n,r){let i=Hc(n),a=JSON.stringify([t,i]);e.dataset.sig!==a&&(e.dataset.sig=a,e.replaceChildren(...i.map(e=>{let n=x(`small`,{class:`tnote-fail`,role:`alert`}),i=x(`p`,{class:`tnote ${e.level}`},x(`span`,null,e.text));for(let a of e.actions){if(a===`answer`){let e=r?w({view:`session`,ws:t,key:r}):``,n=x(`a`,{class:`pair-btn`,href:e||`./`,"data-route":e},Zc[a]());n.addEventListener(`click`,()=>document.querySelector(`.composer-root textarea`)?.focus()),i.append(n);continue}let o=x(`button`,{type:`button`,class:`pair-btn`},Zc[a]()),[s,c]=e.proposal&&(a===`confirm`||a===`reject`)?[`memory`,a===`confirm`?{op:`confirm`,proposal:e.proposal,rev:e.rev}:{op:`reject`,proposal:e.proposal}]:[a,e.event?{id:e.event}:{}];o.onclick=()=>void Wc(o,e=>n.textContent=e??``,()=>Xs(`tower/${encodeURIComponent(t)}/${s}`,c)),i.append(o)}return i.append(n),i})))}var $c=140;function el(e,t){let n=document.createElement(`nav`),r=document.createElement(`div`),i=document.createElement(`i`);[n.className,r.className,i.className,n.hidden]=[`minimap`,`mm-in`,`mm-view`,!0],n.setAttribute(`aria-label`,bi()),n.append(r,i),document.body.append(n);let a=1,o=0,s=()=>{o=0;let t=e.getBoundingClientRect();i.style.transform=`translateY(${Math.round(Math.max(0,-t.top)*a)}px)`,i.style.height=`${Math.round(Math.min(innerHeight-Math.max(0,t.top),t.bottom)*a)}px`,n.classList.toggle(`away`,t.bottom<innerHeight)},c=()=>{let i=e.getBoundingClientRect();n.hidden=e.hidden||i.height<innerHeight*1.05||!matchMedia(`(min-width: 900px) and (hover: hover)`).matches,!n.hidden&&(a=Math.min($c/i.width,innerHeight*.4/i.height),Object.assign(n.style,{width:`${Math.round(i.width*a)}px`,height:`${Math.round(i.height*a)}px`}),r.replaceChildren(...[...t.querySelectorAll(`:scope > .base:not(.leaving)`)].map(e=>{let t=e.getBoundingClientRect(),n=document.createElement(`i`);return n.dataset.mark=e.dataset.mark??`idle`,n.style.cssText=`left:${(t.left-i.left)*a}px;top:${(t.top-i.top)*a}px;width:${t.width*a}px;height:${t.height*a}px`,n})),s())};return addEventListener(`scroll`,()=>o||=requestAnimationFrame(s),{passive:!0}),addEventListener(`resize`,c),n.addEventListener(`click`,t=>{let n=e.getBoundingClientRect(),i=(t.clientY-r.getBoundingClientRect().top)/a;scrollTo({top:n.top+scrollY+i-innerHeight/2,behavior:matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})}),c}function tl({x1:e,y1:t,x2:n,y2:r,mid:i},a=64){let o=Array.from({length:201},(a,o)=>{let s=o/200,c=1-s;return[c**3*e+3*c*c*s*i+3*c*s*s*i+s**3*n,c**3*t+3*c*c*s*t+3*c*s*s*r+s**3*r]}),s=o.reduce((e,t,n)=>(e.push(n?e[n-1]+Math.hypot(t[0]-o[n-1][0],t[1]-o[n-1][1]):0),e),[]);return Array.from({length:a+1},(e,t)=>{let n=t/a*s.at(-1),r=Math.max(1,s.findIndex(e=>e>=n)),[i,c]=[o[r-1],o[r]],l=s[r]>s[r-1]?(n-s[r-1])/(s[r]-s[r-1]):0;return[i[0]+(c[0]-i[0])*l,i[1]+(c[1]-i[1])*l]})}function nl(e,t){if(t||!e.length)return[];let n=document.createElement(`style`);return n.textContent=e.map((e,t)=>`@keyframes pk${t}{${tl(e).map(([e,t],n,r)=>`${(n/(r.length-1)*100).toFixed(2)}%{transform:translate(${e.toFixed(1)}px,${t.toFixed(1)}px)}`).join(``)}}`).join(``),[n,...e.map((e,t)=>(e=>(e.className=`packet`,e.style.animationName=`pk${t}`,e))(document.createElement(`i`)))]}var rl=typeof document<`u`&&typeof document.querySelector==`function`&&((e=document)=>e.querySelector(`meta[name="sb-desk"]`)?.content===`1`)(),il=(e,t=rl)=>t||e!==`127.0.0.1`,al=(e,t=rl)=>({phone:!il(e,t),server:e===`127.0.0.1`}),ol=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),sl=function(e,t){return new URL(e,t).href},cl={},ll=function(e){return e.pathname.endsWith(`.css`)},ul=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},D=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=sl(t,n);let r=s(t),i=ll(r);return ul(cl,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:ol,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function O(e,t,n,r,i=!1){Object.assign(e.dataset,t),[e.hidden,e.textContent]=[i,n],r&&e.setAttribute(`aria-label`,r)}var dl=(e,t)=>t.role===`subagent`&&t.ended&&t.key?O(e,{close:`dismiss`,key:t.key,name:t.name,role:t.role},Xt(),nn({name:t.name})):O(e,{close:`unit`,key:t.key??``,name:t.name,role:t.role},v(),ot({name:t.name}),!(t.control&&t.key)||t.role===`subagent`),fl=(e,t)=>O(e,{key:t?.key??``,name:t?.name??``,role:`tower`},ea(),void 0,!t?.control);function pl(e,t){e.dataset.close=`unit`,t?.u.role===`tower`&&t.base.tower?.key===t.u.key?fl(e,t.base.tower):t&&dl(e,t.u),e.hidden=!t||e.dataset.close!==`unit`||e.hidden}var ml=(e,t)=>O(e,{ws:t.id,name:t.label},v(),Ge({name:t.label})),hl=(e,t,n=rl)=>O(e,{ws:t.id,name:t.label},Oa(),ja({name:t.label}),n),gl=(e,t,n)=>O(e,{ws:t.id,name:n.label,tab:n.id},v(),Ze({name:n.label})),k=(e,t)=>new Promise(n=>{let r=document.createElement(`dialog`),i=document.createElement(`p`),a=document.createElement(`div`),o=(e,t,i)=>Object.assign(document.createElement(`button`),{type:`button`,className:t,textContent:e,onclick:()=>(r.close(),n(i))});[r.className,i.textContent,a.className]=[`sheet`,e,`sheet-row`],a.append(...t?[o(Ve(),`later`,!1),o(t,`sheet-yes`,!0)]:[o(He(),`later`,!1)]),r.append(i,a),r.addEventListener(`close`,()=>(r.remove(),n(!1))),document.body.append(r),r.showModal()}),_l=e=>e.bases.flatMap(e=>[...e.tower?[e.tower]:[],...e.tabs.flatMap(e=>e.units),...e.outside]).flatMap(e=>e.subs).filter(e=>e.ended).map(e=>e.key);function vl(e,t){let n=_l(t).length;e.hidden=!n,n&&(e.textContent=$t({count:n}))}function yl(e,t,n,r=rl){if(r)return void(e.hidden=!0);let i=n.stashed??[],a=JSON.stringify(i);e.hidden=!i.length;let o=t.closest(`[popover]`);!i.length&&o?.matches(`:popover-open`)&&o.hidePopover(),i.length&&(e.textContent=La({count:i.length})),t.dataset.key!==a&&(t.dataset.key=a,t.replaceChildren(...i.map(e=>{let t=document.createElement(`li`),n=document.createElement(`span`),r=document.createElement(`button`);return n.textContent=e.name===e.label?e.label:`${e.name} (${e.label})`,[r.type,r.className]=[`button`,`pair-btn`],O(r,{close:`pop`,name:e.name},Ji(),Zi({name:e.name})),t.append(n,r),t})))}var bl=e=>D(async()=>{let{post:e}=await Promise.resolve().then(()=>qs);return{post:e}},void 0,import.meta.url).then(({post:t})=>t(`dismiss`,e)).then(e=>e.ok||(k(e.body.reason??y({status:e.status})),!1),()=>(k(_()),!1));function xl(e,{route:t,net:n,go:r}){let i=t();if(i.view===`map`)return;if(e.close===`base`||e.close===`stash`)return void(i.ws===e.ws&&r({view:`map`}));let a=e=>e.flatMap(e=>[e.key,...a(e.subs)]),o=e.close===`tab`&&i.ws===e.ws?n()?.bases.find(t=>t.id===e.ws)?.tabs.find(t=>t.id===e.tab):void 0;i.view===`session`&&(e.close===`unit`?i.key===e.key:o&&a(o.units).includes(i.key))&&r({view:`workspace`,ws:i.ws})}function Sl(e){document.addEventListener(`click`,t=>{let n=t.target?.closest?.(`button[data-close]`),r=n?.dataset;if(n&&r){if(t.preventDefault(),r.close===`dismiss`||r.close===`dismiss-all`)return void bl(r.close===`dismiss`?{key:r.key}:{all:!0});if(r.close===`pop`)return void(n.toggleAttribute(`disabled`,!0),Promise.all([D(()=>Promise.resolve().then(()=>qs),void 0,import.meta.url),D(()=>import(`./refusal--wJ5SRx-.js`).then(e=>e.n),[],import.meta.url)]).then(([{post:e},{reasonOf:t}])=>e(`close/pop`,{name:r.name}).then(e=>e.ok||k(t(e.body.reason,e.body.settings)??y({status:e.status})))).catch(()=>k(_())).finally(()=>n.toggleAttribute(`disabled`,!1)));k((r.close===`stash`?Pa:r.close===`base`?Je:r.close===`tab`?et:r.role===`tower`?rt:lt)({name:r.name??``}),r.close===`stash`?Oa():v()).then(t=>{t&&(n.toggleAttribute(`disabled`,!0),D(async()=>{let{post:e}=await Promise.resolve().then(()=>qs);return{post:e}},void 0,import.meta.url).then(({post:e})=>e(`close/${r.close===`base`?`all`:r.close}`,r.close===`unit`?{key:r.key}:{workspace:r.ws,...r.tab&&{tab:r.tab}})).then(t=>t.ok?xl(r,e):k(t.body.reason??y({status:t.status})),()=>k(_())).finally(()=>n.toggleAttribute(`disabled`,!1)))})}})}var Cl={main:`main`,member:`member`,subagent:`subagent`,outpost:`outpost`,outside:`outside`,tower:`tower`,ally:`tower`,run:`tower`},wl={commanding:Ar,working:Lr,waiting:Ir,idle:Nr,done:jr,error:Mr,unknown:Fr},Tl={ally:la,run:ma,main:ua,member:da,subagent:ga,tower:_a,outpost:fa,outside:pa,session:ha},El={thinking:Ni,"watching a monitor":Mi,idle:Nr,"waiting on a question":Ir,finished:jr},Dl={claude:`Claude`,codex:`Codex`},Ol=e=>Object.hasOwn(Tl,e)?Tl[e]():e,kl=e=>e===`waiting`||e===`error`,A=e=>{let t=new DOMParser().parseFromString(e.trim(),`text/html`).body.firstElementChild;if(!(t instanceof HTMLElement))throw Error(`bad template`);return document.importNode(t,!0)},j=(e,t)=>{let n=document.getElementById(e);if(!(n instanceof t))throw Error(`#${e} is missing from the page`);return n},M=(e,t,n)=>{let r=e.querySelector(t);r.textContent!==n&&(r.textContent=n)},N=(e,t)=>{if(e.dataset.mark===t)return;let n=e.dataset.mark!==void 0;e.dataset.mark=t,n&&Bs(e,`flash`)},Al=e=>(t=>(e.slice(8,t)===`stale`?Ei:Ci)({what:e.slice(t+1)}))(e.indexOf(`:`,8)),P=(e,t)=>e?e.startsWith(`tool:`)?ns({tool:e.slice(5)}):e.startsWith(`monitor:`)?Al(e):Object.hasOwn(El,e)?El[e]():e:wl[t](),jl=(e,t,n)=>C(e,t)?``:n===`working`||n===`commanding`?P(e?.note,n):kl(n)?wl[n]():``,Ml=(e,t,n)=>C(e,t)&&(n===`working`||n===`commanding`)?`done`:n,Nl=(e,t,n,r,i=P(n,r))=>{M(e,t,i),e.querySelector(t).toggleAttribute(`data-monitoring`,i===P(n,r)&&n===`watching a monitor`)},Pl=(e,t)=>{e.toggleAttribute(`hidden`,!t),t&&(e.setAttribute(`href`,w(t)||`./`),e.setAttribute(`data-route`,w(t)))},Fl=(e,t)=>{let n=t.getBoundingClientRect(),r=e.offsetWidth;e.style.top=`${n.bottom+8}px`,e.style.left=`${Math.max(8,Math.min(n.right-r,innerWidth-r-8))}px`},Il=`<div class="plate"><i class="ring"></i><svg><use href="#i-main"/></svg><b class="badge"></b></div>`;function Ll(e,t,n,r){N(e,n);let i=e.querySelector(`use`),a=`#i-${Cl[t]??`member`}`,o=r?.filter(e=>e.onScreen).length;i.getAttribute(`href`)!==a&&i.setAttribute(`href`,a),o?e.dataset.docs=String(o):delete e.dataset.docs}function F(e,t,n,r){let i=new Map;for(let t of e.children)!t.classList.contains(`leaving`)&&t.dataset.key&&i.set(t.dataset.key,t);let a=e.firstElementChild;for(let o of t){let t=i.get(o.id);for(t||(t=n(o),t.dataset.key=o.id,t.classList.add(`enter`),setTimeout(()=>t.classList.remove(`enter`),600)),i.delete(o.id);a?.classList.contains(`leaving`);)a=a.nextElementSibling;t===a?a=a.nextElementSibling:e.insertBefore(t,a),r(t,o)}for(let e of i.values())e.classList.add(`leaving`),setTimeout(()=>e.remove(),400)}var Rl=(e,t=Math.max(0,Date.now()-e)/1e3)=>t<60?de({n:String(Math.floor(t))}):t<3600?ce({n:String(Math.floor(t/60))}):t<86400?ae({n:String(Math.floor(t/3600))}):ne({n:String(Math.floor(t/86400))}),zl=(e,t)=>(t===void 0?delete e.dataset.since:e.dataset.since=String(t),e.textContent=t===void 0?``:Rl(t));function Bl(e,t=[]){let n=e.querySelector(`:scope > .ticks`),r=t.map(e=>`${e.at}${e.mark}`).join();n.dataset.sig!==r&&(n.dataset.sig=r,e.classList.toggle(`ticked`,t.length>0),n.replaceChildren(...t.map((e,n)=>{let r=document.createElement(`i`);return r.dataset.mark=e.mark,r.style.setProperty(`--o`,((n+1)/t.length).toFixed(2)),r})))}var Vl=()=>A(`<div class="unit"><div class="card"><a class="hit"></a>${Il}<div class="meta"><span class="name"></span><span class="line"><em class="role"></em><em class="agent"></em><span class="note"></span><span class="age"></span></span><span class="todo" hidden><b></b><span></span></span></div><button type="button" class="quit-btn" data-close="unit" hidden></button><span class="ticks" aria-hidden="true"></span></div><div class="subs"></div></div>`);function Hl(e,t){let n=e.closest(`.base`)?.dataset.key,r=e.querySelector(`.hit`),i=Ml(t,void 0,t.mark),a=C(t)?void 0:t.note;Pl(r,t.key&&n?{view:`session`,ws:n,key:t.key}:void 0),r.setAttribute(`aria-label`,`${t.name}: ${P(a,i)}`),r.toggleAttribute(`data-alert`,kl(i)),N(e,i),Ll(e.querySelector(`.plate`),t.role,i,t.docs),M(e,`.name`,t.name),M(e,`.role`,Ol(t.role)),M(e,`.agent`,t.agent?Dl[t.agent]:``),Nl(e,`.note`,a,i),zl(e.querySelector(`:scope > .card .age`),t.since);let o=e.querySelector(`:scope > .card .todo`);o.hidden=!t.todo,t.todo&&(M(o,`b`,`${t.todo.done<t.todo.total?`◐`:`✓`} ${t.todo.done}/${t.todo.total}`),M(o,`span`,t.todo.now??``)),Bl(e.querySelector(`:scope > .card`),t.ticks),dl(e.querySelector(`:scope > .card > .quit-btn`),t),F(e.querySelector(`.subs`),t.subs??[],Vl,Hl)}function Ul(e,t,n){let r=t.tower?`main`:`member`;e.hidden=!!(n&&t.tower),e.dataset.open=r,e.dataset.ws=t.id,n&&(e.dataset.tab=n),e.textContent!==(r===`main`?Ui():Wi())&&(e.textContent=r===`main`?Ui():Wi())}var Wl=()=>A(`<section class="base"><header><div class="tower"><i class="sweep"></i><i class="pulse"></i><svg><use href="#i-tower"/></svg><b class="badge"></b></div><div class="title"><span class="crown"><svg><use href="#i-crown"/></svg>${an()}</span><h2><a class="enter-base"></a></h2><p><span class="tstate"></span><span class="tqueue"></span><span class="age"></span></p><div class="allies" hidden></div><button type="button" class="quit-btn tower-quit" data-close="unit" hidden></button></div><button type="button" class="quit-btn" data-close="base"></button></header><div class="subs tower-subs"></div><div class="tower-notices"></div><div class="spawn-btns"><button type="button" class="pair-btn"></button><button type="button" class="pair-btn" data-close="stash"></button></div><div class="tabs"></div><div class="outposts" data-label="${Gi()}"></div></section>`),Gl=()=>{let e=Wl();return ac(e.querySelector(`header > .quit-btn`)),e},Kl=e=>Pc(e.service,e.mark,e=>wl[e]());function ql(e,t){N(e,t.mark),e.classList.toggle(`head`,t.head);let n=e.querySelector(`.tower`);n.classList.toggle(`ghost`,!t.tower),N(n,t.tower?.mark??`unknown`),M(e,`h2 a`,t.label),Pl(e.querySelector(`h2 a`),{view:`workspace`,ws:t.id}),M(e,`.title .tstate`,t.tower?ht({state:Kl(t.tower)}):ji()),M(e,`.title .tqueue`,Fc(t.tower?.service)??``),zl(e.querySelector(`.title .age`),t.tower?.since),Ul(e.querySelector(`.spawn-btns button`),t),ml(e.querySelector(`header .menu-pop > .quit-btn`),t),oc(e.querySelector(`header > .menu`),t.label),hl(e.querySelector(`.spawn-btns [data-close=stash]`),t),fl(e.querySelector(`.tower-quit`),t.tower),F(e.querySelector(`.tower-subs`),t.tower?.subs??[],Vl,Hl),Tc(e.querySelector(`.title .allies`),t.id,t.tower?.service),Qc(e.querySelector(`.tower-notices`),t.id,t.tower?.service,t.tower?.key),F(e.querySelector(`.tabs`),t.tabs,()=>{let e=A(`<div class="tab"><h3><span></span><button type="button" class="tab-add"></button><button type="button" class="quit-btn" data-close="tab"></button></h3><div class="units"></div></div>`);return ac(e.querySelector(`h3 > .quit-btn`)),e},(e,n)=>{M(e,`h3 span`,Xa({label:n.label})),gl(e.querySelector(`.menu-pop > .quit-btn`),t,n),oc(e.querySelector(`h3 > .menu`),Xa({label:n.label})),Ul(e.querySelector(`.tab-add`),t,n.id),F(e.querySelector(`.units`),n.units,Vl,Hl)}),F(e.querySelector(`.outposts`),t.outposts.map(e=>({id:e.id,name:e.label,role:`outpost`,mark:e.mark,note:e.mark===`unknown`?ki():void 0,since:e.since,ticks:e.ticks})),Vl,Hl)}var Jl=()=>A(`<section class="base ally"><header><div class="tower"><i class="pulse"></i><svg><use href="#i-tower"/></svg><b class="badge"></b></div><div class="title"><span class="crown"><svg><use href="#i-main"/></svg><em class="ally-tag"></em></span><h2></h2><p><span class="tstate"></span></p></div></header><ul class="ally-tabs"></ul></section>`);function Yl(e,t){let n=Gs(t);N(e,n),e.classList.toggle(`offline`,!t.online),N(e.querySelector(`.tower`),n),M(e,`.ally-tag`,Te({team:t.teamName})),M(e,`h2`,t.workspace??t.label),M(e,`.tstate`,`${t.workspace?`${t.label} · `:``}${t.short} · ${t.online?Ks(t.tower):Kn()}`),F(e.querySelector(`.ally-tabs`),t.tabs.map((e,t)=>({id:`${t}`,...e})),()=>A(`<li class="ally-tab"><b></b><span></span></li>`),(e,n)=>{M(e,`b`,n.label),M(e,`span`,t.online?Ks(n.state):``),e.dataset.state=n.state})}function Xl(e,t,n,r){let i=[...e.querySelectorAll(`.base:not(.leaving):not(.ally) .tower`)],a=e.querySelector(`.base.head:not(.leaving) .tower`),o=e.getBoundingClientRect(),s=e=>{let t=e.getBoundingClientRect();return[Math.round(t.x+t.width/2-o.x),Math.round(t.y+t.height/2-o.y)]},c=a?i.filter(e=>e!==a):[],l=c.map(e=>{let[[t,n],[r,i]]=[s(a),s(e)];return{x1:t,y1:n,x2:r,y2:i,mid:Math.round((t+r)/2)}}),u=l.map(({x1:e,y1:t,x2:n,y2:r,mid:i})=>`M${e} ${t}C${i} ${t} ${i} ${r} ${n} ${r}`),d=u.join(`|`);t.dataset.sig!==d&&(t.dataset.sig=d,t.replaceChildren(...u.map(e=>(t=>(t.setAttribute(`class`,`wire`),t.setAttribute(`d`,e),t))(document.createElementNS(`http://www.w3.org/2000/svg`,`path`)))),n.replaceChildren(...nl(l,r))),n.querySelectorAll(`.packet`).forEach((e,t)=>e.toggleAttribute(`data-live`,[`working`,`commanding`].includes(a.dataset.mark??``)||[`working`,`commanding`].includes(c[t].dataset.mark??``)))}var Zl=2,Ql=20;function $l(){let[e,t,n,r]=[j(`map`,HTMLElement),j(`bases`,HTMLElement),j(`links`,SVGSVGElement),j(`packets`,HTMLElement)],i=matchMedia(`(prefers-reduced-motion: reduce)`).matches,a=new Set,o=el(e,t),s=()=>(o(),!e.hidden&&Xl(e,n,r,i)),c=0,l=()=>c||=requestAnimationFrame(()=>(c=0,s())),u=new ResizeObserver(e=>(e.forEach(({target:e,borderBoxSize:t})=>e.style.gridRowEnd=`span ${Math.ceil((t[0].blockSize+Ql)/Zl)}`),l()));return setInterval(()=>document.querySelectorAll(`.age[data-since]`).forEach(e=>zl(e,Number(e.dataset.since))),15e3),addEventListener(`resize`,l),new ResizeObserver(([e])=>document.documentElement.style.setProperty(`--hud`,`${Math.ceil(e.borderBoxSize[0].blockSize)}px`)).observe(document.querySelector(`.hud`)),ec(),{layout:s,stats(e){let t=e.bases.flatMap(e=>[...e.tower?.subs??[],...e.tabs.flatMap(e=>e.units.flatMap(e=>[e,...e.subs]))]),n=e=>String(t.filter(t=>!e||t.mark===e).length);j(`s-commanding`,HTMLElement).parentElement.toggleAttribute(`data-on`,t.some(e=>e.mark===`commanding`));for(let[t,r]of[[`s-bases`,String(e.bases.length)],[`s-agents`,n()],[`s-working`,n(`working`)],[`s-commanding`,n(`commanding`)],[`s-waiting`,n(`waiting`)]])j(t,HTMLElement).textContent=r},show(e){let n=(e.link?.allies??[]).map(e=>({...e,id:`ally/${e.id}`,ally:!0}));F(t,[...e.bases,...n],e=>`ally`in e?Jl():Gl(),(e,t)=>`ally`in t?Yl(e,t):ql(e,t));for(let e of t.children)a.has(e)||(a.add(e),u.observe(e));for(let e of a)e.isConnected||(a.delete(e),u.unobserve(e));requestAnimationFrame(s)},pause(e){document.documentElement.classList.toggle(`paused`,e)}}}var eu=(e,t)=>n=>n&&!e()&&t();function tu(e,t){let n=j(`link-alerts`,HTMLButtonElement),r=j(`link-alerts-pop`,HTMLElement),i=j(`link-alerts-list`,HTMLElement),a=``,o=new Set,s=!0;r.addEventListener(`toggle`,e=>e.newState===`open`&&Fl(r,n)),r.setAttribute(`aria-label`,Bn()),n.title=Bn();let c=(e,t,n)=>{let r=n.querySelector(`.link-note`);for(let e of n.querySelectorAll(`button`))e.disabled=!0;Xs(`link/confirm-answer`,{dialogId:e.dialogId,allow:t}).then(e=>{e.ok||(r.textContent=e.body.reason??y({status:e.status}));for(let e of n.querySelectorAll(`button`))e.disabled=!1},()=>{r.textContent=_();for(let e of n.querySelectorAll(`button`))e.disabled=!1})},l=e=>{let t=x(`li`,{class:`link-alert`,"data-level":`warning`}),n=x(`button`,{type:`button`,class:`pair-btn`},Vn()),r=x(`button`,{type:`button`,class:`pair-btn`},Un());return n.onclick=()=>c(e,!0,t),r.onclick=()=>c(e,!1,t),t.append(x(`b`,null,Vs({id:``,kind:`confirm`,level:`warning`,team:e.team,teamName:``,data:{label:e.fromLabel,short:e.fromShort,tool:e.tool,tower:e.tower}})),x(`pre`,{class:`link-args`},e.args),x(`div`,{class:`devices-acts`},n,r),x(`small`,{class:`link-note`,role:`status`})),t};return{net(c){let u=Hs((c?.alerts??[]).filter(e=>e.kind!==`confirm`)),d=c?.confirms??[],f=JSON.stringify([u,d]);if(f===a)return;a=f;let p=new Set([...d.map(e=>`c/${e.dialogId}`),...u.filter(e=>e.kind===`join-request`).map(e=>e.id)]);s||t([...p].filter(e=>!o.has(e)).length),[o,s]=[p,!1];let m=u.length+d.length;n.hidden=m===0,n.textContent=zn({count:String(m)}),n.dataset.state=d.length||u.some(e=>e.level===`error`)?`error`:u.some(e=>e.level===`warning`)?`waiting`:`done`,!m&&r.matches(`:popover-open`)&&r.hidePopover(),i.replaceChildren(...zs(...d.map(l),...u.map(t=>{let n=x(`li`,{class:`link-alert`,"data-level":t.level},x(`span`,null,Vs(t)));if(t.kind===`join-request`||t.kind===`fork`||t.kind===`mismatch`){let i=x(`button`,{type:`button`,class:`later`},t.kind===`join-request`?Xn():Jn());i.onclick=()=>(r.hidePopover(),e()),n.append(i)}if(t.kind===`served`){let e=x(`a`,{class:`later`,href:`./`,"data-route":``},er());e.onclick=()=>r.hidePopover(),n.append(e)}return n})))}}}var nu=`sb.sound`,ru=`sb.volume`,I=(e,t)=>{try{return e()}catch{return t}},iu=(e=localStorage)=>I(()=>e.getItem(nu),null)===`1`,au=(e=localStorage)=>Math.min(100,Math.max(0,Number(I(()=>e.getItem(`sb.volume`),null)??`60`)||0)),ou=(e,t=localStorage)=>I(()=>t.setItem(nu,e?`1`:`0`),void 0),su=(e,t=localStorage)=>I(()=>t.setItem(ru,String(e)),void 0),cu=new URL(`done-jqKY4qf5.mp3`,import.meta.url).href,lu=new URL(`error-DdTLgPEw.mp3`,import.meta.url).href,uu={waiting:new URL(`waiting-DOg8-8gu.mp3`,import.meta.url).href,error:lu,done:cu},du=e=>e.mark===`waiting`||e.pending?`waiting`:e.mark===`error`?`error`:e.mark===`done`?`done`:void 0,fu=(e,t)=>{try{return localStorage.getItem(e)??t}catch{return t}},pu=(e,t)=>{try{localStorage.setItem(e,t)}catch{}};function mu(e){let t=e=>document.getElementById(e),n=t(`remind`),r=t(`sound`),i=t(`sound-vol`),a=t(`sound-vol-out`),o=typeof Notification<`u`,s=fu(`sb.remind`,`1`)===`1`,c=iu(),l=au(),u,d,f=new Map,p=()=>{let e=o?Notification.permission:`denied`;n.setAttribute(`aria-pressed`,String(s)),n.dataset.state=s?e===`granted`?`on`:e===`denied`?`blocked`:`ask`:`off`,n.title=o?s?e===`granted`?sa():e===`denied`?aa():ia():oa():ca(),t(`remind-note`).textContent=n.title,r.dataset.state=c?`on`:`off`,n.textContent={off:Ga,on:Ka,blocked:Wa,ask:Ua}[n.dataset.state](),r.textContent=c?Ka():Ga(),r.setAttribute(`aria-pressed`,String(c)),i.value=a.value=String(l),d&&(d.gain.value=(l/100)**2)};n.onclick=async()=>{s&&o&&Notification.permission==="default"?await Notification.requestPermission().catch(()=>{}):pu(`sb.remind`,(s=!s)?`1`:`0`),p()};let m=e=>{ou(c=e),p(),c&&h(`done`)},ee=e=>(su(l=e),p());r.onclick=()=>m(!c),i.oninput=()=>ee(Number(i.value)),i.onchange=()=>h(`done`),t(`sound-try`).onclick=()=>h(`done`);function h(e){u??=new AudioContext,d||((d=u.createGain()).connect(u.destination),p());let t=u,n=d;f.has(e)||f.set(e,fetch(uu[e]).then(e=>e.arrayBuffer()).then(e=>t.decodeAudioData(e))),Promise.all([t.resume(),f.get(e)]).then(([,e])=>{let r=t.createBufferSource();r.buffer=e,r.connect(n),r.start()}).catch(()=>f.delete(e))}function te(t,n){if(!s||!o||Notification.permission!==`granted`||!document.hidden&&document.hasFocus())return;let r=new Notification(t.name,{body:t.trust?Qo():{waiting:Hi,error:zi,done:Ii}[n]({note:t.note??``}).trim(),tag:t.key,icon:document.querySelector(`link[rel="icon"]`)?.href,silent:n!==`waiting`});r.onclick=()=>(window.focus(),r.close(),e(t))}return p(),{remind:e=>te(e,`waiting`),sound:{on:()=>c,volume:()=>l,set:m,setVolume:ee,try:()=>h(`done`)},chime:()=>c&&h(`done`),signal(e){let t=e.flatMap(e=>(t=>t?[{a:e,k:t}]:[])(du(e)));if(t.length){c&&h([`waiting`,`error`,`done`].find(e=>t.some(t=>t.k===e)));for(let{a:e,k:n}of t)te(e,n)}}}}var hu=45e3,gu=1e3,_u=3e4,vu=(e,t)=>Math.min(_u,gu*2**(e-1))*(.8+.4*t);function yu(e){try{return JSON.parse(e)}catch{return}}function bu(e){let t,n,r,i=0,a={state:`connecting`,attempt:0},o=t=>e.onStatus(a={...a,...t}),s=()=>(e.clearTimeout(n),e.clearTimeout(r),n=r=void 0),c=()=>{let e=t;t=void 0,e?.close()},l=()=>{e.clearTimeout(r),r=e.setTimeout(()=>u(),hu),o({state:`live`,attempt:0,lastContact:e.now()})},u=()=>{c(),s();let t=a.attempt+1;if(t>8)return o({state:`offline`,attempt:t});o({state:`reconnecting`,attempt:t}),e.hidden()||(n=e.setTimeout(d,vu(t,e.random())))},d=()=>{c(),s(),i=e.now();let n=t=e.open();n.onError(()=>{t===n&&(u(),e.replaced?.().then(e=>{e&&a.state!==`live`&&a.state!==`replaced`&&(c(),s(),o({state:`replaced`}))},()=>{}))}),n.listen(`message`,r=>{if(t!==n)return;let i=yu(r);i&&e.onNet(i),o({problem:i?void 0:Qi()}),l()}),n.listen(`ping`,()=>t===n&&l()),n.listen(`problem`,e=>{t===n&&(o({problem:yu(e)??$i()}),l())}),r=e.setTimeout(()=>u(),hu)};return{start(){o({state:`connecting`,attempt:0}),d()},resume(){if(a.state===`replaced`)return;let n=e.now()-i<2e3||a.lastContact!==void 0&&e.now()-a.lastContact<=2e4;t&&n||(o({attempt:0,state:a.state===`live`||a.state===`offline`?`reconnecting`:a.state}),d())},restart:d,hide(){e.clearTimeout(n),n=void 0},stop(){c(),s()}}}var xu,Su=e=>void(xu=e);function Cu(e,t){if(`terminal`in e)return void t?.();if(e.pane===null)return Ki();xu?.(e.pane)}var wu={commanding:ar,working:kr,waiting:Er,idle:mr,done:cr,error:dr,unknown:Cr},Tu=e=>(e.kind===`joined`?_r:e.kind===`left`?br:wu[e.mark])({name:e.name}),Eu=18e5,Du={waiting:0,error:0,working:1,commanding:1},Ou=e=>new Date(e).toLocaleTimeString([],{hour12:!1});function ku(e){let[t,n,r,i,a]=[`.tl-lanes`,`.tl-axis`,`.tl-at`,`.tl-last`,`.tl-span`].map(t=>e.querySelector(t)),o=[],s=``;matchMedia(`(max-width: 640px)`).matches&&(e.open=!1);let c=()=>{let e=Date.now()-Eu,s=o.filter(t=>t.at>=e),c=s.at(-1);t.replaceChildren(...s.map(t=>{let n=document.createElement(`a`),r=(t.at-e)/Eu*100;return n.className=`tl-mark ${t.kind}${r>70?` end`:``}`,n.dataset.mark=t.kind===`left`?`unknown`:t.mark,n.style.cssText=`left:${r.toFixed(2)}%;top:${(Du[t.mark]??2)*14+4}px`,n.setAttribute(`aria-label`,`${Ou(t.at)} ${Tu(t)}`),Pl(n,t.key&&t.kind!==`left`?{view:`session`,ws:t.ws,key:t.key}:{view:`workspace`,ws:t.ws}),n})),n.replaceChildren(...[0,10,20].map(t=>Object.assign(document.createElement(`span`),{textContent:Ou(e+t*6e4).slice(0,5)})),Object.assign(document.createElement(`span`),{textContent:eo()})),r.textContent=c?Ou(c.at):``,i.textContent=c?Tu(c):$a(),a.textContent=ro({count:String(s.length)})};return setInterval(c,3e4),c(),{net(e){let t=e.events??[],n=t.map(e=>`${e.at}${e.kind}${e.key??e.name}${e.mark}`).join();n!==s&&(s=n,o=t,c())}}}async function Au(e,t=fetch){return e.startsWith(`data:`)?decodeURIComponent(e.slice(e.indexOf(`,`)+1)):t(e).then(e=>e.text(),()=>void 0)}function ju(e,t){let n=`<circle cx='23' cy='9' r='9' fill='#e0af68' stroke='#1a1b26' stroke-width='2'/><text x='23' y='13' text-anchor='middle' font-family='sans-serif' font-size='${t>9?9:12}' font-weight='700' fill='#16161e'>${t>9?`9+`:t}</text>`;return`data:image/svg+xml,${encodeURIComponent(t?e.replace(`</svg>`,`${n}</svg>`):e)}`}var L=d(void 0);bs(),dc(),f(document.getElementById(`view-pick`),L,xs);var R=$l(),Mu=ku(document.getElementById(`timeline`)),z=e=>document.getElementById(e),Nu=document.documentElement,Pu=p(z(`zen-back`),L,Nu),Fu=e=>e?new Date(e).toLocaleTimeString([],{hour12:!1}):Di(),Iu,B,V,Lu={state:`connecting`,attempt:0},H={view:`map`},Ru=!1,zu,Bu=``,U,Vu,W=e=>U?e(U):void Vu?.then(e);function Hu(){Vu??=D(async()=>{let{mountFocus:e}=await import(`./views-Cdt6yzVx.js`);return{mountFocus:e}},[],import.meta.url).then(({mountFocus:e})=>(U=e({data:Sd,restart:()=>Q.restart(),openTile:Gu,embedTerminal:(e,t,n)=>new Promise(r=>K(i=>r(i.terminal.embed(e,t,n)))),online:()=>Lu.state===`live`}),U.show(T(H),T(H)),B&&U.net(B),U))}var Uu=e=>B?.bases.find(t=>t.id===e)?.label??e,G,Wu,K=e=>{if(G)return e(G);Wu??=D(async()=>{let{mountPanels:e}=await import(`./layer-B3XpK4A2.js`);return{mountPanels:e}},[],import.meta.url).then(({mountPanels:e})=>G=e({label:Uu,recent:Cd,post:e=>Y&&((t,n)=>Y.data(e).post(t,n)),stream:()=>Bu,showTerminal:(e,t)=>(G?.stack.close(`go`),X.go({view:`session`,ws:e,key:t}),W(e=>e.terminal(t)))})),Wu.then(e)},Gu=(e,t)=>K(n=>n.tiles.open(e,t));Su(e=>(q()&&ed.leave(),K(t=>t.terminal.open(`grant:${e}`,qi(),!0))));var q=()=>L.view()===`zen`&&Nu.dataset.zenAway===void 0&&H.view!==`settings`,J,Ku,qu=null,Ju=null,Yu=e=>{Ku??=D(async()=>{let{mountZen:e}=await import(`./zenchunk-1xuaV6wt.js`);return{mountZen:e}},__vite__mapDeps([0]),import.meta.url).then(({mountZen:e})=>J=e(z(`zen`),{data:Sd,recent:Cd,label:Uu,online:()=>Lu.state===`live`,post:e=>Y&&((t,n)=>Y.data(e).post(t,n)),trust:Y&&Y.trust,remind:e=>Z.remind(e),sound:()=>{},menu:{language:{get:i,names:ys,set:vs},view:{choice:()=>L.choice(),set:e=>L.set(e),auto:()=>xs(L.server())},sound:Z.sound},leave:$u,watch:e=>(qu=e,Zu())})),Ku.then(e)},Xu=()=>q()&&qu||Sc(H);function Zu(){let e=Xu();e!==Ju&&(Ju=e,Ru&&Q.restart())}function Qu(){let e=q();z(`zen`).hidden=!e,e?Yu(e=>q()&&(B&&e.net(Ts(B,Date.now()),B),e.show())):J?.hide(),B&&ld(B),Zu()}function $u({item:e,route:t,terminal:n}){ed.leave(),e&&K(t=>t.stack.show(e)),n&&(Hu(),W(e=>e.terminal(n))),t&&X.go(t),V&&fd(V)}var ed=ee({view:L,root:Nu,settings:()=>H.view===`settings`,leaveSettings:()=>Od(),draw:()=>(Pu(),Qu())}),td=al(location.hostname),nd=td.phone,rd,id=e=>void(rd??=D(async()=>{let{mountSettings:e}=await import(`./settings-GqUawN7V.js`);return{mountSettings:e}},[],import.meta.url).then(({mountSettings:e})=>e(z(`settings-view`),td))).then(e),ad=e=>H.view===`settings`?id(t=>t.show(e)):X.go({view:`settings`,section:e}),od=document.querySelector(`link[rel="icon"]`),sd=od?Au(od.href):void 0,cd=0;function ld(e){let t=q()?0:e.bases.flatMap(e=>[...e.tower?[e.tower,...e.tower.subs]:[],...[...e.tabs.flatMap(e=>e.units),...e.outside].flatMap(e=>[e,...e.subs])]).filter(e=>e.mark===`waiting`||e.pending).length+(e.trust?.length??0);od&&sd&&t!==cd&&(cd=t,sd.then(e=>e&&t===cd&&(od.href=ju(e,t))))}var ud;function dd(){let e=z(`dismiss-all`).hidden&&z(`stashed`).hidden;z(`bar-more`).hidden=e,e&&z(`bar-pop`).matches(`:popover-open`)&&z(`bar-pop`).hidePopover()}function fd(e){B=V=e,ld(e),Td.net(e.link);let t=Ts(e,Date.now());if(q())return void(ud=t,Yu(n=>n.net(t,e)));if(ud&&Z.signal(Es(ud,t)),ud=t,document.hidden)return;R.stats(e),vl(z(`dismiss-all`),e),yl(z(`stashed`),z(`stashed-list`),e),dd(),$?.net(e);let n=Es(zu,t);(n.length||G)&&K(e=>e.alerts(n,t)),zu=t,Mu.net(e),W(t=>t.net(e)),H.view===`map`&&(R.show(e),Iu=e,V=void 0)}function pd(e){let t=H,n=e.view===`workspace`&&t.view===`map`?document.querySelector(`#bases [data-key="${CSS.escape(e.ws)}"]`)?.getBoundingClientRect():void 0;H=e,e.view===`settings`!=(t.view===`settings`)&&ed.route(e.view===`settings`),document.body.dataset.route=e.view,$?.route(e),(e.view===`workspace`||e.view===`session`)&&Hu(),z(`map`).hidden=e.view!==`map`,z(`settings-view`).hidden=e.view!==`settings`,z(`crumbs`).hidden=e.view===`settings`,z(`legend`).hidden=e.view===`session`||e.view===`settings`,z(`prefs`).toggleAttribute(`aria-current`,e.view===`settings`),z(`stage`).dataset.view=e.view,W(r=>r.show(T(e),T(t),n)),e.view===`settings`?id(t=>H===e&&t.show(e.section)):t.view===`settings`&&id(e=>e.hide()),e.view===`map`&&B&&B!==Iu&&(fd(B),requestAnimationFrame(R.layout)),Zu()}function md(e){Lu=e,Dd(e),J?.refresh();let t=e.state===`reconnecting`||e.state===`offline`||e.state===`replaced`;document.body.dataset.stale=z(`stage`).dataset.stale=String(t),z(`link`).dataset.state=e.state,z(`link-text`).textContent={connecting:Hn,live:Wn,reconnecting:Yn,offline:Kn,replaced:Kn}[e.state](),U&&B&&U.net(B),G?.stack.redraw();let n=z(`banner`);n.hidden=!t&&!e.problem;let r=e.state===`replaced`?ze():e.state===`offline`?je({tries:e.attempt-1}):e.state===`reconnecting`?e.attempt?Re({attempt:e.attempt}):Fe():Pe({problem:e.problem??``}),i=document.createElement(`b`);i.textContent=Fu(e.lastContact),n.replaceChildren(`${r} ${Oe()} `,i,De())}function hd(e,t){try{let n=JSON.parse(t);e===`history`&&J?.history(n),W(t=>e===`history`?t.history(n):t.cards(n))}catch{}}var gd=document.querySelector(`meta[name="sb-build"]`)?.content,_d=e=>!!(gd&&gd!==JSON.parse(e).build);function vd(e,t=!1){try{let n=JSON.parse(e),r=t?n:n?.view;typeof r==`string`&&L.setServer(r)}catch{}}function yd(e){let t=new EventSource(e?`events?watch=${encodeURIComponent(e)}`:`events`);return{onError:e=>t.onerror=e,listen:(e,n)=>t.addEventListener(e,e=>n(e.data)),close:()=>t.close()}}var bd=e=>fetch(`api/${e}`,{cache:`no-store`}).then(e=>e.ok?e.json():Promise.reject(Error(String(e.status)))),xd=(e,t=``)=>bd(`history/${encodeURIComponent(e)}${t}`),Y=void 0,Sd=e=>({older:t=>xd(e,`?before=${encodeURIComponent(t)}`),latest:()=>xd(e),entry:t=>bd(`entry/${encodeURIComponent(e)}/${encodeURIComponent(t)}`).catch(()=>void 0),pic:(t,n)=>`api/image/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${n}`}),Cd=async e=>(await xd(e,`?limit=12`)).items,wd=()=>{Ju=Xu();let e=yd(Ju);return e.listen(`history`,e=>hd(`history`,e)),e.listen(`cards`,e=>hd(`cards`,e)),e.listen(`hello`,e=>_d(e)?location.reload():(Bu=e,vd(e),G?.terminal.hello())),e.listen(`view`,e=>vd(e,!0)),e.listen(`mirror`,e=>G?.terminal.frame(e)),e};document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[data-alert]`),n=t&&bc(t.getAttribute(`data-route`)??``);if(!n||n.view!==`session`||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let r=zu?.get(n.key);r&&(e.preventDefault(),K(e=>e.stack.show(r)))},!0);var X=wc(e=>pd(e)),Td=tu(()=>ad(`teams`),eu(q,()=>Z.chime())),Z=mu(e=>q()||(e.trust?K(t=>t.stack.show(e)):X.go({view:`session`,ws:e.ws,key:Cs(e)}))),Q=bu({open:wd,now:Date.now,setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e),random:Math.random,hidden:()=>document.hidden,onNet:fd,onStatus:md,replaced:()=>fetch(`./`,{cache:`no-store`}).then(e=>e.status===403)}),Ed=()=>Q.resume(),Dd=Ms(Ed);document.addEventListener(`visibilitychange`,()=>{if(R.pause(document.hidden),J?.visible(!document.hidden),document.hidden)return Q.hide();V&&fd(V),W(e=>e.wake()),Ed()});var Od=()=>Cc(window.history.state)>0?window.history.back():X.go({view:`map`});addEventListener(`keydown`,e=>{e.key===`Escape`&&!e.defaultPrevented&&!e.isComposing&&q()&&!document.querySelector(`dialog.sheet[open], dialog.lightbox[open], [popover]:popover-open`)&&J?.escape(e)&&e.stopPropagation()},!0),addEventListener(`keydown`,e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(`dialog.sheet[open], dialog.lightbox[open], [popover]:popover-open`)||(e.preventDefault(),!(G?.stack.close()||H.view===`map`)&&(H.view===`settings`?Od():X.go(xc(H))))}),Rs(e=>G?.hotkey(e)??!1,()=>q()||document.querySelector(`dialog.sheet[open], dialog.lightbox[open], [popover]:popover-open`)!==null),z(`prefs`).addEventListener(`click`,e=>H.view===`settings`&&(e.preventDefault(),Od())),nd&&D(async()=>{let{mountLanWait:e}=await import(`./lanwait-D5EZzX1l.js`);return{mountLanWait:e}},[],import.meta.url).then(({mountLanWait:e})=>e(z(`lan-wait`),()=>ad(`wifi`)));var $,kd=matchMedia(`(pointer: coarse), (max-width: 640px)`),Ad=()=>void D(async()=>{let{mountDrawer:e}=await import(`./drawer-2puVMQ4G.js`);return{mountDrawer:e}},[],import.meta.url).then(({mountDrawer:e})=>($??=e(q),B&&$.net(B),$.route(H)));kd.matches?Ad():kd.addEventListener(`change`,()=>kd.matches&&!$&&Ad(),{once:!0}),Sl({route:()=>T(H),net:()=>B,go:e=>X.go(e)}),z(`stashed-pop`).addEventListener(`toggle`,e=>e.newState===`open`&&Fl(z(`stashed-pop`),z(`stashed`))),document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`button[data-open]`);t&&D(async()=>{let{openingOf:e,spawnTile:t}=await import(`./spawn-BE3dB0IA.js`);return{openingOf:e,spawnTile:t}},[],import.meta.url).then(({openingOf:e,spawnTile:n})=>{let r=e(t,B?.bases??[]);r&&Gu(n(r,(e,t,n)=>(G?.tiles.close(n),X.go({view:`session`,ws:e,key:t})),()=>Z.chime()),!0)})});for(let e of[`focus`,`pageshow`,`online`])window.addEventListener(e,()=>!document.hidden&&Ed());md(Lu),pd(X.route()),Qu(),Q.start(),Ru=!0;export{x as $,kc as A,ri as At,w as B,ht as Bt,bl as C,Gi as Ct,Gc as D,ki as Dt,Qc as E,Ai as Et,Xc as F,wn as Ft,mc as G,ge as Gt,C as H,Ve as Ht,qc as I,hn as It,Zs as J,fc as K,pe as Kt,Fc as L,on as Lt,Jc as M,Mr as Mt,Kc as N,In as Nt,Uc as O,Di as Ot,Yc as P,Dn as Pt,Ws as Q,Pc as R,an as Rt,dl as S,y as St,D as T,_ as Tt,pc as U,Ee as Ut,hc as V,He as Vt,gc as W,g as Wt,Ys as X,Xs as Y,Us as Z,Nl as _,wa as _t,Il as a,Cs as at,kl as b,ua as bt,j as c,cs as ct,Fl as d,Xa as dt,zs as et,A as f,Ka as ft,Ol as g,Da as gt,N as h,Va as ht,wl as i,ws as it,Wc as j,Vr as jt,Ac as k,gi as kt,P as l,ss as lt,jl as m,Ha as mt,Dl as n,Is as nt,Pl as o,ds as ot,Ml as p,Ga as pt,rc as q,Cl as r,Ss as rt,Ul as s,ls as st,Cu as t,Bs as tt,Ll as u,$o as ut,F as v,ma as vt,vl as w,ji as wt,pl as x,la as xt,M as y,da as yt,Tc as z,rn as zt};