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