diff --git a/d2ypp2/douyin_youtube_ffplay.py b/d2ypp2/douyin_youtube_ffplay.py index cb4b65d..006112e 100644 --- a/d2ypp2/douyin_youtube_ffplay.py +++ b/d2ypp2/douyin_youtube_ffplay.py @@ -41,6 +41,22 @@ def _youtube_bitrate_triplet(kbps: int) -> tuple[str, str, str]: return f"{n}k", f"{n}k", f"{n * 2}k" +def _load_simple_env_file(path: str) -> dict[str, str]: + out: dict[str, str] = {} + if not os.path.isfile(path): + return out + with open(path, "r", encoding="utf-8-sig", errors="ignore") as fh: + for line in fh: + line = line.strip() + if not line or line.startswith("#") or "=" not in line: + continue + k, _, v = line.partition("=") + key = k.strip() + if key.startswith("#"): + continue + out[key] = v.strip().strip('"').strip("'") + return out + def _ffmpeg_stats_period_seconds(default: int = 5) -> str: raw = os.environ.get("LIVE_FFMPEG_STATS_PERIOD") or os.environ.get("YOUTUBE_FFMPEG_STATS_PERIOD") or str(default) try: @@ -324,6 +340,10 @@ def _ffmpeg_env_with_push_proxy( use_proxychains: bool = False, ) -> dict[str, str]: env = os.environ.copy() + pm2 = _live_pm2_name() + if pm2: + env["LIVE_PM2_PROCESS_NAME"] = pm2 + env["PM2_SERVICE_NAME"] = pm2 for key in _PROXY_ENV_KEYS: env.pop(key, None) @@ -375,6 +395,36 @@ def _proxychains_proxy_line(push_proxy: str) -> str | None: return " ".join(parts) +def _looks_like_youtube_output_rejected(line_lower: str) -> bool: + if not any( + marker in line_lower + for marker in ( + "rtmps://a.rtmps.youtube.com/live2/", + "rtmp://a.rtmp.youtube.com/live2/", + "youtube.com/live2/", + ) + ): + return False + if not any( + marker in line_lower + for marker in ("error opening output", "error opening output file", "error opening output files") + ): + return False + return any( + marker in line_lower + for marker in ( + "input/output error", + "io error: end of file", + "error in the pull function", + "tls @", + "401", + "403", + "unauthorized", + "forbidden", + ) + ) + + def _proxychains_config_for_push(push_proxy: str) -> str | None: explicit = ( os.environ.get("YOUTUBE_PROXYCHAINS_CONF") @@ -552,6 +602,7 @@ def start_douyin_youtube_ffplay( # ====================== 读取 YouTube 配置 ====================== config_file = _resolve_youtube_push_config_file(config_file) + _config_dir = os.path.dirname(os.path.abspath(config_file)) rtmps_base = os.environ.get("YOUTUBE_RTMPS_BASE", "rtmps://a.rtmps.youtube.com/live2/") rtmp_base = os.environ.get("YOUTUBE_RTMP_BASE", "rtmp://a.rtmp.youtube.com/live2/") use_rtmps = True @@ -612,6 +663,11 @@ def start_douyin_youtube_ffplay( print(f"[WARN] {ffmpeg_note}") if ffmpeg_bin != "ffmpeg": print(f"[INFO] YouTube push ffmpeg: {ffmpeg_bin}") + if not _ffmpeg_supports_stats_period(ffmpeg_bin): + print( + f"[WARN] {_ffmpeg_display_name(ffmpeg_bin)} 不支持 -stats_period;" + "建议执行 scripts/linux/upgrade_ffmpeg_newer.sh 以获得稳定 speed 指标" + ) MAX_RETRY_DELAY = 90 INITIAL_RETRY_DELAY = 3 @@ -629,6 +685,9 @@ def start_douyin_youtube_ffplay( "access denied", "server returned 403", "client disconnected", + "error opening output file", + "error opening output files", + "error opening output", ] # 瞬时错误:结束当前 ffmpeg 进程后由外层循环退避重连 TRANSIENT_KEYWORDS = [ @@ -658,30 +717,13 @@ def start_douyin_youtube_ffplay( print(f"[INFO] {rec_info} 开始推流到 YouTube: {stream_title}") # ====================== 视频编码:hardware.env(ARM)→ NVENC → libx264 ====================== - def _load_simple_env(path: str) -> dict[str, str]: - out: dict[str, str] = {} - if not os.path.isfile(path): - return out - with open(path, "r", encoding="utf-8-sig", errors="ignore") as fh: - for line in fh: - line = line.strip() - if not line or line.startswith("#") or "=" not in line: - continue - k, _, v = line.partition("=") - key = k.strip() - if key.startswith("#"): - continue - out[key] = v.strip().strip('"').strip("'") - return out - + _hw_env = _load_simple_env_file(os.path.join(_config_dir, "hardware.env")) codec_v = "libx264" video_args = [ "-preset", "ultrafast", "-tune", "zerolatency", "-profile:v", "high", "-level", "4.0", "-b:v", b_v, "-minrate", b_v, "-maxrate", maxrate, "-bufsize", bufsize, ] - _config_dir = os.path.dirname(os.path.abspath(config_file)) - _hw_env = _load_simple_env(os.path.join(_config_dir, "hardware.env")) _want_enc = (_hw_env.get("LIVE_VIDEO_ENCODER") or "").strip() _hw_enc_active = False _encoders_blob = "" @@ -924,14 +966,14 @@ def start_douyin_youtube_ffplay( proc = None stderr_q = None reader_t = None - retry_delay = INITIAL_RETRY_DELAY + retry_delay = 0 try: while True: try: - if retry_delay > INITIAL_RETRY_DELAY: + if retry_delay > 0: print(f"[WARN] 防风控等待 {retry_delay}s 后重新连接抖音源...") - time.sleep(retry_delay) + time.sleep(retry_delay) cleanup_proc(proc) stderr_q = queue.Queue() @@ -999,7 +1041,7 @@ def start_douyin_youtube_ffplay( if is_progress_line: last_ffmpeg_log_time = now_ts - if any(kw in line_lower for kw in TERMINAL_KEYWORDS): + if any(kw in line_lower for kw in TERMINAL_KEYWORDS) or _looks_like_youtube_output_rejected(line_lower): print("[ERROR] 判定直播结束或平台明确拒绝,停止推流") cleanup_proc(proc) raise StreamEnded() @@ -1016,7 +1058,7 @@ def start_douyin_youtube_ffplay( time_advanced = media_time is not None and media_time > last_progress_time + 0.01 if frame_advanced or time_advanced: last_frame_time = time.time() - retry_delay = INITIAL_RETRY_DELAY + retry_delay = 0 if frame is not None: last_progress_frame = frame if media_time is not None: diff --git a/d2ypp2/src/douyin_source_display.py b/d2ypp2/src/douyin_source_display.py index 8d91795..2ea4b89 100644 --- a/d2ypp2/src/douyin_source_display.py +++ b/d2ypp2/src/douyin_source_display.py @@ -72,6 +72,27 @@ def _source_title_from_url_lines(url_lines: str) -> str: return "" +def _log_indicates_active_relay(recent_log: str) -> bool: + text = (recent_log or "").lower() + if "frame=" in text and "speed=" in text: + return True + return bool(_RECORDING_TITLE_RE.search(recent_log or "")) or bool(_LIVE_TITLE_RE.search(recent_log or "")) + + +def _title_from_waiting_log_only(recent_log: str) -> str: + lines = [line.strip() for line in (recent_log or "").splitlines() if line.strip()] + for line in reversed(lines[-240:]): + if _ERROR_CONTEXT_RE.search(line): + continue + match = _WAIT_TITLE_RE.search(line) or _STATUS_TITLE_RE.search(line) + if not match: + continue + title = _clean_source_title(match.group(1)) + if title: + return title + return "" + + def _source_title_from_log(recent_log: str) -> str: lines = [line.strip() for line in (recent_log or "").splitlines() if line.strip()] tail = lines[-240:] @@ -175,6 +196,19 @@ def extract_douyin_source_meta(url_lines: str = "", recent_log: str = "") -> dic source_url = "" title = "" + if ( + len(entries) > 1 + and title + and not _log_indicates_active_relay(recent_log) + and title == _title_from_waiting_log_only(recent_log) + ): + pinned = entries[0] + room_id = pinned["room_id"] + source_url = pinned["source_url"] + title = pinned.get("source_title", "") or title + source_ambiguous = True + source_current = False + display = title or (f"抖音直播间 {room_id}" if room_id else "") return { "source_title": title, diff --git a/d2ypp2/src/process_runtime_status.py b/d2ypp2/src/process_runtime_status.py index df14d8c..034383e 100644 --- a/d2ypp2/src/process_runtime_status.py +++ b/d2ypp2/src/process_runtime_status.py @@ -199,5 +199,6 @@ def summarize_process_activity( "ffmpeg_speed": latest_progress.get("speed"), "ffmpeg_progress_stalled": progress_stalled, "ffmpeg_speed_low": speed_low, - "is_pushing": business_status in {"streaming", "relay_slow"}, + "is_pushing": business_status in {"streaming", "relay_slow"} + or (business_status == "source_stalled" and bool(pids)), } diff --git a/d2ypp2/src/recorder_config.py b/d2ypp2/src/recorder_config.py new file mode 100644 index 0000000..90db123 --- /dev/null +++ b/d2ypp2/src/recorder_config.py @@ -0,0 +1,80 @@ +from __future__ import annotations + +import configparser +from pathlib import Path +from typing import Any + +SHARED_RECORDER_SECTIONS = frozenset( + {"Cookie", "录制设置", "推送配置", "Authorization", "账号密码"} +) + + +def _read_ini_tolerant(path: Path, encoding: str) -> configparser.RawConfigParser: + """Parse ini files even when duplicate keys exist (keep first occurrence).""" + parser = configparser.RawConfigParser() + if not path.is_file(): + return parser + section: str | None = None + seen: dict[str, set[str]] = {} + for raw_line in path.read_text(encoding=encoding, errors="ignore").splitlines(): + line = raw_line.strip() + if not line or line.startswith("#") or line.startswith(";"): + continue + if line.startswith("[") and line.endswith("]"): + section = line[1:-1].strip() + seen.setdefault(section, set()) + continue + if section is None or "=" not in line: + continue + key, _, value = line.partition("=") + key = key.strip() + if key in seen[section]: + continue + seen[section].add(key) + if not parser.has_section(section): + parser.add_section(section) + parser.set(section, key, value.strip()) + return parser + + +def shared_recorder_config_path(base_dir: str | Path) -> Path: + return Path(base_dir) / "config" / "config.ini" + + +def read_recorder_setting( + *, + base_dir: str | Path, + lane_config_file: str | Path, + section: str, + option: str, + default: Any = "", + encoding: str = "utf-8-sig", +) -> Any: + """Read recorder settings from lane config, then fall back to shared config.ini.""" + lane_path = Path(lane_config_file) + lane_parser = configparser.RawConfigParser() + if lane_path.is_file(): + lane_parser = _read_ini_tolerant(lane_path, encoding) + if lane_parser.has_section(section) and lane_parser.has_option(section, option): + value = lane_parser.get(section, option) + if str(value).strip(): + return value + + shared_path = shared_recorder_config_path(base_dir) + if shared_path.is_file() and shared_path.resolve() != lane_path.resolve(): + shared_parser = _read_ini_tolerant(shared_path, encoding) + if shared_parser.has_section(section) and shared_parser.has_option(section, option): + return shared_parser.get(section, option) + return default + + +def recorder_config_target_path( + *, + base_dir: str | Path, + lane_config_file: str | Path, + section: str, +) -> Path: + """Lane files own [youtube]; shared/global sections belong in config.ini.""" + if section in SHARED_RECORDER_SECTIONS: + return shared_recorder_config_path(base_dir) + return Path(lane_config_file) diff --git a/d2ypp2/src/spider.py b/d2ypp2/src/spider.py index 3d9ca9f..004dadc 100644 --- a/d2ypp2/src/spider.py +++ b/d2ypp2/src/spider.py @@ -19,7 +19,7 @@ import uuid from operator import itemgetter import urllib.parse import urllib.error -from typing import List, Optional, Union +from typing import Any, List, Optional, Union import httpx import ssl import re @@ -67,7 +67,18 @@ async def get_play_url_list(m3u8: str, proxy: OptionalStr = None, header: Option return play_url_list -async def get_douyin_web_stream_data(url: str, proxy_addr: OptionalStr = None, cookies: OptionalStr = None): +_PARSE_WEB = "web" +_PARSE_HTML = "html" +_PARSE_APP = "app" + + +async def get_douyin_web_stream_data( + url: str, + proxy_addr: OptionalStr = None, + cookies: OptionalStr = None, + *, + _tried: frozenset[str] = frozenset(), +): headers = { 'cookie': 'ttwid=1%7C2iDIYVmjzMcpZ20fcaFde0VghXAA3NaNXE_SLR68IyE%7C1761045455' '%7Cab35197d5cfb21df6cbb2fa7ef1c9262206b062c315b9d04da746d0b37dfbc7d', @@ -78,6 +89,7 @@ async def get_douyin_web_stream_data(url: str, proxy_addr: OptionalStr = None, c if cookies: headers['cookie'] = cookies + room_data: dict[str, Any] = {'anchor_name': ""} try: web_rid = url.split('?')[0].split('live.douyin.com/')[-1] params = { @@ -138,13 +150,27 @@ async def get_douyin_web_stream_data(url: str, proxy_addr: OptionalStr = None, c room_data['stream_url']['hls_pull_url_map'] = {**origin_m3u8, **hls_pull_url_map} room_data['stream_url']['flv_pull_url'] = {**origin_flv, **flv_pull_url} except Exception as e: + print(f"Douyin web API failed for {url}, trying HTML parser: {e}") + if _PARSE_HTML not in _tried: + return await get_douyin_stream_data( + url=url, + proxy_addr=proxy_addr, + cookies=cookies, + _tried=_tried | {_PARSE_WEB}, + ) print(f"Error message: {e} Error line: {e.__traceback__.tb_lineno}") room_data = {'anchor_name': ""} return room_data @trace_error_decorator -async def get_douyin_app_stream_data(url: str, proxy_addr: OptionalStr = None, cookies: OptionalStr = None) -> dict: +async def get_douyin_app_stream_data( + url: str, + proxy_addr: OptionalStr = None, + cookies: OptionalStr = None, + *, + _tried: frozenset[str] = frozenset(), +) -> dict: headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0', @@ -184,7 +210,18 @@ async def get_douyin_app_stream_data(url: str, proxy_addr: OptionalStr = None, c try: web_rid = url.split('?')[0].split('live.douyin.com/') if len(web_rid) > 1: - return await get_douyin_web_stream_data(url, proxy_addr, cookies) + if _PARSE_WEB not in _tried: + return await get_douyin_web_stream_data( + url, proxy_addr, cookies, _tried=_tried | {_PARSE_APP} + ) + if _PARSE_HTML not in _tried: + return await get_douyin_stream_data( + url=url, + proxy_addr=proxy_addr, + cookies=cookies, + _tried=_tried | {_PARSE_APP}, + ) + return {'anchor_name': ""} else: try: data = await get_sec_user_id(url, proxy_addr=proxy_addr) @@ -229,7 +266,13 @@ async def get_douyin_app_stream_data(url: str, proxy_addr: OptionalStr = None, c @trace_error_decorator -async def get_douyin_stream_data(url: str, proxy_addr: OptionalStr = None, cookies: OptionalStr = None) -> dict: +async def get_douyin_stream_data( + url: str, + proxy_addr: OptionalStr = None, + cookies: OptionalStr = None, + *, + _tried: frozenset[str] = frozenset(), +) -> dict: headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0', 'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2', @@ -245,10 +288,18 @@ async def get_douyin_stream_data(url: str, proxy_addr: OptionalStr = None, cooki match_json_str = re.search(r'(\{\\"state\\":.*?)]\\n"]\)', html_str) if not match_json_str: match_json_str = re.search(r'(\{\\"common\\":.*?)]\\n"]\)
lis str(config_dir / f"URL_config.{safe}.ini"), } ) + ini_path = config_dir / f"youtube.{safe}.ini" + if ini_path.is_file(): + try: + text = ini_path.read_text(encoding="utf-8", errors="replace") + except OSError: + text = "" + for line in text.splitlines(): + match = re.match(r"^\s*key\s*=\s*(.+)$", line, flags=re.IGNORECASE) + if not match: + continue + value = match.group(1).strip().split("#", 1)[0].strip() + if not value: + continue + if "live2/" in value: + stream_key = value.rsplit("live2/", 1)[-1].strip("/") + else: + stream_key = value + if stream_key: + markers.add(stream_key) + markers.add(f"live2/{stream_key}") + break return [m for m in markers if m] @@ -414,6 +435,7 @@ class LocalProcessRegistry: "process_status": status, "out_path": out_path, "err_path": err_path, + "pid": pid if status == "online" else 0, } def status_table_text(self) -> str: @@ -974,7 +996,17 @@ class WebProcessBackend: names.append(name) if not self._use_pm2: - return {name: self._local.describe_status(name) for name in names} + runtime = await self._proc_runtime_items() + out: dict[str, dict[str, Any]] = {} + for name in names: + info = self._local.describe_status(name) + runtime_info = runtime.get(name) + if runtime_info: + info = dict(info) + info["process_status"] = "online" + info["pid"] = int(runtime_info.get("pid") or info.get("pid") or 0) + out[name] = info + return out jlist = await self._pm2_jlist_index() runtime = await self._proc_runtime_items() @@ -1054,6 +1086,8 @@ class WebProcessBackend: if cached and now - cached[0] <= self._ffmpeg_pid_cache_ttl: return list(cached[1]) result = await asyncio.to_thread(_linux_ffmpeg_pids_for_process_tree, pid, root_pgid=pgid) + if not result: + result = await asyncio.to_thread(_linux_ffmpeg_pids_for_stack, process, self.base_dir) self._ffmpeg_pid_cache[cache_key] = (now, list(result)) return result diff --git a/d2ypp2/src/youtube_quality_guard.py b/d2ypp2/src/youtube_quality_guard.py index 02820ab..0d3777f 100644 --- a/d2ypp2/src/youtube_quality_guard.py +++ b/d2ypp2/src/youtube_quality_guard.py @@ -28,22 +28,61 @@ def _as_int(value: Any) -> int | None: return None if parsed is None else max(0, int(parsed)) +_IDLE_MARKERS = ( + "等待直播", + "waiting", + "获取失败", + "douyin web api failed", + "无录制任务", + "网址内容获取失败", + "没有正在监测的直播", +) + + +def _line_implies_relay_idle(line: str) -> bool: + lower = line.lower() + if "frame=" in lower and "speed=" in lower: + return False + return any(marker in lower for marker in _IDLE_MARKERS) or "error" in lower or "failed" in lower + + +def _latest_ffmpeg_stats_line(text: str, *, lookback: int = 12) -> str: + lines = [line.strip() for line in str(text or "").splitlines() if line.strip()] + if not lines: + return "" + tail = lines[-lookback:] + stats_idx = -1 + stats_line = "" + for idx in range(len(tail) - 1, -1, -1): + line = tail[idx] + lower = line.lower() + if "frame=" in lower and "speed=" in lower: + stats_idx = idx + stats_line = line + break + if stats_idx < 0: + return "" + if any(_line_implies_relay_idle(line) for line in tail[stats_idx + 1 :]): + return "" + return stats_line + + def parse_ffmpeg_metrics(*texts: str) -> dict[str, Any]: raw = "\n".join(str(item or "") for item in texts) tail = raw[-16000:] metrics: dict[str, Any] = {} - for match in _FFMPEG_KV_RE.finditer(tail): - key = match.group("key").lower() - value = match.group("value") - if key in {"frame", "drop", "dup"}: - metrics[key] = _as_int(value) - elif key in {"fps", "speed", "bitrate"}: - metrics[key] = _as_float(value) - time_match = None - for time_match in _TIME_RE.finditer(tail): - pass - if time_match: - metrics["encoded_time"] = time_match.group("value") + stats_line = _latest_ffmpeg_stats_line(tail) + if stats_line: + for match in _FFMPEG_KV_RE.finditer(stats_line): + key = match.group("key").lower() + value = match.group("value") + if key in {"frame", "drop", "dup"}: + metrics[key] = _as_int(value) + elif key in {"fps", "speed", "bitrate"}: + metrics[key] = _as_float(value) + time_match = _TIME_RE.search(stats_line) + if time_match: + metrics["encoded_time"] = time_match.group("value") lower = tail.lower() metrics["error_count"] = sum( lower.count(token) @@ -201,7 +240,7 @@ def build_youtube_quality_guard_report( "lanes": lanes, "recommendations": recommendations[:10], "ffmpeg_profile": { - "target": "1080p30/RTMPS/AAC/stable input copy when possible", + "target": "720p30 H.264 CBR / RTMPS / AAC 128k / hardware encoder when available", "guardrails": [ "保持 FFmpeg speed 接近 1.00x", "长直播优先稳定码率与低错误率,而不是频繁重启", diff --git a/d2ypp2/src/youtube_runtime.py b/d2ypp2/src/youtube_runtime.py index 901ab36..703d520 100644 --- a/d2ypp2/src/youtube_runtime.py +++ b/d2ypp2/src/youtube_runtime.py @@ -10,12 +10,12 @@ def normalize_youtube_video_save_type(raw_value: str, process_name: str) -> str: low_process = (process_name or "").strip().lower() force_youtube_push = low_process.startswith("youtube") or low_process.startswith("douyin_youtube") + if force_youtube_push: + return "YOUTUBE" if normalized in YOUTUBE_PUSH_SAVE_TYPES: return "YOUTUBE" if normalized in LOCAL_RECORD_SAVE_TYPES: return normalized - if force_youtube_push: - return "YOUTUBE" return "TS" diff --git a/d2ypp2/tests/test_douyin_source_display.py b/d2ypp2/tests/test_douyin_source_display.py index 5b93087..ceffb80 100644 --- a/d2ypp2/tests/test_douyin_source_display.py +++ b/d2ypp2/tests/test_douyin_source_display.py @@ -104,5 +104,27 @@ class DouyinSourceDisplayTests(unittest.TestCase): self.assertFalse(meta["source_current"]) + def test_pins_ambiguous_waiting_probe_title_to_first_configured_room(self) -> None: + meta = extract_douyin_source_meta( + "\n".join( + [ + "https://live.douyin.com/11111111, 主播: 第一个主播", + "https://live.douyin.com/22222222, 主播: 第二个主播", + ] + ), + "\n".join( + [ + "序号2 第二个主播 等待直播...", + "序号1 第一个主播 等待直播...", + ] + ), + ) + + self.assertEqual(meta["source_title"], "第一个主播") + self.assertEqual(meta["source_room_id"], "11111111") + self.assertTrue(meta["source_ambiguous"]) + self.assertFalse(meta["source_current"]) + + if __name__ == "__main__": unittest.main() diff --git a/d2ypp2/tests/test_ffmpeg_metrics.py b/d2ypp2/tests/test_ffmpeg_metrics.py new file mode 100644 index 0000000..98ff741 --- /dev/null +++ b/d2ypp2/tests/test_ffmpeg_metrics.py @@ -0,0 +1,40 @@ +from __future__ import annotations + +import unittest + +from src.youtube_quality_guard import parse_ffmpeg_metrics + + +class FfmpegMetricsFrontendParityTests(unittest.TestCase): + def test_uses_recent_stats_line_when_last_line_is_idle(self) -> None: + metrics = parse_ffmpeg_metrics( + "\n".join( + [ + "序号2 第二个主播 等待直播...", + "[FFmpeg] frame=9440 fps=30 bitrate=4186.4kbits/s speed=1.00x time=00:05:14.63", + ] + ) + ) + + self.assertEqual(metrics.get("fps"), 30.0) + self.assertEqual(metrics.get("speed"), 1.0) + self.assertEqual(metrics.get("bitrate"), 4186.4) + self.assertEqual(metrics.get("frame"), 9440) + + def test_ignores_stale_stats_after_waiting_lines(self) -> None: + metrics = parse_ffmpeg_metrics( + "\n".join( + [ + "[FFmpeg] frame=9440 fps=30 bitrate=4186.4kbits/s speed=1.00x time=00:05:14.63", + "序号2 第二个主播 等待直播...", + "Douyin web API failed for https://live.douyin.com/141410319583", + ] + ) + ) + + self.assertNotIn("bitrate", metrics) + self.assertNotIn("fps", metrics) + + +if __name__ == "__main__": + unittest.main() diff --git a/d2ypp2/tests/test_process_runtime_status.py b/d2ypp2/tests/test_process_runtime_status.py index abab40b..da922f6 100644 --- a/d2ypp2/tests/test_process_runtime_status.py +++ b/d2ypp2/tests/test_process_runtime_status.py @@ -128,7 +128,7 @@ class ProcessRuntimeStatusTests(unittest.TestCase): ffmpeg_pids=[1234], ) self.assertEqual(state["business_status"], "source_stalled") - self.assertFalse(state["is_pushing"]) + self.assertTrue(state["is_pushing"]) self.assertTrue(state["ffmpeg_progress_stalled"]) def test_summarize_process_activity_marks_relay_slow_when_speed_stays_low(self) -> None: diff --git a/d2ypp2/tests/test_recorder_config.py b/d2ypp2/tests/test_recorder_config.py new file mode 100644 index 0000000..1d14961 --- /dev/null +++ b/d2ypp2/tests/test_recorder_config.py @@ -0,0 +1,56 @@ +from __future__ import annotations + +import configparser +import tempfile +import unittest +from pathlib import Path + +from src.recorder_config import read_recorder_setting + + +class RecorderConfigTests(unittest.TestCase): + def test_read_recorder_setting_falls_back_to_shared_cookie(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + config_dir = root / "config" + config_dir.mkdir() + shared = config_dir / "config.ini" + lane = config_dir / "youtube.youtube2__ch_test.ini" + shared.write_text( + "\ufeff[Cookie]\n抖音cookie = shared-cookie-value\n", + encoding="utf-8", + ) + lane.write_text( + "\ufeff[youtube]\nkey = test\n\n[Cookie]\n抖音cookie = \n", + encoding="utf-8", + ) + value = read_recorder_setting( + base_dir=root, + lane_config_file=lane, + section="Cookie", + option="抖音cookie", + default="", + ) + self.assertEqual(value, "shared-cookie-value") + + def test_lane_cookie_overrides_shared(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + config_dir = root / "config" + config_dir.mkdir() + shared = config_dir / "config.ini" + lane = config_dir / "youtube.youtube2__ch_test.ini" + shared.write_text("\ufeff[Cookie]\n抖音cookie = shared\n", encoding="utf-8") + lane.write_text("\ufeff[Cookie]\n抖音cookie = lane\n", encoding="utf-8") + value = read_recorder_setting( + base_dir=root, + lane_config_file=lane, + section="Cookie", + option="抖音cookie", + default="", + ) + self.assertEqual(value, "lane") + + +if __name__ == "__main__": + unittest.main() diff --git a/d2ypp2/tests/test_web_process_backend.py b/d2ypp2/tests/test_web_process_backend.py index d767373..5315a0c 100644 --- a/d2ypp2/tests/test_web_process_backend.py +++ b/d2ypp2/tests/test_web_process_backend.py @@ -8,6 +8,7 @@ from unittest.mock import AsyncMock, patch from src.web_process_backend import ( WebProcessBackend, + _ffmpeg_cmdline_markers, _ffmpeg_pid_matches_process, build_pm2_start_command, pm2_process_entry_needs_recreate, @@ -255,6 +256,32 @@ class WebProcessBackendTests(unittest.TestCase): self.assertEqual(text, "boom") set_desired.assert_not_awaited() + def test_local_process_infos_merges_runtime_scan_when_registry_missing_pid(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + base = Path(tmp) + backend = WebProcessBackend(base, base / ".pm2" / "logs") + backend._use_pm2 = False + backend.ensure_mode = AsyncMock() + with patch.object( + backend, + "_proc_runtime_items", + AsyncMock(return_value={"youtube2__lane1": {"pid": 5151}}), + ): + infos = asyncio.run(backend.process_infos(["youtube2__lane1"])) + self.assertEqual(infos["youtube2__lane1"]["process_status"], "online") + self.assertEqual(infos["youtube2__lane1"]["pid"], 5151) + + def test_local_describe_status_includes_pid_for_online_process(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + base = Path(tmp) + backend = WebProcessBackend(base, base / ".pm2" / "logs") + registry = backend._local + registry._write_state({"processes": {"youtube": {"pid": 4242, "script": "youtube.py"}}}) + with patch.object(registry, "_pid_alive", return_value=True): + info = registry.describe_status("youtube") + self.assertEqual(info["process_status"], "online") + self.assertEqual(info["pid"], 4242) + def test_live_ffmpeg_pids_uses_process_tree_of_target_process(self) -> None: with tempfile.TemporaryDirectory() as tmp: base_dir = Path(tmp) @@ -271,6 +298,39 @@ class WebProcessBackendTests(unittest.TestCase): self.assertEqual(pids, [9876]) finder.assert_called_once_with(4321, root_pgid=6789) + def test_live_ffmpeg_pids_falls_back_to_stack_markers_when_tree_empty(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + base_dir = Path(tmp) + backend = WebProcessBackend(base_dir, base_dir / ".pm2" / "logs") + backend.ensure_mode = AsyncMock() + backend.process_infos = AsyncMock( # type: ignore[method-assign] + return_value={"youtube2__lane1": {"pid": 4321, "process_status": "online"}} + ) + + with patch("src.web_process_backend.os.getpgid", return_value=6789): + with patch("src.web_process_backend._linux_ffmpeg_pids_for_process_tree", return_value=[]): + with patch( + "src.web_process_backend._linux_ffmpeg_pids_for_stack", + return_value=[5555], + ) as stack_finder: + pids = asyncio.run(backend.live_ffmpeg_pids("youtube2__lane1")) + + self.assertEqual(pids, [5555]) + stack_finder.assert_called_once_with("youtube2__lane1", base_dir) + + def test_ffmpeg_cmdline_markers_include_stream_key_suffix(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + base = Path(tmp) + ini = base / "config" / "youtube.youtube2__lane1.ini" + ini.parent.mkdir(parents=True, exist_ok=True) + ini.write_text( + "[youtube]\nkey = rtmps://a.rtmps.youtube.com/live2/test-stream-key\n", + encoding="utf-8", + ) + markers = _ffmpeg_cmdline_markers("youtube2__lane1", base) + self.assertIn("live2/test-stream-key", markers) + self.assertIn("test-stream-key", markers) + def test_ffmpeg_pid_matches_process_uses_exact_inherited_env_name(self) -> None: env_map = { "LIVE_PM2_PROCESS_NAME": "youtube2__lane1", diff --git a/d2ypp2/tests/test_youtube_push_config.py b/d2ypp2/tests/test_youtube_push_config.py index 5ab0a99..d3f12d0 100644 --- a/d2ypp2/tests/test_youtube_push_config.py +++ b/d2ypp2/tests/test_youtube_push_config.py @@ -85,7 +85,7 @@ class YoutubePushConfigTests(unittest.TestCase): self.assertEqual(parsed["stream_key"], "bom-key") self.assertEqual(parsed["b_v"], "5500k") - self.assertEqual(parsed["maxrate"], "6600k") + self.assertEqual(parsed["maxrate"], "5500k") self.assertEqual(parsed["bufsize"], "11000k") self.assertTrue(parsed["fast_audio"]) diff --git a/d2ypp2/tests/test_youtube_quality_guard.py b/d2ypp2/tests/test_youtube_quality_guard.py index 824b2b4..1fef08b 100644 --- a/d2ypp2/tests/test_youtube_quality_guard.py +++ b/d2ypp2/tests/test_youtube_quality_guard.py @@ -17,6 +17,19 @@ class YoutubeQualityGuardTests(unittest.TestCase): self.assertEqual(metrics["drop"], 1) self.assertEqual(metrics["encoded_time"], "00:00:40.00") + def test_parse_ffmpeg_metrics_ignores_stale_bitrate_before_waiting_lines(self) -> None: + metrics = parse_ffmpeg_metrics( + "\n".join( + [ + "[FFmpeg] frame=9440 fps=30 bitrate=4186.4kbits/s speed=1.00x time=00:05:14.63", + "序号2 第二个主播 等待直播...", + "Douyin web API failed for https://live.douyin.com/141410319583", + ] + ) + ) + self.assertNotIn("bitrate", metrics) + self.assertNotIn("speed", metrics) + def test_quality_report_flags_inactive_lane_and_missing_studio_samples(self) -> None: report = build_youtube_quality_guard_report( [ diff --git a/d2ypp2/tests/test_youtube_runtime.py b/d2ypp2/tests/test_youtube_runtime.py index 2dcd074..1cb75df 100644 --- a/d2ypp2/tests/test_youtube_runtime.py +++ b/d2ypp2/tests/test_youtube_runtime.py @@ -10,9 +10,9 @@ class YoutubeRuntimeTests(unittest.TestCase): self.assertEqual(normalize_youtube_video_save_type("ts", "youtube"), "YOUTUBE") self.assertEqual(normalize_youtube_video_save_type("", "youtube2__lane1"), "YOUTUBE") - def test_explicit_local_record_format_is_preserved(self) -> None: - self.assertEqual(normalize_youtube_video_save_type("mp4", "youtube"), "MP4") - self.assertEqual(normalize_youtube_video_save_type("mkv", "douyin_youtube"), "MKV") + def test_youtube_process_forces_push_even_with_local_format(self) -> None: + self.assertEqual(normalize_youtube_video_save_type("mp4", "youtube"), "YOUTUBE") + self.assertEqual(normalize_youtube_video_save_type("mkv", "douyin_youtube"), "YOUTUBE") def test_non_youtube_process_falls_back_to_ts(self) -> None: self.assertEqual(normalize_youtube_video_save_type("ts", "tiktok"), "TS") @@ -28,7 +28,7 @@ class YoutubeRuntimeTests(unittest.TestCase): cfg.write_text("[youtube]\nkey = abc\n", encoding="utf-8") settings = _load_youtube_push_settings(str(cfg)) self.assertEqual(settings["b_v"], "4000k") - self.assertEqual(settings["maxrate"], "4500k") + self.assertEqual(settings["maxrate"], "4000k") self.assertEqual(settings["bufsize"], "8000k") self.assertTrue(settings["fast_audio"]) diff --git a/d2ypp2/tools/_check_host04_errors.py b/d2ypp2/tools/_check_host04_errors.py new file mode 100644 index 0000000..c9c83c8 --- /dev/null +++ b/d2ypp2/tools/_check_host04_errors.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +import paramiko + +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect("10.88.0.4", username="eric", password="4669805", timeout=20) +B = "/home/eric/d2ypp2-src" + + +def run(cmd: str) -> str: + _, o, e = c.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=90, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +for label, cmd in [ + ("proxychains_nameerror", f"grep -h '_proxychains_config_for_push' {B}/.pm2/logs/youtube2__*-err.log 2>/dev/null | tail -5 || echo none"), + ("duplicate_option", f"grep -h 'DuplicateOptionError' {B}/.pm2/logs/youtube2__*-err.log 2>/dev/null | tail -3 || echo none"), + ("outer_exception", f"grep -h '外层异常' {B}/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -5 || echo none"), + ("ffmpeg", "pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep | head -3"), + ("recent_out", f"tail -8 {B}/.pm2/logs/youtube2__ch_mpwri36r_z5lm2-out.log 2>/dev/null"), +]: + print(f"=== {label} ===") + print(run(cmd)[:1500]) + print() +c.close() diff --git a/d2ypp2/tools/_check_host04_lanes.py b/d2ypp2/tools/_check_host04_lanes.py new file mode 100644 index 0000000..e389689 --- /dev/null +++ b/d2ypp2/tools/_check_host04_lanes.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +import json +import paramiko + +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect("10.88.0.4", username="eric", password="4669805", timeout=20) +B = "/home/eric/d2ypp2-src" + + +def run(cmd: str, timeout: int = 90) -> str: + _, o, e = c.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +raw = run("curl -sS -m 12 'http://127.0.0.1:8001/process_monitor?family=youtube'") +entries = json.loads(raw).get("entries", []) +print("=== all youtube lanes ===") +for row in entries: + pm2 = row.get("pm2", "") + if not pm2.startswith("youtube"): + continue + print( + pm2, + row.get("business_status"), + f"pushing={row.get('is_pushing')}", + f"speed={row.get('ffmpeg_speed')}", + repr((row.get("source_display") or "")[:50]), + ) + +print("\n=== ffmpeg ===") +print(run("pgrep -af ffmpeg | grep -v pgrep | head -6")) + +print("\n=== live profile lines ===") +print(run(f"grep -h 'YouTube Live profile' {B}/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -6")) + +print("\n=== recent errors ===") +print(run(f"grep -hE '外层异常|NameError|DuplicateOption' {B}/.pm2/logs/youtube2__*-err.log 2>/dev/null | tail -5 || echo none")) + +c.close() diff --git a/d2ypp2/tools/_check_host04_now.py b/d2ypp2/tools/_check_host04_now.py new file mode 100644 index 0000000..18407a4 --- /dev/null +++ b/d2ypp2/tools/_check_host04_now.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +import json +import paramiko + +HOST, USER, PASS, BASE = "10.88.0.4", "eric", "4669805", "/home/eric/d2ypp2-src" +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect(HOST, username=USER, password=PASS, timeout=20) + + +def run(cmd: str) -> str: + _, o, e = c.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=90, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +checks = { + "health": run("curl -sf -m 8 http://127.0.0.1:8001/health"), + "copy_fn": run(f"grep -c _resolve_stream_copy_plan {BASE}/douyin_youtube_ffplay.py 2>/dev/null || echo 0").strip(), + "key_guard": run(f"grep -c _looks_like_youtube_output_rejected {BASE}/douyin_youtube_ffplay.py").strip(), + "relay": run(f"grep -c relay_strategy {BASE}/config/hardware-profile.json 2>/dev/null || echo 0").strip(), + "ffmpeg": run("pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep | head -3"), + "profile": run(f"grep -h 'YouTube Live profile' {BASE}/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -4"), + "speed": run(f"grep -h 'speed=' {BASE}/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -4"), + "qg": run( + "curl -sS -m 12 http://127.0.0.1:8001/hub/youtube/quality_guard | " + "python3 -c \"import sys,json; d=json.load(sys.stdin); print(d.get('ffmpeg_profile',{}).get('target','?'))\"" + ).strip(), +} +print(json.dumps(checks, ensure_ascii=False, indent=2)) +raw = run("curl -sS -m 12 'http://127.0.0.1:8001/process_monitor?family=youtube'") +for row in json.loads(raw).get("entries", []): + pm2 = row.get("pm2", "") + if pm2.startswith("youtube2"): + print(pm2, row.get("business_status"), row.get("is_pushing"), row.get("ffmpeg_speed")) + +ok = ( + checks["copy_fn"] in {"0", ""} + and checks["relay"] in {"0", ""} + and "libx264" in (checks["ffmpeg"] + checks["profile"]) +) +print("REGRESSION:", "PASS" if ok else "PARTIAL") +c.close() diff --git a/d2ypp2/tools/_diag_host04_console.py b/d2ypp2/tools/_diag_host04_console.py new file mode 100644 index 0000000..8efb512 --- /dev/null +++ b/d2ypp2/tools/_diag_host04_console.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +import paramiko + +HOST, USER, PASS, BASE = "10.88.0.4", "eric", "4669805", "/home/eric/d2ypp2-src" +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect(HOST, username=USER, password=PASS, timeout=20) + + +def run(cmd: str, timeout: int = 120) -> str: + _, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +for cmd in [ + "systemctl is-active live-console.service", + "systemctl status live-console.service --no-pager -n 30", + "journalctl -u live-console.service -n 50 --no-pager", + f"cd {BASE} && . .venv/bin/activate && python -m py_compile web.py douyin_youtube_ffplay.py youtube.py", + f"grep relay_strategy {BASE}/config/hardware-profile.json 2>/dev/null || echo no_relay", +]: + print("===", cmd[:100]) + print(run(cmd)[:4000]) + print() + +c.close() diff --git a/d2ypp2/tools/_remote_cleanup_relay.py b/d2ypp2/tools/_remote_cleanup_relay.py new file mode 100644 index 0000000..b2e4d88 --- /dev/null +++ b/d2ypp2/tools/_remote_cleanup_relay.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +import glob +import json +import sys +from pathlib import Path + +base = sys.argv[1] + +def patch_ini() -> int: + removed = 0 + for path in sorted(glob.glob(f"{base}/config/youtube.youtube2__*.ini")): + lines_out = [] + for line in Path(path).read_text(encoding="utf-8-sig").splitlines(): + key = line.split("=", 1)[0].strip().lower() + if key in {"video_mode", "bitrate"}: + removed += 1 + continue + lines_out.append(line) + Path(path).write_text("\n".join(lines_out).rstrip() + "\n", encoding="utf-8") + return removed + + +def patch_profile() -> bool: + p = Path(f"{base}/config/hardware-profile.json") + if not p.is_file(): + return False + data = json.loads(p.read_text(encoding="utf-8")) + if isinstance(data, dict) and "relay_strategy" in data: + data.pop("relay_strategy", None) + p.write_text(json.dumps(data, indent=2, ensure_ascii=False) + "\n", encoding="utf-8") + return True + return False + + +def patch_env() -> int: + p = Path(f"{base}/config/hardware.env") + if not p.is_file(): + return 0 + kept = [] + removed = 0 + for line in p.read_text(encoding="utf-8-sig").splitlines(): + key = line.split("=", 1)[0].strip() + if key.startswith("LIVE_RELAY_"): + removed += 1 + continue + kept.append(line) + p.write_text("\n".join(kept).rstrip() + "\n", encoding="utf-8") + return removed + + +text = Path(f"{base}/douyin_youtube_ffplay.py").read_text(encoding="utf-8", errors="ignore") +print("ini_removed", patch_ini()) +print("relay_strategy_removed", patch_profile()) +print("relay_env_removed", patch_env()) +print("has_stream_copy_fn", "_resolve_stream_copy_plan" in text) diff --git a/d2ypp2/tools/_remote_douyin_diag2.py b/d2ypp2/tools/_remote_douyin_diag2.py new file mode 100644 index 0000000..90990b2 --- /dev/null +++ b/d2ypp2/tools/_remote_douyin_diag2.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +import paramiko + +HOST, USER, PASS, BASE = "10.88.0.4", "eric", "4669805", "/home/eric/d2ypp2-src" +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect(HOST, username=USER, password=PASS, timeout=20) + + +def run(cmd: str, timeout: int = 120) -> str: + _, o, e = c.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +cmds = [ + f"head -30 {BASE}/config/youtube.youtube2__ch_mpwri36r_z5lm2.ini", + f"grep -i douyin {BASE}/config/config.ini 2>/dev/null | head -3 || echo no_douyin_cookie", + f"grep -E 'push_proxy|proxy' {BASE}/config/youtube.youtube2__ch_mpwri36r_z5lm2.ini | head -5", + f"cd {BASE} && . .venv/bin/activate && python tools/test_douyin_fetch.py https://live.douyin.com/29155980665 2>&1", + f"grep -c 'def _proxychains_config_for_push' {BASE}/douyin_youtube_ffplay.py", + f"grep -c 'Douyin web API failed' {BASE}/src/spider.py || echo 0", +] +for cmd in cmds: + print("===", cmd[:100]) + print(run(cmd)[:2500]) + print() + +c.close() diff --git a/d2ypp2/tools/apply_host04_like_05.py b/d2ypp2/tools/apply_host04_like_05.py new file mode 100644 index 0000000..9e4b6c2 --- /dev/null +++ b/d2ypp2/tools/apply_host04_like_05.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 +"""Upload and run remote_patch_host04.py on 10.88.0.4, restart shellcrash, verify.""" +from __future__ import annotations + +import json +from pathlib import Path + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +LOCAL = Path(__file__).resolve().parent / "remote_patch_host04.py" +REMOTE = "/tmp/remote_patch_host04.py" + + +def run(c: paramiko.SSHClient, cmd: str, timeout: int = 120) -> str: + _, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +def main() -> int: + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(HOST, username=USER, password=PASS, timeout=20) + + sftp = c.open_sftp() + sftp.put(str(LOCAL), REMOTE) + sftp.close() + + print("=== apply patch ===") + print(run(c, f"python3 {REMOTE}")) + + print("\n=== restart shellcrash ===") + print(run(c, f"echo '{PASS}' | sudo -S -p '' systemctl restart shellcrash && sleep 2 && systemctl is-active shellcrash")) + + verify = ( + "curl -sS -m 8 -x socks5://127.0.0.1:7890 https://www.gstatic.com/generate_204 " + "-w 'gstatic=%{http_code} t=%{time_total}\\n' -o /dev/null; " + "curl -sS -m 10 -x socks5://127.0.0.1:7890 https://a.rtmps.youtube.com/ " + "-w 'yt_rtmps_t=%{time_total}\\n' -o /dev/null 2>&1 | tail -1; " + "python3 -c \"import urllib.request,json;print(json.load(urllib.request.urlopen('http://127.0.0.1:9999/proxies',timeout=5))['proxies']['\\U0001f680 \\u8282\\u70b9\\u9009\\u62e9']['now'])\"" + ) + print("\n=== verify proxy ===") + print(run(c, verify)) + + print("\n=== config snapshot ===") + print(run(c, "grep -H 'video_mode\\|bitrate\\|fast_audio' /home/eric/d2ypp2-src/config/youtube.youtube2__*.ini | head -10")) + print(run(c, "cat /home/eric/d2ypp2-src/config/hardware.env")) + print(run(c, "grep SHELLCRASH /home/eric/d2ypp2-src/config/system-stack.env")) + + print("\n=== active ffmpeg (restart lanes from UI if needed) ===") + print(run(c, "pgrep -af 'ffmpeg.*rtmps' || echo none")) + + c.close() + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/check_host04_deep.py b/d2ypp2/tools/check_host04_deep.py new file mode 100644 index 0000000..648d69e --- /dev/null +++ b/d2ypp2/tools/check_host04_deep.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +BASE = "/home/eric/d2ypp2-src" + + +def run(cmd: str, timeout: int = 90) -> str: + client = paramiko.SSHClient() + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + client.connect(HOST, username=USER, password=PASS, timeout=20) + _, stdout, stderr = client.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout) + out = (stdout.read() + stderr.read()).decode("utf-8", "replace") + client.close() + return out.strip() + + +def curl_json(path: str) -> tuple[int, object | str]: + raw = run(f"curl -sS -m 12 -w '\\n__HTTP__%{{http_code}}' 'http://127.0.0.1:8001{path}'") + if "__HTTP__" not in raw: + return 0, raw + body, code_s = raw.rsplit("__HTTP__", 1) + code = int(code_s.strip() or "0") + body = body.strip() + if not body: + return code, "" + try: + return code, json.loads(body) + except json.JSONDecodeError: + return code, body[:2000] + + +def main() -> int: + print("=== host ===") + print(run("hostname")) + + print("\n=== is_pushing fix on disk ===") + print(run(f"grep -n 'is_pushing' {BASE}/src/process_runtime_status.py | tail -2")) + + print("\n=== uvicorn ===") + print(run("pgrep -af 'uvicorn web:app' | head -2")) + + print("\n=== ffmpeg pushing ===") + print(run("pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep | head -3")) + + code, data = curl_json("/process_monitor?family=youtube") + print(f"\n=== process_monitor http={code} ===") + if isinstance(data, dict): + rows = data.get("rows") or [] + print("row_count", len(rows)) + for row in rows: + print( + f" {row.get('pm2')}: business={row.get('business_status')} " + f"pushing={row.get('is_pushing')} label={row.get('label')} " + f"display={row.get('source_display') or row.get('source_title') or '-'}" + ) + else: + print(data) + + code, data = curl_json("/hub/youtube_pro_channels") + print(f"\n=== pro_channels http={code} ===") + if isinstance(data, dict): + for ch in (data.get("channels") or [])[:8]: + print(f" name={ch.get('name')} pm2={ch.get('pm2Name')}") + else: + print(data) + + print("\n=== served page bundle ===") + print(run("curl -sS -m 8 http://127.0.0.1/ | grep -o 'page-[a-z0-9]*\\.js' | head -3")) + + print("\n=== bundle contains new UI strings ===") + print( + run( + "python3 -c \"from pathlib import Path; import glob; " + f"files=glob.glob('{BASE}/web-console/out/_next/static/chunks/app/page-*.js'); " + "text=Path(files[0]).read_text('utf-8', errors='replace') if files else ''; " + "needles=['当前转播线路','抖音源','Pro relay status']; " + "[print(n, n in text) for n in needles]; " + "print('file', files[0] if files else 'none', 'size', len(text))\"" + ) + ) + + print("\n=== lane logs (last 2 lines each) ===") + print(run(f"for f in {BASE}/.pm2/logs/youtube2__*-out.log; do echo ---$f---; tail -n 2 $f; done")) + + print("\n=== restart web if python module stale? ===") + print(run(f"stat -c '%y' {BASE}/src/process_runtime_status.py; ps -o lstart= -p $(pgrep -f 'uvicorn web:app' | head -1) 2>/dev/null")) + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/check_host04_now.py b/d2ypp2/tools/check_host04_now.py new file mode 100644 index 0000000..9d71f83 --- /dev/null +++ b/d2ypp2/tools/check_host04_now.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python3 +"""Quick remote check for 10.88.0.4 deployment and YouTube Pro status.""" +from __future__ import annotations + +import json +import sys + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +BASE = "/home/eric/d2ypp2-src" + + +def run(cmd: str, timeout: int = 60) -> str: + client = paramiko.SSHClient() + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + client.connect(HOST, username=USER, password=PASS, timeout=20) + _, stdout, stderr = client.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout) + out = (stdout.read() + stderr.read()).decode("utf-8", "replace") + client.close() + return out + + +def main() -> int: + checks: list[tuple[str, str]] = [ + ("hostname", "hostname"), + ("health", "curl -sf -m 5 http://127.0.0.1:8001/health; echo"), + ( + "web_root", + "curl -sS -m 8 -o /dev/null -w 'http_code=%{http_code} size=%{size_download}' http://127.0.0.1/; echo", + ), + ( + "console_built", + "curl -sf -m 8 http://127.0.0.1:8001/server_info | python3 -c \"import sys,json; d=json.load(sys.stdin); print('console_built=', d.get('console_built'))\"", + ), + ( + "ui_helpers", + f"grep -n 'proLanePrimaryTitle\\|proLaneStatusLabel' {BASE}/web-console/components/live-product/LiveYoutubeUnmannedView.tsx | head -5", + ), + ( + "backend_is_pushing", + f"grep -n 'is_pushing' {BASE}/src/process_runtime_status.py | tail -2", + ), + ( + "backend_ambiguous", + f"grep -n '_log_indicates_active_relay' {BASE}/src/douyin_source_display.py | head -2", + ), + ( + "web_out_mtime", + f"ls -la {BASE}/web-console/out/index.html {BASE}/web-console/out/_next/static/chunks/app/page-*.js 2>/dev/null | tail -3", + ), + ("uvicorn", "pgrep -af 'uvicorn web:app' | head -2"), + ("youtube_procs", "pgrep -af 'youtube.py' | grep -v grep | head -8"), + ("ffmpeg", "pgrep -af 'ffmpeg.*rtmps' | head -3"), + ( + "process_monitor", + """curl -sf -m 8 'http://127.0.0.1:8001/process_monitor?family=youtube' | python3 - <<'PY' +import json,sys +rows=json.load(sys.stdin).get('rows') or [] +for r in rows[:8]: + print( + f"{r.get('pm2')}: business={r.get('business_status')} pushing={r.get('is_pushing')} " + f"display={r.get('source_display') or r.get('source_title') or '-'} label={r.get('label')}" + ) +if not rows: + print('no youtube rows') +PY""", + ), + ( + "pro_channels", + """curl -sf -m 8 'http://127.0.0.1:8001/hub/youtube_pro_channels' | python3 - <<'PY' +import json,sys +data=json.load(sys.stdin) +channels=data.get('channels') or [] +print('channel_count=', len(channels)) +for ch in channels[:8]: + print(f" id={ch.get('id')} name={ch.get('name')} pm2={ch.get('pm2Name')}") +PY""", + ), + ( + "recent_youtube_log", + f"tail -n 8 {BASE}/.pm2/logs/youtube2__ch_mp9mm36r_2wn0r-out.log 2>/dev/null || " + f"ls -1 {BASE}/.pm2/logs/*youtube*out.log 2>/dev/null | head -5", + ), + ( + "js_bundle_has_fix", + f"grep -l 'proLanePrimaryTitle\\|推流中' {BASE}/web-console/out/_next/static/chunks/app/page-*.js 2>/dev/null | head -1 | xargs -I{{}} sh -c 'echo bundle={{}}; grep -o proLanePrimaryTitle {{}} | head -1 || echo minified_no_symbol'", + ), + ] + + for title, cmd in checks: + print(f"\n=== {title} ===") + try: + text = run(cmd) + print(text[:3000] if text else "(empty)") + except Exception as exc: + print(f"ERR: {exc}") + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/cleanup_relay_remote.py b/d2ypp2/tools/cleanup_relay_remote.py new file mode 100644 index 0000000..188dc6c --- /dev/null +++ b/d2ypp2/tools/cleanup_relay_remote.py @@ -0,0 +1,159 @@ +#!/usr/bin/env python3 +"""Remove Cursor relay/copy artifacts from remote hosts and sync clean push code.""" +from __future__ import annotations + +import argparse +import glob +import json +import os +import sys +from pathlib import Path + +import paramiko + +ROOT = Path(__file__).resolve().parent.parent +LOCAL_PUSH = ROOT / "douyin_youtube_ffplay.py" +LOCAL_PROBE = ROOT / "scripts" / "hardware_probe.py" + + +def run(ssh: paramiko.SSHClient, cmd: str, timeout: int = 120) -> str: + _, stdout, stderr = ssh.exec_command(cmd, timeout=timeout, get_pty=True) + out = (stdout.read() + stderr.read()).decode("utf-8", "replace") + return out.strip() + + +def sftp_put(sftp: paramiko.SFTPClient, local: Path, remote: str) -> None: + sftp.put(str(local), remote) + print(f"[ok] uploaded {local.name} -> {remote}") + + +def patch_ini_files(base: str) -> int: + removed = 0 + for path in sorted(glob.glob(f"{base}/config/youtube.youtube2__*.ini")): + lines_out: list[str] = [] + for line in Path(path).read_text(encoding="utf-8-sig").splitlines(): + key = line.split("=", 1)[0].strip().lower() + if key in {"video_mode", "bitrate"}: + removed += 1 + continue + lines_out.append(line) + Path(path).write_text("\n".join(lines_out).rstrip() + "\n", encoding="utf-8") + return removed + + +def patch_hardware_profile(base: str) -> bool: + profile_path = Path(f"{base}/config/hardware-profile.json") + if not profile_path.is_file(): + return False + data = json.loads(profile_path.read_text(encoding="utf-8")) + if isinstance(data, dict) and "relay_strategy" in data: + data.pop("relay_strategy", None) + profile_path.write_text(json.dumps(data, indent=2, ensure_ascii=False) + "\n", encoding="utf-8") + return True + return False + + +def cleanup_hardware_env(base: str) -> int: + env_path = Path(f"{base}/config/hardware.env") + if not env_path.is_file(): + return 0 + kept: list[str] = [] + removed = 0 + for line in env_path.read_text(encoding="utf-8-sig").splitlines(): + key = line.split("=", 1)[0].strip() + if key.startswith("LIVE_RELAY_"): + removed += 1 + continue + kept.append(line) + env_path.write_text("\n".join(kept).rstrip() + "\n", encoding="utf-8") + return removed + + +def main() -> int: + parser = argparse.ArgumentParser() + parser.add_argument("host") + parser.add_argument("--user", default="eric") + parser.add_argument("--password", default=os.environ.get("LIVE_DEPLOY_PASS", "4669805")) + parser.add_argument("--base", required=True, help="Remote repo base path") + parser.add_argument("--restart", action="store_true") + args = parser.parse_args() + + if not LOCAL_PUSH.is_file(): + print(f"missing {LOCAL_PUSH}", file=sys.stderr) + return 2 + + ssh = paramiko.SSHClient() + ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + ssh.connect(args.host, username=args.user, password=args.password, timeout=20) + sftp = ssh.open_sftp() + + remote_push = f"{args.base}/douyin_youtube_ffplay.py" + remote_probe = f"{args.base}/scripts/hardware_probe.py" + sftp_put(sftp, LOCAL_PUSH, remote_push) + if LOCAL_PROBE.is_file(): + sftp_put(sftp, LOCAL_PROBE, remote_probe) + sftp.close() + + # Run cleanup on remote via inline python (paths are on remote) + cleanup_py = f""" +import glob, json +from pathlib import Path +base = {args.base!r} + +def patch_ini(): + removed = 0 + for path in sorted(glob.glob(f"{{base}}/config/youtube.youtube2__*.ini")): + lines_out = [] + for line in Path(path).read_text(encoding='utf-8-sig').splitlines(): + key = line.split('=', 1)[0].strip().lower() + if key in {{'video_mode', 'bitrate'}}: + removed += 1 + continue + lines_out.append(line) + Path(path).write_text('\\n'.join(lines_out).rstrip() + '\\n', encoding='utf-8') + return removed + +def patch_profile(): + p = Path(f"{{base}}/config/hardware-profile.json") + if not p.is_file(): + return False + data = json.loads(p.read_text(encoding='utf-8')) + if isinstance(data, dict) and 'relay_strategy' in data: + data.pop('relay_strategy', None) + p.write_text(json.dumps(data, indent=2, ensure_ascii=False) + '\\n', encoding='utf-8') + return True + return False + +def patch_env(): + p = Path(f"{{base}}/config/hardware.env") + if not p.is_file(): + return 0 + kept = [] + removed = 0 + for line in p.read_text(encoding='utf-8-sig').splitlines(): + key = line.split('=', 1)[0].strip() + if key.startswith('LIVE_RELAY_'): + removed += 1 + continue + kept.append(line) + p.write_text('\\n'.join(kept).rstrip() + '\\n', encoding='utf-8') + return removed + +print('ini_removed', patch_ini()) +print('relay_strategy_removed', patch_profile()) +print('relay_env_removed', patch_env()) +has_copy_fn = '_resolve_stream_copy_plan' in Path(f"{{base}}/douyin_youtube_ffplay.py").read_text(encoding='utf-8', errors='ignore') +print('has_stream_copy_fn', has_copy_fn) +""" + print(run(ssh, f"python3 -c {json.dumps(cleanup_py)}")) + + if args.restart: + print(run(ssh, f"cd {args.base} && pm2 restart youtube2__ch_mpwri36r_z5lm2 youtube2__ch_mpyvqkc0_gj63k 2>/dev/null || true")) + print(run(ssh, f"grep -hE 'LIVE_VIDEO_ENCODER|YouTube Live profile|stream copy|libx264' {args.base}/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -8")) + + ssh.close() + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/compare_04_05_speed.py b/d2ypp2/tools/compare_04_05_speed.py new file mode 100644 index 0000000..b2cf75c --- /dev/null +++ b/d2ypp2/tools/compare_04_05_speed.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +import paramiko + +def run(host, user, pw, cmd, timeout=60): + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(host, username=user, password=pw, timeout=15) + _, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True) + out = (o.read() + e.read()).decode("utf-8", "replace") + c.close() + return out + +HOSTS = [("10.88.0.4", "eric", "4669805"), ("10.88.0.5", "eric", "4669805")] + +for host, user, pw in HOSTS: + print(f"\n{'#'*70}\n# {host}\n{'#'*70}") + cmds = [ + ("live_speed", "for pid in $(pgrep -f 'ffmpeg.*rtmps'); do echo PID=$pid; ps -p $pid -o %cpu,%mem,etime,cmd --no-headers | head -c 200; echo; timeout 3 tail -c 8000 /proc/$pid/fd/2 2>/dev/null | tr '\\r' '\\n' | grep speed= | tail -3; done"), + ("proxychains", "pgrep -af proxychains; ps aux | grep proxychains | grep -v grep"), + ("top_mem", "ps aux --sort=-%mem | head -15"), + ("top_cpu", "ps aux --sort=-%cpu | head -15"), + ("services", "systemctl is-active live-console shellcrash 2>/dev/null; docker ps --format '{{.Names}} {{.Status}}' 2>/dev/null | wc -l"), + ("yt_proxy_test", "time curl -sS -m 15 -x socks5://127.0.0.1:7890 -o /dev/null -w 'yt_socks=%{http_code} spd=%{speed_download} time=%{time_total}\\n' https://a.rtmps.youtube.com/ 2>&1; time curl -sS -m 10 -o /dev/null -w 'douyin_pull=%{http_code} spd=%{speed_download} time=%{time_total}\\n' -H 'User-Agent: Mozilla/5.0' -H 'Referer: https://live.douyin.com/' 'http://pull-flv-l26.douyincdn.com/' 2>&1 | head -3"), + ("wg", "ip -br a | grep -E 'wgeasy|wg0|enp'; wg show wgeasy 2>/dev/null | head -5"), + ("lane_logs_mode", "grep -hE 'proxychains|push_proxy|stream copy|transcode|1080|1088|720' /home/eric/d2ypp2-src/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -12"), + ] + for label, cmd in cmds: + print(f"\n--- {label} ---") + try: + print(run(host, user, pw, cmd)[:5000].encode("ascii", "backslashreplace").decode()) + except Exception as ex: + print(ex) diff --git a/d2ypp2/tools/compare_hosts.py b/d2ypp2/tools/compare_hosts.py new file mode 100644 index 0000000..31fd073 --- /dev/null +++ b/d2ypp2/tools/compare_hosts.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +"""Compare live streaming hosts on the same LAN.""" +from __future__ import annotations + +import json + +import paramiko + +HOSTS = [ + ("10.88.0.4", "eric", "4669805"), + ("10.88.0.5", "eric", "4669805"), +] + + +def run(host: str, user: str, password: str, cmd: str, timeout: int = 45) -> str: + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(host, username=user, password=password, timeout=15) + try: + _, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + finally: + c.close() + + +def safe(text: str, limit: int = 6000) -> str: + return text.encode("ascii", "backslashreplace").decode()[:limit] + + +def main() -> None: + cmds = [ + "hostname; uptime; free -h | head -2; nproc; uname -m", + "curl -sS -m 8 http://127.0.0.1:8001/health 2>/dev/null || echo health_fail", + "curl -sS -m 12 'http://127.0.0.1:8001/process_monitor?family=youtube&light=1' 2>/dev/null | head -c 5000", + "pgrep -af 'ffmpeg.*rtmps' || echo NO_FFMPEG", + "ps aux | grep 'd2ypp2.*/youtube.py' | grep -v grep || echo NO_YOUTUBE", + "grep -E 'stream copy|transcode|speed=|Douyin web data fetch|YouTube Live profile' $(ls -t /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_*-out.log 2>/dev/null | head -2) 2>/dev/null | tail -8 || true", + "test -f /home/eric/d2ypp2-src/douyin_youtube_ffplay.py && grep -c '_resolve_stream_copy_plan' /home/eric/d2ypp2-src/douyin_youtube_ffplay.py || echo NO_COPY_FIX", + "grep -H 'video_mode\\|fast_audio' /home/eric/d2ypp2-src/config/youtube.youtube2__ch_*.ini 2>/dev/null | head -6", + "curl -sS -m 5 -x socks5://127.0.0.1:7890 https://www.gstatic.com/generate_204 -w 'proxy7890=%{http_code}\\n' -o /dev/null 2>/dev/null; curl -sS -m 5 -x http://127.0.0.1:7894 https://www.gstatic.com/generate_204 -w 'proxy7894=%{http_code}\\n' -o /dev/null 2>/dev/null", + "systemctl is-active shellcrash live-console 2>/dev/null; ss -tlnp 2>/dev/null | grep -E ':7890|:7894|:8001' || true", + "ls -d /home/eric/d2ypp2* 2>/dev/null | head -5", + ] + for host, user, password in HOSTS: + print(f"\n{'#' * 70}\n# HOST {host}\n{'#' * 70}") + for cmd in cmds: + print(f"\n--- {cmd[:72]} ---") + try: + out = run(host, user, password, cmd) + print(safe(out)) + except Exception as exc: + print(f"ERROR: {exc}") + + +if __name__ == "__main__": + main() diff --git a/d2ypp2/tools/compare_hosts2.py b/d2ypp2/tools/compare_hosts2.py new file mode 100644 index 0000000..e469fe2 --- /dev/null +++ b/d2ypp2/tools/compare_hosts2.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +import paramiko + +HOSTS = [("10.88.0.4", "eric", "4669805"), ("10.88.0.5", "eric", "4669805")] + +def run(host, user, pw, cmd, timeout=40): + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(host, username=user, password=pw, timeout=15) + try: + _, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode('utf-8', 'replace') + finally: + c.close() + +cmds = [ + "lscpu | grep 'Model name'", + "ps aux | grep youtube.py | grep -v grep", + "ls -la /home/eric/d2ypp2/youtube.py /home/eric/d2ypp2-src/youtube.py 2>&1", + "grep -r LIVE_PM2 /home/eric/d2ypp2-src/.pm2/logs/*.log 2>/dev/null | tail -1; ls /home/eric/d2ypp2/.pm2/logs/youtube2__ch_*-out.log 2>/dev/null | head -3", + "cd /home/eric/d2ypp2 2>/dev/null || cd /home/eric/d2ypp2-src; pwd; .venv/bin/python -c \"import asyncio; from src.spider import get_douyin_app_stream_data; print('test')\" 2>&1 | head -3", + "curl -sS -m 8 'http://127.0.0.1:8001/restart?process=youtube2__ch_mpwri36r_z5lm2' 2>/dev/null | head -c 300", + "sleep 3; ps aux | grep youtube.py | grep -v grep | head -3", +] + +for host, user, pw in HOSTS: + print('\n' + '='*20, host, '='*20) + for cmd in cmds: + print('\n--', cmd[:65]) + try: + print(run(host, user, pw, cmd).encode('ascii','backslashreplace').decode()[:3500]) + except Exception as ex: + print('ERR', ex) diff --git a/d2ypp2/tools/compare_hosts3.py b/d2ypp2/tools/compare_hosts3.py new file mode 100644 index 0000000..936cee2 --- /dev/null +++ b/d2ypp2/tools/compare_hosts3.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +import paramiko + +def q(host, cmd, timeout=30): + c=paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(host,username='eric',password='4669805',timeout=15) + _,o,e=c.exec_command(cmd,timeout=timeout,get_pty=True) + out=(o.read()+e.read()).decode('utf-8','replace') + c.close(); return out + +for host in ['10.88.0.4','10.88.0.5']: + print('\n===',host,'===') + for cmd in [ + 'ls -la /opt/live/d2ypp/youtube.py /opt/live/d2ypp/douyin_youtube_ffplay.py 2>&1', + 'systemctl list-units --type=service --state=running 2>/dev/null | grep -Ei \"live|youtube|d2ypp\" || true', + 'cat /home/eric/d2ypp2-src/config/system-stack.env 2>/dev/null | grep -E \"^PORT=|^BASE|^REPO\" || true', + 'cat /opt/live/d2ypp/config/system-stack.env 2>/dev/null | grep -E \"^PORT=\" || true', + 'docker ps --format \"{{.Names}} {{.Status}}\" 2>/dev/null | wc -l', + 'free -h | grep -E \"Mem|Swap\"', + 'curl -sS -m 10 http://127.0.0.1:8001/stack/summary 2>/dev/null | head -c 2000', + 'ls /home/eric/d2ypp2-src/.pm2/pids/*.pid 2>/dev/null | wc -l; cat /home/eric/d2ypp2-src/.pm2/pids/*.pid 2>/dev/null | head -5', + ]: + print('--',cmd[:60]) + print(q(host,cmd).encode('ascii','backslashreplace').decode()[:2500]) diff --git a/d2ypp2/tools/compare_proxy_shellcrash.py b/d2ypp2/tools/compare_proxy_shellcrash.py new file mode 100644 index 0000000..ed6564c --- /dev/null +++ b/d2ypp2/tools/compare_proxy_shellcrash.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 +import paramiko + +CMDS = [ + "systemctl status shellcrash --no-pager 2>/dev/null | head -12", + "tail -20 /tmp/ShellCrash/ShellCrash.log 2>/dev/null || tail -20 /var/log/shellcrash.log 2>/dev/null || echo no_log", + "grep -E 'mode|proxy|mixed|tun|socks' /tmp/ShellCrash/config.yaml 2>/dev/null | head -20", + "curl -sS -m 5 http://127.0.0.1:9090/proxies 2>/dev/null | head -c 500 || echo no_clash_api", + "neko_count=$(docker ps 2>/dev/null | grep -c neko || echo 0); echo neko_containers=$neko_count; docker ps --format '{{.Names}} {{.Status}}' 2>/dev/null | grep neko", +] + +for host, pw in [("10.88.0.4", "4669805"), ("10.88.0.5", "4669805")]: + print(f"\n{'='*50}\n{host}\n{'='*50}") + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(host, username="eric", password=pw, timeout=15) + for cmd in CMDS: + print(f"\n> {cmd[:70]}") + _, o, e = c.exec_command(cmd, timeout=25, get_pty=True) + print((o.read() + e.read()).decode()[:1200].encode("ascii", "backslashreplace").decode()) + c.close() diff --git a/d2ypp2/tools/compare_three_hosts_speed.py b/d2ypp2/tools/compare_three_hosts_speed.py new file mode 100644 index 0000000..3a32dc4 --- /dev/null +++ b/d2ypp2/tools/compare_three_hosts_speed.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 +"""Compare streaming speed/config across 10.88.0.3/.4/.5.""" +from __future__ import annotations + +import paramiko + +HOSTS = [ + ("10.88.0.3", "eric", "Xiao4669805"), + ("10.88.0.4", "eric", "4669805"), + ("10.88.0.5", "eric", "4669805"), +] + +CMDS = [ + ("identity", "hostname; uname -m; nproc; free -h | grep Mem; uptime"), + ( + "ffmpeg", + "ffmpeg -hide_banner -version 2>&1 | head -3; which ffmpeg; ls -la $(which ffmpeg) 2>/dev/null", + ), + ("hw_profile", "cat /home/eric/d2ypp2-src/config/hardware-profile.json 2>/dev/null | head -c 2500"), + ("hardware_env", "cat /home/eric/d2ypp2-src/config/hardware.env 2>/dev/null"), + ("pm2", "PM2_HOME=/home/eric/d2ypp2-src/.pm2 pm2 list 2>/dev/null | head -25"), + ("ffmpeg_ps", "ps aux | grep -E 'ffmpeg.*rtmps' | grep -v grep"), + ( + "speed_proc", + r"""for pid in $(pgrep -f 'ffmpeg.*rtmps://a.rtmps.youtube.com' 2>/dev/null); do + echo PID=$pid + timeout 2 cat /proc/$pid/fd/2 2>/dev/null | tr '\r' '\n' | grep -E 'speed=|stream copy|transcode|YouTube Live profile' | tail -5 +done""", + ), + ("speed_api", "curl -sS -m 12 'http://127.0.0.1:8001/process_monitor?family=youtube' 2>/dev/null | head -c 4000"), + ( + "youtube_ini", + "grep -H 'video_mode\\|fast_audio\\|bitrate' /home/eric/d2ypp2-src/config/youtube.youtube2__*.ini 2>/dev/null | head -20", + ), + ( + "code_hash", + "md5sum /home/eric/d2ypp2-src/douyin_youtube_ffplay.py /home/eric/d2ypp2-src/youtube.py 2>/dev/null", + ), + ("load", "top -bn1 | head -5; echo ffmpeg_count=$(pgrep -cf ffmpeg)"), + ( + "proxy", + "curl -sS -m 5 -x socks5://127.0.0.1:7890 https://www.gstatic.com/generate_204 -w 'socks=%{http_code} time=%{time_total}\n' -o /dev/null 2>&1; " + "curl -sS -m 5 -x http://127.0.0.1:7894 https://www.gstatic.com/generate_204 -w 'http=%{http_code} time=%{time_total}\n' -o /dev/null 2>&1", + ), + ( + "recent_log", + "grep -hE 'speed=|stream copy|transcode|YouTube Live profile|hardware relay' /home/eric/d2ypp2-src/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -10", + ), + ( + "ffplay_re", + "grep -n '\\-re' /home/eric/d2ypp2-src/douyin_youtube_ffplay.py | head -8", + ), + ( + "static_ffmpeg", + "file $(which ffmpeg); ldd $(which ffmpeg) 2>&1 | head -3", + ), +] + + +def q(host: str, user: str, pw: str, cmd: str, timeout: int = 45) -> str: + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(host, username=user, password=pw, timeout=15) + _, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True) + out = (o.read() + e.read()).decode("utf-8", "replace") + c.close() + return out + + +def main() -> int: + for host, user, pw in HOSTS: + print(f"\n{'=' * 60}\nHOST {host}\n{'=' * 60}") + try: + for label, cmd in CMDS: + print(f"\n--- {label} ---") + try: + out = q(host, user, pw, cmd) + print(out[:4000].encode("ascii", "backslashreplace").decode()) + except Exception as exc: + print(f"CMD_ERR: {exc}") + except Exception as exc: + print(f"CONNECT_FAIL: {exc}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/deploy_relay_fix.py b/d2ypp2/tools/deploy_relay_fix.py new file mode 100644 index 0000000..31c7136 --- /dev/null +++ b/d2ypp2/tools/deploy_relay_fix.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +"""Deploy relay fix, auto-tune hardware profile, and restart Pro lanes.""" +from __future__ import annotations + +import json +import time +from pathlib import Path + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +ROOT = Path(__file__).resolve().parent.parent +REMOTE_BASE = "/home/eric/d2ypp2-src" +LANES = ["youtube2__ch_mpwri36r_z5lm2", "youtube2__ch_mpyvqkc0_gj63k"] +UPLOADS = { + ROOT / "douyin_youtube_ffplay.py": f"{REMOTE_BASE}/douyin_youtube_ffplay.py", + ROOT / "scripts" / "hardware_probe.py": f"{REMOTE_BASE}/scripts/hardware_probe.py", + ROOT / "config" / "hardware.env.example": f"{REMOTE_BASE}/config/hardware.env.example", + ROOT / "youtube.py": f"{REMOTE_BASE}/youtube.py", + ROOT / "src" / "spider.py": f"{REMOTE_BASE}/src/spider.py", + ROOT / "src" / "recorder_config.py": f"{REMOTE_BASE}/src/recorder_config.py", +} + + +def run(c: paramiko.SSHClient, cmd: str, timeout: int = 90) -> str: + _, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +def main() -> int: + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(HOST, username=USER, password=PASS, timeout=20) + sftp = c.open_sftp() + for local, remote in UPLOADS.items(): + sftp.put(str(local), remote) + print(f"uploaded {remote}") + sftp.close() + + print( + run( + c, + f"echo '{PASS}' | sudo -S -p '' chown -R eric:eric {REMOTE_BASE}/config && " + f"chmod -R u+rwX {REMOTE_BASE}/config && echo perms_ok", + timeout=30, + ) + ) + probe_raw = run( + c, + f"cd {REMOTE_BASE} && . .venv/bin/activate && " + "python scripts/hardware_probe.py --write --apply-youtube-defaults", + timeout=120, + ) + print(probe_raw[:3500]) + print("\n=== hardware.env ===") + print(run(c, f"grep LIVE_RELAY {REMOTE_BASE}/config/hardware.env 2>/dev/null || true")) + print("\n=== lane ini ===") + print( + run( + c, + f"grep -H 'video_mode\\|fast_audio\\|bitrate' {REMOTE_BASE}/config/youtube.youtube2__ch_*.ini 2>/dev/null | head -10", + )[:1500] + ) + + for lane in LANES: + print(run(c, f"curl -sS -m 60 'http://127.0.0.1:8001/restart?process={lane}'")[:220]) + time.sleep(4) + + print("waiting 50s...") + time.sleep(50) + print(run(c, "pgrep -af 'ffmpeg.*rtmps' || echo none")[:4000]) + for lane in LANES: + print(f"\n=== {lane} log ===") + print( + run( + c, + f"grep -E 'hardware relay|stream copy|YouTube Live profile|speed=' " + f"{REMOTE_BASE}/.pm2/logs/{lane}-out.log | tail -6", + )[:1200] + ) + raw = run(c, "curl -sS -m 15 'http://127.0.0.1:8001/process_monitor?family=youtube&light=1'") + try: + data = json.loads(raw) + for entry in data.get("entries", []): + if entry.get("pm2") in LANES: + print( + f"{entry['pm2']}: {entry.get('business_status')} " + f"speed={entry.get('ffmpeg_speed')} room={entry.get('source_room_id')}" + ) + except json.JSONDecodeError: + print(raw[:1500]) + c.close() + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/deploy_test_host04.py b/d2ypp2/tools/deploy_test_host04.py new file mode 100644 index 0000000..545ed6d --- /dev/null +++ b/d2ypp2/tools/deploy_test_host04.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python3 +"""Deploy current repo source to 10.88.0.4 for integration test, then verify clean regression.""" +from __future__ import annotations + +import io +import json +import posixpath +import time +from pathlib import Path + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +BASE = "/home/eric/d2ypp2-src" +REPO = Path(__file__).resolve().parent.parent +OUT = REPO / "web-console" / "out" + +# Core files changed in this fix cycle — sync from local repo as source of truth. +SYNC_FILES = [ + "douyin_youtube_ffplay.py", + "youtube.py", + "web.py", + "scripts/hardware_probe.py", + "src/youtube_runtime.py", + "src/youtube_quality_guard.py", + "src/process_runtime_status.py", + "src/douyin_source_display.py", + "src/web_process_backend.py", + "src/spider.py", + "web-console/lib/ffmpegMetrics.ts", + "web-console/lib/youtubeConfigUtils.ts", + "web-console/components/live-product/LiveYoutubeUnmannedView.tsx", + "web-console/components/live-product/LiveProcessLiveLogCard.tsx", +] + + +def run(ssh: paramiko.SSHClient, cmd: str, timeout: int = 180) -> str: + _, stdout, stderr = ssh.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout, get_pty=True) + return (stdout.read() + stderr.read()).decode("utf-8", "replace").strip() + + +def mkdir_p(sftp: paramiko.SFTPClient, remote_dir: str) -> None: + remote_dir = remote_dir.replace("\\", "/").rstrip("/") + parts = [p for p in remote_dir.split("/") if p] + cur = "" + for part in parts: + cur = f"{cur}/{part}" if cur else f"/{part}" + try: + sftp.stat(cur) + except OSError: + sftp.mkdir(cur) + + +def put_file(sftp: paramiko.SFTPClient, local: Path, remote: str) -> None: + mkdir_p(sftp, posixpath.dirname(remote)) + if local.suffix.lower() in {".py", ".ts", ".tsx", ".sh"}: + sftp.putfo(io.BytesIO(local.read_bytes().replace(b"\r\n", b"\n")), remote) + else: + sftp.put(str(local), remote) + + +def put_tree(sftp: paramiko.SFTPClient, local_dir: Path, remote_dir: str) -> int: + count = 0 + for path in sorted(local_dir.rglob("*")): + if not path.is_file(): + continue + rel = path.relative_to(local_dir).as_posix() + remote = posixpath.join(remote_dir, rel) + mkdir_p(sftp, posixpath.dirname(remote)) + sftp.put(str(path), remote) + count += 1 + return count + + +def lane_names(ssh: paramiko.SSHClient) -> list[str]: + raw = run(ssh, f"ls {BASE}/config/youtube.youtube2__*.ini 2>/dev/null") + names: list[str] = [] + for line in raw.splitlines(): + name = line.rsplit("/", 1)[-1] + if name.startswith("youtube.") and name.endswith(".ini"): + names.append(name[len("youtube.") : -len(".ini")]) + return sorted(names) + + +def main() -> int: + if not (OUT / "index.html").is_file(): + raise SystemExit("missing web-console/out — run: cd web-console && npm run build") + + ssh = paramiko.SSHClient() + ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + ssh.connect(HOST, username=USER, password=PASS, timeout=25) + sftp = ssh.open_sftp() + + print("=== [1/5] upload repo source files ===") + for rel in SYNC_FILES: + local = REPO / rel + if not local.is_file(): + print(f"[skip] missing {rel}") + continue + remote = f"{BASE}/{rel.replace(chr(92), '/')}" + put_file(sftp, local, remote) + print(f"[ok] {rel}") + + print("\n=== [2/5] upload web-console/out ===") + uploaded = put_tree(sftp, OUT, f"{BASE}/web-console/out") + print(f"[ok] uploaded {uploaded} static files") + + cleanup_py = (REPO / "tools" / "_remote_cleanup_relay.py").read_text(encoding="utf-8") + with sftp.open("/tmp/_remote_cleanup_relay.py", "w") as fh: + fh.write(cleanup_py) + sftp.close() + + print("\n=== [3/5] cleanup relay/copy artifacts on remote ===") + print(run(ssh, f"python3 /tmp/_remote_cleanup_relay.py {BASE}")) + + print("\n=== [4/5] restart live-console + youtube lanes ===") + print(run(ssh, f"echo '{PASS}' | sudo -S -p '' systemctl restart live-console.service", timeout=90)) + print(run(ssh, "sleep 5; curl -sf -m 8 http://127.0.0.1:8001/health && echo health_ok")) + for proc in lane_names(ssh): + out = run( + ssh, + "curl -sS -m 60 -X POST 'http://127.0.0.1:8001/restart' " + "-H 'Content-Type: application/json' " + f"-d '{json.dumps({'process': proc})}'", + ) + print(f"restart {proc}: {out[:220]}") + time.sleep(12) + + print("\n=== [5/5] regression verify (remote == repo source) ===") + checks = [ + ("no_stream_copy_fn", f"grep -c _resolve_stream_copy_plan {BASE}/douyin_youtube_ffplay.py || echo 0"), + ("has_key_reject_guard", f"grep -c _looks_like_youtube_output_rejected {BASE}/douyin_youtube_ffplay.py"), + ("force_youtube_push", f"grep -A2 'force_youtube_push' {BASE}/src/youtube_runtime.py | head -4"), + ("no_relay_strategy", f"grep relay_strategy {BASE}/config/hardware-profile.json 2>/dev/null || echo clean"), + ("no_video_mode_ini", f"grep -H video_mode {BASE}/config/youtube.youtube2__*.ini 2>/dev/null | head -3 || echo clean"), + ("ffmpeg_cmd", "pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep | head -2"), + ("push_profile_log", f"grep -hE 'YouTube Live profile|stream copy|libx264' {BASE}/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -6"), + ("quality_guard_profile", "curl -sS -m 12 http://127.0.0.1:8001/hub/youtube/quality_guard | python3 -c \"import sys,json;d=json.load(sys.stdin);print(d.get('ffmpeg_profile',{}).get('target','?'))\""), + ("process_monitor", "curl -sS -m 12 'http://127.0.0.1:8001/process_monitor?family=youtube'"), + ] + monitor_rows: list[dict] = [] + for label, cmd in checks: + out = run(ssh, cmd) + print(f"\n--- {label} ---\n{out[:1200]}") + if label == "process_monitor": + try: + monitor_rows = json.loads(out).get("entries") or [] + except json.JSONDecodeError: + pass + + print("\n=== summary ===") + copy_fn = run(ssh, f"grep -c _resolve_stream_copy_plan {BASE}/douyin_youtube_ffplay.py || true").strip() + relay = run(ssh, f"grep -c relay_strategy {BASE}/config/hardware-profile.json 2>/dev/null || echo 0").strip() + ffmpeg = run(ssh, "pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep | head -1") + ok = copy_fn in {"0", ""} and relay in {"0", ""} and "libx264" in ffmpeg + print(f"stream_copy_removed={copy_fn in {'0', ''}}") + print(f"relay_strategy_removed={relay in {'0', ''}}") + print(f"libx264_push={'libx264' in ffmpeg}") + for row in monitor_rows[:8]: + print( + f" {row.get('pm2')}: {row.get('business_status')} pushing={row.get('is_pushing')} " + f"speed={row.get('ffmpeg_speed')}" + ) + print(f"\n回归源码: {'PASS' if ok else 'CHECK LOGS'} — remote {BASE} synced from local repo") + ssh.close() + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/diag_host04_ffmpeg_match.py b/d2ypp2/tools/diag_host04_ffmpeg_match.py new file mode 100644 index 0000000..31e6556 --- /dev/null +++ b/d2ypp2/tools/diag_host04_ffmpeg_match.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +BASE = "/home/eric/d2ypp2-src" + +REMOTE_PY = f""" +import os, json +from pathlib import Path +os.chdir('{BASE}') +import sys +sys.path.insert(0, '{BASE}') +from src.web_process_backend import ( + _linux_ffmpeg_pids_for_process_tree, + _linux_ffmpeg_pids_for_stack, + _ffmpeg_cmdline_markers, + _ffmpeg_pid_matches_process, + _read_proc_env_value, +) + +ff = [int(x) for x in os.popen("pgrep -f 'ffmpeg.*rtmps'").read().split() if x.strip().isdigit()] +print('ffmpeg_pids', ff) +for pid in ff[:3]: + cmd = (Path('/proc')/str(pid)/'cmdline').read_bytes().replace(b'\\0', b' ').decode('utf-8','replace')[:300] + print('cmd', pid, cmd) + for proc in ['youtube2__ch_mpwri36r_z5lm2','youtube2__ch_mpyvqkc0_gj63k']: + print(' env_match', proc, _ffmpeg_pid_matches_process(pid, proc)) + print(' markers', _ffmpeg_cmdline_markers(proc, Path('{BASE}'))[:4]) + +for proc in ['youtube2__ch_mpwri36r_z5lm2','youtube2__ch_mpyvqkc0_gj63k']: + ypid = [x for x in os.popen(f"pgrep -f 'youtube.py'").read().split() if x.strip().isdigit()] + print('proc', proc, 'youtube_pids', ypid[:4]) + stack = _linux_ffmpeg_pids_for_stack(proc, Path('{BASE}')) + print(' stack_match', stack) +""" + +c = paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy()); c.connect(HOST, username=USER, password=PASS, timeout=20) +_, o, e = c.exec_command(f"cd {BASE} && .venv/bin/python - <<'PY'\n{REMOTE_PY}\nPY", timeout=90) +print((o.read()+e.read()).decode('utf-8','replace')) +c.close() diff --git a/d2ypp2/tools/diag_host04_live_ffmpeg_pids.py b/d2ypp2/tools/diag_host04_live_ffmpeg_pids.py new file mode 100644 index 0000000..c2564a5 --- /dev/null +++ b/d2ypp2/tools/diag_host04_live_ffmpeg_pids.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +import asyncio +import json +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +BASE = "/home/eric/d2ypp2-src" +PY = f""" +import asyncio, json, os +os.chdir('{BASE}') +import sys +sys.path.insert(0, '{BASE}') +from pathlib import Path +from src.web_process_backend import WebProcessBackend + +async def main(): + backend = WebProcessBackend(Path('{BASE}'), Path('{BASE}/.pm2/logs')) + await backend.ensure_mode() + for proc in ['youtube2__ch_mpwri36r_z5lm2','youtube2__ch_mpyvqkc0_gj63k']: + info = (await backend.process_infos([proc])).get(proc) or {{}} + pids = await backend.live_ffmpeg_pids(proc, info) + print(proc, 'status=', info.get('process_status'), 'pid=', info.get('pid'), 'ffmpeg_pids=', pids) + +asyncio.run(main()) +""" + +c = paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy()); c.connect(HOST,username=USER,password=PASS,timeout=20) +_, o, e = c.exec_command(f"cd {BASE} && .venv/bin/python - <<'PY'\n{PY}\nPY", timeout=90) +print((o.read()+e.read()).decode('utf-8','replace')) +raw = (o.read()+e.read()).decode('utf-8','replace') +c.close() + +c = paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy()); c.connect(HOST,username=USER,password=PASS,timeout=20) +_, o, e = c.exec_command(f"curl -sS -m 12 'http://127.0.0.1:8001/process_monitor?family=youtube&light=0'", timeout=90) +print((o.read()+e.read()).decode('utf-8','replace')[:3000]) +c.close() diff --git a/d2ypp2/tools/diag_host4_speed.py b/d2ypp2/tools/diag_host4_speed.py new file mode 100644 index 0000000..79a1edb --- /dev/null +++ b/d2ypp2/tools/diag_host4_speed.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" + +CMDS = [ + ("mem_detail", "free -h; swapon --show; cat /proc/meminfo | grep -E 'MemTotal|MemAvailable|Swap'"), + ("cpu", "lscpu | grep -E 'Model name|CPU\\(s\\)|MHz'"), + ("deploy_path", "ls -la /home/eric/d2ypp2-src/ /opt/live/d2ypp/ 2>&1 | head -20"), + ("hw_files", "ls -la /home/eric/d2ypp2-src/config/hardware* 2>&1; cat /home/eric/d2ypp2-src/config/hardware-profile.json 2>/dev/null"), + ("hw_env", "cat /home/eric/d2ypp2-src/config/hardware.env 2>/dev/null"), + ("pm2_full", "PM2_HOME=/home/eric/d2ypp2-src/.pm2 pm2 list 2>/dev/null"), + ("ffmpeg_cmd", "ps auxww | grep -E 'ffmpeg.*rtmps' | grep -v grep"), + ("stream_mode", "grep -hE 'stream copy|transcode|YouTube Live profile|hardware relay|video_mode' /home/eric/d2ypp2-src/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -15"), + ("speed_lines", "grep -h 'speed=' /home/eric/d2ypp2-src/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -20"), + ("ini_all", "grep -H '' /home/eric/d2ypp2-src/config/youtube*.ini 2>/dev/null | head -40"), + ("quality", "curl -sS -m 15 http://127.0.0.1:8001/youtube/quality_guard 2>/dev/null | head -c 5000"), + ("process_mon", "curl -sS -m 15 'http://127.0.0.1:8001/process_monitor?family=youtube' 2>/dev/null"), + ("compare_ffmpeg", "which -a ffmpeg; /usr/bin/ffmpeg -version 2>&1 | head -1; /usr/local/bin/ffmpeg -version 2>&1 | head -1"), + ("docker_neko", "docker ps --format '{{.Names}} {{.Status}}' 2>/dev/null | head -15"), + ("load_per_cpu", "mpstat -P ALL 1 1 2>/dev/null || top -bn1 | head -8"), + ("oom", "dmesg 2>/dev/null | grep -iE 'oom|killed process' | tail -5; journalctl -k --no-pager 2>/dev/null | grep -i oom | tail -3"), +] + +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect(HOST, username=USER, password=PASS, timeout=15) +for label, cmd in CMDS: + print(f"\n=== {label} ===") + _, o, e = c.exec_command(cmd, timeout=60, get_pty=True) + out = (o.read() + e.read()).decode("utf-8", "replace") + print(out[:6000].encode("ascii", "backslashreplace").decode()) +c.close() diff --git a/d2ypp2/tools/diag_lane_status_mismatch.py b/d2ypp2/tools/diag_lane_status_mismatch.py new file mode 100644 index 0000000..f2e438b --- /dev/null +++ b/d2ypp2/tools/diag_lane_status_mismatch.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +import json +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" + +CMDS = [ + "cat /home/eric/d2ypp2-src/.process_runner/state.json 2>/dev/null", + "ps auxww | grep 'd2ypp2-src/youtube.py' | grep -v grep", + "for pid in $(pgrep -f 'ffmpeg.*rtmps'); do echo FFMPEG=$pid PPID=$(ps -o ppid= -p $pid | tr -d ' ') PGID=$(ps -o pgid= -p $pid | tr -d ' '); ps -p $pid -o user,cmd --no-headers | head -c 120; echo; done", + "curl -sS -m 10 'http://127.0.0.1:8001/process_monitor?family=youtube' | python3 -m json.tool", + "ls -la /home/eric/d2ypp2-src/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -5", + "tail -3 /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpwri36r_z5lm2-out.log 2>/dev/null", + "tail -3 /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpyvqkc0_gj63k-out.log 2>/dev/null", + "grep -h 'speed=' /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpwri36r_z5lm2-out.log 2>/dev/null | tail -2", + "grep -h 'speed=' /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpyvqkc0_gj63k-out.log 2>/dev/null | tail -2", +] + +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect(HOST, username=USER, password=PASS, timeout=15) +for cmd in CMDS: + print(f"\n=== {cmd[:90]} ===") + _, o, e = c.exec_command(cmd, timeout=40, get_pty=True) + print((o.read() + e.read()).decode()[:5000].encode("ascii", "backslashreplace").decode()) +c.close() diff --git a/d2ypp2/tools/find_deploy_paths.py b/d2ypp2/tools/find_deploy_paths.py new file mode 100644 index 0000000..b48aaf1 --- /dev/null +++ b/d2ypp2/tools/find_deploy_paths.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +import paramiko + +def q(host, pw, cmd): + c = paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(host, username='eric', password=pw, timeout=15) + _, o, e = c.exec_command(cmd, timeout=60, get_pty=True) + r = (o.read()+e.read()).decode('utf-8','replace'); c.close(); return r + +pw = '4669805' +for host in ['10.88.0.4', '10.88.0.5']: + print('\n===', host, '===') + for cmd in [ + 'find /home/eric /opt/live -maxdepth 4 -name d2ypp2-src -type d 2>/dev/null', + 'find /home/eric /opt/live -maxdepth 5 -name hardware.env 2>/dev/null', + 'find /home/eric /opt/live -maxdepth 5 -name system-stack.env 2>/dev/null', + 'ps auxww | grep "ffmpeg.*rtmps" | grep -v grep | head -1 | grep -oE "scale=[^ ]+|libx264|copy|video_mode" || ps auxww | grep ffmpeg | grep rtmps | grep -v grep | head -c 300', + "curl -sS -m 5 'http://127.0.0.1:9999/proxies' 2>/dev/null | python3 -c \"import sys,json;d=json.load(sys.stdin);p=d.get('proxies',{});g=p.get('\\U0001f680 \\u8282\u70b9\u9009\u62e9') or p.get('GLOBAL') or {};print('selected=',g.get('now'));print('all=',list(p.keys())[:8])\" 2>/dev/null || echo no_clash_api", + 'grep -r SHELLCRASH_NEKO_PROXY_NODE /home/eric /opt/live/config 2>/dev/null | head -5', + ]: + print('>', cmd[:75]) + print(q(host, pw, cmd)[:1200].encode('ascii','backslashreplace').decode()) diff --git a/d2ypp2/tools/fix_host04_caddy.py b/d2ypp2/tools/fix_host04_caddy.py new file mode 100644 index 0000000..957bf30 --- /dev/null +++ b/d2ypp2/tools/fix_host04_caddy.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import time + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +BASE = "/home/eric/d2ypp2-src" + + +def run(cmd: str, timeout: int = 180, sudo: bool = False) -> str: + client = paramiko.SSHClient() + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + client.connect(HOST, username=USER, password=PASS, timeout=20) + _, stdout, stderr = client.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout, get_pty=bool(sudo)) + if sudo: + stdout.channel.send(f"{PASS}\n") + out = (stdout.read() + stderr.read()).decode("utf-8", "replace") + client.close() + return out.strip() + + +def main() -> int: + print("=== disk index bundle ===") + print(run(f"grep -o 'page-[a-z0-9]*\\.js' {BASE}/web-console/out/index.html | head -1")) + + print("\n=== served bundle before edge reinstall ===") + print(run("curl -sS -m 8 http://127.0.0.1/ | grep -o 'page-[a-z0-9]*\\.js' | head -1")) + + print("\n=== caddy root hints ===") + print(run(f"grep -R 'web-console/out' {BASE}/live-platform /etc/caddy 2>/dev/null | head -15")) + + print("\n=== reinstall live edge ===") + print(run(f"sudo -S -p '' bash {BASE}/scripts/linux/reinstall_live_edge.sh", sudo=True)) + + time.sleep(8) + print("\n=== served bundle after edge reinstall ===") + print(run("curl -sS -m 8 http://127.0.0.1/ | grep -o 'page-[a-z0-9]*\\.js' | head -1")) + print(run("curl -sS -m 8 -o /dev/null -w 'http_code=%{http_code}' http://127.0.0.1/; echo")) + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/fix_host04_frontend.py b/d2ypp2/tools/fix_host04_frontend.py new file mode 100644 index 0000000..f311d79 --- /dev/null +++ b/d2ypp2/tools/fix_host04_frontend.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import io +import json +import posixpath +from pathlib import Path + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +BASE = "/home/eric/d2ypp2-src" +REPO = Path(__file__).resolve().parent.parent +OUT = REPO / "web-console" / "out" + + +def run(ssh: paramiko.SSHClient, cmd: str, timeout: int = 120) -> str: + _, stdout, stderr = ssh.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout) + return (stdout.read() + stderr.read()).decode("utf-8", "replace").strip() + + +def mkdir_p(sftp: paramiko.SFTPClient, remote_dir: str) -> None: + remote_dir = remote_dir.replace("\\", "/").rstrip("/") + parts = [p for p in remote_dir.split("/") if p] + cur = "" + for part in parts: + cur = f"{cur}/{part}" if cur else f"/{part}" + try: + sftp.stat(cur) + except OSError: + sftp.mkdir(cur) + + +def put_tree(sftp: paramiko.SFTPClient, local_dir: Path, remote_dir: str) -> int: + count = 0 + for path in sorted(local_dir.rglob("*")): + if not path.is_file(): + continue + rel = path.relative_to(local_dir).as_posix() + remote = posixpath.join(remote_dir, rel) + mkdir_p(sftp, posixpath.dirname(remote)) + sftp.put(str(path), remote) + count += 1 + return count + + +def main() -> int: + if not (OUT / "index.html").is_file(): + raise SystemExit("missing local web-console/out; run pnpm build first") + + local_page = next(OUT.glob("_next/static/chunks/app/page-*.js"), None) + local_index = (OUT / "index.html").read_text(encoding="utf-8", errors="replace") + print("local page bundle:", local_page.name if local_page else "missing") + + client = paramiko.SSHClient() + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + client.connect(HOST, username=USER, password=PASS, timeout=20) + sftp = client.open_sftp() + + print("uploading web-console/out ...") + uploaded = put_tree(sftp, OUT, f"{BASE}/web-console/out") + print(f"uploaded {uploaded} files") + + backend_files = [ + "src/process_runtime_status.py", + "src/douyin_source_display.py", + "src/youtube_quality_guard.py", + "web-console/components/live-product/LiveYoutubeUnmannedView.tsx", + "web-console/components/live-product/LiveProcessLiveLogCard.tsx", + "web-console/lib/ffmpegMetrics.ts", + "web-console/lib/youtubeConfigUtils.ts", + ] + for rel in backend_files: + local = REPO / rel + remote = f"{BASE}/{rel.replace(chr(92), '/')}" + mkdir_p(sftp, posixpath.dirname(remote)) + if local.suffix.lower() in {".py", ".ts", ".tsx"}: + sftp.putfo(io.BytesIO(local.read_bytes().replace(b"\r\n", b"\n")), remote) + else: + sftp.put(str(local), remote) + sftp.close() + + print(run(client, f"grep -o 'page-[a-z0-9]*\\.js' {BASE}/web-console/out/index.html | head -1")) + print(run(client, f"wc -c {BASE}/web-console/out/_next/static/chunks/app/page-*.js")) + + print("restarting live-console ...") + print(run(client, f"echo '{PASS}' | sudo -S -p '' systemctl restart live-console.service", timeout=60)) + print(run(client, "sleep 4; curl -sf -m 8 http://127.0.0.1:8001/health; echo")) + + raw = run(client, "curl -sS -m 12 'http://127.0.0.1:8001/process_monitor?family=youtube'") + try: + data = json.loads(raw) + entries = data.get("entries") or [] + print(f"process_monitor entries={len(entries)}") + for row in entries: + print( + f" {row.get('pm2')}: business={row.get('business_status')} pushing={row.get('is_pushing')} " + f"label={row.get('label')} display={row.get('source_display') or row.get('source_title') or '-'}" + ) + except json.JSONDecodeError: + print("process_monitor raw:", raw[:1500]) + + served = run(client, "curl -sS -m 8 http://127.0.0.1/ | grep -o 'page-[a-z0-9]*\\.js' | head -1") + print("served page bundle:", served) + print("local index references page-9ff3a078ec6e16cb.js:", "page-9ff3a078ec6e16cb.js" in local_index) + + client.close() + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/hotfix_host04_ffmpeg_pids.py b/d2ypp2/tools/hotfix_host04_ffmpeg_pids.py new file mode 100644 index 0000000..e058122 --- /dev/null +++ b/d2ypp2/tools/hotfix_host04_ffmpeg_pids.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +"""Deploy ffmpeg PID matching fix to 10.88.0.4.""" +from __future__ import annotations + +import io +import json +import time +from pathlib import Path + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +BASE = "/home/eric/d2ypp2-src" +REPO = Path(__file__).resolve().parent.parent +FILES = [ + REPO / "src" / "web_process_backend.py", + REPO / "douyin_youtube_ffplay.py", +] + + +def put(sftp: paramiko.SFTPClient, local: Path, remote: str) -> None: + sftp.putfo(io.BytesIO(local.read_bytes().replace(b"\r\n", b"\n")), remote) + + +def ssh_run(client: paramiko.SSHClient, cmd: str, sudo: bool = False) -> str: + _, stdout, stderr = client.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=180, get_pty=sudo) + if sudo: + stdout.channel.send(f"{PASS}\n") + return (stdout.read() + stderr.read()).decode("utf-8", "replace").strip() + + +def main() -> int: + client = paramiko.SSHClient() + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + client.connect(HOST, username=USER, password=PASS, timeout=20) + sftp = client.open_sftp() + for local in FILES: + remote = f"{BASE}/{local.relative_to(REPO).as_posix()}" + put(sftp, local, remote) + print("uploaded", remote) + sftp.close() + + print(ssh_run(client, "sudo -S -p '' systemctl restart live-console.service", sudo=True)) + for _ in range(15): + if '"status":"ok"' in ssh_run(client, "curl -sf -m 4 http://127.0.0.1:8001/health; echo"): + print("health ok") + break + time.sleep(2) + + for proc in ("youtube2__ch_mpwri36r_z5lm2", "youtube2__ch_mpyvqkc0_gj63k"): + print(proc, ssh_run( + client, + "curl -sS -m 60 -X POST 'http://127.0.0.1:8001/restart' " + "-H 'Content-Type: application/json' " + f"-d '{{\"process\":\"{proc}\"}}'", + )[:300]) + + print("waiting for ffmpeg ...") + time.sleep(20) + print(ssh_run(client, "pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep")) + raw = ssh_run(client, "curl -sS -m 12 'http://127.0.0.1:8001/process_monitor?family=youtube'") + data = json.loads(raw) + for row in data.get("entries") or []: + if str(row.get("pm2", "")).startswith("youtube2__"): + line = ( + f"{row.get('pm2')} business={row.get('business_status')} " + f"pushing={row.get('is_pushing')} label={row.get('label')}" + ) + print(line.encode("utf-8", "replace").decode("utf-8", "replace")) + client.close() + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/hotfix_host04_proxychains.py b/d2ypp2/tools/hotfix_host04_proxychains.py new file mode 100644 index 0000000..67a7d66 --- /dev/null +++ b/d2ypp2/tools/hotfix_host04_proxychains.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import io +import json +import time +from pathlib import Path + +import paramiko + +HOST, USER, PASS, BASE = "10.88.0.4", "eric", "4669805", "/home/eric/d2ypp2-src" +REPO = Path(__file__).resolve().parent.parent +FILES = ["douyin_youtube_ffplay.py", "src/recorder_config.py", "youtube.py", "src/spider.py"] + + +def run(ssh: paramiko.SSHClient, cmd: str, timeout: int = 120) -> str: + _, o, e = ssh.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +def lane_names(ssh: paramiko.SSHClient) -> list[str]: + raw = run(ssh, f"ls {BASE}/config/youtube.youtube2__*.ini 2>/dev/null") + out: list[str] = [] + for line in raw.splitlines(): + name = line.rsplit("/", 1)[-1] + if name.startswith("youtube.") and name.endswith(".ini"): + out.append(name[len("youtube.") : -len(".ini")]) + return sorted(out) + + +def main() -> int: + ssh = paramiko.SSHClient() + ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + ssh.connect(HOST, username=USER, password=PASS, timeout=20) + sftp = ssh.open_sftp() + for rel in FILES: + local = REPO / rel + remote = f"{BASE}/{rel.replace(chr(92), '/')}" + sftp.putfo(io.BytesIO(local.read_bytes().replace(b"\r\n", b"\n")), remote) + print(f"[ok] {rel}") + sftp.close() + + print(run(ssh, f"python3 -m py_compile {BASE}/douyin_youtube_ffplay.py {BASE}/src/recorder_config.py {BASE}/youtube.py")) + print("fn count:", run(ssh, f"grep -c 'def _proxychains_config_for_push' {BASE}/douyin_youtube_ffplay.py").strip()) + + for proc in lane_names(ssh): + out = run( + ssh, + "curl -sS -m 60 -X POST 'http://127.0.0.1:8001/restart' " + "-H 'Content-Type: application/json' " + f"-d '{json.dumps({'process': proc})}'", + ) + print(f"restart {proc}: {out[:200]}") + time.sleep(18) + + print("\nffmpeg:", run(ssh, "pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep | head -2")) + print( + "proxychains err:", + run(ssh, f"grep -h '_proxychains_config_for_push' {BASE}/.pm2/logs/youtube2__*-err.log 2>/dev/null | tail -3 || echo none"), + ) + print( + "duplicate err:", + run(ssh, f"grep -h 'DuplicateOptionError' {BASE}/.pm2/logs/youtube2__*-err.log 2>/dev/null | tail -3 || echo none"), + ) + print("profile:", run(ssh, f"grep -h 'YouTube Live profile' {BASE}/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -4")) + ssh.close() + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/inspect_host04_caddy.py b/d2ypp2/tools/inspect_host04_caddy.py new file mode 100644 index 0000000..09363e6 --- /dev/null +++ b/d2ypp2/tools/inspect_host04_caddy.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" + + +def run(cmd: str, timeout: int = 90) -> str: + client = paramiko.SSHClient() + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + client.connect(HOST, username=USER, password=PASS, timeout=20) + _, stdout, stderr = client.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout) + out = (stdout.read() + stderr.read()).decode("utf-8", "replace") + client.close() + return out.strip() + + +def main() -> int: + cmds = [ + "cat /opt/live/generated/Caddyfile", + "grep -R 'root\\|file_server\\|web-console' /opt/live/generated/Caddyfile /home/eric/d2ypp2-src/live-platform 2>/dev/null | head -30", + "ls -la /opt/live/d2ypp/web-console/out/index.html 2>/dev/null || echo no_opt_live_out", + "grep -o 'page-[a-z0-9]*\\.js' /opt/live/d2ypp/web-console/out/index.html 2>/dev/null | head -1", + "grep -o 'page-[a-z0-9]*\\.js' /home/eric/d2ypp2-src/web-console/out/index.html | head -1", + "readlink -f /opt/live/d2ypp 2>/dev/null || true", + "systemctl cat live-console.service | head -40", + ] + for cmd in cmds: + print(f"\n=== {cmd} ===") + print(run(cmd)[:4000]) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/live_speed_now.py b/d2ypp2/tools/live_speed_now.py new file mode 100644 index 0000000..d1d8910 --- /dev/null +++ b/d2ypp2/tools/live_speed_now.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +import paramiko + +for host, pw in [("10.88.0.4", "4669805"), ("10.88.0.5", "4669805")]: + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(host, username="eric", password=pw, timeout=15) + cmd = ( + "for pid in $(pgrep -f 'ffmpeg.*rtmps'); do echo PID=$pid; " + "timeout 2 cat /proc/$pid/fd/2 2>/dev/null | tr '\\r' '\\n' | grep speed= | tail -2; done" + ) + print(f"=== {host} ===") + _, o, e = c.exec_command(cmd, timeout=20, get_pty=True) + print((o.read() + e.read()).decode()[:800]) + c.close() diff --git a/d2ypp2/tools/poll_host04_push.py b/d2ypp2/tools/poll_host04_push.py new file mode 100644 index 0000000..2d447bb --- /dev/null +++ b/d2ypp2/tools/poll_host04_push.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +import json +import time + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" + +def run(cmd): + c=paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy()); c.connect(HOST,username=USER,password=PASS,timeout=20) + _,o,e=c.exec_command('export LC_ALL=C.UTF-8; '+cmd,timeout=90) + out=(o.read()+e.read()).decode('utf-8','replace'); c.close(); return out + +for i in range(6): + print(f'--- poll {i+1} ---') + print(run("pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep")) + raw=run("curl -sS -m 12 'http://127.0.0.1:8001/process_monitor?family=youtube'") + d=json.loads(raw) + for row in d.get('entries') or []: + if str(row.get('pm2','')).startswith('youtube2__'): + print(row['pm2'], row.get('business_status'), row.get('is_pushing'), row.get('source_display'), row.get('label')) + time.sleep(5) diff --git a/d2ypp2/tools/proxy_check_three.py b/d2ypp2/tools/proxy_check_three.py new file mode 100644 index 0000000..48e219f --- /dev/null +++ b/d2ypp2/tools/proxy_check_three.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +import paramiko + +HOSTS = [ + ("10.88.0.3", "Xiao4669805"), + ("10.88.0.4", "4669805"), + ("10.88.0.5", "4669805"), +] + +CMDS = [ + "ss -tlnp | grep -E '7890|7894|7891' || true", + "curl -sS -m 8 -x socks5://127.0.0.1:7890 https://www.gstatic.com/generate_204 -w 'gstatic_socks=%{http_code} t=%{time_total}\n' -o /dev/null", + "curl -sS -m 12 -x socks5://127.0.0.1:7890 https://a.rtmps.youtube.com/ -w 'yt_socks=%{http_code} t=%{time_total}\n' -o /dev/null", + "pgrep -cf 'ffmpeg.*rtmps'; pgrep -cf neko; free -h | grep -E 'Mem|Swap'", +] + + +def q(host: str, pw: str, cmd: str) -> str: + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(host, username="eric", password=pw, timeout=15) + _, o, e = c.exec_command(cmd, timeout=45, get_pty=True) + out = (o.read() + e.read()).decode("utf-8", "replace") + c.close() + return out + + +for host, pw in HOSTS: + print(f"\nHOST {host}") + for cmd in CMDS: + print(f" > {cmd}") + print(q(host, pw, cmd).encode("ascii", "backslashreplace").decode()[:900]) diff --git a/d2ypp2/tools/quick_host5.py b/d2ypp2/tools/quick_host5.py new file mode 100644 index 0000000..6ac0461 --- /dev/null +++ b/d2ypp2/tools/quick_host5.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +import paramiko + +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect("10.88.0.5", username="eric", password="4669805", timeout=15) +for cmd in [ + "lscpu | grep 'Model name'", + "grep -h speed= /home/eric/d2ypp2-src/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -6", + "ps auxww | grep 'ffmpeg.*rtmps' | grep -v grep | head -1 | cut -c1-220", +]: + print(">", cmd) + _, o, e = c.exec_command(cmd, timeout=30, get_pty=True) + print((o.read() + e.read()).decode()[:600]) +c.close() diff --git a/d2ypp2/tools/read_host05_config.py b/d2ypp2/tools/read_host05_config.py new file mode 100644 index 0000000..c846464 --- /dev/null +++ b/d2ypp2/tools/read_host05_config.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +import paramiko + +def q(host, pw, cmd): + c = paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(host, username='eric', password=pw, timeout=15) + _, o, e = c.exec_command(cmd, timeout=60, get_pty=True) + r = (o.read()+e.read()).decode('utf-8','replace'); c.close(); return r + +pw='4669805' +host='10.88.0.5' +cmds=[ + 'cat /opt/live/d2ypp/config/hardware.env 2>/dev/null', + 'cat /opt/live/d2ypp/config/hardware-profile.json 2>/dev/null | head -c 2000', + 'grep -H "video_mode\\|fast_audio\\|bitrate" /opt/live/d2ypp/config/youtube.youtube2__*.ini 2>/dev/null | head -30', + 'cat /opt/live/d2ypp/config/system-stack.env 2>/dev/null | grep -E SHELLCRASH|YOUTUBE|PUSH|RELAY|PROXY', + 'ls /opt/live/d2ypp/config/youtube.youtube2__*.ini 2>/dev/null', + 'md5sum /opt/live/d2ypp/douyin_youtube_ffplay.py /home/eric/d2ypp2-src/douyin_youtube_ffplay.py 2>/dev/null', +] +for cmd in cmds: + print('>',cmd) + print(q(host,pw,cmd)[:2500].encode('ascii','backslashreplace').decode()) diff --git a/d2ypp2/tools/read_lane_ini_both.py b/d2ypp2/tools/read_lane_ini_both.py new file mode 100644 index 0000000..12c9ef9 --- /dev/null +++ b/d2ypp2/tools/read_lane_ini_both.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +import paramiko + +def q(host, pw, cmd): + c = paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(host, username='eric', password=pw, timeout=15) + _, o, e = c.exec_command(cmd, timeout=60, get_pty=True) + return (o.read()+e.read()).decode('utf-8','replace') + +pw='4669805' +for host, base in [('10.88.0.5','/opt/live/d2ypp'), ('10.88.0.4','/home/eric/d2ypp2-src')]: + print('\n===', host, '===') + for cmd in [ + f'cat {base}/config/youtube.youtube2__ch_mp9mm36r_2wn0r.ini 2>/dev/null || ls {base}/config/youtube.youtube2__*.ini | head -1 | xargs cat 2>/dev/null', + f"grep -E 'SHELLCRASH|YOUTUBE|PUSH|RELAY|PROXY' {base}/config/system-stack.env 2>/dev/null", + f'grep relay_strategy {base}/config/hardware-profile.json 2>/dev/null -A12 | head -15', + ]: + print('>', cmd[:90]) + print(q(host,pw,cmd)[:2000].encode('ascii','backslashreplace').decode()) diff --git a/d2ypp2/tools/remote_diag.py b/d2ypp2/tools/remote_diag.py new file mode 100644 index 0000000..f98d489 --- /dev/null +++ b/d2ypp2/tools/remote_diag.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +"""Quick remote diagnostics for live streaming host.""" +from __future__ import annotations + +import sys + +import paramiko + +HOST = sys.argv[1] if len(sys.argv) > 1 else "10.88.0.4" +USER = sys.argv[2] if len(sys.argv) > 2 else "eric" +PASS = sys.argv[3] if len(sys.argv) > 3 else "4669805" + +COMMANDS = [ + "hostname; uptime; free -h | head -3", + "which pm2; PM2_HOME=/etc/.pm2 pm2 list 2>/dev/null; PM2_HOME=$HOME/.pm2 pm2 list 2>/dev/null", + "ps aux | grep -E 'ffmpeg|youtube|douyin|ffplay' | grep -v grep | head -40", + "ss -tlnp 2>/dev/null | head -40", + "systemctl is-active live-console shellcrash 2>/dev/null; docker ps --format '{{.Names}} {{.Status}}' 2>/dev/null | head -20", + "find /opt /home/eric -maxdepth 4 -name 'd2ypp*' -type d 2>/dev/null | head -10", + "for p in 8001 8000 9200 9201 7890 7894; do curl -sS -m 3 -o /dev/null -w \"port=$p code=%{http_code}\\n\" http://127.0.0.1:$p/ 2>/dev/null; done", + "curl -sS -m 8 http://127.0.0.1:8001/api/process-monitor 2>/dev/null | head -c 5000", + "curl -sS -m 8 http://127.0.0.1:8001/process-monitor 2>/dev/null | head -c 5000", + "ls -la /etc/.pm2/logs/ 2>/dev/null | tail -20", + "tail -30 /etc/.pm2/logs/*youtube*out*.log 2>/dev/null | tail -80", + "tail -30 /etc/.pm2/logs/*youtube*error*.log 2>/dev/null | tail -80", + "wg show 2>/dev/null | head -30", + "curl -sS -m 5 -x http://127.0.0.1:7894 https://www.gstatic.com/generate_204 -w 'proxy7894=%{http_code}\\n' -o /dev/null 2>/dev/null", + "for pid in $(pgrep -f 'ffmpeg.*rtmps://a.rtmps.youtube.com'); do echo PID=$pid; timeout 3 cat /proc/$pid/fd/2 2>/dev/null | tail -3; done", + "curl -sS -m 10 http://127.0.0.1:8001/api/process-monitor/list 2>/dev/null | head -c 10000", + "curl -sS -m 10 http://127.0.0.1:8001/hub/youtube/quality 2>/dev/null | head -c 10000", + "grep -r speed= /home/eric/d2ypp2-src/logs/ /var/log/ 2>/dev/null | tail -15", + "ls -la /root/.pm2/logs/ 2>/dev/null; ls -la /home/eric/d2ypp2-src/logs/ 2>/dev/null | tail -15", + "grep fast_audio /home/eric/d2ypp2-src/config/youtube*.ini 2>/dev/null", + "head -80 /home/eric/d2ypp2-src/douyin_youtube_ffplay.py 2>/dev/null | tail -5; grep -n fast_audio /home/eric/d2ypp2-src/douyin_youtube_ffplay.py 2>/dev/null | head -5", +] + + +def main() -> int: + client = paramiko.SSHClient() + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + client.connect(HOST, username=USER, password=PASS, timeout=20) + for cmd in COMMANDS: + print(f"\n{'='*20} {cmd[:72]} {'='*20}") + _, stdout, stderr = client.exec_command(cmd, timeout=60) + out = stdout.read().decode("utf-8", "replace") + err = stderr.read().decode("utf-8", "replace") + if out.strip(): + print(out[:12000]) + if err.strip(): + print("STDERR:", err[:2000]) + client.close() + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/remote_douyin_diag.py b/d2ypp2/tools/remote_douyin_diag.py new file mode 100644 index 0000000..47cded0 --- /dev/null +++ b/d2ypp2/tools/remote_douyin_diag.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +"""Diagnose Douyin fetch failures on remote host.""" +from __future__ import annotations + +import configparser +import concurrent.futures +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +REMOTE = "/home/eric/d2ypp2-src" + + +def run(c: paramiko.SSHClient, cmd: str, timeout: int = 90) -> str: + _, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +def main() -> None: + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(HOST, username=USER, password=PASS, timeout=20) + sftp = c.open_sftp() + sftp.put("tools/test_douyin_fetch.py", f"{REMOTE}/tools/test_douyin_fetch.py") + sftp.close() + + remote_py = f""" +import asyncio, configparser +from pathlib import Path +from src.spider import get_douyin_web_stream_data + +cfg = configparser.RawConfigParser() +cfg.read('{REMOTE}/config/config.ini', encoding='utf-8-sig') +dy_cookie = cfg.get('Cookie', '抖音cookie', fallback='') + +async def one(url, cookies): + data = await get_douyin_web_stream_data(url, proxy_addr=None, cookies=cookies) + return url, bool(data.get('anchor_name')), data.get('status') + +async def main(): + url = 'https://live.douyin.com/29155980665' + for label, cookies in [('builtin', ''), ('config', dy_cookie)]: + data = await get_douyin_web_stream_data(url, cookies=cookies or None) + print(label, 'anchor=', data.get('anchor_name',''), 'status=', data.get('status'), 'stream=', bool(data.get('stream_url'))) + urls = [ + 'https://live.douyin.com/29155980665', + 'https://live.douyin.com/52546370369', + 'https://live.douyin.com/70746445716', + 'https://live.douyin.com/53684233877', + 'https://live.douyin.com/49924415687', + ] + tasks = [one(u, dy_cookie) for u in urls] + results = await asyncio.gather(*tasks, return_exceptions=True) + for item in results: + print('burst', item) + +asyncio.run(main()) +""" + cmd = ( + f"cd {REMOTE} && . .venv/bin/activate && PYTHONPATH={REMOTE} python - <<'PY'\n" + f"{remote_py}\nPY" + ) + print(run(c, cmd, timeout=120)) + c.close() + + +if __name__ == "__main__": + main() diff --git a/d2ypp2/tools/remote_fix_now.py b/d2ypp2/tools/remote_fix_now.py new file mode 100644 index 0000000..38b2cd2 --- /dev/null +++ b/d2ypp2/tools/remote_fix_now.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" + + +def run(c, cmd, timeout=60): + _, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +def main(): + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(HOST, username=USER, password=PASS, timeout=20) + cmds = [ + "curl -sS -m 15 'http://127.0.0.1:8001/process_monitor?family=youtube'", + "pgrep -af 'ffmpeg.*rtmps' || echo NO_FFMPEG", + "ps aux | grep 'd2ypp2-src/youtube.py' | grep -v grep", + "head -3 /home/eric/d2ypp2-src/config/URL_config.youtube2__ch_mpwri36r_z5lm2.ini", + "head -3 /home/eric/d2ypp2-src/config/URL_config.youtube2__ch_mpyvqkc0_gj63k.ini", + "grep -E 'stream copy|transcode|speed=|并发|YouTube Live profile' /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpwri36r_z5lm2-out.log | tail -12", + "grep -E 'stream copy|transcode|speed=|并发|YouTube Live profile' /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpyvqkc0_gj63k-out.log | tail -12", + "tail -20 /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpwri36r_z5lm2-out.log", + "tail -20 /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpyvqkc0_gj63k-out.log", + "md5sum /home/eric/d2ypp2-src/douyin_youtube_ffplay.py | head -1", + "grep -c '_use_stream_copy' /home/eric/d2ypp2-src/douyin_youtube_ffplay.py || true", + ] + for cmd in cmds: + print(f"\n=== {cmd[:75]} ===") + out = run(c, cmd) + try: + print(out.encode("ascii", "backslashreplace").decode()[:8000]) + except Exception: + print(out[:8000]) + c.close() + + +if __name__ == "__main__": + main() diff --git a/d2ypp2/tools/remote_hw_check.py b/d2ypp2/tools/remote_hw_check.py new file mode 100644 index 0000000..cc2275e --- /dev/null +++ b/d2ypp2/tools/remote_hw_check.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" + + +def run(c, cmd): + _, o, e = c.exec_command(cmd, timeout=45, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace").strip() + + +def main() -> None: + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(HOST, username=USER, password=PASS, timeout=20) + cmds = [ + "cat /home/eric/d2ypp2-src/config/hardware.env 2>/dev/null || echo NO_HW_ENV", + "ls -la /dev/dri/ 2>/dev/null; ls /dev/mpp_service 2>/dev/null; nvidia-smi 2>/dev/null | head -8", + "ffmpeg -hide_banner -encoders 2>/dev/null | grep -E '264|265|vaapi|nvenc|rkmpp|v4l2'", + "top -bn1 | head -20", + "ps -o pid,pcpu,pmem,etime,cmd -p $(pgrep -f 'ffmpeg.*rtmps://a.rtmps.youtube.com' | tr '\\n' ',') 2>/dev/null", + "grep -E 'NVENC|VAAPI|libx264|hardware|Encoder|fast_audio' /home/eric/d2ypp2-src/logs/*.log 2>/dev/null | tail -30", + f"echo '{PASS}' | sudo -S -p '' journalctl -u 'youtube2__ch_*' --no-pager -n 5 2>/dev/null | tail -20", + "systemctl list-units 'youtube*' --all --no-pager 2>/dev/null | head -15", + "ls -la /home/eric/d2ypp2-src/logs/ 2>/dev/null", + "find /home/eric/d2ypp2-src -name '*.log' -mmin -120 2>/dev/null | head -20", + ] + for cmd in cmds: + print(f"\n=== {cmd[:70]} ===\n{run(c, cmd)[:5000]}") + c.close() + + +if __name__ == "__main__": + main() diff --git a/d2ypp2/tools/remote_lane2_check.py b/d2ypp2/tools/remote_lane2_check.py new file mode 100644 index 0000000..11e8a44 --- /dev/null +++ b/d2ypp2/tools/remote_lane2_check.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +import paramiko +c=paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect('10.88.0.4',username='eric',password='4669805',timeout=15) +cmds=[ +"grep -n '29155980665\\|654138586813' /home/eric/d2ypp2-src/config/URL_config.youtube2__ch_mpwri36r_z5lm2.ini /home/eric/d2ypp2-src/config/URL_config.youtube2__ch_mpyvqkc0_gj63k.ini 2>/dev/null", +"tail -15 /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpyvqkc0_gj63k-out.log", +"curl -sS -m 8 'http://127.0.0.1:8001/restart?process=youtube2__ch_mpyvqkc0_gj63k'", +] +for cmd in cmds: + print('===',cmd) + _,o,e=c.exec_command(cmd,timeout=30) + print(o.read().decode('utf-8','replace')[:3000]) +c.close() diff --git a/d2ypp2/tools/remote_patch_host04.py b/d2ypp2/tools/remote_patch_host04.py new file mode 100644 index 0000000..554e909 --- /dev/null +++ b/d2ypp2/tools/remote_patch_host04.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python3 +"""Remote patch script - run on 10.88.0.4.""" +from __future__ import annotations + +import glob +import json +import os +import urllib.parse +import urllib.request +from pathlib import Path + +BASE = "/home/eric/d2ypp2-src" +TUIC3 = "5d723acc-singbox_tuic3" + +HARDWARE_ENV = """LIVE_HW_DECODER=vaapi +LIVE_HDMI_PLAYER=mpv-drm +LIVE_BROWSER_HWACCEL=auto +LIVE_STABILITY_MODE=balanced +# LIVE_VIDEO_ENCODER= # optional: h264_v4l2m2m / h264_rkmpp when ffmpeg supports it +""" + +STACK_PATCH = { + "SHELLCRASH_NEKO_PROXY_NODE": TUIC3, + "SHELLCRASH_ATTACH_WHEN_DIRECT_OK": "1", + "SHELLCRASH_ATTACH_NEKO": "auto", + "SHELLCRASH_ATTACH_FFMPEG": "auto", + "NEKO_BROWSER_PROXY": "http://host.docker.internal:7894", +} + + +def patch_ini_files() -> None: + removed = 0 + for path in sorted(glob.glob(f"{BASE}/config/youtube.youtube2__*.ini")): + lines_out = [] + for line in Path(path).read_text(encoding="utf-8-sig").splitlines(): + key = line.split("=", 1)[0].strip().lower() + if key in {"video_mode", "bitrate"}: + removed += 1 + continue + lines_out.append(line) + Path(path).write_text("\n".join(lines_out).rstrip() + "\n", encoding="utf-8") + print(f"[ok] lane ini cleaned, removed {removed} copy/bitrate lines") + + +def patch_hardware_profile() -> None: + profile_path = Path(f"{BASE}/config/hardware-profile.json") + if not profile_path.is_file(): + print("[skip] no hardware-profile.json") + return + data = json.loads(profile_path.read_text(encoding="utf-8")) + if isinstance(data, dict) and "relay_strategy" in data: + data.pop("relay_strategy", None) + profile_path.write_text(json.dumps(data, indent=2, ensure_ascii=False) + "\n", encoding="utf-8") + print("[ok] removed relay_strategy from hardware-profile.json") + else: + print("[skip] relay_strategy not present") + + +def patch_system_stack() -> None: + stack_path = Path(f"{BASE}/config/system-stack.env") + lines = stack_path.read_text(encoding="utf-8-sig").splitlines() if stack_path.is_file() else [] + kv: dict[str, str] = {} + for line in lines: + if not line.strip() or line.strip().startswith("#") or "=" not in line: + continue + k, _, v = line.partition("=") + kv[k.strip()] = v + kv.update(STACK_PATCH) + out_lines: list[str] = [] + seen: set[str] = set() + for line in lines: + if "=" not in line or line.strip().startswith("#"): + out_lines.append(line) + continue + k = line.split("=", 1)[0].strip() + if k in STACK_PATCH: + if k not in seen: + out_lines.append(f"{k}={STACK_PATCH[k]}") + seen.add(k) + continue + out_lines.append(line) + seen.add(k) + for k, v in STACK_PATCH.items(): + if k not in seen: + out_lines.append(f"{k}={v}") + stack_path.write_text("\n".join(out_lines).rstrip() + "\n", encoding="utf-8") + print("[ok] system-stack.env patched") + + +def select_shellcrash_node() -> None: + for group in ("🚀 节点选择", "dialer"): + try: + req = urllib.request.Request( + f"http://127.0.0.1:9999/proxies/{urllib.parse.quote(group)}", + data=json.dumps({"name": TUIC3}).encode(), + headers={"Content-Type": "application/json"}, + method="PUT", + ) + with urllib.request.urlopen(req, timeout=8) as resp: + print(f"[ok] shellcrash {group} -> {TUIC3} ({resp.status})") + except Exception as exc: + print(f"[warn] shellcrash {group}: {exc}") + + +def main() -> int: + Path(f"{BASE}/config/hardware.env").write_text(HARDWARE_ENV, encoding="utf-8") + print("[ok] hardware.env") + patch_ini_files() + patch_hardware_profile() + patch_system_stack() + select_shellcrash_node() + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/remote_pm2_logs.py b/d2ypp2/tools/remote_pm2_logs.py new file mode 100644 index 0000000..4720948 --- /dev/null +++ b/d2ypp2/tools/remote_pm2_logs.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" + + +def run(c, cmd): + _, o, e = c.exec_command(cmd, timeout=60, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +def main() -> None: + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(HOST, username=USER, password=PASS, timeout=20) + cmds = [ + "PM2_HOME=/home/eric/d2ypp2-src/.pm2 pm2 list 2>/dev/null", + "tail -40 /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpwri36r_z5lm2-out.log", + "tail -40 /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpyvqkc0_gj63k-out.log", + "grep -E 'NVENC|VAAPI|libx264|fast_audio|Encoder|hardware|使用' /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_*-out.log | tail -30", + "pgrep -af 'ffmpeg.*rtmps' || echo NO_FFMPEG", + "nvidia-smi -L 2>/dev/null; nvidia-smi --query-gpu=utilization.encoder,utilization.gpu --format=csv 2>/dev/null", + "ffmpeg -hide_banner -loglevel error -vaapi_device /dev/dri/renderD128 -f lavfi -i testsrc2=size=128x128:rate=1 -vf format=nv12,hwupload -frames:v 1 -an -c:v h264_vaapi -f null - 2>&1; echo VAAPI_EXIT=$?", + "ffmpeg -hide_banner -loglevel error -f lavfi -i testsrc2=size=128x128:rate=1 -frames:v 1 -an -c:v h264_nvenc -f null - 2>&1; echo NVENC_EXIT=$?", + "uname -m; lscpu | grep -E 'Model name|CPU\\(s\\)|Thread'", + ] + for cmd in cmds: + print(f"\n=== {cmd[:72]} ===") + print(run(c, cmd)[:8000]) + c.close() + + +if __name__ == "__main__": + main() diff --git a/d2ypp2/tools/remote_probe_restart.py b/d2ypp2/tools/remote_probe_restart.py new file mode 100644 index 0000000..ab04c8d --- /dev/null +++ b/d2ypp2/tools/remote_probe_restart.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 +"""Fix config perms, run hardware probe, restart Pro lanes on 10.88.0.4.""" +from __future__ import annotations + +import json +import time +from pathlib import Path + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +REMOTE = "/home/eric/d2ypp2-src" +LANES = ["youtube2__ch_mpwri36r_z5lm2", "youtube2__ch_mpyvqkc0_gj63k"] +ROOT = Path(__file__).resolve().parent.parent +UPLOADS = { + ROOT / "douyin_youtube_ffplay.py": f"{REMOTE}/douyin_youtube_ffplay.py", + ROOT / "scripts" / "hardware_probe.py": f"{REMOTE}/scripts/hardware_probe.py", + ROOT / "config" / "hardware.env.example": f"{REMOTE}/config/hardware.env.example", + ROOT / "youtube.py": f"{REMOTE}/youtube.py", + ROOT / "src" / "spider.py": f"{REMOTE}/src/spider.py", + ROOT / "src" / "recorder_config.py": f"{REMOTE}/src/recorder_config.py", +} + + +def run(c: paramiko.SSHClient, cmd: str, timeout: int = 90) -> str: + _, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +def main() -> int: + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(HOST, username=USER, password=PASS, timeout=20) + sftp = c.open_sftp() + for local, remote in UPLOADS.items(): + sftp.put(str(local), remote) + print(f"uploaded {remote}") + sftp.close() + + print( + run( + c, + f"echo '{PASS}' | sudo -S -p '' chown -R eric:eric {REMOTE}/config && " + f"chmod -R u+rwX {REMOTE}/config && echo perms_ok", + timeout=30, + ) + ) + probe_out = run( + c, + f"cd {REMOTE} && . .venv/bin/activate && " + "python scripts/hardware_probe.py --write --apply-youtube-defaults", + timeout=120, + ) + try: + profile = json.loads(probe_out.strip().splitlines()[-1]) + relay = profile.get("relay_strategy", {}) + print(f"relay_tier={relay.get('tier')} video_mode={relay.get('video_mode')} policy={relay.get('dual_lane_policy')}") + applied = profile.get("youtube_defaults_applied") or [] + if applied: + print(f"ini_updated={len(applied)}") + except (json.JSONDecodeError, IndexError): + print(probe_out[-2000:]) + + print("\n=== hardware.env ===") + print(run(c, f"grep LIVE_RELAY {REMOTE}/config/hardware.env 2>/dev/null || echo MISSING")) + + for lane in LANES: + print(run(c, f"curl -sS -m 60 'http://127.0.0.1:8001/restart?process={lane}'")[:200]) + time.sleep(4) + + print("waiting 50s...") + time.sleep(50) + print(run(c, "pgrep -af 'ffmpeg.*rtmps' || echo none")[:3000]) + raw = run(c, "curl -sS -m 15 'http://127.0.0.1:8001/process_monitor?family=youtube&light=1'") + try: + data = json.loads(raw) + for entry in data.get("entries", []): + if entry.get("pm2") in LANES: + print( + f"{entry['pm2']}: {entry.get('business_status')} " + f"speed={entry.get('ffmpeg_speed')} room={entry.get('source_room_id')}" + ) + except json.JSONDecodeError: + print(raw[:1500]) + + for lane in LANES: + log = run( + c, + f"grep -E 'hardware relay|stream copy|YouTube Live profile|speed=' " + f"{REMOTE}/.pm2/logs/{lane}-out.log | tail -6", + ) + print(f"\n=== {lane} ===\n{log[:1000]}") + c.close() + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/remote_speed_check.py b/d2ypp2/tools/remote_speed_check.py new file mode 100644 index 0000000..2177dd9 --- /dev/null +++ b/d2ypp2/tools/remote_speed_check.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +"""Live streaming speed check on remote host.""" +from __future__ import annotations + +import json +import sys + +import paramiko + +HOST = "10.88.0.4" +USER = "eric" +PASS = "4669805" + + +def run(client: paramiko.SSHClient, cmd: str, timeout: int = 60) -> str: + _, stdout, stderr = client.exec_command(cmd, timeout=timeout, get_pty=True) + out = stdout.read().decode("utf-8", "replace") + err = stderr.read().decode("utf-8", "replace") + return (out + err).strip() + + +def main() -> int: + client = paramiko.SSHClient() + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + client.connect(HOST, username=USER, password=PASS, timeout=20) + + print("=== process_monitor ===") + raw = run(client, "curl -sS -m 15 'http://127.0.0.1:8001/process_monitor?family=youtube'") + try: + data = json.loads(raw) + for entry in data.get("entries", []): + print( + f"{entry.get('pm2')}: status={entry.get('process_status')} " + f"biz={entry.get('business_status')} speed={entry.get('ffmpeg_speed')} " + f"speed_low={entry.get('ffmpeg_speed_low')} pids={entry.get('ffmpeg_pids')}" + ) + note = entry.get("business_note") or "" + if note: + print(f" note: {note}") + except json.JSONDecodeError: + print(raw[:3000]) + + print("\n=== quality_guard ===") + raw = run(client, "curl -sS -m 15 'http://127.0.0.1:8001/youtube/quality_guard'") + try: + q = json.loads(raw) + print(json.dumps(q, ensure_ascii=False, indent=2)[:6000]) + except json.JSONDecodeError: + print(raw[:3000]) + + print("\n=== ffmpeg speed (sudo tail stderr) ===") + print( + run( + client, + f"echo '{PASS}' | sudo -S -p '' bash -lc " + "\"for pid in $(pgrep -f 'ffmpeg.*rtmps://a.rtmps.youtube.com'); do " + "echo PID=$pid; timeout 2 tail -c 4000 /proc/$pid/fd/2 2>/dev/null | tr '\\r' '\\n' | grep speed= | tail -2; done\"", + timeout=30, + ) + ) + + print("\n=== youtube processes ===") + print(run(client, "ps aux | grep 'd2ypp2-src/youtube.py' | grep -v grep")) + + print("\n=== active youtube configs fast_audio ===") + print( + run( + client, + "grep -H 'fast_audio\\|bitrate' /home/eric/d2ypp2-src/config/youtube.youtube2__*.ini 2>/dev/null", + ) + ) + + print("\n=== system load / mem ===") + print(run(client, "uptime; free -h | head -2; nproc")) + + client.close() + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/remote_wait_speed.py b/d2ypp2/tools/remote_wait_speed.py new file mode 100644 index 0000000..a8ab776 --- /dev/null +++ b/d2ypp2/tools/remote_wait_speed.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import time + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +LANES = ["youtube2__ch_mpwri36r_z5lm2", "youtube2__ch_mpyvqkc0_gj63k"] + + +def run(c, cmd, timeout=60): + _, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +def main(): + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(HOST, username=USER, password=PASS, timeout=20) + print("waiting 45s for stable push...") + time.sleep(45) + print(run(c, "pgrep -af 'ffmpeg.*rtmps' || echo none")) + for lane in LANES: + print(f"\n=== {lane} log tail ===") + print(run(c, f"grep -E 'speed=|stream copy|并发推流|FFmpeg]' /home/eric/d2ypp2-src/.pm2/logs/{lane}-out.log | tail -8")) + raw = run(c, "curl -sS -m 15 'http://127.0.0.1:8001/process_monitor?family=youtube&light=1'") + data = json.loads(raw) + for entry in data.get("entries", []): + if entry.get("pm2") in LANES: + print( + f"\n{entry['pm2']}: {entry.get('business_status')} " + f"speed={entry.get('ffmpeg_speed')} low={entry.get('ffmpeg_speed_low')}" + ) + c.close() + + +if __name__ == "__main__": + main() diff --git a/d2ypp2/tools/restart_host04_lanes.py b/d2ypp2/tools/restart_host04_lanes.py new file mode 100644 index 0000000..2aea97e --- /dev/null +++ b/d2ypp2/tools/restart_host04_lanes.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +BASE = "/home/eric/d2ypp2-src" + + +def run(cmd: str, timeout: int = 120) -> str: + client = paramiko.SSHClient() + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + client.connect(HOST, username=USER, password=PASS, timeout=20) + _, stdout, stderr = client.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout) + out = (stdout.read() + stderr.read()).decode("utf-8", "replace") + client.close() + return out.strip() + + +def main() -> int: + print("=== process runner state ===") + raw = run(f"cat {BASE}/.process_runner/state.json 2>/dev/null || echo '{{}}'") + try: + state = json.loads(raw) + for name, row in sorted(state.items()): + if "youtube" not in name: + continue + print(name, "pid=", row.get("pid"), "status=", row.get("status"), "script=", row.get("script")) + except json.JSONDecodeError: + print(raw[:2000]) + + print("\n=== running youtube/ffmpeg ===") + print(run("pgrep -af 'youtube.py|ffmpeg.*rtmps' | grep -v pgrep || echo none")) + + print("\n=== try restart pro lanes via api ===") + for proc in ("youtube2__ch_mpwri36r_z5lm2", "youtube2__ch_mpyvqkc0_gj63k"): + out = run( + "curl -sS -m 60 -X POST 'http://127.0.0.1:8001/restart' " + "-H 'Content-Type: application/json' " + f"-d '{{\"process\":\"{proc}\"}}'" + ) + print(proc, out[:800]) + + print("\n=== after start ===") + print(run("sleep 8; pgrep -af 'youtube.py' | grep -v pgrep")) + print(run("pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep")) + raw = run("curl -sS -m 12 'http://127.0.0.1:8001/process_monitor?family=youtube'") + try: + data = json.loads(raw) + for row in data.get("entries") or []: + print( + row.get("pm2"), + row.get("business_status"), + row.get("is_pushing"), + row.get("label"), + row.get("source_display"), + ) + except json.JSONDecodeError: + print(raw[:2000]) + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/restart_lanes_host04.py b/d2ypp2/tools/restart_lanes_host04.py new file mode 100644 index 0000000..e7778f1 --- /dev/null +++ b/d2ypp2/tools/restart_lanes_host04.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +"""Restart Pro lanes on .4 and verify transcode profile.""" +import sys +import time + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +LANES = [ + "youtube2__ch_mpwri36r_z5lm2", + "youtube2__ch_mpyvqkc0_gj63k", +] + +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect(HOST, username=USER, password=PASS, timeout=15) + + +def run(cmd: str, timeout: int = 90) -> str: + _, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +for lane in LANES: + print(f"\n=== start {lane} ===") + print(run(f"curl -sS -m 30 'http://127.0.0.1:8001/start?process={lane}'")[:500]) + +print("\n=== wait 15s ===") +time.sleep(15) + +print(run("pgrep -af 'ffmpeg.*rtmps' | head -2")) +print(run("grep -hE 'stream copy|transcode|YouTube Live profile|hardware relay' /home/eric/d2ypp2-src/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -8")) +print(run("grep -h 'speed=' /home/eric/d2ypp2-src/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -4")) +print(run("curl -sS -m 10 'http://127.0.0.1:8001/process_monitor?family=youtube' | python3 -m json.tool | head -60")) + +c.close() diff --git a/d2ypp2/tools/restart_youtube_lanes.py b/d2ypp2/tools/restart_youtube_lanes.py new file mode 100644 index 0000000..f53f107 --- /dev/null +++ b/d2ypp2/tools/restart_youtube_lanes.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +"""Restart YouTube lanes via control plane API after relay/copy cleanup.""" +from __future__ import annotations + +import json +import time + +import paramiko + +TARGETS = [ + ("10.88.0.4", "/home/eric/d2ypp2-src"), + ("10.88.0.5", "/opt/live/d2ypp"), +] + + +def run(ssh: paramiko.SSHClient, cmd: str, timeout: int = 120) -> str: + _, stdout, stderr = ssh.exec_command(cmd, timeout=timeout, get_pty=True) + return (stdout.read() + stderr.read()).decode("utf-8", "replace").strip() + + +def lane_names(ssh: paramiko.SSHClient, base: str) -> list[str]: + raw = run(ssh, f"ls {base}/config/youtube.youtube2__*.ini 2>/dev/null") + names: list[str] = [] + for line in raw.splitlines(): + name = line.rsplit("/", 1)[-1] + if name.startswith("youtube.") and name.endswith(".ini"): + names.append(name[len("youtube.") : -len(".ini")]) + return sorted(names) + + +def main() -> int: + for host, base in TARGETS: + ssh = paramiko.SSHClient() + ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + ssh.connect(host, username="eric", password="4669805", timeout=20) + print(f"=== {host} {base} ===") + print("before:", run(ssh, "pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep | head -3")) + for proc in lane_names(ssh, base): + out = run( + ssh, + "curl -sS -m 60 -X POST 'http://127.0.0.1:8001/restart' " + "-H 'Content-Type: application/json' " + f"-d '{{\"process\":\"{proc}\"}}'", + ) + print(f"restart {proc}: {out[:300]}") + time.sleep(10) + print("after:", run(ssh, "pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep | head -3")) + print( + run( + ssh, + f"grep -hE 'YouTube Live profile|stream copy|libx264|LIVE_VIDEO_ENCODER' " + f"{base}/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -8", + ) + ) + ssh.close() + print() + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/sync_host04_from_05.py b/d2ypp2/tools/sync_host04_from_05.py new file mode 100644 index 0000000..c493a60 --- /dev/null +++ b/d2ypp2/tools/sync_host04_from_05.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""Compare and sync relay/proxy config from 10.88.0.5 -> 10.88.0.4.""" +from __future__ import annotations + +import json +import paramiko + +HOSTS = { + "10.88.0.4": ("eric", "4669805"), + "10.88.0.5": ("eric", "4669805"), +} + +COMPARE_CMDS = [ + ("hardware_env", "cat /home/eric/d2ypp2-src/config/hardware.env 2>/dev/null"), + ("hw_profile", "cat /home/eric/d2ypp2-src/config/hardware-profile.json 2>/dev/null"), + ("system_stack", "grep -E 'YOUTUBE|PUSH|PROXY|SHELL|RELAY|PM2|FFMPEG' /home/eric/d2ypp2-src/config/system-stack.env 2>/dev/null | head -40"), + ("proxychains_yt", "cat /home/eric/d2ypp2-src/config/proxychains-youtube.conf 2>/dev/null"), + ("youtube_ini_glob", "grep -H 'video_mode\\|fast_audio\\|bitrate\\|push_proxy\\|rtmps' /home/eric/d2ypp2-src/config/youtube.youtube2__*.ini 2>/dev/null"), + ("shellcrash_proxy", "grep -A30 'proxy-groups:' /tmp/ShellCrash/config.yaml 2>/dev/null | head -35"), + ("shellcrash_selected", "grep -E '^(mode|mixed-port|socks-port|external-controller)' /tmp/ShellCrash/config.yaml 2>/dev/null"), + ("ffmpeg_bin", "which ffmpeg; ffmpeg -version 2>&1 | head -1"), + ("pm2_mode", "which pm2 2>/dev/null; PM2_HOME=/home/eric/d2ypp2-src/.pm2 pm2 list 2>/dev/null | head -8"), + ("state_json", "cat /home/eric/d2ypp2-src/.process_runner/state.json 2>/dev/null"), + ("ffplay_push_proxy", "grep -n 'push_proxy\\|proxychains\\|YOUTUBE_PUSH' /home/eric/d2ypp2-src/douyin_youtube_ffplay.py 2>/dev/null | head -15"), +] + + +def run(host: str, user: str, pw: str, cmd: str, timeout: int = 45) -> str: + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(host, username=user, password=pw, timeout=15) + _, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True) + out = (o.read() + e.read()).decode("utf-8", "replace") + c.close() + return out + + +def main() -> int: + data: dict[str, dict[str, str]] = {} + for host, (user, pw) in HOSTS.items(): + data[host] = {} + print(f"\n{'#' * 60}\n# {host}\n{'#' * 60}") + for label, cmd in COMPARE_CMDS: + try: + out = run(host, user, pw, cmd) + data[host][label] = out + print(f"\n--- {label} ---") + print(out[:3500].encode("ascii", "backslashreplace").decode()) + except Exception as exc: + print(f"ERR {label}: {exc}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/test_douyin_fetch.py b/d2ypp2/tools/test_douyin_fetch.py new file mode 100644 index 0000000..64c9985 --- /dev/null +++ b/d2ypp2/tools/test_douyin_fetch.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +"""Test Douyin fetch paths on remote or local.""" +from __future__ import annotations + +import asyncio +import sys +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent +if str(ROOT) not in sys.path: + sys.path.insert(0, str(ROOT)) + +from src.spider import get_douyin_stream_data, get_douyin_web_stream_data + + +async def main() -> None: + url = sys.argv[1] if len(sys.argv) > 1 else "https://live.douyin.com/29155980665" + proxy = sys.argv[2] if len(sys.argv) > 2 else "" + cookie_arg = sys.argv[3] if len(sys.argv) > 3 else "__default__" + proxy_addr = proxy or None + cookies = None if cookie_arg == "__default__" else cookie_arg + for name, fn in ( + ("web", get_douyin_web_stream_data), + ("html", get_douyin_stream_data), + ): + data = await fn(url, proxy_addr=proxy_addr, cookies=cookies) + anchor = str(data.get("anchor_name") or "") + print( + f"{name}: anchor={anchor[:30] or '-'} status={data.get('status')} " + f"stream={bool(data.get('stream_url'))}" + ) + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/d2ypp2/tools/tmp_lane2_grep.py b/d2ypp2/tools/tmp_lane2_grep.py new file mode 100644 index 0000000..cd2dcc3 --- /dev/null +++ b/d2ypp2/tools/tmp_lane2_grep.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 +import paramiko +c=paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect('10.88.0.4',username='eric',password='4669805',timeout=15) +cmd=r"""grep -E 'stream copy|ffprobe|probe|transcode|不可用|YouTube Live profile' /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpyvqkc0_gj63k-out.log | tail -25""" +_,o,_=c.exec_command(cmd,timeout=30) +print(o.read().decode('utf-8','replace').encode('ascii','backslashreplace').decode()) +c.close() diff --git a/d2ypp2/tools/verify_deploy_host04.py b/d2ypp2/tools/verify_deploy_host04.py new file mode 100644 index 0000000..62989e1 --- /dev/null +++ b/d2ypp2/tools/verify_deploy_host04.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python3 +"""Post-deploy verify on 10.88.0.4.""" +from __future__ import annotations + +import json +import sys + +import paramiko + +HOST, USER, PASS, BASE = "10.88.0.4", "eric", "4669805", "/home/eric/d2ypp2-src" +OUT_PATH = sys.argv[1] if len(sys.argv) > 1 else None + + +def emit(text: str) -> None: + if OUT_PATH: + with open(OUT_PATH, "a", encoding="utf-8") as fh: + fh.write(text + "\n") + else: + sys.stdout.buffer.write((text + "\n").encode("utf-8", errors="replace")) + + +def run(ssh: paramiko.SSHClient, cmd: str, timeout: int = 90) -> str: + _, o, e = ssh.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +def main() -> int: + if OUT_PATH: + open(OUT_PATH, "w", encoding="utf-8").close() + + ssh = paramiko.SSHClient() + ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + ssh.connect(HOST, username=USER, password=PASS, timeout=20) + + checks = { + "health": run(ssh, "curl -sf -m 8 http://127.0.0.1:8001/health || echo DOWN"), + "hide_relay_snapshot": run( + ssh, f"grep -c 'HIDE_YOUTUBE_RELAY_SNAPSHOT = true' {BASE}/web-console/components/live-product/LiveYoutubeUnmannedView.tsx" + ).strip(), + "hide_event_hub": run( + ssh, f"grep -c 'HIDE_YOUTUBE_LIVE_EVENT_HUB = true' {BASE}/web-console/components/live-product/LiveYoutubeUnmannedView.tsx" + ).strip(), + "static_chunk": run( + ssh, f"ls {BASE}/web-console/out/_next/static/chunks/904-*.js 2>/dev/null | tail -1" + ).strip(), + "proxychains_fn": run( + ssh, f"grep -c 'def _proxychains_config_for_push' {BASE}/douyin_youtube_ffplay.py" + ).strip(), + "ffmpeg": run(ssh, "pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep | head -2"), + } + emit("=== deploy verify ===") + for key, value in checks.items(): + emit(f"{key}: {value[:500]}") + + raw = run(ssh, "curl -sS -m 12 'http://127.0.0.1:8001/process_monitor?family=youtube'") + emit("\n=== lanes ===") + try: + for row in json.loads(raw).get("entries", []): + pm2 = row.get("pm2", "") + if pm2.startswith("youtube"): + emit( + f"{pm2}: {row.get('business_status')} pushing={row.get('is_pushing')} speed={row.get('ffmpeg_speed')}" + ) + except json.JSONDecodeError: + emit(f"process_monitor failed: {raw[:300]}") + + ok = ( + "ok" in checks["health"] + and checks["hide_relay_snapshot"] == "1" + and checks["hide_event_hub"] == "1" + and checks["proxychains_fn"] == "1" + ) + emit(f"\nDEPLOY_TEST: {'PASS' if ok else 'PARTIAL'}") + ssh.close() + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/verify_host04.py b/d2ypp2/tools/verify_host04.py new file mode 100644 index 0000000..ea5c7fa --- /dev/null +++ b/d2ypp2/tools/verify_host04.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +import paramiko, sys + +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect("10.88.0.4", username="eric", password="4669805", timeout=15) +cmds = [ + "grep -H 'video_mode\\|bitrate' /home/eric/d2ypp2-src/config/youtube.youtube2__*.ini 2>/dev/null | head -15 || echo no_copy_lines", + "grep relay_strategy /home/eric/d2ypp2-src/config/hardware-profile.json || echo no_relay_strategy", + "curl -sS -m 8 -x socks5://127.0.0.1:7890 https://www.gstatic.com/generate_204 -w 'gstatic=%{http_code} t=%{time_total}\n' -o /dev/null", + "curl -sS -m 10 -x socks5://127.0.0.1:7890 https://a.rtmps.youtube.com/ -w 'yt_t=%{time_total}\n' -o /dev/null 2>&1 | tail -1", + "pgrep -af 'ffmpeg.*rtmps' || echo no_ffmpeg", + "grep -hE 'stream copy|transcode|YouTube Live profile' /home/eric/d2ypp2-src/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -4", +] +for cmd in cmds: + _, o, e = c.exec_command(cmd, timeout=45, get_pty=True) + out = (o.read() + e.read()).decode("utf-8", "replace") + sys.stdout.buffer.write(f"\n> {cmd[:70]}\n".encode()) + sys.stdout.buffer.write(out.encode("utf-8", "replace")) +c.close() diff --git a/d2ypp2/tools/verify_host04_after_fix.py b/d2ypp2/tools/verify_host04_after_fix.py new file mode 100644 index 0000000..813b4c3 --- /dev/null +++ b/d2ypp2/tools/verify_host04_after_fix.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import time + +import paramiko + +HOST, USER, PASS = "10.88.0.4", "eric", "4669805" +BASE = "/home/eric/d2ypp2-src" + + +def run(cmd: str, timeout: int = 90) -> str: + client = paramiko.SSHClient() + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + client.connect(HOST, username=USER, password=PASS, timeout=20) + _, stdout, stderr = client.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout) + out = (stdout.read() + stderr.read()).decode("utf-8", "replace") + client.close() + return out.strip() + + +def main() -> int: + for attempt in range(1, 21): + health = run("curl -sf -m 4 http://127.0.0.1:8001/health; echo") + if '"status":"ok"' in health or '"status": "ok"' in health: + print(f"health ok (attempt {attempt})") + break + print(f"waiting health attempt {attempt}: {health[:120]}") + time.sleep(2) + else: + print("health failed") + print(run(f"echo {PASS!r} | sudo -S -p '' systemctl status live-console.service --no-pager")) + + raw = run("curl -sS -m 12 'http://127.0.0.1:8001/process_monitor?family=youtube'") + print("\n=== process_monitor ===") + try: + data = json.loads(raw) + entries = data.get("entries") or [] + print("entries", len(entries)) + for row in entries: + print( + f" {row.get('pm2')}: business={row.get('business_status')} pushing={row.get('is_pushing')} " + f"label={row.get('label')} display={row.get('source_display') or row.get('source_title') or '-'}" + ) + except json.JSONDecodeError: + print(raw[:2500]) + + print("\n=== served bundle ===") + print(run("curl -sS -m 8 http://127.0.0.1/ | grep -o 'page-[a-z0-9]*\\.js' | head -1")) + + print("\n=== chunk string hits ===") + print( + run( + "python3 -c \"from pathlib import Path; import glob; " + f"hits=[]; " + f"files=glob.glob('{BASE}/web-console/out/_next/static/chunks/**/*.js', recursive=True); " + "needles=['Douyin','Current relay lane','Pro relay status','Waiting source','Pushing']; " + "exec('for p in files:\\n t=Path(p).read_text(\\\"utf-8\\\",errors=\\\"replace\\\")\\n for n in needles:\\n if n in t: hits.append((n,p))'); " + "[print(h) for h in hits[:12]]; print('files',len(files))\"" + ) + ) + + print("\n=== ffmpeg / youtube ===") + print(run("pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep | wc -l")) + print(run("pgrep -af 'youtube.py' | grep -v pgrep")) + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/tools/verify_host04_regression.py b/d2ypp2/tools/verify_host04_regression.py new file mode 100644 index 0000000..7f23ea3 --- /dev/null +++ b/d2ypp2/tools/verify_host04_regression.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python3 +"""Finish host04 deploy: restart lanes and verify regression.""" +from __future__ import annotations + +import json +import time + +import paramiko + +HOST, USER, PASS, BASE = "10.88.0.4", "eric", "4669805", "/home/eric/d2ypp2-src" + + +def run(ssh: paramiko.SSHClient, cmd: str, timeout: int = 120) -> str: + _, o, e = ssh.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout, get_pty=True) + return (o.read() + e.read()).decode("utf-8", "replace") + + +def lane_names(ssh: paramiko.SSHClient) -> list[str]: + raw = run(ssh, f"ls {BASE}/config/youtube.youtube2__*.ini 2>/dev/null") + out: list[str] = [] + for line in raw.splitlines(): + name = line.rsplit("/", 1)[-1] + if name.startswith("youtube.") and name.endswith(".ini"): + out.append(name[len("youtube.") : -len(".ini")]) + return sorted(out) + + +def main() -> int: + ssh = paramiko.SSHClient() + ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + ssh.connect(HOST, username=USER, password=PASS, timeout=20) + + print("health:", run(ssh, "curl -sf -m 8 http://127.0.0.1:8001/health && echo OK")) + for proc in lane_names(ssh): + out = run( + ssh, + "curl -sS -m 60 -X POST 'http://127.0.0.1:8001/restart' " + "-H 'Content-Type: application/json' " + f"-d '{json.dumps({'process': proc})}'", + ) + print(f"restart {proc}: {out[:240]}") + time.sleep(30) + + copy_fn = run(ssh, f"grep -c _resolve_stream_copy_plan {BASE}/douyin_youtube_ffplay.py 2>/dev/null || echo 0").strip() + relay = run(ssh, f"grep -c relay_strategy {BASE}/config/hardware-profile.json 2>/dev/null || echo 0").strip() + ffmpeg = run(ssh, "pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep | head -2") + profile = run( + ssh, + "grep -hE 'YouTube Live profile|stream copy|libx264' " + f"{BASE}/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -8", + ) + qg = run( + ssh, + "curl -sS -m 12 http://127.0.0.1:8001/hub/youtube/quality_guard | " + "python3 -c \"import sys,json; d=json.load(sys.stdin); print(d.get('ffmpeg_profile',{}).get('target','?'))\"", + ) + raw = run(ssh, "curl -sS -m 12 'http://127.0.0.1:8001/process_monitor?family=youtube'") + print("\n--- ffmpeg processes ---\n", ffmpeg) + print("\n--- push profile log ---\n", profile) + print("\n--- quality guard target ---\n", qg) + try: + rows = json.loads(raw).get("entries") or [] + print("\n--- process_monitor ---") + for row in rows: + print( + f" {row.get('pm2')}: {row.get('business_status')} pushing={row.get('is_pushing')} " + f"speed={row.get('ffmpeg_speed')} display={row.get('source_display') or '-'}" + ) + except json.JSONDecodeError: + print("process_monitor raw:", raw[:800]) + + ok = copy_fn in {"0", ""} and relay in {"0", ""} and ("libx264" in ffmpeg or "H.264 libx264" in profile) + print(f"\n回归源码: {'PASS' if ok else 'PARTIAL'} (copy_fn={copy_fn}, relay={relay}, libx264={'yes' if 'libx264' in ffmpeg else 'no'})") + ssh.close() + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/d2ypp2/web-console/components/live-product/LiveProcessLiveLogCard.tsx b/d2ypp2/web-console/components/live-product/LiveProcessLiveLogCard.tsx index 5bed406..c5ece95 100644 --- a/d2ypp2/web-console/components/live-product/LiveProcessLiveLogCard.tsx +++ b/d2ypp2/web-console/components/live-product/LiveProcessLiveLogCard.tsx @@ -4,6 +4,12 @@ import { AlertTriangle, ExternalLink, Pause, Play, RefreshCw } from "lucide-reac import { useCallback, useEffect, useRef, useState } from "react"; import { formatPollBadge } from "@/lib/adaptivePoll"; +import { + formatBitrateLabel, + formatFfmpegMetricValue, + formatFfmpegStatsBrief, + mergeFfmpegMetrics, +} from "@/lib/ffmpegMetrics"; import { douyinSourceDisplayFrom, extractDouyinCurrentRoomFromLog, @@ -22,6 +28,11 @@ type StatusPayload = { ffmpeg_pids?: number[]; log_age_seconds?: number | null; is_pushing?: boolean; + ffmpeg_speed?: number | null; + ffmpeg_frame?: number | null; + ffmpeg_time_seconds?: number | null; + ffmpeg_speed_low?: boolean; + ffmpeg_progress_stalled?: boolean; source_title?: string; source_room_id?: string; source_url?: string; @@ -53,6 +64,8 @@ type MonitorRowHint = { ffmpeg_active?: boolean; ffmpeg_speed?: number | null; ffmpeg_frame?: number | null; + ffmpeg_speed_low?: boolean; + ffmpeg_progress_stalled?: boolean; is_pushing?: boolean; }; @@ -69,6 +82,8 @@ type Props = { refreshToken?: number; /** process_monitor 行:补全 light status 缺失的 FFmpeg 指标 */ monitorRow?: MonitorRowHint; + /** Pro 线路名:推流中时固定显示频道名 */ + preferredTitle?: string; }; function businessLine(t: TFn, raw: string | undefined, note: string | undefined): string { @@ -92,7 +107,8 @@ function businessLine(t: TFn, raw: string | undefined, note: string | undefined) return t("暂无业务状态", "No business-state hint yet"); } -function businessShortLine(t: TFn, raw: string | undefined): string { +function businessShortLine(t: TFn, raw: string | undefined, pushing = false): string { + if (pushing) return t("推流中", "Pushing"); const s = (raw || "").toLowerCase(); if (s === "streaming") return t("推流中", "Pushing"); if (s === "relay_slow") return t("低速", "Slow"); @@ -137,6 +153,7 @@ export function LiveProcessLiveLogCard({ pollMs = 1000, refreshToken = 0, monitorRow, + preferredTitle, }: Props) { const [processStatus, setProcessStatus] = useState(""); const [recentLog, setRecentLog] = useState(""); @@ -152,13 +169,18 @@ export function LiveProcessLiveLogCard({ const [sourceAmbiguous, setSourceAmbiguous] = useState(false); const [sourceCurrent, setSourceCurrent] = useState(false); const [isPushing, setIsPushing] = useState(false); + const [statusFfmpegSpeed, setStatusFfmpegSpeed] = useState(null); + const [statusFfmpegFrame, setStatusFfmpegFrame] = useState(null); + const [statusFfmpegTime, setStatusFfmpegTime] = useState(null); + const [statusSpeedLow, setStatusSpeedLow] = useState(false); + const [statusProgressStalled, setStatusProgressStalled] = useState(false); const [paused, setPaused] = useState(false); const [liveSince, setLiveSince] = useState(null); const [nowTick, setNowTick] = useState(0); const [pageVisible, setPageVisible] = useState(true); const outRef = useRef(null); const errRef = useRef(null); - const prevOnlineRef = useRef(false); + const prevPushingRef = useRef(false); const pullInFlightRef = useRef(false); const pullQueuedRef = useRef(false); const currentProcRef = useRef(currentProc); @@ -173,9 +195,25 @@ export function LiveProcessLiveLogCard({ isPushing || !!monitorRow?.is_pushing || ["streaming", "relay_slow"].includes(businessStatus.trim().toLowerCase()); - const monitorSpeed = - typeof monitorRow?.ffmpeg_speed === "number" ? monitorRow.ffmpeg_speed.toFixed(2) : null; - const monitorFrame = typeof monitorRow?.ffmpeg_frame === "number" ? String(monitorRow.ffmpeg_frame) : null; + const liveMetrics = mergeFfmpegMetrics( + { + ffmpeg_speed: statusFfmpegSpeed ?? monitorRow?.ffmpeg_speed, + ffmpeg_frame: statusFfmpegFrame ?? monitorRow?.ffmpeg_frame, + ffmpeg_active: monitorRow?.ffmpeg_active, + is_pushing: pushingNow, + ffmpeg_speed_low: statusSpeedLow || monitorRow?.ffmpeg_speed_low, + ffmpeg_progress_stalled: statusProgressStalled || monitorRow?.ffmpeg_progress_stalled, + }, + undefined, + `${recentLog}\n${recentError}`, + ); + const encodedDurationLabel = + typeof statusFfmpegTime === "number" && statusFfmpegTime > 0 + ? fmtDuration(Math.max(0, Math.floor(statusFfmpegTime))) + : null; + const liveStatsText = formatFfmpegStatsBrief(liveMetrics, { + live: pushingNow || onlineNow || !!monitorRow?.ffmpeg_active, + }); const ffmpegWorkerLabel = ffmpegPids.length ? ffmpegPids.join(", ") : pushingNow || monitorRow?.ffmpeg_active @@ -207,7 +245,12 @@ export function LiveProcessLiveLogCard({ (suppressAmbiguousBackend ? "" : sourceDisplay) || (suppressAmbiguousBackend ? "" : sourceTitle) || localSourceLabel || + preferredTitle?.trim() || (primaryRoomId ? `抖音直播间 ${primaryRoomId}` : ""); + const douyinSourceSubtitle = + preferredTitle?.trim() && primarySourceLabel && preferredTitle.trim() !== primarySourceLabel + ? preferredTitle.trim() + : ""; const youtubeKeyRejected = businessStatus.trim().toLowerCase() === "youtube_key_rejected"; const pull = useCallback(async () => { @@ -239,14 +282,22 @@ export function LiveProcessLiveLogCard({ setSourceAmbiguous(!!data.source_ambiguous); setSourceCurrent(!!data.source_current); setIsPushing(!!data.is_pushing); - const online = /^(online|running)$/i.test(ps); - if (online && !prevOnlineRef.current) { + setStatusFfmpegSpeed(typeof data.ffmpeg_speed === "number" ? data.ffmpeg_speed : null); + setStatusFfmpegFrame(typeof data.ffmpeg_frame === "number" ? data.ffmpeg_frame : null); + setStatusFfmpegTime(typeof data.ffmpeg_time_seconds === "number" ? data.ffmpeg_time_seconds : null); + setStatusSpeedLow(!!data.ffmpeg_speed_low); + setStatusProgressStalled(!!data.ffmpeg_progress_stalled); + const pushing = !!( + data.is_pushing || + ["streaming", "relay_slow"].includes((data.business_status || "").trim().toLowerCase()) + ); + if (pushing && !prevPushingRef.current) { setLiveSince(Date.now()); } - if (!online) { + if (!pushing) { setLiveSince(null); } - prevOnlineRef.current = online; + prevPushingRef.current = pushing; } catch { if (requestId !== requestSeqRef.current || targetProc !== currentProcRef.current.trim()) return; setProcessStatus("error"); @@ -261,6 +312,12 @@ export function LiveProcessLiveLogCard({ setSourceAmbiguous(false); setSourceCurrent(false); setIsPushing(false); + setStatusFfmpegSpeed(null); + setStatusFfmpegFrame(null); + setStatusFfmpegTime(null); + setStatusSpeedLow(false); + setStatusProgressStalled(false); + prevPushingRef.current = false; } finally { pullInFlightRef.current = false; if (pullQueuedRef.current) { @@ -289,8 +346,13 @@ export function LiveProcessLiveLogCard({ setSourceAmbiguous(false); setSourceCurrent(false); setIsPushing(false); + setStatusFfmpegSpeed(null); + setStatusFfmpegFrame(null); + setStatusFfmpegTime(null); + setStatusSpeedLow(false); + setStatusProgressStalled(false); setLiveSince(null); - prevOnlineRef.current = false; + prevPushingRef.current = false; return; } setProcessStatus(""); @@ -307,8 +369,13 @@ export function LiveProcessLiveLogCard({ setSourceAmbiguous(false); setSourceCurrent(false); setIsPushing(false); + setStatusFfmpegSpeed(null); + setStatusFfmpegFrame(null); + setStatusFfmpegTime(null); + setStatusSpeedLow(false); + setStatusProgressStalled(false); setLiveSince(null); - prevOnlineRef.current = false; + prevPushingRef.current = false; void pull(); }, [currentProc, pull]); @@ -433,34 +500,75 @@ export function LiveProcessLiveLogCard({ className={`mt-2 inline-flex max-w-full rounded-full px-2.5 py-0.5 text-[11px] font-medium ring-1 ${businessBadgeClass(businessStatus)}`} title={businessLine(t, businessStatus, businessNote)} > - {businessShortLine(t, businessStatus)} + {businessShortLine(t, businessStatus, pushingNow)}
-

{t("本次在线时长(估算)", "Online duration (est.)")}

+

+ {pushingNow ? t("推流时长(估算)", "Relay duration (est.)") : t("进程在线时长(估算)", "Process uptime (est.)")} +

{durationLabel}

+ {encodedDurationLabel ? ( +

+ {t("已编码", "Encoded")} {encodedDurationLabel} +

+ ) : null}

{t("FFmpeg workers", "FFmpeg workers")}

{ffmpegWorkerLabel}

- {monitorSpeed || monitorFrame ? ( -

- {monitorSpeed ? `speed ${monitorSpeed}x` : ""} - {monitorSpeed && monitorFrame ? " · " : ""} - {monitorFrame ? `frame ${monitorFrame}` : ""} -

- ) : null} {logAgeSeconds != null ? (

{t("日志心跳", "Log heartbeat")} {fmtDuration(Math.max(0, Math.floor(logAgeSeconds)))}

) : null}
+
+

{t("实时转推指标", "Live relay metrics")}

+

+ {liveStatsText || t("等待 FFmpeg 上报 fps / speed / frame", "Waiting for FFmpeg fps / speed / frame")} +

+
+

+ fps + {formatFfmpegMetricValue(liveMetrics.fps)} +

+

+ speed + {formatFfmpegMetricValue(liveMetrics.speed, "x")} +

+

+ frame + {formatFfmpegMetricValue(liveMetrics.frame, "", 0)} +

+

+ {t("码率", "Bitrate")} + {formatBitrateLabel(liveMetrics.bitrate) ?? "—"} +

+
+
{primarySourceLabel ? (
-

{t("当前转播源", "Current relay source")}

+

+ {pushingNow && preferredTitle?.trim() + ? t("当前转播线路", "Current relay lane") + : t("当前转播源", "Current relay source")} +

{primarySourceLabel}

+ {douyinSourceSubtitle ? ( +

+ {t("抖音源", "Douyin")}: {douyinSourceSubtitle} +

+ ) : null}
) : null} {showKeyRow ? ( diff --git a/d2ypp2/web-console/components/live-product/LiveYoutubeUnmannedView.tsx b/d2ypp2/web-console/components/live-product/LiveYoutubeUnmannedView.tsx index 79a186d..e33dab8 100644 --- a/d2ypp2/web-console/components/live-product/LiveYoutubeUnmannedView.tsx +++ b/d2ypp2/web-console/components/live-product/LiveYoutubeUnmannedView.tsx @@ -46,6 +46,13 @@ import { urlConfigPollMs, } from "@/lib/adaptivePoll"; import { normalizeBrowserReachableHttpUrl } from "@/lib/panelUrls"; +import { + formatBitrateLabel, + formatFfmpegMetricValue, + formatFfmpegStatsBrief, + mergeFfmpegMetrics, + type FfmpegMetrics, +} from "@/lib/ffmpegMetrics"; type ProcessEntry = { pm2: string; script: string; label: string }; @@ -171,6 +178,12 @@ const PRO_PM2_RESERVED = new Set(["douyin_youtube", "tiktok", "obs", "web"]); /** UI 暂时隐藏「多频道 Pro」切换(DOM 与逻辑保留,改 false 即可恢复) */ const HIDE_YOUTUBE_MULTI_PRO_TOGGLE = false; +/** UI 隐藏顶部「转播实况」概览卡(状态、指标网格、打开源站等) */ +const HIDE_YOUTUBE_RELAY_SNAPSHOT = true; + +/** UI 隐藏「直播事件中枢」板块 */ +const HIDE_YOUTUBE_LIVE_EVENT_HUB = true; + type ProLaneDraft = { name: string; streamKey: string; @@ -197,7 +210,35 @@ function laneDraftsFromChannels(channels: YoutubeProChannel[]): Record= 100 ? 0 : 2).replace(/\.00$/, "")}${suffix}`; } +function laneStatusEmoji(row?: LiveProcRow): string { + const business = (row?.business_status || "").trim().toLowerCase(); + if (business === "streaming") return "🟢"; + if (business === "relay_slow") return "🟡"; + if (business === "source_stalled") return "🟠"; + if (business === "youtube_key_rejected" || business === "error") return "🔴"; + if (business === "source_live") return "🔵"; + if (business === "waiting_source") return "⚪"; + return "⚫"; +} + +function speedToneClass(speed?: number, speedLow?: boolean, progressStalled?: boolean): string { + if (progressStalled) return "text-rose-300"; + if (speedLow || (typeof speed === "number" && speed > 0 && speed < 0.95)) return "text-amber-200"; + if (typeof speed === "number" && speed >= 0.95) return "text-emerald-200"; + return "text-cyan-100"; +} + +function MetricPulseCard({ + label, + value, + helper, + warn = false, + accent = "cyan", +}: { + label: string; + value: string; + helper: string; + warn?: boolean; + accent?: "cyan" | "emerald" | "amber" | "violet"; +}) { + const ring = + accent === "emerald" + ? "from-emerald-500/20 via-transparent to-cyan-500/10" + : accent === "amber" + ? "from-amber-500/20 via-transparent to-rose-500/10" + : accent === "violet" + ? "from-violet-500/20 via-transparent to-cyan-500/10" + : "from-cyan-500/20 via-transparent to-violet-500/10"; + return ( +
+
+
+

{label}

+

+ {value} +

+

{helper}

+
+
+ ); +} + +function qualityLaneMetrics( + row: LiveProcRow | undefined, + qualityLane: YoutubeQualityLane | undefined, +): FfmpegMetrics & { speedLow?: boolean; progressStalled?: boolean; live: boolean } { + return mergeFfmpegMetrics(row, qualityLane?.metrics, ""); +} + function nonCommentUrlLinesOf(text: string): string[] { return text .split(/\r?\n/) @@ -949,7 +1050,7 @@ export function LiveYoutubeUnmannedView({ name: "线路 1", streamKey: "", urlLines: "", - pm2Name: "youtube", + pm2Name: defaultPm2NameForChannel(id), notes: "", }, ]; @@ -1928,10 +2029,19 @@ export function LiveYoutubeUnmannedView({ if (ch && ch.id === active?.id) return proUrlDraft; return (ch?.urlLines ?? "").trim() || proUrlDraft; }, [active?.id, channels, mode, proUrlDraft, runtimeLogProc, singleUrlDraft]); - const overviewSource = douyinSourceDisplayFor(overviewRow, monitorUrlDraft); + const overviewChannel = + mode === "pro" ? channels.find((channel) => resolveChannelPm2(channel) === runtimeLogProc) : null; + const overviewLaneIndex = overviewChannel ? channels.findIndex((channel) => channel.id === overviewChannel.id) : -1; + const overviewLaneName = overviewChannel + ? cleanLaneName(overviewChannel.name, overviewLaneIndex >= 0 ? overviewLaneIndex : 0) + : ""; + const overviewSource = proLanePrimaryTitle(overviewLaneName, overviewRow, monitorUrlDraft); + const overviewDouyinSubtitle = proLaneDouyinSubtitle(overviewRow, monitorUrlDraft, overviewLaneName); + const overviewStatusLabel = proLaneStatusLabel(overviewRow, t); const overviewSourceUrl = douyinSourceUrlFor(overviewRow, monitorUrlDraft); const overviewQualityLane = qualityGuard?.lanes?.find((lane) => lane.process === runtimeLogProc); const overviewQualityMetrics = overviewQualityLane?.metrics; + const overviewLiveMetrics = qualityLaneMetrics(overviewRow, overviewQualityLane); const overviewQualityScore = overviewQualityLane?.score ?? null; const overviewPushingLanes = mode === "pro" @@ -1939,23 +2049,11 @@ export function LiveYoutubeUnmannedView({ : overviewPushing ? 1 : 0; - const overviewFfmpegSpeed = - typeof overviewRow?.ffmpeg_speed === "number" - ? overviewRow.ffmpeg_speed.toFixed(2) - : typeof overviewQualityMetrics?.speed === "number" - ? overviewQualityMetrics.speed.toFixed(2) - : null; - const overviewFfmpegFrame = - typeof overviewRow?.ffmpeg_frame === "number" - ? String(overviewRow.ffmpeg_frame) - : typeof overviewQualityMetrics?.frame === "number" - ? String(overviewQualityMetrics.frame) - : null; - const overviewBitrate = - typeof overviewQualityMetrics?.bitrate === "number" - ? `${Math.round(overviewQualityMetrics.bitrate)} kbps` - : null; - const overviewRelayDuration = + const overviewFfmpegSpeed = formatFfmpegMetricValue(overviewLiveMetrics.speed, "x"); + const overviewFfmpegFrame = formatFfmpegMetricValue(overviewLiveMetrics.frame, "", 0); + const overviewFfmpegFps = formatFfmpegMetricValue(overviewLiveMetrics.fps); + const overviewBitrate = overviewLiveMetrics.live ? formatBitrateLabel(overviewLiveMetrics.bitrate) : null; + const overviewEncodedDuration = typeof overviewRow?.ffmpeg_time_seconds === "number" ? fmtDurationHuman(overviewRow.ffmpeg_time_seconds, t) : null; @@ -2606,7 +2704,13 @@ export function LiveYoutubeUnmannedView({
{qualityLanes.map((lane) => { - const laneDisplay = (lane.source_display || lane.source_title || "").trim() || lane.label || lane.process || "-"; + const laneLabelName = (lane.label || "").replace(/^YouTube Pro\s*·\s*/i, "").trim(); + const laneRow = rowForPm2(String(lane.process || "")); + const laneLiveMetrics = qualityLaneMetrics(laneRow, lane); + const laneDisplay = + (lane.source_display || lane.source_title || "").trim() || laneLabelName || lane.label || lane.process || "-"; + const laneDouyinSubtitle = + lane.is_pushing && laneLabelName && laneDisplay !== laneLabelName ? laneLabelName : ""; const laneTech = [lane.label, lane.process].filter(Boolean).join(" · "); return (
@@ -2620,6 +2724,9 @@ export function LiveYoutubeUnmannedView({ {lane.rtmps ? "RTMPS" : t("非 RTMPS", "No RTMPS")}
+ {laneDouyinSubtitle && laneDouyinSubtitle !== laneDisplay ? ( +

{laneDouyinSubtitle}

+ ) : null}

{laneTech || "-"}

{(lane.issues || []).slice(0, 3).map((issue, idx) => ( @@ -2634,9 +2741,23 @@ export function LiveYoutubeUnmannedView({

{lane.score ?? 0}

-

fps{metricText(lane.metrics?.fps)}

-

speed{metricText(lane.metrics?.speed, "x")}

-

kbps{metricText(lane.metrics?.bitrate)}

+

fps{formatFfmpegMetricValue(laneLiveMetrics.fps)}

+

+ speed + + {formatFfmpegMetricValue(laneLiveMetrics.speed, "x")} + +

+

+ {t("码率", "Bitrate")} + {lane.is_pushing ? formatBitrateLabel(laneLiveMetrics.bitrate) ?? "—" : "—"} +

+

+ frame + + {formatFfmpegMetricValue(laneLiveMetrics.frame, "", 0)} + +

drop{lane.metrics?.drop ?? "-"}

urls{lane.url_count ?? 0}

err{lane.metrics?.error_count ?? 0}

@@ -2666,7 +2787,7 @@ export function LiveYoutubeUnmannedView({

FFmpeg

-

{qualityGuard?.ffmpeg_profile?.target || "1080p30 / RTMPS / AAC / stable relay"}

+

{qualityGuard?.ffmpeg_profile?.target || "720p30 H.264 CBR / RTMPS / AAC 128k"}

    {(qualityGuard?.ffmpeg_profile?.guardrails || []).slice(0, 4).map((item) => (
  • - {item}
  • @@ -2697,17 +2818,17 @@ export function LiveYoutubeUnmannedView({ - {businessStatusLabel(overviewRow, t)} + {overviewStatusLabel} - {overviewPushing ? ( - - {t("正在推流", "Pushing")} - - ) : null}

{overviewSource || t("未配置抖音直播源", "No Douyin source configured")}

+ {overviewDouyinSubtitle && overviewDouyinSubtitle !== overviewSource ? ( +

+ {t("抖音源", "Douyin")}: {overviewDouyinSubtitle} +

+ ) : null}

{runtimeLogProc || "—"} {mode === "pro" && overviewPushingLanes > 0 @@ -2754,54 +2875,66 @@ export function LiveYoutubeUnmannedView({ {[ { label: t("FFmpeg 速度", "FFmpeg speed"), - value: overviewFfmpegSpeed ? `${overviewFfmpegSpeed}x` : "—", - warn: overviewRow?.ffmpeg_speed_low, - helper: overviewRelayDuration || t("等待进程上报", "Waiting for metrics"), + value: overviewFfmpegSpeed, + warn: overviewLiveMetrics.speedLow, + helper: overviewLiveMetrics.live + ? overviewEncodedDuration + ? `${t("已编码", "Encoded")} ${overviewEncodedDuration}` + : t("实时倍速", "Realtime multiplier") + : t("等待进程上报", "Waiting for metrics"), + accent: overviewLiveMetrics.speedLow ? "amber" as const : "emerald" as const, + }, + { + label: t("实时 FPS", "Live FPS"), + value: overviewFfmpegFps, + warn: typeof overviewLiveMetrics.fps === "number" && overviewLiveMetrics.fps > 0 && overviewLiveMetrics.fps < 24, + helper: overviewLiveMetrics.live ? t("FFmpeg 输出帧率", "FFmpeg output fps") : t("未推流", "Not pushing"), + accent: "cyan" as const, }, { label: t("编码帧", "Encoded frame"), - value: overviewFfmpegFrame ?? "—", - warn: overviewRow?.ffmpeg_progress_stalled, + value: overviewFfmpegFrame, + warn: overviewLiveMetrics.progressStalled, helper: overviewRow?.ffmpeg_active ? t("Worker 活跃", "Worker active") : t("无活跃 Worker", "No active worker"), + accent: overviewLiveMetrics.progressStalled ? "amber" as const : "violet" as const, }, { label: t("码率", "Bitrate"), value: overviewBitrate ?? "—", warn: false, - helper: overviewQualityMetrics?.fps != null ? `${overviewQualityMetrics.fps} fps` : t("质量守护采样", "Quality guard"), + helper: overviewLiveMetrics.live ? t("实时输出码率", "Live output bitrate") : t("停推后不显示", "Hidden when idle"), + accent: "cyan" as const, }, { label: t("质量分", "Quality score"), value: overviewQualityScore != null ? String(overviewQualityScore) : "—", warn: overviewQualityScore != null && overviewQualityScore < 55, helper: t("当前线路综合评估", "Current lane score"), + accent: "violet" as const, }, { label: t("活动场次", "Active events"), value: String(activeLiveEventCount), warn: false, helper: t("本地事件库", "Local event store"), + accent: "cyan" as const, }, { label: t("抖音地址", "Douyin URLs"), value: String(currentDouyinCount), warn: currentDouyinCount === 0, helper: `${currentUrlCount} ${t("条有效地址", "valid URLs")}`, + accent: "cyan" as const, }, { label: t("密钥尾码", "Key suffix"), value: keySuffixDisplay, warn: !keySuffixUi, helper: overviewKeyHelper, + accent: "violet" as const, }, - ].map(({ label, value, warn, helper }) => ( -

-

{label}

-

- {value} -

-

{helper}

-
+ ].map(({ label, value, warn, helper, accent }) => ( + ))}
{overviewActiveEvent && overviewPushing ? ( @@ -2907,7 +3040,7 @@ export function LiveYoutubeUnmannedView({ - {statusOverviewPanel} + {!HIDE_YOUTUBE_RELAY_SNAPSHOT ? statusOverviewPanel : null} {laneQuickLinks.length ? (
@@ -3069,9 +3202,14 @@ export function LiveYoutubeUnmannedView({ const laneIndex = channels.findIndex((row) => row.id === c.id); const laneNeko = resolveNekoBrowserLink(nekoLinks, laneIndex).link; const laneName = cleanLaneName(c.name, laneIndex >= 0 ? laneIndex : 0); - const laneDisplay = douyinSourceDisplayFor(row, laneUrlText); - const speedText = typeof row?.ffmpeg_speed === "number" ? `speed ${row.ffmpeg_speed.toFixed(2)}x` : ""; - const frameText = typeof row?.ffmpeg_frame === "number" ? `frame ${row.ffmpeg_frame}` : ""; + const laneQuality = qualityGuard?.lanes?.find((lane) => lane.process === pm); + const laneDisplay = proLanePrimaryTitle(laneName, row, laneUrlText, laneQuality); + const laneDouyinSubtitle = proLaneDouyinSubtitle(row, laneUrlText, laneName); + const laneStatusLabel = proLaneStatusLabel(row, t); + const laneLiveMetrics = qualityLaneMetrics(row, laneQuality); + const laneStatsText = formatFfmpegStatsBrief(laneLiveMetrics, { + live: laneLiveMetrics.live || rowOnline || isLivePushingRow(row), + }); return (
+ {laneStatusEmoji(row)} {laneDisplay || t("未配置抖音直播源", "No Douyin source")} - {businessStatusLabel(row, t)} + {laneStatusLabel} {laneNeko ? ( @@ -3105,6 +3244,14 @@ export function LiveYoutubeUnmannedView({ ) : null}
+ {laneDouyinSubtitle && laneDouyinSubtitle !== laneDisplay ? ( + <> + + {t("抖音源", "Douyin")} {laneDouyinSubtitle} + + · + + ) : null} {t("线路", "Lane")} {laneName} @@ -3124,19 +3271,17 @@ export function LiveYoutubeUnmannedView({ DY {douyinUrls.length} - {speedText ? ( + {laneStatsText ? ( <> · - - {speedText} - - - ) : null} - {frameText ? ( - <> - · - - {frameText} + + {laneStatsText} ) : null} @@ -3237,11 +3382,12 @@ export function LiveYoutubeUnmannedView({ pollMs={statusCardPollMs} refreshToken={activeViewRefreshToken} monitorRow={overviewRow ?? undefined} + preferredTitle={mode === "pro" ? overviewLaneName : undefined} /> {qualityGuardPanel} - {humanLiveEventPanel || liveEventPanel} + {!HIDE_YOUTUBE_LIVE_EVENT_HUB ? humanLiveEventPanel || liveEventPanel : null}
diff --git a/d2ypp2/web-console/lib/youtubeConfigUtils.ts b/d2ypp2/web-console/lib/youtubeConfigUtils.ts index 12bb174..351eaa9 100644 --- a/d2ypp2/web-console/lib/youtubeConfigUtils.ts +++ b/d2ypp2/web-console/lib/youtubeConfigUtils.ts @@ -102,12 +102,32 @@ export function extractDouyinSourceTitleFromLog(logText: string): string { } export function douyinSourceDisplayFrom(urlIni: string, logText = ""): string { - const title = extractDouyinSourceTitleFromUrlLines(urlIni) || extractDouyinSourceTitleFromLog(logText); + const urlTitle = extractDouyinSourceTitleFromUrlLines(urlIni); + const logTitle = extractDouyinSourceTitleFromLog(logText); + const urlCount = extractDouyinLiveUrls(urlIni).length; + const waitingOnly = extractDouyinSourceTitleFromWaitingLog(logText); + const activeRelay = /frame=.*speed=/i.test(logText) || /(?:正在录制|录制中)\s*\d*\s*个?\s*[::]/i.test(logText); + if (urlCount > 1 && logTitle && !activeRelay && logTitle === waitingOnly) { + if (urlTitle) return urlTitle; + } + const title = urlTitle || logTitle; if (title) return title; const roomId = extractDouyinCurrentRoomFromLog(logText) || extractDouyinRoomHints(urlIni)[0] || ""; return roomId ? `抖音直播间 ${roomId}` : ""; } +function extractDouyinSourceTitleFromWaitingLog(logText: string): string { + const lines = logText.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).slice(-160); + const waiting = /(?:序号\s*\d+\s*)?(.{1,80}?)\s*(?:等待直播|主播已下播|下播)/i; + const errorContext = /(?:获取失败|错误|异常|error|failed|exception)/i; + for (let i = lines.length - 1; i >= 0; i -= 1) { + if (errorContext.test(lines[i])) continue; + const title = cleanDouyinSourceTitle(lines[i].match(waiting)?.[1] || ""); + if (title) return title; + } + return ""; +} + /** 从进程日志中解析「当前」抖音房间号(取文本中最后一次出现的 live.douyin.com/xxx) */ export function extractDouyinCurrentRoomFromLog(logText: string): string | null { if (!logText) return null; diff --git a/d2ypp2/web-console/out/404.html b/d2ypp2/web-console/out/404.html index 25decb6..8f04c29 100644 --- a/d2ypp2/web-console/out/404.html +++ b/d2ypp2/web-console/out/404.html @@ -1 +1 @@ -404: This page could not be found.无人直播系统 · live.local

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.无人直播系统 · live.local

404

This page could not be found.

\ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/BfhpIk8_9MUFzvnv8gp2T/_buildManifest.js b/d2ypp2/web-console/out/_next/static/LUR--1jFr5J8xPFAxV9C7/_buildManifest.js similarity index 100% rename from d2ypp2/web-console/out/_next/static/BfhpIk8_9MUFzvnv8gp2T/_buildManifest.js rename to d2ypp2/web-console/out/_next/static/LUR--1jFr5J8xPFAxV9C7/_buildManifest.js diff --git a/d2ypp2/web-console/out/_next/static/BfhpIk8_9MUFzvnv8gp2T/_ssgManifest.js b/d2ypp2/web-console/out/_next/static/LUR--1jFr5J8xPFAxV9C7/_ssgManifest.js similarity index 100% rename from d2ypp2/web-console/out/_next/static/BfhpIk8_9MUFzvnv8gp2T/_ssgManifest.js rename to d2ypp2/web-console/out/_next/static/LUR--1jFr5J8xPFAxV9C7/_ssgManifest.js diff --git a/d2ypp2/web-console/out/_next/static/chunks/348-80f0852ea47d5112.js b/d2ypp2/web-console/out/_next/static/chunks/348-80f0852ea47d5112.js deleted file mode 100644 index dbe0b30..0000000 --- a/d2ypp2/web-console/out/_next/static/chunks/348-80f0852ea47d5112.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[348],{6348:function(e,t,s){s.d(t,{Z:function(){return t0}});var n=s(7437),l=s(6247),i=s(7586),a=s(4401),r=s(6137),o=s(4372),c=s(5901),d=s(3388),x=s(4938),u=s(3420),m=s(8728),h=s(2023),p=s(407),g=s(6840),b=s(7226),f=s(5929),v=s(7945),y=s(1817),w=s(7168),j=s(3581),N=s(4766),k=s(7580),_=s(9688),z=s(4743),S=s(8930),C=s(3651),R=s(4286),L=s(4428),P=s(7265),M=s(8867),T=s(8406),E=s(2926),U=s(2489),Z=s(2265),I=s(2246),A=s(4794),D=s(221),O=s(8124),B=s(2101),W=s(9985),K=s(6362),H=s(3468),F=s(6443),Y=s(5287),G=s(3276),q=s(9227),V=s(257),J=s(1387);class ${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 s=new Uint8Array(e.length+t.length);return s.set(e,0),s.set(t,e.length),s}(this.buf,t),this.drainAvcc()}drainAvcc(){let e=this.buf,t=0;for(;t+4<=e.length;){var s;let n=e[s=t]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3];if(n<=0||n>6291456){this.buf=new Uint8Array(e.subarray(t+1)),t=0;continue}if(t+4+n>e.length)break;let l=e.subarray(t+4,t+4+n);t+=4+n,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 s=new Uint8Array(4+e.length);new DataView(s.buffer).setUint32(0,e.length,!1),s.set(e,4);try{let e=new EncodedVideoChunk({type:5===t?"key":"delta",timestamp:this.ts,data:s});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 s=e.subarray(1),n=t.subarray(1),l=new Uint8Array(11+s.length+3+n.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++]=s.length>>8&255,l[i++]=255&s.length,l.set(s,i),i+=s.length,l[i++]=1,l[i++]=n.length>>8&255,l[i++]=255&n.length,l.set(n,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),s=new VideoDecoder({output:e=>{var t;let s=this.canvas.getContext("2d");if(!s){e.close();return}(this.canvas.width!==e.displayWidth||this.canvas.height!==e.displayHeight)&&(this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight),s.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 s.configure({codec:t,description:e,optimizeForLatency:!0}),this.decoder=s,this.configured=!0}catch(e){this.onDecodeError(e.message||String(e))}finally{this.configuring=!1}}}constructor(e,t,s){this.canvas=e,this.onDecodeError=t,this.onFrame=s,this.buf=new Uint8Array(0),this.decoder=null,this.configured=!1,this.configuring=!1,this.ts=0,this.sps=null,this.pps=null}}function X(){return"undefined"!=typeof VideoDecoder&&"undefined"!=typeof VideoFrame}let Q="live-hub-adb-bookmarks-v1";function ee(e,t,s){let n,l,i,a;let r=e.getBoundingClientRect(),o=e.width,c=e.height;if(!o||!c)return null;let d=r.width/r.height,x=o/c;x>d?(n=r.width,l=r.width/x,i=0,a=(r.height-l)/2):(l=r.height,n=r.height*x,i=(r.width-n)/2,a=0);let u=t-r.left-i,m=s-r.top-a;return u<0||m<0||u>n||m>l?null:{x:Math.max(0,Math.min(o-1,Math.round(u/n*o))),y:Math.max(0,Math.min(c-1,Math.round(m/l*c)))}}function et(e,t,s){let n,l,i,a;let r=e.getBoundingClientRect(),o=e.naturalWidth,c=e.naturalHeight;if(!o||!c)return null;let d=r.width/r.height,x=o/c;x>d?(n=r.width,l=r.width/x,i=0,a=(r.height-l)/2):(l=r.height,n=r.height*x,i=(r.width-n)/2,a=0);let u=t-r.left-i,m=s-r.top-a;return u<0||m<0||u>n||m>l?null:{x:Math.max(0,Math.min(o-1,Math.round(u/n*o))),y:Math.max(0,Math.min(c-1,Math.round(m/l*c)))}}let es=[0,280,450,700,1100];function en(e){switch(e){case"usb":return{Icon:B.Z,zh:"USB",en:"USB",cls:"bg-amber-500/20 text-amber-100 ring-amber-500/35"};case"tcp":return{Icon:E.Z,zh:"网络",en:"TCP",cls:"bg-cyan-500/20 text-cyan-100 ring-cyan-500/35"};case"emulator":return{Icon:C.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 el="https://github.com/Genymobile/scrcpy",ei="https://github.com/viarotel-org/escrcpy";function ea(e,t){let s=t.startsWith("/")?t:"/".concat(t),n=(e||"").trim().replace(/\/$/,"");return n?"".concat(n).concat(s):s}function er(e){var t;let{t:s,apiBase:l,fetchJson:i,serial:a,devices:r,setSerial:o,adbAvailable:c,lock:x,overview:u,onAndroidAction:m,notify:p,onRefreshDevices:g}=e,[b,f]=(0,Z.useState)(0),[v,y]=(0,Z.useState)(450),[j,N]=(0,Z.useState)(!1),[k,_]=(0,Z.useState)(null),[z,S]=(0,Z.useState)(null),[C,R]=(0,Z.useState)(!0),[L,P]=(0,Z.useState)(""),[M,T]=(0,Z.useState)(""),[E,U]=(0,Z.useState)("37777"),[I,A]=(0,Z.useState)(""),[D,O]=(0,Z.useState)(!1),[B,er]=(0,Z.useState)([]),[eo,ec]=(0,Z.useState)(!1),[ed,ex]=(0,Z.useState)(null),[eu,em]=(0,Z.useState)(!1),[eh,ep]=(0,Z.useState)(null),[eg,eb]=(0,Z.useState)(null),[ef,ev]=(0,Z.useState)(!0),ey=(0,Z.useRef)(null),ew=(0,Z.useRef)(null),ej=(0,Z.useRef)(null),eN=(0,Z.useRef)(null),ek=(0,Z.useRef)(null),e_=(0,Z.useRef)(null),ez=(0,Z.useRef)(0),eS=(0,Z.useRef)(!1),eC=(0,Z.useRef)(null),eR=(0,Z.useRef)(!1),eL=null===(t=r.find(e=>e.serial===a))||void 0===t?void 0:t.transport,eP=v>0,eM=a?"".concat(ea(l,"/android/screenshot"),"?serial=").concat(encodeURIComponent(a),"&ts=").concat(b).concat(eP?"&fast=1":""):"",eT=(0,Z.useCallback)(()=>{f(e=>e+1)},[]),eE=(0,Z.useCallback)(()=>{null!=eC.current&&(window.clearTimeout(eC.current),eC.current=null)},[]);(0,Z.useEffect)(()=>{let e=()=>ev("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,Z.useEffect)(()=>{try{let e=window.localStorage.getItem(Q);if(e){let t=JSON.parse(e);Array.isArray(t)&&er(t.map(String).filter(Boolean).slice(0,24))}}catch(e){}},[]);let eU=e=>{let t=e.trim();if(!t)return;let n=[t,...B.filter(e=>e!==t)].slice(0,16);er(n);try{window.localStorage.setItem(Q,JSON.stringify(n))}catch(e){}p(s("已保存快捷地址","Saved quick address"))};(0,Z.useEffect)(()=>{if(!a||!c){S(null);return}let e=!1;return(async()=>{try{let t=await (0,J.N)("".concat(ea(l,"/android/display_metrics"),"?serial=").concat(encodeURIComponent(a)));if(e)return;"number"==typeof t.width&&"number"==typeof t.height&&S({width:t.width,height:t.height})}catch(e){}})(),()=>{e=!0}},[l,c,a]),(0,Z.useEffect)(()=>{if(!c||!a||v<=0||eo||!ef)return;let e=window.setInterval(()=>f(e=>e+1),v);return()=>clearInterval(e)},[c,v,ef,a,eo]),(0,Z.useEffect)(()=>{ef&&c&&a&&!eo&&eT()},[c,eT,ef,a,eo]),(0,Z.useEffect)(()=>{if(!c){eb(null);return}let e=!1;return(async()=>{try{let t=await (0,J.N)(ea(l,"/android/scrcpy/info"));e||eb(t)}catch(e){}})(),()=>{e=!0}},[l,c]),(0,Z.useEffect)(()=>{eo||ep(null)},[eo]),(0,Z.useEffect)(()=>{ex(null),eS.current=!1},[a]),(0,Z.useEffect)(()=>{let e=r.find(e=>e.serial===a),t=!!(a&&ed===a);if(c&&a&&(null==e?void 0:e.state)==="device"&&(null==eg?void 0:eg.server_jar)&&X()&&!t){ec(!0),y(0);return}if(t||!a||!c||eg&&!eg.server_jar||!X()||e&&"device"!==e.state){ec(!1);return}},[a,r,c,eg,ed]),(0,Z.useEffect)(()=>{if(!eo||!a||!c){var e,t;eE(),eS.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(!X()){ep(s("当前浏览器不支持 WebCodecs H.264","WebCodecs H.264 not supported in this browser")),ec(!1);return}let n=ej.current;if(!n)return;let i=e=>{var t;eE(),eS.current=!0,null===(t=eN.current)||void 0===t||t.close(),ep(e),ec(!1),y(450),ex(a),window.setTimeout(()=>eT(),120)},r=new $(n,e=>i("".concat(s("实时画面解码失败,已切回截图模式","Live stream decode failed, using screenshot mode"),": ").concat(e)),()=>{eR.current=!0,eE()});ek.current=r,eS.current=!1,eR.current=!1;let o=new WebSocket(function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1920,n=(function(e){let t=(e||"").trim();if(t)try{let e=new URL(t,window.location.href),s="https:"===e.protocol?"wss:":"ws:";return"".concat(s,"//").concat(e.host)}catch(e){}let s=void 0!==V&&V.env.NEXT_PUBLIC_API_URL?String(V.env.NEXT_PUBLIC_API_URL).trim():"";if(s)try{let e=new URL(s,window.location.href),t="https:"===e.protocol?"wss:":"ws:";return"".concat(t,"//").concat(e.host)}catch(e){}let n=window.location.port;if("3000"===n||"3001"===n){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(s)});return"".concat(n,"/android/scrcpy/ws?").concat(l.toString())}(l,a));return eN.current=o,o.binaryType="arraybuffer",o.onopen=()=>{em(!0),ep(null),eE(),eC.current=window.setTimeout(()=>{eR.current||i(s("实时画面无首帧,已切回截图模式","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(s("WebSocket 异常","WebSocket error"))},o.onclose=()=>{var e;em(!1),null===(e=ek.current)||void 0===e||e.reset(),ek.current=null,eE(),eo&&!eS.current&&i(s("实时画面连接失败,已切回截图模式","Live stream failed, using screenshot mode"))},()=>{eE(),eS.current=!0,eR.current=!1,o.close(),eN.current=null,r.reset(),ek.current===r&&(ek.current=null)}},[eo,a,c,l,eT,eE,s]),(0,Z.useEffect)(()=>{a&&c&&(ez.current=0,f(e=>e+1))},[a,c]);let eZ=async()=>{let e=L.trim();if(!e){p(s("填写 host:port","Enter host:port"));return}O(!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":s("连接结果见日志","See message"))),g(),eT()}catch(e){p(e.message)}finally{O(!1)}},eI=async e=>{O(!0);try{let t=await i("/android/disconnect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e})});p(t.message||"OK"),g()}catch(e){p(e.message)}finally{O(!1)}},eA=async()=>{let e=M.trim(),t=parseInt(E,10)||37777,n=I.trim();if(!e||!n){p(s("填写配对 IP 与码","Host + code required"));return}O(!0);try{let l=await i("/android/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({host:e,port:t,code:n})});p(l.message||(l.ok?s("配对成功后再点连接","Paired — now Connect"):"pair"))}catch(e){p(e.message)}finally{O(!1)}},eD=async e=>{if(!C||x||!c||!a)return;let t=ew.current;if(!t)return;let n=et(t,e.clientX,e.clientY);if(!n)return;let l=Date.now(),i=ey.current;i&&l-i.t<320&&28>Math.abs(i.x-n.x)&&28>Math.abs(i.y-n.y)?(ey.current=null,await m("double_tap",{x:n.x,y:n.y}),p(s("双击","Double tap"))):(ey.current={t:l,x:n.x,y:n.y},await m("tap",{x:n.x,y:n.y})),eT()},eO=async e=>{if(e.preventDefault(),x||!c||!a)return;let t=ew.current;if(!t)return;let n=et(t,e.clientX,e.clientY);n&&(await m("long_press",{x:n.x,y:n.y,duration:720}),p(s("长按","Long press")),eT())},eB=async e=>{if(!C||x||!c||!a)return;let t=ej.current;if(!t)return;let n=ee(t,e.clientX,e.clientY);if(!n)return;let l=Date.now(),i=ey.current;i&&l-i.t<320&&28>Math.abs(i.x-n.x)&&28>Math.abs(i.y-n.y)?(ey.current=null,await m("double_tap",{x:n.x,y:n.y}),p(s("双击","Double tap"))):(ey.current={t:l,x:n.x,y:n.y},await m("tap",{x:n.x,y:n.y})),eo||eT()},eW=async e=>{if(e.preventDefault(),x||!c||!a)return;let t=ej.current;if(!t)return;let n=ee(t,e.clientX,e.clientY);n&&(await m("long_press",{x:n.x,y:n.y,duration:720}),p(s("长按","Long press")),eo||eT())};if(!c)return(0,n.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:s("宿主机未安装 adb,无法使用 Live 控制台。","adb is required for the Live console.")});let eK=en(eL),eH=eK.Icon;return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.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,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-white/[0.06] pb-3",children:[(0,n.jsx)(W.Z,{className:"h-4 w-4 text-sky-400"}),(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:s("链路管理","Link manager")}),(0,n.jsx)("span",{className:"text-[10px] text-zinc-500",children:s("USB / Redroid :5555 / 无线调试(先配对再连接)","USB \xb7 Redroid :5555 \xb7 wireless (pair then connect)")})]}),(0,n.jsxs)("div",{className:"mt-3 grid gap-3 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"space-y-2 rounded-xl border border-white/[0.06] bg-black/35 p-3",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:"adb connect"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.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:L,onChange:e=>P(e.target.value),onKeyDown:e=>"Enter"===e.key&&void eZ()}),(0,n.jsx)("button",{type:"button",disabled:D||x,onClick:()=>void eZ(),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:D?"…":"Connect"}),(0,n.jsx)("button",{type:"button",disabled:D||x||!L.trim(),onClick:()=>eU(L),className:"rounded-lg border border-white/10 px-3 py-2 text-xs text-zinc-400 hover:text-zinc-200",children:s("存书签","Pin")})]}),B.length?(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5 pt-1",children:B.map(e=>(0,n.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:()=>P(e),children:e},e))}):null,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 pt-2",children:[(0,n.jsx)("button",{type:"button",disabled:D||x||!a,onClick:()=>void eI(a),className:"rounded-lg border border-rose-500/30 bg-rose-500/10 px-2.5 py-1.5 text-[10px] text-rose-200",children:s("断开当前 TCP","Disconnect current")}),(0,n.jsx)("button",{type:"button",disabled:D||x,onClick:()=>void eI(""),className:"rounded-lg border border-white/10 px-2.5 py-1.5 text-[10px] text-zinc-500 hover:text-zinc-300",children:s("断开全部 TCP","Disconnect all TCP")}),(0,n.jsxs)("button",{type:"button",disabled:D||x,onClick:()=>{g(),eT(),p(s("已刷新设备列表","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,n.jsx)(w.Z,{className:"h-3 w-3"}),"ADB list"]})]})]}),(0,n.jsxs)("div",{className:"space-y-2 rounded-xl border border-white/[0.06] bg-black/35 p-3",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:"adb pair(无线调试)"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.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:M,onChange:e=>T(e.target.value)}),(0,n.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=>U(e.target.value)}),(0,n.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:I,onChange:e=>A(e.target.value)}),(0,n.jsx)("button",{type:"button",disabled:D||x,onClick:()=>void eA(),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,n.jsx)("p",{className:"text-[10px] leading-relaxed text-zinc-600",children:s("手机上「无线调试」会显示配对端口与 6 位码;配对成功后用上方 connect 连接 adb 显示的 IP:5555。","Use the pairing port + 6-digit code from Wireless debugging; then connect to the listed adb IP:5555.")})]})]})]}),(0,n.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,n.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,n.jsxs)("div",{className:"relative rounded-[1.35rem] border border-white/[0.06] bg-zinc-950/80 p-4 backdrop-blur-sm",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.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,n.jsx)(h.Z,{className:"h-6 w-6 text-emerald-200"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-base font-semibold tracking-tight text-white",children:s("无人直播系统 \xb7 ADB 云控台","Unmanned Live System \xb7 ADB farm console")}),(0,n.jsxs)("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-zinc-500",children:[s("统一适配 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,n.jsx)("a",{href:ei,target:"_blank",rel:"noreferrer",className:"text-emerald-300/90 underline-offset-2 hover:underline",children:"escrcpy"}),s(" / "," / "),(0,n.jsx)("a",{href:el,target:"_blank",rel:"noreferrer",className:"text-emerald-300/90 underline-offset-2 hover:underline",children:"scrcpy"}),s(");无 jar 或关闭真流时用截图。","); PNG screenshot when jar missing or stream off.")]})]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 flex-col gap-1.5 self-start sm:flex-row",children:[(0,n.jsxs)("a",{href:ei,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,n.jsx)(K.Z,{className:"h-3.5 w-3.5 opacity-70"})]}),(0,n.jsxs)("a",{href:el,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,n.jsx)(K.Z,{className:"h-3.5 w-3.5 opacity-70"})]})]})]}),r.length>0?(0,n.jsxs)("div",{className:"mt-5",children:[(0,n.jsxs)("p",{className:"mb-2 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:[(0,n.jsx)(H.Z,{className:"h-3.5 w-3.5"}),s("设备矩阵","Device matrix")]}),(0,n.jsx)("div",{className:"flex gap-2 overflow-x-auto pb-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:r.map(e=>{let t="device"===e.state,l=a===e.serial,i=en(e.transport),r=i.Icon;return(0,n.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,n.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-zinc-200",children:[(0,n.jsx)(d.Z,{className:"h-3.5 w-3.5 text-emerald-400/80"}),(0,n.jsx)("span",{className:"truncate",children:e.model||e.serial.slice(0,10)})]}),(0,n.jsx)("span",{className:"mt-0.5 truncate font-mono text-[9px] text-zinc-600",children:e.serial}),(0,n.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1",children:[(0,n.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,n.jsx)(r,{className:"h-2.5 w-2.5"}),s(i.zh,i.en)]}),(0,n.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,n.jsxs)("div",{className:"mt-6 grid gap-6 xl:grid-cols-12",children:[(0,n.jsxs)("div",{className:"xl:col-span-8",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-white/[0.06] pb-3",children:[(0,n.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:s("刷新间隔","Interval")}),es.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>y(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?s("手动","Manual"):"".concat(e,"ms")},e)),(0,n.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,n.jsx)(eH,{className:"h-3 w-3"}),"tcp"===eL?s("建议 ≥450ms","Suggest ≥450ms"):s("可试 280ms","Try 280ms")]}),(0,n.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,n.jsx)(w.Z,{className:"h-3 w-3 ".concat(j?"animate-spin":"")}),s("下一帧","Next frame")]}),(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>void m("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,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-[10px] text-zinc-400",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/50",checked:C,onChange:e=>R(e.target.checked)}),(0,n.jsx)(F.Z,{className:"h-3 w-3"}),s("点按穿透","Tap-through")]}),(0,n.jsxs)("button",{type:"button",disabled:x||!a||!(null==eg?void 0:eg.server_jar),title:eg&&!eg.server_jar&&eg.hint_zh?eg.hint_zh:s("官方 scrcpy-server + WebSocket H.264","Official scrcpy-server + WebSocket H.264"),onClick:()=>{ec(e=>{let t=!e;return t?(ex(null),p(s("已开启实时画面(H.264 WebSocket)","Live H.264 WebSocket stream on"))):(a&&ex(a),p(s("已关闭实时画面(将使用截图)","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,n.jsx)(Y.Z,{className:"h-3 w-3"}),eo?s("关闭真流","Stop WS"):s("实时画面","Live H.264")]})]}),eg&&!eg.server_jar?(0,n.jsxs)("p",{className:"mt-2 text-[10px] text-amber-200/80",children:[s("未检测到 scrcpy-server:启动时会自动拉取;内网可在 runtime.env 配置 SCRCPY_SERVER_DOWNLOAD_URL(支持 {tag})。","scrcpy-server missing: auto-fetched on startup; set SCRCPY_SERVER_DOWNLOAD_URL ({tag}) for mirrors."),eg.server_version?" (".concat(s("期望版本","version")," ").concat(eg.server_version,")"):null]}):null,(0,n.jsx)("p",{className:"mt-2 text-[10px] text-zinc-600",children:s("快捷键(镜像区聚焦时):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,n.jsxs)("div",{className:"relative mx-auto mt-4 max-h-[min(78vh,720px)] min-h-[280px]",children:[a?(0,n.jsxs)("div",{ref:e_,tabIndex:0,onKeyDown:e=>{if(!a||x)return;let t=e.target.tagName;if("INPUT"===t||"TEXTAREA"===t||"SELECT"===t)return;let s={h:["key",{keycode:"3"}],b:["key",{keycode:"4"}],r:["key",{keycode:"187"}],w:["wake",void 0],m:["key",{keycode:"82"}]}[e.key.toLowerCase()];s&&(e.preventDefault(),(async()=>{await m(s[0],s[1]),eo||eT()})())},className:"relative flex justify-center outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/50",children:[(0,n.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,n.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,n.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:eB,onContextMenu:eW}):(0,n.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),ez.current=0,_(null)},onError:()=>{N(!1),ez.current+=1,ez.current<=3?(_(null),window.setTimeout(()=>eT(),380+200*ez.current)):_(s("截图连续失败:检查 USB 授权 / 无线是否断开 / Redroid 端口","Screenshot failed repeatedly"))},onClick:eD,onContextMenu:eO})]}),eu?(0,n.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,n.jsx)(Y.Z,{className:"h-3 w-3"}),"SCRCPY\xb7WS"]}):v>0&&!eo?(0,n.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,n.jsx)(G.Z,{className:"h-3 w-3"}),"LIVE"]}):eo?null:(0,n.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,n.jsx)(q.Z,{className:"h-3 w-3"}),s("单帧","Still")]})]}):(0,n.jsx)("p",{className:"py-16 text-center text-sm text-zinc-600",children:s("请选择或连接设备","Pick or connect a device")}),eh?(0,n.jsx)("p",{className:"mt-3 text-center text-xs text-rose-300",children:eh}):null,k&&!eo?(0,n.jsx)("p",{className:"mt-3 text-center text-xs text-rose-300",children:k}):null,(0,n.jsx)("p",{className:"mt-3 text-center text-[10px] text-zinc-600",children:s("左键单击 / 双击 \xb7 右键长按 \xb7 坐标对齐 PNG 像素","Left tap/double \xb7 right long-press \xb7 PNG pixel coords")})]})]}),(0,n.jsxs)("div",{className:"space-y-4 xl:col-span-4",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.07] bg-black/40 p-4",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:s("遥测","Telemetry")}),u?(0,n.jsxs)("dl",{className:"mt-3 space-y-2 font-mono text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"device"}),(0,n.jsxs)("dd",{className:"text-right text-zinc-200",children:[u.brand," ",u.model]})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"Android"}),(0,n.jsxs)("dd",{className:"text-zinc-300",children:[u.android_version," (API ",u.sdk,")"]})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"wm size"}),(0,n.jsx)("dd",{className:"text-cyan-300/90",children:z?"".concat(z.width,"\xd7").concat(z.height):u.resolution||"—"})]}),(0,n.jsx)("div",{className:"whitespace-pre-wrap text-[10px] leading-snug text-zinc-500",children:u.battery})]}):(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-600",children:s("在上方点「刷新设备信息」","Use Refresh device info above")})]}),(0,n.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,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-violet-300/80",children:s("导航坞","Nav dock")}),(0,n.jsx)("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[["3","Home"],["4","Back"],["187","Recents"]].map(e=>{let[t,s]=e;return(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>{m("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:s},t)})}),(0,n.jsxs)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>{m("key",{keycode:"24"}),eT()},className:"rounded-xl border border-white/10 bg-black/30 py-2 text-[11px] text-zinc-300",children:"Vol+"}),(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>{m("key",{keycode:"25"}),eT()},className:"rounded-xl border border-white/10 bg-black/30 py-2 text-[11px] text-zinc-300",children:"Vol−"})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-cyan-500/[0.05] p-4",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-cyan-300/80",children:s("手势","Gestures")}),(0,n.jsx)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:["up","down","left","right"].map(e=>(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>{m("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 eo=[{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 ec(e,t,s){return e?(0,n.jsx)("span",{className:"rounded bg-emerald-500/15 px-2 py-0.5 text-[10px] text-emerald-200",children:t}):(0,n.jsx)("span",{className:"rounded bg-zinc-500/15 px-2 py-0.5 text-[10px] text-zinc-400",children:s})}function ed(e){var t,s,l,i,a,r,o,c,d,x,u,m,h,p,g;let{t:b,notify:f,fetchJson:v,apiBase:w,busy:j,androidSerial:N,setAndroidSerial:k,devices:_,adbAvailable:z,apkPath:S,setApkPath:C,onAndroidAction:L,onCopy:P,onRefreshDevices:T}=e,[E,U]=(0,Z.useState)(null),[I,B]=(0,Z.useState)(null),[W,K]=(0,Z.useState)(null),[H,F]=(0,Z.useState)(null),[Y,G]=(0,Z.useState)(""),[q,V]=(0,Z.useState)([]),[J,$]=(0,Z.useState)("getprop ro.product.model"),[X,Q]=(0,Z.useState)(""),[ee,et]=(0,Z.useState)("300"),[es,en]=(0,Z.useState)(""),[el,ei]=(0,Z.useState)(null),[ea,ed]=(0,Z.useState)([]),[ex,eu]=(0,Z.useState)(null),[em,eh]=(0,Z.useState)("https://"),[ep,eg]=(0,Z.useState)(""),[eb,ef]=(0,Z.useState)(!1),[ev,ey]=(0,Z.useState)(null),ew=!!(j||ev),ej=_.find(e=>e.serial===N)||null,eN=(0,Z.useCallback)(async()=>{if(!N||!z){U(null),B(null);return}ey("overview"),B(null);try{let e=await v("/android/overview?serial=".concat(encodeURIComponent(N)));U(e)}catch(e){U(null),B(e.message)}finally{ey(null)}},[z,N,v]),ek=(0,Z.useCallback)(async()=>{F(null);try{let e=await v("/redroid/summary");K(e)}catch(e){K(null),F(e.message)}},[v]);(0,Z.useEffect)(()=>{eN()},[eN]),(0,Z.useEffect)(()=>{ek()},[ek]);let e_=async()=>{if(!N){f(b("请选择设备","Pick a device"));return}ey("packages");try{let e=encodeURIComponent(Y.trim()),t=await v("/android/packages?serial=".concat(encodeURIComponent(N),"&query=").concat(e,"&limit=80"));V(t.packages||[])}catch(e){f(e.message),V([])}finally{ey(null)}},ez=async()=>{if(!N){f(b("请选择设备","Pick a device"));return}let e=J.trim();if(e){ey("shell");try{var t,s;let n=await v("/android/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"shell",serial:N,payload:{command:e}})});Q(null!==(s=null!==(t=n.output)&&void 0!==t?t:n.message)&&void 0!==s?s:"")}catch(e){Q(e.message)}finally{ey(null)}}},eS=(0,Z.useCallback)(async e=>{if(!N)return;let t=Math.min(3e3,Math.max(1,parseInt(ee,10)||200)),s=!!(null==e?void 0:e.silent);s||ey("logcat"),ei(null);try{var n;let e=await v("/android/logcat?serial=".concat(encodeURIComponent(N),"&lines=").concat(t));en(null!==(n=e.text)&&void 0!==n?n:"")}catch(e){en(""),ei(e.message)}finally{s||ey(null)}},[N,v,ee]);(0,Z.useEffect)(()=>{if(!eb||!N||!z)return;let e=window.setInterval(()=>void eS({silent:!0}),3e3);return eS({silent:!0}),()=>clearInterval(e)},[z,N,eb,eS]);let eC=async()=>{if(!N){f(b("请选择设备","Pick a device"));return}ey("ui"),eu(null);try{let e=await v("/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 s=await v("/redroid/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,name:t||""})});s.summary&&K(s.summary),f(s.message||"OK"),await ek(),T()}catch(e){f(e.message)}finally{ey(null)}},eL=async e=>{await L("key",{keycode:e})},eP=async()=>{let e=ep.trim();if(!e){f(b("请输入文字","Enter text"));return}await L("text",{text:e})},eM=async()=>{let e=em.trim();if(!e||"https://"===e){f(b("请输入 URL","Enter URL"));return}await L("open_url",{url:e})};return(0,n.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:b("安卓设备工作台","Android workstation")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:b("USB 真机与 Redroid 共用一套控制面,优先保证 USB 真机稳定。","USB phone and Redroid share one control surface.")})]}),z?(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.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:b("刷新设备","Refresh device")}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>{ek(),T()},className:"rounded-lg border border-white/10 bg-white/[0.05] px-3 py-1.5 text-xs text-zinc-300",children:b("刷新 Redroid","Refresh Redroid")})]}):(0,n.jsx)("span",{className:"text-xs text-amber-200/90",children:b("宿主机未检测到 adb","adb not found on host")})]}),(0,n.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:_.map(e=>(0,n.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,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"font-medium text-zinc-200",children:e.model||e.serial}),e.transport?(0,n.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,n.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,n.jsx)("div",{className:"text-[10px] text-zinc-600",children:e.serial}),"device"!==(e.state||"").toLowerCase()?(0,n.jsx)("div",{className:"mt-1 text-[10px] font-medium text-amber-200/90",children:"unauthorized"===e.state?b("未授权,请在手机上允许 USB 调试。","Unauthorized, allow USB debugging on device."):"".concat(b("状态","State"),": ").concat(e.state)}):null]},e.serial))}),z&&0===_.length?(0,n.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:b("当前没有已授权设备。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,n.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/15 bg-zinc-950/50 p-5",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-violet-300/90",children:b("真机诊断","Phone diagnostics")}),I?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:I}):null,E?(0,n.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,n.jsxs)("dl",{className:"space-y-1.5 font-mono text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"model"})," ",(0,n.jsxs)("dd",{className:"inline text-zinc-300",children:[E.brand," ",E.model]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"android"})," ",(0,n.jsxs)("dd",{className:"inline text-zinc-300",children:[E.android_version," (sdk ",E.sdk,")"]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"kind"})," ",(0,n.jsxs)("dd",{className:"inline text-zinc-300",children:[E.kind||(null==ej?void 0:ej.kind)||"unknown"," / ",E.transport||(null==ej?void 0:ej.transport)||"unknown"]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"display"})," ",(0,n.jsx)("dd",{className:"inline text-zinc-300",children:E.resolution})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"rotation"})," ",(0,n.jsx)("dd",{className:"inline text-zinc-300",children:E.rotation})]}),(0,n.jsx)("div",{className:"whitespace-pre-wrap text-[10px] leading-snug text-zinc-500",children:E.battery}),(0,n.jsx)("div",{className:"line-clamp-3 text-[10px] text-zinc-500",children:E.focus})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[ec(null===(t=E.diagnostics)||void 0===t?void 0:t.ready,b("已启动","Boot ready"),b("未完成启动","Boot pending")),ec(null===(s=E.diagnostics)||void 0===s?void 0:s.google_play,"Google Play","No Play"),ec(null===(l=E.diagnostics)||void 0===l?void 0:l.google_services,"GMS","No GMS"),ec(null===(i=E.diagnostics)||void 0===i?void 0:i.magisk,"Magisk","No Magisk"),ec(null===(a=E.diagnostics)||void 0===a?void 0:a.root,"Root","No root")]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/5 bg-black/20 p-3 text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{children:["boot_completed: ",(null===(r=E.diagnostics)||void 0===r?void 0:r.boot_completed)||"-"]}),(0,n.jsxs)("div",{children:["provisioned: ",(null===(o=E.diagnostics)||void 0===o?void 0:o.device_provisioned)||"-"]}),(0,n.jsxs)("div",{children:["setup_complete: ",(null===(c=E.diagnostics)||void 0===c?void 0:c.user_setup_complete)||"-"]}),(0,n.jsxs)("div",{children:["abi: ",(null===(d=E.diagnostics)||void 0===d?void 0:d.abi)||"-"]}),(0,n.jsxs)("div",{className:"truncate",children:["hardware: ",(null===(x=E.diagnostics)||void 0===x?void 0:x.hardware)||"-"]})]})]}):I?null:(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:b("加载中","Loading")})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-zinc-950/50 p-5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-300/90",children:b("Redroid 板块","Redroid panel")}),(0,n.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:b("启动默认实例","Start default")})]}),H?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:H}):null,W?(0,n.jsxs)("div",{className:"mt-3 space-y-3 text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,n.jsxs)("div",{children:["arch: ",W.arch||"-"]}),(0,n.jsxs)("div",{className:"truncate",children:["image: ",W.image||"-"]}),(0,n.jsxs)("div",{children:["profile: ",W.device_profile||"-"]}),(0,n.jsxs)("div",{children:["gpu: ",W.gpu_mode||"-"]}),(0,n.jsxs)("div",{children:["adb: 127.0.0.1:",W.default_port||5555]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[ec(null===(u=W.requirements)||void 0===u?void 0:u.docker_available,"Docker","No Docker"),ec(null===(m=W.requirements)||void 0===m?void 0:m.adb_available,"ADB","No ADB"),ec(null===(h=W.requirements)||void 0===h?void 0:h.kvm,"KVM","No KVM"),ec(null===(p=W.requirements)||void 0===p?void 0:p.binderfs,"binderfs","No binderfs")]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(W.instances||[]).map(e=>{var t,s,l,i;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-medium text-zinc-100",children:e.name}),(0,n.jsxs)("div",{className:"font-mono text-[10px] text-zinc-500",children:[e.port?"127.0.0.1:".concat(e.port):"-"," / ",e.status_text||"-"]})]}),(0,n.jsxs)("div",{className:"flex gap-1",children:[(0,n.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,n.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,n.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,n.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,n.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[ec(null===(t=e.diagnostics)||void 0===t?void 0:t.ready,b("系统就绪","System ready"),b("启动中","Booting")),ec(null===(s=e.diagnostics)||void 0===s?void 0:s.google_play,"Play","No Play"),ec(null===(l=e.diagnostics)||void 0===l?void 0:l.magisk,"Magisk","No Magisk"),ec(null===(i=e.diagnostics)||void 0===i?void 0:i.root,"Root","No root")]}),e.data_dir?(0,n.jsx)("div",{className:"mt-2 truncate font-mono text-[10px] text-zinc-500",children:e.data_dir}):null]},e.name)}),(null===(g=W.instances)||void 0===g?void 0:g.length)?null:(0,n.jsx)("p",{className:"rounded-xl border border-white/5 bg-black/20 p-3 text-xs text-zinc-500",children:b("当前没有 Redroid 实例。默认动作会创建 redroid13-1。","No Redroid instances yet. Default actions create redroid13-1.")})]})]}):(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:b("读取 Redroid 状态中","Loading Redroid status")})]})]}),(0,n.jsx)(er,{t:b,apiBase:w,fetchJson:v,serial:N,devices:_,setSerial:k,adbAvailable:z,lock:ew,overview:E,onAndroidAction:L,notify:f,onRefreshDevices:T}),z&&N?(0,n.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-emerald-300/90",children:b("快捷控制","Quick controls")}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL("3"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Home"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL("4"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Back"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL("187"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Recents"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void L("wake"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Wake"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void L("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,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL("24"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Vol+"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL("25"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Vol-"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL("66"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Enter"})]}),(0,n.jsx)("p",{className:"mt-3 text-[10px] text-zinc-600",children:b("滑动手势","Swipe gestures")}),(0,n.jsx)("div",{className:"mt-1 flex flex-wrap gap-2",children:["up","down","left","right"].map(e=>(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void L("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,n.jsxs)("div",{className:"mt-4 rounded-lg border border-white/5 bg-black/20 p-3",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:b("ADB 文本输入","ADB text input")}),(0,n.jsxs)("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row",children:[(0,n.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=>eg(e.target.value),placeholder:"hello / 123",onKeyDown:e=>{"Enter"===e.key&&eP()}}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP(),className:"rounded-lg bg-emerald-500/20 px-3 py-2 text-xs text-emerald-100 ring-1 ring-emerald-500/30",children:b("发送","Send")})]})]}),(0,n.jsxs)("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row sm:items-center",children:[(0,n.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,n.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:b("打开链接","Open URL")})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,n.jsxs)("h4",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-cyan-300/90",children:[(0,n.jsx)(R.Z,{className:"h-4 w-4"}),b("USB 真机优化建议","USB optimization")]}),(0,n.jsxs)("ul",{className:"mt-3 space-y-2 text-xs leading-relaxed text-zinc-400",children:[(0,n.jsx)("li",{children:b("优先使用主板直连 USB,不要经过不稳的 HUB。","Prefer direct motherboard USB, not unstable hubs.")}),(0,n.jsx)("li",{children:b("开发板端固定 adb server,避免频繁 kill-server。","Keep adb server stable and avoid frequent kill-server.")}),(0,n.jsx)("li",{children:b("镜像页默认支持 scrcpy H.264 真流,截图模式作为回退。","Use scrcpy H.264 live stream first, screenshot mode as fallback.")}),(0,n.jsx)("li",{children:b("如果 TikTok / YouTube App 直播,要先确认屏幕常亮、分辨率稳定、USB 供电足够。","For TikTok / YouTube app live, keep screen on, resolution stable, and USB power sufficient.")})]})]})]}):null,z&&N?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(A.Z,{className:"h-4 w-4 text-emerald-400"}),b("包名搜索与启动","Packages")]}),(0,n.jsxs)("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row",children:[(0,n.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&&e_()}}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void e_(),className:"rounded-xl bg-emerald-500/20 px-4 py-2 text-sm text-emerald-100 ring-1 ring-emerald-500/30",children:b("搜索","Search")})]}),(0,n.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,n.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 py-1 text-zinc-400",children:[(0,n.jsx)("span",{className:"min-w-0 truncate text-zinc-300",children:e.package}),(0,n.jsxs)("span",{className:"flex shrink-0 gap-1",children:[(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void L("launch_package",{package:e.package}),className:"rounded bg-white/10 px-2 py-0.5 text-[10px] text-zinc-200",children:b("启动","Launch")}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void L("force_stop",{package:e.package}),className:"rounded bg-rose-500/15 px-2 py-0.5 text-[10px] text-rose-200",children:b("停止","Stop")})]})]},e.package)),q.length?null:(0,n.jsx)("li",{className:"py-2 text-center text-zinc-600",children:b("暂无结果","No results")})]})]}):null,z&&N?(0,n.jsxs)("div",{className:"grid gap-6 xl:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(D.Z,{className:"h-4 w-4 text-amber-400"}),"ADB shell"]}),(0,n.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:eo.map(e=>(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>$(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,n.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:J,onChange:e=>$(e.target.value),spellCheck:!1,onKeyDown:e=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),ez())}}),(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void ez(),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,n.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}),"Run"]}):"Run"}),X?(0,n.jsxs)("button",{type:"button",disabled:!X,onClick:()=>P(X),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,n.jsx)(M.Z,{className:"h-3.5 w-3.5"}),b("复制输出","Copy")]}):null]}),X?(0,n.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:X}):null]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:b("Logcat","Logcat")}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,n.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,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 text-[11px] text-zinc-400",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:eb,onChange:e=>ef(e.target.checked)}),b("每 3 秒自动刷新","Auto every 3s")]}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eS(),className:"rounded-xl bg-cyan-500/20 px-4 py-2 text-sm text-cyan-100 ring-1 ring-cyan-500/30",children:b("拉取日志","Pull logs")}),es?(0,n.jsxs)("button",{type:"button",onClick:()=>P(es),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,n.jsx)(M.Z,{className:"h-3.5 w-3.5"}),b("复制","Copy")]}):null]}),el?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:el}):null,es?(0,n.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:es}):null]})]}):null,z&&N?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(O.Z,{className:"h-4 w-4 text-fuchsia-400"}),b("界面节点","UI nodes")]}),(0,n.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:b("刷新节点","Refresh nodes")}),ex?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:ex}):null,(0,n.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:[ea.map((e,t)=>(0,n.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,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"text-zinc-200",children:e.label}),e.resource_id?(0,n.jsx)("span",{className:"ml-2 font-mono text-[10px] text-zinc-600",children:e.resource_id}):null,(0,n.jsxs)("div",{className:"font-mono text-[10px] text-zinc-600",children:["(",e.center_x,", ",e.center_y,")",e.clickable?" click":""]})]}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void L("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))),ea.length||ex?null:(0,n.jsx)("li",{className:"py-4 text-center text-zinc-600",children:b("尚未加载","Not loaded")})]})]}):null,z&&N?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:b("安装 APK","Install APK")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:b("先 adb push 到 /sdcard/ 再执行安装。","Push the APK to /sdcard/ first.")}),(0,n.jsx)("input",{className:"mt-4 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm",value:S,onChange:e=>C(e.target.value)}),(0,n.jsx)("button",{type:"button",disabled:ew||!z||!N,onClick:()=>void L("install_apk",{path:S}),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 ex=s(9897),eu=s(4554),em=s(7689),eh=s(8401);function ep(e){let{t,title:s,subtitle:l,steps:i,onNavigate:a}=e;return(0,n.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,n.jsx)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:s}),(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-400",children:l}),(0,n.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,n.jsxs)("div",{className:"flex items-center gap-4",children:[e.openUrl||e.target&&a?(0,n.jsxs)("button",{type:"button",onClick:()=>{if(e.openUrl){window.open((0,eh.p)(e.openUrl),"_blank","noopener,noreferrer");return}e.target&&a&&a(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,n.jsx)("span",{children:e.label}),e.sub?(0,n.jsx)("span",{className:"mt-1 text-[10px] font-normal text-white/80",children:e.sub}):null]}):(0,n.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,n.jsx)("span",{children:e.label}),e.sub?(0,n.jsx)("span",{className:"mt-1 text-[10px] font-normal text-white/80",children:e.sub}):null]}),t8?e.slice(-8):e;if(e.includes("live2/")){let t=e.split("/"),s=t[t.length-1]||"";return s.length>8?s.slice(-8):s}}}let t=e.trim();return!t||t.includes("\n")||t.toLowerCase().startsWith("rtmp")?"":t.length>8?t.slice(-8):t}function ej(e){let t=[];for(let s of e.split(/\r?\n/)){let e=s.trim();if(!e||e.startsWith("#")||!/douyin\.com|v\.douyin\.com/i.test(e))continue;let n=e.match(/(https?:\/\/live\.douyin\.com\/[a-zA-Z0-9_-]+)/i);if(n){t.push(n[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 eN(e){let t=(e||"").trim().replace(/^[\s"'`[\]()()【】]+|[\s"'`[\]()()【】]+$/g,"");return!(t=(t=(t=(t=t.replace(/^(?:主播|房间名|直播间|抖音源|源站|标题)\s*[::]\s*/i,"")).replace(/https?:\/\/(?:www\.)?live\.douyin\.com\/[a-zA-Z0-9_-]+/gi,"")).replace(/(?:等待直播|正在直播|直播中|已开播|开始推流|主播已下播|下播|录制中|推流中).*$/i,"")).trim().replace(/^[\s,,;;||\-—::]+|[\s,,;;||\-—::]+$/g,""))||/^[-—_无未知]+$/i.test(t)||/^(unknown|null|undefined|none|nan)$/i.test(t)||/live\.douyin\.com/i.test(t)||/^\d{5,}$/.test(t)||/^(监测|格式|错误|无录制任务)/.test(t)?"":t.slice(0,48)}function ek(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=function(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(!e||e.startsWith("#"))continue;let s=e.match(/https?:\/\/(?:www\.)?live\.douyin\.com\/[a-zA-Z0-9_-]+/i);if(!s||null==s.index)continue;let n=eN(e.slice(s.index+s[0].length));if(n)return n;let l=e.split(/[,,||]/,2);if(l.length>1){let e=eN(l[1]);if(e)return e}}return""}(e)||function(e){var t,s,n;let l=e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).slice(-160),i=/(?:主播|房间名|直播间|抖音源|源站|标题)\s*[::]\s*(.{1,80})/i,a=/(?:序号\s*\d+\s*)?(.{1,80}?)\s*(?:等待直播|主播已下播|下播)/i,r=/(?:获取失败|错误|异常|error|failed|exception)/i;for(let e of[/(?:正在录制|录制中)\s*\d*\s*个?\s*[::]\s*([^\[\r\n]{1,80})/i,/(?:序号\s*\d+\s*)?(.{1,80}?)\s*(?:正在直播中|正在直播|直播中|已开播|开始推流|录制中|推流中)/i])for(let s=l.length-1;s>=0;s-=1){let n=eN((null===(t=l[s].match(e))||void 0===t?void 0:t[1])||"");if(n)return n}for(let e=l.length-1;e>=0;e-=1){if(r.test(l[e]))continue;let t=eN((null===(s=l[e].match(i))||void 0===s?void 0:s[1])||"");if(t)return t}for(let e=l.length-1;e>=0;e-=1){let t=eN((null===(n=l[e].match(a))||void 0===n?void 0:n[1])||"");if(t)return t}return""}(t);if(s)return s;let n=e_(t)||ez(e)[0]||"";return n?"抖音直播间 ".concat(n):""}function e_(e){if(!e)return null;let t=null;for(let s of e.split(/\r?\n/)){let e=s.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i);e&&(t=e[1]);let n=s.match(/https?:\/\/[^/\s]*douyin\.com\/(\d{8,})/i);n&&(t=n[1])}return t}function ez(e){let t=[];for(let s of e.split(/\r?\n/)){let e=s.trim();if(!e||e.startsWith("#")||!/douyin\.com|v\.douyin\.com/i.test(e))continue;let n=e.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i);if(n){t.push(n[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)}function eS(e){let t="",s=!0,n="",l=!0,i=e.split(/\r?\n/),a=!1;for(let e of i){let i=e.trim();if(/^\[youtube\]/i.test(i)){a=!0;continue}if(/^\[/.test(i)){a=!1;continue}if(!a||!i||i.startsWith("#")||i.startsWith(";"))continue;let r=i.indexOf("=");if(r<0)continue;let o=i.slice(0,r).trim().toLowerCase(),c=i.slice(r+1).trim().split(/[#;]/)[0].trim();"key"===o||"stream_key"===o?t=c:"rtmps"===o?s=!/^(0|false|否)/i.test(c):"bitrate"===o?n=c:"fast_audio"===o&&(l=/^(1|true|yes|是|开|on)/i.test(c))}return{key:t,rtmps:s,bitrate:n,fastAudio:l}}function eC(e){return"URL_config.".concat(e.replace(/[^a-zA-Z0-9_.-]/g,"_"),".ini")}function eR(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 eL(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 eP(e){var t,s,l;let{t:i,currentProc:a,fetchJson:r,urlListText:o,keySuffixUi:c,showKeyRow:d=!0,pollMs:x=1e3,refreshToken:u=0,monitorRow:m}=e,[h,p]=(0,Z.useState)(""),[g,b]=(0,Z.useState)(""),[f,v]=(0,Z.useState)(""),[y,j]=(0,Z.useState)(""),[N,k]=(0,Z.useState)(""),[_,z]=(0,Z.useState)([]),[S,C]=(0,Z.useState)(null),[R,L]=(0,Z.useState)(""),[P,M]=(0,Z.useState)(""),[T,E]=(0,Z.useState)(""),[U,I]=(0,Z.useState)(""),[A,D]=(0,Z.useState)(!1),[O,B]=(0,Z.useState)(!1),[W,H]=(0,Z.useState)(!1),[F,Y]=(0,Z.useState)(!1),[V,J]=(0,Z.useState)(null),[$,X]=(0,Z.useState)(0),[Q,ee]=(0,Z.useState)(!0),et=(0,Z.useRef)(null),es=(0,Z.useRef)(null),en=(0,Z.useRef)(!1),el=(0,Z.useRef)(!1),ei=(0,Z.useRef)(!1),ea=(0,Z.useRef)(a),er=(0,Z.useRef)(0),eo=ez(o),ec=/^(online|running)$/i.test(h),ed=e_(g),ex=ej(o),eu=null!==(s=ex[0])&&void 0!==s?s:"",em=W||!!(null==m?void 0:m.is_pushing)||["streaming","relay_slow"].includes(y.trim().toLowerCase()),eh="number"==typeof(null==m?void 0:m.ffmpeg_speed)?m.ffmpeg_speed.toFixed(2):null,ep="number"==typeof(null==m?void 0:m.ffmpeg_frame)?String(m.ffmpeg_frame):null,eb=_.length?_.join(", "):em||(null==m?void 0:m.ffmpeg_active)?i("转推活跃(PID 未采集)","Relay active (PID n/a)"):i("无","none"),ef=A&&em&&!O,ev=ef?"":P,ey=ef?"":T,ew=ex.length>1&&em&&!ey&&!ev&&!ed&&(A||!!U||!!R),eN=ev||ed||(ew?null:null!==(l=null===(t=eu.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i))||void 0===t?void 0:t[1])&&void 0!==l?l:null),eS=ey||(ev?"https://live.douyin.com/".concat(ev):"")||(ed?"https://live.douyin.com/".concat(ed):"")||(ew?null:eu||null),eC=ef?ek("",g):ek(o,g),eR=(ef?"":U)||(ef?"":R)||eC||(eN?"抖音直播间 ".concat(eN):""),eP="youtube_key_rejected"===y.trim().toLowerCase(),eM=(0,Z.useCallback)(async()=>{let e=ea.current.trim();if(!e)return;if(el.current){ei.current=!0;return}el.current=!0;let t=++er.current;try{let s=await r("/status?process=".concat(encodeURIComponent(e),"&light=1"));if(t!==er.current||e!==ea.current.trim())return;let n=s.process_status||"unknown";p(n),b(s.recent_log||""),v(s.recent_error||""),j(s.business_status||""),k(s.business_note||""),z(Array.isArray(s.ffmpeg_pids)?s.ffmpeg_pids:[]),C("number"==typeof s.log_age_seconds?s.log_age_seconds:null),L(s.source_title||""),M(s.source_room_id||""),E(s.source_url||""),I(s.source_display||""),D(!!s.source_ambiguous),B(!!s.source_current),H(!!s.is_pushing);let l=/^(online|running)$/i.test(n);l&&!en.current&&J(Date.now()),l||J(null),en.current=l}catch(s){if(t!==er.current||e!==ea.current.trim())return;p("error"),j("error"),k(""),z([]),C(null),L(""),M(""),E(""),I(""),D(!1),B(!1),H(!1)}finally{el.current=!1,ei.current&&(ei.current=!1,window.setTimeout(()=>void eM(),0))}},[r]);(0,Z.useEffect)(()=>{if(ea.current=a,er.current+=1,ei.current=!1,!a){p(""),b(""),v(""),j(""),k(""),z([]),C(null),L(""),M(""),E(""),I(""),D(!1),B(!1),H(!1),J(null),en.current=!1;return}p(""),b(""),v(""),j(""),k(""),z([]),C(null),L(""),M(""),E(""),I(""),D(!1),B(!1),H(!1),J(null),en.current=!1,eM()},[a,eM]),(0,Z.useEffect)(()=>{let e=()=>ee("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,Z.useEffect)(()=>{a&&eM()},[a,eM,u]),(0,Z.useEffect)(()=>{if(F||!a||x<=0)return;let e=window.setInterval(()=>void eM(),x);return()=>clearInterval(e)},[F,a,eM,x]),(0,Z.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&eM()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[eM]),(0,Z.useEffect)(()=>{if(!V)return;let e=window.setInterval(()=>X(e=>e+1),1e3);return()=>clearInterval(e)},[V]),(0,Z.useEffect)(()=>{if(F||!Q)return;let e=et.current;e&&(e.scrollTop=e.scrollHeight)},[g,F,Q]),(0,Z.useEffect)(()=>{if(F||!Q)return;let e=es.current;e&&(e.scrollTop=e.scrollHeight)},[f,F,Q]);let eT=null==V?i("—(未检测到在线)","— (not online)"):eL(Math.max(0,Math.floor((Date.now()-V)/1e3))),eE=F?i("已暂停刷新","Paused"):x<=0?i("已暂停","Paused"):x>=3e4?i("约 30 秒","~30s"):x>=15e3?i("约 15 秒","~15s"):x>=12e3?i("约 12 秒","~12s"):x>=5e3?i("约 5 秒","~5s"):x>=2500?i("约 2.5 秒","~2.5s"):x>=2e3?i("约 2 秒","~2s"):x>=800?i("约 1 秒","~1s"):"".concat(x,"ms"),eU=F?"bg-amber-500/20 text-amber-100 ring-amber-500/35":x>=3e4?"bg-sky-500/15 text-sky-100 ring-sky-500/25":x>=4e3?"bg-zinc-500/15 text-zinc-200/90 ring-zinc-500/25":"bg-emerald-500/15 text-emerald-200/90 ring-emerald-500/25";return(0,n.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,n.jsx)("span",{className:"sr-only","aria-hidden":!0,children:$}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:i("当前直播日志","Live process log")}),em?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-emerald-500/15 px-2.5 py-0.5 text-[10px] font-medium text-emerald-100 ring-1 ring-emerald-500/25",children:[(0,n.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,n.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-70"}),(0,n.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-emerald-400"})]}),i("推流中","Pushing")]}):null,(0,n.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:a||"—"}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-medium ring-1 ".concat(eU),children:eE})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>void eM(),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,n.jsx)(w.Z,{className:"h-3.5 w-3.5"}),i("立即拉取","Refresh")]}),(0,n.jsxs)("button",{type:"button",onClick:()=>Y(e=>!e),className:"inline-flex items-center gap-1 rounded-lg px-3 py-1.5 text-xs ring-1 ".concat(F?"bg-amber-500/20 text-amber-100 ring-amber-500/35":"border border-white/10 bg-black/30 text-zinc-300"),children:[F?(0,n.jsx)(G.Z,{className:"h-3.5 w-3.5"}):(0,n.jsx)(q.Z,{className:"h-3.5 w-3.5"}),F?i("继续自动刷新","Resume"):i("暂停自动刷新","Pause")]})]})]}),(0,n.jsxs)("div",{className:"mt-4 space-y-3 rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.05] bg-black/20 p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:i("进程状态","Process")}),(0,n.jsx)("span",{className:"mt-2 inline-flex rounded-full px-2.5 py-0.5 text-[11px] font-medium ring-1 ".concat(function(e){let t=(e||"").trim().toLowerCase();return"online"===t||"running"===t?"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30":"stopped"===t||"stopping"===t?"bg-zinc-600/20 text-zinc-300 ring-zinc-500/25":"not_found"===t||"errored"===t||"error"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"bg-zinc-600/20 text-zinc-300 ring-zinc-500/25"}(h)),children:function(e,t){let s=(t||"unknown").toLowerCase();return"online"===s||"running"===s?e("运行中(PM2/进程在线)","Running (process online)"):"stopped"===s||"stopping"===s?e("已停止","Stopped"):"not_found"===s||"errored"===s?e("未运行或未找到","Not running / not found"):"invalid"===s?e("无效进程名","Invalid process"):t||"—"}(i,h)})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.05] bg-black/20 p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:i("业务状态","Business")}),(0,n.jsx)("span",{className:"mt-2 inline-flex max-w-full rounded-full px-2.5 py-0.5 text-[11px] font-medium ring-1 ".concat(function(e){let t=(e||"").trim().toLowerCase();return"streaming"===t||"relay_slow"===t?"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30":"waiting_source"===t||"monitoring"===t||"source_live"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/25":"misconfigured"===t||"youtube_key_rejected"===t||"error"===t||"stale"===t||"source_stalled"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"bg-zinc-600/20 text-zinc-300 ring-zinc-500/25"}(y)),title:function(e,t,s){let n=(t||"").toLowerCase();return"streaming"===n?e("正在推流到 YouTube","Pushing to YouTube"):"relay_slow"===n?e("推流速度偏低","Relay running slowly"):"waiting_source"===n?e("等待上游直播源开播","Waiting for the upstream live source"):"source_live"===n?e("源站已开播,转推 Worker 未启动","Source live detected, but no active FFmpeg relay worker"):"monitoring"===n?e("进程在线,监控源站中","Process online and monitoring the source"):"misconfigured"===n?e("YouTube 密钥缺失或无效","YouTube key missing or invalid"):"youtube_key_rejected"===n?e("YouTube 推流失败:串流密钥无效、过期或不属于当前直播间","YouTube rejected the stream key"):"source_stalled"===n?e("上游源站卡住","Upstream source stalled"):"stale"===n?e("进程在线但日志心跳过期","Process online but the log heartbeat is stale"):"error"===n?e("检测到近期进程错误","Recent process error detected"):(null==s?void 0:s.trim())?s.trim():e("暂无业务状态","No business-state hint yet")}(i,y,N),children:function(e,t){let s=(t||"").toLowerCase();return"streaming"===s?e("推流中","Pushing"):"relay_slow"===s?e("低速","Slow"):"waiting_source"===s?e("等源","Wait source"):"source_live"===s?e("源开播","Source live"):"monitoring"===s?e("监控中","Monitoring"):"misconfigured"===s?e("密钥异常","Key invalid"):"youtube_key_rejected"===s?e("密钥被拒","Key rejected"):"source_stalled"===s?e("源卡住","Stalled"):"stale"===s?e("心跳过期","Stale"):"error"===s?e("异常","Error"):e("未知","Unknown")}(i,y)})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.05] bg-black/20 p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:i("本次在线时长(估算)","Online duration (est.)")}),(0,n.jsx)("p",{className:"mt-2 font-mono text-sm font-semibold text-cyan-200/90",children:eT})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.05] bg-black/20 p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:i("FFmpeg workers","FFmpeg workers")}),(0,n.jsx)("p",{className:"mt-2 font-mono text-sm text-zinc-200",children:eb}),eh||ep?(0,n.jsxs)("p",{className:"mt-1 font-mono text-[10px] text-zinc-500",children:[eh?"speed ".concat(eh,"x"):"",eh&&ep?" \xb7 ":"",ep?"frame ".concat(ep):""]}):null,null!=S?(0,n.jsxs)("p",{className:"mt-1 text-[10px] text-zinc-600",children:[i("日志心跳","Log heartbeat")," ",eL(Math.max(0,Math.floor(S)))]}):null]})]}),eR?(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.05] bg-black/20 px-3 py-2.5",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:i("当前转播源","Current relay source")}),(0,n.jsx)("p",{className:"mt-1 text-sm font-medium text-zinc-200",children:eR})]}):null,d?(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,n.jsx)("span",{className:"text-zinc-500",children:i("YouTube key 尾码(参考)","YT key suffix")}),(0,n.jsx)("span",{className:"font-mono text-zinc-300",children:c||"—"})]}):null,eP?(0,n.jsx)("div",{className:"rounded-lg border border-rose-500/30 bg-rose-500/[0.10] px-3 py-2.5 text-xs text-rose-100 ring-1 ring-rose-500/15",children:(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(eg.Z,{className:"mt-0.5 h-4 w-4 shrink-0 text-rose-300","aria-hidden":!0}),(0,n.jsx)("p",{children:i("YouTube 已拒绝本次 RTMPS 推流。请从 YouTube Studio 当前直播间复制完整串流密钥,保存到当前线路后重新开始;如果密钥确认无误,再检查到 YouTube RTMPS 的网络/代理。","YouTube rejected this RTMPS publish. Copy the full stream key for the current live event from YouTube Studio, save it to this lane, then start again; if the key is correct, check network/proxy access to YouTube RTMPS.")})]})}):null,eS?(0,n.jsxs)("div",{className:"rounded-lg border border-violet-500/20 bg-violet-500/[0.06] px-3 py-2.5",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium text-zinc-400",children:ed?i("当前直播源站(日志)","Current source (from log)"):ec?i("配置中的源站地址","Configured source URL"):i("源站快捷入口","Source quick link")}),(0,n.jsxs)("a",{href:eS,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,n.jsx)(K.Z,{className:"h-3.5 w-3.5 shrink-0 opacity-90"}),eR||i("打开抖音直播页","Open Douyin live")]})]}),eN&&eR&&!eR.includes(eN)?(0,n.jsxs)("p",{className:"mt-2 font-mono text-[10px] text-zinc-600",children:["room:",eN]}):null,eo.length>1&&ed?(0,n.jsxs)("p",{className:"mt-2 text-[10px] text-zinc-600",children:[i("配置中还有","Also in config:")," ",eo.filter(e=>e!==eN).slice(0,3).map(e=>(0,n.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)),eo.length>4?"…":null]}):null]}):(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:i("(日志与地址列表中暂无抖音房间)","(No Douyin room in log or URL list)")})]}),"not_found"!==h&&"invalid"!==h?(0,n.jsxs)("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-emerald-400/90",children:i("进程输出(stdout / 合并日志)","Process output")}),(0,n.jsx)("pre",{ref:et,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:g.trim()||i("(暂无)","(empty)")})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-rose-400/90",children:i("异常信息(stderr)","Stderr")}),(0,n.jsx)("pre",{ref:es,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:f.trim()||i("(暂无)","(empty)")})]})]}):(0,n.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:i("进程未在 PM2 / 本地注册表中运行,日志区域已隐藏。","Process not running — log panes hidden.")})]})}function eM(e){return/tiktok/i.test(e.script)||/tiktok/i.test(e.pm2)}let eT=[{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."}],eE="live-hub-tiktok-hdmi-check-v1",eU="live-hub-tiktok-hdmi-notes-v1",eZ="live-hub-tiktok-source-mode-v1";function eI(e){var t;let{t:s,busy:l,entries:i,currentProc:a,setCurrentProc:r,urlConfig:o,setUrlConfig:c,onRunProcess:d,onSaveUrlConfig:x,onReplayGoLive:u,onCopy:m,fetchJson:h,apiPrefix:p,quickLinks:g,hdmiStatus:b,notify:f,onNavigate:v}=e,y=(0,Z.useMemo)(()=>i.filter(eM),[i]),w=y.length?y:i,[j,N]=(0,Z.useState)("srs"),[k,_]=(0,Z.useState)([]),[z,R]=(0,Z.useState)(!1),[L,P]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)("1080p30"),[U,I]=(0,Z.useState)("1080p30"),[A,D]=(0,Z.useState)(!1),[O,B]=(0,Z.useState)(!0),[W,K]=(0,Z.useState)(null),H=(0,Z.useRef)(!1),F=(0,Z.useRef)(o),[G,q]=(0,Z.useState)(""),[V,$]=(0,Z.useState)({}),X=(0,Z.useCallback)(e=>{F.current=e,c(e)},[c]),Q=(0,Z.useCallback)(e=>{N(e);try{window.localStorage.setItem(eZ,e)}catch(e){}},[]);(0,Z.useEffect)(()=>{try{let e=window.localStorage.getItem(eZ);("ffmpeg"===e||"replay"===e||"srs"===e)&&("ffmpeg"!==e&&"replay"!==e?N(e):N("srs"))}catch(e){}},[]),(0,Z.useEffect)(()=>{H.current=!1},[a]),(0,Z.useEffect)(()=>{F.current=o},[o]);let ee=(0,Z.useCallback)(async()=>{if(a)try{var e;let t=new URLSearchParams({process:a,_ts:String(Date.now())}),s=await h("/get_url_config?".concat(t));X(null!==(e=s.content)&&void 0!==e?e:"")}catch(e){}},[X,a,h]);(0,Z.useEffect)(()=>{if(!a||!O||"ffmpeg"!==j)return;let e=window.setInterval(()=>{H.current||ee()},8e3);return()=>clearInterval(e)},[a,O,ee,j]),(0,Z.useEffect)(()=>{"ffmpeg"===j&&a&&ee()},[j,a,ee]);let et=(0,Z.useCallback)(async()=>{if(a){R(!0);try{var e;let t=await h("/tiktok_replay/list?process=".concat(encodeURIComponent(a)));_(null!==(e=t.files)&&void 0!==e?e:[])}catch(e){f(e.message),_([])}finally{R(!1)}}},[a,h,f]);(0,Z.useEffect)(()=>{"replay"===j&&a&&et()},[j,a,et]),(0,Z.useEffect)(()=>{try{let e=window.localStorage.getItem(eE);e&&$(JSON.parse(e))}catch(e){}try{q(window.localStorage.getItem(eU)||"")}catch(e){}},[]);let es=(0,Z.useCallback)(e=>{$(e);try{window.localStorage.setItem(eE,JSON.stringify(e))}catch(e){}},[]),en=e=>{q(e);try{window.localStorage.setItem(eU,e)}catch(e){}},el=async()=>{if(a){D(!0),K(null),H.current=!1;try{var e;let t=new URLSearchParams({process:a,_ts:String(Date.now())}),n=await h("/get_url_config?".concat(t));X(null!==(e=n.content)&&void 0!==e?e:""),K(s("已从服务器读取 URL_config","Reloaded URL_config from server"))}catch(e){K(e.message)}finally{D(!1)}}},ei=async()=>{try{await Promise.resolve(x(F.current)),H.current=!1}catch(e){}},ea=async e=>{if(a){P(!0);try{await h("/tiktok_replay/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:a,filename:e})}),f(s("已删除文件","File removed")),await et()}catch(e){f(e.message)}finally{P(!1)}}},er=async e=>{var t;let n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(e.target.value="",n&&a){P(!0);try{let e=new FormData;e.append("file",n);let t=await (0,J.N)("".concat(p,"/tiktok_replay/upload?process=").concat(encodeURIComponent(a)),{method:"POST",body:e});f(t.message||s("上传成功","Uploaded")),await et()}catch(e){f(e.message)}finally{P(!1)}}},eo=l||A||L,ec=eT.find(e=>e.id===U),ed=!!(null==b?void 0:b.can_stream_hdmi),eh=(null==b?void 0:b.preferred_device)||(null==b?void 0:null===(t=b.video_devices)||void 0===t?void 0:t[0])||"";return(0,n.jsxs)("div",{className:"mx-auto max-w-4xl space-y-6",children:[v?(0,n.jsx)(ep,{t:s,title:s("TikTok HDMI 硬件链路","TikTok HDMI hardware chain"),subtitle:s("板端编码经 HDMI 到显示/下游设备;与「网络」页顶卡相同的箭头风格。","Encode on SoC → HDMI → display/downstream; same arrow style as Network header."),onNavigate:v,steps:[{label:"FFmpeg",sub:s("采集 / 推流","Capture"),gradient:"from-cyan-400 to-blue-500",target:"live_tiktok"},{label:"HDMI",sub:s("板载输出","SoC out"),gradient:"from-violet-500 to-fuchsia-500"},{label:"Android",sub:s("AOSP / 手机","AOSP"),gradient:"from-amber-400 to-orange-500",target:"android"}]}):null,(0,n.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,n.jsx)("div",{className:"flex flex-wrap items-start gap-4",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.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,n.jsx)(C.Z,{className:"h-5 w-5 text-cyan-200"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg font-semibold tracking-tight text-white",children:s("TikTok 无人直播(单路)","TikTok unmanned (single lane)")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:s("布局对齐 YouTube 单频道:直播开关 + 源站 + URL_config;无 stream key,输出走 HDMI 硬件链路。","Same layout as YouTube single: controls + URLs; no stream key — HDMI hardware path.")})]})]})})}),(0,n.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,n.jsx)("p",{className:"text-xs leading-relaxed text-cyan-100/90",children:s("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,n.jsxs)("div",{className:"rounded-2xl border border-white/10 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(ex.Z,{className:"h-4 w-4 text-cyan-300"}),s("X86 HDMI 采集状态","X86 HDMI capture status")]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("这里直接显示主机是否识别到采集卡和 /dev/video 设备,可用于验证 ARM HDMI 进 X86 的链路。","Shows whether the host sees the capture card and /dev/video nodes for ARM-to-X86 HDMI ingest.")})]}),(0,n.jsx)("span",{className:"rounded-full px-3 py-1 text-[11px] font-semibold ring-1 ".concat(ed?"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30":"bg-rose-500/15 text-rose-200 ring-rose-500/25"),children:ed?s("可推流","Ready"):s("未就绪","Not ready")})]}),(0,n.jsxs)("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-4 text-[11px] text-zinc-400",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"device: "}),(0,n.jsx)("span",{className:"font-mono text-zinc-200",children:eh||"—"})]}),(0,n.jsxs)("p",{className:"mt-2",children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"video nodes: "}),(0,n.jsx)("span",{className:"font-mono text-zinc-200",children:((null==b?void 0:b.video_devices)||[]).join(", ")||"—"})]}),(0,n.jsxs)("p",{className:"mt-2",children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"usb matches: "}),(0,n.jsx)("span",{className:"text-zinc-300",children:((null==b?void 0:b.usb_capture_matches)||[]).length||0})]})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-4 text-[11px] text-zinc-400",children:[(0,n.jsx)("p",{className:"text-zinc-600",children:s("建议 FFmpeg","Suggested FFmpeg")}),(0,n.jsx)("p",{className:"mt-2 break-all font-mono text-zinc-200",children:(null==b?void 0:b.suggested_ffmpeg_cmd)||"—"}),(null==b?void 0:b.suggested_ffmpeg_cmd)?(0,n.jsxs)("button",{type:"button",onClick:()=>m(b.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,n.jsx)(M.Z,{className:"h-3.5 w-3.5"}),s("复制命令","Copy command")]}):null]})]}),((null==b?void 0:b.issues)||[]).length?(0,n.jsx)("ul",{className:"mt-4 list-inside list-disc space-y-1 text-[11px] text-amber-200/85",children:((null==b?void 0:b.issues)||[]).map(e=>(0,n.jsx)("li",{children:e},e))}):null]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-amber-500/20 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-amber-200/90",children:[(0,n.jsx)(Y.Z,{className:"h-4 w-4"}),(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:s("直播开关","Live control")})]}),(0,n.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:s("TikTok 进程(PM2)","TikTok PM2 process")}),(0,n.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:a,onChange:e=>r(e.target.value),children:w.map(e=>(0,n.jsxs)("option",{value:e.pm2,children:[e.label," (",e.pm2,")"]},e.pm2))}),(0,n.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:s("直播源","Video source")}),(0,n.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=>Q(e.target.value),children:[(0,n.jsx)("option",{value:"ffmpeg",hidden:!0,children:"FFmpeg(抖音 / TikTok 等直播间 URL)"}),(0,n.jsx)("option",{value:"replay",hidden:!0,children:s("录播素材(本地上传)","VOD upload")}),(0,n.jsx)("option",{value:"srs",children:s("SRS(OBS 推流)","SRS (OBS)")})]}),"srs"===j?(0,n.jsx)("p",{className:"mt-2 text-[11px] leading-relaxed text-amber-200/85",children:s("此模式不显示 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,n.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[["start",s("开始直播","Start"),"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30"],["stop",s("停止直播","Stop"),"bg-rose-500/15 text-rose-200 ring-rose-500/25"],["restart",s("重新开始","Restart"),"bg-amber-500/15 text-amber-200 ring-amber-500/25"]].map(e=>{let[t,s,l]=e;return(0,n.jsx)("button",{type:"button",disabled:eo,onClick:()=>d(t),className:"rounded-xl px-4 py-3 text-sm font-medium ring-1 ".concat(l),children:s},t)})}),(0,n.jsxs)("p",{className:"mt-3 text-center text-[11px] text-zinc-500",children:[s("当前 HDMI 预设(备忘)","HDMI preset (memo)"),":"," ",(0,n.jsx)("span",{className:"font-mono text-cyan-300/90",children:ec?s(ec.labelZh,ec.labelEn):U})]})]}),"replay"===j?(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/25 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(eu.Z,{className:"h-4 w-4 text-violet-300"}),s("录播素材","VOD library")]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.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,n.jsx)(em.Z,{className:"h-3.5 w-3.5"}),(0,n.jsx)("span",{children:s("上传视频","Upload")}),(0,n.jsx)("input",{type:"file",accept:".mp4,.mkv,.ts,.flv,.mov,.m4v,.webm",className:"hidden",onChange:er})]}),(0,n.jsx)("button",{type:"button",disabled:eo||!a,onClick:()=>void et(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-300",children:s("刷新列表","Refresh")})]})]}),(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:s("文件保存在服务器 config/tiktok_replay/对应进程目录;点「开始直播」会写入 replayfile 行并启动 PM2 进程。停播请用上方「停止直播」。","Files under config/tiktok_replay/. Go live writes replayfile + starts PM2. Use Stop above to stop.")}),z?(0,n.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:s("加载中…","Loading…")}):0===k.length?(0,n.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:s("暂无文件,请先上传。","No files yet.")}):(0,n.jsx)("ul",{className:"mt-4 space-y-2",children:k.map(e=>(0,n.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,n.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.name}),(0,n.jsxs)("span",{className:"shrink-0 text-zinc-500",children:[(e.size/1048576).toFixed(1)," MB"]}),(0,n.jsxs)("div",{className:"flex shrink-0 flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:eo,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:s("开始直播","Go live")}),(0,n.jsx)("button",{type:"button",disabled:eo,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:s("停播","Stop")}),(0,n.jsxs)("button",{type:"button",disabled:eo,onClick:()=>void ea(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,n.jsx)(S.Z,{className:"h-3 w-3"}),s("删除","Del")]})]})]},e.name))})]}):null,"srs"===j?(0,n.jsxs)("div",{className:"rounded-2xl border border-emerald-500/25 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:s("SRS / OBS 推流","SRS / OBS ingest")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("OBS:设置 → 推流 → 服务选「自定义」,服务器填 RTMP 地址;串流密钥可与 SRS 应用配置一致(默认 live/livestream)。","OBS → Stream → Custom: RTMP URL as server; stream key per SRS app (default live/livestream).")}),(0,n.jsxs)("dl",{className:"mt-4 space-y-3 text-xs",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-500",children:s("RTMP 推流地址(OBS 服务器)","RTMP publish URL")}),(0,n.jsxs)("dd",{className:"mt-1 flex flex-wrap items-center gap-2 font-mono text-emerald-200/90",children:[(0,n.jsx)("span",{className:"break-all",children:g.srs_rtmp_publish||"—"}),g.srs_rtmp_publish?(0,n.jsx)("button",{type:"button",className:"shrink-0 text-cyan-300 hover:text-cyan-200",onClick:()=>m(g.srs_rtmp_publish),children:(0,n.jsx)(M.Z,{className:"h-3.5 w-3.5"})}):null]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-500",children:s("HTTP-FLV 预览","HTTP-FLV preview")}),(0,n.jsxs)("dd",{className:"mt-1 flex flex-wrap items-center gap-2 font-mono text-zinc-400",children:[(0,n.jsx)("span",{className:"break-all",children:g.srs_play_flv||g.srs_http||"—"}),g.srs_play_flv||g.srs_http?(0,n.jsx)("button",{type:"button",className:"shrink-0 text-cyan-300 hover:text-cyan-200",onClick:()=>m(g.srs_play_flv||g.srs_http),children:(0,n.jsx)(M.Z,{className:"h-3.5 w-3.5"})}):null]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-500",children:s("SRS 控制台","SRS web UI")}),(0,n.jsx)("dd",{className:"mt-1 font-mono text-zinc-400",children:(0,n.jsx)("a",{href:g.srs_http||"#",target:"_blank",rel:"noreferrer",className:"text-cyan-300 hover:underline",children:g.srs_http||"—"})})]})]})]}):null,(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(ex.Z,{className:"h-4 w-4 text-cyan-400"}),s("HDMI 硬件与时序","HDMI timing")]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("点选一路作为现场备忘;与板端 ffmpeg/OBS 采集参数对齐。","Pick a preset as field memo; match capture settings.")}),(0,n.jsx)("div",{className:"mt-4 grid gap-3 md:grid-cols-3",children:eT.map(e=>{let t=T===e.id,l=U===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>{E(t?null:e.id),I(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,n.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(ex.Z,{className:"h-4 w-4 text-cyan-400"}),s(e.labelZh,e.labelEn)]}),(0,n.jsx)("p",{className:"mt-2 font-mono text-[11px] text-zinc-400",children:e.spec}),t?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:s(e.hintZh,e.hintEn)}):null]},e.id)})}),(0,n.jsxs)("div",{className:"mt-6 rounded-xl border border-white/5 bg-black/25 p-4",children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-zinc-400",children:s("上线前检查清单(本地保存)","Pre-flight checklist (local)")}),(0,n.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,n.jsxs)("li",{className:"flex items-start gap-2 text-xs text-zinc-400",children:[(0,n.jsx)("input",{type:"checkbox",className:"mt-0.5 rounded border-white/20 bg-black/40",checked:!!V[e.id],onChange:t=>es({...V,[e.id]:t.target.checked})}),(0,n.jsx)("span",{children:s(e.zh,e.en)})]},e.id))}),(0,n.jsx)("label",{className:"mt-4 block text-[11px] text-zinc-500",children:s("HDMI / 走线备忘","HDMI / wiring notes")}),(0,n.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:G,onChange:e=>en(e.target.value),spellCheck:!1,placeholder:s("接口、线长、显示器型号…","Ports, cable length, display model…")})]})]}),"ffmpeg"===j?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:s("直播地址列表 \xb7 URL_config.ini","URL_config.ini")}),(0,n.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,n.jsx)(M.Z,{className:"h-3.5 w-3.5"}),s("复制全文","Copy all")]})]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("一行一个地址;可勾选自动从服务器刷新,或点「重新读取」手动同步。","One URL per line; enable auto-refresh or reload from server.")}),(0,n.jsx)("div",{className:"mt-2 flex flex-wrap items-center gap-4 text-xs text-zinc-400",children:(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:O,onChange:e=>B(e.target.checked)}),s("每 8 秒自动从服务器刷新","Auto-refresh from server every 8s")]})}),W?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:W}):null,(0,n.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=>{H.current=!0,X(e.target.value)},spellCheck:!1}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:eo,onClick:()=>void el(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-300",children:s("重新读取","Reload from server")}),(0,n.jsx)("button",{type:"button",disabled:eo,onClick:()=>void ei(),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:s("保存 URL 配置","Save URL config")})]})]}):null,(0,n.jsx)(eP,{t:s,currentProc:a,fetchJson:h,urlListText:"ffmpeg"===j?o:"",keySuffixUi:"",showKeyRow:!1})]})}var eA=s(875),eD=s(4822),eO=s(9170);function eB(e){e.traverse(e=>{e.geometry&&e.geometry.dispose();let t=e.material;Array.isArray(t)?t.forEach(e=>e.dispose()):t&&t.dispose()})}function eW(e){let{tr:t,className:l="",liveActive:i=0,onOpenStudio:a}=e,r=(0,Z.useRef)(null),o=(0,Z.useRef)(null),[d,x]=(0,Z.useState)("idle"),[u,m]=(0,Z.useState)(0),p=(0,Z.useRef)(i);p.current=i;let g=(0,Z.useCallback)(()=>{x("idle"),m(e=>e+1)},[]);return(0,Z.useEffect)(()=>{let e;let t=o.current,n=r.current;if(!t||!n)return;let l=!1,i=0,a=null,c=!1,d=0,u=()=>{cancelAnimationFrame(i),cancelAnimationFrame(d),null==a||a.disconnect(),null==e||e(),e=void 0,t.replaceChildren()},m=()=>{if(l||c)return;let a=t.clientWidth,r=t.clientHeight;a<16||r<16||(c=!0,x("loading"),s.e(689).then(s.bind(s,1448)).then(t=>{let s;if(l||!o.current)return;let a=o.current,r=a.clientWidth,c=a.clientHeight,d=new t.Scene,u=new t.PerspectiveCamera(48,r/c,.1,80);u.position.set(0,1.1,7.2);try{s=new t.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance"})}catch(e){l||x("failed");return}s.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),s.setSize(r,c,!1),s.setClearColor(0,0);let m=s.domElement;m.style.display="block",m.style.width="100%",m.style.height="100%",a.replaceChildren(m);let h=new t.HemisphereLight(16762092,4482815,.85);d.add(h);let g=new t.DirectionalLight(16777215,.9);g.position.set(4,8,6),d.add(g);let b=new t.PointLight(8189439,.6,20);b.position.set(-3,2,-2),d.add(b);let f=new t.Group,v=new t.MeshStandardMaterial({color:2762048,metalness:.15,roughness:.55}),y=new t.MeshStandardMaterial({color:16724821,emissive:4456465,metalness:.35,roughness:.25}),w=new t.MeshStandardMaterial({color:16777215,emissive:2236962,metalness:.2,roughness:.3}),j=new t.MeshStandardMaterial({color:2487534,emissive:340024,metalness:.25,roughness:.35}),N=new t.MeshStandardMaterial({color:16657493,emissive:2229520,metalness:.2,roughness:.4}),k=new t.Mesh(new t.BoxGeometry(3.2,.35,2.2),v);k.position.y=-.85,f.add(k);let _=new t.Mesh(new t.TorusGeometry(.72,.09,12,48),y);_.rotation.x=Math.PI/2,_.position.set(-.85,.15,.2),f.add(_);let z=new t.Mesh(new t.ConeGeometry(.35,.5,3),w);z.rotation.z=-Math.PI/2,z.rotation.y=Math.PI,z.position.set(-.55,.18,.2),f.add(z);let S=new t.Mesh(new t.CylinderGeometry(.22,.28,.95,20),j);S.position.set(1.05,.35,-.15),S.rotation.z=.12,f.add(S);let C=new t.Mesh(new t.SphereGeometry(.26,16,16),N);C.position.set(1.05,.92,-.15),f.add(C);let R=new t.BufferGeometry,L=new Float32Array(360);for(let e=0;e<120;e++)L[3*e]=(Math.random()-.5)*14,L[3*e+1]=(Math.random()-.3)*8,L[3*e+2]=(Math.random()-.5)*8-2;R.setAttribute("position",new t.BufferAttribute(L,3));let P=new t.PointsMaterial({color:16777215,size:.06,transparent:!0,opacity:.7}),M=new t.Points(R,P);d.add(M),d.add(f);let T=0,E=0,U=e=>{let t=a.getBoundingClientRect();t.width&&t.height&&(T=((e.clientX-t.left)/t.width-.5)*2,E=((e.clientY-t.top)/t.height-.5)*2)},Z=()=>{T=0,E=0};n.addEventListener("pointermove",U),n.addEventListener("pointerleave",Z);let I=performance.now(),A=!document.hidden,D=()=>{A=!document.hidden};document.addEventListener("visibilitychange",D);let O=()=>{if(l||(i=requestAnimationFrame(O),!A))return;let e=(performance.now()-I)/1e3,t=p.current,n=t>0?.5+.5*Math.sin(4*e):0;f.rotation.y=.25*Math.sin(.35*e)+.12*e+.08*T,f.rotation.x=-.06*E,f.position.y=.06*Math.sin(.9*e),_.rotation.z=.4*e,M.rotation.y=.02*e,u.position.x+=(.35*T-u.position.x)*.06,u.position.y+=(1.1+-.2*E-u.position.y)*.06,u.lookAt(0,.1,0),t>0?(y.emissive.setHex(4456465),y.emissiveIntensity=.4+1.2*n,j.emissiveIntensity=.3+.5*n):(y.emissiveIntensity=1,j.emissiveIntensity=1),s.render(d,u)};O();let B=new ResizeObserver(()=>{if(!o.current||l)return;let e=o.current.clientWidth,t=o.current.clientHeight;e<16||t<16||(u.aspect=e/t,u.updateProjectionMatrix(),s.setSize(e,t,!1))});B.observe(a),l||x("ready"),e=()=>{var e;document.removeEventListener("visibilitychange",D),n.removeEventListener("pointermove",U),n.removeEventListener("pointerleave",Z),B.disconnect(),eB(f),eB(M),R.dispose(),P.dispose(),s.dispose(),null===(e=s.forceContextLoss)||void 0===e||e.call(s),a.replaceChildren()}}).catch(()=>{l||x("failed")}))},h=0,g=()=>{l||c||(h+=1,m(),!c&&h<120?d=requestAnimationFrame(g):!c&&h>=120&&x("failed"))};return(a=new ResizeObserver(()=>{c||m()})).observe(t),g(),()=>{l=!0,u()}},[u]),(0,n.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col ".concat(l),children:[(0,n.jsxs)("div",{className:"mb-2 flex shrink-0 items-center justify-between gap-2 px-1",children:[(0,n.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-fuchsia-200/80",children:t("直播工作室 \xb7 3D","Live studio \xb7 3D")}),i>0?(0,n.jsxs)("span",{className:"studio-live-badge inline-flex items-center gap-1 rounded-full bg-rose-500/20 px-2 py-0.5 text-[9px] font-bold uppercase tracking-wide text-rose-100 ring-1 ring-rose-400/40",children:[(0,n.jsxs)("span",{className:"relative flex h-1.5 w-1.5",children:[(0,n.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-rose-400 opacity-70"}),(0,n.jsx)("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-rose-400"})]}),"LIVE \xd7",i]}):null]}),(0,n.jsxs)("div",{ref:r,className:"studio-scene-shell relative min-h-0 flex-1 overflow-hidden rounded-xl bg-gradient-to-b from-fuchsia-950/40 to-cyan-950/20 ring-1 ring-white/10",children:[(0,n.jsx)("div",{ref:o,className:"absolute inset-0","aria-hidden":!0}),"idle"===d||"loading"===d?(0,n.jsxs)("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center gap-2",children:[(0,n.jsx)("div",{className:"studio-scene-shimmer absolute inset-0 opacity-60"}),(0,n.jsx)(h.Z,{className:"relative h-5 w-5 animate-pulse text-fuchsia-300/70"}),(0,n.jsx)("p",{className:"relative text-[10px] text-zinc-500",children:t("加载 3D 场景…","Loading 3D scene…")})]}):null,"failed"===d?(0,n.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 px-4 text-center",children:[(0,n.jsx)(c.Z,{className:"h-8 w-8 text-fuchsia-300/70"}),(0,n.jsx)("p",{className:"text-[11px] text-zinc-400",children:t("WebGL 不可用,已显示占位预览","WebGL unavailable — showing placeholder")}),(0,n.jsxs)("button",{type:"button",onClick:g,className:"inline-flex items-center gap-1.5 rounded-lg border border-fuchsia-400/30 bg-fuchsia-500/10 px-3 py-1.5 text-[10px] font-semibold text-fuchsia-100 transition hover:bg-fuchsia-500/20",children:[(0,n.jsx)(w.Z,{className:"h-3 w-3"}),t("重试","Retry")]})]}):null,a?(0,n.jsxs)("button",{type:"button",onClick:a,className:"absolute bottom-2 right-2 z-10 inline-flex items-center gap-1 rounded-lg border border-white/10 bg-black/45 px-2.5 py-1 text-[10px] font-semibold text-zinc-200 backdrop-blur-sm transition hover:border-fuchsia-400/35 hover:bg-black/60 hover:text-white",children:[(0,n.jsx)(h.Z,{className:"h-3 w-3 text-fuchsia-300"}),t("进入工作室","Open studio")]}):null]})]})}function eK(e){if(null==e||!Number.isFinite(e))return"—";if(0===e)return"0 B";let t=["B","KB","MB","GB","TB"],s=e,n=0;for(;s>=1024&&n=10||0===n?0:1)," ").concat(t[n])}function eH(e){let t=eK(e);return"—"===t?t:"".concat(t,"/s")}function eF(e,t){return t&&Number.isFinite(e)&&Number.isFinite(t)?Math.min(100,Math.max(0,Math.round(e/t*100))):0}function eY(e){return"online"===e||"running"===e||"streaming"===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"}let eG=[{id:"live_youtube",zh:"YouTube 无人直播",en:"YouTube Live",icon:Y.Z,accent:"from-rose-500/20 to-violet-500/10 text-rose-100 ring-rose-500/25"},{id:"live_tiktok",zh:"TikTok HDMI",en:"TikTok HDMI",icon:c.Z,accent:"from-cyan-500/20 to-sky-500/10 text-cyan-100 ring-cyan-500/25"},{id:"android",zh:"安卓投屏",en:"Android",icon:d.Z,accent:"from-emerald-500/20 to-teal-500/10 text-emerald-100 ring-emerald-500/25"},{id:"services",zh:"服务编排",en:"Services",icon:r.Z,accent:"from-indigo-500/20 to-violet-500/10 text-indigo-100 ring-indigo-500/25"},{id:"network",zh:"网络 / WG",en:"Network",icon:E.Z,accent:"from-amber-500/20 to-orange-500/10 text-amber-100 ring-amber-500/25"},{id:"studio",zh:"工作室",en:"Studio",icon:h.Z,accent:"from-fuchsia-500/20 to-pink-500/10 text-fuchsia-100 ring-fuchsia-500/25"}],eq=["control_plane","netdata","filebrowser","webtty","neko_browser","srs_http","youtube_events"];function eV(e){let{label:t,value:s,sub:l,pct:i,icon:a,theme:r}=e,o=2*Math.PI*18,c=null!=i?i/100*o:0;return(0,n.jsx)("div",{className:"group relative overflow-hidden rounded-2xl border p-3.5 transition hover:-translate-y-0.5 ".concat("light"===r?"border-slate-200/90 bg-white/90 shadow-sm shadow-slate-200/40":"border-white/[0.07] bg-gradient-to-br from-white/[0.06] to-transparent shadow-lg shadow-black/20"),children:(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(a,{className:"h-4 w-4 shrink-0 ".concat("light"===r?"text-violet-600":"text-violet-300/90")}),(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:t})]}),(0,n.jsx)("p",{className:"mt-2 font-mono text-xl font-bold leading-none ".concat("light"===r?"text-slate-900":"text-white"),children:s}),(0,n.jsx)("p",{className:"mt-1 text-[10px] text-zinc-500",children:l})]}),null!=i?(0,n.jsxs)("svg",{className:"h-11 w-11 shrink-0 -rotate-90",viewBox:"0 0 44 44","aria-hidden":!0,children:[(0,n.jsx)("circle",{cx:"22",cy:"22",r:18,fill:"none",className:"stroke-white/10",strokeWidth:"4"}),(0,n.jsx)("circle",{cx:"22",cy:"22",r:18,fill:"none",className:"".concat(i>=90?"stroke-rose-400":i>=75?"stroke-amber-400":"stroke-cyan-400"," transition-all duration-500"),strokeWidth:"4",strokeDasharray:"".concat(c," ").concat(o),strokeLinecap:"round"}),(0,n.jsxs)("text",{x:"22",y:"24",textAnchor:"middle",className:"fill-zinc-400 text-[8px] font-bold rotate-90 origin-center",children:[i,"%"]})]}):null]})})}function eJ(e){let{id:t,title:s,subtitle:l,defaultOpen:i=!0,theme:a,children:r,badge:o}=e,[c,d]=(0,Z.useState)(i);return(0,n.jsxs)("section",{id:t,className:"overflow-hidden rounded-2xl border ".concat("light"===a?"border-slate-200/90 bg-white/80":"border-white/[0.07] bg-zinc-950/35"),children:[(0,n.jsxs)("button",{type:"button",onClick:()=>d(e=>!e),className:"flex w-full items-center gap-3 px-4 py-3.5 text-left transition ".concat("light"===a?"hover:bg-slate-50":"hover:bg-white/[0.03]"),"aria-expanded":c,children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold ".concat("light"===a?"text-slate-900":"text-white"),children:s}),o]}),l?(0,n.jsx)("p",{className:"mt-0.5 text-[11px] text-zinc-500",children:l}):null]}),(0,n.jsx)(eA.Z,{className:"h-4 w-4 shrink-0 text-zinc-500 transition ".concat(c?"rotate-180":"")})]}),c?(0,n.jsx)("div",{className:"border-t border-white/[0.05] px-4 pb-4 pt-3",children:r}):null]})}function e$(e){let{theme:t}=e;return(0,n.jsxs)("div",{className:"space-y-4 animate-pulse",children:[(0,n.jsx)("div",{className:"h-28 rounded-2xl border ".concat("light"===t?"bg-slate-100":"bg-white/[0.04]")}),(0,n.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:Array.from({length:4}).map((e,s)=>(0,n.jsx)("div",{className:"h-24 rounded-2xl border ".concat("light"===t?"bg-slate-100":"bg-white/[0.04]")},s))}),(0,n.jsx)("div",{className:"h-72 rounded-2xl border ".concat("light"===t?"bg-slate-100":"bg-white/[0.04]")})]})}function eX(e){var t,s,i,c,d,x,u,m,h,p,g,b,f,v,y,w,j,N,_,z,S,C,R,P,M,T,U,I,A,D,O,B,W,H,F,Y,G,q,V,J,$,X,Q,ee,et,es,en,el,ei,ea,er,eo,ec,ed;let{dash:ex,deployCheck:eu,dashErr:em,loading:ep,theme:eg,t:eb,onNavigate:ef,nekoLinks:ev,nekoPortsLabel:ey,showStreamProbes:ew,quickLinks:ej}=e,eN=null!==(Q=null==ex?void 0:null===(t=ex.services)||void 0===t?void 0:t.filter(e=>e.running).length)&&void 0!==Q?Q:0,ek=null!==(ee=null==ex?void 0:null===(s=ex.services)||void 0===s?void 0:s.length)&&void 0!==ee?ee:0,e_=(null==ex?void 0:null===(c=ex.snapshot)||void 0===c?void 0:null===(i=c.memory)||void 0===i?void 0:i.total)||0,ez=null!==(es=null!==(et=null==ex?void 0:null===(x=ex.snapshot)||void 0===x?void 0:null===(d=x.memory)||void 0===d?void 0:d.available)&&void 0!==et?et:null==ex?void 0:null===(m=ex.snapshot)||void 0===m?void 0:null===(u=m.memory)||void 0===u?void 0:u.free)&&void 0!==es?es:0,eS=Math.max(0,e_-ez),eC=(null==ex?void 0:null===(p=ex.snapshot)||void 0===p?void 0:null===(h=p.disk)||void 0===h?void 0:h.total)||0,eR=(null==ex?void 0:null===(b=ex.snapshot)||void 0===b?void 0:null===(g=b.disk)||void 0===g?void 0:g.free)||0,eL=(null==ex?void 0:null===(f=ex.live)||void 0===f?void 0:f.processes)||[],eP=(null==ex?void 0:null===(v=ex.live_events)||void 0===v?void 0:v.process_digest)||[],eM=eP.filter(e=>{let t=(e.status||"").toLowerCase();return"online"===t||"running"===t||"streaming"===t}).length,eT=(0,Z.useMemo)(()=>eq.map(e=>({key:e,url:ej[e]})).filter(e=>e.url&&/^https?:\/\//i.test(e.url)),[ej]),eE=(0,Z.useMemo)(()=>((null==ex?void 0:ex.services)||[]).filter(e=>["live-console","live-edge","srs","neko","shellcrash"].some(t=>e.service_id.includes(t.replace("live-",""))||e.service_id===t)).slice(0,6),[null==ex?void 0:ex.services]);return ep&&!ex?(0,n.jsx)(e$,{theme:eg}):(0,n.jsxs)("div",{className:"space-y-5",children:[em?(0,n.jsxs)("div",{className:"rounded-2xl border border-rose-500/25 bg-rose-950/20 p-4 text-sm text-rose-200",children:[eb("无法加载仪表盘:","Dashboard error: "),em]}):null,(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"relative overflow-hidden rounded-2xl border p-4 sm:p-5 ".concat("light"===eg?"border-violet-200/80 bg-gradient-to-br from-violet-50 via-white to-cyan-50 shadow-sm":"border-violet-500/20 bg-gradient-to-br from-violet-600/10 via-zinc-950/80 to-cyan-500/10"),children:[(0,n.jsx)("div",{className:"pointer-events-none absolute -right-8 -top-8 h-40 w-40 rounded-full bg-fuchsia-500/15 blur-3xl"}),(0,n.jsx)("div",{className:"pointer-events-none absolute -bottom-10 left-1/3 h-32 w-32 rounded-full bg-cyan-500/10 blur-3xl"}),(0,n.jsxs)("div",{className:"relative flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-emerald-500/15 px-2.5 py-0.5 text-[10px] font-semibold text-emerald-200 ring-1 ring-emerald-500/30",children:[(0,n.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,n.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-60"}),(0,n.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-emerald-400"})]}),(null==ex?void 0:null===(y=ex.stack)||void 0===y?void 0:y.hostname)||"live"]}),(null==eu?void 0:eu.ready)?(0,n.jsx)("span",{className:"rounded-full bg-emerald-500/10 px-2 py-0.5 text-[10px] font-medium text-emerald-200 ring-1 ring-emerald-500/20",children:eb("交付就绪","Deploy ready")}):eu?(0,n.jsx)("span",{className:"rounded-full bg-amber-500/10 px-2 py-0.5 text-[10px] font-medium text-amber-200 ring-1 ring-amber-500/20",children:eb("待验收","Needs checks")}):null,eM>0?(0,n.jsxs)("span",{className:"rounded-full bg-rose-500/15 px-2 py-0.5 text-[10px] font-semibold text-rose-100 ring-1 ring-rose-500/25",children:[eM," ",eb("路直播活跃","live lanes active")]}):null]}),(0,n.jsxs)("h2",{className:"mt-2 text-lg font-bold tracking-tight sm:text-xl ".concat("light"===eg?"text-slate-900":"text-white"),children:[(null==ex?void 0:null===(w=ex.stack)||void 0===w?void 0:w.mdns_host)||"live.local",(0,n.jsx)("span",{className:"ml-2 text-sm font-normal ".concat("light"===eg?"text-slate-500":"text-zinc-500"),children:((null==ex?void 0:null===(j=ex.stack)||void 0===j?void 0:j.ips)||[]).join(" \xb7 ")||"—"})]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[null==ex?void 0:null===(N=ex.stack)||void 0===N?void 0:N.machine," \xb7 ",null==ex?void 0:null===(_=ex.stack)||void 0===_?void 0:_.kernel," \xb7 Python ",(null==ex?void 0:null===(z=ex.stack)||void 0===z?void 0:z.python)||"—"]})]}),(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:eT.slice(0,4).map(e=>(0,n.jsxs)("a",{href:(0,eh.p)(e.url),target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-xl border px-3 py-2 text-[11px] font-medium transition hover:-translate-y-0.5 ".concat("light"===eg?"border-slate-200 bg-white text-slate-700 shadow-sm":"border-white/10 bg-black/30 text-zinc-200 hover:bg-black/45"),children:[e.key.replace(/_/g," "),(0,n.jsx)(K.Z,{className:"h-3 w-3 opacity-60"})]},e.key))})]})]}),(0,n.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 xl:grid-cols-6",children:eG.map((e,t)=>(0,n.jsxs)(l.E.button,{type:"button",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.04*t},whileHover:{y:-2},whileTap:{scale:.98},onClick:()=>ef(e.id),className:"flex items-center gap-2 rounded-xl border bg-gradient-to-br px-3 py-3 text-left text-[11px] font-semibold ring-1 transition ".concat(e.accent),children:[(0,n.jsx)(e.icon,{className:"h-4 w-4 shrink-0 opacity-90"}),(0,n.jsx)("span",{className:"line-clamp-2 leading-snug",children:eb(e.zh,e.en)}),(0,n.jsx)(k.Z,{className:"ml-auto h-3.5 w-3.5 shrink-0 opacity-50"})]},e.id))}),(0,n.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-4",children:[(0,n.jsx)(eV,{theme:eg,icon:eD.Z,label:eb("CPU 1m","CPU 1m"),value:null!==(en=null==ex?void 0:null===(R=ex.snapshot)||void 0===R?void 0:null===(C=R.cpu_load)||void 0===C?void 0:null===(S=C["1m"])||void 0===S?void 0:S.toFixed(2))&&void 0!==en?en:"—",sub:"5m ".concat(null!==(el=null==ex?void 0:null===(T=ex.snapshot)||void 0===T?void 0:null===(M=T.cpu_load)||void 0===M?void 0:null===(P=M["5m"])||void 0===P?void 0:P.toFixed(2))&&void 0!==el?el:"—"," \xb7 15m ").concat(null!==(ei=null==ex?void 0:null===(A=ex.snapshot)||void 0===A?void 0:null===(I=A.cpu_load)||void 0===I?void 0:null===(U=I["15m"])||void 0===U?void 0:U.toFixed(2))&&void 0!==ei?ei:"—")}),(0,n.jsx)(eV,{theme:eg,icon:a.Z,label:eb("内存","Memory"),value:eK(ez),sub:"/ ".concat(eK(e_)),pct:e_?eF(eS,e_):void 0}),(0,n.jsx)(eV,{theme:eg,icon:L.Z,label:eb("磁盘","Disk"),value:eK(eR),sub:eb("可用","free"),pct:eC?eF(Math.max(0,eC-eR),eC):void 0}),(0,n.jsx)(eV,{theme:eg,icon:r.Z,label:eb("服务","Services"),value:"".concat(eN,"/").concat(ek||"—"),sub:function(e){if(null==e||!Number.isFinite(e))return"—";let t=Math.max(0,Math.floor(e)),s=Math.floor(t/86400),n=Math.floor(t%86400/3600),l=Math.floor(t%3600/60);return s>0?"".concat(s,"d ").concat(n,"h"):n>0?"".concat(n,"h ").concat(l,"m"):"".concat(l,"m")}(null==ex?void 0:null===(D=ex.snapshot)||void 0===D?void 0:D.uptime_seconds)+" "+eb("运行","uptime")})]}),(0,n.jsxs)("div",{className:"grid gap-4 xl:grid-cols-5 xl:items-stretch",children:[(0,n.jsx)(l.E.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"flex h-[248px] flex-col overflow-hidden xl:col-span-3 rounded-2xl border p-3 backdrop-blur-xl ".concat("light"===eg?"border-slate-200/90 bg-white/85":"border-white/[0.07] bg-zinc-950/40"),children:(0,n.jsx)(eO.Z,{snapshot:null!==(ea=null==ex?void 0:ex.snapshot)&&void 0!==ea?ea:null,theme:eg,tr:eb,compact:!0})}),(0,n.jsx)(l.E.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.05},className:"flex h-[248px] flex-col overflow-hidden xl:col-span-2 rounded-2xl border p-3 ".concat("light"===eg?"border-fuchsia-200/80 bg-gradient-to-br from-fuchsia-50/90 via-white to-cyan-50/70":"border-fuchsia-500/20 bg-gradient-to-br from-fuchsia-500/10 via-zinc-950/60 to-cyan-500/10"),children:(0,n.jsx)(eW,{tr:eb,className:"h-full",liveActive:eM,onOpenStudio:()=>ef("studio")})})]}),(0,n.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-2xl border p-4 ".concat("light"===eg?"border-violet-200/70 bg-white/90":"border-violet-500/20 bg-gradient-to-br from-violet-500/[0.08] to-transparent"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold ".concat("light"===eg?"text-slate-900":"text-white"),children:eb("直播进程","Live processes")}),(0,n.jsx)("span",{className:"rounded-full bg-white/10 px-2 py-0.5 font-mono text-[10px] text-zinc-400",children:(null==ex?void 0:null===(O=ex.live)||void 0===O?void 0:O.backend_mode)||"—"})]}),(0,n.jsxs)("ul",{className:"mt-3 max-h-52 space-y-2 overflow-y-auto pr-1",children:[(eL.length?eL:eP).slice(0,8).map(e=>{let t="pm2"in e?e.pm2:"",s="label"in e&&e.label||t,l="process_status"in e&&e.process_status||"status"in e&&e.status||"",i="".concat(t," ").concat(s).toLowerCase(),a=i.includes("tiktok")||i.includes("hdmi")?"live_tiktok":i.includes("youtube")||i.includes("yt")?"live_youtube":null;return(0,n.jsxs)("li",{role:a?"button":void 0,tabIndex:a?0:void 0,onClick:a?()=>ef(a):void 0,onKeyDown:a?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),ef(a))}:void 0,className:"flex items-center gap-3 rounded-xl border px-3 py-2 transition ".concat("light"===eg?"border-slate-200 bg-slate-50/80":"border-white/[0.06] bg-black/25 hover:border-violet-400/20"," ").concat(a?"cursor-pointer hover:-translate-y-px hover:border-violet-400/30":""),children:[(0,n.jsx)(o.Z,{className:"h-4 w-4 shrink-0 text-violet-300/80"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"truncate text-xs font-medium text-zinc-200",children:s}),(0,n.jsx)("p",{className:"truncate font-mono text-[10px] text-zinc-600",children:t})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-md px-2 py-0.5 text-[10px] font-medium ".concat(eY(l||"")),children:function(e,t){let s=(e||"").trim().toLowerCase();return"online"===s||"running"===s||"streaming"===s?t("运行中","Running"):"configured"===s?t("已配置","Configured"):"not_found"===s?t("未注册","Unregistered"):"stopped"===s?t("已停止","Stopped"):"error"===s?t("异常","Error"):e||"—"}(l||"",eb)})]},t||s)}),eL.length||eP.length?null:(0,n.jsx)("li",{className:"py-6 text-center text-xs text-zinc-600",children:eb("暂无直播进程","No live processes")})]}),(0,n.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:()=>ef("live_youtube"),className:"rounded-xl bg-violet-500/20 py-2 text-[11px] font-semibold text-violet-100 ring-1 ring-violet-500/30 transition hover:bg-violet-500/30",children:"YouTube"}),(0,n.jsx)("button",{type:"button",onClick:()=>ef("live_tiktok"),className:"rounded-xl bg-cyan-500/20 py-2 text-[11px] font-semibold text-cyan-100 ring-1 ring-cyan-500/30 transition hover:bg-cyan-500/30",children:"TikTok"})]})]}),(null==ex?void 0:null===(W=ex.network)||void 0===W?void 0:null===(B=W.interfaces)||void 0===B?void 0:B.length)?(0,n.jsxs)("div",{className:"rounded-2xl border p-4 ".concat("light"===eg?"border-cyan-200/70 bg-white/90":"border-cyan-500/15 bg-cyan-500/[0.05]"),children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===eg?"text-slate-900":"text-white"),children:[(0,n.jsx)(E.Z,{className:"h-4 w-4 text-cyan-300"}),eb("网络吞吐","Network throughput")]}),(0,n.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/20 px-3 py-2.5",children:[(0,n.jsxs)("p",{className:"text-[10px] uppercase text-cyan-300/70",children:["↓ ",eb("下行","Down")]}),(0,n.jsx)("p",{className:"mt-1 font-mono text-lg font-bold text-cyan-100",children:eH(ex.network.total_rx_bps)})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/20 px-3 py-2.5",children:[(0,n.jsxs)("p",{className:"text-[10px] uppercase text-cyan-300/70",children:["↑ ",eb("上行","Up")]}),(0,n.jsx)("p",{className:"mt-1 font-mono text-lg font-bold text-cyan-100",children:eH(ex.network.total_tx_bps)})]})]}),(0,n.jsx)("div",{className:"mt-3 space-y-2",children:(ex.network.interfaces||[]).slice(0,3).map(e=>(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-white/[0.05] bg-black/20 px-3 py-2 font-mono text-[10px]",children:[(0,n.jsx)("span",{className:"font-semibold text-cyan-200/90",children:e.name}),(0,n.jsxs)("span",{className:"text-zinc-500",children:["↓ ",eH(e.rx_bps)," \xb7 ↑ ",eH(e.tx_bps)]})]},e.name))})]}):null]}),eE.length?(0,n.jsx)("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:eE.map(e=>(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border px-3 py-2.5 ".concat("light"===eg?"border-slate-200 bg-white":"border-white/[0.06] bg-black/25"),children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"truncate text-xs font-medium text-zinc-200",children:e.label}),(0,n.jsx)("p",{className:"truncate text-[10px] text-zinc-600",children:e.service_id})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat(eY(e.running?"online":e.status)),children:e.running?eb("运行中","Running"):e.status})]},e.service_id))}):null,(0,n.jsxs)("div",{className:"space-y-3",children:[eu?(0,n.jsxs)(eJ,{id:"deploy",theme:eg,title:eb("安装验收","Deployment health"),subtitle:eb("API / 边缘反代 / mDNS 可用性","API, edge proxy, mDNS"),defaultOpen:!eu.ready,badge:(0,n.jsxs)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat(eu.ready?"bg-emerald-500/15 text-emerald-200":"bg-amber-500/15 text-amber-200"),children:[eu.pass_count,"/",eu.total_count]}),children:[(0,n.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[(0,n.jsx)("p",{className:"text-sm text-zinc-300",children:eu.ready?eb("必需检查已通过,控制面可交付。","Required checks passed."):eb("部分检查未通过,请查看失败项。","Some checks failed.")}),(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(eu.urls||{}).filter(e=>{let[,t]=e;return!!t}).slice(0,5).map(e=>{let[t,s]=e;return(0,n.jsx)("a",{href:(0,eh.p)(s),target:"_blank",rel:"noreferrer",className:"rounded-lg border border-white/10 bg-white/5 px-2.5 py-1.5 text-[10px] text-zinc-300",children:t},t)})})]}),(eu.failing_checks||[]).length?(0,n.jsx)("ul",{className:"mt-3 space-y-1.5",children:eu.failing_checks.slice(0,4).map(e=>(0,n.jsxs)("li",{className:"rounded-lg border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-100",children:[e.label,": ",e.detail||"—"]},e.id))}):null]}):null,(null==ex?void 0:ex.hardware)?(0,n.jsx)(eJ,{id:"hardware",theme:eg,title:eb("硬件能力","Hardware profile"),subtitle:eb("GPU / NPU / FFmpeg 策略","GPU, NPU, FFmpeg"),defaultOpen:!1,children:(0,n.jsxs)("div",{className:"grid gap-3 font-mono text-[11px] text-zinc-400 sm:grid-cols-2",children:[(0,n.jsxs)("p",{children:["arch ",String(null!==(er=ex.hardware.arch)&&void 0!==er?er:"—")]}),(0,n.jsxs)("p",{children:["GPU ",ex.hardware.gpu&&"object"==typeof ex.hardware.gpu&&ex.hardware.gpu.present?eb("有","yes"):eb("无","no")]}),(0,n.jsxs)("p",{className:"sm:col-span-2",children:["hwaccels"," ",(ex.hardware.ffmpeg_hwaccels||[]).join(", ")||"—"]})]})}):null,(null==ex?void 0:null===(H=ex.stack)||void 0===H?void 0:H.neko_login)?(0,n.jsxs)(eJ,{id:"neko",theme:eg,title:"Neko ".concat(eb("登录","sign-in")),subtitle:ey||eb("多实例","multi-instance"),defaultOpen:!1,children:[(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:ev.map(e=>(0,n.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",children:[e.label," \xb7 ",e.accessLabel]},e.key))}),(0,n.jsx)("p",{className:"mt-3 text-[11px] text-amber-200/85",children:eb("昵称随意,密码须与环境变量一致(默认 12345678)。","Display name is free; password must match NEKO_* (default 12345678).")})]}):null,ew&&(null==ex?void 0:ex.probes)?(0,n.jsx)(eJ,{id:"probes",theme:eg,title:eb("推流探针","Stream probes"),subtitle:"SRS \xb7 Neko",defaultOpen:!1,children:(0,n.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[ex.probes.srs?(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-3 text-[11px]",children:[(0,n.jsx)("p",{className:"font-semibold text-white",children:"SRS"}),(0,n.jsxs)("p",{className:"mt-1 text-zinc-500",children:["API ",ex.probes.srs.api_ok?"OK":"—"," \xb7 :",ex.probes.srs.port," \xb7 RTT ",null!==(ec=null!==(eo=null===(F=ex.probes.srs.http)||void 0===F?void 0:F.latency_ms)&&void 0!==eo?eo:null===(Y=ex.probes.srs.tcp)||void 0===Y?void 0:Y.latency_ms)&&void 0!==ec?ec:"—"," ms"]}),(null===(G=ex.probes.srs.http)||void 0===G?void 0:G.error)?(0,n.jsx)("p",{className:"mt-1 text-amber-300/80",children:ex.probes.srs.http.error}):null]}):null,ex.probes.neko?(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-3 text-[11px]",children:[(0,n.jsx)("p",{className:"font-semibold text-white",children:"Neko"}),(0,n.jsxs)("p",{className:"mt-1 text-zinc-500",children:[ex.probes.neko.running_count,"/",ex.probes.neko.required_count," ",eb("在线","online")," \xb7 HTTP ",null!==(ed=null===(q=ex.probes.neko.http)||void 0===q?void 0:q.http_code)&&void 0!==ed?ed:"—"]}),(null===(V=ex.probes.neko.http)||void 0===V?void 0:V.error)?(0,n.jsx)("p",{className:"mt-1 text-amber-300/80",children:ex.probes.neko.http.error}):null]}):null]})}):null,(null==ex?void 0:null===($=ex.live_events)||void 0===$?void 0:null===(J=$.pm2_tail)||void 0===J?void 0:J.length)||eP.length?(0,n.jsx)(eJ,{id:"feeds",theme:eg,title:eb("事件流","Event feed"),defaultOpen:!1,children:(0,n.jsx)("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded-lg border border-white/[0.05] bg-black/40 p-3 font-mono text-[10px] text-zinc-400",children:((null==ex?void 0:null===(X=ex.live_events)||void 0===X?void 0:X.pm2_tail)||[]).slice(-12).join("\n")||eb("暂无日志","No logs")})}):null]})]})}var eQ=s(5468),e0=s(1094),e1=s(5621),e5=s(91),e2=s(2208),e3=s(1723),e4=s(9397),e6=s(90);let e8="live-hub-youtube-pro-v2",e9="youtube2__",e7=/[^a-zA-Z0-9_.-]+/g,te=new Set(["douyin_youtube","tiktok","obs","web"]);function tt(e,t){var s;let n=(e||"").trim();if(!function(e){let t=(e||"").trim();return!t||/\?{2,}/.test(t)||/?{2,}/.test(t)||/�/.test(t)||/锟|绾胯矾|çº|è·|Â/.test(t)||/^(undefined|null|nan)$/i.test(t)}(n))return n;let l=(null===(s=n.match(/\d+/))||void 0===s?void 0:s[0])||String(Math.max(0,t)+1);return"线路 ".concat(l)}function ts(e){return e.map((e,t)=>({...e,name:tt(e.name,t)}))}function tn(e){return(e||"").trim().replace(e7,"_")}function tl(e,t){let s=tn(e);return!s||te.has(s)||s===e9?tm(t):"youtube"===s||s.startsWith(e9)?s:tm(s)}function ti(e){return tl(String(e.pm2Name||""),String(e.id||""))}function ta(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e||"object"!=typeof e)return null;let s=String(e.id||"").trim();return s?{id:s,name:tt("string"==typeof e.name?e.name:"",t),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:tl("string"==typeof e.pm2Name?e.pm2Name:"",s),notes:"string"==typeof e.notes?e.notes:void 0}:null}function tr(e){if(!e)return[];try{let t=JSON.parse(e);if(!Array.isArray(t))return[];let s=t.map((e,t)=>ta(e,t)).filter(e=>null!==e);return ts(s)}catch(e){return[]}}function to(e){window.localStorage.setItem(e8,JSON.stringify(ts(e)))}let tc=["/hub/youtube_pro_channels","/youtube_pro_channels"];async function td(e){for(let s of tc)try{var t;let n=await e(s);return{fetched:!0,channels:(t=n.channels,Array.isArray(t)?ts(t.map((e,t)=>ta(e,t)).filter(e=>null!==e)):[])}}catch(e){}return{fetched:!1,channels:[]}}async function tx(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=null,l=ts(t);for(let t of tc)try{var i;let a=await e(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channels:l,force:!!s.force})});if((null===(i=a.neko)||void 0===i?void 0:i.ok)===!1){let e=a.neko.desired?" desired=".concat(a.neko.desired):"",t=a.neko.current?" current=".concat(a.neko.current):"";n=Error("Neko capacity expansion failed:".concat(e).concat(t," ").concat(a.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 tu(){return"ch_".concat(Date.now().toString(36),"_").concat(Math.random().toString(36).slice(2,7))}function tm(e){return"".concat(e9).concat(tn(e)||"channel")}function th(e){return/youtube/i.test(e.script)||/youtube/i.test(e.pm2)}function tp(e){return e.trim().toLowerCase().startsWith("youtube2__")}function tg(e){return(e.split("/").pop()||e).replace(/\.[^.]+$/,"")}function tb(e){var t;return!!e&&(/youtube/i.test(e.pm2)||/youtube/i.test(null!==(t=e.script)&&void 0!==t?t:""))}function tf(e,t){let s=((null==t?void 0:t.business_status)||"").trim().toLowerCase();return(null==t?void 0:t.is_pushing)||"streaming"===s?0:tz(null==t?void 0:t.process_status)?1:"youtube"===e.pm2.trim().toLowerCase()?2:"youtube"===tg(e.script).trim().toLowerCase()?3:10}let tv="live-hub-youtube-mode-v1",ty=new Set(["douyin_youtube","tiktok","obs","web"]);function tw(e){var t,s,n;return{name:e.name,streamKey:null!==(t=e.streamKey)&&void 0!==t?t:"",pm2Name:null!==(s=e.pm2Name)&&void 0!==s?s:tm(e.id),notes:null!==(n=e.notes)&&void 0!==n?n:""}}function tj(e){return Object.fromEntries(e.map(e=>[e.id,tw(e)]))}function tN(e){let t=((null==e?void 0:e.business_status)||"").trim().toLowerCase();return!!(null==e?void 0:e.is_pushing)||"streaming"===t||"relay_slow"===t}function tk(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if((null==e?void 0:e.source_ambiguous)&&tN(e)&&!(null==e?void 0:e.source_current))return(s?ek("",s).trim():"")||"";{let t=((null==e?void 0:e.source_display)||(null==e?void 0:e.source_title)||"").trim();if(t)return t}let n=ek(t,s).trim();if(n)return n;let l=((null==e?void 0:e.source_room_id)||"").trim();return l?"抖音直播间 ".concat(l):""}function t_(e){var t;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=((null==e?void 0:e.source_url)||"").trim();if(n)return n;let l=ej(s);return tN(e)&&((null==e?void 0:e.source_ambiguous)||(null==e?void 0:e.source_display)||(null==e?void 0:e.source_title))&&l.length>1?"":null!==(t=l[0])&&void 0!==t?t:""}function tz(e){return/^(online|running)$/i.test((e||"").trim())}function tS(e,t){let s=((null==e?void 0:e.business_status)||"").trim().toLowerCase();return"ready"===s?t("已配置","Ready"):"streaming"===s?t("推流中","Pushing"):"source_stalled"===s?t("源卡住","Source stalled"):"relay_slow"===s?t("低速推流","Relay slow"):"waiting_source"===s?t("等待上游","Waiting source"):"source_live"===s?t("源已开播,转推未起","Source live, relay down"):"monitoring"===s?t("监控中","Monitoring"):"misconfigured"===s?t("密钥异常","Key invalid"):"youtube_key_rejected"===s?t("密钥被 YouTube 拒绝","Key rejected"):"stale"===s?t("心跳过期","Stale"):"error"===s?t("异常","Error"):tz(null==e?void 0:e.process_status)?t("运行中","Running"):((null==e?void 0:e.process_status)||"").trim()||t("未运行","Idle")}function tC(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":"relay_slow"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/25":"source_stalled"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/25":"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||"youtube_key_rejected"===t||"error"===t||"stale"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/25":tz(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"}function tR(e){let t=Math.max(0,Math.floor(e||0));if(t<60)return"".concat(t,"s");let s=Math.floor(t/60);return s<60?"".concat(s,"m ").concat(t%60,"s"):"".concat(Math.floor(s/60),"h ").concat(s%60,"m")}function tL(e){if(!e)return"-";try{return new Date(1e3*e).toLocaleString()}catch(e){return"-"}}function tP(e){let t=(e||"").toLowerCase();return"active"===t?"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30":"error"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"ended"===t?"bg-zinc-600/20 text-zinc-300 ring-zinc-500/25":"bg-cyan-500/15 text-cyan-100 ring-cyan-500/25"}function tM(e,t){let s=(e||"").toLowerCase();return"active"===s?t("直播中","Live"):"ended"===s?t("已结束","Ended"):"error"===s?t("异常","Problem"):"idle"===s?t("等待中","Waiting"):t("记录","Record")}function tT(e,t){return null==e?t?t("未知","Unknown"):"-":e.toLocaleString()}function tE(e,t){return e?(e.source_title||e.channel_name||"").trim()||(e.source_room_id?t("抖音直播间 ".concat(e.source_room_id),"Douyin room ".concat(e.source_room_id)):e.process?t("直播线路 ".concat(e.process),"Relay lane ".concat(e.process)):t("直播事件 #".concat(e.id),"Live event #".concat(e.id))):t("未选择直播","No event selected")}function tU(e,t){return e?e.source_room_id?t("抖音房间 ".concat(e.source_room_id),"Douyin room ".concat(e.source_room_id)):e.source_url?e.source_url.replace(/^https?:\/\//,""):t("来源未识别","Unknown source"):"-"}function tZ(e,t){let s=Math.max(0,Math.floor(e||0));if(s<60)return t("".concat(s," 秒"),"".concat(s,"s"));let n=Math.floor(s/60);if(n<60)return t("".concat(n," 分 ").concat(s%60," 秒"),"".concat(n,"m ").concat(s%60,"s"));let l=Math.floor(n/60),i=n%60;return t("".concat(l," 小时 ").concat(i," 分"),"".concat(l,"h ").concat(i,"m"))}function tI(e){if(!e)return"-";try{return new Date(1e3*e).toLocaleString(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1})}catch(e){return"-"}}function tA(e,t){var s;if(!e)return"-";let n=(e.status||"").toLowerCase(),l="".concat(e.last_health||""," ").concat(e.last_live_status||""," ").concat(e.last_popup_text||"").toLowerCase();return"error"===n||/error|failed|poor|unstable|异常|错误|失败/.test(l)?t("需要处理","Needs attention"):e.last_popup_text?t("有弹窗","Popup seen"):(null!==(s=e.quality_score)&&void 0!==s?s:100)<50?t("质量偏低","Low quality"):t("正常","Normal")}function tD(e){let t=tA(e,e=>e);return"需要处理"===t||"质量偏低"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"有弹窗"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/30":"bg-emerald-500/15 text-emerald-100 ring-emerald-500/25"}function tO(e){let t=Number(e||0);return t>=80?"text-emerald-200":t>=55?"text-amber-200":"text-rose-200"}function tB(e){let t=(e||"").toLowerCase();return"critical"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"warning"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/30":"ok"===t?"bg-emerald-500/15 text-emerald-100 ring-emerald-500/25":"bg-cyan-500/15 text-cyan-100 ring-cyan-500/25"}function tW(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"number"!=typeof e||Number.isNaN(e)?"-":"".concat(e.toFixed(e>=100?0:2).replace(/\.00$/,"")).concat(t)}function tK(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith("#"))}function tH(e,t){return tK(e).length>0&&0===tK(t).length}function tF(e){let{kind:t,busyKind:s,targetPm2:l,busy:i,online:a,label:r,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),s=t.indexOf(":");if(s<=0)return null;let n=t.slice(0,s),l=t.slice(s+1);return l&&["start","stop","restart"].includes(n)?{action:n,pm2:l}:null}(i),p=h&&h.pm2===l,g=null!=s?s:t,b=!!(p&&h.action===g),f=!!(p&&h.action!==g),v="start"===t&&a,w="stop"===t&&!a,j="restart"===t&&!a,N=v||w||j;return(0,n.jsxs)("button",{type:"button",onClick:()=>{if(!b){if(f){x(u("请等待当前操作完成","Wait for the current action to finish"));return}if(v){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||b||f?"cursor-not-allowed":""," ").concat(N&&!b?"opacity-45":""," ").concat(f?"opacity-35":""," ").concat(b?"ring-violet-400/40":""),children:[b?(0,n.jsx)("span",{className:"absolute inset-0 flex items-center justify-center bg-black/25 backdrop-blur-[2px]",children:(0,n.jsx)(y.Z,{className:"".concat(m?"h-4 w-4":"h-6 w-6"," animate-spin text-white")})}):null,(0,n.jsxs)("span",{className:"inline-flex items-center justify-center gap-1.5 ".concat(b?"invisible":""),children:[N?(0,n.jsx)(eQ.Z,{className:"".concat(m?"h-3 w-3":"h-4 w-4"," shrink-0 opacity-90"),"aria-hidden":!0}):null,r]})]})}function tY(e){var t,s,l,i,r,o,d,x,u,m,h,p,g,b,f,v,j,N,k,_,z,C,R,L,P,M,T,E,U,I;let{t:A,busy:D,entries:O,currentProc:B,setCurrentProc:W,urlConfig:H,setUrlConfig:F,onRunProcess:q,onSaveUrlConfig:V,fetchJson:J,liveProcesses:$,notify:X,onNavigate:Q,onRefresh:ee,quickLinks:et}=e,es=(0,Z.useMemo)(()=>O.filter(th),[O]),en=(0,Z.useMemo)(()=>(function(e,t){let s=e.filter(e=>th(e)&&!tp(e.pm2)),n=s.filter(e=>th(e)&&e.pm2.trim()===tg(e.script).trim()),l=n.length?[...n]:s.length?[...s]:[...e],i=new Set(l.map(e=>e.pm2.trim()));for(let e of t.filter(e=>tb(e)&&!tp(e.pm2))){var a,r,o,c;let t=e.pm2.trim();if(!t||i.has(t))continue;let n=(e.business_status||"").trim().toLowerCase();if(!e.is_pushing&&"streaming"!==n&&!tz(e.process_status))continue;let d=s.find(e=>e.pm2.trim()===t);l.push(null!=d?d:{pm2:t,script:null!==(o=null!==(r=e.script)&&void 0!==r?r:null===(a=s[0])||void 0===a?void 0:a.script)&&void 0!==o?o:"youtube.py",label:null!==(c=e.label)&&void 0!==c?c:t}),i.add(t)}return l})(es.length?es:O,$),[O,$,es]),el=(0,Z.useMemo)(()=>(function(e,t){if(!e.length)return"";let s=new Map(t.filter(tb).map(e=>[e.pm2.trim(),e])),n=e[0],l=tf(n,s.get(n.pm2.trim()));for(let t of e.slice(1)){let e=tf(t,s.get(t.pm2.trim()));e"youtube"===e.pm2.trim().toLowerCase());if(n)return n.pm2;let l=e.find(e=>"youtube"===tg(e.script).trim().toLowerCase());return l?l.pm2:null!==(s=null===(t=e[0])||void 0===t?void 0:t.pm2)&&void 0!==s?s:""}(en),[$,en]),[ei,ea]=(0,Z.useState)("single"),[er,eo]=(0,Z.useState)([]),[ec,ed]=(0,Z.useState)(""),[ex,eu]=(0,Z.useState)(H),[em,eb]=(0,Z.useState)(""),[ef,eN]=(0,Z.useState)({key:"",rtmps:!0,bitrate:"",fastAudio:!0}),[ek,e_]=(0,Z.useState)(null),[ez,eL]=(0,Z.useState)(!1),[eM,eT]=(0,Z.useState)(""),[eE,eU]=(0,Z.useState)(!0),[eZ,eI]=(0,Z.useState)(!1),[eA,eD]=(0,Z.useState)(!1),[eO,eB]=(0,Z.useState)(null),[eW,eK]=(0,Z.useState)({}),[eH,eF]=(0,Z.useState)(!1),[eY,eG]=(0,Z.useState)(null),[eq,eV]=(0,Z.useState)(0),[eJ,e$]=(0,Z.useState)(null),[eX,eQ]=(0,Z.useState)(null),[e9,e7]=(0,Z.useState)(!1),[te,tl]=(0,Z.useState)(null),[ta,tc]=(0,Z.useState)(!1),[tY,tG]=(0,Z.useState)(!0),[tq,tV]=(0,Z.useState)(null),[tJ,t$]=(0,Z.useState)(null),tX=(0,Z.useRef)(!1),tQ=(0,Z.useRef)(H),t0=(0,Z.useRef)(eM),t1=(0,Z.useRef)([]),t5=(0,Z.useRef)(B),t2=(0,Z.useRef)(0),t3=(0,Z.useRef)(0),t4=(0,Z.useRef)(0),t6=(0,Z.useRef)(0),t8=(0,Z.useRef)({}),t9=(0,Z.useRef)({}),t7=(0,Z.useCallback)(e=>{tQ.current=e,eu(e),F(e)},[F]),se=(0,Z.useCallback)(e=>{t0.current=e,eT(e)},[]),st=(0,Z.useCallback)(e=>{let t=e.trim();if(!t)return Promise.resolve("");let s=t8.current[t];if(s)return s;let n=new URLSearchParams({process:t,_ts:String(Date.now())}),l=J("/get_url_config?".concat(n)).then(e=>{var t;return null!==(t=e.content)&&void 0!==t?t:""});return t8.current[t]=l,l.then(()=>{t8.current[t]===l&&delete t8.current[t]},()=>{t8.current[t]===l&&delete t8.current[t]}),l},[J]),ss=(0,Z.useCallback)(e=>{let t=e.trim();if(!t)return Promise.resolve("");let s=t9.current[t];if(s)return s;let n=new URLSearchParams({process:t,_ts:String(Date.now())}),l=J("/get_config?".concat(n)).then(e=>{var t;return null!==(t=e.content)&&void 0!==t?t:""});return t9.current[t]=l,l.then(()=>{t9.current[t]===l&&delete t9.current[t]},()=>{t9.current[t]===l&&delete t9.current[t]}),l},[J]),sn=(0,Z.useCallback)(()=>{let e=++t4.current;return eI(!0),e},[]),sl=(0,Z.useCallback)(e=>{e===t4.current&&eI(!1)},[]),si=(0,Z.useCallback)(()=>{let e=++t6.current;return eL(!0),e},[]),sa=(0,Z.useCallback)(e=>{e===t6.current&&eL(!1)},[]);(0,Z.useEffect)(()=>{let e=()=>tG("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,Z.useEffect)(()=>{tX.current=!1},[B]),(0,Z.useEffect)(()=>{t5.current=B},[B]),(0,Z.useEffect)(()=>{"single"===ei&&(tQ.current=H,eu(H))},[ei,H]),(0,Z.useEffect)(()=>{t0.current=eM},[eM]),(0,Z.useEffect)(()=>{t1.current=er},[er]),(0,Z.useEffect)(()=>{t2.current+=1,t3.current+=1,tX.current=!1,eB(null)},[ei,ec]);let sr=(0,Z.useCallback)(async()=>{let e=t5.current.trim();if(!e)return;if("pro"===ei){let t=t1.current.find(e=>e.id===ec);if(!t||ti(t)!==e)return}let t=++t2.current;try{let l=await st(e);if(t!==t2.current||e!==t5.current.trim()||tX.current)return;if("single"===ei)t7(l);else{var s,n;let e=null!==(n=null===(s=t1.current.find(e=>e.id===ec))||void 0===s?void 0:s.urlLines)&&void 0!==n?n:"";if(tH(e,l)){se(e);return}se(l)}}catch(e){}},[ec,se,t7,ei,st]),so=(0,Z.useMemo)(()=>({pageVisible:tY}).pageVisible?12e3:0,[tY]);(0,Z.useEffect)(()=>{if(!B||!eE||so<=0)return;let e=window.setInterval(()=>{tX.current||sr()},so);return()=>clearInterval(e)},[B,eE,sr,so]);let sc=async()=>{let e=t5.current.trim();if(!e)return;if("pro"===ei){let t=t1.current.find(e=>e.id===ec);if(!t||ti(t)!==e)return}let t=sn();eB(null),tX.current=!1;let s=++t2.current;try{let t=await st(e);if(s!==t2.current||e!==t5.current.trim())return;if(tX.current){eB(A("检测到本地未保存修改,已保留当前草稿","Kept the local unsaved draft"));return}if("single"===ei)t7(t);else{var n,l;let e=null!==(l=null===(n=t1.current.find(e=>e.id===ec))||void 0===n?void 0:n.urlLines)&&void 0!==l?l:"";if(tH(e,t)){se(e),eB(A("服务器暂无已保存 URL,已保留本地草稿","Server has no saved URLs, kept the local draft"));return}se(t)}eB(A("已从服务器读取 URL_config","Reloaded URL_config from server"))}catch(t){if(s!==t2.current||e!==t5.current.trim())return;eB(t.message)}finally{sl(t)}};(0,Z.useEffect)(()=>{try{let e=window.localStorage.getItem(tv);("pro"===e||"single"===e)&&ea(e)}catch(e){}},[]),(0,Z.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await td(J);if(t.fetched&&t.channels.length&&!e){let e=ts(t.channels);t1.current=e,eo(e),eK(tj(e)),to(e);return}}catch(e){}if(e)return;let t=function(){let e=window.localStorage.getItem(e8);if(!e&&(e=window.localStorage.getItem("live-hub-youtube-pro-v1"))){let t=tr(e);if(t.length)return window.localStorage.setItem(e8,JSON.stringify(t)),t}return tr(e)}(),s=ts(t.length>0?t:[{id:tu(),name:"线路 1",streamKey:"",urlLines:"",pm2Name:"youtube",notes:""}]);t1.current=s,eo(s),eK(tj(s)),to(s)})(),()=>{e=!0}},[J]),(0,Z.useEffect)(()=>{if(!er.length){ec&&ed("");return}ec&&er.some(e=>e.id===ec)||ed(er[0].id)},[er,ec]);let sd=er.find(e=>e.id===ec)||er[0],sx=(0,Z.useMemo)(()=>er.find(e=>ti(e)===B),[er,B]),su=(0,Z.useCallback)(e=>$.find(t=>t.pm2===e),[$]),sm=(0,Z.useCallback)(e=>{var t;return null===(t=su(e))||void 0===t?void 0:t.process_status},[su]),sh=su(B),sp=su(B);(0,Z.useEffect)(()=>{"single"===ei&&el&&!B&&(t5.current=el,W(el))},[B,ei,el,W]);let sg=(0,Z.useCallback)(e=>{let t=ts(e);t1.current=t,eo(t),to(t)},[]),sb=(0,Z.useCallback)((e,t)=>{let s=e.trim();if(!s)return;let n=!1,l=t1.current.map(e=>ti(e)!==s?e:(n=!0,{...e,...t}));n&&sg(l)},[sg]),sf=(0,Z.useCallback)(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};await tx(J,e,t)},[J]),sv=(0,Z.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sg(e),sf(e,t).catch(e=>{X("".concat(A("多频道列表未同步到服务器","Channel list not saved on server"),": ").concat(e.message))})},[sg,X,sf,A]),sy=(0,Z.useMemo)(()=>{var e;return sd?null!==(e=eW[sd.id])&&void 0!==e?e:tw(sd):null},[sd,eW]);(0,Z.useEffect)(()=>{sd&&eK(e=>e[sd.id]?e:{...e,[sd.id]:tw(sd)})},[sd]),(0,Z.useEffect)(()=>{if(!sd||"youtube"!==ti(sd))return;let e=ef.key.trim();e&&eK(t=>{var s;let n=null!==(s=t[sd.id])&&void 0!==s?s:tw(sd);return n.streamKey.trim()===e&&"youtube"===n.pm2Name||n.streamKey.trim()?t:{...t,[sd.id]:{...n,streamKey:e,pm2Name:"youtube"}}})},[sd,ef.key]),(0,Z.useEffect)(()=>{eG(null)},[ec]);let sw=(0,Z.useCallback)((e,t)=>{sd&&(eK(s=>{var n;return{...s,[sd.id]:{...null!==(n=s[sd.id])&&void 0!==n?n:tw(sd),[e]:t}}}),eG(null))},[sd]),sj=sd?ti(sd):"",sN=sd&&sy?ti({id:sd.id,pm2Name:sy.pm2Name}):"",sk=!!sd&&!!sy&&sN!==sj,s_=(0,Z.useMemo)(()=>{if(!sd||!sy)return{ok:!1,message:A("请选择线路","Pick a lane"),normalizedName:"",normalizedPm2:"",normalizedStreamKey:"",normalizedNotes:""};let e=er.findIndex(e=>e.id===sd.id),t=tt(sy.name,e>=0?e:0),s=ti({id:sd.id,pm2Name:sy.pm2Name});return s?ty.has(s)?{ok:!1,message:A("该进程名保留给系统模块,请换一个","This PM2 name is reserved"),normalizedName:t,normalizedPm2:s,normalizedStreamKey:sy.streamKey.trim(),normalizedNotes:sy.notes.trim()}:er.find(e=>e.id!==sd.id&&ti(e)===s)?{ok:!1,message:A("该进程名已被其它线路占用","Another lane already uses this PM2 name"),normalizedName:t,normalizedPm2:s,normalizedStreamKey:sy.streamKey.trim(),normalizedNotes:sy.notes.trim()}:{ok:!0,message:"",normalizedName:t,normalizedPm2:s,normalizedStreamKey:sy.streamKey.trim(),normalizedNotes:sy.notes.trim()}:{ok:!1,message:A("进程名不能为空","PM2 name is required"),normalizedName:t,normalizedPm2:s,normalizedStreamKey:sy.streamKey.trim(),normalizedNotes:sy.notes.trim()}},[sd,sy,er,A]),sz=(0,Z.useMemo)(()=>{if(!sd||!sy)return!1;let e=tw(sd);return sy.name!==e.name||sy.streamKey!==e.streamKey||tn(sy.pm2Name)!==tn(e.pm2Name)||sy.notes!==e.notes},[sd,sy]),sS=(0,Z.useCallback)(async e=>{let t=e.trim();if(!t)return;let s=++t2.current,n=++t3.current;tX.current=!1;let l=sn(),i=si();eB(A("正在同步单频道配置...","Syncing single-channel config...")),e_(null);try{let[e,l]=await Promise.allSettled([st(t),ss(t)]);if(s===t2.current&&t===t5.current.trim()&&("fulfilled"===e.status?(t7(e.value),eB(A("单频道配置已实时同步","Single-channel config synced"))):eB(e.reason instanceof Error?e.reason.message:String(e.reason))),n===t3.current&&t===t5.current.trim()){if("fulfilled"===l.status){let e=l.value;eb(e),eN(eS(e))}else e_(l.reason instanceof Error?l.reason.message:String(l.reason))}}finally{sl(l),sa(i),t===t5.current.trim()&&eV(e=>e+1)}},[t7,sn,si,sl,sa,st,ss,A]),sC=(0,Z.useCallback)(async e=>{let t=ti(e).trim();if(!t)return;let s=++t2.current,n=++t3.current;tX.current=!1;let l=sn(),i=si();eB(A("正在同步当前线路配置...","Syncing current lane config...")),e_(null);try{let[l,i]=await Promise.allSettled([st(t),ss(t)]);if(s===t2.current&&t===t5.current.trim()){if("fulfilled"===l.status){var a;let s=l.value,n=null!==(a=e.urlLines)&&void 0!==a?a:"";tH(n,s)?(se(n),sb(t,{urlLines:n}),eB(A("服务器暂无已保存 URL,已保留当前线路草稿","Server has no saved URLs, kept this lane draft"))):(se(s),sb(t,{urlLines:s}),eB(A("当前线路地址已实时同步","Current lane URLs synced")))}else eB(l.reason instanceof Error?l.reason.message:String(l.reason))}if(n===t3.current&&t===t5.current.trim()){if("fulfilled"===i.status){let t=i.value,s=eS(t);eb(t),eN(s),s.key.trim()&&eK(t=>{var n,l;let i=null!==(n=t[e.id])&&void 0!==n?n:tw(e);return i.streamKey.trim()&&i.streamKey.trim()!==(null!==(l=e.streamKey)&&void 0!==l?l:"").trim()||i.streamKey.trim()===s.key.trim()?t:{...t,[e.id]:{...i,streamKey:s.key.trim()}}})}else e_(i.reason instanceof Error?i.reason.message:String(i.reason))}}finally{sl(l),sa(i),t===t5.current.trim()&&eV(e=>e+1)}},[se,sn,si,sl,sa,sb,st,ss,A]);(0,Z.useCallback)(async()=>{try{var e,t;let s=await td(J);if(!s.fetched||!s.channels.length)return;let n=ts(s.channels);t1.current=n,eo(n),eK(tj(n)),to(n);let l=null!==(e=n.find(e=>e.id===ec))&&void 0!==e?e:n[0];if(!l)return;ed(l.id),se((null!==(t=l.urlLines)&&void 0!==t?t:"").trim());let i=ti(l);t5.current=i,W(i),sC(l)}catch(e){}},[ec,se,J,sC,W]);let sR=(0,Z.useCallback)(e=>{var t,s,n,l;if("pro"===e&&"single"===ei&&!ef.key.trim()){X(A("请先填写并保存 YouTube 推流 key,再切换到多频道 Pro","Fill and save the YouTube stream key before switching to Multi Pro"));return}if("single"===e){let e=t5.current.trim(),s=sd?ti(sd):"",n="pro"===ei?s||e:e||el||(null===(t=en[0])||void 0===t?void 0:t.pm2)||"";n&&(t5.current=n,W(n),sS(n))}if("pro"===e&&er.length){let e=t5.current.trim(),t=null!==(n=null!==(s=er.find(t=>ti(t)===e))&&void 0!==s?s:er.find(e=>e.id===ec))&&void 0!==n?n:er[0];if(se((null!==(l=null==t?void 0:t.urlLines)&&void 0!==l?l:"").trim()),t){ed(t.id);let e=ti(t);t5.current=e,W(e),sC(t)}}ea(e);try{window.localStorage.setItem(tv,e)}catch(e){}},[er,se,sd,ec,ei,X,el,sC,sS,W,en,A,ef.key]),sL=(0,Z.useCallback)(e=>{var t;se((null!==(t=e.urlLines)&&void 0!==t?t:"").trim()),ed(e.id);let s=ti(e);t5.current=s,W(s),sC(e)},[se,sC,W]);(0,Z.useEffect)(()=>{if("pro"!==ei||!ec)return;let e=er.find(e=>e.id===ec);if(!e)return;let t=ti(e);t5.current=t,W(t)},[ei,ec,er,W]);let sP=(0,Z.useCallback)(async()=>{let e=t5.current.trim();if(!e)return;let t=++t3.current,s=si();e_(null);try{let s=await ss(e);if(t!==t3.current||e!==t5.current.trim())return;eb(s),eN(eS(s))}catch(s){if(t!==t3.current||e!==t5.current.trim())return;e_(s.message)}finally{sa(s)}},[si,sa,ss]);(0,Z.useEffect)(()=>{if(B){if("pro"===ei){if(!sd||B!==ti(sd))return;sr(),sP(),eV(e=>e+1);return}sS(B)}},[sd,ec,B,sP,ei,sr,sS]);let sM=(0,Z.useCallback)(async()=>{var e;if(!sd||!sy)throw Error(A("请选择线路","Pick a lane"));if(!s_.ok)throw Error(s_.message);let t=t0.current,s=er.map(e=>e.id===sd.id?{...e,name:s_.normalizedName,streamKey:s_.normalizedStreamKey,pm2Name:s_.normalizedPm2,notes:s_.normalizedNotes,urlLines:t}:e);return await sf(s,{force:!0}),sg(s),eK(e=>({...e,[sd.id]:{name:s_.normalizedName,streamKey:s_.normalizedStreamKey,pm2Name:s_.normalizedPm2,notes:s_.normalizedNotes}})),{next:s,savedLane:null!==(e=s.find(e=>e.id===sd.id))&&void 0!==e?e:{...sd,name:s_.normalizedName,streamKey:s_.normalizedStreamKey,pm2Name:s_.normalizedPm2,notes:s_.normalizedNotes,urlLines:t},pm2:s_.normalizedPm2}},[sd,sy,s_,sg,er,sf,A]),sT=(0,Z.useCallback)(async()=>{if(sd){eF(!0),eG(null);try{let e=await sM();t5.current=e.pm2,W(e.pm2),eG(A("线路设置已保存","Lane settings saved"))}catch(t){let e=t.message;eG(e),X(e)}finally{eF(!1)}}},[sd,X,sM,W,A]),sE=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t5.current,s=t.trim();if(!s){e_(A("请选择进程","Pick a process"));return}t3.current+=1;let n=si();e_(null);try{let t=new URLSearchParams({process:s});await J("/save_config?".concat(t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})}),eb(e),sb(s,{streamKey:eS(e).key}),e_(A("youtube.ini 已保存","youtube.ini saved"))}catch(e){e_(e.message)}finally{sa(n)}},sU=async()=>{let e=eR(ef);await sE(e)},sZ=async()=>{t3.current+=1;let e=si();e_(null);try{var t,s;let e=em||eR(ef),n=await J("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:"app-config",path:(s=t5.current,"youtube.".concat(s.replace(/[^a-zA-Z0-9_.-]/g,"_"),".ini")),content:e,action:"youtube_balanced_preset"})}),l=null!==(t=n.content)&&void 0!==t?t:e;eb(l),eN(eS(l)),e_(n.message||A("已应用 YouTube 预设","Applied YouTube preset"))}catch(e){e_(e.message)}finally{sa(e)}},sI=(0,Z.useMemo)(()=>{var e,t;if("single"===ei)return ew("key = ".concat(ef.key));let s=null!==(t=null!==(e=null==sy?void 0:sy.streamKey)&&void 0!==e?e:null==sd?void 0:sd.streamKey)&&void 0!==t?t:"";return ew("key = ".concat(s))},[ei,null==sd?void 0:sd.streamKey,ef.key,null==sy?void 0:sy.streamKey]),sA=sI?"…".concat(sI):"—",sD=async()=>{if(!sd){let e=A("请选择线路后再保存地址","Pick a lane before saving URLs");eG(e),X(e);return}if(s7){eG(s7),X(s7);return}try{eF(!0),eG(null),t2.current+=1;let e=t0.current,t=await sM();t5.current=t.pm2,W(t.pm2),await Promise.resolve(V(e,t.pm2)),tX.current=!1,eG(A("线路与地址已保存","Lane settings and URLs saved"))}catch(t){let e=t instanceof Error?t.message:String(t);eG(e),X(e)}finally{eF(!1)}},sO=async()=>{if(s7){X(s7);return}let e=t5.current.trim();if(!e){X(A("请选择进程","Pick a process"));return}try{t2.current+=1,await Promise.resolve(V(tQ.current,e)),sb(e,{urlLines:tQ.current}),tX.current=!1}catch(e){}},sB=async()=>{let e="single"===ei?tQ.current:t0.current;eD(!0),eB(null);try{var t;let s=await J("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:"app-config",path:eC(t5.current),content:e,action:"dedupe_urls"})}),n=null!==(t=s.content)&&void 0!==t?t:e;"single"===ei?t7(n):se(n),tX.current=!0,eB(s.message||A("已去重当前 URL 列表","Deduplicated current URL list"))}catch(e){eB(e.message)}finally{eD(!1)}},sW=async()=>{if(!sd||!sy)return;let e=eS(em||eR(ef)),t=eR({key:sy.streamKey.trim(),rtmps:e.rtmps,bitrate:e.bitrate,fastAudio:e.fastAudio});eF(!0),eG(null);try{let e=await sM();t5.current=e.pm2,W(e.pm2),await sE(t,e.pm2),eG(A("线路设置与 youtube.ini 已保存","Lane settings and youtube.ini saved"))}catch(t){let e=t.message;eG(e),X(e)}finally{eF(!1)}},sK="single"===ei?ex:eM,sH=(0,Z.useMemo)(()=>tK(sK).length,[sK]),sF=(0,Z.useMemo)(()=>ej(sK).length,[sK]),sY=(0,Z.useMemo)(()=>(0,e6.O0)(et),[et]),sG=(0,Z.useMemo)(()=>(0,e6.U_)(sY,"pro"===ei&&sd?er.findIndex(e=>e.id===sd.id):0),[sd,er,ei,sY]),sq=sG.link?(0,eh.p)(sG.link.url):(0,eh.p)("http://live.local:9200/"),sV=(0,Z.useMemo)(()=>(0,e6.Tc)(sY),[sY]),sJ=(0,Z.useMemo)(()=>{var e;return[null===(e=sG.link)||void 0===e?void 0:e.url,null==et?void 0:et.chromium_remote_debug,null==et?void 0:et.srs_api].filter(e=>!!e)},[et,null===(t=sG.link)||void 0===t?void 0:t.url]),s$=(0,Z.useCallback)(async(e,t)=>{if(!tq&&("delete"!==t||window.confirm("".concat(e.label,": 删除容器?浏览器配置和登录数据会保留,之后点“启动”会自动重建。")))){tV("".concat(e.id,":").concat(t)),t$(null);try{let s=await J("/neko/instance_action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id,action:t})}),n=s.running?A("运行中","running"):s.exists?A("已停止","stopped"):A("容器不存在","missing"),l=s.message||"".concat(e.label,": ").concat(n);t$("".concat(l," \xb7 ").concat(n)),await (null==ee?void 0:ee())}catch(t){let e=t.message;t$(e),X(e)}finally{tV(null)}}},[J,tq,X,ee,A]),sX=(0,Z.useCallback)(async e=>{let t=sd?ti(sd):"";return sd&&e===t?await sM():(sg(er),await sf(er,{force:!0}),{next:er,savedLane:null!=sd?sd:null,pm2:e})},[sd,sg,er,sM,sf]),sQ=(0,Z.useCallback)(async(e,t)=>{let s=!!sd&&ti(sd)===t;if("stop"!==e){var n,l;let e=er,s=t;try{let n=await sX(t);e=n.next,s=n.pm2}catch(e){X("".concat(A("当前线路保存失败","Failed to save the active lane"),": ").concat(e.message));return}let i=e.find(e=>ti(e)===s),a=null!==(n=null==i?void 0:i.urlLines)&&void 0!==n?n:"";if(!(null!==(l=null==i?void 0:i.streamKey)&&void 0!==l?l:"").trim()){X(A("请先填写当前线路的推流密钥","Fill the stream key before starting"));return}if(!tK(a).length){X(A("请先填写当前线路的直播地址","Fill the source URLs before starting"));return}t=s}s&&W(t),q(e,t)},[sd,er,sX,X,q,W,A]),s0=(0,Z.useCallback)(async e=>{e7(!0);try{var t,s,n,l;let i=await J("/hub/youtube/live/summary");e$(i);let a=i.active||[],r=t5.current.trim(),o=null!==(l=null!==(n=null!=e?e:r?null===(t=a.find(e=>e.process===r))||void 0===t?void 0:t.id:void 0)&&void 0!==n?n:null===(s=a[0])||void 0===s?void 0:s.id)&&void 0!==l?l:null==eX?void 0:eX.id;if(o){let e=await J("/hub/youtube/live/events/".concat(encodeURIComponent(String(o))));e.event&&eQ(e.event)}}catch(e){}finally{e7(!1)}},[J,null==eX?void 0:eX.id]),s1=(0,Z.useCallback)(async e=>{e7(!0);try{let t=await J("/hub/youtube/live/events/".concat(encodeURIComponent(String(e))));eQ(t.event||null)}catch(e){X(e.message)}finally{e7(!1)}},[J,X]),s5=null!==(x=null==eJ?void 0:null===(s=eJ.active)||void 0===s?void 0:s.length)&&void 0!==x?x:0,s2=(0,Z.useMemo)(()=>{var e;return(e={activeEvents:s5,pageVisible:tY}).pageVisible?e.activeEvents>0?4e3:12e3:3e4},[s5,tY]);(0,Z.useEffect)(()=>{if(s0(null),s2<=0)return;let e=window.setInterval(()=>void s0(),s2);return()=>window.clearInterval(e)},[s2,s0]),(0,Z.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&s0(null)};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[s0]);let s3=(0,Z.useCallback)(async()=>{tc(!0);try{let e=await J("/hub/youtube/quality_guard");tl(e)}catch(e){}finally{tc(!1)}},[J]),s4=null!==(u=null==te?void 0:null===(l=te.summary)||void 0===l?void 0:l.pushing_lanes)&&void 0!==u?u:0,s6=(0,Z.useMemo)(()=>{var e;return(e={pushingLanes:s4,pageVisible:tY}).pageVisible?e.pushingLanes>0?6e3:15e3:3e4},[s4,tY]);(0,Z.useEffect)(()=>{if(s3(),s6<=0)return;let e=window.setInterval(()=>void s3(),s6);return()=>window.clearInterval(e)},[s6,s3]),(0,Z.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&s3()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[s3]);let s8=!!D||ez||eZ||eA||eH,s9=!!D||eH,s7=ez?A("正在读取 youtube.ini,稍后再保存地址","youtube.ini is loading; save URLs after it finishes"):eZ?A("正在重新读取地址列表,稍后再保存","URL list is reloading; save after it finishes"):eA?A("正在整理地址列表,稍后再保存","URL list is being optimized; save after it finishes"):D?A("正在执行其他操作,稍后再保存地址","Another operation is running; save URLs after it finishes"):"",ne="single"===ei?sp:sh,nt=(0,Z.useMemo)(()=>"pro"===ei?ey($.filter(e=>tb(e))):ev(sp),[ei,$,sp]),ns=(0,Z.useMemo)(()=>(function(e){if(e.paused)return 0;if(!e.pageVisible)return 3e4;switch(e.activity){case"hot":return 800;case"warm":return 2e3;default:return 4e3}})({activity:nt,pageVisible:tY}),[nt,tY]),nn=tz(sm(B)),nl=sd?tk(su(ti(sd)),eM||sd.urlLines||""):"",ni=tN(sp),na=(0,Z.useMemo)(()=>{var e,t,s;let n=(null==eJ?void 0:eJ.active)||[],l=B.trim();return l?null!==(s=null!==(t=n.find(e=>e.process===l))&&void 0!==t?t:n[0])&&void 0!==s?s:null:null!==(e=n[0])&&void 0!==e?e:null},[B,null==eJ?void 0:eJ.active]),nr=(0,Z.useMemo)(()=>{var e;if("single"===ei)return ex;let t=er.find(e=>ti(e)===B);return t&&t.id===(null==sd?void 0:sd.id)?eM:(null!==(e=null==t?void 0:t.urlLines)&&void 0!==e?e:"").trim()||eM},[null==sd?void 0:sd.id,er,ei,eM,B,ex]),no=tk(sp,nr),nc=t_(sp,nr),nd=null==te?void 0:null===(i=te.lanes)||void 0===i?void 0:i.find(e=>e.process===B),nx=null==nd?void 0:nd.metrics,nu=null!==(m=null==nd?void 0:nd.score)&&void 0!==m?m:null,nm="pro"===ei?$.filter(e=>tb(e)&&tN(e)).length:ni?1:0,nh="number"==typeof(null==sp?void 0:sp.ffmpeg_speed)?sp.ffmpeg_speed.toFixed(2):"number"==typeof(null==nx?void 0:nx.speed)?nx.speed.toFixed(2):null,np="number"==typeof(null==sp?void 0:sp.ffmpeg_frame)?String(sp.ffmpeg_frame):"number"==typeof(null==nx?void 0:nx.frame)?String(nx.frame):null,ng="number"==typeof(null==nx?void 0:nx.bitrate)?"".concat(Math.round(nx.bitrate)," kbps"):null,nb="number"==typeof(null==sp?void 0:sp.ffmpeg_time_seconds)?tZ(sp.ffmpeg_time_seconds,A):null,nf=!sI||0===sF,nv=sI?ef.rtmps?"RTMPS":"RTMP":A("检查密钥","Check key"),ny=e=>{var t;let s=(null===(t=sG.link)||void 0===t?void 0:t.id)===e.id,l=tq==="".concat(e.id,":start"),i=tq==="".concat(e.id,":stop"),a=tq==="".concat(e.id,":delete"),r=!!tq,o=e.id===sY.length&&sY.length>1,c=r||!o;return(0,n.jsxs)("div",{className:"flex min-h-[2.5rem] items-stretch overflow-hidden rounded-lg border text-xs ring-1 ".concat(s?"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,n.jsxs)("a",{href:(0,eh.p)(e.url),target:"_blank",rel:"noreferrer",className:"flex items-center gap-2 px-3 py-2 hover:bg-white/[0.04]",children:[(0,n.jsx)("span",{className:"font-semibold",children:e.label}),(0,n.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-1.5 py-0.5 text-[10px] text-emerald-100",children:e.accessLabel}),(0,n.jsxs)("span",{className:"font-mono text-white/70",children:[e.host||"",e.port?":".concat(e.port):""]})]}),(0,n.jsxs)("div",{className:"flex border-l border-white/10",children:[(0,n.jsxs)("button",{type:"button",disabled:r,title:A("启动 Neko 容器","Start Neko container"),onClick:()=>void s$(e,"start"),className:"inline-flex min-w-[3.75rem] items-center justify-center gap-1 px-2 text-emerald-100 hover:bg-emerald-500/15 disabled:cursor-not-allowed disabled:opacity-45",children:[l?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(G.Z,{className:"h-3.5 w-3.5"}),A("启动","Start")]}),(0,n.jsxs)("button",{type:"button",disabled:r,title:A("停止 Neko 容器","Stop Neko container"),onClick:()=>void s$(e,"stop"),className:"inline-flex min-w-[3.75rem] items-center justify-center gap-1 border-l border-white/10 px-2 text-amber-100 hover:bg-amber-500/15 disabled:cursor-not-allowed disabled:opacity-45",children:[i?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(e0.Z,{className:"h-3.5 w-3.5"}),A("停止","Stop")]}),(0,n.jsxs)("button",{type:"button",disabled:c,title:o?A("删除最后一个 Neko 实例,保留浏览器配置数据","Delete the last Neko instance and keep browser profile data"):A("只能删除最后一个 Neko 实例","Only the last Neko instance can be deleted"),onClick:()=>void s$(e,"delete"),className:"inline-flex min-w-[3.75rem] items-center justify-center gap-1 border-l border-white/10 px-2 text-rose-100 hover:bg-rose-500/15 disabled:cursor-not-allowed disabled:opacity-45",children:[a?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(S.Z,{className:"h-3.5 w-3.5"}),A("删除","Delete")]})]})]},e.key)},nw=(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-4 text-xs text-zinc-400",children:[(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:eE,onChange:e=>eU(e.target.checked)}),A("后台自动从服务器刷新(空闲约 12 秒)","Auto-refresh from server (~12s when idle)")]}),(0,n.jsx)("button",{type:"button",disabled:s8,onClick:()=>void sc(),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,n.jsx)("button",{type:"button",disabled:s8,onClick:()=>void sB(),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:eA?A("去重中...","Deduplicating..."):A("智能去重","Deduplicate")})]}),nj=(null==eJ?void 0:eJ.active)||[],nN=(null==eJ?void 0:eJ.latest)||[],nk=(null==eJ?void 0:eJ.alerts)||[],n_=(null==eJ?void 0:eJ.stats)||{},nz=[{label:A("活动事件","Active"),value:null!==(h=n_.active_events)&&void 0!==h?h:nj.length,Icon:a.Z},{label:A("历史事件","History"),value:null!==(p=n_.total_events)&&void 0!==p?p:nN.length,Icon:e1.Z},{label:A("采样点","Samples"),value:null!==(g=n_.sample_count)&&void 0!==g?g:0,Icon:e5.Z},{label:A("峰值在线","Viewer peak"),value:null!==(b=n_.viewer_peak)&&void 0!==b?b:0,Icon:e2.Z},{label:A("累计时长","Total duration"),value:tR(n_.total_duration_seconds),Icon:e3.Z}],nS=(0,n.jsxs)("section",{className:"rounded-2xl border border-cyan-500/20 bg-gradient-to-br from-cyan-500/[0.08] via-zinc-950/80 to-emerald-500/[0.05] p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(e5.Z,{className:"h-4 w-4 text-cyan-300"}),A("直播事件中枢","Live event center")]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:A("事件、转播对象、时长、页面采集、弹窗和告警全部写入本地 SQLite,可追溯。","Events, source rooms, duration, browser telemetry, popups, and alerts are stored locally.")})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>void s0(),className:"inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-200 hover:bg-white/[0.08]",children:[(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(e9?"animate-spin":"")}),A("刷新事件","Refresh events")]})]}),(0,n.jsx)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 xl:grid-cols-5",children:nz.map(e=>{let{label:t,value:s,Icon:l}=e;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-zinc-500",children:[(0,n.jsx)(l,{className:"h-3.5 w-3.5 text-cyan-300"}),t]}),(0,n.jsx)("p",{className:"mt-2 font-mono text-lg font-semibold text-white",children:String(s)})]},t)})}),(0,n.jsxs)("div",{className:"mt-5 grid gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(22rem,0.9fr)]",children:[(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-200/90",children:A("正在转播","Active relay")}),(0,n.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] text-emerald-100 ring-1 ring-emerald-500/25",children:nj.length})]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2",children:[(nj.length?nj:nN.slice(0,1)).map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>void s1(e.id),className:"block w-full rounded-lg border border-white/[0.06] bg-white/[0.03] px-3 py-2 text-left transition hover:bg-white/[0.06]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"truncate text-sm font-medium text-white",children:e.source_title||e.channel_name||e.source_room_id||e.process||"#".concat(e.id)}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tP(e.status)),children:e.status||"event"})]}),(0,n.jsxs)("div",{className:"mt-1 flex flex-wrap gap-2 font-mono text-[10px] text-zinc-500",children:[(0,n.jsx)("span",{children:e.process||"-"}),(0,n.jsx)("span",{children:e.source_room_id?"room:".concat(e.source_room_id):A("未知来源","unknown source")}),(0,n.jsx)("span",{children:tR(e.duration_seconds)}),(0,n.jsx)("span",{children:null!=e.last_viewer_count?"".concat(e.last_viewer_count," online"):""})]})]},e.id)),nj.length||nN.length?null:(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:A("暂无事件;开始直播或打开 Neko 中的 YouTube Studio 后会自动生成。","No events yet. Start a relay or open YouTube Studio in Neko.")})]})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-400",children:A("最近事件","Recent events")}),(0,n.jsx)("div",{className:"mt-3 divide-y divide-white/[0.06]",children:nN.slice(0,8).map(e=>{var t;return(0,n.jsxs)("button",{type:"button",onClick:()=>void s1(e.id),className:"flex w-full items-center justify-between gap-3 py-2 text-left",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"truncate text-xs font-medium text-zinc-200",children:e.source_title||e.source_room_id||e.channel_name||e.process||"#".concat(e.id)}),(0,n.jsxs)("p",{className:"mt-0.5 font-mono text-[10px] text-zinc-600",children:[tL(e.started_at)," \xb7 ",tR(e.duration_seconds)]})]}),(0,n.jsxs)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tP(e.status)),children:[null!==(t=e.quality_score)&&void 0!==t?t:0,"/100"]})]},e.id)})})]})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-200/90",children:A("事件详情页","Event detail")}),eX?(0,n.jsx)("button",{type:"button",onClick:()=>eQ(null),className:"text-[11px] text-zinc-500 hover:text-zinc-300",children:A("收起","Close")}):null]}),eX?(0,n.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("p",{className:"truncate text-sm font-semibold text-white",children:eX.source_title||eX.source_room_id||eX.process}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tP(eX.status)),children:eX.status})]}),(0,n.jsxs)("div",{className:"mt-2 grid gap-2 text-[11px] text-zinc-400 sm:grid-cols-2",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Process:"})," ",eX.process||"-"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Room:"})," ",eX.source_room_id||"-"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Started:"})," ",tL(eX.started_at)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Duration:"})," ",tR(eX.duration_seconds)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Viewers:"})," ",null!==(f=eX.last_viewer_count)&&void 0!==f?f:"-"," / peak ",null!==(v=eX.viewer_peak)&&void 0!==v?v:0]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Health:"})," ",eX.last_health||eX.last_live_status||"-"]})]}),(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[eX.source_url?(0,n.jsx)("a",{href:eX.source_url,target:"_blank",rel:"noreferrer",className:"rounded-lg bg-violet-500/15 px-2.5 py-1.5 text-[11px] text-violet-100 ring-1 ring-violet-500/25",children:A("打开源直播间","Open source")}):null,eX.last_page_url?(0,n.jsx)("a",{href:eX.last_page_url,target:"_blank",rel:"noreferrer",className:"rounded-lg bg-cyan-500/15 px-2.5 py-1.5 text-[11px] text-cyan-100 ring-1 ring-cyan-500/25",children:A("打开 Studio 页面","Open Studio page")}):null]})]}),(eX.alerts||nk).slice(0,4).length?(0,n.jsxs)("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/[0.06] p-3",children:[(0,n.jsxs)("h5",{className:"flex items-center gap-2 text-xs font-semibold text-amber-100",children:[(0,n.jsx)(eg.Z,{className:"h-3.5 w-3.5"}),A("弹窗 / 告警","Popups / alerts")]}),(0,n.jsx)("div",{className:"mt-2 space-y-1",children:(eX.alerts||nk).slice(0,4).map((e,t)=>(0,n.jsxs)("p",{className:"text-[11px] text-amber-100/85",children:[e.title||e.severity||"alert",": ",e.message||"-"]},"".concat(e.id||t)))})]}):null,(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("h5",{className:"text-xs font-semibold text-zinc-300",children:A("采样时间线","Sample timeline")}),(0,n.jsxs)("div",{className:"mt-2 max-h-52 space-y-2 overflow-auto pr-1",children:[(eX.samples||[]).slice(0,12).map(e=>{var t;return(0,n.jsxs)("div",{className:"rounded-md border border-white/[0.05] bg-black/25 px-2 py-1.5",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 font-mono text-[10px] text-zinc-500",children:[(0,n.jsx)("span",{children:tL(e.ts)}),(0,n.jsx)("span",{children:e.source||"sample"})]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-300",children:[e.live_status||"-"," \xb7 ",e.health||"-"," \xb7 ",null!==(t=e.viewer_count)&&void 0!==t?t:"-"," online"]}),e.popup_text?(0,n.jsx)("p",{className:"mt-1 text-[10px] text-amber-100/80",children:e.popup_text}):null]},e.id)}),(eX.samples||[]).length?null:(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:A("暂无采样;Chrome 扩展或状态接口会自动写入。","No samples yet. The Chrome extension or status API will fill this.")})]})]})]}):(0,n.jsx)("p",{className:"mt-3 text-xs text-zinc-600",children:A("选择左侧事件查看完整详情。","Select an event to see details.")})]})]})]}),nC=[...nj,...nN.filter(e=>!nj.some(t=>t.id===e.id))].slice(0,12),nR=eX||nC[0]||null,nL=(null==nR?void 0:nR.samples)||[],nP=(null==nR?void 0:null===(r=nR.alerts)||void 0===r?void 0:r.length)?nR.alerts:nk,nM=[{label:A("正在直播","Live now"),value:String(null!==(j=n_.active_events)&&void 0!==j?j:nj.length),helper:A("当前仍在推流的场次","Events still pushing"),Icon:Y.Z,tone:"text-emerald-200"},{label:A("总场次","Total events"),value:String(null!==(N=n_.total_events)&&void 0!==N?N:nN.length),helper:A("本机数据库里的直播记录","Stored locally"),Icon:e1.Z,tone:"text-cyan-200"},{label:A("累计时长","Total duration"),value:tZ(n_.total_duration_seconds,A),helper:A("已结束场次累计","Ended events total"),Icon:e3.Z,tone:"text-violet-200"},{label:A("最高在线","Peak viewers"),value:tT(null!==(k=n_.viewer_peak)&&void 0!==k?k:0,A),helper:A("Chrome/Studio 采集峰值","Captured from Studio"),Icon:e2.Z,tone:"text-amber-200"}],nT=(0,n.jsxs)("section",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/90 p-6 ring-1 ring-cyan-500/10",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold text-white",children:[(0,n.jsx)(e5.Z,{className:"h-5 w-5 text-cyan-300"}),A("直播事件中枢","Live event center")]}),(0,n.jsx)("p",{className:"mt-1 max-w-3xl text-sm text-zinc-400",children:A("这里按运营视角展示:谁在播、转播哪个直播间、播了多久、观众多少、Studio 是否弹窗、有没有异常。机器编号只放在详情底部。","Built for operators: what is live, source room, duration, viewers, Studio popups, and issues. Technical ids stay in the detail footer.")})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>void s0(),className:"inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-200 hover:bg-white/[0.08]",children:[(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(e9?"animate-spin":"")}),A("刷新","Refresh")]})]}),(0,n.jsx)("div",{className:"mt-5 grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:nM.map(e=>{let{label:t,value:s,helper:l,Icon:i,tone:a}=e;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.035] p-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("p",{className:"text-xs text-zinc-500",children:t}),(0,n.jsx)(i,{className:"h-4 w-4 ".concat(a)})]}),(0,n.jsx)("p",{className:"mt-2 text-2xl font-semibold tracking-tight text-white",children:s}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-600",children:l})]},t)})}),(0,n.jsxs)("div",{className:"mt-6 grid gap-5 xl:grid-cols-[minmax(0,1.1fr)_minmax(25rem,0.9fr)]",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-white/[0.06] px-4 py-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:nj.length?A("正在直播","Live now"):A("最近直播记录","Recent live events")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:nj.length?A("优先显示还在推流的场次。","Active relays are listed first."):A("当前没有正在直播的场次,下方是最近历史。","Nothing is live now; showing recent history.")})]}),(0,n.jsxs)("span",{className:"rounded-full bg-cyan-500/10 px-2.5 py-1 text-xs text-cyan-100 ring-1 ring-cyan-500/20",children:[nC.length," ",A("条记录","records")]})]}),(0,n.jsxs)("div",{className:"divide-y divide-white/[0.06]",children:[nC.map(e=>{var t;let s=(null==nR?void 0:nR.id)===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>void s1(e.id),className:"grid w-full gap-3 px-4 py-4 text-left transition md:grid-cols-[minmax(0,1fr)_8rem_7rem_7rem] ".concat(s?"bg-cyan-500/[0.08]":"hover:bg-white/[0.04]"),children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(tP(e.status)),children:tM(e.status,A)}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(tD(e)),children:tA(e,A)})]}),(0,n.jsx)("p",{className:"mt-2 truncate text-sm font-semibold text-white",children:tE(e,A)}),(0,n.jsxs)("p",{className:"mt-1 truncate text-xs text-zinc-500",children:[tU(e,A)," ","->"," YouTube"]})]}),(0,n.jsxs)("div",{className:"self-center",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:A("开始","Started")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-300",children:tI(e.started_at)})]}),(0,n.jsxs)("div",{className:"self-center",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:A("时长","Duration")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-300",children:tZ(e.duration_seconds,A)})]}),(0,n.jsxs)("div",{className:"self-center",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:A("在线/峰值","Viewers")}),(0,n.jsxs)("p",{className:"mt-1 text-xs text-zinc-300",children:[tT(e.last_viewer_count,A)," / ",tT(null!==(t=e.viewer_peak)&&void 0!==t?t:0,A)]})]})]},e.id)}),nC.length?null:(0,n.jsxs)("div",{className:"px-4 py-10 text-center",children:[(0,n.jsx)(c.Z,{className:"mx-auto h-8 w-8 text-zinc-700"}),(0,n.jsx)("p",{className:"mt-3 text-sm font-medium text-zinc-300",children:A("还没有直播记录","No live events yet")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-600",children:A("启动转播或在 Neko 打开 YouTube Studio 后,这里会自动生成可追溯记录。","Start a relay or open YouTube Studio in Neko to create traceable records.")})]})]})]}),(0,n.jsx)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:nR?(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("div",{children:(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"text-xs text-cyan-300",children:A("这场直播","Selected event")}),(0,n.jsx)("h4",{className:"mt-1 truncate text-lg font-semibold text-white",children:tE(nR,A)}),(0,n.jsxs)("p",{className:"mt-1 text-sm text-zinc-500",children:[tU(nR,A)," ","->"," YouTube"]})]}),(0,n.jsx)("span",{className:"rounded-full px-2.5 py-1 text-xs ring-1 ".concat(tP(nR.status)),children:tM(nR.status,A)})]})}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:A("直播时长","Duration")}),(0,n.jsx)("p",{className:"mt-1 text-lg font-semibold text-white",children:tZ(nR.duration_seconds,A)}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:tL(nR.started_at)})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:A("观众","Viewers")}),(0,n.jsxs)("p",{className:"mt-1 text-lg font-semibold text-white",children:[tT(nR.last_viewer_count,A),(0,n.jsxs)("span",{className:"ml-2 text-xs font-normal text-zinc-500",children:[A("峰值","peak")," ",tT(null!==(_=nR.viewer_peak)&&void 0!==_?_:0,A)]})]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:A("来自 Chrome 插件/Studio 页面采集","Captured from Studio")})]})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("h5",{className:"text-sm font-semibold text-white",children:A("Studio 状态","Studio status")}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(tD(nR)),children:tA(nR,A)})]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2 text-sm text-zinc-300",children:[(0,n.jsx)("p",{children:nR.last_live_status||nR.last_health||A("暂未采集到 Studio 状态","No Studio status captured yet")}),nR.last_popup_text?(0,n.jsx)("p",{className:"rounded-md border border-amber-500/20 bg-amber-500/[0.08] px-3 py-2 text-xs text-amber-100",children:nR.last_popup_text}):(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:A("没有记录到弹窗。","No popup recorded.")}),nR.last_page_title||nR.last_page_url?(0,n.jsx)("p",{className:"truncate text-xs text-zinc-500",children:nR.last_page_title||nR.last_page_url}):null]}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[nR.source_url?(0,n.jsxs)("a",{href:nR.source_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-lg bg-violet-500/15 px-2.5 py-1.5 text-xs text-violet-100 ring-1 ring-violet-500/25",children:[A("打开源直播间","Open source")," ",(0,n.jsx)(K.Z,{className:"h-3 w-3"})]}):null,nR.last_page_url?(0,n.jsxs)("a",{href:nR.last_page_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-lg bg-cyan-500/15 px-2.5 py-1.5 text-xs text-cyan-100 ring-1 ring-cyan-500/25",children:[A("打开 Studio","Open Studio")," ",(0,n.jsx)(K.Z,{className:"h-3 w-3"})]}):null]})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("h5",{className:"text-sm font-semibold text-white",children:A("采样时间线","Telemetry timeline")}),(0,n.jsxs)("div",{className:"mt-3 max-h-64 space-y-2 overflow-auto pr-1",children:[nL.slice(0,10).map(e=>(0,n.jsxs)("div",{className:"rounded-md border border-white/[0.05] bg-black/25 px-3 py-2",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[(0,n.jsx)("span",{className:"text-zinc-400",children:tI(e.ts)}),(0,n.jsx)("span",{className:"text-zinc-600",children:e.source||A("采样","sample")})]}),(0,n.jsxs)("p",{className:"mt-1 text-sm text-zinc-200",children:[e.live_status||e.health||A("状态未识别","Unknown status"),(0,n.jsxs)("span",{className:"ml-2 text-xs text-zinc-500",children:[A("在线","online")," ",tT(e.viewer_count,A)]})]}),e.popup_text?(0,n.jsx)("p",{className:"mt-1 text-xs text-amber-100",children:e.popup_text}):null]},e.id)),nL.length?null:(0,n.jsx)("p",{className:"rounded-md border border-white/[0.05] bg-black/20 px-3 py-3 text-xs text-zinc-500",children:eX?A("这场直播暂时没有采样明细。","No telemetry samples for this event yet."):A("点击左侧记录后加载完整采样明细。","Click a record on the left to load full telemetry samples.")})]})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsxs)("h5",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(eg.Z,{className:"h-4 w-4 text-amber-300"}),A("告警和弹窗","Alerts and popups")]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2",children:[nP.slice(0,4).map((e,t)=>(0,n.jsxs)("p",{className:"rounded-md border border-amber-500/15 bg-amber-500/[0.06] px-3 py-2 text-xs text-amber-100",children:[e.title||e.severity||A("提示","Notice"),": ",e.message||"-"]},"".concat(e.id||t))),nP.length?null:(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:A("没有告警。","No alerts.")})]})]}),(0,n.jsxs)("p",{className:"truncate text-[11px] text-zinc-700",children:[A("技术标识","Technical id"),": #",nR.id," \xb7 ",nR.process||"-"," \xb7 ",nR.event_uuid||"-"]})]}):(0,n.jsxs)("div",{className:"flex min-h-[24rem] flex-col items-center justify-center text-center",children:[(0,n.jsx)(e5.Z,{className:"h-10 w-10 text-zinc-700"}),(0,n.jsx)("p",{className:"mt-3 text-sm font-medium text-zinc-300",children:A("等待第一场直播","Waiting for the first live event")}),(0,n.jsx)("p",{className:"mt-1 max-w-sm text-xs text-zinc-600",children:A("开始转播后,这里会变成这场直播的详情页。","After a relay starts, this panel becomes the event detail page.")})]})})]})]}),nE=(null==te?void 0:te.summary)||{},nU=(null==te?void 0:te.lanes)||[],nZ=(null==te?void 0:te.recommendations)||[],nI=(0,n.jsxs)("section",{className:"rounded-2xl border border-emerald-500/20 bg-gradient-to-br from-emerald-500/[0.08] via-zinc-950/90 to-cyan-500/[0.06] p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold text-white",children:[(0,n.jsx)(a.Z,{className:"h-5 w-5 text-emerald-300"}),A("算法友好质量守护","Algorithm-friendly quality guard")]}),(0,n.jsx)("p",{className:"mt-1 max-w-3xl text-sm text-zinc-400",children:A("目标不是刷数据,而是让直播信号长期稳定:不断流、不卡顿、Studio 状态可见、异常能追踪。","The goal is stable, policy-safe signal quality: no drops, no stalls, visible Studio state, and traceable issues.")})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>void s3(),className:"inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-200 hover:bg-white/[0.08]",children:[(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(ta?"animate-spin":"")}),A("重新检测","Check now")]})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-3 md:grid-cols-[12rem_minmax(0,1fr)]",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/30 p-4",children:[(0,n.jsx)("p",{className:"text-xs text-zinc-500",children:A("综合分","Score")}),(0,n.jsx)("p",{className:"mt-2 text-5xl font-semibold tracking-tight ".concat(tO(null==te?void 0:te.score)),children:null!==(z=null==te?void 0:te.score)&&void 0!==z?z:0}),(0,n.jsx)("p",{className:"mt-2 text-[11px] text-zinc-600",children:A("80 以上适合长时间无人值守","80+ is suitable for long unattended runs")})]}),(0,n.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[[A("推流线路","Lanes"),"".concat(null!==(C=nE.pushing_lanes)&&void 0!==C?C:0,"/").concat(null!==(R=nE.lanes)&&void 0!==R?R:0)],[A("活动事件","Active events"),String(null!==(L=nE.active_events)&&void 0!==L?L:0)],[A("Studio 采样","Studio samples"),String(null!==(P=nE.sample_count)&&void 0!==P?P:0)],[A("最高在线","Viewer peak"),tT(null!==(M=nE.viewer_peak)&&void 0!==M?M:0,A)]].map(e=>{let[t,s]=e;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("p",{className:"text-xs text-zinc-500",children:t}),(0,n.jsx)("p",{className:"mt-2 text-2xl font-semibold text-white",children:s})]},t)})})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(20rem,0.8fr)]",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25",children:[(0,n.jsxs)("div",{className:"border-b border-white/[0.06] px-4 py-3",children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:A("线路质量","Lane quality")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:A("从进程、FFmpeg 日志、配置和事件采样综合判断。","Combined from process state, FFmpeg logs, config, and event telemetry.")})]}),(0,n.jsxs)("div",{className:"divide-y divide-white/[0.06]",children:[nU.map(e=>{var t,s,l,i,a,r,o,c,d;let x=(e.source_display||e.source_title||"").trim()||e.label||e.process||"-",u=[e.label,e.process].filter(Boolean).join(" \xb7 ");return(0,n.jsxs)("div",{className:"grid gap-3 px-4 py-4 md:grid-cols-[minmax(0,1fr)_6rem_14rem]",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("p",{className:"truncate text-sm font-semibold text-white",children:x}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(e.is_pushing?"bg-emerald-500/15 text-emerald-100 ring-emerald-500/25":"bg-zinc-600/20 text-zinc-300 ring-zinc-500/25"),children:e.is_pushing?A("推流中","Pushing"):A("未推流","Idle")}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(e.rtmps?"bg-cyan-500/15 text-cyan-100 ring-cyan-500/25":"bg-amber-500/15 text-amber-100 ring-amber-500/25"),children:e.rtmps?"RTMPS":A("非 RTMPS","No RTMPS")})]}),(0,n.jsx)("p",{className:"mt-1 truncate text-xs text-zinc-600",children:u||"-"}),(0,n.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:(e.issues||[]).slice(0,3).map((e,t)=>(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tB(e.level)),children:e.text||e.level},"".concat(e.text||t)))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:A("分数","Score")}),(0,n.jsx)("p",{className:"mt-1 text-2xl font-semibold ".concat(tO(e.score)),children:null!==(r=e.score)&&void 0!==r?r:0})]}),(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-2 font-mono text-[11px] text-zinc-300",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"fps"}),tW(null===(t=e.metrics)||void 0===t?void 0:t.fps)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"speed"}),tW(null===(s=e.metrics)||void 0===s?void 0:s.speed,"x")]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"kbps"}),tW(null===(l=e.metrics)||void 0===l?void 0:l.bitrate)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"drop"}),null!==(o=null===(i=e.metrics)||void 0===i?void 0:i.drop)&&void 0!==o?o:"-"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"urls"}),null!==(c=e.url_count)&&void 0!==c?c:0]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"err"}),null!==(d=null===(a=e.metrics)||void 0===a?void 0:a.error_count)&&void 0!==d?d:0]})]})]},e.process||e.label)}),nU.length?null:(0,n.jsx)("div",{className:"px-4 py-8 text-center text-sm text-zinc-500",children:A("没有发现 YouTube 线路。","No YouTube lanes found.")})]})]}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:A("下一步建议","Next actions")}),(0,n.jsxs)("div",{className:"mt-3 space-y-2",children:[nZ.slice(0,6).map((e,t)=>(0,n.jsx)("p",{className:"rounded-lg px-3 py-2 text-xs ring-1 ".concat(tB(e.level)),children:e.text||"-"},"".concat(e.text||t))),nZ.length?null:(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:A("暂无建议。","No recommendations.")})]})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:"FFmpeg"}),(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-400",children:(null==te?void 0:null===(o=te.ffmpeg_profile)||void 0===o?void 0:o.target)||"1080p30 / RTMPS / AAC / stable relay"}),(0,n.jsx)("ul",{className:"mt-3 space-y-1.5 text-xs text-zinc-500",children:((null==te?void 0:null===(d=te.ffmpeg_profile)||void 0===d?void 0:d.guardrails)||[]).slice(0,4).map(e=>(0,n.jsxs)("li",{children:["- ",e]},e))})]})]})]})]}),nA=(0,n.jsxs)("section",{className:"rounded-2xl border border-white/[0.08] bg-gradient-to-br from-zinc-950/95 via-zinc-950/80 to-violet-500/[0.06] p-5 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,n.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,n.jsxs)("div",{className:"relative mt-0.5 flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-black/40 ring-1 ring-white/10",children:[(0,n.jsx)(Y.Z,{className:"h-5 w-5 ".concat(ni?"text-emerald-300":"text-zinc-500")}),ni?(0,n.jsxs)("span",{className:"absolute -right-0.5 -top-0.5 flex h-3 w-3",children:[(0,n.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-60"}),(0,n.jsx)("span",{className:"relative inline-flex h-3 w-3 rounded-full bg-emerald-400"})]}):null]}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:A("转播实况","Relay snapshot")}),(0,n.jsx)("span",{className:"rounded-full px-2.5 py-0.5 text-[11px] font-medium ring-1 ".concat(tC(sp)),children:tS(sp,A)}),ni?(0,n.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-2.5 py-0.5 text-[11px] text-emerald-100 ring-1 ring-emerald-500/25",children:A("正在推流","Pushing")}):null]}),(0,n.jsx)("p",{className:"mt-1 truncate text-sm text-zinc-300",children:no||A("未配置抖音直播源","No Douyin source configured")}),(0,n.jsxs)("p",{className:"mt-1 font-mono text-[11px] text-zinc-600",children:[B||"—","pro"===ei&&nm>0?" \xb7 ".concat(nm,"/").concat(er.length," ").concat(A("路推流中","lanes pushing")):""]})]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[nc?(0,n.jsxs)("a",{href:nc,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border border-violet-500/25 bg-violet-500/10 px-3 py-1.5 text-xs text-violet-100 ring-1 ring-violet-500/20 hover:bg-violet-500/15",children:[(0,n.jsx)(K.Z,{className:"h-3.5 w-3.5"}),A("打开源站","Open source")]}):null,sG.link?(0,n.jsxs)("a",{href:sq,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-3 py-1.5 text-xs text-emerald-100 ring-1 ring-emerald-500/20 hover:bg-emerald-500/15",children:[(0,n.jsx)(K.Z,{className:"h-3.5 w-3.5"}),A("Studio","Studio")]}):null,(0,n.jsxs)("button",{type:"button",onClick:()=>void(null==ee||ee()),className:"inline-flex items-center gap-1.5 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,n.jsx)(w.Z,{className:"h-3.5 w-3.5"}),A("刷新全局","Refresh")]})]})]}),(0,n.jsx)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-7",children:[{label:A("FFmpeg 速度","FFmpeg speed"),value:nh?"".concat(nh,"x"):"—",warn:null==sp?void 0:sp.ffmpeg_speed_low,helper:nb||A("等待进程上报","Waiting for metrics")},{label:A("编码帧","Encoded frame"),value:null!=np?np:"—",warn:null==sp?void 0:sp.ffmpeg_progress_stalled,helper:(null==sp?void 0:sp.ffmpeg_active)?A("Worker 活跃","Worker active"):A("无活跃 Worker","No active worker")},{label:A("码率","Bitrate"),value:null!=ng?ng:"—",warn:!1,helper:(null==nx?void 0:nx.fps)!=null?"".concat(nx.fps," fps"):A("质量守护采样","Quality guard")},{label:A("质量分","Quality score"),value:null!=nu?String(nu):"—",warn:null!=nu&&nu<55,helper:A("当前线路综合评估","Current lane score")},{label:A("活动场次","Active events"),value:String(s5),warn:!1,helper:A("本地事件库","Local event store")},{label:A("抖音地址","Douyin URLs"),value:String(sF),warn:0===sF,helper:"".concat(sH," ").concat(A("条有效地址","valid URLs"))},{label:A("密钥尾码","Key suffix"),value:sA,warn:!sI,helper:nv}].map(e=>{let{label:t,value:s,warn:l,helper:i}=e;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-3 min-w-0",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:t}),(0,n.jsx)("p",{className:"mt-1 text-xl font-semibold tracking-tight ".concat(l?"text-amber-200":"text-white"),children:s}),(0,n.jsx)("p",{className:"mt-1 text-[10px] text-zinc-600",children:i})]},t)})}),na&&ni?(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-3 rounded-xl border border-cyan-500/20 bg-cyan-500/[0.06] px-4 py-3 text-xs",children:[(0,n.jsx)("span",{className:"font-medium text-cyan-100",children:A("本场直播","This event")}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 ring-1 ".concat(tP(na.status)),children:tM(na.status,A)}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 ring-1 ".concat(tD(na)),children:tA(na,A)}),(0,n.jsxs)("span",{className:"text-zinc-400",children:[A("观众","Viewers")," ",tT(na.last_viewer_count,A)," \xb7 ",tZ(na.duration_seconds,A)]}),na.last_popup_text?(0,n.jsxs)("span",{className:"text-amber-200",children:[A("弹窗","Popup"),": ",na.last_popup_text]}):null]}):null]});return(0,n.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6",children:[Q?(0,n.jsx)(ep,{t:A,title:A("YouTube 转播链路","YouTube relay chain"),subtitle:A("与「网络」页相同风格的链路示意:代理 → 编码推流 → 浏览器侧操作工作室。","Same visual language as Network: proxy → encode → browser studio."),onNavigate:Q,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:sG.link?"".concat(A("Chromium 工作室","Chromium studio")," \xb7 ").concat(sG.link.label):A("Chromium 工作室","Chromium studio"),gradient:"from-emerald-400 to-teal-500",openUrl:sq}]}):null,(0,n.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,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.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,n.jsx)(c.Z,{className:"h-5 w-5 text-red-200"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg font-semibold tracking-tight text-white",children:A("YouTube 无人直播","YouTube unmanned live")}),(0,n.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,n.jsxs)("div",{className:"ml-auto flex shrink-0 self-start rounded-xl border border-white/10 bg-black/30 p-1 ".concat(""),"aria-hidden":!1,children:[(0,n.jsx)("button",{type:"button",onClick:()=>sR("single"),className:"rounded-lg px-4 py-2 text-xs font-medium transition ".concat("single"===ei?"bg-violet-500/25 text-white":"text-zinc-500 hover:text-zinc-300"),children:A("单频道","Single")}),(0,n.jsx)("button",{type:"button",onClick:()=>sR("pro"),className:"rounded-lg px-4 py-2 text-xs font-medium transition ".concat("pro"===ei?"bg-violet-500/25 text-white":"text-zinc-500 hover:text-zinc-300"),children:A("多频道 Pro","Multi Pro")})]})]})}),nA,sJ.length?(0,n.jsxs)("div",{className:"space-y-2",children:[tJ?(0,n.jsx)("p",{className:"text-xs text-zinc-400",children:tJ}):null,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[sG.link?(0,n.jsx)("a",{href:sq,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,sY.length?(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:sY.map(e=>ny(e))}):null,(null==et?void 0:et.chromium_remote_debug)?(0,n.jsx)("a",{href:(0,eh.p)(et.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==et?void 0:et.srs_api)?(0,n.jsx)("a",{href:(0,eh.p)(et.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,n.jsxs)("div",{className:"rounded-2xl border border-amber-500/20 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-amber-200/90",children:[(0,n.jsx)(Y.Z,{className:"h-4 w-4"}),(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:A("直播开关","Live control")})]}),"single"===ei?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:A("转播任务","Relay task")}),(0,n.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:B,onChange:e=>{let t=e.target.value;t5.current=t,W(t),sS(t)},children:[B&&!en.some(e=>e.pm2===B)?(0,n.jsxs)("option",{value:B,children:[sx?"".concat(sx.name||sx.id," (").concat(B,")"):B,sh?" (".concat(tS(sh,A),")"):""]}):null,en.map(e=>(0,n.jsxs)("option",{value:e.pm2,children:[function(e,t){let s=tg(e.script).toLowerCase();return s.startsWith("douyin_youtube")?t("抖音→YouTube","Douyin → YouTube"):s.startsWith("youtube")?t("YouTube","YouTube"):e.label}(e,A)," (",e.pm2,")"]},e.pm2))]}),(0,n.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[(0,n.jsx)(tF,{kind:"start",targetPm2:B,busy:D,online:nn,label:A("开始直播","Start"),className:"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30",baseLock:!1,onRun:()=>q("start",B),notify:X,t:A}),(0,n.jsx)(tF,{kind:"stop",targetPm2:B,busy:D,online:nn,label:A("停止直播","Stop"),className:"bg-rose-500/15 text-rose-200 ring-rose-500/25",baseLock:!1,onRun:()=>q("stop",B),notify:X,t:A}),(0,n.jsx)(tF,{kind:"restart",targetPm2:B,busy:D,online:nn,label:A("重新开始","Restart"),className:"bg-amber-500/15 text-amber-200 ring-amber-500/25",baseLock:!1,onRun:()=>q("restart",B),notify:X,t:A})]}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap items-center justify-center gap-2 text-xs",children:[(0,n.jsx)("span",{className:"rounded-full px-2.5 py-0.5 font-medium ring-1 ".concat(tC(ne)),children:tS(ne,A)}),"number"==typeof(null==ne?void 0:ne.ffmpeg_speed)?(0,n.jsxs)("span",{className:"font-mono text-zinc-400 ".concat(ne.ffmpeg_speed_low?"text-amber-300":""),children:["speed ",ne.ffmpeg_speed.toFixed(2),"x"]}):null,"number"==typeof(null==ne?void 0:ne.ffmpeg_frame)?(0,n.jsxs)("span",{className:"font-mono text-zinc-400 ".concat(ne.ffmpeg_progress_stalled?"text-rose-300":""),children:["frame ",ne.ffmpeg_frame]}):null]})]}):(0,n.jsx)(n.Fragment,{children:(0,n.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,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-200/90",children:A("Pro 转播实况","Pro relay status")}),(0,n.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.")}),sV?(0,n.jsxs)("p",{className:"mt-2 text-[11px] text-zinc-500",children:[A("Neko 实例","Neko instances"),": ",sV]}):null,(0,n.jsx)("div",{className:"mt-3 max-h-[min(24rem,55vh)] space-y-2 overflow-y-auto pr-1",children:er.map(e=>{var t,s,l,i;let a=ti(e),r=su(a),o=sm(a),c=ec===e.id,d=c?eM:(null!==(t=e.urlLines)&&void 0!==t?t:"").trim(),x=c?null!==(l=null!==(s=null==sy?void 0:sy.streamKey)&&void 0!==s?s:e.streamKey)&&void 0!==l?l:"":null!==(i=e.streamKey)&&void 0!==i?i:"",u=tK(d),m=ej(d),h=t_(r,d),p=ew("key = ".concat(x)),g=tz(o),b=er.findIndex(t=>t.id===e.id),f=(0,e6.U_)(sY,b).link,v=tt(e.name,b>=0?b:0),y=tk(r,d),w="number"==typeof(null==r?void 0:r.ffmpeg_speed)?"speed ".concat(r.ffmpeg_speed.toFixed(2),"x"):"",j="number"==typeof(null==r?void 0:r.ffmpeg_frame)?"frame ".concat(r.ffmpeg_frame):"";return(0,n.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(c?"border-violet-500/45 bg-violet-500/[0.1]":"border-white/10 bg-black/30 hover:border-white/18"),children:[(0,n.jsxs)("button",{type:"button",className:"min-w-0 flex-1 text-left",onClick:()=>{t5.current=ti(e),sL(e)},children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"font-medium text-zinc-100",children:y||A("未配置抖音直播源","No Douyin source")}),(0,n.jsx)("span",{className:"shrink-0 rounded-md px-2 py-0.5 text-[10px] font-medium ring-1 ".concat(tC(r)),children:tS(r,A)}),f?(0,n.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:[f.label," \xb7 ",f.accessLabel]}):null]}),(0,n.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,n.jsxs)("span",{title:v,children:[A("线路","Lane")," ",v]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["key …",p||"—"]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsx)("span",{className:"truncate",title:a,children:a}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["URL ",u.length]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["DY ",m.length]}),w?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsx)("span",{className:(null==r?void 0:r.ffmpeg_speed_low)?"text-amber-300":"text-zinc-500",children:w})]}):null,j?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsx)("span",{className:(null==r?void 0:r.ffmpeg_progress_stalled)?"text-rose-300":"text-zinc-500",children:j})]}):null]}),h?(0,n.jsx)("a",{href:h,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:h,children:y?"".concat(A("打开源站","Open source")," \xb7 ").concat(h.replace(/^https?:\/\//,"")):h.replace(/^https?:\/\//,"")}):(0,n.jsx)("span",{className:"mt-1 block text-zinc-600",children:"—"})]}),(0,n.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,n.jsx)(tF,{kind:"start",targetPm2:a,busy:D,online:g,label:A("开始","Start"),className:"rounded-lg bg-emerald-500/20 text-emerald-100 ring-emerald-500/30",baseLock:!1,onRun:()=>void sQ("start",a),notify:X,t:A,compact:!0}),(0,n.jsx)(tF,{kind:"stop",targetPm2:a,busy:D,online:g,label:A("停止","Stop"),className:"rounded-lg bg-rose-500/15 text-rose-100 ring-rose-500/25",baseLock:!1,onRun:()=>void sQ("stop",a),notify:X,t:A,compact:!0}),(0,n.jsx)(tF,{kind:"restart",targetPm2:a,busy:D,online:g,label:A("重新开始","Restart"),className:"rounded-lg bg-amber-500/15 text-amber-100 ring-amber-500/25",baseLock:!1,onRun:()=>void sQ("restart",a),notify:X,t:A,compact:!0}),f?(0,n.jsxs)("button",{type:"button",onClick:()=>{window.open((0,eh.p)(f.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(f.label).concat(f.port?" :".concat(f.port):""),"aria-label":"".concat(A("打开该线路 Neko 工作室","Open this lane's Neko studio")," \xb7 ").concat(f.label),children:[(0,n.jsx)("span",{className:"sr-only",children:A("打开该线路 Neko 工作室","Open this lane's Neko studio")}),(0,n.jsx)("span",{"aria-hidden":!0,className:"text-sm leading-none",children:"\uD83D\uDC31"}),(0,n.jsx)(K.Z,{className:"ml-1 h-3.5 w-3.5 shrink-0","aria-hidden":!0})]}):null]})]},e.id)})})]})})]}),(0,n.jsx)(eP,{t:A,currentProc:B,fetchJson:J,urlListText:nr,keySuffixUi:sI,showKeyRow:!0,pollMs:ns,refreshToken:eq,monitorRow:null!=sp?sp:void 0}),nI,nT||nS,(0,n.jsxs)("section",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 ring-1 ring-white/[0.03]",children:[(0,n.jsxs)("div",{className:"border-b border-white/[0.06] px-6 py-4",children:[(0,n.jsxs)("h3",{className:"text-sm font-semibold text-white",children:[A("配置与地址","Config and URLs"),nf?(0,n.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("待完善","Needs setup")}):null]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:A("密钥、youtube.ini、URL 列表","Keys, youtube.ini, URL list")})]}),(0,n.jsxs)("div",{className:"space-y-6 p-6 pt-4",children:["single"===ei?(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:A("YouTube 相关设置","YouTube settings")}),(0,n.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,n.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,n.jsx)("label",{className:"block text-xs text-zinc-400",children:A("串流密钥","Stream key")}),(0,n.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:ef.key,onChange:e=>eN(t=>({...t,key:e.target.value})),placeholder:"xxxx-xxxx-xxxx-xxxx-xxxx"}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,n.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-zinc-400",children:["RTMPS",(0,n.jsxs)("select",{className:"rounded-lg border border-white/10 bg-black/40 px-3 py-2 text-sm text-white",value:ef.rtmps?"1":"0",onChange:e=>eN(t=>({...t,rtmps:"1"===e.target.value})),children:[(0,n.jsx)("option",{value:"1",children:A("是(默认)","Yes")}),(0,n.jsx)("option",{value:"0",children:A("否 → RTMP","No")})]})]}),(0,n.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-zinc-400",children:[A("比特率 kbps","Bitrate kbps"),(0,n.jsx)("input",{className:"rounded-lg border border-white/10 bg-black/40 px-3 py-2 font-mono text-sm",value:ef.bitrate,onChange:e=>eN(t=>({...t,bitrate:e.target.value})),placeholder:"4000"})]}),(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 pt-6 text-xs text-zinc-300",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:ef.fastAudio,onChange:e=>eN(t=>({...t,fastAudio:e.target.checked}))}),"fast_audio(",A("轻量音频","lighter audio"),")"]})]})]}),(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{type:"button",disabled:s8,onClick:()=>void sP(),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,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(ez?"animate-spin":"")}),A("重新读取","Reload")]}),(0,n.jsxs)("button",{type:"button",disabled:s8,onClick:()=>void sU(),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:[ez?(0,n.jsx)(y.Z,{className:"h-4 w-4 animate-spin"}):null,A("保存 youtube.ini","Save youtube.ini")]}),(0,n.jsx)("button",{type:"button",disabled:s8,onClick:()=>void sZ(),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,n.jsx)("button",{type:"button",disabled:s8,onClick:()=>{eN(eS(em)),e_(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,n.jsxs)("details",{className:"mt-4 rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,n.jsx)("summary",{className:"cursor-pointer text-xs text-zinc-500",children:A("高级:youtube.ini 原文","Raw youtube.ini")}),(0,n.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:em,onChange:e=>eb(e.target.value),spellCheck:!1}),(0,n.jsx)("button",{type:"button",disabled:s8,className:"mt-2 rounded-lg bg-cyan-500/15 px-3 py-1.5 text-xs text-cyan-200",onClick:()=>void sE(em),children:A("保存原文","Save raw")})]}),ek?(0,n.jsx)("p",{className:"mt-2 font-mono text-xs text-zinc-500",children:ek}):null]}):(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"text-sm font-semibold text-white",children:[A("当前线路","Current lane"),sd?(0,n.jsxs)("span",{className:"ml-2 font-normal text-zinc-400",children:["\xb7 ",nl||A("未配置抖音直播源","No Douyin source")]}):null,sz?(0,n.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]}),sd?(0,n.jsxs)("p",{className:"mt-0.5 font-mono text-[11px] text-zinc-500",children:[A("配置名","Config"),": ",tt(sd.name,Math.max(0,er.findIndex(e=>e.id===sd.id)))," \xb7 PM2: ",sj,sk?" → ".concat(sN):""," \xb7 ","key ",A("尾码","suffix"),": ",sA]}):null]}),(0,n.jsxs)("button",{type:"button",disabled:s9,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=tu(),t={id:e,name:"".concat(A("线路","Ch")," ").concat(er.length+1),streamKey:"",urlLines:"",pm2Name:tm(e),notes:""};eK(s=>({...s,[e]:tw(t)})),sv([...er,t],{force:!0}),ed(e),t5.current=ti(t),W(t5.current),se(""),t2.current+=1,t3.current+=1,tX.current=!1,eb(""),eN(eS("")),eB(A("新线路已切换,地址列表为空","New lane selected with an empty URL list"))},children:[(0,n.jsx)(e4.Z,{className:"h-3.5 w-3.5"}),A("新增线路","Add lane")]})]}),sd?(0,n.jsxs)("div",{className:"mt-4 space-y-3 border-t border-white/5 pt-4",children:[(0,n.jsx)("input",{className:"w-full rounded-xl border border-white/10 bg-black/40 px-3 py-2 text-sm",value:null!==(T=null==sy?void 0:sy.name)&&void 0!==T?T:"",onChange:e=>sw("name",e.target.value),placeholder:A("线路名称","Lane name")}),(0,n.jsx)("label",{className:"block text-xs text-zinc-500",children:A("串流密钥","Stream key")}),(0,n.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!==(E=null==sy?void 0:sy.streamKey)&&void 0!==E?E:"",onChange:e=>sw("streamKey",e.target.value),placeholder:"xxxx-xxxx… / rtmp(s)://…"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:s9,onClick:()=>void sT(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-100",children:eH?A("保存中...","Saving..."):A("保存线路设置","Save lane")}),(0,n.jsx)("button",{type:"button",disabled:s9,onClick:()=>void sW(),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")})]}),s_.ok?null:(0,n.jsx)("p",{className:"text-xs text-rose-300",children:s_.message}),(0,n.jsxs)("details",{className:"rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,n.jsx)("summary",{className:"cursor-pointer text-xs text-zinc-500",children:A("高级:进程名","Advanced: process name")}),(0,n.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!==(U=null==sy?void 0:sy.pm2Name)&&void 0!==U?U:tm(sd.id),onChange:e=>sw("pm2Name",e.target.value),spellCheck:!1,placeholder:"youtube2__…"}),(0,n.jsxs)("p",{className:"mt-2 font-mono text-[11px] text-zinc-500",children:[A("实际生效","Effective"),": ",sN||"—"]}),s_.message&&!s_.ok?(0,n.jsx)("p",{className:"mt-2 text-[11px] text-rose-300",children:s_.message}):null]}),(0,n.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!==(I=null==sy?void 0:sy.notes)&&void 0!==I?I:"",onChange:e=>sw("notes",e.target.value),placeholder:A("备注(可选)","Notes (optional)")}),eY?(0,n.jsx)("p",{className:"text-xs text-zinc-400",children:eY}):null,(0,n.jsxs)("button",{type:"button",disabled:s8||er.length<2,className:"inline-flex items-center gap-1 text-xs text-rose-300 hover:text-rose-200 disabled:opacity-30",onClick:()=>{var e,t;let s=er.filter(e=>e.id!==sd.id),n=null!==(e=s[0])&&void 0!==e?e:null;if(eK(e=>{let t={...e};return delete t[sd.id],t}),sv(s,{force:!0}),ed((null==n?void 0:n.id)||""),n){let e=ti(n);t5.current=e,W(e),se((null!==(t=n.urlLines)&&void 0!==t?t:"").trim()),sC(n)}else t5.current="",W(""),se("")},children:[(0,n.jsx)(S.Z,{className:"h-3.5 w-3.5"}),A("删除此线路","Delete lane")]})]}):null]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:A("直播地址列表","URL list")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:A("每条线路独立写入自己的 URL_config..ini,不再复用或回填所谓“全局地址”。","Each lane writes to its own URL_config..ini with no shared global URL draft.")}),(0,n.jsx)("p",{className:"mt-1 font-mono text-[10px] text-zinc-600",children:B?eC(B):"URL_config.ini"}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px]",children:[(0,n.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"),": ",sH]}),(0,n.jsxs)("span",{className:"rounded-full border border-violet-500/20 bg-violet-500/10 px-2.5 py-1 text-violet-100",children:["Douyin: ",sF]})]}),nw,eO?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:eO}):null,(0,n.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:eM,onChange:e=>{tX.current=!0,se(e.target.value)},spellCheck:!1,placeholder:"https://live.douyin.com/..."}),(0,n.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:(0,n.jsx)("button",{type:"button",disabled:eH,title:s7||void 0,onClick:()=>void sD(),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"===ei?(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:A("直播地址列表 \xb7 URL_config.ini","URL_config.ini")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:A("一行一个地址;可自动刷新或手动重新读取。","One URL per line; auto-refresh or reload.")}),(0,n.jsx)("p",{className:"mt-1 font-mono text-[10px] text-zinc-600",children:B?eC(B):"URL_config.ini"}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px]",children:[(0,n.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"),": ",sH]}),(0,n.jsxs)("span",{className:"rounded-full border border-violet-500/20 bg-violet-500/10 px-2.5 py-1 text-violet-100",children:["Douyin: ",sF]})]}),nw,eO?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:eO}):null,(0,n.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:ex,onChange:e=>{tX.current=!0,t7(e.target.value)},spellCheck:!1}),(0,n.jsx)("button",{type:"button",disabled:eH,title:s7||void 0,onClick:()=>void sO(),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]})]})]})}var tG=s(257);let tq=["dashboard","services","live_youtube","live_tiktok","android","studio","network","settings"],tV=()=>void 0!==tG&&tG.env.NEXT_PUBLIC_API_URL||"";function tJ(e){if(null==e||!Number.isFinite(e))return"—";if(0===e)return"0 B";let t=["B","KB","MB","GB","TB"],s=e,n=0;for(;s>=1024&&n=10||0===n?0:1)," ").concat(t[n])}function t$(e){if(null==e||!Number.isFinite(e))return"—";let t=Math.max(0,Math.floor(e));if(t<60)return"".concat(t,"s");let s=Math.floor(t/60);if(s<60)return"".concat(s,"m");let n=Math.floor(s/60);return n<48?"".concat(n,"h"):"".concat(Math.floor(n/24),"d")}function tX(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 tQ(e,t){let s=null!=t?t:(e,t)=>t||e,n=(e||"").trim().toLowerCase();return"connected"===n?s("高速可用","Ready"):"configured"===n?s("已配置","Configured"):"detected"===n?s("接口已起","Detected"):"idle"===n?s("等待握手","Idle"):"stale"===n?s("握手过期","Stale"):"down"===n?s("未连接","Down"):e||"—"}function t0(){var e,t,s,C,A,D,O,B,W,K,H,F,Y,G,q,V,$,X,Q,ee,et,es,en,el,ei,ea,er,eo,ec,ex,eu,em,ep,eg,eb,ef,ev,ew,ej,eN,ek,e_,ez,eS,eC,eR,eL,eP,eM,eT,eE,eU,eZ,eA,eD,eO,eB,eW,eK,eH,eF,eY,eG,eq,eV,eJ,e$;let eQ=tV(),[e0,e1]=(0,Z.useState)("zh"),[e5,e2]=(0,Z.useState)("dark"),[e3,e4]=(0,Z.useState)("dashboard"),[e8,e9]=(0,Z.useState)(!1),[e7,te]=(0,Z.useState)(!1),[tt,ts]=(0,Z.useState)(null),[tn,tl]=(0,Z.useState)(null),[ti,ta]=(0,Z.useState)(!0),[tr,to]=(0,Z.useState)(null),[tc,td]=(0,Z.useState)(null),[tx,tu]=(0,Z.useState)(null),[tm,th]=(0,Z.useState)(!0),[tp,tg]=(0,Z.useState)([]),[tb,tf]=(0,Z.useState)([]),[tv,ty]=(0,Z.useState)(""),[tw,tj]=(0,Z.useState)(""),[tN,tk]=(0,Z.useState)("/sdcard/app.apk"),[t_,tz]=(0,Z.useState)(""),[tS,tC]=(0,Z.useState)(null),[tR,tL]=(0,Z.useState)(null),[tP,tM]=(0,Z.useState)(!0),[tT,tE]=(0,Z.useState)(!0),[tU,tZ]=(0,Z.useState)("tencent-relay-wg0"),[tI,tA]=(0,Z.useState)(""),[tD,tO]=(0,Z.useState)(null),[tB,tW]=(0,Z.useState)(null),[tK,tH]=(0,Z.useState)(null),[tF,tG]=(0,Z.useState)(!1),[t0,t1]=(0,Z.useState)(!0),[t5,t2]=(0,Z.useState)("overlay"),[t3,t4]=(0,Z.useState)(""),[t6,t8]=(0,Z.useState)(""),[t9,t7]=(0,Z.useState)(""),[se,st]=(0,Z.useState)("255.255.255.255"),[ss,sn]=(0,Z.useState)("9"),[sl,si]=(0,Z.useState)([]),[sa,sr]=(0,Z.useState)(""),[so,sc]=(0,Z.useState)(""),[sd,sx]=(0,Z.useState)(""),[su,sm]=(0,Z.useState)([]),[sh,sp]=(0,Z.useState)(""),[sg,sb]=(0,Z.useState)("115200"),[sf,sv]=(0,Z.useState)("AT"),[sy,sw]=(0,Z.useState)(""),[sj,sN]=(0,Z.useState)(null),sk=(0,Z.useRef)(null),s_=(0,Z.useRef)(null),sz=(0,Z.useRef)(null),sS=(0,Z.useRef)(tv),sC=(0,Z.useRef)(0),sR=(0,Z.useRef)(null),sL=(0,Z.useCallback)((e,t)=>"zh"===e0?e:t,[e0]),sP=(0,Z.useCallback)(e=>{td(e),null!=sR.current&&window.clearTimeout(sR.current),sR.current=window.setTimeout(()=>{td(null),sR.current=null},2800)},[]),sM=(0,Z.useCallback)(async(e,t)=>(0,J.N)("".concat(eQ).concat(e),t),[eQ]),sT=(0,Z.useCallback)(async()=>{if(s_.current)return s_.current;let e=(async()=>{try{let e=await sM("/stack/summary");ts(t=>({...null!=t?t:{},stack:e})),tl(null),tu(Date.now())}catch(e){tl(e.message)}finally{s_.current=null}})();return s_.current=e,e},[sM]),sE=(0,Z.useCallback)(async()=>{if(sk.current)return sk.current;let e=(async()=>{try{var e;let[t,s]=await Promise.allSettled([sM("/hub/dashboard"),sM("/deploy/check")]);if("fulfilled"!==t.status)throw t.reason;let n=t.value;ts(n),tl(null),tu(Date.now()),"fulfilled"===s.status?tL(s.value):tL(null);let l=(null===(e=n.android)||void 0===e?void 0:e.devices)||[];if(l.length&&!t_){let e=l.find(e=>"device"===(e.state||"").toLowerCase());tz((null!=e?e:l[0]).serial)}}catch(e){tl(e.message),tL(null)}finally{ta(!1),sk.current=null}})();return sk.current=e,e},[t_,sM]),sU=(0,Z.useMemo)(()=>{let e=new URLSearchParams({light:"1"});return"live_youtube"===e3?e.set("family","youtube"):"live_tiktok"===e3&&e.set("family","tiktok"),"/process_monitor?".concat(e.toString())},[e3]),sZ=(0,Z.useMemo)(()=>ey(tb),[tb]),sI=(0,Z.useMemo)(()=>(function(e){if(!e.pageVisible)return 3e4;if("live_youtube"===e.view||"live_tiktok"===e.view)switch(e.activity){case"hot":return 800;case"warm":return 2500;default:return 5e3}return 4e3})({view:e3,activity:sZ,pageVisible:tm}),[e3,sZ,tm]),sA=(0,Z.useCallback)(async()=>{if(sz.current)return sz.current;let e=(async()=>{try{let e=(await sM(sU)).entries||[];tf(e),tg(e.map(e=>({pm2:e.pm2,script:e.script,label:e.label}))),tu(Date.now()),ty(t=>!e.length||t&&e.some(e=>e.pm2===t)?t:e[0].pm2)}catch(e){}finally{sz.current=null}})();return sz.current=e,e},[sM,sU]);(0,Z.useEffect)(()=>{e4(function(){let e=new URLSearchParams(window.location.search).get("view");return e&&tq.includes(e)?e:"/youtube-events"===window.location.pathname.replace(/\/$/,"")?"live_youtube":"dashboard"}()),e9(!0);let e=window.localStorage.getItem("live-hub-lang");("zh"===e||"en"===e)&&e1(e);let t=window.localStorage.getItem("live-hub-theme");("light"===t||"dark"===t)&&e2(t)},[]),(0,Z.useEffect)(()=>{if(!e8)return;let e=new URL(window.location.href);"dashboard"===e3?e.searchParams.delete("view"):e.searchParams.set("view",e3),window.history.replaceState(null,"",e.toString())},[e3,e8]),(0,Z.useEffect)(()=>{window.localStorage.setItem("live-hub-lang",e0)},[e0]),(0,Z.useEffect)(()=>{document.documentElement.setAttribute("data-theme",e5);try{window.localStorage.setItem("live-hub-theme",e5)}catch(e){}},[e5]),(0,Z.useEffect)(()=>{let e=()=>th("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,Z.useEffect)(()=>{if(!e7)return;let e=e=>{"Escape"===e.key&&te(!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}},[e7]),(0,Z.useEffect)(()=>()=>{null!=sR.current&&window.clearTimeout(sR.current)},[]),(0,Z.useEffect)(()=>{try{"0"===localStorage.getItem("livehub.autorefresh")&&tM(!1),"0"===localStorage.getItem("livehub.showStreamProbes")&&tE(!1)}catch(e){}},[]),(0,Z.useEffect)(()=>{if(e8){if("live_youtube"===e3||"live_tiktok"===e3){ta(!1),sT();return}sE()}},[sE,sT,e3,e8]),(0,Z.useEffect)(()=>{e8&&sA()},[sA,e8]),(0,Z.useEffect)(()=>{if(!e8||!tP||!tm||"live_youtube"===e3||"live_tiktok"===e3)return;let e=window.setInterval(()=>{sE()},1e4);return()=>clearInterval(e)},[tP,tm,sE,e3,e8]),(0,Z.useEffect)(()=>{if(!e8||!tP)return;let e=window.setInterval(()=>{sA()},sI);return()=>clearInterval(e)},[tP,sI,sA,e8]),(0,Z.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&sA()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[sA]),(0,Z.useEffect)(()=>{sS.current=tv},[tv]),(0,Z.useEffect)(()=>{"settings"===e3&&(async()=>{try{let e=await sM("/hub/config");tC(e)}catch(e){tC(null)}})()},[sM,e3]);let sD=(0,Z.useMemo)(()=>{var e;let t=(null==tt?void 0:null===(e=tt.stack)||void 0===e?void 0:e.quick_links)||{},s={};for(let[e,n]of Object.entries(t))/^https?:\/\//i.test(n)?s[e]=(0,eh.p)(n):s[e]=n;return s},[null==tt?void 0:null===(e=tt.stack)||void 0===e?void 0:e.quick_links]),sO=(0,Z.useMemo)(()=>{let e=new Map;for(let t of(null==tt?void 0:tt.services)||[])e.set(t.service_id,t);return e},[null==tt?void 0:tt.services]),sB=(0,Z.useMemo)(()=>["homeassistant","frigate","ntfy","wol"].map(e=>sO.get(e)).filter(Boolean),[sO]),sW=sO.get("wol"),sK=(0,Z.useMemo)(()=>(0,e6.O0)(sD),[sD]),sH=(0,Z.useMemo)(()=>(0,e6.Tc)(sK),[sK]),sF=(0,Z.useMemo)(()=>((null==tB?void 0:tB.interfaces)||[]).flatMap(e=>e.peers||[]),[null==tB?void 0:tB.interfaces]),sY=(0,Z.useMemo)(()=>((null==tB?void 0:tB.interfaces)||[]).flatMap(e=>e.configured_peers||[]),[null==tB?void 0:tB.interfaces]),sG=(0,Z.useMemo)(()=>((null==tB?void 0:tB.repo_configs)||[]).flatMap(e=>e.peers||[]).map(e=>({...e,status_source:"config",config_source:"repo"})),[null==tB?void 0:tB.repo_configs]),sq=sF[0]||sY[0]||sG[0]||null,sV=(0,Z.useMemo)(()=>{for(let e of[...sF,...sY,...sG]){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 s=t.lastIndexOf(":");return s>0?t.slice(0,s):t}(e.endpoint);if(t)return t}return""},[sY,sG,sF]),sJ=(null==tD?void 0:null===(t=tD.windows_route_template)||void 0===t?void 0:t.endpoint_host)||(null==tD?void 0:null===(C=tD.peers)||void 0===C?void 0:null===(s=C.find(e=>e.endpoint_host))||void 0===s?void 0:s.endpoint_host)||sV||"",s$=(0,Z.useMemo)(()=>{if(!sJ)return"";let e=t3.trim()||"",t=t6.trim()||"";return"route -p add ".concat(sJ," mask 255.255.255.255 ").concat(e," metric 1 if ").concat(t)},[sJ,t3,t6]),sX=(0,Z.useCallback)(async()=>{try{var e;let t=await sM("/hub/network/wireguard/status");tW(null!==(e=t.wireguard)&&void 0!==e?e:null)}catch(e){tW(null)}},[sM]),sQ=(0,Z.useCallback)(async()=>{tG(!0);try{let e=await sM("/hub/network/system_probe");tH(null!=e?e:null)}catch(e){tH(null)}finally{tG(!1)}},[sM]);(0,Z.useEffect)(()=>{"network"===e3&&(sX(),sQ())},[sQ,sX,e3]);let s0=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=tI.trim();if(!t){sP(sL("请先选择或粘贴 WireGuard 配置","Pick or paste a WireGuard config first"));return}to(e?"wg:apply":"wg:save");try{var s;let n=await sM("/hub/network/wireguard/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:tU,content:t,route_mode:t5,apply:e})});tO(null!==(s=n.wireguard)&&void 0!==s?s:null),await sX(),sP(e?sL("WireGuard 配置已保存并应用","WireGuard config saved and applied"):sL("WireGuard 配置已保存","WireGuard config saved"))}catch(e){sP(e.message)}finally{to(null)}},s1=async e=>{to("wg:neko:".concat(e));try{await sM("/hub/network/wireguard/neko_access",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e,restart:!0})}),await sX(),await sE(),sP("remote"===e?"Neko switched to WireGuard remote access":"Neko switched back to LAN")}catch(e){sP(e.message),await sX()}finally{to(null)}},s5=async()=>{await s0(!1)},s2=async e=>{let t=(e||"").trim();if(t){to("wg:load:".concat(t));try{var s;let e=await sM("/hub/network/wireguard/config/".concat(encodeURIComponent(t)));tZ(e.name||t),tA(e.content||""),tO(null!==(s=e.wireguard)&&void 0!==s?s:null),t1(!0),sP(sL("已载入 WireGuard 配置","WireGuard config loaded"))}catch(e){sP(e.message)}finally{to(null)}}},s3=async e=>{if(e)try{let t=await e.text();tA(t),tU.trim()||tZ(e.name.replace(/\.conf$/i,""))}catch(e){sP(e.message)}},s4=async(e,t)=>{to("svc:".concat(e));try{let s=await sM("/service_action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:e,action:t})});"error"===s.status?sP(s.detail||s.message||sL("操作失败","Action failed")):sP(s.message||"OK"),await sE()}catch(e){sP(e.message)}finally{to(null)}},s6=async()=>{let e=t9.trim(),t=se.trim()||"255.255.255.255",s=Number(ss.trim()||"9");if(!e){sP(sL("请输入 MAC 地址","Enter a MAC address"));return}if(!Number.isInteger(s)||s<1||s>65535){sP(sL("端口必须在 1-65535 之间","Port must be 1-65535"));return}to("wol:wake");try{let n=await sM("/studio/wol/wake",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mac:e,broadcast:t,port:s})});sP(n.message||sL("唤醒包已发送","Wake packet sent"))}catch(e){sP(e.message)}finally{to(null)}},s8=(0,Z.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{let t=await sM(e?"/studio/wol/devices/probe":"/studio/wol/devices",e?{method:"POST"}:void 0);si(t.devices||[])}catch(t){e&&sP(t.message)}},[sM,sP]),s9=async()=>{let e=t9.trim();if(!e){sP(sL("请输入 MAC 地址","Enter a MAC address"));return}to("wol:save");try{var t;let s=await sM("/studio/wol/devices",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:so,mac:e,ip:sd})});si(s.devices||[]),sr((null===(t=s.device)||void 0===t?void 0:t.mac)||e),sP(s.message||sL("设备已保存","Device saved"))}catch(e){sP(e.message)}finally{to(null)}},s7=async()=>{let e=(sa||t9).trim();if(e){to("wol:delete");try{let t=await sM("/studio/wol/devices/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mac:e})});si(t.devices||[]),sr(""),t7(""),sc(""),sx(""),sP(sL("设备已删除","Device removed"))}catch(e){sP(e.message)}finally{to(null)}}},ne=(0,Z.useCallback)(async()=>{try{let e=(await sM("/studio/serial/ports")).ports||[];sm(e),sp(t=>{var s;return t&&e.some(e=>e.path===t)?t:(null===(s=e[0])||void 0===s?void 0:s.path)||t})}catch(e){sm([])}},[sM]),nt=(0,Z.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{let t=await sM("/studio/ops/summary".concat(e?"?refresh=1":""));sN(t)}catch(t){e&&sP(t.message)}},[sM,sP]),ns=async()=>{to("studio:snapshot");try{let e=await sM("/studio/ops/snapshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"studio"})});await nt(!1),sP(e.message||sL("系统快照已创建","System snapshot created"))}catch(e){sP(e.message)}finally{to(null)}};(0,Z.useEffect)(()=>{if("studio"!==e3)return;s8(!0),nt(!0);let e=window.setInterval(()=>{s8(!0),nt(!1)},3e4);return()=>window.clearInterval(e)},[ne,nt,s8,e3]);let nn=async(e,t)=>{let s=(null!=t?t:tv).trim();if(s){to("proc:".concat(e,":").concat(s));try{let t=await sM("/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:s})});sP(String(t.output||t.message||"OK")),await sA(),"live_youtube"===e3||"live_tiktok"===e3?sE():await sE()}catch(e){sP(e.message)}finally{to(null)}}},nl=async(e,t)=>{let s=(null!=t?t:tv).trim();if(!s)throw sP(sL("请选择要保存地址的进程","Pick a process before saving URLs")),Error(sL("请选择要保存地址的进程","Pick a process before saving URLs"));let n=null!=e?e:tw,l=++sC.current;to("save:url");try{let e=new URLSearchParams({process:s}),t=await sM("/save_url_config?".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})});l===sC.current&&s===sS.current.trim()&&tj(n),sP(t.path?sL("URL 配置已保存: ".concat(t.path),"URL config saved: ".concat(t.path)):sL("URL 配置已保存","URL config saved"))}catch(e){throw sP(e.message),e}finally{to(null)}},ni=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t_){sP(sL("请选择设备","Pick a device"));return}to("adb:".concat(e));try{let s=await sM("/android/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,serial:t_,payload:t})});sP(s.message||"OK")}catch(e){sP(e.message)}finally{to(null)}},na=[{id:"dashboard",icon:a.Z,labelZh:"总览",labelEn:"Dashboard"},{id:"services",icon:r.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:"studio",icon:x.Z,labelZh:"工作室",labelEn:"Studio"},{id:"network",icon:u.Z,labelZh:"网络",labelEn:"Network"},{id:"settings",icon:m.Z,labelZh:"设置",labelEn:"Settings"}],nr=e=>{(async()=>{var t;if(null===(t=navigator.clipboard)||void 0===t?void 0:t.writeText){await navigator.clipboard.writeText(e);return}let s=document.createElement("textarea");s.value=e,s.readOnly=!0,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select(),document.execCommand("copy"),s.remove()})().then(()=>sP(sL("已复制","Copied")),()=>sP(sL("复制失败","Copy failed")))},no=tx?new Date(tx).toLocaleTimeString("zh"===e0?"zh-CN":"en-US",{hour12:!1}):sL("未同步","Not synced"),nc=tm?sL("前台自动刷新","Auto refresh"):sL("后台已暂停刷新","Refresh paused in background");return(0,n.jsxs)("div",{className:"lp-root min-h-screen transition-colors duration-300 ".concat("light"===e5?"bg-slate-100 text-slate-900 selection:bg-violet-400/25":"bg-[#050508] text-zinc-100 selection:bg-violet-500/30"),children:[(0,n.jsx)("div",{className:"lp-noise pointer-events-none fixed inset-0 z-0 ".concat("light"===e5?"opacity-[0.06]":"opacity-[0.22]"),"aria-hidden":!0}),(0,n.jsx)("div",{className:"lp-aurora pointer-events-none fixed -left-1/4 top-0 h-[42rem] w-[42rem] rounded-full blur-[120px] ".concat("light"===e5?"bg-violet-400/15":"bg-violet-600/20"),"aria-hidden":!0}),(0,n.jsx)("div",{className:"lp-aurora2 pointer-events-none fixed bottom-0 right-0 h-[36rem] w-[36rem] rounded-full blur-[100px] ".concat("light"===e5?"bg-cyan-400/10":"bg-cyan-500/10"),"aria-hidden":!0}),tc?(0,n.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:tc}):null,(0,n.jsxs)("div",{className:"relative z-10 flex min-h-screen",children:[(0,n.jsxs)("aside",{className:"hidden w-64 shrink-0 flex-col border-r px-4 py-6 backdrop-blur-2xl lg:flex ".concat("light"===e5?"border-slate-200/90 bg-white/70":"border-white/[0.06] bg-zinc-950/40"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 px-2",children:[(0,n.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,n.jsx)(h.Z,{className:"h-4 w-4 text-white"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-[0.2em] ".concat("light"===e5?"text-slate-500":"text-zinc-500"),children:"live.local"}),(0,n.jsx)("p",{className:"text-sm font-semibold ".concat("light"===e5?"text-slate-900":"text-white"),children:sL("无人直播系统","Unmanned Live System")})]})]}),(0,n.jsx)("nav",{className:"mt-10 flex flex-1 flex-col gap-1",children:na.map(e=>{let t=e.icon,s=e3===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>e4(e.id),"aria-current":s?"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"===e5?s?"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":s?"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,n.jsx)(t,{className:"h-4 w-4 ".concat("light"===e5?s?"text-violet-600":"text-slate-400":s?"text-violet-300":"text-zinc-600")}),sL(e.labelZh,e.labelEn),s?(0,n.jsx)(p.Z,{className:"ml-auto h-4 w-4 ".concat("light"===e5?"text-slate-400":"text-zinc-600")}):null]},e.id)})})]}),(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,n.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"===e5?"border-slate-200/80 bg-white/75 text-slate-900":"border-white/[0.06] bg-zinc-950/70 text-white"),children:[(0,n.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,n.jsx)("button",{type:"button",className:"rounded-xl border p-2 lg:hidden ".concat("light"===e5?"border-slate-200 bg-white/80":"border-white/10 bg-white/5"),onClick:()=>te(!0),"aria-label":"Menu",children:(0,n.jsx)(g.Z,{className:"h-5 w-5"})}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("h1",{className:"truncate text-lg font-semibold tracking-tight lg:text-xl ".concat("light"===e5?"text-slate-900":"text-white"),children:sL((null===(A=na.find(e=>e.id===e3))||void 0===A?void 0:A.labelZh)||"",(null===(D=na.find(e=>e.id===e3))||void 0===D?void 0:D.labelEn)||"")}),(0,n.jsxs)("p",{className:"truncate text-xs ".concat("light"===e5?"text-slate-500":"text-zinc-500"),children:[(null==tt?void 0:null===(O=tt.stack)||void 0===O?void 0:O.mdns_host)||"live.local"," \xb7"," ","dark"===e5?sL("夜间","Dark mode"):sL("日间","Light mode")," \xb7 ",nc," \xb7"," ",sL("最后同步","Last sync")," ",no]})]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 sm:gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:()=>e2(e=>"dark"===e?"light":"dark"),className:"rounded-xl border p-2 transition ".concat("light"===e5?"border-slate-200 bg-white text-amber-500 shadow-sm":"border-white/10 bg-white/[0.06] text-violet-200"),title:"dark"===e5?sL("切换到日间","Switch to light"):sL("切换到夜间","Switch to dark"),"aria-label":"dark"===e5?sL("日间模式","Light mode"):sL("夜间模式","Dark mode"),"aria-pressed":"light"===e5,children:"dark"===e5?(0,n.jsx)(b.Z,{className:"h-5 w-5",strokeWidth:2}):(0,n.jsx)(f.Z,{className:"h-5 w-5",strokeWidth:2})}),(0,n.jsxs)("button",{type:"button",onClick:()=>e1(e=>"zh"===e?"en":"zh"),className:"relative rounded-xl border p-2 transition ".concat("light"===e5?"border-slate-200 bg-white text-cyan-600 shadow-sm":"border-white/10 bg-white/[0.06] text-cyan-200"),title:"zh"===e0?"English":"中文","aria-label":sL("切换语言","Toggle language"),"aria-pressed":"en"===e0,children:[(0,n.jsx)(v.Z,{className:"h-5 w-5",strokeWidth:2}),(0,n.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"===e5?"bg-cyan-100 text-cyan-800":"bg-cyan-500/30 text-cyan-100"),children:"zh"===e0?"中":"A"})]}),(0,n.jsxs)("button",{type:"button",disabled:!!tr,onClick:()=>void Promise.all([sE(),sA()]),className:"flex items-center gap-2 rounded-xl border px-3 py-2 text-xs font-medium transition disabled:opacity-40 ".concat("light"===e5?"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:[tr?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5"}),(0,n.jsx)("span",{className:"hidden sm:inline",children:sL("刷新","Refresh")})]})]})]}),(0,n.jsx)("main",{className:"flex-1 px-4 py-6 lg:px-8 lg:py-8",children:(0,n.jsx)(i.M,{mode:"wait",children:(0,n.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"===e3?(0,n.jsx)(eX,{dash:tt,deployCheck:tR,dashErr:tn,loading:ti,theme:e5,t:sL,onNavigate:e4,nekoLinks:sK,nekoPortsLabel:sH,showStreamProbes:tT,quickLinks:sD}):null,"services"===e3?(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:[((null==tt?void 0:tt.services)||[]).map((e,t)=>(0,n.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,n.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"font-semibold text-white",children:e.label}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500 line-clamp-2",children:e.description})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(tX(e.running?"online":e.status)),children:e.running?sL("运行中","Running"):e.status})]}),e.detail?(0,n.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,n.jsx)("p",{className:"mt-2 text-[11px] text-zinc-500",children:sL("stopped 为常态:仅当需要透明代理 / 规则分流时再手动点 Start,不建议设置自启。","Stopped is normal; click Start manually only when the proxy is needed. Autostart stays off.")}):null,(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.url?(0,n.jsx)("a",{href:(0,eh.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:sL("打开面板","Open panel")}):null,(0,n.jsx)("button",{type:"button",disabled:!!tr||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?sL("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||sL("当前不可操作","Unavailable"),onClick:()=>void s4(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,n.jsx)("button",{type:"button",disabled:!!tr||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?sL("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||sL("当前不可操作","Unavailable"),onClick:()=>void s4(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,n.jsx)("button",{type:"button",disabled:!!tr||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?sL("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||sL("当前不可操作","Unavailable"),onClick:()=>void s4(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,n.jsx)("button",{type:"button",disabled:!!tr||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?sL("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||sL("当前不可操作","Unavailable"),onClick:()=>void s4(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,n.jsx)("button",{type:"button",disabled:!!tr||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?sL("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||sL("当前不可操作","Unavailable"),onClick:()=>void s4(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,n.jsx)("button",{type:"button",disabled:!!tr||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?sL("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||sL("当前不可操作","Unavailable"),onClick:()=>void s4(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==tt?void 0:null===(B=tt.services)||void 0===B?void 0:B.length)?null:(0,n.jsx)("p",{className:"text-sm text-zinc-500",children:sL("暂无服务数据","No services")})]}):null,"live_youtube"===e3?(0,n.jsx)(tY,{t:sL,busy:tr,entries:tp,currentProc:tv,setCurrentProc:ty,urlConfig:tw,setUrlConfig:tj,onRunProcess:(e,t)=>void nn(e,t),onSaveUrlConfig:(e,t)=>nl(e,t),fetchJson:sM,liveProcesses:tb.length?tb:null!==(eO=null==tt?void 0:null===(W=tt.live)||void 0===W?void 0:W.processes)&&void 0!==eO?eO:[],notify:sP,quickLinks:sD,onRefresh:()=>sE(),onNavigate:e=>e4(e)}):null,"live_tiktok"===e3?(0,n.jsx)(eI,{t:sL,busy:!!tr,entries:tp,currentProc:tv,setCurrentProc:ty,urlConfig:tw,setUrlConfig:tj,onRunProcess:e=>void nn(e),onSaveUrlConfig:e=>nl(e),onReplayGoLive:async(e,t)=>{let s=t.replace(/[,,|]/g,"_");await nl("原画,".concat(e,",主播: ").concat(s)),await nn("start")},onCopy:nr,fetchJson:sM,apiPrefix:eQ,quickLinks:sD,hdmiStatus:null==tt?void 0:tt.hdmi,notify:sP,onNavigate:e=>e4(e)}):null,"android"===e3?(0,n.jsx)(ed,{t:sL,notify:sP,fetchJson:sM,apiBase:eQ,busy:tr,androidSerial:t_,setAndroidSerial:tz,devices:(null==tt?void 0:null===(K=tt.android)||void 0===K?void 0:K.devices)||[],adbAvailable:!!(null==tt?void 0:null===(H=tt.android)||void 0===H?void 0:H.adb_available),apkPath:tN,setApkPath:tk,onAndroidAction:(e,t)=>ni(e,null!=t?t:{}),onCopy:nr,onRefreshDevices:()=>void sE()}):null,"studio"===e3?(0,n.jsxs)("div",{className:"mx-auto max-w-7xl space-y-5",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold ".concat("light"===e5?"text-slate-900":"text-white"),children:[(0,n.jsx)(x.Z,{className:"h-5 w-5 ".concat("light"===e5?"text-emerald-700":"text-emerald-300")}),sL("工作室","Studio")]}),(0,n.jsx)("p",{className:"mt-1 text-xs ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:"Home Assistant / Frigate / WOL"})]}),(0,n.jsxs)("span",{className:"w-fit rounded-full px-3 py-1 text-[11px] font-semibold ".concat("light"===e5?"bg-emerald-50 text-emerald-800 ring-1 ring-emerald-200":"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-500/25"),children:[sB.filter(e=>null==e?void 0:e.running).length,"/",sB.length||4," online"]})]}),(0,n.jsxs)("div",{className:"grid gap-4 xl:grid-cols-4",children:[[{id:"homeassistant",label:"Home Assistant",icon:x.Z,fallbackUrl:sD.homeassistant,iconClass:"light"===e5?"text-emerald-700":"text-emerald-300",openClass:"light"===e5?"bg-emerald-50 text-emerald-800 ring-1 ring-emerald-200 hover:bg-emerald-100":"bg-emerald-500/15 text-emerald-100 ring-1 ring-emerald-400/25 hover:bg-emerald-500/25"},{id:"frigate",label:"Frigate NVR",icon:j.Z,fallbackUrl:sD.frigate,iconClass:"light"===e5?"text-cyan-700":"text-cyan-300",openClass:"light"===e5?"bg-cyan-50 text-cyan-800 ring-1 ring-cyan-200 hover:bg-cyan-100":"bg-cyan-500/15 text-cyan-100 ring-1 ring-cyan-400/25 hover:bg-cyan-500/25"},{id:"ntfy",label:"ntfy",icon:N.Z,fallbackUrl:sD.ntfy,iconClass:"light"===e5?"text-violet-700":"text-violet-300",openClass:"light"===e5?"bg-violet-50 text-violet-800 ring-1 ring-violet-200 hover:bg-violet-100":"bg-violet-500/15 text-violet-100 ring-1 ring-violet-400/25 hover:bg-violet-500/25"}].map(e=>{let t=sO.get(e.id),s=e.icon,i=(null==t?void 0:t.url)||e.fallbackUrl||"",a=!!tr||(null==t?void 0:t.available)===!1;return(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===e5?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e5?"text-slate-900":"text-white"),children:[(0,n.jsx)(s,{className:"h-4 w-4 ".concat(e.iconClass)}),e.label]}),(0,n.jsx)("p",{className:"mt-2 line-clamp-2 text-xs ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:(null==t?void 0:t.description)||("frigate"===e.id?"Camera NVR and detection console":"Local automation workspace")})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(tX((null==t?void 0:t.running)?"online":(null==t?void 0:t.status)||"unknown")),children:(null==t?void 0:t.running)?sL("运行中","Running"):(null==t?void 0:t.status)||"unknown"})]}),(null==t?void 0:t.detail)?(0,n.jsx)("p",{className:"mt-3 line-clamp-4 font-mono text-[11px] ".concat("light"===e5?"text-slate-500":"text-zinc-500"),children:t.detail}):null,(0,n.jsxs)("div",{className:"mt-5 flex flex-wrap gap-2",children:[i?(0,n.jsxs)("a",{href:(0,eh.p)(i),target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 rounded-lg px-3 py-2 text-xs font-semibold transition ".concat(e.openClass),children:[(0,n.jsx)(k.Z,{className:"h-3.5 w-3.5"}),sL("打开","Open")]}):null,(0,n.jsx)("button",{type:"button",disabled:a,onClick:()=>void s4(e.id,"start"),className:"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:"Start"}),(0,n.jsx)("button",{type:"button",disabled:a,onClick:()=>void s4(e.id,"restart"),className:"rounded-lg bg-amber-500/15 px-3 py-2 text-xs font-semibold text-amber-100 ring-1 ring-amber-400/25 transition hover:bg-amber-500/25 disabled:opacity-40",children:"Restart"}),(0,n.jsx)("button",{type:"button",disabled:a,onClick:()=>void s4(e.id,"stop"),className:"rounded-lg bg-rose-500/15 px-3 py-2 text-xs font-semibold text-rose-100 ring-1 ring-rose-400/25 transition hover:bg-rose-500/25 disabled:opacity-40",children:"Stop"})]})]},e.id)}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===e5?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e5?"text-slate-900":"text-white"),children:[(0,n.jsx)(_.Z,{className:"h-4 w-4 ".concat("light"===e5?"text-amber-700":"text-amber-300")}),sL("WOL 网络唤醒","WOL Network Wake")]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:(null==sW?void 0:sW.detail)||"broadcast=255.255.255.255;port=9"})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(tX((null==sW?void 0:sW.status)||"ready")),children:(null==sW?void 0:sW.status)||"ready"})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-3",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("select",{value:sa,onChange:e=>{let t=e.target.value;sr(t);let s=sl.find(e=>e.mac===t);s&&(t7(s.mac),sc(s.name||""),sx(s.ip||""))},className:"min-w-0 flex-1 rounded-lg border px-3 py-2 text-xs outline-none ".concat("light"===e5?"border-slate-200 bg-slate-50 text-slate-900":"border-white/10 bg-black/35 text-zinc-100"),children:[(0,n.jsx)("option",{value:"",children:sL("选择设备","Select device")}),sl.map(e=>(0,n.jsx)("option",{value:e.mac,children:(e.name||e.ip||e.mac)+(e.reachable?" \xb7 online":"")},e.mac))]}),(0,n.jsx)("button",{type:"button",disabled:"wol:probe"===tr,onClick:()=>{to("wol:probe"),s8(!0).finally(()=>to(null))},className:"inline-flex items-center justify-center rounded-lg bg-cyan-500/15 px-3 py-2 text-xs font-semibold text-cyan-100 ring-1 ring-cyan-400/25 transition hover:bg-cyan-500/25 disabled:opacity-40",children:(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat("wol:probe"===tr?"animate-spin":"")})})]}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:sL("名称","Name")}),(0,n.jsx)("input",{value:so,onChange:e=>sc(e.target.value),placeholder:"NAS / PC",className:"mt-1 w-full rounded-lg border px-3 py-2 text-sm outline-none ".concat("light"===e5?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]}),(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:"IP"}),(0,n.jsx)("input",{value:sd,onChange:e=>sx(e.target.value),placeholder:"10.0.0.10",inputMode:"decimal",className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===e5?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]})]}),(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:"MAC"}),(0,n.jsx)("input",{value:t9,onChange:e=>t7(e.target.value),placeholder:"AA:BB:CC:DD:EE:FF",autoCapitalize:"characters",spellCheck:!1,className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===e5?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[minmax(0,1fr)_7rem]",children:[(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:"Broadcast"}),(0,n.jsx)("input",{value:se,onChange:e=>st(e.target.value),placeholder:"255.255.255.255",inputMode:"decimal",className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===e5?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]}),(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:"Port"}),(0,n.jsx)("input",{value:ss,onChange:e=>sn(e.target.value),inputMode:"numeric",className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===e5?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]})]}),(0,n.jsxs)("button",{type:"button",disabled:"wol:wake"===tr||(null==sW?void 0:sW.available)===!1,onClick:()=>void s6(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-amber-500/18 px-3 py-2.5 text-xs font-semibold text-amber-100 ring-1 ring-amber-400/30 transition hover:bg-amber-500/28 disabled:opacity-40",children:["wol:wake"===tr?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(_.Z,{className:"h-3.5 w-3.5"}),sL("唤醒","Wake")]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,n.jsxs)("button",{type:"button",disabled:"wol:save"===tr,onClick:()=>void s9(),className:"inline-flex items-center justify-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:["wol:save"===tr?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(z.Z,{className:"h-3.5 w-3.5"}),sL("保存","Save")]}),(0,n.jsxs)("button",{type:"button",disabled:"wol:delete"===tr||!(sa||t9),onClick:()=>void s7(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-rose-500/15 px-3 py-2 text-xs font-semibold text-rose-100 ring-1 ring-rose-400/25 transition hover:bg-rose-500/25 disabled:opacity-40",children:["wol:delete"===tr?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(S.Z,{className:"h-3.5 w-3.5"}),sL("删除","Delete")]})]})]})]})]}),null,(0,n.jsxs)("div",{className:"grid gap-4 xl:grid-cols-4",children:[(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===e5?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e5?"text-slate-900":"text-white"),children:[(0,n.jsx)(R.Z,{className:"h-4 w-4 ".concat("light"===e5?"text-emerald-700":"text-emerald-300")}),"System Doctor"]}),(0,n.jsxs)("p",{className:"mt-2 text-xs ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:[null!==(eB=null==sj?void 0:null===(F=sj.doctor)||void 0===F?void 0:F.services_running)&&void 0!==eB?eB:0,"/",null!==(eW=null==sj?void 0:null===(Y=sj.doctor)||void 0===Y?void 0:Y.services_available)&&void 0!==eW?eW:0," services"]})]}),(0,n.jsxs)("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(tX((null==sj?void 0:null===(G=sj.doctor)||void 0===G?void 0:G.status)||"unknown")),children:[null!==(eK=null==sj?void 0:null===(q=sj.doctor)||void 0===q?void 0:q.score)&&void 0!==eK?eK:0,"/100"]})]}),(0,n.jsxs)("div",{className:"mt-4 space-y-2 text-xs ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:[(0,n.jsxs)("p",{children:[sL("严重","Critical"),": ",null!==(eH=null==sj?void 0:null===(V=sj.doctor)||void 0===V?void 0:V.critical)&&void 0!==eH?eH:0," / ",sL("警告","Warnings"),": ",null!==(eF=null==sj?void 0:null===($=sj.doctor)||void 0===$?void 0:$.warnings)&&void 0!==eF?eF:0]}),((null==sj?void 0:null===(X=sj.doctor)||void 0===X?void 0:X.recommendations)||[]).slice(0,2).map(e=>(0,n.jsxs)("p",{className:"line-clamp-2",children:["- ",e]},e))]})]}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===e5?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e5?"text-slate-900":"text-white"),children:[(0,n.jsx)(L.Z,{className:"h-4 w-4 ".concat("light"===e5?"text-cyan-700":"text-cyan-300")}),sL("设备资产","Device inventory")]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:"LAN / USB"})]}),(0,n.jsx)("button",{type:"button",disabled:"studio:ops"===tr,onClick:()=>{to("studio:ops"),nt(!0).finally(()=>to(null))},className:"inline-flex items-center justify-center rounded-lg px-2.5 py-2 text-xs font-semibold ring-1 transition disabled:opacity-40 ".concat("light"===e5?"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,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat("studio:ops"===tr?"animate-spin":"")})})]}),(0,n.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-2 text-center text-xs",children:[["WOL",null!==(eY=null==sj?void 0:null===(ee=sj.inventory)||void 0===ee?void 0:null===(Q=ee.counts)||void 0===Q?void 0:Q.wol)&&void 0!==eY?eY:0],["Video",null!==(eG=null==sj?void 0:null===(es=sj.inventory)||void 0===es?void 0:null===(et=es.counts)||void 0===et?void 0:et.video)&&void 0!==eG?eG:0]].map(e=>{let[t,s]=e;return(0,n.jsxs)("div",{className:"rounded-lg border px-2 py-2 ".concat("light"===e5?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"font-semibold ".concat("light"===e5?"text-slate-900":"text-white"),children:s}),(0,n.jsx)("p",{className:"light"===e5?"text-slate-500":"text-zinc-500",children:t})]},t)})})]}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===e5?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e5?"text-slate-900":"text-white"),children:[(0,n.jsx)(h.Z,{className:"h-4 w-4 ".concat("light"===e5?"text-amber-700":"text-amber-300")}),sL("自动化配方","Automation recipes")]}),(0,n.jsx)("div",{className:"mt-4 space-y-2",children:((null==sj?void 0:sj.recipes)||[]).slice(0,3).map(e=>(0,n.jsx)("div",{className:"rounded-lg border px-3 py-2 text-xs ".concat("light"===e5?"border-slate-200 bg-slate-50 text-slate-700":"border-white/10 bg-black/30 text-zinc-300"),children:(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"line-clamp-1 font-semibold",children:e.title}),(0,n.jsx)("span",{className:"ready"===e.status?"text-emerald-400":"text-amber-300",children:e.status})]})},e.id||e.title))})]}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===e5?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e5?"text-slate-900":"text-white"),children:[(0,n.jsx)(r.Z,{className:"h-4 w-4 ".concat("light"===e5?"text-violet-700":"text-violet-300")}),sL("备份快照","Backup snapshots")]}),(0,n.jsxs)("p",{className:"mt-2 text-xs ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:[((null==sj?void 0:null===(en=sj.backups)||void 0===en?void 0:en.snapshots)||[]).length," snapshots"]})]}),(0,n.jsxs)("button",{type:"button",disabled:"studio:snapshot"===tr,onClick:()=>void ns(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-violet-500/15 px-3 py-2 text-xs font-semibold text-violet-100 ring-1 ring-violet-400/25 transition hover:bg-violet-500/25 disabled:opacity-40",children:["studio:snapshot"===tr?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(P.Z,{className:"h-3.5 w-3.5"}),sL("创建","Create")]})]}),(0,n.jsx)("p",{className:"mt-4 line-clamp-2 text-xs ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:(null===(el=((null==sj?void 0:null===(ei=sj.backups)||void 0===ei?void 0:ei.snapshots)||[])[0])||void 0===el?void 0:el.name)||sL("暂无快照","No snapshots yet")})]})]})]}):null,"network"===e3?(0,n.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6",children:[(0,n.jsxs)("div",{className:"rounded-2xl border p-6 shadow-xl ".concat("light"===e5?"border-cyan-200/90 bg-white shadow-cyan-100/50":"border-cyan-500/20 bg-zinc-950/55 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e5?"text-slate-900":"text-white"),children:[(0,n.jsx)(R.Z,{className:"h-4 w-4 ".concat("light"===e5?"text-cyan-700":"text-cyan-300")}),"WireGuard VPS"]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:sL("导入 VPS wg-quick 配置,保存到受管配置目录,并生成 Windows 端点旁路路由命令。","Import a VPS wg-quick config, save it under managed config, and generate the Windows endpoint bypass route.")})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)("span",{className:"rounded-full px-3 py-1 text-[11px] font-semibold ".concat((null==tB?void 0:tB.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:[tQ(null==tB?void 0:null===(ea=tB.quality)||void 0===ea?void 0:ea.status,sL),"number"==typeof(null==tB?void 0:null===(er=tB.quality)||void 0===er?void 0:er.score)?" \xb7 ".concat(tB.quality.score,"/100"):""]}),(null==tD?void 0:tD.relative_path)?(0,n.jsx)("div",{className:"rounded-lg border px-3 py-2 text-[11px] ".concat("light"===e5?"border-cyan-200 bg-cyan-50 text-cyan-900":"border-cyan-400/20 bg-cyan-500/10 text-cyan-100"),children:tD.relative_path}):null,(0,n.jsxs)("button",{onClick:()=>{sX(),sQ()},disabled:"wg:status"===tr||tF,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"===e5?"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,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(tF?"animate-spin":"")}),tF?sL("探测中","Probing"):sL("刷新","Refresh")]})]})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-3 lg:grid-cols-2 xl:grid-cols-4",children:[(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===e5?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===e5?"text-slate-500":"text-zinc-500"),children:sL("当前接口","Active interfaces")}),(0,n.jsxs)("div",{className:"mt-2 rounded-lg border px-3 py-2 text-xs ".concat("light"===e5?"border-cyan-100 bg-white text-slate-700":"border-cyan-400/15 bg-cyan-500/10 text-cyan-100"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"font-semibold",children:tQ(null==tB?void 0:null===(eo=tB.quality)||void 0===eo?void 0:eo.status,sL)}),(0,n.jsx)("span",{className:"font-mono",children:"number"==typeof(null==tB?void 0:null===(ec=tB.quality)||void 0===ec?void 0:ec.score)?"".concat(tB.quality.score,"/100"):"—"})]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] ".concat("light"===e5?"text-slate-500":"text-cyan-100/75"),children:[sL("新鲜握手","Fresh peers"),": ",null!==(eq=null==tB?void 0:null===(ex=tB.quality)||void 0===ex?void 0:ex.fresh_peer_count)&&void 0!==eq?eq:0,"/",null!==(eV=null==tB?void 0:null===(eu=tB.quality)||void 0===eu?void 0:eu.peer_count)&&void 0!==eV?eV:0," \xb7 ",sL("最佳握手","Best handshake"),": ",t$(null==tB?void 0:null===(em=tB.quality)||void 0===em?void 0:em.best_handshake_age_seconds)]})]}),(0,n.jsx)("div",{className:"mt-2 space-y-2",children:((null==tB?void 0:tB.interfaces)||[]).length?((null==tB?void 0:tB.interfaces)||[]).map(e=>{var t,s,l;return(0,n.jsxs)("div",{className:"rounded-lg border px-3 py-2 text-xs ".concat("light"===e5?"border-slate-200 bg-white text-slate-700":"border-white/10 bg-zinc-950/60 text-zinc-200"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"font-semibold",children:e.name||"wg"}),(0,n.jsx)("span",{className:(null===(t=e.systemd)||void 0===t?void 0:t.active)==="active"?"text-emerald-400":"text-amber-300",children:(null===(s=e.systemd)||void 0===s?void 0:s.active)||"active"})]}),(0,n.jsx)("p",{className:"mt-1 font-mono text-[11px]",children:(e.addresses||[]).join(", ")||"—"}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] ".concat("light"===e5?"text-slate-500":"text-zinc-500"),children:[e.details_available?sL("运行细节可读","Runtime details readable"):sL("运行细节受限","Runtime details limited"),(null===(l=e.configured_from)||void 0===l?void 0:l.name)?" \xb7 ".concat(sL("配置","Config"),": ").concat(e.configured_from.name):""]})]},e.name||"wg")}):(0,n.jsx)("p",{className:"text-xs ".concat("light"===e5?"text-slate-500":"text-zinc-500"),children:sL("未发现 wg show 输出","No wg show output")})})]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===e5?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===e5?"text-slate-500":"text-zinc-500"),children:sL("对端与流量","Peer and traffic")}),(()=>{var e;let t=(null==sq?void 0:sq.status_source)==="wg"?sL("运行态","Runtime"):(null==sq?void 0:sq.config_source)==="system"?sL("系统配置","System config"):(null==sq?void 0:sq.config_source)==="repo"?sL("受管配置","Managed config"):sL("配置态","Config");return sq?(0,n.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[11px] ".concat("light"===e5?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["Source: ",t]}),(0,n.jsxs)("p",{children:["Endpoint: ",sq.endpoint||"—"]}),(0,n.jsxs)("p",{children:["AllowedIPs: ",(sq.allowed_ips||[]).join(", ")||"—"]}),(0,n.jsxs)("p",{children:["Handshake:"," ","config"===sq.status_source?sL("运行态需 root/CAP_NET_ADMIN","Runtime details need root/CAP_NET_ADMIN"):t$(sq.latest_handshake_age_seconds)]}),(0,n.jsxs)("p",{children:["RX/TX: ",tJ(sq.transfer_rx_bytes)," / ",tJ(sq.transfer_tx_bytes)]}),(0,n.jsxs)("p",{children:["Keepalive: ",null!==(e=sq.persistent_keepalive)&&void 0!==e?e:"—"]})]}):(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===e5?"text-slate-500":"text-zinc-500"),children:sL("暂无 peer 数据","No peer data yet")})})(),((null==tB?void 0:tB.endpoint_routes)||[]).length?(0,n.jsx)("div",{className:"mt-3 space-y-1 rounded-lg border px-3 py-2 font-mono text-[10px] ".concat("light"===e5?"border-slate-200 bg-white text-slate-600":"border-white/10 bg-zinc-950/60 text-zinc-400"),children:((null==tB?void 0:tB.endpoint_routes)||[]).slice(0,2).map(e=>(0,n.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,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===e5?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===e5?"text-slate-500":"text-zinc-500"),children:sL("Neko 访问模式","Neko access mode")}),(0,n.jsx)("div",{className:"mt-2 grid grid-cols-2 rounded-lg p-1 text-xs font-semibold ".concat("light"===e5?"bg-slate-200/70":"bg-black/40"),children:["lan","remote"].map(e=>{var t,s;let l=((null==tB?void 0:null===(t=tB.neko_access)||void 0===t?void 0:t.mode)||"lan")===e,i=(null==tr?void 0:tr.startsWith("wg:neko"))||"remote"===e&&!(null==tB?void 0:null===(s=tB.neko_access)||void 0===s?void 0:s.remote_ready);return(0,n.jsx)("button",{onClick:()=>void s1(e),disabled:i,className:"rounded-md px-2.5 py-1.5 transition disabled:opacity-40 ".concat(l?"light"===e5?"bg-white text-cyan-800 shadow-sm":"bg-cyan-500/25 text-cyan-100 ring-1 ring-cyan-400/25":"light"===e5?"text-slate-600 hover:bg-white/60":"text-zinc-300 hover:bg-white/10"),children:"lan"===e?sL("局域网","LAN"):sL("远控","Remote")},e)})}),(0,n.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[11px] ".concat("light"===e5?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["NAT1TO1: ",(null==tB?void 0:null===(ep=tB.neko_access)||void 0===ep?void 0:ep.nat1to1)||"-"]}),(0,n.jsxs)("p",{children:["LAN: ",(null==tB?void 0:null===(eg=tB.neko_access)||void 0===eg?void 0:eg.lan_host)||"-"]}),(0,n.jsxs)("p",{children:["WG: ",(null==tB?void 0:null===(eb=tB.neko_access)||void 0===eb?void 0:eb.wireguard_host)||"-"]}),(0,n.jsxs)("p",{children:["Target: ",(null==tB?void 0:null===(ef=tB.neko_access)||void 0===ef?void 0:ef.target_nat1to1)||"-"]}),(0,n.jsxs)("p",{children:["ShellCrash: ",(null==tB?void 0:null===(ev=tB.shellcrash)||void 0===ev?void 0:ev.running)?"running:".concat((null==tB?void 0:null===(ew=tB.shellcrash)||void 0===ew?void 0:ew.mixed_port)||"7890"):"stopped"]})]}),((null==tB?void 0:null===(ej=tB.neko_access)||void 0===ej?void 0:ej.remote_urls)||[]).length?(0,n.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:((null==tB?void 0:null===(eN=tB.neko_access)||void 0===eN?void 0:eN.remote_urls)||[]).slice(0,4).map(e=>(0,n.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"===e5?"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]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===e5?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===e5?"text-slate-500":"text-zinc-500"),children:"Google / Douyin"}),(0,n.jsx)("div",{className:"mt-2 space-y-2",children:["google","youtube","douyin"].map(e=>{let t=((null==tK?void 0:tK.direct)||[]).find(t=>t.target===e),s=!!(null==t?void 0:t.ok),l=!t,i=tF&&l,a=(null==t?void 0:t.label)||("google"===e?"Google":"youtube"===e?"YouTube":"Douyin");return(0,n.jsxs)("div",{className:"rounded-lg border px-3 py-2 text-xs ".concat("light"===e5?"border-slate-200 bg-white text-slate-700":"border-white/10 bg-zinc-950/60 text-zinc-200"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"font-semibold",children:a}),(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat(i?"bg-cyan-500/15 text-cyan-100 ring-1 ring-cyan-500/25":l?"bg-zinc-500/15 text-zinc-300 ring-1 ring-zinc-500/25":s?"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-500/25":"bg-rose-500/15 text-rose-200 ring-1 ring-rose-500/25"),children:[i?(0,n.jsx)(y.Z,{className:"h-3 w-3 animate-spin"}):null,i?sL("探测中","Probing"):l?sL("等待结果","Waiting"):s?"OK":"FAIL"]})]}),(0,n.jsxs)("p",{className:"mt-1 font-mono text-[10px] ".concat("light"===e5?"text-slate-500":"text-zinc-500"),children:[(null==t?void 0:t.elapsed_ms)!=null?"".concat(t.elapsed_ms," ms"):i?sL("正在连接 ".concat(a,"..."),"Connecting ".concat(a,"...")):sL("等待探测结果","Waiting for probe result"),(null==t?void 0:t.status)?" \xb7 HTTP ".concat(t.status):""]}),!s&&(null==t?void 0:t.error)?(0,n.jsx)("p",{className:"mt-1 line-clamp-2 text-[10px] text-amber-200/80",children:t.error}):null]},e)})}),(0,n.jsxs)("div",{className:"mt-3 space-y-1 font-mono text-[11px] ".concat("light"===e5?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["Mode: ",tF?sL("正在探测直连链路与代理链路","Probing direct/proxy paths"):(null==tK?void 0:tK.mode)||"-"]}),(0,n.jsxs)("p",{children:["ShellCrash: ",(null==tK?void 0:null===(ek=tK.shellcrash)||void 0===ek?void 0:ek.running)?"running:".concat((null==tK?void 0:null===(e_=tK.shellcrash)||void 0===e_?void 0:e_.mixed_port)||"7890"):"manual/stopped"]}),(0,n.jsxs)("p",{children:["Autostart: ",(null==tK?void 0:null===(ez=tK.shellcrash_policy)||void 0===ez?void 0:ez.autostart_on_direct_fail)?"on direct fail":"off"]}),(0,n.jsxs)("p",{children:["Neko attach: ",(null==tK?void 0:null===(eS=tK.shellcrash_policy)||void 0===eS?void 0:eS.attach_neko)||"auto"]})]}),tF?(0,n.jsxs)("p",{className:"mt-3 inline-flex items-center gap-2 text-xs ".concat("light"===e5?"text-cyan-700":"text-cyan-200"),children:[(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}),sL("正在探测 Google / YouTube / Douyin,请等待结果返回。","Probing Google / YouTube / Douyin. Waiting for results.")]}):(null==tK?void 0:tK.summary)?(0,n.jsx)("p",{className:"mt-3 text-xs ".concat("light"===e5?"text-slate-600":"text-zinc-500"),children:tK.summary}):null]})]}),(null==tB?void 0:null===(eC=tB.recommendations)||void 0===eC?void 0:eC.length)?(0,n.jsx)("div",{className:"mt-3 rounded-xl border px-4 py-3 text-xs ".concat("light"===e5?"border-amber-200 bg-amber-50 text-amber-800":"border-amber-400/20 bg-amber-500/10 text-amber-100"),children:(tB.recommendations||[]).join(" \xb7 ")}):null,(null==tB?void 0:null===(eL=tB.quality)||void 0===eL?void 0:null===(eR=eL.reasons)||void 0===eR?void 0:eR.length)?(0,n.jsx)("div",{className:"mt-3 rounded-xl border px-4 py-3 text-xs ".concat("light"===e5?"border-slate-200 bg-white text-slate-700":"border-white/10 bg-black/25 text-zinc-300"),children:(tB.quality.reasons||[]).slice(0,4).join(" \xb7 ")}):null,(0,n.jsxs)("div",{className:"mt-5 grid gap-4 lg:grid-cols-[minmax(0,1fr)_22rem]",children:[(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[14rem_minmax(0,1fr)]",children:[(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:sL("配置名","Config name")}),(0,n.jsx)("input",{value:tU,onChange:e=>tZ(e.target.value),className:"mt-1 w-full rounded-lg border px-3 py-2 text-sm outline-none ".concat("light"===e5?"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,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:sL("配置文件","Config file")}),(0,n.jsx)("input",{type:"file",accept:".conf,.txt,text/plain",onChange:e=>{var t;s3(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"===e5?"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,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-xl border px-3 py-2 ".concat("light"===e5?"border-slate-200 bg-slate-50":"border-white/10 bg-black/25"),children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:sL("保存模式","Save mode")}),["overlay","preserve"].map(e=>(0,n.jsx)("button",{onClick:()=>t2(e),className:"rounded-md px-2.5 py-1 text-[11px] font-semibold transition ".concat(t5===e?"bg-cyan-500/20 text-cyan-100 ring-1 ring-cyan-400/30":"light"===e5?"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?sL("组网不接管默认路由","Overlay only"):sL("保留原路由","Preserve routes")},e)),(0,n.jsx)("button",{onClick:()=>t1(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"===e5?"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:t0?sL("锁定","Lock"):sL("编辑","Edit")}),(0,n.jsxs)("button",{onClick:()=>void s0(!1),disabled:"wg:save"===tr,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"===tr?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(P.Z,{className:"h-3.5 w-3.5"}),sL("保存","Save")]}),(0,n.jsxs)("button",{onClick:()=>void s0(!0),disabled:"wg:apply"===tr,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"===tr?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(o.Z,{className:"h-3.5 w-3.5"}),sL("保存并应用","Save & apply")]})]}),(0,n.jsx)("textarea",{value:tI,onChange:e=>tA(e.target.value),readOnly:!t0,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"===e5?"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(t0?"":"opacity-75")}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{onClick:()=>void s5(),disabled:"wg:save"===tr,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"===tr?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(P.Z,{className:"h-3.5 w-3.5"}),sL("解析并保存","Parse & save")]}),(null==tD?void 0:tD.redacted_config)?(0,n.jsxs)("button",{onClick:()=>nr(tD.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,n.jsx)(M.Z,{className:"h-3.5 w-3.5"}),sL("复制脱敏配置","Copy redacted")]}):null]})]}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===e5?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("p",{className:"text-xs font-semibold ".concat("light"===e5?"text-slate-900":"text-white"),children:sL("解析结果","Parsed config")}),(0,n.jsxs)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat("light"===e5?"bg-cyan-100 text-cyan-800":"bg-cyan-500/15 text-cyan-200"),children:[null!==(eJ=null==tD?void 0:tD.peer_count)&&void 0!==eJ?eJ:0," peers"]})]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2 font-mono text-[11px] ".concat("light"===e5?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["Address: ",((null==tD?void 0:null===(eP=tD.interface)||void 0===eP?void 0:eP.addresses)||[]).join(", ")||"—"]}),(0,n.jsxs)("p",{children:["Endpoint: ",(null==tD?void 0:null===(eT=tD.peers)||void 0===eT?void 0:null===(eM=eT[0])||void 0===eM?void 0:eM.endpoint)||"—"]}),(0,n.jsxs)("p",{children:["AllowedIPs: ",((null==tD?void 0:null===(eU=tD.peers)||void 0===eU?void 0:null===(eE=eU[0])||void 0===eE?void 0:eE.allowed_ips)||[]).join(", ")||"—"]}),(0,n.jsxs)("p",{children:["MTU: ",null!==(e$=null==tD?void 0:null===(eZ=tD.interface)||void 0===eZ?void 0:eZ.mtu)&&void 0!==e$?e$:"—"]})]}),(null==tD?void 0:null===(eA=tD.warnings)||void 0===eA?void 0:eA.length)?(0,n.jsx)("ul",{className:"mt-3 space-y-1 text-[11px] ".concat("light"===e5?"text-amber-700":"text-amber-200"),children:tD.warnings.map(e=>(0,n.jsx)("li",{children:e},e))}):null]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===e5?"border-slate-200 bg-white":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-xs font-semibold ".concat("light"===e5?"text-slate-900":"text-white"),children:sL("已保存配置","Saved configs")}),(0,n.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:((null==tB?void 0:tB.repo_configs)||[]).length?((null==tB?void 0:tB.repo_configs)||[]).map(e=>(0,n.jsx)("button",{onClick:()=>void s2(e.name),className:"rounded-lg px-3 py-1.5 text-[11px] font-semibold ring-1 transition ".concat("light"===e5?"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,n.jsx)("span",{className:"text-[11px] ".concat("light"===e5?"text-slate-500":"text-zinc-500"),children:sL("暂无受管配置","No managed configs")})})]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===e5?"border-slate-200 bg-white":"border-white/10 bg-black/30"),children:[(0,n.jsxs)("p",{className:"flex items-center gap-2 text-xs font-semibold ".concat("light"===e5?"text-slate-900":"text-white"),children:[(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"}),sL("Windows 端点路由","Windows endpoint route")]}),(0,n.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-2 lg:grid-cols-1",children:[(0,n.jsx)("input",{value:t3,onChange:e=>t4(e.target.value),placeholder:sL("网关,如 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"===e5?"border-slate-200 bg-slate-50 text-slate-900":"border-white/10 bg-black/35 text-zinc-100")}),(0,n.jsx)("input",{value:t6,onChange:e=>t8(e.target.value),placeholder:sL("接口 ifIndex,如 21","Interface ifIndex, e.g. 21"),className:"rounded-lg border px-3 py-2 text-xs outline-none ".concat("light"===e5?"border-slate-200 bg-slate-50 text-slate-900":"border-white/10 bg-black/35 text-zinc-100")})]}),(0,n.jsx)("code",{className:"mt-3 block break-all rounded-lg border p-3 text-[11px] ".concat("light"===e5?"border-slate-200 bg-slate-50 text-slate-800":"border-white/10 bg-black/40 text-zinc-200"),children:s$||"route -p add mask 255.255.255.255 metric 1 if "}),(0,n.jsxs)("button",{onClick:()=>nr(s$),disabled:!s$,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,n.jsx)(M.Z,{className:"h-3.5 w-3.5"}),sL("复制命令","Copy command")]})]})]})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border p-6 ".concat("light"===e5?"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,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e5?"text-slate-900":"text-white"),children:[(0,n.jsx)(E.Z,{className:"h-4 w-4 ".concat("light"===e5?"text-violet-600":"text-violet-300")}),sL("ShellCrash 网络面板","ShellCrash panel")]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:sL("透明代理与规则分流直接在本页完成,无需跳转;流媒体与其它系统服务请在「服务」页管理。","Proxy rules and YAML editing are embedded here. Use Services for SRS/Neko/Chromium, etc.")}),(0,n.jsx)("div",{className:"mt-6 flex flex-col items-center gap-4 sm:flex-row sm:justify-center",children:[{tx:sL("互联网","Internet"),c:"from-cyan-400 to-blue-500"},{tx:"ShellCrash",c:"from-violet-500 to-fuchsia-500"},{tx:sL("本机 / 安卓","Host / Android"),c:"from-emerald-400 to-teal-500"}].map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.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,n.jsx)(p.Z,{className:"hidden h-5 w-5 sm:block ".concat("light"===e5?"text-slate-400":"text-zinc-600")}):null]},e.tx))})]}),(0,n.jsx)("div",{className:"overflow-hidden rounded-2xl border shadow-xl ".concat("light"===e5?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:(0,n.jsx)("div",{className:"max-h-[min(78vh,56rem)] min-h-[22rem] overflow-y-auto overflow-x-hidden",children:(0,n.jsx)(I.d,{embeddedShellCrash:!0,portalLang:e0})})})]}):null,"settings"===e3?(0,n.jsxs)("div",{className:"mx-auto max-w-lg space-y-6",children:[(0,n.jsx)("p",{className:"text-sm ".concat("light"===e5?"text-slate-600":"text-zinc-400"),children:sL("常用选项(本机偏好);完整文件与 JSON 编辑见下方链接。","Local preferences; full file/JSON editor via the link below.")}),(0,n.jsxs)("div",{className:"space-y-4 rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,n.jsxs)("label",{className:"flex cursor-pointer items-center justify-between gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-medium text-white",children:sL("总览自动刷新","Auto-refresh dashboard")}),(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:"10s"})]}),(0,n.jsx)("input",{type:"checkbox",className:"h-5 w-5 accent-violet-500",checked:tP,onChange:e=>{let t=e.target.checked;tM(t);try{localStorage.setItem("livehub.autorefresh",t?"1":"0")}catch(e){}sP(t?sL("已开启刷新","Auto refresh on"):sL("已暂停刷新","Paused"))}})]}),(0,n.jsxs)("label",{className:"flex cursor-pointer items-center justify-between gap-4 border-t border-white/[0.06] pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-medium text-white",children:sL("总览显示 SRS / Neko 探针","Show SRS/Neko probes")}),(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:sL("关闭可精简首页","Hide stream probe cards")})]}),(0,n.jsx)("input",{type:"checkbox",className:"h-5 w-5 accent-violet-500",checked:tT,onChange:e=>{let t=e.target.checked;tE(t);try{localStorage.setItem("livehub.showStreamProbes",t?"1":"0")}catch(e){}}})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/40 p-5",children:[(0,n.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-500",children:sL("配置快照","Config snapshot")}),(0,n.jsx)("p",{className:"mt-2 font-mono text-[11px] text-zinc-400",children:String((null==tS?void 0:tS.config_root)||"—")}),(0,n.jsxs)("p",{className:"mt-3 text-sm text-zinc-300",children:[sL("主机名","Hostname"),":"," ",(0,n.jsx)("span",{className:"font-mono text-violet-200",children:(()=>{var e,t,s;let n=null==tS?void 0:tS.system;return(null==n?void 0:null===(t=n.identity)||void 0===t?void 0:null===(e=t.hostname_alias)||void 0===e?void 0:e.trim())||((null==tt?void 0:null===(s=tt.stack)||void 0===s?void 0:s.mdns_host)||"").replace(/\.local$/i,"")||"—"})()})]}),(0,n.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:null==tS?void 0:null===(eD=tS.services)||void 0===eD?void 0:eD.slice(0,8).map(e=>(0,n.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,n.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"===e5?"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:[sL("完整配置中心(文件 / JSON)","Full config center (files / JSON)"),(0,n.jsx)(k.Z,{className:"h-4 w-4"})]})]}):null]},e3)})})]})]}),(0,n.jsx)(i.M,{children:e7?(0,n.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:()=>te(!1),children:(0,n.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,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)("button",{type:"button",onClick:()=>te(!1),className:"rounded-lg p-2",children:(0,n.jsx)(U.Z,{className:"h-5 w-5"})})}),(0,n.jsx)("nav",{className:"mt-4 flex flex-col gap-1",children:na.map(e=>{let t=e.icon,s=e3===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>{e4(e.id),te(!1)},"aria-current":s?"page":void 0,className:"flex items-center gap-3 rounded-xl px-3 py-3 text-left text-sm transition ".concat(s?"bg-white/[0.08] text-white shadow-inner shadow-white/5":"text-zinc-300 hover:bg-white/[0.04]"),children:[(0,n.jsx)(t,{className:"h-4 w-4 ".concat(s?"text-violet-300":"text-violet-400")}),sL(e.labelZh,e.labelEn)]},e.id)})})]})}):null})]})}}}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/904-e2d4e288fe270492.js b/d2ypp2/web-console/out/_next/static/chunks/904-e2d4e288fe270492.js new file mode 100644 index 0000000..5331603 --- /dev/null +++ b/d2ypp2/web-console/out/_next/static/chunks/904-e2d4e288fe270492.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[904],{8904:function(e,t,s){s.d(t,{Z:function(){return sn}});var n=s(7437),l=s(6247),i=s(7586),r=s(4401),a=s(6137),o=s(4372),c=s(5901),d=s(3388),u=s(4938),x=s(3420),m=s(8728),p=s(2023),h=s(407),g=s(6840),b=s(7226),f=s(5929),v=s(7945),y=s(1817),w=s(7168),j=s(3581),N=s(4766),k=s(7580),_=s(9688),S=s(4743),z=s(8930),C=s(3651),R=s(4286),L=s(4428),P=s(7265),M=s(8867),T=s(8406),E=s(2926),U=s(2489),Z=s(2265),I=s(2246),D=s(4794),A=s(221),O=s(8124),B=s(2101),F=s(9985),W=s(6362),H=s(3468),K=s(6443),Y=s(5287),G=s(3276),q=s(9227),J=s(257),V=s(1387);class ${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 s=new Uint8Array(e.length+t.length);return s.set(e,0),s.set(t,e.length),s}(this.buf,t),this.drainAvcc()}drainAvcc(){let e=this.buf,t=0;for(;t+4<=e.length;){var s;let n=e[s=t]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3];if(n<=0||n>6291456){this.buf=new Uint8Array(e.subarray(t+1)),t=0;continue}if(t+4+n>e.length)break;let l=e.subarray(t+4,t+4+n);t+=4+n,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 s=new Uint8Array(4+e.length);new DataView(s.buffer).setUint32(0,e.length,!1),s.set(e,4);try{let e=new EncodedVideoChunk({type:5===t?"key":"delta",timestamp:this.ts,data:s});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 s=e.subarray(1),n=t.subarray(1),l=new Uint8Array(11+s.length+3+n.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++]=s.length>>8&255,l[i++]=255&s.length,l.set(s,i),i+=s.length,l[i++]=1,l[i++]=n.length>>8&255,l[i++]=255&n.length,l.set(n,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),s=new VideoDecoder({output:e=>{var t;let s=this.canvas.getContext("2d");if(!s){e.close();return}(this.canvas.width!==e.displayWidth||this.canvas.height!==e.displayHeight)&&(this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight),s.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 s.configure({codec:t,description:e,optimizeForLatency:!0}),this.decoder=s,this.configured=!0}catch(e){this.onDecodeError(e.message||String(e))}finally{this.configuring=!1}}}constructor(e,t,s){this.canvas=e,this.onDecodeError=t,this.onFrame=s,this.buf=new Uint8Array(0),this.decoder=null,this.configured=!1,this.configuring=!1,this.ts=0,this.sps=null,this.pps=null}}function X(){return"undefined"!=typeof VideoDecoder&&"undefined"!=typeof VideoFrame}let Q="live-hub-adb-bookmarks-v1";function ee(e,t,s){let n,l,i,r;let a=e.getBoundingClientRect(),o=e.width,c=e.height;if(!o||!c)return null;let d=a.width/a.height,u=o/c;u>d?(n=a.width,l=a.width/u,i=0,r=(a.height-l)/2):(l=a.height,n=a.height*u,i=(a.width-n)/2,r=0);let x=t-a.left-i,m=s-a.top-r;return x<0||m<0||x>n||m>l?null:{x:Math.max(0,Math.min(o-1,Math.round(x/n*o))),y:Math.max(0,Math.min(c-1,Math.round(m/l*c)))}}function et(e,t,s){let n,l,i,r;let a=e.getBoundingClientRect(),o=e.naturalWidth,c=e.naturalHeight;if(!o||!c)return null;let d=a.width/a.height,u=o/c;u>d?(n=a.width,l=a.width/u,i=0,r=(a.height-l)/2):(l=a.height,n=a.height*u,i=(a.width-n)/2,r=0);let x=t-a.left-i,m=s-a.top-r;return x<0||m<0||x>n||m>l?null:{x:Math.max(0,Math.min(o-1,Math.round(x/n*o))),y:Math.max(0,Math.min(c-1,Math.round(m/l*c)))}}let es=[0,280,450,700,1100];function en(e){switch(e){case"usb":return{Icon:B.Z,zh:"USB",en:"USB",cls:"bg-amber-500/20 text-amber-100 ring-amber-500/35"};case"tcp":return{Icon:E.Z,zh:"网络",en:"TCP",cls:"bg-cyan-500/20 text-cyan-100 ring-cyan-500/35"};case"emulator":return{Icon:C.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 el="https://github.com/Genymobile/scrcpy",ei="https://github.com/viarotel-org/escrcpy";function er(e,t){let s=t.startsWith("/")?t:"/".concat(t),n=(e||"").trim().replace(/\/$/,"");return n?"".concat(n).concat(s):s}function ea(e){var t;let{t:s,apiBase:l,fetchJson:i,serial:r,devices:a,setSerial:o,adbAvailable:c,lock:u,overview:x,onAndroidAction:m,notify:h,onRefreshDevices:g}=e,[b,f]=(0,Z.useState)(0),[v,y]=(0,Z.useState)(450),[j,N]=(0,Z.useState)(!1),[k,_]=(0,Z.useState)(null),[S,z]=(0,Z.useState)(null),[C,R]=(0,Z.useState)(!0),[L,P]=(0,Z.useState)(""),[M,T]=(0,Z.useState)(""),[E,U]=(0,Z.useState)("37777"),[I,D]=(0,Z.useState)(""),[A,O]=(0,Z.useState)(!1),[B,ea]=(0,Z.useState)([]),[eo,ec]=(0,Z.useState)(!1),[ed,eu]=(0,Z.useState)(null),[ex,em]=(0,Z.useState)(!1),[ep,eh]=(0,Z.useState)(null),[eg,eb]=(0,Z.useState)(null),[ef,ev]=(0,Z.useState)(!0),ey=(0,Z.useRef)(null),ew=(0,Z.useRef)(null),ej=(0,Z.useRef)(null),eN=(0,Z.useRef)(null),ek=(0,Z.useRef)(null),e_=(0,Z.useRef)(null),eS=(0,Z.useRef)(0),ez=(0,Z.useRef)(!1),eC=(0,Z.useRef)(null),eR=(0,Z.useRef)(!1),eL=null===(t=a.find(e=>e.serial===r))||void 0===t?void 0:t.transport,eP=v>0,eM=r?"".concat(er(l,"/android/screenshot"),"?serial=").concat(encodeURIComponent(r),"&ts=").concat(b).concat(eP?"&fast=1":""):"",eT=(0,Z.useCallback)(()=>{f(e=>e+1)},[]),eE=(0,Z.useCallback)(()=>{null!=eC.current&&(window.clearTimeout(eC.current),eC.current=null)},[]);(0,Z.useEffect)(()=>{let e=()=>ev("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,Z.useEffect)(()=>{try{let e=window.localStorage.getItem(Q);if(e){let t=JSON.parse(e);Array.isArray(t)&&ea(t.map(String).filter(Boolean).slice(0,24))}}catch(e){}},[]);let eU=e=>{let t=e.trim();if(!t)return;let n=[t,...B.filter(e=>e!==t)].slice(0,16);ea(n);try{window.localStorage.setItem(Q,JSON.stringify(n))}catch(e){}h(s("已保存快捷地址","Saved quick address"))};(0,Z.useEffect)(()=>{if(!r||!c){z(null);return}let e=!1;return(async()=>{try{let t=await (0,V.N)("".concat(er(l,"/android/display_metrics"),"?serial=").concat(encodeURIComponent(r)));if(e)return;"number"==typeof t.width&&"number"==typeof t.height&&z({width:t.width,height:t.height})}catch(e){}})(),()=>{e=!0}},[l,c,r]),(0,Z.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,Z.useEffect)(()=>{ef&&c&&r&&!eo&&eT()},[c,eT,ef,r,eo]),(0,Z.useEffect)(()=>{if(!c){eb(null);return}let e=!1;return(async()=>{try{let t=await (0,V.N)(er(l,"/android/scrcpy/info"));e||eb(t)}catch(e){}})(),()=>{e=!0}},[l,c]),(0,Z.useEffect)(()=>{eo||eh(null)},[eo]),(0,Z.useEffect)(()=>{eu(null),ez.current=!1},[r]),(0,Z.useEffect)(()=>{let e=a.find(e=>e.serial===r),t=!!(r&&ed===r);if(c&&r&&(null==e?void 0:e.state)==="device"&&(null==eg?void 0:eg.server_jar)&&X()&&!t){ec(!0),y(0);return}if(t||!r||!c||eg&&!eg.server_jar||!X()||e&&"device"!==e.state){ec(!1);return}},[r,a,c,eg,ed]),(0,Z.useEffect)(()=>{if(!eo||!r||!c){var e,t;eE(),ez.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(!X()){eh(s("当前浏览器不支持 WebCodecs H.264","WebCodecs H.264 not supported in this browser")),ec(!1);return}let n=ej.current;if(!n)return;let i=e=>{var t;eE(),ez.current=!0,null===(t=eN.current)||void 0===t||t.close(),eh(e),ec(!1),y(450),eu(r),window.setTimeout(()=>eT(),120)},a=new $(n,e=>i("".concat(s("实时画面解码失败,已切回截图模式","Live stream decode failed, using screenshot mode"),": ").concat(e)),()=>{eR.current=!0,eE()});ek.current=a,ez.current=!1,eR.current=!1;let o=new WebSocket(function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1920,n=(function(e){let t=(e||"").trim();if(t)try{let e=new URL(t,window.location.href),s="https:"===e.protocol?"wss:":"ws:";return"".concat(s,"//").concat(e.host)}catch(e){}let s=void 0!==J&&J.env.NEXT_PUBLIC_API_URL?String(J.env.NEXT_PUBLIC_API_URL).trim():"";if(s)try{let e=new URL(s,window.location.href),t="https:"===e.protocol?"wss:":"ws:";return"".concat(t,"//").concat(e.host)}catch(e){}let n=window.location.port;if("3000"===n||"3001"===n){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(s)});return"".concat(n,"/android/scrcpy/ws?").concat(l.toString())}(l,r));return eN.current=o,o.binaryType="arraybuffer",o.onopen=()=>{em(!0),eh(null),eE(),eC.current=window.setTimeout(()=>{eR.current||i(s("实时画面无首帧,已切回截图模式","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&&eh(t.error)}catch(e){}return}null===(t=ek.current)||void 0===t||t.push(e.data)},o.onerror=()=>{eh(s("WebSocket 异常","WebSocket error"))},o.onclose=()=>{var e;em(!1),null===(e=ek.current)||void 0===e||e.reset(),ek.current=null,eE(),eo&&!ez.current&&i(s("实时画面连接失败,已切回截图模式","Live stream failed, using screenshot mode"))},()=>{eE(),ez.current=!0,eR.current=!1,o.close(),eN.current=null,a.reset(),ek.current===a&&(ek.current=null)}},[eo,r,c,l,eT,eE,s]),(0,Z.useEffect)(()=>{r&&c&&(eS.current=0,f(e=>e+1))},[r,c]);let eZ=async()=>{let e=L.trim();if(!e){h(s("填写 host:port","Enter host:port"));return}O(!0);try{let t=await i("/android/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e})});h(t.message||(t.ok?"OK":s("连接结果见日志","See message"))),g(),eT()}catch(e){h(e.message)}finally{O(!1)}},eI=async e=>{O(!0);try{let t=await i("/android/disconnect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e})});h(t.message||"OK"),g()}catch(e){h(e.message)}finally{O(!1)}},eD=async()=>{let e=M.trim(),t=parseInt(E,10)||37777,n=I.trim();if(!e||!n){h(s("填写配对 IP 与码","Host + code required"));return}O(!0);try{let l=await i("/android/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({host:e,port:t,code:n})});h(l.message||(l.ok?s("配对成功后再点连接","Paired — now Connect"):"pair"))}catch(e){h(e.message)}finally{O(!1)}},eA=async e=>{if(!C||u||!c||!r)return;let t=ew.current;if(!t)return;let n=et(t,e.clientX,e.clientY);if(!n)return;let l=Date.now(),i=ey.current;i&&l-i.t<320&&28>Math.abs(i.x-n.x)&&28>Math.abs(i.y-n.y)?(ey.current=null,await m("double_tap",{x:n.x,y:n.y}),h(s("双击","Double tap"))):(ey.current={t:l,x:n.x,y:n.y},await m("tap",{x:n.x,y:n.y})),eT()},eO=async e=>{if(e.preventDefault(),u||!c||!r)return;let t=ew.current;if(!t)return;let n=et(t,e.clientX,e.clientY);n&&(await m("long_press",{x:n.x,y:n.y,duration:720}),h(s("长按","Long press")),eT())},eB=async e=>{if(!C||u||!c||!r)return;let t=ej.current;if(!t)return;let n=ee(t,e.clientX,e.clientY);if(!n)return;let l=Date.now(),i=ey.current;i&&l-i.t<320&&28>Math.abs(i.x-n.x)&&28>Math.abs(i.y-n.y)?(ey.current=null,await m("double_tap",{x:n.x,y:n.y}),h(s("双击","Double tap"))):(ey.current={t:l,x:n.x,y:n.y},await m("tap",{x:n.x,y:n.y})),eo||eT()},eF=async e=>{if(e.preventDefault(),u||!c||!r)return;let t=ej.current;if(!t)return;let n=ee(t,e.clientX,e.clientY);n&&(await m("long_press",{x:n.x,y:n.y,duration:720}),h(s("长按","Long press")),eo||eT())};if(!c)return(0,n.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:s("宿主机未安装 adb,无法使用 Live 控制台。","adb is required for the Live console.")});let eW=en(eL),eH=eW.Icon;return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.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,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-white/[0.06] pb-3",children:[(0,n.jsx)(F.Z,{className:"h-4 w-4 text-sky-400"}),(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:s("链路管理","Link manager")}),(0,n.jsx)("span",{className:"text-[10px] text-zinc-500",children:s("USB / Redroid :5555 / 无线调试(先配对再连接)","USB \xb7 Redroid :5555 \xb7 wireless (pair then connect)")})]}),(0,n.jsxs)("div",{className:"mt-3 grid gap-3 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"space-y-2 rounded-xl border border-white/[0.06] bg-black/35 p-3",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:"adb connect"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.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:L,onChange:e=>P(e.target.value),onKeyDown:e=>"Enter"===e.key&&void eZ()}),(0,n.jsx)("button",{type:"button",disabled:A||u,onClick:()=>void eZ(),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:A?"…":"Connect"}),(0,n.jsx)("button",{type:"button",disabled:A||u||!L.trim(),onClick:()=>eU(L),className:"rounded-lg border border-white/10 px-3 py-2 text-xs text-zinc-400 hover:text-zinc-200",children:s("存书签","Pin")})]}),B.length?(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5 pt-1",children:B.map(e=>(0,n.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:()=>P(e),children:e},e))}):null,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 pt-2",children:[(0,n.jsx)("button",{type:"button",disabled:A||u||!r,onClick:()=>void eI(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:s("断开当前 TCP","Disconnect current")}),(0,n.jsx)("button",{type:"button",disabled:A||u,onClick:()=>void eI(""),className:"rounded-lg border border-white/10 px-2.5 py-1.5 text-[10px] text-zinc-500 hover:text-zinc-300",children:s("断开全部 TCP","Disconnect all TCP")}),(0,n.jsxs)("button",{type:"button",disabled:A||u,onClick:()=>{g(),eT(),h(s("已刷新设备列表","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,n.jsx)(w.Z,{className:"h-3 w-3"}),"ADB list"]})]})]}),(0,n.jsxs)("div",{className:"space-y-2 rounded-xl border border-white/[0.06] bg-black/35 p-3",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:"adb pair(无线调试)"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.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:M,onChange:e=>T(e.target.value)}),(0,n.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=>U(e.target.value)}),(0,n.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:I,onChange:e=>D(e.target.value)}),(0,n.jsx)("button",{type:"button",disabled:A||u,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,n.jsx)("p",{className:"text-[10px] leading-relaxed text-zinc-600",children:s("手机上「无线调试」会显示配对端口与 6 位码;配对成功后用上方 connect 连接 adb 显示的 IP:5555。","Use the pairing port + 6-digit code from Wireless debugging; then connect to the listed adb IP:5555.")})]})]})]}),(0,n.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,n.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,n.jsxs)("div",{className:"relative rounded-[1.35rem] border border-white/[0.06] bg-zinc-950/80 p-4 backdrop-blur-sm",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.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,n.jsx)(p.Z,{className:"h-6 w-6 text-emerald-200"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-base font-semibold tracking-tight text-white",children:s("无人直播系统 \xb7 ADB 云控台","Unmanned Live System \xb7 ADB farm console")}),(0,n.jsxs)("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-zinc-500",children:[s("统一适配 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,n.jsx)("a",{href:ei,target:"_blank",rel:"noreferrer",className:"text-emerald-300/90 underline-offset-2 hover:underline",children:"escrcpy"}),s(" / "," / "),(0,n.jsx)("a",{href:el,target:"_blank",rel:"noreferrer",className:"text-emerald-300/90 underline-offset-2 hover:underline",children:"scrcpy"}),s(");无 jar 或关闭真流时用截图。","); PNG screenshot when jar missing or stream off.")]})]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 flex-col gap-1.5 self-start sm:flex-row",children:[(0,n.jsxs)("a",{href:ei,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,n.jsx)(W.Z,{className:"h-3.5 w-3.5 opacity-70"})]}),(0,n.jsxs)("a",{href:el,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,n.jsx)(W.Z,{className:"h-3.5 w-3.5 opacity-70"})]})]})]}),a.length>0?(0,n.jsxs)("div",{className:"mt-5",children:[(0,n.jsxs)("p",{className:"mb-2 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:[(0,n.jsx)(H.Z,{className:"h-3.5 w-3.5"}),s("设备矩阵","Device matrix")]}),(0,n.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=en(e.transport),a=i.Icon;return(0,n.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,n.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-zinc-200",children:[(0,n.jsx)(d.Z,{className:"h-3.5 w-3.5 text-emerald-400/80"}),(0,n.jsx)("span",{className:"truncate",children:e.model||e.serial.slice(0,10)})]}),(0,n.jsx)("span",{className:"mt-0.5 truncate font-mono text-[9px] text-zinc-600",children:e.serial}),(0,n.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1",children:[(0,n.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,n.jsx)(a,{className:"h-2.5 w-2.5"}),s(i.zh,i.en)]}),(0,n.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,n.jsxs)("div",{className:"mt-6 grid gap-6 xl:grid-cols-12",children:[(0,n.jsxs)("div",{className:"xl:col-span-8",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-white/[0.06] pb-3",children:[(0,n.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:s("刷新间隔","Interval")}),es.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>y(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?s("手动","Manual"):"".concat(e,"ms")},e)),(0,n.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(eW.cls),children:[(0,n.jsx)(eH,{className:"h-3 w-3"}),"tcp"===eL?s("建议 ≥450ms","Suggest ≥450ms"):s("可试 280ms","Try 280ms")]}),(0,n.jsxs)("button",{type:"button",disabled:u,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,n.jsx)(w.Z,{className:"h-3 w-3 ".concat(j?"animate-spin":"")}),s("下一帧","Next frame")]}),(0,n.jsx)("button",{type:"button",disabled:u||!r,onClick:()=>void m("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,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-[10px] text-zinc-400",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/50",checked:C,onChange:e=>R(e.target.checked)}),(0,n.jsx)(K.Z,{className:"h-3 w-3"}),s("点按穿透","Tap-through")]}),(0,n.jsxs)("button",{type:"button",disabled:u||!r||!(null==eg?void 0:eg.server_jar),title:eg&&!eg.server_jar&&eg.hint_zh?eg.hint_zh:s("官方 scrcpy-server + WebSocket H.264","Official scrcpy-server + WebSocket H.264"),onClick:()=>{ec(e=>{let t=!e;return t?(eu(null),h(s("已开启实时画面(H.264 WebSocket)","Live H.264 WebSocket stream on"))):(r&&eu(r),h(s("已关闭实时画面(将使用截图)","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,n.jsx)(Y.Z,{className:"h-3 w-3"}),eo?s("关闭真流","Stop WS"):s("实时画面","Live H.264")]})]}),eg&&!eg.server_jar?(0,n.jsxs)("p",{className:"mt-2 text-[10px] text-amber-200/80",children:[s("未检测到 scrcpy-server:启动时会自动拉取;内网可在 runtime.env 配置 SCRCPY_SERVER_DOWNLOAD_URL(支持 {tag})。","scrcpy-server missing: auto-fetched on startup; set SCRCPY_SERVER_DOWNLOAD_URL ({tag}) for mirrors."),eg.server_version?" (".concat(s("期望版本","version")," ").concat(eg.server_version,")"):null]}):null,(0,n.jsx)("p",{className:"mt-2 text-[10px] text-zinc-600",children:s("快捷键(镜像区聚焦时):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,n.jsxs)("div",{className:"relative mx-auto mt-4 max-h-[min(78vh,720px)] min-h-[280px]",children:[r?(0,n.jsxs)("div",{ref:e_,tabIndex:0,onKeyDown:e=>{if(!r||u)return;let t=e.target.tagName;if("INPUT"===t||"TEXTAREA"===t||"SELECT"===t)return;let s={h:["key",{keycode:"3"}],b:["key",{keycode:"4"}],r:["key",{keycode:"187"}],w:["wake",void 0],m:["key",{keycode:"82"}]}[e.key.toLowerCase()];s&&(e.preventDefault(),(async()=>{await m(s[0],s[1]),eo||eT()})())},className:"relative flex justify-center outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/50",children:[(0,n.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,n.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,n.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:eB,onContextMenu:eF}):(0,n.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,_(null)},onError:()=>{N(!1),eS.current+=1,eS.current<=3?(_(null),window.setTimeout(()=>eT(),380+200*eS.current)):_(s("截图连续失败:检查 USB 授权 / 无线是否断开 / Redroid 端口","Screenshot failed repeatedly"))},onClick:eA,onContextMenu:eO})]}),ex?(0,n.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,n.jsx)(Y.Z,{className:"h-3 w-3"}),"SCRCPY\xb7WS"]}):v>0&&!eo?(0,n.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,n.jsx)(G.Z,{className:"h-3 w-3"}),"LIVE"]}):eo?null:(0,n.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,n.jsx)(q.Z,{className:"h-3 w-3"}),s("单帧","Still")]})]}):(0,n.jsx)("p",{className:"py-16 text-center text-sm text-zinc-600",children:s("请选择或连接设备","Pick or connect a device")}),ep?(0,n.jsx)("p",{className:"mt-3 text-center text-xs text-rose-300",children:ep}):null,k&&!eo?(0,n.jsx)("p",{className:"mt-3 text-center text-xs text-rose-300",children:k}):null,(0,n.jsx)("p",{className:"mt-3 text-center text-[10px] text-zinc-600",children:s("左键单击 / 双击 \xb7 右键长按 \xb7 坐标对齐 PNG 像素","Left tap/double \xb7 right long-press \xb7 PNG pixel coords")})]})]}),(0,n.jsxs)("div",{className:"space-y-4 xl:col-span-4",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.07] bg-black/40 p-4",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:s("遥测","Telemetry")}),x?(0,n.jsxs)("dl",{className:"mt-3 space-y-2 font-mono text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"device"}),(0,n.jsxs)("dd",{className:"text-right text-zinc-200",children:[x.brand," ",x.model]})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"Android"}),(0,n.jsxs)("dd",{className:"text-zinc-300",children:[x.android_version," (API ",x.sdk,")"]})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"wm size"}),(0,n.jsx)("dd",{className:"text-cyan-300/90",children:S?"".concat(S.width,"\xd7").concat(S.height):x.resolution||"—"})]}),(0,n.jsx)("div",{className:"whitespace-pre-wrap text-[10px] leading-snug text-zinc-500",children:x.battery})]}):(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-600",children:s("在上方点「刷新设备信息」","Use Refresh device info above")})]}),(0,n.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,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-violet-300/80",children:s("导航坞","Nav dock")}),(0,n.jsx)("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[["3","Home"],["4","Back"],["187","Recents"]].map(e=>{let[t,s]=e;return(0,n.jsx)("button",{type:"button",disabled:u||!r,onClick:()=>{m("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:s},t)})}),(0,n.jsxs)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:u||!r,onClick:()=>{m("key",{keycode:"24"}),eT()},className:"rounded-xl border border-white/10 bg-black/30 py-2 text-[11px] text-zinc-300",children:"Vol+"}),(0,n.jsx)("button",{type:"button",disabled:u||!r,onClick:()=>{m("key",{keycode:"25"}),eT()},className:"rounded-xl border border-white/10 bg-black/30 py-2 text-[11px] text-zinc-300",children:"Vol−"})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-cyan-500/[0.05] p-4",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-cyan-300/80",children:s("手势","Gestures")}),(0,n.jsx)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:["up","down","left","right"].map(e=>(0,n.jsx)("button",{type:"button",disabled:u||!r,onClick:()=>{m("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 eo=[{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 ec(e,t,s){return e?(0,n.jsx)("span",{className:"rounded bg-emerald-500/15 px-2 py-0.5 text-[10px] text-emerald-200",children:t}):(0,n.jsx)("span",{className:"rounded bg-zinc-500/15 px-2 py-0.5 text-[10px] text-zinc-400",children:s})}function ed(e){var t,s,l,i,r,a,o,c,d,u,x,m,p,h,g;let{t:b,notify:f,fetchJson:v,apiBase:w,busy:j,androidSerial:N,setAndroidSerial:k,devices:_,adbAvailable:S,apkPath:z,setApkPath:C,onAndroidAction:L,onCopy:P,onRefreshDevices:T}=e,[E,U]=(0,Z.useState)(null),[I,B]=(0,Z.useState)(null),[F,W]=(0,Z.useState)(null),[H,K]=(0,Z.useState)(null),[Y,G]=(0,Z.useState)(""),[q,J]=(0,Z.useState)([]),[V,$]=(0,Z.useState)("getprop ro.product.model"),[X,Q]=(0,Z.useState)(""),[ee,et]=(0,Z.useState)("300"),[es,en]=(0,Z.useState)(""),[el,ei]=(0,Z.useState)(null),[er,ed]=(0,Z.useState)([]),[eu,ex]=(0,Z.useState)(null),[em,ep]=(0,Z.useState)("https://"),[eh,eg]=(0,Z.useState)(""),[eb,ef]=(0,Z.useState)(!1),[ev,ey]=(0,Z.useState)(null),ew=!!(j||ev),ej=_.find(e=>e.serial===N)||null,eN=(0,Z.useCallback)(async()=>{if(!N||!S){U(null),B(null);return}ey("overview"),B(null);try{let e=await v("/android/overview?serial=".concat(encodeURIComponent(N)));U(e)}catch(e){U(null),B(e.message)}finally{ey(null)}},[S,N,v]),ek=(0,Z.useCallback)(async()=>{K(null);try{let e=await v("/redroid/summary");W(e)}catch(e){W(null),K(e.message)}},[v]);(0,Z.useEffect)(()=>{eN()},[eN]),(0,Z.useEffect)(()=>{ek()},[ek]);let e_=async()=>{if(!N){f(b("请选择设备","Pick a device"));return}ey("packages");try{let e=encodeURIComponent(Y.trim()),t=await v("/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(b("请选择设备","Pick a device"));return}let e=V.trim();if(e){ey("shell");try{var t,s;let n=await v("/android/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"shell",serial:N,payload:{command:e}})});Q(null!==(s=null!==(t=n.output)&&void 0!==t?t:n.message)&&void 0!==s?s:"")}catch(e){Q(e.message)}finally{ey(null)}}},ez=(0,Z.useCallback)(async e=>{if(!N)return;let t=Math.min(3e3,Math.max(1,parseInt(ee,10)||200)),s=!!(null==e?void 0:e.silent);s||ey("logcat"),ei(null);try{var n;let e=await v("/android/logcat?serial=".concat(encodeURIComponent(N),"&lines=").concat(t));en(null!==(n=e.text)&&void 0!==n?n:"")}catch(e){en(""),ei(e.message)}finally{s||ey(null)}},[N,v,ee]);(0,Z.useEffect)(()=>{if(!eb||!N||!S)return;let e=window.setInterval(()=>void ez({silent:!0}),3e3);return ez({silent:!0}),()=>clearInterval(e)},[S,N,eb,ez]);let eC=async()=>{if(!N){f(b("请选择设备","Pick a device"));return}ey("ui"),ex(null);try{let e=await v("/android/ui?serial=".concat(encodeURIComponent(N),"&limit=100"));ed(e.nodes||[])}catch(e){ed([]),ex(e.message)}finally{ey(null)}},eR=async(e,t)=>{ey("redroid:".concat(e));try{let s=await v("/redroid/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,name:t||""})});s.summary&&W(s.summary),f(s.message||"OK"),await ek(),T()}catch(e){f(e.message)}finally{ey(null)}},eL=async e=>{await L("key",{keycode:e})},eP=async()=>{let e=eh.trim();if(!e){f(b("请输入文字","Enter text"));return}await L("text",{text:e})},eM=async()=>{let e=em.trim();if(!e||"https://"===e){f(b("请输入 URL","Enter URL"));return}await L("open_url",{url:e})};return(0,n.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:b("安卓设备工作台","Android workstation")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:b("USB 真机与 Redroid 共用一套控制面,优先保证 USB 真机稳定。","USB phone and Redroid share one control surface.")})]}),S?(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.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:b("刷新设备","Refresh device")}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>{ek(),T()},className:"rounded-lg border border-white/10 bg-white/[0.05] px-3 py-1.5 text-xs text-zinc-300",children:b("刷新 Redroid","Refresh Redroid")})]}):(0,n.jsx)("span",{className:"text-xs text-amber-200/90",children:b("宿主机未检测到 adb","adb not found on host")})]}),(0,n.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:_.map(e=>(0,n.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,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"font-medium text-zinc-200",children:e.model||e.serial}),e.transport?(0,n.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,n.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,n.jsx)("div",{className:"text-[10px] text-zinc-600",children:e.serial}),"device"!==(e.state||"").toLowerCase()?(0,n.jsx)("div",{className:"mt-1 text-[10px] font-medium text-amber-200/90",children:"unauthorized"===e.state?b("未授权,请在手机上允许 USB 调试。","Unauthorized, allow USB debugging on device."):"".concat(b("状态","State"),": ").concat(e.state)}):null]},e.serial))}),S&&0===_.length?(0,n.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:b("当前没有已授权设备。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,n.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/15 bg-zinc-950/50 p-5",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-violet-300/90",children:b("真机诊断","Phone diagnostics")}),I?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:I}):null,E?(0,n.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,n.jsxs)("dl",{className:"space-y-1.5 font-mono text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"model"})," ",(0,n.jsxs)("dd",{className:"inline text-zinc-300",children:[E.brand," ",E.model]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"android"})," ",(0,n.jsxs)("dd",{className:"inline text-zinc-300",children:[E.android_version," (sdk ",E.sdk,")"]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"kind"})," ",(0,n.jsxs)("dd",{className:"inline text-zinc-300",children:[E.kind||(null==ej?void 0:ej.kind)||"unknown"," / ",E.transport||(null==ej?void 0:ej.transport)||"unknown"]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"display"})," ",(0,n.jsx)("dd",{className:"inline text-zinc-300",children:E.resolution})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"rotation"})," ",(0,n.jsx)("dd",{className:"inline text-zinc-300",children:E.rotation})]}),(0,n.jsx)("div",{className:"whitespace-pre-wrap text-[10px] leading-snug text-zinc-500",children:E.battery}),(0,n.jsx)("div",{className:"line-clamp-3 text-[10px] text-zinc-500",children:E.focus})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[ec(null===(t=E.diagnostics)||void 0===t?void 0:t.ready,b("已启动","Boot ready"),b("未完成启动","Boot pending")),ec(null===(s=E.diagnostics)||void 0===s?void 0:s.google_play,"Google Play","No Play"),ec(null===(l=E.diagnostics)||void 0===l?void 0:l.google_services,"GMS","No GMS"),ec(null===(i=E.diagnostics)||void 0===i?void 0:i.magisk,"Magisk","No Magisk"),ec(null===(r=E.diagnostics)||void 0===r?void 0:r.root,"Root","No root")]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/5 bg-black/20 p-3 text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{children:["boot_completed: ",(null===(a=E.diagnostics)||void 0===a?void 0:a.boot_completed)||"-"]}),(0,n.jsxs)("div",{children:["provisioned: ",(null===(o=E.diagnostics)||void 0===o?void 0:o.device_provisioned)||"-"]}),(0,n.jsxs)("div",{children:["setup_complete: ",(null===(c=E.diagnostics)||void 0===c?void 0:c.user_setup_complete)||"-"]}),(0,n.jsxs)("div",{children:["abi: ",(null===(d=E.diagnostics)||void 0===d?void 0:d.abi)||"-"]}),(0,n.jsxs)("div",{className:"truncate",children:["hardware: ",(null===(u=E.diagnostics)||void 0===u?void 0:u.hardware)||"-"]})]})]}):I?null:(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:b("加载中","Loading")})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-zinc-950/50 p-5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-300/90",children:b("Redroid 板块","Redroid panel")}),(0,n.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:b("启动默认实例","Start default")})]}),H?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:H}):null,F?(0,n.jsxs)("div",{className:"mt-3 space-y-3 text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,n.jsxs)("div",{children:["arch: ",F.arch||"-"]}),(0,n.jsxs)("div",{className:"truncate",children:["image: ",F.image||"-"]}),(0,n.jsxs)("div",{children:["profile: ",F.device_profile||"-"]}),(0,n.jsxs)("div",{children:["gpu: ",F.gpu_mode||"-"]}),(0,n.jsxs)("div",{children:["adb: 127.0.0.1:",F.default_port||5555]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[ec(null===(x=F.requirements)||void 0===x?void 0:x.docker_available,"Docker","No Docker"),ec(null===(m=F.requirements)||void 0===m?void 0:m.adb_available,"ADB","No ADB"),ec(null===(p=F.requirements)||void 0===p?void 0:p.kvm,"KVM","No KVM"),ec(null===(h=F.requirements)||void 0===h?void 0:h.binderfs,"binderfs","No binderfs")]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(F.instances||[]).map(e=>{var t,s,l,i;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-medium text-zinc-100",children:e.name}),(0,n.jsxs)("div",{className:"font-mono text-[10px] text-zinc-500",children:[e.port?"127.0.0.1:".concat(e.port):"-"," / ",e.status_text||"-"]})]}),(0,n.jsxs)("div",{className:"flex gap-1",children:[(0,n.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,n.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,n.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,n.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,n.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[ec(null===(t=e.diagnostics)||void 0===t?void 0:t.ready,b("系统就绪","System ready"),b("启动中","Booting")),ec(null===(s=e.diagnostics)||void 0===s?void 0:s.google_play,"Play","No Play"),ec(null===(l=e.diagnostics)||void 0===l?void 0:l.magisk,"Magisk","No Magisk"),ec(null===(i=e.diagnostics)||void 0===i?void 0:i.root,"Root","No root")]}),e.data_dir?(0,n.jsx)("div",{className:"mt-2 truncate font-mono text-[10px] text-zinc-500",children:e.data_dir}):null]},e.name)}),(null===(g=F.instances)||void 0===g?void 0:g.length)?null:(0,n.jsx)("p",{className:"rounded-xl border border-white/5 bg-black/20 p-3 text-xs text-zinc-500",children:b("当前没有 Redroid 实例。默认动作会创建 redroid13-1。","No Redroid instances yet. Default actions create redroid13-1.")})]})]}):(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:b("读取 Redroid 状态中","Loading Redroid status")})]})]}),(0,n.jsx)(ea,{t:b,apiBase:w,fetchJson:v,serial:N,devices:_,setSerial:k,adbAvailable:S,lock:ew,overview:E,onAndroidAction:L,notify:f,onRefreshDevices:T}),S&&N?(0,n.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-emerald-300/90",children:b("快捷控制","Quick controls")}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL("3"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Home"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL("4"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Back"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL("187"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Recents"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void L("wake"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Wake"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void L("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,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL("24"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Vol+"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL("25"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Vol-"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL("66"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Enter"})]}),(0,n.jsx)("p",{className:"mt-3 text-[10px] text-zinc-600",children:b("滑动手势","Swipe gestures")}),(0,n.jsx)("div",{className:"mt-1 flex flex-wrap gap-2",children:["up","down","left","right"].map(e=>(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void L("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,n.jsxs)("div",{className:"mt-4 rounded-lg border border-white/5 bg-black/20 p-3",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:b("ADB 文本输入","ADB text input")}),(0,n.jsxs)("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row",children:[(0,n.jsx)("input",{className:"min-w-0 flex-1 rounded-lg border border-white/10 bg-black/40 px-3 py-2 text-xs",value:eh,onChange:e=>eg(e.target.value),placeholder:"hello / 123",onKeyDown:e=>{"Enter"===e.key&&eP()}}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP(),className:"rounded-lg bg-emerald-500/20 px-3 py-2 text-xs text-emerald-100 ring-1 ring-emerald-500/30",children:b("发送","Send")})]})]}),(0,n.jsxs)("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row sm:items-center",children:[(0,n.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=>ep(e.target.value),placeholder:"https://"}),(0,n.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:b("打开链接","Open URL")})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,n.jsxs)("h4",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-cyan-300/90",children:[(0,n.jsx)(R.Z,{className:"h-4 w-4"}),b("USB 真机优化建议","USB optimization")]}),(0,n.jsxs)("ul",{className:"mt-3 space-y-2 text-xs leading-relaxed text-zinc-400",children:[(0,n.jsx)("li",{children:b("优先使用主板直连 USB,不要经过不稳的 HUB。","Prefer direct motherboard USB, not unstable hubs.")}),(0,n.jsx)("li",{children:b("开发板端固定 adb server,避免频繁 kill-server。","Keep adb server stable and avoid frequent kill-server.")}),(0,n.jsx)("li",{children:b("镜像页默认支持 scrcpy H.264 真流,截图模式作为回退。","Use scrcpy H.264 live stream first, screenshot mode as fallback.")}),(0,n.jsx)("li",{children:b("如果 TikTok / YouTube App 直播,要先确认屏幕常亮、分辨率稳定、USB 供电足够。","For TikTok / YouTube app live, keep screen on, resolution stable, and USB power sufficient.")})]})]})]}):null,S&&N?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(D.Z,{className:"h-4 w-4 text-emerald-400"}),b("包名搜索与启动","Packages")]}),(0,n.jsxs)("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row",children:[(0,n.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&&e_()}}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void e_(),className:"rounded-xl bg-emerald-500/20 px-4 py-2 text-sm text-emerald-100 ring-1 ring-emerald-500/30",children:b("搜索","Search")})]}),(0,n.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,n.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 py-1 text-zinc-400",children:[(0,n.jsx)("span",{className:"min-w-0 truncate text-zinc-300",children:e.package}),(0,n.jsxs)("span",{className:"flex shrink-0 gap-1",children:[(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void L("launch_package",{package:e.package}),className:"rounded bg-white/10 px-2 py-0.5 text-[10px] text-zinc-200",children:b("启动","Launch")}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void L("force_stop",{package:e.package}),className:"rounded bg-rose-500/15 px-2 py-0.5 text-[10px] text-rose-200",children:b("停止","Stop")})]})]},e.package)),q.length?null:(0,n.jsx)("li",{className:"py-2 text-center text-zinc-600",children:b("暂无结果","No results")})]})]}):null,S&&N?(0,n.jsxs)("div",{className:"grid gap-6 xl:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(A.Z,{className:"h-4 w-4 text-amber-400"}),"ADB shell"]}),(0,n.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:eo.map(e=>(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>$(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,n.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=>$(e.target.value),spellCheck:!1,onKeyDown:e=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),eS())}}),(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[(0,n.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,n.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}),"Run"]}):"Run"}),X?(0,n.jsxs)("button",{type:"button",disabled:!X,onClick:()=>P(X),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,n.jsx)(M.Z,{className:"h-3.5 w-3.5"}),b("复制输出","Copy")]}):null]}),X?(0,n.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:X}):null]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:b("Logcat","Logcat")}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,n.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,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 text-[11px] text-zinc-400",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:eb,onChange:e=>ef(e.target.checked)}),b("每 3 秒自动刷新","Auto every 3s")]}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void ez(),className:"rounded-xl bg-cyan-500/20 px-4 py-2 text-sm text-cyan-100 ring-1 ring-cyan-500/30",children:b("拉取日志","Pull logs")}),es?(0,n.jsxs)("button",{type:"button",onClick:()=>P(es),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,n.jsx)(M.Z,{className:"h-3.5 w-3.5"}),b("复制","Copy")]}):null]}),el?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:el}):null,es?(0,n.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:es}):null]})]}):null,S&&N?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(O.Z,{className:"h-4 w-4 text-fuchsia-400"}),b("界面节点","UI nodes")]}),(0,n.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:b("刷新节点","Refresh nodes")}),eu?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:eu}):null,(0,n.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:[er.map((e,t)=>(0,n.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,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"text-zinc-200",children:e.label}),e.resource_id?(0,n.jsx)("span",{className:"ml-2 font-mono text-[10px] text-zinc-600",children:e.resource_id}):null,(0,n.jsxs)("div",{className:"font-mono text-[10px] text-zinc-600",children:["(",e.center_x,", ",e.center_y,")",e.clickable?" click":""]})]}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void L("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))),er.length||eu?null:(0,n.jsx)("li",{className:"py-4 text-center text-zinc-600",children:b("尚未加载","Not loaded")})]})]}):null,S&&N?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:b("安装 APK","Install APK")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:b("先 adb push 到 /sdcard/ 再执行安装。","Push the APK to /sdcard/ first.")}),(0,n.jsx)("input",{className:"mt-4 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm",value:z,onChange:e=>C(e.target.value)}),(0,n.jsx)("button",{type:"button",disabled:ew||!S||!N,onClick:()=>void L("install_apk",{path:z}),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 eu=s(9897),ex=s(4554),em=s(7689),ep=s(8401);function eh(e){let{t,title:s,subtitle:l,steps:i,onNavigate:r}=e;return(0,n.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,n.jsx)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:s}),(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-400",children:l}),(0,n.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,n.jsxs)("div",{className:"flex items-center gap-4",children:[e.openUrl||e.target&&r?(0,n.jsxs)("button",{type:"button",onClick:()=>{if(e.openUrl){window.open((0,ep.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,n.jsx)("span",{children:e.label}),e.sub?(0,n.jsx)("span",{className:"mt-1 text-[10px] font-normal text-white/80",children:e.sub}):null]}):(0,n.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,n.jsx)("span",{children:e.label}),e.sub?(0,n.jsx)("span",{className:"mt-1 text-[10px] font-normal text-white/80",children:e.sub}):null]}),t1&&void 0!==arguments[1]&&arguments[1],s=e.replace(/kbits\/s/gi,"").replace(/x$/i,"").trim().match(/-?\d+(?:\.\d+)?/);if(!s)return;let n=t?parseInt(s[0],10):Number(s[0]);return Number.isFinite(n)?n:void 0}function ek(e){let t=e.toLowerCase();return!(t.includes("frame=")&&t.includes("speed="))&&(ej.some(e=>t.includes(e.toLowerCase()))||t.includes("error")||t.includes("failed"))}function e_(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=function(){for(var e=arguments.length,t=Array(e),s=0;s1&&void 0!==arguments[1]?arguments[1]:12,s=e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).slice(-t),n=-1,l="";for(let e=s.length-1;e>=0;e-=1){let t=s[e].toLowerCase();if(t.includes("frame=")&&t.includes("speed=")){n=e,l=s[e];break}}return n<0||s.slice(n+1).some(ek)?"":l}(t.filter(Boolean).join("\n").slice(-16e3)),l={};if(!n)return l;for(let e of n.matchAll(ew)){let t=e[1].toLowerCase(),s=e[2];if("frame"===t||"drop"===t||"dup"===t){let e=eN(s,!0);null!=e&&(l[t]=e)}else if("fps"===t||"speed"===t||"bitrate"===t){let e=eN(s);null!=e&&(l[t]=e)}}return l}(s),l=!!((null==e?void 0:e.is_pushing)||(null==e?void 0:e.ffmpeg_active));return{frame:eS(null==e?void 0:e.ffmpeg_frame,null==t?void 0:t.frame,n.frame),fps:eS(null==t?void 0:t.fps,n.fps),speed:eS(null==e?void 0:e.ffmpeg_speed,null==t?void 0:t.speed,n.speed),bitrate:eS(null==t?void 0:t.bitrate,n.bitrate),drop:eS(null==t?void 0:t.drop,n.drop),dup:eS(null==t?void 0:t.dup,n.dup),speedLow:null==e?void 0:e.ffmpeg_speed_low,progressStalled:null==e?void 0:e.ffmpeg_progress_stalled,live:l}}function eS(){for(var e=arguments.length,t=Array(e),s=0;s=1e3?"".concat((e/1e3).toFixed(1)," Mbps"):"".concat(Math.round(e)," kbps")}function eC(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if("number"!=typeof e||!Number.isFinite(e))return"—";let n=e>=100?String(Math.round(e)):e.toFixed(s).replace(/\.00$/,"");return"".concat(n).concat(t)}function eR(e,t){let s=["fps ".concat(eC(e.fps)),"speed ".concat(eC(e.speed,"x")),"frame ".concat(eC(e.frame,"",0))],n=ez(e.bitrate);return(n&&s.push(n),!(null==t?void 0:t.live)&&s.every(e=>e.endsWith("—")))?"":s.join(" \xb7 ")}function eL(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(e.startsWith("#")||!e)continue;let s=e.match(/^(?:key|stream_key)\s*=\s*(.+)$/i);if(s){let e=s[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("/"),s=t[t.length-1]||"";return s.length>8?s.slice(-8):s}}}let t=e.trim();return!t||t.includes("\n")||t.toLowerCase().startsWith("rtmp")?"":t.length>8?t.slice(-8):t}function eP(e){let t=[];for(let s of e.split(/\r?\n/)){let e=s.trim();if(!e||e.startsWith("#")||!/douyin\.com|v\.douyin\.com/i.test(e))continue;let n=e.match(/(https?:\/\/live\.douyin\.com\/[a-zA-Z0-9_-]+)/i);if(n){t.push(n[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 eM(e){let t=(e||"").trim().replace(/^[\s"'`[\]()()【】]+|[\s"'`[\]()()【】]+$/g,"");return!(t=(t=(t=(t=t.replace(/^(?:主播|房间名|直播间|抖音源|源站|标题)\s*[::]\s*/i,"")).replace(/https?:\/\/(?:www\.)?live\.douyin\.com\/[a-zA-Z0-9_-]+/gi,"")).replace(/(?:等待直播|正在直播|直播中|已开播|开始推流|主播已下播|下播|录制中|推流中).*$/i,"")).trim().replace(/^[\s,,;;||\-—::]+|[\s,,;;||\-—::]+$/g,""))||/^[-—_无未知]+$/i.test(t)||/^(unknown|null|undefined|none|nan)$/i.test(t)||/live\.douyin\.com/i.test(t)||/^\d{5,}$/.test(t)||/^(监测|格式|错误|无录制任务)/.test(t)?"":t.slice(0,48)}function eT(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=function(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(!e||e.startsWith("#"))continue;let s=e.match(/https?:\/\/(?:www\.)?live\.douyin\.com\/[a-zA-Z0-9_-]+/i);if(!s||null==s.index)continue;let n=eM(e.slice(s.index+s[0].length));if(n)return n;let l=e.split(/[,,||]/,2);if(l.length>1){let e=eM(l[1]);if(e)return e}}return""}(e),n=function(e){var t,s,n;let l=e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).slice(-160),i=/(?:主播|房间名|直播间|抖音源|源站|标题)\s*[::]\s*(.{1,80})/i,r=/(?:序号\s*\d+\s*)?(.{1,80}?)\s*(?:等待直播|主播已下播|下播)/i,a=/(?:获取失败|错误|异常|error|failed|exception)/i;for(let e of[/(?:正在录制|录制中)\s*\d*\s*个?\s*[::]\s*([^\[\r\n]{1,80})/i,/(?:序号\s*\d+\s*)?(.{1,80}?)\s*(?:正在直播中|正在直播|直播中|已开播|开始推流|录制中|推流中)/i])for(let s=l.length-1;s>=0;s-=1){let n=eM((null===(t=l[s].match(e))||void 0===t?void 0:t[1])||"");if(n)return n}for(let e=l.length-1;e>=0;e-=1){if(a.test(l[e]))continue;let t=eM((null===(s=l[e].match(i))||void 0===s?void 0:s[1])||"");if(t)return t}for(let e=l.length-1;e>=0;e-=1){let t=eM((null===(n=l[e].match(r))||void 0===n?void 0:n[1])||"");if(t)return t}return""}(t),l=eP(e).length,i=function(e){let t=e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).slice(-160),s=/(?:序号\s*\d+\s*)?(.{1,80}?)\s*(?:等待直播|主播已下播|下播)/i,n=/(?:获取失败|错误|异常|error|failed|exception)/i;for(let e=t.length-1;e>=0;e-=1){var l;if(n.test(t[e]))continue;let i=eM((null===(l=t[e].match(s))||void 0===l?void 0:l[1])||"");if(i)return i}return""}(t),r=/frame=.*speed=/i.test(t)||/(?:正在录制|录制中)\s*\d*\s*个?\s*[::]/i.test(t);if(l>1&&n&&!r&&n===i&&s)return s;let a=s||n;if(a)return a;let o=eE(t)||eU(e)[0]||"";return o?"抖音直播间 ".concat(o):""}function eE(e){if(!e)return null;let t=null;for(let s of e.split(/\r?\n/)){let e=s.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i);e&&(t=e[1]);let n=s.match(/https?:\/\/[^/\s]*douyin\.com\/(\d{8,})/i);n&&(t=n[1])}return t}function eU(e){let t=[];for(let s of e.split(/\r?\n/)){let e=s.trim();if(!e||e.startsWith("#")||!/douyin\.com|v\.douyin\.com/i.test(e))continue;let n=e.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i);if(n){t.push(n[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)}function eZ(e){let t="",s=!0,n="",l=!0,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?s=!/^(0|false|否)/i.test(c):"bitrate"===o?n=c:"fast_audio"===o&&(l=/^(1|true|yes|是|开|on)/i.test(c))}return{key:t,rtmps:s,bitrate:n,fastAudio:l}}function eI(e){return"URL_config.".concat(e.replace(/[^a-zA-Z0-9_.-]/g,"_"),".ini")}function eD(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 eA(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 eO(e){var t,s,l,i;let{t:r,currentProc:a,fetchJson:o,urlListText:c,keySuffixUi:d,showKeyRow:u=!0,pollMs:x=1e3,refreshToken:m=0,monitorRow:p,preferredTitle:h}=e,[g,b]=(0,Z.useState)(""),[f,v]=(0,Z.useState)(""),[y,j]=(0,Z.useState)(""),[N,k]=(0,Z.useState)(""),[_,S]=(0,Z.useState)(""),[z,C]=(0,Z.useState)([]),[R,L]=(0,Z.useState)(null),[P,M]=(0,Z.useState)(""),[T,E]=(0,Z.useState)(""),[U,I]=(0,Z.useState)(""),[D,A]=(0,Z.useState)(""),[O,B]=(0,Z.useState)(!1),[F,H]=(0,Z.useState)(!1),[K,Y]=(0,Z.useState)(!1),[J,V]=(0,Z.useState)(null),[$,X]=(0,Z.useState)(null),[Q,ee]=(0,Z.useState)(null),[et,es]=(0,Z.useState)(!1),[en,el]=(0,Z.useState)(!1),[ei,er]=(0,Z.useState)(!1),[ea,eo]=(0,Z.useState)(null),[ec,ed]=(0,Z.useState)(0),[eu,ex]=(0,Z.useState)(!0),em=(0,Z.useRef)(null),ep=(0,Z.useRef)(null),eh=(0,Z.useRef)(!1),eb=(0,Z.useRef)(!1),ef=(0,Z.useRef)(!1),ev=(0,Z.useRef)(a),ey=(0,Z.useRef)(0),ew=eU(c),ej=/^(online|running)$/i.test(g),eN=eE(f),ek=eP(c),eS=null!==(s=ek[0])&&void 0!==s?s:"",eL=K||!!(null==p?void 0:p.is_pushing)||["streaming","relay_slow"].includes(N.trim().toLowerCase()),eM=e_({ffmpeg_speed:null!=J?J:null==p?void 0:p.ffmpeg_speed,ffmpeg_frame:null!=$?$:null==p?void 0:p.ffmpeg_frame,ffmpeg_active:null==p?void 0:p.ffmpeg_active,is_pushing:eL,ffmpeg_speed_low:et||(null==p?void 0:p.ffmpeg_speed_low),ffmpeg_progress_stalled:en||(null==p?void 0:p.ffmpeg_progress_stalled)},void 0,"".concat(f,"\n").concat(y)),eZ="number"==typeof Q&&Q>0?eA(Math.max(0,Math.floor(Q))):null,eI=eR(eM,{live:eL||ej||!!(null==p?void 0:p.ffmpeg_active)}),eD=z.length?z.join(", "):eL||(null==p?void 0:p.ffmpeg_active)?r("转推活跃(PID 未采集)","Relay active (PID n/a)"):r("无","none"),eO=O&&eL&&!F,eB=eO?"":T,eF=eO?"":U,eW=ek.length>1&&eL&&!eF&&!eB&&!eN&&(O||!!D||!!P),eH=eB||eN||(eW?null:null!==(l=null===(t=eS.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i))||void 0===t?void 0:t[1])&&void 0!==l?l:null),eK=eF||(eB?"https://live.douyin.com/".concat(eB):"")||(eN?"https://live.douyin.com/".concat(eN):"")||(eW?null:eS||null),eY=eO?eT("",f):eT(c,f),eG=(eO?"":D)||(eO?"":P)||eY||(null==h?void 0:h.trim())||(eH?"抖音直播间 ".concat(eH):""),eq=(null==h?void 0:h.trim())&&eG&&h.trim()!==eG?h.trim():"",eJ="youtube_key_rejected"===N.trim().toLowerCase(),eV=(0,Z.useCallback)(async()=>{let e=ev.current.trim();if(!e)return;if(eb.current){ef.current=!0;return}eb.current=!0;let t=++ey.current;try{let s=await o("/status?process=".concat(encodeURIComponent(e),"&light=1"));if(t!==ey.current||e!==ev.current.trim())return;let n=s.process_status||"unknown";b(n),v(s.recent_log||""),j(s.recent_error||""),k(s.business_status||""),S(s.business_note||""),C(Array.isArray(s.ffmpeg_pids)?s.ffmpeg_pids:[]),L("number"==typeof s.log_age_seconds?s.log_age_seconds:null),M(s.source_title||""),E(s.source_room_id||""),I(s.source_url||""),A(s.source_display||""),B(!!s.source_ambiguous),H(!!s.source_current),Y(!!s.is_pushing),V("number"==typeof s.ffmpeg_speed?s.ffmpeg_speed:null),X("number"==typeof s.ffmpeg_frame?s.ffmpeg_frame:null),ee("number"==typeof s.ffmpeg_time_seconds?s.ffmpeg_time_seconds:null),es(!!s.ffmpeg_speed_low),el(!!s.ffmpeg_progress_stalled);let l=!!(s.is_pushing||["streaming","relay_slow"].includes((s.business_status||"").trim().toLowerCase()));l&&!eh.current&&eo(Date.now()),l||eo(null),eh.current=l}catch(s){if(t!==ey.current||e!==ev.current.trim())return;b("error"),k("error"),S(""),C([]),L(null),M(""),E(""),I(""),A(""),B(!1),H(!1),Y(!1),V(null),X(null),ee(null),es(!1),el(!1),eh.current=!1}finally{eb.current=!1,ef.current&&(ef.current=!1,window.setTimeout(()=>void eV(),0))}},[o]);(0,Z.useEffect)(()=>{if(ev.current=a,ey.current+=1,ef.current=!1,!a){b(""),v(""),j(""),k(""),S(""),C([]),L(null),M(""),E(""),I(""),A(""),B(!1),H(!1),Y(!1),V(null),X(null),ee(null),es(!1),el(!1),eo(null),eh.current=!1;return}b(""),v(""),j(""),k(""),S(""),C([]),L(null),M(""),E(""),I(""),A(""),B(!1),H(!1),Y(!1),V(null),X(null),ee(null),es(!1),el(!1),eo(null),eh.current=!1,eV()},[a,eV]),(0,Z.useEffect)(()=>{let e=()=>ex("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,Z.useEffect)(()=>{a&&eV()},[a,eV,m]),(0,Z.useEffect)(()=>{if(ei||!a||x<=0)return;let e=window.setInterval(()=>void eV(),x);return()=>clearInterval(e)},[ei,a,eV,x]),(0,Z.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&eV()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[eV]),(0,Z.useEffect)(()=>{if(!ea)return;let e=window.setInterval(()=>ed(e=>e+1),1e3);return()=>clearInterval(e)},[ea]),(0,Z.useEffect)(()=>{if(ei||!eu)return;let e=em.current;e&&(e.scrollTop=e.scrollHeight)},[f,ei,eu]),(0,Z.useEffect)(()=>{if(ei||!eu)return;let e=ep.current;e&&(e.scrollTop=e.scrollHeight)},[y,ei,eu]);let e$=null==ea?r("—(未检测到在线)","— (not online)"):eA(Math.max(0,Math.floor((Date.now()-ea)/1e3))),eX=ei?r("已暂停刷新","Paused"):x<=0?r("已暂停","Paused"):x>=3e4?r("约 30 秒","~30s"):x>=15e3?r("约 15 秒","~15s"):x>=12e3?r("约 12 秒","~12s"):x>=5e3?r("约 5 秒","~5s"):x>=2500?r("约 2.5 秒","~2.5s"):x>=2e3?r("约 2 秒","~2s"):x>=800?r("约 1 秒","~1s"):"".concat(x,"ms"),eQ=ei?"bg-amber-500/20 text-amber-100 ring-amber-500/35":x>=3e4?"bg-sky-500/15 text-sky-100 ring-sky-500/25":x>=4e3?"bg-zinc-500/15 text-zinc-200/90 ring-zinc-500/25":"bg-emerald-500/15 text-emerald-200/90 ring-emerald-500/25";return(0,n.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,n.jsx)("span",{className:"sr-only","aria-hidden":!0,children:ec}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:r("当前直播日志","Live process log")}),eL?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-emerald-500/15 px-2.5 py-0.5 text-[10px] font-medium text-emerald-100 ring-1 ring-emerald-500/25",children:[(0,n.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,n.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-70"}),(0,n.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-emerald-400"})]}),r("推流中","Pushing")]}):null,(0,n.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:a||"—"}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-medium ring-1 ".concat(eQ),children:eX})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>void eV(),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,n.jsx)(w.Z,{className:"h-3.5 w-3.5"}),r("立即拉取","Refresh")]}),(0,n.jsxs)("button",{type:"button",onClick:()=>er(e=>!e),className:"inline-flex items-center gap-1 rounded-lg px-3 py-1.5 text-xs ring-1 ".concat(ei?"bg-amber-500/20 text-amber-100 ring-amber-500/35":"border border-white/10 bg-black/30 text-zinc-300"),children:[ei?(0,n.jsx)(G.Z,{className:"h-3.5 w-3.5"}):(0,n.jsx)(q.Z,{className:"h-3.5 w-3.5"}),ei?r("继续自动刷新","Resume"):r("暂停自动刷新","Pause")]})]})]}),(0,n.jsxs)("div",{className:"mt-4 space-y-3 rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.05] bg-black/20 p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:r("进程状态","Process")}),(0,n.jsx)("span",{className:"mt-2 inline-flex rounded-full px-2.5 py-0.5 text-[11px] font-medium ring-1 ".concat(function(e){let t=(e||"").trim().toLowerCase();return"online"===t||"running"===t?"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30":"stopped"===t||"stopping"===t?"bg-zinc-600/20 text-zinc-300 ring-zinc-500/25":"not_found"===t||"errored"===t||"error"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"bg-zinc-600/20 text-zinc-300 ring-zinc-500/25"}(g)),children:function(e,t){let s=(t||"unknown").toLowerCase();return"online"===s||"running"===s?e("运行中(PM2/进程在线)","Running (process online)"):"stopped"===s||"stopping"===s?e("已停止","Stopped"):"not_found"===s||"errored"===s?e("未运行或未找到","Not running / not found"):"invalid"===s?e("无效进程名","Invalid process"):t||"—"}(r,g)})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.05] bg-black/20 p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:r("业务状态","Business")}),(0,n.jsx)("span",{className:"mt-2 inline-flex max-w-full rounded-full px-2.5 py-0.5 text-[11px] font-medium ring-1 ".concat(function(e){let t=(e||"").trim().toLowerCase();return"streaming"===t||"relay_slow"===t?"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30":"waiting_source"===t||"monitoring"===t||"source_live"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/25":"misconfigured"===t||"youtube_key_rejected"===t||"error"===t||"stale"===t||"source_stalled"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"bg-zinc-600/20 text-zinc-300 ring-zinc-500/25"}(N)),title:function(e,t,s){let n=(t||"").toLowerCase();return"streaming"===n?e("正在推流到 YouTube","Pushing to YouTube"):"relay_slow"===n?e("推流速度偏低","Relay running slowly"):"waiting_source"===n?e("等待上游直播源开播","Waiting for the upstream live source"):"source_live"===n?e("源站已开播,转推 Worker 未启动","Source live detected, but no active FFmpeg relay worker"):"monitoring"===n?e("进程在线,监控源站中","Process online and monitoring the source"):"misconfigured"===n?e("YouTube 密钥缺失或无效","YouTube key missing or invalid"):"youtube_key_rejected"===n?e("YouTube 推流失败:串流密钥无效、过期或不属于当前直播间","YouTube rejected the stream key"):"source_stalled"===n?e("上游源站卡住","Upstream source stalled"):"stale"===n?e("进程在线但日志心跳过期","Process online but the log heartbeat is stale"):"error"===n?e("检测到近期进程错误","Recent process error detected"):(null==s?void 0:s.trim())?s.trim():e("暂无业务状态","No business-state hint yet")}(r,N,_),children:function(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(s)return e("推流中","Pushing");let n=(t||"").toLowerCase();return"streaming"===n?e("推流中","Pushing"):"relay_slow"===n?e("低速","Slow"):"waiting_source"===n?e("等源","Wait source"):"source_live"===n?e("源开播","Source live"):"monitoring"===n?e("监控中","Monitoring"):"misconfigured"===n?e("密钥异常","Key invalid"):"youtube_key_rejected"===n?e("密钥被拒","Key rejected"):"source_stalled"===n?e("源卡住","Stalled"):"stale"===n?e("心跳过期","Stale"):"error"===n?e("异常","Error"):e("未知","Unknown")}(r,N,eL)})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.05] bg-black/20 p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:eL?r("推流时长(估算)","Relay duration (est.)"):r("进程在线时长(估算)","Process uptime (est.)")}),(0,n.jsx)("p",{className:"mt-2 font-mono text-sm font-semibold text-cyan-200/90",children:e$}),eZ?(0,n.jsxs)("p",{className:"mt-1 text-[10px] text-zinc-600",children:[r("已编码","Encoded")," ",eZ]}):null]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.05] bg-black/20 p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:r("FFmpeg workers","FFmpeg workers")}),(0,n.jsx)("p",{className:"mt-2 font-mono text-sm text-zinc-200",children:eD}),null!=R?(0,n.jsxs)("p",{className:"mt-1 text-[10px] text-zinc-600",children:[r("日志心跳","Log heartbeat")," ",eA(Math.max(0,Math.floor(R)))]}):null]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.05] bg-black/20 p-3 sm:col-span-2 xl:col-span-4",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:r("实时转推指标","Live relay metrics")}),(0,n.jsx)("p",{className:"mt-2 font-mono text-sm ".concat(eM.speedLow?"text-amber-200":eM.progressStalled?"text-rose-200":"text-cyan-100"),children:eI||r("等待 FFmpeg 上报 fps / speed / frame","Waiting for FFmpeg fps / speed / frame")}),(0,n.jsxs)("div",{className:"mt-2 grid gap-2 sm:grid-cols-4 font-mono text-[11px] text-zinc-400",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"fps"}),eC(eM.fps)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"speed"}),eC(eM.speed,"x")]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"frame"}),eC(eM.frame,"",0)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:r("码率","Bitrate")}),null!==(i=ez(eM.bitrate))&&void 0!==i?i:"—"]})]})]})]}),eG?(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.05] bg-black/20 px-3 py-2.5",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:eL&&(null==h?void 0:h.trim())?r("当前转播线路","Current relay lane"):r("当前转播源","Current relay source")}),(0,n.jsx)("p",{className:"mt-1 text-sm font-medium text-zinc-200",children:eG}),eq?(0,n.jsxs)("p",{className:"mt-1 text-xs text-zinc-500",children:[r("抖音源","Douyin"),": ",eq]}):null]}):null,u?(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,n.jsx)("span",{className:"text-zinc-500",children:r("YouTube key 尾码(参考)","YT key suffix")}),(0,n.jsx)("span",{className:"font-mono text-zinc-300",children:d||"—"})]}):null,eJ?(0,n.jsx)("div",{className:"rounded-lg border border-rose-500/30 bg-rose-500/[0.10] px-3 py-2.5 text-xs text-rose-100 ring-1 ring-rose-500/15",children:(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(eg.Z,{className:"mt-0.5 h-4 w-4 shrink-0 text-rose-300","aria-hidden":!0}),(0,n.jsx)("p",{children:r("YouTube 已拒绝本次 RTMPS 推流。请从 YouTube Studio 当前直播间复制完整串流密钥,保存到当前线路后重新开始;如果密钥确认无误,再检查到 YouTube RTMPS 的网络/代理。","YouTube rejected this RTMPS publish. Copy the full stream key for the current live event from YouTube Studio, save it to this lane, then start again; if the key is correct, check network/proxy access to YouTube RTMPS.")})]})}):null,eK?(0,n.jsxs)("div",{className:"rounded-lg border border-violet-500/20 bg-violet-500/[0.06] px-3 py-2.5",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium text-zinc-400",children:eN?r("当前直播源站(日志)","Current source (from log)"):ej?r("配置中的源站地址","Configured source URL"):r("源站快捷入口","Source quick link")}),(0,n.jsxs)("a",{href:eK,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,n.jsx)(W.Z,{className:"h-3.5 w-3.5 shrink-0 opacity-90"}),eG||r("打开抖音直播页","Open Douyin live")]})]}),eH&&eG&&!eG.includes(eH)?(0,n.jsxs)("p",{className:"mt-2 font-mono text-[10px] text-zinc-600",children:["room:",eH]}):null,ew.length>1&&eN?(0,n.jsxs)("p",{className:"mt-2 text-[10px] text-zinc-600",children:[r("配置中还有","Also in config:")," ",ew.filter(e=>e!==eH).slice(0,3).map(e=>(0,n.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)),ew.length>4?"…":null]}):null]}):(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:r("(日志与地址列表中暂无抖音房间)","(No Douyin room in log or URL list)")})]}),"not_found"!==g&&"invalid"!==g?(0,n.jsxs)("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-emerald-400/90",children:r("进程输出(stdout / 合并日志)","Process output")}),(0,n.jsx)("pre",{ref:em,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:f.trim()||r("(暂无)","(empty)")})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-rose-400/90",children:r("异常信息(stderr)","Stderr")}),(0,n.jsx)("pre",{ref:ep,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:y.trim()||r("(暂无)","(empty)")})]})]}):(0,n.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:r("进程未在 PM2 / 本地注册表中运行,日志区域已隐藏。","Process not running — log panes hidden.")})]})}function eB(e){return/tiktok/i.test(e.script)||/tiktok/i.test(e.pm2)}let eF=[{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."}],eW="live-hub-tiktok-hdmi-check-v1",eH="live-hub-tiktok-hdmi-notes-v1",eK="live-hub-tiktok-source-mode-v1";function eY(e){var t;let{t:s,busy:l,entries:i,currentProc:r,setCurrentProc:a,urlConfig:o,setUrlConfig:c,onRunProcess:d,onSaveUrlConfig:u,onReplayGoLive:x,onCopy:m,fetchJson:p,apiPrefix:h,quickLinks:g,hdmiStatus:b,notify:f,onNavigate:v}=e,y=(0,Z.useMemo)(()=>i.filter(eB),[i]),w=y.length?y:i,[j,N]=(0,Z.useState)("srs"),[k,_]=(0,Z.useState)([]),[S,R]=(0,Z.useState)(!1),[L,P]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)("1080p30"),[U,I]=(0,Z.useState)("1080p30"),[D,A]=(0,Z.useState)(!1),[O,B]=(0,Z.useState)(!0),[F,W]=(0,Z.useState)(null),H=(0,Z.useRef)(!1),K=(0,Z.useRef)(o),[G,q]=(0,Z.useState)(""),[J,$]=(0,Z.useState)({}),X=(0,Z.useCallback)(e=>{K.current=e,c(e)},[c]),Q=(0,Z.useCallback)(e=>{N(e);try{window.localStorage.setItem(eK,e)}catch(e){}},[]);(0,Z.useEffect)(()=>{try{let e=window.localStorage.getItem(eK);("ffmpeg"===e||"replay"===e||"srs"===e)&&("ffmpeg"!==e&&"replay"!==e?N(e):N("srs"))}catch(e){}},[]),(0,Z.useEffect)(()=>{H.current=!1},[r]),(0,Z.useEffect)(()=>{K.current=o},[o]);let ee=(0,Z.useCallback)(async()=>{if(r)try{var e;let t=new URLSearchParams({process:r,_ts:String(Date.now())}),s=await p("/get_url_config?".concat(t));X(null!==(e=s.content)&&void 0!==e?e:"")}catch(e){}},[X,r,p]);(0,Z.useEffect)(()=>{if(!r||!O||"ffmpeg"!==j)return;let e=window.setInterval(()=>{H.current||ee()},8e3);return()=>clearInterval(e)},[r,O,ee,j]),(0,Z.useEffect)(()=>{"ffmpeg"===j&&r&&ee()},[j,r,ee]);let et=(0,Z.useCallback)(async()=>{if(r){R(!0);try{var e;let t=await p("/tiktok_replay/list?process=".concat(encodeURIComponent(r)));_(null!==(e=t.files)&&void 0!==e?e:[])}catch(e){f(e.message),_([])}finally{R(!1)}}},[r,p,f]);(0,Z.useEffect)(()=>{"replay"===j&&r&&et()},[j,r,et]),(0,Z.useEffect)(()=>{try{let e=window.localStorage.getItem(eW);e&&$(JSON.parse(e))}catch(e){}try{q(window.localStorage.getItem(eH)||"")}catch(e){}},[]);let es=(0,Z.useCallback)(e=>{$(e);try{window.localStorage.setItem(eW,JSON.stringify(e))}catch(e){}},[]),en=e=>{q(e);try{window.localStorage.setItem(eH,e)}catch(e){}},el=async()=>{if(r){A(!0),W(null),H.current=!1;try{var e;let t=new URLSearchParams({process:r,_ts:String(Date.now())}),n=await p("/get_url_config?".concat(t));X(null!==(e=n.content)&&void 0!==e?e:""),W(s("已从服务器读取 URL_config","Reloaded URL_config from server"))}catch(e){W(e.message)}finally{A(!1)}}},ei=async()=>{try{await Promise.resolve(u(K.current)),H.current=!1}catch(e){}},er=async e=>{if(r){P(!0);try{await p("/tiktok_replay/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:r,filename:e})}),f(s("已删除文件","File removed")),await et()}catch(e){f(e.message)}finally{P(!1)}}},ea=async e=>{var t;let n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(e.target.value="",n&&r){P(!0);try{let e=new FormData;e.append("file",n);let t=await (0,V.N)("".concat(h,"/tiktok_replay/upload?process=").concat(encodeURIComponent(r)),{method:"POST",body:e});f(t.message||s("上传成功","Uploaded")),await et()}catch(e){f(e.message)}finally{P(!1)}}},eo=l||D||L,ec=eF.find(e=>e.id===U),ed=!!(null==b?void 0:b.can_stream_hdmi),ep=(null==b?void 0:b.preferred_device)||(null==b?void 0:null===(t=b.video_devices)||void 0===t?void 0:t[0])||"";return(0,n.jsxs)("div",{className:"mx-auto max-w-4xl space-y-6",children:[v?(0,n.jsx)(eh,{t:s,title:s("TikTok HDMI 硬件链路","TikTok HDMI hardware chain"),subtitle:s("板端编码经 HDMI 到显示/下游设备;与「网络」页顶卡相同的箭头风格。","Encode on SoC → HDMI → display/downstream; same arrow style as Network header."),onNavigate:v,steps:[{label:"FFmpeg",sub:s("采集 / 推流","Capture"),gradient:"from-cyan-400 to-blue-500",target:"live_tiktok"},{label:"HDMI",sub:s("板载输出","SoC out"),gradient:"from-violet-500 to-fuchsia-500"},{label:"Android",sub:s("AOSP / 手机","AOSP"),gradient:"from-amber-400 to-orange-500",target:"android"}]}):null,(0,n.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,n.jsx)("div",{className:"flex flex-wrap items-start gap-4",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.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,n.jsx)(C.Z,{className:"h-5 w-5 text-cyan-200"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg font-semibold tracking-tight text-white",children:s("TikTok 无人直播(单路)","TikTok unmanned (single lane)")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:s("布局对齐 YouTube 单频道:直播开关 + 源站 + URL_config;无 stream key,输出走 HDMI 硬件链路。","Same layout as YouTube single: controls + URLs; no stream key — HDMI hardware path.")})]})]})})}),(0,n.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,n.jsx)("p",{className:"text-xs leading-relaxed text-cyan-100/90",children:s("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,n.jsxs)("div",{className:"rounded-2xl border border-white/10 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(eu.Z,{className:"h-4 w-4 text-cyan-300"}),s("X86 HDMI 采集状态","X86 HDMI capture status")]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("这里直接显示主机是否识别到采集卡和 /dev/video 设备,可用于验证 ARM HDMI 进 X86 的链路。","Shows whether the host sees the capture card and /dev/video nodes for ARM-to-X86 HDMI ingest.")})]}),(0,n.jsx)("span",{className:"rounded-full px-3 py-1 text-[11px] font-semibold ring-1 ".concat(ed?"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30":"bg-rose-500/15 text-rose-200 ring-rose-500/25"),children:ed?s("可推流","Ready"):s("未就绪","Not ready")})]}),(0,n.jsxs)("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-4 text-[11px] text-zinc-400",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"device: "}),(0,n.jsx)("span",{className:"font-mono text-zinc-200",children:ep||"—"})]}),(0,n.jsxs)("p",{className:"mt-2",children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"video nodes: "}),(0,n.jsx)("span",{className:"font-mono text-zinc-200",children:((null==b?void 0:b.video_devices)||[]).join(", ")||"—"})]}),(0,n.jsxs)("p",{className:"mt-2",children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"usb matches: "}),(0,n.jsx)("span",{className:"text-zinc-300",children:((null==b?void 0:b.usb_capture_matches)||[]).length||0})]})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-4 text-[11px] text-zinc-400",children:[(0,n.jsx)("p",{className:"text-zinc-600",children:s("建议 FFmpeg","Suggested FFmpeg")}),(0,n.jsx)("p",{className:"mt-2 break-all font-mono text-zinc-200",children:(null==b?void 0:b.suggested_ffmpeg_cmd)||"—"}),(null==b?void 0:b.suggested_ffmpeg_cmd)?(0,n.jsxs)("button",{type:"button",onClick:()=>m(b.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,n.jsx)(M.Z,{className:"h-3.5 w-3.5"}),s("复制命令","Copy command")]}):null]})]}),((null==b?void 0:b.issues)||[]).length?(0,n.jsx)("ul",{className:"mt-4 list-inside list-disc space-y-1 text-[11px] text-amber-200/85",children:((null==b?void 0:b.issues)||[]).map(e=>(0,n.jsx)("li",{children:e},e))}):null]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-amber-500/20 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-amber-200/90",children:[(0,n.jsx)(Y.Z,{className:"h-4 w-4"}),(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:s("直播开关","Live control")})]}),(0,n.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:s("TikTok 进程(PM2)","TikTok PM2 process")}),(0,n.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,n.jsxs)("option",{value:e.pm2,children:[e.label," (",e.pm2,")"]},e.pm2))}),(0,n.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:s("直播源","Video source")}),(0,n.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=>Q(e.target.value),children:[(0,n.jsx)("option",{value:"ffmpeg",hidden:!0,children:"FFmpeg(抖音 / TikTok 等直播间 URL)"}),(0,n.jsx)("option",{value:"replay",hidden:!0,children:s("录播素材(本地上传)","VOD upload")}),(0,n.jsx)("option",{value:"srs",children:s("SRS(OBS 推流)","SRS (OBS)")})]}),"srs"===j?(0,n.jsx)("p",{className:"mt-2 text-[11px] leading-relaxed text-amber-200/85",children:s("此模式不显示 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,n.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[["start",s("开始直播","Start"),"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30"],["stop",s("停止直播","Stop"),"bg-rose-500/15 text-rose-200 ring-rose-500/25"],["restart",s("重新开始","Restart"),"bg-amber-500/15 text-amber-200 ring-amber-500/25"]].map(e=>{let[t,s,l]=e;return(0,n.jsx)("button",{type:"button",disabled:eo,onClick:()=>d(t),className:"rounded-xl px-4 py-3 text-sm font-medium ring-1 ".concat(l),children:s},t)})}),(0,n.jsxs)("p",{className:"mt-3 text-center text-[11px] text-zinc-500",children:[s("当前 HDMI 预设(备忘)","HDMI preset (memo)"),":"," ",(0,n.jsx)("span",{className:"font-mono text-cyan-300/90",children:ec?s(ec.labelZh,ec.labelEn):U})]})]}),"replay"===j?(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/25 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(ex.Z,{className:"h-4 w-4 text-violet-300"}),s("录播素材","VOD library")]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.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,n.jsx)(em.Z,{className:"h-3.5 w-3.5"}),(0,n.jsx)("span",{children:s("上传视频","Upload")}),(0,n.jsx)("input",{type:"file",accept:".mp4,.mkv,.ts,.flv,.mov,.m4v,.webm",className:"hidden",onChange:ea})]}),(0,n.jsx)("button",{type:"button",disabled:eo||!r,onClick:()=>void et(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-300",children:s("刷新列表","Refresh")})]})]}),(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:s("文件保存在服务器 config/tiktok_replay/对应进程目录;点「开始直播」会写入 replayfile 行并启动 PM2 进程。停播请用上方「停止直播」。","Files under config/tiktok_replay/. Go live writes replayfile + starts PM2. Use Stop above to stop.")}),S?(0,n.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:s("加载中…","Loading…")}):0===k.length?(0,n.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:s("暂无文件,请先上传。","No files yet.")}):(0,n.jsx)("ul",{className:"mt-4 space-y-2",children:k.map(e=>(0,n.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,n.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.name}),(0,n.jsxs)("span",{className:"shrink-0 text-zinc-500",children:[(e.size/1048576).toFixed(1)," MB"]}),(0,n.jsxs)("div",{className:"flex shrink-0 flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:eo,onClick:()=>void(async()=>{try{await Promise.resolve(x(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:s("开始直播","Go live")}),(0,n.jsx)("button",{type:"button",disabled:eo,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:s("停播","Stop")}),(0,n.jsxs)("button",{type:"button",disabled:eo,onClick:()=>void er(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,n.jsx)(z.Z,{className:"h-3 w-3"}),s("删除","Del")]})]})]},e.name))})]}):null,"srs"===j?(0,n.jsxs)("div",{className:"rounded-2xl border border-emerald-500/25 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:s("SRS / OBS 推流","SRS / OBS ingest")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("OBS:设置 → 推流 → 服务选「自定义」,服务器填 RTMP 地址;串流密钥可与 SRS 应用配置一致(默认 live/livestream)。","OBS → Stream → Custom: RTMP URL as server; stream key per SRS app (default live/livestream).")}),(0,n.jsxs)("dl",{className:"mt-4 space-y-3 text-xs",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-500",children:s("RTMP 推流地址(OBS 服务器)","RTMP publish URL")}),(0,n.jsxs)("dd",{className:"mt-1 flex flex-wrap items-center gap-2 font-mono text-emerald-200/90",children:[(0,n.jsx)("span",{className:"break-all",children:g.srs_rtmp_publish||"—"}),g.srs_rtmp_publish?(0,n.jsx)("button",{type:"button",className:"shrink-0 text-cyan-300 hover:text-cyan-200",onClick:()=>m(g.srs_rtmp_publish),children:(0,n.jsx)(M.Z,{className:"h-3.5 w-3.5"})}):null]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-500",children:s("HTTP-FLV 预览","HTTP-FLV preview")}),(0,n.jsxs)("dd",{className:"mt-1 flex flex-wrap items-center gap-2 font-mono text-zinc-400",children:[(0,n.jsx)("span",{className:"break-all",children:g.srs_play_flv||g.srs_http||"—"}),g.srs_play_flv||g.srs_http?(0,n.jsx)("button",{type:"button",className:"shrink-0 text-cyan-300 hover:text-cyan-200",onClick:()=>m(g.srs_play_flv||g.srs_http),children:(0,n.jsx)(M.Z,{className:"h-3.5 w-3.5"})}):null]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-500",children:s("SRS 控制台","SRS web UI")}),(0,n.jsx)("dd",{className:"mt-1 font-mono text-zinc-400",children:(0,n.jsx)("a",{href:g.srs_http||"#",target:"_blank",rel:"noreferrer",className:"text-cyan-300 hover:underline",children:g.srs_http||"—"})})]})]})]}):null,(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(eu.Z,{className:"h-4 w-4 text-cyan-400"}),s("HDMI 硬件与时序","HDMI timing")]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("点选一路作为现场备忘;与板端 ffmpeg/OBS 采集参数对齐。","Pick a preset as field memo; match capture settings.")}),(0,n.jsx)("div",{className:"mt-4 grid gap-3 md:grid-cols-3",children:eF.map(e=>{let t=T===e.id,l=U===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>{E(t?null:e.id),I(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,n.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(eu.Z,{className:"h-4 w-4 text-cyan-400"}),s(e.labelZh,e.labelEn)]}),(0,n.jsx)("p",{className:"mt-2 font-mono text-[11px] text-zinc-400",children:e.spec}),t?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:s(e.hintZh,e.hintEn)}):null]},e.id)})}),(0,n.jsxs)("div",{className:"mt-6 rounded-xl border border-white/5 bg-black/25 p-4",children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-zinc-400",children:s("上线前检查清单(本地保存)","Pre-flight checklist (local)")}),(0,n.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,n.jsxs)("li",{className:"flex items-start gap-2 text-xs text-zinc-400",children:[(0,n.jsx)("input",{type:"checkbox",className:"mt-0.5 rounded border-white/20 bg-black/40",checked:!!J[e.id],onChange:t=>es({...J,[e.id]:t.target.checked})}),(0,n.jsx)("span",{children:s(e.zh,e.en)})]},e.id))}),(0,n.jsx)("label",{className:"mt-4 block text-[11px] text-zinc-500",children:s("HDMI / 走线备忘","HDMI / wiring notes")}),(0,n.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:G,onChange:e=>en(e.target.value),spellCheck:!1,placeholder:s("接口、线长、显示器型号…","Ports, cable length, display model…")})]})]}),"ffmpeg"===j?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:s("直播地址列表 \xb7 URL_config.ini","URL_config.ini")}),(0,n.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,n.jsx)(M.Z,{className:"h-3.5 w-3.5"}),s("复制全文","Copy all")]})]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("一行一个地址;可勾选自动从服务器刷新,或点「重新读取」手动同步。","One URL per line; enable auto-refresh or reload from server.")}),(0,n.jsx)("div",{className:"mt-2 flex flex-wrap items-center gap-4 text-xs text-zinc-400",children:(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:O,onChange:e=>B(e.target.checked)}),s("每 8 秒自动从服务器刷新","Auto-refresh from server every 8s")]})}),F?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:F}):null,(0,n.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=>{H.current=!0,X(e.target.value)},spellCheck:!1}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:eo,onClick:()=>void el(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-300",children:s("重新读取","Reload from server")}),(0,n.jsx)("button",{type:"button",disabled:eo,onClick:()=>void ei(),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:s("保存 URL 配置","Save URL config")})]})]}):null,(0,n.jsx)(eO,{t:s,currentProc:r,fetchJson:p,urlListText:"ffmpeg"===j?o:"",keySuffixUi:"",showKeyRow:!1})]})}var eG=s(875),eq=s(4822),eJ=s(9170);function eV(e){e.traverse(e=>{e.geometry&&e.geometry.dispose();let t=e.material;Array.isArray(t)?t.forEach(e=>e.dispose()):t&&t.dispose()})}function e$(e){let{tr:t,className:l="",liveActive:i=0,onOpenStudio:r}=e,a=(0,Z.useRef)(null),o=(0,Z.useRef)(null),[d,u]=(0,Z.useState)("idle"),[x,m]=(0,Z.useState)(0),h=(0,Z.useRef)(i);h.current=i;let g=(0,Z.useCallback)(()=>{u("idle"),m(e=>e+1)},[]);return(0,Z.useEffect)(()=>{let e;let t=o.current,n=a.current;if(!t||!n)return;let l=!1,i=0,r=null,c=!1,d=0,x=()=>{cancelAnimationFrame(i),cancelAnimationFrame(d),null==r||r.disconnect(),null==e||e(),e=void 0,t.replaceChildren()},m=()=>{if(l||c)return;let r=t.clientWidth,a=t.clientHeight;r<16||a<16||(c=!0,u("loading"),s.e(689).then(s.bind(s,1448)).then(t=>{let s;if(l||!o.current)return;let r=o.current,a=r.clientWidth,c=r.clientHeight,d=new t.Scene,x=new t.PerspectiveCamera(48,a/c,.1,80);x.position.set(0,1.1,7.2);try{s=new t.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance"})}catch(e){l||u("failed");return}s.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),s.setSize(a,c,!1),s.setClearColor(0,0);let m=s.domElement;m.style.display="block",m.style.width="100%",m.style.height="100%",r.replaceChildren(m);let p=new t.HemisphereLight(16762092,4482815,.85);d.add(p);let g=new t.DirectionalLight(16777215,.9);g.position.set(4,8,6),d.add(g);let b=new t.PointLight(8189439,.6,20);b.position.set(-3,2,-2),d.add(b);let f=new t.Group,v=new t.MeshStandardMaterial({color:2762048,metalness:.15,roughness:.55}),y=new t.MeshStandardMaterial({color:16724821,emissive:4456465,metalness:.35,roughness:.25}),w=new t.MeshStandardMaterial({color:16777215,emissive:2236962,metalness:.2,roughness:.3}),j=new t.MeshStandardMaterial({color:2487534,emissive:340024,metalness:.25,roughness:.35}),N=new t.MeshStandardMaterial({color:16657493,emissive:2229520,metalness:.2,roughness:.4}),k=new t.Mesh(new t.BoxGeometry(3.2,.35,2.2),v);k.position.y=-.85,f.add(k);let _=new t.Mesh(new t.TorusGeometry(.72,.09,12,48),y);_.rotation.x=Math.PI/2,_.position.set(-.85,.15,.2),f.add(_);let S=new t.Mesh(new t.ConeGeometry(.35,.5,3),w);S.rotation.z=-Math.PI/2,S.rotation.y=Math.PI,S.position.set(-.55,.18,.2),f.add(S);let z=new t.Mesh(new t.CylinderGeometry(.22,.28,.95,20),j);z.position.set(1.05,.35,-.15),z.rotation.z=.12,f.add(z);let C=new t.Mesh(new t.SphereGeometry(.26,16,16),N);C.position.set(1.05,.92,-.15),f.add(C);let R=new t.BufferGeometry,L=new Float32Array(360);for(let e=0;e<120;e++)L[3*e]=(Math.random()-.5)*14,L[3*e+1]=(Math.random()-.3)*8,L[3*e+2]=(Math.random()-.5)*8-2;R.setAttribute("position",new t.BufferAttribute(L,3));let P=new t.PointsMaterial({color:16777215,size:.06,transparent:!0,opacity:.7}),M=new t.Points(R,P);d.add(M),d.add(f);let T=0,E=0,U=e=>{let t=r.getBoundingClientRect();t.width&&t.height&&(T=((e.clientX-t.left)/t.width-.5)*2,E=((e.clientY-t.top)/t.height-.5)*2)},Z=()=>{T=0,E=0};n.addEventListener("pointermove",U),n.addEventListener("pointerleave",Z);let I=performance.now(),D=!document.hidden,A=()=>{D=!document.hidden};document.addEventListener("visibilitychange",A);let O=()=>{if(l||(i=requestAnimationFrame(O),!D))return;let e=(performance.now()-I)/1e3,t=h.current,n=t>0?.5+.5*Math.sin(4*e):0;f.rotation.y=.25*Math.sin(.35*e)+.12*e+.08*T,f.rotation.x=-.06*E,f.position.y=.06*Math.sin(.9*e),_.rotation.z=.4*e,M.rotation.y=.02*e,x.position.x+=(.35*T-x.position.x)*.06,x.position.y+=(1.1+-.2*E-x.position.y)*.06,x.lookAt(0,.1,0),t>0?(y.emissive.setHex(4456465),y.emissiveIntensity=.4+1.2*n,j.emissiveIntensity=.3+.5*n):(y.emissiveIntensity=1,j.emissiveIntensity=1),s.render(d,x)};O();let B=new ResizeObserver(()=>{if(!o.current||l)return;let e=o.current.clientWidth,t=o.current.clientHeight;e<16||t<16||(x.aspect=e/t,x.updateProjectionMatrix(),s.setSize(e,t,!1))});B.observe(r),l||u("ready"),e=()=>{var e;document.removeEventListener("visibilitychange",A),n.removeEventListener("pointermove",U),n.removeEventListener("pointerleave",Z),B.disconnect(),eV(f),eV(M),R.dispose(),P.dispose(),s.dispose(),null===(e=s.forceContextLoss)||void 0===e||e.call(s),r.replaceChildren()}}).catch(()=>{l||u("failed")}))},p=0,g=()=>{l||c||(p+=1,m(),!c&&p<120?d=requestAnimationFrame(g):!c&&p>=120&&u("failed"))};return(r=new ResizeObserver(()=>{c||m()})).observe(t),g(),()=>{l=!0,x()}},[x]),(0,n.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col ".concat(l),children:[(0,n.jsxs)("div",{className:"mb-2 flex shrink-0 items-center justify-between gap-2 px-1",children:[(0,n.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-fuchsia-200/80",children:t("直播工作室 \xb7 3D","Live studio \xb7 3D")}),i>0?(0,n.jsxs)("span",{className:"studio-live-badge inline-flex items-center gap-1 rounded-full bg-rose-500/20 px-2 py-0.5 text-[9px] font-bold uppercase tracking-wide text-rose-100 ring-1 ring-rose-400/40",children:[(0,n.jsxs)("span",{className:"relative flex h-1.5 w-1.5",children:[(0,n.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-rose-400 opacity-70"}),(0,n.jsx)("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-rose-400"})]}),"LIVE \xd7",i]}):null]}),(0,n.jsxs)("div",{ref:a,className:"studio-scene-shell relative min-h-0 flex-1 overflow-hidden rounded-xl bg-gradient-to-b from-fuchsia-950/40 to-cyan-950/20 ring-1 ring-white/10",children:[(0,n.jsx)("div",{ref:o,className:"absolute inset-0","aria-hidden":!0}),"idle"===d||"loading"===d?(0,n.jsxs)("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center gap-2",children:[(0,n.jsx)("div",{className:"studio-scene-shimmer absolute inset-0 opacity-60"}),(0,n.jsx)(p.Z,{className:"relative h-5 w-5 animate-pulse text-fuchsia-300/70"}),(0,n.jsx)("p",{className:"relative text-[10px] text-zinc-500",children:t("加载 3D 场景…","Loading 3D scene…")})]}):null,"failed"===d?(0,n.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 px-4 text-center",children:[(0,n.jsx)(c.Z,{className:"h-8 w-8 text-fuchsia-300/70"}),(0,n.jsx)("p",{className:"text-[11px] text-zinc-400",children:t("WebGL 不可用,已显示占位预览","WebGL unavailable — showing placeholder")}),(0,n.jsxs)("button",{type:"button",onClick:g,className:"inline-flex items-center gap-1.5 rounded-lg border border-fuchsia-400/30 bg-fuchsia-500/10 px-3 py-1.5 text-[10px] font-semibold text-fuchsia-100 transition hover:bg-fuchsia-500/20",children:[(0,n.jsx)(w.Z,{className:"h-3 w-3"}),t("重试","Retry")]})]}):null,r?(0,n.jsxs)("button",{type:"button",onClick:r,className:"absolute bottom-2 right-2 z-10 inline-flex items-center gap-1 rounded-lg border border-white/10 bg-black/45 px-2.5 py-1 text-[10px] font-semibold text-zinc-200 backdrop-blur-sm transition hover:border-fuchsia-400/35 hover:bg-black/60 hover:text-white",children:[(0,n.jsx)(p.Z,{className:"h-3 w-3 text-fuchsia-300"}),t("进入工作室","Open studio")]}):null]})]})}function eX(e){if(null==e||!Number.isFinite(e))return"—";if(0===e)return"0 B";let t=["B","KB","MB","GB","TB"],s=e,n=0;for(;s>=1024&&n=10||0===n?0:1)," ").concat(t[n])}function eQ(e){let t=eX(e);return"—"===t?t:"".concat(t,"/s")}function e0(e,t){return t&&Number.isFinite(e)&&Number.isFinite(t)?Math.min(100,Math.max(0,Math.round(e/t*100))):0}function e1(e){return"online"===e||"running"===e||"streaming"===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"}let e5=[{id:"live_youtube",zh:"YouTube 无人直播",en:"YouTube Live",icon:Y.Z,accent:"from-rose-500/20 to-violet-500/10 text-rose-100 ring-rose-500/25"},{id:"live_tiktok",zh:"TikTok HDMI",en:"TikTok HDMI",icon:c.Z,accent:"from-cyan-500/20 to-sky-500/10 text-cyan-100 ring-cyan-500/25"},{id:"android",zh:"安卓投屏",en:"Android",icon:d.Z,accent:"from-emerald-500/20 to-teal-500/10 text-emerald-100 ring-emerald-500/25"},{id:"services",zh:"服务编排",en:"Services",icon:a.Z,accent:"from-indigo-500/20 to-violet-500/10 text-indigo-100 ring-indigo-500/25"},{id:"network",zh:"网络 / WG",en:"Network",icon:E.Z,accent:"from-amber-500/20 to-orange-500/10 text-amber-100 ring-amber-500/25"},{id:"studio",zh:"工作室",en:"Studio",icon:p.Z,accent:"from-fuchsia-500/20 to-pink-500/10 text-fuchsia-100 ring-fuchsia-500/25"}],e2=["control_plane","netdata","filebrowser","webtty","neko_browser","srs_http","youtube_events"];function e3(e){let{label:t,value:s,sub:l,pct:i,icon:r,theme:a}=e,o=2*Math.PI*18,c=null!=i?i/100*o:0;return(0,n.jsx)("div",{className:"group relative overflow-hidden rounded-2xl border p-3.5 transition hover:-translate-y-0.5 ".concat("light"===a?"border-slate-200/90 bg-white/90 shadow-sm shadow-slate-200/40":"border-white/[0.07] bg-gradient-to-br from-white/[0.06] to-transparent shadow-lg shadow-black/20"),children:(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(r,{className:"h-4 w-4 shrink-0 ".concat("light"===a?"text-violet-600":"text-violet-300/90")}),(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:t})]}),(0,n.jsx)("p",{className:"mt-2 font-mono text-xl font-bold leading-none ".concat("light"===a?"text-slate-900":"text-white"),children:s}),(0,n.jsx)("p",{className:"mt-1 text-[10px] text-zinc-500",children:l})]}),null!=i?(0,n.jsxs)("svg",{className:"h-11 w-11 shrink-0 -rotate-90",viewBox:"0 0 44 44","aria-hidden":!0,children:[(0,n.jsx)("circle",{cx:"22",cy:"22",r:18,fill:"none",className:"stroke-white/10",strokeWidth:"4"}),(0,n.jsx)("circle",{cx:"22",cy:"22",r:18,fill:"none",className:"".concat(i>=90?"stroke-rose-400":i>=75?"stroke-amber-400":"stroke-cyan-400"," transition-all duration-500"),strokeWidth:"4",strokeDasharray:"".concat(c," ").concat(o),strokeLinecap:"round"}),(0,n.jsxs)("text",{x:"22",y:"24",textAnchor:"middle",className:"fill-zinc-400 text-[8px] font-bold rotate-90 origin-center",children:[i,"%"]})]}):null]})})}function e4(e){let{id:t,title:s,subtitle:l,defaultOpen:i=!0,theme:r,children:a,badge:o}=e,[c,d]=(0,Z.useState)(i);return(0,n.jsxs)("section",{id:t,className:"overflow-hidden rounded-2xl border ".concat("light"===r?"border-slate-200/90 bg-white/80":"border-white/[0.07] bg-zinc-950/35"),children:[(0,n.jsxs)("button",{type:"button",onClick:()=>d(e=>!e),className:"flex w-full items-center gap-3 px-4 py-3.5 text-left transition ".concat("light"===r?"hover:bg-slate-50":"hover:bg-white/[0.03]"),"aria-expanded":c,children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold ".concat("light"===r?"text-slate-900":"text-white"),children:s}),o]}),l?(0,n.jsx)("p",{className:"mt-0.5 text-[11px] text-zinc-500",children:l}):null]}),(0,n.jsx)(eG.Z,{className:"h-4 w-4 shrink-0 text-zinc-500 transition ".concat(c?"rotate-180":"")})]}),c?(0,n.jsx)("div",{className:"border-t border-white/[0.05] px-4 pb-4 pt-3",children:a}):null]})}function e6(e){let{theme:t}=e;return(0,n.jsxs)("div",{className:"space-y-4 animate-pulse",children:[(0,n.jsx)("div",{className:"h-28 rounded-2xl border ".concat("light"===t?"bg-slate-100":"bg-white/[0.04]")}),(0,n.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:Array.from({length:4}).map((e,s)=>(0,n.jsx)("div",{className:"h-24 rounded-2xl border ".concat("light"===t?"bg-slate-100":"bg-white/[0.04]")},s))}),(0,n.jsx)("div",{className:"h-72 rounded-2xl border ".concat("light"===t?"bg-slate-100":"bg-white/[0.04]")})]})}function e8(e){var t,s,i,c,d,u,x,m,p,h,g,b,f,v,y,w,j,N,_,S,z,C,R,P,M,T,U,I,D,A,O,B,F,H,K,Y,G,q,J,V,$,X,Q,ee,et,es,en,el,ei,er,ea,eo,ec,ed;let{dash:eu,deployCheck:ex,dashErr:em,loading:eh,theme:eg,t:eb,onNavigate:ef,nekoLinks:ev,nekoPortsLabel:ey,showStreamProbes:ew,quickLinks:ej}=e,eN=null!==(Q=null==eu?void 0:null===(t=eu.services)||void 0===t?void 0:t.filter(e=>e.running).length)&&void 0!==Q?Q:0,ek=null!==(ee=null==eu?void 0:null===(s=eu.services)||void 0===s?void 0:s.length)&&void 0!==ee?ee:0,e_=(null==eu?void 0:null===(c=eu.snapshot)||void 0===c?void 0:null===(i=c.memory)||void 0===i?void 0:i.total)||0,eS=null!==(es=null!==(et=null==eu?void 0:null===(u=eu.snapshot)||void 0===u?void 0:null===(d=u.memory)||void 0===d?void 0:d.available)&&void 0!==et?et:null==eu?void 0:null===(m=eu.snapshot)||void 0===m?void 0:null===(x=m.memory)||void 0===x?void 0:x.free)&&void 0!==es?es:0,ez=Math.max(0,e_-eS),eC=(null==eu?void 0:null===(h=eu.snapshot)||void 0===h?void 0:null===(p=h.disk)||void 0===p?void 0:p.total)||0,eR=(null==eu?void 0:null===(b=eu.snapshot)||void 0===b?void 0:null===(g=b.disk)||void 0===g?void 0:g.free)||0,eL=(null==eu?void 0:null===(f=eu.live)||void 0===f?void 0:f.processes)||[],eP=(null==eu?void 0:null===(v=eu.live_events)||void 0===v?void 0:v.process_digest)||[],eM=eP.filter(e=>{let t=(e.status||"").toLowerCase();return"online"===t||"running"===t||"streaming"===t}).length,eT=(0,Z.useMemo)(()=>e2.map(e=>({key:e,url:ej[e]})).filter(e=>e.url&&/^https?:\/\//i.test(e.url)),[ej]),eE=(0,Z.useMemo)(()=>((null==eu?void 0:eu.services)||[]).filter(e=>["live-console","live-edge","srs","neko","shellcrash"].some(t=>e.service_id.includes(t.replace("live-",""))||e.service_id===t)).slice(0,6),[null==eu?void 0:eu.services]);return eh&&!eu?(0,n.jsx)(e6,{theme:eg}):(0,n.jsxs)("div",{className:"space-y-5",children:[em?(0,n.jsxs)("div",{className:"rounded-2xl border border-rose-500/25 bg-rose-950/20 p-4 text-sm text-rose-200",children:[eb("无法加载仪表盘:","Dashboard error: "),em]}):null,(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"relative overflow-hidden rounded-2xl border p-4 sm:p-5 ".concat("light"===eg?"border-violet-200/80 bg-gradient-to-br from-violet-50 via-white to-cyan-50 shadow-sm":"border-violet-500/20 bg-gradient-to-br from-violet-600/10 via-zinc-950/80 to-cyan-500/10"),children:[(0,n.jsx)("div",{className:"pointer-events-none absolute -right-8 -top-8 h-40 w-40 rounded-full bg-fuchsia-500/15 blur-3xl"}),(0,n.jsx)("div",{className:"pointer-events-none absolute -bottom-10 left-1/3 h-32 w-32 rounded-full bg-cyan-500/10 blur-3xl"}),(0,n.jsxs)("div",{className:"relative flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-emerald-500/15 px-2.5 py-0.5 text-[10px] font-semibold text-emerald-200 ring-1 ring-emerald-500/30",children:[(0,n.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,n.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-60"}),(0,n.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-emerald-400"})]}),(null==eu?void 0:null===(y=eu.stack)||void 0===y?void 0:y.hostname)||"live"]}),(null==ex?void 0:ex.ready)?(0,n.jsx)("span",{className:"rounded-full bg-emerald-500/10 px-2 py-0.5 text-[10px] font-medium text-emerald-200 ring-1 ring-emerald-500/20",children:eb("交付就绪","Deploy ready")}):ex?(0,n.jsx)("span",{className:"rounded-full bg-amber-500/10 px-2 py-0.5 text-[10px] font-medium text-amber-200 ring-1 ring-amber-500/20",children:eb("待验收","Needs checks")}):null,eM>0?(0,n.jsxs)("span",{className:"rounded-full bg-rose-500/15 px-2 py-0.5 text-[10px] font-semibold text-rose-100 ring-1 ring-rose-500/25",children:[eM," ",eb("路直播活跃","live lanes active")]}):null]}),(0,n.jsxs)("h2",{className:"mt-2 text-lg font-bold tracking-tight sm:text-xl ".concat("light"===eg?"text-slate-900":"text-white"),children:[(null==eu?void 0:null===(w=eu.stack)||void 0===w?void 0:w.mdns_host)||"live.local",(0,n.jsx)("span",{className:"ml-2 text-sm font-normal ".concat("light"===eg?"text-slate-500":"text-zinc-500"),children:((null==eu?void 0:null===(j=eu.stack)||void 0===j?void 0:j.ips)||[]).join(" \xb7 ")||"—"})]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[null==eu?void 0:null===(N=eu.stack)||void 0===N?void 0:N.machine," \xb7 ",null==eu?void 0:null===(_=eu.stack)||void 0===_?void 0:_.kernel," \xb7 Python ",(null==eu?void 0:null===(S=eu.stack)||void 0===S?void 0:S.python)||"—"]})]}),(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:eT.slice(0,4).map(e=>(0,n.jsxs)("a",{href:(0,ep.p)(e.url),target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-xl border px-3 py-2 text-[11px] font-medium transition hover:-translate-y-0.5 ".concat("light"===eg?"border-slate-200 bg-white text-slate-700 shadow-sm":"border-white/10 bg-black/30 text-zinc-200 hover:bg-black/45"),children:[e.key.replace(/_/g," "),(0,n.jsx)(W.Z,{className:"h-3 w-3 opacity-60"})]},e.key))})]})]}),(0,n.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 xl:grid-cols-6",children:e5.map((e,t)=>(0,n.jsxs)(l.E.button,{type:"button",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.04*t},whileHover:{y:-2},whileTap:{scale:.98},onClick:()=>ef(e.id),className:"flex items-center gap-2 rounded-xl border bg-gradient-to-br px-3 py-3 text-left text-[11px] font-semibold ring-1 transition ".concat(e.accent),children:[(0,n.jsx)(e.icon,{className:"h-4 w-4 shrink-0 opacity-90"}),(0,n.jsx)("span",{className:"line-clamp-2 leading-snug",children:eb(e.zh,e.en)}),(0,n.jsx)(k.Z,{className:"ml-auto h-3.5 w-3.5 shrink-0 opacity-50"})]},e.id))}),(0,n.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-4",children:[(0,n.jsx)(e3,{theme:eg,icon:eq.Z,label:eb("CPU 1m","CPU 1m"),value:null!==(en=null==eu?void 0:null===(R=eu.snapshot)||void 0===R?void 0:null===(C=R.cpu_load)||void 0===C?void 0:null===(z=C["1m"])||void 0===z?void 0:z.toFixed(2))&&void 0!==en?en:"—",sub:"5m ".concat(null!==(el=null==eu?void 0:null===(T=eu.snapshot)||void 0===T?void 0:null===(M=T.cpu_load)||void 0===M?void 0:null===(P=M["5m"])||void 0===P?void 0:P.toFixed(2))&&void 0!==el?el:"—"," \xb7 15m ").concat(null!==(ei=null==eu?void 0:null===(D=eu.snapshot)||void 0===D?void 0:null===(I=D.cpu_load)||void 0===I?void 0:null===(U=I["15m"])||void 0===U?void 0:U.toFixed(2))&&void 0!==ei?ei:"—")}),(0,n.jsx)(e3,{theme:eg,icon:r.Z,label:eb("内存","Memory"),value:eX(eS),sub:"/ ".concat(eX(e_)),pct:e_?e0(ez,e_):void 0}),(0,n.jsx)(e3,{theme:eg,icon:L.Z,label:eb("磁盘","Disk"),value:eX(eR),sub:eb("可用","free"),pct:eC?e0(Math.max(0,eC-eR),eC):void 0}),(0,n.jsx)(e3,{theme:eg,icon:a.Z,label:eb("服务","Services"),value:"".concat(eN,"/").concat(ek||"—"),sub:function(e){if(null==e||!Number.isFinite(e))return"—";let t=Math.max(0,Math.floor(e)),s=Math.floor(t/86400),n=Math.floor(t%86400/3600),l=Math.floor(t%3600/60);return s>0?"".concat(s,"d ").concat(n,"h"):n>0?"".concat(n,"h ").concat(l,"m"):"".concat(l,"m")}(null==eu?void 0:null===(A=eu.snapshot)||void 0===A?void 0:A.uptime_seconds)+" "+eb("运行","uptime")})]}),(0,n.jsxs)("div",{className:"grid gap-4 xl:grid-cols-5 xl:items-stretch",children:[(0,n.jsx)(l.E.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"flex h-[248px] flex-col overflow-hidden xl:col-span-3 rounded-2xl border p-3 backdrop-blur-xl ".concat("light"===eg?"border-slate-200/90 bg-white/85":"border-white/[0.07] bg-zinc-950/40"),children:(0,n.jsx)(eJ.Z,{snapshot:null!==(er=null==eu?void 0:eu.snapshot)&&void 0!==er?er:null,theme:eg,tr:eb,compact:!0})}),(0,n.jsx)(l.E.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.05},className:"flex h-[248px] flex-col overflow-hidden xl:col-span-2 rounded-2xl border p-3 ".concat("light"===eg?"border-fuchsia-200/80 bg-gradient-to-br from-fuchsia-50/90 via-white to-cyan-50/70":"border-fuchsia-500/20 bg-gradient-to-br from-fuchsia-500/10 via-zinc-950/60 to-cyan-500/10"),children:(0,n.jsx)(e$,{tr:eb,className:"h-full",liveActive:eM,onOpenStudio:()=>ef("studio")})})]}),(0,n.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-2xl border p-4 ".concat("light"===eg?"border-violet-200/70 bg-white/90":"border-violet-500/20 bg-gradient-to-br from-violet-500/[0.08] to-transparent"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold ".concat("light"===eg?"text-slate-900":"text-white"),children:eb("直播进程","Live processes")}),(0,n.jsx)("span",{className:"rounded-full bg-white/10 px-2 py-0.5 font-mono text-[10px] text-zinc-400",children:(null==eu?void 0:null===(O=eu.live)||void 0===O?void 0:O.backend_mode)||"—"})]}),(0,n.jsxs)("ul",{className:"mt-3 max-h-52 space-y-2 overflow-y-auto pr-1",children:[(eL.length?eL:eP).slice(0,8).map(e=>{let t="pm2"in e?e.pm2:"",s="label"in e&&e.label||t,l="process_status"in e&&e.process_status||"status"in e&&e.status||"",i="".concat(t," ").concat(s).toLowerCase(),r=i.includes("tiktok")||i.includes("hdmi")?"live_tiktok":i.includes("youtube")||i.includes("yt")?"live_youtube":null;return(0,n.jsxs)("li",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r?()=>ef(r):void 0,onKeyDown:r?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),ef(r))}:void 0,className:"flex items-center gap-3 rounded-xl border px-3 py-2 transition ".concat("light"===eg?"border-slate-200 bg-slate-50/80":"border-white/[0.06] bg-black/25 hover:border-violet-400/20"," ").concat(r?"cursor-pointer hover:-translate-y-px hover:border-violet-400/30":""),children:[(0,n.jsx)(o.Z,{className:"h-4 w-4 shrink-0 text-violet-300/80"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"truncate text-xs font-medium text-zinc-200",children:s}),(0,n.jsx)("p",{className:"truncate font-mono text-[10px] text-zinc-600",children:t})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-md px-2 py-0.5 text-[10px] font-medium ".concat(e1(l||"")),children:function(e,t){let s=(e||"").trim().toLowerCase();return"online"===s||"running"===s||"streaming"===s?t("运行中","Running"):"configured"===s?t("已配置","Configured"):"not_found"===s?t("未注册","Unregistered"):"stopped"===s?t("已停止","Stopped"):"error"===s?t("异常","Error"):e||"—"}(l||"",eb)})]},t||s)}),eL.length||eP.length?null:(0,n.jsx)("li",{className:"py-6 text-center text-xs text-zinc-600",children:eb("暂无直播进程","No live processes")})]}),(0,n.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:()=>ef("live_youtube"),className:"rounded-xl bg-violet-500/20 py-2 text-[11px] font-semibold text-violet-100 ring-1 ring-violet-500/30 transition hover:bg-violet-500/30",children:"YouTube"}),(0,n.jsx)("button",{type:"button",onClick:()=>ef("live_tiktok"),className:"rounded-xl bg-cyan-500/20 py-2 text-[11px] font-semibold text-cyan-100 ring-1 ring-cyan-500/30 transition hover:bg-cyan-500/30",children:"TikTok"})]})]}),(null==eu?void 0:null===(F=eu.network)||void 0===F?void 0:null===(B=F.interfaces)||void 0===B?void 0:B.length)?(0,n.jsxs)("div",{className:"rounded-2xl border p-4 ".concat("light"===eg?"border-cyan-200/70 bg-white/90":"border-cyan-500/15 bg-cyan-500/[0.05]"),children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===eg?"text-slate-900":"text-white"),children:[(0,n.jsx)(E.Z,{className:"h-4 w-4 text-cyan-300"}),eb("网络吞吐","Network throughput")]}),(0,n.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/20 px-3 py-2.5",children:[(0,n.jsxs)("p",{className:"text-[10px] uppercase text-cyan-300/70",children:["↓ ",eb("下行","Down")]}),(0,n.jsx)("p",{className:"mt-1 font-mono text-lg font-bold text-cyan-100",children:eQ(eu.network.total_rx_bps)})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/20 px-3 py-2.5",children:[(0,n.jsxs)("p",{className:"text-[10px] uppercase text-cyan-300/70",children:["↑ ",eb("上行","Up")]}),(0,n.jsx)("p",{className:"mt-1 font-mono text-lg font-bold text-cyan-100",children:eQ(eu.network.total_tx_bps)})]})]}),(0,n.jsx)("div",{className:"mt-3 space-y-2",children:(eu.network.interfaces||[]).slice(0,3).map(e=>(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-white/[0.05] bg-black/20 px-3 py-2 font-mono text-[10px]",children:[(0,n.jsx)("span",{className:"font-semibold text-cyan-200/90",children:e.name}),(0,n.jsxs)("span",{className:"text-zinc-500",children:["↓ ",eQ(e.rx_bps)," \xb7 ↑ ",eQ(e.tx_bps)]})]},e.name))})]}):null]}),eE.length?(0,n.jsx)("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:eE.map(e=>(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border px-3 py-2.5 ".concat("light"===eg?"border-slate-200 bg-white":"border-white/[0.06] bg-black/25"),children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"truncate text-xs font-medium text-zinc-200",children:e.label}),(0,n.jsx)("p",{className:"truncate text-[10px] text-zinc-600",children:e.service_id})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat(e1(e.running?"online":e.status)),children:e.running?eb("运行中","Running"):e.status})]},e.service_id))}):null,(0,n.jsxs)("div",{className:"space-y-3",children:[ex?(0,n.jsxs)(e4,{id:"deploy",theme:eg,title:eb("安装验收","Deployment health"),subtitle:eb("API / 边缘反代 / mDNS 可用性","API, edge proxy, mDNS"),defaultOpen:!ex.ready,badge:(0,n.jsxs)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat(ex.ready?"bg-emerald-500/15 text-emerald-200":"bg-amber-500/15 text-amber-200"),children:[ex.pass_count,"/",ex.total_count]}),children:[(0,n.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[(0,n.jsx)("p",{className:"text-sm text-zinc-300",children:ex.ready?eb("必需检查已通过,控制面可交付。","Required checks passed."):eb("部分检查未通过,请查看失败项。","Some checks failed.")}),(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(ex.urls||{}).filter(e=>{let[,t]=e;return!!t}).slice(0,5).map(e=>{let[t,s]=e;return(0,n.jsx)("a",{href:(0,ep.p)(s),target:"_blank",rel:"noreferrer",className:"rounded-lg border border-white/10 bg-white/5 px-2.5 py-1.5 text-[10px] text-zinc-300",children:t},t)})})]}),(ex.failing_checks||[]).length?(0,n.jsx)("ul",{className:"mt-3 space-y-1.5",children:ex.failing_checks.slice(0,4).map(e=>(0,n.jsxs)("li",{className:"rounded-lg border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-100",children:[e.label,": ",e.detail||"—"]},e.id))}):null]}):null,(null==eu?void 0:eu.hardware)?(0,n.jsx)(e4,{id:"hardware",theme:eg,title:eb("硬件能力","Hardware profile"),subtitle:eb("GPU / NPU / FFmpeg 策略","GPU, NPU, FFmpeg"),defaultOpen:!1,children:(0,n.jsxs)("div",{className:"grid gap-3 font-mono text-[11px] text-zinc-400 sm:grid-cols-2",children:[(0,n.jsxs)("p",{children:["arch ",String(null!==(ea=eu.hardware.arch)&&void 0!==ea?ea:"—")]}),(0,n.jsxs)("p",{children:["GPU ",eu.hardware.gpu&&"object"==typeof eu.hardware.gpu&&eu.hardware.gpu.present?eb("有","yes"):eb("无","no")]}),(0,n.jsxs)("p",{className:"sm:col-span-2",children:["hwaccels"," ",(eu.hardware.ffmpeg_hwaccels||[]).join(", ")||"—"]})]})}):null,(null==eu?void 0:null===(H=eu.stack)||void 0===H?void 0:H.neko_login)?(0,n.jsxs)(e4,{id:"neko",theme:eg,title:"Neko ".concat(eb("登录","sign-in")),subtitle:ey||eb("多实例","multi-instance"),defaultOpen:!1,children:[(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:ev.map(e=>(0,n.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",children:[e.label," \xb7 ",e.accessLabel]},e.key))}),(0,n.jsx)("p",{className:"mt-3 text-[11px] text-amber-200/85",children:eb("昵称随意,密码须与环境变量一致(默认 12345678)。","Display name is free; password must match NEKO_* (default 12345678).")})]}):null,ew&&(null==eu?void 0:eu.probes)?(0,n.jsx)(e4,{id:"probes",theme:eg,title:eb("推流探针","Stream probes"),subtitle:"SRS \xb7 Neko",defaultOpen:!1,children:(0,n.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[eu.probes.srs?(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-3 text-[11px]",children:[(0,n.jsx)("p",{className:"font-semibold text-white",children:"SRS"}),(0,n.jsxs)("p",{className:"mt-1 text-zinc-500",children:["API ",eu.probes.srs.api_ok?"OK":"—"," \xb7 :",eu.probes.srs.port," \xb7 RTT ",null!==(ec=null!==(eo=null===(K=eu.probes.srs.http)||void 0===K?void 0:K.latency_ms)&&void 0!==eo?eo:null===(Y=eu.probes.srs.tcp)||void 0===Y?void 0:Y.latency_ms)&&void 0!==ec?ec:"—"," ms"]}),(null===(G=eu.probes.srs.http)||void 0===G?void 0:G.error)?(0,n.jsx)("p",{className:"mt-1 text-amber-300/80",children:eu.probes.srs.http.error}):null]}):null,eu.probes.neko?(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-3 text-[11px]",children:[(0,n.jsx)("p",{className:"font-semibold text-white",children:"Neko"}),(0,n.jsxs)("p",{className:"mt-1 text-zinc-500",children:[eu.probes.neko.running_count,"/",eu.probes.neko.required_count," ",eb("在线","online")," \xb7 HTTP ",null!==(ed=null===(q=eu.probes.neko.http)||void 0===q?void 0:q.http_code)&&void 0!==ed?ed:"—"]}),(null===(J=eu.probes.neko.http)||void 0===J?void 0:J.error)?(0,n.jsx)("p",{className:"mt-1 text-amber-300/80",children:eu.probes.neko.http.error}):null]}):null]})}):null,(null==eu?void 0:null===($=eu.live_events)||void 0===$?void 0:null===(V=$.pm2_tail)||void 0===V?void 0:V.length)||eP.length?(0,n.jsx)(e4,{id:"feeds",theme:eg,title:eb("事件流","Event feed"),defaultOpen:!1,children:(0,n.jsx)("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded-lg border border-white/[0.05] bg-black/40 p-3 font-mono text-[10px] text-zinc-400",children:((null==eu?void 0:null===(X=eu.live_events)||void 0===X?void 0:X.pm2_tail)||[]).slice(-12).join("\n")||eb("暂无日志","No logs")})}):null]})]})}var e9=s(5468),e7=s(1094),te=s(5621),tt=s(91),ts=s(2208),tn=s(1723),tl=s(9397),ti=s(90);let tr="live-hub-youtube-pro-v2",ta="youtube2__",to=/[^a-zA-Z0-9_.-]+/g,tc=new Set(["douyin_youtube","tiktok","obs","web"]);function td(e,t){var s;let n=(e||"").trim();if(!function(e){let t=(e||"").trim();return!t||/\?{2,}/.test(t)||/?{2,}/.test(t)||/�/.test(t)||/锟|绾胯矾|çº|è·|Â/.test(t)||/^(undefined|null|nan)$/i.test(t)}(n))return n;let l=(null===(s=n.match(/\d+/))||void 0===s?void 0:s[0])||String(Math.max(0,t)+1);return"线路 ".concat(l)}function tu(e){return e.map((e,t)=>({...e,name:td(e.name,t)}))}function tx(e){return(e||"").trim().replace(to,"_")}function tm(e,t){let s=tx(e);return!s||tc.has(s)||s===ta?tj(t):"youtube"===s||s.startsWith(ta)?s:tj(s)}function tp(e){return tm(String(e.pm2Name||""),String(e.id||""))}function th(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e||"object"!=typeof e)return null;let s=String(e.id||"").trim();return s?{id:s,name:td("string"==typeof e.name?e.name:"",t),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:tm("string"==typeof e.pm2Name?e.pm2Name:"",s),notes:"string"==typeof e.notes?e.notes:void 0}:null}function tg(e){if(!e)return[];try{let t=JSON.parse(e);if(!Array.isArray(t))return[];let s=t.map((e,t)=>th(e,t)).filter(e=>null!==e);return tu(s)}catch(e){return[]}}function tb(e){window.localStorage.setItem(tr,JSON.stringify(tu(e)))}let tf=["/hub/youtube_pro_channels","/youtube_pro_channels"];async function tv(e){for(let s of tf)try{var t;let n=await e(s);return{fetched:!0,channels:(t=n.channels,Array.isArray(t)?tu(t.map((e,t)=>th(e,t)).filter(e=>null!==e)):[])}}catch(e){}return{fetched:!1,channels:[]}}async function ty(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=null,l=tu(t);for(let t of tf)try{var i;let r=await e(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channels:l,force:!!s.force})});if((null===(i=r.neko)||void 0===i?void 0:i.ok)===!1){let e=r.neko.desired?" desired=".concat(r.neko.desired):"",t=r.neko.current?" current=".concat(r.neko.current):"";n=Error("Neko capacity expansion failed:".concat(e).concat(t," ").concat(r.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 tw(){return"ch_".concat(Date.now().toString(36),"_").concat(Math.random().toString(36).slice(2,7))}function tj(e){return"".concat(ta).concat(tx(e)||"channel")}function tN(e){return/youtube/i.test(e.script)||/youtube/i.test(e.pm2)}function tk(e){return e.trim().toLowerCase().startsWith("youtube2__")}function t_(e){return(e.split("/").pop()||e).replace(/\.[^.]+$/,"")}function tS(e){var t;return!!e&&(/youtube/i.test(e.pm2)||/youtube/i.test(null!==(t=e.script)&&void 0!==t?t:""))}function tz(e,t){let s=((null==t?void 0:t.business_status)||"").trim().toLowerCase();return(null==t?void 0:t.is_pushing)||"streaming"===s?0:tD(null==t?void 0:t.process_status)?1:"youtube"===e.pm2.trim().toLowerCase()?2:"youtube"===t_(e.script).trim().toLowerCase()?3:10}let tC="live-hub-youtube-mode-v1",tR=new Set(["douyin_youtube","tiktok","obs","web"]);function tL(e){var t,s,n;return{name:e.name,streamKey:null!==(t=e.streamKey)&&void 0!==t?t:"",pm2Name:null!==(s=e.pm2Name)&&void 0!==s?s:tj(e.id),notes:null!==(n=e.notes)&&void 0!==n?n:""}}function tP(e){return Object.fromEntries(e.map(e=>[e.id,tL(e)]))}function tM(e){let t=((null==e?void 0:e.business_status)||"").trim().toLowerCase();return!!(null==e?void 0:e.is_pushing)||"streaming"===t||"relay_slow"===t||"source_stalled"===t&&!!(null==e?void 0:e.ffmpeg_active)}function tT(e,t){return tM(e)?t("推流中","Pushing"):tA(e,t)}function tE(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3?arguments[3]:void 0;return((null==n?void 0:n.source_display)||(null==n?void 0:n.source_title)||"").trim()||tZ(t,s)||e.trim()}function tU(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=tZ(e,t).trim(),l=s.trim();return tM(e)&&l&&n&&l!==n?l:""}function tZ(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if((null==e?void 0:e.source_ambiguous)&&tM(e)&&!(null==e?void 0:e.source_current))return(s?eT("",s).trim():"")||"";{let t=((null==e?void 0:e.source_display)||(null==e?void 0:e.source_title)||"").trim();if(t)return t}let n=eT(t,s).trim();if(n)return n;let l=((null==e?void 0:e.source_room_id)||"").trim();return l?"抖音直播间 ".concat(l):""}function tI(e){var t;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=((null==e?void 0:e.source_url)||"").trim();if(n)return n;let l=eP(s);return tM(e)&&((null==e?void 0:e.source_ambiguous)||(null==e?void 0:e.source_display)||(null==e?void 0:e.source_title))&&l.length>1?"":null!==(t=l[0])&&void 0!==t?t:""}function tD(e){return/^(online|running)$/i.test((e||"").trim())}function tA(e,t){let s=((null==e?void 0:e.business_status)||"").trim().toLowerCase();return"ready"===s?t("已配置","Ready"):"streaming"===s?t("推流中","Pushing"):"source_stalled"===s?t("源卡住","Source stalled"):"relay_slow"===s?t("低速推流","Relay slow"):"waiting_source"===s?t("等待上游","Waiting source"):"source_live"===s?t("源已开播,转推未起","Source live, relay down"):"monitoring"===s?t("监控中","Monitoring"):"misconfigured"===s?t("密钥异常","Key invalid"):"youtube_key_rejected"===s?t("密钥被 YouTube 拒绝","Key rejected"):"stale"===s?t("心跳过期","Stale"):"error"===s?t("异常","Error"):tD(null==e?void 0:e.process_status)?t("运行中","Running"):((null==e?void 0:e.process_status)||"").trim()||t("未运行","Idle")}function tO(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":"relay_slow"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/25":"source_stalled"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/25":"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||"youtube_key_rejected"===t||"error"===t||"stale"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/25":tD(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"}function tB(e){let t=Math.max(0,Math.floor(e||0));if(t<60)return"".concat(t,"s");let s=Math.floor(t/60);return s<60?"".concat(s,"m ").concat(t%60,"s"):"".concat(Math.floor(s/60),"h ").concat(s%60,"m")}function tF(e){if(!e)return"-";try{return new Date(1e3*e).toLocaleString()}catch(e){return"-"}}function tW(e){let t=(e||"").toLowerCase();return"active"===t?"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30":"error"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"ended"===t?"bg-zinc-600/20 text-zinc-300 ring-zinc-500/25":"bg-cyan-500/15 text-cyan-100 ring-cyan-500/25"}function tH(e,t){let s=(e||"").toLowerCase();return"active"===s?t("直播中","Live"):"ended"===s?t("已结束","Ended"):"error"===s?t("异常","Problem"):"idle"===s?t("等待中","Waiting"):t("记录","Record")}function tK(e,t){return null==e?t?t("未知","Unknown"):"-":e.toLocaleString()}function tY(e,t){return e?(e.source_title||e.channel_name||"").trim()||(e.source_room_id?t("抖音直播间 ".concat(e.source_room_id),"Douyin room ".concat(e.source_room_id)):e.process?t("直播线路 ".concat(e.process),"Relay lane ".concat(e.process)):t("直播事件 #".concat(e.id),"Live event #".concat(e.id))):t("未选择直播","No event selected")}function tG(e,t){return e?e.source_room_id?t("抖音房间 ".concat(e.source_room_id),"Douyin room ".concat(e.source_room_id)):e.source_url?e.source_url.replace(/^https?:\/\//,""):t("来源未识别","Unknown source"):"-"}function tq(e,t){let s=Math.max(0,Math.floor(e||0));if(s<60)return t("".concat(s," 秒"),"".concat(s,"s"));let n=Math.floor(s/60);if(n<60)return t("".concat(n," 分 ").concat(s%60," 秒"),"".concat(n,"m ").concat(s%60,"s"));let l=Math.floor(n/60),i=n%60;return t("".concat(l," 小时 ").concat(i," 分"),"".concat(l,"h ").concat(i,"m"))}function tJ(e){if(!e)return"-";try{return new Date(1e3*e).toLocaleString(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1})}catch(e){return"-"}}function tV(e,t){var s;if(!e)return"-";let n=(e.status||"").toLowerCase(),l="".concat(e.last_health||""," ").concat(e.last_live_status||""," ").concat(e.last_popup_text||"").toLowerCase();return"error"===n||/error|failed|poor|unstable|异常|错误|失败/.test(l)?t("需要处理","Needs attention"):e.last_popup_text?t("有弹窗","Popup seen"):(null!==(s=e.quality_score)&&void 0!==s?s:100)<50?t("质量偏低","Low quality"):t("正常","Normal")}function t$(e){let t=tV(e,e=>e);return"需要处理"===t||"质量偏低"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"有弹窗"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/30":"bg-emerald-500/15 text-emerald-100 ring-emerald-500/25"}function tX(e){let t=Number(e||0);return t>=80?"text-emerald-200":t>=55?"text-amber-200":"text-rose-200"}function tQ(e){let t=(e||"").toLowerCase();return"critical"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"warning"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/30":"ok"===t?"bg-emerald-500/15 text-emerald-100 ring-emerald-500/25":"bg-cyan-500/15 text-cyan-100 ring-cyan-500/25"}function t0(e){let{label:t,value:s,helper:l,warn:i=!1,accent:r="cyan"}=e;return(0,n.jsxs)("div",{className:"group relative overflow-hidden rounded-xl border border-white/[0.06] bg-black/25 p-3 min-w-0 transition hover:border-white/12",children:[(0,n.jsx)("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br ".concat("emerald"===r?"from-emerald-500/20 via-transparent to-cyan-500/10":"amber"===r?"from-amber-500/20 via-transparent to-rose-500/10":"violet"===r?"from-violet-500/20 via-transparent to-cyan-500/10":"from-cyan-500/20 via-transparent to-violet-500/10"," opacity-70")}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:t}),(0,n.jsx)("p",{className:"mt-1 text-xl font-semibold tracking-tight ".concat(i?"text-amber-200":"text-white"),children:(0,n.jsx)("span",{className:i?"inline-flex animate-pulse":"",children:s})}),(0,n.jsx)("p",{className:"mt-1 text-[10px] text-zinc-600",children:l})]})]})}function t1(e,t){return e_(e,null==t?void 0:t.metrics,"")}function t5(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith("#"))}function t2(e,t){return t5(e).length>0&&0===t5(t).length}function t3(e){let{kind:t,busyKind:s,targetPm2:l,busy:i,online:r,label:a,className:o,baseLock:c,onRun:d,notify:u,t:x,compact:m}=e,p=function(e){if(!(null==e?void 0:e.startsWith("proc:")))return null;let t=e.slice(5),s=t.indexOf(":");if(s<=0)return null;let n=t.slice(0,s),l=t.slice(s+1);return l&&["start","stop","restart"].includes(n)?{action:n,pm2:l}:null}(i),h=p&&p.pm2===l,g=null!=s?s:t,b=!!(h&&p.action===g),f=!!(h&&p.action!==g),v="start"===t&&r,w="stop"===t&&!r,j="restart"===t&&!r,N=v||w||j;return(0,n.jsxs)("button",{type:"button",onClick:()=>{if(!b){if(f){u(x("请等待当前操作完成","Wait for the current action to finish"));return}if(v){u(x("已在直播中,无需重复开始","Already live"));return}if(w){u(x("当前未在直播,无法停止","Not live — cannot stop"));return}if(j){u(x("进程未运行时请使用「开始直播」","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||b||f?"cursor-not-allowed":""," ").concat(N&&!b?"opacity-45":""," ").concat(f?"opacity-35":""," ").concat(b?"ring-violet-400/40":""),children:[b?(0,n.jsx)("span",{className:"absolute inset-0 flex items-center justify-center bg-black/25 backdrop-blur-[2px]",children:(0,n.jsx)(y.Z,{className:"".concat(m?"h-4 w-4":"h-6 w-6"," animate-spin text-white")})}):null,(0,n.jsxs)("span",{className:"inline-flex items-center justify-center gap-1.5 ".concat(b?"invisible":""),children:[N?(0,n.jsx)(e9.Z,{className:"".concat(m?"h-3 w-3":"h-4 w-4"," shrink-0 opacity-90"),"aria-hidden":!0}):null,a]})]})}function t4(e){var t,s,l,i,a,o,d,u,x,m,p,h,g,b,f,v,j,N,k,_,S,C,R,L,P,M,T,E,U,I;let{t:D,busy:A,entries:O,currentProc:B,setCurrentProc:F,urlConfig:H,setUrlConfig:K,onRunProcess:q,onSaveUrlConfig:J,fetchJson:V,liveProcesses:$,notify:X,onNavigate:Q,onRefresh:ee,quickLinks:et}=e,es=(0,Z.useMemo)(()=>O.filter(tN),[O]),en=(0,Z.useMemo)(()=>(function(e,t){let s=e.filter(e=>tN(e)&&!tk(e.pm2)),n=s.filter(e=>tN(e)&&e.pm2.trim()===t_(e.script).trim()),l=n.length?[...n]:s.length?[...s]:[...e],i=new Set(l.map(e=>e.pm2.trim()));for(let e of t.filter(e=>tS(e)&&!tk(e.pm2))){var r,a,o,c;let t=e.pm2.trim();if(!t||i.has(t))continue;let n=(e.business_status||"").trim().toLowerCase();if(!e.is_pushing&&"streaming"!==n&&!tD(e.process_status))continue;let d=s.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=s[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})(es.length?es:O,$),[O,$,es]),el=(0,Z.useMemo)(()=>(function(e,t){if(!e.length)return"";let s=new Map(t.filter(tS).map(e=>[e.pm2.trim(),e])),n=e[0],l=tz(n,s.get(n.pm2.trim()));for(let t of e.slice(1)){let e=tz(t,s.get(t.pm2.trim()));e"youtube"===e.pm2.trim().toLowerCase());if(n)return n.pm2;let l=e.find(e=>"youtube"===t_(e.script).trim().toLowerCase());return l?l.pm2:null!==(s=null===(t=e[0])||void 0===t?void 0:t.pm2)&&void 0!==s?s:""}(en),[$,en]),[ei,er]=(0,Z.useState)("single"),[ea,eo]=(0,Z.useState)([]),[ec,ed]=(0,Z.useState)(""),[eu,ex]=(0,Z.useState)(H),[em,eb]=(0,Z.useState)(""),[ef,ew]=(0,Z.useState)({key:"",rtmps:!0,bitrate:"",fastAudio:!0}),[ej,eN]=(0,Z.useState)(null),[ek,e_]=(0,Z.useState)(!1),[eS,eM]=(0,Z.useState)(""),[eT,eE]=(0,Z.useState)(!0),[eU,eA]=(0,Z.useState)(!1),[eB,eF]=(0,Z.useState)(!1),[eW,eH]=(0,Z.useState)(null),[eK,eY]=(0,Z.useState)({}),[eG,eq]=(0,Z.useState)(!1),[eJ,eV]=(0,Z.useState)(null),[e$,eX]=(0,Z.useState)(0),[eQ,e0]=(0,Z.useState)(null),[e1,e5]=(0,Z.useState)(null),[e2,e3]=(0,Z.useState)(!1),[e4,e6]=(0,Z.useState)(null),[e8,e9]=(0,Z.useState)(!1),[ta,to]=(0,Z.useState)(!0),[tc,tm]=(0,Z.useState)(null),[th,tf]=(0,Z.useState)(null),t4=(0,Z.useRef)(!1),t6=(0,Z.useRef)(H),t8=(0,Z.useRef)(eS),t9=(0,Z.useRef)([]),t7=(0,Z.useRef)(B),se=(0,Z.useRef)(0),st=(0,Z.useRef)(0),ss=(0,Z.useRef)(0),sn=(0,Z.useRef)(0),sl=(0,Z.useRef)({}),si=(0,Z.useRef)({}),sr=(0,Z.useCallback)(e=>{t6.current=e,ex(e),K(e)},[K]),sa=(0,Z.useCallback)(e=>{t8.current=e,eM(e)},[]),so=(0,Z.useCallback)(e=>{let t=e.trim();if(!t)return Promise.resolve("");let s=sl.current[t];if(s)return s;let n=new URLSearchParams({process:t,_ts:String(Date.now())}),l=V("/get_url_config?".concat(n)).then(e=>{var t;return null!==(t=e.content)&&void 0!==t?t:""});return sl.current[t]=l,l.then(()=>{sl.current[t]===l&&delete sl.current[t]},()=>{sl.current[t]===l&&delete sl.current[t]}),l},[V]),sc=(0,Z.useCallback)(e=>{let t=e.trim();if(!t)return Promise.resolve("");let s=si.current[t];if(s)return s;let n=new URLSearchParams({process:t,_ts:String(Date.now())}),l=V("/get_config?".concat(n)).then(e=>{var t;return null!==(t=e.content)&&void 0!==t?t:""});return si.current[t]=l,l.then(()=>{si.current[t]===l&&delete si.current[t]},()=>{si.current[t]===l&&delete si.current[t]}),l},[V]),sd=(0,Z.useCallback)(()=>{let e=++ss.current;return eA(!0),e},[]),su=(0,Z.useCallback)(e=>{e===ss.current&&eA(!1)},[]),sx=(0,Z.useCallback)(()=>{let e=++sn.current;return e_(!0),e},[]),sm=(0,Z.useCallback)(e=>{e===sn.current&&e_(!1)},[]);(0,Z.useEffect)(()=>{let e=()=>to("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,Z.useEffect)(()=>{t4.current=!1},[B]),(0,Z.useEffect)(()=>{t7.current=B},[B]),(0,Z.useEffect)(()=>{"single"===ei&&(t6.current=H,ex(H))},[ei,H]),(0,Z.useEffect)(()=>{t8.current=eS},[eS]),(0,Z.useEffect)(()=>{t9.current=ea},[ea]),(0,Z.useEffect)(()=>{se.current+=1,st.current+=1,t4.current=!1,eH(null)},[ei,ec]);let sp=(0,Z.useCallback)(async()=>{let e=t7.current.trim();if(!e)return;if("pro"===ei){let t=t9.current.find(e=>e.id===ec);if(!t||tp(t)!==e)return}let t=++se.current;try{let l=await so(e);if(t!==se.current||e!==t7.current.trim()||t4.current)return;if("single"===ei)sr(l);else{var s,n;let e=null!==(n=null===(s=t9.current.find(e=>e.id===ec))||void 0===s?void 0:s.urlLines)&&void 0!==n?n:"";if(t2(e,l)){sa(e);return}sa(l)}}catch(e){}},[ec,sa,sr,ei,so]),sh=(0,Z.useMemo)(()=>({pageVisible:ta}).pageVisible?12e3:0,[ta]);(0,Z.useEffect)(()=>{if(!B||!eT||sh<=0)return;let e=window.setInterval(()=>{t4.current||sp()},sh);return()=>clearInterval(e)},[B,eT,sp,sh]);let sg=async()=>{let e=t7.current.trim();if(!e)return;if("pro"===ei){let t=t9.current.find(e=>e.id===ec);if(!t||tp(t)!==e)return}let t=sd();eH(null),t4.current=!1;let s=++se.current;try{let t=await so(e);if(s!==se.current||e!==t7.current.trim())return;if(t4.current){eH(D("检测到本地未保存修改,已保留当前草稿","Kept the local unsaved draft"));return}if("single"===ei)sr(t);else{var n,l;let e=null!==(l=null===(n=t9.current.find(e=>e.id===ec))||void 0===n?void 0:n.urlLines)&&void 0!==l?l:"";if(t2(e,t)){sa(e),eH(D("服务器暂无已保存 URL,已保留本地草稿","Server has no saved URLs, kept the local draft"));return}sa(t)}eH(D("已从服务器读取 URL_config","Reloaded URL_config from server"))}catch(t){if(s!==se.current||e!==t7.current.trim())return;eH(t.message)}finally{su(t)}};(0,Z.useEffect)(()=>{try{let e=window.localStorage.getItem(tC);("pro"===e||"single"===e)&&er(e)}catch(e){}},[]),(0,Z.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await tv(V);if(t.fetched&&t.channels.length&&!e){let e=tu(t.channels);t9.current=e,eo(e),eY(tP(e)),tb(e);return}}catch(e){}if(e)return;let t=function(){let e=window.localStorage.getItem(tr);if(!e&&(e=window.localStorage.getItem("live-hub-youtube-pro-v1"))){let t=tg(e);if(t.length)return window.localStorage.setItem(tr,JSON.stringify(t)),t}return tg(e)}(),s=tu(t.length>0?t:(()=>{let e=tw();return[{id:e,name:"线路 1",streamKey:"",urlLines:"",pm2Name:tj(e),notes:""}]})());t9.current=s,eo(s),eY(tP(s)),tb(s)})(),()=>{e=!0}},[V]),(0,Z.useEffect)(()=>{if(!ea.length){ec&&ed("");return}ec&&ea.some(e=>e.id===ec)||ed(ea[0].id)},[ea,ec]);let sb=ea.find(e=>e.id===ec)||ea[0],sf=(0,Z.useMemo)(()=>ea.find(e=>tp(e)===B),[ea,B]),sv=(0,Z.useCallback)(e=>$.find(t=>t.pm2===e),[$]),sy=(0,Z.useCallback)(e=>{var t;return null===(t=sv(e))||void 0===t?void 0:t.process_status},[sv]),sw=sv(B),sj=sv(B);(0,Z.useEffect)(()=>{"single"===ei&&el&&!B&&(t7.current=el,F(el))},[B,ei,el,F]);let sN=(0,Z.useCallback)(e=>{let t=tu(e);t9.current=t,eo(t),tb(t)},[]),sk=(0,Z.useCallback)((e,t)=>{let s=e.trim();if(!s)return;let n=!1,l=t9.current.map(e=>tp(e)!==s?e:(n=!0,{...e,...t}));n&&sN(l)},[sN]),s_=(0,Z.useCallback)(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};await ty(V,e,t)},[V]),sS=(0,Z.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sN(e),s_(e,t).catch(e=>{X("".concat(D("多频道列表未同步到服务器","Channel list not saved on server"),": ").concat(e.message))})},[sN,X,s_,D]),sz=(0,Z.useMemo)(()=>{var e;return sb?null!==(e=eK[sb.id])&&void 0!==e?e:tL(sb):null},[sb,eK]);(0,Z.useEffect)(()=>{sb&&eY(e=>e[sb.id]?e:{...e,[sb.id]:tL(sb)})},[sb]),(0,Z.useEffect)(()=>{if(!sb||"youtube"!==tp(sb))return;let e=ef.key.trim();e&&eY(t=>{var s;let n=null!==(s=t[sb.id])&&void 0!==s?s:tL(sb);return n.streamKey.trim()===e&&"youtube"===n.pm2Name||n.streamKey.trim()?t:{...t,[sb.id]:{...n,streamKey:e,pm2Name:"youtube"}}})},[sb,ef.key]),(0,Z.useEffect)(()=>{eV(null)},[ec]);let sC=(0,Z.useCallback)((e,t)=>{sb&&(eY(s=>{var n;return{...s,[sb.id]:{...null!==(n=s[sb.id])&&void 0!==n?n:tL(sb),[e]:t}}}),eV(null))},[sb]),sR=sb?tp(sb):"",sL=sb&&sz?tp({id:sb.id,pm2Name:sz.pm2Name}):"",sP=!!sb&&!!sz&&sL!==sR,sM=(0,Z.useMemo)(()=>{if(!sb||!sz)return{ok:!1,message:D("请选择线路","Pick a lane"),normalizedName:"",normalizedPm2:"",normalizedStreamKey:"",normalizedNotes:""};let e=ea.findIndex(e=>e.id===sb.id),t=td(sz.name,e>=0?e:0),s=tp({id:sb.id,pm2Name:sz.pm2Name});return s?tR.has(s)?{ok:!1,message:D("该进程名保留给系统模块,请换一个","This PM2 name is reserved"),normalizedName:t,normalizedPm2:s,normalizedStreamKey:sz.streamKey.trim(),normalizedNotes:sz.notes.trim()}:ea.find(e=>e.id!==sb.id&&tp(e)===s)?{ok:!1,message:D("该进程名已被其它线路占用","Another lane already uses this PM2 name"),normalizedName:t,normalizedPm2:s,normalizedStreamKey:sz.streamKey.trim(),normalizedNotes:sz.notes.trim()}:{ok:!0,message:"",normalizedName:t,normalizedPm2:s,normalizedStreamKey:sz.streamKey.trim(),normalizedNotes:sz.notes.trim()}:{ok:!1,message:D("进程名不能为空","PM2 name is required"),normalizedName:t,normalizedPm2:s,normalizedStreamKey:sz.streamKey.trim(),normalizedNotes:sz.notes.trim()}},[sb,sz,ea,D]),sT=(0,Z.useMemo)(()=>{if(!sb||!sz)return!1;let e=tL(sb);return sz.name!==e.name||sz.streamKey!==e.streamKey||tx(sz.pm2Name)!==tx(e.pm2Name)||sz.notes!==e.notes},[sb,sz]),sE=(0,Z.useCallback)(async e=>{let t=e.trim();if(!t)return;let s=++se.current,n=++st.current;t4.current=!1;let l=sd(),i=sx();eH(D("正在同步单频道配置...","Syncing single-channel config...")),eN(null);try{let[e,l]=await Promise.allSettled([so(t),sc(t)]);if(s===se.current&&t===t7.current.trim()&&("fulfilled"===e.status?(sr(e.value),eH(D("单频道配置已实时同步","Single-channel config synced"))):eH(e.reason instanceof Error?e.reason.message:String(e.reason))),n===st.current&&t===t7.current.trim()){if("fulfilled"===l.status){let e=l.value;eb(e),ew(eZ(e))}else eN(l.reason instanceof Error?l.reason.message:String(l.reason))}}finally{su(l),sm(i),t===t7.current.trim()&&eX(e=>e+1)}},[sr,sd,sx,su,sm,so,sc,D]),sU=(0,Z.useCallback)(async e=>{let t=tp(e).trim();if(!t)return;let s=++se.current,n=++st.current;t4.current=!1;let l=sd(),i=sx();eH(D("正在同步当前线路配置...","Syncing current lane config...")),eN(null);try{let[l,i]=await Promise.allSettled([so(t),sc(t)]);if(s===se.current&&t===t7.current.trim()){if("fulfilled"===l.status){var r;let s=l.value,n=null!==(r=e.urlLines)&&void 0!==r?r:"";t2(n,s)?(sa(n),sk(t,{urlLines:n}),eH(D("服务器暂无已保存 URL,已保留当前线路草稿","Server has no saved URLs, kept this lane draft"))):(sa(s),sk(t,{urlLines:s}),eH(D("当前线路地址已实时同步","Current lane URLs synced")))}else eH(l.reason instanceof Error?l.reason.message:String(l.reason))}if(n===st.current&&t===t7.current.trim()){if("fulfilled"===i.status){let t=i.value,s=eZ(t);eb(t),ew(s),s.key.trim()&&eY(t=>{var n,l;let i=null!==(n=t[e.id])&&void 0!==n?n:tL(e);return i.streamKey.trim()&&i.streamKey.trim()!==(null!==(l=e.streamKey)&&void 0!==l?l:"").trim()||i.streamKey.trim()===s.key.trim()?t:{...t,[e.id]:{...i,streamKey:s.key.trim()}}})}else eN(i.reason instanceof Error?i.reason.message:String(i.reason))}}finally{su(l),sm(i),t===t7.current.trim()&&eX(e=>e+1)}},[sa,sd,sx,su,sm,sk,so,sc,D]);(0,Z.useCallback)(async()=>{try{var e,t;let s=await tv(V);if(!s.fetched||!s.channels.length)return;let n=tu(s.channels);t9.current=n,eo(n),eY(tP(n)),tb(n);let l=null!==(e=n.find(e=>e.id===ec))&&void 0!==e?e:n[0];if(!l)return;ed(l.id),sa((null!==(t=l.urlLines)&&void 0!==t?t:"").trim());let i=tp(l);t7.current=i,F(i),sU(l)}catch(e){}},[ec,sa,V,sU,F]);let sZ=(0,Z.useCallback)(e=>{var t,s,n,l;if("pro"===e&&"single"===ei&&!ef.key.trim()){X(D("请先填写并保存 YouTube 推流 key,再切换到多频道 Pro","Fill and save the YouTube stream key before switching to Multi Pro"));return}if("single"===e){let e=t7.current.trim(),s=sb?tp(sb):"",n="pro"===ei?s||e:e||el||(null===(t=en[0])||void 0===t?void 0:t.pm2)||"";n&&(t7.current=n,F(n),sE(n))}if("pro"===e&&ea.length){let e=t7.current.trim(),t=null!==(n=null!==(s=ea.find(t=>tp(t)===e))&&void 0!==s?s:ea.find(e=>e.id===ec))&&void 0!==n?n:ea[0];if(sa((null!==(l=null==t?void 0:t.urlLines)&&void 0!==l?l:"").trim()),t){ed(t.id);let e=tp(t);t7.current=e,F(e),sU(t)}}er(e);try{window.localStorage.setItem(tC,e)}catch(e){}},[ea,sa,sb,ec,ei,X,el,sU,sE,F,en,D,ef.key]),sI=(0,Z.useCallback)(e=>{var t;sa((null!==(t=e.urlLines)&&void 0!==t?t:"").trim()),ed(e.id);let s=tp(e);t7.current=s,F(s),sU(e)},[sa,sU,F]);(0,Z.useEffect)(()=>{if("pro"!==ei||!ec)return;let e=ea.find(e=>e.id===ec);if(!e)return;let t=tp(e);t7.current=t,F(t)},[ei,ec,ea,F]);let sD=(0,Z.useCallback)(async()=>{let e=t7.current.trim();if(!e)return;let t=++st.current,s=sx();eN(null);try{let s=await sc(e);if(t!==st.current||e!==t7.current.trim())return;eb(s),ew(eZ(s))}catch(s){if(t!==st.current||e!==t7.current.trim())return;eN(s.message)}finally{sm(s)}},[sx,sm,sc]);(0,Z.useEffect)(()=>{if(B){if("pro"===ei){if(!sb||B!==tp(sb))return;sp(),sD(),eX(e=>e+1);return}sE(B)}},[sb,ec,B,sD,ei,sp,sE]);let sA=(0,Z.useCallback)(async()=>{var e;if(!sb||!sz)throw Error(D("请选择线路","Pick a lane"));if(!sM.ok)throw Error(sM.message);let t=t8.current,s=ea.map(e=>e.id===sb.id?{...e,name:sM.normalizedName,streamKey:sM.normalizedStreamKey,pm2Name:sM.normalizedPm2,notes:sM.normalizedNotes,urlLines:t}:e);return await s_(s,{force:!0}),sN(s),eY(e=>({...e,[sb.id]:{name:sM.normalizedName,streamKey:sM.normalizedStreamKey,pm2Name:sM.normalizedPm2,notes:sM.normalizedNotes}})),{next:s,savedLane:null!==(e=s.find(e=>e.id===sb.id))&&void 0!==e?e:{...sb,name:sM.normalizedName,streamKey:sM.normalizedStreamKey,pm2Name:sM.normalizedPm2,notes:sM.normalizedNotes,urlLines:t},pm2:sM.normalizedPm2}},[sb,sz,sM,sN,ea,s_,D]),sO=(0,Z.useCallback)(async()=>{if(sb){eq(!0),eV(null);try{let e=await sA();t7.current=e.pm2,F(e.pm2),eV(D("线路设置已保存","Lane settings saved"))}catch(t){let e=t.message;eV(e),X(e)}finally{eq(!1)}}},[sb,X,sA,F,D]),sB=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t7.current,s=t.trim();if(!s){eN(D("请选择进程","Pick a process"));return}st.current+=1;let n=sx();eN(null);try{let t=new URLSearchParams({process:s});await V("/save_config?".concat(t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})}),eb(e),sk(s,{streamKey:eZ(e).key}),eN(D("youtube.ini 已保存","youtube.ini saved"))}catch(e){eN(e.message)}finally{sm(n)}},sF=async()=>{let e=eD(ef);await sB(e)},sW=async()=>{st.current+=1;let e=sx();eN(null);try{var t,s;let e=em||eD(ef),n=await V("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:"app-config",path:(s=t7.current,"youtube.".concat(s.replace(/[^a-zA-Z0-9_.-]/g,"_"),".ini")),content:e,action:"youtube_balanced_preset"})}),l=null!==(t=n.content)&&void 0!==t?t:e;eb(l),ew(eZ(l)),eN(n.message||D("已应用 YouTube 预设","Applied YouTube preset"))}catch(e){eN(e.message)}finally{sm(e)}},sH=(0,Z.useMemo)(()=>{var e,t;if("single"===ei)return eL("key = ".concat(ef.key));let s=null!==(t=null!==(e=null==sz?void 0:sz.streamKey)&&void 0!==e?e:null==sb?void 0:sb.streamKey)&&void 0!==t?t:"";return eL("key = ".concat(s))},[ei,null==sb?void 0:sb.streamKey,ef.key,null==sz?void 0:sz.streamKey]),sK=sH?"…".concat(sH):"—",sY=async()=>{if(!sb){let e=D("请选择线路后再保存地址","Pick a lane before saving URLs");eV(e),X(e);return}if(nr){eV(nr),X(nr);return}try{eq(!0),eV(null),se.current+=1;let e=t8.current,t=await sA();t7.current=t.pm2,F(t.pm2),await Promise.resolve(J(e,t.pm2)),t4.current=!1,eV(D("线路与地址已保存","Lane settings and URLs saved"))}catch(t){let e=t instanceof Error?t.message:String(t);eV(e),X(e)}finally{eq(!1)}},sG=async()=>{if(nr){X(nr);return}let e=t7.current.trim();if(!e){X(D("请选择进程","Pick a process"));return}try{se.current+=1,await Promise.resolve(J(t6.current,e)),sk(e,{urlLines:t6.current}),t4.current=!1}catch(e){}},sq=async()=>{let e="single"===ei?t6.current:t8.current;eF(!0),eH(null);try{var t;let s=await V("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:"app-config",path:eI(t7.current),content:e,action:"dedupe_urls"})}),n=null!==(t=s.content)&&void 0!==t?t:e;"single"===ei?sr(n):sa(n),t4.current=!0,eH(s.message||D("已去重当前 URL 列表","Deduplicated current URL list"))}catch(e){eH(e.message)}finally{eF(!1)}},sJ=async()=>{if(!sb||!sz)return;let e=eZ(em||eD(ef)),t=eD({key:sz.streamKey.trim(),rtmps:e.rtmps,bitrate:e.bitrate,fastAudio:e.fastAudio});eq(!0),eV(null);try{let e=await sA();t7.current=e.pm2,F(e.pm2),await sB(t,e.pm2),eV(D("线路设置与 youtube.ini 已保存","Lane settings and youtube.ini saved"))}catch(t){let e=t.message;eV(e),X(e)}finally{eq(!1)}},sV="single"===ei?eu:eS,s$=(0,Z.useMemo)(()=>t5(sV).length,[sV]),sX=(0,Z.useMemo)(()=>eP(sV).length,[sV]),sQ=(0,Z.useMemo)(()=>(0,ti.O0)(et),[et]),s0=(0,Z.useMemo)(()=>(0,ti.U_)(sQ,"pro"===ei&&sb?ea.findIndex(e=>e.id===sb.id):0),[sb,ea,ei,sQ]),s1=s0.link?(0,ep.p)(s0.link.url):(0,ep.p)("http://live.local:9200/"),s5=(0,Z.useMemo)(()=>(0,ti.Tc)(sQ),[sQ]),s2=(0,Z.useMemo)(()=>{var e;return[null===(e=s0.link)||void 0===e?void 0:e.url,null==et?void 0:et.chromium_remote_debug,null==et?void 0:et.srs_api].filter(e=>!!e)},[et,null===(t=s0.link)||void 0===t?void 0:t.url]),s3=(0,Z.useCallback)(async(e,t)=>{if(!tc&&("delete"!==t||window.confirm("".concat(e.label,": 删除容器?浏览器配置和登录数据会保留,之后点“启动”会自动重建。")))){tm("".concat(e.id,":").concat(t)),tf(null);try{let s=await V("/neko/instance_action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id,action:t})}),n=s.running?D("运行中","running"):s.exists?D("已停止","stopped"):D("容器不存在","missing"),l=s.message||"".concat(e.label,": ").concat(n);tf("".concat(l," \xb7 ").concat(n)),await (null==ee?void 0:ee())}catch(t){let e=t.message;tf(e),X(e)}finally{tm(null)}}},[V,tc,X,ee,D]),s4=(0,Z.useCallback)(async e=>{let t=sb?tp(sb):"";return sb&&e===t?await sA():(sN(ea),await s_(ea,{force:!0}),{next:ea,savedLane:null!=sb?sb:null,pm2:e})},[sb,sN,ea,sA,s_]),s6=(0,Z.useCallback)(async(e,t)=>{let s=!!sb&&tp(sb)===t;if("stop"!==e){var n,l;let e=ea,s=t;try{let n=await s4(t);e=n.next,s=n.pm2}catch(e){X("".concat(D("当前线路保存失败","Failed to save the active lane"),": ").concat(e.message));return}let i=e.find(e=>tp(e)===s),r=null!==(n=null==i?void 0:i.urlLines)&&void 0!==n?n:"";if(!(null!==(l=null==i?void 0:i.streamKey)&&void 0!==l?l:"").trim()){X(D("请先填写当前线路的推流密钥","Fill the stream key before starting"));return}if(!t5(r).length){X(D("请先填写当前线路的直播地址","Fill the source URLs before starting"));return}t=s}s&&F(t),q(e,t)},[sb,ea,s4,X,q,F,D]),s8=(0,Z.useCallback)(async e=>{e3(!0);try{var t,s,n,l;let i=await V("/hub/youtube/live/summary");e0(i);let r=i.active||[],a=t7.current.trim(),o=null!==(l=null!==(n=null!=e?e:a?null===(t=r.find(e=>e.process===a))||void 0===t?void 0:t.id:void 0)&&void 0!==n?n:null===(s=r[0])||void 0===s?void 0:s.id)&&void 0!==l?l:null==e1?void 0:e1.id;if(o){let e=await V("/hub/youtube/live/events/".concat(encodeURIComponent(String(o))));e.event&&e5(e.event)}}catch(e){}finally{e3(!1)}},[V,null==e1?void 0:e1.id]),s9=(0,Z.useCallback)(async e=>{e3(!0);try{let t=await V("/hub/youtube/live/events/".concat(encodeURIComponent(String(e))));e5(t.event||null)}catch(e){X(e.message)}finally{e3(!1)}},[V,X]),s7=null!==(u=null==eQ?void 0:null===(s=eQ.active)||void 0===s?void 0:s.length)&&void 0!==u?u:0,ne=(0,Z.useMemo)(()=>{var e;return(e={activeEvents:s7,pageVisible:ta}).pageVisible?e.activeEvents>0?4e3:12e3:3e4},[s7,ta]);(0,Z.useEffect)(()=>{if(s8(null),ne<=0)return;let e=window.setInterval(()=>void s8(),ne);return()=>window.clearInterval(e)},[ne,s8]),(0,Z.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&s8(null)};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[s8]);let nt=(0,Z.useCallback)(async()=>{e9(!0);try{let e=await V("/hub/youtube/quality_guard");e6(e)}catch(e){}finally{e9(!1)}},[V]),ns=null!==(x=null==e4?void 0:null===(l=e4.summary)||void 0===l?void 0:l.pushing_lanes)&&void 0!==x?x:0,nn=(0,Z.useMemo)(()=>{var e;return(e={pushingLanes:ns,pageVisible:ta}).pageVisible?e.pushingLanes>0?6e3:15e3:3e4},[ns,ta]);(0,Z.useEffect)(()=>{if(nt(),nn<=0)return;let e=window.setInterval(()=>void nt(),nn);return()=>window.clearInterval(e)},[nn,nt]),(0,Z.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&nt()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[nt]);let nl=!!A||ek||eU||eB||eG,ni=!!A||eG,nr=ek?D("正在读取 youtube.ini,稍后再保存地址","youtube.ini is loading; save URLs after it finishes"):eU?D("正在重新读取地址列表,稍后再保存","URL list is reloading; save after it finishes"):eB?D("正在整理地址列表,稍后再保存","URL list is being optimized; save after it finishes"):A?D("正在执行其他操作,稍后再保存地址","Another operation is running; save URLs after it finishes"):"",na="single"===ei?sj:sw,no=(0,Z.useMemo)(()=>"pro"===ei?ey($.filter(e=>tS(e))):ev(sj),[ei,$,sj]),nc=(0,Z.useMemo)(()=>(function(e){if(e.paused)return 0;if(!e.pageVisible)return 3e4;switch(e.activity){case"hot":return 800;case"warm":return 2e3;default:return 4e3}})({activity:no,pageVisible:ta}),[no,ta]),nd=tD(sy(B)),nu=sb?tZ(sv(tp(sb)),eS||sb.urlLines||""):"",nx=tM(sj),nm=(0,Z.useMemo)(()=>{var e,t,s;let n=(null==eQ?void 0:eQ.active)||[],l=B.trim();return l?null!==(s=null!==(t=n.find(e=>e.process===l))&&void 0!==t?t:n[0])&&void 0!==s?s:null:null!==(e=n[0])&&void 0!==e?e:null},[B,null==eQ?void 0:eQ.active]),np=(0,Z.useMemo)(()=>{var e;if("single"===ei)return eu;let t=ea.find(e=>tp(e)===B);return t&&t.id===(null==sb?void 0:sb.id)?eS:(null!==(e=null==t?void 0:t.urlLines)&&void 0!==e?e:"").trim()||eS},[null==sb?void 0:sb.id,ea,ei,eS,B,eu]),nh="pro"===ei?ea.find(e=>tp(e)===B):null,ng=nh?ea.findIndex(e=>e.id===nh.id):-1,nb=nh?td(nh.name,ng>=0?ng:0):"",nf=tE(nb,sj,np),nv=tU(sj,np,nb),ny=(tT(sj,D),tI(sj,np)),nw=null==e4?void 0:null===(i=e4.lanes)||void 0===i?void 0:i.find(e=>e.process===B);null==nw||nw.metrics;let nj=t1(sj,nw),nN=null!==(m=null==nw?void 0:nw.score)&&void 0!==m?m:null,nk="pro"===ei?$.filter(e=>tS(e)&&tM(e)).length:nx?1:0,n_=eC(nj.speed,"x"),nS=eC(nj.frame,"",0),nz=eC(nj.fps),nC=nj.live?ez(nj.bitrate):null,nR="number"==typeof(null==sj?void 0:sj.ffmpeg_time_seconds)?tq(sj.ffmpeg_time_seconds,D):null,nL=!sH||0===sX,nP=sH?ef.rtmps?"RTMPS":"RTMP":D("检查密钥","Check key"),nM=e=>{var t;let s=(null===(t=s0.link)||void 0===t?void 0:t.id)===e.id,l=tc==="".concat(e.id,":start"),i=tc==="".concat(e.id,":stop"),r=tc==="".concat(e.id,":delete"),a=!!tc,o=e.id===sQ.length&&sQ.length>1,c=a||!o;return(0,n.jsxs)("div",{className:"flex min-h-[2.5rem] items-stretch overflow-hidden rounded-lg border text-xs ring-1 ".concat(s?"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,n.jsxs)("a",{href:(0,ep.p)(e.url),target:"_blank",rel:"noreferrer",className:"flex items-center gap-2 px-3 py-2 hover:bg-white/[0.04]",children:[(0,n.jsx)("span",{className:"font-semibold",children:e.label}),(0,n.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-1.5 py-0.5 text-[10px] text-emerald-100",children:e.accessLabel}),(0,n.jsxs)("span",{className:"font-mono text-white/70",children:[e.host||"",e.port?":".concat(e.port):""]})]}),(0,n.jsxs)("div",{className:"flex border-l border-white/10",children:[(0,n.jsxs)("button",{type:"button",disabled:a,title:D("启动 Neko 容器","Start Neko container"),onClick:()=>void s3(e,"start"),className:"inline-flex min-w-[3.75rem] items-center justify-center gap-1 px-2 text-emerald-100 hover:bg-emerald-500/15 disabled:cursor-not-allowed disabled:opacity-45",children:[l?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(G.Z,{className:"h-3.5 w-3.5"}),D("启动","Start")]}),(0,n.jsxs)("button",{type:"button",disabled:a,title:D("停止 Neko 容器","Stop Neko container"),onClick:()=>void s3(e,"stop"),className:"inline-flex min-w-[3.75rem] items-center justify-center gap-1 border-l border-white/10 px-2 text-amber-100 hover:bg-amber-500/15 disabled:cursor-not-allowed disabled:opacity-45",children:[i?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(e7.Z,{className:"h-3.5 w-3.5"}),D("停止","Stop")]}),(0,n.jsxs)("button",{type:"button",disabled:c,title:o?D("删除最后一个 Neko 实例,保留浏览器配置数据","Delete the last Neko instance and keep browser profile data"):D("只能删除最后一个 Neko 实例","Only the last Neko instance can be deleted"),onClick:()=>void s3(e,"delete"),className:"inline-flex min-w-[3.75rem] items-center justify-center gap-1 border-l border-white/10 px-2 text-rose-100 hover:bg-rose-500/15 disabled:cursor-not-allowed disabled:opacity-45",children:[r?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(z.Z,{className:"h-3.5 w-3.5"}),D("删除","Delete")]})]})]},e.key)},nT=(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-4 text-xs text-zinc-400",children:[(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:eT,onChange:e=>eE(e.target.checked)}),D("后台自动从服务器刷新(空闲约 12 秒)","Auto-refresh from server (~12s when idle)")]}),(0,n.jsx)("button",{type:"button",disabled:nl,onClick:()=>void sg(),className:"rounded-lg border border-white/10 px-3 py-1.5 text-zinc-200 hover:bg-white/5",children:D("手动重新读取","Reload from server")}),(0,n.jsx)("button",{type:"button",disabled:nl,onClick:()=>void sq(),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:eB?D("去重中...","Deduplicating..."):D("智能去重","Deduplicate")})]}),nE=(null==eQ?void 0:eQ.active)||[],nU=(null==eQ?void 0:eQ.latest)||[],nZ=(null==eQ?void 0:eQ.alerts)||[],nI=(null==eQ?void 0:eQ.stats)||{},nD=[{label:D("活动事件","Active"),value:null!==(p=nI.active_events)&&void 0!==p?p:nE.length,Icon:r.Z},{label:D("历史事件","History"),value:null!==(h=nI.total_events)&&void 0!==h?h:nU.length,Icon:te.Z},{label:D("采样点","Samples"),value:null!==(g=nI.sample_count)&&void 0!==g?g:0,Icon:tt.Z},{label:D("峰值在线","Viewer peak"),value:null!==(b=nI.viewer_peak)&&void 0!==b?b:0,Icon:ts.Z},{label:D("累计时长","Total duration"),value:tB(nI.total_duration_seconds),Icon:tn.Z}],nA=(tt.Z,D("直播事件中枢","Live event center"),D("事件、转播对象、时长、页面采集、弹窗和告警全部写入本地 SQLite,可追溯。","Events, source rooms, duration, browser telemetry, popups, and alerts are stored locally."),w.Z,D("刷新事件","Refresh events"),nD.map(e=>{let{label:t,value:s,Icon:l}=e;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-zinc-500",children:[(0,n.jsx)(l,{className:"h-3.5 w-3.5 text-cyan-300"}),t]}),(0,n.jsx)("p",{className:"mt-2 font-mono text-lg font-semibold text-white",children:String(s)})]},t)}),D("正在转播","Active relay"),nE.length,(nE.length?nE:nU.slice(0,1)).map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>void s9(e.id),className:"block w-full rounded-lg border border-white/[0.06] bg-white/[0.03] px-3 py-2 text-left transition hover:bg-white/[0.06]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"truncate text-sm font-medium text-white",children:e.source_title||e.channel_name||e.source_room_id||e.process||"#".concat(e.id)}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tW(e.status)),children:e.status||"event"})]}),(0,n.jsxs)("div",{className:"mt-1 flex flex-wrap gap-2 font-mono text-[10px] text-zinc-500",children:[(0,n.jsx)("span",{children:e.process||"-"}),(0,n.jsx)("span",{children:e.source_room_id?"room:".concat(e.source_room_id):D("未知来源","unknown source")}),(0,n.jsx)("span",{children:tB(e.duration_seconds)}),(0,n.jsx)("span",{children:null!=e.last_viewer_count?"".concat(e.last_viewer_count," online"):""})]})]},e.id)),nE.length||nU.length||D("暂无事件;开始直播或打开 Neko 中的 YouTube Studio 后会自动生成。","No events yet. Start a relay or open YouTube Studio in Neko."),D("最近事件","Recent events"),nU.slice(0,8).map(e=>{var t;return(0,n.jsxs)("button",{type:"button",onClick:()=>void s9(e.id),className:"flex w-full items-center justify-between gap-3 py-2 text-left",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"truncate text-xs font-medium text-zinc-200",children:e.source_title||e.source_room_id||e.channel_name||e.process||"#".concat(e.id)}),(0,n.jsxs)("p",{className:"mt-0.5 font-mono text-[10px] text-zinc-600",children:[tF(e.started_at)," \xb7 ",tB(e.duration_seconds)]})]}),(0,n.jsxs)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tW(e.status)),children:[null!==(t=e.quality_score)&&void 0!==t?t:0,"/100"]})]},e.id)}),D("事件详情页","Event detail"),e1&&(()=>e5(null),D("收起","Close")),e1?(0,n.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("p",{className:"truncate text-sm font-semibold text-white",children:e1.source_title||e1.source_room_id||e1.process}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tW(e1.status)),children:e1.status})]}),(0,n.jsxs)("div",{className:"mt-2 grid gap-2 text-[11px] text-zinc-400 sm:grid-cols-2",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Process:"})," ",e1.process||"-"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Room:"})," ",e1.source_room_id||"-"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Started:"})," ",tF(e1.started_at)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Duration:"})," ",tB(e1.duration_seconds)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Viewers:"})," ",null!==(f=e1.last_viewer_count)&&void 0!==f?f:"-"," / peak ",null!==(v=e1.viewer_peak)&&void 0!==v?v:0]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Health:"})," ",e1.last_health||e1.last_live_status||"-"]})]}),(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[e1.source_url?(0,n.jsx)("a",{href:e1.source_url,target:"_blank",rel:"noreferrer",className:"rounded-lg bg-violet-500/15 px-2.5 py-1.5 text-[11px] text-violet-100 ring-1 ring-violet-500/25",children:D("打开源直播间","Open source")}):null,e1.last_page_url?(0,n.jsx)("a",{href:e1.last_page_url,target:"_blank",rel:"noreferrer",className:"rounded-lg bg-cyan-500/15 px-2.5 py-1.5 text-[11px] text-cyan-100 ring-1 ring-cyan-500/25",children:D("打开 Studio 页面","Open Studio page")}):null]})]}),(e1.alerts||nZ).slice(0,4).length?(0,n.jsxs)("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/[0.06] p-3",children:[(0,n.jsxs)("h5",{className:"flex items-center gap-2 text-xs font-semibold text-amber-100",children:[(0,n.jsx)(eg.Z,{className:"h-3.5 w-3.5"}),D("弹窗 / 告警","Popups / alerts")]}),(0,n.jsx)("div",{className:"mt-2 space-y-1",children:(e1.alerts||nZ).slice(0,4).map((e,t)=>(0,n.jsxs)("p",{className:"text-[11px] text-amber-100/85",children:[e.title||e.severity||"alert",": ",e.message||"-"]},"".concat(e.id||t)))})]}):null,(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("h5",{className:"text-xs font-semibold text-zinc-300",children:D("采样时间线","Sample timeline")}),(0,n.jsxs)("div",{className:"mt-2 max-h-52 space-y-2 overflow-auto pr-1",children:[(e1.samples||[]).slice(0,12).map(e=>{var t;return(0,n.jsxs)("div",{className:"rounded-md border border-white/[0.05] bg-black/25 px-2 py-1.5",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 font-mono text-[10px] text-zinc-500",children:[(0,n.jsx)("span",{children:tF(e.ts)}),(0,n.jsx)("span",{children:e.source||"sample"})]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-300",children:[e.live_status||"-"," \xb7 ",e.health||"-"," \xb7 ",null!==(t=e.viewer_count)&&void 0!==t?t:"-"," online"]}),e.popup_text?(0,n.jsx)("p",{className:"mt-1 text-[10px] text-amber-100/80",children:e.popup_text}):null]},e.id)}),(e1.samples||[]).length?null:(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:D("暂无采样;Chrome 扩展或状态接口会自动写入。","No samples yet. The Chrome extension or status API will fill this.")})]})]})]}):(0,n.jsx)("p",{className:"mt-3 text-xs text-zinc-600",children:D("选择左侧事件查看完整详情。","Select an event to see details.")}),[...nE,...nU.filter(e=>!nE.some(t=>t.id===e.id))].slice(0,12)),nO=e1||nA[0]||null,nB=(null==nO?void 0:nO.samples)||[],nF=(null==nO?void 0:null===(a=nO.alerts)||void 0===a?void 0:a.length)?nO.alerts:nZ,nW=[{label:D("正在直播","Live now"),value:String(null!==(j=nI.active_events)&&void 0!==j?j:nE.length),helper:D("当前仍在推流的场次","Events still pushing"),Icon:Y.Z,tone:"text-emerald-200"},{label:D("总场次","Total events"),value:String(null!==(N=nI.total_events)&&void 0!==N?N:nU.length),helper:D("本机数据库里的直播记录","Stored locally"),Icon:te.Z,tone:"text-cyan-200"},{label:D("累计时长","Total duration"),value:tq(nI.total_duration_seconds,D),helper:D("已结束场次累计","Ended events total"),Icon:tn.Z,tone:"text-violet-200"},{label:D("最高在线","Peak viewers"),value:tK(null!==(k=nI.viewer_peak)&&void 0!==k?k:0,D),helper:D("Chrome/Studio 采集峰值","Captured from Studio"),Icon:ts.Z,tone:"text-amber-200"}],nH=(tt.Z,D("直播事件中枢","Live event center"),D("这里按运营视角展示:谁在播、转播哪个直播间、播了多久、观众多少、Studio 是否弹窗、有没有异常。机器编号只放在详情底部。","Built for operators: what is live, source room, duration, viewers, Studio popups, and issues. Technical ids stay in the detail footer."),w.Z,D("刷新","Refresh"),nW.map(e=>{let{label:t,value:s,helper:l,Icon:i,tone:r}=e;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.035] p-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("p",{className:"text-xs text-zinc-500",children:t}),(0,n.jsx)(i,{className:"h-4 w-4 ".concat(r)})]}),(0,n.jsx)("p",{className:"mt-2 text-2xl font-semibold tracking-tight text-white",children:s}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-600",children:l})]},t)}),nE.length?D("正在直播","Live now"):D("最近直播记录","Recent live events"),nE.length?D("优先显示还在推流的场次。","Active relays are listed first."):D("当前没有正在直播的场次,下方是最近历史。","Nothing is live now; showing recent history."),nA.length,D("条记录","records"),nA.map(e=>{var t;let s=(null==nO?void 0:nO.id)===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>void s9(e.id),className:"grid w-full gap-3 px-4 py-4 text-left transition md:grid-cols-[minmax(0,1fr)_8rem_7rem_7rem] ".concat(s?"bg-cyan-500/[0.08]":"hover:bg-white/[0.04]"),children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(tW(e.status)),children:tH(e.status,D)}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(t$(e)),children:tV(e,D)})]}),(0,n.jsx)("p",{className:"mt-2 truncate text-sm font-semibold text-white",children:tY(e,D)}),(0,n.jsxs)("p",{className:"mt-1 truncate text-xs text-zinc-500",children:[tG(e,D)," ","->"," YouTube"]})]}),(0,n.jsxs)("div",{className:"self-center",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:D("开始","Started")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-300",children:tJ(e.started_at)})]}),(0,n.jsxs)("div",{className:"self-center",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:D("时长","Duration")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-300",children:tq(e.duration_seconds,D)})]}),(0,n.jsxs)("div",{className:"self-center",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:D("在线/峰值","Viewers")}),(0,n.jsxs)("p",{className:"mt-1 text-xs text-zinc-300",children:[tK(e.last_viewer_count,D)," / ",tK(null!==(t=e.viewer_peak)&&void 0!==t?t:0,D)]})]})]},e.id)}),nA.length||(c.Z,D("还没有直播记录","No live events yet"),D("启动转播或在 Neko 打开 YouTube Studio 后,这里会自动生成可追溯记录。","Start a relay or open YouTube Studio in Neko to create traceable records.")),nO?(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("div",{children:(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"text-xs text-cyan-300",children:D("这场直播","Selected event")}),(0,n.jsx)("h4",{className:"mt-1 truncate text-lg font-semibold text-white",children:tY(nO,D)}),(0,n.jsxs)("p",{className:"mt-1 text-sm text-zinc-500",children:[tG(nO,D)," ","->"," YouTube"]})]}),(0,n.jsx)("span",{className:"rounded-full px-2.5 py-1 text-xs ring-1 ".concat(tW(nO.status)),children:tH(nO.status,D)})]})}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:D("直播时长","Duration")}),(0,n.jsx)("p",{className:"mt-1 text-lg font-semibold text-white",children:tq(nO.duration_seconds,D)}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:tF(nO.started_at)})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:D("观众","Viewers")}),(0,n.jsxs)("p",{className:"mt-1 text-lg font-semibold text-white",children:[tK(nO.last_viewer_count,D),(0,n.jsxs)("span",{className:"ml-2 text-xs font-normal text-zinc-500",children:[D("峰值","peak")," ",tK(null!==(_=nO.viewer_peak)&&void 0!==_?_:0,D)]})]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:D("来自 Chrome 插件/Studio 页面采集","Captured from Studio")})]})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("h5",{className:"text-sm font-semibold text-white",children:D("Studio 状态","Studio status")}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(t$(nO)),children:tV(nO,D)})]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2 text-sm text-zinc-300",children:[(0,n.jsx)("p",{children:nO.last_live_status||nO.last_health||D("暂未采集到 Studio 状态","No Studio status captured yet")}),nO.last_popup_text?(0,n.jsx)("p",{className:"rounded-md border border-amber-500/20 bg-amber-500/[0.08] px-3 py-2 text-xs text-amber-100",children:nO.last_popup_text}):(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:D("没有记录到弹窗。","No popup recorded.")}),nO.last_page_title||nO.last_page_url?(0,n.jsx)("p",{className:"truncate text-xs text-zinc-500",children:nO.last_page_title||nO.last_page_url}):null]}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[nO.source_url?(0,n.jsxs)("a",{href:nO.source_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-lg bg-violet-500/15 px-2.5 py-1.5 text-xs text-violet-100 ring-1 ring-violet-500/25",children:[D("打开源直播间","Open source")," ",(0,n.jsx)(W.Z,{className:"h-3 w-3"})]}):null,nO.last_page_url?(0,n.jsxs)("a",{href:nO.last_page_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-lg bg-cyan-500/15 px-2.5 py-1.5 text-xs text-cyan-100 ring-1 ring-cyan-500/25",children:[D("打开 Studio","Open Studio")," ",(0,n.jsx)(W.Z,{className:"h-3 w-3"})]}):null]})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("h5",{className:"text-sm font-semibold text-white",children:D("采样时间线","Telemetry timeline")}),(0,n.jsxs)("div",{className:"mt-3 max-h-64 space-y-2 overflow-auto pr-1",children:[nB.slice(0,10).map(e=>(0,n.jsxs)("div",{className:"rounded-md border border-white/[0.05] bg-black/25 px-3 py-2",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[(0,n.jsx)("span",{className:"text-zinc-400",children:tJ(e.ts)}),(0,n.jsx)("span",{className:"text-zinc-600",children:e.source||D("采样","sample")})]}),(0,n.jsxs)("p",{className:"mt-1 text-sm text-zinc-200",children:[e.live_status||e.health||D("状态未识别","Unknown status"),(0,n.jsxs)("span",{className:"ml-2 text-xs text-zinc-500",children:[D("在线","online")," ",tK(e.viewer_count,D)]})]}),e.popup_text?(0,n.jsx)("p",{className:"mt-1 text-xs text-amber-100",children:e.popup_text}):null]},e.id)),nB.length?null:(0,n.jsx)("p",{className:"rounded-md border border-white/[0.05] bg-black/20 px-3 py-3 text-xs text-zinc-500",children:e1?D("这场直播暂时没有采样明细。","No telemetry samples for this event yet."):D("点击左侧记录后加载完整采样明细。","Click a record on the left to load full telemetry samples.")})]})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsxs)("h5",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(eg.Z,{className:"h-4 w-4 text-amber-300"}),D("告警和弹窗","Alerts and popups")]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2",children:[nF.slice(0,4).map((e,t)=>(0,n.jsxs)("p",{className:"rounded-md border border-amber-500/15 bg-amber-500/[0.06] px-3 py-2 text-xs text-amber-100",children:[e.title||e.severity||D("提示","Notice"),": ",e.message||"-"]},"".concat(e.id||t))),nF.length?null:(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:D("没有告警。","No alerts.")})]})]}),(0,n.jsxs)("p",{className:"truncate text-[11px] text-zinc-700",children:[D("技术标识","Technical id"),": #",nO.id," \xb7 ",nO.process||"-"," \xb7 ",nO.event_uuid||"-"]})]}):(0,n.jsxs)("div",{className:"flex min-h-[24rem] flex-col items-center justify-center text-center",children:[(0,n.jsx)(tt.Z,{className:"h-10 w-10 text-zinc-700"}),(0,n.jsx)("p",{className:"mt-3 text-sm font-medium text-zinc-300",children:D("等待第一场直播","Waiting for the first live event")}),(0,n.jsx)("p",{className:"mt-1 max-w-sm text-xs text-zinc-600",children:D("开始转播后,这里会变成这场直播的详情页。","After a relay starts, this panel becomes the event detail page.")})]}),(null==e4?void 0:e4.summary)||{}),nK=(null==e4?void 0:e4.lanes)||[],nY=(null==e4?void 0:e4.recommendations)||[],nG=(0,n.jsxs)("section",{className:"rounded-2xl border border-emerald-500/20 bg-gradient-to-br from-emerald-500/[0.08] via-zinc-950/90 to-cyan-500/[0.06] p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold text-white",children:[(0,n.jsx)(r.Z,{className:"h-5 w-5 text-emerald-300"}),D("算法友好质量守护","Algorithm-friendly quality guard")]}),(0,n.jsx)("p",{className:"mt-1 max-w-3xl text-sm text-zinc-400",children:D("目标不是刷数据,而是让直播信号长期稳定:不断流、不卡顿、Studio 状态可见、异常能追踪。","The goal is stable, policy-safe signal quality: no drops, no stalls, visible Studio state, and traceable issues.")})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>void nt(),className:"inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-200 hover:bg-white/[0.08]",children:[(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(e8?"animate-spin":"")}),D("重新检测","Check now")]})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-3 md:grid-cols-[12rem_minmax(0,1fr)]",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/30 p-4",children:[(0,n.jsx)("p",{className:"text-xs text-zinc-500",children:D("综合分","Score")}),(0,n.jsx)("p",{className:"mt-2 text-5xl font-semibold tracking-tight ".concat(tX(null==e4?void 0:e4.score)),children:null!==(S=null==e4?void 0:e4.score)&&void 0!==S?S:0}),(0,n.jsx)("p",{className:"mt-2 text-[11px] text-zinc-600",children:D("80 以上适合长时间无人值守","80+ is suitable for long unattended runs")})]}),(0,n.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[[D("推流线路","Lanes"),"".concat(null!==(C=nH.pushing_lanes)&&void 0!==C?C:0,"/").concat(null!==(R=nH.lanes)&&void 0!==R?R:0)],[D("活动事件","Active events"),String(null!==(L=nH.active_events)&&void 0!==L?L:0)],[D("Studio 采样","Studio samples"),String(null!==(P=nH.sample_count)&&void 0!==P?P:0)],[D("最高在线","Viewer peak"),tK(null!==(M=nH.viewer_peak)&&void 0!==M?M:0,D)]].map(e=>{let[t,s]=e;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("p",{className:"text-xs text-zinc-500",children:t}),(0,n.jsx)("p",{className:"mt-2 text-2xl font-semibold text-white",children:s})]},t)})})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(20rem,0.8fr)]",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25",children:[(0,n.jsxs)("div",{className:"border-b border-white/[0.06] px-4 py-3",children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:D("线路质量","Lane quality")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:D("从进程、FFmpeg 日志、配置和事件采样综合判断。","Combined from process state, FFmpeg logs, config, and event telemetry.")})]}),(0,n.jsxs)("div",{className:"divide-y divide-white/[0.06]",children:[nK.map(e=>{var t,s,l,i,r,a,o;let c=(e.label||"").replace(/^YouTube Pro\s*·\s*/i,"").trim(),d=t1(sv(String(e.process||"")),e),u=(e.source_display||e.source_title||"").trim()||c||e.label||e.process||"-",x=e.is_pushing&&c&&u!==c?c:"",m=[e.label,e.process].filter(Boolean).join(" \xb7 ");return(0,n.jsxs)("div",{className:"grid gap-3 px-4 py-4 md:grid-cols-[minmax(0,1fr)_6rem_14rem]",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("p",{className:"truncate text-sm font-semibold text-white",children:u}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(e.is_pushing?"bg-emerald-500/15 text-emerald-100 ring-emerald-500/25":"bg-zinc-600/20 text-zinc-300 ring-zinc-500/25"),children:e.is_pushing?D("推流中","Pushing"):D("未推流","Idle")}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(e.rtmps?"bg-cyan-500/15 text-cyan-100 ring-cyan-500/25":"bg-amber-500/15 text-amber-100 ring-amber-500/25"),children:e.rtmps?"RTMPS":D("非 RTMPS","No RTMPS")})]}),x&&x!==u?(0,n.jsx)("p",{className:"mt-0.5 truncate text-xs text-zinc-500",children:x}):null,(0,n.jsx)("p",{className:"mt-1 truncate text-xs text-zinc-600",children:m||"-"}),(0,n.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:(e.issues||[]).slice(0,3).map((e,t)=>(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tQ(e.level)),children:e.text||e.level},"".concat(e.text||t)))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:D("分数","Score")}),(0,n.jsx)("p",{className:"mt-1 text-2xl font-semibold ".concat(tX(e.score)),children:null!==(l=e.score)&&void 0!==l?l:0})]}),(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-2 font-mono text-[11px] text-zinc-300",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"fps"}),eC(d.fps)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"speed"}),(0,n.jsx)("span",{className:d.speedLow?"text-amber-300":"",children:eC(d.speed,"x")})]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:D("码率","Bitrate")}),e.is_pushing&&null!==(i=ez(d.bitrate))&&void 0!==i?i:"—"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"frame"}),(0,n.jsx)("span",{className:d.progressStalled?"text-rose-300":"",children:eC(d.frame,"",0)})]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"drop"}),null!==(r=null===(t=e.metrics)||void 0===t?void 0:t.drop)&&void 0!==r?r:"-"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"urls"}),null!==(a=e.url_count)&&void 0!==a?a:0]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"err"}),null!==(o=null===(s=e.metrics)||void 0===s?void 0:s.error_count)&&void 0!==o?o:0]})]})]},e.process||e.label)}),nK.length?null:(0,n.jsx)("div",{className:"px-4 py-8 text-center text-sm text-zinc-500",children:D("没有发现 YouTube 线路。","No YouTube lanes found.")})]})]}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:D("下一步建议","Next actions")}),(0,n.jsxs)("div",{className:"mt-3 space-y-2",children:[nY.slice(0,6).map((e,t)=>(0,n.jsx)("p",{className:"rounded-lg px-3 py-2 text-xs ring-1 ".concat(tQ(e.level)),children:e.text||"-"},"".concat(e.text||t))),nY.length?null:(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:D("暂无建议。","No recommendations.")})]})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:"FFmpeg"}),(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-400",children:(null==e4?void 0:null===(o=e4.ffmpeg_profile)||void 0===o?void 0:o.target)||"720p30 H.264 CBR / RTMPS / AAC 128k"}),(0,n.jsx)("ul",{className:"mt-3 space-y-1.5 text-xs text-zinc-500",children:((null==e4?void 0:null===(d=e4.ffmpeg_profile)||void 0===d?void 0:d.guardrails)||[]).slice(0,4).map(e=>(0,n.jsxs)("li",{children:["- ",e]},e))})]})]})]})]});return Y.Z,D("转播实况","Relay snapshot"),tO(sj),nf||D("未配置抖音直播源","No Douyin source configured"),nv&&nv!==nf&&D("抖音源","Douyin"),"pro"===ei&&nk>0&&" \xb7 ".concat(nk,"/").concat(ea.length," ").concat(D("路推流中","lanes pushing")),ny&&(W.Z,D("打开源站","Open source")),s0.link&&(W.Z,D("Studio","Studio")),w.Z,D("刷新全局","Refresh"),[{label:D("FFmpeg 速度","FFmpeg speed"),value:n_,warn:nj.speedLow,helper:nj.live?nR?"".concat(D("已编码","Encoded")," ").concat(nR):D("实时倍速","Realtime multiplier"):D("等待进程上报","Waiting for metrics"),accent:nj.speedLow?"amber":"emerald"},{label:D("实时 FPS","Live FPS"),value:nz,warn:"number"==typeof nj.fps&&nj.fps>0&&nj.fps<24,helper:nj.live?D("FFmpeg 输出帧率","FFmpeg output fps"):D("未推流","Not pushing"),accent:"cyan"},{label:D("编码帧","Encoded frame"),value:nS,warn:nj.progressStalled,helper:(null==sj?void 0:sj.ffmpeg_active)?D("Worker 活跃","Worker active"):D("无活跃 Worker","No active worker"),accent:nj.progressStalled?"amber":"violet"},{label:D("码率","Bitrate"),value:null!=nC?nC:"—",warn:!1,helper:nj.live?D("实时输出码率","Live output bitrate"):D("停推后不显示","Hidden when idle"),accent:"cyan"},{label:D("质量分","Quality score"),value:null!=nN?String(nN):"—",warn:null!=nN&&nN<55,helper:D("当前线路综合评估","Current lane score"),accent:"violet"},{label:D("活动场次","Active events"),value:String(s7),warn:!1,helper:D("本地事件库","Local event store"),accent:"cyan"},{label:D("抖音地址","Douyin URLs"),value:String(sX),warn:0===sX,helper:"".concat(s$," ").concat(D("条有效地址","valid URLs")),accent:"cyan"},{label:D("密钥尾码","Key suffix"),value:sK,warn:!sH,helper:nP,accent:"violet"}].map(e=>{let{label:t,value:s,warn:l,helper:i,accent:r}=e;return(0,n.jsx)(t0,{label:t,value:s,warn:l,helper:i,accent:r},t)}),nm&&nx&&(D("本场直播","This event"),tW(nm.status),tH(nm.status,D),t$(nm),tV(nm,D),D("观众","Viewers"),tK(nm.last_viewer_count,D),tq(nm.duration_seconds,D),nm.last_popup_text?(0,n.jsxs)("span",{className:"text-amber-200",children:[D("弹窗","Popup"),": ",nm.last_popup_text]}):null),(0,n.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6",children:[Q?(0,n.jsx)(eh,{t:D,title:D("YouTube 转播链路","YouTube relay chain"),subtitle:D("与「网络」页相同风格的链路示意:代理 → 编码推流 → 浏览器侧操作工作室。","Same visual language as Network: proxy → encode → browser studio."),onNavigate:Q,steps:[{label:"ShellCrash",sub:D("透明代理","Proxy"),gradient:"from-violet-500 to-fuchsia-500",target:"network"},{label:"FFmpeg",sub:D("推流 / 转码","Stream"),gradient:"from-cyan-400 to-blue-500",target:"live_youtube"},{label:"Neko",sub:s0.link?"".concat(D("Chromium 工作室","Chromium studio")," \xb7 ").concat(s0.link.label):D("Chromium 工作室","Chromium studio"),gradient:"from-emerald-400 to-teal-500",openUrl:s1}]}):null,(0,n.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,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.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,n.jsx)(c.Z,{className:"h-5 w-5 text-red-200"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg font-semibold tracking-tight text-white",children:D("YouTube 无人直播","YouTube unmanned live")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:D("单路一条流;多路时每条线路独立保存自己的密钥、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,n.jsxs)("div",{className:"ml-auto flex shrink-0 self-start rounded-xl border border-white/10 bg-black/30 p-1 ".concat(""),"aria-hidden":!1,children:[(0,n.jsx)("button",{type:"button",onClick:()=>sZ("single"),className:"rounded-lg px-4 py-2 text-xs font-medium transition ".concat("single"===ei?"bg-violet-500/25 text-white":"text-zinc-500 hover:text-zinc-300"),children:D("单频道","Single")}),(0,n.jsx)("button",{type:"button",onClick:()=>sZ("pro"),className:"rounded-lg px-4 py-2 text-xs font-medium transition ".concat("pro"===ei?"bg-violet-500/25 text-white":"text-zinc-500 hover:text-zinc-300"),children:D("多频道 Pro","Multi Pro")})]})]})}),null,s2.length?(0,n.jsxs)("div",{className:"space-y-2",children:[th?(0,n.jsx)("p",{className:"text-xs text-zinc-400",children:th}):null,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[s0.link?(0,n.jsx)("a",{href:s1,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:D("打开当前线路 Neko 工作室","Open lane Neko studio")}):null,sQ.length?(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:sQ.map(e=>nM(e))}):null,(null==et?void 0:et.chromium_remote_debug)?(0,n.jsx)("a",{href:(0,ep.p)(et.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:D("打开 Chromium 调试","Open Chromium debug")}):null,(null==et?void 0:et.srs_api)?(0,n.jsx)("a",{href:(0,ep.p)(et.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:D("打开 SRS API","Open SRS API")}):null]})]}):null,(0,n.jsxs)("div",{className:"rounded-2xl border border-amber-500/20 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-amber-200/90",children:[(0,n.jsx)(Y.Z,{className:"h-4 w-4"}),(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:D("直播开关","Live control")})]}),"single"===ei?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:D("转播任务","Relay task")}),(0,n.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:B,onChange:e=>{let t=e.target.value;t7.current=t,F(t),sE(t)},children:[B&&!en.some(e=>e.pm2===B)?(0,n.jsxs)("option",{value:B,children:[sf?"".concat(sf.name||sf.id," (").concat(B,")"):B,sw?" (".concat(tA(sw,D),")"):""]}):null,en.map(e=>(0,n.jsxs)("option",{value:e.pm2,children:[function(e,t){let s=t_(e.script).toLowerCase();return s.startsWith("douyin_youtube")?t("抖音→YouTube","Douyin → YouTube"):s.startsWith("youtube")?t("YouTube","YouTube"):e.label}(e,D)," (",e.pm2,")"]},e.pm2))]}),(0,n.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[(0,n.jsx)(t3,{kind:"start",targetPm2:B,busy:A,online:nd,label:D("开始直播","Start"),className:"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30",baseLock:!1,onRun:()=>q("start",B),notify:X,t:D}),(0,n.jsx)(t3,{kind:"stop",targetPm2:B,busy:A,online:nd,label:D("停止直播","Stop"),className:"bg-rose-500/15 text-rose-200 ring-rose-500/25",baseLock:!1,onRun:()=>q("stop",B),notify:X,t:D}),(0,n.jsx)(t3,{kind:"restart",targetPm2:B,busy:A,online:nd,label:D("重新开始","Restart"),className:"bg-amber-500/15 text-amber-200 ring-amber-500/25",baseLock:!1,onRun:()=>q("restart",B),notify:X,t:D})]}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap items-center justify-center gap-2 text-xs",children:[(0,n.jsx)("span",{className:"rounded-full px-2.5 py-0.5 font-medium ring-1 ".concat(tO(na)),children:tA(na,D)}),"number"==typeof(null==na?void 0:na.ffmpeg_speed)?(0,n.jsxs)("span",{className:"font-mono text-zinc-400 ".concat(na.ffmpeg_speed_low?"text-amber-300":""),children:["speed ",na.ffmpeg_speed.toFixed(2),"x"]}):null,"number"==typeof(null==na?void 0:na.ffmpeg_frame)?(0,n.jsxs)("span",{className:"font-mono text-zinc-400 ".concat(na.ffmpeg_progress_stalled?"text-rose-300":""),children:["frame ",na.ffmpeg_frame]}):null]})]}):(0,n.jsx)(n.Fragment,{children:(0,n.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,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-200/90",children:D("Pro 转播实况","Pro relay status")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:D("对齐桌面端:每路独立 URL / youtube 配置文件;点左侧信息切换编辑,右侧控制进程。","Per-lane config files like desktop; click row info to edit, use right-side controls for PM2.")}),s5?(0,n.jsxs)("p",{className:"mt-2 text-[11px] text-zinc-500",children:[D("Neko 实例","Neko instances"),": ",s5]}):null,(0,n.jsx)("div",{className:"mt-3 max-h-[min(24rem,55vh)] space-y-2 overflow-y-auto pr-1",children:ea.map(e=>{var t,s,l,i,r,a,o;let c=tp(e),d=sv(c),u=sy(c),x=ec===e.id,m=x?eS:(null!==(s=e.urlLines)&&void 0!==s?s:"").trim(),p=x?null!==(i=null!==(l=null==sz?void 0:sz.streamKey)&&void 0!==l?l:e.streamKey)&&void 0!==i?i:"":null!==(r=e.streamKey)&&void 0!==r?r:"",h=t5(m),g=eP(m),b=tI(d,m),f=eL("key = ".concat(p)),v=tD(u),y=ea.findIndex(t=>t.id===e.id),w=(0,ti.U_)(sQ,y).link,j=td(e.name,y>=0?y:0),N=null==e4?void 0:null===(t=e4.lanes)||void 0===t?void 0:t.find(e=>e.process===c),k=tE(j,d,m,N),_=tU(d,m,j),S=tT(d,D),z=t1(d,N),C=eR(z,{live:z.live||v||tM(d)});return(0,n.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(x?"border-violet-500/45 bg-violet-500/[0.1]":"border-white/10 bg-black/30 hover:border-white/18"),children:[(0,n.jsxs)("button",{type:"button",className:"min-w-0 flex-1 text-left",onClick:()=>{t7.current=tp(e),sI(e)},children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)("span",{className:"font-medium text-zinc-100",children:[(0,n.jsx)("span",{className:"mr-1.5","aria-hidden":!0,children:function(e){let t=((null==e?void 0:e.business_status)||"").trim().toLowerCase();return"streaming"===t?"\uD83D\uDFE2":"relay_slow"===t?"\uD83D\uDFE1":"source_stalled"===t?"\uD83D\uDFE0":"youtube_key_rejected"===t||"error"===t?"\uD83D\uDD34":"source_live"===t?"\uD83D\uDD35":"waiting_source"===t?"⚪":"⚫"}(d)}),k||D("未配置抖音直播源","No Douyin source")]}),(0,n.jsx)("span",{className:"shrink-0 rounded-md px-2 py-0.5 text-[10px] font-medium ring-1 ".concat(tO(d)),children:S}),w?(0,n.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:[w.label," \xb7 ",w.accessLabel]}):null]}),(0,n.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:[_&&_!==k?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{className:"truncate text-zinc-400",title:_,children:[D("抖音源","Douyin")," ",_]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"})]}):null,(0,n.jsxs)("span",{title:j,children:[D("线路","Lane")," ",j]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["key …",f||"—"]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsx)("span",{className:"truncate",title:c,children:c}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["URL ",h.length]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["DY ",g.length]}),C?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsx)("span",{className:(a=z.speed,o=z.speedLow,z.progressStalled?"text-rose-300":o||"number"==typeof a&&a>0&&a<.95?"text-amber-200":"number"==typeof a&&a>=.95?"text-emerald-200":"text-cyan-100"),children:C})]}):null]}),b?(0,n.jsx)("a",{href:b,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:b,children:k?"".concat(D("打开源站","Open source")," \xb7 ").concat(b.replace(/^https?:\/\//,"")):b.replace(/^https?:\/\//,"")}):(0,n.jsx)("span",{className:"mt-1 block text-zinc-600",children:"—"})]}),(0,n.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,n.jsx)(t3,{kind:"start",targetPm2:c,busy:A,online:v,label:D("开始","Start"),className:"rounded-lg bg-emerald-500/20 text-emerald-100 ring-emerald-500/30",baseLock:!1,onRun:()=>void s6("start",c),notify:X,t:D,compact:!0}),(0,n.jsx)(t3,{kind:"stop",targetPm2:c,busy:A,online:v,label:D("停止","Stop"),className:"rounded-lg bg-rose-500/15 text-rose-100 ring-rose-500/25",baseLock:!1,onRun:()=>void s6("stop",c),notify:X,t:D,compact:!0}),(0,n.jsx)(t3,{kind:"restart",targetPm2:c,busy:A,online:v,label:D("重新开始","Restart"),className:"rounded-lg bg-amber-500/15 text-amber-100 ring-amber-500/25",baseLock:!1,onRun:()=>void s6("restart",c),notify:X,t:D,compact:!0}),w?(0,n.jsxs)("button",{type:"button",onClick:()=>{window.open((0,ep.p)(w.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(D("打开该线路 Neko 工作室","Open this lane's Neko studio")," \xb7 ").concat(w.label).concat(w.port?" :".concat(w.port):""),"aria-label":"".concat(D("打开该线路 Neko 工作室","Open this lane's Neko studio")," \xb7 ").concat(w.label),children:[(0,n.jsx)("span",{className:"sr-only",children:D("打开该线路 Neko 工作室","Open this lane's Neko studio")}),(0,n.jsx)("span",{"aria-hidden":!0,className:"text-sm leading-none",children:"\uD83D\uDC31"}),(0,n.jsx)(W.Z,{className:"ml-1 h-3.5 w-3.5 shrink-0","aria-hidden":!0})]}):null]})]},e.id)})})]})})]}),(0,n.jsx)(eO,{t:D,currentProc:B,fetchJson:V,urlListText:np,keySuffixUi:sH,showKeyRow:!0,pollMs:nc,refreshToken:e$,monitorRow:null!=sj?sj:void 0,preferredTitle:"pro"===ei?nb:void 0}),nG,null,(0,n.jsxs)("section",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 ring-1 ring-white/[0.03]",children:[(0,n.jsxs)("div",{className:"border-b border-white/[0.06] px-6 py-4",children:[(0,n.jsxs)("h3",{className:"text-sm font-semibold text-white",children:[D("配置与地址","Config and URLs"),nL?(0,n.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:D("待完善","Needs setup")}):null]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:D("密钥、youtube.ini、URL 列表","Keys, youtube.ini, URL list")})]}),(0,n.jsxs)("div",{className:"space-y-6 p-6 pt-4",children:["single"===ei?(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:D("YouTube 相关设置","YouTube settings")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:D("串流参数写进 youtube.ini,无需 Google 登录。","Stream settings go to youtube.ini — no Google login.")}),(0,n.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,n.jsx)("label",{className:"block text-xs text-zinc-400",children:D("串流密钥","Stream key")}),(0,n.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:ef.key,onChange:e=>ew(t=>({...t,key:e.target.value})),placeholder:"xxxx-xxxx-xxxx-xxxx-xxxx"}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,n.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-zinc-400",children:["RTMPS",(0,n.jsxs)("select",{className:"rounded-lg border border-white/10 bg-black/40 px-3 py-2 text-sm text-white",value:ef.rtmps?"1":"0",onChange:e=>ew(t=>({...t,rtmps:"1"===e.target.value})),children:[(0,n.jsx)("option",{value:"1",children:D("是(默认)","Yes")}),(0,n.jsx)("option",{value:"0",children:D("否 → RTMP","No")})]})]}),(0,n.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-zinc-400",children:[D("比特率 kbps","Bitrate kbps"),(0,n.jsx)("input",{className:"rounded-lg border border-white/10 bg-black/40 px-3 py-2 font-mono text-sm",value:ef.bitrate,onChange:e=>ew(t=>({...t,bitrate:e.target.value})),placeholder:"4000"})]}),(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 pt-6 text-xs text-zinc-300",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:ef.fastAudio,onChange:e=>ew(t=>({...t,fastAudio:e.target.checked}))}),"fast_audio(",D("轻量音频","lighter audio"),")"]})]})]}),(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{type:"button",disabled:nl,onClick:()=>void sD(),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,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(ek?"animate-spin":"")}),D("重新读取","Reload")]}),(0,n.jsxs)("button",{type:"button",disabled:nl,onClick:()=>void sF(),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:[ek?(0,n.jsx)(y.Z,{className:"h-4 w-4 animate-spin"}):null,D("保存 youtube.ini","Save youtube.ini")]}),(0,n.jsx)("button",{type:"button",disabled:nl,onClick:()=>void sW(),className:"rounded-xl border border-cyan-500/20 bg-cyan-500/10 px-4 py-2 text-sm text-cyan-100",children:D("平衡预设","Balanced preset")}),(0,n.jsx)("button",{type:"button",disabled:nl,onClick:()=>{ew(eZ(em)),eN(D("已从下方原文同步到表单","Synced from raw"))},className:"rounded-xl border border-white/10 px-4 py-2 text-sm text-zinc-400",children:D("从原文同步表单","Parse raw")})]}),(0,n.jsxs)("details",{className:"mt-4 rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,n.jsx)("summary",{className:"cursor-pointer text-xs text-zinc-500",children:D("高级:youtube.ini 原文","Raw youtube.ini")}),(0,n.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:em,onChange:e=>eb(e.target.value),spellCheck:!1}),(0,n.jsx)("button",{type:"button",disabled:nl,className:"mt-2 rounded-lg bg-cyan-500/15 px-3 py-1.5 text-xs text-cyan-200",onClick:()=>void sB(em),children:D("保存原文","Save raw")})]}),ej?(0,n.jsx)("p",{className:"mt-2 font-mono text-xs text-zinc-500",children:ej}):null]}):(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"text-sm font-semibold text-white",children:[D("当前线路","Current lane"),sb?(0,n.jsxs)("span",{className:"ml-2 font-normal text-zinc-400",children:["\xb7 ",nu||D("未配置抖音直播源","No Douyin source")]}):null,sT?(0,n.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:D("有未保存修改","Unsaved")}):null]}),sb?(0,n.jsxs)("p",{className:"mt-0.5 font-mono text-[11px] text-zinc-500",children:[D("配置名","Config"),": ",td(sb.name,Math.max(0,ea.findIndex(e=>e.id===sb.id)))," \xb7 PM2: ",sR,sP?" → ".concat(sL):""," \xb7 ","key ",D("尾码","suffix"),": ",sK]}):null]}),(0,n.jsxs)("button",{type:"button",disabled:ni,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=tw(),t={id:e,name:"".concat(D("线路","Ch")," ").concat(ea.length+1),streamKey:"",urlLines:"",pm2Name:tj(e),notes:""};eY(s=>({...s,[e]:tL(t)})),sS([...ea,t],{force:!0}),ed(e),t7.current=tp(t),F(t7.current),sa(""),se.current+=1,st.current+=1,t4.current=!1,eb(""),ew(eZ("")),eH(D("新线路已切换,地址列表为空","New lane selected with an empty URL list"))},children:[(0,n.jsx)(tl.Z,{className:"h-3.5 w-3.5"}),D("新增线路","Add lane")]})]}),sb?(0,n.jsxs)("div",{className:"mt-4 space-y-3 border-t border-white/5 pt-4",children:[(0,n.jsx)("input",{className:"w-full rounded-xl border border-white/10 bg-black/40 px-3 py-2 text-sm",value:null!==(T=null==sz?void 0:sz.name)&&void 0!==T?T:"",onChange:e=>sC("name",e.target.value),placeholder:D("线路名称","Lane name")}),(0,n.jsx)("label",{className:"block text-xs text-zinc-500",children:D("串流密钥","Stream key")}),(0,n.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!==(E=null==sz?void 0:sz.streamKey)&&void 0!==E?E:"",onChange:e=>sC("streamKey",e.target.value),placeholder:"xxxx-xxxx… / rtmp(s)://…"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:ni,onClick:()=>void sO(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-100",children:eG?D("保存中...","Saving..."):D("保存线路设置","Save lane")}),(0,n.jsx)("button",{type:"button",disabled:ni,onClick:()=>void sJ(),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:D("写入 youtube.ini","Write youtube.ini")})]}),sM.ok?null:(0,n.jsx)("p",{className:"text-xs text-rose-300",children:sM.message}),(0,n.jsxs)("details",{className:"rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,n.jsx)("summary",{className:"cursor-pointer text-xs text-zinc-500",children:D("高级:进程名","Advanced: process name")}),(0,n.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!==(U=null==sz?void 0:sz.pm2Name)&&void 0!==U?U:tj(sb.id),onChange:e=>sC("pm2Name",e.target.value),spellCheck:!1,placeholder:"youtube2__…"}),(0,n.jsxs)("p",{className:"mt-2 font-mono text-[11px] text-zinc-500",children:[D("实际生效","Effective"),": ",sL||"—"]}),sM.message&&!sM.ok?(0,n.jsx)("p",{className:"mt-2 text-[11px] text-rose-300",children:sM.message}):null]}),(0,n.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!==(I=null==sz?void 0:sz.notes)&&void 0!==I?I:"",onChange:e=>sC("notes",e.target.value),placeholder:D("备注(可选)","Notes (optional)")}),eJ?(0,n.jsx)("p",{className:"text-xs text-zinc-400",children:eJ}):null,(0,n.jsxs)("button",{type:"button",disabled:nl||ea.length<2,className:"inline-flex items-center gap-1 text-xs text-rose-300 hover:text-rose-200 disabled:opacity-30",onClick:()=>{var e,t;let s=ea.filter(e=>e.id!==sb.id),n=null!==(e=s[0])&&void 0!==e?e:null;if(eY(e=>{let t={...e};return delete t[sb.id],t}),sS(s,{force:!0}),ed((null==n?void 0:n.id)||""),n){let e=tp(n);t7.current=e,F(e),sa((null!==(t=n.urlLines)&&void 0!==t?t:"").trim()),sU(n)}else t7.current="",F(""),sa("")},children:[(0,n.jsx)(z.Z,{className:"h-3.5 w-3.5"}),D("删除此线路","Delete lane")]})]}):null]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:D("直播地址列表","URL list")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:D("每条线路独立写入自己的 URL_config..ini,不再复用或回填所谓“全局地址”。","Each lane writes to its own URL_config..ini with no shared global URL draft.")}),(0,n.jsx)("p",{className:"mt-1 font-mono text-[10px] text-zinc-600",children:B?eI(B):"URL_config.ini"}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px]",children:[(0,n.jsxs)("span",{className:"rounded-full border border-cyan-500/20 bg-cyan-500/10 px-2.5 py-1 text-cyan-100",children:[D("有效地址","Valid URLs"),": ",s$]}),(0,n.jsxs)("span",{className:"rounded-full border border-violet-500/20 bg-violet-500/10 px-2.5 py-1 text-violet-100",children:["Douyin: ",sX]})]}),nT,eW?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:eW}):null,(0,n.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:eS,onChange:e=>{t4.current=!0,sa(e.target.value)},spellCheck:!1,placeholder:"https://live.douyin.com/..."}),(0,n.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:(0,n.jsx)("button",{type:"button",disabled:eG,title:nr||void 0,onClick:()=>void sY(),className:"rounded-xl bg-cyan-500/20 px-4 py-2 text-sm text-cyan-100 ring-1 ring-cyan-500/30",children:D("保存地址","Save URLs")})})]})]}),"single"===ei?(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:D("直播地址列表 \xb7 URL_config.ini","URL_config.ini")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:D("一行一个地址;可自动刷新或手动重新读取。","One URL per line; auto-refresh or reload.")}),(0,n.jsx)("p",{className:"mt-1 font-mono text-[10px] text-zinc-600",children:B?eI(B):"URL_config.ini"}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px]",children:[(0,n.jsxs)("span",{className:"rounded-full border border-cyan-500/20 bg-cyan-500/10 px-2.5 py-1 text-cyan-100",children:[D("有效地址","Valid URLs"),": ",s$]}),(0,n.jsxs)("span",{className:"rounded-full border border-violet-500/20 bg-violet-500/10 px-2.5 py-1 text-violet-100",children:["Douyin: ",sX]})]}),nT,eW?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:eW}):null,(0,n.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:eu,onChange:e=>{t4.current=!0,sr(e.target.value)},spellCheck:!1}),(0,n.jsx)("button",{type:"button",disabled:eG,title:nr||void 0,onClick:()=>void sG(),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:D("保存 URL 配置","Save URL config")})]}):null]})]})]})}var t6=s(257);let t8=["dashboard","services","live_youtube","live_tiktok","android","studio","network","settings"],t9=()=>void 0!==t6&&t6.env.NEXT_PUBLIC_API_URL||"";function t7(e){if(null==e||!Number.isFinite(e))return"—";if(0===e)return"0 B";let t=["B","KB","MB","GB","TB"],s=e,n=0;for(;s>=1024&&n=10||0===n?0:1)," ").concat(t[n])}function se(e){if(null==e||!Number.isFinite(e))return"—";let t=Math.max(0,Math.floor(e));if(t<60)return"".concat(t,"s");let s=Math.floor(t/60);if(s<60)return"".concat(s,"m");let n=Math.floor(s/60);return n<48?"".concat(n,"h"):"".concat(Math.floor(n/24),"d")}function st(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 ss(e,t){let s=null!=t?t:(e,t)=>t||e,n=(e||"").trim().toLowerCase();return"connected"===n?s("高速可用","Ready"):"configured"===n?s("已配置","Configured"):"detected"===n?s("接口已起","Detected"):"idle"===n?s("等待握手","Idle"):"stale"===n?s("握手过期","Stale"):"down"===n?s("未连接","Down"):e||"—"}function sn(){var e,t,s,C,D,A,O,B,F,W,H,K,Y,G,q,J,$,X,Q,ee,et,es,en,el,ei,er,ea,eo,ec,eu,ex,em,eh,eg,eb,ef,ev,ew,ej,eN,ek,e_,eS,ez,eC,eR,eL,eP,eM,eT,eE,eU,eZ,eI,eD,eA,eO,eB,eF,eW,eH,eK,eG,eq,eJ,eV,e$,eX,eQ,e0,e1;let e5=t9(),[e2,e3]=(0,Z.useState)("zh"),[e4,e6]=(0,Z.useState)("dark"),[e9,e7]=(0,Z.useState)("dashboard"),[te,tt]=(0,Z.useState)(!1),[ts,tn]=(0,Z.useState)(!1),[tl,tr]=(0,Z.useState)(null),[ta,to]=(0,Z.useState)(null),[tc,td]=(0,Z.useState)(!0),[tu,tx]=(0,Z.useState)(null),[tm,tp]=(0,Z.useState)(null),[th,tg]=(0,Z.useState)(null),[tb,tf]=(0,Z.useState)(!0),[tv,ty]=(0,Z.useState)([]),[tw,tj]=(0,Z.useState)([]),[tN,tk]=(0,Z.useState)(""),[t_,tS]=(0,Z.useState)(""),[tz,tC]=(0,Z.useState)("/sdcard/app.apk"),[tR,tL]=(0,Z.useState)(""),[tP,tM]=(0,Z.useState)(null),[tT,tE]=(0,Z.useState)(null),[tU,tZ]=(0,Z.useState)(!0),[tI,tD]=(0,Z.useState)(!0),[tA,tO]=(0,Z.useState)("tencent-relay-wg0"),[tB,tF]=(0,Z.useState)(""),[tW,tH]=(0,Z.useState)(null),[tK,tY]=(0,Z.useState)(null),[tG,tq]=(0,Z.useState)(null),[tJ,tV]=(0,Z.useState)(!1),[t$,tX]=(0,Z.useState)(!0),[tQ,t0]=(0,Z.useState)("overlay"),[t1,t5]=(0,Z.useState)(""),[t2,t3]=(0,Z.useState)(""),[t6,sn]=(0,Z.useState)(""),[sl,si]=(0,Z.useState)("255.255.255.255"),[sr,sa]=(0,Z.useState)("9"),[so,sc]=(0,Z.useState)([]),[sd,su]=(0,Z.useState)(""),[sx,sm]=(0,Z.useState)(""),[sp,sh]=(0,Z.useState)(""),[sg,sb]=(0,Z.useState)([]),[sf,sv]=(0,Z.useState)(""),[sy,sw]=(0,Z.useState)("115200"),[sj,sN]=(0,Z.useState)("AT"),[sk,s_]=(0,Z.useState)(""),[sS,sz]=(0,Z.useState)(null),sC=(0,Z.useRef)(null),sR=(0,Z.useRef)(null),sL=(0,Z.useRef)(null),sP=(0,Z.useRef)(tN),sM=(0,Z.useRef)(0),sT=(0,Z.useRef)(null),sE=(0,Z.useCallback)((e,t)=>"zh"===e2?e:t,[e2]),sU=(0,Z.useCallback)(e=>{tp(e),null!=sT.current&&window.clearTimeout(sT.current),sT.current=window.setTimeout(()=>{tp(null),sT.current=null},2800)},[]),sZ=(0,Z.useCallback)(async(e,t)=>(0,V.N)("".concat(e5).concat(e),t),[e5]),sI=(0,Z.useCallback)(async()=>{if(sR.current)return sR.current;let e=(async()=>{try{let e=await sZ("/stack/summary");tr(t=>({...null!=t?t:{},stack:e})),to(null),tg(Date.now())}catch(e){to(e.message)}finally{sR.current=null}})();return sR.current=e,e},[sZ]),sD=(0,Z.useCallback)(async()=>{if(sC.current)return sC.current;let e=(async()=>{try{var e;let[t,s]=await Promise.allSettled([sZ("/hub/dashboard"),sZ("/deploy/check")]);if("fulfilled"!==t.status)throw t.reason;let n=t.value;tr(n),to(null),tg(Date.now()),"fulfilled"===s.status?tE(s.value):tE(null);let l=(null===(e=n.android)||void 0===e?void 0:e.devices)||[];if(l.length&&!tR){let e=l.find(e=>"device"===(e.state||"").toLowerCase());tL((null!=e?e:l[0]).serial)}}catch(e){to(e.message),tE(null)}finally{td(!1),sC.current=null}})();return sC.current=e,e},[tR,sZ]),sA=(0,Z.useMemo)(()=>{let e=new URLSearchParams({light:"1"});return"live_youtube"===e9?e.set("family","youtube"):"live_tiktok"===e9&&e.set("family","tiktok"),"/process_monitor?".concat(e.toString())},[e9]),sO=(0,Z.useMemo)(()=>ey(tw),[tw]),sB=(0,Z.useMemo)(()=>(function(e){if(!e.pageVisible)return 3e4;if("live_youtube"===e.view||"live_tiktok"===e.view)switch(e.activity){case"hot":return 800;case"warm":return 2500;default:return 5e3}return 4e3})({view:e9,activity:sO,pageVisible:tb}),[e9,sO,tb]),sF=(0,Z.useCallback)(async()=>{if(sL.current)return sL.current;let e=(async()=>{try{let e=(await sZ(sA)).entries||[];tj(e),ty(e.map(e=>({pm2:e.pm2,script:e.script,label:e.label}))),tg(Date.now()),tk(t=>!e.length||t&&e.some(e=>e.pm2===t)?t:e[0].pm2)}catch(e){}finally{sL.current=null}})();return sL.current=e,e},[sZ,sA]);(0,Z.useEffect)(()=>{e7(function(){let e=new URLSearchParams(window.location.search).get("view");return e&&t8.includes(e)?e:"/youtube-events"===window.location.pathname.replace(/\/$/,"")?"live_youtube":"dashboard"}()),tt(!0);let e=window.localStorage.getItem("live-hub-lang");("zh"===e||"en"===e)&&e3(e);let t=window.localStorage.getItem("live-hub-theme");("light"===t||"dark"===t)&&e6(t)},[]),(0,Z.useEffect)(()=>{if(!te)return;let e=new URL(window.location.href);"dashboard"===e9?e.searchParams.delete("view"):e.searchParams.set("view",e9),window.history.replaceState(null,"",e.toString())},[e9,te]),(0,Z.useEffect)(()=>{window.localStorage.setItem("live-hub-lang",e2)},[e2]),(0,Z.useEffect)(()=>{document.documentElement.setAttribute("data-theme",e4);try{window.localStorage.setItem("live-hub-theme",e4)}catch(e){}},[e4]),(0,Z.useEffect)(()=>{let e=()=>tf("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,Z.useEffect)(()=>{if(!ts)return;let e=e=>{"Escape"===e.key&&tn(!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}},[ts]),(0,Z.useEffect)(()=>()=>{null!=sT.current&&window.clearTimeout(sT.current)},[]),(0,Z.useEffect)(()=>{try{"0"===localStorage.getItem("livehub.autorefresh")&&tZ(!1),"0"===localStorage.getItem("livehub.showStreamProbes")&&tD(!1)}catch(e){}},[]),(0,Z.useEffect)(()=>{if(te){if("live_youtube"===e9||"live_tiktok"===e9){td(!1),sI();return}sD()}},[sD,sI,e9,te]),(0,Z.useEffect)(()=>{te&&sF()},[sF,te]),(0,Z.useEffect)(()=>{if(!te||!tU||!tb||"live_youtube"===e9||"live_tiktok"===e9)return;let e=window.setInterval(()=>{sD()},1e4);return()=>clearInterval(e)},[tU,tb,sD,e9,te]),(0,Z.useEffect)(()=>{if(!te||!tU)return;let e=window.setInterval(()=>{sF()},sB);return()=>clearInterval(e)},[tU,sB,sF,te]),(0,Z.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&sF()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[sF]),(0,Z.useEffect)(()=>{sP.current=tN},[tN]),(0,Z.useEffect)(()=>{"settings"===e9&&(async()=>{try{let e=await sZ("/hub/config");tM(e)}catch(e){tM(null)}})()},[sZ,e9]);let sW=(0,Z.useMemo)(()=>{var e;let t=(null==tl?void 0:null===(e=tl.stack)||void 0===e?void 0:e.quick_links)||{},s={};for(let[e,n]of Object.entries(t))/^https?:\/\//i.test(n)?s[e]=(0,ep.p)(n):s[e]=n;return s},[null==tl?void 0:null===(e=tl.stack)||void 0===e?void 0:e.quick_links]),sH=(0,Z.useMemo)(()=>{let e=new Map;for(let t of(null==tl?void 0:tl.services)||[])e.set(t.service_id,t);return e},[null==tl?void 0:tl.services]),sK=(0,Z.useMemo)(()=>["homeassistant","frigate","ntfy","wol"].map(e=>sH.get(e)).filter(Boolean),[sH]),sY=sH.get("wol"),sG=(0,Z.useMemo)(()=>(0,ti.O0)(sW),[sW]),sq=(0,Z.useMemo)(()=>(0,ti.Tc)(sG),[sG]),sJ=(0,Z.useMemo)(()=>((null==tK?void 0:tK.interfaces)||[]).flatMap(e=>e.peers||[]),[null==tK?void 0:tK.interfaces]),sV=(0,Z.useMemo)(()=>((null==tK?void 0:tK.interfaces)||[]).flatMap(e=>e.configured_peers||[]),[null==tK?void 0:tK.interfaces]),s$=(0,Z.useMemo)(()=>((null==tK?void 0:tK.repo_configs)||[]).flatMap(e=>e.peers||[]).map(e=>({...e,status_source:"config",config_source:"repo"})),[null==tK?void 0:tK.repo_configs]),sX=sJ[0]||sV[0]||s$[0]||null,sQ=(0,Z.useMemo)(()=>{for(let e of[...sJ,...sV,...s$]){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 s=t.lastIndexOf(":");return s>0?t.slice(0,s):t}(e.endpoint);if(t)return t}return""},[sV,s$,sJ]),s0=(null==tW?void 0:null===(t=tW.windows_route_template)||void 0===t?void 0:t.endpoint_host)||(null==tW?void 0:null===(C=tW.peers)||void 0===C?void 0:null===(s=C.find(e=>e.endpoint_host))||void 0===s?void 0:s.endpoint_host)||sQ||"",s1=(0,Z.useMemo)(()=>{if(!s0)return"";let e=t1.trim()||"",t=t2.trim()||"";return"route -p add ".concat(s0," mask 255.255.255.255 ").concat(e," metric 1 if ").concat(t)},[s0,t1,t2]),s5=(0,Z.useCallback)(async()=>{try{var e;let t=await sZ("/hub/network/wireguard/status");tY(null!==(e=t.wireguard)&&void 0!==e?e:null)}catch(e){tY(null)}},[sZ]),s2=(0,Z.useCallback)(async()=>{tV(!0);try{let e=await sZ("/hub/network/system_probe");tq(null!=e?e:null)}catch(e){tq(null)}finally{tV(!1)}},[sZ]);(0,Z.useEffect)(()=>{"network"===e9&&(s5(),s2())},[s2,s5,e9]);let s3=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=tB.trim();if(!t){sU(sE("请先选择或粘贴 WireGuard 配置","Pick or paste a WireGuard config first"));return}tx(e?"wg:apply":"wg:save");try{var s;let n=await sZ("/hub/network/wireguard/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:tA,content:t,route_mode:tQ,apply:e})});tH(null!==(s=n.wireguard)&&void 0!==s?s:null),await s5(),sU(e?sE("WireGuard 配置已保存并应用","WireGuard config saved and applied"):sE("WireGuard 配置已保存","WireGuard config saved"))}catch(e){sU(e.message)}finally{tx(null)}},s4=async e=>{tx("wg:neko:".concat(e));try{await sZ("/hub/network/wireguard/neko_access",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e,restart:!0})}),await s5(),await sD(),sU("remote"===e?"Neko switched to WireGuard remote access":"Neko switched back to LAN")}catch(e){sU(e.message),await s5()}finally{tx(null)}},s6=async e=>{tx("neko:proxy:".concat(e?"on":"off"));try{await sZ("/hub/network/neko_browser_proxy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:e,restart:!0})}),await s5(),await sD(),sU(e?sE("已开启 Neko 浏览器代理","Neko browser proxy enabled"):sE("已关闭 Neko 浏览器代理","Neko browser proxy disabled"))}catch(e){sU(e.message),await s5()}finally{tx(null)}},s8=async()=>{await s3(!1)},s9=async e=>{let t=(e||"").trim();if(t){tx("wg:load:".concat(t));try{var s;let e=await sZ("/hub/network/wireguard/config/".concat(encodeURIComponent(t)));tO(e.name||t),tF(e.content||""),tH(null!==(s=e.wireguard)&&void 0!==s?s:null),tX(!0),sU(sE("已载入 WireGuard 配置","WireGuard config loaded"))}catch(e){sU(e.message)}finally{tx(null)}}},s7=async e=>{if(e)try{let t=await e.text();tF(t),tA.trim()||tO(e.name.replace(/\.conf$/i,""))}catch(e){sU(e.message)}},ne=async(e,t)=>{tx("svc:".concat(e));try{let s=await sZ("/service_action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:e,action:t})});"error"===s.status?sU(s.detail||s.message||sE("操作失败","Action failed")):sU(s.message||"OK"),await sD()}catch(e){sU(e.message)}finally{tx(null)}},nt=async()=>{let e=t6.trim(),t=sl.trim()||"255.255.255.255",s=Number(sr.trim()||"9");if(!e){sU(sE("请输入 MAC 地址","Enter a MAC address"));return}if(!Number.isInteger(s)||s<1||s>65535){sU(sE("端口必须在 1-65535 之间","Port must be 1-65535"));return}tx("wol:wake");try{let n=await sZ("/studio/wol/wake",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mac:e,broadcast:t,port:s})});sU(n.message||sE("唤醒包已发送","Wake packet sent"))}catch(e){sU(e.message)}finally{tx(null)}},ns=(0,Z.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{let t=await sZ(e?"/studio/wol/devices/probe":"/studio/wol/devices",e?{method:"POST"}:void 0);sc(t.devices||[])}catch(t){e&&sU(t.message)}},[sZ,sU]),nn=async()=>{let e=t6.trim();if(!e){sU(sE("请输入 MAC 地址","Enter a MAC address"));return}tx("wol:save");try{var t;let s=await sZ("/studio/wol/devices",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:sx,mac:e,ip:sp})});sc(s.devices||[]),su((null===(t=s.device)||void 0===t?void 0:t.mac)||e),sU(s.message||sE("设备已保存","Device saved"))}catch(e){sU(e.message)}finally{tx(null)}},nl=async()=>{let e=(sd||t6).trim();if(e){tx("wol:delete");try{let t=await sZ("/studio/wol/devices/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mac:e})});sc(t.devices||[]),su(""),sn(""),sm(""),sh(""),sU(sE("设备已删除","Device removed"))}catch(e){sU(e.message)}finally{tx(null)}}},ni=(0,Z.useCallback)(async()=>{try{let e=(await sZ("/studio/serial/ports")).ports||[];sb(e),sv(t=>{var s;return t&&e.some(e=>e.path===t)?t:(null===(s=e[0])||void 0===s?void 0:s.path)||t})}catch(e){sb([])}},[sZ]),nr=(0,Z.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{let t=await sZ("/studio/ops/summary".concat(e?"?refresh=1":""));sz(t)}catch(t){e&&sU(t.message)}},[sZ,sU]),na=async()=>{tx("studio:snapshot");try{let e=await sZ("/studio/ops/snapshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"studio"})});await nr(!1),sU(e.message||sE("系统快照已创建","System snapshot created"))}catch(e){sU(e.message)}finally{tx(null)}};(0,Z.useEffect)(()=>{if("studio"!==e9)return;ns(!0),nr(!0);let e=window.setInterval(()=>{ns(!0),nr(!1)},3e4);return()=>window.clearInterval(e)},[ni,nr,ns,e9]);let no=async(e,t)=>{let s=(null!=t?t:tN).trim();if(s){tx("proc:".concat(e,":").concat(s));try{let t=await sZ("/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:s})});sU(String(t.output||t.message||"OK")),await sF(),"live_youtube"===e9||"live_tiktok"===e9?sD():await sD()}catch(e){sU(e.message)}finally{tx(null)}}},nc=async(e,t)=>{let s=(null!=t?t:tN).trim();if(!s)throw sU(sE("请选择要保存地址的进程","Pick a process before saving URLs")),Error(sE("请选择要保存地址的进程","Pick a process before saving URLs"));let n=null!=e?e:t_,l=++sM.current;tx("save:url");try{let e=new URLSearchParams({process:s}),t=await sZ("/save_url_config?".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})});l===sM.current&&s===sP.current.trim()&&tS(n),sU(t.path?sE("URL 配置已保存: ".concat(t.path),"URL config saved: ".concat(t.path)):sE("URL 配置已保存","URL config saved"))}catch(e){throw sU(e.message),e}finally{tx(null)}},nd=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!tR){sU(sE("请选择设备","Pick a device"));return}tx("adb:".concat(e));try{let s=await sZ("/android/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,serial:tR,payload:t})});sU(s.message||"OK")}catch(e){sU(e.message)}finally{tx(null)}},nu=[{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:"studio",icon:u.Z,labelZh:"工作室",labelEn:"Studio"},{id:"network",icon:x.Z,labelZh:"网络",labelEn:"Network"},{id:"settings",icon:m.Z,labelZh:"设置",labelEn:"Settings"}],nx=e=>{(async()=>{var t;if(null===(t=navigator.clipboard)||void 0===t?void 0:t.writeText){await navigator.clipboard.writeText(e);return}let s=document.createElement("textarea");s.value=e,s.readOnly=!0,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select(),document.execCommand("copy"),s.remove()})().then(()=>sU(sE("已复制","Copied")),()=>sU(sE("复制失败","Copy failed")))},nm=th?new Date(th).toLocaleTimeString("zh"===e2?"zh-CN":"en-US",{hour12:!1}):sE("未同步","Not synced"),np=tb?sE("前台自动刷新","Auto refresh"):sE("后台已暂停刷新","Refresh paused in background");return(0,n.jsxs)("div",{className:"lp-root min-h-screen transition-colors duration-300 ".concat("light"===e4?"bg-slate-100 text-slate-900 selection:bg-violet-400/25":"bg-[#050508] text-zinc-100 selection:bg-violet-500/30"),children:[(0,n.jsx)("div",{className:"lp-noise pointer-events-none fixed inset-0 z-0 ".concat("light"===e4?"opacity-[0.06]":"opacity-[0.22]"),"aria-hidden":!0}),(0,n.jsx)("div",{className:"lp-aurora pointer-events-none fixed -left-1/4 top-0 h-[42rem] w-[42rem] rounded-full blur-[120px] ".concat("light"===e4?"bg-violet-400/15":"bg-violet-600/20"),"aria-hidden":!0}),(0,n.jsx)("div",{className:"lp-aurora2 pointer-events-none fixed bottom-0 right-0 h-[36rem] w-[36rem] rounded-full blur-[100px] ".concat("light"===e4?"bg-cyan-400/10":"bg-cyan-500/10"),"aria-hidden":!0}),tm?(0,n.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:tm}):null,(0,n.jsxs)("div",{className:"relative z-10 flex min-h-screen",children:[(0,n.jsxs)("aside",{className:"hidden w-64 shrink-0 flex-col border-r px-4 py-6 backdrop-blur-2xl lg:flex ".concat("light"===e4?"border-slate-200/90 bg-white/70":"border-white/[0.06] bg-zinc-950/40"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 px-2",children:[(0,n.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,n.jsx)(p.Z,{className:"h-4 w-4 text-white"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-[0.2em] ".concat("light"===e4?"text-slate-500":"text-zinc-500"),children:"live.local"}),(0,n.jsx)("p",{className:"text-sm font-semibold ".concat("light"===e4?"text-slate-900":"text-white"),children:sE("无人直播系统","Unmanned Live System")})]})]}),(0,n.jsx)("nav",{className:"mt-10 flex flex-1 flex-col gap-1",children:nu.map(e=>{let t=e.icon,s=e9===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>e7(e.id),"aria-current":s?"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"===e4?s?"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":s?"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,n.jsx)(t,{className:"h-4 w-4 ".concat("light"===e4?s?"text-violet-600":"text-slate-400":s?"text-violet-300":"text-zinc-600")}),sE(e.labelZh,e.labelEn),s?(0,n.jsx)(h.Z,{className:"ml-auto h-4 w-4 ".concat("light"===e4?"text-slate-400":"text-zinc-600")}):null]},e.id)})})]}),(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,n.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"===e4?"border-slate-200/80 bg-white/75 text-slate-900":"border-white/[0.06] bg-zinc-950/70 text-white"),children:[(0,n.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,n.jsx)("button",{type:"button",className:"rounded-xl border p-2 lg:hidden ".concat("light"===e4?"border-slate-200 bg-white/80":"border-white/10 bg-white/5"),onClick:()=>tn(!0),"aria-label":"Menu",children:(0,n.jsx)(g.Z,{className:"h-5 w-5"})}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("h1",{className:"truncate text-lg font-semibold tracking-tight lg:text-xl ".concat("light"===e4?"text-slate-900":"text-white"),children:sE((null===(D=nu.find(e=>e.id===e9))||void 0===D?void 0:D.labelZh)||"",(null===(A=nu.find(e=>e.id===e9))||void 0===A?void 0:A.labelEn)||"")}),(0,n.jsxs)("p",{className:"truncate text-xs ".concat("light"===e4?"text-slate-500":"text-zinc-500"),children:[(null==tl?void 0:null===(O=tl.stack)||void 0===O?void 0:O.mdns_host)||"live.local"," \xb7"," ","dark"===e4?sE("夜间","Dark mode"):sE("日间","Light mode")," \xb7 ",np," \xb7"," ",sE("最后同步","Last sync")," ",nm]})]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 sm:gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:()=>e6(e=>"dark"===e?"light":"dark"),className:"rounded-xl border p-2 transition ".concat("light"===e4?"border-slate-200 bg-white text-amber-500 shadow-sm":"border-white/10 bg-white/[0.06] text-violet-200"),title:"dark"===e4?sE("切换到日间","Switch to light"):sE("切换到夜间","Switch to dark"),"aria-label":"dark"===e4?sE("日间模式","Light mode"):sE("夜间模式","Dark mode"),"aria-pressed":"light"===e4,children:"dark"===e4?(0,n.jsx)(b.Z,{className:"h-5 w-5",strokeWidth:2}):(0,n.jsx)(f.Z,{className:"h-5 w-5",strokeWidth:2})}),(0,n.jsxs)("button",{type:"button",onClick:()=>e3(e=>"zh"===e?"en":"zh"),className:"relative rounded-xl border p-2 transition ".concat("light"===e4?"border-slate-200 bg-white text-cyan-600 shadow-sm":"border-white/10 bg-white/[0.06] text-cyan-200"),title:"zh"===e2?"English":"中文","aria-label":sE("切换语言","Toggle language"),"aria-pressed":"en"===e2,children:[(0,n.jsx)(v.Z,{className:"h-5 w-5",strokeWidth:2}),(0,n.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"===e4?"bg-cyan-100 text-cyan-800":"bg-cyan-500/30 text-cyan-100"),children:"zh"===e2?"中":"A"})]}),(0,n.jsxs)("button",{type:"button",disabled:!!tu,onClick:()=>void Promise.all([sD(),sF()]),className:"flex items-center gap-2 rounded-xl border px-3 py-2 text-xs font-medium transition disabled:opacity-40 ".concat("light"===e4?"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:[tu?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5"}),(0,n.jsx)("span",{className:"hidden sm:inline",children:sE("刷新","Refresh")})]})]})]}),(0,n.jsx)("main",{className:"flex-1 px-4 py-6 lg:px-8 lg:py-8",children:(0,n.jsx)(i.M,{mode:"wait",children:(0,n.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"===e9?(0,n.jsx)(e8,{dash:tl,deployCheck:tT,dashErr:ta,loading:tc,theme:e4,t:sE,onNavigate:e7,nekoLinks:sG,nekoPortsLabel:sq,showStreamProbes:tI,quickLinks:sW}):null,"services"===e9?(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:[((null==tl?void 0:tl.services)||[]).map((e,t)=>(0,n.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,n.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"font-semibold text-white",children:e.label}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500 line-clamp-2",children:e.description})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(st(e.running?"online":e.status)),children:e.running?sE("运行中","Running"):e.status})]}),e.detail?(0,n.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,n.jsx)("p",{className:"mt-2 text-[11px] text-zinc-500",children:sE("stopped 为常态:仅当需要透明代理 / 规则分流时再手动点 Start,不建议设置自启。","Stopped is normal; click Start manually only when the proxy is needed. Autostart stays off.")}):null,(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.url?(0,n.jsx)("a",{href:(0,ep.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:sE("打开面板","Open panel")}):null,(0,n.jsx)("button",{type:"button",disabled:!!tu||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?sE("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||sE("当前不可操作","Unavailable"),onClick:()=>void ne(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,n.jsx)("button",{type:"button",disabled:!!tu||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?sE("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||sE("当前不可操作","Unavailable"),onClick:()=>void ne(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,n.jsx)("button",{type:"button",disabled:!!tu||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?sE("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||sE("当前不可操作","Unavailable"),onClick:()=>void ne(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,n.jsx)("button",{type:"button",disabled:!!tu||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?sE("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||sE("当前不可操作","Unavailable"),onClick:()=>void ne(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,n.jsx)("button",{type:"button",disabled:!!tu||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?sE("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||sE("当前不可操作","Unavailable"),onClick:()=>void ne(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,n.jsx)("button",{type:"button",disabled:!!tu||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?sE("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||sE("当前不可操作","Unavailable"),onClick:()=>void ne(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==tl?void 0:null===(B=tl.services)||void 0===B?void 0:B.length)?null:(0,n.jsx)("p",{className:"text-sm text-zinc-500",children:sE("暂无服务数据","No services")})]}):null,"live_youtube"===e9?(0,n.jsx)(t4,{t:sE,busy:tu,entries:tv,currentProc:tN,setCurrentProc:tk,urlConfig:t_,setUrlConfig:tS,onRunProcess:(e,t)=>void no(e,t),onSaveUrlConfig:(e,t)=>nc(e,t),fetchJson:sZ,liveProcesses:tw.length?tw:null!==(eW=null==tl?void 0:null===(F=tl.live)||void 0===F?void 0:F.processes)&&void 0!==eW?eW:[],notify:sU,quickLinks:sW,onRefresh:()=>sD(),onNavigate:e=>e7(e)}):null,"live_tiktok"===e9?(0,n.jsx)(eY,{t:sE,busy:!!tu,entries:tv,currentProc:tN,setCurrentProc:tk,urlConfig:t_,setUrlConfig:tS,onRunProcess:e=>void no(e),onSaveUrlConfig:e=>nc(e),onReplayGoLive:async(e,t)=>{let s=t.replace(/[,,|]/g,"_");await nc("原画,".concat(e,",主播: ").concat(s)),await no("start")},onCopy:nx,fetchJson:sZ,apiPrefix:e5,quickLinks:sW,hdmiStatus:null==tl?void 0:tl.hdmi,notify:sU,onNavigate:e=>e7(e)}):null,"android"===e9?(0,n.jsx)(ed,{t:sE,notify:sU,fetchJson:sZ,apiBase:e5,busy:tu,androidSerial:tR,setAndroidSerial:tL,devices:(null==tl?void 0:null===(W=tl.android)||void 0===W?void 0:W.devices)||[],adbAvailable:!!(null==tl?void 0:null===(H=tl.android)||void 0===H?void 0:H.adb_available),apkPath:tz,setApkPath:tC,onAndroidAction:(e,t)=>nd(e,null!=t?t:{}),onCopy:nx,onRefreshDevices:()=>void sD()}):null,"studio"===e9?(0,n.jsxs)("div",{className:"mx-auto max-w-7xl space-y-5",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold ".concat("light"===e4?"text-slate-900":"text-white"),children:[(0,n.jsx)(u.Z,{className:"h-5 w-5 ".concat("light"===e4?"text-emerald-700":"text-emerald-300")}),sE("工作室","Studio")]}),(0,n.jsx)("p",{className:"mt-1 text-xs ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:"Home Assistant / Frigate / WOL"})]}),(0,n.jsxs)("span",{className:"w-fit rounded-full px-3 py-1 text-[11px] font-semibold ".concat("light"===e4?"bg-emerald-50 text-emerald-800 ring-1 ring-emerald-200":"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-500/25"),children:[sK.filter(e=>null==e?void 0:e.running).length,"/",sK.length||4," online"]})]}),(0,n.jsxs)("div",{className:"grid gap-4 xl:grid-cols-4",children:[[{id:"homeassistant",label:"Home Assistant",icon:u.Z,fallbackUrl:sW.homeassistant,iconClass:"light"===e4?"text-emerald-700":"text-emerald-300",openClass:"light"===e4?"bg-emerald-50 text-emerald-800 ring-1 ring-emerald-200 hover:bg-emerald-100":"bg-emerald-500/15 text-emerald-100 ring-1 ring-emerald-400/25 hover:bg-emerald-500/25"},{id:"frigate",label:"Frigate NVR",icon:j.Z,fallbackUrl:sW.frigate,iconClass:"light"===e4?"text-cyan-700":"text-cyan-300",openClass:"light"===e4?"bg-cyan-50 text-cyan-800 ring-1 ring-cyan-200 hover:bg-cyan-100":"bg-cyan-500/15 text-cyan-100 ring-1 ring-cyan-400/25 hover:bg-cyan-500/25"},{id:"ntfy",label:"ntfy",icon:N.Z,fallbackUrl:sW.ntfy,iconClass:"light"===e4?"text-violet-700":"text-violet-300",openClass:"light"===e4?"bg-violet-50 text-violet-800 ring-1 ring-violet-200 hover:bg-violet-100":"bg-violet-500/15 text-violet-100 ring-1 ring-violet-400/25 hover:bg-violet-500/25"}].map(e=>{let t=sH.get(e.id),s=e.icon,i=(null==t?void 0:t.url)||e.fallbackUrl||"",r=!!tu||(null==t?void 0:t.available)===!1;return(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===e4?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e4?"text-slate-900":"text-white"),children:[(0,n.jsx)(s,{className:"h-4 w-4 ".concat(e.iconClass)}),e.label]}),(0,n.jsx)("p",{className:"mt-2 line-clamp-2 text-xs ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:(null==t?void 0:t.description)||("frigate"===e.id?"Camera NVR and detection console":"Local automation workspace")})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(st((null==t?void 0:t.running)?"online":(null==t?void 0:t.status)||"unknown")),children:(null==t?void 0:t.running)?sE("运行中","Running"):(null==t?void 0:t.status)||"unknown"})]}),(null==t?void 0:t.detail)?(0,n.jsx)("p",{className:"mt-3 line-clamp-4 font-mono text-[11px] ".concat("light"===e4?"text-slate-500":"text-zinc-500"),children:t.detail}):null,(0,n.jsxs)("div",{className:"mt-5 flex flex-wrap gap-2",children:[i?(0,n.jsxs)("a",{href:(0,ep.p)(i),target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 rounded-lg px-3 py-2 text-xs font-semibold transition ".concat(e.openClass),children:[(0,n.jsx)(k.Z,{className:"h-3.5 w-3.5"}),sE("打开","Open")]}):null,(0,n.jsx)("button",{type:"button",disabled:r,onClick:()=>void ne(e.id,"start"),className:"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:"Start"}),(0,n.jsx)("button",{type:"button",disabled:r,onClick:()=>void ne(e.id,"restart"),className:"rounded-lg bg-amber-500/15 px-3 py-2 text-xs font-semibold text-amber-100 ring-1 ring-amber-400/25 transition hover:bg-amber-500/25 disabled:opacity-40",children:"Restart"}),(0,n.jsx)("button",{type:"button",disabled:r,onClick:()=>void ne(e.id,"stop"),className:"rounded-lg bg-rose-500/15 px-3 py-2 text-xs font-semibold text-rose-100 ring-1 ring-rose-400/25 transition hover:bg-rose-500/25 disabled:opacity-40",children:"Stop"})]})]},e.id)}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===e4?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e4?"text-slate-900":"text-white"),children:[(0,n.jsx)(_.Z,{className:"h-4 w-4 ".concat("light"===e4?"text-amber-700":"text-amber-300")}),sE("WOL 网络唤醒","WOL Network Wake")]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:(null==sY?void 0:sY.detail)||"broadcast=255.255.255.255;port=9"})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(st((null==sY?void 0:sY.status)||"ready")),children:(null==sY?void 0:sY.status)||"ready"})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-3",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("select",{value:sd,onChange:e=>{let t=e.target.value;su(t);let s=so.find(e=>e.mac===t);s&&(sn(s.mac),sm(s.name||""),sh(s.ip||""))},className:"min-w-0 flex-1 rounded-lg border px-3 py-2 text-xs outline-none ".concat("light"===e4?"border-slate-200 bg-slate-50 text-slate-900":"border-white/10 bg-black/35 text-zinc-100"),children:[(0,n.jsx)("option",{value:"",children:sE("选择设备","Select device")}),so.map(e=>(0,n.jsx)("option",{value:e.mac,children:(e.name||e.ip||e.mac)+(e.reachable?" \xb7 online":"")},e.mac))]}),(0,n.jsx)("button",{type:"button",disabled:"wol:probe"===tu,onClick:()=>{tx("wol:probe"),ns(!0).finally(()=>tx(null))},className:"inline-flex items-center justify-center rounded-lg bg-cyan-500/15 px-3 py-2 text-xs font-semibold text-cyan-100 ring-1 ring-cyan-400/25 transition hover:bg-cyan-500/25 disabled:opacity-40",children:(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat("wol:probe"===tu?"animate-spin":"")})})]}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:sE("名称","Name")}),(0,n.jsx)("input",{value:sx,onChange:e=>sm(e.target.value),placeholder:"NAS / PC",className:"mt-1 w-full rounded-lg border px-3 py-2 text-sm outline-none ".concat("light"===e4?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]}),(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:"IP"}),(0,n.jsx)("input",{value:sp,onChange:e=>sh(e.target.value),placeholder:"10.0.0.10",inputMode:"decimal",className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===e4?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]})]}),(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:"MAC"}),(0,n.jsx)("input",{value:t6,onChange:e=>sn(e.target.value),placeholder:"AA:BB:CC:DD:EE:FF",autoCapitalize:"characters",spellCheck:!1,className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===e4?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[minmax(0,1fr)_7rem]",children:[(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:"Broadcast"}),(0,n.jsx)("input",{value:sl,onChange:e=>si(e.target.value),placeholder:"255.255.255.255",inputMode:"decimal",className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===e4?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]}),(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:"Port"}),(0,n.jsx)("input",{value:sr,onChange:e=>sa(e.target.value),inputMode:"numeric",className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===e4?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]})]}),(0,n.jsxs)("button",{type:"button",disabled:"wol:wake"===tu||(null==sY?void 0:sY.available)===!1,onClick:()=>void nt(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-amber-500/18 px-3 py-2.5 text-xs font-semibold text-amber-100 ring-1 ring-amber-400/30 transition hover:bg-amber-500/28 disabled:opacity-40",children:["wol:wake"===tu?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(_.Z,{className:"h-3.5 w-3.5"}),sE("唤醒","Wake")]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,n.jsxs)("button",{type:"button",disabled:"wol:save"===tu,onClick:()=>void nn(),className:"inline-flex items-center justify-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:["wol:save"===tu?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(S.Z,{className:"h-3.5 w-3.5"}),sE("保存","Save")]}),(0,n.jsxs)("button",{type:"button",disabled:"wol:delete"===tu||!(sd||t6),onClick:()=>void nl(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-rose-500/15 px-3 py-2 text-xs font-semibold text-rose-100 ring-1 ring-rose-400/25 transition hover:bg-rose-500/25 disabled:opacity-40",children:["wol:delete"===tu?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(z.Z,{className:"h-3.5 w-3.5"}),sE("删除","Delete")]})]})]})]})]}),null,(0,n.jsxs)("div",{className:"grid gap-4 xl:grid-cols-4",children:[(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===e4?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e4?"text-slate-900":"text-white"),children:[(0,n.jsx)(R.Z,{className:"h-4 w-4 ".concat("light"===e4?"text-emerald-700":"text-emerald-300")}),"System Doctor"]}),(0,n.jsxs)("p",{className:"mt-2 text-xs ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:[null!==(eH=null==sS?void 0:null===(K=sS.doctor)||void 0===K?void 0:K.services_running)&&void 0!==eH?eH:0,"/",null!==(eK=null==sS?void 0:null===(Y=sS.doctor)||void 0===Y?void 0:Y.services_available)&&void 0!==eK?eK:0," services"]})]}),(0,n.jsxs)("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(st((null==sS?void 0:null===(G=sS.doctor)||void 0===G?void 0:G.status)||"unknown")),children:[null!==(eG=null==sS?void 0:null===(q=sS.doctor)||void 0===q?void 0:q.score)&&void 0!==eG?eG:0,"/100"]})]}),(0,n.jsxs)("div",{className:"mt-4 space-y-2 text-xs ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:[(0,n.jsxs)("p",{children:[sE("严重","Critical"),": ",null!==(eq=null==sS?void 0:null===(J=sS.doctor)||void 0===J?void 0:J.critical)&&void 0!==eq?eq:0," / ",sE("警告","Warnings"),": ",null!==(eJ=null==sS?void 0:null===($=sS.doctor)||void 0===$?void 0:$.warnings)&&void 0!==eJ?eJ:0]}),((null==sS?void 0:null===(X=sS.doctor)||void 0===X?void 0:X.recommendations)||[]).slice(0,2).map(e=>(0,n.jsxs)("p",{className:"line-clamp-2",children:["- ",e]},e))]})]}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===e4?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e4?"text-slate-900":"text-white"),children:[(0,n.jsx)(L.Z,{className:"h-4 w-4 ".concat("light"===e4?"text-cyan-700":"text-cyan-300")}),sE("设备资产","Device inventory")]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:"LAN / USB"})]}),(0,n.jsx)("button",{type:"button",disabled:"studio:ops"===tu,onClick:()=>{tx("studio:ops"),nr(!0).finally(()=>tx(null))},className:"inline-flex items-center justify-center rounded-lg px-2.5 py-2 text-xs font-semibold ring-1 transition disabled:opacity-40 ".concat("light"===e4?"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,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat("studio:ops"===tu?"animate-spin":"")})})]}),(0,n.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-2 text-center text-xs",children:[["WOL",null!==(eV=null==sS?void 0:null===(ee=sS.inventory)||void 0===ee?void 0:null===(Q=ee.counts)||void 0===Q?void 0:Q.wol)&&void 0!==eV?eV:0],["Video",null!==(e$=null==sS?void 0:null===(es=sS.inventory)||void 0===es?void 0:null===(et=es.counts)||void 0===et?void 0:et.video)&&void 0!==e$?e$:0]].map(e=>{let[t,s]=e;return(0,n.jsxs)("div",{className:"rounded-lg border px-2 py-2 ".concat("light"===e4?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"font-semibold ".concat("light"===e4?"text-slate-900":"text-white"),children:s}),(0,n.jsx)("p",{className:"light"===e4?"text-slate-500":"text-zinc-500",children:t})]},t)})})]}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===e4?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e4?"text-slate-900":"text-white"),children:[(0,n.jsx)(p.Z,{className:"h-4 w-4 ".concat("light"===e4?"text-amber-700":"text-amber-300")}),sE("自动化配方","Automation recipes")]}),(0,n.jsx)("div",{className:"mt-4 space-y-2",children:((null==sS?void 0:sS.recipes)||[]).slice(0,3).map(e=>(0,n.jsx)("div",{className:"rounded-lg border px-3 py-2 text-xs ".concat("light"===e4?"border-slate-200 bg-slate-50 text-slate-700":"border-white/10 bg-black/30 text-zinc-300"),children:(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"line-clamp-1 font-semibold",children:e.title}),(0,n.jsx)("span",{className:"ready"===e.status?"text-emerald-400":"text-amber-300",children:e.status})]})},e.id||e.title))})]}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===e4?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e4?"text-slate-900":"text-white"),children:[(0,n.jsx)(a.Z,{className:"h-4 w-4 ".concat("light"===e4?"text-violet-700":"text-violet-300")}),sE("备份快照","Backup snapshots")]}),(0,n.jsxs)("p",{className:"mt-2 text-xs ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:[((null==sS?void 0:null===(en=sS.backups)||void 0===en?void 0:en.snapshots)||[]).length," snapshots"]})]}),(0,n.jsxs)("button",{type:"button",disabled:"studio:snapshot"===tu,onClick:()=>void na(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-violet-500/15 px-3 py-2 text-xs font-semibold text-violet-100 ring-1 ring-violet-400/25 transition hover:bg-violet-500/25 disabled:opacity-40",children:["studio:snapshot"===tu?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(P.Z,{className:"h-3.5 w-3.5"}),sE("创建","Create")]})]}),(0,n.jsx)("p",{className:"mt-4 line-clamp-2 text-xs ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:(null===(el=((null==sS?void 0:null===(ei=sS.backups)||void 0===ei?void 0:ei.snapshots)||[])[0])||void 0===el?void 0:el.name)||sE("暂无快照","No snapshots yet")})]})]})]}):null,"network"===e9?(0,n.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6",children:[(0,n.jsxs)("div",{className:"rounded-2xl border p-6 shadow-xl ".concat("light"===e4?"border-cyan-200/90 bg-white shadow-cyan-100/50":"border-cyan-500/20 bg-zinc-950/55 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e4?"text-slate-900":"text-white"),children:[(0,n.jsx)(R.Z,{className:"h-4 w-4 ".concat("light"===e4?"text-cyan-700":"text-cyan-300")}),"WireGuard VPS"]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:sE("导入 VPS wg-quick 配置,保存到受管配置目录,并生成 Windows 端点旁路路由命令。","Import a VPS wg-quick config, save it under managed config, and generate the Windows endpoint bypass route.")})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)("span",{className:"rounded-full px-3 py-1 text-[11px] font-semibold ".concat((null==tK?void 0:tK.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:[ss(null==tK?void 0:null===(er=tK.quality)||void 0===er?void 0:er.status,sE),"number"==typeof(null==tK?void 0:null===(ea=tK.quality)||void 0===ea?void 0:ea.score)?" \xb7 ".concat(tK.quality.score,"/100"):""]}),(null==tW?void 0:tW.relative_path)?(0,n.jsx)("div",{className:"rounded-lg border px-3 py-2 text-[11px] ".concat("light"===e4?"border-cyan-200 bg-cyan-50 text-cyan-900":"border-cyan-400/20 bg-cyan-500/10 text-cyan-100"),children:tW.relative_path}):null,(0,n.jsxs)("button",{onClick:()=>{s5(),s2()},disabled:"wg:status"===tu||tJ,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"===e4?"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,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(tJ?"animate-spin":"")}),tJ?sE("探测中","Probing"):sE("刷新","Refresh")]})]})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-3 lg:grid-cols-2 xl:grid-cols-4",children:[(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===e4?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===e4?"text-slate-500":"text-zinc-500"),children:sE("当前接口","Active interfaces")}),(0,n.jsxs)("div",{className:"mt-2 rounded-lg border px-3 py-2 text-xs ".concat("light"===e4?"border-cyan-100 bg-white text-slate-700":"border-cyan-400/15 bg-cyan-500/10 text-cyan-100"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"font-semibold",children:ss(null==tK?void 0:null===(eo=tK.quality)||void 0===eo?void 0:eo.status,sE)}),(0,n.jsx)("span",{className:"font-mono",children:"number"==typeof(null==tK?void 0:null===(ec=tK.quality)||void 0===ec?void 0:ec.score)?"".concat(tK.quality.score,"/100"):"—"})]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] ".concat("light"===e4?"text-slate-500":"text-cyan-100/75"),children:[sE("新鲜握手","Fresh peers"),": ",null!==(eX=null==tK?void 0:null===(eu=tK.quality)||void 0===eu?void 0:eu.fresh_peer_count)&&void 0!==eX?eX:0,"/",null!==(eQ=null==tK?void 0:null===(ex=tK.quality)||void 0===ex?void 0:ex.peer_count)&&void 0!==eQ?eQ:0," \xb7 ",sE("最佳握手","Best handshake"),": ",se(null==tK?void 0:null===(em=tK.quality)||void 0===em?void 0:em.best_handshake_age_seconds)]})]}),(0,n.jsx)("div",{className:"mt-2 space-y-2",children:((null==tK?void 0:tK.interfaces)||[]).length?((null==tK?void 0:tK.interfaces)||[]).map(e=>{var t,s,l;return(0,n.jsxs)("div",{className:"rounded-lg border px-3 py-2 text-xs ".concat("light"===e4?"border-slate-200 bg-white text-slate-700":"border-white/10 bg-zinc-950/60 text-zinc-200"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"font-semibold",children:e.name||"wg"}),(0,n.jsx)("span",{className:(null===(t=e.systemd)||void 0===t?void 0:t.active)==="active"?"text-emerald-400":"text-amber-300",children:(null===(s=e.systemd)||void 0===s?void 0:s.active)||"active"})]}),(0,n.jsx)("p",{className:"mt-1 font-mono text-[11px]",children:(e.addresses||[]).join(", ")||"—"}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] ".concat("light"===e4?"text-slate-500":"text-zinc-500"),children:[e.details_available?sE("运行细节可读","Runtime details readable"):sE("运行细节受限","Runtime details limited"),(null===(l=e.configured_from)||void 0===l?void 0:l.name)?" \xb7 ".concat(sE("配置","Config"),": ").concat(e.configured_from.name):""]})]},e.name||"wg")}):(0,n.jsx)("p",{className:"text-xs ".concat("light"===e4?"text-slate-500":"text-zinc-500"),children:sE("未发现 wg show 输出","No wg show output")})})]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===e4?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===e4?"text-slate-500":"text-zinc-500"),children:sE("对端与流量","Peer and traffic")}),(()=>{var e;let t=(null==sX?void 0:sX.status_source)==="wg"?sE("运行态","Runtime"):(null==sX?void 0:sX.config_source)==="system"?sE("系统配置","System config"):(null==sX?void 0:sX.config_source)==="repo"?sE("受管配置","Managed config"):sE("配置态","Config");return sX?(0,n.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[11px] ".concat("light"===e4?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["Source: ",t]}),(0,n.jsxs)("p",{children:["Endpoint: ",sX.endpoint||"—"]}),(0,n.jsxs)("p",{children:["AllowedIPs: ",(sX.allowed_ips||[]).join(", ")||"—"]}),(0,n.jsxs)("p",{children:["Handshake:"," ","config"===sX.status_source?sE("运行态需 root/CAP_NET_ADMIN","Runtime details need root/CAP_NET_ADMIN"):se(sX.latest_handshake_age_seconds)]}),(0,n.jsxs)("p",{children:["RX/TX: ",t7(sX.transfer_rx_bytes)," / ",t7(sX.transfer_tx_bytes)]}),(0,n.jsxs)("p",{children:["Keepalive: ",null!==(e=sX.persistent_keepalive)&&void 0!==e?e:"—"]})]}):(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===e4?"text-slate-500":"text-zinc-500"),children:sE("暂无 peer 数据","No peer data yet")})})(),((null==tK?void 0:tK.endpoint_routes)||[]).length?(0,n.jsx)("div",{className:"mt-3 space-y-1 rounded-lg border px-3 py-2 font-mono text-[10px] ".concat("light"===e4?"border-slate-200 bg-white text-slate-600":"border-white/10 bg-zinc-950/60 text-zinc-400"),children:((null==tK?void 0:tK.endpoint_routes)||[]).slice(0,2).map(e=>(0,n.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,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===e4?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===e4?"text-slate-500":"text-zinc-500"),children:sE("Neko 访问模式","Neko access mode")}),(0,n.jsx)("div",{className:"mt-2 grid grid-cols-2 rounded-lg p-1 text-xs font-semibold ".concat("light"===e4?"bg-slate-200/70":"bg-black/40"),children:["lan","remote"].map(e=>{var t,s;let l=((null==tK?void 0:null===(t=tK.neko_access)||void 0===t?void 0:t.mode)||"lan")===e,i=(null==tu?void 0:tu.startsWith("wg:neko"))||"remote"===e&&!(null==tK?void 0:null===(s=tK.neko_access)||void 0===s?void 0:s.remote_ready);return(0,n.jsx)("button",{onClick:()=>void s4(e),disabled:i,className:"rounded-md px-2.5 py-1.5 transition disabled:opacity-40 ".concat(l?"light"===e4?"bg-white text-cyan-800 shadow-sm":"bg-cyan-500/25 text-cyan-100 ring-1 ring-cyan-400/25":"light"===e4?"text-slate-600 hover:bg-white/60":"text-zinc-300 hover:bg-white/10"),children:"lan"===e?sE("局域网","LAN"):sE("远控","Remote")},e)})}),(0,n.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[11px] ".concat("light"===e4?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["NAT1TO1: ",(null==tK?void 0:null===(eh=tK.neko_access)||void 0===eh?void 0:eh.nat1to1)||"-"]}),(0,n.jsxs)("p",{children:["LAN: ",(null==tK?void 0:null===(eg=tK.neko_access)||void 0===eg?void 0:eg.lan_host)||"-"]}),(0,n.jsxs)("p",{children:["WG: ",(null==tK?void 0:null===(eb=tK.neko_access)||void 0===eb?void 0:eb.wireguard_host)||"-"]}),(0,n.jsxs)("p",{children:["Target: ",(null==tK?void 0:null===(ef=tK.neko_access)||void 0===ef?void 0:ef.target_nat1to1)||"-"]}),(0,n.jsxs)("p",{children:["ShellCrash: ",(null==tK?void 0:null===(ev=tK.shellcrash)||void 0===ev?void 0:ev.running)?"running:".concat((null==tK?void 0:null===(ew=tK.shellcrash)||void 0===ew?void 0:ew.mixed_port)||"7890"):"stopped"]})]}),(0,n.jsxs)("div",{className:"mt-3 rounded-lg border px-3 py-2 ".concat("light"===e4?"border-slate-200 bg-white":"border-white/10 bg-black/20"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===e4?"text-slate-500":"text-zinc-500"),children:sE("Neko 浏览器代理","Neko browser proxy")}),(0,n.jsx)("div",{className:"mt-2 grid grid-cols-2 rounded-lg p-1 text-xs font-semibold ".concat("light"===e4?"bg-slate-200/70":"bg-black/40"),children:[!1,!0].map(e=>{var t;let s=!!(null==tK?void 0:null===(t=tK.neko_browser_proxy)||void 0===t?void 0:t.enabled)===e,l=null==tu?void 0:tu.startsWith("neko:proxy");return(0,n.jsx)("button",{onClick:()=>void s6(e),disabled:l,className:"rounded-md px-2.5 py-1.5 transition disabled:opacity-40 ".concat(s?"light"===e4?"bg-white text-cyan-800 shadow-sm":"bg-cyan-500/25 text-cyan-100 ring-1 ring-cyan-400/25":"light"===e4?"text-slate-600 hover:bg-white/60":"text-zinc-300 hover:bg-white/10"),children:e?sE("开启","On"):sE("关闭","Off")},e?"on":"off")})}),(0,n.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[11px] ".concat("light"===e4?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:[sE("当前","Current"),": ",(null==tK?void 0:null===(ej=tK.neko_browser_proxy)||void 0===ej?void 0:ej.resolved_proxy)||sE("直连","direct")]}),(0,n.jsxs)("p",{children:[sE("节点","Node"),": ",(null==tK?void 0:null===(eN=tK.neko_browser_proxy)||void 0===eN?void 0:eN.shellcrash_node)||"-"," \xb7 :",(null==tK?void 0:null===(ek=tK.neko_browser_proxy)||void 0===ek?void 0:ek.shellcrash_port)||"7894"]})]})]}),((null==tK?void 0:null===(e_=tK.neko_access)||void 0===e_?void 0:e_.remote_urls)||[]).length?(0,n.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:((null==tK?void 0:null===(eS=tK.neko_access)||void 0===eS?void 0:eS.remote_urls)||[]).slice(0,4).map(e=>(0,n.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"===e4?"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]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===e4?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===e4?"text-slate-500":"text-zinc-500"),children:"Google / Douyin"}),(0,n.jsx)("div",{className:"mt-2 space-y-2",children:["google","youtube","douyin"].map(e=>{let t=((null==tG?void 0:tG.direct)||[]).find(t=>t.target===e),s=!!(null==t?void 0:t.ok),l=!t,i=tJ&&l,r=(null==t?void 0:t.label)||("google"===e?"Google":"youtube"===e?"YouTube":"Douyin");return(0,n.jsxs)("div",{className:"rounded-lg border px-3 py-2 text-xs ".concat("light"===e4?"border-slate-200 bg-white text-slate-700":"border-white/10 bg-zinc-950/60 text-zinc-200"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"font-semibold",children:r}),(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat(i?"bg-cyan-500/15 text-cyan-100 ring-1 ring-cyan-500/25":l?"bg-zinc-500/15 text-zinc-300 ring-1 ring-zinc-500/25":s?"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-500/25":"bg-rose-500/15 text-rose-200 ring-1 ring-rose-500/25"),children:[i?(0,n.jsx)(y.Z,{className:"h-3 w-3 animate-spin"}):null,i?sE("探测中","Probing"):l?sE("等待结果","Waiting"):s?"OK":"FAIL"]})]}),(0,n.jsxs)("p",{className:"mt-1 font-mono text-[10px] ".concat("light"===e4?"text-slate-500":"text-zinc-500"),children:[(null==t?void 0:t.elapsed_ms)!=null?"".concat(t.elapsed_ms," ms"):i?sE("正在连接 ".concat(r,"..."),"Connecting ".concat(r,"...")):sE("等待探测结果","Waiting for probe result"),(null==t?void 0:t.status)?" \xb7 HTTP ".concat(t.status):""]}),!s&&(null==t?void 0:t.error)?(0,n.jsx)("p",{className:"mt-1 line-clamp-2 text-[10px] text-amber-200/80",children:t.error}):null]},e)})}),(0,n.jsxs)("div",{className:"mt-3 space-y-1 font-mono text-[11px] ".concat("light"===e4?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["Mode: ",tJ?sE("正在探测直连链路与代理链路","Probing direct/proxy paths"):(null==tG?void 0:tG.mode)||"-"]}),(0,n.jsxs)("p",{children:["ShellCrash: ",(null==tG?void 0:null===(ez=tG.shellcrash)||void 0===ez?void 0:ez.running)?"running:".concat((null==tG?void 0:null===(eC=tG.shellcrash)||void 0===eC?void 0:eC.mixed_port)||"7890"):"manual/stopped"]}),(0,n.jsxs)("p",{children:["Autostart: ",(null==tG?void 0:null===(eR=tG.shellcrash_policy)||void 0===eR?void 0:eR.autostart_on_direct_fail)?"on direct fail":"off"]}),(0,n.jsxs)("p",{children:["Neko attach: ",(null==tG?void 0:null===(eL=tG.shellcrash_policy)||void 0===eL?void 0:eL.attach_neko)||"auto"]}),(0,n.jsxs)("p",{children:["Neko proxy switch: ",(null==tG?void 0:null===(eP=tG.shellcrash_policy)||void 0===eP?void 0:eP.enable_neko_browser_proxy)?"on":"off"]})]}),tJ?(0,n.jsxs)("p",{className:"mt-3 inline-flex items-center gap-2 text-xs ".concat("light"===e4?"text-cyan-700":"text-cyan-200"),children:[(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}),sE("正在探测 Google / YouTube / Douyin,请等待结果返回。","Probing Google / YouTube / Douyin. Waiting for results.")]}):(null==tG?void 0:tG.summary)?(0,n.jsx)("p",{className:"mt-3 text-xs ".concat("light"===e4?"text-slate-600":"text-zinc-500"),children:tG.summary}):null]})]}),(null==tK?void 0:null===(eM=tK.recommendations)||void 0===eM?void 0:eM.length)?(0,n.jsx)("div",{className:"mt-3 rounded-xl border px-4 py-3 text-xs ".concat("light"===e4?"border-amber-200 bg-amber-50 text-amber-800":"border-amber-400/20 bg-amber-500/10 text-amber-100"),children:(tK.recommendations||[]).join(" \xb7 ")}):null,(null==tK?void 0:null===(eE=tK.quality)||void 0===eE?void 0:null===(eT=eE.reasons)||void 0===eT?void 0:eT.length)?(0,n.jsx)("div",{className:"mt-3 rounded-xl border px-4 py-3 text-xs ".concat("light"===e4?"border-slate-200 bg-white text-slate-700":"border-white/10 bg-black/25 text-zinc-300"),children:(tK.quality.reasons||[]).slice(0,4).join(" \xb7 ")}):null,(0,n.jsxs)("div",{className:"mt-5 grid gap-4 lg:grid-cols-[minmax(0,1fr)_22rem]",children:[(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[14rem_minmax(0,1fr)]",children:[(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:sE("配置名","Config name")}),(0,n.jsx)("input",{value:tA,onChange:e=>tO(e.target.value),className:"mt-1 w-full rounded-lg border px-3 py-2 text-sm outline-none ".concat("light"===e4?"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,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:sE("配置文件","Config file")}),(0,n.jsx)("input",{type:"file",accept:".conf,.txt,text/plain",onChange:e=>{var t;s7(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"===e4?"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,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-xl border px-3 py-2 ".concat("light"===e4?"border-slate-200 bg-slate-50":"border-white/10 bg-black/25"),children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:sE("保存模式","Save mode")}),["overlay","preserve"].map(e=>(0,n.jsx)("button",{onClick:()=>t0(e),className:"rounded-md px-2.5 py-1 text-[11px] font-semibold transition ".concat(tQ===e?"bg-cyan-500/20 text-cyan-100 ring-1 ring-cyan-400/30":"light"===e4?"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?sE("组网不接管默认路由","Overlay only"):sE("保留原路由","Preserve routes")},e)),(0,n.jsx)("button",{onClick:()=>tX(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"===e4?"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:t$?sE("锁定","Lock"):sE("编辑","Edit")}),(0,n.jsxs)("button",{onClick:()=>void s3(!1),disabled:"wg:save"===tu,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"===tu?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(P.Z,{className:"h-3.5 w-3.5"}),sE("保存","Save")]}),(0,n.jsxs)("button",{onClick:()=>void s3(!0),disabled:"wg:apply"===tu,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"===tu?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(o.Z,{className:"h-3.5 w-3.5"}),sE("保存并应用","Save & apply")]})]}),(0,n.jsx)("textarea",{value:tB,onChange:e=>tF(e.target.value),readOnly:!t$,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"===e4?"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(t$?"":"opacity-75")}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{onClick:()=>void s8(),disabled:"wg:save"===tu,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"===tu?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(P.Z,{className:"h-3.5 w-3.5"}),sE("解析并保存","Parse & save")]}),(null==tW?void 0:tW.redacted_config)?(0,n.jsxs)("button",{onClick:()=>nx(tW.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,n.jsx)(M.Z,{className:"h-3.5 w-3.5"}),sE("复制脱敏配置","Copy redacted")]}):null]})]}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===e4?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("p",{className:"text-xs font-semibold ".concat("light"===e4?"text-slate-900":"text-white"),children:sE("解析结果","Parsed config")}),(0,n.jsxs)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat("light"===e4?"bg-cyan-100 text-cyan-800":"bg-cyan-500/15 text-cyan-200"),children:[null!==(e0=null==tW?void 0:tW.peer_count)&&void 0!==e0?e0:0," peers"]})]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2 font-mono text-[11px] ".concat("light"===e4?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["Address: ",((null==tW?void 0:null===(eU=tW.interface)||void 0===eU?void 0:eU.addresses)||[]).join(", ")||"—"]}),(0,n.jsxs)("p",{children:["Endpoint: ",(null==tW?void 0:null===(eI=tW.peers)||void 0===eI?void 0:null===(eZ=eI[0])||void 0===eZ?void 0:eZ.endpoint)||"—"]}),(0,n.jsxs)("p",{children:["AllowedIPs: ",((null==tW?void 0:null===(eA=tW.peers)||void 0===eA?void 0:null===(eD=eA[0])||void 0===eD?void 0:eD.allowed_ips)||[]).join(", ")||"—"]}),(0,n.jsxs)("p",{children:["MTU: ",null!==(e1=null==tW?void 0:null===(eO=tW.interface)||void 0===eO?void 0:eO.mtu)&&void 0!==e1?e1:"—"]})]}),(null==tW?void 0:null===(eB=tW.warnings)||void 0===eB?void 0:eB.length)?(0,n.jsx)("ul",{className:"mt-3 space-y-1 text-[11px] ".concat("light"===e4?"text-amber-700":"text-amber-200"),children:tW.warnings.map(e=>(0,n.jsx)("li",{children:e},e))}):null]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===e4?"border-slate-200 bg-white":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-xs font-semibold ".concat("light"===e4?"text-slate-900":"text-white"),children:sE("已保存配置","Saved configs")}),(0,n.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:((null==tK?void 0:tK.repo_configs)||[]).length?((null==tK?void 0:tK.repo_configs)||[]).map(e=>(0,n.jsx)("button",{onClick:()=>void s9(e.name),className:"rounded-lg px-3 py-1.5 text-[11px] font-semibold ring-1 transition ".concat("light"===e4?"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,n.jsx)("span",{className:"text-[11px] ".concat("light"===e4?"text-slate-500":"text-zinc-500"),children:sE("暂无受管配置","No managed configs")})})]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===e4?"border-slate-200 bg-white":"border-white/10 bg-black/30"),children:[(0,n.jsxs)("p",{className:"flex items-center gap-2 text-xs font-semibold ".concat("light"===e4?"text-slate-900":"text-white"),children:[(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"}),sE("Windows 端点路由","Windows endpoint route")]}),(0,n.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-2 lg:grid-cols-1",children:[(0,n.jsx)("input",{value:t1,onChange:e=>t5(e.target.value),placeholder:sE("网关,如 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"===e4?"border-slate-200 bg-slate-50 text-slate-900":"border-white/10 bg-black/35 text-zinc-100")}),(0,n.jsx)("input",{value:t2,onChange:e=>t3(e.target.value),placeholder:sE("接口 ifIndex,如 21","Interface ifIndex, e.g. 21"),className:"rounded-lg border px-3 py-2 text-xs outline-none ".concat("light"===e4?"border-slate-200 bg-slate-50 text-slate-900":"border-white/10 bg-black/35 text-zinc-100")})]}),(0,n.jsx)("code",{className:"mt-3 block break-all rounded-lg border p-3 text-[11px] ".concat("light"===e4?"border-slate-200 bg-slate-50 text-slate-800":"border-white/10 bg-black/40 text-zinc-200"),children:s1||"route -p add mask 255.255.255.255 metric 1 if "}),(0,n.jsxs)("button",{onClick:()=>nx(s1),disabled:!s1,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,n.jsx)(M.Z,{className:"h-3.5 w-3.5"}),sE("复制命令","Copy command")]})]})]})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border p-6 ".concat("light"===e4?"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,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===e4?"text-slate-900":"text-white"),children:[(0,n.jsx)(E.Z,{className:"h-4 w-4 ".concat("light"===e4?"text-violet-600":"text-violet-300")}),sE("ShellCrash 网络面板","ShellCrash panel")]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:sE("透明代理与规则分流直接在本页完成,无需跳转;流媒体与其它系统服务请在「服务」页管理。","Proxy rules and YAML editing are embedded here. Use Services for SRS/Neko/Chromium, etc.")}),(0,n.jsx)("div",{className:"mt-6 flex flex-col items-center gap-4 sm:flex-row sm:justify-center",children:[{tx:sE("互联网","Internet"),c:"from-cyan-400 to-blue-500"},{tx:"ShellCrash",c:"from-violet-500 to-fuchsia-500"},{tx:sE("本机 / 安卓","Host / Android"),c:"from-emerald-400 to-teal-500"}].map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.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,n.jsx)(h.Z,{className:"hidden h-5 w-5 sm:block ".concat("light"===e4?"text-slate-400":"text-zinc-600")}):null]},e.tx))})]}),(0,n.jsx)("div",{className:"overflow-hidden rounded-2xl border shadow-xl ".concat("light"===e4?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:(0,n.jsx)("div",{className:"max-h-[min(78vh,56rem)] min-h-[22rem] overflow-y-auto overflow-x-hidden",children:(0,n.jsx)(I.d,{embeddedShellCrash:!0,portalLang:e2})})})]}):null,"settings"===e9?(0,n.jsxs)("div",{className:"mx-auto max-w-lg space-y-6",children:[(0,n.jsx)("p",{className:"text-sm ".concat("light"===e4?"text-slate-600":"text-zinc-400"),children:sE("常用选项(本机偏好);完整文件与 JSON 编辑见下方链接。","Local preferences; full file/JSON editor via the link below.")}),(0,n.jsxs)("div",{className:"space-y-4 rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,n.jsxs)("label",{className:"flex cursor-pointer items-center justify-between gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-medium text-white",children:sE("总览自动刷新","Auto-refresh dashboard")}),(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:"10s"})]}),(0,n.jsx)("input",{type:"checkbox",className:"h-5 w-5 accent-violet-500",checked:tU,onChange:e=>{let t=e.target.checked;tZ(t);try{localStorage.setItem("livehub.autorefresh",t?"1":"0")}catch(e){}sU(t?sE("已开启刷新","Auto refresh on"):sE("已暂停刷新","Paused"))}})]}),(0,n.jsxs)("label",{className:"flex cursor-pointer items-center justify-between gap-4 border-t border-white/[0.06] pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-medium text-white",children:sE("总览显示 SRS / Neko 探针","Show SRS/Neko probes")}),(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:sE("关闭可精简首页","Hide stream probe cards")})]}),(0,n.jsx)("input",{type:"checkbox",className:"h-5 w-5 accent-violet-500",checked:tI,onChange:e=>{let t=e.target.checked;tD(t);try{localStorage.setItem("livehub.showStreamProbes",t?"1":"0")}catch(e){}}})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/40 p-5",children:[(0,n.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-500",children:sE("配置快照","Config snapshot")}),(0,n.jsx)("p",{className:"mt-2 font-mono text-[11px] text-zinc-400",children:String((null==tP?void 0:tP.config_root)||"—")}),(0,n.jsxs)("p",{className:"mt-3 text-sm text-zinc-300",children:[sE("主机名","Hostname"),":"," ",(0,n.jsx)("span",{className:"font-mono text-violet-200",children:(()=>{var e,t,s;let n=null==tP?void 0:tP.system;return(null==n?void 0:null===(t=n.identity)||void 0===t?void 0:null===(e=t.hostname_alias)||void 0===e?void 0:e.trim())||((null==tl?void 0:null===(s=tl.stack)||void 0===s?void 0:s.mdns_host)||"").replace(/\.local$/i,"")||"—"})()})]}),(0,n.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:null==tP?void 0:null===(eF=tP.services)||void 0===eF?void 0:eF.slice(0,8).map(e=>(0,n.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,n.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"===e4?"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:[sE("完整配置中心(文件 / JSON)","Full config center (files / JSON)"),(0,n.jsx)(k.Z,{className:"h-4 w-4"})]})]}):null]},e9)})})]})]}),(0,n.jsx)(i.M,{children:ts?(0,n.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:()=>tn(!1),children:(0,n.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,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)("button",{type:"button",onClick:()=>tn(!1),className:"rounded-lg p-2",children:(0,n.jsx)(U.Z,{className:"h-5 w-5"})})}),(0,n.jsx)("nav",{className:"mt-4 flex flex-col gap-1",children:nu.map(e=>{let t=e.icon,s=e9===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>{e7(e.id),tn(!1)},"aria-current":s?"page":void 0,className:"flex items-center gap-3 rounded-xl px-3 py-3 text-left text-sm transition ".concat(s?"bg-white/[0.08] text-white shadow-inner shadow-white/5":"text-zinc-300 hover:bg-white/[0.04]"),children:[(0,n.jsx)(t,{className:"h-4 w-4 ".concat(s?"text-violet-300":"text-violet-400")}),sE(e.labelZh,e.labelEn)]},e.id)})})]})}):null})]})}}}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/app/page-9ff3a078ec6e16cb.js b/d2ypp2/web-console/out/_next/static/chunks/app/page-5d458b26bf02fc41.js similarity index 60% rename from d2ypp2/web-console/out/_next/static/chunks/app/page-9ff3a078ec6e16cb.js rename to d2ypp2/web-console/out/_next/static/chunks/app/page-5d458b26bf02fc41.js index 72aed23..f53512a 100644 --- a/d2ypp2/web-console/out/_next/static/chunks/app/page-9ff3a078ec6e16cb.js +++ b/d2ypp2/web-console/out/_next/static/chunks/app/page-5d458b26bf02fc41.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{2195:function(n,e,u){Promise.resolve().then(u.bind(u,7340))},7340:function(n,e,u){"use strict";u.r(e),u.d(e,{default:function(){return t.Z}});var t=u(6348)}},function(n){n.O(0,[500,568,246,348,971,117,744],function(){return n(n.s=2195)}),_N_E=n.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{2195:function(n,e,u){Promise.resolve().then(u.bind(u,7340))},7340:function(n,e,u){"use strict";u.r(e),u.d(e,{default:function(){return t.Z}});var t=u(8904)}},function(n){n.O(0,[500,568,246,904,971,117,744],function(){return n(n.s=2195)}),_N_E=n.O()}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/app/youtube-events/page-a88e6c919a0b42a9.js b/d2ypp2/web-console/out/_next/static/chunks/app/youtube-events/page-d361f3631be60b8a.js similarity index 61% rename from d2ypp2/web-console/out/_next/static/chunks/app/youtube-events/page-a88e6c919a0b42a9.js rename to d2ypp2/web-console/out/_next/static/chunks/app/youtube-events/page-d361f3631be60b8a.js index 04d3048..cdbcb51 100644 --- a/d2ypp2/web-console/out/_next/static/chunks/app/youtube-events/page-a88e6c919a0b42a9.js +++ b/d2ypp2/web-console/out/_next/static/chunks/app/youtube-events/page-d361f3631be60b8a.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[851],{8797:function(n,e,u){Promise.resolve().then(u.bind(u,316))},316:function(n,e,u){"use strict";u.r(e),u.d(e,{default:function(){return t.Z}});var t=u(6348)}},function(n){n.O(0,[500,568,246,348,971,117,744],function(){return n(n.s=8797)}),_N_E=n.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[851],{8797:function(n,e,u){Promise.resolve().then(u.bind(u,316))},316:function(n,e,u){"use strict";u.r(e),u.d(e,{default:function(){return t.Z}});var t=u(8904)}},function(n){n.O(0,[500,568,246,904,971,117,744],function(){return n(n.s=8797)}),_N_E=n.O()}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/css/267c3a238bcbe8cf.css b/d2ypp2/web-console/out/_next/static/css/267c3a238bcbe8cf.css deleted file mode 100644 index 518b83c..0000000 --- a/d2ypp2/web-console/out/_next/static/css/267c3a238bcbe8cf.css +++ /dev/null @@ -1,3 +0,0 @@ -@font-face{font-family:__geistSans_1e4310;src:url(/_next/static/media/4473ecc91f70f139-s.p.woff) format("woff");font-display:swap;font-weight:100 900}@font-face{font-family:__geistSans_Fallback_1e4310;src:local("Arial");ascent-override:85.83%;descent-override:20.52%;line-gap-override:9.33%;size-adjust:107.19%}.__className_1e4310{font-family:__geistSans_1e4310,__geistSans_Fallback_1e4310}.__variable_1e4310{--font-geist-sans:"__geistSans_1e4310","__geistSans_Fallback_1e4310"}@font-face{font-family:__geistMono_c3aa02;src:url(/_next/static/media/463dafcda517f24f-s.p.woff) format("woff");font-display:swap;font-weight:100 900}@font-face{font-family:__geistMono_Fallback_c3aa02;src:local("Arial");ascent-override:69.97%;descent-override:16.73%;line-gap-override:7.61%;size-adjust:131.49%}.__className_c3aa02{font-family:__geistMono_c3aa02,__geistMono_Fallback_c3aa02}.__variable_c3aa02{--font-geist-mono:"__geistMono_c3aa02","__geistMono_Fallback_c3aa02"}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/* -! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com -*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media (min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media (min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media (min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media (min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media (min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.-bottom-0\.5{bottom:-.125rem}.-bottom-10{bottom:-2.5rem}.-left-1\/4{left:-25%}.-right-0\.5{right:-.125rem}.-right-20{right:-5rem}.-right-8{right:-2rem}.-top-0\.5{top:-.125rem}.-top-20{top:-5rem}.-top-8{top:-2rem}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-24{bottom:6rem}.bottom-3{bottom:.75rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.left-1\/2{left:50%}.left-1\/3{left:33.333333%}.right-0{right:0}.right-2{right:.5rem}.right-3{right:.75rem}.top-0{top:0}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.col-span-2{grid-column:span 2/span 2}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-10{margin-top:2.5rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{-webkit-line-clamp:1}.line-clamp-1,.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical}.line-clamp-2{-webkit-line-clamp:2}.line-clamp-3{-webkit-line-clamp:3}.line-clamp-3,.line-clamp-4{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical}.line-clamp-4{-webkit-line-clamp:4}.line-clamp-6{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:6}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-28{height:7rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-36{height:9rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-52{height:13rem}.h-56{height:14rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-72{height:18rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[168px\]{height:168px}.h-\[248px\]{height:248px}.h-\[30rem\]{height:30rem}.h-\[36rem\]{height:36rem}.h-\[42rem\]{height:42rem}.h-\[min\(72vh\2c 40rem\)\]{height:min(72vh,40rem)}.h-full{height:100%}.max-h-40{max-height:10rem}.max-h-48{max-height:12rem}.max-h-52{max-height:13rem}.max-h-64{max-height:16rem}.max-h-72{max-height:18rem}.max-h-\[28rem\]{max-height:28rem}.max-h-\[min\(22rem\2c 42vh\)\]{max-height:min(22rem,42vh)}.max-h-\[min\(24rem\2c 55vh\)\]{max-height:min(24rem,55vh)}.max-h-\[min\(70vh\2c 48rem\)\]{max-height:min(70vh,48rem)}.max-h-\[min\(72vh\2c 680px\)\]{max-height:min(72vh,680px)}.max-h-\[min\(78vh\2c 56rem\)\]{max-height:min(78vh,56rem)}.max-h-\[min\(78vh\2c 720px\)\]{max-height:min(78vh,720px)}.min-h-0{min-height:0}.min-h-16{min-height:4rem}.min-h-24{min-height:6rem}.min-h-56{min-height:14rem}.min-h-\[100px\]{min-height:100px}.min-h-\[12rem\]{min-height:12rem}.min-h-\[14rem\]{min-height:14rem}.min-h-\[160px\]{min-height:160px}.min-h-\[18rem\]{min-height:18rem}.min-h-\[2\.5rem\]{min-height:2.5rem}.min-h-\[2\.75rem\]{min-height:2.75rem}.min-h-\[200px\]{min-height:200px}.min-h-\[22rem\]{min-height:22rem}.min-h-\[24rem\]{min-height:24rem}.min-h-\[280px\]{min-height:280px}.min-h-\[2rem\]{min-height:2rem}.min-h-\[32rem\]{min-height:32rem}.min-h-\[3rem\]{min-height:3rem}.min-h-\[4rem\]{min-height:4rem}.min-h-\[6rem\]{min-height:6rem}.min-h-\[72px\]{min-height:72px}.min-h-screen{min-height:100vh}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[36rem\]{width:36rem}.w-\[42rem\]{width:42rem}.w-\[min\(88vw\2c 280px\)\]{width:min(88vw,280px)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.min-w-0{min-width:0}.min-w-\[12rem\]{min-width:12rem}.min-w-\[1rem\]{min-width:1rem}.min-w-\[3\.75rem\]{min-width:3.75rem}.min-w-\[6rem\]{min-width:6rem}.min-w-\[7rem\]{min-width:7rem}.min-w-\[9rem\]{min-width:9rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[min\(92vw\2c 28rem\)\]{max-width:min(92vw,28rem)}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.origin-center{transform-origin:center}.-translate-x-1\/2{--tw-translate-x:-50%}.-rotate-90,.-translate-x-1\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate:-90deg}.rotate-180{--tw-rotate:180deg}.rotate-180,.rotate-90{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate:90deg}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-crosshair{cursor:crosshair}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize-y{resize:vertical}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-around{justify-content:space-around}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-x-2{column-gap:.5rem}.gap-y-0\.5{row-gap:.125rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-white\/\[0\.06\]>:not([hidden])~:not([hidden]){border-color:hsla(0,0%,100%,.06)}.self-start{align-self:flex-start}.self-center{align-self:center}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[1\.35rem\]{border-radius:1.35rem}.rounded-\[2rem\]{border-radius:2rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-b-xl{border-bottom-right-radius:.75rem;border-bottom-left-radius:.75rem}.border{border-width:1px}.border-\[10px\]{border-width:10px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-amber-200{--tw-border-opacity:1;border-color:rgb(253 230 138/var(--tw-border-opacity,1))}.border-amber-400\/20{border-color:rgba(251,191,36,.2)}.border-amber-400\/50{border-color:rgba(251,191,36,.5)}.border-amber-500\/15{border-color:rgba(245,158,11,.15)}.border-amber-500\/20{border-color:rgba(245,158,11,.2)}.border-amber-500\/25{border-color:rgba(245,158,11,.25)}.border-amber-500\/30{border-color:rgba(245,158,11,.3)}.border-cyan-100{--tw-border-opacity:1;border-color:rgb(207 250 254/var(--tw-border-opacity,1))}.border-cyan-200{--tw-border-opacity:1;border-color:rgb(165 243 252/var(--tw-border-opacity,1))}.border-cyan-200\/70{border-color:rgba(165,243,252,.7)}.border-cyan-200\/90{border-color:rgba(165,243,252,.9)}.border-cyan-400\/15{border-color:rgba(34,211,238,.15)}.border-cyan-400\/20{border-color:rgba(34,211,238,.2)}.border-cyan-400\/50{border-color:rgba(34,211,238,.5)}.border-cyan-500\/15{border-color:rgba(6,182,212,.15)}.border-cyan-500\/20{border-color:rgba(6,182,212,.2)}.border-cyan-500\/25{border-color:rgba(6,182,212,.25)}.border-cyan-500\/30{border-color:rgba(6,182,212,.3)}.border-cyan-500\/40{border-color:rgba(6,182,212,.4)}.border-cyan-500\/50{border-color:rgba(6,182,212,.5)}.border-emerald-400\/30{border-color:rgba(52,211,153,.3)}.border-emerald-500\/15{border-color:rgba(16,185,129,.15)}.border-emerald-500\/20{border-color:rgba(16,185,129,.2)}.border-emerald-500\/25{border-color:rgba(16,185,129,.25)}.border-emerald-500\/30{border-color:rgba(16,185,129,.3)}.border-emerald-500\/50{border-color:rgba(16,185,129,.5)}.border-fuchsia-200\/80{border-color:rgba(245,208,254,.8)}.border-fuchsia-400\/20{border-color:rgba(232,121,249,.2)}.border-fuchsia-400\/30{border-color:rgba(232,121,249,.3)}.border-fuchsia-500\/20{border-color:rgba(217,70,239,.2)}.border-fuchsia-500\/30{border-color:rgba(217,70,239,.3)}.border-indigo-400\/50{border-color:rgba(129,140,248,.5)}.border-rose-500\/15{border-color:rgba(244,63,94,.15)}.border-rose-500\/20{border-color:rgba(244,63,94,.2)}.border-rose-500\/25{border-color:rgba(244,63,94,.25)}.border-rose-500\/30{border-color:rgba(244,63,94,.3)}.border-sky-400\/20{border-color:rgba(56,189,248,.2)}.border-sky-500\/20{border-color:rgba(14,165,233,.2)}.border-slate-200{--tw-border-opacity:1;border-color:rgb(226 232 240/var(--tw-border-opacity,1))}.border-slate-200\/80{border-color:rgba(226,232,240,.8)}.border-slate-200\/90{border-color:rgba(226,232,240,.9)}.border-slate-500\/30{border-color:rgba(100,116,139,.3)}.border-slate-700\/30{border-color:rgba(51,65,85,.3)}.border-violet-200\/70{border-color:rgba(221,214,254,.7)}.border-violet-200\/80{border-color:rgba(221,214,254,.8)}.border-violet-200\/90{border-color:rgba(221,214,254,.9)}.border-violet-500\/15{border-color:rgba(139,92,246,.15)}.border-violet-500\/20{border-color:rgba(139,92,246,.2)}.border-violet-500\/25{border-color:rgba(139,92,246,.25)}.border-violet-500\/30{border-color:rgba(139,92,246,.3)}.border-violet-500\/35{border-color:rgba(139,92,246,.35)}.border-violet-500\/45{border-color:rgba(139,92,246,.45)}.border-violet-500\/50{border-color:rgba(139,92,246,.5)}.border-white\/10{border-color:hsla(0,0%,100%,.1)}.border-white\/15{border-color:hsla(0,0%,100%,.15)}.border-white\/20{border-color:hsla(0,0%,100%,.2)}.border-white\/5{border-color:hsla(0,0%,100%,.05)}.border-white\/\[0\.04\]{border-color:hsla(0,0%,100%,.04)}.border-white\/\[0\.05\]{border-color:hsla(0,0%,100%,.05)}.border-white\/\[0\.06\]{border-color:hsla(0,0%,100%,.06)}.border-white\/\[0\.07\]{border-color:hsla(0,0%,100%,.07)}.border-white\/\[0\.08\]{border-color:hsla(0,0%,100%,.08)}.border-zinc-800{--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.bg-\[\#050508\]{--tw-bg-opacity:1;background-color:rgb(5 5 8/var(--tw-bg-opacity,1))}.bg-amber-50{--tw-bg-opacity:1;background-color:rgb(255 251 235/var(--tw-bg-opacity,1))}.bg-amber-500\/10{background-color:rgba(245,158,11,.1)}.bg-amber-500\/15{background-color:rgba(245,158,11,.15)}.bg-amber-500\/20{background-color:rgba(245,158,11,.2)}.bg-amber-500\/5{background-color:rgba(245,158,11,.05)}.bg-amber-500\/\[0\.06\]{background-color:rgba(245,158,11,.06)}.bg-amber-500\/\[0\.08\]{background-color:rgba(245,158,11,.08)}.bg-amber-600{--tw-bg-opacity:1;background-color:rgb(217 119 6/var(--tw-bg-opacity,1))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-black\/10{background-color:rgba(0,0,0,.1)}.bg-black\/20{background-color:rgba(0,0,0,.2)}.bg-black\/25{background-color:rgba(0,0,0,.25)}.bg-black\/30{background-color:rgba(0,0,0,.3)}.bg-black\/35{background-color:rgba(0,0,0,.35)}.bg-black\/40{background-color:rgba(0,0,0,.4)}.bg-black\/45{background-color:rgba(0,0,0,.45)}.bg-black\/5{background-color:rgba(0,0,0,.05)}.bg-black\/50{background-color:rgba(0,0,0,.5)}.bg-black\/55{background-color:rgba(0,0,0,.55)}.bg-black\/60{background-color:rgba(0,0,0,.6)}.bg-black\/75{background-color:rgba(0,0,0,.75)}.bg-black\/80{background-color:rgba(0,0,0,.8)}.bg-cyan-100{--tw-bg-opacity:1;background-color:rgb(207 250 254/var(--tw-bg-opacity,1))}.bg-cyan-400\/10{background-color:rgba(34,211,238,.1)}.bg-cyan-50{--tw-bg-opacity:1;background-color:rgb(236 254 255/var(--tw-bg-opacity,1))}.bg-cyan-500\/10{background-color:rgba(6,182,212,.1)}.bg-cyan-500\/15{background-color:rgba(6,182,212,.15)}.bg-cyan-500\/20{background-color:rgba(6,182,212,.2)}.bg-cyan-500\/25{background-color:rgba(6,182,212,.25)}.bg-cyan-500\/30{background-color:rgba(6,182,212,.3)}.bg-cyan-500\/90{background-color:rgba(6,182,212,.9)}.bg-cyan-500\/\[0\.05\]{background-color:rgba(6,182,212,.05)}.bg-cyan-500\/\[0\.06\]{background-color:rgba(6,182,212,.06)}.bg-cyan-500\/\[0\.08\]{background-color:rgba(6,182,212,.08)}.bg-cyan-600{--tw-bg-opacity:1;background-color:rgb(8 145 178/var(--tw-bg-opacity,1))}.bg-cyan-600\/80{background-color:rgba(8,145,178,.8)}.bg-emerald-400{--tw-bg-opacity:1;background-color:rgb(52 211 153/var(--tw-bg-opacity,1))}.bg-emerald-50{--tw-bg-opacity:1;background-color:rgb(236 253 245/var(--tw-bg-opacity,1))}.bg-emerald-500\/10{background-color:rgba(16,185,129,.1)}.bg-emerald-500\/15{background-color:rgba(16,185,129,.15)}.bg-emerald-500\/20{background-color:rgba(16,185,129,.2)}.bg-emerald-500\/90{background-color:rgba(16,185,129,.9)}.bg-emerald-600{--tw-bg-opacity:1;background-color:rgb(5 150 105/var(--tw-bg-opacity,1))}.bg-fuchsia-500\/10{background-color:rgba(217,70,239,.1)}.bg-fuchsia-500\/15{background-color:rgba(217,70,239,.15)}.bg-fuchsia-500\/20{background-color:rgba(217,70,239,.2)}.bg-indigo-500\/15{background-color:rgba(99,102,241,.15)}.bg-rose-400{--tw-bg-opacity:1;background-color:rgb(251 113 133/var(--tw-bg-opacity,1))}.bg-rose-500\/10{background-color:rgba(244,63,94,.1)}.bg-rose-500\/15{background-color:rgba(244,63,94,.15)}.bg-rose-500\/20{background-color:rgba(244,63,94,.2)}.bg-rose-500\/\[0\.10\]{background-color:rgba(244,63,94,.1)}.bg-rose-600{--tw-bg-opacity:1;background-color:rgb(225 29 72/var(--tw-bg-opacity,1))}.bg-rose-950\/20{background-color:rgba(76,5,25,.2)}.bg-rose-950\/25{background-color:rgba(76,5,25,.25)}.bg-sky-500\/10{background-color:rgba(14,165,233,.1)}.bg-sky-500\/15{background-color:rgba(14,165,233,.15)}.bg-sky-500\/25{background-color:rgba(14,165,233,.25)}.bg-sky-600{--tw-bg-opacity:1;background-color:rgb(2 132 199/var(--tw-bg-opacity,1))}.bg-slate-100{--tw-bg-opacity:1;background-color:rgb(241 245 249/var(--tw-bg-opacity,1))}.bg-slate-200\/70{background-color:rgba(226,232,240,.7)}.bg-slate-50{--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity,1))}.bg-slate-50\/80{background-color:rgba(248,250,252,.8)}.bg-slate-500\/10{background-color:rgba(100,116,139,.1)}.bg-slate-500\/15{background-color:rgba(100,116,139,.15)}.bg-slate-800\/50{background-color:rgba(30,41,59,.5)}.bg-slate-950\/30{background-color:rgba(2,6,23,.3)}.bg-slate-950\/50{background-color:rgba(2,6,23,.5)}.bg-slate-950\/60{background-color:rgba(2,6,23,.6)}.bg-slate-950\/80{background-color:rgba(2,6,23,.8)}.bg-slate-950\/95{background-color:rgba(2,6,23,.95)}.bg-violet-100{--tw-bg-opacity:1;background-color:rgb(237 233 254/var(--tw-bg-opacity,1))}.bg-violet-100\/90{background-color:rgba(237,233,254,.9)}.bg-violet-400\/15{background-color:rgba(167,139,250,.15)}.bg-violet-50{--tw-bg-opacity:1;background-color:rgb(245 243 255/var(--tw-bg-opacity,1))}.bg-violet-500\/10{background-color:rgba(139,92,246,.1)}.bg-violet-500\/15{background-color:rgba(139,92,246,.15)}.bg-violet-500\/20{background-color:rgba(139,92,246,.2)}.bg-violet-500\/25{background-color:rgba(139,92,246,.25)}.bg-violet-500\/\[0\.06\]{background-color:rgba(139,92,246,.06)}.bg-violet-500\/\[0\.1\]{background-color:rgba(139,92,246,.1)}.bg-violet-600{--tw-bg-opacity:1;background-color:rgb(124 58 237/var(--tw-bg-opacity,1))}.bg-violet-600\/20{background-color:rgba(124,58,237,.2)}.bg-violet-600\/70{background-color:rgba(124,58,237,.7)}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.bg-white\/10{background-color:hsla(0,0%,100%,.1)}.bg-white\/5{background-color:hsla(0,0%,100%,.05)}.bg-white\/70{background-color:hsla(0,0%,100%,.7)}.bg-white\/75{background-color:hsla(0,0%,100%,.75)}.bg-white\/80{background-color:hsla(0,0%,100%,.8)}.bg-white\/85{background-color:hsla(0,0%,100%,.85)}.bg-white\/90{background-color:hsla(0,0%,100%,.9)}.bg-white\/\[0\.035\]{background-color:hsla(0,0%,100%,.035)}.bg-white\/\[0\.03\]{background-color:hsla(0,0%,100%,.03)}.bg-white\/\[0\.04\]{background-color:hsla(0,0%,100%,.04)}.bg-white\/\[0\.05\]{background-color:hsla(0,0%,100%,.05)}.bg-white\/\[0\.06\]{background-color:hsla(0,0%,100%,.06)}.bg-white\/\[0\.08\]{background-color:hsla(0,0%,100%,.08)}.bg-zinc-500\/15{background-color:hsla(240,4%,46%,.15)}.bg-zinc-600\/20{background-color:rgba(82,82,91,.2)}.bg-zinc-600\/30{background-color:rgba(82,82,91,.3)}.bg-zinc-700\/40{background-color:rgba(63,63,70,.4)}.bg-zinc-700\/90{background-color:rgba(63,63,70,.9)}.bg-zinc-950{--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.bg-zinc-950\/35{background-color:rgba(9,9,11,.35)}.bg-zinc-950\/40{background-color:rgba(9,9,11,.4)}.bg-zinc-950\/50{background-color:rgba(9,9,11,.5)}.bg-zinc-950\/55{background-color:rgba(9,9,11,.55)}.bg-zinc-950\/60{background-color:rgba(9,9,11,.6)}.bg-zinc-950\/70{background-color:rgba(9,9,11,.7)}.bg-zinc-950\/80{background-color:rgba(9,9,11,.8)}.bg-zinc-950\/90{background-color:rgba(9,9,11,.9)}.bg-zinc-950\/95{background-color:rgba(9,9,11,.95)}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-amber-400{--tw-gradient-from:#fbbf24 var(--tw-gradient-from-position);--tw-gradient-to:rgba(251,191,36,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-amber-50\/90{--tw-gradient-from:rgba(255,251,235,.9) var(--tw-gradient-from-position);--tw-gradient-to:rgba(255,251,235,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-amber-500\/20{--tw-gradient-from:rgba(245,158,11,.2) var(--tw-gradient-from-position);--tw-gradient-to:rgba(245,158,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-amber-500\/35{--tw-gradient-from:rgba(245,158,11,.35) var(--tw-gradient-from-position);--tw-gradient-to:rgba(245,158,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-amber-500\/\[0\.07\]{--tw-gradient-from:rgba(245,158,11,.07) var(--tw-gradient-from-position);--tw-gradient-to:rgba(245,158,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-amber-500\/\[0\.12\]{--tw-gradient-from:rgba(245,158,11,.12) var(--tw-gradient-from-position);--tw-gradient-to:rgba(245,158,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-cyan-400{--tw-gradient-from:#22d3ee var(--tw-gradient-from-position);--tw-gradient-to:rgba(34,211,238,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-cyan-500\/20{--tw-gradient-from:rgba(6,182,212,.2) var(--tw-gradient-from-position);--tw-gradient-to:rgba(6,182,212,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-cyan-500\/35{--tw-gradient-from:rgba(6,182,212,.35) var(--tw-gradient-from-position);--tw-gradient-to:rgba(6,182,212,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-cyan-500\/\[0\.08\]{--tw-gradient-from:rgba(6,182,212,.08) var(--tw-gradient-from-position);--tw-gradient-to:rgba(6,182,212,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-cyan-500\/\[0\.14\]{--tw-gradient-from:rgba(6,182,212,.14) var(--tw-gradient-from-position);--tw-gradient-to:rgba(6,182,212,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-cyan-500\/\[0\.1\]{--tw-gradient-from:rgba(6,182,212,.1) var(--tw-gradient-from-position);--tw-gradient-to:rgba(6,182,212,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-emerald-400{--tw-gradient-from:#34d399 var(--tw-gradient-from-position);--tw-gradient-to:rgba(52,211,153,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-emerald-400\/30{--tw-gradient-from:rgba(52,211,153,.3) var(--tw-gradient-from-position);--tw-gradient-to:rgba(52,211,153,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-emerald-500\/20{--tw-gradient-from:rgba(16,185,129,.2) var(--tw-gradient-from-position);--tw-gradient-to:rgba(16,185,129,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-emerald-500\/\[0\.07\]{--tw-gradient-from:rgba(16,185,129,.07) var(--tw-gradient-from-position);--tw-gradient-to:rgba(16,185,129,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-emerald-500\/\[0\.08\]{--tw-gradient-from:rgba(16,185,129,.08) var(--tw-gradient-from-position);--tw-gradient-to:rgba(16,185,129,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-emerald-500\/\[0\.12\]{--tw-gradient-from:rgba(16,185,129,.12) var(--tw-gradient-from-position);--tw-gradient-to:rgba(16,185,129,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-fuchsia-50\/90{--tw-gradient-from:rgba(253,244,255,.9) var(--tw-gradient-from-position);--tw-gradient-to:rgba(253,244,255,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-fuchsia-500\/10{--tw-gradient-from:rgba(217,70,239,.1) var(--tw-gradient-from-position);--tw-gradient-to:rgba(217,70,239,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-fuchsia-500\/20{--tw-gradient-from:rgba(217,70,239,.2) var(--tw-gradient-from-position);--tw-gradient-to:rgba(217,70,239,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-fuchsia-950\/40{--tw-gradient-from:rgba(74,4,78,.4) var(--tw-gradient-from-position);--tw-gradient-to:rgba(74,4,78,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-indigo-500\/20{--tw-gradient-from:rgba(99,102,241,.2) var(--tw-gradient-from-position);--tw-gradient-to:rgba(99,102,241,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-pink-500\/25{--tw-gradient-from:rgba(236,72,153,.25) var(--tw-gradient-from-position);--tw-gradient-to:rgba(236,72,153,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-red-500\/30{--tw-gradient-from:rgba(239,68,68,.3) var(--tw-gradient-from-position);--tw-gradient-to:rgba(239,68,68,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-rose-500\/20{--tw-gradient-from:rgba(244,63,94,.2) var(--tw-gradient-from-position);--tw-gradient-to:rgba(244,63,94,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-sky-500\/\[0\.08\]{--tw-gradient-from:rgba(14,165,233,.08) var(--tw-gradient-from-position);--tw-gradient-to:rgba(14,165,233,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-violet-50{--tw-gradient-from:#f5f3ff var(--tw-gradient-from-position);--tw-gradient-to:rgba(245,243,255,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-violet-500{--tw-gradient-from:#8b5cf6 var(--tw-gradient-from-position);--tw-gradient-to:rgba(139,92,246,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-violet-500\/10{--tw-gradient-from:rgba(139,92,246,.1) var(--tw-gradient-from-position);--tw-gradient-to:rgba(139,92,246,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-violet-500\/\[0\.08\]{--tw-gradient-from:rgba(139,92,246,.08) var(--tw-gradient-from-position);--tw-gradient-to:rgba(139,92,246,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-violet-500\/\[0\.12\]{--tw-gradient-from:rgba(139,92,246,.12) var(--tw-gradient-from-position);--tw-gradient-to:rgba(139,92,246,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-violet-600\/10{--tw-gradient-from:rgba(124,58,237,.1) var(--tw-gradient-from-position);--tw-gradient-to:rgba(124,58,237,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-white\/\[0\.05\]{--tw-gradient-from:hsla(0,0%,100%,.05) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-white\/\[0\.06\]{--tw-gradient-from:hsla(0,0%,100%,.06) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-zinc-950\/95{--tw-gradient-from:rgba(9,9,11,.95) var(--tw-gradient-from-position);--tw-gradient-to:rgba(9,9,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.via-black\/25{--tw-gradient-to:transparent var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),rgba(0,0,0,.25) var(--tw-gradient-via-position),var(--tw-gradient-to)}.via-white{--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),#fff var(--tw-gradient-via-position),var(--tw-gradient-to)}.via-zinc-950\/40{--tw-gradient-to:rgba(9,9,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),rgba(9,9,11,.4) var(--tw-gradient-via-position),var(--tw-gradient-to)}.via-zinc-950\/50{--tw-gradient-to:rgba(9,9,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),rgba(9,9,11,.5) var(--tw-gradient-via-position),var(--tw-gradient-to)}.via-zinc-950\/60{--tw-gradient-to:rgba(9,9,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),rgba(9,9,11,.6) var(--tw-gradient-via-position),var(--tw-gradient-to)}.via-zinc-950\/80{--tw-gradient-to:rgba(9,9,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),rgba(9,9,11,.8) var(--tw-gradient-via-position),var(--tw-gradient-to)}.via-zinc-950\/90{--tw-gradient-to:rgba(9,9,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),rgba(9,9,11,.9) var(--tw-gradient-via-position),var(--tw-gradient-to)}.to-black\/40{--tw-gradient-to:rgba(0,0,0,.4) var(--tw-gradient-to-position)}.to-blue-500{--tw-gradient-to:#3b82f6 var(--tw-gradient-to-position)}.to-cyan-400{--tw-gradient-to:#22d3ee var(--tw-gradient-to-position)}.to-cyan-50{--tw-gradient-to:#ecfeff var(--tw-gradient-to-position)}.to-cyan-50\/70{--tw-gradient-to:rgba(236,254,255,.7) var(--tw-gradient-to-position)}.to-cyan-500\/10{--tw-gradient-to:rgba(6,182,212,.1) var(--tw-gradient-to-position)}.to-cyan-500\/5{--tw-gradient-to:rgba(6,182,212,.05) var(--tw-gradient-to-position)}.to-cyan-500\/\[0\.06\]{--tw-gradient-to:rgba(6,182,212,.06) var(--tw-gradient-to-position)}.to-cyan-950\/20{--tw-gradient-to:rgba(8,51,68,.2) var(--tw-gradient-to-position)}.to-emerald-500\/\[0\.05\]{--tw-gradient-to:rgba(16,185,129,.05) var(--tw-gradient-to-position)}.to-fuchsia-50\/80{--tw-gradient-to:rgba(253,244,255,.8) var(--tw-gradient-to-position)}.to-fuchsia-500{--tw-gradient-to:#d946ef var(--tw-gradient-to-position)}.to-fuchsia-500\/10{--tw-gradient-to:rgba(217,70,239,.1) var(--tw-gradient-to-position)}.to-fuchsia-500\/5{--tw-gradient-to:rgba(217,70,239,.05) var(--tw-gradient-to-position)}.to-fuchsia-600\/25{--tw-gradient-to:rgba(192,38,211,.25) var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to:#f97316 var(--tw-gradient-to-position)}.to-orange-500\/10{--tw-gradient-to:rgba(249,115,22,.1) var(--tw-gradient-to-position)}.to-pink-500\/10{--tw-gradient-to:rgba(236,72,153,.1) var(--tw-gradient-to-position)}.to-sky-500\/10{--tw-gradient-to:rgba(14,165,233,.1) var(--tw-gradient-to-position)}.to-slate-50{--tw-gradient-to:#f8fafc var(--tw-gradient-to-position)}.to-teal-500{--tw-gradient-to:#14b8a6 var(--tw-gradient-to-position)}.to-teal-500\/10{--tw-gradient-to:rgba(20,184,166,.1) var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to:transparent var(--tw-gradient-to-position)}.to-violet-500\/10{--tw-gradient-to:rgba(139,92,246,.1) var(--tw-gradient-to-position)}.to-violet-500\/25{--tw-gradient-to:rgba(139,92,246,.25) var(--tw-gradient-to-position)}.to-violet-500\/\[0\.06\]{--tw-gradient-to:rgba(139,92,246,.06) var(--tw-gradient-to-position)}.to-violet-500\/\[0\.08\]{--tw-gradient-to:rgba(139,92,246,.08) var(--tw-gradient-to-position)}.to-violet-600\/25{--tw-gradient-to:rgba(124,58,237,.25) var(--tw-gradient-to-position)}.to-violet-600\/30{--tw-gradient-to:rgba(124,58,237,.3) var(--tw-gradient-to-position)}.to-zinc-900\/90{--tw-gradient-to:rgba(24,24,27,.9) var(--tw-gradient-to-position)}.to-zinc-950\/80{--tw-gradient-to:rgba(9,9,11,.8) var(--tw-gradient-to-position)}.fill-zinc-400{fill:#a1a1aa}.stroke-amber-400{stroke:#fbbf24}.stroke-cyan-400{stroke:#22d3ee}.stroke-rose-400{stroke:#fb7185}.stroke-white\/10{stroke:hsla(0,0%,100%,.1)}.object-contain{object-fit:contain}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-1{padding-bottom:.25rem}.pb-16{padding-bottom:4rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-5{padding-left:1.25rem}.pr-1{padding-right:.25rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-\[0\.22em\]{letter-spacing:.22em}.tracking-\[0\.2em\]{letter-spacing:.2em}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[color\:var\(--text\)\]{color:var(--text)}.text-amber-100{--tw-text-opacity:1;color:rgb(254 243 199/var(--tw-text-opacity,1))}.text-amber-100\/80{color:hsla(48,96%,89%,.8)}.text-amber-100\/85{color:hsla(48,96%,89%,.85)}.text-amber-200{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}.text-amber-200\/80{color:hsla(48,97%,77%,.8)}.text-amber-200\/85{color:hsla(48,97%,77%,.85)}.text-amber-200\/90{color:hsla(48,97%,77%,.9)}.text-amber-300{--tw-text-opacity:1;color:rgb(252 211 77/var(--tw-text-opacity,1))}.text-amber-300\/80{color:rgba(252,211,77,.8)}.text-amber-400{--tw-text-opacity:1;color:rgb(251 191 36/var(--tw-text-opacity,1))}.text-amber-400\/95{color:rgba(251,191,36,.95)}.text-amber-500{--tw-text-opacity:1;color:rgb(245 158 11/var(--tw-text-opacity,1))}.text-amber-700{--tw-text-opacity:1;color:rgb(180 83 9/var(--tw-text-opacity,1))}.text-amber-800{--tw-text-opacity:1;color:rgb(146 64 14/var(--tw-text-opacity,1))}.text-cyan-100{--tw-text-opacity:1;color:rgb(207 250 254/var(--tw-text-opacity,1))}.text-cyan-100\/75{color:rgba(207,250,254,.75)}.text-cyan-100\/90{color:rgba(207,250,254,.9)}.text-cyan-200{--tw-text-opacity:1;color:rgb(165 243 252/var(--tw-text-opacity,1))}.text-cyan-200\/90{color:rgba(165,243,252,.9)}.text-cyan-300{--tw-text-opacity:1;color:rgb(103 232 249/var(--tw-text-opacity,1))}.text-cyan-300\/70{color:rgba(103,232,249,.7)}.text-cyan-300\/80{color:rgba(103,232,249,.8)}.text-cyan-300\/90{color:rgba(103,232,249,.9)}.text-cyan-400{--tw-text-opacity:1;color:rgb(34 211 238/var(--tw-text-opacity,1))}.text-cyan-400\/90{color:rgba(34,211,238,.9)}.text-cyan-50{--tw-text-opacity:1;color:rgb(236 254 255/var(--tw-text-opacity,1))}.text-cyan-600{--tw-text-opacity:1;color:rgb(8 145 178/var(--tw-text-opacity,1))}.text-cyan-700{--tw-text-opacity:1;color:rgb(14 116 144/var(--tw-text-opacity,1))}.text-cyan-800{--tw-text-opacity:1;color:rgb(21 94 117/var(--tw-text-opacity,1))}.text-cyan-900{--tw-text-opacity:1;color:rgb(22 78 99/var(--tw-text-opacity,1))}.text-cyan-950{--tw-text-opacity:1;color:rgb(8 51 68/var(--tw-text-opacity,1))}.text-emerald-100{--tw-text-opacity:1;color:rgb(209 250 229/var(--tw-text-opacity,1))}.text-emerald-100\/95{color:rgba(209,250,229,.95)}.text-emerald-200{--tw-text-opacity:1;color:rgb(167 243 208/var(--tw-text-opacity,1))}.text-emerald-200\/90{color:rgba(167,243,208,.9)}.text-emerald-300{--tw-text-opacity:1;color:rgb(110 231 183/var(--tw-text-opacity,1))}.text-emerald-300\/90{color:rgba(110,231,183,.9)}.text-emerald-400{--tw-text-opacity:1;color:rgb(52 211 153/var(--tw-text-opacity,1))}.text-emerald-400\/80{color:rgba(52,211,153,.8)}.text-emerald-400\/90{color:rgba(52,211,153,.9)}.text-emerald-50{--tw-text-opacity:1;color:rgb(236 253 245/var(--tw-text-opacity,1))}.text-emerald-700{--tw-text-opacity:1;color:rgb(4 120 87/var(--tw-text-opacity,1))}.text-emerald-800{--tw-text-opacity:1;color:rgb(6 95 70/var(--tw-text-opacity,1))}.text-emerald-950{--tw-text-opacity:1;color:rgb(2 44 34/var(--tw-text-opacity,1))}.text-fuchsia-100{--tw-text-opacity:1;color:rgb(250 232 255/var(--tw-text-opacity,1))}.text-fuchsia-200\/80{color:rgba(245,208,254,.8)}.text-fuchsia-300{--tw-text-opacity:1;color:rgb(240 171 252/var(--tw-text-opacity,1))}.text-fuchsia-300\/70{color:rgba(240,171,252,.7)}.text-fuchsia-400{--tw-text-opacity:1;color:rgb(232 121 249/var(--tw-text-opacity,1))}.text-indigo-100{--tw-text-opacity:1;color:rgb(224 231 255/var(--tw-text-opacity,1))}.text-indigo-200{--tw-text-opacity:1;color:rgb(199 210 254/var(--tw-text-opacity,1))}.text-indigo-300{--tw-text-opacity:1;color:rgb(165 180 252/var(--tw-text-opacity,1))}.text-indigo-700{--tw-text-opacity:1;color:rgb(67 56 202/var(--tw-text-opacity,1))}.text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.text-rose-100{--tw-text-opacity:1;color:rgb(255 228 230/var(--tw-text-opacity,1))}.text-rose-100\/95{color:rgba(255,228,230,.95)}.text-rose-200{--tw-text-opacity:1;color:rgb(254 205 211/var(--tw-text-opacity,1))}.text-rose-300{--tw-text-opacity:1;color:rgb(253 164 175/var(--tw-text-opacity,1))}.text-rose-400\/90{color:rgba(251,113,133,.9)}.text-sky-100{--tw-text-opacity:1;color:rgb(224 242 254/var(--tw-text-opacity,1))}.text-sky-100\/80{color:rgba(224,242,254,.8)}.text-sky-200{--tw-text-opacity:1;color:rgb(186 230 253/var(--tw-text-opacity,1))}.text-sky-400{--tw-text-opacity:1;color:rgb(56 189 248/var(--tw-text-opacity,1))}.text-slate-100{--tw-text-opacity:1;color:rgb(241 245 249/var(--tw-text-opacity,1))}.text-slate-200{--tw-text-opacity:1;color:rgb(226 232 240/var(--tw-text-opacity,1))}.text-slate-300{--tw-text-opacity:1;color:rgb(203 213 225/var(--tw-text-opacity,1))}.text-slate-300\/90{color:rgba(203,213,225,.9)}.text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}.text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.text-slate-600{--tw-text-opacity:1;color:rgb(71 85 105/var(--tw-text-opacity,1))}.text-slate-700{--tw-text-opacity:1;color:rgb(51 65 85/var(--tw-text-opacity,1))}.text-slate-800{--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity,1))}.text-slate-900{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}.text-violet-100{--tw-text-opacity:1;color:rgb(237 233 254/var(--tw-text-opacity,1))}.text-violet-200{--tw-text-opacity:1;color:rgb(221 214 254/var(--tw-text-opacity,1))}.text-violet-300{--tw-text-opacity:1;color:rgb(196 181 253/var(--tw-text-opacity,1))}.text-violet-300\/80{color:rgba(196,181,253,.8)}.text-violet-300\/90{color:rgba(196,181,253,.9)}.text-violet-400{--tw-text-opacity:1;color:rgb(167 139 250/var(--tw-text-opacity,1))}.text-violet-400\/90{color:rgba(167,139,250,.9)}.text-violet-600{--tw-text-opacity:1;color:rgb(124 58 237/var(--tw-text-opacity,1))}.text-violet-700{--tw-text-opacity:1;color:rgb(109 40 217/var(--tw-text-opacity,1))}.text-violet-800{--tw-text-opacity:1;color:rgb(91 33 182/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.text-white\/70{color:hsla(0,0%,100%,.7)}.text-white\/80{color:hsla(0,0%,100%,.8)}.text-zinc-100{--tw-text-opacity:1;color:rgb(244 244 245/var(--tw-text-opacity,1))}.text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.text-zinc-200\/90{color:hsla(240,6%,90%,.9)}.text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.text-zinc-600{--tw-text-opacity:1;color:rgb(82 82 91/var(--tw-text-opacity,1))}.text-zinc-700{--tw-text-opacity:1;color:rgb(63 63 70/var(--tw-text-opacity,1))}.underline-offset-2{text-underline-offset:2px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.accent-violet-500{accent-color:#8b5cf6}.opacity-35{opacity:.35}.opacity-40{opacity:.4}.opacity-45{opacity:.45}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-90{opacity:.9}.opacity-\[0\.06\]{opacity:.06}.opacity-\[0\.22\]{opacity:.22}.shadow-2xl{--tw-shadow:0 25px 50px -12px rgba(0,0,0,.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color)}.shadow-2xl,.shadow-inner{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 rgba(0,0,0,.05);--tw-shadow-colored:inset 0 2px 4px 0 var(--tw-shadow-color)}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-lg,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-black\/20{--tw-shadow-color:rgba(0,0,0,.2);--tw-shadow:var(--tw-shadow-colored)}.shadow-black\/30{--tw-shadow-color:rgba(0,0,0,.3);--tw-shadow:var(--tw-shadow-colored)}.shadow-black\/50{--tw-shadow-color:rgba(0,0,0,.5);--tw-shadow:var(--tw-shadow-colored)}.shadow-black\/80{--tw-shadow-color:rgba(0,0,0,.8);--tw-shadow:var(--tw-shadow-colored)}.shadow-cyan-100\/50{--tw-shadow-color:rgba(207,250,254,.5);--tw-shadow:var(--tw-shadow-colored)}.shadow-cyan-900\/10{--tw-shadow-color:rgba(22,78,99,.1);--tw-shadow:var(--tw-shadow-colored)}.shadow-emerald-900\/20{--tw-shadow-color:rgba(6,78,59,.2);--tw-shadow:var(--tw-shadow-colored)}.shadow-slate-200\/40{--tw-shadow-color:rgba(226,232,240,.4);--tw-shadow:var(--tw-shadow-colored)}.shadow-violet-200\/50{--tw-shadow-color:rgba(221,214,254,.5);--tw-shadow:var(--tw-shadow-colored)}.shadow-violet-500\/25{--tw-shadow-color:rgba(139,92,246,.25);--tw-shadow:var(--tw-shadow-colored)}.shadow-violet-900\/10{--tw-shadow-color:rgba(76,29,149,.1);--tw-shadow:var(--tw-shadow-colored)}.shadow-white\/5{--tw-shadow-color:hsla(0,0%,100%,.05);--tw-shadow:var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.ring,.ring-1{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.ring-amber-400\/25{--tw-ring-color:rgba(251,191,36,.25)}.ring-amber-400\/30{--tw-ring-color:rgba(251,191,36,.3)}.ring-amber-500\/20{--tw-ring-color:rgba(245,158,11,.2)}.ring-amber-500\/25{--tw-ring-color:rgba(245,158,11,.25)}.ring-amber-500\/30{--tw-ring-color:rgba(245,158,11,.3)}.ring-amber-500\/35{--tw-ring-color:rgba(245,158,11,.35)}.ring-cyan-100{--tw-ring-opacity:1;--tw-ring-color:rgb(207 250 254/var(--tw-ring-opacity,1))}.ring-cyan-200{--tw-ring-opacity:1;--tw-ring-color:rgb(165 243 252/var(--tw-ring-opacity,1))}.ring-cyan-400\/20{--tw-ring-color:rgba(34,211,238,.2)}.ring-cyan-400\/25{--tw-ring-color:rgba(34,211,238,.25)}.ring-cyan-400\/30{--tw-ring-color:rgba(34,211,238,.3)}.ring-cyan-400\/35{--tw-ring-color:rgba(34,211,238,.35)}.ring-cyan-500\/10{--tw-ring-color:rgba(6,182,212,.1)}.ring-cyan-500\/20{--tw-ring-color:rgba(6,182,212,.2)}.ring-cyan-500\/25{--tw-ring-color:rgba(6,182,212,.25)}.ring-cyan-500\/30{--tw-ring-color:rgba(6,182,212,.3)}.ring-cyan-500\/35{--tw-ring-color:rgba(6,182,212,.35)}.ring-emerald-200{--tw-ring-opacity:1;--tw-ring-color:rgb(167 243 208/var(--tw-ring-opacity,1))}.ring-emerald-400\/25{--tw-ring-color:rgba(52,211,153,.25)}.ring-emerald-400\/30{--tw-ring-color:rgba(52,211,153,.3)}.ring-emerald-500\/20{--tw-ring-color:rgba(16,185,129,.2)}.ring-emerald-500\/25{--tw-ring-color:rgba(16,185,129,.25)}.ring-emerald-500\/30{--tw-ring-color:rgba(16,185,129,.3)}.ring-fuchsia-500\/25{--tw-ring-color:rgba(217,70,239,.25)}.ring-fuchsia-500\/35{--tw-ring-color:rgba(217,70,239,.35)}.ring-indigo-400\/30{--tw-ring-color:rgba(129,140,248,.3)}.ring-indigo-500\/25{--tw-ring-color:rgba(99,102,241,.25)}.ring-rose-400\/25{--tw-ring-color:rgba(251,113,133,.25)}.ring-rose-400\/40{--tw-ring-color:rgba(251,113,133,.4)}.ring-rose-500\/15{--tw-ring-color:rgba(244,63,94,.15)}.ring-rose-500\/25{--tw-ring-color:rgba(244,63,94,.25)}.ring-rose-500\/30{--tw-ring-color:rgba(244,63,94,.3)}.ring-rose-500\/35{--tw-ring-color:rgba(244,63,94,.35)}.ring-sky-400\/40{--tw-ring-color:rgba(56,189,248,.4)}.ring-sky-500\/25{--tw-ring-color:rgba(14,165,233,.25)}.ring-slate-200{--tw-ring-opacity:1;--tw-ring-color:rgb(226 232 240/var(--tw-ring-opacity,1))}.ring-slate-500\/30{--tw-ring-color:rgba(100,116,139,.3)}.ring-violet-200{--tw-ring-opacity:1;--tw-ring-color:rgb(221 214 254/var(--tw-ring-opacity,1))}.ring-violet-400\/25{--tw-ring-color:rgba(167,139,250,.25)}.ring-violet-400\/35{--tw-ring-color:rgba(167,139,250,.35)}.ring-violet-400\/40{--tw-ring-color:rgba(167,139,250,.4)}.ring-violet-500\/20{--tw-ring-color:rgba(139,92,246,.2)}.ring-violet-500\/25{--tw-ring-color:rgba(139,92,246,.25)}.ring-violet-500\/30{--tw-ring-color:rgba(139,92,246,.3)}.ring-violet-500\/35{--tw-ring-color:rgba(139,92,246,.35)}.ring-white\/10{--tw-ring-color:hsla(0,0%,100%,.1)}.ring-white\/\[0\.03\]{--tw-ring-color:hsla(0,0%,100%,.03)}.ring-white\/\[0\.04\]{--tw-ring-color:hsla(0,0%,100%,.04)}.ring-white\/\[0\.05\]{--tw-ring-color:hsla(0,0%,100%,.05)}.ring-white\/\[0\.06\]{--tw-ring-color:hsla(0,0%,100%,.06)}.ring-zinc-500\/25{--tw-ring-color:hsla(240,4%,46%,.25)}.blur-3xl{--tw-blur:blur(64px)}.blur-3xl,.blur-\[100px\]{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-\[100px\]{--tw-blur:blur(100px)}.blur-\[120px\]{--tw-blur:blur(120px)}.blur-\[120px\],.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-2xl{--tw-backdrop-blur:blur(40px)}.backdrop-blur-2xl,.backdrop-blur-\[2px\]{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-\[2px\]{--tw-backdrop-blur:blur(2px)}.backdrop-blur-lg{--tw-backdrop-blur:blur(16px)}.backdrop-blur-lg,.backdrop-blur-md{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur:blur(12px)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px)}.backdrop-blur-sm,.backdrop-blur-xl{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur:blur(24px)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.glass{border-width:1px;border-color:hsla(0,0%,100%,.08);--tw-shadow:0 25px 50px -12px rgba(0,0,0,.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);--tw-shadow-color:rgba(0,0,0,.4);--tw-shadow:var(--tw-shadow-colored);background:var(--bg-card);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);transition:border-color .25s ease,box-shadow .25s ease,background .25s ease}html[data-theme=light] .glass{border-color:rgba(226,232,240,.9);--tw-shadow-color:rgba(148,163,184,.15);--tw-shadow:var(--tw-shadow-colored)}.section-title{font-size:1.125rem;line-height:1.75rem;font-weight:600;letter-spacing:-.025em;color:var(--text)}.section-lead{margin-top:.5rem}.meta-chip,.section-lead{font-size:.75rem;line-height:1rem;line-height:1.625;color:var(--muted)}.meta-chip{border-radius:1rem;border-width:1px;padding:.75rem 1rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;border-color:hsla(0,0%,100%,.1);background:rgba(0,0,0,.22)}html[data-theme=light] .meta-chip{border-color:rgba(226,232,240,.95);background:hsla(0,0%,100%,.72);color:var(--muted)}.tab-strip{margin-left:-.25rem;margin-right:-.25rem;display:flex;gap:.5rem;overflow-x:auto;padding-bottom:.375rem;padding-top:.125rem}@media (min-width:768px){.tab-strip{flex-wrap:wrap;overflow:visible}}.tab-strip{scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch}.tab-btn{flex-shrink:0;scroll-snap-align:start;border-radius:1rem;border-width:1px;padding:.625rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s}.tab-btn:focus-visible{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-color:rgba(34,211,238,.5);--tw-ring-offset-width:2px}.tab-btn{--tw-ring-offset-color:var(--ring-offset);border-color:hsla(0,0%,100%,.12);background:rgba(0,0,0,.22);color:#cbd5e1}.tab-btn:hover{border-color:rgba(34,211,238,.25);color:#e2e8f0}.tab-btn-active{border-color:rgba(34,211,238,.45)!important;background:rgba(34,211,238,.12)!important;color:#cffafe!important}html[data-theme=light] .tab-btn{border-color:#e2e8f0;background:hsla(0,0%,100%,.75);color:#475569}html[data-theme=light] .tab-btn:hover{border-color:rgba(6,182,212,.45);color:#0f766e}html[data-theme=light] .tab-btn-active{border-color:rgba(6,182,212,.55)!important;background:rgba(207,250,254,.55)!important;color:#0e7490!important}.link-tile{display:block;border-radius:1rem;border-width:1px;padding:.625rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s}.link-tile:focus-visible{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-color:rgba(34,211,238,.5);--tw-ring-offset-width:2px}.link-tile{--tw-ring-offset-color:var(--ring-offset);border-color:hsla(0,0%,100%,.1);background:rgba(0,0,0,.2);color:#f1f5f9}.link-tile:hover{border-color:rgba(34,211,238,.35)}html[data-theme=light] .link-tile{border-color:#e2e8f0;background:hsla(0,0%,100%,.65);color:#1e293b}.link-tile-accent{border-color:rgba(34,211,238,.28);background:rgba(34,211,238,.1);color:#ecfeff}.link-tile-accent:hover{border-color:rgba(34,211,238,.55)}html[data-theme=light] .link-tile-accent{border-color:rgba(6,182,212,.35);background:rgba(207,250,254,.65);color:#0e7490}.link-tile-warn{border-color:rgba(251,191,36,.25);background:rgba(251,191,36,.1);color:#fefce8}html[data-theme=light] .link-tile-warn{border-color:rgba(251,191,36,.45);background:hsla(55,92%,95%,.9);color:#78350f}.service-card{border-radius:1.5rem;border-width:1px;padding:1.25rem;transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;border-color:hsla(0,0%,100%,.08);background:rgba(0,0,0,.2)}.service-card:hover{box-shadow:0 12px 40px -24px rgba(34,211,238,.35)}html[data-theme=light] .service-card{border-color:rgba(226,232,240,.95);background:hsla(0,0%,100%,.55)}.panel-inset{border-radius:1rem;border-width:1px;padding:1rem;font-size:.875rem;line-height:1.25rem;border-color:hsla(0,0%,100%,.08);background:rgba(0,0,0,.2);color:#cbd5e1}html[data-theme=light] .panel-inset{border-color:rgba(226,232,240,.85);background:hsla(0,0%,100%,.5);color:#334155}.field-select{width:100%;border-radius:1rem;border-width:1px;padding:.75rem 1rem;font-size:.875rem;line-height:1.25rem;outline:2px solid transparent;outline-offset:2px;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s;border-color:hsla(0,0%,100%,.12);background:rgba(2,6,23,.55);color:#f8fafc}html[data-theme=light] .field-select{border-color:#e2e8f0;background:hsla(0,0%,100%,.9);color:#0f172a}.btn-focus:focus-visible{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-color:rgba(34,211,238,.5);--tw-ring-offset-width:2px}.btn-focus{--tw-ring-offset-color:var(--ring-offset)}.\[-ms-overflow-style\:none\]{-ms-overflow-style:none}.\[scrollbar-width\:none\]{scrollbar-width:none}:root{--bg-deep:#060912;--bg-card:rgba(16,22,36,.78);--accent:#22d3ee;--accent2:#a78bfa;--danger:#f43f5e;--ok:#34d399;--text:#e8edf7;--muted:#94a3b8;--ring-offset:#060912;color-scheme:dark}html[data-theme=light]{--bg-deep:#f1f5f9;--bg-card:hsla(0,0%,100%,.88);--text:#0f172a;--muted:#64748b;--ring-offset:#f1f5f9;color-scheme:light}html{scroll-behavior:smooth}body{color:var(--text);background:var(--bg-deep);min-height:100vh;font-family:var(--font-geist-sans),system-ui,sans-serif;overflow-x:hidden;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;transition:background-color .35s ease,color .25s ease}*{scrollbar-width:thin;scrollbar-color:rgba(148,163,184,.35) transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:rgba(148,163,184,.35);border-radius:999px}::-webkit-scrollbar-track{background:transparent}.app-bg-layer{position:fixed;inset:0;z-index:-1;opacity:.92;pointer-events:none;background:radial-gradient(ellipse 80% 50% at 50% -20%,rgba(34,211,238,.22),transparent),radial-gradient(ellipse 60% 40% at 100% 0,rgba(167,139,250,.18),transparent),radial-gradient(ellipse 50% 30% at 0 100%,rgba(59,130,246,.12),transparent);transition:opacity .35s ease}html[data-theme=light] .app-bg-layer{opacity:.75;background:radial-gradient(ellipse 80% 50% at 50% -20%,rgba(14,165,233,.12),transparent),radial-gradient(ellipse 60% 40% at 100% 0,rgba(139,92,246,.1),transparent),radial-gradient(ellipse 50% 30% at 0 100%,rgba(59,130,246,.08),transparent)}html[data-theme=light] .chart-surface{border-color:rgba(15,23,42,.12)!important;background:hsla(0,0%,100%,.65)!important}::selection{background:rgba(34,211,238,.25)}.safe-pb-nav{padding-bottom:calc(5.5rem + env(safe-area-inset-bottom, 0px))}@media (min-width:768px){.safe-pb-nav{padding-bottom:4rem}}@keyframes toast-in{0%{opacity:0;transform:translate(-50%,12px)}to{opacity:1;transform:translate(-50%)}}.animate-toast-in{animation:toast-in .35s ease-out both}@keyframes pulse-soft{0%,to{opacity:1}50%{opacity:.65}}.animate-pulse-soft{animation:pulse-soft 2s ease-in-out infinite}.log-scroll{scrollbar-width:thin;scrollbar-color:rgba(148,163,184,.35) transparent}.log-scroll::-webkit-scrollbar{width:6px;height:6px}.log-scroll::-webkit-scrollbar-thumb{background:rgba(148,163,184,.35);border-radius:6px}.portal-grid-bg{background-image:linear-gradient(hsla(0,0%,100%,.05) 1px,transparent 0),linear-gradient(90deg,hsla(0,0%,100%,.05) 1px,transparent 0);background-size:28px 28px}.lp-noise{background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E")}.studio-scene-shell{perspective:800px}.studio-scene-shimmer{background:linear-gradient(105deg,transparent 40%,rgba(244,114,182,.12) 50%,transparent 60%);background-size:200% 100%;animation:studio-shimmer 1.8s ease-in-out infinite}@keyframes studio-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.studio-live-badge{animation:studio-live-glow 2.4s ease-in-out infinite}@keyframes studio-live-glow{0%,to{box-shadow:0 0 0 0 rgba(244,63,94,0)}50%{box-shadow:0 0 12px 2px rgba(244,63,94,.25)}}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}*,:after,:before{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}.selection\:bg-violet-400\/25 ::selection{background-color:rgba(167,139,250,.25)}.selection\:bg-violet-500\/30 ::selection{background-color:rgba(139,92,246,.3)}.selection\:bg-violet-400\/25::selection{background-color:rgba(167,139,250,.25)}.selection\:bg-violet-500\/30::selection{background-color:rgba(139,92,246,.3)}.file\:mr-3::file-selector-button{margin-right:.75rem}.file\:rounded-md::file-selector-button{border-radius:.375rem}.file\:border-0::file-selector-button{border-width:0}.file\:bg-cyan-50::file-selector-button{--tw-bg-opacity:1;background-color:rgb(236 254 255/var(--tw-bg-opacity,1))}.file\:bg-cyan-500\/15::file-selector-button{background-color:rgba(6,182,212,.15)}.file\:px-3::file-selector-button{padding-left:.75rem;padding-right:.75rem}.file\:py-1\.5::file-selector-button{padding-top:.375rem;padding-bottom:.375rem}.file\:text-xs::file-selector-button{font-size:.75rem;line-height:1rem}.file\:font-semibold::file-selector-button{font-weight:600}.file\:text-cyan-100::file-selector-button{--tw-text-opacity:1;color:rgb(207 250 254/var(--tw-text-opacity,1))}.file\:text-cyan-800::file-selector-button{--tw-text-opacity:1;color:rgb(21 94 117/var(--tw-text-opacity,1))}.last\:border-0:last-child{border-width:0}.hover\:-translate-y-0\.5:hover{--tw-translate-y:-0.125rem}.hover\:-translate-y-0\.5:hover,.hover\:-translate-y-px:hover{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:-translate-y-px:hover{--tw-translate-y:-1px}.hover\:border-fuchsia-400\/35:hover{border-color:rgba(232,121,249,.35)}.hover\:border-violet-400\/20:hover{border-color:rgba(167,139,250,.2)}.hover\:border-violet-400\/30:hover{border-color:rgba(167,139,250,.3)}.hover\:border-white\/15:hover{border-color:hsla(0,0%,100%,.15)}.hover\:border-white\/20:hover{border-color:hsla(0,0%,100%,.2)}.hover\:bg-amber-500\/15:hover{background-color:rgba(245,158,11,.15)}.hover\:bg-amber-500\/25:hover{background-color:rgba(245,158,11,.25)}.hover\:bg-black\/45:hover{background-color:rgba(0,0,0,.45)}.hover\:bg-black\/60:hover{background-color:rgba(0,0,0,.6)}.hover\:bg-cyan-100:hover{--tw-bg-opacity:1;background-color:rgb(207 250 254/var(--tw-bg-opacity,1))}.hover\:bg-cyan-50:hover{--tw-bg-opacity:1;background-color:rgb(236 254 255/var(--tw-bg-opacity,1))}.hover\:bg-cyan-500\/15:hover{background-color:rgba(6,182,212,.15)}.hover\:bg-cyan-500\/25:hover{background-color:rgba(6,182,212,.25)}.hover\:bg-cyan-500\/30:hover{background-color:rgba(6,182,212,.3)}.hover\:bg-emerald-100:hover{--tw-bg-opacity:1;background-color:rgb(209 250 229/var(--tw-bg-opacity,1))}.hover\:bg-emerald-500\/15:hover{background-color:rgba(16,185,129,.15)}.hover\:bg-emerald-500\/20:hover{background-color:rgba(16,185,129,.2)}.hover\:bg-emerald-500\/25:hover{background-color:rgba(16,185,129,.25)}.hover\:bg-fuchsia-500\/20:hover{background-color:rgba(217,70,239,.2)}.hover\:bg-rose-500\/15:hover{background-color:rgba(244,63,94,.15)}.hover\:bg-rose-500\/25:hover{background-color:rgba(244,63,94,.25)}.hover\:bg-slate-100:hover{--tw-bg-opacity:1;background-color:rgb(241 245 249/var(--tw-bg-opacity,1))}.hover\:bg-slate-200\/60:hover{background-color:rgba(226,232,240,.6)}.hover\:bg-slate-50:hover{--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity,1))}.hover\:bg-violet-100:hover{--tw-bg-opacity:1;background-color:rgb(237 233 254/var(--tw-bg-opacity,1))}.hover\:bg-violet-500\/15:hover{background-color:rgba(139,92,246,.15)}.hover\:bg-violet-500\/25:hover{background-color:rgba(139,92,246,.25)}.hover\:bg-violet-500\/30:hover{background-color:rgba(139,92,246,.3)}.hover\:bg-white\/10:hover{background-color:hsla(0,0%,100%,.1)}.hover\:bg-white\/5:hover{background-color:hsla(0,0%,100%,.05)}.hover\:bg-white\/60:hover{background-color:hsla(0,0%,100%,.6)}.hover\:bg-white\/\[0\.03\]:hover{background-color:hsla(0,0%,100%,.03)}.hover\:bg-white\/\[0\.04\]:hover{background-color:hsla(0,0%,100%,.04)}.hover\:bg-white\/\[0\.06\]:hover{background-color:hsla(0,0%,100%,.06)}.hover\:bg-white\/\[0\.07\]:hover{background-color:hsla(0,0%,100%,.07)}.hover\:bg-white\/\[0\.08\]:hover{background-color:hsla(0,0%,100%,.08)}.hover\:bg-white\/\[0\.1\]:hover{background-color:hsla(0,0%,100%,.1)}.hover\:bg-zinc-500\/25:hover{background-color:hsla(240,4%,46%,.25)}.hover\:text-amber-300:hover{--tw-text-opacity:1;color:rgb(252 211 77/var(--tw-text-opacity,1))}.hover\:text-cyan-200:hover{--tw-text-opacity:1;color:rgb(165 243 252/var(--tw-text-opacity,1))}.hover\:text-rose-200:hover{--tw-text-opacity:1;color:rgb(254 205 211/var(--tw-text-opacity,1))}.hover\:text-slate-900:hover{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.hover\:text-zinc-200:hover{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.hover\:text-zinc-300:hover{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:ring-violet-400\/50:hover{--tw-ring-color:rgba(167,139,250,.5)}.hover\:brightness-110:hover{--tw-brightness:brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:border-amber-400:focus{--tw-border-opacity:1;border-color:rgb(251 191 36/var(--tw-border-opacity,1))}.focus\:border-amber-400\/60:focus{border-color:rgba(251,191,36,.6)}.focus\:border-cyan-400:focus{--tw-border-opacity:1;border-color:rgb(34 211 238/var(--tw-border-opacity,1))}.focus\:border-cyan-400\/60:focus{border-color:rgba(34,211,238,.6)}.focus\:border-indigo-400:focus{--tw-border-opacity:1;border-color:rgb(129 140 248/var(--tw-border-opacity,1))}.focus\:border-indigo-400\/60:focus{border-color:rgba(129,140,248,.6)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-emerald-500\/50:focus-visible{--tw-ring-color:rgba(16,185,129,.5)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-45:disabled{opacity:.45}@media (min-width:640px){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:w-auto{width:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-\[14rem_minmax\(0\2c 1fr\)\]{grid-template-columns:14rem minmax(0,1fr)}.sm\:grid-cols-\[minmax\(0\2c 1fr\)_7rem\]{grid-template-columns:minmax(0,1fr) 7rem}.sm\:flex-row{flex-direction:row}.sm\:flex-wrap{flex-wrap:wrap}.sm\:flex-nowrap{flex-wrap:nowrap}.sm\:items-start{align-items:flex-start}.sm\:items-end{align-items:flex-end}.sm\:items-center{align-items:center}.sm\:justify-center{justify-content:center}.sm\:justify-between{justify-content:space-between}.sm\:gap-2{gap:.5rem}.sm\:p-5{padding:1.25rem}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:text-4xl{font-size:2.25rem;line-height:2.5rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width:768px){.md\:bottom-6{bottom:1.5rem}.md\:hidden{display:none}.md\:h-56{height:14rem}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-\[12rem_minmax\(0\2c 1fr\)\]{grid-template-columns:12rem minmax(0,1fr)}.md\:grid-cols-\[minmax\(0\2c 1fr\)_6rem_14rem\]{grid-template-columns:minmax(0,1fr) 6rem 14rem}.md\:grid-cols-\[minmax\(0\2c 1fr\)_8rem_7rem_7rem\]{grid-template-columns:minmax(0,1fr) 8rem 7rem 7rem}}@media (min-width:1024px){.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[minmax\(0\2c 1fr\)_22rem\]{grid-template-columns:minmax(0,1fr) 22rem}.lg\:grid-cols-\[minmax\(0\2c 1fr\)_8rem\]{grid-template-columns:minmax(0,1fr) 8rem}.lg\:flex-row{flex-direction:row}.lg\:items-start{align-items:flex-start}.lg\:items-end{align-items:flex-end}.lg\:items-center{align-items:center}.lg\:justify-between{justify-content:space-between}.lg\:px-10{padding-left:2.5rem;padding-right:2.5rem}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:py-8{padding-top:2rem;padding-bottom:2rem}.lg\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width:1280px){.xl\:col-span-12{grid-column:span 12/span 12}.xl\:col-span-2{grid-column:span 2/span 2}.xl\:col-span-3{grid-column:span 3/span 3}.xl\:col-span-4{grid-column:span 4/span 4}.xl\:col-span-8{grid-column:span 8/span 8}.xl\:max-h-\[min\(24rem\2c 50vh\)\]{max-height:min(24rem,50vh)}.xl\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.xl\:grid-cols-\[0\.95fr\2c 1\.05fr\]{grid-template-columns:.95fr 1.05fr}.xl\:grid-cols-\[1\.1fr_0\.9fr\]{grid-template-columns:1.1fr .9fr}.xl\:grid-cols-\[18rem\2c 1fr\]{grid-template-columns:18rem 1fr}.xl\:grid-cols-\[minmax\(0\2c 1\.1fr\)_minmax\(20rem\2c 0\.8fr\)\]{grid-template-columns:minmax(0,1.1fr) minmax(20rem,.8fr)}.xl\:grid-cols-\[minmax\(0\2c 1\.1fr\)_minmax\(25rem\2c 0\.9fr\)\]{grid-template-columns:minmax(0,1.1fr) minmax(25rem,.9fr)}.xl\:grid-cols-\[minmax\(0\2c 1fr\)_minmax\(22rem\2c 0\.9fr\)\]{grid-template-columns:minmax(0,1fr) minmax(22rem,.9fr)}.xl\:items-stretch{align-items:stretch}}@media (min-width:1536px){.\32xl\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}}.\[\&\:\:-webkit-scrollbar\]\:hidden::-webkit-scrollbar{display:none}html[data-theme=light] .\[html\[data-theme\=light\]_\&\]\:border-cyan-600\/25{border-color:rgba(8,145,178,.25)}html[data-theme=light] .\[html\[data-theme\=light\]_\&\]\:border-slate-200\/60{border-color:rgba(226,232,240,.6)}html[data-theme=light] .\[html\[data-theme\=light\]_\&\]\:bg-white\/90{background-color:hsla(0,0%,100%,.9)}html[data-theme=light] .\[html\[data-theme\=light\]_\&\]\:bg-white\/95{background-color:hsla(0,0%,100%,.95)}html[data-theme=light] .\[html\[data-theme\=light\]_\&\]\:text-cyan-700{--tw-text-opacity:1;color:rgb(14 116 144/var(--tw-text-opacity,1))}html[data-theme=light] .\[html\[data-theme\=light\]_\&\]\:text-cyan-950{--tw-text-opacity:1;color:rgb(8 51 68/var(--tw-text-opacity,1))}html[data-theme=light] .\[html\[data-theme\=light\]_\&\]\:text-slate-600{--tw-text-opacity:1;color:rgb(71 85 105/var(--tw-text-opacity,1))} \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/css/8082d3508f852f9a.css b/d2ypp2/web-console/out/_next/static/css/8082d3508f852f9a.css new file mode 100644 index 0000000..c8c1a11 --- /dev/null +++ b/d2ypp2/web-console/out/_next/static/css/8082d3508f852f9a.css @@ -0,0 +1,3 @@ +@font-face{font-family:__geistSans_1e4310;src:url(/_next/static/media/4473ecc91f70f139-s.p.woff) format("woff");font-display:swap;font-weight:100 900}@font-face{font-family:__geistSans_Fallback_1e4310;src:local("Arial");ascent-override:85.83%;descent-override:20.52%;line-gap-override:9.33%;size-adjust:107.19%}.__className_1e4310{font-family:__geistSans_1e4310,__geistSans_Fallback_1e4310}.__variable_1e4310{--font-geist-sans:"__geistSans_1e4310","__geistSans_Fallback_1e4310"}@font-face{font-family:__geistMono_c3aa02;src:url(/_next/static/media/463dafcda517f24f-s.p.woff) format("woff");font-display:swap;font-weight:100 900}@font-face{font-family:__geistMono_Fallback_c3aa02;src:local("Arial");ascent-override:69.97%;descent-override:16.73%;line-gap-override:7.61%;size-adjust:131.49%}.__className_c3aa02{font-family:__geistMono_c3aa02,__geistMono_Fallback_c3aa02}.__variable_c3aa02{--font-geist-mono:"__geistMono_c3aa02","__geistMono_Fallback_c3aa02"}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/* +! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com +*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media (min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media (min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media (min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media (min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media (min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.-bottom-0\.5{bottom:-.125rem}.-bottom-10{bottom:-2.5rem}.-left-1\/4{left:-25%}.-right-0\.5{right:-.125rem}.-right-20{right:-5rem}.-right-8{right:-2rem}.-top-0\.5{top:-.125rem}.-top-20{top:-5rem}.-top-8{top:-2rem}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-24{bottom:6rem}.bottom-3{bottom:.75rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.left-1\/2{left:50%}.left-1\/3{left:33.333333%}.right-0{right:0}.right-2{right:.5rem}.right-3{right:.75rem}.top-0{top:0}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.col-span-2{grid-column:span 2/span 2}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mr-1\.5{margin-right:.375rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-10{margin-top:2.5rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{-webkit-line-clamp:1}.line-clamp-1,.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical}.line-clamp-2{-webkit-line-clamp:2}.line-clamp-3{-webkit-line-clamp:3}.line-clamp-3,.line-clamp-4{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical}.line-clamp-4{-webkit-line-clamp:4}.line-clamp-6{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:6}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-28{height:7rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-36{height:9rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-52{height:13rem}.h-56{height:14rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-72{height:18rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[168px\]{height:168px}.h-\[248px\]{height:248px}.h-\[30rem\]{height:30rem}.h-\[36rem\]{height:36rem}.h-\[42rem\]{height:42rem}.h-\[min\(72vh\2c 40rem\)\]{height:min(72vh,40rem)}.h-full{height:100%}.max-h-40{max-height:10rem}.max-h-48{max-height:12rem}.max-h-52{max-height:13rem}.max-h-64{max-height:16rem}.max-h-72{max-height:18rem}.max-h-\[28rem\]{max-height:28rem}.max-h-\[min\(22rem\2c 42vh\)\]{max-height:min(22rem,42vh)}.max-h-\[min\(24rem\2c 55vh\)\]{max-height:min(24rem,55vh)}.max-h-\[min\(70vh\2c 48rem\)\]{max-height:min(70vh,48rem)}.max-h-\[min\(72vh\2c 680px\)\]{max-height:min(72vh,680px)}.max-h-\[min\(78vh\2c 56rem\)\]{max-height:min(78vh,56rem)}.max-h-\[min\(78vh\2c 720px\)\]{max-height:min(78vh,720px)}.min-h-0{min-height:0}.min-h-16{min-height:4rem}.min-h-24{min-height:6rem}.min-h-56{min-height:14rem}.min-h-\[100px\]{min-height:100px}.min-h-\[12rem\]{min-height:12rem}.min-h-\[14rem\]{min-height:14rem}.min-h-\[160px\]{min-height:160px}.min-h-\[18rem\]{min-height:18rem}.min-h-\[2\.5rem\]{min-height:2.5rem}.min-h-\[2\.75rem\]{min-height:2.75rem}.min-h-\[200px\]{min-height:200px}.min-h-\[22rem\]{min-height:22rem}.min-h-\[24rem\]{min-height:24rem}.min-h-\[280px\]{min-height:280px}.min-h-\[2rem\]{min-height:2rem}.min-h-\[32rem\]{min-height:32rem}.min-h-\[3rem\]{min-height:3rem}.min-h-\[4rem\]{min-height:4rem}.min-h-\[6rem\]{min-height:6rem}.min-h-\[72px\]{min-height:72px}.min-h-screen{min-height:100vh}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[36rem\]{width:36rem}.w-\[42rem\]{width:42rem}.w-\[min\(88vw\2c 280px\)\]{width:min(88vw,280px)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.min-w-0{min-width:0}.min-w-\[12rem\]{min-width:12rem}.min-w-\[1rem\]{min-width:1rem}.min-w-\[3\.75rem\]{min-width:3.75rem}.min-w-\[6rem\]{min-width:6rem}.min-w-\[7rem\]{min-width:7rem}.min-w-\[9rem\]{min-width:9rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[min\(92vw\2c 28rem\)\]{max-width:min(92vw,28rem)}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.origin-center{transform-origin:center}.-translate-x-1\/2{--tw-translate-x:-50%}.-rotate-90,.-translate-x-1\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate:-90deg}.rotate-180{--tw-rotate:180deg}.rotate-180,.rotate-90{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate:90deg}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-crosshair{cursor:crosshair}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize-y{resize:vertical}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-around{justify-content:space-around}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-x-2{column-gap:.5rem}.gap-y-0\.5{row-gap:.125rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-white\/\[0\.06\]>:not([hidden])~:not([hidden]){border-color:hsla(0,0%,100%,.06)}.self-start{align-self:flex-start}.self-center{align-self:center}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[1\.35rem\]{border-radius:1.35rem}.rounded-\[2rem\]{border-radius:2rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-b-xl{border-bottom-right-radius:.75rem;border-bottom-left-radius:.75rem}.border{border-width:1px}.border-\[10px\]{border-width:10px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-amber-200{--tw-border-opacity:1;border-color:rgb(253 230 138/var(--tw-border-opacity,1))}.border-amber-400\/20{border-color:rgba(251,191,36,.2)}.border-amber-400\/50{border-color:rgba(251,191,36,.5)}.border-amber-500\/15{border-color:rgba(245,158,11,.15)}.border-amber-500\/20{border-color:rgba(245,158,11,.2)}.border-amber-500\/25{border-color:rgba(245,158,11,.25)}.border-amber-500\/30{border-color:rgba(245,158,11,.3)}.border-cyan-100{--tw-border-opacity:1;border-color:rgb(207 250 254/var(--tw-border-opacity,1))}.border-cyan-200{--tw-border-opacity:1;border-color:rgb(165 243 252/var(--tw-border-opacity,1))}.border-cyan-200\/70{border-color:rgba(165,243,252,.7)}.border-cyan-200\/90{border-color:rgba(165,243,252,.9)}.border-cyan-400\/15{border-color:rgba(34,211,238,.15)}.border-cyan-400\/20{border-color:rgba(34,211,238,.2)}.border-cyan-400\/50{border-color:rgba(34,211,238,.5)}.border-cyan-500\/15{border-color:rgba(6,182,212,.15)}.border-cyan-500\/20{border-color:rgba(6,182,212,.2)}.border-cyan-500\/25{border-color:rgba(6,182,212,.25)}.border-cyan-500\/30{border-color:rgba(6,182,212,.3)}.border-cyan-500\/40{border-color:rgba(6,182,212,.4)}.border-cyan-500\/50{border-color:rgba(6,182,212,.5)}.border-emerald-400\/30{border-color:rgba(52,211,153,.3)}.border-emerald-500\/15{border-color:rgba(16,185,129,.15)}.border-emerald-500\/20{border-color:rgba(16,185,129,.2)}.border-emerald-500\/25{border-color:rgba(16,185,129,.25)}.border-emerald-500\/30{border-color:rgba(16,185,129,.3)}.border-emerald-500\/50{border-color:rgba(16,185,129,.5)}.border-fuchsia-200\/80{border-color:rgba(245,208,254,.8)}.border-fuchsia-400\/20{border-color:rgba(232,121,249,.2)}.border-fuchsia-400\/30{border-color:rgba(232,121,249,.3)}.border-fuchsia-500\/20{border-color:rgba(217,70,239,.2)}.border-fuchsia-500\/30{border-color:rgba(217,70,239,.3)}.border-indigo-400\/50{border-color:rgba(129,140,248,.5)}.border-rose-500\/15{border-color:rgba(244,63,94,.15)}.border-rose-500\/20{border-color:rgba(244,63,94,.2)}.border-rose-500\/25{border-color:rgba(244,63,94,.25)}.border-rose-500\/30{border-color:rgba(244,63,94,.3)}.border-sky-400\/20{border-color:rgba(56,189,248,.2)}.border-sky-500\/20{border-color:rgba(14,165,233,.2)}.border-slate-200{--tw-border-opacity:1;border-color:rgb(226 232 240/var(--tw-border-opacity,1))}.border-slate-200\/80{border-color:rgba(226,232,240,.8)}.border-slate-200\/90{border-color:rgba(226,232,240,.9)}.border-slate-500\/30{border-color:rgba(100,116,139,.3)}.border-slate-700\/30{border-color:rgba(51,65,85,.3)}.border-violet-200\/70{border-color:rgba(221,214,254,.7)}.border-violet-200\/80{border-color:rgba(221,214,254,.8)}.border-violet-200\/90{border-color:rgba(221,214,254,.9)}.border-violet-500\/15{border-color:rgba(139,92,246,.15)}.border-violet-500\/20{border-color:rgba(139,92,246,.2)}.border-violet-500\/25{border-color:rgba(139,92,246,.25)}.border-violet-500\/30{border-color:rgba(139,92,246,.3)}.border-violet-500\/35{border-color:rgba(139,92,246,.35)}.border-violet-500\/45{border-color:rgba(139,92,246,.45)}.border-violet-500\/50{border-color:rgba(139,92,246,.5)}.border-white\/10{border-color:hsla(0,0%,100%,.1)}.border-white\/15{border-color:hsla(0,0%,100%,.15)}.border-white\/20{border-color:hsla(0,0%,100%,.2)}.border-white\/5{border-color:hsla(0,0%,100%,.05)}.border-white\/\[0\.04\]{border-color:hsla(0,0%,100%,.04)}.border-white\/\[0\.05\]{border-color:hsla(0,0%,100%,.05)}.border-white\/\[0\.06\]{border-color:hsla(0,0%,100%,.06)}.border-white\/\[0\.07\]{border-color:hsla(0,0%,100%,.07)}.border-white\/\[0\.08\]{border-color:hsla(0,0%,100%,.08)}.border-zinc-800{--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.bg-\[\#050508\]{--tw-bg-opacity:1;background-color:rgb(5 5 8/var(--tw-bg-opacity,1))}.bg-amber-50{--tw-bg-opacity:1;background-color:rgb(255 251 235/var(--tw-bg-opacity,1))}.bg-amber-500\/10{background-color:rgba(245,158,11,.1)}.bg-amber-500\/15{background-color:rgba(245,158,11,.15)}.bg-amber-500\/20{background-color:rgba(245,158,11,.2)}.bg-amber-500\/5{background-color:rgba(245,158,11,.05)}.bg-amber-500\/\[0\.06\]{background-color:rgba(245,158,11,.06)}.bg-amber-500\/\[0\.08\]{background-color:rgba(245,158,11,.08)}.bg-amber-600{--tw-bg-opacity:1;background-color:rgb(217 119 6/var(--tw-bg-opacity,1))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-black\/10{background-color:rgba(0,0,0,.1)}.bg-black\/20{background-color:rgba(0,0,0,.2)}.bg-black\/25{background-color:rgba(0,0,0,.25)}.bg-black\/30{background-color:rgba(0,0,0,.3)}.bg-black\/35{background-color:rgba(0,0,0,.35)}.bg-black\/40{background-color:rgba(0,0,0,.4)}.bg-black\/45{background-color:rgba(0,0,0,.45)}.bg-black\/5{background-color:rgba(0,0,0,.05)}.bg-black\/50{background-color:rgba(0,0,0,.5)}.bg-black\/55{background-color:rgba(0,0,0,.55)}.bg-black\/60{background-color:rgba(0,0,0,.6)}.bg-black\/75{background-color:rgba(0,0,0,.75)}.bg-black\/80{background-color:rgba(0,0,0,.8)}.bg-cyan-100{--tw-bg-opacity:1;background-color:rgb(207 250 254/var(--tw-bg-opacity,1))}.bg-cyan-400\/10{background-color:rgba(34,211,238,.1)}.bg-cyan-50{--tw-bg-opacity:1;background-color:rgb(236 254 255/var(--tw-bg-opacity,1))}.bg-cyan-500\/10{background-color:rgba(6,182,212,.1)}.bg-cyan-500\/15{background-color:rgba(6,182,212,.15)}.bg-cyan-500\/20{background-color:rgba(6,182,212,.2)}.bg-cyan-500\/25{background-color:rgba(6,182,212,.25)}.bg-cyan-500\/30{background-color:rgba(6,182,212,.3)}.bg-cyan-500\/90{background-color:rgba(6,182,212,.9)}.bg-cyan-500\/\[0\.05\]{background-color:rgba(6,182,212,.05)}.bg-cyan-500\/\[0\.06\]{background-color:rgba(6,182,212,.06)}.bg-cyan-500\/\[0\.08\]{background-color:rgba(6,182,212,.08)}.bg-cyan-600{--tw-bg-opacity:1;background-color:rgb(8 145 178/var(--tw-bg-opacity,1))}.bg-cyan-600\/80{background-color:rgba(8,145,178,.8)}.bg-emerald-400{--tw-bg-opacity:1;background-color:rgb(52 211 153/var(--tw-bg-opacity,1))}.bg-emerald-50{--tw-bg-opacity:1;background-color:rgb(236 253 245/var(--tw-bg-opacity,1))}.bg-emerald-500\/10{background-color:rgba(16,185,129,.1)}.bg-emerald-500\/15{background-color:rgba(16,185,129,.15)}.bg-emerald-500\/20{background-color:rgba(16,185,129,.2)}.bg-emerald-500\/90{background-color:rgba(16,185,129,.9)}.bg-emerald-600{--tw-bg-opacity:1;background-color:rgb(5 150 105/var(--tw-bg-opacity,1))}.bg-fuchsia-500\/10{background-color:rgba(217,70,239,.1)}.bg-fuchsia-500\/15{background-color:rgba(217,70,239,.15)}.bg-fuchsia-500\/20{background-color:rgba(217,70,239,.2)}.bg-indigo-500\/15{background-color:rgba(99,102,241,.15)}.bg-rose-400{--tw-bg-opacity:1;background-color:rgb(251 113 133/var(--tw-bg-opacity,1))}.bg-rose-500\/10{background-color:rgba(244,63,94,.1)}.bg-rose-500\/15{background-color:rgba(244,63,94,.15)}.bg-rose-500\/20{background-color:rgba(244,63,94,.2)}.bg-rose-500\/\[0\.10\]{background-color:rgba(244,63,94,.1)}.bg-rose-600{--tw-bg-opacity:1;background-color:rgb(225 29 72/var(--tw-bg-opacity,1))}.bg-rose-950\/20{background-color:rgba(76,5,25,.2)}.bg-rose-950\/25{background-color:rgba(76,5,25,.25)}.bg-sky-500\/10{background-color:rgba(14,165,233,.1)}.bg-sky-500\/15{background-color:rgba(14,165,233,.15)}.bg-sky-500\/25{background-color:rgba(14,165,233,.25)}.bg-sky-600{--tw-bg-opacity:1;background-color:rgb(2 132 199/var(--tw-bg-opacity,1))}.bg-slate-100{--tw-bg-opacity:1;background-color:rgb(241 245 249/var(--tw-bg-opacity,1))}.bg-slate-200\/70{background-color:rgba(226,232,240,.7)}.bg-slate-50{--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity,1))}.bg-slate-50\/80{background-color:rgba(248,250,252,.8)}.bg-slate-500\/10{background-color:rgba(100,116,139,.1)}.bg-slate-500\/15{background-color:rgba(100,116,139,.15)}.bg-slate-800\/50{background-color:rgba(30,41,59,.5)}.bg-slate-950\/30{background-color:rgba(2,6,23,.3)}.bg-slate-950\/50{background-color:rgba(2,6,23,.5)}.bg-slate-950\/60{background-color:rgba(2,6,23,.6)}.bg-slate-950\/80{background-color:rgba(2,6,23,.8)}.bg-slate-950\/95{background-color:rgba(2,6,23,.95)}.bg-violet-100{--tw-bg-opacity:1;background-color:rgb(237 233 254/var(--tw-bg-opacity,1))}.bg-violet-100\/90{background-color:rgba(237,233,254,.9)}.bg-violet-400\/15{background-color:rgba(167,139,250,.15)}.bg-violet-50{--tw-bg-opacity:1;background-color:rgb(245 243 255/var(--tw-bg-opacity,1))}.bg-violet-500\/10{background-color:rgba(139,92,246,.1)}.bg-violet-500\/15{background-color:rgba(139,92,246,.15)}.bg-violet-500\/20{background-color:rgba(139,92,246,.2)}.bg-violet-500\/25{background-color:rgba(139,92,246,.25)}.bg-violet-500\/\[0\.06\]{background-color:rgba(139,92,246,.06)}.bg-violet-500\/\[0\.1\]{background-color:rgba(139,92,246,.1)}.bg-violet-600{--tw-bg-opacity:1;background-color:rgb(124 58 237/var(--tw-bg-opacity,1))}.bg-violet-600\/20{background-color:rgba(124,58,237,.2)}.bg-violet-600\/70{background-color:rgba(124,58,237,.7)}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.bg-white\/10{background-color:hsla(0,0%,100%,.1)}.bg-white\/5{background-color:hsla(0,0%,100%,.05)}.bg-white\/70{background-color:hsla(0,0%,100%,.7)}.bg-white\/75{background-color:hsla(0,0%,100%,.75)}.bg-white\/80{background-color:hsla(0,0%,100%,.8)}.bg-white\/85{background-color:hsla(0,0%,100%,.85)}.bg-white\/90{background-color:hsla(0,0%,100%,.9)}.bg-white\/\[0\.035\]{background-color:hsla(0,0%,100%,.035)}.bg-white\/\[0\.03\]{background-color:hsla(0,0%,100%,.03)}.bg-white\/\[0\.04\]{background-color:hsla(0,0%,100%,.04)}.bg-white\/\[0\.05\]{background-color:hsla(0,0%,100%,.05)}.bg-white\/\[0\.06\]{background-color:hsla(0,0%,100%,.06)}.bg-white\/\[0\.08\]{background-color:hsla(0,0%,100%,.08)}.bg-zinc-500\/15{background-color:hsla(240,4%,46%,.15)}.bg-zinc-600\/20{background-color:rgba(82,82,91,.2)}.bg-zinc-600\/30{background-color:rgba(82,82,91,.3)}.bg-zinc-700\/40{background-color:rgba(63,63,70,.4)}.bg-zinc-700\/90{background-color:rgba(63,63,70,.9)}.bg-zinc-950{--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.bg-zinc-950\/35{background-color:rgba(9,9,11,.35)}.bg-zinc-950\/40{background-color:rgba(9,9,11,.4)}.bg-zinc-950\/50{background-color:rgba(9,9,11,.5)}.bg-zinc-950\/55{background-color:rgba(9,9,11,.55)}.bg-zinc-950\/60{background-color:rgba(9,9,11,.6)}.bg-zinc-950\/70{background-color:rgba(9,9,11,.7)}.bg-zinc-950\/80{background-color:rgba(9,9,11,.8)}.bg-zinc-950\/90{background-color:rgba(9,9,11,.9)}.bg-zinc-950\/95{background-color:rgba(9,9,11,.95)}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-amber-400{--tw-gradient-from:#fbbf24 var(--tw-gradient-from-position);--tw-gradient-to:rgba(251,191,36,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-amber-50\/90{--tw-gradient-from:rgba(255,251,235,.9) var(--tw-gradient-from-position);--tw-gradient-to:rgba(255,251,235,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-amber-500\/20{--tw-gradient-from:rgba(245,158,11,.2) var(--tw-gradient-from-position);--tw-gradient-to:rgba(245,158,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-amber-500\/35{--tw-gradient-from:rgba(245,158,11,.35) var(--tw-gradient-from-position);--tw-gradient-to:rgba(245,158,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-amber-500\/\[0\.07\]{--tw-gradient-from:rgba(245,158,11,.07) var(--tw-gradient-from-position);--tw-gradient-to:rgba(245,158,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-amber-500\/\[0\.12\]{--tw-gradient-from:rgba(245,158,11,.12) var(--tw-gradient-from-position);--tw-gradient-to:rgba(245,158,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-cyan-400{--tw-gradient-from:#22d3ee var(--tw-gradient-from-position);--tw-gradient-to:rgba(34,211,238,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-cyan-500\/20{--tw-gradient-from:rgba(6,182,212,.2) var(--tw-gradient-from-position);--tw-gradient-to:rgba(6,182,212,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-cyan-500\/35{--tw-gradient-from:rgba(6,182,212,.35) var(--tw-gradient-from-position);--tw-gradient-to:rgba(6,182,212,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-cyan-500\/\[0\.08\]{--tw-gradient-from:rgba(6,182,212,.08) var(--tw-gradient-from-position);--tw-gradient-to:rgba(6,182,212,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-cyan-500\/\[0\.14\]{--tw-gradient-from:rgba(6,182,212,.14) var(--tw-gradient-from-position);--tw-gradient-to:rgba(6,182,212,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-cyan-500\/\[0\.1\]{--tw-gradient-from:rgba(6,182,212,.1) var(--tw-gradient-from-position);--tw-gradient-to:rgba(6,182,212,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-emerald-400{--tw-gradient-from:#34d399 var(--tw-gradient-from-position);--tw-gradient-to:rgba(52,211,153,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-emerald-400\/30{--tw-gradient-from:rgba(52,211,153,.3) var(--tw-gradient-from-position);--tw-gradient-to:rgba(52,211,153,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-emerald-500\/20{--tw-gradient-from:rgba(16,185,129,.2) var(--tw-gradient-from-position);--tw-gradient-to:rgba(16,185,129,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-emerald-500\/\[0\.07\]{--tw-gradient-from:rgba(16,185,129,.07) var(--tw-gradient-from-position);--tw-gradient-to:rgba(16,185,129,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-emerald-500\/\[0\.08\]{--tw-gradient-from:rgba(16,185,129,.08) var(--tw-gradient-from-position);--tw-gradient-to:rgba(16,185,129,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-emerald-500\/\[0\.12\]{--tw-gradient-from:rgba(16,185,129,.12) var(--tw-gradient-from-position);--tw-gradient-to:rgba(16,185,129,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-fuchsia-50\/90{--tw-gradient-from:rgba(253,244,255,.9) var(--tw-gradient-from-position);--tw-gradient-to:rgba(253,244,255,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-fuchsia-500\/10{--tw-gradient-from:rgba(217,70,239,.1) var(--tw-gradient-from-position);--tw-gradient-to:rgba(217,70,239,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-fuchsia-500\/20{--tw-gradient-from:rgba(217,70,239,.2) var(--tw-gradient-from-position);--tw-gradient-to:rgba(217,70,239,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-fuchsia-950\/40{--tw-gradient-from:rgba(74,4,78,.4) var(--tw-gradient-from-position);--tw-gradient-to:rgba(74,4,78,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-indigo-500\/20{--tw-gradient-from:rgba(99,102,241,.2) var(--tw-gradient-from-position);--tw-gradient-to:rgba(99,102,241,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-pink-500\/25{--tw-gradient-from:rgba(236,72,153,.25) var(--tw-gradient-from-position);--tw-gradient-to:rgba(236,72,153,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-red-500\/30{--tw-gradient-from:rgba(239,68,68,.3) var(--tw-gradient-from-position);--tw-gradient-to:rgba(239,68,68,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-rose-500\/20{--tw-gradient-from:rgba(244,63,94,.2) var(--tw-gradient-from-position);--tw-gradient-to:rgba(244,63,94,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-sky-500\/\[0\.08\]{--tw-gradient-from:rgba(14,165,233,.08) var(--tw-gradient-from-position);--tw-gradient-to:rgba(14,165,233,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-violet-50{--tw-gradient-from:#f5f3ff var(--tw-gradient-from-position);--tw-gradient-to:rgba(245,243,255,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-violet-500{--tw-gradient-from:#8b5cf6 var(--tw-gradient-from-position);--tw-gradient-to:rgba(139,92,246,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-violet-500\/10{--tw-gradient-from:rgba(139,92,246,.1) var(--tw-gradient-from-position);--tw-gradient-to:rgba(139,92,246,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-violet-500\/20{--tw-gradient-from:rgba(139,92,246,.2) var(--tw-gradient-from-position);--tw-gradient-to:rgba(139,92,246,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-violet-500\/\[0\.08\]{--tw-gradient-from:rgba(139,92,246,.08) var(--tw-gradient-from-position);--tw-gradient-to:rgba(139,92,246,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-violet-500\/\[0\.12\]{--tw-gradient-from:rgba(139,92,246,.12) var(--tw-gradient-from-position);--tw-gradient-to:rgba(139,92,246,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-violet-600\/10{--tw-gradient-from:rgba(124,58,237,.1) var(--tw-gradient-from-position);--tw-gradient-to:rgba(124,58,237,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-white\/\[0\.05\]{--tw-gradient-from:hsla(0,0%,100%,.05) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-white\/\[0\.06\]{--tw-gradient-from:hsla(0,0%,100%,.06) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-zinc-950\/95{--tw-gradient-from:rgba(9,9,11,.95) var(--tw-gradient-from-position);--tw-gradient-to:rgba(9,9,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.via-black\/25{--tw-gradient-to:transparent var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),rgba(0,0,0,.25) var(--tw-gradient-via-position),var(--tw-gradient-to)}.via-transparent{--tw-gradient-to:transparent var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),transparent var(--tw-gradient-via-position),var(--tw-gradient-to)}.via-white{--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),#fff var(--tw-gradient-via-position),var(--tw-gradient-to)}.via-zinc-950\/40{--tw-gradient-to:rgba(9,9,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),rgba(9,9,11,.4) var(--tw-gradient-via-position),var(--tw-gradient-to)}.via-zinc-950\/50{--tw-gradient-to:rgba(9,9,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),rgba(9,9,11,.5) var(--tw-gradient-via-position),var(--tw-gradient-to)}.via-zinc-950\/60{--tw-gradient-to:rgba(9,9,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),rgba(9,9,11,.6) var(--tw-gradient-via-position),var(--tw-gradient-to)}.via-zinc-950\/80{--tw-gradient-to:rgba(9,9,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),rgba(9,9,11,.8) var(--tw-gradient-via-position),var(--tw-gradient-to)}.via-zinc-950\/90{--tw-gradient-to:rgba(9,9,11,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),rgba(9,9,11,.9) var(--tw-gradient-via-position),var(--tw-gradient-to)}.to-black\/40{--tw-gradient-to:rgba(0,0,0,.4) var(--tw-gradient-to-position)}.to-blue-500{--tw-gradient-to:#3b82f6 var(--tw-gradient-to-position)}.to-cyan-400{--tw-gradient-to:#22d3ee var(--tw-gradient-to-position)}.to-cyan-50{--tw-gradient-to:#ecfeff var(--tw-gradient-to-position)}.to-cyan-50\/70{--tw-gradient-to:rgba(236,254,255,.7) var(--tw-gradient-to-position)}.to-cyan-500\/10{--tw-gradient-to:rgba(6,182,212,.1) var(--tw-gradient-to-position)}.to-cyan-500\/5{--tw-gradient-to:rgba(6,182,212,.05) var(--tw-gradient-to-position)}.to-cyan-500\/\[0\.06\]{--tw-gradient-to:rgba(6,182,212,.06) var(--tw-gradient-to-position)}.to-cyan-950\/20{--tw-gradient-to:rgba(8,51,68,.2) var(--tw-gradient-to-position)}.to-emerald-500\/\[0\.05\]{--tw-gradient-to:rgba(16,185,129,.05) var(--tw-gradient-to-position)}.to-fuchsia-50\/80{--tw-gradient-to:rgba(253,244,255,.8) var(--tw-gradient-to-position)}.to-fuchsia-500{--tw-gradient-to:#d946ef var(--tw-gradient-to-position)}.to-fuchsia-500\/10{--tw-gradient-to:rgba(217,70,239,.1) var(--tw-gradient-to-position)}.to-fuchsia-500\/5{--tw-gradient-to:rgba(217,70,239,.05) var(--tw-gradient-to-position)}.to-fuchsia-600\/25{--tw-gradient-to:rgba(192,38,211,.25) var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to:#f97316 var(--tw-gradient-to-position)}.to-orange-500\/10{--tw-gradient-to:rgba(249,115,22,.1) var(--tw-gradient-to-position)}.to-pink-500\/10{--tw-gradient-to:rgba(236,72,153,.1) var(--tw-gradient-to-position)}.to-rose-500\/10{--tw-gradient-to:rgba(244,63,94,.1) var(--tw-gradient-to-position)}.to-sky-500\/10{--tw-gradient-to:rgba(14,165,233,.1) var(--tw-gradient-to-position)}.to-slate-50{--tw-gradient-to:#f8fafc var(--tw-gradient-to-position)}.to-teal-500{--tw-gradient-to:#14b8a6 var(--tw-gradient-to-position)}.to-teal-500\/10{--tw-gradient-to:rgba(20,184,166,.1) var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to:transparent var(--tw-gradient-to-position)}.to-violet-500\/10{--tw-gradient-to:rgba(139,92,246,.1) var(--tw-gradient-to-position)}.to-violet-500\/25{--tw-gradient-to:rgba(139,92,246,.25) var(--tw-gradient-to-position)}.to-violet-500\/\[0\.06\]{--tw-gradient-to:rgba(139,92,246,.06) var(--tw-gradient-to-position)}.to-violet-500\/\[0\.08\]{--tw-gradient-to:rgba(139,92,246,.08) var(--tw-gradient-to-position)}.to-violet-600\/25{--tw-gradient-to:rgba(124,58,237,.25) var(--tw-gradient-to-position)}.to-violet-600\/30{--tw-gradient-to:rgba(124,58,237,.3) var(--tw-gradient-to-position)}.to-zinc-900\/90{--tw-gradient-to:rgba(24,24,27,.9) var(--tw-gradient-to-position)}.to-zinc-950\/80{--tw-gradient-to:rgba(9,9,11,.8) var(--tw-gradient-to-position)}.fill-zinc-400{fill:#a1a1aa}.stroke-amber-400{stroke:#fbbf24}.stroke-cyan-400{stroke:#22d3ee}.stroke-rose-400{stroke:#fb7185}.stroke-white\/10{stroke:hsla(0,0%,100%,.1)}.object-contain{object-fit:contain}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-1{padding-bottom:.25rem}.pb-16{padding-bottom:4rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-5{padding-left:1.25rem}.pr-1{padding-right:.25rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-\[0\.22em\]{letter-spacing:.22em}.tracking-\[0\.2em\]{letter-spacing:.2em}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[color\:var\(--text\)\]{color:var(--text)}.text-amber-100{--tw-text-opacity:1;color:rgb(254 243 199/var(--tw-text-opacity,1))}.text-amber-100\/80{color:hsla(48,96%,89%,.8)}.text-amber-100\/85{color:hsla(48,96%,89%,.85)}.text-amber-200{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}.text-amber-200\/80{color:hsla(48,97%,77%,.8)}.text-amber-200\/85{color:hsla(48,97%,77%,.85)}.text-amber-200\/90{color:hsla(48,97%,77%,.9)}.text-amber-300{--tw-text-opacity:1;color:rgb(252 211 77/var(--tw-text-opacity,1))}.text-amber-300\/80{color:rgba(252,211,77,.8)}.text-amber-400{--tw-text-opacity:1;color:rgb(251 191 36/var(--tw-text-opacity,1))}.text-amber-400\/95{color:rgba(251,191,36,.95)}.text-amber-500{--tw-text-opacity:1;color:rgb(245 158 11/var(--tw-text-opacity,1))}.text-amber-700{--tw-text-opacity:1;color:rgb(180 83 9/var(--tw-text-opacity,1))}.text-amber-800{--tw-text-opacity:1;color:rgb(146 64 14/var(--tw-text-opacity,1))}.text-cyan-100{--tw-text-opacity:1;color:rgb(207 250 254/var(--tw-text-opacity,1))}.text-cyan-100\/75{color:rgba(207,250,254,.75)}.text-cyan-100\/90{color:rgba(207,250,254,.9)}.text-cyan-200{--tw-text-opacity:1;color:rgb(165 243 252/var(--tw-text-opacity,1))}.text-cyan-200\/90{color:rgba(165,243,252,.9)}.text-cyan-300{--tw-text-opacity:1;color:rgb(103 232 249/var(--tw-text-opacity,1))}.text-cyan-300\/70{color:rgba(103,232,249,.7)}.text-cyan-300\/80{color:rgba(103,232,249,.8)}.text-cyan-300\/90{color:rgba(103,232,249,.9)}.text-cyan-400{--tw-text-opacity:1;color:rgb(34 211 238/var(--tw-text-opacity,1))}.text-cyan-400\/90{color:rgba(34,211,238,.9)}.text-cyan-50{--tw-text-opacity:1;color:rgb(236 254 255/var(--tw-text-opacity,1))}.text-cyan-600{--tw-text-opacity:1;color:rgb(8 145 178/var(--tw-text-opacity,1))}.text-cyan-700{--tw-text-opacity:1;color:rgb(14 116 144/var(--tw-text-opacity,1))}.text-cyan-800{--tw-text-opacity:1;color:rgb(21 94 117/var(--tw-text-opacity,1))}.text-cyan-900{--tw-text-opacity:1;color:rgb(22 78 99/var(--tw-text-opacity,1))}.text-cyan-950{--tw-text-opacity:1;color:rgb(8 51 68/var(--tw-text-opacity,1))}.text-emerald-100{--tw-text-opacity:1;color:rgb(209 250 229/var(--tw-text-opacity,1))}.text-emerald-100\/95{color:rgba(209,250,229,.95)}.text-emerald-200{--tw-text-opacity:1;color:rgb(167 243 208/var(--tw-text-opacity,1))}.text-emerald-200\/90{color:rgba(167,243,208,.9)}.text-emerald-300{--tw-text-opacity:1;color:rgb(110 231 183/var(--tw-text-opacity,1))}.text-emerald-300\/90{color:rgba(110,231,183,.9)}.text-emerald-400{--tw-text-opacity:1;color:rgb(52 211 153/var(--tw-text-opacity,1))}.text-emerald-400\/80{color:rgba(52,211,153,.8)}.text-emerald-400\/90{color:rgba(52,211,153,.9)}.text-emerald-50{--tw-text-opacity:1;color:rgb(236 253 245/var(--tw-text-opacity,1))}.text-emerald-700{--tw-text-opacity:1;color:rgb(4 120 87/var(--tw-text-opacity,1))}.text-emerald-800{--tw-text-opacity:1;color:rgb(6 95 70/var(--tw-text-opacity,1))}.text-emerald-950{--tw-text-opacity:1;color:rgb(2 44 34/var(--tw-text-opacity,1))}.text-fuchsia-100{--tw-text-opacity:1;color:rgb(250 232 255/var(--tw-text-opacity,1))}.text-fuchsia-200\/80{color:rgba(245,208,254,.8)}.text-fuchsia-300{--tw-text-opacity:1;color:rgb(240 171 252/var(--tw-text-opacity,1))}.text-fuchsia-300\/70{color:rgba(240,171,252,.7)}.text-fuchsia-400{--tw-text-opacity:1;color:rgb(232 121 249/var(--tw-text-opacity,1))}.text-indigo-100{--tw-text-opacity:1;color:rgb(224 231 255/var(--tw-text-opacity,1))}.text-indigo-200{--tw-text-opacity:1;color:rgb(199 210 254/var(--tw-text-opacity,1))}.text-indigo-300{--tw-text-opacity:1;color:rgb(165 180 252/var(--tw-text-opacity,1))}.text-indigo-700{--tw-text-opacity:1;color:rgb(67 56 202/var(--tw-text-opacity,1))}.text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.text-rose-100{--tw-text-opacity:1;color:rgb(255 228 230/var(--tw-text-opacity,1))}.text-rose-100\/95{color:rgba(255,228,230,.95)}.text-rose-200{--tw-text-opacity:1;color:rgb(254 205 211/var(--tw-text-opacity,1))}.text-rose-300{--tw-text-opacity:1;color:rgb(253 164 175/var(--tw-text-opacity,1))}.text-rose-400\/90{color:rgba(251,113,133,.9)}.text-sky-100{--tw-text-opacity:1;color:rgb(224 242 254/var(--tw-text-opacity,1))}.text-sky-100\/80{color:rgba(224,242,254,.8)}.text-sky-200{--tw-text-opacity:1;color:rgb(186 230 253/var(--tw-text-opacity,1))}.text-sky-400{--tw-text-opacity:1;color:rgb(56 189 248/var(--tw-text-opacity,1))}.text-slate-100{--tw-text-opacity:1;color:rgb(241 245 249/var(--tw-text-opacity,1))}.text-slate-200{--tw-text-opacity:1;color:rgb(226 232 240/var(--tw-text-opacity,1))}.text-slate-300{--tw-text-opacity:1;color:rgb(203 213 225/var(--tw-text-opacity,1))}.text-slate-300\/90{color:rgba(203,213,225,.9)}.text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}.text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.text-slate-600{--tw-text-opacity:1;color:rgb(71 85 105/var(--tw-text-opacity,1))}.text-slate-700{--tw-text-opacity:1;color:rgb(51 65 85/var(--tw-text-opacity,1))}.text-slate-800{--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity,1))}.text-slate-900{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}.text-violet-100{--tw-text-opacity:1;color:rgb(237 233 254/var(--tw-text-opacity,1))}.text-violet-200{--tw-text-opacity:1;color:rgb(221 214 254/var(--tw-text-opacity,1))}.text-violet-300{--tw-text-opacity:1;color:rgb(196 181 253/var(--tw-text-opacity,1))}.text-violet-300\/80{color:rgba(196,181,253,.8)}.text-violet-300\/90{color:rgba(196,181,253,.9)}.text-violet-400{--tw-text-opacity:1;color:rgb(167 139 250/var(--tw-text-opacity,1))}.text-violet-400\/90{color:rgba(167,139,250,.9)}.text-violet-600{--tw-text-opacity:1;color:rgb(124 58 237/var(--tw-text-opacity,1))}.text-violet-700{--tw-text-opacity:1;color:rgb(109 40 217/var(--tw-text-opacity,1))}.text-violet-800{--tw-text-opacity:1;color:rgb(91 33 182/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.text-white\/70{color:hsla(0,0%,100%,.7)}.text-white\/80{color:hsla(0,0%,100%,.8)}.text-zinc-100{--tw-text-opacity:1;color:rgb(244 244 245/var(--tw-text-opacity,1))}.text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.text-zinc-200\/90{color:hsla(240,6%,90%,.9)}.text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.text-zinc-600{--tw-text-opacity:1;color:rgb(82 82 91/var(--tw-text-opacity,1))}.text-zinc-700{--tw-text-opacity:1;color:rgb(63 63 70/var(--tw-text-opacity,1))}.underline-offset-2{text-underline-offset:2px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.accent-violet-500{accent-color:#8b5cf6}.opacity-35{opacity:.35}.opacity-40{opacity:.4}.opacity-45{opacity:.45}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-90{opacity:.9}.opacity-\[0\.06\]{opacity:.06}.opacity-\[0\.22\]{opacity:.22}.shadow-2xl{--tw-shadow:0 25px 50px -12px rgba(0,0,0,.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color)}.shadow-2xl,.shadow-inner{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 rgba(0,0,0,.05);--tw-shadow-colored:inset 0 2px 4px 0 var(--tw-shadow-color)}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-lg,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-black\/20{--tw-shadow-color:rgba(0,0,0,.2);--tw-shadow:var(--tw-shadow-colored)}.shadow-black\/30{--tw-shadow-color:rgba(0,0,0,.3);--tw-shadow:var(--tw-shadow-colored)}.shadow-black\/50{--tw-shadow-color:rgba(0,0,0,.5);--tw-shadow:var(--tw-shadow-colored)}.shadow-black\/80{--tw-shadow-color:rgba(0,0,0,.8);--tw-shadow:var(--tw-shadow-colored)}.shadow-cyan-100\/50{--tw-shadow-color:rgba(207,250,254,.5);--tw-shadow:var(--tw-shadow-colored)}.shadow-cyan-900\/10{--tw-shadow-color:rgba(22,78,99,.1);--tw-shadow:var(--tw-shadow-colored)}.shadow-emerald-900\/20{--tw-shadow-color:rgba(6,78,59,.2);--tw-shadow:var(--tw-shadow-colored)}.shadow-slate-200\/40{--tw-shadow-color:rgba(226,232,240,.4);--tw-shadow:var(--tw-shadow-colored)}.shadow-violet-200\/50{--tw-shadow-color:rgba(221,214,254,.5);--tw-shadow:var(--tw-shadow-colored)}.shadow-violet-500\/25{--tw-shadow-color:rgba(139,92,246,.25);--tw-shadow:var(--tw-shadow-colored)}.shadow-violet-900\/10{--tw-shadow-color:rgba(76,29,149,.1);--tw-shadow:var(--tw-shadow-colored)}.shadow-white\/5{--tw-shadow-color:hsla(0,0%,100%,.05);--tw-shadow:var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.ring,.ring-1{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.ring-amber-400\/25{--tw-ring-color:rgba(251,191,36,.25)}.ring-amber-400\/30{--tw-ring-color:rgba(251,191,36,.3)}.ring-amber-500\/20{--tw-ring-color:rgba(245,158,11,.2)}.ring-amber-500\/25{--tw-ring-color:rgba(245,158,11,.25)}.ring-amber-500\/30{--tw-ring-color:rgba(245,158,11,.3)}.ring-amber-500\/35{--tw-ring-color:rgba(245,158,11,.35)}.ring-cyan-100{--tw-ring-opacity:1;--tw-ring-color:rgb(207 250 254/var(--tw-ring-opacity,1))}.ring-cyan-200{--tw-ring-opacity:1;--tw-ring-color:rgb(165 243 252/var(--tw-ring-opacity,1))}.ring-cyan-400\/20{--tw-ring-color:rgba(34,211,238,.2)}.ring-cyan-400\/25{--tw-ring-color:rgba(34,211,238,.25)}.ring-cyan-400\/30{--tw-ring-color:rgba(34,211,238,.3)}.ring-cyan-400\/35{--tw-ring-color:rgba(34,211,238,.35)}.ring-cyan-500\/10{--tw-ring-color:rgba(6,182,212,.1)}.ring-cyan-500\/20{--tw-ring-color:rgba(6,182,212,.2)}.ring-cyan-500\/25{--tw-ring-color:rgba(6,182,212,.25)}.ring-cyan-500\/30{--tw-ring-color:rgba(6,182,212,.3)}.ring-cyan-500\/35{--tw-ring-color:rgba(6,182,212,.35)}.ring-emerald-200{--tw-ring-opacity:1;--tw-ring-color:rgb(167 243 208/var(--tw-ring-opacity,1))}.ring-emerald-400\/25{--tw-ring-color:rgba(52,211,153,.25)}.ring-emerald-400\/30{--tw-ring-color:rgba(52,211,153,.3)}.ring-emerald-500\/20{--tw-ring-color:rgba(16,185,129,.2)}.ring-emerald-500\/25{--tw-ring-color:rgba(16,185,129,.25)}.ring-emerald-500\/30{--tw-ring-color:rgba(16,185,129,.3)}.ring-fuchsia-500\/25{--tw-ring-color:rgba(217,70,239,.25)}.ring-fuchsia-500\/35{--tw-ring-color:rgba(217,70,239,.35)}.ring-indigo-400\/30{--tw-ring-color:rgba(129,140,248,.3)}.ring-indigo-500\/25{--tw-ring-color:rgba(99,102,241,.25)}.ring-rose-400\/25{--tw-ring-color:rgba(251,113,133,.25)}.ring-rose-400\/40{--tw-ring-color:rgba(251,113,133,.4)}.ring-rose-500\/15{--tw-ring-color:rgba(244,63,94,.15)}.ring-rose-500\/25{--tw-ring-color:rgba(244,63,94,.25)}.ring-rose-500\/30{--tw-ring-color:rgba(244,63,94,.3)}.ring-rose-500\/35{--tw-ring-color:rgba(244,63,94,.35)}.ring-sky-400\/40{--tw-ring-color:rgba(56,189,248,.4)}.ring-sky-500\/25{--tw-ring-color:rgba(14,165,233,.25)}.ring-slate-200{--tw-ring-opacity:1;--tw-ring-color:rgb(226 232 240/var(--tw-ring-opacity,1))}.ring-slate-500\/30{--tw-ring-color:rgba(100,116,139,.3)}.ring-violet-200{--tw-ring-opacity:1;--tw-ring-color:rgb(221 214 254/var(--tw-ring-opacity,1))}.ring-violet-400\/25{--tw-ring-color:rgba(167,139,250,.25)}.ring-violet-400\/35{--tw-ring-color:rgba(167,139,250,.35)}.ring-violet-400\/40{--tw-ring-color:rgba(167,139,250,.4)}.ring-violet-500\/20{--tw-ring-color:rgba(139,92,246,.2)}.ring-violet-500\/25{--tw-ring-color:rgba(139,92,246,.25)}.ring-violet-500\/30{--tw-ring-color:rgba(139,92,246,.3)}.ring-violet-500\/35{--tw-ring-color:rgba(139,92,246,.35)}.ring-white\/10{--tw-ring-color:hsla(0,0%,100%,.1)}.ring-white\/\[0\.03\]{--tw-ring-color:hsla(0,0%,100%,.03)}.ring-white\/\[0\.04\]{--tw-ring-color:hsla(0,0%,100%,.04)}.ring-white\/\[0\.05\]{--tw-ring-color:hsla(0,0%,100%,.05)}.ring-white\/\[0\.06\]{--tw-ring-color:hsla(0,0%,100%,.06)}.ring-zinc-500\/25{--tw-ring-color:hsla(240,4%,46%,.25)}.blur-3xl{--tw-blur:blur(64px)}.blur-3xl,.blur-\[100px\]{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-\[100px\]{--tw-blur:blur(100px)}.blur-\[120px\]{--tw-blur:blur(120px)}.blur-\[120px\],.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-2xl{--tw-backdrop-blur:blur(40px)}.backdrop-blur-2xl,.backdrop-blur-\[2px\]{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-\[2px\]{--tw-backdrop-blur:blur(2px)}.backdrop-blur-lg{--tw-backdrop-blur:blur(16px)}.backdrop-blur-lg,.backdrop-blur-md{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur:blur(12px)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px)}.backdrop-blur-sm,.backdrop-blur-xl{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur:blur(24px)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.glass{border-width:1px;border-color:hsla(0,0%,100%,.08);--tw-shadow:0 25px 50px -12px rgba(0,0,0,.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);--tw-shadow-color:rgba(0,0,0,.4);--tw-shadow:var(--tw-shadow-colored);background:var(--bg-card);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);transition:border-color .25s ease,box-shadow .25s ease,background .25s ease}html[data-theme=light] .glass{border-color:rgba(226,232,240,.9);--tw-shadow-color:rgba(148,163,184,.15);--tw-shadow:var(--tw-shadow-colored)}.section-title{font-size:1.125rem;line-height:1.75rem;font-weight:600;letter-spacing:-.025em;color:var(--text)}.section-lead{margin-top:.5rem}.meta-chip,.section-lead{font-size:.75rem;line-height:1rem;line-height:1.625;color:var(--muted)}.meta-chip{border-radius:1rem;border-width:1px;padding:.75rem 1rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;border-color:hsla(0,0%,100%,.1);background:rgba(0,0,0,.22)}html[data-theme=light] .meta-chip{border-color:rgba(226,232,240,.95);background:hsla(0,0%,100%,.72);color:var(--muted)}.tab-strip{margin-left:-.25rem;margin-right:-.25rem;display:flex;gap:.5rem;overflow-x:auto;padding-bottom:.375rem;padding-top:.125rem}@media (min-width:768px){.tab-strip{flex-wrap:wrap;overflow:visible}}.tab-strip{scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch}.tab-btn{flex-shrink:0;scroll-snap-align:start;border-radius:1rem;border-width:1px;padding:.625rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s}.tab-btn:focus-visible{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-color:rgba(34,211,238,.5);--tw-ring-offset-width:2px}.tab-btn{--tw-ring-offset-color:var(--ring-offset);border-color:hsla(0,0%,100%,.12);background:rgba(0,0,0,.22);color:#cbd5e1}.tab-btn:hover{border-color:rgba(34,211,238,.25);color:#e2e8f0}.tab-btn-active{border-color:rgba(34,211,238,.45)!important;background:rgba(34,211,238,.12)!important;color:#cffafe!important}html[data-theme=light] .tab-btn{border-color:#e2e8f0;background:hsla(0,0%,100%,.75);color:#475569}html[data-theme=light] .tab-btn:hover{border-color:rgba(6,182,212,.45);color:#0f766e}html[data-theme=light] .tab-btn-active{border-color:rgba(6,182,212,.55)!important;background:rgba(207,250,254,.55)!important;color:#0e7490!important}.link-tile{display:block;border-radius:1rem;border-width:1px;padding:.625rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s}.link-tile:focus-visible{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-color:rgba(34,211,238,.5);--tw-ring-offset-width:2px}.link-tile{--tw-ring-offset-color:var(--ring-offset);border-color:hsla(0,0%,100%,.1);background:rgba(0,0,0,.2);color:#f1f5f9}.link-tile:hover{border-color:rgba(34,211,238,.35)}html[data-theme=light] .link-tile{border-color:#e2e8f0;background:hsla(0,0%,100%,.65);color:#1e293b}.link-tile-accent{border-color:rgba(34,211,238,.28);background:rgba(34,211,238,.1);color:#ecfeff}.link-tile-accent:hover{border-color:rgba(34,211,238,.55)}html[data-theme=light] .link-tile-accent{border-color:rgba(6,182,212,.35);background:rgba(207,250,254,.65);color:#0e7490}.link-tile-warn{border-color:rgba(251,191,36,.25);background:rgba(251,191,36,.1);color:#fefce8}html[data-theme=light] .link-tile-warn{border-color:rgba(251,191,36,.45);background:hsla(55,92%,95%,.9);color:#78350f}.service-card{border-radius:1.5rem;border-width:1px;padding:1.25rem;transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;border-color:hsla(0,0%,100%,.08);background:rgba(0,0,0,.2)}.service-card:hover{box-shadow:0 12px 40px -24px rgba(34,211,238,.35)}html[data-theme=light] .service-card{border-color:rgba(226,232,240,.95);background:hsla(0,0%,100%,.55)}.panel-inset{border-radius:1rem;border-width:1px;padding:1rem;font-size:.875rem;line-height:1.25rem;border-color:hsla(0,0%,100%,.08);background:rgba(0,0,0,.2);color:#cbd5e1}html[data-theme=light] .panel-inset{border-color:rgba(226,232,240,.85);background:hsla(0,0%,100%,.5);color:#334155}.field-select{width:100%;border-radius:1rem;border-width:1px;padding:.75rem 1rem;font-size:.875rem;line-height:1.25rem;outline:2px solid transparent;outline-offset:2px;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s;border-color:hsla(0,0%,100%,.12);background:rgba(2,6,23,.55);color:#f8fafc}html[data-theme=light] .field-select{border-color:#e2e8f0;background:hsla(0,0%,100%,.9);color:#0f172a}.btn-focus:focus-visible{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-color:rgba(34,211,238,.5);--tw-ring-offset-width:2px}.btn-focus{--tw-ring-offset-color:var(--ring-offset)}.\[-ms-overflow-style\:none\]{-ms-overflow-style:none}.\[scrollbar-width\:none\]{scrollbar-width:none}:root{--bg-deep:#060912;--bg-card:rgba(16,22,36,.78);--accent:#22d3ee;--accent2:#a78bfa;--danger:#f43f5e;--ok:#34d399;--text:#e8edf7;--muted:#94a3b8;--ring-offset:#060912;color-scheme:dark}html[data-theme=light]{--bg-deep:#f1f5f9;--bg-card:hsla(0,0%,100%,.88);--text:#0f172a;--muted:#64748b;--ring-offset:#f1f5f9;color-scheme:light}html{scroll-behavior:smooth}body{color:var(--text);background:var(--bg-deep);min-height:100vh;font-family:var(--font-geist-sans),system-ui,sans-serif;overflow-x:hidden;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;transition:background-color .35s ease,color .25s ease}*{scrollbar-width:thin;scrollbar-color:rgba(148,163,184,.35) transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:rgba(148,163,184,.35);border-radius:999px}::-webkit-scrollbar-track{background:transparent}.app-bg-layer{position:fixed;inset:0;z-index:-1;opacity:.92;pointer-events:none;background:radial-gradient(ellipse 80% 50% at 50% -20%,rgba(34,211,238,.22),transparent),radial-gradient(ellipse 60% 40% at 100% 0,rgba(167,139,250,.18),transparent),radial-gradient(ellipse 50% 30% at 0 100%,rgba(59,130,246,.12),transparent);transition:opacity .35s ease}html[data-theme=light] .app-bg-layer{opacity:.75;background:radial-gradient(ellipse 80% 50% at 50% -20%,rgba(14,165,233,.12),transparent),radial-gradient(ellipse 60% 40% at 100% 0,rgba(139,92,246,.1),transparent),radial-gradient(ellipse 50% 30% at 0 100%,rgba(59,130,246,.08),transparent)}html[data-theme=light] .chart-surface{border-color:rgba(15,23,42,.12)!important;background:hsla(0,0%,100%,.65)!important}::selection{background:rgba(34,211,238,.25)}.safe-pb-nav{padding-bottom:calc(5.5rem + env(safe-area-inset-bottom, 0px))}@media (min-width:768px){.safe-pb-nav{padding-bottom:4rem}}@keyframes toast-in{0%{opacity:0;transform:translate(-50%,12px)}to{opacity:1;transform:translate(-50%)}}.animate-toast-in{animation:toast-in .35s ease-out both}@keyframes pulse-soft{0%,to{opacity:1}50%{opacity:.65}}.animate-pulse-soft{animation:pulse-soft 2s ease-in-out infinite}.log-scroll{scrollbar-width:thin;scrollbar-color:rgba(148,163,184,.35) transparent}.log-scroll::-webkit-scrollbar{width:6px;height:6px}.log-scroll::-webkit-scrollbar-thumb{background:rgba(148,163,184,.35);border-radius:6px}.portal-grid-bg{background-image:linear-gradient(hsla(0,0%,100%,.05) 1px,transparent 0),linear-gradient(90deg,hsla(0,0%,100%,.05) 1px,transparent 0);background-size:28px 28px}.lp-noise{background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E")}.studio-scene-shell{perspective:800px}.studio-scene-shimmer{background:linear-gradient(105deg,transparent 40%,rgba(244,114,182,.12) 50%,transparent 60%);background-size:200% 100%;animation:studio-shimmer 1.8s ease-in-out infinite}@keyframes studio-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.studio-live-badge{animation:studio-live-glow 2.4s ease-in-out infinite}@keyframes studio-live-glow{0%,to{box-shadow:0 0 0 0 rgba(244,63,94,0)}50%{box-shadow:0 0 12px 2px rgba(244,63,94,.25)}}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}*,:after,:before{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}.selection\:bg-violet-400\/25 ::selection{background-color:rgba(167,139,250,.25)}.selection\:bg-violet-500\/30 ::selection{background-color:rgba(139,92,246,.3)}.selection\:bg-violet-400\/25::selection{background-color:rgba(167,139,250,.25)}.selection\:bg-violet-500\/30::selection{background-color:rgba(139,92,246,.3)}.file\:mr-3::file-selector-button{margin-right:.75rem}.file\:rounded-md::file-selector-button{border-radius:.375rem}.file\:border-0::file-selector-button{border-width:0}.file\:bg-cyan-50::file-selector-button{--tw-bg-opacity:1;background-color:rgb(236 254 255/var(--tw-bg-opacity,1))}.file\:bg-cyan-500\/15::file-selector-button{background-color:rgba(6,182,212,.15)}.file\:px-3::file-selector-button{padding-left:.75rem;padding-right:.75rem}.file\:py-1\.5::file-selector-button{padding-top:.375rem;padding-bottom:.375rem}.file\:text-xs::file-selector-button{font-size:.75rem;line-height:1rem}.file\:font-semibold::file-selector-button{font-weight:600}.file\:text-cyan-100::file-selector-button{--tw-text-opacity:1;color:rgb(207 250 254/var(--tw-text-opacity,1))}.file\:text-cyan-800::file-selector-button{--tw-text-opacity:1;color:rgb(21 94 117/var(--tw-text-opacity,1))}.last\:border-0:last-child{border-width:0}.hover\:-translate-y-0\.5:hover{--tw-translate-y:-0.125rem}.hover\:-translate-y-0\.5:hover,.hover\:-translate-y-px:hover{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:-translate-y-px:hover{--tw-translate-y:-1px}.hover\:border-fuchsia-400\/35:hover{border-color:rgba(232,121,249,.35)}.hover\:border-violet-400\/20:hover{border-color:rgba(167,139,250,.2)}.hover\:border-violet-400\/30:hover{border-color:rgba(167,139,250,.3)}.hover\:border-white\/15:hover{border-color:hsla(0,0%,100%,.15)}.hover\:border-white\/20:hover{border-color:hsla(0,0%,100%,.2)}.hover\:bg-amber-500\/15:hover{background-color:rgba(245,158,11,.15)}.hover\:bg-amber-500\/25:hover{background-color:rgba(245,158,11,.25)}.hover\:bg-black\/45:hover{background-color:rgba(0,0,0,.45)}.hover\:bg-black\/60:hover{background-color:rgba(0,0,0,.6)}.hover\:bg-cyan-100:hover{--tw-bg-opacity:1;background-color:rgb(207 250 254/var(--tw-bg-opacity,1))}.hover\:bg-cyan-50:hover{--tw-bg-opacity:1;background-color:rgb(236 254 255/var(--tw-bg-opacity,1))}.hover\:bg-cyan-500\/15:hover{background-color:rgba(6,182,212,.15)}.hover\:bg-cyan-500\/25:hover{background-color:rgba(6,182,212,.25)}.hover\:bg-cyan-500\/30:hover{background-color:rgba(6,182,212,.3)}.hover\:bg-emerald-100:hover{--tw-bg-opacity:1;background-color:rgb(209 250 229/var(--tw-bg-opacity,1))}.hover\:bg-emerald-500\/15:hover{background-color:rgba(16,185,129,.15)}.hover\:bg-emerald-500\/20:hover{background-color:rgba(16,185,129,.2)}.hover\:bg-emerald-500\/25:hover{background-color:rgba(16,185,129,.25)}.hover\:bg-fuchsia-500\/20:hover{background-color:rgba(217,70,239,.2)}.hover\:bg-rose-500\/15:hover{background-color:rgba(244,63,94,.15)}.hover\:bg-rose-500\/25:hover{background-color:rgba(244,63,94,.25)}.hover\:bg-slate-100:hover{--tw-bg-opacity:1;background-color:rgb(241 245 249/var(--tw-bg-opacity,1))}.hover\:bg-slate-200\/60:hover{background-color:rgba(226,232,240,.6)}.hover\:bg-slate-50:hover{--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity,1))}.hover\:bg-violet-100:hover{--tw-bg-opacity:1;background-color:rgb(237 233 254/var(--tw-bg-opacity,1))}.hover\:bg-violet-500\/15:hover{background-color:rgba(139,92,246,.15)}.hover\:bg-violet-500\/25:hover{background-color:rgba(139,92,246,.25)}.hover\:bg-violet-500\/30:hover{background-color:rgba(139,92,246,.3)}.hover\:bg-white\/10:hover{background-color:hsla(0,0%,100%,.1)}.hover\:bg-white\/5:hover{background-color:hsla(0,0%,100%,.05)}.hover\:bg-white\/60:hover{background-color:hsla(0,0%,100%,.6)}.hover\:bg-white\/\[0\.03\]:hover{background-color:hsla(0,0%,100%,.03)}.hover\:bg-white\/\[0\.04\]:hover{background-color:hsla(0,0%,100%,.04)}.hover\:bg-white\/\[0\.06\]:hover{background-color:hsla(0,0%,100%,.06)}.hover\:bg-white\/\[0\.07\]:hover{background-color:hsla(0,0%,100%,.07)}.hover\:bg-white\/\[0\.08\]:hover{background-color:hsla(0,0%,100%,.08)}.hover\:bg-white\/\[0\.1\]:hover{background-color:hsla(0,0%,100%,.1)}.hover\:bg-zinc-500\/25:hover{background-color:hsla(240,4%,46%,.25)}.hover\:text-amber-300:hover{--tw-text-opacity:1;color:rgb(252 211 77/var(--tw-text-opacity,1))}.hover\:text-cyan-200:hover{--tw-text-opacity:1;color:rgb(165 243 252/var(--tw-text-opacity,1))}.hover\:text-rose-200:hover{--tw-text-opacity:1;color:rgb(254 205 211/var(--tw-text-opacity,1))}.hover\:text-slate-900:hover{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.hover\:text-zinc-200:hover{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.hover\:text-zinc-300:hover{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:ring-violet-400\/50:hover{--tw-ring-color:rgba(167,139,250,.5)}.hover\:brightness-110:hover{--tw-brightness:brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:border-amber-400:focus{--tw-border-opacity:1;border-color:rgb(251 191 36/var(--tw-border-opacity,1))}.focus\:border-amber-400\/60:focus{border-color:rgba(251,191,36,.6)}.focus\:border-cyan-400:focus{--tw-border-opacity:1;border-color:rgb(34 211 238/var(--tw-border-opacity,1))}.focus\:border-cyan-400\/60:focus{border-color:rgba(34,211,238,.6)}.focus\:border-indigo-400:focus{--tw-border-opacity:1;border-color:rgb(129 140 248/var(--tw-border-opacity,1))}.focus\:border-indigo-400\/60:focus{border-color:rgba(129,140,248,.6)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-emerald-500\/50:focus-visible{--tw-ring-color:rgba(16,185,129,.5)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-45:disabled{opacity:.45}@media (min-width:640px){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:w-auto{width:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-\[14rem_minmax\(0\2c 1fr\)\]{grid-template-columns:14rem minmax(0,1fr)}.sm\:grid-cols-\[minmax\(0\2c 1fr\)_7rem\]{grid-template-columns:minmax(0,1fr) 7rem}.sm\:flex-row{flex-direction:row}.sm\:flex-wrap{flex-wrap:wrap}.sm\:flex-nowrap{flex-wrap:nowrap}.sm\:items-start{align-items:flex-start}.sm\:items-end{align-items:flex-end}.sm\:items-center{align-items:center}.sm\:justify-center{justify-content:center}.sm\:justify-between{justify-content:space-between}.sm\:gap-2{gap:.5rem}.sm\:p-5{padding:1.25rem}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:text-4xl{font-size:2.25rem;line-height:2.5rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width:768px){.md\:bottom-6{bottom:1.5rem}.md\:hidden{display:none}.md\:h-56{height:14rem}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-\[12rem_minmax\(0\2c 1fr\)\]{grid-template-columns:12rem minmax(0,1fr)}.md\:grid-cols-\[minmax\(0\2c 1fr\)_6rem_14rem\]{grid-template-columns:minmax(0,1fr) 6rem 14rem}.md\:grid-cols-\[minmax\(0\2c 1fr\)_8rem_7rem_7rem\]{grid-template-columns:minmax(0,1fr) 8rem 7rem 7rem}}@media (min-width:1024px){.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[minmax\(0\2c 1fr\)_22rem\]{grid-template-columns:minmax(0,1fr) 22rem}.lg\:grid-cols-\[minmax\(0\2c 1fr\)_8rem\]{grid-template-columns:minmax(0,1fr) 8rem}.lg\:flex-row{flex-direction:row}.lg\:items-start{align-items:flex-start}.lg\:items-end{align-items:flex-end}.lg\:items-center{align-items:center}.lg\:justify-between{justify-content:space-between}.lg\:px-10{padding-left:2.5rem;padding-right:2.5rem}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:py-8{padding-top:2rem;padding-bottom:2rem}.lg\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width:1280px){.xl\:col-span-12{grid-column:span 12/span 12}.xl\:col-span-2{grid-column:span 2/span 2}.xl\:col-span-3{grid-column:span 3/span 3}.xl\:col-span-4{grid-column:span 4/span 4}.xl\:col-span-8{grid-column:span 8/span 8}.xl\:max-h-\[min\(24rem\2c 50vh\)\]{max-height:min(24rem,50vh)}.xl\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.xl\:grid-cols-\[0\.95fr\2c 1\.05fr\]{grid-template-columns:.95fr 1.05fr}.xl\:grid-cols-\[1\.1fr_0\.9fr\]{grid-template-columns:1.1fr .9fr}.xl\:grid-cols-\[18rem\2c 1fr\]{grid-template-columns:18rem 1fr}.xl\:grid-cols-\[minmax\(0\2c 1\.1fr\)_minmax\(20rem\2c 0\.8fr\)\]{grid-template-columns:minmax(0,1.1fr) minmax(20rem,.8fr)}.xl\:grid-cols-\[minmax\(0\2c 1\.1fr\)_minmax\(25rem\2c 0\.9fr\)\]{grid-template-columns:minmax(0,1.1fr) minmax(25rem,.9fr)}.xl\:grid-cols-\[minmax\(0\2c 1fr\)_minmax\(22rem\2c 0\.9fr\)\]{grid-template-columns:minmax(0,1fr) minmax(22rem,.9fr)}.xl\:items-stretch{align-items:stretch}}@media (min-width:1536px){.\32xl\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}}.\[\&\:\:-webkit-scrollbar\]\:hidden::-webkit-scrollbar{display:none}html[data-theme=light] .\[html\[data-theme\=light\]_\&\]\:border-cyan-600\/25{border-color:rgba(8,145,178,.25)}html[data-theme=light] .\[html\[data-theme\=light\]_\&\]\:border-slate-200\/60{border-color:rgba(226,232,240,.6)}html[data-theme=light] .\[html\[data-theme\=light\]_\&\]\:bg-white\/90{background-color:hsla(0,0%,100%,.9)}html[data-theme=light] .\[html\[data-theme\=light\]_\&\]\:bg-white\/95{background-color:hsla(0,0%,100%,.95)}html[data-theme=light] .\[html\[data-theme\=light\]_\&\]\:text-cyan-700{--tw-text-opacity:1;color:rgb(14 116 144/var(--tw-text-opacity,1))}html[data-theme=light] .\[html\[data-theme\=light\]_\&\]\:text-cyan-950{--tw-text-opacity:1;color:rgb(8 51 68/var(--tw-text-opacity,1))}html[data-theme=light] .\[html\[data-theme\=light\]_\&\]\:text-slate-600{--tw-text-opacity:1;color:rgb(71 85 105/var(--tw-text-opacity,1))} \ No newline at end of file diff --git a/d2ypp2/web-console/out/android.html b/d2ypp2/web-console/out/android.html index a3128fd..335468b 100644 --- a/d2ypp2/web-console/out/android.html +++ b/d2ypp2/web-console/out/android.html @@ -1 +1 @@ -无人直播系统 · live.local
← 返回门户首页无人直播 · 本页需与 API 同域(推荐 live.local:8001)

控制平面 · ARM Linux 开发板

无人直播控制中心

ShellCrash 负责代理上网;本机 FFmpeg 处理推流或 HDMI;Neko(Docker Chromium)或本机 Chromium 负责浏览器侧;开发板通过 USB 双头线 ADB 控制 AOSP。各模块独立,可分别启停。

live.local · unknown · unknown
正在连接控制台...
\ No newline at end of file +无人直播系统 · live.local
← 返回门户首页无人直播 · 本页需与 API 同域(推荐 live.local:8001)

控制平面 · ARM Linux 开发板

无人直播控制中心

ShellCrash 负责代理上网;本机 FFmpeg 处理推流或 HDMI;Neko(Docker Chromium)或本机 Chromium 负责浏览器侧;开发板通过 USB 双头线 ADB 控制 AOSP。各模块独立,可分别启停。

live.local · unknown · unknown
正在连接控制台...
\ No newline at end of file diff --git a/d2ypp2/web-console/out/android.txt b/d2ypp2/web-console/out/android.txt index 690f324..6845191 100644 --- a/d2ypp2/web-console/out/android.txt +++ b/d2ypp2/web-console/out/android.txt @@ -2,6 +2,6 @@ 3:I[3946,["500","static/chunks/500-ea37cc8de90441f7.js","246","static/chunks/246-17569b8e78acf2ac.js","357","static/chunks/app/android/page-5f87422c86e34807.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -0:["BfhpIk8_9MUFzvnv8gp2T",[[["",{"children":["android",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["android",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","android","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/267c3a238bcbe8cf.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] +0:["LUR--1jFr5J8xPFAxV9C7",[[["",{"children":["android",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["android",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","android","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/8082d3508f852f9a.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] 6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]] 1:null diff --git a/d2ypp2/web-console/out/console.html b/d2ypp2/web-console/out/console.html index cee7c62..4529150 100644 --- a/d2ypp2/web-console/out/console.html +++ b/d2ypp2/web-console/out/console.html @@ -1 +1 @@ -无人直播系统 · live.local
← 返回门户首页无人直播 · 本页需与 API 同域(推荐 live.local:8001)

控制平面 · ARM Linux 开发板

无人直播控制中心

ShellCrash 负责代理上网;本机 FFmpeg 处理推流或 HDMI;Neko(Docker Chromium)或本机 Chromium 负责浏览器侧;开发板通过 USB 双头线 ADB 控制 AOSP。各模块独立,可分别启停。

live.local · unknown · unknown
正在连接控制台...
\ No newline at end of file +无人直播系统 · live.local
← 返回门户首页无人直播 · 本页需与 API 同域(推荐 live.local:8001)

控制平面 · ARM Linux 开发板

无人直播控制中心

ShellCrash 负责代理上网;本机 FFmpeg 处理推流或 HDMI;Neko(Docker Chromium)或本机 Chromium 负责浏览器侧;开发板通过 USB 双头线 ADB 控制 AOSP。各模块独立,可分别启停。

live.local · unknown · unknown
正在连接控制台...
\ No newline at end of file diff --git a/d2ypp2/web-console/out/console.txt b/d2ypp2/web-console/out/console.txt index 51a4f4c..8a3e521 100644 --- a/d2ypp2/web-console/out/console.txt +++ b/d2ypp2/web-console/out/console.txt @@ -2,6 +2,6 @@ 3:I[6367,["500","static/chunks/500-ea37cc8de90441f7.js","246","static/chunks/246-17569b8e78acf2ac.js","443","static/chunks/app/console/page-f5a0052a001f3016.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -0:["BfhpIk8_9MUFzvnv8gp2T",[[["",{"children":["console",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["console",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","console","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/267c3a238bcbe8cf.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] +0:["LUR--1jFr5J8xPFAxV9C7",[[["",{"children":["console",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["console",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","console","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/8082d3508f852f9a.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] 6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]] 1:null diff --git a/d2ypp2/web-console/out/index.html b/d2ypp2/web-console/out/index.html index 9ebde96..bd56bc4 100644 --- a/d2ypp2/web-console/out/index.html +++ b/d2ypp2/web-console/out/index.html @@ -1 +1 @@ -无人直播系统 · live.local

总览

live.local · 夜间 · 前台自动刷新 · 最后同步 未同步

\ No newline at end of file +无人直播系统 · live.local

总览

live.local · 夜间 · 前台自动刷新 · 最后同步 未同步

\ No newline at end of file diff --git a/d2ypp2/web-console/out/index.txt b/d2ypp2/web-console/out/index.txt index 2bbf7a0..644fb24 100644 --- a/d2ypp2/web-console/out/index.txt +++ b/d2ypp2/web-console/out/index.txt @@ -1,7 +1,7 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[7340,["500","static/chunks/500-ea37cc8de90441f7.js","568","static/chunks/568-00230e48c631a139.js","246","static/chunks/246-17569b8e78acf2ac.js","348","static/chunks/348-80f0852ea47d5112.js","931","static/chunks/app/page-9ff3a078ec6e16cb.js"],"default",1] +3:I[7340,["500","static/chunks/500-ea37cc8de90441f7.js","568","static/chunks/568-00230e48c631a139.js","246","static/chunks/246-17569b8e78acf2ac.js","904","static/chunks/904-e2d4e288fe270492.js","931","static/chunks/app/page-5d458b26bf02fc41.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -0:["BfhpIk8_9MUFzvnv8gp2T",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/267c3a238bcbe8cf.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] +0:["LUR--1jFr5J8xPFAxV9C7",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/8082d3508f852f9a.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] 6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]] 1:null diff --git a/d2ypp2/web-console/out/shellcrash.html b/d2ypp2/web-console/out/shellcrash.html index 266b4d3..4735b68 100644 --- a/d2ypp2/web-console/out/shellcrash.html +++ b/d2ypp2/web-console/out/shellcrash.html @@ -1 +1 @@ -无人直播系统 · live.local
← 返回门户首页无人直播 · 本页需与 API 同域(推荐 live.local:8001)

控制平面 · ARM Linux 开发板

无人直播控制中心

ShellCrash 负责代理上网;本机 FFmpeg 处理推流或 HDMI;Neko(Docker Chromium)或本机 Chromium 负责浏览器侧;开发板通过 USB 双头线 ADB 控制 AOSP。各模块独立,可分别启停。

live.local · unknown · unknown
正在连接控制台...
\ No newline at end of file +无人直播系统 · live.local
← 返回门户首页无人直播 · 本页需与 API 同域(推荐 live.local:8001)

控制平面 · ARM Linux 开发板

无人直播控制中心

ShellCrash 负责代理上网;本机 FFmpeg 处理推流或 HDMI;Neko(Docker Chromium)或本机 Chromium 负责浏览器侧;开发板通过 USB 双头线 ADB 控制 AOSP。各模块独立,可分别启停。

live.local · unknown · unknown
正在连接控制台...
\ No newline at end of file diff --git a/d2ypp2/web-console/out/shellcrash.txt b/d2ypp2/web-console/out/shellcrash.txt index 0c83ba5..d2f014b 100644 --- a/d2ypp2/web-console/out/shellcrash.txt +++ b/d2ypp2/web-console/out/shellcrash.txt @@ -2,6 +2,6 @@ 3:I[3398,["500","static/chunks/500-ea37cc8de90441f7.js","246","static/chunks/246-17569b8e78acf2ac.js","6","static/chunks/app/shellcrash/page-0c73522b1d5c8dc1.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -0:["BfhpIk8_9MUFzvnv8gp2T",[[["",{"children":["shellcrash",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["shellcrash",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","shellcrash","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/267c3a238bcbe8cf.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] +0:["LUR--1jFr5J8xPFAxV9C7",[[["",{"children":["shellcrash",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["shellcrash",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","shellcrash","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/8082d3508f852f9a.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] 6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]] 1:null diff --git a/d2ypp2/web-console/out/youtube-events.html b/d2ypp2/web-console/out/youtube-events.html index 9ab450f..af47cda 100644 --- a/d2ypp2/web-console/out/youtube-events.html +++ b/d2ypp2/web-console/out/youtube-events.html @@ -1 +1 @@ -无人直播系统 · live.local

总览

live.local · 夜间 · 前台自动刷新 · 最后同步 未同步

\ No newline at end of file +无人直播系统 · live.local

总览

live.local · 夜间 · 前台自动刷新 · 最后同步 未同步

\ No newline at end of file diff --git a/d2ypp2/web-console/out/youtube-events.txt b/d2ypp2/web-console/out/youtube-events.txt index c72c731..1897d8b 100644 --- a/d2ypp2/web-console/out/youtube-events.txt +++ b/d2ypp2/web-console/out/youtube-events.txt @@ -1,7 +1,7 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[316,["500","static/chunks/500-ea37cc8de90441f7.js","568","static/chunks/568-00230e48c631a139.js","246","static/chunks/246-17569b8e78acf2ac.js","348","static/chunks/348-80f0852ea47d5112.js","851","static/chunks/app/youtube-events/page-a88e6c919a0b42a9.js"],"default",1] +3:I[316,["500","static/chunks/500-ea37cc8de90441f7.js","568","static/chunks/568-00230e48c631a139.js","246","static/chunks/246-17569b8e78acf2ac.js","904","static/chunks/904-e2d4e288fe270492.js","851","static/chunks/app/youtube-events/page-d361f3631be60b8a.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -0:["BfhpIk8_9MUFzvnv8gp2T",[[["",{"children":["youtube-events",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["youtube-events",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","youtube-events","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/267c3a238bcbe8cf.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] +0:["LUR--1jFr5J8xPFAxV9C7",[[["",{"children":["youtube-events",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["youtube-events",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","youtube-events","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/8082d3508f852f9a.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] 6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]] 1:null diff --git a/d2ypp2/web.py b/d2ypp2/web.py index eb834c4..4678c1b 100644 --- a/d2ypp2/web.py +++ b/d2ypp2/web.py @@ -2003,9 +2003,11 @@ async def status( recent_error = "" full_status = configured_hint else: + status_log_lines = 80 if light and process_family(process) == "youtube" else MAX_LOG_LINES + status_err_lines = 24 if light and process_family(process) == "youtube" else MAX_LOG_LINES recent_log, recent_error, ffmpeg_pids = await asyncio.gather( - read_log_path_normalized(info.get("out_path"), MAX_LOG_LINES), - read_log_path_normalized(info.get("err_path"), MAX_LOG_LINES), + read_log_path_normalized(info.get("out_path"), status_log_lines), + read_log_path_normalized(info.get("err_path"), status_err_lines), process_backend.live_ffmpeg_pids(process, info), ) diff --git a/d2ypp2/youtube.py b/d2ypp2/youtube.py index d409239..4d3eeea 100644 --- a/d2ypp2/youtube.py +++ b/d2ypp2/youtube.py @@ -42,6 +42,7 @@ from src.proxy import ProxyDetector from src.runtime_bootstrap import load_msg_push_exports from src.youtube_config_paths import resolve_youtube_style_config_paths from src.youtube_runtime import normalize_youtube_video_save_type +from src.recorder_config import read_recorder_setting, recorder_config_target_path, SHARED_RECORDER_SECTIONS from src.utils import logger from src import utils from ffmpeg_install import ( @@ -1635,25 +1636,22 @@ def start_record(url_data: tuple, count_variable: int = -1) -> None: error_window.append(1) else: - try: - from douyin_youtube_ffplay import start_douyin_youtube_ffplay + from douyin_youtube_ffplay import start_douyin_youtube_ffplay - start_douyin_youtube_ffplay( - title=title_in_name, - anchor_name=anchor_name, - real_url=real_url, - rec_info=rec_info, - record_name=record_name, - recording=recording, - recording_time_list=recording_time_list, - running_list=running_list, - clear_record_info=clear_record_info, - color_obj=color_obj, - config_file=config_file, - record_url=record_url, - ) - finally: - clear_record_info(record_name, record_url) + start_douyin_youtube_ffplay( + title=title_in_name, + anchor_name=anchor_name, + real_url=real_url, + rec_info=rec_info, + record_name=record_name, + recording=recording, + recording_time_list=recording_time_list, + running_list=running_list, + clear_record_info=clear_record_info, + color_obj=color_obj, + config_file=config_file, + record_url=record_url, + ) count_time = time.time() @@ -1786,6 +1784,17 @@ utils.remove_duplicate_lines(url_config_file) def read_config_value(config_parser: configparser.RawConfigParser, section: str, option: str, default_value: Any) \ -> Any: + if section in SHARED_RECORDER_SECTIONS: + value = read_recorder_setting( + base_dir=script_path, + lane_config_file=config_file, + section=section, + option=option, + default=default_value, + encoding=text_encoding, + ) + if str(value).strip(): + return value try: config_parser.read(config_file, encoding=text_encoding) @@ -1801,9 +1810,25 @@ def read_config_value(config_parser: configparser.RawConfigParser, section: str, config_parser.add_section('账号密码') return config_parser.get(section, option) except (configparser.NoSectionError, configparser.NoOptionError): + target = recorder_config_target_path( + base_dir=script_path, + lane_config_file=config_file, + section=section, + ) config_parser.set(section, option, str(default_value)) - with open(config_file, 'w', encoding=text_encoding) as f: + with open(target, 'w', encoding=text_encoding) as f: config_parser.write(f) + if section in SHARED_RECORDER_SECTIONS: + shared_value = read_recorder_setting( + base_dir=script_path, + lane_config_file=config_file, + section=section, + option=option, + default=default_value, + encoding=text_encoding, + ) + if str(shared_value).strip(): + return shared_value return default_value