pi-straw-boss 0.53.0 → 0.55.0

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 (54) hide show
  1. package/README.md +9 -5
  2. package/README.zh-TW.md +9 -5
  3. package/dist/gui/assets/answer-Du2RpbRB.js +7 -0
  4. package/dist/gui/assets/audiobus-D2ARHGet.js +1 -0
  5. package/dist/gui/assets/chat-DSWAad0K.js +2 -0
  6. package/dist/gui/assets/drawer-c2IPPoTf.js +1 -0
  7. package/dist/gui/assets/index-Cdt9Y_2Z.js +2 -0
  8. package/dist/gui/assets/{index-BzfVoZly.css → index-JBhYPpcB.css} +1 -1
  9. package/dist/gui/assets/{lanwait-B55V6Hzg.js → lanwait-B5xr0Cu-.js} +1 -1
  10. package/dist/gui/assets/layer-D_Nd21Va.js +1 -0
  11. package/dist/gui/assets/{lightbox-BPm8Slkx.js → lightbox-DpmA8Dqw.js} +1 -1
  12. package/dist/gui/assets/{link-B4gquLop.js → link-D_FpbqGV.js} +1 -1
  13. package/dist/gui/assets/{pair-CxWg1ujM.js → pair-CiEpVf_M.js} +3 -3
  14. package/dist/gui/assets/{picker-SCgRa1U0.js → picker-BA7-qKRz.js} +1 -1
  15. package/dist/gui/assets/{post-DDdE-PdN.js → post-CmicYl-f.js} +1 -1
  16. package/dist/gui/assets/{refusal--wJ5SRx-.js → refusal-CTAnRvLI.js} +1 -1
  17. package/dist/gui/assets/rolldown-runtime-4tVxZq34.js +1 -0
  18. package/dist/gui/assets/{server-rMym1M3k.js → server-Cv41-zd2.js} +1 -1
  19. package/dist/gui/assets/sessionfacts-BrkpMsIf.js +1 -0
  20. package/dist/gui/assets/{settings-BnkVNw-O.js → settings-BuDk0PId.js} +2 -2
  21. package/dist/gui/assets/{spawn-DeiKuxWU.js → spawn-Fs38-uFE.js} +1 -1
  22. package/dist/gui/assets/termcard-VWE88hjm.js +6 -0
  23. package/dist/gui/assets/{trust-D08lfFGC.js → trust-Cbbox4A2.js} +1 -1
  24. package/dist/gui/assets/{unit_count-BYJg5DlT.js → unit_count-CWN-sdri.js} +1 -1
  25. package/dist/gui/assets/views-LUsmInsF.js +2 -0
  26. package/dist/gui/assets/zenchunk-BdRRs6h7.css +1 -0
  27. package/dist/gui/assets/zenchunk-CwupAPRd.js +2 -0
  28. package/dist/gui/assets/zenmusic-5XvJwQvP.js +1 -0
  29. package/dist/gui/index.html +2 -2
  30. package/dist/server/main.mjs +471 -297
  31. package/package.json +1 -1
  32. package/src/balance.mjs +9 -2
  33. package/src/bridge.ts +6 -6
  34. package/src/control.ts +4 -1
  35. package/src/dialogs.ts +2 -2
  36. package/src/gui.ts +18 -2
  37. package/src/keys.ts +22 -6
  38. package/src/music.ts +83 -0
  39. package/src/owners.ts +1 -1
  40. package/src/probe.ts +9 -5
  41. package/src/runs.ts +62 -0
  42. package/src/server/guihost.ts +2 -1
  43. package/src/server/towers.ts +45 -4
  44. package/dist/gui/assets/ask-h9tEvliL.js +0 -1
  45. package/dist/gui/assets/chat-Q4jCeR79.js +0 -2
  46. package/dist/gui/assets/drawer-bbm3Tpcx.js +0 -1
  47. package/dist/gui/assets/index-BE9lfp5F.js +0 -2
  48. package/dist/gui/assets/intel-DYqMQcgV.js +0 -2
  49. package/dist/gui/assets/layer-CNt6nrZr.js +0 -2
  50. package/dist/gui/assets/rolldown-runtime-DK3Fl9T5.js +0 -1
  51. package/dist/gui/assets/views-k9iUtNUb.js +0 -2
  52. package/dist/gui/assets/zenchunk-BGSj08_H.js +0 -2
  53. package/dist/gui/assets/zenchunk-h5W8yA6g.css +0 -1
  54. package/dist/gui/assets/zenwith-COGnDI7z.js +0 -7
package/README.md CHANGED
@@ -18,15 +18,19 @@ 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. A dialog with several questions shows one at a time: the one you are on is open and clear, the others fold to one faded line (the question, and your answer once it has one), and a scroll or swipe, picking an answer, Tab, or a tap on a line moves on to 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. A terminal an answer opens (robot_hand's *Put it in my prompt* or a new Herdr pane) shows inside Zen, full screen in ink, with *Back to Zen* in the top right corner; it returns by itself when the pane closes or the session starts working on your command. Set it as the default with `/boss gui view zen`, or pick it on a device's settings page. Sounds and music come later.
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. A dialog with several questions shows one at a time: the one you are on is open and clear, the others fold to one faded line (the question, and your answer once it has one), and a scroll or swipe, picking an answer, Tab, or a tap on a line moves on to the next. When nothing waits, a breathing circle and a short line on mindfulness: every visit starts there. `[` or `]` steps to a session to keep you company, its live log and its composer, and the circle sits where the list wraps round; ⌘K's *Back to the breath* returns to it. No session, a tower included, is put there for you. 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. An answer that leaves a terminal step (robot_hand's *Put it in my prompt* or a new Herdr pane) shows a small card in ink to finish it, which closes by itself when your Enter is taken or the pane closes; *Full terminal* on the card opens the whole terminal inside Zen, with *Back to Zen* in the top right corner. **Keys.** Enter or Space ends the breathing pause early (so does a tap); Esc answers or skips the card on the page, and a second Esc within 600 ms goes back to Standard (with the corner menu open, Esc only closes it; with text in a box, it only lets the box go). Inside a terminal the page does not take Esc: Shift+Esc lets the keyboard out of the terminal. **H** opens *Context* on a card, the unit's session log inside the card, read-only, and you can still answer while it is open; H or Esc closes it. `[` and `]` step the session beside you (the companion) through the sessions you can talk to. **⌘K** (Ctrl+K off a Mac) opens a command palette for the page's actions and the corner menu's choices. While nothing waits, a quiet line at the top says how many units work and how many are idle; it never counts what waits. Moving the pointer leaves faint ripples. **Sound** follows the settings page's Sound switch (off by default) and Volume: a soft singing-bowl tone when an item takes the screen, a wooden-fish knock when one is done, a lower bowl on an error; the corner menu's *Try the sounds* plays them. Set it as the default with `/boss gui view zen`, or pick it on a device's settings page. Music is yours: put audio files (mp3, m4a, ogg, wav, flac, and the like) in `~/.pi/agent/straw-boss-music/` and Zen shows a ♪ in the corner that plays them on a loop, with a ⌄ to choose the track (shown when there are two or more); with no files there is no ♪. The folder is read each time Zen shows, and tracks cross-fade into themselves so the loop has no gap. On a phone nothing plays before your first tap (♪ says *tap to play* until then, and again after the phone locks), the music pauses while the page is hidden, and the ringer switch mutes it. Motion stops under *reduce motion*, and the page follows the system's forced colours.
22
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>
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 lines of text, each with a dot, and Maybe later below"> <img src="docs/gui-zen-idle.png" width="49%" alt="The Zen view when nothing waits: a session stepped to with ], its live log and its composer"></p>
24
24
 
25
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
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>
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: a companion 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
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>
29
+ <p align="center"><img src="docs/gui-zen-history.png" width="49%" alt="The Zen view with an item's Context open: the unit's session log inside the card, above the question's choices, which stay answerable"> <img src="docs/gui-zen-palette.png" width="49%" alt="The Zen view's command palette (⌘K) open over the companion session, with the quiet strip of working and idle units above"></p>
30
+
31
+ <p align="center"><img src="docs/gui-zen-music.png" width="49%" alt="The Zen view with a music folder: the ♪ switch and the open track list in the corner"></p>
32
+
33
+ <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, the context, the command palette, the music, and the same on a phone.</sub></p>
30
34
 
31
35
  ![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)
32
36
 
@@ -46,7 +50,7 @@ Run a few agents on the same project and they start stepping on each other: two
46
50
  - **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)).
47
51
  - **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)).
48
52
  - **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)).
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 walks a question's own-words box and note and then on to the next question, 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).
53
+ - **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 walks a question's own-words box and note and then on to the next question, 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) shows a small card to finish it: the command, a pane's last rows, one line (hidden while a password is asked), and one button, with a link to the full terminal for ssh and vim. 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).
50
54
  - **Broadcast** to a tab, a workspace, every tower (a workspace without one, through its mains or members), or every session.
51
55
  - **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.
52
56
  - **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)).
package/README.zh-TW.md CHANGED
@@ -18,15 +18,19 @@
18
18
 
19
19
  <p align="center"><sub>單位的通訊畫面、可以直接在瀏覽器回答的問題、極客檢視、每個裝置自選檢視的設定頁,以及同一個頁面在手機上的樣子。</sub></p>
20
20
 
21
- **禪(Zen)** 是第三種檢視,給你在回應這張網、而不是指揮它的時候用。有東西在等你時,整個畫面只放那一件事:沒有地圖,也不顯示還排著幾件。你回答、取消或跳過(「晚點再說」)之後,會有一次呼吸般的停頓,再換下一件。一個對話框有好幾個問題時,一次只清楚地顯示一題:你正在回答的那題展開、清晰,其餘收成一行淡淡的字(題目,答了就接著你的答案),捲動或滑動、選好答案、按 Tab 或點一下那一行就移到下一題。沒有東西在等時,畫面留著你最近談過的那個 session,有它的即時紀錄和輸入框;連這樣的 session 都沒有時,就只有一個呼吸的圓圈和一句正念的話。按一次 Esc 會取消畫面上的問題,不能取消的卡片則是跳過;連按兩次 Esc(或選單最後一列)回到標準檢視。右上角的選單還有語言、檢視、音效與音量,旁邊的按鈕可以讓頁面全螢幕。回答之後需要終端機的選項(robot_hand 的「放進我的 prompt」或新的 Herdr 窗格)會在禪裡面開啟:墨色、全螢幕、右上角有「回到禪」,窗格關閉或 session 開始執行你送出的指令時會自動回到禪。用 `/boss gui view zen` 把它設成預設,或在裝置的設定頁自己選。音效和音樂之後才會加入。
21
+ **禪(Zen)** 是第三種檢視,給你在回應這張網、而不是指揮它的時候用。有東西在等你時,整個畫面只放那一件事:沒有地圖,也不顯示還排著幾件。你回答、取消或跳過(「晚點再說」)之後,會有一次呼吸般的停頓,再換下一件。一個對話框有好幾個問題時,一次只清楚地顯示一題:你正在回答的那題展開、清晰,其餘收成一行淡淡的字(題目,答了就接著你的答案),捲動或滑動、選好答案、按 Tab 或點一下那一行就移到下一題。沒有東西在等時,畫面是一個呼吸的圓圈和一句正念的話,每次進入禪都從這裡開始。用 `[` 或 `]` 可以挑一個 session 來陪,畫面會換成它的即時紀錄和輸入框;清單繞完一圈會回到呼吸圓圈,⌘K 裡的「回到呼吸」也能隨時回去。不會自動放一個 session(包括塔台)在那裡。按一次 Esc 會取消畫面上的問題,不能取消的卡片則是跳過;連按兩次 Esc(或選單最後一列)回到標準檢視。右上角的選單還有語言、檢視、音效與音量,旁邊的按鈕可以讓頁面全螢幕。回答之後留下終端機步驟的選項(robot_hand 的「放進我的 prompt」或新的 Herdr 窗格)會在禪裡面出現一張墨色的小卡片讓你完成它,你的 Enter 送出或窗格關閉時卡片自己消失;卡片上的「完整終端機」會在禪裡打開整個終端機,右上角有「回到禪」。**按鍵。** Enter 或空白鍵可以提早結束呼吸停頓(點一下畫面也行);Esc 回答或跳過畫面上的卡片,600 毫秒內再按一次 Esc 回到標準檢視(選單開著時 Esc 只關選單;輸入框裡有字時只是離開輸入框)。終端機在使用中時頁面不攔 Esc,Shift+Esc 可以讓鍵盤離開終端機。**H** 在卡片上展開「前情」,也就是這個 unit 的 session 紀錄,唯讀地顯示在卡片裡,展開時仍然可以回答;再按 H 或 Esc 收起。`[` 與 `]` 在你能對話的 session 之間切換身邊陪著的那一個。**⌘K**(不在 Mac 上是 Ctrl+K)打開指令面板,列出頁面的動作和右上角選單的選項。沒有東西在等時,頂端有一行淡淡的字說明幾個 unit 在工作、幾個閒著,不會數還在等的。滑鼠移動時會留下淡淡的漣漪。**音效**跟隨設定頁的「音效」開關(預設關)與音量:待辦出現時是一聲柔和的頌缽,完成時是一聲木魚,出錯時是低一點的缽聲;選單裡的「試聽音效」可以先聽。用 `/boss gui view zen` 把它設成預設,或在裝置的設定頁自己選。音樂由你自己放:把音檔(mp3、m4a、ogg、wav、flac 等)放進 `~/.pi/agent/straw-boss-music/`,禪的右上角就會出現 ♪,循環播放,旁邊的 ⌄ 可以選曲(有兩首以上才出現);資料夾裡沒有檔案就不會出現 ♪。每次顯示禪時都會重讀資料夾,曲子播完前會與自己交叉淡入淡出,所以循環沒有空檔。手機上要先點一下才會出聲(在那之前 ♪ 寫「點一下播放」,手機鎖屏之後也會再次這樣寫),頁面被藏起來時音樂暫停,靜音開關也會讓它靜音。「減少動態效果」開啟時畫面不動,系統的強制色彩模式也會被遵守。
22
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>
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
24
 
25
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
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>
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
28
 
29
- <p align="center"><sub>禪:一次一件待辦、沒東西等時陪著的 session、沒有 session 時的呼吸圓圈、右上角選單,以及同樣的畫面在手機上的樣子。</sub></p>
29
+ <p align="center"><img src="docs/gui-zen-history.png" width="49%" alt="打開「前情」的禪檢視:卡片裡是這個 unit 的 session 紀錄,問題的選項仍然可以回答"> <img src="docs/gui-zen-palette.png" width="49%" alt="在陪伴的 session 上打開指令面板(⌘K)的禪檢視,頂端有工作中與閒著的 unit 數的淡淡一行"></p>
30
+
31
+ <p align="center"><img src="docs/gui-zen-music.png" width="49%" alt="有音樂資料夾時的禪檢視:右上角的 ♪ 開關與打開的曲目清單"></p>
32
+
33
+ <p align="center"><sub>禪:一次一件待辦、沒東西等時陪著的 session、沒有 session 時的呼吸圓圈、右上角選單、前情、指令面板、音樂,以及同樣的畫面在手機上的樣子。</sub></p>
30
34
 
31
35
  ![裝了 pi-straw-boss 的 Herdr:側邊欄的網路檢視列出每個工作區、塔台、主智慧體和子智慧體,旁邊是一個正在工作的主智慧體](docs/herdr-window.png)
32
36
 
@@ -46,7 +50,7 @@
46
50
  - **工作看板。** 主智慧體的看板由它的待辦清單和名稱自動填入(`board_set` 可覆寫);塔台讀每個主智慧體的項目(`board_read`),本機的,加上 Straw Link 團隊中隊友電腦上的,這樣塔台分派工作時知道各主智慧體做到哪([細節](docs/how-it-works.md#the-work-board))。
47
51
  - **塔台會關掉自己開的主智慧體。** 塔台替請求開出的主智慧體做完後,向發話者和那座塔台各回報一次;塔台確認裡面沒有東西在跑,就用 `boss_close_main` 把它關掉([細節](docs/how-it-works.md#closing-an-opened-main),英文)。
48
52
  - **給塔台的摘要**:自塔台上一輪以來,工作區裡有誰加入、啟動了哪些子智慧體、誰改了名字;塔台下一輪會讀進來一次,讀完就清掉([細節](docs/how-it-works.md#the-towers-digest))。
49
- - **瀏覽器畫面** `/boss gui` 看得到整張網:每個工作區是一座基地,裡面有塔台、智慧體和子智慧體,畫面會動,但只能看。點基地可以放大,點單位可以把它的對話當成即時通訊紀錄來讀;在等你回覆的單位會排成警示,按空白鍵開下一則,按 F 放大最上面的對話框,按 Esc 關掉它(打字時都不會觸發);回答問題也可以只用鍵盤:方向鍵選項目,Tab 依序走過每一題自己的答案框和備註、再換到下一題,Enter 確認並跳到下一題。頂端齒輪「設定」裡有兩個開關:單位在等你、出錯或完成時,一個會跳系統通知,一個會播音效;已完成的單位另外排在自己的清單裡,可以一個一個清,也可以一次全清;地圖上已結束的子智慧體也可以一個一個移除,或用位置列旁的「移除已完成」一次全移除。單位的通訊畫面也會列出它在背景跑的 Monitor,出錯或太久沒輸出的 Monitor 會列進標頭的「通知」(只有在等你回答的單位才會跳出醒目的警示,出錯和完成都只是安靜的通知);自己閒置、但它的子智慧體在工作或等待,或它的 Monitor 還在跑的單位,會顯示成帶光暈的「指揮中」;只在等 Monitor 跑完的單位,備註會用紅字顯示「監看中」。在桌面上點進單位的終端機,就能直接用鍵盤操作它。如果一個答案的下一步要在終端機進行(robot_hand 的「放進提示列」和開新 pane 的選項),畫面會直接替你打開那個終端機。畫面有英文和正體中文,預設跟隨瀏覽器語言,也可以從頂端「設定」裡的語言選單切換。地圖最後一張「+新基地」會在選定的資料夾開一座基地,裡面先有一位成員、沒有塔台。沒有塔台的基地只能加成員(基地上的「+成員」開在新分頁,小隊上的開在該小隊旁),等成員自己升格時才會開塔台;有塔台的基地只能加主智慧體(「+主智慧體」,各開在自己的分頁)。在 session 的輸入框貼上、拖進或用「+」選的檔案(最多 20 MB)會存到私有的暫存資料夾,路徑放進訊息。開啟表單都可以先填第一句指令;資料夾選擇只能在家目錄以下,也不會列出點開頭的資料夾。
53
+ - **瀏覽器畫面** `/boss gui` 看得到整張網:每個工作區是一座基地,裡面有塔台、智慧體和子智慧體,畫面會動,但只能看。點基地可以放大,點單位可以把它的對話當成即時通訊紀錄來讀;在等你回覆的單位會排成警示,按空白鍵開下一則,按 F 放大最上面的對話框,按 Esc 關掉它(打字時都不會觸發);回答問題也可以只用鍵盤:方向鍵選項目,Tab 依序走過每一題自己的答案框和備註、再換到下一題,Enter 確認並跳到下一題。頂端齒輪「設定」裡有兩個開關:單位在等你、出錯或完成時,一個會跳系統通知,一個會播音效;已完成的單位另外排在自己的清單裡,可以一個一個清,也可以一次全清;地圖上已結束的子智慧體也可以一個一個移除,或用位置列旁的「移除已完成」一次全移除。單位的通訊畫面也會列出它在背景跑的 Monitor,出錯或太久沒輸出的 Monitor 會列進標頭的「通知」(只有在等你回答的單位才會跳出醒目的警示,出錯和完成都只是安靜的通知);自己閒置、但它的子智慧體在工作或等待,或它的 Monitor 還在跑的單位,會顯示成帶光暈的「指揮中」;只在等 Monitor 跑完的單位,備註會用紅字顯示「監看中」。在桌面上點進單位的終端機,就能直接用鍵盤操作它。如果一個答案的下一步要在終端機進行(robot_hand 的「放進提示列」和開新 pane 的選項),畫面會出現一張小卡片讓你完成它:指令、窗格最後幾行、一行輸入(要輸入密碼時會自動遮住)和一個按鈕,另有連到完整終端機的連結,給 ssh 和 vim 這類程式用。畫面有英文和正體中文,預設跟隨瀏覽器語言,也可以從頂端「設定」裡的語言選單切換。地圖最後一張「+新基地」會在選定的資料夾開一座基地,裡面先有一位成員、沒有塔台。沒有塔台的基地只能加成員(基地上的「+成員」開在新分頁,小隊上的開在該小隊旁),等成員自己升格時才會開塔台;有塔台的基地只能加主智慧體(「+主智慧體」,各開在自己的分頁)。在 session 的輸入框貼上、拖進或用「+」選的檔案(最多 20 MB)會存到私有的暫存資料夾,路徑放進訊息。開啟表單都可以先填第一句指令;資料夾選擇只能在家目錄以下,也不會列出點開頭的資料夾。
50
54
  - **廣播**給一個分頁、一個工作區、所有塔台(沒有塔台的工作區改送主智慧體或成員),或所有 session。
51
55
  - **分頁保持整齊。** pi 在分頁裡啟動或結束時,分頁裡的 pane 會重新平均分配,一個一個切出來的 worker 就不會留下一長串對半切的窄 pane。
52
56
  - **斷線的子智慧體會被提醒回報。** 子智慧體做完後還開著,但開出它的 pi 已經重開、收不到它的結果時,它會收到一則 intercom,請它把最終報告送回去,只會送一次([運作方式](docs/how-it-works.md#orphaned-subagents))。
@@ -0,0 +1,7 @@
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{n as o}from"./post-CmicYl-f.js";import{It as s,Vt as c,gt as l,j as u,t as d}from"./index-Cdt9Y_2Z.js";var f=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在終端機中回答。`:`Answer it in the terminal.`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在終端機中回答。`:`Answer them in the terminal.`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`下方還有 ▾`:`More below ▾`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`也可以自己輸入答案。`:`It also takes your own words.`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`可以複選。`:`It takes several choices.`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`已取消。`:`Cancelled.`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`選擇`:`Choices`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`瀏覽器拒絕存取剪貼簿。`:`The browser refused the clipboard.`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`已複製到這台裝置的剪貼簿。`:`Copied to this device's clipboard.`),ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`複製指令`:`Copy command`),te=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個選項有預覽;請在終端機中查看。`:`It has a preview; see it in the terminal.`),ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註`:`Note`),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註(選填)`:`Note (optional)`),x=e=>`Opened while ${e?.tool} was running; it may not be about that call.`,S=e=>`在 ${e?.tool} 執行時開啟,不一定與該呼叫有關。`,C=((t,n={})=>(n.locale??e())===`zh-TW`?S(t):x(t)),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`選項`:`Options`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`另一個答案沒有被採用;這個可以送出。`:`The other answer was not taken; this one can go.`),ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`你的答案`:`Your own answer`),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`或自己輸入答案`:`Or type your own answer`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`問題已變更,請重新閱讀。`:`The question changed; read it again.`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 讀不懂這個答案。`:`The session could not read that answer.`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個答案不符合問題。`:`That answer does not fit the question.`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 拒絕了這個答案。`:`The session refused that answer.`),oe=((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.`),se=((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.`),ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`送出答案`:`Send answer`),le=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示終端機`:`Show terminal`),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中關閉。`:`It was dismissed in the terminal.`),j=((t={},n={})=>(n.locale??e())===`zh-TW`?`它已不再開啟。`:`It is no longer open.`),M=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中回答。`:`It was already answered in the terminal.`),N=((t={},n={})=>(n.locale??e())===`zh-TW`?`這些訊息在 sb server 的佇列裡,等塔台下一個 run 取走;run 啟動時就會被取走。`:`These messages wait in the sb server's queue for the tower's next run; they are taken when it runs.`),P=((t={},n={})=>(n.locale??e())===`zh-TW`?`塔台正在待命:沒有進行中的 run,所以沒有終端機。請在輸入框寫給它,那會喚醒它。`:`The tower is standing by: no run is live, so there is no terminal. Write to it in the composer; that wakes it.`),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`塔台因反覆當機而暫停,沒有終端機。請重試,或在「通訊」裡寫給它。`:`The tower is held after repeated crashes, so it has no terminal. Retry it, or write to it in Comms.`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`塔台正在待命,沒有終端機。run 被喚醒時才會開一個;請在「通訊」裡寫給它來喚醒。`:`The tower is standing by, so it has no terminal. A run opens one when it wakes; write to it in Comms to wake it.`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框。`:`It waits on a dialog.`),R=`[the boss writes to you from the GUI or /boss tower; this is an instruction]`,z=`[possibly handled by a run that crashed: check before acting]`;function B(e){let t=(e??``).split(`
2
+ `,1)[0];if(t.startsWith(`[intercom from `)&&t.endsWith(`]`))return{kind:`intercom`,from:t.slice(15,-1)};if(t===`[notice from the sb server]`)return{kind:`server`};if(t===`[your wakeAfter follow-up is due]`)return{kind:`timer`}}function V(e){let t=(e??``).split(`
3
+ `);if(t[0]!==`[the boss writes to you from the GUI or /boss tower; this is an instruction]`)return;let n=t[1]===z;return{body:t.slice(n?2:1).join(`
4
+ `),crashed:n}}function H(e){let t=(e??``).trim(),n=/^(.*?)\s*\(([^()]*)\)$/.exec(t);return n?{name:n[1],...n[2]?{id:n[2]}:{}}:{name:t}}function U(e){let t=e??``;if(!t.startsWith(`[straw net `))return;let n={},r=11;for(;;){for(;t[r]===` `;)r++;if(t[r]===`]`)break;let e=t.indexOf(`=`,r);if(e<0||!/^[a-z]+$/.test(t.slice(r,e)))return;let i=t.slice(r,e),a;if(t[e+1]===`"`){if(a=t.indexOf(`"`,e+2),a<0)return;n[i]=t.slice(e+2,a++)}else{for(a=e+1;a<t.length&&t[a]!==` `&&t[a]!==`]`;)a++;n[i]=t.slice(e+1,a)}r=a}return{fields:n,raw:t.slice(0,r+1),body:t.slice(r+1).replace(/^ /,``)}}var W={intercom:e=>e.startsWith(`[intercom from `)&&e.endsWith(`]`),notice:e=>e===`[notice from the sb server]`,timer:e=>e===`[your wakeAfter follow-up is due]`};function ue(e){let t=e.text??``,n=e=>{let n=t.split(`
5
+ `),r=+!!e(n[0]??``),i=r===1&&n[1]===`[possibly handled by a run that crashed: check before acting]`;return{body:n.slice(r+ +!!i).join(`
6
+ `),crashed:i}};if(e.type===`straw-link`||e.event===`link`){let n=U(t),r=n?.fields.kind,i=e.from??n?.fields.remote??n?.fields.from??`?`;return{kind:`link`,what:r===`link_reply`?`reply`:r===`tower_reply`?`answer`:n?.fields.asks?`ask`:`message`,from:i,body:n?n.body:t,...n?{raw:n.raw}:{}}}if(e.type===`straw-tower`)switch(e.event){case`boss`:return{kind:`boss`,...n(e=>e===R)};case`intercom`:{let r=t.split(`
7
+ `,1)[0];return{kind:`intercom`,from:W.intercom(r)?r.slice(15,-1):e.from??``,...n(W.intercom)}}case`notice`:return{kind:`server`,...n(W.notice)};case`steer`:return{kind:`server`,body:t.replace(/^\[sb server\] /,``),crashed:!1};case`timer`:return{kind:`timer`,...n(W.timer)}}}function de(e,t){if(!(e.status<400))return e.body.error===`standing`?P({},t):e.body.error===`server_queue`?N({},t):u(e,t)}function fe(e,t){if(e&&!e.run)return e.state===`held`?F({},t):I({},t)}var pe={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};function me(e,t,n,r,i){let{q:a}=n,o=r[a],s=pe[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`){let e=r[a-1],i=n.part===`opt`?o.own||o.note:n.part===`own`&&o.note;return t?n.part===`opt`&&e?{to:{q:a-1,part:e.note?`note`:e.own?`own`:`opt`}}:void 0:i||a===r.length-1?void 0:{to:{q:a+1,part:`opt`}}}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 G(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`,i=>{let o=a(i.target);if(!o||i.ctrlKey||i.altKey||i.metaKey||i.isComposing)return;let c=i.target;if(o.part!==`opt`&&(i.key===`ArrowUp`?c.selectionStart!==0:i.key===`ArrowDown`&&c.selectionEnd!==c.value.length))return;let l=me(i.key,i.shiftKey,o,t.map(e=>({options:e.opts.length,multiple:e.multiple,own:!!e.own,note:!!e.note})),t.map(e=>e.answered()));if(!l||(i.preventDefault(),i.repeat&&[`Enter`,` `].includes(i.key)))return;if(s=i.key===` `,l.pick!==void 0){let e=t[o.q].opts[l.pick];e.getAttribute(`aria-checked`)!==`true`&&e.click()}let u=l.to===`send`?void 0:t[l.to.q],d=l.to===`send`?n():l.to.part===`opt`?u.opts[l.to.o??r(u)]:l.to.part===`own`?u.own:u.note;d&&!d.disabled&&(e.dispatchEvent(new CustomEvent(`ask-reveal`,{detail:d})),d.focus())}),e.addEventListener(`keyup`,e=>s&&e.key===` `&&(s=!1,e.preventDefault())),()=>t[0]?.opts[r(t[0])]}var K=e=>e.multiple?g():e.freeform&&e.options.length?h():``,q=90,he=(e,t)=>c(`div`,{class:`ask-one`},e.header&&c(`b`,{class:`ask-head`},e.header),c(`p`,{class:`ask-q`,...e.question.length>q?{"data-long":``}:{}},e.question),e.context&&c(`div`,{class:`ask-ctx`},e.context),e.options.length>0&&c(`ol`,{class:`ask-opts`,"aria-label":w()},...e.options.map(e=>c(`li`,{class:`ask-opt`},c(`b`,null,e.title),e.description&&c(`small`,null,e.description)))),t&&K(e)&&c(`small`,{class:`ask-how`},K(e))),J=e=>e.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\p{Cf}]/gu,`�`),Y=e=>(e.select?.choices??[]).map((e,t)=>({...e,i:t})),ge=(e,t,n)=>({...e.size?{choices:[...e].sort((e,t)=>e-t)}:{},...t.trim()?{text:t}:{},...n.trim()?{note:n}:{}}),_e=(e,t,n)=>({dialog:e.dialog,digest:e.digest,answerId:n,...t}),ve=(e,t)=>({dialog:e.dialog,digest:e.digest,answerId:t,cancel:!0}),ye=(e,t)=>e.cancel===!0&&!(t&&e.select?.choices.every(e=>e.hereOnly)),X={digest:E,"not-allowed":O,malformed:D};function be(e,i=!1){let{outcome:a,reason:o,by:s}=e.body;return a===`accepted`?[`ok`,i?_():n()]:a===`stale`?[`error`,s===`local`?M():s===`cancel`?A():j()]:a===`rejected`?[`error`,(Object.hasOwn(X,String(o))?X[String(o)]:k)()]:a===`busy`?[`error`,t()]:a===`unknown`||e.status===504?[`error`,r(),!0]:[`error`,o??l({status:e.status})]}var xe=e=>[`accepted`,`stale`,`busy`,`unknown`].includes(String(e.body.outcome))||e.status===504,Z=e=>e.answer?`d\n${e.answer.dialog}\n${e.answer.digest}`:`c\n${e.callId}\n${e.why??``}`;function Se(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=m()};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 Q(e,t,n=location.hostname!==`127.0.0.1`,o,l,u=le){let m,h,g,_=!1,x=!1,S;for(let e of[`focusin`,`pointerdown`])document.addEventListener(e,e=>h&&!h.el.contains(e.target)&&(h.lost=void 0));let E=(e,t,n,...r)=>(e.dataset.tone=t,e.replaceChildren(n,...r)),D=()=>{if(!h)return;let e=document.activeElement;e&&e!==document.body&&e!==h.lost&&(h.lost=void 0),h.controls.forEach(e=>e.disabled=!_||x||h.done),h.send&&(h.send.disabled=!_||x||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 O(e,n){[e.sending,x,e.spell]=[!0,!0,!1],D(),E(e.note,``,a());let s=await t(`answer`,n).catch(()=>void 0),u=c(`button`,{type:`button`,class:`cmp-link`},i());u.onclick=()=>void O(e,n);let[f,p,m]=s?be(s,n.cancel===!0):[`error`,r(),!0];[e.done,e.sending,x,e.busy]=[!s||xe(s),!1,!1,s?.body.outcome===`busy`],E(e.note,f,p,...m?[u]:[]);let h=s?.body.outcome===`accepted`?s.body.then:void 0,g=h&&d(h,{key:o?.key??``,command:e.copy,answerId:String(n.answerId??``)});g&&E(e.note,f,`${p} ${g}`),D(),e.note.scrollIntoView?.({block:`nearest`}),l&&s?.body.outcome===`accepted`&&setTimeout(()=>l(!!h&&!g),h&&!g?0:1200)}let k=(e,t,n,r,i)=>{let a=c(`button`,{type:`button`,class:`ask-opt`,role:e,"aria-checked":`false`},c(`b`,i?{"data-n":String(i)}:null,t),...n.filter(Boolean).map(e=>c(`small`,null,e)));return a.onclick=r,a};function A(e,t){let r,i=Y(t).map(e=>k(`radio`,J(e.label),[e.note&&J(e.note)],()=>(r=e.i,i.forEach((n,r)=>n.setAttribute(`aria-checked`,String(Y(t)[r].i===e.i))),D()),e.i+1)),a=t.select?.copy!==void 0&&c(`button`,{type:`button`,class:`cmp-link`},ee());a&&(a.disabled=!navigator.clipboard,a.onclick=()=>void navigator.clipboard.writeText(t.select.copy).then(()=>E(e.note,`ok`,b()),()=>E(e.note,`error`,y())));let o=i.filter((e,r)=>!(n&&Y(t)[r].hereOnly));return i.forEach(e=>!o.includes(e)&&(e.disabled=!0)),e.pick=()=>r===void 0?void 0:{choice:r},e.first=G(e.el,[{opts:i,multiple:!1,answered:()=>r!==void 0}],()=>e.send),e.controls=o,[c(`pre`,{class:`ask-title`},J(t.select.title)),c(`div`,{class:`ask-opts`,role:`radiogroup`,"aria-label":v()},...i),c(`div`,{class:`ask-acts`},e.send,e.cancel,a)]}function j(e,t){let n=t.questions.map(()=>({picks:new Set,text:c(`textarea`,{rows:`1`,maxlength:`8192`,class:`ask-own`,placeholder:ae(),"aria-label":ie()}),note:c(`input`,{type:`text`,maxlength:`2048`,class:`ask-own ask-memo`,placeholder:re(),"aria-label":ne()})})),r=[],i=t.questions.map((t,i)=>{let a=n[i],o=t.multiple?`checkbox`:`radio`,s=t.options.map((e,n)=>k(o,e.title,[e.description,e.preview&&te()],()=>{t.multiple||(a.picks.clear(),a.text.value=``),a.picks.has(n)?a.picks.delete(n):a.picks.add(n),s.forEach((e,t)=>e.setAttribute(`aria-checked`,String(a.picks.has(t)))),D()}));return a.text.oninput=()=>(t.multiple||(a.picks.clear(),s.forEach(e=>e.setAttribute(`aria-checked`,`false`))),D()),e.controls.push(...s,a.text,a.note),r.push({opts:s,multiple:!!t.multiple,own:a.text,note:a.note,answered:()=>a.picks.size>0||a.text.value.trim()!==``}),c(`div`,{class:`ask-one`},t.header&&c(`b`,{class:`ask-head`},t.header),c(`p`,{class:`ask-q`,...t.question.length>q?{"data-long":``}:{}},t.question),c(`div`,{class:`ask-opts`,role:t.multiple?`group`:`radiogroup`,"aria-label":w()},...s),a.text,a.note)});return e.pick=()=>n.every(e=>e.picks.size||e.text.value.trim())?{answers:n.map(e=>ge(e.picks,e.text.value,e.note.value))}:void 0,e.first=G(e.el,r,()=>e.send),[...i,c(`div`,{class:`ask-acts`},e.send,e.cancel)]}function M(e){let t=e.asks??(e.ask?[e.ask]:[]),r=t.length>1,i=e.answer,a={copy:i?.select?.copy,key:Z(e),el:c(`section`,{class:`ask`}),note:c(`p`,{class:`ask-note`,role:`status`,"aria-live":`polite`}),controls:[],pick:()=>void 0,done:!1,sending:!1};i&&((a.send=c(`button`,{type:`button`,class:`ask-send`},ce())).onclick=()=>void(a.pick()&&O(a,_e(i,a.pick(),crypto.randomUUID()))));let l=e.tool===`secret_drop`;i&&!l&&ye(i,n)&&((a.cancel=c(`button`,{type:`button`,class:`ask-cancel`},s())).onclick=()=>void O(a,ve(i,crypto.randomUUID())));let d=c(`p`,{class:`ask-term`},e.why&&t.length?e.why:`${r?p():f()} ${r||!t[0]?``:K(t[0])}`.trim()),m=o&&e.tool!==`secret_drop`&&c(`button`,{type:`button`,class:`cmp-link`},u());m&&(m.onclick=o.show);let h=e.answer?.twin&&e.tool&&e.tool!==`dialog`?[c(`p`,{class:`ask-why`},C({tool:e.tool}))]:[];return a.el.append(...h,...i&&!l?i.select?A(a,i):j(a,i):[...t.length?t.map(e=>he(e,r)):[c(`p`,{class:`ask-why`},l?n?oe():se():e.why??L())],c(`div`,{class:`ask-acts`},l?c(`p`,{class:`ask-term`},f()):d,m)],a.note),a.cancel&&a.controls.push(a.cancel),a}let N=(t,n)=>{let r=document.activeElement;h&&h!==n&&(h.focus=h.el.contains(r)?r:void 0),[m,h,g]=[t,n,n?.send?n:g],e.replaceChildren(...n?[n.el]:[]),n&&Se(n.el),D(),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:()=>x,update(e,t){_=t,e&&(S=void clearTimeout(S)),!e&&(h?.done||h?.sending)?S??=setTimeout(()=>(S=void 0,N()),6e3):e?h&&(Z(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],E(h.note,``,T())),m=e):N(e,g?.key===Z(e)&&!g.done?g:M(e)):N(),D()}}}var Ce=(e,t)=>t?.(e)??((t,n)=>o(e.startsWith(`grant:`)?`panes/${encodeURIComponent(e.slice(6))}/${t}`:`sessions/${encodeURIComponent(e)}/${t}`,n)),$=e=>e??(e=>o(`trust/answer`,e)),we=(e,...t)=>e===`waiting`&&t.every(Boolean),Te=e=>e.body.outcome===`accepted`?`accepted`:e.body.outcome===`unknown`||e.status===504?`unknown`:`refused`,Ee=(e,{key:t,show:n,post:r,remote:i,accepted:a,label:o})=>Q(e,r,i,{key:t,show:n},a,o);export{$ as a,ue as c,fe as d,de as f,Te as i,B as l,we as n,Q as o,Ee as r,V as s,Ce as t,H as u};
@@ -0,0 +1 @@
1
+ var e=new WeakMap;function t(t,n){let{c:r,g:i}=t.out(),a=e.get(t)??r.createGain();return e.has(t)||(a.gain.value=.5,a.connect(n??i),e.set(t,a)),a}export{t as musicBus};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-JBhYPpcB.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"./answer-Du2RpbRB.js";import{n as a,t as o}from"./markdown-DvbY97ID.js";import{M as s,O as c,Ut as l,Vt as u,h as d,o as f,y as p}from"./index-Cdt9Y_2Z.js";var ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`可能已被當機的 run 處理過:動手前先確認。`:`A run that crashed may already have handled this: check before acting.`),te=((t={},n={})=>(n.locale??e())===`zh-TW`?`分支摘要`:`branch summary`),ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`通訊紀錄`:`Comms log`),m=e=>`context compacted · ${e?.tokens} tokens summarized`,h=e=>`上下文已壓縮 · 摘要了 ${e?.tokens} tokens`,re=((t,n={})=>(n.locale??e())===`zh-TW`?h(t):m(t)),ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`…(於 1 MB 截斷)`:`… (cut at 1 MB)`),g=e=>`exit ${e?.code}`,_=e=>`結束碼 ${e?.code}`,ae=((t,n={})=>(n.locale??e())===`zh-TW`?_(t):g(t)),v=e=>`Image ${e?.n}`,y=e=>`圖片 ${e?.n}`,oe=((t,n={})=>(n.locale??e())===`zh-TW`?y(t):v(t)),se=((t={},n={})=>(n.locale??e())===`zh-TW`?`圖片無法讀取`:`Image unavailable`),b=e=>`${e?.count} image(s)`,x=e=>`${e?.count} 張圖片`,ce=((t,n={})=>(n.locale??e())===`zh-TW`?x(t):b(t)),le=((t={},n={})=>(n.locale??e())===`zh-TW`?`收到`:`incoming`),S=((t={},n={})=>(n.locale??e())===`zh-TW`?`跳到最新`:`jump to latest`),C=e=>`${e?.count} new`,w=e=>`${e?.count} 則新訊息`,T=((t,n={})=>(n.locale??e())===`zh-TW`?w(t):C(t)),ue=((t={},n={})=>(n.locale??e())===`zh-TW`?`還沒有通訊。`:`No transmissions yet.`),de=((t={},n={})=>(n.locale??e())===`zh-TW`?`通知`:`notice`),fe=((t={},n={})=>(n.locale??e())===`zh-TW`?`細節`:`details`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`表單回覆`:`form answers`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`訊息,來自`:`message from`),O=e=>`answer from ${e?.from}`,k=e=>`${e?.from} 的回答`,pe=((t,n={})=>(n.locale??e())===`zh-TW`?k(t):O(t)),A=e=>`request from ${e?.from}`,j=e=>`${e?.from} 的請求`,me=((t,n={})=>(n.locale??e())===`zh-TW`?j(t):A(t)),M=e=>`message from ${e?.from}`,N=e=>`${e?.from} 的訊息`,he=((t,n={})=>(n.locale??e())===`zh-TW`?N(t):M(t)),P=e=>`reply to your ask from ${e?.from}`,F=e=>`${e?.from} 回覆了你的詢問`,ge=((t,n={})=>(n.locale??e())===`zh-TW`?F(t):P(t)),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`記憶`:`memory`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`監看`:`monitor`),_e=((t={},n={})=>(n.locale??e())===`zh-TW`?`本機`:`this computer`),ve=((t={},n={})=>(n.locale??e())===`zh-TW`?`隊友`:`teammate`),R=((t={},n={})=>(n.locale??e())===`zh-TW`?`提問,來自`:`question from`),ye=((t={},n={})=>(n.locale??e())===`zh-TW`?`回報,來自`:`report from`),be=((t={},n={})=>(n.locale??e())===`zh-TW`?`sb server 的通知`:`notice from the sb server`),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`狀態:`:`status of`),B=((t={},n={})=>(n.locale??e())===`zh-TW`?`Straw Link 訊息`:`Straw Link message`),xe=((t={},n={})=>(n.locale??e())===`zh-TW`?`喚醒鬧鐘`:`wake-up call`),V=((t={},n={})=>(n.locale??e())===`zh-TW`?`塔台事件`:`tower event`),Se=((t={},n={})=>(n.locale??e())===`zh-TW`?`在旁開啟`:`open beside`),Ce=e=>`Open image ${e?.n}`,H=e=>`打開圖片 ${e?.n}`,we=((t,n={})=>(n.locale??e())===`zh-TW`?H(t):Ce(t)),U=e=>`show all (${e?.size})`,W=e=>`顯示全部(${e?.size})`,Te=((t,n={})=>(n.locale??e())===`zh-TW`?W(t):U(t)),Ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示全部參數`:`show all arguments`),G=e=>`◇ thought · ${e?.count} chars`,De=e=>`◇ 思考 · ${e?.count} 字元`,Oe=((t,n={})=>(n.locale??e())===`zh-TW`?De(t):G(t)),ke=((t={},n={})=>(n.locale??e())===`zh-TW`?`◇ 思考 · 已遮蔽`:`◇ thought · redacted`),Ae=((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.`),je=((t={},n={})=>(n.locale??e())===`zh-TW`?`無法取得`:`unavailable`),Me=((t={},n={})=>(n.locale??e())===`zh-TW`?`你`:`you`);function Ne(){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?T({count:t}):S()}}async function Pe(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 Fe(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 Ie=e=>p(e.role),Le=e=>e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1}):``,Re=e=>e>=1024?`${(e/1024).toFixed(e>=10240?0:1)} KB`:`${e} B`,ze={intercom_message:D,subagent_result:ye,subagent_ping:R,subagent_status:z,"pi-loop-monitor":L,"memory-context":I,"doc-review":E,"straw-tower":V,"straw-link":B},K=e=>{let t=d(`<span class="ava"><svg><use/></svg></span>`);return t.querySelector(`use`).setAttribute(`href`,`#i-${f[e]??e}`),t};function Be(e){let t=[],n=0;for(let r of e.matchAll(/https?:\/\/[^\s<>)\]]+/g))t.push(e.slice(n,r.index),u(`a`,{href:r[0],rel:`noopener noreferrer`,target:`_blank`},r[0])),n=r.index+r[0].length;return[...t,e.slice(n)]}function q(e,d,{who:f,link:p,docFor:m}){let h=Fe(),g=new Map,_=new Set,v=()=>_.forEach(e=>e.button.isConnected?(e.shown=!0,e.button.hidden=!e.paths.some(e=>m?.(e))):e.shown&&_.delete(e)),y=u(`div`,{class:`chat-list`}),b=u(`div`,{class:`chat-top`}),x=u(`div`,{class:`chat-live`}),S=u(`div`,{class:`chat-end`}),C=u(`button`,{class:`chat-pill`,type:`button`,hidden:``}),w=u(`p`,{class:`chat-empty`},ue()),T=u(`div`,{class:`chat-scroll`,tabindex:`-1`,"aria-label":ne()},b,y,x,S);e.replaceChildren(T,C);let E=Ne(),O=!1,k=!1,A,j,M=0,N=!1,P,F=()=>N||P!==void 0,I=()=>(clearTimeout(P),P=setTimeout(()=>(P=void 0,E.pinned&&!h.detached&&R()),250)),L=(e=E.button(h.detached))=>(C.hidden=!e,C.textContent=e??``),R=()=>(E.jump(),j=void 0,T.scrollTop=T.scrollHeight,L());async function ye(e){O=!0;let t=await Pe(h,d,e,e=>(J(e),Z(e))).finally(()=>O=!1),n=g.get(e);if(A===e){if(!t||!n)return R();E.hold(),j=n,n.scrollIntoView({block:`center`}),l(n,`lit`),clearTimeout(M),M=window.setTimeout(()=>(j=void 0,n.classList.remove(`lit`)),2e3),L()}}let z=()=>A?void ye(A):R(),B=(e,t,n,r)=>{e.disabled=!0,d.entry(n).then(n=>{let i=n&&r(n);if(i===void 0)return void(e.textContent=je());t.textContent=i,e.remove()},()=>e.textContent=je())};function V(e,t=0){if(!t||!d.pic)return null;let n=Array.from({length:t},(t,n)=>d.pic(e,n));return u(`div`,{class:`pics`},...n.map((e,t)=>{let r=u(`img`,{src:e,alt:oe({n:t+1}),loading:`lazy`,decoding:`async`}),i=u(`button`,{type:`button`,class:`pic`,"aria-label":we({n:t+1})},r);return r.addEventListener(`error`,()=>i.replaceWith(u(`em`,{class:`pic-gone`},se()))),i.addEventListener(`click`,()=>void c(async()=>{let{lightbox:e}=await import(`./lightbox-DpmA8Dqw.js`);return{lightbox:e}},__vite__mapDeps([0]),import.meta.url).then(({lightbox:e})=>e(n,t))),i}))}function Ce(e,t){let n=h.result(e.id),r=u(`pre`,{class:`out`},n?.text??``),i=u(`pre`,{class:`args`},e.args??``),a=e.cut?u(`button`,{class:`more`,type:`button`},Ee()):null;a?.addEventListener(`click`,()=>B(a,i,t,t=>(e=>e&&`${e.args??``}${e.cut?`\n${ie()}`:``}`)(t.tools?.find(t=>t.id===e.id))));let o=n?.more?u(`button`,{class:`more`,type:`button`},Te({size:Re(n.bytes??0)})):null;o?.addEventListener(`click`,()=>B(o,r,n.id,e=>e.text));let s=e.name===`show_doc`&&m?u(`button`,{class:`more open`,type:`button`,hidden:``},Se()):null;s?.addEventListener(`click`,t=>(t.preventDefault(),e.summary.split(`, `).forEach(e=>m?.(e)?.()))),s&&_.add({paths:e.summary.split(`, `),button:s}),s&&queueMicrotask(v);let c=u(`details`,{class:`act`},u(`summary`,{"data-mark":n?n.isError?`error`:`done`:`working`},u(`b`,{class:`badge`}),u(`code`,null,e.name),u(`span`,{class:`sum`},e.summary),s),i,a,n&&u(`div`,{class:`result`},n.images?u(`em`,null,ce({count:n.images})):null,r,o)),l=n&&V(n.id,n.images);return l?[c,l]:[c]}let H=e=>u(`time`,null,Le(e.at)),U=(e,t,n,r)=>u(`article`,{class:`tx you`},u(`header`,null,H(e),u(`b`,null,Me()),K(`user`)),u(`div`,{class:`bubble`,title:r},n?u(`small`,{class:`boss-flag`},ee()):null,...Be(t),V(e.id,e.images))),W=(e,t,n,r={})=>u(`article`,{class:`tx sys`},u(`details`,{class:`notice`},u(`summary`,null,K(`comms`),u(`em`,null,le()),...t,H(e)),r.crashed?u(`small`,{class:`boss-flag`},ee()):null,u(`pre`,null,n),r.raw?u(`details`,{class:`notice-raw`},u(`summary`,null,fe()),u(`pre`,{class:`raw`},r.raw)):null)),G=e=>{let t=i(e);return[D(),` `,t.name&&p(t.name)||t.name,t.id?` (${t.id})`:``,` · `,_e()]},De=e=>e.kind===`link`?[{ask:me,reply:ge,answer:pe,message:he}[e.what]({from:e.from}),` · `,ve()]:e.kind===`intercom`?G(e.from):[e.kind===`server`?be():xe()];function q(e){switch(e.kind){case`user`:{let t=f().service?n(e.text):void 0;if(t)return W(e,t.kind===`intercom`?G(t.from):[t.kind===`server`?be():xe()],e.text??``);let i=f().service?r(e.text):void 0;return U(e,i?i.body:e.text??``,i?.crashed,i?e.text??``:``)}case`assistant`:{let t=f(),n=u(`pre`,{class:`thought-text`}),r=e.thought?u(`button`,{class:`thought`,type:`button`},e.thought<0?ke():Oe({count:e.thought.toLocaleString()})):null;return e.thought&&e.thought>0&&r?.addEventListener(`click`,()=>B(r,n,e.id,e=>e.thoughtText)),u(`article`,{class:`tx in`},K(t.role),u(`div`,{class:`tx-body`},u(`header`,null,u(`b`,null,Ie(t)),e.model?u(`span`,null,e.model):null,H(e),e.stop?u(`span`,{class:`stop`,"data-mark":`error`},e.stop):null),r,n,e.text?u(`div`,{class:`md`},o(a(e.text))):null,e.error?u(`p`,{class:`fault`},e.error):null,...(e.tools??[]).flatMap(t=>Ce(t,e.id))))}case`bash`:return u(`article`,{class:`tx sys`},u(`details`,{class:`act`},u(`summary`,{"data-mark":e.exit?`error`:`done`},u(`b`,{class:`badge`}),u(`code`,null,`shell`),u(`span`,{class:`sum`},`! ${e.command}`),e.exit?u(`span`,{class:`stop`,"data-mark":`error`},ae({code:e.exit})):null),e.text?u(`pre`,{class:`out`},e.text):null));case`notice`:{let n=t(e);return n?.kind===`boss`&&f().service?U(e,n.body,n.crashed,e.text??``):n&&n.kind!==`boss`?W(e,De(n),n.body,n.kind===`link`?{raw:n.raw}:{crashed:n.crashed}):W(e,[ze[e.type??``]?.()??e.type??de(),` `,e.from&&p(e.from)||(e.from??``)],e.text??``)}case`divider`:return u(`article`,{class:`tx rule`},u(`details`,null,u(`summary`,null,e.type===`compaction`?re({tokens:(e.tokens??0).toLocaleString()}):te()),u(`pre`,null,e.text??``)));default:return u(`article`,{class:`tx note`},e.text??``,` `,H(e))}}function J(e){e.rebuild&&(g.clear(),y.replaceChildren());for(let t of e.dropped)g.get(t)?.remove(),g.delete(t);let t=e.added.map(e=>(g.set(e.id,q(e)),g.get(e.id)));e.front?y.prepend(...t):y.append(...t),k&&!e.front&&!e.rebuild&&t.forEach(e=>(e.classList.add(`fresh`),e.dataset.born=String(Date.now()))),w.remove();let n=f().service;w.textContent=n?.state===`standing`&&!n.run?Ae():ue(),h.items.length||y.append(w),b.hidden=!h.before,Ve()}let Y=[],X=new Map;function Ve(){let e=new Set;for(let t of Y){let n=Date.parse(t.startedAt),r=h.items.findIndex(e=>e.at!==void 0&&Date.parse(e.at)>=n);if(r===0&&h.before)continue;let i=r<0?``:h.items[r].id,a=JSON.stringify([i,s(t)]),o=X.get(t.id);if(e.add(t.id),o&&o.sig===a&&o.el.isConnected)continue;o?.el.remove();let c=s(t),l=u(`article`,{class:`tx rule conv-rule`},u(`div`,null,u(`b`,null,c.title),c.ended?u(`small`,null,c.ended):null));X.set(t.id,{el:l,sig:a});let d=i?g.get(i):void 0;d?d.before(l):y.append(l)}for(let[t,n]of X)e.has(t)||(n.el.remove(),X.delete(t))}let Z=e=>e.touched.forEach(e=>{let t=g.get(e),n=h.items.find(t=>t.id===e);if(t&&n){let r=q(n);t.classList.contains(`fresh`)&&Date.now()-Number(t.dataset.born??0)<400&&r.classList.add(`fresh`),t.replaceWith(r),g.set(e,r)}}),He=async()=>{if(!O&&h.before&&k){O=!0;try{let e=T.scrollHeight,t=h.prepend(await d.older(h.before));J(t),Z(t),T.scrollTop+=T.scrollHeight-e}finally{O=!1}h.before&&T.clientHeight&&b.getBoundingClientRect().bottom>=T.getBoundingClientRect().top&&He()}};C.addEventListener(`click`,()=>{A=void 0,h.detached?d.latest().then(e=>(J(h.reset(e)),R())):R()});let Q=[new IntersectionObserver(e=>e.some(e=>e.isIntersecting)&&void He(),{root:T}),new IntersectionObserver(e=>T.clientHeight&&(E.scrolled(e.at(-1).isIntersecting),L()),{root:T,rootMargin:`0px 0px 67px`})],$,Ue=()=>($??(Q[0].observe(b),Q[1].observe(S)),clearTimeout($),$=setTimeout(()=>($=void 0,Q.forEach(e=>e.disconnect())),600));T.addEventListener(`scroll`,()=>(Ue(),!N&&P!==void 0&&I()),{passive:!0}),T.addEventListener(`touchstart`,()=>(N=!0,clearTimeout(P),P=void 0),{passive:!0});for(let e of[`touchend`,`touchcancel`])T.addEventListener(e,()=>(N=!1,I()),{passive:!0});for(let e of[`wheel`,`touchstart`,`pointerdown`,`keydown`])T.addEventListener(e,()=>j=A=void 0,{passive:!0});let We=new ResizeObserver(()=>F()?void 0:E.pinned&&!h.detached?T.scrollTop=T.scrollHeight:j?.scrollIntoView({block:`center`}));return We.observe(y),We.observe(T),{log:T,docs:v,runs(e){JSON.stringify(e)!==JSON.stringify(Y)&&(Y=e,Ve())},apply(e){if(e.reset)J(h.reset({items:e.items??[],before:e.before})),k=!0,z();else if(e.items?.length){let t=h.append(e.items);J(t),Z(t),E.arrived(t.added.length)&&!h.detached&&!F()?R():L()}},reveal(e){A=e,k&&z()},setLive(e,t){x.dataset.mark=t,x.lastChild?.textContent!==e&&x.replaceChildren(...e?[u(`b`,{class:`badge`}),u(`span`,null,e)]:[])}}}export{q as mountChat,oe 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-CWN-sdri.js";import{D as i,E as a,S as o,T as s,Vt as c,at as l,b as u,c as d,h as f,l as p,p as m,u as h,v as g,x as _,y as v}from"./index-Cdt9Y_2Z.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=()=>f(`<div class="unit"><div class="card"><a class="hit"></a>${d}<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=()=>f(`<div class="unit tower-row"><div class="trow"><a class="tower-go">${d}<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=()=>f(`<section class="dbase"><h3><a></a><small></small></h3><div class="dgroups"></div></section>`),G=()=>f(`<div class="dgroup"><h4></h4><div class="drows"></div></div>`),K=()=>matchMedia(`(max-width: 640px)`).matches;function q(e=()=>!1){let n=c(`div`,{class:`drawer-body`}),l=c(`button`,{type:`button`,class:`x`,"aria-label":y()},`×`),d=c(`a`,{class:`drawer-map`},x()),f=c(`button`,{type:`button`,class:`pair-btn`,"data-close":`dismiss-all`,hidden:``}),C=c(`div`,{class:`drawer-sweep`,hidden:``},f);p(d,{view:`map`});let w=c(`aside`,{class:`drawer`,"aria-label":b()},c(`header`,null,c(`b`,null,S()),l),n,c(`footer`,{class:`drawer-foot`},C,d)),T=c(`div`,{class:`drawer-veil`});document.body.append(T,w);let E,D,O=!1,k=0,A=0,P,I=()=>{i(f,E??{bases:[]}),C.hidden=f.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,g(t,n.mark),m(t.querySelector(`.plate`),n.role,n.mark),o(t,`.name`,n.name),o(t,`.role`,v(n.role)),o(t,`.dstate`,L(n.mark,n.ended)),u(t,`.note`,n.note,n.mark,n.note?void 0:``);let r=t.querySelector(`:scope > .card > .quit-btn`);B(n)?s(r,n):r.hidden=!0,_(t.querySelector(`.subs`),n.subs??[],H,e)},a=(n,r)=>{let i=n.querySelector(`.tower-go`),a=n.querySelector(`.tower-add`),s=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,g(n,r.mark),m(i.querySelector(`.plate`),`tower`,r.mark),o(i,`.name`,r.name),o(i,`.role`,v(`tower`)),o(i,`.dstate`,L(r.mark,r.ended)),a.hidden=!s,s&&(h(a,s),a.setAttribute(`aria-label`,t({base:s.label}))),_(n.querySelector(`.subs`),r.subs,H,e)};_(n,z(E??{bases:[]}),W,(t,n)=>{g(t,n.mark),o(t,`h3 a`,n.label),p(t.querySelector(`h3 a`),{view:`workspace`,ws:n.id}),o(t,`small`,r({count:n.groups.reduce((e,t)=>e+t.rows.length,0)})),_(t.querySelector(`.dgroups`),n.groups,G,(t,n)=>{o(t,`h4`,n.label??``),t.querySelector(`h4`).toggleAttribute(`hidden`,!n.label),n.id===`tower`?_(t.querySelector(`.drows`),V(n.rows),U,a):_(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,d.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-BdRRs6h7.css"])))=>i.map(i=>d[i]);
2
+ import{i as e,n as t,r as n,t as r}from"./runtime-ZX6HkxDa.js";import{n as i}from"./post-CmicYl-f.js";var a={view:`sb.view`,locale:`sb-locale`,sound:`sb.sound`,volume:`sb.volume`,remind:`sb.remind`,wide:`sb.dialog-wide`,zenHint:`sb.zen.homehint`,zenMusic:`sb.zen.music`,zenTrack:`sb.zen.track`},o={view:e=>e??`auto`,locale:e=>e??null,sound:e=>e===`1`,volume:e=>Math.min(100,Math.max(0,Number(e??`60`)||0)),remind:e=>(e??`1`)===`1`,wide:e=>e===`1`,zenHint:e=>e!==null,zenMusic:e=>e===`1`,zenTrack:e=>e??null};function s(e){let t=[];return{get(t){let n;try{n=e.getItem?.(a[t])}catch{}return o[t](n)},set(t,n){try{return e.setItem(a[t],typeof n==`boolean`?n?`1`:`0`:String(n)),!0}catch{return!1}},on(e,n){t.length||addEventListener(`storage`,e=>t.forEach(([t,n])=>e.key===t&&n())),t.push([a[e],n])}}}var c=s({getItem:e=>localStorage.getItem(e),setItem:(e,t)=>localStorage.setItem(e,t)});a.view;var l={geek:`#000000`,zen:`#14110e`},u=e=>e===`standard`||e===`geek`||e===`zen`?e:`auto`,d=(e,t=`auto`)=>t===`auto`?e?`geek`:`standard`:t,f=(e,t,n=`auto`)=>e===`auto`?d(t,n):e;function p(){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 m(e=p()){let t=[],n=[],r=e.meta?.content??``,i=s(e.storage),a=()=>u(i.get(`view`)),o=a(),c=u(e.server?.content),d;function m(n){let i=f(o,e.media.matches,c),a=i===`zen`&&e.root.dataset.zenAway!==void 0?`standard`:i;e.root.dataset.view=a,e.meta&&(e.meta.content=a===`standard`?r:l[a]);let s=n===`pick`||n===`follow`&&d!==void 0&&d!==i;if(d=i,s)for(let e of t)e(i,n)}return m(),e.media.addEventListener(`change`,()=>m(`follow`)),{choice:()=>o,view:()=>f(o,e.media.matches,c),server:()=>c,setServer(e){let t=u(typeof e==`string`?e:void 0);if(t!==c){c=t;for(let e of n)e(c);m(`follow`)}},set(e){o=e,i.set(`view`,e),m(`pick`)},refresh:()=>m(),reread(){o=a(),m(`pick`)},onStored:e=>i.on(`view`,e),onChange:e=>void t.push(e),onServer:e=>void n.push(e)}}function h(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(u(e.dataset.choice)),o()));t.onStored(()=>(t.reread(),o())),o()}var ee=(e,t)=>(delete t.dataset.zenAway,e.reread());function te(e,t,n,r=()=>ee(t,n)){let i=()=>e.hidden=t.view()!==`zen`||n.dataset.zenAway===void 0;return t.onChange(i),e.addEventListener(`click`,()=>(r(),i())),i(),i}function ne(e){let t=[],n=(e,r,i)=>(t.push({base:e,unit:r,sub:i}),r.subs.forEach(t=>n(e,t,!0)));for(let t of e.bases)[...t.tower?[t.tower]:[],...t.tabs.flatMap(e=>e.units),...t.outside].forEach(e=>n(t,e,!1));return t}var g=e=>e.mark===`waiting`||e.pending?0:1,re=e=>[...e].filter(e=>g(e)===0),ie=new Set,ae=e=>e.unit??e.key;function oe(e,t){let n=new Map;for(let{base:r,unit:i}of ne(e)){let e=i,a=e.role??`tower`;n.set(e.key,{key:e.key,ws:r.id,name:e.name,role:a,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`)&&(o=>n.set(o,{key:o,unit:e.key,ws:r.id,name:e.name,role:a,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&&ie.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 se(e,t){return[...t.values()].filter(t=>{let n=e?.get(t.key);return g(t)===0?!n||g(n)!==0||n.mark!==t.mark:e!==void 0&&n?.mark!==t.mark&&(t.mark===`error`||t.mark===`done`)})}var _={count:!0,signal:!0,announce:`arrivals`,keys:`dialogs`,drawer:!0,calm:!0,chime:!0,escape:`stay`},ce={standard:_,geek:{..._,calm:!1},zen:{count:!1,signal:!1,announce:`current`,keys:`zen`,drawer:!1,calm:!0,chime:!1,escape:`blur`}},le=(e,t)=>ce[e===`zen`&&t?`standard`:e],v=(...e)=>e.filter(e=>e!==!1&&e!=null),y=(e,t)=>(e.classList.add(t),e.classList.toggle(`flip`));function b(e,t,...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t??{}))r.setAttribute(e,n);return r.append(...v(...n)),r}var ue=e=>`${e?.n}d`,de=e=>`${e?.n} 天`,fe=((e,t={})=>(t.locale??r())===`zh-TW`?de(e):ue(e)),pe=e=>`${e?.n}h`,me=e=>`${e?.n} 小時`,he=((e,t={})=>(t.locale??r())===`zh-TW`?me(e):pe(e)),ge=e=>`${e?.n}m`,_e=e=>`${e?.n} 分`,ve=((e,t={})=>(t.locale??r())===`zh-TW`?_e(e):ge(e)),ye=e=>`${e?.n}s`,be=e=>`${e?.n} 秒`,xe=((e,t={})=>(t.locale??r())===`zh-TW`?be(e):ye(e)),Se=((e={},t={})=>(t.locale??r())===`zh-TW`?`警示`:`Alerts`),Ce=((e={},t={})=>(t.locale??r())===`zh-TW`?`所有基地`:`all bases`),we=e=>`ally run · ${e?.device}`,Te=e=>`隊友 run · ${e?.device}`,Ee=((e,t={})=>(t.locale??r())===`zh-TW`?Te(e):we(e)),De=((e={},t={})=>(t.locale??r())===`zh-TW`?`唯讀查看這個隊友 run 的通訊`:`Read this ally run's comms (read only)`),Oe=((e={},t={})=>(t.locale??r())===`zh-TW`?`還看不到它的通訊:尚未取得這個 run 的工作階段檔`:`Its comms are not shown yet: the run's session file is not known`);function ke(e,t,n,r){if(typeof t!=`string`||n!==void 0&&!r)return new e(t,n);let i=ke;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 x(e,t,n,r=!1){return ke(Intl.PluralRules,e,n,r).select(Number(t)-Number(n?.offset??0))}var Ae=e=>{let t=x(`en`,e?.count,{},!0);return t===`one`?`${e?.count} ally run`:t===`other`?`${e?.count} ally runs`:`ally_runs`},je=e=>`${e?.count} 個隊友 run`,Me=((e,t={})=>(t.locale??r())===`zh-TW`?je(e):Ae(e)),Ne=e=>`${e?.team} · teammate`,Pe=e=>`${e?.team} · 隊友`,Fe=((e,t={})=>(t.locale??r())===`zh-TW`?Pe(e):Ne(e)),Ie=((e={},t={})=>(t.locale??r())===`zh-TW`?`返回`:`Back`),Le=((e={},t={})=>(t.locale??r())===`zh-TW`?``:`.`),Re=((e={},t={})=>(t.locale??r())===`zh-TW`?`最後更新:`:`Last update`),ze=e=>`Disconnected. Gave up after ${e?.tries} tries; it reconnects when you return to this tab.`,Be=e=>`連線中斷。重試 ${e?.tries} 次後放棄;回到此分頁時會重新連線。`,Ve=((e,t={})=>(t.locale??r())===`zh-TW`?Be(e):ze(e)),He=e=>`The server is up but cannot read the net: ${e?.problem}`,Ue=e=>`伺服器正常,但讀不到網:${e?.problem}`,We=((e,t={})=>(t.locale??r())===`zh-TW`?Ue(e):He(e)),Ge=((e={},t={})=>(t.locale??r())===`zh-TW`?`與稻草網的連線中斷,正在重新連線…畫面顯示的是最後已知狀態。`:`Disconnected from the straw net. Reconnecting… The view shows the last known state.`),Ke=e=>`Disconnected from the straw net. Reconnecting (try ${e?.attempt})… The view shows the last known state.`,qe=e=>`與稻草網的連線中斷,正在重新連線(第 ${e?.attempt} 次)…畫面顯示的是最後已知狀態。`,Je=((e,t={})=>(t.locale??r())===`zh-TW`?qe(e):Ke(e)),Ye=((e={},t={})=>(t.locale??r())===`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.`),Xe=((e={},t={})=>(t.locale??r())===`zh-TW`?`Straw Net:所有基地`:`Straw Net: all bases`),Ze=((e={},t={})=>(t.locale??r())===`zh-TW`?`取消`:`Cancel`),Qe=((e={},t={})=>(t.locale??r())===`zh-TW`?`關閉`:`Close`),$e=e=>`Quit base ${e?.name}`,et=e=>`關掉基地 ${e?.name}`,tt=((e,t={})=>(t.locale??r())===`zh-TW`?et(e):$e(e)),nt=e=>`Quit base ${e?.name}? Every agent in it and its tower quit. Nothing quits while anything running would be lost.`,rt=e=>`要關掉基地 ${e?.name} 嗎?裡面所有 agent 和塔台都會退出。有會遺失的東西時什麼都不關。`,it=((e,t={})=>(t.locale??r())===`zh-TW`?rt(e):nt(e)),at=e=>`Quit squad ${e?.name}`,ot=e=>`關掉小隊 ${e?.name}`,st=((e,t={})=>(t.locale??r())===`zh-TW`?ot(e):at(e)),ct=e=>`Quit squad ${e?.name}? Every agent in it quits.`,lt=e=>`要關掉小隊 ${e?.name} 嗎?裡面所有 agent 都會退出。`,ut=((e,t={})=>(t.locale??r())===`zh-TW`?lt(e):ct(e)),dt=e=>`Quit the tower ${e?.name}? The base's mains become members again.`,ft=e=>`要關掉塔台 ${e?.name} 嗎?這個基地的主智慧體都會降格成成員。`,pt=((e,t={})=>(t.locale??r())===`zh-TW`?ft(e):dt(e)),mt=e=>`Quit ${e?.name}`,ht=e=>`關掉 ${e?.name}`,gt=((e,t={})=>(t.locale??r())===`zh-TW`?ht(e):mt(e)),_t=e=>`Quit ${e?.name}? It quits pi and its pane closes.`,vt=e=>`要關掉 ${e?.name} 嗎?它會退出 pi,窗格也會關掉。`,yt=((e,t={})=>(t.locale??r())===`zh-TW`?vt(e):_t(e)),bt=((e={},t={})=>(t.locale??r())===`zh-TW`?`連線中…`:`Connecting…`),xt=((e={},t={})=>(t.locale??r())===`zh-TW`?`重新連線中…`:`Reconnecting…`),St=((e={},t={})=>(t.locale??r())===`zh-TW`?`重試`:`Try again`),Ct=e=>`control tower · ${e?.state}`,wt=e=>`塔台 · ${e?.state}`,Tt=((e,t={})=>(t.locale??r())===`zh-TW`?wt(e):Ct(e)),Et=e=>`hard cap ${e?.time}`,Dt=e=>`上限 ${e?.time}`,Ot=((e,t={})=>(t.locale??r())===`zh-TW`?Dt(e):Et(e)),kt=((e={},t={})=>(t.locale??r())===`zh-TW`?`收尾中`:`closing`),At=e=>`Boss conversation · new session · ${e?.time}`,jt=e=>`老闆對話・新的工作階段・${e?.time}`,Mt=((e,t={})=>(t.locale??r())===`zh-TW`?jt(e):At(e)),Nt=e=>`Boss conversation · resumed · ${e?.time}`,Pt=e=>`老闆對話・接續・${e?.time}`,Ft=((e,t={})=>(t.locale??r())===`zh-TW`?Pt(e):Nt(e)),It=e=>`ended ${e?.time}`,Lt=e=>`${e?.time} 結束`,Rt=((e,t={})=>(t.locale??r())===`zh-TW`?Lt(e):It(e)),zt=e=>`waiting for you; it ends at ${e?.time} if you stay quiet`,Bt=e=>`等你說話;你若不說話,${e?.time} 結束`,Vt=((e,t={})=>(t.locale??r())===`zh-TW`?Bt(e):zt(e)),Ht=((e={},t={})=>(t.locale??r())===`zh-TW`?`新的工作階段`:`new session`),Ut=e=>`new session · ${e?.why}`,Wt=e=>`新的工作階段・${e?.why}`,Gt=((e,t={})=>(t.locale??r())===`zh-TW`?Wt(e):Ut(e)),Kt=e=>`resumed session · boss turns: ${e?.turns}`,qt=e=>`接續舊工作階段・老闆輪數 ${e?.turns}`,Jt=((e,t={})=>(t.locale??r())===`zh-TW`?qt(e):Kt(e)),Yt=((e={},t={})=>(t.locale??r())===`zh-TW`?`老闆對話・收尾中`:`boss conversation · closing`),Xt=e=>`boss conversation · waiting for you · ends after ${e?.minutes} min idle`,Zt=e=>`老闆對話・等你說話・閒置 ${e?.minutes} 分鐘後結束`,Qt=((e,t={})=>(t.locale??r())===`zh-TW`?Zt(e):Xt(e)),$t=e=>`boss conversation · ends after ${e?.minutes} min idle`,en=e=>`老闆對話・閒置 ${e?.minutes} 分鐘後結束`,tn=((e,t={})=>(t.locale??r())===`zh-TW`?en(e):$t(e)),nn=e=>`working; it ends after ${e?.minutes} min idle`,rn=e=>`處理中;閒置 ${e?.minutes} 分鐘後結束`,an=((e,t={})=>(t.locale??r())===`zh-TW`?rn(e):nn(e)),on=((e={},t={})=>(t.locale??r())===`zh-TW`?`圖示來自 game-icons.net(Lorc、Delapouite),CC BY 3.0。`:`Icons from game-icons.net by Lorc and Delapouite, CC BY 3.0.`),sn=((e={},t={})=>(t.locale??r())===`zh-TW`?`移除`:`Dismiss`),cn=e=>`Dismiss finished (${e?.count})`,ln=e=>`移除已完成(${e?.count})`,un=((e,t={})=>(t.locale??r())===`zh-TW`?ln(e):cn(e)),dn=e=>`Dismiss ${e?.name}`,fn=e=>`從畫面移除 ${e?.name}`,pn=((e,t={})=>(t.locale??r())===`zh-TW`?fn(e):dn(e)),mn=((e={},t={})=>(t.locale??r())===`zh-TW`?`文件`:`Documents`),hn=((e={},t={})=>(t.locale??r())===`zh-TW`?`總塔台`:`head tower`),gn=((e={},t={})=>(t.locale??r())===`zh-TW`?`語言`:`Language`),_n=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`,vn=e=>`${e?.label}(${e?.short})請你確認它的塔台 ${e?.tower} 的一次 ${e?.tool} 呼叫,該塔台正在處理你送出的訊息`,yn=((e,t={})=>(t.locale??r())===`zh-TW`?vn(e):_n(e)),bn=e=>`${e?.label} (${e?.short}) asks you to confirm a ${e?.tool} call from its tower`,xn=e=>`${e?.label}(${e?.short})請你確認它塔台的一次 ${e?.tool} 呼叫`,Sn=((e,t={})=>(t.locale??r())===`zh-TW`?xn(e):bn(e)),Cn=e=>`Team ${e?.team} stopped: ${e?.reason}`,wn=e=>`團隊 ${e?.team} 已停止:${e?.reason}`,Tn=((e,t={})=>(t.locale??r())===`zh-TW`?wn(e):Cn(e)),En=e=>{let t=x(`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`},Dn=e=>`團隊 ${e?.team} 有 ${e?.count} 則訊息已等了超過 10 分鐘,塔台一直不閒`,On=((e,t={})=>(t.locale??r())===`zh-TW`?Dn(e):En(e)),kn=e=>{let t=x(`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`},An=e=>`團隊 ${e?.team} 的收件匣有 ${e?.count} 則訊息在等:專案上沒有開著的塔台`,jn=((e,t={})=>(t.locale??r())===`zh-TW`?An(e):kn(e)),Mn=e=>`${e?.label} (${e?.short}) asks to join team ${e?.team}`,Nn=e=>`${e?.label}(${e?.short})要求加入團隊 ${e?.team}`,Pn=((e,t={})=>(t.locale??r())===`zh-TW`?Nn(e):Mn(e)),Fn=e=>`${e?.label} (${e?.short}), an unattended device, asks to join team ${e?.team}`,In=e=>`${e?.label}(${e?.short})是無人值守的裝置,要求加入團隊 ${e?.team}`,Ln=((e,t={})=>(t.locale??r())===`zh-TW`?In(e):Fn(e)),Rn=e=>`${e?.label} (${e?.short}) shows another roster than this computer in team ${e?.team}; the relay may be showing different rosters`,zn=e=>`團隊 ${e?.team} 中,${e?.label}(${e?.short})顯示的名冊和這台電腦不同;中繼站可能對不同人顯示不同名冊`,Bn=((e,t={})=>(t.locale??r())===`zh-TW`?zn(e):Rn(e)),Vn=e=>{let t=x(`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`},Hn=e=>`團隊 ${e?.team} 的收件匣有 ${e?.count} 則 Straw Link 訊息等隊友 run 接手已超過 10 分鐘。請看地圖上塔台的卡片:塔台已暫停或 run 啟動被拒,都會讓它們一直等。`,Un=((e,t={})=>(t.locale??r())===`zh-TW`?Hn(e):Vn(e)),Wn=e=>`The relay of team ${e?.team} has been unreachable for ${e?.minutes} minutes`,Gn=e=>`團隊 ${e?.team} 的中繼站已經 ${e?.minutes} 分鐘連不上`,Kn=((e,t={})=>(t.locale??r())===`zh-TW`?Gn(e):Wn(e)),qn=e=>`Link ${e?.count}`,Jn=e=>`連線 ${e?.count}`,Yn=((e,t={})=>(t.locale??r())===`zh-TW`?Jn(e):qn(e)),Xn=((e={},t={})=>(t.locale??r())===`zh-TW`?`Straw Link 通知`:`Straw Link notices`),Zn=((e={},t={})=>(t.locale??r())===`zh-TW`?`允許`:`Allow`),Qn=((e={},t={})=>(t.locale??r())===`zh-TW`?`連線中`:`connecting`),$n=((e={},t={})=>(t.locale??r())===`zh-TW`?`拒絕`:`Deny`),er=((e={},t={})=>(t.locale??r())===`zh-TW`?`即時`:`live`),tr=((e={},t={})=>(t.locale??r())===`zh-TW`?`尚未見到`:`not seen yet`),nr=((e={},t={})=>(t.locale??r())===`zh-TW`?`離線`:`offline`),rr=((e={},t={})=>(t.locale??r())===`zh-TW`?`在線`:`online`),ir=((e={},t={})=>(t.locale??r())===`zh-TW`?`開啟團隊`:`Open Teams`),ar=((e={},t={})=>(t.locale??r())===`zh-TW`?`重新連線中`:`reconnecting`),or=((e={},t={})=>(t.locale??r())===`zh-TW`?`查看`:`Review`),sr=e=>`seen ${e?.ago} ago`,cr=e=>`${e?.ago}前見到`,lr=((e,t={})=>(t.locale??r())===`zh-TW`?cr(e):sr(e)),ur=((e={},t={})=>(t.locale??r())===`zh-TW`?`查看塔台`:`Show towers`),dr=((e={},t={})=>(t.locale??r())===`zh-TW`?`正體中文`:`English`),fr=((e={},t={})=>(t.locale??r())===`zh-TW`?`位置`:`Location`),pr=e=>`${e?.name} is commanding`,mr=e=>`${e?.name} 指揮中`,hr=((e,t={})=>(t.locale??r())===`zh-TW`?mr(e):pr(e)),gr=e=>`${e?.name} finished`,_r=e=>`${e?.name} 已完成`,vr=((e,t={})=>(t.locale??r())===`zh-TW`?_r(e):gr(e)),yr=e=>`${e?.name} hit an error`,br=e=>`${e?.name} 發生錯誤`,xr=((e,t={})=>(t.locale??r())===`zh-TW`?br(e):yr(e)),Sr=e=>`${e?.name} went idle`,Cr=e=>`${e?.name} 轉為閒置`,wr=((e,t={})=>(t.locale??r())===`zh-TW`?Cr(e):Sr(e)),Tr=e=>`${e?.name} joined`,Er=e=>`${e?.name} 加入`,Dr=((e,t={})=>(t.locale??r())===`zh-TW`?Er(e):Tr(e)),Or=e=>`${e?.name} left`,kr=e=>`${e?.name} 離開`,Ar=((e,t={})=>(t.locale??r())===`zh-TW`?kr(e):Or(e)),jr=e=>`${e?.name} lost its status`,Mr=e=>`${e?.name} 失去狀態`,Nr=((e,t={})=>(t.locale??r())===`zh-TW`?Mr(e):jr(e)),Pr=e=>`${e?.name} is waiting on a question`,Fr=e=>`${e?.name} 正在等待回答`,Ir=((e,t={})=>(t.locale??r())===`zh-TW`?Fr(e):Pr(e)),Lr=e=>`${e?.name} started working`,Rr=e=>`${e?.name} 開始工作`,zr=((e,t={})=>(t.locale??r())===`zh-TW`?Rr(e):Lr(e)),Br=((e={},t={})=>(t.locale??r())===`zh-TW`?`指揮中`:`commanding`),Vr=((e={},t={})=>(t.locale??r())===`zh-TW`?`已完成`:`finished`),Hr=((e={},t={})=>(t.locale??r())===`zh-TW`?`錯誤`:`error`),Ur=((e={},t={})=>(t.locale??r())===`zh-TW`?`閒置`:`idle`),Wr=((e={},t={})=>(t.locale??r())===`zh-TW`?`待命`:`standing by`),Gr=((e={},t={})=>(t.locale??r())===`zh-TW`?`無狀態`:`no status`),Kr=((e={},t={})=>(t.locale??r())===`zh-TW`?`等待回答`:`waiting on a question`),qr=((e={},t={})=>(t.locale??r())===`zh-TW`?`工作中`:`working`),Jr=((e={},t={})=>(t.locale??r())===`zh-TW`?`你的原話`:`your words`),Yr=((e={},t={})=>(t.locale??r())===`zh-TW`?`塔台提議,你確認`:`proposed by the tower, confirmed by you`),Xr=((e={},t={})=>(t.locale??r())===`zh-TW`?`塔台自己的備註`:`the tower's note`),Zr=((e={},t={})=>(t.locale??r())===`zh-TW`?`確認`:`Confirm`),Qr=e=>`${e?.standing} standing · ${e?.decisions} decisions · ${e?.waits} waits`,$r=e=>`${e?.standing} 常駐指示・${e?.decisions} 決定・${e?.waits} 等待`,ei=((e,t={})=>(t.locale??r())===`zh-TW`?$r(e):Qr(e)),ti=e=>`${e?.standing} standing · ${e?.decisions} decisions · ${e?.waits} waits · ${e?.proposals} to confirm`,ni=e=>`${e?.standing} 常駐指示・${e?.decisions} 決定・${e?.waits} 等待・${e?.proposals} 則待你確認`,ri=((e,t={})=>(t.locale??r())===`zh-TW`?ni(e):ti(e)),ii=e=>`The tower proposes a decision: ${e?.text}`,ai=e=>`塔台提議一項決定:${e?.text}`,oi=((e,t={})=>(t.locale??r())===`zh-TW`?ai(e):ii(e)),si=e=>`The tower proposes a standing instruction: ${e?.text}`,ci=e=>`塔台提議一則常駐指示:${e?.text}`,li=((e,t={})=>(t.locale??r())===`zh-TW`?ci(e):si(e)),ui=e=>`The tower proposes to retire ${e?.id}: ${e?.text}`,di=e=>`塔台提議撤掉 ${e?.id}:${e?.text}`,fi=((e,t={})=>(t.locale??r())===`zh-TW`?di(e):ui(e)),pi=((e={},t={})=>(t.locale??r())===`zh-TW`?`駁回`:`Reject`),mi=((e={},t={})=>(t.locale??r())===`zh-TW`?`你讀到記憶之後它又有變動,所以重新顯示了。請再試一次。`:`The memory changed since you read it, so it is shown again. Try once more.`),hi=e=>`waits for ${e?.who}`,gi=e=>`等 ${e?.who}`,_i=((e,t={})=>(t.locale??r())===`zh-TW`?gi(e):hi(e)),vi=e=>`answered? a message came from ${e?.who}`,yi=e=>`可能已回覆:${e?.who} 來了一則訊息`,bi=((e,t={})=>(t.locale??r())===`zh-TW`?yi(e):vi(e)),xi=((e={},t={})=>(t.locale??r())===`zh-TW`?`等你決定`:`waits for you`),Si=((e={},t={})=>(t.locale??r())===`zh-TW`?`已過 7 天而失效`:`expired after 7 days`),Ci=e=>`resolved: ${e?.outcome}`,wi=e=>`已處理:${e?.outcome}`,Ti=((e,t={})=>(t.locale??r())===`zh-TW`?wi(e):Ci(e)),Ei=((e={},t={})=>(t.locale??r())===`zh-TW`?`更多`:`More`),Di=e=>`More actions for ${e?.name}`,Oi=e=>`「${e?.name}」的更多動作`,ki=((e,t={})=>(t.locale??r())===`zh-TW`?Oi(e):Di(e)),Ai=((e={},t={})=>(t.locale??r())===`zh-TW`?`地圖總覽`:`Overview of the map`),ji=e=>`Monitor failed: ${e?.what}`,Mi=e=>`Monitor 出錯:${e?.what}`,Ni=((e,t={})=>(t.locale??r())===`zh-TW`?Mi(e):ji(e)),Pi=e=>`Monitor went quiet and stopped: ${e?.what}`,Fi=e=>`Monitor 太久沒輸出,已停止:${e?.what}`,Ii=((e,t={})=>(t.locale??r())===`zh-TW`?Fi(e):Pi(e)),Li=((e={},t={})=>(t.locale??r())===`zh-TW`?`從未`:`never`),Ri=((e={},t={})=>(t.locale??r())===`zh-TW`?`+新基地`:`+ New base`),zi=((e={},t={})=>(t.locale??r())===`zh-TW`?`沒有執行中的智慧體`:`no agent running`),Bi=((e={},t={})=>(t.locale??r())===`zh-TW`?`無警示`:`no alerts`),S=((e={},t={})=>(t.locale??r())===`zh-TW`?`伺服器沒有回應。`:`The server did not answer.`),Vi=((e={},t={})=>(t.locale??r())===`zh-TW`?`尚無塔台`:`no tower yet`),Hi=((e={},t={})=>(t.locale??r())===`zh-TW`?`監看中`:`Watching a monitor`),Ui=((e={},t={})=>(t.locale??r())===`zh-TW`?`思考中`:`thinking`),Wi=e=>`Finished ${e?.note}`,Gi=e=>`完成了 ${e?.note}`,Ki=((e,t={})=>(t.locale??r())===`zh-TW`?Gi(e):Wi(e)),qi=e=>`Failed ${e?.note}`,Ji=e=>`出錯了 ${e?.note}`,Yi=((e,t={})=>(t.locale??r())===`zh-TW`?Ji(e):qi(e)),Xi=e=>`Waiting on you ${e?.note}`,Zi=e=>`等你回答 ${e?.note}`,Qi=((e,t={})=>(t.locale??r())===`zh-TW`?Zi(e):Xi(e)),$i=((e={},t={})=>(t.locale??r())===`zh-TW`?`+主智慧體`:`+ Main`),ea=((e={},t={})=>(t.locale??r())===`zh-TW`?`+成員`:`+ Member`),ta=((e={},t={})=>(t.locale??r())===`zh-TW`?`前哨`:`Outposts`),na=((e={},t={})=>(t.locale??r())===`zh-TW`?`Herdr 開了新窗格,請到 Herdr 裡接著做。`:`A pane opened in Herdr; carry on there.`),ra=((e={},t={})=>(t.locale??r())===`zh-TW`?`接回`:`Pop`),ia=e=>`Pop ${e?.name}`,aa=e=>`接回 ${e?.name}`,oa=((e,t={})=>(t.locale??r())===`zh-TW`?aa(e):ia(e)),sa=((e={},t={})=>(t.locale??r())===`zh-TW`?`伺服器送來的快照,頁面無法讀取`:`the server sent a snapshot the page cannot read`),ca=((e={},t={})=>(t.locale??r())===`zh-TW`?`伺服器回報了頁面無法讀取的問題`:`the server reported a problem the page cannot read`),la=((e={},t={})=>(t.locale??r())===`zh-TW`?`關掉`:`Quit`),ua=((e={},t={})=>(t.locale??r())===`zh-TW`?`關掉塔台`:`Quit tower`),da=e=>`Refused (${e?.status}).`,fa=e=>`已拒絕(${e?.status})。`,C=((e,t={})=>(t.locale??r())===`zh-TW`?fa(e):da(e)),pa=((e={},t={})=>(t.locale??r())===`zh-TW`?`提醒`:`Remind`),ma=((e={},t={})=>(t.locale??r())===`zh-TW`?`點一下允許瀏覽器通知`:`Press to allow browser notifications`),ha=((e={},t={})=>(t.locale??r())===`zh-TW`?`瀏覽器已封鎖通知,要到網站設定裡允許`:`The browser blocks notifications; allow them in the site settings`),ga=((e={},t={})=>(t.locale??r())===`zh-TW`?`提醒已關`:`Reminders off`),_a=((e={},t={})=>(t.locale??r())===`zh-TW`?`提醒已開:分頁不在前景時,單位等你回答、完成或出錯會跳系統通知`:`Reminders on: while the page is in the background, a unit waiting on you, finishing, or failing raises a system notification`),va=((e={},t={})=>(t.locale??r())===`zh-TW`?`這個瀏覽器不支援通知`:`This browser has no notifications`),ya=((e={},t={})=>(t.locale??r())===`zh-TW`?`隊友 run`:`ally run`),ba=((e={},t={})=>(t.locale??r())===`zh-TW`?`主智慧體`:`main`),xa=((e={},t={})=>(t.locale??r())===`zh-TW`?`成員`:`member`),Sa=((e={},t={})=>(t.locale??r())===`zh-TW`?`前哨`:`outpost`),Ca=((e={},t={})=>(t.locale??r())===`zh-TW`?`未編入`:`unaligned`),wa=((e={},t={})=>(t.locale??r())===`zh-TW`?`事件 run`:`event run`),Ta=((e={},t={})=>(t.locale??r(),`session`)),Ea=((e={},t={})=>(t.locale??r())===`zh-TW`?`子智慧體`:`subagent`),Da=((e={},t={})=>(t.locale??r())===`zh-TW`?`塔台`:`tower`),Oa=((e={},t={})=>(t.locale??r())===`zh-TW`?`這台裝置`:`This device`),ka=((e={},t={})=>(t.locale??r())===`zh-TW`?`這些選擇只留在這台裝置的這個瀏覽器。`:`These choices stay on this device, in this browser.`),Aa=((e={},t={})=>(t.locale??r())===`zh-TW`?`手機與裝置`:`Phone & devices`),ja=((e={},t={})=>(t.locale??r())===`zh-TW`?`伺服器`:`Server`),Ma=((e={},t={})=>(t.locale??r())===`zh-TW`?`團隊`:`Teams`),Na=((e={},t={})=>(t.locale??r())===`zh-TW`?`設定`:`Settings`),Pa=((e={},t={})=>(t.locale??r())===`zh-TW`?`音效`:`Sound`),Fa=((e={},t={})=>(t.locale??r())===`zh-TW`?`音效:開關、音量與試聽`:`Sounds: on or off, volume, and a try`),Ia=((e={},t={})=>(t.locale??r())===`zh-TW`?`▶ 試聽`:`▶ Try`),La=((e={},t={})=>(t.locale??r())===`zh-TW`?`音量`:`Volume`),Ra=((e={},t={})=>(t.locale??r())===`zh-TW`?`收起`:`Stash`),za=e=>`Stash base ${e?.name}`,Ba=e=>`收起基地 ${e?.name}`,Va=((e,t={})=>(t.locale??r())===`zh-TW`?Ba(e):za(e)),Ha=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.`,Ua=e=>`要收起基地 ${e?.name} 嗎?塔台、主智慧體和成員會結束,之後可以用「接回」叫回來。有會遺失的東西時不會收。`,Wa=((e,t={})=>(t.locale??r())===`zh-TW`?Ua(e):Ha(e)),Ga=e=>`Stashed (${e?.count})`,Ka=e=>`已收起(${e?.count})`,qa=((e,t={})=>(t.locale??r())===`zh-TW`?Ka(e):Ga(e)),Ja=((e={},t={})=>(t.locale??r())===`zh-TW`?`智慧體`:`Agents`),Ya=((e={},t={})=>(t.locale??r())===`zh-TW`?`基地`:`Bases`),Xa=((e={},t={})=>(t.locale??r())===`zh-TW`?`指揮中`:`Commanding`),Za=((e={},t={})=>(t.locale??r())===`zh-TW`?`等待中`:`Waiting`),Qa=((e={},t={})=>(t.locale??r())===`zh-TW`?`工作中`:`Working`),$a=((e={},t={})=>(t.locale??r())===`zh-TW`?`待允許`:`Allow?`),eo=((e={},t={})=>(t.locale??r())===`zh-TW`?`被擋`:`Blocked`),to=((e={},t={})=>(t.locale??r())===`zh-TW`?`關`:`Off`),no=((e={},t={})=>(t.locale??r())===`zh-TW`?`開`:`On`),ro=((e={},t={})=>(t.locale??r())===`zh-TW`?`狀態`:`States`),io=e=>`tab ${e?.label}`,ao=e=>`分頁 ${e?.label}`,oo=((e,t={})=>(t.locale??r())===`zh-TW`?ao(e):io(e)),so=((e={},t={})=>(t.locale??r())===`zh-TW`?`即時網況 · 通訊`:`live net · comms`),co=((e={},t={})=>(t.locale??r())===`zh-TW`?`網路活動`:`Net activity`),lo=((e={},t={})=>(t.locale??r())===`zh-TW`?`伺服器啟動後還沒有動靜`:`Nothing has happened since the server started`),uo=((e={},t={})=>(t.locale??r())===`zh-TW`?`現在`:`now`),fo=e=>`${e?.count} events in 30 min`,po=e=>`近 30 分鐘 ${e?.count} 筆`,mo=((e,t={})=>(t.locale??r())===`zh-TW`?po(e):fo(e)),ho=((e={},t={})=>(t.locale??r())===`zh-TW`?`網的總計`:`Net totals`),go=e=>`The tower refused it: ${e?.reason}`,_o=e=>`塔台拒絕了:${e?.reason}`,vo=((e,t={})=>(t.locale??r())===`zh-TW`?_o(e):go(e)),yo=((e={},t={})=>(t.locale??r())===`zh-TW`?`回覆`:`Answer`),bo=((e={},t={})=>(t.locale??r())===`zh-TW`?`重新送達`:`Deliver again`),xo=((e={},t={})=>(t.locale??r())===`zh-TW`?`捨棄`:`Drop`),So=((e={},t={})=>(t.locale??r())===`zh-TW`?`沒有這則已擱置的事件。`:`No such parked event.`),Co=((e={},t={})=>(t.locale??r())===`zh-TW`?`sb server 沒有替這個工作區執行塔台。`:`The sb server runs no tower for this workspace.`),wo=e=>{let t=x(`en`,e?.count,{},!0);return t===`one`?`${e?.count} failed run lately`:t===`other`?`${e?.count} failed runs lately`:`tower_failures`},To=e=>`近來有 ${e?.count} 次 run 失敗`,Eo=((e,t={})=>(t.locale??r())===`zh-TW`?To(e):wo(e)),Do=((e={},t={})=>(t.locale??r())===`zh-TW`?`上一次 run 當機`:`last run crashed`),Oo=((e={},t={})=>(t.locale??r())===`zh-TW`?`上一次 run 已結束`:`last run quit`),ko=((e={},t={})=>(t.locale??r())===`zh-TW`?`上一次 run 逾時`:`last run timed out`),Ao=e=>`An event was parked after two runs crashed with it: ${e?.what}`,jo=e=>`有一則事件在兩個 run 都當機後被擱置:${e?.what}`,Mo=((e,t={})=>(t.locale??r())===`zh-TW`?jo(e):Ao(e)),No=((e={},t={})=>(t.locale??r())===`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.`),Po=((e={},t={})=>(t.locale??r())===`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`),Fo=e=>`The tower types nothing in the standing pane: ${e?.reason}`,Io=e=>`塔台不在常駐窗格輸入任何東西:${e?.reason}`,Lo=((e,t={})=>(t.locale??r())===`zh-TW`?Io(e):Fo(e)),Ro=((e={},t={})=>(t.locale??r())===`zh-TW`?`重試`:`Retry`),zo=e=>`A run could not start: ${e?.reason}`,Bo=e=>`run 無法啟動:${e?.reason}`,Vo=((e,t={})=>(t.locale??r())===`zh-TW`?Bo(e):zo(e)),Ho=((e={},t={})=>(t.locale??r())===`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`),Uo=e=>`Parked: ${e?.kind} from ${e?.from}: ${e?.first}`,Wo=e=>`已擱置:${e?.kind},來自 ${e?.from}:${e?.first}`,Go=((e,t={})=>(t.locale??r())===`zh-TW`?Wo(e):Uo(e)),Ko=e=>`Parked: ${e?.kind}: ${e?.first}`,qo=e=>`已擱置:${e?.kind}:${e?.first}`,Jo=((e,t={})=>(t.locale??r())===`zh-TW`?qo(e):Ko(e)),Yo=e=>{let t=x(`en`,e?.count,{},!0);return t===`one`?`${e?.count} message queued`:t===`other`?`${e?.count} messages queued`:`tower_queued`},Xo=e=>`${e?.count} 則排隊中`,Zo=((e,t={})=>(t.locale??r())===`zh-TW`?Xo(e):Yo(e)),Qo=e=>`ally run · ${e?.device}`,$o=e=>`隊友 run · ${e?.device}`,es=((e,t={})=>(t.locale??r())===`zh-TW`?$o(e):Qo(e)),ts=((e={},t={})=>(t.locale??r())===`zh-TW`?`收工中`:`closing`),ns=((e={},t={})=>(t.locale??r())===`zh-TW`?`已暫停`:`held`),rs=((e={},t={})=>(t.locale??r())===`zh-TW`?`喚醒中`:`waking`),is=e=>`Waits for you: ${e?.text}`,as=e=>`等你決定:${e?.text}`,os=((e,t={})=>(t.locale??r())===`zh-TW`?as(e):is(e)),ss=((e={},t={})=>(t.locale??r())===`zh-TW`?`處理中…`:`Working…`),cs=((e={},t={})=>(t.locale??r())===`zh-TW`?`有智慧體等你同意,才能載入資料夾的設定`:`An agent needs your OK to load a folder's settings`),ls=((e={},t={})=>(t.locale??r())===`zh-TW`?`連不上伺服器。`:`The server could not be reached.`),us=e=>`using ${e?.tool}`,ds=e=>`使用 ${e?.tool}`,fs=((e,t={})=>(t.locale??r())===`zh-TW`?ds(e):us(e)),ps=((e={},t={})=>(t.locale??r())===`zh-TW`?`自動`:`Auto`),ms=e=>`Follow server (${e?.view})`,hs=e=>`跟隨伺服器(${e?.view})`,gs=((e,t={})=>(t.locale??r())===`zh-TW`?hs(e):ms(e)),_s=((e={},t={})=>(t.locale??r())===`zh-TW`?`極客`:`Geek`),vs=((e={},t={})=>(t.locale??r())===`zh-TW`?`檢視`:`View`),ys=((e={},t={})=>(t.locale??r())===`zh-TW`?`標準`:`Standard`),bs=((e={},t={})=>(t.locale??r())===`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`),xs=((e={},t={})=>(t.locale??r())===`zh-TW`?`禪`:`Zen`),Ss=((e={},t={})=>(t.locale??r())===`zh-TW`?`禪`:`Zen`),Cs=((e={},t={})=>(t.locale??r())===`zh-TW`?`回到禪`:`Back to Zen`),w=e=>String(e??``);function ws(e){let t=e.data,n=e.teamName;switch(e.kind){case`join-request`:return t.unattended?Ln({label:w(t.label),short:w(t.short),team:n}):Pn({label:w(t.label),short:w(t.short),team:n});case`confirm`:return t.tower?yn({label:w(t.label),short:w(t.short),tool:w(t.tool),tower:w(t.tower)}):Sn({label:w(t.label),short:w(t.short),tool:w(t.tool)});case`fork`:return Tn({team:n,reason:w(t.reason)});case`mismatch`:return Bn({label:w(t.label),short:w(t.short),team:n});case`unreachable`:return Kn({team:n,minutes:w(t.minutes)});case`inbox`:return jn({count:Number(t.count)||0,team:n});case`held`:return On({count:Number(t.count)||0,team:n});case`served`:return Un({count:Number(t.count)||0,team:n})}}var Ts=e=>{let t={error:0,warning:1,info:2};return[...e].sort((e,n)=>t[e.level]-t[n.level])};function Es(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 Ds(e,t){if(e===null)return tr();if(t)return rr();let n=Math.floor(e/1e3);return lr({ago:n<3600?ve({n:String(Math.max(1,Math.floor(n/60)))}):n<86400?he({n:String(Math.floor(n/3600))}):fe({n:String(Math.floor(n/86400))})})}function Os(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 qr();case`blocked`:return Kr();case`idle`:return Ur();case`done`:return Vr();case`unknown`:return Gr();default:return e}}var As=3e4,js=[`pointermove`,`pointerdown`,`keydown`,`wheel`,`touchstart`];function Ms(e=document.documentElement){if(matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=Date.now(),n,r=()=>ce[e.dataset.view]?.calm===!1,i=()=>{let a=t+As-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,As)))};for(let e of js)addEventListener(e,a,{capture:!0,passive:!0});document.addEventListener(`visibilitychange`,()=>document.hidden||a()),a()}var Ns=0,Ps=`button:not([disabled]):not([hidden]), a[href]:not([hidden])`;function Fs(e,t){e.id||=`menu-${++Ns}`;let n=t?ki({name:t}):Ei();return b(`button`,{type:`button`,class:`pair-btn menu-btn`,popovertarget:e.id,"aria-haspopup":`true`,"aria-label":n,title:n},`⋯`)}function Is(e,t,n=``){let r=b(`div`,{class:`menu-pop hud-pop`,popover:`auto`,role:`group`,"aria-label":t?ki({name:t}):Ei()},...e);return b(`span`,{class:`menu ${n}`.trim()},Fs(r,t),r)}function Ls(e){let t=document.createComment(``);e.replaceWith(t);let n=Is([e]);return t.replaceWith(n),n}function Rs(e,t){let n=ki({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 zs(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 Bs(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 Vs=e=>e instanceof Element?e.closest(`.menu-pop`):null,Hs=e=>document.querySelector(`[popovertarget="${CSS.escape(e.id)}"]`);function Us(){document.addEventListener(`toggle`,e=>{let t=Vs(e.target);if(!t||e.newState!==`open`)return;let n=Hs(t);n&&zs(t,n),t.querySelector(Ps)?.focus({preventScroll:!0})},!0),document.addEventListener(`keydown`,e=>{let t=Vs(e.target);if(!t||!t.matches(`:popover-open`))return;if(e.key===`Escape`)return void(e.preventDefault(),t.hidePopover(),Hs(t)?.focus());let n=[...t.querySelectorAll(Ps)],r=Bs(n,n.indexOf(document.activeElement),e.key);r&&(e.preventDefault(),r.focus())}),document.addEventListener(`click`,e=>{let t=Vs(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 Ws=e=>e.route.view===`map`?``:e.route.ws;function Gs(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 Ks=e=>e?.u.role===`tower`&&e.base.tower?.key===e.u.key?e.base:void 0,T=(e,t)=>(t?t!==`live`:!e)||!(!e?.ended||e.control);function qs(e,t,n){return n?`readonly`:T(e,t)?t===`recent`||e?.ended?`closed`:`none`:`live`}function Js(e){if(e.route.view!==`session`)return;let t=e.route.key,n=Gs(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 Ys=[`phone`,`wifi`,`teams`,`server`],Xs=e=>{try{return decodeURIComponent(e)}catch{return e}},Zs=e=>/^\.+$/.test(e)?e.replaceAll(`.`,`%2E`):encodeURIComponent(e);function Qs(e){let[t,n]=e.split(`#`)[0].split(`?`),[r,i,a,o]=t.replace(/^\/+|\/+$/g,``).split(`/`).map(Xs);if(r===`settings`)return Ys.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 E=e=>e.view===`map`?``:e.view===`settings`?e.section?`settings/${e.section}`:`settings`:e.view===`workspace`?`w/${Zs(e.ws)}`:`w/${Zs(e.ws)}/s/${Zs(e.key)}${e.at?`?at=${encodeURIComponent(e.at)}`:``}`,$s=e=>e.view===`session`?{view:`workspace`,ws:e.ws}:{view:`map`},D=e=>e.view===`settings`?{view:`map`}:e,ec=e=>e.view===`session`?e.key:e.view===`workspace`?`w:${e.ws}`:null,tc=e=>Math.max(0,e?.depth||0);function nc(e,t=new URL(document.baseURI).pathname){let n=()=>Qs(location.pathname.slice(t.length)+location.search),r={route:n,href:e=>E(e)||`./`,go(n){let r=t+E(n);location.pathname+location.search!==r&&history.pushState({depth:tc(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`)&&tc(history.state)>0?history.back():r.go(Qs(t.getAttribute(`data-route`))))}),r}function rc(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?[b(`b`,null,Me({count:r.length}))]:[],...r.map(e=>{let n=Ee({device:e.label});if(!e.key)return b(`span`,{class:`ally-chip`,title:Oe()},n);let r=E({view:`session`,ws:t,key:e.key});return b(`a`,{class:`ally-chip`,href:r||`./`,"data-route":r,title:De()},n)})))}var ic=(e,t)=>e.allyRuns.length===1?es({device:e.allyRuns[0].label},t):e.allyRuns.length>1?Me({count:e.allyRuns.length},t):ya({},t),O=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1}),ac=e=>Math.max(1,Math.round(e.idleMs/6e4)),oc=(e,t)=>e.closing?Yt({},t):(e.idle?Qt:tn)({minutes:ac(e)},t);function sc(e,t){return{began:e.resumed?Jt({turns:e.turns},t):e.why?Gt({why:e.why},t):Ht({},t),...e.why?{why:e.why}:{},now:e.closing?kt({},t):e.idle&&e.idleAt?Vt({time:O(e.idleAt)},t):an({minutes:ac(e)},t),cap:Ot({time:O(e.capAt)},t)}}function cc(e,t){return{title:(e.resumed?Ft:Mt)({time:O(e.startedAt)},t),...e.endedAt?{ended:[Rt({time:O(e.endedAt)},t),e.note].filter(Boolean).join(` · `)}:{}}}function lc(e,t,n,r){if(!e)return n(t);switch(e.state){case`held`:return ns({},r);case`waking`:return rs({},r);case`closing`:return ts({},r);case`running`:return e.run?.kind===`ally`?ic(e,r):e.conversation&&t!==`waiting`?oc(e.conversation,r):n(t);case`standing`:return t===`idle`?e.allyRuns.length?ic(e,r):Wr({},r):n(t)}}var uc={crashed:e=>Do({},e),timeout:e=>ko({},e),quit:e=>Oo({},e)};function dc(e,t){if(!e||e.run)return;let n=Object.hasOwn(uc,e.lastRun?.outcome??``)?uc[e.lastRun.outcome](t):void 0;return n&&[n,e.crashes?Eo({count:e.crashes},t):``].filter(Boolean).join(` · `)}var fc=(e,t,n,r)=>[lc(e,t,n,r),dc(e,r)].filter(Boolean).join(` · `),pc=(e,t)=>e?.queued?Zo({count:e.queued},t):void 0,mc=`A run could not start: `,hc=`The tower could not check the standing pane for a program of yours, so it types nothing there; press Retry when it is free`,gc=`The standing pane is not at its own shell: a nested shell or a program runs there. Leave it, then press Retry`,_c=`The tower types nothing in the standing pane: `,vc=`An event was parked after two runs crashed with it: `;function yc(e,t){return(e.kind===`settings`||e.kind===`start`)&&e.text.startsWith(mc)?Vo({reason:e.text.slice(23)},t):e.kind===`start`&&e.text===hc?Ho({},t):e.kind===`start`&&e.text===gc?Po({},t):e.kind===`start`&&e.text.startsWith(_c)?Lo({reason:e.text.slice(46)},t):e.kind===`loop`?No({},t):e.kind===`late`&&e.text.startsWith(vc)?Mo({what:e.text.slice(52)},t):e.text}function bc(e,t){return[...(e?.notices??[]).filter(e=>!e.id.startsWith(`parked-`)).map(e=>({id:e.id,level:e.level,text:yc(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:os({text:e.text},t),actions:[`answer`]})),...(e?.memory?.proposals??[]).map(n=>({id:`proposal-${n.id}`,level:`warning`,text:Tc(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?Go({kind:e.kind,from:e.from,first:e.first},t):Jo({kind:e.kind,first:e.first},t),event:e.id,actions:[`deliver`,`drop`]}))]}function xc(e,t){if(!(e.status<400)){if(e.body.reason===`No such parked event`)return So({},t);if(e.body.reason?.startsWith(`The sb server stands in for no tower`))return Co({},t)}}async function Sc(e,t,n,r=1200){let i=e.textContent;e.disabled=!0,e.textContent=ss(),t(void 0);try{let e=await n();e.ok?r&&await new Promise(e=>setTimeout(e,r)):t(vo({reason:xc(e)??e.body.reason??e.body.error??String(e.status)}))}catch{t(vo({reason:ls()}))}finally{e.disabled=!1,e.textContent=i}}var Cc={standing:12,decision:24};function wc(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 Tc=(e,t)=>e.op===`retire`?fi({id:e.target??``,text:e.text},t):(e.kind===`standing`?li:oi)({text:e.text},t),Ec=(e,t)=>e.proposals.length?ri({standing:e.standing,decisions:e.decisions,waits:e.waits,proposals:e.proposals.length},t):ei({standing:e.standing,decisions:e.decisions,waits:e.waits},t);function Dc(e,t){return[e.kind===`wait`?Xr({},t):e.via===`proposal`?Yr({},t):Jr({},t),e.kind===`wait`?e.for===`boss`?xi({},t):_i({who:e.on??``},t):void 0,e.state===`answered`?bi({who:e.on??``},t):e.state===`resolved`?Ti({outcome:e.outcome??``},t):e.state===`expired`?Si({},t):void 0].filter(Boolean).join(` · `)}function Oc(e,t){return e.body.error===`rev`?mi({},t):String(e.body.reason??e.body.error??e.status)}var kc={retry:Ro,deliver:bo,drop:xo,answer:yo,confirm:Zr,reject:pi};function Ac(e,t,n,r){let a=bc(n),o=JSON.stringify([t,a]);e.dataset.sig!==o&&(e.dataset.sig=o,e.replaceChildren(...a.map(e=>{let n=b(`small`,{class:`tnote-fail`,role:`alert`}),a=b(`p`,{class:`tnote ${e.level}`},b(`span`,null,e.text));for(let o of e.actions){if(o===`answer`){let e=r?E({view:`session`,ws:t,key:r}):``,n=b(`a`,{class:`pair-btn`,href:e||`./`,"data-route":e},kc[o]());n.addEventListener(`click`,()=>document.querySelector(`.composer-root textarea`)?.focus()),a.append(n);continue}let s=b(`button`,{type:`button`,class:`pair-btn`},kc[o]()),[c,l]=e.proposal&&(o===`confirm`||o===`reject`)?[`memory`,o===`confirm`?{op:`confirm`,proposal:e.proposal,rev:e.rev}:{op:`reject`,proposal:e.proposal}]:[o,e.event?{id:e.event}:{}];s.onclick=()=>void Sc(s,e=>n.textContent=e??``,()=>i(`tower/${encodeURIComponent(t)}/${c}`,l)),a.append(s)}return a.append(n),a})))}var jc=140;function Mc(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`,Ai()),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(jc/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 Nc({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 Pc(e,t){if(t||!e.length)return[];let n=document.createElement(`style`);return n.textContent=e.map((e,t)=>`@keyframes pk${t}{${Nc(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 Fc=typeof document<`u`&&typeof document.querySelector==`function`&&((e=document)=>e.querySelector(`meta[name="sb-desk"]`)?.content===`1`)(),Ic=(e,t=Fc)=>t||e!==`127.0.0.1`,Lc=(e,t=Fc)=>({phone:!Ic(e,t),server:e===`127.0.0.1`}),Rc=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),zc=function(e,t){return new URL(e,t).href},Bc={},Vc=function(e){return e.pathname.endsWith(`.css`)},Hc=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},k=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=zc(t,n);let r=s(t),i=Vc(r);return Hc(Bc,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`:Rc,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 A(e,t,n,r,i=!1){Object.assign(e.dataset,t),[e.hidden,e.textContent]=[i,n],r&&e.setAttribute(`aria-label`,r)}var Uc=(e,t)=>t.role===`subagent`&&t.ended&&t.key?A(e,{close:`dismiss`,key:t.key,name:t.name,role:t.role},sn(),pn({name:t.name})):A(e,{close:`unit`,key:t.key??``,name:t.name,role:t.role},la(),gt({name:t.name}),!(t.control&&t.key)||t.role===`subagent`),Wc=(e,t)=>A(e,{key:t?.key??``,name:t?.name??``,role:`tower`},ua(),void 0,!t?.control);function Gc(e,t){e.dataset.close=`unit`,t?.u.role===`tower`&&t.base.tower?.key===t.u.key?Wc(e,t.base.tower):t&&Uc(e,t.u),e.hidden=!t||e.dataset.close!==`unit`||e.hidden}var Kc=(e,t)=>A(e,{ws:t.id,name:t.label},la(),tt({name:t.label})),qc=(e,t,n=Fc)=>A(e,{ws:t.id,name:t.label},Ra(),Va({name:t.label}),n),Jc=(e,t,n)=>A(e,{ws:t.id,name:n.label,tab:n.id},la(),st({name:n.label})),j=(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(Ze(),`later`,!1),o(t,`sheet-yes`,!0)]:[o(Qe(),`later`,!1)]),r.append(i,a),r.addEventListener(`close`,()=>(r.remove(),n(!1))),document.body.append(r),r.showModal()}),Yc=e=>ne(e).filter(e=>e.sub&&`ended`in e.unit&&e.unit.ended).map(e=>e.unit.key);function Xc(e,t){let n=Yc(t).length;e.hidden=!n,n&&(e.textContent=un({count:n}))}function Zc(e,t,n,r=Fc){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=qa({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`],A(r,{close:`pop`,name:e.name},ra(),oa({name:e.name})),t.append(n,r),t})))}var Qc=e=>k(async()=>{let{post:e}=await import(`./post-CmicYl-f.js`).then(e=>e.r);return{post:e}},[],import.meta.url).then(({post:t})=>t(`dismiss`,e)).then(e=>e.ok||(j(e.body.reason??C({status:e.status})),!1),()=>(j(S()),!1));function $c(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 el(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 Qc(r.close===`dismiss`?{key:r.key}:{all:!0});if(r.close===`pop`)return void(n.toggleAttribute(`disabled`,!0),Promise.all([k(()=>import(`./post-CmicYl-f.js`).then(e=>e.r),[],import.meta.url),k(()=>import(`./refusal-CTAnRvLI.js`).then(e=>e.n),[],import.meta.url)]).then(([{post:e},{reasonOf:t}])=>e(`close/pop`,{name:r.name}).then(e=>e.ok||j(t(e.body.reason,e.body.settings)??C({status:e.status})))).catch(()=>j(S())).finally(()=>n.toggleAttribute(`disabled`,!1)));j((r.close===`stash`?Wa:r.close===`base`?it:r.close===`tab`?ut:r.role===`tower`?pt:yt)({name:r.name??``}),r.close===`stash`?Ra():la()).then(t=>{t&&(n.toggleAttribute(`disabled`,!0),k(async()=>{let{post:e}=await import(`./post-CmicYl-f.js`).then(e=>e.r);return{post:e}},[],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?$c(r,e):j(t.body.reason??C({status:t.status})),()=>j(S())).finally(()=>n.toggleAttribute(`disabled`,!1)))})}})}var tl={main:`main`,member:`member`,subagent:`subagent`,outpost:`outpost`,outside:`outside`,tower:`tower`,ally:`tower`,run:`tower`},M={commanding:Br,working:qr,waiting:Kr,idle:Ur,done:Vr,error:Hr,unknown:Gr},nl={ally:ya,run:wa,main:ba,member:xa,subagent:Ea,tower:Da,outpost:Sa,outside:Ca,session:Ta},rl={thinking:Ui,"watching a monitor":Hi,idle:Ur,"waiting on a question":Kr,finished:Vr},il={claude:`Claude`,codex:`Codex`},al=e=>Object.hasOwn(nl,e)?nl[e]():e,ol=e=>e===`waiting`||e===`error`,N=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)},P=(e,t)=>{let n=document.getElementById(e);if(!(n instanceof t))throw Error(`#${e} is missing from the page`);return n},F=(e,t,n)=>{let r=e.querySelector(t);r.textContent!==n&&(r.textContent=n)},I=(e,t)=>{if(e.dataset.mark===t)return;let n=e.dataset.mark!==void 0;e.dataset.mark=t,n&&y(e,`flash`)},sl=e=>(t=>(e.slice(8,t)===`stale`?Ii:Ni)({what:e.slice(t+1)}))(e.indexOf(`:`,8)),L=(e,t)=>e?e.startsWith(`tool:`)?fs({tool:e.slice(5)}):e.startsWith(`monitor:`)?sl(e):Object.hasOwn(rl,e)?rl[e]():e:M[t](),cl=(e,t,n)=>T(e,t)?``:n===`working`||n===`commanding`?L(e?.note,n):ol(n)?M[n]():``,ll=(e,t,n)=>T(e,t)&&(n===`working`||n===`commanding`)?`done`:n,ul=(e,t,n,r,i=L(n,r))=>{F(e,t,i),e.querySelector(t).toggleAttribute(`data-monitoring`,i===L(n,r)&&n===`watching a monitor`)},dl=(e,t)=>{e.toggleAttribute(`hidden`,!t),t&&(e.setAttribute(`href`,E(t)||`./`),e.setAttribute(`data-route`,E(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`},pl=`<div class="plate"><i class="ring"></i><svg><use href="#i-main"/></svg><b class="badge"></b></div>`;function ml(e,t,n,r){I(e,n);let i=e.querySelector(`use`),a=`#i-${tl[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 R(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 hl=(e,t=Math.max(0,Date.now()-e)/1e3)=>t<60?xe({n:String(Math.floor(t))}):t<3600?ve({n:String(Math.floor(t/60))}):t<86400?he({n:String(Math.floor(t/3600))}):fe({n:String(Math.floor(t/86400))}),gl=(e,t)=>(t===void 0?delete e.dataset.since:e.dataset.since=String(t),e.textContent=t===void 0?``:hl(t));function _l(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=()=>N(`<div class="unit"><div class="card"><a class="hit"></a>${pl}<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 z(e,t){let n=e.closest(`.base`)?.dataset.key,r=e.querySelector(`.hit`),i=ll(t,void 0,t.mark),a=T(t)?void 0:t.note;dl(r,t.key&&n?{view:`session`,ws:n,key:t.key}:void 0),r.setAttribute(`aria-label`,`${t.name}: ${L(a,i)}`),r.toggleAttribute(`data-alert`,ol(i)),I(e,i),ml(e.querySelector(`.plate`),t.role,i,t.docs),F(e,`.name`,t.name),F(e,`.role`,al(t.role)),F(e,`.agent`,t.agent?il[t.agent]:``),ul(e,`.note`,a,i),gl(e.querySelector(`:scope > .card .age`),t.since);let o=e.querySelector(`:scope > .card .todo`);o.hidden=!t.todo,t.todo&&(F(o,`b`,`${t.todo.done<t.todo.total?`◐`:`✓`} ${t.todo.done}/${t.todo.total}`),F(o,`span`,t.todo.now??``)),_l(e.querySelector(`:scope > .card`),t.ticks),Uc(e.querySelector(`:scope > .card > .quit-btn`),t),R(e.querySelector(`.subs`),t.subs??[],vl,z)}function yl(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`?$i():ea())&&(e.textContent=r===`main`?$i():ea())}var bl=()=>N(`<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>${hn()}</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="${ta()}"></div></section>`),xl=()=>{let e=bl();return Ls(e.querySelector(`header > .quit-btn`)),e},Sl=e=>fc(e.service,e.mark,e=>M[e]());function Cl(e,t){I(e,t.mark),e.classList.toggle(`head`,t.head);let n=e.querySelector(`.tower`);n.classList.toggle(`ghost`,!t.tower),I(n,t.tower?.mark??`unknown`),F(e,`h2 a`,t.label),dl(e.querySelector(`h2 a`),{view:`workspace`,ws:t.id}),F(e,`.title .tstate`,t.tower?Tt({state:Sl(t.tower)}):Vi()),F(e,`.title .tqueue`,pc(t.tower?.service)??``),gl(e.querySelector(`.title .age`),t.tower?.since),yl(e.querySelector(`.spawn-btns button`),t),Kc(e.querySelector(`header .menu-pop > .quit-btn`),t),Rs(e.querySelector(`header > .menu`),t.label),qc(e.querySelector(`.spawn-btns [data-close=stash]`),t),Wc(e.querySelector(`.tower-quit`),t.tower),R(e.querySelector(`.tower-subs`),t.tower?.subs??[],vl,z),rc(e.querySelector(`.title .allies`),t.id,t.tower?.service),Ac(e.querySelector(`.tower-notices`),t.id,t.tower?.service,t.tower?.key),R(e.querySelector(`.tabs`),t.tabs,()=>{let e=N(`<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 Ls(e.querySelector(`h3 > .quit-btn`)),e},(e,n)=>{F(e,`h3 span`,oo({label:n.label})),Jc(e.querySelector(`.menu-pop > .quit-btn`),t,n),Rs(e.querySelector(`h3 > .menu`),oo({label:n.label})),yl(e.querySelector(`.tab-add`),t,n.id),R(e.querySelector(`.units`),n.units,vl,z)}),R(e.querySelector(`.outposts`),t.outposts.map(e=>({id:e.id,name:e.label,role:`outpost`,mark:e.mark,note:e.mark===`unknown`?zi():void 0,since:e.since,ticks:e.ticks})),vl,z)}var wl=()=>N(`<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 Tl(e,t){let n=Os(t);I(e,n),e.classList.toggle(`offline`,!t.online),I(e.querySelector(`.tower`),n),F(e,`.ally-tag`,Fe({team:t.teamName})),F(e,`h2`,t.workspace??t.label),F(e,`.tstate`,`${t.workspace?`${t.label} · `:``}${t.short} · ${t.online?ks(t.tower):nr()}`),R(e.querySelector(`.ally-tabs`),t.tabs.map((e,t)=>({id:`${t}`,...e})),()=>N(`<li class="ally-tab"><b></b><span></span></li>`),(e,n)=>{F(e,`b`,n.label),F(e,`span`,t.online?ks(n.state):``),e.dataset.state=n.state})}function El(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(...Pc(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 Dl=2,Ol=20;function kl(){let[e,t,n,r]=[P(`map`,HTMLElement),P(`bases`,HTMLElement),P(`links`,SVGSVGElement),P(`packets`,HTMLElement)],i=matchMedia(`(prefers-reduced-motion: reduce)`).matches,a=new Set,o=Mc(e,t),s=()=>(o(),!e.hidden&&El(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+Ol)/Dl)}`),l()));return setInterval(()=>document.querySelectorAll(`.age[data-since]`).forEach(e=>gl(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`)),Ms(),{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);P(`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`)]])P(t,HTMLElement).textContent=r},show(e){let n=(e.link?.allies??[]).map(e=>({...e,id:`ally/${e.id}`,ally:!0}));R(t,[...e.bases,...n],e=>`ally`in e?wl():xl(),(e,t)=>`ally`in t?Tl(e,t):Cl(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 Al=(e,t)=>n=>n&&!e()&&t();function jl(e,t){let n=P(`link-alerts`,HTMLButtonElement),r=P(`link-alerts-pop`,HTMLElement),a=P(`link-alerts-list`,HTMLElement),o=``,s=new Set,c=!0;r.addEventListener(`toggle`,e=>e.newState===`open`&&fl(r,n)),r.setAttribute(`aria-label`,Xn()),n.title=Xn();let l=(e,t,n)=>{let r=n.querySelector(`.link-note`);for(let e of n.querySelectorAll(`button`))e.disabled=!0;i(`link/confirm-answer`,{dialogId:e.dialogId,allow:t}).then(e=>{e.ok||(r.textContent=e.body.reason??C({status:e.status}));for(let e of n.querySelectorAll(`button`))e.disabled=!1},()=>{r.textContent=S();for(let e of n.querySelectorAll(`button`))e.disabled=!1})},u=e=>{let t=b(`li`,{class:`link-alert`,"data-level":`warning`}),n=b(`button`,{type:`button`,class:`pair-btn`},Zn()),r=b(`button`,{type:`button`,class:`pair-btn`},$n());return n.onclick=()=>l(e,!0,t),r.onclick=()=>l(e,!1,t),t.append(b(`b`,null,ws({id:``,kind:`confirm`,level:`warning`,team:e.team,teamName:``,data:{label:e.fromLabel,short:e.fromShort,tool:e.tool,tower:e.tower}})),b(`pre`,{class:`link-args`},e.args),b(`div`,{class:`devices-acts`},n,r),b(`small`,{class:`link-note`,role:`status`})),t};return{net(i){let l=Ts((i?.alerts??[]).filter(e=>e.kind!==`confirm`)),d=i?.confirms??[],f=JSON.stringify([l,d]);if(f===o)return;o=f;let p=new Set([...d.map(e=>`c/${e.dialogId}`),...l.filter(e=>e.kind===`join-request`).map(e=>e.id)]);c||t([...p].filter(e=>!s.has(e)).length),[s,c]=[p,!1];let m=l.length+d.length;n.hidden=m===0,n.textContent=Yn({count:String(m)}),n.dataset.state=d.length||l.some(e=>e.level===`error`)?`error`:l.some(e=>e.level===`warning`)?`waiting`:`done`,!m&&r.matches(`:popover-open`)&&r.hidePopover(),a.replaceChildren(...v(...d.map(u),...l.map(t=>{let n=b(`li`,{class:`link-alert`,"data-level":t.level},b(`span`,null,ws(t)));if(t.kind===`join-request`||t.kind===`fork`||t.kind===`mismatch`){let i=b(`button`,{type:`button`,class:`later`},t.kind===`join-request`?or():ir());i.onclick=()=>(r.hidePopover(),e()),n.append(i)}if(t.kind===`served`){let e=b(`a`,{class:`later`,href:`./`,"data-route":``},ur());e.onclick=()=>r.hidePopover(),n.append(e)}return n})))}}}var Ml=45e3,Nl=1e3,Pl=3e4,Fl={state:`connecting`,attempt:0},Il=(e,t)=>Math.min(Pl,Nl*2**(e-1))*(.8+.4*t);function Ll(e){try{return JSON.parse(e)}catch{return}}function Rl(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(),Ml),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,Il(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=Ll(r);i&&e.onNet(i),o({problem:i?void 0:sa()}),l()}),n.listen(`ping`,()=>t===n&&l()),n.listen(`problem`,e=>{t===n&&(o({problem:Ll(e)??ca()}),l())}),r=e.setTimeout(()=>u(),Ml)};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()}}}function zl(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 Bl(e){let t=()=>({away:e.root.dataset.zenAway!==void 0,settings:e.settings()});function n(n){let r=t(),i=zl(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})}}function Vl(e){let t={view:`map`},n,r,i,a=Fl,o,s,c=null,l=null,u=()=>le(e.view.view(),e.root.dataset.zenAway!==void 0||t.view===`settings`),d=()=>u()===ce.zen,f=()=>d()&&c||ec(t);function p(){let t=f();t!==l&&(l=t,e.restart())}let m=t=>e.icon(u().count?re(ne(t).map(e=>e.unit)).length+(t.trust?.length??0):0);function h(){let t=d();e.zenEl.hidden=!t,t?e.withZen(e=>d()&&(n&&e.net(oe(n,Date.now()),n),e.show())):e.zen()?.hide(),n&&m(n),p()}let te=Bl({view:e.view,root:e.root,settings:()=>t.view===`settings`,leaveSettings:e.leaveSettings,draw:()=>(e.back(),h())});function g(a){n=r=a,m(a),e.link(a.link);let c=oe(a,Date.now()),l=u();if(l.announce===`current`)return void(s=c,e.withZen(e=>e.net(c,a)));if(s&&l.signal&&e.signal(se(s,c)),s=c,e.hidden())return;let d=se(o,c);o=c,e.draw(a,d,c),t.view===`map`&&(e.map(a),i=a,r=void 0)}let ie=()=>void(r&&g(r)),_=t=>e.withPanels(e=>e.stack.show(t));function v(t,n,{mode:r,at:i}={}){if(r===`term`&&d())return e.withZen(e=>d()?e.terminal({key:n}):v(t,n,{mode:r,at:i}));r===`term`&&e.panels()?.stack.close(`go`),e.go({view:`session`,ws:t,key:n,at:i}),r===`term`&&e.withFocus(e=>e.terminal(n))}function y(t){if(d())return e.withZen(e=>d()?e.step(t):y(t));e.withPanels(e=>e.step(t,n))}return{get current(){return t},get latest(){return n},alertOf:e=>o?.get(e),rules:u,zenOn:d,watch:f,face:te,snapshot:g,sync:h,online:()=>a.state===`live`,status(t){a=t,e.zen()?.refresh()},opened:()=>l=f(),wake:ie,route(r){let a=t;t=r,r.view===`settings`!=(a.view===`settings`)&&te.route(r.view===`settings`),e.navigate(r,a),r.view===`map`&&n&&n!==i&&(g(n),e.layout()),p()},openAlert:_,openSession:v,openStep:y,leaveZen({item:t,route:n}){te.leave(),t&&_(t),n&&e.go(n),ie()},enterZen:()=>ee(e.view,e.root),notified:e=>u().announce===`current`||(e.trust?_(e):v(e.ws,ae(e))),news:Al(()=>!u().chime,e.chime),keys:()=>u().keys,modal:()=>e.modal(),hotkey:t=>(t===`next`||t===`zoom`?e.panels()?.hotkey(t):e.zen()?.key(t))??!1,newest:()=>n,openSettings:()=>e.go({view:`settings`}),noDrawer:()=>!u().drawer,escape(n,r){if(!(n.key!==`Escape`||n.defaultPrevented||e.modal())){if(r)return void(!n.isComposing&&d()&&e.zen()?.escape(n)&&n.stopPropagation());d()||(n.preventDefault(),!(e.panels()?.stack.close()||t.view===`map`)&&(t.view===`settings`?e.leaveSettings():e.go($s(t))))}},watchLog(e){c=e,p()}}}function Hl(t){let n=/^zh\b/i.test(t)&&(/-(hant|tw|hk|mo)\b/i.test(t)?`zh-TW`:/-(hans|cn|sg|my)\b/i.test(t)?`zh-CN`:void 0);return e(t)??(n?e(n):void 0)??e(t.split(`-`)[0])}function Ul(t,n){return e(t)??n.map(Hl).find(Boolean)??`en`}var Wl={brand_label:Xe,menu_more:Ei,tagline:so,totals_label:ho,stat_bases:Ya,stat_agents:Ja,stat_working:Qa,stat_waiting:Za,stat_commanding:Xa,mark_commanding:Br,alerts:Se,no_alerts:Bi,link_connecting:Qn,connect_connecting:bt,connect_retry:St,location:fr,all_bases:Ce,documents:mn,timeline:co,states:ro,mark_working:qr,mark_waiting:Kr,mark_idle:Ur,mark_done:Vr,mark_error:Hr,credit:on,language:gn,view_label:vs,view_auto:ps,view_standard:ys,view_geek:_s,view_zen:xs,zen_back:Ss,zen_back_title:Cs,view_title:bs,settings:Na,new_base:Ri,back:Ie,remind:pa,sound:Pa,sound_volume:La,sound_try:Ia,sound_title:Fa,set_device:Oa,set_device_note:ka,set_phone:Aa,set_teams:Ma,set_server:ja};Object.keys(Wl);function Gl(e,t=localStorage,n=()=>location.reload()){return s(t).set(`locale`,e)?(n(),!0):!1}var Kl=()=>t.map(e=>({id:e,name:dr({},{locale:e})}));function ql(){let e=Ul(c.get(`locale`),navigator.languages??[navigator.language]);n(()=>e),document.documentElement.lang=e;let r={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(r))e.dataset[t]&&n(e,Wl[e.dataset[t]]?.()??e.dataset[t]);let i=document.getElementById(`lang`);i.replaceChildren(...t.map(t=>new Option(dr({},{locale:t}),t,!1,t===e))),i.onchange=()=>Gl(i.value)||(i.value=e)}var Jl=e=>e===`auto`?ps():gs({view:e===`geek`?_s():e===`zen`?xs():ys()}),Yl=e=>e.state===`live`?void 0:e.state,Xl={connecting:bt,reconnecting:xt,offline:e=>Ve({tries:e.attempt-1}),replaced:Ye},Zl=[`click`,`dblclick`,`auxclick`,`contextmenu`,`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`keydown`,`keyup`,`keypress`,`submit`,`dragstart`],Ql=new Set([`click`,`dblclick`,`auxclick`,`contextmenu`,`submit`]),B=e=>document.getElementById(e),$l=()=>({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 eu(e,t=$l()){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 Zl)n.addEventListener(e,t=>{!o||r.contains(t.target)||t.target?.closest?.(`dialog:modal`)||(t.stopPropagation(),Ql.has(e)&&t.preventDefault())},!0),r.addEventListener(e,e=>e.stopPropagation());return t.reload?.remove(),t.retry.addEventListener(`click`,e),e=>{if(o=Yl(e),!o)return d();r.dataset.state=o,i.textContent=Xl[o](e),t.retry.hidden=o!==`offline`,u()}}var tu=`input, textarea, select, [role=textbox], [role=combobox], [role=listbox], .term-scroll`,nu=`button, a, summary, [role=button], [role=link]`,ru=`.ask-opt, [role=radio], [role=checkbox]`,iu=`dialog.sheet[open], dialog.lightbox[open], [popover]:popover-open`,au={dialogs:[{keys:[`f`],hotkey:`zoom`},{keys:[` `],hotkey:`next`,native:`keyboard`}]};function ou(e,t,n=!1,r=`dialogs`,i){if(t||e.defaultPrevented||e.isComposing)return;let a=e.key.toLowerCase(),o=au[r]?.find(t=>t.keys.includes(a)&&(t.takes?t.takes(e,i):!e.metaKey&&!e.ctrlKey&&!e.altKey)),s=e.target;if(!(!o||(o.blocks?o.blocks(s):s?.isContentEditable||s?.closest?.(tu)))&&(!o.native||!s?.closest?.(nu)||o.native!==`any`&&n)&&!(a===` `&&s?.closest?.(ru)))return o.hotkey}function su(e,t=()=>document.querySelector(iu)!==null,n=window,r=()=>`dialogs`,i){let a,o=!1,s=null;n.addEventListener(`pointerdown`,()=>o=!0,!0),n.addEventListener(`focusin`,e=>s=o?e.target:null,!0),n.addEventListener(`keydown`,n=>{let c=n.target===s;o=!1;let l=ou(n,t(),c,r(),i?.());if(l){if(n.repeat)return a===l?n.preventDefault():void 0;e(l)&&(a=l,n.preventDefault())}}),n.addEventListener(`keyup`,e=>{(a===`next`||a===`pause`)&&e.key===` `&&e.preventDefault(),a=void 0})}function cu(e=()=>new AudioContext,t=e=>fetch(e).then(e=>e.arrayBuffer())){let n,r,i=1,a=new Map,o=()=>(n??=e(),r||((r=n.createGain()).connect(n.destination),r.gain.value=i),{c:n,g:r});return{volume:e=>void(i=(e/100)**2,r&&(r.gain.value=i)),unlock:()=>o().c.resume().then(()=>o().c.state===`running`,()=>!1),out:o,running:()=>n?.state===`running`,play(e){let{c:n,g:r}=o();a.has(e)||a.set(e,t(e).then(e=>n.decodeAudioData(e))),Promise.all([n.resume(),a.get(e)]).then(([,e])=>{let t=n.createBufferSource();t.buffer=e,t.connect(r),t.start()}).catch(()=>a.delete(e))}}}var lu=cu(),uu=new URL(`done-jqKY4qf5.mp3`,import.meta.url).href,du=new URL(`error-DdTLgPEw.mp3`,import.meta.url).href,fu={waiting:new URL(`waiting-DOg8-8gu.mp3`,import.meta.url).href,error:du,done:uu},pu=e=>e.mark===`waiting`||e.pending?`waiting`:e.mark===`error`?`error`:e.mark===`done`?`done`:void 0;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=c.get(`remind`),l=c.get(`sound`),u=c.get(`volume`),d=[],f=()=>{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`?_a():e===`denied`?ha():ma():ga():va(),t(`remind-note`).textContent=n.title,r.dataset.state=l?`on`:`off`,n.textContent={off:to,on:no,blocked:eo,ask:$a}[n.dataset.state](),r.textContent=l?no():to(),r.setAttribute(`aria-pressed`,String(l)),i.value=a.value=String(u),lu.volume(u)};n.onclick=async()=>{s&&o&&Notification.permission==="default"?await Notification.requestPermission().catch(()=>{}):c.set(`remind`,s=!s),f()};let p=e=>{c.set(`sound`,l=e),f(),l&&h(`done`)},m=e=>(c.set(`volume`,u=e),f());c.on(`sound`,()=>(l=c.get(`sound`),f(),d.forEach(e=>e()))),c.on(`volume`,()=>(u=c.get(`volume`),f(),d.forEach(e=>e()))),r.onclick=()=>p(!l),i.oninput=()=>m(Number(i.value)),i.onchange=()=>h(`done`),t(`sound-try`).onclick=()=>h(`done`);let h=e=>lu.play(fu[e]);function ee(t,n){if(!s||!o||Notification.permission!==`granted`||!document.hidden&&document.hasFocus())return;let r=new Notification(t.name,{body:t.trust?cs():{waiting:Qi,error:Yi,done:Ki}[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 f(),{remind:e=>ee(e,`waiting`),sound:{on:()=>l,volume:()=>u,set:p,setVolume:m,try:()=>h(`done`),onChange:e=>void d.push(e)},chime:()=>l&&h(`done`),signal(e){let t=e.flatMap(e=>(t=>t?[{a:e,k:t}]:[])(pu(e)));if(t.length){l&&h([`waiting`,`error`,`done`].find(e=>t.some(t=>t.k===e)));for(let{a:e,k:n}of t)ee(e,n)}}}}var hu,gu=e=>void(hu=e);function _u(e,t){if(`terminal`in e)return void(t.key&&hu?.({kind:`prompt`,key:t.key,asker:t.key,command:t.command,...e.run&&t.answerId?{run:t.answerId}:{}}));if(e.pane===null)return na();hu?.({kind:`pane`,key:`grant:${e.pane}`,asker:t.key,command:t.command})}var vu={commanding:hr,working:zr,waiting:Ir,idle:wr,done:vr,error:xr,unknown:Nr},yu=e=>(e.kind===`joined`?Dr:e.kind===`left`?Ar:vu[e.mark])({name:e.name}),bu=18e5,xu={waiting:0,error:0,working:1,commanding:1},Su=e=>new Date(e).toLocaleTimeString([],{hour12:!1});function Cu(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()-bu,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)/bu*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:${(xu[t.mark]??2)*14+4}px`,n.setAttribute(`aria-label`,`${Su(t.at)} ${yu(t)}`),dl(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:Su(e+t*6e4).slice(0,5)})),Object.assign(document.createElement(`span`),{textContent:uo()})),r.textContent=c?Su(c.at):``,i.textContent=c?yu(c):lo(),a.textContent=mo({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 wu(e,t=fetch){return e.startsWith(`data:`)?decodeURIComponent(e.slice(e.indexOf(`,`)+1)):t(e).then(e=>e.text(),()=>void 0)}function Tu(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 V=m(void 0);ql(),Us(),h(document.getElementById(`view-pick`),V,Jl);var H=kl(),Eu=Cu(document.getElementById(`timeline`)),U=e=>document.getElementById(e),Du=document.documentElement,Ou=te(U(`zen-back`),V,Du,()=>J.enterZen()),ku=e=>e?new Date(e).toLocaleTimeString([],{hour12:!1}):Li(),Au=!1,ju=``,W,Mu,G=e=>W?e(W):void Mu?.then(e);function Nu(){Mu??=k(async()=>{let{mountFocus:e}=await import(`./views-LUsmInsF.js`);return{mountFocus:e}},[],import.meta.url).then(({mountFocus:e})=>(W=e({data:ud,restart:()=>Q.restart(),openTile:Ru,embedTerminal:(e,t,n)=>Pu(e,t,n,{keys:!1}),online:J.online}),W.show(D(J.current),D(J.current)),J.latest&&W.net(J.latest),W))}var Pu=(e,t,n,r)=>new Promise(i=>q(a=>i(a.terminal.embed(e,t,n,r)))),Fu=()=>new Promise(e=>q(t=>e(t.kit))),Iu=e=>J.latest?.bases.find(t=>t.id===e)?.label??e,K,Lu,q=e=>{if(K)return e(K);Lu??=k(async()=>{let{mountPanels:e}=await import(`./layer-D_Nd21Va.js`);return{mountPanels:e}},[],import.meta.url).then(({mountPanels:e})=>K=e({label:Iu,recent:dd,post:e=>X&&((t,n)=>X.data(e).post(t,n)),trust:X&&X.trust,stream:()=>ju,showTerminal:(e,t)=>J.openSession(e,t,{mode:`term`})})),Lu.then(e)},Ru=(e,t)=>q(n=>n.tiles.open(e,t)),zu,Bu,Vu=e=>{Bu??=k(async()=>{let{mountZen:e,zenPage:t}=await import(`./zenchunk-CwupAPRd.js`);return{mountZen:e,zenPage:t}},__vite__mapDeps([0]),import.meta.url).then(({mountZen:e,zenPage:t})=>{let n=t({sound:Y.sound,api:X?.api??cd,snapshot:J.newest});return zu=e(U(`zen`),{data:ud,recent:dd,label:Iu,online:J.online,post:e=>X&&((t,n)=>X.data(e).post(t,n)),trust:X&&X.trust,remind:e=>Y.remind(e),sound:n.sound,menu:{language:{get:r,names:Kl,set:Gl},view:{choice:()=>V.choice(),set:e=>V.set(e),auto:()=>Jl(V.server())},sound:{...Y.sound,...n.menuSound}},music:n.music,leave:J.leaveZen,terminals:Fu,watch:J.watchLog,companions:n.companions,activity:n.activity,settings:J.openSettings,start:X?.start})}),Bu.then(e)},Hu=Lc(location.hostname),Uu=Hu.phone,Wu,Gu=e=>void(Wu??=k(async()=>{let{mountSettings:e}=await import(`./settings-BuDk0PId.js`);return{mountSettings:e}},[],import.meta.url).then(({mountSettings:e})=>e(U(`settings-view`),Hu))).then(e),Ku=e=>J.current.view===`settings`?Gu(t=>t.show(e)):Z.go({view:`settings`,section:e}),qu=document.querySelector(`link[rel="icon"]`),Ju=qu?wu(qu.href):void 0,Yu=0;function Xu(e){qu&&Ju&&e!==Yu&&(Yu=e,Ju.then(t=>t&&e===Yu&&(qu.href=Tu(t,e))))}function Zu(){let e=U(`dismiss-all`).hidden&&U(`stashed`).hidden;U(`bar-more`).hidden=e,e&&U(`bar-pop`).matches(`:popover-open`)&&U(`bar-pop`).hidePopover()}function Qu(e,t,n){H.stats(e),Xc(U(`dismiss-all`),e),Zc(U(`stashed`),U(`stashed-list`),e),Zu(),$?.net(e),(t.length||K)&&q(r=>r.alerts(t,n,e)),Eu.net(e),G(t=>t.net(e))}function $u(e,t){let n=e.view===`workspace`&&t.view===`map`?document.querySelector(`#bases [data-key="${CSS.escape(e.ws)}"]`)?.getBoundingClientRect():void 0;document.body.dataset.route=e.view,$?.route(e),(e.view===`workspace`||e.view===`session`)&&Nu(),U(`map`).hidden=e.view!==`map`,U(`settings-view`).hidden=e.view!==`settings`,U(`crumbs`).hidden=e.view===`settings`,U(`legend`).hidden=e.view===`session`||e.view===`settings`,U(`prefs`).toggleAttribute(`aria-current`,e.view===`settings`),U(`stage`).dataset.view=e.view,G(r=>r.show(D(e),D(t),n)),e.view===`settings`?Gu(t=>J.current===e&&t.show(e.section)):t.view===`settings`&&Gu(e=>e.hide())}var ed=()=>tc(window.history.state)>0?window.history.back():Z.go({view:`map`}),J=Vl({view:V,root:Du,zenEl:U(`zen`),zen:()=>zu,withZen:Vu,hidden:()=>document.hidden,back:Ou,leaveSettings:ed,restart:()=>Au&&Q.restart(),icon:Xu,link:e=>td.net(e),signal:e=>Y.signal(e),draw:Qu,map:H.show,navigate:$u,layout:()=>requestAnimationFrame(H.layout),panels:()=>K,withPanels:q,withFocus:G,go:e=>Z.go(e),modal:()=>document.querySelector(iu)!==null,chime:()=>Y.chime()});gu(J.openStep);var td=jl(()=>Ku(`teams`),J.news),Y=mu(J.notified);function nd(e){md(e),J.status(e);let t=e.state===`reconnecting`||e.state===`offline`||e.state===`replaced`;document.body.dataset.stale=U(`stage`).dataset.stale=String(t),U(`link`).dataset.state=e.state,U(`link-text`).textContent={connecting:Qn,live:er,reconnecting:ar,offline:nr,replaced:nr}[e.state](),W&&J.latest&&W.net(J.latest),K?.stack.redraw();let n=U(`banner`);n.hidden=!t&&!e.problem;let r=e.state===`replaced`?Ye():e.state===`offline`?Ve({tries:e.attempt-1}):e.state===`reconnecting`?e.attempt?Je({attempt:e.attempt}):Ge():We({problem:e.problem??``}),i=document.createElement(`b`);i.textContent=ku(e.lastContact),n.replaceChildren(`${r} ${Re()} `,i,Le())}function rd(e,t){try{let n=JSON.parse(t);e===`history`&&zu?.history(n),G(t=>e===`history`?t.history(n):t.cards(n))}catch{}}var id=document.querySelector(`meta[name="sb-build"]`)?.content,ad=e=>!!(id&&id!==JSON.parse(e).build);function od(e,t=!1){try{let n=JSON.parse(e),r=t?n:n?.view;typeof r==`string`&&V.setServer(r)}catch{}}function sd(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 cd=e=>fetch(`api/${e}`,{cache:`no-store`}).then(e=>e.ok?e.json():Promise.reject(Error(String(e.status)))),ld=(e,t=``)=>cd(`history/${encodeURIComponent(e)}${t}`),X=void 0,ud=e=>({older:t=>ld(e,`?before=${encodeURIComponent(t)}`),latest:()=>ld(e),entry:t=>cd(`entry/${encodeURIComponent(e)}/${encodeURIComponent(t)}`).catch(()=>void 0),pic:(t,n)=>`api/image/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${n}`}),dd=async e=>(await ld(e,`?limit=12`)).items,fd=()=>{let e=sd(J.opened());return e.listen(`history`,e=>rd(`history`,e)),e.listen(`cards`,e=>rd(`cards`,e)),e.listen(`hello`,e=>ad(e)?location.reload():(ju=e,od(e),K?.terminal.hello())),e.listen(`view`,e=>od(e,!0)),e.listen(`mirror`,e=>K?.terminal.frame(e)),e};document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[data-alert]`),n=t&&Qs(t.getAttribute(`data-route`)??``);if(!n||n.view!==`session`||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let r=J.alertOf(n.key);r&&(e.preventDefault(),J.openAlert(r))},!0);var Z=nc(e=>J.route(e)),Q=Rl({open:fd,now:Date.now,setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e),random:Math.random,hidden:()=>document.hidden,onNet:J.snapshot,onStatus:nd,replaced:()=>fetch(`./`,{cache:`no-store`}).then(e=>e.status===403)}),pd=()=>Q.resume(),md=eu(pd);document.addEventListener(`visibilitychange`,()=>{if(H.pause(document.hidden),zu?.visible(!document.hidden),document.hidden)return Q.hide();J.wake(),G(e=>e.wake()),pd()}),addEventListener(`keydown`,e=>J.escape(e,!0),!0),addEventListener(`keydown`,e=>J.escape(e,!1)),su(J.hotkey,J.modal,window,J.keys),U(`prefs`).addEventListener(`click`,e=>J.current.view===`settings`&&(e.preventDefault(),ed())),Uu&&k(async()=>{let{mountLanWait:e}=await import(`./lanwait-B5xr0Cu-.js`);return{mountLanWait:e}},[],import.meta.url).then(({mountLanWait:e})=>e(U(`lan-wait`),()=>Ku(`wifi`)));var $,hd=matchMedia(`(pointer: coarse), (max-width: 640px)`),gd=()=>void k(async()=>{let{mountDrawer:e}=await import(`./drawer-c2IPPoTf.js`);return{mountDrawer:e}},[],import.meta.url).then(({mountDrawer:e})=>($??=e(J.noDrawer),J.latest&&$.net(J.latest),$.route(J.current)));hd.matches?gd():hd.addEventListener(`change`,()=>hd.matches&&!$&&gd(),{once:!0}),el({route:()=>D(J.current),net:()=>J.latest,go:e=>Z.go(e)}),U(`stashed-pop`).addEventListener(`toggle`,e=>e.newState===`open`&&fl(U(`stashed-pop`),U(`stashed`))),document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`button[data-open]`);t&&k(async()=>{let{openingOf:e,spawnTile:t}=await import(`./spawn-Fs38-uFE.js`);return{openingOf:e,spawnTile:t}},[],import.meta.url).then(({openingOf:e,spawnTile:n})=>{let r=e(t,J.latest?.bases??[]);r&&Ru(n(r,(e,t,n)=>(K?.tiles.close(n),J.openSession(e,t)),()=>Y.chime()),!0)})});for(let e of[`focus`,`pageshow`,`online`])window.addEventListener(e,()=>!document.hidden&&pd());nd(Fl),J.route(Z.route()),J.sync(),Q.start(),Au=!0;export{Cs as $,Cc as A,Tn as At,pc as B,Ce as Bt,ol as C,Ei as Ct,Xc as D,Kn as Dt,Qc as E,Hr as Et,Ec as F,Qe as Ft,T as G,ae as Gt,rc as H,v as Ht,wc as I,Ze as It,Ks as J,re as Jt,Gs as K,g as Kt,Dc as L,Ie as Lt,cc as M,hn as Mt,sc as N,mn as Nt,k as O,Ln as Ot,Sc as P,Tt as Pt,Ds as Q,Oc as R,x as Rt,F as S,Li as St,Uc as T,Zr as Tt,E as U,y as Ut,fc as V,b as Vt,qs as W,ie as Wt,Fs as X,s as Xt,Ws as Y,a as Yt,Es as Z,c as Zt,cl as _,ta as _t,il as a,oo as at,ul as b,Bi as bt,pl as c,Qa as ct,P as d,Pa as dt,xs as et,L as f,wa as ft,ll as g,C as gt,N as h,ya as ht,iu as i,ls as it,xc as j,gn as jt,Ac as k,Pn as kt,dl as l,Za as lt,fl as m,ba as mt,lu as n,vs as nt,tl as o,no as ot,ml as p,xa as pt,Js as q,ne as qt,au as r,_s as rt,M as s,to as st,_u as t,ys as tt,yl as u,La as ut,I as v,Vi as vt,Gc as w,pi as wt,R as x,zi as xt,al as y,S as yt,Tc as z,Ee as zt};