pi-straw-boss 0.60.0 → 0.60.2
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.
- package/README.md +3 -3
- package/README.zh-TW.md +3 -3
- package/dist/gui/assets/allyasks-ByNVSYw-.js +2 -0
- package/dist/gui/assets/allyunits-BcvbktEl.js +2 -0
- package/dist/gui/assets/{answer-D403RHyM.js → answer-D0lm35aH.js} +1 -1
- package/dist/gui/assets/{ask-tXVEUKiF.js → ask-ClTrdwZU.js} +1 -1
- package/dist/gui/assets/asks-BDGpeeS-.js +1 -0
- package/dist/gui/assets/chat-D6zuSuv_.js +2 -0
- package/dist/gui/assets/drawer-CTm2r1zP.js +1 -0
- package/dist/gui/assets/index-DNvqiyaL.js +3 -0
- package/dist/gui/assets/index-hKtslWoM.css +1 -0
- package/dist/gui/assets/layer-DwFgBKd_.js +1 -0
- package/dist/gui/assets/{lightbox-B8HApcBz.js → lightbox-BUb7EEzQ.js} +1 -1
- package/dist/gui/assets/link-D0zEHUqf.js +1 -0
- package/dist/gui/assets/linkdialogs-DrSUQeBf.js +1 -0
- package/dist/gui/assets/markdown-Bk5NWfKQ.js +6 -0
- package/dist/gui/assets/pair-CTl21a6C.js +3 -0
- package/dist/gui/assets/{picker-DXgdpMA0.js → picker-D8BB7zo5.js} +1 -1
- package/dist/gui/assets/{server-kDaAFu34.js → server-DbGYbWua.js} +2 -2
- package/dist/gui/assets/sessionfacts-INXGQcx9.js +1 -0
- package/dist/gui/assets/{settings-Bc7Yefkm.js → settings-BJlGvy0_.js} +2 -2
- package/dist/gui/assets/spawn-Byj-FrmU.js +1 -0
- package/dist/gui/assets/termcard-CsdAh_0I.js +6 -0
- package/dist/gui/assets/towermodel-DJLQh2fz.js +1 -0
- package/dist/gui/assets/{towerturns-sm4atUwy.js → towerturns-CYO3ciQ8.js} +2 -2
- package/dist/gui/assets/{trust-C-LiJfO0.js → trust-Dd52bAdg.js} +1 -1
- package/dist/gui/assets/unit_count-CJMBHDBg.js +1 -0
- package/dist/gui/assets/views-whzTVDOK.js +2 -0
- package/dist/gui/assets/waitpanel-D1MKcXBT.js +1 -0
- package/dist/gui/assets/{zenchunk-DlzlVwLa.css → zenchunk-Cjg1XxCH.css} +1 -1
- package/dist/gui/assets/zenchunk-I4-BBnZj.js +2 -0
- package/dist/gui/index.html +2 -2
- package/dist/server/main.mjs +273 -129
- package/package.json +1 -1
- package/src/deploy.ts +9 -3
- package/src/link/holder.ts +11 -10
- package/src/link/text.ts +16 -2
- package/src/nethead.ts +5 -2
- package/src/openings.ts +48 -0
- package/src/server/dispatcher.ts +1 -1
- package/src/server/guihost.ts +4 -3
- package/src/server/headasks.ts +22 -2
- package/src/server/headbrief.ts +5 -2
- package/src/server/headnet.ts +14 -5
- package/src/server/headside.ts +2 -2
- package/src/server/towermemory.ts +12 -4
- package/src/server/towers.ts +1 -1
- package/src/spawn.ts +100 -23
- package/src/waitlapse.ts +7 -0
- package/dist/gui/assets/allyasks-CTUiK5Ht.js +0 -2
- package/dist/gui/assets/asks-DU25Zsis.js +0 -1
- package/dist/gui/assets/chat-I4VvpYyG.js +0 -2
- package/dist/gui/assets/drawer-wBIYsu9b.js +0 -1
- package/dist/gui/assets/index-CkdCrste.js +0 -2
- package/dist/gui/assets/index-Cr2P3LZC.css +0 -1
- package/dist/gui/assets/layer-IY4EhFST.js +0 -1
- package/dist/gui/assets/link-CZN40s8s.js +0 -1
- package/dist/gui/assets/linkdialogs-Deiaw55t.js +0 -1
- package/dist/gui/assets/markdown-DvbY97ID.js +0 -6
- package/dist/gui/assets/pair-CfFNN-re.js +0 -3
- package/dist/gui/assets/sessionfacts-Bf2gYU0C.js +0 -1
- package/dist/gui/assets/spawn-1_5KXhD5.js +0 -1
- package/dist/gui/assets/termcard-0sRxxgI7.js +0 -6
- package/dist/gui/assets/towermodel-YlF7HR2k.js +0 -1
- package/dist/gui/assets/unit_count-5h7nN0qd.js +0 -1
- package/dist/gui/assets/views-CeY-q5tM.js +0 -2
- package/dist/gui/assets/waitpanel-SWbCnm0P.js +0 -1
- package/dist/gui/assets/zenchunk-MeFqgUsg.js +0 -2
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. A tower's wait for you is answered in place: **Handle** in its dialog (or on the tower's card) unfolds a box, and Enter tells the tower.</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,
|
|
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. On the breathing circle a card does not appear by itself: one quiet line above the input says how many wait ("1 card waits for Enter. No rush, when you're ready."), and **Enter**, or a tap on the line, takes the next, blocking questions first. When you answer, cancel, or skip it (Maybe later), a breath of a pause follows and Zen breathes again; the next card waits for Enter. A wait a tower recorded on you (a question only you can settle) is a card of its own: **Handle** unfolds an answer box right on it, Enter or **Send** tells the tower in your words, and the card leaves with the knock; **Dismiss** drops the wait, and **Esc** folds the box with your draft kept. Four things Standard shows in the Link button, the Wi-Fi notice, and a tower's notices are cards of their own too: a **confirm** a teammate's tower asks of this computer (Allow or Deny, with the tool's full arguments), a **dialog a Straw Link box forwarded**, a **pair request** (type the number the phone shows, then Allow or Deny), and a **memory proposal** from a tower (Confirm or Reject). They answer through the same functions as Standard's rows, the server decides when one is over, and a paired phone keeps only the authority it has in Standard (no pair-request card: that is this computer's to decide). A join request stays in Standard. A dialog with several questions shows one at a time: the one you are on is open and clear, the others fold to one faded line (the question, and your answer once it has one), and a scroll or swipe, picking an answer, Tab, or a tap on a line moves on to the next. When nothing waits, a breathing circle and a short line on mindfulness or stillness, with whom it comes from (a Japanese source also has its original, small, below): every visit starts there. `[` or `]` steps to a session to keep you company, its live log and its composer, and the circle sits where the list wraps round; ⌘K's *Back to the breath* returns to it. No session, a tower included, is put there for you. One Esc cancels the question on the page, or skips the card when it cannot be cancelled; Esc twice (or the corner menu's last row) goes back to Standard. The corner menu also holds the language, the view, and the sound and volume, and the button beside it takes the page to full screen. An answer that leaves a terminal step (robot_hand's *Put it in my prompt* or a new Herdr pane) shows a small card in ink to finish it, which closes by itself when your Enter is taken or the pane closes; *Full terminal* on the card opens the whole terminal inside Zen, with *Back to Zen* in the top right corner. **Keys.** Enter or Space ends the breathing pause early (so does a tap); Esc answers or skips the card on the page, and a second Esc within 600 ms goes back to Standard (with the corner menu open, Esc only closes it; with text in a box, it only lets the box go). Inside a terminal the page does not take Esc: Shift+Esc lets the keyboard out of the terminal. **H** opens *Context* on a card, the unit's session log inside the card, read-only, and you can still answer while it is open; H or Esc closes it. `[` and `]` step the session beside you (the companion) through the sessions you can talk to. **⌘K** (Ctrl+K off a Mac) opens a command palette for the page's actions and the corner menu's choices. While nothing waits, a quiet line at the top says how many units work and how many are idle; it never counts what waits. Moving the pointer leaves faint ripples. **Sound** follows the settings page's Sound switch (off by default) and Volume: a soft singing-bowl tone when an item takes the screen, a wooden-fish knock when one is done, a lower bowl on an error; the corner menu's *Try the sounds* plays them. Set it as the default with `/boss gui view zen`, or pick it on a device's settings page. Music is yours: put audio files (mp3, m4a, ogg, wav, flac, and the like) in `~/.pi/agent/straw-boss-music/` and Zen shows a ♪ in the corner that plays them on a loop, with a ⌄ to choose the track (shown when there are two or more); with no files there is no ♪. The folder is read each time Zen shows, and tracks cross-fade into themselves so the loop has no gap. On a phone nothing plays before your first tap (♪ says *tap to play* until then, and again after the phone locks), the music pauses while the page is hidden, and the ringer switch mutes it. Motion stops under *reduce motion*, and the page follows the system's forced colours.
|
|
22
22
|
|
|
23
23
|
<p align="center"><img src="docs/gui-zen-item.png" width="49%" alt="The Zen view with one item: a robot_hand question from ops-main on an ink-dark page, its choices as lines of text, each with a dot, and Maybe later below"> <img src="docs/gui-zen-idle.png" width="49%" alt="The Zen view when nothing waits: a session stepped to with ], its live log and its composer"></p>
|
|
24
24
|
|
|
@@ -36,9 +36,9 @@ English | [繁體中文](https://github.com/wayne930242/pi-straw-boss/blob/main/
|
|
|
36
36
|
|
|
37
37
|
<p align="center"><sub>Zen: one item at a time, the companion session when nothing waits, a breathing circle when there is no session, the corner menu, the context, the command palette, the music, a tower's wait answered on its card, a teammate's confirm answered on its card, and the same on a phone.</sub></p>
|
|
38
38
|
|
|
39
|
-
**The head tower** is the one tower that belongs to no project. You talk to it in one long conversation, on its own page in Standard or in a line under Zen's breathing circle, and it decides which workspace owns each instruction and hands it to that workspace's tower, opening the tower if there is none. It does no work itself and answers you in a line when a tower answers it. Zen
|
|
39
|
+
**The head tower** is the one tower that belongs to no project. You talk to it in one long conversation, on its own page in Standard or in a line under Zen's breathing circle, and it decides which workspace owns each instruction and hands it to that workspace's tower, opening the tower if there is none. It does no work itself and answers you in a line when a tower answers it. Zen starts at rest: the breathing circle, a line on mindfulness, and the input as a hairline. Click the input, press Enter, or press **H** and the head's last lines come up, fading as they age (hover to read them clear, **H** again or a swipe up for the whole conversation). **Esc**, a tap on the blank space, or leaving the input rests the strip again; the head's own reports do not wake it, a reply to you does, and a question for you does not: it waits as a card, counted in a quiet line above the input, until you press Enter.
|
|
40
40
|
|
|
41
|
-
<p align="center"><img src="docs/gui-head.png" width="49%" alt="The head tower's page in the Standard view: a crowned header, the conversation with two forwards to the Harbor API and Lighthouse Web towers and one answer, the open and answered asks as chips, and the composer"> <img src="docs/gui-zen-head.png" width="49%" alt="The Zen view with the head tower
|
|
41
|
+
<p align="center"><img src="docs/gui-head.png" width="49%" alt="The head tower's page in the Standard view: a crowned header, the conversation with two forwards to the Harbor API and Lighthouse Web towers and one answer, the open and answered asks as chips, and the composer"> <img src="docs/gui-zen-head.png" width="49%" alt="The Zen view with the head tower at rest, as every visit begins: the breathing circle, a line on mindfulness, one quiet line saying a card waits for Enter, and a hairline input that says Click to talk to the head tower"></p>
|
|
42
42
|
|
|
43
43
|
<p align="center"><img src="docs/gui-zen-head-open.png" width="49%" alt="The Zen strip with the input open and a draft typed, the head tower's lines clear under the pointer"> <img src="docs/gui-phone-zen-head.png" width="220" alt="The Zen strip on a phone: two lines of the head tower's conversation, the Whole conversation link, and the folded input"></p>
|
|
44
44
|
|
package/README.zh-TW.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
<p align="center"><sub>單位的通訊畫面、可以直接在瀏覽器回答的問題、極客檢視、每個裝置自選檢視的設定頁,以及同一個頁面在手機上的樣子。塔台記在你身上的等待事項就在原處回覆:在它的對話框(或塔台卡片上)按「去處理」展開輸入框,按 Enter 就送給塔台。</sub></p>
|
|
20
20
|
|
|
21
|
-
**禪(Zen)**
|
|
21
|
+
**禪(Zen)** 是第三種檢視,給你在回應這張網、而不是指揮它的時候用。有東西在等你時,整個畫面只放那一件事:沒有地圖。停在呼吸圓圈時,卡片不會自己跳出來:輸入框上方有一行安靜的字說有幾張在等(「1 張卡等 Enter。不急,等你準備好。」),按 **Enter** 或點那一行才接下一張,會阻擋智慧體的問題先來。你回答、取消或跳過(「晚點再說」)之後,會有一次呼吸般的停頓,回到呼吸;下一張仍等你按 Enter。塔台記在你身上的等待事項(只有你能決定的事)自己是一張卡片:按「去處理」會在卡片上直接展開輸入框,按 Enter 或「送出」把你的話交給塔台,卡片隨一聲木魚離開;「略過」把這則等待丟掉,Esc 把輸入框收起並保留草稿。標準檢視裡放在 Link 按鈕、Wi-Fi 通知和塔台通知的四件事,在禪裡也各是一張卡片:隊友的塔台向這台電腦要的**確認**(允許或拒絕,附上工具的完整參數)、Straw Link 盒子**轉過來的對話框**、**配對請求**(輸入手機上顯示的號碼,再按允許或拒絕),以及塔台提出的**記憶提案**(確認或駁回)。它們呼叫的是和標準檢視同一組函式,什麼時候算結束由伺服器決定,已配對的手機只有它在標準檢視裡原本就有的權限(沒有配對請求卡片:那是這台電腦自己決定的事)。加入團隊的請求仍留在標準檢視。一個對話框有好幾個問題時,一次只清楚地顯示一題:你正在回答的那題展開、清晰,其餘收成一行淡淡的字(題目,答了就接著你的答案),捲動或滑動、選好答案、按 Tab 或點一下那一行就移到下一題。沒有東西在等時,畫面是一個呼吸的圓圈和一句正念的話,每次進入禪都從這裡開始。用 `[` 或 `]` 可以挑一個 session 來陪,畫面會換成它的即時紀錄和輸入框;清單繞完一圈會回到呼吸圓圈,⌘K 裡的「回到呼吸」也能隨時回去。不會自動放一個 session(包括塔台)在那裡。按一次 Esc 會取消畫面上的問題,不能取消的卡片則是跳過;連按兩次 Esc(或選單最後一列)回到標準檢視。右上角的選單還有語言、檢視、音效與音量,旁邊的按鈕可以讓頁面全螢幕。回答之後留下終端機步驟的選項(robot_hand 的「放進我的 prompt」或新的 Herdr 窗格)會在禪裡面出現一張墨色的小卡片讓你完成它,你的 Enter 送出或窗格關閉時卡片自己消失;卡片上的「完整終端機」會在禪裡打開整個終端機,右上角有「回到禪」。**按鍵。** Enter 或空白鍵可以提早結束呼吸停頓(點一下畫面也行);Esc 回答或跳過畫面上的卡片,600 毫秒內再按一次 Esc 回到標準檢視(選單開著時 Esc 只關選單;輸入框裡有字時只是離開輸入框)。終端機在使用中時頁面不攔 Esc,Shift+Esc 可以讓鍵盤離開終端機。**H** 在卡片上展開「前情」,也就是這個 unit 的 session 紀錄,唯讀地顯示在卡片裡,展開時仍然可以回答;再按 H 或 Esc 收起。`[` 與 `]` 在你能對話的 session 之間切換身邊陪著的那一個。**⌘K**(不在 Mac 上是 Ctrl+K)打開指令面板,列出頁面的動作和右上角選單的選項。沒有東西在等時,頂端有一行淡淡的字說明幾個 unit 在工作、幾個閒著,不會數還在等的。滑鼠移動時會留下淡淡的漣漪。**音效**跟隨設定頁的「音效」開關(預設關)與音量:待辦出現時是一聲柔和的頌缽,完成時是一聲木魚,出錯時是低一點的缽聲;選單裡的「試聽音效」可以先聽。用 `/boss gui view zen` 把它設成預設,或在裝置的設定頁自己選。音樂由你自己放:把音檔(mp3、m4a、ogg、wav、flac 等)放進 `~/.pi/agent/straw-boss-music/`,禪的右上角就會出現 ♪,循環播放,旁邊的 ⌄ 可以選曲(有兩首以上才出現);資料夾裡沒有檔案就不會出現 ♪。每次顯示禪時都會重讀資料夾,曲子播完前會與自己交叉淡入淡出,所以循環沒有空檔。手機上要先點一下才會出聲(在那之前 ♪ 寫「點一下播放」,手機鎖屏之後也會再次這樣寫),頁面被藏起來時音樂暫停,靜音開關也會讓它靜音。「減少動態效果」開啟時畫面不動,系統的強制色彩模式也會被遵守。
|
|
22
22
|
|
|
23
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
|
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
|
|
37
37
|
<p align="center"><sub>禪:一次一件待辦、沒東西等時陪著的 session、沒有 session 時的呼吸圓圈、右上角選單、前情、指令面板、音樂、在卡片上回覆塔台的等待、在卡片上回覆隊友的確認,以及同樣的畫面在手機上的樣子。</sub></p>
|
|
38
38
|
|
|
39
|
-
**主塔台(head tower)**
|
|
39
|
+
**主塔台(head tower)** 是唯一不屬於任何專案的塔台。你和它只有一場很長的對話:在標準檢視有它自己的一頁,在禪檢視則是呼吸圓圈下方的幾行字。它判斷每件事該由哪個工作區處理,轉給那個工作區的塔台,那個工作區還沒有塔台就先替它開一座。它自己不做事;塔台回覆之後,它再用一行話告訴你。禪檢視一進來就是靜止的呼吸圓圈、正念句和一條細線的輸入框。點一下輸入框、按 Enter 或按 **H**,主塔台最近說的話才會出現,並隨時間慢慢淡去(滑鼠移上去就看得清楚,再按 **H** 或往上滑可以看全部對話)。按 **Esc**、點空白處,或離開輸入框,這幾行字會再退下、正念句回來;主塔台自己主動說的話不會把它叫醒,它回覆你時才會出現;它有事要問你時,算成一張卡,列在輸入框上方那行字裡,等你按 Enter 才接。
|
|
40
40
|
|
|
41
|
-
<p align="center"><img src="docs/gui-head.png" width="49%" alt="標準檢視裡主塔台的頁面:標題有皇冠,對話裡有兩則轉給 Harbor API 和 Lighthouse Web 塔台的紀錄和一則回覆,進行中和已回覆的轉交以標籤列在下方,最下面是輸入框"> <img src="docs/gui-zen-head.png" width="49%" alt="
|
|
41
|
+
<p align="center"><img src="docs/gui-head.png" width="49%" alt="標準檢視裡主塔台的頁面:標題有皇冠,對話裡有兩則轉給 Harbor API 和 Lighthouse Web 塔台的紀錄和一則回覆,進行中和已回覆的轉交以標籤列在下方,最下面是輸入框"> <img src="docs/gui-zen-head.png" width="49%" alt="禪檢視裡靜止的主塔台,每次進來都是這樣:呼吸圓圈、一句正念句、一行說有一張卡等 Enter 的小字,以及一條細線的輸入框,寫著點一下和主塔台說話(英文版畫面)"></p>
|
|
42
42
|
|
|
43
43
|
<p align="center"><img src="docs/gui-zen-head-open.png" width="49%" alt="輸入框展開、已打了一段草稿的禪檢視:主塔台的幾行字在滑鼠底下是清楚的"> <img src="docs/gui-phone-zen-head.png" width="220" alt="手機上的禪檢視:主塔台對話的兩行字、「全部對話」連結,和收起的輸入框"></p>
|
|
44
44
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{w as e}from"./towermodel-DJLQh2fz.js";import{t}from"./runtime-ZX6HkxDa.js";import{$ as n,X as r}from"./index-DNvqiyaL.js";import{mountDialogCards as i}from"./linkdialogs-DrSUQeBf.js";var a=t=>{let n=e(`en`,t?.count,{},!0);return n===`one`?`${t?.count} question waits for you: answer it here`:n===`other`?`${t?.count} questions wait for you: answer them here`:`ally_asks_button`},o=e=>`${e?.count} 個問題等你回答,在這裡回答`,s=((e,n={})=>(n.locale??t())===`zh-TW`?o(e):a(e)),c=e=>e.tower===`blocked`||e.tabs.some(e=>e.state===`blocked`);function l(e){let t=new Map;for(let n of e?.alerts??[]){let i=n.kind===`dialog`?r(n):void 0;if(i!==`open`&&i!==`sent`)continue;let a=(e?.allies??[]).filter(e=>e.device===n.data.device),o=a.filter(e=>e.team===n.team),s=(o.length?o:a).find(c)??(o.length?o:a)[0];s&&t.set(s.id,[...t.get(s.id)??[],n])}return t}var u=`.ally-unit[data-state="blocked"], .ally-tab[data-state="blocked"]`;function d(){let e=new WeakMap,t=t=>{let a=e.get(t);if(a)return a;let o=n(`button`,{type:`button`,class:`ally-asks-btn`,"aria-expanded":`false`}),s=n(`ul`,{class:`ally-asks-list`}),c=n(`div`,{class:`ally-asks`},o,s);return a={box:c,btn:o,list:s,cards:i(),ids:``},e.set(t,a),o.onclick=()=>r(t),t.addEventListener(`click`,e=>{let n=e.target?.closest?.(u);n&&t.contains(n)&&t.dataset.asks&&!e.target.closest(`details`)&&r(t)}),t.append(c),a};function r(t){let n=e.get(t);if(!n||!t.dataset.asks)return;let r=t.dataset.asking===void 0;r?t.dataset.asking=``:delete t.dataset.asking,n.list.hidden=!r,n.btn.setAttribute(`aria-expanded`,String(r))}function a(n,r){if(!r.length&&!e.has(n))return;let i=t(n);if(i.box.hidden=!r.length,!r.length){delete n.dataset.asks,delete n.dataset.asking,i.btn.setAttribute(`aria-expanded`,`false`),i.cards.keep(new Set),i.list.replaceChildren(),i.ids=``;return}n.dataset.asks=String(r.length),i.btn.textContent=s({count:r.length}),i.list.hidden=n.dataset.asking===void 0,i.cards.keep(new Set(r.map(e=>e.id)));let a=r.map(e=>i.cards.row(e)),o=r.map(e=>e.id).join(`
|
|
2
|
+
`);o!==i.ids&&(i.list.replaceChildren(...a),i.ids=o)}return{toggle:r,fill:a,show:(e,t,n)=>a(e,l(n).get(t.id)??[])}}export{d as mountAllyAsks};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{w as e}from"./towermodel-DJLQh2fz.js";import{t}from"./runtime-ZX6HkxDa.js";import{L as n,O as r,Q as i,S as a,h as o,k as s}from"./index-DNvqiyaL.js";var c=((e={},n={})=>(n.locale??t())===`zh-TW`?`前`:` ago`),l=((e={},n={})=>(n.locale??t())===`zh-TW`?`發生了什麼事`:`What happened`),u=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個單位最後一次回報的時間`:`When this unit last reported`),d=t=>{let n=e(`en`,t?.count,{},!0);return n===`one`?`${t?.count} monitor`:n===`other`?`${t?.count} monitors`:`link_unit_monitors`},f=e=>`${e?.count} 個監看程序`,p=((e,n={})=>(n.locale??t())===`zh-TW`?f(e):d(e)),m=((e={},n={})=>(n.locale??t())===`zh-TW`?`最後回報`:`Last report`),h=((e={},n={})=>(n.locale??t())===`zh-TW`?`最近沒有狀態`:`no status lately`),g=((e={},n={})=>(n.locale??t())===`zh-TW`?`盒子已超過 3 分鐘沒送狀態,這是它最後一次的內容`:`The box has sent no status for 3 minutes; this is its last one`),_=((e={},n={})=>(n.locale??t())===`zh-TW`?`請在盒子的 trust.json 加入這個專案`:`Add the project to the box's trust.json`),v=((e={},n={})=>(n.locale??t())===`zh-TW`?`為什麼停了`:`Why it stopped`),y=((e={},n={})=>(n.locale??t())===`zh-TW`?`前更新`:` ago`),b=((e={},n={})=>(n.locale??t())===`zh-TW`?``:`updated `),x=()=>a(`<li class="ally-unit"><div class="au-head"><i class="au-dot"></i><b class="au-word"></b><span class="au-name"></span><span class="au-time" hidden><span class="au-pre"></span><span class="age"></span><span class="au-ago"></span></span><em class="au-stale" hidden></em></div><p class="au-mons" hidden><b></b><span></span></p><details class="au-crash" hidden><summary><b></b><span class="au-time"><span class="age"></span><span class="au-ago"></span></span></summary><pre></pre><p class="au-hint" hidden></p></details><details class="au-report" hidden><summary><b class="au-label"></b><span class="au-peek"></span></summary><div class="md au-md"></div></details></li>`),S,C=new WeakMap;function w(e){let t=e.querySelector(`.au-md`),r=C.get(e)??``;e.open&&t.dataset.report!==r&&(S?Promise.resolve(S):n(()=>import(`./markdown-Bk5NWfKQ.js`).then(e=>e.t).then(e=>S=e),[],import.meta.url)).then(({mount:n,parse:i})=>{e.open&&C.get(e)===r&&(t.dataset.report=r,t.replaceChildren(n(i(r))))})}function T(e,t,n=``,r=c()){let i=e.querySelector(`.age`);i.dataset.since=String(t),i.textContent=o(t),e.querySelector(`.au-pre`)?.replaceChildren(n),e.querySelector(`.au-ago`).textContent=r}function E(e,t,n){r(e,t.map(e=>({...e,id:e.unit,named:n})),x,(e,t)=>{e.dataset.state=t.state,e.dataset.tone=t.tone,e.classList.toggle(`stale`,t.stale),s(e,`.au-word`,t.word),s(e,`.au-name`,t.named?t.unit:``);let n=e.querySelector(`.au-head > .au-time`);n.hidden=!1,n.title=u(),T(n,t.at,b(),y());let r=e.querySelector(`.au-stale`);r.hidden=!t.stale,r.textContent=t.stale?h():``,r.title=t.stale?g():``;let a=e.querySelector(`.au-mons`);a.hidden=!t.monitors.length,t.monitors.length&&(s(a,`b`,p({count:t.monitors.length})),s(a,`span`,t.monitors.join(` · `)),a.title=t.monitors.join(`
|
|
2
|
+
`));let o=e.querySelector(`.au-crash`);if(o.hidden=!t.crash,o.toggleAttribute(`data-trust`,t.crash?.trust===!0),t.crash){s(o,`summary > b`,t.crash.trust?v():l()),T(o.querySelector(`summary > .au-time`),t.crash.at),s(o,`pre`,t.crash.text);let e=o.querySelector(`.au-hint`);e.hidden=!t.crash.trust,e.textContent=t.crash.trust?_():``}let c=e.querySelector(`.au-report`);c.hidden=!t.report,t.report&&(s(c,`.au-label`,m()),s(c,`.au-peek`,i(t.report)),C.set(c,t.report),c.ontoggle=()=>w(c),w(c))})}export{E as fillAllyUnits};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./ask-
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./ask-ClTrdwZU.js";import{n}from"./post-DDdE-PdN.js";var r=e({answerPost:()=>i,canAnswer:()=>o,mountAnswer:()=>s,trustPost:()=>a}),i=(e,t)=>t?.(e)??((t,r)=>n(e.startsWith(`grant:`)?`panes/${encodeURIComponent(e.slice(6))}/${t}`:`sessions/${encodeURIComponent(e)}/${t}`,r)),a=e=>e??(e=>n(`trust/answer`,e)),o=(e,...t)=>e===`waiting`&&t.every(Boolean),s=(e,{key:n,show:r,post:i,remote:a,accepted:o,label:s})=>t(e,i,a,{key:n,show:r},o,s);export{a,s as i,r as n,o as r,i as t};
|
|
@@ -1 +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{Ut as o,X as s,t as c,vt as l}from"./index-CkdCrste.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`),ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個選項有預覽;請在終端機中查看。`:`It has a preview; see it in the terminal.`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註`:`Note`),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註(選填)`:`Note (optional)`),S=e=>`Opened while ${e?.tool} was running; it may not be about that call.`,C=e=>`在 ${e?.tool} 執行時開啟,不一定與該呼叫有關。`,te=((t,n={})=>(n.locale??e())===`zh-TW`?C(t):S(t)),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`選項`:`Options`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`另一個答案沒有被採用;這個可以送出。`:`The other answer was not taken; this one can go.`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`你的答案`:`Your own answer`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`或自己輸入答案`:`Or type your own answer`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`問題已變更,請重新閱讀。`:`The question changed; read it again.`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 讀不懂這個答案。`:`The session could not read that answer.`),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個答案不符合問題。`:`That answer does not fit the question.`),j=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 拒絕了這個答案。`:`The session refused that answer.`),M=((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.`),N=((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.`),P=((t={},n={})=>(n.locale??e())===`zh-TW`?`送出答案`:`Send answer`),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示終端機`:`Show terminal`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中關閉。`:`It was dismissed in the terminal.`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`它已不再開啟。`:`It is no longer open.`),R=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中回答。`:`It was already answered in the terminal.`),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框。`:`It waits on a dialog.`),B={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};function V(e,t,n,r,i){let{q:a}=n,o=r[a],s=B[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 H(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,c=!1;return e.addEventListener(`keydown`,i=>{i.key===` `&&(c=!0);let o=a(i.target);if(!o||i.ctrlKey||i.altKey||i.metaKey||i.isComposing)return;let l=i.target;if(o.part!==`opt`&&(i.key===`ArrowUp`?l.selectionStart!==0:i.key===`ArrowDown`&&l.selectionEnd!==l.value.length))return;let u=V(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(!u||(i.preventDefault(),i.repeat&&[`Enter`,` `].includes(i.key)))return;if(s=i.key===` `,u.pick!==void 0){let e=t[o.q].opts[u.pick];e.getAttribute(`aria-checked`)!==`true`&&e.click()}let d=u.to===`send`?void 0:t[u.to.q],f=u.to===`send`?n():u.to.part===`opt`?d.opts[u.to.o??r(d)]:u.to.part===`own`?d.own:d.note;f&&!f.disabled&&(e.dispatchEvent(new CustomEvent(`ask-reveal`,{detail:f})),f.focus())}),e.addEventListener(`keyup`,e=>{e.key===` `&&((s||!c)&&e.preventDefault(),s=c=!1)}),()=>t[0]?.opts[r(t[0])]}var U=e=>e.multiple?m():e.freeform&&e.options.length?p():``,W=90,G=(e,t)=>s(`div`,{class:`ask-one`},e.header&&s(`b`,{class:`ask-head`},e.header),s(`p`,{class:`ask-q`,...e.question.length>W?{"data-long":``}:{}},e.question),e.context&&s(`div`,{class:`ask-ctx`},e.context),e.options.length>0&&s(`ol`,{class:`ask-opts`,"aria-label":w()},...e.options.map(e=>s(`li`,{class:`ask-opt`},s(`b`,null,e.title),e.description&&s(`small`,null,e.description)))),t&&U(e)&&s(`small`,{class:`ask-how`},U(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:O,"not-allowed":A,malformed:k};function ne(e,i=!1){let{outcome:a,reason:o,by:s}=e.body;return a===`accepted`?[`ok`,i?h():n()]:a===`stale`?[`error`,s===`local`?R():s===`cancel`?I():L()]:a===`rejected`?[`error`,(Object.hasOwn(Q,String(o))?Q[String(o)]:j)()]:a===`busy`?[`error`,t()]:a===`unknown`||e.status===504?[`error`,r(),!0]:[`error`,o??l({status:e.status})]}var re=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 ie(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 ae(e,t,n=location.hostname!==`127.0.0.1`,l,f,p=F){let m,h,S,C=!1,O=!1,k;for(let e of[`focusin`,`pointerdown`])document.addEventListener(e,e=>h&&!h.el.contains(e.target)&&(h.lost=void 0));let A=(e,t,n,...r)=>(e.dataset.tone=t,e.replaceChildren(n,...r)),j=()=>{if(!h)return;let e=document.activeElement;e&&e!==document.body&&e!==h.lost&&(h.lost=void 0),h.controls.forEach(e=>e.disabled=!C||O||h.done),h.send&&(h.send.disabled=!C||O||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 I(e,n){[e.sending,O,e.spell]=[!0,!0,!1],j(),A(e.note,``,a());let o=await t(`answer`,n).catch(()=>void 0),u=s(`button`,{type:`button`,class:`cmp-link`},i());u.onclick=()=>void I(e,n);let[d,p,m]=o?ne(o,n.cancel===!0):[`error`,r(),!0];[e.done,e.sending,O,e.busy]=[!o||re(o),!1,!1,o?.body.outcome===`busy`],A(e.note,d,p,...m?[u]:[]);let h=o?.body.outcome===`accepted`?o.body.then:void 0,g=h&&c(h,{key:l?.key??``,command:e.copy,answerId:String(n.answerId??``)});g&&A(e.note,d,`${p} ${g}`),j(),e.note.scrollIntoView?.({block:`nearest`}),f&&o?.body.outcome===`accepted`&&setTimeout(()=>f(!!h&&!g),h&&!g?0:1200)}let L=(e,t,n,r,i)=>{let a=s(`button`,{type:`button`,class:`ask-opt`,role:e,"aria-checked":`false`},s(`b`,i?{"data-n":String(i)}:null,t),...n.filter(Boolean).map(e=>s(`small`,null,e)));return a.onclick=r,a};function R(e,t){let r,i=q(t).map(e=>L(`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))),j()),e.i+1)),a=t.select?.copy!==void 0&&s(`button`,{type:`button`,class:`cmp-link`},y());a&&(a.disabled=!navigator.clipboard,a.onclick=()=>void navigator.clipboard.writeText(t.select.copy).then(()=>A(e.note,`ok`,v()),()=>A(e.note,`error`,_())));let o=i.filter((e,r)=>!(n&&q(t)[r].hereOnly));return i.forEach(e=>!o.includes(e)&&(e.disabled=!0)),e.pick=()=>r===void 0?void 0:{choice:r},e.first=H(e.el,[{opts:i,multiple:!1,answered:()=>r!==void 0}],()=>e.send),e.controls=o,[s(`pre`,{class:`ask-title`},K(t.select.title)),s(`div`,{class:`ask-opts`,role:`radiogroup`,"aria-label":g()},...i),s(`div`,{class:`ask-acts`},e.send,e.cancel,a)]}function B(e,t){let n=t.questions.map(()=>({picks:new Set,text:s(`textarea`,{rows:`1`,maxlength:`8192`,class:`ask-own`,placeholder:D(),"aria-label":E()}),note:s(`input`,{type:`text`,maxlength:`2048`,class:`ask-own ask-memo`,placeholder:x(),"aria-label":b()})})),r=[],i=t.questions.map((t,i)=>{let a=n[i],o=t.multiple?`checkbox`:`radio`,c=t.options.map((e,n)=>L(o,e.title,[e.description,e.preview&&ee()],()=>{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)))),j()}));return a.text.oninput=()=>(t.multiple||(a.picks.clear(),c.forEach(e=>e.setAttribute(`aria-checked`,`false`))),j()),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()!==``}),s(`div`,{class:`ask-one`},t.header&&s(`b`,{class:`ask-head`},t.header),s(`p`,{class:`ask-q`,...t.question.length>W?{"data-long":``}:{}},t.question),s(`div`,{class:`ask-opts`,role:t.multiple?`group`:`radiogroup`,"aria-label":w()},...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=H(e.el,r,()=>e.send),[...i,s(`div`,{class:`ask-acts`},e.send,e.cancel)]}function V(e){let t=e.asks??(e.ask?[e.ask]:[]),r=t.length>1,i=e.answer,a={copy:i?.select?.copy,key:$(e),el:s(`section`,{class:`ask`}),note:s(`p`,{class:`ask-note`,role:`status`,"aria-live":`polite`}),controls:[],pick:()=>void 0,done:!1,sending:!1};i&&((a.send=s(`button`,{type:`button`,class:`ask-send`},P())).onclick=()=>void(a.pick()&&I(a,Y(i,a.pick(),crypto.randomUUID()))));let c=e.tool===`secret_drop`;i&&!c&&Z(i,n)&&((a.cancel=s(`button`,{type:`button`,class:`ask-cancel`},o())).onclick=()=>void I(a,X(i,crypto.randomUUID())));let f=s(`p`,{class:`ask-term`},e.why&&t.length?e.why:`${r?d():u()} ${r||!t[0]?``:U(t[0])}`.trim()),m=l&&e.tool!==`secret_drop`&&s(`button`,{type:`button`,class:`cmp-link`},p());m&&(m.onclick=l.show);let h=e.answer?.twin&&e.tool&&e.tool!==`dialog`?[s(`p`,{class:`ask-why`},te({tool:e.tool}))]:[];return a.el.append(...h,...i&&!c?i.select?R(a,i):B(a,i):[...t.length?t.map(e=>G(e,r)):[s(`p`,{class:`ask-why`},c?n?M():N():e.why??z())],s(`div`,{class:`ask-acts`},c?s(`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,S]=[t,n,n?.send?n:S],e.replaceChildren(...n?[n.el]:[]),n&&ie(n.el),j(),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:()=>O,update(e,t){C=t,e&&(k=void clearTimeout(k)),!e&&(h?.done||h?.sending)?k??=setTimeout(()=>(k=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],A(h.note,``,T())),m=e):Q(e,S?.key===$(e)&&!S.done?S:V(e)):Q(),j()}}}export{ae as t};
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{a as t,i as n,n as r,r as i,t as a}from"./sending-aEpvzoz2.js";import{$ as o,Kt as s,t as c,xt as l}from"./index-DNvqiyaL.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`),ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個選項有預覽;請在終端機中查看。`:`It has a preview; see it in the terminal.`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註`:`Note`),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註(選填)`:`Note (optional)`),S=e=>`Opened while ${e?.tool} was running; it may not be about that call.`,C=e=>`在 ${e?.tool} 執行時開啟,不一定與該呼叫有關。`,te=((t,n={})=>(n.locale??e())===`zh-TW`?C(t):S(t)),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`選項`:`Options`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`另一個答案沒有被採用;這個可以送出。`:`The other answer was not taken; this one can go.`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`你的答案`:`Your own answer`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`或自己輸入答案`:`Or type your own answer`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`問題已變更,請重新閱讀。`:`The question changed; read it again.`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 讀不懂這個答案。`:`The session could not read that answer.`),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個答案不符合問題。`:`That answer does not fit the question.`),j=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 拒絕了這個答案。`:`The session refused that answer.`),M=((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.`),N=((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.`),P=((t={},n={})=>(n.locale??e())===`zh-TW`?`送出答案`:`Send answer`),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示終端機`:`Show terminal`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中關閉。`:`It was dismissed in the terminal.`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`它已不再開啟。`:`It is no longer open.`),R=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中回答。`:`It was already answered in the terminal.`),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框。`:`It waits on a dialog.`),B={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};function V(e,t,n,r,i){let{q:a}=n,o=r[a],s=B[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 H(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,c=!1;return e.addEventListener(`keydown`,i=>{i.key===` `&&(c=!0);let o=a(i.target);if(!o||i.ctrlKey||i.altKey||i.metaKey||i.isComposing)return;let l=i.target;if(o.part!==`opt`&&(i.key===`ArrowUp`?l.selectionStart!==0:i.key===`ArrowDown`&&l.selectionEnd!==l.value.length))return;let u=V(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(!u||(i.preventDefault(),i.repeat&&[`Enter`,` `].includes(i.key)))return;if(s=i.key===` `,u.pick!==void 0){let e=t[o.q].opts[u.pick];e.getAttribute(`aria-checked`)!==`true`&&e.click()}let d=u.to===`send`?void 0:t[u.to.q],f=u.to===`send`?n():u.to.part===`opt`?d.opts[u.to.o??r(d)]:u.to.part===`own`?d.own:d.note;f&&!f.disabled&&(e.dispatchEvent(new CustomEvent(`ask-reveal`,{detail:f})),f.focus())}),e.addEventListener(`keyup`,e=>{e.key===` `&&((s||!c)&&e.preventDefault(),s=c=!1)}),()=>t[0]?.opts[r(t[0])]}var U=e=>e.multiple?m():e.freeform&&e.options.length?p():``,W=90,G=(e,t)=>o(`div`,{class:`ask-one`},e.header&&o(`b`,{class:`ask-head`},e.header),o(`p`,{class:`ask-q`,...e.question.length>W?{"data-long":``}:{}},e.question),e.context&&o(`div`,{class:`ask-ctx`},e.context),e.options.length>0&&o(`ol`,{class:`ask-opts`,"aria-label":w()},...e.options.map(e=>o(`li`,{class:`ask-opt`},o(`b`,null,e.title),e.description&&o(`small`,null,e.description)))),t&&U(e)&&o(`small`,{class:`ask-how`},U(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:O,"not-allowed":A,malformed:k};function ne(e,i=!1){let{outcome:a,reason:o,by:s}=e.body;return a===`accepted`?[`ok`,i?h():n()]:a===`stale`?[`error`,s===`local`?R():s===`cancel`?I():L()]:a===`rejected`?[`error`,(Object.hasOwn(Q,String(o))?Q[String(o)]:j)()]:a===`busy`?[`error`,t()]:a===`unknown`||e.status===504?[`error`,r(),!0]:[`error`,o??l({status:e.status})]}var re=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 ie(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 ae(e,t,n=location.hostname!==`127.0.0.1`,l,f,p=F){let m,h,S,C=!1,O=!1,k;for(let e of[`focusin`,`pointerdown`])document.addEventListener(e,e=>h&&!h.el.contains(e.target)&&(h.lost=void 0));let A=(e,t,n,...r)=>(e.dataset.tone=t,e.replaceChildren(n,...r)),j=()=>{if(!h)return;let e=document.activeElement;e&&e!==document.body&&e!==h.lost&&(h.lost=void 0),h.controls.forEach(e=>e.disabled=!C||O||h.done),h.send&&(h.send.disabled=!C||O||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 I(e,n){[e.sending,O,e.spell]=[!0,!0,!1],j(),A(e.note,``,a());let s=await t(`answer`,n).catch(()=>void 0),u=o(`button`,{type:`button`,class:`cmp-link`},i());u.onclick=()=>void I(e,n);let[d,p,m]=s?ne(s,n.cancel===!0):[`error`,r(),!0];[e.done,e.sending,O,e.busy]=[!s||re(s),!1,!1,s?.body.outcome===`busy`],A(e.note,d,p,...m?[u]:[]);let h=s?.body.outcome===`accepted`?s.body.then:void 0,g=h&&c(h,{key:l?.key??``,command:e.copy,answerId:String(n.answerId??``)});g&&A(e.note,d,`${p} ${g}`),j(),e.note.scrollIntoView?.({block:`nearest`}),f&&s?.body.outcome===`accepted`&&setTimeout(()=>f(!!h&&!g),h&&!g?0:1200)}let L=(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 R(e,t){let r,i=q(t).map(e=>L(`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))),j()),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(()=>A(e.note,`ok`,v()),()=>A(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=H(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 B(e,t){let n=t.questions.map(()=>({picks:new Set,text:o(`textarea`,{rows:`1`,maxlength:`8192`,class:`ask-own`,placeholder:D(),"aria-label":E()}),note:o(`input`,{type:`text`,maxlength:`2048`,class:`ask-own ask-memo`,placeholder:x(),"aria-label":b()})})),r=[],i=t.questions.map((t,i)=>{let a=n[i],s=t.multiple?`checkbox`:`radio`,c=t.options.map((e,n)=>L(s,e.title,[e.description,e.preview&&ee()],()=>{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)))),j()}));return a.text.oninput=()=>(t.multiple||(a.picks.clear(),c.forEach(e=>e.setAttribute(`aria-checked`,`false`))),j()),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.length>W?{"data-long":``}:{}},t.question),o(`div`,{class:`ask-opts`,role:t.multiple?`group`:`radiogroup`,"aria-label":w()},...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=H(e.el,r,()=>e.send),[...i,o(`div`,{class:`ask-acts`},e.send,e.cancel)]}function V(e){let t=e.asks??(e.ask?[e.ask]:[]),r=t.length>1,i=e.answer,a={copy:i?.select?.copy,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`},P())).onclick=()=>void(a.pick()&&I(a,Y(i,a.pick(),crypto.randomUUID()))));let c=e.tool===`secret_drop`;i&&!c&&Z(i,n)&&((a.cancel=o(`button`,{type:`button`,class:`ask-cancel`},s())).onclick=()=>void I(a,X(i,crypto.randomUUID())));let f=o(`p`,{class:`ask-term`},e.why&&t.length?e.why:`${r?d():u()} ${r||!t[0]?``:U(t[0])}`.trim()),m=l&&e.tool!==`secret_drop`&&o(`button`,{type:`button`,class:`cmp-link`},p());m&&(m.onclick=l.show);let h=e.answer?.twin&&e.tool&&e.tool!==`dialog`?[o(`p`,{class:`ask-why`},te({tool:e.tool}))]:[];return a.el.append(...h,...i&&!c?i.select?R(a,i):B(a,i):[...t.length?t.map(e=>G(e,r)):[o(`p`,{class:`ask-why`},c?n?M():N():e.why??z())],o(`div`,{class:`ask-acts`},c?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,S]=[t,n,n?.send?n:S],e.replaceChildren(...n?[n.el]:[]),n&&ie(n.el),j(),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:()=>O,update(e,t){C=t,e&&(k=void clearTimeout(k)),!e&&(h?.done||h?.sending)?k??=setTimeout(()=>(k=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],A(h.note,``,T())),m=e):Q(e,S?.key===$(e)&&!S.done?S:V(e)):Q(),j()}}}export{ae as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{m as t}from"./towermodel-DJLQh2fz.js";import{t as n}from"./runtime-ZX6HkxDa.js";import{n as r}from"./post-DDdE-PdN.js";import{xt as i}from"./index-DNvqiyaL.js";var a=((e={},t={})=>(t.locale??n())===`zh-TW`?`沒有符合這個號碼的請求。`:`No request has that number.`),o=((e={},t={})=>(t.locale??n())===`zh-TW`?`這個請求已經不在了。`:`That request is gone.`),s=((e={},t={})=>(t.locale??n())===`zh-TW`?`連續輸入三次錯誤號碼,所以所有等待中的請求都已拒絕。請按「新的配對碼」重新配對。`:`Three wrong numbers in a row, so every waiting request was denied. Press New code and pair again.`),c=((e={},t={})=>(t.locale??n())===`zh-TW`?`這個請求已經變了,請重新看過。`:`That request changed. Look at it again.`),l=((e={},t={})=>(t.locale??n())===`zh-TW`?`這個請求已經不在了,或已逾時。`:`That request is gone or has timed out.`),u=((e={},t={})=>(t.locale??n())===`zh-TW`?`這個團隊沒有在這台裝置上執行。`:`That team is not running on this device.`),d=((e={},t={})=>(t.locale??n())===`zh-TW`?`已在該裝置上取消。`:`It was cancelled at the device.`),f=((e={},t={})=>(t.locale??n())===`zh-TW`?`你已從這裡回答。`:`You answered it from here.`),p=((e={},t={})=>(t.locale??n())===`zh-TW`?`已在該裝置上回答。`:`Answered at the device itself.`),m=((e={},t={})=>(t.locale??n())===`zh-TW`?`已由團隊的另一個控制端回答。`:`Answered by another controller of this team.`),h=e=>`The answer was not sent: ${e?.reason}`,g=e=>`答案沒有送出:${e?.reason}`,_=((e,t={})=>(t.locale??n())===`zh-TW`?g(e):h(e)),v=((e={},t={})=>(t.locale??n())===`zh-TW`?`問題在有人回答前就結束了。`:`It ended before anyone answered it.`),y=((e={},t={})=>(t.locale??n())===`zh-TW`?`已送出你的答案;對方裝置還沒關閉這個問題。`:`Your answer was sent; the device has not closed the question yet.`),b=((e={},t={})=>(t.locale??n())===`zh-TW`?`你已不再負責回答這台裝置的問題;問題在那邊仍未結束。`:`You no longer answer this device's questions; it is still open there.`);function x(e){switch(e){case`sent`:return y();case`done-here`:return f();case`done-other`:return m();case`done-local`:return p();case`cancelled`:return d();case`expired`:return v();case`withdrawn`:return b()}}var S=e=>typeof e==`object`&&!!e&&!Array.isArray(e),C=e=>typeof e==`string`,w=e=>Array.isArray(e)&&e.every(e=>S(e)&&C(e.title));function T(e){let{dialog:t,dialogId:n,digest:r}=e.data;if(!C(t)||!C(n)||!C(r))return;let i;try{i=JSON.parse(t)}catch{return}if(!S(i))return;let{select:a,questions:o,cancel:s}=i,c={dialog:n,digest:r,...s===!0?{cancel:!0}:{}};if(S(a)&&C(a.title)&&Array.isArray(a.choices)&&a.choices.every(e=>S(e)&&C(e.label)))return{callId:n,tool:`dialog`,answer:{...c,select:a}};if(Array.isArray(o)&&o.length>0&&o.every(e=>S(e)&&C(e.question)&&w(e.options)))return{callId:n,tool:`dialog`,answer:{...c,questions:o}}}var E=e=>e.cancel===!0?{cancel:!0}:e.choice===void 0?{answers:e.answers}:{choice:e.choice},D=e({confirmActions:()=>M,confirmWhy:()=>N,forwardedAnswer:()=>P,joined:()=>k,lanActions:()=>I,lanReading:()=>L,outcome:()=>O,proposalActions:()=>F,taken:()=>j,waitActions:()=>A}),O=e=>{let t=e.body.outcome;return t===void 0?e.status===504?`unknown`:e.ok&&(e.body.accepted===!0||Array.isArray(e.body.entries))?`accepted`:`refused`:t===`accepted`?`accepted`:t===`unknown`?`unknown`:`refused`},k=e=>e.replace(/^([A-Z])(?=[a-z])/,e=>e.toLowerCase()),A=(e,n)=>({tell:t=>n(`input`,{text:t,as:`send`,answers:e.id}),dismiss:()=>r(`${t(e.ws)}/memory`,{op:`drop`,id:e.id}),goto:{view:`session`,ws:e.ws,key:e.tower}}),j=e=>e.ok&&e.body.outcome===void 0?{...e,body:{...e.body,outcome:`accepted`}}:e,M=e=>{let t=t=>r(`link/confirm-answer`,{dialogId:e.dialogId,digest:e.digest,allow:t}).then(j);return{allow:()=>t(!0),deny:()=>t(!1)}},N=e=>{let t=String(e.body.reason??e.body.error??``);return[[/^That request is gone/,l],[/^That team is not running/,u],[/^That request changed/,c]].find(([e])=>e.test(t))?.[1]()??(t||i({status:e.status}))},P=e=>async(t,n)=>{let a=await r(`link/dialog-answer`,{device:e.device,dialogId:e.dialogId,digest:e.digest,answer:E(n)});return a.ok?j(a):{ok:!1,status:a.status,body:{reason:_({reason:a.body.reason??i({status:a.status})})}}},F=e=>({confirm:()=>r(`${t(e.ws)}/memory`,{op:`confirm`,proposal:e.id,rev:e.rev()}),reject:()=>r(`${t(e.ws)}/memory`,{op:`reject`,proposal:e.id})}),I=e=>({approve:t=>e(`lan/approve`,{number:t}).then(j),deny:t=>e(`lan/approve`,{deny:t}).then(e=>e.ok&&e.body.denied===0?{...e,ok:!1,body:{error:`gone`,reason:o()}}:j(e)),denyAll:()=>e(`lan/approve`,{deny:`all`}).then(j)});function L(e){let t=!e.ok&&e.body.error===`no_match`&&Number(e.body.denied)>0;return{answer:e.ok||t?``:e.body.error===`no_match`?a():String(e.body.reason??i({status:e.status})),verdict:t?s():``}}export{k as a,O as c,x as d,T as f,P as i,F as l,M as n,I as o,N as r,L as s,D as t,A as u};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-hKtslWoM.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./towermodel-DJLQh2fz.js";import{t}from"./runtime-ZX6HkxDa.js";import{i as n,n as r,r as i,t as a}from"./towerturns-CYO3ciQ8.js";import{n as o,r as s}from"./markdown-Bk5NWfKQ.js";import{$ as c,Bt as l,E as u,L as d,S as f,f as p,tt as ee}from"./index-DNvqiyaL.js";var te=((e={},n={})=>(n.locale??t())===`zh-TW`?`可能已被當機的 run 處理過:動手前先確認。`:`A run that crashed may already have handled this: check before acting.`),ne=((e={},n={})=>(n.locale??t())===`zh-TW`?`分支摘要`:`branch summary`),re=((e={},n={})=>(n.locale??t())===`zh-TW`?`通訊紀錄`:`Comms log`),m=e=>`context compacted · ${e?.tokens} tokens summarized`,ie=e=>`上下文已壓縮 · 摘要了 ${e?.tokens} tokens`,ae=((e,n={})=>(n.locale??t())===`zh-TW`?ie(e):m(e)),oe=((e={},n={})=>(n.locale??t())===`zh-TW`?`…(於 1 MB 截斷)`:`… (cut at 1 MB)`),h=e=>`exit ${e?.code}`,g=e=>`結束碼 ${e?.code}`,se=((e,n={})=>(n.locale??t())===`zh-TW`?g(e):h(e)),_=e=>`New chapter · ${e?.date} · ${e?.why}`,v=e=>`新的一章・${e?.date}・${e?.why}`,ce=((e,n={})=>(n.locale??t())===`zh-TW`?v(e):_(e)),y=((e={},n={})=>(n.locale??t())===`zh-TW`?`第一次對話`:`the first conversation`),b=((e={},n={})=>(n.locale??t())===`zh-TW`?`你要求開新對話`:`you asked for a new conversation`),x=((e={},n={})=>(n.locale??t())===`zh-TW`?`上一章太長了`:`the last one grew too large`),S=((e={},n={})=>(n.locale??t())===`zh-TW`?`上一章無法接續`:`the last one could not be resumed`),C=e=>`Image ${e?.n}`,w=e=>`圖片 ${e?.n}`,le=((e,n={})=>(n.locale??t())===`zh-TW`?w(e):C(e)),ue=((e={},n={})=>(n.locale??t())===`zh-TW`?`圖片無法讀取`:`Image unavailable`),T=e=>`${e?.count} image(s)`,E=e=>`${e?.count} 張圖片`,de=((e,n={})=>(n.locale??t())===`zh-TW`?E(e):T(e)),fe=((e={},n={})=>(n.locale??t())===`zh-TW`?`收到`:`incoming`),D=((e={},n={})=>(n.locale??t())===`zh-TW`?`跳到最新`:`jump to latest`),O=e=>`${e?.count} new`,k=e=>`${e?.count} 則新訊息`,A=((e,n={})=>(n.locale??t())===`zh-TW`?k(e):O(e)),pe=((e={},n={})=>(n.locale??t())===`zh-TW`?`還沒有通訊。`:`No transmissions yet.`),me=((e={},n={})=>(n.locale??t())===`zh-TW`?`通知`:`notice`),he=((e={},n={})=>(n.locale??t())===`zh-TW`?`細節`:`details`),j=((e={},n={})=>(n.locale??t())===`zh-TW`?`表單回覆`:`form answers`),ge=((e={},n={})=>(n.locale??t())===`zh-TW`?`訊息,來自`:`message from`),M=e=>`answer from ${e?.from}`,N=e=>`${e?.from} 的回答`,_e=((e,n={})=>(n.locale??t())===`zh-TW`?N(e):M(e)),P=e=>`request from ${e?.from}`,F=e=>`${e?.from} 的請求`,ve=((e,n={})=>(n.locale??t())===`zh-TW`?F(e):P(e)),I=e=>`message from ${e?.from}`,L=e=>`${e?.from} 的訊息`,ye=((e,n={})=>(n.locale??t())===`zh-TW`?L(e):I(e)),be=e=>`reply to your ask from ${e?.from}`,R=e=>`${e?.from} 回覆了你的詢問`,xe=((e,n={})=>(n.locale??t())===`zh-TW`?R(e):be(e)),z=((e={},n={})=>(n.locale??t())===`zh-TW`?`記憶`:`memory`),B=((e={},n={})=>(n.locale??t())===`zh-TW`?`監看`:`monitor`),Se=((e={},n={})=>(n.locale??t())===`zh-TW`?`本機`:`this computer`),Ce=((e={},n={})=>(n.locale??t())===`zh-TW`?`隊友`:`teammate`),we=((e={},n={})=>(n.locale??t())===`zh-TW`?`提問,來自`:`question from`),V=((e={},n={})=>(n.locale??t())===`zh-TW`?`回報,來自`:`report from`),Te=((e={},n={})=>(n.locale??t())===`zh-TW`?`sb server 的通知`:`notice from the sb server`),H=((e={},n={})=>(n.locale??t())===`zh-TW`?`狀態:`:`status of`),U=((e={},n={})=>(n.locale??t())===`zh-TW`?`Straw Link 訊息`:`Straw Link message`),Ee=((e={},n={})=>(n.locale??t())===`zh-TW`?`喚醒鬧鐘`:`wake-up call`),W=((e={},n={})=>(n.locale??t())===`zh-TW`?`塔台事件`:`tower event`),De=((e={},n={})=>(n.locale??t())===`zh-TW`?`在旁開啟`:`open beside`),Oe=e=>`Open image ${e?.n}`,G=e=>`打開圖片 ${e?.n}`,ke=((e,n={})=>(n.locale??t())===`zh-TW`?G(e):Oe(e)),K=e=>`show all (${e?.size})`,q=e=>`顯示全部(${e?.size})`,Ae=((e,n={})=>(n.locale??t())===`zh-TW`?q(e):K(e)),je=((e={},n={})=>(n.locale??t())===`zh-TW`?`顯示全部參數`:`show all arguments`),J=e=>`◇ thought · ${e?.count} chars`,Y=e=>`◇ 思考 · ${e?.count} 字元`,Me=((e,n={})=>(n.locale??t())===`zh-TW`?Y(e):J(e)),Ne=((e={},n={})=>(n.locale??t())===`zh-TW`?`◇ 思考 · 已遮蔽`:`◇ thought · redacted`),Pe=((e={},n={})=>(n.locale??t())===`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.`),Fe=((e={},n={})=>(n.locale??t())===`zh-TW`?`無法取得`:`unavailable`),Ie=((e={},n={})=>(n.locale??t())===`zh-TW`?`你`:`you`);function Le(){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?A({count:t}):D()}}async function Re(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 ze(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 Be=(e,t)=>({first:y,new:b,size:x,unreadable:S})[e??``]?.()??t??``,Ve=e=>e.head?l():u(e.role),He=e=>e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1}):``,Ue=e=>e>=1024?`${(e/1024).toFixed(e>=10240?0:1)} KB`:`${e} B`,We={intercom_message:ge,subagent_result:V,subagent_ping:we,subagent_status:H,"pi-loop-monitor":B,"memory-context":z,"doc-review":j,"straw-tower":W,"straw-link":U},X=e=>{let t=f(`<span class="ava"><svg><use/></svg></span>`);return t.querySelector(`use`).setAttribute(`href`,`#i-${p[e]??e}`),t};function Ge(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 Z(l,u,{who:f,link:p,docFor:m,page:ie}){let h=ze(),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`},pe()),T=c(`div`,{class:`chat-scroll`,tabindex:`-1`,"aria-label":re()},b,y,x,S);l.replaceChildren(T,C);let E=Le(),D=!1,O=!1,k,A,j=0,M=!1,N,P=()=>M||N!==void 0,F=()=>(clearTimeout(N),N=setTimeout(()=>(N=void 0,E.pinned&&!h.detached&&L()),250)),I=(e=E.button(h.detached))=>(C.hidden=!e,C.textContent=e??``),L=()=>(E.jump(),A=void 0,T.scrollTop=T.scrollHeight,I());async function be(e){D=!0;let t=await Re(h,u,e,e=>(J(e),qe(e))).finally(()=>D=!1),n=g.get(e);if(k===e){if(!t||!n)return L();E.hold(),A=n,n.scrollIntoView({block:`center`}),ee(n,`lit`),clearTimeout(j),j=window.setTimeout(()=>(A=void 0,n.classList.remove(`lit`)),2e3),I()}}let R=()=>k?void be(k):L(),z=(e,t,n,r)=>{e.disabled=!0,u.entry(n).then(n=>{let i=n&&r(n);if(i===void 0)return void(e.textContent=Fe());t.textContent=i,e.remove()},()=>e.textContent=Fe())};function B(e,t=0){if(!t||!u.pic)return null;let n=Array.from({length:t},(t,n)=>u.pic(e,n));return c(`div`,{class:`pics`},...n.map((e,t)=>{let r=c(`img`,{src:e,alt:le({n:t+1}),loading:`lazy`,decoding:`async`}),i=c(`button`,{type:`button`,class:`pic`,"aria-label":ke({n:t+1})},r);return r.addEventListener(`error`,()=>i.replaceWith(c(`em`,{class:`pic-gone`},ue()))),i.addEventListener(`click`,()=>void d(async()=>{let{lightbox:e}=await import(`./lightbox-BUb7EEzQ.js`);return{lightbox:e}},__vite__mapDeps([0]),import.meta.url).then(({lightbox:e})=>e(n,t))),i}))}function we(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`},je()):null;a?.addEventListener(`click`,()=>z(a,i,t,t=>(e=>e&&`${e.args??``}${e.cut?`\n${oe()}`:``}`)(t.tools?.find(t=>t.id===e.id))));let o=n?.more?c(`button`,{class:`more`,type:`button`},Ae({size:Ue(n.bytes??0)})):null;o?.addEventListener(`click`,()=>z(o,r,n.id,e=>e.text));let s=e.name===`show_doc`&&m?c(`button`,{class:`more open`,type:`button`,hidden:``},De()):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,de({count:n.images})):null,r,o)),u=n&&B(n.id,n.images);return u?[l,u]:[l]}let V=e=>c(`time`,null,He(e.at)),H=(e,t,n,r)=>c(`article`,{class:`tx you`},c(`header`,null,V(e),c(`b`,null,Ie()),X(`user`)),c(`div`,{class:`bubble`,title:r},n?c(`small`,{class:`boss-flag`},te()):null,...Ge(t),B(e.id,e.images))),U=(e,t,n,r={})=>c(`article`,{class:`tx sys`},c(`details`,{class:`notice`},c(`summary`,null,X(`comms`),c(`em`,null,fe()),...t,V(e)),r.crashed?c(`small`,{class:`boss-flag`},te()):null,c(`pre`,null,n),r.raw?c(`details`,{class:`notice-raw`},c(`summary`,null,he()),c(`pre`,{class:`raw`},r.raw)):null)),W=e=>{let t=n(e);return[ge(),` `,t.name&&p(t.name)||t.name,t.id?` (${t.id})`:``,` · `,Se()]},Oe=e=>e.kind===`link`?[{ask:ve,reply:xe,answer:_e,message:ye}[e.what]({from:e.from}),` · `,Ce()]:e.kind===`intercom`?W(e.from):[e.kind===`server`?Te():Ee()],G=()=>ie===!0&&f().head===!0,K=()=>c(`article`,{class:`tx skip`,hidden:``});function q(e){switch(e.kind){case`user`:{let t=f().service?i(e.text):void 0;if(t)return U(e,t.kind===`intercom`?W(t.from):[t.kind===`server`?Te():Ee()],e.text??``);let n=f().service?a(e.text):void 0;return H(e,n?n.body:e.text??``,n?.crashed,n?e.text??``:``)}case`assistant`:{let t=f();if(G()&&!e.text&&!e.thought&&!e.error&&!e.stop)return K();let n=c(`pre`,{class:`thought-text`}),r=e.thought?c(`button`,{class:`thought`,type:`button`},e.thought<0?Ne():Me({count:e.thought.toLocaleString()})):null;return e.thought&&e.thought>0&&r?.addEventListener(`click`,()=>z(r,n,e.id,e=>e.thoughtText)),c(`article`,{class:t.head?`tx in head`:`tx in`},X(t.head?`crown`:t.role),c(`div`,{class:`tx-body`},c(`header`,null,c(`b`,null,Ve(t)),e.model?c(`span`,null,e.model):null,V(e),e.stop?c(`span`,{class:`stop`,"data-mark":`error`},e.stop):null),r,n,e.text?c(`div`,{class:`md`},o(s(e.text))):null,e.error?c(`p`,{class:`fault`},e.error):null,...(G()?[]:e.tools??[]).flatMap(t=>we(t,e.id))))}case`bash`:return G()?K():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`},se({code:e.exit})):null),e.text?c(`pre`,{class:`out`},e.text):null));case`notice`:{let t=r(e);return t?.kind===`boss`&&f().service?H(e,t.body,t.crashed,e.text??``):G()&&(t?.kind===`server`||t?.kind===`timer`)?K():t&&t.kind!==`boss`?U(e,Oe(t),t.body,t.kind===`link`?{raw:t.raw}:{crashed:t.crashed}):U(e,[We[e.type??``]?.()??e.type??me(),` `,e.from&&p(e.from)||(e.from??``)],e.text??``)}case`divider`:return e.type===`chapter`?c(`article`,{class:`tx rule chapter`},c(`p`,null,ce({date:e.at?new Date(e.at).toLocaleDateString(t(),{year:`numeric`,month:`short`,day:`numeric`}):``,why:Be(e.code,e.text)}))):c(`article`,{class:`tx rule`},c(`details`,null,c(`summary`,null,e.type===`compaction`?ae({tokens:(e.tokens??0).toLocaleString()}):ne()),c(`pre`,null,e.text??``)));default:return c(`article`,{class:`tx note`},e.text??``,` `,V(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),O&&!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?Pe():pe(),h.items.length||y.append(w),b.hidden=!h.before,Ke()}let Y=[],Z=new Map;function Ke(){let t=new Set;for(let n of Y){let r=Date.parse(n.startedAt),i=h.items.findIndex(e=>e.at!==void 0&&Date.parse(e.at)>=r);if(i===0&&h.before)continue;let a=i<0?``:h.items[i].id,o=JSON.stringify([a,e(n)]),s=Z.get(n.id);if(t.add(n.id),s&&s.sig===o&&s.el.isConnected)continue;s?.el.remove();let l=e(n),u=c(`article`,{class:`tx rule conv-rule`},c(`div`,null,c(`b`,null,l.title),l.ended?c(`small`,null,l.ended):null));Z.set(n.id,{el:u,sig:o});let d=a?g.get(a):void 0;d?d.before(u):y.append(u)}for(let[e,n]of Z)t.has(e)||(n.el.remove(),Z.delete(e))}let qe=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)}}),Je=async()=>{if(!D&&h.before&&O){D=!0;try{let e=T.scrollHeight,t=h.prepend(await u.older(h.before));J(t),qe(t),T.scrollTop+=T.scrollHeight-e}finally{D=!1}h.before&&T.clientHeight&&b.getBoundingClientRect().bottom>=T.getBoundingClientRect().top&&Je()}};C.addEventListener(`click`,()=>{k=void 0,h.detached?u.latest().then(e=>(J(h.reset(e)),L())):L()});let Q=[new IntersectionObserver(e=>e.some(e=>e.isIntersecting)&&void Je(),{root:T}),new IntersectionObserver(e=>T.clientHeight&&(E.scrolled(e.at(-1).isIntersecting),I()),{root:T,rootMargin:`0px 0px 67px`})],$,Ye=()=>($??(Q[0].observe(b),Q[1].observe(S)),clearTimeout($),$=setTimeout(()=>($=void 0,Q.forEach(e=>e.disconnect())),600));T.addEventListener(`scroll`,()=>(Ye(),!M&&N!==void 0&&F()),{passive:!0}),T.addEventListener(`touchstart`,()=>(M=!0,clearTimeout(N),N=void 0),{passive:!0});for(let e of[`touchend`,`touchcancel`])T.addEventListener(e,()=>(M=!1,F()),{passive:!0});for(let e of[`wheel`,`touchstart`,`pointerdown`,`keydown`])T.addEventListener(e,()=>A=k=void 0,{passive:!0});let Xe=new ResizeObserver(()=>P()?void 0:E.pinned&&!h.detached?T.scrollTop=T.scrollHeight:A?.scrollIntoView({block:`center`}));return Xe.observe(y),Xe.observe(T),{log:T,docs:v,runs(e){JSON.stringify(e)!==JSON.stringify(Y)&&(Y=e,Ke())},apply(e){if(e.reset)J(h.reset({items:e.items??[],before:e.before})),O=!0,R();else if(e.items?.length){let t=h.append(e.items);J(t),qe(t),E.arrived(t.added.length)&&!h.detached&&!P()?L():I()}},reveal(e){k=e,O&&R()},setLive(e,t){x.dataset.mark=t,x.lastChild?.textContent!==e&&x.replaceChildren(...e?[c(`b`,{class:`badge`}),c(`span`,null,e)]:[])}}}export{Z as mountChat,le as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./towermodel-DJLQh2fz.js";import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./open_main_title-Ccbha5pD.js";import{n,t as r}from"./unit_count-CJMBHDBg.js";import{$ as i,Bt as a,D as o,E as s,F as c,N as l,O as u,P as d,S as f,T as p,Vt as m,_ as h,b as g,dt as _,g as v,i as ee,k as y,m as b,s as x}from"./index-DNvqiyaL.js";var S=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉清單`:`Close the list`),C=((t={},n={})=>(n.locale??e())===`zh-TW`?`切換到其他單位`:`Switch to a unit`),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`回到主地圖`:`Back to the map`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`所有單位`:`All units`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`指揮中`:`commanding`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`已結束`:`ended`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`錯誤`:`error`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`閒置`:`idle`),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`無狀態`:`unknown`),j=((t={},n={})=>(n.locale??e())===`zh-TW`?`等待`:`waiting`),M=((t={},n={})=>(n.locale??e())===`zh-TW`?`工作中`:`working`),N=.4;function P(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 F=(e,t,n)=>Math.abs(n)>=.45?n>0:e>=t*N,I=(e,t)=>t||e.some(e=>e.editable||e.sink||e.scrollsX||[`input`,`textarea`,`select`].includes(e.tag));function L(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 R=e=>{let t=[];for(let n=e;n;n=n.parentElement)t.push(L(n));return t},z={working:M,waiting:j,idle:k,done:D,error:O,unknown:A,commanding:E},B=(e,t,n)=>(t?D:z[e])({},n&&{locale:n}),V=(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 H(e){return e.bases.flatMap(e=>{let t=[{id:`tower`,rows:e.tower?V(e.id,[{...e.tower,role:`tower`}]):[]},...e.tabs.map(t=>({id:t.id,label:_({label:t.label}),rows:V(e.id,t.units)})),{id:`outside`,label:n(),rows:V(e.id,e.outside)}].filter(e=>e.rows.length);return t.length?[{id:e.id,label:e.label,mark:e.mark,groups:t}]:[]})}var U=(e,t)=>e?.head?{mark:e.head.mark,word:e.head.state===`absent`?m({},t&&{locale:t}):B(e.head.mark,!1,t)}:void 0,W=e=>e.role===`main`&&e.mark===`idle`,G=e=>e.reduce((e,t)=>(t.sub?e.at(-1)?.subs.push(t):e.push({...t,subs:[]}),e),[]),K=()=>f(`<div class="unit"><div class="card"><a class="hit"></a>${b}<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>`),q=()=>f(`<div class="unit tower-row"><div class="trow"><a class="tower-go">${b}<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>`),J=()=>f(`<section class="dbase"><h3><a></a><small></small></h3><div class="dgroups"></div></section>`),te=()=>f(`<div class="dgroup"><h4></h4><div class="drows"></div></div>`),ne=()=>matchMedia(`(max-width: 640px)`).matches;function Y(e=()=>!1){let n=i(`div`,{class:`drawer-body`}),m=i(`button`,{type:`button`,class:`x`,"aria-label":S()},`×`),_=i(`a`,{class:`drawer-map`},w()),b=i(`button`,{type:`button`,class:`pair-btn`,"data-close":`dismiss-all`,hidden:``}),E=i(`div`,{class:`drawer-sweep`,hidden:``},b);v(_,{view:`map`});let D=f(`<a class="drawer-head"><svg viewBox="0 0 512 512" aria-hidden="true"><use href="#i-crown"/></svg><span class="name"></span><b class="dstate"></b></a>`);D.hidden=!0,v(D,{view:`head`});let O=i(`aside`,{class:`drawer`,"aria-label":C()},i(`header`,null,i(`b`,null,T()),m),D,n,i(`footer`,{class:`drawer-foot`},E,_)),k=i(`div`,{class:`drawer-veil`});document.body.append(k,O);let A,j,M=!1,N=!1,L=0,z=0,V,Y=()=>{let e=U(A);D.hidden=!e,e&&(p(D,e.mark),y(D,`.name`,a()),y(D,`.dstate`,e.word),D.classList.toggle(`current`,M),D.toggleAttribute(`data-news`,ee(A?.head,x())&&!M)),c(b,A??{bases:[]}),E.hidden=b.hidden;let i=(e,t)=>{v(e.querySelector(`.hit`),{view:`session`,ws:t.ws,key:t.key}),e.querySelector(`.hit`).setAttribute(`aria-label`,`${t.name}: ${B(t.mark,t.ended)}`),e.classList.toggle(`current`,t.key===j),e.toggleAttribute(`data-dismiss`,t.role===`subagent`&&t.ended),e.dataset.key=t.key,p(e,t.mark),g(e.querySelector(`.plate`),t.role,t.mark),y(e,`.name`,t.name),y(e,`.role`,s(t.role)),y(e,`.dstate`,B(t.mark,t.ended)),o(e,`.note`,t.note,t.mark,t.note?void 0:``);let n=e.querySelector(`:scope > .card > .quit-btn`);W(t)?l(n,t):n.hidden=!0,u(e.querySelector(`.subs`),t.subs??[],K,i)},d=(e,n)=>{let r=e.querySelector(`.tower-go`),a=e.querySelector(`.tower-add`),o=A?.bases.find(e=>e.id===n.ws);v(r,{view:`session`,ws:n.ws,key:n.key}),r.setAttribute(`aria-label`,`${n.name}: ${B(n.mark,n.ended)}`),e.classList.toggle(`current`,n.key===j),e.dataset.key=n.key,p(e,n.mark),g(r.querySelector(`.plate`),`tower`,n.mark),y(r,`.name`,n.name),y(r,`.role`,s(`tower`)),y(r,`.dstate`,B(n.mark,n.ended)),a.hidden=!o,o&&(h(a,o),a.setAttribute(`aria-label`,t({base:o.label}))),u(e.querySelector(`.subs`),n.subs,K,i)};u(n,H(A??{bases:[]}),J,(e,t)=>{p(e,t.mark),y(e,`h3 a`,t.label),v(e.querySelector(`h3 a`),{view:`workspace`,ws:t.id}),y(e,`small`,r({count:t.groups.reduce((e,t)=>e+t.rows.length,0)})),u(e.querySelector(`.dgroups`),t.groups,te,(e,t)=>{y(e,`h4`,t.label??``),e.querySelector(`h4`).toggleAttribute(`hidden`,!t.label),t.id===`tower`?u(e.querySelector(`.drows`),G(t.rows),q,d):u(e.querySelector(`.drows`),G(t.rows),K,i)})})},X=e=>{L=Math.max(0,Math.min(z,e)),O.style.setProperty(`--dx`,`${L}px`),k.style.opacity=String(z?L/z:0),k.style.pointerEvents=L>0?`auto`:`none`},Z=e=>{N=e,O.classList.toggle(`on`,e),O.inert=!e,document.documentElement.classList.remove(`drawer-drag`),X(e?z:0)},Q=()=>{z=O.offsetWidth,Y(),O.classList.add(`on`),document.documentElement.classList.add(`drawer-drag`)};O.inert=!0,document.addEventListener(`touchstart`,t=>{let n=t.target,r=O.contains(n)||n===k;if(V=void 0,!ne()||e()||t.touches.length!==1||document.querySelector(`dialog.sheet[open], dialog.lightbox[open], [popover]:popover-open`)||(N?!r:I(R(n),!!getSelection()?.toString())))return;let i=t.touches[0],a=N?n.closest(`.unit[data-dismiss] > .card`)??void 0:void 0;V={x0:i.clientX,y0:i.clientY,mode:`wait`,was:N,base:L,last:i.clientX,at:performance.now(),v:0,card:a}},{passive:!0}),document.addEventListener(`touchmove`,e=>{if(!V||V.mode===`pass`)return;let t=e.touches[0],n=t.clientX-V.x0,r=t.clientY-V.y0;if(V.mode===`wait`){let e=P(n,r,V.was);if(e===`wait`)return;if(e===`pass`&&V.card&&P(n,r,!1)===`drag`)V.mode=`card`,V.card.classList.add(`swiping`);else if(e===`pass`)return void(V.mode=`pass`);else V.mode=`drag`,Q()}e.preventDefault();let i=performance.now();if(V.v=(t.clientX-V.last)/Math.max(1,i-V.at),[V.last,V.at]=[t.clientX,i],V.mode!==`card`)return X(V.base+n);let a=Math.max(0,n);V.card.style.setProperty(`--sx`,`${a}px`),V.card.style.setProperty(`--so`,String(1-a/V.card.offsetWidth))},{passive:!1});let re=(e,t)=>{e.classList.remove(`swiping`),e.style.removeProperty(`--sx`),e.style.removeProperty(`--so`),t&&(e.classList.add(`gone`),d({key:e.parentElement.dataset.key}).then(t=>t||e.classList.remove(`gone`)))},$=e=>{let t=V;V=void 0,t?.mode===`drag`&&Z(F(L,z,t.v)),t?.mode===`card`&&re(t.card,e.type===`touchend`&&F(Math.max(0,t.last-t.x0),t.card.offsetWidth,t.v))};return document.addEventListener(`touchend`,$),document.addEventListener(`touchcancel`,$),k.addEventListener(`click`,()=>Z(!1)),O.addEventListener(`click`,e=>e.target.closest(`a[data-route], button[data-open], .x`)&&Z(!1)),document.addEventListener(`keydown`,e=>N&&e.key===`Escape`&&(e.preventDefault(),Z(!1)),!0),document.addEventListener(`sb-drawer`,()=>(N||Q(),Z(!N))),{net(e){A=e,N&&Y()},route(e){j=e.view===`session`?e.key:void 0,M=e.view===`head`||e.view===`session`&&e.ws===`@head`,_.toggleAttribute(`aria-current`,e.view===`map`),N&&Y()}}}export{Y as mountDrawer};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./zenchunk-Cjg1XxCH.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{C as e,E as t,S as n,T as r,a as i,b as a,f as o,g as s,h as c,m as l,p as u,u as d,v as f,w as p}from"./towermodel-DJLQh2fz.js";import{i as m,n as h,r as g,t as _}from"./runtime-ZX6HkxDa.js";import{n as v}from"./post-DDdE-PdN.js";var y={view:`sb.view`,locale:`sb-locale`,sound:`sb.sound`,volume:`sb.volume`,remind:`sb.remind`,wide:`sb.dialog-wide`,zenHint:`sb.zen.homehint`,zenMusic:`sb.zen.music`,zenTrack:`sb.zen.track`},ee={view:e=>e??`auto`,locale:e=>e??null,sound:e=>e===`1`,volume:e=>Math.min(100,Math.max(0,Number(e??`60`)||0)),remind:e=>(e??`1`)===`1`,wide:e=>e===`1`,zenHint:e=>e!==null,zenMusic:e=>e===`1`,zenTrack:e=>e??null};function b(e){let t=[];return{get(t){let n;try{n=e.getItem?.(y[t])}catch{}return ee[t](n)},set(t,n){try{return e.setItem(y[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([y[e],n])}}}var x=b({getItem:e=>localStorage.getItem(e),setItem:(e,t)=>localStorage.setItem(e,t)});y.view;var te={geek:`#000000`,zen:`#14110e`},ne=e=>e===`standard`||e===`geek`||e===`zen`?e:`auto`,re=(e,t=`auto`)=>t===`auto`?e?`geek`:`standard`:t,ie=(e,t,n=`auto`)=>e===`auto`?re(t,n):e;function ae(){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 oe(e=ae()){let t=[],n=[],r=e.meta?.content??``,i=b(e.storage),a=()=>ne(i.get(`view`)),o=a(),s=ne(e.server?.content),c;function l(n){let i=ie(o,e.media.matches,s),a=i===`zen`&&e.root.dataset.zenAway!==void 0?`standard`:i;e.root.dataset.view=a,e.meta&&(e.meta.content=a===`standard`?r:te[a]);let l=n===`pick`||n===`follow`&&c!==void 0&&c!==i;if(c=i,l)for(let e of t)e(i,n)}return l(),e.media.addEventListener(`change`,()=>l(`follow`)),{choice:()=>o,view:()=>ie(o,e.media.matches,s),server:()=>s,setServer(e){let t=ne(typeof e==`string`?e:void 0);if(t!==s){s=t;for(let e of n)e(s);l(`follow`)}},set(e){o=e,i.set(`view`,e),l(`pick`)},refresh:()=>l(),reread(){o=a(),l(`pick`)},onStored:e=>i.on(`view`,e),onChange:e=>void t.push(e),onServer:e=>void n.push(e)}}function se(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(ne(e.dataset.choice)),o()));t.onStored(()=>(t.reread(),o())),o()}var ce=(e,t)=>(delete t.dataset.zenAway,e.reread());function le(e,t,n,r=()=>ce(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 ue(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 de=e=>e.mark===`waiting`||e.pending?0:1,fe=e=>[...e].filter(e=>de(e)===0),pe=e=>`${e?.n}m`,me=e=>`${e?.n} 分`,he=((e,t={})=>(t.locale??_())===`zh-TW`?me(e):pe(e)),ge=e=>`${e?.n}s`,_e=e=>`${e?.n} 秒`,ve=((e,t={})=>(t.locale??_())===`zh-TW`?_e(e):ge(e)),ye=((e={},t={})=>(t.locale??_())===`zh-TW`?`警示`:`Alerts`),be=((e={},t={})=>(t.locale??_())===`zh-TW`?`所有基地`:`all bases`),xe=e=>`ally run · ${e?.device}`,Se=e=>`隊友 run · ${e?.device}`,Ce=((e,t={})=>(t.locale??_())===`zh-TW`?Se(e):xe(e)),we=((e={},t={})=>(t.locale??_())===`zh-TW`?`唯讀查看這個隊友 run 的通訊`:`Read this ally run's comms (read only)`),Te=((e={},t={})=>(t.locale??_())===`zh-TW`?`還看不到它的通訊:尚未取得這個 run 的工作階段檔`:`Its comms are not shown yet: the run's session file is not known`),Ee=e=>`${e?.team} · teammate`,De=e=>`${e?.team} · 隊友`,Oe=((e,t={})=>(t.locale??_())===`zh-TW`?De(e):Ee(e)),ke=((e={},t={})=>(t.locale??_())===`zh-TW`?`返回`:`Back`),Ae=((e={},t={})=>(t.locale??_())===`zh-TW`?``:`.`),je=((e={},t={})=>(t.locale??_())===`zh-TW`?`最後更新:`:`Last update`),Me=e=>`Disconnected. Gave up after ${e?.tries} tries; it reconnects when you return to this tab.`,Ne=e=>`連線中斷。重試 ${e?.tries} 次後放棄;回到此分頁時會重新連線。`,Pe=((e,t={})=>(t.locale??_())===`zh-TW`?Ne(e):Me(e)),Fe=e=>`The server is up but cannot read the net: ${e?.problem}`,Ie=e=>`伺服器正常,但讀不到網:${e?.problem}`,Le=((e,t={})=>(t.locale??_())===`zh-TW`?Ie(e):Fe(e)),Re=((e={},t={})=>(t.locale??_())===`zh-TW`?`與稻草網的連線中斷,正在重新連線…畫面顯示的是最後已知狀態。`:`Disconnected from the straw net. Reconnecting… The view shows the last known state.`),ze=e=>`Disconnected from the straw net. Reconnecting (try ${e?.attempt})… The view shows the last known state.`,Be=e=>`與稻草網的連線中斷,正在重新連線(第 ${e?.attempt} 次)…畫面顯示的是最後已知狀態。`,Ve=((e,t={})=>(t.locale??_())===`zh-TW`?Be(e):ze(e)),He=((e={},t={})=>(t.locale??_())===`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.`),Ue=((e={},t={})=>(t.locale??_())===`zh-TW`?`Straw Net:所有基地`:`Straw Net: all bases`),We=((e={},t={})=>(t.locale??_())===`zh-TW`?`取消`:`Cancel`),Ge=((e={},t={})=>(t.locale??_())===`zh-TW`?`關閉`:`Close`),Ke=e=>`Quit base ${e?.name}`,qe=e=>`關掉基地 ${e?.name}`,Je=((e,t={})=>(t.locale??_())===`zh-TW`?qe(e):Ke(e)),Ye=e=>`Quit base ${e?.name}? Every agent in it and its tower quit. Nothing quits while anything running would be lost.`,Xe=e=>`要關掉基地 ${e?.name} 嗎?裡面所有 agent 和塔台都會退出。有會遺失的東西時什麼都不關。`,Ze=((e,t={})=>(t.locale??_())===`zh-TW`?Xe(e):Ye(e)),Qe=e=>`Quit squad ${e?.name}`,$e=e=>`關掉小隊 ${e?.name}`,et=((e,t={})=>(t.locale??_())===`zh-TW`?$e(e):Qe(e)),tt=e=>`Quit squad ${e?.name}? Every agent in it quits.`,nt=e=>`要關掉小隊 ${e?.name} 嗎?裡面所有 agent 都會退出。`,rt=((e,t={})=>(t.locale??_())===`zh-TW`?nt(e):tt(e)),it=e=>`Quit the tower ${e?.name}? The base's mains become members again.`,at=e=>`要關掉塔台 ${e?.name} 嗎?這個基地的主智慧體都會降格成成員。`,ot=((e,t={})=>(t.locale??_())===`zh-TW`?at(e):it(e)),st=e=>`Quit ${e?.name}`,ct=e=>`關掉 ${e?.name}`,lt=((e,t={})=>(t.locale??_())===`zh-TW`?ct(e):st(e)),ut=e=>`Quit ${e?.name}? It quits pi and its pane closes.`,dt=e=>`要關掉 ${e?.name} 嗎?它會退出 pi,窗格也會關掉。`,ft=((e,t={})=>(t.locale??_())===`zh-TW`?dt(e):ut(e)),pt=((e={},t={})=>(t.locale??_())===`zh-TW`?`連線中…`:`Connecting…`),mt=((e={},t={})=>(t.locale??_())===`zh-TW`?`重新連線中…`:`Reconnecting…`),ht=((e={},t={})=>(t.locale??_())===`zh-TW`?`重試`:`Try again`),gt=e=>`control tower · ${e?.state}`,_t=e=>`塔台 · ${e?.state}`,vt=((e,t={})=>(t.locale??_())===`zh-TW`?_t(e):gt(e)),yt=((e={},t={})=>(t.locale??_())===`zh-TW`?`圖示來自 game-icons.net(Lorc、Delapouite),CC BY 3.0。`:`Icons from game-icons.net by Lorc and Delapouite, CC BY 3.0.`),bt=((e={},t={})=>(t.locale??_())===`zh-TW`?`移除`:`Dismiss`),xt=e=>`Dismiss finished (${e?.count})`,St=e=>`移除已完成(${e?.count})`,Ct=((e,t={})=>(t.locale??_())===`zh-TW`?St(e):xt(e)),wt=e=>`Dismiss ${e?.name}`,Tt=e=>`從畫面移除 ${e?.name}`,Et=((e,t={})=>(t.locale??_())===`zh-TW`?Tt(e):wt(e)),Dt=((e={},t={})=>(t.locale??_())===`zh-TW`?`文件`:`Documents`),Ot=((e={},t={})=>(t.locale??_())===`zh-TW`?`第一則訊息會開啟主塔台`:`The head tower opens with your first message`),kt=((e={},t={})=>(t.locale??_())===`zh-TW`?`已回覆`:`answered`),At=((e={},t={})=>(t.locale??_())===`zh-TW`?`沒有塔台`:`no tower`),jt=((e={},t={})=>(t.locale??_())===`zh-TW`?`沒回應`:`no answer`),Mt=((e={},t={})=>(t.locale??_())===`zh-TW`?`等回覆`:`waiting`),Nt=((e={},t={})=>(t.locale??_())===`zh-TW`?`交給各塔台的工作`:`Work handed to the towers`),Pt=((e={},t={})=>(t.locale??_())===`zh-TW`?`關閉主塔台`:`Close the head tower`),Ft=((e={},t={})=>(t.locale??_())===`zh-TW`?`要關閉主塔台嗎?對話和記憶都會保留。`:`Close the head tower? The conversation and its memory are kept.`),It=e=>`→ ${e?.count} towers · ${e?.age} ago · ${e?.replied}/${e?.count} replied`,Lt=e=>`→ ${e?.count} 個塔台・${e?.age}前・回覆 ${e?.replied}/${e?.count}`,Rt=((e,t={})=>(t.locale??_())===`zh-TW`?Lt(e):It(e)),zt=e=>`→ 1 tower · ${e?.age} ago · ${e?.replied}/1 replied`,Bt=e=>`→ 1 個塔台・${e?.age}前・回覆 ${e?.replied}/1`,Vt=((e,t={})=>(t.locale??_())===`zh-TW`?Bt(e):zt(e)),Ht=((e={},t={})=>(t.locale??_())===`zh-TW`?`主塔台有新的話`:`The head tower said something new`),Ut=e=>`Older (${e?.count})`,Wt=e=>`更早(${e?.count})`,Gt=((e,t={})=>(t.locale??_())===`zh-TW`?Wt(e):Ut(e)),Kt=((e={},t={})=>(t.locale??_())===`zh-TW`?`尚未開啟`:`not open`),S=((e={},t={})=>(t.locale??_())===`zh-TW`?`主塔台`:`Head tower`),qt=((e={},t={})=>(t.locale??_())===`zh-TW`?`語言`:`Language`),Jt=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`,Yt=e=>`${e?.label}(${e?.short})請你確認它的塔台 ${e?.tower} 的一次 ${e?.tool} 呼叫,該塔台正在處理你送出的訊息`,Xt=((e,t={})=>(t.locale??_())===`zh-TW`?Yt(e):Jt(e)),Zt=e=>`${e?.label} (${e?.short}) asks you to confirm a ${e?.tool} call from its tower`,Qt=e=>`${e?.label}(${e?.short})請你確認它塔台的一次 ${e?.tool} 呼叫`,$t=((e,t={})=>(t.locale??_())===`zh-TW`?Qt(e):Zt(e)),en=e=>`${e?.label} (${e?.short}) in team ${e?.team} asks a question (${e?.owner}).`,tn=e=>`團隊 ${e?.team} 的 ${e?.label}(${e?.short})問了一個問題(${e?.owner})。`,nn=((e,t={})=>(t.locale??_())===`zh-TW`?tn(e):en(e)),rn=e=>`Team ${e?.team} stopped: ${e?.reason}`,an=e=>`團隊 ${e?.team} 已停止:${e?.reason}`,on=((e,t={})=>(t.locale??_())===`zh-TW`?an(e):rn(e)),sn=e=>{let t=p(`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`},cn=e=>`團隊 ${e?.team} 有 ${e?.count} 則訊息已等了超過 10 分鐘,塔台一直不閒`,ln=((e,t={})=>(t.locale??_())===`zh-TW`?cn(e):sn(e)),un=e=>{let t=p(`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`},dn=e=>`團隊 ${e?.team} 的收件匣有 ${e?.count} 則訊息在等:專案上沒有開著的塔台`,fn=((e,t={})=>(t.locale??_())===`zh-TW`?dn(e):un(e)),pn=e=>`${e?.label} (${e?.short}) asks to join team ${e?.team}`,mn=e=>`${e?.label}(${e?.short})要求加入團隊 ${e?.team}`,hn=((e,t={})=>(t.locale??_())===`zh-TW`?mn(e):pn(e)),gn=e=>`${e?.label} (${e?.short}), an unattended device, asks to join team ${e?.team}`,_n=e=>`${e?.label}(${e?.short})是無人值守的裝置,要求加入團隊 ${e?.team}`,vn=((e,t={})=>(t.locale??_())===`zh-TW`?_n(e):gn(e)),yn=e=>`${e?.label} (${e?.short}) shows another roster than this computer in team ${e?.team}; the relay may be showing different rosters`,bn=e=>`團隊 ${e?.team} 中,${e?.label}(${e?.short})顯示的名冊和這台電腦不同;中繼站可能對不同人顯示不同名冊`,xn=((e,t={})=>(t.locale??_())===`zh-TW`?bn(e):yn(e)),Sn=e=>`${e?.label} (${e?.short}), unattended, in team ${e?.team} — ${e?.what}, ${e?.unit}: ${e?.text}`,Cn=e=>`團隊 ${e?.team} 無人值守的 ${e?.label}(${e?.short}):${e?.what},${e?.unit}:${e?.text}`,wn=((e,t={})=>(t.locale??_())===`zh-TW`?Cn(e):Sn(e)),Tn=e=>{let t=p(`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`},En=e=>`團隊 ${e?.team} 的收件匣有 ${e?.count} 則 Straw Link 訊息等隊友 run 接手已超過 10 分鐘。請看地圖上塔台的卡片:塔台已暫停或 run 啟動被拒,都會讓它們一直等。`,Dn=((e,t={})=>(t.locale??_())===`zh-TW`?En(e):Tn(e)),On=e=>`The relay of team ${e?.team} has been unreachable for ${e?.minutes} minutes`,kn=e=>`團隊 ${e?.team} 的中繼站已經 ${e?.minutes} 分鐘連不上`,An=((e,t={})=>(t.locale??_())===`zh-TW`?kn(e):On(e)),jn=e=>`Link ${e?.count}`,Mn=e=>`連線 ${e?.count}`,Nn=((e,t={})=>(t.locale??_())===`zh-TW`?Mn(e):jn(e)),Pn=((e={},t={})=>(t.locale??_())===`zh-TW`?`Straw Link 通知`:`Straw Link notices`),Fn=((e={},t={})=>(t.locale??_())===`zh-TW`?`允許`:`Allow`),In=((e={},t={})=>(t.locale??_())===`zh-TW`?`連線中`:`connecting`),Ln=((e={},t={})=>(t.locale??_())===`zh-TW`?`拒絕`:`Deny`),Rn=((e={},t={})=>(t.locale??_())===`zh-TW`?`即時`:`live`),zn=((e={},t={})=>(t.locale??_())===`zh-TW`?`尚未見到`:`not seen yet`),Bn=((e={},t={})=>(t.locale??_())===`zh-TW`?`清除`:`Clear`),Vn=((e={},t={})=>(t.locale??_())===`zh-TW`?`離線`:`offline`),Hn=((e={},t={})=>(t.locale??_())===`zh-TW`?`在線`:`online`),Un=((e={},t={})=>(t.locale??_())===`zh-TW`?`開啟團隊`:`Open Teams`),Wn=((e={},t={})=>(t.locale??_())===`zh-TW`?`重新連線中`:`reconnecting`),Gn=((e={},t={})=>(t.locale??_())===`zh-TW`?`查看`:`Review`),Kn=e=>`seen ${e?.ago} ago`,qn=e=>`${e?.ago}前見到`,Jn=((e,t={})=>(t.locale??_())===`zh-TW`?qn(e):Kn(e)),Yn=((e={},t={})=>(t.locale??_())===`zh-TW`?`查看塔台`:`Show towers`),Xn=((e={},t={})=>(t.locale??_())===`zh-TW`?`當掉`:`crashed`),Zn=((e={},t={})=>(t.locale??_())===`zh-TW`?`當掉後暫停`:`held after crashes`),Qn=((e={},t={})=>(t.locale??_())===`zh-TW`?`執行中`:`running`),$n=e=>{let t=p(`en`,e?.count,{},!0);return t===`one`?`${e?.count} unit online`:t===`other`?`${e?.count} units online`:`link_unit_summary`},er=e=>`${e?.count} 個單位在線`,tr=((e,t={})=>(t.locale??_())===`zh-TW`?er(e):$n(e)),nr=((e={},t={})=>(t.locale??_())===`zh-TW`?`待信任`:`needs trust`),rr=((e={},t={})=>(t.locale??_())===`zh-TW`?`正體中文`:`English`),ir=((e={},t={})=>(t.locale??_())===`zh-TW`?`位置`:`Location`),ar=e=>`${e?.name} is commanding`,or=e=>`${e?.name} 指揮中`,sr=((e,t={})=>(t.locale??_())===`zh-TW`?or(e):ar(e)),cr=e=>`${e?.name} finished`,lr=e=>`${e?.name} 已完成`,ur=((e,t={})=>(t.locale??_())===`zh-TW`?lr(e):cr(e)),dr=e=>`${e?.name} hit an error`,fr=e=>`${e?.name} 發生錯誤`,pr=((e,t={})=>(t.locale??_())===`zh-TW`?fr(e):dr(e)),mr=e=>`${e?.name} went idle`,hr=e=>`${e?.name} 轉為閒置`,gr=((e,t={})=>(t.locale??_())===`zh-TW`?hr(e):mr(e)),_r=e=>`${e?.name} joined`,vr=e=>`${e?.name} 加入`,yr=((e,t={})=>(t.locale??_())===`zh-TW`?vr(e):_r(e)),br=e=>`${e?.name} left`,xr=e=>`${e?.name} 離開`,Sr=((e,t={})=>(t.locale??_())===`zh-TW`?xr(e):br(e)),Cr=e=>`${e?.name} lost its status`,wr=e=>`${e?.name} 失去狀態`,Tr=((e,t={})=>(t.locale??_())===`zh-TW`?wr(e):Cr(e)),Er=e=>`${e?.name} is waiting on a question`,Dr=e=>`${e?.name} 正在等待回答`,Or=((e,t={})=>(t.locale??_())===`zh-TW`?Dr(e):Er(e)),kr=e=>`${e?.name} started working`,Ar=e=>`${e?.name} 開始工作`,jr=((e,t={})=>(t.locale??_())===`zh-TW`?Ar(e):kr(e)),Mr=((e={},t={})=>(t.locale??_())===`zh-TW`?`指揮中`:`commanding`),Nr=((e={},t={})=>(t.locale??_())===`zh-TW`?`已完成`:`finished`),Pr=((e={},t={})=>(t.locale??_())===`zh-TW`?`錯誤`:`error`),Fr=((e={},t={})=>(t.locale??_())===`zh-TW`?`閒置`:`idle`),Ir=((e={},t={})=>(t.locale??_())===`zh-TW`?`無狀態`:`no status`),C=((e={},t={})=>(t.locale??_())===`zh-TW`?`等待回答`:`waiting on a question`),Lr=((e={},t={})=>(t.locale??_())===`zh-TW`?`工作中`:`working`),Rr=((e={},t={})=>(t.locale??_())===`zh-TW`?`確認`:`Confirm`),zr=((e={},t={})=>(t.locale??_())===`zh-TW`?`駁回`:`Reject`),Br=((e={},t={})=>(t.locale??_())===`zh-TW`?`更多`:`More`),Vr=e=>`More actions for ${e?.name}`,Hr=e=>`「${e?.name}」的更多動作`,Ur=((e,t={})=>(t.locale??_())===`zh-TW`?Hr(e):Vr(e)),Wr=((e={},t={})=>(t.locale??_())===`zh-TW`?`地圖總覽`:`Overview of the map`),Gr=e=>`Monitor failed: ${e?.what}`,Kr=e=>`Monitor 出錯:${e?.what}`,qr=((e,t={})=>(t.locale??_())===`zh-TW`?Kr(e):Gr(e)),Jr=e=>`Monitor went quiet and stopped: ${e?.what}`,Yr=e=>`Monitor 太久沒輸出,已停止:${e?.what}`,Xr=((e,t={})=>(t.locale??_())===`zh-TW`?Yr(e):Jr(e)),Zr=((e={},t={})=>(t.locale??_())===`zh-TW`?`從未`:`never`),Qr=((e={},t={})=>(t.locale??_())===`zh-TW`?`+新基地`:`+ New base`),$r=((e={},t={})=>(t.locale??_())===`zh-TW`?`沒有執行中的智慧體`:`no agent running`),ei=((e={},t={})=>(t.locale??_())===`zh-TW`?`無警示`:`no alerts`),w=((e={},t={})=>(t.locale??_())===`zh-TW`?`伺服器沒有回應。`:`The server did not answer.`),ti=((e={},t={})=>(t.locale??_())===`zh-TW`?`尚無塔台`:`no tower yet`),ni=((e={},t={})=>(t.locale??_())===`zh-TW`?`監看中`:`Watching a monitor`),ri=((e={},t={})=>(t.locale??_())===`zh-TW`?`思考中`:`thinking`),ii=e=>`Finished ${e?.note}`,ai=e=>`完成了 ${e?.note}`,oi=((e,t={})=>(t.locale??_())===`zh-TW`?ai(e):ii(e)),si=e=>`Failed ${e?.note}`,ci=e=>`出錯了 ${e?.note}`,li=((e,t={})=>(t.locale??_())===`zh-TW`?ci(e):si(e)),ui=e=>`Waiting on you ${e?.note}`,di=e=>`等你回答 ${e?.note}`,fi=((e,t={})=>(t.locale??_())===`zh-TW`?di(e):ui(e)),pi=((e={},t={})=>(t.locale??_())===`zh-TW`?`+主智慧體`:`+ Main`),mi=((e={},t={})=>(t.locale??_())===`zh-TW`?`+成員`:`+ Member`),hi=((e={},t={})=>(t.locale??_())===`zh-TW`?`前哨`:`Outposts`),gi=((e={},t={})=>(t.locale??_())===`zh-TW`?`Herdr 開了新窗格,請到 Herdr 裡接著做。`:`A pane opened in Herdr; carry on there.`),_i=((e={},t={})=>(t.locale??_())===`zh-TW`?`接回`:`Pop`),vi=e=>`Pop ${e?.name}`,yi=e=>`接回 ${e?.name}`,bi=((e,t={})=>(t.locale??_())===`zh-TW`?yi(e):vi(e)),xi=((e={},t={})=>(t.locale??_())===`zh-TW`?`伺服器送來的快照,頁面無法讀取`:`the server sent a snapshot the page cannot read`),Si=((e={},t={})=>(t.locale??_())===`zh-TW`?`伺服器回報了頁面無法讀取的問題`:`the server reported a problem the page cannot read`),Ci=((e={},t={})=>(t.locale??_())===`zh-TW`?`關掉`:`Quit`),wi=((e={},t={})=>(t.locale??_())===`zh-TW`?`關掉塔台`:`Quit tower`),Ti=e=>`Refused (${e?.status}).`,Ei=e=>`已拒絕(${e?.status})。`,T=((e,t={})=>(t.locale??_())===`zh-TW`?Ei(e):Ti(e)),Di=((e={},t={})=>(t.locale??_())===`zh-TW`?`提醒`:`Remind`),Oi=((e={},t={})=>(t.locale??_())===`zh-TW`?`點一下允許瀏覽器通知`:`Press to allow browser notifications`),ki=((e={},t={})=>(t.locale??_())===`zh-TW`?`瀏覽器已封鎖通知,要到網站設定裡允許`:`The browser blocks notifications; allow them in the site settings`),Ai=((e={},t={})=>(t.locale??_())===`zh-TW`?`提醒已關`:`Reminders off`),ji=((e={},t={})=>(t.locale??_())===`zh-TW`?`提醒已開:分頁不在前景時,單位等你回答、完成或出錯會跳系統通知`:`Reminders on: while the page is in the background, a unit waiting on you, finishing, or failing raises a system notification`),Mi=((e={},t={})=>(t.locale??_())===`zh-TW`?`這個瀏覽器不支援通知`:`This browser has no notifications`),Ni=((e={},t={})=>(t.locale??_())===`zh-TW`?`主智慧體`:`main`),Pi=((e={},t={})=>(t.locale??_())===`zh-TW`?`成員`:`member`),Fi=((e={},t={})=>(t.locale??_())===`zh-TW`?`前哨`:`outpost`),Ii=((e={},t={})=>(t.locale??_())===`zh-TW`?`未編入`:`unaligned`),Li=((e={},t={})=>(t.locale??_())===`zh-TW`?`事件 run`:`event run`),Ri=((e={},t={})=>(t.locale??_(),`session`)),zi=((e={},t={})=>(t.locale??_())===`zh-TW`?`子智慧體`:`subagent`),Bi=((e={},t={})=>(t.locale??_())===`zh-TW`?`塔台`:`tower`),Vi=((e={},t={})=>(t.locale??_())===`zh-TW`?`這台裝置`:`This device`),Hi=((e={},t={})=>(t.locale??_())===`zh-TW`?`這些選擇只留在這台裝置的這個瀏覽器。`:`These choices stay on this device, in this browser.`),Ui=((e={},t={})=>(t.locale??_())===`zh-TW`?`手機與裝置`:`Phone & devices`),Wi=((e={},t={})=>(t.locale??_())===`zh-TW`?`伺服器`:`Server`),Gi=((e={},t={})=>(t.locale??_())===`zh-TW`?`團隊`:`Teams`),Ki=((e={},t={})=>(t.locale??_())===`zh-TW`?`設定`:`Settings`),qi=((e={},t={})=>(t.locale??_())===`zh-TW`?`音效`:`Sound`),Ji=((e={},t={})=>(t.locale??_())===`zh-TW`?`音效:開關、音量與試聽`:`Sounds: on or off, volume, and a try`),Yi=((e={},t={})=>(t.locale??_())===`zh-TW`?`▶ 試聽`:`▶ Try`),Xi=((e={},t={})=>(t.locale??_())===`zh-TW`?`音量`:`Volume`),Zi=((e={},t={})=>(t.locale??_())===`zh-TW`?`收起`:`Stash`),Qi=e=>`Stash base ${e?.name}`,$i=e=>`收起基地 ${e?.name}`,ea=((e,t={})=>(t.locale??_())===`zh-TW`?$i(e):Qi(e)),ta=e=>`Stash base ${e?.name}? Its tower, mains, and members quit and come back with Pop. Nothing is stashed while anything running would be lost.`,na=e=>`要收起基地 ${e?.name} 嗎?塔台、主智慧體和成員會結束,之後可以用「接回」叫回來。有會遺失的東西時不會收。`,ra=((e,t={})=>(t.locale??_())===`zh-TW`?na(e):ta(e)),ia=e=>`Stashed (${e?.count})`,aa=e=>`已收起(${e?.count})`,oa=((e,t={})=>(t.locale??_())===`zh-TW`?aa(e):ia(e)),sa=((e={},t={})=>(t.locale??_())===`zh-TW`?`智慧體`:`Agents`),ca=((e={},t={})=>(t.locale??_())===`zh-TW`?`基地`:`Bases`),la=((e={},t={})=>(t.locale??_())===`zh-TW`?`指揮中`:`Commanding`),ua=((e={},t={})=>(t.locale??_())===`zh-TW`?`等待中`:`Waiting`),da=((e={},t={})=>(t.locale??_())===`zh-TW`?`工作中`:`Working`),fa=((e={},t={})=>(t.locale??_())===`zh-TW`?`待允許`:`Allow?`),pa=((e={},t={})=>(t.locale??_())===`zh-TW`?`被擋`:`Blocked`),ma=((e={},t={})=>(t.locale??_())===`zh-TW`?`關`:`Off`),ha=((e={},t={})=>(t.locale??_())===`zh-TW`?`開`:`On`),ga=((e={},t={})=>(t.locale??_())===`zh-TW`?`狀態`:`States`),_a=e=>`tab ${e?.label}`,va=e=>`分頁 ${e?.label}`,ya=((e,t={})=>(t.locale??_())===`zh-TW`?va(e):_a(e)),ba=((e={},t={})=>(t.locale??_())===`zh-TW`?`即時網況 · 通訊`:`live net · comms`),xa=((e={},t={})=>(t.locale??_())===`zh-TW`?`網路活動`:`Net activity`),Sa=((e={},t={})=>(t.locale??_())===`zh-TW`?`伺服器啟動後還沒有動靜`:`Nothing has happened since the server started`),Ca=((e={},t={})=>(t.locale??_())===`zh-TW`?`現在`:`now`),wa=e=>`${e?.count} events in 30 min`,Ta=e=>`近 30 分鐘 ${e?.count} 筆`,Ea=((e,t={})=>(t.locale??_())===`zh-TW`?Ta(e):wa(e)),Da=((e={},t={})=>(t.locale??_())===`zh-TW`?`網的總計`:`Net totals`),Oa=((e={},t={})=>(t.locale??_())===`zh-TW`?`去處理`:`Handle`),ka=((e={},t={})=>(t.locale??_())===`zh-TW`?`重新送達`:`Deliver again`),Aa=((e={},t={})=>(t.locale??_())===`zh-TW`?`捨棄`:`Drop`),ja=((e={},t={})=>(t.locale??_())===`zh-TW`?`重試`:`Retry`),Ma=((e={},t={})=>(t.locale??_())===`zh-TW`?`有智慧體等你同意,才能載入資料夾的設定`:`An agent needs your OK to load a folder's settings`),Na=e=>`using ${e?.tool}`,Pa=e=>`使用 ${e?.tool}`,Fa=((e,t={})=>(t.locale??_())===`zh-TW`?Pa(e):Na(e)),Ia=((e={},t={})=>(t.locale??_())===`zh-TW`?`自動`:`Auto`),La=e=>`Follow server (${e?.view})`,Ra=e=>`跟隨伺服器(${e?.view})`,za=((e,t={})=>(t.locale??_())===`zh-TW`?Ra(e):La(e)),Ba=((e={},t={})=>(t.locale??_())===`zh-TW`?`極客`:`Geek`),Va=((e={},t={})=>(t.locale??_())===`zh-TW`?`檢視`:`View`),Ha=((e={},t={})=>(t.locale??_())===`zh-TW`?`標準`:`Standard`),Ua=((e={},t={})=>(t.locale??_())===`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`),Wa=((e={},t={})=>(t.locale??_())===`zh-TW`?`禪`:`Zen`),Ga=((e={},t={})=>(t.locale??_())===`zh-TW`?`略過`:`Dismiss`),Ka=((e={},t={})=>(t.locale??_())===`zh-TW`?`禪`:`Zen`),qa=((e={},t={})=>(t.locale??_())===`zh-TW`?`回到禪`:`Back to Zen`),Ja=new Set,Ya=e=>e.unit??e.key;function Xa(e,t){let n=new Map;for(let{base:r,unit:i}of ue(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 e of s(r.id,i,t))n.set(e.key,e);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&&Ja.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 Za(e,t){return[...t.values()].filter(t=>{let n=e?.get(t.key);return de(t)===0?!n||de(n)!==0||n.mark!==t.mark:e!==void 0&&n?.mark!==t.mark&&(t.mark===`error`||t.mark===`done`)})}var Qa={count:!0,signal:!0,announce:`arrivals`,keys:`dialogs`,drawer:!0,calm:!0,chime:!0,escape:`stay`},$a={standard:Qa,geek:{...Qa,calm:!1},zen:{count:!1,signal:!1,announce:`current`,keys:`zen`,drawer:!1,calm:!0,chime:!1,escape:`blur`}},eo=(e,t)=>$a[e===`zen`&&t?`standard`:e],to=(...e)=>e.filter(e=>e!==!1&&e!=null),no=(e,t)=>(e.classList.add(t),e.classList.toggle(`flip`));function E(e,t,...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t??{}))r.setAttribute(e,n);return r.append(...to(...n)),r}var D=e=>String(e??``);function ro(e){let t=e.data,n=e.teamName;switch(e.kind){case`join-request`:return t.unattended?vn({label:D(t.label),short:D(t.short),team:n}):hn({label:D(t.label),short:D(t.short),team:n});case`confirm`:return t.tower?Xt({label:D(t.label),short:D(t.short),tool:D(t.tool),tower:D(t.tower)}):$t({label:D(t.label),short:D(t.short),tool:D(t.tool)});case`dialog`:return nn({label:D(t.label),short:D(t.short),team:n,owner:D(t.owner)});case`fork`:return on({team:n,reason:D(t.reason)});case`mismatch`:return xn({label:D(t.label),short:D(t.short),team:n});case`unreachable`:return An({team:n,minutes:D(t.minutes)});case`inbox`:return fn({count:Number(t.count)||0,team:n});case`held`:return ln({count:Number(t.count)||0,team:n});case`served`:return Dn({count:Number(t.count)||0,team:n});case`notice`:return wn({label:D(t.label),short:D(t.short),team:n,what:D(t.what),unit:D(t.unit),text:D(t.text)})}}var io=e=>ro({id:``,kind:`confirm`,level:`warning`,team:e.team,teamName:``,data:{label:e.fromLabel,short:e.fromShort,tool:e.tool,tower:e.tower}}),ao=e=>{let t={error:0,warning:1,info:2};return[...e].sort((e,n)=>t[e.level]-t[n.level])};function oo(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 so(e,n){if(e===null)return zn();if(n)return Hn();let i=Math.floor(e/1e3);return Jn({ago:i<3600?he({n:String(Math.max(1,Math.floor(i/60)))}):i<86400?r({n:String(Math.floor(i/3600))}):t({n:String(Math.floor(i/86400))})})}function co(e){return e.online?e.tower===`blocked`?`waiting`:e.tower===`working`?`working`:e.tower===`unknown`?`unknown`:`idle`:`unknown`}function lo(e){switch(e){case`working`:return Lr();case`blocked`:return C();case`idle`:return Fr();case`done`:return Nr();case`unknown`:return Ir();default:return e}}function uo(e){let{closed:t,answered:n}=e.data;return t===void 0?n?`sent`:`open`:t===`remote`?n?`done-here`:`done-other`:t===`local`?`done-local`:t===`cancel`?`cancelled`:t===`withdrawn`?`withdrawn`:`expired`}function fo(e,t){let n=(e??[]).find(e=>e.team===t.team&&e.device===t.device);return n?n.units.filter(e=>t.workspace===null||e.unit===t.workspace).map(e=>({...e,at:n.at,stale:n.stale===!0})):[]}var po=[`run-crashed`,`trust-unanswered`];function mo(e){switch(e){case`standing`:case`idle`:case`done`:return{tone:`idle`,word:n()};case`running`:case`working`:case`waking`:case`commanding`:return{tone:`working`,word:Qn()};case`blocked`:return{tone:`waiting`,word:C()};case`held`:return{tone:`crashed`,word:Zn()};case`closing`:return{tone:`other`,word:f()};default:return{tone:`other`,word:lo(e)}}}function ho(e,t,n,r,i=new Map){return fo(e,n).map(e=>{let a=mo(e.state),o=`${n.team}/${n.device}/${e.unit}`;a.tone===`working`&&i.set(o,Math.max(i.get(o)??0,e.at));let s=t?.filter(t=>t.kind===`notice`&&po.includes(String(t.data.what))&&t.team===n.team&&t.data.device===n.device&&t.data.unit===e.unit&&Number(t.data.at)>0).map(e=>({at:Number(e.data.at),text:String(e.data.text??``),trust:e.data.what===`trust-unanswered`})).sort((e,t)=>t.at-e.at)[0],c=s!==void 0&&a.tone!==`working`&&r-s.at<18e5&&s.at>(i.get(o)??0)?{at:s.at,text:s.text,...s.trust?{trust:!0}:{}}:void 0,l=c?a.tone===`crashed`?a:c.trust?{tone:`waiting`,word:nr()}:{tone:`crashed`,word:Xn()}:a;return{unit:e.unit,state:e.state,...l,...c?{crash:c}:{},at:e.at,stale:e.stale,monitors:e.monitors,report:e.report}})}var go=/(^|[\s(["'])(\*\*|__|~~|\*|_)(?=\S)(.+?)(?<=\S)\2(?=$|[\s,;:!?)\]"']|\.(?:$|\s))/g;function _o(e){let t=(e.split(`
|
|
3
|
+
`).map(e=>e.trim()).find(e=>e&&!/^(`{3,}|~{3,}|[-*_]{3,}$)/.test(e))??``).replace(/^(#{1,6}\s+|>\s*|[-*+]\s+|\d+[.)]\s+)+/,``).replace(/(`+)(.+?)\1/g,`$2`);for(let e=0;e<4;e++){let e=t.replace(go,`$1$3`);if(e===t)break;t=e}return t.trim()}var vo=3e4,yo=[`pointermove`,`pointerdown`,`keydown`,`wheel`,`touchstart`];function bo(e=document.documentElement){if(matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=Date.now(),n,r=()=>$a[e.dataset.view]?.calm===!1,i=()=>{let a=t+vo-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,vo)))};for(let e of yo)addEventListener(e,a,{capture:!0,passive:!0});document.addEventListener(`visibilitychange`,()=>document.hidden||a()),a()}var xo=0,So=`button:not([disabled]):not([hidden]), a[href]:not([hidden])`;function Co(e,t){e.id||=`menu-${++xo}`;let n=t?Ur({name:t}):Br();return E(`button`,{type:`button`,class:`pair-btn menu-btn`,popovertarget:e.id,"aria-haspopup":`true`,"aria-label":n,title:n},`⋯`)}function wo(e,t,n=``){let r=E(`div`,{class:`menu-pop hud-pop`,popover:`auto`,role:`group`,"aria-label":t?Ur({name:t}):Br()},...e);return E(`span`,{class:`menu ${n}`.trim()},Co(r,t),r)}function To(e){let t=document.createComment(``);e.replaceWith(t);let n=wo([e]);return t.replaceWith(n),n}function Eo(e,t){let n=Ur({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 Do(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 Oo(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 ko=e=>e instanceof Element?e.closest(`.menu-pop`):null,Ao=e=>document.querySelector(`[popovertarget="${CSS.escape(e.id)}"]`);function jo(){document.addEventListener(`toggle`,e=>{let t=ko(e.target);if(!t||e.newState!==`open`)return;let n=Ao(t);n&&Do(t,n),t.querySelector(So)?.focus({preventScroll:!0})},!0),document.addEventListener(`keydown`,e=>{let t=ko(e.target);if(!t||!t.matches(`:popover-open`))return;if(e.key===`Escape`)return void(e.preventDefault(),t.hidePopover(),Ao(t)?.focus());let n=[...t.querySelectorAll(So)],r=Oo(n,n.indexOf(document.activeElement),e.key);r&&(e.preventDefault(),r.focus())}),document.addEventListener(`click`,e=>{let t=ko(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 Mo=e=>e.route.view===`map`||e.route.view===`head`?``:e.route.ws,No=(e,t)=>{let n=e?.head;return n?.key===t?{u:{key:t,name:n.name,role:`tower`,head:!0,mark:n.mark,control:!0,queued:n.queued,service:n.service,subs:[]},base:{id:c,label:n.name,mark:n.mark,tower:null,tabs:[],outposts:[],outside:[]}}:void 0};function Po(e,t){let n=No(e,t);if(n)return n;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 Fo=e=>e?.u.role===`tower`&&e.base.tower?.key===e.u.key?e.base:void 0,O=(e,t)=>(t?t!==`live`:!e)||!(!e?.ended||e.control);function Io(e,t,n){return n?`readonly`:O(e,t)?t===`recent`||e?.ended?`closed`:`none`:`live`}function Lo(e){if(e.route.view!==`session`)return;let t=e.route.key,n=Po(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 Ro=[`phone`,`wifi`,`teams`,`server`],zo=e=>{try{return decodeURIComponent(e)}catch{return e}},Bo=e=>/^\.+$/.test(e)?e.replaceAll(`.`,`%2E`):encodeURIComponent(e);function Vo(e){let[t,n]=e.split(`#`)[0].split(`?`),[r,i,a,o]=t.replace(/^\/+|\/+$/g,``).split(`/`).map(zo);if(r===`head`&&!i)return{view:`head`};if(r===`settings`)return Ro.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 k=e=>e.view===`map`?``:e.view===`head`||e.view===`session`&&e.ws===`@head`?`head`:e.view===`settings`?e.section?`settings/${e.section}`:`settings`:e.view===`workspace`?`w/${Bo(e.ws)}`:`w/${Bo(e.ws)}/s/${Bo(e.key)}${e.at?`?at=${encodeURIComponent(e.at)}`:``}`,Ho=e=>e.view===`session`&&e.ws!==`@head`?{view:`workspace`,ws:e.ws}:{view:`map`},A=e=>e.view===`settings`?{view:`map`}:e,Uo=(e,t)=>e.view===`session`?e.key:e.view===`head`?t??null:e.view===`workspace`?`w:${e.ws}`:null,Wo=e=>Math.max(0,e?.depth||0);function Go(e,t=new URL(document.baseURI).pathname){let n=()=>Vo(location.pathname.slice(t.length)+location.search),r={route:n,href:e=>k(e)||`./`,go(n){let r=t+k(n);location.pathname+location.search!==r&&history.pushState({depth:Wo(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`)&&Wo(history.state)>0?history.back():r.go(Vo(t.getAttribute(`data-route`))))}),r}function Ko(t,n,r){let i=r?.allyRuns??[],a=JSON.stringify([n,i.map(e=>[e.id,e.label,e.key])]);t.dataset.sig!==a&&(t.dataset.sig=a,t.hidden=!i.length,t.replaceChildren(...i.length>1?[E(`b`,null,e({count:i.length}))]:[],...i.map(e=>{let t=Ce({device:e.label});if(!e.key)return E(`span`,{class:`ally-chip`,title:Te()},t);let r=k({view:`session`,ws:n,key:e.key});return E(`a`,{class:`ally-chip`,href:r||`./`,"data-route":r,title:we()},t)})))}var qo=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),Jo=function(e,t){return new URL(e,t).href},Yo={},Xo=function(e){return e.pathname.endsWith(`.css`)},Zo=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},j=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=Jo(t,n);let r=s(t),i=Xo(r);return Zo(Yo,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`:qo,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)})},Qo={retry:ja,deliver:ka,drop:Aa,answer:Oa,dismiss:Ga,confirm:Rr,reject:zr},M,$o,es=()=>$o??=Promise.all([j(()=>import(`./waitpanel-D1MKcXBT.js`).then(e=>e.r),[],import.meta.url),j(()=>import(`./asks-BDGpeeS-.js`).then(e=>e.t),[],import.meta.url),j(()=>import(`./answer-D0lm35aH.js`).then(e=>e.n),[],import.meta.url)]).then(([e,t,n])=>M={waitPanel:e.waitPanel,waitActions:t.waitActions,answerPost:n.answerPost}),ts=new WeakMap,ns=new WeakMap,rs=4e3,is=new WeakMap,as=e=>E(`p`,{class:`tnote-flash`,role:`status`},e);function os(e,t){let n=Date.now();is.set(e,{text:t,at:n}),e.querySelector(`.tnote-flash`)?.remove(),e.append(as(t)),setTimeout(()=>{is.get(e)?.at===n&&(is.delete(e),e.querySelector(`.tnote-flash`)?.remove())},rs).unref?.()}function ss(e,t,n,r,a=!1){ns.set(e,[t,n,r,a]);let o=d(n),s=JSON.stringify([t,o]),c=document.body.dataset.stale!==`true`;for(let t of ts.get(e)?.values()??[])t.update(c);if(e.dataset.sig===s)return;e.dataset.sig=s,!M&&r&&o.some(e=>e.wait)&&es().then(()=>(e.dataset.sig=``,ss(e,...ns.get(e))));let u=ts.get(e)??new Map,f=new Map,p=document.activeElement,m=p&&[...u.values()].some(e=>e.el.contains(p))?p:void 0;e.replaceChildren(...o.map(n=>{let o=E(`small`,{class:`tnote-fail`,role:`alert`}),s=E(n.wait?`div`:`p`,{class:`tnote ${n.level}`},E(`span`,null,n.text));if(n.wait){if(M&&r){let i=`${t}\u001f${n.wait}`,o=u.get(i)??M.waitPanel({actions:M.waitActions({ws:t,id:n.wait,tower:r},M.answerPost(r)),reply:!0,report:!0,goto:!a&&t!==`@head`,done:t=>os(e,t)});o.update(c),f.set(i,o),s.append(o.el)}return s}for(let e of n.actions){let r=E(`button`,{type:`button`,class:`pair-btn`},Qo[e]()),a=async()=>n.proposal&&(e===`confirm`||e===`reject`)?(await j(async()=>{let{proposalActions:e}=await import(`./asks-BDGpeeS-.js`).then(e=>e.t);return{proposalActions:e}},[],import.meta.url)).proposalActions({ws:t,id:n.proposal,rev:()=>n.rev})[e]():v(`${l(t)}/${e}`,n.event?{id:n.event}:{});r.onclick=()=>void i(r,e=>o.textContent=e??``,a),s.append(r)}return s.append(o),s}));let h=is.get(e);h&&e.append(as(h.text)),ts.set(e,f),m?.focus()}var cs=140;function ls(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`,Wr()),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(cs/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 us({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 ds(e,t){if(t||!e.length)return[];let n=document.createElement(`style`);return n.textContent=e.map((e,t)=>`@keyframes pk${t}{${us(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 fs=typeof document<`u`&&typeof document.querySelector==`function`&&((e=document)=>e.querySelector(`meta[name="sb-desk"]`)?.content===`1`)(),ps=(e,t=fs)=>t||e!==`127.0.0.1`,ms=(e,t=fs)=>({phone:!ps(e,t),server:e===`127.0.0.1`});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 hs=(e,t)=>t.role===`subagent`&&t.ended&&t.key?N(e,{close:`dismiss`,key:t.key,name:t.name,role:t.role},bt(),Et({name:t.name})):N(e,{close:`unit`,key:t.key??``,name:t.name,role:t.role},Ci(),lt({name:t.name}),!(t.control&&t.key)||t.role===`subagent`),gs=(e,t)=>N(e,{key:t?.key??``,name:t?.name??``,role:`tower`},wi(),void 0,!t?.control);function _s(e,t){e.dataset.close=`unit`,t?.u.role===`tower`&&t.base.tower?.key===t.u.key?gs(e,t.base.tower):t&&hs(e,t.u),e.hidden=!t||e.dataset.close!==`unit`||e.hidden}var vs=(e,t)=>N(e,{ws:t.id,name:t.label},Ci(),Je({name:t.label})),ys=(e,t,n=fs)=>N(e,{ws:t.id,name:t.label},Zi(),ea({name:t.label}),n),bs=(e,t,n)=>N(e,{ws:t.id,name:n.label,tab:n.id},Ci(),et({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(We(),`later`,!1),o(t,`sheet-yes`,!0)]:[o(Ge(),`later`,!1)]),r.append(i,a),r.addEventListener(`close`,()=>(r.remove(),n(!1))),document.body.append(r),r.showModal()}),xs=e=>ue(e).filter(e=>e.sub&&`ended`in e.unit&&e.unit.ended).map(e=>e.unit.key);function Ss(e,t){let n=xs(t).length;e.hidden=!n,n&&(e.textContent=Ct({count:n}))}function Cs(e,t,n,r=fs){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=oa({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},_i(),bi({name:e.name})),t.append(n,r),t})))}var ws=e=>j(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 Ts(e,{route:t,net:n,go:r}){let i=t();if(i.view===`map`||i.view===`head`)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 Es(e){document.addEventListener(`click`,t=>{let n=t.target?.closest?.(`button[data-close]`),r=n?.dataset;if(n&&r){if(t.preventDefault(),r.close===`head`)return void P(Ft(),Pt()).then(e=>e&&(n.toggleAttribute(`disabled`,!0),j(async()=>{let{post:e}=await import(`./post-DDdE-PdN.js`).then(e=>e.r);return{post:e}},[],import.meta.url).then(({post:e})=>e(`head/close`,{})).then(e=>e.ok||P(e.body.reason??T({status:e.status})),()=>P(w())).finally(()=>n.toggleAttribute(`disabled`,!1))));if(r.close===`dismiss`||r.close===`dismiss-all`)return void ws(r.close===`dismiss`?{key:r.key}:{all:!0});if(r.close===`pop`)return void(n.toggleAttribute(`disabled`,!0),Promise.all([j(()=>import(`./post-DDdE-PdN.js`).then(e=>e.r),[],import.meta.url),j(()=>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`?ra:r.close===`base`?Ze:r.close===`tab`?rt:r.role===`tower`?ot:ft)({name:r.name??``}),r.close===`stash`?Zi():Ci()).then(t=>{t&&(n.toggleAttribute(`disabled`,!0),j(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?Ts(r,e):P(t.body.reason??T({status:t.status})),()=>P(w())).finally(()=>n.toggleAttribute(`disabled`,!1)))})}})}var Ds={main:`main`,member:`member`,subagent:`subagent`,outpost:`outpost`,outside:`outside`,tower:`tower`,ally:`tower`,run:`tower`},F={commanding:Mr,working:Lr,waiting:C,idle:Fr,done:Nr,error:Pr,unknown:Ir},Os={ally:a,run:Li,main:Ni,member:Pi,subagent:zi,tower:Bi,outpost:Fi,outside:Ii,session:Ri},ks={thinking:ri,"watching a monitor":ni,idle:Fr,"waiting on a question":C,finished:Nr},As={claude:`Claude`,codex:`Codex`},js=e=>Object.hasOwn(Os,e)?Os[e]():e,Ms=(e,t)=>`${js(e)} · ${t}`,Ns=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&&no(e,`flash`)},Ps=e=>(t=>(e.slice(8,t)===`stale`?Xr:qr)({what:e.slice(t+1)}))(e.indexOf(`:`,8)),B=(e,t)=>e?e.startsWith(`tool:`)?Fa({tool:e.slice(5)}):e.startsWith(`monitor:`)?Ps(e):Object.hasOwn(ks,e)?ks[e]():e:F[t](),Fs=(e,t,n)=>O(e,t)?``:n===`working`||n===`commanding`?B(e?.note,n):Ns(n)?F[n]():``,Is=(e,t,n)=>O(e,t)&&(n===`working`||n===`commanding`)?`done`:n,Ls=(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`)},Rs=(e,t)=>{e.toggleAttribute(`hidden`,!t),t&&(e.setAttribute(`href`,k(t)||`./`),e.setAttribute(`data-route`,k(t)))},zs=(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`},Bs=`<div class="plate"><i class="ring"></i><svg><use href="#i-main"/></svg><b class="badge"></b></div>`;function Vs(e,t,n,r){z(e,n);let i=e.querySelector(`use`),a=`#i-${Ds[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 Hs=(e,n=Math.max(0,Date.now()-e)/1e3)=>n<60?ve({n:String(Math.floor(n))}):n<3600?he({n:String(Math.floor(n/60))}):n<86400?r({n:String(Math.floor(n/3600))}):t({n:String(Math.floor(n/86400))}),Us=(e,t)=>(t===void 0?delete e.dataset.since:e.dataset.since=String(t),e.textContent=t===void 0?``:Hs(t));function Ws(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 Gs=()=>I(`<div class="unit"><div class="card"><a class="hit"></a>${Bs}<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 Ks(e,t){let n=e.closest(`.base`)?.dataset.key,r=e.querySelector(`.hit`),i=Is(t,void 0,t.mark),a=O(t)?void 0:t.note;Rs(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`,Ns(i)),z(e,i),Vs(e.querySelector(`.plate`),t.role,i,t.docs),R(e,`.name`,t.name),R(e,`.role`,js(t.role)),R(e,`.agent`,t.agent?As[t.agent]:``),Ls(e,`.note`,a,i),Us(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??``)),Ws(e.querySelector(`:scope > .card`),t.ticks),hs(e.querySelector(`:scope > .card > .quit-btn`),t),V(e.querySelector(`.subs`),t.subs??[],Gs,Ks)}function qs(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`?pi():mi())&&(e.textContent=r===`main`?pi():mi())}var Js=()=>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"><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="${hi()}"></div></section>`),Ys=()=>{let e=Js();return To(e.querySelector(`header > .quit-btn`)),e},Xs=e=>u(e.service,e.mark,e=>F[e]());function Zs(e,t){z(e,t.mark);let n=e.querySelector(`.tower`);n.classList.toggle(`ghost`,!t.tower),z(n,t.tower?.mark??`unknown`),R(e,`h2 a`,t.label),Rs(e.querySelector(`h2 a`),{view:`workspace`,ws:t.id}),R(e,`.title .tstate`,t.tower?vt({state:Xs(t.tower)}):ti()),R(e,`.title .tqueue`,o(t.tower?.service)??``),Us(e.querySelector(`.title .age`),t.tower?.since),qs(e.querySelector(`.spawn-btns button`),t),vs(e.querySelector(`header .menu-pop > .quit-btn`),t),Eo(e.querySelector(`header > .menu`),t.label),ys(e.querySelector(`.spawn-btns [data-close=stash]`),t),gs(e.querySelector(`.tower-quit`),t.tower),V(e.querySelector(`.tower-subs`),t.tower?.subs??[],Gs,Ks),Ko(e.querySelector(`.title .allies`),t.id,t.tower?.service),ss(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 To(e.querySelector(`h3 > .quit-btn`)),e},(e,n)=>{R(e,`h3 span`,ya({label:n.label})),bs(e.querySelector(`.menu-pop > .quit-btn`),t,n),Eo(e.querySelector(`h3 > .menu`),ya({label:n.label})),qs(e.querySelector(`.tab-add`),t,n.id),V(e.querySelector(`.units`),n.units,Gs,Ks)}),V(e.querySelector(`.outposts`),t.outposts.map(e=>({id:e.id,name:e.label,role:`outpost`,mark:e.mark,note:e.mark===`unknown`?$r():void 0,since:e.since,ticks:e.ticks})),Gs,Ks)}var Qs=()=>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><ul class="ally-units"></ul></section>`),$s,ec=!1,tc=new Map;function nc(e,t,n){if(t={...t,id:t.id.replace(/^ally\//,``)},$s)return void $s.show(e,t,n);if(!n?.alerts.some(e=>e.kind===`dialog`))return void tc.delete(e);tc.set(e,[t,n]),!ec&&(ec=!0,j(async()=>{let{mountAllyAsks:e}=await import(`./allyasks-ByNVSYw-.js`);return{mountAllyAsks:e}},[],import.meta.url).then(({mountAllyAsks:e})=>($s=e(),tc.forEach(([e,t],n)=>$s.show(n,e,t)),tc.clear()),()=>void(ec=!1)))}var rc,ic=!1,ac=new Map;function oc(e,t,n){if(rc)return void rc(e.querySelector(`.ally-units`),t,n);if(!t.length)return void ac.delete(e);ac.set(e,[t,n]),!ic&&(ic=!0,j(async()=>{let{fillAllyUnits:e}=await import(`./allyunits-BcvbktEl.js`);return{fillAllyUnits:e}},[],import.meta.url).then(({fillAllyUnits:e})=>(rc=e,ac.forEach(([t,n],r)=>e(r.querySelector(`.ally-units`),t,n)),ac.clear()),()=>void(ic=!1)))}var sc=new Map;function cc(e,t,n){let r=co(t),i=n?.units;z(e,r),e.classList.toggle(`offline`,!t.online),z(e.querySelector(`.tower`),r),R(e,`.ally-tag`,Oe({team:t.teamName})),R(e,`h2`,t.workspace??t.label);let a=ho(i,n?.alerts,t,Date.now(),sc);R(e,`.tstate`,`${t.workspace?`${t.label} · `:``}${t.short}${t.online?a.length?``:` · ${lo(t.tower)}`:` · ${Vn()}`}`);let o=a.length?[]:t.unattended?t.online&&t.tabs.length?[{id:`online`,label:``,state:t.tower,says:tr({count:t.tabs.length})}]:[]:t.tabs.map((e,t)=>({id:`${t}`,...e}));V(e.querySelector(`.ally-tabs`),o,()=>I(`<li class="ally-tab"><b></b><span></span></li>`),(e,n)=>{R(e,`b`,n.says??n.label),R(e,`span`,n.says!==void 0||!t.online?``:lo(n.state)),e.dataset.state=n.state}),e.classList.toggle(`has-units`,a.length>0),oc(e,a,t.workspace===null),nc(e,t,n)}function lc(e,t){if(e.hidden=!t,e.classList.toggle(`off`,!t),!t)return;let n=t.state!==`absent`;e.classList.toggle(`absent`,!n),z(e,t.mark);let r=e.querySelector(`.tower`);r.classList.toggle(`ghost`,!n),z(r,t.mark),e.setAttribute(`href`,`head`),R(e,`.head-name`,S()),R(e,`.tstate`,n?u(t.service,t.mark,e=>F[e]()):Kt()),e.title=`${S()} · ${e.querySelector(`.tstate`).textContent}`}var uc=(e,t)=>e?t.map(([t,n])=>({x1:e[0],y1:e[1],x2:t,y2:n,mid:Math.round((e[0]+t)/2)})):[];function dc(e,t,n,r){let i=[...e.querySelectorAll(`.base:not(.leaving):not(.ally) .tower`)],a=e.querySelector(`.head-node:not(.off) .tower`)??void 0,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=uc(a&&s(a),c.map(s)),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(...ds(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 fc=2,pc=20;function mc(){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=ls(e,t),s=()=>(o(),!e.hidden&&dc(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+pc)/fc)}`),l()));return setInterval(()=>document.querySelectorAll(`.age[data-since]`).forEach(e=>Us(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`)),bo(),{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}));lc(L(`head-node`,HTMLElement),e.head),V(t,[...e.bases,...n],e=>`ally`in e?Qs():Ys(),(t,n)=>`ally`in n?cc(t,n,e.link):Zs(t,n));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 hc=(e,t)=>n=>n&&!e()&&t();function gc(e,t){let n=L(`link-alerts`,HTMLButtonElement),r=L(`link-alerts-pop`,HTMLElement),i=L(`link-alerts-list`,HTMLElement),a=``,o=new Set,s=!0;r.addEventListener(`toggle`,e=>e.newState===`open`&&zs(r,n)),r.setAttribute(`aria-label`,Pn()),n.title=Pn();let c=(e,t,n)=>{let r=n.querySelector(`.link-note`);for(let e of n.querySelectorAll(`button`))e.disabled=!0;j(async()=>{let{confirmActions:e,confirmWhy:t}=await import(`./asks-BDGpeeS-.js`).then(e=>e.t);return{confirmActions:e,confirmWhy:t}},[],import.meta.url).then(async({confirmActions:n,confirmWhy:r})=>({r:await n(e)[t?`allow`:`deny`](),why:r})).then(({r:e,why:t})=>{e.ok||(r.textContent=t(e));for(let e of n.querySelectorAll(`button`))e.disabled=!1},()=>{r.textContent=w();for(let e of n.querySelectorAll(`button`))e.disabled=!1})},l=e=>{let t=E(`li`,{class:`link-alert`,"data-level":`warning`}),n=E(`button`,{type:`button`,class:`pair-btn`},Fn()),r=E(`button`,{type:`button`,class:`pair-btn`},Ln());return n.onclick=()=>c(e,!0,t),r.onclick=()=>c(e,!1,t),t.append(E(`b`,null,io(e)),E(`pre`,{class:`link-args`},e.args),E(`div`,{class:`devices-acts`},n,r),E(`small`,{class:`link-note`,role:`status`})),t},u,d,f=()=>void j(async()=>{let{mountDialogCards:e}=await import(`./linkdialogs-DrSUQeBf.js`);return{mountDialogCards:e}},[],import.meta.url).then(({mountDialogCards:e})=>(u=e(),a=``,m.net(d))),p=new Set,m={net(c){d=c;let h=ao((c?.alerts??[]).filter(e=>e.kind!==`confirm`&&!p.has(e.id))),g=c?.confirms??[],_=JSON.stringify([h,g]);if(_===a)return;a=_;let v=new Set([...g.map(e=>`c/${e.dialogId}`),...h.filter(e=>e.kind===`join-request`||e.kind===`dialog`&&uo(e)===`open`).map(e=>e.id)]);u?.keep(new Set(h.map(e=>e.id))),!u&&h.some(e=>e.kind===`dialog`)&&f(),s||t([...v].filter(e=>!o.has(e)).length),[o,s]=[v,!1];let y=h.length+g.length;n.hidden=y===0,n.textContent=Nn({count:String(y)}),n.dataset.state=g.length||h.some(e=>e.level===`error`)?`error`:h.some(e=>e.level===`warning`)?`waiting`:`done`,!y&&r.matches(`:popover-open`)&&r.hidePopover(),i.replaceChildren(...to(...g.map(l),...h.map(t=>{if(t.kind===`dialog`&&u)return u.row(t);let n=E(`li`,{class:`link-alert`,"data-level":t.level,"data-kind":t.kind},E(`span`,null,ro(t)));if(t.kind===`join-request`||t.kind===`fork`||t.kind===`mismatch`){let i=E(`button`,{type:`button`,class:`later`},t.kind===`join-request`?Gn():Un());i.onclick=()=>(r.hidePopover(),e()),n.append(i)}if(t.kind===`notice`){let e=E(`button`,{type:`button`,class:`later`},Bn());e.onclick=()=>(p.add(t.id),a=``,m.net(d)),n.append(e)}if(t.kind===`served`){let e=E(`a`,{class:`later`,href:`./`,"data-route":``},Yn());e.onclick=()=>r.hidePopover(),n.append(e)}return n})))}};return m}var _c=45e3,vc=1e3,yc=3e4,bc={state:`connecting`,attempt:0},xc=(e,t)=>Math.min(yc,vc*2**(e-1))*(.8+.4*t);function Sc(e){try{return JSON.parse(e)}catch{return}}function Cc(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(),_c),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,xc(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=Sc(r);i&&e.onNet(i),o({problem:i?void 0:xi()}),l()}),n.listen(`ping`,()=>t===n&&l()),n.listen(`problem`,e=>{t===n&&(o({problem:Sc(e)??Si()}),l())}),r=e.setTimeout(()=>u(),_c)};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 wc(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 Tc(e){let t=()=>({away:e.root.dataset.zenAway!==void 0,settings:e.settings()});function n(n){let r=t(),i=wc(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 Ec(e){let t={view:`map`},n,r,i,a=bc,o,s,c=null,l=null,u=[],d=()=>eo(e.view.view(),e.root.dataset.zenAway!==void 0||t.view===`settings`),f=()=>d()===$a.zen,p=()=>f()&&c||Uo(t,n?.head?.key);function m(){let t=p();t!==l&&(l=t,e.restart())}let h=t=>e.icon(d().count?fe(ue(t).map(e=>e.unit)).length+(t.trust?.length??0)+[...Xa(t,Date.now()).values()].filter(e=>e.wait).length:0);function g(){let t=f();e.zenEl.hidden=!t,t?e.withZen(e=>f()&&(e.pairs(u),n&&e.net(Xa(n,Date.now()),n),e.show())):e.zen()?.hide(),n&&h(n),m()}let _=Tc({view:e.view,root:e.root,settings:()=>t.view===`settings`,leaveSettings:e.leaveSettings,draw:()=>(e.back(),g())});function v(a){n=r=a,h(a),e.link(a.link),t.view===`head`&&m();let c=Xa(a,Date.now()),l=d();if(l.announce===`current`)return void(s=c,e.withZen(e=>e.net(c,a)));if(s&&l.signal&&e.signal(Za(s,c)),s=c,e.hidden())return;let u=Za(o,c);o=c,e.draw(a,u,c),t.view===`map`&&(e.map(a),i=a,r=void 0)}let y=()=>void(r&&v(r)),ee=t=>e.withPanels(e=>e.stack.show(t));function b(t,n,{mode:r,at:i}={}){if(r===`term`&&f())return e.withZen(e=>f()?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(f())return e.withZen(e=>f()?e.step(t):x(t));e.withPanels(e=>e.step(t,n))}return{get current(){return t},get latest(){return n},alertOf:e=>o?.get(e),rules:d,zenOn:f,watch:p,face:_,snapshot:v,sync:g,online:()=>a.state===`live`,status(t){a=t,e.zen()?.refresh()},opened:()=>l=p(),wake:y,route(r){let a=t;t=r,r.view===`settings`!=(a.view===`settings`)&&_.route(r.view===`settings`),e.navigate(r,a),r.view===`map`&&n&&n!==i&&(v(n),e.layout()),m()},openAlert:ee,openSession:b,openStep:x,leaveZen({item:t,route:n}){_.leave(),t&&ee(t),n&&e.go(n),y()},pairing(t){u=t,f()&&e.withZen(e=>e.pairs(t))},enterZen:()=>ce(e.view,e.root),notified:e=>d().announce===`current`||!!e.card||(e.trust||e.wait?ee(e):b(e.ws,Ya(e))),news:hc(()=>!d().chime,e.chime),keys:()=>d().keys,modal:()=>e.modal(),hotkey:t=>(t===`next`||t===`zoom`?e.panels()?.hotkey(t):e.zen()?.key(t))??!1,newest:()=>n,openSettings:()=>e.go({view:`settings`}),noDrawer:()=>!d().drawer,escape(n,r){if(!(n.key!==`Escape`||n.defaultPrevented||e.modal())){if(r)return void(!n.isComposing&&f()&&e.zen()?.escape(n)&&n.stopPropagation());f()||(n.preventDefault(),!(e.panels()?.stack.close()||t.view===`map`)&&(t.view===`settings`?e.leaveSettings():e.go(Ho(t))))}},watchLog(e){c=e,m()}}}function Dc(e){let t=/^zh\b/i.test(e)&&(/-(hant|tw|hk|mo)\b/i.test(e)?`zh-TW`:/-(hans|cn|sg|my)\b/i.test(e)?`zh-CN`:void 0);return m(e)??(t?m(t):void 0)??m(e.split(`-`)[0])}function Oc(e,t){return m(e)??t.map(Dc).find(Boolean)??`en`}var kc={brand_label:Ue,head_tower:S,menu_more:Br,tagline:ba,totals_label:Da,stat_bases:ca,stat_agents:sa,stat_working:da,stat_waiting:ua,stat_commanding:la,mark_commanding:Mr,alerts:ye,no_alerts:ei,link_connecting:In,connect_connecting:pt,connect_retry:ht,location:ir,all_bases:be,documents:Dt,timeline:xa,states:ga,mark_working:Lr,mark_waiting:C,mark_idle:Fr,mark_done:Nr,mark_error:Pr,credit:yt,language:qt,view_label:Va,view_auto:Ia,view_standard:Ha,view_geek:Ba,view_zen:Wa,zen_back:Ka,zen_back_title:qa,view_title:Ua,settings:Ki,new_base:Qr,back:ke,remind:Di,sound:qi,sound_volume:Xi,sound_try:Yi,sound_title:Ji,set_device:Vi,set_device_note:Hi,set_phone:Ui,set_teams:Gi,set_server:Wi};Object.keys(kc);function Ac(e,t=localStorage,n=()=>location.reload()){return b(t).set(`locale`,e)?(n(),!0):!1}var jc=()=>h.map(e=>({id:e,name:rr({},{locale:e})}));function Mc(){let e=Oc(x.get(`locale`),navigator.languages??[navigator.language]);g(()=>e),document.documentElement.lang=e;let t={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[n,r]of Object.entries(t))e.dataset[n]&&r(e,kc[e.dataset[n]]?.()??e.dataset[n]);let n=document.getElementById(`lang`);n.replaceChildren(...h.map(t=>new Option(rr({},{locale:t}),t,!1,t===e))),n.onchange=()=>Ac(n.value)||(n.value=e)}var Nc=e=>e===`auto`?Ia():za({view:e===`geek`?Ba():e===`zen`?Wa():Ha()}),Pc=e=>e.state===`live`?void 0:e.state,Fc={connecting:pt,reconnecting:mt,offline:e=>Pe({tries:e.attempt-1}),replaced:He},Ic=[`click`,`dblclick`,`auxclick`,`contextmenu`,`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`keydown`,`keyup`,`keypress`,`submit`,`dragstart`],Lc=new Set([`click`,`dblclick`,`auxclick`,`contextmenu`,`submit`]),H=e=>document.getElementById(e),Rc=()=>({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 zc(e,t=Rc()){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 Ic)n.addEventListener(e,t=>{!o||r.contains(t.target)||t.target?.closest?.(`dialog:modal`)||(t.stopPropagation(),Lc.has(e)&&t.preventDefault())},!0),r.addEventListener(e,e=>e.stopPropagation());return t.reload?.remove(),t.retry.addEventListener(`click`,e),e=>{if(o=Pc(e),!o)return d();r.dataset.state=o,i.textContent=Fc[o](e),t.retry.hidden=o!==`offline`,u()}}var Bc=`input, textarea, select, [role=textbox], [role=combobox], [role=listbox], .term-scroll`,Vc=`button, a, summary, [role=button], [role=link]`,Hc=`.ask-opt, [role=radio], [role=checkbox]`,Uc=`dialog.sheet[open], dialog.lightbox[open], [popover]:popover-open`,Wc={dialogs:[{keys:[`f`],hotkey:`zoom`},{keys:[` `],hotkey:`next`,native:`keyboard`}]};function Gc(e,t,n=!1,r=`dialogs`,i){if(t||e.defaultPrevented||e.isComposing)return;let a=e.key.toLowerCase(),o=Wc[r]?.find(t=>t.keys.includes(a)&&(t.takes?t.takes(e,i):!e.metaKey&&!e.ctrlKey&&!e.altKey)),s=e.target;if(!(!o||(o.blocks?o.blocks(s):s?.isContentEditable||s?.closest?.(Bc)))&&(!o.native||!s?.closest?.(Vc)||o.native!==`any`&&n)&&!(a===` `&&s?.closest?.(Hc)))return o.hotkey}function Kc(e,t=()=>document.querySelector(Uc)!==null,n=window,r=()=>`dialogs`,i){let a,o=!1,s=null;n.addEventListener(`pointerdown`,()=>o=!0,!0),n.addEventListener(`focusin`,e=>s=o?e.target:null,!0),n.addEventListener(`keydown`,n=>{let c=n.target===s;o=!1;let l=Gc(n,t(),c,r(),i?.());if(l){if(n.repeat)return a===l?n.preventDefault():void 0;e(l)&&(a=l,n.preventDefault())}}),n.addEventListener(`keyup`,e=>{(a===`next`||a===`pause`)&&e.key===` `&&e.preventDefault(),a=void 0})}function qc(e=()=>new AudioContext,t=e=>fetch(e).then(e=>e.arrayBuffer())){let n,r,i=1,a=new Map,o=()=>(n??=e(),r||((r=n.createGain()).connect(n.destination),r.gain.value=i),{c:n,g:r});return{volume:e=>void(i=(e/100)**2,r&&(r.gain.value=i)),unlock:()=>o().c.resume().then(()=>o().c.state===`running`,()=>!1),out:o,running:()=>n?.state===`running`,play(e){let{c:n,g:r}=o();a.has(e)||a.set(e,t(e).then(e=>n.decodeAudioData(e))),Promise.all([n.resume(),a.get(e)]).then(([,e])=>{let t=n.createBufferSource();t.buffer=e,t.connect(r),t.start()}).catch(()=>a.delete(e))}}}var Jc=qc(),Yc=new URL(`done-jqKY4qf5.mp3`,import.meta.url).href,Xc=new URL(`error-DdTLgPEw.mp3`,import.meta.url).href,Zc={waiting:new URL(`waiting-DOg8-8gu.mp3`,import.meta.url).href,error:Xc,done:Yc},Qc=e=>e.mark===`waiting`||e.pending?`waiting`:e.mark===`error`?`error`:e.mark===`done`?`done`:void 0;function $c(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=x.get(`remind`),c=x.get(`sound`),l=x.get(`volume`),u=[],d=()=>{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`?ji():e===`denied`?ki():Oi():Ai():Mi(),t(`remind-note`).textContent=n.title,r.dataset.state=c?`on`:`off`,n.textContent={off:ma,on:ha,blocked:pa,ask:fa}[n.dataset.state](),r.textContent=c?ha():ma(),r.setAttribute(`aria-pressed`,String(c)),i.value=a.value=String(l),Jc.volume(l)};n.onclick=async()=>{s&&o&&Notification.permission==="default"?await Notification.requestPermission().catch(()=>{}):x.set(`remind`,s=!s),d()};let f=e=>{x.set(`sound`,c=e),d(),c&&m(`done`)},p=e=>(x.set(`volume`,l=e),d());x.on(`sound`,()=>(c=x.get(`sound`),d(),u.forEach(e=>e()))),x.on(`volume`,()=>(l=x.get(`volume`),d(),u.forEach(e=>e()))),r.onclick=()=>f(!c),i.oninput=()=>p(Number(i.value)),i.onchange=()=>m(`done`),t(`sound-try`).onclick=()=>m(`done`);let m=e=>Jc.play(Zc[e]);function h(t,n){if(!s||!o||Notification.permission!==`granted`||!document.hidden&&document.hasFocus())return;let r=new Notification(t.name,{body:t.trust?Ma():{waiting:fi,error:li,done:oi}[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 d(),{remind:e=>h(e,`waiting`),sound:{on:()=>c,volume:()=>l,set:f,setVolume:p,try:()=>m(`done`),onChange:e=>void u.push(e)},chime:()=>c&&m(`done`),signal(e){let t=e.flatMap(e=>(t=>t?[{a:e,k:t}]:[])(Qc(e)));if(t.length){c&&m([`waiting`,`error`,`done`].find(e=>t.some(t=>t.k===e)));for(let{a:e,k:n}of t)h(e,n)}}}}var el=`sb.head.seen`;function tl(){try{let e=Number(localStorage.getItem(el));return Number.isFinite(e)&&e>0?e:0}catch{return 0}}function nl(e){try{e>tl()&&localStorage.setItem(el,String(e))}catch{}}var rl=(e,t)=>!!(e?.said&&e.said>t);function il(e,t,n,r){if(e.hidden=!t,!t)return;e.dataset.mark=t.mark,e.dataset.state=t.state,e.title=S(),e.setAttribute(`aria-label`,t.said&&rl(t,n)&&!r?`${S()}: ${Ht()}`:S()),e.toggleAttribute(`aria-current`,r),r&&e.setAttribute(`aria-current`,`page`);let i=e.querySelector(`.dot`);i&&(i.hidden=r||!rl(t,n))}var al=e=>e&&(e.standing||e.decisions||e.proposals.length||e.problem)?e:void 0,ol=(e,t)=>e.state===`absent`?Kt({},t):u(e.service,e.mark,e=>F[e](),t);function sl(e,t){let n=(t,n)=>{let r=e.querySelector(t);r&&r.textContent!==n&&(r.textContent=n)};e.querySelector(`.head-icon`)?.setAttribute(`href`,`#i-crown`),n(`.head-kicker`,``),n(`.head-title`,S()),n(`.head-line`,ol(t));let r=e.querySelector(`.head-absent`);r&&(r.hidden=t.state!==`absent`,n(`.head-absent`,Ot()))}var cl=864e5,ll={answered:2,waiting:1,silent:0};function ul(e,t,n){let r=new Map;for(let t of e)r.set(t.group??t.id,[...r.get(t.group??t.id)??[],t]);let i=[...r].map(([e,t])=>{let r=[...new Set(t.map(e=>e.workspace))].map(e=>{let r=t.filter(t=>t.workspace===e),i=r.reduce((e,t)=>ll[t.state]>ll[e.state]?t:e),a=r.filter(e=>e.last).sort((e,t)=>t.at-e.at)[0]?.last,o=n?.bases.find(t=>t.id===e)?.tower?.key;return{workspace:e,label:r.at(-1).label,state:i.state,...a?{said:a}:{},...o?{route:k({view:`session`,ws:e,key:o})}:{}}});return{id:e,first:t[0].first,towers:r,replied:r.filter(e=>e.state===`answered`).length,since:Math.min(...t.map(e=>e.since)),active:Math.max(...t.map(e=>e.at))}}).sort((e,t)=>t.since-e.since);return{recent:i.filter(e=>t-e.active<cl),older:i.filter(e=>t-e.active>=cl)}}function dl(e,n,i){let a=Math.max(0,n-e.since)/1e3,o=a<60?ve({n:String(Math.floor(a))},i):a<3600?he({n:String(Math.floor(a/60))},i):a<86400?r({n:String(Math.floor(a/3600))},i):t({n:String(Math.floor(a/86400))},i);return(e.towers.length===1?Vt:Rt)({count:e.towers.length,age:o,replied:e.replied},i)}var fl={waiting:e=>Mt({},e),answered:e=>kt({},e),silent:e=>jt({},e)},pl=e=>!e.route&&e.state!==`answered`,ml=(e,t)=>pl(e)?At({},t):fl[e.state](t),hl=new WeakMap;function gl(e,t,n,r=Date.now()){let{recent:i,older:a}=t?ul(t.asks,r,n):{recent:[],older:[]},o=new Map([...i,...a].map(e=>[e.id,dl(e,r)])),s=JSON.stringify([i,a,[...o]]);if(e.hidden=!i.length&&!a.length,e.dataset.sig===s)return;e.dataset.sig=s;let c=hl.get(e)??hl.set(e,new Set).get(e);e.setAttribute(`aria-label`,Nt());let l=(e,t)=>(c.has(t)&&e.setAttribute(`open`,``),e.addEventListener(`toggle`,()=>void(e.hasAttribute(`open`)?c.add(t):c.delete(t))),e),u=e=>E(`li`,{class:`ask-tower`,"data-state":pl(e)?`none`:e.state},E(`span`,{class:`ask-line`},e.route?E(`a`,{class:`ask-name`,href:e.route||`./`,"data-route":e.route},e.label):E(`b`,{class:`ask-name`},e.label),E(`span`,{class:pl(e)?`ask-none`:`ask-state`},ml(e)),...e.route||pl(e)?[]:[E(`span`,{class:`ask-none`},At())]),...e.said?[E(`p`,{class:`ask-said`},e.said)]:[]),d=e=>l(E(`details`,{class:`ask-group`,"data-id":e.id},E(`summary`,null,E(`span`,{class:`ask-first`},e.first),E(`span`,{class:`ask-meta`},o.get(e.id))),E(`ul`,{class:`ask-towers`},...e.towers.map(u))),e.id);e.replaceChildren(...i.map(d),...a.length?[l(E(`details`,{class:`ask-older`,"data-id":`older`},E(`summary`,null,Gt({count:a.length})),...a.map(d)),`older`)]:[])}var _l,vl=e=>void(_l=e);function yl(e,t){if(`terminal`in e)return void(t.key&&_l?.({kind:`prompt`,key:t.key,asker:t.key,command:t.command,...e.run&&t.answerId?{run:t.answerId}:{}}));if(e.pane===null)return gi();_l?.({kind:`pane`,key:`grant:${e.pane}`,asker:t.key,command:t.command})}var bl={commanding:sr,working:jr,waiting:Or,idle:gr,done:ur,error:pr,unknown:Tr},xl=e=>(e.kind===`joined`?yr:e.kind===`left`?Sr:bl[e.mark])({name:e.name}),Sl=18e5,Cl={waiting:0,error:0,working:1,commanding:1},wl=e=>new Date(e).toLocaleTimeString([],{hour12:!1});function Tl(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()-Sl,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)/Sl*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:${(Cl[t.mark]??2)*14+4}px`,n.setAttribute(`aria-label`,`${wl(t.at)} ${xl(t)}`),Rs(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:wl(e+t*6e4).slice(0,5)})),Object.assign(document.createElement(`span`),{textContent:Ca()})),r.textContent=c?wl(c.at):``,i.textContent=c?xl(c):Sa(),a.textContent=Ea({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 El(e,t=fetch){return e.startsWith(`data:`)?decodeURIComponent(e.slice(e.indexOf(`,`)+1)):t(e).then(e=>e.text(),()=>void 0)}function Dl(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=oe(void 0);Mc(),jo(),se(document.getElementById(`view-pick`),U,Nc);var Ol=mc(),kl=Tl(document.getElementById(`timeline`)),W=e=>document.getElementById(e),Al=document.documentElement,jl=le(W(`zen-back`),U,Al,()=>Y.enterZen()),Ml=e=>e?new Date(e).toLocaleTimeString([],{hour12:!1}):Zr(),Nl=!1,Pl=``,G,Fl,K=e=>G?e(G):void Fl?.then(e);function Il(){Fl??=j(async()=>{let{mountFocus:e}=await import(`./views-whzTVDOK.js`);return{mountFocus:e}},[],import.meta.url).then(({mountFocus:e})=>(G=e({data:pu,restart:()=>Q.restart(),openTile:Vl,embedTerminal:(e,t,n)=>Ll(e,t,n,{keys:!1}),online:Y.online}),G.show(A(Y.current),A(Y.current)),Y.latest&&G.net(Y.latest),G))}var Ll=(e,t,n,r)=>new Promise(i=>J(a=>i(a.terminal.embed(e,t,n,r)))),Rl=()=>new Promise(e=>J(t=>e(t.kit))),zl=e=>Y.latest?.bases.find(t=>t.id===e)?.label??e,q,Bl,J=e=>{if(q)return e(q);Bl??=j(async()=>{let{mountPanels:e}=await import(`./layer-DwFgBKd_.js`);return{mountPanels:e}},[],import.meta.url).then(({mountPanels:e})=>q=e({label:zl,recent:mu,post:e=>Z&&((t,n)=>Z.data(e).post(t,n)),trust:Z&&Z.trust,stream:()=>Pl,showTerminal:(e,t)=>Y.openSession(e,t,{mode:`term`})})),Bl.then(e)},Vl=(e,t)=>J(n=>n.tiles.open(e,t)),Hl,Ul,Wl=e=>{Ul??=j(async()=>{let{mountZen:e,zenPage:t}=await import(`./zenchunk-I4-BBnZj.js`);return{mountZen:e,zenPage:t}},__vite__mapDeps([0]),import.meta.url).then(({mountZen:e,zenPage:t})=>{let n=t({sound:X.sound,api:Z?.api??du,snapshot:Y.newest});return Hl=e(W(`zen`),{data:pu,recent:mu,label:zl,online:Y.online,post:e=>Z&&((t,n)=>Z.data(e).post(t,n)),trust:Z&&Z.trust,remind:e=>X.remind(e),sound:n.sound,menu:{language:{get:_,names:jc,set:Ac},view:{choice:()=>U.choice(),set:e=>U.set(e),auto:()=>Nc(U.server())},sound:{...X.sound,...n.menuSound}},music:n.music,leave:Y.leaveZen,terminals:Rl,watch:Y.watchLog,companions:n.companions,activity:n.activity,settings:Y.openSettings,start:Z?.start})}),Ul.then(e)},Gl=ms(location.hostname),Kl=Gl.phone,ql,Jl=e=>void(ql??=j(async()=>{let{mountSettings:e}=await import(`./settings-BJlGvy0_.js`);return{mountSettings:e}},[],import.meta.url).then(({mountSettings:e})=>e(W(`settings-view`),Gl))).then(e),Yl=e=>Y.current.view===`settings`?Jl(t=>t.show(e)):gu.go({view:`settings`,section:e}),Xl=document.querySelector(`link[rel="icon"]`),Zl=Xl?El(Xl.href):void 0,Ql=0;function $l(e){Xl&&Zl&&e!==Ql&&(Ql=e,Zl.then(t=>t&&e===Ql&&(Xl.href=Dl(t,e))))}function eu(){let e=W(`dismiss-all`).hidden&&W(`stashed`).hidden&&W(`head-btn`).hidden;W(`bar-more`).hidden=e,e&&W(`bar-pop`).matches(`:popover-open`)&&W(`bar-pop`).hidePopover()}function tu(e,t,n){Ol.stats(e),Ss(W(`dismiss-all`),e),Cs(W(`stashed`),W(`stashed-list`),e),il(W(`head-btn`),e.head,tl(),Y.current.view===`head`||Y.current.view===`session`&&Y.current.ws===`@head`),eu(),W(`bar-more`).toggleAttribute(`data-news`,rl(e.head,tl())&&!(Y.current.view===`head`||Y.current.view===`session`&&Y.current.ws===`@head`)),$?.net(e),(t.length||q)&&J(r=>r.alerts(t,n,e)),kl.net(e),K(t=>t.net(e))}function nu(e,t){let n=e.view===`workspace`&&t.view===`map`?document.querySelector(`#bases [data-key="${CSS.escape(e.ws)}"]`)?.getBoundingClientRect():void 0,r=e.view===`head`?`session`:e.view;document.body.dataset.route=r,$?.route(e),(e.view===`workspace`||e.view===`session`||e.view===`head`)&&Il(),W(`map`).hidden=e.view!==`map`,W(`settings-view`).hidden=e.view!==`settings`,W(`crumbs`).hidden=e.view===`settings`,W(`legend`).hidden=r===`session`||e.view===`settings`,W(`prefs`).toggleAttribute(`aria-current`,e.view===`settings`),W(`stage`).dataset.view=e.view===`head`||e.view===`session`&&e.ws===`@head`?`head`:r,K(r=>r.show(A(e),A(t),n)),e.view===`settings`?Jl(t=>Y.current===e&&t.show(e.section)):t.view===`settings`&&Jl(e=>e.hide())}var ru=()=>Wo(window.history.state)>0?window.history.back():gu.go({view:`map`}),Y=Ec({view:U,root:Al,zenEl:W(`zen`),zen:()=>Hl,withZen:Wl,hidden:()=>document.hidden,back:jl,leaveSettings:ru,restart:()=>Nl&&Q.restart(),icon:$l,link:e=>iu.net(e),signal:e=>X.signal(e),draw:tu,map:Ol.show,navigate:nu,layout:()=>requestAnimationFrame(Ol.layout),panels:()=>q,withPanels:J,withFocus:K,go:e=>gu.go(e),modal:()=>document.querySelector(Uc)!==null,chime:()=>X.chime()});vl(Y.openStep);var iu=gc(()=>Yl(`teams`),Y.news),X=$c(Y.notified);function au(e){vu(e),Y.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:In,live:Rn,reconnecting:Wn,offline:Vn,replaced:Vn}[e.state](),G&&Y.latest&&G.net(Y.latest),q?.stack.redraw();let n=W(`banner`);n.hidden=!t&&!e.problem;let r=e.state===`replaced`?He():e.state===`offline`?Pe({tries:e.attempt-1}):e.state===`reconnecting`?e.attempt?Ve({attempt:e.attempt}):Re():Le({problem:e.problem??``}),i=document.createElement(`b`);i.textContent=Ml(e.lastContact),n.replaceChildren(`${r} ${je()} `,i,Ae())}function ou(e,t){try{let n=JSON.parse(t);e===`history`&&Hl?.history(n),K(t=>e===`history`?t.history(n):t.cards(n))}catch{}}var su=document.querySelector(`meta[name="sb-build"]`)?.content,cu=e=>!!(su&&su!==JSON.parse(e).build);function lu(e,t=!1){try{let n=JSON.parse(e),r=t?n:n?.view;typeof r==`string`&&U.setServer(r)}catch{}}function uu(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 du=e=>fetch(`api/${e}`,{cache:`no-store`}).then(e=>e.ok?e.json():Promise.reject(Error(String(e.status)))),fu=(e,t=``)=>du(`history/${encodeURIComponent(e)}${t}`),Z=void 0,pu=e=>({older:t=>fu(e,`?before=${encodeURIComponent(t)}`),latest:()=>fu(e),entry:t=>du(`entry/${encodeURIComponent(e)}/${encodeURIComponent(t)}`).catch(()=>void 0),pic:(t,n)=>`api/image/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${n}`}),mu=async e=>(await fu(e,`?limit=12`)).items,hu=()=>{let e=uu(Y.opened());return e.listen(`history`,e=>ou(`history`,e)),e.listen(`cards`,e=>ou(`cards`,e)),e.listen(`hello`,e=>cu(e)?location.reload():(Pl=e,lu(e),q?.terminal.hello())),e.listen(`view`,e=>lu(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&&Vo(t.getAttribute(`data-route`)??``);if(!n||n.view!==`session`||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let r=Y.alertOf(n.key);r&&(e.preventDefault(),Y.openAlert(r))},!0);var gu=Go(e=>Y.route(e)),Q=Cc({open:hu,now:Date.now,setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e),random:Math.random,hidden:()=>document.hidden,onNet:Y.snapshot,onStatus:au,replaced:()=>fetch(`./`,{cache:`no-store`}).then(e=>e.status===403)}),_u=()=>Q.resume(),vu=zc(_u);document.addEventListener(`visibilitychange`,()=>{if(Ol.pause(document.hidden),Hl?.visible(!document.hidden),document.hidden)return Q.hide();Y.wake(),K(e=>e.wake()),_u()}),addEventListener(`keydown`,e=>Y.escape(e,!0),!0),addEventListener(`keydown`,e=>Y.escape(e,!1)),Kc(Y.hotkey,Y.modal,window,Y.keys),W(`prefs`).addEventListener(`click`,e=>Y.current.view===`settings`&&(e.preventDefault(),ru())),Kl&&j(async()=>{let{mountLanWait:e}=await import(`./lanwait-sVzvVJ6q.js`);return{mountLanWait:e}},[],import.meta.url).then(({mountLanWait:e})=>e(W(`lan-wait`),()=>Yl(`wifi`),void 0,Y.pairing));var $,yu=matchMedia(`(pointer: coarse), (max-width: 640px)`),bu=()=>void j(async()=>{let{mountDrawer:e}=await import(`./drawer-CTm2r1zP.js`);return{mountDrawer:e}},[],import.meta.url).then(({mountDrawer:e})=>($??=e(Y.noDrawer),Y.latest&&$.net(Y.latest),$.route(Y.current)));yu.matches?bu():yu.addEventListener(`change`,()=>yu.matches&&!$&&bu(),{once:!0}),Es({route:()=>A(Y.current),net:()=>Y.latest,go:e=>gu.go(e)}),W(`stashed-pop`).addEventListener(`toggle`,e=>e.newState===`open`&&zs(W(`stashed-pop`),W(`stashed`))),document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`button[data-open]`);t&&j(async()=>{let{openingOf:e,spawnTile:t}=await import(`./spawn-Byj-FrmU.js`);return{openingOf:e,spawnTile:t}},[],import.meta.url).then(({openingOf:e,spawnTile:n})=>{let r=e(t,Y.latest?.bases??[]);r&&Vl(n(r,(e,t,n)=>(q?.tiles.close(n),Y.openSession(e,t)),()=>X.chime()),!0)})});for(let e of[`focus`,`pageshow`,`online`])window.addEventListener(e,()=>!document.hidden&&_u());au(bc),Y.route(gu.route()),Y.sync(),Q.start(),Nl=!0;export{E as $,y as $t,Ns as A,Rr as At,Io as B,S as Bt,Is as C,ti as Ct,Ls as D,Zr as Dt,js as E,$r as Et,Ss as F,An as Ft,Mo as G,Ge as Gt,Po as H,Pt as Ht,ss as I,vn as It,io as J,Ce as Jt,Co as K,We as Kt,j as L,hn as Lt,_s as M,Vn as Mt,hs as N,Ln as Nt,V as O,Br as Ot,ws as P,Fn as Pt,_o as Q,fe as Qt,Ko as R,on as Rt,I as S,hi as St,z as T,ei as Tt,Lo as U,Dt as Ut,O as V,Kt as Vt,Fo as W,vt as Wt,uo as X,de as Xt,oo as Y,be as Yt,so as Z,ue as Zt,qs as _,qi as _t,al as a,Ga as at,Vs as b,Ni as bt,Jc as c,Va as ct,As as d,ya as dt,b as en,to as et,Ds as f,ha as ft,Rs as g,Xi as gt,Hs as h,ua as ht,rl as i,qa as it,Ms as j,Pr as jt,R as k,zr as kt,Wc as l,Ba as lt,Bs as m,da as mt,gl as n,Ja as nt,nl as o,Wa as ot,F as p,ma as pt,ro as q,ke as qt,sl as r,Ya as rt,tl as s,Ha as st,yl as t,x as tn,no as tt,Uc as u,Oa as ut,L as v,Li as vt,Fs as w,w as wt,zs as x,T as xt,B as y,Pi as yt,k as z,qt as zt};
|