1 line
70 KiB
JavaScript
1 line
70 KiB
JavaScript
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[246],{9170:function(e,t,l){l.d(t,{Z:function(){return r}});var s=l(7437),a=l(2265);function r(e){let{snapshot:t,theme:r,tr:n}=e,i=(0,a.useRef)(null);return((0,a.useEffect)(()=>{let e=i.current;if(!e||!t)return;let s=!1,a=null,o="light"===r?"#0f172a":"#e2e8f0",c="light"===r?"#64748b":"#94a3b8",d="light"===r?"rgba(15,23,42,0.1)":"rgba(148,163,184,0.12)";l.e(614).then(l.bind(l,9614)).then(e=>{var l,r,x,h,m,u,b,p,g,f,v,j,w;if(s||!i.current)return;a=e.init(i.current,void 0,{renderer:"canvas"});let N=null!==(g=null===(l=t.cpu_load)||void 0===l?void 0:l["1m"])&&void 0!==g?g:0,y=null!==(f=null===(r=t.cpu_load)||void 0===r?void 0:r["5m"])&&void 0!==f?f:0,k=null!==(v=null===(x=t.cpu_load)||void 0===x?void 0:x["15m"])&&void 0!==v?v:0,C=(null===(h=t.memory)||void 0===h?void 0:h.total)||1,S=null!==(w=null!==(j=null===(m=t.memory)||void 0===m?void 0:m.available)&&void 0!==j?j:null===(u=t.memory)||void 0===u?void 0:u.free)&&void 0!==w?w:0,_=(null===(b=t.disk)||void 0===b?void 0:b.total)||1,D=(null===(p=t.disk)||void 0===p?void 0:p.free)||0;a.setOption({animationDurationUpdate:450,textStyle:{color:o},title:{text:n("无人直播节点 \xb7 资源","Unmanned live \xb7 resources"),left:12,top:8,textStyle:{color:o,fontSize:12,fontWeight:600}},tooltip:{trigger:"axis"},grid:{left:52,right:"48%",top:52,bottom:36},xAxis:{type:"category",data:["1m","5m","15m"],axisLabel:{color:c,fontSize:10},axisLine:{lineStyle:{color:d}}},yAxis:{type:"value",name:n("负载","Load"),nameTextStyle:{color:c,fontSize:10},axisLabel:{color:c,fontSize:10},splitLine:{lineStyle:{color:d}}},series:[{name:n("CPU","CPU"),type:"bar",data:[N,y,k],barMaxWidth:28,itemStyle:{borderRadius:[6,6,0,0],color:new e.graphic.LinearGradient(0,0,0,1,[{offset:0,color:"#22d3ee"},{offset:1,color:"#6366f1"}])}},{name:n("内存","RAM"),type:"pie",radius:["26%","40%"],center:["78%","38%"],label:{color:o,fontSize:9},data:[{value:Math.max(0,C-S),name:n("已用","Used")},{value:Math.max(0,S),name:n("可用","Free")}]},{name:n("磁盘","Disk"),type:"pie",radius:["20%","32%"],center:["78%","72%"],label:{color:o,fontSize:9},data:[{value:Math.max(0,_-D),name:n("已用","Used")},{value:Math.max(0,D),name:n("空闲","Free")}]}]})});let x=new ResizeObserver(()=>null==a?void 0:a.resize());return x.observe(e),()=>{s=!0,x.disconnect(),null==a||a.dispose()}},[t,r,n]),t)?(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)("p",{className:"mb-2 text-xs opacity-70",children:n("ECharts 动态图表","ECharts live charts")}),(0,s.jsx)("div",{ref:i,className:"chart-surface h-64 w-full rounded-2xl border border-white/[0.08] bg-black/15 md:h-72"})]}):null}},2246:function(e,t,l){l.d(t,{d:function(){return k}});var s=l(7437),a=l(3145),r=l(2265),n=l(9170),i=l(2023),o=l(1817),c=l(7168),d=l(6865),x=l(5621),h=l(9076);function m(e){let{lang:t,rootId:l,filePath:a,fileContent:n,refreshKey:m,busy:u,fetchJson:b,notify:p,onChangeContent:g,onRefreshListing:f}=e,[v,j]=(0,r.useState)(null),[w,N]=(0,r.useState)(!1),[y,k]=(0,r.useState)(!1),[C,S]=(0,r.useState)(null),[_,D]=(0,r.useState)(null),E=(0,r.useCallback)((e,l)=>"zh"===t?e:l,[t]),O=(0,r.useCallback)(async()=>{if(!l||!a){j(null);return}N(!0);try{let e=new URLSearchParams({root:l,path:a}),t=await b("/config_insights?".concat(e.toString()));j(t)}catch(e){j(null),p(e.message)}finally{N(!1)}},[b,a,p,l]);(0,r.useEffect)(()=>{O()},[O,m]);let R=async()=>{if(l&&a){k(!0);try{let e=await b("/config_insights",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:l,path:a,content:n})});j(e),p(E("已分析当前编辑内容","Analyzed current editor draft"))}catch(e){p(e.message)}finally{k(!1)}}},T=async e=>{if(l&&a){S(e);try{let t=await b("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:l,path:a,content:n,action:e})});"string"==typeof t.content&&g(t.content),t.insights&&j(e=>({...e,...t.insights,backups:(null==e?void 0:e.backups)||[]})),p(t.message||E("已应用优化","Optimization applied"))}catch(e){p(e.message)}finally{S(null)}}},U=async e=>{if(l&&a){D(e);try{let t=await b("/config_restore",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:l,path:a,backup_id:e})});"string"==typeof t.content&&g(t.content),await Promise.resolve(null==f?void 0:f()),await O(),p(t.message||E("已恢复历史版本","Backup restored"))}catch(e){p(e.message)}finally{D(null)}}};if(!a)return(0,s.jsx)("div",{className:"rounded-2xl border border-white/8 bg-black/20 p-4 text-sm text-slate-400",children:E("选择文件后显示诊断、回滚和一键优化。","Pick a file to see diagnostics, rollback, and one-click optimizations.")});let A=(null==v?void 0:v.issues)||[],P=(null==v?void 0:v.actions)||[],I=(null==v?void 0:v.backups)||[],L=(null==v?void 0:v.stats)||[];return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-gradient-to-br from-cyan-500/[0.08] via-black/25 to-transparent p-4",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-white",children:[(0,s.jsx)(i.Z,{className:"h-4 w-4 text-cyan-300"}),(0,s.jsx)("h3",{className:"text-sm font-semibold",children:E("配置治理","Config governance")}),(null==v?void 0:v.source)?(0,s.jsx)("span",{className:"rounded-full border border-white/10 bg-black/25 px-2 py-0.5 text-[10px] uppercase tracking-wider text-slate-400",children:v.source}):null]}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:(null==v?void 0:v.summary)||E("校验配置风险、查看历史快照,并将常见优化应用到编辑器。","Validate risks, inspect snapshots, and apply optimizations into the editor.")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)("button",{type:"button",disabled:!!u||w,onClick:()=>void O(),className:"btn-focus inline-flex items-center gap-2 rounded-xl border border-white/10 bg-black/25 px-3 py-2 text-xs text-slate-100 disabled:opacity-40",children:[w?(0,s.jsx)(o.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(c.Z,{className:"h-3.5 w-3.5"}),E("刷新已保存状态","Refresh saved state")]}),(0,s.jsxs)("button",{type:"button",disabled:!!u||y,onClick:()=>void R(),className:"btn-focus inline-flex items-center gap-2 rounded-xl border border-cyan-500/30 bg-cyan-500/15 px-3 py-2 text-xs text-cyan-100 disabled:opacity-40",children:[y?(0,s.jsx)(o.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(d.Z,{className:"h-3.5 w-3.5"}),E("分析当前编辑器","Analyze editor draft")]})]})]}),(0,s.jsx)("div",{className:"mt-4 grid gap-2 sm:grid-cols-2 xl:grid-cols-4",children:L.slice(0,8).map(e=>(0,s.jsxs)("div",{className:"rounded-xl border border-white/8 bg-black/20 px-3 py-2.5",children:[(0,s.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-slate-500",children:e.label}),(0,s.jsx)("div",{className:"mt-1 truncate font-mono text-sm text-white",children:e.value})]},e.key))})]}),(0,s.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-white/8 bg-black/20 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-white",children:[(0,s.jsx)(d.Z,{className:"h-4 w-4 text-amber-300"}),(0,s.jsx)("h4",{className:"text-sm font-semibold",children:E("风险与建议","Risks & guidance")})]}),A.length?(0,s.jsx)("div",{className:"mt-3 space-y-2",children:A.map((e,t)=>{var l;return(0,s.jsxs)("div",{className:"rounded-xl border px-3 py-2 text-xs ".concat("error"===(l=e.level)?"border-rose-500/30 bg-rose-500/10 text-rose-100":"warning"===l?"border-amber-500/30 bg-amber-500/10 text-amber-100":"border-cyan-500/30 bg-cyan-500/10 text-cyan-100"),children:[(0,s.jsxs)("div",{className:"font-medium",children:[e.message,e.line?" (L".concat(e.line,")"):""]}),(0,s.jsx)("div",{className:"mt-1 font-mono opacity-70",children:e.code})]},"".concat(e.code,"-").concat(t))})}):(0,s.jsx)("p",{className:"mt-3 text-xs text-emerald-300/90",children:E("当前没有发现明显配置风险。","No obvious config risks were detected.")}),(0,s.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:P.length?P.map(e=>(0,s.jsx)("button",{type:"button",disabled:!!u||!!C,onClick:()=>void T(e.id),className:"btn-focus rounded-xl border border-violet-500/30 bg-violet-500/15 px-3 py-2 text-xs text-violet-100 disabled:opacity-40",title:e.description,children:C===e.id?E("处理中...","Working..."):e.label},e.id)):(0,s.jsx)("span",{className:"text-xs text-slate-500",children:E("当前文件没有可自动应用的预设。","No auto-applicable presets for this file.")})})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-white/8 bg-black/20 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-white",children:[(0,s.jsx)(x.Z,{className:"h-4 w-4 text-cyan-300"}),(0,s.jsx)("h4",{className:"text-sm font-semibold",children:E("历史快照","Backup snapshots")})]}),I.length?(0,s.jsx)("div",{className:"mt-3 space-y-2",children:I.slice(0,8).map(e=>(0,s.jsx)("div",{className:"rounded-xl border border-white/8 bg-black/25 px-3 py-2.5",children:(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-xs text-white",children:new Date(e.created_at).toLocaleString("zh"===t?"zh-CN":"en-US",{hour12:!1})}),(0,s.jsxs)("div",{className:"mt-1 text-[11px] text-slate-500",children:[e.reason," \xb7 ",function(e){if(!e)return"0 B";let t=["B","KB","MB","GB"],l=e,s=0;for(;l>=1024&&s<t.length-1;)l/=1024,s+=1;return"".concat(l.toFixed(l>=10||0===s?0:1)," ").concat(t[s])}(e.size),"legacy"===e.source?" \xb7 ".concat(E("旧备份","legacy")):""]})]}),(0,s.jsxs)("button",{type:"button",disabled:!!u||!!_,onClick:()=>void U(e.id),className:"btn-focus inline-flex items-center gap-1 rounded-lg border border-white/10 bg-white/5 px-3 py-1.5 text-xs text-slate-100 disabled:opacity-40",children:[_===e.id?(0,s.jsx)(o.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(h.Z,{className:"h-3.5 w-3.5"}),E("恢复","Restore")]})]})},e.id))}):(0,s.jsx)("p",{className:"mt-3 text-xs text-slate-500",children:E("当前文件还没有 Web 侧快照。保存、删除或恢复后会自动累积历史。","No Web snapshots yet. Saving, deleting, or restoring will accumulate history automatically.")})]})]})]})}var u=l(1387),b=l(90),p=l(8401),g=l(257);let f=["overview","business","modules","shellcrash","android","config"],v=new Set(["shellcrash-configs","shellcrash-yamls","shellcrash-jsons"]),j=()=>void 0!==g&&g.env.NEXT_PUBLIC_API_URL||"";function w(e){if(!e)return"0 B";let t=["B","KB","MB","GB","TB"],l=e,s=0;for(;l>=1024&&s<t.length-1;)l/=1024,s+=1;return"".concat(l.toFixed(l>=10||0===s?0:1)," ").concat(t[s])}function N(e){return"online"===e?"border-emerald-500/30 bg-emerald-500/10 text-emerald-200":"stopped"===e?"border-slate-500/30 bg-slate-500/10 text-slate-300":"configured"===e?"border-violet-500/30 bg-violet-500/10 text-violet-200":"unavailable"===e?"border-slate-700/30 bg-slate-800/50 text-slate-500":"error"===e?"border-rose-500/30 bg-rose-500/10 text-rose-200":"border-cyan-500/30 bg-cyan-500/10 text-cyan-200"}function y(e){let{children:t,className:l,disabled:a,onClick:r,title:n}=e;return(0,s.jsx)("button",{type:"button",className:"btn-focus rounded-xl px-3 py-2 text-xs font-semibold text-white disabled:cursor-not-allowed disabled:opacity-40 ".concat(l||""),disabled:a,onClick:r,title:n,children:t})}function k(e){var t,l,i,o,c,d,x,h,g,k,C,S,_,D,E,O;let{embeddedShellCrash:R=!1,portalLang:T}=e,U=j(),[A,P]=(0,r.useState)("zh"),[I,L]=(0,r.useState)("dark"),[M,B]=(0,r.useState)("overview"),z=(0,r.useCallback)((e,t)=>"zh"===A?e:t,[A]),[F,W]=(0,r.useState)(!0),[K,H]=(0,r.useState)(null),[Y,J]=(0,r.useState)(null),[Z,V]=(0,r.useState)(null),[G,Q]=(0,r.useState)(!0),q=(0,r.useRef)(null),[X,$]=(0,r.useState)([]),[ee,et]=(0,r.useState)(""),[el,es]=(0,r.useState)("unknown"),[ea,er]=(0,r.useState)(""),[en,ei]=(0,r.useState)(""),[eo,ec]=(0,r.useState)(null),[ed,ex]=(0,r.useState)([]),[eh,em]=(0,r.useState)(null),[eu,eb]=(0,r.useState)(null),[ep,eg]=(0,r.useState)([]),[ef,ev]=(0,r.useState)(""),[ej,ew]=(0,r.useState)([]),[eN,ey]=(0,r.useState)(""),[ek,eC]=(0,r.useState)(""),[eS,e_]=(0,r.useState)(!1),[eD,eE]=(0,r.useState)([]),[eO,eR]=(0,r.useState)(""),[eT,eU]=(0,r.useState)(null),[eA,eP]=(0,r.useState)([]),[eI,eL]=(0,r.useState)([]),[eM,eB]=(0,r.useState)(""),[ez,eF]=(0,r.useState)(""),[eW,eK]=(0,r.useState)("com.zhiliaoapp.musically"),[eH,eY]=(0,r.useState)("https://www.tiktok.com"),[eJ,eZ]=(0,r.useState)(""),[eV,eG]=(0,r.useState)(""),[eQ,eq]=(0,r.useState)(Date.now()),[eX,e$]=(0,r.useState)("tap"),[e0,e2]=(0,r.useState)(null),[e1,e3]=(0,r.useState)(0),[e5,e4]=(0,r.useState)(0),[e8,e6]=(0,r.useState)(null),[e9,e7]=(0,r.useState)(null),[te,tt]=(0,r.useState)(!1),tl=null!==(D=ep.find(e=>e.root_id===ef))&&void 0!==D?D:null,ts=ep.filter(e=>v.has(e.root_id)),ta=ep.filter(e=>!v.has(e.root_id)),tr=null!==(E=ed.find(e=>"shellcrash"===e.service_id))&&void 0!==E?E:null,tn=null!==(O=ed.find(e=>"android_panel"===e.service_id))&&void 0!==O?O:null,ti=(0,r.useMemo)(()=>{var e;let t=null!==(e=null==eo?void 0:eo.quick_links)&&void 0!==e?e:{},l={};for(let[e,s]of Object.entries(t)){let t=String(s);l[e]=/^https?:\/\//i.test(t)?(0,p.p)(t):t}return l},[eo]),to=(0,r.useMemo)(()=>(0,b.O0)(ti),[ti]),tc=(0,r.useMemo)(()=>(0,b.Tc)(to),[to]),td=(0,r.useMemo)(()=>{let e=ti.ws_scrcpy||((null==tn?void 0:tn.host)&&tn.port?"http://".concat(tn.host,":").concat(tn.port):(null==eo?void 0:eo.mdns_host)?"http://".concat(eo.mdns_host,":5000"):"");return e?(0,p.p)(e):""},[null==tn?void 0:tn.host,null==tn?void 0:tn.port,ti.ws_scrcpy,null==eo?void 0:eo.mdns_host]),tx=function(e){let t=null==e?void 0:e.match(/(\d+)x(\d+)/);return t?{width:Number(t[1]),height:Number(t[2])}:null}(null==eT?void 0:eT.resolution),th=(0,r.useCallback)(e=>{J(e),null!=q.current&&window.clearTimeout(q.current),q.current=window.setTimeout(()=>{J(null),q.current=null},2500)},[]),tm=(0,r.useCallback)(async(e,t)=>(0,u.N)("".concat(U).concat(e),t),[U]),tu=(0,r.useCallback)((e,t)=>{let l=new URL(window.location.href);l.pathname="shellcrash"===e?"/shellcrash":"android"===e?"/android":"/console","/console"===l.pathname?l.searchParams.set("tab",e):l.searchParams.delete("tab"),l.searchParams.set("lang",t),window.history.replaceState(null,"",l.toString()),window.localStorage.setItem("live-console-lang",t)},[]),tb=(0,r.useCallback)(async()=>{if(!ee)return;let e=await tm("/status?process=".concat(encodeURIComponent(ee)));es(e.process_status||"unknown"),er(e.recent_log||""),ei(e.recent_error||"")},[ee,tm]),tp=(0,r.useCallback)(async()=>{let[e,t,l]=await Promise.all([tm("/stack/services"),tm("/system_snapshot"),tm("/hardware_profile")]);ex(e.services||[]),em(t),eb(l)},[tm]),tg=(0,r.useCallback)(async(e,t)=>{if(!e)return;let l=(await tm("/managed_files?root=".concat(encodeURIComponent(e)))).files||[];ew(l);let s=t||eN;if(s&&l.some(e=>e.path===s))ey(s);else{var a;ey((null===(a=l[0])||void 0===a?void 0:a.path)||"")}},[tm,eN]),tf=(0,r.useCallback)(async()=>{var e;let t=await tm("/android/devices"),l=t.devices||[],s=eO&&l.some(e=>e.serial===eO)?eO:(null===(e=l[0])||void 0===e?void 0:e.serial)||"";return e_(!!t.available),eE(l),eR(s),s},[eO,tm]),tv=(0,r.useCallback)(async e=>{if(!e){eU(null);return}eU(await tm("/android/overview?serial=".concat(encodeURIComponent(e))))},[tm]),tj=(0,r.useCallback)(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eM;if(!e){eL([]);return}eL((await tm("/android/packages?serial=".concat(encodeURIComponent(e),"&query=").concat(encodeURIComponent(t),"&limit=60"))).packages||[])},[eM,tm]),tw=(0,r.useCallback)(async e=>{if(!e){eP([]);return}eP((await tm("/android/ui?serial=".concat(encodeURIComponent(e),"&limit=80"))).nodes||[])},[tm]),tN=(0,r.useCallback)(async(e,t)=>{ev(e),ey(t),await tg(e,t)},[tg]),ty=(0,r.useCallback)((e,t)=>{B("config"),window.setTimeout(()=>{tN(e,t)},0)},[tN]),tk=(0,r.useCallback)(async()=>{V("hardware:probe");try{let e=await tm("/hardware_profile?refresh=true");eb(e),th(z("硬件探测已更新","Hardware profile refreshed"))}catch(e){th(e.message)}finally{V(null)}},[tm,th,z]),tC=(0,r.useCallback)(async()=>{W(!0),H(null);try{var e,t,l,s;let[a,r,n]=await Promise.all([tm("/process_monitor"),tm("/server_info"),tm("/managed_roots")]);$(a.entries||[]),et((null===(t=a.entries)||void 0===t?void 0:null===(e=t[0])||void 0===e?void 0:e.pm2)||""),ec(r.stack||null),eg(n.roots||[]),ev((null===(s=n.roots)||void 0===s?void 0:null===(l=s[0])||void 0===l?void 0:l.root_id)||""),await Promise.all([tp(),tf()])}catch(e){H(e.message)}finally{W(!1)}},[tm,tf,tp]);(0,r.useEffect)(()=>{if(R){if(B("shellcrash"),"zh"===T||"en"===T)P(T);else{let e=window.localStorage.getItem("live-hub-lang");("zh"===e||"en"===e)&&P(e)}return}let e=new URLSearchParams(window.location.search),t=function(e){let t=e.replace(/\/+$/,"")||"/";return"/shellcrash"===t?"shellcrash":"/android"===t?"android":null}(window.location.pathname),l=e.get("tab"),s=e.get("lang"),a=window.localStorage.getItem("live-console-lang");t?B(t):null!==l&&f.includes(l)&&B(l),"zh"===s||"en"===s?P(s):("zh"===a||"en"===a)&&P(a);let r=window.localStorage.getItem("live-console-theme");("light"===r||"dark"===r)&&L(r)},[R,T]),(0,r.useEffect)(()=>{R||(document.documentElement.setAttribute("data-theme",I),window.localStorage.setItem("live-console-theme",I))},[I,R]),(0,r.useEffect)(()=>{let e=()=>Q("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,r.useEffect)(()=>()=>{null!=q.current&&window.clearTimeout(q.current)},[]),(0,r.useEffect)(()=>{R&&("zh"===T||"en"===T)&&P(T)},[R,T]),(0,r.useEffect)(()=>{R||tu(M,A)},[R,A,tu,M]),(0,r.useEffect)(()=>{tC()},[tC]),(0,r.useEffect)(()=>{if(!ee||!G)return;tb();let e=window.setInterval(()=>void tb(),1500);return()=>window.clearInterval(e)},[ee,G,tb]),(0,r.useEffect)(()=>{if(F||K||!G||"overview"!==M&&"modules"!==M&&"shellcrash"!==M)return;tp();let e=window.setInterval(()=>void tp(),1e4);return()=>clearInterval(e)},[F,K,G,tp,M]),(0,r.useEffect)(()=>{let e="shellcrash"===M?ts:"config"===M?ta:ep;e.length&&!e.some(e=>e.root_id===ef)&&(ev(e[0].root_id),ey(""))},[ta,ef,ep,ts,M]),(0,r.useEffect)(()=>{ef&&tg(ef)},[tg,ef]),(0,r.useEffect)(()=>{if(!ef||!eN){eC("");return}(async()=>{try{let e=await tm("/managed_file?root=".concat(encodeURIComponent(ef),"&path=").concat(encodeURIComponent(eN)));eC(e.content||"")}catch(e){th(e.message)}})()},[tm,eN,th,ef]),(0,r.useEffect)(()=>{"android"===M&&(async()=>{let e=await tf();e&&(await Promise.all([tv(e),tw(e),tj(e)]),eq(Date.now()))})()},[tf,tv,tj,tw,M]),(0,r.useEffect)(()=>{if("android"!==M||!eO||!G)return;tv(eO),eq(Date.now());let e=window.setInterval(()=>{tv(eO),eq(Date.now())},5e3);return()=>window.clearInterval(e)},[eO,G,tv,M]),(0,r.useEffect)(()=>{if(!eO){e6(e=>(e&&URL.revokeObjectURL(e),null)),e7(null),tt(!1);return}let e=new AbortController,t="".concat(U,"/android/screenshot?serial=").concat(encodeURIComponent(eO),"&ts=").concat(eQ);return tt(!0),e7(null),fetch(t,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(await (0,u.e)(e));return e.blob()}).then(e=>{if(!e.type.startsWith("image/"))throw Error("Not an image");let t=URL.createObjectURL(e);e6(e=>(e&&URL.revokeObjectURL(e),t))}).catch(e=>{"AbortError"!==e.name&&(e7(e.message),e6(e=>(e&&URL.revokeObjectURL(e),null)))}).finally(()=>{e.signal.aborted||tt(!1)}),()=>{e.abort()}},[eO,eQ,U]);let tS=async e=>{if(ee){V("process:".concat(e));try{let t=await tm("/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:ee})});th(String(t.output||t.pm2_output||t.message||"OK")),await tb()}catch(e){th(e.message)}finally{V(null)}}},t_=async(e,t)=>{V("".concat(e,":").concat(t));try{let l=await tm("/service_action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:e,action:t})});th(l.message||"OK"),await tp()}catch(e){th(e.message)}finally{V(null)}},tD=async()=>{if(ef&&eN){V("file:save");try{await tm("/managed_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:ef,path:eN,content:ek})}),th(z("文件已保存","File saved")),await tg(ef,eN),e4(e=>e+1)}catch(e){th(e.message)}finally{V(null)}}},tE=async()=>{if(!(null==tl?void 0:tl.allow_create)){th(z("当前目录不允许新建文件","The current root does not allow new files"));return}let e=window.prompt(z("请输入新的相对路径","Enter a new relative path"),tl.default_file||"");if(e){V("file:create");try{await tm("/managed_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:ef,path:e,content:""})}),th(z("文件已创建","File created")),await tg(ef,e),e4(e=>e+1)}catch(e){th(e.message)}finally{V(null)}}},tO=async()=>{if(ef&&eN){if(!(null==tl?void 0:tl.allow_delete)){th(z("当前目录不允许删除文件","The current root does not allow deletion"));return}if(window.confirm(z("确定删除该文件?","Delete this file?"))){V("file:delete");try{await tm("/managed_file?root=".concat(encodeURIComponent(ef),"&path=").concat(encodeURIComponent(eN)),{method:"DELETE"}),th(z("文件已删除","File deleted")),await tg(ef),e4(e=>e+1)}catch(e){th(e.message)}finally{V(null)}}}},tR=async e=>{var t;let l=null===(t=e.target.files)||void 0===t?void 0:t[0];if(e.target.value="",e3(e=>e+1),l&&ef){V("file:import");try{let e=await l.text();await tm("/managed_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:ef,path:l.name,content:e})}),th(z("导入完成,已替换同名文件","Import finished and replaced matching file")),ey(l.name),await tg(ef,l.name),e4(e=>e+1)}catch(e){th(e.message)}finally{V(null)}}},tT=async(e,t)=>{if(!eO){th(z("当前没有可用的 ADB 设备","No active ADB device"));return}V("android:".concat(e));try{let l=await tm("/android/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,serial:eO,payload:t||{}})});th(l.message||"OK"),l.output&&eG(l.output),eq(Date.now()),await tv(eO)}catch(e){th(e.message)}finally{V(null)}},tU="tap"===eX?z("点击","Tap"):"double_tap"===eX?z("双击","Double Tap"):z("长按","Long Press"),tA=async e=>{if(!eO){th(z("当前没有可用的 ADB 设备","No active ADB device"));return}let t=function(e,t,l){let s,a,r,n;let i=e.getBoundingClientRect(),o=e.naturalWidth,c=e.naturalHeight;if(!o||!c||!i.width||!i.height)return null;let d=i.width/i.height,x=o/c;x>d?(s=i.width,a=i.width/x,r=0,n=(i.height-a)/2):(a=i.height,s=i.height*x,r=(i.width-s)/2,n=0);let h=t-i.left-r,m=l-i.top-n;return h<0||m<0||h>s||m>a?null:{x:Math.max(0,Math.min(o-1,Math.round(h/s*o))),y:Math.max(0,Math.min(c-1,Math.round(m/a*c)))}}(e.currentTarget,e.clientX,e.clientY);if(!t){th(z("请点击画面有效区域","Tap inside the visible frame"));return}let l=(null==tx?void 0:tx.width)||e.currentTarget.naturalWidth,s=(null==tx?void 0:tx.height)||e.currentTarget.naturalHeight,a=l>0?l/Math.max(1,e.currentTarget.naturalWidth):1,r=s>0?s/Math.max(1,e.currentTarget.naturalHeight):1,n=Math.max(0,Math.min(l||t.x,Math.round(t.x*a))),i=Math.max(0,Math.min(s||t.y,Math.round(t.y*r)));if(e2({x:n,y:i}),"long_press"===eX){await tT("long_press",{x:n,y:i,duration:750});return}await tT(eX,{x:n,y:i})},tP=e=>"shellcrash"===e.service_id&&(null==eo?void 0:eo.control_url)?"".concat(eo.control_url,"/shellcrash?lang=").concat(A):"android_panel"===e.service_id&&(null==eo?void 0:eo.control_url)?"".concat(eo.control_url,"/android?lang=").concat(A):e.url||"",tI=e=>({online:z("在线","Online"),stopped:z("已停止","Stopped"),configured:z("已配置","Configured"),unavailable:z("未安装","Unavailable")})[e]||e,tL="shellcrash"===M?ts:ta,tM={overview:"\uD83D\uDCCA",business:"\uD83C\uDFAC",modules:"\uD83E\uDDE9",shellcrash:"\uD83D\uDEE1️",android:"\uD83E\uDD16",config:"⚙️"};return(0,s.jsxs)(s.Fragment,{children:[R?null:(0,s.jsx)("div",{className:"border-b border-white/[0.08] bg-slate-950/80 backdrop-blur-md",children:(0,s.jsxs)("div",{className:"mx-auto flex max-w-7xl flex-wrap items-center justify-between gap-2 px-4 py-2.5 text-xs sm:px-6 lg:px-10",children:[(0,s.jsxs)("a",{className:"font-medium text-amber-400/95 transition hover:text-amber-300",href:"/",children:["← ",z("返回门户首页","Back to portal")]}),(0,s.jsx)("span",{className:"text-slate-500",children:z("无人直播 \xb7 本页需与 API 同域(推荐 live.local:8001)","Unmanned live \xb7 same origin as API (live.local:8001)")})]})}),(0,s.jsxs)("main",{className:R?"mx-auto min-h-0 max-w-7xl px-1 pb-4 pt-1 sm:px-3":"safe-pb-nav mx-auto min-h-screen max-w-7xl px-4 pb-16 pt-6 sm:px-6 lg:px-10",children:[Y?(0,s.jsx)("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"animate-toast-in fixed bottom-24 left-1/2 z-50 max-w-[min(92vw,28rem)] -translate-x-1/2 rounded-2xl border border-cyan-500/25 bg-slate-950/95 px-5 py-3 text-center text-sm text-cyan-50 shadow-lg md:bottom-6 [html[data-theme=light]_&]:border-cyan-600/25 [html[data-theme=light]_&]:bg-white/95 [html[data-theme=light]_&]:text-cyan-950",children:Y}):null,R?(0,s.jsxs)("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2 border-b border-white/[0.08] pb-3",children:[(0,s.jsx)("h2",{className:"text-base font-semibold text-[color:var(--text)]",children:"ShellCrash"}),(0,s.jsx)(y,{className:"border border-white/12 bg-black/20",onClick:()=>void tC(),children:z("刷新","Refresh")})]}):(0,s.jsxs)("header",{className:"mb-8 flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-[0.22em] text-cyan-400/90",children:z("控制平面 \xb7 ARM Linux 开发板","Control plane \xb7 ARM Linux SBC")}),(0,s.jsx)("h1",{className:"mt-2 text-3xl font-bold text-[color:var(--text)] sm:text-4xl",children:z("无人直播控制中心","Unmanned live control center")}),(0,s.jsx)("p",{className:"mt-3 max-w-3xl text-sm text-slate-400",children:z("ShellCrash 负责代理上网;本机 FFmpeg 处理推流或 HDMI;Neko(Docker Chromium)或本机 Chromium 负责浏览器侧;开发板通过 USB 双头线 ADB 控制 AOSP。各模块独立,可分别启停。","ShellCrash for egress; FFmpeg for stream or HDMI; Neko (Docker Chromium) or host Chromium for browser; USB ADB to AOSP. Modules are isolated.")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsx)("div",{className:"meta-chip max-w-full",children:((null==eo?void 0:eo.mdns_host)||"live.local")+" \xb7 "+((null==eo?void 0:eo.machine)||"unknown")+" \xb7 "+((null==eo?void 0:eo.kernel)||"unknown")}),(0,s.jsx)(y,{className:"zh"===A?"border border-cyan-400/50 bg-cyan-500/10":"border border-white/12 bg-black/20",onClick:()=>P("zh"),children:"中文"}),(0,s.jsx)(y,{className:"en"===A?"border border-cyan-400/50 bg-cyan-500/10":"border border-white/12 bg-black/20",onClick:()=>P("en"),children:"EN"}),(0,s.jsx)(y,{className:"light"===I?"border border-amber-400/50 bg-amber-500/15":"border border-white/12 bg-black/20",onClick:()=>L("light"),title:z("日间主题","Light theme"),children:z("☀️ 日间","☀️ Light")}),(0,s.jsx)(y,{className:"dark"===I?"border border-indigo-400/50 bg-indigo-500/15":"border border-white/12 bg-black/20",onClick:()=>L("dark"),title:z("夜间主题","Dark theme"),children:z("\uD83C\uDF19 夜间","\uD83C\uDF19 Dark")}),(0,s.jsx)(y,{className:"border border-white/12 bg-black/20",onClick:()=>void tC(),children:z("刷新","Refresh")})]})]}),(0,s.jsx)("nav",{className:"tab-strip","aria-label":z("主导航","Primary navigation"),children:f.map(e=>(0,s.jsx)("button",{type:"button",className:"tab-btn ".concat(M===e?"tab-btn-active":""),onClick:()=>B(e),children:{overview:z("总览","Overview"),business:z("直播业务","Live ops"),modules:z("系统服务","Services"),shellcrash:"ShellCrash",android:z("安卓设备","Android"),config:z("配置中心","Config")}[e]},e))})]}),F?(0,s.jsx)("div",{className:"glass rounded-3xl py-24 text-center text-slate-400",children:z("正在连接控制台...","Connecting to the control plane...")}):null,!F&&K?(0,s.jsx)("div",{className:"glass rounded-3xl border border-rose-500/25 bg-rose-950/20 p-8 text-center text-rose-200",children:K}):null,F||K?null:(0,s.jsxs)("div",{className:"grid gap-6",children:["overview"===M?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("section",{className:"glass rounded-3xl border border-amber-500/20 bg-gradient-to-br from-amber-500/[0.07] to-transparent p-6",children:[(0,s.jsx)("h2",{className:"section-title",children:z("第一次用?按这条线理解整套板子","New here? Follow this mental model")}),(0,s.jsxs)("ol",{className:"mt-4 list-decimal space-y-2 pl-5 text-sm leading-relaxed text-slate-300",children:[(0,s.jsx)("li",{children:z("插电、接网线或连好 Wi‑Fi 后,用浏览器打开本页(验收域名一般为 http://live.local:8001/ ,门户在根路径 /,控制台在 /console)。","After power and Ethernet/Wi‑Fi, open this stack in a browser (often http://live.local:8001/ — portal at /, full console at /console).")}),(0,s.jsx)("li",{children:z("「直播业务」里启停 PM2 脚本(抖音→YouTube、HDMI 等);「系统服务」看 ShellCrash、SRS、ws-scrcpy、Neko 等是否在跑。","Use Live ops for PM2 scripts; Services for ShellCrash, SRS, ws-scrcpy, Neko, etc.")}),(0,s.jsx)("li",{children:z("「安卓设备」需要 USB 调试授权;截图预览 + ws-scrcpy 低延迟画面二选一或同用。TikTok 等场景常配合板载 AOSP。","Android tab needs USB debugging; use screenshot taps and/or ws-scrcpy. TikTok workflows often use on-board AOSP.")}),(0,s.jsx)("li",{children:z("深度指标点 Netdata;命令行点 WebTTY;代理规则与 YAML 在 ShellCrash 页。","Netdata for metrics; WebTTY for shell; ShellCrash tab for proxy rules and YAML.")})]})]}),(0,s.jsxs)("section",{className:"grid gap-6 xl:grid-cols-12",children:[(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsx)("h2",{className:"section-title",children:z("\uD83D\uDEF0️ 流媒体与桌面入口","Streaming & desktop")}),(0,s.jsx)("p",{className:"section-lead",children:z("ws-scrcpy:浏览器里控安卓;Chromium:本机+油猴+RemoteDebug;Neko:Docker 里跑 Chromium 桌面(非 Firefox 版)。","ws-scrcpy: browser ADB; Chromium: host+Tampermonkey+9222; Neko: Chromium desktop in Docker (not the Firefox image).")}),(0,s.jsxs)("div",{className:"mt-4 flex max-h-[28rem] flex-col gap-2 overflow-y-auto pr-1 log-scroll",children:[(null==eo?void 0:eo.dashboard_url)?(0,s.jsx)("a",{className:"link-tile",href:eo.dashboard_url,target:"_blank",rel:"noreferrer",children:"\uD83C\uDFE0 Homepage"}):null,(null==eo?void 0:eo.control_url)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("a",{className:"link-tile",href:"".concat(eo.control_url,"/console?tab=shellcrash&lang=").concat(A),target:"_blank",rel:"noreferrer",children:"\uD83D\uDEE1️ ShellCrash"}),(0,s.jsxs)("a",{className:"link-tile",href:"".concat(eo.control_url,"/console?tab=android&lang=").concat(A),target:"_blank",rel:"noreferrer",children:["\uD83E\uDD16 ",z("安卓中心 (含 ws-scrcpy)","Android hub + ws-scrcpy")]}),(0,s.jsxs)("a",{className:"link-tile",href:"".concat(eo.control_url,"/console?tab=config&lang=").concat(A),target:"_blank",rel:"noreferrer",children:["⚙️ ",z("配置中心","Config")]})]}):null,ti.ws_scrcpy?(0,s.jsxs)("a",{className:"link-tile link-tile-accent",href:ti.ws_scrcpy,target:"_blank",rel:"noreferrer",children:["\uD83D\uDCF1 ws-scrcpy (",z("原始流控制页","raw stream UI"),")"]}):null,ti.chromium_remote_debug?(0,s.jsxs)("a",{className:"link-tile",href:ti.chromium_remote_debug,target:"_blank",rel:"noreferrer",children:["\uD83E\uDDEA ",z("Chromium RemoteDebug (9222)","Chromium RemoteDebug")]}):null,to.map(e=>(0,s.jsxs)("a",{className:"link-tile link-tile-warn",href:e.url,target:"_blank",rel:"noreferrer",children:["\uD83D\uDC31 ",e.label," / ",z("Docker Chromium 桌面","Docker Chromium desktop")]},e.key)),ti.webtty?(0,s.jsx)("a",{className:"link-tile",href:ti.webtty,target:"_blank",rel:"noreferrer",children:"⌨️ WebTTY"}):null,ti.filebrowser?(0,s.jsx)("a",{className:"link-tile",href:ti.filebrowser,target:"_blank",rel:"noreferrer",children:"\uD83D\uDCC2 File Browser"}):null,ti.netdata?(0,s.jsx)("a",{className:"link-tile",href:ti.netdata,target:"_blank",rel:"noreferrer",children:"\uD83D\uDCC8 Netdata"}):null,ti.srs_http?(0,s.jsx)("a",{className:"link-tile",href:ti.srs_http,target:"_blank",rel:"noreferrer",children:"\uD83C\uDF9E️ SRS :8080"}):null,ti.srs_api?(0,s.jsx)("a",{className:"link-tile",href:ti.srs_api,target:"_blank",rel:"noreferrer",children:"\uD83C\uDF9E️ SRS API :1985"}):null]})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsx)("h2",{className:"section-title",children:z("节点状态","Node Status")}),(0,s.jsxs)("div",{className:"panel-inset mt-4",children:[(0,s.jsx)("p",{children:(null==eo?void 0:eo.mdns_host)||"live.local"}),(0,s.jsxs)("p",{className:"mt-2",children:["IP: ",((null==eo?void 0:eo.ips)||[]).join(" / ")||"-"]}),(0,s.jsx)("p",{className:"mt-2",children:(null==eo?void 0:eo.machine)||"-"}),(0,s.jsx)("p",{className:"mt-2",children:(null==eo?void 0:eo.kernel)||"-"})]})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsx)("h2",{className:"section-title",children:z("系统快照","System Snapshot")}),(0,s.jsx)("p",{className:"section-lead",children:z("总览页每 10 秒自动刷新服务与监控数据。","Overview auto-refreshes every 10s.")}),(0,s.jsxs)("div",{className:"panel-inset mt-4",children:[(0,s.jsxs)("p",{children:["CPU:"," ",[null==eh?void 0:null===(t=eh.cpu_load)||void 0===t?void 0:t["1m"],null==eh?void 0:null===(l=eh.cpu_load)||void 0===l?void 0:l["5m"],null==eh?void 0:null===(i=eh.cpu_load)||void 0===i?void 0:i["15m"]].map(e=>"number"==typeof e?e.toFixed(2):"0.00").join(" / ")]}),(0,s.jsxs)("p",{className:"mt-2",children:["RAM: ",w(null==eh?void 0:null===(o=eh.memory)||void 0===o?void 0:o.available)," / ",w(null==eh?void 0:null===(c=eh.memory)||void 0===c?void 0:c.total)]}),(0,s.jsxs)("p",{className:"mt-2",children:["Disk: ",w(null==eh?void 0:null===(d=eh.disk)||void 0===d?void 0:d.free)," / ",w(null==eh?void 0:null===(x=eh.disk)||void 0===x?void 0:x.total)]}),(0,s.jsxs)("p",{className:"mt-2",children:["Netdata: ",(null==eh?void 0:null===(h=eh.netdata)||void 0===h?void 0:h.available)?eh.netdata.version||"online":"offline"]})]}),(0,s.jsx)(n.Z,{snapshot:eh,theme:I,tr:z})]})]}),(0,s.jsxs)("section",{className:"glass rounded-3xl p-6",children:[(0,s.jsx)("h2",{className:"section-title",children:z("模块概况","Module Summary")}),(0,s.jsx)("div",{className:"mt-4 grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:ed.map(e=>(0,s.jsxs)("div",{className:"service-card",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:e.label}),(0,s.jsx)("p",{className:"mt-1 text-xs text-slate-400",children:e.description})]}),(0,s.jsx)("span",{className:"rounded-full border px-2.5 py-1 text-xs ".concat(N(e.status)),children:tI(e.status)})]}),(0,s.jsx)("p",{className:"mt-3 min-h-[3rem] text-xs text-slate-500",children:e.detail||"-"}),tP(e)?(0,s.jsx)("a",{className:"btn-focus mt-3 inline-flex rounded-xl border border-white/12 px-3 py-2 text-xs text-slate-200",href:tP(e),target:"_blank",rel:"noreferrer",children:z("打开","Open")}):null]},e.service_id))})]})]}):null,"business"===M?(0,s.jsxs)("section",{className:"grid gap-6 xl:grid-cols-12",children:[(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-12",children:[(0,s.jsx)("h2",{className:"section-title",children:z("⚡ 快捷配置","Quick config")}),(0,s.jsx)("p",{className:"section-lead",children:z("跳转配置中心编辑推流与录制相关文件。","Jump to the config editor for stream keys and URLs.")}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(y,{className:"border border-cyan-500/30 bg-cyan-600/80",onClick:()=>ty("app-config","youtube.ini"),children:"youtube.ini"}),(0,s.jsx)(y,{className:"border border-cyan-500/30 bg-cyan-600/80",onClick:()=>ty("app-config","URL_config.ini"),children:"URL_config.ini"}),(0,s.jsx)(y,{className:"border border-white/15 bg-black/30",onClick:()=>ty("app-config","config.ini"),children:"config.ini"}),(0,s.jsx)(y,{className:"border border-white/15 bg-black/30",onClick:()=>ty("stack-config","system-stack.env"),children:"system-stack.env"})]})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsx)("h2",{className:"section-title",children:z("业务运行时","Business Runtime")}),(0,s.jsx)("p",{className:"section-lead",children:z("这里只放业务脚本本身,Hub 基座可单独运行。","Only business processes live here.")}),X.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("select",{className:"field-select mt-4",value:ee,onChange:e=>et(e.target.value),children:X.map(e=>(0,s.jsxs)("option",{value:e.pm2,children:[e.label," | ",e.script]},e.pm2))}),(0,s.jsxs)("div",{className:"mt-4 flex items-center justify-between rounded-2xl border border-white/8 bg-black/20 px-4 py-3",children:[(0,s.jsx)("span",{className:"rounded-full border px-3 py-1 text-xs ".concat(N(el)),children:tI(el)}),(0,s.jsx)(y,{className:"border border-white/12 bg-black/20",onClick:()=>void tb(),children:z("轮询","Poll")})]}),(0,s.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[(0,s.jsx)(y,{className:"bg-emerald-600",disabled:"process:start"===Z,onClick:()=>void tS("start"),children:"process:start"===Z?z("启动中...","Starting..."):z("启动","Start")}),(0,s.jsx)(y,{className:"bg-amber-600",disabled:"process:restart"===Z,onClick:()=>void tS("restart"),children:"process:restart"===Z?z("重启中...","Restarting..."):z("重启","Restart")}),(0,s.jsx)(y,{className:"col-span-2 bg-rose-600",disabled:"process:stop"===Z,onClick:()=>void tS("stop"),children:"process:stop"===Z?z("停止中...","Stopping..."):z("停止","Stop")})]})]}):(0,s.jsx)("div",{className:"mt-4 rounded-2xl border border-dashed border-white/12 bg-black/20 p-4 text-sm text-slate-400",children:z("未发现业务进程。若只部署了 Hub 基座,这是正常状态。","No business process discovered.")})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-8",children:[(0,s.jsx)("h2",{className:"section-title",children:z("业务日志","Process Logs")}),(0,s.jsxs)("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:[(0,s.jsx)("pre",{className:"log-scroll min-h-[22rem] rounded-2xl border border-emerald-500/15 bg-black/55 p-4 font-mono text-[11px] text-emerald-100/95",children:ea||z("暂无输出","No stdout yet.")}),(0,s.jsx)("pre",{className:"log-scroll min-h-[22rem] rounded-2xl border border-rose-500/15 bg-black/55 p-4 font-mono text-[11px] text-rose-100/95",children:en||z("暂无报错","No stderr yet.")})]})]})]}):null,"modules"===M?(0,s.jsxs)("section",{className:"grid gap-6 xl:grid-cols-12",children:[(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-8",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"section-title",children:z("系统模块","System Modules")}),(0,s.jsx)("p",{className:"section-lead",children:z("每个模块都独立启停和降级,避免一个服务异常拖垮整套业务。","Each module starts and degrades independently.")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(y,{className:"border border-white/12 bg-black/20",onClick:()=>void tp(),children:z("刷新服务","Refresh Services")}),(0,s.jsx)(y,{className:"border border-violet-500/35 bg-violet-600/70",disabled:"hardware:probe"===Z,onClick:()=>void tk(),children:"hardware:probe"===Z?z("探测中…","Probing…"):z("重探测硬件","Re-probe HW")})]})]}),(0,s.jsx)("div",{className:"mt-4 grid gap-4 md:grid-cols-2",children:ed.map(e=>(0,s.jsxs)("div",{className:"service-card",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:e.label}),(0,s.jsx)("p",{className:"mt-1 text-xs text-slate-400",children:e.description})]}),(0,s.jsx)("span",{className:"rounded-full border px-2.5 py-1 text-xs ".concat(N(e.status)),children:tI(e.status)})]}),(0,s.jsx)("p",{className:"mt-3 min-h-[3rem] text-xs text-slate-500",children:e.detail||"-"}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(y,{className:"bg-emerald-600",disabled:!e.available||!!Z,onClick:()=>void t_(e.service_id,"start"),children:z("启动","Start")}),(0,s.jsx)(y,{className:"bg-amber-600",disabled:!e.available||!!Z,onClick:()=>void t_(e.service_id,"restart"),children:z("重启","Restart")}),(0,s.jsx)(y,{className:"bg-rose-600",disabled:!e.available||!!Z,onClick:()=>void t_(e.service_id,"stop"),children:z("停止","Stop")}),tP(e)?(0,s.jsx)("a",{className:"btn-focus rounded-xl border border-white/12 px-3 py-2 text-xs text-slate-200",href:tP(e),target:"_blank",rel:"noreferrer",children:z("打开","Open")}):null]})]},e.service_id))})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-white",children:z("硬件与系统","Hardware and System")}),(0,s.jsxs)("div",{className:"mt-4 rounded-2xl border border-white/8 bg-black/20 p-4 text-xs text-slate-400",children:[(0,s.jsxs)("p",{children:["Arch: ",(null==eu?void 0:eu.arch)||"-"]}),(0,s.jsxs)("p",{className:"mt-2",children:["FFmpeg: ",((null==eu?void 0:eu.ffmpeg_hwaccels)||[]).join(", ")||"-"]}),(0,s.jsxs)("p",{className:"mt-2",children:["GPU: ",(null==eu?void 0:null===(g=eu.gpu)||void 0===g?void 0:g.present)?eu.gpu.driver||"present":"none"]}),(0,s.jsxs)("p",{className:"mt-2",children:["NPU: ",(null==eu?void 0:null===(k=eu.npu)||void 0===k?void 0:k.present)?(eu.npu.devices||[]).join(", "):"none"]}),(0,s.jsxs)("p",{className:"mt-2",children:["Decoder: ",(null==eu?void 0:null===(C=eu.recommendation)||void 0===C?void 0:C.video_decoder)||"cpu"]}),(0,s.jsxs)("p",{className:"mt-2",children:["HDMI: ",(null==eu?void 0:null===(S=eu.recommendation)||void 0===S?void 0:S.hdmi_player)||"cpu"]}),(0,s.jsxs)("p",{className:"mt-2",children:["Mode: ",(null==eu?void 0:null===(_=eu.recommendation)||void 0===_?void 0:_.stability_mode)||"safe"]})]})]})]}):null,"shellcrash"===M?(0,s.jsxs)("section",{className:"grid gap-6 xl:grid-cols-12",children:[(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-white",children:"ShellCrash"}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:z("这里不再依赖命令行菜单,直接做 YAML / JSON / CFG 编辑与服务控制。","Manage ShellCrash from the web instead of the shell menu.")}),tr?(0,s.jsxs)("div",{className:"mt-4 rounded-3xl border border-white/8 bg-black/20 p-5",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:tr.label}),(0,s.jsx)("p",{className:"mt-1 text-xs text-slate-400",children:tr.description})]}),(0,s.jsx)("span",{className:"rounded-full border px-2.5 py-1 text-xs ".concat(N(tr.status)),children:tI(tr.status)})]}),(0,s.jsx)("p",{className:"mt-3 text-xs text-slate-500",children:tr.detail||"-"}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(y,{className:"bg-emerald-600",disabled:!tr.available||!!Z,onClick:()=>void t_("shellcrash","start"),children:z("启动","Start")}),(0,s.jsx)(y,{className:"bg-amber-600",disabled:!tr.available||!!Z,onClick:()=>void t_("shellcrash","restart"),children:z("重启","Restart")}),(0,s.jsx)(y,{className:"bg-rose-600",disabled:!tr.available||!!Z,onClick:()=>void t_("shellcrash","stop"),children:z("停止","Stop")})]})]}):null,(0,s.jsxs)("div",{className:"mt-4 rounded-2xl border border-white/8 bg-black/20 p-4 text-xs text-slate-400",children:[(0,s.jsx)("p",{className:"text-white",children:z("快捷文件","Quick Files")}),(0,s.jsxs)("div",{className:"mt-3 grid gap-2",children:[(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-left text-slate-200",onClick:()=>void tN("shellcrash-yamls","config.yaml"),children:"config.yaml"}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-left text-slate-200",onClick:()=>void tN("shellcrash-configs","ShellCrash.cfg"),children:"ShellCrash.cfg"}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-left text-slate-200",onClick:()=>void tN("shellcrash-configs","servers.list"),children:"servers.list"}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-left text-slate-200",onClick:()=>void tN("shellcrash-configs","command.env"),children:"command.env"})]})]})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-8",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-white",children:z("ShellCrash 文件编辑器","ShellCrash Editor")}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:z("支持查看、修改、新建、删除,路径被限制在 ShellCrash 托管目录内。","View, edit, create and delete files inside managed ShellCrash roots.")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)("label",{className:"btn-focus rounded-xl border border-white/12 px-3 py-2 text-xs text-slate-100 ".concat(Z?"cursor-not-allowed opacity-40":""),children:["file:import"===Z?z("导入中...","Importing..."):z("导入/替换","Import/Replace"),(0,s.jsx)("input",{className:"hidden",disabled:!!Z,type:"file",accept:".yaml,.yml,.json,.cfg,.env,.list,.txt",onChange:e=>void tR(e)},e1)]}),(0,s.jsx)(y,{className:"bg-cyan-600",disabled:!eN||!!Z,onClick:()=>void tD(),children:"file:save"===Z?z("保存中...","Saving..."):z("保存","Save")})]})]}),(0,s.jsxs)("div",{className:"mt-4 grid gap-6 xl:grid-cols-[18rem,1fr]",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("select",{className:"w-full rounded-2xl border border-white/12 bg-slate-950/60 px-4 py-3 text-sm text-white",value:ef,onChange:e=>{ev(e.target.value),ey("")},children:ts.map(e=>(0,s.jsxs)("option",{value:e.root_id,children:[e.label," | ",e.file_count]},e.root_id))}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(y,{className:"bg-cyan-600",disabled:!!Z,onClick:()=>void tE(),children:z("新建","New")}),(0,s.jsx)(y,{className:"bg-rose-600",disabled:!eN||!!Z,onClick:()=>void tO(),children:z("删除","Delete")})]}),(0,s.jsx)("div",{className:"mt-4 space-y-2",children:ej.map(e=>(0,s.jsxs)("button",{className:"btn-focus w-full rounded-2xl border px-4 py-3 text-left ".concat(eN===e.path?"border-cyan-500/40 bg-cyan-500/10":"border-white/8 bg-black/20"),onClick:()=>ey(e.path),children:[(0,s.jsx)("div",{className:"truncate text-sm text-white",children:e.path}),(0,s.jsx)("div",{className:"mt-1 text-[11px] text-slate-500",children:w(e.size)})]},e.path))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"rounded-2xl border border-white/8 bg-black/20 px-4 py-3 font-mono text-[11px] text-slate-500",children:eN?"".concat(ef," / ").concat(eN):z("请选择文件","Pick a file")}),(0,s.jsx)("textarea",{className:"log-scroll mt-4 min-h-[32rem] w-full resize-y rounded-2xl border border-white/10 bg-black/45 p-4 font-mono text-xs leading-relaxed text-slate-200",spellCheck:!1,value:ek,onChange:e=>eC(e.target.value)})]})]})]})]}):null,"android"===M?(0,s.jsxs)("section",{className:"grid gap-6 xl:grid-cols-12",children:[(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-white",children:z("安卓设备中心","Android Device Center")}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:z("把设备发现、截图预览、ADB 动作和原始 web-scrcpy 放到一个模块里。","Combine discovery, preview, ADB actions and raw web-scrcpy in one module.")})]}),(0,s.jsx)(y,{className:"border border-white/12 bg-black/20",onClick:()=>void(async()=>{let e=await tf();e&&await Promise.all([tv(e),tw(e),tj(e)]),eq(Date.now())})(),children:z("刷新设备","Refresh")})]}),(0,s.jsxs)("div",{className:"mt-4 rounded-2xl border border-white/8 bg-black/20 p-4",children:[(0,s.jsx)("p",{className:"text-sm font-semibold text-white",children:z("已连接设备","Devices")}),eS&&0!==eD.length?(0,s.jsx)("div",{className:"mt-3 space-y-2",children:eD.map(e=>(0,s.jsxs)("button",{className:"btn-focus w-full rounded-2xl border px-4 py-3 text-left ".concat(eO===e.serial?"border-cyan-500/40 bg-cyan-500/10":"border-white/8 bg-black/20"),onClick:()=>{eR(e.serial),Promise.all([tv(e.serial),tw(e.serial),tj(e.serial)]),eq(Date.now())},children:[(0,s.jsx)("div",{className:"text-sm text-white",children:e.model||e.device||e.serial}),(0,s.jsxs)("div",{className:"mt-1 text-[11px] text-slate-500",children:[e.serial," | ",e.state]})]},e.serial))}):(0,s.jsx)("p",{className:"mt-3 text-sm text-slate-400",children:z("当前没有可用的 ADB 设备。","No active ADB device.")})]}),(0,s.jsxs)("div",{className:"mt-4 rounded-2xl border border-white/8 bg-black/20 p-4 text-xs text-slate-400",children:[(0,s.jsx)("p",{className:"text-white",children:z("设备状态","Device Status")}),(0,s.jsxs)("p",{className:"mt-2",children:[(null==eT?void 0:eT.brand)||"-"," ",(null==eT?void 0:eT.model)||"-"]}),(0,s.jsxs)("p",{className:"mt-2",children:["Android ",(null==eT?void 0:eT.android_version)||"-"," / SDK ",(null==eT?void 0:eT.sdk)||"-"]}),(0,s.jsx)("p",{className:"mt-2 whitespace-pre-wrap",children:(null==eT?void 0:eT.battery)||"-"}),(0,s.jsx)("p",{className:"mt-2 whitespace-pre-wrap",children:(null==eT?void 0:eT.resolution)||"-"}),(0,s.jsx)("p",{className:"mt-2 whitespace-pre-wrap",children:(null==eT?void 0:eT.focus)||"-"})]})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-8",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-white",children:z("屏幕预览与动作","Screen Preview and Actions")}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:z("预览图支持直接点按/双击/长按,配合 UI 节点和包管理形成更完整的安卓控制台。","The preview supports tap, double tap and long press, backed by UI nodes and package tools.")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(y,{className:"border border-white/12 ".concat("tap"===eX?"bg-cyan-600":"bg-black/20"),disabled:!eO||!!Z,onClick:()=>e$("tap"),children:z("点击","Tap")}),(0,s.jsx)(y,{className:"border border-white/12 ".concat("double_tap"===eX?"bg-cyan-600":"bg-black/20"),disabled:!eO||!!Z,onClick:()=>e$("double_tap"),children:z("双击","Double Tap")}),(0,s.jsx)(y,{className:"border border-white/12 ".concat("long_press"===eX?"bg-cyan-600":"bg-black/20"),disabled:!eO||!!Z,onClick:()=>e$("long_press"),children:z("长按","Long Press")}),(0,s.jsx)(y,{className:"border border-white/12 bg-black/20",disabled:!eO,onClick:()=>eq(Date.now()),children:z("刷新截图","Refresh Shot")})]})]}),(0,s.jsx)("div",{className:"mt-4 overflow-hidden rounded-3xl border border-white/8 bg-black/35 p-4",children:eO?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-3 text-xs text-slate-400",children:[(0,s.jsxs)("span",{children:[z("当前动作","Current action"),": ",tU]}),(0,s.jsxs)("span",{children:[z("分辨率","Resolution"),": ",(null==eT?void 0:eT.resolution)||"-"]}),(0,s.jsxs)("span",{children:[z("最近坐标","Last point"),": ",e0?"".concat(e0.x,", ").concat(e0.y):"-"]}),te?(0,s.jsx)("span",{className:"text-cyan-400/90",children:z("截图刷新中…","Refreshing…")}):null]}),e9?(0,s.jsxs)("div",{className:"mb-3 rounded-xl border border-rose-500/30 bg-rose-950/25 px-4 py-3 text-sm text-rose-100",children:[z("截图不可用:","Screenshot unavailable: "),e9]}):null,e8?(0,s.jsx)(a.default,{alt:"Android preview",className:"max-h-[min(70vh,48rem)] min-h-[14rem] w-full cursor-crosshair rounded-2xl object-contain bg-black",onClick:e=>void tA(e),src:e8,unoptimized:!0,width:(null==tx?void 0:tx.width)||1080,height:(null==tx?void 0:tx.height)||1920}):e9?null:(0,s.jsx)("div",{className:"flex min-h-[18rem] items-center justify-center rounded-2xl border border-dashed border-white/10 bg-black/30 text-sm text-slate-500",children:z("正在拉取截图…","Fetching screenshot…")})]}):(0,s.jsx)("div",{className:"flex min-h-[18rem] items-center justify-center rounded-2xl border border-dashed border-white/10 bg-black/20 text-sm text-slate-500",children:z("当前没有可用的 ADB 设备。","No active ADB device.")})}),(0,s.jsxs)("div",{className:"mt-6 grid gap-6 xl:grid-cols-3",children:[(0,s.jsxs)("div",{className:"rounded-3xl border border-white/8 bg-black/20 p-5",children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:z("快捷控制","Quick Controls")}),(0,s.jsxs)("div",{className:"mt-4 grid grid-cols-3 gap-2",children:[[["HOME","KEYCODE_HOME"],["BACK","KEYCODE_BACK"],["RECENTS","KEYCODE_APP_SWITCH"],["POWER","KEYCODE_POWER"],["NOTIFY","KEYCODE_NOTIFICATION"],["VOL+","KEYCODE_VOLUME_UP"],["VOL-","KEYCODE_VOLUME_DOWN"]].map(e=>{let[t,l]=e;return(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 bg-slate-950/50 px-3 py-3 text-xs text-slate-100",disabled:!eO||!!Z,onClick:()=>void tT("key",{keycode:l}),children:t},t)}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 bg-slate-950/50 px-3 py-3 text-xs text-slate-100",disabled:!eO||!!Z,onClick:()=>void tT("wake"),children:"WAKE"}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 bg-slate-950/50 px-3 py-3 text-xs text-slate-100",disabled:!eO||!!Z,onClick:()=>void tT("rotate",{rotation:"0"}),children:"Portrait"}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 bg-slate-950/50 px-3 py-3 text-xs text-slate-100",disabled:!eO||!!Z,onClick:()=>void tT("rotate",{rotation:"1"}),children:"Landscape"})]}),(0,s.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:["up","down","left","right"].map(e=>(0,s.jsxs)("button",{className:"btn-focus rounded-xl border border-white/10 bg-slate-950/50 px-3 py-3 text-xs uppercase text-slate-100",disabled:!eO||!!Z,onClick:()=>void tT("swipe",{direction:e}),children:["Swipe ",e]},e))})]}),(0,s.jsxs)("div",{className:"rounded-3xl border border-white/8 bg-black/20 p-5",children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:z("输入与跳转","Input and Launch")}),(0,s.jsx)("textarea",{className:"mt-4 min-h-[6rem] w-full rounded-2xl border border-white/10 bg-black/45 p-4 text-sm text-slate-200",placeholder:z("输入要发送到安卓输入框的文字","Text to send to Android"),value:ez,onChange:e=>eF(e.target.value)}),(0,s.jsx)(y,{className:"mt-3 bg-cyan-600",disabled:!ez.trim()||!eO||!!Z,onClick:()=>void tT("text",{text:ez}),children:z("发送文本","Send Text")}),(0,s.jsx)("input",{className:"mt-4 w-full rounded-2xl border border-white/10 bg-black/45 px-4 py-3 text-sm text-slate-200",placeholder:"com.zhiliaoapp.musically",value:eW,onChange:e=>eK(e.target.value)}),(0,s.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[(0,s.jsx)(y,{className:"bg-emerald-600",disabled:!eW.trim()||!eO||!!Z,onClick:()=>void tT("launch_package",{package:eW}),children:z("启动","Launch")}),(0,s.jsx)(y,{className:"bg-amber-600",disabled:!eW.trim()||!eO||!!Z,onClick:()=>void tT("force_stop",{package:eW}),children:z("停应用","Stop App")}),(0,s.jsx)(y,{className:"bg-rose-600",disabled:!eW.trim()||!eO||!!Z,onClick:()=>void tT("clear_app",{package:eW}),children:z("清数据","Clear Data")})]}),(0,s.jsx)("input",{className:"mt-4 w-full rounded-2xl border border-white/10 bg-black/45 px-4 py-3 text-sm text-slate-200",placeholder:"https://www.tiktok.com",value:eH,onChange:e=>eY(e.target.value)}),(0,s.jsx)(y,{className:"mt-3 bg-violet-600",disabled:!eH.trim()||!eO||!!Z,onClick:()=>void tT("open_url",{url:eH}),children:z("打开链接","Open URL")})]}),(0,s.jsxs)("div",{className:"rounded-3xl border border-white/8 bg-black/20 p-5",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:z("应用工作台","App Workspace")}),(0,s.jsx)(y,{className:"border border-white/12 bg-black/20",disabled:!eO||!!Z,onClick:()=>void tw(eO),children:z("刷新UI","Refresh UI")})]}),(0,s.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:[["TikTok","com.zhiliaoapp.musically"],["Chrome","com.android.chrome"],["Settings","com.android.settings"],["YouTube","com.google.android.youtube"],["Play","com.android.vending"]].map(e=>{let[t,l]=e;return(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 bg-slate-950/50 px-3 py-2 text-xs text-slate-100",disabled:!eO||!!Z,onClick:()=>{eK(l),tT("launch_package",{package:l})},children:t},l)})}),(0,s.jsxs)("div",{className:"mt-4 flex gap-2",children:[(0,s.jsx)("input",{className:"w-full rounded-2xl border border-white/10 bg-black/45 px-4 py-3 text-sm text-slate-200",placeholder:z("搜索包名,例如 tiktok","Search package, e.g. tiktok"),value:eM,onChange:e=>eB(e.target.value)}),(0,s.jsx)(y,{className:"bg-cyan-600",disabled:!eO||!!Z,onClick:()=>void tj(eO),children:z("搜索","Search")})]}),(0,s.jsx)("div",{className:"mt-4 space-y-2",children:0===eI.length?(0,s.jsx)("div",{className:"rounded-2xl border border-dashed border-white/10 px-4 py-6 text-sm text-slate-500",children:z("还没有查询结果。","No package results yet.")}):eI.slice(0,8).map(e=>(0,s.jsxs)("div",{className:"rounded-2xl border border-white/8 bg-slate-950/30 p-3",children:[(0,s.jsx)("div",{className:"text-sm text-white",children:e.label||e.package.split(".").pop()}),(0,s.jsx)("div",{className:"mt-1 truncate font-mono text-[11px] text-slate-500",children:e.package}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-xs text-slate-200",disabled:!eO||!!Z,onClick:()=>{eK(e.package),tT("launch_package",{package:e.package})},children:z("启动","Launch")}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-xs text-slate-200",disabled:!eO||!!Z,onClick:()=>{eK(e.package),tT("force_stop",{package:e.package})},children:z("停应用","Stop")}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-xs text-slate-200",disabled:!eO||!!Z,onClick:()=>{eK(e.package),tT("clear_app",{package:e.package})},children:z("清数据","Clear")})]})]},e.package))})]})]}),(0,s.jsxs)("div",{className:"mt-6 grid gap-6 xl:grid-cols-[0.95fr,1.05fr]",children:[(0,s.jsxs)("div",{className:"rounded-3xl border border-white/8 bg-black/20 p-5",children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:"ADB Shell"}),(0,s.jsxs)("div",{className:"mt-4 flex flex-col gap-3 lg:flex-row",children:[(0,s.jsx)("input",{className:"w-full rounded-2xl border border-white/10 bg-black/45 px-4 py-3 text-sm text-slate-200",placeholder:"input keyevent KEYCODE_HOME",value:eJ,onChange:e=>eZ(e.target.value)}),(0,s.jsx)(y,{className:"bg-amber-600",disabled:!eJ.trim()||!eO||!!Z,onClick:()=>void tT("shell",{command:eJ}),children:z("执行命令","Run Command")})]}),(0,s.jsx)("pre",{className:"log-scroll mt-4 min-h-[14rem] rounded-2xl border border-white/10 bg-black/45 p-4 font-mono text-[11px] text-slate-200",children:eV||z("动作结果会显示在这里。","Action output will appear here.")})]}),(0,s.jsxs)("div",{className:"rounded-3xl border border-white/8 bg-black/20 p-5",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:z("UI 节点","UI Nodes")}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:z("用 uiautomator 抓当前页面结构,快速定位可点击元素。","Inspect the current UI hierarchy and act on clickable nodes.")})]}),(0,s.jsx)(y,{className:"border border-white/12 bg-black/20",disabled:!eO||!!Z,onClick:()=>void tw(eO),children:z("刷新节点","Refresh Nodes")})]}),(0,s.jsx)("div",{className:"mt-4 space-y-3",children:0===eA.length?(0,s.jsx)("div",{className:"rounded-2xl border border-dashed border-white/10 px-4 py-6 text-sm text-slate-500",children:z("还没有抓到 UI 节点。","No UI nodes yet.")}):eA.slice(0,12).map((e,t)=>(0,s.jsxs)("div",{className:"rounded-2xl border border-white/8 bg-slate-950/30 p-3",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm text-white",children:e.label||e.resource_id||e.class_name||"node"}),(0,s.jsx)("div",{className:"mt-1 text-[11px] text-slate-500",children:e.resource_id||e.class_name||"-"}),(0,s.jsxs)("div",{className:"mt-1 text-[11px] text-slate-500",children:[e.bounds," | ",e.center_x,",",e.center_y]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-xs text-slate-200",disabled:!eO||!!Z,onClick:()=>void tT("tap",{x:e.center_x,y:e.center_y}),children:z("点击","Tap")}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-xs text-slate-200",disabled:!eO||!!Z,onClick:()=>void tT("long_press",{x:e.center_x,y:e.center_y,duration:750}),children:z("长按","Long Press")})]})]}),e.text||e.content_desc?(0,s.jsx)("div",{className:"mt-2 whitespace-pre-wrap text-xs text-slate-400",children:e.text||e.content_desc}):null]},"".concat(e.resource_id||e.label,"-").concat(t)))})]})]}),td?(0,s.jsxs)("div",{className:"mt-6 rounded-3xl border border-white/8 bg-black/20 p-5",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:"ws-scrcpy"}),(0,s.jsx)("a",{className:"btn-focus rounded-xl border border-white/12 px-3 py-2 text-xs text-slate-200",href:td,target:"_blank",rel:"noreferrer",children:z("新标签全屏打开","Open full tab")})]}),(0,s.jsx)("p",{className:"mt-2 text-xs leading-relaxed text-slate-500",children:z(tc?"内嵌若黑屏:多为 WebSocket 未连上或服务未启动。请先确认「系统服务」里 android_panel 在线,并尝试新标签打开;Neko(Chromium)实例通常为 ".concat(tc,"。"):"内嵌若黑屏:多为 WebSocket 未连上或服务未启动。请先确认「系统服务」里 android_panel 在线,并尝试新标签打开;Neko(Chromium)在 ENABLE_NEKO=1 且容器运行后一般为 9200 端口。",tc?"Black iframe: often WebSocket or service down. Check android_panel in Services, try opening in a new tab; Neko Chromium instances are usually on ".concat(tc,"."):"Black iframe: often WebSocket or service down. Check android_panel in Services, try opening in a new tab; Neko Chromium is often :9200 when ENABLE_NEKO=1 and the container is up.")}),(0,s.jsx)("iframe",{className:"mt-4 h-[30rem] w-full rounded-2xl border border-white/10 bg-black",src:td,title:"ws-scrcpy"})]}):null]})]}):null,"config"===M?(0,s.jsxs)("section",{className:"grid gap-6 xl:grid-cols-12",children:[(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-white",children:z("配置中心","Config Center")}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:z("系统级与业务级配置文件分目录托管,避免大杂烩。","System and business configs are isolated by managed roots.")})]}),(0,s.jsx)(y,{className:"border border-white/12 bg-black/20",onClick:()=>void tg(ef),children:z("刷新","Refresh")})]}),(0,s.jsx)("select",{className:"mt-4 w-full rounded-2xl border border-white/12 bg-slate-950/60 px-4 py-3 text-sm text-white",value:ef,onChange:e=>{ev(e.target.value),ey("")},children:tL.map(e=>(0,s.jsxs)("option",{value:e.root_id,children:[e.label," | ",e.file_count]},e.root_id))}),tl?(0,s.jsxs)("div",{className:"mt-4 rounded-2xl border border-white/8 bg-black/20 p-4 text-xs text-slate-400",children:[(0,s.jsx)("p",{className:"text-white",children:tl.label}),(0,s.jsx)("p",{className:"mt-2",children:tl.description}),(0,s.jsx)("p",{className:"mt-2 font-mono text-[11px] text-slate-500",children:tl.path})]}):null,(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(y,{className:"bg-cyan-600",disabled:!!Z,onClick:()=>void tE(),children:z("新建","New")}),(0,s.jsx)(y,{className:"bg-rose-600",disabled:!eN||!!Z,onClick:()=>void tO(),children:z("删除","Delete")})]}),(0,s.jsx)("div",{className:"mt-4 space-y-2",children:ej.map(e=>(0,s.jsxs)("button",{className:"btn-focus w-full rounded-2xl border px-4 py-3 text-left ".concat(eN===e.path?"border-cyan-500/40 bg-cyan-500/10":"border-white/8 bg-black/20"),onClick:()=>ey(e.path),children:[(0,s.jsx)("div",{className:"truncate text-sm text-white",children:e.path}),(0,s.jsxs)("div",{className:"mt-1 text-[11px] text-slate-500",children:[w(e.size)," | ",new Date(1e3*e.mtime).toLocaleString("zh"===A?"zh-CN":"en-US",{hour12:!1})]})]},e.path))})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-8",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-white",children:z("文件编辑器","Config Editor")}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:z("仅允许编辑受管目录中的配置文件。","Only approved config roots are editable.")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)("label",{className:"btn-focus rounded-xl border border-white/12 px-3 py-2 text-xs text-slate-100 ".concat(Z?"cursor-not-allowed opacity-40":""),children:["file:import"===Z?z("导入中...","Importing..."):z("导入/替换","Import/Replace"),(0,s.jsx)("input",{className:"hidden",disabled:!!Z,type:"file",accept:".yaml,.yml,.json,.cfg,.env,.list,.txt,.ini",onChange:e=>void tR(e)},"config-".concat(e1))]}),(0,s.jsx)(y,{className:"bg-cyan-600",disabled:!eN||!!Z,onClick:()=>void tD(),children:"file:save"===Z?z("保存中...","Saving..."):z("保存","Save")})]})]}),(0,s.jsx)("div",{className:"mt-4 rounded-2xl border border-white/8 bg-black/20 px-4 py-3 font-mono text-[11px] text-slate-500",children:eN?"".concat(ef," / ").concat(eN):z("请选择文件","Pick a file")}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(m,{lang:A,rootId:ef,filePath:eN,fileContent:ek,refreshKey:e5,busy:Z,fetchJson:tm,notify:th,onChangeContent:eC,onRefreshListing:()=>tg(ef,eN)})}),(0,s.jsx)("textarea",{className:"log-scroll mt-4 min-h-[32rem] w-full resize-y rounded-2xl border border-white/10 bg-black/45 p-4 font-mono text-xs leading-relaxed text-slate-200",spellCheck:!1,value:ek,onChange:e=>eC(e.target.value)})]})]}):null]})]}),R?null:(0,s.jsx)("nav",{className:"fixed bottom-0 left-0 right-0 z-40 flex justify-around border-t border-white/15 bg-black/75 py-1.5 backdrop-blur-lg [html[data-theme=light]_&]:border-slate-200/60 [html[data-theme=light]_&]:bg-white/90 md:hidden",style:{paddingBottom:"max(0.35rem, env(safe-area-inset-bottom))"},"aria-label":z("主导航","Main nav"),children:f.map(e=>(0,s.jsxs)("button",{type:"button",className:"btn-focus flex min-w-0 flex-1 flex-col items-center gap-0.5 rounded-xl px-1 py-1 text-[10px] font-medium ".concat(M===e?"text-cyan-300 [html[data-theme=light]_&]:text-cyan-700":"text-slate-400 [html[data-theme=light]_&]:text-slate-600"),onClick:()=>B(e),children:[(0,s.jsx)("span",{className:"text-lg leading-none","aria-hidden":!0,children:tM[e]}),(0,s.jsx)("span",{className:"truncate",children:{overview:z("总览","Home"),business:z("业务","Biz"),modules:z("模块","Mods"),shellcrash:"SC",android:z("安卓","Droid"),config:z("配置","Cfg")}[e]})]},e))})]})}},1387:function(e,t,l){function s(e,t,l){return"string"==typeof(null==l?void 0:l.error)&&l.error.trim()||"string"==typeof(null==l?void 0:l.message)&&l.message.trim()||"string"==typeof(null==l?void 0:l.detail)&&l.detail.trim()||function(e){let t=e.replace(/\s+/g," ").trim();return t?t.length<=240?t:"".concat(t.slice(0,237),"..."):""}(t)||function(e){var t;let l=(null===(t=e.statusText)||void 0===t?void 0:t.trim())?" ".concat(e.statusText.trim()):"";return"HTTP ".concat(e.status).concat(l)}(e)}async function a(e,t){let l=await fetch(e,{cache:"no-store",...t}),a=(await l.text()).trim(),r=null;if(a)try{r=JSON.parse(a)}catch(t){if(!l.ok)throw Error(s(l,a,null));throw Error("Invalid JSON response from ".concat(e))}if(!l.ok)throw Error(s(l,a,r));return null!==r?r:{}}async function r(e){let t=(await e.text()).trim(),l=null;if(t)try{l=JSON.parse(t)}catch(e){l=null}return s(e,t,l)}l.d(t,{N:function(){return a},e:function(){return r}})},90:function(e,t,l){l.d(t,{O0:function(){return a},Tc:function(){return n},U_:function(){return r}});let s=/^neko_browser(?:_(\d+))?$/i;function a(e){let t=new Map;for(let[l,a]of Object.entries(null!=e?e:{})){let e=l.match(s),r=a.trim();if(!e||!r)continue;let n="neko_browser"===l?1:Number(e[1]||1),i={id:n,key:l,label:"Neko ".concat(n),url:r,port:function(e){try{return new URL(e,"http://127.0.0.1").port||""}catch(e){return""}}(r)},o=t.get(n),c="neko_browser"!==l;(!o||c)&&t.set(n,i)}return Array.from(t.values()).sort((e,t)=>e.id-t.id)}function r(e,t){return e.length?!Number.isInteger(t)||t<0?{link:e[0],fallback:!1}:t<e.length?{link:e[t],fallback:!1}:{link:e[0],fallback:!0}:{link:null,fallback:!1}}function n(e){let t=e.map(e=>e.port).filter(Boolean);return t.length?t.map(e=>":".concat(e)).join(" / "):""}},8401:function(e,t,l){l.d(t,{p:function(){return s}});function s(e){let t=e.trim();if(!t)return t;try{let e=new URL(t,window.location.origin),l=e.hostname,s=window.location.hostname;if("0.0.0.0"===l||"::"===l||"[::]"===l)return e.hostname=s||l,e.toString();if(("127.0.0.1"===l||"localhost"===l)&&s&&"127.0.0.1"!==s&&"localhost"!==s)return e.hostname=s,e.toString();if(l.endsWith(".local")&&"8001"===e.port)return"".concat(e.pathname||"/").concat(e.search).concat(e.hash);if(l.endsWith(".local")&&s&&s!==l)return e.hostname=s,e.toString();return t}catch(e){return t}}}}]); |