herdr-remote 0.3.35 → 0.3.36
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/chunks/{SJIUJN5L.js → 4CO2WAXZ.js} +1 -1
- package/dist/chunks/{RNFSFKGM.js → 54QMQDOL.js} +1 -1
- package/dist/chunks/{ENJULI6H.js → 67FHQKXM.js} +1 -1
- package/dist/chunks/{JBZYXV5K.js → B6LZOIKD.js} +1 -1
- package/dist/chunks/{CXEZYDSV.js → D3LUHIKR.js} +1 -1
- package/dist/chunks/{CIIAHGYH.js → ETEPTJGZ.js} +1 -1
- package/dist/chunks/{OVCCY2BQ.js → GZIFCN7B.js} +1 -1
- package/dist/chunks/{6Z6GROTK.js → HDHNFESR.js} +1 -1
- package/dist/chunks/{NMQNEH6L.js → HRFNURKU.js} +1 -1
- package/dist/chunks/KEUAW3VO.js +3 -0
- package/dist/chunks/{6H6NEYX7.js → KUDVTWG4.js} +1 -1
- package/dist/chunks/{CLKCCQKG.js → N3C7MVSO.js} +1 -1
- package/dist/chunks/{ZBDFFRB5.js → NYAKZHLQ.js} +1 -1
- package/dist/chunks/{BBRYDVMP.js → ODOBBR6N.js} +1 -1
- package/dist/chunks/{U4MT2N6T.js → PDOEV4QJ.js} +1 -1
- package/dist/chunks/{TARBQM5W.js → QL4I7VLD.js} +1 -1
- package/dist/chunks/{RSLAVKFI.js → QP6NLV4R.js} +2 -2
- package/dist/chunks/{6EGSSNV7.js → VSBBDPSE.js} +1 -1
- package/dist/chunks/{S2CKUJLV.js → W2FYGFNZ.js} +1 -1
- package/dist/chunks/{AQY5SQIR.js → ZUTRSLCH.js} +1 -1
- package/dist/cli.js +4 -4
- package/dist/connector/main.js +1 -1
- package/herdr-plugin.toml +2 -2
- package/node_modules/herdr-remote-relay/package.json +1 -1
- package/package.json +2 -2
- package/dist/chunks/QLOMG2U7.js +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{a as m,c as S}from"./
|
|
3
|
+
import{a as m,c as S}from"./HRFNURKU.js";import{a as x}from"./QRGNEKME.js";import{a as R,b as D,c,f as g}from"./TNLCNVA2.js";import{spawnSync as T}from"node:child_process";import $ from"node:fs";import M from"node:os";import W from"node:path";var k="dev.herdr.remote";function C(){return W.join(M.homedir(),"Library","LaunchAgents",`${k}.plist`)}function n(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function V({nodePath:t=process.execPath,entryPoint:e=m(),label:r=k,outLog:o=g("supervisor"),errLog:i=g("supervisor"),environment:p={}}={}){let u=Object.entries(p).map(([y,v])=>` <key>${n(y)}</key>
|
|
4
4
|
<string>${n(v)}</string>`).join(`
|
|
5
5
|
`),s=u?` <key>EnvironmentVariables</key>
|
|
6
6
|
<dict>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import"./C2UUZY6J.js";import{b as P,c as I}from"./
|
|
3
|
+
import"./C2UUZY6J.js";import{b as P,c as I}from"./B6LZOIKD.js";import"./5RGV2MW6.js";import"./JJGEV4EZ.js";import"./IONXNA5T.js";import"./ZAAEQP3M.js";import{c as a,d as w,g as l,h as M}from"./U6QAYG3E.js";import"./ETEPTJGZ.js";import{o as u}from"./37NKZLLR.js";import{a as y,c as n}from"./KRVF37OW.js";import{a as g}from"./QRGNEKME.js";import"./SWVUDSHP.js";import{c as f,f as m}from"./TNLCNVA2.js";import"./I6NRCYLI.js";import S from"node:fs";import{spawn as v}from"node:child_process";var T=500,k=3e4,A=3e4,d=class{config;state;logToFiles;onEvent;specs;children=new Map;stopping=!1;constructor({config:t=u(),state:s=w(),logToFiles:i=!1,onEvent:e=null,specs:r=null}={}){this.config=t,this.state=s,this.logToFiles=i,this.onEvent=e,this.specs=r}emit(t){this.onEvent&&this.onEvent(t);let s=`[${new Date().toISOString()}] herdr-remote supervisor: ${t.message}
|
|
4
4
|
`;process.stdout.write(s)}async reclaimStrays({timeoutMs:t=5e3}={}){let s=M().filter(e=>e.pid!==process.pid);if(s.length===0)return s;for(let{pid:e,name:r}of s){this.emit({type:"reclaim",name:r,pid:e,message:`stopping stray ${r} from an earlier start (pid ${e})`});try{process.kill(e,"SIGTERM")}catch{}}let i=Date.now()+t;for(;Date.now()<i;){if(s.every(({pid:e})=>!y(e)))return s;await new Promise(e=>{setTimeout(e,100)})}for(let{pid:e,name:r}of n(s)){this.emit({type:"reclaim",name:r,pid:e,message:`stray ${r} (pid ${e}) ignored SIGTERM, killing`});try{process.kill(e,"SIGKILL")}catch{}}return s}async start(){if(this.stopping=!1,g(f()),await this.reclaimStrays(),!this.stopping){for(let t of this.specs??P(this.config,this.state))this.children.set(t.name,{spec:t,child:null,pid:null,restarts:0,backoffMs:T,timer:null}),this.spawnChild(t.name);this.persistPids()}}spawnChild(t){if(this.stopping)return;let s=this.children.get(t);if(!s||s.child)return;let i=["ignore","inherit","inherit"],e=null;this.logToFiles&&(e=S.openSync(m(t),"a"),i=["ignore",e,e]);let r;try{r=v(s.spec.command,s.spec.args,{cwd:s.spec.cwd,env:{...I(),...s.spec.env},windowsHide:!0,stdio:i})}catch(o){this.emit({type:"spawn_failed",name:t,message:`could not start ${t}: ${o.message}`}),this.scheduleRestart(t);return}finally{if(e!==null)try{S.closeSync(e)}catch{}}s.child=r,s.pid=r.pid,s.startedAt=Date.now(),this.emit({type:"started",name:t,pid:r.pid,message:`${t} started (pid ${r.pid})`}),this.persistPids(),r.on("exit",(o,c)=>{let h=Date.now()-(s.startedAt??Date.now());if(s.child=null,s.pid=null,this.persistPids(),!this.stopping){if(o===12){this.emit({type:"replaced",name:t,message:`${t} stood down: another instance owns this workstation. Not restarting it.`});return}if(o===13){this.emit({type:"fatal",name:t,message:`${t} stopped: relay authentication failed. Update credentials before restarting it.`});return}h>=A&&(s.backoffMs=T),this.emit({type:"exited",name:t,code:o,signal:c,message:`${t} exited (${c||`code ${o}`}) after ${Math.round(h/1e3)}s, restarting in ${s.backoffMs}ms`}),this.scheduleRestart(t)}}),r.on("error",o=>{this.emit({type:"error",name:t,message:`${t} error: ${o.message}`})})}scheduleRestart(t){if(this.stopping)return;let s=this.children.get(t);if(!s||s.timer)return;let i=s.backoffMs;s.restarts+=1,s.backoffMs=Math.min(k,Math.round(s.backoffMs*2));let e=setTimeout(()=>{s.timer=null,this.spawnChild(t)},i);s.timer=e,e.unref?.()}persistPids(){try{a(t=>{t.supervisorPid=process.pid,t.relayPid=this.children.get("relay")?.pid||null,t.hostPid=this.children.get("host")?.pid||null,t.startedAt=t.startedAt||new Date().toISOString(),t.mode=this.config.relay.mode,l(t,"supervisor",process.pid);for(let[s,i]of this.children)i.pid&&l(t,s,i.pid)})}catch(t){process.stderr.write(`herdr-remote supervisor: could not persist pids: ${t.message}
|
|
5
5
|
`)}}async stop({graceMs:t=5e3}={}){this.stopping=!0;let s=[];for(let i of this.children.values()){i.timer&&(clearTimeout(i.timer),i.timer=null);let e=i.child;e&&s.push(new Promise(r=>{let o=setTimeout(()=>{try{e.kill("SIGKILL")}catch{}r()},t);o.unref?.(),e.once("exit",()=>{clearTimeout(o),r()});try{e.kill("SIGTERM")}catch{r()}}))}await Promise.all(s);try{a(i=>{i.supervisorPid=null,i.relayPid=null,i.hostPid=null,i.startedAt=null,i.managedPids=n((i.managedPids||[]).filter(Boolean))})}catch{}}};async function x({logToFiles:p=!1}={}){let t=new d({logToFiles:p});return await t.start(),new Promise(s=>{let i=!1,e=async r=>{i||(i=!0,t.emit({type:"shutdown",message:`${r} received, stopping services`}),await t.stop(),s(0))};process.on("SIGINT",()=>{e("SIGINT")}),process.on("SIGTERM",()=>{e("SIGTERM")}),process.on("SIGHUP",()=>{e("SIGHUP")})})}export{T as MIN_BACKOFF_MS,d as Supervisor,x as runForeground};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{a as u,b as f}from"./
|
|
3
|
+
import{a as u,b as f}from"./ODOBBR6N.js";import"./HRFNURKU.js";import{l as p}from"./ETEPTJGZ.js";import{h as d}from"./SWVUDSHP.js";import"./TNLCNVA2.js";import"./I6NRCYLI.js";import{spawnSync as h}from"node:child_process";import S from"node:net";import l from"node:path";var T=2e3;function w(o,n,s,c){return new Promise(a=>{let e="",t=c(o),r=m=>{clearTimeout(i),t.destroy(),a(m)},i=setTimeout(()=>r(!1),T);t.setEncoding("utf8"),t.on("connect",()=>t.write(`${JSON.stringify({stream:n,url:s})}
|
|
4
4
|
`)),t.on("data",m=>{if(e+=m,!!e.includes(`
|
|
5
5
|
`))try{r(JSON.parse(e).ok===!0)}catch{r(!1)}}),t.on("error",()=>r(!1)),t.on("close",()=>r(!1))})}function O(o,n,s){return h(o,n,{stdio:"inherit",env:s}).status??1}function _(o,n,s,c){let a=l.resolve(l.dirname(o)),e=String(s.PATH||"").split(l.delimiter).filter(m=>m&&l.resolve(m)!==a).join(l.delimiter),t=l.basename(o),r=p(e,[t]);if(!r)return process.stderr.write(`herdr-remote: ${t} was not found on PATH
|
|
6
6
|
`),127;let i={...s,PATH:e};return delete i[u],delete i[f],c(r,n,i)}async function A(o,{env:n=process.env,connect:s=S.connect,run:c=O}={}){let[a,...e]=o;if(!a)return 2;let t=n[u],r=n[f],i=e.length===1?d(e[0]):null;return i&&t&&r&&await w(r,t,i,s)?0:_(a,e,n,c)}export{A as runLinkShim};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{a as f,b as I,c as N,d as w,e as k,h as R}from"./5RGV2MW6.js";import{c as E}from"./JJGEV4EZ.js";import{h as U}from"./IONXNA5T.js";import{o as F}from"./ZAAEQP3M.js";import{a as v,b as H,c as D,d as A,g,h as u}from"./U6QAYG3E.js";import{k as x,m as C,n as Y,p as M}from"./
|
|
3
|
+
import{a as f,b as I,c as N,d as w,e as k,h as R}from"./5RGV2MW6.js";import{c as E}from"./JJGEV4EZ.js";import{h as U}from"./IONXNA5T.js";import{o as F}from"./ZAAEQP3M.js";import{a as v,b as H,c as D,d as A,g,h as u}from"./U6QAYG3E.js";import{k as x,m as C,n as Y,p as M}from"./ETEPTJGZ.js";import{d as l,e as p,f as h,g as L,h as O,o as c}from"./37NKZLLR.js";import{a as P}from"./QRGNEKME.js";import{a as T,c as m,f as S}from"./TNLCNVA2.js";import{spawn as b}from"node:child_process";import _ from"node:fs";import{createRequire as j}from"node:module";import y from"node:path";function G(){let e=j(import.meta.url).resolve("herdr-remote-relay/package.json");return y.join(y.dirname(e),"bin","herdr-remote-relay.js")}function J(){return y.join(m(),"relay-auth.json")}function V(e=c(),t=A()){let r=[],s=h(e,R());l(e)&&r.push({name:"relay",command:process.execPath,args:[G()],cwd:m(),env:{RELAY_DEPLOYMENT_MODE:"local",RELAY_BIND:p(e),RELAY_PORT:String(e.relay.port),RELAY_PUBLIC_URL:s,RELAY_PASSWORD:t.hostToken,RELAY_AUTH_STATE_FILE:J(),RELAY_ALLOWED_ORIGINS:(e.relay.allowedOrigins||[]).join(","),RELAY_MAX_CLIENTS_PER_HOST:String(e.relay.maxClientsPerHost),RELAY_MAX_HOSTS:String(e.relay.maxHosts),RELAY_MAX_PENDING_HANDSHAKES:String(e.relay.maxPendingHandshakes),RELAY_MAX_BUFFERED_BYTES_PER_CLIENT:String(e.relay.maxBufferedBytesPerClient),RELAY_HOST_RECONNECT_GRACE_MS:String(e.relay.hostReconnectGraceMs)}});let n=F(),a=U();return r.push({name:"host",command:process.execPath,args:[y.join(T,"dist","connector","main.js")],cwd:m(),env:{...n?{HERDR_TERM_PALETTE_JSON:JSON.stringify(n)}:{},...a?{HERDR_TERM_FONT_JSON:JSON.stringify(a)}:{},RELAY_URL:O(e),RELAY_HOST_ID:t.hostId,RELAY_HOST_TOKEN:t.hostToken,RELAY_PASSWORD:l(e)?t.hostToken:t.relayPassword||"",HERDR_SOCKET_PATH:E(e.herdr.socketPath),HERDR_ARGS_JSON:JSON.stringify(e.herdr.args),HERDR_CWD:e.herdr.cwd,HERDR_BIN_PATH:Y()}}),r}function K(){return{...process.env,HERDR_REMOTE_SERVICE:"1"}}function W(e){P(m());let t=_.openSync(S(e.name),"a");try{let r=b(e.command,e.args,{cwd:e.cwd,env:{...K(),...e.env},detached:!0,windowsHide:!0,stdio:["ignore",t,t]});return r.unref(),r.pid}finally{_.closeSync(t)}}var X={relay:"relayPid",host:"hostPid"};function B(){let e=c(),t=A(),r={...t},s=V(e,t),n=u(r),a=o=>n.some(i=>i.pid===o);for(let o of s){let i=X[o.name];a(r[i])||(r[i]=W(o)??null,g(r,o.name,r[i]))}if(!s.some(o=>o.name==="relay")&&a(r.relayPid)){try{process.kill(r.relayPid,"SIGTERM")}catch{}r.relayPid=null}r.startedAt=r.startedAt||new Date().toISOString(),r.mode=e.relay.mode,H(r);let d=u(r);return{ok:!0,mode:e.relay.mode,relay:{local:l(e),pid:r.relayPid||null,alive:d.some(({pid:o})=>o===r.relayPid),bind:l(e)?p(e):null,port:e.relay.port,remoteUrl:e.relay.remoteUrl||null},host:{pid:r.hostPid||null,alive:d.some(({pid:o})=>o===r.hostPid),socketPath:E(e.herdr.socketPath)},publicUrl:h(e,R())}}function $(){let e=[];return P(m()),D(t=>{let r=u(t).sort((s,n)=>(s.name==="supervisor"?0:1)-(n.name==="supervisor"?0:1));for(let{pid:s,name:n}of r)try{process.kill(s,"SIGTERM"),e.push({name:n,pid:s})}catch(a){process.stderr.write(`herdr-remote: could not stop ${n} (pid ${s}): ${a.message}
|
|
4
4
|
`)}t.hostPid=null,t.relayPid=null,t.supervisorPid=null,t.managedPids=[],t.startedAt=null}),{ok:!0,stopped:e}}function ce(){return $(),B()}async function ue(){let e=c(),t=v(),r=u(t),s=R(),n;try{n=await f(I(e),{timeout:1200})}catch(i){n={ok:!1,message:i.message}}let a=E(e.herdr.socketPath),d=C(),o=d.found?M({command:d.command}):{version:null,supported:!0};return{ok:!0,mode:e.relay.mode,relay:{local:l(e),pid:t.relayPid||null,alive:l(e)?r.some(({pid:i})=>i===t.relayPid):null,bind:l(e)?p(e):null,port:e.relay.port,remoteUrl:e.relay.remoteUrl||null,health:n},host:{pid:t.hostPid||null,alive:r.some(({pid:i})=>i===t.hostPid),hostId:t.hostId||null,socketPath:a,socketExists:!!a&&_.existsSync(a),herdrCommand:d.command,herdrCommandFound:d.found,herdrCommandSource:d.source,herdrVersion:o.version,herdrVersionSupported:o.supported,herdrVersionMinimum:x},publicUrl:h(e,s),startedAt:t.startedAt||null}}async function pe(){let e=c();return l(e)&&B(),await w(e),await k(e),f(`${L(e)}/api/pair/start`,{method:"POST",headers:N(),timeout:5e3})}function he(e,t=40){try{return _.readFileSync(S(e),"utf8").split(`
|
|
5
5
|
`).filter(Boolean).slice(-t)}catch{return[]}}export{G as a,V as b,K as c,B as d,$ as e,ce as f,ue as g,pe as h,he as i};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{e as m,f as S,g as l,h as v,i as h,j as $,k as g,l as x,m as A}from"./
|
|
3
|
+
import{e as m,f as S,g as l,h as v,i as h,j as $,k as g,l as x,m as A}from"./4CO2WAXZ.js";import"./HRFNURKU.js";import"./ETEPTJGZ.js";import"./QRGNEKME.js";import"./SWVUDSHP.js";import"./TNLCNVA2.js";import"./I6NRCYLI.js";import{spawnSync as f}from"node:child_process";import P from"node:fs";var y=3;function I({id:n,account:t}){let r=l(n),e=l(t);return`$ErrorActionPreference = 'Stop'
|
|
4
4
|
$password = [Console]::In.ReadLine()
|
|
5
5
|
$service = Get-CimInstance -ClassName Win32_Service -Filter "Name='${r}'"
|
|
6
6
|
$result = Invoke-CimMethod -InputObject $service -MethodName Change -Arguments @{ StartName = '${e}'; StartPassword = $password }
|
|
@@ -2,4 +2,4 @@ import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
3
|
import{q as b,r as Q,s as G,t as K}from"./SWVUDSHP.js";import{a as E,c as Z}from"./TNLCNVA2.js";import h from"node:fs";import w from"node:path";var Ae=["EBUSY","EPERM","EACCES"];function ee(e){return/\b(EBUSY|EPERM)\b/.test(e??"")}function $e(e,t,o){try{o(e,t)}catch(n){if(!Ae.includes(n.code??""))throw n;h.renameSync(t,`${t}.${process.pid}.old`),o(e,t)}}function P(e,t,o=h.copyFileSync,n=new Set){h.mkdirSync(t,{recursive:!0});let s=new Set;for(let r of h.readdirSync(e,{withFileTypes:!0})){s.add(r.name.toLowerCase());let i=w.join(e,r.name),c=w.join(t,r.name),a=h.lstatSync(c,{throwIfNoEntry:!1});a&&a.isDirectory()!==r.isDirectory()&&h.rmSync(c,{recursive:!0,force:!0}),r.isDirectory()?P(i,c,o,n):$e(i,c,o)}for(let r of h.readdirSync(t))if(!(s.has(r.toLowerCase())||n.has(w.join(t,r))))try{h.rmSync(w.join(t,r),{recursive:!0,force:!0})}catch{}}async function re(e,t,{target:o=E,stage:n=w.join(Z(),"update-stage"),platform:s=process.platform}={}){h.rmSync(n,{recursive:!0,force:!0});try{let r=await t([...e,"--prefix",n]);if(!r.ok)return r;let i=s==="win32"?w.join(n,"node_modules"):w.join(n,"lib","node_modules");try{P(w.join(i,w.basename(o)),o)}catch(c){return{ok:!1,output:`${r.output}
|
|
4
4
|
${c.message}`}}return r}finally{try{h.rmSync(n,{recursive:!0,force:!0})}catch{}}}import H from"node:fs";import z from"node:path";import{spawn as Fe}from"node:child_process";import{createRequire as Me}from"node:module";import Te from"node:fs";import te from"node:path";function ve({args:e,platform:t=process.platform,env:o=process.env,execPath:n=process.execPath,exists:s=Te.existsSync}){if(t!=="win32")return{command:"npm",args:e};let r=o.npm_execpath;if(r&&/npm-cli\.js$/i.test(r)&&s(r))return{command:n,args:[r,...e]};let i=te.join(te.dirname(n),"node_modules","npm","bin","npm-cli.js");return s(i)?{command:n,args:[i,...e]}:null}function Y(e,t,o,n={}){return new Promise(s=>{let r;try{let l=ve({args:t,...n});if(!l){s({ok:!1,spawnFailed:!0,output:"npm-cli.js was not found next to this Node.js; run npm install -g herdr-remote yourself."});return}r=e(l.command,l.args,{timeout:o,windowsHide:!0})}catch(l){s({ok:!1,spawnFailed:!0,output:String(l?.message||l)});return}let i="",c=!1,a=l=>{c||(c=!0,s(l))},u=l=>{i+=String(l)};r.stdout?.on("data",u),r.stderr?.on("data",u),r.on("error",l=>a({ok:!1,spawnFailed:!0,output:l.message})),r.on("close",l=>a({ok:l===0,output:i.trim()}))})}import p from"node:fs";import{createRequire as Pe}from"node:module";import y from"node:path";import N from"node:fs";import O from"node:path";import xe from"node:zlib";var _=512;function A(e,t,o){let n=e.subarray(t,t+o),s=n.indexOf(0);return n.subarray(0,s===-1?o:s).toString("utf8")}function ne(e,t,o){let n=A(e,t,o).trim();return n?Number.parseInt(n,8):0}function je(e){let t=null,o=0;for(;o<e.length;){let n=e.indexOf(32,o);if(n===-1)break;let s=Number.parseInt(e.subarray(o,n).toString("utf8"),10);if(!(s>0))break;let r=e.subarray(n+1,o+s-1).toString("utf8"),i=r.indexOf("=");r.slice(0,i)==="path"&&(t=r.slice(i+1)),o+=s}return t}function oe(e,t){let o=xe.gunzipSync(e),n=O.resolve(t);N.mkdirSync(n,{recursive:!0});let s=null,r=0;for(;r+_<=o.length;){let i=o.subarray(r,r+_);if(i.every(f=>f===0))break;let c=ne(i,124,12),a=String.fromCharCode(i[156]||48),u=o.subarray(r+_,r+_+c);if(u.length<c)throw new Error("truncated release archive");if(r+=_+Math.ceil(c/_)*_,a==="x"){s=je(u);continue}if(a==="L"){s=A(u,0,u.length);continue}if(a==="g")continue;let l=A(i,345,155),g=s??(l?`${l}/${A(i,0,100)}`:A(i,0,100));s=null;let x=g.replace(/^package\//,"");if(x===g)throw new Error(`unexpected path in release archive: ${g}`);let m=O.resolve(n,x);if(m!==n&&!m.startsWith(`${n}${O.sep}`))throw new Error(`path escapes the release archive: ${g}`);if(a==="5")N.mkdirSync(m,{recursive:!0});else if(a==="0"){N.mkdirSync(O.dirname(m),{recursive:!0});let f=ne(i,100,8)&73?493:420;N.writeFileSync(m,u,{mode:f})}else throw new Error(`unsupported entry type '${a}' in release archive: ${g}`)}}var Ne=["EBUSY","EPERM","EACCES"];function U(e){try{return JSON.parse(p.readFileSync(y.join(e,"package.json"),"utf8"))}catch{return null}}function ie(e){let t=new Set(e.bundleDependencies??[]);return Object.entries(e.dependencies??{}).filter(([o])=>!t.has(o))}function Oe(e,t,o){if(JSON.stringify(e.bin)!==JSON.stringify(t.bin))return!1;let n=Pe(y.join(o,"package.json")).resolve;return ie(t).every(([s,r])=>{if(e.dependencies?.[s]!==r)return!1;try{return n(`${s}/package.json`),!0}catch{return!1}})}function Ce(e,t){let o=[],n=ie(e).map(([s])=>s);for(;n.length>0;){let s=n.shift(),r=y.join(t,"node_modules",s);if(o.includes(s)||!p.existsSync(r))continue;o.push(s);let i=U(r);n.push(...Object.keys({...i?.dependencies,...i?.optionalDependencies}))}return o}async function He(e,t,o){let n=new AbortController,s=setTimeout(()=>n.abort(),o);try{let r=await t(e,{signal:n.signal,headers:{Accept:"application/octet-stream"}});if(!r.ok)throw new Error(`${e}: HTTP ${r.status??"?"}`);return Buffer.from(await r.arrayBuffer())}catch(r){throw r.name==="AbortError"?new Error(`${e}: timed out`):r}finally{clearTimeout(s)}}function se(e,t,o){for(let n of e){let s=y.join(o,"node_modules",n);p.mkdirSync(y.dirname(s),{recursive:!0}),p.renameSync(y.join(t,"node_modules",n),s)}}function Ie(e,t,o,n){let s=`${t}.previous-${process.pid}`;try{p.renameSync(t,s)}catch(r){let i=r.code??"";if(n!=="win32"||!Ne.includes(i))throw r;let c=new Set(o.map(a=>y.join(t,"node_modules",a)));P(e,t,p.copyFileSync,c);return}try{se(o,s,e),p.renameSync(e,t)}catch(r){try{for(let i of o)p.existsSync(y.join(e,"node_modules",i))&&se([i],e,s);p.renameSync(s,t)}catch{}throw r}try{p.rmSync(s,{recursive:!0,force:!0})}catch{}}async function ce({url:e,version:t,target:o=E,fetchImpl:n=globalThis.fetch,timeoutMs:s=18e4,platform:r=process.platform}){let i=y.join(y.dirname(o),`.herdr-remote-update-${process.pid}`);try{p.rmSync(i,{recursive:!0,force:!0}),oe(await He(e,n,s),i);let c=U(i),a=U(o);return c?.name!=="herdr-remote"||t&&c.version!==t?{ok:!1,output:`${e} is not herdr-remote ${t??""}`.trim()}:!a||!Oe(a,c,o)?{ok:!1,needsNpm:!0,output:"the release changes installed dependencies"}:(Ie(i,o,Ce(c,o),r),{ok:!0,output:`installed ${c.version} from ${e}`})}catch(c){return{ok:!1,output:String(c?.message||c)}}finally{try{p.rmSync(i,{recursive:!0,force:!0})}catch{}}}import De from"node:fs";import Le from"node:os";import ae from"node:path";var ue="herdr-remote",fe="https://registry.npmjs.org",pe="https://registry.npmmirror.com";function C(e){if(typeof e!="string")return null;let t=e.trim().replace(/\/+$/,"");return/^https?:\/\//i.test(t)?t:null}function le(e){let t;try{t=De.readFileSync(e,"utf8")}catch{return null}let o=null;for(let n of t.split(/\r?\n/)){let s=n.trim();if(!s||s.startsWith("#")||s.startsWith(";"))continue;let r=/^registry\s*=\s*(.+)$/i.exec(s);r&&(o=C(r[1].replace(/^["']|["']$/g,"")))}return o}function me({env:e=process.env,home:t=Le.homedir(),cwd:o=process.cwd()}={}){let n=[],s=r=>{let i=C(r);i&&!n.includes(i)&&n.push(i)};return s(e.npm_config_registry),s(e.NPM_CONFIG_REGISTRY),s(e.HERDR_REMOTE_REGISTRY),s(le(ae.join(o,".npmrc"))),s(le(ae.join(t,".npmrc"))),s(fe),s(pe),n}async function de(e,{timeoutMs:t,fetchImpl:o}){let n=new AbortController,s=setTimeout(()=>n.abort(),t);try{let r=await o(e,{signal:n.signal,headers:{Accept:"application/json","Cache-Control":"no-cache"}});return r.ok?{ok:!0,body:await r.json()}:{ok:!1,message:`HTTP ${r.status??"?"}`}}catch(r){let i=r;return{ok:!1,message:i?.name==="AbortError"?"timed out":String(i?.message||r)}}finally{clearTimeout(s)}}async function he(e,{timeoutMs:t,fetchImpl:o}){let n=[{url:`${e}/-/package/${ue}/dist-tags`,read:r=>r?.latest},{url:`${e}/${ue}/latest`,read:r=>r?.version}],s=null;for(let r of n){let i=await de(r.url,{timeoutMs:t,fetchImpl:o});if(!i.ok){s=i.message;continue}let c=r.read(i.body);if(typeof c=="string"&&c)return{ok:!0,latest:c};s="registry answered without a version"}return{ok:!1,message:s}}var V=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;async function ye(e,{timeoutMs:t,fetchImpl:o}){let n=await de(e,{timeoutMs:t,fetchImpl:o});if(!n.ok)return n;let s=n.body?.version;return typeof s=="string"&&V.test(s)?{ok:!0,latest:s}:{ok:!1,message:"release manifest has no version"}}var Be="herdr-remote",Ge="herdr-remote-relay";function Ke(){try{return JSON.parse(H.readFileSync(z.join(E,"package.json"),"utf8")).version}catch{return"0.0.0"}}function Nr(){try{let e=Me(import.meta.url).resolve(`${Ge}/package.json`);return JSON.parse(H.readFileSync(e,"utf8")).version}catch{return null}}function we(){let e=E;if(!e.split(z.sep).includes("node_modules"))return"source";try{if(H.lstatSync(e).isSymbolicLink())return"linked"}catch{}return"npm"}function Or(e=process.env){return e.HERDR_REMOTE_UPDATE_CHECK!=="0"}function Cr(){return we()==="npm"}function $(e,t){let o=r=>String(r).split("-")[0].split(".").map(i=>Number.parseInt(i,10)||0),n=o(e),s=o(t);for(let r=0;r<Math.max(n.length,s.length);r+=1){let i=(n[r]||0)-(s[r]||0);if(i>0)return 1;if(i<0)return-1}return 0}async function Hr({timeoutMs:e=6e3,fetchImpl:t=globalThis.fetch,registries:o,releaseManifest:n=Q,current:s=Ke()}={}){let r=(u,l)=>({ok:!0,current:s,latest:u,source:l,updateAvailable:$(u,s)>0}),i=[];if(n){let u=await ye(n,{timeoutMs:e,fetchImpl:t});if(u.ok)return r(u.latest,b);i.push(`${b}: ${u.message??""}`)}let c=await Promise.all((o??me()).map(async u=>({source:u,...await he(u,{timeoutMs:e,fetchImpl:t})}))),a=null;for(let u of c)u.ok?(!a||$(u.latest,a.latest)>0)&&(a=u):i.push(`${u.source}: ${u.message??""}`);return a?r(a.latest,a.source):{ok:!1,current:s,errorKey:"update.errorNetwork",message:i.join("; ")}}function Ye(e){let t=String(e||"").split(/\r?\n/).map(o=>o.trim()).filter(o=>/^npm (error|ERR!)/.test(o)&&!/complete log of this run/i.test(o)).map(o=>o.replace(/^npm (error|ERR!)\s*/,"")).filter(Boolean);return(t.length>0?t.slice(0,3):String(e||"").trim().split(/\r?\n/).slice(-3)).join(" ")}function Ue(e){return/\bETARGET\b|notarget|No matching version found/i.test(String(e||""))}function Ve(){try{return JSON.parse(H.readFileSync(z.join(E,"package.json"),"utf8")).version}catch{return null}}function Se(e,t,o){let n=o();return e&&n&&$(n,e)<0?{ok:!1,errorKey:"update.errorNotApplied",installed:n,output:t.slice(-2e3)}:{ok:!0,installed:n,output:t.slice(-2e3)}}async function Ir({spawnImpl:e=Fe,timeoutMs:t=18e4,installKindImpl:o=we,source:n="",version:s=null,attempts:r=3,retryDelayMs:i=15e3,sleep:c=m=>new Promise(f=>setTimeout(f,m)),readInstalledVersion:a=Ve,onAttempt:u=()=>{},platform:l=process.platform,inPlace:g=re,installReleaseImpl:x=ce}={}){let m=o();if(m!=="npm")return{ok:!1,errorKey:`update.cannot.${m}`};let f=typeof s=="string"&&V.test(s)?s:null,D=C(n),L,X="";if(!D||D===b){u({source:b,attempt:1});let k=f?K(f):G,R=await x({url:k,version:f,platform:l});if(R.ok)return Se(f,R.output,a);L=R.needsNpm?[b,""]:[""],X=`${k}: ${R.output}
|
|
5
|
-
`}else L=[D];let F={ok:!1,output:""},M=!1;for(let k of L){let R=k===b,B=R?["install","-g",f?K(f):G]:["install","-g",`${Be}@${f||"latest"}`,"--prefer-online"];k&&!R&&B.push("--registry",k);for(let j=1;j<=r;j+=1){u({source:k,attempt:j});let d=await Y(e,B,t);if(!d.ok&&l==="win32"&&ee(d.output)&&(d=await g(B,_e=>Y(e,_e,t))),d.ok)return Se(f,d.output,a);if(F=d,d.spawnFailed)return{ok:!1,errorKey:"update.errorFailed",output:d.output,summary:d.output};if(M=Ue(d.output),!M)break;j<r&&await c(i)}}return{ok:!1,errorKey:M?"update.errorNotYetPublished":"update.errorFailed",output:`${X}${String(F.output||"")}`.slice(-2e3),summary:Ye(F.output)}}import J from"node:fs";import q from"node:os";import S from"node:path";import{spawnSync as ze}from"node:child_process";var T="herdr",Ee="0.9.
|
|
5
|
+
`}else L=[D];let F={ok:!1,output:""},M=!1;for(let k of L){let R=k===b,B=R?["install","-g",f?K(f):G]:["install","-g",`${Be}@${f||"latest"}`,"--prefer-online"];k&&!R&&B.push("--registry",k);for(let j=1;j<=r;j+=1){u({source:k,attempt:j});let d=await Y(e,B,t);if(!d.ok&&l==="win32"&&ee(d.output)&&(d=await g(B,_e=>Y(e,_e,t))),d.ok)return Se(f,d.output,a);if(F=d,d.spawnFailed)return{ok:!1,errorKey:"update.errorFailed",output:d.output,summary:d.output};if(M=Ue(d.output),!M)break;j<r&&await c(i)}}return{ok:!1,errorKey:M?"update.errorNotYetPublished":"update.errorFailed",output:`${X}${String(F.output||"")}`.slice(-2e3),summary:Ye(F.output)}}import J from"node:fs";import q from"node:os";import S from"node:path";import{spawnSync as ze}from"node:child_process";var T="herdr",Ee="0.9.5",Je=["~/.local/bin","~/.cargo/bin","~/bin","/opt/homebrew/bin","/usr/local/bin","/home/linuxbrew/.linuxbrew/bin","/usr/bin"];function qe(e,t){return e==="~"?t:e.startsWith("~/")?S.join(t,e.slice(2)):e}function v(e=T,t=process.platform){return t!=="win32"?[e]:[/\.exe$/i.test(e)?e:`${e}.exe`]}function I(e){try{return J.statSync(e).isFile()?(J.accessSync(e,J.constants.X_OK),!0):!1}catch{return!1}}function W(e,t=v()){if(!e)return null;for(let o of t){let n=S.join(e,o);if(I(n))return n}return null}function ge(e,t=v()){for(let o of String(e||"").split(S.delimiter)){let n=W(o.trim(),t);if(n)return n}return null}function ke(e=q.homedir(),t=process.platform,o=process.env){return t==="win32"?[S.join(o.LOCALAPPDATA||S.join(e,"AppData","Local"),"Programs","Herdr","bin"),S.join(e,".cargo","bin"),S.join(e,"scoop","shims")]:Je.map(n=>qe(n,e))}function Re(e){return e.includes("/")||e.includes(S.sep)}function We(e,t,o){let n=String(e||"").trim();if(!n)return null;if(Re(n)){let s=S.resolve(n);if(I(s))return s;if(o==="win32"&&S.extname(s)===""){let r=`${s}.exe`;if(I(r))return r}return W(s,v(T,o))}return ge(t,v(n,o))}function be({env:e=process.env,home:t=q.homedir(),platform:o=process.platform,directories:n=ke(t,o,e)}={}){let s=v(T,o),r=We(e.HERDR_BIN_PATH,e.PATH,o);if(r)return{command:r,source:"env",found:!0};let i=ge(e.PATH,s);if(i)return{command:i,source:"path",found:!0};for(let c of n){let a=W(c,s);if(a)return{command:a,source:"fallback",found:!0}}return{command:T,source:"unresolved",found:!1}}function Xe(e){return be(e).command}function Kr(e,t={}){return typeof e=="string"&&Re(e)&&I(e)?{command:e,source:"verified",found:!0}:be(t)}function Ze(e){let t=/(\d+)\.(\d+)\.(\d+)/.exec(String(e||""));return t?`${t[1]}.${t[2]}.${t[3]}`:null}function Qe(e,t=Ee){return e?$(e,t)>=0:!0}function Yr({command:e,timeout:t=1e4,...o}={}){let n=e||Xe(o),s={command:n,version:null,raw:null,supported:!0,ok:!1},r;try{r=ze(n,["--version"],{encoding:"utf8",timeout:t,windowsHide:!0})}catch{return s}if(r.error||r.status!==0&&r.status!==1)return s;let i=`${r.stdout||""}${r.stderr||""}`.trim(),c=Ze(i);return{command:n,version:c,raw:i||null,supported:Qe(c),ok:!0}}function Ur(e){return`Herdr ${e} is older than ${Ee}, which herdr-remote is written against. Run "herdr update" \u2014 window titles, large pastes, taps on a pane, Alt shortcuts, typing over a slow link and agent alerts all misbehave in browser windows before that release.`}function Vr({env:e=process.env,home:t=q.homedir(),platform:o=process.platform,directories:n=ke(t,o,e)}={}){let s=String(e.HERDR_BIN_PATH||"").trim(),r=[`Herdr executable "${T}" was not found.`];return s&&r.push(`HERDR_BIN_PATH=${s} does not point at an executable.`),r.push(n.length?`Searched PATH and ${n.join(", ")}.`:"Searched PATH."),r.push("Install Herdr or set HERDR_BIN_PATH to its full path, then restart herdr-remote."),r.join(" ")}export{ee as a,Ke as b,Nr as c,we as d,Or as e,Cr as f,$ as g,Hr as h,Ve as i,Ir as j,Ee as k,ge as l,be as m,Xe as n,Kr as o,Yr as p,Ur as q,Vr as r};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{a,b,c,d,e,f,g,h,i}from"./
|
|
3
|
+
import{a,b,c,d,e,f,g,h,i}from"./B6LZOIKD.js";import"./5RGV2MW6.js";import"./JJGEV4EZ.js";import"./IONXNA5T.js";import"./ZAAEQP3M.js";import"./U6QAYG3E.js";import"./ETEPTJGZ.js";import"./37NKZLLR.js";import"./KRVF37OW.js";import"./QRGNEKME.js";import"./SWVUDSHP.js";import"./TNLCNVA2.js";import"./I6NRCYLI.js";export{c as baseEnvironment,h as pair,i as readLogTail,a as relayBinPath,f as restartServices,b as serviceSpecs,d as startServices,g as statusServices,e as stopServices};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{a as M,b as O}from"./
|
|
3
|
+
import{a as M,b as O}from"./KEUAW3VO.js";import{h as I}from"./QOPTXTL7.js";import{b as g}from"./JJGEV4EZ.js";import{a as x}from"./HRFNURKU.js";import R from"node:net";var H=1e4,B=8*1024*1024,v=1e3,N=1e4,T=0;function L(r,t,n={},a={}){let{timeout:c=H,connect:o=R.connect}=a;T+=1;let m=`herdr-remote:${T}`;return new Promise((y,p)=>{let i,s="",h=!1,l=(e,u)=>{h||(h=!0,clearTimeout(w),i&&(i.removeAllListeners(),i.destroy()),e?p(e):y(u))},w=setTimeout(()=>l(new Error(`Herdr API did not answer ${t} in time`)),c);typeof w.unref=="function"&&w.unref();try{i=o(g(r))}catch(e){l(e);return}let f=i;f.setEncoding("utf8"),f.on("connect",()=>{f.write(`${JSON.stringify({id:m,method:t,params:n})}
|
|
4
4
|
`)}),f.on("data",e=>{if(s+=e,s.length>B){l(new Error("Herdr API sent an oversized response"));return}let u=s.indexOf(`
|
|
5
5
|
`);if(u===-1)return;let d;try{d=JSON.parse(s.slice(0,u))}catch{l(new Error("Herdr API sent a line that is not JSON"));return}if(d.error){let b=Object.assign(new Error(d.error.message||"Herdr API request failed"),{code:d.error.code||"herdr_api_error"});l(b);return}l(null,d.result)}),f.on("error",e=>l(e)),f.on("close",()=>l(new Error(`Herdr API closed before answering ${t}`)))})}function z(r,t,n,a={}){let{connect:c=R.connect,retryBaseMs:o=v,retryMaxMs:m=N,onStarted:y}=a,p=null,i=null,s=null,h=0,l=!1,w=()=>{if(l||i)return;let e=Math.min(o*2**h,m);h+=1,i=setTimeout(()=>{i=null,f()},e),typeof i.unref=="function"&&i.unref()},f=()=>{if(l)return;let e;try{e=c(g(r))}catch{w();return}p=e;let u="",d=null,b=!1,A=()=>{s&&clearTimeout(s),s=null};e.setEncoding("utf8"),e.on("connect",()=>{T+=1,d=`herdr-remote:subscription:${T}`,e.write(`${JSON.stringify({id:d,method:"events.subscribe",params:{subscriptions:t}})}
|
|
6
6
|
`),s=setTimeout(()=>e.destroy(),H),typeof s.unref=="function"&&s.unref()}),e.on("data",k=>{if(u+=k,Buffer.byteLength(u,"utf8")>B){e.destroy();return}let E=u.indexOf(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{m as c}from"./
|
|
3
|
+
import{m as c}from"./ETEPTJGZ.js";import{a as s}from"./TNLCNVA2.js";import f from"node:os";import i from"node:path";function h(){return i.join(s,"bin","herdr-remote.js")}function p({env:o=process.env,herdrCommand:e=null}={}){let n=String(o.PATH||"").split(i.delimiter).map(r=>r.trim()).filter(Boolean);return e&&n.push(i.dirname(e)),[...new Set(n)].join(i.delimiter)}function P({env:o=process.env,home:e=f.homedir(),directories:n}={}){let r={},t=c({env:o,home:e,...n?{directories:n}:{}});t.found&&(r.HERDR_BIN_PATH=t.command);let m=p({env:o,herdrCommand:t.found?t.command:null});return m&&(r.PATH=m),r}export{h as a,p as b,P as c};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
|
+
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
+
var m={"app.name":"Herdr Remote","app.tagline":"Remote browser access to Herdr workspaces","common.yes":"Yes","common.no":"No","common.on":"on","common.off":"off","common.none":"none","common.auto":"auto","common.unknown":"unknown","common.running":"running","common.stopped":"stopped","common.connected":"connected","common.disconnected":"disconnected","common.installed":"installed","common.notInstalled":"not installed","common.enabled":"enabled","common.disabled":"disabled","common.loading":"Working\u2026","common.save":"Save settings","common.saved":"Configuration saved to {path}","common.back":"Back","common.cancel":"Cancel","common.confirm":"Confirm","common.pid":"pid {pid}","common.notApplicable":"n/a","nav.overview":"Overview","nav.pair":"Pair a device","nav.services":"Services","nav.relay":"Relay","nav.keepalive":"Keep-alive","nav.herdr":"Herdr","nav.about":"Language & about","mode.local":"This machine only","mode.lan":"Local network / Tailscale","mode.official":"Official relay","mode.remote":"Self-hosted relay","mode.local.description":"Relay listens on 127.0.0.1. Local browser only.","mode.lan.description":"Relay listens on 0.0.0.0. Accessible over LAN or Tailscale.","mode.official.description":"Connect via official relay. No server needed.","mode.remote.description":"Connect via self-hosted relay for external access.","overview.title":"Status","overview.mode":"Access mode","overview.relay":"Relay","overview.host":"Host connector","overview.socket":"Herdr socket","overview.webUrl":"Web UI","overview.keepalive":"Keep-alive","overview.devices":"Browsers","overview.hosts":"Workstations","overview.uptime":"Relay uptime","overview.relayLocal":"local, {bind}:{port}","overview.relayRemote":"remote, {url}","overview.socketMissing":"not found \u2014 is Herdr running?","overview.unreachable":"unreachable: {message}","overview.notStarted":"Services not running. Open Services tab to start.","pair.title":"Pair a device","pair.generate":"Generate pairing code","pair.regenerate":"Regenerate code","pair.working":"Generating pairing code\u2026","pair.code":"Pairing code","pair.url":"Access URL","pair.expires":"Expires in {minutes} (at {time})","pair.expired":"Code expired. Generate a new one.","pair.instructions":"Open URL and enter code to pair.","pair.qrHint":"Scan QR code to open URL.","pair.qrUnavailable":"Terminal too narrow for QR code; use URL above.","pair.failed":"Could not create pairing code: {message}","pair.hostOffline":"Relay has no workstation connected. Start services first.","services.title":"Services","services.start":"Start services","services.stop":"Stop services","services.restart":"Restart services","services.started":"Services started.","services.stopped":"Services stopped.","services.restarted":"Services restarted.","services.startFailed":"Could not start services: {message}","services.stopFailed":"Could not stop services: {message}","services.unsavedBlocked":"Unsaved changes. Save before restarting.","services.managedNotice":"Managed by {manager}; applied via keep-alive service.","services.logs":"Recent logs","services.logEmpty":"No logs.","services.logRelay":"Relay","services.logHost":"Host connector","adminBroker.windowsOnly":"The administrator terminal broker only runs on Windows.","adminBroker.needsElevation":"Open the Windows TUI and choose Set up admin terminal access. Approve the one-time Windows prompt under the same account as Herdr Remote.","adminBroker.busy":"An admin terminal is open; close it before restarting the broker.","adminBroker.title":"Admin terminal broker","adminBroker.checking":"Checking\u2026","adminBroker.ready":"Ready","adminBroker.notReady":"Not configured or stopped","adminBroker.install":"Set up admin terminal access","adminBroker.uninstall":"Remove admin terminal access","adminBroker.installDone":"Admin terminal broker setup task registered.","adminBroker.uninstallDone":"Admin terminal broker setup task removed.","adminBroker.elevationCancelled":"Administrator approval was declined; no changes were made.","adminBroker.setupFailed":"Could not configure the administrator terminal broker.","adminBroker.tuiHint":"Set this up once. Windows asks for administrator approval; later WebUI admin terminals open without UAC.","adminShell.needsTerminal":"admin-shell must run in a terminal.","adminShell.brokerUnavailable":"The administrator terminal broker is not running. Open the herdr-remote TUI, go to Keep-alive, and choose Set up admin terminal access.","adminShell.tabLabel":"Admin","relay.title":"Relay settings","relay.settings":"Settings","relay.locked":"fixed","relay.officialFixed":"The official relay address is fixed and cannot be edited.","relay.officialHint":"Official relay: address is fixed and no password is needed.","relay.password":"Relay password","relay.passwordHint":"Must match RELAY_PASSWORD on relay. Leave empty if public.","relay.passwordSet":"set","relay.passwordEmpty":"not set (public)","relay.passwordSaved":"Relay password saved. Restart services to apply.","relay.showPassword":"Show password","relay.hidePassword":"Hide password","relay.identity":"Workstation ID","relay.regenerate":"Generate new ID","relay.regenerated":"New workstation identity generated. Restart services to re-register.","relay.envSnippet":"Relay startup command","relay.envHint":"Run this command on the relay host.","relay.test":"Test relay connection","relay.testOk":"Relay reachable: version {version}, {hosts} workstation(s) connected.","relay.testFailed":"Relay unreachable: {message}","relay.selectAddress":"Choose advertised address","relay.listenAddress":"Listen address","relay.listenAddressHint":"Server bind address. Browsers use advertised address below.","relay.addressTailscale":"Tailscale","relay.addressLan":"LAN","relay.addressVirtual":"virtual","relay.addressLoopback":"loopback","relay.noAddresses":"No non-loopback addresses found.","relay.docsHint":"Self-hosting guide: docs/self-hosted-relay.md","keepalive.title":"Keep-alive service","keepalive.manager":"Manager","keepalive.state":"State","keepalive.install":"Install and start","keepalive.uninstall":"Stop and remove","keepalive.restart":"Restart service","keepalive.installed":"Keep-alive installed with {manager}.","keepalive.uninstalled":"Keep-alive removed.","keepalive.restarted":"Keep-alive service restarted.","keepalive.failed":"Keep-alive operation failed: {message}","keepalive.unitPath":"Unit file","keepalive.logsHint":"View logs: {command}","keepalive.linger":"Start at boot","keepalive.lingerEnabled":"Start at boot enabled.","keepalive.lingerDisabled":"Start at boot disabled (runs while logged in).","keepalive.enableLinger":"Enable start at boot","keepalive.lingerDone":"Start at boot enabled for {username}.","keepalive.fallbackNote":"No system service manager found; background process will not survive reboot.","keepalive.windowsTaskNote":"Starts after you sign in as your account. It needs no password or administrator rights and does not run before sign-in.","keepalive.serviceNote":"Runs as a Windows service under your account and starts before sign-in. Installing or removing it asks for administrator rights, and Windows may require your account password.","keepalive.serviceWindowHint":"Finish the installation in the administrator window that opens.","keepalive.elevationCancelled":"Administrator rights were not granted; nothing was installed.","keepalive.passwordPrompt":"Windows account password for {account} (not a PIN; press Enter if there is no password):","keepalive.passwordRejected":"Windows could not start the service with those credentials. Check the account password and service logon policy.","keepalive.serviceInstalled":"Service {id} is installed and running.","keepalive.wrongAccount":"Run this as the account that will use herdr-remote, not another administrator account.","keepalive.pressEnter":"Press Enter to close this window.","herdr.title":"Herdr integration","herdr.socketPath":"Socket path","herdr.args":"Extra arguments","herdr.autoStartHint":"Off: Herdr starts only when you run it, or when you confirm it from a browser. On: herdr-remote also starts it every time it starts, at boot included. Takes effect the next time herdr-remote starts.","herdr.cliMissing":"Command herdr not found. Set HERDR_BIN_PATH to its full path.","herdr.version":"Herdr version","herdr.versionOutdated":'Herdr {version} is older than {minimum}. Run "herdr update": window titles, large pastes, taps on a pane, Alt shortcuts, typing over a slow link and agent alerts misbehave in browser windows before that release.',"about.title":"Language & about","about.language":"Interface language","about.languageAuto":"Follow system ({detected})","about.languageZh":"\u4E2D\u6587","about.languageEn":"English","about.version":"Version","about.configPath":"Config file","about.statePath":"State directory","about.relayPackage":"Relay package","about.docs":"Self-hosting guide: docs/self-hosted-relay.md","wizard.title":"First-time setup","wizard.step":"Step {current} of {total}","wizard.languageTitle":"Choose language","wizard.accessTitle":"Access mode","wizard.accessHint":"Can be changed later in Relay settings.","wizard.addressTitle":"Browser access address","wizard.relayTitle":"Relay server","wizard.relayUrlLabel":"Relay URL (wss://\u2026)","wizard.relayHint":"Relay must be running. See docs/self-hosted-relay.md.","wizard.passwordTitle":"Relay password","wizard.passwordHint":"RELAY_PASSWORD of the relay. Leave empty if unset.","wizard.finishTitle":"Finish","wizard.finishHint":"Configuration will be saved to {path}.","wizard.startNow":"Start services now","wizard.installKeepalive":"Run in background","wizard.finish":"Save and finish","field.mode":"Access mode","field.port":"Relay port","field.lanHost":"Browser address","field.remoteUrl":"Relay URL","field.publicUrl":"Browser URL override","field.socketPath":"Herdr socket path","field.herdrArgs":"Herdr arguments","field.herdrAutoStart":"Auto-start Herdr","field.language":"Language","field.keepalive":"Keep-alive manager","placeholder.autoDiscovered":"auto-discovered","placeholder.none":"none","error.invalidMode":"Unknown access mode.","error.invalidPort":"Port must be a number between 1 and 65535.","error.invalidLanHost":"Browser address must be a reachable LAN or Tailscale address, not loopback or 0.0.0.0.","error.invalidRelayUrl":"Relay URL must start with wss://, ws://, https:// or http://.","error.invalidPublicUrl":"Browser URL must start with https:// or http:// and cannot use 0.0.0.0 or ::.","error.invalidLanguage":"Unknown language.","error.invalidKeepalive":"Unknown keep-alive manager.","error.unknownField":"Unknown setting.","error.remoteUrlRequired":"Relay URL is required for self-hosted relay mode.","error.removedHerdrArg":"Herdr 0.9.0 removed --no-session; remove it from the extra arguments.","error.saveFailed":"Could not save configuration: {message}","hint.navigate":"\u2191\u2193 move","hint.select":"\u21B5 select","hint.edit":"\u21B5 edit","hint.tabs":"\u2190 \u2192 switch tab","hint.back":"esc back","hint.quit":"q quit","hint.mouseOn":"m mouse off","hint.mouseOff":"m mouse on","hint.mouseUnsupported":"mouse unsupported","hint.restartRequired":"Restart services to apply changes.","hint.unsavedChanges":"Unsaved changes (press s to save).","hint.save":"s save","hint.editing":"\u21B5 confirm \xB7 esc cancel","update.title":"Updates","update.banner":"herdr-remote {latest} is out (running {current}). Press 7 and Enter on the update row to install.","update.check":"Check for updates","update.checking":"Checking GitHub Releases\u2026","update.upToDate":"Up to date ({version})","update.available":"Update {version} available (press Enter to install)","update.updating":"Installing {version}\u2026","update.updatingRetry":"Installing {version}\u2026 (npm has not caught up yet, attempt {attempt})","update.done":"Updated to {version}","update.restartHint":"Update installed. Restart herdr-remote to apply.","update.errorNetwork":"Could not reach GitHub Releases, nor any npm registry as a fallback","update.errorNetworkDetail":"Nothing answered: {message}","update.errorFailed":"Update failed. Run: npm install -g {url}","update.errorFailedDetail":"Installer: {message}","update.errorNotYetPublished":"npm has not caught up with {version} yet (common in the first minutes after a release). Press Enter to try again shortly.","update.errorNotApplied":"The install reported success, but {installed} is still installed","update.cannot.source":"Source checkout \u2014 update with git","update.cannot.linked":"Linked package \u2014 managed by npm link","update.stoppingServices":"Stopping services while their files are replaced\u2026","update.restarting":"Restarting services on the new release\u2026","update.notRunning":"Services were not running and were left stopped. Start them with: herdr-remote start","update.restartFailed":"Installed, but the services did not restart: {message}","update.brokerRestarted":"Admin terminal broker restarted.","update.brokerRestartFailed":"The admin terminal broker did not start again. Sign out of Windows and back in, or run herdr-remote admin-broker restart.","update.brokerBusy":"An admin terminal is open, so the broker keeps running the previous release. Close admin terminals, then run herdr-remote admin-broker restart.","update.errorBusy":"A process still holds the herdr-remote folder; an admin terminal broker set up by an older release does. In an administrator PowerShell run: Get-ScheduledTask -TaskName 'HerdrRemoteAdminBroker-*' | Stop-ScheduledTask. Then run herdr-remote update again here, and afterwards herdr-remote admin-broker install as administrator."},l=m;var u={"app.name":"Herdr Remote","app.tagline":"\u5728\u6D4F\u89C8\u5668\u4E2D\u4F7F\u7528 Herdr \u5DE5\u4F5C\u533A","common.yes":"\u662F","common.no":"\u5426","common.on":"\u5F00","common.off":"\u5173","common.none":"\u65E0","common.auto":"\u81EA\u52A8","common.unknown":"\u672A\u77E5","common.running":"\u8FD0\u884C\u4E2D","common.stopped":"\u5DF2\u505C\u6B62","common.connected":"\u5DF2\u8FDE\u63A5","common.disconnected":"\u672A\u8FDE\u63A5","common.installed":"\u5DF2\u5B89\u88C5","common.notInstalled":"\u672A\u5B89\u88C5","common.enabled":"\u5DF2\u542F\u7528","common.disabled":"\u5DF2\u505C\u7528","common.loading":"\u5904\u7406\u4E2D\u2026","common.save":"\u4FDD\u5B58\u8BBE\u7F6E","common.saved":"\u914D\u7F6E\u5DF2\u4FDD\u5B58\u81F3 {path}","common.back":"\u8FD4\u56DE","common.cancel":"\u53D6\u6D88","common.confirm":"\u786E\u8BA4","common.pid":"PID {pid}","common.notApplicable":"\u4E0D\u9002\u7528","nav.overview":"\u6982\u89C8","nav.pair":"\u914D\u5BF9\u8BBE\u5907","nav.services":"\u670D\u52A1","nav.relay":"Relay","nav.keepalive":"\u4FDD\u6D3B","nav.herdr":"Herdr","nav.about":"\u8BED\u8A00\u4E0E\u5173\u4E8E","mode.local":"\u4EC5\u672C\u673A","mode.lan":"\u5C40\u57DF\u7F51 / Tailscale","mode.official":"\u5B98\u65B9 Relay","mode.remote":"\u81EA\u5EFA Relay","mode.local.description":"\u76D1\u542C 127.0.0.1\uFF0C\u4EC5\u672C\u673A\u53EF\u8BBF\u95EE\u3002","mode.lan.description":"\u76D1\u542C 0.0.0.0\uFF0C\u5C40\u57DF\u7F51\u4E0E Tailscale \u8BBE\u5907\u53EF\u8BBF\u95EE\u3002","mode.official.description":"\u4F7F\u7528\u5B98\u65B9 Relay \u8DE8\u7F51\u8BBF\u95EE\uFF0C\u65E0\u9700\u81EA\u5EFA\u670D\u52A1\u5668\u3002","mode.remote.description":"\u8FDE\u63A5\u81EA\u5EFA Relay \u8DE8\u7F51\u8BBF\u95EE\u3002","overview.title":"\u72B6\u6001","overview.mode":"\u8BBF\u95EE\u65B9\u5F0F","overview.relay":"Relay","overview.host":"\u4E3B\u673A\u8FDE\u63A5\u5668","overview.socket":"Herdr \u5957\u63A5\u5B57","overview.webUrl":"Web \u754C\u9762","overview.keepalive":"\u4FDD\u6D3B\u670D\u52A1","overview.devices":"\u6D4F\u89C8\u5668","overview.hosts":"\u5DE5\u4F5C\u7AD9","overview.uptime":"Relay \u8FD0\u884C\u65F6\u95F4","overview.relayLocal":"\u672C\u5730\uFF0C{bind}:{port}","overview.relayRemote":"\u8FDC\u7A0B\uFF0C{url}","overview.socketMissing":"\u672A\u627E\u5230\uFF0C\u8BF7\u786E\u8BA4 Herdr \u662F\u5426\u8FD0\u884C","overview.unreachable":"\u65E0\u6CD5\u8BBF\u95EE\uFF1A{message}","overview.notStarted":"\u670D\u52A1\u672A\u8FD0\u884C\uFF0C\u53EF\u524D\u5F80\u300C\u670D\u52A1\u300D\u542F\u52A8\u3002","pair.title":"\u914D\u5BF9\u8BBE\u5907","pair.generate":"\u751F\u6210\u914D\u5BF9\u7801","pair.regenerate":"\u91CD\u65B0\u751F\u6210","pair.working":"\u751F\u6210\u914D\u5BF9\u7801\u4E2D\u2026","pair.code":"\u914D\u5BF9\u7801","pair.url":"\u8BBF\u95EE\u5730\u5740","pair.expires":"\u5269\u4F59 {minutes}\uFF08\u81F3 {time}\uFF09","pair.expired":"\u914D\u5BF9\u7801\u5DF2\u8FC7\u671F\uFF0C\u9700\u91CD\u65B0\u751F\u6210\u3002","pair.instructions":"\u6253\u5F00\u94FE\u63A5\u5E76\u8F93\u5165\u914D\u5BF9\u7801\u3002","pair.qrHint":"\u626B\u63CF\u4E8C\u7EF4\u7801\u6253\u5F00\u94FE\u63A5\u3002","pair.qrUnavailable":"\u7EC8\u7AEF\u5BBD\u5EA6\u4E0D\u8DB3\uFF0C\u65E0\u6CD5\u663E\u793A\u4E8C\u7EF4\u7801\u3002","pair.failed":"\u751F\u6210\u914D\u5BF9\u7801\u5931\u8D25\uFF1A{message}","pair.hostOffline":"Relay \u672A\u8FDE\u63A5\u5DE5\u4F5C\u7AD9\uFF0C\u9700\u5148\u542F\u52A8\u670D\u52A1\u3002","services.title":"\u670D\u52A1","services.start":"\u542F\u52A8\u670D\u52A1","services.stop":"\u505C\u6B62\u670D\u52A1","services.restart":"\u91CD\u542F\u670D\u52A1","services.started":"\u670D\u52A1\u5DF2\u542F\u52A8\u3002","services.stopped":"\u670D\u52A1\u5DF2\u505C\u6B62\u3002","services.restarted":"\u670D\u52A1\u5DF2\u91CD\u542F\u3002","services.startFailed":"\u542F\u52A8\u670D\u52A1\u5931\u8D25\uFF1A{message}","services.stopFailed":"\u505C\u6B62\u670D\u52A1\u5931\u8D25\uFF1A{message}","services.unsavedBlocked":"\u914D\u7F6E\u672A\u4FDD\u5B58\uFF0C\u8BF7\u5148\u4FDD\u5B58\u518D\u91CD\u542F\u3002","services.managedNotice":"\u7531 {manager} \u6258\u7BA1\uFF0C\u5DF2\u901A\u8FC7\u4FDD\u6D3B\u670D\u52A1\u6267\u884C\u3002","services.logs":"\u6700\u8FD1\u65E5\u5FD7","services.logEmpty":"\u6682\u65E0\u65E5\u5FD7\u3002","services.logRelay":"Relay","services.logHost":"\u4E3B\u673A\u8FDE\u63A5\u5668","adminBroker.windowsOnly":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u53EA\u652F\u6301 Windows\u3002","adminBroker.needsElevation":"\u8BF7\u6253\u5F00 Windows TUI \u5E76\u9009\u62E9\u201C\u8BBE\u7F6E\u7BA1\u7406\u5458\u7EC8\u7AEF\u201D\uFF0C\u4F7F\u7528\u8FD0\u884C Herdr Remote \u7684\u540C\u4E00\u8D26\u6237\u6279\u51C6\u4E00\u6B21 Windows \u63D0\u6743\u63D0\u793A\u3002","adminBroker.busy":"\u6709\u7BA1\u7406\u5458\u7EC8\u7AEF\u5F00\u7740\uFF0C\u8BF7\u5148\u5173\u95ED\u518D\u91CD\u542F broker\u3002","adminBroker.title":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker","adminBroker.checking":"\u6B63\u5728\u68C0\u67E5\u2026","adminBroker.ready":"\u5DF2\u5C31\u7EEA","adminBroker.notReady":"\u5C1A\u672A\u8BBE\u7F6E\u6216\u672A\u8FD0\u884C","adminBroker.install":"\u8BBE\u7F6E\u7BA1\u7406\u5458\u7EC8\u7AEF","adminBroker.uninstall":"\u79FB\u9664\u7BA1\u7406\u5458\u7EC8\u7AEF\u8BBE\u7F6E","adminBroker.installDone":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u4EFB\u52A1\u5DF2\u6CE8\u518C\u3002","adminBroker.uninstallDone":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u4EFB\u52A1\u5DF2\u79FB\u9664\u3002","adminBroker.elevationCancelled":"\u672A\u6279\u51C6\u7BA1\u7406\u5458\u6743\u9650\uFF0C\u672A\u8FDB\u884C\u66F4\u6539\u3002","adminBroker.setupFailed":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u8BBE\u7F6E\u5931\u8D25\u3002","adminBroker.tuiHint":"\u53EA\u9700\u8BBE\u7F6E\u4E00\u6B21\u3002Windows \u4F1A\u8BF7\u6C42\u7BA1\u7406\u5458\u6388\u6743\uFF1B\u4E4B\u540E WebUI \u65B0\u5EFA\u7BA1\u7406\u5458\u7EC8\u7AEF\u4E0D\u518D\u5F39\u51FA UAC\u3002","adminShell.needsTerminal":"admin-shell \u5FC5\u987B\u5728\u7EC8\u7AEF\u4E2D\u8FD0\u884C\u3002","adminShell.brokerUnavailable":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u5C1A\u672A\u8FD0\u884C\u3002\u8BF7\u6253\u5F00 herdr-remote TUI\uFF0C\u8FDB\u5165\u300C\u4FDD\u6D3B\u300D\u5E76\u9009\u62E9\u300C\u8BBE\u7F6E\u7BA1\u7406\u5458\u7EC8\u7AEF\u300D\u3002","adminShell.tabLabel":"\u7BA1\u7406\u5458","relay.title":"Relay \u8BBE\u7F6E","relay.settings":"\u8BBE\u7F6E","relay.locked":"\u56FA\u5B9A","relay.officialFixed":"\u5B98\u65B9 relay \u5730\u5740\u56FA\u5B9A\uFF0C\u4E0D\u53EF\u4FEE\u6539\u3002","relay.officialHint":"\u5B98\u65B9 relay\uFF1A\u5730\u5740\u56FA\u5B9A\uFF0C\u65E0\u9700\u5BC6\u7801\u3002","relay.password":"Relay \u5BC6\u7801","relay.passwordHint":"\u987B\u4E0E Relay \u7AEF\u7684 RELAY_PASSWORD \u4E00\u81F4\u3002\u7559\u7A7A\u4E3A\u516C\u7528 Relay\u3002","relay.passwordSet":"\u5DF2\u8BBE\u7F6E","relay.passwordEmpty":"\u672A\u8BBE\u7F6E\uFF08\u516C\u7528\uFF09","relay.passwordSaved":"Relay \u5BC6\u7801\u5DF2\u4FDD\u5B58\uFF0C\u91CD\u542F\u670D\u52A1\u751F\u6548\u3002","relay.showPassword":"\u663E\u793A\u5BC6\u7801","relay.hidePassword":"\u9690\u85CF\u5BC6\u7801","relay.identity":"\u5DE5\u4F5C\u7AD9\u6807\u8BC6","relay.regenerate":"\u91CD\u65B0\u751F\u6210\u6807\u8BC6","relay.regenerated":"\u5DF2\u751F\u6210\u65B0\u6807\u8BC6\uFF0C\u91CD\u542F\u540E\u91CD\u65B0\u6CE8\u518C\u3002","relay.envSnippet":"Relay \u542F\u52A8\u547D\u4EE4","relay.envHint":"\u5728 Relay \u4E3B\u673A\u6267\u884C\u6B64\u547D\u4EE4\u3002","relay.test":"\u6D4B\u8BD5 Relay \u8FDE\u63A5","relay.testOk":"Relay \u53EF\u8BBF\u95EE\uFF1A\u7248\u672C {version}\uFF0C\u5DF2\u8FDE\u63A5 {hosts} \u53F0\u5DE5\u4F5C\u7AD9\u3002","relay.testFailed":"Relay \u65E0\u6CD5\u8BBF\u95EE\uFF1A{message}","relay.selectAddress":"\u9009\u62E9\u516C\u5E03\u5730\u5740","relay.listenAddress":"\u76D1\u542C\u5730\u5740","relay.listenAddressHint":"\u670D\u52A1\u5668\u7ED1\u5B9A\u5730\u5740\uFF1B\u6D4F\u89C8\u5668\u8BBF\u95EE\u4E0B\u65B9\u516C\u5E03\u5730\u5740\u3002","relay.addressTailscale":"Tailscale","relay.addressLan":"\u5C40\u57DF\u7F51","relay.addressVirtual":"\u865A\u62DF\u7F51\u5361","relay.addressLoopback":"\u56DE\u73AF","relay.noAddresses":"\u672A\u627E\u5230\u975E\u56DE\u73AF\u5730\u5740\u3002","relay.docsHint":"\u81EA\u5EFA\u6307\u5357\uFF1Adocs/self-hosted-relay.zh-CN.md","keepalive.title":"\u540E\u53F0\u4FDD\u6D3B\u670D\u52A1","keepalive.manager":"\u7BA1\u7406\u65B9\u5F0F","keepalive.state":"\u72B6\u6001","keepalive.install":"\u5B89\u88C5\u5E76\u542F\u52A8","keepalive.uninstall":"\u505C\u6B62\u5E76\u79FB\u9664","keepalive.restart":"\u91CD\u542F\u4FDD\u6D3B\u670D\u52A1","keepalive.installed":"\u5DF2\u901A\u8FC7 {manager} \u5B89\u88C5\u4FDD\u6D3B\u670D\u52A1\u3002","keepalive.uninstalled":"\u4FDD\u6D3B\u670D\u52A1\u5DF2\u79FB\u9664\u3002","keepalive.restarted":"\u4FDD\u6D3B\u670D\u52A1\u5DF2\u91CD\u542F\u3002","keepalive.failed":"\u4FDD\u6D3B\u64CD\u4F5C\u5931\u8D25\uFF1A{message}","keepalive.unitPath":"\u5355\u5143\u6587\u4EF6","keepalive.logsHint":"\u67E5\u770B\u65E5\u5FD7\uFF1A{command}","keepalive.linger":"\u5F00\u673A\u81EA\u542F","keepalive.lingerEnabled":"\u5DF2\u5F00\u542F\u5F00\u673A\u81EA\u542F\u3002","keepalive.lingerDisabled":"\u672A\u5F00\u542F\u5F00\u673A\u81EA\u542F\uFF08\u4EC5\u767B\u5F55\u671F\u95F4\u8FD0\u884C\uFF09\u3002","keepalive.enableLinger":"\u5F00\u542F\u5F00\u673A\u81EA\u542F","keepalive.lingerDone":"\u5DF2\u4E3A {username} \u5F00\u542F\u5F00\u673A\u81EA\u542F\u3002","keepalive.fallbackNote":"\u65E0\u7CFB\u7EDF\u670D\u52A1\u7BA1\u7406\u5668\uFF0C\u4F7F\u7528\u540E\u53F0\u5B88\u62A4\u8FDB\u7A0B\uFF0C\u91CD\u542F\u540E\u4E0D\u81EA\u52A8\u6062\u590D\u3002","keepalive.windowsTaskNote":"\u5728\u4F60\u7684\u8D26\u6237\u767B\u5F55\u540E\u542F\u52A8\uFF0C\u65E0\u9700\u5BC6\u7801\u6216\u7BA1\u7406\u5458\u6743\u9650\uFF1B\u767B\u5F55\u524D\u4E0D\u4F1A\u8FD0\u884C\u3002","keepalive.serviceNote":"\u4EE5\u4F60\u7684\u8D26\u6237\u4F5C\u4E3A Windows \u670D\u52A1\u8FD0\u884C\uFF0C\u5728\u767B\u5F55\u524D\u542F\u52A8\u3002\u5B89\u88C5\u6216\u79FB\u9664\u9700\u8981\u7BA1\u7406\u5458\u6743\u9650\uFF0CWindows \u4E5F\u53EF\u80FD\u8981\u6C42\u8D26\u6237\u5BC6\u7801\u3002","keepalive.serviceWindowHint":"\u8BF7\u5728\u968F\u540E\u6253\u5F00\u7684\u7BA1\u7406\u5458\u7A97\u53E3\u4E2D\u5B8C\u6210\u5B89\u88C5\u3002","keepalive.elevationCancelled":"\u672A\u6388\u4E88\u7BA1\u7406\u5458\u6743\u9650\uFF0C\u672A\u5B89\u88C5\u670D\u52A1\u3002","keepalive.passwordPrompt":"\u8BF7\u8F93\u5165 {account} \u7684 Windows \u8D26\u6237\u5BC6\u7801\uFF08\u4E0D\u662F PIN\uFF1B\u8D26\u6237\u65E0\u5BC6\u7801\u65F6\u76F4\u63A5\u6309 Enter\uFF09\uFF1A","keepalive.passwordRejected":"Windows \u672A\u80FD\u4F7F\u7528\u8FD9\u4E9B\u51ED\u636E\u542F\u52A8\u670D\u52A1\u3002\u8BF7\u68C0\u67E5\u8D26\u6237\u5BC6\u7801\u548C\u201C\u4F5C\u4E3A\u670D\u52A1\u767B\u5F55\u201D\u7B56\u7565\u3002","keepalive.serviceInstalled":"\u670D\u52A1 {id} \u5DF2\u5B89\u88C5\u5E76\u6B63\u5728\u8FD0\u884C\u3002","keepalive.wrongAccount":"\u8BF7\u4F7F\u7528\u5C06\u8FD0\u884C herdr-remote \u7684\u8D26\u6237\u6267\u884C\u6B64\u64CD\u4F5C\uFF0C\u4E0D\u8981\u6362\u7528\u5176\u4ED6\u7BA1\u7406\u5458\u8D26\u6237\u3002","keepalive.pressEnter":"\u6309 Enter \u5173\u95ED\u6B64\u7A97\u53E3\u3002","herdr.title":"Herdr \u96C6\u6210","herdr.socketPath":"\u5957\u63A5\u5B57\u8DEF\u5F84","herdr.args":"\u9644\u52A0\u53C2\u6570","herdr.autoStartHint":"\u5173\uFF1AHerdr \u53EA\u5728\u4F60\u624B\u52A8\u8FD0\u884C\uFF0C\u6216\u5728\u6D4F\u89C8\u5668\u91CC\u786E\u8BA4\u540E\u624D\u542F\u52A8\u3002\u5F00\uFF1Aherdr-remote \u6BCF\u6B21\u542F\u52A8\uFF08\u5305\u62EC\u5F00\u673A\uFF09\u65F6\u4E00\u5E76\u542F\u52A8 Herdr\u3002\u4E0B\u6B21 herdr-remote \u542F\u52A8\u65F6\u751F\u6548\u3002","herdr.cliMissing":"\u672A\u627E\u5230 herdr \u547D\u4EE4\uFF0C\u53EF\u5C06 HERDR_BIN_PATH \u8BBE\u4E3A\u5176\u5B8C\u6574\u8DEF\u5F84\u3002","herdr.version":"Herdr \u7248\u672C","herdr.versionOutdated":"Herdr {version} \u4F4E\u4E8E {minimum}\uFF0C\u8BF7\u8FD0\u884C \u201Cherdr update\u201D\uFF1A\u5728\u8BE5\u7248\u672C\u4E4B\u524D\uFF0C\u6D4F\u89C8\u5668\u7A97\u53E3\u7684\u6807\u9898\u3001\u5927\u6BB5\u7C98\u8D34\u3001\u70B9\u6309\u7A97\u683C\u3001Alt \u5FEB\u6377\u952E\u3001\u6162\u901F\u94FE\u8DEF\u4E0A\u7684\u8F93\u5165\u4EE5\u53CA\u667A\u80FD\u4F53\u63D0\u9192\u90FD\u4F1A\u51FA\u95EE\u9898\u3002","about.title":"\u8BED\u8A00\u4E0E\u5173\u4E8E","about.language":"\u754C\u9762\u8BED\u8A00","about.languageAuto":"\u8DDF\u968F\u7CFB\u7EDF\uFF08{detected}\uFF09","about.languageZh":"\u4E2D\u6587","about.languageEn":"English","about.version":"\u7248\u672C","about.configPath":"\u914D\u7F6E\u6587\u4EF6","about.statePath":"\u72B6\u6001\u76EE\u5F55","about.relayPackage":"Relay \u5305","about.docs":"\u81EA\u5EFA\u6307\u5357\uFF1Adocs/self-hosted-relay.zh-CN.md","wizard.title":"\u9996\u6B21\u8BBE\u7F6E","wizard.step":"\u7B2C {current} / {total} \u6B65","wizard.languageTitle":"\u9009\u62E9\u8BED\u8A00","wizard.accessTitle":"\u9009\u62E9\u8BBF\u95EE\u65B9\u5F0F","wizard.accessHint":"\u540E\u7EED\u53EF\u5728 Relay \u9875\u9762\u4FEE\u6539\u3002","wizard.addressTitle":"\u9009\u62E9\u8BBF\u95EE\u5730\u5740","wizard.relayTitle":"Relay \u670D\u52A1\u5668","wizard.relayUrlLabel":"Relay \u5730\u5740\uFF08wss://\u2026\uFF09","wizard.relayHint":"Relay \u9700\u5148\u8FD0\u884C\u3002\u642D\u5EFA\u6307\u5357\u89C1 docs/self-hosted-relay.zh-CN.md\u3002","wizard.passwordTitle":"Relay \u5BC6\u7801","wizard.passwordHint":"Relay \u7684 RELAY_PASSWORD\u3002\u672A\u8BBE\u7559\u7A7A\u3002","wizard.finishTitle":"\u5B8C\u6210","wizard.finishHint":"\u914D\u7F6E\u5C06\u4FDD\u5B58\u81F3 {path}\u3002","wizard.startNow":"\u7ACB\u5373\u542F\u52A8\u670D\u52A1","wizard.installKeepalive":"\u540E\u53F0\u4FDD\u6D3B","wizard.finish":"\u4FDD\u5B58\u5E76\u5B8C\u6210","field.mode":"\u8BBF\u95EE\u65B9\u5F0F","field.port":"Relay \u7AEF\u53E3","field.lanHost":"\u6D4F\u89C8\u5668\u5730\u5740","field.remoteUrl":"Relay \u5730\u5740","field.publicUrl":"\u6D4F\u89C8\u5668\u5730\u5740\uFF08\u8986\u76D6\uFF09","field.socketPath":"Herdr \u5957\u63A5\u5B57\u8DEF\u5F84","field.herdrArgs":"Herdr \u53C2\u6570","field.herdrAutoStart":"\u968F\u670D\u52A1\u542F\u52A8 Herdr","field.language":"\u8BED\u8A00","field.keepalive":"\u4FDD\u6D3B\u7BA1\u7406\u65B9\u5F0F","placeholder.autoDiscovered":"\u81EA\u52A8\u63A2\u6D4B","placeholder.none":"\u65E0","error.invalidMode":"\u672A\u77E5\u7684\u8BBF\u95EE\u65B9\u5F0F\u3002","error.invalidPort":"\u7AEF\u53E3\u987B\u4E3A 1 \u5230 65535 \u4E4B\u95F4\u7684\u6570\u5B57\u3002","error.invalidLanHost":"\u6D4F\u89C8\u5668\u5730\u5740\u987B\u4E3A\u53EF\u8BBF\u95EE\u5C40\u57DF\u7F51\u6216 Tailscale \u5730\u5740\uFF0C\u4E0D\u80FD\u4E3A\u56DE\u73AF\u6216 0.0.0.0\u3002","error.invalidRelayUrl":"Relay \u5730\u5740\u987B\u4EE5 wss://\u3001ws://\u3001https:// \u6216 http:// \u5F00\u5934\u3002","error.invalidPublicUrl":"\u6D4F\u89C8\u5668\u5730\u5740\u987B\u4EE5 https:// \u6216 http:// \u5F00\u5934\uFF0C\u4E0D\u80FD\u4E3A 0.0.0.0 \u6216 ::\u3002","error.invalidLanguage":"\u672A\u77E5\u7684\u8BED\u8A00\u3002","error.invalidKeepalive":"\u672A\u77E5\u7684\u4FDD\u6D3B\u7BA1\u7406\u65B9\u5F0F\u3002","error.unknownField":"\u672A\u77E5\u7684\u8BBE\u7F6E\u9879\u3002","error.remoteUrlRequired":"\u81EA\u5EFA Relay \u6A21\u5F0F\u987B\u586B\u5199 Relay \u5730\u5740\u3002","error.removedHerdrArg":"Herdr 0.9.0 \u5DF2\u79FB\u9664 --no-session\uFF0C\u8BF7\u4ECE\u9644\u52A0\u53C2\u6570\u4E2D\u79FB\u9664\u3002","error.saveFailed":"\u4FDD\u5B58\u914D\u7F6E\u5931\u8D25\uFF1A{message}","hint.navigate":"\u2191\u2193 \u79FB\u52A8","hint.select":"\u21B5 \u9009\u62E9","hint.edit":"\u21B5 \u7F16\u8F91","hint.tabs":"\u2190 \u2192 \u5207\u6362\u9875\u9762","hint.back":"esc \u8FD4\u56DE","hint.quit":"q \u9000\u51FA","hint.mouseOn":"m \u5173\u95ED\u9F20\u6807","hint.mouseOff":"m \u5F00\u542F\u9F20\u6807","hint.mouseUnsupported":"\u4E0D\u652F\u6301\u9F20\u6807","hint.restartRequired":"\u91CD\u542F\u670D\u52A1\u751F\u6548\u3002","hint.unsavedChanges":"\u6709\u672A\u4FDD\u5B58\u4FEE\u6539\uFF08\u6309 s \u4FDD\u5B58\uFF09\u3002","hint.save":"s \u4FDD\u5B58","hint.editing":"\u21B5 \u786E\u8BA4 \xB7 esc \u53D6\u6D88","update.title":"\u66F4\u65B0","update.banner":"herdr-remote {latest} \u5DF2\u53D1\u5E03\uFF08\u5F53\u524D {current}\uFF09\uFF0C\u6309 7 \u8FDB\u5165\u300C\u8BED\u8A00\u4E0E\u5173\u4E8E\u300D\uFF0C\u5728\u66F4\u65B0\u4E00\u884C\u6309 Enter \u5B89\u88C5\u3002","update.check":"\u68C0\u67E5\u66F4\u65B0","update.checking":"\u67E5\u8BE2 GitHub Releases \u4E2D\u2026","update.upToDate":"\u5DF2\u662F\u6700\u65B0\uFF08{version}\uFF09","update.available":"\u65B0\u7248\u672C {version} \u53EF\u7528\uFF08\u6309 Enter \u5B89\u88C5\uFF09","update.updating":"\u5B89\u88C5 {version} \u4E2D\u2026","update.updatingRetry":"\u5B89\u88C5 {version} \u4E2D\u2026\uFF08npm \u5C1A\u672A\u540C\u6B65\uFF0C\u7B2C {attempt} \u6B21\u5C1D\u8BD5\uFF09","update.done":"\u5DF2\u66F4\u65B0\u81F3 {version}","update.restartHint":"\u66F4\u65B0\u5DF2\u5B89\u88C5\uFF0C\u91CD\u542F herdr-remote \u751F\u6548\u3002","update.errorNetwork":"\u65E0\u6CD5\u8FDE\u63A5 GitHub Releases\uFF0C\u4F5C\u4E3A\u5907\u7528\u7684 npm registry \u4E5F\u65E0\u6CD5\u8FDE\u63A5","update.errorNetworkDetail":"\u5747\u65E0\u5E94\u7B54\uFF1A{message}","update.errorFailed":"\u66F4\u65B0\u5931\u8D25\uFF0C\u53EF\u624B\u52A8\u6267\u884C\uFF1Anpm install -g {url}","update.errorFailedDetail":"\u5B89\u88C5\u8F93\u51FA\uFF1A{message}","update.errorNotYetPublished":"npm \u8FD8\u6CA1\u540C\u6B65\u5230 {version}\uFF08\u521A\u53D1\u5E03\u7684\u51E0\u5206\u949F\u5185\u5E38\u89C1\uFF09\uFF0C\u7A0D\u540E\u6309 Enter \u91CD\u8BD5\u3002","update.errorNotApplied":"\u5B89\u88C5\u62A5\u544A\u6210\u529F\uFF0C\u4F46\u5B89\u88C5\u7684\u4ECD\u662F {installed}","update.cannot.source":"\u6E90\u7801\u76EE\u5F55\u8FD0\u884C\uFF0C\u8BF7\u4F7F\u7528 git \u66F4\u65B0","update.cannot.linked":"npm link \u5DE5\u4F5C\u526F\u672C\uFF0C\u7531 npm link \u7BA1\u7406","update.stoppingServices":"\u66FF\u6362\u6587\u4EF6\u671F\u95F4\u5148\u505C\u6B62\u670D\u52A1\u2026","update.restarting":"\u6B63\u5728\u7528\u65B0\u7248\u672C\u91CD\u542F\u670D\u52A1\u2026","update.notRunning":"\u670D\u52A1\u4E4B\u524D\u6CA1\u6709\u8FD0\u884C\uFF0C\u4FDD\u6301\u505C\u6B62\u3002\u9700\u8981\u65F6\u6267\u884C\uFF1Aherdr-remote start","update.restartFailed":"\u5DF2\u5B89\u88C5\uFF0C\u4F46\u670D\u52A1\u6CA1\u80FD\u91CD\u542F\uFF1A{message}","update.brokerRestarted":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u5DF2\u91CD\u542F\u3002","update.brokerRestartFailed":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u6CA1\u6709\u91CD\u65B0\u542F\u52A8\u3002\u91CD\u65B0\u767B\u5F55 Windows\uFF0C\u6216\u8FD0\u884C herdr-remote admin-broker restart\u3002","update.brokerBusy":"\u6709\u7BA1\u7406\u5458\u7EC8\u7AEF\u5F00\u7740\uFF0Cbroker \u7EE7\u7EED\u8FD0\u884C\u65E7\u7248\u672C\u3002\u5173\u95ED\u6240\u6709\u7BA1\u7406\u5458\u7EC8\u7AEF\u540E\u8FD0\u884C herdr-remote admin-broker restart\u3002","update.errorBusy":"\u4ECD\u6709\u8FDB\u7A0B\u5360\u7528 herdr-remote \u7684\u5B89\u88C5\u76EE\u5F55\uFF0C\u65E7\u7248\u672C\u8BBE\u7F6E\u7684\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u4F1A\u8FD9\u6837\u3002\u5148\u5728\u7BA1\u7406\u5458 PowerShell \u4E2D\u6267\u884C\uFF1AGet-ScheduledTask -TaskName 'HerdrRemoteAdminBroker-*' | Stop-ScheduledTask\uFF0C\u518D\u56DE\u5230\u8FD9\u91CC\u91CD\u65B0\u8FD0\u884C herdr-remote update\uFF0C\u6700\u540E\u4EE5\u7BA1\u7406\u5458\u8EAB\u4EFD\u8FD0\u884C herdr-remote admin-broker install\u3002"},d=u;var o={en:l,zh:d},n="en";function s(e){return typeof e=="string"&&Object.hasOwn(o,e)}function y({env:e=process.env,preference:r="auto"}={}){if(r&&r!=="auto"&&s(r))return r;if(s(e.HERDR_REMOTE_LANG))return e.HERDR_REMOTE_LANG;let a=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE||"";return String(a).split(/[:.@]/)[0].toLowerCase().startsWith("zh")?"zh":n}function v(e,r){return r?e.replace(/\{(\w+)\}/g,(a,i)=>Object.hasOwn(r,i)?String(r[i]):a):e}function b(e=n){let r=s(e)?o[e]:o[n],a=o[n];return Object.assign((t,c)=>{let p=r[t]??a[t]??t;return v(p,c)},{locale:e,has:t=>Object.hasOwn(r,t)})}export{y as a,b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{a as m,c as w}from"./
|
|
3
|
+
import{a as m,c as w}from"./HDHNFESR.js";import"./KEUAW3VO.js";import{b as u,c as p,d as h}from"./QOPTXTL7.js";import"./JJGEV4EZ.js";import"./HRFNURKU.js";import"./ETEPTJGZ.js";import"./SWVUDSHP.js";import"./TNLCNVA2.js";import"./I6NRCYLI.js";var E=5e3,f=class{socket=null;input="";connected=!1;started=!1;finished=!1;killed=!1;early=[];dataListener=null;exitListener=null;errorListener=null;options;constructor(e){this.options=e}start({cols:e,rows:r,onData:l,onExit:t,onError:n}){this.dataListener=l,this.exitListener=t,this.errorListener=n;let c;try{c=p()}catch(o){this.fail(o);return}let{socket:i,token:a}=c;this.socket=i,i.setEncoding("utf8"),i.setTimeout(E,()=>{i.destroy(Object.assign(new Error("Administrator terminal broker connection timed out"),{code:"ETIMEDOUT"}))}),i.on("connect",()=>{this.connected=!0,i.setTimeout(0),h(i,{type:"start",token:a,...this.options,cols:e,rows:r})}),i.on("data",o=>this.receive(o)),i.on("error",o=>this.fail(o)),i.on("close",()=>{this.started&&!this.finished&&!this.killed&&(this.finished=!0,this.exitListener?.({exitCode:1}))})}write(e){if(!this.finished){if(!this.started){this.early.push(Buffer.from(e));return}this.socket?.writable&&h(this.socket,{type:"input",dataBase64:Buffer.from(e).toString("base64")})}}resize(e,r){this.started&&this.socket?.writable&&h(this.socket,{type:"resize",cols:e,rows:r})}kill(){this.killed=!0,this.socket&&(this.connected&&this.socket.writable?(h(this.socket,{type:"kill"}),this.socket.end()):this.socket.destroy())}receive(e){if(this.input+=e,Buffer.byteLength(this.input,"utf8")>u){this.socket?.destroy(new Error("Administrator terminal broker message exceeded the limit"));return}for(;;){let r=this.input.indexOf(`
|
|
4
4
|
`);if(r<0)return;let l=this.input.slice(0,r);this.input=this.input.slice(r+1);let t;try{t=JSON.parse(l)}catch{this.socket?.destroy(new Error("Administrator terminal broker sent invalid JSON"));return}if(t.type==="started"){this.started=!0;let n=Buffer.concat(this.early);this.early=[],n.length>0&&this.write(n)}else t.type==="data"&&typeof t.dataBase64=="string"?this.dataListener?.(Buffer.from(t.dataBase64,"base64").toString("utf8")):t.type==="exit"?(this.finished=!0,this.exitListener?.({exitCode:Number(t.exitCode)||0,...typeof t.signal=="number"?{signal:t.signal}:{}}),this.socket?.end()):t.type==="error"&&this.fail(new Error(typeof t.message=="string"?t.message:"Admin PTY failed"))}}fail(e){if(this.started){!this.finished&&!this.killed&&(this.finished=!0,this.exitListener?.({exitCode:1}));return}this.finished||this.killed||(this.finished=!0,this.errorListener?.(e))}};var k=["ENOENT","ECONNREFUSED","ETIMEDOUT"];async function y(){let s=process.env.HERDR_SOCKET_PATH,e=process.env.HERDR_PANE_ID;if(!(process.env[w]!=="1"||!s||!e))try{await m(s,"pane.close",{pane_id:e})}catch{}}async function O(s,{stdin:e=process.stdin,stdout:r=process.stdout,platform:l=process.platform}={}){if(l!=="win32")throw new Error(s("adminBroker.windowsOnly"));if(!e.isTTY||!r.isTTY)throw new Error(s("adminShell.needsTerminal"));let t=new f({command:"powershell.exe",args:["-NoLogo","-NoProfile"],cwd:process.cwd()}),n=i=>t.write(i),c=()=>t.resize(r.columns,r.rows);e.setRawMode(!0),e.on("data",n),e.resume(),r.on("resize",c);try{let i=await new Promise((a,o)=>{t.start({cols:r.columns,rows:r.rows,onData:d=>r.write(d),onExit:d=>a(d.exitCode),onError:o})});return await y(),i}catch(i){let{code:a}=i;throw a&&k.includes(a)?new Error(s("adminShell.brokerUnavailable")):i}finally{e.off("data",n),r.off("resize",c),e.setRawMode(!1),e.pause()}}export{O as runAdminShell};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{a,b,c,d,e,f,g}from"./
|
|
3
|
+
import{a,b,c,d,e,f,g}from"./QL4I7VLD.js";import"./B6LZOIKD.js";import"./5RGV2MW6.js";import"./JJGEV4EZ.js";import"./IONXNA5T.js";import"./ZAAEQP3M.js";import"./U6QAYG3E.js";import"./PDOEV4QJ.js";import"./4CO2WAXZ.js";import"./HRFNURKU.js";import"./ETEPTJGZ.js";import"./37NKZLLR.js";import"./KRVF37OW.js";import"./QRGNEKME.js";import"./SWVUDSHP.js";import"./TNLCNVA2.js";import"./I6NRCYLI.js";export{g as fullStatus,a as managerInUse,d as restartAll,e as servicesRunning,b as startAll,c as stopAll,f as whileServicesStopped};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{a as e,b as f,c as g,d as h,e as i,f as j,g as k,h as l,i as m,j as n}from"./
|
|
3
|
+
import{a as e,b as f,c as g,d as h,e as i,f as j,g as k,h as l,i as m,j as n}from"./PDOEV4QJ.js";import{a as c,b as d}from"./4CO2WAXZ.js";import{b as a,c as b}from"./HRFNURKU.js";import"./ETEPTJGZ.js";import"./37NKZLLR.js";import"./KRVF37OW.js";import"./QRGNEKME.js";import"./SWVUDSHP.js";import"./TNLCNVA2.js";import"./I6NRCYLI.js";export{g as detectManager,m as enableLinger,c as escapeXml,i as install,n as logsHint,d as renderLaunchdPlist,f as renderSystemdUnit,k as restart,b as serviceEnvironment,a as servicePath,h as status,l as stopManaged,e as systemdEnvironmentLine,j as uninstall};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{a as l}from"./
|
|
3
|
+
import{a as l}from"./HRFNURKU.js";import{h,k as c}from"./SWVUDSHP.js";import n from"node:fs";import f from"node:net";import o from"node:path";var d="HERDR_REMOTE_LINK_STREAM",y="HERDR_REMOTE_LINK_SOCKET",k=["xdg-open","open"],E=16*1024;function a(i){return`'${i.replaceAll("'","'\\''")}'`}function S(i,e){return`#!/bin/sh
|
|
4
4
|
exec ${a(i)} ${a(e)} open-link "$0" "$@"
|
|
5
5
|
`}var p=class{shimDir;socketPath;send;hasStream;node;entry;supported;server=null;relayOpensLinks=!1;constructor({directory:e,node:t=process.execPath,entry:s=l(),platform:r=process.platform},m,u){this.shimDir=o.join(e,"link-shims"),this.socketPath=o.join(e,"links.sock"),this.send=m,this.hasStream=u,this.node=t,this.entry=s,this.supported=r!=="win32"}setRelayCapabilities(e){this.relayOpensLinks=Array.isArray(e)&&e.includes(c.openLink),this.relayOpensLinks&&this.start()}start(){if(!this.supported||this.server)return;try{n.mkdirSync(this.shimDir,{recursive:!0,mode:448});let t=S(this.node,this.entry);for(let s of k)n.writeFileSync(o.join(this.shimDir,s),t,{mode:493});n.rmSync(this.socketPath,{force:!0})}catch(t){process.stderr.write(`herdr-remote host connector: links will open on this workstation: ${t.message}
|
|
6
6
|
`);return}let e=f.createServer(t=>this.serve(t));e.on("error",t=>{process.stderr.write(`herdr-remote host connector: links will open on this workstation: ${t.message}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{a as F,b as B,c as q,d as Q,e as P,g as r,h,m as i}from"./
|
|
3
|
+
import{a as F,b as B,c as q,d as Q,e as P,g as r,h,m as i}from"./4CO2WAXZ.js";import{a as m,b as G,c as a}from"./HRFNURKU.js";import{o as u}from"./37NKZLLR.js";import{b as U,c as j}from"./KRVF37OW.js";import{a as w,b as M,c as W}from"./QRGNEKME.js";import{b as C,c as d,f as N}from"./TNLCNVA2.js";import{c as it}from"./I6NRCYLI.js";var It={};it(It,{detectManager:()=>rt,enableLinger:()=>At,escapeXml:()=>F,install:()=>Pt,logsHint:()=>xt,renderLaunchdPlist:()=>B,renderSystemdUnit:()=>O,restart:()=>Dt,serviceEnvironment:()=>a,servicePath:()=>G,status:()=>st,stopManaged:()=>bt,systemdEnvironmentLine:()=>L,uninstall:()=>Rt});import{spawnSync as Et}from"node:child_process";import tt from"node:fs";import Nt from"node:os";import et from"node:path";import{spawn as at}from"node:child_process";import D from"node:fs";import ct from"node:path";function k(){return ct.join(d(),"supervisor.pid")}function b(){let t=W(k(),{});return j([t]).length>0?t.pid:null}function X(){let t=b();if(t!==null)return{ok:!0,alreadyRunning:!0,pid:t};w(d());let e=D.openSync(N("supervisor"),"a");try{let n=at(process.execPath,[m(),"run","--daemon"],{cwd:d(),env:{...process.env,HERDR_REMOTE_SERVICE:"1",...a()},detached:!0,windowsHide:!0,stdio:["ignore",e,e]});return n.unref(),M(k(),{pid:n.pid,processStart:n.pid?U(n.pid):null,startedAt:new Date().toISOString()}),{ok:!0,pid:n.pid,note:"this fallback does not survive a reboot"}}finally{D.closeSync(e)}}function R(){let t=b();if(t!==null)try{process.kill(t,"SIGTERM")}catch{}return D.rmSync(k(),{force:!0}),{ok:!0,stoppedPid:t}}function A(t=process.platform,e=N("supervisor")){return t==="win32"?`Get-Content -Wait -Tail 40 "${e}"`:`tail -f ${e}`}var J={name:"supervisor",status(){let t=b(),e=t!==null;return{manager:"supervisor",installed:e,active:e,enabled:!1,pid:e?t:null,unitPath:k(),state:e?"running":"stopped"}},async install(){return X()},async uninstall(){return R()},restart(){return R(),X()},stop(){R()},logsHint(){return A()}};import{spawnSync as V}from"node:child_process";import x from"node:fs";import I from"node:os";import _ from"node:path";var c="herdr-remote.service";function $(){let t=process.env.XDG_CONFIG_HOME||_.join(I.homedir(),".config");return _.join(t,"systemd","user",c)}function L(t,e){let n=String(e).replace(/[\r\n]+/g," ").replace(/%/g,"%%");return/^[\w@+=:,./-]*$/.test(n)?`Environment=${t}=${n}`:`Environment="${t}=${n.replace(/([\\"])/g,"\\$1")}"`}function O({nodePath:t=process.execPath,entryPoint:e=m(),environment:n={}}={}){let s=Object.entries(n).map(([o,S])=>L(o,S)).join(`
|
|
4
4
|
`);return`[Unit]
|
|
5
5
|
Description=Herdr Remote (relay and host connector)
|
|
6
6
|
Documentation=https://github.com/dibin666/herdr-remote
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{d as m,e as n,f as c,g as p}from"./
|
|
3
|
+
import{d as m,e as n,f as c,g as p}from"./B6LZOIKD.js";import{a as l,h as o}from"./U6QAYG3E.js";import{d as s,g as i,h as v,j as f}from"./PDOEV4QJ.js";import{o as t}from"./37NKZLLR.js";function u(a){let e=s(a);return e.installed||e.active?e:null}function S(a=t()){let e=u(a);return e?(e.active||i(a),{ok:!0,managed:!0,manager:e.manager,alreadyRunning:!!e.active}):{...m(),managed:!1}}function w(a=t()){let e=v(a);return e.managed?(n(),{ok:!0,managed:!0,manager:e.manager}):{...n(),managed:!1}}function P(a=t()){let e=u(a);return e?(i(a),{ok:!0,managed:!0,manager:e.manager}):{...c(),managed:!1}}function y(a=t()){if(u(a)?.active)return!0;let e=l();return o(e).some(({pid:r})=>r===e.hostPid)}async function x(a,e,{platform:r=process.platform,isRunning:d=()=>y(a),stop:g=w,start:k=S}={}){if(r!=="win32"||!d())return e();await g(a);try{return await e()}finally{await k(a)}}async function B(a=t()){let[e,r]=[await p(),s(a)];return{...e,keepalive:r,logsHint:f(a)}}export{u as a,S as b,w as c,P as d,y as e,x as f,B as g};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{b as Rl,c as Rg,d as Ng,f as wg,g as vg}from"./TARBQM5W.js";import{a as yl,b as Ig}from"./QLOMG2U7.js";import{h as Dg,i as Rs}from"./JBZYXV5K.js";import{a as fg,f as Eg,g as Sl,h as Bg}from"./5RGV2MW6.js";import"./JJGEV4EZ.js";import"./IONXNA5T.js";import"./ZAAEQP3M.js";import{d as ml,e as gr,f as gg}from"./U6QAYG3E.js";import{k as Mn}from"./U4MT2N6T.js";import"./SJIUJN5L.js";import"./NMQNEH6L.js";import{b as Cg,c as dg,d as Qg,e as hg,f as pg,h as Dl,j as mg,k as yg,p as Sg}from"./CIIAHGYH.js";import{a as Ss,b as Ds,c as FC,d as ag,e as sg,f as kC,g as KC,j as JC,k as Ri,l as ug,m as so,o as Zn,p as cg}from"./37NKZLLR.js";import"./KRVF37OW.js";import{a as YC,b as zC,c as qC}from"./QRGNEKME.js";import{t as lg}from"./SWVUDSHP.js";import{b as OC,c as og,d as vn}from"./TNLCNVA2.js";import{a as Qt,b as $,c as $S,d as iA}from"./I6NRCYLI.js";var VC=$(Ns=>{"use strict";var AD=Symbol.for("react.transitional.element"),tD=Symbol.for("react.fragment");function XC(A,e,i){var r=null;if(i!==void 0&&(r=""+i),e.key!==void 0&&(r=""+e.key),"key"in e){i={};for(var l in e)l!=="key"&&(i[l]=e[l])}else i=e;return e=i.ref,{$$typeof:AD,type:A,key:r,ref:e!==void 0?e:null,props:i}}Ns.Fragment=tD;Ns.jsx=XC;Ns.jsxs=XC});var ye=$((BG,ZC)=>{"use strict";ZC.exports=VC()});var od=$(CA=>{"use strict";var Gg=Symbol.for("react.transitional.element"),eD=Symbol.for("react.portal"),nD=Symbol.for("react.fragment"),iD=Symbol.for("react.strict_mode"),rD=Symbol.for("react.profiler"),oD=Symbol.for("react.consumer"),lD=Symbol.for("react.context"),aD=Symbol.for("react.forward_ref"),sD=Symbol.for("react.suspense"),uD=Symbol.for("react.memo"),Ad=Symbol.for("react.lazy"),cD=Symbol.for("react.activity"),jC=Symbol.iterator;function gD(A){return A===null||typeof A!="object"?null:(A=jC&&A[jC]||A["@@iterator"],typeof A=="function"?A:null)}var td={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ed=Object.assign,nd={};function co(A,e,i){this.props=A,this.context=e,this.refs=nd,this.updater=i||td}co.prototype.isReactComponent={};co.prototype.setState=function(A,e){if(typeof A!="object"&&typeof A!="function"&&A!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,A,e,"setState")};co.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function id(){}id.prototype=co.prototype;function bg(A,e,i){this.props=A,this.context=e,this.refs=nd,this.updater=i||td}var Ug=bg.prototype=new id;Ug.constructor=bg;ed(Ug,co.prototype);Ug.isPureReactComponent=!0;var WC=Array.isArray;function Tg(){}var tt={H:null,A:null,T:null,S:null},rd=Object.prototype.hasOwnProperty;function Hg(A,e,i){var r=i.ref;return{$$typeof:Gg,type:A,key:e,ref:r!==void 0?r:null,props:i}}function fD(A,e){return Hg(A.type,e,A.props)}function xg(A){return typeof A=="object"&&A!==null&&A.$$typeof===Gg}function ED(A){var e={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(i){return e[i]})}var PC=/\/+/g;function Mg(A,e){return typeof A=="object"&&A!==null&&A.key!=null?ED(""+A.key):e.toString(36)}function ID(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(Tg,Tg):(A.status="pending",A.then(function(e){A.status==="pending"&&(A.status="fulfilled",A.value=e)},function(e){A.status==="pending"&&(A.status="rejected",A.reason=e)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function uo(A,e,i,r,l){var s=typeof A;(s==="undefined"||s==="boolean")&&(A=null);var u=!1;if(A===null)u=!0;else switch(s){case"bigint":case"string":case"number":u=!0;break;case"object":switch(A.$$typeof){case Gg:case eD:u=!0;break;case Ad:return u=A._init,uo(u(A._payload),e,i,r,l)}}if(u)return l=l(A),u=r===""?"."+Mg(A,0):r,WC(l)?(i="",u!=null&&(i=u.replace(PC,"$&/")+"/"),uo(l,e,i,"",function(d){return d})):l!=null&&(xg(l)&&(l=fD(l,i+(l.key==null||A&&A.key===l.key?"":(""+l.key).replace(PC,"$&/")+"/")+u)),e.push(l)),1;u=0;var f=r===""?".":r+":";if(WC(A))for(var E=0;E<A.length;E++)r=A[E],s=f+Mg(r,E),u+=uo(r,e,i,s,l);else if(E=gD(A),typeof E=="function")for(A=E.call(A),E=0;!(r=A.next()).done;)r=r.value,s=f+Mg(r,E++),u+=uo(r,e,i,s,l);else if(s==="object"){if(typeof A.then=="function")return uo(ID(A),e,i,r,l);throw e=String(A),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.")}return u}function ws(A,e,i){if(A==null)return A;var r=[],l=0;return uo(A,r,"","",function(s){return e.call(i,s,l++)}),r}function BD(A){if(A._status===-1){var e=A._result;e=e(),e.then(function(i){(A._status===0||A._status===-1)&&(A._status=1,A._result=i)},function(i){(A._status===0||A._status===-1)&&(A._status=2,A._result=i)}),A._status===-1&&(A._status=0,A._result=e)}if(A._status===1)return A._result.default;throw A._result}var $C=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},CD={map:ws,forEach:function(A,e,i){ws(A,function(){e.apply(this,arguments)},i)},count:function(A){var e=0;return ws(A,function(){e++}),e},toArray:function(A){return ws(A,function(e){return e})||[]},only:function(A){if(!xg(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};CA.Activity=cD;CA.Children=CD;CA.Component=co;CA.Fragment=nD;CA.Profiler=rD;CA.PureComponent=bg;CA.StrictMode=iD;CA.Suspense=sD;CA.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=tt;CA.__COMPILER_RUNTIME={__proto__:null,c:function(A){return tt.H.useMemoCache(A)}};CA.cache=function(A){return function(){return A.apply(null,arguments)}};CA.cacheSignal=function(){return null};CA.cloneElement=function(A,e,i){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var r=ed({},A.props),l=A.key;if(e!=null)for(s in e.key!==void 0&&(l=""+e.key),e)!rd.call(e,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&e.ref===void 0||(r[s]=e[s]);var s=arguments.length-2;if(s===1)r.children=i;else if(1<s){for(var u=Array(s),f=0;f<s;f++)u[f]=arguments[f+2];r.children=u}return Hg(A.type,l,r)};CA.createContext=function(A){return A={$$typeof:lD,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:oD,_context:A},A};CA.createElement=function(A,e,i){var r,l={},s=null;if(e!=null)for(r in e.key!==void 0&&(s=""+e.key),e)rd.call(e,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(l[r]=e[r]);var u=arguments.length-2;if(u===1)l.children=i;else if(1<u){for(var f=Array(u),E=0;E<u;E++)f[E]=arguments[E+2];l.children=f}if(A&&A.defaultProps)for(r in u=A.defaultProps,u)l[r]===void 0&&(l[r]=u[r]);return Hg(A,s,l)};CA.createRef=function(){return{current:null}};CA.forwardRef=function(A){return{$$typeof:aD,render:A}};CA.isValidElement=xg;CA.lazy=function(A){return{$$typeof:Ad,_payload:{_status:-1,_result:A},_init:BD}};CA.memo=function(A,e){return{$$typeof:uD,type:A,compare:e===void 0?null:e}};CA.startTransition=function(A){var e=tt.T,i={};tt.T=i;try{var r=A(),l=tt.S;l!==null&&l(i,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(Tg,$C)}catch(s){$C(s)}finally{e!==null&&i.types!==null&&(e.types=i.types),tt.T=e}};CA.unstable_useCacheRefresh=function(){return tt.H.useCacheRefresh()};CA.use=function(A){return tt.H.use(A)};CA.useActionState=function(A,e,i){return tt.H.useActionState(A,e,i)};CA.useCallback=function(A,e){return tt.H.useCallback(A,e)};CA.useContext=function(A){return tt.H.useContext(A)};CA.useDebugValue=function(){};CA.useDeferredValue=function(A,e){return tt.H.useDeferredValue(A,e)};CA.useEffect=function(A,e){return tt.H.useEffect(A,e)};CA.useEffectEvent=function(A){return tt.H.useEffectEvent(A)};CA.useId=function(){return tt.H.useId()};CA.useImperativeHandle=function(A,e,i){return tt.H.useImperativeHandle(A,e,i)};CA.useInsertionEffect=function(A,e){return tt.H.useInsertionEffect(A,e)};CA.useLayoutEffect=function(A,e){return tt.H.useLayoutEffect(A,e)};CA.useMemo=function(A,e){return tt.H.useMemo(A,e)};CA.useOptimistic=function(A,e){return tt.H.useOptimistic(A,e)};CA.useReducer=function(A,e,i){return tt.H.useReducer(A,e,i)};CA.useRef=function(A){return tt.H.useRef(A)};CA.useState=function(A){return tt.H.useState(A)};CA.useSyncExternalStore=function(A,e,i){return tt.H.useSyncExternalStore(A,e,i)};CA.useTransition=function(){return tt.H.useTransition()};CA.version="19.2.8"});var EA=$((dG,ld)=>{"use strict";ld.exports=od()});var Qd=$((ZG,Gs)=>{Gs.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Gs.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Gs.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Kg=$((jG,Qo)=>{var at=global.process,Er=function(A){return A&&typeof A=="object"&&typeof A.removeListener=="function"&&typeof A.emit=="function"&&typeof A.reallyExit=="function"&&typeof A.listeners=="function"&&typeof A.kill=="function"&&typeof A.pid=="number"&&typeof A.on=="function"};Er(at)?(hd=Qt("assert"),Bo=Qd(),pd=/^win/i.test(at.platform),vl=Qt("events"),typeof vl!="function"&&(vl=vl.EventEmitter),at.__signal_exit_emitter__?qt=at.__signal_exit_emitter__:(qt=at.__signal_exit_emitter__=new vl,qt.count=0,qt.emitted={}),qt.infinite||(qt.setMaxListeners(1/0),qt.infinite=!0),Qo.exports=function(A,e){if(!Er(global.process))return function(){};hd.equal(typeof A,"function","a callback must be provided for exit handler"),Co===!1&&Fg();var i="exit";e&&e.alwaysLast&&(i="afterexit");var r=function(){qt.removeListener(i,A),qt.listeners("exit").length===0&&qt.listeners("afterexit").length===0&&bs()};return qt.on(i,A),r},bs=function(){!Co||!Er(global.process)||(Co=!1,Bo.forEach(function(e){try{at.removeListener(e,Us[e])}catch{}}),at.emit=Hs,at.reallyExit=kg,qt.count-=1)},Qo.exports.unload=bs,Ir=function(e,i,r){qt.emitted[e]||(qt.emitted[e]=!0,qt.emit(e,i,r))},Us={},Bo.forEach(function(A){Us[A]=function(){if(Er(global.process)){var i=at.listeners(A);i.length===qt.count&&(bs(),Ir("exit",null,A),Ir("afterexit",null,A),pd&&A==="SIGHUP"&&(A="SIGINT"),at.kill(at.pid,A))}}}),Qo.exports.signals=function(){return Bo},Co=!1,Fg=function(){Co||!Er(global.process)||(Co=!0,qt.count+=1,Bo=Bo.filter(function(e){try{return at.on(e,Us[e]),!0}catch{return!1}}),at.emit=yd,at.reallyExit=md)},Qo.exports.load=Fg,kg=at.reallyExit,md=function(e){Er(global.process)&&(at.exitCode=e||0,Ir("exit",at.exitCode,null),Ir("afterexit",at.exitCode,null),kg.call(at,at.exitCode))},Hs=at.emit,yd=function(e,i){if(e==="exit"&&Er(global.process)){i!==void 0&&(at.exitCode=i);var r=Hs.apply(this,arguments);return Ir("exit",at.exitCode,null),Ir("afterexit",at.exitCode,null),r}else return Hs.apply(this,arguments)}):Qo.exports=function(){return function(){}};var hd,Bo,pd,vl,qt,bs,Ir,Us,Co,Fg,kg,md,Hs,yd});var Nd=$(Ni=>{"use strict";Ni.ConcurrentRoot=1;Ni.ContinuousEventPriority=8;Ni.DefaultEventPriority=32;Ni.DiscreteEventPriority=2;Ni.IdleEventPriority=268435456;Ni.LegacyRoot=0;Ni.NoEventPriority=0});var xs=$((Ab,wd)=>{"use strict";wd.exports=Nd()});var bQ=$(ut=>{"use strict";function gf(A,e){var i=A.length;A.push(e);A:for(;0<i;){var r=i-1>>>1,l=A[r];if(0<Ks(l,e))A[r]=e,A[i]=l,i=r;else break A}}function Tn(A){return A.length===0?null:A[0]}function Ys(A){if(A.length===0)return null;var e=A[0],i=A.pop();if(i!==e){A[0]=i;A:for(var r=0,l=A.length,s=l>>>1;r<s;){var u=2*(r+1)-1,f=A[u],E=u+1,d=A[E];if(0>Ks(f,i))E<l&&0>Ks(d,f)?(A[r]=d,A[E]=i,r=E):(A[r]=f,A[u]=i,r=u);else if(E<l&&0>Ks(d,i))A[r]=d,A[E]=i,r=E;else break A}}return e}function Ks(A,e){var i=A.sortIndex-e.sortIndex;return i!==0?i:A.id-e.id}ut.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(SQ=performance,ut.unstable_now=function(){return SQ.now()}):(sf=Date,DQ=sf.now(),ut.unstable_now=function(){return sf.now()-DQ});var SQ,sf,DQ,$n=[],wi=[],AN=1,Xe=null,oe=3,ff=!1,Ll=!1,_l=!1,Ef=!1,wQ=typeof setTimeout=="function"?setTimeout:null,vQ=typeof clearTimeout=="function"?clearTimeout:null,RQ=typeof setImmediate<"u"?setImmediate:null;function Js(A){for(var e=Tn(wi);e!==null;){if(e.callback===null)Ys(wi);else if(e.startTime<=A)Ys(wi),e.sortIndex=e.expirationTime,gf($n,e);else break;e=Tn(wi)}}function If(A){if(_l=!1,Js(A),!Ll)if(Tn($n)!==null)Ll=!0,Ro||(Ro=!0,Do());else{var e=Tn(wi);e!==null&&Bf(If,e.startTime-A)}}var Ro=!1,Ol=-1,MQ=5,TQ=-1;function GQ(){return Ef?!0:!(ut.unstable_now()-TQ<MQ)}function uf(){if(Ef=!1,Ro){var A=ut.unstable_now();TQ=A;var e=!0;try{A:{Ll=!1,_l&&(_l=!1,vQ(Ol),Ol=-1),ff=!0;var i=oe;try{t:{for(Js(A),Xe=Tn($n);Xe!==null&&!(Xe.expirationTime>A&&GQ());){var r=Xe.callback;if(typeof r=="function"){Xe.callback=null,oe=Xe.priorityLevel;var l=r(Xe.expirationTime<=A);if(A=ut.unstable_now(),typeof l=="function"){Xe.callback=l,Js(A),e=!0;break t}Xe===Tn($n)&&Ys($n),Js(A)}else Ys($n);Xe=Tn($n)}if(Xe!==null)e=!0;else{var s=Tn(wi);s!==null&&Bf(If,s.startTime-A),e=!1}}break A}finally{Xe=null,oe=i,ff=!1}e=void 0}}finally{e?Do():Ro=!1}}}var Do;typeof RQ=="function"?Do=function(){RQ(uf)}:typeof MessageChannel<"u"?(cf=new MessageChannel,NQ=cf.port2,cf.port1.onmessage=uf,Do=function(){NQ.postMessage(null)}):Do=function(){wQ(uf,0)};var cf,NQ;function Bf(A,e){Ol=wQ(function(){A(ut.unstable_now())},e)}ut.unstable_IdlePriority=5;ut.unstable_ImmediatePriority=1;ut.unstable_LowPriority=4;ut.unstable_NormalPriority=3;ut.unstable_Profiling=null;ut.unstable_UserBlockingPriority=2;ut.unstable_cancelCallback=function(A){A.callback=null};ut.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):MQ=0<A?Math.floor(1e3/A):5};ut.unstable_getCurrentPriorityLevel=function(){return oe};ut.unstable_next=function(A){switch(oe){case 1:case 2:case 3:var e=3;break;default:e=oe}var i=oe;oe=e;try{return A()}finally{oe=i}};ut.unstable_requestPaint=function(){Ef=!0};ut.unstable_runWithPriority=function(A,e){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var i=oe;oe=A;try{return e()}finally{oe=i}};ut.unstable_scheduleCallback=function(A,e,i){var r=ut.unstable_now();switch(typeof i=="object"&&i!==null?(i=i.delay,i=typeof i=="number"&&0<i?r+i:r):i=r,A){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return l=i+l,A={id:AN++,callback:e,priorityLevel:A,startTime:i,expirationTime:l,sortIndex:-1},i>r?(A.sortIndex=i,gf(wi,A),Tn($n)===null&&A===Tn(wi)&&(_l?(vQ(Ol),Ol=-1):_l=!0,Bf(If,i-r))):(A.sortIndex=l,gf($n,A),Ll||ff||(Ll=!0,Ro||(Ro=!0,Do()))),A};ut.unstable_shouldYield=GQ;ut.unstable_wrapCallback=function(A){var e=oe;return function(){var i=oe;oe=e;try{return A.apply(this,arguments)}finally{oe=i}}}});var Cf=$((zb,UQ)=>{"use strict";UQ.exports=bQ()});var HQ=$((qb,Fl)=>{"use strict";Fl.exports=function(A){function e(t,n,o,a){return new i1(t,n,o,a)}function i(){}function r(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)n+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){var n=t,o=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(o=n.return),t=n.return;while(t)}return n.tag===3?o:null}function s(t){if(l(t)!==t)throw Error(r(188))}function u(t){var n=t.alternate;if(!n){if(n=l(t),n===null)throw Error(r(188));return n!==t?null:t}for(var o=t,a=n;;){var c=o.return;if(c===null)break;var g=c.alternate;if(g===null){if(a=c.return,a!==null){o=a;continue}break}if(c.child===g.child){for(g=c.child;g;){if(g===o)return s(c),t;if(g===a)return s(c),n;g=g.sibling}throw Error(r(188))}if(o.return!==a.return)o=c,a=g;else{for(var B=!1,y=c.child;y;){if(y===o){B=!0,o=c,a=g;break}if(y===a){B=!0,a=c,o=g;break}y=y.sibling}if(!B){for(y=g.child;y;){if(y===o){B=!0,o=g,a=c;break}if(y===a){B=!0,a=g,o=c;break}y=y.sibling}if(!B)throw Error(r(189))}}if(o.alternate!==a)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?t:n}function f(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=f(t),n!==null)return n;t=t.sibling}return null}function E(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(t.tag!==4&&(n=E(t),n!==null))return n;t=t.sibling}return null}function d(t){return t===null||typeof t!="object"?null:(t=iC&&t[iC]||t["@@iterator"],typeof t=="function"?t:null)}function h(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===s1?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Jr:return"Fragment";case Rc:return"Profiler";case eC:return"StrictMode";case wc:return"Suspense";case vc:return"SuspenseList";case Tc:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case Kr:return"Portal";case Ii:return t.displayName||"Context";case nC:return(t._context.displayName||"Context")+".Consumer";case Nc:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Mc:return n=t.displayName||null,n!==null?n:h(t.type)||"Memo";case Bi:n=t._payload,t=t._init;try{return h(t(n))}catch{}}return null}function S(t){return{current:t}}function Q(t){0>qr||(t.current=Lc[qr],Lc[qr]=null,qr--)}function p(t,n){qr++,Lc[qr]=t.current,t.current=n}function D(t){return t>>>=0,t===0?32:31-(LS(t)/_S|0)|0}function v(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function N(t,n,o){var a=t.pendingLanes;if(a===0)return 0;var c=0,g=t.suspendedLanes,B=t.pingedLanes;t=t.warmLanes;var y=a&134217727;return y!==0?(a=y&~g,a!==0?c=v(a):(B&=y,B!==0?c=v(B):o||(o=y&~t,o!==0&&(c=v(o))))):(y=a&~g,y!==0?c=v(y):B!==0?c=v(B):o||(o=a&~t,o!==0&&(c=v(o)))),c===0?0:n!==0&&n!==c&&(n&g)===0&&(g=c&-c,o=n&-n,g>=o||g===32&&(o&4194048)!==0)?n:c}function L(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function uA(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function J(){var t=rs;return rs<<=1,(rs&62914560)===0&&(rs=4194304),t}function G(t){for(var n=[],o=0;31>o;o++)n.push(t);return n}function q(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function V(t,n,o,a,c,g){var B=t.pendingLanes;t.pendingLanes=o,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=o,t.entangledLanes&=o,t.errorRecoveryDisabledLanes&=o,t.shellSuspendCounter=0;var y=t.entanglements,U=t.expirationTimes,O=t.hiddenUpdates;for(o=B&~o;0<o;){var W=31-Me(o),Y=1<<W;y[W]=0,U[W]=-1;var eA=O[W];if(eA!==null)for(O[W]=null,W=0;W<eA.length;W++){var BA=eA[W];BA!==null&&(BA.lane&=-536870913)}o&=~Y}a!==0&&fA(t,a,0),g!==0&&c===0&&t.tag!==0&&(t.suspendedLanes|=g&~(B&~n))}function fA(t,n,o){t.pendingLanes|=n,t.suspendedLanes&=~n;var a=31-Me(n);t.entangledLanes|=n,t.entanglements[a]=t.entanglements[a]|1073741824|o&261930}function TA(t,n){var o=t.entangledLanes|=n;for(t=t.entanglements;o;){var a=31-Me(o),c=1<<a;c&n|t[a]&n&&(t[a]|=n),o&=~c}}function AA(t,n){var o=n&-n;return o=(o&42)!==0?1:oA(o),(o&(t.suspendedLanes|n))!==0?0:o}function oA(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function OA(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function FA(t){if(typeof JS=="function"&&YS(t),Te&&typeof Te.setStrictMode=="function")try{Te.setStrictMode(ul,t)}catch{}}function rt(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}function PA(t){if(Fc===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);Fc=n&&n[1]||"",MC=-1<o.stack.indexOf(`
|
|
3
|
+
import{b as Rl,c as Rg,d as Ng,f as wg,g as vg}from"./QL4I7VLD.js";import{a as yl,b as Ig}from"./KEUAW3VO.js";import{h as Dg,i as Rs}from"./B6LZOIKD.js";import{a as fg,f as Eg,g as Sl,h as Bg}from"./5RGV2MW6.js";import"./JJGEV4EZ.js";import"./IONXNA5T.js";import"./ZAAEQP3M.js";import{d as ml,e as gr,f as gg}from"./U6QAYG3E.js";import{k as Mn}from"./PDOEV4QJ.js";import"./4CO2WAXZ.js";import"./HRFNURKU.js";import{b as Cg,c as dg,d as Qg,e as hg,f as pg,h as Dl,j as mg,k as yg,p as Sg}from"./ETEPTJGZ.js";import{a as Ss,b as Ds,c as FC,d as ag,e as sg,f as kC,g as KC,j as JC,k as Ri,l as ug,m as so,o as Zn,p as cg}from"./37NKZLLR.js";import"./KRVF37OW.js";import{a as YC,b as zC,c as qC}from"./QRGNEKME.js";import{t as lg}from"./SWVUDSHP.js";import{b as OC,c as og,d as vn}from"./TNLCNVA2.js";import{a as Qt,b as $,c as $S,d as iA}from"./I6NRCYLI.js";var VC=$(Ns=>{"use strict";var AD=Symbol.for("react.transitional.element"),tD=Symbol.for("react.fragment");function XC(A,e,i){var r=null;if(i!==void 0&&(r=""+i),e.key!==void 0&&(r=""+e.key),"key"in e){i={};for(var l in e)l!=="key"&&(i[l]=e[l])}else i=e;return e=i.ref,{$$typeof:AD,type:A,key:r,ref:e!==void 0?e:null,props:i}}Ns.Fragment=tD;Ns.jsx=XC;Ns.jsxs=XC});var ye=$((BG,ZC)=>{"use strict";ZC.exports=VC()});var od=$(CA=>{"use strict";var Gg=Symbol.for("react.transitional.element"),eD=Symbol.for("react.portal"),nD=Symbol.for("react.fragment"),iD=Symbol.for("react.strict_mode"),rD=Symbol.for("react.profiler"),oD=Symbol.for("react.consumer"),lD=Symbol.for("react.context"),aD=Symbol.for("react.forward_ref"),sD=Symbol.for("react.suspense"),uD=Symbol.for("react.memo"),Ad=Symbol.for("react.lazy"),cD=Symbol.for("react.activity"),jC=Symbol.iterator;function gD(A){return A===null||typeof A!="object"?null:(A=jC&&A[jC]||A["@@iterator"],typeof A=="function"?A:null)}var td={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ed=Object.assign,nd={};function co(A,e,i){this.props=A,this.context=e,this.refs=nd,this.updater=i||td}co.prototype.isReactComponent={};co.prototype.setState=function(A,e){if(typeof A!="object"&&typeof A!="function"&&A!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,A,e,"setState")};co.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function id(){}id.prototype=co.prototype;function bg(A,e,i){this.props=A,this.context=e,this.refs=nd,this.updater=i||td}var Ug=bg.prototype=new id;Ug.constructor=bg;ed(Ug,co.prototype);Ug.isPureReactComponent=!0;var WC=Array.isArray;function Tg(){}var tt={H:null,A:null,T:null,S:null},rd=Object.prototype.hasOwnProperty;function Hg(A,e,i){var r=i.ref;return{$$typeof:Gg,type:A,key:e,ref:r!==void 0?r:null,props:i}}function fD(A,e){return Hg(A.type,e,A.props)}function xg(A){return typeof A=="object"&&A!==null&&A.$$typeof===Gg}function ED(A){var e={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(i){return e[i]})}var PC=/\/+/g;function Mg(A,e){return typeof A=="object"&&A!==null&&A.key!=null?ED(""+A.key):e.toString(36)}function ID(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(Tg,Tg):(A.status="pending",A.then(function(e){A.status==="pending"&&(A.status="fulfilled",A.value=e)},function(e){A.status==="pending"&&(A.status="rejected",A.reason=e)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function uo(A,e,i,r,l){var s=typeof A;(s==="undefined"||s==="boolean")&&(A=null);var u=!1;if(A===null)u=!0;else switch(s){case"bigint":case"string":case"number":u=!0;break;case"object":switch(A.$$typeof){case Gg:case eD:u=!0;break;case Ad:return u=A._init,uo(u(A._payload),e,i,r,l)}}if(u)return l=l(A),u=r===""?"."+Mg(A,0):r,WC(l)?(i="",u!=null&&(i=u.replace(PC,"$&/")+"/"),uo(l,e,i,"",function(d){return d})):l!=null&&(xg(l)&&(l=fD(l,i+(l.key==null||A&&A.key===l.key?"":(""+l.key).replace(PC,"$&/")+"/")+u)),e.push(l)),1;u=0;var f=r===""?".":r+":";if(WC(A))for(var E=0;E<A.length;E++)r=A[E],s=f+Mg(r,E),u+=uo(r,e,i,s,l);else if(E=gD(A),typeof E=="function")for(A=E.call(A),E=0;!(r=A.next()).done;)r=r.value,s=f+Mg(r,E++),u+=uo(r,e,i,s,l);else if(s==="object"){if(typeof A.then=="function")return uo(ID(A),e,i,r,l);throw e=String(A),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.")}return u}function ws(A,e,i){if(A==null)return A;var r=[],l=0;return uo(A,r,"","",function(s){return e.call(i,s,l++)}),r}function BD(A){if(A._status===-1){var e=A._result;e=e(),e.then(function(i){(A._status===0||A._status===-1)&&(A._status=1,A._result=i)},function(i){(A._status===0||A._status===-1)&&(A._status=2,A._result=i)}),A._status===-1&&(A._status=0,A._result=e)}if(A._status===1)return A._result.default;throw A._result}var $C=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},CD={map:ws,forEach:function(A,e,i){ws(A,function(){e.apply(this,arguments)},i)},count:function(A){var e=0;return ws(A,function(){e++}),e},toArray:function(A){return ws(A,function(e){return e})||[]},only:function(A){if(!xg(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};CA.Activity=cD;CA.Children=CD;CA.Component=co;CA.Fragment=nD;CA.Profiler=rD;CA.PureComponent=bg;CA.StrictMode=iD;CA.Suspense=sD;CA.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=tt;CA.__COMPILER_RUNTIME={__proto__:null,c:function(A){return tt.H.useMemoCache(A)}};CA.cache=function(A){return function(){return A.apply(null,arguments)}};CA.cacheSignal=function(){return null};CA.cloneElement=function(A,e,i){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var r=ed({},A.props),l=A.key;if(e!=null)for(s in e.key!==void 0&&(l=""+e.key),e)!rd.call(e,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&e.ref===void 0||(r[s]=e[s]);var s=arguments.length-2;if(s===1)r.children=i;else if(1<s){for(var u=Array(s),f=0;f<s;f++)u[f]=arguments[f+2];r.children=u}return Hg(A.type,l,r)};CA.createContext=function(A){return A={$$typeof:lD,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:oD,_context:A},A};CA.createElement=function(A,e,i){var r,l={},s=null;if(e!=null)for(r in e.key!==void 0&&(s=""+e.key),e)rd.call(e,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(l[r]=e[r]);var u=arguments.length-2;if(u===1)l.children=i;else if(1<u){for(var f=Array(u),E=0;E<u;E++)f[E]=arguments[E+2];l.children=f}if(A&&A.defaultProps)for(r in u=A.defaultProps,u)l[r]===void 0&&(l[r]=u[r]);return Hg(A,s,l)};CA.createRef=function(){return{current:null}};CA.forwardRef=function(A){return{$$typeof:aD,render:A}};CA.isValidElement=xg;CA.lazy=function(A){return{$$typeof:Ad,_payload:{_status:-1,_result:A},_init:BD}};CA.memo=function(A,e){return{$$typeof:uD,type:A,compare:e===void 0?null:e}};CA.startTransition=function(A){var e=tt.T,i={};tt.T=i;try{var r=A(),l=tt.S;l!==null&&l(i,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(Tg,$C)}catch(s){$C(s)}finally{e!==null&&i.types!==null&&(e.types=i.types),tt.T=e}};CA.unstable_useCacheRefresh=function(){return tt.H.useCacheRefresh()};CA.use=function(A){return tt.H.use(A)};CA.useActionState=function(A,e,i){return tt.H.useActionState(A,e,i)};CA.useCallback=function(A,e){return tt.H.useCallback(A,e)};CA.useContext=function(A){return tt.H.useContext(A)};CA.useDebugValue=function(){};CA.useDeferredValue=function(A,e){return tt.H.useDeferredValue(A,e)};CA.useEffect=function(A,e){return tt.H.useEffect(A,e)};CA.useEffectEvent=function(A){return tt.H.useEffectEvent(A)};CA.useId=function(){return tt.H.useId()};CA.useImperativeHandle=function(A,e,i){return tt.H.useImperativeHandle(A,e,i)};CA.useInsertionEffect=function(A,e){return tt.H.useInsertionEffect(A,e)};CA.useLayoutEffect=function(A,e){return tt.H.useLayoutEffect(A,e)};CA.useMemo=function(A,e){return tt.H.useMemo(A,e)};CA.useOptimistic=function(A,e){return tt.H.useOptimistic(A,e)};CA.useReducer=function(A,e,i){return tt.H.useReducer(A,e,i)};CA.useRef=function(A){return tt.H.useRef(A)};CA.useState=function(A){return tt.H.useState(A)};CA.useSyncExternalStore=function(A,e,i){return tt.H.useSyncExternalStore(A,e,i)};CA.useTransition=function(){return tt.H.useTransition()};CA.version="19.2.8"});var EA=$((dG,ld)=>{"use strict";ld.exports=od()});var Qd=$((ZG,Gs)=>{Gs.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Gs.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Gs.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Kg=$((jG,Qo)=>{var at=global.process,Er=function(A){return A&&typeof A=="object"&&typeof A.removeListener=="function"&&typeof A.emit=="function"&&typeof A.reallyExit=="function"&&typeof A.listeners=="function"&&typeof A.kill=="function"&&typeof A.pid=="number"&&typeof A.on=="function"};Er(at)?(hd=Qt("assert"),Bo=Qd(),pd=/^win/i.test(at.platform),vl=Qt("events"),typeof vl!="function"&&(vl=vl.EventEmitter),at.__signal_exit_emitter__?qt=at.__signal_exit_emitter__:(qt=at.__signal_exit_emitter__=new vl,qt.count=0,qt.emitted={}),qt.infinite||(qt.setMaxListeners(1/0),qt.infinite=!0),Qo.exports=function(A,e){if(!Er(global.process))return function(){};hd.equal(typeof A,"function","a callback must be provided for exit handler"),Co===!1&&Fg();var i="exit";e&&e.alwaysLast&&(i="afterexit");var r=function(){qt.removeListener(i,A),qt.listeners("exit").length===0&&qt.listeners("afterexit").length===0&&bs()};return qt.on(i,A),r},bs=function(){!Co||!Er(global.process)||(Co=!1,Bo.forEach(function(e){try{at.removeListener(e,Us[e])}catch{}}),at.emit=Hs,at.reallyExit=kg,qt.count-=1)},Qo.exports.unload=bs,Ir=function(e,i,r){qt.emitted[e]||(qt.emitted[e]=!0,qt.emit(e,i,r))},Us={},Bo.forEach(function(A){Us[A]=function(){if(Er(global.process)){var i=at.listeners(A);i.length===qt.count&&(bs(),Ir("exit",null,A),Ir("afterexit",null,A),pd&&A==="SIGHUP"&&(A="SIGINT"),at.kill(at.pid,A))}}}),Qo.exports.signals=function(){return Bo},Co=!1,Fg=function(){Co||!Er(global.process)||(Co=!0,qt.count+=1,Bo=Bo.filter(function(e){try{return at.on(e,Us[e]),!0}catch{return!1}}),at.emit=yd,at.reallyExit=md)},Qo.exports.load=Fg,kg=at.reallyExit,md=function(e){Er(global.process)&&(at.exitCode=e||0,Ir("exit",at.exitCode,null),Ir("afterexit",at.exitCode,null),kg.call(at,at.exitCode))},Hs=at.emit,yd=function(e,i){if(e==="exit"&&Er(global.process)){i!==void 0&&(at.exitCode=i);var r=Hs.apply(this,arguments);return Ir("exit",at.exitCode,null),Ir("afterexit",at.exitCode,null),r}else return Hs.apply(this,arguments)}):Qo.exports=function(){return function(){}};var hd,Bo,pd,vl,qt,bs,Ir,Us,Co,Fg,kg,md,Hs,yd});var Nd=$(Ni=>{"use strict";Ni.ConcurrentRoot=1;Ni.ContinuousEventPriority=8;Ni.DefaultEventPriority=32;Ni.DiscreteEventPriority=2;Ni.IdleEventPriority=268435456;Ni.LegacyRoot=0;Ni.NoEventPriority=0});var xs=$((Ab,wd)=>{"use strict";wd.exports=Nd()});var bQ=$(ut=>{"use strict";function gf(A,e){var i=A.length;A.push(e);A:for(;0<i;){var r=i-1>>>1,l=A[r];if(0<Ks(l,e))A[r]=e,A[i]=l,i=r;else break A}}function Tn(A){return A.length===0?null:A[0]}function Ys(A){if(A.length===0)return null;var e=A[0],i=A.pop();if(i!==e){A[0]=i;A:for(var r=0,l=A.length,s=l>>>1;r<s;){var u=2*(r+1)-1,f=A[u],E=u+1,d=A[E];if(0>Ks(f,i))E<l&&0>Ks(d,f)?(A[r]=d,A[E]=i,r=E):(A[r]=f,A[u]=i,r=u);else if(E<l&&0>Ks(d,i))A[r]=d,A[E]=i,r=E;else break A}}return e}function Ks(A,e){var i=A.sortIndex-e.sortIndex;return i!==0?i:A.id-e.id}ut.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(SQ=performance,ut.unstable_now=function(){return SQ.now()}):(sf=Date,DQ=sf.now(),ut.unstable_now=function(){return sf.now()-DQ});var SQ,sf,DQ,$n=[],wi=[],AN=1,Xe=null,oe=3,ff=!1,Ll=!1,_l=!1,Ef=!1,wQ=typeof setTimeout=="function"?setTimeout:null,vQ=typeof clearTimeout=="function"?clearTimeout:null,RQ=typeof setImmediate<"u"?setImmediate:null;function Js(A){for(var e=Tn(wi);e!==null;){if(e.callback===null)Ys(wi);else if(e.startTime<=A)Ys(wi),e.sortIndex=e.expirationTime,gf($n,e);else break;e=Tn(wi)}}function If(A){if(_l=!1,Js(A),!Ll)if(Tn($n)!==null)Ll=!0,Ro||(Ro=!0,Do());else{var e=Tn(wi);e!==null&&Bf(If,e.startTime-A)}}var Ro=!1,Ol=-1,MQ=5,TQ=-1;function GQ(){return Ef?!0:!(ut.unstable_now()-TQ<MQ)}function uf(){if(Ef=!1,Ro){var A=ut.unstable_now();TQ=A;var e=!0;try{A:{Ll=!1,_l&&(_l=!1,vQ(Ol),Ol=-1),ff=!0;var i=oe;try{t:{for(Js(A),Xe=Tn($n);Xe!==null&&!(Xe.expirationTime>A&&GQ());){var r=Xe.callback;if(typeof r=="function"){Xe.callback=null,oe=Xe.priorityLevel;var l=r(Xe.expirationTime<=A);if(A=ut.unstable_now(),typeof l=="function"){Xe.callback=l,Js(A),e=!0;break t}Xe===Tn($n)&&Ys($n),Js(A)}else Ys($n);Xe=Tn($n)}if(Xe!==null)e=!0;else{var s=Tn(wi);s!==null&&Bf(If,s.startTime-A),e=!1}}break A}finally{Xe=null,oe=i,ff=!1}e=void 0}}finally{e?Do():Ro=!1}}}var Do;typeof RQ=="function"?Do=function(){RQ(uf)}:typeof MessageChannel<"u"?(cf=new MessageChannel,NQ=cf.port2,cf.port1.onmessage=uf,Do=function(){NQ.postMessage(null)}):Do=function(){wQ(uf,0)};var cf,NQ;function Bf(A,e){Ol=wQ(function(){A(ut.unstable_now())},e)}ut.unstable_IdlePriority=5;ut.unstable_ImmediatePriority=1;ut.unstable_LowPriority=4;ut.unstable_NormalPriority=3;ut.unstable_Profiling=null;ut.unstable_UserBlockingPriority=2;ut.unstable_cancelCallback=function(A){A.callback=null};ut.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):MQ=0<A?Math.floor(1e3/A):5};ut.unstable_getCurrentPriorityLevel=function(){return oe};ut.unstable_next=function(A){switch(oe){case 1:case 2:case 3:var e=3;break;default:e=oe}var i=oe;oe=e;try{return A()}finally{oe=i}};ut.unstable_requestPaint=function(){Ef=!0};ut.unstable_runWithPriority=function(A,e){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var i=oe;oe=A;try{return e()}finally{oe=i}};ut.unstable_scheduleCallback=function(A,e,i){var r=ut.unstable_now();switch(typeof i=="object"&&i!==null?(i=i.delay,i=typeof i=="number"&&0<i?r+i:r):i=r,A){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return l=i+l,A={id:AN++,callback:e,priorityLevel:A,startTime:i,expirationTime:l,sortIndex:-1},i>r?(A.sortIndex=i,gf(wi,A),Tn($n)===null&&A===Tn(wi)&&(_l?(vQ(Ol),Ol=-1):_l=!0,Bf(If,i-r))):(A.sortIndex=l,gf($n,A),Ll||ff||(Ll=!0,Ro||(Ro=!0,Do()))),A};ut.unstable_shouldYield=GQ;ut.unstable_wrapCallback=function(A){var e=oe;return function(){var i=oe;oe=e;try{return A.apply(this,arguments)}finally{oe=i}}}});var Cf=$((zb,UQ)=>{"use strict";UQ.exports=bQ()});var HQ=$((qb,Fl)=>{"use strict";Fl.exports=function(A){function e(t,n,o,a){return new i1(t,n,o,a)}function i(){}function r(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)n+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){var n=t,o=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(o=n.return),t=n.return;while(t)}return n.tag===3?o:null}function s(t){if(l(t)!==t)throw Error(r(188))}function u(t){var n=t.alternate;if(!n){if(n=l(t),n===null)throw Error(r(188));return n!==t?null:t}for(var o=t,a=n;;){var c=o.return;if(c===null)break;var g=c.alternate;if(g===null){if(a=c.return,a!==null){o=a;continue}break}if(c.child===g.child){for(g=c.child;g;){if(g===o)return s(c),t;if(g===a)return s(c),n;g=g.sibling}throw Error(r(188))}if(o.return!==a.return)o=c,a=g;else{for(var B=!1,y=c.child;y;){if(y===o){B=!0,o=c,a=g;break}if(y===a){B=!0,a=c,o=g;break}y=y.sibling}if(!B){for(y=g.child;y;){if(y===o){B=!0,o=g,a=c;break}if(y===a){B=!0,a=g,o=c;break}y=y.sibling}if(!B)throw Error(r(189))}}if(o.alternate!==a)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?t:n}function f(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=f(t),n!==null)return n;t=t.sibling}return null}function E(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(t.tag!==4&&(n=E(t),n!==null))return n;t=t.sibling}return null}function d(t){return t===null||typeof t!="object"?null:(t=iC&&t[iC]||t["@@iterator"],typeof t=="function"?t:null)}function h(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===s1?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Jr:return"Fragment";case Rc:return"Profiler";case eC:return"StrictMode";case wc:return"Suspense";case vc:return"SuspenseList";case Tc:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case Kr:return"Portal";case Ii:return t.displayName||"Context";case nC:return(t._context.displayName||"Context")+".Consumer";case Nc:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Mc:return n=t.displayName||null,n!==null?n:h(t.type)||"Memo";case Bi:n=t._payload,t=t._init;try{return h(t(n))}catch{}}return null}function S(t){return{current:t}}function Q(t){0>qr||(t.current=Lc[qr],Lc[qr]=null,qr--)}function p(t,n){qr++,Lc[qr]=t.current,t.current=n}function D(t){return t>>>=0,t===0?32:31-(LS(t)/_S|0)|0}function v(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function N(t,n,o){var a=t.pendingLanes;if(a===0)return 0;var c=0,g=t.suspendedLanes,B=t.pingedLanes;t=t.warmLanes;var y=a&134217727;return y!==0?(a=y&~g,a!==0?c=v(a):(B&=y,B!==0?c=v(B):o||(o=y&~t,o!==0&&(c=v(o))))):(y=a&~g,y!==0?c=v(y):B!==0?c=v(B):o||(o=a&~t,o!==0&&(c=v(o)))),c===0?0:n!==0&&n!==c&&(n&g)===0&&(g=c&-c,o=n&-n,g>=o||g===32&&(o&4194048)!==0)?n:c}function L(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function uA(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function J(){var t=rs;return rs<<=1,(rs&62914560)===0&&(rs=4194304),t}function G(t){for(var n=[],o=0;31>o;o++)n.push(t);return n}function q(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function V(t,n,o,a,c,g){var B=t.pendingLanes;t.pendingLanes=o,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=o,t.entangledLanes&=o,t.errorRecoveryDisabledLanes&=o,t.shellSuspendCounter=0;var y=t.entanglements,U=t.expirationTimes,O=t.hiddenUpdates;for(o=B&~o;0<o;){var W=31-Me(o),Y=1<<W;y[W]=0,U[W]=-1;var eA=O[W];if(eA!==null)for(O[W]=null,W=0;W<eA.length;W++){var BA=eA[W];BA!==null&&(BA.lane&=-536870913)}o&=~Y}a!==0&&fA(t,a,0),g!==0&&c===0&&t.tag!==0&&(t.suspendedLanes|=g&~(B&~n))}function fA(t,n,o){t.pendingLanes|=n,t.suspendedLanes&=~n;var a=31-Me(n);t.entangledLanes|=n,t.entanglements[a]=t.entanglements[a]|1073741824|o&261930}function TA(t,n){var o=t.entangledLanes|=n;for(t=t.entanglements;o;){var a=31-Me(o),c=1<<a;c&n|t[a]&n&&(t[a]|=n),o&=~c}}function AA(t,n){var o=n&-n;return o=(o&42)!==0?1:oA(o),(o&(t.suspendedLanes|n))!==0?0:o}function oA(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function OA(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function FA(t){if(typeof JS=="function"&&YS(t),Te&&typeof Te.setStrictMode=="function")try{Te.setStrictMode(ul,t)}catch{}}function rt(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}function PA(t){if(Fc===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);Fc=n&&n[1]||"",MC=-1<o.stack.indexOf(`
|
|
4
4
|
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
5
5
|
`+Fc+t+MC}function qA(t,n){if(!t||kc)return"";kc=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(n){var Y=function(){throw Error()};if(Object.defineProperty(Y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Y,[])}catch(BA){var eA=BA}Reflect.construct(t,[],Y)}else{try{Y.call()}catch(BA){eA=BA}t.call(Y.prototype)}}else{try{throw Error()}catch(BA){eA=BA}(Y=t())&&typeof Y.catch=="function"&&Y.catch(function(){})}}catch(BA){if(BA&&eA&&typeof BA.stack=="string")return[BA.stack,eA.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=a.DetermineComponentFrameRoot(),B=g[0],y=g[1];if(B&&y){var U=B.split(`
|
|
6
6
|
`),O=y.split(`
|
|
@@ -74,4 +74,4 @@ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#isr
|
|
|
74
74
|
`))}patchConsole(){this.options.debug||(this.restoreConsole=Rd((e,i)=>{e==="stdout"&&this.writeToStdout(i),e==="stderr"&&(i.startsWith("The above error occurred")||this.writeToStderr(i))}))}registerInputControl(e,i){this.pauseInput=e,this.resumeInput=i}async suspendTerminal(e){if(this.beginSuspend(),e){try{await e()}finally{await this.endSuspend()}return}let i=async()=>{await this.endSuspend()};return{resume:i,[Symbol.asyncDispose]:i}}setAlternateScreen(e){this.alternateScreen=this.resolveAlternateScreenOption(e,this.interactive),this.alternateScreen&&(this.writeBestEffort(this.options.stdout,ZA.enterAlternativeScreen),this.writeBestEffort(this.options.stdout,dr))}resolveInteractiveOption(e){return e??(!Ts&&!!this.options.stdout.isTTY)}resolveAlternateScreenOption(e,i){return!!e&&i&&!!this.options.stdout.isTTY}shouldSync(){return Ph(this.options.stdout,this.interactive)}writeBestEffort(e,i){try{e.write(i)}catch{}}async awaitExit(){try{await this.exitPromise}catch{}}hasPendingConcurrentWork(){let e=this.container;return(e.pendingLanes??0)!==0&&e.callbackNode!==void 0&&e.callbackNode!==null}async awaitNextRender(){if(!this.nextRenderCommit){let e,i=new Promise(r=>{e=r});this.nextRenderCommit={promise:i,resolve:e}}return this.nextRenderCommit.promise}renderInteractiveFrame(e,i,r){let l=r!=="",s=this.options.stdout.isTTY,u=s?Pn(this.options.stdout).rows:24,E=s&&i>=u?e:e+`
|
|
75
75
|
`;if(lv({isTty:s,viewportRows:u,previousOutputHeight:this.lastOutputHeight,nextOutputHeight:i,isUnmounting:this.isUnmounting})){let h=this.shouldSync();h&&this.options.stdout.write(pr),this.options.stdout.write(ZA.clearTerminal+this.fullStaticOutput+E),this.lastOutput=e,this.lastOutputToRender=E,this.lastOutputHeight=i,this.log.sync(E),h&&this.options.stdout.write(Ti);return}if(l){let h=this.shouldSync();h&&this.options.stdout.write(pr),this.log.clear(),this.options.stdout.write(r),this.log(E),h&&this.options.stdout.write(Ti)}else(e!==this.lastOutput||this.log.isCursorDirty())&&this.throttledLog(E);this.lastOutput=e,this.lastOutputToRender=E,this.lastOutputHeight=i}initKittyKeyboard(){if(!this.options.kittyKeyboard)return;let e=this.options.kittyKeyboard,i=e.mode??"auto";if(i==="disabled")return;let r=e.flags??["disambiguateEscapeCodes"];if(i==="enabled"){this.options.stdin.isTTY&&this.options.stdout.isTTY&&this.enableKittyProtocol(r);return}!this.interactive||!this.options.stdin.isTTY||!this.options.stdout.isTTY||this.confirmKittySupport(r)}confirmKittySupport(e){let{stdin:i,stdout:r}=this.options,l=[],s=()=>{this.cancelKittyDetection=void 0,clearTimeout(f),i.removeListener("data",u);let E=rv(l);l=[],E.length>0&&i.unshift(Uint8Array.from(E))},u=E=>{let d=typeof E=="string"?jw.encode(E):E;for(let h of d)l.push(h);iv(l)&&(s(),this.isUnmounted||this.enableKittyProtocol(e))};i.on("data",u);let f=setTimeout(s,200);this.cancelKittyDetection=s,r.write("\x1B[?u")}enableKittyProtocol(e){this.options.stdout.write(`\x1B[>${nE(e)}u`),this.kittyProtocolEnabled=!0,this.kittyFlags=e}beginSuspend(){if(this.isSuspended)throw new Error("The terminal is already suspended. Resume the current suspension before suspending again.");if(this.isSuspended=!0,!(!this.interactive||this.isUnmounted||this.isUnmounting))try{let e=this.options.stdout,{canWriteToStdout:i}=hu(e);Uo(this.throttledOnRender,i),Uo(this.throttledLog,i),i&&(this.log.clear(),this.log.done(),this.kittyProtocolEnabled&&this.writeBestEffort(this.options.stdout,"\x1B[<u"),this.alternateScreen&&this.writeBestEffort(this.options.stdout,ZA.exitAlternativeScreen)),this.pauseInput?.()}catch(e){this.isSuspended=!1;try{this.resumeInput?.()}catch{}throw e}}async endSuspend(){if(!this.isSuspended||(this.isSuspended=!1,this.resumeInput?.(),!this.interactive||this.isUnmounted||this.isUnmounting))return;let e=this.options.stdout,{canWriteToStdout:i}=hu(e);i&&(this.alternateScreen&&this.writeBestEffort(this.options.stdout,ZA.enterAlternativeScreen),this.kittyProtocolEnabled&&this.kittyFlags&&this.writeBestEffort(this.options.stdout,`\x1B[>${nE(this.kittyFlags)}u`)),this.lastOutput="",this.lastOutputToRender="",this.lastOutputHeight=0,this.log.reset();try{this.calculateLayout(),this.onRender(),await this.waitUntilRenderFlush()}catch{}}};var sv=(A,e)=>{let i={stdout:ca.stdout,stdin:ca.stdin,stderr:ca.stderr,debug:!1,exitOnCtrlC:!0,patchConsole:!0,maxFps:30,incrementalRendering:!1,concurrent:!1,alternateScreen:!1,...uv(e)},r=cv(i.stdout,()=>new ua(i));return r.render(A),{rerender:r.render,unmount(){r.unmount()},waitUntilExit:r.waitUntilExit,waitUntilRenderFlush:r.waitUntilRenderFlush,cleanup(){r.unmount()},clear:r.clear}},oE=sv,uv=(A={})=>A instanceof av?{stdout:A,stdin:ca.stdin}:A,cv=(A,e)=>{let i=ra.get(A);if(i===void 0){let r=e();return ra.set(A,r),r}return ca.stderr.write(`Warning: render() was called again for the same stdout before the previous Ink instance was unmounted. Reusing stdout across multiple render() calls is unsupported. Call unmount() first.
|
|
76
76
|
`),i};var gv=iA(xs(),1);var mu=iA(EA(),1);var _p=iA(EA(),1);var fv=iA(EA(),1);var Ev=iA(EA(),1);var ga=iA(EA(),1);var Op=new TextDecoder,Iv=/^(?:\x1b)([a-zA-Z0-9])$/,Bv=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,kp={OP:"f1",OQ:"f2",OR:"f3",OS:"f4","[P":"f1","[Q":"f2","[R":"f3","[S":"f4","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"},Kp=[...Object.values(kp),"backspace"],Cv=A=>["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(A),dv=A=>["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(A),Jp=/^\x1b\[(\d+)(?:;(\d+)(?::(\d+))?(?:;([\d:]+))?)?u$/,Qv=/^\x1b\[(\d+);(\d+):(\d+)([A-Za-z~])$/,hv={A:"up",B:"down",C:"right",D:"left",E:"clear",F:"end",H:"home",P:"f1",Q:"f2",R:"f3",S:"f4"},pv={2:"insert",3:"delete",5:"pageup",6:"pagedown",7:"home",8:"end",11:"f1",12:"f2",13:"f3",14:"f4",15:"f5",17:"f6",18:"f7",19:"f8",20:"f9",21:"f10",23:"f11",24:"f12"},Fp={27:"escape",9:"tab",127:"backspace",8:"backspace",57358:"capslock",57359:"scrolllock",57360:"numlock",57361:"printscreen",57362:"pause",57363:"menu",57376:"f13",57377:"f14",57378:"f15",57379:"f16",57380:"f17",57381:"f18",57382:"f19",57383:"f20",57384:"f21",57385:"f22",57386:"f23",57387:"f24",57388:"f25",57389:"f26",57390:"f27",57391:"f28",57392:"f29",57393:"f30",57394:"f31",57395:"f32",57396:"f33",57397:"f34",57398:"f35",57399:"kp0",57400:"kp1",57401:"kp2",57402:"kp3",57403:"kp4",57404:"kp5",57405:"kp6",57406:"kp7",57407:"kp8",57408:"kp9",57409:"kpdecimal",57410:"kpdivide",57411:"kpmultiply",57412:"kpsubtract",57413:"kpadd",57414:"kpenter",57415:"kpequal",57416:"kpseparator",57417:"kpleft",57418:"kpright",57419:"kpup",57420:"kpdown",57421:"kppageup",57422:"kppagedown",57423:"kphome",57424:"kpend",57425:"kpinsert",57426:"kpdelete",57427:"kpbegin",57428:"mediaplay",57429:"mediapause",57430:"mediaplaypause",57431:"mediareverse",57432:"mediastop",57433:"mediafastforward",57434:"mediarewind",57435:"mediatracknext",57436:"mediatrackprevious",57437:"mediarecord",57438:"lowervolume",57439:"raisevolume",57440:"mutevolume",57441:"leftshift",57442:"leftcontrol",57443:"leftalt",57444:"leftsuper",57445:"lefthyper",57446:"leftmeta",57447:"rightshift",57448:"rightcontrol",57449:"rightalt",57450:"rightsuper",57451:"righthyper",57452:"rightmeta",57453:"isoLevel3Shift",57454:"isoLevel5Shift"},Yp=A=>A>=0&&A<=1114111&&!(A>=55296&&A<=57343),lE=A=>Yp(A)?String.fromCodePoint(A):"?";function zp(A){return A===3?"release":A===2?"repeat":"press"}function qp(A){return{ctrl:!!(A&Gn.ctrl),shift:!!(A&Gn.shift),meta:!!(A&(Gn.meta|Gn.alt)),super:!!(A&Gn.super),hyper:!!(A&Gn.hyper),capsLock:!!(A&Gn.capsLock),numLock:!!(A&Gn.numLock)}}var mv=A=>{let e=Jp.exec(A);if(!e)return null;let i=parseInt(e[1],10),r=e[2]?Math.max(0,parseInt(e[2],10)-1):0,l=e[3]?parseInt(e[3],10):1,s=e[4];if(!Yp(i))return null;let u;s&&(u=s.split(":").map(d=>lE(parseInt(d,10))).join(""));let f,E;return i===32?(f="space",E=!0):i===13?(f="return",E=!0):Fp[i]?(f=Fp[i],E=!1):i>=1&&i<=26?(f=String.fromCodePoint(i+96),E=!1):(f=lE(i).toLowerCase(),E=!0),E&&!u&&(u=lE(i)),{name:f,...qp(r),eventType:zp(l),sequence:A,raw:A,isKittyProtocol:!0,isPrintable:E,text:u}},yv=A=>{let e=Qv.exec(A);if(!e)return null;let i=parseInt(e[1],10),r=Math.max(0,parseInt(e[2],10)-1),l=parseInt(e[3],10),s=e[4],u=s==="~"?pv[i]:hv[s];return u?{name:u,...qp(r),eventType:zp(l),sequence:A,raw:A,isKittyProtocol:!0,isPrintable:!1}:null},Sv=(A="")=>{let e;A instanceof Uint8Array?A[0]>127&&A[1]===void 0?(A[0]-=128,A="\x1B"+Op.decode(A)):A=Op.decode(A):A!==void 0&&typeof A!="string"?A=String(A):A||(A="");let i=mv(A);if(i)return i;let r=yv(A);if(r)return r;if(Jp.test(A))return{name:"",ctrl:!1,meta:!1,shift:!1,sequence:A,raw:A,isKittyProtocol:!0,isPrintable:!1};let l={name:"",ctrl:!1,meta:!1,shift:!1,sequence:A,raw:A};if(l.sequence=l.sequence||A||l.name,A==="\r"||A==="\x1B\r")l.raw=void 0,l.name="return",l.meta=A.length===2;else if(A===`
|
|
77
|
-
`)l.name="enter";else if(A===" ")l.name="tab";else if(A==="\b"||A==="\x1B\b")l.name="backspace",l.meta=A.charAt(0)==="\x1B";else if(A==="\x7F"||A==="\x1B\x7F")l.name="backspace",l.meta=A.charAt(0)==="\x1B";else if(A==="\x1B"||A==="\x1B\x1B")l.name="escape",l.meta=A.length===2;else if(A===" "||A==="\x1B ")l.name="space",l.meta=A.length===2;else if(A.length===1&&A<="")l.name=String.fromCharCode(A.charCodeAt(0)+97-1),l.ctrl=!0;else if(A.length===1&&A>="0"&&A<="9")l.name="number";else if(A.length===1&&A>="a"&&A<="z")l.name=A;else if(A.length===1&&A>="A"&&A<="Z")l.name=A.toLowerCase(),l.shift=!0;else if(e=Iv.exec(A))l.name=e[1].toLowerCase(),l.meta=!0,l.shift=/^[A-Z]$/.test(e[1]);else if(e=Bv.exec(A)){let s=[...A];s[0]==="\x1B"&&s[1]==="\x1B"&&(l.meta=!0);let u=[e[1],e[2],e[4],e[6]].filter(Boolean).join(""),f=(e[3]||e[5]||1)-1;l.ctrl=!!(f&4),l.meta=l.meta||!!(f&10),l.shift=!!(f&1),l.code=u,l.name=kp[u]??"",l.shift=Cv(u)||l.shift,l.ctrl=dv(u)||l.ctrl}return l},Xp=Sv;var Vp=iA(EA(),1);var aE=()=>(0,Vp.useContext)(Eu);var Dv=(A,e={})=>{let{setRawMode:i,internal_exitOnCtrlC:r,internal_eventEmitter:l}=aE();(0,ga.useEffect)(()=>{if(e.isActive!==!1)return i(!0),()=>{i(!1)}},[e.isActive,i]);let s=(0,ga.useEffectEvent)(u=>{let f=Xp(u),E={upArrow:f.name==="up",downArrow:f.name==="down",leftArrow:f.name==="left",rightArrow:f.name==="right",pageDown:f.name==="pagedown",pageUp:f.name==="pageup",home:f.name==="home",end:f.name==="end",return:f.name==="return",escape:f.name==="escape",ctrl:f.ctrl,shift:f.shift,tab:f.name==="tab",backspace:f.name==="backspace",delete:f.name==="delete",meta:f.meta,super:f.super??!1,hyper:f.hyper??!1,capsLock:f.capsLock??!1,numLock:f.numLock??!1,eventType:f.eventType},d;f.isKittyProtocol?f.isPrintable?d=f.text??f.name:f.ctrl&&f.name.length===1?d=f.name:d="":f.ctrl?d=f.name??"":d=f.sequence,!f.isKittyProtocol&&Kp.includes(f.name)&&(d=""),d.startsWith("\x1B")&&(d=d.slice(1)),d.length===1&&/[A-Z]/.test(d)&&(E.shift=!0),!(d==="c"&&E.ctrl&&r)&&le.discreteUpdates(()=>{A(d,E)})});(0,ga.useEffect)(()=>{if(e.isActive!==!1)return l.on("input",s),()=>{l.removeListener("input",s)}},[e.isActive,l])},mt=Dv;var Zp=iA(EA(),1);var jp=iA(EA(),1);var Rv=()=>(0,jp.useContext)(fu),sE=Rv;var Wp=iA(EA(),1);var Nv=()=>(0,Wp.useContext)(Iu),uE=Nv;var wv=iA(EA(),1);var cE=iA(EA(),1);var Mv=iA(EA(),1);var Tv=iA(EA(),1);var yu=iA(EA(),1);var fa=iA(EA(),1);var Su=iA(EA(),1);var Gv=()=>{let{stdout:A}=uE(),[e,i]=(0,Su.useState)(()=>Pn(A));return(0,Su.useEffect)(()=>{let r=()=>{i(Pn(A))};return A.on("resize",r),()=>{A.off("resize",r)}},[A]),e},gE=Gv;var Du=iA(EA(),1);var it=iA(ye(),1),zA=iA(EA(),1);var IE=iA(ye(),1),JA=iA(EA(),1);import{PassThrough as xv}from"node:stream";var Pp="\x1B[?1000h\x1B[?1002h\x1B[?1003h\x1B[?1006h",Ru="\x1B[?1006l\x1B[?1003l\x1B[?1002l\x1B[?1000l",bv=/^\x1b\[<(\d+);(\d+);(\d+)([Mm])/;function Uv(A,e){if(A&64)return(A&3)===1?"wheel-down":"wheel-up";if(e)return"none";switch(A&3){case 0:return"left";case 1:return"middle";case 2:return"right";default:return"none"}}function Hv(A){return"\x1B[<".startsWith(A.slice(0,3))&&A.length<=32&&/^\x1b(\[(<[\d;]*)?)?$/.test(A)}function $p(A){let e=[],i="",r=0;for(;r<A.length;){let l=A.indexOf("\x1B",r);if(l===-1)return i+=A.slice(r),{events:e,passthrough:i,pending:""};i+=A.slice(r,l);let s=A.slice(l),u=bv.exec(s);if(u){let f=Number(u[1]),E=u[4]==="m",d=(f&32)!==0,h=(f&64)!==0;e.push({type:h?"wheel":d?"move":E?"release":"press",button:Uv(f,E),x:Number(u[2]),y:Number(u[3]),shift:(f&4)!==0,alt:(f&8)!==0,ctrl:(f&16)!==0}),r=l+u[0].length;continue}if(Hv(s))return{events:e,passthrough:i,pending:s};i+="\x1B",r=l+1}return{events:e,passthrough:i,pending:""}}function fE(){let A="";return e=>{let i=$p(A+e);return A=i.pending,{events:i.events,passthrough:i.passthrough}}}function EE(A=process.stdin,e=process.stdout){let i=!!(A.isTTY&&e.isTTY),r=new Set,l=fE(),s=new xv,u=S=>{let Q=typeof S=="string"?S:S.toString("utf8"),{events:p,passthrough:D}=l(Q);for(let v of p)for(let N of r)N(v);D.length>0&&s.write(D)};i&&(A.on("data",u),A.resume());let f=s;f.isTTY=A.isTTY,f.setRawMode=(S=>(A.setRawMode?.(S),f)),f.ref=(()=>(A.ref?.(),f)),f.unref=(()=>(A.unref?.(),f));let E=!1,d=()=>{!i||E||(e.write(Pp),E=!0)},h=()=>{E&&(e.write(Ru),E=!1)};return{stdin:f,supported:i,isEnabled:()=>E,enable:d,disable:h,subscribe(S){return r.add(S),()=>r.delete(S)},dispose(){h(),r.clear(),i&&A.off("data",u)}}}function Lv(A){if(!A?.yogaNode)return null;let e=A.yogaNode.getComputedLayout(),i=0,r=0,l=A;for(;l?.yogaNode;){let s=l.yogaNode.getComputedLayout();i+=s.left,r+=s.top,l=l.parentNode??void 0}return{left:i+1,top:r+1,width:e.width,height:e.height}}function _v(A,e,i){return e>=A.left&&e<A.left+A.width&&i>=A.top&&i<A.top+A.height}var Am=(0,JA.createContext)(null),tm=(0,JA.createContext)(null);function em({source:A,children:e}){let i=(0,JA.useRef)(new Set),r=(0,JA.useRef)(null),[l,s]=(0,JA.useState)(null),[u,f]=(0,JA.useState)(!1),E=(0,JA.useCallback)(D=>(i.current.add(D),()=>{i.current.delete(D),r.current===D&&(r.current=null),s(v=>v===D?null:v)}),[]),d=(0,JA.useCallback)((D,v)=>{let N=null,L=Number.POSITIVE_INFINITY;for(let uA of i.current){let J=Lv(uA.ref.current);if(!J||J.width<=0||J.height<=0||!_v(J,D,v))continue;let G=J.width*J.height;G<L&&(N=uA,L=G)}return N},[]);(0,JA.useEffect)(()=>{if(A)return A.subscribe(D=>{if(D.type==="wheel")return;let v=d(D.x,D.y);if(D.type==="move"){s(N=>N===v?N:v);return}if(D.type==="press"){if(D.button!=="left")return;r.current=v,s(v);return}r.current&&r.current===v&&v?.onClick?.(),r.current=null})},[A,d]),(0,JA.useEffect)(()=>{let D=l;return D?.onHover?.(!0),()=>D?.onHover?.(!1)},[l]);let h=(0,JA.useCallback)(()=>{A&&(A.enable(),f(A.isEnabled()))},[A]),S=(0,JA.useCallback)(()=>{A&&(A.disable(),f(A.isEnabled()))},[A]),Q=(0,JA.useMemo)(()=>({register:E}),[E]),p=(0,JA.useMemo)(()=>({supported:!!A?.supported,enabled:u,enable:h,disable:S}),[A,u,h,S]);return(0,IE.jsx)(Am.Provider,{value:Q,children:(0,IE.jsx)(tm.Provider,{value:p,children:e})})}var Ov={supported:!1,enabled:!1,enable:()=>{},disable:()=>{}};function nm(){return(0,JA.useContext)(tm)??Ov}function Ea(A,{onClick:e,disabled:i=!1}={}){let r=(0,JA.useContext)(Am),[l,s]=(0,JA.useState)(!1),u=(0,JA.useRef)(e);u.current=e;let f=(0,JA.useMemo)(()=>({ref:A,onClick:()=>u.current?.(),onHover:s}),[A]);return(0,JA.useEffect)(()=>{if(!(!r||i))return r.register(f)},[r,f,i]),(0,JA.useEffect)(()=>{i&&s(!1)},[i]),l&&!i}var k={accent:"cyan",border:"gray",muted:"gray",ok:"green",warn:"yellow",bad:"red"},BE="\u25B8",CE=" ",im={ok:k.ok,warn:k.warn,bad:k.bad,idle:k.muted},rm={ok:"\u25CF",warn:"\u25CF",bad:"\u25CF",idle:"\u25CB"};function dE(A,e){return A.includes(e)}var Fv=[{id:"mode",kind:"choice",choices:JC,labelKey:"field.mode"},{id:"port",kind:"text",labelKey:"field.port",visibleFor:["local","lan"]},{id:"lanHost",kind:"address",labelKey:"field.lanHost",visibleFor:["lan"]},{id:"remoteUrl",kind:"text",labelKey:"field.remoteUrl",visibleFor:["remote"]},{id:"publicUrl",kind:"text",labelKey:"field.publicUrl"},{id:"socketPath",kind:"text",labelKey:"field.socketPath"},{id:"herdrArgs",kind:"text",labelKey:"field.herdrArgs"},{id:"herdrAutoStart",kind:"toggle",labelKey:"field.herdrAutoStart"},{id:"language",kind:"choice",choices:ug,labelKey:"field.language"},{id:"keepaliveManager",kind:"choice",choices:so,labelKey:"field.keepalive"}],je="",kv=["local","lan","official","remote"];function mr(A){return A.relay.mode==="remote"&&A.relay.remoteUrl===Ri?"official":A.relay.mode}function QE(A){return mr(A)==="official"}function lm(A){return JSON.parse(JSON.stringify(A))}function Nu(A=Zn()){return lm(A)}function hE(A){return Fv.filter(e=>!e.visibleFor||e.visibleFor.includes(A))}function Ho(A,e){switch(e){case"mode":return A.relay.mode;case"port":return String(A.relay.port);case"lanHost":return A.relay.lanHost||je;case"remoteUrl":return A.relay.remoteUrl||je;case"publicUrl":return A.relay.publicUrl||je;case"socketPath":return A.herdr.socketPath||je;case"herdrArgs":return(A.herdr.args||[]).join(" ");case"herdrAutoStart":return A.herdr.autoStart?"on":"off";case"language":return A.ui.language;case"keepaliveManager":return A.keepalive.manager;default:return je}}function Ia(A,e){switch(e){case"lanHost":return Bg()||"0.0.0.0";case"publicUrl":return kC(A,Bg());case"socketPath":return"placeholder.autoDiscovered";case"herdrArgs":return"placeholder.none";case"remoteUrl":return"wss://relay.example.com";default:return je}}function om(A,e){try{let i=new URL(A);return e.includes(i.protocol)}catch{return!1}}function dn(A,e,i){let r=lm(A),l=typeof i=="string"?i.trim():i,s=l;switch(e){case"mode":{if(!dE(kv,l))return{draft:A,errorKey:"error.invalidMode"};if(l==="official"){r.relay.mode="remote",r.relay.remoteUrl=Ri,r.relay.publicUrl=je;break}l==="remote"&&r.relay.remoteUrl===Ri&&(r.relay.remoteUrl=je),r.relay.mode=l,l==="lan"&&(Ss(r.relay.lanHost)||Ds(r.relay.lanHost))&&(r.relay.lanHost=je),r.relay.publicUrl=je;break}case"port":{let u=Number.parseInt(s,10);if(!Number.isInteger(u)||u<1||u>65535)return{draft:A,errorKey:"error.invalidPort"};r.relay.port=u;break}case"lanHost":{if(s&&(Ss(s)||Ds(s)))return{draft:A,errorKey:"error.invalidLanHost"};r.relay.lanHost=s||je;break}case"remoteUrl":{if(s&&!om(s,["ws:","wss:","http:","https:"]))return{draft:A,errorKey:"error.invalidRelayUrl"};r.relay.remoteUrl=s.replace(/\/+$/,"");break}case"publicUrl":{if(s&&(!om(s,["http:","https:"])||FC(s)))return{draft:A,errorKey:"error.invalidPublicUrl"};r.relay.publicUrl=s.replace(/\/+$/,"");break}case"socketPath":{r.herdr.socketPath=s||null;break}case"herdrArgs":{let u=s?s.split(/\s+/).filter(Boolean):[];if(u.includes("--no-session"))return{draft:A,errorKey:"error.removedHerdrArg"};r.herdr.args=u;break}case"herdrAutoStart":{if(l!==!0&&l!==!1&&l!=="on"&&l!=="off")return{draft:A,errorKey:"error.unknownField"};r.herdr.autoStart=l===!0||l==="on";break}case"language":{if(!dE(ug,l))return{draft:A,errorKey:"error.invalidLanguage"};r.ui.language=l;break}case"keepaliveManager":{if(!dE(so,l))return{draft:A,errorKey:"error.invalidKeepalive"};r.keepalive.manager=l;break}default:return{draft:A,errorKey:"error.unknownField"}}return{draft:r,errorKey:null}}function Kv(A){let e=[];return A.relay.mode==="remote"&&!A.relay.remoteUrl&&e.push("error.remoteUrlRequired"),e}function Qn(A){let e=Kv(A);if(e.length>0)throw Object.assign(new Error(`configuration is incomplete: ${e.join(", ")}`),{problems:e});let i=qC(vn(),{})||{},r={...i};r.ui={...i.ui||{},language:A.ui.language};let l={...i.relay||{},mode:A.relay.mode,port:A.relay.port,lanHost:A.relay.mode==="lan"&&(Ss(A.relay.lanHost)||Ds(A.relay.lanHost))?je:A.relay.lanHost,publicUrl:A.relay.publicUrl,remoteUrl:A.relay.remoteUrl};r.relay=l,delete l.local,delete l.host,delete l.url,delete r.patch;let s={...i.herdr||{},socketPath:A.herdr.socketPath,args:A.herdr.args,autoStart:A.herdr.autoStart===!0};return r.herdr=s,s.socketPath||delete s.socketPath,r.keepalive={...i.keepalive||{},manager:A.keepalive.manager},YC(OC()),zC(vn(),r),{ok:!0,path:vn()}}function pE(A,e){return A.relay.mode!==e.relay.mode||A.relay.port!==e.relay.port||A.relay.lanHost!==e.relay.lanHost||A.relay.remoteUrl!==e.relay.remoteUrl||A.relay.publicUrl!==e.relay.publicUrl||A.herdr.socketPath!==e.herdr.socketPath||A.herdr.args.join(" ")!==e.herdr.args.join(" ")}async function mE({waitForStart:A=!1}={}){if(process.platform!=="win32")return!1;let e=await import("../connector/admin-broker.js");return A?e.waitForAdminBroker():e.adminBrokerStatus()}async function am(A,e){return(await import("./S2CKUJLV.js")).configureAdminBroker(A,e)}function sm(A,e){let r=["herdr-remote-relay",`--public-url ${A.relay.remoteUrl?A.relay.remoteUrl.replace(/^ws/,"http"):"https://relay.example.com"}`,"--trust-proxy"];return e&&r.push(`--password '${e.replace(/'/g,"'\\''")}'`),r.join(" ")}async function um(A){let e=KC(A),i;try{i=await fg(`${e}/healthz`,{timeout:4e3})}catch(r){return{ok:!1,message:r.message}}try{let r=ml(),l=await fg(`${e}/api/status`,{timeout:4e3,headers:{"X-Herdr-Host-Id":r.hostId,"X-Herdr-Host-Token":r.hostToken}});return{ok:!0,version:String(i.version||l.version||""),hosts:Array.isArray(l.hosts)?l.hosts.length:0}}catch{return{ok:!0,version:String(i.version||""),hosts:void 0}}}function cm(A,e){if(!Number.isFinite(A))return e("common.unknown");let i=Math.max(0,Math.floor(A)),r=Math.floor(i/3600),l=Math.floor(i%3600/60);return r>0?`${r}h ${l}m`:l>0?`${l}m ${i%60}s`:`${i}s`}var IA=iA(ye(),1);var ht=iA(ye(),1),xo=iA(EA(),1);function Ai({level:A}){return(0,ht.jsx)(x,{color:im[A],children:rm[A]})}var Jv=20;function et({label:A,labelWidth:e=Jv,children:i}){return(0,ht.jsxs)(X,{children:[(0,ht.jsx)(X,{width:e,flexShrink:0,children:(0,ht.jsx)(x,{color:k.muted,wrap:"truncate-end",children:A})}),(0,ht.jsx)(X,{flexGrow:1,children:i})]})}function xe({selected:A,disabled:e=!1,onSelect:i,onHover:r,children:l}){let s=(0,xo.useRef)(null),u=Ea(s,{disabled:e,onClick:i});gm(u,r);let f=A||u,E=e?k.muted:f?k.accent:void 0;return(0,ht.jsxs)(X,{ref:s,children:[(0,ht.jsxs)(x,{color:f?k.accent:void 0,children:[f?BE:CE," "]}),(0,ht.jsx)(x,{color:E,bold:f,dimColor:e,children:l})]})}function gm(A,e){let i=(0,xo.useRef)(e);i.current=e,(0,xo.useEffect)(()=>{A&&i.current?.()},[A])}function Lo({items:A,selectedId:e,onChange:i,onSelect:r}){return(0,ht.jsx)(X,{flexDirection:"column",children:A.map(l=>(0,ht.jsx)(xe,{selected:l.id===e,disabled:l.disabled,onSelect:()=>r(l.id),onHover:()=>i(l.id),children:l.label},l.id))})}function Ui({label:A,selected:e,disabled:i=!1,labelWidth:r=22,onSelect:l,onHover:s,children:u}){let f=(0,xo.useRef)(null),E=Ea(f,{disabled:i,onClick:l});gm(E,s);let d=e||E;return(0,ht.jsxs)(X,{ref:f,children:[(0,ht.jsxs)(X,{width:r,flexShrink:0,children:[(0,ht.jsxs)(x,{color:d?k.accent:void 0,children:[d?BE:CE," "]}),(0,ht.jsx)(x,{color:d?k.accent:k.muted,bold:d,wrap:"truncate-end",children:A})]}),(0,ht.jsx)(X,{flexGrow:1,children:u})]})}function nt({title:A,children:e}){return(0,ht.jsxs)(X,{flexDirection:"column",borderStyle:"round",borderColor:k.border,paddingX:1,flexGrow:1,children:[A?(0,ht.jsx)(X,{marginBottom:1,children:(0,ht.jsx)(x,{bold:!0,children:A})}):null,e]})}function yt({text:A,level:e}){if(!A)return null;let i=e==="error"?k.bad:e==="success"?k.ok:k.muted;return(0,ht.jsx)(X,{marginTop:1,children:(0,ht.jsx)(x,{color:i,children:A})})}function fm(A){return A==null?"idle":A?"ok":"bad"}function Em({ctx:A}){let{t:e,status:i,config:r}=A;if(!i)return(0,IA.jsx)(nt,{title:e("overview.title"),children:(0,IA.jsx)(x,{color:k.muted,children:e("common.loading")})});let l=i.relay.health||{},s=l.ok!==!1,u=i.relay.local?fm(i.relay.alive):s?"ok":"bad",f=i.keepalive.active?"ok":i.keepalive.installed?"warn":"idle",E=!i.host.alive&&(i.relay.local?!i.relay.alive:!s);return(0,IA.jsxs)(nt,{title:e("overview.title"),children:[(0,IA.jsx)(et,{label:e("overview.mode"),children:(0,IA.jsx)(x,{children:e(`mode.${i.mode}`)})}),(0,IA.jsx)(et,{label:e("overview.relay"),children:(0,IA.jsxs)(X,{children:[(0,IA.jsx)(Ai,{level:u}),(0,IA.jsxs)(x,{children:[" ",i.relay.local?e("overview.relayLocal",{bind:i.relay.bind??"",port:i.relay.port}):e("overview.relayRemote",{url:i.relay.remoteUrl??""})]}),i.relay.local&&i.relay.pid?(0,IA.jsx)(x,{color:k.muted,children:` ${e("common.pid",{pid:i.relay.pid})}`}):null]})}),(0,IA.jsx)(et,{label:e("overview.host"),children:(0,IA.jsxs)(X,{children:[(0,IA.jsx)(Ai,{level:fm(i.host.alive)}),(0,IA.jsx)(x,{children:` ${i.host.alive?e("common.running"):e("common.stopped")}`}),i.host.pid?(0,IA.jsx)(x,{color:k.muted,children:` ${e("common.pid",{pid:i.host.pid})}`}):null]})}),(0,IA.jsx)(et,{label:e("overview.socket"),children:(0,IA.jsxs)(X,{children:[(0,IA.jsx)(Ai,{level:i.host.socketExists?"ok":"warn"}),(0,IA.jsx)(x,{color:k.muted,children:` ${i.host.socketPath}`}),i.host.socketExists?null:(0,IA.jsx)(x,{color:k.warn,children:` ${e("overview.socketMissing")}`})]})}),(0,IA.jsx)(et,{label:e("overview.webUrl"),children:(0,IA.jsx)(x,{color:k.accent,children:i.publicUrl})}),(0,IA.jsx)(et,{label:e("overview.keepalive"),children:(0,IA.jsxs)(X,{children:[(0,IA.jsx)(Ai,{level:f}),(0,IA.jsxs)(x,{children:[` ${i.keepalive.manager} \u2014 `,i.keepalive.active?e("common.running"):i.keepalive.installed?e("common.installed"):e("common.notInstalled")]})]})}),(0,IA.jsx)(X,{marginTop:1,flexDirection:"column",children:s?(0,IA.jsxs)(IA.Fragment,{children:[typeof l.hosts=="number"?(0,IA.jsx)(et,{label:e("overview.hosts"),children:(0,IA.jsx)(x,{children:l.hosts})}):null,typeof l.clients=="number"?(0,IA.jsx)(et,{label:e("overview.devices"),children:(0,IA.jsx)(x,{children:l.clients})}):null,(0,IA.jsx)(et,{label:e("overview.uptime"),children:(0,IA.jsx)(x,{color:k.muted,children:cm(l.uptimeSeconds,e)})})]}):(0,IA.jsx)(x,{color:k.warn,children:e("overview.unreachable",{message:l.message??""})})}),E?(0,IA.jsx)(X,{marginTop:1,children:(0,IA.jsx)(x,{color:k.muted,children:e("overview.notStarted")})}):null,r.relay.mode==="local"?(0,IA.jsx)(X,{marginTop:1,children:(0,IA.jsx)(x,{color:k.muted,children:e("mode.local.description")})}):null,(0,IA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}var St=iA(ye(),1),Ki=iA(EA(),1);var Dy=iA(yy(),1);var Sy=44;function Ry({ctx:A}){let{t:e,run:i}=A,{columns:r}=gE(),[l,s]=(0,Ki.useState)(null),[u,f]=(0,Ki.useState)(null),[E,d]=(0,Ki.useState)(0),[h,S]=(0,Ki.useState)("generate");(0,Ki.useEffect)(()=>{if(!l)return;let N=()=>d(Math.max(0,l.expiresAt-Date.now()));N();let L=setInterval(N,1e3);return()=>clearInterval(L)},[l]),(0,Ki.useEffect)(()=>{if(!l||r<Sy){f(null);return}let N=!1;return Dy.default.toString(l.pairUrl,{type:"terminal",small:!0,errorCorrectionLevel:"L"}).then(L=>{N||f(L.replace(/\n$/,""))}).catch(()=>{N||f(null)}),()=>{N=!0}},[l,r]);let Q=()=>i(async()=>{A.notify(N=>N("pair.working"));try{let N=await Dg(),L=Eg(N);s({...N,code:L}),A.notify("","info")}catch(N){let L=N.message;throw s(null),new Error(/host_offline|no Herdr host|did not register/i.test(L)?e("pair.hostOffline"):e("pair.failed",{message:L}))}});mt((N,L)=>{L.return&&Q()},{isActive:A.editingId===null});let p=l!==null&&E<=0,D=Math.floor(E/6e4),v=Math.floor(E%6e4/1e3);return(0,St.jsxs)(nt,{title:e("pair.title"),children:[(0,St.jsx)(Lo,{items:[{id:"generate",label:e(l?"pair.regenerate":"pair.generate")}],selectedId:h,onChange:S,onSelect:Q}),l?(0,St.jsxs)(X,{flexDirection:"column",marginTop:1,children:[(0,St.jsxs)(X,{children:[(0,St.jsx)(x,{color:k.muted,children:`${e("pair.code")} `}),(0,St.jsx)(x,{bold:!0,color:p?k.muted:k.accent,children:l.code.split("").join(" ")})]}),(0,St.jsxs)(X,{children:[(0,St.jsx)(x,{color:k.muted,children:`${e("pair.url")} `}),(0,St.jsx)(x,{children:l.pairUrl})]}),(0,St.jsx)(X,{marginTop:1,children:(0,St.jsx)(x,{color:p?k.bad:k.muted,children:p?e("pair.expired"):e("pair.expires",{minutes:`${D}:${String(v).padStart(2,"0")}`,time:new Date(l.expiresAt).toLocaleTimeString()})})}),!p&&u?(0,St.jsxs)(X,{flexDirection:"column",marginTop:1,children:[(0,St.jsx)(x,{children:u}),(0,St.jsx)(x,{color:k.muted,children:e("pair.qrHint")})]}):null,!p&&!u&&r<Sy?(0,St.jsx)(X,{marginTop:1,children:(0,St.jsx)(x,{color:k.muted,children:e("pair.qrUnavailable")})}):null,(0,St.jsx)(X,{marginTop:1,children:(0,St.jsx)(x,{color:k.muted,children:e("pair.instructions")})})]}):null,(0,St.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}var Pt=iA(ye(),1),vy=iA(EA(),1);var Ny=8;function My({ctx:A}){let{t:e,run:i,status:r}=A,[l,s]=(0,vy.useState)("start"),u=[{id:"start",label:e("services.start")},{id:"stop",label:e("services.stop")},{id:"restart",label:e("services.restart")}],f=h=>{if(A.dirty&&h!=="stop"){A.notify(S=>S("services.unsavedBlocked"),"error");return}return i(()=>{let S=A.config;if(h==="start"){let p=Rl(S);A.notify(D=>p.managed?D("services.managedNotice",{manager:p.manager??""}):D("services.started"),"success");return}if(h==="stop"){let p=Rg(S);A.notify(D=>p.managed?D("services.managedNotice",{manager:p.manager??""}):D("services.stopped"),"success");return}let Q=Ng(S);A.notify(p=>Q.managed?p("services.managedNotice",{manager:Q.manager??""}):p("services.restarted"),"success")})};mt((h,S)=>{let Q=u.findIndex(p=>p.id===l);S.upArrow?s(u[(Q-1+u.length)%u.length].id):S.downArrow?s(u[(Q+1)%u.length].id):S.return&&f(l)},{isActive:A.editingId===null});let E=Rs("relay",Ny),d=Rs("host",Ny);return(0,Pt.jsxs)(nt,{title:e("services.title"),children:[(0,Pt.jsx)(Lo,{items:u,selectedId:l,onChange:s,onSelect:f}),A.dirty?(0,Pt.jsx)(X,{marginTop:1,children:(0,Pt.jsx)(x,{color:k.warn,children:e("services.unsavedBlocked")})}):null,r?.keepalive.installed?(0,Pt.jsx)(X,{marginTop:1,children:(0,Pt.jsx)(x,{color:k.muted,children:e("services.managedNotice",{manager:r.keepalive.manager})})}):null,(0,Pt.jsxs)(X,{flexDirection:"column",marginTop:1,children:[(0,Pt.jsx)(x,{color:k.muted,children:e("services.logs")}),(0,Pt.jsx)(wy,{title:e("services.logRelay"),lines:E,emptyText:e("services.logEmpty")}),(0,Pt.jsx)(wy,{title:e("services.logHost"),lines:d,emptyText:e("services.logEmpty")})]}),(0,Pt.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}function wy({title:A,lines:e,emptyText:i}){return(0,Pt.jsxs)(X,{flexDirection:"column",marginTop:1,children:[(0,Pt.jsx)(x,{bold:!0,color:k.muted,children:A}),e.length===0?(0,Pt.jsx)(x,{color:k.muted,children:i}):e.map((r,l)=>(0,Pt.jsx)(x,{color:k.muted,wrap:"truncate-end",children:r},l))]})}var vA=iA(ye(),1),ei=iA(EA(),1);var vr=iA(ye(),1),Ku=iA(EA(),1);var rG=/[\x00-\x1f\x7f]/;function Ji({value:A,placeholder:e,active:i,mask:r=!1,onSubmit:l,onCancel:s}){let[u,f]=(0,Ku.useState)(A);(0,Ku.useEffect)(()=>{i&&f(A)},[i,A]),mt((h,S)=>{if(S.return){l(u);return}if(S.escape){f(A),s();return}if(S.backspace||S.delete){f(Q=>Q.slice(0,-1));return}if(S.ctrl&&h==="u"){f("");return}h&&!S.ctrl&&!S.meta&&!rG.test(h)&&f(Q=>Q+h)},{isActive:i});let E=i?u:A,d=r&&E?"\u2022".repeat(Math.min(E.length,32)):E;return i?(0,vr.jsxs)(X,{children:[(0,vr.jsx)(x,{color:k.accent,children:d}),(0,vr.jsx)(x,{color:k.accent,inverse:!0,children:" "})]}):d?(0,vr.jsx)(x,{children:d}):(0,vr.jsx)(x,{color:k.muted,children:e??""})}function Gy({ctx:A}){let{t:e,draft:i,editingId:r}=A,[l,s]=(0,ei.useState)("mode"),[u,f]=(0,ei.useState)(!1),[E,d]=(0,ei.useState)(!1),[h,S]=(0,ei.useState)(A.runtime.relayPassword||""),Q=QE(i),D=[...(0,ei.useMemo)(()=>hE(i.relay.mode).filter(G=>["mode","port","lanHost","remoteUrl","publicUrl"].includes(G.id)),[i.relay.mode]).map(G=>({id:G.id,kind:Q&&(G.id==="remoteUrl"||G.id==="publicUrl")?"readonly":"field",fieldKind:G.kind,label:e(G.labelKey)})),...i.relay.mode==="remote"&&!Q?[{id:"password",kind:"password",label:e("relay.password")}]:[],{id:"save",kind:"action",label:e("common.save")},{id:"test",kind:"action",label:e("relay.test")},...i.relay.mode==="remote"&&!Q?[{id:"reveal",kind:"action",label:e(u?"relay.hidePassword":"relay.showPassword")},{id:"env",kind:"action",label:e("relay.envSnippet")}]:[],{id:"regenerate",kind:"action",label:e("relay.regenerate")}],v=(0,ei.useMemo)(()=>Sl({includeLoopback:!1}),[]),N=G=>{let q=i;for(let[V,fA]of G){let TA=dn(q,V,fA),{errorKey:AA}=TA;if(AA)return A.notify(oA=>oA(AA),"error"),!1;q=TA.draft}return A.updateDraft(q),A.notify("","info"),!0},L=(G,q)=>N([[G,q]]),uA=()=>{try{let G=Qn(i);A.reloadConfig(),A.notify(q=>q("common.saved",{path:G.path}),"success")}catch(G){let q=G.problems;A.notify(V=>q?q.map(fA=>V(fA)).join(" "):V("error.saveFailed",{message:G.message}),"error")}},J=G=>{let q=D.find(V=>V.id===G);if(q){if(q.kind==="readonly"){A.notify(V=>V("relay.officialFixed"),"info");return}if(q.kind==="field"||q.kind==="password"){A.setEditing(G);return}if(G==="save"){uA();return}if(G==="reveal"){f(V=>!V);return}if(G==="env"){d(V=>!V);return}if(G==="regenerate"){A.run(()=>{gg(),A.reloadConfig(),A.notify(V=>V("relay.regenerated"),"success")});return}G==="test"&&A.run(async()=>{let V=await um(A.config);A.notify(fA=>V.ok?fA("relay.testOk",{version:V.version??"?",hosts:V.hosts??0}):fA("relay.testFailed",{message:V.message??""}),V.ok?"success":"error")})}};if(mt((G,q)=>{let V=D.findIndex(fA=>fA.id===l);q.upArrow?s(D[(V-1+D.length)%D.length].id):q.downArrow?s(D[(V+1)%D.length].id):q.return?J(l):G==="s"&&uA()},{isActive:r===null}),r==="mode")return(0,vA.jsx)(nt,{title:e("field.mode"),children:(0,vA.jsx)(Yi,{options:[...["local","lan"].map(G=>({id:G,label:e(`mode.${G}`),description:e(`mode.${G}.description`)})),{id:"official",label:e("mode.official"),description:e("mode.official.description")},{id:"remote",label:e("mode.remote"),description:e("mode.remote.description")}],current:mr(i),onPick:G=>{L("mode",G)&&(G==="official"&&(S(""),gr("")),A.setEditing(null))},onCancel:()=>A.setEditing(null)})});if(r==="lanHost"){let G=v.map(q=>({id:q.address,label:`${q.address} (${q.name}, ${e(oG(q.kind))})`}));return(0,vA.jsx)(nt,{title:e("relay.selectAddress"),children:G.length===0?(0,vA.jsx)(x,{color:k.warn,children:e("relay.noAddresses")}):(0,vA.jsx)(Yi,{options:G,current:i.relay.lanHost||G[0].id,onPick:q=>{L("lanHost",q),A.setEditing(null)},onCancel:()=>A.setEditing(null)})})}return(0,vA.jsxs)(nt,{title:e("relay.title"),children:[i.relay.mode!=="remote"?(0,vA.jsxs)(X,{flexDirection:"column",marginBottom:1,children:[(0,vA.jsx)(et,{label:e("relay.listenAddress"),children:(0,vA.jsx)(x,{color:k.muted,children:`${sg(i)}:${i.relay.port}`})}),(0,vA.jsx)(x,{color:k.muted,children:e("relay.listenAddressHint")})]}):null,D.map(G=>G.kind==="action"?(0,vA.jsx)(xe,{selected:l===G.id,onSelect:()=>{s(G.id),J(G.id)},onHover:()=>s(G.id),children:G.label},G.id):(0,vA.jsx)(Ui,{label:G.label,selected:l===G.id,onSelect:()=>J(G.id),onHover:()=>s(G.id),children:G.kind==="password"?(0,vA.jsx)(Ji,{value:h,placeholder:e("relay.passwordEmpty"),active:r==="password",mask:!u,onSubmit:q=>{S(q),gr(q),A.setEditing(null),A.notify(V=>V("relay.passwordSaved"),"success")},onCancel:()=>A.setEditing(null)}):G.kind==="readonly"?(0,vA.jsx)(x,{color:k.muted,children:`${Ho(i,G.id)||Ty(A,G.id)} (${e("relay.locked")})`}):G.fieldKind==="choice"?(0,vA.jsx)(x,{children:e(`mode.${mr(i)}`)}):(0,vA.jsx)(Ji,{value:Ho(i,G.id),placeholder:Ty(A,G.id),active:r===G.id,onSubmit:q=>{L(G.id,q)&&A.setEditing(null)},onCancel:()=>A.setEditing(null)})},G.id)),A.dirty?(0,vA.jsx)(X,{marginTop:1,children:(0,vA.jsx)(x,{color:k.warn,children:e("hint.unsavedChanges")})}):null,i.relay.mode==="remote"?(0,vA.jsx)(X,{marginTop:1,children:(0,vA.jsx)(x,{color:k.muted,children:e(Q?"relay.officialHint":"relay.passwordHint")})}):null,(0,vA.jsx)(X,{marginTop:1,children:(0,vA.jsx)(et,{label:e("relay.identity"),children:(0,vA.jsx)(x,{color:k.muted,children:A.runtime.hostId})})}),E?(0,vA.jsxs)(X,{flexDirection:"column",marginTop:1,borderStyle:"round",borderColor:k.border,paddingX:1,children:[(0,vA.jsx)(x,{color:k.muted,children:e("relay.envHint")}),(0,vA.jsx)(x,{children:sm(A.config,h)})]}):null,Q?null:(0,vA.jsx)(X,{marginTop:1,children:(0,vA.jsx)(x,{color:k.muted,children:e("relay.docsHint")})}),(0,vA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}function Ty(A,e){let i=Ia(A.draft,e);return i.startsWith("placeholder.")?A.t(i):i}function oG(A){return`relay.address${A.charAt(0).toUpperCase()}${A.slice(1)}`}function Yi({options:A,current:e,onPick:i,onCancel:r}){let[l,s]=(0,ei.useState)(()=>{let f=A.findIndex(E=>E.id===e);return f>=0?f:0}),u=A[Math.min(l,A.length-1)];return mt((f,E)=>{if(E.escape){r();return}E.upArrow?s(d=>(d-1+A.length)%A.length):E.downArrow?s(d=>(d+1)%A.length):E.return&&u&&i(u.id)}),(0,vA.jsxs)(X,{flexDirection:"column",children:[(0,vA.jsx)(Lo,{items:A.map(f=>({id:f.id,label:f.label})),selectedId:u?.id??"",onChange:f=>s(A.findIndex(E=>E.id===f)),onSelect:i}),u?.description?(0,vA.jsx)(X,{marginTop:1,children:(0,vA.jsx)(x,{color:k.muted,children:u.description})}):null]})}var YA=iA(ye(),1),wa=iA(EA(),1);function by({ctx:A}){let{t:e,status:i,draft:r,editingId:l}=A,[s,u]=(0,wa.useState)("install"),[f,E]=(0,wa.useState)(null);(0,wa.useEffect)(()=>{if(process.platform!=="win32")return;let Q=!1;return mE().then(p=>{Q||E(p)}).catch(()=>{Q||E(!1)}),()=>{Q=!0}},[]);let d=i?.keepalive,h=[{id:"install",label:e("keepalive.install")},{id:"restart",label:e("keepalive.restart")},{id:"uninstall",label:e("keepalive.uninstall")},{id:"manager",label:`${e("keepalive.manager")}: ${r.keepalive.manager}`},...process.platform==="linux"&&d?.manager==="systemd"&&!d?.linger?[{id:"linger",label:e("keepalive.enableLinger")}]:[],...process.platform==="win32"?[{id:"adminBrokerInstall",label:e("adminBroker.install")},{id:"adminBrokerUninstall",label:e("adminBroker.uninstall")}]:[]],S=Q=>{if(Q==="manager"){A.setEditing("keepaliveManager");return}if(Q==="adminBrokerInstall"||Q==="adminBrokerUninstall"){let p=Q==="adminBrokerInstall"?"install":"uninstall";A.run(async()=>{let D=!1;try{await am(p,e),D=p==="install"&&await mE({waitForStart:!0})}catch(v){if(v.code==="ELEVATION_CANCELLED"){A.notify(N=>N("adminBroker.elevationCancelled"),"info");return}throw v}E(D),A.notify(v=>v(`adminBroker.${p}Done`),"success")});return}A.run(async()=>{if(Q==="install"){Mn.detectManager(A.config.keepalive.manager)==="windows-service"&&A.notify(p=>p("keepalive.serviceWindowHint"),"info");try{let p=await Mn.install(A.config);A.notify(D=>D("keepalive.installed",{manager:p.manager}),"success")}catch(p){if(p.code==="ELEVATION_CANCELLED"){A.notify(D=>D("keepalive.elevationCancelled"),"info");return}throw p}return}if(Q==="uninstall"){await Mn.uninstall(A.config),A.notify(p=>p("keepalive.uninstalled"),"success");return}if(Q==="restart"){Mn.restart(A.config),A.notify(p=>p("keepalive.restarted"),"success");return}if(Q==="linger"){let p=Mn.enableLinger();A.notify(D=>D("keepalive.lingerDone",{username:p.username}),"success")}})};return mt((Q,p)=>{let D=h.findIndex(v=>v.id===s);p.upArrow?u(h[(D-1+h.length)%h.length].id):p.downArrow?u(h[(D+1)%h.length].id):p.return&&S(s)},{isActive:l===null}),l==="keepaliveManager"?(0,YA.jsx)(nt,{title:e("field.keepalive"),children:(0,YA.jsx)(Yi,{options:so.map(Q=>({id:Q,label:Q})),current:r.keepalive.manager,onPick:Q=>{let p=dn(r,"keepaliveManager",Q),{errorKey:D}=p;if(D){A.notify(v=>v(D),"error");return}A.updateDraft(p.draft);try{Qn(p.draft),A.reloadConfig()}catch(v){A.notify(N=>N("error.saveFailed",{message:v.message}),"error")}A.setEditing(null)},onCancel:()=>A.setEditing(null)})}):(0,YA.jsxs)(nt,{title:e("keepalive.title"),children:[(0,YA.jsx)(et,{label:e("keepalive.manager"),children:(0,YA.jsx)(x,{children:d?.manager??e("common.unknown")})}),(0,YA.jsx)(et,{label:e("keepalive.state"),children:(0,YA.jsxs)(X,{children:[(0,YA.jsx)(Ai,{level:d?.active?"ok":d?.installed?"warn":"idle"}),(0,YA.jsxs)(x,{children:[" ",d?.active?e("common.running"):d?.installed?e("common.installed"):e("common.notInstalled")]})]})}),process.platform==="win32"?(0,YA.jsxs)(YA.Fragment,{children:[(0,YA.jsx)(et,{label:e("adminBroker.title"),children:(0,YA.jsx)(x,{color:f?k.ok:k.warn,children:e(f===null?"adminBroker.checking":f?"adminBroker.ready":"adminBroker.notReady")})}),(0,YA.jsx)(x,{color:k.muted,children:e("adminBroker.tuiHint")})]}):null,d?.unitPath?(0,YA.jsx)(et,{label:e("keepalive.unitPath"),children:(0,YA.jsx)(x,{color:k.muted,children:d.unitPath})}):null,(0,YA.jsx)(X,{marginTop:1,flexDirection:"column",children:h.map(Q=>(0,YA.jsx)(xe,{selected:s===Q.id,onSelect:()=>{u(Q.id),S(Q.id)},onHover:()=>u(Q.id),children:Q.label},Q.id))}),(0,YA.jsxs)(X,{marginTop:1,flexDirection:"column",children:[d?.manager==="systemd"?(0,YA.jsx)(x,{color:d.linger?k.muted:k.warn,children:d.linger?e("keepalive.lingerEnabled"):e("keepalive.lingerDisabled")}):null,d?.manager==="supervisor"?(0,YA.jsx)(x,{color:k.warn,children:e("keepalive.fallbackNote")}):null,d?.manager==="windows-task"?(0,YA.jsx)(x,{color:k.muted,children:e("keepalive.windowsTaskNote")}):null,d?.manager==="windows-service"?(0,YA.jsx)(x,{color:k.warn,children:e("keepalive.serviceNote")}):null,(0,YA.jsx)(x,{color:k.muted,children:e("keepalive.logsHint",{command:i?.logsHint??""})})]}),(0,YA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}var Dt=iA(ye(),1),va=iA(EA(),1);function Uy({ctx:A}){let{t:e,draft:i,editingId:r}=A,[l,s]=(0,va.useState)("socketPath"),[u,f]=(0,va.useState)(null);(0,va.useEffect)(()=>{f(Sg())},[]);let E=[{id:"socketPath",kind:"field",label:e("herdr.socketPath")},{id:"herdrArgs",kind:"field",label:e("herdr.args")},{id:"herdrAutoStart",kind:"toggle",label:e("field.herdrAutoStart")},{id:"save",kind:"action",label:e("common.save")}],d=(Q,p)=>{let D=dn(i,Q,p),{errorKey:v}=D;return v?(A.notify(N=>N(v),"error"),!1):(A.updateDraft(D.draft),!0)},h=()=>{try{let Q=Qn(i);A.reloadConfig(),A.notify(p=>p("common.saved",{path:Q.path}),"success")}catch(Q){A.notify(p=>p("error.saveFailed",{message:Q.message}),"error")}},S=Q=>{if(Q==="socketPath"||Q==="herdrArgs"){A.setEditing(Q);return}if(Q==="herdrAutoStart"){d(Q,i.herdr.autoStart?"off":"on");return}Q==="save"&&h()};return mt((Q,p)=>{let D=E.findIndex(N=>N.id===l),v=D>=0?D:0;p.upArrow?s(E[(v-1+E.length)%E.length].id):p.downArrow?s(E[(v+1)%E.length].id):p.return?S(l):Q==="s"&&h()},{isActive:r===null}),(0,Dt.jsxs)(nt,{title:e("herdr.title"),children:[E.map(Q=>Q.kind==="toggle"?(0,Dt.jsx)(Ui,{label:Q.label,selected:l===Q.id,onSelect:()=>{s(Q.id),S(Q.id)},onHover:()=>s(Q.id),children:(0,Dt.jsx)(x,{color:i.herdr.autoStart?k.ok:k.muted,children:i.herdr.autoStart?`[\xD7] ${e("common.on")}`:`[ ] ${e("common.off")}`})},Q.id):Q.kind==="field"?(0,Dt.jsx)(Ui,{label:Q.label,selected:l===Q.id,onSelect:()=>S(Q.id),onHover:()=>s(Q.id),children:(0,Dt.jsx)(Ji,{value:Ho(i,Q.id),placeholder:A.t(Ia(i,Q.id)),active:r===Q.id,onSubmit:p=>{d(Q.id,p)&&A.setEditing(null)},onCancel:()=>A.setEditing(null)})},Q.id):(0,Dt.jsx)(X,{marginTop:1,children:(0,Dt.jsx)(xe,{selected:l===Q.id,onSelect:()=>{s(Q.id),S(Q.id)},onHover:()=>s(Q.id),children:Q.label})},Q.id)),l==="herdrAutoStart"?(0,Dt.jsx)(X,{marginTop:1,children:(0,Dt.jsx)(x,{color:k.muted,children:e("herdr.autoStartHint")})}):null,A.dirty?(0,Dt.jsx)(X,{marginTop:1,children:(0,Dt.jsx)(x,{color:k.warn,children:e("hint.unsavedChanges")})}):null,(0,Dt.jsxs)(X,{marginTop:1,flexDirection:"column",children:[u?.version?(0,Dt.jsx)(et,{label:e("herdr.version"),children:(0,Dt.jsxs)(X,{children:[(0,Dt.jsx)(Ai,{level:u.supported?"ok":"warn"}),(0,Dt.jsx)(x,{children:` ${u.version}`})]})}):null,u?.version&&!u.supported?(0,Dt.jsx)(x,{color:k.warn,children:e("herdr.versionOutdated",{version:u.version,minimum:yg})}):null,u&&!u.ok?(0,Dt.jsx)(x,{color:k.warn,children:e("herdr.cliMissing")}):null]}),(0,Dt.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}var Gt=iA(ye(),1),qo=iA(EA(),1);function Hy({ctx:A}){let{t:e,draft:i}=A,[r,l]=(0,qo.useState)("auto"),[s,u]=(0,qo.useState)({phase:"idle"}),f=(0,qo.useState)(()=>({current:{source:""}}))[0],E=yl({preference:"auto"}),d=[{id:"auto",label:e("about.languageAuto",{detected:E})},{id:"zh",label:e("about.languageZh")},{id:"en",label:e("about.languageEn")}],h=pg(),S=(()=>{switch(s.phase){case"checking":return e("update.checking");case"current":return e("update.upToDate",{version:s.latest});case"available":return e("update.available",{version:s.latest});case"updating":return s.attempt>1?e("update.updatingRetry",{version:s.latest,attempt:s.attempt}):e("update.updating",{version:s.latest});case"done":return e("update.done",{version:s.latest});case"error":return e(s.messageKey,s.params);default:return e("update.check")}})(),Q=[...d,{id:"update",label:S}],p=J=>{f.current={source:J.source??""},u(J.updateAvailable?{phase:"available",latest:J.latest}:{phase:"current",latest:J.latest})};(0,qo.useEffect)(()=>{A.updateCheck?.ok&&s.phase==="idle"&&p(A.updateCheck)},[A.updateCheck]);let D=async()=>{u({phase:"checking"});let J=await Dl();if(!J.ok){u({phase:"error",messageKey:J.errorKey??"update.errorNetwork"});let{message:G}=J;G&&A.notify(q=>q("update.errorNetworkDetail",{message:G}),"error");return}A.setUpdateCheck(J),p(J)},v=async J=>{u({phase:"updating",latest:J,attempt:1});let G=await wg(A.config,()=>mg({source:f.current.source,version:J,onAttempt:({attempt:q})=>u({phase:"updating",latest:J,attempt:q})}));if(!G.ok){let q={version:J,installed:G.installed??"",url:lg(J)};u({phase:"error",messageKey:G.errorKey??"update.errorFailed",params:q}),A.notify(V=>G.summary?V("update.errorFailedDetail",{message:G.summary}):V(G.errorKey??"update.errorFailed",q),"error");return}u({phase:"done",latest:J}),A.setUpdateCheck(null),A.notify(q=>q("update.restartHint"),"success")},N=()=>{if(!(s.phase==="checking"||s.phase==="updating")){if(s.phase==="available"){if(!h){u({phase:"error",messageKey:`update.cannot.${Qg()}`});return}v(s.latest);return}D()}},L=J=>{let G=dn(i,"language",J),{errorKey:q}=G;if(q){A.notify(V=>V(q),"error");return}A.updateDraft(G.draft);try{Qn(G.draft),A.reloadConfig(),A.notify(V=>V("common.saved",{path:vn()}),"success")}catch(V){A.notify(fA=>fA("error.saveFailed",{message:V.message}),"error")}},uA=J=>{if(J==="update"){N();return}L(J)};return mt((J,G)=>{let q=Q.findIndex(V=>V.id===r);G.upArrow?l(Q[(q-1+Q.length)%Q.length].id):G.downArrow?l(Q[(q+1)%Q.length].id):G.return&&uA(r)},{isActive:A.editingId===null}),(0,Gt.jsxs)(nt,{title:e("about.title"),children:[(0,Gt.jsx)(x,{color:k.muted,children:e("about.language")}),(0,Gt.jsx)(X,{flexDirection:"column",marginTop:1,marginBottom:1,children:d.map(J=>(0,Gt.jsx)(xe,{selected:r===J.id,onSelect:()=>{l(J.id),L(J.id)},onHover:()=>l(J.id),children:`${J.label}${i.ui.language===J.id?" \u2713":""}`},J.id))}),(0,Gt.jsx)(x,{color:k.muted,children:e("update.title")}),(0,Gt.jsx)(X,{flexDirection:"column",marginTop:1,marginBottom:1,children:(0,Gt.jsx)(xe,{selected:r==="update",onSelect:()=>{l("update"),N()},onHover:()=>l("update"),children:S})}),(0,Gt.jsx)(et,{label:e("about.version"),children:(0,Gt.jsx)(x,{color:k.muted,children:Cg()})}),ag(A.config)?(0,Gt.jsx)(et,{label:e("about.relayPackage"),children:(0,Gt.jsx)(x,{color:k.muted,children:dg()??"?"})}):null,(0,Gt.jsx)(et,{label:e("about.configPath"),children:(0,Gt.jsx)(x,{color:k.muted,children:vn()})}),(0,Gt.jsx)(et,{label:e("about.statePath"),children:(0,Gt.jsx)(x,{color:k.muted,children:og()})}),(0,Gt.jsx)(X,{marginTop:1,children:(0,Gt.jsx)(x,{color:k.muted,children:e("about.docs")})}),(0,Gt.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}var pA=iA(ye(),1),ni=iA(EA(),1);function fI(A,e){let i=["language","access"];return A==="lan"&&i.push("address"),A==="remote"&&e!==Ri&&i.push("relayUrl","password"),i.push("finish"),i}function EI({ctx:A,onDone:e}){let{t:i,draft:r}=A,[l,s]=(0,ni.useState)("language"),[u,f]=(0,ni.useState)(A.runtime.relayPassword||""),[E,d]=(0,ni.useState)(!0),[h,S]=(0,ni.useState)(!0),[Q,p]=(0,ni.useState)("startNow"),D=(0,ni.useMemo)(()=>Sl({includeLoopback:!1}),[]),v=(0,ni.useMemo)(()=>fI(r.relay.mode,r.relay.remoteUrl),[r.relay.mode,r.relay.remoteUrl]),N=Math.max(0,v.indexOf(l)),L=AA=>{let oA=r;for(let[OA,FA]of AA){let rt=dn(oA,OA,FA),{errorKey:PA}=rt;if(PA)return A.notify(qA=>qA(PA),"error"),!1;oA=rt.draft}return A.updateDraft(oA),A.notify("","info"),!0},uA=(AA,oA)=>L([[AA,oA]]),J=(AA,oA=v)=>{let OA=oA.indexOf(AA);s(oA[Math.min(oA.length-1,OA+1)])},G=()=>{let AA=v.indexOf(l);AA>0&&s(v[AA-1])},q=()=>{A.run(async()=>{r.relay.mode==="remote"&&gr(u),Qn(r),A.reloadConfig();let AA=Zn(),oA=!1;if(h)try{Mn.detectManager(AA.keepalive.manager)==="windows-service"&&A.notify(OA=>OA("keepalive.serviceWindowHint"),"info"),await Mn.install(AA),oA=!0}catch(OA){OA.code==="ELEVATION_CANCELLED"?A.notify(FA=>FA("keepalive.elevationCancelled"),"info"):A.notify(FA=>FA("keepalive.failed",{message:OA.message}),"error")}E&&!oA&&Rl(AA),e()})},V=(0,pA.jsxs)(X,{flexDirection:"column",marginBottom:1,children:[(0,pA.jsx)(x,{bold:!0,children:i("wizard.title")}),(0,pA.jsx)(x,{color:k.muted,children:i("wizard.step",{current:N+1,total:v.length})})]});if(l==="language")return(0,pA.jsxs)(nt,{title:i("wizard.languageTitle"),children:[V,(0,pA.jsx)(Yi,{options:[{id:"auto",label:i("about.languageAuto",{detected:A.locale})},{id:"zh",label:i("about.languageZh")},{id:"en",label:i("about.languageEn")}],current:r.ui.language,onPick:AA=>{uA("language",AA)&&J("language")},onCancel:()=>{}}),(0,pA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]});if(l==="access")return(0,pA.jsxs)(nt,{title:i("wizard.accessTitle"),children:[V,(0,pA.jsx)(Yi,{options:[...["local","lan"].map(AA=>({id:AA,label:i(`mode.${AA}`),description:i(`mode.${AA}.description`)})),{id:"official",label:i("mode.official"),description:i("mode.official.description")},{id:"remote",label:i("mode.remote"),description:i("mode.remote.description")}],current:mr(r),onPick:AA=>{if(AA==="official"){if(!uA("mode","official"))return;gr(""),J("access",fI("remote",Ri));return}uA("mode",AA)&&J("access",fI(AA,AA==="remote"?"":r.relay.remoteUrl))},onCancel:G}),(0,pA.jsx)(X,{marginTop:1,children:(0,pA.jsx)(x,{color:k.muted,children:i("wizard.accessHint")})}),(0,pA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]});if(l==="address")return(0,pA.jsxs)(nt,{title:i("wizard.addressTitle"),children:[V,D.length===0?(0,pA.jsxs)(X,{flexDirection:"column",children:[(0,pA.jsx)(x,{color:k.warn,children:i("relay.noAddresses")}),(0,pA.jsx)(X,{marginTop:1,children:(0,pA.jsx)(xe,{selected:!0,onSelect:()=>J("address"),children:i("wizard.finish")})}),(0,pA.jsx)(aG,{onSkip:()=>J("address"),onBack:G})]}):(0,pA.jsx)(Yi,{options:D.map(AA=>({id:AA.address,label:`${AA.address} (${AA.name}, ${AA.kind})`})),current:r.relay.lanHost||D[0].address,onPick:AA=>{uA("lanHost",AA)&&J("address")},onCancel:G}),(0,pA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]});if(l==="relayUrl")return(0,pA.jsxs)(nt,{title:i("wizard.relayTitle"),children:[V,(0,pA.jsx)(Ui,{label:i("wizard.relayUrlLabel"),selected:!0,onSelect:()=>{},children:(0,pA.jsx)(Ji,{value:r.relay.remoteUrl,placeholder:"wss://relay.example.com",active:!0,onSubmit:AA=>{if(!AA){A.notify(oA=>oA("error.remoteUrlRequired"),"error");return}uA("remoteUrl",AA)&&J("relayUrl")},onCancel:G})}),(0,pA.jsx)(X,{marginTop:1,children:(0,pA.jsx)(x,{color:k.muted,children:i("wizard.relayHint")})}),(0,pA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]});if(l==="password")return(0,pA.jsxs)(nt,{title:i("wizard.passwordTitle"),children:[V,(0,pA.jsx)(Ui,{label:i("relay.password"),selected:!0,onSelect:()=>{},children:(0,pA.jsx)(Ji,{value:u,placeholder:i("relay.passwordEmpty"),active:!0,mask:!0,onSubmit:AA=>{f(AA),J("password")},onCancel:G})}),(0,pA.jsx)(X,{marginTop:1,children:(0,pA.jsx)(x,{color:k.muted,children:i("wizard.passwordHint")})}),(0,pA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]});let fA=[{id:"startNow",label:`${i("wizard.startNow")} [${E?"\xD7":" "}]`},{id:"installKeepalive",label:`${i("wizard.installKeepalive")} [${h?"\xD7":" "}]`},{id:"finish",label:i("wizard.finish")}],TA=AA=>{if(AA==="startNow"){d(oA=>!oA);return}if(AA==="installKeepalive"){S(oA=>!oA);return}q()};return(0,pA.jsxs)(nt,{title:i("wizard.finishTitle"),children:[V,(0,pA.jsx)(lG,{items:fA.map(AA=>AA.id),selected:Q,onSelect:p,onActivate:TA,onBack:G}),fA.map(AA=>(0,pA.jsx)(xe,{selected:Q===AA.id,onSelect:()=>{p(AA.id),TA(AA.id)},onHover:()=>p(AA.id),children:AA.label},AA.id)),(0,pA.jsx)(X,{marginTop:1,children:(0,pA.jsx)(x,{color:k.muted,children:i("wizard.finishHint",{path:vn()})})}),(0,pA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}function lG({items:A,selected:e,onSelect:i,onActivate:r,onBack:l}){return mt((s,u)=>{let f=Math.max(0,A.indexOf(e));u.escape?l():u.upArrow?i(A[(f-1+A.length)%A.length]):u.downArrow?i(A[(f+1)%A.length]):u.return&&r(e)}),null}function aG({onSkip:A,onBack:e}){return mt((i,r)=>{r.return?A():r.escape&&e()}),null}var sG=3e3,ii=[{id:"overview",labelKey:"nav.overview"},{id:"pair",labelKey:"nav.pair"},{id:"services",labelKey:"nav.services"},{id:"relay",labelKey:"nav.relay"},{id:"keepalive",labelKey:"nav.keepalive"},{id:"herdr",labelKey:"nav.herdr"},{id:"about",labelKey:"nav.about"}];function uG({label:A,active:e,onSelect:i}){let r=(0,zA.useRef)(null),l=Ea(r,{onClick:i});return(0,it.jsx)(X,{ref:r,marginRight:2,children:(0,it.jsx)(x,{color:e||l?k.accent:k.muted,bold:e,underline:e||l,children:A})})}function cG({hints:A}){return(0,it.jsx)(X,{marginTop:1,paddingX:1,children:(0,it.jsx)(x,{color:k.muted,children:A.join(" \xB7 ")})})}function II({initialLanguage:A,needsWizard:e,updateChecker:i=hg()?Dl:null}){let{exit:r}=sE(),l=nm(),[s,u]=(0,zA.useState)(()=>Zn()),[f,E]=(0,zA.useState)(()=>Nu()),[d,h]=(0,zA.useState)(()=>ml()),[S,Q]=(0,zA.useState)(null),[p,D]=(0,zA.useState)("overview"),[v,N]=(0,zA.useState)(null),[L,uA]=(0,zA.useState)(!1),[J,G]=(0,zA.useState)(null),[q,V]=(0,zA.useState)(!e),[fA,TA]=(0,zA.useState)(null);(0,zA.useEffect)(()=>{if(!i)return;let hA=!1;return i().then(LA=>{!hA&&LA?.ok&&TA(LA)}).catch(()=>{}),()=>{hA=!0}},[i]);let AA=(0,zA.useMemo)(()=>yl({preference:A??f.ui.language}),[A,f.ui.language]),oA=(0,zA.useMemo)(()=>Ig(AA),[AA]),OA=(0,zA.useMemo)(()=>JSON.stringify(s)!==JSON.stringify(f),[s,f]),FA=(0,zA.useMemo)(()=>OA&&pE(s,f),[s,f,OA]),rt=(0,zA.useCallback)((hA,LA="info")=>{N({notice:hA,level:LA})},[]),PA=v&&{text:typeof v.notice=="string"?v.notice:v.notice(oA),level:v.level},qA=(0,zA.useCallback)(()=>{vg(Zn()).then(hA=>Q(hA)).catch(hA=>rt(hA.message,"error"))},[rt]),$t=(0,zA.useCallback)(()=>{let hA=Zn();u(hA),E(Nu(hA)),h(ml())},[]),$e=(0,zA.useCallback)(hA=>{uA(!0),Promise.resolve().then(hA).catch(LA=>rt(LA.message,"error")).finally(()=>{uA(!1),qA()})},[rt,qA]);(0,zA.useEffect)(()=>{if(!q)return;qA();let hA=setInterval(()=>{J||qA()},sG);return()=>clearInterval(hA)},[q,qA,J]);let mA=(0,zA.useRef)(null);(0,zA.useEffect)(()=>{mA.current===null&&l.supported&&!l.enabled&&l.enable()},[l.supported,l.enabled,l]);let ot={t:oA,locale:AA,config:s,draft:f,status:S,runtime:d,busy:L,dirty:OA,editingId:J,updateDraft:E,reloadConfig:$t,setEditing:G,notify:rt,run:$e,refresh:qA,message:PA,updateCheck:fA,setUpdateCheck:TA};if(mt((hA,LA)=>{if(LA.ctrl&&hA==="c"){r();return}if(hA==="q"){r();return}if(hA==="r"){N(null),qA();return}if(hA==="m"){if(!l.supported){rt($A=>$A("hint.mouseUnsupported"),"info");return}mA.current=!l.enabled,l.enabled?l.disable():l.enable();return}let An=ii.findIndex($A=>$A.id===p);if(LA.rightArrow||LA.tab&&!LA.shift){D(ii[(An+1)%ii.length].id);return}if(LA.leftArrow||LA.tab&&LA.shift){D(ii[(An-1+ii.length)%ii.length].id);return}let bt=Number.parseInt(hA,10);Number.isInteger(bt)&&bt>=1&&bt<=ii.length&&D(ii[bt-1].id)},{isActive:q&&J===null}),!q)return(0,it.jsx)(EI,{ctx:ot,onDone:()=>{$t(),V(!0),qA()}});let Ee=[oA("hint.navigate"),oA("hint.select"),oA("hint.tabs"),OA?oA("hint.save"):null,l.supported?l.enabled?oA("hint.mouseOn"):oA("hint.mouseOff"):oA("hint.mouseUnsupported"),oA("hint.quit")].filter(Boolean);return(0,it.jsxs)(X,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,it.jsxs)(X,{marginBottom:1,flexDirection:"column",children:[(0,it.jsxs)(X,{children:[(0,it.jsx)(x,{bold:!0,children:oA("app.name")}),(0,it.jsx)(x,{color:k.muted,children:` ${oA("app.tagline")}`})]}),fA?.updateAvailable?(0,it.jsx)(x,{color:k.warn,children:oA("update.banner",{latest:fA.latest??"",current:fA.current})}):null]}),(0,it.jsx)(X,{marginBottom:1,children:ii.map((hA,LA)=>(0,it.jsx)(uG,{label:`${LA+1} ${oA(hA.labelKey)}`,active:hA.id===p,onSelect:()=>D(hA.id)},hA.id))}),p==="overview"?(0,it.jsx)(Em,{ctx:ot}):null,p==="pair"?(0,it.jsx)(Ry,{ctx:ot}):null,p==="services"?(0,it.jsx)(My,{ctx:ot}):null,p==="relay"?(0,it.jsx)(Gy,{ctx:ot}):null,p==="keepalive"?(0,it.jsx)(by,{ctx:ot}):null,p==="herdr"?(0,it.jsx)(Uy,{ctx:ot}):null,p==="about"?(0,it.jsx)(Hy,{ctx:ot}):null,FA?(0,it.jsx)(X,{marginTop:1,children:(0,it.jsx)(x,{color:k.warn,children:oA("hint.restartRequired")})}):null,(0,it.jsx)(cG,{hints:Ee})]})}var Ju="\x1B",gG=`${Ju}[?1049h${Ju}[H`,fG=`${Ju}[?1049l`,EG=`${Ju}[?25h`;function xy(A=process.stdout){try{A.write(gG)}catch{}}function Ly(A=process.stdout){try{A.write(`${Ru}${EG}${fG}`)}catch{}}async function j_({language:A=null}={}){let e=!cg(),i=EE(process.stdin,process.stdout);xy();let r=oE((0,BI.jsx)(em,{source:i,children:(0,BI.jsx)(II,{initialLanguage:A,needsWizard:e})}),{stdin:i.stdin,exitOnCtrlC:!1}),l=()=>{i.dispose(),Ly()},s=()=>{r.unmount(),l(),process.exit(0)};process.once("SIGINT",s),process.once("SIGTERM",s),process.once("exit",l);try{await r.waitUntilExit()}finally{l(),process.off("SIGINT",s),process.off("SIGTERM",s)}}export{II as App,EI as Wizard,j_ as startTui};
|
|
77
|
+
`)l.name="enter";else if(A===" ")l.name="tab";else if(A==="\b"||A==="\x1B\b")l.name="backspace",l.meta=A.charAt(0)==="\x1B";else if(A==="\x7F"||A==="\x1B\x7F")l.name="backspace",l.meta=A.charAt(0)==="\x1B";else if(A==="\x1B"||A==="\x1B\x1B")l.name="escape",l.meta=A.length===2;else if(A===" "||A==="\x1B ")l.name="space",l.meta=A.length===2;else if(A.length===1&&A<="")l.name=String.fromCharCode(A.charCodeAt(0)+97-1),l.ctrl=!0;else if(A.length===1&&A>="0"&&A<="9")l.name="number";else if(A.length===1&&A>="a"&&A<="z")l.name=A;else if(A.length===1&&A>="A"&&A<="Z")l.name=A.toLowerCase(),l.shift=!0;else if(e=Iv.exec(A))l.name=e[1].toLowerCase(),l.meta=!0,l.shift=/^[A-Z]$/.test(e[1]);else if(e=Bv.exec(A)){let s=[...A];s[0]==="\x1B"&&s[1]==="\x1B"&&(l.meta=!0);let u=[e[1],e[2],e[4],e[6]].filter(Boolean).join(""),f=(e[3]||e[5]||1)-1;l.ctrl=!!(f&4),l.meta=l.meta||!!(f&10),l.shift=!!(f&1),l.code=u,l.name=kp[u]??"",l.shift=Cv(u)||l.shift,l.ctrl=dv(u)||l.ctrl}return l},Xp=Sv;var Vp=iA(EA(),1);var aE=()=>(0,Vp.useContext)(Eu);var Dv=(A,e={})=>{let{setRawMode:i,internal_exitOnCtrlC:r,internal_eventEmitter:l}=aE();(0,ga.useEffect)(()=>{if(e.isActive!==!1)return i(!0),()=>{i(!1)}},[e.isActive,i]);let s=(0,ga.useEffectEvent)(u=>{let f=Xp(u),E={upArrow:f.name==="up",downArrow:f.name==="down",leftArrow:f.name==="left",rightArrow:f.name==="right",pageDown:f.name==="pagedown",pageUp:f.name==="pageup",home:f.name==="home",end:f.name==="end",return:f.name==="return",escape:f.name==="escape",ctrl:f.ctrl,shift:f.shift,tab:f.name==="tab",backspace:f.name==="backspace",delete:f.name==="delete",meta:f.meta,super:f.super??!1,hyper:f.hyper??!1,capsLock:f.capsLock??!1,numLock:f.numLock??!1,eventType:f.eventType},d;f.isKittyProtocol?f.isPrintable?d=f.text??f.name:f.ctrl&&f.name.length===1?d=f.name:d="":f.ctrl?d=f.name??"":d=f.sequence,!f.isKittyProtocol&&Kp.includes(f.name)&&(d=""),d.startsWith("\x1B")&&(d=d.slice(1)),d.length===1&&/[A-Z]/.test(d)&&(E.shift=!0),!(d==="c"&&E.ctrl&&r)&&le.discreteUpdates(()=>{A(d,E)})});(0,ga.useEffect)(()=>{if(e.isActive!==!1)return l.on("input",s),()=>{l.removeListener("input",s)}},[e.isActive,l])},mt=Dv;var Zp=iA(EA(),1);var jp=iA(EA(),1);var Rv=()=>(0,jp.useContext)(fu),sE=Rv;var Wp=iA(EA(),1);var Nv=()=>(0,Wp.useContext)(Iu),uE=Nv;var wv=iA(EA(),1);var cE=iA(EA(),1);var Mv=iA(EA(),1);var Tv=iA(EA(),1);var yu=iA(EA(),1);var fa=iA(EA(),1);var Su=iA(EA(),1);var Gv=()=>{let{stdout:A}=uE(),[e,i]=(0,Su.useState)(()=>Pn(A));return(0,Su.useEffect)(()=>{let r=()=>{i(Pn(A))};return A.on("resize",r),()=>{A.off("resize",r)}},[A]),e},gE=Gv;var Du=iA(EA(),1);var it=iA(ye(),1),zA=iA(EA(),1);var IE=iA(ye(),1),JA=iA(EA(),1);import{PassThrough as xv}from"node:stream";var Pp="\x1B[?1000h\x1B[?1002h\x1B[?1003h\x1B[?1006h",Ru="\x1B[?1006l\x1B[?1003l\x1B[?1002l\x1B[?1000l",bv=/^\x1b\[<(\d+);(\d+);(\d+)([Mm])/;function Uv(A,e){if(A&64)return(A&3)===1?"wheel-down":"wheel-up";if(e)return"none";switch(A&3){case 0:return"left";case 1:return"middle";case 2:return"right";default:return"none"}}function Hv(A){return"\x1B[<".startsWith(A.slice(0,3))&&A.length<=32&&/^\x1b(\[(<[\d;]*)?)?$/.test(A)}function $p(A){let e=[],i="",r=0;for(;r<A.length;){let l=A.indexOf("\x1B",r);if(l===-1)return i+=A.slice(r),{events:e,passthrough:i,pending:""};i+=A.slice(r,l);let s=A.slice(l),u=bv.exec(s);if(u){let f=Number(u[1]),E=u[4]==="m",d=(f&32)!==0,h=(f&64)!==0;e.push({type:h?"wheel":d?"move":E?"release":"press",button:Uv(f,E),x:Number(u[2]),y:Number(u[3]),shift:(f&4)!==0,alt:(f&8)!==0,ctrl:(f&16)!==0}),r=l+u[0].length;continue}if(Hv(s))return{events:e,passthrough:i,pending:s};i+="\x1B",r=l+1}return{events:e,passthrough:i,pending:""}}function fE(){let A="";return e=>{let i=$p(A+e);return A=i.pending,{events:i.events,passthrough:i.passthrough}}}function EE(A=process.stdin,e=process.stdout){let i=!!(A.isTTY&&e.isTTY),r=new Set,l=fE(),s=new xv,u=S=>{let Q=typeof S=="string"?S:S.toString("utf8"),{events:p,passthrough:D}=l(Q);for(let v of p)for(let N of r)N(v);D.length>0&&s.write(D)};i&&(A.on("data",u),A.resume());let f=s;f.isTTY=A.isTTY,f.setRawMode=(S=>(A.setRawMode?.(S),f)),f.ref=(()=>(A.ref?.(),f)),f.unref=(()=>(A.unref?.(),f));let E=!1,d=()=>{!i||E||(e.write(Pp),E=!0)},h=()=>{E&&(e.write(Ru),E=!1)};return{stdin:f,supported:i,isEnabled:()=>E,enable:d,disable:h,subscribe(S){return r.add(S),()=>r.delete(S)},dispose(){h(),r.clear(),i&&A.off("data",u)}}}function Lv(A){if(!A?.yogaNode)return null;let e=A.yogaNode.getComputedLayout(),i=0,r=0,l=A;for(;l?.yogaNode;){let s=l.yogaNode.getComputedLayout();i+=s.left,r+=s.top,l=l.parentNode??void 0}return{left:i+1,top:r+1,width:e.width,height:e.height}}function _v(A,e,i){return e>=A.left&&e<A.left+A.width&&i>=A.top&&i<A.top+A.height}var Am=(0,JA.createContext)(null),tm=(0,JA.createContext)(null);function em({source:A,children:e}){let i=(0,JA.useRef)(new Set),r=(0,JA.useRef)(null),[l,s]=(0,JA.useState)(null),[u,f]=(0,JA.useState)(!1),E=(0,JA.useCallback)(D=>(i.current.add(D),()=>{i.current.delete(D),r.current===D&&(r.current=null),s(v=>v===D?null:v)}),[]),d=(0,JA.useCallback)((D,v)=>{let N=null,L=Number.POSITIVE_INFINITY;for(let uA of i.current){let J=Lv(uA.ref.current);if(!J||J.width<=0||J.height<=0||!_v(J,D,v))continue;let G=J.width*J.height;G<L&&(N=uA,L=G)}return N},[]);(0,JA.useEffect)(()=>{if(A)return A.subscribe(D=>{if(D.type==="wheel")return;let v=d(D.x,D.y);if(D.type==="move"){s(N=>N===v?N:v);return}if(D.type==="press"){if(D.button!=="left")return;r.current=v,s(v);return}r.current&&r.current===v&&v?.onClick?.(),r.current=null})},[A,d]),(0,JA.useEffect)(()=>{let D=l;return D?.onHover?.(!0),()=>D?.onHover?.(!1)},[l]);let h=(0,JA.useCallback)(()=>{A&&(A.enable(),f(A.isEnabled()))},[A]),S=(0,JA.useCallback)(()=>{A&&(A.disable(),f(A.isEnabled()))},[A]),Q=(0,JA.useMemo)(()=>({register:E}),[E]),p=(0,JA.useMemo)(()=>({supported:!!A?.supported,enabled:u,enable:h,disable:S}),[A,u,h,S]);return(0,IE.jsx)(Am.Provider,{value:Q,children:(0,IE.jsx)(tm.Provider,{value:p,children:e})})}var Ov={supported:!1,enabled:!1,enable:()=>{},disable:()=>{}};function nm(){return(0,JA.useContext)(tm)??Ov}function Ea(A,{onClick:e,disabled:i=!1}={}){let r=(0,JA.useContext)(Am),[l,s]=(0,JA.useState)(!1),u=(0,JA.useRef)(e);u.current=e;let f=(0,JA.useMemo)(()=>({ref:A,onClick:()=>u.current?.(),onHover:s}),[A]);return(0,JA.useEffect)(()=>{if(!(!r||i))return r.register(f)},[r,f,i]),(0,JA.useEffect)(()=>{i&&s(!1)},[i]),l&&!i}var k={accent:"cyan",border:"gray",muted:"gray",ok:"green",warn:"yellow",bad:"red"},BE="\u25B8",CE=" ",im={ok:k.ok,warn:k.warn,bad:k.bad,idle:k.muted},rm={ok:"\u25CF",warn:"\u25CF",bad:"\u25CF",idle:"\u25CB"};function dE(A,e){return A.includes(e)}var Fv=[{id:"mode",kind:"choice",choices:JC,labelKey:"field.mode"},{id:"port",kind:"text",labelKey:"field.port",visibleFor:["local","lan"]},{id:"lanHost",kind:"address",labelKey:"field.lanHost",visibleFor:["lan"]},{id:"remoteUrl",kind:"text",labelKey:"field.remoteUrl",visibleFor:["remote"]},{id:"publicUrl",kind:"text",labelKey:"field.publicUrl"},{id:"socketPath",kind:"text",labelKey:"field.socketPath"},{id:"herdrArgs",kind:"text",labelKey:"field.herdrArgs"},{id:"herdrAutoStart",kind:"toggle",labelKey:"field.herdrAutoStart"},{id:"language",kind:"choice",choices:ug,labelKey:"field.language"},{id:"keepaliveManager",kind:"choice",choices:so,labelKey:"field.keepalive"}],je="",kv=["local","lan","official","remote"];function mr(A){return A.relay.mode==="remote"&&A.relay.remoteUrl===Ri?"official":A.relay.mode}function QE(A){return mr(A)==="official"}function lm(A){return JSON.parse(JSON.stringify(A))}function Nu(A=Zn()){return lm(A)}function hE(A){return Fv.filter(e=>!e.visibleFor||e.visibleFor.includes(A))}function Ho(A,e){switch(e){case"mode":return A.relay.mode;case"port":return String(A.relay.port);case"lanHost":return A.relay.lanHost||je;case"remoteUrl":return A.relay.remoteUrl||je;case"publicUrl":return A.relay.publicUrl||je;case"socketPath":return A.herdr.socketPath||je;case"herdrArgs":return(A.herdr.args||[]).join(" ");case"herdrAutoStart":return A.herdr.autoStart?"on":"off";case"language":return A.ui.language;case"keepaliveManager":return A.keepalive.manager;default:return je}}function Ia(A,e){switch(e){case"lanHost":return Bg()||"0.0.0.0";case"publicUrl":return kC(A,Bg());case"socketPath":return"placeholder.autoDiscovered";case"herdrArgs":return"placeholder.none";case"remoteUrl":return"wss://relay.example.com";default:return je}}function om(A,e){try{let i=new URL(A);return e.includes(i.protocol)}catch{return!1}}function dn(A,e,i){let r=lm(A),l=typeof i=="string"?i.trim():i,s=l;switch(e){case"mode":{if(!dE(kv,l))return{draft:A,errorKey:"error.invalidMode"};if(l==="official"){r.relay.mode="remote",r.relay.remoteUrl=Ri,r.relay.publicUrl=je;break}l==="remote"&&r.relay.remoteUrl===Ri&&(r.relay.remoteUrl=je),r.relay.mode=l,l==="lan"&&(Ss(r.relay.lanHost)||Ds(r.relay.lanHost))&&(r.relay.lanHost=je),r.relay.publicUrl=je;break}case"port":{let u=Number.parseInt(s,10);if(!Number.isInteger(u)||u<1||u>65535)return{draft:A,errorKey:"error.invalidPort"};r.relay.port=u;break}case"lanHost":{if(s&&(Ss(s)||Ds(s)))return{draft:A,errorKey:"error.invalidLanHost"};r.relay.lanHost=s||je;break}case"remoteUrl":{if(s&&!om(s,["ws:","wss:","http:","https:"]))return{draft:A,errorKey:"error.invalidRelayUrl"};r.relay.remoteUrl=s.replace(/\/+$/,"");break}case"publicUrl":{if(s&&(!om(s,["http:","https:"])||FC(s)))return{draft:A,errorKey:"error.invalidPublicUrl"};r.relay.publicUrl=s.replace(/\/+$/,"");break}case"socketPath":{r.herdr.socketPath=s||null;break}case"herdrArgs":{let u=s?s.split(/\s+/).filter(Boolean):[];if(u.includes("--no-session"))return{draft:A,errorKey:"error.removedHerdrArg"};r.herdr.args=u;break}case"herdrAutoStart":{if(l!==!0&&l!==!1&&l!=="on"&&l!=="off")return{draft:A,errorKey:"error.unknownField"};r.herdr.autoStart=l===!0||l==="on";break}case"language":{if(!dE(ug,l))return{draft:A,errorKey:"error.invalidLanguage"};r.ui.language=l;break}case"keepaliveManager":{if(!dE(so,l))return{draft:A,errorKey:"error.invalidKeepalive"};r.keepalive.manager=l;break}default:return{draft:A,errorKey:"error.unknownField"}}return{draft:r,errorKey:null}}function Kv(A){let e=[];return A.relay.mode==="remote"&&!A.relay.remoteUrl&&e.push("error.remoteUrlRequired"),e}function Qn(A){let e=Kv(A);if(e.length>0)throw Object.assign(new Error(`configuration is incomplete: ${e.join(", ")}`),{problems:e});let i=qC(vn(),{})||{},r={...i};r.ui={...i.ui||{},language:A.ui.language};let l={...i.relay||{},mode:A.relay.mode,port:A.relay.port,lanHost:A.relay.mode==="lan"&&(Ss(A.relay.lanHost)||Ds(A.relay.lanHost))?je:A.relay.lanHost,publicUrl:A.relay.publicUrl,remoteUrl:A.relay.remoteUrl};r.relay=l,delete l.local,delete l.host,delete l.url,delete r.patch;let s={...i.herdr||{},socketPath:A.herdr.socketPath,args:A.herdr.args,autoStart:A.herdr.autoStart===!0};return r.herdr=s,s.socketPath||delete s.socketPath,r.keepalive={...i.keepalive||{},manager:A.keepalive.manager},YC(OC()),zC(vn(),r),{ok:!0,path:vn()}}function pE(A,e){return A.relay.mode!==e.relay.mode||A.relay.port!==e.relay.port||A.relay.lanHost!==e.relay.lanHost||A.relay.remoteUrl!==e.relay.remoteUrl||A.relay.publicUrl!==e.relay.publicUrl||A.herdr.socketPath!==e.herdr.socketPath||A.herdr.args.join(" ")!==e.herdr.args.join(" ")}async function mE({waitForStart:A=!1}={}){if(process.platform!=="win32")return!1;let e=await import("../connector/admin-broker.js");return A?e.waitForAdminBroker():e.adminBrokerStatus()}async function am(A,e){return(await import("./W2FYGFNZ.js")).configureAdminBroker(A,e)}function sm(A,e){let r=["herdr-remote-relay",`--public-url ${A.relay.remoteUrl?A.relay.remoteUrl.replace(/^ws/,"http"):"https://relay.example.com"}`,"--trust-proxy"];return e&&r.push(`--password '${e.replace(/'/g,"'\\''")}'`),r.join(" ")}async function um(A){let e=KC(A),i;try{i=await fg(`${e}/healthz`,{timeout:4e3})}catch(r){return{ok:!1,message:r.message}}try{let r=ml(),l=await fg(`${e}/api/status`,{timeout:4e3,headers:{"X-Herdr-Host-Id":r.hostId,"X-Herdr-Host-Token":r.hostToken}});return{ok:!0,version:String(i.version||l.version||""),hosts:Array.isArray(l.hosts)?l.hosts.length:0}}catch{return{ok:!0,version:String(i.version||""),hosts:void 0}}}function cm(A,e){if(!Number.isFinite(A))return e("common.unknown");let i=Math.max(0,Math.floor(A)),r=Math.floor(i/3600),l=Math.floor(i%3600/60);return r>0?`${r}h ${l}m`:l>0?`${l}m ${i%60}s`:`${i}s`}var IA=iA(ye(),1);var ht=iA(ye(),1),xo=iA(EA(),1);function Ai({level:A}){return(0,ht.jsx)(x,{color:im[A],children:rm[A]})}var Jv=20;function et({label:A,labelWidth:e=Jv,children:i}){return(0,ht.jsxs)(X,{children:[(0,ht.jsx)(X,{width:e,flexShrink:0,children:(0,ht.jsx)(x,{color:k.muted,wrap:"truncate-end",children:A})}),(0,ht.jsx)(X,{flexGrow:1,children:i})]})}function xe({selected:A,disabled:e=!1,onSelect:i,onHover:r,children:l}){let s=(0,xo.useRef)(null),u=Ea(s,{disabled:e,onClick:i});gm(u,r);let f=A||u,E=e?k.muted:f?k.accent:void 0;return(0,ht.jsxs)(X,{ref:s,children:[(0,ht.jsxs)(x,{color:f?k.accent:void 0,children:[f?BE:CE," "]}),(0,ht.jsx)(x,{color:E,bold:f,dimColor:e,children:l})]})}function gm(A,e){let i=(0,xo.useRef)(e);i.current=e,(0,xo.useEffect)(()=>{A&&i.current?.()},[A])}function Lo({items:A,selectedId:e,onChange:i,onSelect:r}){return(0,ht.jsx)(X,{flexDirection:"column",children:A.map(l=>(0,ht.jsx)(xe,{selected:l.id===e,disabled:l.disabled,onSelect:()=>r(l.id),onHover:()=>i(l.id),children:l.label},l.id))})}function Ui({label:A,selected:e,disabled:i=!1,labelWidth:r=22,onSelect:l,onHover:s,children:u}){let f=(0,xo.useRef)(null),E=Ea(f,{disabled:i,onClick:l});gm(E,s);let d=e||E;return(0,ht.jsxs)(X,{ref:f,children:[(0,ht.jsxs)(X,{width:r,flexShrink:0,children:[(0,ht.jsxs)(x,{color:d?k.accent:void 0,children:[d?BE:CE," "]}),(0,ht.jsx)(x,{color:d?k.accent:k.muted,bold:d,wrap:"truncate-end",children:A})]}),(0,ht.jsx)(X,{flexGrow:1,children:u})]})}function nt({title:A,children:e}){return(0,ht.jsxs)(X,{flexDirection:"column",borderStyle:"round",borderColor:k.border,paddingX:1,flexGrow:1,children:[A?(0,ht.jsx)(X,{marginBottom:1,children:(0,ht.jsx)(x,{bold:!0,children:A})}):null,e]})}function yt({text:A,level:e}){if(!A)return null;let i=e==="error"?k.bad:e==="success"?k.ok:k.muted;return(0,ht.jsx)(X,{marginTop:1,children:(0,ht.jsx)(x,{color:i,children:A})})}function fm(A){return A==null?"idle":A?"ok":"bad"}function Em({ctx:A}){let{t:e,status:i,config:r}=A;if(!i)return(0,IA.jsx)(nt,{title:e("overview.title"),children:(0,IA.jsx)(x,{color:k.muted,children:e("common.loading")})});let l=i.relay.health||{},s=l.ok!==!1,u=i.relay.local?fm(i.relay.alive):s?"ok":"bad",f=i.keepalive.active?"ok":i.keepalive.installed?"warn":"idle",E=!i.host.alive&&(i.relay.local?!i.relay.alive:!s);return(0,IA.jsxs)(nt,{title:e("overview.title"),children:[(0,IA.jsx)(et,{label:e("overview.mode"),children:(0,IA.jsx)(x,{children:e(`mode.${i.mode}`)})}),(0,IA.jsx)(et,{label:e("overview.relay"),children:(0,IA.jsxs)(X,{children:[(0,IA.jsx)(Ai,{level:u}),(0,IA.jsxs)(x,{children:[" ",i.relay.local?e("overview.relayLocal",{bind:i.relay.bind??"",port:i.relay.port}):e("overview.relayRemote",{url:i.relay.remoteUrl??""})]}),i.relay.local&&i.relay.pid?(0,IA.jsx)(x,{color:k.muted,children:` ${e("common.pid",{pid:i.relay.pid})}`}):null]})}),(0,IA.jsx)(et,{label:e("overview.host"),children:(0,IA.jsxs)(X,{children:[(0,IA.jsx)(Ai,{level:fm(i.host.alive)}),(0,IA.jsx)(x,{children:` ${i.host.alive?e("common.running"):e("common.stopped")}`}),i.host.pid?(0,IA.jsx)(x,{color:k.muted,children:` ${e("common.pid",{pid:i.host.pid})}`}):null]})}),(0,IA.jsx)(et,{label:e("overview.socket"),children:(0,IA.jsxs)(X,{children:[(0,IA.jsx)(Ai,{level:i.host.socketExists?"ok":"warn"}),(0,IA.jsx)(x,{color:k.muted,children:` ${i.host.socketPath}`}),i.host.socketExists?null:(0,IA.jsx)(x,{color:k.warn,children:` ${e("overview.socketMissing")}`})]})}),(0,IA.jsx)(et,{label:e("overview.webUrl"),children:(0,IA.jsx)(x,{color:k.accent,children:i.publicUrl})}),(0,IA.jsx)(et,{label:e("overview.keepalive"),children:(0,IA.jsxs)(X,{children:[(0,IA.jsx)(Ai,{level:f}),(0,IA.jsxs)(x,{children:[` ${i.keepalive.manager} \u2014 `,i.keepalive.active?e("common.running"):i.keepalive.installed?e("common.installed"):e("common.notInstalled")]})]})}),(0,IA.jsx)(X,{marginTop:1,flexDirection:"column",children:s?(0,IA.jsxs)(IA.Fragment,{children:[typeof l.hosts=="number"?(0,IA.jsx)(et,{label:e("overview.hosts"),children:(0,IA.jsx)(x,{children:l.hosts})}):null,typeof l.clients=="number"?(0,IA.jsx)(et,{label:e("overview.devices"),children:(0,IA.jsx)(x,{children:l.clients})}):null,(0,IA.jsx)(et,{label:e("overview.uptime"),children:(0,IA.jsx)(x,{color:k.muted,children:cm(l.uptimeSeconds,e)})})]}):(0,IA.jsx)(x,{color:k.warn,children:e("overview.unreachable",{message:l.message??""})})}),E?(0,IA.jsx)(X,{marginTop:1,children:(0,IA.jsx)(x,{color:k.muted,children:e("overview.notStarted")})}):null,r.relay.mode==="local"?(0,IA.jsx)(X,{marginTop:1,children:(0,IA.jsx)(x,{color:k.muted,children:e("mode.local.description")})}):null,(0,IA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}var St=iA(ye(),1),Ki=iA(EA(),1);var Dy=iA(yy(),1);var Sy=44;function Ry({ctx:A}){let{t:e,run:i}=A,{columns:r}=gE(),[l,s]=(0,Ki.useState)(null),[u,f]=(0,Ki.useState)(null),[E,d]=(0,Ki.useState)(0),[h,S]=(0,Ki.useState)("generate");(0,Ki.useEffect)(()=>{if(!l)return;let N=()=>d(Math.max(0,l.expiresAt-Date.now()));N();let L=setInterval(N,1e3);return()=>clearInterval(L)},[l]),(0,Ki.useEffect)(()=>{if(!l||r<Sy){f(null);return}let N=!1;return Dy.default.toString(l.pairUrl,{type:"terminal",small:!0,errorCorrectionLevel:"L"}).then(L=>{N||f(L.replace(/\n$/,""))}).catch(()=>{N||f(null)}),()=>{N=!0}},[l,r]);let Q=()=>i(async()=>{A.notify(N=>N("pair.working"));try{let N=await Dg(),L=Eg(N);s({...N,code:L}),A.notify("","info")}catch(N){let L=N.message;throw s(null),new Error(/host_offline|no Herdr host|did not register/i.test(L)?e("pair.hostOffline"):e("pair.failed",{message:L}))}});mt((N,L)=>{L.return&&Q()},{isActive:A.editingId===null});let p=l!==null&&E<=0,D=Math.floor(E/6e4),v=Math.floor(E%6e4/1e3);return(0,St.jsxs)(nt,{title:e("pair.title"),children:[(0,St.jsx)(Lo,{items:[{id:"generate",label:e(l?"pair.regenerate":"pair.generate")}],selectedId:h,onChange:S,onSelect:Q}),l?(0,St.jsxs)(X,{flexDirection:"column",marginTop:1,children:[(0,St.jsxs)(X,{children:[(0,St.jsx)(x,{color:k.muted,children:`${e("pair.code")} `}),(0,St.jsx)(x,{bold:!0,color:p?k.muted:k.accent,children:l.code.split("").join(" ")})]}),(0,St.jsxs)(X,{children:[(0,St.jsx)(x,{color:k.muted,children:`${e("pair.url")} `}),(0,St.jsx)(x,{children:l.pairUrl})]}),(0,St.jsx)(X,{marginTop:1,children:(0,St.jsx)(x,{color:p?k.bad:k.muted,children:p?e("pair.expired"):e("pair.expires",{minutes:`${D}:${String(v).padStart(2,"0")}`,time:new Date(l.expiresAt).toLocaleTimeString()})})}),!p&&u?(0,St.jsxs)(X,{flexDirection:"column",marginTop:1,children:[(0,St.jsx)(x,{children:u}),(0,St.jsx)(x,{color:k.muted,children:e("pair.qrHint")})]}):null,!p&&!u&&r<Sy?(0,St.jsx)(X,{marginTop:1,children:(0,St.jsx)(x,{color:k.muted,children:e("pair.qrUnavailable")})}):null,(0,St.jsx)(X,{marginTop:1,children:(0,St.jsx)(x,{color:k.muted,children:e("pair.instructions")})})]}):null,(0,St.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}var Pt=iA(ye(),1),vy=iA(EA(),1);var Ny=8;function My({ctx:A}){let{t:e,run:i,status:r}=A,[l,s]=(0,vy.useState)("start"),u=[{id:"start",label:e("services.start")},{id:"stop",label:e("services.stop")},{id:"restart",label:e("services.restart")}],f=h=>{if(A.dirty&&h!=="stop"){A.notify(S=>S("services.unsavedBlocked"),"error");return}return i(()=>{let S=A.config;if(h==="start"){let p=Rl(S);A.notify(D=>p.managed?D("services.managedNotice",{manager:p.manager??""}):D("services.started"),"success");return}if(h==="stop"){let p=Rg(S);A.notify(D=>p.managed?D("services.managedNotice",{manager:p.manager??""}):D("services.stopped"),"success");return}let Q=Ng(S);A.notify(p=>Q.managed?p("services.managedNotice",{manager:Q.manager??""}):p("services.restarted"),"success")})};mt((h,S)=>{let Q=u.findIndex(p=>p.id===l);S.upArrow?s(u[(Q-1+u.length)%u.length].id):S.downArrow?s(u[(Q+1)%u.length].id):S.return&&f(l)},{isActive:A.editingId===null});let E=Rs("relay",Ny),d=Rs("host",Ny);return(0,Pt.jsxs)(nt,{title:e("services.title"),children:[(0,Pt.jsx)(Lo,{items:u,selectedId:l,onChange:s,onSelect:f}),A.dirty?(0,Pt.jsx)(X,{marginTop:1,children:(0,Pt.jsx)(x,{color:k.warn,children:e("services.unsavedBlocked")})}):null,r?.keepalive.installed?(0,Pt.jsx)(X,{marginTop:1,children:(0,Pt.jsx)(x,{color:k.muted,children:e("services.managedNotice",{manager:r.keepalive.manager})})}):null,(0,Pt.jsxs)(X,{flexDirection:"column",marginTop:1,children:[(0,Pt.jsx)(x,{color:k.muted,children:e("services.logs")}),(0,Pt.jsx)(wy,{title:e("services.logRelay"),lines:E,emptyText:e("services.logEmpty")}),(0,Pt.jsx)(wy,{title:e("services.logHost"),lines:d,emptyText:e("services.logEmpty")})]}),(0,Pt.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}function wy({title:A,lines:e,emptyText:i}){return(0,Pt.jsxs)(X,{flexDirection:"column",marginTop:1,children:[(0,Pt.jsx)(x,{bold:!0,color:k.muted,children:A}),e.length===0?(0,Pt.jsx)(x,{color:k.muted,children:i}):e.map((r,l)=>(0,Pt.jsx)(x,{color:k.muted,wrap:"truncate-end",children:r},l))]})}var vA=iA(ye(),1),ei=iA(EA(),1);var vr=iA(ye(),1),Ku=iA(EA(),1);var rG=/[\x00-\x1f\x7f]/;function Ji({value:A,placeholder:e,active:i,mask:r=!1,onSubmit:l,onCancel:s}){let[u,f]=(0,Ku.useState)(A);(0,Ku.useEffect)(()=>{i&&f(A)},[i,A]),mt((h,S)=>{if(S.return){l(u);return}if(S.escape){f(A),s();return}if(S.backspace||S.delete){f(Q=>Q.slice(0,-1));return}if(S.ctrl&&h==="u"){f("");return}h&&!S.ctrl&&!S.meta&&!rG.test(h)&&f(Q=>Q+h)},{isActive:i});let E=i?u:A,d=r&&E?"\u2022".repeat(Math.min(E.length,32)):E;return i?(0,vr.jsxs)(X,{children:[(0,vr.jsx)(x,{color:k.accent,children:d}),(0,vr.jsx)(x,{color:k.accent,inverse:!0,children:" "})]}):d?(0,vr.jsx)(x,{children:d}):(0,vr.jsx)(x,{color:k.muted,children:e??""})}function Gy({ctx:A}){let{t:e,draft:i,editingId:r}=A,[l,s]=(0,ei.useState)("mode"),[u,f]=(0,ei.useState)(!1),[E,d]=(0,ei.useState)(!1),[h,S]=(0,ei.useState)(A.runtime.relayPassword||""),Q=QE(i),D=[...(0,ei.useMemo)(()=>hE(i.relay.mode).filter(G=>["mode","port","lanHost","remoteUrl","publicUrl"].includes(G.id)),[i.relay.mode]).map(G=>({id:G.id,kind:Q&&(G.id==="remoteUrl"||G.id==="publicUrl")?"readonly":"field",fieldKind:G.kind,label:e(G.labelKey)})),...i.relay.mode==="remote"&&!Q?[{id:"password",kind:"password",label:e("relay.password")}]:[],{id:"save",kind:"action",label:e("common.save")},{id:"test",kind:"action",label:e("relay.test")},...i.relay.mode==="remote"&&!Q?[{id:"reveal",kind:"action",label:e(u?"relay.hidePassword":"relay.showPassword")},{id:"env",kind:"action",label:e("relay.envSnippet")}]:[],{id:"regenerate",kind:"action",label:e("relay.regenerate")}],v=(0,ei.useMemo)(()=>Sl({includeLoopback:!1}),[]),N=G=>{let q=i;for(let[V,fA]of G){let TA=dn(q,V,fA),{errorKey:AA}=TA;if(AA)return A.notify(oA=>oA(AA),"error"),!1;q=TA.draft}return A.updateDraft(q),A.notify("","info"),!0},L=(G,q)=>N([[G,q]]),uA=()=>{try{let G=Qn(i);A.reloadConfig(),A.notify(q=>q("common.saved",{path:G.path}),"success")}catch(G){let q=G.problems;A.notify(V=>q?q.map(fA=>V(fA)).join(" "):V("error.saveFailed",{message:G.message}),"error")}},J=G=>{let q=D.find(V=>V.id===G);if(q){if(q.kind==="readonly"){A.notify(V=>V("relay.officialFixed"),"info");return}if(q.kind==="field"||q.kind==="password"){A.setEditing(G);return}if(G==="save"){uA();return}if(G==="reveal"){f(V=>!V);return}if(G==="env"){d(V=>!V);return}if(G==="regenerate"){A.run(()=>{gg(),A.reloadConfig(),A.notify(V=>V("relay.regenerated"),"success")});return}G==="test"&&A.run(async()=>{let V=await um(A.config);A.notify(fA=>V.ok?fA("relay.testOk",{version:V.version??"?",hosts:V.hosts??0}):fA("relay.testFailed",{message:V.message??""}),V.ok?"success":"error")})}};if(mt((G,q)=>{let V=D.findIndex(fA=>fA.id===l);q.upArrow?s(D[(V-1+D.length)%D.length].id):q.downArrow?s(D[(V+1)%D.length].id):q.return?J(l):G==="s"&&uA()},{isActive:r===null}),r==="mode")return(0,vA.jsx)(nt,{title:e("field.mode"),children:(0,vA.jsx)(Yi,{options:[...["local","lan"].map(G=>({id:G,label:e(`mode.${G}`),description:e(`mode.${G}.description`)})),{id:"official",label:e("mode.official"),description:e("mode.official.description")},{id:"remote",label:e("mode.remote"),description:e("mode.remote.description")}],current:mr(i),onPick:G=>{L("mode",G)&&(G==="official"&&(S(""),gr("")),A.setEditing(null))},onCancel:()=>A.setEditing(null)})});if(r==="lanHost"){let G=v.map(q=>({id:q.address,label:`${q.address} (${q.name}, ${e(oG(q.kind))})`}));return(0,vA.jsx)(nt,{title:e("relay.selectAddress"),children:G.length===0?(0,vA.jsx)(x,{color:k.warn,children:e("relay.noAddresses")}):(0,vA.jsx)(Yi,{options:G,current:i.relay.lanHost||G[0].id,onPick:q=>{L("lanHost",q),A.setEditing(null)},onCancel:()=>A.setEditing(null)})})}return(0,vA.jsxs)(nt,{title:e("relay.title"),children:[i.relay.mode!=="remote"?(0,vA.jsxs)(X,{flexDirection:"column",marginBottom:1,children:[(0,vA.jsx)(et,{label:e("relay.listenAddress"),children:(0,vA.jsx)(x,{color:k.muted,children:`${sg(i)}:${i.relay.port}`})}),(0,vA.jsx)(x,{color:k.muted,children:e("relay.listenAddressHint")})]}):null,D.map(G=>G.kind==="action"?(0,vA.jsx)(xe,{selected:l===G.id,onSelect:()=>{s(G.id),J(G.id)},onHover:()=>s(G.id),children:G.label},G.id):(0,vA.jsx)(Ui,{label:G.label,selected:l===G.id,onSelect:()=>J(G.id),onHover:()=>s(G.id),children:G.kind==="password"?(0,vA.jsx)(Ji,{value:h,placeholder:e("relay.passwordEmpty"),active:r==="password",mask:!u,onSubmit:q=>{S(q),gr(q),A.setEditing(null),A.notify(V=>V("relay.passwordSaved"),"success")},onCancel:()=>A.setEditing(null)}):G.kind==="readonly"?(0,vA.jsx)(x,{color:k.muted,children:`${Ho(i,G.id)||Ty(A,G.id)} (${e("relay.locked")})`}):G.fieldKind==="choice"?(0,vA.jsx)(x,{children:e(`mode.${mr(i)}`)}):(0,vA.jsx)(Ji,{value:Ho(i,G.id),placeholder:Ty(A,G.id),active:r===G.id,onSubmit:q=>{L(G.id,q)&&A.setEditing(null)},onCancel:()=>A.setEditing(null)})},G.id)),A.dirty?(0,vA.jsx)(X,{marginTop:1,children:(0,vA.jsx)(x,{color:k.warn,children:e("hint.unsavedChanges")})}):null,i.relay.mode==="remote"?(0,vA.jsx)(X,{marginTop:1,children:(0,vA.jsx)(x,{color:k.muted,children:e(Q?"relay.officialHint":"relay.passwordHint")})}):null,(0,vA.jsx)(X,{marginTop:1,children:(0,vA.jsx)(et,{label:e("relay.identity"),children:(0,vA.jsx)(x,{color:k.muted,children:A.runtime.hostId})})}),E?(0,vA.jsxs)(X,{flexDirection:"column",marginTop:1,borderStyle:"round",borderColor:k.border,paddingX:1,children:[(0,vA.jsx)(x,{color:k.muted,children:e("relay.envHint")}),(0,vA.jsx)(x,{children:sm(A.config,h)})]}):null,Q?null:(0,vA.jsx)(X,{marginTop:1,children:(0,vA.jsx)(x,{color:k.muted,children:e("relay.docsHint")})}),(0,vA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}function Ty(A,e){let i=Ia(A.draft,e);return i.startsWith("placeholder.")?A.t(i):i}function oG(A){return`relay.address${A.charAt(0).toUpperCase()}${A.slice(1)}`}function Yi({options:A,current:e,onPick:i,onCancel:r}){let[l,s]=(0,ei.useState)(()=>{let f=A.findIndex(E=>E.id===e);return f>=0?f:0}),u=A[Math.min(l,A.length-1)];return mt((f,E)=>{if(E.escape){r();return}E.upArrow?s(d=>(d-1+A.length)%A.length):E.downArrow?s(d=>(d+1)%A.length):E.return&&u&&i(u.id)}),(0,vA.jsxs)(X,{flexDirection:"column",children:[(0,vA.jsx)(Lo,{items:A.map(f=>({id:f.id,label:f.label})),selectedId:u?.id??"",onChange:f=>s(A.findIndex(E=>E.id===f)),onSelect:i}),u?.description?(0,vA.jsx)(X,{marginTop:1,children:(0,vA.jsx)(x,{color:k.muted,children:u.description})}):null]})}var YA=iA(ye(),1),wa=iA(EA(),1);function by({ctx:A}){let{t:e,status:i,draft:r,editingId:l}=A,[s,u]=(0,wa.useState)("install"),[f,E]=(0,wa.useState)(null);(0,wa.useEffect)(()=>{if(process.platform!=="win32")return;let Q=!1;return mE().then(p=>{Q||E(p)}).catch(()=>{Q||E(!1)}),()=>{Q=!0}},[]);let d=i?.keepalive,h=[{id:"install",label:e("keepalive.install")},{id:"restart",label:e("keepalive.restart")},{id:"uninstall",label:e("keepalive.uninstall")},{id:"manager",label:`${e("keepalive.manager")}: ${r.keepalive.manager}`},...process.platform==="linux"&&d?.manager==="systemd"&&!d?.linger?[{id:"linger",label:e("keepalive.enableLinger")}]:[],...process.platform==="win32"?[{id:"adminBrokerInstall",label:e("adminBroker.install")},{id:"adminBrokerUninstall",label:e("adminBroker.uninstall")}]:[]],S=Q=>{if(Q==="manager"){A.setEditing("keepaliveManager");return}if(Q==="adminBrokerInstall"||Q==="adminBrokerUninstall"){let p=Q==="adminBrokerInstall"?"install":"uninstall";A.run(async()=>{let D=!1;try{await am(p,e),D=p==="install"&&await mE({waitForStart:!0})}catch(v){if(v.code==="ELEVATION_CANCELLED"){A.notify(N=>N("adminBroker.elevationCancelled"),"info");return}throw v}E(D),A.notify(v=>v(`adminBroker.${p}Done`),"success")});return}A.run(async()=>{if(Q==="install"){Mn.detectManager(A.config.keepalive.manager)==="windows-service"&&A.notify(p=>p("keepalive.serviceWindowHint"),"info");try{let p=await Mn.install(A.config);A.notify(D=>D("keepalive.installed",{manager:p.manager}),"success")}catch(p){if(p.code==="ELEVATION_CANCELLED"){A.notify(D=>D("keepalive.elevationCancelled"),"info");return}throw p}return}if(Q==="uninstall"){await Mn.uninstall(A.config),A.notify(p=>p("keepalive.uninstalled"),"success");return}if(Q==="restart"){Mn.restart(A.config),A.notify(p=>p("keepalive.restarted"),"success");return}if(Q==="linger"){let p=Mn.enableLinger();A.notify(D=>D("keepalive.lingerDone",{username:p.username}),"success")}})};return mt((Q,p)=>{let D=h.findIndex(v=>v.id===s);p.upArrow?u(h[(D-1+h.length)%h.length].id):p.downArrow?u(h[(D+1)%h.length].id):p.return&&S(s)},{isActive:l===null}),l==="keepaliveManager"?(0,YA.jsx)(nt,{title:e("field.keepalive"),children:(0,YA.jsx)(Yi,{options:so.map(Q=>({id:Q,label:Q})),current:r.keepalive.manager,onPick:Q=>{let p=dn(r,"keepaliveManager",Q),{errorKey:D}=p;if(D){A.notify(v=>v(D),"error");return}A.updateDraft(p.draft);try{Qn(p.draft),A.reloadConfig()}catch(v){A.notify(N=>N("error.saveFailed",{message:v.message}),"error")}A.setEditing(null)},onCancel:()=>A.setEditing(null)})}):(0,YA.jsxs)(nt,{title:e("keepalive.title"),children:[(0,YA.jsx)(et,{label:e("keepalive.manager"),children:(0,YA.jsx)(x,{children:d?.manager??e("common.unknown")})}),(0,YA.jsx)(et,{label:e("keepalive.state"),children:(0,YA.jsxs)(X,{children:[(0,YA.jsx)(Ai,{level:d?.active?"ok":d?.installed?"warn":"idle"}),(0,YA.jsxs)(x,{children:[" ",d?.active?e("common.running"):d?.installed?e("common.installed"):e("common.notInstalled")]})]})}),process.platform==="win32"?(0,YA.jsxs)(YA.Fragment,{children:[(0,YA.jsx)(et,{label:e("adminBroker.title"),children:(0,YA.jsx)(x,{color:f?k.ok:k.warn,children:e(f===null?"adminBroker.checking":f?"adminBroker.ready":"adminBroker.notReady")})}),(0,YA.jsx)(x,{color:k.muted,children:e("adminBroker.tuiHint")})]}):null,d?.unitPath?(0,YA.jsx)(et,{label:e("keepalive.unitPath"),children:(0,YA.jsx)(x,{color:k.muted,children:d.unitPath})}):null,(0,YA.jsx)(X,{marginTop:1,flexDirection:"column",children:h.map(Q=>(0,YA.jsx)(xe,{selected:s===Q.id,onSelect:()=>{u(Q.id),S(Q.id)},onHover:()=>u(Q.id),children:Q.label},Q.id))}),(0,YA.jsxs)(X,{marginTop:1,flexDirection:"column",children:[d?.manager==="systemd"?(0,YA.jsx)(x,{color:d.linger?k.muted:k.warn,children:d.linger?e("keepalive.lingerEnabled"):e("keepalive.lingerDisabled")}):null,d?.manager==="supervisor"?(0,YA.jsx)(x,{color:k.warn,children:e("keepalive.fallbackNote")}):null,d?.manager==="windows-task"?(0,YA.jsx)(x,{color:k.muted,children:e("keepalive.windowsTaskNote")}):null,d?.manager==="windows-service"?(0,YA.jsx)(x,{color:k.warn,children:e("keepalive.serviceNote")}):null,(0,YA.jsx)(x,{color:k.muted,children:e("keepalive.logsHint",{command:i?.logsHint??""})})]}),(0,YA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}var Dt=iA(ye(),1),va=iA(EA(),1);function Uy({ctx:A}){let{t:e,draft:i,editingId:r}=A,[l,s]=(0,va.useState)("socketPath"),[u,f]=(0,va.useState)(null);(0,va.useEffect)(()=>{f(Sg())},[]);let E=[{id:"socketPath",kind:"field",label:e("herdr.socketPath")},{id:"herdrArgs",kind:"field",label:e("herdr.args")},{id:"herdrAutoStart",kind:"toggle",label:e("field.herdrAutoStart")},{id:"save",kind:"action",label:e("common.save")}],d=(Q,p)=>{let D=dn(i,Q,p),{errorKey:v}=D;return v?(A.notify(N=>N(v),"error"),!1):(A.updateDraft(D.draft),!0)},h=()=>{try{let Q=Qn(i);A.reloadConfig(),A.notify(p=>p("common.saved",{path:Q.path}),"success")}catch(Q){A.notify(p=>p("error.saveFailed",{message:Q.message}),"error")}},S=Q=>{if(Q==="socketPath"||Q==="herdrArgs"){A.setEditing(Q);return}if(Q==="herdrAutoStart"){d(Q,i.herdr.autoStart?"off":"on");return}Q==="save"&&h()};return mt((Q,p)=>{let D=E.findIndex(N=>N.id===l),v=D>=0?D:0;p.upArrow?s(E[(v-1+E.length)%E.length].id):p.downArrow?s(E[(v+1)%E.length].id):p.return?S(l):Q==="s"&&h()},{isActive:r===null}),(0,Dt.jsxs)(nt,{title:e("herdr.title"),children:[E.map(Q=>Q.kind==="toggle"?(0,Dt.jsx)(Ui,{label:Q.label,selected:l===Q.id,onSelect:()=>{s(Q.id),S(Q.id)},onHover:()=>s(Q.id),children:(0,Dt.jsx)(x,{color:i.herdr.autoStart?k.ok:k.muted,children:i.herdr.autoStart?`[\xD7] ${e("common.on")}`:`[ ] ${e("common.off")}`})},Q.id):Q.kind==="field"?(0,Dt.jsx)(Ui,{label:Q.label,selected:l===Q.id,onSelect:()=>S(Q.id),onHover:()=>s(Q.id),children:(0,Dt.jsx)(Ji,{value:Ho(i,Q.id),placeholder:A.t(Ia(i,Q.id)),active:r===Q.id,onSubmit:p=>{d(Q.id,p)&&A.setEditing(null)},onCancel:()=>A.setEditing(null)})},Q.id):(0,Dt.jsx)(X,{marginTop:1,children:(0,Dt.jsx)(xe,{selected:l===Q.id,onSelect:()=>{s(Q.id),S(Q.id)},onHover:()=>s(Q.id),children:Q.label})},Q.id)),l==="herdrAutoStart"?(0,Dt.jsx)(X,{marginTop:1,children:(0,Dt.jsx)(x,{color:k.muted,children:e("herdr.autoStartHint")})}):null,A.dirty?(0,Dt.jsx)(X,{marginTop:1,children:(0,Dt.jsx)(x,{color:k.warn,children:e("hint.unsavedChanges")})}):null,(0,Dt.jsxs)(X,{marginTop:1,flexDirection:"column",children:[u?.version?(0,Dt.jsx)(et,{label:e("herdr.version"),children:(0,Dt.jsxs)(X,{children:[(0,Dt.jsx)(Ai,{level:u.supported?"ok":"warn"}),(0,Dt.jsx)(x,{children:` ${u.version}`})]})}):null,u?.version&&!u.supported?(0,Dt.jsx)(x,{color:k.warn,children:e("herdr.versionOutdated",{version:u.version,minimum:yg})}):null,u&&!u.ok?(0,Dt.jsx)(x,{color:k.warn,children:e("herdr.cliMissing")}):null]}),(0,Dt.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}var Gt=iA(ye(),1),qo=iA(EA(),1);function Hy({ctx:A}){let{t:e,draft:i}=A,[r,l]=(0,qo.useState)("auto"),[s,u]=(0,qo.useState)({phase:"idle"}),f=(0,qo.useState)(()=>({current:{source:""}}))[0],E=yl({preference:"auto"}),d=[{id:"auto",label:e("about.languageAuto",{detected:E})},{id:"zh",label:e("about.languageZh")},{id:"en",label:e("about.languageEn")}],h=pg(),S=(()=>{switch(s.phase){case"checking":return e("update.checking");case"current":return e("update.upToDate",{version:s.latest});case"available":return e("update.available",{version:s.latest});case"updating":return s.attempt>1?e("update.updatingRetry",{version:s.latest,attempt:s.attempt}):e("update.updating",{version:s.latest});case"done":return e("update.done",{version:s.latest});case"error":return e(s.messageKey,s.params);default:return e("update.check")}})(),Q=[...d,{id:"update",label:S}],p=J=>{f.current={source:J.source??""},u(J.updateAvailable?{phase:"available",latest:J.latest}:{phase:"current",latest:J.latest})};(0,qo.useEffect)(()=>{A.updateCheck?.ok&&s.phase==="idle"&&p(A.updateCheck)},[A.updateCheck]);let D=async()=>{u({phase:"checking"});let J=await Dl();if(!J.ok){u({phase:"error",messageKey:J.errorKey??"update.errorNetwork"});let{message:G}=J;G&&A.notify(q=>q("update.errorNetworkDetail",{message:G}),"error");return}A.setUpdateCheck(J),p(J)},v=async J=>{u({phase:"updating",latest:J,attempt:1});let G=await wg(A.config,()=>mg({source:f.current.source,version:J,onAttempt:({attempt:q})=>u({phase:"updating",latest:J,attempt:q})}));if(!G.ok){let q={version:J,installed:G.installed??"",url:lg(J)};u({phase:"error",messageKey:G.errorKey??"update.errorFailed",params:q}),A.notify(V=>G.summary?V("update.errorFailedDetail",{message:G.summary}):V(G.errorKey??"update.errorFailed",q),"error");return}u({phase:"done",latest:J}),A.setUpdateCheck(null),A.notify(q=>q("update.restartHint"),"success")},N=()=>{if(!(s.phase==="checking"||s.phase==="updating")){if(s.phase==="available"){if(!h){u({phase:"error",messageKey:`update.cannot.${Qg()}`});return}v(s.latest);return}D()}},L=J=>{let G=dn(i,"language",J),{errorKey:q}=G;if(q){A.notify(V=>V(q),"error");return}A.updateDraft(G.draft);try{Qn(G.draft),A.reloadConfig(),A.notify(V=>V("common.saved",{path:vn()}),"success")}catch(V){A.notify(fA=>fA("error.saveFailed",{message:V.message}),"error")}},uA=J=>{if(J==="update"){N();return}L(J)};return mt((J,G)=>{let q=Q.findIndex(V=>V.id===r);G.upArrow?l(Q[(q-1+Q.length)%Q.length].id):G.downArrow?l(Q[(q+1)%Q.length].id):G.return&&uA(r)},{isActive:A.editingId===null}),(0,Gt.jsxs)(nt,{title:e("about.title"),children:[(0,Gt.jsx)(x,{color:k.muted,children:e("about.language")}),(0,Gt.jsx)(X,{flexDirection:"column",marginTop:1,marginBottom:1,children:d.map(J=>(0,Gt.jsx)(xe,{selected:r===J.id,onSelect:()=>{l(J.id),L(J.id)},onHover:()=>l(J.id),children:`${J.label}${i.ui.language===J.id?" \u2713":""}`},J.id))}),(0,Gt.jsx)(x,{color:k.muted,children:e("update.title")}),(0,Gt.jsx)(X,{flexDirection:"column",marginTop:1,marginBottom:1,children:(0,Gt.jsx)(xe,{selected:r==="update",onSelect:()=>{l("update"),N()},onHover:()=>l("update"),children:S})}),(0,Gt.jsx)(et,{label:e("about.version"),children:(0,Gt.jsx)(x,{color:k.muted,children:Cg()})}),ag(A.config)?(0,Gt.jsx)(et,{label:e("about.relayPackage"),children:(0,Gt.jsx)(x,{color:k.muted,children:dg()??"?"})}):null,(0,Gt.jsx)(et,{label:e("about.configPath"),children:(0,Gt.jsx)(x,{color:k.muted,children:vn()})}),(0,Gt.jsx)(et,{label:e("about.statePath"),children:(0,Gt.jsx)(x,{color:k.muted,children:og()})}),(0,Gt.jsx)(X,{marginTop:1,children:(0,Gt.jsx)(x,{color:k.muted,children:e("about.docs")})}),(0,Gt.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}var pA=iA(ye(),1),ni=iA(EA(),1);function fI(A,e){let i=["language","access"];return A==="lan"&&i.push("address"),A==="remote"&&e!==Ri&&i.push("relayUrl","password"),i.push("finish"),i}function EI({ctx:A,onDone:e}){let{t:i,draft:r}=A,[l,s]=(0,ni.useState)("language"),[u,f]=(0,ni.useState)(A.runtime.relayPassword||""),[E,d]=(0,ni.useState)(!0),[h,S]=(0,ni.useState)(!0),[Q,p]=(0,ni.useState)("startNow"),D=(0,ni.useMemo)(()=>Sl({includeLoopback:!1}),[]),v=(0,ni.useMemo)(()=>fI(r.relay.mode,r.relay.remoteUrl),[r.relay.mode,r.relay.remoteUrl]),N=Math.max(0,v.indexOf(l)),L=AA=>{let oA=r;for(let[OA,FA]of AA){let rt=dn(oA,OA,FA),{errorKey:PA}=rt;if(PA)return A.notify(qA=>qA(PA),"error"),!1;oA=rt.draft}return A.updateDraft(oA),A.notify("","info"),!0},uA=(AA,oA)=>L([[AA,oA]]),J=(AA,oA=v)=>{let OA=oA.indexOf(AA);s(oA[Math.min(oA.length-1,OA+1)])},G=()=>{let AA=v.indexOf(l);AA>0&&s(v[AA-1])},q=()=>{A.run(async()=>{r.relay.mode==="remote"&&gr(u),Qn(r),A.reloadConfig();let AA=Zn(),oA=!1;if(h)try{Mn.detectManager(AA.keepalive.manager)==="windows-service"&&A.notify(OA=>OA("keepalive.serviceWindowHint"),"info"),await Mn.install(AA),oA=!0}catch(OA){OA.code==="ELEVATION_CANCELLED"?A.notify(FA=>FA("keepalive.elevationCancelled"),"info"):A.notify(FA=>FA("keepalive.failed",{message:OA.message}),"error")}E&&!oA&&Rl(AA),e()})},V=(0,pA.jsxs)(X,{flexDirection:"column",marginBottom:1,children:[(0,pA.jsx)(x,{bold:!0,children:i("wizard.title")}),(0,pA.jsx)(x,{color:k.muted,children:i("wizard.step",{current:N+1,total:v.length})})]});if(l==="language")return(0,pA.jsxs)(nt,{title:i("wizard.languageTitle"),children:[V,(0,pA.jsx)(Yi,{options:[{id:"auto",label:i("about.languageAuto",{detected:A.locale})},{id:"zh",label:i("about.languageZh")},{id:"en",label:i("about.languageEn")}],current:r.ui.language,onPick:AA=>{uA("language",AA)&&J("language")},onCancel:()=>{}}),(0,pA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]});if(l==="access")return(0,pA.jsxs)(nt,{title:i("wizard.accessTitle"),children:[V,(0,pA.jsx)(Yi,{options:[...["local","lan"].map(AA=>({id:AA,label:i(`mode.${AA}`),description:i(`mode.${AA}.description`)})),{id:"official",label:i("mode.official"),description:i("mode.official.description")},{id:"remote",label:i("mode.remote"),description:i("mode.remote.description")}],current:mr(r),onPick:AA=>{if(AA==="official"){if(!uA("mode","official"))return;gr(""),J("access",fI("remote",Ri));return}uA("mode",AA)&&J("access",fI(AA,AA==="remote"?"":r.relay.remoteUrl))},onCancel:G}),(0,pA.jsx)(X,{marginTop:1,children:(0,pA.jsx)(x,{color:k.muted,children:i("wizard.accessHint")})}),(0,pA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]});if(l==="address")return(0,pA.jsxs)(nt,{title:i("wizard.addressTitle"),children:[V,D.length===0?(0,pA.jsxs)(X,{flexDirection:"column",children:[(0,pA.jsx)(x,{color:k.warn,children:i("relay.noAddresses")}),(0,pA.jsx)(X,{marginTop:1,children:(0,pA.jsx)(xe,{selected:!0,onSelect:()=>J("address"),children:i("wizard.finish")})}),(0,pA.jsx)(aG,{onSkip:()=>J("address"),onBack:G})]}):(0,pA.jsx)(Yi,{options:D.map(AA=>({id:AA.address,label:`${AA.address} (${AA.name}, ${AA.kind})`})),current:r.relay.lanHost||D[0].address,onPick:AA=>{uA("lanHost",AA)&&J("address")},onCancel:G}),(0,pA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]});if(l==="relayUrl")return(0,pA.jsxs)(nt,{title:i("wizard.relayTitle"),children:[V,(0,pA.jsx)(Ui,{label:i("wizard.relayUrlLabel"),selected:!0,onSelect:()=>{},children:(0,pA.jsx)(Ji,{value:r.relay.remoteUrl,placeholder:"wss://relay.example.com",active:!0,onSubmit:AA=>{if(!AA){A.notify(oA=>oA("error.remoteUrlRequired"),"error");return}uA("remoteUrl",AA)&&J("relayUrl")},onCancel:G})}),(0,pA.jsx)(X,{marginTop:1,children:(0,pA.jsx)(x,{color:k.muted,children:i("wizard.relayHint")})}),(0,pA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]});if(l==="password")return(0,pA.jsxs)(nt,{title:i("wizard.passwordTitle"),children:[V,(0,pA.jsx)(Ui,{label:i("relay.password"),selected:!0,onSelect:()=>{},children:(0,pA.jsx)(Ji,{value:u,placeholder:i("relay.passwordEmpty"),active:!0,mask:!0,onSubmit:AA=>{f(AA),J("password")},onCancel:G})}),(0,pA.jsx)(X,{marginTop:1,children:(0,pA.jsx)(x,{color:k.muted,children:i("wizard.passwordHint")})}),(0,pA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]});let fA=[{id:"startNow",label:`${i("wizard.startNow")} [${E?"\xD7":" "}]`},{id:"installKeepalive",label:`${i("wizard.installKeepalive")} [${h?"\xD7":" "}]`},{id:"finish",label:i("wizard.finish")}],TA=AA=>{if(AA==="startNow"){d(oA=>!oA);return}if(AA==="installKeepalive"){S(oA=>!oA);return}q()};return(0,pA.jsxs)(nt,{title:i("wizard.finishTitle"),children:[V,(0,pA.jsx)(lG,{items:fA.map(AA=>AA.id),selected:Q,onSelect:p,onActivate:TA,onBack:G}),fA.map(AA=>(0,pA.jsx)(xe,{selected:Q===AA.id,onSelect:()=>{p(AA.id),TA(AA.id)},onHover:()=>p(AA.id),children:AA.label},AA.id)),(0,pA.jsx)(X,{marginTop:1,children:(0,pA.jsx)(x,{color:k.muted,children:i("wizard.finishHint",{path:vn()})})}),(0,pA.jsx)(yt,{text:A.message?.text??null,level:A.message?.level??"info"})]})}function lG({items:A,selected:e,onSelect:i,onActivate:r,onBack:l}){return mt((s,u)=>{let f=Math.max(0,A.indexOf(e));u.escape?l():u.upArrow?i(A[(f-1+A.length)%A.length]):u.downArrow?i(A[(f+1)%A.length]):u.return&&r(e)}),null}function aG({onSkip:A,onBack:e}){return mt((i,r)=>{r.return?A():r.escape&&e()}),null}var sG=3e3,ii=[{id:"overview",labelKey:"nav.overview"},{id:"pair",labelKey:"nav.pair"},{id:"services",labelKey:"nav.services"},{id:"relay",labelKey:"nav.relay"},{id:"keepalive",labelKey:"nav.keepalive"},{id:"herdr",labelKey:"nav.herdr"},{id:"about",labelKey:"nav.about"}];function uG({label:A,active:e,onSelect:i}){let r=(0,zA.useRef)(null),l=Ea(r,{onClick:i});return(0,it.jsx)(X,{ref:r,marginRight:2,children:(0,it.jsx)(x,{color:e||l?k.accent:k.muted,bold:e,underline:e||l,children:A})})}function cG({hints:A}){return(0,it.jsx)(X,{marginTop:1,paddingX:1,children:(0,it.jsx)(x,{color:k.muted,children:A.join(" \xB7 ")})})}function II({initialLanguage:A,needsWizard:e,updateChecker:i=hg()?Dl:null}){let{exit:r}=sE(),l=nm(),[s,u]=(0,zA.useState)(()=>Zn()),[f,E]=(0,zA.useState)(()=>Nu()),[d,h]=(0,zA.useState)(()=>ml()),[S,Q]=(0,zA.useState)(null),[p,D]=(0,zA.useState)("overview"),[v,N]=(0,zA.useState)(null),[L,uA]=(0,zA.useState)(!1),[J,G]=(0,zA.useState)(null),[q,V]=(0,zA.useState)(!e),[fA,TA]=(0,zA.useState)(null);(0,zA.useEffect)(()=>{if(!i)return;let hA=!1;return i().then(LA=>{!hA&&LA?.ok&&TA(LA)}).catch(()=>{}),()=>{hA=!0}},[i]);let AA=(0,zA.useMemo)(()=>yl({preference:A??f.ui.language}),[A,f.ui.language]),oA=(0,zA.useMemo)(()=>Ig(AA),[AA]),OA=(0,zA.useMemo)(()=>JSON.stringify(s)!==JSON.stringify(f),[s,f]),FA=(0,zA.useMemo)(()=>OA&&pE(s,f),[s,f,OA]),rt=(0,zA.useCallback)((hA,LA="info")=>{N({notice:hA,level:LA})},[]),PA=v&&{text:typeof v.notice=="string"?v.notice:v.notice(oA),level:v.level},qA=(0,zA.useCallback)(()=>{vg(Zn()).then(hA=>Q(hA)).catch(hA=>rt(hA.message,"error"))},[rt]),$t=(0,zA.useCallback)(()=>{let hA=Zn();u(hA),E(Nu(hA)),h(ml())},[]),$e=(0,zA.useCallback)(hA=>{uA(!0),Promise.resolve().then(hA).catch(LA=>rt(LA.message,"error")).finally(()=>{uA(!1),qA()})},[rt,qA]);(0,zA.useEffect)(()=>{if(!q)return;qA();let hA=setInterval(()=>{J||qA()},sG);return()=>clearInterval(hA)},[q,qA,J]);let mA=(0,zA.useRef)(null);(0,zA.useEffect)(()=>{mA.current===null&&l.supported&&!l.enabled&&l.enable()},[l.supported,l.enabled,l]);let ot={t:oA,locale:AA,config:s,draft:f,status:S,runtime:d,busy:L,dirty:OA,editingId:J,updateDraft:E,reloadConfig:$t,setEditing:G,notify:rt,run:$e,refresh:qA,message:PA,updateCheck:fA,setUpdateCheck:TA};if(mt((hA,LA)=>{if(LA.ctrl&&hA==="c"){r();return}if(hA==="q"){r();return}if(hA==="r"){N(null),qA();return}if(hA==="m"){if(!l.supported){rt($A=>$A("hint.mouseUnsupported"),"info");return}mA.current=!l.enabled,l.enabled?l.disable():l.enable();return}let An=ii.findIndex($A=>$A.id===p);if(LA.rightArrow||LA.tab&&!LA.shift){D(ii[(An+1)%ii.length].id);return}if(LA.leftArrow||LA.tab&&LA.shift){D(ii[(An-1+ii.length)%ii.length].id);return}let bt=Number.parseInt(hA,10);Number.isInteger(bt)&&bt>=1&&bt<=ii.length&&D(ii[bt-1].id)},{isActive:q&&J===null}),!q)return(0,it.jsx)(EI,{ctx:ot,onDone:()=>{$t(),V(!0),qA()}});let Ee=[oA("hint.navigate"),oA("hint.select"),oA("hint.tabs"),OA?oA("hint.save"):null,l.supported?l.enabled?oA("hint.mouseOn"):oA("hint.mouseOff"):oA("hint.mouseUnsupported"),oA("hint.quit")].filter(Boolean);return(0,it.jsxs)(X,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,it.jsxs)(X,{marginBottom:1,flexDirection:"column",children:[(0,it.jsxs)(X,{children:[(0,it.jsx)(x,{bold:!0,children:oA("app.name")}),(0,it.jsx)(x,{color:k.muted,children:` ${oA("app.tagline")}`})]}),fA?.updateAvailable?(0,it.jsx)(x,{color:k.warn,children:oA("update.banner",{latest:fA.latest??"",current:fA.current})}):null]}),(0,it.jsx)(X,{marginBottom:1,children:ii.map((hA,LA)=>(0,it.jsx)(uG,{label:`${LA+1} ${oA(hA.labelKey)}`,active:hA.id===p,onSelect:()=>D(hA.id)},hA.id))}),p==="overview"?(0,it.jsx)(Em,{ctx:ot}):null,p==="pair"?(0,it.jsx)(Ry,{ctx:ot}):null,p==="services"?(0,it.jsx)(My,{ctx:ot}):null,p==="relay"?(0,it.jsx)(Gy,{ctx:ot}):null,p==="keepalive"?(0,it.jsx)(by,{ctx:ot}):null,p==="herdr"?(0,it.jsx)(Uy,{ctx:ot}):null,p==="about"?(0,it.jsx)(Hy,{ctx:ot}):null,FA?(0,it.jsx)(X,{marginTop:1,children:(0,it.jsx)(x,{color:k.warn,children:oA("hint.restartRequired")})}):null,(0,it.jsx)(cG,{hints:Ee})]})}var Ju="\x1B",gG=`${Ju}[?1049h${Ju}[H`,fG=`${Ju}[?1049l`,EG=`${Ju}[?25h`;function xy(A=process.stdout){try{A.write(gG)}catch{}}function Ly(A=process.stdout){try{A.write(`${Ru}${EG}${fG}`)}catch{}}async function j_({language:A=null}={}){let e=!cg(),i=EE(process.stdin,process.stdout);xy();let r=oE((0,BI.jsx)(em,{source:i,children:(0,BI.jsx)(II,{initialLanguage:A,needsWizard:e})}),{stdin:i.stdin,exitOnCtrlC:!1}),l=()=>{i.dispose(),Ly()},s=()=>{r.unmount(),l(),process.exit(0)};process.once("SIGINT",s),process.once("SIGTERM",s),process.once("exit",l);try{await r.waitUntilExit()}finally{l(),process.off("SIGINT",s),process.off("SIGTERM",s)}}export{II as App,EI as Wizard,j_ as startTui};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{b as T,c as F,e as S}from"./
|
|
3
|
+
import{b as T,c as F,e as S}from"./QL4I7VLD.js";import{i as U,j as K,k as x}from"./QOPTXTL7.js";import"./B6LZOIKD.js";import"./5RGV2MW6.js";import"./JJGEV4EZ.js";import"./IONXNA5T.js";import"./ZAAEQP3M.js";import"./U6QAYG3E.js";import"./PDOEV4QJ.js";import"./4CO2WAXZ.js";import{a as h}from"./HRFNURKU.js";import{a as A,h as R,j as v}from"./ETEPTJGZ.js";import{o as B}from"./37NKZLLR.js";import"./KRVF37OW.js";import"./QRGNEKME.js";import{t as b}from"./SWVUDSHP.js";import"./TNLCNVA2.js";import"./I6NRCYLI.js";import{spawnSync as N}from"node:child_process";var O=12e4;function W(){let e=N(process.execPath,[h(),"restart","--json"],{encoding:"utf8",timeout:O,windowsHide:!0});if(!e.error&&e.status===0)return{ok:!0,message:""};let i=String(e.stderr||e.stdout||"").trim();return{ok:!1,message:e.error?.message||i||`exit ${e.status}`}}async function Z(e,i={}){let u=()=>i.config??B(),{platform:l=process.platform,checkCli:C=()=>R(),installCli:D=(r,p)=>v({source:r.source,version:r.latest,onAttempt:p}),isRunning:E=()=>S(u()),stop:I=()=>F(u()),start:P=()=>T(u()),restartInstalled:_=W,stopBroker:M=U,startBroker:$=async()=>{try{K(e)}catch{}return x()},report:t=r=>process.stdout.write(`${r}
|
|
4
4
|
`)}=i;t(e("update.checking"));let o=await C(),{current:a}=o;if(!o.ok)return t(e("update.errorNetworkDetail",{message:o.message??""})),{ok:!1,current:a,updated:null,restarted:!1,errorKey:o.errorKey};if(!o.updateAvailable)return t(e("update.upToDate",{version:a})),{ok:!0,current:a,updated:null,restarted:!1};let c="cli",n=o.latest??"",m=E(),f=l==="win32"&&m;f&&(t(e("update.stoppingServices")),I());let d=l==="win32"?await M():"unavailable",k=async()=>{if(d!=="stopped")return d==="busy"?"busy":null;let r=await $();return t(e(r?"update.brokerRestarted":"update.brokerRestartFailed")),r?"restarted":"failed"};t(e("update.updating",{version:n}));let s=await D(o,({attempt:r})=>{r>1&&t(e("update.updatingRetry",{version:n,attempt:r}))});if(!s.ok){f&&P();let r=await k();t(e(s.errorKey??"update.errorFailed",{version:n,installed:s.installed??"",url:b(n)})),s.summary&&t(e("update.errorFailedDetail",{message:s.summary})),l==="win32"&&A(s.output)&&t(e("update.errorBusy"));let{errorKey:p,summary:H}=s;return{ok:!1,current:a,updated:c,restarted:!1,adminBroker:r,errorKey:p,summary:H}}let g=s.installed??n;t(e("update.done",{version:g}));let y=!0,w=!1;if(!m)t(e("update.notRunning"));else{t(e("update.restarting"));let r=_();y=r.ok,w=r.ok,t(r.ok?e("services.restarted"):e("update.restartFailed",{message:r.message}))}d==="busy"&&t(e("update.brokerBusy"));let j=await k();return{ok:y,current:a,updated:c,installed:g,restarted:w,adminBroker:j}}export{Z as runUpdate};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{g as c,h as s}from"./
|
|
3
|
+
import{g as c,h as s}from"./4CO2WAXZ.js";import{a as i}from"./HRFNURKU.js";import"./ETEPTJGZ.js";import"./QRGNEKME.js";import"./SWVUDSHP.js";import"./TNLCNVA2.js";import"./I6NRCYLI.js";import{spawn as a}from"node:child_process";function d(r){return new Promise((e,n)=>{r.once("error",n),r.once("close",o=>e(o??1))})}function l({action:r,nodePath:e,entryPoint:n}){let o=c,t=`"${n}" admin-broker ${r} --elevated`;return`$ErrorActionPreference = 'Stop'
|
|
4
4
|
try {
|
|
5
5
|
$process = Start-Process -FilePath '${o(e)}' -ArgumentList '${o(t)}' -Verb RunAs -Wait -PassThru -WindowStyle Hidden
|
|
6
6
|
} catch {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{n as g,p}from"./
|
|
3
|
+
import{n as g,p}from"./ETEPTJGZ.js";import"./SWVUDSHP.js";import{a as s}from"./TNLCNVA2.js";import"./I6NRCYLI.js";import m from"node:fs";import c from"node:path";import{spawnSync as h}from"node:child_process";var d="herdr.remote.web",S="herdr-plugin.toml";function w(){return c.join(s,S)}function a(t,{timeout:r=15e3}={}){let e=h(g(),t,{encoding:"utf8",timeout:r,windowsHide:!0});if(e.error?.code==="ENOENT")throw Object.assign(new Error("herdr command not found"),{code:"HERDR_NOT_FOUND"});return e}function b(t){let r=[];for(let e of String(t||"").split(`
|
|
4
4
|
`)){let n=/^-\s+(\S+)\s+\((.*?)\)\s+(\S+)(?:\s+\[(.*)\])?/.exec(e.trim());if(!n)continue;let[,f,i,o,l]=n,u=l?l.split(";")[0].trim():null;r.push({id:f,name:i,enabled:o==="enabled",source:u,warnings:l?.includes(";")?l.slice(l.indexOf(";")+1).trim():null,localPath:u?.startsWith("local:")?u.slice(6):null})}return r}function k(){if(!m.existsSync(w()))return{available:!1,registered:!1,reason:"manifest missing"};let{version:t,supported:r}=p(),e={version:t,versionSupported:r},n;try{n=a(["plugin","list"])}catch(o){if(o.code==="HERDR_NOT_FOUND")return{available:!1,registered:!1,reason:"herdr not found"};throw o}if(n.status!==0)return{available:!0,registered:!1,reason:String(n.stderr||"").trim(),...e};let i=b(n.stdout).find(o=>o.id===d);return i?{available:!0,registered:!0,enabled:i.enabled,linkedPath:i.localPath,stale:i.localPath?c.resolve(i.localPath)!==c.resolve(s):!1,packageRoot:s,...e}:{available:!0,registered:!1,packageRoot:s,...e}}function _(){let t=k();t.registered&&t.stale&&a(["plugin","unlink",d]);let r=a(["plugin","link",s]);if(r.status!==0)throw new Error(String(r.stderr||r.stdout||"").trim()||"herdr plugin link failed");return{ok:!0,path:s,output:String(r.stdout||"").trim()}}function R(){let t=a(["plugin","unlink",d]);if(t.status!==0)throw new Error(String(t.stderr||t.stdout||"").trim()||"herdr plugin unlink failed");return{ok:!0,output:String(t.stdout||"").trim()}}export{b as parsePluginList,_ as register,k as registrationStatus,R as unregister};
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{a as y,b as A}from"./chunks/
|
|
3
|
+
import{a as y,b as A}from"./chunks/KEUAW3VO.js";import{f as S,h as w}from"./chunks/5RGV2MW6.js";import"./chunks/U6QAYG3E.js";import{f as m,l as v,n as $,o as k}from"./chunks/37NKZLLR.js";import"./chunks/KRVF37OW.js";import"./chunks/QRGNEKME.js";import"./chunks/SWVUDSHP.js";import{a as d,c as h,d as g}from"./chunks/TNLCNVA2.js";import"./chunks/I6NRCYLI.js";import U from"node:fs";import P from"node:os";import u from"node:path";var j=JSON.parse(U.readFileSync(u.join(d,"package.json"),"utf8")).version,f=`herdr-remote ${j} \u2014 browser access to Herdr workspaces
|
|
4
4
|
|
|
5
5
|
Usage: herdr-remote [command] [options]
|
|
6
6
|
|
|
@@ -28,10 +28,10 @@ Options:
|
|
|
28
28
|
Self-hosting: docs/self-hosted-relay.md
|
|
29
29
|
`;function E(r){let s=[],t={};for(let l=0;l<r.length;l+=1){let n=r[l];if(n==="--json"){t.json=!0;continue}if(n==="--daemon"){t.daemon=!0;continue}if(n==="--elevated"){t.elevated=!0;continue}if(n==="--help"||n==="-h"){t.help=!0;continue}if(n==="--version"||n==="-v"){t.version=!0;continue}if(n==="--lang"){t.lang=r[l+1],l+=1;continue}if(n.startsWith("--lang=")){t.lang=n.slice(7);continue}if(n.startsWith("-")){t.unknown=n;continue}s.push(n)}return{positional:s,flags:t}}function o(r){process.stdout.write(`${JSON.stringify(r,null,2)}
|
|
30
30
|
`)}function b(r,s){let t=[];if(t.push(`${s("overview.mode")}: ${s(`mode.${r.mode}`)}`),r.relay.local?t.push(`${s("overview.relay")}: ${r.relay.alive?s("common.running"):s("common.stopped")} (${r.relay.bind}:${r.relay.port})`):t.push(`${s("overview.relay")}: ${r.relay.remoteUrl}`),t.push(`${s("overview.host")}: ${r.host.alive?s("common.running"):s("common.stopped")}`),t.push(`${s("overview.socket")}: ${r.host.socketPath}${r.host.socketExists?"":` (${s("overview.socketMissing")})`}`),t.push(`${s("overview.webUrl")}: ${r.publicUrl}`),r.keepalive){let l=r.keepalive.active?s("common.running"):r.keepalive.installed?s("common.installed"):s("common.notInstalled");t.push(`${s("overview.keepalive")}: ${r.keepalive.manager} \u2014 ${l}`)}return r.relay.health&&r.relay.health.ok===!1&&t.push(`${s("overview.relay")}: ${s("overview.unreachable",{message:r.relay.health.message??""})}`),t.join(`
|
|
31
|
-
`)}async function B(r){let{startTui:s}=await import("./chunks/
|
|
31
|
+
`)}async function B(r){let{startTui:s}=await import("./chunks/QP6NLV4R.js");await s(r)}async function O(r=process.argv.slice(2)){if(r[0]==="open-link"){let{runLinkShim:e}=await import("./chunks/67FHQKXM.js");process.exitCode=await e(r.slice(1));return}let{positional:s,flags:t}=E(r);if(process.platform==="win32"){let e=u.relative(d,process.cwd());(e===""||e!==".."&&!e.startsWith(`..${u.sep}`)&&!u.isAbsolute(e))&&process.chdir(P.homedir())}let l=s[0]||null;if(t.help){process.stdout.write(f);return}if(t.version){process.stdout.write(`${j}
|
|
32
32
|
`);return}if(t.unknown){process.stderr.write(`herdr-remote: unknown option "${t.unknown}"
|
|
33
33
|
|
|
34
|
-
${f}`),process.exitCode=2;return}$(),await(await import("./chunks/S4TW5MHM.js")).captureTerminalPalette(),(await import("./chunks/CUXGXJMW.js")).captureTerminalFont();let n=k(),C=t.lang&&v.includes(t.lang)?t.lang:n.ui.language,a=A(y({preference:C})),c=await import("./chunks/
|
|
34
|
+
${f}`),process.exitCode=2;return}$(),await(await import("./chunks/S4TW5MHM.js")).captureTerminalPalette(),(await import("./chunks/CUXGXJMW.js")).captureTerminalFont();let n=k(),C=t.lang&&v.includes(t.lang)?t.lang:n.ui.language,a=A(y({preference:C})),c=await import("./chunks/N3C7MVSO.js"),T=await import("./chunks/GZIFCN7B.js");switch(l){case null:{if(process.stdin.isTTY&&process.stdout.isTTY){await B({language:t.lang||null});return}o(await c.fullStatus(n));return}case"start":{let e=c.startAll(n);t.json?o(e):process.stdout.write(`${a("services.started")}
|
|
35
35
|
${b(await c.fullStatus(n),a)}
|
|
36
36
|
`);return}case"stop":{let e=c.stopAll(n);t.json?o(e):process.stdout.write(`${a("services.stopped")}
|
|
37
37
|
`);return}case"restart":{let e=c.restartAll(n);t.json?o(e):process.stdout.write(`${a("services.restarted")}
|
|
@@ -40,7 +40,7 @@ ${b(await c.fullStatus(n),a)}
|
|
|
40
40
|
${a("pair.url")}: ${p}
|
|
41
41
|
${a("pair.expires",{minutes:x,time:new Date(e.expiresAt).toLocaleTimeString()})}
|
|
42
42
|
`);return}case"url":{process.stdout.write(`${m(n,w())}
|
|
43
|
-
`);return}case"update":{let{runUpdate:e}=await import("./chunks/
|
|
43
|
+
`);return}case"update":{let{runUpdate:e}=await import("./chunks/VSBBDPSE.js"),i=await e(a,{config:n,...t.json?{report:()=>{}}:{}});t.json&&o(i),i.ok||(process.exitCode=1);return}case"run":{let{runForeground:e}=await import("./chunks/54QMQDOL.js");await e({logToFiles:!!t.daemon});return}case"admin-broker":{let e=await import("./connector/admin-broker.js"),i=s[1]||"status";if(i==="install")e.installAdminBroker(a),o({installed:!0,available:await e.waitForAdminBroker()});else if(i==="uninstall")e.uninstallAdminBroker(a),o({installed:!1});else if(i==="restart"){if(await e.stopAdminBroker()==="busy")throw new Error(a("adminBroker.busy"));e.startAdminBrokerTask(a),o({available:await e.waitForAdminBroker()})}else if(i==="status")o({available:await e.adminBrokerStatus()});else throw new Error(`unknown administrator broker action: ${i}`);return}case"admin-shell":{let{runAdminShell:e}=await import("./chunks/KUDVTWG4.js");process.exitCode=await e(a);return}case"keepalive":{let e=await import("./chunks/NYAKZHLQ.js"),i=s[1]||"status";if(i==="install"&&t.elevated){let{completeServiceInstall:p}=await import("./chunks/D3LUHIKR.js");process.exitCode=await p(a)}else if(i==="install")o(await e.install(n));else if(i==="uninstall")o(await e.uninstall(n));else if(i==="restart")o(e.restart(n));else if(i==="status")o(e.status(n));else throw new Error(`unknown keepalive action: ${i}`);return}case"plugin":{let e=await import("./chunks/ZUTRSLCH.js"),i=s[1]||"status";if(i==="link")o(e.register());else if(i==="unlink")o(e.unregister());else if(i==="status")o(e.registrationStatus());else throw new Error(`unknown plugin action: ${i}`);return}case"config":{o({configPath:g(),stateDir:h(),config:n});return}default:process.stderr.write(`herdr-remote: unknown command "${l}"
|
|
44
44
|
|
|
45
45
|
${f}`),process.exitCode=2}}function M(){O().catch(r=>{process.stderr.write(`herdr-remote: ${r.message}
|
|
46
46
|
`),process.exitCode=1})}export{b as describeStatus,E as parseArgs,M as run};
|
package/dist/connector/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
2
|
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
import{c as Se}from"../chunks/
|
|
3
|
+
import{c as Se}from"../chunks/ODOBBR6N.js";import"../chunks/C2UUZY6J.js";import{a as Ee,b as ke,d as Ie}from"../chunks/HDHNFESR.js";import"../chunks/KEUAW3VO.js";import{a as _}from"../chunks/QOPTXTL7.js";import{a as u}from"../chunks/7SMZ43LI.js";import{a as pe,b as ye,c as ge,d as I}from"../chunks/JJGEV4EZ.js";import{a as _e,d as M,e as be,i as we}from"../chunks/IONXNA5T.js";import{m as Te}from"../chunks/ZAAEQP3M.js";import"../chunks/U6QAYG3E.js";import"../chunks/HRFNURKU.js";import{b as ae,e as ce,g as T,h as le,i as he,n as de,o as ue,p as k,q as fe,r as me}from"../chunks/ETEPTJGZ.js";import{h as te,i as re,o as se}from"../chunks/37NKZLLR.js";import{b as ie,c as oe}from"../chunks/KRVF37OW.js";import{a as g,d as ne}from"../chunks/QRGNEKME.js";import{a as Y,b as W,c as X,i as q,k as y,l as j,m as J,n as Q,o as Z,p as ee}from"../chunks/SWVUDSHP.js";import{a as G,c as p}from"../chunks/TNLCNVA2.js";import"../chunks/I6NRCYLI.js";import Ut from"node:os";import Be from"node:path";import ve from"node:crypto";import b from"node:fs";import N from"node:path";var Xe=20,qe=50*1024*1024,je=1440*60*1e3;function Ae(){let s=N.join(p(),"pasted");return g(s),s}function v({dir:s=Ae(),maxFiles:e=Xe,maxBytes:t=qe,maxAgeMs:r=je,now:n=Date.now()}={}){let i;try{i=b.readdirSync(s,{withFileTypes:!0})}catch{return}let o=[];for(let h of i){if(!h.isFile())continue;let l=N.join(s,h.name);try{let c=b.statSync(l);if(n-c.mtimeMs>r){try{b.unlinkSync(l)}catch{}continue}o.push({path:l,size:c.size,mtimeMs:c.mtimeMs})}catch{}}o.sort((h,l)=>h.mtimeMs-l.mtimeMs);let a=o.reduce((h,l)=>h+l.size,0);for(;o.length>e||a>t;){let h=o.shift();if(!h)break;try{b.unlinkSync(h.path),a-=h.size}catch{}}}function He({mime:s,dataBase64:e,name:t,dir:r=Ae()}){let n=Z(s)?s:null;if(!n&&s!==j)throw new Error(`unsupported MIME type: ${s}`);if(typeof e!="string")throw new Error("missing or invalid dataBase64 payload");let i=Buffer.from(e,"base64");if(i.length>3145728)throw new Error(`file size (${i.length} bytes) exceeds maximum limit of 3 MB`);if(i.length===0)throw new Error("file payload is empty");if(n&&!ee(n,i))throw new Error(`file magic bytes do not match declared MIME type ${s}`);v({dir:r});let o=n?`${ve.randomUUID()}${Q[n]}`:`${ve.randomUUID()}-${J(t)}`,a=N.join(r,o);b.writeFileSync(a,i,{mode:384,flag:"wx"});try{b.chmodSync(a,384)}catch{}return v({dir:r}),a}var S=["blocked","done","working","idle","unknown"];function Pe(s,e=48){if(typeof s!="string")return null;let t=s.replace(/[\u0000-\u001F\u007F-\u009F]/g," ").replace(/\s+/g," ").trim();return t?t.length>e?t.slice(0,e):t:null}function Je(s){return S.includes(s)?s:"unknown"}function Qe(){return Object.fromEntries(S.map(s=>[s,0]))}function Fe(s){let e=Array.isArray(s?.agents)?s.agents:[],t=Array.isArray(s?.panes)?s.panes:[],r=typeof s?.focused_pane_id=="string"&&s.focused_pane_id?s.focused_pane_id:null,n=(r?t.find(c=>c?.pane_id===r):t.find(c=>c?.focused===!0))||null,i=(r?e.find(c=>c?.pane_id===r):e.find(c=>c?.focused===!0))||null,o=r||(typeof n?.pane_id=="string"?n.pane_id:null)||(typeof i?.pane_id=="string"?i.pane_id:null),a=typeof n?.agent=="string"?n.agent:typeof i?.agent=="string"?i.agent:null,h=Qe(),l=[];for(let c of e){if(!c||typeof c.pane_id!="string")continue;let d=Je(c.agent_status);h[d]+=1,l.push({paneId:c.pane_id,workspaceId:typeof c.workspace_id=="string"?c.workspace_id:null,agent:Pe(c.display_agent||c.agent,24),title:Pe(c.terminal_title_stripped||c.terminal_title),status:d,focused:c.focused===!0})}return l.sort((c,d)=>S.indexOf(c.status)-S.indexOf(d.status)),{focusedPaneId:o,focusedAgent:a,counts:h,total:l.length,agents:l.slice(0,16)}}function Oe(s,e){if(!s||!e)return s===e;if(s.focusedPaneId!==e.focusedPaneId||s.focusedAgent!==e.focusedAgent||s.total!==e.total)return!1;for(let t of S)if((s.counts?.[t]||0)!==(e.counts?.[t]||0))return!1;return s.agents.length!==e.agents.length?!1:s.agents.every((t,r)=>{let n=e.agents[r];return n&&t.paneId===n.paneId&&t.status===n.status&&t.agent===n.agent&&t.title===n.title})}var Ze=5e3,et=150,tt=[{type:"pane.focused"},{type:"tab.focused"},{type:"workspace.focused"},{type:"pane.agent_detected"}],A=class{socketPath;request;subscribe;send;pollTimer=null;debounceTimer=null;subscription=null;pending=!1;stale=!1;lastSummary=null;constructor(e,t){this.socketPath=e.socketPath,this.request=e.requestHerdr||Ee,this.subscribe=e.subscribeHerdr||ke,this.send=t}start(){if(!this.pollTimer){this.pollTimer=setInterval(()=>this.read(),Ze),this.pollTimer.unref?.();try{this.subscription=this.subscribe(this.socketPath,tt,()=>this.scheduleRead(),{onStarted:()=>this.scheduleRead()})}catch{}this.read()}}stop(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null),this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.subscription&&(this.subscription.close(),this.subscription=null),this.stale=!1,this.lastSummary=null}scheduleRead(){this.pollTimer&&(this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.read()},et),this.debounceTimer.unref?.())}async read(){if(!this.pollTimer)return;if(this.pending){this.stale=!0;return}this.pending=!0,this.stale=!1;let e;try{let r=await this.request(this.socketPath,"session.snapshot",{});e=r?.snapshot||r}catch{return}finally{this.pending=!1,this.stale&&this.scheduleRead()}if(!this.pollTimer)return;let t=Fe(e);Oe(this.lastSummary,t)||(this.lastSummary=t,this.send({type:"agent_status",...t}))}};import ct from"node:crypto";import lt from"node:fs";import{createRequire as rt}from"node:module";import D from"node:fs";import st from"node:path";var nt=6e4,it=16384,ot=1,R=null;function at(){if(!R){let s=st.join(G,"dist","harfbuzz-subset.wasm"),e=D.existsSync(s)?s:rt(import.meta.url).resolve("harfbuzzjs/dist/harfbuzz-subset.wasm");R=new WebAssembly.Module(D.readFileSync(e))}return R}var H=class{idleMs;instance=null;faces=new Map;idleTimer=null;constructor({idleMs:e=nt}={}){this.idleMs=e}exports(){return this.instance||(this.instance=new WebAssembly.Instance(at(),{}).exports,this.instance._initialize()),this.instance}face(e){let t=`${e.path}\0${e.index||0}`,r=this.faces.get(t);if(r)return r.face;let n=this.exports(),i=D.readFileSync(e.path),o=n.malloc(i.length);if(!o)throw new Error("out of memory loading font");new Uint8Array(n.memory.buffer).set(i,o);let a=n.hb_blob_create(o,i.length,ot,0,0),h=n.hb_face_create(a,e.index||0);return n.hb_blob_destroy(a),this.faces.set(t,{pointer:o,face:h}),h}subset(e,t){let r=this.exports(),n=this.face(e),i=r.hb_subset_input_create_or_fail();if(!i)throw new Error("font subsetting is unavailable");let o=0,a=0;try{let h=r.hb_subset_input_unicode_set(i);for(let d of t.slice(0,it))r.hb_set_add(h,d);if(a=r.hb_subset_or_fail(n,i),!a)throw new Error("the font could not be subset");o=r.hb_face_reference_blob(a);let l=r.hb_blob_get_length(o),c=r.hb_blob_get_data(o,0);return Buffer.from(new Uint8Array(r.memory.buffer,c,l))}finally{o&&r.hb_blob_destroy(o),a&&r.hb_face_destroy(a),r.hb_subset_input_destroy(i),this.scheduleRelease()}}scheduleRelease(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>this.release(),this.idleMs),this.idleTimer.unref?.()}release(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null,this.faces.clear(),this.instance=null}};var ht=48*1024*1024,Le="The terminal font changed or is no longer on this workstation",F=class{font;load;subsetter;subsets=new Map;send;constructor(e,t){this.load=e.loadTerminalFont||we,this.font=e.terminalFont!==void 0?e.terminalFont:this.load(),this.subsetter=e.fontSubsetter||new H,this.send=t}publicFont(){return M(this.font)}pickUp(){if(this.font)return;let e=null;try{e=this.load()}catch{return}e&&(this.font=e,this.send({type:"terminal_font",terminalFont:M(e)}))}refresh(){try{let e=this.load({refresh:!0});e&&(this.font=e)}catch(e){process.stderr.write(`herdr-remote host connector: could not read the terminal font: ${e.message}
|
|
4
4
|
`)}this.send({type:"terminal_font",terminalFont:this.publicFont()})}sendChunk(e,t){let r=this.subsetChunk(t.sha256,t.index)||be(this.font,t.sha256,t.index);if(!r){this.send({type:"error",clientId:e,code:"host_font_unavailable",message:Le});return}this.send({type:"host_font_chunk",clientId:e,sha256:t.sha256,index:t.index,total:r.total,dataBase64:r.data.toString("base64")})}sendSubset(e,t){let r=(l,c)=>this.send({type:"error",clientId:e,code:l,message:c}),n=this.font?.subsets?.find(l=>l.sha256===t.sha256);if(!n||!this.unchanged(n)){r("host_font_unavailable",Le);return}let i=[...new Set(Array.from(String(t.text||""),l=>l.codePointAt(0)))],o;try{o=this.subsetter.subset(n,i)}catch(l){r("host_font_subset_failed",l.message||"The font could not be subset");return}let a=ct.createHash("sha256").update(o).digest("hex"),h={type:"host_font_subset_ready",clientId:e,requestId:t.requestId,sha256:n.sha256,subsetSha:a,bytes:o.length};o.length<=262144?h.dataBase64=o.toString("base64"):this.hold(a,o),this.send(h)}unchanged(e){try{let t=lt.statSync(e.path);return t.size===e.bytes&&t.mtimeMs===e.mtimeMs}catch{return!1}}hold(e,t){this.subsets.delete(e),this.subsets.set(e,t);let r=[...this.subsets.values()].reduce((n,i)=>n+i.length,0);for(let[n,i]of this.subsets){if(r<=ht||n===e)break;this.subsets.delete(n),r-=i.length}}subsetChunk(e,t){let r=this.subsets.get(e);if(!r)return null;let n=Math.ceil(r.length/262144);if(!Number.isInteger(t)||t<0||t>=n)return null;let i=t*262144;return{data:r.subarray(i,i+262144),total:n}}};import ft from"node:os";import dt from"node:fs";var Ce=["ctrl+b"];function xe(s=process.env,e=process.platform){let t;try{t=dt.readFileSync(pe(s,e),"utf8")}catch{return[...Ce]}let r=_e(t)["keys.prefix"];return q(typeof r=="string"?[r]:r)??[...Ce]}function Me(s){return{type:"host_hello",protocol:1,hostId:s.hostId,token:s.token,password:s.password||null,hostname:ft.hostname(),platform:process.platform,...process.platform==="win32"&&(process.env.MSYSTEM||/(?:^|[\\/])(?:bash|sh)(?:\.exe)?$/i.test(process.env.SHELL||""))?{shellProfile:"git-bash"}:{},arch:process.arch,version:s.version,terminalPalette:s.terminalPalette||null,terminalFont:s.terminalFont,herdrPrefixKeys:xe(),capabilities:[y.hostHandoff,y.idleHeartbeat,y.binaryFrameV2,y.pasteAnyFile,...process.platform==="win32"?[y.adminTabs]:[]]}}import w from"node:fs";import mt from"node:path";function Re(s){try{return JSON.parse(w.readFileSync(s,"utf8"))}catch{return null}}function Ne(s,e){let t=new Error(s);return t.code=e,t}function De(s,e){g(mt.dirname(s));for(let t=0;t<2;t+=1)try{let r=w.openSync(s,"wx",384);return w.writeFileSync(r,`${JSON.stringify({pid:process.pid,processStart:ie(process.pid),hostId:e,startedAt:new Date().toISOString()})}
|
|
5
5
|
`),r}catch(r){if(r.code!=="EEXIST")throw r;let n=Re(s);if(n&&oe([n]).length>0)throw Ne(`another host connector is already running (pid ${n.pid})`,"HOST_ALREADY_RUNNING");try{w.rmSync(s,{force:!0})}catch{}}throw Ne("could not acquire host connector lock","HOST_LOCK_FAILED")}function Ue(s,e){try{w.closeSync(e)}catch{}let t=Re(s);if(!(t&&t.pid!==process.pid))try{w.rmSync(s,{force:!0})}catch{}}import O from"node:fs";import pt from"node:net";import yt from"node:path";import{spawn as gt,spawnSync as _t}from"node:child_process";var bt=1e3,wt=2e4,Tt=200,St=["EPERM","EACCES"],Et="0.9.4",kt=/S-1-16-(?:12288|16384)\b/;function It(s,e){return e!=="win32"||!St.includes(s.code||"")?{state:"unavailable",reason:s.message}:{state:"unavailable",elevated:!0,reason:`Herdr is running as administrator and refuses clients that are not. Start Herdr from an ordinary terminal, or set allow_unelevated_clients = true under [server] in its config.toml and restart its server. (${s.message})`}}function U(s,{connect:e=pt.connect,timeout:t=bt,platform:r=process.platform}={}){let n=I(s);return n.ok?new Promise(i=>{let o,a=l=>{clearTimeout(h),o&&(o.removeAllListeners(),o.on("error",()=>{}),o.destroy()),i(l)},h=setTimeout(()=>a({state:"running"}),t);typeof h.unref=="function"&&h.unref(),o=e(ye(s,r)),o.once("connect",()=>a({state:"running"})),o.once("error",l=>a(l.code==="ECONNREFUSED"||l.code==="ENOENT"?{state:"stopped",stale:!0}:It(l,r)))}):Promise.resolve(n.missing?{state:"stopped"}:{state:"unavailable",reason:n.reason})}function vt({platform:s=process.platform,readCgroup:e=()=>O.readFileSync("/proc/self/cgroup","utf8")}={}){if(s!=="linux")return!1;try{let t=e().split(`
|
|
6
6
|
`).find(r=>r.startsWith("0::"));return t!==void 0&&/\.service$/.test(t.trim())}catch{return!1}}function At({platform:s=process.platform,whoamiGroups:e=()=>_t("whoami",["/groups","/fo","csv","/nh"],{encoding:"utf8",windowsHide:!0}).stdout||""}={}){if(s!=="win32")return!1;try{return kt.test(e())}catch{return!1}}function Ht(s,e=At()){if(!e)return!1;let{version:t}=k({command:s});return t!==null&&T(t,Et)>=0}function Pt(s,e=process.env){let t={...e};for(let r of Object.keys(t))r.startsWith("HERDR_")&&delete t[r];return s&&(t.HERDR_SOCKET_PATH=s),t}function Ft({command:s,args:e=[],inService:t=vt(),allowUnelevated:r=!1}){let n=[s,...e,"server",...r?["--allow-unelevated-clients"]:[]];return t?{file:"systemd-run",args:["--user","--scope","--quiet","--collect","--description=Herdr server started by herdr-remote","--",...n]}:{file:n[0],args:n.slice(1)}}function Ot({command:s,args:e=[],socketPath:t,cwd:r,logPath:n,spawnProcess:i=gt,inService:o,allowUnelevated:a=Ht(s)}){let{file:h,args:l}=Ft({command:s,args:e,inService:o,allowUnelevated:a});g(yt.dirname(n));let c=O.openSync(n,"a"),d;try{d=i(h,l,{cwd:r,env:Pt(t),detached:!0,windowsHide:!0,stdio:["ignore",c,c]})}finally{O.closeSync(c)}return d.on("error",()=>{}),d.unref(),d}function Lt(s,e=2e3){try{return O.readFileSync(s,"utf8").slice(-e).trim()}catch{return""}}async function $e({command:s,args:e=[],socketPath:t,cwd:r,logPath:n,probe:i=U,launch:o=Ot,timeout:a=wt,interval:h=Tt}){let l=await i(t);if(l.state==="running")return{started:!1};if(l.state==="unavailable")throw new Error(`Herdr socket at ${t} cannot be used: ${l.reason}`);let c=o({command:s,args:e,socketPath:t,cwd:r,logPath:n}),d=null;c.once("exit",(z,E)=>{d={code:z,signal:E}});let Ge=Date.now()+a;for(;;){if(await new Promise(Ye=>setTimeout(Ye,h)),(await i(t)).state==="running")return{started:!0};let E=Lt(n),K=E?`
|
package/herdr-plugin.toml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
id = "herdr.remote.web"
|
|
2
2
|
name = "Herdr Remote Web"
|
|
3
|
-
version = "0.3.
|
|
4
|
-
min_herdr_version = "0.9.
|
|
3
|
+
version = "0.3.36"
|
|
4
|
+
min_herdr_version = "0.9.5"
|
|
5
5
|
description = "Browser access to Herdr workspaces via local or self-hosted relay"
|
|
6
6
|
platforms = ["linux", "macos", "windows"]
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "herdr-remote",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.36",
|
|
4
4
|
"description": "Browser access to Herdr workspaces: plugin, host connector, and configuration TUI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"README.zh-CN.md"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"herdr-remote-relay": "0.3.
|
|
39
|
+
"herdr-remote-relay": "0.3.36",
|
|
40
40
|
"node-pty": "^1.1.0"
|
|
41
41
|
},
|
|
42
42
|
"bundleDependencies": [
|
package/dist/chunks/QLOMG2U7.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __herdrCreateRequire } from 'node:module';
|
|
2
|
-
const require = __herdrCreateRequire(import.meta.url);
|
|
3
|
-
var m={"app.name":"Herdr Remote","app.tagline":"Remote browser access to Herdr workspaces","common.yes":"Yes","common.no":"No","common.on":"on","common.off":"off","common.none":"none","common.auto":"auto","common.unknown":"unknown","common.running":"running","common.stopped":"stopped","common.connected":"connected","common.disconnected":"disconnected","common.installed":"installed","common.notInstalled":"not installed","common.enabled":"enabled","common.disabled":"disabled","common.loading":"Working\u2026","common.save":"Save settings","common.saved":"Configuration saved to {path}","common.back":"Back","common.cancel":"Cancel","common.confirm":"Confirm","common.pid":"pid {pid}","common.notApplicable":"n/a","nav.overview":"Overview","nav.pair":"Pair a device","nav.services":"Services","nav.relay":"Relay","nav.keepalive":"Keep-alive","nav.herdr":"Herdr","nav.about":"Language & about","mode.local":"This machine only","mode.lan":"Local network / Tailscale","mode.official":"Official relay","mode.remote":"Self-hosted relay","mode.local.description":"Relay listens on 127.0.0.1. Local browser only.","mode.lan.description":"Relay listens on 0.0.0.0. Accessible over LAN or Tailscale.","mode.official.description":"Connect via official relay. No server needed.","mode.remote.description":"Connect via self-hosted relay for external access.","overview.title":"Status","overview.mode":"Access mode","overview.relay":"Relay","overview.host":"Host connector","overview.socket":"Herdr socket","overview.webUrl":"Web UI","overview.keepalive":"Keep-alive","overview.devices":"Browsers","overview.hosts":"Workstations","overview.uptime":"Relay uptime","overview.relayLocal":"local, {bind}:{port}","overview.relayRemote":"remote, {url}","overview.socketMissing":"not found \u2014 is Herdr running?","overview.unreachable":"unreachable: {message}","overview.notStarted":"Services not running. Open Services tab to start.","pair.title":"Pair a device","pair.generate":"Generate pairing code","pair.regenerate":"Regenerate code","pair.working":"Generating pairing code\u2026","pair.code":"Pairing code","pair.url":"Access URL","pair.expires":"Expires in {minutes} (at {time})","pair.expired":"Code expired. Generate a new one.","pair.instructions":"Open URL and enter code to pair.","pair.qrHint":"Scan QR code to open URL.","pair.qrUnavailable":"Terminal too narrow for QR code; use URL above.","pair.failed":"Could not create pairing code: {message}","pair.hostOffline":"Relay has no workstation connected. Start services first.","services.title":"Services","services.start":"Start services","services.stop":"Stop services","services.restart":"Restart services","services.started":"Services started.","services.stopped":"Services stopped.","services.restarted":"Services restarted.","services.startFailed":"Could not start services: {message}","services.stopFailed":"Could not stop services: {message}","services.unsavedBlocked":"Unsaved changes. Save before restarting.","services.managedNotice":"Managed by {manager}; applied via keep-alive service.","services.logs":"Recent logs","services.logEmpty":"No logs.","services.logRelay":"Relay","services.logHost":"Host connector","adminBroker.windowsOnly":"The administrator terminal broker only runs on Windows.","adminBroker.needsElevation":"Open the Windows TUI and choose Set up admin terminal access. Approve the one-time Windows prompt under the same account as Herdr Remote.","adminBroker.busy":"An admin terminal is open; close it before restarting the broker.","adminBroker.title":"Admin terminal broker","adminBroker.checking":"Checking\u2026","adminBroker.ready":"Ready","adminBroker.notReady":"Not configured or stopped","adminBroker.install":"Set up admin terminal access","adminBroker.uninstall":"Remove admin terminal access","adminBroker.installDone":"Admin terminal broker setup task registered.","adminBroker.uninstallDone":"Admin terminal broker setup task removed.","adminBroker.elevationCancelled":"Administrator approval was declined; no changes were made.","adminBroker.setupFailed":"Could not configure the administrator terminal broker.","adminBroker.tuiHint":"Set this up once. Windows asks for administrator approval; later WebUI admin terminals open without UAC.","adminShell.needsTerminal":"admin-shell must run in a terminal.","adminShell.brokerUnavailable":"The administrator terminal broker is not running. Open the herdr-remote TUI, go to Keep-alive, and choose Set up admin terminal access.","adminShell.tabLabel":"Admin","relay.title":"Relay settings","relay.settings":"Settings","relay.locked":"fixed","relay.officialFixed":"The official relay address is fixed and cannot be edited.","relay.officialHint":"Official relay: address is fixed and no password is needed.","relay.password":"Relay password","relay.passwordHint":"Must match RELAY_PASSWORD on relay. Leave empty if public.","relay.passwordSet":"set","relay.passwordEmpty":"not set (public)","relay.passwordSaved":"Relay password saved. Restart services to apply.","relay.showPassword":"Show password","relay.hidePassword":"Hide password","relay.identity":"Workstation ID","relay.regenerate":"Generate new ID","relay.regenerated":"New workstation identity generated. Restart services to re-register.","relay.envSnippet":"Relay startup command","relay.envHint":"Run this command on the relay host.","relay.test":"Test relay connection","relay.testOk":"Relay reachable: version {version}, {hosts} workstation(s) connected.","relay.testFailed":"Relay unreachable: {message}","relay.selectAddress":"Choose advertised address","relay.listenAddress":"Listen address","relay.listenAddressHint":"Server bind address. Browsers use advertised address below.","relay.addressTailscale":"Tailscale","relay.addressLan":"LAN","relay.addressVirtual":"virtual","relay.addressLoopback":"loopback","relay.noAddresses":"No non-loopback addresses found.","relay.docsHint":"Self-hosting guide: docs/self-hosted-relay.md","keepalive.title":"Keep-alive service","keepalive.manager":"Manager","keepalive.state":"State","keepalive.install":"Install and start","keepalive.uninstall":"Stop and remove","keepalive.restart":"Restart service","keepalive.installed":"Keep-alive installed with {manager}.","keepalive.uninstalled":"Keep-alive removed.","keepalive.restarted":"Keep-alive service restarted.","keepalive.failed":"Keep-alive operation failed: {message}","keepalive.unitPath":"Unit file","keepalive.logsHint":"View logs: {command}","keepalive.linger":"Start at boot","keepalive.lingerEnabled":"Start at boot enabled.","keepalive.lingerDisabled":"Start at boot disabled (runs while logged in).","keepalive.enableLinger":"Enable start at boot","keepalive.lingerDone":"Start at boot enabled for {username}.","keepalive.fallbackNote":"No system service manager found; background process will not survive reboot.","keepalive.windowsTaskNote":"Starts after you sign in as your account. It needs no password or administrator rights and does not run before sign-in.","keepalive.serviceNote":"Runs as a Windows service under your account and starts before sign-in. Installing or removing it asks for administrator rights, and Windows may require your account password.","keepalive.serviceWindowHint":"Finish the installation in the administrator window that opens.","keepalive.elevationCancelled":"Administrator rights were not granted; nothing was installed.","keepalive.passwordPrompt":"Windows account password for {account} (not a PIN; press Enter if there is no password):","keepalive.passwordRejected":"Windows could not start the service with those credentials. Check the account password and service logon policy.","keepalive.serviceInstalled":"Service {id} is installed and running.","keepalive.wrongAccount":"Run this as the account that will use herdr-remote, not another administrator account.","keepalive.pressEnter":"Press Enter to close this window.","herdr.title":"Herdr integration","herdr.socketPath":"Socket path","herdr.args":"Extra arguments","herdr.autoStartHint":"Off: Herdr starts only when you run it, or when you confirm it from a browser. On: herdr-remote also starts it every time it starts, at boot included. Takes effect the next time herdr-remote starts.","herdr.cliMissing":"Command herdr not found. Set HERDR_BIN_PATH to its full path.","herdr.version":"Herdr version","herdr.versionOutdated":'Herdr {version} is older than {minimum}. Run "herdr update": window titles, large pastes, taps on a pane, Alt shortcuts and typing over a slow link misbehave in browser windows before that release.',"about.title":"Language & about","about.language":"Interface language","about.languageAuto":"Follow system ({detected})","about.languageZh":"\u4E2D\u6587","about.languageEn":"English","about.version":"Version","about.configPath":"Config file","about.statePath":"State directory","about.relayPackage":"Relay package","about.docs":"Self-hosting guide: docs/self-hosted-relay.md","wizard.title":"First-time setup","wizard.step":"Step {current} of {total}","wizard.languageTitle":"Choose language","wizard.accessTitle":"Access mode","wizard.accessHint":"Can be changed later in Relay settings.","wizard.addressTitle":"Browser access address","wizard.relayTitle":"Relay server","wizard.relayUrlLabel":"Relay URL (wss://\u2026)","wizard.relayHint":"Relay must be running. See docs/self-hosted-relay.md.","wizard.passwordTitle":"Relay password","wizard.passwordHint":"RELAY_PASSWORD of the relay. Leave empty if unset.","wizard.finishTitle":"Finish","wizard.finishHint":"Configuration will be saved to {path}.","wizard.startNow":"Start services now","wizard.installKeepalive":"Run in background","wizard.finish":"Save and finish","field.mode":"Access mode","field.port":"Relay port","field.lanHost":"Browser address","field.remoteUrl":"Relay URL","field.publicUrl":"Browser URL override","field.socketPath":"Herdr socket path","field.herdrArgs":"Herdr arguments","field.herdrAutoStart":"Auto-start Herdr","field.language":"Language","field.keepalive":"Keep-alive manager","placeholder.autoDiscovered":"auto-discovered","placeholder.none":"none","error.invalidMode":"Unknown access mode.","error.invalidPort":"Port must be a number between 1 and 65535.","error.invalidLanHost":"Browser address must be a reachable LAN or Tailscale address, not loopback or 0.0.0.0.","error.invalidRelayUrl":"Relay URL must start with wss://, ws://, https:// or http://.","error.invalidPublicUrl":"Browser URL must start with https:// or http:// and cannot use 0.0.0.0 or ::.","error.invalidLanguage":"Unknown language.","error.invalidKeepalive":"Unknown keep-alive manager.","error.unknownField":"Unknown setting.","error.remoteUrlRequired":"Relay URL is required for self-hosted relay mode.","error.removedHerdrArg":"Herdr 0.9.0 removed --no-session; remove it from the extra arguments.","error.saveFailed":"Could not save configuration: {message}","hint.navigate":"\u2191\u2193 move","hint.select":"\u21B5 select","hint.edit":"\u21B5 edit","hint.tabs":"\u2190 \u2192 switch tab","hint.back":"esc back","hint.quit":"q quit","hint.mouseOn":"m mouse off","hint.mouseOff":"m mouse on","hint.mouseUnsupported":"mouse unsupported","hint.restartRequired":"Restart services to apply changes.","hint.unsavedChanges":"Unsaved changes (press s to save).","hint.save":"s save","hint.editing":"\u21B5 confirm \xB7 esc cancel","update.title":"Updates","update.banner":"herdr-remote {latest} is out (running {current}). Press 7 and Enter on the update row to install.","update.check":"Check for updates","update.checking":"Checking GitHub Releases\u2026","update.upToDate":"Up to date ({version})","update.available":"Update {version} available (press Enter to install)","update.updating":"Installing {version}\u2026","update.updatingRetry":"Installing {version}\u2026 (npm has not caught up yet, attempt {attempt})","update.done":"Updated to {version}","update.restartHint":"Update installed. Restart herdr-remote to apply.","update.errorNetwork":"Could not reach GitHub Releases, nor any npm registry as a fallback","update.errorNetworkDetail":"Nothing answered: {message}","update.errorFailed":"Update failed. Run: npm install -g {url}","update.errorFailedDetail":"Installer: {message}","update.errorNotYetPublished":"npm has not caught up with {version} yet (common in the first minutes after a release). Press Enter to try again shortly.","update.errorNotApplied":"The install reported success, but {installed} is still installed","update.cannot.source":"Source checkout \u2014 update with git","update.cannot.linked":"Linked package \u2014 managed by npm link","update.stoppingServices":"Stopping services while their files are replaced\u2026","update.restarting":"Restarting services on the new release\u2026","update.notRunning":"Services were not running and were left stopped. Start them with: herdr-remote start","update.restartFailed":"Installed, but the services did not restart: {message}","update.brokerRestarted":"Admin terminal broker restarted.","update.brokerRestartFailed":"The admin terminal broker did not start again. Sign out of Windows and back in, or run herdr-remote admin-broker restart.","update.brokerBusy":"An admin terminal is open, so the broker keeps running the previous release. Close admin terminals, then run herdr-remote admin-broker restart.","update.errorBusy":"A process still holds the herdr-remote folder; an admin terminal broker set up by an older release does. In an administrator PowerShell run: Get-ScheduledTask -TaskName 'HerdrRemoteAdminBroker-*' | Stop-ScheduledTask. Then run herdr-remote update again here, and afterwards herdr-remote admin-broker install as administrator."},l=m;var u={"app.name":"Herdr Remote","app.tagline":"\u5728\u6D4F\u89C8\u5668\u4E2D\u4F7F\u7528 Herdr \u5DE5\u4F5C\u533A","common.yes":"\u662F","common.no":"\u5426","common.on":"\u5F00","common.off":"\u5173","common.none":"\u65E0","common.auto":"\u81EA\u52A8","common.unknown":"\u672A\u77E5","common.running":"\u8FD0\u884C\u4E2D","common.stopped":"\u5DF2\u505C\u6B62","common.connected":"\u5DF2\u8FDE\u63A5","common.disconnected":"\u672A\u8FDE\u63A5","common.installed":"\u5DF2\u5B89\u88C5","common.notInstalled":"\u672A\u5B89\u88C5","common.enabled":"\u5DF2\u542F\u7528","common.disabled":"\u5DF2\u505C\u7528","common.loading":"\u5904\u7406\u4E2D\u2026","common.save":"\u4FDD\u5B58\u8BBE\u7F6E","common.saved":"\u914D\u7F6E\u5DF2\u4FDD\u5B58\u81F3 {path}","common.back":"\u8FD4\u56DE","common.cancel":"\u53D6\u6D88","common.confirm":"\u786E\u8BA4","common.pid":"PID {pid}","common.notApplicable":"\u4E0D\u9002\u7528","nav.overview":"\u6982\u89C8","nav.pair":"\u914D\u5BF9\u8BBE\u5907","nav.services":"\u670D\u52A1","nav.relay":"Relay","nav.keepalive":"\u4FDD\u6D3B","nav.herdr":"Herdr","nav.about":"\u8BED\u8A00\u4E0E\u5173\u4E8E","mode.local":"\u4EC5\u672C\u673A","mode.lan":"\u5C40\u57DF\u7F51 / Tailscale","mode.official":"\u5B98\u65B9 Relay","mode.remote":"\u81EA\u5EFA Relay","mode.local.description":"\u76D1\u542C 127.0.0.1\uFF0C\u4EC5\u672C\u673A\u53EF\u8BBF\u95EE\u3002","mode.lan.description":"\u76D1\u542C 0.0.0.0\uFF0C\u5C40\u57DF\u7F51\u4E0E Tailscale \u8BBE\u5907\u53EF\u8BBF\u95EE\u3002","mode.official.description":"\u4F7F\u7528\u5B98\u65B9 Relay \u8DE8\u7F51\u8BBF\u95EE\uFF0C\u65E0\u9700\u81EA\u5EFA\u670D\u52A1\u5668\u3002","mode.remote.description":"\u8FDE\u63A5\u81EA\u5EFA Relay \u8DE8\u7F51\u8BBF\u95EE\u3002","overview.title":"\u72B6\u6001","overview.mode":"\u8BBF\u95EE\u65B9\u5F0F","overview.relay":"Relay","overview.host":"\u4E3B\u673A\u8FDE\u63A5\u5668","overview.socket":"Herdr \u5957\u63A5\u5B57","overview.webUrl":"Web \u754C\u9762","overview.keepalive":"\u4FDD\u6D3B\u670D\u52A1","overview.devices":"\u6D4F\u89C8\u5668","overview.hosts":"\u5DE5\u4F5C\u7AD9","overview.uptime":"Relay \u8FD0\u884C\u65F6\u95F4","overview.relayLocal":"\u672C\u5730\uFF0C{bind}:{port}","overview.relayRemote":"\u8FDC\u7A0B\uFF0C{url}","overview.socketMissing":"\u672A\u627E\u5230\uFF0C\u8BF7\u786E\u8BA4 Herdr \u662F\u5426\u8FD0\u884C","overview.unreachable":"\u65E0\u6CD5\u8BBF\u95EE\uFF1A{message}","overview.notStarted":"\u670D\u52A1\u672A\u8FD0\u884C\uFF0C\u53EF\u524D\u5F80\u300C\u670D\u52A1\u300D\u542F\u52A8\u3002","pair.title":"\u914D\u5BF9\u8BBE\u5907","pair.generate":"\u751F\u6210\u914D\u5BF9\u7801","pair.regenerate":"\u91CD\u65B0\u751F\u6210","pair.working":"\u751F\u6210\u914D\u5BF9\u7801\u4E2D\u2026","pair.code":"\u914D\u5BF9\u7801","pair.url":"\u8BBF\u95EE\u5730\u5740","pair.expires":"\u5269\u4F59 {minutes}\uFF08\u81F3 {time}\uFF09","pair.expired":"\u914D\u5BF9\u7801\u5DF2\u8FC7\u671F\uFF0C\u9700\u91CD\u65B0\u751F\u6210\u3002","pair.instructions":"\u6253\u5F00\u94FE\u63A5\u5E76\u8F93\u5165\u914D\u5BF9\u7801\u3002","pair.qrHint":"\u626B\u63CF\u4E8C\u7EF4\u7801\u6253\u5F00\u94FE\u63A5\u3002","pair.qrUnavailable":"\u7EC8\u7AEF\u5BBD\u5EA6\u4E0D\u8DB3\uFF0C\u65E0\u6CD5\u663E\u793A\u4E8C\u7EF4\u7801\u3002","pair.failed":"\u751F\u6210\u914D\u5BF9\u7801\u5931\u8D25\uFF1A{message}","pair.hostOffline":"Relay \u672A\u8FDE\u63A5\u5DE5\u4F5C\u7AD9\uFF0C\u9700\u5148\u542F\u52A8\u670D\u52A1\u3002","services.title":"\u670D\u52A1","services.start":"\u542F\u52A8\u670D\u52A1","services.stop":"\u505C\u6B62\u670D\u52A1","services.restart":"\u91CD\u542F\u670D\u52A1","services.started":"\u670D\u52A1\u5DF2\u542F\u52A8\u3002","services.stopped":"\u670D\u52A1\u5DF2\u505C\u6B62\u3002","services.restarted":"\u670D\u52A1\u5DF2\u91CD\u542F\u3002","services.startFailed":"\u542F\u52A8\u670D\u52A1\u5931\u8D25\uFF1A{message}","services.stopFailed":"\u505C\u6B62\u670D\u52A1\u5931\u8D25\uFF1A{message}","services.unsavedBlocked":"\u914D\u7F6E\u672A\u4FDD\u5B58\uFF0C\u8BF7\u5148\u4FDD\u5B58\u518D\u91CD\u542F\u3002","services.managedNotice":"\u7531 {manager} \u6258\u7BA1\uFF0C\u5DF2\u901A\u8FC7\u4FDD\u6D3B\u670D\u52A1\u6267\u884C\u3002","services.logs":"\u6700\u8FD1\u65E5\u5FD7","services.logEmpty":"\u6682\u65E0\u65E5\u5FD7\u3002","services.logRelay":"Relay","services.logHost":"\u4E3B\u673A\u8FDE\u63A5\u5668","adminBroker.windowsOnly":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u53EA\u652F\u6301 Windows\u3002","adminBroker.needsElevation":"\u8BF7\u6253\u5F00 Windows TUI \u5E76\u9009\u62E9\u201C\u8BBE\u7F6E\u7BA1\u7406\u5458\u7EC8\u7AEF\u201D\uFF0C\u4F7F\u7528\u8FD0\u884C Herdr Remote \u7684\u540C\u4E00\u8D26\u6237\u6279\u51C6\u4E00\u6B21 Windows \u63D0\u6743\u63D0\u793A\u3002","adminBroker.busy":"\u6709\u7BA1\u7406\u5458\u7EC8\u7AEF\u5F00\u7740\uFF0C\u8BF7\u5148\u5173\u95ED\u518D\u91CD\u542F broker\u3002","adminBroker.title":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker","adminBroker.checking":"\u6B63\u5728\u68C0\u67E5\u2026","adminBroker.ready":"\u5DF2\u5C31\u7EEA","adminBroker.notReady":"\u5C1A\u672A\u8BBE\u7F6E\u6216\u672A\u8FD0\u884C","adminBroker.install":"\u8BBE\u7F6E\u7BA1\u7406\u5458\u7EC8\u7AEF","adminBroker.uninstall":"\u79FB\u9664\u7BA1\u7406\u5458\u7EC8\u7AEF\u8BBE\u7F6E","adminBroker.installDone":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u4EFB\u52A1\u5DF2\u6CE8\u518C\u3002","adminBroker.uninstallDone":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u4EFB\u52A1\u5DF2\u79FB\u9664\u3002","adminBroker.elevationCancelled":"\u672A\u6279\u51C6\u7BA1\u7406\u5458\u6743\u9650\uFF0C\u672A\u8FDB\u884C\u66F4\u6539\u3002","adminBroker.setupFailed":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u8BBE\u7F6E\u5931\u8D25\u3002","adminBroker.tuiHint":"\u53EA\u9700\u8BBE\u7F6E\u4E00\u6B21\u3002Windows \u4F1A\u8BF7\u6C42\u7BA1\u7406\u5458\u6388\u6743\uFF1B\u4E4B\u540E WebUI \u65B0\u5EFA\u7BA1\u7406\u5458\u7EC8\u7AEF\u4E0D\u518D\u5F39\u51FA UAC\u3002","adminShell.needsTerminal":"admin-shell \u5FC5\u987B\u5728\u7EC8\u7AEF\u4E2D\u8FD0\u884C\u3002","adminShell.brokerUnavailable":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u5C1A\u672A\u8FD0\u884C\u3002\u8BF7\u6253\u5F00 herdr-remote TUI\uFF0C\u8FDB\u5165\u300C\u4FDD\u6D3B\u300D\u5E76\u9009\u62E9\u300C\u8BBE\u7F6E\u7BA1\u7406\u5458\u7EC8\u7AEF\u300D\u3002","adminShell.tabLabel":"\u7BA1\u7406\u5458","relay.title":"Relay \u8BBE\u7F6E","relay.settings":"\u8BBE\u7F6E","relay.locked":"\u56FA\u5B9A","relay.officialFixed":"\u5B98\u65B9 relay \u5730\u5740\u56FA\u5B9A\uFF0C\u4E0D\u53EF\u4FEE\u6539\u3002","relay.officialHint":"\u5B98\u65B9 relay\uFF1A\u5730\u5740\u56FA\u5B9A\uFF0C\u65E0\u9700\u5BC6\u7801\u3002","relay.password":"Relay \u5BC6\u7801","relay.passwordHint":"\u987B\u4E0E Relay \u7AEF\u7684 RELAY_PASSWORD \u4E00\u81F4\u3002\u7559\u7A7A\u4E3A\u516C\u7528 Relay\u3002","relay.passwordSet":"\u5DF2\u8BBE\u7F6E","relay.passwordEmpty":"\u672A\u8BBE\u7F6E\uFF08\u516C\u7528\uFF09","relay.passwordSaved":"Relay \u5BC6\u7801\u5DF2\u4FDD\u5B58\uFF0C\u91CD\u542F\u670D\u52A1\u751F\u6548\u3002","relay.showPassword":"\u663E\u793A\u5BC6\u7801","relay.hidePassword":"\u9690\u85CF\u5BC6\u7801","relay.identity":"\u5DE5\u4F5C\u7AD9\u6807\u8BC6","relay.regenerate":"\u91CD\u65B0\u751F\u6210\u6807\u8BC6","relay.regenerated":"\u5DF2\u751F\u6210\u65B0\u6807\u8BC6\uFF0C\u91CD\u542F\u540E\u91CD\u65B0\u6CE8\u518C\u3002","relay.envSnippet":"Relay \u542F\u52A8\u547D\u4EE4","relay.envHint":"\u5728 Relay \u4E3B\u673A\u6267\u884C\u6B64\u547D\u4EE4\u3002","relay.test":"\u6D4B\u8BD5 Relay \u8FDE\u63A5","relay.testOk":"Relay \u53EF\u8BBF\u95EE\uFF1A\u7248\u672C {version}\uFF0C\u5DF2\u8FDE\u63A5 {hosts} \u53F0\u5DE5\u4F5C\u7AD9\u3002","relay.testFailed":"Relay \u65E0\u6CD5\u8BBF\u95EE\uFF1A{message}","relay.selectAddress":"\u9009\u62E9\u516C\u5E03\u5730\u5740","relay.listenAddress":"\u76D1\u542C\u5730\u5740","relay.listenAddressHint":"\u670D\u52A1\u5668\u7ED1\u5B9A\u5730\u5740\uFF1B\u6D4F\u89C8\u5668\u8BBF\u95EE\u4E0B\u65B9\u516C\u5E03\u5730\u5740\u3002","relay.addressTailscale":"Tailscale","relay.addressLan":"\u5C40\u57DF\u7F51","relay.addressVirtual":"\u865A\u62DF\u7F51\u5361","relay.addressLoopback":"\u56DE\u73AF","relay.noAddresses":"\u672A\u627E\u5230\u975E\u56DE\u73AF\u5730\u5740\u3002","relay.docsHint":"\u81EA\u5EFA\u6307\u5357\uFF1Adocs/self-hosted-relay.zh-CN.md","keepalive.title":"\u540E\u53F0\u4FDD\u6D3B\u670D\u52A1","keepalive.manager":"\u7BA1\u7406\u65B9\u5F0F","keepalive.state":"\u72B6\u6001","keepalive.install":"\u5B89\u88C5\u5E76\u542F\u52A8","keepalive.uninstall":"\u505C\u6B62\u5E76\u79FB\u9664","keepalive.restart":"\u91CD\u542F\u4FDD\u6D3B\u670D\u52A1","keepalive.installed":"\u5DF2\u901A\u8FC7 {manager} \u5B89\u88C5\u4FDD\u6D3B\u670D\u52A1\u3002","keepalive.uninstalled":"\u4FDD\u6D3B\u670D\u52A1\u5DF2\u79FB\u9664\u3002","keepalive.restarted":"\u4FDD\u6D3B\u670D\u52A1\u5DF2\u91CD\u542F\u3002","keepalive.failed":"\u4FDD\u6D3B\u64CD\u4F5C\u5931\u8D25\uFF1A{message}","keepalive.unitPath":"\u5355\u5143\u6587\u4EF6","keepalive.logsHint":"\u67E5\u770B\u65E5\u5FD7\uFF1A{command}","keepalive.linger":"\u5F00\u673A\u81EA\u542F","keepalive.lingerEnabled":"\u5DF2\u5F00\u542F\u5F00\u673A\u81EA\u542F\u3002","keepalive.lingerDisabled":"\u672A\u5F00\u542F\u5F00\u673A\u81EA\u542F\uFF08\u4EC5\u767B\u5F55\u671F\u95F4\u8FD0\u884C\uFF09\u3002","keepalive.enableLinger":"\u5F00\u542F\u5F00\u673A\u81EA\u542F","keepalive.lingerDone":"\u5DF2\u4E3A {username} \u5F00\u542F\u5F00\u673A\u81EA\u542F\u3002","keepalive.fallbackNote":"\u65E0\u7CFB\u7EDF\u670D\u52A1\u7BA1\u7406\u5668\uFF0C\u4F7F\u7528\u540E\u53F0\u5B88\u62A4\u8FDB\u7A0B\uFF0C\u91CD\u542F\u540E\u4E0D\u81EA\u52A8\u6062\u590D\u3002","keepalive.windowsTaskNote":"\u5728\u4F60\u7684\u8D26\u6237\u767B\u5F55\u540E\u542F\u52A8\uFF0C\u65E0\u9700\u5BC6\u7801\u6216\u7BA1\u7406\u5458\u6743\u9650\uFF1B\u767B\u5F55\u524D\u4E0D\u4F1A\u8FD0\u884C\u3002","keepalive.serviceNote":"\u4EE5\u4F60\u7684\u8D26\u6237\u4F5C\u4E3A Windows \u670D\u52A1\u8FD0\u884C\uFF0C\u5728\u767B\u5F55\u524D\u542F\u52A8\u3002\u5B89\u88C5\u6216\u79FB\u9664\u9700\u8981\u7BA1\u7406\u5458\u6743\u9650\uFF0CWindows \u4E5F\u53EF\u80FD\u8981\u6C42\u8D26\u6237\u5BC6\u7801\u3002","keepalive.serviceWindowHint":"\u8BF7\u5728\u968F\u540E\u6253\u5F00\u7684\u7BA1\u7406\u5458\u7A97\u53E3\u4E2D\u5B8C\u6210\u5B89\u88C5\u3002","keepalive.elevationCancelled":"\u672A\u6388\u4E88\u7BA1\u7406\u5458\u6743\u9650\uFF0C\u672A\u5B89\u88C5\u670D\u52A1\u3002","keepalive.passwordPrompt":"\u8BF7\u8F93\u5165 {account} \u7684 Windows \u8D26\u6237\u5BC6\u7801\uFF08\u4E0D\u662F PIN\uFF1B\u8D26\u6237\u65E0\u5BC6\u7801\u65F6\u76F4\u63A5\u6309 Enter\uFF09\uFF1A","keepalive.passwordRejected":"Windows \u672A\u80FD\u4F7F\u7528\u8FD9\u4E9B\u51ED\u636E\u542F\u52A8\u670D\u52A1\u3002\u8BF7\u68C0\u67E5\u8D26\u6237\u5BC6\u7801\u548C\u201C\u4F5C\u4E3A\u670D\u52A1\u767B\u5F55\u201D\u7B56\u7565\u3002","keepalive.serviceInstalled":"\u670D\u52A1 {id} \u5DF2\u5B89\u88C5\u5E76\u6B63\u5728\u8FD0\u884C\u3002","keepalive.wrongAccount":"\u8BF7\u4F7F\u7528\u5C06\u8FD0\u884C herdr-remote \u7684\u8D26\u6237\u6267\u884C\u6B64\u64CD\u4F5C\uFF0C\u4E0D\u8981\u6362\u7528\u5176\u4ED6\u7BA1\u7406\u5458\u8D26\u6237\u3002","keepalive.pressEnter":"\u6309 Enter \u5173\u95ED\u6B64\u7A97\u53E3\u3002","herdr.title":"Herdr \u96C6\u6210","herdr.socketPath":"\u5957\u63A5\u5B57\u8DEF\u5F84","herdr.args":"\u9644\u52A0\u53C2\u6570","herdr.autoStartHint":"\u5173\uFF1AHerdr \u53EA\u5728\u4F60\u624B\u52A8\u8FD0\u884C\uFF0C\u6216\u5728\u6D4F\u89C8\u5668\u91CC\u786E\u8BA4\u540E\u624D\u542F\u52A8\u3002\u5F00\uFF1Aherdr-remote \u6BCF\u6B21\u542F\u52A8\uFF08\u5305\u62EC\u5F00\u673A\uFF09\u65F6\u4E00\u5E76\u542F\u52A8 Herdr\u3002\u4E0B\u6B21 herdr-remote \u542F\u52A8\u65F6\u751F\u6548\u3002","herdr.cliMissing":"\u672A\u627E\u5230 herdr \u547D\u4EE4\uFF0C\u53EF\u5C06 HERDR_BIN_PATH \u8BBE\u4E3A\u5176\u5B8C\u6574\u8DEF\u5F84\u3002","herdr.version":"Herdr \u7248\u672C","herdr.versionOutdated":"Herdr {version} \u4F4E\u4E8E {minimum}\uFF0C\u8BF7\u8FD0\u884C \u201Cherdr update\u201D\uFF1A\u5728\u8BE5\u7248\u672C\u4E4B\u524D\uFF0C\u6D4F\u89C8\u5668\u7A97\u53E3\u7684\u6807\u9898\u3001\u5927\u6BB5\u7C98\u8D34\u3001\u70B9\u6309\u7A97\u683C\u3001Alt \u5FEB\u6377\u952E\u4EE5\u53CA\u6162\u901F\u94FE\u8DEF\u4E0A\u7684\u8F93\u5165\u90FD\u4F1A\u51FA\u95EE\u9898\u3002","about.title":"\u8BED\u8A00\u4E0E\u5173\u4E8E","about.language":"\u754C\u9762\u8BED\u8A00","about.languageAuto":"\u8DDF\u968F\u7CFB\u7EDF\uFF08{detected}\uFF09","about.languageZh":"\u4E2D\u6587","about.languageEn":"English","about.version":"\u7248\u672C","about.configPath":"\u914D\u7F6E\u6587\u4EF6","about.statePath":"\u72B6\u6001\u76EE\u5F55","about.relayPackage":"Relay \u5305","about.docs":"\u81EA\u5EFA\u6307\u5357\uFF1Adocs/self-hosted-relay.zh-CN.md","wizard.title":"\u9996\u6B21\u8BBE\u7F6E","wizard.step":"\u7B2C {current} / {total} \u6B65","wizard.languageTitle":"\u9009\u62E9\u8BED\u8A00","wizard.accessTitle":"\u9009\u62E9\u8BBF\u95EE\u65B9\u5F0F","wizard.accessHint":"\u540E\u7EED\u53EF\u5728 Relay \u9875\u9762\u4FEE\u6539\u3002","wizard.addressTitle":"\u9009\u62E9\u8BBF\u95EE\u5730\u5740","wizard.relayTitle":"Relay \u670D\u52A1\u5668","wizard.relayUrlLabel":"Relay \u5730\u5740\uFF08wss://\u2026\uFF09","wizard.relayHint":"Relay \u9700\u5148\u8FD0\u884C\u3002\u642D\u5EFA\u6307\u5357\u89C1 docs/self-hosted-relay.zh-CN.md\u3002","wizard.passwordTitle":"Relay \u5BC6\u7801","wizard.passwordHint":"Relay \u7684 RELAY_PASSWORD\u3002\u672A\u8BBE\u7559\u7A7A\u3002","wizard.finishTitle":"\u5B8C\u6210","wizard.finishHint":"\u914D\u7F6E\u5C06\u4FDD\u5B58\u81F3 {path}\u3002","wizard.startNow":"\u7ACB\u5373\u542F\u52A8\u670D\u52A1","wizard.installKeepalive":"\u540E\u53F0\u4FDD\u6D3B","wizard.finish":"\u4FDD\u5B58\u5E76\u5B8C\u6210","field.mode":"\u8BBF\u95EE\u65B9\u5F0F","field.port":"Relay \u7AEF\u53E3","field.lanHost":"\u6D4F\u89C8\u5668\u5730\u5740","field.remoteUrl":"Relay \u5730\u5740","field.publicUrl":"\u6D4F\u89C8\u5668\u5730\u5740\uFF08\u8986\u76D6\uFF09","field.socketPath":"Herdr \u5957\u63A5\u5B57\u8DEF\u5F84","field.herdrArgs":"Herdr \u53C2\u6570","field.herdrAutoStart":"\u968F\u670D\u52A1\u542F\u52A8 Herdr","field.language":"\u8BED\u8A00","field.keepalive":"\u4FDD\u6D3B\u7BA1\u7406\u65B9\u5F0F","placeholder.autoDiscovered":"\u81EA\u52A8\u63A2\u6D4B","placeholder.none":"\u65E0","error.invalidMode":"\u672A\u77E5\u7684\u8BBF\u95EE\u65B9\u5F0F\u3002","error.invalidPort":"\u7AEF\u53E3\u987B\u4E3A 1 \u5230 65535 \u4E4B\u95F4\u7684\u6570\u5B57\u3002","error.invalidLanHost":"\u6D4F\u89C8\u5668\u5730\u5740\u987B\u4E3A\u53EF\u8BBF\u95EE\u5C40\u57DF\u7F51\u6216 Tailscale \u5730\u5740\uFF0C\u4E0D\u80FD\u4E3A\u56DE\u73AF\u6216 0.0.0.0\u3002","error.invalidRelayUrl":"Relay \u5730\u5740\u987B\u4EE5 wss://\u3001ws://\u3001https:// \u6216 http:// \u5F00\u5934\u3002","error.invalidPublicUrl":"\u6D4F\u89C8\u5668\u5730\u5740\u987B\u4EE5 https:// \u6216 http:// \u5F00\u5934\uFF0C\u4E0D\u80FD\u4E3A 0.0.0.0 \u6216 ::\u3002","error.invalidLanguage":"\u672A\u77E5\u7684\u8BED\u8A00\u3002","error.invalidKeepalive":"\u672A\u77E5\u7684\u4FDD\u6D3B\u7BA1\u7406\u65B9\u5F0F\u3002","error.unknownField":"\u672A\u77E5\u7684\u8BBE\u7F6E\u9879\u3002","error.remoteUrlRequired":"\u81EA\u5EFA Relay \u6A21\u5F0F\u987B\u586B\u5199 Relay \u5730\u5740\u3002","error.removedHerdrArg":"Herdr 0.9.0 \u5DF2\u79FB\u9664 --no-session\uFF0C\u8BF7\u4ECE\u9644\u52A0\u53C2\u6570\u4E2D\u79FB\u9664\u3002","error.saveFailed":"\u4FDD\u5B58\u914D\u7F6E\u5931\u8D25\uFF1A{message}","hint.navigate":"\u2191\u2193 \u79FB\u52A8","hint.select":"\u21B5 \u9009\u62E9","hint.edit":"\u21B5 \u7F16\u8F91","hint.tabs":"\u2190 \u2192 \u5207\u6362\u9875\u9762","hint.back":"esc \u8FD4\u56DE","hint.quit":"q \u9000\u51FA","hint.mouseOn":"m \u5173\u95ED\u9F20\u6807","hint.mouseOff":"m \u5F00\u542F\u9F20\u6807","hint.mouseUnsupported":"\u4E0D\u652F\u6301\u9F20\u6807","hint.restartRequired":"\u91CD\u542F\u670D\u52A1\u751F\u6548\u3002","hint.unsavedChanges":"\u6709\u672A\u4FDD\u5B58\u4FEE\u6539\uFF08\u6309 s \u4FDD\u5B58\uFF09\u3002","hint.save":"s \u4FDD\u5B58","hint.editing":"\u21B5 \u786E\u8BA4 \xB7 esc \u53D6\u6D88","update.title":"\u66F4\u65B0","update.banner":"herdr-remote {latest} \u5DF2\u53D1\u5E03\uFF08\u5F53\u524D {current}\uFF09\uFF0C\u6309 7 \u8FDB\u5165\u300C\u8BED\u8A00\u4E0E\u5173\u4E8E\u300D\uFF0C\u5728\u66F4\u65B0\u4E00\u884C\u6309 Enter \u5B89\u88C5\u3002","update.check":"\u68C0\u67E5\u66F4\u65B0","update.checking":"\u67E5\u8BE2 GitHub Releases \u4E2D\u2026","update.upToDate":"\u5DF2\u662F\u6700\u65B0\uFF08{version}\uFF09","update.available":"\u65B0\u7248\u672C {version} \u53EF\u7528\uFF08\u6309 Enter \u5B89\u88C5\uFF09","update.updating":"\u5B89\u88C5 {version} \u4E2D\u2026","update.updatingRetry":"\u5B89\u88C5 {version} \u4E2D\u2026\uFF08npm \u5C1A\u672A\u540C\u6B65\uFF0C\u7B2C {attempt} \u6B21\u5C1D\u8BD5\uFF09","update.done":"\u5DF2\u66F4\u65B0\u81F3 {version}","update.restartHint":"\u66F4\u65B0\u5DF2\u5B89\u88C5\uFF0C\u91CD\u542F herdr-remote \u751F\u6548\u3002","update.errorNetwork":"\u65E0\u6CD5\u8FDE\u63A5 GitHub Releases\uFF0C\u4F5C\u4E3A\u5907\u7528\u7684 npm registry \u4E5F\u65E0\u6CD5\u8FDE\u63A5","update.errorNetworkDetail":"\u5747\u65E0\u5E94\u7B54\uFF1A{message}","update.errorFailed":"\u66F4\u65B0\u5931\u8D25\uFF0C\u53EF\u624B\u52A8\u6267\u884C\uFF1Anpm install -g {url}","update.errorFailedDetail":"\u5B89\u88C5\u8F93\u51FA\uFF1A{message}","update.errorNotYetPublished":"npm \u8FD8\u6CA1\u540C\u6B65\u5230 {version}\uFF08\u521A\u53D1\u5E03\u7684\u51E0\u5206\u949F\u5185\u5E38\u89C1\uFF09\uFF0C\u7A0D\u540E\u6309 Enter \u91CD\u8BD5\u3002","update.errorNotApplied":"\u5B89\u88C5\u62A5\u544A\u6210\u529F\uFF0C\u4F46\u5B89\u88C5\u7684\u4ECD\u662F {installed}","update.cannot.source":"\u6E90\u7801\u76EE\u5F55\u8FD0\u884C\uFF0C\u8BF7\u4F7F\u7528 git \u66F4\u65B0","update.cannot.linked":"npm link \u5DE5\u4F5C\u526F\u672C\uFF0C\u7531 npm link \u7BA1\u7406","update.stoppingServices":"\u66FF\u6362\u6587\u4EF6\u671F\u95F4\u5148\u505C\u6B62\u670D\u52A1\u2026","update.restarting":"\u6B63\u5728\u7528\u65B0\u7248\u672C\u91CD\u542F\u670D\u52A1\u2026","update.notRunning":"\u670D\u52A1\u4E4B\u524D\u6CA1\u6709\u8FD0\u884C\uFF0C\u4FDD\u6301\u505C\u6B62\u3002\u9700\u8981\u65F6\u6267\u884C\uFF1Aherdr-remote start","update.restartFailed":"\u5DF2\u5B89\u88C5\uFF0C\u4F46\u670D\u52A1\u6CA1\u80FD\u91CD\u542F\uFF1A{message}","update.brokerRestarted":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u5DF2\u91CD\u542F\u3002","update.brokerRestartFailed":"\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u6CA1\u6709\u91CD\u65B0\u542F\u52A8\u3002\u91CD\u65B0\u767B\u5F55 Windows\uFF0C\u6216\u8FD0\u884C herdr-remote admin-broker restart\u3002","update.brokerBusy":"\u6709\u7BA1\u7406\u5458\u7EC8\u7AEF\u5F00\u7740\uFF0Cbroker \u7EE7\u7EED\u8FD0\u884C\u65E7\u7248\u672C\u3002\u5173\u95ED\u6240\u6709\u7BA1\u7406\u5458\u7EC8\u7AEF\u540E\u8FD0\u884C herdr-remote admin-broker restart\u3002","update.errorBusy":"\u4ECD\u6709\u8FDB\u7A0B\u5360\u7528 herdr-remote \u7684\u5B89\u88C5\u76EE\u5F55\uFF0C\u65E7\u7248\u672C\u8BBE\u7F6E\u7684\u7BA1\u7406\u5458\u7EC8\u7AEF broker \u4F1A\u8FD9\u6837\u3002\u5148\u5728\u7BA1\u7406\u5458 PowerShell \u4E2D\u6267\u884C\uFF1AGet-ScheduledTask -TaskName 'HerdrRemoteAdminBroker-*' | Stop-ScheduledTask\uFF0C\u518D\u56DE\u5230\u8FD9\u91CC\u91CD\u65B0\u8FD0\u884C herdr-remote update\uFF0C\u6700\u540E\u4EE5\u7BA1\u7406\u5458\u8EAB\u4EFD\u8FD0\u884C herdr-remote admin-broker install\u3002"},d=u;var o={en:l,zh:d},n="en";function s(e){return typeof e=="string"&&Object.hasOwn(o,e)}function y({env:e=process.env,preference:r="auto"}={}){if(r&&r!=="auto"&&s(r))return r;if(s(e.HERDR_REMOTE_LANG))return e.HERDR_REMOTE_LANG;let a=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE||"";return String(a).split(/[:.@]/)[0].toLowerCase().startsWith("zh")?"zh":n}function v(e,r){return r?e.replace(/\{(\w+)\}/g,(a,i)=>Object.hasOwn(r,i)?String(r[i]):a):e}function b(e=n){let r=s(e)?o[e]:o[n],a=o[n];return Object.assign((t,c)=>{let p=r[t]??a[t]??t;return v(p,c)},{locale:e,has:t=>Object.hasOwn(r,t)})}export{y as a,b};
|