⛅ Sync 2026-09-28 17:06:29

This commit is contained in:
github-actions[bot] committed 2026-09-28 17:06:29 +08:00
1 parent 86e1d0663a
commit 8e6f80e195
138 files changed
+975 -606

No files matched your search

+6 -5
View File
@@ -3,16 +3,16 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=honk
PKG_VERSION:=0.0.1_beta81
PKG_RELEASE:=1
PKG_VERSION:=0.0.1_beta82
PKG_RELEASE:=2
# Raw upstream release tag. It keeps the dots in qualifiers (e.g. v0.0.1.beta.49)
# because that is what the GitHub release asset name uses.
HONK_RELEASE_TAG:=v0.0.1.beta.81
HONK_RELEASE_TAG:=v0.0.1.beta.82
# SHA256 of each release tarball, kept in sync by scripts/update_honk_version.sh.
HONK_HASH_X86_64:=88e5c3b29200c6ad729cc89636e14a452d974108cd08852c9c1e44074d23e10e
HONK_HASH_AARCH64:=b160a3c8674556222b2b29ce6c975bc346f7ce3cddeb049474c6ca9e0a8191a6
HONK_HASH_X86_64:=075db4ebb3dd1b51fb59c8e4c3de5853bd837f5f5ca5fd0ef7698b574f8f9a88
HONK_HASH_AARCH64:=6b66319bda2110d075e8f2788d728fdf75ca36dffdb3884a192803a34a529c59
PKG_LICENSE:=AGPL-3.0-only
PKG_LICENSE_FILE:=LICENSE
@@ -89,6 +89,7 @@ define Package/honk/install
$(INSTALL_CONF) $(CURDIR)/files/config.d/node.dae $(1)/etc/honk/config.d/node.dae
$(INSTALL_CONF) $(CURDIR)/files/config.d/route.dae $(1)/etc/honk/config.d/route.dae
$(INSTALL_CONF) $(CURDIR)/files/config.d/dns.dae $(1)/etc/honk/config.d/dns.dae
$(INSTALL_CONF) $(CURDIR)/files/config.d/api.dae $(1)/etc/honk/config.d/api.dae
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) $(CURDIR)/files/honk.config $(1)/etc/config/honk
+14
View File
@@ -0,0 +1,14 @@
# api.dae
# Configure API access for HONK dashboards and controllers.
experimental {
native_api {
enabled: true
listen: '0.0.0.0:9527'
secret: 'honk114514'
ui: '/etc/honk/dashboard'
config_write: true
geosite_download_url: 'https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/release/geosite.dat'
geoip_download_url: 'https://raw.githubusercontent.com/QiuSimons/geoip-moedove/refs/heads/main/geoip.dat'
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ dns {
#ipversion_prefer: 4
upstream {
local: 'udp://127.0.0.1:53' -> direct
remote: 'tcp+udp://dns.google:53'
remote: 'tcp+udp://one.one.one.one:53'
}
routing {
request {
+4 -14
View File
@@ -22,21 +22,11 @@ global {
udp_check_dns: 'dns.google.com:53', '8.8.8.8', '2001:4860:4860::8888'
}
# using for enable experimental features
# native-api, clash-api, cache-file
# API access (native_api / clash_api) is configured separately in config.d/api.dae
# to allow web dashboard configuration without locking the config as read-only.
#
# Optional cache-file configuration:
#experimental {
# native_api {
# enabled: true
# listen: '0.0.0.0:9527'
# secret: 'honk'
# ui: '/etc/honk/dashboard'
# }
# clash_api {
# external_controller: '0.0.0.0:9090'
# external_ui: '/etc/honk/zashboard'
# secret: ''
# default_mode: 'Rule'
# }
# cache_file {
# enabled: true
# path: '/etc/honk/cache.db'
+3 -2
View File
@@ -17,8 +17,9 @@ HONK_NETNS_PATH="/run/netns/$HONK_NETNS_NAME"
RESOLV_HONK="/tmp/resolv.conf.honk"
set_chmod_640() {
mkdir -p /etc/honk/config.d
chmod -R 640 /etc/honk/ 2>/dev/null || true
mkdir -p /etc/honk/config.d /etc/honk/state
chmod -R u=rwX,go= /etc/honk 2>/dev/null || true
chmod 700 /etc/honk /etc/honk/config.d /etc/honk/state 2>/dev/null || true
}
cleanup_netns() {
+2 -2
View File
@@ -12,7 +12,7 @@ PKG_ARCH_LINKEASE:=$(ARCH)
PKG_NAME:=linkease-common-bin
# use PKG_SOURCE_DATE instead of PKG_VERSION for compitable
PKG_SOURCE_DATE:=1.7.5
PKG_RELEASE:=40
PKG_RELEASE:=41
ARCH_HEXCODE:=
ifeq ($(ARCH),x86_64)
@@ -28,7 +28,7 @@ else ifeq ($(ARCH),mipsel)
ARCH_HEXCODE=1b0c
endif
PKG_SOURCE_VERSION:=9d3701bbe8fa141bd5b8293fd19651a8c1704050
PKG_SOURCE_VERSION:=6a7d4c0d89d4e2bbcd8ba6558719353e91846255
PKG_SOURCE:=linkease-common-bin-$(PKG_SOURCE_DATE)-linux-$(PKG_ARCH_LINKEASE).tar.gz
PKG_SOURCE_URL:=https://github.com/istoreos/istoreos-app-hub/releases/download/linkease-runtime-v$(PKG_SOURCE_DATE)/
PKG_BUILD_DIR:=$(BUILD_DIR)/linkease-common-bin-$(PKG_SOURCE_DATE)-linux-$(PKG_ARCH_LINKEASE)
+2 -2
View File
@@ -12,7 +12,7 @@ PKG_ARCH_LINKEASE:=$(ARCH)
PKG_NAME:=linkease
# use PKG_SOURCE_DATE instead of PKG_VERSION for compitable
PKG_SOURCE_DATE:=1.7.5
PKG_RELEASE:=43
PKG_RELEASE:=44
ARCH_HEXCODE:=
ifeq ($(ARCH),x86_64)
@@ -28,7 +28,7 @@ else ifeq ($(ARCH),mipsel)
ARCH_HEXCODE=1b0c
endif
PKG_SOURCE_VERSION:=9d3701bbe8fa141bd5b8293fd19651a8c1704050
PKG_SOURCE_VERSION:=6a7d4c0d89d4e2bbcd8ba6558719353e91846255
PKG_SOURCE:=linkease-bin-$(PKG_SOURCE_DATE)-linux-$(PKG_ARCH_LINKEASE).tar.gz
PKG_SOURCE_URL:=https://github.com/istoreos/istoreos-app-hub/releases/download/linkease-runtime-v$(PKG_SOURCE_DATE)/
PKG_BUILD_DIR:=$(BUILD_DIR)/linkease-bin-$(PKG_SOURCE_DATE)-linux-$(PKG_ARCH_LINKEASE)
+2 -2
View File
@@ -11,7 +11,7 @@ PKG_ARCH_LINKEASE:=$(ARCH)
PKG_NAME:=linkeasefull
# use PKG_SOURCE_DATE instead of PKG_VERSION for compitable
PKG_SOURCE_DATE:=3.0.22
PKG_RELEASE:=42
PKG_RELEASE:=43
ARCH_HEXCODE:=
ifeq ($(ARCH),x86_64)
@@ -24,7 +24,7 @@ LINKEASE_RUNTIME_ARCH:=arm64
PKG_HASH:=skip
endif
PKG_SOURCE_VERSION:=9d3701bbe8fa141bd5b8293fd19651a8c1704050
PKG_SOURCE_VERSION:=6a7d4c0d89d4e2bbcd8ba6558719353e91846255
PKG_SOURCE:=linkease-runtime-$(PKG_SOURCE_DATE)-linux-$(LINKEASE_RUNTIME_ARCH).tar.gz
PKG_SOURCE_URL:=https://github.com/istoreos/istoreos-app-hub/releases/download/linkeasefull-runtime-v$(PKG_SOURCE_DATE)/
PKG_BUILD_DIR:=$(BUILD_DIR)/linkease-runtime-$(PKG_SOURCE_DATE)-linux-$(LINKEASE_RUNTIME_ARCH)
+1 -1
View File
@@ -1 +1 @@
release
snapshot
+1 -1
View File
@@ -1 +1 @@
26.268.33051~dd3d1cb
26.270.72820~0818828
+1 -1
View File
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
LUCI_TITLE:=AgentFlow
PKG_VERSION:=1.0.1
PKG_RELEASE:=9
PKG_RELEASE:=10
LUCI_DEPENDS:=+agentflow +luci-compat +luci-lib-taskd +luci-lib-linkeaseauth +linkease-app-entry
LUCI_MINIFY_CSS:=0
LUCI_MINIFY_JS:=0
@@ -1,9 +1,13 @@
import json
from pathlib import Path
import unittest
APP_DIR = Path(__file__).resolve().parents[1]
META_MAKEFILE = APP_DIR.parent / "app-meta-agentflow/Makefile"
AGENTFLOW_DIR = APP_DIR.parent
META_DIR = AGENTFLOW_DIR / "app-meta-agentflow"
META_MAKEFILE = META_DIR / "Makefile"
RUNTIME_DIR = AGENTFLOW_DIR / "agentflow"
class AgentFlowLuciOpenContractTest(unittest.TestCase):
@@ -18,7 +22,7 @@ class AgentFlowLuciOpenContractTest(unittest.TestCase):
self.assertIn("+luci-lib-linkeaseauth", makefile)
self.assertIn("+linkease-app-entry", makefile)
self.assertIn("PKG_RELEASE:=3", meta)
self.assertIn("PKG_RELEASE:=2", meta)
self.assertIn("META_LUCI_ENTRY:=/cgi-bin/luci/admin/services/agentflow", meta)
self.assertIn('entry({"admin", "services", "agentflow", "open"}', controller)
self.assertIn("open.sysauth = false", controller)
@@ -33,6 +37,50 @@ class AgentFlowLuciOpenContractTest(unittest.TestCase):
self.assertIn('url("admin/services/agentflow/open")', status)
self.assertNotIn('window.location.hostname + ":" + st.port', status)
def test_app_meta_autoconfigures_agentflow_and_exposes_management_entry(self):
meta = META_MAKEFILE.read_text(encoding="utf-8")
config = (META_DIR / "config.sh").read_text(encoding="utf-8")
entry = (META_DIR / "entry.sh").read_text(encoding="utf-8")
self.assertIn("META_AUTOCONF:=path enable", meta)
self.assertIn('[ -n "$ISTORE_CONF_DIR" ] || exit 1', config)
self.assertIn('data_dir="$ISTORE_CONF_DIR/AgentFlow"', config)
self.assertIn('set agentflow.@agentflow[0].enabled="$enabled"', config)
self.assertIn('set agentflow.@agentflow[0].data_dir="$data_dir"', config)
self.assertIn('ISTORE_DONT_START', config)
self.assertIn('if [ "$enabled" = "1" ]; then', config)
self.assertIn('/etc/init.d/agentflow restart', config)
self.assertIn('/etc/init.d/agentflow stop || true', config)
self.assertNotIn('/etc/init.d/agentflow restart || true', config)
self.assertIn('json_add_string "app" "agentflow"', entry)
self.assertIn('json_add_boolean "docker" "0"', entry)
self.assertIn('pidof agentflow', entry)
self.assertIn('json_add_string "web" ":${port}${base_path}"', entry)
self.assertIn(
'json_add_string "href" "/cgi-bin/luci/admin/services/agentflow"',
entry,
)
self.assertIn('/etc/init.d/agentflow start', entry)
self.assertIn('/etc/init.d/agentflow stop', entry)
self.assertNotIn("linkease_apps/open", entry)
def test_app_meta_and_desktop_icons_have_single_owners(self):
manifest = json.loads(
(RUNTIME_DIR / "files/agentflow-plugin.json").read_text(encoding="utf-8")
)
self.assertEqual(manifest["id"], "agentflow")
self.assertEqual(manifest["icon"], "logo.svg")
self.assertEqual(manifest["staticRoot"], "/usr/share/agentflow/www")
self.assertTrue((RUNTIME_DIR / "files/www/logo.svg").is_file())
meta_logo = META_DIR / "logo.png"
self.assertTrue(meta_logo.is_file())
self.assertTrue(meta_logo.read_bytes().startswith(b"\x89PNG\r\n\x1a\n"))
self.assertFalse(
(META_DIR / "root/usr/share/linkeasefull/desktop-apps.d").exists(),
"agentflow runtime already owns the desktop manifest",
)
if __name__ == "__main__":
unittest.main()
@@ -56,6 +56,14 @@ const congestion_controller = [
['bbr', _('bbr')],
];
const ipstack_congestion_controller = [
['', _('Keep default')],
['cubic', _('cubic')],
['reno', _('reno')],
['bbr', _('bbr')],
['bbr3', _('bbr3')],
];
const bbr_profiles = [
['', _('Keep default')],
['standard', _('Standard')],
@@ -2149,6 +2157,7 @@ return baseclass.extend({
monospacefonts,
checkurls,
congestion_controller,
ipstack_congestion_controller,
bbr_profiles,
stunserver,
dashrepos,
@@ -512,13 +512,13 @@ return view.extend({
so = ss.option(form.RichListValue, 'tun_stack', _('Stack'),
_('Tun stack.'));
so.value('system', _('System'), _('Less compatibility and sometimes better performance.'));
so.value('mips', _('mihomo IP stack (MIPS)'));
if (features.with_gvisor) {
so.value('gvisor', _('gVisor'), _('Based on google/gvisor.'));
so.value('mixed', _('Mixed'), _('Mixed <code>system</code> TCP stack and <code>gVisor</code> UDP stack.'));
}
so.value('mips', _('mihomo IP stack (MIPS)'));
so.default = 'system';
so.value('system', _('System'), _('Less compatibility and sometimes better performance.'));
so.default = 'mips';
so.rmempty = false;
so = ss.option(form.Value, 'tun_mtu', _('MTU'));
@@ -545,6 +545,13 @@ return view.extend({
so = ss.option(form.Flag, 'tun_disable_icmp_forwarding', _('Disable ICMP Forwarding'),
_('Prevent ICMP loopback issues in some cases. Ping will not show real delay.'));
so.default = so.enabled;
so = ss.option(form.ListValue, 'tun_congestion_controller', _('Congestion controller'));
so.default = hm.ipstack_congestion_controller[0][0];
hm.ipstack_congestion_controller.forEach((res) => {
so.value.apply(so, res);
})
so.depends('tun_stack', 'mips');
/* Inbound END */
/* TLS START */
@@ -1200,17 +1200,18 @@ return view.extend({
so = ss.taboption('field_general', form.ListValue, 'ipstack', _('IP stack'));
so.value('', _('Keep default'));
so.value('auto', _('Auto'));
so.value('gvisor', _('gVisor'));
so.value('mips', _('mihomo IP stack (MIPS)'));
if (features.with_gvisor) {
so.value('gvisor', _('gVisor'));
}
so.depends({type: /^(zerotier|wireguard|masque|openvpn)$/});
so.modalonly = true;
so = ss.taboption('field_general', form.ListValue, 'ipstack_congestion_controller', _('IP stack') + ': ' + _('Congestion controller'));
so.value('', _('Keep default'));
so.value('cubic', _('cubic'));
so.value('reno', _('reno'));
so.value('bbr', _('bbr'));
so.value('bbr3', _('bbr3'));
so.default = hm.ipstack_congestion_controller[0][0];
hm.ipstack_congestion_controller.forEach((res) => {
so.value.apply(so, res);
})
so.depends({ipstack: /^(auto|mips)$/}); // not empty not gvisor
so.modalonly = true;
@@ -403,6 +403,7 @@ if (match(proxy_mode, /tun/))
"udp-timeout": durationToSecond(uci.get(uciconf, uciinbound, 'tun_udp_timeout')) || 300,
"endpoint-independent-nat": strToBool(uci.get(uciconf, uciinbound, 'tun_endpoint_independent_nat')),
"disable-icmp-forwarding": (uci.get(uciconf, uciinbound, 'tun_disable_icmp_forwarding') === '0') ? false : true,
"congestion-controller": uci.get(uciconf, uciinbound, 'tun_congestion_controller'),
"auto-detect-interface": true
};
/* Inbound END */
+1 -1
View File
@@ -2,7 +2,7 @@
include $(TOPDIR)/rules.mk
PKG_VERSION:=1.0.0-20230829
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_MAINTAINER:=forcedata
LUCI_TITLE:=LuCI support for forcedata
+69
View File
@@ -0,0 +1,69 @@
[简体中文](README.md) | [English](README.en.md)
# luci-app-forcedata
A LuCI management plugin for the "ForceData (原力云)" edge-computing client on OpenWrt / iStoreOS.
![Platform](https://img.shields.io/badge/platform-OpenWrt%20%7C%20iStoreOS-blue)
![Arch](https://img.shields.io/badge/arch-x86__64%20%7C%20aarch64-green)
![UI](https://img.shields.io/badge/LuCI-Lua-yellow)
## 📖 Introduction
ForceData (YuanLiYun) is an edge-computing / bandwidth-sharing platform: you run its client on your own device and share idle bandwidth online for a certain monthly cash reward. This plugin moves the whole deployment into LuCI: after installation it automatically downloads and starts the forcecloud client, keeps it alive with minute-level checks and self-updates, and provides a service status page with a QR-code binding entry in the router admin UI.
It targets owners of OpenWrt / iStoreOS soft routers and TV boxes who want to run ForceData without touching the command line. The plugin is built on the iStore app framework (`luci-lib-taskd` + istorec management script), so it behaves like other iStoreOS apps.
## ✨ Features
- LuCI web UI under "Services → Forcedata", showing live service status
- Automatically generates an 18-digit numeric UID on first use, stored in `/etc/config/forcedata` (do not change it, or deployment breaks)
- One-click install / upgrade of the forcecloud client, auto-selecting x86_64 / aarch64 builds with MD5 verification
- crontab-based self-check every minute: restarts the process when it dies, and skips updates when the root partition is 100% full
- Pushes DingTalk robot alerts when the client restarts unexpectedly or multiple probes start on one host
- The status page renders a binding QR code to link the device via the "ForceData" WeChat mini program
- The management script supports install / upgrade / rm / start / stop / restart / status sub-commands
## 🛠 Tech Stack
- LuCI (Lua) + iStore/taskd app framework, depends on `luci-lib-taskd`, package arch `all`
- busybox ash shell management script
- Page QR code rendered with qrcode.min.js
## 🚀 Quick Start
1. Build: copy this repo into the `package/` directory of an OpenWrt/LeDE source tree, select `LuCI → Applications → luci-app-forcedata` in `make menuconfig`, then build the ipk and install it on the router.
2. On first installation, uci-defaults registers a crontab keep-alive job that runs every minute.
3. Log in to LuCI, open "Services → Forcedata", confirm the UID, and wait for the status to become Running.
4. Click "Running, click to show QR" to render the QR code, then scan it with the "ForceData" WeChat mini program to bind the device. See the [official guide](https://docs.qq.com/doc/DZXNFWWtKbHN4UHFD) (Chinese).
You can also manage it over SSH:
```sh
sh /usr/libexec/istorec/forcedata.sh install # Install / start the client
sh /usr/libexec/istorec/forcedata.sh status # Show running status
sh /usr/libexec/istorec/forcedata.sh rm # Stop the process and clean /usr/local/forcecloud
```
## 📁 Directory Structure
```
luci-app-forcedata/
├── luasrc/ # LuCI controller, CBI config page, status view
├── po/zh-cn/ # Simplified Chinese language pack
├── root/
│ ├── etc/config/forcedata # UCI config (uid)
│ ├── etc/uci-defaults/luci-app-forcedata # Registers crontab on first install
│ ├── usr/libexec/istorec/forcedata.sh # Install / keep-alive / update script
│ └── www/luci-static/forcedata/ # QR-code JS and mini-program image
└── Makefile
```
## 🔗 Links
- [ForceData official site](http://www.forcedata.cn) (Chinese)
- [Mini-program binding guide](https://docs.qq.com/doc/DZXNFWWtKbHN4UHFD) (Chinese)
## 📄 License
No LICENSE file is included in this repo (the Makefile lists the maintainer as forcedata). For learning and research only.
+69
View File
@@ -0,0 +1,69 @@
[简体中文](README.md) | [English](README.en.md)
# luci-app-forcedata
OpenWrt / iStoreOS 平台的「原力云(Forcedata)」边缘计算客户端 LuCI 管理插件。
![Platform](https://img.shields.io/badge/platform-OpenWrt%20%7C%20iStoreOS-blue)
![Arch](https://img.shields.io/badge/arch-x86__64%20%7C%20aarch64-green)
![UI](https://img.shields.io/badge/LuCI-Lua-yellow)
## 📖 项目介绍
原力云是一个边缘计算 / 共享带宽平台:在自家设备上运行它的客户端,在线共享闲置带宽,每月可获取一定的现金回报。本插件把整套部署流程搬进 LuCI:安装后自动下载并拉起 forcecloud 客户端,分钟级保活与自更新,并在路由器管理页提供运行状态与扫码绑定入口。
适合已经刷了 OpenWrt / iStoreOS 的软路由、盒子玩家,不敲命令行即可挂机跑原力云。插件基于 iStore 应用框架(`luci-lib-taskd` + istorec 管理脚本)开发,与 iStoreOS 上其他应用的使用方式一致。
## ✨ 功能特性
- LuCI 图形界面:菜单位置「服务 → Forcedata(原力云)」,实时展示服务运行状态
- 首次使用自动生成 18 位数字 UID,保存在 `/etc/config/forcedata`(请勿修改,否则影响部署)
- 一键安装 / 升级 forcecloud 客户端,自动区分 x86_64 / aarch64 架构,下载包做 MD5 校验
- 通过 crontab 每分钟自检:进程掉线自动拉起,根分区使用率 100% 时自动跳过更新
- 客户端异常重启、同一主机重复启动探针时,通过钉钉机器人推送报警
- 状态页可生成绑定二维码,用「原力云」微信小程序扫码绑定设备
- 管理脚本支持 install / upgrade / rm / start / stop / restart / status 子命令
## 🛠 技术栈
- LuCI(Lua)+ iStore/taskd 应用框架,依赖 `luci-lib-taskd`,包架构 all
- busybox ash Shell 管理脚本
- 页面二维码基于 qrcode.min.js 生成
## 🚀 快速开始
1. 编译安装:把本仓库放进 OpenWrt/LeDE 源码的 `package/` 目录,`make menuconfig` 选中 `LuCI → Applications → luci-app-forcedata`,编译出 ipk 后安装到路由器;
2. 首次安装时 uci-defaults 会自动注册每分钟执行一次的 crontab 保活任务;
3. 登录 LuCI 进入「服务 → Forcedata」,确认 UID 后等待状态变为 Running;
4. 点击「Running, click to show QR」生成二维码,用「原力云」微信小程序扫码绑定设备,详见[官方教程](https://docs.qq.com/doc/DZXNFWWtKbHN4UHFD)。
也可以在 SSH 里手动管理:
```sh
sh /usr/libexec/istorec/forcedata.sh install # 安装 / 拉起客户端
sh /usr/libexec/istorec/forcedata.sh status # 查看运行状态
sh /usr/libexec/istorec/forcedata.sh rm # 停止进程并清理 /usr/local/forcecloud
```
## 📁 目录结构
```
luci-app-forcedata/
├── luasrc/ # LuCI 控制器、CBI 配置页、状态视图
├── po/zh-cn/ # 简体中文语言包
├── root/
│ ├── etc/config/forcedata # UCI 配置(uid)
│ ├── etc/uci-defaults/luci-app-forcedata # 首次安装注册 crontab
│ ├── usr/libexec/istorec/forcedata.sh # 安装 / 保活 / 更新脚本
│ └── www/luci-static/forcedata/ # 二维码 JS 与小程序码图片
└── Makefile
```
## 🔗 相关链接
- [原力云官网](http://www.forcedata.cn)
- [小程序扫码绑定教程](https://docs.qq.com/doc/DZXNFWWtKbHN4UHFD)
## 📄 License
本仓库未附带 LICENSE 文件(Makefile 中标注维护者为 forcedata),仅供学习研究。
+1 -1
View File
@@ -12,7 +12,7 @@ LUCI_DEPENDS:=+luci-base +logd +jsonfilter +coreutils-timeout
LUCI_PKGARCH:=all
PKG_VERSION:=0.1.46
PKG_RELEASE:=46
PKG_RELEASE:=47
# Reproducible build: honor SOURCE_DATE_EPOCH from the build environment (set by docker-sdk.sh / CI).
ifdef SOURCE_DATE_EPOCH
@@ -169,24 +169,33 @@ return baseclass.extend({
};
const evalNode = function (node) {
if (node.and) {
const keys = Object.keys(node);
if (keys.length !== 1)
throw new Error(
'CLASSIFY_SPEC node must have exactly one key: ' + JSON.stringify(node)
);
const key = keys[0];
if (key === 'and') {
if (!Array.isArray(node.and))
throw new Error('CLASSIFY_SPEC and node must be an array');
for (let i = 0; i < node.and.length; i++) {
if (!evalNode(node.and[i])) return false;
}
return true;
}
if (node.or) {
if (key === 'or') {
if (!Array.isArray(node.or))
throw new Error('CLASSIFY_SPEC or node must be an array');
for (let i = 0; i < node.or.length; i++) {
if (evalNode(node.or[i])) return true;
}
return false;
}
const keys = Object.keys(node);
for (let i = 0; i < keys.length; i++) {
const k = keys[i];
if (pred[k]) return pred[k](node);
}
return false;
if (!Object.prototype.hasOwnProperty.call(pred, key))
throw new Error(
'unrecognised CLASSIFY_SPEC predicate node: ' + JSON.stringify(node)
);
return pred[key](node);
};
for (let i = 0; i < this.CLASSIFY_SPEC.rules.length; i++) {
@@ -320,7 +320,7 @@ function rowClass(index, row, state, callbacks) {
.join(' ');
}
function buildRow(row, index, state, columns, callbacks) {
function buildRow(row, index, state, columns, callbacks, key) {
const cells = [];
for (let c = 0; c < columns.length; c++)
cells.push(buildColumnCell(columns[c], row, state, callbacks));
@@ -334,7 +334,7 @@ function buildRow(row, index, state, columns, callbacks) {
cells
);
tr._fwliveRowId = String(row.id);
tr._fwliveRowKey = rowRenderKey(row, state, columns);
tr._fwliveRowKey = key === undefined ? rowRenderKey(row, state, columns) : key;
return tr;
}
@@ -398,7 +398,7 @@ function renderRows(host, state, callbacks) {
const id = String(row.id);
const key = rowRenderKey(row, state, columns);
let tr = existingRows.get(id);
if (!tr || tr._fwliveRowKey !== key) tr = buildRow(row, i, state, columns, callbacks);
if (!tr || tr._fwliveRowKey !== key) tr = buildRow(row, i, state, columns, callbacks, key);
else tr.setAttribute('class', rowClass(i, row, state, callbacks));
tr._fwliveRowId = id;
tr._fwliveRowKey = key;
@@ -15,7 +15,7 @@ msgid ""
"messages returned"
msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:493
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:502
msgid "%s: %s"
msgstr ""
@@ -27,7 +27,7 @@ msgstr ""
msgid "Accessible (teal/orange)"
msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:353
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:362
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:37
msgid "Action"
msgstr ""
@@ -183,7 +183,7 @@ msgstr ""
msgid "Degraded — sampling (slow poll RTT; cadence reduced)."
msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:357
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:366
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:45
msgid "Destination"
msgstr ""
@@ -192,7 +192,7 @@ msgstr ""
msgid "Destination IP contains (! to exclude)"
msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:359
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:368
msgid "Destination port"
msgstr ""
@@ -361,7 +361,7 @@ msgstr ""
msgid "Installation is incomplete. Reinstall luci-app-fwlive."
msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:354
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:363
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:39
msgid "Interface"
msgstr ""
@@ -497,7 +497,7 @@ msgstr ""
msgid "Paused"
msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:355
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:364
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:43
msgid "Proto"
msgstr ""
@@ -555,7 +555,7 @@ msgstr ""
msgid "SPort"
msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:352
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:361
msgid "Search"
msgstr ""
@@ -596,7 +596,7 @@ msgstr ""
msgid "Simple"
msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:356
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:365
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:44
msgid "Source"
msgstr ""
@@ -605,7 +605,7 @@ msgstr ""
msgid "Source IP contains (! to exclude)"
msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:358
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js:367
msgid "Source port"
msgstr ""
@@ -12,9 +12,11 @@
# Lock: sibling ${FWLIVE_ADAPTIVE_LOCK_FILE:-$STATE.lock} — never the JSON
# inode (atomic mv replaces that inode; locking it would not serialize writers).
# Lock covers only short update — never held across ubus/filter work.
# Hot-path budget: ≤1 flock exec per update (release by closing the fd when the
# subshell exits — no flock -u). /proc/uptime + state I/O via shell builtins/
# redirects (no sed/cat/jsonfilter on the adaptive path). Fail-open on missing
# Hot-path budget: ≤1 flock exec and 2 find execs per successful update
# (directory safety checked before lock open and before the state write).
# Release flock by closing the fd when the subshell exits (no flock -u).
# /proc/uptime + state I/O use shell builtins/redirects (no sed/cat/jsonfilter
# on the adaptive path). Fail-open on missing
# flock, lock busy, or corrupt state. Fail-closed if the lock file cannot be
# opened (skip the write; do not record unlocked). Lock-busy ⇒ unlocked
# last-writer-wins is acceptable (state stays one valid JSON line; ordering
+3 -1
View File
@@ -253,7 +253,7 @@ run_with_timeout() {
fi
done
[ "$peer" = 1 ] || break
"$busybox_bin" sleep 0.1
"$busybox_bin" sleep 0.1 || "$busybox_bin" sleep 1 || exit 125
done
exit "$status"
' fwlive-timeout "$FWLIVE_TIMEOUT_BIN" "$secs" \
@@ -1220,6 +1220,7 @@ run_selftest() {
got=$(printf '%s\n' "log prefix \"fwlive${_tab}tabbed\" comment \"!fw4: TabRule\"" | nft_dump_fields)
OUT=''
_map_keys=0
_map_lines=0
_map_overflow=''
map_from_nft_stream all <<EOF
$got
@@ -1236,6 +1237,7 @@ EOF
fi
OUT=''
_map_keys=0
_map_lines=0
_map_overflow=''
map_from_nft_stream all <<EOF
$got
+2 -2
View File
@@ -6,8 +6,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-honk
PKG_VERSION:=1.1.1
PKG_RELEASE:=2
PKG_VERSION:=1.1.2
PKG_RELEASE:=3
LUCI_TITLE:=LuCI support for honk
LUCI_PKGARCH:=all
+20 -8
View File
@@ -136,17 +136,17 @@ msgstr "HONK 尚未在配置文件中启用 Clash API。Dashboard 控制面板
msgid "HONK has not enabled Native API in its configuration file. Doona requires native API listener and dashboard UI path."
msgstr "HONK 尚未在配置文件中启用 Native API。Doona 控制面板需要依赖 Native API 提供的监听端口与面板静态文件路径。"
msgid "Please add or uncomment experimental.clash_api block in Global Settings, and ensure external_controller and external_ui are configured."
msgstr "请在【全局设置】的配置文件中添加或取消注释 experimental.clash_api 语法块,并确保配置了 external_controller 和 external_ui。"
msgid "Please configure experimental.clash_api block in API Settings, and ensure external_controller and external_ui are configured."
msgstr "请在【API 设置】的配置文件中配置 experimental.clash_api 语法块,并确保配置了 external_controller 和 external_ui。"
msgid "Please add or uncomment experimental.native_api block in Global Settings, and ensure listen and ui are configured."
msgstr "请在【全局设置】的配置文件中添加或取消注释 experimental.native_api 语法块,并确保配置了 listen 和 ui。"
msgid "Please configure experimental.native_api block in API Settings, and ensure listen and ui are configured."
msgstr "请在【API 设置】的配置文件中配置 experimental.native_api 语法块,并确保配置了 listen 和 ui。"
msgid "Example Configuration (/etc/honk/config.dae):"
msgstr "参考配置示例(/etc/honk/config.dae):"
msgid "Example Configuration (/etc/honk/config.d/api.dae):"
msgstr "参考配置示例(/etc/honk/config.d/api.dae):"
msgid "Configure in Global Settings"
msgstr "前往【全局设置】手动配置"
msgid "Configure in API Settings"
msgstr "前往【API 设置】手动配置"
msgid "(Not set)"
msgstr "(未设置)"
@@ -339,3 +339,15 @@ msgstr "认证密钥: "
msgid "Click or drag to select Token"
msgstr "点击或拖选认证密钥"
msgid "API Settings"
msgstr "API 设置"
msgid "Configure API settings for HONK."
msgstr "调整 HONK 的 API 设置。"
msgid "API Configuration"
msgstr "API 配置"
msgid "API configuration saved and service restarted."
msgstr "API 配置已保存并重启服务。"
@@ -2,6 +2,71 @@
This changelog follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.1.0-beta.8] - 2026-09-28
### Added
- Each release attaches the eight honk-core builds of honk's `debug` pre-release, so honk does not have to be compiled: x86_64 and aarch64, glibc and musl, each with mimalloc or the system allocator. `honk-source-<commit>.tar.gz` holds the source of the honk commit they were built from and `HONK-SOURCE.txt` names that commit; `SHA256SUMS` lists every release asset except itself. The builds are attached until honk publishes a release with the native API. (#109, #117)
- Sign-in is a full page instead of a dialog over an empty window, with its own language menu and theme toggle. From 1024 pixels wide, a panel beside the form shows a construction scene that becomes a small Flappy Duck game when pressed. The form keeps working if the scene fails to load, and the scene is a still picture when reduced motion is requested. (#107, #114, #115)
- The public demo opens on the sign-in page with its account filled in: user name `demo`, password `demo`. (#107)
- The setup guide is a separate documentation site in English, Simplified Chinese and Traditional Chinese, maintained in [Zakkaus/doona-docs](https://github.com/Zakkaus/doona-docs). Sign-in and Settings > About link to it; the sign-in hint for a backend without the native API and the read-only outbound mode help open its troubleshooting sections. (#100)
- The documentation site has step-by-step installation pages for Debian or Ubuntu, Fedora or RHEL, Arch Linux, Gentoo, OpenWrt and other systems, and follows the layout of the React Spectrum docs. Its search ranks titles first and works from the keyboard, the 404 page is in the reader's language, and Chinese pages use the Spectrum CJK type scale. Colours are correct in Safari 17.0 to 17.4, and links into doona's source work when the pages are read on GitHub. The pages are shared under CC BY 4.0, and the header links to the demo. (Zakkaus/doona-docs#1, #2, #3, #6, #11, #13, #14)
- Help buttons explain unclear states and terms on Overview, Connections, Configuration, Rules, Policies, DNS, Events, Logs and Settings. (#98)
- Overview lists the features that are off in a full-width card, one row per cause. Where one applies, a row explains the cause, gives the configuration lines that turn the feature on, or links to the documentation or Settings. The rule list, validation and closing connections are listed when the backend lacks them. The count on Activity links to the card. (#102)
- A disabled action says why in a line beside its buttons, visible at every width, where before the reason was only in a tooltip that touch does not open, or missing. This covers Configuration, Activity, Policies, Rules, DNS, Nodes and Settings, and the dialogs for new rules, subscriptions and nodes. Screen readers read the line as the button's description. (#97, #127, #130, #133)
- Connections can collapse and expand each group, or all groups at once, while the list is grouped. (#93)
- On Events and Logs, pressing a row, or Enter or Space on it, shows its full text below the table, so text cut on a phone can be read; pressing the row again hides it. (#105)
- The demo shows its error states when opened with `?scenario=faults`; `?scenario=` returns to the healthy demo. (#103)
### Changed
- The demo behaves as a healthy honk: it seeds no failures, and switching the outbound mode works. (#103)
- The Overview header and the Activity status add a degraded or failed datapath to the engine state, in the matching tone. The Overview header links to the Datapath card. (#102)
- Backend features on Overview lists only the features that are on. (#102)
- Configuration shows each source's path once. A read-only source has one badge naming the reason (generated, subscription, read-only, contains secrets, redacted or text not returned) and no Validate button; when configuration writes are off, help beside the badge says how to turn them on. Every source with text has one line saying what it is and what can be done with it, and all source editors start at the same height. (#101)
- A writable source is edited in place, without an Edit button. Typing, pasting or tapping in a read-only source shows one notice with the reason. (#101)
- When a save finds that the file changed on disk, the source card, the modules and the quick setup show an alert and wait until the draft is kept over the change or discarded; previously, the draft was applied to the changed file without warning. A module draft carries over on its own when the change is outside its section. (#118)
- Read-only code editors show no caret or current-line highlight; the line a source was opened at keeps a marker. (#97)
- The must switch in the new-rule dialog reads Lock this outbound, with a line explaining what a locked outbound skips. (#91)
- The outbound mode card and the Arrange review label their button Apply and reload, as Configuration does, since all three write the configuration and reload it. (#126)
- Below 600 pixels wide, tables keep every column at its minimum width and scroll sideways, instead of dropping columns until the rest fit. Wider screens drop columns as before. (#128)
- On Policies, a large node group lays out its tiles like a small group: the same columns, tile width and edges, with room left for the scrollbar. (#125)
- The busiest-host tile on Connections takes two shares of its row. A host that still does not fit keeps its end visible and shows the full name on hover, focus or tap. (#99)
- When a subscription refresh leaves the datapath degraded, the notice says that new connections proxied through userspace are refused and points to Overview. (#98)
- The Chinese token sign-in heading and missing-token message use formal wording. (#107)
- README screenshots are rendered by the documentation site on each deploy and are no longer stored in the repository. (Zakkaus/doona-docs#6)
- NOTICE, `REUSE.toml`, the READMEs and the `OFL.txt` shipped with the fonts name Adobe as the copyright holder of Noto Sans TC and SC. The documentation site credits Adobe for the Spectrum icons, fonts and design. (#122, Zakkaus/doona-docs#12)
### Fixed
- Errors with the reused codes `invalid_request`, `unsupported_value` and `state_conflict` keep the backend's own message beside the summary. (#94)
- A backend that never answers no longer leaves a page loading. API reads fail when the headers, or the next part of the body, take more than 15 seconds to arrive, and writes when they take more than 30; the event and log streams keep their own limit. Sign-in and sign-out time out the same way. After a read timeout, Retry fetches the data again. A write timeout says the change may have been applied and asks for a reload before trying again. (#104, #118)
- Apply and reload is disabled when a refetch makes the open source read-only. Undo after Cancel no longer restores the discarded edits. (#101, #106)
- The must switch in the new-rule dialog aligns with the outbound picker. (#90)
- A connection opened by its link unfolds its collapsed group, and so does a selected connection that moves into another folded group. Outbound groups no longer unfold when the language changes, and an outbound named like a built-in label keeps its own group. (#93, #118)
- When an ordinary rule precedes the must rules in the routing block, doona's refusal to switch the outbound mode says to move the must rules to the top and names the rule. (#103)
- Trace field errors wait until a field is filled. Chrome no longer reports `apple-mobile-web-app-capable` as deprecated. (#103)
- Help buttons and status lights align with the centre of their text. (#98)
- Logs and the flow distribution say when the configuration forbids their recorder. Test all no longer blames TCP probe support when it is unavailable for another reason. (#98)
- The minimum password length applies only to the administrator password created at setup, not to signing in. (#107)
- A failed suspend or resume shows its translated message again (`lifecycle_failed`). (#115)
- Overview no longer gives honk's causes and fixes for resources an older backend leaves out of its capabilities; they are listed as not provided by the build. When another engine gives no reason, a read-only main configuration no longer claims one. (#118, #132)
- A read-only source is labelled as containing secrets only when its text defines a `native_api` or `clash_api` block; otherwise it shows as read-only. (#118)
- The health-check URL dialog sends only the fields that were edited and offers the check settings that the group's `mutable_config` lists. A save no longer replaces a change another client made to the same field: it fails as a conflict and the dialog stays open. (#106, #118, #132)
- The new-source dialog warns that a path is not included only when no loaded file includes it, and resolves include patterns from the main configuration's directory, as honk does. (#118, #131)
- A geodata update whose result cannot be confirmed is shown as unknown, not as failed. (#106)
- A new source whose read-back fails stays created, and a late result no longer reaches a reopened new-file dialog. A selected diagnostic stays selected across polls. In the demo, a new source whose name has a space, a non-ASCII character or `?` opens once created. (#106)
- The demo refuses source writes over honk's size limits, a second create of the same path and a create past the source limit, as honk does. Demo sign-in works over plain HTTP on a LAN address, where browsers do not provide `crypto.randomUUID`. (#118, #124, #131)
- The DNS device filter error appears under its field and is read with it by screen readers. The DNS log's time column fits relative times. (#105, #106)
- The note on the Arrange tab of Policies no longer mentions an Add menu on each row; it points to Add to group below the list and to Review and apply. (#111)
### For contributors
- CONTRIBUTING describes the architecture and the import allow-lists, and lint enforces the engine boundary. (#123)
- `tools/honk-commit.txt` pins the honk commit a release bundles; the release workflow fails unless honk's `debug` release, its target and its source tag name that commit. (#117)
- The API contract is pinned at api-standardize 3640713. (#116)
- The store, the configuration page, the engine explanations, the sign-in outcomes and the connection test were split into smaller modules, and unused code and duplicate strings were removed, without changing behaviour. (#108, #119, #120, #121, #126, #129)
## [0.1.0-beta.7] - 2026-09-27
### Added
@@ -253,6 +318,7 @@ This changelog follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
- Keep table columns and action cells visible and prevent cards and controls from overflowing.
[0.1.0-beta.8]: https://github.com/Zakkaus/doona/compare/v0.1.0-beta.7...v0.1.0-beta.8
[0.1.0-beta.7]: https://github.com/Zakkaus/doona/compare/v0.1.0-beta.6...v0.1.0-beta.7
[0.1.0-beta.6]: https://github.com/Zakkaus/doona/compare/v0.1.0-beta.5...v0.1.0-beta.6
[0.1.0-beta.5]: https://github.com/Zakkaus/doona/compare/v0.1.0-beta.4...v0.1.0-beta.5
@@ -6,3 +6,9 @@ Licensed under the Apache License, Version 2.0:
https://www.apache.org/licenses/LICENSE-2.0
Source: https://github.com/adobe/react-spectrum
Noto Sans TC and Noto Sans SC
Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name
'Source'.
The fonts in public/fonts are the Google Fonts subsets of Noto Sans TC and SC
from https://github.com/notofonts/noto-cjk.
Licensed under the SIL Open Font License, Version 1.1; see public/fonts/OFL.txt.
+47 -89
View File
@@ -1,32 +1,31 @@
<div align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/logo-dark.svg">
<img src="docs/logo-light.svg" width="104" alt="doona">
</picture>
<img src="public/logo.svg" width="104" alt="doona">
# doona
**Web UI for the [daeuniverse](https://github.com/daeuniverse) engines: nodes, groups, rules and the configuration, from a browser.**
English · [简体中文](README.zh-CN.md) · [繁體中文](README.zh-TW.md)
**[Live demo](https://demo.daeuniverse.org/)** / **[Documentation](https://zakkaus.github.io/doona-docs/en/)**
[Install](#install) • [First run](#first-run) • [Pages](#pages) • [Page tour](#page-tour) • [On a phone](#on-a-phone) • [Development](#development) • [Guide](docs/guide.md)
English / [简体中文](README.zh-CN.md) / [繁體中文](README.zh-TW.md)
[Install](#install) / [Pages](#pages) / [Page tour](#page-tour) / [On a phone](#on-a-phone) / [Development](#development)
</div>
doona is a static web UI for the native API the daeuniverse engines share: honk today, dae once it implements the same contract. The engine serves it itself or any web server does; it shows what the engine is doing and manages nodes, groups, routing rules and configuration files.
[Try the demo with sample data](https://demo.daeuniverse.org/).
[Try the demo with sample data](https://demo.daeuniverse.org/). To see the error states, open it with [`?scenario=faults`](https://demo.daeuniverse.org/?scenario=faults); `?scenario=` returns to the healthy demo.
![The activity page](docs/screenshots/en/activity-light.webp)
![The activity page](https://zakkaus.github.io/doona-docs/screenshots/en/activity-light.webp)
<details>
<summary><strong>Every palette</strong></summary>
Eleven palettes support light and dark modes; Rosé Pine and Catppuccin include multiple dark flavours. Use the palette picker in the top bar.
<img src="docs/screenshots/palettes.webp" alt="Every palette in light and dark" width="100%">
<img src="https://zakkaus.github.io/doona-docs/screenshots/palettes.webp" alt="Every palette in light and dark" width="100%">
</details>
@@ -34,12 +33,12 @@ Eleven palettes support light and dark modes; Rosé Pine and Catppuccin include
The activity page in four palettes. Select a palette and mode from the top bar.
| Theme gallery | Light | Dark |
| ------------- | -------------------------------------------------------------------- | ------------------------------------------------------------------ |
| Rosé Pine | ![Rosé Pine Light](docs/screenshots/en/theme-rose-pine-light.webp) | ![Rosé Pine Dark](docs/screenshots/en/theme-rose-pine-dark.webp) |
| Catppuccin | ![Catppuccin Light](docs/screenshots/en/theme-catppuccin-light.webp) | ![Catppuccin Dark](docs/screenshots/en/theme-catppuccin-dark.webp) |
| Nord | ![Nord Light](docs/screenshots/en/theme-nord-light.webp) | ![Nord Dark](docs/screenshots/en/theme-nord-dark.webp) |
| Glass | ![Glass Light](docs/screenshots/en/theme-glass-light.webp) | ![Glass Dark](docs/screenshots/en/theme-glass-dark.webp) |
| Theme gallery | Light | Dark |
| ------------- | ---------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| Rosé Pine | ![Rosé Pine Light](https://zakkaus.github.io/doona-docs/screenshots/en/theme-rose-pine-light.webp) | ![Rosé Pine Dark](https://zakkaus.github.io/doona-docs/screenshots/en/theme-rose-pine-dark.webp) |
| Catppuccin | ![Catppuccin Light](https://zakkaus.github.io/doona-docs/screenshots/en/theme-catppuccin-light.webp) | ![Catppuccin Dark](https://zakkaus.github.io/doona-docs/screenshots/en/theme-catppuccin-dark.webp) |
| Nord | ![Nord Light](https://zakkaus.github.io/doona-docs/screenshots/en/theme-nord-light.webp) | ![Nord Dark](https://zakkaus.github.io/doona-docs/screenshots/en/theme-nord-dark.webp) |
| Glass | ![Glass Light](https://zakkaus.github.io/doona-docs/screenshots/en/theme-glass-light.webp) | ![Glass Dark](https://zakkaus.github.io/doona-docs/screenshots/en/theme-glass-dark.webp) |
## Status
@@ -47,129 +46,88 @@ doona targets the native API implemented by honk's `feat/native-api` branch; tha
## Install
Release archives (`doona-<version>.tar.gz`, the optional `doona-fonts-<version>.tar.gz` with Noto Sans TC and SC, and `SHA256SUMS`) are attached to tags on the [releases page](https://github.com/Zakkaus/doona/releases). Build from source as described under [Development](#development). Verify and extract the files into the directory the engine or web server will serve:
doona needs honk's native API, which only the `debug` release of [Glassyiris/honk `feat/native-api`](https://github.com/Glassyiris/honk/tree/feat/native-api) provides so far. Release archives (`doona-<version>.tar.gz`, the optional `doona-fonts-<version>.tar.gz` with Noto Sans TC and SC, and `SHA256SUMS`) are attached to tags on the [releases page](https://github.com/Zakkaus/doona/releases). Extract them into the directory that honk's `native_api` block names in `ui`, and honk serves doona at `/ui/`.
```sh
VERSION=0.1.0-beta.7 # replace with the downloaded release version, without v
sha256sum --ignore-missing -c SHA256SUMS
sudo mkdir -p /usr/share/doona
sudo tar -xzf "doona-${VERSION}.tar.gz" -C /usr/share/doona
if [ -f "doona-fonts-${VERSION}.tar.gz" ]; then
sudo tar -xzf "doona-fonts-${VERSION}.tar.gz" -C /usr/share/doona
fi
```
From v0.1.0-beta.8 on, until honk publishes a release with the native API, each doona release also attaches prebuilt `honk-core-debug-<target>[-stock].tar.gz` archives from that `debug` release, so no one needs to compile honk. `HONK-SOURCE.txt` names the honk commit they were built from, `honk-source-<commit>.tar.gz` holds that commit's source, and `SHA256SUMS` covers every release asset except itself. [Install honk](https://zakkaus.github.io/doona-docs/en/install.html#install) explains which archive fits a gateway.
### Native API requirement
**Required honk build:** doona needs the native API in [Glassyiris/honk `feat/native-api`](https://github.com/Glassyiris/honk/tree/feat/native-api). No tagged daeuniverse/honk release includes it yet. The `native_api` and `password_auth` keys may change before upstream release. A released honk returns 404 for `/api` and `/ui/`. The configuration below applies to that branch.
honk's native API is opt-in. Point `ui` at the extracted files and honk serves them at `/ui/`, same-origin with the API:
```dae
experimental {
native_api {
enabled: true
listen: '127.0.0.1:9527'
password_auth: true
ui: '/usr/share/doona'
}
}
```
Keep this block in its own include (`include { api.dae }`) so the main file stays editable from the configuration page. For scripts and automation, use `secret: '<random token>'` instead of `password_auth: true`. Requirements, serving from another web server or a reverse proxy, and the distribution packages are in the [guide](docs/guide.md#install).
## First run
Open `/ui/` on the engine host. On a first visit doona asks the origin it was served from for `/api` and saves the engine as a backend. In password mode, the locked sign-in dialog offers first-time setup to create the administrator; complete setup from a loopback or private-network client, then sign in with the username and password. Served from elsewhere, or to reach another engine, open Settings and enter the server root.
In token mode, doona asks for the token. Enter it in Settings with the server root, or use a pairing link such as `/ui/#/settings?api=http://router:9527&token=…` to fill the form; doona removes the token from the address bar on load.
The activity page then shows the running engine. Add a subscription or paste share links on Nodes, pick or pin members on Policies, add rules on Rules, and edit, validate and reload the sources on Configuration. Every write goes through the engine with the hash doona read the source at, and a failed reload keeps the previous generation active. The [guide](docs/guide.md#first-run) walks through each page.
The [documentation](https://zakkaus.github.io/doona-docs/en/) covers the requirements, installing honk and doona, an example configuration, the first sign-in, checking each feature and troubleshooting.
## Pages
<img src="docs/screenshots/en/policies-light.webp" alt="The policies page" width="100%">
<img src="https://zakkaus.github.io/doona-docs/screenshots/en/policies-light.webp" alt="The policies page" width="100%">
| Page | Shows |
| ------------- | --------------------------------------------------------------------------------------------------------------- |
| Activity | Outbound mode, traffic and memory, active connections, node latency, outbound usage, top clients, notifications |
| Overview | Engine and eBPF state, process CPU, traffic counters, backend capabilities, the status as JSON |
| Connections | Live connections with source, destination, rule, chain, traffic and transfer rates; close one or all |
| DNS | Queries with their answers, the cache, the log; a flush |
| Policies | Groups, their members and health; selection, pinning, probing, editing and health-check URLs |
| Rules | A routing tree from rules or devices through outbounds to nodes, the rule list with hits, the flow log, a trace |
| Nodes | Subscriptions and their refresh interval, inline nodes, add and remove, probe and join a group |
| Configuration | Create and edit source files, diagnostics, validation, quick setup and export |
| Events, Logs | The backend event stream; the log stream with filters, pause and export |
| Settings | Backends, runtime settings and backend actions, language, appearance, palette and notification placement |
| Page | Shows |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Activity | Outbound mode, traffic and memory, active connections, node latency, outbound usage, top clients, notifications |
| Overview | Engine and eBPF state, process CPU, traffic counters, backend capabilities and the features that are off, the status as JSON |
| Connections | Live connections with source, destination, rule, chain, traffic and transfer rates; fold groups, close one or all |
| DNS | Queries with their answers, the cache, the log; a flush |
| Policies | Groups, their members and health; selection, pinning, probing, editing and health-check URLs |
| Rules | A routing tree from rules or devices through outbounds to nodes, the rule list with hits, the flow log, a trace |
| Nodes | Subscriptions and their refresh interval, inline nodes, add and remove, probe and join a group |
| Configuration | Create source files and edit them in place, diagnostics, validation, quick setup and export |
| Events, Logs | The backend event stream; the log stream with filters, pause and export |
| Settings | Backends, runtime settings and backend actions, language, appearance, palette and notification placement |
A page is marked unavailable only when every resource it needs is unavailable. `Ctrl K` searches pages, connections, nodes, groups, rules and sources from anywhere. Which resources each page needs, and where doona keeps its own settings, are in the [guide](docs/guide.md#pages).
A page is marked unavailable only when every resource it needs is unavailable. `Ctrl K` searches pages, connections, nodes, groups, rules and sources from anywhere. Which resources each page needs, and where doona keeps its own settings, are on the [features page](https://zakkaus.github.io/doona-docs/en/features.html#pages). Help buttons beside unclear states and terms explain them.
<img src="docs/screenshots/en/rules-light.webp" alt="The rules page" width="100%">
Sign-in is a page of its own with the language menu and scheme toggle. From 1024 pixels wide, a panel beside the form shows a construction scene; pressing it starts a Flappy Duck game. The demo fills in the user name `demo` and the password `demo`.
<img src="https://zakkaus.github.io/doona-docs/screenshots/en/rules-light.webp" alt="The rules page" width="100%">
## Page tour
### Arranging groups
On the Arrange tab of Policies, drag a node or a subscription from the list on the right onto a group to add it. The Add menu on each row and keyboard dragging do the same.
On the Arrange tab of Policies, drag a node or a subscription from the list on the right onto a group to add it. Keyboard dragging does the same, and Add to group below the list adds the selected rows to a group. The changes stay staged until you open Review and apply and press Apply.
<img src="docs/screenshots/en/arrange.webp" alt="Dragging the node us-01 onto the gaming group" width="100%">
<img src="https://zakkaus.github.io/doona-docs/screenshots/en/arrange.webp" alt="Dragging the node us-01 onto the gaming group" width="100%">
### Traffic and connections
The Traffic tab of Connections plots each connection's upload against its download, coloured by outbound; select a point to open that connection. The Connections tab groups live connections by device or by outbound, filters them by protocol and outbound, and exports them as CSV.
<img src="docs/screenshots/en/connections-traffic.webp" alt="The Traffic tab of the connections page" width="100%">
<img src="https://zakkaus.github.io/doona-docs/screenshots/en/connections-traffic.webp" alt="The Traffic tab of the connections page" width="100%">
<img src="docs/screenshots/en/connections-list.webp" alt="Live connections grouped by device" width="100%">
<img src="https://zakkaus.github.io/doona-docs/screenshots/en/connections-list.webp" alt="Live connections grouped by device" width="100%">
### DNS
The Statistics tab shows the median and P95 resolution time, the cache hit rate and the failure rate. The charts below place each upstream's lookups on a latency scale and count how the queries ended.
<img src="docs/screenshots/en/dns.webp" alt="The Statistics tab of the DNS page" width="100%">
<img src="https://zakkaus.github.io/doona-docs/screenshots/en/dns.webp" alt="The Statistics tab of the DNS page" width="100%">
### Log activity
Above the log list, a heatmap counts records per level over time. A level's row header sets the minimum level the list shows.
<img src="docs/screenshots/en/logs.webp" alt="The log activity heatmap" width="100%">
<img src="https://zakkaus.github.io/doona-docs/screenshots/en/logs.webp" alt="The log activity heatmap" width="100%">
### Routing map
The routing map on Rules follows traffic from rules, or from devices, through outbounds to nodes. Point at or select a rule, outbound or node to highlight the paths through it.
<img src="docs/screenshots/en/routing.webp" alt="Selecting a rule and then a node on the routing map" width="100%">
<img src="https://zakkaus.github.io/doona-docs/screenshots/en/routing.webp" alt="Selecting a rule and then a node on the routing map" width="100%">
### Node latency
The Latency tab of Nodes plots each node's latest latency, moving average and average of the last 10 measurements. A switch groups the nodes by policy group or by protocol; unavailable nodes appear under their group.
The Latency tab of Nodes plots each node's latest latency, and its moving average and the average of the last 10 measurements when the backend reports them. A switch groups the nodes by policy group or by protocol; unavailable nodes appear under their group.
<img src="docs/screenshots/en/latency.webp" alt="The Latency tab of the nodes page" width="100%">
<img src="https://zakkaus.github.io/doona-docs/screenshots/en/latency.webp" alt="The Latency tab of the nodes page" width="100%">
## On a phone
Below 1024 pixels wide, the side navigation becomes a bottom bar with four hubs: Overview, Traffic, Routing and Settings. A hub opens on the page last viewed in it during the session, and its pages sit in a row above the content. Language, theme, palette and wordmark move into the top bar's overflow menu, a submenu each.
Tables drop the columns that do not fit, in a set order, and toolbars wrap onto more rows. On Overview, DNS and Logs, the first page action stays a button and the rest move into a menu.
Below 600 pixels wide, tables keep every column and scroll sideways; on wider screens they drop the columns that do not fit, in a set order. Toolbars wrap onto more rows. On Events and Logs, press a row to read its full text below the table. On Overview, DNS and Logs, the first page action stays a button and the rest move into a menu.
Over HTTPS or on localhost, doona installs as an app. In Chrome and Edge, the About card in Settings offers Install as an app. Safari has no install prompt, so the card shows the steps instead. On iPhone and iPad, tap Share, then Add to Home Screen. In Safari 26 on macOS, choose File > Add to Dock.
<img src="docs/screenshots/en/phone.webp" alt="doona on phones: the connections table, the overflow menu and its palette submenu" width="100%">
<img src="https://zakkaus.github.io/doona-docs/screenshots/en/phone.webp" alt="doona on phones: the connections table, the overflow menu and its palette submenu" width="100%">
## Development
```sh
pnpm install --frozen-lockfile
pnpm build # writes dist/
pnpm check # types, lint, translations, formatting, unit tests, generated API types
pnpm check:size # gzip budgets for the dist/ build
pnpm e2e:install --with-deps # once, for the browser tests
pnpm e2e # rebuild, then test against the mock at the root and under /ui/
pnpm package # release/doona-<version>.tar.gz, doona-fonts-<version>.tar.gz, SHA256SUMS
```
`pnpm dev` serves the mock on Vite's dev server. The live-backend test run, the performance and screenshot tools, the source layout and the contract pin are described in the [guide](docs/guide.md#development); see [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request. Its [Translations](CONTRIBUTING.md#translations) section covers correcting a translation and proposing a language.
The build, test and packaging commands, the source layout and the contract pin are on the [development page](https://zakkaus.github.io/doona-docs/en/development.html). See [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request.
## Support
@@ -177,4 +135,4 @@ Report bugs and ask questions in the [issues](https://github.com/Zakkaus/doona/i
## License and credits
[GPL-3.0-only](LICENSE). Noto Sans TC and SC are under the [Open Font License](public/fonts/OFL.txt); [NOTICE](NOTICE) credits the Adobe Spectrum icons (Apache-2.0). The duck is the maintainer's own artwork.
[GPL-3.0-only](LICENSE). Noto Sans TC and SC are copyright Adobe and licensed under the [Open Font License](public/fonts/OFL.txt); [NOTICE](NOTICE) credits the Adobe Spectrum icons (Apache-2.0). The duck is the maintainer's own artwork.
@@ -1 +1 @@
import{j as s}from"./vendor-react-Bf71BWbF.js";import{u as o,dP as c,dQ as p,dR as x,dS as m,B as u}from"./index-zQjLFfuj.js";const r=({action:n})=>s.jsxs(u,{isDisabled:n.isDisabled,isPending:n.isPending,onPress:n.onAction,children:[n.icon,n.label]});function b({actions:n,overflowMode:d="collapse"}){const l=o();if(d==="wrap")return s.jsx(s.Fragment,{children:n.map(e=>s.jsx(r,{action:e},e.id))});const[a,...i]=n;return a?s.jsxs(s.Fragment,{children:[s.jsx(r,{action:a}),i.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"rp-wide-only",children:i.map(e=>s.jsx(r,{action:e},e.id))}),s.jsx("span",{className:"rp-narrow-only",children:s.jsx(c,{chevron:!1,label:l("ui.moreActions"),content:s.jsx(x,{"aria-label":l("ui.moreActions"),disabledKeys:i.filter(e=>e.isDisabled||e.isPending).map(e=>e.id),onAction:e=>i.find(t=>t.id===e)?.onAction(),children:i.map(e=>s.jsx(m,{id:e.id,className:"rp-item plain",textValue:e.label,children:e.label},e.id))}),children:s.jsx(p,{})})})]})]}):null}export{b as A};
import{j as s}from"./vendor-react-Bf71BWbF.js";import{u as o,e2 as c,e3 as p,e4 as x,e5 as m,B as u}from"./index-CXHBmSa5.js";const r=({action:n})=>s.jsxs(u,{isDisabled:n.isDisabled,isPending:n.isPending,onPress:n.onAction,children:[n.icon,n.label]});function b({actions:n,overflowMode:t="collapse"}){const l=o();if(t==="wrap")return s.jsx(s.Fragment,{children:n.map(e=>s.jsx(r,{action:e},e.id))});const[a,...i]=n;return a?s.jsxs(s.Fragment,{children:[s.jsx(r,{action:a}),i.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"rp-wide-only",children:i.map(e=>s.jsx(r,{action:e},e.id))}),s.jsx("span",{className:"rp-narrow-only",children:s.jsx(c,{chevron:!1,label:l("ui.moreActions"),content:s.jsx(x,{"aria-label":l("ui.moreActions"),disabledKeys:i.filter(e=>e.isDisabled||e.isPending).map(e=>e.id),onAction:e=>i.find(d=>d.id===e)?.onAction(),children:i.map(e=>s.jsx(m,{id:e.id,className:"rp-item plain",textValue:e.label,children:e.label},e.id))}),children:s.jsx(p,{})})})]})]}):null}export{b as A};
@@ -1 +0,0 @@
import{j as r}from"./vendor-react-Bf71BWbF.js";import{bd as t}from"./index-zQjLFfuj.js";function o({className:a,...s}){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:t("rp-icon",a),...s,children:r.jsx("path",{fill:"currentColor",d:"M10 1.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17m0 15.5a7 7 0 1 1 0-14 7 7 0 0 1 0 14m3.75-7.75h-3v-3a.75.75 0 0 0-1.5 0v3h-3a.75.75 0 0 0 0 1.5h3v3a.75.75 0 0 0 1.5 0v-3h3a.75.75 0 0 0 0-1.5"})})}export{o as A};
@@ -0,0 +1 @@
import{j as r}from"./vendor-react-Bf71BWbF.js";import{c as t}from"./index-CXHBmSa5.js";function o({className:a,...s}){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:t("rp-icon",a),...s,children:r.jsx("path",{fill:"currentColor",d:"M10 1.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17m0 15.5a7 7 0 1 1 0-14 7 7 0 0 1 0 14m3.75-7.75h-3v-3a.75.75 0 0 0-1.5 0v3h-3a.75.75 0 0 0 0 1.5h3v3a.75.75 0 0 0 1.5 0v-3h3a.75.75 0 0 0 0-1.5"})})}export{o as A};
@@ -1 +0,0 @@
import{r as u,j as l}from"./vendor-react-Bf71BWbF.js";import{u as ct,as as it,eq as rt,er as ut}from"./index-zQjLFfuj.js";import{u as ht,e as dt,v as H,C as xt,f as pt,n as ft,g as J}from"./layout-B3T-zLsm.js";import{G as mt,C as yt}from"./AreaCurve-BriPYJva.js";import"./array-C0P64tl-.js";const Mt=a=>{const o=Math.pow(10,Math.floor(Math.log10(a))),e=a/o;return([1,1.2,1.5,2,2.5,3,4,5,6,8,10].find(h=>e<=h)??10)*o},gt=a=>{const o=Math.pow(10,Math.floor(Math.log10(Math.max(a,1e-9)))),e=a/o;return(e<=1?.2:e<=2?.5:e<=5?1:2)*o},F=[30,60,120,300,600,900,1800,3600,7200,21600,43200,86400].map(a=>a*1e3);function kt(a,o){const e=o-a,s=F.find(c=>e/c<=6)??F[F.length-1],h=s>=864e5?new Date(o).getTimezoneOffset()*6e4:0,y=Math.ceil((a-h)/s)*s+h,x=[];for(let c=y;c<=o;c+=s)c-a>=e*.04&&o-c>=e*.04&&x.push(c);return{ticks:x,step:s}}function Q(a){const[o,e]=u.useState([]);return u.useLayoutEffect(()=>{const s=document.createElement("span");Object.assign(s.style,{position:"absolute",top:"-20000px",whiteSpace:"pre",fontSize:"11px"}),document.body.appendChild(s),e(a.map(y=>{s.textContent=y;const{width:x,height:c}=s.getBoundingClientRect();return{width:x,height:c}})),s.remove()},[a]),o}function zt({label:a,series:o,timestamps:e,fmt:s,locale:h,height:y=150,baseline:x="zero",window:c,fill:U}){const X=ct(),w=it(),A=u.useId(),[Y,L]=rt(Math.round,120),{tip:Z,showAt:_,hide:E}=ht(),[C,B]=u.useState(null),i=C&&C.index<e.length?C.index:null,I=c?c.until-c.since:e.length?e[e.length-1]-e[0]:0,M=c?.since,g=c?.until,p=u.useMemo(()=>M!==void 0&&g!==void 0?kt(M,g):void 0,[M,g]),D=p?p.step<6e4:I<180*1e3,N=p?p.step>=864e5:I>2160*60*1e3,G=u.useMemo(()=>new Intl.DateTimeFormat(h,N?{month:"numeric",day:"numeric"}:D?{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}:{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),[h,D,N]),{yDomain:K,yTicks:j}=u.useMemo(()=>{const t=o.flatMap(d=>d.values.filter(z=>z!==null));let n=0,r=Mt(Math.max(1,...t)*1.08);if(x==="auto"&&t.length){const d=Math.min(...t),z=Math.max(...t),b=gt(Math.max(z-d,z*.02,1));n=Math.max(0,Math.floor(d/b)*b-b),r=Math.ceil(z/b)*b+b}return{yDomain:[n,r],yTicks:x==="auto"?[n,(n+r)/2,r]:[r/2,r]}},[o,x]),P=u.useMemo(()=>{const t=e.length-1;return p?p.ticks:[...new Set((D?[0,Math.round(t/2),t]:[0,Math.round(t/3),Math.round(2*t/3),t]).map(n=>e[n]))]},[p,D,e]),O=u.useMemo(()=>M!==void 0&&g!==void 0?[M,g]:[Math.min(...e),Math.max(...e)],[M,g,e]),k=L?.width??0,S=L?.height??y,m=S-30,v=k-64,tt=[Math.min(O[0],...e),Math.max(O[1],...e)],f=t=>J(t,tt,[20,v]),T=t=>J(t,K,[m,8]),et={x:20,y:8,width:v-20,height:m-8},R=(t,n)=>B({index:t,y:n}),W=()=>{B(null),E()};u.useLayoutEffect(()=>{if(i===null){E();return}if(!o.some(t=>t.values[i]!=null)){E();return}_({x:f(e[i]),y:C?.y??(8+m)/2,width:k,bounds:et,label:ut(h).format(e[i]),lines:o.filter(t=>t.values[i]!=null).sort((t,n)=>t.label<n.label?-1:t.label>n.label?1:0).map(t=>`${t.label}${X("ui.labelSeparator")}${s(t.values[i])}`)})});const $=dt(e.length,R,W),q=u.useMemo(()=>P.map(t=>G.format(t)),[P,G]),nt=u.useMemo(()=>j.map(s),[j,s]),ot=Q(q),st=Q(nt),lt=p?H(P.map(f),ot.map(t=>t.width),0,k,16,!0):P.map((t,n)=>({index:n,position:f(t)})),V=H(j.map(T),st.map(t=>t.height),0,S,5,!1),at=[...new Set([...V.map(t=>T(j[t.index])),8,m])];return l.jsx("div",{ref:Y,style:{height:y,width:"100%",flex:U?"1 1 auto":void 0,position:"relative"},onPointerLeave:$.onPointerLeave,children:e.length>0&&L&&l.jsxs(l.Fragment,{children:[l.jsx(xt,{tip:Z}),l.jsxs("svg",{className:"rp-activity-surface",width:k,height:S,viewBox:`0 0 ${k} ${S}`,style:{display:"block"},role:"application","aria-label":a,tabIndex:0,onFocus:$.onFocus,onBlur:$.onBlur,onKeyDown:$.onKeyDown,onPointerMove:t=>{const{x:n,y:r}=pt(t,t.currentTarget,{width:k,height:S});if(n<20||n>v||r<8||r>m){W();return}const d=ft(e.map(f),n);R(d,r)},children:[l.jsx("g",{className:"rp-area-grid",children:at.map(t=>l.jsx("line",{x1:20,x2:v,y1:t,y2:t,stroke:w["hl-med"],strokeDasharray:"2 4",fill:"none"},t))}),l.jsx("defs",{children:o.map((t,n)=>l.jsx(mt,{id:A+n,color:t.color},t.label))}),o.map((t,n)=>l.jsx(yt,{points:e.map((r,d)=>t.values[d]==null?null:{x:f(r),y:T(t.values[d])}),baseline:T(Math.max(0,K[0])),color:t.color,id:A+n,strokeWidth:2},t.label)),i!==null&&l.jsx("path",{d:`M${f(e[i])},8L${f(e[i])},${m}`,stroke:w.subtle,strokeDasharray:"3 3",fill:"none",pointerEvents:"none"}),l.jsx("g",{children:lt.map(({index:t,position:n})=>l.jsx("text",{x:n,y:m+8,fontSize:11,fill:w.subtle,textAnchor:"middle",children:l.jsx("tspan",{x:n,dy:"0.71em",children:q[t]})},t))}),l.jsx("g",{className:"rp-area-y-ticks",children:V.map(({index:t,position:n})=>l.jsx("text",{x:v+8,y:n,fontSize:11,fill:w.subtle,textAnchor:"start",children:l.jsx("tspan",{x:v+8,dy:"0.355em",children:s(j[t])})},t))}),i!==null&&o.map(t=>t.values[i]==null?null:l.jsx("circle",{cx:f(e[i]),cy:T(t.values[i]),r:4,fill:t.color,stroke:"#fff",strokeWidth:2},t.label))]})]})})}export{zt as AreaPlot};
@@ -0,0 +1 @@
import{r as u,j as a}from"./vendor-react-Bf71BWbF.js";import{u as ct,aB as it,eH as rt,eI as ut}from"./index-CXHBmSa5.js";import{u as ht,e as dt,v as q,C as xt,f as pt,n as ft,g as J}from"./layout-BRLew_nj.js";import{G as mt,C as yt}from"./AreaCurve-BriPYJva.js";import"./array-C0P64tl-.js";const Mt=l=>{const o=Math.pow(10,Math.floor(Math.log10(l))),e=l/o;return([1,1.2,1.5,2,2.5,3,4,5,6,8,10].find(h=>e<=h)??10)*o},gt=l=>{const o=Math.pow(10,Math.floor(Math.log10(Math.max(l,1e-9)))),e=l/o;return(e<=1?.2:e<=2?.5:e<=5?1:2)*o},B=[30,60,120,300,600,900,1800,3600,7200,21600,43200,86400].map(l=>l*1e3);function kt(l,o){const e=o-l,s=B.find(c=>e/c<=6)??B[B.length-1],h=s>=864e5?new Date(o).getTimezoneOffset()*6e4:0,y=Math.ceil((l-h)/s)*s+h,x=[];for(let c=y;c<=o;c+=s)c-l>=e*.04&&o-c>=e*.04&&x.push(c);return{ticks:x,step:s}}function Q(l){const[o,e]=u.useState([]);return u.useLayoutEffect(()=>{const s=document.createElement("span");Object.assign(s.style,{position:"absolute",top:"-20000px",whiteSpace:"pre",fontSize:"11px"}),document.body.appendChild(s),e(l.map(y=>{s.textContent=y;const{width:x,height:c}=s.getBoundingClientRect();return{width:x,height:c}})),s.remove()},[l]),o}function wt({label:l,series:o,timestamps:e,fmt:s,locale:h,height:y=150,baseline:x="zero",window:c,fill:U}){const X=ct(),C=it(),F=u.useId(),[Y,L]=rt(Math.round,120),{tip:Z,showAt:_,hide:E}=ht(),[z,I]=u.useState(null),i=z&&z.index<e.length?z.index:null,N=c?c.until-c.since:e.length?e[e.length-1]-e[0]:0,M=c?.since,g=c?.until,p=u.useMemo(()=>M!==void 0&&g!==void 0?kt(M,g):void 0,[M,g]),D=p?p.step<6e4:N<180*1e3,A=p?p.step>=864e5:N>2160*60*1e3,G=u.useMemo(()=>new Intl.DateTimeFormat(h,A?{month:"numeric",day:"numeric"}:D?{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}:{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),[h,D,A]),{yDomain:K,yTicks:j}=u.useMemo(()=>{const t=o.flatMap(d=>d.values.filter(w=>w!==null));let n=0,r=Mt(Math.max(1,...t)*1.08);if(x==="auto"&&t.length){const d=Math.min(...t),w=Math.max(...t),b=gt(Math.max(w-d,w*.02,1));n=Math.max(0,Math.floor(d/b)*b-b),r=Math.ceil(w/b)*b+b}return{yDomain:[n,r],yTicks:x==="auto"?[n,(n+r)/2,r]:[r/2,r]}},[o,x]),P=u.useMemo(()=>{const t=e.length-1;return p?p.ticks:[...new Set((D?[0,Math.round(t/2),t]:[0,Math.round(t/3),Math.round(2*t/3),t]).map(n=>e[n]))]},[p,D,e]),O=u.useMemo(()=>M!==void 0&&g!==void 0?[M,g]:[Math.min(...e),Math.max(...e)],[M,g,e]),k=L?.width??0,S=L?.height??y,m=S-30,v=k-64,tt=[Math.min(O[0],...e),Math.max(O[1],...e)],f=t=>J(t,tt,[20,v]),T=t=>J(t,K,[m,8]),et={x:20,y:8,width:v-20,height:m-8},R=(t,n)=>I({index:t,y:n}),W=()=>{I(null),E()};u.useLayoutEffect(()=>{if(i===null){E();return}if(!o.some(t=>t.values[i]!=null)){E();return}_({x:f(e[i]),y:z?.y??(8+m)/2,width:k,bounds:et,label:ut(h).format(e[i]),lines:o.filter(t=>t.values[i]!=null).sort((t,n)=>t.label<n.label?-1:t.label>n.label?1:0).map(t=>`${t.label}${X("ui.labelSeparator")}${s(t.values[i])}`)})});const $=dt(e.length,R,W),H=u.useMemo(()=>P.map(t=>G.format(t)),[P,G]),nt=u.useMemo(()=>j.map(s),[j,s]),ot=Q(H),st=Q(nt),at=p?q(P.map(f),ot.map(t=>t.width),0,k,16,!0):P.map((t,n)=>({index:n,position:f(t)})),V=q(j.map(T),st.map(t=>t.height),0,S,5,!1),lt=[...new Set([...V.map(t=>T(j[t.index])),8,m])];return a.jsx("div",{ref:Y,style:{height:y,width:"100%",flex:U?"1 1 auto":void 0,position:"relative"},onPointerLeave:$.onPointerLeave,children:e.length>0&&L&&a.jsxs(a.Fragment,{children:[a.jsx(xt,{tip:Z}),a.jsxs("svg",{className:"rp-activity-surface",width:k,height:S,viewBox:`0 0 ${k} ${S}`,style:{display:"block"},role:"application","aria-label":l,tabIndex:0,onFocus:$.onFocus,onBlur:$.onBlur,onKeyDown:$.onKeyDown,onPointerMove:t=>{const{x:n,y:r}=pt(t,t.currentTarget,{width:k,height:S});if(n<20||n>v||r<8||r>m){W();return}const d=ft(e.map(f),n);R(d,r)},children:[a.jsx("g",{className:"rp-area-grid",children:lt.map(t=>a.jsx("line",{x1:20,x2:v,y1:t,y2:t,stroke:C["hl-med"],strokeDasharray:"2 4",fill:"none"},t))}),a.jsx("defs",{children:o.map((t,n)=>a.jsx(mt,{id:F+n,color:t.color},t.label))}),o.map((t,n)=>a.jsx(yt,{points:e.map((r,d)=>t.values[d]==null?null:{x:f(r),y:T(t.values[d])}),baseline:T(Math.max(0,K[0])),color:t.color,id:F+n,strokeWidth:2},t.label)),i!==null&&a.jsx("path",{d:`M${f(e[i])},8L${f(e[i])},${m}`,stroke:C.subtle,strokeDasharray:"3 3",fill:"none",pointerEvents:"none"}),a.jsx("g",{children:at.map(({index:t,position:n})=>a.jsx("text",{x:n,y:m+8,className:"rp-area-tick",fill:C.subtle,textAnchor:"middle",children:a.jsx("tspan",{x:n,dy:"0.71em",children:H[t]})},t))}),a.jsx("g",{className:"rp-area-y-ticks",children:V.map(({index:t,position:n})=>a.jsx("text",{x:v+8,y:n,className:"rp-area-tick",fill:C.subtle,textAnchor:"start",children:a.jsx("tspan",{x:v+8,dy:"0.355em",children:s(j[t])})},t))}),i!==null&&o.map(t=>t.values[i]==null?null:a.jsx("circle",{cx:f(e[i]),cy:T(t.values[i]),r:4,fill:t.color,stroke:"#fff",strokeWidth:2},t.label))]})]})})}export{wt as AreaPlot};
@@ -0,0 +1,4 @@
import{r as x,$ as _,a as St,j as f}from"./vendor-react-Bf71BWbF.js";import{eu as Pt,eN as Bt,eo as ae,bT as G,bR as M,eO as Qe,eP as et,eQ as It,bL as Re,el as F,em as re,en as Be,e7 as N,eA as tt,eR as At,eS as Ot,eT as Mt,bI as jt,bU as Nt,b$ as Rt,eU as Lt,c1 as Vt,c2 as Gt,bG as Ht,es as zt,c4 as Ut,bD as Xt,c6 as Yt,c8 as qt,c5 as _t,eV as Wt,eW as Jt,bE as ke,aJ as Zt,eE as Qt,eB as er,bQ as tr,eX as rt,eY as nt,eZ as oe,bF as rr,bB as at,e6 as nr,c as Ie,J as Ke,e_ as Le,d9 as ot,e$ as Ve,f0 as Ge,de as it,u as W,a5 as ar,a8 as or,a7 as He,aa as ir,cA as lr,dB as sr,b as ur,bb as ze,E as dr,j as cr,I as Q,af as lt,B as L,d5 as Ue,ac as st,T as ut,a as dt,aH as Xe,aC as pr,bx as fr,$ as de,L as gr,h as yr,by as mr,aG as hr,b1 as Dr,eF as br,eG as $r,f1 as vr,aE as Er,bj as xr,ae as ct,cG as wr}from"./index-CXHBmSa5.js";import{$ as Tr,a as kr}from"./Policies-wpHv6bOW.js";import{d as Kr}from"./Virtualizer--Vfl8O3n.js";import{$ as Cr}from"./ListLayout-CPapuywx.js";import{D as pt}from"./DaeCode-STEiRZuV.js";import{b as Fr,g as Sr}from"./policyText-CAFy3qpo.js";import{P as Pr}from"./PolicyPicker-DSSmYroN.js";import{$ as Br}from"./useFilter-DZ8TXqn_.js";import"./useGridSelectionCheckbox-BV96yL-N.js";var P=(function(e){return e[e.none=0]="none",e[e.cancel=0]="cancel",e[e.move=1]="move",e[e.copy=2]="copy",e[e.link=4]="link",e[e.all=7]="all",e})({});const ft={...P,copyMove:3,copyLink:6,linkMove:5,all:7,uninitialized:7},gt=yt(ft);gt[7]="all";const ee={none:"cancel",link:"link",copy:"copy",move:"move"},De=yt(ee);function yt(e){let t={};for(let r in e)t[e[r]]=r;return t}const Ir=new Set(["text/plain","text/uri-list","text/html"]),fe="application/vnd.react-aria.items+json",ge="application/octet-stream",Ae=new WeakMap,mt=Symbol();function Ar(e){let{id:t}=Ae.get(e)||{};if(!t)throw new Error("Droppable item outside a droppable collection");return t}function Or(e){let{ref:t}=Ae.get(e)||{};if(!t)throw new Error("Droppable item outside a droppable collection");return t}function z(e){let t=new Set;for(let r of e)for(let n of Object.keys(r))t.add(n);return t}function ht(e){return e||(e="virtual"),e==="pointer"&&(e="virtual"),e==="virtual"&&typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches&&(e="touch"),e}function Oe(){return ht(Pt())}function Dt(){return ht(Bt())}function Ce(e,t){let r=new Map,n=!1,a=[];for(let o of t){let y=Object.keys(o);y.length>1&&(n=!0);let c={};for(let D of y){let v=r.get(D);v?n=!0:(v=[],r.set(D,v));let g=o[D];c[D]=g,v.push(g)}a.push(c)}for(let[o,y]of r)if(Ir.has(o)){let c=y.join(`
`);e.items.add(c,o)}else e.items.add(y[0],o);if(n){let o=JSON.stringify(a);e.items.add(o,fe)}}class ie{constructor(t){this.types=new Set;let r=!1;for(let n of t.items)n.type!==fe&&(n.kind==="file"&&(r=!0),n.type?this.types.add(n.type):this.types.add(ge));this.includesUnknownTypes=!r&&t.types.includes("Files")}has(t){if(Array.isArray(t))return t.some(r=>this.has(r));if(this.includesUnknownTypes||t===mt&&this.types.has(ge)||t==="*/*")return!0;if(typeof t=="string"){if(t.endsWith("/*")){for(let r of this.types)if(r.startsWith(t.slice(0,-2)))return!0;return!1}return this.types.has(t)}return!1}}function bt(e){let t=[];if(!e)return t;let r=!1;if(e.types.includes(fe))try{let n=e.getData(fe),a=JSON.parse(n);for(let o of a)t.push({kind:"text",types:new Set(Object.keys(o)),getText:y=>Promise.resolve(o[y])});r=!0}catch{}if(!r){let n=new Map;for(let a of e.items)if(a.kind==="string")n.set(a.type||ge,e.getData(a.type));else if(a.kind==="file")if(typeof a.webkitGetAsEntry=="function"){let o=a.webkitGetAsEntry();if(!o)continue;o.isFile?t.push(Fe(a.getAsFile())):o.isDirectory&&t.push($t(o))}else t.push(Fe(a.getAsFile()));n.size>0&&t.push({kind:"text",types:new Set(n.keys()),getText:a=>Promise.resolve(n.get(a))})}return t}function Mr(e){return typeof e.text=="function"?e.text():new Promise((t,r)=>{let n=new FileReader;n.onload=()=>{t(n.result)},n.onerror=r,n.readAsText(e)})}function Fe(e){if(!e)throw new Error("No file provided");return{kind:"file",type:e.type||ge,name:e.name,getText:()=>Mr(e),getFile:()=>Promise.resolve(e)}}function $t(e){return{kind:"directory",name:e.name,getEntries:()=>jr(e)}}async function*jr(e){let t=e.createReader(),r;do{r=await new Promise((n,a)=>{t.readEntries(n,a)});for(let n of r)if(n.isFile){let a=await Nr(n);yield Fe(a)}else n.isDirectory&&(yield $t(n))}while(r.length>0)}function Nr(e){return new Promise((t,r)=>e.file(t,r))}function Rr(e){return e.kind==="text"}let B={draggingKeys:new Set};function Lr(e){B.draggingCollectionRef=e}function Vr(e){B.draggingKeys=e}function Y(e){B.dropCollectionRef=e}function vt(){B={draggingKeys:new Set}}function Gr(e){B=e}function V(e){let{draggingCollectionRef:t,dropCollectionRef:r}=B;return t?.current!=null&&t.current===(e?.current||r?.current)}let ce;function ye(e){ce=e}let Se=P.none;function be(e){Se=e}let Pe=new Map,te=new Map,R=null,me=new Set;function Et(e){return Pe.set(e.element,e),R?.updateValidDropTargets(),()=>{Pe.delete(e.element),R?.updateValidDropTargets()}}function Hr(e){return te.set(e.element,e),()=>{te.delete(e.element)}}function zr(e,t){if(R)throw new Error("Cannot begin dragging while already dragging");R=new _r(e,t),requestAnimationFrame(()=>{R&&(R.setup(),Dt()==="keyboard"&&R.next())});for(let r of me)r()}function Me(){let[e,t]=x.useState(R);return x.useEffect(()=>{let r=()=>t(R);return me.add(r),()=>{me.delete(r)}},[]),e}function Ur(){return!!R}function Xr(){R=null;for(let e of me)e()}const Ye=["pointerdown","pointermove","pointerenter","pointerleave","pointerover","pointerout","pointerup","mousedown","mousemove","mouseenter","mouseleave","mouseover","mouseout","mouseup","touchstart","touchmove","touchend","focusin","focusout"],Yr=["pointerup","mouseup","touchend"],qr={keyboard:"dragStartedKeyboard",touch:"dragStartedTouch",virtual:"dragStartedVirtual"};class _r{constructor(t,r){this.validDropTargets=[],this.currentDropTarget=null,this.currentDropItem=null,this.dropOperation=null,this.mutationObserver=null,this.restoreAriaHidden=null,this.isVirtualClick=!1,this.dragTarget=t,this.stringFormatter=r,this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.onClick=this.onClick.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.cancelEvent=this.cancelEvent.bind(this),this.initialFocused=!1}setup(){document.addEventListener("keydown",this.onKeyDown,!0),document.addEventListener("keyup",this.onKeyUp,!0),window.addEventListener("focus",this.onFocus,!0),window.addEventListener("blur",this.onBlur,!0),document.addEventListener("click",this.onClick,!0),document.addEventListener("pointerdown",this.onPointerDown,!0);for(let t of Ye)document.addEventListener(t,this.cancelEvent,!0);this.mutationObserver=new MutationObserver(()=>this.updateValidDropTargets()),this.updateValidDropTargets(),ae(this.stringFormatter.format(qr[Dt()]))}teardown(){document.removeEventListener("keydown",this.onKeyDown,!0),document.removeEventListener("keyup",this.onKeyUp,!0),window.removeEventListener("focus",this.onFocus,!0),window.removeEventListener("blur",this.onBlur,!0),document.removeEventListener("click",this.onClick,!0),document.removeEventListener("pointerdown",this.onPointerDown,!0);for(let t of Ye)document.removeEventListener(t,this.cancelEvent,!0);this.mutationObserver?.disconnect(),this.restoreAriaHidden?.()}onKeyDown(t){if(this.cancelEvent(t),t.key==="Escape"){this.cancel();return}t.key==="Tab"&&!(t.metaKey||t.altKey||t.ctrlKey)&&(t.shiftKey?this.previous( Line truncated
`),A=new Set(c.map(O=>O.group));return Ke(l.stagedText).filter(O=>A.has(O.name)).map(O=>({group:O.name,text:K.slice(O.from,O.to+1).join(`
`)}))},[l.stagedText,c]);return{groups:l.groups,unknown:l.unknown,byGroup:d,subscriptions:i,nodes:T,search:b,setSearch:m,loading:r.loading&&!r.data||a.loading&&!y||o.loading&&!o.data,error:[r,a,o].find(K=>K.error&&!K.data)?.error??(e.main?null:e.error),retry:x.useCallback(()=>void sr(),[]),blocked:S?t(S):null,busy:e.busy||h,applying:h,failure:k,changes:c,changeLines:c.map(K=>Fn(K,$,t)),pendingText:t("arrange.pending",{n:c.length}),place:H,unplace:j,drop:K=>I(A=>Sn(A,K)),discard:()=>I(()=>[]),nameProblem:J,create:(K,A)=>I(O=>Te(O,{kind:"createGroup",group:K,policy:A})),reviewing:s&&c.length>0,setReviewing:K=>{h||u(K)},preview:X,canApply:c.length>0&&l.emptyNew.length===0&&!S&&!h,applyNote:Kn(S?t(S):null,l.emptyNew,t),apply:Z}}function Xn({source:e,groups:t}){const r=W(),n=Pn(e),a=x.useMemo(()=>new Map((t??[]).map(o=>[o.name,o])),[t]);return n.error?f.jsx(dr,{error:n.error,onRetry:n.retry}):n.loading?f.jsx(cr,{}):f.jsxs("div",{className:"rp-arrange",children:[f.jsxs("div",{className:"rp-row",children:[f.jsxs("p",{className:"rp-note rp-grow",children:[f.jsx("span",{className:"rp-wide-only",children:r("arrange.note")}),f.jsx("span",{className:"rp-narrow-only",children:r("arrange.selectHint")})]}),f.jsx(An,{m:n})]}),n.blocked&&f.jsx(Q,{tone:"informative",children:n.blocked}),f.jsxs("div",{className:"rp-arrange-grid",children:[f.jsx("div",{className:"rp-col",children:n.groups.length?n.groups.map(o=>f.jsx(Bn,{group:o,live:a.get(o.name),m:n},o.name)):f.jsx(lt,{children:r("policy.empty")})}),f.jsx(In,{m:n})]}),n.changes.length>0&&f.jsxs(En,{label:r("arrange.pendingRegion"),message:n.pendingText,children:[f.jsx(L,{quiet:!0,onPress:n.discard,isDisabled:n.busy,children:r("arrange.discard")}),f.jsx(L,{accent:!0,onPress:()=>n.setReviewing(!0),children:r("arrange.review")})]}),f.jsx(On,{m:n})]})}function Bn({group:e,live:t,m:r}){const n=W(),a=dt(),o=x.useId(),y=!!r.blocked,c=t?Sr(t.policy,n):null,D=async $=>{const l=await Promise.all($.filter(Rr).filter(d=>d.types.has(pe)).map(d=>d.getText(pe)));r.place(e.name,l.flatMap(d=>Cn(d)??[]))},v=($,l,d)=>f.jsx(L,{quiet:!0,icon:!0,small:!0,label:n("arrange.remove",{name:$,group:e.name}),isDisabled:y||r.applying||!!d,onPress:()=>r.unplace(e.name,l),children:f.jsx(ct,{})}),g=($,l)=>f.jsx(L,{quiet:!0,small:!0,label:n("arrange.undoRemove",{name:$}),isDisabled:r.applying,onPress:()=>r.place(e.name,[l]),children:n("arrange.undoShort")});return f.jsx(nn,{className:mr("rp-drop"),"aria-label":n("arrange.dropInto",{group:e.name}),isDisabled:y||r.applying,getDropOperation:$=>$.has(pe)?"copy":"cancel",onDrop:$=>void D($.items),children:({isDropTarget:$})=>f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"rp-row",children:f.jsxs("span",{className:"rp-cluster",children:[f.jsx("h3",{className:"rp-h3",id:o,children:e.name}),c&&f.jsx(Xe,{tip:c.id,children:c.label}),t&&f.jsx(pr,{small:!0,tone:"neutral",children:n("arrange.memberCount",{n:t.member_count})}),e.isNew&&f.jsx(Xe,{children:n("arrange.new")})]})}),e.holdsAll&&f.jsx("p",{className:"rp-note",children:n("arrange.holdsAll")}),f.jsxs(fr,{reason:kn(e,y||r.applying),children:[(e.names.length>0||e.removedNames.length>0)&&f.jsxs(Je,{label:n("arrange.byName"),children:[f.jsx("span",{className:"rp-label rp-tags-title",children:n("arrange.byName")}),e.names.map(l=>f.jsx(ue,{tone:l.isNew?"new":void 0,action:v(l.name,{kind:"node",value:l.name},l.blocked),children:l.name},l.name)),e.removedNames.map(l=>f.jsx(ue,{tone:"removed",action:g(l,{kind:"node",value:l}),children:l},l))]}),(e.subscriptions.length>0||e.removedSubscriptions.length>0)&&f.jsxs(Je,{label:n("arrange.bySubscription"),children:[f.jsx("span",{className:"rp-label rp-tags-title",children:n("arrange.bySubscription")}),e.subscriptions.map(l=>f.jsx(ue,{tone:l.isNew?"new":void 0,action:v(l.label,{kind:"subscription",value:l.tag},l.blocked),children:l.count===null?l.label:n("arrange.subscriptionCount",{name:l.label,n:l.count})},l.tag)),e.removedSubscriptions.map(l=>f.jsx(ue,{tone:"removed",action:g(l.label,{kind:"subscription",value:l.tag}),children:l.label},l.tag))]})]}),e.rules.length>0&&f.jsxs("div",{className:"rp-arrange-rules",children:[f.jsx("span",{className:"rp-label",children:n("arrange.byRule")}),e.rules.map(l=>f.jsx(pt,{as:"code",text:l},l)),e.ruleNodes.length>0&&f.jsx("span",{children:e.ruleMore?n("arrange.ruleSelectsMore",{names:de(a,e.ruleNodes),n:e.ruleMore}):n("arrange.ruleSelects",{names:de(a,e.ruleNodes)})}),f.jsxs("span",{className:"rp-label",children:[e.ruleNote," ",f.jsx(gr,{appearance:"link",href:yr("config",{tab:"source"}),children:n("arrange.editSource")})]})]}),e.stillIn.length>0&&f.jsx(Q,{tone:"informative",children:n("arrange.stillIn",{names:de(a,e.stillIn)})}),$&&f.jsx("div",{className:"rp-drop-hint","aria-hidden":"true",children:n("arrange.dropHint")})]})})}function In({m:e}){const t=W(),r=x.useId(),n=!!e.blocked||e.applying,[a,o]=x.useState("all"),[y,c]=x.useState(new Set),D=x.useMemo(()=>[...a==="node"?[]:e.subscriptions.map(d=>({id:"subscription:"+d.tag,item:{ki Line truncated
@@ -1,4 +0,0 @@
import{r as x,$ as _,a as Ft,j as f}from"./vendor-react-Bf71BWbF.js";import{ef as Pt,ew as Bt,e9 as ae,bI as G,bG as M,ex as Qe,ey as et,ez as It,bA as Re,e6 as S,e7 as re,e8 as Be,dU as j,el as tt,eA as At,eB as Ot,eC as Mt,bx as Nt,bJ as jt,bQ as Rt,eD as Lt,bS as Vt,bT as Gt,bv as Ht,ed as zt,bV as Ut,bs as Xt,bX as Yt,bZ as qt,bW as _t,eE as Wt,eF as Jt,bt as ke,aA as Zt,ep as Qt,em as er,bF as tr,eG as rt,eH as nt,eI as oe,bu as rr,bq as at,dT as nr,bd as Ie,z as Ke,eJ as Le,cZ as ot,eK as Ve,eL as Ge,d3 as it,u as W,$ as ar,a2 as or,a1 as He,a4 as ir,co as lr,dj as sr,a as ur,b0 as ze,E as dr,b as cr,I as Q,a8 as lt,B as L,cU as Ue,M as st,T as ut,_ as dt,ay as Xe,at as pr,U as de,L as fr,h as gr,bn as yr,ax as mr,aS as hr,eM as Dr,eN as br,eO as $r,av as vr,b9 as Er,a7 as ct,cv as xr}from"./index-zQjLFfuj.js";import{$ as wr,a as Tr}from"./Policies-VixfIaVZ.js";import{d as kr}from"./Virtualizer-CTh266-x.js";import{$ as Kr}from"./ListLayout-DU_9AgrU.js";import{D as pt}from"./DaeCode-B4MDdwFy.js";import{b as Cr,g as Sr}from"./policyText-IIH31itq.js";import{P as Fr}from"./PolicyPicker-iyQz7WhP.js";import{$ as Pr}from"./useFilter-BYneYrGs.js";import"./useGridSelectionCheckbox-BK6qtlfZ.js";var P=(function(e){return e[e.none=0]="none",e[e.cancel=0]="cancel",e[e.move=1]="move",e[e.copy=2]="copy",e[e.link=4]="link",e[e.all=7]="all",e})({});const ft={...P,copyMove:3,copyLink:6,linkMove:5,all:7,uninitialized:7},gt=yt(ft);gt[7]="all";const ee={none:"cancel",link:"link",copy:"copy",move:"move"},De=yt(ee);function yt(e){let t={};for(let n in e)t[e[n]]=n;return t}const Br=new Set(["text/plain","text/uri-list","text/html"]),fe="application/vnd.react-aria.items+json",ge="application/octet-stream",Ae=new WeakMap,mt=Symbol();function Ir(e){let{id:t}=Ae.get(e)||{};if(!t)throw new Error("Droppable item outside a droppable collection");return t}function Ar(e){let{ref:t}=Ae.get(e)||{};if(!t)throw new Error("Droppable item outside a droppable collection");return t}function z(e){let t=new Set;for(let n of e)for(let r of Object.keys(n))t.add(r);return t}function ht(e){return e||(e="virtual"),e==="pointer"&&(e="virtual"),e==="virtual"&&typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches&&(e="touch"),e}function Oe(){return ht(Pt())}function Dt(){return ht(Bt())}function Ce(e,t){let n=new Map,r=!1,a=[];for(let o of t){let y=Object.keys(o);y.length>1&&(r=!0);let c={};for(let D of y){let v=n.get(D);v?r=!0:(v=[],n.set(D,v));let g=o[D];c[D]=g,v.push(g)}a.push(c)}for(let[o,y]of n)if(Br.has(o)){let c=y.join(`
`);e.items.add(c,o)}else e.items.add(y[0],o);if(r){let o=JSON.stringify(a);e.items.add(o,fe)}}class ie{constructor(t){this.types=new Set;let n=!1;for(let r of t.items)r.type!==fe&&(r.kind==="file"&&(n=!0),r.type?this.types.add(r.type):this.types.add(ge));this.includesUnknownTypes=!n&&t.types.includes("Files")}has(t){if(Array.isArray(t))return t.some(n=>this.has(n));if(this.includesUnknownTypes||t===mt&&this.types.has(ge)||t==="*/*")return!0;if(typeof t=="string"){if(t.endsWith("/*")){for(let n of this.types)if(n.startsWith(t.slice(0,-2)))return!0;return!1}return this.types.has(t)}return!1}}function bt(e){let t=[];if(!e)return t;let n=!1;if(e.types.includes(fe))try{let r=e.getData(fe),a=JSON.parse(r);for(let o of a)t.push({kind:"text",types:new Set(Object.keys(o)),getText:y=>Promise.resolve(o[y])});n=!0}catch{}if(!n){let r=new Map;for(let a of e.items)if(a.kind==="string")r.set(a.type||ge,e.getData(a.type));else if(a.kind==="file")if(typeof a.webkitGetAsEntry=="function"){let o=a.webkitGetAsEntry();if(!o)continue;o.isFile?t.push(Se(a.getAsFile())):o.isDirectory&&t.push($t(o))}else t.push(Se(a.getAsFile()));r.size>0&&t.push({kind:"text",types:new Set(r.keys()),getText:a=>Promise.resolve(r.get(a))})}return t}function Or(e){return typeof e.text=="function"?e.text():new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{t(r.result)},r.onerror=n,r.readAsText(e)})}function Se(e){if(!e)throw new Error("No file provided");return{kind:"file",type:e.type||ge,name:e.name,getText:()=>Or(e),getFile:()=>Promise.resolve(e)}}function $t(e){return{kind:"directory",name:e.name,getEntries:()=>Mr(e)}}async function*Mr(e){let t=e.createReader(),n;do{n=await new Promise((r,a)=>{t.readEntries(r,a)});for(let r of n)if(r.isFile){let a=await Nr(r);yield Se(a)}else r.isDirectory&&(yield $t(r))}while(n.length>0)}function Nr(e){return new Promise((t,n)=>e.file(t,n))}function jr(e){return e.kind==="text"}let B={draggingKeys:new Set};function Rr(e){B.draggingCollectionRef=e}function Lr(e){B.draggingKeys=e}function Y(e){B.dropCollectionRef=e}function vt(){B={draggingKeys:new Set}}function Vr(e){B=e}function V(e){let{draggingCollectionRef:t,dropCollectionRef:n}=B;return t?.current!=null&&t.current===(e?.current||n?.current)}let ce;function ye(e){ce=e}let Fe=P.none;function be(e){Fe=e}let Pe=new Map,te=new Map,R=null,me=new Set;function Et(e){return Pe.set(e.element,e),R?.updateValidDropTargets(),()=>{Pe.delete(e.element),R?.updateValidDropTargets()}}function Gr(e){return te.set(e.element,e),()=>{te.delete(e.element)}}function Hr(e,t){if(R)throw new Error("Cannot begin dragging while already dragging");R=new qr(e,t),requestAnimationFrame(()=>{R&&(R.setup(),Dt()==="keyboard"&&R.next())});for(let n of me)n()}function Me(){let[e,t]=x.useState(R);return x.useEffect(()=>{let n=()=>t(R);return me.add(n),()=>{me.delete(n)}},[]),e}function zr(){return!!R}function Ur(){R=null;for(let e of me)e()}const Ye=["pointerdown","pointermove","pointerenter","pointerleave","pointerover","pointerout","pointerup","mousedown","mousemove","mouseenter","mouseleave","mouseover","mouseout","mouseup","touchstart","touchmove","touchend","focusin","focusout"],Xr=["pointerup","mouseup","touchend"],Yr={keyboard:"dragStartedKeyboard",touch:"dragStartedTouch",virtual:"dragStartedVirtual"};class qr{constructor(t,n){this.validDropTargets=[],this.currentDropTarget=null,this.currentDropItem=null,this.dropOperation=null,this.mutationObserver=null,this.restoreAriaHidden=null,this.isVirtualClick=!1,this.dragTarget=t,this.stringFormatter=n,this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.onClick=this.onClick.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.cancelEvent=this.cancelEvent.bind(this),this.initialFocused=!1}setup(){document.addEventListener("keydown",this.onKeyDown,!0),document.addEventListener("keyup",this.onKeyUp,!0),window.addEventListener("focus",this.onFocus,!0),window.addEventListener("blur",this.onBlur,!0),document.addEventListener("click",this.onClick,!0),document.addEventListener("pointerdown",this.onPointerDown,!0);for(let t of Ye)document.addEventListener(t,this.cancelEvent,!0);this.mutationObserver=new MutationObserver(()=>this.updateValidDropTargets()),this.updateValidDropTargets(),ae(this.stringFormatter.format(Yr[Dt()]))}teardown(){document.removeEventListener("keydown",this.onKeyDown,!0),document.removeEventListener("keyup",this.onKeyUp,!0),window.removeEventListener("focus",this.onFocus,!0),window.removeEventListener("blur",this.onBlur,!0),document.removeEventListener("click",this.onClick,!0),document.removeEventListener("pointerdown",this.onPointerDown,!0);for(let t of Ye)document.removeEventListener(t,this.cancelEvent,!0);this.mutationObserver?.disconnect(),this.restoreAriaHidden?.()}onKeyDown(t){if(this.cancelEvent(t),t.key==="Escape"){this.cancel();return}t.key==="Tab"&&!(t.metaKey||t.altKey||t.ctrlKey)&&(t.shiftKey?this.previous( Line truncated
`),A=new Set(c.map(O=>O.group));return Ke(l.stagedText).filter(O=>A.has(O.name)).map(O=>({group:O.name,text:K.slice(O.from,O.to+1).join(`
`)}))},[l.stagedText,c]);return{groups:l.groups,unknown:l.unknown,byGroup:d,subscriptions:i,nodes:T,search:b,setSearch:m,loading:n.loading&&!n.data||a.loading&&!y||o.loading&&!o.data,error:[n,a,o].find(K=>K.error&&!K.data)?.error??(e.main?null:e.error),retry:x.useCallback(()=>void sr(),[]),blocked:F?t(F):null,busy:e.busy||h,applying:h,failure:k,changes:c,changeLines:c.map(K=>kn(K,$,t)),pendingText:t("arrange.pending",{n:c.length}),place:H,unplace:N,drop:K=>I(A=>Kn(A,K)),discard:()=>I(()=>[]),nameProblem:J,create:(K,A)=>I(O=>Te(O,{kind:"createGroup",group:K,policy:A})),reviewing:s&&c.length>0,setReviewing:K=>{h||u(K)},preview:X,canApply:c.length>0&&l.emptyNew.length===0&&!F&&!h,applyNote:l.emptyNew.length?t("arrange.emptyNew",{group:l.emptyNew[0]}):null,apply:Z}}function Hn({source:e,groups:t}){const n=W(),r=Cn(e),a=x.useMemo(()=>new Map((t??[]).map(o=>[o.name,o])),[t]);return r.error?f.jsx(dr,{error:r.error,onRetry:r.retry}):r.loading?f.jsx(cr,{}):f.jsxs("div",{className:"rp-arrange",children:[f.jsxs("div",{className:"rp-row",children:[f.jsxs("p",{className:"rp-note rp-grow",children:[f.jsx("span",{className:"rp-wide-only",children:n("arrange.note")}),f.jsx("span",{className:"rp-narrow-only",children:n("arrange.selectHint")})]}),f.jsx(Pn,{m:r})]}),r.blocked&&f.jsx(Q,{tone:"informative",children:r.blocked}),f.jsxs("div",{className:"rp-arrange-grid",children:[f.jsx("div",{className:"rp-col",children:r.groups.length?r.groups.map(o=>f.jsx(Sn,{group:o,live:a.get(o.name),m:r},o.name)):f.jsx(lt,{children:n("policy.empty")})}),f.jsx(Fn,{m:r})]}),r.changes.length>0&&f.jsxs(vn,{label:n("arrange.pendingRegion"),message:r.pendingText,children:[f.jsx(L,{quiet:!0,onPress:r.discard,isDisabled:r.busy,children:n("arrange.discard")}),f.jsx(L,{accent:!0,onPress:()=>r.setReviewing(!0),children:n("arrange.review")})]}),f.jsx(Bn,{m:r})]})}function Sn({group:e,live:t,m:n}){const r=W(),a=dt(),o=x.useId(),y=!!n.blocked,c=t?Sr(t.policy,r):null,D=async $=>{const l=await Promise.all($.filter(jr).filter(d=>d.types.has(pe)).map(d=>d.getText(pe)));n.place(e.name,l.flatMap(d=>Tn(d)??[]))},v=($,l,d)=>f.jsx(L,{quiet:!0,icon:!0,small:!0,label:r("arrange.remove",{name:$,group:e.name}),tip:d??void 0,isDisabled:y||n.applying||!!d,onPress:()=>n.unplace(e.name,l),children:f.jsx(ct,{})}),g=($,l)=>f.jsx(L,{quiet:!0,small:!0,label:r("arrange.undoRemove",{name:$}),isDisabled:n.applying,onPress:()=>n.place(e.name,[l]),children:r("arrange.undoShort")});return f.jsx(rn,{className:yr("rp-drop"),"aria-label":r("arrange.dropInto",{group:e.name}),isDisabled:y||n.applying,getDropOperation:$=>$.has(pe)?"copy":"cancel",onDrop:$=>void D($.items),children:({isDropTarget:$})=>f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"rp-row",children:f.jsxs("span",{className:"rp-cluster",children:[f.jsx("h3",{className:"rp-h3",id:o,children:e.name}),c&&f.jsx(Xe,{tip:c.id,children:c.label}),t&&f.jsx(pr,{small:!0,tone:"neutral",children:r("arrange.memberCount",{n:t.member_count})}),e.isNew&&f.jsx(Xe,{children:r("arrange.new")})]})}),e.holdsAll&&f.jsx("p",{className:"rp-note",children:r("arrange.holdsAll")}),(e.names.length>0||e.removedNames.length>0)&&f.jsxs(Je,{label:r("arrange.byName"),children:[f.jsx("span",{className:"rp-label rp-tags-title",children:r("arrange.byName")}),e.names.map(l=>f.jsx(ue,{tone:l.isNew?"new":void 0,action:v(l.name,{kind:"node",value:l.name},l.blocked),children:l.name},l.name)),e.removedNames.map(l=>f.jsx(ue,{tone:"removed",action:g(l,{kind:"node",value:l}),children:l},l))]}),(e.subscriptions.length>0||e.removedSubscriptions.length>0)&&f.jsxs(Je,{label:r("arrange.bySubscription"),children:[f.jsx("span",{className:"rp-label rp-tags-title",children:r("arrange.bySubscription")}),e.subscriptions.map(l=>f.jsx(ue,{tone:l.isNew?"new":void 0,action:v(l.label,{kind:"subscription",value:l.tag},l.blocked),children:l.count===null?l.label:r("arrange.subscriptionCount",{name:l.label,n:l.count})},l.tag)),e.removedSubscriptions.map(l=>f.jsx(ue,{tone:"removed",action:g(l.label,{kind:"subscription",value:l.tag}),children:l.label},l.tag))]}),e.rules.length>0&&f.jsxs("div",{className:"rp-arrange-rules",children:[f.jsx("span",{className:"rp-label",children:r("arrange.byRule")}),e.rules.map(l=>f.jsx(pt,{as:"code",text:l},l)),e.ruleNodes.length>0&&f.jsx("span",{children:e.ruleMore?r("arrange.ruleSelectsMore",{names:de(a,e.ruleNodes),n:e.ruleMore}):r("arrange.ruleSelects",{names:de(a,e.ruleNodes)})}),f.jsxs("span",{className:"rp-label",children:[e.ruleNote," ",f.jsx(fr,{appearance:"link",href:gr("config",{tab:"source"}),children:r("arrange.editSource")})]})]}),e.stillIn.length>0&&f.jsx(Q,{tone:"informative",children:r("arrange.stillIn",{names:de(a,e.stillIn)})}),$&&f.jsx("div",{className:"rp-drop-hint","aria-hidden":"true",children:r("arrange.dropHint")})]})})}function Fn({m:e}){const t=W(),n=x.useId(),r=!!e.blocked||e.applying,[a,o]=x.useState("all"),[y,c]=x.useState(new Set),D=x.useMemo(()=>[...a==="node"?[]:e.subscriptions.map(d=>({id:"subscription:"+d.tag,item:{k Line truncated
@@ -0,0 +1,4 @@
import{r as m,j as o}from"./vendor-react-Bf71BWbF.js";import{a0 as Re,aq as Te,ap as Xe,db as Ye,cL as q,an as Ze,a1 as xe,dc as en,dd as Le,de as nn,$ as Fe,y as Oe,h as we,N as oe,M as tn,df as sn,cP as Ae,u as F,a2 as ee,a as ne,a5 as on,ab as rn,a7 as ye,dg as ce,ay as He,dh as _e,bf as an,be as ln,A as cn,di as dn,bb as H,cO as $e,X as re,bc as Y,cA as de,dj as Be,dk as un,F as fn,dl as pn,D as gn,I as le,B as z,aG as ue,bx as Z,aH as fe,L as mn,aC as $,dm as hn,dn as bn,dp as vn,dq as xn,cz as wn,dr as yn,G as jn,ds as kn,b as Ie,ac as Sn,b2 as pe,T as G,af as Cn,bz as Nn,b1 as Dn,aE as We,dt as Mn,ae as Pn,du as En,aF as zn,E as Rn,j as Tn,aD as Ln,bn as Fn}from"./index-CXHBmSa5.js";import{d as On}from"./files-BxEOxSF8.js";import{r as An,d as Hn,a as _n,t as je,b as $n,w as ke,v as Bn,c as In,n as Wn}from"./setup-B5f1cfyO.js";import{g as Vn}from"./policyText-CAFy3qpo.js";import{a as Kn,s as Gn,c as Un}from"./nav-BeFLfZq8.js";import{S as qn,a as Jn,E as _,C as te,b as ge,l as Qn,h as Xn,c as Se,r as Yn,d as Zn,e as et,f as nt,i as tt,g as st,s as ot,k as rt,t as at,j as it,m as lt,n as ct,o as dt,p as ut,q as ft,u as pt,v as gt,w as Ve,D as J,R as mt,x as ht,y as bt,z as vt,A as xt,B as wt,F as Ke,H as yt,G as K}from"./vendor-editor-CF5uj9id.js";import{d as jt,s as kt,D as Ge}from"./DaeCode-STEiRZuV.js";import{A as St}from"./AddCircle-Db3HxlxQ.js";import{D as Ct}from"./Table-D0NFHHNQ.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";const Nt=["global","subscription","node","group","dns","routing"],Dt=(t,s,e)=>t?e("config.moduleEditBlocked"):s?e("ui.changeApplying"):void 0;function Ce(t,s){return`${q(t)}:${s.line+1}-${s.endLine+1}`}function Mt(t,s,e){return t.slice(0,s.from)+e+t.slice(s.to)}function Pt(t,s){const{section:e,text:n}=t,a=s.find(f=>f.id===e.id);if(a?.source?.content_sha256===e.source.content_sha256)return{next:null,conflict:!1};if(!a?.source?.content||!a.block)return{next:null,conflict:!0};const r=a.source.content.slice(a.block.from,a.block.to),l=e.source.content.slice(e.block.from,e.block.to);return{next:{section:{...a,source:a.source,block:a.block},text:n===l?r:n},conflict:r!==l&&n!==l&&r!==n}}function Et(t,s,e,n){const a=e.line+n.split(`
`).length;return t.filter(r=>r.source_id===s&&r.line!==null&&r.line>e.line&&r.line<=a).map(r=>({line:r.line-e.line,column:r.column,level:r.level,message:r.message}))}function zt(t,s){return t.filter(e=>e.source_id===s&&e.line!==null).map(e=>({line:e.line,column:e.column,level:e.level,message:e.message}))}function ae(t,s,e){return e.filter(n=>n.from>s.open&&n.to<=s.close&&n.depth===s.depth+1&&n.parens===0&&n.kind==="text"&&t.slice(n.from,n.to)==="->").length}function Ne(t,s,e){const n=s.filter(a=>a.from>t.open&&a.to<=t.close&&a.depth===t.depth+1&&a.parens===0&&(a.kind==="quoted"||a.kind==="text")&&!e.some(r=>a.from>=r.from&&a.to<=r.to));return e.length+n.length}function Rt(t,s,e,n,a,r){const l=oe(s,e,n);switch(t){case"global":return r("config.moduleSettings",{n:l.length});case"subscription":return r("config.moduleSubscriptions",{n:Ne(e,n,l)});case"node":return r("config.moduleNodes",{n:Ne(e,n,l)});case"group":return r("config.moduleGroups",{n:e.children.length,policies:Fe(a,e.children.map(c=>{const f=oe(s,c,n).find(u=>u.name==="policy")?.value;if(!f)return c.name;const i=tn(f);return r("ui.valuePair",{label:c.name,value:i?Vn({kind:i,native:f},r).label:f})}))});case"dns":{const c=e.children.filter(i=>i.name==="upstream"),f=e.children.filter(i=>i.name==="routing").flatMap(i=>i.children);return[r("config.moduleDnsUpstreams",{n:c.reduce((i,u)=>i+oe(s,u,n).length,0)}),r("config.moduleDnsRequests",{n:f.filter(i=>i.name==="request").reduce((i,u)=>i+ae(s,u,n),0)}),r("config.moduleDnsResponses",{n:f.filter(i=>i.name==="response").reduce((i,u)=>i+ae(s,u,n),0)})].join(r("ui.listSeparator"))}case"routing":{const c=r("config.moduleRules",{n:ae(s,e,n)}),f=l.find(i=>i.name==="fallback")?.value;return f?c+r("ui.separator")+r("ui.valuePair",{label:"fallback",value:f}):c}}}function Tt(t,s,e,n){const r=t.filter(i=>i.kind==="main"||i.kind==="include").map(i=>({source:i,...Oe(i.content??"")})),l=t.find(i=>i.kind==="main")??null,c=Nt.flatMap(i=>{const u=i==="group"?we("policies"):i==="node"||i==="subscription"?we("nodes"):null,g=r.flatMap(({source:d,blocks:v,tokens:S})=>v.filter(w=>w.name===i).map((w,b)=>({id:`${d.id}:${i}:${b}`,kind:i,source:d,block:w,href:u,range:Ce(d,w),summary:Rt(i,d.content,w,S,e,n),note:null})));return g.length||l&&l.content===void 0?g:[{id:i,kind:i,source:l,block:null,href:u,range:l?q(l):"config.dae",summary:l?.content===void 0?"":l.writable?n("config.moduleAbsent",{file:q(l)}):n("config.moduleAbsentReadOnly"),note:l?.content===void 0?n("config.contentWithheld"):null}]}),f=r.flatMap(({source:i,blocks:u})=>i.content===void 0?[{id:i.id,kind:q(i),source:i,block:null,href:null,range:q(i),summary:"",note:n("config.contentWithheld")}]:s.redactedSections(u).map(({block:g,name:d},v)=>({id:`${i.id}:${g.name}:${v}`,kind:d,source:i,block:null,href:null,range:Ce(i,g),summary:"",note:n("config.incomplete")})));return[...c,...f]}function Q(t,s,e){const n=Re(Kn,t.kind,e);return{id:t.id,label:Ye(t)?`${n} ${t.id.slice(0,8)}`:t.path,kind:n,facts:e("config.sourceFacts",{n:t.line_count,size:Xe(String(t.bytes),s)}),loaded:e("config.loadedAt",{time:Te(t.loaded_at,s)}),hasContent:t.content!==void 0}}const Lt={generated:{label:"config.kind.generated",note:"config.generatedNote"},subscription:{label:"config.kind.subscription",note:"config.subscriptionNote"},disabled:{label:"config.readOnly",note:"config.readOnlyNote",help:"config.readOnlyHelp"},secret:{label:"config.secretSource",note:"config.secretNote"},refused:{label:"config.readOnly",note:"config.refusedNote"},withheld:{label:"config.withheldSource",note:"config.contentWithheld"},redacted:{label:"config.redactedSource",note:"config.redactedNote"}};function Ft(t,s,e,n,a){const r=t.kind==="generated"||t.kind==="subscription"?t.kind:s?t.writable?t.content===void 0?"withheld":e===!1?"redacted":null:n.holdsCredentials(t)?"secret":"refused":"disabled";if(!r)return null;const l=Lt[r],c=a(l.label);return{reason:r,label:c,note:a(l.note),...l.help&&{help:{title:c,text:a(l.help)}}}}const Ot={error:"err",warning:"warn",info:"info"},At={error:"config.level.error",warning:"config.level.warning",info:"config.level.info"};function se(t,s,e,n){const a=new Map(s.map(l=>[l.id,q(l)])),r=new Map;for(const l of t){const c=JSON.stringify([l.level,l.source_id,l.line,l.column,l.code,l.message]),f=r.get(c);f?f.count++:r.set(c,{item:l,count:1})}return[...r].map(([l,{item:c,count:f}])=>{const i=a.get(c.source_id)??c.source_id,u=Ze(c.code,c.message,n).summary,g=f>1?n("config.repeated",{text:u,n:xe(f,e)}):u,d=en(c.code)?n("config.backendDetail",{text:g,message:c.message}):g;return{id:l,level:c.level,tone:Ot[c.level],levelText:Re(At,c.level,n),sourceId:c.source_id,line:c.line,where:c.line===null?i:`${i}:${c.line}`,message:g,code:c.code,detail:c.line===null?d:n("config.atFile",{file:i,line:xe(c.line,e),message:d}),count:f}})}function ie(t){return{...An(t),rules:t.trim()?"keep":Hn}}function Ht(t,s,e){return s.content_sha256===e.content_sha256?null:t?"conflict":"follow"}function _t(t,s,e){return{groupUsedText Line truncated
}`;v.dispatch({changes:{from:w,to:b,insert:x},selection:{anchor:w+d.label.length+4}})}}));else if(u==="routing"||u==="dns")g=[...Xt,...es];else if(u==="global")g=Qt;else if(u==="group")g=/\bpolicy\s*:\s*[\w.-]*$/.test(a)?De:[...De.map(d=>({...d,apply:"policy: "+d.label})),{label:"filter",type:"property",apply:"filter: "}];else return null;return{from:e.from,options:g,validFor:/^[\w.-]*$/}}function ts(t){return Jn({override:[s=>ns(s,t)]})}function ss(t,s){return s.filter(e=>e.line>=1&&e.line<=t.doc.lines).map(e=>{const n=t.doc.line(e.line),a=Math.max(0,(e.column??1)-1),r=new TextEncoder().encode(n.text);let l=0;for(let f=0;f<Math.min(a,r.length);){const i=r[f]<128?1:r[f]<224?2:r[f]<240?3:4;if(f+i>a)break;f+=i,l+=i===4?2:1}return{from:n.from+l,to:n.to,severity:e.level,message:e.message}})}function os(t){return t.key==="Backspace"||t.key==="Delete"||t.key==="Enter"?!0:[...t.key].length===1&&!t.ctrlKey&&!t.metaKey}function rs(t){let s=!1;const e=n=>(n.state.readOnly&&t(),!1);return _.domEventHandlers({keydown:(n,a)=>os(n)&&e(a),paste:(n,a)=>e(a),cut:(n,a)=>e(a),pointerdown:n=>(s=n.pointerType==="touch",!1),click:(n,a)=>s&&e(a)})}const as=[["Completions","cm.completions"],["Find","cm.find"],["Replace","cm.replace"],["next","cm.next"],["previous","cm.previous"],["all","cm.all"],["match case","cm.matchCase"],["regexp","cm.regexp"],["by word","cm.byWord"],["replace","cm.replaceOne"],["replace all","cm.replaceAll"],["close","close"],["Go to line","cm.gotoLine"],["go","cm.go"],["current match","cm.currentMatch"],["replaced $ matches","cm.replacedMatches"],["replaced match on line $","cm.replacedOnLine"],["on line","cm.onLine"],["Selection deleted","cm.selectionDeleted"],["Control character","cm.controlCharacter"]],Me=t=>ge.phrases.of(Object.fromEntries(as.map(([s,e])=>[s,t(e)]))),is=_.theme({"&":{backgroundColor:"var(--rp-base)",color:"var(--rp-text)",border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-md)",fontSize:"var(--rp-text-sm)"},"&.cm-focused":{outline:"none",borderColor:"var(--rp-accent)",boxShadow:"0 0 0 1px var(--rp-accent)"},".cm-scroller":{fontFamily:"ui-monospace, 'SF Mono', Menlo, Consolas, 'JetBrains Mono', 'Fira Code', 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono', monospace",lineHeight:"20px",maxHeight:"70vh",fontVariantLigatures:"none",borderRadius:"calc(var(--rp-r-md) - 1px)"},".cm-content":{padding:"8px 0",caretColor:"var(--rp-text)"},".cm-line":{padding:"0 12px"},".cm-gutters":{backgroundColor:"var(--rp-base)",color:"var(--rp-muted)",border:"none"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 12px",minWidth:"40px"},".cm-activeLine, .cm-focusLine":{backgroundColor:"color-mix(in srgb, var(--rp-hl-med) 60%, transparent)"},".cm-activeLineGutter":{backgroundColor:"transparent",color:"var(--rp-text)"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground, ::selection":{backgroundColor:"var(--rp-hl-high)"},".cm-cursor":{borderLeftColor:"var(--rp-text)"},".cm-matchingBracket":{backgroundColor:"color-mix(in srgb, var(--rp-accent) 20%, transparent)",outline:"none"},".cm-selectionMatch":{backgroundColor:"color-mix(in srgb, var(--rp-notice) 25%, transparent)"},".cm-tooltip.cm-tooltip-lint":{backgroundColor:"var(--rp-text)",color:"var(--rp-on-text)",border:"none",borderRadius:"var(--rp-r-sm)",padding:"2px 0"},".cm-tooltip-lint .cm-diagnostic":{border:"none",padding:"2px 8px",fontSize:"var(--rp-text-xs)",lineHeight:"16px",fontFamily:"inherit"},".cm-tooltip-lint .cm-diagnosticText":{color:"inherit"},".cm-diag-line-error":{backgroundColor:"color-mix(in srgb, var(--rp-negative) 14%, transparent)"},".cm-diag-line-warning":{backgroundColor:"color-mix(in srgb, var(--rp-notice) 16%, transparent)"},".cm-diag-line-info":{backgroundColor:"color-mix(in srgb, var(--rp-foam) 14%, transparent)"},".cm-lintRange-error":{backgroundImage:"none",textDecoration:"underline wavy var(--rp-negative)",textUnderlineOffset:"3px"},".cm-lintRange-warning":{backgroundImage:"none",textDecoration:"underline wavy var(--rp-notice)",textUnderlineOffset:"3px"},".cm-lintRange-info":{backgroundImage:"none",textDecoration:"underline dotted var(--rp-foam)",textUnderlineOffset:"3px"},".cm-tooltip":{backgroundColor:"var(--rp-surface)",border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-md)",color:"var(--rp-text)"},".cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"var(--rp-selected)",color:"var(--rp-text)"},".cm-tooltip.cm-tooltip-autocomplete > ul":{fontFamily:"ui-monospace, 'SF Mono', Menlo, Consolas, 'JetBrains Mono', 'Fira Code', 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono', monospace"},".cm-panels":{backgroundColor:"var(--rp-surface)",color:"var(--rp-text)"},".cm-panels-bottom":{borderTop:"1px solid var(--rp-hl-med)"},".cm-textfield":{border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-sm)",backgroundColor:"var(--rp-base)",color:"var(--rp-text)"},".cm-button":{border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-sm)",backgroundImage:"none Line truncated
@@ -1,4 +0,0 @@
import{r as h,j as o}from"./vendor-react-Bf71BWbF.js";import{j as Ne,q as He,c$ as $e,p as Ie,u as R,V as Me,ah as Te,ag as Oe,W as ie,d0 as We,cA as W,ae as Be,d1 as Ve,d2 as Pe,d3 as Ge,U as ze,h as me,F as se,D as Ke,_ as q,d4 as Ue,co as le,A as ee,b2 as V,X as J,b0 as _,a as Ee,ax as ce,T as O,B as T,a7 as qe,aT as de,at as L,d5 as Je,cE as Re,$ as Qe,a5 as Xe,a1 as he,b5 as Ye,b4 as Ze,d6 as en,cD as nn,Q as te,d7 as ue,d8 as sn,d9 as Le,x as tn,da as on,db as rn,dc as an,t as ln,v as cn,dd as dn,ay as pe,aw as un,E as pn,b as fn,au as gn,bc as mn,bo as hn,aS as bn,av as vn,M as xn,I as be,a8 as wn,L as yn}from"./index-zQjLFfuj.js";import{d as jn,s as Sn,D as Fe}from"./DaeCode-B4MDdwFy.js";import{D as kn}from"./Table-DLlwyNFJ.js";import{A as Cn}from"./AddCircle-DSsJ-CRu.js";import{S as Dn,a as Nn,C as oe,E as H,b as Y,l as Mn,h as Tn,c as Pn,d as zn,e as En,r as Rn,f as Ln,g as Fn,i as _n,j as An,k as Hn,m as $n,s as In,n as On,t as Wn,o as Bn,p as Vn,q as Gn,u as Kn,v as Un,w as qn,x as Jn,T as Qn,y as Xn,z as Yn,D as Z,R as Zn,A as es,B as ns,F as ss,H as ts,G as I}from"./vendor-editor-BYSNX95r.js";import{r as os,d as rs,a as as,t as ve,b as is,w as xe,v as ls,c as we,n as cs}from"./setup-BqwQo7FE.js";import{g as ds}from"./policyText-IIH31itq.js";import{a as us,s as ps,c as fs}from"./nav-BeFLfZq8.js";import{d as gs}from"./files-BxEOxSF8.js";import"./useGridSelectionCheckbox-BK6qtlfZ.js";import"./Virtualizer-CTh266-x.js";import"./ListLayout-DU_9AgrU.js";const ms=Dn.define({name:"dae",languageData:{commentTokens:{line:"#"},closeBrackets:{brackets:["(","{","'",'"']}},startState:Sn,token:jn}),hs=["global","subscription","node","group","dns","routing"].map(n=>({label:n,type:"keyword"})),bs=Ie.map(n=>({label:n,type:"property",apply:n+": "})),vs=["domain","dip","sip","dport","sport","l4proto","ipversion","pname","mac","dscp","qname","qtype","upstream"].map(n=>({label:n,type:"function",apply:n+"("})),xs=["geosite","geoip","suffix","full","keyword","regex"].map(n=>({label:n,type:"constant",apply:n+":"})),ye=$e.map(n=>({label:n,type:"constant"})),ws=He.map(n=>({label:n,type:"keyword"})),ys=[{label:"fallback",type:"keyword",apply:"fallback: "},{label:"include",type:"keyword",apply:"include "}];function js(n,s){const e=n.matchBefore(/[\w.-]*/);if(!e)return null;const t=n.state.doc.lineAt(n.pos),a=t.text.slice(0,n.pos-t.from),r=/->\s*[\w.-]*$/.test(a)||/^\s*fallback:\s*[\w.-]*$/.test(a);if(e.from===e.to&&!n.explicit&&!r)return null;const l=n.state.doc.sliceString(0,n.pos),{blocks:p,tokens:c}=Ne(l),d=c.at(-1);if(d?.to===n.pos&&(d.kind==="quoted"||d.kind==="comment"))return null;const i=p.find(b=>b.close===n.pos)?.name;let f;if(r)f=[...s().map(b=>({label:b.name,apply:b.written,type:"variable"})),...ws];else if(/\b(domain|dip|sip|qname)\(\s*[\w.-]*$/.test(a))f=xs;else if(i===void 0)f=hs.map(b=>({...b,apply:(v,x,k,C)=>{const j=b.label+` {
}`;v.dispatch({changes:{from:k,to:C,insert:j},selection:{anchor:k+b.label.length+4}})}}));else if(i==="routing"||i==="dns")f=[...vs,...ys];else if(i==="global")f=bs;else if(i==="group")f=/\bpolicy\s*:\s*[\w.-]*$/.test(a)?ye:[...ye.map(b=>({...b,apply:"policy: "+b.label})),{label:"filter",type:"property",apply:"filter: "}];else return null;return{from:e.from,options:f,validFor:/^[\w.-]*$/}}function Ss(n){return Nn({override:[s=>js(s,n)]})}function ks(n,s){return s.filter(e=>e.line>=1&&e.line<=n.doc.lines).map(e=>{const t=n.doc.line(e.line),a=Math.max(0,(e.column??1)-1),r=new TextEncoder().encode(t.text);let l=0;for(let c=0;c<Math.min(a,r.length);){const d=r[c]<128?1:r[c]<224?2:r[c]<240?3:4;if(c+d>a)break;c+=d,l+=d===4?2:1}return{from:t.from+l,to:t.to,severity:e.level,message:e.message}})}const Cs=[["Completions","cm.completions"],["Find","cm.find"],["Replace","cm.replace"],["next","cm.next"],["previous","cm.previous"],["all","cm.all"],["match case","cm.matchCase"],["regexp","cm.regexp"],["by word","cm.byWord"],["replace","cm.replaceOne"],["replace all","cm.replaceAll"],["close","close"],["Go to line","cm.gotoLine"],["go","cm.go"],["current match","cm.currentMatch"],["replaced $ matches","cm.replacedMatches"],["replaced match on line $","cm.replacedOnLine"],["on line","cm.onLine"],["Selection deleted","cm.selectionDeleted"],["Control character","cm.controlCharacter"]],je=n=>Y.phrases.of(Object.fromEntries(Cs.map(([s,e])=>[s,n(e)]))),Ds=H.theme({"&":{backgroundColor:"var(--rp-base)",color:"var(--rp-text)",border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-md)",fontSize:"var(--rp-text-sm)"},"&.cm-focused":{outline:"none",borderColor:"var(--rp-accent)",boxShadow:"0 0 0 1px var(--rp-accent)"},".cm-scroller":{fontFamily:"ui-monospace, 'SF Mono', Menlo, Consolas, 'JetBrains Mono', 'Fira Code', 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono', monospace",lineHeight:"20px",maxHeight:"70vh",fontVariantLigatures:"none"},".cm-content":{padding:"8px 0",caretColor:"var(--rp-text)"},".cm-line":{padding:"0 12px"},".cm-gutters":{backgroundColor:"var(--rp-base)",color:"var(--rp-muted)",border:"none"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 12px",minWidth:"40px"},".cm-activeLine":{backgroundColor:"color-mix(in srgb, var(--rp-hl-med) 60%, transparent)"},".cm-activeLineGutter":{backgroundColor:"transparent",color:"var(--rp-text)"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground, ::selection":{backgroundColor:"var(--rp-hl-high)"},".cm-cursor":{borderLeftColor:"var(--rp-text)"},".cm-matchingBracket":{backgroundColor:"color-mix(in srgb, var(--rp-accent) 20%, transparent)",outline:"none"},".cm-selectionMatch":{backgroundColor:"color-mix(in srgb, var(--rp-notice) 25%, transparent)"},".cm-tooltip.cm-tooltip-lint":{backgroundColor:"var(--rp-text)",color:"var(--rp-on-text)",border:"none",borderRadius:"var(--rp-r-sm)",padding:"2px 0"},".cm-tooltip-lint .cm-diagnostic":{border:"none",padding:"2px 8px",fontSize:"var(--rp-text-xs)",lineHeight:"16px",fontFamily:"inherit"},".cm-tooltip-lint .cm-diagnosticText":{color:"inherit"},".cm-diag-line-error":{backgroundColor:"color-mix(in srgb, var(--rp-negative) 14%, transparent)"},".cm-diag-line-warning":{backgroundColor:"color-mix(in srgb, var(--rp-notice) 16%, transparent)"},".cm-diag-line-info":{backgroundColor:"color-mix(in srgb, var(--rp-foam) 14%, transparent)"},".cm-lintRange-error":{backgroundImage:"none",textDecoration:"underline wavy var(--rp-negative)",textUnderlineOffset:"3px"},".cm-lintRange-warning":{backgroundImage:"none",textDecoration:"underline wavy var(--rp-notice)",textUnderlineOffset:"3px"},".cm-lintRange-info":{backgroundImage:"none",textDecoration:"underline dotted var(--rp-foam)",textUnderlineOffset:"3px"},".cm-tooltip":{backgroundColor:"var(--rp-surface)",border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-md)",color:"var(--rp-text)"},".cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"var(--rp-selected)",color:"var(--rp-text)"},".cm-tooltip.cm-tooltip-autocomplete > ul":{fontFamily:"ui-monospace, 'SF Mono', Menlo, Consolas, 'JetBrains Mono', 'Fira Code', 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono', monospace"},".cm-panels":{backgroundColor:"var(--rp-surface)",color:"var(--rp-text)"},".cm-panels-bottom":{borderTop:"1px solid var(--rp-hl-med)"},".cm-textfield":{border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-sm)",backgroundColor:"var(--rp-base)",color:"var(--rp-text)"},".cm-button":{border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-sm)",backgroundImage:"none",backgroundColor:"var(--rp-overlay)",color:"var(--rp-text)"}}),Ns=ts.define([{tag:I.comment,color:"var(--rp-code-comment)"},{tag:I.keyword,color:"var(--rp-code-keyword)",fontWeight:"700"},{tag:I.string,color:"var(--rp-code-string)"},{tag:I.number,color:"var(--rp-code-number)"},{tag:I.propertyName,color:"var(--rp-code-propertyName)"},{tag:I.variableName,color:"var(--rp-code-variableName)"},{tag:I.ope Line truncated
`).length;return n.filter(r=>r.source_id===s&&r.line!==null&&r.line>e.line&&r.line<=a).map(r=>({line:r.line-e.line,column:r.column,level:r.level,message:r.message}))}function Fs(n,s){return n.filter(e=>e.source_id===s&&e.line!==null).map(e=>({line:e.line,column:e.column,level:e.level,message:e.message}))}function re(n,s,e){return e.filter(t=>t.from>s.open&&t.to<=s.close&&t.depth===s.depth+1&&t.parens===0&&t.kind==="text"&&n.slice(t.from,t.to)==="->").length}function Ce(n,s,e){const t=s.filter(a=>a.from>n.open&&a.to<=n.close&&a.depth===n.depth+1&&a.parens===0&&(a.kind==="quoted"||a.kind==="text")&&!e.some(r=>a.from>=r.from&&a.to<=r.to));return e.length+t.length}function _s(n,s,e,t,a,r){const l=se(s,e,t);switch(n){case"global":return r("config.moduleSettings",{n:l.length});case"subscription":return r("config.moduleSubscriptions",{n:Ce(e,t,l)});case"node":return r("config.moduleNodes",{n:Ce(e,t,l)});case"group":return r("config.moduleGroups",{n:e.children.length,policies:ze(a,e.children.map(p=>{const c=se(s,p,t).find(i=>i.name==="policy")?.value;if(!c)return p.name;const d=Ke(c);return r("ui.valuePair",{label:p.name,value:d?ds({kind:d,native:c},r).label:c})}))});case"dns":{const p=e.children.filter(d=>d.name==="upstream"),c=e.children.filter(d=>d.name==="routing").flatMap(d=>d.children);return[r("config.moduleDnsUpstreams",{n:p.reduce((d,i)=>d+se(s,i,t).length,0)}),r("config.moduleDnsRequests",{n:c.filter(d=>d.name==="request").reduce((d,i)=>d+re(s,i,t),0)}),r("config.moduleDnsResponses",{n:c.filter(d=>d.name==="response").reduce((d,i)=>d+re(s,i,t),0)})].join(r("ui.listSeparator"))}case"routing":{const p=r("config.moduleRules",{n:re(s,e,t)}),c=l.find(d=>d.name==="fallback")?.value;return c?p+r("ui.separator")+r("ui.valuePair",{label:"fallback",value:c}):p}}}function As(n,s,e){const a=n.filter(c=>c.kind==="main"||c.kind==="include").map(c=>({source:c,...Ne(c.content??"")})),r=n.find(c=>c.kind==="main")??null,l=Es.flatMap(c=>{const d=c==="group"?me("policies"):c==="node"||c==="subscription"?me("nodes"):null,i=a.flatMap(({source:f,blocks:b,tokens:v})=>b.filter(x=>x.name===c).map((x,k)=>({id:`${f.id}:${c}:${k}`,kind:c,source:f,block:x,href:d,range:ke(f,x),summary:_s(c,f.content,x,v,s,e),note:null})));return i.length||r&&r.content===void 0?i:[{id:c,kind:c,source:r,block:null,href:d,range:r?W(r):"config.dae",summary:r?.content===void 0?"":r.writable?e("config.moduleAbsent",{file:W(r)}):e("config.moduleAbsentReadOnly"),note:r?.content===void 0?e("config.contentWithheld"):null}]}),p=a.flatMap(({source:c,blocks:d})=>c.content===void 0?[{id:c.id,kind:W(c),source:c,block:null,href:null,range:W(c),summary:"",note:e("config.contentWithheld")}]:d.filter(i=>i.name==="experimental"&&i.children.some(f=>f.name==="native_api")).map((i,f)=>({id:`${c.id}:experimental:${f}`,kind:"experimental.native_api",source:c,block:null,href:null,range:ke(c,i),summary:"",note:e("config.incomplete")})));return[...l,...p]}function G(n,s,e){const t=Me(us,n.kind,e);return{id:n.id,label:We(n)?`${t} ${n.id.slice(0,8)}`:n.path,kind:t,editable:e(n.writable?"config.editable":"config.readOnly"),tone:n.writable?"ok":"muted",facts:e("config.sourceFacts",{lines:ie(n.line_count,s),size:Oe(String(n.bytes),s),time:Te(n.loaded_at,s)}),hasContent:n.content!==void 0}}const Hs={error:"err",warning:"warn",info:"info"},$s={error:"config.level.error",warning:"config.level.warning",info:"config.level.info"};function ne(n,s,e,t){const a=new Map(s.map(l=>[l.id,W(l)])),r=new Map;for(const l of n){const p=JSON.stringify([l.level,l.source_id,l.line,l.column,l.code,l.message]),c=r.get(p);c?c.count++:r.set(p,{item:l,count:1})}return[...r.values()].map(({item:l,count:p},c)=>{const d=a.get(l.source_id)??l.source_id,i=Be(l.code,l.message,t),f=p>1?t("config.repeated",{text:i,n:ie(p,e)}):i,b=Ve(l.code)?t("config.backendDetail",{text:f,message:l.message}):f;return{id:String(c),level:l.level,tone:Hs[l.level],levelText:Me($s,l.level,t),sourceId:l.source_id,line:l.line,where:l.line===null?d:`${d}:${l.line}`,message:f,code:l.code,detail:l.line===null?b:t("config.atFile",{file:d,line:ie(l.line,e),message:b}),count:p}})}function ae(n){return{...os(n),rules:n.trim()?"keep":rs}}function Is(n,s,e){return{groupUsedText:n.rules==="keep"?null:ve[n.rules].groups.length?e("config.wizardNamedGroups",{names:ze(s,ve[n.rules].groups.map(t=>t.name))}):e("config.wizardGroupUsed",{name:n.group??is}),rows:n.subscriptions.flatMap((t,a)=>t.raw!==void 0&&!t.raw.trim()?[]:[{index:a,name:t.name,url:t.url,raw:t.raw!==void 0&&!t.name?t.raw.trim():null,nameError:t.raw===void 0&&!Ge(t.name.trim())?e("config.unquotable"):void 0,error:t.url!==""&&!as(t.url)?e("config.wizardSubscriptionHelp"):t.raw===void 0&&!Pe(t.url.trim())?e("config.unquotable"):void 0,description:a===0?e("config.wizardSubscriptionHelp"):void 0,removeLabel:e("config.wizardRemove",{name:t.name||t.raw?.trim()||""})}])}}const Os=["global","bypass","gfw","mini","standard","full"],De={global:["config.wizardGlobal","config.wizardGlobalHelp"],bypass: Line truncated
@@ -1,3 +0,0 @@
import{j as s,r as v}from"./vendor-react-Bf71BWbF.js";import{aB as sn,aC as on,aD as ue,aE as le,u as J,as as Be,X as he,_ as fe,ag as z,aF as Z,aG as an,aw as Ie,aH as ln,ax as pe,E as xe,W as se,aI as rn,aJ as cn,O as ie,Q as oe,S as dn,V as ge,aK as we,aL as Ee,aM as me,ah as un,aN as pn,aO as mn,aP as bn,al as je,aQ as hn,aR as Ve,ay as be,av as te,M as fn,I as _e,aS as We,aT as ae,B as O,aU as xn,aV as gn,aW as Ue,aX as wn,$ as He,a1 as Q,a5 as vn,a3 as yn,aY as jn,aZ as _n,a_ as kn,a$ as Nn,b0 as K,b1 as ke,b2 as Cn,N as Mn,a0 as Ln,b3 as Sn,R as Tn,a2 as An,b4 as Pn,b5 as Qe,b6 as Rn,a as Ne,b7 as Dn,b8 as Fn,A as On,T as Ce,b9 as de,ba as Bn,bb as In,at as En,au as Me,bc as Vn}from"./index-zQjLFfuj.js";import{F as Wn}from"./FactStrip-vcLr7nBw.js";import{B as Un,r as Hn}from"./ranked-C_Wt6A1w.js";import{u as Qn,C as Kn,s as Le,a as Gn,p as Se}from"./layout-B3T-zLsm.js";import{D as Jn}from"./Table-DLlwyNFJ.js";import{T as $n}from"./TimeCell-DxlzlVpw.js";import{t as Y,r as Ke,w as Te,a as Xn}from"./link-CaqmdEp1.js";import{c as Ae,d as Yn,e as Zn}from"./files-BxEOxSF8.js";import{D as qn}from"./DaeCode-B4MDdwFy.js";import{u as zn}from"./outbounds-CM0Hhk3q.js";import{u as et}from"./flows-Bv2rvXJX.js";import"./useGridSelectionCheckbox-BK6qtlfZ.js";import"./Virtualizer-CTh266-x.js";import"./ListLayout-DU_9AgrU.js";const H=64,nt=22,X=8,tt=28;function st({label:n,series:t,fmt:e,onSelect:l,regions:c,height:i=260}){const o=sn(),[a,r]=on(),{ref:p,tip:g,show:m,hide:h}=Qn(),w=Math.max(1,...t.flatMap(b=>b.points.flatMap(N=>[N.x,N.y]))),{end:u,ticks:R}=Gn(w),M=Math.max((r??0)-H-tt,1),_=i-X-nt,j=b=>H+Le(b,u)*M,y=b=>X+(1-Le(b,u))*_,D=new Map,k=t.flatMap(b=>b.points.map(N=>{const T=j(N.x),A=y(N.y),F=T+","+A,L=D.get(F)??0;return D.set(F,L+1),{point:N,color:b.color,cx:T,cy:A,nth:L,spot:F}})).map(b=>({...b,twins:D.get(b.spot)}));return s.jsx("div",{className:"rp-scatter",ref:a,children:s.jsxs("div",{className:"rp-chart-hover",ref:p,onPointerLeave:h,children:[r!==null&&s.jsxs("svg",{width:r,height:i,role:"img","aria-label":n,"aria-describedby":o,children:[R.map(b=>s.jsxs("g",{children:[s.jsx("line",{className:"grid",x1:j(b),x2:j(b),y1:X,y2:X+_}),s.jsx("line",{className:"grid",x1:H,x2:H+M,y1:y(b),y2:y(b)}),s.jsx("text",{className:"tick",x:j(b),y:i-6,textAnchor:"middle",children:e(b)}),s.jsx("text",{className:"tick",x:H-8,y:y(b)+4,textAnchor:"end",children:e(b)})]},b)),c&&s.jsxs("g",{className:"diagonal",children:[s.jsx("line",{x1:j(0),y1:y(0),x2:j(u),y2:y(u)}),s.jsx("text",{x:H+8,y:X+14,children:c.above}),s.jsx("text",{x:H+M-8,y:X+_-8,textAnchor:"end",children:c.below})]}),k.map(({point:b,color:N,cx:T,cy:A,nth:F,twins:L})=>{const P=2*Math.PI*F/L,S=L>1?6:0;return s.jsx("circle",{className:l?"pick":void 0,cx:T+S*Math.cos(P),cy:A+S*Math.sin(P),r:5,fill:N,onClick:l?()=>l(b.id):void 0,onPointerMove:E=>m(E,[b.name,b.detail])},b.id)})]}),s.jsx(Kn,{tip:g})]})})}function ot({series:n}){return s.jsx("div",{className:"rp-legend",children:n.map(t=>s.jsx(ue,{swatch:t.color,label:t.label,value:String(t.points.length)},t.id))})}function at(n){const t=new Map;let e=0;for(const o of n){if(o.upload_bytes===null||o.download_bytes===null){e++;continue}const a={id:o.id,up:Number(o.upload_bytes),down:Number(o.download_bytes),name:o.domain||o.dst||o.id},r=t.get(o.outbound);r?r.push(a):t.set(o.outbound,[a])}const l=[...t].map(([o,a])=>({outbound:o,points:a})).sort((o,a)=>le(o.outbound??"",a.outbound??""));let c,i=-1n;for(const o of n){if(o.upload_bytes===null||o.download_bytes===null)continue;const a=BigInt(o.upload_bytes)+BigInt(o.download_bytes);a>i&&(i=a,c={id:o.id,up:Number(o.upload_bytes),down:Number(o.download_bytes),name:o.domain||o.dst||o.id,outbound:o.outbound})}return{series:l,unknown:e,heaviest:c,placed:n.length-e}}const Pe=[0,2,3,1,4,5,6,7],lt=v.memo(function({records:t,outbounds:e,latency:l,latencyError:c,retryLatency:i,truncated:o,onSelect:a}){const r=J(),p=Be(),g=he[fe()],m=v.useCallback(M=>z(M,g),[g]),h=v.useMemo(()=>at(t),[t]),w=v.useMemo(()=>{const M=e.filter(j=>j!=="block"),_=j=>j==="block"?p.negative:p.cat[Pe[Math.max(0,M.indexOf(j))%Pe.length]];return h.series.map(j=>({id:j.outbound??"",label:Z(j.outbound,r),color:_(j.outbound),points:j.points.map(y=>({id:y.id,x:y.up,y:y.down,name:y.name,detail:r("conn.chart.point",{down:m(y.down),up:m(y.up)})}))}))},[h,e,p,r,m]),u=h.heaviest?[{label:r("conn.chart.busiest"),icon:s.jsx(an,{}),tint:"c3",value:h.heaviest.name,caption:Z(h.heaviest.outbound,r)},{label:r("conn.chart.down"),value:m(h.heaviest.down),icon:s.jsx(Ie,{}),tint:"c1"},{label:r("conn.chart.up"),value:m(h.heaviest.up),icon:s.jsx(ln,{}),tint:"c4"}]:[],R=h.unknown?r("conn.chart.sampleUnknown",{n:t.length,unknown:h.unknown}):r("conn.chart.sample",{n:t.length});return s.jsxs("div",{className:"rp-chart-page",children:[s.jsx(Wn,{facts:u,lead:!0}),s.jsxs(pe,{title:r("conn.chart.title"),note:R,children:[o&&s.jsx("p",{className:"rp-note",children:r("conn.truncated")}),h.placed>0&&s.jsxs(s.Fragment,{children:[s.jsx(st,{label:r("conn.cLine truncated
`)+`
`}function ft(n,t){const e=n.map(c=>c.id),l=t.bulkLimit!=null&&e.length>t.bulkLimit;return t.narrowed||t.truncated||l?{ids:e}:{ids:e,query:{type:t.network,src:t.src,all:!0}}}const xt=n=>n.target;function gt({collection:n,view:t,loading:e,selected:l,onSelect:c,selectOnFocus:i,onSort:o}){const a=J(),[r,p]=hn(442),g=v.useMemo(()=>{const w={dst:u=>s.jsx(te,{children:u.target}),src:u=>s.jsx(te,{className:"rp-code",children:u.source}),node:u=>s.jsx(te,{className:"rp-chain",text:u.path??void 0,children:u.node}),rule:u=>s.jsxs("span",{className:"rp-rule",children:[s.jsx(Ve,{...u.rule}),u.recomputed&&s.jsx(be,{children:u.recomputed})]}),state:u=>u.state,down:u=>u.download,downRate:u=>u.downloadRate,age:u=>s.jsx($n,{at:u.startedAt})};return G.filter(u=>!t.hidden.includes(u.id)).map(u=>({...u,label:a(u.label),grow:1,render:w[u.id]}))},[t.hidden,a]),m=v.useMemo(()=>n.map(w=>"connection"in w?w.connection:w),[n]),h=v.useMemo(()=>({grouped:t.group!=="none"}),[t.group]);return s.jsx("div",{ref:r,children:s.jsx(Jn,{label:a("nav.connections"),rowDetail:!0,cols:g,rows:m,height:p,selected:l,onSelect:c,selectOnFocus:i,reveal:!0,empty:a("conn.empty"),loading:e,sort:t.sort&&{column:String(t.sort.column),direction:t.sort.direction},onSort:o,getTextValue:xt,stream:!0,tree:h})})}function wt({dialog:n}){const t=J();return s.jsxs(fn,{title:t("rule.add"),narrow:!0,isOpen:!!n,onOpenChange:e=>{e||n?.close()},footer:()=>s.jsxs(s.Fragment,{children:[s.jsx(O,{onPress:()=>n?.close(),children:t("ui.cancel")}),s.jsx(O,{isDisabled:n?.disabled,isPending:n?.busy,onPress:()=>n?.applyNow(),children:t("rule.addApply")}),s.jsx(O,{accent:!0,isDisabled:n?.disabled||n?.busy,onPress:()=>n?.hold(),children:t("rule.hold")})]}),children:[n?.failure&&s.jsx(_e,{takeFocus:!0,children:n.failure.text},n.failure.id),n&&s.jsxs("div",{className:"rp-list",children:[n.failure?.lines.map((e,l)=>s.jsx("span",{className:"rp-label",children:e},l)),s.jsx(xe,{error:n.loadError,onRetry:n.retry}),s.jsx("span",{className:"rp-label",children:t("rule.holdHelp")}),n.targets&&s.jsx(We,{isDisabled:n.busy,label:t("rule.kind"),value:n.target,onChange:n.setTarget,items:n.targets}),s.jsxs("div",{className:"rp-toolbar top",children:[s.jsx(ae,{isDisabled:n.busy,label:t("ui.outbound"),value:n.outbound,onChange:n.setOutbound,items:n.outbounds}),s.jsx(ae,{isDisabled:n.busy||!n.positions.length,label:t("rule.position"),value:n.before,onChange:n.setBefore,items:n.positions})]}),n.moved&&s.jsx(_e,{tone:"informative",children:t("conn.ruleMoved")}),n.unplaceable&&s.jsx("p",{className:"rp-note",children:t("conn.ruleNoPosition")}),s.jsx(qn,{text:n.preview})]})]})}function vt(n,t){if(!t.some(m=>m.health?.length))return null;const e=[];let l=0;for(const m of t){const h=xn(gn(m.health??[]));h===void 0?l++:e.push({node:m.id,name:m.name,value:h,connections:0})}e.sort((m,h)=>m.value-h.value||le(m.name,h.name));const c=new Map(e.map(m=>[m.node,m])),i=n.some(m=>m.chain?.length);let o=0;for(const m of n){const h=m.chain?.at(-1);if(h===void 0)continue;const w=c.get(h);w?w.connections++:o++}const a=e.reduce((m,h)=>m+h.connections,0);let r=0;const p=e.find(m=>(r+=m.connections)>=Math.max(1,Math.ceil(a/2))),g=e.map(m=>m.value);return{samples:e,chains:i,missing:l,unplaced:o,used:e.filter(m=>m.connections).length,p50:Se(g,50),p90:Se(g,90),weightedP50:a?p.value:null}}function yt(n){const t=c=>c.flatMap(([i,o])=>{const a=wn(i,o);return a?[{kind:i,condition:a}]:[]}),e=n.domain?t([["domain",n.domain],["domainSuffix",n.domain]]):[],l=ie(n.dst);return e.length?e:l?t([["dip",l]]):[]}function jt(n,t,e,l){const c=r=>{const p=t.find(g=>g.id===r.source?.source_id);return!!p?.writable&&Ue(p,r)!==null},i=n.find(r=>r.rule_id===e&&c(r)),o=n.find(c),a=r=>r===n[0]?l("conn.ruleTop"):l("rule.positionBefore",{n:r.index+1});return[...i?[{rule:i,label:l("conn.ruleBeforeMatched")}]:[],...o&&o!==i?[{rule:o,label:a(o)}]:[]].map(({rule:r,label:p})=>({id:r.rule_id,label:p,desc:r.expression}))}function _t(n,t,e){if(!t)return{before:n[0]?.id,moved:!1};const l=n.find(c=>c.id===t.rule.rule_id&&(e===t.generation||c.desc===t.rule.expression));return l?{before:l.id,moved:!1}:{before:n[0]?.id,moved:!0}}function kt(n){const t=J(),e=He().data?.resources,l=Q(e,"rules",{whileLoading:!1})&&Q(e,"config",{whileLoading:!1})&&e?.config.writable===!0,[c,i]=v.useState(null),[o,a]=v.useState(null),r=!!c,p=et(r),g=vn(r),m=Q(e,"groups",{whileLoading:!1}),h=yn(r&&m),w=()=>{p.refetch(),g.refetch(),m&&h.refetch()},u=jn(),R=g.data?.sources??[],M=jt(p.data?.rules??[],R,c?.matched??null,t),_=_n(h.data??[]),j=!m||!!h.data,y=c?.outbound||_.find(f=>f.id===c?.current)?.id||(j?_[0].id:""),D=p.data?.generation_id,V=f=>{const C=p.data?.rules.find(W=>W.rule_id===f);return C&&D?{generation:D,rule:C}:null},{before:k,moved:b}=_t(M,c?.pin??null,D),N=c&&!c.pin?V(k):null;N&&i({...c,pin:N});const T=c?.targets[c.target],A=f=>{c&&!u.busy&&i({...c,...f})},F=()=>{u.busy&&(u.cancel(),w()),i(null),a(null)},L=()=>{K("negative",t("rule.stale")),w()},P=()=>{const f=p.data?.rules.find(W=> Line truncated
@@ -0,0 +1,3 @@
import{j as s,r as g}from"./vendor-react-Bf71BWbF.js";import{aM as fn,aN as gn,aO as fe,aP as de,u as Y,aB as Ge,a2 as ve,a as ye,ap as te,aQ as ee,aR as xn,aF as Je,aS as wn,aG as ge,E as je,a1 as ie,aT as vn,aU as yn,V as ue,X as re,Z as jn,a0 as ke,aV as _e,aW as Xe,aX as xe,aq as kn,aY as _n,aZ as Cn,a_ as Nn,au as Ae,a$ as Mn,b0 as Ye,aH as we,aE as le,ac as Ln,I as Te,b1 as Ze,b2 as ce,B as F,b3 as Sn,b4 as An,b5 as $e,b6 as Tn,a5 as qe,a7 as G,ab as Pn,a9 as Rn,b7 as Dn,b8 as Fn,b9 as On,ba as In,bb as J,f as Pe,bc as Bn,U as Wn,a6 as En,bd as Hn,Y as Un,a8 as Vn,be as Kn,bf as ze,bg as Qn,b as Re,bh as Gn,bi as Jn,A as Xn,T as De,bj as me,bk as Yn,bl as Zn,bm as $n,aC as qn,aD as Fe,bn as zn}from"./index-CXHBmSa5.js";import{F as et}from"./FactStrip-BgQ_tYB6.js";import{B as nt,r as tt}from"./ranked-FVqORIQj.js";import{u as st,C as ot,s as Oe,a as at,p as Ie}from"./layout-BRLew_nj.js";import{D as lt}from"./Table-D0NFHHNQ.js";import{T as it}from"./TimeCell-gSIuLEFc.js";import{t as z,r as en,w as Be,a as rt}from"./link-D6L0Eg5i.js";import{c as We,d as ct,e as dt}from"./files-BxEOxSF8.js";import{D as ut}from"./DaeCode-STEiRZuV.js";import{u as pt}from"./outbounds-f8QoVoCV.js";import{u as bt}from"./flows-C0byZ3sY.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";const Q=64,mt=22,q=8,ht=28;function ft({label:e,series:t,fmt:n,onSelect:a,regions:r,height:i=260}){const o=fn(),[l,c]=gn(),{ref:u,tip:j,show:b,hide:m}=st(),M=Math.max(1,...t.flatMap(h=>h.points.flatMap(A=>[A.x,A.y]))),{end:k,ticks:w}=at(M),p=Math.max((c??0)-Q-ht,1),N=i-q-mt,v=h=>Q+Oe(h,k)*p,y=h=>q+(1-Oe(h,k))*N,L=new Map,R=t.flatMap(h=>h.points.map(A=>{const _=v(A.x),C=y(A.y),T=_+","+C,B=L.get(T)??0;return L.set(T,B+1),{point:A,color:h.color,cx:_,cy:C,nth:B,spot:T}})).map(h=>({...h,twins:L.get(h.spot)}));return s.jsx("div",{className:"rp-scatter",ref:l,children:s.jsxs("div",{className:"rp-chart-hover",ref:u,onPointerLeave:m,children:[c!==null&&s.jsxs("svg",{width:c,height:i,role:"img","aria-label":e,"aria-describedby":o,children:[w.map(h=>s.jsxs("g",{children:[s.jsx("line",{className:"grid",x1:v(h),x2:v(h),y1:q,y2:q+N}),s.jsx("line",{className:"grid",x1:Q,x2:Q+p,y1:y(h),y2:y(h)}),s.jsx("text",{className:"tick",x:v(h),y:i-6,textAnchor:"middle",children:n(h)}),s.jsx("text",{className:"tick",x:Q-8,y:y(h)+4,textAnchor:"end",children:n(h)})]},h)),r&&s.jsxs("g",{className:"diagonal",children:[s.jsx("line",{x1:v(0),y1:y(0),x2:v(k),y2:y(k)}),s.jsx("text",{x:Q+8,y:q+14,children:r.above}),s.jsx("text",{x:Q+p-8,y:q+N-8,textAnchor:"end",children:r.below})]}),R.map(({point:h,color:A,cx:_,cy:C,nth:T,twins:B})=>{const O=2*Math.PI*T/B,U=B>1?6:0;return s.jsx("circle",{className:a?"pick":void 0,cx:_+U*Math.cos(O),cy:C+U*Math.sin(O),r:5,fill:A,onClick:a?()=>a(h.id):void 0,onPointerMove:D=>b(D,[h.name,h.detail])},h.id)})]}),s.jsx(ot,{tip:j})]})})}function gt({series:e}){return s.jsx("div",{className:"rp-legend",children:e.map(t=>s.jsx(fe,{swatch:t.color,label:t.label,value:String(t.points.length)},t.id))})}function xt(e){const t=new Map;let n=0;for(const o of e){if(o.upload_bytes===null||o.download_bytes===null){n++;continue}const l={id:o.id,up:Number(o.upload_bytes),down:Number(o.download_bytes),name:o.domain||o.dst||o.id},c=t.get(o.outbound);c?c.push(l):t.set(o.outbound,[l])}const a=[...t].map(([o,l])=>({outbound:o,points:l})).sort((o,l)=>de(o.outbound??"",l.outbound??""));let r,i=-1n;for(const o of e){if(o.upload_bytes===null||o.download_bytes===null)continue;const l=BigInt(o.upload_bytes)+BigInt(o.download_bytes);l>i&&(i=l,r={id:o.id,up:Number(o.upload_bytes),down:Number(o.download_bytes),name:o.domain||o.dst||o.id,outbound:o.outbound})}return{series:a,unknown:n,heaviest:r,placed:e.length-n}}const Ee=[0,2,3,1,4,5,6,7],wt=g.memo(function({records:t,outbounds:n,latency:a,latencyError:r,retryLatency:i,truncated:o,onSelect:l}){const c=Y(),u=Ge(),j=ve[ye()],b=g.useCallback(p=>te(p,j),[j]),m=g.useMemo(()=>xt(t),[t]),M=g.useMemo(()=>{const p=n.filter(v=>v!=="block"),N=v=>v==="block"?u.negative:u.cat[Ee[Math.max(0,p.indexOf(v))%Ee.length]];return m.series.map(v=>({id:v.outbound??"",label:ee(v.outbound,c),color:N(v.outbound),points:v.points.map(y=>({id:y.id,x:y.up,y:y.down,name:y.name,detail:c("conn.chart.point",{down:b(y.down),up:b(y.up)})}))}))},[m,n,u,c,b]),k=m.heaviest?[{label:c("conn.chart.busiest"),icon:s.jsx(xn,{}),tint:"c3",value:m.heaviest.name,caption:ee(m.heaviest.outbound,c)},{label:c("conn.chart.down"),value:b(m.heaviest.down),icon:s.jsx(Je,{}),tint:"c1"},{label:c("conn.chart.up"),value:b(m.heaviest.up),icon:s.jsx(wn,{}),tint:"c4"}]:[],w=m.unknown?c("conn.chart.sampleUnknown",{n:t.length,unknown:m.unknown}):c("conn.chart.sample",{n:t.length});return s.jsxs("div",{className:"rp-chart-page",children:[s.jsx(et,{facts:k,lead:!0}),s.jsxs(ge,{title:c("conn.chart.title"),note:w,children:[o&&s.jsx("p",{className:"rp-note",children:c("conn.truncated")}),m.placed>0&&s.jsxs(s.Fragment,{children:[s.jsx(fLine truncated
`)+`
`}function Ft(e,t){const n=e.map(r=>r.id),a=t.bulkLimit!=null&&n.length>t.bulkLimit;return t.narrowed||t.truncated||a?{ids:n}:{ids:n,query:{type:t.network,src:t.src,all:!0}}}const Ot=e=>e.target;function It({collection:e,view:t,collapse:n,onToggleGroup:a,loading:r,selected:i,onSelect:o,selectOnFocus:l,onSort:c}){const u=Y(),[j,b]=Mn(442),m=g.useMemo(()=>{const w={dst:p=>s.jsx(le,{children:p.target}),src:p=>s.jsx(le,{className:"rp-code",children:p.source}),node:p=>s.jsx(le,{className:"rp-chain",text:p.path??void 0,children:p.node}),rule:p=>s.jsxs("span",{className:"rp-rule",children:[s.jsx(Ye,{...p.rule}),p.recomputed&&s.jsx(we,{children:p.recomputed})]}),state:p=>p.state,down:p=>p.download,downRate:p=>p.downloadRate,age:p=>s.jsx(it,{at:p.startedAt})};return X.filter(p=>!t.hidden.includes(p.id)).map(p=>({...p,label:u(p.label),grow:1,render:w[p.id]}))},[t.hidden,u]),M=g.useMemo(()=>e.map(w=>"connection"in w?w.connection:w),[e]),k=g.useMemo(()=>({grouped:t.group!=="none",collapsed:w=>nn(n,w),onToggle:a}),[t.group,n,a]);return s.jsx("div",{ref:j,children:s.jsx(lt,{label:u("nav.connections"),rowDetail:!0,cols:m,rows:M,height:b,selected:i&&Ce(i),onSelect:o&&(w=>o(w&&Ct(w))),selectOnFocus:l,reveal:!0,empty:u("conn.empty"),loading:r,sort:t.sort&&{column:String(t.sort.column),direction:t.sort.direction},onSort:c,getTextValue:Ot,stream:!0,tree:k})})}function Bt({dialog:e}){const t=Y();return s.jsxs(Ln,{title:t("rule.add"),narrow:!0,isOpen:!!e,reason:e?.reason,onOpenChange:n=>{n||e?.close()},footer:()=>s.jsxs(s.Fragment,{children:[s.jsx(F,{onPress:()=>e?.close(),children:t("ui.cancel")}),s.jsx(F,{isDisabled:e?.disabled,isPending:e?.busy,onPress:()=>e?.applyNow(),children:t("rule.addApply")}),s.jsx(F,{accent:!0,isDisabled:e?.disabled||e?.busy,onPress:()=>e?.hold(),children:t("rule.hold")})]}),children:[e?.failure&&s.jsx(Te,{takeFocus:!0,children:e.failure.text},e.failure.id),e&&s.jsxs("div",{className:"rp-list",children:[e.failure?.lines.map((n,a)=>s.jsx("span",{className:"rp-label",children:n},a)),s.jsx(je,{error:e.loadError,onRetry:e.retry}),s.jsx("span",{className:"rp-label",children:t("rule.holdHelp")}),e.targets&&s.jsx(Ze,{isDisabled:e.busy,label:t("rule.kind"),value:e.target,onChange:e.setTarget,items:e.targets}),s.jsxs("div",{className:"rp-toolbar top",children:[s.jsx(ce,{isDisabled:e.busy,label:t("ui.outbound"),value:e.outbound,onChange:e.setOutbound,items:e.outbounds}),s.jsx(ce,{isDisabled:e.busy||!e.positions.length,label:t("rule.position"),value:e.before,onChange:e.setBefore,items:e.positions})]}),e.moved&&s.jsx(Te,{tone:"informative",children:t("conn.ruleMoved")}),e.unplaceable&&s.jsx("p",{className:"rp-note",children:t("conn.ruleNoPosition")}),s.jsx(ut,{text:e.preview})]})]})}function Wt(e,t){if(!t.some(b=>b.health?.length))return null;const n=[];let a=0;for(const b of t){const m=Sn(An(b.health??[]));m===void 0?a++:n.push({node:b.id,name:b.name,value:m,connections:0})}n.sort((b,m)=>b.value-m.value||de(b.name,m.name));const r=new Map(n.map(b=>[b.node,b])),i=e.some(b=>b.chain?.length);let o=0;for(const b of e){const m=b.chain?.at(-1);if(m===void 0)continue;const M=r.get(m);M?M.connections++:o++}const l=n.reduce((b,m)=>b+m.connections,0);let c=0;const u=n.find(b=>(c+=b.connections)>=Math.max(1,Math.ceil(l/2))),j=n.map(b=>b.value);return{samples:n,chains:i,missing:a,unplaced:o,used:n.filter(b=>b.connections).length,p50:Ie(j,50),p90:Ie(j,90),weightedP50:l?u.value:null}}function Et(e){const t=r=>r.flatMap(([i,o])=>{const l=Tn(i,o);return l?[{kind:i,condition:l}]:[]}),n=e.domain?t([["domain",e.domain],["domainSuffix",e.domain]]):[],a=ue(e.dst);return n.length?n:a?t([["dip",a]]):[]}function Ht(e,t,n,a){const r=c=>{const u=t.find(j=>j.id===c.source?.source_id);return!!u?.writable&&$e(u,c)!==null},i=e.find(c=>c.rule_id===n&&r(c)),o=e.find(r),l=c=>c===e[0]?a("conn.ruleTop"):a("rule.positionBefore",{n:c.index+1});return[...i?[{rule:i,label:a("conn.ruleBeforeMatched")}]:[],...o&&o!==i?[{rule:o,label:l(o)}]:[]].map(({rule:c,label:u})=>({id:c.rule_id,label:u,desc:c.expression}))}function Ut(e,t,n){if(!t)return{before:e[0]?.id,moved:!1};const a=e.find(r=>r.id===t.rule.rule_id&&(n===t.generation||r.desc===t.rule.expression));return a?{before:a.id,moved:!1}:{before:e[0]?.id,moved:!0}}function Vt({disabled:e,busy:t,failed:n,unplaceable:a},r){return e&&!t&&!n&&!a?r("ui.loading"):null}function Kt(e){const t=Y(),n=qe().data?.resources,a=G(n,"rules",{whileLoading:!1})&&G(n,"config",{whileLoading:!1})&&n?.config.writable===!0,[r,i]=g.useState(null),[o,l]=g.useState(null),c=!!r,u=bt(c),j=Pn(c),b=G(n,"groups",{whileLoading:!1}),m=Rn(c&&b),M=()=>{u.refetch(),j.refetch(),b&&m.refetch()},k=Dn(),w=j.data?.sources??[],p=Ht(u.data?.rules??[],w,r?.matched??null,t),N=Fn(m.data??[]),v=!b||!!m.data,y=r?.outbound||N.find(x=>x.id===r?.current)?.id||(v?N[0].id:""),L=u.data?.generation_id,Z=x=>{const S=u.data?.rules.find(K=>K.rule_id===x);return S&&L?{generation:L,rule:S}:null},{before:R,moved:h}=Ut(p,r?.pin??null,L),A=r&&!r.pin?Z(R):null;A&&i( Line truncated
@@ -1,3 +1,3 @@
import{r as o}from"./vendor-react-Bf71BWbF.js";const h=/^(global|dns|upstream|routing|request|response|subscription|node|group|include|fallback)\b/,p=()=>({afterArrow:!1});function l(t,e){return t.sol()&&(e.afterArrow=!1),t.eatSpace()?null:t.match("#")?(t.skipToEnd(),"comment"):t.match(/^'[^']*'/)||t.match(/^"[^"]*"/)?"string":t.match("->")?(e.afterArrow=!0,"operator"):e.afterArrow&&t.match(/^[\w.-]+/)?(e.afterArrow=!1,"keyword"):(t.sol()||t.string.slice(0,t.pos).trim()==="")&&t.match(h)?"keyword":t.match(/^\d+(\.\d+)*(\/\d+)?[a-z]*/)?"number":t.match(/^[\w.-]+(?=\s*\()/)?"propertyName":t.match(/^[\w.-]+(?=\s*:)/)?"variableName":t.match(/^[A-Za-z_][\w.-]*/)?null:t.match(/^[{}()&|!,:]/)?"punctuation":(t.next(),null)}class f{constructor(e){this.string=e}pos=0;sol(){return this.pos===0}eatSpace(){const e=/^\s+/.exec(this.string.slice(this.pos));return e?(this.pos+=e[0].length,!0):!1}match(e){const s=typeof e=="string"?this.string.slice(this.pos).startsWith(e)&&e:e.exec(this.string.slice(this.pos));return s&&(this.pos+=typeof s=="string"?s.length:s[0].length),s}skipToEnd(){this.pos=this.string.length}next(){return this.pos<this.string.length?this.string[this.pos++]:void 0}}function g(t){const e=[],s=t.split(`
import{r as o}from"./vendor-react-Bf71BWbF.js";const h=/^(global|dns|upstream|routing|request|response|subscription|node|group|include|fallback)\b/,p=()=>({afterArrow:!1});function l(t,e){return t.sol()&&(e.afterArrow=!1),t.eatSpace()?null:t.match("#")?(t.skipToEnd(),"comment"):t.match(/^'[^']*'/)||t.match(/^"[^"]*"/)?"string":t.match("->")?(e.afterArrow=!0,"operator"):e.afterArrow&&t.match(/^[\w.-]+/)?(e.afterArrow=!1,"keyword"):(t.sol()||t.string.slice(0,t.pos).trim()==="")&&t.match(h)?"keyword":t.match(/^\d+(\.\d+)*(\/\d+)?[a-z]*/)?"number":t.match(/^[\w.-]+(?=\s*\()/)?"propertyName":t.match(/^[\w.-]+(?=\s*:)/)?"variableName":t.match(/^[A-Za-z_][\w.-]*/)?null:t.match(/^[{}()&|!,:]/)?"punctuation":(t.next(),null)}class f{pos=0;string;constructor(e){this.string=e}sol(){return this.pos===0}eatSpace(){const e=/^\s+/.exec(this.string.slice(this.pos));return e?(this.pos+=e[0].length,!0):!1}match(e){const s=typeof e=="string"?this.string.slice(this.pos).startsWith(e)&&e:e.exec(this.string.slice(this.pos));return s&&(this.pos+=typeof s=="string"?s.length:s[0].length),s}skipToEnd(){this.pos=this.string.length}next(){return this.pos<this.string.length?this.string[this.pos++]:void 0}}function g(t){const e=[],s=t.split(`
`),r=p();return s.forEach((n,c)=>{const i=new f(n);for(;i.pos<n.length;){const u=i.pos,a=l(i,r);e.push({text:n.slice(u,i.pos),type:a})}c<s.length-1&&e.push({text:`
`,type:null})}),e}function m({text:t,as:e="span",className:s=""}){return o.createElement(e,{className:`rp-code ${s}`.trim()},g(t).map((r,n)=>r.type?o.createElement("span",{key:n,className:`rp-dae-${r.type}`},r.text):r.text))}export{m as D,l as d,p as s};
@@ -1,3 +0,0 @@
import{r as m,j as a}from"./vendor-react-Bf71BWbF.js";import{u as g,aB as ye,bd as we,V as Ne,aI as j,ah as Ce,W as ne,ad as Te,A as _e,al as Se,be as re,$ as V,b2 as q,bf as le,Q as Y,b5 as De,b4 as Le,X as $,_ as I,bg as Z,N as Re,b1 as Ae,b8 as Ee,bh as qe,b0 as O,a as B,a1 as Fe,bi as Me,aE as ke,a8 as C,b as ie,E as R,as as Q,bj as Oe,bk as Pe,bl as We,bm as Be,ax as L,aD as ee,az as ce,aS as Ue,T as U,aT as oe,B as F,bn as He,ay as de,au as z,bc as Ve,av as D,at as se,aw as $e,bo as Ie,bb as Qe,ba as ze}from"./index-zQjLFfuj.js";import{D as ue}from"./Table-DLlwyNFJ.js";import{T as H}from"./TimeCell-DxlzlVpw.js";import{A as Ke}from"./ActionGroup-C-LVMOvQ.js";import{q as Xe,u as me,a as Ge,s as Je,b as Ye}from"./dns-BoPCaePc.js";import{c as ae,d as Ze,e as es}from"./files-BxEOxSF8.js";import{d as ss}from"./nav--TYgv3Ng.js";import{F as as}from"./FactStrip-vcLr7nBw.js";import{r as te,B as ts}from"./ranked-C_Wt6A1w.js";import{u as ns,w as rs,C as ls,p as P}from"./layout-B3T-zLsm.js";import"./useGridSelectionCheckbox-BK6qtlfZ.js";import"./Virtualizer-CTh266-x.js";import"./ListLayout-DU_9AgrU.js";function is({label:r,shares:t}){const e=g(),s=ye(),{ref:i,tip:n,show:l,hide:c}=ns(),o=m.useMemo(()=>{const u=rs(t.map(h=>h.count));return t.flatMap((h,x)=>Array.from({length:u[x]},()=>h))},[t]);return a.jsxs("div",{className:"rp-waffle rp-chart-hover",ref:i,onPointerLeave:c,children:[a.jsx("div",{className:"grid",role:"img","aria-describedby":s,"aria-label":e("ui.valuePair",{label:r,value:t.map(u=>`${u.label} ${u.text}`).join(e("ui.separator"))}),children:o.map((u,h)=>a.jsx("span",{style:{background:u.color},onPointerMove:x=>l(x,[u.label,u.text])},h))}),a.jsx("ul",{className:"legend",children:t.map(u=>a.jsxs("li",{children:[a.jsx("i",{className:"sw",style:{background:u.color}}),a.jsx("span",{children:u.label}),a.jsx("b",{children:u.text})]},u.id))}),a.jsx(ls,{tip:n})]})}function cs({className:r,...t}){return a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:we("rp-icon",r),...t,children:[a.jsx("path",{fill:"currentColor",d:"M8.249 15.021c-.4 0-.733-.317-.748-.72l-.25-6.5c-.017-.414.307-.763.72-.779H8c.4 0 .733.317.748.72l.25 6.5c.017.414-.307.763-.72.778zM11.751 15.021h-.03c-.413-.016-.737-.365-.72-.779l.25-6.5c.015-.403.348-.72.748-.72h.03c.413.016.737.365.72.779l-.25 6.5c-.015.403-.348.72-.748.72"}),a.jsx("path",{fill:"currentColor",d:"M17 4h-3.5v-.75C13.5 2.01 12.49 1 11.25 1h-2.5C7.51 1 6.5 2.01 6.5 3.25V4H3c-.414 0-.75.336-.75.75s.336.75.75.75h.52l.422 10.342C3.99 17.052 4.98 18 6.19 18h7.62c1.211 0 2.2-.948 2.248-2.158L16.48 5.5H17c.414 0 .75-.336.75-.75S17.414 4 17 4m-9-.75c0-.413.337-.75.75-.75h2.5c.413 0 .75.337.75.75V4H8zm6.56 12.531c-.017.404-.346.719-.75.719H6.19c-.404 0-.733-.315-.75-.719L5.02 5.5h9.96z"})]})}const os={forced:"dns.route.forced","dns.routing":"dns.route.rules",default:"dns.route.default"};function pe(r,t){return{fields:[[t("ui.state"),r.status],[t("ui.upstream"),r.upstream??"—"],[t("dns.routeSource"),Ne(os,r.route.source,t)],[t("dns.routeRule"),r.route.rule??"—"],[t("ui.elapsed"),j(r.elapsed_ms,t)]],answers:(r.answers??[]).map(e=>t("dns.answer",{name:e.name,type:e.type,ttl:e.ttl,data:e.data})),cacheText:t(r.cached?"dns.hit":"dns.miss"),cacheTone:r.cached?void 0:"warn"}}function ds(r,t,e,s,i,n){const l=t?.dns_query.record_types??[];return{types:l,choices:[...l.map(c=>({id:c,label:c})),{id:"all",label:n("dns.allTypes")}],disabled:i||!t?.dns_query.available||!(e==="all"?l.length>0:l.includes(e))||!s.trim(),showCache:!!t?.dns_cache.available,cards:r?.results.map(c=>({id:c.type,title:`${r.domain} ${c.type}`,...pe(c,n)}))??[],tabs:ss(t).map(c=>({id:c.id,label:n(c.titleKey)}))}}function us(r,t,e,s,i,n){const l=e.toLowerCase();return{fields:[[n("dns.entries"),r?ne(r.total,i):"—"]],coverage:r?["positive","negative","persistent"].filter(c=>!r.coverage[c]).map(c=>({id:c,text:n("ui.valuePair",{label:n({positive:"dns.positive",negative:"dns.negative",persistent:"dns.persistent"}[c]),value:n("dns.notCovered")})})):[],filterText:l?n("dns.cacheFilter",{domain:e}):"",confirmationText:r?n("dns.flushConfirm",{n:r.total}):n("dns.flushConfirmAll"),flushDisabled:!!s||!t?.dns_cache.available||!t.dns_cache.flush,empty:n(t?.dns_cache.available&&t.dns_cache.read?"dns.empty":"dns.cacheUnavailable"),rows:(r?.entries??[]).filter(c=>!l||c.domain.toLowerCase().includes(l)).map(c=>({id:c.entry_id,domain:c.domain,type:c.type,status:c.status,expiresAt:c.expires_at,staleUntil:c.stale_until,deleteLabel:n("dns.deleteEntry",{domain:c.domain,type:c.type}),pending:s===c.entry_id,disabled:!!s||!t?.dns_cache.available||!t.dns_cache.delete_entry}))}}function ms(r,t,e,s){const i=r?.records.find(l=>l.id===t);if(!i)return null;const n=pe(i,s);return{id:i.id,title:i.question.name,answers:n.answers,fields:[[s("ui.type"),i.question.type],[s("ui.device"),i.src??"—"],n.fields[0],[s("ui.cache"),n.cacheText],...n.fields.slice(1),[s("ui.time"),CeLine truncated
`)+`
`}function xs(r,t){const e=new Set(r.records.map(s=>s.id));return{...r,records:[...r.records,...t.records.filter(s=>!e.has(s.id))],next_cursor:t.next_cursor}}function fs(r,t){const e=t&&new Set(t.records.map(s=>s.id));return{data:t??r,newerWaiting:!!e&&!!r?.records.some(s=>!e.has(s.id))}}function gs(r,t,e){if(!r)return null;const{usage:s,coverage:i}=r,n=c=>{const o=Se(c);return o===null?"—":ne(o,t)},l=s?Te(s.entries,s.entry_capacity):null;return{note:s?void 0:e("dns.chart.cacheNote",{n:r.total}),usage:s&&l!==null?{pct:l,value:l>0&&l<.5?"<"+e("ui.percent",{n:1}):e("ui.percent",{n:Math.round(l)}),facts:e("dns.chart.usageFacts",{entries:e("ui.fraction",{part:n(s.entries),whole:n(s.entry_capacity)})})}:null,coverage:e("dns.chart.coverage",{kinds:[i.positive&&e("dns.chart.positive"),i.negative&&e("dns.chart.negative")].filter(Boolean).join(e("ui.listSeparator")),persistent:e(i.persistent?"dns.chart.persistent":"dns.chart.memoryOnly")})}}function bs(r,t,e){return r?e instanceof _e&&e.status===503?"unavailable":t?"ready":e?"error":"loading":"unlisted"}function vs({go:r,query:t}){const e=g(),s=re(),i=V(),n=m.useMemo(()=>new URLSearchParams(t),[t]),[l,c]=m.useState(n.get("domain")??""),[o,u]=m.useState(n.get("type")??"A");q(n.get("domain"),p=>c(p??"")),q(n.get("type"),p=>u(p??"A"));const[h,x]=m.useState(null),{busy:y,error:d,run:v}=le({rethrow:!0}),f=i.data?.resources,w=m.useMemo(()=>ds(h,f,o,l,!!y,e),[h,f,o,l,y,e]),N=n.has("domain")&&w.tabs.some(p=>p.id==="log")?"log":w.tabs[0]?.id??"query",A=async()=>{try{await v("query",async p=>{const _=await Xe(s.dnsQuery,l.trim(),o==="all"?w.types:[o],f?.dns_query.limits?.max_types_per_request??1,p);return p.aborted||x(_),_})}catch{}};return{...w,domain:l,setDomain:c,type:o,setType:u,pending:y==="query",queryError:d,submit:()=>void A(),setTab:p=>r("dns",Le(t,p,f&&!n.has("domain")?N:null)),tab:De(t,w.tabs.map(p=>p.id),N),filterDomain:n.get("domain")??"",logEnabled:f?.dns_log.available,viewCache:()=>r("dns",Y(t,{tab:"cache",domain:h?.domain??""})),clearCacheFilter:()=>r("dns",Y(t,{tab:"cache",domain:null}))}}function js(r){const t=g(),e=$[I()],s=Ge(!qe()),i=m.useMemo(()=>us(s.cache.data,s.capabilities.data?.resources,r,s.busy,e,t),[s.cache.data,s.capabilities.data,r,s.busy,e,t]),{remove:n}=s,l=m.useCallback(o=>void n(o).then(u=>u&&O("positive",t("dns.deleted",{n:u.deleted})),u=>O("negative",t("dns.deleteFailed"),{detail:B(u,t)})),[n,t]),c=async()=>{try{const o=await s.flush();o&&O("positive",t("dns.flushed",{matched:o.matched,deleted:o.deleted}))}catch(o){return t("dns.flushFailed",{error:B(o,t)})}};return{...i,error:s.cache.error,retry:s.cache.refetch,loading:(s.cache.loading||s.capabilities.loading)&&!s.cache.data,flushPending:s.busy==="flush",remove:l,flush:c,abortFlush:()=>{s.cancel(),s.cache.refetch()}}}function ys(r){const t=me({},r===!0),e=V().data?.resources;return{log:t,cacheListed:Fe(e,"dns_cache",{whileLoading:!1})&&e?.dns_cache.read===!0}}function ws(r){const t=g(),e=$[I()],[s,i]=Me(),[n,l]=m.useState(!1),c=Ye(r,!i&&n);c.data&&!n&&l(!0);const o=m.useMemo(()=>gs(c.data,e,t),[c.data,e,t]);return{ref:s,card:o,state:bs(r,!!o,c.error),error:c.error,retry:c.refetch}}function Ns(r,t){const e=g(),s=$[I()],[i,n]=m.useState(t);q(t,n);const[l,c]=m.useState("all"),[o,u]=m.useState(""),h=re(),x=V(),y=Z(o),d=Re(y),v=y.trim()!==""&&!d,[f,w]=m.useState(d);!v&&d!==f&&w(d);const N={name:Z(i),type:l,src:v?f:d},A=JSON.stringify(N),p=me(N,r===!0),[_,E]=m.useState(null),[he,K]=m.useState(!1),S=le({scope:A});q(A,()=>E(null));const{data:b,newerWaiting:xe}=m.useMemo(()=>fs(p.data,_),[p.data,_]),X=()=>void S.run("older",async T=>{if(!b?.next_cursor)return;E(b);const{page:ve}=await Je(je=>h.dnsLog(je,T),{name:N.name.trim()||void 0,type:l==="all"?void 0:l,src:N.src,cursor:b.next_cursor,limit:p.limit},T);T.aborted||E(xs(b,ve))}),G=()=>{S.cancel(),E(null);const T=p.refetch();T&&(K(!0),T.finally(()=>K(!1)))},[M,fe]=m.useState(null),ge=Ae(Ee),J=x.data?.resources.dns_query.record_types,be=m.useMemo(()=>ps(b,r,e,J),[b,r,e,J]),k=m.useMemo(()=>ms(b,M,s,e),[b,M,s,e]);return{...be,detail:k,detailTitle:k?.title??"",name:i,newerWaiting:xe,setName:n,type:l,setType:c,src:o,setSrc:u,srcError:v?e("dns.srcInvalid"):void 0,selected:k?M:null,setSelected:fe,wide:ge,error:S.error??p.error,loading:p.loading&&!b,hasOlder:!!b?.next_cursor,loadingOlder:!!S.busy,loadOlder:X,refreshing:he,refresh:G,retry:S.error?X:G,export:()=>Ze(es("dns-log","csv"),hs(b?.records??[]),"text/csv;charset=utf-8")}}const Cs=["cached","answered","nxdomain","failed"],Ts=r=>r.cached?"cached":r.status==="NOERROR"?"answered":r.status==="NXDOMAIN"?"nxdomain":"failed";function _s(r){const t={cached:0,answered:0,nxdomain:0,failed:0},e=[];for(const c of r){const o=Ts(c);t[o]++,!c.cached&&c.upstream!==null&&e.push({id:c.id,value:c.elapsed_ms,outcome:o,name:c.question.name,upstream:c.upstream})}const s=e.map(c=>c.value).sort((c,o)=>c-o),i=new Map;for(const c of e)i.set(c.upstream,[...i.get(c.upstream)??[],c]);const n=[...i].map(([c,o])=>({upstream:c Line truncated
@@ -0,0 +1,3 @@
import{r as p,j as a}from"./vendor-react-Bf71BWbF.js";import{u as g,aM as we,c as Ne,a0 as Ce,aT as j,aq as Te,a1 as re,ak as _e,A as Se,au as De,bo as le,a5 as V,bc as F,bp as ie,X as Y,bf as Re,be as Le,a2 as $,a as I,bq as Z,U as qe,f as Ae,bi as Fe,br as Ee,bb as k,b as ee,a7 as Me,bs as Oe,aP as ke,af as C,j as oe,E as L,aB as Q,bt as Pe,bu as We,bv as Ue,bw as He,aG as R,aO as se,aI as ce,b1 as Be,bx as U,T as H,b2 as de,B as E,by as Ve,aH as ue,aD as z,bn as $e,aE as D,aC as ae,bm as Ie,aF as Qe,bz as ze,bl as Ke,bk as Ge}from"./index-CXHBmSa5.js";import{D as pe}from"./Table-D0NFHHNQ.js";import{T as B}from"./TimeCell-gSIuLEFc.js";import{A as Xe}from"./ActionGroup-90AzAQje.js";import{q as Je,u as he,a as Ye,s as Ze,b as es}from"./dns-DQrpG8y_.js";import{c as te,d as ss,e as as}from"./files-BxEOxSF8.js";import{d as ts}from"./nav-C2A1sZKm.js";import{F as ns}from"./FactStrip-BgQ_tYB6.js";import{r as ne,B as rs}from"./ranked-FVqORIQj.js";import{u as ls,w as is,C as os,p as P}from"./layout-BRLew_nj.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";function cs({label:r,shares:t}){const e=g(),s=we(),{ref:l,tip:n,show:i,hide:o}=ls(),c=p.useMemo(()=>{const d=is(t.map(m=>m.count));return t.flatMap((m,f)=>Array.from({length:d[f]},()=>m))},[t]);return a.jsxs("div",{className:"rp-waffle rp-chart-hover",ref:l,onPointerLeave:o,children:[a.jsx("div",{className:"grid",role:"img","aria-describedby":s,"aria-label":e("ui.valuePair",{label:r,value:t.map(d=>`${d.label} ${d.text}`).join(e("ui.separator"))}),children:c.map((d,m)=>a.jsx("span",{style:{background:d.color},onPointerMove:f=>i(f,[d.label,d.text])},m))}),a.jsx("ul",{className:"legend",children:t.map(d=>a.jsxs("li",{children:[a.jsx("i",{className:"sw",style:{background:d.color}}),a.jsx("span",{children:d.label}),a.jsx("b",{children:d.text})]},d.id))}),a.jsx(os,{tip:n})]})}function ds({className:r,...t}){return a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:Ne("rp-icon",r),...t,children:[a.jsx("path",{fill:"currentColor",d:"M8.249 15.021c-.4 0-.733-.317-.748-.72l-.25-6.5c-.017-.414.307-.763.72-.779H8c.4 0 .733.317.748.72l.25 6.5c.017.414-.307.763-.72.778zM11.751 15.021h-.03c-.413-.016-.737-.365-.72-.779l.25-6.5c.015-.403.348-.72.748-.72h.03c.413.016.737.365.72.779l-.25 6.5c-.015.403-.348.72-.748.72"}),a.jsx("path",{fill:"currentColor",d:"M17 4h-3.5v-.75C13.5 2.01 12.49 1 11.25 1h-2.5C7.51 1 6.5 2.01 6.5 3.25V4H3c-.414 0-.75.336-.75.75s.336.75.75.75h.52l.422 10.342C3.99 17.052 4.98 18 6.19 18h7.62c1.211 0 2.2-.948 2.248-2.158L16.48 5.5H17c.414 0 .75-.336.75-.75S17.414 4 17 4m-9-.75c0-.413.337-.75.75-.75h2.5c.413 0 .75.337.75.75V4H8zm6.56 12.531c-.017.404-.346.719-.75.719H6.19c-.404 0-.733-.315-.75-.719L5.02 5.5h9.96z"})]})}const us={forced:"dns.route.forced","dns.routing":"dns.route.rules",default:"dns.route.default"};function me(r,t){return{fields:[[t("ui.state"),r.status],[t("ui.upstream"),r.upstream??"—"],[t("dns.routeSource"),Ce(us,r.route.source,t)],[t("dns.routeRule"),r.route.rule??"—"],[t("ui.elapsed"),j(r.elapsed_ms,t)]],answers:(r.answers??[]).map(e=>t("dns.answer",{name:e.name,type:e.type,ttl:e.ttl,data:e.data})),cacheText:t(r.cached?"dns.hit":"dns.miss"),cacheTone:r.cached?void 0:"warn"}}function ps(r,t,e,s,l,n){const i=t?.dns_query.record_types??[],o=e==="all"?i.length>0:i.includes(e);return{types:i,choices:[...i.map(c=>({id:c,label:c})),{id:"all",label:n("dns.allTypes")}],disabled:l||!t?.dns_query.available||!o||!s.trim(),reason:!t||l?null:t.dns_query.available?o?null:n(e==="all"?"dns.noTypes":"dns.typeUnsupported"):n("dns.queryUnavailable"),showCache:!!t?.dns_cache.available,cards:r?.results.map(c=>({id:c.type,title:`${r.domain} ${c.type}`,...me(c,n)}))??[],tabs:ts(t).map(c=>({id:c.id,label:n(c.titleKey)}))}}function hs(r,t,e,s,l,n){const i=e.toLowerCase(),o=t?.dns_cache,c=(r?.entries??[]).filter(d=>!i||d.domain.toLowerCase().includes(i));return{fields:[[n("dns.entries"),r?re(r.total,l):"—"]],coverage:r?["positive","negative","persistent"].filter(d=>!r.coverage[d]).map(d=>({id:d,text:n("ui.valuePair",{label:n({positive:"dns.positive",negative:"dns.negative",persistent:"dns.persistent"}[d]),value:n(d==="persistent"?"dns.chart.memoryOnly":"dns.notCovered")})})):[],filterText:i?n("dns.cacheFilter",{domain:e}):"",confirmationText:r?n("dns.flushConfirm",{n:r.total}):n("dns.flushConfirmAll"),flushDisabled:!!s||!t?.dns_cache.available||!t.dns_cache.flush,flushReason:o&&!s&&(!o.available||!o.flush)?n("dns.flushUnsupported"):null,deleteReason:o&&!s&&c.length>0&&(!o.available||!o.delete_entry)?n("dns.deleteUnsupported"):null,empty:n(t?.dns_cache.available&&t.dns_cache.read?"dns.empty":"dns.cacheUnavailable"),rows:c.map(d=>({id:d.entry_id,domain:d.domain,type:d.type,status:d.status,expiresAt:d.expires_at,staleUntil:d.stale_until,deleteLabel:n("dns.deleteEntry",{domain:d.domain,type:d.type}),pending:s==Line truncated
`)+`
`}function gs(r,t){const e=new Set(r.records.map(s=>s.id));return{...r,records:[...r.records,...t.records.filter(s=>!e.has(s.id))],next_cursor:t.next_cursor}}function bs(r,t){const e=t&&new Set(t.records.map(s=>s.id));return{data:t??r,newerWaiting:!!e&&!!r?.records.some(s=>!e.has(s.id))}}function vs(r,t,e){if(!r)return null;const{usage:s,coverage:l}=r,n=o=>{const c=De(o);return c===null?"—":re(c,t)},i=s?_e(s.entries,s.entry_capacity):null;return{note:s?void 0:e("dns.chart.cacheNote",{n:r.total}),usage:s&&i!==null?{pct:i,value:i>0&&i<.5?"<"+e("ui.percent",{n:1}):e("ui.percent",{n:Math.round(i)}),facts:e("dns.chart.usageFacts",{entries:e("ui.fraction",{part:n(s.entries),whole:n(s.entry_capacity)})})}:null,coverage:e("dns.chart.coverage",{kinds:[l.positive&&e("dns.chart.positive"),l.negative&&e("dns.chart.negative")].filter(Boolean).join(e("ui.listSeparator")),persistent:e(l.persistent?"dns.chart.persistent":"dns.chart.memoryOnly")})}}function js(r,t,e){return r?e instanceof Se&&e.status===503?"unavailable":t?"ready":e?"error":"loading":"unlisted"}function ys({go:r,query:t}){const e=g(),s=le(),l=V(),n=p.useMemo(()=>new URLSearchParams(t),[t]),[i,o]=p.useState(n.get("domain")??""),[c,d]=p.useState(n.get("type")??"A");F(n.get("domain"),h=>o(h??"")),F(n.get("type"),h=>d(h??"A"));const[m,f]=p.useState(null),{busy:y,error:u,run:v}=ie({rethrow:!0}),x=l.data?.resources,w=p.useMemo(()=>ps(m,x,c,i,!!y,e),[m,x,c,i,y,e]),N=n.has("domain")&&w.tabs.some(h=>h.id==="log")?"log":w.tabs[0]?.id??"query",q=async()=>{try{await v("query",async h=>{const _=await Je(s.dnsQuery,i.trim(),c==="all"?w.types:[c],x?.dns_query.limits?.max_types_per_request??1,h);return h.aborted||f(_),_})}catch{}};return{...w,domain:i,setDomain:o,type:c,setType:d,pending:y==="query",queryError:u,submit:()=>void q(),setTab:h=>r("dns",Le(t,h,x&&!n.has("domain")?N:null)),tab:Re(t,w.tabs.map(h=>h.id),N),filterDomain:n.get("domain")??"",logEnabled:x?.dns_log.available,viewCache:()=>r("dns",Y(t,{tab:"cache",domain:m?.domain??""})),clearCacheFilter:()=>r("dns",Y(t,{tab:"cache",domain:null}))}}function ws(r){const t=g(),e=$[I()],s=Ye(!Ee()),l=p.useMemo(()=>hs(s.cache.data,s.capabilities.data?.resources,r,s.busy,e,t),[s.cache.data,s.capabilities.data,r,s.busy,e,t]),{remove:n}=s,i=p.useCallback(c=>void n(c).then(d=>d&&k("positive",t("dns.deleted",{n:d.deleted})),d=>k("negative",t("dns.deleteFailed"),{detail:ee(d,t)})),[n,t]),o=async()=>{try{const c=await s.flush();c&&k("positive",t("dns.flushed",{matched:c.matched,deleted:c.deleted}))}catch(c){return t("dns.flushFailed",{error:ee(c,t)})}};return{...l,error:s.cache.error,retry:s.cache.refetch,loading:(s.cache.loading||s.capabilities.loading)&&!s.cache.data,flushPending:s.busy==="flush",remove:i,flush:o,abortFlush:()=>{s.cancel(),s.cache.refetch()}}}function Ns(r){const t=he({},r===!0),e=V().data?.resources;return{log:t,cacheListed:Me(e,"dns_cache",{whileLoading:!1})&&e?.dns_cache.read===!0}}function Cs(r){const t=g(),e=$[I()],[s,l]=Oe(),[n,i]=p.useState(!1),o=es(r,!l&&n);o.data&&!n&&i(!0);const c=p.useMemo(()=>vs(o.data,e,t),[o.data,e,t]);return{ref:s,card:c,state:js(r,!!c,o.error),error:o.error,retry:o.refetch}}function Ts(r,t){const e=g(),s=$[I()],[l,n]=p.useState(t);F(t,n);const[i,o]=p.useState("all"),[c,d]=p.useState(""),m=le(),f=V(),y=Z(c),u=qe(y),v=y.trim()!==""&&!u,[x,w]=p.useState(u);!v&&u!==x&&w(u);const N={name:Z(l),type:i,src:v?x:u},q=JSON.stringify(N),h=he(N,r===!0),[_,A]=p.useState(null),[fe,K]=p.useState(!1),S=ie({scope:q});F(q,()=>A(null));const{data:b,newerWaiting:xe}=p.useMemo(()=>bs(h.data,_),[h.data,_]),G=()=>void S.run("older",async T=>{if(!b?.next_cursor)return;A(b);const{page:je}=await Ze(ye=>m.dnsLog(ye,T),{name:N.name.trim()||void 0,type:i==="all"?void 0:i,src:N.src,cursor:b.next_cursor,limit:h.limit},T);T.aborted||A(gs(b,je))}),X=()=>{S.cancel(),A(null);const T=h.refetch();T&&(K(!0),T.finally(()=>K(!1)))},[M,ge]=p.useState(null),be=Ae(Fe),J=f.data?.resources.dns_query.record_types,ve=p.useMemo(()=>fs(b,r,e,J),[b,r,e,J]),O=p.useMemo(()=>ms(b,M,s,e),[b,M,s,e]);return{...ve,detail:O,detailTitle:O?.title??"",name:l,newerWaiting:xe,setName:n,type:i,setType:o,src:c,setSrc:d,srcError:v?e("ui.invalidIp"):void 0,selected:O?M:null,setSelected:ge,wide:be,error:S.error??h.error,loading:h.loading&&!b,hasOlder:!!b?.next_cursor,loadingOlder:!!S.busy,loadOlder:G,refreshing:fe,refresh:X,retry:S.error?G:X,export:()=>ss(as("dns-log","csv"),xs(b?.records??[]),"text/csv;charset=utf-8")}}const _s=["cached","answered","nxdomain","failed"],Ss=r=>r.cached?"cached":r.status==="NOERROR"?"answered":r.status==="NXDOMAIN"?"nxdomain":"failed";function Ds(r){const t={cached:0,answered:0,nxdomain:0,failed:0},e=[];for(const o of r){const c=Ss(o);t[c]++,!o.cached&&o.upstream!==null&&e.push({id:o.id,value:o.elapsed_ms,outcome:c,name:o.question.name,upstream:o.upstream})}const s=e.map(o=>o.value).sort((o,c)=>o-c),l=new Map;for(const o of e)l.set(o.upstream,[...l.get(o.upstream)??[],o]);const n=[...l].map(([o,c])=>({upstream:o Line truncated
@@ -1 +1 @@
import{r as an,j as K}from"./vendor-react-Bf71BWbF.js";import{u as cn,eq as fn}from"./index-zQjLFfuj.js";import{u as gn,i as hn,e as pn,C as yn}from"./layout-B3T-zLsm.js";import{w as dn,c as T,a as mn}from"./array-C0P64tl-.js";const on=Math.abs,w=Math.atan2,N=Math.cos,xn=Math.max,rn=Math.min,b=Math.sin,F=Math.sqrt,S=1e-12,V=Math.PI,X=V/2,W=2*V;function vn(t){return t>1?0:t<-1?V:Math.acos(t)}function ln(t){return t>=1?X:t<=-1?-X:Math.asin(t)}function An(t){return t.innerRadius}function Mn(t){return t.outerRadius}function Rn(t){return t.startAngle}function wn(t){return t.endAngle}function Pn(t){return t&&t.padAngle}function Tn(t,h,v,P,x,A,p,n){var f=v-t,u=P-h,e=p-x,y=n-A,r=y*f-e*u;if(!(r*r<S))return r=(e*(h-A)-y*(t-x))/r,[t+r*f,h+r*u]}function U(t,h,v,P,x,A,p){var n=t-v,f=h-P,u=(p?A:-A)/F(n*n+f*f),e=u*f,y=-u*n,r=t+e,a=h+y,g=v+e,d=P+y,j=(r+g)/2,c=(a+d)/2,m=g-r,o=d-a,l=m*m+o*o,M=x-A,R=r*d-g*a,D=(o<0?-1:1)*F(xn(0,M*M*l-R*R)),I=(R*o-m*D)/l,q=(-R*m-o*D)/l,L=(R*o+m*D)/l,$=(-R*m+o*D)/l,E=I-j,s=q-c,i=L-j,B=$-c;return E*E+s*s>i*i+B*B&&(I=L,q=$),{cx:I,cy:q,x01:-e,y01:-y,x11:I*(x/M-1),y11:q*(x/M-1)}}function jn(){var t=An,h=Mn,v=T(0),P=null,x=Rn,A=wn,p=Pn,n=null,f=dn(u);function u(){var e,y,r=+t.apply(this,arguments),a=+h.apply(this,arguments),g=x.apply(this,arguments)-X,d=A.apply(this,arguments)-X,j=on(d-g),c=d>g;if(n||(n=e=f()),a<r&&(y=a,a=r,r=y),!(a>S))n.moveTo(0,0);else if(j>W-S)n.moveTo(a*N(g),a*b(g)),n.arc(0,0,a,g,d,!c),r>S&&(n.moveTo(r*N(d),r*b(d)),n.arc(0,0,r,d,g,c));else{var m=g,o=d,l=g,M=d,R=j,D=j,I=p.apply(this,arguments)/2,q=I>S&&(P?+P.apply(this,arguments):F(r*r+a*a)),L=rn(on(a-r)/2,+v.apply(this,arguments)),$=L,E=L,s,i;if(q>S){var B=ln(q/r*b(I)),O=ln(q/a*b(I));(R-=B*2)>S?(B*=c?1:-1,l+=B,M-=B):(R=0,l=M=(g+d)/2),(D-=O*2)>S?(O*=c?1:-1,m+=O,o-=O):(D=0,m=o=(g+d)/2)}var k=a*N(m),z=a*b(m),G=r*N(M),H=r*b(M);if(L>S){var J=a*N(o),Q=a*b(o),Y=r*N(l),Z=r*b(l),C;if(j<V)if(C=Tn(k,z,Y,Z,J,Q,G,H)){var _=k-C[0],nn=z-C[1],en=J-C[0],tn=Q-C[1],sn=1/b(vn((_*en+nn*tn)/(F(_*_+nn*nn)*F(en*en+tn*tn)))/2),un=F(C[0]*C[0]+C[1]*C[1]);$=rn(L,(r-un)/(sn-1)),E=rn(L,(a-un)/(sn+1))}else $=E=0}D>S?E>S?(s=U(Y,Z,k,z,a,E,c),i=U(J,Q,G,H,a,E,c),n.moveTo(s.cx+s.x01,s.cy+s.y01),E<L?n.arc(s.cx,s.cy,E,w(s.y01,s.x01),w(i.y01,i.x01),!c):(n.arc(s.cx,s.cy,E,w(s.y01,s.x01),w(s.y11,s.x11),!c),n.arc(0,0,a,w(s.cy+s.y11,s.cx+s.x11),w(i.cy+i.y11,i.cx+i.x11),!c),n.arc(i.cx,i.cy,E,w(i.y11,i.x11),w(i.y01,i.x01),!c))):(n.moveTo(k,z),n.arc(0,0,a,m,o,!c)):n.moveTo(k,z),!(r>S)||!(R>S)?n.lineTo(G,H):$>S?(s=U(G,H,J,Q,r,-$,c),i=U(k,z,Y,Z,r,-$,c),n.lineTo(s.cx+s.x01,s.cy+s.y01),$<L?n.arc(s.cx,s.cy,$,w(s.y01,s.x01),w(i.y01,i.x01),!c):(n.arc(s.cx,s.cy,$,w(s.y01,s.x01),w(s.y11,s.x11),!c),n.arc(0,0,r,w(s.cy+s.y11,s.cx+s.x11),w(i.cy+i.y11,i.cx+i.x11),c),n.arc(i.cx,i.cy,$,w(i.y11,i.x11),w(i.y01,i.x01),!c))):n.arc(0,0,r,M,l,c)}if(n.closePath(),e)return n=null,e+""||null}return u.centroid=function(){var e=(+t.apply(this,arguments)+ +h.apply(this,arguments))/2,y=(+x.apply(this,arguments)+ +A.apply(this,arguments))/2-V/2;return[N(y)*e,b(y)*e]},u.innerRadius=function(e){return arguments.length?(t=typeof e=="function"?e:T(+e),u):t},u.outerRadius=function(e){return arguments.length?(h=typeof e=="function"?e:T(+e),u):h},u.cornerRadius=function(e){return arguments.length?(v=typeof e=="function"?e:T(+e),u):v},u.padRadius=function(e){return arguments.length?(P=e==null?null:typeof e=="function"?e:T(+e),u):P},u.startAngle=function(e){return arguments.length?(x=typeof e=="function"?e:T(+e),u):x},u.endAngle=function(e){return arguments.length?(A=typeof e=="function"?e:T(+e),u):A},u.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:T(+e),u):p},u.context=function(e){return arguments.length?(n=e??null,u):n},u}function Sn(t,h){return h<t?-1:h>t?1:h>=t?0:NaN}function $n(t){return t}function En(){var t=$n,h=Sn,v=null,P=T(0),x=T(W),A=T(0);function p(n){var f,u=(n=mn(n)).length,e,y,r=0,a=new Array(u),g=new Array(u),d=+P.apply(this,arguments),j=Math.min(W,Math.max(-W,x.apply(this,arguments)-d)),c,m=Math.min(Math.abs(j)/u,A.apply(this,arguments)),o=m*(j<0?-1:1),l;for(f=0;f<u;++f)(l=g[a[f]=f]=+t(n[f],f,n))>0&&(r+=l);for(h!=null?a.sort(function(M,R){return h(g[M],g[R])}):v!=null&&a.sort(function(M,R){return v(n[M],n[R])}),f=0,y=r?(j-u*o)/r:0;f<u;++f,d=c)e=a[f],l=g[e],c=d+(l>0?l*y:0)+o,g[e]={data:n[e],index:f,value:l,startAngle:d,endAngle:c,padAngle:m};return g}return p.value=function(n){return arguments.length?(t=typeof n=="function"?n:T(+n),p):t},p.sortValues=function(n){return arguments.length?(h=n,v=null,p):h},p.sort=function(n){return arguments.length?(v=n,h=null,p):v},p.startAngle=function(n){return arguments.length?(P=typeof n=="function"?n:T(+n),p):P},p.endAngle=function(n){return arguments.length?(x=typeof n=="function"?n:T(+n),p):x},p.padAngle=function(n){return arguments.length?(A=typeof n=="function"?n:T(+n),p):A},p}function In({label:t,rows:h}){const v=cn(),[P,x]=fn(Math.round,120),{tip:A,showAt:p,hide:n}=gn(),[f,u]=an.useState(null),e=h.filter(o=>o.value!==null&&o.valuLine truncated
import{r as an,j as K}from"./vendor-react-Bf71BWbF.js";import{u as cn,eH as fn}from"./index-CXHBmSa5.js";import{u as gn,i as hn,e as pn,C as yn}from"./layout-BRLew_nj.js";import{w as dn,c as T,a as mn}from"./array-C0P64tl-.js";const on=Math.abs,w=Math.atan2,k=Math.cos,xn=Math.max,rn=Math.min,b=Math.sin,F=Math.sqrt,S=1e-12,V=Math.PI,X=V/2,W=2*V;function vn(t){return t>1?0:t<-1?V:Math.acos(t)}function ln(t){return t>=1?X:t<=-1?-X:Math.asin(t)}function An(t){return t.innerRadius}function Mn(t){return t.outerRadius}function Rn(t){return t.startAngle}function wn(t){return t.endAngle}function Pn(t){return t&&t.padAngle}function Tn(t,h,v,P,x,A,p,n){var f=v-t,u=P-h,e=p-x,y=n-A,r=y*f-e*u;if(!(r*r<S))return r=(e*(h-A)-y*(t-x))/r,[t+r*f,h+r*u]}function U(t,h,v,P,x,A,p){var n=t-v,f=h-P,u=(p?A:-A)/F(n*n+f*f),e=u*f,y=-u*n,r=t+e,a=h+y,g=v+e,d=P+y,j=(r+g)/2,c=(a+d)/2,m=g-r,o=d-a,l=m*m+o*o,M=x-A,R=r*d-g*a,D=(o<0?-1:1)*F(xn(0,M*M*l-R*R)),I=(R*o-m*D)/l,B=(-R*m-o*D)/l,L=(R*o+m*D)/l,$=(-R*m+o*D)/l,E=I-j,s=B-c,i=L-j,N=$-c;return E*E+s*s>i*i+N*N&&(I=L,B=$),{cx:I,cy:B,x01:-e,y01:-y,x11:I*(x/M-1),y11:B*(x/M-1)}}function jn(){var t=An,h=Mn,v=T(0),P=null,x=Rn,A=wn,p=Pn,n=null,f=dn(u);function u(){var e,y,r=+t.apply(this,arguments),a=+h.apply(this,arguments),g=x.apply(this,arguments)-X,d=A.apply(this,arguments)-X,j=on(d-g),c=d>g;if(n||(n=e=f()),a<r&&(y=a,a=r,r=y),!(a>S))n.moveTo(0,0);else if(j>W-S)n.moveTo(a*k(g),a*b(g)),n.arc(0,0,a,g,d,!c),r>S&&(n.moveTo(r*k(d),r*b(d)),n.arc(0,0,r,d,g,c));else{var m=g,o=d,l=g,M=d,R=j,D=j,I=p.apply(this,arguments)/2,B=I>S&&(P?+P.apply(this,arguments):F(r*r+a*a)),L=rn(on(a-r)/2,+v.apply(this,arguments)),$=L,E=L,s,i;if(B>S){var N=ln(B/r*b(I)),H=ln(B/a*b(I));(R-=N*2)>S?(N*=c?1:-1,l+=N,M-=N):(R=0,l=M=(g+d)/2),(D-=H*2)>S?(H*=c?1:-1,m+=H,o-=H):(D=0,m=o=(g+d)/2)}var q=a*k(m),z=a*b(m),O=r*k(M),G=r*b(M);if(L>S){var J=a*k(o),Q=a*b(o),Y=r*k(l),Z=r*b(l),C;if(j<V)if(C=Tn(q,z,Y,Z,J,Q,O,G)){var _=q-C[0],nn=z-C[1],en=J-C[0],tn=Q-C[1],sn=1/b(vn((_*en+nn*tn)/(F(_*_+nn*nn)*F(en*en+tn*tn)))/2),un=F(C[0]*C[0]+C[1]*C[1]);$=rn(L,(r-un)/(sn-1)),E=rn(L,(a-un)/(sn+1))}else $=E=0}D>S?E>S?(s=U(Y,Z,q,z,a,E,c),i=U(J,Q,O,G,a,E,c),n.moveTo(s.cx+s.x01,s.cy+s.y01),E<L?n.arc(s.cx,s.cy,E,w(s.y01,s.x01),w(i.y01,i.x01),!c):(n.arc(s.cx,s.cy,E,w(s.y01,s.x01),w(s.y11,s.x11),!c),n.arc(0,0,a,w(s.cy+s.y11,s.cx+s.x11),w(i.cy+i.y11,i.cx+i.x11),!c),n.arc(i.cx,i.cy,E,w(i.y11,i.x11),w(i.y01,i.x01),!c))):(n.moveTo(q,z),n.arc(0,0,a,m,o,!c)):n.moveTo(q,z),!(r>S)||!(R>S)?n.lineTo(O,G):$>S?(s=U(O,G,J,Q,r,-$,c),i=U(q,z,Y,Z,r,-$,c),n.lineTo(s.cx+s.x01,s.cy+s.y01),$<L?n.arc(s.cx,s.cy,$,w(s.y01,s.x01),w(i.y01,i.x01),!c):(n.arc(s.cx,s.cy,$,w(s.y01,s.x01),w(s.y11,s.x11),!c),n.arc(0,0,r,w(s.cy+s.y11,s.cx+s.x11),w(i.cy+i.y11,i.cx+i.x11),c),n.arc(i.cx,i.cy,$,w(i.y11,i.x11),w(i.y01,i.x01),!c))):n.arc(0,0,r,M,l,c)}if(n.closePath(),e)return n=null,e+""||null}return u.centroid=function(){var e=(+t.apply(this,arguments)+ +h.apply(this,arguments))/2,y=(+x.apply(this,arguments)+ +A.apply(this,arguments))/2-V/2;return[k(y)*e,b(y)*e]},u.innerRadius=function(e){return arguments.length?(t=typeof e=="function"?e:T(+e),u):t},u.outerRadius=function(e){return arguments.length?(h=typeof e=="function"?e:T(+e),u):h},u.cornerRadius=function(e){return arguments.length?(v=typeof e=="function"?e:T(+e),u):v},u.padRadius=function(e){return arguments.length?(P=e==null?null:typeof e=="function"?e:T(+e),u):P},u.startAngle=function(e){return arguments.length?(x=typeof e=="function"?e:T(+e),u):x},u.endAngle=function(e){return arguments.length?(A=typeof e=="function"?e:T(+e),u):A},u.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:T(+e),u):p},u.context=function(e){return arguments.length?(n=e??null,u):n},u}function Sn(t,h){return h<t?-1:h>t?1:h>=t?0:NaN}function $n(t){return t}function En(){var t=$n,h=Sn,v=null,P=T(0),x=T(W),A=T(0);function p(n){var f,u=(n=mn(n)).length,e,y,r=0,a=new Array(u),g=new Array(u),d=+P.apply(this,arguments),j=Math.min(W,Math.max(-W,x.apply(this,arguments)-d)),c,m=Math.min(Math.abs(j)/u,A.apply(this,arguments)),o=m*(j<0?-1:1),l;for(f=0;f<u;++f)(l=g[a[f]=f]=+t(n[f],f,n))>0&&(r+=l);for(h!=null?a.sort(function(M,R){return h(g[M],g[R])}):v!=null&&a.sort(function(M,R){return v(n[M],n[R])}),f=0,y=r?(j-u*o)/r:0;f<u;++f,d=c)e=a[f],l=g[e],c=d+(l>0?l*y:0)+o,g[e]={data:n[e],index:f,value:l,startAngle:d,endAngle:c,padAngle:m};return g}return p.value=function(n){return arguments.length?(t=typeof n=="function"?n:T(+n),p):t},p.sortValues=function(n){return arguments.length?(h=n,v=null,p):h},p.sort=function(n){return arguments.length?(v=n,h=null,p):v},p.startAngle=function(n){return arguments.length?(P=typeof n=="function"?n:T(+n),p):P},p.endAngle=function(n){return arguments.length?(x=typeof n=="function"?n:T(+n),p):x},p.padAngle=function(n){return arguments.length?(A=typeof n=="function"?n:T(+n),p):A},p}function In({label:t,rows:h}){const v=cn(),[P,x]=fn(Math.round,120),{tip:A,showAt:p,hide:n}=gn(),[f,u]=an.useState(null),e=h.filter(o=>o.value!==null&&o.valuLine truncated
@@ -0,0 +1,2 @@
import{r as v,j as n}from"./vendor-react-Bf71BWbF.js";import{a0 as b,dy as k,dz as f,aq as j,bo as y,u as g,a2 as E,a as T,a5 as L,dA as N,bc as D,dB as H,dC as C,dD as R,dE as K,aE as p,bm as M,aD as _,b2 as A,aC as F,B as O,aF as S,E as W}from"./index-CXHBmSa5.js";import{D as B}from"./Table-D0NFHHNQ.js";import{d as I,e as P}from"./files-BxEOxSF8.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";const h={buffer_overflow:["event.gap.overflow","event.gapHelp.overflow"],evicted:["event.gap.evicted","event.gapHelp.evicted"]};function V(e,t){const a=e.event==="flow.gap"&&Object.hasOwn(h,e.data.reason)?h[e.data.reason]:void 0;return a&&{title:t(a[0]),text:t(a[1])}}const w=new WeakMap;function q(e,t,a,l){const s=w.get(e);if(s&&s.locale===t)return s.row;const o=l?{key:"event.lostHistory"}:k(e,a),i={id:e.id,timestamp:j(e.data.observed_at,t),iso:e.data.observed_at,kind:e.event,kindText:b(f,e.event,a),summary:a(o.key,o.params),help:V(e,a)};return w.set(e,{locale:t,row:i}),i}function z(e,t,a,l,s,o,i,c,r=!1,u=()=>!1){const m=t==="without-runtime"||c.includes(t)?t:"all",x=e.filter(d=>m==="all"||(m==="without-runtime"?d.event!=="runtime.updated":d.event===m)).slice(0,s);return{kind:m,rows:x.map(d=>q(d,o,i,u(d))),kinds:[{id:"without-runtime",label:i("event.withoutRuntime")},{id:"all",label:i("event.allKinds")},...c.map(d=>({id:d,label:b(f,d,i)}))],status:r&&l!==!1?{tone:"err",text:i("event.disconnected")}:{tone:a?"ok":l===null?"muted":"warn",text:i(l===!1?"event.unavailable":a?"event.connected":l===null?"ui.loading":"event.reconnecting")},limitText:i("event.limit",{n:s}),shown:x}}function J(e){return JSON.stringify(e,null,2)+`
`}function G(){const e=y(),t=g(),a=E[T()],s=L().data?.resources.events.kinds,[o,i]=v.useState("without-runtime"),c=o!=="all"&&o!=="runtime.updated"&&s?.includes(o),r=N(o!=="without-runtime"&&!c),u=v.useMemo(()=>z(r.events,o,r.connected,r.available,K,a,t,s??[],!!r.error,R),[r.events,o,r.connected,r.available,r.error,a,t,s]);return D(u.kind,i),{...u,setKind:i,cursor:r.cursor,error:r.error,retry:()=>void H().then(()=>C(e)),loading:!r.error&&!r.connected&&r.available!==!1&&!r.events.length,export:()=>I(P("doona-events","json"),J(u.shown),"application/json")}}function te(){const e=g(),t=G(),a=v.useMemo(()=>[{id:"t",label:e("ui.time"),minWidth:200,grow:0,drop:1,render:s=>n.jsx(p,{className:"rp-code",text:s.iso,children:s.timestamp})},{id:"k",label:e("event.kind"),minWidth:168,drop:2,render:s=>n.jsx(p,{text:s.kind,children:s.kindText})},{id:"m",label:e("event.summary"),minWidth:240,isRowHeader:!0,render:s=>n.jsx(M,{fill:!0,help:s.help,children:n.jsx(p,{children:s.summary})})}],[e]),l=v.useCallback(s=>n.jsx(_,{inline:!0,items:[[e("ui.time"),s.timestamp],[e("event.kind"),s.kindText],[e("event.summary"),s.summary]]}),[e]);return n.jsxs("div",{className:"rp-page",children:[n.jsxs("div",{className:"rp-toolbar",children:[n.jsx(A,{label:e("event.kind"),side:!0,value:t.kind,onChange:t.setKind,items:t.kinds}),n.jsx(F,{small:!0,tone:t.status.tone,children:t.status.text}),t.cursor&&n.jsx(p,{text:t.cursor,children:n.jsx("span",{className:"rp-label",children:e("event.cursor")})}),n.jsx("span",{className:"rp-label",children:t.limitText}),n.jsx("span",{className:"rp-grow"}),n.jsxs(O,{isDisabled:!t.rows.length,onPress:t.export,children:[n.jsx(S,{}),e("event.export")]})]}),t.error&&n.jsx(W,{error:t.error,onRetry:t.retry}),n.jsx(B,{label:e("nav.events"),stream:!0,fit:!0,height:442,loading:t.loading,rows:t.rows,empty:e("event.empty"),cols:a,detail:l})]})}export{te as Events};
@@ -1,2 +0,0 @@
import{r as x,j as r}from"./vendor-react-Bf71BWbF.js";import{V as w,dh as k,di as b,ah as g,be as j,u as f,X as y,_ as E,$ as T,b2 as L,dj as N,dk as D,dl as M,dm as R,av as p,aT as _,at as K,B as S,aw as W,E as A}from"./index-zQjLFfuj.js";import{D as C}from"./Table-DLlwyNFJ.js";import{u as F}from"./logs-KkruktUh.js";import{d as V,e as B}from"./files-BxEOxSF8.js";import"./useGridSelectionCheckbox-BK6qtlfZ.js";import"./Virtualizer-CTh266-x.js";import"./ListLayout-DU_9AgrU.js";const v=new WeakMap;function H(t,e,o,n){const l=v.get(t);if(l&&l.locale===e)return l.row;const i=n?{key:"event.lostHistory"}:k(t,o),a={id:t.id,timestamp:g(t.data.observed_at,e),iso:t.data.observed_at,kind:t.event,kindText:w(b,t.event,o),summary:o(i.key,i.params)};return v.set(t,{locale:e,row:a}),a}function I(t,e,o,n,l,i,a,m,s=!1,u=()=>!1){const c=e==="without-runtime"||m.includes(e)?e:"all",h=t.filter(d=>c==="all"||(c==="without-runtime"?d.event!=="runtime.updated":d.event===c)).slice(0,l);return{kind:c,rows:h.map(d=>H(d,i,a,u(d))),kinds:[{id:"without-runtime",label:a("event.withoutRuntime")},{id:"all",label:a("event.allKinds")},...m.map(d=>({id:d,label:w(b,d,a)}))],status:s&&n!==!1?{tone:"err",text:a("event.disconnected")}:{tone:o?"ok":n===null?"muted":"warn",text:a(n===!1?"event.unavailable":o?"event.connected":n===null?"ui.loading":"event.reconnecting")},limitText:a("event.limit",{n:l}),shown:h}}function O(t){return JSON.stringify(t,null,2)+`
`}function P(){const t=j(),e=f(),o=y[E()],l=T().data?.resources.events.kinds,[i,a]=x.useState("without-runtime"),m=i!=="all"&&i!=="runtime.updated"&&l?.includes(i),s=F(i!=="without-runtime"&&!m),u=x.useMemo(()=>I(s.events,i,s.connected,s.available,R,o,e,l??[],!!s.error,M),[s.events,i,s.connected,s.available,s.error,o,e,l]);return L(u.kind,a),{...u,setKind:a,cursor:s.cursor,error:s.error,retry:()=>void N().then(()=>D(t)),loading:!s.error&&!s.connected&&s.available!==!1&&!s.events.length,export:()=>V(B("doona-events","json"),O(u.shown),"application/json")}}function Y(){const t=f(),e=P(),o=x.useMemo(()=>[{id:"t",label:t("ui.time"),minWidth:200,grow:0,drop:1,render:n=>r.jsx(p,{className:"rp-code",text:n.iso,children:n.timestamp})},{id:"k",label:t("event.kind"),minWidth:168,drop:2,render:n=>r.jsx(p,{text:n.kind,children:n.kindText})},{id:"m",label:t("event.summary"),minWidth:240,isRowHeader:!0,render:n=>n.summary}],[t]);return r.jsxs("div",{className:"rp-page",children:[r.jsxs("div",{className:"rp-toolbar",children:[r.jsx(_,{label:t("event.kind"),side:!0,value:e.kind,onChange:e.setKind,items:e.kinds}),r.jsx(K,{small:!0,tone:e.status.tone,children:e.status.text}),e.cursor&&r.jsx(p,{text:e.cursor,children:r.jsx("span",{className:"rp-label",children:t("event.cursor")})}),r.jsx("span",{className:"rp-label",children:e.limitText}),r.jsx("span",{className:"rp-grow"}),r.jsxs(S,{isDisabled:!e.rows.length,onPress:e.export,children:[r.jsx(W,{}),t("event.export")]})]}),e.error&&r.jsx(A,{error:e.error,onRetry:e.retry}),r.jsx(C,{label:t("nav.events"),stream:!0,fit:!0,height:442,loading:e.loading,rows:e.rows,empty:t("event.empty"),cols:o})]})}export{Y as Events};
@@ -0,0 +1 @@
import{j as s}from"./vendor-react-Bf71BWbF.js";import{aE as t}from"./index-CXHBmSa5.js";function p({facts:l,lead:r}){return l.length?s.jsx("dl",{className:"rp-strip rp-facts"+(r?" rp-facts-lead":""),style:{"--facts":l.length,"--facts-rest":l.length-1},children:l.map((e,i)=>s.jsxs("div",{className:"rp-card"+(e.tone?" "+e.tone:""),children:[s.jsxs("dt",{className:"rp-tile-head"+(e.tint?" rp-tint-"+e.tint:""),children:[e.icon,e.label]}),s.jsxs("dd",{className:"rp-tile-body",children:[r&&i===0?s.jsx(t,{className:"rp-big",cut:"start",children:e.value}):s.jsx("span",{className:"rp-big",title:e.value,children:e.value}),e.caption&&s.jsx("span",{className:"rp-fact-caption",title:e.caption,children:e.caption})]})]},e.label))}):null}export{p as F};
@@ -1 +0,0 @@
import{j as s}from"./vendor-react-Bf71BWbF.js";import{b1 as t,av as a,b7 as p}from"./index-zQjLFfuj.js";function c({facts:r,lead:l}){const i=t(p);return r.length?s.jsx("dl",{className:"rp-strip rp-facts"+(l?" rp-facts-lead":""),style:{"--facts":r.length},children:r.map((e,n)=>s.jsxs("div",{className:"rp-card"+(e.tone?" "+e.tone:""),children:[s.jsxs("dt",{className:"rp-tile-head"+(e.tint?" rp-tint-"+e.tint:""),children:[e.icon,e.label]}),s.jsxs("dd",{className:"rp-tile-body",children:[l&&i&&n===0?s.jsx(a,{className:"rp-big",cut:"start",children:e.value}):s.jsx("span",{className:"rp-big",title:e.value,children:e.value}),e.caption&&s.jsx("span",{className:"rp-fact-caption",title:e.caption,children:e.caption})]})]},e.label))}):null}export{c as F};
@@ -1 +1 @@
import{d$ as v}from"./index-zQjLFfuj.js";import{$ as R,c,a as S,b as p}from"./Virtualizer-CTh266-x.js";const f=48;class N extends R{constructor(t={}){super(),this.rowSize=t?.rowSize??t?.rowHeight??null,this.orientation=t.orientation??"vertical",this.estimatedRowSize=t?.estimatedRowSize??t?.estimatedRowHeight??null,this.headingSize=t?.headingSize??t?.headingHeight??null,this.estimatedHeadingSize=t?.estimatedHeadingSize??t?.estimatedHeadingHeight??null,this.loaderSize=t?.loaderSize??t?.loaderHeight??null,this.dropIndicatorThickness=t.dropIndicatorThickness||2,this.gap=t.gap||0,this.padding=t.padding||0,this.layoutNodes=new Map,this.rootNodes=[],this.lastCollection=null,this.invalidateEverything=!1,this.validRect=new c,this.requestedRect=new c,this.contentSize=new S}get collection(){return this.virtualizer.collection}get rowHeight(){return this.rowSize}get estimatedRowHeight(){return this.estimatedRowSize}get headingHeight(){return this.headingSize}get estimatedHeadingHeight(){return this.estimatedHeadingSize}get loaderHeight(){return this.loaderSize}getLayoutInfo(t){return this.ensureLayoutInfo(t),this.layoutNodes.get(t)?.layoutInfo||null}getVisibleLayoutInfos(t){let e=this.orientation==="horizontal"?"x":"y",i=this.orientation==="horizontal"?"width":"height";if(t[i]>1){let s=(this.rowSize??this.estimatedRowSize??f)+this.gap;t=t.copy();let o=Math.floor(t[e]/s)*s,l=t[i]+t[e]-o;t[e]=o,t[i]=Math.ceil(l/s)*s}this.layoutIfNeeded(t);let r=[],h=s=>{for(let o of s)this.isVisible(o,t)&&(r.push(o.layoutInfo),o.children&&h(o.children))};return h(this.rootNodes),r}layoutIfNeeded(t){if(this.lastCollection){this.requestedRect.containsRect(t)||(this.requestedRect=this.requestedRect.union(t),this.rootNodes=this.buildCollection());for(let e of this.virtualizer.persistedKeys)if(this.ensureLayoutInfo(e))return}}ensureLayoutInfo(t){return!this.layoutNodes.has(t)&&this.requestedRect.area<this.contentSize.area&&this.lastCollection?(this.requestedRect=new c(0,0,1/0,1/0),this.rootNodes=this.buildCollection(),this.requestedRect=new c(0,0,this.contentSize.width,this.contentSize.height),!0):!1}isVisible(t,e){return t.layoutInfo.rect.intersects(e)||t.layoutInfo.isSticky||t.layoutInfo.type==="header"||t.layoutInfo.type==="loader"||this.virtualizer.isPersistedKey(t.layoutInfo.key)}shouldInvalidateEverything(t){let e=t.layoutOptions;return t.sizeChanged||this.rowSize!==(e?.rowSize??e?.rowHeight??this.rowSize)||this.orientation!==(e?.orientation??this.orientation)||this.headingSize!==(e?.headingSize??e?.headingHeight??this.headingSize)||this.loaderSize!==(e?.loaderSize??e?.loaderHeight??this.loaderSize)||this.gap!==(e?.gap??this.gap)||this.padding!==(e?.padding??this.padding)}shouldInvalidateLayoutOptions(t,e){return(t?.rowSize??t?.rowHeight)!==(e?.rowSize??e?.rowHeight)||t.orientation!==e.orientation||(t?.estimatedRowSize??t?.estimatedRowHeight)!==(e?.estimatedRowSize??e?.estimatedRowHeight)||(t?.headingSize??t?.headingHeight)!==(e?.headingSize??e?.headingHeight)||(t?.estimatedHeadingSize??t?.estimatedHeadingHeight)!==(e?.estimatedHeadingSize??e?.estimatedHeadingHeight)||(t?.loaderSize??t?.loaderHeight)!==(e?.loaderSize??e?.loaderHeight)||t.dropIndicatorThickness!==e.dropIndicatorThickness||t.gap!==e.gap||t.padding!==e.padding}update(t){let e=this.virtualizer.collection;this.invalidateEverything=this.shouldInvalidateEverything(t),this.invalidateEverything&&(this.requestedRect=this.virtualizer.visibleRect.copy(),this.layoutNodes.clear());let i=t.layoutOptions;if(this.rowSize=i?.rowSize??i?.rowHeight??this.rowSize,this.orientation=i?.orientation??this.orientation,this.estimatedRowSize=i?.estimatedRowSize??i?.estimatedRowHeight??this.estimatedRowSize,this.headingSize=i?.headingSize??i?.headingHeight??this.headingSize,this.estimatedHeadingSize=i?.estimatedHeadingSize??i?.estimatedHeadingHeight??this.estimatedHeadingSize,this.loaderSize=i?.loaderSize??i?.loaderHeight??this.loaderSize,this.dropIndicatorThickness=i?.dropIndicatorThickness??this.dropIndicatorThickness,this.gap=i?.gap??this.gap,this.padding=i?.padding??this.padding,this.rootNodes=this.buildCollection(),this.lastCollection&&e!==this.lastCollection)for(let r of this.lastCollection.getKeys())e.getItem(r)||this.layoutNodes.get(r)&&this.layoutNodes.delete(r);this.lastCollection=e,this.invalidateEverything=!1,this.validRect=this.requestedRect.copy()}buildCollection(t=this.padding){let e=this.virtualizer.collection,i=this.orientation==="horizontal"?"x":"y",r=this.orientation==="horizontal"?"maxX":"maxY",h=H(e,a=>a.type!=="content"),s=h.filter(a=>a.type==="loader"),o=[],l=e?.size===0;l&&(t=0);for(let a of h){let n=(this.rowSize??this.estimatedRowSize??f)+this.gap;if(a.type==="item"&&t+n<this.requestedRect[i]&&!this.isValid(a,t)){t+=n;continue}let d=this.orientation==="horizontal"?this.buildChild(a,t,this.padding,null):this.buildChild(a,this.padding,t,null);if(t=d.layoutInfo.rect[r]+this.gap,o.push(d),a.type==="loader"){let u=s.indexOf(a);s.splice(u,1)}if((a.type==="item"||a.type==="loader"Line truncated
import{ee as v}from"./index-CXHBmSa5.js";import{$ as R,c,a as S,b as p}from"./Virtualizer--Vfl8O3n.js";const f=48;class N extends R{constructor(t={}){super(),this.rowSize=t?.rowSize??t?.rowHeight??null,this.orientation=t.orientation??"vertical",this.estimatedRowSize=t?.estimatedRowSize??t?.estimatedRowHeight??null,this.headingSize=t?.headingSize??t?.headingHeight??null,this.estimatedHeadingSize=t?.estimatedHeadingSize??t?.estimatedHeadingHeight??null,this.loaderSize=t?.loaderSize??t?.loaderHeight??null,this.dropIndicatorThickness=t.dropIndicatorThickness||2,this.gap=t.gap||0,this.padding=t.padding||0,this.layoutNodes=new Map,this.rootNodes=[],this.lastCollection=null,this.invalidateEverything=!1,this.validRect=new c,this.requestedRect=new c,this.contentSize=new S}get collection(){return this.virtualizer.collection}get rowHeight(){return this.rowSize}get estimatedRowHeight(){return this.estimatedRowSize}get headingHeight(){return this.headingSize}get estimatedHeadingHeight(){return this.estimatedHeadingSize}get loaderHeight(){return this.loaderSize}getLayoutInfo(t){return this.ensureLayoutInfo(t),this.layoutNodes.get(t)?.layoutInfo||null}getVisibleLayoutInfos(t){let e=this.orientation==="horizontal"?"x":"y",i=this.orientation==="horizontal"?"width":"height";if(t[i]>1){let s=(this.rowSize??this.estimatedRowSize??f)+this.gap;t=t.copy();let o=Math.floor(t[e]/s)*s,l=t[i]+t[e]-o;t[e]=o,t[i]=Math.ceil(l/s)*s}this.layoutIfNeeded(t);let r=[],h=s=>{for(let o of s)this.isVisible(o,t)&&(r.push(o.layoutInfo),o.children&&h(o.children))};return h(this.rootNodes),r}layoutIfNeeded(t){if(this.lastCollection){this.requestedRect.containsRect(t)||(this.requestedRect=this.requestedRect.union(t),this.rootNodes=this.buildCollection());for(let e of this.virtualizer.persistedKeys)if(this.ensureLayoutInfo(e))return}}ensureLayoutInfo(t){return!this.layoutNodes.has(t)&&this.requestedRect.area<this.contentSize.area&&this.lastCollection?(this.requestedRect=new c(0,0,1/0,1/0),this.rootNodes=this.buildCollection(),this.requestedRect=new c(0,0,this.contentSize.width,this.contentSize.height),!0):!1}isVisible(t,e){return t.layoutInfo.rect.intersects(e)||t.layoutInfo.isSticky||t.layoutInfo.type==="header"||t.layoutInfo.type==="loader"||this.virtualizer.isPersistedKey(t.layoutInfo.key)}shouldInvalidateEverything(t){let e=t.layoutOptions;return t.sizeChanged||this.rowSize!==(e?.rowSize??e?.rowHeight??this.rowSize)||this.orientation!==(e?.orientation??this.orientation)||this.headingSize!==(e?.headingSize??e?.headingHeight??this.headingSize)||this.loaderSize!==(e?.loaderSize??e?.loaderHeight??this.loaderSize)||this.gap!==(e?.gap??this.gap)||this.padding!==(e?.padding??this.padding)}shouldInvalidateLayoutOptions(t,e){return(t?.rowSize??t?.rowHeight)!==(e?.rowSize??e?.rowHeight)||t.orientation!==e.orientation||(t?.estimatedRowSize??t?.estimatedRowHeight)!==(e?.estimatedRowSize??e?.estimatedRowHeight)||(t?.headingSize??t?.headingHeight)!==(e?.headingSize??e?.headingHeight)||(t?.estimatedHeadingSize??t?.estimatedHeadingHeight)!==(e?.estimatedHeadingSize??e?.estimatedHeadingHeight)||(t?.loaderSize??t?.loaderHeight)!==(e?.loaderSize??e?.loaderHeight)||t.dropIndicatorThickness!==e.dropIndicatorThickness||t.gap!==e.gap||t.padding!==e.padding}update(t){let e=this.virtualizer.collection;this.invalidateEverything=this.shouldInvalidateEverything(t),this.invalidateEverything&&(this.requestedRect=this.virtualizer.visibleRect.copy(),this.layoutNodes.clear());let i=t.layoutOptions;if(this.rowSize=i?.rowSize??i?.rowHeight??this.rowSize,this.orientation=i?.orientation??this.orientation,this.estimatedRowSize=i?.estimatedRowSize??i?.estimatedRowHeight??this.estimatedRowSize,this.headingSize=i?.headingSize??i?.headingHeight??this.headingSize,this.estimatedHeadingSize=i?.estimatedHeadingSize??i?.estimatedHeadingHeight??this.estimatedHeadingSize,this.loaderSize=i?.loaderSize??i?.loaderHeight??this.loaderSize,this.dropIndicatorThickness=i?.dropIndicatorThickness??this.dropIndicatorThickness,this.gap=i?.gap??this.gap,this.padding=i?.padding??this.padding,this.rootNodes=this.buildCollection(),this.lastCollection&&e!==this.lastCollection)for(let r of this.lastCollection.getKeys())e.getItem(r)||this.layoutNodes.get(r)&&this.layoutNodes.delete(r);this.lastCollection=e,this.invalidateEverything=!1,this.validRect=this.requestedRect.copy()}buildCollection(t=this.padding){let e=this.virtualizer.collection,i=this.orientation==="horizontal"?"x":"y",r=this.orientation==="horizontal"?"maxX":"maxY",h=H(e,a=>a.type!=="content"),s=h.filter(a=>a.type==="loader"),o=[],l=e?.size===0;l&&(t=0);for(let a of h){let n=(this.rowSize??this.estimatedRowSize??f)+this.gap;if(a.type==="item"&&t+n<this.requestedRect[i]&&!this.isValid(a,t)){t+=n;continue}let d=this.orientation==="horizontal"?this.buildChild(a,t,this.padding,null):this.buildChild(a,this.padding,t,null);if(t=d.layoutInfo.rect[r]+this.gap,o.push(d),a.type==="loader"){let u=s.indexOf(a);s.splice(u,1)}if((a.type==="item"||a.type==="loader"Line truncated
@@ -0,0 +1,2 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./LoginShowcase-CwRzXrsa.js","./vendor-react-Bf71BWbF.js","./index-CXHBmSa5.js","./index-BMPxGQXj.css"])))=>i.map(i=>d[i]);
import{u as z,a as W,e as X,d as I,A as L,i as Y,b as ee,s as se,r as ne,w as te,n as B,c as re,f as oe,L as C,h as ie,g as ae,S as le,l as ce,E as H,j as ue,I as de,T as b,B as ge,k as me,_ as pe}from"./index-CXHBmSa5.js";import{r as u,j as s}from"./vendor-react-Bf71BWbF.js";import{D as P,s as fe,d as he,a as xe,o as we}from"./auth-BGnwk8Hi.js";function ke(n,r,o,a){return n.some(t=>t.id===r&&B(t.api)===B(o))?n.map(t=>t.id===r?{...t,token:a.trim()}:t):null}const ye=/^[A-Za-z0-9_.-]{1,64}$/;function je(n,r,o,a){const t={};r?ye.test(r)||(t.username="login.badUsername"):t.username="login.usernameRequired";const l=[...o].length;return l?n==="setup"&&l<8?t.password="login.passwordShort":l>128||new TextEncoder().encode(o).length>512?t.password="login.passwordLong":n==="setup"&&o!==a&&(t.confirm="login.mismatch"):t.password="login.passwordRequired",t}function ve(n){return n instanceof L?n.code==="invalid_credentials"?{key:"login.invalidCredentials"}:n.code==="setup_required"?{key:"login.needsSetup",switchTo:"setup"}:n.code==="setup_already_completed"?{key:"login.alreadySetUp",switchTo:"login"}:n.code==="permission_denied"?{key:"login.setupPeer"}:n.code==="rate_limited"?{key:"login.rateLimited",params:{n:n.retryAfter??60}}:null:null}function be(n){return n instanceof SyntaxError?!0:n instanceof L&&(n.status===404||n.status===401||n.status===403)}async function Se(n,r){try{return fe(await he(n,r))}catch(o){if(!be(o))throw o;return!(o instanceof L)||o.status!==404||await xe(n,r)?"token":"no-api"}}function Te(n,r,o){try{const{profiles:a,activeId:t}=ne(),l=ke(a,n,r,o);if(!l)return"login.stale";te({profiles:l,activeId:t})}catch{return"settings.saveError"}return null}async function Ee(n,r,o,a){let t;try{t=await we(r,o,a)}catch(l){return ve(l)??{error:l}}try{se(n,r,t.token,t.expires_at)}catch{return{key:"settings.saveError"}}return null}function Ne(n,r){const{kind:o,failure:a,attempt:t,ended:l,rejected:h}=n;return o==="no-api"?null:a!==null?{tone:"negative",text:typeof a=="string"?a:r(a.key,a.params),focus:!0,id:t}:l?{tone:"informative",text:r("login.sessionEnded"),focus:!1,id:0}:h&&o==="token"?{tone:"negative",text:r("login.rejected"),focus:!1,id:0}:null}function Ae(n,r,o,a){const t=z(),l=W(),[h]=u.useState(()=>X(n,r)),[c,w]=u.useState(null),[k,y]=u.useState({attempt:0,error:null});u.useEffect(()=>{const i=new AbortController;return Se(r,i.signal).then(g=>w(g),g=>{i.signal.aborted||y(m=>({...m,error:g instanceof Error?g:new Error(String(g))}))}),()=>i.abort()},[r,k.attempt]);const[p,d]=u.useState(""),e=Y(r),[x,j]=u.useState(e?P.username:""),[f,S]=u.useState(e?P.password:""),[D,R]=u.useState(""),[T,K]=u.useState(!1),[U,q]=u.useState(!1),[E,F]=u.useState({}),[V,v]=u.useState(null),[Z,Q]=u.useState(0),N=(i,g)=>m=>{g(m),E[i]&&F(({[i]:Ce,...J})=>J)},$=()=>{if(!p.trim())return;const i=Te(n,r,p);i?v({key:i}):location.reload()},G=async i=>{const g=je(i,x,f,D);if(F(g),Object.keys(g).length)return;q(!0);const m=await Ee(n,r,i,{username:x,password:f});if(!m){location.reload();return}if(q(!1),"error"in m){v(t("login.failed",{error:ee(m.error,t)}));return}m.switchTo&&(w(m.switchTo),R("")),v(m)},A=c==="setup"||c==="login",_=i=>E[i]?t(E[i]):void 0;return{kind:c,discoveryError:k.error,retryDiscovery:()=>y(i=>({attempt:i.attempt+1,error:null})),title:t(c==="no-api"?"login.noApiTitle":c==="setup"?"login.setupTitle":c==="token"?"login.title":"login.passwordTitle"),note:c==="no-api"?t("login.noApiNote"):c==="setup"?t("login.setupNote",{backend:o}):c==="login"?t("login.connectedTo",{backend:o}):t("login.note",{backend:o}),demoNote:e&&c==="login"?t("login.demoNote",P):null,alert:Ne({kind:c,failure:V,attempt:Z,ended:h,rejected:a},t),busy:U,token:p,setToken:d,username:x,setUsername:N("username",j),usernameError:_("username"),password:f,setPassword:N("password",S),passwordError:_("password"),confirm:D,setConfirm:N("confirm",R),confirmError:_("confirm"),submit:()=>{U||c==="no-api"||(v(null),Q(i=>i+1),A?G(c):$())},canSubmit:c!=="no-api"&&(A||!!p.trim()),secretType:T?"text":"password",toggle:()=>K(i=>!i),toggleText:t(A?T?"login.hidePassword":"login.showPassword":T?"settings.hideToken":"settings.showToken"),guideHref:I(l),requirementsHref:I(l,"no-native-api")}}function M({className:n,...r}){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:10,height:10,viewBox:"0 0 12 12","aria-hidden":"true",focusable:"false",className:re("rp-icon rp-link-out",n),...r,children:s.jsx("path",{fill:"currentColor",d:"m10.08887,1h-5.51074c-.50293,0-.91113.4082-.91113.91113s.4082.91113.91113.91113h3.31055L1.35547,9.35547c-.35645.35645-.35645.93262,0,1.28906.17773.17773.41113.2666.64453.2666s.4668-.08887.64453-.2666l6.5332-6.5332v3.31055c0,.50293.4082.91113.91113.91113s.91113-.4082.91113-.91113V1.91113c0-.50293-.4082-.91113-.91113-.91113Z"})})}const _e=u.lazy(()=>pe(()=>import("./LoginShowcase-CwRzXrsa.js"),__vite__mapDeps([0,1,2,3]),import.meta.url)),O=s.jsx("div",{className:"rp-login-showcase","aria-hidden":"true"});function Re({profileId:n,api:r,backend:o,rLine truncated
@@ -1 +0,0 @@
import{r as l,j as n}from"./vendor-react-Bf71BWbF.js";import{u as U,e as H,A,s as J,a as Q,r as V,w as W,n as D,M as X,l as Y,E as ee,L as E,h as F,b as te,I as se,T as w,B as ne}from"./index-zQjLFfuj.js";import{s as re,d as oe,a as ie,o as ae}from"./auth-CPB25VPp.js";function le(s,o,a,d){return s.some(t=>t.id===o&&D(t.api)===D(a))?s.map(t=>t.id===o?{...t,token:d.trim()}:t):null}const ue=/^[A-Za-z0-9_.-]{1,64}$/;function ce(s,o,a,d){const t={};o?ue.test(o)||(t.username="login.badUsername"):t.username="login.usernameRequired";const e=[...a].length;return e?e<8?t.password="login.passwordShort":e>128||new TextEncoder().encode(a).length>512?t.password="login.passwordLong":s==="setup"&&a!==d&&(t.confirm="login.mismatch"):t.password="login.passwordRequired",t}function de(s){return s instanceof A?s.code==="invalid_credentials"?{key:"login.invalidCredentials"}:s.code==="setup_required"?{key:"login.needsSetup",switchTo:"setup"}:s.code==="setup_already_completed"?{key:"login.alreadySetUp",switchTo:"login"}:s.code==="permission_denied"?{key:"login.setupPeer"}:s.code==="rate_limited"?{key:"login.rateLimited",params:{n:s.retryAfter??60}}:null:null}function pe(s){return s instanceof SyntaxError?!0:s instanceof A&&(s.status===404||s.status===401||s.status===403)}async function ge(s,o){try{return re(await oe(s,o))}catch(a){if(!pe(a))throw a;return!(a instanceof A)||a.status!==404||await ie(s,o)?"token":"no-api"}}function me(s,o,a,d){const t=U(),[e]=l.useState(()=>H(s,o)),[i,m]=l.useState(null),[C,P]=l.useState({attempt:0,error:null});l.useEffect(()=>{const r=new AbortController;return ge(o,r.signal).then(u=>m(u),u=>{r.signal.aborted||P(c=>({...c,error:u instanceof Error?u:new Error(String(u))}))}),()=>r.abort()},[o,C.attempt]);const[f,q]=l.useState(""),[k,I]=l.useState(""),[y,M]=l.useState(""),[N,_]=l.useState(""),[x,B]=l.useState(!1),[L,v]=l.useState(!1),[b,R]=l.useState({}),[p,g]=l.useState(null),[K,z]=l.useState(0),j=(r,u)=>c=>{u(c),b[r]&&R(({[r]:h,...G})=>G)},O=()=>{if(f.trim()){try{const{profiles:r,activeId:u}=V(),c=le(r,s,o,f);if(!c){g({key:"login.stale"});return}W({profiles:c,activeId:u})}catch{g({key:"settings.saveError"});return}location.reload()}},Z=async r=>{const u=ce(r,k,y,N);if(R(u),!Object.keys(u).length){v(!0);try{const c=await ae(o,r,{username:k,password:y});try{J(s,o,c.token,c.expires_at)}catch{v(!1),g({key:"settings.saveError"});return}location.reload()}catch(c){v(!1);const h=de(c);h?.switchTo&&(m(h.switchTo),_("")),g(h??t("login.failed",{error:Q(c,t)}))}}},S=i==="setup"||i==="login",$=i==="no-api"?null:p!==null?{tone:"negative",text:typeof p=="string"?p:t(p.key,p.params),focus:!0,id:K}:e?{tone:"informative",text:t("login.sessionEnded"),focus:!1,id:0}:d&&i==="token"?{tone:"negative",text:t("login.rejected"),focus:!1,id:0}:null,T=r=>b[r]?t(b[r]):void 0;return{kind:i,discoveryError:C.error,retryDiscovery:()=>P(r=>({attempt:r.attempt+1,error:null})),title:t(i==="no-api"?"login.noApiTitle":i==="setup"?"login.setupTitle":i==="token"?"login.title":"login.passwordTitle"),note:i==="no-api"?t("login.noApiNote"):i==="setup"?t("login.setupNote",{backend:a}):i==="login"?null:t("login.note",{backend:a}),alert:$,busy:L,token:f,setToken:q,username:k,setUsername:j("username",I),usernameError:T("username"),password:y,setPassword:j("password",M),passwordError:T("password"),confirm:N,setConfirm:j("confirm",_),confirmError:T("confirm"),submit:()=>{L||i==="no-api"||(g(null),z(r=>r+1),S?Z(i):O())},canSubmit:i!=="no-api"&&(S||!!f.trim()),secretType:x?"text":"password",toggle:()=>B(r=>!r),toggleText:t(S?x?"login.hidePassword":"login.showPassword":x?"settings.hideToken":"settings.showToken")}}function ke({profileId:s,api:o,backend:a,rejected:d}){const t=U(),e=me(s,o,a,d),i={shown:e.secretType==="text",label:e.toggleText,onToggle:e.toggle};return n.jsxs(X,{isOpen:!0,locked:!0,narrow:!0,hideTitle:!0,title:e.title,children:[n.jsxs("div",{className:"rp-login-brand",children:[n.jsx("img",{src:Y,alt:""}),n.jsx("span",{className:"rp-brand-text",children:n.jsx("span",{children:"doona"})}),n.jsx("h2",{className:"rp-h3",children:e.title})]}),n.jsx("form",{className:"rp-login",onSubmit:m=>{m.preventDefault(),e.submit()},children:e.kind===null?e.discoveryError?n.jsxs(n.Fragment,{children:[n.jsx(ee,{error:e.discoveryError,onRetry:e.retryDiscovery}),n.jsx("div",{className:"rp-toolbar",children:n.jsx(E,{appearance:"link",href:F("settings"),children:t("login.settings")})})]}):n.jsx(te,{}):n.jsxs(n.Fragment,{children:[e.note&&n.jsx("span",{className:"rp-label",children:e.note}),e.alert&&n.jsx(se,{tone:e.alert.tone,takeFocus:e.alert.focus,children:e.alert.text},e.alert.id),e.kind==="no-api"?n.jsx(E,{appearance:"link",href:"https://github.com/Zakkaus/doona#native-api-requirement",children:t("login.requirements")}):e.kind==="token"?n.jsx(w,{label:t("login.token"),name:"token",type:e.secretType,value:e.token,autoComplete:"off",onChange:e.setToken,reveal:i}):n.jsxs(n.Fragment,{children:[n.jsx(w,{label:t("login.username"),name:"username",value:e.userLine truncated
@@ -0,0 +1 @@
import{j as N,r as B}from"./vendor-react-Bf71BWbF.js";import{u as W1,f as j1,aJ as K1}from"./index-CXHBmSa5.js";function N1({label:r,className:a,isDisabled:m,ref:e,canvasRef:l}){return N.jsx("button",{ref:e,type:"button",className:a,"aria-label":r,disabled:m,children:N.jsx("canvas",{ref:l})})}const U1=[["ink","M657 1228c-12-4-23-14-28-26-1-4-2-4-4-4-22 4-36 3-49-3-11-6-18-16-20-27-2-11 3-23 12-34 3-3 6-6 6-6 0 0-7-1-15-1-34-2-70-7-100-14-49-12-98-36-134-67l-5-4-12 4c-20 7-36 9-60 9-21 0-43-4-57-10-13-5-25-16-30-25-5-10-4-23 3-34 4-6 16-18 24-22l6-4-3-8c-2-5-2-9-2-12 1-6 5-15 9-18 4-5 16-13 21-14 3-1 5-2 6-2 0-1-1-6-3-12-21-73-6-145 45-212l7-10-12-2c-15-1-23-3-34-7-24-9-40-29-40-49 0-19 7-34 36-72 15-21 27-39 35-54 11-19 10-17 5-28-2-4-5-11-6-14-2-8-3-32-1-43 4-28 18-59 42-90l3-5-6-4c-11-9-20-21-23-32-2-6-2-9-2-17 1-9 1-10 4-18 6-11 15-20 29-27 14-7 24-10 47-15 1 0 3-3 7-11 19-37 51-71 88-94 12-8 32-18 44-22 10-3 29-8 33-8 1 0 5-2 8-5 11-8 25-14 39-16 12-2 49-1 63 2 21 4 34 9 45 19 8 7 10 9 15 18 4 7 4 7 13 12 34 18 63 46 86 81 10 16 20 38 26 57 4 12 8 34 10 48 2 13 2 43 0 56l-1 10 6 7c8 8 14 19 18 28 3 9 4 24 2 33-3 14-14 27-29 35-9 5-19 7-31 8l-9 1 0 8c0 4 0 15 0 25 0 16-1 31-5 47l0 3 14 0c27 0 58 5 83 14 21 9 51 25 68 39 3 2 6 5 7 5 0 1 6-2 14-6 27-14 49-17 69-11 26 8 38 34 27 64-2 5-3 9-3 10 0 0 4 1 8 3 14 7 24 19 29 34 8 22 0 45-24 73l-5 6 3 9c6 26 8 63 5 89-2 14-7 33-12 48-9 22-26 52-43 72-10 13-34 36-47 46-28 22-59 39-93 52-16 7-44 16-47 16-1 0-1 1-1 3 9 31 7 61-3 81-8 16-19 27-33 34-9 4-14 5-25 5-15 0-28-4-39-13l-6-5-7 6c-9 7-18 13-26 16-9 3-27 4-35 1z"],["paper","M582 1098c-44-2-79-6-117-16-55-14-102-41-141-81-42-43-67-93-75-148-2-14-1-43 1-56 6-30 16-57 32-82 8-12 24-33 32-42 6-7 7-7 17-10 58-18 110-56 126-92 2-5 2-9 3-16 1-14-2-21-15-33-13-14-21-24-33-39-18-26-28-35-45-43-11-5-21-7-33-7-13 0-23 2-33 7-6 3-9 3-9 3-4-6-4-28-2-42 5-23 18-49 37-73 14-18 37-39 56-53 5-4 6-4 11-4 41 1 105 13 154 28 32 9 72 25 104 42 18 9 51 27 66 37 8 5 8 5 11 13 7 16 13 37 16 56 2 11 2 41 1 54-4 39-19 74-44 104-8 9-10 14-9 20 1 5 7 10 13 12 7 2 14-1 24-11 10-11 22-29 32-48 3-5 4-7 6-7 2-1 14-1 27-1 22 0 24 0 37 2 34 8 68 24 98 48 13 11 15 12 20 12 5 0 7-1 16-7 22-14 41-21 53-18 13 3 16 15 7 32-2 5-6 11-8 15-4 8-4 14 0 19 4 5 7 6 17 7 15 1 23 5 27 14 3 6 3 15 0 22-2 6-10 18-20 30-9 11-11 15-8 24 3 10 6 33 7 52 0 26-2 47-10 70-18 53-57 101-111 135-40 25-87 43-144 54-66 14-132 19-194 17z"],["ink","M517 445c-7-2-13-6-18-12-7-7-9-14-9-25 0-7 0-8 3-15 7-13 17-21 31-22 23-1 43 18 41 40-2 19-17 33-36 35-4 0-9-1-12-1z"],["yellow","M541 220c-13-3-27-7-41-9-6-1-14-3-17-3l-5-1 2-6c3-15 13-40 23-59 20-39 43-66 64-73 11-3 56-1 74 4 7 1 13 4 17 7 3 3 3 4-1 4-5 0-17 4-24 7-35 18-62 59-79 118-2 8-4 14-4 14 0 0-4-1-9-3z"],["yellow","M446 203c-4-1-19-1-35-2-16 0-29 0-29-1 0-1 6-12 12-20 22-34 53-62 87-78 10-5 32-13 33-12 0 0-2 3-6 8-19 27-38 69-47 102-1 4-1 4-5 4-3 0-7-1-10-1z"],["yellow","M569 226c13-58 39-102 70-119 14-7 21-6 40 1 53 23 96 73 113 132 9 29 11 67 7 95-71-43-149-81-230-109z"],["yellow","M780 426c-1-2-5-19-5-19 0-1 3 0 8 0 6 0 8 0 10-2 5-4 3-6-21-21-50-32-74-46-109-63-71-36-143-57-225-67-48-6-99-5-107 1-4 3-5 5-2 7 1 2 3 2 10 3l8 0-4 4c-3 3-9 8-13 12l-9 8-4-2c-6-4-13-11-16-17-3-5-4-12-3-17 2-8 11-17 22-22 22-10 60-14 101-12 63 3 121 16 167 36 71 31 145 67 214 105 17 10 27 31 23 45-1 5-6 12-10 15-6 4-15 6-25 7-8 0-10 0-10-1z"],["yellow","M251 640c-19-4-32-16-32-29 0-10 5-19 23-43 26-34 37-50 50-75 6-12 9-17 13-20 12-11 29-13 45-7 11 5 17 10 37 36 9 13 19 25 24 30 5 5 10 10 12 13 2 3 2 5 2 10 0 5-1 8-4 12-17 29-73 61-123 71-14 3-38 4-47 2z"],["yellow","M226 1028c-12-1-24-5-31-10-12-8-13-16-2-27 5-5 19-13 30-17 7-3 11-6 11-8 0-3-1-5-8-9-7-6-10-10-10-14 0-4 1-5 4-8 2-2 6-4 9-5 3-1 5-2 5-2 1 0 4 7 8 14 15 29 28 49 49 72 4 5 7 8 7 9-1 1-21 5-29 6-13 1-31 1-43-1z"],["yellow","M663 1201c-7-4-9-12-7-24 1-7 1-8 0-10-3-4-7-4-15-1-18 7-40 10-48 7-5-2-8-6-8-11 0-7 8-16 29-30l10-7 19 0c22-1 52-4 78-7 18-3 57-9 65-11 6-2 11-1 14 1 2 3 4 7 5 20 4 39-13 70-39 68-9-1-16-5-29-17-14-12-14-12-27 1-11 11-20 18-28 21-7 3-15 3-19 0z"]],U={width:940,height:1192},K=1.4,R=52,Z=72,f1=500,V1=250,F=22,Y=22,i1=Y+2,l1=16,u1=12,X1=56,A1=17,E=9,S1=18,q=1/120,h1=1500,e1=430,C=48,J1=e1*e1/(2*h1),H1=Math.max(2.2*R,R+J1+4),B1=200,_1=B1*h1/(2*e1),Q=.84*R*U.width/U.height/2,d1=.84*R/2;function G1(r,a,m){let e=0;for(;r>=1e3&&e<a.length-1;e++)r/=1e3;return(e?r.toFixed(m):r.toFixed(m>1?1:0))+" "+a[e]}function G(r){return G1(r,["MB","GB","TB","PB"],2)}function I1(r){return r<6?[100,150,200,300,450,650][r]:[1,1.5,2.5,4,6][(r-6)%5]*Math.pow(10,3+Math.floor((r-6)/5))}function q1(r){const a=I1(r);return a<1e3?a+" Mbps":G1(a,["Mbps","Gbps","Tbps","Pbps"],1).replace(".0 "," ")}function D1(r){const a=Math.pow(.9,r);return{speed:_1-(_1-110)*a,gap:H1+(205-H1)*a,space:B1+70*a,swing:r<6?0:34*(1-Math.pow(.8,r-5)),drift:r>=6}}function Q1(r){return(Math.floor(r*1e3/f1)+3)%4}function Y1(r,a,m={}){const e=Z*U.width/U.height,l=Math.max(X1,m.board??0),I=Math.floor(r-2*(u1+l1)-l-i1-YLine truncated
@@ -1,3 +0,0 @@
import{j as a,r as v}from"./vendor-react-Bf71BWbF.js";import{aB as B,u as M,X as O,_ as R,as as P,dn as L,B as W,dp as q,bm as k,dq as C,ax as H,V as N,W as _,ah as I,$ as V,aq as G,bg as J,dr as U,av as $,at as S,aT as X,T as z,cl as K,aw as Q,E as Y}from"./index-zQjLFfuj.js";import{F as Z}from"./FactStrip-vcLr7nBw.js";import{u as ee,h as te,C as se,t as ae}from"./layout-B3T-zLsm.js";import{D as re}from"./Table-DLlwyNFJ.js";import{A as oe}from"./ActionGroup-C-LVMOvQ.js";import{a as ne,L as le}from"./logs-KkruktUh.js";import{d as ie,e as ce}from"./files-BxEOxSF8.js";import"./useGridSelectionCheckbox-BK6qtlfZ.js";import"./Virtualizer-CTh266-x.js";import"./ListLayout-DU_9AgrU.js";function ue({label:e,rows:t,columns:o}){const r=B(),{ref:s,tip:h,show:l,hide:p}=ee();return a.jsxs("div",{className:"rp-heatmap rp-chart-hover",ref:s,onPointerLeave:p,role:"group","aria-label":e,"aria-describedby":r,style:{"--cols":o.length},children:[t.map(n=>{const c=Math.max(...n.counts);return a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"head",children:n.label}),a.jsx("div",{className:"cells",children:n.counts.map((b,f)=>a.jsx("span",{className:"cell t"+te(b,c),style:{"--tone":n.color},onPointerMove:g=>l(g,[n.titles[f]]),role:"img","aria-label":n.titles[f]},f))})]},n.id)}),o.length>0&&a.jsxs("div",{className:"row times","aria-hidden":"true",children:[a.jsx("div",{className:"head"}),a.jsxs("div",{className:"ends",children:[a.jsx("span",{children:o[0]}),o.length>2&&a.jsx("span",{children:o[Math.floor(o.length/2)]}),o.length>1&&a.jsx("span",{children:o[o.length-1]})]})]}),a.jsx(se,{tip:h})]})}const A=new WeakMap;function D(e){let t=A.get(e);return t===void 0&&A.set(e,t=Date.parse(e.ts)),t}const y=["error","warn","info","debug","trace"];function ge(e,t,o,r=24){const s=o?y.indexOf(o):y.length-1,h=y.filter((u,x)=>t.includes(u)&&x<=s),l=e.map(D).filter(Number.isFinite);if(!l.length)return{rows:h.map(u=>({level:u,counts:[]})),buckets:[],width:0,busiest:null};const p=Math.min(...l),n=Math.max(...l),c=ae(p,n,r),b=c.length>1?c[1]-c[0]:Math.max(n-p,6e4),f=new Map(h.map(u=>[u,new Array(c.length).fill(0)])),g=new Array(c.length).fill(0),j=new Array(c.length).fill(0);for(const u of e){const x=D(u),T=f.get(u.level);if(!T||!Number.isFinite(x))continue;const w=Math.min(c.length-1,Math.floor((x-c[0])/b));T[w]++,g[w]++,u.level==="error"&&j[w]++}const i=u=>u.reduce((x,T,w)=>T>u[x]?w:x,0),m=j.reduce((u,x)=>u+x,0),d=i(m?j:g);return{rows:h.map(u=>({level:u,counts:f.get(u)})),buckets:c,width:b,busiest:{start:c[d],count:m?j[d]:g[d],errors:m}}}function de({records:e,offered:t,minimum:o,setMinimum:r}){const s=M(),h=O[R()],l=P(),p=v.useMemo(()=>ge(e,t,o),[e,t,o]),n=v.useMemo(()=>new Intl.DateTimeFormat(h,{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),[h]),c=v.useCallback(i=>`${n.format(i)}–${n.format(i+p.width)}`,[n,p.width]),b=v.useMemo(()=>{const i=Object.keys(L).map(m=>{const d=s(L[m]);return[m,{text:d,label:a.jsxs(W,{quiet:!0,small:!0,className:m===o?"current":void 0,label:s(m===o?"log.chart.current":"log.chart.minimum",{level:d}),onPress:()=>r(m),children:[m===o&&a.jsx(q,{}),d]})}]});return new Map(i)},[o,r,s]),f=v.useMemo(()=>{const i={error:l.negative,warn:l.notice,info:l.info,debug:l.subtle,trace:l.muted},m=p.buckets.map(c);return{columns:p.buckets.map(d=>n.format(d)),rows:p.rows.map(d=>{const{text:u,label:x}=b.get(d.level);return{id:d.level,color:i[d.level],label:x,counts:d.counts,titles:d.counts.map((T,w)=>s("log.chart.cell",{time:m[w],level:u,n:T}))}})}},[p,c,n,b,l,s]);if(!e.length)return null;const g=p.busiest,j=g?g.errors?[{label:s("log.chart.errors"),value:s("log.chart.count",{n:g.errors}),icon:a.jsx(k,{}),tone:"negative"},{label:s("log.chart.peakErrors"),icon:a.jsx(C,{}),tint:"c1",value:c(g.start),caption:s("log.chart.count",{n:g.count})}]:[{label:s("log.chart.errors"),value:s("log.chart.count",{n:0}),icon:a.jsx(k,{}),tint:"c5"},{label:s("log.chart.peak"),icon:a.jsx(C,{}),tint:"c1",value:c(g.start),caption:s("log.chart.count",{n:g.count})}]:[];return a.jsxs("div",{className:"rp-chart-page",children:[a.jsx(Z,{facts:j}),a.jsx(H,{title:s("log.chart.title"),note:s("log.chart.sample",{n:e.length}),children:a.jsx(ue,{label:s("log.chart.title"),columns:f.columns,rows:f.rows})})]})}const E=["trace","debug","info","warn","error"],pe={trace:"muted",debug:"neutral",info:"info",warn:"warn",error:"err"},F=new WeakMap;function he(e,t,o){const r=F.get(e);if(r&&r.locale===t)return r.row;const s={id:e.id,timestamp:I(e.ts,t),iso:e.ts,levelText:N(L,e.level,o),tone:pe[e.level],target:e.target,gap:!1,message:e.message+(e.fields?" "+Object.entries(e.fields).map(([h,l])=>`${h}=${typeof l=="string"?l:JSON.stringify(l)}`).join(" "):"")};return F.set(e,{locale:t,row:s}),s}function me(e,t,o,r,s,h=new Set,l){const p=n=>!!l&&E.indexOf(n)<E.indexOf(l);return{rows:e.flatMap(n=>{const c=he(n,r,s);return h.has(n)?[{...c,id:`gap ${n.id}`,timestamp:"",iso:"",levelText:"",target:"",gap:!0,message:s("log.gap")},c]:[c]}),levels:t.map(n=>({id:n,label:p(n)?Line truncated
`)+`
`}const be=[];function je(){const e=M(),t=O[R()],o=V(),r=G(),[s,h]=v.useState("info"),l=v.useCallback(u=>h(u),[]),[p,n]=v.useState(""),[c,b]=v.useState(!1),f=J(p.trim()),g=o.data?.resources.logs,j=xe(s,g?.levels),i=ne({level:j,target:f,paused:c}),m=U(o.data?.resources.runtime_settings.available??!1).data?.log.level,d=v.useMemo(()=>me(i.records,g?.levels??[],r.data?.engine.name,t,e,i.gaps,m),[i.records,i.gaps,g,r.data,t,e,m]);return{...d,status:fe(i.connected,!!i.error,c,i.pending,le,t,e),records:i.records,offered:g?.levels??be,level:j??"",setLevel:l,target:p,setTarget:n,paused:c,setPaused:b,error:o.error??i.error,loading:!o.error&&!i.error&&!i.connected&&!i.records.length,clear:i.clear,retry:o.error?o.refetch:i.retry,export:()=>ie(ce(d.exportBase,"txt"),ve(i.records,i.gaps,e),"text/plain;charset=utf-8")}}function De(){const e=M(),t=je(),o=v.useMemo(()=>[{id:"ts",label:e("ui.time"),minWidth:200,grow:0,drop:2,render:r=>!r.gap&&a.jsx($,{className:"rp-code",text:r.iso,children:r.timestamp})},{id:"level",label:e("log.level"),minWidth:90,grow:0,drop:3,render:r=>!r.gap&&a.jsx(S,{small:!0,tone:r.tone,children:r.levelText})},{id:"target",label:e("log.target"),minWidth:160,grow:0,drop:1,render:r=>a.jsx("span",{className:"rp-code",children:r.target})},{id:"message",label:e("log.message"),minWidth:280,grow:3,isRowHeader:!0,render:r=>a.jsx($,{children:r.message})}],[e]);return a.jsxs("div",{className:"rp-page",children:[a.jsxs("div",{className:"rp-toolbar",children:[a.jsx(X,{side:!0,label:e("log.level"),value:t.level,onChange:t.setLevel,items:t.levels}),a.jsx(z,{search:!0,label:e("log.target"),value:t.target,width:240,placeholder:e("log.targetPlaceholder"),onChange:t.setTarget}),a.jsx(K,{isSelected:t.paused,onChange:t.setPaused,children:e("log.pause")}),a.jsx(S,{small:!0,tone:t.status.tone,children:t.status.text}),t.recordedText&&a.jsx("span",{className:"rp-label",children:t.recordedText}),a.jsx("span",{className:"rp-grow"}),a.jsx(oe,{actions:[{id:"clear",label:e("log.clear"),isDisabled:!t.rows.length,onAction:t.clear},{id:"export",label:e("log.export"),icon:a.jsx(Q,{}),isDisabled:!t.rows.length,onAction:t.export}]})]}),a.jsx(Y,{error:t.error,onRetry:t.retry}),a.jsx(de,{records:t.records,offered:t.offered,minimum:t.level,setMinimum:t.setLevel}),a.jsx(re,{label:e("nav.logs"),stream:!0,rows:t.rows,height:640,loading:t.loading,empty:e("log.empty"),cols:o})]})}export{De as Logs};
@@ -0,0 +1,3 @@
import{j as a,r as b}from"./vendor-react-Bf71BWbF.js";import{aM as B,u as L,a2 as O,a as R,aB as P,dF as T,B as W,dG as q,bw as k,dH as C,aG as H,a0 as N,a1 as G,aq as I,a5 as J,ay as _,bq as V,dI as K,cQ as Q,dJ as U,aE as F,aC as E,aD as z,b2 as X,T as Y,cw as Z,aF as ee,E as te}from"./index-CXHBmSa5.js";import{F as se}from"./FactStrip-BgQ_tYB6.js";import{u as ae,h as re,C as oe,t as ne}from"./layout-BRLew_nj.js";import{D as le}from"./Table-D0NFHHNQ.js";import{A as ie}from"./ActionGroup-90AzAQje.js";import{d as ce,e as ge}from"./files-BxEOxSF8.js";import{r as ue}from"./recorder-DlDpPhd4.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";function de({label:e,rows:s,columns:r}){const n=B(),{ref:t,tip:m,show:l,hide:p}=ae();return a.jsxs("div",{className:"rp-heatmap rp-chart-hover",ref:t,onPointerLeave:p,role:"group","aria-label":e,"aria-describedby":n,style:{"--cols":r.length},children:[s.map(o=>{const c=Math.max(...o.counts);return a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"head",children:o.label}),a.jsx("div",{className:"cells",children:o.counts.map((v,x)=>a.jsx("span",{className:"cell t"+re(v,c),style:{"--tone":o.color},onPointerMove:u=>l(u,[o.titles[x]]),role:"img","aria-label":o.titles[x]},x))})]},o.id)}),r.length>0&&a.jsxs("div",{className:"row times","aria-hidden":"true",children:[a.jsx("div",{className:"head"}),a.jsxs("div",{className:"ends",children:[a.jsx("span",{children:r[0]}),r.length>2&&a.jsx("span",{children:r[Math.floor(r.length/2)]}),r.length>1&&a.jsx("span",{children:r[r.length-1]})]})]}),a.jsx(oe,{tip:m})]})}const S=new WeakMap;function $(e){let s=S.get(e);return s===void 0&&S.set(e,s=Date.parse(e.ts)),s}const M=["error","warn","info","debug","trace"];function pe(e,s,r,n=24){const t=r?M.indexOf(r):M.length-1,m=M.filter((g,f)=>s.includes(g)&&f<=t),l=e.map($).filter(Number.isFinite);if(!l.length)return{rows:m.map(g=>({level:g,counts:[]})),buckets:[],width:0,busiest:null};const p=Math.min(...l),o=Math.max(...l),c=ne(p,o,n),v=c.length>1?c[1]-c[0]:Math.max(o-p,6e4),x=new Map(m.map(g=>[g,new Array(c.length).fill(0)])),u=new Array(c.length).fill(0),j=new Array(c.length).fill(0);for(const g of e){const f=$(g),y=x.get(g.level);if(!y||!Number.isFinite(f))continue;const w=Math.min(c.length-1,Math.floor((f-c[0])/v));y[w]++,u[w]++,g.level==="error"&&j[w]++}const i=g=>g.reduce((f,y,w)=>y>g[f]?w:f,0),h=j.reduce((g,f)=>g+f,0),d=i(h?j:u);return{rows:m.map(g=>({level:g,counts:x.get(g)})),buckets:c,width:v,busiest:{start:c[d],count:h?j[d]:u[d],errors:h}}}function me({records:e,offered:s,minimum:r,setMinimum:n}){const t=L(),m=O[R()],l=P(),p=b.useMemo(()=>pe(e,s,r),[e,s,r]),o=b.useMemo(()=>new Intl.DateTimeFormat(m,{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),[m]),c=b.useCallback(i=>`${o.format(i)}–${o.format(i+p.width)}`,[o,p.width]),v=b.useMemo(()=>{const i=Object.keys(T).map(h=>{const d=t(T[h]);return[h,{text:d,label:a.jsxs(W,{quiet:!0,small:!0,className:h===r?"current":void 0,label:t(h===r?"log.chart.current":"log.chart.minimum",{level:d}),onPress:()=>n(h),children:[h===r&&a.jsx(q,{}),d]})}]});return new Map(i)},[r,n,t]),x=b.useMemo(()=>{const i={error:l.negative,warn:l.notice,info:l.info,debug:l.subtle,trace:l.muted},h=p.buckets.map(c);return{columns:p.buckets.map(d=>o.format(d)),rows:p.rows.map(d=>{const{text:g,label:f}=v.get(d.level);return{id:d.level,color:i[d.level],label:f,counts:d.counts,titles:d.counts.map((y,w)=>t("log.chart.cell",{time:h[w],level:g,n:y}))}})}},[p,c,o,v,l,t]);if(!e.length)return null;const u=p.busiest,j=u?u.errors?[{label:t("log.chart.errors"),value:t("log.chart.count",{n:u.errors}),icon:a.jsx(k,{}),tone:"negative"},{label:t("log.chart.peakErrors"),icon:a.jsx(C,{}),tint:"c1",value:c(u.start),caption:t("log.chart.count",{n:u.count})}]:[{label:t("log.chart.errors"),value:t("log.chart.count",{n:0}),icon:a.jsx(k,{}),tint:"c5"},{label:t("log.chart.peak"),icon:a.jsx(C,{}),tint:"c1",value:c(u.start),caption:t("log.chart.count",{n:u.count})}]:[];return a.jsxs("div",{className:"rp-chart-page",children:[a.jsx(se,{facts:j}),a.jsx(H,{title:t("log.chart.title"),note:t("log.chart.sample",{n:e.length}),children:a.jsx(de,{label:t("log.chart.title"),columns:x.columns,rows:x.rows})})]})}const D=["trace","debug","info","warn","error"],he={trace:"muted",debug:"neutral",info:"info",warn:"warn",error:"err"},A=new WeakMap;function fe(e,s,r){const n=A.get(e);if(n&&n.locale===s)return n.row;const t={id:e.id,timestamp:I(e.ts,s),iso:e.ts,levelText:N(T,e.level,r),tone:he[e.level],target:e.target,gap:!1,message:e.message+(e.fields?" "+Object.entries(e.fields).map(([m,l])=>`${m}=${typeof l=="string"?l:JSON.stringify(l)}`).join(" "):"")};return A.set(e,{locale:s,row:t}),t}function xe(e,s,r,n,t,m=new Set,l){const p=o=>!!l&&D.indexOf(o)<D.indexOf(l);return{rows:e.flatMap(o=>{const c=fe(o,n,t);return m.has(o)?[{...c,id:`gap ${o.id}`,timestamp:"",iso:"",levelText:"",target:"",gap:!0,message:t("log.gap")},c]:[c]}),levelsLine truncated
`)+`
`}const ye=[];function Te(){const e=L(),s=O[R()],r=J(),n=_(),[t,m]=b.useState("info"),l=b.useCallback(f=>m(f),[]),[p,o]=b.useState(""),[c,v]=b.useState(!1),x=V(p.trim()),u=r.data?.resources.logs,j=je(t,u?.levels),i=K({level:j,target:x,paused:c}),h=Q(r.data?.resources.runtime_settings.available??!1).data,d=h?.log.level,g=b.useMemo(()=>xe(i.records,u?.levels??[],n.data?.engine.name,s,e,i.gaps,d),[i.records,i.gaps,u,n.data,s,e,d]);return{...g,empty:be(h?.recording?.logs,!!x,e),status:ve(i.connected,!!i.error,c,i.pending,U,s,e),records:i.records,offered:u?.levels??ye,level:j??"",setLevel:l,target:p,setTarget:o,paused:c,setPaused:v,error:r.error??i.error,loading:!r.error&&!i.error&&!i.connected&&!i.records.length,clear:i.clear,retry:r.error?r.refetch:i.retry,export:()=>ce(ge(g.exportBase,"txt"),we(i.records,i.gaps,e),"text/plain;charset=utf-8")}}function Oe(){const e=L(),s=Te(),r=b.useMemo(()=>[{id:"ts",label:e("ui.time"),minWidth:200,grow:0,drop:2,render:t=>!t.gap&&a.jsx(F,{className:"rp-code",text:t.iso,children:t.timestamp})},{id:"level",label:e("log.level"),minWidth:90,grow:0,drop:3,render:t=>!t.gap&&a.jsx(E,{small:!0,tone:t.tone,children:t.levelText})},{id:"target",label:e("log.target"),minWidth:160,grow:0,drop:1,render:t=>a.jsx("span",{className:"rp-code",children:t.target})},{id:"message",label:e("log.message"),minWidth:280,grow:3,isRowHeader:!0,render:t=>a.jsx(F,{children:t.message})}],[e]),n=b.useCallback(t=>a.jsx(z,{inline:!0,items:t.gap?[[e("log.message"),t.message]]:[[e("ui.time"),t.timestamp],[e("log.level"),t.levelText],[e("log.target"),t.target],[e("log.message"),t.message]]}),[e]);return a.jsxs("div",{className:"rp-page",children:[a.jsxs("div",{className:"rp-toolbar",children:[a.jsx(X,{side:!0,label:e("log.level"),value:s.level,onChange:s.setLevel,items:s.levels}),a.jsx(Y,{search:!0,label:e("log.target"),value:s.target,width:240,placeholder:e("log.targetPlaceholder"),onChange:s.setTarget}),a.jsx(Z,{isSelected:s.paused,onChange:s.setPaused,children:e("log.pause")}),a.jsx(E,{small:!0,tone:s.status.tone,children:s.status.text}),s.recordedText&&a.jsx("span",{className:"rp-label",children:s.recordedText}),a.jsx("span",{className:"rp-grow"}),a.jsx(ie,{actions:[{id:"clear",label:e("log.clear"),isDisabled:!s.rows.length,onAction:s.clear},{id:"export",label:e("log.export"),icon:a.jsx(ee,{}),isDisabled:!s.rows.length,onAction:s.export}]})]}),a.jsx(te,{error:s.error,onRetry:s.retry}),a.jsx(me,{records:s.records,offered:s.offered,minimum:s.level,setMinimum:s.setLevel}),a.jsx(le,{label:e("nav.logs"),stream:!0,rows:s.rows,height:640,loading:s.loading,empty:s.empty,cols:r,detail:n})]})}export{Oe as Logs};
@@ -1 +1 @@
import{j as e}from"./vendor-react-Bf71BWbF.js";import{u as s,a6 as a,T as c}from"./index-zQjLFfuj.js";import{d as i}from"./Virtualizer-CTh266-x.js";import{$ as b}from"./useFilter-BYneYrGs.js";import{$ as f}from"./ListLayout-DU_9AgrU.js";function x({children:t}){const o=s(),{contains:r}=b({sensitivity:"base"});return e.jsxs(a,{filter:r,children:[e.jsx(c,{search:!0,label:o("policy.filter"),autoFocus:!0,className:"rp-menu-search"}),e.jsx(i,{layout:f,layoutOptions:{rowHeight:32,headingHeight:26},children:t})]})}export{x as NodeSearch};
import{j as e}from"./vendor-react-Bf71BWbF.js";import{u as s,ad as a,T as c}from"./index-CXHBmSa5.js";import{d as i}from"./Virtualizer--Vfl8O3n.js";import{$ as b}from"./useFilter-DZ8TXqn_.js";import{$ as f}from"./ListLayout-CPapuywx.js";function x({children:t}){const o=s(),{contains:r}=b({sensitivity:"base"});return e.jsxs(a,{filter:r,children:[e.jsx(c,{search:!0,label:o("policy.filter"),autoFocus:!0,className:"rp-menu-search"}),e.jsx(i,{layout:f,layoutOptions:{rowHeight:32,headingHeight:26},children:t})]})}export{x as NodeSearch};
@@ -1,5 +0,0 @@
import{r as j,j as t}from"./vendor-react-Bf71BWbF.js";import{u as q,aB as ze,B as A,cm as ve,aE as H,$ as _e,a2 as Se,a1 as Z,a3 as Xe,_ as le,as as Je,E as Te,b as Ke,a8 as Qe,aI as O,bj as Ce,bk as Ye,bm as Ze,ax as en,cg as Le,aS as nn,U as De,av as ee,ay as sn,b9 as $e,at as an,bo as tn,a7 as Re,T as z,aT as me,j as Ge,F as on,k as ne,J as rn,H as ye,o as ln,cR as Ae,cS as dn,aj as cn,aN as un,ae as mn,V as Ne,ah as pn,ag as ce,W as se,aU as bn,ch as vn,X as he,b0 as C,cp as pe,cD as fe,a as ge,cC as hn,b2 as fn,z as We,cT as gn,cw as xn,cU as we,co as jn,a4 as kn,cV as yn,cW as Nn,cn as wn,cX as Pn,cY as Mn,b4 as _n,b5 as Sn,cZ as Tn,cq as Cn,bc as Ln,M as Dn,I as $n,cl as Rn,cK as Gn}from"./index-zQjLFfuj.js";import{F as An}from"./FactStrip-vcLr7nBw.js";import{u as Wn,C as Fn,p as Bn}from"./layout-B3T-zLsm.js";import{D as Fe,c as En}from"./Table-DLlwyNFJ.js";import{T as In}from"./TimeCell-DxlzlVpw.js";import{A as On}from"./AddCircle-DSsJ-CRu.js";import{u as Hn}from"./outbounds-CM0Hhk3q.js";import{p as qn,b as Un}from"./policyText-IIH31itq.js";import{$ as Vn}from"./useFilter-BYneYrGs.js";import{p as zn}from"./probe-CjOLdDVD.js";import{a as Xn}from"./setup-BqwQo7FE.js";import{P as Jn}from"./PolicyPicker-iyQz7WhP.js";import"./useGridSelectionCheckbox-BK6qtlfZ.js";import"./Virtualizer-CTh266-x.js";import"./ListLayout-DU_9AgrU.js";function Pe({kind:e,color:s}){return t.jsx("i",{className:"rp-marker "+e,style:s?{color:s}:void 0,"aria-hidden":"true"})}function Kn({label:e,groups:s,legend:n,max:a,fmt:d,limit:o=10,showAll:c}){const r=q(),u=ze(),{ref:i,tip:p,show:m,hide:h}=Wn(),[y,b]=j.useState(new Set),l=[0,a/4,a/2,3*a/4,a],v=x=>Math.min(100,x/a*100);return t.jsxs("div",{className:"rp-markerplot rp-chart-hover",ref:i,onPointerLeave:h,role:"group","aria-label":e,"aria-describedby":u,children:[t.jsx("ul",{className:"legend",children:n.map(x=>t.jsxs("li",{children:[t.jsx(Pe,{kind:x.kind}),x.label]},x.kind))}),t.jsxs("div",{className:"axis","aria-hidden":"true",children:[t.jsx("span",{}),t.jsx("div",{className:"scale",children:l.map(x=>t.jsx("span",{style:{insetInlineStart:`${v(x)}%`},children:d(x)},x))}),t.jsx("span",{})]}),s.map(x=>t.jsxs("section",{"aria-label":x.label,children:[s.length>1&&t.jsx("h4",{className:"rp-label",children:x.label}),(y.has(x.id)?x.rows:x.rows.slice(0,o)).map(f=>{const S=Object.values(f.values).filter(P=>P!==void 0),_=v(Math.min(...S)),R=v(Math.max(...S));return t.jsxs("div",{className:"row",onPointerMove:P=>m(P,[f.label,...f.details]),children:[t.jsx("span",{className:"name",children:f.label}),t.jsxs("div",{className:"track",role:"img","aria-label":f.label+r("ui.separator")+f.description,children:[l.map(P=>t.jsx("i",{className:"grid",style:{insetInlineStart:`${v(P)}%`}},P)),R>_&&t.jsx("i",{className:"span",style:{insetInlineStart:`${_}%`,width:`${R-_}%`}}),["tick","diamond","dot"].map(P=>f.values[P]===void 0?null:t.jsx("span",{className:"at "+P+(f.values[P]>a?" over":""),style:{insetInlineStart:`${v(f.values[P])}%`},children:t.jsx(Pe,{kind:P,color:P==="dot"?f.tone:void 0})},P))]}),t.jsx("span",{className:"value",children:f.text})]},f.id)}),!y.has(x.id)&&x.rows.length>o&&t.jsx("div",{className:"row more",children:t.jsx(A,{quiet:!0,small:!0,onPress:()=>b(f=>new Set([...f,x.id])),children:c(x.rows.length)})}),x.notes.map(f=>t.jsx("p",{className:"rp-note note",children:f},f))]},x.id)),t.jsx(Fn,{tip:p})]})}function Qn(e,s,n){const a=new Map((s??[]).map(r=>[r.id,r.name])),d=new Map,o=(r,u)=>{let i=d.get(r);return i||d.set(r,i={id:r,label:u,rows:[],missing:[]}),i};for(const r of e){const u=ve(r),i=n==="protocol"?[["protocol:"+(r.protocol??""),r.protocol??null]]:r.group_ids.length?r.group_ids.map(p=>["group:"+p,a.get(p)??p]):[["group:",null]];for(const[p,m]of i){const h=o(p,m);u?.state==="healthy"&&u.latency_ms!==null?h.rows.push({id:r.id,name:r.name,latest:u.latency_ms,moving:u.moving_avg_ms,avg10:u.avg10_ms}):h.missing.push({id:r.id,name:r.name,state:u?.state==="unavailable"?"unavailable":"unmeasured"})}}const c=[...d.values()];for(const r of c)r.rows.sort((u,i)=>u.latest-i.latest||H(u.name,i.name)),r.missing.sort((u,i)=>H(u.name,i.name));return c.sort((r,u)=>(r.label===null?1:0)-(u.label===null?1:0)||H(r.label??"",u.label??""))}function Yn(e){const s=e.flatMap(n=>n.rows);return{moving:s.some(n=>n.moving!==null),avg10:s.some(n=>n.avg10!==null)}}function Zn(e){const s=e.flatMap(d=>d.rows.flatMap(o=>[o.latest,o.moving??o.latest])).sort((d,o)=>d-o),n=Math.max(10,(Bn(s,90)??0)*1.25),a=n<=100?20:n<=500?100:n<=2e3?500:1e3;return Math.ceil(n/a)*a}function es(){const e=_e().data?.resources,s=Se(Z(e,"nodes",{whileLoading:!0})),n=Xe(Z(e,"groups",{whileLoading:!1})),[a,d]=j.useState("group"),o=j.useMemo(()=>Qn(s.data??[],n.data,a),[s.data,n.data,a]);return{nodes:s,by:a,setBy:d,view:o}}const ue=6;function ns(){const e=q(),s=le(),n=Je(),{nodes:a,by:d,setBy:o,view:c}=es();if(a.error&&!a.data)return t.jsx(Te,{error:a.error,onRetry:a.refetch});if(!a.data)return t.jsx(Ke,{});if(!a.data.length)return t.jsx(QLine truncated
`,c.from-1)+1,u=/^[ \t]*$/.test(e.slice(r,c.from))?r:c.from,i=d.children.find(l=>l.from===c.from);if(i){for(;n[o+1]?.from<i.to;)o++;if(i.line===i.endLine)continue;const l=on(e,i,n),v=l.find(f=>f.name==="url"),x=l.find(f=>f.name==="interval");a.push({from:u,to:i.to,block:i,tag:i.name,host:v?re(ne(v.value)):null,interval:x?os(ne(x.value)):null,fields:l,parts:null});continue}const p=n[o+1];p&&e.slice(p.from,p.to)===":"&&!e.slice(p.to).startsWith("//")&&(o+=2);const m=n[o];if(!m||m.from>=d.close)break;if(m.kind!=="quoted")for(;n[o+1]?.from===n[o].to&&!/[(){}]/.test(e.slice(n[o+1].from,n[o+1].to));)o++;if(e[n[o+1]?.from]==="(")for(o++;n[o+1]&&!(e[n[o].from]===")"&&n[o].parens===1);)o++;let h=n[o].to,y;n[o+1]?.kind==="comment"&&n[o+1].line===n[o].line&&(y=e.slice(n[o+1].from,n[o+1].to),h=n[++o].to);const b=rs(e.slice(u,h));b&&a.push({from:u,to:h,tag:b.tag,host:re(b.url),interval:null,fields:[],parts:b,comment:y})}return a}function ls(e){return Ee(e).map(({tag:s,host:n,interval:a})=>({tag:s,host:n,interval:a}))}function is(e,s,n){const a=Ee(e).find(u=>u.tag===s);if(!a||a.interval===n)return e;const d=e.slice(a.from,a.to).match(/^[ \t]*/)?.[0]??" ",o=d+(d.includes(" ")?" ":" ");if(a.parts){const u=[`${d}${rn(s)}: {`,`${o}url: ${ye(a.parts.url)}`];return a.parts.ua!==null&&u.push(`${o}ua: ${ye(a.parts.ua)}`),u.push(`${o}interval: '${n}s'`,`${d}}${a.comment?" "+a.comment:""}`),e.slice(0,a.from)+u.join(`
`)+e.slice(a.to)}const c=a.fields.find(u=>u.name==="interval");if(c)return e.slice(0,c.valueFrom)+` '${n}s'`+e.slice(c.valueTo);if(!a.block)return e;const r=e.lastIndexOf(`
`,a.block.close-1)+1;return e.slice(0,r)+`${o}interval: '${n}s'
`+e.slice(r)}function ds(e,s,n,a){const d=ve(e),o=d?.state==="healthy"&&d.latency_ms!=null;return{id:e.id,name:e.name,protocol:e.protocol??"—",latency:o?O(d.latency_ms,a):d?.state==="unavailable"?a("ui.unavailable"):"—",latencyClass:o?`ms ${Le(d.latency_ms)}`:d?.state==="unavailable"?"ms err":"ms",groups:e.group_ids.length?De(n,e.group_ids.map(c=>s.get(c)??c)):"—",probeLabel:a("nodes.probe",{name:e.name}),joinLabel:a("nodes.joinGroup",{name:e.name}),removeLabel:a("nodes.remove",{name:e.name})}}const cs=e=>bn(ve(e));function us(e,s,n,a){const d=new Map;for(const l of s){if(!l.provider_id||!l.subscription_tag)continue;const v=d.get(l.provider_id)??new Set;v.add(l.subscription_tag),d.set(l.provider_id,v)}const o=l=>{const v=d.get(l);return v?.size===1?[...v][0]:void 0},c=l=>{const v=re(l.url_redacted),x=v?n.filter(f=>f.host===v):[];return x.length===1?x[0].tag:void 0},r=new Map,u=e.filter(l=>l.kind==="subscription");for(const l of u){const v=o(l.id)??c(l);v&&r.set(l.id,v)}const i=u.filter(l=>!r.has(l.id)),p=new Set(r.values()),m=n.filter(l=>!p.has(l.tag));i.length===1&&m.length===1&&r.set(i[0].id,m[0].tag);const h=e.map(l=>{const v=o(l.id);return{...l,displayName:r.get(l.id)??l.name,configTag:l.kind==="subscription"&&v&&n.filter(x=>x.tag===v).length===1?v:void 0}}),y={builtin:0,unattributed:0};for(const l of s)l.provider_id==null&&y[Ae(l)]++;const b=[];for(const l of["builtin","unattributed"]){const v=y[l];v&&b.push({id:dn(l,e),name:a(l==="builtin"?"nodes.kind.builtin":"nodes.kind.unattributed"),kind:l,url_redacted:null,node_count:v,updated_at:null,expires_at:null,traffic:null,status:"ok",last_error:null})}return{list:[...b,...h]}}function ms(e,s){return s!==null&&e.some(n=>n.id===s)?s:(e.find(n=>n.kind!=="builtin"&&n.kind!=="unattributed")??e[0])?.id??null}function ps(e,s,n){return e.filter(a=>s===void 0||(s===null?a.provider_id==null&&Ae(a)==="builtin"==(n==="builtin"):a.provider_id===s))}function bs(e,s,n,a,d,o){const c=s.trim(),r=e.filter(m=>(!c||o(m.name,c))&&(!n||m.group_ids.includes(n))&&(!a||m.protocol===a)),u=d.direction==="ascending"?1:-1,i=d.column==="latency"?new Map(r.map(m=>[m.id,cs(m)])):new Map,p={name:(m,h)=>H(m.name,h.name),protocol:(m,h)=>H(m.protocol??"",h.protocol??""),latency:(m,h)=>vn(i.get(m.id),i.get(h.id))||H(m.name,h.name)};return r.sort((m,h)=>u*(p[d.column]??p.name)(m,h))}const be=[3600,21600,43200,86400];function xe(e,s,n){return e===0?n("nodes.manualOnly"):be.includes(e)?n("nodes.everyHours",{n:e/3600}):cn(String(e),s)}function Ie(e,s,n){return[0,...be,...e===null||e===0||be.includes(e)?[]:[e]].map(a=>({id:String(a),label:xe(a,s,n)}))}function vs(e,s){const n={name:e.name.trim(),kind:"subscription",url:e.value.trim()},a=Number(e.interval);s?.update_interval!==void 0&&e.interval&&a!==s.update_interval&&(n.update_interval=a);const d=e.agent.trim();return s?.user_agent!==void 0&&d&&d!==s.user_agent&&(n.user_agent=d),s?.cache!==void 0&&e.cache!==null&&e.cache!==s.cache&&(n.cache=e.cache),n}function hs(e,s,n,a){const d={subscription:"nodes.kind.subscription",file:"nodes.kind.file",inline:"nodes.kind.inline",builtin:"nodes.kind.builtin",unattributed:"nodes.kind.unattributed"},o={ok:"nodes.status.ok",stale:"nodes.status.stale",error:"nodes.status.error"},c={ok:"ok",stale:"warn",error:"err"},r=e.kind==="builtin"||e.kind==="unattributed",u=e.traffic?un(e.traffic.upload_bytes,e.traffic.download_bytes):null,i=e.kind==="subscription"?s:void 0,p=e.displayName??e.name;return{id:e.id,name:p,url:e.url_redacted??void 0,kind:Ne(d,e.kind,a),count:se(e.node_count,n),usage:u===null?"—":e.traffic?.total_bytes?a("ui.fraction",{part:ce(u,n),whole:ce(e.traffic.total_bytes,n)}):ce(u,n),updatedAt:r?null:e.updated_at,expires:e.expires_at?pn(e.expires_at,n):"—",interval:i==null?"—":xe(i,n,a),intervalValue:i==null?"":String(i),hasInterval:i!==void 0,intervalLabel:a("nodes.intervalOf",{name:p}),intervals:i===void 0?[]:Ie(i,n,a),status:r?null:Ne(o,e.status,a),tone:c[e.status],error:e.last_error?mn(e.last_error.code,e.last_error.message,a):void 0,refreshLabel:a("nodes.refresh",{name:p}),removeLabel:a("nodes.remove",{name:p})}}function fs(e){const s=q(),n=he[le()],{refresh:a}=e,d=new Map(e.entries.map(c=>[c.tag,c.interval]));return{rows:e.rows.map(c=>({...hs(c,c.configTag?d.get(c.configTag):void 0,n,s),refreshable:c.kind==="subscription"&&e.canRefresh,refreshing:a.busy===c.id,refreshDisabled:!!a.busy,refresh:()=>void a.refresh(c.id).then(r=>{r&&("degraded"in r?C("info",s("nodes.refreshedDegraded",{name:c.name})):C("positive",s("nodes.refreshed",{name:c.name,n:se(r.node_count,n)})))},r=>fe(r,s,s("nodes.refreshFailed",{name:c.name}))),removable:e.canManage&&(c.kind==="subscription"||c.kind==="file"),remove:()=>{(c.kind==="subscription"||c.kind==="file")&&e.onRemove(c)},setInterval:r=>{if(!c.configTag)return;const u=Number(r);e.source.apply(i=>is(i,c.configTag,u)).then(i=>{i.kind==="ok"&&C("positive",s("nodes.intervalSet",{name:c.name,interval:xe(u,n,s)}));const p=pe(i,s);p&&C(p.kind,p.text,{detail:p.de Line truncated
@@ -0,0 +1,5 @@
import{r as j,j as t}from"./vendor-react-Bf71BWbF.js";import{u as V,aM as Ye,B as F,cx as ve,aP as q,a5 as _e,a8 as Se,a7 as ee,a9 as Ke,a as ie,aB as Xe,E as Te,j as Ze,af as en,aT as H,bt as Ce,bu as nn,bw as sn,aG as an,cr as Le,b1 as tn,$ as De,aE as ne,aH as on,bj as Re,aC as rn,bz as ln,ae as $e,T as Q,b2 as me,y as Ge,N as dn,q as se,Q as cn,P as ke,C as un,d1 as Ae,d2 as mn,d3 as Fe,as as pn,aY as bn,am as vn,an as hn,a0 as Ne,aq as fn,ap as ce,a1 as ae,b3 as gn,cs as xn,a2 as he,bb as C,cB as pe,cO as fe,b as ge,cN as jn,bc as yn,J as We,d4 as kn,cH as Nn,d5 as we,cA as wn,aa as Pn,d6 as Mn,d7 as _n,cy as Sn,d8 as Tn,be as Cn,bf as Ln,d9 as Dn,cC as Rn,bn as $n,ac as Gn,I as An,cw as Fn,cW as Wn}from"./index-CXHBmSa5.js";import{F as Bn}from"./FactStrip-BgQ_tYB6.js";import{u as In,C as En,p as On}from"./layout-BRLew_nj.js";import{D as Be,c as Hn}from"./Table-D0NFHHNQ.js";import{T as qn}from"./TimeCell-gSIuLEFc.js";import{A as Vn}from"./AddCircle-Db3HxlxQ.js";import{u as zn}from"./outbounds-f8QoVoCV.js";import{p as Un,b as Qn}from"./policyText-CAFy3qpo.js";import{a as Ie}from"./setup-B5f1cfyO.js";import{$ as Jn}from"./useFilter-DZ8TXqn_.js";import{p as Yn}from"./probe-C8ejAKwA.js";import{P as Kn}from"./PolicyPicker-DSSmYroN.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";function Pe({kind:e,color:s}){return t.jsx("i",{className:"rp-marker "+e,style:s?{color:s}:void 0,"aria-hidden":"true"})}function Xn({label:e,groups:s,legend:n,max:a,fmt:l,limit:o=10,showAll:c}){const r=V(),u=Ye(),{ref:d,tip:p,show:m,hide:h}=In(),[k,b]=j.useState(new Set),i=[0,a/4,a/2,3*a/4,a],v=g=>Math.min(100,g/a*100);return t.jsxs("div",{className:"rp-markerplot rp-chart-hover",ref:d,onPointerLeave:h,role:"group","aria-label":e,"aria-describedby":u,children:[t.jsx("ul",{className:"legend",children:n.map(g=>t.jsxs("li",{children:[t.jsx(Pe,{kind:g.kind}),g.label]},g.kind))}),t.jsxs("div",{className:"axis","aria-hidden":"true",children:[t.jsx("span",{}),t.jsx("div",{className:"scale",children:i.map(g=>t.jsx("span",{style:{insetInlineStart:`${v(g)}%`},children:l(g)},g))}),t.jsx("span",{})]}),s.map(g=>t.jsxs("section",{"aria-label":g.label,children:[s.length>1&&t.jsx("h4",{className:"rp-label",children:g.label}),(k.has(g.id)?g.rows:g.rows.slice(0,o)).map(x=>{const N=Object.values(x.values).filter(M=>M!==void 0),T=v(Math.min(...N)),D=v(Math.max(...N));return t.jsxs("div",{className:"row",onPointerMove:M=>m(M,[x.label,...x.details]),children:[t.jsx("span",{className:"name",children:x.label}),t.jsxs("div",{className:"track",role:"img","aria-label":x.label+r("ui.separator")+x.description,children:[i.map(M=>t.jsx("i",{className:"grid",style:{insetInlineStart:`${v(M)}%`}},M)),D>T&&t.jsx("i",{className:"span",style:{insetInlineStart:`${T}%`,width:`${D-T}%`}}),["tick","diamond","dot"].map(M=>x.values[M]===void 0?null:t.jsx("span",{className:"at "+M+(x.values[M]>a?" over":""),style:{insetInlineStart:`${v(x.values[M])}%`},children:t.jsx(Pe,{kind:M,color:M==="dot"?x.tone:void 0})},M))]}),t.jsx("span",{className:"value",children:x.text})]},x.id)}),!k.has(g.id)&&g.rows.length>o&&t.jsx("div",{className:"row more",children:t.jsx(F,{quiet:!0,small:!0,onPress:()=>b(x=>new Set([...x,g.id])),children:c(g.rows.length)})}),g.notes.map(x=>t.jsx("p",{className:"rp-note note",children:x},x))]},g.id)),t.jsx(En,{tip:p})]})}function Zn(e,s,n){const a=new Map((s??[]).map(r=>[r.id,r.name])),l=new Map,o=(r,u)=>{let d=l.get(r);return d||l.set(r,d={id:r,label:u,rows:[],missing:[]}),d};for(const r of e){const u=ve(r),d=n==="protocol"?[["protocol:"+(r.protocol??""),r.protocol??null]]:r.group_ids.length?r.group_ids.map(p=>["group:"+p,a.get(p)??p]):[["group:",null]];for(const[p,m]of d){const h=o(p,m);u?.state==="healthy"&&u.latency_ms!==null?h.rows.push({id:r.id,name:r.name,latest:u.latency_ms,moving:u.moving_avg_ms,avg10:u.avg10_ms}):h.missing.push({id:r.id,name:r.name,state:u?.state==="unavailable"?"unavailable":"unmeasured"})}}const c=[...l.values()];for(const r of c)r.rows.sort((u,d)=>u.latest-d.latest||q(u.name,d.name)),r.missing.sort((u,d)=>q(u.name,d.name));return c.sort((r,u)=>(r.label===null?1:0)-(u.label===null?1:0)||q(r.label??"",u.label??""))}function es(e){const s=e.flatMap(n=>n.rows);return{moving:s.some(n=>n.moving!==null),avg10:s.some(n=>n.avg10!==null)}}function ns(e){const s=e.flatMap(l=>l.rows.flatMap(o=>[o.latest,o.moving??o.latest])).sort((l,o)=>l-o),n=Math.max(10,(On(s,90)??0)*1.25),a=n<=100?20:n<=500?100:n<=2e3?500:1e3;return Math.ceil(n/a)*a}function ss(){const e=_e().data?.resources,s=Se(ee(e,"nodes",{whileLoading:!0})),n=Ke(ee(e,"groups",{whileLoading:!1})),[a,l]=j.useState("group"),o=j.useMemo(()=>Zn(s.data??[],n.data,a),[s.data,n.data,a]);return{nodes:s,by:a,setBy:l,view:o}}const ue=6;function as(){const e=V(),s=ie(),n=Xe(),{nodes:a,by:l,setBy:o,view:c}=ss();if(a.error&&!a.data)return t.jsx(Te,{error:a.error,onRetry:a.refetch});if(!a.data)return t.jsx(Ze,{});if(!a.data.lengLine truncated
`,c.from-1)+1,u=/^[ \t]*$/.test(e.slice(r,c.from))?r:c.from,d=l.children.find(i=>i.from===c.from);if(d){for(;n[o+1]?.from<d.to;)o++;if(d.line===d.endLine)continue;const i=dn(e,d,n),v=i.find(x=>x.name==="url"),g=i.find(x=>x.name==="interval");a.push({from:u,to:d.to,block:d,tag:d.name,host:v?re(se(v.value)):null,interval:g?is(se(g.value)):null,fields:i,parts:null});continue}const p=n[o+1];p&&e.slice(p.from,p.to)===":"&&!e.slice(p.to).startsWith("//")&&(o+=2);const m=n[o];if(!m||m.from>=l.close)break;if(m.kind!=="quoted")for(;n[o+1]?.from===n[o].to&&!/[(){}]/.test(e.slice(n[o+1].from,n[o+1].to));)o++;if(e[n[o+1]?.from]==="(")for(o++;n[o+1]&&!(e[n[o].from]===")"&&n[o].parens===1);)o++;let h=n[o].to,k;n[o+1]?.kind==="comment"&&n[o+1].line===n[o].line&&(k=e.slice(n[o+1].from,n[o+1].to),h=n[++o].to);const b=ls(e.slice(u,h));b&&a.push({from:u,to:h,tag:b.tag,host:re(b.url),interval:null,fields:[],parts:b,comment:k})}return a}function ds(e){return Oe(e).map(({tag:s,host:n,interval:a})=>({tag:s,host:n,interval:a}))}function cs(e,s,n){const a=Oe(e).find(u=>u.tag===s);if(!a||a.interval===n)return e;const l=e.slice(a.from,a.to).match(/^[ \t]*/)?.[0]??" ",o=l+(l.includes(" ")?" ":" ");if(a.parts){const u=[`${l}${cn(s)}: {`,`${o}url: ${ke(a.parts.url)}`];return a.parts.ua!==null&&u.push(`${o}ua: ${ke(a.parts.ua)}`),u.push(`${o}interval: '${n}s'`,`${l}}${a.comment?" "+a.comment:""}`),e.slice(0,a.from)+u.join(`
`)+e.slice(a.to)}const c=a.fields.find(u=>u.name==="interval");if(c)return e.slice(0,c.valueFrom)+` '${n}s'`+e.slice(c.valueTo);if(!a.block)return e;const r=e.lastIndexOf(`
`,a.block.close-1)+1;return e.slice(0,r)+`${o}interval: '${n}s'
`+e.slice(r)}function us(e,s,n,a){const l=ve(e),o=l?.state==="healthy"&&l.latency_ms!=null;return{id:e.id,name:e.name,protocol:e.protocol??"—",latency:o?H(l.latency_ms,a):l?.state==="unavailable"?a("ui.unavailable"):"—",latencyClass:o?`ms ${Le(l.latency_ms)}`:l?.state==="unavailable"?"ms err":"ms",groups:e.group_ids.length?De(n,e.group_ids.map(c=>s.get(c)??c)):"—",probeLabel:a("nodes.probe",{name:e.name}),joinLabel:a("nodes.joinGroup",{name:e.name}),removeLabel:a("nodes.remove",{name:e.name})}}const ms=e=>gn(ve(e));function ps(e,s,n,a){const l=new Map;for(const i of s){if(!i.provider_id||!i.subscription_tag)continue;const v=l.get(i.provider_id)??new Set;v.add(i.subscription_tag),l.set(i.provider_id,v)}const o=i=>{const v=l.get(i);return v?.size===1?[...v][0]:void 0},c=i=>{const v=re(i.url_redacted),g=v?n.filter(x=>x.host===v):[];return g.length===1?g[0].tag:void 0},r=new Map,u=e.filter(i=>i.kind==="subscription");for(const i of u){const v=o(i.id)??c(i);v&&r.set(i.id,v)}const d=u.filter(i=>!r.has(i.id)),p=new Set(r.values()),m=n.filter(i=>!p.has(i.tag));d.length===1&&m.length===1&&r.set(d[0].id,m[0].tag);const h=e.map(i=>{const v=o(i.id);return{...i,displayName:r.get(i.id)??i.name,configTag:i.kind==="subscription"&&v&&n.filter(g=>g.tag===v).length===1?v:void 0}}),k={builtin:0,unattributed:0};for(const i of s)i.provider_id==null&&k[Ae(i)]++;const b=[];for(const i of["builtin","unattributed"]){const v=k[i];v&&b.push({id:mn(i,e),name:a(i==="builtin"?"nodes.kind.builtin":"nodes.kind.unattributed"),kind:i,url_redacted:null,node_count:v,updated_at:null,expires_at:null,traffic:null,status:"ok",last_error:null})}return{list:[...b,...h]}}function bs(e,s){return s!==null&&e.some(n=>n.id===s)?s:(e.find(n=>n.kind!=="builtin"&&n.kind!=="unattributed")??e[0])?.id??null}function vs(e,s,n){return e.filter(a=>s===void 0||(s===null?a.provider_id==null&&Ae(a)==="builtin"==(n==="builtin"):a.provider_id===s))}function hs(e,s,n,a,l,o){const c=s.trim(),r=e.filter(m=>(!c||o(m.name,c))&&(!n||m.group_ids.includes(n))&&(!a||m.protocol===a)),u=l.direction==="ascending"?1:-1,d=l.column==="latency"?new Map(r.map(m=>[m.id,ms(m)])):new Map,p={name:(m,h)=>q(m.name,h.name),protocol:(m,h)=>q(m.protocol??"",h.protocol??""),latency:(m,h)=>xn(d.get(m.id),d.get(h.id))||q(m.name,h.name)};return r.sort((m,h)=>u*(p[l.column]??p.name)(m,h))}const be=[3600,21600,43200,86400];function xe(e,s,n){return e===0?n("nodes.manualOnly"):be.includes(e)?n("nodes.everyHours",{n:e/3600}):pn(String(e),s)}function He(e,s,n){return[0,...be,...e===null||e===0||be.includes(e)?[]:[e]].map(a=>({id:String(a),label:xe(a,s,n)}))}function fs(e,s){const n={name:e.name.trim(),kind:"subscription",url:e.value.trim()},a=Number(e.interval);s?.update_interval!==void 0&&e.interval&&a!==s.update_interval&&(n.update_interval=a);const l=e.agent.trim();return s?.user_agent!==void 0&&l&&l!==s.user_agent&&(n.user_agent=l),s?.cache!==void 0&&e.cache!==null&&e.cache!==s.cache&&(n.cache=e.cache),n}function gs(e,s,n,a){const l={subscription:"nodes.kind.subscription",file:"nodes.kind.file",inline:"nodes.kind.inline",builtin:"nodes.kind.builtin",unattributed:"nodes.kind.unattributed"},o={ok:"nodes.status.ok",stale:"nodes.status.stale",error:"nodes.status.error"},c={ok:"ok",stale:"warn",error:"err"},r=e.kind==="builtin"||e.kind==="unattributed",u=e.traffic?bn(e.traffic.upload_bytes,e.traffic.download_bytes):null,d=e.kind==="subscription"?s:void 0,p=e.displayName??e.name;return{id:e.id,name:p,url:e.url_redacted??void 0,kind:Ne(l,e.kind,a),count:ae(e.node_count,n),usage:u===null?"—":e.traffic?.total_bytes?a("ui.fraction",{part:ce(u,n),whole:ce(e.traffic.total_bytes,n)}):ce(u,n),updatedAt:r?null:e.updated_at,expires:e.expires_at?fn(e.expires_at,n):"—",interval:d==null?"—":xe(d,n,a),intervalValue:d==null?"":String(d),hasInterval:d!==void 0,intervalLabel:a("nodes.intervalOf",{name:p}),intervals:d===void 0?[]:He(d,n,a),status:r?null:Ne(o,e.status,a),tone:c[e.status],error:e.last_error?vn(hn(e.last_error.code,e.last_error.message,a),a):void 0,refreshLabel:a("nodes.refresh",{name:p}),removeLabel:a("nodes.remove",{name:p})}}const qe=e=>/^[a-z][a-z0-9+.-]*:\/\/\S+$/i.test(e.trim());function xs(e,s,n,a){const l=s.trim();return e!=="provider"&&e!=="node"||!l&&!n.trim()?null:l?e==="node"?qe(n)?null:a("nodes.linkInvalid"):Fe(l)?Ie(n)?null:a("nodes.urlInvalid"):a("nodes.nameInvalid"):a("nodes.nameMissing")}function js(e){const s=V(),n=he[ie()],{refresh:a}=e,l=new Map(e.entries.map(c=>[c.tag,c.interval]));return{rows:e.rows.map(c=>({...gs(c,c.configTag?l.get(c.configTag):void 0,n,s),refreshable:c.kind==="subscription"&&e.canRefresh,refreshing:a.busy===c.id,refreshDisabled:!!a.busy,refresh:()=>void a.refresh(c.id).then(r=>{r&&("degraded"in r?C("info",s("nodes.refreshedDegraded",{name:c.name})):C("positive",s("nodes.refreshed",{name:c.name,n:ae(r.node_count,n)})))},r=>fe(r,s,s("nodes.refreshFailed",{name:c.name}))),removable:e.canManage&&(c.kind==="subscription"||c.kind==="file"),remove:()=>{(c.kind= Line truncated
@@ -1 +0,0 @@
import{r as E,j as t}from"./vendor-react-Bf71BWbF.js";import{ad as W,ae as C,af as H,ag as m,ah as N,W as g,ai as M,aj as $,V as P,ak as q,al as I,am as K,u as B,X as U,_ as z,$ as G,an as J,a1 as S,ao as Q,ap as X,aq as Y,ar as Z,as as ee,E as y,at as x,au as j,av as F,aw as ae,ax as w,ay as te,a8 as _,az as re,aA as se,b as D}from"./index-zQjLFfuj.js";import{d as oe,e as ne}from"./files-BxEOxSF8.js";import{D as ie,t as O}from"./Table-DLlwyNFJ.js";import{A as ce}from"./ActionGroup-C-LVMOvQ.js";import"./useGridSelectionCheckbox-BK6qtlfZ.js";import"./Virtualizer-CTh266-x.js";import"./ListLayout-DU_9AgrU.js";const T={ebpf:"ov.v.ebpf",userspace:"ov.v.userspace",mock:"ov.v.mock",active:"ov.v.active",degraded:"ov.v.degraded",detached:"ov.v.detached",failed:"ov.v.failed",disabled:"ov.v.disabled",full:"ov.v.full",partial:"ov.v.partial",none:"ov.v.none",real:"ov.v.real",loaded:"ov.v.loaded",not_loaded:"ov.v.notLoaded",attached:"ov.v.attached",partially_attached:"ov.v.partiallyAttached",published:"ov.v.published",not_published:"ov.v.notPublished",healthy:"ov.v.healthy",ready:"ov.v.ready",error:"ov.v.error",unknown:"ov.v.unknown",ingress:"ov.v.ingress",egress:"ov.v.egress"};function R(s,e){return T[s]?e(T[s]):s}function le(s,e,a,r){const i=s.ebpf,o=i?.maps?.conn_state,n=l=>R(l,a);return[[a("ov.f.kind"),n(s.kind)],[a("ov.f.state"),n(s.state)],[a("ov.f.visibility"),n(s.visibility)],...i?[[a("ov.f.backend"),n(i.backend)],[a("ov.f.programs"),n(i.programs)],[a("ov.f.hooks"),n(i.hooks)],[a("ov.f.routing"),n(i.routing.state)],[a("ov.f.health"),n(i.health)],[a("ov.f.maps"),n(i.maps?.state??"unknown")],[a("ov.f.connState"),o?.occupancy_known&&o.occupancy!==null?a("ui.fraction",{part:g(o.occupancy,r),whole:g(o.capacity,r)}):e]]:[]]}const de={service:"ov.v.cgroupService",shared:"ov.v.cgroupShared",unknown:"ui.unknown"};function ue(s,e,a,r=[]){const i=n=>{const l=I(n??null);return l===null?"—":g(l,a)};return[["ov.f.rss",m(s.process?.rss_bytes??null,a)],["ov.f.cgroupCurrent",m(s.cgroup?.current_bytes??null,a)],["ov.f.cgroupLimit",m(s.cgroup?.limit_bytes??null,a)],["ov.f.cgroupScope",s.cgroup?e(de[s.cgroup.scope]):"—"],["ov.f.oomHigh",i(s.cgroup?.events?.high)],["ov.f.oom",i(s.cgroup?.events?.oom)],["ov.f.oomKill",i(s.cgroup?.events?.oom_kill)],["ov.f.ebpfBytes",m(s.kernel?.ebpf_bytes??null,a)]].filter(([n])=>!r.includes(n)).map(([n,l])=>[e(n),l])}const V={connections:"nav.connections",flows:"rule.flows",routing_trace:"ov.r.routingTrace",dns_query:"ov.r.dnsQuery",dns_cache:"ov.r.dnsCache",events:"nav.events",probes:"ov.r.probes",traffic_history:"ov.r.trafficHistory",memory_history:"ov.r.memoryHistory",runtime_outbounds:"ov.r.outbounds",logs:"nav.logs",providers:"nodes.providers",config:"nav.config",runtime_settings:"settings.runtime",geodata:"settings.geodata"};function pe(s,e,a,r){const{capabilities:i,runtime:o,version:n,memory:l,datapath:d}=s,f=o?.lifecycle.state,v=o?.generation.config_revision??o?.generation.active_id??"—",u=o?.last_reload,k=o?.process.cpu_percent,h=W(l?.cgroup?.current_bytes??null,l?.cgroup?.limit_bytes??null),A=c=>c===null?"—":g(c,a),b=(c,p)=>c?"ready":p?"loading":"unavailable";return{status:{tone:q(f),text:f?P(K,f,r):r(e.capabilities||e.runtime?"ov.loading":"ov.unknown")},strip:[[r("ov.config"),M(v),v],[r("ov.uptime"),$(o?.lifecycle.uptime_seconds??null,a)],[r("ov.cpu"),k==null?"—":r("ui.percent",{n:g(k,a,1)})],[r("ov.lastReload"),u?N(u.finished_at,a):"—"]],reload:u?{tooltip:u.operation_id,tone:u.status==="succeeded"?"ok":u.status==="failed"?"err":"warn",text:r(u.status==="succeeded"?"ov.succeeded":u.status==="failed"?"ov.failed":"ov.running")}:null,engine:{state:b(!!n,e.version),fields:n?[[r("ov.f.engine"),n.engine.name+" "+n.engine.version],[r("ov.f.api"),r("ui.apiVersion",{name:n.api.name,major:n.api.major,status:n.api.status})],[r("ov.f.build"),[n.build?.revision,n.build?.target].filter(Boolean).join(r("ui.separator"))||"—"],[r("ov.f.instance"),o?.instance_id??"—"],[r("ov.f.started"),N(o?.lifecycle.started_at??null,a)],[r("ov.f.activated"),N(o?.generation.activated_at??null,a)]]:[],profiles:i?.profiles.map(c=>({id:c,text:r(c==="base"?"ov.profileBase":"ov.profileFull")}))??[]},counters:{state:b(!!o,e.capabilities||e.runtime),fields:o?[[r("ov.f.tcp"),A(o.traffic.connections.tcp)],[r("ov.f.udp"),A(o.traffic.connections.udp)],[r("ov.f.total"),A(o.traffic.connections.total)],[r("ui.upload"),m(o.traffic.bytes.upload,a)],[r("ui.download"),m(o.traffic.bytes.download,a)],[r("ov.f.rateWindow"),o.traffic.rates?r("ui.seconds",{n:g(o.traffic.rates.window_seconds,a,1)}):"—"]]:[],since:o?r("ov.countersSince",{t:N(o.traffic.counter_since,a),scope:r(o.traffic.scope==="visible"?"ov.scopeVisible":"ov.scopeAll")}):""},memory:{state:b(!!l,e.capabilities||e.memory),fields:l?ue(l,r,a,h===null?[]:["ov.f.cgroupCurrent","ov.f.cgroupLimit"]):[],bar:h===null?null:{label:r("ov.f.cgroupPercent"),value:r("ui.fraction",{part:m(l?.cgroup?.current_bytes??null,a),whole:m(l?.cgroup?.limit_bytes??null,a)}),pct:h,tone:H(h)Line truncated
@@ -0,0 +1 @@
import{r as S,j as a}from"./vendor-react-Bf71BWbF.js";import{ak as T,al as R,am as U,an as K,ao as $,ap as h,aq as B,a1 as b,ar as G,as as J,at as q,au as z,u as W,a as Q,a5 as X,av as Y,a7 as A,aw as Z,ax as ee,ay as ae,az as te,aA as se,a2 as re,aB as oe,aC as _,E as L,L as M,aD as N,aE as C,aF as ie,aG as y,aH as ne,af as H,aI as le,aJ as ce,j as O,aK as de,B as pe,aL as ue}from"./index-CXHBmSa5.js";import{d as ve,e as me}from"./files-BxEOxSF8.js";import{D as he,t as I}from"./Table-D0NFHHNQ.js";import{A as fe}from"./ActionGroup-90AzAQje.js";import{D as xe}from"./DaeCode-STEiRZuV.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";const V={ebpf:"ov.v.ebpf",userspace:"ov.v.userspace",mock:"ov.v.mock",active:"ov.v.active",degraded:"ov.v.degraded",detached:"ov.v.detached",failed:"ov.v.failed",disabled:"ov.v.disabled",full:"ov.v.full",partial:"ov.v.partial",none:"ov.v.none",real:"ov.v.real",loaded:"ov.v.loaded",not_loaded:"ov.v.notLoaded",attached:"ov.v.attached",partially_attached:"ov.v.partiallyAttached",published:"ov.v.published",not_published:"ov.v.notPublished",healthy:"ov.v.healthy",ready:"ov.v.ready",error:"ov.v.error",unknown:"ov.v.unknown",ingress:"ov.v.ingress",egress:"ov.v.egress"};function E(o,s){return V[o]?s(V[o]):o}function ge(o,s,e){if(o==="degraded")return{title:e("ov.v.degraded"),text:e(s?"ov.degradedHelp.runtime":"ov.degradedHelp.datapath")};if(o==="unknown")return{title:e("ov.v.unknown"),text:e("ov.unknownHelp")}}function be(o,s,e,t,r=!1){const i=o.ebpf,l=i?.maps?.conn_state,n=(c,p)=>{const f=ge(p,r,e);return f?{label:e(c),value:E(p,e),help:f}:[e(c),E(p,e)]};return[n("ov.f.kind",o.kind),n("ov.f.state",o.state),n("ov.f.visibility",o.visibility),...i?[n("ov.f.backend",i.backend),n("ov.f.programs",i.programs),n("ov.f.hooks",i.hooks),n("ov.f.routing",i.routing.state),n("ov.f.health",i.health),n("ov.f.maps",i.maps?.state??"unknown"),[e("ov.f.connState"),l?.occupancy_known&&l.occupancy!==null?e("ui.fraction",{part:b(l.occupancy,t),whole:b(l.capacity,t)}):l?e("ov.occupancyUnknown",{capacity:b(l.capacity,t)}):s]]:[]]}const je={service:"ov.v.cgroupService",shared:"ov.v.cgroupShared",unknown:"ui.unknown"},ye={service:"ov.cgroupHelp.service",shared:"ov.cgroupHelp.shared",unknown:"ov.cgroupHelp.unknown"};function we(o,s,e,t=[]){const r=n=>{const c=z(n??null);return c===null?"—":b(c,e)},i=[["ov.f.rss",h(o.process?.rss_bytes??null,e)],["ov.f.cgroupCurrent",h(o.cgroup?.current_bytes??null,e)],["ov.f.cgroupLimit",h(o.cgroup?.limit_bytes??null,e)],["ov.f.cgroupScope",o.cgroup?s(je[o.cgroup.scope]):"—"],["ov.f.oomHigh",r(o.cgroup?.events?.high)],["ov.f.oom",r(o.cgroup?.events?.oom)],["ov.f.oomKill",r(o.cgroup?.events?.oom_kill)],["ov.f.ebpfBytes",h(o.kernel?.ebpf_bytes??null,e)]],l=o.cgroup?.scope;return i.filter(([n])=>!t.includes(n)).map(([n,c])=>n==="ov.f.cgroupScope"&&l?{label:s(n),value:c,help:{title:s(n),text:s("ui.valuePair",{label:c,value:s(ye[l])})}}:[s(n),c])}function ke(o,s,e,t){const{capabilities:r,runtime:i,version:l,memory:n,datapath:c,limits:p=[]}=o,f=i?.lifecycle.state,j=i?.generation.config_revision??i?.generation.active_id??"—",u=i?.last_reload,w=i?.process.cpu_percent,x=T(n?.cgroup?.current_bytes??null,n?.cgroup?.limit_bytes??null),v=d=>d===null?"—":b(d,e),m=(d,g)=>d?"ready":g?"loading":"unavailable";return{status:q(f,c?.state,t(s.capabilities||s.runtime?"ov.loading":"ov.unknown"),t),strip:[{label:t("ov.config"),value:G(j),full:j,help:{title:t("ov.config"),text:t("ov.configHelp")}},[t("ov.uptime"),J(i?.lifecycle.uptime_seconds??null,e)],[t("ov.cpu"),w==null?"—":t("ui.percent",{n:b(w,e,1)})],[t("ov.lastReload"),u?B(u.finished_at,e):"—"]],reload:u?{tooltip:u.operation_id,tone:u.status==="succeeded"?"ok":u.status==="failed"?"err":"warn",text:t(u.status==="succeeded"?"ov.succeeded":u.status==="failed"?"ov.failed":"ov.running")}:null,engine:{state:m(!!l,s.version),fields:l?[[t("ov.f.engine"),l.engine.name+" "+l.engine.version],[t("ov.f.api"),t("ui.apiVersion",{name:l.api.name,major:l.api.major,status:l.api.status})],[t("ov.f.build"),[l.build?.revision,l.build?.target].filter(Boolean).join(t("ui.separator"))||"—"],[t("ov.f.instance"),i?.instance_id??"—"],[t("ov.f.started"),B(i?.lifecycle.started_at??null,e)],[t("ov.f.activated"),B(i?.generation.activated_at??null,e)]]:[],profiles:r?.profiles.map(d=>({id:d,text:t(d==="base"?"ov.profileBase":"ov.profileFull")}))??[]},counters:{state:m(!!i,s.capabilities||s.runtime),fields:i?[[t("ov.f.tcp"),v(i.traffic.connections.tcp)],[t("ov.f.udp"),v(i.traffic.connections.udp)],[t("ov.f.total"),v(i.traffic.connections.total)],[t("ui.upload"),h(i.traffic.bytes.upload,e)],[t("ui.download"),h(i.traffic.bytes.download,e)],{label:t("ov.f.rateWindow"),value:i.traffic.rates?t("ui.seconds",{n:b(i.traffic.rates.window_seconds,e,1)}):"—",help:{title:t("ov.f.rateWindow"),text:t("ov.rateWindowHelp")}}]:[],since:i?t("ov.countersSince",{t:B(i.traffic.counter_since,e),scope:t(i.traffic.scope=Line truncated
@@ -1,2 +0,0 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Arrange-C-Cvg5Lz.js","./vendor-react-Bf71BWbF.js","./index-zQjLFfuj.js","./index-CszNs-yj.css","./Virtualizer-CTh266-x.js","./ListLayout-DU_9AgrU.js","./DaeCode-B4MDdwFy.js","./policyText-IIH31itq.js","./PolicyPicker-iyQz7WhP.js","./useFilter-BYneYrGs.js","./useGridSelectionCheckbox-BK6qtlfZ.js","./Arrange-Dd3j3leY.css"])))=>i.map(i=>d[i]);
import{bp as Ye,bq as Qe,br as Je,bs as pe,bt as te,bu as we,bv as Ze,bw as et,bx as tt,by as rt,bz as De,bA as ie,bB as oe,bC as me,bD as G,bE as q,bF as X,bG as ee,bH as at,bI as ne,bJ as Ae,bK as it,bL as ot,bM as Re,bN as nt,bO as de,bP as fe,bQ as Ke,bR as ue,bS as lt,bT as xe,bU as Pe,bV as he,bW as be,bX as Fe,bY as st,bZ as ct,b_ as dt,b$ as He,c0 as ut,c1 as pt,c2 as le,c3 as ft,c4 as ht,c5 as bt,c6 as mt,c7 as gt,c8 as yt,c9 as vt,ca as xt,cb as $t,cc as kt,cd as wt,ce as Pt,a as ce,cf as It,V as St,aU as Oe,cg as Dt,aI as Et,y as Mt,ch as jt,aE as Ct,W as Nt,u as V,X as Tt,_ as _t,a8 as $e,ci as Lt,cj as ge,bd as ye,T as Ie,b9 as zt,ck as At,cl as Be,M as Ve,I as Rt,B as A,a7 as Kt,aV as Ft,$ as Ht,a3 as Ot,a1 as Ee,a2 as Bt,cm as Vt,cn as Gt,z as Ut,b4 as Wt,b5 as qt,bi as Xt,co as Ge,G as Yt,b0 as U,cp as Qt,cq as Jt,cr as Zt,E as Ue,b as Me,cs as er,bc as tr,ax as rr,ct as ar,cu as ir,ay as or,at as se,bo as nr,cv as lr,au as sr,aS as cr}from"./index-zQjLFfuj.js";import{r as b,$ as P,j as n}from"./vendor-react-Bf71BWbF.js";import{$ as dr,a as ur,b as pr,c as fr,d as hr}from"./useGridSelectionCheckbox-BK6qtlfZ.js";import{$ as br,a as B,b as ve,c as Q,d as mr}from"./Virtualizer-CTh266-x.js";import{$ as gr}from"./useFilter-BYneYrGs.js";import{g as yr,a as vr}from"./policyText-IIH31itq.js";import{P as xr}from"./PolicyPicker-iyQz7WhP.js";const Se=new WeakMap;function ke(a,t){let{id:e}=Se.get(a)??{};if(!e)throw new Error("Unknown list");return`${e}-${$r(t)}`}function $r(a){return typeof a=="string"?a.replace(/\s*/g,""):""+a}function kr(a,t,e){let{isVirtualized:r,keyboardDelegate:i,layoutDelegate:l,onAction:s,disallowTypeAhead:d,linkBehavior:o="action",keyboardNavigationBehavior:c="arrow",escapeKeyBehavior:p="clearSelection",shouldSelectOnPressUp:m}=a;!a["aria-label"]&&!a["aria-labelledby"]&&console.warn("An aria-label or aria-labelledby prop is required for accessibility.");let{listProps:v}=Ye({selectionManager:t.selectionManager,collection:t.collection,disabledKeys:t.disabledKeys,ref:e,keyboardDelegate:i,layoutDelegate:l,isVirtualized:r,selectOnFocus:t.selectionManager.selectionBehavior==="replace",shouldFocusWrap:a.shouldFocusWrap,linkBehavior:o,disallowTypeAhead:d,autoFocus:a.autoFocus,escapeKeyBehavior:p,UNSTABLE_focusOnEntry:a.UNSTABLE_focusOnEntry}),h=Qe(a.id);Se.set(t,{id:h,onAction:s,linkBehavior:o,keyboardNavigationBehavior:c,shouldSelectOnPressUp:m});let f=dr({selectionManager:t.selectionManager,hasItemActions:!!s}),x=Je(e,{isDisabled:t.collection.size!==0}),g=pe(a,{labelable:!0}),k=te(g,{role:"grid",id:h,"aria-multiselectable":t.selectionManager.selectionMode==="multiple"?"true":void 0},t.collection.size===0?{tabIndex:x?-1:0}:v,f);return r&&(k["aria-rowcount"]=t.collection.size,k["aria-colcount"]=1),ur({},t),{gridProps:k}}const je={expand:{ltr:"ArrowRight",rtl:"ArrowLeft"},collapse:{ltr:"ArrowLeft",rtl:"ArrowRight"}};function wr(a,t,e){let{node:r,isVirtualized:i,focusMode:l="row",allowsArrowNavigation:s}=a,{direction:d}=we(),{onAction:o,linkBehavior:c,keyboardNavigationBehavior:p,shouldSelectOnPressUp:m}=Se.get(t),v=Ze(),h=b.useRef(null),f=()=>{if(e.current!==null){if(l==="child"){if(De(e.current)&&e.current!==ie(oe(e.current)))return;let I=me(e.current,{tabbable:!0}).firstChild();if(I){G(I),q(I,{containingElement:X(I)});return}}(h.current!=null&&r.key!==h.current||!De(e.current))&&G(e.current)}},x={},g=a.hasChildItems,k=t.selectionManager.isLink(r.key);if(r!=null&&"expandedKeys"in t){let u=t.collection.getChildren?.(r.key);g=g||[...u??[]].length>1,o==null&&!k&&t.selectionManager.selectionMode==="none"&&g&&(o=()=>t.toggleKey(r.key));let I=g?t.expandedKeys.has(r.key):void 0,w=1,D=r.index;if(r.level>=0&&r?.parentKey!=null){let E=t.collection.getItem(r.parentKey);if(E){let R=Pr(E,t.collection);w=[...R].filter(K=>K.type==="item").length,D>0&&R[0].type!=="item"&&(D-=1)}}else w=[...t.collection].filter(E=>E.level===0&&E.type==="item").length;x={"aria-expanded":I,"aria-level":r.level+1,"aria-posinset":D+1,"aria-setsize":w}}let{itemProps:j,...T}=et({selectionManager:t.selectionManager,key:r.key,ref:e,isVirtualized:i,shouldSelectOnPressUp:a.shouldSelectOnPressUp||m,onAction:o||r.props?.onAction?tt(r.props?.onAction,o?()=>o(r.key):void 0):void 0,focus:f,linkBehavior:c}),N=u=>{let I=ie(oe(e.current));if(!ne(u.currentTarget,ee(u))||!e.current||!I)return;let w=me(e.current);if(w.currentNode=I,!Ce(u,t,r,g,d,I,e.current,s))switch(u.key){case"ArrowLeft":if(p==="arrow"){let D=d==="rtl"?w.nextNode():w.previousNode();if(D)u.preventDefault(),u.stopPropagation(),G(D),q(D,{containingElement:X(e.current)});else if(u.preventDefault(),u.stopPropagation(),d==="rtl")G(e.current),q(e.current,{containingElement:X(e.current)});else{w.currentNode=e.current;let E=Ne(w);E&&(G(E),q(E,{containingElement:X(e.current)}))}}break;case"ArrowRight":if(p==="arrow"){let D=d==="rtl"?w.previousNode():w.nextNode();if(D)u.preventDefault(),u.stopPropagation(),G(D),q(D,{containingElement:X(e.current)});else if(u.preventDefault(),u.stopLine truncated
@@ -0,0 +1,2 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Arrange-Aggv2ZKG.js","./vendor-react-Bf71BWbF.js","./index-CXHBmSa5.js","./index-BMPxGQXj.css","./Virtualizer--Vfl8O3n.js","./ListLayout-CPapuywx.js","./DaeCode-STEiRZuV.js","./policyText-CAFy3qpo.js","./PolicyPicker-DSSmYroN.js","./useFilter-DZ8TXqn_.js","./useGridSelectionCheckbox-BV96yL-N.js","./Arrange-Dd3j3leY.css"])))=>i.map(i=>d[i]);
import{bA as Je,bB as Qe,bC as Ze,bD as pe,bE as re,bF as we,bG as et,bH as tt,bI as rt,bJ as at,bK as De,bL as oe,bM as ne,bN as me,bO as V,bP as q,bQ as Y,bR as ee,bS as it,bT as le,bU as Ae,bV as ot,bW as nt,bX as Re,bY as lt,bZ as de,b_ as fe,b$ as Ke,c0 as ue,c1 as st,c2 as xe,c3 as Pe,c4 as he,c5 as be,c6 as He,c7 as ct,c8 as dt,c9 as ut,ca as Fe,cb as pt,cc as ft,cd as se,ce as ht,cf as bt,cg as mt,ch as gt,ci as yt,cj as vt,ck as xt,cl as $t,cm as kt,cn as wt,co as Pt,cp as St,b as te,cq as It,a0 as Dt,b3 as Oe,cr as Et,aT as Mt,H as jt,cs as Ct,aP as Nt,a1 as Tt,u as G,a2 as _t,a as Lt,af as $e,ct as zt,cu as ge,c as ye,T as Se,bj as At,cv as Rt,cw as Be,ac as Ge,I as Kt,B as A,ae as Ht,b4 as Ft,a5 as Ot,a9 as Bt,a7 as Ee,a8 as Gt,cx as Vt,cy as Ut,J as Wt,be as qt,bf as Yt,bs as Xt,cz as Ve,cA as Ue,O as Jt,bb as U,cB as Qt,cC as Zt,cD as er,E as We,j as Me,cE as tr,bn as rr,aG as ar,cF as ir,_ as or,bx as nr,aH as lr,aC as ce,bm as sr,bz as cr,cG as dr,aD as ur,b1 as pr}from"./index-CXHBmSa5.js";import{r as m,$ as P,j as n}from"./vendor-react-Bf71BWbF.js";import{$ as fr,a as hr,b as br,c as mr,d as gr}from"./useGridSelectionCheckbox-BV96yL-N.js";import{$ as yr,a as B,b as ve,c as J,d as vr}from"./Virtualizer--Vfl8O3n.js";import{$ as xr}from"./useFilter-DZ8TXqn_.js";import{g as $r,a as kr}from"./policyText-CAFy3qpo.js";import{P as wr}from"./PolicyPicker-DSSmYroN.js";const Ie=new WeakMap;function ke(a,t){let{id:e}=Ie.get(a)??{};if(!e)throw new Error("Unknown list");return`${e}-${Pr(t)}`}function Pr(a){return typeof a=="string"?a.replace(/\s*/g,""):""+a}function Sr(a,t,e){let{isVirtualized:r,keyboardDelegate:i,layoutDelegate:l,onAction:s,disallowTypeAhead:c,linkBehavior:o="action",keyboardNavigationBehavior:d="arrow",escapeKeyBehavior:f="clearSelection",shouldSelectOnPressUp:b}=a;!a["aria-label"]&&!a["aria-labelledby"]&&console.warn("An aria-label or aria-labelledby prop is required for accessibility.");let{listProps:v}=Je({selectionManager:t.selectionManager,collection:t.collection,disabledKeys:t.disabledKeys,ref:e,keyboardDelegate:i,layoutDelegate:l,isVirtualized:r,selectOnFocus:t.selectionManager.selectionBehavior==="replace",shouldFocusWrap:a.shouldFocusWrap,linkBehavior:o,disallowTypeAhead:c,autoFocus:a.autoFocus,escapeKeyBehavior:f,UNSTABLE_focusOnEntry:a.UNSTABLE_focusOnEntry}),h=Qe(a.id);Ie.set(t,{id:h,onAction:s,linkBehavior:o,keyboardNavigationBehavior:d,shouldSelectOnPressUp:b});let u=fr({selectionManager:t.selectionManager,hasItemActions:!!s}),x=Ze(e,{isDisabled:t.collection.size!==0}),g=pe(a,{labelable:!0}),k=re(g,{role:"grid",id:h,"aria-multiselectable":t.selectionManager.selectionMode==="multiple"?"true":void 0},t.collection.size===0?{tabIndex:x?-1:0}:v,u);return r&&(k["aria-rowcount"]=t.collection.size,k["aria-colcount"]=1),hr({},t),{gridProps:k}}const je={expand:{ltr:"ArrowRight",rtl:"ArrowLeft"},collapse:{ltr:"ArrowLeft",rtl:"ArrowRight"}};function Ir(a,t,e){let{node:r,isVirtualized:i,focusMode:l="row",allowsArrowNavigation:s}=a,{direction:c}=we(),{onAction:o,linkBehavior:d,keyboardNavigationBehavior:f,shouldSelectOnPressUp:b}=Ie.get(t),v=et(),h=m.useRef(null),u=()=>{if(e.current!==null){if(l==="child"){if(De(e.current)&&e.current!==oe(ne(e.current)))return;let S=me(e.current,{tabbable:!0}).firstChild();if(S){V(S),q(S,{containingElement:Y(S)});return}}(h.current!=null&&r.key!==h.current||!De(e.current))&&V(e.current)}},x={},g=a.hasChildItems,k=t.selectionManager.isLink(r.key);if(r!=null&&"expandedKeys"in t){let p=t.collection.getChildren?.(r.key);g=g||[...p??[]].length>1,o==null&&!k&&t.selectionManager.selectionMode==="none"&&g&&(o=()=>t.toggleKey(r.key));let S=g?t.expandedKeys.has(r.key):void 0,w=1,D=r.index;if(r.level>=0&&r?.parentKey!=null){let E=t.collection.getItem(r.parentKey);if(E){let R=Dr(E,t.collection);w=[...R].filter(K=>K.type==="item").length,D>0&&R[0].type!=="item"&&(D-=1)}}else w=[...t.collection].filter(E=>E.level===0&&E.type==="item").length;x={"aria-expanded":S,"aria-level":r.level+1,"aria-posinset":D+1,"aria-setsize":w}}let{itemProps:j,...T}=tt({selectionManager:t.selectionManager,key:r.key,ref:e,isVirtualized:i,shouldSelectOnPressUp:a.shouldSelectOnPressUp||b,onAction:o||r.props?.onAction?rt(r.props?.onAction,o?()=>o(r.key):void 0):void 0,focus:u,linkBehavior:d}),N=p=>{let S=oe(ne(e.current));if(!le(p.currentTarget,ee(p))||!e.current||!S)return;let w=me(e.current);if(w.currentNode=S,!Ce(p,t,r,g,c,S,e.current,s))switch(p.key){case"ArrowLeft":if(f==="arrow"){let D=c==="rtl"?w.nextNode():w.previousNode();if(D)p.preventDefault(),p.stopPropagation(),V(D),q(D,{containingElement:Y(e.current)});else if(p.preventDefault(),p.stopPropagation(),c==="rtl")V(e.current),q(e.current,{containingElement:Y(e.current)});else{w.currentNode=e.current;let E=Ne(w);E&&(V(E),q(E,{containingElement:Y(e.current)}))}}break;case"ArrowRight":if(f==="arrow"){let D=c==="rtl"?w.previousNode():w.nextNode();if(D)p.preventDefault(),p.stopPropagation(),V(D),q(D,{containingElement:Y(e.current)});elsLine truncated
@@ -0,0 +1 @@
import{j as i}from"./vendor-react-Bf71BWbF.js";import{u as a,b2 as l}from"./index-CXHBmSa5.js";import{c as m}from"./policyText-CAFy3qpo.js";function f({value:o,onChange:s,isDisabled:t}){const e=a(),{selected:r,items:c}=m(o,e);return i.jsx(l,{label:e("arrange.policy"),value:r,onChange:s,items:c,isDisabled:t})}export{f as P};
@@ -1 +0,0 @@
import{j as c}from"./vendor-react-Bf71BWbF.js";import{u as i,aT as l}from"./index-zQjLFfuj.js";import{c as m}from"./policyText-IIH31itq.js";function f({value:o,onChange:s,isDisabled:t}){const e=i(),{selected:r,items:a}=m(o,e);return c.jsx(l,{label:e("arrange.policy"),value:r,onChange:s,items:a,isDisabled:t})}export{f as P};
@@ -1 +0,0 @@
import{r as g,j as r}from"./vendor-react-Bf71BWbF.js";import{cw as Fe,O as Je,cx as ze,cm as Xe,aU as us,aK as ie,V as J,aO as ps,aP as ms,ah as Ze,X as ce,h as fs,aF as Ne,U as se,al as bs,W as le,cg as hs,aI as Ye,b5 as gs,Q as K,aZ as xs,cy as ws,cz as ys,cA as vs,j as js,aW as es,cB as ks,u as D,_ as Me,be as _s,$ as he,a3 as Oe,a1 as P,a2 as ss,cC as Ns,bf as Ms,b0 as fe,a as Ss,N as Re,cD as ns,av as z,at as ve,a5 as Ls,cE as Cs,aX as Ts,co as Rs,cF as Ps,a$ as Is,cG as Ds,cH as Fs,cI as Os,ay as be,B as O,cJ as Es,a7 as je,ax as ke,I as Hs,E as de,cK as Ws,aS as Se,aT as ae,T as ee,cl as As,aC as Bs,ci as Vs,bd as Be,b1 as Us,b8 as $s,aR as Qs,bb as qs,b as Ee,au as _e,L as Ve,a8 as ts,b4 as Ks,bc as Gs,cv as Js,bn as zs}from"./index-zQjLFfuj.js";import{u as Le,r as Xs,a as He,b as Zs}from"./flows-Bv2rvXJX.js";import{q as Ys}from"./dns-BoPCaePc.js";import{i as Ue}from"./setup-BqwQo7FE.js";import{a as en,t as sn,b as nn,w as I,p as tn,r as rn}from"./link-CaqmdEp1.js";import{g as on}from"./policyText-IIH31itq.js";import{r as an}from"./nav-BIVfQR1w.js";import{p as ln}from"./probe-CjOLdDVD.js";import{D as Ce}from"./Table-DLlwyNFJ.js";import{D as pe}from"./DaeCode-B4MDdwFy.js";import{T as dn}from"./TimeCell-DxlzlVpw.js";import{u as cn}from"./outbounds-CM0Hhk3q.js";import"./useGridSelectionCheckbox-BK6qtlfZ.js";import"./Virtualizer-CTh266-x.js";import"./ListLayout-DU_9AgrU.js";const un=["client","rule","outbound","node"],pn=e=>new Map(e.map(s=>[s.id,s.name])),De="\0";function mn(e,s){return e.rule_id?s.get(e.rule_id)?.expression===e.rule_expression?e.rule_id:e.rule_id+De+e.rule_expression:void 0}function rs(e,s,n,i){switch(s){case"client":{const o=Je(e.input?.src??void 0);return{label:o??"unknown",unknown:!o}}case"rule":return e.rule_expression?{label:e.rule_expression,unknown:!1,key:mn(e,i)}:{label:"unknown",unknown:!0};case"outbound":return e.outbound?{label:e.outbound,unknown:!1}:{label:"unknown",unknown:!0};case"node":{if(Fe(e.outbound))return null;const o=e.chain.at(-1)??null;return o?{label:n.get(o)??o,unknown:!1,key:o}:{label:"unknown",unknown:!0}}}}const me=(e,s)=>sn(e,s.unknown?"":s.key??s.label),os=e=>en(e,un)?.kind,fn=new Map;function as(e,s,n){const i=os(s);if(!i)return[];const o=new Map(n.map(t=>[t.rule_id,t]));return e.filter(t=>{const a=rs(t,i,fn,o);return a!==null&&me(i,a)===s})}function bn(e,s,n,i){const o=e.slice(0,e.indexOf(":")),t=e.slice(e.indexOf(":")+1);return t===""?i(null):o==="rule"?t.includes(De)?t.slice(t.indexOf(De)+1):s.find(a=>a.rule_id===t)?.expression??t:o==="node"?n.get(t)??t:o==="client"?t:i(t)}function hn(e,s,n,i,o="rule"){const t=pn(n),a=new Map(s.map(f=>[f.id,f])),l=new Map(s.map(f=>[f.name,f])),d=new Map(n.map(f=>[f.id,f])),p=new Map(i.map(f=>[f.rule_id,f])),h=new Map,m=new Map,c=new Map,j=new Map,y=(f,b)=>{const M=f+">"+b;let w=j.get(M);return w||j.set(M,w={source:f,target:b,count:0}),w},S=(f,b,M=!1)=>{const w=me("node",{key:f,label:b,unknown:M});let T=c.get(w);if(!T){const U=M?void 0:d.get(f),H=U&&Xe(U);c.set(w,T={id:w,label:b,count:0,unknown:M||void 0,latency:us(H),unavailable:H?.state==="unavailable"})}return T},u=(f,b=!1)=>{const M=me("outbound",{label:f,unknown:b});let w=m.get(M);if(w)return w;const T=b?void 0:l.get(f),U=b?{groups:[],member:null}:ze(f,T?.selection.tcp_member_id?"tcp":"udp",l,a,d),H=U.groups.map(A=>({name:A.name,kind:A.policy.kind,policy:A.policy.native})),W=U.member,X=b?"unknown":f==="direct"||f==="block"?f:H.length?"group":"unknown";return w={id:M,label:f,count:0,unknown:b||void 0,kind:X,groups:H,node:W&&S(W,t.get(W)??W).id},m.set(M,w),w.node&&y(M,w.node),w},x=(f,b,M=!1)=>{let w=h.get(f);return w||h.set(f,w={id:f,label:b,count:0,unknown:M||void 0,outbound:null,must:!1,fallback:!1}),w};if(o==="rule")for(const f of i){const b=x(me("rule",{key:f.rule_id,label:f.expression}),f.expression);b.must=f.must,b.fallback=f.kind==="fallback",f.outbound&&(b.outbound=u(f.outbound).id,y(b.id,b.outbound))}const _=[o,"outbound","node"];for(const f of e){let b;for(const M of _){const w=rs(f,M,t,p);if(!w)break;const T=M==="outbound"?u(w.label,w.unknown):M==="node"?S(w.key??w.label,w.label,w.unknown):x(me(M,w),w.label,w.unknown);T.count++,b&&y(b.id,T.id).count++,b=T}}for(const f of s)u(f.name);const N=new Set([...h.values()].map(f=>f.outbound)),L=new Set([...m.values()].flatMap(f=>f.groups.slice(1).map(b=>b.name))),C=[...m.values()].filter(f=>f.count||N.has(f.id)||!L.has(f.label)),E=new Set(C.map(f=>f.id));return{by:o,leaves:[...h.values()],outbounds:C,nodes:[...c.values()],links:[...j.values()].filter(f=>E.has(f.source)||E.has(f.target))}}const $e=new WeakMap;function We(e){const s=$e.get(e);if(s)return s;const n=new Map,i=new Map,o=new Map;for(const l of e.links){for(const[d,p]of[[n,l.source],[i,l.target]]){let h=d.get(p);h||d.set(p,h=[]),h.push(l)}(!o.has(l.source)||o.get(l.source).count<l.count)&&o.set(l.source,l)}const t=new Map;for(const l of[...e.leaves,...e.outbounds]){const d=("groups"in l?l.node:l.outbound)??o.get(l.id)?.target;d&&t.set(l.id,d)}const a={Line truncated
@@ -0,0 +1 @@
import{r as g,j as r}from"./vendor-react-Bf71BWbF.js";import{cH as Fe,V as Ze,cI as Ye,cx as en,b3 as hn,aV as ie,a0 as K,aZ as gn,a_ as xn,aq as nn,a2 as ce,h as wn,aQ as Se,$ as ee,au as yn,a1 as le,cr as vn,aT as sn,bf as kn,X as G,b8 as jn,cJ as _n,cK as Nn,cL as Mn,y as Sn,b5 as tn,cM as Ln,u as E,a as Le,bo as Cn,a5 as ve,a9 as We,a7 as P,a8 as rn,cN as Rn,bp as Tn,bb as we,b as Pn,U as Pe,cO as on,aE as J,aC as je,ab as In,cP as Dn,b6 as Hn,cA as En,cQ as On,cR as Fn,ba as Wn,cS as An,cT as Vn,cU as Bn,aH as ye,B as W,cV as Un,ae as _e,bx as an,aG as Ne,I as $n,E as de,cW as Qn,b1 as Ce,b2 as ae,T as Y,cw as qn,bm as Gn,aN as Kn,ct as Jn,c as $e,f as zn,bi as Xn,b0 as Zn,bl as Yn,j as Ae,aD as Me,L as Qe,af as ln,be as es,bn as ns,cG as ss,by as ts}from"./index-CXHBmSa5.js";import{u as Re,r as rs,a as Ve,b as os}from"./flows-C0byZ3sY.js";import{q as as}from"./dns-DQrpG8y_.js";import{i as qe}from"./setup-B5f1cfyO.js";import{a as is,t as ls,b as ds,w as H,p as cs,r as us}from"./link-D6L0Eg5i.js";import{g as ps}from"./policyText-CAFy3qpo.js";import{r as ms}from"./nav-D1cfWFA0.js";import{r as fs}from"./recorder-DlDpPhd4.js";import{p as bs}from"./probe-C8ejAKwA.js";import{D as Te}from"./Table-D0NFHHNQ.js";import{D as ge}from"./DaeCode-STEiRZuV.js";import{T as hs}from"./TimeCell-gSIuLEFc.js";import{u as gs}from"./outbounds-f8QoVoCV.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";const xs=["client","rule","outbound","node"],ws=e=>new Map(e.map(n=>[n.id,n.name])),Ee="\0";function ys(e,n){return e.rule_id?n.get(e.rule_id)?.expression===e.rule_expression?e.rule_id:e.rule_id+Ee+e.rule_expression:void 0}function dn(e,n,s,a){switch(n){case"client":{const o=Ze(e.input?.src??void 0);return{label:o??"unknown",unknown:!o}}case"rule":return e.rule_expression?{label:e.rule_expression,unknown:!1,key:ys(e,a)}:{label:"unknown",unknown:!0};case"outbound":return e.outbound?{label:e.outbound,unknown:!1}:{label:"unknown",unknown:!0};case"node":{if(Fe(e.outbound))return null;const o=e.chain.at(-1)??null;return o?{label:s.get(o)??o,unknown:!1,key:o}:{label:"unknown",unknown:!0}}}}const xe=(e,n)=>ls(e,n.unknown?"":n.key??n.label),cn=e=>is(e,xs)?.kind,vs=new Map;function un(e,n,s){const a=cn(n);if(!a)return[];const o=new Map(s.map(t=>[t.rule_id,t]));return e.filter(t=>{const i=dn(t,a,vs,o);return i!==null&&xe(a,i)===n})}function ks(e,n,s,a){const o=e.slice(0,e.indexOf(":")),t=e.slice(e.indexOf(":")+1);return t===""?a(null):o==="rule"?t.includes(Ee)?t.slice(t.indexOf(Ee)+1):n.find(i=>i.rule_id===t)?.expression??t:o==="node"?s.get(t)??t:o==="client"?t:a(t)}function js(e,n,s,a,o="rule"){const t=ws(s),i=new Map(n.map(b=>[b.id,b])),l=new Map(n.map(b=>[b.name,b])),d=new Map(s.map(b=>[b.id,b])),p=new Map(a.map(b=>[b.rule_id,b])),h=new Map,m=new Map,u=new Map,f=new Map,v=(b,x)=>{const L=b+">"+x;let y=f.get(L);return y||f.set(L,y={source:b,target:x,count:0}),y},M=(b,x,L=!1)=>{const y=xe("node",{key:b,label:x,unknown:L});let R=u.get(y);if(!R){const V=L?void 0:d.get(b),B=V&&en(V);u.set(y,R={id:y,label:x,count:0,unknown:L||void 0,latency:hn(B),unavailable:B?.state==="unavailable"})}return R},c=(b,x=!1)=>{const L=xe("outbound",{label:b,unknown:x});let y=m.get(L);if(y)return y;const R=x?void 0:l.get(b),V=x?{groups:[],member:null}:Ye(b,R?.selection.tcp_member_id?"tcp":"udp",l,i,d),B=V.groups.map(I=>({name:I.name,kind:I.policy.kind,policy:I.policy.native})),U=V.member,ne=x?"unknown":b==="direct"||b==="block"?b:B.length?"group":"unknown";return y={id:L,label:b,count:0,unknown:x||void 0,kind:ne,groups:B,node:U&&M(U,t.get(U)??U).id},m.set(L,y),y.node&&v(L,y.node),y},w=(b,x,L=!1)=>{let y=h.get(b);return y||h.set(b,y={id:b,label:x,count:0,unknown:L||void 0,outbound:null,must:!1,fallback:!1}),y};if(o==="rule")for(const b of a){const x=w(xe("rule",{key:b.rule_id,label:b.expression}),b.expression);x.must=b.must,x.fallback=b.kind==="fallback",b.outbound&&(x.outbound=c(b.outbound).id,v(x.id,x.outbound))}const N=[o,"outbound","node"];for(const b of e){let x;for(const L of N){const y=dn(b,L,t,p);if(!y)break;const R=L==="outbound"?c(y.label,y.unknown):L==="node"?M(y.key??y.label,y.label,y.unknown):w(xe(L,y),y.label,y.unknown);R.count++,x&&v(x.id,R.id).count++,x=R}}for(const b of n)c(b.name);const _=new Set([...h.values()].map(b=>b.outbound)),S=new Set([...m.values()].flatMap(b=>b.groups.slice(1).map(x=>x.name))),C=[...m.values()].filter(b=>b.count||_.has(b.id)||!S.has(b.label)),A=new Set(C.map(b=>b.id));return{by:o,leaves:[...h.values()],outbounds:C,nodes:[...u.values()],links:[...f.values()].filter(b=>A.has(b.source)||A.has(b.target))}}const Ge=new WeakMap;function Be(e){const n=Ge.get(e);if(n)return n;const s=new Map,a=new Map,o=new Map;for(const l of e.links){for(const[d,p]of[[s,l.source],[a,l.target]]){let h=d.get(p);h||d.set(p,h=[]),h.push(l)}(!o.has(l.source)||o.get(l.source).count<l.count)&&o.set(l.source,l)}const t=new Map;for(const l of[...e.leaves,...e.outbounds]){const d=("grouLine truncated
@@ -1 +0,0 @@
import{r as h,j as i}from"./vendor-react-Bf71BWbF.js";import{P as L,Q as v,R as k,S as H,U as R,V as _,W as A,X as I,Y as O,Z as P,u as E,_ as Q,$ as V,a0 as B,a1 as y,a2 as D,a3 as F,a4 as z,a5 as G,M as U,a6 as W,T as X,B as w,a7 as Y,E as Z,b as J,a8 as ee,a9 as se,aa as te,ab as ae,ac as ne}from"./index-zQjLFfuj.js";import{u as re}from"./flows-Bv2rvXJX.js";import{d as oe}from"./nav--TYgv3Ng.js";import{r as ie}from"./nav-BIVfQR1w.js";import{s as de}from"./nav-BIpfWn6-.js";import{c as ce,s as ue,a as le}from"./nav-BeFLfZq8.js";const x=(t,a,e,d,r,o="")=>({hit:{id:a,label:e,description:d,route:r,query:o},keys:t.flatMap(n=>n==null?[]:[n.toLowerCase()])});function pe(t,a,e){const d=s=>O(s,t),r=t?.resources,o=a?.sources.find(s=>s.kind==="main"),n=[...ie(r).map(s=>({path:"rules",params:{tab:s.id},titleKey:s.titleKey})),...oe(r).map(s=>({path:"dns",params:{tab:s.id},titleKey:s.titleKey})),...ce(ue(r,o)).map(s=>({path:"config",params:{tab:s.id},titleKey:s.titleKey})),...de(r).map(s=>({path:"settings",params:{card:s.id},titleKey:s.titleKey}))];return[...L.filter(s=>s.nav&&d(s.path)).map(s=>({route:s.path,query:"",title:e(s.nav.titleKey),parent:""})),...n.filter(s=>d(s.path)).map(s=>({route:s.path,query:v("",s.params),title:e(s.titleKey),parent:e(L.find(u=>u.path===s.path).nav.titleKey)}))].map(s=>x([s.title,s.parent&&s.parent+" "+s.title],`page:${s.route}?${s.query}`,s.title,s.parent||void 0,s.route,s.query))}function me(t,a){return k(t).map(e=>x([e.domain,e.dst,e.src],`connection:${e.id}`,e.domain||e.dst||e.src||e.id,H(e,a),"connections",v("",{id:e.id})))}function he(t,a,e){const d=a?.providers??[],r=o=>v("",{provider:P(o,d),q:o.name});return(t??[]).map(o=>x([o.name],`node:${o.id}`,o.name,R(e,o.group_ids)||void 0,"nodes",r(o)))}function fe(t){return(t??[]).map(a=>x([a.name],`group:${a.id}`,a.name,a.policy.native,"policies",v("",{group:a.id})))}function ge(t,a){return(t?.providers??[]).map(e=>x([e.name],`provider:${e.id}`,e.name,a("search.nodeCount",{n:e.node_count}),"nodes",v("",{provider:e.id})))}function be(t,a){return(t?.sources??[]).map(e=>x([e.path],`source:${e.id}`,e.path,_(le,e.kind,a),"config",v("",{tab:"source",source:e.id})))}function ve(t,a){return(t?.rules??[]).filter(e=>e.kind==="rule").map(e=>x([e.expression,e.outbound],`rule:${e.rule_id}`,e.expression,`#${A(e.index+1,I[a])} → ${e.outbound}`,"rules",v("",{tab:"list",rule:e.rule_id})))}function xe(t,a,e){return{sections:[{id:"pages",title:e("search.pages"),entries:t.pages},{id:"conns",title:e("nav.connections"),entries:t.conns},{id:"nodes",title:e("search.nodes"),entries:t.nodes},{id:"groups",title:e("search.groups"),entries:t.groups},{id:"providers",title:e("search.providers"),entries:t.providers},{id:"sources",title:e("search.sources"),entries:t.sources},{id:"rules",title:e("nav.rules"),entries:t.rules}],partial:a?.truncated?e("conn.truncated"):null}}function ye(t,a){const e=t.trim().toLowerCase(),d=e?8:5,r=new Map;return{sections:a.sections.map(n=>{const c=[];for(const{hit:s,keys:u}of n.entries){if(c.length===d)break;u.some(f=>f.includes(e))&&(c.push(s),r.set(s.id,s))}return{id:n.id,title:n.title,items:c}}).filter(n=>n.items.length>0),byId:r,partial:a.partial}}function $e(t,a){const e=E(),d=Q(),[r,o]=h.useState(""),n=V(),c=n.data?.resources,s=B(void 0,y(c,"connections",{whileLoading:!1})),u=D(y(c,"nodes",{whileLoading:!1})),f=F(y(c,"groups",{whileLoading:!1})),g=z(y(c,"providers",{whileLoading:!1})),b=G(y(c,"config",{whileLoading:!1})),l=re(y(c,"rules",{whileLoading:!1})),p=[n,s,u,f,g,b,l],K=h.useMemo(()=>pe(n.data,b.data,e),[n.data,b.data,e]),M=h.useMemo(()=>me(s.data,e),[s.data,e]),C=h.useMemo(()=>he(u.data,g.data,d),[u.data,g.data,d]),q=h.useMemo(()=>fe(f.data),[f.data]),N=h.useMemo(()=>ge(g.data,e),[g.data,e]),T=h.useMemo(()=>be(b.data,e),[b.data,e]),S=h.useMemo(()=>ve(l.data,d),[l.data,d]),$=ye(r,xe({pages:K,conns:M,nodes:C,groups:q,providers:N,sources:T,rules:S},s.data,e));return{q:r,setQ:o,sections:$.sections,partial:$.partial,openConnections:()=>{t("connections"),a()},empty:$.byId.size===0,error:p.find(m=>m.error)?.error,retry:()=>p.forEach(m=>m.error&&m.refetch()),loading:p.some(m=>m.loading&&!m.data),select:m=>{const j=$.byId.get(String(m));j&&(t(j.route,j.query),a())}}}function qe({onClose:t,go:a}){const e=E(),{q:d,setQ:r,sections:o,partial:n,openConnections:c,empty:s,error:u,retry:f,loading:g,select:b}=$e(a,t);return i.jsx(U,{title:e("search"),hideTitle:!0,isOpen:!0,onOpenChange:l=>{l||t()},children:i.jsxs(W,{inputValue:d,onInputChange:r,children:[i.jsxs("div",{className:"rp-toolbar",children:[i.jsx(X,{search:!0,large:!0,label:e("search"),value:d,onChange:r,autoFocus:!0,className:"rp-grow"}),i.jsx(w,{quiet:!0,icon:!0,onPress:t,label:e("close"),children:i.jsx(Y,{})})]}),u&&i.jsx(Z,{error:u,onRetry:f}),n&&i.jsxs("div",{className:"rp-note",role:"status",children:[n,i.jsx(w,{small:!0,quiet:!0,onPress:c,children:e("nav.connections")})]}),s&&(g?i.jsx(J,{}):i.jsx(ee,{children:e("search.none")})),i.jsx(se,{"aria-label":e("search"),classNameLine truncated
@@ -0,0 +1 @@
import{r as h,j as i}from"./vendor-react-Bf71BWbF.js";import{W as L,X as v,Y as H,Z as S,$ as A,a0 as I,a1 as O,a2 as R,a3 as _,a4 as P,u as E,a as Q,a5 as V,a6 as B,a7 as y,a8 as D,a9 as F,aa as z,ab as G,ac as W,ad as X,T as Y,B as w,ae as Z,E as J,j as U,af as ee,ag as se,ah as ae,ai as te,aj as ne}from"./index-CXHBmSa5.js";import{u as re}from"./flows-C0byZ3sY.js";import{d as oe}from"./nav-C2A1sZKm.js";import{r as ie}from"./nav-D1cfWFA0.js";import{s as de}from"./nav-BIpfWn6-.js";import{c as ce,s as ue,a as le}from"./nav-BeFLfZq8.js";const x=(a,t,e,d,r,o="")=>({hit:{id:t,label:e,description:d,route:r,query:o},keys:a.flatMap(n=>n==null?[]:[n.toLowerCase()])});function pe(a,t,e){const d=s=>_(s,a),r=a?.resources,o=t?.sources.find(s=>s.kind==="main"),n=[...ie(r).map(s=>({path:"rules",params:{tab:s.id},titleKey:s.titleKey})),...oe(r).map(s=>({path:"dns",params:{tab:s.id},titleKey:s.titleKey})),...ce(ue(r,o)).map(s=>({path:"config",params:{tab:s.id},titleKey:s.titleKey})),...de(r).map(s=>({path:"settings",params:{card:s.id},titleKey:s.titleKey}))];return[...L.filter(s=>s.nav&&d(s.path)).map(s=>({route:s.path,query:"",title:e(s.nav.titleKey),parent:""})),...n.filter(s=>d(s.path)).map(s=>({route:s.path,query:v("",s.params),title:e(s.titleKey),parent:e(L.find(u=>u.path===s.path).nav.titleKey)}))].map(s=>x([s.title,s.parent&&s.parent+" "+s.title],`page:${s.route}?${s.query}`,s.title,s.parent||void 0,s.route,s.query))}function me(a,t){return H(a).map(e=>x([e.domain,e.dst,e.src],`connection:${e.id}`,e.domain||e.dst||e.src||e.id,S(e,t),"connections",v("",{id:e.id})))}function he(a,t,e){const d=t?.providers??[],r=o=>v("",{provider:P(o,d),q:o.name});return(a??[]).map(o=>x([o.name],`node:${o.id}`,o.name,A(e,o.group_ids)||void 0,"nodes",r(o)))}function fe(a){return(a??[]).map(t=>x([t.name],`group:${t.id}`,t.name,t.policy.native,"policies",v("",{group:t.id})))}function ge(a,t){return(a?.providers??[]).map(e=>x([e.name],`provider:${e.id}`,e.name,t("search.nodeCount",{n:e.node_count}),"nodes",v("",{provider:e.id})))}function be(a,t){return(a?.sources??[]).map(e=>x([e.path],`source:${e.id}`,e.path,I(le,e.kind,t),"config",v("",{tab:"source",source:e.id})))}function ve(a,t){return(a?.rules??[]).filter(e=>e.kind==="rule").map(e=>x([e.expression,e.outbound],`rule:${e.rule_id}`,e.expression,`#${O(e.index+1,R[t])} → ${e.outbound}`,"rules",v("",{tab:"list",rule:e.rule_id})))}function xe(a,t,e){return{sections:[{id:"pages",title:e("search.pages"),entries:a.pages},{id:"conns",title:e("nav.connections"),entries:a.conns},{id:"nodes",title:e("search.nodes"),entries:a.nodes},{id:"groups",title:e("search.groups"),entries:a.groups},{id:"providers",title:e("search.providers"),entries:a.providers},{id:"sources",title:e("search.sources"),entries:a.sources},{id:"rules",title:e("nav.rules"),entries:a.rules}],partial:t?.truncated?e("conn.truncated"):null}}function ye(a,t){const e=a.trim().toLowerCase(),d=e?8:5,r=new Map;return{sections:t.sections.map(n=>{const c=[];for(const{hit:s,keys:u}of n.entries){if(c.length===d)break;u.some(f=>f.includes(e))&&(c.push(s),r.set(s.id,s))}return{id:n.id,title:n.title,items:c}}).filter(n=>n.items.length>0),byId:r,partial:t.partial}}function $e(a,t){const e=E(),d=Q(),[r,o]=h.useState(""),n=V(),c=n.data?.resources,s=B(void 0,y(c,"connections",{whileLoading:!1})),u=D(y(c,"nodes",{whileLoading:!1})),f=F(y(c,"groups",{whileLoading:!1})),g=z(y(c,"providers",{whileLoading:!1})),b=G(y(c,"config",{whileLoading:!1})),l=re(y(c,"rules",{whileLoading:!1})),p=[n,s,u,f,g,b,l],K=h.useMemo(()=>pe(n.data,b.data,e),[n.data,b.data,e]),C=h.useMemo(()=>me(s.data,e),[s.data,e]),M=h.useMemo(()=>he(u.data,g.data,d),[u.data,g.data,d]),q=h.useMemo(()=>fe(f.data),[f.data]),N=h.useMemo(()=>ge(g.data,e),[g.data,e]),T=h.useMemo(()=>be(b.data,e),[b.data,e]),k=h.useMemo(()=>ve(l.data,d),[l.data,d]),$=ye(r,xe({pages:K,conns:C,nodes:M,groups:q,providers:N,sources:T,rules:k},s.data,e));return{q:r,setQ:o,sections:$.sections,partial:$.partial,openConnections:()=>{a("connections"),t()},empty:$.byId.size===0,error:p.find(m=>m.error)?.error,retry:()=>p.forEach(m=>m.error&&m.refetch()),loading:p.some(m=>m.loading&&!m.data),select:m=>{const j=$.byId.get(String(m));j&&(a(j.route,j.query),t())}}}function qe({onClose:a,go:t}){const e=E(),{q:d,setQ:r,sections:o,partial:n,openConnections:c,empty:s,error:u,retry:f,loading:g,select:b}=$e(t,a);return i.jsx(W,{title:e("search"),hideTitle:!0,isOpen:!0,onOpenChange:l=>{l||a()},children:i.jsxs(X,{inputValue:d,onInputChange:r,children:[i.jsxs("div",{className:"rp-toolbar",children:[i.jsx(Y,{search:!0,large:!0,label:e("search"),value:d,onChange:r,autoFocus:!0,className:"rp-grow"}),i.jsx(w,{quiet:!0,icon:!0,onPress:a,label:e("close"),children:i.jsx(Z,{})})]}),u&&i.jsx(J,{error:u,onRetry:f}),n&&i.jsxs("div",{className:"rp-note",role:"status",children:[n,i.jsx(w,{small:!0,quiet:!0,onPress:c,children:e("nav.connections")})]}),s&&(g?i.jsx(U,{}):i.jsx(ee,{children:e("search.none")})),i.jsx(se,{"aria-label":e("search"),clLine truncated
@@ -0,0 +1 @@
import{r as b,a as Je,j as t}from"./vendor-react-Bf71BWbF.js";import{a1 as ie,ap as ce,A as Ne,dK as Ye,u as M,dL as Xe,cA as He,dM as Be,n as ve,i as xe,bb as L,o as Re,dN as Ze,w as es,aU as ss,dO as ts,a5 as pe,ay as as,dP as ns,dQ as rs,r as os,dR as is,b as J,dS as ls,dT as ds,a2 as Se,a as Ce,cQ as Ge,a0 as cs,dF as us,aG as se,E as q,j as ue,I as gs,b2 as G,T as ae,aC as ke,bx as ne,B as I,av as ps,a7 as je,aa as fs,d7 as ms,dU as hs,bd as bs,az as vs,dV as Oe,bg as xs,bk as Le,aE as Ae,am as js,an as ys,dW as ws,dX as Ns,a9 as ks,$ as _s,cO as Ss,cw as Me,du as Cs,cG as Ps,aD as Rs,cW as ge,dY as De,dZ as Ls,bj as As,d_ as Ds}from"./index-CXHBmSa5.js";import{d as Ts,c as Is}from"./auth-BGnwk8Hi.js";import{c as Es,a as te,g as ze}from"./nav-BIpfWn6-.js";import{D as Us}from"./Table-D0NFHHNQ.js";import{T as Fs}from"./TimeCell-gSIuLEFc.js";import{A as Hs}from"./ActionGroup-90AzAQje.js";import{c as Bs}from"./dns-DQrpG8y_.js";import{g as le,m as Gs,v as Os}from"./geodata-DprMPspn.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";const Te=["record_flows","record_logs","record_dns_log"],_e={record_flows:{state:"flows",label:"settings.recordFlows"},record_logs:{state:"logs",label:"settings.recordLogs"},record_dns_log:{state:"dns_log",label:"settings.recordDnsLog"}},Ms={auto:"settings.record.auto",on:"settings.record.on",off:"settings.record.off"},zs=s=>s==="auto"?"auto":s==="on";function Vs(s,e,a,n){const r=a?!a.allowed:!1;return{id:s,label:n(_e[s].label),value:e,items:["auto","on","off"].map(l=>({id:l,label:n(Ms[l])})),disabled:r,tone:r?"muted":a?.active?"ok":"neutral",status:n(r?"settings.recordingForbidden":a?.active?"settings.recordingActive":"settings.recordingIdle")}}function qs(s,e){return s?s.grace_remaining_seconds>0?e("settings.recordingGrace",{n:s.grace_remaining_seconds}):e(s.events.active?"settings.recordingEvents":"settings.recordingDetached"):null}const Ks=["log.buffered_records","dns_log.max_records","flows.max_flows","flows.retention_seconds"],de={"log.buffered_records":{read:s=>s.log.buffered_records,write:(s,e)=>{(s.log??={}).buffered_records=e},floor:64,label:"settings.logBuffer"},"dns_log.max_records":{read:s=>s.dns_log.max_records,write:(s,e)=>{(s.dns_log??={}).max_records=e},floor:64,label:"settings.dnsLogSize"},"flows.max_flows":{read:s=>s.flows.max_flows,write:(s,e)=>{(s.flows??={}).max_flows=e},floor:64,label:"settings.flowsMax"},"flows.retention_seconds":{read:s=>s.flows.retention_seconds,write:(s,e)=>{(s.flows??={}).retention_seconds=e},floor:1,label:"settings.flowsRetention"}};function Ws(s,e,a,n,r){const l=de[s];return{id:s,value:e,label:r(l.label),invalid:!/^\d+$/.test(e)||Number(e)<l.floor||a!==void 0&&Number(e)>a,description:a===void 0?r("settings.rangeMin",{min:ie(l.floor,n)}):r("settings.range",{min:ie(l.floor,n),max:ie(a,n)})}}function $s(s,e){return s.map(a=>({id:a.kind,kind:a.kind,size:ce(a.size_bytes,e),modifiedAt:a.modified_at,sha:a.sha256.slice(0,12),shaTitle:a.sha256,source:a.source_redacted??"—",fetched:a.fetched_url_redacted??"—",verified:a.verified===!0}))}function Qs(s,e,a){return{choices:s.map(n=>({id:n.id,label:n.name})),result:e?{text:a(e.key,e.params),role:e.error?"alert":"status",request:e.requestId?a("ui.requestNote",{id:e.requestId}):"",error:!!e.error,id:e.id??0}:null}}function Js(s,e){return s?null:e("settings.noProfile")}function Ys({busy:s,invalid:e,changed:a},n){return s?null:e?n("settings.runtimeInvalid",{field:e}):a?null:n("config.noChanges")}function Xs({ready:s,busy:e,count:a},n){return s&&!e&&!a?n("settings.noSubscriptions"):null}function Ve({busy:s,loaded:e,failed:a},n){return!s&&!e&&a?n("settings.geodataUnread"):null}function Zs(s,e){return s.flatMap(a=>a.items).find(a=>a.id===e)?.label??e}function et(s,e,a,n,r=""){return e.aborted&&e.reason?.name==="TimeoutError"?{key:"settings.timeout"}:e.aborted?null:s instanceof Ne?s.status===401?{key:r?"settings.tokenRejected":"settings.unauthorized"}:s.code==="empty_response"?{key:"settings.nonJson"}:s.code==="invalid_discovery"?{key:"settings.invalidResponse"}:{key:"settings.httpError",params:{status:s.status}}:s instanceof SyntaxError?{key:"settings.nonJson"}:s instanceof TypeError&&new URL(a).origin!==n?{key:"settings.cors"}:{key:"settings.network"}}async function st(s,e,a,n){try{const r=await Ye(s,e).discovery(a);if(!r||!Number.isInteger(r.api_major)||r.api_major<1)throw new Ne(200,"invalid_discovery","Missing API version");return{version:String(r.api_major),password:r.auth?.mode==="password"}}catch(r){const l=et(r,a,s,n,e);return l&&{failure:l,requestId:r instanceof Ne?r.requestId:null}}}function tt(){const[s,e]=b.useState(!1),a=b.useRef(null),n=b.useCallback(()=>{const o=a.current;a.current=null,o?.abort()},[]);b.useEffect(()=>n,[n]);const r=b.useCallback(()=>{n(),e(!1)},[n]);return{pending:s,running:()=>a.current!==null,cancel:r,run:async(o,d,y)=>{const m=new AbortController;a.current=m;const f=setTimeout(()=>m.abort(new DOMExLine truncated
@@ -1 +0,0 @@
import{r as b,a as qe,j as t}from"./vendor-react-Bf71BWbF.js";import{W as ie,ag as ce,A as we,u as O,du as We,co as Fe,dv as Be,n as be,dw as ve,b0 as C,dx as $e,d as Pe,dy as Je,w as Qe,aJ as Xe,dz as Ye,$ as pe,aq as Ze,dA as es,dB as ss,r as ts,dC as as,a as W,dD as ns,dE as rs,X as _e,_ as Se,dr as He,V as os,dn as is,ax as ae,E as $,b as ue,I as ls,aT as G,T as re,at as Ne,B as I,an as ds,a1 as xe,a4 as cs,cW as us,dF as gs,b3 as ps,ar as fs,dG as Ge,b6 as ms,ba as Le,av as De,ae as hs,dH as bs,dI as vs,a3 as xs,U as js,cl as Me,cv as ys,au as ws,cK as ge,dJ as Ae,dK as Ns,b9 as ks,dL as _s}from"./index-zQjLFfuj.js";import{d as Ss,c as Cs}from"./auth-CPB25VPp.js";import{c as Ps,a as ne,g as Oe}from"./nav-BIpfWn6-.js";import{D as Ls}from"./Table-DLlwyNFJ.js";import{T as Ds}from"./TimeCell-DxlzlVpw.js";import{A as As}from"./ActionGroup-C-LVMOvQ.js";import{c as Rs}from"./dns-BoPCaePc.js";import{g as le,m as Ts,v as Is}from"./geodata-DprMPspn.js";import"./useGridSelectionCheckbox-BK6qtlfZ.js";import"./Virtualizer-CTh266-x.js";import"./ListLayout-DU_9AgrU.js";const Re=["record_flows","record_logs","record_dns_log"],ke={record_flows:{state:"flows",label:"settings.recordFlows"},record_logs:{state:"logs",label:"settings.recordLogs"},record_dns_log:{state:"dns_log",label:"settings.recordDnsLog"}},Es={auto:"settings.record.auto",on:"settings.record.on",off:"settings.record.off"},Us=s=>s==="auto"?"auto":s==="on";function Fs(s,e,a,n){const r=a?!a.allowed:!1;return{id:s,label:n(ke[s].label),value:e,items:["auto","on","off"].map(l=>({id:l,label:n(Es[l])})),disabled:r,tone:r?"muted":a?.active?"ok":"neutral",status:n(r?"settings.recordingForbidden":a?.active?"settings.recordingActive":"settings.recordingIdle")}}function Bs(s,e){return s?s.grace_remaining_seconds>0?e("settings.recordingGrace",{n:s.grace_remaining_seconds}):e(s.events.active?"settings.recordingEvents":"settings.recordingDetached"):null}const Hs=["log.buffered_records","dns_log.max_records","flows.max_flows","flows.retention_seconds"],de={"log.buffered_records":{read:s=>s.log.buffered_records,write:(s,e)=>{(s.log??={}).buffered_records=e},floor:64,label:"settings.logBuffer"},"dns_log.max_records":{read:s=>s.dns_log.max_records,write:(s,e)=>{(s.dns_log??={}).max_records=e},floor:64,label:"settings.dnsLogSize"},"flows.max_flows":{read:s=>s.flows.max_flows,write:(s,e)=>{(s.flows??={}).max_flows=e},floor:64,label:"settings.flowsMax"},"flows.retention_seconds":{read:s=>s.flows.retention_seconds,write:(s,e)=>{(s.flows??={}).retention_seconds=e},floor:1,label:"settings.flowsRetention"}};function Gs(s,e,a,n,r){const l=de[s];return{id:s,value:e,label:r(l.label),invalid:!/^\d+$/.test(e)||Number(e)<l.floor||a!==void 0&&Number(e)>a,description:a===void 0?r("settings.rangeMin",{min:ie(l.floor,n)}):r("settings.range",{min:ie(l.floor,n),max:ie(a,n)})}}function Ms(s,e){return s.map(a=>({id:a.kind,kind:a.kind,size:ce(a.size_bytes,e),modifiedAt:a.modified_at,sha:a.sha256.slice(0,12),shaTitle:a.sha256,source:a.source_redacted??"—",fetched:a.fetched_url_redacted??"—",verified:a.verified===!0}))}function Os(s,e,a){return{choices:s.map(n=>({id:n.id,label:n.name})),result:e?{text:a(e.key,e.params),role:e.error?"alert":"status",request:e.requestId?a("ui.requestNote",{id:e.requestId}):"",error:!!e.error,id:e.id??0}:null}}function zs(s,e){return s.flatMap(a=>a.items).find(a=>a.id===e)?.label??e}function Ks(s,e,a,n,r=""){return e.aborted&&e.reason?.name==="TimeoutError"?{key:"settings.timeout"}:e.aborted?null:s instanceof we?s.status===401?{key:r?"settings.tokenRejected":"settings.unauthorized"}:s.code==="empty_response"?{key:"settings.nonJson"}:s.code==="invalid_discovery"?{key:"settings.invalidResponse"}:{key:"settings.httpError",params:{status:s.status}}:s instanceof SyntaxError?{key:"settings.nonJson"}:s instanceof TypeError&&new URL(a).origin!==n?{key:"settings.cors"}:{key:"settings.network"}}function Te(s){const e=new URLSearchParams(s),a=e.get("api");return a?{api:a,token:e.get("token")??""}:null}function Vs(s){const e=O(),[a]=b.useState(We),[n,r]=b.useState(a.api??""),[l,i]=b.useState(a.token),[c,w]=b.useState(!1),[v,x]=b.useState(null),[N,p]=b.useState(!1),k=n!==(a.api??"")||l!==a.token,E=Fe(k,()=>{r(a.api??""),i(a.token),w(!1)}),[P,_]=b.useState(null);if(P!==s){_(s);const o=Te(s);o&&(w(!0),r(o.api),i(o.token),p(!1),x(null))}b.useEffect(()=>{const o=new URLSearchParams(s);o.has("api")&&(o.delete("api"),o.delete("token"),history.replaceState(history.state,"",location.pathname+location.search+Be("settings",o.toString())));const f=o.get("card");f&&document.getElementById(Ps(f))?.scrollIntoView({block:"start"})},[s]);const j=a.profiles.find(o=>o.id===a.activeId),[L,S]=b.useState(!1),[B,u]=b.useState(!1),g=b.useRef(!1),y=b.useRef(0),h=b.useRef(null);b.useEffect(()=>()=>{const o=h.current;h.current=null,o?.abort()},[]);const D=b.useCallback(()=>{const o=h.current;h.current=null,o?.abort(),p(!1),x(null)},[]);b.useLayoutEffect(()=>{if(!Te(s))return;const o=h.current;h.currenLine truncated
@@ -1 +1 @@
import{r as x,j as r}from"./vendor-react-Bf71BWbF.js";import{as as k,eq as P,er as S}from"./index-zQjLFfuj.js";import{u as T,C as B,f as W,n as v,g as j}from"./layout-B3T-zLsm.js";import{G as L,C as R}from"./AreaCurve-BriPYJva.js";import"./array-C0P64tl-.js";function z(i){let t=i.parentElement;for(;t&&getComputedStyle(t).overflow==="visible";)t=t.parentElement;const l=i.getBoundingClientRect();if(!t)return{x:-l.left,y:-l.top,width:document.documentElement.clientWidth,height:document.documentElement.clientHeight};const h=t.getBoundingClientRect();return{x:h.left+t.clientLeft-l.left,y:h.top+t.clientTop-l.top,width:t.clientWidth,height:t.clientHeight}}function q({values:i,timestamps:t,color:l,fmt:h,locale:p,height:f=32,floor:m=0}){const g=x.useId(),C=k(),[o,w]=x.useState(null),[u,e]=P(Math.round,120),{tip:M,showAt:b,hide:E}=T(),c=i.filter(n=>n!==null),y=[m>0?0:Math.min(...c)*.85,Math.max(Math.max(...c)*1.05||1,m)],d=n=>j(n,[Math.min(...t),Math.max(...t)],[0,e?.width??0]),a=n=>j(n,y,[(e?.height??f)-2,2]);return x.useLayoutEffect(()=>{if(o===null||i[o]==null||!h||!p||!u.current||!e){E();return}b({x:d(t[o]),y:a(i[o]),width:e.width,bounds:z(u.current),label:S(p).format(t[o]),lines:[h(i[o])]})}),r.jsx("div",{ref:u,style:{height:f,width:"100%",position:"relative"},"aria-hidden":c.length?!0:void 0,onPointerLeave:()=>w(null),children:c.length>0&&e&&r.jsxs(r.Fragment,{children:[r.jsx(B,{tip:M}),r.jsxs("svg",{className:"rp-activity-surface",width:e.width,height:e.height,viewBox:`0 0 ${e.width} ${e.height}`,style:{display:"block"},onPointerMove:n=>{const s=W(n,n.currentTarget,e);w(s.x<0||s.x>e.width||s.y<2||s.y>e.height-2?null:v(t.map(d),s.x))},children:[r.jsx("defs",{children:r.jsx(L,{id:g,color:l})}),r.jsx(R,{points:i.map((n,s)=>n===null?null:{x:d(t[s]),y:a(n)}),baseline:a(Math.max(0,y[0])),color:l,id:g,strokeWidth:1.5}),o!==null&&i[o]!=null&&r.jsx("circle",{cx:d(t[o]),cy:a(i[o]),r:4,fill:l,stroke:C.base,strokeWidth:2})]})]})})}export{q as SparkPlot};
import{r as x,j as r}from"./vendor-react-Bf71BWbF.js";import{aB as k,eH as P,eI as B}from"./index-CXHBmSa5.js";import{u as S,C as T,f as W,n as v,g as j}from"./layout-BRLew_nj.js";import{G as H,C as I}from"./AreaCurve-BriPYJva.js";import"./array-C0P64tl-.js";function L(i){let t=i.parentElement;for(;t&&getComputedStyle(t).overflow==="visible";)t=t.parentElement;const l=i.getBoundingClientRect();if(!t)return{x:-l.left,y:-l.top,width:document.documentElement.clientWidth,height:document.documentElement.clientHeight};const h=t.getBoundingClientRect();return{x:h.left+t.clientLeft-l.left,y:h.top+t.clientTop-l.top,width:t.clientWidth,height:t.clientHeight}}function A({values:i,timestamps:t,color:l,fmt:h,locale:p,height:f=32,floor:m=0}){const g=x.useId(),C=k(),[o,w]=x.useState(null),[u,e]=P(Math.round,120),{tip:M,showAt:b,hide:E}=S(),c=i.filter(n=>n!==null),y=[m>0?0:Math.min(...c)*.85,Math.max(Math.max(...c)*1.05||1,m)],d=n=>j(n,[Math.min(...t),Math.max(...t)],[0,e?.width??0]),a=n=>j(n,y,[(e?.height??f)-2,2]);return x.useLayoutEffect(()=>{if(o===null||i[o]==null||!h||!p||!u.current||!e){E();return}b({x:d(t[o]),y:a(i[o]),width:e.width,bounds:L(u.current),label:B(p).format(t[o]),lines:[h(i[o])]})}),r.jsx("div",{ref:u,style:{height:f,width:"100%",position:"relative"},"aria-hidden":c.length?!0:void 0,onPointerLeave:()=>w(null),children:c.length>0&&e&&r.jsxs(r.Fragment,{children:[r.jsx(T,{tip:M}),r.jsxs("svg",{className:"rp-activity-surface",width:e.width,height:e.height,viewBox:`0 0 ${e.width} ${e.height}`,style:{display:"block"},onPointerMove:n=>{const s=W(n,n.currentTarget,e);w(s.x<0||s.x>e.width||s.y<2||s.y>e.height-2?null:v(t.map(d),s.x))},children:[r.jsx("defs",{children:r.jsx(H,{id:g,color:l})}),r.jsx(I,{points:i.map((n,s)=>n===null?null:{x:d(t[s]),y:a(n)}),baseline:a(Math.max(0,y[0])),color:l,id:g,strokeWidth:1.5}),o!==null&&i[o]!=null&&r.jsx("circle",{cx:d(t[o]),cy:a(i[o]),r:4,fill:l,stroke:C.base,strokeWidth:2})]})]})})}export{A as SparkPlot};
@@ -0,0 +1 @@
import{r as f,$,b as Vt,j as E}from"./vendor-react-Bf71BWbF.js";import{e6 as Ot,e7 as He,e8 as Ut,e9 as Qe,bR as ee,ea as _t,eb as ie,ec as he,ed as ht,ee as N,ef as jt,eg as Yt,eh as ft,ei as Xt,ej as Ke,cg as yt,bF as ae,ek as Gt,bB as Be,bD as Y,bT as fe,bC as qt,bE as L,el as D,em as be,en as Le,eo as Qt,bH as pt,bN as Pe,bK as Je,bL as ve,bM as Ie,bO as Z,bS as Jt,bP as de,bQ as ce,ep as gt,eq as Zt,er as Ze,bI as el,es as tl,bJ as ll,et as il,eu as rl,c3 as Se,bU as bt,bW as Ve,bV as nl,ev as Oe,c0 as H,b_ as me,c4 as le,cl as ol,ew as al,ca as et,b$ as se,ex as sl,ch as dl,c2 as ye,c6 as Me,cj as cl,cb as ul,ci as hl,ck as fl,cm as yl,ey as pl,c1 as Ce,bX as Ue,c9 as mt,c5 as W,ez as $t,c7 as gl,cc as bl,cd as ze,eA as tt,eB as ml,eC as $l,eD as De,eE as xl,cn as wl,co as vl,cp as Cl,u as xt,aN as lt,f as kl,j as Kl,af as Il,bh as Rl,dY as wt,c as vt,eF as Sl,eG as Ml,aE as Dl}from"./index-CXHBmSa5.js";import{$ as El,a as Pl,e as zl,b as Tl,c as Ct,d as kt}from"./useGridSelectionCheckbox-BV96yL-N.js";import{a as Nl,c as oe,b as ue,d as Hl}from"./Virtualizer--Vfl8O3n.js";import{$ as Wl}from"./ListLayout-CPapuywx.js";function Fl(n){let{onMoveStart:e,onMove:t,onMoveEnd:l}=n,i=f.useRef({didMove:!1,lastPosition:null,id:null}),{addGlobalListener:r,removeGlobalListener:o}=Ot(),s=f.useCallback((y,g,p,h)=>{p===0&&h===0||(i.current.didMove||(i.current.didMove=!0,e?.({type:"movestart",pointerType:g,shiftKey:y.shiftKey,metaKey:y.metaKey,ctrlKey:y.ctrlKey,altKey:y.altKey})),t?.({type:"move",pointerType:g,deltaX:p,deltaY:h,shiftKey:y.shiftKey,metaKey:y.metaKey,ctrlKey:y.ctrlKey,altKey:y.altKey}))},[e,t,i]),a=He(s),d=f.useCallback((y,g)=>{Ut(),i.current.didMove&&l?.({type:"moveend",pointerType:g,shiftKey:y.shiftKey,metaKey:y.metaKey,ctrlKey:y.ctrlKey,altKey:y.altKey})},[l,i]),c=He(d);return{moveProps:f.useMemo(()=>{let y={},g=()=>{_t(),i.current.didMove=!1};{let h=b=>{if(b.pointerId===i.current.id){let k=b.pointerType||"mouse";a(b,k,b.pageX-(i.current.lastPosition?.pageX??0),b.pageY-(i.current.lastPosition?.pageY??0)),i.current.lastPosition={pageX:b.pageX,pageY:b.pageY}}},x=b=>{if(b.pointerId===i.current.id){let k=b.pointerType||"mouse";c(b,k),i.current.id=null;let w=Qe(ee(b));o(w,"pointermove",h,!1),o(w,"pointerup",x,!1),o(w,"pointercancel",x,!1)}};y.onPointerDown=b=>{if(b.button===0&&i.current.id==null){g(),b.stopPropagation(),b.preventDefault(),i.current.lastPosition={pageX:b.pageX,pageY:b.pageY},i.current.id=b.pointerId;let k=Qe(ee(b));r(k,"pointermove",h,!1),r(k,"pointerup",x,!1),r(k,"pointercancel",x,!1)}}}let p=(h,x,b)=>{g(),a(h,"keyboard",x,b),c(h,"keyboard")};return y.onKeyDown=h=>{switch(h.key){case"Left":case"ArrowLeft":h.preventDefault(),h.stopPropagation(),p(h,-1,0);break;case"Right":case"ArrowRight":h.preventDefault(),h.stopPropagation(),p(h,1,0);break;case"Up":case"ArrowUp":h.preventDefault(),h.stopPropagation(),p(h,0,-1);break;case"Down":case"ArrowDown":h.preventDefault(),h.stopPropagation(),p(h,0,1);break}},y},[r,o,i])}}const it=10,rt=5;class Al{setup(e,t,l){this.delegate=e,this.state=t,this.direction=l}getDropTargetFromPoint(e,t,l){let i=this.delegate.getDropTargetFromPoint(e,t,l);return!i||i.type==="root"?i:this.resolveDropTarget(i,e,t,l)}resolveDropTarget(e,t,l,i){let r=this.pointerTracking,o=l-r.lastY,s=t-r.lastX,a=r.yDirection,d=r.xDirection;if(Math.abs(o)>rt&&(a=o>0?"down":"up",r.yDirection=a,r.lastY=l),Math.abs(s)>it&&(d=s>0?"right":"left",r.xDirection=d,r.lastX=t),e.dropPosition==="before"){let y=this.state.collection.getKeyBefore(e.key);for(;y!=null;){let g=this.state.collection.getItem(y);if(g?.type==="item")break;y=g?.parentKey??null}if(y!=null){let g={type:"item",key:y,dropPosition:"after"};i(g)&&(e=g)}}let c=this.getPotentialTargets(e,i);if(c.length===0)return{type:"root"};let u;return c.length>1?u=this.selectTarget(c,e,t,l,a,d):(u=c[0],r.boundaryContext=null),u}getPotentialTargets(e,t){if(e.dropPosition==="on")return[e];let l=e,i=this.state.collection,r=i.getItem(l.key);for(;r&&r?.type!=="item"&&r.nextKey!=null;)l.key=r.nextKey,r=i.getItem(r.nextKey);let o=[l];if(r&&r.hasChildNodes&&this.state.expandedKeys.has(r.key)&&i.getChildren&&l.dropPosition==="after"){let d=r.firstChildKey!=null?i.getItem(r.firstChildKey):null;for(;d&&d.type!=="item";)d=d.nextKey!=null?i.getItem(d.nextKey):null;if(d?.type==="item"){const c={type:"item",key:d.key,dropPosition:"before"};return t(c)?[c]:[]}}if(r?.nextKey!=null)return[e];let s=r?.parentKey,a=[];for(;s!=null;){let d=i.getItem(s),c=d?.nextKey!=null?i.getItem(d.nextKey):null;if(!c||c.parentKey!==s){if(d?.type==="item"){let y={type:"item",key:s,dropPosition:"after"};t(y)&&a.push(y)}if(c)break}s=d?.parentKey}if(a.length>0&&o.push(...a),o.length===1){let d=i.getKeyAfter(l.key),c=d!=null?i.getItem(d):null;if(d!=null&&c&&r&&c.level!=null&&r.level!=null&&c.level>r.level){let u={type:"item",key:d,dropPosition:"before"};if(t(u))return[u]}}return o.filter(t)}selectTarget(e,t,l,i,r,o){if(e.length<2)return e[0];let s=this.pointerTracking,d=this.state.collectionLine truncated
@@ -1 +0,0 @@
import{r as y,$ as m,b as Ht,j as E}from"./vendor-react-Bf71BWbF.js";import{dT as Wt,dU as ze,dV as Ft,dW as Ye,bG as q,dX as At,dY as te,dZ as ce,d_ as at,d$ as N,e0 as Bt,e1 as Lt,e2 as st,e3 as Vt,e4 as ve,c5 as dt,bu as ne,e5 as Ot,bq as We,bs as Y,bI as ue,br as Ut,bt as A,e6 as M,e7 as pe,e8 as Fe,e9 as _t,bw as ct,bC as Se,bz as je,bA as xe,bB as Ce,bD as G,bH as Yt,bE as ae,bF as se,ea as ut,eb as jt,ec as Xe,bx as Xt,ed as Gt,by as qt,ee as Jt,ef as Zt,bU as ke,bJ as ht,bL as Ae,bK as Qt,eg as Be,bR as H,bP as ge,bV as Q,ca as el,eh as tl,b$ as Ge,bQ as oe,ei as ll,c6 as il,bT as he,bX as Ke,c8 as rl,c0 as nl,c7 as ol,c9 as al,cb as sl,ej as dl,bS as we,bM as Le,b_ as ft,bW as W,ek as yt,bY as cl,c1 as ul,c2 as De,el as qe,em as hl,en as fl,eo as Ie,ep as yl,cc as pl,cd as gl,ce as bl,u as pt,aC as Je,b as ml,a8 as $l,dJ as xl,bd as wl,av as vl}from"./index-zQjLFfuj.js";import{$ as Cl,a as kl,e as Kl,b as Il,c as gt,d as bt}from"./useGridSelectionCheckbox-BK6qtlfZ.js";import{a as Rl,c as re,b as de,d as Sl}from"./Virtualizer-CTh266-x.js";import{$ as Dl}from"./ListLayout-DU_9AgrU.js";function Ml(n){let{onMoveStart:e,onMove:t,onMoveEnd:l}=n,i=y.useRef({didMove:!1,lastPosition:null,id:null}),{addGlobalListener:r,removeGlobalListener:o}=Wt(),s=y.useCallback((f,g,p,h)=>{p===0&&h===0||(i.current.didMove||(i.current.didMove=!0,e?.({type:"movestart",pointerType:g,shiftKey:f.shiftKey,metaKey:f.metaKey,ctrlKey:f.ctrlKey,altKey:f.altKey})),t?.({type:"move",pointerType:g,deltaX:p,deltaY:h,shiftKey:f.shiftKey,metaKey:f.metaKey,ctrlKey:f.ctrlKey,altKey:f.altKey}))},[e,t,i]),a=ze(s),d=y.useCallback((f,g)=>{Ft(),i.current.didMove&&l?.({type:"moveend",pointerType:g,shiftKey:f.shiftKey,metaKey:f.metaKey,ctrlKey:f.ctrlKey,altKey:f.altKey})},[l,i]),c=ze(d);return{moveProps:y.useMemo(()=>{let f={},g=()=>{At(),i.current.didMove=!1};{let h=b=>{if(b.pointerId===i.current.id){let k=b.pointerType||"mouse";a(b,k,b.pageX-(i.current.lastPosition?.pageX??0),b.pageY-(i.current.lastPosition?.pageY??0)),i.current.lastPosition={pageX:b.pageX,pageY:b.pageY}}},x=b=>{if(b.pointerId===i.current.id){let k=b.pointerType||"mouse";c(b,k),i.current.id=null;let w=Ye(q(b));o(w,"pointermove",h,!1),o(w,"pointerup",x,!1),o(w,"pointercancel",x,!1)}};f.onPointerDown=b=>{if(b.button===0&&i.current.id==null){g(),b.stopPropagation(),b.preventDefault(),i.current.lastPosition={pageX:b.pageX,pageY:b.pageY},i.current.id=b.pointerId;let k=Ye(q(b));r(k,"pointermove",h,!1),r(k,"pointerup",x,!1),r(k,"pointercancel",x,!1)}}}let p=(h,x,b)=>{g(),a(h,"keyboard",x,b),c(h,"keyboard")};return f.onKeyDown=h=>{switch(h.key){case"Left":case"ArrowLeft":h.preventDefault(),h.stopPropagation(),p(h,-1,0);break;case"Right":case"ArrowRight":h.preventDefault(),h.stopPropagation(),p(h,1,0);break;case"Up":case"ArrowUp":h.preventDefault(),h.stopPropagation(),p(h,0,-1);break;case"Down":case"ArrowDown":h.preventDefault(),h.stopPropagation(),p(h,0,1);break}},f},[r,o,i])}}const Ze=10,Qe=5;class El{setup(e,t,l){this.delegate=e,this.state=t,this.direction=l}getDropTargetFromPoint(e,t,l){let i=this.delegate.getDropTargetFromPoint(e,t,l);return!i||i.type==="root"?i:this.resolveDropTarget(i,e,t,l)}resolveDropTarget(e,t,l,i){let r=this.pointerTracking,o=l-r.lastY,s=t-r.lastX,a=r.yDirection,d=r.xDirection;if(Math.abs(o)>Qe&&(a=o>0?"down":"up",r.yDirection=a,r.lastY=l),Math.abs(s)>Ze&&(d=s>0?"right":"left",r.xDirection=d,r.lastX=t),e.dropPosition==="before"){let f=this.state.collection.getKeyBefore(e.key);for(;f!=null;){let g=this.state.collection.getItem(f);if(g?.type==="item")break;f=g?.parentKey??null}if(f!=null){let g={type:"item",key:f,dropPosition:"after"};i(g)&&(e=g)}}let c=this.getPotentialTargets(e,i);if(c.length===0)return{type:"root"};let u;return c.length>1?u=this.selectTarget(c,e,t,l,a,d):(u=c[0],r.boundaryContext=null),u}getPotentialTargets(e,t){if(e.dropPosition==="on")return[e];let l=e,i=this.state.collection,r=i.getItem(l.key);for(;r&&r?.type!=="item"&&r.nextKey!=null;)l.key=r.nextKey,r=i.getItem(r.nextKey);let o=[l];if(r&&r.hasChildNodes&&this.state.expandedKeys.has(r.key)&&i.getChildren&&l.dropPosition==="after"){let d=r.firstChildKey!=null?i.getItem(r.firstChildKey):null;for(;d&&d.type!=="item";)d=d.nextKey!=null?i.getItem(d.nextKey):null;if(d?.type==="item"){const c={type:"item",key:d.key,dropPosition:"before"};return t(c)?[c]:[]}}if(r?.nextKey!=null)return[e];let s=r?.parentKey,a=[];for(;s!=null;){let d=i.getItem(s),c=d?.nextKey!=null?i.getItem(d.nextKey):null;if(!c||c.parentKey!==s){if(d?.type==="item"){let f={type:"item",key:s,dropPosition:"after"};t(f)&&a.push(f)}if(c)break}s=d?.parentKey}if(a.length>0&&o.push(...a),o.length===1){let d=i.getKeyAfter(l.key),c=d!=null?i.getItem(d):null;if(d!=null&&c&&r&&c.level!=null&&r.level!=null&&c.level>r.level){let u={type:"item",key:d,dropPosition:"before"};if(t(u))return[u]}}return o.filter(t)}selectTarget(e,t,l,i,r,o){if(e.length<2)return e[0];let s=this.pointerTracking,d=this.state.collection.getItem(t.key)?.parentKey;if(d==Line truncated
@@ -1 +0,0 @@
import{j as t}from"./vendor-react-Bf71BWbF.js";import{X as a,_ as r,dI as i,av as l,dH as n,ah as m}from"./index-zQjLFfuj.js";function p({at:o}){const s=a[r()],e=i();return t.jsx(l,{text:o?m(o,s):void 0,children:n(o,s,e)})}export{p as T};
@@ -0,0 +1 @@
import{j as e}from"./vendor-react-Bf71BWbF.js";import{a2 as t,a as r,dX as i,aE as l,dW as n,aq as m}from"./index-CXHBmSa5.js";function p({at:o}){const a=t[r()],s=i();return e.jsx(l,{text:o?m(o,a):void 0,children:n(o,a,s)})}export{p as T};
@@ -1 +1 @@
import{bu as H,bG as te,bI as ie,es as ne,et as le,bB as se,dU as F,el as _,en as re,eu as oe,bR as ae,ev as he}from"./index-zQjLFfuj.js";import{r as f,$ as z,a as M}from"./vendor-react-Bf71BWbF.js";class x{constructor(e=0,t=0){this.x=e,this.y=t}copy(){return new x(this.x,this.y)}equals(e){return this.x===e.x&&this.y===e.y}isOrigin(){return this.x===0&&this.y===0}}class y{constructor(e=0,t=0,i=0,n=0){this.x=e,this.y=t,this.width=i,this.height=n}get maxX(){return this.x+this.width}get maxY(){return this.y+this.height}get area(){return this.width*this.height}get topLeft(){return new x(this.x,this.y)}get topRight(){return new x(this.maxX,this.y)}get bottomLeft(){return new x(this.x,this.maxY)}get bottomRight(){return new x(this.maxX,this.maxY)}intersects(e){return this.area>0&&e.area>0&&this.x<=e.x+e.width&&e.x<=this.x+this.width&&this.y<=e.y+e.height&&e.y<=this.y+this.height}containsRect(e){return this.x<=e.x&&this.y<=e.y&&this.maxX>=e.maxX&&this.maxY>=e.maxY}containsPoint(e){return this.x<=e.x&&this.y<=e.y&&this.maxX>=e.x&&this.maxY>=e.y}getCornerInRect(e){for(let t of["topLeft","topRight","bottomLeft","bottomRight"])if(e.containsPoint(this[t]))return t;return null}equals(e){return e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height}pointEquals(e){return this.x===e.x&&this.y===e.y}sizeEquals(e){return this.width===e.width&&this.height===e.height}union(e){let t=Math.min(this.x,e.x),i=Math.min(this.y,e.y),n=Math.max(this.maxX,e.maxX)-t,s=Math.max(this.maxY,e.maxY)-i;return new y(t,i,n,s)}intersection(e){if(!this.intersects(e))return new y(0,0,0,0);let t=Math.max(this.x,e.x),i=Math.max(this.y,e.y);return new y(t,i,Math.min(this.maxX,e.maxX)-t,Math.min(this.maxY,e.maxY)-i)}copy(){return new y(this.x,this.y,this.width,this.height)}}class b{constructor(e=0,t=0){this.width=Math.max(e,0),this.height=Math.max(t,0)}copy(){return new b(this.width,this.height)}equals(e){return this.width===e.width&&this.height===e.height}get area(){return this.width*this.height}}let ce=0;class B{constructor(e,t){this.virtualizer=e,this.key=++ce,this.viewType=t,this.children=new Set,this.reusableViews=new Map,this.layoutInfo=null,this.content=null,this.rendered=null}prepareForReuse(){this.content=null,this.rendered=null,this.layoutInfo=null}getReusableView(e){let t=this.reusableViews.get(e);return t&&t.length>0?t.shift():new de(this.virtualizer,this,e)}reuseChild(e){e.prepareForReuse();let t=this.reusableViews.get(e.viewType);t||(t=[],this.reusableViews.set(e.viewType,t)),t.push(e)}}class ue extends B{constructor(e){super(e,"root")}}class de extends B{constructor(e,t,i){super(e,i),this.parent=t}}function fe(l,e){if(l===e)return!0;if(l.size!==e.size)return!1;for(let t of l)if(!e.has(t))return!1;return!0}class ye{setVisibleRect(e){let t=performance.now()-this.startTime;t<500&&(e.x!==this.visibleRect.x&&t>0&&(this.velocity.x=(e.x-this.visibleRect.x)/t),e.y!==this.visibleRect.y&&t>0&&(this.velocity.y=(e.y-this.visibleRect.y)/t)),this.startTime=performance.now(),this.visibleRect=e}getOverscannedRect(){let e=this.visibleRect.copy(),t=this.visibleRect.height/3;e.height+=t,this.velocity.y<0&&(e.y-=t);let i=this.visibleRect.width/3;return e.width+=i,this.velocity.x<0&&(e.x-=i),e}constructor(){this.startTime=0,this.velocity=new x(0,0),this.visibleRect=new y}}const we=4;function T(l){return l==="x"?"width":"height"}function ge(l,e,t,i,n){let s=t(l.key);if(!s)return null;let a=s.rect[l.corner][e]-i[e]-l.offset;if(a===0)return null;let h=i[e]+a,r=T(e),d=Math.max(0,n[r]-i[r]),u=Math.max(0,Math.min(d,h));return u!==i[e]?u:null}function ve(l,e,t,i,n=()=>!0){let s=T(e),a=null;for(let[h,r]of i){if(!r||!n(r))continue;let d=r.rect.intersection(t)[s];if(r.rect.area>0&&d>=we){let u=r.rect.getCornerInRect(t)??"topLeft",c=r.rect[u][e]-t[e];(!a||(l==="end"?c<a.offset:c>a.offset))&&(a={key:h,corner:u,offset:c})}}return a}function be(l,e,t,i){if(l==="start")return 0;let n=T(e);return Math.max(0,t[n]-i[n])}function X(l,e,t,i,n){if(t==="start")return l[i]<=n;let s=T(i);return e[s]-(l[i]+l[s])<=n}function pe(l,e,t,i,n,s,a,h,r,d){let u=c=>e==="x"?new y(c,r.y,r.width,r.height):new y(r.x,c,r.width,r.height);if(t){let c=ge(t,e,h,r,d);if(c!=null)return u(c)}if(i&&!n&&(!s||a>0)){let c=u(be(l,e,d,r));return c.equals(r)?null:c}return null}class me{reset(){this.hasSnappedToEdge=!1,this.hadEstimatedVisibleItems=!1,this.wasNearAnchorEdge=!1}captureBeforeLayout(e,t,i){return e?ve(e.edge,e.axis,i,t,e.isAnchorable):null}resolveAfterLayout(e){let{anchorInfo:t,anchor:i,postLayoutInfos:n,previousVisibleRect:s,previousContentSize:a,contentSize:h,itemSizeChanged:r,isScrolling:d,getLayoutInfo:u}=e;if(!t)return null;let c=this.hadEstimatedVisibleItems,o=this.wasNearAnchorEdge,m=!1;for(let V of n.values())if(V.estimatedSize){m=!0;break}if(this.hadEstimatedVisibleItems=m,c||(this.wasNearAnchorEdge=X(s,a,t.edge,t.axis,t.threshold)),s.area===0)return null;let w=t.axis==="x"?"width":"height",S=h[w]-a[w],$=!this.hasSnappedToEdge;if(this.hasSnappedToEdge=!0,!($||S!==0||r))Line truncated
import{bF as F,bR as te,bT as ie,eJ as ne,eK as le,bM as se,e7 as H,eA as T,eC as re,eL as oe,c0 as ae,eM as he}from"./index-CXHBmSa5.js";import{r as f,$ as z,a as M}from"./vendor-react-Bf71BWbF.js";class x{constructor(e=0,t=0){this.x=e,this.y=t}copy(){return new x(this.x,this.y)}equals(e){return this.x===e.x&&this.y===e.y}isOrigin(){return this.x===0&&this.y===0}}class y{constructor(e=0,t=0,i=0,n=0){this.x=e,this.y=t,this.width=i,this.height=n}get maxX(){return this.x+this.width}get maxY(){return this.y+this.height}get area(){return this.width*this.height}get topLeft(){return new x(this.x,this.y)}get topRight(){return new x(this.maxX,this.y)}get bottomLeft(){return new x(this.x,this.maxY)}get bottomRight(){return new x(this.maxX,this.maxY)}intersects(e){return this.area>0&&e.area>0&&this.x<=e.x+e.width&&e.x<=this.x+this.width&&this.y<=e.y+e.height&&e.y<=this.y+this.height}containsRect(e){return this.x<=e.x&&this.y<=e.y&&this.maxX>=e.maxX&&this.maxY>=e.maxY}containsPoint(e){return this.x<=e.x&&this.y<=e.y&&this.maxX>=e.x&&this.maxY>=e.y}getCornerInRect(e){for(let t of["topLeft","topRight","bottomLeft","bottomRight"])if(e.containsPoint(this[t]))return t;return null}equals(e){return e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height}pointEquals(e){return this.x===e.x&&this.y===e.y}sizeEquals(e){return this.width===e.width&&this.height===e.height}union(e){let t=Math.min(this.x,e.x),i=Math.min(this.y,e.y),n=Math.max(this.maxX,e.maxX)-t,s=Math.max(this.maxY,e.maxY)-i;return new y(t,i,n,s)}intersection(e){if(!this.intersects(e))return new y(0,0,0,0);let t=Math.max(this.x,e.x),i=Math.max(this.y,e.y);return new y(t,i,Math.min(this.maxX,e.maxX)-t,Math.min(this.maxY,e.maxY)-i)}copy(){return new y(this.x,this.y,this.width,this.height)}}class b{constructor(e=0,t=0){this.width=Math.max(e,0),this.height=Math.max(t,0)}copy(){return new b(this.width,this.height)}equals(e){return this.width===e.width&&this.height===e.height}get area(){return this.width*this.height}}let ce=0;class B{constructor(e,t){this.virtualizer=e,this.key=++ce,this.viewType=t,this.children=new Set,this.reusableViews=new Map,this.layoutInfo=null,this.content=null,this.rendered=null}prepareForReuse(){this.content=null,this.rendered=null,this.layoutInfo=null}getReusableView(e){let t=this.reusableViews.get(e);return t&&t.length>0?t.shift():new de(this.virtualizer,this,e)}reuseChild(e){e.prepareForReuse();let t=this.reusableViews.get(e.viewType);t||(t=[],this.reusableViews.set(e.viewType,t)),t.push(e)}}class ue extends B{constructor(e){super(e,"root")}}class de extends B{constructor(e,t,i){super(e,i),this.parent=t}}function fe(l,e){if(l===e)return!0;if(l.size!==e.size)return!1;for(let t of l)if(!e.has(t))return!1;return!0}class ye{setVisibleRect(e){let t=performance.now()-this.startTime;t<500&&(e.x!==this.visibleRect.x&&t>0&&(this.velocity.x=(e.x-this.visibleRect.x)/t),e.y!==this.visibleRect.y&&t>0&&(this.velocity.y=(e.y-this.visibleRect.y)/t)),this.startTime=performance.now(),this.visibleRect=e}getOverscannedRect(){let e=this.visibleRect.copy(),t=this.visibleRect.height/3;e.height+=t,this.velocity.y<0&&(e.y-=t);let i=this.visibleRect.width/3;return e.width+=i,this.velocity.x<0&&(e.x-=i),e}constructor(){this.startTime=0,this.velocity=new x(0,0),this.visibleRect=new y}}const we=4;function _(l){return l==="x"?"width":"height"}function ge(l,e,t,i,n){let s=t(l.key);if(!s)return null;let a=s.rect[l.corner][e]-i[e]-l.offset;if(a===0)return null;let h=i[e]+a,r=_(e),d=Math.max(0,n[r]-i[r]),u=Math.max(0,Math.min(d,h));return u!==i[e]?u:null}function ve(l,e,t,i,n=()=>!0){let s=_(e),a=null;for(let[h,r]of i){if(!r||!n(r))continue;let d=r.rect.intersection(t)[s];if(r.rect.area>0&&d>=we){let u=r.rect.getCornerInRect(t)??"topLeft",c=r.rect[u][e]-t[e];(!a||(l==="end"?c<a.offset:c>a.offset))&&(a={key:h,corner:u,offset:c})}}return a}function be(l,e,t,i){if(l==="start")return 0;let n=_(e);return Math.max(0,t[n]-i[n])}function X(l,e,t,i,n){if(t==="start")return l[i]<=n;let s=_(i);return e[s]-(l[i]+l[s])<=n}function pe(l,e,t,i,n,s,a,h,r,d){let u=c=>e==="x"?new y(c,r.y,r.width,r.height):new y(r.x,c,r.width,r.height);if(t){let c=ge(t,e,h,r,d);if(c!=null)return u(c)}if(i&&!n&&(!s||a>0)){let c=u(be(l,e,d,r));return c.equals(r)?null:c}return null}class me{reset(){this.hasSnappedToEdge=!1,this.hadEstimatedVisibleItems=!1,this.wasNearAnchorEdge=!1}captureBeforeLayout(e,t,i){return e?ve(e.edge,e.axis,i,t,e.isAnchorable):null}resolveAfterLayout(e){let{anchorInfo:t,anchor:i,postLayoutInfos:n,previousVisibleRect:s,previousContentSize:a,contentSize:h,itemSizeChanged:r,isScrolling:d,getLayoutInfo:u}=e;if(!t)return null;let c=this.hadEstimatedVisibleItems,o=this.wasNearAnchorEdge,m=!1;for(let V of n.values())if(V.estimatedSize){m=!0;break}if(this.hadEstimatedVisibleItems=m,c||(this.wasNearAnchorEdge=X(s,a,t.edge,t.axis,t.threshold)),s.area===0)return null;let w=t.axis==="x"?"width":"height",S=h[w]-a[w],$=!this.hasSnappedToEdge;if(this.hasSnappedToEdge=!0,!($||S!==0||r))Line truncated
@@ -0,0 +1,2 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./auth-DmBaDwOI.js","./index-CXHBmSa5.js","./vendor-react-Bf71BWbF.js","./index-BMPxGQXj.css"])))=>i.map(i=>d[i]);
import{i as r,d$ as a,e0 as c,_ as u}from"./index-CXHBmSa5.js";const n=(o,e)=>new URL(o.replace(/\/+$/,"")+e,globalThis.location?.href),p=()=>u(()=>import("./auth-DmBaDwOI.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),h={username:"demo",password:"demo"};async function l(o,e){if(r(o))return(await p()).mockDiscovery();const t=await a(n(o,"/api"),{headers:{Accept:"application/json"},cache:"no-store",signal:e});if(!t.ok)throw await c(t);return(await t.json()).auth??null}async function w(o,e){return(await a(n(o,"/api/v1/capabilities"),{headers:{Accept:"application/json"},cache:"no-store",signal:e})).status!==404}function f(o){return o?.mode!=="password"?"token":o.setup_required?"setup":"login"}async function m(o,e,t,s){if(r(o))return(await p()).mockOpenSession(e,t);const i=await a(n(o,`/api/v1/auth/${e}`),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t),cache:"no-store",signal:s},e==="setup");if(!i.ok)throw await c(i);return i.json()}async function A(o,e,t){if(r(o))return;const s=await a(n(o,"/api/v1/auth/logout"),{method:"POST",headers:{Accept:"application/json",Authorization:"Bearer "+e},cache:"no-store",signal:t});if(!s.ok&&s.status!==401)throw await c(s)}export{h as D,w as a,A as c,l as d,m as o,f as s};
@@ -1 +0,0 @@
import{dM as i,dN as r}from"./index-zQjLFfuj.js";const a=(o,e)=>new URL(o.replace(/\/+$/,"")+e,globalThis.location?.href);async function p(o,e){const s=await r(a(o,"/api"),{headers:{Accept:"application/json"},cache:"no-store",signal:e});if(!s.ok)throw await i(s);return(await s.json()).auth??null}async function u(o,e){return(await r(a(o,"/api/v1/capabilities"),{headers:{Accept:"application/json"},cache:"no-store",signal:e})).status!==404}function h(o){return o?.mode!=="password"?"token":o.setup_required?"setup":"login"}async function d(o,e,s,t){const n=await fetch(a(o,`/api/v1/auth/${e}`),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(s),cache:"no-store",signal:t});if(!n.ok)throw await i(n);return n.json()}async function l(o,e,s){const t=await fetch(a(o,"/api/v1/auth/logout"),{method:"POST",headers:{Accept:"application/json",Authorization:"Bearer "+e},cache:"no-store",signal:s});if(!t.ok&&t.status!==401)throw await i(t)}export{u as a,l as c,p as d,d as o,h as s};
@@ -0,0 +1 @@
import{D as r}from"./auth-BGnwk8Hi.js";import{A as o,o as a}from"./index-CXHBmSa5.js";import"./vendor-react-Bf71BWbF.js";const n="demo-session-",c=12*36e5;function f(){return{mode:"password",setup_required:!1}}function w(e,t){if(e==="setup")throw new o(409,"setup_already_completed","Setup already completed");if(t.username!==r.username||t.password!==r.password)throw new o(401,"invalid_credentials","Invalid credentials");return{token:n+a(),expires_at:new Date(Date.now()+c).toISOString()}}function l(e){return!!e?.startsWith(n)}function _(e){const t=()=>Promise.reject(new o(401,"authentication_required","Authentication required"));return new Proxy(e,{get:(i,s,u)=>typeof Reflect.get(i,s,u)=="function"?t:void 0})}export{f as mockDiscovery,w as mockOpenSession,l as mockSessionValid,_ as refuseWithoutSession};
@@ -1 +0,0 @@
import{r as m}from"./vendor-react-Bf71BWbF.js";import{be as h,bf as g,$ as b,cM as w,a1 as D,cL as L,A as _,K as M,cO as y,cP as E,dO as x}from"./index-zQjLFfuj.js";const O=100;function P(e){const t=L(e,e?.resources.dns_log.max_page_size);return t===void 0?void 0:Math.min(O,t)}async function C(e,t,n){try{return{page:await e(t),limit:t.limit}}catch(s){const{limit:r}=t;if(!(s instanceof _&&s.status===503&&s.code==="temporarily_unavailable"&&s.retryAfter!==null)||r===void 0||r<2)throw s;await M(s.retryAfter,n);const c=Math.ceil(r/4);return{page:await e({...t,limit:c}),limit:c}}}function z(e,t){let n=x;return E(async s=>{const r=await C(a=>e.dnsCache(a,t),{cursor:s,limit:n,detail:"summary"},t);return n=r.limit,r.page},(s,r)=>s?(s.entries.push(...r.entries),s):{...r,entries:[...r.entries]})}function W(){const e=h(),{busy:t,run:n,cancel:s}=g({rethrow:!0});return{busy:t!==null,cancel:s,flush:m.useCallback(()=>n("flush",r=>k(e,r)),[e,n])}}function F(e,t=!0){const n=h(),s=e.name?.trim()||void 0,r=e.type&&e.type!=="all"?e.type:void 0,a=e.src?.trim()||void 0,c=b().data,o=P(c),i=w({key:["dnsLog",{name:s,type:r,src:a,limit:o}],fetch:async u=>{const l=await C(f=>n.dnsLog(f,u),{name:s,type:r,src:a,limit:o},u);return{...l.page,limit:l.limit}}},{enabled:t});return{...i,limit:i.data?i.data.limit:o}}const p=new WeakMap,d=new WeakMap;async function G(e,t){const n=d.get(e)??0,s=await z(e,t);return(d.get(e)??0)===n&&p.set(e,{at:Date.now(),list:{...s,entries:[]}}),s}const v=e=>{d.set(e,(d.get(e)??0)+1),p.delete(e)};function k(e,t){return e.flushDnsCache(t).finally(()=>v(e))}function S(e,t,n){return e.deleteDnsEntry(t,n).finally(()=>v(e))}function I(e,t){const n=p.get(e);return n&&Date.now()-n.at<y.background?Promise.resolve(n.list):e.dnsCache({limit:1,detail:"summary"},t)}function N(e=!0,t=!1){const n=h();return w({key:["dnsCache"],every:y.lists,fetch:s=>G(n,s)},{enabled:e,paused:t})}function K(e=!0,t=!1){const n=h();return w({key:["dnsCache",{usage:!0}],every:y.background,fetch:s=>I(n,s)},{enabled:e,paused:t})}function T(e=!1){const t=h(),n=b(),s=n.data?.resources,r=N(D(s,"dns_cache",{whileLoading:!1})&&!!s?.dns_cache.read,e),{refetch:a}=r,{busy:c,error:o,run:i,cancel:u}=g({rethrow:!0});return{capabilities:n,cache:r,busy:c,error:o,cancel:u,remove:m.useCallback(l=>i(l,async f=>{const A=await S(t,l,f);return a(),A}),[t,i,a]),flush:m.useCallback(()=>i("flush",async l=>{const f=await k(t,l);return a(),f}),[t,i,a])}}async function X(e,t,n,s,r){const a=Math.max(1,Math.floor(s));let c;for(let o=0;o<n.length;o+=a){r.throwIfAborted();const i=n.slice(o,o+a),u=await e(t,i,r);r.throwIfAborted(),c?c.results.push(...u.results):c={...u,results:[...u.results]}}if(!c)throw new Error("DNS query requires at least one record type");return c}export{T as a,K as b,W as c,X as q,C as s,F as u};
@@ -0,0 +1 @@
import{r as m}from"./vendor-react-Bf71BWbF.js";import{bo as h,bp as g,a5 as b,cY as w,a7 as D,cX as _,A as L,R as E,c_ as y,c$ as M,e1 as x}from"./index-CXHBmSa5.js";const z=100;function G(e){const t=_(e,e?.resources.dns_log.max_page_size);return t===void 0?void 0:Math.min(z,t)}async function C(e,t,n){try{return{page:await e(t),limit:t.limit}}catch(s){const{limit:r}=t;if(!(s instanceof L&&s.status===503&&s.code==="temporarily_unavailable"&&s.retryAfter!==null)||r===void 0||r<2)throw s;await E(s.retryAfter,n);const c=Math.ceil(r/4);return{page:await e({...t,limit:c}),limit:c}}}function P(e,t){let n=x;return M(async s=>{const r=await C(a=>e.dnsCache(a,t),{cursor:s,limit:n,detail:"summary"},t);return n=r.limit,r.page},(s,r)=>s?(s.entries.push(...r.entries),s):{...r,entries:[...r.entries]})}function W(){const e=h(),{busy:t,run:n,cancel:s}=g({rethrow:!0});return{busy:t!==null,cancel:s,flush:m.useCallback(()=>n("flush",r=>k(e,r)),[e,n])}}function X(e,t=!0){const n=h(),s=e.name?.trim()||void 0,r=e.type&&e.type!=="all"?e.type:void 0,a=e.src?.trim()||void 0,c=b().data,o=G(c),i=w({key:["dnsLog",{name:s,type:r,src:a,limit:o}],fetch:async u=>{const l=await C(f=>n.dnsLog(f,u),{name:s,type:r,src:a,limit:o},u);return{...l.page,limit:l.limit}}},{enabled:t});return{...i,limit:i.data?i.data.limit:o}}const p=new WeakMap,d=new WeakMap;async function R(e,t){const n=d.get(e)??0,s=await P(e,t);return(d.get(e)??0)===n&&p.set(e,{at:Date.now(),list:{...s,entries:[]}}),s}const v=e=>{d.set(e,(d.get(e)??0)+1),p.delete(e)};function k(e,t){return e.flushDnsCache(t).finally(()=>v(e))}function S(e,t,n){return e.deleteDnsEntry(t,n).finally(()=>v(e))}function I(e,t){const n=p.get(e);return n&&Date.now()-n.at<y.background?Promise.resolve(n.list):e.dnsCache({limit:1,detail:"summary"},t)}function N(e=!0,t=!1){const n=h();return w({key:["dnsCache"],every:y.lists,fetch:s=>R(n,s)},{enabled:e,paused:t})}function F(e=!0,t=!1){const n=h();return w({key:["dnsCache",{usage:!0}],every:y.background,fetch:s=>I(n,s)},{enabled:e,paused:t})}function T(e=!1){const t=h(),n=b(),s=n.data?.resources,r=N(D(s,"dns_cache",{whileLoading:!1})&&!!s?.dns_cache.read,e),{refetch:a}=r,{busy:c,error:o,run:i,cancel:u}=g({rethrow:!0});return{capabilities:n,cache:r,busy:c,error:o,cancel:u,remove:m.useCallback(l=>i(l,async f=>{const A=await S(t,l,f);return a(),A}),[t,i,a]),flush:m.useCallback(()=>i("flush",async l=>{const f=await k(t,l);return a(),f}),[t,i,a])}}async function Y(e,t,n,s,r){const a=Math.max(1,Math.floor(s));let c;for(let o=0;o<n.length;o+=a){r.throwIfAborted();const i=n.slice(o,o+a),u=await e(t,i,r);r.throwIfAborted(),c?c.results.push(...u.results):c={...u,results:[...u.results]}}if(!c)throw new Error("DNS query requires at least one record type");return c}export{T as a,F as b,W as c,Y as q,C as s,X as u};
@@ -1 +0,0 @@
import{be as p,$ as f,cL as _,cM as d,cN as y,cO as h,cP as w,cQ as g}from"./index-zQjLFfuj.js";async function v(s,{input:t,resolve:a,recordTypes:i},o){if(a!=="query")return s.routingTrace({input:t,resolve:a},o);const l=await s.dnsQuery(t.domain,i,o),c=l.results.map(e=>({lookup_id:`query:${e.type}`,parent_lookup_id:null,attempt_id:null,purpose:"dial_target",name:l.domain,qtype:e.type,source:e.cached?"cache":"upstream",upstream_transport:null,carrier_transport:null,cache:e.cached?"hit":"miss",cache_entry_id:e.cache_entry_id,upstream:e.upstream,route_evaluation_ids:[],status:e.status,addresses:(e.answers??[]).filter(r=>r.type===e.type).map(r=>r.data),selected_ip:e.type==="A"||e.type==="AAAA"?(e.answers??[]).find(r=>r.type===e.type)?.data??null:null,error:null})),u=[...new Set(["A","AAAA"].flatMap(e=>c.find(r=>r.qtype===e&&r.selected_ip)?.selected_ip??[]))],n=[];for(const e of u.length?u:[null])n.push(await s.routingTrace({input:e?{...t,dst_ip:e}:t,resolve:"none"},o));if(n.some(e=>e.instance_id!==n[0].instance_id||e.generation_id!==n[0].generation_id))throw g(409,"snapshot_unavailable","The routing generation changed during simulation; retry the query","ui.errGenerationChanged");return{...n[0],evaluations:n.flatMap(e=>e.evaluations),dns:c}}function b({connection_id:s,network:t="all",state:a="all"}={},i=!0){const o=p(),{data:l,error:c}=f(),u=_(l,l?.resources.flows.max_page_size);return d({key:["flows",{connection_id:s,network:t,state:a,limit:u}],every:h.lists,fetch:n=>w(e=>o.flows({network:t,state:a,connection_id:s,cursor:e,limit:u,detail:"full"},n),(e,r)=>e?(e.flows.push(...r.flows),e):{...r,flows:[...r.flows]})},y(l,c,i))}function k(s){const t=p();return d({key:["flow",{id:s}],fetch:a=>s?t.flow(s,a):Promise.resolve(null),acceptEvent:a=>a.event!=="flow.updated"||a.data.resource_id===s},{enabled:s!==null})}function m(s=!0){const t=p();return d({key:["rules"],every:0,fetch:a=>t.rules(a)},{enabled:s})}export{b as a,k as b,v as r,m as u};
@@ -0,0 +1 @@
import{bo as p,a5 as f,cX as _,cY as d,cZ as y,c_ as h,c$ as w,d0 as g}from"./index-CXHBmSa5.js";async function v(s,{input:t,resolve:a,recordTypes:i},o){if(a!=="query")return s.routingTrace({input:t,resolve:a},o);const l=await s.dnsQuery(t.domain,i,o),c=l.results.map(e=>({lookup_id:`query:${e.type}`,parent_lookup_id:null,attempt_id:null,purpose:"dial_target",name:l.domain,qtype:e.type,source:e.cached?"cache":"upstream",upstream_transport:null,carrier_transport:null,cache:e.cached?"hit":"miss",cache_entry_id:e.cache_entry_id,upstream:e.upstream,route_evaluation_ids:[],status:e.status,addresses:(e.answers??[]).filter(r=>r.type===e.type).map(r=>r.data),selected_ip:e.type==="A"||e.type==="AAAA"?(e.answers??[]).find(r=>r.type===e.type)?.data??null:null,error:null})),u=[...new Set(["A","AAAA"].flatMap(e=>c.find(r=>r.qtype===e&&r.selected_ip)?.selected_ip??[]))],n=[];for(const e of u.length?u:[null])n.push(await s.routingTrace({input:e?{...t,dst_ip:e}:t,resolve:"none"},o));if(n.some(e=>e.instance_id!==n[0].instance_id||e.generation_id!==n[0].generation_id))throw g(409,"snapshot_unavailable","The routing generation changed during simulation; retry the query","ui.errGenerationChanged");return{...n[0],evaluations:n.flatMap(e=>e.evaluations),dns:c}}function b({connection_id:s,network:t="all",state:a="all"}={},i=!0){const o=p(),{data:l,error:c}=f(),u=_(l,l?.resources.flows.max_page_size);return d({key:["flows",{connection_id:s,network:t,state:a,limit:u}],every:h.lists,fetch:n=>w(e=>o.flows({network:t,state:a,connection_id:s,cursor:e,limit:u,detail:"full"},n),(e,r)=>e?(e.flows.push(...r.flows),e):{...r,flows:[...r.flows]})},y(l,c,i))}function k(s){const t=p();return d({key:["flow",{id:s}],fetch:a=>s?t.flow(s,a):Promise.resolve(null),acceptEvent:a=>a.event!=="flow.updated"||a.data.resource_id===s},{enabled:s!==null})}function m(s=!0){const t=p();return d({key:["rules"],every:0,fetch:a=>t.rules(a)},{enabled:s})}export{b as a,k as b,v as r,m as u};
@@ -1,78 +0,0 @@
import{A as w,c as wt,d as ot,f as vt,i as yt,g as st,j as re,k as ce,m as kt,o as xt,p as St,q as It,t as At,v as Mt,x as $t,y as Nt,z as rt,C as Ot,D as Dt,F as _e,G as Ct,H as ne,J as Ge,K as Rt,N as ke,O as ie}from"./index-zQjLFfuj.js";import{d as oe,m as Te,v as jt,g as Pt,a as Et}from"./geodata-DprMPspn.js";import"./vendor-react-Bf71BWbF.js";const ve=Date.now(),z=e=>new Date(ve-e*1e3).toISOString(),q=e=>new Date(ve+e*1e3).toISOString(),F=z(0),W="mock-instance-1",Me="40",Z={observed_at:F,profiles:["base","full_transparency"],limits:{max_request_target_bytes:4096,max_header_bytes:16384,max_json_body_bytes:65536},resources:{runtime:{available:!0},runtime_memory:{available:!0,metrics:["process.rss_bytes","cgroup.current_bytes","cgroup.limit_bytes","cgroup.events.high","cgroup.events.oom","cgroup.events.oom_kill","kernel.ebpf_bytes"]},datapath:{available:!0,kinds:["ebpf"],details:["attachments","maps"]},runtime_outbounds:{available:!0},traffic_history:{available:!0,max_window_seconds:604800,max_points:360},memory_history:{available:!0,max_window_seconds:604800,max_points:720},nodes:{available:!0,can_manage:!0},providers:{available:!0,can_refresh:!0,can_manage:!0,create_options:{update_interval:86400,user_agent:"honk/0.0.1-alpha",cache:!0},max_page_size:1e3},geodata:{available:!0,can_update:!0,assets:["geosite","geoip"],configurable_sources:!0},rules:{available:!0,max_rules:4096},config:{available:!0,content:!0,writable:!0,create:!0,max_bytes:1048576,max_sources:32},config_validate:{available:!0,modes:["syntax","full"],max_bytes:1048576,max_sources:32},logs:{available:!0,levels:["trace","debug","info","warn","error"],max_buffered_records:4096},dns_log:{available:!0,max_records:2048,max_page_size:500},runtime_settings:{available:!0,fields:["log.level","log.buffered_records","dns_log.max_records","flows.max_flows","flows.retention_seconds","record_flows","record_logs","record_dns_log","geodata"]},groups:{available:!0,config_patch:!0,selection:!0,max_patch_operations:32},probes:{available:!0,targets:["node","group"],kinds:["tcp_connect","http","dns"],purposes:["data","dns"],transports:["tcp","udp"],ip_versions:["ipv4","ipv6"],limits:{max_members_per_job:64,max_results_per_job:256,max_active_jobs:4,max_queued_jobs:16,max_concurrent_per_target:1,job_timeout_ms:3e4,per_principal_requests_per_minute:60,global_requests_per_minute:120}},connections:{available:!0,can_close:!0,max_bulk_close:200},flows:{available:!0,recording:"on",scopes:["userspace_tcp","userspace_udp","kernel_direct","kernel_block","dns_intercept","kernel_bypass"],max_flows:4096,max_steps_per_flow:64,retention_seconds:300,snapshot_ttl_seconds:60,max_page_size:1e3},routing_trace:{available:!0,resolve_modes:["none","live"],max_addresses:16,max_rule_steps:128,timeout_ms:5e3,per_principal_requests_per_minute:60,global_requests_per_minute:120},events:{available:!0,kinds:["stream.ready","runtime.updated","flow.updated","flow.gap","operation.updated","generation.changed"],retention_seconds:300,max_buffered_events:1024,max_clients:16,heartbeat_seconds:15},dns_query:{available:!0,record_types:["A","AAAA","HTTPS"],limits:{max_types_per_request:8,query_timeout_ms:5e3,max_response_bytes:65536,per_principal_requests_per_minute:60,global_requests_per_minute:120}},dns_cache:{available:!0,read:!0,delete_entry:!0,delete_name:!0,flush:!0,entry_kinds:["positive","negative"]},operations:{available:!0,retention_seconds:300},reload:{available:!0},suspend:{available:!0},resume:{available:!0}}},Lt={...Z,profiles:["base"],resources:{...Z.resources,runtime_outbounds:{available:!1},traffic_history:{available:!1},memory_history:{available:!1},logs:{available:!1},dns_log:{available:!1},runtime_settings:{available:!1},geodata:{available:!1},rules:{available:!1},nodes:{available:!0,can_manage:!1},providers:{available:!0,can_refresh:!0,can_manage:!1,max_page_size:1e3},config:{available:!1,content:!1,create:!1},config_validate:{available:!1},flows:{...Z.resources.flows,available:!1},routing_trace:{...Z.resources.routing_trace,available:!1},events:{...Z.resources.events,available:!1}}},Gt={...Z,profiles:["base"],resources:{...Object.fromEntries(Object.keys(Z.resources).map(e=>[e,{available:!1}])),runtime:{available:!0},connections:{available:!0,can_close:!1,max_bulk_close:1e3},config:{available:!1,content:!1,create:!1}}},je=[{id:"r1",cond:"domain(suffix: doubleclick.net)",target:"block",must:!1},{id:"r2",cond:"pname(NetworkManager, systemd-resolved) && l4proto(udp) && dport(53)",target:"direct",must:!0},{id:"r3",cond:"dip(geoip: private)",target:"direct",must:!0},{id:"r4",cond:"domain(geosite: cn)",target:"direct",must:!1},{id:"r5",cond:"domain(geosite: telegram)",target:"proxy",must:!1},{id:"r6",cond:"mac(aa:bb:cc:dd:ee:ff) && ipversion(4)",target:"direct",must:!1},{id:"r7",cond:"domain(geosite: discord)",target:"proxy",must:!1},{id:"r8",cond:"sip(10.0.0.0/24) && dport(25)",target:"block",must:!1}],ae={proxy:{kind:"selector",native:"fixed(0)"},resilient:{kind:"urltest",native:"minLine truncated
tproxy_port: 12345
log_level: info
lan_interface: br-lan
wan_interface: auto
allow_insecure: false
auto_config_kernel_parameter: true
}
subscription {
sub-c: 'https://sub.example.net/api/v1/client/subscribe?token=demo'
}
node {
'hk-01': 'vless://demo@hk-01.example.net:443?security=tls#hk-01'
'hk-02': 'vless://demo@hk-02.example.net:443?security=tls#hk-02'
'sg-01': 'trojan://demo@sg-01.example.net:443#sg-01'
'jp-01': 'vless://demo@jp-01.example.net:443?security=tls#jp-01'
'us-01': 'anytls://demo@us-01.example.net:443#us-01'
}
group {
proxy { policy: ${ae.proxy.native} }
resilient { filter: name(hk-01, sg-01, us-01) policy: ${ae.resilient.native} }
gaming { filter: name(jp-01, hk-02) policy: ${ae.gaming.native} }
skylink { filter: subtag(sub-c) policy: ${ae.skylink.native} }
}
dns {
upstream {
cloudflare: 'tls://1.1.1.1:853'
alidns: 'udp://223.5.5.5:53'
}
routing {
request { qname(geosite: cn) -> alidns; fallback: cloudflare }
}
}
routing {
domain(suffix: doubleclick.net) -> block
pname(NetworkManager, systemd-resolved) && l4proto(udp) && dport(53) -> direct(must)
dip(geoip: private) -> direct(must)
domain(geosite: cn) -> direct
domain(geosite: telegram) -> proxy
include rules.dae
fallback: resilient
}
include {
config.d/*.dae
}
`,zt=`# Household exceptions, kept apart from config.dae.
# The TV never leaves through a node.
mac(aa:bb:cc:dd:ee:ff) && ipversion(4) -> direct
# Chat
domain(geosite: discord) -> proxy
sip(10.0.0.0/24) && dport(25) -> block
`,Ue=`'香港 01 IPLC': 'vless://<redacted>'
'香港 02 BGP': 'vless://<redacted>'
'新加坡 01 2x': 'trojan://<redacted>'
'日本 01 2x': 'vless://<redacted>'
`,Ut=`# Written by honk from the subscription; edits are lost on refresh.
skylink { filter: subtag(sub-c) }
`,Ft=[{level:"warning",source_id:"src-main",line:5,column:3,span:null,code:"interface_auto",message:"wan_interface: auto is resolved at start; a changed default route needs a reload"},{level:"warning",source_id:"src-rules",line:3,column:1,span:null,code:"mac_unseen",message:"mac(aa:bb:cc:dd:ee:ff) has not been seen on the LAN since start"},{level:"info",source_id:"src-sub-c",line:1,column:null,span:null,code:"subscription_cached",message:"Subscription fetched 30 minutes ago; nodes come from the cache"}],Ht=[{id:"src-main",path:"/etc/honk/config.dae",kind:"main",writable:!0,loaded_at:z(3600),content:Tt},{id:"src-rules",path:"/etc/honk/rules.dae",kind:"include",writable:!0,loaded_at:z(3600),content:zt},{id:"src-sub-c",path:"/var/lib/honk/subscriptions/sub-c.dae",kind:"subscription",writable:!1,loaded_at:z(1800),content:Ue,onDisk:Ue.replaceAll("<redacted>","demo@edge.example.net:443")},{id:"src-generated",path:"/var/lib/honk/generated/skylink.dae",kind:"generated",writable:!1,loaded_at:z(1800),content:Ut}];function de(e){const t=new Map;return(o,i={})=>{const{cursor:d,limit:a=1e3,...s}=i,r=wt([e,s]);if(!Number.isSafeInteger(a)||a<1)throw new w(400,"invalid_request","Invalid page size");for(const[k,I]of t)I.expires<=Date.now()&&t.delete(k);const[c,l,b]=d?.split(":")??[ot(),"0"],f=Number(l);let g=d?t.get(c):void 0;if(d&&(b!==void 0||!g||g.key!==r||!Number.isSafeInteger(f)||f<1||f>=g.items.length))throw new w(e==="flows"?410:400,e==="flows"?"snapshot_expired":"invalid_request","Unknown or expired cursor");if(!g){if(o.length<=a)return{items:structuredClone(o),total:o.length,next_cursor:null};g={items:structuredClone(o),key:r,expires:Date.now()+3e4},t.size>=32&&t.delete(t.keys().next().value),t.set(c,g)}const h=f+a;return{items:structuredClone(g.items.slice(f,h)),total:g.items.length,next_cursor:h<g.items.length?`${c}:${h}`:null}}}function V(e,t){if(e===void 0)throw new w(404,"resource_not_found",`${t} not found`);return e}function $e(e){const t=URL.parse(e);return t?t.origin+t.pathname+(t.search?"?[redacted]":""):null}const Bt=new Set(["global","subscription","node","group","dns","routing","upstream","request","response","include"]),Fe=new Set(It),Jt=new Set(St),Kt=e=>e===""?0:e.replace(/\n$/,"").split(`
`).length;async function fe({onDisk:e,...t}){const o=e??t.content;return{...t,content_sha256:await vt(o),bytes:new TextEncoder().encode(o).length,line_count:Kt(o)}}function ue(e,t,o=!1){const{blocks:i}=re(e),d=i.filter(a=>a.name===t).flatMap(a=>kt(e,a).filter(s=>!s.block));return o&&!i.length&&d.push({from:0,to:e.length,block:void 0}),d.flatMap(({from:a,to:s})=>{const r=e.slice(0,a).split(`
`).length;return e.slice(a,s).split(`
`).map((c,l)=>({code:xt(c).trim(),raw:c,line:r+l}))})}function Ne(e){return[...ue(e,"include").filter(({code:t})=>t).map(({code:t,line:o})=>({path:ce(t),line:o})),...ue(e,"routing",!0).flatMap(({code:t,line:o})=>{const i=/^include\s+(\S+)$/.exec(t);return i?[{path:ce(i[1]),line:o}]:[]})]}const Q=(e,t)=>new URL(t,new URL(e??"","file:///")).pathname,He=(e,t,o)=>e.filter(i=>st(Q(t,o),Q(void 0,i.path)));function at(e,t,o,i){const d=[],a=(l,b,f,g,h)=>d.push({level:f,source_id:e,line:l,column:b,span:null,code:g,message:h}),{blocks:s,tokens:r}=re(t),c=l=>{l.depth===0&&!Bt.has(l.name)&&a(l.line+1,1,"error","unknown_section",`Unknown section "${l.name}"`),l.close===t.length&&a(l.line+1,1,"error","section_not_closed",`Section "${l.name}" is never closed`),l.children.forEach(c)};s.forEach(c);for(const l of r)l.kind==="symbol"&&l.depth===0&&t[l.from]==="}"&&a(l.line+1,1,"error","brace_without_section","Closing brace without an open section");for(const{code:l,line:b}of ue(t,"global")){if(!l)continue;const f=/^([\w.-]+)\s*:\s*(.*)$/.exec(l);f?Jt.has(f[1])||a(b,1,"error","unknown_key",`Unknown global setting "${f[1]}"`):a(b,1,"error","not_a_setting",'Expected "<key>: <value>"')}return ue(t,"routing",!0).forEach(({code:l,raw:b,line:f})=>{if(!l||/^include\s+\S+$/.test(l))return;const g=/^fallback:\s*(\S+)$/.exec(l),h=/^(.+?)\s*->\s*(\S+)$/.exec(l),k=g?.[1]??h?.[2];if(!k){a(f,1,"error","not_a_rule",'Expected "<condition> -> <outbound>", "include <file>" or "fallback: <outbound>"');return}const I=k.replace(/\(.*\)$/,"");i==="full"&&!Fe.has(k)&&!Fe.has(I)&&!o.has(I)&&a(f,b.lastIndexOf(k)+1,"error","unknown_outbound",`No group named "${I}"`),h&&!/\w\(/.test(h[1])&&a(f,1,"warning","bare_condition","Condition has no function call; it will never match")}),d}function Vt(e){return new Set(re(e).blocks.filter(t=>t.name==="group").flatMap(t=>t.children.map(o=>o.name)))}function xe(e,t,o=[]){const i=e.sources.map((s,r)=>({...s,id:s.id??`source-${r+1}`}));if(new Set(i.map(s=>s.id)).size!==i.length)throw new w(400,"invalid_request","Source IDs must be unique");const d=[];if(e.mode==="full"){const s=new Map([...o,...i].filter(c=>c.path).map(c=>[Q(void 0,c.path),c])),r=new Set(i.map(c=>c.path&&Q(void 0,c.path)));for(let c=0;c<i.length;c++){const l=i[c];for(const{path:b,line:f}of Ne(l.content)){const g=Q(l.path,b);if(yt(b)){for(const[k,I]of s)st(g,k)&&!r.has(k)&&(r.add(k),i.push({...I,id:I.id??`source-${i.length+1}`}));continue}const h=s.get(g);h?r.has(g)||(r.add(g),i.push({...h,id:h.id??`source-${i.length+1}`})):d.push({source_id:l.id,line:f,column:1,span:null,level:"error",code:"include_not_found",message:`Include "${b}" cannot be resolved`})}}}const a=e.mode==="full"?new Set(i.flatMap(s=>[...Vt(s.content)])):new Set;return d.push(...i.flatMap(s=>at(s.id,s.content,a,e.mode))),{valid:!d.some(s=>s.level==="error"),diagnostics:d,generation_id:t,validated_at:new Date().toISOString()}}function Wt(e,t,{enqueue:o,log:i,publish:d,eventData:a,trimLogs:s},r,c,l){const b=structuredClone(ze),f=()=>{const v=structuredClone(b);return e.resources.geodata.configurable_sources===!0&&(v.geodata=l.settings()),v};let g=null,h=[],k;const I=()=>k??=Promise.all(Ht.map(fe)).then(v=>(g=v,h=[...v],v));let C=40,n=0;const u=v=>v.kind==="main"||v.kind==="include";function p(v,y=h){const S=[],M=L=>{if(S.some(B=>B.id===L.id))return;const U=L.id===v?.id?v.content:L.content;S.push({id:L.id,path:L.path,content:U});for(const{path:B}of Ne(U))He(y,L.path,B).forEach(M)},G=y.find(L=>L.kind==="main");return G&&M(G),S}function _(){const v=String(C+1),y=p();y.length&&c(y.map(M=>M.content).join(`
`),v),g&&(g=[...h],l.follow(A(g).rules.flatMap(M=>M.kind==="rule"?[M.expression]:[]))),C+=1,Object.assign(b,structuredClone(ze),{observed_at:new Date().toISOString()}),i("info","honk::routing","Routing generation published.",{generation_id:String(C)});const S=String(C);return t.generation={...t.generation,active_id:S,config_revision:S,activated_at:new Date().toISOString()},d({id:"",event:"generation.changed",data:{...a(),generation_id:S,previous_generation_id:String(C-1)}}),S}async function x(v){await I();const y=V(h.find(M=>M.kind==="main"),"Main source"),S=await fe({...y,content:v(y.content),loaded_at:new Date().toISOString()});return()=>{if(h.find(M=>M.id===y.id)!==y)throw new w(412,"stale_revision","The main source changed before activation");return h=h.map(M=>M.id===y.id?S:M),_()}}function A(v){const y=new Map(v.map(m=>[Q(void 0,m.path),m])),S=new Map(it.rules.map(m=>[m.cond+" -> "+m.target+(m.must?"(must)":""),m.id])),M=[];let G=null;const L=new Set,U=(m,N)=>{if(!L.has(m.id)){L.add(m.id),ue(m.content,"routing",N).forEach(({code:D,raw:R,line:O})=>{const E=/^include\s+(\S+)$/.exec(D);if(E){const Le=y.get(Q(m.path,E[1]));Le&&U(Le,!0);return}const j=/^fallback:\s*(\S+)$/.exec(D),T=/^(.+?)\s*->\s*(\S+)$/.exec(D);if(!j&&!T)return;const J=R.search(/\S/),ye=new TextEncoder().encode(R.slice(0,J)).length+1,K={file:m.path.split("/").pop(),source_id:m.id,line:O,column:ye};if(j){G={outbound:j[1],source:K},M.push({rule_id:"fallback",index:M.length,expression:D,outbound:j[1],must:!1,source:K,kind:"fallback"});return}const ht=T[2].endsWith("(must)"),bt=T[2].replace(/\(must\)$/,"");M.push({rule_id:S.get(D)??`${K.file}:${K.line}`,index:M.length,expression:T[1],outbound:bt,must:ht,source:K,kind:"rule"})});for(const{path:D}of Ne(m.content))He(v,m.path,D).forEach(R=>U(R,!0))}},B=v.find(m=>m.kind==="main");return B&&U(B,!1),{rules:M,fallback:G}}const $=async()=>{await I();const{rules:v,fallback:y}=A(g);if(!y)throw new w(503,"snapshot_unavailable","The routing section has no fallback",null,null,1);return{generation_id:String(C),rules:v,fallback:y}};return{api:{rules:async v=>{if(v?.throwIfAborted(),!e.resources.rules.available)throw new w(404,"capability_not_supported","The rule list is unavailable");return $()},config:async v=>{if(v?.throwIfAborted(),!e.resources.config.available)throw new w(404,"capability_not_supported","Configuration readback is unavailable");await I();const y=g,S=String(C),M=r();return{generation_id:S,revision:S,sources:y.map(G=>e.resources.config.content?{...G}:{...G,content:void 0}),diagnostics:[...y.filter(u).flatMap(G=>at(G.id,G.content,M,"full").filter(L=>L.level!=="error")),...Ft],secrets_redacted:!0}},validateConfig:async(v,y)=>{if(y?.throwIfAborted(),!e.resources.config_validate.available)throw new w(404,"capability_not_supported","Validation is unavailable");if(!e.resources.config_validate.modes?.includes(v.mode))throw new w(400,"invalid_request",`Mode ${v.mode} is not advertised`);return v.mode==="full"&&await I(),xe(v,String(C),h.filter(u))},replaceConfigSource:async(v,y,S,M)=>{M?.throwIfAborted(),await I();const L=V(h.find(m=>m.id===v),"Configuration source");if(!e.resources.config.writable||!L.writable)throw new w(403,"permission_denied","This source is read-only");if(!S)throw new w(428,"precondition_required","If-Match is required");if(S.replace(/^"|"$/g,"")!==L.content_sha256)throw new w(412,"stale_revision","The source changed on disk; fetch it again before retrying");const U=xe({sources:p({id:v,content:y}),mode:"full"},String(C));if(!U.valid)throw new w(422,"unsupported_value","Validation found errors; nothing was written",null,{diagnostics:U.diagnostics});const B=await fe({...L,content:y,loaded_at:new Date().toISOString()});return h=h.map(m=>m.id===v?B:m),i("info","honk::config","Configuration source replaced; reloading.",{source_id:v}),o("reload",()=>{const m=_();return{active_generation_id:m,datapath_generation_id:m}})},createConfigSource:async(v,y,S)=>{S?.throwIfAborted();const M=e.resources.config;if(!M.available||!M.create)throw new w(404,"capability_not_supported","Creating configuration sources is unavailable");if(!M.writable)throw new w(403,"permission_denied","Configuration writes are disabled");if(At(v)||new TextEncoder().encode(v).length>1024)throw new w(400,"invalid_request","path must be a relative .dae path with normal segments");await I();const G=V(h.find(m=>m.kind==="main"),"Main source"),L=Q(G.path,v);if(h.some(m=>Q(void 0,m.path)===L))throw new w(409,"state_conflict",`${v} already exists`);if(!Mt($t(G.content),v)){const m={level:"error",source_id:G.id,line:null,column:null,span:null,code:"source-not-included"};throw new w(422,"unsupported_value","No include pattern matches the path; nothing was written",null,{diagnostics:[{...m,message:`No include pattern matches ${v}`}]})}const U=await fe({id:`src-new-${++n}`,path:L,kind:"include",writable:!0,loaded_at:new Date().toISOString(),content:y}),B=xe({sources:p(void 0,[...h,U]),mode:"full"},String(C));if(!B.valid)throw ne Line truncated
`);e=e.slice(0,s.close)+`
`+c+`
`+e.slice(s.close);for(const l of r.reverse())e=e.slice(0,l.from)+e.slice(l.to);return e}function Be(e){try{return e()}catch{throw new w(422,"unsupported_value","The value cannot be written to the configuration")}}const Je=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function sn(e,t,{enqueue:o,log:i,pending:d},a,s,r,c){const l=de("nodes"),b=de("providers"),f=structuredClone(Yt),{nodes:g,groups:h}=Qt(Number.isFinite(t)?t:120);for(const n of f)n.node_count=g.filter(u=>u.provider_id===n.id).length;const k=new Map,I=new Set;return{api:{nodes:async(n,u)=>{if(u?.throwIfAborted(),!e.resources.nodes.available)throw new w(404,"capability_not_supported","Nodes are unavailable");const p=l(n?.group_id?g.filter(_=>_.group_ids.includes(n.group_id)):g,n);return{observed_at:F,nodes:p.items,next_cursor:p.next_cursor}},groups:async n=>{if(n?.throwIfAborted(),!e.resources.groups.available)throw new w(404,"capability_not_supported","Groups are unavailable");return h.map(u=>({id:u.id,name:u.name,icon:u.icon,config_revision:u.config_revision,policy:{...u.policy},member_count:u.members.length,selection:{tcp_member_id:u.runtime.selection.tcp?.member_id??null,udp_member_id:u.runtime.selection.udp?.member_id??null}}))},group:async(n,u)=>{if(u?.throwIfAborted(),!e.resources.groups.available)throw new w(404,"capability_not_supported","Groups are unavailable");return structuredClone(V(h.find(p=>p.id===n),"Group"))},selectGroup:async(n,u,p)=>{p?.throwIfAborted();const _=V(h.find(y=>y.id===n),"Group"),x=!_.capabilities.can_select&&_.capabilities.can_override;if(!_.capabilities.can_select&&!x)throw new w(404,"capability_not_supported","Group does not support manual selection");V(_.members.find(y=>y.id===u.member_id),"Group member");const A=u.network==="both"?["tcp","udp"]:[u.network];let $=!1;for(const y of A){const S=_.runtime.selection[y]?.member_id;_.runtime.selection[y]={member_id:u.member_id,resolved_leaf_node_id:ge(u.member_id,y,g,h)?.id??null,source:x?"override":"runtime"},!(S===u.member_id||!_.config.interrupt_connections)&&($=r(n,y)||$)}const P=(k.get(n)??0n)+1n;k.set(n,P);const v={group_id:n,member_id:u.member_id,network:u.network,source:x?"override":"runtime",selection_revision:String(P),connections_interrupted:$};return u.network!=="both"&&(v.resolved_leaf_node_id=_.runtime.selection[u.network]?.resolved_leaf_node_id),v},clearGroupOverride:async(n,u,p)=>{p?.throwIfAborted();const _=V(h.find(P=>P.id===n),"Group");if(!_.capabilities.can_override)throw new w(409,"state_conflict","Group has no override to clear");const x=u==="both"?["tcp","udp"]:[u],A=Xt(_);for(const P of x)_.runtime.selection[P]={member_id:A,resolved_leaf_node_id:ge(A,P,g,h)?.id??null,source:"policy"};const $=(k.get(n)??0n)+1n;return k.set(n,$),{group_id:n,network:u,selection_revision:String($),connections_interrupted:!1,selection:structuredClone(_.runtime.selection)}},patchGroup:async(n,u,p,_)=>{_?.throwIfAborted();const x=V(h.find(v=>v.id===n),"Group");if(p!=='"'+x.config_revision+'"')throw new w(412,"stale_revision","Group configuration revision changed");if(I.has(n))throw new w(409,"state_conflict","Group update is pending");const A=e.resources.groups.max_patch_operations;if(A!==void 0&&u.length>A)throw new w(413,"request_too_large","Too many patch operations");const $=tn(x,u),P=await s(v=>on(v,x.name,$));return I.add(n),o("group_update",()=>{I.delete(n);const v=P();return{group_id:n,config_revision:v}})},startProbe:async(n,u)=>{u?.throwIfAborted();const p=e.resources.probes;if(!p.available)throw new w(404,"capability_not_supported","Probes are unavailable");const _=n.ip_version==="any"?["ipv4","ipv6"]:[n.ip_version];if(!p.targets?.includes(n.target.type)||!p.kinds?.includes(n.kind)||!p.purposes?.includes(n.purpose)||n.transport.some(y=>!p.transports?.includes(y))||_.some(y=>!p.ip_versions?.includes(y)))throw new w(422,"unsupported_value","Probe dimensions are not advertised");const x=n.target,A=x.type==="group"?V(h.find(y=>y.id===x.group_id),"Group"):void 0;if(x.type==="node"&&V(g.find(y=>y.id===x.node_id),"Node"),!n.transport.length||n.transport.some(y=>A&&!A.capabilities.probe_transports.includes(y))||n.kind!=="dns"&&(n.purpose!=="data"||n.transport.some(y=>y!=="tcp"))||n.kind==="dns"&&n.purpose!=="dns")throw new w(422,"unsupported_value","Unsupported probe dimensions");if(A&&Array.isArray(n.members)&&n.members.some(y=>!A.members.some(S=>S.id===y)))throw new w(422,"unsupported_value","Probe member is not in this group");const $=lt(n,g,h).length,P=p.limits;if($>P.max_members_per_job||$*n.transport.length*_.length>P.max_results_per_job)throw new w(413,"request_too_large","Probe exceeds the advertised member or result limit");const v=structuredClone(n);return o("probe",()=>en(v,g,h,new Date().toISOString()))},providers:async(n,u)=>{if(u?.throwIfAborted(),!e.resources.providers.available)throw new w(404,"capability_not_supported","Providers are unavailable");const p=e.resources.providers.max_page_size??1e3;if(n?.limit!==void 0&&n.limit>p)throw new w(400,"inva Line truncated
`),y=Be(()=>v.length?` ${Ge(n.name)}: {
url: ${ne(n.url)}
${v.join("")} }
`:` ${Ge(n.name)}: ${ne(n.url)}
`),S=await s(M=>M.replace(/^(subscription \{\n)/m,`$1${y}`));return i("info","honk::subscription","Subscription added.",{provider:n.name}),S(),structuredClone(V(f.find(M=>M.name===n.name),"Provider"))},deleteProvider:async(n,u)=>{if(u?.throwIfAborted(),!e.resources.providers.can_manage)throw new w(404,"capability_not_supported","Provider management is unavailable");const p=f.findIndex($=>$.id===n);if(p<0)return{deleted:0};if(f[p].kind==="inline")throw new w(404,"capability_not_supported","The inline provider is the node section itself");const _=f[p],x=Je(_.name),A=await s($=>$.replace(new RegExp(`^\\s*${x}:\\s*\\{\\n[\\s\\S]*?\\n\\s*\\}\\n|^\\s*${x}:.*\\n`,"m"),""));return i("info","honk::subscription","Subscription removed.",{provider:_.name}),A(),{deleted:1}},createNode:async(n,u)=>{if(u?.throwIfAborted(),!e.resources.nodes.can_manage)throw new w(404,"capability_not_supported","Node management is unavailable");const p=/^([a-z][a-z0-9+.-]*):\/\/\S+$/i.exec(n.link.trim())?.[1]?.toLowerCase();if(!p||!Zt.includes(p))throw new w(422,"unsupported_value",`Unsupported share link scheme "${p??""}"`);if(g.some(A=>A.name===n.name))throw new w(409,"state_conflict",`An inline node named ${n.name} already exists`);const _=Be(()=>` ${ne(n.name)}: ${ne(n.link.trim())}
`),x=await s(A=>A.replace(/^(node \{\n)/m,`$1${_}`));return i("info","honk::config","Node added.",{node:n.name,protocol:p}),x(),structuredClone(V(g.find(A=>A.name===n.name),"Node"))},deleteNode:async(n,u)=>{if(u?.throwIfAborted(),!e.resources.nodes.can_manage)throw new w(404,"capability_not_supported","Node management is unavailable");const p=g.find(x=>x.id===n);if(!p)return{deleted:0};if(p.provider_id!=="inline")throw new w(404,"capability_not_supported","Only inline nodes can be deleted; refresh or delete the provider instead");const _=await s(x=>x.replace(new RegExp(`^\\s*'${Je(p.name)}':.*\\n`,"m"),""));return i("info","honk::config","Node removed.",{node:p.name}),_(),{deleted:1}},geodata:async n=>{if(n?.throwIfAborted(),!e.resources.geodata.available)throw new w(404,"capability_not_supported","Geodata is unavailable");return c.status()},updateGeodata:async n=>{if(n?.throwIfAborted(),!e.resources.geodata.can_update)throw new w(404,"capability_not_supported","Geodata update is unavailable");if(d("geodata_update"))throw new w(409,"state_conflict","A geodata update is already queued or running");return o("geodata_update",()=>{const u=c.update();return i("info","honk::geodata","Geodata updated; reloading.",{assets:u.assets.map(p=>p.kind)}),a(),u})}},groupNames:()=>new Set(h.map(n=>n.name)),groupIds:()=>new Set(h.map(n=>n.id)),activate:(n,u)=>nn(n,u,g,h,f)}}const rn=[{level:"info",target:"honk::main",message:"Runtime snapshot captured.",fields:{pid:1842}},{level:"info",target:"honk::config",message:"Configuration state checked.",fields:{sources:4,generation_id:"40"}},{level:"info",target:"honk::subscription",message:"Subscription status checked.",fields:{provider:"sub-c"}},{level:"warn",target:"honk::subscription",message:"Subscription served from cache.",fields:{provider:"sub-c",age_seconds:1800}},{level:"warn",target:"honk::datapath",message:"Routing map sample delayed.",fields:{interface:"lan0"}},{level:"info",target:"honk::dns",message:"DNS listener healthy.",fields:{bind:"127.0.0.1:5353"}},{level:"info",target:"honk::routing",message:"Routing generation checked.",fields:{generation_id:"40"}},{level:"error",target:"honk::group",message:"Health check failed.",fields:{node:"jp-01",error:"connect timeout"}},{level:"info",target:"honk::api",message:"Native API request served.",fields:{listen:"127.0.0.1:9090"}}];function an(e,t,o,i,d,a=2500){const s=new Map;let r=0;const c=new Set,l=[],b=new Map,f=new Map,g=()=>{for(;l.length&&Date.now()-Date.parse(l[0].data.observed_at)>t.retention_seconds*1e3;)l.shift();const m=l.length?Number(l[0].id.split(":")[1])-1:r,N=A.length?Number(A[0].id.split(":")[2])-1:P;for(const[D,R]of b)(R.position<(R.stream==="events"?m:N)||R.stream==="events"&&Date.now()-R.issued>t.retention_seconds*1e3)&&(b.delete(D),f.delete(JSON.stringify([R.stream,R.filter,R.position])))},h=(m,N,D)=>{const R=JSON.stringify([m,N,D]),O=f.get(R);if(O)return O;const E=ot();return b.set(E,{stream:m,filter:N,position:D,issued:Date.now()}),f.set(R,E),E},k=(m,N,D,R)=>{if(m===void 0)return R;g();const O=b.get(m);if(!O||O.stream!==N||O.filter!==D)throw new w(409,"event_cursor_expired","The stream cursor cannot be replayed");return O.position};let I;const C=()=>({instance_id:W,observed_at:new Date().toISOString()});function n(m){m.id=`${W}:${++r}`,l.push(m),l.length>t.max_buffered_events&&l.shift(),g(),c.forEach(N=>N(m))}function u(){o.observed_at=new Date().toISOString(),n({id:"",event:"runtime.updated",data:{...C(),href:"/api/v1/runtime"}})}const p=(m,N)=>{const D="op-"+(s.size+1),R=new Date().toISOString(),O={operation_id:D,kind:m,created_at:R,started_at:R};s.set(D,{...O,finished_at:null,status:"running",result:null,error:null,retryAfter:1}),n({id:"",event:"operation.updated",data:{...C(),resource_id:D,status:"running",href:"/api/v1/operations/"+D}}),setTimeout(()=>{try{s.set(D,{...O,status:"succeeded",result:N(),error:null,finished_at:new Date().toISOString()})}catch(T){s.set(D,{...O,status:"failed",finished_at:new Date().toISOString(),result:null,error:T instanceof w?{code:T.code,message:T.message,details:T.details}:{code:"operation_failed",message:T instanceof Error?T.message:String(T)}})}const j=s.get(D);m==="reload"&&(j.status==="succeeded"||j.status==="failed")&&(o.last_reload={operation_id:D,status:j.status,finished_at:j.finished_at,error:j.error}),n({id:"",event:"operation.updated",data:{...C(),resource_id:D,status:j.status,href:"/api/v1/operations/"+D}}),u()},1e3);const E="/api/v1/operations/"+D;return{operation_id:D,kind:m,status:"queued",href:E,retryAfter:1}},_=async(m,N)=>(N?.throwIfAborted(),structuredClone(V(s.get(m),"Operation"))),x=["trace","debug","info","warn","error"],A=[],$=new Set;let P=0;function v(){const m=i().buffered_records;A.length>m&&A.splice(0,A.length-m),g()}const y=(m,N,D,R=null,O=Date.now())=>{const E={id:`${W}:logs:${++P}`,ts:new Date(O).toISOString(),level:m,target:N,message:D,fields:R};A.push(E),v(),$.forEach(j=>j(E))},S=[()=>y("info","honk::routing","Routing generation publis Line truncated
@@ -0,0 +1 @@
@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1PCEKM_Y.woff2)format("woff2");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116;ascent-override:100%;descent-override:20%;line-gap-override:0%}@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1NyEKM_Y.woff2)format("woff2");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB;ascent-override:100%;descent-override:20%;line-gap-override:0%}@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1NiEKM_Y.woff2)format("woff2");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;ascent-override:100%;descent-override:20%;line-gap-override:0%}@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1OCEK.woff2)format("woff2");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;ascent-override:100%;descent-override:20%;line-gap-override:0%}:root,:root[data-family=rose-pine]{--rp-base:#faf4ed;--rp-surface:#fffaf3;--rp-overlay:#f2e9e1;--rp-muted:#9893a5;--rp-subtle:#797593;--rp-text:#464261;--rp-love:#b4637a;--rp-gold:#ea9d34;--rp-rose:#d7827e;--rp-pine:#286983;--rp-foam:#56949f;--rp-iris:#907aa9;--rp-c1:var(--rp-pine);--rp-c2:var(--rp-foam);--rp-c3:var(--rp-iris);--rp-c4:var(--rp-gold);--rp-c5:var(--rp-rose);--rp-c6:var(--rp-love);--rp-c7:var(--rp-pine);--rp-c8:var(--rp-foam);--rp-hl-low:#f4ede8;--rp-hl-med:#dfdad9;--rp-hl-high:#cecacd;--rp-shadow:0 1px 2px #57527914}:root[data-family=rose-pine]{--rp-negative-text:var(--rp-text);--rp-notice-text:var(--rp-text);--rp-positive-text:var(--rp-text);--rp-accent-tile-text:var(--rp-text);--rp-info-tile-text:var(--rp-text);--rp-subtle-text:var(--rp-text)}:root[data-family=rose-pine][data-scheme=dark],:root[data-flavour=moon][data-scheme=dark]{--rp-base:#232136;--rp-surface:#2a273f;--rp-overlay:#393552;--rp-muted:#6e6a86;--rp-subtle:#908caa;--rp-text:#e0def4;--rp-love:#eb6f92;--rp-gold:#f6c177;--rp-rose:#ea9a97;--rp-pine:#3e8fb0;--rp-foam:#9ccfd8;--rp-iris:#c4a7e7;--rp-c1:var(--rp-pine);--rp-c2:var(--rp-foam);--rp-c3:var(--rp-iris);--rp-c4:var(--rp-gold);--rp-c5:var(--rp-rose);--rp-c6:var(--rp-love);--rp-c7:var(--rp-pine);--rp-c8:var(--rp-foam);--rp-hl-low:#2a283e;--rp-hl-med:#44415a;--rp-hl-high:#56526e;--rp-shadow:0 1px 2px #0000004d;--rp-line:var(--rp-hl-med);--rp-fill:var(--rp-hl-med);--rp-on-accent:#191724;--rp-accent-text:var(--rp-text);--rp-negative-text:var(--rp-negative);--rp-notice-text:var(--rp-notice);--rp-positive-text:var(--rp-positive);--rp-info-text:var(--rp-text);--rp-negative-tile-text:var(--rp-text)}:root[data-family=catppuccin]{--rp-base:#e6e9ef;--rp-surface:#eff1f5;--rp-overlay:#dce0e8;--rp-muted:#9ca0b0;--rp-subtle:#6c6f85;--rp-text:#4c4f69;--rp-love:#d20f39;--rp-gold:#df8e1d;--rp-rose:#fe640b;--rp-pine:#1e66f5;--rp-foam:#179299;--rp-iris:#8839ef;--rp-c1:#1e66f5;--rp-c2:#179299;--rp-c3:#8839ef;--rp-c4:#fe640b;--rp-c5:#40a02b;--rp-c6:#ea76cb;--rp-c7:#df8e1d;--rp-c8:#d20f39;--rp-hl-low:#dce0e8;--rp-hl-med:#ccd0da;--rp-hl-high:#bcc0cc;--rp-shadow:0 1px 2px #4c4f691a;--rp-on-accent:#fff;--rp-accent-text:var(--rp-text);--rp-negative-text:var(--rp-text);--rp-notice-text:var(--rp-text);--rp-positive-text:var(--rp-text);--rp-info-text:var(--rp-text);--rp-subtle-text:var(--rp-text)}:root[data-family=catppuccin][data-scheme=dark],:root[data-flavour=mocha][data-scheme=dark]{--rp-base:#181825;--rp-surface:#1e1e2e;--rp-overlay:#313244;--rp-muted:#6c7086;--rp-subtle:#a6adc8;--rp-text:#cdd6f4;--rp-love:#f38ba8;--rp-gold:#f9e2af;--rp-rose:#fab387;--rp-pine:#89b4fa;--rp-foam:#94e2d5;--rp-iris:#cba6f7;--rp-c1:#89b4fa;--rp-c2:#94e2d5;--rp-c3:#cba6f7;--rp-c4:#fab387;--rp-c5:#a6e3a1;--rp-c6:#f5c2e7;--rp-c7:#f9e2af;--rp-c8:#f38ba8;--rp-hl-low:#313244;--rp-hl-med:#45475a;--rp-hl-high:#585b70;--rp-shadow:0 1px 2px #00000059;--rp-on-accent:var(--rp-surface);--rp-accent-text:var(--rp-accent);--rp-negative-text:var(--rp-negative);--rp-notice-text:var(--rp-notice);--rp-positive-text:var(--rp-positive);--rp-info-text:var(--rp-info);--rp-negative-tile-text:var(--rp-text);--rp-subtle-text:var(--rp-subtle)}:root[data-family=nord]{--rp-base:#e5e9f0;--rp-surface:#eceff4;--rp-overlay:#d8dee9;--rp-muted:#4c566a;--rp-subtle:#3b4252;--rp-text:#2e3440;--rp-love:#bf616a;--rp-gold:#d08770;--rp-rose:#b48ead;--rp-pine:#5e81ac;--rp-foam:#8fbcbb;--rp-iris:#81a1c1;--rp-c1:#88c0d0;--rp-c2:#a3be8c;--rp-c3:#b48ead;--rp-c4:#d08770;--rp-c5:#5e81ac;--rp-c6:#ebcb8b;--rp-c7:#bf616a;--rp-c8:#8fbcbb;--rp-hl-low:#e5e9f0;--rp-hLine truncated
@@ -0,0 +1,62 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./fonts-tc-B6Zt5HQN.css","./fonts-sc-DWPGxLPK.css","./SearchDialog-h0qVIWxg.js","./vendor-react-Bf71BWbF.js","./flows-C0byZ3sY.js","./nav-C2A1sZKm.js","./nav-D1cfWFA0.js","./nav-BIpfWn6-.js","./nav-BeFLfZq8.js","./index-ChxA9-bE.js","./geodata-DprMPspn.js","./auth-DmBaDwOI.js","./auth-BGnwk8Hi.js","./AreaChart-DtE4xcoZ.js","./layout-BRLew_nj.js","./AreaCurve-BriPYJva.js","./array-C0P64tl-.js","./Sparkline-B2EO782x.js","./Donut-BhofZH9-.js","./NodeSearch-Dmxd0d8_.js","./Virtualizer--Vfl8O3n.js","./useFilter-DZ8TXqn_.js","./ListLayout-CPapuywx.js","./Overview-Fg9wiBtP.js","./files-BxEOxSF8.js","./Table-D0NFHHNQ.js","./useGridSelectionCheckbox-BV96yL-N.js","./ActionGroup-90AzAQje.js","./DaeCode-STEiRZuV.js","./Connections-L2aJE6s8.js","./FactStrip-BgQ_tYB6.js","./ranked-FVqORIQj.js","./TimeCell-gSIuLEFc.js","./link-D6L0Eg5i.js","./outbounds-f8QoVoCV.js","./Dns-vjK8rYCH.js","./dns-DQrpG8y_.js","./Policies-wpHv6bOW.js","./policyText-CAFy3qpo.js","./PolicyPicker-DSSmYroN.js","./Rules-CSApE4tY.js","./setup-B5f1cfyO.js","./recorder-DlDpPhd4.js","./probe-C8ejAKwA.js","./Rules-l5FnUA9B.css","./Nodes-CF-Y3hZu.js","./AddCircle-Db3HxlxQ.js","./Config-BTdL4dU5.js","./vendor-editor-CF5uj9id.js","./Events-B-WlUhq0.js","./Logs-bjF3zhK-.js","./Settings-Ajzo2fTI.js","./Login-CBpAitxd.js"])))=>i.map(i=>d[i]);
import{$ as w,r as c,c as Lp,s as Ws,a as Qt,b as kc,j as f,d as Ip}from"./vendor-react-Bf71BWbF.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const jp="modulepreload",Dp=function(t,e){return new URL(t,e).href},El={},pe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(d){return Promise.all(d.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};const l=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),u=a?.nonce||a?.getAttribute("nonce");i=o(n.map(d=>{if(d=Dp(d,r),d in El)return;El[d]=!0;const m=d.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(!!r)for(let y=l.length-1;y>=0;y--){const g=l[y];if(g.href===d&&(!m||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${p}`))return;const b=document.createElement("link");if(b.rel=m?"stylesheet":jp,m||(b.as="script"),b.crossOrigin="",b.href=d,u&&b.setAttribute("nonce",u),document.head.appendChild(b),m)return new Promise((y,g)=>{b.addEventListener("load",y),b.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return e().catch(s)})};function ot(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}const ee=typeof document<"u"?w.useLayoutEffect:()=>{},Tc={prefix:String(Math.round(Math.random()*1e10)),current:0},Rc=w.createContext(Tc),Kp=w.createContext(!1);let Ni=new WeakMap;function Fp(t=!1){let e=c.useContext(Rc),n=c.useRef(null);if(n.current===null&&!t){let r=w.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(r){let i=Ni.get(r);i==null?Ni.set(r,{id:e.current,state:r.memoizedState}):r.memoizedState!==i.state&&(e.current=i.id,Ni.delete(r))}n.current=++e.current}return n.current}function _p(t){let e=c.useContext(Rc),n=Fp(!!t),r=`react-aria${e.prefix}`;return t||`${r}-${n}`}function Ap(t){let e=w.useId(),[n]=c.useState(Je()),r=n?"react-aria":`react-aria${Tc.prefix}`;return t||`${r}-${e}`}const Op=typeof w.useId=="function"?Ap:_p;function Bp(){return!1}function Vp(){return!0}function Hp(t){return()=>{}}function Je(){return typeof w.useSyncExternalStore=="function"?w.useSyncExternalStore(Hp,Bp,Vp):c.useContext(Kp)}function Up(t){let[e,n]=c.useState(t),r=c.useRef(e),i=c.useRef(null),s=c.useRef(()=>{if(!i.current)return;let l=i.current.next();if(l.done){i.current=null;return}r.current===l.value?s.current():n(l.value)});ee(()=>{r.current=e,i.current&&s.current()});let o=c.useCallback(l=>{i.current=l(r.current),s.current()},[s]);return[e,o]}let zp=!!(typeof window<"u"&&window.document&&window.document.createElement),hn=new Map,cn;typeof FinalizationRegistry<"u"&&(cn=new FinalizationRegistry(t=>{hn.delete(t)}));let Li=new WeakMap;function de(t){let[e,n]=c.useState(t),r=c.useRef(null),i=Op(e),s=c.useRef(null),o=Li.get(s);if(cn&&o!==i&&(o!=null&&cn.unregister(s),cn.register(s,i,s),Li.set(s,i)),zp){const l=hn.get(i);l&&!l.includes(r)?l.push(r):hn.set(i,[r])}return ee(()=>{let l=i;return()=>{cn&&(cn.unregister(s),Li.delete(s)),hn.delete(l)}},[i]),c.useEffect(()=>{let l=r.current;return l&&n(l),()=>{l&&(r.current=null)}}),i}function Wp(t,e){if(t===e)return t;let n=hn.get(t);if(n)return n.forEach(i=>i.current=e),e;let r=hn.get(e);return r?(r.forEach(i=>i.current=t),t):e}function rt(t=[]){let e=de(),[n,r]=Up(e),i=c.useCallback(()=>{r(function*(){yield e,yield document.getElementById(e)?e:void 0})},[e,r]);return ee(i,[e,i,...t]),n}function Mt(...t){return t.length===1&&t[0]?t[0]:e=>{let n=!1;const r=t.map(i=>{const s=Sl(i,e);return n||=typeof s=="function",s});if(n)return()=>{r.forEach((i,s)=>{typeof i=="function"?i():Sl(t[s],null)})}}}function Sl(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function A(...t){let e={...t[0]};for(let n=1;n<t.length;n++){let r=t[n];for(let i in r){let s=e[i],o=r[i];typeof s=="function"&&typeof o=="function"&&i[0]==="o"&&i[1]==="n"&&i.charCodeAt(2)>=65&&i.charCodeAt(2)<=90?e[i]=ot(s,o):(i==="className"||i==="UNSAFE_className")&&typeof s=="string"&&typeof o=="string"?e[i]=Lp(s,o):i==="id"&&s&&o?e.id=Wp(s,o):i==="ref"&&s&&o?e.ref=Mt(s,o):e[i]=o!==void 0?o:s}}retuLine truncated
@layer {
[${_l}] {
touch-action: pan-x pan-y pinch-zoom;
}
}
`.trim(),C.head.prepend(j)},[p]),c.useEffect(()=>{let C=g.current;return()=>{m||jl(C.target??void 0);for(let j of C.disposables)j();C.disposables=[]}},[m]),{isPressed:a||b,pressProps:A(h,V,{[_l]:!0})}}function oo(t){return t.tagName==="A"&&t.hasAttribute("href")}function Ii(t,e){const{key:n,code:r}=t,i=e,s=i.getAttribute("role");return(n==="Enter"||n===" "||n==="Spacebar"||r==="Space")&&!(i instanceof xe(i).HTMLInputElement&&!$u(i,n)||i instanceof xe(i).HTMLTextAreaElement||i.isContentEditable)&&!((s==="link"||!s&&oo(i))&&n!=="Enter")}function Dt(t,e){let n=e.clientX,r=e.clientY;return{currentTarget:t,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,clientX:n,clientY:r,key:e.key}}function xm(t){return t instanceof HTMLInputElement?!1:t instanceof HTMLButtonElement?t.type!=="submit"&&t.type!=="reset":!oo(t)}function Al(t,e){return Fe()&&e==="Enter"?!1:t instanceof HTMLInputElement?e==="Enter"&&(t.type==="checkbox"||t.type==="radio")?!1:!$u(t,e):xm(t)}const wm=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function $u(t,e){return t.type==="checkbox"||t.type==="radio"?e===" ":wm.has(t.type)}function Em(t,e){let{elementType:n="a",onPress:r,onPressStart:i,onPressEnd:s,onPressChange:o,onClick:l,isDisabled:a,...u}=t,d={};n!=="a"&&(d={role:"link",tabIndex:a?void 0:0});let{focusableProps:m}=Nt(t,e),{pressProps:p,isPressed:h}=Wt({onPress:r,onPressStart:i,onPressEnd:s,onPressChange:o,onClick:l,isDisabled:a,ref:e}),b=Y(u,{labelable:!0}),y=A(m,p),g=Sn(),v=si(t);return{isPressed:h,linkProps:A(b,v,{...y,...d,"aria-disabled":a||void 0,"aria-current":t["aria-current"],onClick:$=>{p.onClick?.($),Uc($,g,t.href,t.routerOptions)}})}}function Cn(t){let{isDisabled:e,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=t,s=c.useRef({isFocusWithin:!1}),{addGlobalListener:o,removeAllGlobalListeners:l}=ui(),a=c.useCallback(m=>{Z(m.currentTarget,F(m))&&s.current.isFocusWithin&&!Z(m.currentTarget,m.relatedTarget)&&(s.current.isFocusWithin=!1,l(),n&&n(m),i&&i(!1))},[n,i,s,l]),u=Fc(a),d=c.useCallback(m=>{if(!Z(m.currentTarget,F(m)))return;let p=F(m);const h=ne(p),b=se(h);if(!s.current.isFocusWithin&&b===p){r&&r(m),i&&i(!0),s.current.isFocusWithin=!0,u(m);let y=m.currentTarget;o(h,"focus",g=>{let v=F(g);if(s.current.isFocusWithin&&!Z(y,v)){let $=new h.defaultView.FocusEvent("blur",{relatedTarget:v});Kc($,y);let x=Xs($);a(x)}},{capture:!0})}},[r,i,u,o,a]);return e?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:a}}}function Ie(t={}){let{autoFocus:e=!1,isTextInput:n,within:r}=t,i=c.useRef({isFocused:!1,isFocusVisible:e||Tt()}),[s,o]=c.useState(!1),[l,a]=c.useState(()=>i.current.isFocused&&i.current.isFocusVisible),u=c.useCallback(()=>a(i.current.isFocused&&i.current.isFocusVisible),[]),d=c.useCallback(h=>{i.current.isFocused=h,i.current.isFocusVisible=Tt(),o(h),u()},[u]);$h(h=>{i.current.isFocusVisible=h,u()},[n,s],{enabled:s,isTextInput:n});let{focusProps:m}=to({isDisabled:r,onFocusChange:d}),{focusWithinProps:p}=Cn({isDisabled:!r,onFocusWithinChange:d});return{isFocused:s,isFocusVisible:l,focusProps:r?p:m}}let cs=!1,vr=0;function Sm(){cs=!0,setTimeout(()=>{cs=!1},500)}function Ol(t){t.pointerType==="touch"&&Sm()}function Pm(){let t=ne(null);if(!(typeof t>"u"))return vr===0&&typeof PointerEvent<"u"&&t.addEventListener("pointerup",Ol),vr++,()=>{vr--,!(vr>0)&&typeof PointerEvent<"u"&&t.removeEventListener("pointerup",Ol)}}function ke(t){let{onHoverStart:e,onHoverChange:n,onHoverEnd:r,isDisabled:i}=t,[s,o]=c.useState(!1),l=c.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;c.useEffect(Pm,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=ui(),{hoverProps:d,triggerHoverEnd:m}=c.useMemo(()=>{let p=(y,g)=>{if(l.pointerType=g,i||g==="touch"||l.isHovered||!Z(y.currentTarget,F(y)))return;l.isHovered=!0;let v=y.currentTarget;l.target=v,a(ne(F(y)),"pointerover",$=>{l.isHovered&&l.target&&!Z(l.target,F($))&&h($,$.pointerType)},{capture:!0}),e&&e({type:"hoverstart",target:v,pointerType:g}),n&&n(!0),o(!0)},h=(y,g)=>{let v=l.target;l.pointerType="",l.target=null,!(g==="touch"||!l.isHovered||!v)&&(l.isHovered=!1,u(),r&&r({type:"hoverend",target:v,pointerType:g}),n&&n(!1),o(!1))},b={};return typeof PointerEvent<"u"&&(b.onPointerEnter=y=>{cs&&y.pointerType==="mouse"||p(y,y.pointerType)},b.onPointerLeave=y=>{!i&&Z(y.currentTarget,F(y))&&h(y,y.pointerType)}),{hoverProps:b,triggerHoverEnd:h}},[e,n,r,i,l,a,u]);return c.useEffect(()=>{i&&m({currentTarget:l.target},l.pointerType)},[i]),{hoverProps:d,isHovered:s}}const Cm=c.createContext(null),lo=c.forwardRef(function(e,n){[e,n]=le(e,n,Cm);let r=e.href&&!e.isDisabled?"a":"span",{linkProps:i,isPressed:s}=Em({...e,elementType:r},n),o=Q[r],{hoverProps:l,isHovered:a}=ke(e),{focusProps:u,isFocused:d,isFocusVisible:m}=Ie(),p=ie({...e,defaultClassName:"react-aria-Link",values:{isCurrent:!!e["aria-current"],isDisabled:e.isDisabled||!1,isPressed:s,isHovered:a,isFocused:d,isFo Line truncated
@layer {
* {
overscroll-behavior: contain;
}
}`.trim(),document.head.prepend(i);let o=d=>{if(!(d.touches.length===2||n)){if(!e||e===document.documentElement||e===document.body){d.preventDefault();return}e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&d.preventDefault()}},l=d=>{let m=F(d),p=d.relatedTarget;p&&Fn(p)?(p.focus({preventScroll:!0}),ma(p,Fn(m))):p||m.parentElement?.closest("[tabindex]")?.focus({preventScroll:!0})},a=HTMLElement.prototype.focus;Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(d){let m=se(),p=m!=null&&Fn(m);a.call(this,{...d,preventScroll:!0}),(!d||!d.preventScroll)&&ma(this,p)}});let u=ot(mn(document,"touchstart",r,{passive:!1,capture:!0}),mn(document,"touchmove",o,{passive:!1,capture:!0}),mn(document,"blur",l,!0));return()=>{t(),u(),i.remove(),Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:a})}}function ma(t,e){e||!_n?ba(t):_n.addEventListener("resize",()=>ba(t),{once:!0})}function ba(t){let e=document.scrollingElement||document.documentElement,n=t;for(;n&&n!==e;){let r=co(n);if(r!==document.documentElement&&r!==document.body&&r!==n){let i=r.getBoundingClientRect(),s=n.getBoundingClientRect();if(s.top<i.top||s.bottom>i.top+n.clientHeight){let o=i.bottom;_n&&(o=Math.min(o,_n.offsetTop+_n.height));let l=s.top-i.top-((o-i.top)/2-s.height/2);r.scrollTo({top:Math.max(0,Math.min(r.scrollHeight-r.clientHeight,r.scrollTop+l)),behavior:"smooth"})}}n=r.parentElement}}function zb(t,e){let{triggerRef:n,popoverRef:r,groupRef:i,isNonModal:s,isKeyboardDismissDisabled:o,shouldCloseOnInteractOutside:l,...a}=t,u=a.trigger==="SubmenuTrigger",{overlayProps:d,underlayProps:m}=id({isOpen:e.isOpen,onClose:e.close,shouldCloseOnBlur:!0,isDismissable:!s||u,isKeyboardDismissDisabled:o,shouldCloseOnInteractOutside:l},i??r),{overlayProps:p,arrowProps:h,placement:b,triggerAnchorPoint:y}=rd({...a,targetRef:n,overlayRef:r,isOpen:e.isOpen,onClose:s&&!u?e.close:null,getTargetRect:a.getTargetRect??(e.point?()=>new DOMRect(e.point.x,e.point.y,0,0):void 0)});sd({isDisabled:s||!e.isOpen}),c.useEffect(()=>{if(e.isOpen&&r.current)return s?Rb(i?.current??r.current):ed([i?.current??r.current],{shouldUseInert:!0})},[s,e.isOpen,r,i]);let{focusWithinProps:g}=Cn(t);return{popoverProps:A(d,p,g),arrowProps:h,underlayProps:m,placement:b,triggerAnchorPoint:y}}var od={};od={dismiss:"Dismiss"};var ld={};ld={dismiss:"取消"};var ad={};ad={dismiss:"關閉"};var cd={};cd={"ar-AE":S,"bg-BG":S,"cs-CZ":S,"da-DK":S,"de-DE":S,"el-GR":S,"en-US":od,"es-ES":S,"et-EE":S,"fi-FI":S,"fr-FR":S,"he-IL":S,"hr-HR":S,"hu-HU":S,"it-IT":S,"ja-JP":S,"ko-KR":S,"lt-LT":S,"lv-LV":S,"nb-NO":S,"nl-NL":S,"pl-PL":S,"pt-BR":S,"pt-PT":S,"ro-RO":S,"ru-RU":S,"sk-SK":S,"sl-SI":S,"sr-SP":S,"sv-SE":S,"tr-TR":S,"uk-UA":S,"zh-CN":ld,"zh-TW":ad};function Wb(t){return t&&t.__esModule?t.default:t}function ys(t){let{onDismiss:e,...n}=t,r=en(Wb(cd),"@react-aria/overlays"),i=ir(n,r.format("dismiss")),s=()=>{e&&e()};return w.createElement(uo,null,w.createElement("button",{...i,tabIndex:-1,onClick:s,style:{width:1,height:1}}))}const ud=w.forwardRef(({children:t,...e},n)=>{let r=c.useRef(!1),i=c.useContext(qn),s=A(i||{},{...e,register(){r.current=!0,i&&i.register()}});return s.ref=we(n||i?.ref),no(i,s.ref),c.useEffect(()=>{r.current||(r.current=!0)},[]),w.createElement(qn.Provider,{value:s},t)});function qb({children:t}){let e=c.useMemo(()=>({register:()=>{}}),[]);return w.createElement(qn.Provider,{value:e},t)}const Gb=c.createContext({});function Mo(){return c.useContext(Gb)??{}}const dd=w.createContext(null);function vs(t){let e=Je(),{portalContainer:n=e?null:document.body,isExiting:r}=t,[i,s]=c.useState(!1),o=c.useMemo(()=>({contain:i,setContain:s}),[i,s]),{getContainer:l}=Mo();if(!t.portalContainer&&l&&(n=l()),!n)return null;let a=t.children;return t.disableFocusManagement||(a=w.createElement($o,{restoreFocus:!0,contain:(t.shouldContainFocus||i)&&!r},a)),a=w.createElement(dd.Provider,{value:o},w.createElement(qb,null,w.createElement(zn.Provider,{value:null},a))),kc.createPortal(a,n)}function fd(){let e=c.useContext(dd)?.setContain;ee(()=>{e?.(!0)},[e])}function ar(t){let[e,n]=Ve(t.isOpen,t.defaultOpen||!1,t.onOpenChange),[r,i]=c.useState(null);const s=c.useCallback(()=>{n(!0)},[n]),o=c.useCallback(()=>{n(!1)},[n]),l=c.useCallback(()=>{n(!e)},[n,e]);return{isOpen:e,setOpen:n,open:s,close:o,toggle:l,point:r,setPoint:i}}function cr(t,e=!0){let[n,r]=c.useState(!0),i=n&&e;return ee(()=>{if(i&&t.current&&"getAnimations"in t.current)for(let s of t.current.getAnimations())s instanceof CSSTransition&&s.cancel()},[t,i]),pd(t,i,c.useCallback(()=>r(!1),[])),i}function Jn(t,e){let[n,r]=c.useState(e?"open":"closed");switch(n){case"open":e||r("exiting");break;case"closed":case"exiting":e&&r("open");break}let i=n==="exiting";return pd(t,i,c.useCallback(()=>{r(s=>s==="exiting"?"closed":s)},[])),i}function pd(t,e,n){ee(()=>{if(e&&t.current){if(!("getAnimations"in t.current)){n();return}let r=t.current.getAnimations();if(r.length== Line truncated
${n}`:e);const o=[t,i,s??""].join(`
`),l=Sr.get(o);l&&wt.close(l);const a=wt.add({kind:t,text:i,detail:s,action:r},{timeout:r?void 0:5e3,onClose:()=>{Sr.get(o)===a&&Sr.delete(o)}});Sr.set(o,a)},wy=(t,e,n,r)=>{const i=Wo(t,e,n);Le(i.kind,i.text,{detail:i.detail,action:r})},Ey={positive:W0,negative:xs,info:Jd,neutral:null};function Sy({placement:t="bottom"}){const[e,n="center"]=t.split(" "),r=te(),[i,s]=c.useState(!1);return c.useEffect(()=>{i?wt.pauseAll():wt.resumeAll()},[i]),c.useEffect(()=>wt.subscribe(()=>{wt.visibleToasts.length===0&&s(!1)}),[]),c.useEffect(()=>{if(!i)return;const o=l=>{if(l.key!=="Escape")return;(l.target?.closest?.(".rp-toasts")||!document.querySelector(sf))&&s(!1)};return addEventListener("keydown",o),()=>removeEventListener("keydown",o)},[i]),f.jsxs(C0,{queue:wt,className:q("rp-toasts",i&&"expanded"),"data-placement":e,"data-align":n,children:[i&&f.jsx(Ne,{className:"rp-toast-underlay","aria-label":r("toast.collapse"),onPress:()=>s(!1)}),i&&f.jsxs("div",{className:"rp-toast-controls",children:[f.jsx(Ne,{className:"rp-btn sm",onPress:()=>wt.clear(),children:r("toast.clearAll")}),f.jsx(Ne,{className:"rp-btn sm",onPress:()=>s(!1),children:r("toast.collapse")})]}),f.jsx(Py,{expanded:i,edge:e,onExpand:()=>s(!0)})]})}function Py({expanded:t,edge:e,onExpand:n}){const r=c.useContext(gi),i=r.visibleToasts;return f.jsx(Hd,{className:"rp-toast-list",children:({toast:s})=>{const o=i.indexOf(s);return f.jsx(Cy,{item:s,state:r,depth:o,count:i.length,background:!t&&o>0,more:!t&&o===0&&i.length>1?{edge:e,onExpand:n}:null})}})}function Cy({item:t,state:e,depth:n,count:r,background:i,more:s}){const o=te(),l=Ey[t.content.kind],{text:a,detail:u,action:d}=t.content;return f.jsxs(k0,{toast:t,className:q("rp-toast",t.content.kind,i&&"background"),style:{zIndex:r-n,"--i":Math.min(n,3)},inert:i||void 0,children:[f.jsxs(T0,{className:"body",children:[l&&f.jsx("span",{className:"icon",children:f.jsx(l,{})}),f.jsxs("div",{className:"msg",children:[f.jsx(Ar,{slot:"title",elementType:"div",className:"summary",children:a}),u&&f.jsx(Ar,{slot:"description",elementType:"div",className:"detail",children:u})]})]}),f.jsx(Ne,{slot:"close",className:"rp-btn quiet icon close","aria-label":o("close"),children:f.jsx(Oo,{})}),(s||d)&&f.jsxs("div",{className:"foot",children:[s&&f.jsxs(Ne,{className:"rp-btn sm quiet more",onPress:s.onExpand,children:[f.jsx(Jt,{className:q(s.edge==="bottom"&&"up")}),o("toast.showAllCount",{n:r})]}),d&&f.jsx(Ne,{className:"rp-btn action",onPress:()=>{d.onAction(),d.closeOnAction&&e.close(t.key)},children:d.label})]})]})}let An=null;const Ss=new Set,Ps=()=>Ss.forEach(t=>t());typeof window<"u"&&(addEventListener("beforeinstallprompt",t=>{t.preventDefault(),An=t,Ps()}),addEventListener("appinstalled",()=>{An=null,Ps()}));function g7(t=navigator,e=n=>matchMedia(n).matches){if(t.standalone||e("(display-mode: standalone), (display-mode: minimal-ui)"))return null;const n=/Version\/(\d+)[.\d]* (?:Mobile\/\w+ )?Safari\//.exec(t.userAgent);return n?typeof t.standalone=="boolean"&&(/iP(?:hone|ad|od)/.test(t.userAgent)||t.maxTouchPoints>1)?"ios":/Macintosh/.test(t.userAgent)&&t.maxTouchPoints<2&&Number(n[1])>=26?"mac":null:null}function y7(){const t=te(),e=c.useSyncExternalStore(n=>(Ss.add(n),()=>Ss.delete(n)),()=>An,()=>null);return e?async()=>{if(An!==e)return!1;An=null,Ps();try{return await e.prompt(),(await e.userChoice).outcome==="accepted"}catch(n){return Le("negative",t("settings.installFailed"),{detail:yi(n,t)}),!1}}:null}function Cs({className:t,...e}){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:f.jsx("path",{fill:"currentColor",d:"m18.53 17.47-5.083-5.084C14.417 11.186 15 9.66 15 8c0-3.86-3.14-7-7-7S1 4.14 1 8s3.14 7 7 7c1.66 0 3.185-.584 4.386-1.553l5.084 5.083c.146.147.338.22.53.22s.384-.073.53-.22c.293-.293.293-.767 0-1.06M8 13.5c-3.032 0-5.5-2.468-5.5-5.5S4.968 2.5 8 2.5s5.5 2.468 5.5 5.5-2.468 5.5-5.5 5.5"})})}function ky({className:t,...e}){return f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:[f.jsx("path",{fill:"currentColor",d:"m10.03418,16.66162C5.14258,16.66162.75,12.27295.75,10.20068c0-1.68506,2.59814-4.55029,5.34717-5.89746,1.20117-.60596,2.54736-.93506,3.89307-.95264,5.15771,0,9.25977,4.91943,9.25977,6.8501,0,2.07227-4.36035,6.46094-9.21582,6.46094Zm-.03418-11.81104c-1.11084.01465-2.23145.28906-3.23096.79346-.00244.00146-.00537.00293-.0083.00439-2.60596,1.27539-4.51074,3.75-4.51074,4.55225,0,1.14453,3.67969,4.96094,7.78418,4.96094,4.06836,0,7.71582-3.81641,7.71582-4.96094,0-1.04883-3.48145-5.3501-7.75-5.3501Zm-3.56885.12402h.00977-.00977Z"}),f.jsx("path",{fill:"currentColor",d:"m9.82907,7.64351c.22275-.63691-.47262-1.25888-1.09987-1.01025-.47319.18757-.91275.48099-1.28245.88097-1.49146,1.6136-1.20734,4.23592.75785,5.46243,1.20025.7491,2.79762.68815,3.93958-.14712.6684-.48889, Line truncated
`)),a=c.useRef(null),u=c.useRef(!1),d=c.useCallback(m=>(a.current=m,()=>{u.current=m.contains(document.activeElement),a.current=null}),[]);return c.useLayoutEffect(()=>{l&&s.current?.contains(document.activeElement)&&a.current?.querySelector("button")?.focus(),!l&&u.current&&s.current?.querySelector("[data-selected]")?.focus(),u.current=!1},[s,l]),f.jsxs("div",{className:"rp-segfit","data-collapsed":l||void 0,children:[f.jsxs(j0,{ref:s,className:"rp-seg","aria-label":r,isDisabled:i,selectionMode:"single",disallowEmptySelection:!0,selectedKeys:[e],onSelectionChange:m=>{const p=[...m][0];p!=null&&n(String(p))},children:[o&&f.jsx("span",{className:"rp-slider","data-still":o.still||void 0,style:{left:o.x,width:o.w}}),t.map(([m,p])=>f.jsx(K0,{id:m,className:"rp-btn",children:p},m))]}),l&&f.jsx("div",{ref:d,className:"rp-segpick",children:f.jsx(Dy,{bare:!0,label:r,value:e,onChange:n,isDisabled:i,items:t.map(([m,p])=>({id:m,label:p}))})})]})}function $7({children:t,isSelected:e,onChange:n,isDisabled:r,"aria-label":i,"aria-describedby":s}){return f.jsxs(Yg,{className:"rp-switch",isSelected:e,onChange:n,isDisabled:r,"aria-label":i,"aria-describedby":s,children:[f.jsx("span",{className:"track"}),t]})}function Ky({label:t,width:e,search:n,large:r,side:i,className:s,placeholder:o,description:l,error:a,action:u,reveal:d,prefix:m,suffix:p,autoComplete:h,spellCheck:b,...y}){const g=te(),v=c.useId(),$=a?{isInvalid:!0,validationBehavior:"aria"}:{};if(n)return f.jsxs(Fg,{...$,...y,"aria-label":t,className:q("rp-search-field",s),style:e?{width:e}:void 0,children:[f.jsxs("span",{className:q("rp-input",r&&"lg"),children:[f.jsx(Cs,{}),f.jsx(ql,{placeholder:o??t,autoComplete:h,spellCheck:b}),f.jsx(Ne,{className:"clear","aria-label":g("clear"),children:f.jsx(Oo,{})})]}),a&&f.jsxs(Ul,{className:"rp-field-error",children:[f.jsx(xs,{}),a]})]});const x=f.jsxs("span",{className:q("rp-input",(i||!!u)&&"rp-grow",(m||p)&&"affixed"),children:[m&&f.jsx("span",{className:"affix",id:`${v}-prefix`,children:m}),f.jsx(ql,{placeholder:o,autoComplete:h,spellCheck:b}),p&&f.jsx("span",{className:"affix",id:`${v}-suffix`,children:p}),d&&f.jsx(Ne,{className:"reveal","aria-label":d.label,onPress:d.onToggle,children:d.shown?f.jsx(Ty,{}):f.jsx(ky,{})})]});return f.jsxs(h0,{...$,...y,"aria-describedby":[m&&`${v}-prefix`,p&&`${v}-suffix`].filter(Boolean).join(" ")||void 0,className:q(i?"rp-cluster":"rp-field",s),style:e?{width:e}:void 0,children:[f.jsx(xu,{className:"rp-label",children:t}),u?f.jsxs("div",{className:"rp-toolbar",children:[x,u]}):x,l&&f.jsx(Ar,{slot:"description",className:"rp-label",children:l}),a&&f.jsxs(Ul,{className:"rp-field-error",children:[f.jsx(xs,{}),a]})]})}function x7({title:t,children:e,...n}){return f.jsxs(Eg,{...n,className:"rp-disclosure",children:[f.jsx(ao,{level:3,children:f.jsxs(Ne,{slot:"trigger",className:"rp-btn quiet rp-disclosure-trigger",children:[f.jsx(Jt,{}),t]})}),f.jsx(Sg,{className:"rp-disclosure-panel",children:f.jsx("div",{className:"rp-disclosure-content",children:e})})]})}function w7({children:t}){return f.jsx($g,{className:"rp-col",allowsMultipleExpanded:!0,children:t})}function Zo({trigger:t,title:e,children:n,footer:r,narrow:i,alert:s,isOpen:o,onOpenChange:l,hideTitle:a,locked:u,reason:d}){const m=f.jsx(Do,{className:"rp-underlay",isDismissable:!s&&!u,isKeyboardDismissDisabled:u,isOpen:o,onOpenChange:l,children:f.jsx(Rd,{className:q("rp-modal",i&&"narrow"),children:f.jsx(zr,{className:"rp-dialog",role:s?"alertdialog":"dialog","aria-label":a?e:void 0,children:({close:p})=>f.jsxs(nf,{reason:r?d:null,children:[!a&&f.jsx(ao,{slot:"title",children:e}),typeof n=="function"?n(p):n,r&&f.jsx("div",{className:"foot",children:r(p)})]})})})});return t?f.jsxs(Pd,{children:[t,m]}):m}function Qo({trigger:t,triggerRef:e,isOpen:n,onOpenChange:r,title:i,label:s,subtitle:o,placement:l="top start",children:a}){const u=f.jsx(mi,{className:i?"rp-popover rp-popover-dialog":"rp-popover",placement:l,...t?{}:{triggerRef:e,isOpen:n,onOpenChange:r},children:i?f.jsx(zr,{className:"rp-popover-body",children:({close:d})=>f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"rp-popover-head",children:[f.jsx(ao,{slot:"title",children:i}),o]}),a(d)]})}):f.jsx(zr,{className:"rp-popover-note","aria-label":s,children:({close:d})=>a(d)})});return t?f.jsxs(Pd,{children:[t,u]}):u}function uf({title:t,isOpen:e,onCancel:n,confirmLabel:r,onConfirm:i,tone:s="negative",isPending:o,isDisabled:l,reason:a,error:u,children:d}){const m=te();return f.jsxs(Zo,{title:t,narrow:!0,alert:s==="negative",isOpen:e,reason:a,onOpenChange:p=>{p||n()},footer:()=>f.jsxs(f.Fragment,{children:[f.jsx(ge,{onPress:n,children:m("ui.cancel")}),f.jsx(ge,{negative:s==="negative",accent:s==="accent",isDisabled:l,isPending:o,onPress:i,children:r})]}),children:[u&&f.jsx(Go,{takeFocus:!0,children:u.text},u.id),d]})}function E7({label:t,confirmationText:e,isDisabled:n,isPending:r,onConfirm:i,onAbort:s,open:o,setOpen:l}){const a=te(),[u,d]=c.useState(!1),[m,p]=c.useState(!1),[h,b]=c Line truncated
`)}),l="",a=void 0,u=[];return}if(p.startsWith(":"))return;const h=p.indexOf(":"),b=h<0?p:p.slice(0,h);let y=h<0?"":p.slice(h+1);y.startsWith(" ")&&(y=y.slice(1)),b==="event"&&(l=y),b==="data"&&u.push(y),b==="id"&&!y.includes("\0")&&(a=y)},m=()=>{i.cancel(n?.reason).catch(()=>{})};n?.addEventListener("abort",m,{once:!0});try{for(;;){const{value:p,done:h}=await i.read();n?.throwIfAborted(),r?.(),o+=s.decode(p,{stream:!h});let b=0;for(let y=0;y<o.length;y++){const g=o[y];if(!(g!=="\r"&&g!==`
`)){if(g==="\r"&&y===o.length-1&&!h)break;d(o.slice(b,y)),g==="\r"&&o[y+1]===`
`&&y++,b=y+1}}if(o=o.slice(b),h)break}}finally{n?.removeEventListener("abort",m),await i.cancel().catch(()=>{}),i.releaseLock()}}function On(t,e){return e?.throwIfAborted(),new Promise((n,r)=>{const i=()=>{clearTimeout(s),r(e?.reason)},s=setTimeout(()=>{e?.removeEventListener("abort",i),n()},Math.max(1,t)*1e3);e?.addEventListener("abort",i,{once:!0})})}const C1=3,Is=new Set,js=new Set;let Rf=null;function Ja(){Rf=[...Is].reduce((t,e)=>t&&t.until>=e.until?t:e,null),js.forEach(t=>t())}const k1=()=>Rf;function T1(t){return js.add(t),()=>void js.delete(t)}async function R1(t,e,n){if(e<=C1)return On(e,n);const r={status:t,until:Date.now()+e*1e3};Is.add(r),Ja();try{await On(e,n)}finally{Is.delete(r),Ja()}}const D7=["tproxy_port","tproxy_port_protect","pprof_port","so_mark_from_dae","log_level","log_file","disable_waiting_network","lan_interface","wan_interface","auto_config_kernel_parameter","data_dir","store_subscribe","tcp_check_url","tcp_check_http_method","udp_check_dns","check_interval","check_tolerance","dial_mode","nfqueue_enable","allow_insecure","sniffing_timeout","tls_implementation","utls_imitate","tls_fragment","tls_fragment_length","tls_fragment_interval","mptcp","bootstrap_resolver","fallback_resolver","bandwidth_max_tx","bandwidth_max_rx","udp_warm_node_count","preconnect_node_count","max_concurrent_dials"],M1={select:"selector",fixed:"selector",urltest:"urltest",min_moving_avg:"urltest",min_avg10:"urltest",min_last_delay:"urltest",fallback:"fallback",roundrobin:"loadbalance",loadbalance:"loadbalance",random:"random",score:"score"};function K7(t){return M1[t.toLowerCase().replace(/\(.*$/,"")]}const F7=["select","urltest","roundrobin","fallback","score","fixed","min_moving_avg","min_avg10","min_last_delay","loadbalance"],_7=[{id:"min_moving_avg",label:"arrange.policy.fastest",description:"arrange.policy.fastestHint"},{id:"fallback",label:"arrange.policy.fallback",description:"arrange.policy.fallbackHint"},{id:"roundrobin",label:"arrange.policy.spread",description:"arrange.policy.spreadHint"},{id:"select",label:"arrange.policy.manual",description:"arrange.policy.manualHint"}],Xr=["direct","block"],A7=[...Xr,...Xr.map(t=>`${t}(must)`)],En=t=>t!=null&&Xr.includes(t);function O7(t){if(new TextEncoder().encode(t).length>2048||/[\s,]/.test(t)||!/^https?:\/\/[^/?#@]+(?:[/?#]|$)/i.test(t))return!1;try{return!!new URL(t).hostname}catch{return!1}}const N1={warm:0,unknown:1,mixed:2,cold:3},L1={tcp_connect:0,http_headers:1,http_round_trip:2,quic_handshake:3,mixed:4,unknown:5,dns_round_trip:6};function I1(t){const e=n=>(N1[n.warmth]??1)*100+(L1[n.measurement]??5)*10+(n.ip_version==="ipv4"?0:1);return t.filter(n=>n.transport==="tcp"&&n.purpose==="data").sort((n,r)=>e(n)-e(r))[0]}const j1=t=>I1(t.health),D1=t=>t?.state==="healthy"&&t.latency_ms!=null?t.latency_ms:void 0,K1=(t,e)=>(t??1/0)-(e??1/0)||0;function F1(t){const e=t?Rs(...t.outbounds.map(r=>r.download_bytes)):null,n=(t?.outbounds??[]).map(r=>({name:r.name,kind:r.kind,bytes:je(r.download_bytes),percent:tl(r.download_bytes,e)}));return n.sort((r,i)=>r.bytes===i.bytes?0:r.bytes===null?1:i.bytes===null||r.bytes>i.bytes?-1:1),{rows:n,total:e}}function _1(t){const e=t.trim().replace(/^\[([^\]]+)\]$/,"$1");if(/^(?:0|[1-9]\d{0,2})(?:\.(?:0|[1-9]\d{0,2})){3}$/.test(e)&&e.split(".").every(n=>Number(n)<=255))return e;if(!(!e.includes(":")||!/^[\da-f:.]+$/i.test(e)))try{return new URL("http://["+e+"]/").hostname.slice(1,-1)}catch{return}}const A1=t=>En(t.protocol)?"builtin":"unattributed";function O1(t,e){let n=t;for(;e.some(r=>r.id===n);)n+="-";return n}const B7=(t,e)=>t.provider_id??O1(A1(t),e);function Mf(t){if(t)return _1(t.startsWith("[")?t.slice(1,t.indexOf("]")):t.split(":").length===2?t.split(":")[0]:t)}function ll(t,e){return t==="direct"?e("ui.direct"):t==="block"?e("ui.block"):t===null||t==="unknown"?e("ui.unknown"):t}const B1=(t,e)=>t.map(n=>e?.get(n)??n);function V1(t,e,n){return En(t.outbound)?e?ll(t.outbound,e):t.outbound:B1(t.chain,n).join(" → ")||"—"}function V7(t,e,n){if(En(t.outbound))return ll(t.outbound,e);const r=t.chain.at(-1);return r?n?.get(r)??r:t.outbound&&t.outbound!=="unknown"?t.outbound:"—"}const H7=(t,e,n)=>t.chain.length>1?V1(t,e,n):null,H1={starting:"lifecycle.starting",running:"lifecycle.running",reloading:"lifecycle.reloading",suspended:"lifecycle.suspended",draining:"lifecycle.draining",degraded:"lifecycle.degraded",failed:"lifecycle.failed"},U1=t=>t==="running"?"ok":t==="failed"?"err":"warn",z1=t=>t>90?"err":t>75?"warn":"ok",U7=t=>t.closed?t.skipped?"info":"positive":"negative",z7={observed:"conn.state.observed",routing:"conn.state.routing",dialing:"conn.state.dialing",active:"conn.state.active",closed:"conn.state.closed",blocked:"conn.state.blocked",failed:"conn.state.failed",unknown:"conn.state.unknown"};function W1(t){return t?[...t.tcp.map(e=>({...e,network:"tcp"})),...t.udp.map(e=>({...e,network:"udp"}))]:[]}const q1=["stream.ready","runtime.updated","flow.updated","flow.gap","operation.updated","generation.changed"],G Line truncated
`&&i++,o++;continue}const a=o,u=i;let d="text";if(l==="#")for(d="comment";o<t.length&&t[o]!==`
`;)o++;else if(l==="'"||l==='"')for(d="quoted",o++;o<t.length;){const p=t[o++];if(p===`
`&&i++,p==="\\"&&o<t.length)t[o]===`
`&&i++,o++;else if(p===l)break}else if("{}:(),".includes(l))d="symbol",o++;else if(l==="-"&&t[o+1]===">")o+=2;else for(;o<t.length&&!/[\s{}:(),'"]/.test(t[o])&&!(t[o]==="-"&&t[o+1]===">");)o++;const m={from:a,to:o,line:u,kind:d,depth:r.length,parens:s};if(d==="symbol"&&l==="{"){let p=e.length-1;for(;p>=0&&(e[p].kind==="comment"||t.slice(e[p].from,e[p].to)===":");)p--;const h=e[p],b={name:h?sn(t.slice(h.from,h.to)):"",from:h?.from??a,open:a,close:t.length,to:t.length,line:h?.line??i,endLine:i,depth:r.length,children:[]};(r.at(-1)?.children??n).push(b),r.push(b)}else if(d==="symbol"&&l==="}"){const p=r.pop();p&&(p.close=a,p.to=o,p.endLine=i)}else d==="symbol"&&l==="("?s++:d==="symbol"&&l===")"&&(s=Math.max(0,s-1));e.push(m)}return{blocks:n,tokens:e}}function z2(t){if(/[\r\n]/.test(t))return!1;let e=0;for(const n of Oe(t).tokens){if(n.kind==="comment")return!1;if(n.kind==="quoted")continue;const r=t.slice(n.from,n.to);if(r.includes("{")||r.includes("}")||(r==="("&&e++,r===")"&&--e<0))return!1}return e===0}const sn=t=>/^['"]/.test(t)?t.slice(1,-1):t;function Yf(t){const e=Oe(t).tokens.filter(n=>n.kind==="comment");for(const n of e.reverse())t=t.slice(0,n.from)+t.slice(n.to);return t}function Xf(t,e,n){const r=[];let i;for(let s=0;s<n.length;s++){const o=n[s];if(o.from<=e.open||o.from>=e.close)continue;const l=t.slice(o.from,o.to);if(o.parens===0&&(o.kind==="comment"||i&&t.slice(i.valueTo,o.from).includes(`
`))&&(i=void 0),o.depth!==e.depth+1||o.kind==="comment")continue;const a=n[s+1];o.parens===0&&(o.kind==="text"||o.kind==="quoted")&&a&&t.slice(a.from,a.to)===":"?(i={name:sn(l),from:o.from,to:a.to,valueFrom:a.to,valueTo:a.to,value:""},r.push(i),s++):i&&(i.to=o.to,i.valueTo=o.to)}for(const s of r)s.value=t.slice(s.valueFrom,s.valueTo).trim();return r}function W2(t,e){const n=t.slice(e.open+1,e.close);return e.line===e.endLine?[n]:n.replace(/^[^\S\n]*\n/,"").replace(/\n[^\S\n]*$/,"").split(`
`)}function o$(t,e){const n=[];let r=e.open+1;/^[^\S\n]*\n/.test(t.slice(r,e.close))&&(r=t.indexOf(`
`,r)+1);const i=t.lastIndexOf(`
`,e.close-1)+1,s=i>r&&/^[ \t]*$/.test(t.slice(i,e.close))?i-1:e.close;for(;r<=s;){const o=t.indexOf(`
`,r);let l=o===-1?s:Math.min(o,s);const a=e.children.find(u=>u.from>=r&&u.from<=l);if(a){const u=t.indexOf(`
`,a.to);l=u===-1?s:Math.min(u,s)}n.push({from:r,to:l,block:a}),r=l+1}return n}function q2(t){const{blocks:e}=Oe(t);return e.filter(n=>n.name==="include").flatMap(n=>W2(t,n).map(r=>sn(Yf(r).trim()))).filter(Boolean)}const nc=t=>/[*?]/.test(t);function G2(t,e){const n=t.replace(/^\.\//,"").split(/([*?])/).map(r=>r==="*"?"[^/]*":r==="?"?"[^/]":r.replace(/[.+^${}()|[\]\\]/g,"\\$&")).join("");return new RegExp("^"+n+"$").test(e)}const J2=(t,e)=>t.some(n=>G2(n,e));function rc(t,e){const n=e.startsWith("/")?e:(t??"").slice(0,(t??"").lastIndexOf("/")+1)+e,r=[];for(const i of n.split("/"))i===".."?r.pop():i&&i!=="."&&r.push(i);return"/"+r.join("/")+(r.length&&/\/\.{0,2}$/.test(n)?"/":"")}function l$(t){const e=t.find(r=>r.kind==="main");if(!e||t.some(r=>r.content===void 0))return null;const n=t.flatMap(r=>q2(r.content).map(i=>rc(e.path,i)));return r=>J2(n,rc(e.path,r))}function a$(t){for(const e of t.map(n=>n.replace(/^\.\//,""))){const n=e.lastIndexOf("/");if(n>0&&nc(e.slice(n))&&!nc(e.slice(0,n)))return e.slice(0,n+1)}return""}function Zf(t){return[...t].some(e=>e.charCodeAt(0)<32||e.charCodeAt(0)>=127&&e.charCodeAt(0)<=159)?"config.newSourceControl":t.startsWith("/")?"config.newSourceAbsolute":t.split("/").some(e=>e===""||e==="."||e==="..")?"config.newSourceSegments":/[^/]\.dae$/.test(t)?null:"config.newSourceExtension"}function c$(t){const e=[];for(const n of t.map(r=>r.replace(/^\.\//,""))){const r=n.indexOf("*"),i=n.slice(0,r),s=n.slice(r+1);r<0||/[*?]/.test(i+s)||!i.includes("/")||s.includes("/")||!s.endsWith(".dae")||Zf(i+"name"+s)||e.some(o=>o.pattern===n)||e.push({pattern:n,prefix:i,suffix:s})}return e}function u$(t,e){if(t.includes("/"))return"config.newSourceNameSlash";const n=Zf(e.prefix+t+e.suffix);return n==="config.newSourceControl"?"config.newSourceNameControl":n}function Y2(t,e){const n=t.find(i=>i.kind==="main"),r=n?n.path.slice(0,n.path.lastIndexOf("/")+1):"";return t.find(i=>i.path===e||i.path===r+e)??null}function Qf(t=!0){const e=oe();return Ee({key:["config"],every:0,fetch:n=>e.config(n)},{enabled:t})}function hl(t,e){return t.config(e)}async function ep(t){return t.content!==void 0&&await x1(t.content)===t.content_sha256}function X2(t){const[e,n]=c.useState(new Map);return c.useEffect(()=>{let r=!0;return Promise.all(t.map(async i=>[i.id,{digest:i.content_sha256,content:i.content,complete:await ep(i)}])).then(i=>{r&&n(new Map(i))}),()=>{r=!1}},[t]),c.useCallback(r=>{const i=e.get(r.id);return i&&i.digest===r.content_sha256&&i.content===r.content?i.complete:void 0},[e])}function Z2(t){const e=c.useMemo(()=>t?[t]:[],[t]),n=X2(e);return t?n(t)??null:null}function Q2(t,e,n,r){if(n!==e.content_sha256)return{error:t,lastRefused:r};const i=e.id+":"+e.content_sha256;return i===r?{error:new he("config.diskAhead"),lastRefused:r}:{error:t,lastRefused:i}}const ic=t=>new TextEncoder().encode(t).length,sc=t=>wn(413,"request_too_large",`Configuration exceeds the ${t}-byte limit`,"config.tooLarge",{limit:t});function ev(t,e,n){const[r]=[{limit:t.content,size:ic(e)},{limit:t.body,size:ic(JSON.stringify(n))}].filter(i=>i.limit!==void 0).sort((i,s)=>s.size/s.limit-i.size/i.limit);return r&&{limit:r.limit,exceeded:r.size>r.limit}}async function oc(t,e,n,r){const i=ev(t,e,n);if(i?.exceeded)throw sc(i.limit);return r().catch(s=>{throw s instanceof $e&&s.status===413&&i?sc(i.limit):s})}function tp(t,e,n){return rn(t,e,n).catch(r=>{throw n.aborted||r instanceof he?r:(Rn(),new he("ui.operationUnknown"))})}async function tv(t,e,n){const r=await tp(t,await t.createConfigSource(e,"",n),n);jt(r,"reload"),n.throwIfAborted();const i=await hl(t,n).catch(()=>(n.throwIfAborted(),null));return i&&(Y2(i.sources,e)?.id??null)}function d$(t){const e=oe(),{busy:n,run:r}=dt({rethrow:!0});return{busy:n!==null,create:c.useCallback(i=>r("create",async s=>({id:await tv(e,i,s).finally(t)})),[e,r,t])}}function np(t,{rethrow:e=!1}={}){const n=oe(),r=He().data,i=r?.resources.config_validate,s=i?.available===!0&&i.modes?.includes("full")===!0,o=r?.limits.max_json_body_bytes,l=r?.resources.config.max_bytes,a=i?.max_bytes,u=c.useCallback((v,$)=>oc({content:a,body:o},v.sources.map(x=>x.content??"").join(""),v,()=>n.validateConfig(v,$)),[n,a,o]),{busy:d,error:m,run:p,cancel:h}=dt({rethrow:e}),[b,y]=c.useState(null),g=c.useRef(null);return{busy:d,cancel:h,error:m,errorSource:m?b:null,validate:c.useCallback(v=>p("validate",$=>(y(v.sources.length===1?v.sources[0].id??null:null),u(v,$))),[u,p]),apply:c.useCallback((v,$)=>p("save",async x=>{if(y(v.id),!v.writable)throw new he("config.readOnly");if(!await ep(v))throw new he("config.incomplete");x.throwIfAborted();const E=typeof $=="string"?$:$(v.content);if(E===null)return;if(s&&v.kind==="main"&&v.path!=="<redacted>"){const P=await u({sources:[{id:v.id,path:v.path,content:E}],mode:"full"},x);if(x.throwIfAborted(),!P.valid)return{diagnostics:P.diagnostics}}const R=await oc({content:l,body:o},E,{content:E},()=>n.replaceConfigSource(v.id,E,Of(v.content_sha256),x)).catch(async P=>{if(!(P instanceof $e) Line truncated
`,o.from-1)+1,m=t.slice(d,o.from),p=/^\s*$/.test(m)?m:" ",h=Xf(t,o,i),b=o.open+1,g=t.slice(b,o.close).match(/\n([ \t]+)\S/)?.[1]??p+(p||" ");if(o.line!==o.endLine)return av(t,o,h,g,n);const v=[b,...h.map(x=>x.from),o.close],$=v.slice(0,-1).flatMap((x,E)=>{const R=t.slice(x,v[E+1]).trim();return R?[g+R]:[]});return gl(t.slice(0,b)+`
`+$.map(x=>x+`
`).join("")+p+t.slice(o.close),e,n)}const l=s.at(-1),a=l?t.slice(l.open+1,l.close).match(/\n([ \t]+)\S/)?.[1]??" ":" ",u=[`${a}${ip(e)} {`,...n.filters.map(d=>`${a}${a}filter: ${d}`),...n.policy?[`${a}${a}policy: ${n.policy}`]:[],`${a}}`].join(`
`);if(l){const d=t.lastIndexOf(`
`,l.close-1)+1,m=/^[ \t]*$/.test(t.slice(d,l.close))?d:l.close;return t.slice(0,m)+(t[m-1]===`
`?"":`
`)+u+`
`+t.slice(m)}return`${t.replace(/\n+$/,"")}
group {
${u}
}
`}function av(t,e,n,r,i){const s=n.filter(p=>p.name==="filter"),o=n.filter(p=>p.name==="policy"),l=[],a=p=>t.indexOf(`
`,p)+1,u=p=>{const h=t.lastIndexOf(`
`,p.from-1)+1,b=a(p.to),y=/^[ \t\r]*$/.test(t.slice(h,p.from))&&b>0&&/^[ \t\r]*$/.test(t.slice(p.to,b-1));l.push(y?{from:h,to:b,text:""}:{from:p.from,to:p.to,text:""})},d=(p,h)=>{if(p.value===h)return;const b=/^\s*/.exec(t.slice(p.valueFrom,p.valueTo))[0];l.push({from:p.valueFrom+b.length,to:p.valueTo,text:(b?"":" ")+h})};s.forEach((p,h)=>h<i.filters.length?d(p,i.filters[h]):u(p)),o.slice(0,-1).forEach(u),o.length&&(i.policy?d(o.at(-1),i.policy):u(o.at(-1)));const m=[...i.filters.slice(s.length).map(p=>`${r}filter: ${p}
`),...i.policy&&!o.length?[`${r}policy: ${i.policy}
`]:[]].join("");if(m){const p=s.length?a(s.at(-1).to):o.length?t.lastIndexOf(`
`,o[0].from-1)+1:a(e.open);l.push({from:p,to:p,text:m})}return l.sort((p,h)=>h.from-p.from||h.to-p.to).reduce((p,h)=>p.slice(0,h.from)+h.text+p.slice(h.to),t)}function er(t,e){const n=Oe(t).tokens,r=n.map(o=>t.slice(o.from,o.to));if(n[0]?.kind!=="text"||r[0]!==e||r[1]!=="("||r.at(-1)!==")"||n.at(-1)?.parens!==1)return null;const i=[];let s=!0;for(let o=2;o<n.length-1;o++){const l=n[o];if(l.parens!==1)return null;if(s){if(l.kind!=="text"&&l.kind!=="quoted"||l.kind==="text"&&/[\s:]/.test(r[o]))return null;i.push(r[o])}else if(r[o]!==",")return null;s=!s}return s&&i.length?null:i}const Qr=(t,e)=>t.flatMap(n=>(er(n,e)??[]).map(sn));function b$(t){return Qr(t.filters,"name")}function g$(t){return{names:Qr(t.filters,"name"),subtags:Qr(t.filters,"subtag"),rules:t.filters.filter(e=>er(e,"name")===null&&er(e,"subtag")===null)}}function y$(t,e,n){return t.filters.every(r=>{const i=er(r,e);return i!==null&&i.every(s=>sn(s)===n)})}function Ti(t,e,n,r,i){const s=bl(t).find(p=>p.name===e);if(!s&&!r.length)return t;const o=new Set(i),l=new Set(Qr(s?.filters??[],n).filter(p=>!o.has(p))),a=[...new Set(r)].filter(p=>!l.has(p)&&!o.has(p)),u=p=>a.map(p.length&&p.every(h=>h.startsWith("'"))?ki:ip);let d=!a.length;const m=[];for(const p of s?.filters??[]){const h=er(p,n);if(h===null){m.push(p);continue}const b=h.filter(g=>!o.has(sn(g))),y=d?b:[...b,...u(b)];d=!0,y.length&&m.push(`${n}(${y.join(", ")})`)}return d||m.push(`${n}(${u([]).join(", ")})`),s&&m.length===s.filters.length&&m.every((p,h)=>p===s.filters[h])||s?.filters.length&&!m.length?t:gl(t,e,{filters:m,policy:s?.policy??null})}const cv=(t,e,n)=>Ti(t,e,"name",n,[]),uv=(t,e,n)=>Ti(t,e,"name",[],n),dv=(t,e,n)=>Ti(t,e,"subtag",n,[]),fv=(t,e,n)=>Ti(t,e,"subtag",[],n);function sp(t,e){const n=[];let r=0,i=null,s=0;for(let o=0;o<t.length;o++){const l=t[o];i?l==="\\"?o++:l===i&&(i=null):l==="'"||l==='"'?i=l:l==="("?r++:l===")"?r--:r===0&&t.startsWith(e,o)&&(n.push(t.slice(s,o)),s=o+e.length,o+=e.length-1)}return n.push(t.slice(s)),n.map(o=>o.trim())}function pv(t){const e=t.startsWith("!"),n=e?t.slice(1).trim():t,r=n.startsWith("name(")?"name":n.startsWith("subtag(")?"subtag":null;if(!r||!n.endsWith(")"))return null;const i=[],s=[];for(const o of sp(n.slice(r.length+1,-1),",")){const l=/^keyword:\s*/.exec(o),a=/^regex:\s*/.exec(o),u=sn((l??a?o.slice((l??a)[0].length):o).trim());if(u)if(l)s.push(d=>d.includes(u));else if(a){let d;try{d=new RegExp(u)}catch{return null}s.push(m=>d.test(m))}else i.push(u),s.push(d=>d===u)}return s.length?{call:r,negated:e,exact:i,tests:s}:null}function hv(t){const e=sp(t,"&&").map(pv);return e.every(n=>n!==null)&&e.length?e:null}function mv(t){const e=t.map(hv).filter(n=>n!==null);if(!e.length){const n=t.some(r=>r.startsWith("group("));return r=>!n&&!En(r.name)}return n=>e.some(r=>(!En(n.name)||r.some(i=>i.call==="name"&&!i.negated&&i.exact.includes(n.name)))&&r.every(i=>i.tests.some(s=>s(i.call==="name"?n.name:n.subscription_tag??""))!==i.negated))}const v$=(t,e)=>mv(t)(e);function bv(t,e){switch(e.kind){case"addNode":return cv(t,e.group,[e.value]);case"removeNode":return uv(t,e.group,[e.value]);case"addSubscription":return dv(t,e.group,[e.value]);case"removeSubscription":return fv(t,e.group,[e.value]);case"createGroup":return bl(t).some(n=>n.name===e.group)?t:gl(t,e.group,{filters:[],policy:e.policy})}}const $$=(t,e)=>e.reduce(bv,t),x$=["domainSuffix","domain","geosite","dip","geoip","sip","dport","sport","pname","l4proto"];function w$(t,e){const n=e.split(/[,\s]+/).map(i=>i.trim()).filter(Boolean);if(n.some(i=>gv.test(i)||i.includes(":")&&!Jf(i)))return null;const r=yv(t,n);return z2(r)&&!r.includes("->")?r:null}const gv=/[()'"#{}]|&&|->/;function yv(t,e){const n=e.map(s=>s.includes(":")?ki(s):s),r=n.join(", "),i=s=>n.map(o=>`${s}: ${o}`).join(", ");switch(t){case"domain":return`domain(${i("full")})`;case"domainSuffix":return`domain(${i("suffix")})`;case"geosite":return`domain(${i("geosite")})`;case"dip":return`dip(${r})`;case"geoip":return`dip(${i("geoip")})`;case"sip":return`sip(${r})`;case"dport":return`dport(${r})`;case"sport":return`sport(${r})`;case"pname":return`pname(${r})`;case"l4proto":return`l4proto(${r})`}}function E$(t,e){const r=t.map(i=>i.id===e?.id?e.content:i.content).flatMap(i=>i===void 0?[]:bl(i));return[...new Map(r.map(({name:i,written:s})=>[s,{name:i,written:s}])).values()]}const Bs=t=>t.path==="<redacted>"||t.path==="",vv=t=>Bs(t)?t.kind==="main"?"config.dae":`${t.kind}-${t.id.slice(0,8)}.dae`:t.path.split("/").pop()||"config.dae";function S$(t,e){const n=t.find(i=>i.kind==="main");if(n?.content===void 0)return null;const r=[n,...t.filter(i=>i.kind==="include"&&i.content!==void 0&&!Bs(i))];return e&&!r.some(i=>i.id===e.id)?null:r.map(i=>({id:i.id,...Bs(i)?{}:{path:i.path},content:i.id===e?.id?e.content:i.content}))}const $v=t=>t.filter(e=>e.level==="error"&&e.code==="restart-required").length;function P$(t,e){if(e)return t.find(n=>n.id===e.source_id)}function xv(t,e,n){if(!e.source||e.source.source_id!==t.id||t.content=== Line truncated
`,u.from-1)+1,$=r.indexOf(`
`,d.to),x=$===-1?r.length:$+1;return{from:v,to:x,indent:r.slice(v,u.from),text:r.slice(v,x)}}const yl=(t,e,n=!1)=>`${t} -> ${e}${n?"(must)":""}`,C$=t=>[...t.map(e=>e.name),...Xr].map(e=>({id:e,label:e}));function k$(t,e,n,r,i){return t.slice(e.from,e.to)===e.text?t.slice(0,e.from)+`${e.indent}${yl(n,r,i)}
`+t.slice(e.from):null}function T$(t,e){return t.slice(e.from,e.to)===e.text?t.slice(0,e.from)+t.slice(e.to):null}function wv(t,e){const n=t.content??"",r=Oe(n),i=e.map(l=>({rule:l,anchor:xv(t,l.before,r)}));if(i.some(l=>!l.anchor))return null;i.sort((l,a)=>l.anchor.from-a.anchor.from||l.rule.id-a.rule.id);let s="",o=0;for(const{rule:l,anchor:a}of i)s+=n.slice(o,a.from)+a.indent+yl(l.condition,l.outbound,l.must)+`
`,o=a.from;return s+n.slice(o)}function vl(t){const e=new Map;for(const n of t)e.set(n.sourceId,[...e.get(n.sourceId)??[],n]);return[...e.values()]}function cc(t,e,n,r){const i=e??(t instanceof $e&&t.status===422?t.details?.diagnostics??null:null);if(!i)return{text:uy(Wo(t,r,r("ui.writeFailed")),r),lines:[]};const s=i.filter(l=>l.level==="error").length,o=$v(i);return{text:o?r("config.writeRestart",{n:o}):s?r("ui.writeInvalid",{n:s}):r("rule.refused"),lines:i.map(l=>{const a=zo(Uo(l.code,l.message,r),r),u=n.find(d=>d.id===l.source_id);return l.line===null?a:r("config.atFile",{file:u?vv(u):l.source_id,line:l.line,message:a})})}}function R$(t,e,n){const r=vl(t).length;return t.length?{title:n("rule.pending",{n:t.length}),files:r>1?n("rule.pendingFiles",{n:r}):null,failure:e,rows:t.map(i=>({id:i.id,line:yl(i.condition,i.outbound,i.must),position:i.before.kind==="fallback"?n("rule.positionEnd"):n("rule.positionBefore",{n:i.before.index+1})}))}:null}function Ev(t,e,n,r){return e?{text:r("rule.partial",{n:e,held:n}),lines:[t.text,...t.lines]}:t}const uc=()=>void Rn();function Sv(){const t=te(),e=np(uc,{rethrow:!0}),n=rp().applying,r=c.useRef(null);c.useEffect(()=>()=>r.current?.abort(),[]);const i=async(a,u)=>{let d=[],m;try{if(d=(await hl(oe(),u)).sources,u.aborted)return;const p=d.find(b=>b.id===a[0].sourceId),h=p&&await e.apply(p,()=>m=wv(p,a));return!p||m===null?(uc(),{written:!1,failure:{text:t("rule.stale"),lines:[]}}):h?h.diagnostics?{written:!1,failure:cc(null,h.diagnostics,d,t)}:{written:!0,failure:null}:void 0}catch(p){return u.aborted?void 0:{written:p instanceof he&&(p.key==="ui.writtenNotApplied"||p.key==="ui.operationUnknown"),failure:cc(p,null,d,t)}}},s=async(a,u)=>{let d=0;for(const m of vl(a)){const p=await i(m,u);if(!p)return;p.written&&yn.remove(m.map(b=>b.id));const h=p.written?m.length:0;if(p.failure)return{written:d+h,failure:Ev(p.failure,d&&d+h,a.length-d-h,t)};d+=h}return{written:d,failure:null}};return{apply:async a=>{if(!yn.begin())return;const u=new AbortController;r.current=u;try{return await s(a,u.signal)}finally{r.current===u&&(r.current=null),yn.end()}},busy:n,cancel:()=>{r.current?.abort(),e.cancel()}}}function Pv(){const t=te(),{rules:e}=rp(),{apply:n,busy:r}=Sv(),i=vl(e).length;return{count:e.length,label:i>1?t("rule.applyFiles",{n:e.length,files:i}):t("rule.applyPending",{n:e.length}),busy:r,apply:async()=>{const s=await n(e);s&&(yn.fail(s.failure),Le(s.failure?"negative":"positive",s.failure?s.failure.text:t("rule.applied",{n:e.length})))}}}function Cv(t,e,n,r){return Object.keys(Ds).filter(i=>t(i)||e===i).map(i=>({id:i,label:r(Ds[i]),isPending:e===i,isDisabled:!!e,onAction:()=>n(i)}))}function kv(t,e,n){const r=te(),i=D2(t,e,n),s=o=>void i.run(o).then(l=>{l&&Le("positive",r("ov.operationResult",{action:r(Ds[o]),status:r("ov.succeeded"),id:l.operation_id}))},l=>wy(l,r,r("ov.operationError")));return{canRun:i.canRun,busy:i.busy,run:s,actions:Cv(i.canRun,i.busy,s,r)}}function Tv({className:t,...e}){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:f.jsx("path",{fill:"currentColor",d:"m17.13 5.734-5.75-4.472c-.812-.631-1.948-.632-2.76 0L2.87 5.735h-.002C2.324 6.157 2 6.821 2 7.511v8.239C2 16.99 3.01 18 4.25 18h11.5c1.24 0 2.25-1.01 2.25-2.25V7.51c0-.689-.324-1.353-.87-1.776M11.5 16.5h-3v-4.75c0-.413.337-.75.75-.75h1.5c.413 0 .75.337.75.75zm5-.75c0 .413-.337.75-.75.75H13v-4.75c0-1.24-1.01-2.25-2.25-2.25h-1.5C8.01 9.5 7 10.51 7 11.75v4.75H4.25c-.413 0-.75-.337-.75-.75V7.51c0-.229.108-.45.29-.592l5.75-4.47c.272-.213.65-.21.92-.002l5.75 4.472c.182.142.29.363.29.593z"})})}function op({className:t,...e}){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:f.jsx("path",{fill:"currentColor",d:"M5.313 18.748c-1.04 0-2.08-.396-2.873-1.188-1.584-1.584-1.584-4.163 0-5.747l3.906-3.906c1.585-1.584 4.162-1.583 5.747 0q.327.329.566.71c.22.35.115.814-.235 1.034-.353.222-.814.115-1.034-.235q-.152-.241-.36-.45c-.999-.998-2.625-.997-3.624.002l-3.905 3.905c-.999 1-.999 2.627 0 3.626 1.001 1.001 2.627.997 3.626 0l1.952-1.952c.293-.293.768-.293 1.06 0s.294.767 0 1.06L8.189 17.56c-.792.792-1.834 1.187-2.875 1.188m8.341-6.655 3.906-3.905c1.584-1.585 1.584-4.164 0-5.748s-4.164-1.584-5.747 0L9.86 4.393c-.293.293-.293.767 0 1.06s.768.293 1.06 0l1.953-1.952c1-.998 2.625-1 3.626 0 .999.999.999 2.626 0 3.626l-3.905 3.905c-1 1-2.625 1-3.624.001q-.208-.207-.36-.449c-.22-.35-.681-.457-1.034-.235-.35.22-.456.683-.235 1.034q.24.381.566.71c.793.792 1.833 1.188 2.874 1.188 1.04 0 2.081-.396 2.873-1.188"})})}function Rv({className:t,...e}){return f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:[f.jsx("path",{fill:"currentColor",d:"m13.527 5.49-3.002-2.997c-.293-.29 Line truncated
`,r.from-1)+1,s=n.filter(a=>a.from>=i&&a.to<=r.from);if(s.some(a=>a.depth!==1))return[];const o=s.findIndex(a=>a.parens===0&&t.slice(a.from,a.to)==="->"),l=o===-1||o===s.length-1?"":t.slice(s[o+1].from,r.from).trim();return[{from:i,to:r.to+(t[r.to]===`
`?1:0),target:l}]})}function E5(t){const{blocks:e,tokens:n}=Oe(t),r=bp(t,e,n).find(i=>i.target);return r?r.target==="direct"?{mode:"direct"}:{mode:"global",target:r.target}:{mode:"rule"}}function S5(t,e){const n=Oe(t);for(const p of bp(t,n.blocks,n.tokens).reverse())t=t.slice(0,p.from)+t.slice(p.to);if(e.mode==="rule")return t;const{blocks:r,tokens:i}=Oe(t),s=r.find(p=>p.name==="routing");if(!s)throw new he("act.modeNoRouting");const l=t.slice(s.open+1,s.close).match(/\n([ \t]+)\S/)?.[1]??" ";let a=s.open+1;t[a]===`
`&&a++;let u=null;const d=p=>{const h=t.indexOf(`
`,p);return t.slice(t.lastIndexOf(`
`,p-1)+1,h===-1?void 0:h).trim()};for(let p=0;p<i.length;p++){const h=i[p];if(h.from<=s.open||h.to>s.close||h.depth!==1||h.parens!==0||t.slice(h.from,h.to)!=="->")continue;const b=i[p+1],y=i[p+2],g=i[p+3],v=i[p+4];if(!(b&&y&&g&&v&&t.slice(y.from,y.to)==="("&&t.slice(g.from,g.to)==="must"&&t.slice(v.from,v.to)===")")){u??=d(h.from);continue}if(u!==null)throw new he("act.modeInterleaved",u);const x=t.indexOf(`
`,v.to);a=x!==-1&&x<s.close?x+1:v.to;const E=i[p+5];if(E&&E.from<a&&E.kind!=="comment")throw new he("act.modeInterleaved",d(E.from))}const m=e.mode==="direct"?"direct":e.target;return t.slice(0,a)+(t[a-1]===`
`?"":`
`)+`${l}l4proto(tcp, udp) -> ${m} ${mp}
`+t.slice(a)}const P5=(t,e)=>t.mode===e.mode&&(t.mode!=="global"||e.mode!=="global"||t.target===e.target),xc=["ok","warn","err"];function C5(t,e,n,r){const i=U1(t),s=t?hp(H1,t,r):n;return!t||e!=="degraded"&&e!=="failed"?{tone:i,text:s,href:null}:{tone:xc[Math.max(xc.indexOf(i),e==="failed"?2:1)],text:r(e==="failed"?"ov.status.datapathFailed":"ov.status.datapathDegraded",{status:s}),href:nt("overview",{card:"datapath"})}}const gp={rule:"mode.rule",direct:"mode.direct",global:"mode.global"};function k5(t,e,n,r,i,s,o=!0){const l=r?e??t:t,a=l.mode==="global"?l.target:(t.mode==="global"?t.target:n[0]?.name)??"";return{mode:o?l.mode:"",target:o?a:"",targetText:o&&a||"—",writable:r,dirty:r&&e!==null&&!P5(e,t),incomplete:l.mode==="global"&&!a,status:s(i?"act.modeReadOnly":"act.modeUnavailable"),readOnly:i&&!r,modes:["rule","direct","global"].map(u=>[u,s(gp[u])]),targets:n.map(u=>({id:u.name,label:u.name}))}}function T5({writable:t,dirty:e,incomplete:n,status:r},i,s){return i?{mode:null,global:null}:t?{mode:n?s("act.globalMissing"):e?null:s("config.noChanges"),global:null}:{mode:null,global:r}}const R5=t=>t.event!=="runtime.updated"&&t.event!=="flow.updated"&&!J1(t),M5=8;function N5(t,e){const n=[];for(const r of t){const i=X1(r,e),s=[r.event,i.key,...Object.entries(i.params??{}).map(([a,u])=>`${a}=${String(u)}`)].join("|"),o=n[n.length-1];if(o&&o.key===s){o.count+=1;continue}if(n.length===M5)break;const l=Object.fromEntries(Object.entries(i.params??{}).map(([a,u])=>[a,typeof u=="string"?Z1(u):u]));n.push({id:r.id,tone:r.event==="flow.gap"?"warn":"info",kindText:e(r.event==="flow.gap"?"ui.warning":"ui.notice"),summaryText:e("ui.valuePair",{label:hp(G1,r.event,e),value:e(i.key,l)}),key:s,count:1})}return n.map(({key:r,count:i,summaryText:s,...o})=>({...o,summaryText:i>1?e("ui.aside",{text:s,note:e("act.noticeRepeat",{n:i})}):s}))}function L5(t,e,n,r=!1){return t.down.some(i=>i!==null)||t.up.some(i=>i!==null)?"ready":e===!1?r?"loading":"unavailable":n?"empty":"loading"}function I5(t,e,n){const r=new Map;for(const o of t)r.set(o.name,(r.get(o.name)??0)+1);const i=t.map(o=>{const l=j1(o);return{id:o.id,name:o.name,label:r.get(o.name)>1?n("ui.aside",{text:o.name,note:[o.subscription_tag??o.provider_id??o.id,o.id].join(n("ui.separator"))}):o.name,tcp:D1(l),alive:l?.state==="unavailable"?!1:l?.state==="healthy"?!0:void 0,unavailable:l?.state==="unavailable",healthError:l?.error?ny(l.error,n):void 0}}),s=i.find(o=>o.id===e)??i.find(o=>o.tcp!==void 0)??i.find(o=>!En(o.name))??i[0];return{options:i,big:i.length>12,id:s?.id??"",name:s?.name??"",latency:s?.alive&&s.tcp!==void 0?df(s.tcp,n):"—",tone:s?.alive?"ok":s?.unavailable?"err":"muted",status:n(s?.alive?"act.good":s?.unavailable?"act.unavailable":"act.unknown"),healthError:s?.healthError}}const j5={ok:"act.memoryOk",warn:"act.memoryHigh",err:"act.memoryNearLimit"};function D5(t,e,n,r,i="en",s){const o=tl(e?.cgroup?.current_bytes??null,e?.cgroup?.limit_bytes??null),l=o===null?null:z1(o),{tone:a,text:u}=C5(t?.lifecycle.state,s,n(r===!1?"act.modeUnavailable":"ui.loading"),n);return{status:{tone:a,text:u},download:Ms(t?.traffic.rates?.download_bytes_per_second??null,i),upload:Ms(t?.traffic.rates?.upload_bytes_per_second??null,i),connections:t?.traffic.connections.total==null?"—":xn(t.traffic.connections.total,i),rss:Xt(e?.process?.rss_bytes??null,i),memoryBadge:l===null?null:{tone:l,text:n(j5[l])}}}function K5(t,e,n,r){const i=F1(t);return{since:t?r("act.since",{t:Oy(t.counter_since,e)}):"",total:Xt(i.total,e),rows:i.rows.map((s,o)=>({name:ll(s.name,r),value:s.percent===null?null:Math.round(s.percent),text:Xt(s.bytes,e),color:s.kind==="builtin"&&s.name==="block"?n.love:n.cat[o%n.cat.length]}))}}function F5(t,e,n,r,i){return w5(t,e).map((s,o)=>({name:s.name,value:s.percent===null?Xt(s.download,r):i("ui.share",{bytes:Xt(s.download,r),percent:s.percent}),pct:s.percent??0,color:n.cat[o%n.cat.length]}))}function _5(){const t=te(),e=oe(),n=ov(R5);return{rows:c.useMemo(()=>N5(n.records,t),[n.records,t]),total:n.records.length,error:n.error,retry:()=>void Rn().then(()=>S2(e)),loading:!n.error&&n.available===null,empty:t(n.available===!1?"event.unavailable":"act.noIssues")}}const A5=(t,e)=>t.kind==="invalid"?{kind:"negative",text:e("ui.writeInvalid",{n:t.errors})}:t.kind==="failed"?Wo(t.error,e,e("ui.writeFailed")):null;function O5(){const t=He().data?.resources,e=tt(t,"config",{whileLoading:!1})&&t?.config.writable===!0&&t?.config.content===!0,n=Qf(tt(t,"config",{whileLoading:!1})),r=np(n.refetch,{rethrow:!0}),i=n.data?.sources.find(d=>d.kind==="main"&&d.writable)??null,s=Z2(i),o=s?i:null,l=s===!1,a=c.useMemo(()=>n.error??(l?new he("config.incomplete"):null),[n.error,l]),{apply:u}=r;return{main:o,writable:e,busy:r.busy!==null,error:a,retry:n.refetch,apply:c.useCallback(async(d,m=o??void 0)=>{if(!m)return{kind:"failed",error:a??new he("config.incomplete")};try{const p=await u(m,d);return p?p.diagnostics?{kind:"invalid",errors:p.diagnostics.filter(h=>h.level==="error").length}:{k Line truncated
`),redactedSections:t=>t.filter(e=>e.name==="experimental"&&e.children.some(n=>n.name==="native_api")).map(e=>({block:e,name:"experimental.native_api"}))},G5={id:"unknown",reason:()=>{},holdsCredentials:()=>!1,snippet:t=>t.map(({key:e,value:n})=>`${e}: ${n}`).join(`
`),redactedSections:()=>[]};function J5(t){switch(t?.api.name){case"dae/honk-native":return q5;default:return G5}}const Ec={connections:"nav.connections",flows:"rule.flows",routing_trace:"ov.r.routingTrace",dns_query:"ov.r.dnsQuery",dns_cache:"ov.r.dnsCache",dns_log:"ov.r.dnsLog",events:"nav.events",probes:"ov.r.probes",traffic_history:"ov.r.trafficHistory",memory_history:"ov.r.memoryHistory",runtime_outbounds:"ov.r.outbounds",logs:"nav.logs",providers:"nodes.providers",rules:"rule.listTitle",config:"nav.config",config_validate:"ov.r.configValidate",runtime_settings:"settings.runtime",geodata:"settings.geodata"},Y5=["configNotLoaded","configReadOnly","mainReadOnly","recordOff","geodataUpdate","geodataUnreadable","notRunning","flowsIdle","notProvided"],X5={"recorder-off":"recordOff","starting-or-stopping":"notRunning","geodata-mismatch":"geodataUnreadable"},Z5={"config-unloaded":{text:"ov.lim.configMissing"},"writes-off":{text:"ov.lim.configWrite",docs:["read-only","ov.lim.docsReadOnly"]},"main-file-read-only":{text:"ov.lim.mainReadOnly",docs:["read-only","ov.lim.docsReadOnly"]},"recorder-off":{text:"ov.lim.recordOff"},"no-download-urls":{text:"ov.lim.geoNoStateDb",docs:["state-db","ov.lim.docsStateDb"]},"geodata-mismatch":{text:"ov.lim.geoUnreadable"},"starting-or-stopping":{text:"ov.lim.notRunningReason"}};function Q5(t,e,n,r){const i=t.resources,s=J5(e),o=v=>s.reason(v,t),l=new Map,a=(v,$,x=Ec[$])=>{const E=l.get(v)??[];E.push({id:$,label:n(x)}),l.set(v,E)},u=(v,$)=>({href:wl(r,v),text:n($),external:!0}),d=(v,$)=>({label:n("ov.lim.why"),text:n(v),link:$}),m=v=>{const $=v.find(L=>L!==void 0),x=$&&Z5[$.code];if(!x)return;const E=x.docs&&u(...x.docs),R=v.flatMap(L=>L&&"settings"in L?L.settings:[]);return R.length>0?{label:n("ov.lim.howTo"),text:n(x.text),snippet:s.snippet(R),link:E}:d(x.text,E)},p=i.config.available?i.config.writable!==!0?"configReadOnly":null:"configNotLoaded";p&&a(p,"config");const h=!i.config_validate.available&&p==="configNotLoaded";h&&a("configNotLoaded","config_validate"),(i.nodes.can_manage===!1||i.providers.can_manage===!1)&&a(p??"mainReadOnly","manage","ov.lim.manage");const b=i.runtime_settings.available&&(i.runtime_settings.fields??[]).includes("record_flows");for(const v of Object.keys(Ec)){const $=i[v];if(v==="config"||v==="config_validate"&&h)continue;const x=v==="flows"&&$.available&&i.flows.recording==="off";if(x||!$.available){const E=o(v)?.code;a((E&&X5[E])??(x?"flowsIdle":"notProvided"),v)}else v==="geodata"&&i.geodata.can_update!==!0&&a(p??"geodataUpdate",v),v==="providers"&&i.providers.can_refresh===!1&&a("notRunning","subscriptions","ov.lim.subscriptions"),v==="connections"&&i.connections.can_close===!1&&a("notProvided","close","ov.lim.close")}const y=()=>{const v=i.geodata;if(v.assets?.length===0)return d("ov.lim.geoNoAssets");const $=m([o("geodata")]);if($)return $;if(v.configurable_sources===!0)return d("ov.lim.geoNoUrl",{href:nt("settings",{card:"geodata"}),text:n("settings.geodata")})},g=(v,$)=>{const x=$.length,E=()=>$.map(R=>o(R.id));switch(v){case"configNotLoaded":return{headline:n("ov.lim.h.configNotLoaded"),named:["config"],help:m([o("config")])};case"configReadOnly":return{headline:n("ov.lim.h.configReadOnly"),named:["config"],help:m([o("config")])};case"mainReadOnly":return{headline:n("ov.lim.h.mainReadOnly"),named:["manage"],help:m([o("manage")])};case"recordOff":return{headline:n("ov.lim.h.recordOff",{n:x}),help:m(E())};case"geodataUpdate":return{headline:n("ov.lim.h.geodataUpdate"),named:["geodata"],help:y()};case"geodataUnreadable":return{headline:n("ov.lim.h.geodataUnreadable"),named:["geodata"],help:m(E())};case"notRunning":return{headline:x>1?n("ov.lim.h.notRunning",{n:x}):n($[0].id==="probes"?"ov.lim.h.probes":"ov.lim.h.subscriptions"),named:x>1?[]:[$[0].id],help:m(E())};case"flowsIdle":return{headline:n(o("flows")?.code==="recorded-on-demand"?"ov.lim.h.flowsIdle":"ov.lim.h.flowsOff"),named:["flows"],link:b?{href:nt("settings",{card:"runtime"}),text:n("settings.runtime")}:void 0};case"notProvided":{const R=E().some(L=>L?.code==="build-lacks");return{headline:n(R?"ov.lim.h.notProvided":"ov.lim.h.notProvidedOther",{n:x}),link:R?u("honk-version","ov.lim.docsVersion"):void 0}}}};return Y5.flatMap(v=>{const $=l.get(v);if(!$)return[];const{named:x=[],...E}=g(v,$),R=$.filter(L=>!x.includes(L.id));return[{cause:v,...E,items:$,features:R.length>0?ey(r,$.map(L=>L.label)):void 0}]})}function e3(){const t=te(),e=Tn(),n=ct[e],r=xl(),i=He(),s=i.data?.resources,o=T2(tt(s,"runtime",{whileLoading:!1})),l=j2(tt(s,"runtime_memory",{whileLoading:!1})),a=L2(tt(s,"datapath",{whileLoading:!1})),[u,d]=c.useState("live"),m=vc[u]??120,p=y5(i.data,l.data),h=M2(m,i.data),b=$5(o.data),y=c.useMemo(()=>h.data?x5(h.data):[],[h.data]),g=c.useMemo(()=>$c(b,y,m),[b,y,m]),v=c.useMemo(()=>$c(b,y,vc.live,void 0,24),[b,y]),$=c.useMemo(()=>[{label:t("act.download"),color:r.cat[0],values:g.down},{label:t("act.upload"),color:r.cat[3],values:g.up}],[t,r,g]),x=c.useMemo(()=>[{label:t("act.rss Line truncated
@@ -0,0 +1,82 @@
import{A as h,m as Nt,o as ct,p as Ot,q as me,t as Y,v as Dt,x as Te,y as ae,z as Ct,C as Rt,D as jt,F as Pt,G as Et,H as Lt,J as dt,K as Tt,M as Gt,N as we,O as zt,P as se,Q as Be,R as Ut,U as Ae,V as ue}from"./index-CXHBmSa5.js";import{d as re,m as Ve,v as Ft,g as Ht,a as Bt}from"./geodata-DprMPspn.js";import{mockSessionValid as Vt,refuseWithoutSession as Jt}from"./auth-DmBaDwOI.js";import"./vendor-react-Bf71BWbF.js";import"./auth-BGnwk8Hi.js";const Ie=Date.now(),B=e=>new Date(Ie-e*1e3).toISOString(),te=e=>new Date(Ie+e*1e3).toISOString(),V=B(0),K="mock-instance-1",De="40",ee={observed_at:V,profiles:["base","full_transparency"],limits:{max_request_target_bytes:4096,max_header_bytes:16384,max_json_body_bytes:65536},resources:{runtime:{available:!0},runtime_memory:{available:!0,metrics:["process.rss_bytes","cgroup.current_bytes","cgroup.limit_bytes","cgroup.events.high","cgroup.events.oom","cgroup.events.oom_kill","kernel.ebpf_bytes"]},datapath:{available:!0,kinds:["ebpf"],details:["attachments","maps"]},runtime_outbounds:{available:!0},traffic_history:{available:!0,max_window_seconds:604800,max_points:360},memory_history:{available:!0,max_window_seconds:604800,max_points:720},nodes:{available:!0,can_manage:!0},providers:{available:!0,can_refresh:!0,can_manage:!0,create_options:{update_interval:86400,user_agent:"honk/0.0.1-alpha",cache:!0},max_page_size:1e3},geodata:{available:!0,can_update:!0,assets:["geosite","geoip"],configurable_sources:!0},rules:{available:!0,max_rules:4096},config:{available:!0,content:!0,writable:!0,create:!0,max_bytes:1048576,max_sources:32},config_validate:{available:!0,modes:["syntax","full"],max_bytes:1048576,max_sources:32},logs:{available:!0,levels:["trace","debug","info","warn","error"],max_buffered_records:4096},dns_log:{available:!0,max_records:2048,max_page_size:500},runtime_settings:{available:!0,fields:["log.level","log.buffered_records","dns_log.max_records","flows.max_flows","flows.retention_seconds","record_flows","record_logs","record_dns_log","geodata"]},groups:{available:!0,config_patch:!0,selection:!0,max_patch_operations:32},probes:{available:!0,targets:["node","group"],kinds:["tcp_connect","http","dns"],purposes:["data","dns"],transports:["tcp","udp"],ip_versions:["ipv4","ipv6"],limits:{max_members_per_job:64,max_results_per_job:256,max_active_jobs:4,max_queued_jobs:16,max_concurrent_per_target:1,job_timeout_ms:3e4,per_principal_requests_per_minute:60,global_requests_per_minute:120}},connections:{available:!0,can_close:!0,max_bulk_close:200},flows:{available:!0,recording:"on",scopes:["userspace_tcp","userspace_udp","kernel_direct","kernel_block","dns_intercept","kernel_bypass"],max_flows:4096,max_steps_per_flow:64,retention_seconds:300,snapshot_ttl_seconds:60,max_page_size:1e3},routing_trace:{available:!0,resolve_modes:["none","live"],max_addresses:16,max_rule_steps:128,timeout_ms:5e3,per_principal_requests_per_minute:60,global_requests_per_minute:120},events:{available:!0,kinds:["stream.ready","runtime.updated","flow.updated","flow.gap","operation.updated","generation.changed"],retention_seconds:300,max_buffered_events:1024,max_clients:16,heartbeat_seconds:15},dns_query:{available:!0,record_types:["A","AAAA","HTTPS"],limits:{max_types_per_request:8,query_timeout_ms:5e3,max_response_bytes:65536,per_principal_requests_per_minute:60,global_requests_per_minute:120}},dns_cache:{available:!0,read:!0,delete_entry:!0,delete_name:!0,flush:!0,entry_kinds:["positive","negative"]},operations:{available:!0,retention_seconds:300},reload:{available:!0},suspend:{available:!0},resume:{available:!0}}},Wt={...ee,profiles:["base"],resources:{...ee.resources,runtime_outbounds:{available:!1},traffic_history:{available:!1},memory_history:{available:!1},logs:{available:!1},dns_log:{available:!1},runtime_settings:{available:!1},geodata:{available:!1},rules:{available:!1},nodes:{available:!0,can_manage:!1},providers:{available:!0,can_refresh:!1,can_manage:!1,max_page_size:1e3},config:{available:!1,content:!1,create:!1},config_validate:{available:!1},flows:{...ee.resources.flows,available:!1},routing_trace:{...ee.resources.routing_trace,available:!1},events:{...ee.resources.events,available:!1}}},Kt={...ee,profiles:["base"],resources:{...Object.fromEntries(Object.keys(ee.resources).map(e=>[e,{available:!1}])),runtime:{available:!0},connections:{available:!0,can_close:!1,max_bulk_close:1e3},config:{available:!1,content:!1,create:!1}}},Ge=[{id:"r1",cond:"pname(NetworkManager, systemd-resolved) && l4proto(udp) && dport(53)",target:"direct",must:!0},{id:"r2",cond:"dip(geoip: private)",target:"direct",must:!0},{id:"r3",cond:"domain(suffix: doubleclick.net)",target:"block",must:!1},{id:"r4",cond:"domain(geosite: cn)",target:"direct",must:!1},{id:"r5",cond:"domain(geosite: telegram)",target:"proxy",must:!1},{id:"r6",cond:"mac(aa:bb:cc:dd:ee:ff) && ipversion(4)",target:"direct",must:!1},{id:"r7",cond:"domain(geosite: openai)",target:"proxy",must:!1},{id:"r8",cond:"sip(10.0.0.0/24) && dport(25)",Line truncated
tproxy_port: 12345
log_level: info
lan_interface: br-lan
wan_interface: auto
allow_insecure: false
auto_config_kernel_parameter: true
}
subscription {
sub-c: 'https://sub.example.net/api/v1/client/subscribe?token=demo'
}
node {
'hk-01': 'vless://demo@hk-01.example.net:443?security=tls#hk-01'
'hk-02': 'vless://demo@hk-02.example.net:443?security=tls#hk-02'
'sg-01': 'trojan://demo@sg-01.example.net:443#sg-01'
'jp-01': 'vless://demo@jp-01.example.net:443?security=tls#jp-01'
'us-01': 'anytls://demo@us-01.example.net:443#us-01'
}
group {
proxy { policy: ${pe.proxy.native} }
resilient { filter: name(hk-01, sg-01, us-01) policy: ${pe.resilient.native} }
gaming { filter: name(jp-01, hk-02) policy: ${pe.gaming.native} }
skylink { filter: subtag(sub-c) policy: ${pe.skylink.native} }
}
dns {
upstream {
cloudflare: 'tls://1.1.1.1:853'
alidns: 'udp://223.5.5.5:53'
}
routing {
request { qname(geosite: cn) -> alidns; fallback: cloudflare }
}
}
routing {
pname(NetworkManager, systemd-resolved) && l4proto(udp) && dport(53) -> direct(must)
dip(geoip: private) -> direct(must)
domain(suffix: doubleclick.net) -> block
domain(geosite: cn) -> direct
domain(geosite: telegram) -> proxy
include rules.dae
fallback: resilient
}
include {
config.d/*.dae
}
`,Yt=`# Household exceptions, kept apart from config.dae.
# The TV never leaves through a node.
mac(aa:bb:cc:dd:ee:ff) && ipversion(4) -> direct
# AI
domain(geosite: openai) -> proxy
sip(10.0.0.0/24) && dport(25) -> block
`,Je=`'香港 01 IPLC': 'vless://<redacted>'
'香港 02 BGP': 'vless://<redacted>'
'新加坡 01 2x': 'trojan://<redacted>'
'日本 01 2x': 'vless://<redacted>'
`,Zt=`# Written by honk from the subscription; edits are lost on refresh.
skylink { filter: subtag(sub-c) }
`,qt=[{level:"warning",source_id:"src-main",line:5,column:3,span:null,code:"interface_auto",message:"wan_interface: auto is resolved at start; a changed default route needs a reload"},{level:"warning",source_id:"src-rules",line:3,column:1,span:null,code:"mac_unseen",message:"mac(aa:bb:cc:dd:ee:ff) has not been seen on the LAN since start"},{level:"info",source_id:"src-sub-c",line:1,column:null,span:null,code:"subscription_cached",message:"Subscription fetched 30 minutes ago; nodes come from the cache"}],pt=[{id:"src-main",path:"/etc/honk/config.dae",kind:"main",writable:!0,loaded_at:B(3600),content:Qt},{id:"src-rules",path:"/etc/honk/rules.dae",kind:"include",writable:!0,loaded_at:B(3600),content:Yt},{id:"src-sub-c",path:"/var/lib/honk/subscriptions/sub-c.dae",kind:"subscription",writable:!1,loaded_at:B(1800),content:Je,onDisk:Je.replaceAll("<redacted>","demo@edge.example.net:443")},{id:"src-generated",path:"/var/lib/honk/generated/skylink.dae",kind:"generated",writable:!1,loaded_at:B(1800),content:Zt}],ft=pt.map(e=>e.id==="src-rules"?{...e,content:e.content+`
# Ads
`+ze.map(n=>`${n.cond} -> ${n.target}
`).join("")}:e),en=ft.map(e=>e.id==="src-rules"?{...e,content:e.content+`domain(suffix: example.org) -> direct
`}:e);function _e(e){const n=new Map;return(o,r={})=>{const{cursor:a,limit:c=1e3,...l}=r,i=Nt([e,l]);if(!Number.isSafeInteger(c)||c<1)throw new h(400,"invalid_request","Invalid page size");for(const[b,w]of n)w.expires<=Date.now()&&n.delete(b);const[d,s,p]=a?.split(":")??[ct(),"0"],v=Number(s);let m=a?n.get(d):void 0;if(a&&(p!==void 0||!m||m.key!==i||!Number.isSafeInteger(v)||v<1||v>=m.items.length))throw new h(e==="flows"?410:400,e==="flows"?"snapshot_expired":"invalid_request","Unknown or expired cursor");if(!m){if(o.length<=c)return{items:structuredClone(o),total:o.length,next_cursor:null};m={items:structuredClone(o),key:i,expires:Date.now()+3e4},n.size>=32&&n.delete(n.keys().next().value),n.set(d,m)}const _=v+c;return{items:structuredClone(m.items.slice(v,_)),total:m.items.length,next_cursor:_<m.items.length?`${d}:${_}`:null}}}function W(e,n){if(e===void 0)throw new h(404,"resource_not_found",`${n} not found`);return e}function Re(e){const n=URL.parse(e);return n?n.origin+n.pathname+(n.search?"?[redacted]":""):null}const tn=new Set(["global","subscription","node","group","dns","routing","upstream","request","response","include"]),We=new Set(Pt),nn=new Set(jt),on=e=>e===""?0:e.replace(/\n$/,"").split(`
`).length;async function ce({onDisk:e,...n}){const o=e??n.content;return{...n,content_sha256:await Ot(o),bytes:new TextEncoder().encode(o).length,line_count:on(o)}}function ge(e,n,o=!1){const{blocks:r}=ae(e),a=r.filter(c=>c.name===n).flatMap(c=>Ct(e,c).filter(l=>!l.block));return o&&!r.length&&a.push({from:0,to:e.length,block:void 0}),a.flatMap(({from:c,to:l})=>{const i=e.slice(0,c).split(`
`).length;return e.slice(c,l).split(`
`).map((d,s)=>({code:Rt(d).trim(),raw:d,line:i+s}))})}function ve(e){return[...ge(e,"include").filter(({code:n})=>n).map(({code:n,line:o})=>({path:me(n),line:o})),...ge(e,"routing",!0).flatMap(({code:n,line:o})=>{const r=/^include\s+(\S+)$/.exec(n);return r?[{path:me(r[1]),line:o}]:[]})]}const Ke=(e,n,o)=>e.filter(r=>Te(Y(n,o),Y(void 0,r.path)));function mt(e,n,o,r){const a=[],c=(s,p,v,m,_)=>a.push({level:v,source_id:e,line:s,column:p,span:null,code:m,message:_}),{blocks:l,tokens:i}=ae(n),d=s=>{s.depth===0&&!tn.has(s.name)&&c(s.line+1,1,"error","unknown_section",`Unknown section "${s.name}"`),s.close===n.length&&c(s.line+1,1,"error","section_not_closed",`Section "${s.name}" is never closed`),s.children.forEach(d)};l.forEach(d);for(const s of i)s.kind==="symbol"&&s.depth===0&&n[s.from]==="}"&&c(s.line+1,1,"error","brace_without_section","Closing brace without an open section");for(const{code:s,line:p}of ge(n,"global")){if(!s)continue;const v=/^([\w.-]+)\s*:\s*(.*)$/.exec(s);v?nn.has(v[1])||c(p,1,"error","unknown_key",`Unknown global setting "${v[1]}"`):c(p,1,"error","not_a_setting",'Expected "<key>: <value>"')}return ge(n,"routing",!0).forEach(({code:s,raw:p,line:v})=>{if(!s||/^include\s+\S+$/.test(s))return;const m=/^fallback:\s*(\S+)$/.exec(s),_=/^(.+?)\s*->\s*(\S+)$/.exec(s),b=m?.[1]??_?.[2];if(!b){c(v,1,"error","not_a_rule",'Expected "<condition> -> <outbound>", "include <file>" or "fallback: <outbound>"');return}const w=b.replace(/\(.*\)$/,"");r==="full"&&!We.has(b)&&!We.has(w)&&!o.has(w)&&c(v,p.lastIndexOf(b)+1,"error","unknown_outbound",`No group named "${w}"`),_&&!/\w\(/.test(_[1])&&c(v,1,"warning","bare_condition","Condition has no function call; it will never match")}),a}function sn(e){return new Set(ae(e).blocks.filter(n=>n.name==="group").flatMap(n=>n.children.map(o=>o.name)))}function $e(e,n,o=[]){const r=e.sources.map((l,i)=>({...l,id:l.id??`source-${i+1}`}));if(new Set(r.map(l=>l.id)).size!==r.length)throw new h(400,"invalid_request","Source IDs must be unique");const a=[];if(e.mode==="full"){const l=r[0]?.path,i=new Map([...o,...r].filter(s=>s.path).map(s=>[Y(void 0,s.path),s])),d=new Set(r.map(s=>s.path&&Y(void 0,s.path)));for(let s=0;s<r.length;s++){const p=r[s];for(const{path:v,line:m}of ve(p.content)){const _=Y(l,v);if(Dt(v)){for(const[w,N]of i)Te(_,w)&&!d.has(w)&&(d.add(w),r.push({...N,id:N.id??`source-${r.length+1}`}));continue}const b=i.get(_);b?d.has(_)||(d.add(_),r.push({...b,id:b.id??`source-${r.length+1}`})):a.push({source_id:p.id,line:m,column:1,span:null,level:"error",code:"include_not_found",message:`Include "${v}" cannot be resolved`})}}}const c=e.mode==="full"?new Set(r.flatMap(l=>[...sn(l.content)])):new Set;return a.push(...r.flatMap(l=>mt(l.id,l.content,c,e.mode))),{valid:!a.some(l=>l.level==="error"),diagnostics:a,generation_id:n,validated_at:new Date().toISOString()}}function rn(e,n,{enqueue:o,log:r,publish:a,eventData:c,trimLogs:l},i,d,s,p=!1){const v=p?Xt:Ce,m=structuredClone(v),_=()=>{const k=structuredClone(m);return e.resources.geodata.configurable_sources===!0&&(k.geodata=s.settings()),k};let b=null,w=[],N;const C=()=>N??=Promise.all([Promise.all((p?ft:pt).map(ce)),p?Promise.all(en.map(ce)):null]).then(([k,$])=>(b=k,w=$??[...k],k));let t=40,f=0;const u=k=>k.kind==="main"||k.kind==="include";function g(k,$=w){const j=[],E=$.find(U=>U.kind==="main"),H=U=>{if(j.some(M=>M.id===U.id))return;const y=U.id===k?.id?k.content:U.content;j.push({id:U.id,path:U.path,content:y});for(const{path:M}of ve(y))Ke($,E.path,M).forEach(H)};return E&&H(E),j}function A(k,$){const j=H=>new TextEncoder().encode(H).length;if(j(JSON.stringify($))>e.limits.max_json_body_bytes)throw new h(413,"request_too_large","Request body exceeds its limit");const E=e.resources.config.max_bytes;if(E!==void 0&&j(k)>E)throw new h(413,"request_too_large",`Source content exceeds ${E} bytes`)}function S(){const k=String(t+1),$=g();$.length&&d($.map(E=>E.content).join(`
`),k),b&&(b=[...w],s.follow(G(b).rules.flatMap(E=>E.kind==="rule"?[E.expression]:[]))),t+=1,Object.assign(m,structuredClone(v),{observed_at:new Date().toISOString()}),r("info","honk::routing","Routing generation published.",{generation_id:String(t)});const j=String(t);return n.generation={...n.generation,active_id:j,config_revision:j,activated_at:new Date().toISOString()},a({id:"",event:"generation.changed",data:{...c(),generation_id:j,previous_generation_id:String(t-1)}}),j}async function O(k){await C();const $=W(w.find(E=>E.kind==="main"),"Main source"),j=await ce({...$,content:k($.content),loaded_at:new Date().toISOString()});return()=>{if(w.find(E=>E.id===$.id)!==$)throw new h(412,"stale_revision","The main source changed before activation");return w=w.map(E=>E.id===$.id?j:E),S()}}function G(k){const $=k.find(I=>I.kind==="main"),j=new Map(k.map(I=>[Y(void 0,I.path),I])),E=new Map([...ut.rules,...ze].map(I=>[I.cond+" -> "+I.target+(I.must?"(must)":""),I.id])),H=[];let U=null;const y=new Set,M=(I,P)=>{if(!y.has(I.id)){y.add(I.id),ge(I.content,"routing",P).forEach(({code:R,raw:F,line:D})=>{const T=/^include\s+(\S+)$/.exec(R);if(T){const He=j.get(Y($.path,T[1]));He&&M(He,!0);return}const L=/^fallback:\s*(\S+)$/.exec(R),X=/^(.+?)\s*->\s*(\S+)$/.exec(R);if(!L&&!X)return;const Q=F.search(/\S/),At=new TextEncoder().encode(F.slice(0,Q)).length+1,le={file:I.path.split("/").pop(),source_id:I.id,line:D,column:At};if(L){U={outbound:L[1],source:le},H.push({rule_id:"fallback",index:H.length,expression:R,outbound:L[1],must:!1,source:le,kind:"fallback"});return}const $t=X[2].endsWith("(must)"),Mt=X[2].replace(/\(must\)$/,"");H.push({rule_id:E.get(R)??`${le.file}:${le.line}`,index:H.length,expression:X[1],outbound:Mt,must:$t,source:le,kind:"rule"})});for(const{path:R}of ve(I.content))Ke(k,$.path,R).forEach(F=>M(F,!0))}};return $&&M($,!1),{rules:H,fallback:U}}const z=async()=>{await C();const{rules:k,fallback:$}=G(b);if(!$)throw new h(503,"snapshot_unavailable","The routing section has no fallback",null,null,1);return{generation_id:String(t),rules:k,fallback:$}};return{api:{rules:async k=>{if(k?.throwIfAborted(),!e.resources.rules.available)throw new h(404,"capability_not_supported","The rule list is unavailable");return z()},config:async k=>{if(k?.throwIfAborted(),!e.resources.config.available)throw new h(404,"capability_not_supported","Configuration readback is unavailable");await C();const $=b,j=String(t),E=i();return{generation_id:j,revision:j,sources:$.map(H=>e.resources.config.content?{...H}:{...H,content:void 0}),diagnostics:[...$.filter(u).flatMap(H=>mt(H.id,H.content,E,"full").filter(U=>U.level!=="error")),...p?qt:[]],secrets_redacted:!0}},validateConfig:async(k,$)=>{if($?.throwIfAborted(),!e.resources.config_validate.available)throw new h(404,"capability_not_supported","Validation is unavailable");if(!e.resources.config_validate.modes?.includes(k.mode))throw new h(400,"invalid_request",`Mode ${k.mode} is not advertised`);return k.mode==="full"&&await C(),$e(k,String(t),w.filter(u))},replaceConfigSource:async(k,$,j,E)=>{E?.throwIfAborted(),await C();const U=W(w.find(I=>I.id===k),"Configuration source");if(!e.resources.config.writable||!U.writable)throw new h(403,"permission_denied","This source is read-only");if(A($,{content:$}),!j)throw new h(428,"precondition_required","If-Match is required");if(j.replace(/^"|"$/g,"")!==U.content_sha256)throw new h(412,"stale_revision","The source changed on disk; fetch it again before retrying");const y=$e({sources:g({id:k,content:$}),mode:"full"},String(t));if(!y.valid)throw new h(422,"unsupported_value","Validation found errors; nothing was written",null,{diagnostics:y.diagnostics});const M=await ce({...U,content:$,loaded_at:new Date().toISOString()});return w=w.map(I=>I.id===k?M:I),r("info","honk::config","Configuration source replaced; reloading.",{source_id:k}),o("reload",()=>{const I=S();return{active_generation_id:I,datapath_generation_id:I}})},createConfigSource:async(k,$,j)=>{j?.throwIfAborted();const E=e.resources.config;if(!E.available||!E.create)throw new h(404,"capability_not_supported","Creating configuration sources is unavailable");if(!E.writable)throw new h(403,"permission_denied","Configuration writes are disabled");if(A($,{path:k,content:$}),Et(k)||new TextEncoder().encode(k).length>1024)throw new h(400,"invalid_request","path must be a relative .dae path with normal segments");await C();const H=W(w.find(R=>R.kind==="main"),"Main source"),U=Y(H.path,k),y=()=>{if(w.some(R=>Y(void 0,R.path)===U))throw new h(409,"state_conflict",`${k} already exists`);if(E.max_sources!==void 0&&w.length>=E.max_sources)throw new h(413,"request_too_large","Source count exceeds the advertised max_sources")};if(y(),!g().some(R=>ve(R.content).some(F=>Te(Y(H.path,F.path),U)))){const R={level:"error",source_id:H.id,line:null,column:null,span:null,code:"source-not-included"};throw new h(422,"unsupported_value","No include pattern matches the path; nothing was written",null,{diagnostic Line truncated
`);e=e.slice(0,l.close)+`
`+d+`
`+e.slice(l.close);for(const s of i.reverse())e=e.slice(0,s.from)+e.slice(s.to);return e}function Xe(e){try{return e()}catch{throw new h(422,"unsupported_value","The value cannot be written to the configuration")}}const Qe=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function hn(e,n,{enqueue:o,log:r,pending:a},c,l,i,d,s=!1){const p=_e("nodes"),v=_e("providers"),m=structuredClone(cn),{nodes:_,groups:b}=ln(Number.isFinite(n)?n:120,s);for(const t of m)t.node_count=_.filter(f=>f.provider_id===t.id).length;s&&Object.assign(m.find(t=>t.id==="sub-c"),{status:"stale",last_error:de});const w=new Map,N=new Set;return{api:{nodes:async(t,f)=>{if(f?.throwIfAborted(),!e.resources.nodes.available)throw new h(404,"capability_not_supported","Nodes are unavailable");const u=p(t?.group_id?_.filter(g=>g.group_ids.includes(t.group_id)):_,t);return{observed_at:V,nodes:u.items,next_cursor:u.next_cursor}},groups:async t=>{if(t?.throwIfAborted(),!e.resources.groups.available)throw new h(404,"capability_not_supported","Groups are unavailable");return b.map(f=>({id:f.id,name:f.name,icon:f.icon,config_revision:f.config_revision,policy:{...f.policy},member_count:f.members.length,selection:{tcp_member_id:f.runtime.selection.tcp?.member_id??null,udp_member_id:f.runtime.selection.udp?.member_id??null}}))},group:async(t,f)=>{if(f?.throwIfAborted(),!e.resources.groups.available)throw new h(404,"capability_not_supported","Groups are unavailable");return structuredClone(W(b.find(u=>u.id===t),"Group"))},selectGroup:async(t,f,u)=>{u?.throwIfAborted();const g=W(b.find(x=>x.id===t),"Group"),A=!g.capabilities.can_select&&g.capabilities.can_override;if(!g.capabilities.can_select&&!A)throw new h(404,"capability_not_supported","Group does not support manual selection");W(g.members.find(x=>x.id===f.member_id),"Group member");const S=f.network==="both"?["tcp","udp"]:[f.network];let O=!1;for(const x of S){const k=g.runtime.selection[x]?.member_id;g.runtime.selection[x]={member_id:f.member_id,resolved_leaf_node_id:ye(f.member_id,x,_,b)?.id??null,source:A?"override":"runtime"},!(k===f.member_id||!g.config.interrupt_connections)&&(O=i(t,x)||O)}const G=(w.get(t)??0n)+1n;w.set(t,G);const z={group_id:t,member_id:f.member_id,network:f.network,source:A?"override":"runtime",selection_revision:String(G),connections_interrupted:O};return f.network!=="both"&&(z.resolved_leaf_node_id=g.runtime.selection[f.network]?.resolved_leaf_node_id),z},clearGroupOverride:async(t,f,u)=>{u?.throwIfAborted();const g=W(b.find(G=>G.id===t),"Group");if(!g.capabilities.can_override)throw new h(409,"state_conflict","Group has no override to clear");const A=f==="both"?["tcp","udp"]:[f],S=an(g);for(const G of A)g.runtime.selection[G]={member_id:S,resolved_leaf_node_id:ye(S,G,_,b)?.id??null,source:"policy"};const O=(w.get(t)??0n)+1n;return w.set(t,O),{group_id:t,network:f,selection_revision:String(O),connections_interrupted:!1,selection:structuredClone(g.runtime.selection)}},patchGroup:async(t,f,u,g)=>{g?.throwIfAborted();const A=W(b.find(z=>z.id===t),"Group");if(u!=='"'+A.config_revision+'"')throw new h(412,"stale_revision","Group configuration revision changed");if(N.has(t))throw new h(409,"state_conflict","Group update is pending");const S=e.resources.groups.max_patch_operations;if(S!==void 0&&f.length>S)throw new h(413,"request_too_large","Too many patch operations");const O=mn(A,f),G=await l(z=>gn(z,A.name,O));return N.add(t),o("group_update",()=>{N.delete(t);const z=G();return{group_id:t,config_revision:z}})},startProbe:async(t,f)=>{f?.throwIfAborted();const u=e.resources.probes;if(!u.available)throw new h(404,"capability_not_supported","Probes are unavailable");const g=t.ip_version==="any"?["ipv4","ipv6"]:[t.ip_version];if(!u.targets?.includes(t.target.type)||!u.kinds?.includes(t.kind)||!u.purposes?.includes(t.purpose)||t.transport.some(x=>!u.transports?.includes(x))||g.some(x=>!u.ip_versions?.includes(x)))throw new h(422,"unsupported_value","Probe dimensions are not advertised");const A=t.target,S=A.type==="group"?W(b.find(x=>x.id===A.group_id),"Group"):void 0;if(A.type==="node"&&W(_.find(x=>x.id===A.node_id),"Node"),!t.transport.length||t.transport.some(x=>S&&!S.capabilities.probe_transports.includes(x))||t.kind!=="dns"&&(t.purpose!=="data"||t.transport.some(x=>x!=="tcp"))||t.kind==="dns"&&t.purpose!=="dns")throw new h(422,"unsupported_value","Unsupported probe dimensions");if(S&&Array.isArray(t.members)&&t.members.some(x=>!S.members.some(k=>k.id===x)))throw new h(422,"unsupported_value","Probe member is not in this group");const O=ht(t,_,b).length,G=u.limits;if(O>G.max_members_per_job||O*t.transport.length*g.length>G.max_results_per_job)throw new h(413,"request_too_large","Probe exceeds the advertised member or result limit");const z=structuredClone(t);return o("probe",()=>fn(z,_,b,new Date().toISOString()))},providers:async(t,f)=>{if(f?.throwIfAborted(),!e.resources.providers.available)throw new h(404,"capability_not_supported","Providers are unavailable");const u=e.resources. Line truncated
`),x=Xe(()=>z.length?` ${Be(t.name)}: {
url: ${se(t.url)}
${z.join("")} }
`:` ${Be(t.name)}: ${se(t.url)}
`),k=await l($=>$.replace(/^(subscription \{\n)/m,`$1${x}`));return r("info","honk::subscription","Subscription added.",{provider:t.name}),k(),structuredClone(W(m.find($=>$.name===t.name),"Provider"))},deleteProvider:async(t,f)=>{if(f?.throwIfAborted(),!e.resources.providers.can_manage)throw new h(404,"capability_not_supported","Provider management is unavailable");const u=m.findIndex(O=>O.id===t);if(u<0)return{deleted:0};if(m[u].kind==="inline")throw new h(404,"capability_not_supported","The inline provider is the node section itself");const g=m[u],A=Qe(g.name),S=await l(O=>O.replace(new RegExp(`^\\s*${A}:\\s*\\{\\n[\\s\\S]*?\\n\\s*\\}\\n|^\\s*${A}:.*\\n`,"m"),""));return r("info","honk::subscription","Subscription removed.",{provider:g.name}),S(),{deleted:1}},createNode:async(t,f)=>{if(f?.throwIfAborted(),!e.resources.nodes.can_manage)throw new h(404,"capability_not_supported","Node management is unavailable");const u=/^([a-z][a-z0-9+.-]*):\/\/\S+$/i.exec(t.link.trim())?.[1]?.toLowerCase();if(!u||!dn.includes(u))throw new h(422,"unsupported_value",`Unsupported share link scheme "${u??""}"`);if(_.some(S=>S.name===t.name))throw new h(409,"state_conflict",`An inline node named ${t.name} already exists`);const g=Xe(()=>` ${se(t.name)}: ${se(t.link.trim())}
`),A=await l(S=>S.replace(/^(node \{\n)/m,`$1${g}`));return r("info","honk::config","Node added.",{node:t.name,protocol:u}),A(),structuredClone(W(_.find(S=>S.name===t.name),"Node"))},deleteNode:async(t,f)=>{if(f?.throwIfAborted(),!e.resources.nodes.can_manage)throw new h(404,"capability_not_supported","Node management is unavailable");const u=_.find(A=>A.id===t);if(!u)return{deleted:0};if(u.provider_id!=="inline")throw new h(404,"capability_not_supported","Only inline nodes can be deleted; refresh or delete the provider instead");const g=await l(A=>A.replace(new RegExp(`^\\s*'${Qe(u.name)}':.*\\n`,"m"),""));return r("info","honk::config","Node removed.",{node:u.name}),g(),{deleted:1}},geodata:async t=>{if(t?.throwIfAborted(),!e.resources.geodata.available)throw new h(404,"capability_not_supported","Geodata is unavailable");return d.status()},updateGeodata:async t=>{if(t?.throwIfAborted(),!e.resources.geodata.can_update)throw new h(404,"capability_not_supported","Geodata update is unavailable");if(a("geodata_update"))throw new h(409,"state_conflict","A geodata update is already queued or running");return o("geodata_update",()=>{const f=d.update();return r("info","honk::geodata","Geodata updated; reloading.",{assets:f.assets.map(u=>u.kind)}),c(),f})}},groupNames:()=>new Set(b.map(t=>t.name)),groupIds:()=>new Set(b.map(t=>t.id)),activate:(t,f)=>_n(t,f,_,b,m)}}const bn=[{level:"info",target:"honk::main",message:"Runtime snapshot captured.",fields:{pid:1842}},{level:"info",target:"honk::config",message:"Configuration state checked.",fields:{sources:4,generation_id:"40"}},{level:"info",target:"honk::subscription",message:"Subscription status checked.",fields:{provider:"sub-c"}},{level:"warn",target:"honk::subscription",message:"Subscription served from cache.",fields:{provider:"sub-c",age_seconds:1800}},{level:"warn",target:"honk::datapath",message:"Routing map sample delayed.",fields:{interface:"lan0"}},{level:"info",target:"honk::dns",message:"DNS listener healthy.",fields:{bind:"127.0.0.1:5353"}},{level:"info",target:"honk::routing",message:"Routing generation checked.",fields:{generation_id:"40"}},{level:"error",target:"honk::group",message:"Health check failed.",fields:{node:"jp-01",error:"connect timeout"}},{level:"info",target:"honk::api",message:"Native API request served.",fields:{listen:"127.0.0.1:9090"}}];function wn(e,n,o,r,a,c=2500,l=!1){const i=new Map;let d=0;const s=new Set,p=[],v=new Map,m=new Map,_=()=>{for(;p.length&&Date.now()-Date.parse(p[0].data.observed_at)>n.retention_seconds*1e3;)p.shift();const y=p.length?Number(p[0].id.split(":")[1])-1:d,M=S.length?Number(S[0].id.split(":")[2])-1:G;for(const[I,P]of v)(P.position<(P.stream==="events"?y:M)||P.stream==="events"&&Date.now()-P.issued>n.retention_seconds*1e3)&&(v.delete(I),m.delete(JSON.stringify([P.stream,P.filter,P.position])))},b=(y,M,I)=>{const P=JSON.stringify([y,M,I]),R=m.get(P);if(R)return R;const F=ct();return v.set(F,{stream:y,filter:M,position:I,issued:Date.now()}),m.set(P,F),F},w=(y,M,I,P)=>{if(y===void 0)return P;_();const R=v.get(y);if(!R||R.stream!==M||R.filter!==I)throw new h(409,"event_cursor_expired","The stream cursor cannot be replayed");return R.position};let N;const C=()=>({instance_id:K,observed_at:new Date().toISOString()});function t(y){y.id=`${K}:${++d}`,p.push(y),p.length>n.max_buffered_events&&p.shift(),_(),s.forEach(M=>M(y))}function f(){o.observed_at=new Date().toISOString(),t({id:"",event:"runtime.updated",data:{...C(),href:"/api/v1/runtime"}})}const u=(y,M)=>{const I="op-"+(i.size+1),P=new Date().toISOString(),R={operation_id:I,kind:y,created_at:P,started_at:P};i.set(I,{...R,finished_at:null,status:"running",result:null,error:null,retryAfter:1}),t({id:"",event:"operation.updated",data:{...C(),resource_id:I,status:"running",href:"/api/v1/operations/"+I}}),setTimeout(()=>{try{i.set(I,{...R,status:"succeeded",result:M(),error:null,finished_at:new Date().toISOString()})}catch(T){i.set(I,{...R,status:"failed",finished_at:new Date().toISOString(),result:null,error:T instanceof h?{code:T.code,message:T.message,details:T.details}:{code:"operation_failed",message:T instanceof Error?T.message:String(T)}})}const D=i.get(I);y==="reload"&&(D.status==="succeeded"||D.status==="failed")&&(o.last_reload={operation_id:I,status:D.status,finished_at:D.finished_at,error:D.error}),t({id:"",event:"operation.updated",data:{...C(),resource_id:I,status:D.status,href:"/api/v1/operations/"+I}}),f()},1e3);const F="/api/v1/operations/"+I;return{operation_id:I,kind:y,status:"queued",href:F,retryAfter:1}},g=async(y,M)=>(M?.throwIfAborted(),structuredClone(W(i.get(y),"Operation"))),A=["trace","debug","info","warn","error"],S=[],O=new Set;let G=0;function z(){const y=r().buffered_records;S.length>y&&S.splice(0,S.length-y),_()}const x=(y,M,I,P=null,R=Date.now())=>{const F={id:`${K}:logs:${++G}`,ts:new Date(R).toISOString(),level:y,target:M,message:I,fields:P};S.push(F),z(),O.forEach(D=>D(F))},k=[()=>x("info","honk::routing","Routing generation p Line truncated
@@ -1 +0,0 @@
@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1PCEKM_Y.woff2)format("woff2");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116;ascent-override:100%;descent-override:20%;line-gap-override:0%}@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1NyEKM_Y.woff2)format("woff2");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB;ascent-override:100%;descent-override:20%;line-gap-override:0%}@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1NiEKM_Y.woff2)format("woff2");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;ascent-override:100%;descent-override:20%;line-gap-override:0%}@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1OCEK.woff2)format("woff2");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;ascent-override:100%;descent-override:20%;line-gap-override:0%}:root,:root[data-family=rose-pine]{--rp-base:#faf4ed;--rp-surface:#fffaf3;--rp-overlay:#f2e9e1;--rp-muted:#9893a5;--rp-subtle:#797593;--rp-text:#464261;--rp-love:#b4637a;--rp-gold:#ea9d34;--rp-rose:#d7827e;--rp-pine:#286983;--rp-foam:#56949f;--rp-iris:#907aa9;--rp-c1:var(--rp-pine);--rp-c2:var(--rp-foam);--rp-c3:var(--rp-iris);--rp-c4:var(--rp-gold);--rp-c5:var(--rp-rose);--rp-c6:var(--rp-love);--rp-c7:var(--rp-pine);--rp-c8:var(--rp-foam);--rp-hl-low:#f4ede8;--rp-hl-med:#dfdad9;--rp-hl-high:#cecacd;--rp-shadow:0 1px 2px #57527914}:root[data-family=rose-pine]{--rp-negative-text:var(--rp-text);--rp-notice-text:var(--rp-text);--rp-positive-text:var(--rp-text);--rp-accent-tile-text:var(--rp-text);--rp-info-tile-text:var(--rp-text);--rp-subtle-text:var(--rp-text)}:root[data-family=rose-pine][data-scheme=dark],:root[data-flavour=moon][data-scheme=dark]{--rp-base:#232136;--rp-surface:#2a273f;--rp-overlay:#393552;--rp-muted:#6e6a86;--rp-subtle:#908caa;--rp-text:#e0def4;--rp-love:#eb6f92;--rp-gold:#f6c177;--rp-rose:#ea9a97;--rp-pine:#3e8fb0;--rp-foam:#9ccfd8;--rp-iris:#c4a7e7;--rp-c1:var(--rp-pine);--rp-c2:var(--rp-foam);--rp-c3:var(--rp-iris);--rp-c4:var(--rp-gold);--rp-c5:var(--rp-rose);--rp-c6:var(--rp-love);--rp-c7:var(--rp-pine);--rp-c8:var(--rp-foam);--rp-hl-low:#2a283e;--rp-hl-med:#44415a;--rp-hl-high:#56526e;--rp-shadow:0 1px 2px #0000004d;--rp-line:var(--rp-hl-med);--rp-fill:var(--rp-hl-med);--rp-on-accent:#191724;--rp-accent-text:var(--rp-text);--rp-negative-text:var(--rp-negative);--rp-notice-text:var(--rp-notice);--rp-positive-text:var(--rp-positive);--rp-info-text:var(--rp-text);--rp-negative-tile-text:var(--rp-text)}:root[data-family=catppuccin]{--rp-base:#e6e9ef;--rp-surface:#eff1f5;--rp-overlay:#dce0e8;--rp-muted:#9ca0b0;--rp-subtle:#6c6f85;--rp-text:#4c4f69;--rp-love:#d20f39;--rp-gold:#df8e1d;--rp-rose:#fe640b;--rp-pine:#1e66f5;--rp-foam:#179299;--rp-iris:#8839ef;--rp-c1:#1e66f5;--rp-c2:#179299;--rp-c3:#8839ef;--rp-c4:#fe640b;--rp-c5:#40a02b;--rp-c6:#ea76cb;--rp-c7:#df8e1d;--rp-c8:#d20f39;--rp-hl-low:#dce0e8;--rp-hl-med:#ccd0da;--rp-hl-high:#bcc0cc;--rp-shadow:0 1px 2px #4c4f691a;--rp-on-accent:#fff;--rp-accent-text:var(--rp-text);--rp-negative-text:var(--rp-text);--rp-notice-text:var(--rp-text);--rp-positive-text:var(--rp-text);--rp-info-text:var(--rp-text);--rp-subtle-text:var(--rp-text)}:root[data-family=catppuccin][data-scheme=dark],:root[data-flavour=mocha][data-scheme=dark]{--rp-base:#181825;--rp-surface:#1e1e2e;--rp-overlay:#313244;--rp-muted:#6c7086;--rp-subtle:#a6adc8;--rp-text:#cdd6f4;--rp-love:#f38ba8;--rp-gold:#f9e2af;--rp-rose:#fab387;--rp-pine:#89b4fa;--rp-foam:#94e2d5;--rp-iris:#cba6f7;--rp-c1:#89b4fa;--rp-c2:#94e2d5;--rp-c3:#cba6f7;--rp-c4:#fab387;--rp-c5:#a6e3a1;--rp-c6:#f5c2e7;--rp-c7:#f9e2af;--rp-c8:#f38ba8;--rp-hl-low:#313244;--rp-hl-med:#45475a;--rp-hl-high:#585b70;--rp-shadow:0 1px 2px #00000059;--rp-on-accent:var(--rp-surface);--rp-accent-text:var(--rp-accent);--rp-negative-text:var(--rp-negative);--rp-notice-text:var(--rp-notice);--rp-positive-text:var(--rp-positive);--rp-info-text:var(--rp-info);--rp-negative-tile-text:var(--rp-text);--rp-subtle-text:var(--rp-subtle)}:root[data-family=nord]{--rp-base:#e5e9f0;--rp-surface:#eceff4;--rp-overlay:#d8dee9;--rp-muted:#4c566a;--rp-subtle:#3b4252;--rp-text:#2e3440;--rp-love:#bf616a;--rp-gold:#d08770;--rp-rose:#b48ead;--rp-pine:#5e81ac;--rp-foam:#8fbcbb;--rp-iris:#81a1c1;--rp-c1:#88c0d0;--rp-c2:#a3be8c;--rp-c3:#b48ead;--rp-c4:#d08770;--rp-c5:#5e81ac;--rp-c6:#ebcb8b;--rp-c7:#bf616a;--rp-c8:#8fbcbb;--rp-hl-low:#e5e9f0;--rp-hLine truncated
@@ -1,58 +0,0 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./fonts-tc-B6Zt5HQN.css","./fonts-sc-DWPGxLPK.css","./SearchDialog-ByDSjolq.js","./vendor-react-Bf71BWbF.js","./flows-Bv2rvXJX.js","./nav--TYgv3Ng.js","./nav-BIVfQR1w.js","./nav-BIpfWn6-.js","./nav-BeFLfZq8.js","./index-BJD5IosD.js","./geodata-DprMPspn.js","./AreaChart-BPSqH5mH.js","./layout-B3T-zLsm.js","./AreaCurve-BriPYJva.js","./array-C0P64tl-.js","./Sparkline-C9XwgOxX.js","./Donut-Dusnd_Se.js","./NodeSearch-BdGpTyio.js","./Virtualizer-CTh266-x.js","./useFilter-BYneYrGs.js","./ListLayout-DU_9AgrU.js","./Overview-D7zbQze3.js","./files-BxEOxSF8.js","./Table-DLlwyNFJ.js","./useGridSelectionCheckbox-BK6qtlfZ.js","./ActionGroup-C-LVMOvQ.js","./Connections-DAjj-jeW.js","./FactStrip-vcLr7nBw.js","./ranked-C_Wt6A1w.js","./TimeCell-DxlzlVpw.js","./link-CaqmdEp1.js","./DaeCode-B4MDdwFy.js","./outbounds-CM0Hhk3q.js","./Dns-BCY3zvs7.js","./dns-BoPCaePc.js","./Policies-VixfIaVZ.js","./policyText-IIH31itq.js","./PolicyPicker-iyQz7WhP.js","./Rules-2i24Jtpl.js","./setup-BqwQo7FE.js","./probe-CjOLdDVD.js","./Rules-l5FnUA9B.css","./Nodes-BPHOu_UD.js","./AddCircle-DSsJ-CRu.js","./Config-BVUCd2Cc.js","./vendor-editor-BYSNX95r.js","./Events-BUl_BoAv.js","./logs-KkruktUh.js","./Logs-JK5xuRFC.js","./Settings-Cznhh7lT.js","./auth-CPB25VPp.js","./Login-CoF6Tj1K.js"])))=>i.map(i=>d[i]);
import{$ as w,r as c,c as cp,s as Us,a as Zt,b as bc,j as f,d as up}from"./vendor-react-Bf71BWbF.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const dp="modulepreload",fp=function(t,e){return new URL(t,e).href},ba={},pe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let l=function(d){return Promise.all(d.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};const a=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),u=o?.nonce||o?.getAttribute("nonce");i=l(n.map(d=>{if(d=fp(d,r),d in ba)return;ba[d]=!0;const h=d.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(!!r)for(let y=a.length-1;y>=0;y--){const g=a[y];if(g.href===d&&(!h||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${p}`))return;const m=document.createElement("link");if(m.rel=h?"stylesheet":dp,h||(m.as="script"),m.crossOrigin="",m.href=d,u&&m.setAttribute("nonce",u),document.head.appendChild(m),h)return new Promise((y,g)=>{m.addEventListener("load",y),m.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(l){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=l,window.dispatchEvent(a),!a.defaultPrevented)throw l}return i.then(l=>{for(const a of l||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};function rt(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}const ee=typeof document<"u"?w.useLayoutEffect:()=>{},mc={prefix:String(Math.round(Math.random()*1e10)),current:0},gc=w.createContext(mc),pp=w.createContext(!1);let Ni=new WeakMap;function hp(t=!1){let e=c.useContext(gc),n=c.useRef(null);if(n.current===null&&!t){let r=w.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(r){let i=Ni.get(r);i==null?Ni.set(r,{id:e.current,state:r.memoizedState}):r.memoizedState!==i.state&&(e.current=i.id,Ni.delete(r))}n.current=++e.current}return n.current}function bp(t){let e=c.useContext(gc),n=hp(!!t),r=`react-aria${e.prefix}`;return t||`${r}-${n}`}function mp(t){let e=w.useId(),[n]=c.useState(qe()),r=n?"react-aria":`react-aria${mc.prefix}`;return t||`${r}-${e}`}const gp=typeof w.useId=="function"?mp:bp;function yp(){return!1}function vp(){return!0}function $p(t){return()=>{}}function qe(){return typeof w.useSyncExternalStore=="function"?w.useSyncExternalStore($p,yp,vp):c.useContext(pp)}function xp(t){let[e,n]=c.useState(t),r=c.useRef(e),i=c.useRef(null),s=c.useRef(()=>{if(!i.current)return;let a=i.current.next();if(a.done){i.current=null;return}r.current===a.value?s.current():n(a.value)});ee(()=>{r.current=e,i.current&&s.current()});let l=c.useCallback(a=>{i.current=a(r.current),s.current()},[s]);return[e,l]}let wp=!!(typeof window<"u"&&window.document&&window.document.createElement),pn=new Map,on;typeof FinalizationRegistry<"u"&&(on=new FinalizationRegistry(t=>{pn.delete(t)}));let Li=new WeakMap;function de(t){let[e,n]=c.useState(t),r=c.useRef(null),i=gp(e),s=c.useRef(null),l=Li.get(s);if(on&&l!==i&&(l!=null&&on.unregister(s),on.register(s,i,s),Li.set(s,i)),wp){const a=pn.get(i);a&&!a.includes(r)?a.push(r):pn.set(i,[r])}return ee(()=>{let a=i;return()=>{on&&(on.unregister(s),Li.delete(s)),pn.delete(a)}},[i]),c.useEffect(()=>{let a=r.current;return a&&n(a),()=>{a&&(r.current=null)}}),i}function Ep(t,e){if(t===e)return t;let n=pn.get(t);if(n)return n.forEach(i=>i.current=e),e;let r=pn.get(e);return r?(r.forEach(i=>i.current=t),t):e}function et(t=[]){let e=de(),[n,r]=xp(e),i=c.useCallback(()=>{r(function*(){yield e,yield document.getElementById(e)?e:void 0})},[e,r]);return ee(i,[e,i,...t]),n}function Rt(...t){return t.length===1&&t[0]?t[0]:e=>{let n=!1;const r=t.map(i=>{const s=ma(i,e);return n||=typeof s=="function",s});if(n)return()=>{r.forEach((i,s)=>{typeof i=="function"?i():ma(t[s],null)})}}}function ma(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function _(...t){let e={...t[0]};for(let n=1;n<t.length;n++){let r=t[n];for(let i in r){let s=e[i],l=r[i];typeof s=="function"&&typeof l=="function"&&i[0]==="o"&&i[1]==="n"&&i.charCodeAt(2)>=65&&i.charCodeAt(2)<=90?e[i]=rt(s,l):(i==="className"||i==="UNSAFE_className")&&typeof s=="string"&&typeof l=="string"?e[i]=cp(s,l):i==="id"&&s&&l?e.id=Ep(s,l):i==="ref"&&s&&l?e.ref=Rt(s,l):e[i]=l!==void 0?l:s}}retuLine truncated
@layer {
[${Ma}] {
touch-action: pan-x pan-y pinch-zoom;
}
}
`.trim(),C.head.prepend(K)},[p]),c.useEffect(()=>{let C=g.current;return()=>{h||Ca(C.target??void 0);for(let K of C.disposables)K();C.disposables=[]}},[h]),{isPressed:o||m,pressProps:_(b,V,{[Ma]:!0})}}function il(t){return t.tagName==="A"&&t.hasAttribute("href")}function Ii(t,e){const{key:n,code:r}=t,i=e,s=i.getAttribute("role");return(n==="Enter"||n===" "||n==="Spacebar"||r==="Space")&&!(i instanceof xe(i).HTMLInputElement&&!ou(i,n)||i instanceof xe(i).HTMLTextAreaElement||i.isContentEditable)&&!((s==="link"||!s&&il(i))&&n!=="Enter")}function Kt(t,e){let n=e.clientX,r=e.clientY;return{currentTarget:t,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,clientX:n,clientY:r,key:e.key}}function Zh(t){return t instanceof HTMLInputElement?!1:t instanceof HTMLButtonElement?t.type!=="submit"&&t.type!=="reset":!il(t)}function Na(t,e){return Fe()&&e==="Enter"?!1:t instanceof HTMLInputElement?e==="Enter"&&(t.type==="checkbox"||t.type==="radio")?!1:!ou(t,e):Zh(t)}const Qh=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function ou(t,e){return t.type==="checkbox"||t.type==="radio"?e===" ":Qh.has(t.type)}function eb(t,e){let{elementType:n="a",onPress:r,onPressStart:i,onPressEnd:s,onPressChange:l,onClick:a,isDisabled:o,...u}=t,d={};n!=="a"&&(d={role:"link",tabIndex:o?void 0:0});let{focusableProps:h}=Mt(t,e),{pressProps:p,isPressed:b}=zt({onPress:r,onPressStart:i,onPressEnd:s,onPressChange:l,onClick:a,isDisabled:o,ref:e}),m=Y(u,{labelable:!0}),y=_(h,p),g=En(),v=si(t);return{isPressed:b,linkProps:_(m,v,{...y,...d,"aria-disabled":o||void 0,"aria-current":t["aria-current"],onClick:$=>{p.onClick?.($),Lc($,g,t.href,t.routerOptions)}})}}function Pn(t){let{isDisabled:e,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=t,s=c.useRef({isFocusWithin:!1}),{addGlobalListener:l,removeAllGlobalListeners:a}=ui(),o=c.useCallback(h=>{Z(h.currentTarget,F(h))&&s.current.isFocusWithin&&!Z(h.currentTarget,h.relatedTarget)&&(s.current.isFocusWithin=!1,a(),n&&n(h),i&&i(!1))},[n,i,s,a]),u=Pc(o),d=c.useCallback(h=>{if(!Z(h.currentTarget,F(h)))return;let p=F(h);const b=te(p),m=se(b);if(!s.current.isFocusWithin&&m===p){r&&r(h),i&&i(!0),s.current.isFocusWithin=!0,u(h);let y=h.currentTarget;l(b,"focus",g=>{let v=F(g);if(s.current.isFocusWithin&&!Z(y,v)){let $=new b.defaultView.FocusEvent("blur",{relatedTarget:v});Sc($,y);let x=Js($);o(x)}},{capture:!0})}},[r,i,u,l,o]);return e?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:o}}}function Le(t={}){let{autoFocus:e=!1,isTextInput:n,within:r}=t,i=c.useRef({isFocused:!1,isFocusVisible:e||kt()}),[s,l]=c.useState(!1),[a,o]=c.useState(()=>i.current.isFocused&&i.current.isFocusVisible),u=c.useCallback(()=>o(i.current.isFocused&&i.current.isFocusVisible),[]),d=c.useCallback(b=>{i.current.isFocused=b,i.current.isFocusVisible=kt(),l(b),u()},[u]);Xp(b=>{i.current.isFocusVisible=b,u()},[n,s],{enabled:s,isTextInput:n});let{focusProps:h}=Qs({isDisabled:r,onFocusChange:d}),{focusWithinProps:p}=Pn({isDisabled:!r,onFocusWithinChange:d});return{isFocused:s,isFocusVisible:a,focusProps:r?p:h}}let os=!1,$r=0;function tb(){os=!0,setTimeout(()=>{os=!1},500)}function La(t){t.pointerType==="touch"&&tb()}function nb(){let t=te(null);if(!(typeof t>"u"))return $r===0&&typeof PointerEvent<"u"&&t.addEventListener("pointerup",La),$r++,()=>{$r--,!($r>0)&&typeof PointerEvent<"u"&&t.removeEventListener("pointerup",La)}}function ke(t){let{onHoverStart:e,onHoverChange:n,onHoverEnd:r,isDisabled:i}=t,[s,l]=c.useState(!1),a=c.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;c.useEffect(nb,[]);let{addGlobalListener:o,removeAllGlobalListeners:u}=ui(),{hoverProps:d,triggerHoverEnd:h}=c.useMemo(()=>{let p=(y,g)=>{if(a.pointerType=g,i||g==="touch"||a.isHovered||!Z(y.currentTarget,F(y)))return;a.isHovered=!0;let v=y.currentTarget;a.target=v,o(te(F(y)),"pointerover",$=>{a.isHovered&&a.target&&!Z(a.target,F($))&&b($,$.pointerType)},{capture:!0}),e&&e({type:"hoverstart",target:v,pointerType:g}),n&&n(!0),l(!0)},b=(y,g)=>{let v=a.target;a.pointerType="",a.target=null,!(g==="touch"||!a.isHovered||!v)&&(a.isHovered=!1,u(),r&&r({type:"hoverend",target:v,pointerType:g}),n&&n(!1),l(!1))},m={};return typeof PointerEvent<"u"&&(m.onPointerEnter=y=>{os&&y.pointerType==="mouse"||p(y,y.pointerType)},m.onPointerLeave=y=>{!i&&Z(y.currentTarget,F(y))&&b(y,y.pointerType)}),{hoverProps:m,triggerHoverEnd:b}},[e,n,r,i,a,o,u]);return c.useEffect(()=>{i&&h({currentTarget:a.target},a.pointerType)},[i]),{hoverProps:d,isHovered:s}}const rb=c.createContext(null),sl=c.forwardRef(function(e,n){[e,n]=ae(e,n,rb);let r=e.href&&!e.isDisabled?"a":"span",{linkProps:i,isPressed:s}=eb({...e,elementType:r},n),l=Q[r],{hoverProps:a,isHovered:o}=ke(e),{focusProps:u,isFocused:d,isFocusVisible:h}=Le(),p=ie({...e,defaultClassName:"react-aria-Link",values:{isCurrent:!!e["aria-current"],isDisabled:e.isDisabled||!1,isPressed:s,isHovered:o,isFocused:d,isFo Line truncated
@layer {
* {
overscroll-behavior: contain;
}
}`.trim(),document.head.prepend(i);let l=d=>{if(!(d.touches.length===2||n)){if(!e||e===document.documentElement||e===document.body){d.preventDefault();return}e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&d.preventDefault()}},a=d=>{let h=F(d),p=d.relatedTarget;p&&Dn(p)?(p.focus({preventScroll:!0}),lo(p,Dn(h))):p||h.parentElement?.closest("[tabindex]")?.focus({preventScroll:!0})},o=HTMLElement.prototype.focus;Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(d){let h=se(),p=h!=null&&Dn(h);o.call(this,{...d,preventScroll:!0}),(!d||!d.preventScroll)&&lo(this,p)}});let u=rt(hn(document,"touchstart",r,{passive:!1,capture:!0}),hn(document,"touchmove",l,{passive:!1,capture:!0}),hn(document,"blur",a,!0));return()=>{t(),u(),i.remove(),Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:o})}}function lo(t,e){e||!jn?ao(t):jn.addEventListener("resize",()=>ao(t),{once:!0})}function ao(t){let e=document.scrollingElement||document.documentElement,n=t;for(;n&&n!==e;){let r=al(n);if(r!==document.documentElement&&r!==document.body&&r!==n){let i=r.getBoundingClientRect(),s=n.getBoundingClientRect();if(s.top<i.top||s.bottom>i.top+n.clientHeight){let l=i.bottom;jn&&(l=Math.min(l,jn.offsetTop+jn.height));let a=s.top-i.top-((l-i.top)/2-s.height/2);r.scrollTo({top:Math.max(0,Math.min(r.scrollHeight-r.clientHeight,r.scrollTop+a)),behavior:"smooth"})}}n=r.parentElement}}function Em(t,e){let{triggerRef:n,popoverRef:r,groupRef:i,isNonModal:s,isKeyboardDismissDisabled:l,shouldCloseOnInteractOutside:a,...o}=t,u=o.trigger==="SubmenuTrigger",{overlayProps:d,underlayProps:h}=Wu({isOpen:e.isOpen,onClose:e.close,shouldCloseOnBlur:!0,isDismissable:!s||u,isKeyboardDismissDisabled:l,shouldCloseOnInteractOutside:a},i??r),{overlayProps:p,arrowProps:b,placement:m,triggerAnchorPoint:y}=zu({...o,targetRef:n,overlayRef:r,isOpen:e.isOpen,onClose:s&&!u?e.close:null,getTargetRect:o.getTargetRect??(e.point?()=>new DOMRect(e.point.x,e.point.y,0,0):void 0)});qu({isDisabled:s||!e.isOpen}),c.useEffect(()=>{if(e.isOpen&&r.current)return s?am(i?.current??r.current):Vu([i?.current??r.current],{shouldUseInert:!0})},[s,e.isOpen,r,i]);let{focusWithinProps:g}=Pn(t);return{popoverProps:_(d,p,g),arrowProps:b,underlayProps:h,placement:m,triggerAnchorPoint:y}}var Gu={};Gu={dismiss:"Dismiss"};var Ju={};Ju={dismiss:"取消"};var Yu={};Yu={dismiss:"關閉"};var Xu={};Xu={"ar-AE":S,"bg-BG":S,"cs-CZ":S,"da-DK":S,"de-DE":S,"el-GR":S,"en-US":Gu,"es-ES":S,"et-EE":S,"fi-FI":S,"fr-FR":S,"he-IL":S,"hr-HR":S,"hu-HU":S,"it-IT":S,"ja-JP":S,"ko-KR":S,"lt-LT":S,"lv-LV":S,"nb-NO":S,"nl-NL":S,"pl-PL":S,"pt-BR":S,"pt-PT":S,"ro-RO":S,"ru-RU":S,"sk-SK":S,"sl-SI":S,"sr-SP":S,"sv-SE":S,"tr-TR":S,"uk-UA":S,"zh-CN":Ju,"zh-TW":Yu};function Sm(t){return t&&t.__esModule?t.default:t}function gs(t){let{onDismiss:e,...n}=t,r=Qt(Sm(Xu),"@react-aria/overlays"),i=rr(n,r.format("dismiss")),s=()=>{e&&e()};return w.createElement(ol,null,w.createElement("button",{...i,tabIndex:-1,onClick:s,style:{width:1,height:1}}))}const Zu=w.forwardRef(({children:t,...e},n)=>{let r=c.useRef(!1),i=c.useContext(zn),s=_(i||{},{...e,register(){r.current=!0,i&&i.register()}});return s.ref=we(n||i?.ref),el(i,s.ref),c.useEffect(()=>{r.current||(r.current=!0)},[]),w.createElement(zn.Provider,{value:s},t)});function Pm({children:t}){let e=c.useMemo(()=>({register:()=>{}}),[]);return w.createElement(zn.Provider,{value:e},t)}const Cm=c.createContext({});function kl(){return c.useContext(Cm)??{}}const Qu=w.createContext(null);function ys(t){let e=qe(),{portalContainer:n=e?null:document.body,isExiting:r}=t,[i,s]=c.useState(!1),l=c.useMemo(()=>({contain:i,setContain:s}),[i,s]),{getContainer:a}=kl();if(!t.portalContainer&&a&&(n=a()),!n)return null;let o=t.children;return t.disableFocusManagement||(o=w.createElement(gl,{restoreFocus:!0,contain:(t.shouldContainFocus||i)&&!r},o)),o=w.createElement(Qu.Provider,{value:l},w.createElement(Pm,null,w.createElement(Hn.Provider,{value:null},o))),bc.createPortal(o,n)}function ed(){let e=c.useContext(Qu)?.setContain;ee(()=>{e?.(!0)},[e])}function ar(t){let[e,n]=Be(t.isOpen,t.defaultOpen||!1,t.onOpenChange),[r,i]=c.useState(null);const s=c.useCallback(()=>{n(!0)},[n]),l=c.useCallback(()=>{n(!1)},[n]),a=c.useCallback(()=>{n(!e)},[n,e]);return{isOpen:e,setOpen:n,open:s,close:l,toggle:a,point:r,setPoint:i}}function or(t,e=!0){let[n,r]=c.useState(!0),i=n&&e;return ee(()=>{if(i&&t.current&&"getAnimations"in t.current)for(let s of t.current.getAnimations())s instanceof CSSTransition&&s.cancel()},[t,i]),td(t,i,c.useCallback(()=>r(!1),[])),i}function qn(t,e){let[n,r]=c.useState(e?"open":"closed");switch(n){case"open":e||r("exiting");break;case"closed":case"exiting":e&&r("open");break}let i=n==="exiting";return td(t,i,c.useCallback(()=>{r(s=>s==="exiting"?"closed":s)},[])),i}function td(t,e,n){ee(()=>{if(e&&t.current){if(!("getAnimations"in t.current)){n();return}let r=t.current.getAnimations();if(r.length== Line truncated
${n}`:e);const l=[t,i,s??""].join(`
`),a=Pr.get(l);a&&xt.close(a);const o=xt.add({kind:t,text:i,detail:s,action:r},{timeout:r?void 0:5e3,onClose:()=>{Pr.get(l)===o&&Pr.delete(l)}});Pr.set(l,o)},q0=(t,e,n,r)=>{const i=Hl(t,e,n);Ie(i.kind,i.text,{detail:i.detail,action:r})},G0={positive:S0,negative:jd,info:P0,neutral:null};function J0({placement:t="bottom"}){const[e,n="center"]=t.split(" "),r=ne(),[i,s]=c.useState(!1);return c.useEffect(()=>{i?xt.pauseAll():xt.resumeAll()},[i]),c.useEffect(()=>xt.subscribe(()=>{xt.visibleToasts.length===0&&s(!1)}),[]),c.useEffect(()=>{if(!i)return;const l=a=>{if(a.key!=="Escape")return;(a.target?.closest?.(".rp-toasts")||!document.querySelector(Bd))&&s(!1)};return addEventListener("keydown",l),()=>removeEventListener("keydown",l)},[i]),f.jsxs(i0,{queue:xt,className:q("rp-toasts",i&&"expanded"),"data-placement":e,"data-align":n,children:[i&&f.jsx(Ne,{className:"rp-toast-underlay","aria-label":r("toast.collapse"),onPress:()=>s(!1)}),i&&f.jsxs("div",{className:"rp-toast-controls",children:[f.jsx(Ne,{className:"rp-btn sm",onPress:()=>xt.clear(),children:r("toast.clearAll")}),f.jsx(Ne,{className:"rp-btn sm",onPress:()=>s(!1),children:r("toast.collapse")})]}),f.jsx(Y0,{expanded:i,edge:e,onExpand:()=>s(!0)})]})}function Y0({expanded:t,edge:e,onExpand:n}){const r=c.useContext(gi),i=r.visibleToasts;return f.jsx(Md,{className:"rp-toast-list",children:({toast:s})=>{const l=i.indexOf(s);return f.jsx(X0,{item:s,state:r,depth:l,count:i.length,background:!t&&l>0,more:!t&&l===0&&i.length>1?{edge:e,onExpand:n}:null})}})}function X0({item:t,state:e,depth:n,count:r,background:i,more:s}){const l=ne(),a=G0[t.content.kind],{text:o,detail:u,action:d}=t.content;return f.jsxs(s0,{toast:t,className:q("rp-toast",t.content.kind,i&&"background"),style:{zIndex:r-n,"--i":Math.min(n,3)},inert:i||void 0,children:[f.jsxs(l0,{className:"body",children:[a&&f.jsx("span",{className:"icon",children:f.jsx(a,{})}),f.jsxs("div",{className:"msg",children:[f.jsx(Br,{slot:"title",elementType:"div",className:"summary",children:o}),u&&f.jsx(Br,{slot:"description",elementType:"div",className:"detail",children:u})]})]}),f.jsx(Ne,{slot:"close",className:"rp-btn quiet icon close","aria-label":l("close"),children:f.jsx(Al,{})}),(s||d)&&f.jsxs("div",{className:"foot",children:[s&&f.jsxs(Ne,{className:"rp-btn sm quiet more",onPress:s.onExpand,children:[f.jsx(Gt,{className:q(s.edge==="bottom"&&"up")}),l("toast.showAllCount",{n:r})]}),d&&f.jsx(Ne,{className:"rp-btn action",onPress:()=>{d.onAction(),d.closeOnAction&&e.close(t.key)},children:d.label})]})]})}let Fn=null;const ws=new Set,Es=()=>ws.forEach(t=>t());typeof window<"u"&&(addEventListener("beforeinstallprompt",t=>{t.preventDefault(),Fn=t,Es()}),addEventListener("appinstalled",()=>{Fn=null,Es()}));function b3(t=navigator,e=n=>matchMedia(n).matches){if(t.standalone||e("(display-mode: standalone), (display-mode: minimal-ui)"))return null;const n=/Version\/(\d+)[.\d]* (?:Mobile\/\w+ )?Safari\//.exec(t.userAgent);return n?typeof t.standalone=="boolean"&&(/iP(?:hone|ad|od)/.test(t.userAgent)||t.maxTouchPoints>1)?"ios":/Macintosh/.test(t.userAgent)&&t.maxTouchPoints<2&&Number(n[1])>=26?"mac":null:null}function m3(){const t=ne(),e=c.useSyncExternalStore(n=>(ws.add(n),()=>ws.delete(n)),()=>Fn,()=>null);return e?async()=>{if(Fn!==e)return!1;Fn=null,Es();try{return await e.prompt(),(await e.userChoice).outcome==="accepted"}catch(n){return Ie("negative",t("settings.installFailed"),{detail:fr(n,t)}),!1}}:null}function Ss({className:t,...e}){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:f.jsx("path",{fill:"currentColor",d:"m18.53 17.47-5.083-5.084C14.417 11.186 15 9.66 15 8c0-3.86-3.14-7-7-7S1 4.14 1 8s3.14 7 7 7c1.66 0 3.185-.584 4.386-1.553l5.084 5.083c.146.147.338.22.53.22s.384-.073.53-.22c.293-.293.293-.767 0-1.06M8 13.5c-3.032 0-5.5-2.468-5.5-5.5S4.968 2.5 8 2.5s5.5 2.468 5.5 5.5-2.468 5.5-5.5 5.5"})})}function Z0({className:t,...e}){return f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:[f.jsx("path",{fill:"currentColor",d:"m10.03418,16.66162C5.14258,16.66162.75,12.27295.75,10.20068c0-1.68506,2.59814-4.55029,5.34717-5.89746,1.20117-.60596,2.54736-.93506,3.89307-.95264,5.15771,0,9.25977,4.91943,9.25977,6.8501,0,2.07227-4.36035,6.46094-9.21582,6.46094Zm-.03418-11.81104c-1.11084.01465-2.23145.28906-3.23096.79346-.00244.00146-.00537.00293-.0083.00439-2.60596,1.27539-4.51074,3.75-4.51074,4.55225,0,1.14453,3.67969,4.96094,7.78418,4.96094,4.06836,0,7.71582-3.81641,7.71582-4.96094,0-1.04883-3.48145-5.3501-7.75-5.3501Zm-3.56885.12402h.00977-.00977Z"}),f.jsx("path",{fill:"currentColor",d:"m9.82907,7.64351c.22275-.63691-.47262-1.25888-1.09987-1.01025-.47319.18757-.91275.48099-1.28245.88097-1.49146,1.6136-1.20734,4.23592.75785,5.46243,1.20025.7491,2.79762.68815,3.93958-.14712.6684-.48889, Line truncated
`)),o=c.useRef(null),u=c.useRef(!1),d=c.useCallback(h=>(o.current=h,()=>{u.current=h.contains(document.activeElement),o.current=null}),[]);return c.useLayoutEffect(()=>{a&&s.current?.contains(document.activeElement)&&o.current?.querySelector("button")?.focus(),!a&&u.current&&s.current?.querySelector("[data-selected]")?.focus(),u.current=!1},[s,a]),f.jsxs("div",{className:"rp-segfit","data-collapsed":a||void 0,children:[f.jsxs(f0,{ref:s,className:"rp-seg","aria-label":r,isDisabled:i,selectionMode:"single",disallowEmptySelection:!0,selectedKeys:[e],onSelectionChange:h=>{const p=[...h][0];p!=null&&n(String(p))},children:[l&&f.jsx("span",{className:"rp-slider","data-still":l.still||void 0,style:{left:l.x,width:l.w}}),t.map(([h,p])=>f.jsx(h0,{id:h,className:"rp-btn",children:p},h))]}),a&&f.jsx("div",{ref:d,className:"rp-segpick",children:f.jsx(l1,{bare:!0,label:r,value:e,onChange:n,isDisabled:i,items:t.map(([h,p])=>({id:h,label:p}))})})]})}function y3({children:t,isSelected:e,onChange:n,isDisabled:r,"aria-label":i,"aria-describedby":s}){return f.jsxs(Tg,{className:"rp-switch",isSelected:e,onChange:n,isDisabled:r,"aria-label":i,"aria-describedby":s,children:[f.jsx("span",{className:"track"}),t]})}function a1({label:t,width:e,search:n,large:r,side:i,className:s,placeholder:l,description:a,error:o,action:u,reveal:d,prefix:h,suffix:p,autoComplete:b,spellCheck:m,...y}){const g=ne(),v=c.useId(),$=o?{isInvalid:!0,validationBehavior:"aria"}:{};if(n)return f.jsxs(bg,{...y,"aria-label":t,className:q("rp-input",r&&"lg",s),style:e?{width:e}:void 0,children:[f.jsx(Ss,{}),f.jsx(Aa,{placeholder:l??t,autoComplete:b,spellCheck:m}),f.jsx(Ne,{className:"clear","aria-label":g("clear"),children:f.jsx(Al,{})})]});const x=f.jsxs("span",{className:q("rp-input",(i||!!u)&&"rp-grow",(h||p)&&"affixed"),children:[h&&f.jsx("span",{className:"affix",id:`${v}-prefix`,children:h}),f.jsx(Aa,{placeholder:l,autoComplete:b,spellCheck:m}),p&&f.jsx("span",{className:"affix",id:`${v}-suffix`,children:p}),d&&f.jsx(Ne,{className:"reveal","aria-label":d.label,onPress:d.onToggle,children:d.shown?f.jsx(Q0,{}):f.jsx(Z0,{})})]});return f.jsxs(Wg,{...$,...y,"aria-describedby":[h&&`${v}-prefix`,p&&`${v}-suffix`].filter(Boolean).join(" ")||void 0,className:q(i?"rp-cluster":"rp-field",s),style:e?{width:e}:void 0,children:[f.jsx(cu,{className:"rp-label",children:t}),u?f.jsxs("div",{className:"rp-toolbar",children:[x,u]}):x,a&&f.jsx(Br,{slot:"description",className:"rp-label",children:a}),o&&f.jsxs(db,{className:"rp-field-error",children:[f.jsx(jd,{}),o]})]})}function v3({title:t,children:e,...n}){return f.jsxs(tg,{...n,className:"rp-disclosure",children:[f.jsx(ll,{level:3,children:f.jsxs(Ne,{slot:"trigger",className:"rp-btn quiet rp-disclosure-trigger",children:[f.jsx(Gt,{}),t]})}),f.jsx(ng,{className:"rp-disclosure-panel",children:f.jsx("div",{className:"rp-disclosure-content",children:e})})]})}function $3({children:t}){return f.jsx(Zm,{className:"rp-col",allowsMultipleExpanded:!0,children:t})}function Jl({trigger:t,title:e,children:n,footer:r,narrow:i,alert:s,isOpen:l,onOpenChange:a,hideTitle:o,locked:u}){const d=f.jsx(Il,{className:"rp-underlay",isDismissable:!s&&!u,isKeyboardDismissDisabled:u,isOpen:l,onOpenChange:a,children:f.jsx(md,{className:q("rp-modal",i&&"narrow"),children:f.jsx(bi,{className:"rp-dialog",role:s?"alertdialog":"dialog","aria-label":o?e:void 0,children:({close:h})=>f.jsxs(f.Fragment,{children:[!o&&f.jsx(ll,{slot:"title",children:e}),typeof n=="function"?n(h):n,r&&f.jsx("div",{className:"foot",children:r(h)})]})})})});return t?f.jsxs(Nl,{children:[t,d]}):d}function o1({trigger:t,triggerRef:e,isOpen:n,onOpenChange:r,title:i,subtitle:s,placement:l="top start",children:a}){const o=f.jsx(ur,{className:"rp-popover rp-popover-dialog",placement:l,...t?{}:{triggerRef:e,isOpen:n,onOpenChange:r},children:f.jsx(bi,{className:"rp-popover-body",children:({close:u})=>f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"rp-popover-head",children:[f.jsx(ll,{slot:"title",children:i}),s]}),a(u)]})})});return t?f.jsxs(Nl,{children:[t,o]}):o}function qd({title:t,isOpen:e,onCancel:n,confirmLabel:r,onConfirm:i,tone:s="negative",isPending:l,isDisabled:a,error:o,children:u}){const d=ne();return f.jsxs(Jl,{title:t,narrow:!0,alert:s==="negative",isOpen:e,onOpenChange:h=>{h||n()},footer:()=>f.jsxs(f.Fragment,{children:[f.jsx(ve,{onPress:n,children:d("ui.cancel")}),f.jsx(ve,{negative:s==="negative",accent:s==="accent",isDisabled:a,isPending:l,onPress:i,children:r})]}),children:[o&&f.jsx(zl,{takeFocus:!0,children:o.text},o.id),u]})}function x3({label:t,confirmationText:e,isDisabled:n,isPending:r,onConfirm:i,onAbort:s,open:l,setOpen:a}){const o=ne(),[u,d]=c.useState(!1),[h,p]=c.useState(!1),[b,m]=c.useState(null),y=c.useRef(0),g=c.useRef(0),v=c.useRef(null);c.useEffect(()=>()=>v.current?.(),[]);const $=l??u,x=D=>{m(null),(a??d)(D)},E=()=>{v.current&&(v.current(),p(!1)),x(!1)},N=async()=>{const D=++g.current;v.current=()=>{v.current=null,g.current++,s?.()},p(!0),m(null Line truncated
`)}),a="",o=void 0,u=[];return}if(p.startsWith(":"))return;const b=p.indexOf(":"),m=b<0?p:p.slice(0,b);let y=b<0?"":p.slice(b+1);y.startsWith(" ")&&(y=y.slice(1)),m==="event"&&(a=y),m==="data"&&u.push(y),m==="id"&&!y.includes("\0")&&(o=y)},h=()=>{i.cancel(n?.reason).catch(()=>{})};n?.addEventListener("abort",h,{once:!0});try{for(;;){const{value:p,done:b}=await i.read();n?.throwIfAborted(),r?.(),l+=s.decode(p,{stream:!b});let m=0;for(let y=0;y<l.length;y++){const g=l[y];if(!(g!=="\r"&&g!==`
`)){if(g==="\r"&&y===l.length-1&&!b)break;d(l.slice(m,y)),g==="\r"&&l[y+1]===`
`&&y++,m=y+1}}if(l=l.slice(m),b)break}}finally{n?.removeEventListener("abort",h),await i.cancel().catch(()=>{}),i.releaseLock()}}function An(t,e){return e?.throwIfAborted(),new Promise((n,r)=>{const i=()=>{clearTimeout(s),r(e?.reason)},s=setTimeout(()=>{e?.removeEventListener("abort",i),n()},Math.max(1,t)*1e3);e?.addEventListener("abort",i,{once:!0})})}const X1=3,Ns=new Set,Ls=new Set;let uf=null;function Bo(){uf=[...Ns].reduce((t,e)=>t&&t.until>=e.until?t:e,null),Ls.forEach(t=>t())}const Z1=()=>uf;function Q1(t){return Ls.add(t),()=>void Ls.delete(t)}async function ey(t,e,n){if(e<=X1)return An(e,n);const r={status:t,until:Date.now()+e*1e3};Ns.add(r),Bo();try{await An(e,n)}finally{Ns.delete(r),Bo()}}const L3=["tproxy_port","tproxy_port_protect","pprof_port","so_mark_from_dae","log_level","log_file","disable_waiting_network","lan_interface","wan_interface","auto_config_kernel_parameter","data_dir","store_subscribe","tcp_check_url","tcp_check_http_method","udp_check_dns","check_interval","check_tolerance","dial_mode","nfqueue_enable","allow_insecure","sniffing_timeout","tls_implementation","utls_imitate","tls_fragment","tls_fragment_length","tls_fragment_interval","mptcp","bootstrap_resolver","fallback_resolver","bandwidth_max_tx","bandwidth_max_rx","udp_warm_node_count","preconnect_node_count","max_concurrent_dials"],ty={select:"selector",fixed:"selector",urltest:"urltest",min_moving_avg:"urltest",min_avg10:"urltest",min_last_delay:"urltest",fallback:"fallback",roundrobin:"loadbalance",loadbalance:"loadbalance",random:"random",score:"score"};function I3(t){return ty[t.toLowerCase().replace(/\(.*$/,"")]}const K3=["select","urltest","roundrobin","fallback","score","fixed","min_moving_avg","min_avg10","min_last_delay","loadbalance"],D3=[{id:"min_moving_avg",label:"arrange.policy.fastest",description:"arrange.policy.fastestHint"},{id:"fallback",label:"arrange.policy.fallback",description:"arrange.policy.fallbackHint"},{id:"roundrobin",label:"arrange.policy.spread",description:"arrange.policy.spreadHint"},{id:"select",label:"arrange.policy.manual",description:"arrange.policy.manualHint"}],Xr=["direct","block"],j3=[...Xr,...Xr.map(t=>`${t}(must)`)],wn=t=>t!=null&&Xr.includes(t);function F3(t){if(new TextEncoder().encode(t).length>2048||/[\s,]/.test(t)||!/^https?:\/\/[^/?#@]+(?:[/?#]|$)/i.test(t))return!1;try{return!!new URL(t).hostname}catch{return!1}}const ny={warm:0,unknown:1,mixed:2,cold:3},ry={tcp_connect:0,http_headers:1,http_round_trip:2,quic_handshake:3,mixed:4,unknown:5,dns_round_trip:6};function iy(t){const e=n=>(ny[n.warmth]??1)*100+(ry[n.measurement]??5)*10+(n.ip_version==="ipv4"?0:1);return t.filter(n=>n.transport==="tcp"&&n.purpose==="data").sort((n,r)=>e(n)-e(r))[0]}const sy=t=>iy(t.health),ly=t=>t?.state==="healthy"&&t.latency_ms!=null?t.latency_ms:void 0,ay=(t,e)=>(t??1/0)-(e??1/0)||0;function oy(t){const e=t?ks(...t.outbounds.map(r=>r.download_bytes)):null,n=(t?.outbounds??[]).map(r=>({name:r.name,kind:r.kind,bytes:Ke(r.download_bytes),percent:Xl(r.download_bytes,e)}));return n.sort((r,i)=>r.bytes===i.bytes?0:r.bytes===null?1:i.bytes===null||r.bytes>i.bytes?-1:1),{rows:n,total:e}}function cy(t){const e=t.trim().replace(/^\[([^\]]+)\]$/,"$1");if(/^(?:0|[1-9]\d{0,2})(?:\.(?:0|[1-9]\d{0,2})){3}$/.test(e)&&e.split(".").every(n=>Number(n)<=255))return e;if(!(!e.includes(":")||!/^[\da-f:.]+$/i.test(e)))try{return new URL("http://["+e+"]/").hostname.slice(1,-1)}catch{return}}const uy=t=>wn(t.protocol)?"builtin":"unattributed";function dy(t,e){let n=t;for(;e.some(r=>r.id===n);)n+="-";return n}const A3=(t,e)=>t.provider_id??dy(uy(t),e);function df(t){if(t)return cy(t.startsWith("[")?t.slice(1,t.indexOf("]")):t.split(":").length===2?t.split(":")[0]:t)}function ra(t,e){return t==="direct"?e("ui.direct"):t==="block"?e("ui.block"):t===null||t==="unknown"?e("ui.unknown"):t}const fy=(t,e)=>t.map(n=>e?.get(n)??n);function py(t,e,n){return wn(t.outbound)?e?ra(t.outbound,e):t.outbound:fy(t.chain,n).join(" → ")||"—"}function _3(t,e,n){if(wn(t.outbound))return ra(t.outbound,e);const r=t.chain.at(-1);return r?n?.get(r)??r:t.outbound&&t.outbound!=="unknown"?t.outbound:"—"}const O3=(t,e,n)=>t.chain.length>1?py(t,e,n):null,hy={starting:"lifecycle.starting",running:"lifecycle.running",reloading:"lifecycle.reloading",suspended:"lifecycle.suspended",draining:"lifecycle.draining",degraded:"lifecycle.degraded",failed:"lifecycle.failed"},by=t=>t==="running"?"ok":t==="failed"?"err":"warn",my=t=>t>90?"err":t>75?"warn":"ok",B3=t=>t.closed?t.skipped?"info":"positive":"negative",V3={observed:"conn.state.observed",routing:"conn.state.routing",dialing:"conn.state.dialing",active:"conn.state.active",closed:"conn.state.closed",blocked:"conn.state.blocked",failed:"conn.state.failed",unknown:"conn.state.unknown"};function gy(t){return t?[...t.tcp.map(e=>({...e,network:"tcp"})),...t.udp.map(e=>({...e,network:"udp"}))]:[]}const yy=["stream.ready","runtime.updated","flow.updated","flow.gap","operation.updated","generation.changed"],v Line truncated
`&&i++,l++;continue}const o=l,u=i;let d="text";if(a==="#")for(d="comment";l<t.length&&t[l]!==`
`;)l++;else if(a==="'"||a==='"')for(d="quoted",l++;l<t.length;){const p=t[l++];if(p===`
`&&i++,p==="\\"&&l<t.length)t[l]===`
`&&i++,l++;else if(p===a)break}else if("{}:(),".includes(a))d="symbol",l++;else if(a==="-"&&t[l+1]===">")l+=2;else for(;l<t.length&&!/[\s{}:(),'"]/.test(t[l])&&!(t[l]==="-"&&t[l+1]===">");)l++;const h={from:o,to:l,line:u,kind:d,depth:r.length,parens:s};if(d==="symbol"&&a==="{"){let p=e.length-1;for(;p>=0&&(e[p].kind==="comment"||t.slice(e[p].from,e[p].to)===":");)p--;const b=e[p],m={name:b?rn(t.slice(b.from,b.to)):"",from:b?.from??o,open:o,close:t.length,to:t.length,line:b?.line??i,endLine:i,depth:r.length,children:[]};(r.at(-1)?.children??n).push(m),r.push(m)}else if(d==="symbol"&&a==="}"){const p=r.pop();p&&(p.close=o,p.to=l,p.endLine=i)}else d==="symbol"&&a==="("?s++:d==="symbol"&&a===")"&&(s=Math.max(0,s-1));e.push(h)}return{blocks:n,tokens:e}}function g2(t){if(/[\r\n]/.test(t))return!1;let e=0;for(const n of We(t).tokens){if(n.kind==="comment")return!1;if(n.kind==="quoted")continue;const r=t.slice(n.from,n.to);if(r.includes("{")||r.includes("}")||(r==="("&&e++,r===")"&&--e<0))return!1}return e===0}const rn=t=>/^['"]/.test(t)?t.slice(1,-1):t;function Mf(t){const e=We(t).tokens.filter(n=>n.kind==="comment");for(const n of e.reverse())t=t.slice(0,n.from)+t.slice(n.to);return t}function Nf(t,e,n){const r=[];let i;for(let s=0;s<n.length;s++){const l=n[s];if(l.from<=e.open||l.from>=e.close)continue;const a=t.slice(l.from,l.to);if(l.parens===0&&(l.kind==="comment"||i&&t.slice(i.valueTo,l.from).includes(`
`))&&(i=void 0),l.depth!==e.depth+1||l.kind==="comment")continue;const o=n[s+1];l.parens===0&&(l.kind==="text"||l.kind==="quoted")&&o&&t.slice(o.from,o.to)===":"?(i={name:rn(a),from:l.from,to:o.to,valueFrom:o.to,valueTo:o.to,value:""},r.push(i),s++):i&&(i.to=l.to,i.valueTo=l.to)}for(const s of r)s.value=t.slice(s.valueFrom,s.valueTo).trim();return r}function y2(t,e){const n=t.slice(e.open+1,e.close);return e.line===e.endLine?[n]:n.replace(/^[^\S\n]*\n/,"").replace(/\n[^\S\n]*$/,"").split(`
`)}function i7(t,e){const n=[];let r=e.open+1;/^[^\S\n]*\n/.test(t.slice(r,e.close))&&(r=t.indexOf(`
`,r)+1);const i=t.lastIndexOf(`
`,e.close-1)+1,s=i>r&&/^[ \t]*$/.test(t.slice(i,e.close))?i-1:e.close;for(;r<=s;){const l=t.indexOf(`
`,r);let a=l===-1?s:Math.min(l,s);const o=e.children.find(u=>u.from>=r&&u.from<=a);if(o){const u=t.indexOf(`
`,o.to);a=u===-1?s:Math.min(u,s)}n.push({from:r,to:a,block:o}),r=a+1}return n}function s7(t){const{blocks:e}=We(t);return e.filter(n=>n.name==="include").flatMap(n=>y2(t,n).map(r=>rn(Mf(r).trim()))).filter(Boolean)}const Go=t=>/[*?]/.test(t);function v2(t,e){const n=t.replace(/^\.\//,"").split(/([*?])/).map(r=>r==="*"?"[^/]*":r==="?"?"[^/]":r.replace(/[.+^${}()|[\]\\]/g,"\\$&")).join("");return new RegExp("^"+n+"$").test(e)}const l7=(t,e)=>t.some(n=>v2(n,e));function a7(t){for(const e of t.map(n=>n.replace(/^\.\//,""))){const n=e.lastIndexOf("/");if(n>0&&Go(e.slice(n))&&!Go(e.slice(0,n)))return e.slice(0,n+1)}return""}function Lf(t){return[...t].some(e=>e.charCodeAt(0)<32||e.charCodeAt(0)>=127&&e.charCodeAt(0)<=159)?"config.newSourceControl":t.startsWith("/")?"config.newSourceAbsolute":t.split("/").some(e=>e===""||e==="."||e==="..")?"config.newSourceSegments":/[^/]\.dae$/.test(t)?null:"config.newSourceExtension"}function o7(t){const e=[];for(const n of t.map(r=>r.replace(/^\.\//,""))){const r=n.indexOf("*"),i=n.slice(0,r),s=n.slice(r+1);r<0||/[*?]/.test(i+s)||!i.includes("/")||s.includes("/")||!s.endsWith(".dae")||Lf(i+"name"+s)||e.some(l=>l.pattern===n)||e.push({pattern:n,prefix:i,suffix:s})}return e}function c7(t,e){if(t.includes("/"))return"config.newSourceNameSlash";const n=Lf(e.prefix+t+e.suffix);return n==="config.newSourceControl"?"config.newSourceNameControl":n}function $2(t,e){const n=t.find(i=>i.kind==="main"),r=n?n.path.slice(0,n.path.lastIndexOf("/")+1):"";return t.find(i=>i.path===e||i.path===r+e)??null}function If(t=!0){const e=le();return Ee({key:["config"],every:0,fetch:n=>e.config(n)},{enabled:t})}async function Kf(t){return t.content!==void 0&&await W1(t.content)===t.content_sha256}function x2(t){const[e,n]=c.useState(new Map);return c.useEffect(()=>{let r=!0;return Promise.all(t.map(async i=>[i.id,{digest:i.content_sha256,content:i.content,complete:await Kf(i)}])).then(i=>{r&&n(new Map(i))}),()=>{r=!1}},[t]),c.useCallback(r=>{const i=e.get(r.id);return i&&i.digest===r.content_sha256&&i.content===r.content?i.complete:void 0},[e])}function w2(t){const e=c.useMemo(()=>t?[t]:[],[t]),n=x2(e);return t?n(t)??null:null}function E2(t,e,n,r){if(n!==e.content_sha256)return{error:t,lastRefused:r};const i=e.id+":"+e.content_sha256;return i===r?{error:new he("config.diskAhead"),lastRefused:r}:{error:t,lastRefused:i}}const Jo=t=>new TextEncoder().encode(t).length,Yo=t=>Xn(413,"request_too_large",`Configuration exceeds the ${t}-byte limit`,"config.tooLarge",{limit:t});function S2(t,e,n){const[r]=[{limit:t.content,size:Jo(e)},{limit:t.body,size:Jo(JSON.stringify(n))}].filter(i=>i.limit!==void 0).sort((i,s)=>s.size/s.limit-i.size/i.limit);return r&&{limit:r.limit,exceeded:r.size>r.limit}}async function Xo(t,e,n,r){const i=S2(t,e,n);if(i?.exceeded)throw Yo(i.limit);return r().catch(s=>{throw s instanceof $e&&s.status===413&&i?Yo(i.limit):s})}function Df(t,e,n){return nn(t,e,n).catch(r=>{throw n.aborted||r instanceof he?r:(kn(),new he("ui.operationUnknown"))})}async function P2(t,e,n){const r=await Df(t,await t.createConfigSource(e,"",n),n);return It(r,"reload"),n.throwIfAborted(),$2((await t.config(n)).sources,e)?.id??null}function u7(t){const e=le(),{busy:n,run:r}=ot({rethrow:!0});return{busy:n!==null,create:c.useCallback(i=>r("create",async s=>({id:await P2(e,i,s).finally(t)})),[e,r,t])}}function jf(t,{rethrow:e=!1}={}){const n=le(),r=Ge().data,i=r?.resources.config_validate,s=i?.available===!0&&i.modes?.includes("full")===!0,l=r?.limits.max_json_body_bytes,a=r?.resources.config.max_bytes,o=i?.max_bytes,u=c.useCallback((v,$)=>Xo({content:o,body:l},v.sources.map(x=>x.content??"").join(""),v,()=>n.validateConfig(v,$)),[n,o,l]),{busy:d,error:h,run:p,cancel:b}=ot({rethrow:e}),[m,y]=c.useState(null),g=c.useRef(null);return{busy:d,cancel:b,error:h,errorSource:h?m:null,validate:c.useCallback(v=>p("validate",$=>(y(v.sources.length===1?v.sources[0].id??null:null),u(v,$))),[u,p]),apply:c.useCallback((v,$)=>p("save",async x=>{if(y(v.id),!v.writable)throw new he("config.readOnly");if(!await Kf(v))throw new he("config.incomplete");x.throwIfAborted();const E=typeof $=="string"?$:$(v.content);if(E===null)return;if(s&&v.kind==="main"&&v.path!=="<redacted>"){const P=await u({sources:[{id:v.id,path:v.path,content:E}],mode:"full"},x);if(x.throwIfAborted(),!P.valid)return{diagnostics:P.diagnostics}}const N=await Xo({content:a,body:l},E,{content:E},()=>n.replaceConfigSource(v.id,E,xf(v.content_sha256),x)).catch(async P=>{if(!(P instanceof $e)||P.status!==412)throw P;const T=await n.config(x).catch(()=>null);t();const M=E2(P,v,T?.sources.find(L=>L.id===v.id)?.content_sha256,g.current);throw g.current=M.lastRefused,M.error});g.current=null,x.throwIfAborted();const D=await Df(n,N,x);return x.throwIfAborted(),t(),{result:It(D,"reload",{written:!0})}}),[n,s,u,a,l,p,t])}}function C2(t,e,n,r=i=>i.id){const i=new Map,s=new Set,l=new Set;let a={records:[],gaps:new Set(s),pending:0,...e},o=!1,u=!1,d=!1,h=!1,p=0,b;const m=()=>{if(b=voi Line truncated
`,l.from-1)+1,h=t.slice(d,l.from),p=/^\s*$/.test(h)?h:" ",b=Nf(t,l,i),m=l.open+1,g=t.slice(m,l.close).match(/\n([ \t]+)\S/)?.[1]??p+(p||" ");if(l.line!==l.endLine)return T2(t,l,b,g,n);const v=[m,...b.map(x=>x.from),l.close],$=v.slice(0,-1).flatMap((x,E)=>{const N=t.slice(x,v[E+1]).trim();return N?[g+N]:[]});return ua(t.slice(0,m)+`
`+$.map(x=>x+`
`).join("")+p+t.slice(l.close),e,n)}const a=s.at(-1),o=a?t.slice(a.open+1,a.close).match(/\n([ \t]+)\S/)?.[1]??" ":" ",u=[`${o}${Af(e)} {`,...n.filters.map(d=>`${o}${o}filter: ${d}`),...n.policy?[`${o}${o}policy: ${n.policy}`]:[],`${o}}`].join(`
`);if(a){const d=t.lastIndexOf(`
`,a.close-1)+1,h=/^[ \t]*$/.test(t.slice(d,a.close))?d:a.close;return t.slice(0,h)+(t[h-1]===`
`?"":`
`)+u+`
`+t.slice(h)}return`${t.replace(/\n+$/,"")}
group {
${u}
}
`}function T2(t,e,n,r,i){const s=n.filter(p=>p.name==="filter"),l=n.filter(p=>p.name==="policy"),a=[],o=p=>t.indexOf(`
`,p)+1,u=p=>{const b=t.lastIndexOf(`
`,p.from-1)+1,m=o(p.to),y=/^[ \t\r]*$/.test(t.slice(b,p.from))&&m>0&&/^[ \t\r]*$/.test(t.slice(p.to,m-1));a.push(y?{from:b,to:m,text:""}:{from:p.from,to:p.to,text:""})},d=(p,b)=>{if(p.value===b)return;const m=/^\s*/.exec(t.slice(p.valueFrom,p.valueTo))[0];a.push({from:p.valueFrom+m.length,to:p.valueTo,text:(m?"":" ")+b})};s.forEach((p,b)=>b<i.filters.length?d(p,i.filters[b]):u(p)),l.slice(0,-1).forEach(u),l.length&&(i.policy?d(l.at(-1),i.policy):u(l.at(-1)));const h=[...i.filters.slice(s.length).map(p=>`${r}filter: ${p}
`),...i.policy&&!l.length?[`${r}policy: ${i.policy}
`]:[]].join("");if(h){const p=s.length?o(s.at(-1).to):l.length?t.lastIndexOf(`
`,l[0].from-1)+1:o(e.open);a.push({from:p,to:p,text:h})}return a.sort((p,b)=>b.from-p.from||b.to-p.to).reduce((p,b)=>p.slice(0,b.from)+b.text+p.slice(b.to),t)}function Qn(t,e){const n=We(t).tokens,r=n.map(l=>t.slice(l.from,l.to));if(n[0]?.kind!=="text"||r[0]!==e||r[1]!=="("||r.at(-1)!==")"||n.at(-1)?.parens!==1)return null;const i=[];let s=!0;for(let l=2;l<n.length-1;l++){const a=n[l];if(a.parens!==1)return null;if(s){if(a.kind!=="text"&&a.kind!=="quoted"||a.kind==="text"&&/[\s:]/.test(r[l]))return null;i.push(r[l])}else if(r[l]!==",")return null;s=!s}return s&&i.length?null:i}const Qr=(t,e)=>t.flatMap(n=>(Qn(n,e)??[]).map(rn));function p7(t){return Qr(t.filters,"name")}function h7(t){return{names:Qr(t.filters,"name"),subtags:Qr(t.filters,"subtag"),rules:t.filters.filter(e=>Qn(e,"name")===null&&Qn(e,"subtag")===null)}}function b7(t,e,n){return t.filters.every(r=>{const i=Qn(r,e);return i!==null&&i.every(s=>rn(s)===n)})}function Ti(t,e,n,r,i){const s=ca(t).find(p=>p.name===e);if(!s&&!r.length)return t;const l=new Set(i),a=new Set(Qr(s?.filters??[],n).filter(p=>!l.has(p))),o=[...new Set(r)].filter(p=>!a.has(p)&&!l.has(p)),u=p=>o.map(p.length&&p.every(b=>b.startsWith("'"))?ki:Af);let d=!o.length;const h=[];for(const p of s?.filters??[]){const b=Qn(p,n);if(b===null){h.push(p);continue}const m=b.filter(g=>!l.has(rn(g))),y=d?m:[...m,...u(m)];d=!0,y.length&&h.push(`${n}(${y.join(", ")})`)}return d||h.push(`${n}(${u([]).join(", ")})`),s&&h.length===s.filters.length&&h.every((p,b)=>p===s.filters[b])||s?.filters.length&&!h.length?t:ua(t,e,{filters:h,policy:s?.policy??null})}const R2=(t,e,n)=>Ti(t,e,"name",n,[]),M2=(t,e,n)=>Ti(t,e,"name",[],n),N2=(t,e,n)=>Ti(t,e,"subtag",n,[]),L2=(t,e,n)=>Ti(t,e,"subtag",[],n);function _f(t,e){const n=[];let r=0,i=null,s=0;for(let l=0;l<t.length;l++){const a=t[l];i?a==="\\"?l++:a===i&&(i=null):a==="'"||a==='"'?i=a:a==="("?r++:a===")"?r--:r===0&&t.startsWith(e,l)&&(n.push(t.slice(s,l)),s=l+e.length,l+=e.length-1)}return n.push(t.slice(s)),n.map(l=>l.trim())}function I2(t){const e=t.startsWith("!"),n=e?t.slice(1).trim():t,r=n.startsWith("name(")?"name":n.startsWith("subtag(")?"subtag":null;if(!r||!n.endsWith(")"))return null;const i=[],s=[];for(const l of _f(n.slice(r.length+1,-1),",")){const a=/^keyword:\s*/.exec(l),o=/^regex:\s*/.exec(l),u=rn((a??o?l.slice((a??o)[0].length):l).trim());if(u)if(a)s.push(d=>d.includes(u));else if(o){let d;try{d=new RegExp(u)}catch{return null}s.push(h=>d.test(h))}else i.push(u),s.push(d=>d===u)}return s.length?{call:r,negated:e,exact:i,tests:s}:null}function K2(t){const e=_f(t,"&&").map(I2);return e.every(n=>n!==null)&&e.length?e:null}function D2(t){const e=t.map(K2).filter(n=>n!==null);if(!e.length){const n=t.some(r=>r.startsWith("group("));return r=>!n&&!wn(r.name)}return n=>e.some(r=>(!wn(n.name)||r.some(i=>i.call==="name"&&!i.negated&&i.exact.includes(n.name)))&&r.every(i=>i.tests.some(s=>s(i.call==="name"?n.name:n.subscription_tag??""))!==i.negated))}const m7=(t,e)=>D2(t)(e);function j2(t,e){switch(e.kind){case"addNode":return R2(t,e.group,[e.value]);case"removeNode":return M2(t,e.group,[e.value]);case"addSubscription":return N2(t,e.group,[e.value]);case"removeSubscription":return L2(t,e.group,[e.value]);case"createGroup":return ca(t).some(n=>n.name===e.group)?t:ua(t,e.group,{filters:[],policy:e.policy})}}const g7=(t,e)=>e.reduce(j2,t),y7=["domainSuffix","domain","geosite","dip","geoip","sip","dport","sport","pname","l4proto"];function v7(t,e){const n=e.split(/[,\s]+/).map(i=>i.trim()).filter(Boolean);if(n.some(i=>F2.test(i)||i.includes(":")&&!Rf(i)))return null;const r=A2(t,n);return g2(r)&&!r.includes("->")?r:null}const F2=/[()'"#{}]|&&|->/;function A2(t,e){const n=e.map(s=>s.includes(":")?ki(s):s),r=n.join(", "),i=s=>n.map(l=>`${s}: ${l}`).join(", ");switch(t){case"domain":return`domain(${i("full")})`;case"domainSuffix":return`domain(${i("suffix")})`;case"geosite":return`domain(${i("geosite")})`;case"dip":return`dip(${r})`;case"geoip":return`dip(${i("geoip")})`;case"sip":return`sip(${r})`;case"dport":return`dport(${r})`;case"sport":return`sport(${r})`;case"pname":return`pname(${r})`;case"l4proto":return`l4proto(${r})`}}function $7(t,e){const r=t.map(i=>i.id===e?.id?e.content:i.content).flatMap(i=>i===void 0?[]:ca(i));return[...new Map(r.map(({name:i,written:s})=>[s,{name:i,written:s}])).values()]}const _s=t=>t.path==="<redacted>"||t.path==="",_2=t=>_s(t)?t.kind==="main"?"config.dae":`${t.kind}-${t.id.slice(0,8)}.dae`:t.path.split("/").pop()||"config.dae";function x7(t,e){const n=t.find(i=>i.kind==="main");if(n?.content===void 0)return null;const r=[n,...t.filter(i=>i.kind==="include"&&i.content!==void 0&&!_s(i))];return e&&!r.some(i=>i.id===e.id)?null:r.map(i=>({id:i.id,..._s(i)?{}:{path:i.path},content:i.id===e?.id?e.content:i.content}))}const O2=t=>t.filter(e=>e.level==="error"&&e.code==="restart-required").length;function w7(t,e){if(e)return t.find(n=>n.id===e.source_id)}function B2(t,e,n){if(!e.source||e.source.source_id!==t.id||t.content=== Line truncated
`,u.from-1)+1,$=r.indexOf(`
`,d.to),x=$===-1?r.length:$+1;return{from:v,to:x,indent:r.slice(v,u.from),text:r.slice(v,x)}}const da=(t,e,n=!1)=>`${t} -> ${e}${n?"(must)":""}`,E7=t=>[...t.map(e=>e.name),...Xr].map(e=>({id:e,label:e}));function S7(t,e,n,r,i){return t.slice(e.from,e.to)===e.text?t.slice(0,e.from)+`${e.indent}${da(n,r,i)}
`+t.slice(e.from):null}function P7(t,e){return t.slice(e.from,e.to)===e.text?t.slice(0,e.from)+t.slice(e.to):null}function V2(t,e){const n=t.content??"",r=We(n),i=e.map(a=>({rule:a,anchor:B2(t,a.before,r)}));if(i.some(a=>!a.anchor))return null;i.sort((a,o)=>a.anchor.from-o.anchor.from||a.rule.id-o.rule.id);let s="",l=0;for(const{rule:a,anchor:o}of i)s+=n.slice(l,o.from)+o.indent+da(a.condition,a.outbound,a.must)+`
`,l=o.from;return s+n.slice(l)}function fa(t){const e=new Map;for(const n of t)e.set(n.sourceId,[...e.get(n.sourceId)??[],n]);return[...e.values()]}function Zo(t,e,n,r){const i=e??(t instanceof $e&&t.status===422?t.details?.diagnostics??null:null);if(!i)return{text:D0(Hl(t,r,r("ui.writeFailed")),r),lines:[]};const s=i.filter(a=>a.level==="error").length,l=O2(i);return{text:l?r("config.writeRestart",{n:l}):s?r("ui.writeInvalid",{n:s}):r("rule.refused"),lines:i.map(a=>{const o=Vl(a.code,a.message,r),u=n.find(d=>d.id===a.source_id);return a.line===null?o:r("config.atFile",{file:u?_2(u):a.source_id,line:a.line,message:o})})}}function C7(t,e,n){const r=fa(t).length;return t.length?{title:n("rule.pending",{n:t.length}),files:r>1?n("rule.pendingFiles",{n:r}):null,failure:e,rows:t.map(i=>({id:i.id,line:da(i.condition,i.outbound,i.must),position:i.before.kind==="fallback"?n("rule.positionEnd"):n("rule.positionBefore",{n:i.before.index+1})}))}:null}function H2(t,e,n,r){return e?{text:r("rule.partial",{n:e,held:n}),lines:[t.text,...t.lines]}:t}const Qo=()=>void kn();function U2(){const t=ne(),e=jf(Qo,{rethrow:!0}),n=Ff().applying,r=c.useRef(null);c.useEffect(()=>()=>r.current?.abort(),[]);const i=async(o,u)=>{let d=[],h;try{if(d=(await le().config(u)).sources,u.aborted)return;const p=d.find(m=>m.id===o[0].sourceId),b=p&&await e.apply(p,()=>h=V2(p,o));return!p||h===null?(Qo(),{written:!1,failure:{text:t("rule.stale"),lines:[]}}):b?b.diagnostics?{written:!1,failure:Zo(null,b.diagnostics,d,t)}:{written:!0,failure:null}:void 0}catch(p){return u.aborted?void 0:{written:p instanceof he&&(p.key==="ui.writtenNotApplied"||p.key==="ui.operationUnknown"),failure:Zo(p,null,d,t)}}},s=async(o,u)=>{let d=0;for(const h of fa(o)){const p=await i(h,u);if(!p)return;p.written&&gn.remove(h.map(m=>m.id));const b=p.written?h.length:0;if(p.failure)return{written:d+b,failure:H2(p.failure,d&&d+b,o.length-d-b,t)};d+=b}return{written:d,failure:null}};return{apply:async o=>{if(!gn.begin())return;const u=new AbortController;r.current=u;try{return await s(o,u.signal)}finally{r.current===u&&(r.current=null),gn.end()}},busy:n,cancel:()=>{r.current?.abort(),e.cancel()}}}function z2(){const t=ne(),{rules:e}=Ff(),{apply:n,busy:r}=U2(),i=fa(e).length;return{count:e.length,label:i>1?t("rule.applyFiles",{n:e.length,files:i}):t("rule.applyPending",{n:e.length}),busy:r,apply:async()=>{const s=await n(e);s&&(gn.fail(s.failure),Ie(s.failure?"negative":"positive",s.failure?s.failure.text:t("rule.applied",{n:e.length})))}}}function W2(t,e,n,r){return Object.keys(Is).filter(i=>t(i)||e===i).map(i=>({id:i,label:r(Is[i]),isPending:e===i,isDisabled:!!e,onAction:()=>n(i)}))}function q2(t,e,n){const r=ne(),i=a2(t,e,n),s=l=>void i.run(l).then(a=>{a&&Ie("positive",r("ov.operationResult",{action:r(Is[l]),status:r("ov.succeeded"),id:a.operation_id}))},a=>q0(a,r,r("ov.operationError")));return{canRun:i.canRun,busy:i.busy,run:s,actions:W2(i.canRun,i.busy,s,r)}}function G2({className:t,...e}){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:f.jsx("path",{fill:"currentColor",d:"m17.13 5.734-5.75-4.472c-.812-.631-1.948-.632-2.76 0L2.87 5.735h-.002C2.324 6.157 2 6.821 2 7.511v8.239C2 16.99 3.01 18 4.25 18h11.5c1.24 0 2.25-1.01 2.25-2.25V7.51c0-.689-.324-1.353-.87-1.776M11.5 16.5h-3v-4.75c0-.413.337-.75.75-.75h1.5c.413 0 .75.337.75.75zm5-.75c0 .413-.337.75-.75.75H13v-4.75c0-1.24-1.01-2.25-2.25-2.25h-1.5C8.01 9.5 7 10.51 7 11.75v4.75H4.25c-.413 0-.75-.337-.75-.75V7.51c0-.229.108-.45.29-.592l5.75-4.47c.272-.213.65-.21.92-.002l5.75 4.472c.182.142.29.363.29.593z"})})}function Of({className:t,...e}){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:f.jsx("path",{fill:"currentColor",d:"M5.313 18.748c-1.04 0-2.08-.396-2.873-1.188-1.584-1.584-1.584-4.163 0-5.747l3.906-3.906c1.585-1.584 4.162-1.583 5.747 0q.327.329.566.71c.22.35.115.814-.235 1.034-.353.222-.814.115-1.034-.235q-.152-.241-.36-.45c-.999-.998-2.625-.997-3.624.002l-3.905 3.905c-.999 1-.999 2.627 0 3.626 1.001 1.001 2.627.997 3.626 0l1.952-1.952c.293-.293.768-.293 1.06 0s.294.767 0 1.06L8.189 17.56c-.792.792-1.834 1.187-2.875 1.188m8.341-6.655 3.906-3.905c1.584-1.585 1.584-4.164 0-5.748s-4.164-1.584-5.747 0L9.86 4.393c-.293.293-.293.767 0 1.06s.768.293 1.06 0l1.953-1.952c1-.998 2.625-1 3.626 0 .999.999.999 2.626 0 3.626l-3.905 3.905c-1 1-2.625 1-3.624.001q-.208-.207-.36-.449c-.22-.35-.681-.457-1.034-.235-.35.22-.456.683-.235 1.034q.24.381.566.71c.793.792 1.833 1.188 2.874 1.188 1.04 0 2.081-.396 2.873-1.188"})})}function J2({className:t,...e}){return f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:[f.jsx("path",{fill:"currentColor",d:"m13.527 5.49-3.002-2.997c-.293-.292- Line truncated
`,r.from-1)+1,s=n.filter(o=>o.from>=i&&o.to<=r.from);if(s.some(o=>o.depth!==1))return[];const l=s.findIndex(o=>o.parens===0&&t.slice(o.from,o.to)==="->"),a=l===-1||l===s.length-1?"":t.slice(s[l+1].from,r.from).trim();return[{from:i,to:r.to+(t[r.to]===`
`?1:0),target:a}]})}function Dv(t){const{blocks:e,tokens:n}=We(t),r=Yf(t,e,n).find(i=>i.target);return r?r.target==="direct"?{mode:"direct"}:{mode:"global",target:r.target}:{mode:"rule"}}function jv(t,e){const n=We(t);for(const h of Yf(t,n.blocks,n.tokens).reverse())t=t.slice(0,h.from)+t.slice(h.to);if(e.mode==="rule")return t;const{blocks:r,tokens:i}=We(t),s=r.find(h=>h.name==="routing");if(!s)throw new he("act.modeNoRouting");const a=t.slice(s.open+1,s.close).match(/\n([ \t]+)\S/)?.[1]??" ";let o=s.open+1;t[o]===`
`&&o++;let u=!1;for(let h=0;h<i.length;h++){const p=i[h];if(p.from<=s.open||p.to>s.close||p.depth!==1||p.parens!==0||t.slice(p.from,p.to)!=="->")continue;const b=i[h+1],m=i[h+2],y=i[h+3],g=i[h+4];if(!(b&&m&&y&&g&&t.slice(m.from,m.to)==="("&&t.slice(y.from,y.to)==="must"&&t.slice(g.from,g.to)===")")){u=!0;continue}if(u)throw new he("act.modeInterleaved");const $=t.indexOf(`
`,g.to);o=$!==-1&&$<s.close?$+1:g.to;const x=i[h+5];if(x&&x.from<o&&x.kind!=="comment")throw new he("act.modeInterleaved")}const d=e.mode==="direct"?"direct":e.target;return t.slice(0,o)+(t[o-1]===`
`?"":`
`)+`${a}l4proto(tcp, udp) -> ${d} ${Jf}
`+t.slice(o)}const Fv=(t,e)=>t.mode===e.mode&&(t.mode!=="global"||e.mode!=="global"||t.target===e.target),Xf={rule:"mode.rule",direct:"mode.direct",global:"mode.global"};function Av(t,e,n,r,i,s,l=!0){const a=r?e??t:t,o=a.mode==="global"?a.target:(t.mode==="global"?t.target:n[0]?.name)??"";return{mode:l?a.mode:"",target:l?o:"",targetText:l&&o||"—",writable:r,dirty:r&&e!==null&&!Fv(e,t),incomplete:a.mode==="global"&&!o,status:s(i?"act.modeReadOnly":"act.modeUnavailable"),readOnly:i&&!r,modes:["rule","direct","global"].map(u=>[u,s(Xf[u])]),targets:n.map(u=>({id:u.name,label:u.name}))}}const _v=t=>t.event!=="runtime.updated"&&t.event!=="flow.updated"&&!$y(t),Ov=8;function Bv(t,e){const n=[];for(const r of t){const i=wy(r,e),s=[r.event,i.key,...Object.entries(i.params??{}).map(([o,u])=>`${o}=${String(u)}`)].join("|"),l=n[n.length-1];if(l&&l.key===s){l.count+=1;continue}if(n.length===Ov)break;const a=Object.fromEntries(Object.entries(i.params??{}).map(([o,u])=>[o,typeof u=="string"?Ey(u):u]));n.push({id:r.id,tone:r.event==="flow.gap"?"warn":"info",kindText:e(r.event==="flow.gap"?"ui.warning":"ui.notice"),summaryText:e("ui.valuePair",{label:Gf(vy,r.event,e),value:e(i.key,a)}),key:s,count:1})}return n.map(({key:r,count:i,summaryText:s,...l})=>({...l,summaryText:i>1?e("ui.aside",{text:s,note:e("act.noticeRepeat",{n:i})}):s}))}function Vv(t,e,n,r=!1){return t.down.some(i=>i!==null)||t.up.some(i=>i!==null)?"ready":e===!1?r?"loading":"unavailable":n?"empty":"loading"}function Hv(t,e,n){const r=new Map;for(const l of t)r.set(l.name,(r.get(l.name)??0)+1);const i=t.map(l=>{const a=sy(l);return{id:l.id,name:l.name,label:r.get(l.name)>1?n("ui.aside",{text:l.name,note:[l.subscription_tag??l.provider_id??l.id,l.id].join(n("ui.separator"))}):l.name,tcp:ly(a),alive:a?.state==="unavailable"?!1:a?.state==="healthy"?!0:void 0,unavailable:a?.state==="unavailable",healthError:a?.error?I0(a.error,n):void 0}}),s=i.find(l=>l.id===e)??i.find(l=>l.tcp!==void 0)??i.find(l=>!wn(l.name))??i[0];return{options:i,big:i.length>12,id:s?.id??"",name:s?.name??"",latency:s?.alive&&s.tcp!==void 0?Gd(s.tcp,n):"—",tone:s?.alive?"ok":s?.unavailable?"err":"muted",status:n(s?.alive?"act.good":s?.unavailable?"act.unavailable":"act.unknown"),healthError:s?.healthError}}const Uv={ok:"act.memoryOk",warn:"act.memoryHigh",err:"act.memoryNearLimit"};function zv(t,e,n,r,i="en"){const s=Xl(e?.cgroup?.current_bytes??null,e?.cgroup?.limit_bytes??null),l=s===null?null:my(s);return{status:{tone:by(t?.lifecycle.state),text:t?Gf(hy,t.lifecycle.state,n):n(r===!1?"act.modeUnavailable":"ui.loading")},download:Ts(t?.traffic.rates?.download_bytes_per_second??null,i),upload:Ts(t?.traffic.rates?.upload_bytes_per_second??null,i),connections:t?.traffic.connections.total==null?"—":xn(t.traffic.connections.total,i),rss:Yt(e?.process?.rss_bytes??null,i),memoryBadge:l===null?null:{tone:l,text:n(Uv[l])}}}function Wv(t,e,n,r){const i=oy(t);return{since:t?r("act.since",{t:f1(t.counter_since,e)}):"",total:Yt(i.total,e),rows:i.rows.map((s,l)=>({name:ra(s.name,r),value:s.percent===null?null:Math.round(s.percent),text:Yt(s.bytes,e),color:s.kind==="builtin"&&s.name==="block"?n.love:n.cat[l%n.cat.length]}))}}function qv(t,e,n,r,i){return Kv(t,e).map((s,l)=>({name:s.name,value:s.percent===null?Yt(s.download,r):i("ui.share",{bytes:Yt(s.download,r),percent:s.percent}),pct:s.percent??0,color:n.cat[l%n.cat.length]}))}const cc=new WeakMap;function Gv(t){let e=cc.get(t);return e||cc.set(t,e=C2(wf,{},"replace")),e}function Jv(){const t=ne(),e=le(),n=Gv(e),r=c.useSyncExternalStore(n.subscribe,n.getSnapshot),i=Yy(l=>{_v(l)&&n.append(l)},!0);return{rows:c.useMemo(()=>Bv(r.records,t),[r.records,t]),total:r.records.length,error:i.error,retry:()=>void kn().then(()=>Jy(e)),loading:!i.error&&i.available===null,empty:t(i.available===!1?"event.unavailable":"act.noIssues")}}const Yv=(t,e)=>t.kind==="invalid"?{kind:"negative",text:e("ui.writeInvalid",{n:t.errors})}:t.kind==="failed"?Hl(t.error,e,e("ui.writeFailed")):null;function Xv(){const t=Ge().data?.resources,e=dt(t,"config",{whileLoading:!1})&&t?.config.writable===!0&&t?.config.content===!0,n=If(dt(t,"config",{whileLoading:!1})),r=jf(n.refetch,{rethrow:!0}),i=n.data?.sources.find(d=>d.kind==="main"&&d.writable)??null,s=w2(i),l=s?i:null,a=s===!1,o=c.useMemo(()=>n.error??(a?new he("config.incomplete"):null),[n.error,a]),{apply:u}=r;return{main:l,writable:e,busy:r.busy!==null,error:o,retry:n.refetch,apply:c.useCallback(async(d,h=l??void 0)=>{if(!h)return{kind:"failed",error:o??new he("config.incomplete")};try{const p=await u(h,d);return p?p.diagnostics?{kind:"invalid",errors:p.diagnostics.filter(b=>b.level==="error").length}:{kind:"ok"}:{kind:"cancelled"}}catch(p){return{kind:"failed",error:p}}},[l,u,o])}}function Zv(){const t=ne(),e=Ge().data?.resources,n=d2(dt(e,"groups",{whileLoading:!1})),r=If(dt(e,"config",{whileLoading:!1})),{main:i,writable:s,busy:l,error:a,retry:o,apply:u}=Xv(),d=(i??r.data?.sources.find(v=>v.kind==="main"))?.content,h=c.useMe Line truncated
@@ -1 +0,0 @@
import{r as g,j as m}from"./vendor-react-Bf71BWbF.js";import{eq as M}from"./index-zQjLFfuj.js";function b(t,e,s){const n=e.getBoundingClientRect(),o=s&&t.pointerType==="mouse"?Math.floor(t.clientX):t.clientX,l=s&&t.pointerType==="mouse"?Math.floor(t.clientY):t.clientY,i=o-n.left,r=l-n.top;return s?{x:Math.round(i*s.width/n.width),y:Math.round(r*s.height/n.height),width:s.width}:{x:i,y:r,width:n.width}}function C(t,e,s){const[n,o]=g.useState(null),[l,i]=g.useState(!1),[r,c]=g.useState(!1),a=n!==null&&n<t?n:null;return{onFocus:()=>{i(!0),a===null&&t&&(o(0),c(!0),e(0))},onBlur:()=>{i(!1),c(!1),s()},onPointerLeave:()=>{l||s()},onKeyDown:u=>{if(!["ArrowRight","ArrowLeft","Enter"].includes(u.key))return;if(u.preventDefault(),u.key==="Enter"){if(a===null)return;r?s():e(a),c(!r);return}const x=a===null?u.key==="ArrowRight"?0:t-1:a+(u.key==="ArrowRight"?1:-1);x<0||x>=t||(o(x),c(!0),e(x))}}}const w=(t,e)=>t===e||!!t&&!!e&&t.x===e.x&&t.y===e.y&&t.width===e.width&&t.label===e.label&&t.bounds?.x===e.bounds?.x&&t.bounds?.y===e.bounds?.y&&t.bounds?.height===e.bounds?.height&&t.bounds?.width===e.bounds?.width&&t.lines.length===e.lines.length&&t.lines.every((s,n)=>s===e.lines[n]);function k(){let t=null;const e=new Set;return{get:()=>t,set(s){w(t,s)||(t=s,e.forEach(n=>n()))},subscribe(s){return e.add(s),()=>void e.delete(s)}}}function T(){const t=g.useRef(null),[e]=g.useState(k),s=g.useCallback((o,l)=>{t.current&&e.set({...b(o,t.current),lines:l})},[e]),n=g.useCallback(()=>e.set(null),[e]);return{ref:t,tip:e,show:s,showAt:e.set,hide:n}}function z({tip:t}){const e=g.useSyncExternalStore(t.subscribe,t.get);if(!e)return null;if(e.bounds)return m.jsx(j,{tip:e});const s=e.x>e.width-120?"end":e.x<120?"start":"middle";return m.jsx("div",{className:"rp-charttip "+s,style:{left:e.x,top:e.y},"aria-hidden":"true",children:e.lines.map((n,o)=>o===0?m.jsx("b",{children:n},o):m.jsx("span",{children:n},o))})}const S=t=>t;function j({tip:t}){const[e,s]=M(S),[n,o]=g.useState(null);g.useEffect(()=>{const a=u=>{u.key==="Escape"&&o({x:t.x,y:t.y})};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[t.x,t.y]),n&&(n.x!==t.x||n.y!==t.y)&&o(null);const l=t.bounds,i=(a,u,x,f)=>{const d=a+10+u>x+f?a-u-10:a+10;return Math.max(x,Math.min(d,x+f-u))},r=i(t.x,s?.width??0,l.x,l.width),c=i(t.y,s?.height??0,l.y,l.height);return m.jsx("div",{ref:e,className:"rp-charttip-bounded",style:{visibility:s&&!(n?.x===t.x&&n?.y===t.y)?"visible":"hidden",pointerEvents:"none",position:"absolute",top:0,left:0,transform:`translate(${r}px, ${c}px)`},children:m.jsxs("div",{role:"status","aria-live":"polite",style:{margin:0,padding:"8px 12px",backgroundColor:"var(--rp-text)",color:"var(--rp-on-text)",border:"none",boxSizing:"border-box",inlineSize:"max-content",maxInlineSize:l.width,overflowWrap:"anywhere",borderRadius:8,fontSize:12},children:[m.jsx("p",{style:{margin:0},children:t.label}),m.jsx("ul",{style:{padding:0,margin:0},children:t.lines.map((a,u)=>m.jsx("li",{style:{display:"block",paddingTop:4,paddingBottom:4},children:a},u))})]})})}function R(t,e){return t.length?t[Math.min(t.length-1,Math.max(0,Math.ceil(e/100*t.length)-1))]:null}function v(t){const e=t.map(o=>Math.max(o,1));if(!e.length)return[1,10];const s=10**Math.floor(Math.log10(Math.min(...e))),n=10**Math.ceil(Math.log10(Math.max(...e)));return[s,n>s?n:s*10]}function B([t,e],s=8){const n=[];for(let l=t;l<=e;l*=10)for(const i of[1,2,5])l*i<=e&&n.push(l*i);const o=l=>Math.abs(Math.log10(l)-Math.round(Math.log10(l)))<1e-9;return n.length>s?n.filter(o):n}function D(t,[e,s]){const n=Math.min(s,Math.max(e,t));return(Math.log10(n)-Math.log10(e))/(Math.log10(s)-Math.log10(e))}function P(t,e,s){const n=t.map((a,u)=>({x:a,index:u})).sort((a,u)=>a.x-u.x),o=[],l=new Array(t.length).fill(0),i=[],r=e*2,c=s-e;for(const{x:a,index:u}of n){const x=[];for(let h=o.length-1;h>=0&&a-o[h].x<r;h--)x.push(o[h]);const f=h=>x.every(y=>(y.x-a)**2+(y.y-h)**2>=r*r-1e-6);let d=0;for(let h=0;!f(d);h++){const y=Math.ceil((h+1)/2)*(e/2);if(y>c){d=null;break}d=h%2?y:-y}if(l[u]=d,d===null){const h=i[i.length-1];h&&a-h.x<r?h.count++:i.push({x:a,count:1})}else o.push({x:a,y:d})}return{ys:l,hidden:i}}function F(t){const s=t.reduce((r,c)=>r+c,0);if(!s)return t.map(()=>0);const n=t.map(r=>r/s*100),o=n.map(Math.floor);let l=100-o.reduce((r,c)=>r+c,0);const i=n.map((r,c)=>({index:c,rest:r-o[c]})).sort((r,c)=>c.rest-r.rest||r.index-c.index);for(const{index:r}of i){if(!l)break;o[r]++,l--}for(let r=0;r<t.length;r++)if(t[r]>0&&o[r]===0){const c=o.indexOf(Math.max(...o));o[c]--,o[r]=1}return o}function I(t){const e=t.reduce((n,o)=>n+o,0),s=t.some(n=>n/e*360<6)?Math.min(6,360/t.length):0;return t.map(n=>s+n/e*(360-t.length*s))}function L(t,e){return t<=0||e<=0?0:Math.max(1,Math.ceil(t/e*5))}const p=[10,30,60,120,300,600,900,1800,3600,7200,21600,43200,86400,172800,604800,2592e3].map(t=>t*1e3);function N(t,e,s=24){const n=i=>Math.floor(e/i)-Math.floor(t/i)+1;let o=p.find(i=>n(i)<=s);o===void 0&&(o=Math.ceil((e-t)/(s-Line truncated
@@ -0,0 +1 @@
import{r as m,j as g}from"./vendor-react-Bf71BWbF.js";import{eH as p}from"./index-CXHBmSa5.js";function b(t,e,s){const n=e.getBoundingClientRect(),o=s&&t.pointerType==="mouse"?Math.floor(t.clientX):t.clientX,l=s&&t.pointerType==="mouse"?Math.floor(t.clientY):t.clientY,i=o-n.left,r=l-n.top;return s?{x:Math.round(i*s.width/n.width),y:Math.round(r*s.height/n.height),width:s.width}:{x:i,y:r,width:n.width}}function C(t,e,s){const[n,o]=m.useState(null),[l,i]=m.useState(!1),[r,a]=m.useState(!1),c=n!==null&&n<t?n:null;return{onFocus:()=>{i(!0),c===null&&t&&(o(0),a(!0),e(0))},onBlur:()=>{i(!1),a(!1),s()},onPointerLeave:()=>{l||s()},onKeyDown:u=>{if(!["ArrowRight","ArrowLeft","Enter"].includes(u.key))return;if(u.preventDefault(),u.key==="Enter"){if(c===null)return;r?s():e(c),a(!r);return}const x=c===null?u.key==="ArrowRight"?0:t-1:c+(u.key==="ArrowRight"?1:-1);x<0||x>=t||(o(x),a(!0),e(x))}}}const w=(t,e)=>t===e||!!t&&!!e&&t.x===e.x&&t.y===e.y&&t.width===e.width&&t.label===e.label&&t.bounds?.x===e.bounds?.x&&t.bounds?.y===e.bounds?.y&&t.bounds?.height===e.bounds?.height&&t.bounds?.width===e.bounds?.width&&t.lines.length===e.lines.length&&t.lines.every((s,n)=>s===e.lines[n]);function k(){let t=null;const e=new Set;return{get:()=>t,set(s){w(t,s)||(t=s,e.forEach(n=>n()))},subscribe(s){return e.add(s),()=>void e.delete(s)}}}function T(){const t=m.useRef(null),[e]=m.useState(k),s=m.useCallback((o,l)=>{t.current&&e.set({...b(o,t.current),lines:l})},[e]),n=m.useCallback(()=>e.set(null),[e]);return{ref:t,tip:e,show:s,showAt:e.set,hide:n}}function R({tip:t}){const e=m.useSyncExternalStore(t.subscribe,t.get);if(!e)return null;if(e.bounds)return g.jsx(E,{tip:e});const s=e.x>e.width-120?"end":e.x<120?"start":"middle";return g.jsx("div",{className:"rp-charttip "+s,style:{left:e.x,top:e.y},"aria-hidden":"true",children:e.lines.map((n,o)=>o===0?g.jsx("b",{children:n},o):g.jsx("span",{children:n},o))})}const j=t=>t;function E({tip:t}){const[e,s]=p(j),[n,o]=m.useState(null);m.useEffect(()=>{const c=u=>{u.key==="Escape"&&o({x:t.x,y:t.y})};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t.x,t.y]),n&&(n.x!==t.x||n.y!==t.y)&&o(null);const l=t.bounds,i=(c,u,x,f)=>{const d=c+10+u>x+f?c-u-10:c+10;return Math.max(x,Math.min(d,x+f-u))},r=i(t.x,s?.width??0,l.x,l.width),a=i(t.y,s?.height??0,l.y,l.height);return g.jsx("div",{ref:e,className:"rp-charttip-bounded",style:{visibility:s&&!(n?.x===t.x&&n?.y===t.y)?"visible":"hidden",pointerEvents:"none",position:"absolute",top:0,left:0,transform:`translate(${r}px, ${a}px)`},children:g.jsxs("div",{role:"status","aria-live":"polite",className:"rp-boundedtip",style:{maxInlineSize:l.width},children:[g.jsx("p",{children:t.label}),g.jsx("ul",{children:t.lines.map((c,u)=>g.jsx("li",{children:c},u))})]})})}function z(t,e){return t.length?t[Math.min(t.length-1,Math.max(0,Math.ceil(e/100*t.length)-1))]:null}function D(t){const e=t.map(o=>Math.max(o,1));if(!e.length)return[1,10];const s=10**Math.floor(Math.log10(Math.min(...e))),n=10**Math.ceil(Math.log10(Math.max(...e)));return[s,n>s?n:s*10]}function N([t,e],s=8){const n=[];for(let l=t;l<=e;l*=10)for(const i of[1,2,5])l*i<=e&&n.push(l*i);const o=l=>Math.abs(Math.log10(l)-Math.round(Math.log10(l)))<1e-9;return n.length>s?n.filter(o):n}function P(t,[e,s]){const n=Math.min(s,Math.max(e,t));return(Math.log10(n)-Math.log10(e))/(Math.log10(s)-Math.log10(e))}function B(t,e,s){const n=t.map((c,u)=>({x:c,index:u})).sort((c,u)=>c.x-u.x),o=[],l=new Array(t.length).fill(0),i=[],r=e*2,a=s-e;for(const{x:c,index:u}of n){const x=[];for(let h=o.length-1;h>=0&&c-o[h].x<r;h--)x.push(o[h]);const f=h=>x.every(M=>(M.x-c)**2+(M.y-h)**2>=r*r-1e-6);let d=0;for(let h=0;!f(d);h++){const M=Math.ceil((h+1)/2)*(e/2);if(M>a){d=null;break}d=h%2?M:-M}if(l[u]=d,d===null){const h=i[i.length-1];h&&c-h.x<r?h.count++:i.push({x:c,count:1})}else o.push({x:c,y:d})}return{ys:l,hidden:i}}function F(t){const s=t.reduce((r,a)=>r+a,0);if(!s)return t.map(()=>0);const n=t.map(r=>r/s*100),o=n.map(Math.floor);let l=100-o.reduce((r,a)=>r+a,0);const i=n.map((r,a)=>({index:a,rest:r-o[a]})).sort((r,a)=>a.rest-r.rest||r.index-a.index);for(const{index:r}of i){if(!l)break;o[r]++,l--}for(let r=0;r<t.length;r++)if(t[r]>0&&o[r]===0){const a=o.indexOf(Math.max(...o));o[a]--,o[r]=1}return o}function I(t){const e=t.reduce((n,o)=>n+o,0),s=t.some(n=>n/e*360<6)?Math.min(6,360/t.length):0;return t.map(n=>s+n/e*(360-t.length*s))}function L(t,e){return t<=0||e<=0?0:Math.max(1,Math.ceil(t/e*5))}const y=[10,30,60,120,300,600,900,1800,3600,7200,21600,43200,86400,172800,604800,2592e3].map(t=>t*1e3);function X(t,e,s=24){const n=i=>Math.floor(e/i)-Math.floor(t/i)+1;let o=y.find(i=>n(i)<=s);o===void 0&&(o=Math.ceil((e-t)/(s-1)/y[y.length-1])*y[y.length-1]);const l=[];for(let i=Math.floor(t/o)*o;i<=e;i+=o)l.push(i);return l}function Y(t,e){return Math.log10(1+Math.max(0,Math.min(t,e)))/Math.log10(1+e)}function v(t){const e=Math.max(1e3,t*2),s=[0];for(let n=1e3;n<=e;n*=1e3)s.push(n);return{enLine truncated
@@ -1 +1 @@
import{h as s,cy as a}from"./index-zQjLFfuj.js";const n=(e,t)=>`${e}:${t}`;function i(e,t){const l=e.indexOf(":"),o=e.slice(0,l);return l>0&&t.includes(o)?{kind:o,value:e.slice(l+1)}:null}const r={kernel:"flow.v.kernel",userspace:"flow.v.userspace",matched:"flow.v.matched",other_family_trusted:"flow.v.otherFamilyTrusted",failed:"flow.v.failed",not_required:"flow.v.notRequired",unavailable:"flow.v.unavailable",pass:"flow.v.pass",redirect:"flow.v.redirect",hold:"flow.v.hold",arm_direct:"flow.v.armDirect",activate_direct:"flow.v.activateDirect",activate_proxy:"flow.v.activateProxy",drop:"flow.v.drop",started:"flow.v.started",succeeded:"flow.v.succeeded",cancelled:"flow.v.cancelled",transport_ready:"flow.v.transportReady",target_request_sent:"flow.v.targetRequestSent",target_confirmed:"flow.v.targetConfirmed",first_reply:"flow.v.firstReply",terminal:"flow.v.terminal",unknown:"ui.unknown",route_selected:"flow.v.routeSelected",no_new_routing_input:"flow.v.noNewRoutingInput",reply_received:"flow.v.replyReceived",hit:"flow.v.hit",miss:"flow.v.miss",stale:"flow.v.stale",bypass:"flow.v.bypass",hosts:"flow.v.hosts",coalesced:"flow.v.coalesced",cache:"flow.v.cache",upstream:"ui.upstream",lan:"flow.v.lan",wan:"flow.v.wan",tls_sni:"flow.v.tlsSni",http_host:"flow.v.httpHost",quic_sni:"flow.v.quicSni",dns_mapping:"flow.v.dnsMapping",explicit:"flow.v.explicit"},c=e=>e==null?"—":r[e]?{key:r[e]}:e,w=(e,t)=>t&&e?s("rules",{tab:"list",rule:e}):void 0;function d(e){return e?i(e,a):null}function v(e){return s("rules",{tab:"list",add:n(e.kind,e.value)})}export{i as a,v as b,d as p,w as r,n as t,c as w};
import{h as s,cJ as a}from"./index-CXHBmSa5.js";const n=(e,t)=>`${e}:${t}`;function i(e,t){const l=e.indexOf(":"),o=e.slice(0,l);return l>0&&t.includes(o)?{kind:o,value:e.slice(l+1)}:null}const r={kernel:"flow.v.kernel",userspace:"flow.v.userspace",matched:"flow.v.matched",other_family_trusted:"flow.v.otherFamilyTrusted",failed:"flow.v.failed",not_required:"flow.v.notRequired",unavailable:"flow.v.unavailable",pass:"flow.v.pass",redirect:"flow.v.redirect",hold:"flow.v.hold",arm_direct:"flow.v.armDirect",activate_direct:"flow.v.activateDirect",activate_proxy:"flow.v.activateProxy",drop:"flow.v.drop",started:"flow.v.started",succeeded:"flow.v.succeeded",cancelled:"flow.v.cancelled",transport_ready:"flow.v.transportReady",target_request_sent:"flow.v.targetRequestSent",target_confirmed:"flow.v.targetConfirmed",first_reply:"flow.v.firstReply",terminal:"flow.v.terminal",unknown:"ui.unknown",route_selected:"flow.v.routeSelected",no_new_routing_input:"flow.v.noNewRoutingInput",reply_received:"flow.v.replyReceived",hit:"flow.v.hit",miss:"flow.v.miss",stale:"flow.v.stale",bypass:"flow.v.bypass",hosts:"flow.v.hosts",coalesced:"flow.v.coalesced",cache:"flow.v.cache",upstream:"ui.upstream",lan:"flow.v.lan",wan:"flow.v.wan",tls_sni:"flow.v.tlsSni",http_host:"flow.v.httpHost",quic_sni:"flow.v.quicSni",dns_mapping:"flow.v.dnsMapping",explicit:"flow.v.explicit"},c=e=>e==null?"—":r[e]?{key:r[e]}:e,w=(e,t)=>t&&e?s("rules",{tab:"list",rule:e}):void 0;function d(e){return e?i(e,a):null}function v(e){return s("rules",{tab:"list",add:n(e.kind,e.value)})}export{i as a,v as b,d as p,w as r,n as t,c as w};
@@ -0,0 +1 @@
const e={"act.noOutbounds":"This backend does not provide outbound counters","act.noConnections":"This backend does not provide connections","act.emptyHistory":"No history samples yet","act.historyRange":"History range","act.noHistory":"This backend does not provide history","act.unknown":"Unknown","act.latency":"Latency","act.upload":"Upload","act.download":"Download","act.active":"Active connections","act.memory":"Memory","act.sampling":"Sampling","act.rss":"Resident memory","act.cgroup":"cgroup used","act.truncated":"Truncated","act.memoryOk":"Normal","act.memoryHigh":"High","act.memoryNearLimit":"Near limit","act.traffic":"Traffic","act.viewDetails":"View details","act.limited":{one:"{n} feature is off",other:"{n} features are off"},"act.mode":"Outbound mode","act.global":"Global target","mode.rule":"Rule","mode.direct":"Direct","mode.global":"Global","act.modeApplied":"Outbound mode written to the configuration and reloaded: {mode}","act.modeNoRouting":"The main configuration has no routing section","act.modeInterleaved":"An ordinary rule comes before a must rule in the routing block. Move the must rules to the top of the routing block, then change the outbound mode.","act.modeReadOnly":"Read-only","act.modeWhyReadOnly":"Why is the mode read-only?","act.modeReadOnlyReason":"honk requires configuration writes and authenticated control. It marks the main source read-only if it contains a secret field or nested block in native_api or clash_api, or an active listener secret.","act.modeReadOnlyAction":"Make the main file writable by honk and keep native_api in its own include file.","act.readOnlyDocs":"Read-only sources","act.modeUnavailable":"Not provided by this backend","act.globalMissing":"Global mode needs a target group","act.viewAll":"View all","act.noticeRepeat":{one:"{n} time",other:"{n} times"},"act.since":"Since {t}","act.good":"Good","act.live":"Live","act.m10":"10 min","act.h1":"1 h","act.h6":"6 h","act.h24":"24 h","act.outUsage":"Outbound downloads","act.topDevices":"Top traffic","act.devices":"Devices","act.domains":"Domains","act.node":"Node","act.issues":"Notifications","act.noIssues":"No issues require attention","act.unavailable":"Unavailable","act.d7":"7 d","act.rankingScope":"Ranked by download totals for visible connections. Shares use all visible data.","act.rankingTruncated":"The connection list is truncated. Rankings cover only the retrieved data.","act.rankingEmpty":"No connections to rank","config.tabModules":"Modules","config.moduleOpen":"Open page","config.moduleManual":"Edit by hand","config.moduleManualTip":"Open the whole file in the Sources tab at this section","config.moduleAbsent":"Section not configured; add it to {file}.","config.moduleAbsentReadOnly":"Section not configured.","config.moduleSettings":{one:"{n} setting",other:"{n} settings"},"config.moduleSubscriptions":{one:"{n} subscription",other:"{n} subscriptions"},"config.moduleNodes":{one:"{n} node",other:"{n} nodes"},"config.moduleGroups":{one:"{n} group: {policies}",other:"{n} groups: {policies}"},"config.moduleDnsUpstreams":{one:"{n} upstream",other:"{n} upstreams"},"config.wizardPresetHelp":"All templates first connect NetworkManager, private-address and multicast traffic directly, then block remaining UDP/443 traffic. All except Global proxy also block advertisements.","config.wizardListenerPort":"Transparent proxy port","config.wizardDefaultDns":"Default DNS upstream","config.wizardChinaDns":"Mainland-China domain DNS upstream","config.wizardNetworkError":"Enter a port from 1 to 65535 and both DNS upstreams.","config.moduleDnsRequests":{one:"{n} request rule",other:"{n} request rules"},"config.moduleDnsResponses":{one:"{n} response rule",other:"{n} response rules"},"config.moduleRules":{one:"{n} rule",other:"{n} rules"},"config.generation":"Generation","config.generationHelp":"The number of the active configuration's generation. A reload that changes the active configuration starts a new generation; a reload that leaves the content unchanged keeps the current one.","config.saveValidating":"Validating…","config.revision":"Revision","config.errors":{one:"{n} error",other:"{n} errors"},"config.warnings":{one:"{n} warning",other:"{n} warnings"},"config.clean":"No diagnostics","config.redacted":"Listener secret values are redacted","config.readOnly":"Read-only","config.readOnlyHelp":"The backend does not allow configuration writes. On honk, enable experimental.native_api.config_write and set a secret or password sign-in.","config.secretSource":"Contains secrets","config.redactedSource":"Redacted","config.withheldSource":"Text not returned","config.readOnlyAttempt":"This file is read-only","config.kind.main":"Main","config.kind.include":"Include","config.kind.subscription":"Subscription","config.kind.generated":"Generated","config.validate":"Validate","config.edit":"Edit","config.save":"Apply and reload","config.noChanges":"No changes to apply","config.saveConflict":"Keep or discard your changes first","config.wLine truncated
@@ -1 +0,0 @@
const e={"act.noOutbounds":"This backend does not provide outbound counters","act.noConnections":"This backend does not provide connections","act.emptyHistory":"No history samples yet","act.historyRange":"History range","act.noHistory":"This backend does not provide history","act.unknown":"Unknown","act.latency":"Latency","act.upload":"Upload","act.download":"Download","act.active":"Active connections","act.memory":"Memory","act.sampling":"Sampling","act.rss":"Resident memory","act.cgroup":"cgroup used","act.truncated":"Truncated","act.memoryOk":"Normal","act.memoryHigh":"High","act.memoryNearLimit":"Near limit","act.traffic":"Traffic","act.viewDetails":"View details","act.mode":"Outbound mode","act.global":"Global target","mode.rule":"Rule","mode.direct":"Direct","mode.global":"Global","act.apply":"Apply","act.modeApplied":"Outbound mode written to the configuration and reloaded: {mode}","act.modeNoRouting":"The main configuration has no routing section","act.modeInterleaved":"Ordinary rules precede must rules; the outbound mode cannot be changed safely.","act.modeReadOnly":"Read-only","act.modeWhyReadOnly":"Why is the mode read-only?","act.modeReadOnlyReason":"honk requires configuration writes and authenticated control. It marks the main source read-only if it contains a secret field or nested block in native_api or clash_api, or an active listener secret.","act.modeReadOnlyAction":"Make the main file writable by honk and keep native_api in its own include file.","act.installGuide":"Installation instructions","act.modeUnavailable":"Not provided by this backend","act.viewAll":"View all","act.noticeRepeat":{one:"{n} time",other:"{n} times"},"act.since":"Since {t}","act.good":"Good","act.live":"Live","act.m10":"10 min","act.h1":"1 h","act.h6":"6 h","act.h24":"24 h","act.outUsage":"Outbound downloads","act.topDevices":"Top traffic","act.devices":"Devices","act.domains":"Domains","act.node":"Node","act.issues":"Notifications","act.noIssues":"No issues require attention","act.unavailable":"Unavailable","act.d7":"7 d","act.rankingScope":"Ranked by download totals for visible connections. Shares use all visible data.","act.rankingTruncated":"The connection list is truncated. Rankings cover only the retrieved data.","act.rankingEmpty":"No connection data to rank","config.tabModules":"Modules","config.moduleOpen":"Open page","config.moduleManual":"Edit by hand","config.moduleManualTip":"Open the whole file in the Sources tab at this section","config.moduleAbsent":"Section not configured; add it to {file}.","config.moduleAbsentReadOnly":"Section not configured.","config.moduleSettings":{one:"{n} setting",other:"{n} settings"},"config.moduleSubscriptions":{one:"{n} subscription",other:"{n} subscriptions"},"config.moduleNodes":{one:"{n} node",other:"{n} nodes"},"config.moduleGroups":{one:"{n} group: {policies}",other:"{n} groups: {policies}"},"config.moduleDnsUpstreams":{one:"{n} upstream",other:"{n} upstreams"},"config.wizardPresetHelp":"All templates first connect NetworkManager, private-address and multicast traffic directly, then block remaining UDP/443 traffic. All except Global proxy also block advertisements.","config.wizardListenerPort":"Transparent proxy port","config.wizardDefaultDns":"Default DNS upstream","config.wizardChinaDns":"Mainland-China domain DNS upstream","config.wizardNetworkError":"Enter a port from 1 to 65535 and both DNS upstreams.","config.moduleDnsRequests":{one:"{n} request rule",other:"{n} request rules"},"config.moduleDnsResponses":{one:"{n} response rule",other:"{n} response rules"},"config.moduleRules":{one:"{n} rule",other:"{n} rules"},"config.generation":"Generation","config.revision":"Revision","config.errors":{one:"{n} error",other:"{n} errors"},"config.warnings":{one:"{n} warning",other:"{n} warnings"},"config.clean":"No diagnostics","config.redacted":"Listener secret values are redacted","config.editable":"Editable","config.readOnly":"Read-only","config.kind.main":"Main","config.kind.include":"Include","config.kind.subscription":"Subscription","config.kind.generated":"Generated","config.validate":"Validate","config.edit":"Edit","config.save":"Apply and reload","config.incomplete":"The text is incomplete or redacted; it cannot be edited here","config.unquotable":"Cannot write this value losslessly as a single-quoted string: it contains an apostrophe, line break, or trailing backslash.","config.contentHidden":"This backend does not provide the configuration text","config.contentWithheld":"The backend did not return this source's text, so it cannot be edited here. Check the backend's content visibility policy.","config.valid":"Validation passed","config.invalid":{one:"Validation found {n} error",other:"Validation found {n} errors"},"config.saved":"{path} written, configuration reloaded","config.writeRestart":{one:"{n} setting takes effect only after a restart; nothing written. Change it in the file, then restart honk",other:"{n} settings take effect only after a restart; nothing wLine truncated
@@ -0,0 +1 @@
const e={"act.noOutbounds":"此后端不提供出站统计","act.noConnections":"此后端不提供连接","act.emptyHistory":"暂无历史样本","act.historyRange":"历史范围","act.noHistory":"此后端不提供历史数据","act.unknown":"未知","act.latency":"延迟","act.upload":"上传","act.download":"下载","act.active":"活动连接","act.memory":"内存","act.sampling":"采样中","act.rss":"常驻内存","act.cgroup":"cgroup 已用","act.truncated":"已截断","act.memoryOk":"正常","act.memoryHigh":"偏高","act.memoryNearLimit":"接近上限","act.traffic":"流量","act.viewDetails":"查看详情","act.limited":"{n} 项功能未开启","act.mode":"出站模式","act.global":"全局目标","mode.rule":"规则","mode.direct":"直连","mode.global":"全局","act.modeApplied":"出站模式已写入配置并重载:{mode}","act.modeNoRouting":"主配置未包含 routing 区段","act.modeInterleaved":"路由区段有普通规则排在 must 规则前面。请先把 must 规则移到路由区段最前面,再切换出站模式。","act.modeReadOnly":"只读","act.modeWhyReadOnly":"查看只读原因","act.modeReadOnlyReason":"honk 须允许配置写入,且控制端已设置身份验证。主配置若含 native_api 或 clash_api 的密钥字段或嵌套区块,会标记为只读。配置含当前的监听密钥时也一样。","act.modeReadOnlyAction":"请确认 honk 对主配置文件有写入权限,并将 native_api 设置放在独立的 include 文件。","act.readOnlyDocs":"只读的配置文件","act.modeUnavailable":"此后端不提供","act.globalMissing":"全局模式须指定目标组","act.viewAll":"查看全部","act.noticeRepeat":"重复 {n} 次","act.since":"自 {t} 起","act.good":"良好","act.live":"实时","act.m10":"10 分钟","act.h1":"1 小时","act.h6":"6 小时","act.h24":"24 小时","act.outUsage":"出站下载量","act.topDevices":"流量排行","act.devices":"设备","act.domains":"域名","act.node":"节点","act.issues":"通知与问题","act.noIssues":"当前没有需要处理的问题","act.unavailable":"不可用","act.d7":"7 天","act.rankingScope":"按当前可见连接的下载量排序,占比以全部可见数据计算。","act.rankingTruncated":"连接列表已截断,排行仅涵盖已获取的数据。","act.rankingEmpty":"当前没有可排行的连接","config.tabModules":"模块","config.moduleOpen":"打开页面","config.moduleManual":"手动编辑","config.moduleManualTip":"在来源标签页打开整个文件,光标位于此区段","config.moduleAbsent":"未设置此区段;可加入 {file}。","config.moduleAbsentReadOnly":"未设置此区段。","config.moduleSettings":"{n} 项设置","config.moduleSubscriptions":"{n} 个订阅","config.moduleNodes":"{n} 个节点","config.moduleGroups":"{n} 个组:{policies}","config.moduleDnsUpstreams":"{n} 个上游","config.wizardPresetHelp":"所有模板先让 NetworkManager、私有地址及多播流量直接连接,再屏蔽其余 UDP/443 流量。除全局代理外,其他模板也屏蔽广告。","config.wizardListenerPort":"透明代理端口","config.wizardDefaultDns":"默认 DNS 上游","config.wizardChinaDns":"中国大陆域名 DNS 上游","config.wizardNetworkError":"端口须介于 1 至 65535,两个 DNS 上游均须填写。","config.moduleDnsRequests":"{n} 条请求规则","config.moduleDnsResponses":"{n} 条响应规则","config.moduleRules":"{n} 条规则","config.generation":"生效代次","config.generationHelp":"生效配置的代次编号。重载使生效配置改变时会产生新代次,内容未变的重载保持原代次。","config.saveValidating":"正在验证…","config.revision":"配置修订","config.errors":"{n} 个错误","config.warnings":"{n} 个警告","config.clean":"没有诊断","config.redacted":"后端已脱敏监听密钥的值","config.readOnly":"只读","config.readOnlyHelp":"后端未开放写入配置。honk 须启用 experimental.native_api.config_write,并设置密钥或密码登录。","config.secretSource":"含密钥","config.redactedSource":"内容已脱敏","config.withheldSource":"未返回内容","config.readOnlyAttempt":"此文件只读","config.kind.main":"主配置","config.kind.include":"引入文件","config.kind.subscription":"订阅","config.kind.generated":"引擎生成","config.validate":"校验","config.edit":"编辑","config.save":"应用并重载","config.noChanges":"没有要应用的修改","config.saveConflict":"须先保留或放弃修改","config.wizardSubsInvalid":"每个订阅都须有不重复的名称和 HTTP 或 HTTPS 网址","config.validateNoMain":"后端未返回完整的主配置,因此无法校验","config.validateOther":"校验只涵盖主配置及其引入文件,不含此文件","config.incomplete":"内容不完整或已脱敏,不能在此编辑","config.moduleEditBlocked":"另一个区段有未保存的修改,须先应用或取消","config.unquotable":"无法写入:值含单引号、换行或结尾反Line truncated
@@ -1 +0,0 @@
const e={"act.noOutbounds":"此后端不提供出站统计","act.noConnections":"此后端不提供连接","act.emptyHistory":"暂无历史样本","act.historyRange":"历史范围","act.noHistory":"此后端不提供历史数据","act.unknown":"未知","act.latency":"延迟","act.upload":"上传","act.download":"下载","act.active":"活动连接","act.memory":"内存","act.sampling":"采样中","act.rss":"常驻内存","act.cgroup":"cgroup 已用","act.truncated":"已截断","act.memoryOk":"正常","act.memoryHigh":"偏高","act.memoryNearLimit":"接近上限","act.traffic":"流量","act.viewDetails":"查看详情","act.mode":"出站模式","act.global":"全局目标","mode.rule":"规则","mode.direct":"直连","mode.global":"全局","act.apply":"应用","act.modeApplied":"出站模式已写入配置并重载:{mode}","act.modeNoRouting":"主配置未包含 routing 区段","act.modeInterleaved":"普通规则位于 must 规则之前,无法安全切换出站模式。","act.modeReadOnly":"只读","act.modeWhyReadOnly":"查看只读原因","act.modeReadOnlyReason":"honk 须允许配置写入,且控制端已设置身份验证。主配置若含 native_api 或 clash_api 的密钥字段或嵌套区块,会标记为只读。配置含当前的监听密钥时也一样。","act.modeReadOnlyAction":"请确认 honk 对主配置文件有写入权限,并将 native_api 设置放在独立的 include 文件。","act.installGuide":"查看安装说明","act.modeUnavailable":"此后端不提供","act.viewAll":"查看全部","act.noticeRepeat":"重复 {n} 次","act.since":"自 {t} 起","act.good":"良好","act.live":"实时","act.m10":"10 分钟","act.h1":"1 小时","act.h6":"6 小时","act.h24":"24 小时","act.outUsage":"出站下载量","act.topDevices":"流量排行","act.devices":"设备","act.domains":"域名","act.node":"节点","act.issues":"通知与问题","act.noIssues":"当前没有需要处理的问题","act.unavailable":"不可用","act.d7":"7 天","act.rankingScope":"按当前可见连接的下载量排序,占比以全部可见数据计算。","act.rankingTruncated":"连接列表已截断,排行仅涵盖已获取的数据。","act.rankingEmpty":"暂无可排行的连接数据","config.tabModules":"模块","config.moduleOpen":"打开页面","config.moduleManual":"手动编辑","config.moduleManualTip":"在来源标签页打开整个文件,光标位于此区段","config.moduleAbsent":"未设置此区段;可加入 {file}。","config.moduleAbsentReadOnly":"未设置此区段。","config.moduleSettings":"{n} 项设置","config.moduleSubscriptions":"{n} 个订阅","config.moduleNodes":"{n} 个节点","config.moduleGroups":"{n} 个组:{policies}","config.moduleDnsUpstreams":"{n} 个上游","config.wizardPresetHelp":"所有模板先让 NetworkManager、私有地址及多播流量直接连接,再屏蔽其余 UDP/443 流量。除全局代理外,其他模板也屏蔽广告。","config.wizardListenerPort":"透明代理端口","config.wizardDefaultDns":"默认 DNS 上游","config.wizardChinaDns":"中国大陆域名 DNS 上游","config.wizardNetworkError":"端口须介于 1 至 65535,两个 DNS 上游均须填写。","config.moduleDnsRequests":"{n} 条请求规则","config.moduleDnsResponses":"{n} 条响应规则","config.moduleRules":"{n} 条规则","config.generation":"生效代次","config.revision":"配置修订","config.errors":"{n} 个错误","config.warnings":"{n} 个警告","config.clean":"没有诊断","config.redacted":"后端已脱敏监听密钥的值","config.editable":"可编辑","config.readOnly":"只读","config.kind.main":"主配置","config.kind.include":"引入文件","config.kind.subscription":"订阅","config.kind.generated":"引擎生成","config.validate":"校验","config.edit":"编辑","config.save":"应用并重载","config.incomplete":"内容不完整或已脱敏,不能在此编辑","config.unquotable":"无法写入:值含单引号、换行或结尾反斜线,无法无损转为单引号字符串。","config.contentHidden":"此后端不提供配置内容","config.contentWithheld":"后端未返回此来源的文本,因此不能在此编辑。请检查后端的内容可见性策略。","config.valid":"校验通过","config.invalid":"校验发现 {n} 个错误","config.saved":"{path} 已写入,配置已重载","config.writeRestart":"{n} 项设置需重启才会生效,未写入。请在文件中修改后重启 honk","config.diskAhead":"磁盘上的文件与运行中的配置不同,因此未写入。请重载 honk 以应用该文件;若文件更改了需重启的设置,请重启 honk","config.tooLarge":"配置超过后端可接受的大小。上限:{limit} 字节","config.diagnostics":"诊断","config.export":"导出","config.exportWarning":"导出文件保留显示的原始文本,可能包含凭据;分享前请检查内容。","config.newSource":"新建文件","config.newSourceTitle":"新建配置文件","config.newSourceHelp":"新文件内容为空,须匹Line truncated
@@ -1 +0,0 @@
const e={"act.noOutbounds":"此後端不提供出站統計","act.noConnections":"此後端不提供連線","act.emptyHistory":"尚無歷史樣本","act.historyRange":"歷史範圍","act.noHistory":"此後端不提供歷史資料","act.unknown":"未知","act.latency":"延遲","act.upload":"上傳","act.download":"下載","act.active":"活動連線","act.memory":"記憶體","act.sampling":"取樣中","act.rss":"常駐記憶體","act.cgroup":"cgroup 已用","act.truncated":"已截斷","act.memoryOk":"正常","act.memoryHigh":"偏高","act.memoryNearLimit":"接近上限","act.traffic":"流量","act.viewDetails":"查看詳情","act.mode":"出站模式","act.global":"全域目標","mode.rule":"規則","mode.direct":"直連","mode.global":"全域","act.apply":"套用","act.modeApplied":"出站模式已寫入組態並重載:{mode}","act.modeNoRouting":"主組態未包含 routing 區段","act.modeInterleaved":"一般規則位於 must 規則之前,無法安全切換出站模式。","act.modeReadOnly":"唯讀","act.modeWhyReadOnly":"查看唯讀原因","act.modeReadOnlyReason":"honk 須允許組態寫入,且控制端已設定驗證。主組態若含 native_api 或 clash_api 的密鑰欄位或巢狀區塊,會標記為唯讀。組態含目前的監聽密鑰時也一樣。","act.modeReadOnlyAction":"請確認 honk 對主組態檔案有寫入權限,並將 native_api 設定放在獨立的 include 檔案。","act.installGuide":"查看安裝說明","act.modeUnavailable":"此後端不提供","act.viewAll":"查看全部","act.noticeRepeat":"重複 {n} 次","act.since":"自 {t} 起","act.good":"良好","act.live":"即時","act.m10":"10 分鐘","act.h1":"1 小時","act.h6":"6 小時","act.h24":"24 小時","act.outUsage":"出站下載量","act.topDevices":"流量排行","act.devices":"裝置","act.domains":"網域","act.node":"節點","act.issues":"通知與問題","act.noIssues":"目前沒有需要處理的問題","act.unavailable":"無法使用","act.d7":"7 天","act.rankingScope":"依目前可見連線的下載量排序,佔比以全部可見資料計算。","act.rankingTruncated":"連線清單已截斷,排行僅涵蓋已取得的資料。","act.rankingEmpty":"尚無可排行的連線資料","config.tabModules":"模組","config.moduleOpen":"開啟頁面","config.moduleManual":"手動編輯","config.moduleManualTip":"在來源分頁開啟整個檔案,游標位於此區段","config.moduleAbsent":"未設定此區段;可加入 {file}。","config.moduleAbsentReadOnly":"未設定此區段。","config.moduleSettings":"{n} 項設定","config.moduleSubscriptions":"{n} 個訂閱","config.moduleNodes":"{n} 個節點","config.moduleGroups":"{n} 個群組:{policies}","config.moduleDnsUpstreams":"{n} 個上游","config.wizardPresetHelp":"所有範本先讓 NetworkManager、私有位址及多播流量直接連線,再封鎖其餘 UDP/443 流量。除全域代理外,其他範本亦封鎖廣告。","config.wizardListenerPort":"透明代理連接埠","config.wizardDefaultDns":"預設 DNS 上游","config.wizardChinaDns":"中國大陸網域 DNS 上游","config.wizardNetworkError":"連接埠須介於 1 至 65535,兩個 DNS 上游均須填寫。","config.moduleDnsRequests":"{n} 條請求規則","config.moduleDnsResponses":"{n} 條回應規則","config.moduleRules":"{n} 條規則","config.generation":"生效代次","config.revision":"組態修訂","config.errors":"{n} 個錯誤","config.warnings":"{n} 個警告","config.clean":"沒有診斷","config.redacted":"後端已遮蔽監聽密鑰的值","config.editable":"可編輯","config.readOnly":"唯讀","config.kind.main":"主組態","config.kind.include":"引入檔","config.kind.subscription":"訂閱","config.kind.generated":"引擎產生","config.validate":"驗證","config.edit":"編輯","config.save":"套用並重載","config.incomplete":"內容不完整或已遮蔽,不能在此編輯","config.unquotable":"無法寫入:值含單引號、換行或結尾反斜線,無法無損轉為單引號字串。","config.contentHidden":"此後端不提供組態內容","config.contentWithheld":"後端未回傳此來源的文字,因此不能在此編輯。請檢查後端的內容可見性原則。","config.valid":"驗證通過","config.invalid":"驗證發現 {n} 個錯誤","config.saved":"{path} 已寫入,組態已重載","config.writeRestart":"{n} 項設定需重新啟動才會生效,未寫入。請在檔案中修改後重新啟動 honk","config.diskAhead":"磁碟上的檔案與執行中的組態不同,因此未寫入。請重載 honk 以套用該檔案;若檔案變更了需重新啟動的設定,請重新啟動 honk","config.tooLarge":"組態超過後端可接受的大小。上限:{limit} 位元組","config.diagnostics":"診斷","config.export":"匯出","config.exportWarning":"匯出檔案保留顯示的原始文字,可能含有憑證;分享前請檢查內容。","config.newSource":"新增檔案","config.newSourceTitle":"新增組態檔","config.newSourceHelp":"新Line truncated
@@ -0,0 +1 @@
const e={"act.noOutbounds":"此後端不提供出站統計","act.noConnections":"此後端不提供連線","act.emptyHistory":"尚無歷史樣本","act.historyRange":"歷史範圍","act.noHistory":"此後端不提供歷史資料","act.unknown":"未知","act.latency":"延遲","act.upload":"上傳","act.download":"下載","act.active":"活動連線","act.memory":"記憶體","act.sampling":"取樣中","act.rss":"常駐記憶體","act.cgroup":"cgroup 已用","act.truncated":"已截斷","act.memoryOk":"正常","act.memoryHigh":"偏高","act.memoryNearLimit":"接近上限","act.traffic":"流量","act.viewDetails":"查看詳情","act.limited":"{n} 項功能未開啟","act.mode":"出站模式","act.global":"全域目標","mode.rule":"規則","mode.direct":"直連","mode.global":"全域","act.modeApplied":"出站模式已寫入組態並重載:{mode}","act.modeNoRouting":"主組態未包含 routing 區段","act.modeInterleaved":"路由區段有一般規則排在 must 規則前面。請先把 must 規則移到路由區段最前面,再切換出站模式。","act.modeReadOnly":"唯讀","act.modeWhyReadOnly":"查看唯讀原因","act.modeReadOnlyReason":"honk 須允許組態寫入,且控制端已設定驗證。主組態若含 native_api 或 clash_api 的密鑰欄位或巢狀區塊,會標記為唯讀。組態含目前的監聽密鑰時也一樣。","act.modeReadOnlyAction":"請確認 honk 對主組態檔案有寫入權限,並將 native_api 設定放在獨立的 include 檔案。","act.readOnlyDocs":"唯讀的組態檔案","act.modeUnavailable":"此後端不提供","act.globalMissing":"全域模式須指定目標群組","act.viewAll":"查看全部","act.noticeRepeat":"重複 {n} 次","act.since":"自 {t} 起","act.good":"良好","act.live":"即時","act.m10":"10 分鐘","act.h1":"1 小時","act.h6":"6 小時","act.h24":"24 小時","act.outUsage":"出站下載量","act.topDevices":"流量排行","act.devices":"裝置","act.domains":"網域","act.node":"節點","act.issues":"通知與問題","act.noIssues":"目前沒有需要處理的問題","act.unavailable":"無法使用","act.d7":"7 天","act.rankingScope":"依目前可見連線的下載量排序,佔比以全部可見資料計算。","act.rankingTruncated":"連線清單已截斷,排行僅涵蓋已取得的資料。","act.rankingEmpty":"目前沒有可排行的連線","config.tabModules":"模組","config.moduleOpen":"開啟頁面","config.moduleManual":"手動編輯","config.moduleManualTip":"在來源分頁開啟整個檔案,游標位於此區段","config.moduleAbsent":"未設定此區段;可加入 {file}。","config.moduleAbsentReadOnly":"未設定此區段。","config.moduleSettings":"{n} 項設定","config.moduleSubscriptions":"{n} 個訂閱","config.moduleNodes":"{n} 個節點","config.moduleGroups":"{n} 個群組:{policies}","config.moduleDnsUpstreams":"{n} 個上游","config.wizardPresetHelp":"所有範本先讓 NetworkManager、私有位址及多播流量直接連線,再封鎖其餘 UDP/443 流量。除全域代理外,其他範本亦封鎖廣告。","config.wizardListenerPort":"透明代理連接埠","config.wizardDefaultDns":"預設 DNS 上游","config.wizardChinaDns":"中國大陸網域 DNS 上游","config.wizardNetworkError":"連接埠須介於 1 至 65535,兩個 DNS 上游均須填寫。","config.moduleDnsRequests":"{n} 條請求規則","config.moduleDnsResponses":"{n} 條回應規則","config.moduleRules":"{n} 條規則","config.generation":"生效代次","config.generationHelp":"生效組態的代次編號。重載使生效組態改變時會產生新代次,內容未變的重載維持原代次。","config.saveValidating":"正在驗證…","config.revision":"組態修訂","config.errors":"{n} 個錯誤","config.warnings":"{n} 個警告","config.clean":"沒有診斷","config.redacted":"後端已遮蔽監聽密鑰的值","config.readOnly":"唯讀","config.readOnlyHelp":"後端未開放寫入組態。honk 須啟用 experimental.native_api.config_write,並設定密鑰或密碼登入。","config.secretSource":"含密鑰","config.redactedSource":"內容已遮蔽","config.withheldSource":"未回傳內容","config.readOnlyAttempt":"此檔案唯讀","config.kind.main":"主組態","config.kind.include":"引入檔","config.kind.subscription":"訂閱","config.kind.generated":"引擎產生","config.validate":"驗證","config.edit":"編輯","config.save":"套用並重載","config.noChanges":"沒有要套用的修改","config.saveConflict":"須先保留或放棄修改","config.wizardSubsInvalid":"每個訂閱都須有不重複的名稱與 HTTP 或 HTTPS 網址","config.validateNoMain":"後端未回傳完整的主組態,因此無法驗證","config.validateOther":"驗證只涵蓋主組態與其引入檔,不含此檔案","config.incomplete":"內容不完整或已遮蔽,不能在此編輯","config.moduleEditBlocked":"另一個區段有未儲存的修改,須先套用或取消","config.unquotable":"無法寫入:值含單引號、換行或結Line truncated
@@ -1 +0,0 @@
import{r as n}from"./vendor-react-Bf71BWbF.js";import{be as E,$ as S,ds as f,dt as v,dm as x}from"./index-zQjLFfuj.js";const g=()=>f(x,{},"replace",o=>`${o.event} ${o.id}`),C=1e3,F=()=>()=>{},L={records:[]};function _(o){const s=n.useMemo(()=>({changes:g(),runtime:g()}),[]),a=n.useSyncExternalStore(s.changes.subscribe,s.changes.getSnapshot),c=n.useSyncExternalStore(o?s.runtime.subscribe:F,o?s.runtime.getSnapshot:()=>L),p=v(r=>(r.event==="runtime.updated"?s.runtime:s.changes).append(r),!0),u=n.useMemo(()=>{if(!c.records.length)return a.records;if(!a.records.length)return c.records;const r=new Map([...a.records,...c.records].map(t=>[t,Date.parse(t.data.observed_at)]));return[...r.keys()].sort((t,e)=>r.get(e)-r.get(t))},[a.records,c.records]);return{...p,events:u}}function I({level:o,target:s,paused:a}){const c=E(),u=S().data?.resources.logs.available,r=n.useRef(()=>{}),t=n.useMemo(()=>{const e=f(C,{connected:!1,error:null},"ignore");return{getSnapshot:e.getSnapshot,clear:e.clear,hold:e.hold,subscribe(h){const m=e.subscribe(h);let l=new AbortController;const b=()=>{l=new AbortController;const{signal:d}=l;e.update({error:null}),u&&c.subscribeLogs({level:o,target:s||void 0,signal:d,onConnectionChange:i=>{d.aborted||e.update({connected:i})},onRecord:i=>{d.aborted||e.append(i)},onCursorExpired:()=>{d.aborted||e.markGap()}}).catch(i=>{d.aborted||e.update({error:i instanceof Error?i:new Error(String(i))})})};return b(),r.current=()=>{l.abort(),b()},()=>{l.abort(),r.current=()=>{},m()}}}},[c,u,o,s]);return n.useEffect(()=>t.hold(a),[t,a]),{...n.useSyncExternalStore(t.subscribe,t.getSnapshot),available:u,clear:t.clear,retry:()=>r.current()}}export{C as L,I as a,_ as u};
@@ -1 +1 @@
import{a1 as e}from"./index-zQjLFfuj.js";function d(t){return[...e(t,"dns_log",{whileLoading:!0})?[{id:"stats",titleKey:"dns.tab.stats"}]:[],...e(t,"dns_log",{whileLoading:!0})?[{id:"log",titleKey:"dns.log"}]:[],...e(t,"dns_query",{whileLoading:!0})?[{id:"query",titleKey:"dns.query"}]:[],...e(t,"dns_cache",{whileLoading:!0})?[{id:"cache",titleKey:"ui.cache"}]:[]]}export{d};
import{a7 as e}from"./index-CXHBmSa5.js";function d(t){return[...e(t,"dns_log",{whileLoading:!0})?[{id:"stats",titleKey:"dns.tab.stats"}]:[],...e(t,"dns_log",{whileLoading:!0})?[{id:"log",titleKey:"dns.log"}]:[],...e(t,"dns_query",{whileLoading:!0})?[{id:"query",titleKey:"dns.query"}]:[],...e(t,"dns_cache",{whileLoading:!0})?[{id:"cache",titleKey:"ui.cache"}]:[]]}export{d};
Loaded 100 of 138 files, more files were not shown because too many files have changed in this diff. Show more