sh2/d2ypp2/web-console/out/_next/static/chunks/app/page-961397b3cef5e0c4.js
2026-06-02 03:19:23 -05:00

1 line
209 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{5052:function(e,t,n){Promise.resolve().then(n.bind(n,1499))},1499:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ts}});var s=n(7437),l=n(6247),i=n(7586),r=n(4401),a=n(6137),o=n(4372),c=n(5901),d=n(3388),x=n(3420),u=n(8728),m=n(2023),h=n(407),p=n(6840),b=n(7226),g=n(5929),f=n(7945),v=n(1817),y=n(7168),w=n(4822),j=n(4428),N=n(1723),k=n(2926),z=n(4286),S=n(7265),_=n(8867),C=n(8406),R=n(7580),P=n(2489),L=n(2265);function M(e){let{tr:t}=e,l=(0,L.useRef)(null);return(0,L.useEffect)(()=>{let e;if(!l.current)return;let t=!1,s=0;return n.e(689).then(n.bind(n,1448)).then(n=>{if(t||!l.current)return;let i=l.current,r=Math.max(i.clientWidth,280),a=Math.max(i.clientHeight,200),o=new n.Scene,c=new n.PerspectiveCamera(48,r/a,.1,80);c.position.set(0,1.1,7.2);let d=new n.WebGLRenderer({antialias:!0,alpha:!0});d.setPixelRatio(Math.min(window.devicePixelRatio,2)),d.setSize(r,a),d.setClearColor(0,0),i.appendChild(d.domElement);let x=new n.HemisphereLight(16762092,4482815,.85);o.add(x);let u=new n.DirectionalLight(16777215,.9);u.position.set(4,8,6),o.add(u);let m=new n.PointLight(8189439,.6,20);m.position.set(-3,2,-2),o.add(m);let h=new n.Group,p=new n.Mesh(new n.BoxGeometry(3.2,.35,2.2),new n.MeshStandardMaterial({color:2762048,metalness:.15,roughness:.55}));p.position.y=-.85,h.add(p);let b=new n.Mesh(new n.TorusGeometry(.72,.09,12,48),new n.MeshStandardMaterial({color:16724821,emissive:4456465,metalness:.35,roughness:.25}));b.rotation.x=Math.PI/2,b.position.set(-.85,.15,.2),h.add(b);let g=new n.Mesh(new n.ConeGeometry(.35,.5,3),new n.MeshStandardMaterial({color:16777215,emissive:2236962,metalness:.2,roughness:.3}));g.rotation.z=-Math.PI/2,g.rotation.y=Math.PI,g.position.set(-.55,.18,.2),h.add(g);let f=new n.Mesh(new n.CylinderGeometry(.22,.28,.95,20),new n.MeshStandardMaterial({color:2487534,emissive:340024,metalness:.25,roughness:.35}));f.position.set(1.05,.35,-.15),f.rotation.z=.12,h.add(f);let v=new n.Mesh(new n.SphereGeometry(.26,16,16),new n.MeshStandardMaterial({color:16657493,emissive:2229520,metalness:.2,roughness:.4}));v.position.set(1.05,.92,-.15),h.add(v);let y=new n.BufferGeometry,w=new Float32Array(360);for(let e=0;e<120;e++)w[3*e]=(Math.random()-.5)*14,w[3*e+1]=(Math.random()-.3)*8,w[3*e+2]=(Math.random()-.5)*8-2;y.setAttribute("position",new n.BufferAttribute(w,3));let j=new n.Points(y,new n.PointsMaterial({color:16777215,size:.06,transparent:!0,opacity:.7}));o.add(j),o.add(h);let N=performance.now(),k=()=>{if(t)return;s=requestAnimationFrame(k);let e=(performance.now()-N)/1e3;h.rotation.y=.25*Math.sin(.35*e)+.12*e,h.position.y=.06*Math.sin(.9*e),b.rotation.z=.4*e,j.rotation.y=.02*e,d.render(o,c)};k();let z=new ResizeObserver(()=>{if(!l.current||t)return;let e=Math.max(l.current.clientWidth,280),n=Math.max(l.current.clientHeight,200);c.aspect=e/n,c.updateProjectionMatrix(),d.setSize(e,n)});z.observe(i),e=()=>{cancelAnimationFrame(s),z.disconnect(),d.dispose(),y.dispose(),d.domElement.parentNode===i&&i.removeChild(d.domElement)}}),()=>{t=!0,cancelAnimationFrame(s),null==e||e()}},[]),(0,s.jsxs)("div",{className:"flex h-full min-h-[14rem] flex-col",children:[(0,s.jsx)("p",{className:"mb-2 px-1 text-[10px] font-medium uppercase tracking-wider text-fuchsia-200/80",children:t("直播工作室 \xb7 3D","Live studio \xb7 3D")}),(0,s.jsx)("div",{ref:l,className:"relative min-h-[12rem] flex-1 overflow-hidden rounded-xl bg-gradient-to-b from-fuchsia-950/40 to-cyan-950/20 ring-1 ring-white/10"})]})}var T=n(9170),U=n(2246),E=n(4794),I=n(221),A=n(8124),D=n(2101),Z=n(3651),O=n(9985),H=n(6362),B=n(3468),K=n(6443),W=n(5287),F=n(3276),Y=n(9227),G=n(257),q=n(1387);class J{reset(){if(this.buf=new Uint8Array(0),this.sps=null,this.pps=null,this.configured=!1,this.configuring=!1,this.ts=0,this.decoder){try{this.decoder.close()}catch(e){}this.decoder=null}}push(e){let t=new Uint8Array(e.byteLength);t.set(new Uint8Array(e)),this.buf=function(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}(this.buf,t),this.drainAvcc()}drainAvcc(){let e=this.buf,t=0;for(;t+4<=e.length;){var n;let s=e[n=t]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3];if(s<=0||s>6291456){this.buf=new Uint8Array(e.subarray(t+1)),t=0;continue}if(t+4+s>e.length)break;let l=e.subarray(t+4,t+4+s);t+=4+s,this.handleNal(l)}t>0&&(this.buf=new Uint8Array(e.subarray(t)))}handleNal(e){if(e.length<2)return;let t=31&e[0];if(7===t?this.sps=new Uint8Array(e):8===t&&(this.pps=new Uint8Array(e)),this.sps&&this.pps&&!this.configured&&!this.configuring&&this.configure(),!this.configured||!this.decoder||1!==t&&5!==t&&7!==t&&8!==t||7===t||8===t)return;let n=new Uint8Array(4+e.length);new DataView(n.buffer).setUint32(0,e.length,!1),n.set(e,4);try{let e=new EncodedVideoChunk({type:5===t?"key":"delta",timestamp:this.ts,data:n});this.ts+=33333,this.decoder.decode(e)}catch(e){this.onDecodeError(e.message||String(e))}}async configure(){if(this.sps&&this.pps&&!this.configured&&!this.configuring){this.configuring=!0;try{let e=function(e,t){let n=e.subarray(1),s=t.subarray(1),l=new Uint8Array(11+n.length+3+s.length),i=0;return l[i++]=1,l[i++]=e[1],l[i++]=e[2],l[i++]=e[3],l[i++]=255,l[i++]=225,l[i++]=n.length>>8&255,l[i++]=255&n.length,l.set(n,i),i+=n.length,l[i++]=1,l[i++]=s.length>>8&255,l[i++]=255&s.length,l.set(s,i),l}(this.sps,this.pps),t=function(e){let t=e=>e.toString(16).padStart(2,"0").toUpperCase();return"avc1.".concat(t(e[1])).concat(t(e[2])).concat(t(e[3]))}(this.sps),n=new VideoDecoder({output:e=>{var t;let n=this.canvas.getContext("2d");if(!n){e.close();return}(this.canvas.width!==e.displayWidth||this.canvas.height!==e.displayHeight)&&(this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight),n.drawImage(e,0,0),e.close(),null===(t=this.onFrame)||void 0===t||t.call(this)},error:e=>this.onDecodeError(String(e.message||e))});await n.configure({codec:t,description:e,optimizeForLatency:!0}),this.decoder=n,this.configured=!0}catch(e){this.onDecodeError(e.message||String(e))}finally{this.configuring=!1}}}constructor(e,t,n){this.canvas=e,this.onDecodeError=t,this.onFrame=n,this.buf=new Uint8Array(0),this.decoder=null,this.configured=!1,this.configuring=!1,this.ts=0,this.sps=null,this.pps=null}}function V(){return"undefined"!=typeof VideoDecoder&&"undefined"!=typeof VideoFrame}let X="live-hub-adb-bookmarks-v1";function $(e,t,n){let s,l,i,r;let a=e.getBoundingClientRect(),o=e.width,c=e.height;if(!o||!c)return null;let d=a.width/a.height,x=o/c;x>d?(s=a.width,l=a.width/x,i=0,r=(a.height-l)/2):(l=a.height,s=a.height*x,i=(a.width-s)/2,r=0);let u=t-a.left-i,m=n-a.top-r;return u<0||m<0||u>s||m>l?null:{x:Math.max(0,Math.min(o-1,Math.round(u/s*o))),y:Math.max(0,Math.min(c-1,Math.round(m/l*c)))}}function Q(e,t,n){let s,l,i,r;let a=e.getBoundingClientRect(),o=e.naturalWidth,c=e.naturalHeight;if(!o||!c)return null;let d=a.width/a.height,x=o/c;x>d?(s=a.width,l=a.width/x,i=0,r=(a.height-l)/2):(l=a.height,s=a.height*x,i=(a.width-s)/2,r=0);let u=t-a.left-i,m=n-a.top-r;return u<0||m<0||u>s||m>l?null:{x:Math.max(0,Math.min(o-1,Math.round(u/s*o))),y:Math.max(0,Math.min(c-1,Math.round(m/l*c)))}}let ee=[0,280,450,700,1100];function et(e){switch(e){case"usb":return{Icon:D.Z,zh:"USB",en:"USB",cls:"bg-amber-500/20 text-amber-100 ring-amber-500/35"};case"tcp":return{Icon:k.Z,zh:"网络",en:"TCP",cls:"bg-cyan-500/20 text-cyan-100 ring-cyan-500/35"};case"emulator":return{Icon:Z.Z,zh:"模拟器",en:"Emu",cls:"bg-fuchsia-500/20 text-fuchsia-100 ring-fuchsia-500/35"};default:return{Icon:d.Z,zh:"?",en:"?",cls:"bg-zinc-600/30 text-zinc-400"}}}let en="https://github.com/Genymobile/scrcpy",es="https://github.com/viarotel-org/escrcpy";function el(e,t){let n=t.startsWith("/")?t:"/".concat(t),s=(e||"").trim().replace(/\/$/,"");return s?"".concat(s).concat(n):n}function ei(e){var t;let{t:n,apiBase:l,fetchJson:i,serial:r,devices:a,setSerial:o,adbAvailable:c,lock:x,overview:u,onAndroidAction:h,notify:p,onRefreshDevices:b}=e,[g,f]=(0,L.useState)(0),[v,w]=(0,L.useState)(450),[j,N]=(0,L.useState)(!1),[k,z]=(0,L.useState)(null),[S,_]=(0,L.useState)(null),[C,R]=(0,L.useState)(!0),[P,M]=(0,L.useState)(""),[T,U]=(0,L.useState)(""),[E,I]=(0,L.useState)("37777"),[A,D]=(0,L.useState)(""),[Z,ei]=(0,L.useState)(!1),[er,ea]=(0,L.useState)([]),[eo,ec]=(0,L.useState)(!1),[ed,ex]=(0,L.useState)(null),[eu,em]=(0,L.useState)(!1),[eh,ep]=(0,L.useState)(null),[eb,eg]=(0,L.useState)(null),[ef,ev]=(0,L.useState)(!0),ey=(0,L.useRef)(null),ew=(0,L.useRef)(null),ej=(0,L.useRef)(null),eN=(0,L.useRef)(null),ek=(0,L.useRef)(null),ez=(0,L.useRef)(null),eS=(0,L.useRef)(0),e_=(0,L.useRef)(!1),eC=(0,L.useRef)(null),eR=(0,L.useRef)(!1),eP=null===(t=a.find(e=>e.serial===r))||void 0===t?void 0:t.transport,eL=v>0,eM=r?"".concat(el(l,"/android/screenshot"),"?serial=").concat(encodeURIComponent(r),"&ts=").concat(g).concat(eL?"&fast=1":""):"",eT=(0,L.useCallback)(()=>{f(e=>e+1)},[]),eU=(0,L.useCallback)(()=>{null!=eC.current&&(window.clearTimeout(eC.current),eC.current=null)},[]);(0,L.useEffect)(()=>{let e=()=>ev("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,L.useEffect)(()=>{try{let e=window.localStorage.getItem(X);if(e){let t=JSON.parse(e);Array.isArray(t)&&ea(t.map(String).filter(Boolean).slice(0,24))}}catch(e){}},[]);let eE=e=>{let t=e.trim();if(!t)return;let s=[t,...er.filter(e=>e!==t)].slice(0,16);ea(s);try{window.localStorage.setItem(X,JSON.stringify(s))}catch(e){}p(n("已保存快捷地址","Saved quick address"))};(0,L.useEffect)(()=>{if(!r||!c){_(null);return}let e=!1;return(async()=>{try{let t=await (0,q.N)("".concat(el(l,"/android/display_metrics"),"?serial=").concat(encodeURIComponent(r)));if(e)return;"number"==typeof t.width&&"number"==typeof t.height&&_({width:t.width,height:t.height})}catch(e){}})(),()=>{e=!0}},[l,c,r]),(0,L.useEffect)(()=>{if(!c||!r||v<=0||eo||!ef)return;let e=window.setInterval(()=>f(e=>e+1),v);return()=>clearInterval(e)},[c,v,ef,r,eo]),(0,L.useEffect)(()=>{ef&&c&&r&&!eo&&eT()},[c,eT,ef,r,eo]),(0,L.useEffect)(()=>{if(!c){eg(null);return}let e=!1;return(async()=>{try{let t=await (0,q.N)(el(l,"/android/scrcpy/info"));e||eg(t)}catch(e){}})(),()=>{e=!0}},[l,c]),(0,L.useEffect)(()=>{eo||ep(null)},[eo]),(0,L.useEffect)(()=>{ex(null),e_.current=!1},[r]),(0,L.useEffect)(()=>{let e=a.find(e=>e.serial===r),t=!!(r&&ed===r);if(c&&r&&(null==e?void 0:e.state)==="device"&&(null==eb?void 0:eb.server_jar)&&V()&&!t){ec(!0),w(0);return}if(t||!r||!c||eb&&!eb.server_jar||!V()||e&&"device"!==e.state){ec(!1);return}},[r,a,c,eb,ed]),(0,L.useEffect)(()=>{if(!eo||!r||!c){var e,t;eU(),e_.current=!0,eR.current=!1,null===(e=eN.current)||void 0===e||e.close(),eN.current=null,null===(t=ek.current)||void 0===t||t.reset(),ek.current=null,em(!1);return}if(!V()){ep(n("当前浏览器不支持 WebCodecs H.264","WebCodecs H.264 not supported in this browser")),ec(!1);return}let s=ej.current;if(!s)return;let i=e=>{var t;eU(),e_.current=!0,null===(t=eN.current)||void 0===t||t.close(),ep(e),ec(!1),w(450),ex(r),window.setTimeout(()=>eT(),120)},a=new J(s,e=>i("".concat(n("实时画面解码失败,已切回截图模式","Live stream decode failed, using screenshot mode"),": ").concat(e)),()=>{eR.current=!0,eU()});ek.current=a,e_.current=!1,eR.current=!1;let o=new WebSocket(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1920,s=(function(e){let t=(e||"").trim();if(t)try{let e=new URL(t,window.location.href),n="https:"===e.protocol?"wss:":"ws:";return"".concat(n,"//").concat(e.host)}catch(e){}let n=void 0!==G&&G.env.NEXT_PUBLIC_API_URL?String(G.env.NEXT_PUBLIC_API_URL).trim():"";if(n)try{let e=new URL(n,window.location.href),t="https:"===e.protocol?"wss:":"ws:";return"".concat(t,"//").concat(e.host)}catch(e){}let s=window.location.port;if("3000"===s||"3001"===s){let e=window.location.hostname||"127.0.0.1";return"ws://".concat(e,":").concat("8001")}let{protocol:l,host:i}=window.location;return"".concat("https:"===l?"wss:":"ws:","//").concat(i)})(e).replace(/\/$/,""),l=new URLSearchParams({serial:t,max_size:String(n)});return"".concat(s,"/android/scrcpy/ws?").concat(l.toString())}(l,r));return eN.current=o,o.binaryType="arraybuffer",o.onopen=()=>{em(!0),ep(null),eU(),eC.current=window.setTimeout(()=>{eR.current||i(n("实时画面无首帧,已切回截图模式","No first live frame, using screenshot mode"))},5200)},o.onmessage=e=>{var t;if("string"==typeof e.data){try{let t=JSON.parse(e.data);t.error&&ep(t.error)}catch(e){}return}null===(t=ek.current)||void 0===t||t.push(e.data)},o.onerror=()=>{ep(n("WebSocket 异常","WebSocket error"))},o.onclose=()=>{var e;em(!1),null===(e=ek.current)||void 0===e||e.reset(),ek.current=null,eU(),eo&&!e_.current&&i(n("实时画面连接失败,已切回截图模式","Live stream failed, using screenshot mode"))},()=>{eU(),e_.current=!0,eR.current=!1,o.close(),eN.current=null,a.reset(),ek.current===a&&(ek.current=null)}},[eo,r,c,l,eT,eU,n]),(0,L.useEffect)(()=>{r&&c&&(eS.current=0,f(e=>e+1))},[r,c]);let eI=async()=>{let e=P.trim();if(!e){p(n("填写 host:port","Enter host:port"));return}ei(!0);try{let t=await i("/android/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e})});p(t.message||(t.ok?"OK":n("连接结果见日志","See message"))),b(),eT()}catch(e){p(e.message)}finally{ei(!1)}},eA=async e=>{ei(!0);try{let t=await i("/android/disconnect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e})});p(t.message||"OK"),b()}catch(e){p(e.message)}finally{ei(!1)}},eD=async()=>{let e=T.trim(),t=parseInt(E,10)||37777,s=A.trim();if(!e||!s){p(n("填写配对 IP 与码","Host + code required"));return}ei(!0);try{let l=await i("/android/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({host:e,port:t,code:s})});p(l.message||(l.ok?n("配对成功后再点连接","Paired — now Connect"):"pair"))}catch(e){p(e.message)}finally{ei(!1)}},eZ=async e=>{if(!C||x||!c||!r)return;let t=ew.current;if(!t)return;let s=Q(t,e.clientX,e.clientY);if(!s)return;let l=Date.now(),i=ey.current;i&&l-i.t<320&&28>Math.abs(i.x-s.x)&&28>Math.abs(i.y-s.y)?(ey.current=null,await h("double_tap",{x:s.x,y:s.y}),p(n("双击","Double tap"))):(ey.current={t:l,x:s.x,y:s.y},await h("tap",{x:s.x,y:s.y})),eT()},eO=async e=>{if(e.preventDefault(),x||!c||!r)return;let t=ew.current;if(!t)return;let s=Q(t,e.clientX,e.clientY);s&&(await h("long_press",{x:s.x,y:s.y,duration:720}),p(n("长按","Long press")),eT())},eH=async e=>{if(!C||x||!c||!r)return;let t=ej.current;if(!t)return;let s=$(t,e.clientX,e.clientY);if(!s)return;let l=Date.now(),i=ey.current;i&&l-i.t<320&&28>Math.abs(i.x-s.x)&&28>Math.abs(i.y-s.y)?(ey.current=null,await h("double_tap",{x:s.x,y:s.y}),p(n("双击","Double tap"))):(ey.current={t:l,x:s.x,y:s.y},await h("tap",{x:s.x,y:s.y})),eo||eT()},eB=async e=>{if(e.preventDefault(),x||!c||!r)return;let t=ej.current;if(!t)return;let s=$(t,e.clientX,e.clientY);s&&(await h("long_press",{x:s.x,y:s.y,duration:720}),p(n("长按","Long press")),eo||eT())};if(!c)return(0,s.jsx)("div",{className:"rounded-2xl border border-amber-500/25 bg-amber-500/[0.06] p-6 text-center text-sm text-amber-200/90",children:n("宿主机未安装 adb,无法使用 Live 控制台。","adb is required for the Live console.")});let eK=et(eP),eW=eK.Icon;return(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-sky-500/20 bg-gradient-to-br from-sky-500/[0.08] via-zinc-950/80 to-zinc-900/90 p-4 ring-1 ring-white/[0.05]",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-white/[0.06] pb-3",children:[(0,s.jsx)(O.Z,{className:"h-4 w-4 text-sky-400"}),(0,s.jsx)("h4",{className:"text-sm font-semibold text-white",children:n("链路管理","Link manager")}),(0,s.jsx)("span",{className:"text-[10px] text-zinc-500",children:n("USB / Redroid :5555 / 无线调试(先配对再连接)","USB \xb7 Redroid :5555 \xb7 wireless (pair then connect)")})]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-3 lg:grid-cols-2",children:[(0,s.jsxs)("div",{className:"space-y-2 rounded-xl border border-white/[0.06] bg-black/35 p-3",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:"adb connect"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("input",{className:"min-w-[12rem] flex-1 rounded-lg border border-white/10 bg-black/50 px-3 py-2 font-mono text-xs text-zinc-200",placeholder:"192.168.1.10:5555",value:P,onChange:e=>M(e.target.value),onKeyDown:e=>"Enter"===e.key&&void eI()}),(0,s.jsx)("button",{type:"button",disabled:Z||x,onClick:()=>void eI(),className:"rounded-lg bg-sky-500/25 px-3 py-2 text-xs font-semibold text-sky-100 ring-1 ring-sky-400/40",children:Z?"…":"Connect"}),(0,s.jsx)("button",{type:"button",disabled:Z||x||!P.trim(),onClick:()=>eE(P),className:"rounded-lg border border-white/10 px-3 py-2 text-xs text-zinc-400 hover:text-zinc-200",children:n("存书签","Pin")})]}),er.length?(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5 pt-1",children:er.map(e=>(0,s.jsx)("button",{type:"button",className:"rounded-md bg-white/[0.06] px-2 py-0.5 font-mono text-[10px] text-zinc-400 hover:bg-white/10",onClick:()=>M(e),children:e},e))}):null,(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 pt-2",children:[(0,s.jsx)("button",{type:"button",disabled:Z||x||!r,onClick:()=>void eA(r),className:"rounded-lg border border-rose-500/30 bg-rose-500/10 px-2.5 py-1.5 text-[10px] text-rose-200",children:n("断开当前 TCP","Disconnect current")}),(0,s.jsx)("button",{type:"button",disabled:Z||x,onClick:()=>void eA(""),className:"rounded-lg border border-white/10 px-2.5 py-1.5 text-[10px] text-zinc-500 hover:text-zinc-300",children:n("断开全部 TCP","Disconnect all TCP")}),(0,s.jsxs)("button",{type:"button",disabled:Z||x,onClick:()=>{b(),eT(),p(n("已刷新设备列表","Devices refreshed"))},className:"inline-flex items-center gap-1 rounded-lg border border-white/10 px-2.5 py-1.5 text-[10px] text-zinc-400",children:[(0,s.jsx)(y.Z,{className:"h-3 w-3"}),"ADB list"]})]})]}),(0,s.jsxs)("div",{className:"space-y-2 rounded-xl border border-white/[0.06] bg-black/35 p-3",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:"adb pair(无线调试)"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("input",{className:"w-32 rounded-lg border border-white/10 bg-black/50 px-2 py-1.5 font-mono text-xs",placeholder:"IP",value:T,onChange:e=>U(e.target.value)}),(0,s.jsx)("input",{className:"w-20 rounded-lg border border-white/10 bg-black/50 px-2 py-1.5 font-mono text-xs",placeholder:"port",value:E,onChange:e=>I(e.target.value)}),(0,s.jsx)("input",{className:"min-w-[6rem] flex-1 rounded-lg border border-white/10 bg-black/50 px-2 py-1.5 font-mono text-xs tracking-widest",placeholder:"123456",value:A,onChange:e=>D(e.target.value)}),(0,s.jsx)("button",{type:"button",disabled:Z||x,onClick:()=>void eD(),className:"rounded-lg bg-violet-500/20 px-3 py-1.5 text-xs text-violet-100 ring-1 ring-violet-400/35",children:"Pair"})]}),(0,s.jsx)("p",{className:"text-[10px] leading-relaxed text-zinc-600",children:n("手机上「无线调试」会显示配对端口与 6 位码;配对成功后用上方 connect 连接 adb 显示的 IP:5555。","Use the pairing port + 6-digit code from Wireless debugging; then connect to the listed adb IP:5555.")})]})]})]}),(0,s.jsxs)("div",{className:"relative overflow-hidden rounded-3xl border border-emerald-500/25 bg-gradient-to-br from-emerald-500/[0.12] via-zinc-950/90 to-violet-500/[0.08] p-1 shadow-2xl shadow-emerald-900/20 ring-1 ring-white/[0.06]",children:[(0,s.jsx)("div",{className:"pointer-events-none absolute -right-20 -top-20 h-56 w-56 rounded-full bg-emerald-500/10 blur-3xl","aria-hidden":!0}),(0,s.jsxs)("div",{className:"relative rounded-[1.35rem] border border-white/[0.06] bg-zinc-950/80 p-4 backdrop-blur-sm",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl bg-gradient-to-br from-emerald-400/30 to-violet-500/25 ring-1 ring-white/10",children:(0,s.jsx)(m.Z,{className:"h-6 w-6 text-emerald-200"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-base font-semibold tracking-tight text-white",children:n("无人直播系统 \xb7 ADB 云控台","Unmanned Live System \xb7 ADB farm console")}),(0,s.jsxs)("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-zinc-500",children:[n("统一适配 USB / Redroid / 无线 adb:已授权设备默认走官方 scrcpy-server 的 WebSocket H.264 真流(与桌面 ","USB / Redroid / wireless adb: authorized devices default to official scrcpy-server WebSocket H.264 (same stack as "),(0,s.jsx)("a",{href:es,target:"_blank",rel:"noreferrer",className:"text-emerald-300/90 underline-offset-2 hover:underline",children:"escrcpy"}),n(" / "," / "),(0,s.jsx)("a",{href:en,target:"_blank",rel:"noreferrer",className:"text-emerald-300/90 underline-offset-2 hover:underline",children:"scrcpy"}),n(");无 jar 或关闭真流时用截图。","); PNG screenshot when jar missing or stream off.")]})]})]}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-col gap-1.5 self-start sm:flex-row",children:[(0,s.jsxs)("a",{href:es,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-xl border border-white/10 bg-white/[0.04] px-3 py-2 text-[11px] font-medium text-zinc-300 hover:bg-white/[0.07]",children:["escrcpy",(0,s.jsx)(H.Z,{className:"h-3.5 w-3.5 opacity-70"})]}),(0,s.jsxs)("a",{href:en,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-xl border border-white/10 bg-white/[0.04] px-3 py-2 text-[11px] font-medium text-zinc-300 hover:bg-white/[0.07]",children:["scrcpy",(0,s.jsx)(H.Z,{className:"h-3.5 w-3.5 opacity-70"})]})]})]}),a.length>0?(0,s.jsxs)("div",{className:"mt-5",children:[(0,s.jsxs)("p",{className:"mb-2 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:[(0,s.jsx)(B.Z,{className:"h-3.5 w-3.5"}),n("设备矩阵","Device matrix")]}),(0,s.jsx)("div",{className:"flex gap-2 overflow-x-auto pb-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:a.map(e=>{let t="device"===e.state,l=r===e.serial,i=et(e.transport),a=i.Icon;return(0,s.jsxs)("button",{type:"button",onClick:()=>o(e.serial),className:"flex min-w-[9rem] flex-col rounded-xl border px-3 py-2 text-left transition ".concat(l?"border-emerald-500/50 bg-emerald-500/15 ring-1 ring-emerald-400/30":"border-white/10 bg-black/30 hover:border-white/20"),children:[(0,s.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-zinc-200",children:[(0,s.jsx)(d.Z,{className:"h-3.5 w-3.5 text-emerald-400/80"}),(0,s.jsx)("span",{className:"truncate",children:e.model||e.serial.slice(0,10)})]}),(0,s.jsx)("span",{className:"mt-0.5 truncate font-mono text-[9px] text-zinc-600",children:e.serial}),(0,s.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1",children:[(0,s.jsxs)("span",{className:"inline-flex items-center gap-0.5 rounded-md px-1.5 py-0.5 text-[9px] font-semibold ring-1 ".concat(i.cls),children:[(0,s.jsx)(a,{className:"h-2.5 w-2.5"}),n(i.zh,i.en)]}),(0,s.jsx)("span",{className:"rounded-md px-1.5 py-0.5 text-[9px] font-semibold ".concat(t?"bg-emerald-500/20 text-emerald-200":"bg-zinc-600/30 text-zinc-500"),children:e.state})]})]},e.serial)})})]}):null,(0,s.jsxs)("div",{className:"mt-6 grid gap-6 xl:grid-cols-12",children:[(0,s.jsxs)("div",{className:"xl:col-span-8",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-white/[0.06] pb-3",children:[(0,s.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:n("刷新间隔","Interval")}),ee.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>w(e),className:"rounded-lg px-2.5 py-1 text-[10px] font-semibold transition ".concat(v===e?"bg-violet-500/25 text-violet-100 ring-1 ring-violet-400/35":"bg-black/30 text-zinc-500 hover:text-zinc-300"),children:0===e?n("手动","Manual"):"".concat(e,"ms")},e)),(0,s.jsxs)("span",{className:"ml-1 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[9px] font-medium ring-1 ".concat(eK.cls),children:[(0,s.jsx)(eW,{className:"h-3 w-3"}),"tcp"===eP?n("建议 ≥450ms","Suggest ≥450ms"):n("可试 280ms","Try 280ms")]}),(0,s.jsxs)("button",{type:"button",disabled:x,onClick:()=>void eT(),className:"ml-auto inline-flex items-center gap-1 rounded-lg border border-white/10 bg-white/[0.05] px-2.5 py-1 text-[10px] text-zinc-300 hover:bg-white/[0.08]",children:[(0,s.jsx)(y.Z,{className:"h-3 w-3 ".concat(j?"animate-spin":"")}),n("下一帧","Next frame")]}),(0,s.jsx)("button",{type:"button",disabled:x||!r,onClick:()=>void h("wake"),className:"rounded-lg bg-amber-500/20 px-2.5 py-1 text-[10px] font-semibold text-amber-100 ring-1 ring-amber-500/30",children:"Wake"}),(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-[10px] text-zinc-400",children:[(0,s.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/50",checked:C,onChange:e=>R(e.target.checked)}),(0,s.jsx)(K.Z,{className:"h-3 w-3"}),n("点按穿透","Tap-through")]}),(0,s.jsxs)("button",{type:"button",disabled:x||!r||!(null==eb?void 0:eb.server_jar),title:eb&&!eb.server_jar&&eb.hint_zh?eb.hint_zh:n("官方 scrcpy-server + WebSocket H.264","Official scrcpy-server + WebSocket H.264"),onClick:()=>{ec(e=>{let t=!e;return t?(ex(null),p(n("已开启实时画面(H.264 WebSocket)","Live H.264 WebSocket stream on"))):(r&&ex(r),p(n("已关闭实时画面(将使用截图)","Live stream off — screenshot mode"))),t})},className:"inline-flex items-center gap-1 rounded-lg border px-2.5 py-1 text-[10px] font-semibold transition ".concat(eo?"border-cyan-400/50 bg-cyan-500/20 text-cyan-100 ring-1 ring-cyan-400/35":"border-white/10 bg-black/30 text-zinc-400 hover:text-zinc-200"),children:[(0,s.jsx)(W.Z,{className:"h-3 w-3"}),eo?n("关闭真流","Stop WS"):n("实时画面","Live H.264")]})]}),eb&&!eb.server_jar?(0,s.jsxs)("p",{className:"mt-2 text-[10px] text-amber-200/80",children:[n("未检测到 scrcpy-server:启动时会自动拉取;内网可在 runtime.env 配置 SCRCPY_SERVER_DOWNLOAD_URL(支持 {tag})。","scrcpy-server missing: auto-fetched on startup; set SCRCPY_SERVER_DOWNLOAD_URL ({tag}) for mirrors."),eb.server_version?" (".concat(n("期望版本","version")," ").concat(eb.server_version,")"):null]}):null,(0,s.jsx)("p",{className:"mt-2 text-[10px] text-zinc-600",children:n("快捷键(镜像区聚焦时):H Home \xb7 B Back \xb7 R 多任务 \xb7 W 唤醒 \xb7 M 菜单","Hotkeys (mirror focused): H Home \xb7 B Back \xb7 R Recents \xb7 W Wake \xb7 M Menu")}),(0,s.jsxs)("div",{className:"relative mx-auto mt-4 max-h-[min(78vh,720px)] min-h-[280px]",children:[r?(0,s.jsxs)("div",{ref:ez,tabIndex:0,onKeyDown:e=>{if(!r||x)return;let t=e.target.tagName;if("INPUT"===t||"TEXTAREA"===t||"SELECT"===t)return;let n={h:["key",{keycode:"3"}],b:["key",{keycode:"4"}],r:["key",{keycode:"187"}],w:["wake",void 0],m:["key",{keycode:"82"}]}[e.key.toLowerCase()];n&&(e.preventDefault(),(async()=>{await h(n[0],n[1]),eo||eT()})())},className:"relative flex justify-center outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/50",children:[(0,s.jsxs)("div",{className:"relative rounded-[2rem] border-[10px] border-zinc-800 bg-black shadow-inner shadow-black/80 ring-1 ring-white/10",style:{maxHeight:"min(72vh, 680px)"},children:[(0,s.jsx)("div",{className:"absolute left-1/2 top-0 z-10 h-5 w-24 -translate-x-1/2 rounded-b-xl bg-black/80"}),eo?(0,s.jsx)("canvas",{ref:ej,className:"max-h-[min(72vh,680px)] w-auto max-w-full rounded-[1.35rem] object-contain ".concat(C?"cursor-crosshair":"cursor-default"),draggable:!1,onClick:eH,onContextMenu:eB}):(0,s.jsx)("img",{ref:ew,src:eM||void 0,alt:"device",className:"max-h-[min(72vh,680px)] w-auto max-w-full rounded-[1.35rem] object-contain ".concat(C?"cursor-crosshair":"cursor-default"),draggable:!1,onLoadStart:()=>{N(!0)},onLoad:()=>{N(!1),eS.current=0,z(null)},onError:()=>{N(!1),eS.current+=1,eS.current<=3?(z(null),window.setTimeout(()=>eT(),380+200*eS.current)):z(n("截图连续失败:检查 USB 授权 / 无线是否断开 / Redroid 端口","Screenshot failed repeatedly"))},onClick:eZ,onContextMenu:eO})]}),eu?(0,s.jsxs)("div",{className:"pointer-events-none absolute bottom-3 right-3 flex items-center gap-1 rounded-full bg-cyan-500/90 px-2 py-0.5 text-[9px] font-bold text-cyan-950 shadow-lg",children:[(0,s.jsx)(W.Z,{className:"h-3 w-3"}),"SCRCPY\xb7WS"]}):v>0&&!eo?(0,s.jsxs)("div",{className:"pointer-events-none absolute bottom-3 right-3 flex items-center gap-1 rounded-full bg-emerald-500/90 px-2 py-0.5 text-[9px] font-bold text-emerald-950 shadow-lg",children:[(0,s.jsx)(F.Z,{className:"h-3 w-3"}),"LIVE"]}):eo?null:(0,s.jsxs)("div",{className:"pointer-events-none absolute bottom-3 right-3 flex items-center gap-1 rounded-full bg-zinc-700/90 px-2 py-0.5 text-[9px] font-bold text-zinc-200",children:[(0,s.jsx)(Y.Z,{className:"h-3 w-3"}),n("单帧","Still")]})]}):(0,s.jsx)("p",{className:"py-16 text-center text-sm text-zinc-600",children:n("请选择或连接设备","Pick or connect a device")}),eh?(0,s.jsx)("p",{className:"mt-3 text-center text-xs text-rose-300",children:eh}):null,k&&!eo?(0,s.jsx)("p",{className:"mt-3 text-center text-xs text-rose-300",children:k}):null,(0,s.jsx)("p",{className:"mt-3 text-center text-[10px] text-zinc-600",children:n("左键单击 / 双击 \xb7 右键长按 \xb7 坐标对齐 PNG 像素","Left tap/double \xb7 right long-press \xb7 PNG pixel coords")})]})]}),(0,s.jsxs)("div",{className:"space-y-4 xl:col-span-4",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.07] bg-black/40 p-4",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:n("遥测","Telemetry")}),u?(0,s.jsxs)("dl",{className:"mt-3 space-y-2 font-mono text-[11px] text-zinc-400",children:[(0,s.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,s.jsx)("dt",{className:"text-zinc-600",children:"device"}),(0,s.jsxs)("dd",{className:"text-right text-zinc-200",children:[u.brand," ",u.model]})]}),(0,s.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,s.jsx)("dt",{className:"text-zinc-600",children:"Android"}),(0,s.jsxs)("dd",{className:"text-zinc-300",children:[u.android_version," (API ",u.sdk,")"]})]}),(0,s.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,s.jsx)("dt",{className:"text-zinc-600",children:"wm size"}),(0,s.jsx)("dd",{className:"text-cyan-300/90",children:S?"".concat(S.width,"\xd7").concat(S.height):u.resolution||"—"})]}),(0,s.jsx)("div",{className:"whitespace-pre-wrap text-[10px] leading-snug text-zinc-500",children:u.battery})]}):(0,s.jsx)("p",{className:"mt-2 text-xs text-zinc-600",children:n("在上方点「刷新设备信息」","Use Refresh device info above")})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-violet-500/20 bg-gradient-to-b from-violet-500/[0.08] to-black/40 p-4",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-violet-300/80",children:n("导航坞","Nav dock")}),(0,s.jsx)("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[["3","Home"],["4","Back"],["187","Recents"]].map(e=>{let[t,n]=e;return(0,s.jsx)("button",{type:"button",disabled:x||!r,onClick:()=>{h("key",{keycode:t}),eT()},className:"rounded-xl border border-white/10 bg-white/[0.06] py-3 text-xs font-semibold text-zinc-200 hover:bg-white/[0.1]",children:n},t)})}),(0,s.jsxs)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:[(0,s.jsx)("button",{type:"button",disabled:x||!r,onClick:()=>{h("key",{keycode:"24"}),eT()},className:"rounded-xl border border-white/10 bg-black/30 py-2 text-[11px] text-zinc-300",children:"Vol+"}),(0,s.jsx)("button",{type:"button",disabled:x||!r,onClick:()=>{h("key",{keycode:"25"}),eT()},className:"rounded-xl border border-white/10 bg-black/30 py-2 text-[11px] text-zinc-300",children:"Vol−"})]})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-cyan-500/[0.05] p-4",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-cyan-300/80",children:n("手势","Gestures")}),(0,s.jsx)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:["up","down","left","right"].map(e=>(0,s.jsx)("button",{type:"button",disabled:x||!r,onClick:()=>{h("swipe",{direction:e}),eT()},className:"rounded-lg border border-white/10 bg-black/30 py-2 font-mono text-[10px] uppercase text-zinc-300",children:e},e))})]})]})]})]})]})]})}let er=[{label:"getprop",cmd:"getprop ro.build.version.release"},{label:"top pkg",cmd:"dumpsys activity activities | grep -E 'mResumedActivity' | tail -n 1"},{label:"usb",cmd:"dumpsys usb | head -n 60"},{label:"surface",cmd:"dumpsys SurfaceFlinger | head -n 40"}];function ea(e,t,n){return e?(0,s.jsx)("span",{className:"rounded bg-emerald-500/15 px-2 py-0.5 text-[10px] text-emerald-200",children:t}):(0,s.jsx)("span",{className:"rounded bg-zinc-500/15 px-2 py-0.5 text-[10px] text-zinc-400",children:n})}function eo(e){var t,n,l,i,r,a,o,c,d,x,u,m,h,p,b;let{t:g,notify:f,fetchJson:y,apiBase:w,busy:j,androidSerial:N,setAndroidSerial:k,devices:S,adbAvailable:C,apkPath:R,setApkPath:P,onAndroidAction:M,onCopy:T,onRefreshDevices:U}=e,[D,Z]=(0,L.useState)(null),[O,H]=(0,L.useState)(null),[B,K]=(0,L.useState)(null),[W,F]=(0,L.useState)(null),[Y,G]=(0,L.useState)(""),[q,J]=(0,L.useState)([]),[V,X]=(0,L.useState)("getprop ro.product.model"),[$,Q]=(0,L.useState)(""),[ee,et]=(0,L.useState)("300"),[en,es]=(0,L.useState)(""),[el,eo]=(0,L.useState)(null),[ec,ed]=(0,L.useState)([]),[ex,eu]=(0,L.useState)(null),[em,eh]=(0,L.useState)("https://"),[ep,eb]=(0,L.useState)(""),[eg,ef]=(0,L.useState)(!1),[ev,ey]=(0,L.useState)(null),ew=!!(j||ev),ej=S.find(e=>e.serial===N)||null,eN=(0,L.useCallback)(async()=>{if(!N||!C){Z(null),H(null);return}ey("overview"),H(null);try{let e=await y("/android/overview?serial=".concat(encodeURIComponent(N)));Z(e)}catch(e){Z(null),H(e.message)}finally{ey(null)}},[C,N,y]),ek=(0,L.useCallback)(async()=>{F(null);try{let e=await y("/redroid/summary");K(e)}catch(e){K(null),F(e.message)}},[y]);(0,L.useEffect)(()=>{eN()},[eN]),(0,L.useEffect)(()=>{ek()},[ek]);let ez=async()=>{if(!N){f(g("请选择设备","Pick a device"));return}ey("packages");try{let e=encodeURIComponent(Y.trim()),t=await y("/android/packages?serial=".concat(encodeURIComponent(N),"&query=").concat(e,"&limit=80"));J(t.packages||[])}catch(e){f(e.message),J([])}finally{ey(null)}},eS=async()=>{if(!N){f(g("请选择设备","Pick a device"));return}let e=V.trim();if(e){ey("shell");try{var t,n;let s=await y("/android/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"shell",serial:N,payload:{command:e}})});Q(null!==(n=null!==(t=s.output)&&void 0!==t?t:s.message)&&void 0!==n?n:"")}catch(e){Q(e.message)}finally{ey(null)}}},e_=(0,L.useCallback)(async e=>{if(!N)return;let t=Math.min(3e3,Math.max(1,parseInt(ee,10)||200)),n=!!(null==e?void 0:e.silent);n||ey("logcat"),eo(null);try{var s;let e=await y("/android/logcat?serial=".concat(encodeURIComponent(N),"&lines=").concat(t));es(null!==(s=e.text)&&void 0!==s?s:"")}catch(e){es(""),eo(e.message)}finally{n||ey(null)}},[N,y,ee]);(0,L.useEffect)(()=>{if(!eg||!N||!C)return;let e=window.setInterval(()=>void e_({silent:!0}),3e3);return e_({silent:!0}),()=>clearInterval(e)},[C,N,eg,e_]);let eC=async()=>{if(!N){f(g("请选择设备","Pick a device"));return}ey("ui"),eu(null);try{let e=await y("/android/ui?serial=".concat(encodeURIComponent(N),"&limit=100"));ed(e.nodes||[])}catch(e){ed([]),eu(e.message)}finally{ey(null)}},eR=async(e,t)=>{ey("redroid:".concat(e));try{let n=await y("/redroid/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,name:t||""})});n.summary&&K(n.summary),f(n.message||"OK"),await ek(),U()}catch(e){f(e.message)}finally{ey(null)}},eP=async e=>{await M("key",{keycode:e})},eL=async()=>{let e=ep.trim();if(!e){f(g("请输入文字","Enter text"));return}await M("text",{text:e})},eM=async()=>{let e=em.trim();if(!e||"https://"===e){f(g("请输入 URL","Enter URL"));return}await M("open_url",{url:e})};return(0,s.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:g("安卓设备工作台","Android workstation")}),(0,s.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:g("USB 真机与 Redroid 共用一套控制面,优先保证 USB 真机稳定。","USB phone and Redroid share one control surface.")})]}),C?(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{type:"button",disabled:ew||!N,onClick:()=>void eN(),className:"rounded-lg border border-white/10 bg-white/[0.05] px-3 py-1.5 text-xs text-zinc-300",children:g("刷新设备","Refresh device")}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>{ek(),U()},className:"rounded-lg border border-white/10 bg-white/[0.05] px-3 py-1.5 text-xs text-zinc-300",children:g("刷新 Redroid","Refresh Redroid")})]}):(0,s.jsx)("span",{className:"text-xs text-amber-200/90",children:g("宿主机未检测到 adb","adb not found on host")})]}),(0,s.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:S.map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>k(e.serial),className:"rounded-xl border px-4 py-2 text-left text-xs ".concat(N===e.serial?"border-violet-500/50 bg-violet-500/10 text-white":"border-white/10 bg-black/30 text-zinc-400"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"font-medium text-zinc-200",children:e.model||e.serial}),e.transport?(0,s.jsx)("span",{className:"rounded bg-white/10 px-1.5 py-0.5 font-mono text-[9px] uppercase text-zinc-500",children:e.transport}):null,e.kind?(0,s.jsx)("span",{className:"rounded bg-cyan-500/10 px-1.5 py-0.5 font-mono text-[9px] uppercase text-cyan-200",children:e.kind}):null]}),(0,s.jsx)("div",{className:"text-[10px] text-zinc-600",children:e.serial}),"device"!==(e.state||"").toLowerCase()?(0,s.jsx)("div",{className:"mt-1 text-[10px] font-medium text-amber-200/90",children:"unauthorized"===e.state?g("未授权,请在手机上允许 USB 调试。","Unauthorized, allow USB debugging on device."):"".concat(g("状态","State"),": ").concat(e.state)}):null]},e.serial))}),C&&0===S.length?(0,s.jsx)("p",{className:"mt-4 rounded-lg border border-amber-500/20 bg-amber-500/5 p-3 text-xs leading-relaxed text-amber-200/90",children:g("当前没有已授权设备。USB 真机请检查调试授权;Redroid 请先启动实例,再 adb connect 127.0.0.1:5555。","No authorized devices. For USB phones, confirm USB debugging. For Redroid, start an instance then adb connect 127.0.0.1:5555.")}):null]}),(0,s.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-violet-500/15 bg-zinc-950/50 p-5",children:[(0,s.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-violet-300/90",children:g("真机诊断","Phone diagnostics")}),O?(0,s.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:O}):null,D?(0,s.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,s.jsxs)("dl",{className:"space-y-1.5 font-mono text-[11px] text-zinc-400",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{className:"inline text-zinc-600",children:"model"})," ",(0,s.jsxs)("dd",{className:"inline text-zinc-300",children:[D.brand," ",D.model]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{className:"inline text-zinc-600",children:"android"})," ",(0,s.jsxs)("dd",{className:"inline text-zinc-300",children:[D.android_version," (sdk ",D.sdk,")"]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{className:"inline text-zinc-600",children:"kind"})," ",(0,s.jsxs)("dd",{className:"inline text-zinc-300",children:[D.kind||(null==ej?void 0:ej.kind)||"unknown"," / ",D.transport||(null==ej?void 0:ej.transport)||"unknown"]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{className:"inline text-zinc-600",children:"display"})," ",(0,s.jsx)("dd",{className:"inline text-zinc-300",children:D.resolution})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{className:"inline text-zinc-600",children:"rotation"})," ",(0,s.jsx)("dd",{className:"inline text-zinc-300",children:D.rotation})]}),(0,s.jsx)("div",{className:"whitespace-pre-wrap text-[10px] leading-snug text-zinc-500",children:D.battery}),(0,s.jsx)("div",{className:"line-clamp-3 text-[10px] text-zinc-500",children:D.focus})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[ea(null===(t=D.diagnostics)||void 0===t?void 0:t.ready,g("已启动","Boot ready"),g("未完成启动","Boot pending")),ea(null===(n=D.diagnostics)||void 0===n?void 0:n.google_play,"Google Play","No Play"),ea(null===(l=D.diagnostics)||void 0===l?void 0:l.google_services,"GMS","No GMS"),ea(null===(i=D.diagnostics)||void 0===i?void 0:i.magisk,"Magisk","No Magisk"),ea(null===(r=D.diagnostics)||void 0===r?void 0:r.root,"Root","No root")]}),(0,s.jsxs)("div",{className:"rounded-xl border border-white/5 bg-black/20 p-3 text-[11px] text-zinc-400",children:[(0,s.jsxs)("div",{children:["boot_completed: ",(null===(a=D.diagnostics)||void 0===a?void 0:a.boot_completed)||"-"]}),(0,s.jsxs)("div",{children:["provisioned: ",(null===(o=D.diagnostics)||void 0===o?void 0:o.device_provisioned)||"-"]}),(0,s.jsxs)("div",{children:["setup_complete: ",(null===(c=D.diagnostics)||void 0===c?void 0:c.user_setup_complete)||"-"]}),(0,s.jsxs)("div",{children:["abi: ",(null===(d=D.diagnostics)||void 0===d?void 0:d.abi)||"-"]}),(0,s.jsxs)("div",{className:"truncate",children:["hardware: ",(null===(x=D.diagnostics)||void 0===x?void 0:x.hardware)||"-"]})]})]}):O?null:(0,s.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:g("加载中","Loading")})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-zinc-950/50 p-5",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-300/90",children:g("Redroid 板块","Redroid panel")}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("start"),className:"rounded-lg bg-emerald-500/20 px-3 py-1.5 text-xs text-emerald-100 ring-1 ring-emerald-500/30",children:g("启动默认实例","Start default")})]}),W?(0,s.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:W}):null,B?(0,s.jsxs)("div",{className:"mt-3 space-y-3 text-[11px] text-zinc-400",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,s.jsxs)("div",{children:["arch: ",B.arch||"-"]}),(0,s.jsxs)("div",{className:"truncate",children:["image: ",B.image||"-"]}),(0,s.jsxs)("div",{children:["profile: ",B.device_profile||"-"]}),(0,s.jsxs)("div",{children:["gpu: ",B.gpu_mode||"-"]}),(0,s.jsxs)("div",{children:["adb: 127.0.0.1:",B.default_port||5555]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[ea(null===(u=B.requirements)||void 0===u?void 0:u.docker_available,"Docker","No Docker"),ea(null===(m=B.requirements)||void 0===m?void 0:m.adb_available,"ADB","No ADB"),ea(null===(h=B.requirements)||void 0===h?void 0:h.kvm,"KVM","No KVM"),ea(null===(p=B.requirements)||void 0===p?void 0:p.binderfs,"binderfs","No binderfs")]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(B.instances||[]).map(e=>{var t,n,l,i;return(0,s.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-3",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:"font-medium text-zinc-100",children:e.name}),(0,s.jsxs)("div",{className:"font-mono text-[10px] text-zinc-500",children:[e.port?"127.0.0.1:".concat(e.port):"-"," / ",e.status_text||"-"]})]}),(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("start",e.name),className:"rounded bg-emerald-500/15 px-2 py-1 text-[10px] text-emerald-200",children:"Start"}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("restart",e.name),className:"rounded bg-amber-500/15 px-2 py-1 text-[10px] text-amber-200",children:"Restart"}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("adb_connect",e.name),className:"rounded bg-cyan-500/15 px-2 py-1 text-[10px] text-cyan-200",children:"ADB"}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("stop",e.name),className:"rounded bg-rose-500/15 px-2 py-1 text-[10px] text-rose-200",children:"Stop"})]})]}),(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[ea(null===(t=e.diagnostics)||void 0===t?void 0:t.ready,g("系统就绪","System ready"),g("启动中","Booting")),ea(null===(n=e.diagnostics)||void 0===n?void 0:n.google_play,"Play","No Play"),ea(null===(l=e.diagnostics)||void 0===l?void 0:l.magisk,"Magisk","No Magisk"),ea(null===(i=e.diagnostics)||void 0===i?void 0:i.root,"Root","No root")]}),e.data_dir?(0,s.jsx)("div",{className:"mt-2 truncate font-mono text-[10px] text-zinc-500",children:e.data_dir}):null]},e.name)}),(null===(b=B.instances)||void 0===b?void 0:b.length)?null:(0,s.jsx)("p",{className:"rounded-xl border border-white/5 bg-black/20 p-3 text-xs text-zinc-500",children:g("当前没有 Redroid 实例。默认动作会创建 redroid13-1。","No Redroid instances yet. Default actions create redroid13-1.")})]})]}):(0,s.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:g("读取 Redroid 状态中","Loading Redroid status")})]})]}),(0,s.jsx)(ei,{t:g,apiBase:w,fetchJson:y,serial:N,devices:S,setSerial:k,adbAvailable:C,lock:ew,overview:D,onAndroidAction:M,notify:f,onRefreshDevices:U}),C&&N?(0,s.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,s.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-emerald-300/90",children:g("快捷控制","Quick controls")}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("3"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Home"}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("4"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Back"}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("187"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Recents"}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void M("wake"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Wake"}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void M("launch_package",{package:"com.zhiliaoapp.musically"}),className:"rounded-lg bg-gradient-to-r from-pink-500/25 to-violet-500/25 px-3 py-1.5 text-xs ring-1 ring-white/10",children:"TikTok"}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("24"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Vol+"}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("25"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Vol-"}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("66"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Enter"})]}),(0,s.jsx)("p",{className:"mt-3 text-[10px] text-zinc-600",children:g("滑动手势","Swipe gestures")}),(0,s.jsx)("div",{className:"mt-1 flex flex-wrap gap-2",children:["up","down","left","right"].map(e=>(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void M("swipe",{direction:e}),className:"rounded-lg border border-white/10 bg-black/30 px-2.5 py-1 font-mono text-[10px] uppercase text-zinc-300",children:e},e))}),(0,s.jsxs)("div",{className:"mt-4 rounded-lg border border-white/5 bg-black/20 p-3",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:g("ADB 文本输入","ADB text input")}),(0,s.jsxs)("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row",children:[(0,s.jsx)("input",{className:"min-w-0 flex-1 rounded-lg border border-white/10 bg-black/40 px-3 py-2 text-xs",value:ep,onChange:e=>eb(e.target.value),placeholder:"hello / 123",onKeyDown:e=>{"Enter"===e.key&&eL()}}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL(),className:"rounded-lg bg-emerald-500/20 px-3 py-2 text-xs text-emerald-100 ring-1 ring-emerald-500/30",children:g("发送","Send")})]})]}),(0,s.jsxs)("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row sm:items-center",children:[(0,s.jsx)("input",{className:"min-w-0 flex-1 rounded-lg border border-white/10 bg-black/40 px-3 py-2 text-xs",value:em,onChange:e=>eh(e.target.value),placeholder:"https://"}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eM(),className:"rounded-lg bg-violet-500/20 px-3 py-2 text-xs text-violet-100 ring-1 ring-violet-500/30",children:g("打开链接","Open URL")})]})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,s.jsxs)("h4",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-cyan-300/90",children:[(0,s.jsx)(z.Z,{className:"h-4 w-4"}),g("USB 真机优化建议","USB optimization")]}),(0,s.jsxs)("ul",{className:"mt-3 space-y-2 text-xs leading-relaxed text-zinc-400",children:[(0,s.jsx)("li",{children:g("优先使用主板直连 USB,不要经过不稳的 HUB。","Prefer direct motherboard USB, not unstable hubs.")}),(0,s.jsx)("li",{children:g("开发板端固定 adb server,避免频繁 kill-server。","Keep adb server stable and avoid frequent kill-server.")}),(0,s.jsx)("li",{children:g("镜像页默认支持 scrcpy H.264 真流,截图模式作为回退。","Use scrcpy H.264 live stream first, screenshot mode as fallback.")}),(0,s.jsx)("li",{children:g("如果 TikTok / YouTube App 直播,要先确认屏幕常亮、分辨率稳定、USB 供电足够。","For TikTok / YouTube app live, keep screen on, resolution stable, and USB power sufficient.")})]})]})]}):null,C&&N?(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,s.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,s.jsx)(E.Z,{className:"h-4 w-4 text-emerald-400"}),g("包名搜索与启动","Packages")]}),(0,s.jsxs)("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row",children:[(0,s.jsx)("input",{className:"min-w-0 flex-1 rounded-xl border border-white/10 bg-black/40 px-4 py-2 text-sm",value:Y,onChange:e=>G(e.target.value),placeholder:"tiktok / musically / youtube",onKeyDown:e=>{"Enter"===e.key&&ez()}}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void ez(),className:"rounded-xl bg-emerald-500/20 px-4 py-2 text-sm text-emerald-100 ring-1 ring-emerald-500/30",children:g("搜索","Search")})]}),(0,s.jsxs)("ul",{className:"mt-4 max-h-48 space-y-1 overflow-y-auto rounded-lg border border-white/5 bg-black/30 p-2 font-mono text-[11px]",children:[q.map(e=>(0,s.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 py-1 text-zinc-400",children:[(0,s.jsx)("span",{className:"min-w-0 truncate text-zinc-300",children:e.package}),(0,s.jsxs)("span",{className:"flex shrink-0 gap-1",children:[(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void M("launch_package",{package:e.package}),className:"rounded bg-white/10 px-2 py-0.5 text-[10px] text-zinc-200",children:g("启动","Launch")}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void M("force_stop",{package:e.package}),className:"rounded bg-rose-500/15 px-2 py-0.5 text-[10px] text-rose-200",children:g("停止","Stop")})]})]},e.package)),q.length?null:(0,s.jsx)("li",{className:"py-2 text-center text-zinc-600",children:g("暂无结果","No results")})]})]}):null,C&&N?(0,s.jsxs)("div",{className:"grid gap-6 xl:grid-cols-2",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,s.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,s.jsx)(I.Z,{className:"h-4 w-4 text-amber-400"}),"ADB shell"]}),(0,s.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:er.map(e=>(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>X(e.cmd),className:"rounded-md border border-white/10 bg-white/[0.04] px-2 py-1 text-[10px] text-zinc-400 hover:text-zinc-200",children:e.label},e.label))}),(0,s.jsx)("textarea",{className:"mt-3 min-h-[100px] w-full resize-y rounded-xl border border-white/10 bg-black/50 p-3 font-mono text-xs text-zinc-200",value:V,onChange:e=>X(e.target.value),spellCheck:!1,onKeyDown:e=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),eS())}}),(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eS(),className:"rounded-xl bg-amber-500/20 px-4 py-2 text-sm text-amber-100 ring-1 ring-amber-500/30",children:"shell"===ev?(0,s.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,s.jsx)(v.Z,{className:"h-3.5 w-3.5 animate-spin"}),"Run"]}):"Run"}),$?(0,s.jsxs)("button",{type:"button",disabled:!$,onClick:()=>T($),className:"inline-flex items-center gap-1 rounded-lg border border-white/10 px-3 py-1.5 text-xs text-zinc-400 hover:text-zinc-200",children:[(0,s.jsx)(_.Z,{className:"h-3.5 w-3.5"}),g("复制输出","Copy")]}):null]}),$?(0,s.jsx)("pre",{className:"mt-3 max-h-64 overflow-auto whitespace-pre-wrap rounded-lg border border-white/5 bg-black/40 p-3 font-mono text-[11px] text-zinc-400 xl:max-h-[min(24rem,50vh)]",children:$}):null]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:g("Logcat","Logcat")}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,s.jsx)("input",{className:"w-24 rounded-lg border border-white/10 bg-black/40 px-3 py-2 font-mono text-xs",value:ee,onChange:e=>et(e.target.value)}),(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 text-[11px] text-zinc-400",children:[(0,s.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:eg,onChange:e=>ef(e.target.checked)}),g("每 3 秒自动刷新","Auto every 3s")]}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void e_(),className:"rounded-xl bg-cyan-500/20 px-4 py-2 text-sm text-cyan-100 ring-1 ring-cyan-500/30",children:g("拉取日志","Pull logs")}),en?(0,s.jsxs)("button",{type:"button",onClick:()=>T(en),className:"inline-flex items-center gap-1 rounded-lg border border-white/10 px-3 py-1.5 text-xs text-zinc-400 hover:text-zinc-200",children:[(0,s.jsx)(_.Z,{className:"h-3.5 w-3.5"}),g("复制","Copy")]}):null]}),el?(0,s.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:el}):null,en?(0,s.jsx)("pre",{className:"mt-3 max-h-72 overflow-auto whitespace-pre-wrap rounded-lg border border-white/5 bg-black/50 p-3 font-mono text-[10px] leading-tight text-zinc-500 xl:max-h-[min(24rem,50vh)]",children:en}):null]})]}):null,C&&N?(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,s.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,s.jsx)(A.Z,{className:"h-4 w-4 text-fuchsia-400"}),g("界面节点","UI nodes")]}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eC(),className:"mt-3 rounded-xl border border-fuchsia-500/30 bg-fuchsia-500/10 px-4 py-2 text-sm text-fuchsia-100",children:g("刷新节点","Refresh nodes")}),ex?(0,s.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:ex}):null,(0,s.jsxs)("ul",{className:"mt-3 max-h-64 space-y-1 overflow-y-auto rounded-lg border border-white/5 bg-black/30 p-2 text-[11px]",children:[ec.map((e,t)=>(0,s.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-white/[0.04] py-1.5 text-zinc-400 last:border-0",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("span",{className:"text-zinc-200",children:e.label}),e.resource_id?(0,s.jsx)("span",{className:"ml-2 font-mono text-[10px] text-zinc-600",children:e.resource_id}):null,(0,s.jsxs)("div",{className:"font-mono text-[10px] text-zinc-600",children:["(",e.center_x,", ",e.center_y,")",e.clickable?" click":""]})]}),(0,s.jsx)("button",{type:"button",disabled:ew,onClick:()=>void M("tap",{x:e.center_x,y:e.center_y}),className:"shrink-0 rounded bg-white/10 px-2 py-1 text-[10px] text-zinc-200",children:"Tap"})]},"".concat(e.center_x,"-").concat(e.center_y,"-").concat(t))),ec.length||ex?null:(0,s.jsx)("li",{className:"py-4 text-center text-zinc-600",children:g("尚未加载","Not loaded")})]})]}):null,C&&N?(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:g("安装 APK","Install APK")}),(0,s.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:g("先 adb push 到 /sdcard/ 再执行安装。","Push the APK to /sdcard/ first.")}),(0,s.jsx)("input",{className:"mt-4 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm",value:R,onChange:e=>P(e.target.value)}),(0,s.jsx)("button",{type:"button",disabled:ew||!C||!N,onClick:()=>void M("install_apk",{path:R}),className:"mt-3 rounded-xl bg-emerald-500/20 px-4 py-2 text-sm font-medium text-emerald-100 ring-1 ring-emerald-500/30",children:"pm install"})]}):null]})}var ec=n(9897),ed=n(4554),ex=n(7689),eu=n(8930),em=n(8401);function eh(e){let{t,title:n,subtitle:l,steps:i,onNavigate:r}=e;return(0,s.jsxs)("div",{className:"rounded-2xl border border-violet-500/25 bg-gradient-to-br from-violet-500/10 via-zinc-950/40 to-fuchsia-500/5 p-6 shadow-lg shadow-violet-900/10",children:[(0,s.jsx)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:n}),(0,s.jsx)("p",{className:"mt-2 text-xs text-zinc-400",children:l}),(0,s.jsx)("div",{className:"mt-6 flex flex-col items-center gap-4 sm:flex-row sm:flex-wrap sm:justify-center",children:i.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[e.openUrl||e.target&&r?(0,s.jsxs)("button",{type:"button",onClick:()=>{if(e.openUrl){window.open((0,em.p)(e.openUrl),"_blank","noopener,noreferrer");return}e.target&&r&&r(e.target)},className:"flex min-h-[4rem] min-w-[7rem] flex-col items-center justify-center rounded-2xl bg-gradient-to-br px-4 py-2 text-center text-xs font-bold text-white shadow-lg ring-2 ring-white/10 transition hover:ring-violet-400/50 hover:brightness-110 ".concat(e.gradient),children:[(0,s.jsx)("span",{children:e.label}),e.sub?(0,s.jsx)("span",{className:"mt-1 text-[10px] font-normal text-white/80",children:e.sub}):null]}):(0,s.jsxs)("div",{className:"flex min-h-[4rem] min-w-[7rem] flex-col items-center justify-center rounded-2xl bg-gradient-to-br px-4 py-2 text-center text-xs font-bold text-white shadow-lg ".concat(e.gradient),children:[(0,s.jsx)("span",{children:e.label}),e.sub?(0,s.jsx)("span",{className:"mt-1 text-[10px] font-normal text-white/80",children:e.sub}):null]}),t<i.length-1?(0,s.jsx)(h.Z,{className:"hidden h-5 w-5 text-zinc-600 sm:block","aria-hidden":!0}):null]},e.label))}),(0,s.jsx)("p",{className:"mt-4 text-center text-[10px] text-zinc-600",children:t("点击高亮块可跳转到对应功能页","Tap a highlighted step to open its page")})]})}function ep(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(e.startsWith("#")||!e)continue;let n=e.match(/^(?:key|stream_key)\s*=\s*(.+)$/i);if(n){let e=n[1].trim().split(/[#;]/)[0].trim();if(e&&!e.toLowerCase().startsWith("rtmp"))return e.length>8?e.slice(-8):e;if(e.includes("live2/")){let t=e.split("/"),n=t[t.length-1]||"";return n.length>8?n.slice(-8):n}}}let t=e.trim();return!t||t.includes("\n")||t.toLowerCase().startsWith("rtmp")?"":t.length>8?t.slice(-8):t}function eb(e){let t=[];for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith("#")||!/douyin\.com|v\.douyin\.com/i.test(e))continue;let s=e.match(/(https?:\/\/live\.douyin\.com\/[a-zA-Z0-9_-]+)/i);if(s){t.push(s[1].replace(/^http:\/\//i,"https://"));continue}let l=e.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i);if(l){t.push("https://live.douyin.com/".concat(l[1]));continue}let i=e.match(/(\d{8,})/);i&&t.push("https://live.douyin.com/".concat(i[1]))}return Array.from(new Set(t)).slice(0,16)}function eg(e){let t="",n=!0,s="",l=!1,i=e.split(/\r?\n/),r=!1;for(let e of i){let i=e.trim();if(/^\[youtube\]/i.test(i)){r=!0;continue}if(/^\[/.test(i)){r=!1;continue}if(!r||!i||i.startsWith("#")||i.startsWith(";"))continue;let a=i.indexOf("=");if(a<0)continue;let o=i.slice(0,a).trim().toLowerCase(),c=i.slice(a+1).trim().split(/[#;]/)[0].trim();"key"===o||"stream_key"===o?t=c:"rtmps"===o?n=!/^(0|false|否)/i.test(c):"bitrate"===o?s=c:"fast_audio"===o&&(l=/^(1|true|yes|是|开|on)/i.test(c))}return{key:t,rtmps:n,bitrate:s,fastAudio:l}}function ef(e){return"URL_config.".concat(e.replace(/[^a-zA-Z0-9_.-]/g,"_"),".ini")}function ev(e){let t=e.bitrate.trim()?"bitrate = ".concat(e.bitrate.trim()):"# bitrate = 4000";return"[youtube]\n# YouTube 推流 key(工作室 → 直播 → 串流密钥)\nkey = ".concat(e.key.trim(),"\n\n# 使用 RTMPS;填 否 则 RTMP\nrtmps = ").concat(e.rtmps?"是":"否","\n\n# 视频比特率 kbps(可选)\n").concat(t,"\n\n# 轻量音频链,减轻 CPU:1 / 是\nfast_audio = ").concat(e.fastAudio?"1":"0","\n")}function ey(e){if(e<60)return"".concat(e,"s");let t=Math.floor(e/60);return t<60?"".concat(t,"m ").concat(e%60,"s"):"".concat(Math.floor(t/60),"h ").concat(t%60,"m")}function ew(e){var t,n,l;let{t:i,currentProc:r,fetchJson:a,urlListText:o,keySuffixUi:c,showKeyRow:d=!0,pollMs:x=1e3,refreshToken:u=0}=e,[m,h]=(0,L.useState)(""),[p,b]=(0,L.useState)(""),[g,f]=(0,L.useState)(""),[v,w]=(0,L.useState)(""),[j,N]=(0,L.useState)(""),[k,z]=(0,L.useState)([]),[S,_]=(0,L.useState)(null),[C,R]=(0,L.useState)(!1),[P,M]=(0,L.useState)(null),[T,U]=(0,L.useState)(0),[E,I]=(0,L.useState)(!0),A=(0,L.useRef)(null),D=(0,L.useRef)(null),Z=(0,L.useRef)(!1),O=(0,L.useRef)(!1),B=(0,L.useRef)(!1),K=(0,L.useRef)(r),W=(0,L.useRef)(0),G=function(e){let t=[];for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith("#")||!/douyin\.com|v\.douyin\.com/i.test(e))continue;let s=e.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i);if(s){t.push(s[1]);continue}let l=e.match(/(\d{8,})/);t.push(l?l[1]:e.slice(0,96))}return Array.from(new Set(t)).slice(0,12)}(o),q=/^(online|running)$/i.test(m),J=function(e){if(!e)return null;let t=null;for(let n of e.split(/\r?\n/)){let e=n.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i);e&&(t=e[1]);let s=n.match(/https?:\/\/[^/\s]*douyin\.com\/(\d{8,})/i);s&&(t=s[1])}return t}(p),V=null!==(n=eb(o)[0])&&void 0!==n?n:"",X=J||(null!==(l=null===(t=V.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i))||void 0===t?void 0:t[1])&&void 0!==l?l:null),$=X?"https://live.douyin.com/".concat(X):V||null,Q=(0,L.useCallback)(async()=>{let e=K.current.trim();if(!e)return;if(O.current){B.current=!0;return}O.current=!0;let t=++W.current;try{let n=await a("/status?process=".concat(encodeURIComponent(e)));if(t!==W.current||e!==K.current.trim())return;let s=n.process_status||"unknown";h(s),b(n.recent_log||""),f(n.recent_error||""),w(n.business_status||""),N(n.business_note||""),z(Array.isArray(n.ffmpeg_pids)?n.ffmpeg_pids:[]),_("number"==typeof n.log_age_seconds?n.log_age_seconds:null);let l=/^(online|running)$/i.test(s);l&&!Z.current&&M(Date.now()),l||M(null),Z.current=l}catch(n){if(t!==W.current||e!==K.current.trim())return;h("error"),w("error"),N(""),z([]),_(null)}finally{O.current=!1,B.current&&(B.current=!1,window.setTimeout(()=>void Q(),0))}},[a]);(0,L.useEffect)(()=>{if(K.current=r,W.current+=1,B.current=!1,!r){h(""),b(""),f(""),w(""),N(""),z([]),_(null),M(null),Z.current=!1;return}h(""),b(""),f(""),w(""),N(""),z([]),_(null),M(null),Z.current=!1,Q()},[r,Q]),(0,L.useEffect)(()=>{let e=()=>I("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,L.useEffect)(()=>{r&&Q()},[r,Q,u]),(0,L.useEffect)(()=>{if(C||!E||!r)return;let e=window.setInterval(()=>void Q(),x);return()=>clearInterval(e)},[C,E,r,Q,x]),(0,L.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&Q()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[Q]),(0,L.useEffect)(()=>{if(!P)return;let e=window.setInterval(()=>U(e=>e+1),1e3);return()=>clearInterval(e)},[P]),(0,L.useEffect)(()=>{if(C||!E)return;let e=A.current;e&&(e.scrollTop=e.scrollHeight)},[p,C,E]),(0,L.useEffect)(()=>{if(C||!E)return;let e=D.current;e&&(e.scrollTop=e.scrollHeight)},[g,C,E]);let ee=null==P?i("—(未检测到在线)","— (not online)"):ey(Math.max(0,Math.floor((Date.now()-P)/1e3))),et=C?i("已暂停刷新","Paused"):E?i("每秒刷新","~1s refresh"):i("后台暂停","Hidden"),en=C?"bg-amber-500/20 text-amber-100 ring-amber-500/35":E?"bg-emerald-500/15 text-emerald-200/90 ring-emerald-500/25":"bg-sky-500/15 text-sky-100 ring-sky-500/25";return(0,s.jsxs)("section",{className:"rounded-2xl border border-emerald-500/20 bg-gradient-to-b from-emerald-500/[0.07] to-zinc-950/80 p-6 ring-1 ring-white/[0.04]",children:[(0,s.jsx)("span",{className:"sr-only","aria-hidden":!0,children:T}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:i("当前直播日志","Live process log")}),(0,s.jsx)("span",{className:"rounded-full bg-white/10 px-2 py-0.5 font-mono text-[10px] text-zinc-300 ring-1 ring-white/10",children:r||"—"}),(0,s.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-medium ring-1 ".concat(en),children:et})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>void Q(),className:"inline-flex items-center gap-1 rounded-lg border border-white/10 bg-white/[0.05] px-3 py-1.5 text-xs text-zinc-300 hover:bg-white/[0.08]",children:[(0,s.jsx)(y.Z,{className:"h-3.5 w-3.5"}),i("立即拉取","Refresh")]}),(0,s.jsxs)("button",{type:"button",onClick:()=>R(e=>!e),className:"inline-flex items-center gap-1 rounded-lg px-3 py-1.5 text-xs ring-1 ".concat(C?"bg-amber-500/20 text-amber-100 ring-amber-500/35":"border border-white/10 bg-black/30 text-zinc-300"),children:[C?(0,s.jsx)(F.Z,{className:"h-3.5 w-3.5"}):(0,s.jsx)(Y.Z,{className:"h-3.5 w-3.5"}),C?i("继续自动刷新","Resume"):i("暂停自动刷新","Pause")]})]})]}),(0,s.jsxs)("div",{className:"mt-4 space-y-3 rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,s.jsxs)("div",{className:"grid gap-2 text-xs sm:grid-cols-2",children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("span",{className:"text-zinc-500",children:i("进程状态","Status")}),(0,s.jsx)("span",{className:"font-medium text-zinc-200",children:function(e,t){let n=(t||"unknown").toLowerCase();return"online"===n||"running"===n?e("运行中(PM2/进程在线)","Running (process online)"):"stopped"===n||"stopping"===n?e("已停止","Stopped"):"not_found"===n||"errored"===n?e("未运行或未找到","Not running / not found"):"invalid"===n?e("无效进程名","Invalid process"):t||"—"}(i,m)})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("span",{className:"text-zinc-500",children:i("Business state","Business state")}),(0,s.jsx)("span",{className:"font-medium text-cyan-200/90",children:function(e,t,n){let s=(t||"").toLowerCase();return"streaming"===s?e("Pushing to YouTube","Pushing to YouTube"):"waiting_source"===s?e("Waiting for the upstream live source","Waiting for the upstream live source"):"source_live"===s?e("Source live detected, but no active FFmpeg relay worker","Source live detected, but no active FFmpeg relay worker"):"monitoring"===s?e("Process online and monitoring the source","Process online and monitoring the source"):"misconfigured"===s?e("YouTube key missing or invalid","YouTube key missing or invalid"):"stale"===s?e("Process online but the log heartbeat is stale","Process online but the log heartbeat is stale"):"error"===s?e("Recent process error detected","Recent process error detected"):(null==n?void 0:n.trim())?n.trim():e("No business-state hint yet","No business-state hint yet")}(i,v,j)})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("span",{className:"text-zinc-500",children:i("本次在线时长(估算)","Online duration (est.)")}),(0,s.jsx)("span",{className:"font-mono text-cyan-200/90",children:ee})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("span",{className:"text-zinc-500",children:i("FFmpeg workers","FFmpeg workers")}),(0,s.jsxs)("span",{className:"font-mono text-zinc-300",children:[k.length?k.join(", "):"none",null!=S?" \xb7 log ".concat(ey(Math.max(0,Math.floor(S)))):""]})]})]}),d?(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,s.jsx)("span",{className:"text-zinc-500",children:i("YouTube key 尾码(参考)","YT key suffix")}),(0,s.jsx)("span",{className:"font-mono text-zinc-300",children:c||"—"})]}):null,$?(0,s.jsxs)("div",{className:"rounded-lg border border-violet-500/20 bg-violet-500/[0.06] px-3 py-2.5",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsx)("span",{className:"text-[11px] font-medium text-zinc-400",children:J?i("当前直播源站(日志)","Current source (from log)"):q?i("配置中的源站地址","Configured source URL"):i("源站快捷入口","Source quick link")}),(0,s.jsxs)("a",{href:$,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg bg-violet-500/20 px-3 py-1.5 text-xs font-medium text-violet-100 ring-1 ring-violet-500/35 transition hover:bg-violet-500/30",children:[(0,s.jsx)(H.Z,{className:"h-3.5 w-3.5 shrink-0 opacity-90"}),X||i("打开抖音直播页","Open Douyin live")]})]}),G.length>1&&J?(0,s.jsxs)("p",{className:"mt-2 text-[10px] text-zinc-600",children:[i("配置中还有","Also in config:")," ",G.filter(e=>e!==X).slice(0,3).map(e=>(0,s.jsx)("a",{href:"https://live.douyin.com/".concat(e),target:"_blank",rel:"noreferrer",className:"ml-1 text-violet-400/90 underline-offset-2 hover:underline",children:e},e)),G.length>4?"…":null]}):null]}):(0,s.jsx)("p",{className:"text-[11px] text-zinc-600",children:i("(日志与地址列表中暂无抖音房间)","(No Douyin room in log or URL list)")})]}),"not_found"!==m&&"invalid"!==m?(0,s.jsxs)("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-emerald-400/90",children:i("进程输出(stdout / 合并日志)","Process output")}),(0,s.jsx)("pre",{ref:A,className:"log-live-scroll mt-2 max-h-[min(22rem,42vh)] min-h-[12rem] overflow-auto whitespace-pre-wrap rounded-xl border border-emerald-500/20 bg-black/55 p-3 font-mono text-[10px] leading-relaxed text-emerald-100/95",children:p.trim()||i("(暂无)","(empty)")})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-rose-400/90",children:i("异常信息(stderr)","Stderr")}),(0,s.jsx)("pre",{ref:D,className:"log-live-scroll mt-2 max-h-[min(22rem,42vh)] min-h-[12rem] overflow-auto whitespace-pre-wrap rounded-xl border border-rose-500/20 bg-black/55 p-3 font-mono text-[10px] leading-relaxed text-rose-100/95",children:g.trim()||i("(暂无)","(empty)")})]})]}):(0,s.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:i("进程未在 PM2 / 本地注册表中运行,日志区域已隐藏。","Process not running — log panes hidden.")})]})}function ej(e){return/tiktok/i.test(e.script)||/tiktok/i.test(e.pm2)}let eN=[{id:"720p60",labelZh:"720p @ 60Hz",labelEn:"720p @ 60Hz",spec:"1280x720, 59.94/60Hz, RGB/YUV 有限",hintZh:"板端 HDMI 输出时序与显示端一致;下游画布建议 1280\xd7720。",hintEn:"Match SoC HDMI timing to the display; downstream canvas e.g. 1280\xd7720."},{id:"1080p30",labelZh:"1080p @ 30Hz",labelEn:"1080p @ 30Hz",spec:"1920x1080, 30Hz",hintZh:"带宽紧张时可优先 1080p30;检查线材与接口规格。",hintEn:"Prefer 1080p30 when bandwidth is tight; check cable and port specs."},{id:"1080p60",labelZh:"1080p @ 60Hz",labelEn:"1080p @ 60Hz",spec:"1920x1080, 60Hz, 高刷转播",hintZh:"两端均需稳定支持 1080p60;长时间运行注意散热。",hintEn:"Both ends need stable 1080p60; mind thermals for long runs."}],ek="live-hub-tiktok-hdmi-check-v1",ez="live-hub-tiktok-hdmi-notes-v1",eS="live-hub-tiktok-source-mode-v1";function e_(e){var t;let{t:n,busy:l,entries:i,currentProc:r,setCurrentProc:a,urlConfig:o,setUrlConfig:c,onRunProcess:d,onSaveUrlConfig:x,onReplayGoLive:u,onCopy:m,fetchJson:h,apiPrefix:p,quickLinks:b,hdmiStatus:g,notify:f,onNavigate:v}=e,y=(0,L.useMemo)(()=>i.filter(ej),[i]),w=y.length?y:i,[j,N]=(0,L.useState)("srs"),[k,z]=(0,L.useState)([]),[S,C]=(0,L.useState)(!1),[R,P]=(0,L.useState)(!1),[M,T]=(0,L.useState)("1080p30"),[U,E]=(0,L.useState)("1080p30"),[I,A]=(0,L.useState)(!1),[D,O]=(0,L.useState)(!0),[H,B]=(0,L.useState)(null),K=(0,L.useRef)(!1),F=(0,L.useRef)(o),[Y,G]=(0,L.useState)(""),[J,V]=(0,L.useState)({}),X=(0,L.useCallback)(e=>{F.current=e,c(e)},[c]),$=(0,L.useCallback)(e=>{N(e);try{window.localStorage.setItem(eS,e)}catch(e){}},[]);(0,L.useEffect)(()=>{try{let e=window.localStorage.getItem(eS);("ffmpeg"===e||"replay"===e||"srs"===e)&&("ffmpeg"!==e&&"replay"!==e?N(e):N("srs"))}catch(e){}},[]),(0,L.useEffect)(()=>{K.current=!1},[r]),(0,L.useEffect)(()=>{F.current=o},[o]);let Q=(0,L.useCallback)(async()=>{if(r)try{var e;let t=new URLSearchParams({process:r,_ts:String(Date.now())}),n=await h("/get_url_config?".concat(t));X(null!==(e=n.content)&&void 0!==e?e:"")}catch(e){}},[X,r,h]);(0,L.useEffect)(()=>{if(!r||!D||"ffmpeg"!==j)return;let e=window.setInterval(()=>{K.current||Q()},8e3);return()=>clearInterval(e)},[r,D,Q,j]),(0,L.useEffect)(()=>{"ffmpeg"===j&&r&&Q()},[j,r,Q]);let ee=(0,L.useCallback)(async()=>{if(r){C(!0);try{var e;let t=await h("/tiktok_replay/list?process=".concat(encodeURIComponent(r)));z(null!==(e=t.files)&&void 0!==e?e:[])}catch(e){f(e.message),z([])}finally{C(!1)}}},[r,h,f]);(0,L.useEffect)(()=>{"replay"===j&&r&&ee()},[j,r,ee]),(0,L.useEffect)(()=>{try{let e=window.localStorage.getItem(ek);e&&V(JSON.parse(e))}catch(e){}try{G(window.localStorage.getItem(ez)||"")}catch(e){}},[]);let et=(0,L.useCallback)(e=>{V(e);try{window.localStorage.setItem(ek,JSON.stringify(e))}catch(e){}},[]),en=e=>{G(e);try{window.localStorage.setItem(ez,e)}catch(e){}},es=async()=>{if(r){A(!0),B(null),K.current=!1;try{var e;let t=new URLSearchParams({process:r,_ts:String(Date.now())}),s=await h("/get_url_config?".concat(t));X(null!==(e=s.content)&&void 0!==e?e:""),B(n("已从服务器读取 URL_config","Reloaded URL_config from server"))}catch(e){B(e.message)}finally{A(!1)}}},el=async()=>{try{await Promise.resolve(x(F.current)),K.current=!1}catch(e){}},ei=async e=>{if(r){P(!0);try{await h("/tiktok_replay/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:r,filename:e})}),f(n("已删除文件","File removed")),await ee()}catch(e){f(e.message)}finally{P(!1)}}},er=async e=>{var t;let s=null===(t=e.target.files)||void 0===t?void 0:t[0];if(e.target.value="",s&&r){P(!0);try{let e=new FormData;e.append("file",s);let t=await (0,q.N)("".concat(p,"/tiktok_replay/upload?process=").concat(encodeURIComponent(r)),{method:"POST",body:e});f(t.message||n("上传成功","Uploaded")),await ee()}catch(e){f(e.message)}finally{P(!1)}}},ea=l||I||R,eo=eN.find(e=>e.id===U),em=!!(null==g?void 0:g.can_stream_hdmi),ep=(null==g?void 0:g.preferred_device)||(null==g?void 0:null===(t=g.video_devices)||void 0===t?void 0:t[0])||"";return(0,s.jsxs)("div",{className:"mx-auto max-w-4xl space-y-6",children:[v?(0,s.jsx)(eh,{t:n,title:n("TikTok HDMI 硬件链路","TikTok HDMI hardware chain"),subtitle:n("板端编码经 HDMI 到显示/下游设备;与「网络」页顶卡相同的箭头风格。","Encode on SoC → HDMI → display/downstream; same arrow style as Network header."),onNavigate:v,steps:[{label:"FFmpeg",sub:n("采集 / 推流","Capture"),gradient:"from-cyan-400 to-blue-500",target:"live_tiktok"},{label:"HDMI",sub:n("板载输出","SoC out"),gradient:"from-violet-500 to-fuchsia-500"},{label:"Android",sub:n("AOSP / 手机","AOSP"),gradient:"from-amber-400 to-orange-500",target:"android"}]}):null,(0,s.jsx)("div",{className:"rounded-2xl border border-cyan-500/25 bg-gradient-to-br from-cyan-500/[0.14] via-zinc-950/80 to-fuchsia-500/10 p-6 shadow-xl shadow-cyan-900/10",children:(0,s.jsx)("div",{className:"flex flex-wrap items-start gap-4",children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-gradient-to-br from-cyan-500/35 to-fuchsia-600/25 ring-1 ring-white/10",children:(0,s.jsx)(Z.Z,{className:"h-5 w-5 text-cyan-200"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold tracking-tight text-white",children:n("TikTok 无人直播(单路)","TikTok unmanned (single lane)")}),(0,s.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:n("布局对齐 YouTube 单频道:直播开关 + 源站 + URL_config;无 stream key,输出走 HDMI 硬件链路。","Same layout as YouTube single: controls + URLs; no stream key — HDMI hardware path.")})]})]})})}),(0,s.jsx)("div",{className:"rounded-2xl border border-cyan-500/20 bg-cyan-500/[0.06] p-4 ring-1 ring-white/[0.04]",children:(0,s.jsx)("p",{className:"text-xs leading-relaxed text-cyan-100/90",children:n("HDMI 互斥:后端在「开始 / 重新开始」TikTok 或 obs*.sh(SRS 拉流上屏)时,会自动停止其它正在占用 HDMI 链路的同类进程;与 YouTube 推流互不干扰。","HDMI mutex: starting TikTok or obs*.sh stops other TikTok/OBS HDMI sinks; YouTube RTMP is unaffected.")})}),(0,s.jsxs)("div",{className:"rounded-2xl border border-white/10 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,s.jsx)(ec.Z,{className:"h-4 w-4 text-cyan-300"}),n("X86 HDMI 采集状态","X86 HDMI capture status")]}),(0,s.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:n("这里直接显示主机是否识别到采集卡和 /dev/video 设备,可用于验证 ARM HDMI 进 X86 的链路。","Shows whether the host sees the capture card and /dev/video nodes for ARM-to-X86 HDMI ingest.")})]}),(0,s.jsx)("span",{className:"rounded-full px-3 py-1 text-[11px] font-semibold ring-1 ".concat(em?"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30":"bg-rose-500/15 text-rose-200 ring-rose-500/25"),children:em?n("可推流","Ready"):n("未就绪","Not ready")})]}),(0,s.jsxs)("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-4 text-[11px] text-zinc-400",children:[(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"text-zinc-600",children:"device: "}),(0,s.jsx)("span",{className:"font-mono text-zinc-200",children:ep||"—"})]}),(0,s.jsxs)("p",{className:"mt-2",children:[(0,s.jsx)("span",{className:"text-zinc-600",children:"video nodes: "}),(0,s.jsx)("span",{className:"font-mono text-zinc-200",children:((null==g?void 0:g.video_devices)||[]).join(", ")||"—"})]}),(0,s.jsxs)("p",{className:"mt-2",children:[(0,s.jsx)("span",{className:"text-zinc-600",children:"usb matches: "}),(0,s.jsx)("span",{className:"text-zinc-300",children:((null==g?void 0:g.usb_capture_matches)||[]).length||0})]})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-4 text-[11px] text-zinc-400",children:[(0,s.jsx)("p",{className:"text-zinc-600",children:n("建议 FFmpeg","Suggested FFmpeg")}),(0,s.jsx)("p",{className:"mt-2 break-all font-mono text-zinc-200",children:(null==g?void 0:g.suggested_ffmpeg_cmd)||"—"}),(null==g?void 0:g.suggested_ffmpeg_cmd)?(0,s.jsxs)("button",{type:"button",onClick:()=>m(g.suggested_ffmpeg_cmd||""),className:"mt-3 inline-flex items-center gap-2 rounded-lg bg-cyan-500/15 px-3 py-2 text-xs font-medium text-cyan-100 ring-1 ring-cyan-500/25",children:[(0,s.jsx)(_.Z,{className:"h-3.5 w-3.5"}),n("复制命令","Copy command")]}):null]})]}),((null==g?void 0:g.issues)||[]).length?(0,s.jsx)("ul",{className:"mt-4 list-inside list-disc space-y-1 text-[11px] text-amber-200/85",children:((null==g?void 0:g.issues)||[]).map(e=>(0,s.jsx)("li",{children:e},e))}):null]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-amber-500/20 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-amber-200/90",children:[(0,s.jsx)(W.Z,{className:"h-4 w-4"}),(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:n("直播开关","Live control")})]}),(0,s.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:n("TikTok 进程(PM2)","TikTok PM2 process")}),(0,s.jsx)("select",{className:"mt-2 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm text-white",value:r,onChange:e=>a(e.target.value),children:w.map(e=>(0,s.jsxs)("option",{value:e.pm2,children:[e.label," (",e.pm2,")"]},e.pm2))}),(0,s.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:n("直播源","Video source")}),(0,s.jsxs)("select",{className:"mt-2 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm text-white",value:j,onChange:e=>$(e.target.value),children:[(0,s.jsx)("option",{value:"ffmpeg",hidden:!0,children:"FFmpeg(抖音 / TikTok 等直播间 URL)"}),(0,s.jsx)("option",{value:"replay",hidden:!0,children:n("录播素材(本地上传)","VOD upload")}),(0,s.jsx)("option",{value:"srs",children:n("SRS(OBS 推流)","SRS (OBS)")})]}),"srs"===j?(0,s.jsx)("p",{className:"mt-2 text-[11px] leading-relaxed text-amber-200/85",children:n("此模式不显示 URL_config:请在 OBS 中填写下方 RTMP 推流地址;板端 SRS 拉流上屏仍可能占用 HDMI,与 TikTok 进程互斥规则不变。","URL_config is hidden: set the RTMP URL in OBS. SRS pull-to-HDMI may still mutex with TikTok per server rules.")}):null,(0,s.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[["start",n("开始直播","Start"),"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30"],["stop",n("停止直播","Stop"),"bg-rose-500/15 text-rose-200 ring-rose-500/25"],["restart",n("重新开始","Restart"),"bg-amber-500/15 text-amber-200 ring-amber-500/25"]].map(e=>{let[t,n,l]=e;return(0,s.jsx)("button",{type:"button",disabled:ea,onClick:()=>d(t),className:"rounded-xl px-4 py-3 text-sm font-medium ring-1 ".concat(l),children:n},t)})}),(0,s.jsxs)("p",{className:"mt-3 text-center text-[11px] text-zinc-500",children:[n("当前 HDMI 预设(备忘)","HDMI preset (memo)"),":"," ",(0,s.jsx)("span",{className:"font-mono text-cyan-300/90",children:eo?n(eo.labelZh,eo.labelEn):U})]})]}),"replay"===j?(0,s.jsxs)("div",{className:"rounded-2xl border border-violet-500/25 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,s.jsx)(ed.Z,{className:"h-4 w-4 text-violet-300"}),n("录播素材","VOD library")]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsxs)("label",{className:"inline-flex cursor-pointer items-center gap-2 rounded-xl bg-violet-500/15 px-3 py-2 text-xs font-medium text-violet-100 ring-1 ring-violet-500/30",children:[(0,s.jsx)(ex.Z,{className:"h-3.5 w-3.5"}),(0,s.jsx)("span",{children:n("上传视频","Upload")}),(0,s.jsx)("input",{type:"file",accept:".mp4,.mkv,.ts,.flv,.mov,.m4v,.webm",className:"hidden",onChange:er})]}),(0,s.jsx)("button",{type:"button",disabled:ea||!r,onClick:()=>void ee(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-300",children:n("刷新列表","Refresh")})]})]}),(0,s.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:n("文件保存在服务器 config/tiktok_replay/对应进程目录;点「开始直播」会写入 replayfile 行并启动 PM2 进程。停播请用上方「停止直播」。","Files under config/tiktok_replay/<process>. Go live writes replayfile + starts PM2. Use Stop above to stop.")}),S?(0,s.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:n("加载中…","Loading…")}):0===k.length?(0,s.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:n("暂无文件,请先上传。","No files yet.")}):(0,s.jsx)("ul",{className:"mt-4 space-y-2",children:k.map(e=>(0,s.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-xl border border-white/10 bg-black/30 px-3 py-2 text-xs text-zinc-300",children:[(0,s.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.name}),(0,s.jsxs)("span",{className:"shrink-0 text-zinc-500",children:[(e.size/1048576).toFixed(1)," MB"]}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-wrap gap-2",children:[(0,s.jsx)("button",{type:"button",disabled:ea,onClick:()=>void(async()=>{try{await Promise.resolve(u(e.replay_url,e.name))}catch(e){}})(),className:"rounded-lg bg-emerald-500/20 px-2 py-1 text-[11px] text-emerald-100 ring-1 ring-emerald-500/30",children:n("开始直播","Go live")}),(0,s.jsx)("button",{type:"button",disabled:ea,onClick:()=>d("stop"),className:"rounded-lg bg-rose-500/15 px-2 py-1 text-[11px] text-rose-100 ring-1 ring-rose-500/25",children:n("停播","Stop")}),(0,s.jsxs)("button",{type:"button",disabled:ea,onClick:()=>void ei(e.name),className:"inline-flex items-center gap-1 rounded-lg bg-zinc-700/40 px-2 py-1 text-[11px] text-zinc-200",children:[(0,s.jsx)(eu.Z,{className:"h-3 w-3"}),n("删除","Del")]})]})]},e.name))})]}):null,"srs"===j?(0,s.jsxs)("div",{className:"rounded-2xl border border-emerald-500/25 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:n("SRS / OBS 推流","SRS / OBS ingest")}),(0,s.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:n("OBS:设置 → 推流 → 服务选「自定义」,服务器填 RTMP 地址;串流密钥可与 SRS 应用配置一致(默认 live/livestream)。","OBS → Stream → Custom: RTMP URL as server; stream key per SRS app (default live/livestream).")}),(0,s.jsxs)("dl",{className:"mt-4 space-y-3 text-xs",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{className:"text-zinc-500",children:n("RTMP 推流地址(OBS 服务器)","RTMP publish URL")}),(0,s.jsxs)("dd",{className:"mt-1 flex flex-wrap items-center gap-2 font-mono text-emerald-200/90",children:[(0,s.jsx)("span",{className:"break-all",children:b.srs_rtmp_publish||"—"}),b.srs_rtmp_publish?(0,s.jsx)("button",{type:"button",className:"shrink-0 text-cyan-300 hover:text-cyan-200",onClick:()=>m(b.srs_rtmp_publish),children:(0,s.jsx)(_.Z,{className:"h-3.5 w-3.5"})}):null]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{className:"text-zinc-500",children:n("HTTP-FLV 预览","HTTP-FLV preview")}),(0,s.jsxs)("dd",{className:"mt-1 flex flex-wrap items-center gap-2 font-mono text-zinc-400",children:[(0,s.jsx)("span",{className:"break-all",children:b.srs_play_flv||b.srs_http||"—"}),b.srs_play_flv||b.srs_http?(0,s.jsx)("button",{type:"button",className:"shrink-0 text-cyan-300 hover:text-cyan-200",onClick:()=>m(b.srs_play_flv||b.srs_http),children:(0,s.jsx)(_.Z,{className:"h-3.5 w-3.5"})}):null]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{className:"text-zinc-500",children:n("SRS 控制台","SRS web UI")}),(0,s.jsx)("dd",{className:"mt-1 font-mono text-zinc-400",children:(0,s.jsx)("a",{href:b.srs_http||"#",target:"_blank",rel:"noreferrer",className:"text-cyan-300 hover:underline",children:b.srs_http||"—"})})]})]})]}):null,(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,s.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,s.jsx)(ec.Z,{className:"h-4 w-4 text-cyan-400"}),n("HDMI 硬件与时序","HDMI timing")]}),(0,s.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:n("点选一路作为现场备忘;与板端 ffmpeg/OBS 采集参数对齐。","Pick a preset as field memo; match capture settings.")}),(0,s.jsx)("div",{className:"mt-4 grid gap-3 md:grid-cols-3",children:eN.map(e=>{let t=M===e.id,l=U===e.id;return(0,s.jsxs)("button",{type:"button",onClick:()=>{T(t?null:e.id),E(e.id)},className:"rounded-2xl border p-4 text-left transition ".concat(l?"border-cyan-500/50 ring-1 ring-cyan-500/20":""," ").concat(t?"border-cyan-500/40 bg-cyan-500/10":"border-white/[0.08] bg-zinc-950/50 hover:border-white/15"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,s.jsx)(ec.Z,{className:"h-4 w-4 text-cyan-400"}),n(e.labelZh,e.labelEn)]}),(0,s.jsx)("p",{className:"mt-2 font-mono text-[11px] text-zinc-400",children:e.spec}),t?(0,s.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:n(e.hintZh,e.hintEn)}):null]},e.id)})}),(0,s.jsxs)("div",{className:"mt-6 rounded-xl border border-white/5 bg-black/25 p-4",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-zinc-400",children:n("上线前检查清单(本地保存)","Pre-flight checklist (local)")}),(0,s.jsx)("ul",{className:"mt-3 space-y-2",children:[{id:"cable",zh:"HDMI 线材插紧、方向正确(如需转接头确认规格)",en:"HDMI cable seated; adapter specs OK"},{id:"thermal",zh:"长时间推流注意散热,过热会掉帧黑屏",en:"Thermal headroom for long runs"}].map(e=>(0,s.jsxs)("li",{className:"flex items-start gap-2 text-xs text-zinc-400",children:[(0,s.jsx)("input",{type:"checkbox",className:"mt-0.5 rounded border-white/20 bg-black/40",checked:!!J[e.id],onChange:t=>et({...J,[e.id]:t.target.checked})}),(0,s.jsx)("span",{children:n(e.zh,e.en)})]},e.id))}),(0,s.jsx)("label",{className:"mt-4 block text-[11px] text-zinc-500",children:n("HDMI / 走线备忘","HDMI / wiring notes")}),(0,s.jsx)("textarea",{className:"mt-1 min-h-[72px] w-full resize-y rounded-lg border border-white/10 bg-black/40 p-3 text-xs text-zinc-300",value:Y,onChange:e=>en(e.target.value),spellCheck:!1,placeholder:n("接口、线长、显示器型号…","Ports, cable length, display model…")})]})]}),"ffmpeg"===j?(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:n("直播地址列表 \xb7 URL_config.ini","URL_config.ini")}),(0,s.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1 text-xs text-cyan-300 hover:text-cyan-200",onClick:()=>m(o),children:[(0,s.jsx)(_.Z,{className:"h-3.5 w-3.5"}),n("复制全文","Copy all")]})]}),(0,s.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:n("一行一个地址;可勾选自动从服务器刷新,或点「重新读取」手动同步。","One URL per line; enable auto-refresh or reload from server.")}),(0,s.jsx)("div",{className:"mt-2 flex flex-wrap items-center gap-4 text-xs text-zinc-400",children:(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,s.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:D,onChange:e=>O(e.target.checked)}),n("每 8 秒自动从服务器刷新","Auto-refresh from server every 8s")]})}),H?(0,s.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:H}):null,(0,s.jsx)("textarea",{className:"mt-4 min-h-[200px] w-full resize-y rounded-xl border border-white/10 bg-black/50 p-4 font-mono text-xs text-zinc-300",value:o,onChange:e=>{K.current=!0,X(e.target.value)},spellCheck:!1}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,s.jsx)("button",{type:"button",disabled:ea,onClick:()=>void es(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-300",children:n("重新读取","Reload from server")}),(0,s.jsx)("button",{type:"button",disabled:ea,onClick:()=>void el(),className:"rounded-xl bg-cyan-500/20 px-4 py-2 text-sm font-medium text-cyan-100 ring-1 ring-cyan-500/30",children:n("保存 URL 配置","Save URL config")})]})]}):null,(0,s.jsx)(ew,{t:n,currentProc:r,fetchJson:h,urlListText:"ffmpeg"===j?o:"",keySuffixUi:"",showKeyRow:!1})]})}var eC=n(5468),eR=n(9397),eP=n(90);let eL="live-hub-youtube-pro-v2",eM="youtube2__",eT=/[^a-zA-Z0-9_.-]+/g,eU=new Set(["youtube","douyin_youtube","tiktok","obs","web"]);function eE(e){return(e||"").trim().replace(eT,"_")}function eI(e,t){let n=eE(e);return!n||eU.has(n)||n===eM?eF(t):n.startsWith(eM)?n:eF(n)}function eA(e){return eI(String(e.pm2Name||""),String(e.id||""))}function eD(e){if(!e||"object"!=typeof e)return null;let t=String(e.id||"").trim();if(!t)return null;let n=String(e.name||"").trim()||t;return{id:t,name:n,streamKeySuffix:"string"==typeof e.streamKeySuffix?e.streamKeySuffix:void 0,streamKey:"string"==typeof e.streamKey?e.streamKey:void 0,urlLines:"string"==typeof e.urlLines?e.urlLines:void 0,pm2Name:eI("string"==typeof e.pm2Name?e.pm2Name:"",t),notes:"string"==typeof e.notes?e.notes:void 0}}function eZ(e){if(!e)return[];try{let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.map(e=>eD(e)).filter(e=>null!==e)}catch(e){return[]}}function eO(e){window.localStorage.setItem(eL,JSON.stringify(e))}let eH=["/hub/youtube_pro_channels","/youtube_pro_channels"];async function eB(e){for(let n of eH)try{var t;let s=await e(n);return{fetched:!0,channels:(t=s.channels,Array.isArray(t)?t.map(e=>eD(e)).filter(e=>null!==e):[])}}catch(e){}return{fetched:!1,channels:[]}}async function eK(e,t){let n=null;for(let l of eH)try{var s;let i=await e(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channels:t})});if((null===(s=i.neko)||void 0===s?void 0:s.ok)===!1){let e=i.neko.desired?" desired=".concat(i.neko.desired):"",t=i.neko.current?" current=".concat(i.neko.current):"";n=Error("Neko capacity expansion failed:".concat(e).concat(t," ").concat(i.neko.reason||"unknown error").trim());break}return}catch(e){n=e instanceof Error?e:Error(String(e))}throw null!=n?n:Error("youtube_pro_channels sync failed")}function eW(){return"ch_".concat(Date.now().toString(36),"_").concat(Math.random().toString(36).slice(2,7))}function eF(e){return"".concat(eM).concat(eE(e)||"channel")}function eY(e){return/youtube/i.test(e.script)||/youtube/i.test(e.pm2)}function eG(e){return(e.split("/").pop()||e).replace(/\.[^.]+$/,"")}function eq(e){var t;return!!e&&(/youtube/i.test(e.pm2)||/youtube/i.test(null!==(t=e.script)&&void 0!==t?t:""))}function eJ(e,t){let n=((null==t?void 0:t.business_status)||"").trim().toLowerCase();return(null==t?void 0:t.is_pushing)||"streaming"===n?0:eQ(null==t?void 0:t.process_status)?1:"youtube"===e.pm2.trim().toLowerCase()?2:"youtube"===eG(e.script).trim().toLowerCase()?3:10}let eV="live-hub-youtube-mode-v1",eX=new Set(["youtube","douyin_youtube","tiktok","obs","web"]);function e$(e){var t,n,s;return{name:e.name,streamKey:null!==(t=e.streamKey)&&void 0!==t?t:"",pm2Name:null!==(n=e.pm2Name)&&void 0!==n?n:eF(e.id),notes:null!==(s=e.notes)&&void 0!==s?s:""}}function eQ(e){return/^(online|running)$/i.test((e||"").trim())}function e0(e,t){let n=((null==e?void 0:e.business_status)||"").trim().toLowerCase();return"ready"===n?t("已配置","Ready"):"streaming"===n?t("推流中","Pushing"):"waiting_source"===n?t("等待上游","Waiting source"):"source_live"===n?t("源已开播,转推未起","Source live, relay down"):"monitoring"===n?t("监控中","Monitoring"):"misconfigured"===n?t("密钥异常","Key invalid"):"stale"===n?t("心跳过期","Stale"):"error"===n?t("异常","Error"):eQ(null==e?void 0:e.process_status)?t("运行中","Running"):((null==e?void 0:e.process_status)||"").trim()||t("未运行","Idle")}function e1(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith("#"))}function e5(e,t){return e1(e).length>0&&0===e1(t).length}function e2(e){let{kind:t,busyKind:n,targetPm2:l,busy:i,online:r,label:a,className:o,baseLock:c,onRun:d,notify:x,t:u,compact:m}=e,h=function(e){if(!(null==e?void 0:e.startsWith("proc:")))return null;let t=e.slice(5),n=t.indexOf(":");if(n<=0)return null;let s=t.slice(0,n),l=t.slice(n+1);return l&&["start","stop","restart"].includes(s)?{action:s,pm2:l}:null}(i),p=h&&h.pm2===l,b=null!=n?n:t,g=!!(p&&h.action===b),f=!!(p&&h.action!==b),y="start"===t&&r,w="stop"===t&&!r,j="restart"===t&&!r,N=y||w||j;return(0,s.jsxs)("button",{type:"button",onClick:()=>{if(!g){if(f){x(u("请等待当前操作完成","Wait for the current action to finish"));return}if(y){x(u("已在直播中,无需重复开始","Already live"));return}if(w){x(u("当前未在直播,无法停止","Not live — cannot stop"));return}if(j){x(u("进程未运行时请使用「开始直播」","Use Start when the process is not running"));return}c||d()}},className:"relative overflow-hidden rounded-xl ring-1 transition ".concat(m?"min-h-[2rem] px-3 py-1.5 text-xs font-medium":"min-h-[2.75rem] px-4 py-3 text-sm font-medium"," ").concat(o," ").concat(N||c||g||f?"cursor-not-allowed":""," ").concat(N&&!g?"opacity-45":""," ").concat(f?"opacity-35":""," ").concat(g?"ring-violet-400/40":""),children:[g?(0,s.jsx)("span",{className:"absolute inset-0 flex items-center justify-center bg-black/25 backdrop-blur-[2px]",children:(0,s.jsx)(v.Z,{className:"".concat(m?"h-4 w-4":"h-6 w-6"," animate-spin text-white")})}):null,(0,s.jsxs)("span",{className:"inline-flex items-center justify-center gap-1.5 ".concat(g?"invisible":""),children:[N?(0,s.jsx)(eC.Z,{className:"".concat(m?"h-3 w-3":"h-4 w-4"," shrink-0 opacity-90"),"aria-hidden":!0}):null,a]})]})}function e3(e){var t,n,l,i,r;let{t:a,busy:o,entries:d,currentProc:x,setCurrentProc:u,urlConfig:m,setUrlConfig:h,onRunProcess:p,onSaveUrlConfig:b,fetchJson:g,liveProcesses:f,notify:w,onNavigate:j,quickLinks:N}=e,k=(0,L.useMemo)(()=>d.filter(eY),[d]),z=(0,L.useMemo)(()=>(function(e,t){let n=e.filter(eY),s=n.filter(e=>eY(e)&&e.pm2.trim()===eG(e.script).trim()),l=s.length?[...s]:n.length?[...n]:[...e],i=new Set(l.map(e=>e.pm2.trim()));for(let e of t.filter(eq)){var r,a,o,c;let t=e.pm2.trim();if(!t||i.has(t))continue;let s=(e.business_status||"").trim().toLowerCase();if(!e.is_pushing&&"streaming"!==s&&!eQ(e.process_status))continue;let d=n.find(e=>e.pm2.trim()===t);l.push(null!=d?d:{pm2:t,script:null!==(o=null!==(a=e.script)&&void 0!==a?a:null===(r=n[0])||void 0===r?void 0:r.script)&&void 0!==o?o:"youtube.py",label:null!==(c=e.label)&&void 0!==c?c:t}),i.add(t)}return l})(k.length?k:d,f),[d,f,k]),S=(0,L.useMemo)(()=>(function(e,t){if(!e.length)return"";let n=new Map(t.filter(eq).map(e=>[e.pm2.trim(),e])),s=e[0],l=eJ(s,n.get(s.pm2.trim()));for(let t of e.slice(1)){let e=eJ(t,n.get(t.pm2.trim()));e<l&&(s=t,l=e)}return s.pm2})(z,f)||function(e){var t,n;let s=e.find(e=>"youtube"===e.pm2.trim().toLowerCase());if(s)return s.pm2;let l=e.find(e=>"youtube"===eG(e.script).trim().toLowerCase());return l?l.pm2:null!==(n=null===(t=e[0])||void 0===t?void 0:t.pm2)&&void 0!==n?n:""}(z),[f,z]),[_,C]=(0,L.useState)("single"),[R,P]=(0,L.useState)([]),[M,T]=(0,L.useState)(""),[U,E]=(0,L.useState)(""),[I,A]=(0,L.useState)({key:"",rtmps:!0,bitrate:"",fastAudio:!1}),[D,Z]=(0,L.useState)(null),[O,B]=(0,L.useState)(!1),[K,F]=(0,L.useState)(""),[Y,G]=(0,L.useState)(!0),[q,J]=(0,L.useState)(!1),[V,X]=(0,L.useState)(!1),[$,Q]=(0,L.useState)(null),[ee,et]=(0,L.useState)({}),[en,es]=(0,L.useState)(!1),[el,ei]=(0,L.useState)(null),[er,ea]=(0,L.useState)(0),eo=(0,L.useRef)(!1),ec=(0,L.useRef)(m),ed=(0,L.useRef)(K),ex=(0,L.useRef)([]),ey=(0,L.useRef)(x),ej=(0,L.useRef)(0),eN=(0,L.useRef)(0),ek=(0,L.useCallback)(e=>{ec.current=e,h(e)},[h]),ez=(0,L.useCallback)(e=>{ed.current=e,F(e)},[]);(0,L.useEffect)(()=>{eo.current=!1},[x]),(0,L.useEffect)(()=>{ey.current=x},[x]),(0,L.useEffect)(()=>{ec.current=m},[m]),(0,L.useEffect)(()=>{ed.current=K},[K]),(0,L.useEffect)(()=>{ex.current=R},[R]);let eS=(0,L.useCallback)((e,t)=>{e&&P(n=>{let s=!1,l=n.map(n=>{var l;return n.id!==e||(null!==(l=n.urlLines)&&void 0!==l?l:"")===t?n:(s=!0,{...n,urlLines:t})});return s?(ex.current=l,eO(l),l):n})},[]),e_=(0,L.useCallback)(async()=>{let e=ey.current.trim();if(!e)return;let t=++ej.current;try{var n,s,l;let i=new URLSearchParams({process:e,_ts:String(Date.now())}),r=await g("/get_url_config?".concat(i));if(t!==ej.current||e!==ey.current.trim())return;let a=null!==(n=r.content)&&void 0!==n?n:"";if(eo.current)return;if("single"===_)ek(a);else{let e=null!==(l=null===(s=ex.current.find(e=>e.id===M))||void 0===s?void 0:s.urlLines)&&void 0!==l?l:"";if(e5(e,a)){ez(e);return}ez(a),eS(M,a)}}catch(e){}},[M,ez,ek,g,_,eS]);(0,L.useEffect)(()=>{if(!x||!Y)return;let e=window.setInterval(()=>{eo.current||e_()},8e3);return()=>clearInterval(e)},[x,Y,e_]);let eC=async()=>{let e=ey.current.trim();if(!e)return;J(!0),Q(null),eo.current=!1;let t=++ej.current;try{var n,s,l;let i=new URLSearchParams({process:e,_ts:String(Date.now())}),r=await g("/get_url_config?".concat(i));if(t!==ej.current||e!==ey.current.trim())return;let o=null!==(n=r.content)&&void 0!==n?n:"";if(eo.current){Q(a("检测到本地未保存修改,已保留当前草稿","Kept the local unsaved draft"));return}if("single"===_)ek(o);else{let e=null!==(l=null===(s=ex.current.find(e=>e.id===M))||void 0===s?void 0:s.urlLines)&&void 0!==l?l:"";if(e5(e,o)){ez(e),Q(a("服务器暂无已保存 URL,已保留本地草稿","Server has no saved URLs, kept the local draft"));return}ez(o),eS(M,o)}Q(a("已从服务器读取 URL_config","Reloaded URL_config from server"))}catch(n){if(t!==ej.current||e!==ey.current.trim())return;Q(n.message)}finally{t===ej.current&&J(!1)}};(0,L.useEffect)(()=>{try{let e=window.localStorage.getItem(eV);("pro"===e||"single"===e)&&C(e)}catch(e){}},[]),(0,L.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await eB(g);if(t.fetched&&t.channels.length&&!e){ex.current=t.channels,P(t.channels),eO(t.channels);return}}catch(e){}if(e)return;let t=function(){let e=window.localStorage.getItem(eL);if(!e&&(e=window.localStorage.getItem("live-hub-youtube-pro-v1"))){let t=eZ(e);if(t.length)return window.localStorage.setItem(eL,JSON.stringify(t)),t}return eZ(e)}(),n=t.length>0?t:(()=>{let e=eW();return[{id:e,name:"线路 1",streamKey:"",urlLines:"",pm2Name:eF(e),notes:""}]})();ex.current=n,P(n),t.length||eO(n)})(),()=>{e=!0}},[g]),(0,L.useEffect)(()=>{if(!R.length){M&&T("");return}M&&R.some(e=>e.id===M)||T(R[0].id)},[R,M]);let eM=(0,L.useCallback)(e=>f.find(t=>t.pm2===e),[f]),eT=(0,L.useCallback)(e=>{var t;return null===(t=eM(e))||void 0===t?void 0:t.process_status},[eM]),eU=eM(x),eI=(0,L.useMemo)(()=>{var e,t;return!!x&&(/youtube/i.test(x)||/youtube/i.test(null!==(e=null==eU?void 0:eU.script)&&void 0!==e?e:"")||/youtube/i.test(null!==(t=null==eU?void 0:eU.label)&&void 0!==t?t:""))},[x,eU]);(0,L.useEffect)(()=>{"single"!==_||!S||x&&eI||u(S)},[x,eI,_,S,u]);let eD=(0,L.useCallback)(e=>{ex.current=e,P(e),eO(e)},[]),eH=(0,L.useCallback)(async e=>{await eK(g,e)},[g]),e3=(0,L.useCallback)(e=>{eD(e),eH(e).catch(e=>{w("".concat(a("多频道列表未同步到服务器","Channel list not saved on server"),": ").concat(e.message))})},[eD,w,eH,a]),e4=R.find(e=>e.id===M)||R[0],e6=(0,L.useMemo)(()=>{var e;return e4?null!==(e=ee[e4.id])&&void 0!==e?e:e$(e4):null},[e4,ee]);(0,L.useEffect)(()=>{e4&&et(e=>e[e4.id]?e:{...e,[e4.id]:e$(e4)})},[e4]),(0,L.useEffect)(()=>{ei(null)},[M]);let e8=(0,L.useCallback)((e,t)=>{e4&&(et(n=>{var s;return{...n,[e4.id]:{...null!==(s=n[e4.id])&&void 0!==s?s:e$(e4),[e]:t}}}),ei(null))},[e4]),e9=e4?eA(e4):"",e7=e4&&e6?eA({id:e4.id,pm2Name:e6.pm2Name}):"",te=!!e4&&!!e6&&e7!==e9,tt=(0,L.useMemo)(()=>{if(!e4||!e6)return{ok:!1,message:a("请选择线路","Pick a lane"),normalizedName:"",normalizedPm2:"",normalizedStreamKey:"",normalizedNotes:""};let e=e6.name.trim()||"".concat(a("线路","Ch")," ").concat(R.findIndex(e=>e.id===e4.id)+1),t=eA({id:e4.id,pm2Name:e6.pm2Name});return t?eX.has(t)?{ok:!1,message:a("该进程名保留给系统模块,请换一个","This PM2 name is reserved"),normalizedName:e,normalizedPm2:t,normalizedStreamKey:e6.streamKey.trim(),normalizedNotes:e6.notes.trim()}:R.find(e=>e.id!==e4.id&&eA(e)===t)?{ok:!1,message:a("该进程名已被其它线路占用","Another lane already uses this PM2 name"),normalizedName:e,normalizedPm2:t,normalizedStreamKey:e6.streamKey.trim(),normalizedNotes:e6.notes.trim()}:{ok:!0,message:"",normalizedName:e,normalizedPm2:t,normalizedStreamKey:e6.streamKey.trim(),normalizedNotes:e6.notes.trim()}:{ok:!1,message:a("进程名不能为空","PM2 name is required"),normalizedName:e,normalizedPm2:t,normalizedStreamKey:e6.streamKey.trim(),normalizedNotes:e6.notes.trim()}},[e4,e6,R,a]),tn=(0,L.useMemo)(()=>{if(!e4||!e6)return!1;let e=e$(e4);return e6.name!==e.name||e6.streamKey!==e.streamKey||eE(e6.pm2Name)!==eE(e.pm2Name)||e6.notes!==e.notes},[e4,e6]),ts=(0,L.useCallback)(e=>{var t,n,s;if("single"===e&&"pro"===_&&e4){let e=ed.current;e!==(null!==(t=e4.urlLines)&&void 0!==t?t:"").trim()&&e3(R.map(t=>t.id===e4.id?{...t,urlLines:e}:t))}if("pro"===e&&R.length){let e=R[0],t=ec.current.trim(),l=eA(e),i=[{...e,streamKey:I.key.trim()||e.streamKey||"",urlLines:t||e.urlLines||"",pm2Name:l},...R.slice(1)];e3(i);let r=null!==(n=i.find(e=>e.id===M))&&void 0!==n?n:i[0];ez((null!==(s=null==r?void 0:r.urlLines)&&void 0!==s?s:"").trim()||t)}C(e);try{window.localStorage.setItem(eV,e)}catch(e){}},[_,e4,R,ez,I.key,M,e3]),tl=(0,L.useCallback)(e=>{var t,n;let s=ed.current;e4&&"pro"===_&&s!==(null!==(t=e4.urlLines)&&void 0!==t?t:"").trim()&&e3(R.map(e=>e.id===e4.id?{...e,urlLines:s}:e)),ez((null!==(n=e.urlLines)&&void 0!==n?n:"").trim()),T(e.id),u(eA(e))},[e4,ez,_,R,u,e3]);(0,L.useEffect)(()=>{if("pro"!==_||!M)return;let e=R.find(e=>e.id===M);e&&u(eA(e))},[_,M,R,u]);let ti=(0,L.useCallback)(async()=>{let e=ey.current.trim();if(!e)return;let t=++eN.current;B(!0),Z(null);try{var n;let s=new URLSearchParams({process:e,_ts:String(Date.now())}),l=await g("/get_config?".concat(s));if(t!==eN.current||e!==ey.current.trim())return;let i=null!==(n=l.content)&&void 0!==n?n:"";E(i),A(eg(i))}catch(n){if(t!==eN.current||e!==ey.current.trim())return;Z(n.message)}finally{t===eN.current&&B(!1)}},[g]);(0,L.useEffect)(()=>{x&&(e_(),ti(),ea(e=>e+1))},[M,x,ti,_,e_]);let tr=(0,L.useCallback)(async()=>{var e;if(!e4||!e6)throw Error(a("请选择线路","Pick a lane"));if(!tt.ok)throw Error(tt.message);let t=ed.current,n=R.map(e=>e.id===e4.id?{...e,name:tt.normalizedName,streamKey:tt.normalizedStreamKey,pm2Name:tt.normalizedPm2,notes:tt.normalizedNotes,urlLines:t}:e);return eD(n),await eH(n),et(e=>({...e,[e4.id]:{name:tt.normalizedName,streamKey:tt.normalizedStreamKey,pm2Name:tt.normalizedPm2,notes:tt.normalizedNotes}})),{next:n,savedLane:null!==(e=n.find(e=>e.id===e4.id))&&void 0!==e?e:{...e4,name:tt.normalizedName,streamKey:tt.normalizedStreamKey,pm2Name:tt.normalizedPm2,notes:tt.normalizedNotes,urlLines:t},pm2:tt.normalizedPm2}},[e4,e6,tt,eD,R,eH,a]),ta=(0,L.useCallback)(async()=>{if(e4){es(!0),ei(null);try{let e=await tr();u(e.pm2),ei(a("线路设置已保存","Lane settings saved"))}catch(t){let e=t.message;ei(e),w(e)}finally{es(!1)}}},[e4,w,tr,u,a]),to=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ey.current,n=t.trim();if(!n){Z(a("请选择进程","Pick a process"));return}B(!0),Z(null);try{let t=new URLSearchParams({process:n});await g("/save_config?".concat(t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})}),E(e),Z(a("youtube.ini 已保存","youtube.ini saved"))}catch(e){Z(e.message)}finally{B(!1)}},tc=async()=>{let e=ev(I);await to(e)},td=async()=>{B(!0),Z(null);try{var e,t;let n=U||ev(I),s=await g("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:"app-config",path:(t=ey.current,"youtube.".concat(t.replace(/[^a-zA-Z0-9_.-]/g,"_"),".ini")),content:n,action:"youtube_balanced_preset"})}),l=null!==(e=s.content)&&void 0!==e?e:n;E(l),A(eg(l)),Z(s.message||a("已应用 YouTube 预设","Applied YouTube preset"))}catch(e){Z(e.message)}finally{B(!1)}},tx=(0,L.useMemo)(()=>{var e,t;if("single"===_)return ep("key = ".concat(I.key));let n=null!==(t=null!==(e=null==e6?void 0:e6.streamKey)&&void 0!==e?e:null==e4?void 0:e4.streamKey)&&void 0!==t?t:"";return ep("key = ".concat(n))},[_,I.key,null==e4?void 0:e4.streamKey,null==e6?void 0:e6.streamKey]),tu=async()=>{if(e4)try{es(!0),ei(null),ej.current+=1;let e=ed.current,t=await tr();u(t.pm2),await Promise.resolve(b(e,t.pm2)),eo.current=!1,ei(a("线路与地址已保存","Lane settings and URLs saved"))}catch(t){let e=t instanceof Error?t.message:String(t);ei(e),w(e)}finally{es(!1)}},tm=async()=>{let e=ey.current.trim();if(!e){w(a("请选择进程","Pick a process"));return}try{ej.current+=1,await Promise.resolve(b(ec.current,e)),eo.current=!1}catch(e){}},th=async()=>{let e="single"===_?ec.current:ed.current;X(!0),Q(null);try{var t;let n=await g("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:"app-config",path:ef(ey.current),content:e,action:"dedupe_urls"})}),s=null!==(t=n.content)&&void 0!==t?t:e;"single"===_?ek(s):ez(s),eo.current=!0,Q(n.message||a("已去重当前 URL 列表","Deduplicated current URL list"))}catch(e){Q(e.message)}finally{X(!1)}},tp=async()=>{if(!e4||!e6)return;let e=eg(U||ev(I)),t=ev({key:e6.streamKey.trim(),rtmps:e.rtmps,bitrate:e.bitrate,fastAudio:e.fastAudio});es(!0),ei(null);try{let e=await tr();u(e.pm2),await to(t,e.pm2),ei(a("线路设置与 youtube.ini 已保存","Lane settings and youtube.ini saved"))}catch(t){let e=t.message;ei(e),w(e)}finally{es(!1)}},tb="single"===_?m:K,tg=(0,L.useMemo)(()=>e1(tb).length,[tb]),tf=(0,L.useMemo)(()=>eb(tb).length,[tb]),tv=(0,L.useMemo)(()=>(0,eP.O0)(N),[N]),ty=(0,L.useMemo)(()=>(0,eP.U_)(tv,"pro"===_&&e4?R.findIndex(e=>e.id===e4.id):0),[e4,R,_,tv]),tw=ty.link?(0,em.p)(ty.link.url):(0,em.p)("http://live.local:9200/"),tj=(0,L.useMemo)(()=>(0,eP.Tc)(tv),[tv]),tN=(0,L.useMemo)(()=>{var e;return[null===(e=ty.link)||void 0===e?void 0:e.url,null==N?void 0:N.chromium_remote_debug,null==N?void 0:N.srs_api].filter(e=>!!e)},[N,null===(t=ty.link)||void 0===t?void 0:t.url]),tk=(0,L.useCallback)(async e=>{let t=e4?eA(e4):"";return e4&&e===t?await tr():(eD(R),await eH(R),{next:R,savedLane:null!=e4?e4:null,pm2:e})},[e4,eD,R,tr,eH]),tz=(0,L.useCallback)(async(e,t)=>{let n=!!e4&&eA(e4)===t;if("stop"!==e){var s,l;let e=R,n=t;try{let s=await tk(t);e=s.next,n=s.pm2}catch(e){w("".concat(a("当前线路保存失败","Failed to save the active lane"),": ").concat(e.message));return}let i=e.find(e=>eA(e)===n),r=null!==(s=null==i?void 0:i.urlLines)&&void 0!==s?s:"";if(!(null!==(l=null==i?void 0:i.streamKey)&&void 0!==l?l:"").trim()){w(a("请先填写当前线路的推流密钥","Fill the stream key before starting"));return}if(!e1(r).length){w(a("请先填写当前线路的直播地址","Fill the source URLs before starting"));return}t=n}n&&u(t),p(e,t)},[e4,R,tk,w,p,u,a]),tS=!!o||O||q||V||en,t_=eQ(eT(x)),tC=(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-4 text-xs text-zinc-400",children:[(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,s.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:Y,onChange:e=>G(e.target.checked)}),a("每 8 秒自动从服务器刷新","Auto-refresh from server every 8s")]}),(0,s.jsx)("button",{type:"button",disabled:tS,onClick:()=>void eC(),className:"rounded-lg border border-white/10 px-3 py-1.5 text-zinc-200 hover:bg-white/5",children:a("手动重新读取","Reload from server")}),(0,s.jsx)("button",{type:"button",disabled:tS,onClick:()=>void th(),className:"rounded-lg border border-cyan-500/20 bg-cyan-500/10 px-3 py-1.5 text-cyan-100 hover:bg-cyan-500/15",children:V?a("去重中...","Deduplicating..."):a("智能去重","Deduplicate")})]});return(0,s.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6",children:[j?(0,s.jsx)(eh,{t:a,title:a("YouTube 转播链路","YouTube relay chain"),subtitle:a("与「网络」页相同风格的链路示意:代理 → 编码推流 → 浏览器侧操作工作室。","Same visual language as Network: proxy → encode → browser studio."),onNavigate:j,steps:[{label:"ShellCrash",sub:a("透明代理","Proxy"),gradient:"from-violet-500 to-fuchsia-500",target:"network"},{label:"FFmpeg",sub:a("推流 / 转码","Stream"),gradient:"from-cyan-400 to-blue-500",target:"live_youtube"},{label:"Neko",sub:ty.link?"".concat(a("Chromium 工作室","Chromium studio")," \xb7 ").concat(ty.link.label):a("Chromium 工作室","Chromium studio"),gradient:"from-emerald-400 to-teal-500",openUrl:tw}]}):null,(0,s.jsx)("div",{className:"rounded-2xl border border-violet-500/25 bg-gradient-to-br from-violet-500/[0.12] via-zinc-950/80 to-cyan-500/5 p-6 shadow-xl shadow-violet-900/10",children:(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-gradient-to-br from-red-500/30 to-violet-600/30 ring-1 ring-white/10",children:(0,s.jsx)(c.Z,{className:"h-5 w-5 text-red-200"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold tracking-tight text-white",children:a("YouTube 无人直播","YouTube unmanned live")}),(0,s.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:a("单路一条流;多路时每条线路独立保存自己的密钥、URL 列表和 PM2 任务。填好后保存,再点「开始」。Neko 浏览器仅作辅助工作室,不再阻塞推流。","Single lane or multi-lane: every lane keeps its own key, URL list, and PM2 task. Save, then Start. Neko is optional browser tooling and no longer blocks streaming.")})]})]}),(0,s.jsxs)("div",{className:"flex rounded-xl border border-white/10 bg-black/30 p-1 ".concat(""),"aria-hidden":!1,children:[(0,s.jsx)("button",{type:"button",onClick:()=>ts("single"),className:"rounded-lg px-4 py-2 text-xs font-medium transition ".concat("single"===_?"bg-violet-500/25 text-white":"text-zinc-500 hover:text-zinc-300"),children:a("单频道","Single")}),(0,s.jsx)("button",{type:"button",onClick:()=>ts("pro"),className:"rounded-lg px-4 py-2 text-xs font-medium transition ".concat("pro"===_?"bg-violet-500/25 text-white":"text-zinc-500 hover:text-zinc-300"),children:a("多频道 Pro","Multi Pro")})]})]})}),tN.length?(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[ty.link?(0,s.jsx)("a",{href:tw,target:"_blank",rel:"noreferrer",className:"rounded-lg border border-emerald-500/20 bg-emerald-500/10 px-3 py-2 text-xs text-emerald-100 ring-1 ring-emerald-500/20",children:a("打开当前线路 Neko 工作室","Open lane Neko studio")}):null,tv.length>1?(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:tv.map(e=>{var t;return(0,s.jsxs)("a",{href:(0,em.p)(e.url),target:"_blank",rel:"noreferrer",className:"rounded-lg border px-3 py-2 text-xs ring-1 ".concat((null===(t=ty.link)||void 0===t?void 0:t.id)===e.id?"border-emerald-400/30 bg-emerald-500/15 text-emerald-50 ring-emerald-400/25":"border-white/10 bg-white/5 text-zinc-200 ring-white/10"),children:[(0,s.jsx)("span",{className:"font-semibold",children:e.label}),(0,s.jsx)("span",{className:"ml-2 rounded-full bg-emerald-500/15 px-1.5 py-0.5 text-[10px] text-emerald-100",children:e.accessLabel}),(0,s.jsxs)("span",{className:"ml-2 font-mono text-white/70",children:[e.host||"",e.port?":".concat(e.port):""]})]},e.key)})}):null,(null==N?void 0:N.chromium_remote_debug)?(0,s.jsx)("a",{href:(0,em.p)(N.chromium_remote_debug),target:"_blank",rel:"noreferrer",className:"rounded-lg border border-cyan-500/20 bg-cyan-500/10 px-3 py-2 text-xs text-cyan-100 ring-1 ring-cyan-500/20",children:a("打开 Chromium 调试","Open Chromium debug")}):null,(null==N?void 0:N.srs_api)?(0,s.jsx)("a",{href:(0,em.p)(N.srs_api),target:"_blank",rel:"noreferrer",className:"rounded-lg border border-violet-500/20 bg-violet-500/10 px-3 py-2 text-xs text-violet-100 ring-1 ring-violet-500/20",children:a("打开 SRS API","Open SRS API")}):null]}):null,(0,s.jsxs)("div",{className:"rounded-2xl border border-amber-500/20 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-amber-200/90",children:[(0,s.jsx)(W.Z,{className:"h-4 w-4"}),(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:a("直播开关","Live control")})]}),"single"===_?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:a("转播任务","Relay task")}),(0,s.jsxs)("select",{className:"mt-2 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm text-white",value:x,onChange:e=>{let t=e.target.value;ey.current=t,u(t)},children:[x&&!z.some(e=>e.pm2===x)?(0,s.jsxs)("option",{value:x,children:[x,eU?" (".concat(e0(eU,a),")"):""]}):null,z.map(e=>(0,s.jsxs)("option",{value:e.pm2,children:[function(e,t){let n=eG(e.script).toLowerCase();return n.startsWith("douyin_youtube")?t("抖音→YouTube","Douyin → YouTube"):n.startsWith("youtube")?t("YouTube","YouTube"):e.label}(e,a)," (",e.pm2,")"]},e.pm2))]}),(0,s.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[(0,s.jsx)(e2,{kind:"start",targetPm2:x,busy:o,online:t_,label:a("开始直播","Start"),className:"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30",baseLock:!1,onRun:()=>p("start",x),notify:w,t:a}),(0,s.jsx)(e2,{kind:"stop",targetPm2:x,busy:o,online:t_,label:a("停止直播","Stop"),className:"bg-rose-500/15 text-rose-200 ring-rose-500/25",baseLock:!1,onRun:()=>p("stop",x),notify:w,t:a}),(0,s.jsx)(e2,{kind:"restart",targetPm2:x,busy:o,online:t_,label:a("重新开始","Restart"),className:"bg-amber-500/15 text-amber-200 ring-amber-500/25",baseLock:!1,onRun:()=>p("restart",x),notify:w,t:a})]}),(0,s.jsxs)("p",{className:"mt-3 text-center text-xs text-zinc-400",children:[a("当前状态","Current state"),": ",e0(eU,a)]}),(0,s.jsxs)("p",{className:"mt-3 text-center font-mono text-[11px] text-zinc-600",children:["key ",a("尾码","suffix"),": ",tx||"—"]})]}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"mt-4 rounded-xl border border-cyan-500/25 bg-gradient-to-br from-cyan-500/[0.1] via-zinc-950/50 to-violet-500/[0.06] p-4 ring-1 ring-white/[0.04]",children:[(0,s.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-200/90",children:a("Pro 转播实况","Pro relay status")}),(0,s.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:a("对齐桌面端:每路独立 URL / youtube 配置文件;点左侧信息切换编辑,右侧控制进程。","Per-lane config files like desktop; click row info to edit, use right-side controls for PM2.")}),tj?(0,s.jsxs)("p",{className:"mt-2 text-[11px] text-zinc-500",children:[a("Neko 实例","Neko instances"),": ",tj]}):null,(0,s.jsx)("div",{className:"mt-3 max-h-[min(24rem,55vh)] space-y-2 overflow-y-auto pr-1",children:R.map(e=>{var t,n,l;let i=eA(e),r=eM(i),c=eT(i),d=e1((null!==(t=e.urlLines)&&void 0!==t?t:"").trim()),x=eb((null!==(n=e.urlLines)&&void 0!==n?n:"").trim()),u=x[0],m=ep("key = ".concat(null!==(l=e.streamKey)&&void 0!==l?l:"")),h=M===e.id,p=eQ(c),b=R.findIndex(t=>t.id===e.id),g=(0,eP.U_)(tv,b).link;return(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border px-3 py-2.5 text-left text-xs transition sm:flex-nowrap ".concat(h?"border-violet-500/45 bg-violet-500/[0.1]":"border-white/10 bg-black/30 hover:border-white/18"),children:[(0,s.jsxs)("button",{type:"button",className:"min-w-0 flex-1 text-left",onClick:()=>{ey.current=eA(e),tl(e)},children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"font-medium text-zinc-100",children:e.name}),(0,s.jsx)("span",{className:"shrink-0 rounded-md px-2 py-0.5 text-[10px] font-medium ring-1 ".concat(function(e){let t=((null==e?void 0:e.business_status)||"").trim().toLowerCase();return"ready"===t?"bg-sky-500/15 text-sky-100 ring-sky-500/25":"streaming"===t?"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30":"waiting_source"===t||"monitoring"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/25":"source_live"===t?"bg-sky-500/15 text-sky-100 ring-sky-500/25":"misconfigured"===t||"error"===t||"stale"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/25":eQ(null==e?void 0:e.process_status)?"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30":"bg-zinc-600/20 text-zinc-400 ring-zinc-500/25"}(r)),children:e0(r,a)}),g?(0,s.jsxs)("span",{className:"shrink-0 rounded-md bg-emerald-500/15 px-2 py-0.5 text-[10px] font-medium text-emerald-100 ring-1 ring-emerald-500/25",children:[g.label," \xb7 ",g.accessLabel]}):null]}),(0,s.jsxs)("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 font-mono text-[10px] text-zinc-500",children:[(0,s.jsxs)("span",{children:["key …",m||"—"]}),(0,s.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,s.jsx)("span",{className:"truncate",title:i,children:i}),(0,s.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,s.jsxs)("span",{children:["URL ",d.length]}),(0,s.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,s.jsxs)("span",{children:["DY ",x.length]})]}),u?(0,s.jsx)("a",{href:u,target:"_blank",rel:"noreferrer",className:"mt-1 block max-w-full truncate text-cyan-300/90 underline-offset-2 hover:underline",onClick:e=>e.stopPropagation(),title:u,children:u.replace(/^https?:\/\//,"")}):(0,s.jsx)("span",{className:"mt-1 block text-zinc-600",children:"—"})]}),(0,s.jsxs)("div",{className:"flex w-full shrink-0 flex-wrap items-center justify-end gap-1.5 sm:w-auto",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[(0,s.jsx)(e2,{kind:"start",targetPm2:i,busy:o,online:p,label:a("开始","Start"),className:"rounded-lg bg-emerald-500/20 text-emerald-100 ring-emerald-500/30",baseLock:!1,onRun:()=>void tz("start",i),notify:w,t:a,compact:!0}),(0,s.jsx)(e2,{kind:"stop",targetPm2:i,busy:o,online:p,label:a("停止","Stop"),className:"rounded-lg bg-rose-500/15 text-rose-100 ring-rose-500/25",baseLock:!1,onRun:()=>void tz("stop",i),notify:w,t:a,compact:!0}),(0,s.jsx)(e2,{kind:"restart",targetPm2:i,busy:o,online:p,label:a("重新开始","Restart"),className:"rounded-lg bg-amber-500/15 text-amber-100 ring-amber-500/25",baseLock:!1,onRun:()=>void tz("restart",i),notify:w,t:a,compact:!0}),g?(0,s.jsxs)("button",{type:"button",onClick:()=>{window.open((0,em.p)(g.url),"_blank","noopener,noreferrer")},className:"inline-flex min-h-[2rem] items-center justify-center rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5 text-emerald-100 ring-1 ring-emerald-500/20 transition hover:bg-emerald-500/20",title:"".concat(a("打开该线路 Neko 工作室","Open this lane's Neko studio")," \xb7 ").concat(g.label).concat(g.port?" :".concat(g.port):""),"aria-label":"".concat(a("打开该线路 Neko 工作室","Open this lane's Neko studio")," \xb7 ").concat(g.label),children:[(0,s.jsx)("span",{className:"sr-only",children:a("打开该线路 Neko 工作室","Open this lane's Neko studio")}),(0,s.jsx)("span",{"aria-hidden":!0,className:"text-sm leading-none",children:"\uD83D\uDC31"}),(0,s.jsx)(H.Z,{className:"ml-1 h-3.5 w-3.5 shrink-0","aria-hidden":!0})]}):null]})]},e.id)})})]})})]}),"single"===_?(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:a("YouTube 相关设置","YouTube settings")}),(0,s.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:a("串流参数写进 youtube.ini,无需 Google 登录。","Stream settings go to youtube.ini — no Google login.")}),(0,s.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,s.jsx)("label",{className:"block text-xs text-zinc-400",children:a("串流密钥","Stream key")}),(0,s.jsx)("input",{className:"w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm font-mono text-zinc-200",spellCheck:!1,autoComplete:"off",value:I.key,onChange:e=>A(t=>({...t,key:e.target.value})),placeholder:"xxxx-xxxx-xxxx-xxxx-xxxx"}),(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,s.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-zinc-400",children:["RTMPS",(0,s.jsxs)("select",{className:"rounded-lg border border-white/10 bg-black/40 px-3 py-2 text-sm text-white",value:I.rtmps?"1":"0",onChange:e=>A(t=>({...t,rtmps:"1"===e.target.value})),children:[(0,s.jsx)("option",{value:"1",children:a("是(默认)","Yes")}),(0,s.jsx)("option",{value:"0",children:a("否 → RTMP","No")})]})]}),(0,s.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-zinc-400",children:[a("比特率 kbps","Bitrate kbps"),(0,s.jsx)("input",{className:"rounded-lg border border-white/10 bg-black/40 px-3 py-2 font-mono text-sm",value:I.bitrate,onChange:e=>A(t=>({...t,bitrate:e.target.value})),placeholder:"4000"})]}),(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 pt-6 text-xs text-zinc-300",children:[(0,s.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:I.fastAudio,onChange:e=>A(t=>({...t,fastAudio:e.target.checked}))}),"fast_audio(",a("轻量音频","lighter audio"),")"]})]})]}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsxs)("button",{type:"button",disabled:tS,onClick:()=>void ti(),className:"inline-flex items-center gap-2 rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-200",children:[(0,s.jsx)(y.Z,{className:"h-3.5 w-3.5 ".concat(O?"animate-spin":"")}),a("重新读取","Reload")]}),(0,s.jsxs)("button",{type:"button",disabled:tS,onClick:()=>void tc(),className:"inline-flex items-center gap-2 rounded-xl bg-violet-500/25 px-4 py-2 text-sm font-medium text-violet-100 ring-1 ring-violet-500/35",children:[O?(0,s.jsx)(v.Z,{className:"h-4 w-4 animate-spin"}):null,a("保存 youtube.ini","Save youtube.ini")]}),(0,s.jsx)("button",{type:"button",disabled:tS,onClick:()=>void td(),className:"rounded-xl border border-cyan-500/20 bg-cyan-500/10 px-4 py-2 text-sm text-cyan-100",children:a("平衡预设","Balanced preset")}),(0,s.jsx)("button",{type:"button",disabled:tS,onClick:()=>{A(eg(U)),Z(a("已从下方原文同步到表单","Synced from raw"))},className:"rounded-xl border border-white/10 px-4 py-2 text-sm text-zinc-400",children:a("从原文同步表单","Parse raw")})]}),(0,s.jsxs)("details",{className:"mt-4 rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,s.jsx)("summary",{className:"cursor-pointer text-xs text-zinc-500",children:a("高级:youtube.ini 原文","Raw youtube.ini")}),(0,s.jsx)("textarea",{className:"mt-2 h-36 w-full resize-y rounded-lg border border-white/10 bg-black/50 p-3 font-mono text-[11px] text-zinc-400",value:U,onChange:e=>E(e.target.value),spellCheck:!1}),(0,s.jsx)("button",{type:"button",disabled:tS,className:"mt-2 rounded-lg bg-cyan-500/15 px-3 py-1.5 text-xs text-cyan-200",onClick:()=>void to(U),children:a("保存原文","Save raw")})]}),D?(0,s.jsx)("p",{className:"mt-2 font-mono text-xs text-zinc-500",children:D}):null]}):(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("h3",{className:"text-sm font-semibold text-white",children:[a("当前线路","Current lane"),e4?(0,s.jsxs)("span",{className:"ml-2 font-normal text-zinc-400",children:["\xb7 ",e4.name]}):null,tn?(0,s.jsx)("span",{className:"ml-2 rounded-md bg-amber-500/15 px-2 py-0.5 text-[10px] font-medium text-amber-100 ring-1 ring-amber-500/25",children:a("有未保存修改","Unsaved")}):null]}),e4?(0,s.jsxs)("p",{className:"mt-0.5 font-mono text-[11px] text-zinc-500",children:["PM2: ",e9,te?" → ".concat(e7):""," \xb7 ","key ",tx||"—"]}):null]}),(0,s.jsxs)("button",{type:"button",disabled:tS,className:"inline-flex items-center gap-1 rounded-lg bg-violet-500/20 px-3 py-1.5 text-xs text-violet-100 ring-1 ring-violet-500/30",onClick:()=>{let e=eW(),t={id:e,name:"".concat(a("线路","Ch")," ").concat(R.length+1),streamKey:"",urlLines:"",pm2Name:eF(e),notes:""};et(n=>({...n,[e]:e$(t)})),e3([...R,t]),T(e),ey.current=eA(t),u(ey.current),ez("")},children:[(0,s.jsx)(eR.Z,{className:"h-3.5 w-3.5"}),a("新增线路","Add lane")]})]}),e4?(0,s.jsxs)("div",{className:"mt-4 space-y-3 border-t border-white/5 pt-4",children:[(0,s.jsx)("input",{className:"w-full rounded-xl border border-white/10 bg-black/40 px-3 py-2 text-sm",value:null!==(n=null==e6?void 0:e6.name)&&void 0!==n?n:"",onChange:e=>e8("name",e.target.value),placeholder:a("线路名称","Lane name")}),(0,s.jsx)("label",{className:"block text-xs text-zinc-500",children:a("串流密钥","Stream key")}),(0,s.jsx)("input",{className:"w-full rounded-xl border border-white/10 bg-black/40 px-3 py-2 font-mono text-sm",spellCheck:!1,value:null!==(l=null==e6?void 0:e6.streamKey)&&void 0!==l?l:"",onChange:e=>e8("streamKey",e.target.value),placeholder:"xxxx-xxxx… / rtmp(s)://…"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("button",{type:"button",disabled:tS,onClick:()=>void ta(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-100",children:en?a("保存中...","Saving..."):a("保存线路设置","Save lane")}),(0,s.jsx)("button",{type:"button",disabled:tS,onClick:()=>void tp(),className:"rounded-xl bg-violet-500/25 px-4 py-2 text-sm font-medium text-violet-100 ring-1 ring-violet-500/35",children:a("写入 youtube.ini","Write youtube.ini")})]}),tt.ok?null:(0,s.jsx)("p",{className:"text-xs text-rose-300",children:tt.message}),(0,s.jsxs)("details",{className:"rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,s.jsx)("summary",{className:"cursor-pointer text-xs text-zinc-500",children:a("高级:进程名","Advanced: process name")}),(0,s.jsx)("input",{className:"mt-2 w-full rounded-lg border border-white/10 bg-black/40 px-3 py-2 font-mono text-xs",value:null!==(i=null==e6?void 0:e6.pm2Name)&&void 0!==i?i:eF(e4.id),onChange:e=>e8("pm2Name",e.target.value),spellCheck:!1,placeholder:"youtube2__…"}),(0,s.jsxs)("p",{className:"mt-2 font-mono text-[11px] text-zinc-500",children:[a("实际生效","Effective"),": ",e7||"—"]}),tt.message&&!tt.ok?(0,s.jsx)("p",{className:"mt-2 text-[11px] text-rose-300",children:tt.message}):null]}),(0,s.jsx)("textarea",{className:"h-16 w-full resize-y rounded-xl border border-white/10 bg-black/40 p-3 text-xs text-zinc-300",value:null!==(r=null==e6?void 0:e6.notes)&&void 0!==r?r:"",onChange:e=>e8("notes",e.target.value),placeholder:a("备注(可选)","Notes (optional)")}),el?(0,s.jsx)("p",{className:"text-xs text-zinc-400",children:el}):null,(0,s.jsxs)("button",{type:"button",disabled:tS||R.length<2,className:"inline-flex items-center gap-1 text-xs text-rose-300 hover:text-rose-200 disabled:opacity-30",onClick:()=>{var e;let t=R.filter(e=>e.id!==e4.id);et(e=>{let t={...e};return delete t[e4.id],t}),e3(t),T((null===(e=t[0])||void 0===e?void 0:e.id)||"")},children:[(0,s.jsx)(eu.Z,{className:"h-3.5 w-3.5"}),a("删除此线路","Delete lane")]})]}):null]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:a("直播地址列表","URL list")}),(0,s.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:a("每条线路独立写入自己的 URL_config.<pm2>.ini,不再复用或回填所谓“全局地址”。","Each lane writes to its own URL_config.<pm2>.ini with no shared global URL draft.")}),(0,s.jsx)("p",{className:"mt-1 font-mono text-[10px] text-zinc-600",children:x?ef(x):"URL_config.ini"}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px]",children:[(0,s.jsxs)("span",{className:"rounded-full border border-cyan-500/20 bg-cyan-500/10 px-2.5 py-1 text-cyan-100",children:[a("有效地址","Valid URLs"),": ",tg]}),(0,s.jsxs)("span",{className:"rounded-full border border-violet-500/20 bg-violet-500/10 px-2.5 py-1 text-violet-100",children:["Douyin: ",tf]})]}),tC,$?(0,s.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:$}):null,(0,s.jsx)("textarea",{className:"mt-4 min-h-[160px] w-full resize-y rounded-xl border border-white/10 bg-black/50 p-4 font-mono text-xs text-zinc-300",value:K,onChange:e=>{eo.current=!0,ez(e.target.value)},spellCheck:!1,placeholder:"https://live.douyin.com/..."}),(0,s.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:(0,s.jsx)("button",{type:"button",disabled:tS,onClick:()=>void tu(),className:"rounded-xl bg-cyan-500/20 px-4 py-2 text-sm text-cyan-100 ring-1 ring-cyan-500/30",children:a("保存地址","Save URLs")})})]})]}),"single"===_?(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:a("直播地址列表 \xb7 URL_config.ini","URL_config.ini")}),(0,s.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:a("一行一个地址;可自动刷新或手动重新读取。","One URL per line; auto-refresh or reload.")}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px]",children:[(0,s.jsxs)("span",{className:"rounded-full border border-cyan-500/20 bg-cyan-500/10 px-2.5 py-1 text-cyan-100",children:[a("有效地址","Valid URLs"),": ",tg]}),(0,s.jsxs)("span",{className:"rounded-full border border-violet-500/20 bg-violet-500/10 px-2.5 py-1 text-violet-100",children:["Douyin: ",tf]})]}),tC,$?(0,s.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:$}):null,(0,s.jsx)("textarea",{className:"mt-4 min-h-[200px] w-full resize-y rounded-xl border border-white/10 bg-black/50 p-4 font-mono text-xs text-zinc-300",value:m,onChange:e=>{eo.current=!0,ek(e.target.value)},spellCheck:!1}),(0,s.jsx)("button",{type:"button",disabled:tS,onClick:()=>void tm(),className:"mt-3 rounded-xl bg-cyan-500/20 px-4 py-2 text-sm text-cyan-100 ring-1 ring-cyan-500/30",children:a("保存 URL 配置","Save URL config")})]}):null,(0,s.jsx)(ew,{t:a,currentProc:x,fetchJson:g,urlListText:"single"===_?m:K,keySuffixUi:tx,showKeyRow:!0,pollMs:800,refreshToken:er})]})}var e4=n(257);let e6=()=>void 0!==e4&&e4.env.NEXT_PUBLIC_API_URL||"";function e8(e){if(null==e||!Number.isFinite(e))return"—";if(0===e)return"0 B";let t=["B","KB","MB","GB","TB"],n=e,s=0;for(;n>=1024&&s<t.length-1;)n/=1024,s+=1;return"".concat(n.toFixed(n>=10||0===s?0:1)," ").concat(t[s])}function e9(e){if(null==e||!Number.isFinite(e))return"—";let t=Math.max(0,Math.floor(e));if(t<60)return"".concat(t,"s");let n=Math.floor(t/60);if(n<60)return"".concat(n,"m");let s=Math.floor(n/60);return s<48?"".concat(s,"h"):"".concat(Math.floor(s/24),"d")}function e7(e){let t=e8(e);return"—"===t?t:"".concat(t,"/s")}function te(e){return"online"===e||"running"===e?"bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-500/30":"configured"===e?"bg-sky-500/15 text-sky-200 ring-1 ring-sky-500/25":"skipped"===e?"bg-slate-500/15 text-slate-300 ring-1 ring-slate-500/30":"stopped"===e||"not_found"===e?"bg-zinc-500/15 text-zinc-400 ring-1 ring-zinc-500/25":"error"===e?"bg-rose-500/15 text-rose-300 ring-1 ring-rose-500/35":"bg-violet-500/15 text-violet-200 ring-1 ring-violet-500/30"}function tt(e,t){let n=(e||"").trim().toLowerCase();return"online"===n||"running"===n?t("运行中","Running"):"configured"===n?t("已配置","Configured"):"not_found"===n?t("未注册","Unregistered"):"stopped"===n?t("已停止","Stopped"):"error"===n?t("异常","Error"):e||"—"}function tn(e,t){let n=null!=t?t:(e,t)=>t||e,s=(e||"").trim().toLowerCase();return"connected"===s?n("高速可用","Ready"):"configured"===s?n("已配置","Configured"):"detected"===s?n("接口已起","Detected"):"idle"===s?n("等待握手","Idle"):"stale"===s?n("握手过期","Stale"):"down"===s?n("未连接","Down"):e||"—"}function ts(){var e,t,n,E,I,A,D,Z,O,H,B,K,W,F,Y,G,J,V,X,$,Q,ee,et,en,es,el,ei,er,ea,ec,ed,ex,eu,eh,ep,eb,eg,ef,ev,ey,ew,ej,eN,ek,ez,eS,eC,eR,eL,eM,eT,eU,eE,eI,eA,eD,eZ,eO,eH,eB,eK,eW,eF,eY,eG,eq,eJ,eV,eX,e$,eQ,e0,e1,e5,e2,e4,ts,tl,ti,tr,ta,to,tc,td,tx,tu,tm,th,tp,tb;let tg=e6(),[tf,tv]=(0,L.useState)("zh"),[ty,tw]=(0,L.useState)("dark"),[tj,tN]=(0,L.useState)("dashboard"),[tk,tz]=(0,L.useState)(!1),[tS,t_]=(0,L.useState)(null),[tC,tR]=(0,L.useState)(null),[tP,tL]=(0,L.useState)(!0),[tM,tT]=(0,L.useState)(null),[tU,tE]=(0,L.useState)(null),[tI,tA]=(0,L.useState)(null),[tD,tZ]=(0,L.useState)(!0),[tO,tH]=(0,L.useState)([]),[tB,tK]=(0,L.useState)([]),[tW,tF]=(0,L.useState)(""),[tY,tG]=(0,L.useState)(""),[tq,tJ]=(0,L.useState)("/sdcard/app.apk"),[tV,tX]=(0,L.useState)(""),[t$,tQ]=(0,L.useState)(null),[t0,t1]=(0,L.useState)(null),[t5,t2]=(0,L.useState)(!0),[t3,t4]=(0,L.useState)(!0),[t6,t8]=(0,L.useState)("tencent-relay-wg0"),[t9,t7]=(0,L.useState)(""),[ne,nt]=(0,L.useState)(null),[nn,ns]=(0,L.useState)(null),[nl,ni]=(0,L.useState)(!0),[nr,na]=(0,L.useState)("overlay"),[no,nc]=(0,L.useState)(""),[nd,nx]=(0,L.useState)(""),nu=(0,L.useRef)(null),nm=(0,L.useRef)(null),nh=(0,L.useRef)(tW),np=(0,L.useRef)(0),nb=(0,L.useRef)(null),ng=(0,L.useCallback)((e,t)=>"zh"===tf?e:t,[tf]),nf=(0,L.useCallback)(e=>{tE(e),null!=nb.current&&window.clearTimeout(nb.current),nb.current=window.setTimeout(()=>{tE(null),nb.current=null},2800)},[]),nv=(0,L.useCallback)(async(e,t)=>(0,q.N)("".concat(tg).concat(e),t),[tg]),ny=(0,L.useCallback)(async()=>{if(nu.current)return nu.current;let e=(async()=>{try{var e;let[t,n]=await Promise.allSettled([nv("/hub/dashboard"),nv("/deploy/check")]);if("fulfilled"!==t.status)throw t.reason;let s=t.value;t_(s),tR(null),tA(Date.now()),"fulfilled"===n.status?t1(n.value):t1(null);let l=(null===(e=s.android)||void 0===e?void 0:e.devices)||[];if(l.length&&!tV){let e=l.find(e=>"device"===(e.state||"").toLowerCase());tX((null!=e?e:l[0]).serial)}}catch(e){tR(e.message),t1(null)}finally{tL(!1),nu.current=null}})();return nu.current=e,e},[tV,nv]),nw=(0,L.useMemo)(()=>{let e=new URLSearchParams({light:"1"});return"live_youtube"===tj?e.set("family","youtube"):"live_tiktok"===tj&&e.set("family","tiktok"),"/process_monitor?".concat(e.toString())},[tj]),nj=(0,L.useCallback)(async()=>{if(nm.current)return nm.current;let e=(async()=>{try{let e=(await nv(nw)).entries||[];tK(e),tH(e.map(e=>({pm2:e.pm2,script:e.script,label:e.label}))),tA(Date.now()),tF(t=>!e.length||t&&e.some(e=>e.pm2===t)?t:e[0].pm2)}catch(e){}finally{nm.current=null}})();return nm.current=e,e},[nv,nw]);(0,L.useEffect)(()=>{let e=window.localStorage.getItem("live-hub-lang");("zh"===e||"en"===e)&&tv(e);let t=window.localStorage.getItem("live-hub-theme");("light"===t||"dark"===t)&&tw(t)},[]),(0,L.useEffect)(()=>{window.localStorage.setItem("live-hub-lang",tf)},[tf]),(0,L.useEffect)(()=>{document.documentElement.setAttribute("data-theme",ty);try{window.localStorage.setItem("live-hub-theme",ty)}catch(e){}},[ty]),(0,L.useEffect)(()=>{let e=()=>tZ("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,L.useEffect)(()=>{if(!tk)return;let e=e=>{"Escape"===e.key&&tz(!1)};window.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t}},[tk]),(0,L.useEffect)(()=>()=>{null!=nb.current&&window.clearTimeout(nb.current)},[]),(0,L.useEffect)(()=>{try{"0"===localStorage.getItem("livehub.autorefresh")&&t2(!1),"0"===localStorage.getItem("livehub.showStreamProbes")&&t4(!1)}catch(e){}},[]),(0,L.useEffect)(()=>{ny()},[ny]),(0,L.useEffect)(()=>{nj()},[nj]),(0,L.useEffect)(()=>{if(!t5||!tD||"live_youtube"===tj||"live_tiktok"===tj)return;let e=window.setInterval(()=>{ny()},1e4);return()=>clearInterval(e)},[t5,tD,ny,tj]),(0,L.useEffect)(()=>{if(!t5||!tD)return;let e=window.setInterval(()=>{nj()},"live_youtube"===tj||"live_tiktok"===tj?700:4e3);return()=>clearInterval(e)},[t5,tD,nj,tj]),(0,L.useEffect)(()=>{nh.current=tW},[tW]),(0,L.useEffect)(()=>{tW&&"live_youtube"===tj&&(async()=>{let e=nh.current.trim(),t=++np.current;try{let n=new URLSearchParams({process:e,_ts:String(Date.now())}),s=await nv("/get_url_config?".concat(n));if(t!==np.current||e!==nh.current.trim())return;tG(s.content||"")}catch(e){}})()},[tW,nv,tj]),(0,L.useEffect)(()=>{"settings"===tj&&(async()=>{try{let e=await nv("/hub/config");tQ(e)}catch(e){tQ(null)}})()},[nv,tj]);let nN=(0,L.useMemo)(()=>{var e;let t=(null==tS?void 0:null===(e=tS.stack)||void 0===e?void 0:e.quick_links)||{},n={};for(let[e,s]of Object.entries(t))/^https?:\/\//i.test(s)?n[e]=(0,em.p)(s):n[e]=s;return n},[null==tS?void 0:null===(e=tS.stack)||void 0===e?void 0:e.quick_links]),nk=(0,L.useMemo)(()=>(0,eP.O0)(nN),[nN]),nz=(0,L.useMemo)(()=>(0,eP.Tc)(nk),[nk]),nS=(0,L.useMemo)(()=>((null==nn?void 0:nn.interfaces)||[]).flatMap(e=>e.peers||[]),[null==nn?void 0:nn.interfaces]),n_=(0,L.useMemo)(()=>((null==nn?void 0:nn.interfaces)||[]).flatMap(e=>e.configured_peers||[]),[null==nn?void 0:nn.interfaces]),nC=(0,L.useMemo)(()=>((null==nn?void 0:nn.repo_configs)||[]).flatMap(e=>e.peers||[]).map(e=>({...e,status_source:"config",config_source:"repo"})),[null==nn?void 0:nn.repo_configs]),nR=nS[0]||n_[0]||nC[0]||null,nP=(0,L.useMemo)(()=>{for(let e of[...nS,...n_,...nC]){let t=e.endpoint_host||function(e){let t=(e||"").trim();if(!t)return"";if(t.startsWith("[")){let e=t.indexOf("]");return e>0?t.slice(1,e):""}let n=t.lastIndexOf(":");return n>0?t.slice(0,n):t}(e.endpoint);if(t)return t}return""},[n_,nC,nS]),nL=(null==ne?void 0:null===(t=ne.windows_route_template)||void 0===t?void 0:t.endpoint_host)||(null==ne?void 0:null===(E=ne.peers)||void 0===E?void 0:null===(n=E.find(e=>e.endpoint_host))||void 0===n?void 0:n.endpoint_host)||nP||"",nM=(0,L.useMemo)(()=>{if(!nL)return"";let e=no.trim()||"<gateway>",t=nd.trim()||"<ifIndex>";return"route -p add ".concat(nL," mask 255.255.255.255 ").concat(e," metric 1 if ").concat(t)},[nL,no,nd]),nT=(0,L.useCallback)(async()=>{try{var e;let t=await nv("/hub/network/wireguard/status");ns(null!==(e=t.wireguard)&&void 0!==e?e:null)}catch(e){ns(null)}},[nv]);(0,L.useEffect)(()=>{"network"===tj&&nT()},[nT,tj]);let nU=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=t9.trim();if(!t){nf(ng("请先选择或粘贴 WireGuard 配置","Pick or paste a WireGuard config first"));return}tT(e?"wg:apply":"wg:save");try{var n;let s=await nv("/hub/network/wireguard/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t6,content:t,route_mode:nr,apply:e})});nt(null!==(n=s.wireguard)&&void 0!==n?n:null),await nT(),nf(e?ng("WireGuard 配置已保存并应用","WireGuard config saved and applied"):ng("WireGuard 配置已保存","WireGuard config saved"))}catch(e){nf(e.message)}finally{tT(null)}},nE=async()=>{await nU(!1)},nI=async e=>{let t=(e||"").trim();if(t){tT("wg:load:".concat(t));try{var n;let e=await nv("/hub/network/wireguard/config/".concat(encodeURIComponent(t)));t8(e.name||t),t7(e.content||""),nt(null!==(n=e.wireguard)&&void 0!==n?n:null),ni(!0),nf(ng("已载入 WireGuard 配置","WireGuard config loaded"))}catch(e){nf(e.message)}finally{tT(null)}}},nA=async e=>{if(e)try{let t=await e.text();t7(t),t6.trim()||t8(e.name.replace(/\.conf$/i,""))}catch(e){nf(e.message)}},nD=async(e,t)=>{tT("svc:".concat(e));try{let n=await nv("/service_action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:e,action:t})});"error"===n.status?nf(n.detail||n.message||ng("操作失败","Action failed")):nf(n.message||"OK"),await ny()}catch(e){nf(e.message)}finally{tT(null)}},nZ=async(e,t)=>{let n=(null!=t?t:tW).trim();if(n){tT("proc:".concat(e,":").concat(n));try{let t=await nv("/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:n})});nf(String(t.output||t.message||"OK")),await nj(),"live_youtube"===tj||"live_tiktok"===tj?ny():await ny()}catch(e){nf(e.message)}finally{tT(null)}}},nO=async(e,t)=>{let n=(null!=t?t:tW).trim();if(!n)return;let s=null!=e?e:tY,l=++np.current;tT("save:url");try{let e=new URLSearchParams({process:n});await nv("/save_url_config?".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s})}),l===np.current&&n===nh.current.trim()&&tG(s),nf(ng("URL 配置已保存","URL config saved"))}catch(e){throw nf(e.message),e}finally{tT(null)}},nH=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!tV){nf(ng("请选择设备","Pick a device"));return}tT("adb:".concat(e));try{let n=await nv("/android/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,serial:tV,payload:t})});nf(n.message||"OK")}catch(e){nf(e.message)}finally{tT(null)}},nB=[{id:"dashboard",icon:r.Z,labelZh:"总览",labelEn:"Dashboard"},{id:"services",icon:a.Z,labelZh:"服务",labelEn:"Services"},{id:"live_youtube",icon:o.Z,labelZh:"YouTube 无人直播",labelEn:"YouTube unmanned"},{id:"live_tiktok",icon:c.Z,labelZh:"TikTok 无人直播",labelEn:"TikTok unmanned"},{id:"android",icon:d.Z,labelZh:"安卓",labelEn:"Android"},{id:"network",icon:x.Z,labelZh:"网络",labelEn:"Network"},{id:"settings",icon:u.Z,labelZh:"设置",labelEn:"Settings"}],nK=e=>{(async()=>{var t;if(null===(t=navigator.clipboard)||void 0===t?void 0:t.writeText){await navigator.clipboard.writeText(e);return}let n=document.createElement("textarea");n.value=e,n.readOnly=!0,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),document.execCommand("copy"),n.remove()})().then(()=>nf(ng("已复制","Copied")),()=>nf(ng("复制失败","Copy failed")))},nW=null!==(e$=null==tS?void 0:null===(I=tS.services)||void 0===I?void 0:I.filter(e=>e.running&&e.available).length)&&void 0!==e$?e$:0,nF=null!==(eQ=null==tS?void 0:null===(A=tS.services)||void 0===A?void 0:A.length)&&void 0!==eQ?eQ:0,nY=tI?new Date(tI).toLocaleTimeString("zh"===tf?"zh-CN":"en-US",{hour12:!1}):ng("未同步","Not synced"),nG=tD?ng("前台自动刷新","Auto refresh"):ng("后台已暂停刷新","Refresh paused in background");return(0,s.jsxs)("div",{className:"lp-root min-h-screen transition-colors duration-300 ".concat("light"===ty?"bg-slate-100 text-slate-900 selection:bg-violet-400/25":"bg-[#050508] text-zinc-100 selection:bg-violet-500/30"),children:[(0,s.jsx)("div",{className:"lp-noise pointer-events-none fixed inset-0 z-0 ".concat("light"===ty?"opacity-[0.06]":"opacity-[0.22]"),"aria-hidden":!0}),(0,s.jsx)("div",{className:"lp-aurora pointer-events-none fixed -left-1/4 top-0 h-[42rem] w-[42rem] rounded-full blur-[120px] ".concat("light"===ty?"bg-violet-400/15":"bg-violet-600/20"),"aria-hidden":!0}),(0,s.jsx)("div",{className:"lp-aurora2 pointer-events-none fixed bottom-0 right-0 h-[36rem] w-[36rem] rounded-full blur-[100px] ".concat("light"===ty?"bg-cyan-400/10":"bg-cyan-500/10"),"aria-hidden":!0}),tU?(0,s.jsx)(l.E.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},role:"status","aria-live":"polite","aria-atomic":"true",className:"fixed bottom-6 left-1/2 z-[100] max-w-md -translate-x-1/2 rounded-2xl border border-white/10 bg-zinc-950/95 px-5 py-3 text-center text-sm text-zinc-100 shadow-2xl shadow-black/50 backdrop-blur-xl",children:tU}):null,(0,s.jsxs)("div",{className:"relative z-10 flex min-h-screen",children:[(0,s.jsxs)("aside",{className:"hidden w-64 shrink-0 flex-col border-r px-4 py-6 backdrop-blur-2xl lg:flex ".concat("light"===ty?"border-slate-200/90 bg-white/70":"border-white/[0.06] bg-zinc-950/40"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-2",children:[(0,s.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-violet-500 to-cyan-400 shadow-lg shadow-violet-500/25",children:(0,s.jsx)(m.Z,{className:"h-4 w-4 text-white"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-[0.2em] ".concat("light"===ty?"text-slate-500":"text-zinc-500"),children:"live.local"}),(0,s.jsx)("p",{className:"text-sm font-semibold ".concat("light"===ty?"text-slate-900":"text-white"),children:ng("无人直播系统","Unmanned Live System")})]})]}),(0,s.jsx)("nav",{className:"mt-10 flex flex-1 flex-col gap-1",children:nB.map(e=>{let t=e.icon,n=tj===e.id;return(0,s.jsxs)("button",{type:"button",onClick:()=>tN(e.id),"aria-current":n?"page":void 0,className:"flex items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm font-medium transition ".concat("light"===ty?n?"bg-violet-100/90 text-slate-900 shadow-inner shadow-violet-200/50":"text-slate-600 hover:bg-slate-200/60 hover:text-slate-900":n?"bg-white/[0.08] text-white shadow-inner shadow-white/5":"text-zinc-500 hover:bg-white/[0.04] hover:text-zinc-200"),children:[(0,s.jsx)(t,{className:"h-4 w-4 ".concat("light"===ty?n?"text-violet-600":"text-slate-400":n?"text-violet-300":"text-zinc-600")}),ng(e.labelZh,e.labelEn),n?(0,s.jsx)(h.Z,{className:"ml-auto h-4 w-4 ".concat("light"===ty?"text-slate-400":"text-zinc-600")}):null]},e.id)})})]}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,s.jsxs)("header",{className:"sticky top-0 z-20 flex items-center justify-between gap-3 border-b px-4 py-3 backdrop-blur-xl lg:px-8 ".concat("light"===ty?"border-slate-200/80 bg-white/75 text-slate-900":"border-white/[0.06] bg-zinc-950/70 text-white"),children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,s.jsx)("button",{type:"button",className:"rounded-xl border p-2 lg:hidden ".concat("light"===ty?"border-slate-200 bg-white/80":"border-white/10 bg-white/5"),onClick:()=>tz(!0),"aria-label":"Menu",children:(0,s.jsx)(p.Z,{className:"h-5 w-5"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h1",{className:"truncate text-lg font-semibold tracking-tight lg:text-xl ".concat("light"===ty?"text-slate-900":"text-white"),children:ng((null===(D=nB.find(e=>e.id===tj))||void 0===D?void 0:D.labelZh)||"",(null===(Z=nB.find(e=>e.id===tj))||void 0===Z?void 0:Z.labelEn)||"")}),(0,s.jsxs)("p",{className:"truncate text-xs ".concat("light"===ty?"text-slate-500":"text-zinc-500"),children:[(null==tS?void 0:null===(O=tS.stack)||void 0===O?void 0:O.mdns_host)||"live.local"," \xb7"," ","dark"===ty?ng("夜间","Dark mode"):ng("日间","Light mode")," \xb7 ",nG," \xb7"," ",ng("最后同步","Last sync")," ",nY]})]})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 sm:gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:()=>tw(e=>"dark"===e?"light":"dark"),className:"rounded-xl border p-2 transition ".concat("light"===ty?"border-slate-200 bg-white text-amber-500 shadow-sm":"border-white/10 bg-white/[0.06] text-violet-200"),title:"dark"===ty?ng("切换到日间","Switch to light"):ng("切换到夜间","Switch to dark"),"aria-label":"dark"===ty?ng("日间模式","Light mode"):ng("夜间模式","Dark mode"),"aria-pressed":"light"===ty,children:"dark"===ty?(0,s.jsx)(b.Z,{className:"h-5 w-5",strokeWidth:2}):(0,s.jsx)(g.Z,{className:"h-5 w-5",strokeWidth:2})}),(0,s.jsxs)("button",{type:"button",onClick:()=>tv(e=>"zh"===e?"en":"zh"),className:"relative rounded-xl border p-2 transition ".concat("light"===ty?"border-slate-200 bg-white text-cyan-600 shadow-sm":"border-white/10 bg-white/[0.06] text-cyan-200"),title:"zh"===tf?"English":"中文","aria-label":ng("切换语言","Toggle language"),"aria-pressed":"en"===tf,children:[(0,s.jsx)(f.Z,{className:"h-5 w-5",strokeWidth:2}),(0,s.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 flex h-4 min-w-[1rem] items-center justify-center rounded px-0.5 text-[9px] font-bold leading-none ".concat("light"===ty?"bg-cyan-100 text-cyan-800":"bg-cyan-500/30 text-cyan-100"),children:"zh"===tf?"中":"A"})]}),(0,s.jsxs)("button",{type:"button",disabled:!!tM,onClick:()=>void Promise.all([ny(),nj()]),className:"flex items-center gap-2 rounded-xl border px-3 py-2 text-xs font-medium transition disabled:opacity-40 ".concat("light"===ty?"border-slate-200 bg-white text-slate-700 hover:bg-slate-50":"border-white/10 bg-white/[0.04] text-zinc-300 hover:bg-white/[0.07]"),children:[tM?(0,s.jsx)(v.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(y.Z,{className:"h-3.5 w-3.5"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:ng("刷新","Refresh")})]})]})]}),(0,s.jsx)("main",{className:"flex-1 px-4 py-6 lg:px-8 lg:py-8",children:(0,s.jsx)(i.M,{mode:"wait",children:(0,s.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.28,ease:[.22,1,.36,1]},children:["dashboard"===tj?(0,s.jsxs)("div",{className:"space-y-6",children:[tC?(0,s.jsxs)("div",{className:"rounded-2xl border border-rose-500/25 bg-rose-950/20 p-4 text-sm text-rose-200",children:[ng("无法加载仪表盘:","Dashboard error: "),tC]}):null,(0,s.jsx)(l.E.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.02},className:"rounded-2xl border p-2 backdrop-blur-xl ".concat("light"===ty?"border-slate-200/90 bg-white/80 shadow-sm shadow-slate-200/30":"border-white/[0.07] bg-zinc-950/30"),children:(0,s.jsx)(T.Z,{snapshot:null!==(e0=null==tS?void 0:tS.snapshot)&&void 0!==e0?e0:null,theme:ty,tr:ng})}),(0,s.jsx)(l.E.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.05},className:"rounded-2xl border p-3 shadow-lg ".concat("light"===ty?"border-fuchsia-200/80 bg-gradient-to-br from-fuchsia-50/90 via-white to-cyan-50/70 shadow-fuchsia-100/40":"border-fuchsia-500/20 bg-gradient-to-br from-fuchsia-500/10 via-zinc-950/60 to-cyan-500/10 shadow-fuchsia-900/10"),children:(0,s.jsx)(M,{tr:ng})}),(0,s.jsx)("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-5",children:[{icon:w.Z,label:ng("CPU 1m","CPU 1m"),value:null!==(e1=null==tS?void 0:null===(K=tS.snapshot)||void 0===K?void 0:null===(B=K.cpu_load)||void 0===B?void 0:null===(H=B["1m"])||void 0===H?void 0:H.toFixed(2))&&void 0!==e1?e1:"—",sub:ng("负载均值","Load avg")},{icon:r.Z,label:ng("内存","Memory"),value:e8(null==tS?void 0:null===(F=tS.snapshot)||void 0===F?void 0:null===(W=F.memory)||void 0===W?void 0:W.available),sub:"/ ".concat(e8(null==tS?void 0:null===(G=tS.snapshot)||void 0===G?void 0:null===(Y=G.memory)||void 0===Y?void 0:Y.total))},{icon:j.Z,label:ng("磁盘可用","Disk free"),value:e8(null==tS?void 0:null===(V=tS.snapshot)||void 0===V?void 0:null===(J=V.disk)||void 0===J?void 0:J.free),sub:"/ ".concat(e8(null==tS?void 0:null===($=tS.snapshot)||void 0===$?void 0:null===(X=$.disk)||void 0===X?void 0:X.total))},{icon:a.Z,label:ng("服务在线","Services up"),value:"".concat(nW,"/").concat(nF||"—"),sub:ng("基础服务层","Infra layer")},{icon:N.Z,label:ng("运行时间","Uptime"),value:function(e){if(null==e||!Number.isFinite(e))return"—";let t=Math.max(0,Math.floor(e)),n=Math.floor(t/86400),s=Math.floor(t%86400/3600),l=Math.floor(t%3600/60);return n>0?"".concat(n,"d ").concat(s,"h"):s>0?"".concat(s,"h ").concat(l,"m"):"".concat(l,"m")}(null==tS?void 0:null===(Q=tS.snapshot)||void 0===Q?void 0:Q.uptime_seconds),sub:ng("自开机","Since boot")}].map((e,t)=>(0,s.jsxs)(l.E.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.05*t,duration:.35,ease:[.22,1,.36,1]},whileHover:{y:-2},className:"group relative overflow-hidden rounded-xl border border-white/[0.07] bg-gradient-to-br from-white/[0.05] to-transparent p-3 shadow-lg shadow-black/20",children:[(0,s.jsx)("div",{className:"absolute -right-4 -top-4 h-16 w-16 rounded-full bg-violet-500/10 blur-xl transition group-hover:bg-violet-500/18"}),(0,s.jsx)(e.icon,{className:"h-4 w-4 text-violet-300/90"}),(0,s.jsx)("p",{className:"mt-2 text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:e.label}),(0,s.jsx)("p",{className:"mt-0.5 font-mono text-lg font-semibold leading-tight text-white",children:tP?"…":e.value}),(0,s.jsx)("p",{className:"mt-0.5 text-[10px] text-zinc-500",children:e.sub})]},e.label))}),(null==tS?void 0:tS.hardware)&&"object"==typeof tS.hardware?(0,s.jsxs)("div",{className:"rounded-2xl border border-indigo-500/25 bg-gradient-to-br from-indigo-500/[0.1] via-zinc-950/70 to-violet-500/[0.08] p-6 shadow-2xl shadow-indigo-500/5",children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:ng("系统硬件与软件能力","Hardware & software profile")}),(0,s.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:ng("来自 hardware_probe;用于直播/解码策略参考。","From hardware_probe; guides decode/streaming posture.")}),(0,s.jsxs)("div",{className:"mt-5 grid gap-4 lg:grid-cols-2",children:[(0,s.jsxs)("div",{className:"space-y-3 rounded-xl border border-white/[0.06] bg-black/30 p-4",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-indigo-300/90",children:ng("平台","Platform")}),(0,s.jsxs)("dl",{className:"space-y-2 font-mono text-[11px] text-zinc-400",children:[(0,s.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,s.jsx)("dt",{className:"text-zinc-600",children:"arch"}),(0,s.jsx)("dd",{className:"text-right text-zinc-200",children:String(null!==(e5=tS.hardware.arch)&&void 0!==e5?e5:"—")})]}),(0,s.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,s.jsx)("dt",{className:"text-zinc-600",children:"kernel"}),(0,s.jsx)("dd",{className:"text-right text-zinc-200",children:String(null!==(e4=null!==(e2=tS.hardware.kernel)&&void 0!==e2?e2:null===(ee=tS.stack)||void 0===ee?void 0:ee.kernel)&&void 0!==e4?e4:"—")})]}),(0,s.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,s.jsx)("dt",{className:"text-zinc-600",children:"Python"}),(0,s.jsx)("dd",{className:"text-right text-zinc-200",children:String(null!==(ts=null===(et=tS.stack)||void 0===et?void 0:et.python)&&void 0!==ts?ts:"—")})]}),(0,s.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,s.jsx)("dt",{className:"text-zinc-600",children:"mDNS"}),(0,s.jsx)("dd",{className:"text-right text-cyan-200/90",children:null!==(tl=null===(en=tS.stack)||void 0===en?void 0:en.mdns_host)&&void 0!==tl?tl:"—"})]}),(0,s.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,s.jsx)("dt",{className:"text-zinc-600",children:"IP"}),(0,s.jsx)("dd",{className:"text-right text-zinc-300",children:((null===(es=tS.stack)||void 0===es?void 0:es.ips)||[]).join(" \xb7 ")||"—"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-3 rounded-xl border border-white/[0.06] bg-black/30 p-4",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-fuchsia-300/90",children:"GPU / NPU"}),(()=>{let e=tS.hardware.gpu,t=tS.hardware.npu;return(0,s.jsxs)("dl",{className:"space-y-2 font-mono text-[11px] text-zinc-400",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{className:"text-zinc-600",children:"GPU"}),(0,s.jsxs)("dd",{className:"mt-0.5 text-zinc-200",children:[(null==e?void 0:e.present)?ng("已检测","present"):ng("未检测","absent"),(null==e?void 0:e.driver)?" \xb7 ".concat(e.driver):""]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{className:"text-zinc-600",children:"render"}),(0,s.jsx)("dd",{className:"mt-0.5 break-all text-zinc-500",children:((null==e?void 0:e.render_nodes)||[]).join(", ")||"—"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{className:"text-zinc-600",children:"NPU"}),(0,s.jsx)("dd",{className:"mt-0.5 break-all text-zinc-500",children:(null==t?void 0:t.present)?(t.devices||[]).join(", "):ng("—","—")})]})]})})()]}),(0,s.jsxs)("div",{className:"space-y-3 rounded-xl border border-white/[0.06] bg-black/30 p-4 lg:col-span-2",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-emerald-300/90",children:"ffmpeg / 建议策略"}),(()=>{var e,t,n,l;let i=tS.hardware.ffmpeg_hwaccels||[],r=tS.hardware.recommendation;return(0,s.jsxs)("div",{className:"space-y-2 text-[11px] text-zinc-400",children:[(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"text-zinc-600",children:"hwaccels: "}),(0,s.jsx)("span",{className:"font-mono text-emerald-200/90",children:i.length?i.join(", "):"—"})]}),(0,s.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[(0,s.jsxs)("p",{children:[(0,s.jsxs)("span",{className:"text-zinc-600",children:[ng("解码","Decoder"),": "]}),(0,s.jsx)("span",{className:"text-zinc-200",children:null!==(e=null==r?void 0:r.video_decoder)&&void 0!==e?e:"—"})]}),(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"text-zinc-600",children:"HDMI: "}),(0,s.jsx)("span",{className:"text-zinc-200",children:null!==(t=null==r?void 0:r.hdmi_player)&&void 0!==t?t:"—"})]}),(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"text-zinc-600",children:"Browser: "}),(0,s.jsx)("span",{className:"text-zinc-200",children:null!==(n=null==r?void 0:r.browser_hwaccel)&&void 0!==n?n:"—"})]}),(0,s.jsxs)("p",{children:[(0,s.jsxs)("span",{className:"text-zinc-600",children:[ng("稳定模式","Stability"),": "]}),(0,s.jsx)("span",{className:"text-amber-200/90",children:null!==(l=null==r?void 0:r.stability_mode)&&void 0!==l?l:"—"})]})]}),((null==r?void 0:r.degradation_reasons)||[]).length?(0,s.jsx)("ul",{className:"mt-2 list-inside list-disc space-y-1 text-[10px] text-amber-200/80",children:((null==r?void 0:r.degradation_reasons)||[]).map(e=>(0,s.jsx)("li",{children:e},e))}):null]})})()]})]})]}):null,t0?(0,s.jsxs)("div",{className:"rounded-2xl border p-5 ".concat(t0.ready?"border-emerald-500/25 bg-gradient-to-br from-emerald-500/[0.08] via-zinc-950/50 to-cyan-500/[0.05]":"border-amber-500/30 bg-gradient-to-br from-amber-500/[0.1] via-zinc-950/55 to-rose-500/[0.05]"),children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:ng("安装验收","Deployment health")}),(0,s.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:ng("一键脚本完成后,本机 API、局域网入口、反向代理与 mDNS 的可用性检查。","Post-install checks for loopback API, LAN access, reverse proxy, and mDNS.")})]}),(0,s.jsx)("span",{className:"rounded-full px-3 py-1 text-[10px] font-semibold ".concat(t0.ready?"bg-emerald-500/20 text-emerald-100 ring-1 ring-emerald-500/30":"bg-amber-500/20 text-amber-100 ring-1 ring-amber-500/30"),children:t0.ready?ng("可交付","Ready"):ng("需处理","Needs attention")})]}),(0,s.jsxs)("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/30 p-4",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:ng("验收摘要","Acceptance summary")}),(0,s.jsxs)("p",{className:"mt-2 font-mono text-sm text-white",children:[null!==(ti=t0.pass_count)&&void 0!==ti?ti:0,"/",null!==(tr=t0.total_count)&&void 0!==tr?tr:0,(0,s.jsx)("span",{className:"ml-2 text-[11px] text-zinc-500",children:ng("已通过","checks passed")})]}),(0,s.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[ng("必需项","Required"),": ",null!==(ta=t0.required_total)&&void 0!==ta?ta:0," \xb7 mDNS"," ",t0.mdns_enabled?ng("已启用","enabled"):ng("已关闭","disabled")," \xb7 edge"," ",t0.live_edge_enabled?ng("已启用","enabled"):ng("已关闭","disabled")]}),(0,s.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:Object.entries(t0.urls||{}).filter(e=>{let[,t]=e;return!!t}).slice(0,4).map(e=>{let[t,n]=e;return(0,s.jsx)("a",{href:(0,em.p)(n),target:"_blank",rel:"noreferrer",className:"rounded-lg border border-white/10 bg-white/5 px-3 py-2 text-[11px] text-zinc-200 ring-1 ring-white/10",children:t},t)})})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/30 p-4",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:(null===(el=t0.failing_checks)||void 0===el?void 0:el.length)?ng("失败项","Failing checks"):ng("当前状态","Current state")}),(null===(ei=t0.failing_checks)||void 0===ei?void 0:ei.length)?(0,s.jsx)("ul",{className:"mt-2 space-y-2 text-[11px] text-zinc-300",children:t0.failing_checks.slice(0,4).map(e=>(0,s.jsxs)("li",{className:"rounded-lg border border-amber-500/20 bg-amber-500/10 px-3 py-2",children:[(0,s.jsx)("span",{className:"font-semibold text-amber-100",children:e.label}),(0,s.jsx)("span",{className:"ml-2 text-zinc-400",children:e.detail||"—"})]},e.id))}):(0,s.jsx)("p",{className:"mt-2 text-[11px] text-emerald-200/90",children:ng("必需检查已全部通过,可直接用浏览器面板交付。","All required checks pass; browser control plane is ready.")}),(t0.hints||[]).length?(0,s.jsx)("ul",{className:"mt-3 list-inside list-disc space-y-1 text-[10px] text-zinc-400",children:(t0.hints||[]).slice(0,3).map(e=>(0,s.jsx)("li",{children:e},e))}):null]})]})]}):null,(null==tS?void 0:null===(er=tS.stack)||void 0===er?void 0:er.neko_login)?(0,s.jsxs)("div",{className:"rounded-2xl border border-fuchsia-500/25 bg-gradient-to-r from-fuchsia-500/[0.08] to-violet-500/[0.06] p-5",children:[(0,s.jsxs)("h3",{className:"text-sm font-semibold text-white",children:["Neko ",ng("登录","sign-in")]}),(0,s.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:tS.stack.neko_login.note_zh||ng(nz?"Neko Chromium ".concat(nz," 使用下列账号策略。"):"Neko Chromium 多实例使用下列账号策略。",nz?"Neko Chromium ".concat(nz," uses the policy below."):"Neko Chromium instances use the policy below.")}),(0,s.jsx)("p",{className:"mt-2 text-[11px] text-amber-200/85",children:ng("重要:两栏分开填——昵称随意,密码必须是环境变量里的口令(默认 12345678)。用错密码会像一直加载;勿把「用户名/密码」写在一行。","Use two fields: display name is free-form; password must match NEKO_* (default 12345678). Wrong password looks like infinite loading.")}),nk.length?(0,s.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:nk.map(e=>(0,s.jsxs)("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"rounded-lg border border-fuchsia-400/20 bg-black/25 px-3 py-2 text-[11px] text-fuchsia-100 ring-1 ring-fuchsia-400/20",children:[(0,s.jsx)("span",{className:"font-semibold",children:e.label}),(0,s.jsx)("span",{className:"ml-2 rounded-full bg-fuchsia-500/15 px-1.5 py-0.5 text-[10px] text-fuchsia-100",children:e.accessLabel}),(0,s.jsxs)("span",{className:"ml-2 font-mono text-fuchsia-100/75",children:[e.host||"",e.port?":".concat(e.port):""]})]},e.key))}):null,(0,s.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 font-mono text-sm",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/40 px-4 py-3",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase text-zinc-500",children:ng("昵称示例","Display Name Example")}),(0,s.jsx)("p",{className:"mt-1 text-fuchsia-200",children:null!==(to=tS.stack.neko_login.user_login)&&void 0!==to?to:"live"}),(0,s.jsx)("p",{className:"mt-2 text-[10px] uppercase text-zinc-500",children:ng("连接口令","Access Password")}),(0,s.jsx)("p",{className:"mt-0.5 text-fuchsia-100",children:null!==(tc=tS.stack.neko_login.user_password)&&void 0!==tc?tc:"—"})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/40 px-4 py-3",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase text-zinc-500",children:ng("管理昵称示例","Admin Display Name Example")}),(0,s.jsx)("p",{className:"mt-1 text-violet-200",children:null!==(td=tS.stack.neko_login.admin_login)&&void 0!==td?td:"admin"}),(0,s.jsx)("p",{className:"mt-2 text-[10px] uppercase text-zinc-500",children:ng("管理口令","Admin Password")}),(0,s.jsx)("p",{className:"mt-0.5 text-violet-100",children:null!==(tx=tS.stack.neko_login.admin_password)&&void 0!==tx?tx:"—"})]})]}),(0,s.jsx)("p",{className:"mt-3 text-[10px] text-zinc-600",children:ng("x86 默认使用 Neko 的 Chrome 镜像,ARM 默认使用 Chromium 镜像;默认保留管理员会话、开发者工具和 Tampermonkey 持久化。本栈未启用 Firefox 版 Neko。","x86 defaults to Neko’s Chrome image, ARM defaults to Chromium, and admin access, DevTools, plus persistent Tampermonkey stay enabled. This stack does not use Firefox Neko.")})]}):null,(null==tS?void 0:null===(ec=tS.network)||void 0===ec?void 0:null===(ea=ec.interfaces)||void 0===ea?void 0:ea.length)?(0,s.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-gradient-to-br from-cyan-500/[0.07] to-transparent p-5",children:[(0,s.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,s.jsx)(k.Z,{className:"h-4 w-4 text-cyan-300"}),ng("网络带宽 / 流量","Network bandwidth / traffic")]}),(0,s.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:ng("实时速率由总览自动刷新间隔计算;累计值来自系统网卡计数器。","Live rates are calculated from dashboard refresh deltas; totals come from kernel counters.")}),(0,s.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 px-4 py-3 font-mono text-[11px]",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.08em] text-cyan-300/70",children:ng("实时下行","Live down")}),(0,s.jsx)("p",{className:"mt-1 text-lg font-semibold text-cyan-100",children:e7(tS.network.total_rx_bps)}),(0,s.jsxs)("p",{className:"mt-1 text-zinc-500",children:[ng("累计","Total"),": ",e8(tS.network.total_rx_bytes)]})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 px-4 py-3 font-mono text-[11px]",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.08em] text-cyan-300/70",children:ng("实时上行","Live up")}),(0,s.jsx)("p",{className:"mt-1 text-lg font-semibold text-cyan-100",children:e7(tS.network.total_tx_bps)}),(0,s.jsxs)("p",{className:"mt-1 text-zinc-500",children:[ng("累计","Total"),": ",e8(tS.network.total_tx_bytes)]})]})]}),(0,s.jsx)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:(tS.network.interfaces||[]).slice(0,6).map(e=>{var t,n,l,i;return(0,s.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 px-4 py-3 font-mono text-[11px]",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-cyan-200/90",children:e.name}),(0,s.jsxs)("p",{className:"mt-2 text-zinc-500",children:[ng("链路","Link"),": ",e.operstate||"unknown"," ",(0,s.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",e.speed_mbps?"".concat(e.speed_mbps," Mbps"):ng("未知速率","unknown speed")]}),(0,s.jsxs)("p",{className:"mt-2 text-zinc-500",children:["↓ ",e7(e.rx_bps)," ",(0,s.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",e8(e.rx_bytes)," ",(0,s.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",null!==(l=null===(t=e.rx_packets)||void 0===t?void 0:t.toLocaleString())&&void 0!==l?l:"—"," pkt"]}),(0,s.jsxs)("p",{className:"mt-0.5 text-zinc-500",children:["↑ ",e7(e.tx_bps)," ",(0,s.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",e8(e.tx_bytes)," ",(0,s.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",null!==(i=null===(n=e.tx_packets)||void 0===n?void 0:n.toLocaleString())&&void 0!==i?i:"—"," pkt"]})]},e.name)})})]}):null,(null==tS?void 0:null===(ex=tS.live_events)||void 0===ex?void 0:null===(ed=ex.pm2_tail)||void 0===ed?void 0:ed.length)||(null==tS?void 0:null===(eh=tS.live_events)||void 0===eh?void 0:null===(eu=eh.process_digest)||void 0===eu?void 0:eu.length)?(0,s.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-amber-500/15 bg-zinc-950/40 p-5",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:ng("直播 / PM2 事件","Live / PM2 feed")}),(0,s.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:ng("PM2 合并日志尾部","PM2 merged log tail")}),(0,s.jsx)("pre",{className:"mt-3 max-h-48 overflow-auto whitespace-pre-wrap rounded-lg border border-white/[0.05] bg-black/40 p-3 font-mono text-[10px] leading-relaxed text-zinc-400",children:((null==tS?void 0:null===(ep=tS.live_events)||void 0===ep?void 0:ep.pm2_tail)||[]).join("\n")||ng("暂无 PM2 输出","No PM2 output")})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-violet-500/15 bg-zinc-950/40 p-5",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:ng("进程快照","Process digest")}),(0,s.jsx)("ul",{className:"mt-3 space-y-2",children:((null==tS?void 0:null===(eb=tS.live_events)||void 0===eb?void 0:eb.process_digest)||[]).map(e=>(0,s.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-lg border border-white/[0.05] bg-black/30 px-3 py-2 text-xs",children:[(0,s.jsx)("span",{className:"truncate text-zinc-300",children:e.label||e.pm2}),(0,s.jsx)("span",{className:"shrink-0 rounded-md px-2 py-0.5 text-[10px] font-medium ".concat(te(e.status||"")),children:tt(e.status||"",ng)})]},e.pm2))})]})]}):null,(0,s.jsxs)("div",{className:"rounded-2xl border border-violet-500/20 bg-gradient-to-br from-violet-500/[0.12] via-zinc-950/50 to-fuchsia-500/[0.06] p-5 shadow-lg shadow-violet-500/5",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:ng("直播进程","Live processes")}),(0,s.jsx)("span",{className:"rounded-full bg-white/10 px-2 py-0.5 text-[10px] font-medium text-zinc-300",children:(null==tS?void 0:null===(eg=tS.live)||void 0===eg?void 0:eg.backend_mode)||"—"})]}),(0,s.jsxs)("ul",{className:"mt-4 space-y-2.5",children:[((null==tS?void 0:null===(ef=tS.live)||void 0===ef?void 0:ef.processes)||[]).slice(0,10).map(e=>(0,s.jsxs)("li",{className:"group flex items-center gap-3 rounded-xl border border-white/[0.08] bg-black/35 px-3 py-2.5 transition hover:border-violet-400/25 hover:bg-black/45",children:[(0,s.jsx)("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-violet-500/30 to-fuchsia-500/20 text-[10px] font-bold text-violet-100 ring-1 ring-white/10",children:"LIVE"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"truncate text-sm font-medium text-zinc-100",children:e.label||e.pm2}),(0,s.jsx)("p",{className:"truncate font-mono text-[10px] text-zinc-600",children:e.script||e.pm2})]}),(0,s.jsx)("span",{className:"shrink-0 rounded-lg px-2.5 py-1 text-[10px] font-semibold ".concat(te(e.process_status||"")),children:tt(e.process_status||"",ng)})]},e.pm2)),(null==tS?void 0:null===(ey=tS.live)||void 0===ey?void 0:null===(ev=ey.processes)||void 0===ev?void 0:ev.length)?null:(0,s.jsx)("li",{className:"rounded-xl border border-dashed border-white/10 py-8 text-center text-xs text-zinc-600",children:ng("暂无直播进程","No live processes")})]}),(0,s.jsxs)("div",{className:"mt-5 grid grid-cols-2 gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:()=>tN("live_youtube"),className:"rounded-xl border border-violet-400/35 bg-violet-500/15 py-2.5 text-[11px] font-semibold text-violet-100 shadow-inner shadow-black/20 transition hover:bg-violet-500/25",children:"YouTube"}),(0,s.jsx)("button",{type:"button",onClick:()=>tN("live_tiktok"),className:"rounded-xl border border-cyan-400/35 bg-cyan-500/15 py-2.5 text-[11px] font-semibold text-cyan-100 shadow-inner shadow-black/20 transition hover:bg-cyan-500/25",children:"TikTok"})]})]}),(null==tS?void 0:tS.probes)&&t3?(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[tS.probes.srs?(()=>{var e,t,n,l,i,r,a;let o=null===(e=tS.probes)||void 0===e?void 0:e.srs,c=null==o?void 0:null===(t=o.tcp)||void 0===t?void 0:t.reachable,d=null==o?void 0:null===(n=o.tcp_api)||void 0===n?void 0:n.reachable,x=null==o?void 0:o.http_ui,u=null==o?void 0:o.http,m=null==o?void 0:o.api_port,h=null!==(i=null==o?void 0:o.api_ok)&&void 0!==i?i:(null==u?void 0:u.http_code)===200,p=null==x?void 0:x.http_code;return(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.07] bg-zinc-950/40 p-4 backdrop-blur-sm",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-white",children:"SRS"}),(0,s.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat(h?"bg-emerald-500/20 text-emerald-200 ring-1 ring-emerald-500/30":"bg-rose-500/15 text-rose-200 ring-1 ring-rose-500/25"),children:h?ng("API 正常","API OK"):ng("API 异常","API down")})]}),(0,s.jsxs)("p",{className:"mt-1 font-mono text-[11px] text-zinc-500",children:[":",null!==(r=null==o?void 0:o.port)&&void 0!==r?r:"—"," / API :",null!=m?m:"—"," \xb7 TCP ",c?"OK":"—"," \xb7 API TCP"," ",d?"OK":"—"]}),(0,s.jsxs)("p",{className:"mt-1 font-mono text-[11px] text-zinc-500",children:["API HTTP ",null!==(a=null==u?void 0:u.http_code)&&void 0!==a?a:"—"," \xb7 ",ng("根路径","root")," ",null!=p?p:"—",404===p?ng("(无首页不影响推流)"," (no index is OK for streaming)"):null]}),(0,s.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[ng("延迟","RTT")," ",(null==u?void 0:u.latency_ms)!=null?"".concat(u.latency_ms," ms"):(null==o?void 0:null===(l=o.tcp)||void 0===l?void 0:l.latency_ms)!=null?"".concat(o.tcp.latency_ms," ms"):"—"]}),!h&&(null==u?void 0:u.error)?(0,s.jsx)("p",{className:"mt-1 line-clamp-2 text-[10px] text-amber-200/80",children:u.error}):null]})})():null,tS.probes.neko?(()=>{var e,t,n,l,i,r,a;let o=null===(e=tS.probes)||void 0===e?void 0:e.neko,c=null==o?void 0:null===(t=o.tcp)||void 0===t?void 0:t.reachable,d=null==o?void 0:o.http,x=(null==o?void 0:o.instances)||[],u=null!==(l=null==o?void 0:o.running_count)&&void 0!==l?l:x.filter(e=>{var t;return null===(t=e.tcp)||void 0===t?void 0:t.reachable}).length,m=null!==(i=null==o?void 0:o.required_count)&&void 0!==i?i:x.length;return(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.07] bg-zinc-950/40 p-4 backdrop-blur-sm",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-white",children:"Neko Chromium"}),(0,s.jsxs)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat(u>0?"bg-emerald-500/20 text-emerald-200 ring-1 ring-emerald-500/30":"bg-rose-500/15 text-rose-200 ring-1 ring-rose-500/25"),children:[u,"/",m||"—"," ",ng("在线","online")]})]}),(0,s.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:ng("Docker 内 Chromium(非 Chrome 品牌);arm64/x86 同一镜像。","Chromium in Docker (not Chrome branding); multi-arch.")}),(0,s.jsxs)("p",{className:"mt-2 font-mono text-[11px] text-zinc-500",children:[":",null!==(r=null==o?void 0:o.port)&&void 0!==r?r:"—"," \xb7 TCP ",c?"OK":"—"," \xb7 HTTP ",null!==(a=null==d?void 0:d.http_code)&&void 0!==a?a:"—"]}),(0,s.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[ng("延迟","RTT")," ",(null==d?void 0:d.latency_ms)!=null?"".concat(d.latency_ms," ms"):(null==o?void 0:null===(n=o.tcp)||void 0===n?void 0:n.latency_ms)!=null?"".concat(o.tcp.latency_ms," ms"):"—"]}),x.length?(0,s.jsx)("div",{className:"mt-3 space-y-2",children:x.map(e=>{var t,n,l,i,r,a,o;return(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-white/[0.05] bg-black/25 px-3 py-2",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("p",{className:"text-[11px] font-semibold text-zinc-200",children:["Neko ",null!==(r=e.id)&&void 0!==r?r:"?"]}),(0,s.jsxs)("p",{className:"font-mono text-[10px] text-zinc-500",children:[":",null!==(a=e.port)&&void 0!==a?a:"—"," \xb7 TCP ",(null===(t=e.tcp)||void 0===t?void 0:t.reachable)?"OK":"—"," \xb7 HTTP"," ",null!==(o=null===(n=e.http)||void 0===n?void 0:n.http_code)&&void 0!==o?o:"—"]})]}),(0,s.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat((null===(l=e.tcp)||void 0===l?void 0:l.reachable)?"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-500/25":"bg-zinc-500/15 text-zinc-400 ring-1 ring-zinc-500/25"),children:(null===(i=e.tcp)||void 0===i?void 0:i.reachable)?ng("运行中","Running"):ng("未连通","Offline")})]},"".concat(e.id,"-").concat(e.port))})}):null,!(null==d?void 0:d.reachable)&&(null==d?void 0:d.error)?(0,s.jsx)("p",{className:"mt-1 line-clamp-2 text-[10px] text-amber-200/80",children:d.error}):null]})})():null]}):null]}):null,"services"===tj?(0,s.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:[((null==tS?void 0:tS.services)||[]).map((e,t)=>(0,s.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.04*t},whileHover:{y:-2},className:"rounded-2xl border border-white/[0.07] bg-gradient-to-b from-white/[0.05] to-transparent p-5",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-semibold text-white",children:e.label}),(0,s.jsx)("p",{className:"mt-1 text-xs text-zinc-500 line-clamp-2",children:e.description})]}),(0,s.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(te(e.running?"online":e.status)),children:e.running?ng("运行中","Running"):e.status})]}),e.detail?(0,s.jsx)("p",{className:"mt-2 text-[11px] leading-snug line-clamp-6 ".concat("skipped"===e.status?"text-slate-300/90":"text-amber-200/85"),children:e.detail}):null,"shellcrash"===e.service_id&&e.available&&!e.running?(0,s.jsx)("p",{className:"mt-2 text-[11px] text-zinc-500",children:ng("stopped 为常态:仅当需要透明代理 / 规则分流时再点 Start(或 systemctl enable --now shellcrash)。","Stopped is normal; Start only when you need the proxy (or enable shellcrash.service).")}):null,(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.url?(0,s.jsx)("a",{href:(0,em.p)(e.url),target:"_blank",rel:"noreferrer",className:"rounded-lg bg-violet-500/15 px-3 py-1.5 text-xs font-medium text-violet-200 ring-1 ring-violet-500/25",children:ng("打开面板","Open panel")}):null,(0,s.jsx)("button",{type:"button",disabled:!!tM||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?ng("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||ng("当前不可操作","Unavailable"),onClick:()=>void nD(e.service_id,"start"),className:"rounded-lg bg-emerald-500/20 px-3 py-1.5 text-xs font-medium text-emerald-200 ring-1 ring-emerald-500/30 disabled:opacity-30",children:"Start"}),(0,s.jsx)("button",{type:"button",disabled:!!tM||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?ng("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||ng("当前不可操作","Unavailable"),onClick:()=>void nD(e.service_id,"install"),className:"rounded-lg bg-sky-500/15 px-3 py-1.5 text-xs font-medium text-sky-200 ring-1 ring-sky-500/25 disabled:opacity-30",children:"Install"}),(0,s.jsx)("button",{type:"button",disabled:!!tM||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?ng("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||ng("当前不可操作","Unavailable"),onClick:()=>void nD(e.service_id,"restart"),className:"rounded-lg bg-amber-500/15 px-3 py-1.5 text-xs font-medium text-amber-200 ring-1 ring-amber-500/25 disabled:opacity-30",children:"Restart"}),(0,s.jsx)("button",{type:"button",disabled:!!tM||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?ng("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||ng("当前不可操作","Unavailable"),onClick:()=>void nD(e.service_id,"upgrade"),className:"rounded-lg bg-indigo-500/15 px-3 py-1.5 text-xs font-medium text-indigo-200 ring-1 ring-indigo-500/25 disabled:opacity-30",children:"Upgrade"}),(0,s.jsx)("button",{type:"button",disabled:!!tM||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?ng("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||ng("当前不可操作","Unavailable"),onClick:()=>void nD(e.service_id,"stop"),className:"rounded-lg bg-rose-500/15 px-3 py-1.5 text-xs font-medium text-rose-200 ring-1 ring-rose-500/25 disabled:opacity-30",children:"Stop"}),(0,s.jsx)("button",{type:"button",disabled:!!tM||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?ng("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||ng("当前不可操作","Unavailable"),onClick:()=>void nD(e.service_id,"uninstall"),className:"rounded-lg bg-zinc-500/15 px-3 py-1.5 text-xs font-medium text-zinc-200 ring-1 ring-zinc-500/25 disabled:opacity-30",children:"Uninstall"})]})]},e.service_id)),(null==tS?void 0:null===(ew=tS.services)||void 0===ew?void 0:ew.length)?null:(0,s.jsx)("p",{className:"text-sm text-zinc-500",children:ng("暂无服务数据","No services")})]}):null,"live_youtube"===tj?(0,s.jsx)(e3,{t:ng,busy:tM,entries:tO,currentProc:tW,setCurrentProc:tF,urlConfig:tY,setUrlConfig:tG,onRunProcess:(e,t)=>void nZ(e,t),onSaveUrlConfig:(e,t)=>nO(e,t),fetchJson:nv,liveProcesses:tB.length?tB:null!==(tu=null==tS?void 0:null===(ej=tS.live)||void 0===ej?void 0:ej.processes)&&void 0!==tu?tu:[],notify:nf,quickLinks:nN,onNavigate:e=>tN(e)}):null,"live_tiktok"===tj?(0,s.jsx)(e_,{t:ng,busy:!!tM,entries:tO,currentProc:tW,setCurrentProc:tF,urlConfig:tY,setUrlConfig:tG,onRunProcess:e=>void nZ(e),onSaveUrlConfig:e=>nO(e),onReplayGoLive:async(e,t)=>{let n=t.replace(/[,,|]/g,"_");await nO("原画,".concat(e,",主播: ").concat(n)),await nZ("start")},onCopy:nK,fetchJson:nv,apiPrefix:tg,quickLinks:nN,hdmiStatus:null==tS?void 0:tS.hdmi,notify:nf,onNavigate:e=>tN(e)}):null,"android"===tj?(0,s.jsx)(eo,{t:ng,notify:nf,fetchJson:nv,apiBase:tg,busy:tM,androidSerial:tV,setAndroidSerial:tX,devices:(null==tS?void 0:null===(eN=tS.android)||void 0===eN?void 0:eN.devices)||[],adbAvailable:!!(null==tS?void 0:null===(ek=tS.android)||void 0===ek?void 0:ek.adb_available),apkPath:tq,setApkPath:tJ,onAndroidAction:(e,t)=>nH(e,null!=t?t:{}),onCopy:nK,onRefreshDevices:()=>void ny()}):null,"network"===tj?(0,s.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6",children:[(0,s.jsxs)("div",{className:"rounded-2xl border p-6 shadow-xl ".concat("light"===ty?"border-cyan-200/90 bg-white shadow-cyan-100/50":"border-cyan-500/20 bg-zinc-950/55 shadow-black/30"),children:[(0,s.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===ty?"text-slate-900":"text-white"),children:[(0,s.jsx)(z.Z,{className:"h-4 w-4 ".concat("light"===ty?"text-cyan-700":"text-cyan-300")}),"WireGuard VPS"]}),(0,s.jsx)("p",{className:"mt-2 text-xs ".concat("light"===ty?"text-slate-600":"text-zinc-400"),children:ng("导入 VPS wg-quick 配置,保存到受管配置目录,并生成 Windows 端点旁路路由命令。","Import a VPS wg-quick config, save it under managed config, and generate the Windows endpoint bypass route.")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsxs)("span",{className:"rounded-full px-3 py-1 text-[11px] font-semibold ".concat((null==nn?void 0:nn.active)?"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-400/25":"bg-amber-500/15 text-amber-200 ring-1 ring-amber-400/25"),children:[tn(null==nn?void 0:null===(ez=nn.quality)||void 0===ez?void 0:ez.status,ng),"number"==typeof(null==nn?void 0:null===(eS=nn.quality)||void 0===eS?void 0:eS.score)?" \xb7 ".concat(nn.quality.score,"/100"):""]}),(null==ne?void 0:ne.relative_path)?(0,s.jsx)("div",{className:"rounded-lg border px-3 py-2 text-[11px] ".concat("light"===ty?"border-cyan-200 bg-cyan-50 text-cyan-900":"border-cyan-400/20 bg-cyan-500/10 text-cyan-100"),children:ne.relative_path}):null,(0,s.jsxs)("button",{onClick:()=>void nT(),disabled:"wg:status"===tM,className:"inline-flex items-center gap-2 rounded-lg px-3 py-2 text-xs font-semibold ring-1 transition disabled:opacity-40 ".concat("light"===ty?"bg-white text-slate-700 ring-slate-200 hover:bg-slate-50":"bg-white/5 text-zinc-100 ring-white/10 hover:bg-white/10"),children:[(0,s.jsx)(y.Z,{className:"h-3.5 w-3.5"}),ng("刷新","Refresh")]})]})]}),(0,s.jsxs)("div",{className:"mt-5 grid gap-3 lg:grid-cols-3",children:[(0,s.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===ty?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,s.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===ty?"text-slate-500":"text-zinc-500"),children:ng("当前接口","Active interfaces")}),(0,s.jsxs)("div",{className:"mt-2 rounded-lg border px-3 py-2 text-xs ".concat("light"===ty?"border-cyan-100 bg-white text-slate-700":"border-cyan-400/15 bg-cyan-500/10 text-cyan-100"),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("span",{className:"font-semibold",children:tn(null==nn?void 0:null===(eC=nn.quality)||void 0===eC?void 0:eC.status,ng)}),(0,s.jsx)("span",{className:"font-mono",children:"number"==typeof(null==nn?void 0:null===(eR=nn.quality)||void 0===eR?void 0:eR.score)?"".concat(nn.quality.score,"/100"):"—"})]}),(0,s.jsxs)("p",{className:"mt-1 text-[11px] ".concat("light"===ty?"text-slate-500":"text-cyan-100/75"),children:[ng("新鲜握手","Fresh peers"),": ",null!==(tm=null==nn?void 0:null===(eL=nn.quality)||void 0===eL?void 0:eL.fresh_peer_count)&&void 0!==tm?tm:0,"/",null!==(th=null==nn?void 0:null===(eM=nn.quality)||void 0===eM?void 0:eM.peer_count)&&void 0!==th?th:0," \xb7 ",ng("最佳握手","Best handshake"),": ",e9(null==nn?void 0:null===(eT=nn.quality)||void 0===eT?void 0:eT.best_handshake_age_seconds)]})]}),(0,s.jsx)("div",{className:"mt-2 space-y-2",children:((null==nn?void 0:nn.interfaces)||[]).length?((null==nn?void 0:nn.interfaces)||[]).map(e=>{var t,n,l;return(0,s.jsxs)("div",{className:"rounded-lg border px-3 py-2 text-xs ".concat("light"===ty?"border-slate-200 bg-white text-slate-700":"border-white/10 bg-zinc-950/60 text-zinc-200"),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("span",{className:"font-semibold",children:e.name||"wg"}),(0,s.jsx)("span",{className:(null===(t=e.systemd)||void 0===t?void 0:t.active)==="active"?"text-emerald-400":"text-amber-300",children:(null===(n=e.systemd)||void 0===n?void 0:n.active)||"active"})]}),(0,s.jsx)("p",{className:"mt-1 font-mono text-[11px]",children:(e.addresses||[]).join(", ")||"—"}),(0,s.jsxs)("p",{className:"mt-1 text-[11px] ".concat("light"===ty?"text-slate-500":"text-zinc-500"),children:[e.details_available?ng("运行细节可读","Runtime details readable"):ng("运行细节受限","Runtime details limited"),(null===(l=e.configured_from)||void 0===l?void 0:l.name)?" \xb7 ".concat(ng("配置","Config"),": ").concat(e.configured_from.name):""]})]},e.name||"wg")}):(0,s.jsx)("p",{className:"text-xs ".concat("light"===ty?"text-slate-500":"text-zinc-500"),children:ng("未发现 wg show 输出","No wg show output")})})]}),(0,s.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===ty?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,s.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===ty?"text-slate-500":"text-zinc-500"),children:ng("对端与流量","Peer and traffic")}),(()=>{var e;let t=(null==nR?void 0:nR.status_source)==="wg"?ng("运行态","Runtime"):(null==nR?void 0:nR.config_source)==="system"?ng("系统配置","System config"):(null==nR?void 0:nR.config_source)==="repo"?ng("受管配置","Managed config"):ng("配置态","Config");return nR?(0,s.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[11px] ".concat("light"===ty?"text-slate-700":"text-zinc-300"),children:[(0,s.jsxs)("p",{children:["Source: ",t]}),(0,s.jsxs)("p",{children:["Endpoint: ",nR.endpoint||"—"]}),(0,s.jsxs)("p",{children:["AllowedIPs: ",(nR.allowed_ips||[]).join(", ")||"—"]}),(0,s.jsxs)("p",{children:["Handshake:"," ","config"===nR.status_source?ng("运行态需 root/CAP_NET_ADMIN","Runtime details need root/CAP_NET_ADMIN"):e9(nR.latest_handshake_age_seconds)]}),(0,s.jsxs)("p",{children:["RX/TX: ",e8(nR.transfer_rx_bytes)," / ",e8(nR.transfer_tx_bytes)]}),(0,s.jsxs)("p",{children:["Keepalive: ",null!==(e=nR.persistent_keepalive)&&void 0!==e?e:"—"]})]}):(0,s.jsx)("p",{className:"mt-2 text-xs ".concat("light"===ty?"text-slate-500":"text-zinc-500"),children:ng("暂无 peer 数据","No peer data yet")})})(),((null==nn?void 0:nn.endpoint_routes)||[]).length?(0,s.jsx)("div",{className:"mt-3 space-y-1 rounded-lg border px-3 py-2 font-mono text-[10px] ".concat("light"===ty?"border-slate-200 bg-white text-slate-600":"border-white/10 bg-zinc-950/60 text-zinc-400"),children:((null==nn?void 0:nn.endpoint_routes)||[]).slice(0,2).map(e=>(0,s.jsxs)("p",{className:e.uses_wireguard_interface?"text-amber-300":"",children:["route ",e.host||"endpoint",": ",e.route||(e.ok?"ok":"unavailable")]},e.host||e.route||"endpoint-route"))}):null]}),(0,s.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===ty?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,s.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===ty?"text-slate-500":"text-zinc-500"),children:ng("Neko / ShellCrash","Neko / ShellCrash")}),(0,s.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[11px] ".concat("light"===ty?"text-slate-700":"text-zinc-300"),children:[(0,s.jsxs)("p",{children:["NAT1TO1: ",(null==nn?void 0:null===(eU=nn.neko)||void 0===eU?void 0:eU.nat1to1)||"—"]}),(0,s.jsxs)("p",{children:["WG host: ",(null==nn?void 0:null===(eE=nn.neko)||void 0===eE?void 0:eE.wireguard_hosts)||"—"]}),(0,s.jsxs)("p",{children:["Neko proxy: ",(null==nn?void 0:null===(eI=nn.neko)||void 0===eI?void 0:eI.browser_proxy)||"auto"]}),(0,s.jsxs)("p",{children:["ShellCrash: ",(null==nn?void 0:null===(eA=nn.shellcrash)||void 0===eA?void 0:eA.running)?"running:".concat((null==nn?void 0:null===(eD=nn.shellcrash)||void 0===eD?void 0:eD.mixed_port)||"7890"):"stopped"]})]}),((null==nn?void 0:null===(eZ=nn.neko)||void 0===eZ?void 0:eZ.remote_urls)||[]).length?(0,s.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:((null==nn?void 0:null===(eO=nn.neko)||void 0===eO?void 0:eO.remote_urls)||[]).slice(0,4).map(e=>(0,s.jsxs)("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"rounded-lg px-2.5 py-1.5 text-[11px] font-semibold ring-1 transition ".concat("light"===ty?"bg-white text-cyan-800 ring-cyan-100 hover:bg-cyan-50":"bg-cyan-500/10 text-cyan-100 ring-cyan-400/20 hover:bg-cyan-500/15"),children:["Neko ",e.id||1," \xb7 ",e.kind||"remote"]},"".concat(e.kind||"remote","-").concat(e.id||0,"-").concat(e.url||"")))}):null]})]}),(null==nn?void 0:null===(eH=nn.recommendations)||void 0===eH?void 0:eH.length)?(0,s.jsx)("div",{className:"mt-3 rounded-xl border px-4 py-3 text-xs ".concat("light"===ty?"border-amber-200 bg-amber-50 text-amber-800":"border-amber-400/20 bg-amber-500/10 text-amber-100"),children:(nn.recommendations||[]).join(" \xb7 ")}):null,(null==nn?void 0:null===(eK=nn.quality)||void 0===eK?void 0:null===(eB=eK.reasons)||void 0===eB?void 0:eB.length)?(0,s.jsx)("div",{className:"mt-3 rounded-xl border px-4 py-3 text-xs ".concat("light"===ty?"border-slate-200 bg-white text-slate-700":"border-white/10 bg-black/25 text-zinc-300"),children:(nn.quality.reasons||[]).slice(0,4).join(" \xb7 ")}):null,(0,s.jsxs)("div",{className:"mt-5 grid gap-4 lg:grid-cols-[minmax(0,1fr)_22rem]",children:[(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[14rem_minmax(0,1fr)]",children:[(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===ty?"text-slate-600":"text-zinc-400"),children:ng("配置名","Config name")}),(0,s.jsx)("input",{value:t6,onChange:e=>t8(e.target.value),className:"mt-1 w-full rounded-lg border px-3 py-2 text-sm outline-none ".concat("light"===ty?"border-slate-200 bg-white text-slate-900 focus:border-cyan-400":"border-white/10 bg-black/30 text-zinc-100 focus:border-cyan-400/60")})]}),(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===ty?"text-slate-600":"text-zinc-400"),children:ng("配置文件","Config file")}),(0,s.jsx)("input",{type:"file",accept:".conf,.txt,text/plain",onChange:e=>{var t;nA(null===(t=e.target.files)||void 0===t?void 0:t[0])},className:"mt-1 w-full rounded-lg border px-3 py-2 text-xs file:mr-3 file:rounded-md file:border-0 file:px-3 file:py-1.5 file:text-xs file:font-semibold ".concat("light"===ty?"border-slate-200 bg-white text-slate-700 file:bg-cyan-50 file:text-cyan-800":"border-white/10 bg-black/30 text-zinc-300 file:bg-cyan-500/15 file:text-cyan-100")})]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-xl border px-3 py-2 ".concat("light"===ty?"border-slate-200 bg-slate-50":"border-white/10 bg-black/25"),children:[(0,s.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===ty?"text-slate-600":"text-zinc-400"),children:ng("保存模式","Save mode")}),["overlay","preserve"].map(e=>(0,s.jsx)("button",{onClick:()=>na(e),className:"rounded-md px-2.5 py-1 text-[11px] font-semibold transition ".concat(nr===e?"bg-cyan-500/20 text-cyan-100 ring-1 ring-cyan-400/30":"light"===ty?"bg-white text-slate-600 ring-1 ring-slate-200 hover:bg-slate-100":"bg-white/5 text-zinc-300 ring-1 ring-white/10 hover:bg-white/10"),children:"overlay"===e?ng("组网不接管默认路由","Overlay only"):ng("保留原路由","Preserve routes")},e)),(0,s.jsx)("button",{onClick:()=>ni(e=>!e),className:"ml-auto inline-flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs font-semibold ring-1 transition ".concat("light"===ty?"bg-white text-slate-700 ring-slate-200 hover:bg-slate-50":"bg-white/5 text-zinc-100 ring-white/10 hover:bg-white/10"),children:nl?ng("锁定","Lock"):ng("编辑","Edit")}),(0,s.jsxs)("button",{onClick:()=>void nU(!1),disabled:"wg:save"===tM,className:"inline-flex items-center gap-2 rounded-lg bg-cyan-500/20 px-3 py-1.5 text-xs font-semibold text-cyan-100 ring-1 ring-cyan-400/30 transition hover:bg-cyan-500/30 disabled:opacity-40",children:["wg:save"===tM?(0,s.jsx)(v.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(S.Z,{className:"h-3.5 w-3.5"}),ng("保存","Save")]}),(0,s.jsxs)("button",{onClick:()=>void nU(!0),disabled:"wg:apply"===tM,className:"inline-flex items-center gap-2 rounded-lg bg-emerald-500/15 px-3 py-1.5 text-xs font-semibold text-emerald-100 ring-1 ring-emerald-400/25 transition hover:bg-emerald-500/25 disabled:opacity-40",children:["wg:apply"===tM?(0,s.jsx)(v.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(o.Z,{className:"h-3.5 w-3.5"}),ng("保存并应用","Save & apply")]})]}),(0,s.jsx)("textarea",{value:t9,onChange:e=>t7(e.target.value),readOnly:!nl,spellCheck:!1,placeholder:"[Interface] Address = 10.88.0.6/32 PrivateKey = ... [Peer] Endpoint = 129.204.21.129:51820 AllowedIPs = 10.88.0.0/24",className:"min-h-56 w-full resize-y rounded-xl border p-3 font-mono text-xs leading-relaxed outline-none ".concat("light"===ty?"border-slate-200 bg-slate-50 text-slate-900 focus:border-cyan-400":"border-white/10 bg-black/40 text-zinc-100 focus:border-cyan-400/60"," ").concat(nl?"":"opacity-75")}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)("button",{onClick:()=>void nE(),disabled:"wg:save"===tM,className:"inline-flex items-center gap-2 rounded-lg bg-cyan-500/20 px-3 py-2 text-xs font-semibold text-cyan-100 ring-1 ring-cyan-400/30 transition hover:bg-cyan-500/30 disabled:opacity-40",children:["wg:save"===tM?(0,s.jsx)(v.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(S.Z,{className:"h-3.5 w-3.5"}),ng("解析并保存","Parse & save")]}),(null==ne?void 0:ne.redacted_config)?(0,s.jsxs)("button",{onClick:()=>nK(ne.redacted_config||""),className:"inline-flex items-center gap-2 rounded-lg bg-zinc-500/15 px-3 py-2 text-xs font-semibold text-zinc-100 ring-1 ring-white/10 transition hover:bg-zinc-500/25",children:[(0,s.jsx)(_.Z,{className:"h-3.5 w-3.5"}),ng("复制脱敏配置","Copy redacted")]}):null]})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===ty?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("p",{className:"text-xs font-semibold ".concat("light"===ty?"text-slate-900":"text-white"),children:ng("解析结果","Parsed config")}),(0,s.jsxs)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat("light"===ty?"bg-cyan-100 text-cyan-800":"bg-cyan-500/15 text-cyan-200"),children:[null!==(tp=null==ne?void 0:ne.peer_count)&&void 0!==tp?tp:0," peers"]})]}),(0,s.jsxs)("div",{className:"mt-3 space-y-2 font-mono text-[11px] ".concat("light"===ty?"text-slate-700":"text-zinc-300"),children:[(0,s.jsxs)("p",{children:["Address: ",((null==ne?void 0:null===(eW=ne.interface)||void 0===eW?void 0:eW.addresses)||[]).join(", ")||"—"]}),(0,s.jsxs)("p",{children:["Endpoint: ",(null==ne?void 0:null===(eY=ne.peers)||void 0===eY?void 0:null===(eF=eY[0])||void 0===eF?void 0:eF.endpoint)||"—"]}),(0,s.jsxs)("p",{children:["AllowedIPs: ",((null==ne?void 0:null===(eq=ne.peers)||void 0===eq?void 0:null===(eG=eq[0])||void 0===eG?void 0:eG.allowed_ips)||[]).join(", ")||"—"]}),(0,s.jsxs)("p",{children:["MTU: ",null!==(tb=null==ne?void 0:null===(eJ=ne.interface)||void 0===eJ?void 0:eJ.mtu)&&void 0!==tb?tb:"—"]})]}),(null==ne?void 0:null===(eV=ne.warnings)||void 0===eV?void 0:eV.length)?(0,s.jsx)("ul",{className:"mt-3 space-y-1 text-[11px] ".concat("light"===ty?"text-amber-700":"text-amber-200"),children:ne.warnings.map(e=>(0,s.jsx)("li",{children:e},e))}):null]}),(0,s.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===ty?"border-slate-200 bg-white":"border-white/10 bg-black/30"),children:[(0,s.jsx)("p",{className:"text-xs font-semibold ".concat("light"===ty?"text-slate-900":"text-white"),children:ng("已保存配置","Saved configs")}),(0,s.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:((null==nn?void 0:nn.repo_configs)||[]).length?((null==nn?void 0:nn.repo_configs)||[]).map(e=>(0,s.jsx)("button",{onClick:()=>void nI(e.name),className:"rounded-lg px-3 py-1.5 text-[11px] font-semibold ring-1 transition ".concat("light"===ty?"bg-slate-50 text-slate-700 ring-slate-200 hover:bg-slate-100":"bg-white/5 text-zinc-200 ring-white/10 hover:bg-white/10"),children:e.name||e.relative_path},e.name||e.relative_path||"wireguard-config")):(0,s.jsx)("span",{className:"text-[11px] ".concat("light"===ty?"text-slate-500":"text-zinc-500"),children:ng("暂无受管配置","No managed configs")})})]}),(0,s.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===ty?"border-slate-200 bg-white":"border-white/10 bg-black/30"),children:[(0,s.jsxs)("p",{className:"flex items-center gap-2 text-xs font-semibold ".concat("light"===ty?"text-slate-900":"text-white"),children:[(0,s.jsx)(C.Z,{className:"h-3.5 w-3.5"}),ng("Windows 端点路由","Windows endpoint route")]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-2 lg:grid-cols-1",children:[(0,s.jsx)("input",{value:no,onChange:e=>nc(e.target.value),placeholder:ng("网关,如 192.168.2.1","Gateway, e.g. 192.168.2.1"),className:"rounded-lg border px-3 py-2 text-xs outline-none ".concat("light"===ty?"border-slate-200 bg-slate-50 text-slate-900":"border-white/10 bg-black/35 text-zinc-100")}),(0,s.jsx)("input",{value:nd,onChange:e=>nx(e.target.value),placeholder:ng("接口 ifIndex,如 21","Interface ifIndex, e.g. 21"),className:"rounded-lg border px-3 py-2 text-xs outline-none ".concat("light"===ty?"border-slate-200 bg-slate-50 text-slate-900":"border-white/10 bg-black/35 text-zinc-100")})]}),(0,s.jsx)("code",{className:"mt-3 block break-all rounded-lg border p-3 text-[11px] ".concat("light"===ty?"border-slate-200 bg-slate-50 text-slate-800":"border-white/10 bg-black/40 text-zinc-200"),children:nM||"route -p add <endpoint> mask 255.255.255.255 <gateway> metric 1 if <ifIndex>"}),(0,s.jsxs)("button",{onClick:()=>nK(nM),disabled:!nM,className:"mt-3 inline-flex items-center gap-2 rounded-lg bg-emerald-500/15 px-3 py-2 text-xs font-semibold text-emerald-100 ring-1 ring-emerald-400/25 transition hover:bg-emerald-500/25 disabled:opacity-40",children:[(0,s.jsx)(_.Z,{className:"h-3.5 w-3.5"}),ng("复制命令","Copy command")]})]})]})]})]}),(0,s.jsxs)("div",{className:"rounded-2xl border p-6 ".concat("light"===ty?"border-violet-200/90 bg-gradient-to-br from-violet-50 via-white to-fuchsia-50/80":"border-violet-500/25 bg-gradient-to-br from-violet-500/10 via-zinc-950/40 to-fuchsia-500/5"),children:[(0,s.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===ty?"text-slate-900":"text-white"),children:[(0,s.jsx)(k.Z,{className:"h-4 w-4 ".concat("light"===ty?"text-violet-600":"text-violet-300")}),ng("ShellCrash 网络面板","ShellCrash panel")]}),(0,s.jsx)("p",{className:"mt-2 text-xs ".concat("light"===ty?"text-slate-600":"text-zinc-400"),children:ng("透明代理与规则分流直接在本页完成,无需跳转;流媒体与其它系统服务请在「服务」页管理。","Proxy rules and YAML editing are embedded here. Use Services for SRS/Neko/Chromium, etc.")}),(0,s.jsx)("div",{className:"mt-6 flex flex-col items-center gap-4 sm:flex-row sm:justify-center",children:[{tx:ng("互联网","Internet"),c:"from-cyan-400 to-blue-500"},{tx:"ShellCrash",c:"from-violet-500 to-fuchsia-500"},{tx:ng("本机 / 安卓","Host / Android"),c:"from-emerald-400 to-teal-500"}].map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)("div",{className:"flex h-16 w-28 items-center justify-center rounded-2xl bg-gradient-to-br ".concat(e.c," text-xs font-bold text-white shadow-lg"),children:e.tx}),t<2?(0,s.jsx)(h.Z,{className:"hidden h-5 w-5 sm:block ".concat("light"===ty?"text-slate-400":"text-zinc-600")}):null]},e.tx))})]}),(0,s.jsx)("div",{className:"overflow-hidden rounded-2xl border shadow-xl ".concat("light"===ty?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:(0,s.jsx)("div",{className:"max-h-[min(78vh,56rem)] min-h-[22rem] overflow-y-auto overflow-x-hidden",children:(0,s.jsx)(U.d,{embeddedShellCrash:!0,portalLang:tf})})})]}):null,"settings"===tj?(0,s.jsxs)("div",{className:"mx-auto max-w-lg space-y-6",children:[(0,s.jsx)("p",{className:"text-sm ".concat("light"===ty?"text-slate-600":"text-zinc-400"),children:ng("常用选项(本机偏好);完整文件与 JSON 编辑见下方链接。","Local preferences; full file/JSON editor via the link below.")}),(0,s.jsxs)("div",{className:"space-y-4 rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,s.jsxs)("label",{className:"flex cursor-pointer items-center justify-between gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-white",children:ng("总览自动刷新","Auto-refresh dashboard")}),(0,s.jsx)("p",{className:"text-[11px] text-zinc-500",children:"10s"})]}),(0,s.jsx)("input",{type:"checkbox",className:"h-5 w-5 accent-violet-500",checked:t5,onChange:e=>{let t=e.target.checked;t2(t);try{localStorage.setItem("livehub.autorefresh",t?"1":"0")}catch(e){}nf(t?ng("已开启刷新","Auto refresh on"):ng("已暂停刷新","Paused"))}})]}),(0,s.jsxs)("label",{className:"flex cursor-pointer items-center justify-between gap-4 border-t border-white/[0.06] pt-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-white",children:ng("总览显示 SRS / Neko 探针","Show SRS/Neko probes")}),(0,s.jsx)("p",{className:"text-[11px] text-zinc-500",children:ng("关闭可精简首页","Hide stream probe cards")})]}),(0,s.jsx)("input",{type:"checkbox",className:"h-5 w-5 accent-violet-500",checked:t3,onChange:e=>{let t=e.target.checked;t4(t);try{localStorage.setItem("livehub.showStreamProbes",t?"1":"0")}catch(e){}}})]})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/40 p-5",children:[(0,s.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-500",children:ng("配置快照","Config snapshot")}),(0,s.jsx)("p",{className:"mt-2 font-mono text-[11px] text-zinc-400",children:String((null==t$?void 0:t$.config_root)||"—")}),(0,s.jsxs)("p",{className:"mt-3 text-sm text-zinc-300",children:[ng("主机名","Hostname"),":"," ",(0,s.jsx)("span",{className:"font-mono text-violet-200",children:(()=>{var e,t,n;let s=null==t$?void 0:t$.system;return(null==s?void 0:null===(t=s.identity)||void 0===t?void 0:null===(e=t.hostname_alias)||void 0===e?void 0:e.trim())||((null==tS?void 0:null===(n=tS.stack)||void 0===n?void 0:n.mdns_host)||"").replace(/\.local$/i,"")||"—"})()})]}),(0,s.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:null==t$?void 0:null===(eX=t$.services)||void 0===eX?void 0:eX.slice(0,8).map(e=>(0,s.jsxs)("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-medium ".concat(e.enabled?"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-500/25":"bg-zinc-500/15 text-zinc-400"),children:[e.id," ",e.enabled?"ON":"off"]},e.id))})]}),(0,s.jsxs)("a",{href:"/console?tab=config",className:"inline-flex w-full items-center justify-center gap-2 rounded-xl border py-3 text-sm transition ".concat("light"===ty?"border-slate-200 bg-slate-50 text-violet-700 hover:bg-slate-100":"border-white/10 bg-white/[0.05] text-violet-200 hover:bg-white/[0.08]"),children:[ng("完整配置中心(文件 / JSON)","Full config center (files / JSON)"),(0,s.jsx)(R.Z,{className:"h-4 w-4"})]})]}):null]},tj)})})]})]}),(0,s.jsx)(i.M,{children:tk?(0,s.jsx)(l.E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm lg:hidden",onClick:()=>tz(!1),children:(0,s.jsxs)(l.E.aside,{initial:{x:-280},animate:{x:0},exit:{x:-280},transition:{type:"spring",damping:28,stiffness:320},className:"absolute left-0 top-0 h-full w-[min(88vw,280px)] border-r border-white/10 bg-zinc-950 p-4 shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("div",{className:"flex justify-end",children:(0,s.jsx)("button",{type:"button",onClick:()=>tz(!1),className:"rounded-lg p-2",children:(0,s.jsx)(P.Z,{className:"h-5 w-5"})})}),(0,s.jsx)("nav",{className:"mt-4 flex flex-col gap-1",children:nB.map(e=>{let t=e.icon,n=tj===e.id;return(0,s.jsxs)("button",{type:"button",onClick:()=>{tN(e.id),tz(!1)},"aria-current":n?"page":void 0,className:"flex items-center gap-3 rounded-xl px-3 py-3 text-left text-sm transition ".concat(n?"bg-white/[0.08] text-white shadow-inner shadow-white/5":"text-zinc-300 hover:bg-white/[0.04]"),children:[(0,s.jsx)(t,{className:"h-4 w-4 ".concat(n?"text-violet-300":"text-violet-400")}),ng(e.labelZh,e.labelEn)]},e.id)})})]})}):null})]})}}},function(e){e.O(0,[500,787,246,971,117,744],function(){return e(e.s=5052)}),_N_E=e.O()}]);