pi-straw-boss 0.80.12 → 0.80.13
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/dist/gui/assets/{allyasks-B157BVSK.js → allyasks-BrZKRX_b.js} +1 -1
- package/dist/gui/assets/{allyunits-D49tC5yS.js → allyunits-2pbUr-y-.js} +1 -1
- package/dist/gui/assets/{answer-B_eEaZuu.js → answer-oqEyY6p_.js} +1 -1
- package/dist/gui/assets/{ask-Cf4u8awy.js → ask-C3ZbOHCx.js} +1 -1
- package/dist/gui/assets/{asks-BP9fh8zE.js → asks-uzLqEs-h.js} +1 -1
- package/dist/gui/assets/{askview-BzFy3A9l.js → askview-B_3H88-v.js} +1 -1
- package/dist/gui/assets/{autoback-mQmgZrYL.js → autoback-t6UReAqU.js} +2 -2
- package/dist/gui/assets/{blockschunk-Bcf8T3l_.js → blockschunk-LYFl0hBj.js} +1 -1
- package/dist/gui/assets/{box-CdTJxlY3.js → box-j5MnB_nM.js} +1 -1
- package/dist/gui/assets/chat-9NVue1Zd.js +2 -0
- package/dist/gui/assets/copy-AmlsMRaE.js +1 -0
- package/dist/gui/assets/drawer-DJAnCa0I.js +1 -0
- package/dist/gui/assets/index-CnIOR2a_.css +1 -0
- package/dist/gui/assets/{index-Dvw58cHb.js → index-TakEXnkN.js} +2 -2
- package/dist/gui/assets/{lanwait-D8XQhI49.js → lanwait-CM3W09aQ.js} +1 -1
- package/dist/gui/assets/{layer-CcPpb9oC.js → layer-WrVjN6ad.js} +1 -1
- package/dist/gui/assets/{lightbox-cGNtXXLf.js → lightbox-dxF3Rvzb.js} +1 -1
- package/dist/gui/assets/{link-CfF8WoKX.js → link-C1vVN7qZ.js} +1 -1
- package/dist/gui/assets/{linkdialogs-BtrIR5oZ.js → linkdialogs-BS_TKTUK.js} +1 -1
- package/dist/gui/assets/{mdbody-CM0vyeve.js → mdbody-BOOtXbVc.js} +2 -2
- package/dist/gui/assets/{pair-BdBNEx-I.js → pair-BnMHeNto.js} +1 -1
- package/dist/gui/assets/{picker-CBlvQLT5.js → picker-t7Evh2ur.js} +1 -1
- package/dist/gui/assets/{server-CSZVUOSr.js → server-DHcR0bEl.js} +1 -1
- package/dist/gui/assets/{sessionfacts-R0PNxQ07.js → sessionfacts-BvPZNbP-.js} +1 -1
- package/dist/gui/assets/{settings-Bqjz9KP-.js → settings-8qzBSaOd.js} +2 -2
- package/dist/gui/assets/{spawn-DlKByPlr.js → spawn-Bcb8_bFg.js} +1 -1
- package/dist/gui/assets/{termcard-acLQMoog.js → termcard-BsO2f0vp.js} +1 -1
- package/dist/gui/assets/{towerturns-Cldgw4hX.js → towerturns-BCVvCBoQ.js} +1 -1
- package/dist/gui/assets/{trains-CY_wPPrG.js → trains-BCOV1518.js} +1 -1
- package/dist/gui/assets/{trust-DYlVFo7K.js → trust-CTyGscJb.js} +1 -1
- package/dist/gui/assets/{views-BxBhtxB1.js → views-C8G5z8_0.js} +2 -2
- package/dist/gui/assets/waitcard-BlyEA-12.js +1 -0
- package/dist/gui/assets/{yard-Bqrbq1yf.js → yard-C-NsjPAi.js} +1 -1
- package/dist/gui/index.html +3 -3
- package/dist/gui/themes/raven/{raven-Dr7te0ib.js → raven-BEog_6gg.js} +1 -1
- package/dist/gui/themes/zen/{zen-C2J8hYV2.js → zen-dykbN8ak.js} +2 -2
- package/dist/gui/themes.json +2 -2
- package/package.json +1 -1
- package/dist/gui/assets/chat-pwXYtfIJ.js +0 -2
- package/dist/gui/assets/drawer-C4b67hAK.js +0 -1
- package/dist/gui/assets/index-CVl6pSSe.css +0 -1
- package/dist/gui/assets/waitcard-BF4toG4g.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./runtime-ZX6HkxDa.js";import{_t as t,nn as n}from"./index-
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{_t as t,nn as n}from"./index-TakEXnkN.js";import{t as r}from"./chat-9NVue1Zd.js";var i=((t={},n={})=>(n.locale??e())===`zh-TW`?`下一張`:`Next image`),a=((t={},n={})=>(n.locale??e())===`zh-TW`?`上一張`:`Previous image`),o=((t={},n={})=>(n.locale??e())===`zh-TW`?`圖片檢視`:`Image viewer`);function s(e,s){let c=s,l=t(`img`,{alt:``}),u=t(`span`,{class:`lb-count`}),d=(e,n,r,i)=>{let a=t(`button`,{type:`button`,class:e,"aria-label":n},r);return a.addEventListener(`click`,e=>(e.stopPropagation(),i())),a},f=t=>(c=(c+t+e.length)%e.length,g()),p=d(`lb-prev`,a(),`‹`,()=>f(-1)),m=d(`lb-next`,i(),`›`,()=>f(1)),h=t(`dialog`,{class:`lightbox`,"aria-label":o()},l,p,m,d(`lb-close`,n(),`×`,()=>h.close()),u);function g(){h.classList.remove(`zoom`),l.src=e[c],l.alt=r({n:c+1}),u.textContent=e.length>1?`${c+1} / ${e.length}`:``,p.hidden=m.hidden=e.length<2}l.addEventListener(`click`,e=>(e.stopPropagation(),h.classList.toggle(`zoom`))),h.addEventListener(`click`,()=>h.close()),h.addEventListener(`keydown`,t=>{e.length>1&&(t.key===`ArrowLeft`||t.key===`ArrowRight`)&&(t.preventDefault(),f(t.key===`ArrowLeft`?-1:1))}),h.addEventListener(`close`,()=>h.remove()),document.body.append(h),g(),h.showModal()}export{s as lightbox};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./sentencepack-DtYqpppS.js";import{t as n}from"./picker-CBlvQLT5.js";import{Ft as r,Jt as i,Nt as a,Xt as o,Yt as s,_t as c,ft as l,mt as u,q as d,qt as ee,vt as f}from"./index-Dvw58cHb.js";import{t as te}from"./pair-BdBNEx-I.js";var ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`核准`:`Approve`),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`有人值守`:`attended`),p=e=>`The camera could not be used: ${e?.reason}`,m=e=>`無法使用相機:${e?.reason}`,ie=((t,n={})=>(n.locale??e())===`zh-TW`?m(t):p(t)),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`取消邀請`:`Cancel invite`),oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`裝置`:`Device`),se=((t={},n={})=>(n.locale??e())===`zh-TW`?`類型`:`Kind`),ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`角色`:`Role`),le=((t={},n={})=>(n.locale??e())===`zh-TW`?`最後在線`:`Last presence`),ue=((t={},n={})=>(n.locale??e())===`zh-TW`?`信任`:`Trust`),de=((t={},n={})=>(n.locale??e())===`zh-TW`?`已複製`:`Copied`),fe=((t={},n={})=>(n.locale??e())===`zh-TW`?`複製`:`Copy`),pe=((t={},n={})=>(n.locale??e())===`zh-TW`?`無法複製;文字已選取,請自行複製`:`Could not copy; the text is selected, copy it yourself`),me=((t={},n={})=>(n.locale??e())===`zh-TW`?`建立團隊`:`Create team`),he=((t={},n={})=>(n.locale??e())===`zh-TW`?`中繼站的管理者會給你一次性的團隊 token。這台電腦會成為團隊的第一位管理員。`:`The relay's operator gives you a one-time team token. This computer becomes the team's first admin.`),ge=((t={},n={})=>(n.locale??e())===`zh-TW`?`建立團隊`:`Create a team`),h=e=>`Team ${e?.name} created`,g=e=>`團隊 ${e?.name} 已建立`,_e=((t,n={})=>(n.locale??e())===`zh-TW`?g(t):h(t)),ve=((t={},n={})=>(n.locale??e())===`zh-TW`?`裝置 id`:`Device id`),ye=((t={},n={})=>(n.locale??e())===`zh-TW`?`裝置 id`:`device id`),be=((t={},n={})=>(n.locale??e())===`zh-TW`?`26 個字元的裝置 id`:`26-character device id`),xe=((t={},n={})=>(n.locale??e())===`zh-TW`?`與另一台裝置同名`:`same label as another device`),_=e=>`key ${e?.n}`,v=e=>`金鑰 ${e?.n}`,Se=((t,n={})=>(n.locale??e())===`zh-TW`?v(t):_(t)),Ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`邀請電腦`:`Invite a computer`),we=((t={},n={})=>(n.locale??e())===`zh-TW`?`用新電腦的相機掃描,或把文字貼到那邊。只能用一次。新電腦會顯示四個單字:在這裡點選同一組。`:`Scan it with the new computer's camera, or paste the text there. It works once. The new computer shows four words: tap the same set here.`),Te=((t={},n={})=>(n.locale??e())===`zh-TW`?`這張邀請已失效`:`This invite has lapsed`),y=e=>`Lapses in ${e?.time}`,b=e=>`${e?.time} 後失效`,Ee=((t,n={})=>(n.locale??e())===`zh-TW`?b(t):y(t)),De=((t={},n={})=>(n.locale??e())===`zh-TW`?`邀請`:`Invite`),x=e=>`Invite for unattended device ${e?.device}`,S=e=>`邀請無人值守裝置 ${e?.device}`,C=((t,n={})=>(n.locale??e())===`zh-TW`?S(t):x(t)),Oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`邀請文字`:`Invite text`),w=e=>`Invite to ${e?.team}`,T=e=>`邀請加入 ${e?.team}`,ke=((t,n={})=>(n.locale??e())===`zh-TW`?T(t):w(t)),Ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`邀請無人值守裝置`:`Invite an unattended device`),je=((t={},n={})=>(n.locale??e())===`zh-TW`?`取消`:`Cancel`),Me=((t={},n={})=>(n.locale??e())===`zh-TW`?`已加入。團隊在「團隊」裡。`:`Joined. The team is under Teams.`),Ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`加入`:`Join`),Pe=((t={},n={})=>(n.locale??e())===`zh-TW`?`貼上邀請文字,或掃描它的 QR code。畫面會顯示四個單字,請念給邀請人聽,由他點選同一組。`:`Paste the invite text, or scan its QR code. You are shown four words to read to the inviter, who taps the same set.`),Fe=((t={},n={})=>(n.locale??e())===`zh-TW`?`你已加入。請選擇專案資料夾,再按使用:`:`You are added. Pick the project folder, then use it:`),Ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`專案資料夾已設定,正在完成…`:`Project folder set. Finishing…`),Le=((t={},n={})=>(n.locale??e())===`zh-TW`?`加入團隊`:`Join a team`),E=e=>`Waiting for the inviter to confirm. The invite lapses in ${e?.time}.`,D=e=>`等待邀請人確認。邀請將在 ${e?.time} 後失效。`,Re=((t,n={})=>(n.locale??e())===`zh-TW`?D(t):E(t)),ze=((t={},n={})=>(n.locale??e())===`zh-TW`?`等待邀請人核准這台裝置。`:`Waiting for the inviter to approve this device.`),Be=((t={},n={})=>(n.locale??e())===`zh-TW`?`請把這四個單字告訴邀請人:`:`Tell the inviter these words:`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦的名稱`:`This computer's label`),Ve=((t={},n={})=>(n.locale??e())===`zh-TW`?`這裡讀不到名稱`:`label unreadable here`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`離開`:`Leave`),He=((t={},n={})=>(n.locale??e())===`zh-TW`?`離開?你是唯一的管理員,離開後沒有人能移除裝置或輪換金鑰。再按一次仍要離開`:`Leave? You are the only admin: nobody can remove a device or rotate the key afterwards. Press again to leave anyway`),Ue=((t={},n={})=>(n.locale??e())===`zh-TW`?`離開?再按一次`:`Leave? Press again`),A=((t={},n={})=>(n.locale??e(),`dispatch`)),We=((t={},n={})=>(n.locale??e(),`forward`)),Ge=((t={},n={})=>(n.locale??e(),`reply`)),Ke=((t={},n={})=>(n.locale??e())===`zh-TW`?`設為管理員`:`Make admin`),qe=e=>`Make ${e?.name} an admin`,j=e=>`讓 ${e?.name} 成為管理員`,Je=((t,n={})=>(n.locale??e())===`zh-TW`?j(t):qe(t)),Ye=((t={},n={})=>(n.locale??e())===`zh-TW`?`設為成員`:`Make member`),Xe=((t={},n={})=>(n.locale??e())===`zh-TW`?`沒有專案`:`no project`),Ze=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦還沒有團隊。建立一個,或用邀請加入。`:`No teams on this computer yet. Create one, or join with an invite.`),Qe=((t={},n={})=>(n.locale??e())===`zh-TW`?`都不是:拒絕`:`None of these: refuse`),$e=((t={},n={})=>(n.locale??e())===`zh-TW`?`尚未使用的邀請`:`Open invites`),et=((t={},n={})=>(n.locale??e())===`zh-TW`?`邀請文字`:`Invite text`),M=e=>`An agent asked for this screen: ${e?.reason}`,N=e=>`有 agent 要求開啟這個畫面:${e?.reason}`,tt=((t,n={})=>(n.locale??e())===`zh-TW`?N(t):M(t)),P=((t={},n={})=>(n.locale??e())===`zh-TW`?`專案資料夾(訊息會送到開在這個資料夾上的塔台):`:`Project folder (messages go to a tower open on it):`),nt=(e,n)=>t(`link_project_pick`,P,e,n),rt=((t={},n={})=>(n.locale??e())===`zh-TW`?`拒絕`:`Refuse`),it=((t={},n={})=>(n.locale??e())===`zh-TW`?`中繼站網址`:`Relay URL`),at=((t={},n={})=>(n.locale??e())===`zh-TW`?`移除`:`Remove`),ot=((t={},n={})=>(n.locale??e())===`zh-TW`?`移除?再按一次`:`Remove? Press again`),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`管理員`:`admin`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`成員`:`member`),st=((t={},n={})=>(n.locale??e())===`zh-TW`?`輪換金鑰`:`Rotate key`),ct=((t={},n={})=>(n.locale??e())===`zh-TW`?`輪換?再按一次`:`Rotate? Press again`),lt=((t={},n={})=>(n.locale??e())===`zh-TW`?`用相機掃描`:`Scan with the camera`),ut=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦是團隊唯一有人值守的管理員。它一旦遺失,就沒有人能移除裝置或輪換金鑰。請再指定一位有人值守的管理員:`:`This computer is the team's only attended admin. If it is lost, nobody can remove a device or rotate the key. Make a second attended admin:`),dt=((t={},n={})=>(n.locale??e())===`zh-TW`?`設定 Straw Link`:`Set up Straw Link`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`Straw Link 尚未在這台電腦啟動。設定後會在其中一個 pi 工作階段(塔台或已加入的工作階段)啟動連線持有者。`:`Straw Link has not started on this computer. Setting it up starts a link holder in one of its pi sessions (a tower or a joined session).`),ft=(e,n)=>t(`link_setup_help`,L,e,n),pt=((t={},n={})=>(n.locale??e())===`zh-TW`?`啟動中,需要幾秒鐘。`:`Starting. This takes a few seconds.`),R=((t={},n={})=>(n.locale??e())===`zh-TW`?`分享`:`Share`),mt=((t={},n={})=>(n.locale??e())===`zh-TW`?`只分享在線`:`shares presence`),ht=((t={},n={})=>(n.locale??e())===`zh-TW`?`只分享我在線`:`Share only that I am online`),gt=((t={},n={})=>(n.locale??e())===`zh-TW`?`分享狀態`:`shares status`),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`分享我的塔台與分頁狀態`:`Share my towers' and tabs' states`),B=(e,n)=>t(`link_share_status_long`,z,e,n),_t=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示`:`Show`),V=((t={},n={})=>(n.locale??e())===`zh-TW`?`團隊`:`Teams`),H=((t={},n={})=>(n.locale??e())===`zh-TW`?`團隊 token`:`Team token`),U=e=>`Trust for ${e?.name}`,W=e=>`${e?.name} 的信任等級`,vt=((t,n={})=>(n.locale??e())===`zh-TW`?W(t):U(t)),yt=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台裝置傳來的訊息能做什麼。reply:允許清單內的唯讀工具直接執行,其餘在這裡問你。forward:同上,但其餘改問對方電腦上的人。dispatch:像你自己送的訊息一樣執行,仍受這台電腦自己的防護限制。`:`What a message from this device may do. reply: the allowed read-only tools run; anything else asks you here. forward: the same, but anything else asks that device's owner on their computer. dispatch: runs as a message from you would, under this computer's own guards.`),bt=((t={},n={})=>(n.locale??e())===`zh-TW`?`無人值守`:`unattended`),xt=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台裝置沒有人在操作。邀請裡的裝置 id 取代了單字比對。`:`This device has no one at it. The id in your invite stands in for the words.`),St=((t={},n={})=>(n.locale??e())===`zh-TW`?`使用這個資料夾`:`Use this folder`),G=e=>`Look at ${e?.label}'s screen. Tap the set of four words it shows. A wrong tap ends the invite.`,K=e=>`看 ${e?.label} 的螢幕,點選它顯示的那一組四個單字。點錯會結束這張邀請。`,Ct=((t,n={})=>(n.locale??e())===`zh-TW`?K(t):G(t)),wt=((t={},n={})=>(n.locale??e())===`zh-TW`?`(這台電腦)`:`(this computer)`),Tt=2e3,Et=()=>globalThis.BarcodeDetector,q=e=>e.body.reason??a({status:e.status}),Dt=e=>e===`admin`?F():I(),Ot=e=>({reply:Ge,forward:We,dispatch:A})[e]();function J(){return{id:`link`,title:V(),icon:`tower`,body:Y}}function Y(){let e=c(`div`,{class:`teams-tile`}),t=c(`p`,{class:`link-status`,role:`status`}),a=c(`div`,{class:`link-head`}),p=c(`div`,{class:`link-requests`}),m=c(`div`,{class:`link-teams`}),h=c(`div`,{class:`link-invites`}),g,_=``,v=``,y=new Map,b=async(e,n={})=>{let i=await d(`link/${e}`,n).catch(()=>({ok:!1,status:0,body:{reason:r()}}));return i.ok?t.textContent=``:t.textContent=q(i),$(),i},x=(e,t,n=`later`)=>{let r=c(`button`,{type:`button`,class:n},e);return r.onclick=()=>{r.disabled=!0,Promise.resolve(t()).finally(()=>r.disabled=!1)},r},S=(e,t,n)=>{let r=c(`button`,{type:`button`,class:`later`},e),i;return r.onclick=()=>{i?(clearTimeout(i),i=void 0,r.disabled=!0,Promise.resolve(n()).finally(()=>(r.disabled=!1,r.textContent=e,delete r.dataset.armed))):(r.textContent=t,r.dataset.armed=`true`,i=setTimeout(()=>(i=void 0,r.textContent=e,delete r.dataset.armed),5e3))},r},w=c(`div`,{class:`link-invite`,hidden:``}),T,E=``,D=()=>{clearInterval(T),w.hidden=!0,w.replaceChildren(),E=``},A=(e,n)=>{let r=e.body;if(!r.text||!r.rows||!r.expires)return;clearInterval(T),E=r.hash??``;let i=c(`b`,{class:`link-count`}),a=c(`textarea`,{readonly:``,rows:`4`,"aria-label":Oe()});a.value=r.text;let o=x(fe(),async()=>{await navigator.clipboard?.writeText(r.text).then(()=>t.textContent=de(),()=>(a.select(),t.textContent=pe()))}),s=x(ae(),async()=>{await b(`invite-cancel`,{hash:r.hash}),D()}),u=()=>{let e=r.expires-Date.now();i.textContent=e>0?Ee({time:l(e)}):Te(),w.dataset.lapsed=String(e<=0)};u(),T=setInterval(u,1e3),w.hidden=!1,w.replaceChildren(c(`h4`,null,n),te(r.rows),i,c(`p`,null,we()),a,c(`div`,{class:`devices-acts`},o,s))},We=e=>{let t=c(`div`,{class:`link-request`});if(t.append(c(`b`,null,e.unattended?i({label:e.label,short:e.short,team:e.teamName}):s({label:e.label,short:e.short,team:e.teamName}))),e.unattended)return t.append(c(`p`,null,xt()),c(`div`,{class:`devices-acts`},x(ne(),()=>b(`decide`,{id:e.id,approve:!0})),x(rt(),()=>b(`decide`,{id:e.id,approve:!1})))),t;t.append(c(`p`,null,Ct({label:e.label})));let n=c(`div`,{class:`link-words`});for(let[t,r]of e.sets.entries())n.append(x(r.join(` `),()=>b(`decide`,{id:e.id,pick:t}),`later link-set`));return t.append(n,c(`div`,{class:`devices-acts`},x(Qe(),()=>b(`decide`,{id:e.id,approve:!1})))),t},Ge=(e,t)=>{let n=c(`tr`,{"data-self":String(t.self),"data-online":String(t.online)}),r=c(`td`,null,c(`b`,null,t.label),` `,c(`small`,{class:`link-short`,title:t.id},t.short),t.duplicate&&c(`em`,{class:`link-dup`},xe()),!t.labelKnown&&c(`em`,{class:`link-dup`},Ve()),t.self&&c(`em`,null,wt())),i=c(`select`,{"aria-label":vt({name:t.label}),title:yt()});for(let e of[`reply`,`forward`,`dispatch`])i.append(new Option(Ot(e),e,!1,e===t.trust));i.onchange=()=>void b(`trust`,{device:t.id,level:i.value});let a=e.self.role===`admin`&&!t.self;return n.append(r,c(`td`,{class:`nw`},Dt(t.role)),c(`td`,{class:`nw`},t.attended?re():bt()),c(`td`,null,t.self?``:u(t.seenAgoMs,t.online)),c(`td`,null,t.self?``:i),c(`td`,{class:`link-acts`},...f(a&&t.attended&&x(t.role===`admin`?Ye():Ke(),()=>b(`role`,{team:e.team,device:t.id,role:t.role===`admin`?`member`:`admin`})),a&&S(at(),ot(),()=>b(`remove`,{team:e.team,device:t.id}))))),n},qe=e=>{let t=c(`section`,{class:`link-team`,"data-status":e.status});if(t.append(c(`h3`,null,e.name,` `,c(`small`,null,e.team.slice(0,6))),c(`p`,{class:`link-meta`},`${e.project||Xe()} · ${e.relay||`?`} · ${e.share===`status`?gt():mt()} · ${Se({n:String(e.epoch)})}`)),e.status===`stopped`)return t.append(c(`p`,{class:`link-warn`},o({team:e.name,reason:e.stoppedWhy??``})),S(k(),Ue(),()=>b(`leave`,{team:e.team,force:!0}))),t;e.relayDown&&t.append(c(`p`,{class:`link-warn`},ee({team:e.name,minutes:`2`}))),e.secondAdmin.length&&t.append(c(`div`,{class:`link-warn`},c(`p`,null,ut()),c(`div`,{class:`devices-acts`},...e.secondAdmin.map(t=>{let n=e.members.find(e=>e.id===t);return x(Je({name:n.label}),()=>b(`role`,{team:e.team,device:t,role:`admin`}))}))));let n=c(`table`,{class:`link-roster`},c(`thead`,null,c(`tr`,null,...[oe(),ce(),se(),le(),ue(),``].map(e=>c(`th`,null,e)))),c(`tbody`,null,...e.members.map(t=>Ge(e,t)))),r=c(`input`,{type:`text`,maxlength:`26`,placeholder:be(),"aria-label":ve()}),i=y.get(e.team)??{open:!1,text:``};r.value=i.text,r.oninput=()=>y.set(e.team,{open:!a.hidden,text:r.value});let a=c(`form`,{class:`link-inline`,...i.open?{}:{hidden:``}},r,x(De(),()=>j(e,r.value.trim()),`go`));a.onsubmit=t=>(t.preventDefault(),void j(e,r.value.trim()));let s=c(`div`,{class:`devices-acts`},...f(x(Ce(),()=>j(e)),x(Ae(),()=>void(a.hidden=!a.hidden,y.set(e.team,{open:!a.hidden,text:r.value}),r.focus())),e.self.role===`admin`&&S(st(),ct(),()=>b(`rotate`,{team:e.team})),S(k(),e.onlyAdmin&&e.members.length>1?He():Ue(),()=>b(`leave`,{team:e.team,force:e.onlyAdmin}))));return t.append(n,s,a),t},j=async(e,t)=>{let n=await b(`invite`,{team:e.team,...t?{forDevice:t}:{}});n.ok&&A(n,t?C({device:t.slice(0,6)}):ke({team:e.name}))},M=c(`input`,{type:`url`,"aria-label":it()}),N=c(`input`,{type:`password`,autocomplete:`off`,"aria-label":H()}),P=c(`input`,{type:`text`,maxlength:`40`,"aria-label":O()}),F=c(`select`,{"aria-label":R()});F.append(new Option(B(),`status`),new Option(ht(),`presence`));let I=``,L=n({},e=>I=e,()=>{}),z=c(`button`,{type:`button`,class:`go`},me());z.onclick=()=>{z.disabled=!0,b(`create`,{relay:M.value.trim(),token:N.value.trim(),project:I,share:F.value,...P.value.trim()?{label:P.value.trim()}:{}}).then(e=>{z.disabled=!1,e.ok&&(N.value=``,t.textContent=_e({name:String(e.body.name)}),V.open=!1)})};let V=c(`details`,{class:`link-form`},c(`summary`,null,ge()),c(`p`,null,he()),c(`label`,null,it(),M),c(`label`,null,H(),N),c(`label`,null,O(),P),c(`label`,null,R(),F),c(`p`,null,nt()),L.el,z),U=c(`textarea`,{rows:`3`,placeholder:`strawlink1:…`,"aria-label":et()}),W=c(`input`,{type:`text`,maxlength:`40`,"aria-label":O()}),G=c(`select`,{"aria-label":R()});G.append(new Option(B(),`status`),new Option(ht(),`presence`));let K=c(`div`,{class:`link-join-progress`}),J=``,Y=n({},e=>J=e,()=>{}),kt=x(St(),async()=>{J&&await b(`join-project`,{project:J,share:G.value})},`go`),X=c(`button`,{type:`button`,class:`go`},Ne());X.onclick=()=>{X.disabled=!0,b(`join-start`,{text:U.value.trim(),...W.value.trim()?{label:W.value.trim()}:{}}).then(e=>{X.disabled=!1,e.ok&&J&&b(`join-project`,{project:J,share:G.value})})};let Z=c(`div`,{class:`link-scan`,hidden:``}),Q,At=x(lt(),async()=>{let e=Et();if(!e||!navigator.mediaDevices?.getUserMedia)return;if(Q)return Q();let n=c(`video`,{playsinline:``,muted:``,"aria-label":lt()});try{let t=await navigator.mediaDevices.getUserMedia({video:{facingMode:`environment`}}),r=new e({formats:[`qr_code`]});n.srcObject=t,await n.play(),Z.hidden=!1,Z.replaceChildren(n);let i=setInterval(()=>void r.detect(n).then(e=>{let t=e.map(e=>e.rawValue).find(e=>e.trim().startsWith(`strawlink1:`));t&&(Q?.(),U.value=t.trim())},()=>{}),300);Q=()=>{clearInterval(i);for(let e of t.getTracks())e.stop();Z.hidden=!0,Z.replaceChildren(),Q=void 0}}catch(e){t.textContent=ie({reason:e.message})}});At.hidden=!Et();let jt=c(`details`,{class:`link-form`},c(`summary`,null,Le()),c(`p`,null,Pe()),U,At,Z,c(`label`,null,O(),W),c(`label`,null,R(),G),c(`p`,null,nt()),Y.el,X,K),Mt=e=>{if(!e)return void K.replaceChildren();let t=[];e.state===`failed`?t.push(c(`p`,{class:`link-warn`},e.error??``)):e.state===`done`?t.push(c(`p`,null,Me())):(t.push(c(`p`,null,Be()),c(`p`,{class:`link-bigwords`},e.words.join(` `)),c(`p`,null,e.pinned?ze():Re({time:l(e.expires-Date.now())}))),e.needsProject?t.push(c(`p`,null,Fe()),kt):t.push(c(`p`,null,Ie()))),e.state!==`done`&&t.push(x(je(),()=>b(`join-cancel`))),K.replaceChildren(...t)},Nt=()=>{let e=x(dt(),async()=>{let e=await d(`link/enable`,{}).catch(()=>void 0);t.textContent=e?.ok?pt():e?q(e):r()},`go`);a.replaceChildren(c(`p`,null,ft()),e),p.replaceChildren(),m.replaceChildren()},Pt=e=>{g=e;let n=JSON.stringify([e.label,e.deviceId,e.relay,e.teams.map(e=>[{...e,members:e.members.map(e=>({...e,seenAgoMs:e.seenAgoMs===null?null:Math.floor(e.seenAgoMs/6e4)}))}]),e.joinRequests,e.invites,e.alerts.map(e=>e.id)]);if(t.textContent===pt()&&(t.textContent=``),E&&!e.invites.some(e=>e.hash===E)&&D(),e.join?Mt(e.join):K.replaceChildren(),e.prefill&&v!==JSON.stringify(e.prefill)&&(v=JSON.stringify(e.prefill),e.prefill.kind===`join`?(e.prefill.text&&(U.value=e.prefill.text),e.prefill.project&&Y.picker.go(e.prefill.project),e.prefill.label&&(W.value=e.prefill.label),e.prefill.share&&(G.value=e.prefill.share),jt.open=!0):(e.prefill.relay&&(M.value=e.prefill.relay),e.prefill.project&&L.picker.go(e.prefill.project),e.prefill.share&&(F.value=e.prefill.share),e.prefill.label&&(P.value=e.prefill.label),V.open=!0),t.textContent=tt({reason:e.prefill.reason}),d(`link/prefill-clear`,{}).catch(()=>{})),!M.value&&e.relay&&(M.value=e.relay),W.placeholder=P.placeholder=e.label,n===_)return;_=n,a.replaceChildren(c(`p`,null,c(`b`,null,e.label),` `,c(`small`,{class:`link-short`,title:e.deviceId},e.short),` · `,ye(),` `,c(`code`,null,e.deviceId))),p.replaceChildren(...e.joinRequests.map(We)),m.replaceChildren(...e.teams.length?e.teams.map(qe):[c(`p`,{class:`chat-empty`},Ze())]);let r=e.invites.filter(e=>e.hash!==E);h.replaceChildren(...f(r.length>0&&c(`h4`,null,$e()),...r.map(e=>{let t=c(`div`,{class:`link-open-invite`},c(`span`,null,`${e.teamName}${e.forDevice?` · ${e.forDevice.slice(0,6)}`:``} · ${l(e.expires-Date.now())}`));return t.append(x(_t(),async()=>{let t=await b(`invite-text`,{hash:e.hash});t.ok&&A(t,e.forDevice?C({device:e.forDevice.slice(0,6)}):ke({team:e.teamName}))}),x(ae(),()=>b(`invite-cancel`,{hash:e.hash}))),t})))};async function $(){if(!e.isConnected&&g)return;let n=await d(`link/state`,{}).catch(()=>void 0);if(n){if(n.ok)return Pt(n.body.view);if(n.body.error===`no_holder`)return Nt();t.textContent=q(n)}}let Ft=setInterval(()=>e.isConnected?void $():clearInterval(Ft),Tt);return e.append(a,t,p,m,w,h,V,jt),$(),e}export{J as linkTile};
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./sentencepack-DtYqpppS.js";import{t as n}from"./picker-t7Evh2ur.js";import{Ft as r,Jt as i,Nt as a,Xt as o,Yt as s,_t as c,ft as l,mt as u,q as d,qt as ee,vt as f}from"./index-TakEXnkN.js";import{t as te}from"./pair-BnMHeNto.js";var ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`核准`:`Approve`),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`有人值守`:`attended`),p=e=>`The camera could not be used: ${e?.reason}`,m=e=>`無法使用相機:${e?.reason}`,ie=((t,n={})=>(n.locale??e())===`zh-TW`?m(t):p(t)),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`取消邀請`:`Cancel invite`),oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`裝置`:`Device`),se=((t={},n={})=>(n.locale??e())===`zh-TW`?`類型`:`Kind`),ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`角色`:`Role`),le=((t={},n={})=>(n.locale??e())===`zh-TW`?`最後在線`:`Last presence`),ue=((t={},n={})=>(n.locale??e())===`zh-TW`?`信任`:`Trust`),de=((t={},n={})=>(n.locale??e())===`zh-TW`?`已複製`:`Copied`),fe=((t={},n={})=>(n.locale??e())===`zh-TW`?`複製`:`Copy`),pe=((t={},n={})=>(n.locale??e())===`zh-TW`?`無法複製;文字已選取,請自行複製`:`Could not copy; the text is selected, copy it yourself`),me=((t={},n={})=>(n.locale??e())===`zh-TW`?`建立團隊`:`Create team`),he=((t={},n={})=>(n.locale??e())===`zh-TW`?`中繼站的管理者會給你一次性的團隊 token。這台電腦會成為團隊的第一位管理員。`:`The relay's operator gives you a one-time team token. This computer becomes the team's first admin.`),ge=((t={},n={})=>(n.locale??e())===`zh-TW`?`建立團隊`:`Create a team`),h=e=>`Team ${e?.name} created`,g=e=>`團隊 ${e?.name} 已建立`,_e=((t,n={})=>(n.locale??e())===`zh-TW`?g(t):h(t)),ve=((t={},n={})=>(n.locale??e())===`zh-TW`?`裝置 id`:`Device id`),ye=((t={},n={})=>(n.locale??e())===`zh-TW`?`裝置 id`:`device id`),be=((t={},n={})=>(n.locale??e())===`zh-TW`?`26 個字元的裝置 id`:`26-character device id`),xe=((t={},n={})=>(n.locale??e())===`zh-TW`?`與另一台裝置同名`:`same label as another device`),_=e=>`key ${e?.n}`,v=e=>`金鑰 ${e?.n}`,Se=((t,n={})=>(n.locale??e())===`zh-TW`?v(t):_(t)),Ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`邀請電腦`:`Invite a computer`),we=((t={},n={})=>(n.locale??e())===`zh-TW`?`用新電腦的相機掃描,或把文字貼到那邊。只能用一次。新電腦會顯示四個單字:在這裡點選同一組。`:`Scan it with the new computer's camera, or paste the text there. It works once. The new computer shows four words: tap the same set here.`),Te=((t={},n={})=>(n.locale??e())===`zh-TW`?`這張邀請已失效`:`This invite has lapsed`),y=e=>`Lapses in ${e?.time}`,b=e=>`${e?.time} 後失效`,Ee=((t,n={})=>(n.locale??e())===`zh-TW`?b(t):y(t)),De=((t={},n={})=>(n.locale??e())===`zh-TW`?`邀請`:`Invite`),x=e=>`Invite for unattended device ${e?.device}`,S=e=>`邀請無人值守裝置 ${e?.device}`,C=((t,n={})=>(n.locale??e())===`zh-TW`?S(t):x(t)),Oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`邀請文字`:`Invite text`),w=e=>`Invite to ${e?.team}`,T=e=>`邀請加入 ${e?.team}`,ke=((t,n={})=>(n.locale??e())===`zh-TW`?T(t):w(t)),Ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`邀請無人值守裝置`:`Invite an unattended device`),je=((t={},n={})=>(n.locale??e())===`zh-TW`?`取消`:`Cancel`),Me=((t={},n={})=>(n.locale??e())===`zh-TW`?`已加入。團隊在「團隊」裡。`:`Joined. The team is under Teams.`),Ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`加入`:`Join`),Pe=((t={},n={})=>(n.locale??e())===`zh-TW`?`貼上邀請文字,或掃描它的 QR code。畫面會顯示四個單字,請念給邀請人聽,由他點選同一組。`:`Paste the invite text, or scan its QR code. You are shown four words to read to the inviter, who taps the same set.`),Fe=((t={},n={})=>(n.locale??e())===`zh-TW`?`你已加入。請選擇專案資料夾,再按使用:`:`You are added. Pick the project folder, then use it:`),Ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`專案資料夾已設定,正在完成…`:`Project folder set. Finishing…`),Le=((t={},n={})=>(n.locale??e())===`zh-TW`?`加入團隊`:`Join a team`),E=e=>`Waiting for the inviter to confirm. The invite lapses in ${e?.time}.`,D=e=>`等待邀請人確認。邀請將在 ${e?.time} 後失效。`,Re=((t,n={})=>(n.locale??e())===`zh-TW`?D(t):E(t)),ze=((t={},n={})=>(n.locale??e())===`zh-TW`?`等待邀請人核准這台裝置。`:`Waiting for the inviter to approve this device.`),Be=((t={},n={})=>(n.locale??e())===`zh-TW`?`請把這四個單字告訴邀請人:`:`Tell the inviter these words:`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦的名稱`:`This computer's label`),Ve=((t={},n={})=>(n.locale??e())===`zh-TW`?`這裡讀不到名稱`:`label unreadable here`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`離開`:`Leave`),He=((t={},n={})=>(n.locale??e())===`zh-TW`?`離開?你是唯一的管理員,離開後沒有人能移除裝置或輪換金鑰。再按一次仍要離開`:`Leave? You are the only admin: nobody can remove a device or rotate the key afterwards. Press again to leave anyway`),Ue=((t={},n={})=>(n.locale??e())===`zh-TW`?`離開?再按一次`:`Leave? Press again`),A=((t={},n={})=>(n.locale??e(),`dispatch`)),We=((t={},n={})=>(n.locale??e(),`forward`)),Ge=((t={},n={})=>(n.locale??e(),`reply`)),Ke=((t={},n={})=>(n.locale??e())===`zh-TW`?`設為管理員`:`Make admin`),qe=e=>`Make ${e?.name} an admin`,j=e=>`讓 ${e?.name} 成為管理員`,Je=((t,n={})=>(n.locale??e())===`zh-TW`?j(t):qe(t)),Ye=((t={},n={})=>(n.locale??e())===`zh-TW`?`設為成員`:`Make member`),Xe=((t={},n={})=>(n.locale??e())===`zh-TW`?`沒有專案`:`no project`),Ze=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦還沒有團隊。建立一個,或用邀請加入。`:`No teams on this computer yet. Create one, or join with an invite.`),Qe=((t={},n={})=>(n.locale??e())===`zh-TW`?`都不是:拒絕`:`None of these: refuse`),$e=((t={},n={})=>(n.locale??e())===`zh-TW`?`尚未使用的邀請`:`Open invites`),et=((t={},n={})=>(n.locale??e())===`zh-TW`?`邀請文字`:`Invite text`),M=e=>`An agent asked for this screen: ${e?.reason}`,N=e=>`有 agent 要求開啟這個畫面:${e?.reason}`,tt=((t,n={})=>(n.locale??e())===`zh-TW`?N(t):M(t)),P=((t={},n={})=>(n.locale??e())===`zh-TW`?`專案資料夾(訊息會送到開在這個資料夾上的塔台):`:`Project folder (messages go to a tower open on it):`),nt=(e,n)=>t(`link_project_pick`,P,e,n),rt=((t={},n={})=>(n.locale??e())===`zh-TW`?`拒絕`:`Refuse`),it=((t={},n={})=>(n.locale??e())===`zh-TW`?`中繼站網址`:`Relay URL`),at=((t={},n={})=>(n.locale??e())===`zh-TW`?`移除`:`Remove`),ot=((t={},n={})=>(n.locale??e())===`zh-TW`?`移除?再按一次`:`Remove? Press again`),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`管理員`:`admin`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`成員`:`member`),st=((t={},n={})=>(n.locale??e())===`zh-TW`?`輪換金鑰`:`Rotate key`),ct=((t={},n={})=>(n.locale??e())===`zh-TW`?`輪換?再按一次`:`Rotate? Press again`),lt=((t={},n={})=>(n.locale??e())===`zh-TW`?`用相機掃描`:`Scan with the camera`),ut=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦是團隊唯一有人值守的管理員。它一旦遺失,就沒有人能移除裝置或輪換金鑰。請再指定一位有人值守的管理員:`:`This computer is the team's only attended admin. If it is lost, nobody can remove a device or rotate the key. Make a second attended admin:`),dt=((t={},n={})=>(n.locale??e())===`zh-TW`?`設定 Straw Link`:`Set up Straw Link`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`Straw Link 尚未在這台電腦啟動。設定後會在其中一個 pi 工作階段(塔台或已加入的工作階段)啟動連線持有者。`:`Straw Link has not started on this computer. Setting it up starts a link holder in one of its pi sessions (a tower or a joined session).`),ft=(e,n)=>t(`link_setup_help`,L,e,n),pt=((t={},n={})=>(n.locale??e())===`zh-TW`?`啟動中,需要幾秒鐘。`:`Starting. This takes a few seconds.`),R=((t={},n={})=>(n.locale??e())===`zh-TW`?`分享`:`Share`),mt=((t={},n={})=>(n.locale??e())===`zh-TW`?`只分享在線`:`shares presence`),ht=((t={},n={})=>(n.locale??e())===`zh-TW`?`只分享我在線`:`Share only that I am online`),gt=((t={},n={})=>(n.locale??e())===`zh-TW`?`分享狀態`:`shares status`),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`分享我的塔台與分頁狀態`:`Share my towers' and tabs' states`),B=(e,n)=>t(`link_share_status_long`,z,e,n),_t=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示`:`Show`),V=((t={},n={})=>(n.locale??e())===`zh-TW`?`團隊`:`Teams`),H=((t={},n={})=>(n.locale??e())===`zh-TW`?`團隊 token`:`Team token`),U=e=>`Trust for ${e?.name}`,W=e=>`${e?.name} 的信任等級`,vt=((t,n={})=>(n.locale??e())===`zh-TW`?W(t):U(t)),yt=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台裝置傳來的訊息能做什麼。reply:允許清單內的唯讀工具直接執行,其餘在這裡問你。forward:同上,但其餘改問對方電腦上的人。dispatch:像你自己送的訊息一樣執行,仍受這台電腦自己的防護限制。`:`What a message from this device may do. reply: the allowed read-only tools run; anything else asks you here. forward: the same, but anything else asks that device's owner on their computer. dispatch: runs as a message from you would, under this computer's own guards.`),bt=((t={},n={})=>(n.locale??e())===`zh-TW`?`無人值守`:`unattended`),xt=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台裝置沒有人在操作。邀請裡的裝置 id 取代了單字比對。`:`This device has no one at it. The id in your invite stands in for the words.`),St=((t={},n={})=>(n.locale??e())===`zh-TW`?`使用這個資料夾`:`Use this folder`),G=e=>`Look at ${e?.label}'s screen. Tap the set of four words it shows. A wrong tap ends the invite.`,K=e=>`看 ${e?.label} 的螢幕,點選它顯示的那一組四個單字。點錯會結束這張邀請。`,Ct=((t,n={})=>(n.locale??e())===`zh-TW`?K(t):G(t)),wt=((t={},n={})=>(n.locale??e())===`zh-TW`?`(這台電腦)`:`(this computer)`),Tt=2e3,Et=()=>globalThis.BarcodeDetector,q=e=>e.body.reason??a({status:e.status}),Dt=e=>e===`admin`?F():I(),Ot=e=>({reply:Ge,forward:We,dispatch:A})[e]();function J(){return{id:`link`,title:V(),icon:`tower`,body:Y}}function Y(){let e=c(`div`,{class:`teams-tile`}),t=c(`p`,{class:`link-status`,role:`status`}),a=c(`div`,{class:`link-head`}),p=c(`div`,{class:`link-requests`}),m=c(`div`,{class:`link-teams`}),h=c(`div`,{class:`link-invites`}),g,_=``,v=``,y=new Map,b=async(e,n={})=>{let i=await d(`link/${e}`,n).catch(()=>({ok:!1,status:0,body:{reason:r()}}));return i.ok?t.textContent=``:t.textContent=q(i),$(),i},x=(e,t,n=`later`)=>{let r=c(`button`,{type:`button`,class:n},e);return r.onclick=()=>{r.disabled=!0,Promise.resolve(t()).finally(()=>r.disabled=!1)},r},S=(e,t,n)=>{let r=c(`button`,{type:`button`,class:`later`},e),i;return r.onclick=()=>{i?(clearTimeout(i),i=void 0,r.disabled=!0,Promise.resolve(n()).finally(()=>(r.disabled=!1,r.textContent=e,delete r.dataset.armed))):(r.textContent=t,r.dataset.armed=`true`,i=setTimeout(()=>(i=void 0,r.textContent=e,delete r.dataset.armed),5e3))},r},w=c(`div`,{class:`link-invite`,hidden:``}),T,E=``,D=()=>{clearInterval(T),w.hidden=!0,w.replaceChildren(),E=``},A=(e,n)=>{let r=e.body;if(!r.text||!r.rows||!r.expires)return;clearInterval(T),E=r.hash??``;let i=c(`b`,{class:`link-count`}),a=c(`textarea`,{readonly:``,rows:`4`,"aria-label":Oe()});a.value=r.text;let o=x(fe(),async()=>{await navigator.clipboard?.writeText(r.text).then(()=>t.textContent=de(),()=>(a.select(),t.textContent=pe()))}),s=x(ae(),async()=>{await b(`invite-cancel`,{hash:r.hash}),D()}),u=()=>{let e=r.expires-Date.now();i.textContent=e>0?Ee({time:l(e)}):Te(),w.dataset.lapsed=String(e<=0)};u(),T=setInterval(u,1e3),w.hidden=!1,w.replaceChildren(c(`h4`,null,n),te(r.rows),i,c(`p`,null,we()),a,c(`div`,{class:`devices-acts`},o,s))},We=e=>{let t=c(`div`,{class:`link-request`});if(t.append(c(`b`,null,e.unattended?i({label:e.label,short:e.short,team:e.teamName}):s({label:e.label,short:e.short,team:e.teamName}))),e.unattended)return t.append(c(`p`,null,xt()),c(`div`,{class:`devices-acts`},x(ne(),()=>b(`decide`,{id:e.id,approve:!0})),x(rt(),()=>b(`decide`,{id:e.id,approve:!1})))),t;t.append(c(`p`,null,Ct({label:e.label})));let n=c(`div`,{class:`link-words`});for(let[t,r]of e.sets.entries())n.append(x(r.join(` `),()=>b(`decide`,{id:e.id,pick:t}),`later link-set`));return t.append(n,c(`div`,{class:`devices-acts`},x(Qe(),()=>b(`decide`,{id:e.id,approve:!1})))),t},Ge=(e,t)=>{let n=c(`tr`,{"data-self":String(t.self),"data-online":String(t.online)}),r=c(`td`,null,c(`b`,null,t.label),` `,c(`small`,{class:`link-short`,title:t.id},t.short),t.duplicate&&c(`em`,{class:`link-dup`},xe()),!t.labelKnown&&c(`em`,{class:`link-dup`},Ve()),t.self&&c(`em`,null,wt())),i=c(`select`,{"aria-label":vt({name:t.label}),title:yt()});for(let e of[`reply`,`forward`,`dispatch`])i.append(new Option(Ot(e),e,!1,e===t.trust));i.onchange=()=>void b(`trust`,{device:t.id,level:i.value});let a=e.self.role===`admin`&&!t.self;return n.append(r,c(`td`,{class:`nw`},Dt(t.role)),c(`td`,{class:`nw`},t.attended?re():bt()),c(`td`,null,t.self?``:u(t.seenAgoMs,t.online)),c(`td`,null,t.self?``:i),c(`td`,{class:`link-acts`},...f(a&&t.attended&&x(t.role===`admin`?Ye():Ke(),()=>b(`role`,{team:e.team,device:t.id,role:t.role===`admin`?`member`:`admin`})),a&&S(at(),ot(),()=>b(`remove`,{team:e.team,device:t.id}))))),n},qe=e=>{let t=c(`section`,{class:`link-team`,"data-status":e.status});if(t.append(c(`h3`,null,e.name,` `,c(`small`,null,e.team.slice(0,6))),c(`p`,{class:`link-meta`},`${e.project||Xe()} · ${e.relay||`?`} · ${e.share===`status`?gt():mt()} · ${Se({n:String(e.epoch)})}`)),e.status===`stopped`)return t.append(c(`p`,{class:`link-warn`},o({team:e.name,reason:e.stoppedWhy??``})),S(k(),Ue(),()=>b(`leave`,{team:e.team,force:!0}))),t;e.relayDown&&t.append(c(`p`,{class:`link-warn`},ee({team:e.name,minutes:`2`}))),e.secondAdmin.length&&t.append(c(`div`,{class:`link-warn`},c(`p`,null,ut()),c(`div`,{class:`devices-acts`},...e.secondAdmin.map(t=>{let n=e.members.find(e=>e.id===t);return x(Je({name:n.label}),()=>b(`role`,{team:e.team,device:t,role:`admin`}))}))));let n=c(`table`,{class:`link-roster`},c(`thead`,null,c(`tr`,null,...[oe(),ce(),se(),le(),ue(),``].map(e=>c(`th`,null,e)))),c(`tbody`,null,...e.members.map(t=>Ge(e,t)))),r=c(`input`,{type:`text`,maxlength:`26`,placeholder:be(),"aria-label":ve()}),i=y.get(e.team)??{open:!1,text:``};r.value=i.text,r.oninput=()=>y.set(e.team,{open:!a.hidden,text:r.value});let a=c(`form`,{class:`link-inline`,...i.open?{}:{hidden:``}},r,x(De(),()=>j(e,r.value.trim()),`go`));a.onsubmit=t=>(t.preventDefault(),void j(e,r.value.trim()));let s=c(`div`,{class:`devices-acts`},...f(x(Ce(),()=>j(e)),x(Ae(),()=>void(a.hidden=!a.hidden,y.set(e.team,{open:!a.hidden,text:r.value}),r.focus())),e.self.role===`admin`&&S(st(),ct(),()=>b(`rotate`,{team:e.team})),S(k(),e.onlyAdmin&&e.members.length>1?He():Ue(),()=>b(`leave`,{team:e.team,force:e.onlyAdmin}))));return t.append(n,s,a),t},j=async(e,t)=>{let n=await b(`invite`,{team:e.team,...t?{forDevice:t}:{}});n.ok&&A(n,t?C({device:t.slice(0,6)}):ke({team:e.name}))},M=c(`input`,{type:`url`,"aria-label":it()}),N=c(`input`,{type:`password`,autocomplete:`off`,"aria-label":H()}),P=c(`input`,{type:`text`,maxlength:`40`,"aria-label":O()}),F=c(`select`,{"aria-label":R()});F.append(new Option(B(),`status`),new Option(ht(),`presence`));let I=``,L=n({},e=>I=e,()=>{}),z=c(`button`,{type:`button`,class:`go`},me());z.onclick=()=>{z.disabled=!0,b(`create`,{relay:M.value.trim(),token:N.value.trim(),project:I,share:F.value,...P.value.trim()?{label:P.value.trim()}:{}}).then(e=>{z.disabled=!1,e.ok&&(N.value=``,t.textContent=_e({name:String(e.body.name)}),V.open=!1)})};let V=c(`details`,{class:`link-form`},c(`summary`,null,ge()),c(`p`,null,he()),c(`label`,null,it(),M),c(`label`,null,H(),N),c(`label`,null,O(),P),c(`label`,null,R(),F),c(`p`,null,nt()),L.el,z),U=c(`textarea`,{rows:`3`,placeholder:`strawlink1:…`,"aria-label":et()}),W=c(`input`,{type:`text`,maxlength:`40`,"aria-label":O()}),G=c(`select`,{"aria-label":R()});G.append(new Option(B(),`status`),new Option(ht(),`presence`));let K=c(`div`,{class:`link-join-progress`}),J=``,Y=n({},e=>J=e,()=>{}),kt=x(St(),async()=>{J&&await b(`join-project`,{project:J,share:G.value})},`go`),X=c(`button`,{type:`button`,class:`go`},Ne());X.onclick=()=>{X.disabled=!0,b(`join-start`,{text:U.value.trim(),...W.value.trim()?{label:W.value.trim()}:{}}).then(e=>{X.disabled=!1,e.ok&&J&&b(`join-project`,{project:J,share:G.value})})};let Z=c(`div`,{class:`link-scan`,hidden:``}),Q,At=x(lt(),async()=>{let e=Et();if(!e||!navigator.mediaDevices?.getUserMedia)return;if(Q)return Q();let n=c(`video`,{playsinline:``,muted:``,"aria-label":lt()});try{let t=await navigator.mediaDevices.getUserMedia({video:{facingMode:`environment`}}),r=new e({formats:[`qr_code`]});n.srcObject=t,await n.play(),Z.hidden=!1,Z.replaceChildren(n);let i=setInterval(()=>void r.detect(n).then(e=>{let t=e.map(e=>e.rawValue).find(e=>e.trim().startsWith(`strawlink1:`));t&&(Q?.(),U.value=t.trim())},()=>{}),300);Q=()=>{clearInterval(i);for(let e of t.getTracks())e.stop();Z.hidden=!0,Z.replaceChildren(),Q=void 0}}catch(e){t.textContent=ie({reason:e.message})}});At.hidden=!Et();let jt=c(`details`,{class:`link-form`},c(`summary`,null,Le()),c(`p`,null,Pe()),U,At,Z,c(`label`,null,O(),W),c(`label`,null,R(),G),c(`p`,null,nt()),Y.el,X,K),Mt=e=>{if(!e)return void K.replaceChildren();let t=[];e.state===`failed`?t.push(c(`p`,{class:`link-warn`},e.error??``)):e.state===`done`?t.push(c(`p`,null,Me())):(t.push(c(`p`,null,Be()),c(`p`,{class:`link-bigwords`},e.words.join(` `)),c(`p`,null,e.pinned?ze():Re({time:l(e.expires-Date.now())}))),e.needsProject?t.push(c(`p`,null,Fe()),kt):t.push(c(`p`,null,Ie()))),e.state!==`done`&&t.push(x(je(),()=>b(`join-cancel`))),K.replaceChildren(...t)},Nt=()=>{let e=x(dt(),async()=>{let e=await d(`link/enable`,{}).catch(()=>void 0);t.textContent=e?.ok?pt():e?q(e):r()},`go`);a.replaceChildren(c(`p`,null,ft()),e),p.replaceChildren(),m.replaceChildren()},Pt=e=>{g=e;let n=JSON.stringify([e.label,e.deviceId,e.relay,e.teams.map(e=>[{...e,members:e.members.map(e=>({...e,seenAgoMs:e.seenAgoMs===null?null:Math.floor(e.seenAgoMs/6e4)}))}]),e.joinRequests,e.invites,e.alerts.map(e=>e.id)]);if(t.textContent===pt()&&(t.textContent=``),E&&!e.invites.some(e=>e.hash===E)&&D(),e.join?Mt(e.join):K.replaceChildren(),e.prefill&&v!==JSON.stringify(e.prefill)&&(v=JSON.stringify(e.prefill),e.prefill.kind===`join`?(e.prefill.text&&(U.value=e.prefill.text),e.prefill.project&&Y.picker.go(e.prefill.project),e.prefill.label&&(W.value=e.prefill.label),e.prefill.share&&(G.value=e.prefill.share),jt.open=!0):(e.prefill.relay&&(M.value=e.prefill.relay),e.prefill.project&&L.picker.go(e.prefill.project),e.prefill.share&&(F.value=e.prefill.share),e.prefill.label&&(P.value=e.prefill.label),V.open=!0),t.textContent=tt({reason:e.prefill.reason}),d(`link/prefill-clear`,{}).catch(()=>{})),!M.value&&e.relay&&(M.value=e.relay),W.placeholder=P.placeholder=e.label,n===_)return;_=n,a.replaceChildren(c(`p`,null,c(`b`,null,e.label),` `,c(`small`,{class:`link-short`,title:e.deviceId},e.short),` · `,ye(),` `,c(`code`,null,e.deviceId))),p.replaceChildren(...e.joinRequests.map(We)),m.replaceChildren(...e.teams.length?e.teams.map(qe):[c(`p`,{class:`chat-empty`},Ze())]);let r=e.invites.filter(e=>e.hash!==E);h.replaceChildren(...f(r.length>0&&c(`h4`,null,$e()),...r.map(e=>{let t=c(`div`,{class:`link-open-invite`},c(`span`,null,`${e.teamName}${e.forDevice?` · ${e.forDevice.slice(0,6)}`:``} · ${l(e.expires-Date.now())}`));return t.append(x(_t(),async()=>{let t=await b(`invite-text`,{hash:e.hash});t.ok&&A(t,e.forDevice?C({device:e.forDevice.slice(0,6)}):ke({team:e.teamName}))}),x(ae(),()=>b(`invite-cancel`,{hash:e.hash}))),t})))};async function $(){if(!e.isConnected&&g)return;let n=await d(`link/state`,{}).catch(()=>void 0);if(n){if(n.ok)return Pt(n.body.view);if(n.body.error===`no_holder`)return Nt();t.textContent=q(n)}}let Ft=setInterval(()=>e.isConnected?void $():clearInterval(Ft),Tt);return e.append(a,t,p,m,w,h,V,jt),$(),e}export{J as linkTile};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./ask-
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./ask-C3ZbOHCx.js";import{d as n,f as r,i}from"./asks-uzLqEs-h.js";import{_t as a,pt as o,ut as s}from"./index-TakEXnkN.js";var c=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個問題無法在這裡顯示,請到該裝置上回答。`:`This question could not be shown here. Answer it at the device.`);function l(){let e=new Map,l=e=>{let n=String(e.data.device),r=String(e.data.dialogId),o=String(e.data.digest),s=a(`li`,{class:`link-alert`,"data-kind":`dialog`}),c=a(`b`,null),l=a(`div`,{class:`link-dialog`}),u=a(`small`,{class:`link-note`,role:`status`}),d=i({device:n,dialogId:r,digest:o});return s.append(c,l,u),{row:s,line:c,status:u,ask:t(l,d,!0),digest:o}};return{row(t){let i=e.get(t.id);i&&i.digest!==String(t.data.digest)&&(e.delete(t.id),i=void 0),i||e.set(t.id,i=l(t));let a=o(t),u=r(t),d=a===`open`&&u!==void 0;return i.row.dataset.level=t.level,i.row.dataset.state=a,i.line.textContent=s(t),i.ask.update(d?u:void 0,d),i.status.textContent=a===`open`?u?``:c():n(a),i.row},keep(t){for(let n of e.keys())t.has(n)||e.delete(n)}}}export{l as mountDialogCards};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-
|
|
2
|
-
import{t as e}from"./runtime-ZX6HkxDa.js";import{r as t}from"./sessionfacts-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-CnIOR2a_.css","./blockschunk-DALNShjU.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{r as t}from"./sessionfacts-BvPZNbP-.js";import{o as n}from"./towerturns-BCVvCBoQ.js";import{n as r,r as i}from"./markdown-Bk5NWfKQ.js";import{G as a,Nt as o,_t as s}from"./index-TakEXnkN.js";var c=((t={},n={})=>(n.locale??e())===`zh-TW`?`區塊不能傳送指令(以 ! 或 / 開頭的一行)。請在下方輸入框自行輸入。`:`A block cannot send a command (a line that starts with ! or /). Type it in the box below.`),l=65,u=2e3,d=new Map;function f(e,t){let n=n=>{let r=JSON.stringify([...t,n]),i=e.get(r);if(!i){for(let[t,n]of e)e.size>=u&&n.cell.state!==`pending`&&e.delete(t);e.set(r,i={cell:{state:`open`},views:new Set})}return i},r=(e,t,r)=>{let i=n(e);i.cell=t,r?i.seeded=!0:delete i.seeded;for(let e of i.views){let n=e.deref();n?n.show(t):i.views.delete(e)}};return{get:e=>n(e).cell,pend:e=>r(e,{state:`pending`}),done:(e,t)=>r(e,{state:`done`,fields:t.slice(0,l)}),cancel:e=>r(e,{state:`open`}),seed({done:i,pending:a}){let o=new Set([...i.map(([e])=>e),...a]);for(let[n,i]of e){let e=JSON.parse(n),a=e.at(-1);i.seeded&&i.cell.state===`pending`&&e.length===t.length+1&&t.every((t,n)=>e[n]===t)&&!o.has(a)&&r(a,{state:`open`})}for(let[e,t]of i)r(e,{state:`done`,fields:t.slice(0,l)});for(let e of a)n(e).cell.state===`open`&&r(e,{state:`pending`},!0)},watch:(e,t)=>void n(e).views.add(new WeakRef(t))}}var p=(...e)=>f(e.length?d:new Map,e),m=e=>({ok:!1,reason:e.status===504?t():n(e)??e.body.reason??o({status:e.status}),...e.status===409&&e.body.error===`answered`&&Array.isArray(e.body.fields)?{answered:e.body.fields}:{}}),h=e=>e.ok?{ok:!0}:m(e),g=e=>/^\s*[!/]/.test(e),_=(e,n)=>async r=>g(r)?{ok:!1,reason:c()}:e({text:r,as:`send`,guarded:!0,block:n}).then(h,()=>({ok:!1,reason:t()})),v=()=>Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``),y=(e,n,r)=>async i=>e(`doc/${encodeURIComponent(n)}/answer`,{answerId:v(),answer:i,rev:r}).then(h,()=>({ok:!1,reason:t()})),b=RegExp("^ {0,3}(?:`{3,}|~{3,})[ \\t]*(?:mermaid|diff|cards|options|form|review|mindmap|suggest|checklist|table|steps|stats|tree)(?=\\s|$)",`im`),x=/^ {0,3}> ?\[!(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/im,S=e=>b.test(e)||x.test(e),C=new Set;function w(e,t,n){let o=s(`div`,{class:t},r(i(e)));if(n&&S(e)){let t=a(async()=>{let{drawBlocks:e}=await import(`./blockschunk-LYFl0hBj.js`);return{drawBlocks:e}},__vite__mapDeps([0,1]),import.meta.url).then(async({drawBlocks:t})=>t(o,e,n,!n.ready||await n.ready())).catch(()=>{});C.add(t),t.finally(()=>C.delete(t))}return o}export{p as i,y as n,_ as r,w as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{t as e}from"./runtime-ZX6HkxDa.js";import{a as t,i as n,n as r,t as i}from"./pairs-B51CKIwf.js";import{n as a,r as o,t as s}from"./lan_number_ask-DlHJl9jN.js";import{o as c,s as l}from"./asks-BP9fh8zE.js";import{Ft as u,K as d,Nt as f,Rt as p,_t as m,q as h,vt as g}from"./index-Dvw58cHb.js";var ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在取得配對碼…`:`Asking for a pairing code…`),_=e=>`Wi-Fi · ${e?.host}`,v=e=>`Wi-Fi・${e?.host}`,y=((t,n={})=>(n.locale??e())===`zh-TW`?v(t):_(t)),b=((t={},n={})=>(n.locale??e(),`Tailscale`)),x=e=>`Paired ${e?.paired} · last used ${e?.seen}`,S=e=>`配對於 ${e?.paired}・最後使用 ${e?.seen}`,C=((t,n={})=>(n.locale??e())===`zh-TW`?S(t):x(t)),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`沒有已配對的裝置。`:`No device is paired.`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`已配對的裝置`:`Paired devices`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取維持關閉:憑證檔讀不出來,或其他帳號也讀得到。請在 pi session 執行 /boss gui lan reset 產生新的憑證,每支手機要重新安裝。`:`Wi-Fi access stays off: the certificate file is unreadable or readable by other accounts. Run /boss gui lan reset in a pi session to make a new certificate; each phone installs it again.`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦的 Wi-Fi 憑證已經到期;請在 pi session 執行 /boss gui lan reset 並選擇更新,每支手機再安裝新的憑證。`:`This computer's Wi-Fi certificate has ended; run /boss gui lan reset in a pi session and choose renew, and each phone installs the new one.`),te=e=>`This computer's Wi-Fi certificate ends on ${e?.date}. Run /boss gui lan reset in a pi session and choose renew; each phone installs the new one.`,O=e=>`這台電腦的 Wi-Fi 憑證將於 ${e?.date} 到期。請在 pi session 執行 /boss gui lan reset 並選擇更新;每支手機要安裝新的憑證。`,k=((t,n={})=>(n.locale??e())===`zh-TW`?O(t):te(t)),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取維持關閉:這台電腦的 Wi-Fi 憑證不見了。請在 pi session 執行 /boss gui lan 產生新的(每支手機要重新安裝)。`:`Wi-Fi access stays off: this computer's Wi-Fi certificate is missing. Run /boss gui lan in a pi session to make a new one (each phone installs it again).`),ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`憑證頁面的 QR code`:`QR code for the certificate page`),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`如果手機打不開,請改用位址。`:`If the phone cannot open it, use the address.`),ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`全部拒絕`:`Deny all`),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`Android,安裝之後:「加密和憑證」>「信任的憑證」>「使用者」裡只能有一張 Straw Boss LAN CA,沒有你沒加過的憑證,且 SHA-256 要相符。否則立刻移除。`:`Android, after installing: Encryption & credentials, Trusted credentials, User must show exactly one Straw Boss LAN CA and nothing you did not add, with this SHA-256. Otherwise remove them now.`),oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`iPhone,按「安裝」之前:「已下載描述檔」> 描述檔。「包含」只能寫「憑證」;「更多詳細資訊」裡只能有一張憑證、沒有其他項目,且 SHA-256 要相符。否則點「移除」。`:`iPhone, before Install: Profile Downloaded, the profile. Contains must say only Certificate; More Details must list exactly one certificate and nothing else, with this SHA-256. Otherwise tap Remove.`),se=((t={},n={})=>(n.locale??e())===`zh-TW`?`如果手機是透過 Wi-Fi 下載憑證,信任之前請在手機上核對指紋。SHA-256 開頭是:`:`If the phone downloaded it over Wi-Fi, check the fingerprint on the phone before trusting it. SHA-256 starts:`),ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`Mac:「鑰匙圈存取」搜尋 Straw Boss:只能有一張 Straw Boss LAN CA,「詳細資訊」裡的 SHA-256 要相符。`:`Mac: Keychain Access, search Straw Boss: exactly one Straw Boss LAN CA, with this SHA-256 in Details.`),j=e=>`Windows: exactly one Security Warning appears, and its SHA-1 thumbprint is ${e?.sha1}. If a second warning appears, choose No, then remove the first in certmgr.msc.`,M=e=>`Windows:只會出現一個「安全性警告」,其中的 SHA-1 指紋是 ${e?.sha1}。如果出現第二個警告,請選「否」,再到 certmgr.msc 移除第一張。`,le=((t,n={})=>(n.locale??e())===`zh-TW`?M(t):j(t)),N=((t={},n={})=>(n.locale??e())===`zh-TW`?`macOS 防火牆封鎖了所有連入連線,手機連不上:請到「系統設定」、「網路」、「防火牆」、「選項」,關閉「封鎖所有連入連線」。`:`The macOS firewall blocks all incoming connections, so a phone cannot connect: turn off "Block all incoming connections" in System Settings, Network, Firewall, Options.`),ue=((t={},n={})=>(n.locale??e())===`zh-TW`?`macOS 防火牆封鎖了 node:請到「系統設定」、「網路」、「防火牆」、「選項」允許它。`:`The macOS firewall blocks node: allow it in System Settings, Network, Firewall, Options.`),P=e=>`Firewall: ${e?.text}`,F=e=>`防火牆:${e?.text}`,de=((t,n={})=>(n.locale??e())===`zh-TW`?F(t):P(t)),I=e=>`In an elevated PowerShell: ${e?.command}`,fe=e=>`在系統管理員身分的 PowerShell 執行:${e?.command}`,L=((t,n={})=>(n.locale??e())===`zh-TW`?fe(t):I(t)),pe=e=>`Cannot go in a command (the name holds a control character, an invisible or direction-changing character, or a wildcard): ${e?.left}. Disable them in wf.msc (Inbound Rules, the rule, Disable Rule).`,R=e=>`下列規則無法用指令處理(名稱含有控制字元、不可見或改變方向的字元,或萬用字元):${e?.left}。請在 wf.msc(輸入規則、該規則、停用規則)停用。`,me=((t,n={})=>(n.locale??e())===`zh-TW`?R(t):pe(t)),z=e=>`Windows Firewall has rules that block node.exe (${e?.names}); they win over any allow rule.`,B=e=>`Windows 防火牆有規則封鎖 node.exe(${e?.names});封鎖規則的優先權高於任何允許規則。`,V=((t,n={})=>(n.locale??e())===`zh-TW`?B(t):z(t)),H=e=>`Windows Firewall has rules that block TCP port ${e?.port} (${e?.names}); they win over any allow rule.`,U=e=>`Windows 防火牆有規則封鎖 TCP 連接埠 ${e?.port}(${e?.names});封鎖規則的優先權高於任何允許規則。`,W=((t,n={})=>(n.locale??e())===`zh-TW`?U(t):H(t)),G=e=>`No Windows Firewall rule allows incoming connections to TCP port ${e?.port}, so a phone cannot connect. A port rule survives node upgrades, which a program rule does not. In an elevated PowerShell: ${e?.command}`,he=e=>`沒有任何 Windows 防火牆規則允許連入 TCP 連接埠 ${e?.port},手機連不上。連接埠規則在 node 升級後仍有效,程式規則則不會。在系統管理員身分的 PowerShell 執行:${e?.command}`,K=((t,n={})=>(n.locale??e())===`zh-TW`?he(t):G(t)),ge=e=>`Windows calls the network of ${e?.where} Public, which blocks incoming connections: Settings, Network & internet, Wi-Fi, the network, Network profile type, Private.`,_e=e=>`Windows 把 ${e?.where} 所在的網路視為「公用」,會封鎖連入連線:請到「設定」、「網路和網際網路」、「Wi-Fi」、該網路、「網路設定檔類型」,改成「私人」。`,ve=((t,n={})=>(n.locale??e())===`zh-TW`?_e(t):ge(t)),ye=e=>`Windows Firewall could not be read (${e?.why}). If a phone cannot connect, allow the port in an elevated PowerShell with ${e?.allow} and list rules that block node.exe with ${e?.list}; disable one by its InstanceID with Disable-NetFirewallRule -Name '<InstanceID>'.`,be=e=>`無法讀取 Windows 防火牆(${e?.why})。如果手機連不上,請在系統管理員身分的 PowerShell 用 ${e?.allow} 允許該連接埠,並用 ${e?.list} 列出封鎖 node.exe 的規則;用 InstanceID 以 Disable-NetFirewallRule -Name '<InstanceID>' 停用其中一條。`,xe=((t,n={})=>(n.locale??e())===`zh-TW`?be(t):ye(t)),Se=((t={},n={})=>(n.locale??e())===`zh-TW`?`建議在手機的個人熱點,或手機直接連到這台電腦的 Wi-Fi 上使用 Wi-Fi 存取,讓網路上沒有其他人。`:`We recommend using Wi-Fi access on your phone's hotspot, or on a Wi-Fi that connects the phone directly to this computer, so no one else is on the network.`),Ce=e=>`Port ${e?.from} was taken on this computer; Wi-Fi access moved to ${e?.to}. An app installed from the old address needs adding again.`,we=e=>`這台電腦的連接埠 ${e?.from} 被佔用,Wi-Fi 存取已改到 ${e?.to}。從舊位址安裝的 app 要重新加入。`,Te=((t,n={})=>(n.locale??e())===`zh-TW`?we(t):Ce(t)),Ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦目前沒有 Wi-Fi 存取可以使用的私人網路位址(VPN 通道不提供服務)。`:`This computer has no private network address Wi-Fi access can serve now (a VPN tunnel is not served).`),De=((t={},n={})=>(n.locale??e())===`zh-TW`?`如果手機警告「此連線不是私人連線」,不要繼續:先完成第一步安裝憑證。`:`If the phone warns that the connection is not private, do not go on: install the certificate first (step 1).`),Oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取還沒開啟。要開啟,讓和這台電腦在同一個網路的手機可以開這個頁面嗎?它只回應這個網路私人位址上的裝置;每支手機要先安裝一次這台電腦的憑證,每個新裝置都要在這裡允許。`:`Wi-Fi access is off. Turn it on so a phone on the same network as this computer can open this page? It answers only devices on this network's private addresses; each phone installs this computer's certificate once, and you allow each new device here.`),ke=e=>`Paired over Wi-Fi: ${e?.label} (${e?.peer})`,Ae=e=>`已透過 Wi-Fi 配對:${e?.label}(${e?.peer})`,je=((t,n={})=>(n.locale??e())===`zh-TW`?Ae(t):ke(t)),Me=((t={},n={})=>(n.locale??e())===`zh-TW`?`不只一個裝置用了配對碼:其中最多只有一個是你的手機。`:`More than one device used a code: only one of them can be your phone.`),Ne=e=>`Port ${e?.port} is taken on ${e?.address} by another program; Wi-Fi access does not serve that address. Run /boss gui lan in a pi session to move to a free port (installed apps then need to be added again).`,Pe=e=>`連接埠 ${e?.port} 在 ${e?.address} 上被其他程式佔用,Wi-Fi 存取不會服務那個位址。請在 pi session 執行 /boss gui lan 換到空的連接埠(已安裝的 app 之後要重新加入)。`,Fe=((t,n={})=>(n.locale??e())===`zh-TW`?Pe(t):Ne(t)),Ie=e=>`A Wi-Fi pairing code was used from ${e?.peer} and not allowed. If that was not your phone, someone saw the code.`,Le=e=>`有人從 ${e?.peer} 使用了 Wi-Fi 配對碼,但沒有被允許。如果那不是你的手機,代表有人看到了配對碼。`,Re=((t,n={})=>(n.locale??e())===`zh-TW`?Le(t):Ie(t)),ze=e=>`A Wi-Fi pairing code was used from ${e?.peer} and not allowed, ${e?.count} times (last at ${e?.time}). If that was not your phone, someone saw the code.`,Be=e=>`有人從 ${e?.peer} 使用了 Wi-Fi 配對碼但沒有被允許,共 ${e?.count} 次(最近一次 ${e?.time})。如果那不是你的手機,代表有人看到了配對碼。`,Ve=((t,n={})=>(n.locale??e())===`zh-TW`?Be(t):ze(t)),He=e=>`This computer is now called ${e?.name}; the certificate is for ${e?.caName}.local. Run /boss gui lan reset in a pi session to make a new certificate (each phone installs it again).`,Ue=e=>`這台電腦現在叫 ${e?.name},但憑證是給 ${e?.caName}.local 的。請在 pi session 執行 /boss gui lan reset 產生新的憑證(每支手機要重新安裝)。`,We=((t,n={})=>(n.locale??e())===`zh-TW`?Ue(t):He(t)),Ge=e=>`Another device on this network answers to ${e?.caName}.local, so macOS renamed this computer ${e?.name}. Use the address instead of the name below, and set the name back in System Settings, General, Sharing, Local hostname.`,Ke=e=>`這個網路上另一台裝置也叫 ${e?.caName}.local,所以 macOS 把這台電腦改名為 ${e?.name}。請改用下方的位址,不用名稱,並到「系統設定」>「一般」>「共享」>「本機主機名稱」把名稱改回來。`,qe=((t,n={})=>(n.locale??e())===`zh-TW`?Ke(t):Ge(t)),Je=e=>`Risk: anyone who copies this certificate's key from this computer (a backup, a program running as you, an agent you run) can pose to your phones, and to any computer that installed it, as ${e?.name}.local and as any private-network address, such as your router's or NAS's 192.168.x.x page, on any Wi-Fi they join, until you remove the certificate from each of them.`,Ye=e=>`風險:任何人只要從這台電腦複製走這張憑證的金鑰(例如備份檔、以你身分執行的程式、你執行的 agent),就能在你的手機和裝過它的電腦連上的任何 Wi-Fi 上,冒充 ${e?.name}.local 和任何私人網路位址(例如路由器或 NAS 的 192.168.x.x 管理頁),直到你從每台裝置移除這張憑證。`,Xe=((t,n={})=>(n.locale??e())===`zh-TW`?Ye(t):Je(t)),Ze=((t={},n={})=>(n.locale??e())===`zh-TW`?`詳細說明`:`Details`),Qe=((t={},n={})=>(n.locale??e())===`zh-TW`?`風險:任何人只要從這台電腦複製走這張憑證的金鑰(例如備份檔、以你身分執行的程式、你執行的 agent),就能在你的手機和裝過它的電腦連上的任何 Wi-Fi 上,冒充任何私人網路位址(例如路由器或 NAS 的 192.168.x.x 管理頁),直到你從每台裝置移除這張憑證。`:`Risk: anyone who copies this certificate's key from this computer (a backup, a program running as you, an agent you run) can pose to your phones, and to any computer that installed it, as any private-network address, such as your router's or NAS's 192.168.x.x page, on any Wi-Fi they join, until you remove the certificate from each of them.`),$e=((t={},n={})=>(n.locale??e())===`zh-TW`?`你的手機信任這台電腦的憑證。手機會不會限制它,目前還沒有驗證過,所以金鑰一旦被複製,就可能被用來向手機冒充任何網站。`:`This computer's certificate is trusted by your phones. Whether they limit it has not been verified, so a copy of its key could pose as any website to them.`),et=((t={},n={})=>(n.locale??e())===`zh-TW`?`或在你信任的網路上用手機掃描(最好是個人熱點或直連的 Wi-Fi)。`:`Or scan this on the phone, on a network you trust (a hotspot or direct Wi-Fi is best).`),tt=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取由預設 Herdr 的 sb server 提供。`:`Wi-Fi access is served by the default Herdr's sb server.`),nt=((t={},n={})=>(n.locale??e())===`zh-TW`?`在這裡下載憑證,再用 AirDrop 或快速分享傳到手機(除非手機要你接受來自不明傳送者的檔案,否則不必核對)。`:`Download the certificate here, then send it to the phone by AirDrop or Quick Share (no check needed unless the phone asked you to accept it from an unknown sender).`),rt=((t={},n={})=>(n.locale??e())===`zh-TW`?`Android 或 Windows 用:憑證(.crt)`:`For Android or Windows: the certificate (.crt)`),it=((t={},n={})=>(n.locale??e())===`zh-TW`?`iPhone 或 Mac 用:描述檔(.mobileconfig)`:`For iPhone or Mac: the profile (.mobileconfig)`),at=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示給已安裝的 app 用的配對碼`:`Show a code for the installed app`),ot=e=>`Wi-Fi access stays off: ${e?.why}`,st=e=>`Wi-Fi 存取維持關閉:${e?.why}`,ct=((t,n={})=>(n.locale??e())===`zh-TW`?st(t):ot(t)),lt=e=>`Wi-Fi access stays off: ${e?.message}. It is tried again when the server next starts.`,ut=e=>`Wi-Fi 存取維持關閉:${e?.message}。伺服器下次啟動時會再試一次。`,dt=((t,n={})=>(n.locale??e())===`zh-TW`?ut(t):lt(t)),ft=((t={},n={})=>(n.locale??e())===`zh-TW`?`第一步,每支手機只要做一次:把這台電腦的憑證給手機。`:`Step 1, once per phone: give it this computer's certificate.`),pt=((t={},n={})=>(n.locale??e())===`zh-TW`?`第二步:用手機掃描並點「配對」,再在這裡允許。配對碼只能用一次,十分鐘內有效。`:`Step 2: scan with the phone and tap Pair, then allow it here. The code works once, within ten minutes.`),mt=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉 Wi-Fi 存取`:`Turn off Wi-Fi access`),ht=((t={},n={})=>(n.locale??e())===`zh-TW`?`產生憑證並開啟 Wi-Fi 存取`:`Make the certificate and turn on Wi-Fi access`),gt=((t={},n={})=>(n.locale??e())===`zh-TW`?`開啟 Wi-Fi 存取`:`Turn on Wi-Fi access`),_t=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在開啟 Wi-Fi 存取…`:`Turning Wi-Fi access on…`),vt=((t={},n={})=>(n.locale??e())===`zh-TW`?`尚未驗證:你的手機會不會把這張憑證限制在這台電腦的名稱和私人位址,目前還沒有查證過。在查證之前,請當作金鑰一旦被複製,就可能被用來向你的手機冒充任何網站。可以的話,請改用 Tailscale。`:`Not verified yet: whether your phone limits this certificate to this computer's name and private addresses has not been checked. Until it has, assume that a copy of the key could pose as any website to your phone. Use Tailscale instead if you can.`),yt=e=>`Use the address ${e?.address} instead of the name`,bt=e=>`改用位址 ${e?.address},不用名稱`,xt=((t,n={})=>(n.locale??e())===`zh-TW`?bt(t):yt(t)),St=e=>`Use the name ${e?.name}.local instead of the address`,Ct=e=>`改用名稱 ${e?.name}.local,不用位址`,wt=((t,n={})=>(n.locale??e())===`zh-TW`?Ct(t):St(t)),Tt=e=>`Too many wrong codes from ${e?.peers} addresses: this code is void. Choose Show a code for the installed app to get a new one (the QR still works). Someone on this network is guessing codes. Pair on your phone's hotspot instead.`,Et=e=>`來自 ${e?.peers} 個位址的錯誤配對碼太多次:這組配對碼已作廢。請按「顯示給已安裝的 app 用的配對碼」取得新的(QR code 仍可使用)。這個網路上有人在猜配對碼,請改用手機的個人熱點配對。`,Dt=((t,n={})=>(n.locale??e())===`zh-TW`?Et(t):Tt(t)),Ot=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦的流量經過 VPN;如果手機連不上,請在 VPN 設定裡允許存取區域網路。`:`A VPN carries this computer's traffic; if the phone cannot connect, allow local network access in the VPN's settings.`),kt=e=>`${e?.count} wrong codes from ${e?.peer}`,At=e=>`來自 ${e?.peer} 的錯誤配對碼 ${e?.count} 次`,jt=((t,n={})=>(n.locale??e())===`zh-TW`?At(t):kt(t)),Mt=((t={},n={})=>(n.locale??e())===`zh-TW`?`新的配對碼`:`New code`),Nt=((t={},n={})=>(n.locale??e())===`zh-TW`?`或在已安裝的 app 裡輸入這 8 個字元(不需要連字號)。只能用一次,十分鐘內有效。`:`Or, in an installed app, type these 8 characters (no hyphen needed). It works once, within ten minutes.`),Pt=((t={},n={})=>(n.locale??e())===`zh-TW`?`配對 QR code`:`Pairing QR code`),Ft=((t={},n={})=>(n.locale??e())===`zh-TW`?`用以本機使用者身分登入 Tailscale 的手機掃描。只能用一次,十分鐘內有效。`:`Scan it with a phone signed in to Tailscale as this machine's user. It works once, within ten minutes.`),It=((t={},n={})=>(n.locale??e())===`zh-TW`?`同一個 Wi-Fi`:`Same Wi-Fi`),Lt=((t={},n={})=>(n.locale??e(),`Tailscale`)),Rt=((t={},n={})=>(n.locale??e())===`zh-TW`?`網路`:`Network`),zt=((t={},n={})=>(n.locale??e())===`zh-TW`?`配對手機`:`Pair a phone`),Bt=((t={},n={})=>(n.locale??e())===`zh-TW`?`遠端存取還沒開啟。要開啟,讓你 tailnet 上的手機可以開這個頁面嗎?只有用這台電腦的 Tailscale 帳號登入的裝置能配對,絕不使用 Funnel。`:`Remote access is off. Turn it on so a phone on your tailnet can open this page? Only devices signed in to Tailscale as this machine's user can pair; Funnel is never used.`),Vt=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉遠端存取不會刪除已配對的裝置;要結束某個裝置的配對,請按它的「解除配對」。`:`Turning remote access off keeps the paired devices. Unpair a device to end its pairing.`),Ht=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉遠端存取`:`Turn off remote access`),Ut=((t={},n={})=>(n.locale??e())===`zh-TW`?`開啟遠端存取`:`Turn on remote access`),Wt=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在開啟遠端存取…`:`Turning remote access on…`),Gt=((t={},n={})=>(n.locale??e())===`zh-TW`?`解除配對`:`Unpair`),Kt=((t={},n={})=>(n.locale??e())===`zh-TW`?`全部解除配對`:`Unpair all`),qt=e=>`Unpair ${e?.name}`,Jt=e=>`解除 ${e?.name} 的配對`,Yt=((t,n={})=>(n.locale??e())===`zh-TW`?Jt(t):qt(t)),Xt=e=>e?new Date(e).toLocaleString([],{hour12:!1,dateStyle:`medium`,timeStyle:`short`}):p();function Zt(e,n=()=>!0){let r=m(`div`,{class:`devices`}),i=m(`p`,{class:`chat-empty`,role:`status`}),a=(e,t,n)=>{let r=m(`button`,{type:`button`,class:`later`,"aria-label":t},e);return r.onclick=()=>(r.disabled=!0,void n().finally(()=>(r.disabled=!1,void s()))),r},o=(e,t={})=>h(e,t).then(e=>e.ok?i.replaceChildren():i.replaceChildren(e.body.reason??f({status:e.status})),()=>i.replaceChildren(u()));async function s(){let s=await h(`remote/devices`,{}).catch(()=>void 0),c=s?.ok?s.body.devices:[];if(!s?.ok)return void r.replaceChildren(m(`p`,{class:`chat-empty`},s?.body.reason??u()));let l=c.map(e=>m(`li`,null,m(`b`,null,e.label||t()),a(Gt(),Yt({name:e.label||t()}),()=>o(`remote/unpair`,{id:e.id})),m(`small`,null,e.net===`lan`?y({host:e.host??``}):b()),m(`small`,null,C({paired:Xt(e.paired),seen:Xt(e.seen)})))),d=s.body.on===!0&&n()&&a(Ht(),Ht(),()=>o(`remote/off`).then(e));r.replaceChildren(...g(m(`div`,{class:`devices-head`},m(`h4`,null,T()),c.length>1&&a(Kt(),Kt(),()=>o(`remote/unpair-all`))),c.length?m(`ul`,null,...l):m(`p`,{class:`chat-empty`},w()),i,d&&m(`div`,{class:`devices-acts`},d),d&&m(`small`,null,Vt())))}return s(),{box:r,refresh:s}}var q=`http://www.w3.org/2000/svg`;function J(e,t=Pt()){let n=e.length,r=document.createElementNS(q,`svg`),i=document.createElementNS(q,`rect`),a=document.createElementNS(q,`path`);r.setAttribute(`viewBox`,`-4 -4 ${n+8} ${n+8}`),r.setAttribute(`class`,`qr`),r.setAttribute(`role`,`img`),r.setAttribute(`aria-label`,t);for(let[e,t]of Object.entries({x:`-4`,y:`-4`,width:String(n+8),height:String(n+8),fill:`#fff`}))i.setAttribute(e,t);return a.setAttribute(`d`,e.flatMap((e,t)=>[...e].flatMap((e,n)=>e===`1`?[`M${n} ${t}h1v1h-1z`]:[])).join(``)),a.setAttribute(`fill`,`#06101e`),r.append(i,a),r}var Y=e=>Array.isArray(e)?e.map(String):[],X=e=>({name:typeof e.name==`string`?e.name:null,sha256:String(e.sha256??``),sha1:String(e.sha1??``),...typeof e.url==`string`?{url:e.url}:{},...Array.isArray(e.rows)?{rows:Y(e.rows)}:{},files:Y(e.files),ended:e.ended===!0}),Qt=n,Z=e=>Array.isArray(e)?e.map(e=>({text:String(e?.text??``),...typeof e?.code==`string`?{code:e.code}:{},...e?.params&&typeof e.params==`object`?{params:e.params}:{},...Array.isArray(e?.of)?{of:Z(e.of)}:{},...typeof e?.at==`number`?{at:e.at}:{}})):[],$t=e=>({on:e.on===!0,addresses:Array.isArray(e.addresses)?e.addresses.map(e=>({address:String(e?.address),...e?.interface?{interface:String(e.interface)}:{}})):[],pending:Qt(e.pending),notes:Array.isArray(e.noteList)?Z(e.noteList):typeof e.note==`string`?[{text:e.note}]:[],events:Array.isArray(e.eventList)?Z(e.eventList):Y(e.events).map(e=>({text:e}))});function Q(e){let n=t=>String(e.params?.[t]??``);switch(e.code){case`paired`:return je({label:n(`label`)||t(),peer:n(`peer`)});case`refused`:return Re({peer:n(`peer`)});case`wrong`:return jt({count:n(`count`),peer:n(`peer`)});case`void`:return Dt({peers:n(`peers`)});case`vpn`:return Ot();case`no_address`:return Ee();case`ca_ended`:return D();case`ca_ending`:return k({date:new Date(Number(n(`until`))).toLocaleDateString()});case`ca_corrupt`:return E();case`ca_missing`:return A();case`secondary`:return tt();case`renamed_n`:return qe({caName:n(`caName`),name:n(`name`)});case`renamed`:return We({caName:n(`caName`),name:n(`name`)});case`taken`:return Fe({port:n(`port`),address:n(`address`)});case`moved`:return Te({from:n(`from`),to:n(`to`)});case`fw_block_all`:return N();case`fw_block_node`:return ue();case`fw_win_block`:return[n(`what`)?V({names:n(`names`)}):W({port:n(`port`),names:n(`names`)}),n(`command`)?L({command:n(`command`)}):``,n(`left`)?me({left:n(`left`)}):``].filter(Boolean).join(` `);case`fw_win_noallow`:return K({port:n(`port`),command:n(`command`)});case`fw_win_public`:return ve({where:n(`where`)});case`fw_win_unknown`:return xe({why:n(`why`),allow:n(`allow`),list:n(`list`)});case`refused_n`:return Ve({peer:n(`peer`),count:n(`count`),time:new Date(e.at??0).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})});case`stays_off_error`:return dt({message:n(`message`)});case`fw_other`:return de({text:e.text});case`stays_off`:return e.of?ct({why:e.of.map(Q).join(` `)}):e.text;default:return e.text}}var en=new Set([`stays_off`,`stays_off_error`,`ca_corrupt`,`ca_missing`,`ca_ended`,`taken`,`no_address`,`fw_block_all`,`fw_block_node`,`fw_win_block`,`fw_win_noallow`,`fw_win_public`]),tn=e=>en.has(e.code??``);function nn(e){let t=new Map,n=new Map;for(let r of e)r.code===`refused`&&(t.set(String(r.params?.peer),(t.get(String(r.params?.peer))??0)+1),n.set(String(r.params?.peer),r));return e.flatMap(e=>e.code===`refused`?n.get(String(e.params?.peer))===e?t.get(String(e.params?.peer))>1?[{...e,code:`refused_n`,params:{...e.params,count:t.get(String(e.params?.peer))}}]:[e]:[]:[e])}var $=e=>String(e.body.reason??f({status:e.status}));function rn(e){let t=m(`div`,{class:`lan`}),n=m(`div`,{class:`lan-board`}),d=m(`div`,{class:`lan-main`}),f=m(`div`,{class:`lan-note`,role:`status`}),p=m(`ul`,{class:`lan-news`,role:`status`}),h=m(`p`,{class:`lan-no`,role:`status`});t.append(n,h,f,p,d);let _,v,y=0,b=0,x=!1,S,C={},w=``,T=``,E=(e,t)=>e!==T&&(T=e,f.replaceChildren(...e?e.split(`
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{a as t,i as n,n as r,t as i}from"./pairs-B51CKIwf.js";import{n as a,r as o,t as s}from"./lan_number_ask-DlHJl9jN.js";import{o as c,s as l}from"./asks-uzLqEs-h.js";import{Ft as u,K as d,Nt as f,Rt as p,_t as m,q as h,vt as g}from"./index-TakEXnkN.js";var ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在取得配對碼…`:`Asking for a pairing code…`),_=e=>`Wi-Fi · ${e?.host}`,v=e=>`Wi-Fi・${e?.host}`,y=((t,n={})=>(n.locale??e())===`zh-TW`?v(t):_(t)),b=((t={},n={})=>(n.locale??e(),`Tailscale`)),x=e=>`Paired ${e?.paired} · last used ${e?.seen}`,S=e=>`配對於 ${e?.paired}・最後使用 ${e?.seen}`,C=((t,n={})=>(n.locale??e())===`zh-TW`?S(t):x(t)),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`沒有已配對的裝置。`:`No device is paired.`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`已配對的裝置`:`Paired devices`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取維持關閉:憑證檔讀不出來,或其他帳號也讀得到。請在 pi session 執行 /boss gui lan reset 產生新的憑證,每支手機要重新安裝。`:`Wi-Fi access stays off: the certificate file is unreadable or readable by other accounts. Run /boss gui lan reset in a pi session to make a new certificate; each phone installs it again.`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦的 Wi-Fi 憑證已經到期;請在 pi session 執行 /boss gui lan reset 並選擇更新,每支手機再安裝新的憑證。`:`This computer's Wi-Fi certificate has ended; run /boss gui lan reset in a pi session and choose renew, and each phone installs the new one.`),te=e=>`This computer's Wi-Fi certificate ends on ${e?.date}. Run /boss gui lan reset in a pi session and choose renew; each phone installs the new one.`,O=e=>`這台電腦的 Wi-Fi 憑證將於 ${e?.date} 到期。請在 pi session 執行 /boss gui lan reset 並選擇更新;每支手機要安裝新的憑證。`,k=((t,n={})=>(n.locale??e())===`zh-TW`?O(t):te(t)),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取維持關閉:這台電腦的 Wi-Fi 憑證不見了。請在 pi session 執行 /boss gui lan 產生新的(每支手機要重新安裝)。`:`Wi-Fi access stays off: this computer's Wi-Fi certificate is missing. Run /boss gui lan in a pi session to make a new one (each phone installs it again).`),ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`憑證頁面的 QR code`:`QR code for the certificate page`),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`如果手機打不開,請改用位址。`:`If the phone cannot open it, use the address.`),ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`全部拒絕`:`Deny all`),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`Android,安裝之後:「加密和憑證」>「信任的憑證」>「使用者」裡只能有一張 Straw Boss LAN CA,沒有你沒加過的憑證,且 SHA-256 要相符。否則立刻移除。`:`Android, after installing: Encryption & credentials, Trusted credentials, User must show exactly one Straw Boss LAN CA and nothing you did not add, with this SHA-256. Otherwise remove them now.`),oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`iPhone,按「安裝」之前:「已下載描述檔」> 描述檔。「包含」只能寫「憑證」;「更多詳細資訊」裡只能有一張憑證、沒有其他項目,且 SHA-256 要相符。否則點「移除」。`:`iPhone, before Install: Profile Downloaded, the profile. Contains must say only Certificate; More Details must list exactly one certificate and nothing else, with this SHA-256. Otherwise tap Remove.`),se=((t={},n={})=>(n.locale??e())===`zh-TW`?`如果手機是透過 Wi-Fi 下載憑證,信任之前請在手機上核對指紋。SHA-256 開頭是:`:`If the phone downloaded it over Wi-Fi, check the fingerprint on the phone before trusting it. SHA-256 starts:`),ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`Mac:「鑰匙圈存取」搜尋 Straw Boss:只能有一張 Straw Boss LAN CA,「詳細資訊」裡的 SHA-256 要相符。`:`Mac: Keychain Access, search Straw Boss: exactly one Straw Boss LAN CA, with this SHA-256 in Details.`),j=e=>`Windows: exactly one Security Warning appears, and its SHA-1 thumbprint is ${e?.sha1}. If a second warning appears, choose No, then remove the first in certmgr.msc.`,M=e=>`Windows:只會出現一個「安全性警告」,其中的 SHA-1 指紋是 ${e?.sha1}。如果出現第二個警告,請選「否」,再到 certmgr.msc 移除第一張。`,le=((t,n={})=>(n.locale??e())===`zh-TW`?M(t):j(t)),N=((t={},n={})=>(n.locale??e())===`zh-TW`?`macOS 防火牆封鎖了所有連入連線,手機連不上:請到「系統設定」、「網路」、「防火牆」、「選項」,關閉「封鎖所有連入連線」。`:`The macOS firewall blocks all incoming connections, so a phone cannot connect: turn off "Block all incoming connections" in System Settings, Network, Firewall, Options.`),ue=((t={},n={})=>(n.locale??e())===`zh-TW`?`macOS 防火牆封鎖了 node:請到「系統設定」、「網路」、「防火牆」、「選項」允許它。`:`The macOS firewall blocks node: allow it in System Settings, Network, Firewall, Options.`),P=e=>`Firewall: ${e?.text}`,F=e=>`防火牆:${e?.text}`,de=((t,n={})=>(n.locale??e())===`zh-TW`?F(t):P(t)),I=e=>`In an elevated PowerShell: ${e?.command}`,fe=e=>`在系統管理員身分的 PowerShell 執行:${e?.command}`,L=((t,n={})=>(n.locale??e())===`zh-TW`?fe(t):I(t)),pe=e=>`Cannot go in a command (the name holds a control character, an invisible or direction-changing character, or a wildcard): ${e?.left}. Disable them in wf.msc (Inbound Rules, the rule, Disable Rule).`,R=e=>`下列規則無法用指令處理(名稱含有控制字元、不可見或改變方向的字元,或萬用字元):${e?.left}。請在 wf.msc(輸入規則、該規則、停用規則)停用。`,me=((t,n={})=>(n.locale??e())===`zh-TW`?R(t):pe(t)),z=e=>`Windows Firewall has rules that block node.exe (${e?.names}); they win over any allow rule.`,B=e=>`Windows 防火牆有規則封鎖 node.exe(${e?.names});封鎖規則的優先權高於任何允許規則。`,V=((t,n={})=>(n.locale??e())===`zh-TW`?B(t):z(t)),H=e=>`Windows Firewall has rules that block TCP port ${e?.port} (${e?.names}); they win over any allow rule.`,U=e=>`Windows 防火牆有規則封鎖 TCP 連接埠 ${e?.port}(${e?.names});封鎖規則的優先權高於任何允許規則。`,W=((t,n={})=>(n.locale??e())===`zh-TW`?U(t):H(t)),G=e=>`No Windows Firewall rule allows incoming connections to TCP port ${e?.port}, so a phone cannot connect. A port rule survives node upgrades, which a program rule does not. In an elevated PowerShell: ${e?.command}`,he=e=>`沒有任何 Windows 防火牆規則允許連入 TCP 連接埠 ${e?.port},手機連不上。連接埠規則在 node 升級後仍有效,程式規則則不會。在系統管理員身分的 PowerShell 執行:${e?.command}`,K=((t,n={})=>(n.locale??e())===`zh-TW`?he(t):G(t)),ge=e=>`Windows calls the network of ${e?.where} Public, which blocks incoming connections: Settings, Network & internet, Wi-Fi, the network, Network profile type, Private.`,_e=e=>`Windows 把 ${e?.where} 所在的網路視為「公用」,會封鎖連入連線:請到「設定」、「網路和網際網路」、「Wi-Fi」、該網路、「網路設定檔類型」,改成「私人」。`,ve=((t,n={})=>(n.locale??e())===`zh-TW`?_e(t):ge(t)),ye=e=>`Windows Firewall could not be read (${e?.why}). If a phone cannot connect, allow the port in an elevated PowerShell with ${e?.allow} and list rules that block node.exe with ${e?.list}; disable one by its InstanceID with Disable-NetFirewallRule -Name '<InstanceID>'.`,be=e=>`無法讀取 Windows 防火牆(${e?.why})。如果手機連不上,請在系統管理員身分的 PowerShell 用 ${e?.allow} 允許該連接埠,並用 ${e?.list} 列出封鎖 node.exe 的規則;用 InstanceID 以 Disable-NetFirewallRule -Name '<InstanceID>' 停用其中一條。`,xe=((t,n={})=>(n.locale??e())===`zh-TW`?be(t):ye(t)),Se=((t={},n={})=>(n.locale??e())===`zh-TW`?`建議在手機的個人熱點,或手機直接連到這台電腦的 Wi-Fi 上使用 Wi-Fi 存取,讓網路上沒有其他人。`:`We recommend using Wi-Fi access on your phone's hotspot, or on a Wi-Fi that connects the phone directly to this computer, so no one else is on the network.`),Ce=e=>`Port ${e?.from} was taken on this computer; Wi-Fi access moved to ${e?.to}. An app installed from the old address needs adding again.`,we=e=>`這台電腦的連接埠 ${e?.from} 被佔用,Wi-Fi 存取已改到 ${e?.to}。從舊位址安裝的 app 要重新加入。`,Te=((t,n={})=>(n.locale??e())===`zh-TW`?we(t):Ce(t)),Ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦目前沒有 Wi-Fi 存取可以使用的私人網路位址(VPN 通道不提供服務)。`:`This computer has no private network address Wi-Fi access can serve now (a VPN tunnel is not served).`),De=((t={},n={})=>(n.locale??e())===`zh-TW`?`如果手機警告「此連線不是私人連線」,不要繼續:先完成第一步安裝憑證。`:`If the phone warns that the connection is not private, do not go on: install the certificate first (step 1).`),Oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取還沒開啟。要開啟,讓和這台電腦在同一個網路的手機可以開這個頁面嗎?它只回應這個網路私人位址上的裝置;每支手機要先安裝一次這台電腦的憑證,每個新裝置都要在這裡允許。`:`Wi-Fi access is off. Turn it on so a phone on the same network as this computer can open this page? It answers only devices on this network's private addresses; each phone installs this computer's certificate once, and you allow each new device here.`),ke=e=>`Paired over Wi-Fi: ${e?.label} (${e?.peer})`,Ae=e=>`已透過 Wi-Fi 配對:${e?.label}(${e?.peer})`,je=((t,n={})=>(n.locale??e())===`zh-TW`?Ae(t):ke(t)),Me=((t={},n={})=>(n.locale??e())===`zh-TW`?`不只一個裝置用了配對碼:其中最多只有一個是你的手機。`:`More than one device used a code: only one of them can be your phone.`),Ne=e=>`Port ${e?.port} is taken on ${e?.address} by another program; Wi-Fi access does not serve that address. Run /boss gui lan in a pi session to move to a free port (installed apps then need to be added again).`,Pe=e=>`連接埠 ${e?.port} 在 ${e?.address} 上被其他程式佔用,Wi-Fi 存取不會服務那個位址。請在 pi session 執行 /boss gui lan 換到空的連接埠(已安裝的 app 之後要重新加入)。`,Fe=((t,n={})=>(n.locale??e())===`zh-TW`?Pe(t):Ne(t)),Ie=e=>`A Wi-Fi pairing code was used from ${e?.peer} and not allowed. If that was not your phone, someone saw the code.`,Le=e=>`有人從 ${e?.peer} 使用了 Wi-Fi 配對碼,但沒有被允許。如果那不是你的手機,代表有人看到了配對碼。`,Re=((t,n={})=>(n.locale??e())===`zh-TW`?Le(t):Ie(t)),ze=e=>`A Wi-Fi pairing code was used from ${e?.peer} and not allowed, ${e?.count} times (last at ${e?.time}). If that was not your phone, someone saw the code.`,Be=e=>`有人從 ${e?.peer} 使用了 Wi-Fi 配對碼但沒有被允許,共 ${e?.count} 次(最近一次 ${e?.time})。如果那不是你的手機,代表有人看到了配對碼。`,Ve=((t,n={})=>(n.locale??e())===`zh-TW`?Be(t):ze(t)),He=e=>`This computer is now called ${e?.name}; the certificate is for ${e?.caName}.local. Run /boss gui lan reset in a pi session to make a new certificate (each phone installs it again).`,Ue=e=>`這台電腦現在叫 ${e?.name},但憑證是給 ${e?.caName}.local 的。請在 pi session 執行 /boss gui lan reset 產生新的憑證(每支手機要重新安裝)。`,We=((t,n={})=>(n.locale??e())===`zh-TW`?Ue(t):He(t)),Ge=e=>`Another device on this network answers to ${e?.caName}.local, so macOS renamed this computer ${e?.name}. Use the address instead of the name below, and set the name back in System Settings, General, Sharing, Local hostname.`,Ke=e=>`這個網路上另一台裝置也叫 ${e?.caName}.local,所以 macOS 把這台電腦改名為 ${e?.name}。請改用下方的位址,不用名稱,並到「系統設定」>「一般」>「共享」>「本機主機名稱」把名稱改回來。`,qe=((t,n={})=>(n.locale??e())===`zh-TW`?Ke(t):Ge(t)),Je=e=>`Risk: anyone who copies this certificate's key from this computer (a backup, a program running as you, an agent you run) can pose to your phones, and to any computer that installed it, as ${e?.name}.local and as any private-network address, such as your router's or NAS's 192.168.x.x page, on any Wi-Fi they join, until you remove the certificate from each of them.`,Ye=e=>`風險:任何人只要從這台電腦複製走這張憑證的金鑰(例如備份檔、以你身分執行的程式、你執行的 agent),就能在你的手機和裝過它的電腦連上的任何 Wi-Fi 上,冒充 ${e?.name}.local 和任何私人網路位址(例如路由器或 NAS 的 192.168.x.x 管理頁),直到你從每台裝置移除這張憑證。`,Xe=((t,n={})=>(n.locale??e())===`zh-TW`?Ye(t):Je(t)),Ze=((t={},n={})=>(n.locale??e())===`zh-TW`?`詳細說明`:`Details`),Qe=((t={},n={})=>(n.locale??e())===`zh-TW`?`風險:任何人只要從這台電腦複製走這張憑證的金鑰(例如備份檔、以你身分執行的程式、你執行的 agent),就能在你的手機和裝過它的電腦連上的任何 Wi-Fi 上,冒充任何私人網路位址(例如路由器或 NAS 的 192.168.x.x 管理頁),直到你從每台裝置移除這張憑證。`:`Risk: anyone who copies this certificate's key from this computer (a backup, a program running as you, an agent you run) can pose to your phones, and to any computer that installed it, as any private-network address, such as your router's or NAS's 192.168.x.x page, on any Wi-Fi they join, until you remove the certificate from each of them.`),$e=((t={},n={})=>(n.locale??e())===`zh-TW`?`你的手機信任這台電腦的憑證。手機會不會限制它,目前還沒有驗證過,所以金鑰一旦被複製,就可能被用來向手機冒充任何網站。`:`This computer's certificate is trusted by your phones. Whether they limit it has not been verified, so a copy of its key could pose as any website to them.`),et=((t={},n={})=>(n.locale??e())===`zh-TW`?`或在你信任的網路上用手機掃描(最好是個人熱點或直連的 Wi-Fi)。`:`Or scan this on the phone, on a network you trust (a hotspot or direct Wi-Fi is best).`),tt=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取由預設 Herdr 的 sb server 提供。`:`Wi-Fi access is served by the default Herdr's sb server.`),nt=((t={},n={})=>(n.locale??e())===`zh-TW`?`在這裡下載憑證,再用 AirDrop 或快速分享傳到手機(除非手機要你接受來自不明傳送者的檔案,否則不必核對)。`:`Download the certificate here, then send it to the phone by AirDrop or Quick Share (no check needed unless the phone asked you to accept it from an unknown sender).`),rt=((t={},n={})=>(n.locale??e())===`zh-TW`?`Android 或 Windows 用:憑證(.crt)`:`For Android or Windows: the certificate (.crt)`),it=((t={},n={})=>(n.locale??e())===`zh-TW`?`iPhone 或 Mac 用:描述檔(.mobileconfig)`:`For iPhone or Mac: the profile (.mobileconfig)`),at=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示給已安裝的 app 用的配對碼`:`Show a code for the installed app`),ot=e=>`Wi-Fi access stays off: ${e?.why}`,st=e=>`Wi-Fi 存取維持關閉:${e?.why}`,ct=((t,n={})=>(n.locale??e())===`zh-TW`?st(t):ot(t)),lt=e=>`Wi-Fi access stays off: ${e?.message}. It is tried again when the server next starts.`,ut=e=>`Wi-Fi 存取維持關閉:${e?.message}。伺服器下次啟動時會再試一次。`,dt=((t,n={})=>(n.locale??e())===`zh-TW`?ut(t):lt(t)),ft=((t={},n={})=>(n.locale??e())===`zh-TW`?`第一步,每支手機只要做一次:把這台電腦的憑證給手機。`:`Step 1, once per phone: give it this computer's certificate.`),pt=((t={},n={})=>(n.locale??e())===`zh-TW`?`第二步:用手機掃描並點「配對」,再在這裡允許。配對碼只能用一次,十分鐘內有效。`:`Step 2: scan with the phone and tap Pair, then allow it here. The code works once, within ten minutes.`),mt=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉 Wi-Fi 存取`:`Turn off Wi-Fi access`),ht=((t={},n={})=>(n.locale??e())===`zh-TW`?`產生憑證並開啟 Wi-Fi 存取`:`Make the certificate and turn on Wi-Fi access`),gt=((t={},n={})=>(n.locale??e())===`zh-TW`?`開啟 Wi-Fi 存取`:`Turn on Wi-Fi access`),_t=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在開啟 Wi-Fi 存取…`:`Turning Wi-Fi access on…`),vt=((t={},n={})=>(n.locale??e())===`zh-TW`?`尚未驗證:你的手機會不會把這張憑證限制在這台電腦的名稱和私人位址,目前還沒有查證過。在查證之前,請當作金鑰一旦被複製,就可能被用來向你的手機冒充任何網站。可以的話,請改用 Tailscale。`:`Not verified yet: whether your phone limits this certificate to this computer's name and private addresses has not been checked. Until it has, assume that a copy of the key could pose as any website to your phone. Use Tailscale instead if you can.`),yt=e=>`Use the address ${e?.address} instead of the name`,bt=e=>`改用位址 ${e?.address},不用名稱`,xt=((t,n={})=>(n.locale??e())===`zh-TW`?bt(t):yt(t)),St=e=>`Use the name ${e?.name}.local instead of the address`,Ct=e=>`改用名稱 ${e?.name}.local,不用位址`,wt=((t,n={})=>(n.locale??e())===`zh-TW`?Ct(t):St(t)),Tt=e=>`Too many wrong codes from ${e?.peers} addresses: this code is void. Choose Show a code for the installed app to get a new one (the QR still works). Someone on this network is guessing codes. Pair on your phone's hotspot instead.`,Et=e=>`來自 ${e?.peers} 個位址的錯誤配對碼太多次:這組配對碼已作廢。請按「顯示給已安裝的 app 用的配對碼」取得新的(QR code 仍可使用)。這個網路上有人在猜配對碼,請改用手機的個人熱點配對。`,Dt=((t,n={})=>(n.locale??e())===`zh-TW`?Et(t):Tt(t)),Ot=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦的流量經過 VPN;如果手機連不上,請在 VPN 設定裡允許存取區域網路。`:`A VPN carries this computer's traffic; if the phone cannot connect, allow local network access in the VPN's settings.`),kt=e=>`${e?.count} wrong codes from ${e?.peer}`,At=e=>`來自 ${e?.peer} 的錯誤配對碼 ${e?.count} 次`,jt=((t,n={})=>(n.locale??e())===`zh-TW`?At(t):kt(t)),Mt=((t={},n={})=>(n.locale??e())===`zh-TW`?`新的配對碼`:`New code`),Nt=((t={},n={})=>(n.locale??e())===`zh-TW`?`或在已安裝的 app 裡輸入這 8 個字元(不需要連字號)。只能用一次,十分鐘內有效。`:`Or, in an installed app, type these 8 characters (no hyphen needed). It works once, within ten minutes.`),Pt=((t={},n={})=>(n.locale??e())===`zh-TW`?`配對 QR code`:`Pairing QR code`),Ft=((t={},n={})=>(n.locale??e())===`zh-TW`?`用以本機使用者身分登入 Tailscale 的手機掃描。只能用一次,十分鐘內有效。`:`Scan it with a phone signed in to Tailscale as this machine's user. It works once, within ten minutes.`),It=((t={},n={})=>(n.locale??e())===`zh-TW`?`同一個 Wi-Fi`:`Same Wi-Fi`),Lt=((t={},n={})=>(n.locale??e(),`Tailscale`)),Rt=((t={},n={})=>(n.locale??e())===`zh-TW`?`網路`:`Network`),zt=((t={},n={})=>(n.locale??e())===`zh-TW`?`配對手機`:`Pair a phone`),Bt=((t={},n={})=>(n.locale??e())===`zh-TW`?`遠端存取還沒開啟。要開啟,讓你 tailnet 上的手機可以開這個頁面嗎?只有用這台電腦的 Tailscale 帳號登入的裝置能配對,絕不使用 Funnel。`:`Remote access is off. Turn it on so a phone on your tailnet can open this page? Only devices signed in to Tailscale as this machine's user can pair; Funnel is never used.`),Vt=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉遠端存取不會刪除已配對的裝置;要結束某個裝置的配對,請按它的「解除配對」。`:`Turning remote access off keeps the paired devices. Unpair a device to end its pairing.`),Ht=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉遠端存取`:`Turn off remote access`),Ut=((t={},n={})=>(n.locale??e())===`zh-TW`?`開啟遠端存取`:`Turn on remote access`),Wt=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在開啟遠端存取…`:`Turning remote access on…`),Gt=((t={},n={})=>(n.locale??e())===`zh-TW`?`解除配對`:`Unpair`),Kt=((t={},n={})=>(n.locale??e())===`zh-TW`?`全部解除配對`:`Unpair all`),qt=e=>`Unpair ${e?.name}`,Jt=e=>`解除 ${e?.name} 的配對`,Yt=((t,n={})=>(n.locale??e())===`zh-TW`?Jt(t):qt(t)),Xt=e=>e?new Date(e).toLocaleString([],{hour12:!1,dateStyle:`medium`,timeStyle:`short`}):p();function Zt(e,n=()=>!0){let r=m(`div`,{class:`devices`}),i=m(`p`,{class:`chat-empty`,role:`status`}),a=(e,t,n)=>{let r=m(`button`,{type:`button`,class:`later`,"aria-label":t},e);return r.onclick=()=>(r.disabled=!0,void n().finally(()=>(r.disabled=!1,void s()))),r},o=(e,t={})=>h(e,t).then(e=>e.ok?i.replaceChildren():i.replaceChildren(e.body.reason??f({status:e.status})),()=>i.replaceChildren(u()));async function s(){let s=await h(`remote/devices`,{}).catch(()=>void 0),c=s?.ok?s.body.devices:[];if(!s?.ok)return void r.replaceChildren(m(`p`,{class:`chat-empty`},s?.body.reason??u()));let l=c.map(e=>m(`li`,null,m(`b`,null,e.label||t()),a(Gt(),Yt({name:e.label||t()}),()=>o(`remote/unpair`,{id:e.id})),m(`small`,null,e.net===`lan`?y({host:e.host??``}):b()),m(`small`,null,C({paired:Xt(e.paired),seen:Xt(e.seen)})))),d=s.body.on===!0&&n()&&a(Ht(),Ht(),()=>o(`remote/off`).then(e));r.replaceChildren(...g(m(`div`,{class:`devices-head`},m(`h4`,null,T()),c.length>1&&a(Kt(),Kt(),()=>o(`remote/unpair-all`))),c.length?m(`ul`,null,...l):m(`p`,{class:`chat-empty`},w()),i,d&&m(`div`,{class:`devices-acts`},d),d&&m(`small`,null,Vt())))}return s(),{box:r,refresh:s}}var q=`http://www.w3.org/2000/svg`;function J(e,t=Pt()){let n=e.length,r=document.createElementNS(q,`svg`),i=document.createElementNS(q,`rect`),a=document.createElementNS(q,`path`);r.setAttribute(`viewBox`,`-4 -4 ${n+8} ${n+8}`),r.setAttribute(`class`,`qr`),r.setAttribute(`role`,`img`),r.setAttribute(`aria-label`,t);for(let[e,t]of Object.entries({x:`-4`,y:`-4`,width:String(n+8),height:String(n+8),fill:`#fff`}))i.setAttribute(e,t);return a.setAttribute(`d`,e.flatMap((e,t)=>[...e].flatMap((e,n)=>e===`1`?[`M${n} ${t}h1v1h-1z`]:[])).join(``)),a.setAttribute(`fill`,`#06101e`),r.append(i,a),r}var Y=e=>Array.isArray(e)?e.map(String):[],X=e=>({name:typeof e.name==`string`?e.name:null,sha256:String(e.sha256??``),sha1:String(e.sha1??``),...typeof e.url==`string`?{url:e.url}:{},...Array.isArray(e.rows)?{rows:Y(e.rows)}:{},files:Y(e.files),ended:e.ended===!0}),Qt=n,Z=e=>Array.isArray(e)?e.map(e=>({text:String(e?.text??``),...typeof e?.code==`string`?{code:e.code}:{},...e?.params&&typeof e.params==`object`?{params:e.params}:{},...Array.isArray(e?.of)?{of:Z(e.of)}:{},...typeof e?.at==`number`?{at:e.at}:{}})):[],$t=e=>({on:e.on===!0,addresses:Array.isArray(e.addresses)?e.addresses.map(e=>({address:String(e?.address),...e?.interface?{interface:String(e.interface)}:{}})):[],pending:Qt(e.pending),notes:Array.isArray(e.noteList)?Z(e.noteList):typeof e.note==`string`?[{text:e.note}]:[],events:Array.isArray(e.eventList)?Z(e.eventList):Y(e.events).map(e=>({text:e}))});function Q(e){let n=t=>String(e.params?.[t]??``);switch(e.code){case`paired`:return je({label:n(`label`)||t(),peer:n(`peer`)});case`refused`:return Re({peer:n(`peer`)});case`wrong`:return jt({count:n(`count`),peer:n(`peer`)});case`void`:return Dt({peers:n(`peers`)});case`vpn`:return Ot();case`no_address`:return Ee();case`ca_ended`:return D();case`ca_ending`:return k({date:new Date(Number(n(`until`))).toLocaleDateString()});case`ca_corrupt`:return E();case`ca_missing`:return A();case`secondary`:return tt();case`renamed_n`:return qe({caName:n(`caName`),name:n(`name`)});case`renamed`:return We({caName:n(`caName`),name:n(`name`)});case`taken`:return Fe({port:n(`port`),address:n(`address`)});case`moved`:return Te({from:n(`from`),to:n(`to`)});case`fw_block_all`:return N();case`fw_block_node`:return ue();case`fw_win_block`:return[n(`what`)?V({names:n(`names`)}):W({port:n(`port`),names:n(`names`)}),n(`command`)?L({command:n(`command`)}):``,n(`left`)?me({left:n(`left`)}):``].filter(Boolean).join(` `);case`fw_win_noallow`:return K({port:n(`port`),command:n(`command`)});case`fw_win_public`:return ve({where:n(`where`)});case`fw_win_unknown`:return xe({why:n(`why`),allow:n(`allow`),list:n(`list`)});case`refused_n`:return Ve({peer:n(`peer`),count:n(`count`),time:new Date(e.at??0).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})});case`stays_off_error`:return dt({message:n(`message`)});case`fw_other`:return de({text:e.text});case`stays_off`:return e.of?ct({why:e.of.map(Q).join(` `)}):e.text;default:return e.text}}var en=new Set([`stays_off`,`stays_off_error`,`ca_corrupt`,`ca_missing`,`ca_ended`,`taken`,`no_address`,`fw_block_all`,`fw_block_node`,`fw_win_block`,`fw_win_noallow`,`fw_win_public`]),tn=e=>en.has(e.code??``);function nn(e){let t=new Map,n=new Map;for(let r of e)r.code===`refused`&&(t.set(String(r.params?.peer),(t.get(String(r.params?.peer))??0)+1),n.set(String(r.params?.peer),r));return e.flatMap(e=>e.code===`refused`?n.get(String(e.params?.peer))===e?t.get(String(e.params?.peer))>1?[{...e,code:`refused_n`,params:{...e.params,count:t.get(String(e.params?.peer))}}]:[e]:[]:[e])}var $=e=>String(e.body.reason??f({status:e.status}));function rn(e){let t=m(`div`,{class:`lan`}),n=m(`div`,{class:`lan-board`}),d=m(`div`,{class:`lan-main`}),f=m(`div`,{class:`lan-note`,role:`status`}),p=m(`ul`,{class:`lan-news`,role:`status`}),h=m(`p`,{class:`lan-no`,role:`status`});t.append(n,h,f,p,d);let _,v,y=0,b=0,x=!1,S,C={},w=``,T=``,E=(e,t)=>e!==T&&(T=e,f.replaceChildren(...e?e.split(`
|
|
2
2
|
`).map((e,n)=>m(`p`,{class:(t??[])[n]??!0?`lan-no`:`lan-info`},e)):[])),te=m(`ul`,{class:`lan-rows`}),O=m(`p`,null,Me()),k=m(`p`,{class:`lan-no`,role:`status`}),A=m(`input`,{type:`text`,inputmode:`numeric`,pattern:`[0-9]{4}`,maxlength:`4`,autocomplete:`off`,spellcheck:`false`,class:`lan-number`,"aria-label":s(),placeholder:`0000`}),j=m(`button`,{type:`button`,class:`go`},o()),M=m(`button`,{type:`button`,class:`later`},ie()),N=!1,ue=c((t,n)=>e.post(t,n)),P=t=>N?Promise.resolve():(N=j.disabled=M.disabled=!0,t(ue).then(t=>{let n=l(t);return k.replaceChildren(n.answer),h.replaceChildren(n.verdict),t.ok&&(A.value=``),e.changed(),K()},()=>k.replaceChildren(u())).finally(()=>N=j.disabled=M.disabled=!1)),F=()=>/^\d{4}$/.test(A.value)&&void P(e=>e.approve(A.value));A.addEventListener(`input`,()=>A.value=A.value.replace(/\D/g,``).slice(0,4)),A.addEventListener(`keydown`,e=>e.key===`Enter`&&F()),j.onclick=F,M.onclick=()=>void P(e=>e.denyAll());let de=m(`div`,{class:`lan-ask`},m(`label`,null,s()),m(`div`,{class:`lan-ask-row`},A,j,M),k),I=new Map;function fe(e){n.hidden=e.length===0;let t=new Set(e.map(e=>e.id));for(let[e,n]of I)t.has(e)||(n.li.remove(),I.delete(e));for(let t of e){let e=r(t),n=I.get(t.id);if(n){n.text!==e&&(n.span.replaceChildren(e),n.text=e);continue}let o=m(`button`,{type:`button`,class:`later`,"aria-label":`${a()}: ${i(t)}`},a()),s=m(`span`,null,e),c=m(`li`,null,s,o);o.onclick=()=>void P(e=>e.deny(t.id)),te.append(c),I.set(t.id,{li:c,span:s,text:e})}O.hidden=e.length<2,e.length?h.replaceChildren():k.replaceChildren()}n.append(O,te,de);let L=new Map;function pe(e){let t=nn(e),n=t.map(e=>`${e.at??``}|${e.code??``}|${e.text}`);for(let[e,t]of L)n.includes(e)||(t.remove(),L.delete(e));t.forEach((e,t)=>{if(L.has(n[t]))return;let r=m(`li`,null,Q(e));p.append(r),L.set(n[t],r)})}let R=e=>e?Xe({name:e}):Qe();async function me(t){let n=await e.post(`lan/ca`,{}).catch(()=>void 0);if(t!==y)return;let r=n?.status===409&&n.body.error===`no_ca`;if(!n?.ok&&!r)return void(d.replaceChildren(m(`p`,null,n?$(n):u())),v=void 0);let i=n.ok?X(n.body).name:typeof n.body.name==`string`?n.body.name:null,a=m(`button`,{type:`button`,class:`go lan-on`},n.ok?gt():ht()),o=m(`p`,{class:`lan-no`,role:`status`});n.ok&&X(n.body).ended&&o.append(D()),a.onclick=()=>(a.disabled=!0,o.replaceChildren(_t()),void e.post(`lan/on`,{accept_risk:!0}).then(e=>e.ok?K():(o.replaceChildren(e.body.error===`lan_ca_ended`?D():$(e)),void(a.disabled=!1)),()=>(o.replaceChildren(u()),void(a.disabled=!1)))),d.replaceChildren(m(`p`,null,Oe()),m(`p`,null,R(i)),m(`p`,{class:`lan-risk`},vt()),m(`p`,null,Se()),a,o)}let z=m(`div`,{class:`lan-pair`}),B=`name`,V=-1,H=!1,U=()=>[...S?.name&&!H?[``]:[],...(C.addresses??[]).map(e=>e.address)];async function W(t,n,r){z.replaceChildren(m(`p`,{class:`chat-empty`},ee()));let i=await e.post(`lan/pair`,{surface:e.surface,form:n,...r?{address:r}:{}}).catch(()=>void 0);if(t!==y)return;if(!i?.ok)return void z.replaceChildren(m(`p`,null,i?$(i):u()),G());let a=i.body,o=a.rows,s=a.code;n===`name`&&(H=a.form===`address`),n!==`typed`&&(B=a.form===`address`?`address`:`name`,V=B===`name`?U().indexOf(``):U().indexOf(String(a.host)));let c=U(),l=c.length>1?c[(V+1)%c.length]:void 0,d=l===void 0?void 0:m(`button`,{type:`button`,class:`later`},l?xt({address:l}):wt({name:S?.name??``}));d&&(d.onclick=()=>void W(y,l?`address`:`name`,l||void 0));let f=m(`button`,{type:`button`,class:`later`},at());f.onclick=()=>void W(y,`typed`);let p=Array.isArray(o)?J(o.map(String)):void 0;z.replaceChildren(...g(m(`p`,null,pt()),p,m(`p`,null,m(`code`,null,`${a.host}:${a.port}`)),typeof s==`string`&&m(`p`,null,Nt(),m(`br`,null),m(`code`,{class:`pair-code`},s),m(`br`,null),m(`small`,null,String(a.entry??``))),m(`p`,{class:`lan-hint`},De()),d&&B===`name`&&m(`p`,{class:`lan-hint`},re()),m(`div`,{class:`devices-acts`},G(),f,d)))}let G=()=>{let e=m(`button`,{type:`button`,class:`later`},Mt());return e.onclick=()=>void W(y,B,B===`address`?U()[V]:void 0),e};async function he(t){let n=await e.post(`lan/ca`,{}).catch(()=>void 0);if(t!==y)return;if(!n?.ok)return void d.replaceChildren(m(`p`,null,n?$(n):u()));S=X(n.body),H=!1;let r=m(`button`,{type:`button`,class:`later`},mt());r.onclick=()=>(r.disabled=!0,void e.post(`lan/off`,{}).then(()=>K(),()=>E(u())));let i=[...S.files??[]].filter(e=>e.endsWith(`.crt`)||e.endsWith(`.mobileconfig`)).sort().reverse().map(e=>m(`a`,{href:`api/lan/ca/${e}`,download:e,class:`go`},e.endsWith(`.crt`)?rt():it())),a=[oe(),ae(),ce(),le({sha1:S.sha1})];d.replaceChildren(m(`p`,{class:`lan-risk`},$e()),m(`details`,null,m(`summary`,null,Ze()),m(`p`,null,R(S.name)),m(`p`,{class:`lan-risk`},vt()),m(`p`,null,Se())),m(`h4`,null,ft()),m(`p`,null,nt()),m(`div`,{class:`devices-acts`},...i),...S.url&&S.rows?[m(`p`,null,et()),J(S.rows.map(String),ne()),m(`p`,null,m(`code`,null,S.url))]:[],m(`p`,null,se()),m(`p`,null,m(`code`,{class:`pair-code lan-fp`},S.sha256)),m(`ul`,{class:`lan-fps`},...a.map(e=>m(`li`,null,e))),m(`hr`,null),z,m(`div`,{class:`devices-acts`},r)),await W(t,`name`)}async function K(){if(!x)return;let t=b,n=await e.get(`lan/pending`).catch(()=>void 0);if(!x||t!==b)return;if(!n)return E(u());if(!n.ok)return E($(n));C=$t(n.body);let r=C.on===!0,i=v===r?y:++y,a=C.pending??[];fe(r?a:[]),E(r&&!(C.addresses??[]).length?Ee():(C.notes??[]).map(Q).join(`
|
|
3
3
|
`),(C.notes??[]).map(tn)),pe(r?C.events??[]:[]);let o=JSON.stringify([C.events,a.length]);o!==w&&(w=o,e.changed()),v!==r&&(v=r,r?he(i):me(i))}return{root:t,start(){_?.(),v=void 0,x=!0,b++,K(),_=e.every(()=>void K(),1e3)},end(){_?.(),_=void 0,x=!1,b++,y++}}}var an=()=>`tile-${[...crypto.getRandomValues(new Uint8Array(8))].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`;function on(e=`tailscale`){let t,n;return{id:`pair`,title:zt(),closed:()=>t?.end(),select:e=>n?.(e),body:()=>{let r=m(`div`,{class:`pair`}),i=m(`button`,{type:`button`,class:`later`},Mt()),a=m(`button`,{type:`button`,class:`pair-btn`},Ut()),o=(e=`remote/pair`,t=ee())=>{r.replaceChildren(m(`p`,{class:`chat-empty`},t)),h(e,{}).then(t=>{c.refresh();let n=t.body.rows,o=String(t.body.url??``),s=t.body.code;if(t.body.error===`remote_off`)return r.replaceChildren(m(`p`,null,Bt()),a);if(!t.ok||!Array.isArray(n))return r.replaceChildren(m(`p`,null,t.body.reason??f({status:t.status})),e===`remote/on`?a:i);r.replaceChildren(...g(J(n.map(String)),m(`p`,null,Ft()),m(`p`,null,m(`code`,null,new URL(o).host)),typeof s==`string`&&m(`p`,null,Nt(),m(`br`,null),m(`code`,{class:`pair-code`},s)),i))},()=>r.replaceChildren(m(`p`,null,u()),i))};a.onclick=()=>o(`remote/on`,Wt()),i.onclick=()=>o();let s=`tailscale`,c=Zt(()=>r.replaceChildren(m(`p`,null,Bt()),a),()=>s===`tailscale`);t=rn({get:d,post:h,surface:an(),changed:()=>void c.refresh(),every:(e,t)=>{let n=setInterval(e,t);return()=>clearInterval(n)}});let l=[`tailscale`,`lan`],p=l.map(e=>{let t=m(`button`,{type:`button`,role:`tab`,class:`later`,id:`pair-tab-${e}`,"aria-controls":`pair-panel-${e}`},e===`lan`?It():Lt());return t.onclick=()=>_(e),t.addEventListener(`keydown`,t=>{let n=t.key,r=n===`ArrowRight`||n===`ArrowLeft`?(l.indexOf(e)+(n===`ArrowRight`?1:l.length-1))%l.length:n===`Home`?0:n===`End`?l.length-1:-1;r<0||(t.preventDefault(),_(l[r]),p[r][1].focus())}),[e,t]});for(let[e,n]of[[`tailscale`,r],[`lan`,t.root]])for(let[t,r]of Object.entries({role:`tabpanel`,id:`pair-panel-${e}`,"aria-labelledby":`pair-tab-${e}`}))n.setAttribute(t,r);let _=(e,n=!1)=>{s=e;for(let[t,n]of p)n.setAttribute(`aria-selected`,String(t===e)),n.setAttribute(`tabindex`,t===e?`0`:`-1`),n.classList.toggle(`on`,t===e);r.hidden=e!==`tailscale`,t.root.hidden=e!==`lan`,e===`lan`?t.start():(t.end(),n||o()),c.refresh()};return n=e=>e!==s&&_(e),_(e,!0),e===`tailscale`&&o(),m(`div`,{class:`pair`},m(`div`,{class:`pair-tabs`,role:`tablist`,"aria-label":Rt()},...p.map(([,e])=>e)),r,t.root,c.box)}}}export{on as pairTile,J as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./runtime-ZX6HkxDa.js";import{Ft as t,Nt as n,_t as r,q as i}from"./index-
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{Ft as t,Nt as n,_t as r,q as i}from"./index-TakEXnkN.js";var a=((t={},n={})=>(n.locale??e())===`zh-TW`?`只顯示前 500 個資料夾。`:`Showing the first 500 folders.`),o=((t={},n={})=>(n.locale??e())===`zh-TW`?`這裡沒有資料夾。`:`No folders here.`),s=((t={},n={})=>(n.locale??e())===`zh-TW`?`資料夾:`:`Folder:`),c=((t={},n={})=>(n.locale??e())===`zh-TW`?`新資料夾`:`New folder`),l=((t={},n={})=>(n.locale??e())===`zh-TW`?`新資料夾的名稱`:`Name of the new folder`),u=((t={},n={})=>(n.locale??e())===`zh-TW`?`上一步`:`Back`),d=((t={},n={})=>(n.locale??e())===`zh-TW`?`選擇…`:`Choose…`),f=((t={},n={})=>(n.locale??e())===`zh-TW`?`選擇資料夾`:`Choose a folder`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`桌面`:`Desktop`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`文件`:`Documents`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`下一步`:`Forward`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`家目錄`:`Home`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`資料夾`:`Folders`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`路徑`:`Path`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`位置`:`Places`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`最近`:`Recent`),x=(e,t)=>e===t?``:e.slice(Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`))+1),S=(e,t,n)=>(e.endsWith(n)?e:e+n)+t;function C({list:e,make:t}){let n=new Map,r=[],i=[],a=[],o=0,s=-1,c=``,l=`/`,u,d,f=0,p=()=>i.forEach(e=>e()),m=e=>{r[s]!==e&&(r.splice(s+1,r.length,e),s=r.length-1)},h=async t=>{let r=t===void 0?void 0:n.get(t);if(r)return r;let i=await e(t);return n.set(i.path,i),t!==void 0&&n.set(t,i),[c,l]=[i.home,i.sep],i},g=async e=>{let t=e.path===e.home||!e.path.startsWith(e.home)?[]:e.path.slice(e.home.length).split(e.sep).filter(Boolean),n=t.reduce((t,n)=>[...t,S(t.at(-1),n,e.sep)],[e.home]);return(await Promise.all(n.map(t=>t===e.path?e:h(t)))).map((e,n)=>({path:e.path,dirs:e.dirs,truncated:e.truncated,...t[n]!==void 0&&{pick:t[n]}}))};async function _(e,t=!0){let n=++f;try{let r=await h(e),i=await g(r);if(n!==f)return;[a,u,d]=[i,r.path,void 0],o=Math.max(0,a.length-2),t&&m(u)}catch(e){n===f&&(d=e.message)}p()}async function v(e,t){let n=S(a[e].path,t,l),r=++f;[a,o,u,d]=[[...a.slice(0,e+1).map((n,r)=>r===e?{...n,pick:t}:n)],e,n,void 0],p();try{let e=await h(n);if(r!==f)return;if(e.path!==n)return void await _(e.path);a=[...a,{path:e.path,dirs:e.dirs,truncated:e.truncated}],m(n)}catch(e){r===f&&(d=e.message)}p()}let y=e=>e>=0&&e<r.length?(s=e,_(r[s],!1)):Promise.resolve();return{state:()=>({path:u,home:c,sep:l,cols:a,focus:o,error:d,back:s>0,forward:s<r.length-1,crumbs:a.map((e,t)=>({path:e.path,name:t===0?``:x(e.path)}))}),on:e=>void i.push(e),start:e=>_(e),go:e=>_(e),pick:v,back:()=>y(s-1),forward:()=>y(s+1),async make(e){if(u!==void 0)try{let r=await t(u,e);n.delete(u),await _(r)}catch(e){d=e.message,p()}},async key(e){let t=a[o];if(!t)return!1;if(e===`Enter`)return u!==void 0&&`chosen`;if(e===`ArrowLeft`){if(o===0)return!0;let e=o-1;return[a,o,u]=[a.slice(0,o+1).map((e,t)=>t===o?{path:e.path,dirs:e.dirs,truncated:e.truncated}:e),e,a[o].path],m(u),p(),!0}if(e===`ArrowRight`){let e=a[o+1];return e?.dirs.length&&(o++,e.pick===void 0?await v(o,e.dirs[0]):p()),!0}if(!t.dirs.length)return!0;let n=t.pick===void 0?-1:t.dirs.indexOf(t.pick);return await v(o,t.dirs[Math.min(t.dirs.length-1,Math.max(0,e===`ArrowDown`?n+1:n<0?t.dirs.length-1:n-1))]),!0}}}var w=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Enter`]),T=()=>(e=>typeof e==`function`?e:void 0)(globalThis.strawBossDesk?.pickFolder),E=e=>Error(e.body.reason??n({status:e.status}));function D(e,n,x){let S=C({list:async n=>{let r=await i(`dirs`,n?{path:n}:e).catch(()=>Promise.reject(Error(t())));return r.ok?r.body:Promise.reject(E(r))},make:async(e,n)=>{let r=await i(`dirs/new`,{path:e,name:n}).catch(()=>Promise.reject(Error(t())));return r.ok?r.body.path:Promise.reject(E(r))}}),D=r(`button`,{type:`button`,class:`later`,"aria-label":u(),title:u()},`←`),O=r(`button`,{type:`button`,class:`later`,"aria-label":h(),title:h()},`→`),k=T(),A=k&&r(`button`,{type:`button`,class:`later`},d()),j=r(`nav`,{class:`picker-crumbs`,"aria-label":v()}),M=r(`button`,{type:`button`,class:`later`},`+ ${c()}`),N=r(`input`,{type:`text`,maxlength:`255`,placeholder:l(),"aria-label":l()}),P=r(`div`,{class:`picker-places`,role:`group`,"aria-label":y()}),F=r(`div`,{class:`picker-cols`,tabindex:`0`,role:`group`,"aria-label":_()}),I=r(`code`,{class:`spawn-path`}),L=r(`p`,{class:`chat-empty`,role:`status`});N.hidden=!0;let R;S.on(()=>{let e=S.state();[D.disabled,O.disabled]=[!e.back,!e.forward],j.replaceChildren(...e.crumbs.map((t,n)=>{let i=r(`button`,{type:`button`,"aria-current":String(n===e.crumbs.length-1)},t.name||g());return[i.title,i.onclick]=[t.name||t.path,()=>void S.go(t.path)],i})),F.replaceChildren(...e.cols.map((t,n)=>{let i=t.dirs.map(e=>{let i=r(`button`,{type:`button`,class:`pitem`,role:`option`,tabindex:`-1`,"aria-selected":String(t.pick===e),title:e},e);return i.onclick=()=>(F.focus(),void S.pick(n,e)),i}),s=r(`div`,{class:`pcol`,role:`listbox`,"data-focus":String(n===e.focus)},...i,!t.dirs.length&&r(`p`,{class:`pempty`},o()),t.truncated&&r(`p`,{class:`pempty`},a())),c=i.find(e=>e.getAttribute(`aria-selected`)===`true`);return c&&requestAnimationFrame(()=>s.scrollTop=Math.max(0,c.offsetTop-s.clientHeight/2)),s})),requestAnimationFrame(()=>{let e=Math.max(1,Math.floor(F.clientWidth/176)),t=F.clientWidth/e,n=F.children.length;F.style.setProperty(`--pw`,`${t}px`),[F.scrollLeft,j.scrollLeft]=[Math.max(0,n-e)*t,j.scrollWidth]}),I.textContent=I.title=e.path??``,L.textContent=e.error??``,e.path!==void 0&&e.path!==R&&n(R=e.path,e.home)}),D.onclick=()=>void S.back(),O.onclick=()=>void S.forward();let z=()=>{if(N.hidden)return void(N.hidden=!1,N.focus());S.make(N.value).then(()=>{S.state().error||(N.value=``,N.hidden=!0,F.focus())})};return M.onclick=z,A&&(A.onclick=()=>void k({defaultPath:S.state().path,title:f()}).then(e=>e?S.go(e):void 0,e=>void(L.textContent=e.message))),N.addEventListener(`keydown`,e=>e.key===`Enter`&&(e.preventDefault(),z())),N.addEventListener(`keydown`,e=>e.key===`Escape`&&N.value===``&&!N.hidden&&(e.stopPropagation(),N.hidden=!0,F.focus())),F.addEventListener(`keydown`,e=>{!w.has(e.key)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.preventDefault(),S.key(e.key).then(e=>e===`chosen`&&x()))}),i(`dirs/places`,{}).then(e=>{if(!e.ok)return;let t=e.body,n=(e,t)=>{let n=r(`button`,{type:`button`,title:t},e);return n.onclick=()=>void S.go(t),n},i=e=>t.places.find(t=>t.name===e);P.replaceChildren(n(g(),t.home),...[`Desktop`,`Documents`].flatMap(e=>(t=>t?[n(e===`Desktop`?p():m(),t.path)]:[])(i(e))),...t.recent.length?[r(`b`,null,b()),...t.recent.map(e=>n(e.slice(Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`))+1),e))]:[])},()=>{}),S.start(),{picker:S,el:r(`div`,{class:`picker`},r(`div`,{class:`picker-bar`},D,O,j,M,A),N,r(`div`,{class:`picker-body`},P,F),r(`p`,{class:`spawn-at`},s(),` `,I),L)}}export{x as n,D as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./runtime-ZX6HkxDa.js";import{Ft as t,Nt as n,_t as r,q as i}from"./index-
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{Ft as t,Nt as n,_t as r,q as i}from"./index-TakEXnkN.js";var a=((t={},n={})=>(n.locale??e())===`zh-TW`?`取消`:`Cancel`),o=((t={},n={})=>(n.locale??e())===`zh-TW`?`最近的錯誤`:`Last error`),s=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示記錄`:`Show log`),c=((t={},n={})=>(n.locale??e())===`zh-TW`?`記錄是空的。`:`The log is empty.`),l=((t={},n={})=>(n.locale??e())===`zh-TW`?`原因(選填)`:`Reason (optional)`),u=((t={},n={})=>(n.locale??e())===`zh-TW`?`重新啟動伺服器`:`Restart server`),d=((t={},n={})=>(n.locale??e())===`zh-TW`?`要重新啟動 sb 伺服器嗎?這個網址會保留,頁面會自行重新連線。執行中的工作與對話框不受影響。`:`Restart the sb server? This page keeps its address and reconnects by itself. Runs and dialogs carry on.`),f=((t={},n={})=>(n.locale??e())===`zh-TW`?`立即重新啟動`:`Restart now`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`重新啟動中。伺服器回來後頁面會自行重新連線;若沒有(連接埠被占用時網址會改變),請用 /boss gui 開啟。`:`Restarting. This page reconnects when the server is back; if it does not, open /boss gui (the address changes when a port was taken).`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在重新啟動伺服器…`:`Restarting the server…`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`狀態`:`State`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`伺服器`:`Server`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`已執行`:`Up for`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`版本`:`Version`),y=e=>e>=36e5?`${Math.floor(e/36e5)} h ${Math.floor(e%36e5/6e4)} min`:e>=6e4?`${Math.floor(e/6e4)} min`:`${Math.floor(e/1e3)} s`;function b(){return{id:`server`,title:g(),body:()=>{let e=r(`dl`,{class:`server-facts`}),g=r(`p`,{class:`chat-empty`,role:`status`}),b=r(`pre`,{class:`link-args`}),x=r(`input`,{type:`text`,maxlength:`200`,placeholder:l(),"aria-label":l()}),S=r(`button`,{type:`button`,class:`pair-btn`},u()),C=r(`button`,{type:`button`,class:`later`},s());b.hidden=!0;let w=(e,t)=>[r(`dt`,null,e),r(`dd`,null,t)];async function T(){let n=await i(`server/status`,{}).catch(()=>void 0);if(!n?.ok)return e.replaceChildren(),g.replaceChildren(n?.body.reason??t()),!1;let r=n.body;return e.replaceChildren(...w(h(),r.state??`?`),...w(v(),r.version??`?`),...typeof r.uptimeMs==`number`?w(_(),y(r.uptimeMs)):[],...r.lastError?w(o(),`${r.lastError.code}: ${r.lastError.text}`):[]),!0}let E=r(`button`,{type:`button`,class:`later`},a());E.hidden=!0;let D=!1;return E.onclick=()=>(D=!1,S.textContent=u(),E.hidden=!0,g.replaceChildren()),S.onclick=()=>{if(!D)return D=!0,S.textContent=f(),E.hidden=!1,g.replaceChildren(d());D=!1,E.hidden=!0,S.textContent=u(),S.disabled=!0,g.replaceChildren(m()),i(`server/restart`,x.value.trim()?{reason:x.value.trim()}:{}).then(async e=>{if(!e.ok)return void g.replaceChildren(e.body.reason??n({status:e.status}));g.replaceChildren(p())},()=>g.replaceChildren(t())).finally(()=>S.disabled=!1)},C.onclick=()=>void i(`server/log`,{lines:200}).then(e=>{b.hidden=!1,b.textContent=e.ok?e.body.lines.join(`
|
|
2
2
|
`)||c():e.body.reason??n({status:e.status})},()=>(b.hidden=!1,b.textContent=t())),T(),r(`div`,{class:`server`},e,r(`div`,{class:`devices-acts`},x,S,E,C),g,b)}}}export{b as serverTile};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./sending-aEpvzoz2.js";import{t as n}from"./sentencepack-DtYqpppS.js";import{c as r,d as i,o as a,u as o}from"./towerturns-Cldgw4hX.js";import{Ft as s,J as c,Nt as l,Q as ee,_t as u,rn as te,x as d}from"./index-Dvw58cHb.js";var ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`附加檔案`:`Attach files`),f=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 已經結束`:`This session has ended`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個隊友 run 由隊友的訊息驅動。你可以在這裡看它的通訊,但不能寫給它。`:`A teammate's message drives this ally run. You can read its comms here; you cannot write to it.`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在上方或終端機回答。`:`Answer above or in pi`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框;請在它的終端機中回答。`:`It waits on a dialog; answer it in its terminal.`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 已不再即時;紀錄仍可閱讀。`:`This session is no longer live; its history stays readable.`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個單位沒有即時的 pi 窗格,無處可輸入。`:`No live pi pane backs this unit, so there is nothing to type into.`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`串流中斷;要等它恢復才能送出。`:`The stream is down; sending waits for it to come back.`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 run 是塔台為事件啟動的。你可以在這裡看它的通訊;要跟它說話,請寫給塔台。`:`The tower started this run for events. You can read its comms here; to talk to it, write to the tower.`),b=(e,t)=>n(`blocked_run`,y,e,t),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`現在連不上這台機器;連上之後才能傳送。`:`This machine cannot be reached right now; sending waits until it can.`),S=((t={},n={})=>(n.locale??e())===`zh-TW`?`指令`:`Commands`),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`配對、遠端存取、Wi-Fi、伺服器、預設檢視、決定加入請求與回答其他工作階段的對話框要在這台電腦的頁面或終端機操作,配對裝置不能做。`:`Pairing, remote access, Wi-Fi, the server, the default view, deciding a join request, and answering another session’s dialog are managed on this computer’s own page or terminal, not from a paired device.`),ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`再取一次`:`Fetch again`),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`已經沒有排隊的訊息了:它們已送達,或在終端機的輸入框裡。`:`Nothing is queued any more: the messages were delivered, or they are in the terminal’s editor.`),oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`排隊中的訊息已放進輸入框,改完再送出。`:`The queued messages are in the box. Edit them and send.`),se=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在取回排隊中的訊息…`:`Taking the queued messages back…`),ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`未確認。若訊息已被取回,請再取一次;否則它們仍在終端機裡。`:`Not confirmed. If the messages were taken back, fetch them again; otherwise they are still in the terminal.`),C=e=>`${e?.command} ends this session or switches its pane to another one.`,w=e=>`${e?.command} 會結束這個 session,或把它的窗格切換到別的 session。`,le=((t,n={})=>(n.locale??e())===`zh-TW`?w(t):C(t)),T=e=>`${e?.name} is larger than 20 MB.`,E=e=>`${e?.name} 超過 20 MB。`,ue=((t,n={})=>(n.locale??e())===`zh-TW`?E(t):T(t)),de=((t={},n={})=>(n.locale??e())===`zh-TW`?`做完再送`:`After this`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`接續與主塔台的對話`:`Continue the conversation with the head tower`),O=(e,t)=>n(`head_continues`,D,e,t),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`叫醒主塔台`:`Wakes the head tower`),A=(e,t)=>n(`head_wakes`,k,e,t),j=e=>`From your message: ${e?.text}`,M=e=>`引自你的訊息:${e?.text}`,N=((t,n={})=>(n.locale??e())===`zh-TW`?M(t):j(t)),fe=((t={},n={})=>(n.locale??e())===`zh-TW`?`訊息`:`Message`),P=e=>`Message ${e?.name}`,F=e=>`傳訊息給 ${e?.name}`,I=((t,n={})=>(n.locale??e())===`zh-TW`?F(t):P(t)),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`隊友的 run 正在回應・送出訊息會另外喚醒塔台跑你自己的 run`:`An ally run is answering a teammate · a message wakes a run of your own`),R=(e,t)=>n(`placeholder_ally`,L,e,t),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`接續與塔台的老闆對話`:`Continues the boss conversation`),B=(e,t)=>n(`placeholder_conversation`,z,e,t),V=((t={},n={})=>(n.locale??e())===`zh-TW`?`送給正在跑的事件 run・它會在這裡回答`:`Goes to the running event run · it answers here`),H=((t={},n={})=>(n.locale??e())===`zh-TW`?`反覆當機後暫停中・送出訊息就會喚醒`:`Held after repeated crashes · a message wakes it`),U=((t={},n={})=>(n.locale??e())===`zh-TW`?`喚醒塔台`:`Wakes the tower`),W=(e,t)=>n(`placeholder_wake`,U,e,t),G=e=>`Send ${e?.command}`,pe=e=>`送出 ${e?.command}`,me=((t,n={})=>(n.locale??e())===`zh-TW`?pe(t):G(t)),he=((t={},n={})=>(n.locale??e())===`zh-TW`?`已照原文送出;你的修改留在這裡,尚未送出。`:`Sent as it was; your edits stayed here, unsent.`),ge=((t={},n={})=>(n.locale??e())===`zh-TW`?`停止`:`Stop`),_e=((t={},n={})=>(n.locale??e())===`zh-TW`?`要停止目前的任務嗎?佇列中的訊息會退回它的終端機編輯器。`:`Stop the current task? Queued messages go back to its terminal editor.`),ve=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框:請在終端機中回答。`:`It is waiting on a dialog: answer it in the terminal.`),ye=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 上還有另一個輸入在途中。`:`Another input to this session is still on its way.`),be=((t={},n={})=>(n.locale??e())===`zh-TW`?`終端機的輸入框裡除了排隊中的訊息與草稿,還有其他內容(期間有人輸入,或 pi 展開了訊息)。訊息在輸入框裡,請查看終端機。`:`The terminal’s editor holds something other than the queued messages and the draft (typed meanwhile, or a message pi expanded). The messages are in it; check the terminal.`),xe=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待連結請求時,配對裝置只能送出 Escape。請在這台電腦的頁面或終端機核准。`:`While it waits on a link request, a paired device can only send Escape. Approve it on this computer’s own page or terminal.`),Se=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 沒有輸入框,無法把訊息取回。`:`This session has no editor to take the messages back into.`),Ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`pi 的取回按鍵(keybindings.json 裡的 app.message.dequeue)不是這個頁面能送出的按鍵。請在終端機裡按。`:`pi’s dequeue key (app.message.dequeue in its keybindings.json) is not one this page can send. Press it in the terminal.`),we=((t={},n={})=>(n.locale??e())===`zh-TW`?`無法清掉終端機輸入框裡的訊息。它們在那裡,不在這裡。`:`The messages could not be cleared from the terminal’s editor. They are there, not here.`),Te=e=>`pi did not take its queue back; its dequeue key may not be ${e?.key}. Check the terminal.`,Ee=e=>`pi 沒有取回它的佇列;它的取回按鍵可能不是 ${e?.key}。請查看終端機。`,De=((t,n={})=>(n.locale??e())===`zh-TW`?Ee(t):Te(t)),Oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`一次按太多鍵了。請一秒後再試。`:`Too many keys at once. Try again in a second.`),ke=((t={},n={})=>(n.locale??e())===`zh-TW`?`取回逾時,或按鍵送出後 session 已有變動:訊息在終端機的輸入框裡,不在這裡。`:`The take-back timed out, or the session changed, after the key went: the messages are in the terminal’s editor, not here.`),Ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`排隊中的訊息太長,帶不回這裡。它們在終端機的輸入框裡。`:`The queued messages are too long to bring here. They are in the terminal’s editor.`),K=((t={},n={})=>(n.locale??e())===`zh-TW`?`未確認。再次送出前請先查看終端機。`:`Not confirmed. Check the terminal before sending again.`),je=((t={},n={})=>(n.locale??e())===`zh-TW`?`上傳中…`:`Uploading…`),Me=((t={},n={})=>(n.locale??e())===`zh-TW`?`原文已送到 session;這裡是你編輯過、尚未送出的副本。`:`The original already went to the session; what is here is your edited copy, unsent.`),Ne=e=>/^\/(\S{0,64})$/.exec(e)?.[1],Pe=(e,t,n)=>(e+n+t)%t;function Fe(e,t){let n=u(`ul`,{class:`slash`,id:`slash`,role:`listbox`,"aria-label":S()}),r=[],i=0,a;e.setAttribute(`aria-controls`,`slash`);let o=()=>!n.hidden&&r.length>0,s=()=>(r=[],n.hidden=!0,e.removeAttribute(`aria-activedescendant`)),c=()=>{n.replaceChildren(...r.map((e,t)=>{let n=u(`li`,{id:`slash-${t}`,role:`option`,"aria-selected":String(t===i)},u(`b`,null,`/${e.name}`),e.description&&u(`span`,null,e.description));return n.onmousedown=e=>e.preventDefault(),n.onclick=()=>l(e),n})),n.hidden=!r.length,r.length&&(e.setAttribute(`aria-activedescendant`,`slash-${i}`),n.children[i]?.scrollIntoView({block:`nearest`}))},l=t=>{e.value=`/${t.name} `,s(),e.focus(),e.dispatchEvent(new Event(`input`))};return s(),e.addEventListener(`input`,()=>{let n=Ne(e.value),o=e.value;if(clearTimeout(a),n===void 0)return s();a=setTimeout(async()=>{let a=await t(n).catch(()=>void 0);if(e.value!==o)return;let s=a?.ok&&Array.isArray(a.body.commands)?a.body.commands:[];[r,i]=[s,0],c()},120)}),e.addEventListener(`blur`,s),e.addEventListener(`keydown`,e=>{if(!o()||e.isComposing||e.keyCode===229)return;let t=e.key;if(t===`ArrowDown`||t===`ArrowUp`)i=Pe(i,r.length,t===`ArrowDown`?1:-1),c();else if(t===`Enter`&&!e.shiftKey||t===`Tab`)l(r[i]);else if(t===`Escape`)s();else return;e.preventDefault(),e.stopImmediatePropagation()}),n}var Ie=16384,Le=/^\s*\/(quit|exit|new|resume|fork|clone|import|reload)(?=\s|$)/,Re=(e,t)=>t.wakes?void 0:e.match(Le)?.[0].trim(),q=new Map;function ze(e,t,n,i){if(!e.ok)return[`error`,e.status===504?K({},i?{locale:i}:void 0):r(e,i)??e.body.reason??l({status:e.status},i?{locale:i}:void 0)];if(t&&!t.startsWith(n))return[`ok`,Me()]}var Be=e=>{try{return e?.startsWith(`[`)?JSON.parse(e):e?[`error`,e]:void 0}catch{return[`error`,e]}},Ve=(e,t)=>e!==``&&!e.startsWith(t)?he():``,He=(e,t)=>e.startsWith(t)?e.slice(t.length).replace(/^\n/,``):e,J=(e,t)=>t.trim()?`${e}\n\n${t}`:e,Y=new Map,Ue=54e4,X=new Map,Z=new Map,Q=e=>`sb-draft:${e}:take`;function We(e,t=Date.now()){let n=X.get(e);if(!n)try{let[t,r]=(sessionStorage.getItem(Q(e))??``).split(`:`);r&&Number(t)>0&&X.set(e,n={id:r,at:Number(t)})}catch{}return n&&t-n.at>=Ue&&(Ke(e),n=void 0),n?.id}function Ge(e,t=Date.now()){let n=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``);X.set(e,{id:n,at:t});try{sessionStorage.setItem(Q(e),`${t}:${n}`)}catch{}return n}function Ke(e){X.delete(e);try{sessionStorage.removeItem(Q(e))}catch{}}function qe(e,t){let n=`sb-draft:${e}`;try{sessionStorage.setItem(n,J(t,sessionStorage.getItem(n)??``)),sessionStorage.setItem(`${n}:note`,JSON.stringify([`ok`,oe()]))}catch{Z.set(e,J(t,Z.get(e)??``))}}function Je(e,t){let n=Z.get(e);return Z.delete(e),n===void 0?t:J(n,t)}var Ye=[`no_editor`,`stale`,`not_taken`,`changed`,`too_large`,`not_cleared`,`no_key`];function Xe(e,t){let n=t?{locale:t}:void 0,r=typeof e.body.label==`string`?e.body.label:`?`;return e.status>=400&&e.status!==504?{no_key:()=>Ce({},n),no_editor:()=>Se({},n),stale:()=>ke({},n),not_taken:()=>De({key:r},n),changed:()=>be({},n),too_large:()=>Ae({},n),not_cleared:()=>we({},n),blocked:()=>ve({},n),local_only:()=>xe({},n),rate:()=>Oe({},n),busy:()=>ye({},n)}[e.body.error??``]?.():void 0}function Ze(e,t,n){t.ok&&typeof t.body.text==`string`&&(n?(n.box.value=J(t.body.text,n.box.value),n.save()):qe(e,t.body.text)),(t.ok||t.status===400||t.status===409&&Ye.includes(t.body.error??``))&&Ke(e)}var Qe=e=>e.live&&!e.ally;function $(e){if(!e.online)return e.away?x():v();if(!e.live)return g();if(!e.control)return e.run?b():e.ally?p():_();if(e.mark===`waiting`)return e.answerable?m():h()}function $e(e){if(e.online){if(!e.live)return f();if(!e.control&&(e.run||e.ally))return e.run?b():p()}}var et=e=>e.wakes?e.held?H():e.allyLive?R():e.eventRun?V():e.head?e.conversation?O():A():e.conversation?B():W():I({name:e.name}),tt=e=>({eventRun:!(!e?.bossIn||e.conversation),wakes:!!e,held:e?.state===`held`,conversation:!(!e?.conversation||e.conversation.closing),allyLive:!(!e?.allyRuns.length||e.run)});function nt(e,n,r,ee=e=>c(`sessions/${encodeURIComponent(n)}/upload`,e)){let d=`sb-draft:${n}`,f=matchMedia(`(pointer: coarse)`).matches,p=u(`textarea`,{rows:`1`,maxlength:String(Ie),"aria-label":fe(),enterkeyhint:f?`enter`:`send`}),m=u(`button`,{type:`submit`,class:`cmp-send`},i()),h=u(`button`,{type:`button`,class:`cmp-alt`},de()),g=u(`button`,{type:`button`,class:`cmp-alt cmp-stop`},ge()),_=u(`input`,{type:`file`,multiple:``,hidden:``}),v=u(`button`,{type:`button`,class:`cmp-alt`,"aria-label":ne()},`+`),y=u(`p`,{class:`cmp-note`,role:`status`,"aria-live":`polite`}),b=Fe(p,e=>r(`commands`,{prefix:e})),x=u(`p`,{class:`cmp-bar`,role:`status`}),S=u(`p`,{class:`cmp-activity`,role:`status`,"aria-live":`polite`});x.hidden=!0;let C=u(`form`,{class:`composer`},b,u(`div`,{class:`cmp-row`},v,_,p,u(`div`,{class:`cmp-acts`},m,h,g)),u(`div`,{class:`cmp-foot`},y),x,S);e.replaceChildren(C);let w={name:``,control:!1,live:!1,mark:`unknown`,online:!1},T=!1,E=!1,D=e=>{try{e()}catch{}};D(()=>p.value=sessionStorage.getItem(d)??``),p.value=Je(n,p.value);let O=()=>D(()=>p.value?sessionStorage.setItem(d,p.value):sessionStorage.removeItem(d)),k=CSS.supports(`field-sizing`,`content`)?()=>{}:()=>(p.style.height=`auto`,p.style.height=`${Math.min(p.scrollHeight,220)}px`),A=(e,t=``,...n)=>(y.dataset.tone=t,y.replaceChildren(e,...n)),j=(e,t,n)=>{let r=u(`button`,{type:`button`,class:`cmp-yes`},t),i=u(`button`,{type:`button`,class:`cmp-link`},te());E=!0,r.onclick=()=>(E=!1,n()),i.onclick=()=>(E=!1,A(``),p.focus()),A(e,`ask`,r,i),r.focus()},[M,N]=[`${d}:note`,()=>{try{return sessionStorage.getItem(d)??``}catch{return}}],P=e=>D(()=>e?sessionStorage.setItem(M,JSON.stringify(e)):sessionStorage.removeItem(M));function F(e,t,i){let a={sent:i,answer:r(e,t)};return i!==void 0&&(P([`error`,K()]),q.set(n,a),a.answer.then(e=>{let t=N();e.ok&&t!==void 0&&D(()=>sessionStorage.setItem(d,He(t,i))),P(ze(e,t,i))},()=>P([`error`,K()]))),I(a)}async function I(e,{sent:r}=e){T=!0,E=!1,R(),A(r===void 0?``:t());try{let t=await e.answer;if(!C.isConnected)return;if(!t.ok)return t.status===504||P(),A(a(t)??(t.status===403&&t.body.error===`local_only`?re():void 0)??t.body.reason??l({status:t.status}),`error`);if(r===void 0)return A(``);P();let n=Ve(p.value,r);p.value=He(p.value,r),O(),k(),A(n,`ok`)}catch{A(K(),`error`)}finally{q.get(n)===e&&q.delete(n),T=!1,R()}}function L(e,t){let n=p.value,r=$(w),i=t===n;if(T||E||!n.trim())return;if(r)return A(r,`error`);if(new TextEncoder().encode(n).length>16384)return A(o(),`error`);let a=!i&&Re(n,w);if(a)return j(le({command:a}),me({command:a}),()=>L(e,n));F(`input`,{text:n,as:e,confirmed:i},n)}function R(){let e=$e(w),t=[C.querySelector(`.cmp-row`),C.querySelector(`.cmp-foot`)];x.hidden=e===void 0,x.textContent=e??``,C.classList.toggle(`ended`,e!==void 0);for(let n of t)n.hidden=e!==void 0;b.hidden||=e!==void 0;let n=w.activity;for(let[e,t]of[[`activity`,n?.mark],[`kind`,n?.kind]])t===void 0?delete C.dataset[e]:C.dataset[e]=t;S.textContent!==(n?.text??``)&&(S.textContent=n?.text??``);let r=$(w),i=w.mark===`working`;p.placeholder=r??et(w),p.disabled=v.disabled=!Qe(w),m.disabled=T||!!r||!p.value.trim(),h.hidden=g.hidden=!i||!!r||!!w.wakes,[h.disabled,g.disabled]=[m.disabled,T]}let z=()=>{let e=u(`button`,{type:`button`,class:`cmp-yes`},ie());e.onclick=()=>void V(),A(ce(),`error`,e)};function B(){return r(`dequeue`,{take:We(n)??Ge(n)}).then(e=>(Ze(n,e,C.isConnected?{box:p,save:O}:void 0),e),()=>void 0)}async function V(){if(T||E||Y.has(n))return;let e=$(w);if(e)return A(e,`error`);let t=B();Y.set(n,t),await H(t)}async function H(e){T=!0,R(),A(se());try{let t=await e;if(!C.isConnected)return;if(!t||t.status===504)return z();if(!t.ok)return A(Xe(t)??t.body.reason??l({status:t.status}),`error`);if(typeof t.body.text!=`string`)return A(ae());let r=N();r!==void 0&&r!==p.value&&(p.value=r),p.value=Je(n,p.value),O(),P(),k(),p.focus(),p.selectionStart=p.selectionEnd=p.value.length,A(oe(),`ok`)}finally{Y.get(n)===e&&Y.delete(n),T=!1,R()}}async function U(e){if(!e.length||T)return;let t=$(w);if(t)return A(t,`error`);A(je(),``);for(let t of e){if(t.size>20971520)return A(ue({name:t.name}),`error`);let e=await ee(t).catch(()=>void 0);if(!e?.ok||typeof e.body.path!=`string`)return A(e?.body.reason??s(),`error`);let n=p.selectionStart??p.value.length,r=p.value.slice(0,n),i=p.value.slice(p.selectionEnd??n),a=`${r&&!/\s$/.test(r)?` `:``}${e.body.path}${/^\s/.test(i)?``:` `}`;p.value=r+a+i,p.selectionStart=p.selectionEnd=n+a.length}A(``),O(),k(),R(),p.focus()}v.onclick=()=>_.click(),_.onchange=()=>void U([..._.files??[]]).finally(()=>_.value=``),p.addEventListener(`paste`,e=>{let t=[...e.clipboardData?.files??[]];t.length&&(e.preventDefault(),U(t))}),C.addEventListener(`dragover`,e=>e.dataTransfer?.types.includes(`Files`)&&e.preventDefault()),C.addEventListener(`drop`,e=>{let t=[...e.dataTransfer?.files??[]];t.length&&(e.preventDefault(),U(t))}),C.addEventListener(`submit`,e=>(e.preventDefault(),L(`send`))),h.onclick=()=>L(`followUp`),g.onclick=()=>j(_e(),ge(),()=>void(T||F(`keys`,{keys:[`esc`]}))),p.addEventListener(`input`,()=>(O(),k(),R())),C.addEventListener(`keydown`,e=>{e.key===`Escape`&&!e.isComposing&&(E||e.target===p&&p.value)&&(e.preventDefault(),E&&(E=!1,A(``),p.focus()))}),p.addEventListener(`keydown`,e=>{e.isComposing||e.keyCode===229||e.key!==`Enter`||e.shiftKey||f&&!e.altKey||(e.preventDefault(),L(e.altKey?`followUp`:`send`))});let W=window.visualViewport,G=()=>[[`--vvh`,W.height],[`--vvt`,W.offsetTop]].forEach(([e,t])=>document.documentElement.style.setProperty(e,`${t}px`));return W&&(W.addEventListener(`resize`,G),W.addEventListener(`scroll`,G),G()),k(),q.has(n)?I(q.get(n)):Y.has(n)?H(Y.get(n)):D(()=>{let e=Be(sessionStorage.getItem(M));sessionStorage.removeItem(M),e?A(e[1],e[0]):We(n)&&z()}),{box:p,update:e=>(w=e,R()),ready:()=>!$(w),takeQueue:V}}var rt=(e,{name:t,mk:n,state:r,online:i,away:a,role:o,head:s})=>({name:t,control:!!e?.control,live:!ee(e,r),mark:n,online:i,away:a,answerable:!!e?.pending?.answer,...tt(e?.service??(s?{state:`absent`,allyRuns:[]}:void 0)),head:!!s,activity:it(e,r,n),ally:!e&&(o===`ally`||o===`run`),run:!e&&o===`run`});function it(e,t,n){let r=d(e,t,n);if(!r)return;let i=e?.note??``;return{text:r,mark:n,kind:i.startsWith(`tool:`)?`tool`:i===`watching a monitor`?`monitoring`:`thinking`}}export{h as a,N as i,nt as n,K as r,rt as t};
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./sending-aEpvzoz2.js";import{t as n}from"./sentencepack-DtYqpppS.js";import{c as r,d as i,o as a,u as o}from"./towerturns-BCVvCBoQ.js";import{Ft as s,J as c,Nt as l,Q as ee,_t as u,rn as te,x as d}from"./index-TakEXnkN.js";var ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`附加檔案`:`Attach files`),f=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 已經結束`:`This session has ended`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個隊友 run 由隊友的訊息驅動。你可以在這裡看它的通訊,但不能寫給它。`:`A teammate's message drives this ally run. You can read its comms here; you cannot write to it.`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在上方或終端機回答。`:`Answer above or in pi`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框;請在它的終端機中回答。`:`It waits on a dialog; answer it in its terminal.`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 已不再即時;紀錄仍可閱讀。`:`This session is no longer live; its history stays readable.`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個單位沒有即時的 pi 窗格,無處可輸入。`:`No live pi pane backs this unit, so there is nothing to type into.`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`串流中斷;要等它恢復才能送出。`:`The stream is down; sending waits for it to come back.`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 run 是塔台為事件啟動的。你可以在這裡看它的通訊;要跟它說話,請寫給塔台。`:`The tower started this run for events. You can read its comms here; to talk to it, write to the tower.`),b=(e,t)=>n(`blocked_run`,y,e,t),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`現在連不上這台機器;連上之後才能傳送。`:`This machine cannot be reached right now; sending waits until it can.`),S=((t={},n={})=>(n.locale??e())===`zh-TW`?`指令`:`Commands`),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`配對、遠端存取、Wi-Fi、伺服器、預設檢視、決定加入請求與回答其他工作階段的對話框要在這台電腦的頁面或終端機操作,配對裝置不能做。`:`Pairing, remote access, Wi-Fi, the server, the default view, deciding a join request, and answering another session’s dialog are managed on this computer’s own page or terminal, not from a paired device.`),ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`再取一次`:`Fetch again`),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`已經沒有排隊的訊息了:它們已送達,或在終端機的輸入框裡。`:`Nothing is queued any more: the messages were delivered, or they are in the terminal’s editor.`),oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`排隊中的訊息已放進輸入框,改完再送出。`:`The queued messages are in the box. Edit them and send.`),se=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在取回排隊中的訊息…`:`Taking the queued messages back…`),ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`未確認。若訊息已被取回,請再取一次;否則它們仍在終端機裡。`:`Not confirmed. If the messages were taken back, fetch them again; otherwise they are still in the terminal.`),C=e=>`${e?.command} ends this session or switches its pane to another one.`,w=e=>`${e?.command} 會結束這個 session,或把它的窗格切換到別的 session。`,le=((t,n={})=>(n.locale??e())===`zh-TW`?w(t):C(t)),T=e=>`${e?.name} is larger than 20 MB.`,E=e=>`${e?.name} 超過 20 MB。`,ue=((t,n={})=>(n.locale??e())===`zh-TW`?E(t):T(t)),de=((t={},n={})=>(n.locale??e())===`zh-TW`?`做完再送`:`After this`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`接續與主塔台的對話`:`Continue the conversation with the head tower`),O=(e,t)=>n(`head_continues`,D,e,t),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`叫醒主塔台`:`Wakes the head tower`),A=(e,t)=>n(`head_wakes`,k,e,t),j=e=>`From your message: ${e?.text}`,M=e=>`引自你的訊息:${e?.text}`,N=((t,n={})=>(n.locale??e())===`zh-TW`?M(t):j(t)),fe=((t={},n={})=>(n.locale??e())===`zh-TW`?`訊息`:`Message`),P=e=>`Message ${e?.name}`,F=e=>`傳訊息給 ${e?.name}`,I=((t,n={})=>(n.locale??e())===`zh-TW`?F(t):P(t)),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`隊友的 run 正在回應・送出訊息會另外喚醒塔台跑你自己的 run`:`An ally run is answering a teammate · a message wakes a run of your own`),R=(e,t)=>n(`placeholder_ally`,L,e,t),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`接續與塔台的老闆對話`:`Continues the boss conversation`),B=(e,t)=>n(`placeholder_conversation`,z,e,t),V=((t={},n={})=>(n.locale??e())===`zh-TW`?`送給正在跑的事件 run・它會在這裡回答`:`Goes to the running event run · it answers here`),H=((t={},n={})=>(n.locale??e())===`zh-TW`?`反覆當機後暫停中・送出訊息就會喚醒`:`Held after repeated crashes · a message wakes it`),U=((t={},n={})=>(n.locale??e())===`zh-TW`?`喚醒塔台`:`Wakes the tower`),W=(e,t)=>n(`placeholder_wake`,U,e,t),G=e=>`Send ${e?.command}`,pe=e=>`送出 ${e?.command}`,me=((t,n={})=>(n.locale??e())===`zh-TW`?pe(t):G(t)),he=((t={},n={})=>(n.locale??e())===`zh-TW`?`已照原文送出;你的修改留在這裡,尚未送出。`:`Sent as it was; your edits stayed here, unsent.`),ge=((t={},n={})=>(n.locale??e())===`zh-TW`?`停止`:`Stop`),_e=((t={},n={})=>(n.locale??e())===`zh-TW`?`要停止目前的任務嗎?佇列中的訊息會退回它的終端機編輯器。`:`Stop the current task? Queued messages go back to its terminal editor.`),ve=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框:請在終端機中回答。`:`It is waiting on a dialog: answer it in the terminal.`),ye=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 上還有另一個輸入在途中。`:`Another input to this session is still on its way.`),be=((t={},n={})=>(n.locale??e())===`zh-TW`?`終端機的輸入框裡除了排隊中的訊息與草稿,還有其他內容(期間有人輸入,或 pi 展開了訊息)。訊息在輸入框裡,請查看終端機。`:`The terminal’s editor holds something other than the queued messages and the draft (typed meanwhile, or a message pi expanded). The messages are in it; check the terminal.`),xe=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待連結請求時,配對裝置只能送出 Escape。請在這台電腦的頁面或終端機核准。`:`While it waits on a link request, a paired device can only send Escape. Approve it on this computer’s own page or terminal.`),Se=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 沒有輸入框,無法把訊息取回。`:`This session has no editor to take the messages back into.`),Ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`pi 的取回按鍵(keybindings.json 裡的 app.message.dequeue)不是這個頁面能送出的按鍵。請在終端機裡按。`:`pi’s dequeue key (app.message.dequeue in its keybindings.json) is not one this page can send. Press it in the terminal.`),we=((t={},n={})=>(n.locale??e())===`zh-TW`?`無法清掉終端機輸入框裡的訊息。它們在那裡,不在這裡。`:`The messages could not be cleared from the terminal’s editor. They are there, not here.`),Te=e=>`pi did not take its queue back; its dequeue key may not be ${e?.key}. Check the terminal.`,Ee=e=>`pi 沒有取回它的佇列;它的取回按鍵可能不是 ${e?.key}。請查看終端機。`,De=((t,n={})=>(n.locale??e())===`zh-TW`?Ee(t):Te(t)),Oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`一次按太多鍵了。請一秒後再試。`:`Too many keys at once. Try again in a second.`),ke=((t={},n={})=>(n.locale??e())===`zh-TW`?`取回逾時,或按鍵送出後 session 已有變動:訊息在終端機的輸入框裡,不在這裡。`:`The take-back timed out, or the session changed, after the key went: the messages are in the terminal’s editor, not here.`),Ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`排隊中的訊息太長,帶不回這裡。它們在終端機的輸入框裡。`:`The queued messages are too long to bring here. They are in the terminal’s editor.`),K=((t={},n={})=>(n.locale??e())===`zh-TW`?`未確認。再次送出前請先查看終端機。`:`Not confirmed. Check the terminal before sending again.`),je=((t={},n={})=>(n.locale??e())===`zh-TW`?`上傳中…`:`Uploading…`),Me=((t={},n={})=>(n.locale??e())===`zh-TW`?`原文已送到 session;這裡是你編輯過、尚未送出的副本。`:`The original already went to the session; what is here is your edited copy, unsent.`),Ne=e=>/^\/(\S{0,64})$/.exec(e)?.[1],Pe=(e,t,n)=>(e+n+t)%t;function Fe(e,t){let n=u(`ul`,{class:`slash`,id:`slash`,role:`listbox`,"aria-label":S()}),r=[],i=0,a;e.setAttribute(`aria-controls`,`slash`);let o=()=>!n.hidden&&r.length>0,s=()=>(r=[],n.hidden=!0,e.removeAttribute(`aria-activedescendant`)),c=()=>{n.replaceChildren(...r.map((e,t)=>{let n=u(`li`,{id:`slash-${t}`,role:`option`,"aria-selected":String(t===i)},u(`b`,null,`/${e.name}`),e.description&&u(`span`,null,e.description));return n.onmousedown=e=>e.preventDefault(),n.onclick=()=>l(e),n})),n.hidden=!r.length,r.length&&(e.setAttribute(`aria-activedescendant`,`slash-${i}`),n.children[i]?.scrollIntoView({block:`nearest`}))},l=t=>{e.value=`/${t.name} `,s(),e.focus(),e.dispatchEvent(new Event(`input`))};return s(),e.addEventListener(`input`,()=>{let n=Ne(e.value),o=e.value;if(clearTimeout(a),n===void 0)return s();a=setTimeout(async()=>{let a=await t(n).catch(()=>void 0);if(e.value!==o)return;let s=a?.ok&&Array.isArray(a.body.commands)?a.body.commands:[];[r,i]=[s,0],c()},120)}),e.addEventListener(`blur`,s),e.addEventListener(`keydown`,e=>{if(!o()||e.isComposing||e.keyCode===229)return;let t=e.key;if(t===`ArrowDown`||t===`ArrowUp`)i=Pe(i,r.length,t===`ArrowDown`?1:-1),c();else if(t===`Enter`&&!e.shiftKey||t===`Tab`)l(r[i]);else if(t===`Escape`)s();else return;e.preventDefault(),e.stopImmediatePropagation()}),n}var Ie=16384,Le=/^\s*\/(quit|exit|new|resume|fork|clone|import|reload)(?=\s|$)/,Re=(e,t)=>t.wakes?void 0:e.match(Le)?.[0].trim(),q=new Map;function ze(e,t,n,i){if(!e.ok)return[`error`,e.status===504?K({},i?{locale:i}:void 0):r(e,i)??e.body.reason??l({status:e.status},i?{locale:i}:void 0)];if(t&&!t.startsWith(n))return[`ok`,Me()]}var Be=e=>{try{return e?.startsWith(`[`)?JSON.parse(e):e?[`error`,e]:void 0}catch{return[`error`,e]}},Ve=(e,t)=>e!==``&&!e.startsWith(t)?he():``,He=(e,t)=>e.startsWith(t)?e.slice(t.length).replace(/^\n/,``):e,J=(e,t)=>t.trim()?`${e}\n\n${t}`:e,Y=new Map,Ue=54e4,X=new Map,Z=new Map,Q=e=>`sb-draft:${e}:take`;function We(e,t=Date.now()){let n=X.get(e);if(!n)try{let[t,r]=(sessionStorage.getItem(Q(e))??``).split(`:`);r&&Number(t)>0&&X.set(e,n={id:r,at:Number(t)})}catch{}return n&&t-n.at>=Ue&&(Ke(e),n=void 0),n?.id}function Ge(e,t=Date.now()){let n=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``);X.set(e,{id:n,at:t});try{sessionStorage.setItem(Q(e),`${t}:${n}`)}catch{}return n}function Ke(e){X.delete(e);try{sessionStorage.removeItem(Q(e))}catch{}}function qe(e,t){let n=`sb-draft:${e}`;try{sessionStorage.setItem(n,J(t,sessionStorage.getItem(n)??``)),sessionStorage.setItem(`${n}:note`,JSON.stringify([`ok`,oe()]))}catch{Z.set(e,J(t,Z.get(e)??``))}}function Je(e,t){let n=Z.get(e);return Z.delete(e),n===void 0?t:J(n,t)}var Ye=[`no_editor`,`stale`,`not_taken`,`changed`,`too_large`,`not_cleared`,`no_key`];function Xe(e,t){let n=t?{locale:t}:void 0,r=typeof e.body.label==`string`?e.body.label:`?`;return e.status>=400&&e.status!==504?{no_key:()=>Ce({},n),no_editor:()=>Se({},n),stale:()=>ke({},n),not_taken:()=>De({key:r},n),changed:()=>be({},n),too_large:()=>Ae({},n),not_cleared:()=>we({},n),blocked:()=>ve({},n),local_only:()=>xe({},n),rate:()=>Oe({},n),busy:()=>ye({},n)}[e.body.error??``]?.():void 0}function Ze(e,t,n){t.ok&&typeof t.body.text==`string`&&(n?(n.box.value=J(t.body.text,n.box.value),n.save()):qe(e,t.body.text)),(t.ok||t.status===400||t.status===409&&Ye.includes(t.body.error??``))&&Ke(e)}var Qe=e=>e.live&&!e.ally;function $(e){if(!e.online)return e.away?x():v();if(!e.live)return g();if(!e.control)return e.run?b():e.ally?p():_();if(e.mark===`waiting`)return e.answerable?m():h()}function $e(e){if(e.online){if(!e.live)return f();if(!e.control&&(e.run||e.ally))return e.run?b():p()}}var et=e=>e.wakes?e.held?H():e.allyLive?R():e.eventRun?V():e.head?e.conversation?O():A():e.conversation?B():W():I({name:e.name}),tt=e=>({eventRun:!(!e?.bossIn||e.conversation),wakes:!!e,held:e?.state===`held`,conversation:!(!e?.conversation||e.conversation.closing),allyLive:!(!e?.allyRuns.length||e.run)});function nt(e,n,r,ee=e=>c(`sessions/${encodeURIComponent(n)}/upload`,e)){let d=`sb-draft:${n}`,f=matchMedia(`(pointer: coarse)`).matches,p=u(`textarea`,{rows:`1`,maxlength:String(Ie),"aria-label":fe(),enterkeyhint:f?`enter`:`send`}),m=u(`button`,{type:`submit`,class:`cmp-send`},i()),h=u(`button`,{type:`button`,class:`cmp-alt`},de()),g=u(`button`,{type:`button`,class:`cmp-alt cmp-stop`},ge()),_=u(`input`,{type:`file`,multiple:``,hidden:``}),v=u(`button`,{type:`button`,class:`cmp-alt`,"aria-label":ne()},`+`),y=u(`p`,{class:`cmp-note`,role:`status`,"aria-live":`polite`}),b=Fe(p,e=>r(`commands`,{prefix:e})),x=u(`p`,{class:`cmp-bar`,role:`status`}),S=u(`p`,{class:`cmp-activity`,role:`status`,"aria-live":`polite`});x.hidden=!0;let C=u(`form`,{class:`composer`},b,u(`div`,{class:`cmp-row`},v,_,p,u(`div`,{class:`cmp-acts`},m,h,g)),u(`div`,{class:`cmp-foot`},y),x,S);e.replaceChildren(C);let w={name:``,control:!1,live:!1,mark:`unknown`,online:!1},T=!1,E=!1,D=e=>{try{e()}catch{}};D(()=>p.value=sessionStorage.getItem(d)??``),p.value=Je(n,p.value);let O=()=>D(()=>p.value?sessionStorage.setItem(d,p.value):sessionStorage.removeItem(d)),k=CSS.supports(`field-sizing`,`content`)?()=>{}:()=>(p.style.height=`auto`,p.style.height=`${Math.min(p.scrollHeight,220)}px`),A=(e,t=``,...n)=>(y.dataset.tone=t,y.replaceChildren(e,...n)),j=(e,t,n)=>{let r=u(`button`,{type:`button`,class:`cmp-yes`},t),i=u(`button`,{type:`button`,class:`cmp-link`},te());E=!0,r.onclick=()=>(E=!1,n()),i.onclick=()=>(E=!1,A(``),p.focus()),A(e,`ask`,r,i),r.focus()},[M,N]=[`${d}:note`,()=>{try{return sessionStorage.getItem(d)??``}catch{return}}],P=e=>D(()=>e?sessionStorage.setItem(M,JSON.stringify(e)):sessionStorage.removeItem(M));function F(e,t,i){let a={sent:i,answer:r(e,t)};return i!==void 0&&(P([`error`,K()]),q.set(n,a),a.answer.then(e=>{let t=N();e.ok&&t!==void 0&&D(()=>sessionStorage.setItem(d,He(t,i))),P(ze(e,t,i))},()=>P([`error`,K()]))),I(a)}async function I(e,{sent:r}=e){T=!0,E=!1,R(),A(r===void 0?``:t());try{let t=await e.answer;if(!C.isConnected)return;if(!t.ok)return t.status===504||P(),A(a(t)??(t.status===403&&t.body.error===`local_only`?re():void 0)??t.body.reason??l({status:t.status}),`error`);if(r===void 0)return A(``);P();let n=Ve(p.value,r);p.value=He(p.value,r),O(),k(),A(n,`ok`)}catch{A(K(),`error`)}finally{q.get(n)===e&&q.delete(n),T=!1,R()}}function L(e,t){let n=p.value,r=$(w),i=t===n;if(T||E||!n.trim())return;if(r)return A(r,`error`);if(new TextEncoder().encode(n).length>16384)return A(o(),`error`);let a=!i&&Re(n,w);if(a)return j(le({command:a}),me({command:a}),()=>L(e,n));F(`input`,{text:n,as:e,confirmed:i},n)}function R(){let e=$e(w),t=[C.querySelector(`.cmp-row`),C.querySelector(`.cmp-foot`)];x.hidden=e===void 0,x.textContent=e??``,C.classList.toggle(`ended`,e!==void 0);for(let n of t)n.hidden=e!==void 0;b.hidden||=e!==void 0;let n=w.activity;for(let[e,t]of[[`activity`,n?.mark],[`kind`,n?.kind]])t===void 0?delete C.dataset[e]:C.dataset[e]=t;S.textContent!==(n?.text??``)&&(S.textContent=n?.text??``);let r=$(w),i=w.mark===`working`;p.placeholder=r??et(w),p.disabled=v.disabled=!Qe(w),m.disabled=T||!!r||!p.value.trim(),h.hidden=g.hidden=!i||!!r||!!w.wakes,[h.disabled,g.disabled]=[m.disabled,T]}let z=()=>{let e=u(`button`,{type:`button`,class:`cmp-yes`},ie());e.onclick=()=>void V(),A(ce(),`error`,e)};function B(){return r(`dequeue`,{take:We(n)??Ge(n)}).then(e=>(Ze(n,e,C.isConnected?{box:p,save:O}:void 0),e),()=>void 0)}async function V(){if(T||E||Y.has(n))return;let e=$(w);if(e)return A(e,`error`);let t=B();Y.set(n,t),await H(t)}async function H(e){T=!0,R(),A(se());try{let t=await e;if(!C.isConnected)return;if(!t||t.status===504)return z();if(!t.ok)return A(Xe(t)??t.body.reason??l({status:t.status}),`error`);if(typeof t.body.text!=`string`)return A(ae());let r=N();r!==void 0&&r!==p.value&&(p.value=r),p.value=Je(n,p.value),O(),P(),k(),p.focus(),p.selectionStart=p.selectionEnd=p.value.length,A(oe(),`ok`)}finally{Y.get(n)===e&&Y.delete(n),T=!1,R()}}async function U(e){if(!e.length||T)return;let t=$(w);if(t)return A(t,`error`);A(je(),``);for(let t of e){if(t.size>20971520)return A(ue({name:t.name}),`error`);let e=await ee(t).catch(()=>void 0);if(!e?.ok||typeof e.body.path!=`string`)return A(e?.body.reason??s(),`error`);let n=p.selectionStart??p.value.length,r=p.value.slice(0,n),i=p.value.slice(p.selectionEnd??n),a=`${r&&!/\s$/.test(r)?` `:``}${e.body.path}${/^\s/.test(i)?``:` `}`;p.value=r+a+i,p.selectionStart=p.selectionEnd=n+a.length}A(``),O(),k(),R(),p.focus()}v.onclick=()=>_.click(),_.onchange=()=>void U([..._.files??[]]).finally(()=>_.value=``),p.addEventListener(`paste`,e=>{let t=[...e.clipboardData?.files??[]];t.length&&(e.preventDefault(),U(t))}),C.addEventListener(`dragover`,e=>e.dataTransfer?.types.includes(`Files`)&&e.preventDefault()),C.addEventListener(`drop`,e=>{let t=[...e.dataTransfer?.files??[]];t.length&&(e.preventDefault(),U(t))}),C.addEventListener(`submit`,e=>(e.preventDefault(),L(`send`))),h.onclick=()=>L(`followUp`),g.onclick=()=>j(_e(),ge(),()=>void(T||F(`keys`,{keys:[`esc`]}))),p.addEventListener(`input`,()=>(O(),k(),R())),C.addEventListener(`keydown`,e=>{e.key===`Escape`&&!e.isComposing&&(E||e.target===p&&p.value)&&(e.preventDefault(),E&&(E=!1,A(``),p.focus()))}),p.addEventListener(`keydown`,e=>{e.isComposing||e.keyCode===229||e.key!==`Enter`||e.shiftKey||f&&!e.altKey||(e.preventDefault(),L(e.altKey?`followUp`:`send`))});let W=window.visualViewport,G=()=>[[`--vvh`,W.height],[`--vvt`,W.offsetTop]].forEach(([e,t])=>document.documentElement.style.setProperty(e,`${t}px`));return W&&(W.addEventListener(`resize`,G),W.addEventListener(`scroll`,G),G()),k(),q.has(n)?I(q.get(n)):Y.has(n)?H(Y.get(n)):D(()=>{let e=Be(sessionStorage.getItem(M));sessionStorage.removeItem(M),e?A(e[1],e[0]):We(n)&&z()}),{box:p,update:e=>(w=e,R()),ready:()=>!$(w),takeQueue:V}}var rt=(e,{name:t,mk:n,state:r,online:i,away:a,role:o,head:s})=>({name:t,control:!!e?.control,live:!ee(e,r),mark:n,online:i,away:a,answerable:!!e?.pending?.answer,...tt(e?.service??(s?{state:`absent`,allyRuns:[]}:void 0)),head:!!s,activity:it(e,r,n),ally:!e&&(o===`ally`||o===`run`),run:!e&&o===`run`});function it(e,t,n){let r=d(e,t,n);if(!r)return;let i=e?.note??``;return{text:r,mark:n,kind:i.startsWith(`tool:`)?`tool`:i===`watching a monitor`?`monitoring`:`thinking`}}export{h as a,N as i,nt as n,K as r,rt as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-
|
|
2
|
-
import{G as e}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-CnIOR2a_.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{G as e}from"./index-TakEXnkN.js";var t=[`phone`,`teams`,`server`],n={phone:t=>e(()=>import(`./pair-BnMHeNto.js`).then(e=>e.pairTile(t())),__vite__mapDeps([0]),import.meta.url),teams:()=>e(()=>import(`./link-C1vVN7qZ.js`).then(e=>e.linkTile()),__vite__mapDeps([0]),import.meta.url),server:()=>e(()=>import(`./server-DHcR0bEl.js`).then(e=>e.serverTile()),__vite__mapDeps([0]),import.meta.url)},r=e=>e===`wifi`?[`phone`,`lan`]:[e,`tailscale`];function i(e,i,a=n){let o=t.map(t=>{let n=e.querySelector(`#set-${t}`),r=n.querySelector(`.set-body`);return n.hidden=t!==`teams`&&!i[t],{name:t,box:n,body:r,panel:void 0,loading:!1,turn:0,tab:`tailscale`}}),s=e=>o.find(t=>t.name===e);function c(e,t){let n=s(e);if(t&&(n.tab=t),n.panel)return void(t&&n.panel.select?.(t));if(n.loading)return;let r=++n.turn;n.loading=!0,a[e](()=>n.tab).then(e=>{n.loading=!1,r===n.turn&&(n.panel=e,n.body.replaceChildren(e.body()))},()=>n.loading=!1)}function l(e){let t=s(e);t.turn++,t.loading=!1,t.panel?.closed?.(),t.panel=void 0,t.body.replaceChildren()}for(let e of o)e.box.addEventListener(`toggle`,()=>e.box.open?c(e.name):l(e.name));return{show(e){if(!e)return;let[t,n]=r(e),i=s(t);i.box.hidden||(i.box.open=!0,c(t,n),i.box.scrollIntoView({block:`start`}))},hide(){for(let e of o)e.box.open=!1,l(e.name)}}}export{i as mountSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./sentencepack-DtYqpppS.js";import{t as n}from"./refusal--wJ5SRx-.js";import{n as r,t as i}from"./picker-
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./sentencepack-DtYqpppS.js";import{t as n}from"./refusal--wJ5SRx-.js";import{n as r,t as i}from"./picker-t7Evh2ur.js";import{t as a}from"./open_main_title-DyToxqLu.js";import{t as o}from"./trust-CTyGscJb.js";import{Ft as s,Nt as c,_t as l,at as u,bt as d,q as f,rt as p}from"./index-TakEXnkN.js";var m=((t={},n={})=>(n.locale??e())===`zh-TW`?`基地名稱`:`Base name`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`部署進度`:`Deployment progress`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`回到表單`:`Back to the form`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`建立基地`:`Create the base`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`分割窗格`:`Split a pane`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`開啟分頁`:`Open a tab`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`交付任務`:`Deliver the task`),x=e=>`Failed at “${e?.step}”.`,S=e=>`在「${e?.step}」失敗:`,C=((t,n={})=>(n.locale??e())===`zh-TW`?S(t):x(t)),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`加入稻草網`:`Join the Straw Net`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`基地`:`base`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`單位就緒`:`Unit ready`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`啟動智慧體`:`Start the agent`),O=(e,n)=>t(`deploy_start`,D,e,n),k=e=>`No answer after ${e?.seconds} s. The unit may still open; check the map.`,A=e=>`${e?.seconds} 秒內沒有回應。單位可能仍會開好,請看地圖確認。`,j=((t,n={})=>(n.locale??e())===`zh-TW`?A(t):k(t)),M=e=>`Deploying ${e?.kind} · ${e?.name}`,N=e=>`部署${e?.kind} · ${e?.name}`,P=((t,n={})=>(n.locale??e())===`zh-TW`?N(t):M(t)),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`等你確認是否信任這個資料夾`:`Waiting for your OK to trust this folder`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`第一句指令(選填)`:`First message (optional)`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`在這裡開基地`:`Open the base here`),R=((t={},n={})=>(n.locale??e())===`zh-TW`?`開新基地`:`New base`),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`在這裡開主智慧體`:`Open the main here`),B=(e,n)=>t(`open_main_go`,z,e,n),V=((t={},n={})=>(n.locale??e())===`zh-TW`?`加入成員`:`Add the member`),H=e=>`New member in squad ${e?.tab}`,U=e=>`在小隊 ${e?.tab} 加一位成員`,W=((t,n={})=>(n.locale??e())===`zh-TW`?U(t):H(t)),G=e=>`New member in ${e?.base}`,K=e=>`在 ${e?.base} 加一位成員`,q=((t,n={})=>(n.locale??e())===`zh-TW`?K(t):G(t)),J=((t={},n={})=>(n.locale??e())===`zh-TW`?`基地已經開好,第一位成員已就位。`:`The base is open with its first member.`),Y=e=>`The main is open in a new squad of ${e?.base}.`,X=e=>`已在 ${e?.base} 的新小隊開好主智慧體。`,Z=((t,n={})=>(n.locale??e())===`zh-TW`?X(t):Y(t)),Q=(e,n)=>t(`opened_main`,Z,e,n),ee=e=>`The member is open in ${e?.base}.`,te=e=>`已在 ${e?.base} 加好成員。`,ne=((t,n={})=>(n.locale??e())===`zh-TW`?te(t):ee(t)),re=500,$=12e4,ie={now:()=>Date.now(),every:(e,t)=>(e=>()=>clearInterval(e))(setInterval(e,t)),after:(e,t)=>(e=>()=>clearTimeout(e))(setTimeout(e,t))},ae=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`,oe=e=>{let t=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),n=document.createElementNS(`http://www.w3.org/2000/svg`,`use`);return n.dataset.icon=e,n.setAttribute(`href`,u(e)),t.append(n),t},se=e=>[`create`,`start`,`join`,...e?[`deliver`]:[]];function ce(e){let t=e.clock??ie,r=`deploy-${crypto.randomUUID()}`,i=t=>({create:e.kind===`base`?_():e.split?v():y(),start:O(),trust:F(),join:w(),deliver:b()})[t],a=se(e.hasPrompt).map(e=>({id:e,state:`pending`,ms:0,since:0})),u=`running`,f=!1,m=!1,x=!1,S=``,D=()=>{},k=l(`span`,{class:`deploy-fill`}),A=l(`span`,{class:`deploy-count`}),M=l(`ol`,{class:`deploy-steps`}),N=l(`p`,{class:`deploy-note`,"aria-live":`polite`}),I=l(`button`,{type:`button`,class:`later`},g()),L=l(`h3`,{class:`deploy-title`},oe(e.kind===`main`?`main`:`member`),P({kind:e.kind===`base`?T():e.kind===`main`?p(`role_main`):p(`role_member`),name:e.name})),R=l(`div`,{class:`deploy-trust`}),z=l(`div`,{class:`deploy`,role:`status`,"aria-label":h()},L,l(`div`,{class:`deploy-bar`},k),A,M,R,N,I),B;d.add(r);let V=t=>{if(!t)return void(B&&=(R.replaceChildren(),void 0));let n=!B;B||R.replaceChildren(B=o(t=>e.trust?.(t)??Promise.reject(Error(`no route`)))),B.update(t),n&&R.scrollIntoView?.({block:`end`,behavior:`smooth`})};I.onclick=()=>e.back();let H=new Map,U=()=>{let e=a.filter(e=>e.state===`done`).length;z.dataset.state=u,k.style.setProperty(`--done`,String(e)),k.style.setProperty(`--of`,String(a.length)),A.textContent=`${e}/${a.length}`,a.map(e=>e.id).join()!==[...H.keys()].join()&&(H.clear(),M.replaceChildren(...a.map(e=>{let t=l(`time`,{class:`deploy-time`}),n=l(`li`,{"data-step":e.id},l(`i`,{class:`deploy-mark`}),l(`span`,null,i(e.id)),t);return H.set(e.id,{li:n,at:t}),n})));for(let e of a){let n=H.get(e.id),r=e.state===`active`?t.now()-e.since:e.ms;n.li.dataset.state=e.state,n.at.textContent=e.state===`pending`||e.state===`done`&&r<1e3?``:ae(r)}},W=j({seconds:$/1e3}),G=()=>a.some(e=>e.id===`trust`&&e.state===`active`)?(X(),X=t.after(G,$)):q(void 0,W),K=()=>(d.delete(r),Y(),X()),q=(e,n)=>{if(u!==`running`)return;u=`failed`,K(),x=e===void 0&&n===W;let r=a.find(t=>t.id===e)??a.find(e=>e.state===`active`)??a[0];a=a.map(e=>e===r?{...e,state:`failed`,ms:e.state===`active`?t.now()-e.since:e.ms}:e.state===`active`?{...e,state:`pending`}:e),N.setAttribute(`role`,`alert`),N.textContent=`${C({step:i(r.id)})} ${n}`,U(),I.focus?.()},J=e=>{if(u===`running`){if(a=e.steps.map(e=>({id:e.id,state:e.state,ms:e.ms,since:t.now()-e.ms})),V(e.trust),e.failed)return q(e.failed.step,n(e.failed.reason,e.failed.settings));U()}},Y=t.every(()=>{U(),!f&&(f=!0,e.progress(r).then(e=>{if(!e.ok||u!==`running`)return;let n=JSON.stringify(e.body);n!==S&&(S=n,X(),X=t.after(G,$)),J(e.body)},()=>{}).finally(()=>f=!1))},re),X=t.after(G,$);return e.open(r).then(r=>{if(!(m||u!==`running`&&!(u===`failed`&&x&&r.ok))){if(!r.ok)return q(r.body.step,n(r.body.reason,r.body.settings)??c({status:r.status}));u=`ready`,K(),N.setAttribute(`role`,`status`),N.textContent=E(),a=a.map(e=>({...e,state:`done`,ms:e.state===`active`?t.now()-e.since:e.ms})),U(),e.chime?.(),D=t.after(()=>e.ready(r.body),matchMedia(`(prefers-reduced-motion: reduce)`).matches?600:1500)}},()=>q(void 0,s())),U(),Object.assign(z,{close:()=>(m=!0,K(),D())})}function le(e,t,n){let o=e.kind===`base`?void 0:e.base,s=e.kind===`base`?void 0:e.tab,c=e.kind===`base`?R():e.kind===`main`?a({base:o.label}):s?W({tab:s.label}):q({base:o.label}),u=`open-${e.kind}-${o?.id??``}-${s?.id??``}`,d;return{id:u,title:c,closed:()=>d?.close(),body:()=>{let a=l(`button`,{type:`button`,class:`go`,disabled:``},e.kind===`base`?L():e.kind===`main`?B():V()),c=l(`textarea`,{rows:`3`,placeholder:I()}),p=l(`input`,{type:`text`,maxlength:`64`,placeholder:m(),"aria-label":m()}),h,g=``,_=!1;p.addEventListener(`input`,()=>_=!0);let v=i(o?{workspace:o.id,...s&&{tab:s.id}}:{},(e,t)=>{[h,g,a.disabled]=[e,t,!1],_||(p.value=r(e,t))},()=>(e.kind===`base`?p:c).focus());a.onclick=()=>{if(h===void 0)return;let i=h,a=c.value,l=p.value.trim()||r(i,g),m=e.kind===`base`?{dir:i,label:p.value,prompt:a}:{workspace:o.id,...s&&{tab:s.id},dir:i,prompt:a};x.replaceChildren(d=ce({kind:e.kind,split:e.kind===`member`&&!!s,hasPrompt:!!a.trim(),name:e.kind===`base`?l:r(i,g)||i,chime:n,open:t=>f(`open/${e.kind}`,{...m,deploy:t}),progress:e=>f(`open/progress`,{id:e}),trust:e=>f(`trust/answer`,e),back:()=>x.replaceChildren(...b),ready:n=>{if(c.value=p.value=``,_=!1,x.replaceChildren(...b),t&&typeof n.session==`string`)return t(n.workspace,n.session,u);y.textContent=e.kind===`base`?J():e.kind===`main`?Q({base:o.label}):ne({base:o.label})}}))};let y=l(`p`,{class:`chat-empty`}),b=[v.el,...e.kind===`base`?[l(`label`,{class:`spawn-name`},m(),p)]:[],c,y,a],x=l(`div`,{class:`spawn`},...b);return x}}}function ue(e,t){let n=e.dataset.open;if(n===`base`)return{kind:n};let r=t.find(t=>t.id===e.dataset.ws),i=e.dataset.tab?r?.tabs.find(t=>t.id===e.dataset.tab):void 0;if(!(n!==`main`&&n!==`member`||!r||e.dataset.tab&&!i))return{kind:n,base:{id:r.id,label:r.label},...i&&{tab:{id:i.id,label:i.label}}}}export{ue as openingOf,le as spawnTile};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e}from"./towermodel-BIQTmR-P.js";import{t}from"./runtime-ZX6HkxDa.js";import{l as n,s as r}from"./towerturns-
|
|
1
|
+
import{_ as e}from"./towermodel-BIQTmR-P.js";import{t}from"./runtime-ZX6HkxDa.js";import{l as n,s as r}from"./towerturns-BCVvCBoQ.js";import{_t as i,nn as a,rn as o,yt as s}from"./index-TakEXnkN.js";import{t as c}from"./focusback-DGGGUsJl.js";var l=((e={},n={})=>(n.locale??t())===`zh-TW`?`現在連不上這台機器;連上之後才能送按鍵。`:`This machine cannot be reached right now; keys wait until it can.`),u=e=>`This runs a command in ${e?.name}'s prompt.`,d=e=>`這會在 ${e?.name} 的提示列執行指令。`,f=((e,n={})=>(n.locale??t())===`zh-TW`?d(e):u(e)),p=e=>`Enter runs /${e?.command}, which ends or replaces this session.`,m=e=>`Enter 會執行 /${e?.command},這會結束或取代這個 session。`,ee=((e,n={})=>(n.locale??t())===`zh-TW`?m(e):p(e)),h=e=>`${e?.name}'s prompt could not be read, so Enter may run something else.`,g=e=>`讀不到 ${e?.name} 的提示列,Enter 可能會執行別的東西。`,te=((e,n={})=>(n.locale??t())===`zh-TW`?g(e):h(e)),ne=((e={},n={})=>(n.locale??t())===`zh-TW`?`確認送出`:`Send it`),re=((e={},n={})=>(n.locale??t())===`zh-TW`?`完整終端機`:`Full terminal`),ie=((e={},n={})=>(n.locale??t())===`zh-TW`?`要送進終端機的一行`:`A line for the terminal`),ae=((e={},n={})=>(n.locale??t())===`zh-TW`?`遮住`:`Hide what I type`),oe=((e={},n={})=>(n.locale??t())===`zh-TW`?`執行`:`Run`),_=((e={},n={})=>(n.locale??t())===`zh-TW`?`看起來在問密碼:輸入內容已遮住。`:`Looks like a password prompt: what you type is hidden.`),se=((e={},n={})=>(n.locale??t())===`zh-TW`?`送出中…`:`Sending…`),ce=((e={},n={})=>(n.locale??t())===`zh-TW`?`已送出。`:`Sent.`),le=((e={},n={})=>(n.locale??t())===`zh-TW`?`終端機暫時沒有更新,稍候。`:`The terminal has not updated for a moment; waiting.`),v=e=>`The command waits in ${e?.name}'s prompt.`,y=e=>`指令在 ${e?.name} 的提示列等 Enter。`,ue=((e,n={})=>(n.locale??t())===`zh-TW`?y(e):v(e)),b=((e={},n={})=>(n.locale??t())===`zh-TW`?`連線中…`:`Connecting…`),x=((e={},n={})=>(n.locale??t())===`zh-TW`?`符合寬度`:`Fit width`),S=((e={},n={})=>(n.locale??t())===`zh-TW`?`鍵盤`:`Keyboard`),C=e=>`The mirror ended: ${e?.why}`,w=e=>`鏡像已結束:${e?.why}`,T=((e,n={})=>(n.locale??t())===`zh-TW`?w(e):C(e)),E=((e={},n={})=>(n.locale??t())===`zh-TW`?`等待輸入密碼時隱藏;請在終端機中輸入。`:`Hidden while it waits for a secret; type it in the terminal.`),D=e=>`Live · ${e?.cols}×${e?.rows}`,O=e=>`即時 · ${e?.cols}×${e?.rows}`,k=((e,n={})=>(n.locale??t())===`zh-TW`?O(e):D(e)),A=((e={},n={})=>(n.locale??t())===`zh-TW`?`此分頁隱藏時暫停。`:`Paused while this tab is hidden.`),j=e=>`${e?.why} Open the terminal again to retry.`,M=e=>`${e?.why} 重新開啟終端機即可重試。`,de=((e,n={})=>(n.locale??t())===`zh-TW`?M(e):j(e)),fe=((e={},n={})=>(n.locale??t())===`zh-TW`?`送出 Enter`:`Send Enter`),pe=e=>`Terminal of ${e?.name}, read only`,N=e=>`${e?.name} 的終端機,唯讀`,P=((e,n={})=>(n.locale??t())===`zh-TW`?N(e):pe(e)),F=e=>`Terminal · ${e?.name}`,me=e=>`終端機 · ${e?.name}`,I=((e,n={})=>(n.locale??t())===`zh-TW`?me(e):F(e)),L=((e={},n={})=>(n.locale??t())===`zh-TW`?`要信任這個資料夾嗎?`:`Trust this folder?`),R=((e={},n={})=>(n.locale??t())===`zh-TW`?`◉ 鍵盤直送中 · 按 Shift+Esc 或點外面結束`:`◉ Keyboard goes to the pane · Shift+Esc or a click outside stops it`),z=((e={},n={})=>(n.locale??t())===`zh-TW`?`點這裡後,鍵盤直接送進終端機(Ctrl、Alt、⌘ 組合鍵除外);按 Shift+Esc 放開`:`Click here and the keyboard goes straight to the terminal (except Ctrl, Alt, and ⌘ combinations); Shift+Esc lets it go`);function B(e){let t=new Set(e.flatMap(e=>e.kind===`result`&&e.callId?[e.callId]:[])),n=e.filter(e=>e.kind===`assistant`),r=n.at(-1),i=r?.tools?.find(e=>!t.has(e.id));return{said:(n.findLast(e=>e.text?.trim())?.text?.trim().split(`
|
|
2
2
|
`).filter(Boolean).at(-1))?.slice(0,280),pending:i&&`${i.name} · ${i.summary}`.slice(0,200),at:(r??e.findLast(e=>e.kind!==`result`))?.id}}var V=[`Tab`,`Shift`,`Escape`,`Control`,`Alt`,`Meta`],H=400;function he(e,t,n,r,a,s={}){let c=i(`button`,{type:`button`,class:`pad-yes`},n),l=i(`button`,{type:`button`,class:`pad-no`},o());if(c.onclick=e=>e.isTrusted&&r(),l.onclick=a,e.dataset.tone=`ask`,e.replaceChildren(i(`span`,{class:`pad-ask-why`},t),i(`span`,{class:`pad-ask-acts`},c,l)),!s.enter)return l.focus();let u=globalThis.performance?.now?.()??0,d=!1;c.addEventListener(`keydown`,e=>{(e.key===`Enter`?d||e.repeat||e.timeStamp<u+H:!V.includes(e.key))&&e.preventDefault(),e.key!==`Enter`&&!V.includes(e.key)&&(d=!0,l.focus())}),c.addEventListener(`keyup`,e=>e.key===` `&&e.preventDefault()),c.focus()}var ge=/^\s*\/(quit|exit|new|resume|fork|clone|import|reload)(?=\s|$)/,U=4e3;function _e({post:t,stream:r,...i}){let a=[],o=0,s=!1,c;async function l(c,l){s=!0,i.busy?.(),i.clear?.(),o=Date.now(),i.sent?.(c);try{let e=await t(`keys`,{...c,stream:r(),...l?{confirmed:l}:{}});e.ok?i.taken?.(c):i.failed?.(c,e),e.status===409&&e.body.error===`confirm`&&typeof e.body.confirm==`string`&&`key`in c?(a=[],i.ask?.(c,String(e.body.reason??``),e.body.confirm)):e.ok||(a=[],i.error?.(n(e)))}catch{i.failed?.(c),a=[],i.error?.(e())}finally{s=!1,i.busy?.(),u()}}function u(){if(s||c||!a.length)return;let e=o+130-Date.now();if(e>0)return void(c=setTimeout(()=>(c=void 0,u()),e));l(a.shift())}return{push(e){a.push(e),u()},confirm(e,t){s||l({key:e},t)},text(e){let t=[...e.replace(/[\u0000-\u001f\u007f-\u009f]/g,``)];for(let e of t){let t=a.at(-1);t&&`text`in t&&[...t.text].length<64?t.text+=e:a.push({text:e})}return u(),t.length>0},paste(e){let t=[...e.replace(/\r\n?/g,`
|
|
3
3
|
`).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f]/g,``)];for(let e=0;e<t.length;e+=U)a.push({paste:t.slice(e,e+U).join(``)});return u(),t.length>0},busy:()=>s,queued:()=>a.length}}var W=5e3,G=3e3;function K({post:t,stream:i}){let a=new Map,o,s=()=>{try{return String(JSON.parse(i()).stream??``)}catch{return``}},c=e=>e.watchers.forEach(t=>t.state?.(e.state(),e)),l=(e,t,n=``)=>(Object.assign(e,{phase:t,why:n}),c(e)),u=(e,t)=>(e.ended=!0,l(e,`refused`,t)),d=e=>e.watchers.forEach(e=>e.end?.()),f=(t,r,i=s())=>i&&void(t.queue=t.queue.then(()=>t.post(`mirror`,{stream:i,on:r}).then(e=>r&&!e.ok&&(u(t,n(e)),(e.status===404||e.body.error===`pane_closed`)&&d(t)),()=>r&&u(t,e())))),p=e=>e.ended&&void(e.ended=!1,l(e,`connecting`),f(e,!0)),m=()=>(clearInterval(o),o=a.size&&!document.hidden?setInterval(()=>a.forEach(c),1e3):void 0);return document.addEventListener(`visibilitychange`,()=>(m(),a.forEach(e=>{clearTimeout(e.away),document.hidden?e.away=setTimeout(()=>(e.parked=!0,f(e,!1),l(e,`paused`)),W):e.parked&&(e.parked=!1,f(e,!0))}))),{id:s,retry:e=>p(e),taken:e=>e.watchers.forEach(e=>e.taken?.()),join(e,n){let r=a.get(e);if(r)p(r);else{let n={key:e,post:t(e),rows:[],cols:0,seen:0,phase:`connecting`,why:``,hidden:!1,ended:!1,parked:!1,watchers:new Set,queue:Promise.resolve(),state:()=>n.parked||n.ended||n.stale()?`off`:n.hidden?`hidden`:`live`,stale:()=>Date.now()-n.seen>G};a.set(e,r=n),f(r,!0)}let i=r;return i.watchers.add(n),m(),{conn:i,stop:()=>i.watchers.delete(n)&&!i.watchers.size&&void(clearTimeout(i.away),f(i,!1),a.delete(e),m())}},hello:()=>a.forEach(e=>!e.parked&&!e.ended&&f(e,!0)),frame(e){let t;try{t=JSON.parse(e)}catch{return}let n=a.get(t.key);if(!n)return;if(n.hidden=!!(t.hidden||t.ended),t.ended)return u(n,T({why:r(t.ended)})),d(n);if([n.seen,n.ended]=[Date.now(),!1],t.hidden)return void(n.rows.length=0,n.watchers.forEach(e=>e.rows?.(n.rows,{key:n.key,rows:0},!1)),l(n,`hidden`));let i=Math.min(Math.max(0,Number(t.rows)||0),120);for(;n.rows.length<i;)n.rows.push(``);n.rows.length=i;for(let[e,r]of Array.isArray(t.set)?t.set:[])Number.isInteger(e)&&e>=0&&e<i&&typeof r==`string`&&(n.rows[e]=r);let o=!!(t.whole||t.cols&&t.cols!==n.cols);o&&(n.cols=t.cols||n.cols),n.watchers.forEach(e=>e.rows?.(n.rows,t,o)),l(n,`live`)}}}var q=``,J=[0,95,135,175,215,255],Y=e=>Number.isInteger(e)&&e>=0&&e<=255,X=e=>Y(e)?e<16?e:e<232?`rgb(${J[Math.floor((e-16)/36)]},${J[Math.floor((e-16)/6)%6]},${J[(e-16)%6]})`:`rgb(${8+10*(e-232)},${8+10*(e-232)},${8+10*(e-232)})`:void 0,ve=([e,t,n])=>[e,t,n].every(e=>Y(e))?`rgb(${e},${t},${n})`:void 0;function ye(e,t){let n={...e},r=t.split(`;`);for(let e=0;e<r.length;e++){let t=r[e].split(`:`).map(e=>e===``?0:Number(e)),i=t[0];if(i===38||i===48||i===58){let a=t.length>1?t[1]:Number(r[e+1]),o=t.length>1?t.slice(2):r.slice(e+2,e+(a===5?3:5)).map(Number);t.length===1&&(e+=a===5?2:a===2?4:1);let s=a===5?X(o[0]):a===2?ve(o.slice(-3)):void 0;s!==void 0&&i!==58&&(n[i===38?`fg`:`bg`]=s)}else if(i===0)for(let e of Object.keys(n))delete n[e];else i===1||i===2?n[i===1?`b`:`d`]=!0:i===22?n.b=n.d=!1:i===3||i===23?n.i=i===3:i===4||i===21||i===24?n.u=i!==24&&t[1]!==0:i===7||i===27?n.v=i===7:i===9||i===29?n.s=i===9:i>=30&&i<=37||i>=90&&i<=97?n.fg=i-(i<90?30:82):i>=40&&i<=47||i>=100&&i<=107?n.bg=i-(i<100?40:92):(i===39||i===49)&&delete n[i===39?`fg`:`bg`]}return n}function Z(e){let t=[],n={},r=0,i=e=>{let r=e.replace(/\x1b(\[[0-?]*[ -/]*[@-~]?)?|[\u0000-\u001f\u007f-\u009f]/g,``);if(!r)return;let[i,a]=n.v?[n.bg??`z`,n.fg??`z`]:[n.fg,n.bg],o=[typeof i==`number`||i===`z`?`c${i}`:``,typeof a==`number`||a===`z`?`k${a}`:``,...[`b`,`d`,`i`,`u`,`s`].filter(e=>n[e]).map(e=>`t${e}`)].filter(Boolean).join(` `);t.push({text:r,cls:o,...typeof i==`string`&&i!==`z`&&{fg:i},...typeof a==`string`&&a!==`z`&&{bg:a}})};for(let t of e.matchAll(/\x1b\[([0-9;:]{0,64})m/g))i(e.slice(r,t.index)),n=ye(n,t[1]),r=t.index+t[0].length;return i(e.slice(r)),t}function be(e,t){let n=Math.min(Math.max(0,Number(t.rows)||0),120);for(;e.children.length<n;)e.append(i(`div`,{class:`tr`}));for(;e.children.length>n;)e.lastElementChild.remove();for(let[r,a]of Array.isArray(t.set)?t.set:[])!Number.isInteger(r)||r<0||r>=n||typeof a!=`string`||e.children[r].replaceChildren(...Z(a).map(e=>{if(!e.cls&&!e.fg&&!e.bg)return e.text;let t=i(`span`,e.cls?{class:e.cls}:null,e.text);return e.fg&&(t.style.color=e.fg),e.bg&&(t.style.backgroundColor=e.bg),t}))}function xe({tiles:e,post:t,stream:n,pad:r}){let a=new Map,o=K({post:t,stream:n}),c=e=>void(e.sink.dataset.pad=e.conn.state()),l=e=>e.phase===`live`?[k({cols:e.cols,rows:e.rows.length}),`ok`]:e.phase===`refused`?[de({why:e.why}),`error`]:[e.phase===`hidden`?E():e.phase===`paused`?A():b(),``],u=e=>{let t=e.conn,[n,r]=l(t);e.box.classList.toggle(`stale`,t.stale()),e.box.classList.toggle(`hidden`,t.hidden),e.pad?.update(),c(e),(e.state.textContent!==n||e.state.dataset.tone!==r)&&(e.state.dataset.tone=r,e.state.textContent=n)},d=(e,t=Math.max(e.conn.cols,...[...e.box.children].map(e=>e.textContent?.length??0)))=>e.box.style.fontSize=e.fit.getAttribute(`aria-pressed`)===`true`&&t?`${Math.max(6,Math.floor((e.scroll.clientWidth-20)/(t*.6)))}px`:``,f=(e,t)=>{let n={key:e,box:i(`div`,{class:`term`,role:`group`,"aria-label":P({name:t})}),scroll:i(`div`,{class:`term-scroll`,tabindex:`0`}),state:i(`p`,{class:`term-state`,role:`status`},b()),fit:i(`button`,{type:`button`,class:`cmp-link`,"aria-pressed":`false`},x()),kb:i(`button`,{type:`button`,class:`cmp-link term-kb`,"aria-pressed":`false`},S()),typing:i(`span`,{class:`term-typing`,hidden:``},R()),sink:i(`textarea`,{class:`term-sink`,rows:`1`,"aria-label":z(),inputmode:`text`,enterkeyhint:`enter`,autocomplete:`off`,autocapitalize:`off`,autocorrect:`off`,spellcheck:`false`}),first:!0};n.fit.onclick=()=>(n.fit.setAttribute(`aria-pressed`,String(n.fit.getAttribute(`aria-pressed`)!==`true`)),d(n),requestAnimationFrame(()=>n.scroll.scrollTop=n.scroll.scrollHeight)),n.scroll.append(n.box);{let{sink:e}=n,t=()=>(e.value=q,e.setSelectionRange?.(1,1)),r=()=>e.value.replaceAll(q,``),i=()=>(r=>(a?t():e.value=``,r&&n.pad?.text?.(r)))(r()),a=!1;globalThis.matchMedia?.(`(pointer: fine)`).matches&&(n.scroll.title=z(),n.scroll.addEventListener(`click`,()=>getSelection()?.isCollapsed!==!1&&e.focus({preventScroll:!0}))),n.kb.addEventListener(`mousedown`,e=>e.preventDefault()),n.kb.addEventListener(`click`,()=>a?e.blur():e.focus({preventScroll:!0})),e.addEventListener(`keydown`,t=>t.key===`Escape`&&t.shiftKey?(t.preventDefault(),e.blur(),n.scroll.focus({preventScroll:!0})):n.pad?.type?.(t)&&t.preventDefault()),e.addEventListener(`beforeinput`,e=>{let{inputType:t,isComposing:a}=e,o=t===`deleteContentBackward`&&!r()?`backspace`:t===`insertLineBreak`||t===`insertParagraph`?`enter`:void 0;!a&&o&&(e.preventDefault(),i(),n.pad?.key?.(o))}),e.addEventListener(`input`,e=>!e.isComposing&&i()),e.addEventListener(`compositionend`,i),e.addEventListener(`paste`,e=>(e.preventDefault(),n.pad?.paste?.(e.clipboardData?.getData(`text/plain`)??``))),e.addEventListener(`focus`,()=>{let r=n.scroll.getBoundingClientRect();Object.assign(e.style,{left:`${r.left+12}px`,top:`${Math.min(r.bottom,innerHeight)-28}px`}),a=!0,t(),n.kb.setAttribute(`aria-pressed`,`true`),n.typing.hidden=!1,n.scroll.classList.add(`typing`,`engage`)}),e.addEventListener(`blur`,()=>(a=!1,n.kb.setAttribute(`aria-pressed`,`false`),n.typing.hidden=!0,n.scroll.classList.remove(`typing`,`engage`,`blip`),i())),n.scroll.addEventListener(`animationend`,e=>n.scroll.classList.remove(e.animationName===`term-engage`?`engage`:`blip`))}new ResizeObserver(()=>d(n)).observe(n.scroll),a.set(e,n),Object.assign(n,o.join(e,{rows:(e,t,r)=>(be(n.box,t),r&&d(n),n.first&&t.whole&&(n.first=!1,requestAnimationFrame(()=>n.scroll.scrollTop=n.scroll.scrollHeight))),state:()=>u(n),end:()=>n.end?.(),taken:()=>n.taken?.()}));let{conn:l}=n;return l.rows.length&&be(n.box,{key:e,rows:l.rows.length,set:l.rows.map((e,t)=>[t,e])}),l.phase!==`connecting`&&u(n),n.pad=r?.({key:e,name:t,state:l.state,post:l.post,stream:o.id,blip:()=>s(n.scroll,`blip`),taken:()=>o.taken(l)}),c(n),n.tile={id:`term:${e}`,title:I({name:t}),icon:`comms`,body:()=>i(`div`,{class:`term-tile`},i(`div`,{class:`term-bar`},n.state,n.typing,n.kb,n.fit),n.scroll,n.sink,n.pad?.el),closed:()=>(n.sink.blur(),n.stop(),a.delete(e))}};return{refresh:()=>a.forEach(e=>e.pad?.update()),open(t,n,r=!1){let i=a.get(t);i&&o.retry(i.conn),e.open(i?.tile??f(t,n),!0);let s=a.get(t);r&&s&&globalThis.matchMedia?.(`(pointer: fine)`).matches&&requestAnimationFrame(()=>s.sink.focus({preventScroll:!0}))},embed(e,t,n,{keys:r=!1,end:i,taken:s}={}){let c=a.get(e);c&&o.retry(c.conn);let l=c?.tile??f(e,t),u=a.get(e);return[u.end,u.taken]=[i,s],n.replaceChildren(l.body()),r&&globalThis.matchMedia?.(`(pointer: fine)`).matches&&requestAnimationFrame(()=>u.sink.focus({preventScroll:!0})),()=>(u.end=u.taken=void 0,l.closed?.(),n.replaceChildren())},watch(e,t,{rows:n,state:r,end:i,taken:a}){let s=o.join(e,{rows:n&&(e=>n(e)),state:r,end:i,taken:a});return{...s,retry:()=>o.retry(s.conn)}},id:o.id,hello:o.hello,frame:o.frame}}var Se=/(password|passphrase|passcode|\bpin\b|密碼|口令).{0,80}[::]$/i,Ce=e=>Z(e).map(e=>e.text).join(``).trimEnd(),we=(e,t)=>e.endsWith(t)&&(e.length===t.length||/[$#%>❯]\s+$/.test(e.slice(0,-t.length))),Te=(e,t)=>e.map(Ce).filter(e=>e&&!(t&&we(e,t))).slice(-4),Ee=e=>Se.test(e.map(Ce).findLast(Boolean)??``),Q={on:!1,hand:!1},De=(e,{secret:t,empty:n})=>e.hand?e:t?e.on?e:{on:!0,hand:!1}:e.on&&n?Q:e,Oe=e=>({on:!e.on,hand:!0});function ke(e){let t=e.kind===`pane`;return e.held?`held`:e.ended?t?`gone`:`ended`:e.sending?`sending`:e.confirm===void 0?e.refused||e.phase===`refused`?`refused`:e.phase===`live`?e.stale?`stale`:t&&Ee(e.rows)?`secret`:t&&e.after&&e.after.join(`
|
|
4
4
|
`)!==Te(e.rows).join(`
|