🎁 Sync 2026-09-30 11:42:51

This commit is contained in:
github-actions[bot] committed 2026-09-30 11:42:51 +08:00
1 parent 214a01499a
commit 6c95370452
167 files changed
+3579 -7579

No files matched your search

+5 -5
View File
@@ -3,16 +3,16 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=honk PKG_NAME:=honk
PKG_VERSION:=0.0.1_beta82 PKG_VERSION:=0.0.1_beta83
PKG_RELEASE:=4 PKG_RELEASE:=5
# Raw upstream release tag. It keeps the dots in qualifiers (e.g. v0.0.1.beta.49) # 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. # because that is what the GitHub release asset name uses.
HONK_RELEASE_TAG:=v0.0.1.beta.82 HONK_RELEASE_TAG:=v0.0.1.beta.83
# SHA256 of each release tarball, kept in sync by scripts/update_honk_version.sh. # SHA256 of each release tarball, kept in sync by scripts/update_honk_version.sh.
HONK_HASH_X86_64:=075db4ebb3dd1b51fb59c8e4c3de5853bd837f5f5ca5fd0ef7698b574f8f9a88 HONK_HASH_X86_64:=0d440bc094a4ceead94a897647b3c598f6ca7630c65a1675ed137e3d9c1c0c56
HONK_HASH_AARCH64:=6b66319bda2110d075e8f2788d728fdf75ca36dffdb3884a192803a34a529c59 HONK_HASH_AARCH64:=bb8c893c676f8f245332598ae701f50b803b922aef308dded4d0805c67692ab3
PKG_LICENSE:=AGPL-3.0-only PKG_LICENSE:=AGPL-3.0-only
PKG_LICENSE_FILE:=LICENSE PKG_LICENSE_FILE:=LICENSE
+1 -1
View File
@@ -12,7 +12,7 @@ LUCI_DEPENDS:=+luci-base +logd +jsonfilter +coreutils-timeout
LUCI_PKGARCH:=all LUCI_PKGARCH:=all
PKG_VERSION:=0.1.47 PKG_VERSION:=0.1.47
PKG_RELEASE:=51 PKG_RELEASE:=52
# Reproducible build: honor SOURCE_DATE_EPOCH from the build environment (set by docker-sdk.sh / CI). # Reproducible build: honor SOURCE_DATE_EPOCH from the build environment (set by docker-sdk.sh / CI).
ifdef SOURCE_DATE_EPOCH ifdef SOURCE_DATE_EPOCH
@@ -125,6 +125,7 @@ return view.extend({
manualFetchLinesExplicit: false, manualFetchLinesExplicit: false,
rpcPreferencesResolved: false, rpcPreferencesResolved: false,
entries: [], entries: [],
filteredRowsCache: null,
sessionSeen: null, sessionSeen: null,
pauseBufferLoading: false, pauseBufferLoading: false,
/* Freezes row rendering while polling, health, and cadence updates continue. */ /* Freezes row rendering while polling, health, and cadence updates continue. */
@@ -1057,6 +1058,8 @@ return view.extend({
} }
} }
if (changed) this.invalidateFilteredRows();
/* Keep buffered rows current without painting a paused or hidden table. */ /* Keep buffered rows current without painting a paused or hidden table. */
if (changed && !this.tablePaused && (!this.summaryMode || this.summaryRowsShown)) if (changed && !this.tablePaused && (!this.summaryMode || this.summaryRowsShown))
this.renderRows(true); this.renderRows(true);
@@ -1214,7 +1217,7 @@ return view.extend({
await Promise.all([this.loadRulesMap(epoch), this.loadLoggingStatus(epoch)]); await Promise.all([this.loadRulesMap(epoch), this.loadLoggingStatus(epoch)]);
/* Recovery RPCs can outlive the poll epoch; don't repaint stale views. */ /* Recovery RPCs can outlive the poll epoch; don't repaint stale views. */
if (epoch !== this.currentPollEpoch() || this.viewDisposed) return; if (epoch !== this.currentPollEpoch() || this.viewDisposed) return;
this.refreshBufferedRuleLabels(); /* loadRulesMap refreshes buffered labels when its map read succeeds. */
} catch (_e) { } catch (_e) {
/* A throw here is local UI work after a successful poll. Leave /* A throw here is local UI work after a successful poll. Leave
* lastPollError / lastPollErrorCode as applyPollReply set them. */ * lastPollError / lastPollErrorCode as applyPollReply set them. */
@@ -1547,7 +1550,7 @@ return view.extend({
if (!card.style) card.style = { display: '' }; if (!card.style) card.style = { display: '' };
card.style.display = this.summaryMode ? 'block' : 'none'; card.style.display = this.summaryMode ? 'block' : 'none';
} }
this.syncEmptyScrollVisibility(this.filteredRows().length); this.syncEmptyScrollVisibility(this.filteredRowsState().rows.length);
if (toggle) { if (toggle) {
toggle.textContent = this.summaryRowsShown ? _('Hide rows') : _('Show rows'); toggle.textContent = this.summaryRowsShown ? _('Hide rows') : _('Show rows');
toggle.setAttribute('aria-pressed', this.summaryRowsShown ? 'true' : 'false'); toggle.setAttribute('aria-pressed', this.summaryRowsShown ? 'true' : 'false');
@@ -1568,7 +1571,7 @@ return view.extend({
this.summaryData = null; this.summaryData = null;
this.updateSummaryUi(); this.updateSummaryUi();
if (this.tablePaused) { if (this.tablePaused) {
this.syncEmptyScrollVisibility(this.filteredRows().length); this.syncEmptyScrollVisibility(this.filteredRowsState().rows.length);
this.updateStatus(); this.updateStatus();
} else { } else {
this.resolvePaintPending = false; this.resolvePaintPending = false;
@@ -1612,27 +1615,61 @@ return view.extend({
} }
}, },
filteredRows() { invalidateFilteredRows() {
const filters = this.readFilters(); /* Use after in-place edits: free-text query matching reads every row field. */
return this.entries this.filteredRowsCache = null;
.filter((row) => log.matchesFilter(row, filters))
.slice(-this.displayRowCap())
.reverse();
}, },
compactCountText(matchCount) { /* Internal shared result: consumers must treat the state and rows as read-only.
* filteredRows() provides an array copy for callers that need to mutate it. */
filteredRowsState() {
/* Poll ingest and limit trimming replace the array, even at equal length.
* Rule-label edits invalidate explicitly because query matches all fields. */
const filters = this.readFilters();
const filterKey = JSON.stringify(filters);
const rowCap = this.displayRowCap();
const entries = this.entries;
const cached = this.filteredRowsCache;
if (
cached &&
cached.entries === entries &&
cached.filterKey === filterKey &&
cached.rowCap === rowCap
)
return cached;
const matching = [];
for (let i = 0; i < entries.length; i++) {
if (log.matchesFilter(entries[i], filters)) matching.push(entries[i]);
}
const state = {
entries: entries,
filterKey: filterKey,
rowCap: rowCap,
matchCount: matching.length,
rows: matching.slice(-rowCap).reverse()
};
this.filteredRowsCache = state;
return state;
},
filteredRows() {
return this.filteredRowsState().rows.slice();
},
compactCountText(filtered) {
const stored = this.entries.length; const stored = this.entries.length;
/* Keep the stored-buffer denominator tied to the user's Limit. A weak /* Keep the stored-buffer denominator tied to the user's Limit. A weak
* device's rendered-row cap is called out separately in statusSuffix(). */ * device's rendered-row cap is called out separately in statusSuffix(). */
const limit = this.rowLimit; const limit = this.rowLimit;
const suffix = this.statusSuffix(); const suffix = this.statusSuffix();
/* While the table is paused the buffer can grow past the display limit — count matches /* The filter state contains both visible rows and the full match count, so
* over the full buffer so "matching" is not capped at visibleRows. */ * paused status can report matches beyond the display cap without rescanning. */
let shown = matchCount; const state =
if (this.tablePaused) { filtered && Array.isArray(filtered.rows) ? filtered : this.filteredRowsState();
const filters = this.readFilters(); const shown = this.tablePaused ? state.matchCount : state.rows.length;
shown = this.entries.filter((row) => log.matchesFilter(row, filters)).length;
}
if (this.pauseBufferLoading && stored === 0) return _('loading…') + suffix; if (this.pauseBufferLoading && stored === 0) return _('loading…') + suffix;
@@ -1643,11 +1680,12 @@ return view.extend({
return ''; return '';
}, },
updateStatus(rows) { updateStatus(filtered) {
const status = document.getElementById('fwlive-status'); const status = document.getElementById('fwlive-status');
if (!status) return; if (!status) return;
const matchCount = rows ? rows.length : this.filteredRows().length; const state =
filtered && Array.isArray(filtered.rows) ? filtered : this.filteredRowsState();
const suffix = this.statusSuffix(); const suffix = this.statusSuffix();
if (this.lastPollError) { if (this.lastPollError) {
@@ -1663,7 +1701,7 @@ return view.extend({
status.className = this.tablePaused status.className = this.tablePaused
? 'fwlive-status fwlive-status-paused' ? 'fwlive-status fwlive-status-paused'
: 'fwlive-status'; : 'fwlive-status';
status.textContent = this.compactCountText(matchCount); status.textContent = this.compactCountText(state);
this.updateAdaptiveBanner(); this.updateAdaptiveBanner();
}, },
@@ -2079,7 +2117,8 @@ return view.extend({
const scroll = document.getElementById('fwlive-scroll'); const scroll = document.getElementById('fwlive-scroll');
this.updateHash(this.readFilters()); this.updateHash(this.readFilters());
const rows = this.filteredRows(); const filtered = this.filteredRowsState();
const rows = filtered.rows.slice();
const paint = this.ensureRenderScheduler().shouldRender( const paint = this.ensureRenderScheduler().shouldRender(
rows, rows,
!!force, !!force,
@@ -2090,7 +2129,7 @@ return view.extend({
if (!paint) { if (!paint) {
this.updateFloodBanner(); this.updateFloodBanner();
this.syncEmptyScrollVisibility(rows.length); this.syncEmptyScrollVisibility(rows.length);
this.updateStatus(rows); this.updateStatus(filtered);
return; return;
} }
@@ -2099,7 +2138,7 @@ return view.extend({
const prevScroll = scroll ? scroll.scrollTop : 0; const prevScroll = scroll ? scroll.scrollTop : 0;
this.syncEmptyScrollVisibility(rows.length); this.syncEmptyScrollVisibility(rows.length);
this.updateStatus(rows); this.updateStatus(filtered);
this.renderFilterChips(); this.renderFilterChips();
table.renderRows( table.renderRows(
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+153 -153
View File
@@ -1,15 +1,15 @@
msgid "" msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8" msgstr "Content-Type: text/plain; charset=UTF-8"
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1639 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1676
msgid "%d matching · %d/%d stored" msgid "%d matching · %d/%d stored"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1433 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1436
msgid "%s · requested up to %d raw lines · %d firewall messages returned" msgid "%s · requested up to %d raw lines · %d firewall messages returned"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1423 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1426
msgid "" msgid ""
"%s · requested up to %d raw lines · server limited fetch to %d · %d firewall " "%s · requested up to %d raw lines · server limited fetch to %d · %d firewall "
"messages returned" "messages returned"
@@ -19,11 +19,11 @@ msgstr ""
msgid "%s: %s" msgid "%s: %s"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1641 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1678
msgid "0 matching · %d/%d stored" msgid "0 matching · %d/%d stored"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:453 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:454
msgid "Accessible (teal/orange)" msgid "Accessible (teal/orange)"
msgstr "" msgstr ""
@@ -32,11 +32,11 @@ msgstr ""
msgid "Action" msgid "Action"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:949 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:950
msgid "Administrator access is required to disable logging." msgid "Administrator access is required to disable logging."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:914 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:915
msgid "Administrator access is required to enable logging." msgid "Administrator access is required to enable logging."
msgstr "" msgstr ""
@@ -44,32 +44,32 @@ msgstr ""
msgid "Allow/deny rules, LAN logging, or anything else." msgid "Allow/deny rules, LAN logging, or anything else."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1833 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1871
msgid "Also seen" msgid "Also seen"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:883 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:884
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:926 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:927
msgid "Another change is staged for the firewall; apply or revert it first." msgid "Another change is staged for the firewall; apply or revert it first."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:903 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:904
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:944 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:945
msgid "" msgid ""
"Another change overwrote WAN logging after it was saved; check the current " "Another change overwrote WAN logging after it was saved; check the current "
"state." "state."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2642 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2681
msgid "Any action" msgid "Any action"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1826 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1864
msgid "Any protocol" msgid "Any protocol"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1414 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1417
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1474 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1477
msgid "Auto" msgid "Auto"
msgstr "" msgstr ""
@@ -77,7 +77,7 @@ msgstr ""
msgid "Before you enable logging" msgid "Before you enable logging"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:880 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:881
msgid "Cannot enable logging until kernel log modules are installed." msgid "Cannot enable logging until kernel log modules are installed."
msgstr "" msgstr ""
@@ -85,11 +85,11 @@ msgstr ""
msgid "Changes:" msgid "Changes:"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:452 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:453
msgid "Classic (green/red)" msgid "Classic (green/red)"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2373 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2412
msgid "Classic uses green/red; Accessible uses teal/orange" msgid "Classic uses green/red; Accessible uses teal/orange"
msgstr "" msgstr ""
@@ -97,13 +97,13 @@ msgstr ""
msgid "Clear all" msgid "Clear all"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2714 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2753
msgid "" msgid ""
"Click a cell to filter · ≠ on a chip to exclude · Ctrl+click a rule for " "Click a cell to filter · ≠ on a chip to exclude · Ctrl+click a rule for "
"firewall settings · in Simple view, click a row for the full message" "firewall settings · in Simple view, click a row for the full message"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2441 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2480
msgid "" msgid ""
"Click a row (Time or other non-link cells) to see the full log line (Simple " "Click a row (Time or other non-link cells) to see the full log line (Simple "
"view)." "view)."
@@ -113,66 +113,66 @@ msgstr ""
msgid "Click a row for the full message" msgid "Click a row for the full message"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2446 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2485
msgid "" msgid ""
"Click an IP, action, or protocol to filter; use the Protocol menu (or ≠ on a " "Click an IP, action, or protocol to filter; use the Protocol menu (or ≠ on a "
"chip) to exclude." "chip) to exclude."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1827 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1865
msgid "Common" msgid "Common"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1658 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1696
msgid "Connection lost — retrying…" msgid "Connection lost — retrying…"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:888 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:889
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:931 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:932
msgid "Could not acquire the logging lock." msgid "Could not acquire the logging lock."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:898 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:899
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:939 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:940
msgid "Could not clear the WAN zone log option." msgid "Could not clear the WAN zone log option."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:946 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:947
msgid "Could not disable logging." msgid "Could not disable logging."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:905 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:906
msgid "Could not enable logging." msgid "Could not enable logging."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:814 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:815
msgid "Could not load logging status." msgid "Could not load logging status."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:813 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:814
msgid "Could not refresh logging status; showing the last known state." msgid "Could not refresh logging status; showing the last known state."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:900 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:901
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:941 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:942
msgid "Could not save the firewall configuration." msgid "Could not save the firewall configuration."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:892 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:893
msgid "Could not snapshot the current logging state." msgid "Could not snapshot the current logging state."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:890 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:891
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:933 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:934
msgid "Could not track the logging change safely; logging was not changed." msgid "Could not track the logging change safely; logging was not changed."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:896 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:897
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:937 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:938
msgid "Could not write the WAN zone log option." msgid "Could not write the WAN zone log option."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2669 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2708
msgid "Custom protocol (prefix ! to exclude). Overrides the menu when set." msgid "Custom protocol (prefix ! to exclude). Overrides the menu when set."
msgstr "" msgstr ""
@@ -180,11 +180,11 @@ msgstr ""
msgid "DPort" msgid "DPort"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1276 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1279
msgid "Degraded — sampling" msgid "Degraded — sampling"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1445 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1448
msgid "Degraded — sampling (slow poll RTT; cadence reduced)." msgid "Degraded — sampling (slow poll RTT; cadence reduced)."
msgstr "" msgstr ""
@@ -193,7 +193,7 @@ msgstr ""
msgid "Destination" msgid "Destination"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2699 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2738
msgid "Destination IP contains (! to exclude)" msgid "Destination IP contains (! to exclude)"
msgstr "" msgstr ""
@@ -201,11 +201,11 @@ msgstr ""
msgid "Destination port" msgid "Destination port"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2704 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2743
msgid "Destination port (! to exclude)" msgid "Destination port (! to exclude)"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2557 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2596
msgid "Detail" msgid "Detail"
msgstr "" msgstr ""
@@ -217,15 +217,15 @@ msgstr ""
msgid "Disabling…" msgid "Disabling…"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1272 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1275
msgid "Display limited to %d rows on this device" msgid "Display limited to %d rows on this device"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2314 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2353
msgid "Display options" msgid "Display options"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2406 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2445
msgid "Display options on the bar set Limit, row tint, palette, and hostnames." msgid "Display options on the bar set Limit, row tint, palette, and hostnames."
msgstr "" msgstr ""
@@ -249,7 +249,7 @@ msgstr ""
msgid "Enable logging" msgid "Enable logging"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2402 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2441
msgid "" msgid ""
"Enable logging turns on WAN zone drop/reject logging only (same as Network → " "Enable logging turns on WAN zone drop/reject logging only (same as Network → "
"Firewall). It does not add rules or log normal LAN browsing." "Firewall). It does not add rules or log normal LAN browsing."
@@ -260,7 +260,7 @@ msgstr ""
msgid "Enabling…" msgid "Enabling…"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1840 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1878
msgid "Exclude" msgid "Exclude"
msgstr "" msgstr ""
@@ -268,11 +268,11 @@ msgstr ""
msgid "Exclude instead" msgid "Exclude instead"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2328 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2367
msgid "Fetch budget" msgid "Fetch budget"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2410 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2449
msgid "" msgid ""
"Fetch budget controls raw log lines per poll. Auto derives from Limit; " "Fetch budget controls raw log lines per poll. Auto derives from Limit; "
"Manual selects a bounded maximum." "Manual selects a bounded maximum."
@@ -288,7 +288,7 @@ msgstr ""
msgid "Filter logs by rule (hint: %s). Ctrl+click to open firewall settings." msgid "Filter logs by rule (hint: %s). Ctrl+click to open firewall settings."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2484 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2523
#: openwrt-feed/luci-app-fwlive/root/usr/share/luci/menu.d/luci-app-fwlive.json:3 #: openwrt-feed/luci-app-fwlive/root/usr/share/luci/menu.d/luci-app-fwlive.json:3
msgid "Firewall Live View" msgid "Firewall Live View"
msgstr "" msgstr ""
@@ -301,7 +301,7 @@ msgstr ""
msgid "Flow" msgid "Flow"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2420 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2459
msgid "" msgid ""
"For a responsive table on a weak device, keep Limit at 250 rows or below. " "For a responsive table on a weak device, keep Limit at 250 rows or below. "
"The weak-device cap affects rendered rows; the buffer can still retain more." "The weak-device cap affects rendered rows; the buffer can still retain more."
@@ -315,25 +315,25 @@ msgstr ""
msgid "Grant access to firewall live log view" msgid "Grant access to firewall live log view"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2393 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2432
msgid "Help" msgid "Help"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1552 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1555
msgid "Hide rows" msgid "Hide rows"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1607 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1610
msgid "" msgid ""
"High event rate — table refresh is throttled to protect the browser. The " "High event rate — table refresh is throttled to protect the browser. The "
"buffer still updates; refresh will resume automatically." "buffer still updates; refresh will resume automatically."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1452 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1455
msgid "Hostname resolve paused while the router is under load." msgid "Hostname resolve paused while the router is under load."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1831 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1869
msgid "ICMPv6" msgid "ICMPv6"
msgstr "" msgstr ""
@@ -341,7 +341,7 @@ msgstr ""
msgid "IN" msgid "IN"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2457 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2496
msgid "" msgid ""
"If Row tint looks missing, the active LuCI theme may omit success/error or " "If Row tint looks missing, the active LuCI theme may omit success/error or "
"info/warn CSS variables; fwlive falls back to local colors (air-gapped, no " "info/warn CSS variables; fwlive falls back to local colors (air-gapped, no "
@@ -368,7 +368,7 @@ msgid ""
"release, then reload the firewall." "release, then reload the firewall."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1657 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1695
msgid "Installation is incomplete. Reinstall luci-app-fwlive." msgid "Installation is incomplete. Reinstall luci-app-fwlive."
msgstr "" msgstr ""
@@ -377,7 +377,7 @@ msgstr ""
msgid "Interface" msgid "Interface"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2684 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2723
msgid "Interface (prefix ! to exclude)" msgid "Interface (prefix ! to exclude)"
msgstr "" msgstr ""
@@ -394,11 +394,11 @@ msgstr ""
msgid "Len" msgid "Len"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2317 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2356
msgid "Limit" msgid "Limit"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:776 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:777
msgid "Live view may be incomplete — a legacy iptables table is registered" msgid "Live view may be incomplete — a legacy iptables table is registered"
msgstr "" msgstr ""
@@ -406,16 +406,16 @@ msgstr ""
msgid "Logging is off on this router" msgid "Logging is off on this router"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1414 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1417
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1475 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1478
msgid "Manual" msgid "Manual"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2346 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2385
msgid "Manual still uses server protection and poll cadence" msgid "Manual still uses server protection and poll cadence"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2415 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2454
msgid "" msgid ""
"Manual still uses server protection and poll cadence; it changes the fetch " "Manual still uses server protection and poll cadence; it changes the fetch "
"budget, not the polling interval." "budget, not the polling interval."
@@ -425,18 +425,18 @@ msgstr ""
msgid "Manual test (System → Terminal):" msgid "Manual test (System → Terminal):"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2340 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2379
msgid "Maximum raw lines" msgid "Maximum raw lines"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:51 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:51
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:344 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:344
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2569 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2608
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2576 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2615
msgid "Message" msgid "Message"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2679 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2718
msgid "More filters" msgid "More filters"
msgstr "" msgstr ""
@@ -453,8 +453,8 @@ msgstr ""
msgid "No WAN zone found" msgid "No WAN zone found"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:886 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:887
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:929 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:930
msgid "No WAN zone found; cannot toggle logging without one." msgid "No WAN zone found; cannot toggle logging without one."
msgstr "" msgstr ""
@@ -470,7 +470,7 @@ msgstr ""
msgid "OUT" msgid "OUT"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2599 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2638
msgid "One line" msgid "One line"
msgstr "" msgstr ""
@@ -497,16 +497,16 @@ msgstr ""
msgid "Outbound" msgid "Outbound"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2367 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2406
msgid "Palette" msgid "Palette"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1706 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1744
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2523 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2562
msgid "Pause" msgid "Pause"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1705 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1743
msgid "Paused" msgid "Paused"
msgstr "" msgstr ""
@@ -515,11 +515,11 @@ msgstr ""
msgid "Proto" msgid "Proto"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2660 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2699
msgid "Protocol — common values" msgid "Protocol — common values"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2639 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2678
msgid "Quick search" msgid "Quick search"
msgstr "" msgstr ""
@@ -527,22 +527,22 @@ msgstr ""
msgid "Remove filter" msgid "Remove filter"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1706 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1744
msgid "Resume" msgid "Resume"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2357 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2396
msgid "Row tint" msgid "Row tint"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2451 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2490
msgid "" msgid ""
"Row tint shows pass/deny row backgrounds when checked. Choose Classic (green/" "Row tint shows pass/deny row backgrounds when checked. Choose Classic (green/"
"red, default) or Accessible (teal/orange). Action text stays colored either " "red, default) or Accessible (teal/orange). Action text stays colored either "
"way." "way."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2507 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2546
msgid "" msgid ""
"Row tint used a local color fallback because the active LuCI theme did not " "Row tint used a local color fallback because the active LuCI theme did not "
"apply pass/deny backgrounds." "apply pass/deny backgrounds."
@@ -552,15 +552,15 @@ msgstr ""
msgid "Rule" msgid "Rule"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:767 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:768
msgid "Rule labels incomplete — map truncated" msgid "Rule labels incomplete — map truncated"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:770 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:771
msgid "Rule labels unavailable" msgid "Rule labels unavailable"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:769 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:770
msgid "Rule labels unavailable — temp file failed" msgid "Rule labels unavailable — temp file failed"
msgstr "" msgstr ""
@@ -572,40 +572,40 @@ msgstr ""
msgid "Search" msgid "Search"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1443 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1446
msgid "Server adaptive protection is disabled." msgid "Server adaptive protection is disabled."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1441 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1444
msgid "Server protection state is unknown." msgid "Server protection state is unknown."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1448 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1451
msgid "Server shedding — at most %d log lines per poll." msgid "Server shedding — at most %d log lines per poll."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1450 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1453
msgid "Server truncated this poll (adaptive cap)." msgid "Server truncated this poll (adaptive cap)."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2384 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2423
msgid "Show hostnames" msgid "Show hostnames"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2355 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2394
msgid "Show pass/deny row background colors" msgid "Show pass/deny row background colors"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1552 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1555
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2622 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2661
msgid "Show rows" msgid "Show rows"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1509 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1512
msgid "Showing a compact summary of the top of the shown sample." msgid "Showing a compact summary of the top of the shown sample."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2546 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2585
msgid "Simple" msgid "Simple"
msgstr "" msgstr ""
@@ -614,7 +614,7 @@ msgstr ""
msgid "Source" msgid "Source"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2689 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2728
msgid "Source IP contains (! to exclude)" msgid "Source IP contains (! to exclude)"
msgstr "" msgstr ""
@@ -622,53 +622,53 @@ msgstr ""
msgid "Source port" msgid "Source port"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2694 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2733
msgid "Source port (! to exclude)" msgid "Source port (! to exclude)"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1511 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1514
msgid "Summary data is unavailable; show rows to inspect the sample." msgid "Summary data is unavailable; show rows to inspect the sample."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2613 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2652
msgid "Summary mode" msgid "Summary mode"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1513 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1516
msgid "Summary was bounded before all categories could be included." msgid "Summary was bounded before all categories could be included."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2425 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2464
msgid "" msgid ""
"Switching tabs pauses polling; returning performs one catch-up poll. " "Switching tabs pauses polling; returning performs one catch-up poll. "
"Hostnames are off by default because lookups add work." "Hostnames are off by default because lookups add work."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:894 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:895
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:935 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:936
msgid "The firewall did not reload; saved and live logging may differ." msgid "The firewall did not reload; saved and live logging may differ."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2435 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2474
msgid "" msgid ""
"The rate shown for WAN logging is the firewall zone log_limit. OpenWrt " "The rate shown for WAN logging is the firewall zone log_limit. OpenWrt "
"defaults to 10/minute when no explicit limit is configured; fwlive does not " "defaults to 10/minute when no explicit limit is configured; fwlive does not "
"impose this cap." "impose this cap."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2430 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2469
msgid "" msgid ""
"The router log ring may evict older events before fwlive reads them. fwlive " "The router log ring may evict older events before fwlive reads them. fwlive "
"cannot recover evicted entries or change forwarding behavior." "cannot recover evicted entries or change forwarding behavior."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2397 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2436
msgid "" msgid ""
"The table updates automatically when your firewall logs traffic. Use Pause " "The table updates automatically when your firewall logs traffic. Use Pause "
"if it moves too fast." "if it moves too fast."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2510 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2549
msgid "Theme tint fallback" msgid "Theme tint fallback"
msgstr "" msgstr ""
@@ -685,15 +685,15 @@ msgstr ""
msgid "Time" msgid "Time"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1518 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1521
msgid "Top drops" msgid "Top drops"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1521 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1524
msgid "Top rules" msgid "Top rules"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1515 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1518
msgid "Top talkers" msgid "Top talkers"
msgstr "" msgstr ""
@@ -716,16 +716,16 @@ msgstr ""
msgid "Undo:" msgid "Undo:"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2454 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2493
msgid "Use Detail for all columns (flags, length, raw message)." msgid "Use Detail for all columns (flags, length, raw message)."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2528 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2567
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2534 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2573
msgid "View" msgid "View"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:948 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:949
msgid "WAN drop/reject logging is off." msgid "WAN drop/reject logging is off."
msgstr "" msgstr ""
@@ -735,13 +735,13 @@ msgid ""
"here. Normal LAN browsing will not." "here. Normal LAN browsing will not."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:910 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:911
msgid "" msgid ""
"WAN drop/reject logging is on. Blocked inbound traffic should appear here as " "WAN drop/reject logging is on. Blocked inbound traffic should appear here as "
"it happens — not normal LAN browsing." "it happens — not normal LAN browsing."
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:912 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:913
msgid "WAN logging is already enabled." msgid "WAN logging is already enabled."
msgstr "" msgstr ""
@@ -770,25 +770,25 @@ msgstr ""
msgid "Waiting for firewall events" msgid "Waiting for firewall events"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1705 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1743
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2498 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2537
msgid "Watching" msgid "Watching"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2588 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2627
msgid "Wrap" msgid "Wrap"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:71 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:71
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2644 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2683
msgid "block" msgid "block"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1263 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1266
msgid "buffer filling" msgid "buffer filling"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1267 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1270
msgid "buffer full" msgid "buffer full"
msgstr "" msgstr ""
@@ -805,7 +805,7 @@ msgid "does not contain"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:72 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:72
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2645 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2684
msgid "drop" msgid "drop"
msgstr "" msgstr ""
@@ -813,16 +813,16 @@ msgstr ""
msgid "is" msgid "is"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1262 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1265
msgid "loading buffer" msgid "loading buffer"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1637 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1674
msgid "loading…" msgid "loading…"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1491 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1494
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1500 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1503
msgid "none" msgid "none"
msgstr "" msgstr ""
@@ -830,98 +830,98 @@ msgstr ""
msgid "not" msgid "not"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1848 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1886
msgid "not AH" msgid "not AH"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1847 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1885
msgid "not ESP" msgid "not ESP"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1846 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1884
msgid "not GRE" msgid "not GRE"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1843 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1881
msgid "not ICMP" msgid "not ICMP"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1844 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1882
msgid "not ICMPv6" msgid "not ICMPv6"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1845 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1883
msgid "not IGMP" msgid "not IGMP"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1849 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1887
msgid "not SCTP" msgid "not SCTP"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1841 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1879
msgid "not TCP" msgid "not TCP"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1842 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1880
msgid "not UDP" msgid "not UDP"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2650 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2689
msgid "not block" msgid "not block"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2649 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2688
msgid "not drop" msgid "not drop"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2648 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2687
msgid "not pass" msgid "not pass"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2651 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2690
msgid "not reject" msgid "not reject"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2652 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2691
msgid "not unknown" msgid "not unknown"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2667 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2706
msgid "or type…" msgid "or type…"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:70 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:70
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2643 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2682
msgid "pass" msgid "pass"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:73 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:73
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2646 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2685
msgid "reject" msgid "reject"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1269 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1272
msgid "render paused (high rate)" msgid "render paused (high rate)"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1278 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1281
msgid "resolve paused (load)" msgid "resolve paused (load)"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1280 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1283
msgid "scroll frozen — scroll to top to follow live" msgid "scroll frozen — scroll to top to follow live"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1277 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:1280
msgid "truncated" msgid "truncated"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:62 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/table.js:62
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2647 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:2686
msgid "unknown" msgid "unknown"
msgstr "" msgstr ""
#: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:751 #: openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js:752
msgid "using fw4" msgid "using fw4"
msgstr "" msgstr ""
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -23,7 +23,7 @@ LUCI_DEPENDS:= \
PKG_NAME:=luci-app-homeproxy-pro PKG_NAME:=luci-app-homeproxy-pro
PKG_VERSION:=28.9.1.14 PKG_VERSION:=28.9.1.14
PKG_RELEASE:=9 PKG_RELEASE:=10
# Only files the package actually ships belong here. The previous list named # Only files the package actually ships belong here. The previous list named
# four paths that exist nowhere in the tree - certs/ and ruleset/ are created at # four paths that exist nowhere in the tree - certs/ and ruleset/ are created at
-32
View File
@@ -74,38 +74,6 @@
**一句话总结**:pro 的核心价值是**把"单文件能跑"变成"orchestrator + table-driven adapter + 可独立测试的模块"**,并把约束、质量、回滚三件事从靠人盯变成靠代码执行(arch-guard 135 checks 静态锁住跨文件不变量)。 **一句话总结**:pro 的核心价值是**把"单文件能跑"变成"orchestrator + table-driven adapter + 可独立测试的模块"**,并把约束、质量、回滚三件事从靠人盯变成靠代码执行(arch-guard 135 checks 静态锁住跨文件不变量)。
## 排障要点
两条会把人带偏的坑,都是实测踩出来的,写在这里省得下一个人重走一遍。
**1. 客户端的 `sing-box-c.log` 里会出现"不是本机做出的决定"**
代理节点侧的失败会用同样的措辞落进客户端日志。例如目的 IP 的 443 没有服务:
```
ERROR connection: open connection to 1.2.3.4:443 using outbound/direct[direct]:
dial tcp 1.2.3.4:443: connect: connection refused
```
这行**不代表**本机把该流量送去了直连——它可能是远端节点直连目标失败后的回传。曾据此误判"分流规则失效",实际是节点侧错误被记进了客户端日志。
判定真实走向要看**转发层**,不要看日志措辞:
```sh
# 被重定向到本机代理端口 = 流量确实进入了代理路径
grep -m1 'dst=<IP>.*dport=443' /proc/net/nf_conntrack # 回复方向出现 sport=5331
# 分流链各分支计数:return 的分支=直连,最后 goto=走代理
nft list chain inet fw4 homeproxy_redirect
# 大陆集合:防火墙据此判定"直连",与路由侧的 china-ip 规则集同源(china_ip4.txt)
nft list chain inet fw4 homeproxy_redirect | grep mainland_addr_v4
```
**2. `sing-box tools connect/fetch` 不能用来验证分流**
两者都通过 `instance.Outbound().Default()` 取默认出站(`cmd_tools_connect.go` / `cmd_tools_fetch.go`),**不经过 route 规则**。用它们测"某个域名/IP 会走代理还是直连",得到的结论一定是错的。
要验证实际走向,只能让**局域网真实客户端**发起连接,再看上面的 conntrack / nft 计数,或看 `sing-box-c.log` 里的 `outbound/xxx[tag]` 行(那才是本机的出站选择)。
## 已知限制 ## 已知限制
- **试验性**:不承诺 API/配置稳定,重大变更可能在 minor 版本里发生。 - **试验性**:不承诺 API/配置稳定,重大变更可能在 minor 版本里发生。
+1 -1
View File
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-honk PKG_NAME:=luci-app-honk
PKG_VERSION:=1.1.4 PKG_VERSION:=1.1.4
PKG_RELEASE:=8 PKG_RELEASE:=9
LUCI_TITLE:=LuCI support for honk LUCI_TITLE:=LuCI support for honk
LUCI_PKGARCH:=all LUCI_PKGARCH:=all
File diff suppressed because it is too large. Load diff
@@ -1 +0,0 @@
import{j as s}from"./vendor-react-Bf71BWbF.js";import{u as o,eb as c,ec as p,ed as x,ee as m,B as u}from"./index-BNBwb-FJ.js";const r=({action:n})=>s.jsxs(u,{isDisabled:n.isDisabled,isPending:n.isPending,onPress:n.onAction,children:[n.icon,n.label]});function h({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{h as A};
@@ -0,0 +1 @@
import{j as e}from"./vendor-react-Bf71BWbF.js";import{u as c,ec as o,eW as x,B as p,ed as u,ee as m,eX as d,c as j}from"./index-Bw0aJc9a.js";const a=({action:n})=>e.jsxs(p,{isDisabled:n.isDisabled,isPending:n.isPending,tip:n.reason,onPress:n.onAction,children:[n.icon,n.label]});function $({actions:n,overflowMode:i="collapse"}){if(i==="wrap")return e.jsx(e.Fragment,{children:n.map(l=>e.jsx(a,{action:l},l.id))});const[s,...r]=n;return s?e.jsxs(e.Fragment,{children:[e.jsx(a,{action:s}),r.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"rp-wide-only",children:r.map(l=>e.jsx(a,{action:l},l.id))}),e.jsx("span",{className:"rp-narrow-only",children:e.jsx(b,{actions:r})})]})]}):null}function f({actions:n,label:i}){return e.jsx(u,{"aria-label":i,disabledKeys:n.filter(s=>s.isDisabled||s.isPending).map(s=>s.id),onAction:s=>n.find(r=>r.id===s)?.onAction(),children:n.map(s=>e.jsx(m,{id:s.id,className:j("rp-item plain",s.negative&&"negative"),textValue:s.label,children:e.jsxs("span",{className:"rp-item-text",children:[e.jsx(d,{slot:"label",children:s.label}),s.isDisabled&&s.reason&&e.jsx(d,{slot:"description",className:"desc reason",children:s.reason})]})},s.id))})}function b({actions:n,label:i,small:s,quiet:r}){const l=c(),t=i??l("ui.moreActions");return n.length===0?null:e.jsx(o,{chevron:!1,small:s,quiet:r,label:t,content:e.jsx(f,{actions:n,label:t}),children:e.jsx(x,{})})}export{$ as A,b as M};
@@ -1 +1 @@
import{j as r}from"./vendor-react-Bf71BWbF.js";import{c as t}from"./index-BNBwb-FJ.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}; import{j as r}from"./vendor-react-Bf71BWbF.js";import{c as t}from"./index-Bw0aJc9a.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 +1 @@
import{r as u,j as a}from"./vendor-react-Bf71BWbF.js";import{u as ct,aE as it,eQ as rt,eR as ut}from"./index-BNBwb-FJ.js";import{u as ht,e as dt,v as q,C as xt,f as pt,n as ft,g as H}from"./layout-wfdMYi2n.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},F=[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=F.find(c=>e/c<=6)??F[F.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 J(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(),N=u.useId(),[Y,E]=rt(Math.round,120),{tip:Z,showAt:_,hide:L}=ht(),[z,A]=u.useState(null),i=z&&z.index<e.length?z.index:null,B=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:B<180*1e3,I=p?p.step>=864e5:B>2160*60*1e3,R=u.useMemo(()=>new Intl.DateTimeFormat(h,I?{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,I]),{yDomain:G,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]),K=u.useMemo(()=>M!==void 0&&g!==void 0?[M,g]:[Math.min(...e),Math.max(...e)],[M,g,e]),k=E?.width??0,S=E?.height??y,m=S-30,v=k-64,tt=[Math.min(K[0],...e),Math.max(K[1],...e)],f=t=>H(t,tt,[20,v]),T=t=>H(t,G,[m,8]),et={x:20,y:8,width:v-20,height:m-8},O=(t,n)=>A({index:t,y:n}),W=()=>{A(null),L()};u.useLayoutEffect(()=>{if(i===null){L();return}if(!o.some(t=>t.values[i]!=null)){L();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,O,W),Q=u.useMemo(()=>P.map(t=>R.format(t)),[P,R]),nt=u.useMemo(()=>j.map(s),[j,s]),ot=J(Q),st=J(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&&E&&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);O(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:N+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,G[0])),color:t.color,id:N+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:Q[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}; import{r as u,j as a}from"./vendor-react-Bf71BWbF.js";import{u as ct,aI as it,fx as rt,fy as ut}from"./index-Bw0aJc9a.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-BWzq8YqC.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},I=[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=I.find(c=>e/c<=6)??I[I.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(),N=u.useId(),[Y,E]=rt(Math.round,120),{tip:Z,showAt:_,hide:F}=ht(),[z,$]=u.useState(null),i=z&&z.index<e.length?z.index:null,A=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:A<180*1e3,B=p?p.step>=864e5:A>2160*60*1e3,G=u.useMemo(()=>new Intl.DateTimeFormat(h,B?{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,B]),{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=E?.width??0,S=E?.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)=>$({index:t,y:n}),W=()=>{$(null),F()};u.useLayoutEffect(()=>{if(i===null){F();return}if(!o.some(t=>t.values[i]!=null)){F();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=>X("ui.valuePair",{label:t.label,value:s(t.values[i])}))})});const L=dt(e.length,R,W),V=u.useMemo(()=>P.map(t=>G.format(t)),[P,G]),nt=u.useMemo(()=>j.map(s),[j,s]),ot=Q(V),st=Q(nt),at=p?H(P.map(f),ot.map(t=>t.width),0,k,16,!0):P.map((t,n)=>({index:n,position:f(t)})),q=H(j.map(T),st.map(t=>t.height),0,S,5,!1),lt=[...new Set([...q.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:L.onPointerLeave,children:e.length>0&&E&&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:L.onFocus,onBlur:L.onBlur,onKeyDown:L.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:N+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:N+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:V[t]})},t))}),a.jsx("g",{className:"rp-area-y-ticks",children:q.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};
@@ -1,4 +0,0 @@
import{r as x,$ as _,a as St,j as f}from"./vendor-react-Bf71BWbF.js";import{eD as Pt,eW as Bt,ex as ae,bX as H,bV as M,eX as Qe,eY as et,eZ as It,bP as Re,eu as F,ev as re,ew as Be,eg as N,eJ as tt,e_ as At,e$ as Ot,f0 as Mt,bM as jt,bY as Nt,c3 as Rt,f1 as Lt,c5 as Vt,c6 as Ht,bK as Gt,eB as zt,c8 as Xt,bH as Yt,ca as Ut,cc as qt,c9 as _t,f2 as Wt,f3 as Jt,bI as ke,aM as Zt,eN as Qt,eK as er,bU as tr,f4 as rt,f5 as nt,f6 as oe,bJ as rr,bF as at,ef as nr,c as Ie,K as Ke,f7 as Le,di as ot,f8 as Ve,f9 as He,dn as it,u as W,a8 as ar,ab as or,aa as Ge,ad as ir,cE as lr,dK as sr,b as ur,be as ze,E as dr,j as cr,I as Q,ai as lt,B as L,de as Xe,af as st,T as ut,a as dt,aK as Ye,aF as pr,bB as fr,a2 as de,L as gr,h as yr,bC as mr,aJ as hr,b4 as Dr,eO as br,eP as $r,fa as vr,aH as Er,bn as xr,ah as ct,cK as wr}from"./index-BNBwb-FJ.js";import{$ as Tr,a as kr}from"./Policies-DiLR7S4N.js";import{d as Kr}from"./Virtualizer-DipGMcji.js";import{$ as Cr}from"./ListLayout-F74Z1Dpf.js";import{D as pt}from"./DaeCode-B8yPDjSE.js";import{b as Fr,g as Sr}from"./policyText-CmeXgUK2.js";import{P as Pr}from"./PolicyPicker-BmHzmXzJ.js";import{$ as Br}from"./useFilter-jz02VVEB.js";import"./useGridSelectionCheckbox-CrCOlZv8.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 U(e){B.dropCollectionRef=e}function vt(){B={draggingKeys:new Set}}function Hr(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 Gr(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 Xr(){return!!R}function Yr(){R=null;for(let e of me)e()}const Ue=["pointerdown","pointermove","pointerenter","pointerleave","pointerover","pointerout","pointerup","mousedown","mousemove","mouseenter","mouseleave","mouseover","mouseout","mouseup","touchstart","touchmove","touchend","focusin","focusout"],Ur=["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 Ue)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 Ue)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:G,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:Y,canApply:c.length>0&&l.emptyNew.length===0&&!S&&!h,applyNote:Kn(S?t(S):null,l.emptyNew,t),apply:Z}}function Yn({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(Ye,{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(Ye,{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
@@ -0,0 +1,4 @@
import{r as E,$ as W,a as Pt,j as f}from"./vendor-react-Bf71BWbF.js";import{fk as Bt,fE as It,fe as ie,ca as H,c8 as M,fF as et,fG as tt,fH as At,c2 as Le,fb as S,fc as ae,fd as Ie,eZ as R,fq as rt,fI as Ot,fJ as Mt,fK as jt,b$ as Nt,cb as Rt,ci as Lt,fL as Vt,ck as Gt,cl as Ht,bZ as zt,fi as Yt,cn as Ut,bW as Xt,cp as qt,cr as _t,co as Wt,fM as Jt,fN as Zt,bX as Ke,aQ as Qt,fu as er,fr as tr,c7 as rr,fO as nt,fP as at,fQ as le,bY as nr,bU as ot,eY as ar,c as Ae,M as Ce,dR as Ve,dY as it,fR as Ge,fS as He,e6 as lt,u as J,aa as or,ad as ir,ac as ze,af as lr,cS as sr,et as ur,b as dr,bm as Ye,E as cr,j as pr,I as te,ak as st,B as V,dT as Ue,ah as ut,T as dt,a as ct,aO as Xe,aJ as fr,bQ as gr,a3 as pe,L as yr,h as mr,bR as hr,aN as Dr,bs as br,fv as $r,fw as vr,fT as Er,aL as xr,br as wr,aj as pt,cY as Tr}from"./index-Bw0aJc9a.js";import{$ as kr,a as Kr}from"./Policies-Dgwc4tfn.js";import{d as Cr}from"./Virtualizer-DCY9HC9Z.js";import{$ as Sr}from"./ListLayout-_fDlx5XY.js";import{D as ft}from"./DaeCode-B8yPDjSE.js";import{b as Fr,g as Pr}from"./policyText-CltaDVEo.js";import{P as Br}from"./openGroup-Dk9B33qx.js";import{$ as Ir}from"./useFilter-Tjznm3lB.js";import"./ActionGroup-DLxTuKht.js";import"./useGridSelectionCheckbox-COXIVEmS.js";import"./nav-BASDWt23.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 gt={...P,copyMove:3,copyLink:6,linkMove:5,all:7,uninitialized:7},yt=mt(gt);yt[7]="all";const re={none:"cancel",link:"link",copy:"copy",move:"move"},be=mt(re);function mt(e){let t={};for(let r in e)t[e[r]]=r;return t}const Ar=new Set(["text/plain","text/uri-list","text/html"]),ye="application/vnd.react-aria.items+json",me="application/octet-stream",Oe=new WeakMap,ht=Symbol();function Or(e){let{id:t}=Oe.get(e)||{};if(!t)throw new Error("Droppable item outside a droppable collection");return t}function Mr(e){let{ref:t}=Oe.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 Dt(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 Me(){return Dt(Bt())}function bt(){return Dt(It())}function Se(e,t){let r=new Map,n=!1,a=[];for(let o of t){let g=Object.keys(o);g.length>1&&(n=!0);let c={};for(let y of g){let $=r.get(y);$?n=!0:($=[],r.set(y,$));let m=o[y];c[y]=m,$.push(m)}a.push(c)}for(let[o,g]of r)if(Ar.has(o)){let c=g.join(`
`);e.items.add(c,o)}else e.items.add(g[0],o);if(n){let o=JSON.stringify(a);e.items.add(o,ye)}}class se{constructor(t){this.types=new Set;let r=!1;for(let n of t.items)n.type!==ye&&(n.kind==="file"&&(r=!0),n.type?this.types.add(n.type):this.types.add(me));this.includesUnknownTypes=!r&&t.types.includes("Files")}has(t){if(Array.isArray(t))return t.some(r=>this.has(r));if(this.includesUnknownTypes||t===ht&&this.types.has(me)||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 $t(e){let t=[];if(!e)return t;let r=!1;if(e.types.includes(ye))try{let n=e.getData(ye),a=JSON.parse(n);for(let o of a)t.push({kind:"text",types:new Set(Object.keys(o)),getText:g=>Promise.resolve(o[g])});r=!0}catch{}if(!r){let n=new Map;for(let a of e.items)if(a.kind==="string")n.set(a.type||me,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(vt(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 jr(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||me,name:e.name,getText:()=>jr(e),getFile:()=>Promise.resolve(e)}}function vt(e){return{kind:"directory",name:e.name,getEntries:()=>Nr(e)}}async function*Nr(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 Rr(n);yield Fe(a)}else n.isDirectory&&(yield vt(n))}while(r.length>0)}function Rr(e){return new Promise((t,r)=>e.file(t,r))}function Lr(e){return e.kind==="text"}let B={draggingKeys:new Set};function Vr(e){B.draggingCollectionRef=e}function Gr(e){B.draggingKeys=e}function q(e){B.dropCollectionRef=e}function Et(){B={draggingKeys:new Set}}function Hr(e){B=e}function G(e){let{draggingCollectionRef:t,dropCollectionRef:r}=B;return t?.current!=null&&t.current===(e?.current||r?.current)}let fe;function he(e){fe=e}let Pe=P.none;function $e(e){Pe=e}let Be=new Map,ne=new Map,L=null,De=new Set;function xt(e){return Be.set(e.element,e),L?.updateValidDropTargets(),()=>{Be.delete(e.element),L?.updateValidDropTargets()}}function zr(e){return ne.set(e.element,e),()=>{ne.delete(e.element)}}function Yr(e,t){if(L)throw new Error("Cannot begin dragging while already dragging");L=new Wr(e,t),requestAnimationFrame(()=>{L&&(L.setup(),bt()==="keyboard"&&L.next())});for(let r of De)r()}function je(){let[e,t]=E.useState(L);return E.useEffect(()=>{let r=()=>t(L);return De.add(r),()=>{De.delete(r)}},[]),e}function Ur(){return!!L}function Xr(){L=null;for(let e of De)e()}const qe=["pointerdown","pointermove","pointerenter","pointerleave","pointerover","pointerout","pointerup","mousedown","mousemove","mouseenter","mouseleave","mouseover","mouseout","mouseup","touchstart","touchmove","touchend","focusin","focusout"],qr=["pointerup","mouseup","touchend"],_r={keyboard:"dragStartedKeyboard",touch:"dragStartedTouch",virtual:"dragStartedVirtual"};class Wr{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 qe)document.addEventListener(t,this.cancelEvent,!0);this.mutationObserver=new MutationObserver(()=>this.updateValidDropTargets()),this.updateValidDropTargets(),ie(this.stringFormatter.format(_r[bt()]))}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 qe)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
`),O=new Set(y.map(A=>A.group));return Ce(d.stagedText).filter(A=>O.has(A.name)).map(A=>({group:A.name,text:K.slice(A.from,A.to+1).join(`
`)}))},[d.stagedText,y]);return{groups:d.groups,unknown:d.unknown,byGroup:p,subscriptions:s,nodes:i,search:h,setSearch:x,loading:n.loading&&!n.data||o.loading&&!c||g.loading&&!g.data,error:[n,o,g].find(K=>K.error&&!K.data)?.error??(e.main?null:e.error),retry:E.useCallback(()=>void ur(),[]),blocked:I?r(I):null,busy:e.busy||w,applying:w,failure:C,changes:y,changeLines:y.map(K=>Fn(K,l,r)),pendingText:r("arrange.pending",{n:y.length}),place:N,unplace:Y,drop:K=>j(O=>Pn(O,K)),discard:()=>j(()=>[]),nameProblem:Q,create:(K,O)=>j(A=>ke(A,{kind:"createGroup",group:K,policy:O})),reviewing:u&&y.length>0,setReviewing:K=>{w||D(K)},preview:X,canApply:y.length>0&&d.emptyNew.length===0&&!I&&!w,applyNote:Cn(I?r(I):null,d.emptyNew,r),apply:U}}function _n({source:e,groups:t,viewGroup:r}){const n=J(),a=Bn(e,r),o=E.useMemo(()=>new Map((t??[]).map(g=>[g.name,g])),[t]);return a.error?f.jsx(cr,{error:a.error,onRetry:a.retry}):a.loading?f.jsx(pr,{}):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(On,{m:a})]}),a.blocked&&f.jsx(te,{tone:"informative",children:a.blocked}),f.jsxs("div",{className:"rp-arrange-grid",children:[f.jsx("div",{className:"rp-col",children:a.groups.length?a.groups.map(g=>f.jsx(In,{group:g,live:o.get(g.name),m:a},g.name)):f.jsx(st,{children:n("policy.empty")})}),f.jsx(An,{m:a})]}),a.changes.length>0&&f.jsxs(xn,{label:n("arrange.pendingRegion"),message:a.pendingText,children:[f.jsx(V,{quiet:!0,onPress:a.discard,isDisabled:a.busy,children:n("arrange.discard")}),f.jsx(V,{accent:!0,onPress:()=>a.setReviewing(!0),children:n("arrange.review")})]}),f.jsx(Mn,{m:a})]})}function In({group:e,live:t,m:r}){const n=J(),a=ct(),o=E.useId(),g=!!r.blocked,c=t?Pr(t.policy,n):null,y=async v=>{const l=await Promise.all(v.filter(Lr).filter(d=>d.types.has(ge)).map(d=>d.getText(ge)));r.place(e.name,l.flatMap(d=>Sn(d)??[]))},$=(v,l,d)=>f.jsx(V,{quiet:!0,icon:!0,small:!0,label:n("arrange.remove",{name:v,group:e.name}),isDisabled:g||r.applying||!!d,onPress:()=>r.unplace(e.name,l),children:f.jsx(pt,{})}),m=(v,l)=>f.jsx(V,{quiet:!0,small:!0,label:n("arrange.undoRemove",{name:v}),isDisabled:r.applying,onPress:()=>r.place(e.name,[l]),children:n("arrange.undoShort")});return f.jsx(an,{className:hr("rp-drop"),"aria-label":n("arrange.dropInto",{group:e.name}),isDisabled:g||r.applying,getDropOperation:v=>v.has(ge)?"copy":"cancel",onDrop:v=>void y(v.items),children:({isDropTarget:v})=>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(fr,{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(gr,{reason:Kn(e,g||r.applying),children:[(e.names.length>0||e.removedNames.length>0)&&f.jsxs(Ze,{label:n("arrange.byName"),children:[f.jsx("span",{className:"rp-label rp-tags-title",children:n("arrange.byName")}),e.names.map(l=>f.jsx(ce,{tone:l.isNew?"new":void 0,action:$(l.name,{kind:"node",value:l.name},l.blocked),children:l.name},l.name)),e.removedNames.map(l=>f.jsx(ce,{tone:"removed",action:m(l,{kind:"node",value:l}),children:l},l))]}),(e.subscriptions.length>0||e.removedSubscriptions.length>0)&&f.jsxs(Ze,{label:n("arrange.bySubscription"),children:[f.jsx("span",{className:"rp-label rp-tags-title",children:n("arrange.bySubscription")}),e.subscriptions.map(l=>f.jsx(ce,{tone:l.isNew?"new":void 0,action:$(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(ce,{tone:"removed",action:m(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(ft,{as:"code",text:l},l)),e.ruleNodes.length>0&&f.jsx("span",{children:e.ruleMore?n("arrange.ruleSelectsMore",{names:pe(a,e.ruleNodes),n:e.ruleMore}):n("arrange.ruleSelects",{names:pe(a,e.ruleNodes)})}),f.jsxs("span",{className:"rp-label",children:[e.ruleNote," ",f.jsx(yr,{appearance:"link",href:mr("config",{tab:"source"}),children:n("arrange.editSource")})]})]}),e.stillIn.length>0&&f.jsx(te,{tone:"informative",children:n("arrange.stillIn",{names:pe(a,e.stillIn)})}),v&&f.jsx("div",{className:"rp-drop-hint","aria-hidden":"true",children:n("arrange.dropHint")})]})})}function An({m:e}){const t=J(),r=E.useId(),n=!!e.blocked||e.applying,[a,o]=E.useState("all"),[g,c]=E.useState(new Set),y=E.useMemo(()=>[...a==="node"?[]:e.subscriptions.map(d=>({id:"subscription: Line truncated
@@ -0,0 +1,4 @@
import{r as b,j as o}from"./vendor-react-Bf71BWbF.js";import{a4 as Oe,aw as Ae,av as sn,e4 as tn,d9 as Y,e5 as de,a5 as je,dX as He,e6 as on,a3 as $e,y as _e,h as I,Q as re,O as rn,e7 as an,df as Be,u as F,a6 as ne,a as se,aa as ln,ag as cn,ac as Se,cP as ue,aF as Ie,ap as Ve,bk as dn,bj as un,A as fn,e8 as pn,bm as $,de as Ke,a0 as ae,bg as Z,cS as fe,e9 as We,ea as gn,D as mn,eb as bn,C as hn,B as T,ec as vn,ed as xn,ee as wn,I as ce,aN as pe,bQ as ee,aO as ge,L as Ue,aJ as B,ef as yn,eg as jn,eh as Sn,ei as kn,cR as Nn,ej as Dn,J as Cn,ek as Mn,b as Pn,ah as Rn,bt as me,T as K,bS as Tn,bs as En,aL as Ge,el as zn,bq as Ln,aj as Fn,em as On,aM as An,E as Hn,j as $n,aK as _n,bx as Bn}from"./index-Bw0aJc9a.js";import{d as In}from"./files-BxEOxSF8.js";import{r as Vn,d as Kn,a as Wn,t as ke,b as Un,w as Ne,v as Gn,c as qn,n as Jn}from"./setup-DLvQ_6ZI.js";import{g as Qn}from"./policyText-CltaDVEo.js";import{a as Xn,s as Yn,c as Zn}from"./nav-BFiTWnsa.js";import{S as es,a as ns,E as _,C as te,b as be,l as ss,h as ts,c as De,r as os,d as rs,e as as,f as is,i as ls,g as cs,s as ds,k as us,t as qe,j as Ce,m as fs,n as ps,o as gs,p as ms,q as bs,u as hs,v as vs,w as xs,x as ws,y as Je,D as q,R as ys,z as js,A as Ss,B as ks,F as Ns,G as Ds,H as Qe,I as Cs,J as V,K as Ms}from"./vendor-editor-2EGeBPxF.js";import{d as Ps,s as Rs,D as Xe}from"./DaeCode-B8yPDjSE.js";import{A as Ts}from"./AddCircle-D11CyK2n.js";import{D as Es}from"./Table-Km6Zv-S8.js";import"./useGridSelectionCheckbox-COXIVEmS.js";import"./Virtualizer-DCY9HC9Z.js";import"./ListLayout-_fDlx5XY.js";const zs=["global","subscription","node","group","dns","routing"],Ls=(s,t,e)=>s?e("config.moduleEditBlocked"):t?e("ui.changeApplying"):void 0;function Me(s,t){return`${Y(s)}:${t.line+1}-${t.endLine+1}`}function Fs(s,t,e){return s.slice(0,t.from)+e+s.slice(t.to)}function Os(s,t){const{section:e,text:n}=s,a=t.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 As(s,t,e,n,a){const r=e.line+n.split(`
`).length;return s.filter(l=>l.source_id===t&&l.line!==null&&l.line>e.line&&l.line<=r).map(l=>({line:l.line-e.line,column:l.column,level:l.level,message:he(de(l,a),a)}))}function Hs(s,t,e){return s.filter(n=>n.source_id===t&&n.line!==null).map(n=>({line:n.line,column:n.column,level:n.level,message:he(de(n,e),e)}))}function he({summary:s,detail:t},e,n=s){return t?e("config.backendDetail",{text:n,message:t}):n}function ie(s,t,e){return e.filter(n=>n.from>t.open&&n.to<=t.close&&n.depth===t.depth+1&&n.parens===0&&n.kind==="text"&&s.slice(n.from,n.to)==="->").length}function Pe(s,t,e){const n=t.filter(a=>a.from>s.open&&a.to<=s.close&&a.depth===s.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 $s(s,t,e,n,a,r){const l=re(t,e,n);switch(s){case"global":return r("config.moduleSettings",{n:l.length});case"subscription":return r("config.moduleSubscriptions",{n:Pe(e,n,l)});case"node":return r("config.moduleNodes",{n:Pe(e,n,l)});case"group":return r("config.moduleGroups",{n:e.children.length,policies:$e(a,e.children.map(c=>{const f=re(t,c,n).find(p=>p.name==="policy")?.value;if(!f)return c.name;const i=rn(f);return r("ui.valuePair",{label:c.name,value:i?Qn({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,p)=>i+re(t,p,n).length,0)}),r("config.moduleDnsRequests",{n:f.filter(i=>i.name==="request").reduce((i,p)=>i+ie(t,p,n),0)}),r("config.moduleDnsResponses",{n:f.filter(i=>i.name==="response").reduce((i,p)=>i+ie(t,p,n),0)})].join(r("ui.listSeparator"))}case"routing":{const c=r("config.moduleRules",{n:ie(t,e,n)}),f=l.find(i=>i.name==="fallback")?.value;return f?c+r("ui.separator")+r("ui.valuePair",{label:"fallback",value:f}):c}}}const _s={global:null,subscription:I("nodes"),node:I("nodes"),group:I("policies"),dns:I("rules",{tab:"dns"}),routing:I("rules",{tab:"list"})};function Bs(s,t,e,n){const r=s.filter(i=>i.kind==="main"||i.kind==="include").map(i=>({source:i,..._e(i.content)})),l=s.find(i=>i.kind==="main")??null,c=zs.flatMap(i=>{const p=_s[i],g=r.flatMap(({source:u,blocks:v,tokens:N})=>v.filter(x=>x.name===i).map((x,w)=>({id:`${u.id}:${i}:${w}`,kind:i,source:u,block:x,href:p,range:Me(u,x),summary:$s(i,u.content,x,N,e,n),note:null})));return g.length?g:[{id:i,kind:i,source:l,block:null,href:p,range:l?Y(l):"config.dae",summary:l?.writable?n("config.moduleAbsent",{file:Y(l)}):n("config.moduleAbsentReadOnly"),note:null}]}),f=r.flatMap(({source:i,blocks:p})=>t.redactedSections(p).map(({block:g,name:u},v)=>({id:`${i.id}:${g.name}:${v}`,kind:u,source:i,block:null,href:null,range:Me(i,g),summary:"",note:n("config.incomplete")})));return[...c,...f]}function J(s,t,e){const n=Oe(Xn,s.kind,e);return{id:s.id,label:tn(s)?`${n} ${s.id.slice(0,8)}`:s.path,kind:n,facts:e("config.sourceFacts",{n:s.line_count,size:sn(String(s.bytes),t)}),loaded:e("config.loadedAt",{time:Ae(s.loaded_at,t)})}}const Is={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"},redacted:{label:"config.redactedSource",note:"config.redactedNote"}};function Vs(s,t,e,n,a){const r=s.kind==="generated"||s.kind==="subscription"?s.kind:t?s.writable?e===!1?"redacted":null:n.holdsCredentials(s)?"secret":"refused":"disabled";if(!r)return null;const l=Is[r],c=a(l.label);return{reason:r,label:c,note:a(l.note),...l.help&&{help:{title:c,text:a(l.help)}}}}const Ks={error:"err",warning:"warn",info:"info"},Ws={error:"config.level.error",warning:"config.level.warning",info:"config.level.info"};function oe(s,t,e,n){const a=new Map(t.map(l=>[l.id,Y(l)])),r=new Map;for(const l of s){const c=JSON.stringify([l.level,l.source_id,l.line,l.column,l.code,l.message,l.params]),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,p=de(c,n),g=p.summary,u=f>1?n("config.repeated",{text:g,n:je(f,e)}):g,v=he(p,n,u);return{id:l,level:c.level,tone:Ks[c.level],levelText:Oe(Ws,c.level,n),sourceId:c.source_id,line:c.line,where:c.line===null?i:`${i}:${c.line}`,message:u,code:c.code,detail:c.line===null?v:n("config.atFile",{file:i,line:je(c.line,e),message:v}),count:f}})}function le(s){return{...Vn(s),rules:s.trim()?"keep":Kn}}function Us(s,t,e){return t.content_sha256===e.content_sha256?null:s?"conflict":"follow"}function Gs(s,t,e){return{groupUsedText:s.rules==="keep"?null:ke[s.rules].groups.length?e("config.wizardNamedGroups",{names:$e(t,ke[s.rules].groups.map(n=>n.name))}):e("config.wizardGroupUsed",{name:s.group??Un}),rows:s.subscriptions.flatMap((n,a)=>n.raw!==void 0&&!n.raw. Line truncated
}`;v.dispatch({changes:{from:x,to:w,insert:h},selection:{anchor:x+u.label.length+4}})}}));else if(p==="routing"||p==="dns")g=[...rt,...lt];else if(p==="global")g=ot;else if(p==="group")g=/\bpolicy\s*:\s*[\w.-]*$/.test(a)?Re:[...Re.map(u=>({...u,apply:"policy: "+u.label})),{label:"filter",type:"property",apply:"filter: "}];else return null;return{from:e.from,options:g,validFor:/^[\w.-]*$/}}function dt(s){return ns({override:[t=>ct(t,s)]})}function ut(s,t){return t.filter(e=>e.line>=1&&e.line<=s.doc.lines).map(e=>{const n=s.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 ft(s){return s.key==="Backspace"||s.key==="Delete"||s.key==="Enter"?!0:[...s.key].length===1&&!s.ctrlKey&&!s.metaKey}function pt(s){let t=!1;const e=n=>(n.state.readOnly&&s(),!1);return _.domEventHandlers({keydown:(n,a)=>ft(n)&&e(a),paste:(n,a)=>e(a),cut:(n,a)=>e(a),pointerdown:n=>(t=n.pointerType==="touch",!1),click:(n,a)=>t&&e(a)})}const gt=[["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","ui.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"]],Te=s=>be.phrases.of(Object.fromEntries(gt.map(([t,e])=>[t,s(e)]))),mt=_.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:"n Line truncated
@@ -1,4 +0,0 @@
import{r as m,j as o}from"./vendor-react-Bf71BWbF.js";import{a3 as Te,at as ze,as as Xe,dk as Ye,cS as q,aq as Ze,a4 as xe,dl as en,dm as Le,dn as nn,a2 as Fe,y as Oe,h as we,O as oe,N as tn,dp as sn,cW as He,u as F,a5 as ee,a as ne,a8 as on,ae as rn,aa as ye,dq as ce,aB as Ae,dr as _e,bj as an,bi as ln,A as cn,ds as dn,be as A,cV as Be,$ as re,bf as Y,cE as de,dt as Ie,du as un,D as fn,dv as pn,C as gn,I as le,B as R,aJ as ue,bB as Z,aK as fe,L as mn,aF as B,dw as hn,dx as bn,dy as vn,dz as xn,cD as wn,dA as yn,H as jn,dB as kn,b as $e,af as Sn,b5 as pe,T as G,ai as Cn,bD as Dn,b4 as Nn,aH as We,dC as Mn,ah as Pn,dD as En,aI as Rn,E as Tn,j as zn,aG as Ln,br as Fn}from"./index-BNBwb-FJ.js";import{d as On}from"./files-BxEOxSF8.js";import{r as Hn,d as An,a as _n,t as je,b as Bn,w as ke,v as In,c as $n,n as Wn}from"./setup-d2VGFWY1.js";import{g as Vn}from"./policyText-CmeXgUK2.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-B8yPDjSE.js";import{A as St}from"./AddCircle-CIj8X2wL.js";import{D as Ct}from"./Table-DyWJelc_.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";const Dt=["global","subscription","node","group","dns","routing"],Nt=(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 Rt(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 De(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 Tt(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:De(e,n,l)});case"node":return r("config.moduleNodes",{n:De(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 zt(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=Dt.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:Tt(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=Te(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:ze(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"},Ht={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:Te(Ht,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{...Hn(t),rules:t.trim()?"keep":An}}function At(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)?Ne:[...Ne.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,3 +0,0 @@
import{j as s,r as w}from"./vendor-react-Bf71BWbF.js";import{aP as xn,aQ as wn,aR as fe,aS as de,u as X,aE as Je,a5 as ve,a as ye,as as te,aT as ee,aU as vn,aI as $e,aV as yn,aJ as ge,E as je,a4 as ie,aW as jn,aX as _n,Y as ue,$ as re,a1 as kn,a3 as _e,aY as ke,aZ as Xe,a_ as xe,at as Cn,a$ as Nn,b0 as Sn,b1 as Ln,ax as Ae,b2 as Mn,b3 as Ye,aK as we,aH as le,af as An,I as Te,b4 as qe,b5 as ce,B as R,b6 as Tn,b7 as Pn,b8 as Ze,b9 as Rn,a8 as ze,aa as G,ae as Dn,ac as Fn,ba as On,bb as In,bc as Bn,bd as En,be as J,f as Pe,bf as Wn,X as Hn,a9 as Un,bg as Vn,bh as Kn,a0 as Qn,ab as Gn,bi as Jn,bj as en,bk as $n,b as Re,bl as Xn,bm as Yn,A as qn,T as De,bn as me,bo as Zn,bp as zn,bq as et,aF as nt,aG as Fe,br as tt}from"./index-BNBwb-FJ.js";import{F as st}from"./FactStrip-n2q1T87k.js";import{B as ot,r as at}from"./ranked-B09X8uKl.js";import{u as lt,C as it,s as Oe,a as rt,p as Ie}from"./layout-wfdMYi2n.js";import{D as ct}from"./Table-DyWJelc_.js";import{T as dt}from"./TimeCell-DUt0i0gi.js";import{t as z,r as nn,a as ut}from"./link-CIkWI7An.js";import{w as Be}from"./labels-Bgu_ZhL8.js";import{c as Ee,d as pt,e as bt}from"./files-BxEOxSF8.js";import{D as mt}from"./DaeCode-B8yPDjSE.js";import{u as ht}from"./outbounds-DPmb26w8.js";import{u as ft}from"./flows-CMFlFH_d.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";const Q=64,gt=22,Z=8,xt=28;function wt({label:e,series:t,fmt:n,onSelect:a,regions:r,height:i=260}){const o=xn(),[l,c]=wn(),{ref:b,tip:y,show:p,hide:m}=lt(),k=Math.max(1,...t.flatMap(h=>h.points.flatMap(T=>[T.x,T.y]))),{end:N,ticks:f}=rt(k),u=Math.max((c??0)-Q-xt,1),C=i-Z-gt,v=h=>Q+Oe(h,N)*u,_=h=>Z+(1-Oe(h,N))*C,S=new Map,I=t.flatMap(h=>h.points.map(T=>{const L=v(T.x),j=_(T.y),A=L+","+j,F=S.get(A)??0;return S.set(A,F+1),{point:T,color:h.color,cx:L,cy:j,nth:F,spot:A}})).map(h=>({...h,twins:S.get(h.spot)}));return s.jsx("div",{className:"rp-scatter",ref:l,children:s.jsxs("div",{className:"rp-chart-hover",ref:b,onPointerLeave:m,children:[c!==null&&s.jsxs("svg",{width:c,height:i,role:"img","aria-label":e,"aria-describedby":o,children:[f.map(h=>s.jsxs("g",{children:[s.jsx("line",{className:"grid",x1:v(h),x2:v(h),y1:Z,y2:Z+C}),s.jsx("line",{className:"grid",x1:Q,x2:Q+u,y1:_(h),y2:_(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:_(h)+4,textAnchor:"end",children:n(h)})]},h)),r&&s.jsxs("g",{className:"diagonal",children:[s.jsx("line",{x1:v(0),y1:_(0),x2:v(N),y2:_(N)}),s.jsx("text",{x:Q+8,y:Z+14,children:r.above}),s.jsx("text",{x:Q+u-8,y:Z+C-8,textAnchor:"end",children:r.below})]}),I.map(({point:h,color:T,cx:L,cy:j,nth:A,twins:F})=>{const B=2*Math.PI*A/F,V=F>1?6:0;return s.jsx("circle",{className:a?"pick":void 0,cx:L+V*Math.cos(B),cy:j+V*Math.sin(B),r:5,fill:T,onClick:a?()=>a(h.id):void 0,onPointerMove:D=>p(D,[h.name,h.detail])},h.id)})]}),s.jsx(it,{tip:y})]})})}function vt({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 yt(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 We=[0,2,3,1,4,5,6,7],jt=w.memo(function({records:t,outbounds:n,latency:a,latencyError:r,retryLatency:i,truncated:o,onSelect:l}){const c=X(),b=Je(),y=ve[ye()],p=w.useCallback(u=>te(u,y),[y]),m=w.useMemo(()=>yt(t),[t]),k=w.useMemo(()=>{const u=n.filter(v=>v!=="block"),C=v=>v==="block"?b.negative:b.cat[We[Math.max(0,u.indexOf(v))%We.length]];return m.series.map(v=>({id:v.outbound??"",label:ee(v.outbound,c),color:C(v.outbound),points:v.points.map(_=>({id:_.id,x:_.up,y:_.down,name:_.name,detail:c("conn.chart.point",{down:p(_.down),up:p(_.up)})}))}))},[m,n,b,c,p]),N=m.heaviest?[{label:c("conn.chart.busiest"),icon:s.jsx(vn,{}),tint:"c3",value:m.heaviest.name,caption:ee(m.heaviest.outbound,c)},{label:c("conn.chart.down"),value:p(m.heaviest.down),icon:s.jsx($e,{}),tint:"c1"},{label:c("conn.chart.up"),value:p(m.heaviest.up),icon:s.jsx(yn,{}),tint:"c4"}]:[],f=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(st,{facts:N,lead:!0}),s.jsxs(ge,{title:c("conn.chart.title"),note:f,children:[o&&s.jsx("p",{className:"rp-note",children:c("conn.truncated")}),m.pLine truncated
`)+`
`}function Bt(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 Et=e=>e.target;function Wt({collection:e,view:t,collapse:n,onToggleGroup:a,loading:r,selected:i,onSelect:o,selectOnFocus:l,onSort:c}){const b=X(),[y,p]=Mn(442),m=w.useMemo(()=>{const f={dst:u=>s.jsx(le,{children:u.target}),src:u=>s.jsx(le,{className:"rp-code",children:u.source}),node:u=>s.jsx(le,{className:"rp-chain",text:u.path??void 0,children:u.node}),rule:u=>s.jsxs("span",{className:"rp-rule",children:[s.jsx(Ye,{...u.rule}),u.recomputed&&s.jsx(we,{children:u.recomputed})]}),state:u=>u.state,down:u=>u.download,downRate:u=>u.downloadRate,age:u=>s.jsx(dt,{at:u.startedAt})};return $.filter(u=>!t.hidden.includes(u.id)).map(u=>({...u,label:b(u.label),grow:1,render:f[u.id]}))},[t.hidden,b]),k=w.useMemo(()=>e.map(f=>"connection"in f?f.connection:f),[e]),N=w.useMemo(()=>({grouped:t.group!=="none",collapsed:f=>tn(n,f),onToggle:a}),[t.group,n,a]);return s.jsx("div",{ref:y,children:s.jsx(ct,{label:b("nav.connections"),rowDetail:!0,cols:m,rows:k,height:p,selected:i&&Ce(i),onSelect:o&&(f=>o(f&&Lt(f))),selectOnFocus:l,reveal:!0,empty:b("conn.empty"),loading:r,sort:t.sort&&{column:String(t.sort.column),direction:t.sort.direction},onSort:c,getTextValue:Et,stream:!0,tree:N})})}function Ht({dialog:e}){const t=X();return s.jsxs(An,{title:t("rule.add"),narrow:!0,isOpen:!!e,reason:e?.reason,onOpenChange:n=>{n||e?.close()},footer:()=>s.jsxs(s.Fragment,{children:[s.jsx(R,{onPress:()=>e?.close(),children:t("ui.cancel")}),s.jsx(R,{isDisabled:e?.disabled,isPending:e?.busy,onPress:()=>e?.applyNow(),children:t("rule.addApply")}),s.jsx(R,{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(qe,{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(mt,{text:e.preview})]})]})}function Ut(e,t){if(!t.some(p=>p.health?.length))return null;const n=[];let a=0;for(const p of t){const m=Tn(Pn(p.health??[]));m===void 0?a++:n.push({node:p.id,name:p.name,value:m,connections:0})}n.sort((p,m)=>p.value-m.value||de(p.name,m.name));const r=new Map(n.map(p=>[p.node,p])),i=e.some(p=>p.chain?.length);let o=0;for(const p of e){const m=p.chain?.at(-1);if(m===void 0)continue;const k=r.get(m);k?k.connections++:o++}const l=n.reduce((p,m)=>p+m.connections,0);let c=0;const b=n.find(p=>(c+=p.connections)>=Math.max(1,Math.ceil(l/2))),y=n.map(p=>p.value);return{samples:n,chains:i,missing:a,unplaced:o,used:n.filter(p=>p.connections).length,p50:Ie(y,50),p90:Ie(y,90),weightedP50:l?b.value:null}}function Vt(e){const t=r=>r.flatMap(([i,o])=>{const l=Rn(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 Kt(e,t,n,a){const r=c=>an(c,t),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:b})=>({id:c.rule_id,label:b,desc:c.expression}))}function an(e,t){const n=e&&t.find(a=>a.id===e.source?.source_id);return!!n?.writable&&Ze(n,e)!==null}function Qt(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 Gt({disabled:e,busy:t,failed:n,unplaceable:a},r){return e&&!t&&!n&&!a?r("ui.loading"):null}function Jt(e){const t=X(),n=ze().data?.resources,a=G(n,"rules",{whileLoading:!1})&&G(n,"config",{whileLoading:!1})&&n?.config.writable===!0,[r,i]=w.useState(null),[o,l]=w.useState(null),c=!!r,b=a?e?.rule_id??null:null,y=ft(c||!!b),p=Dn(c||!!b),m=G(n,"groups",{whileLoading:!1}),k=Fn(c&&m),N=()=>{y.refetch(),p.refetch(),m&&k.refetch()},f=On(),u=p.data?.sources??[],C=Kt(y.data?.rules??[],u,r?.matched??null,t),v=In(k.data??[]),_=!m||!!k.data,S=r?.outbound||v.find(x=>x.id===r?.current)?.id||(_?v[0].id:""),Y=y.data?.generation_id,I=x=>{const M=y.data?.rules.find(O=>O.rule_id===x);return M&&Y?{generation:Y,rule:M}:null},{befo Line truncated
@@ -0,0 +1,3 @@
import{j as o,r as x}from"./vendor-react-Bf71BWbF.js";import{aT as hn,aU as fn,aV as ue,aW as le,u as J,aI as Ue,a6 as he,a as fe,av as X,aX as K,aY as gn,aM as Ve,aZ as xn,aN as pe,E as Qe,a5 as se,a_ as wn,a$ as vn,Z as F,b0 as Q,b1 as yn,b2 as Ce,a0 as ae,b3 as Ke,a2 as jn,a4 as ge,b4 as xe,b5 as Je,b6 as me,aw as _n,b7 as kn,b8 as Cn,b9 as An,aB as Ae,ba as Nn,bb as Ge,aO as be,aL as oe,bc as Mn,bd as Ln,aa as Ye,ac as E,ag as Sn,be as Tn,bf as Rn,f as Ne,bg as Pn,Y as Fn,ab as Dn,bh as Wn,bi as In,a1 as On,ad as En,bj as Bn,bk as Ze,bl as Hn,bm as te,bn as Un,b as Vn,bo as Qn,bp as Kn,A as Jn,bq as Gn,T as Me,br as re,bs as Yn,bt as Le,B as Z,bu as Zn,bv as qn,bw as Xn,aJ as $n,aK as Se,bx as zn}from"./index-Bw0aJc9a.js";import{M as et}from"./ActionGroup-DLxTuKht.js";import{F as nt}from"./FactStrip-DtkOGBRy.js";import{B as tt,r as ot}from"./ranked-SM2ov7Tw.js";import{u as st,C as at,s as Te,a as lt,p as Re}from"./layout-BWzq8YqC.js";import{D as it}from"./Table-Km6Zv-S8.js";import{T as ct}from"./TimeCell-DKHUJpad.js";import{w as Pe}from"./labels-Bgu_ZhL8.js";import{c as Fe,d as rt,e as dt}from"./files-BxEOxSF8.js";import{u as ut,R as pt}from"./useQuickRule-BmFeKwTA.js";import{u as mt}from"./outbounds-DMhWS-9H.js";import{u as bt}from"./flows-D3eabARZ.js";import{c as qe}from"./nav-Wiib71Wo.js";import"./useGridSelectionCheckbox-COXIVEmS.js";import"./Virtualizer-DCY9HC9Z.js";import"./ListLayout-_fDlx5XY.js";import"./DaeCode-B8yPDjSE.js";const O=64,ht=22,V=8,ft=28;function gt({label:n,series:t,fmt:e,onSelect:s,regions:r,height:d=260}){const l=hn(),[a,c]=fn(),{ref:u,tip:b,show:g,hide:p}=st(),w=Math.max(1,...t.flatMap(h=>h.points.flatMap(S=>[S.x,S.y]))),{end:_,ticks:v}=lt(w),m=Math.max((c??0)-O-ft,1),C=d-V-ht,y=h=>O+Te(h,_)*m,j=h=>V+(1-Te(h,_))*C,N=new Map,G=t.flatMap(h=>h.points.map(S=>{const A=y(S.x),k=j(S.y),M=A+","+k,D=N.get(M)??0;return N.set(M,D+1),{point:S,color:h.color,cx:A,cy:k,nth:D,spot:M}})).map(h=>({...h,twins:N.get(h.spot)}));return o.jsx("div",{className:"rp-scatter",ref:a,children:o.jsxs("div",{className:"rp-chart-hover",ref:u,onPointerLeave:p,children:[c!==null&&o.jsxs("svg",{width:c,height:d,role:"img","aria-label":n,"aria-describedby":l,children:[v.map(h=>o.jsxs("g",{children:[o.jsx("line",{className:"grid",x1:y(h),x2:y(h),y1:V,y2:V+C}),o.jsx("line",{className:"grid",x1:O,x2:O+m,y1:j(h),y2:j(h)}),o.jsx("text",{className:"tick",x:y(h),y:d-6,textAnchor:"middle",children:e(h)}),o.jsx("text",{className:"tick",x:O-8,y:j(h)+4,textAnchor:"end",children:e(h)})]},h)),r&&o.jsxs("g",{className:"diagonal",children:[o.jsx("line",{x1:y(0),y1:j(0),x2:y(_),y2:j(_)}),o.jsx("text",{x:O+8,y:V+14,children:r.above}),o.jsx("text",{x:O+m-8,y:V+C-8,textAnchor:"end",children:r.below})]}),G.map(({point:h,color:S,cx:A,cy:k,nth:M,twins:D})=>{const W=2*Math.PI*M/D,Y=D>1?6:0;return o.jsx("circle",{className:s?"pick":void 0,cx:A+Y*Math.cos(W),cy:k+Y*Math.sin(W),r:5,fill:S,onClick:s?()=>s(h.id):void 0,onPointerMove:R=>g(R,[h.name,h.detail])},h.id)})]}),o.jsx(at,{tip:b})]})})}function xt({series:n}){return o.jsx("div",{className:"rp-legend",children:n.map(t=>o.jsx(ue,{swatch:t.color,label:t.label,value:String(t.points.length)},t.id))})}function wt(n,t){const e=new Map;let s=0;for(const a of n){if(a.upload_bytes===null||a.download_bytes===null){s++;continue}const c={id:a.id,up:Number(a.upload_bytes),down:Number(a.download_bytes),name:a.domain||a.dst||a.id},u=e.get(a.outbound);u?u.push(c):e.set(a.outbound,[c])}const r=[...e].map(([a,c])=>({outbound:a,points:c})).sort((a,c)=>le(t)(a.outbound??"",c.outbound??""));let d,l=-1n;for(const a of n){if(a.upload_bytes===null||a.download_bytes===null)continue;const c=BigInt(a.upload_bytes)+BigInt(a.download_bytes);c>l&&(l=c,d={id:a.id,up:Number(a.upload_bytes),down:Number(a.download_bytes),name:a.domain||a.dst||a.id,outbound:a.outbound})}return{series:r,unknown:s,heaviest:d,placed:n.length-s}}const De=[0,2,3,1,4,5,6,7],vt=x.memo(function({records:t,outbounds:e,latency:s,latencyError:r,retryLatency:d,truncated:l,onSelect:a}){const c=J(),u=Ue(),b=he[fe()],g=x.useCallback(m=>X(m,b),[b]),p=x.useMemo(()=>wt(t,b),[t,b]),w=x.useMemo(()=>{const m=e.filter(y=>y!=="block"),C=y=>y==="block"?u.negative:u.cat[De[Math.max(0,m.indexOf(y))%De.length]];return p.series.map(y=>({id:y.outbound??"",label:K(y.outbound,c),color:C(y.outbound),points:y.points.map(j=>({id:j.id,x:j.up,y:j.down,name:j.name,detail:c("conn.chart.point",{download:g(j.down),upload:g(j.up)})}))}))},[p,e,u,c,g]),_=p.heaviest?[{label:c("conn.chart.busiest"),icon:o.jsx(gn,{}),tint:"c3",value:p.heaviest.name,caption:K(p.heaviest.outbound,c)},{label:c("conn.chart.down"),value:g(p.heaviest.down),icon:o.jsx(Ve,{}),tint:"c1"},{label:c("conn.chart.up"),value:g(p.heaviest.up),icon:o.jsx(xn,{}),tint:"c4"}]:[],v=p.unknown?c("conn.chart.sampleUnknown",{n:t.length,unknown:p.unknown}):c("conn.chart.sample",{n:t.length});return o.jsxs("div",{className:"rp-chart-page",children:[o.jsx(nt,{facts:_,lead:!0}),o.jsxs(pe,{title:c("conn.chart.title"),note:v,Line truncated
`)+`
`}function Wt(n,t){const e=n.map(r=>r.id),s=t.bulkLimit!=null&&e.length>t.bulkLimit;return t.narrowed||t.truncated||s?{ids:e}:{ids:e,query:{type:t.network,src:t.src,all:!0}}}const It=n=>n.target;function Ot({collection:n,view:t,collapse:e,onToggleGroup:s,loading:r,selected:d,onSelect:l,selectOnFocus:a,onSort:c}){const u=J(),[b,g]=Nn(442),p=x.useMemo(()=>{const v={dst:m=>o.jsx(oe,{children:m.target}),src:m=>o.jsx(oe,{className:"rp-code",children:m.source}),node:m=>o.jsx(oe,{className:"rp-chain",text:m.path??void 0,children:m.node}),rule:m=>o.jsxs("span",{className:"rp-rule",children:[o.jsx(Ge,{...m.rule}),m.recomputed&&o.jsx(be,{children:m.recomputed})]}),state:m=>m.state,down:m=>m.download,downRate:m=>m.downloadRate,age:m=>o.jsx(ct,{at:m.startedAt})};return B.filter(m=>!t.hidden.includes(m.id)).map(m=>({...m,label:u(m.label),grow:1,render:v[m.id]}))},[t.hidden,u]),w=x.useMemo(()=>n.map(v=>"connection"in v?v.connection:v),[n]),_=x.useMemo(()=>({grouped:t.group!=="none",collapsed:v=>Xe(e,v),onToggle:s}),[t.group,e,s]);return o.jsx("div",{ref:b,children:o.jsx(it,{label:u("nav.connections"),rowDetail:!0,cols:p,rows:w,height:g,selected:d&&we(d),onSelect:l&&(v=>l(v&&At(v))),selectOnFocus:a,reveal:!0,empty:u("conn.empty"),loading:r,sort:t.sort&&{column:String(t.sort.column),direction:t.sort.direction},onSort:c,getTextValue:It,stream:!0,tree:_})})}function Et(n,t,e){if(!t.some(p=>p.health?.length))return null;const s=[];let r=0;for(const p of t){const w=Mn(Ln(p.health??[]));w===void 0?r++:s.push({node:p.id,name:p.name,value:w,connections:0})}s.sort((p,w)=>p.value-w.value||le(e)(p.name,w.name));const d=new Map(s.map(p=>[p.node,p])),l=n.some(p=>p.chain?.length);let a=0;for(const p of n){const w=p.chain?.at(-1);if(w===void 0)continue;const _=d.get(w);_?_.connections++:a++}const c=s.reduce((p,w)=>p+w.connections,0);let u=0;const b=s.find(p=>(u+=p.connections)>=Math.max(1,Math.ceil(c/2))),g=s.map(p=>p.value);return{samples:s,chains:l,missing:r,unplaced:a,used:s.filter(p=>p.connections).length,p50:Re(g,50),p90:Re(g,90),weightedP50:c?b.value:null}}const Bt=n=>({domain:n.domain??null,dip:F(n.dst)??null,sip:F(n.src)??null,outbound:n.outbound,matched:n.rule_id&&n.rule_source!=="unknown"?{id:n.rule_id,expression:n.rule_expression}:null});function Ht(n,t){const e=J(),s=Ye().data?.resources,r=ut(t),l=E(s,"rules",{whileLoading:!1})&&E(s,"config",{whileLoading:!1})&&s?.config.writable===!0?n?.rule_id??null:null,a=bt(!!l),c=Sn(!!l),u=n&&Bt(n);return{canAdd:!!u&&r.canAdd(u),addTip:u?Rn(u).length?void 0:e("conn.ruleNoTarget"):e("ui.selectRow"),canShow:E(s,"rules",{whileLoading:!1})&&!!n?.rule_id,canEdit:!!l&&Tn(a.data?.rules.find(b=>b.rule_id===l),c.data?.sources??[]),openAdd:()=>{u&&r.open(u)},dialog:r.dialog}}const en=qe().map(n=>n.id),nn=n=>["id","src","network","out","rule","q"].some(t=>new URLSearchParams(n).has(t))?"list":"traffic",q=(n,t)=>ae(n,nn(n)==="list"?{tab:Ze(n,en,"list"),...t}:t);function Ut({go:n,query:t}){const e=J(),s=he[fe()],[r,d]=x.useState(()=>{try{return Ee(localStorage.getItem(Oe))}catch{return Ee(null)}}),l=Ne(Kn),a=Ne(Qn),[c,u]=x.useState(()=>de(!1)),b=x.useCallback(i=>u(f=>$e(f,i)),[]),g=i=>{const f={...r,...i};f.group!==r.group&&u(de(!1)),d(f);try{localStorage.setItem(Oe,JSON.stringify(f))}catch{}},p=x.useMemo(()=>new URLSearchParams(t),[t]),[w,_]=x.useState(p.get("q")??""),v=p.get("network")??"all",m=p.get("out")??"all",C=p.get("rule")??"all",y=(i,f)=>n("connections",q(t,{[i]:f==="all"?null:f})),j=p.get("id"),[N,ve]=x.useState(null);Pn(p.get("q"),i=>_(i??""));const G=x.useRef(t);x.useEffect(()=>{G.current=t});const h=i=>n("connections",q(G.current,{id:i})),S=x.useDeferredValue(w),A=Fn(p.get("src")??""),k=Dn(A),M=Ye(),D=M.data?.resources.connections.can_close===!0,W=E(M.data?.resources,"rules",{whileLoading:!1}),Y=E(M.data?.resources,"flows",{whileLoading:!1});Wn(M.data?.resources);const R=mt(),I=In(k.refetch),T=x.useMemo(()=>On(k.data),[k.data]),$=E(M.data?.resources,"nodes",{whileLoading:!1}),H=En($),tn=x.useMemo(()=>$&&H.data?Et(T,H.data,s):null,[$,H.data,T,s]),on=$&&!H.data?H.error:null,sn=x.useMemo(()=>[...new Set(T.map(i=>i.outbound))].sort((i,f)=>le(s)(i??"",f??"")),[T,s]),z=S.trim().toLowerCase(),U=x.useMemo(()=>T.filter(i=>(v==="all"||i.network===v)&&(m==="all"||i.outbound===m)&&(C==="all"||i.rule_expression===C)&&(!z||[i.dst,i.domain,i.src,i.pname,K(i.outbound,e),Je(i.chain,R).join(" "),i.rule_expression].join(" ").toLowerCase().includes(z))),[T,v,m,C,z,R,e]),P=j?T.find(i=>i.id===j):void 0,[ye,je]=x.useState(null);!j&&ye!==null&&je(null);const ee=Nt(P,r.group);ee&&ye!==ee.token&&(je(ee.token),u(_t(c,ee.group)));const an=Ht(P,n),_e=x.useMemo(()=>Tt(T,k.data,A,C,m,s,e),[T,k.data,A,C,m,s,e]),ln=x.useMemo(()=>Ft(P,s,e,R,W),[P,s,e,R,W]),L={..._e,detail:ln},cn=x.useMemo(()=>St(U,r,s,R,W,e),[U,r,s,R,W,e]),rn=async()=>{if(!L.detail)return;const{id:i}=L.detail;try{if(!await I.close(i))return;new URLSearchParams(G.current).get("id")===i&&h(null),te("positive",e("conn.closed",{name:L.detail.title}))}catc Line truncated
@@ -0,0 +1 @@
import{aB as u,a3 as d,a4 as t,u as f,aL as m,aJ as c}from"./index-Bw0aJc9a.js";import{j as s}from"./vendor-react-Bf71BWbF.js";const g={userspace_tcp:"flow.userspaceTcp",userspace_udp:"flow.userspaceUdp",kernel_direct:"flow.kernelDirect",kernel_block:"flow.kernelBlock",dns_intercept:"flow.dnsIntercept",kernel_bypass:"flow.kernelBypass"},w={full:"flow.full",partial:"flow.partialVisibility",none:"ui.none"};function h(e,r,p){const l=Object.entries(e.coverage).filter(([,a])=>a!=="full"),o=u(e.dropped_records),n=o?r("flow.dropped",{n:o}):null;return!l.length&&!n?null:{summary:l.length?r("flow.coverageSummary",{n:l.length}):null,detail:d(p,l.map(([a,i])=>r("ui.valuePair",{label:t(g,a,r),value:t(w,i,r)}))),dropped:n}}function k({view:e}){const r=f();return s.jsxs("div",{className:"rp-cluster",role:"group","aria-label":r("flow.coverage"),children:[e.summary&&s.jsx(m,{text:e.detail,children:s.jsx(c,{small:!0,tone:"warn",children:e.summary})}),e.dropped&&s.jsx(c,{small:!0,tone:"warn",children:e.dropped})]})}export{k as C,h as c};
@@ -0,0 +1,3 @@
import{r as h,j as s}from"./vendor-react-Bf71BWbF.js";import{u as v,aT as De,bE as Re,c as Ae,bF as me,Z as qe,a4 as ke,a_ as S,aw as Ee,a5 as fe,aq as Fe,A as ge,aB as Oe,bG as xe,aa as Y,bg as E,bH as be,ac as B,a0 as W,h as ce,bk as Pe,bj as Me,a6 as V,a as I,bI as de,Y as He,f as We,bp as Ue,bJ as Be,bm as U,bq as Ve,ag as Ie,bK as Qe,W as Ke,b as $e,bL as ze,aW as Je,ak as R,j as ve,E as O,aI as Z,bM as Ge,bN as Xe,bO as Ye,bP as Ze,aN as F,aV as oe,L as ee,aP as je,aL as A,bs as es,bQ as J,T as G,bt as ye,B as _,bR as ss,aO as we,aK as se,bx as as,aJ as ue,bw as ns,bS as ts,aM as rs,bv as ls,bu as is}from"./index-Bw0aJc9a.js";import{D as Ne}from"./Table-Km6Zv-S8.js";import{T as X}from"./TimeCell-DKHUJpad.js";import{A as cs}from"./ActionGroup-DLxTuKht.js";import{q as ds,u as Ce,a as os,b as us}from"./dns-BCg5F0Tv.js";import{c as pe,d as ps,e as hs}from"./files-BxEOxSF8.js";import{d as ms}from"./nav-CdRBQuvD.js";import{u as fs,R as gs}from"./useQuickRule-BmFeKwTA.js";import{F as xs}from"./FactStrip-DtkOGBRy.js";import{r as he,B as bs}from"./ranked-SM2ov7Tw.js";import{u as vs,w as js,C as ys,p as $}from"./layout-BWzq8YqC.js";import"./useGridSelectionCheckbox-COXIVEmS.js";import"./Virtualizer-DCY9HC9Z.js";import"./ListLayout-_fDlx5XY.js";import"./DaeCode-B8yPDjSE.js";import"./flows-D3eabARZ.js";function ws({label:t,shares:n}){const a=v(),r=De(),{ref:c,tip:e,show:l,hide:o}=vs(),i=h.useMemo(()=>{const d=js(n.map(m=>m.count));return n.flatMap((m,f)=>Array.from({length:d[f]},()=>m))},[n]);return s.jsxs("div",{className:"rp-waffle rp-chart-hover",ref:c,onPointerLeave:o,children:[s.jsx("div",{className:"grid",role:"img","aria-describedby":r,"aria-label":Re(t,n,a),children:i.map((d,m)=>s.jsx("span",{style:{background:d.color},onPointerMove:f=>l(f,[d.label,d.text])},m))}),s.jsx("ul",{className:"legend",children:n.map(d=>s.jsxs("li",{children:[s.jsx("i",{className:"sw",style:{background:d.color}}),s.jsx("span",{children:d.label}),s.jsx("b",{children:d.text})]},d.id))}),s.jsx(ys,{tip:e})]})}function Ns({className:t,...n}){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:Ae("rp-icon",t),...n,children:[s.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"}),s.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"})]})}function ae(t,n,a,r,c){return{domain:t,dip:null,sip:(c&&qe(c))??null,outbound:null,matched:null,dns:{type:n,answers:me(a),upstream:r,query:{name:t,type:n}}}}const Cs=(t,n,a)=>({domain:null,dip:t,sip:null,outbound:null,matched:null,dns:{type:a,answers:[t],upstream:null,query:{name:n,type:a}}}),Ss={forced:"dns.route.forced","dns.routing":"dns.route.rules",default:"dns.route.default"};function Se(t,n){return{fields:[[n("ui.state"),t.status],[n("ui.upstream"),t.upstream??"—"],[n("dns.routeSource"),ke(Ss,t.route.source,n)],[n("dns.routeRule"),t.route.rule??"—"],[n("ui.elapsed"),S(t.elapsed_ms,n)]],answers:(t.answers??[]).map(a=>n("dns.answer",{name:a.name,type:a.type,ttl:a.ttl,data:a.data})),cacheText:n(t.cached?"dns.hit":"dns.miss"),cacheTone:t.cached?void 0:"warn"}}function _s(t,n,a,r,c,e){const l=n?.dns_query.record_types??[],o=a==="all"?l.length>0:l.includes(a);return{types:l,choices:[...l.map(i=>({id:i,label:i})),{id:"all",label:e("dns.allTypes")}],disabled:c||!n?.dns_query.available||!o||!r.trim(),reason:!n||c?null:n.dns_query.available?o?null:e(a==="all"?"dns.noTypes":"dns.typeUnsupported"):e("dns.queryUnavailable"),showCache:!!n?.dns_cache.available,cards:t?.results.map(i=>({id:i.type,title:`${t.domain} ${i.type}`,...Se(i,e),seed:ae(t.domain,i.type,i.answers??[],i.upstream,null),answerSeeds:(i.answers??[]).map(d=>me([d]).length?{address:d.data,seed:Cs(d.data,t.domain,i.type)}:null)}))??[],tabs:ms(n).map(i=>({id:i.id,label:e(i.titleKey)}))}}function Ts(t,n,a,r,c,e){const l=a.toLowerCase(),o=n?.dns_cache,i=(t?.entries??[]).filter(d=>!l||d.domain.toLowerCase().includes(l));return{fields:[[e("dns.entries"),t?fe(t.total,c):"—"]],coverage:t?["positive","negative","persistent"].filter(d=>!t.coverage[d]).map(d=>({id:d,text:e("ui.valuePair",{label:e({positive:"dns.positive",negative:"dns.negative",persistent:"dns.persistent"}[d]),value:e(d==="persistent"?"dns.chart.memoryOnly":"dns.notCovered")})})):[],filterText:l?e("dns.cacheFilter",{domain:a}):"",confirmationText:t?e("dns.flushConfirm",{Line truncated
`)+`
`}function As(t,n){const a=new Set(t.records.map(r=>r.id));return{...t,records:[...t.records,...n.records.filter(r=>!a.has(r.id))],next_cursor:n.next_cursor}}function qs(t,n){const a=n&&new Set(n.records.map(r=>r.id));return{data:n??t,newerWaiting:!!a&&!!t?.records.some(r=>!a.has(r.id))}}function ks(t,n,a){if(!t)return null;const{usage:r,coverage:c}=t,e=i=>{const d=Oe(i);return d===null?"—":fe(d,n)},l=r?.entry_capacity??null,o=r&&l!==null?Fe(r.entries,l):null;return{note:r?l===null?a("dns.chart.usageFacts",{entries:e(r.entries)}):void 0:a("dns.chart.cacheNote",{n:t.total}),usage:r&&l!==null&&o!==null?{pct:o,value:o>0&&o<.5?"<"+a("ui.percent",{n:1}):a("ui.percent",{n:Math.round(o)}),facts:a("dns.chart.usageFacts",{entries:a("ui.fraction",{part:e(r.entries),whole:e(l)})})}:null,coverage:a("dns.chart.coverage",{kinds:[c.positive&&a("dns.chart.positive"),c.negative&&a("dns.chart.negative")].filter(Boolean).join(a("ui.listSeparator")),persistent:a(c.persistent?"dns.chart.persistent":"dns.chart.memoryOnly")})}}function Es(t,n,a){return t?a instanceof ge&&a.status===503?"unavailable":n?"ready":a?"error":"loading":"unlisted"}function Fs({go:t,query:n}){const a=v(),r=xe(),c=Y(),e=h.useMemo(()=>new URLSearchParams(n),[n]),[l,o]=h.useState(e.get("domain")??""),[i,d]=h.useState(e.get("type")??"A");E(e.get("domain"),p=>o(p??"")),E(e.get("type"),p=>d(p??"A"));const[m,f]=h.useState(null),{busy:x,error:y,run:C}=be({rethrow:!0}),u=c.data?.resources,b=h.useMemo(()=>_s(m,u,i,l,!!x,a),[m,u,i,l,x,a]),w=b.tabs.map(p=>p.id),T=e.has("domain")||e.has("device"),q=w.includes("log")?T?"log":"stats":w.includes("query")?"query":w[0]??"query",N=async(p={domain:l,type:i})=>{try{await C("query",async g=>{const H=await ds(r.dnsQuery,p.domain.trim(),p.type==="all"?b.types:[p.type],u?.dns_query.limits?.max_types_per_request??1,g);return g.aborted||f(H),H})}catch{}},P=B(u,"dns_query",{whileLoading:!1})&&b.types.length>0,L=fs(t,{queryAgain:P?p=>{const g=b.types.includes(p.type)?p.type:"all";t("dns",W("",{tab:"query",domain:p.name.replace(/\.$/,""),type:g,run:"1"}))}:void 0}),k=e.has("run")&&u?n:null,M=h.useEffectEvent(p=>{const g=new URLSearchParams(p);t("dns",W(p,{run:null}),{replace:!0}),N({domain:g.get("domain")??"",type:g.get("type")??"A"})});return h.useEffect(()=>{k!==null&&M(k)},[k]),{...b,rule:L,domain:l,setDomain:o,type:i,setType:d,pending:x==="query",queryError:y,submit:()=>void N(),setTab:p=>t("dns",Me(n,p,u&&!T?q:null)),tab:Pe(n,b.tabs.map(p=>p.id),q),filterDomain:e.get("domain")??"",filterDevice:e.get("device")??"",cacheHref:w.includes("cache")?ce("dns",{tab:"cache"}):null,logHref:(p,g)=>ce("dns",{tab:"log",[p]:g}),logLinks:[...B(u,"dns_rules",{whileLoading:!1})?[{id:"rules",label:a("rule.dnsTitle"),onAction:()=>t("rules","tab=dns")}]:[],...u?.runtime_settings.available?[{id:"recording",label:a("ui.recordingSettings"),onAction:()=>t("settings","card=runtime")}]:[]],logEnabled:u?.dns_log.available,viewCache:()=>t("dns",W(n,{tab:"cache",domain:m?.domain??""})),clearCacheFilter:()=>t("dns",W(n,{tab:"cache",domain:null}))}}function Os(t){const n=v(),a=V[I()],r=os(!Be()),c=h.useMemo(()=>Ts(r.cache.data,r.capabilities.data?.resources,t,r.busy,a,n),[r.cache.data,r.capabilities.data,t,r.busy,a,n]),[e,l]=h.useState(null),o=c.rows.find(f=>f.id===e),{remove:i}=r,d=h.useCallback(f=>void i(f).then(x=>x&&U("positive",n("dns.deleted",{n:x.deleted})),x=>U("negative",n("dns.deleteFailed"),Ve(x,n))),[i,n]),m=async()=>{try{const f=await r.flush();f&&U("positive",n("dns.flushed",{matched:f.matched,deleted:f.deleted}))}catch(f){return n("dns.flushFailed",{error:$e(f,n)})}};return{...c,selected:o?e:null,setSelected:l,seed:o?.seed??null,error:r.cache.error,retry:r.cache.refetch,loading:(r.cache.loading||r.capabilities.loading)&&!r.cache.data,flushPending:r.busy==="flush",remove:d,flush:m,abortFlush:()=>{r.cancel(),r.cache.refetch()}}}function Ps(t){const n=Ce({},t===!0),a=Y().data?.resources,r=B(a,"config",{whileLoading:!1}),e=Ie(t===!0&&r).data?.sources,l=h.useMemo(()=>r&&e?Qe(e,"dns"):null,[r,e]);return{log:n,cacheListed:B(a,"dns_cache",{whileLoading:!1})&&a?.dns_cache.read===!0,configHref:l}}function Ms(t){const n=v(),a=V[I()],[r,c]=ze(),[e,l]=h.useState(!1),o=us(t,!c&&e);o.data&&!e&&l(!0);const i=h.useMemo(()=>ks(o.data,a,n),[o.data,a,n]);return{ref:r,card:i,state:Es(t,!!i,o.error),error:o.error,retry:o.refetch}}function Hs(t,n,a){const r=v(),c=V[I()],[e,l]=h.useState(n);E(n,l);const[o,i]=h.useState("all"),[d,m]=h.useState(a);E(a,m);const f=xe(),x=Y(),y=de(d),C=He(y),u=y.trim()!==""&&!C,[b,w]=h.useState(C);!u&&C!==b&&w(C);const T={name:de(e),type:o,src:u?b:C},q=JSON.stringify(T),N=Ce(T,t===!0),[P,L]=h.useState(null),[k,M]=h.useState(!1),p=be({scope:q});E(q,()=>L(null));const{data:g,newerWaiting:H}=h.useMemo(()=>qs(N.data,P),[N.data,P]),ne=()=>void p.run("older",async D=>{if(!g?.next_cursor)return;L(g);let le;try{le=await f.dnsLog({name:T.name.trim()||void 0,type:o==="all"?void 0:o,src:T.src,cursor:g.next_cursor,limit:N.limit},D)}catch(j){if(!(j in Line truncated
@@ -1,3 +0,0 @@
import{r as p,j as a}from"./vendor-react-Bf71BWbF.js";import{u as g,aP as Te,c as _e,a3 as Se,aW as j,at as Le,a4 as ie,an as De,A as Re,ax as qe,bs as ce,a8 as I,bf as E,bt as oe,$ as ee,bj as Ae,bi as Fe,a5 as Q,a as z,bu as se,X as Ee,f as Me,bm as Oe,aa as U,bv as ke,be as P,b as ae,bw as Pe,aS as We,ai as T,j as de,E as F,aE as K,bx as He,by as Ue,bz as Be,bA as Ve,aJ as A,aR as te,aL as ue,b4 as $e,bB as B,T as V,b5 as pe,B as M,bC as Ie,aK as he,aG as G,br as Qe,aH as q,aF as ne,bq as ze,aI as Ke,bD as Ge,bp as Je,L as Xe,bo as Ye}from"./index-BNBwb-FJ.js";import{D as me}from"./Table-DyWJelc_.js";import{T as $}from"./TimeCell-DUt0i0gi.js";import{A as Ze}from"./ActionGroup-BKxDwmnT.js";import{q as es,u as fe,a as ss,s as as,b as ts}from"./dns-CvJ19DpX.js";import{c as re,d as ns,e as rs}from"./files-BxEOxSF8.js";import{d as ls}from"./nav-DuA2h3KP.js";import{b as is}from"./link-CIkWI7An.js";import{F as cs}from"./FactStrip-n2q1T87k.js";import{r as le,B as os}from"./ranked-B09X8uKl.js";import{u as ds,w as us,C as ps,p as W}from"./layout-wfdMYi2n.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";function hs({label:r,shares:t}){const e=g(),s=Te(),{ref:l,tip:n,show:i,hide:c}=ds(),o=p.useMemo(()=>{const d=us(t.map(h=>h.count));return t.flatMap((h,f)=>Array.from({length:d[f]},()=>h))},[t]);return a.jsxs("div",{className:"rp-waffle rp-chart-hover",ref:l,onPointerLeave:c,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:o.map((d,h)=>a.jsx("span",{style:{background:d.color},onPointerMove:f=>i(f,[d.label,d.text])},h))}),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(ps,{tip:n})]})}function ms({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:_e("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 fs={forced:"dns.route.forced","dns.routing":"dns.route.rules",default:"dns.route.default"};function xe(r,t){return{fields:[[t("ui.state"),r.status],[t("ui.upstream"),r.upstream??"—"],[t("dns.routeSource"),Se(fs,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 xs(r,t,e,s,l,n){const i=t?.dns_query.record_types??[],c=e==="all"?i.length>0:i.includes(e);return{types:i,choices:[...i.map(o=>({id:o,label:o})),{id:"all",label:n("dns.allTypes")}],disabled:l||!t?.dns_query.available||!c||!s.trim(),reason:!t||l?null:t.dns_query.available?c?null:n(e==="all"?"dns.noTypes":"dns.typeUnsupported"):n("dns.queryUnavailable"),showCache:!!t?.dns_cache.available,cards:r?.results.map(o=>({id:o.type,title:`${r.domain} ${o.type}`,...xe(o,n)}))??[],tabs:ls(t).map(o=>({id:o.id,label:n(o.titleKey)}))}}function gs(r,t,e,s,l,n){const i=e.toLowerCase(),c=t?.dns_cache,o=(r?.entries??[]).filter(d=>!i||d.domain.toLowerCase().includes(i));return{fields:[[n("dns.entries"),r?ie(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:c&&!s&&(!c.available||!c.flush)?n("dns.flushUnsupported"):null,deleteReason:c&&!s&&o.length>0&&(!c.available||!c.delete_entry)?n("dns.deleteUnsupported"):null,empty:n(t?.dns_cache.available&&t.dns_cache.read?"dns.empty":"dns.cacheUnavailable"),rows:o.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.deleteLine truncated
`)+`
`}function ys(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 ws(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 Ns(r,t,e){if(!r)return null;const{usage:s,coverage:l}=r,n=c=>{const o=qe(c);return o===null?"—":ie(o,t)},i=s?De(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 Cs(r,t,e){return r?e instanceof Re&&e.status===503?"unavailable":t?"ready":e?"error":"loading":"unlisted"}function Ts({go:r,query:t}){const e=g(),s=ce(),l=I(),n=p.useMemo(()=>new URLSearchParams(t),[t]),[i,c]=p.useState(n.get("domain")??""),[o,d]=p.useState(n.get("type")??"A");E(n.get("domain"),m=>c(m??"")),E(n.get("type"),m=>d(m??"A"));const[h,f]=p.useState(null),{busy:y,error:u,run:v}=oe({rethrow:!0}),x=l.data?.resources,_=p.useMemo(()=>xs(h,x,o,i,!!y,e),[h,x,o,i,y,e]),w=_.tabs.map(m=>m.id),L=w.includes("log")?n.has("domain")?"log":"stats":w.includes("query")?"query":w[0]??"query",N=async()=>{try{await v("query",async m=>{const C=await es(s.dnsQuery,i.trim(),o==="all"?_.types:[o],x?.dns_query.limits?.max_types_per_request??1,m);return m.aborted||f(C),C})}catch{}};return{..._,domain:i,setDomain:c,type:o,setType:d,pending:y==="query",queryError:u,submit:()=>void N(),setTab:m=>r("dns",Fe(t,m,x&&!n.has("domain")?L:null)),tab:Ae(t,_.tabs.map(m=>m.id),L),filterDomain:n.get("domain")??"",logEnabled:x?.dns_log.available,viewCache:()=>r("dns",ee(t,{tab:"cache",domain:h?.domain??""})),clearCacheFilter:()=>r("dns",ee(t,{tab:"cache",domain:null}))}}function _s(r){const t=g(),e=Q[z()],s=ss(!ke()),l=p.useMemo(()=>gs(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(o=>void n(o).then(d=>d&&P("positive",t("dns.deleted",{n:d.deleted})),d=>P("negative",t("dns.deleteFailed"),{detail:ae(d,t)})),[n,t]),c=async()=>{try{const o=await s.flush();o&&P("positive",t("dns.flushed",{matched:o.matched,deleted:o.deleted}))}catch(o){return t("dns.flushFailed",{error:ae(o,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:c,abortFlush:()=>{s.cancel(),s.cache.refetch()}}}function Ss(r){const t=fe({},r===!0),e=I().data?.resources;return{log:t,cacheListed:U(e,"dns_cache",{whileLoading:!1})&&e?.dns_cache.read===!0}}function Ls(r){const t=g(),e=Q[z()],[s,l]=Pe(),[n,i]=p.useState(!1),c=ts(r,!l&&n);c.data&&!n&&i(!0);const o=p.useMemo(()=>Ns(c.data,e,t),[c.data,e,t]);return{ref:s,card:o,state:Cs(r,!!o,c.error),error:c.error,retry:c.refetch}}function Ds(r,t){const e=g(),s=Q[z()],[l,n]=p.useState(t);E(t,n);const[i,c]=p.useState("all"),[o,d]=p.useState(""),h=ce(),f=I(),y=se(o),u=Ee(y),v=y.trim()!==""&&!u,[x,_]=p.useState(u);!v&&u!==x&&_(u);const w={name:se(l),type:i,src:v?x:u},L=JSON.stringify(w),N=fe(w,r===!0),[m,C]=p.useState(null),[ge,J]=p.useState(!1),D=oe({scope:L});E(L,()=>C(null));const{data:b,newerWaiting:be}=p.useMemo(()=>ws(N.data,m),[N.data,m]),X=()=>void D.run("older",async S=>{if(!b?.next_cursor)return;C(b);const{page:Ne}=await as(Ce=>h.dnsLog(Ce,S),{name:w.name.trim()||void 0,type:i==="all"?void 0:i,src:w.src,cursor:b.next_cursor,limit:N.limit},S);S.aborted||C(ys(b,Ne))}),Y=()=>{D.cancel(),C(null);const S=N.refetch();S&&(J(!0),S.finally(()=>J(!1)))},[O,ve]=p.useState(null),je=Me(Oe),Z=f.data?.resources.dns_query.record_types,ye=p.useMemo(()=>vs(b,r,e,Z),[b,r,e,Z]),R=p.useMemo(()=>bs(b,O,s,e),[b,O,s,e]),k=f.data?.resources,we=U(k,"dns_rules",{whileLoading:!1})&&U(k,"config",{whileLoading:!1})&&k?.config.writable===!0;return{...ye,detail:R,detailTitle:R?.title??"",ruleHref:R&&we?is({kind:"qnameSuffix",value:R.title.replace(/\.$/,"")},"dns"):null,name:l,newerWaiting:be,setName:n,type:i,setType:c,src:o,setSrc:d,srcError:v?e("ui.invalidIp"):void 0,selected:R?O:null,setSelected:ve,wide:je,error:D.error??N.error,loading:N.loading&&!b,hasOlder:!!b?.next_cursor,loadingOlder:!!D.busy,loadOlder:X,refreshing:ge,refresh:Y,retry:D.error?X:Y,export:()=>ns(rs("dns-log","csv"),js(b?.records??[]),"text/csv;charset=utf-8")}}const Rs=["cached","answered","nxdomain","failed"],qs=r=>r.cached?"cached":r.status==="NOERROR"?"answered":r.status==="NXDOMAIN"?"nxdomain":"failed";function As(r){const t={cached:0,answered:0,nxdomain:0,failed:0},e=[];for(const c of r){const o=qs(c);t[o]++,!c.cached&&c.upstream!==null&&e.push Line truncated
@@ -0,0 +1 @@
import{r as an,j as K}from"./vendor-react-Bf71BWbF.js";import{u as cn,fx as fn}from"./index-Bw0aJc9a.js";import{u as gn,i as hn,e as pn,C as yn}from"./layout-BWzq8YqC.js";import{w as dn,c as T,a as mn}from"./array-C0P64tl-.js";const on=Math.abs,P=Math.atan2,k=Math.cos,vn=Math.max,rn=Math.min,C=Math.sin,F=Math.sqrt,S=1e-12,V=Math.PI,X=V/2,W=2*V;function xn(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 Pn(t){return t.endAngle}function wn(t){return t&&t.padAngle}function Tn(t,h,x,w,v,A,p,n){var f=x-t,u=w-h,e=p-v,y=n-A,r=y*f-e*u;if(!(r*r<S))return r=(e*(h-A)-y*(t-v))/r,[t+r*f,h+r*u]}function U(t,h,x,w,v,A,p){var n=t-x,f=h-w,u=(p?A:-A)/F(n*n+f*f),e=u*f,y=-u*n,r=t+e,a=h+y,g=x+e,d=w+y,j=(r+g)/2,c=(a+d)/2,m=g-r,i=d-a,l=m*m+i*i,M=v-A,R=r*d-g*a,I=(i<0?-1:1)*F(vn(0,M*M*l-R*R)),$=(R*i-m*I)/l,B=(-R*m-i*I)/l,b=(R*i+m*I)/l,E=(-R*m+i*I)/l,L=$-j,s=B-c,o=b-j,N=E-c;return L*L+s*s>o*o+N*N&&($=b,B=E),{cx:$,cy:B,x01:-e,y01:-y,x11:$*(v/M-1),y11:B*(v/M-1)}}function jn(){var t=An,h=Mn,x=T(0),w=null,v=Rn,A=Pn,p=wn,n=null,f=dn(u);function u(){var e,y,r=+t.apply(this,arguments),a=+h.apply(this,arguments),g=v.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*C(g)),n.arc(0,0,a,g,d,!c),r>S&&(n.moveTo(r*k(d),r*C(d)),n.arc(0,0,r,d,g,c));else{var m=g,i=d,l=g,M=d,R=j,I=j,$=p.apply(this,arguments)/2,B=$>S&&(w?+w.apply(this,arguments):F(r*r+a*a)),b=rn(on(a-r)/2,+x.apply(this,arguments)),E=b,L=b,s,o;if(B>S){var N=ln(B/r*C($)),O=ln(B/a*C($));(R-=N*2)>S?(N*=c?1:-1,l+=N,M-=N):(R=0,l=M=(g+d)/2),(I-=O*2)>S?(O*=c?1:-1,m+=O,i-=O):(I=0,m=i=(g+d)/2)}var q=a*k(m),z=a*C(m),G=r*k(M),H=r*C(M);if(b>S){var J=a*k(i),Q=a*C(i),Y=r*k(l),Z=r*C(l),D;if(j<V)if(D=Tn(q,z,Y,Z,J,Q,G,H)){var _=q-D[0],nn=z-D[1],en=J-D[0],tn=Q-D[1],sn=1/C(xn((_*en+nn*tn)/(F(_*_+nn*nn)*F(en*en+tn*tn)))/2),un=F(D[0]*D[0]+D[1]*D[1]);E=rn(b,(r-un)/(sn-1)),L=rn(b,(a-un)/(sn+1))}else E=L=0}I>S?L>S?(s=U(Y,Z,q,z,a,L,c),o=U(J,Q,G,H,a,L,c),n.moveTo(s.cx+s.x01,s.cy+s.y01),L<b?n.arc(s.cx,s.cy,L,P(s.y01,s.x01),P(o.y01,o.x01),!c):(n.arc(s.cx,s.cy,L,P(s.y01,s.x01),P(s.y11,s.x11),!c),n.arc(0,0,a,P(s.cy+s.y11,s.cx+s.x11),P(o.cy+o.y11,o.cx+o.x11),!c),n.arc(o.cx,o.cy,L,P(o.y11,o.x11),P(o.y01,o.x01),!c))):(n.moveTo(q,z),n.arc(0,0,a,m,i,!c)):n.moveTo(q,z),!(r>S)||!(R>S)?n.lineTo(G,H):E>S?(s=U(G,H,J,Q,r,-E,c),o=U(q,z,Y,Z,r,-E,c),n.lineTo(s.cx+s.x01,s.cy+s.y01),E<b?n.arc(s.cx,s.cy,E,P(s.y01,s.x01),P(o.y01,o.x01),!c):(n.arc(s.cx,s.cy,E,P(s.y01,s.x01),P(s.y11,s.x11),!c),n.arc(0,0,r,P(s.cy+s.y11,s.cx+s.x11),P(o.cy+o.y11,o.cx+o.x11),c),n.arc(o.cx,o.cy,E,P(o.y11,o.x11),P(o.y01,o.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=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-V/2;return[k(y)*e,C(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?(x=typeof e=="function"?e:T(+e),u):x},u.padRadius=function(e){return arguments.length?(w=e==null?null:typeof e=="function"?e:T(+e),u):w},u.startAngle=function(e){return arguments.length?(v=typeof e=="function"?e:T(+e),u):v},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 En(t){return t}function Ln(){var t=En,h=Sn,x=null,w=T(0),v=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=+w.apply(this,arguments),j=Math.min(W,Math.max(-W,v.apply(this,arguments)-d)),c,m=Math.min(Math.abs(j)/u,A.apply(this,arguments)),i=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])}):x!=null&&a.sort(function(M,R){return x(n[M],n[R])}),f=0,y=r?(j-u*i)/r:0;f<u;++f,d=c)e=a[f],l=g[e],c=d+(l>0?l*y:0)+i,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,x=null,p):h},p.sort=function(n){return arguments.length?(x=n,h=null,p):x},p.startAngle=function(n){return arguments.length?(w=typeof n=="function"?n:T(+n),p):w},p.endAngle=function(n){return arguments.length?(v=typeof n=="function"?n:T(+n),p):v},p.padAngle=function(n){return arguments.length?(A=typeof n=="function"?n:T(+n),p):A},p}function $n({label:t,rows:h}){const x=cn(),[w,v]=fn(Math.round,120),{tip:A,showAt:p,hide:n}=gn(),[f,u]=an.useState(null),e=h.filter(i=>i.value!==null&&i.valuLine truncated
@@ -1 +0,0 @@
import{r as an,j as K}from"./vendor-react-Bf71BWbF.js";import{u as cn,eQ as fn}from"./index-BNBwb-FJ.js";import{u as gn,i as hn,e as pn,C as yn}from"./layout-wfdMYi2n.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)),O=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-=O*2)>S?(O*=c?1:-1,m+=O,o-=O):(D=0,m=o=(g+d)/2)}var q=a*k(m),z=a*b(m),Q=r*k(M),G=r*b(M);if(L>S){var H=a*k(o),J=a*b(o),Y=r*k(l),Z=r*b(l),C;if(j<V)if(C=Tn(q,z,Y,Z,H,J,Q,G)){var _=q-C[0],nn=z-C[1],en=H-C[0],tn=J-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(H,J,Q,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(Q,G):$>S?(s=U(Q,G,H,J,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 h,j as n}from"./vendor-react-Bf71BWbF.js";import{a4 as g,eq as j,er as b,aw as y,h as v,bD as E,bG as L,u as k,a6 as T,a as N,aa as H,es as _,bg as D,et as K,eu as M,ev as R,ew as S,aL as p,bw as C,aK as F,L as O,bt as W,aJ as A,B,aM as I,E as J}from"./index-Bw0aJc9a.js";import{D as P}from"./Table-Km6Zv-S8.js";import{d as V,e as q}from"./files-BxEOxSF8.js";import"./useGridSelectionCheckbox-COXIVEmS.js";import"./Virtualizer-DCY9HC9Z.js";import"./ListLayout-_fDlx5XY.js";const w={buffer_overflow:["event.gap.overflow","event.gapHelp.overflow"],evicted:["event.gap.evicted","event.gapHelp.evicted"]};function G(e,t){const r=e.event==="flow.gap"&&Object.hasOwn(w,e.data.reason)?w[e.data.reason]:void 0;return r&&{title:t(r[0]),text:t(r[1])}}function z(e,t){const r=l=>l?[{id:"flow",label:t("event.viewFlow"),href:v("flows",{tab:"records",id:l})}]:[];switch(e.event){case"flow.updated":return r(e.data.resource_id);case"flow.gap":return[...r(e.data.resource_id),{id:"recording",label:t("ui.recordingSettings"),href:E}];case"generation.changed":return[{id:"config",label:t("event.viewConfig"),href:v("config")}];default:return[]}}const x=new WeakMap;function Q(e,t,r,l){const s=x.get(e);if(s&&s.locale===t)return s.row;const i=l?{key:"event.lostHistory"}:j(e,r),o={id:e.id,timestamp:y(e.data.observed_at,t),iso:e.data.observed_at,kind:e.event,kindText:g(b,e.event,r),summary:r(i.key,i.params),help:G(e,r),links:z(e,r)};return x.set(e,{locale:t,row:o}),o}function U(e,t,r,l,s,i,o,u,a=!1,c=()=>!1){const m=t==="without-runtime"||u.includes(t)?t:"all",f=e.filter(d=>m==="all"||(m==="without-runtime"?d.event!=="runtime.updated":d.event===m)).slice(0,s);return{kind:m,rows:f.map(d=>Q(d,i,o,c(d))),kinds:[{id:"without-runtime",label:o("event.withoutRuntime")},{id:"all",label:o("event.allKinds")},...u.map(d=>({id:d,label:g(b,d,o)}))],status:a&&l!==!1?{tone:"err",text:o("event.disconnected")}:{tone:r?"ok":l===null?"muted":"warn",text:o(l===!1?"event.unavailable":r?"event.connected":l===null?"ui.loading":"event.reconnecting")},limitText:o("event.limit",{n:s}),shown:f}}function X(e){return JSON.stringify(e,null,2)+`
`}function Y(){const e=L(),t=k(),r=T[N()],s=H().data?.resources.events.kinds,[i,o]=h.useState("without-runtime"),u=i!=="all"&&i!=="runtime.updated"&&s?.includes(i),a=_(i!=="without-runtime"&&!u),c=h.useMemo(()=>U(a.events,i,a.connected,a.available,S,r,t,s??[],!!a.error,R),[a.events,i,a.connected,a.available,a.error,r,t,s]);return D(c.kind,o),{...c,setKind:o,cursor:a.cursor,error:a.error,retry:()=>void K().then(()=>M(e)),loading:!a.error&&!a.connected&&a.available!==!1&&!a.events.length,export:()=>V(q("doona-events","json"),X(c.shown),"application/json")}}function ae(){const e=k(),t=Y(),r=h.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(C,{fill:!0,help:s.help,children:n.jsx(p,{children:s.summary})})}],[e]),l=h.useCallback(s=>n.jsxs(n.Fragment,{children:[n.jsx(F,{inline:!0,items:[[e("ui.time"),s.timestamp],[e("event.kind"),s.kindText],[e("event.summary"),s.summary]]}),s.links.length>0&&n.jsx("div",{className:"rp-cluster",children:s.links.map(i=>n.jsx(O,{appearance:"button",small:!0,href:i.href,children:i.label},i.id))})]}),[e]);return n.jsxs("div",{className:"rp-page",children:[n.jsxs("div",{className:"rp-toolbar",children:[n.jsx(W,{label:e("event.kind"),side:!0,value:t.kind,onChange:t.setKind,items:t.kinds}),n.jsx(A,{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(B,{isDisabled:!t.rows.length,onPress:t.export,children:[n.jsx(I,{}),e("event.export")]})]}),t.error&&n.jsx(J,{error:t.error,onRetry:t.retry}),n.jsx(P,{label:e("nav.events"),stream:!0,fit:!0,height:442,loading:t.loading,rows:t.rows,empty:e("event.empty"),cols:r,detail:l})]})}export{ae as Events};
@@ -1,2 +0,0 @@
import{r as v,j as n}from"./vendor-react-Bf71BWbF.js";import{a3 as b,dH as k,dI as f,at as j,bs as y,u as g,a5 as E,a as T,a8 as L,dJ as N,bf as H,dK as K,dL as M,dM as R,dN as D,aH as p,bq as _,aG as C,b5 as F,aF as I,B as O,aI as S,E as W}from"./index-BNBwb-FJ.js";import{D as A}from"./Table-DyWJelc_.js";import{d as B,e as J}from"./files-BxEOxSF8.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";const h={buffer_overflow:["event.gap.overflow","event.gapHelp.overflow"],evicted:["event.gap.evicted","event.gapHelp.evicted"]};function P(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 V(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:P(e,a)};return w.set(e,{locale:t,row:i}),i}function q(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=>V(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 G(e){return JSON.stringify(e,null,2)+`
`}function z(){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(()=>q(r.events,o,r.connected,r.available,D,a,t,s??[],!!r.error,R),[r.events,o,r.connected,r.available,r.error,a,t,s]);return H(u.kind,i),{...u,setKind:i,cursor:r.cursor,error:r.error,retry:()=>void K().then(()=>M(e)),loading:!r.error&&!r.connected&&r.available!==!1&&!r.events.length,export:()=>B(J("doona-events","json"),G(u.shown),"application/json")}}function te(){const e=g(),t=z(),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(_,{fill:!0,help:s.help,children:n.jsx(p,{children:s.summary})})}],[e]),l=v.useCallback(s=>n.jsx(C,{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(F,{label:e("event.kind"),side:!0,value:t.kind,onChange:t.setKind,items:t.kinds}),n.jsx(I,{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(A,{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 +1 @@
import{j as s}from"./vendor-react-Bf71BWbF.js";import{aH as t}from"./index-BNBwb-FJ.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}; import{j as s}from"./vendor-react-Bf71BWbF.js";import{aL as t}from"./index-Bw0aJc9a.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};
@@ -0,0 +1 @@
import{r as b,j as l}from"./vendor-react-Bf71BWbF.js";import{bl as we,by as xe,Z as K,b0 as ve,bz as ye,bA as je,bc as ke,bk as _e,bj as Me,a0 as T,b4 as F,a4 as $,b8 as Le,b9 as Ne,a6 as ie,aw as Te,h as Se,aX as Z,a3 as J,bB as Re,a_ as Ce,a5 as Pe,u as C,a as ce,aU as Ie,B as R,bC as Oe,c as te,aO as z,aa as Y,ac as O,ae as Fe,ad as Ee,f as He,bp as De,bD as $e,bh as We,j as q,E as A,bx as Be,aL as V,bb as Ae,b3 as Ue,bs as de,bt as Ve,aj as ne,L as se,bv as Qe,aK as ae,ak as ue,aN as Ge}from"./index-Bw0aJc9a.js";import{w as L}from"./labels-Bgu_ZhL8.js";import{c as Ke,C as Je}from"./Coverage-DhDWz2sB.js";import{g as ze}from"./policyText-CltaDVEo.js";import{f as Xe}from"./nav-CS6FFQFP.js";import{D as Ze}from"./Table-Km6Zv-S8.js";import{T as Ye}from"./TimeCell-DKHUJpad.js";import{b as fe,u as me,c as qe}from"./flows-D3eabARZ.js";import{u as et}from"./outbounds-DMhWS-9H.js";import{u as tt,R as nt}from"./useQuickRule-BmFeKwTA.js";import"./useGridSelectionCheckbox-COXIVEmS.js";import"./Virtualizer-DCY9HC9Z.js";import"./ListLayout-_fDlx5XY.js";import"./DaeCode-B8yPDjSE.js";const st=["client","rule","outbound","node"],at=e=>new Map(e.map(t=>[t.id,t.name])),X="\0";function ot(e,t){if(e.rule_id)return e.rule_generation_id!==null&&e.rule_generation_id===t?e.rule_id:e.rule_id+X+e.rule_expression}function pe(e,t,n,r){switch(t){case"client":{const a=K(e.input?.src??void 0);return{label:a??"unknown",unknown:!a}}case"rule":return e.rule_expression?{label:e.rule_expression,unknown:!1,key:ot(e,r)}:{label:"unknown",unknown:!0};case"outbound":return e.outbound?{label:e.outbound,unknown:!1}:{label:"unknown",unknown:!0};case"node":{if(xe(e.outbound))return null;const a=e.chain.at(-1)??null;return a?{label:n.get(a)??a,unknown:!1,key:a}:{label:"unknown",unknown:!0}}}}const W=(e,t)=>ve(e,t.unknown?"":t.key??t.label),ge=e=>we(e,st)?.kind,rt=new Map;function he(e,t,n){const r=ge(t);return r?e.filter(a=>{const s=pe(a,r,rt,n?.generation_id);return s!==null&&W(r,s)===t}):[]}function lt(e,t,n,r){const a=e.slice(0,e.indexOf(":")),s=e.slice(e.indexOf(":")+1);return s===""?r(null):a==="rule"?s.includes(X)?s.slice(s.indexOf(X)+1):t.find(c=>c.rule_id===s)?.expression??s:a==="node"?n.get(s)??s:a==="client"?s:r(s)}function it(e,t,n,r,a="rule"){const s=at(n),c=new Map(t.map(d=>[d.id,d])),i=new Map(t.map(d=>[d.name,d])),o=new Map(n.map(d=>[d.id,d])),m=new Map,w=new Map,f=new Map,p=new Map,v=(d,g)=>{const x=d+">"+g;let u=p.get(x);return u||p.set(x,u={source:d,target:g,count:0}),u},j=(d,g,x=!1)=>{const u=W("node",{key:d,label:g,unknown:x});let N=f.get(u);if(!N){const E=x?void 0:o.get(d),H=E&&je(E);f.set(u,N={id:u,label:g,count:0,unknown:x||void 0,latency:ke(H),unavailable:H?.state==="unavailable"})}return N},_=(d,g=!1)=>{const x=W("outbound",{label:d,unknown:g});let u=w.get(x);if(u)return u;const N=g?void 0:i.get(d),E=g?{groups:[],member:null}:ye(d,N?.selection.tcp_member_id?"tcp":"udp",i,c,o),H=E.groups.map(U=>({name:U.name,kind:U.policy.kind,policy:U.policy.native})),B=E.member,be=g?"unknown":d==="direct"||d==="block"?d:H.length?"group":"unknown";return u={id:x,label:d,count:0,unknown:g||void 0,kind:be,groups:H,node:B&&j(B,s.get(B)??B).id},w.set(x,u),u.node&&v(x,u.node),u},h=(d,g,x=!1)=>{let u=m.get(d);return u||m.set(d,u={id:d,label:g,count:0,unknown:x||void 0,outbound:null,must:!1,fallback:!1}),u};if(a==="rule")for(const d of r?.rules??[]){const g=h(W("rule",{key:d.rule_id,label:d.expression}),d.expression);g.must=d.must,g.fallback=d.kind==="fallback",d.outbound&&(g.outbound=_(d.outbound).id,v(g.id,g.outbound))}const k=[a,"outbound","node"];for(const d of e){let g;for(const x of k){const u=pe(d,x,s,r?.generation_id);if(!u)break;const N=x==="outbound"?_(u.label,u.unknown):x==="node"?j(u.key??u.label,u.label,u.unknown):h(W(x,u),u.label,u.unknown);N.count++,g&&v(g.id,N.id).count++,g=N}}for(const d of t)_(d.name);const M=new Set([...m.values()].map(d=>d.outbound)),P=new Set([...w.values()].flatMap(d=>d.groups.slice(1).map(g=>g.name))),y=[...w.values()].filter(d=>d.count||M.has(d.id)||!P.has(d.label)),S=new Set(y.map(d=>d.id));return{by:a,leaves:[...m.values()],outbounds:y,nodes:[...f.values()],links:[...p.values()].filter(d=>S.has(d.source)||S.has(d.target))}}const oe=new WeakMap;function ee(e){const t=oe.get(e);if(t)return t;const n=new Map,r=new Map,a=new Map;for(const i of e.links){for(const[o,m]of[[n,i.source],[r,i.target]]){let w=o.get(m);w||o.set(m,w=[]),w.push(i)}(!a.has(i.source)||a.get(i.source).count<i.count)&&a.set(i.source,i)}const s=new Map;for(const i of[...e.leaves,...e.outbounds]){const o=("groups"in i?i.node:i.outbound)??a.get(i.id)?.target;o&&s.set(i.id,o)}const c={outgoing:n,incoming:r,parents:s};return oe.set(e,c),c}function ct(e){const t=new Map;let n=0;const r=new Map,{parents:a}=ee(e);for(const i of[...e.leaves,...e.outbounds]){const o=a.get(i.id);if(o){let m=r.get(o);m||r.set(o,m=[]),m.push(i.id)}}const s=i=>{const o=r.get(i)??[];if(!o.length){t.set(i,n++);return}for(const m of o)s(m);t.set(i,(t.get(o[0])+t.get(o[o.lengLine truncated
@@ -1 +1 @@
import{en as v}from"./index-BNBwb-FJ.js";import{$ as R,c,a as S,b as p}from"./Virtualizer-DipGMcji.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{f4 as v}from"./index-Bw0aJc9a.js";import{$ as R,c,a as S,b as p}from"./Virtualizer-DCY9HC9Z.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-hawa0qI8.js","./vendor-react-Bf71BWbF.js","./index-Bw0aJc9a.js","./index-7R3bVGRM.css"])))=>i.map(i=>d[i]);
import{u as G,a as ne,e as re,d as K,A as I,i as oe,b as ie,s as ae,r as le,w as ce,n as V,c as ue,f as de,L as U,h as me,g as ge,P as pe,S as fe,l as he,E as Z,j as we,I as xe,T as E,B as ye,k as je,_ as ke}from"./index-Bw0aJc9a.js";import{r as l,j as t}from"./vendor-react-Bf71BWbF.js";import{D as q,s as ve,d as be,a as Te,o as Se}from"./auth-DzCdgIKH.js";function Ee(s,r,o,c){return s.some(n=>n.id===r&&V(n.api)===V(o))?s.map(n=>n.id===r?{...n,token:c.trim()}:n):null}const Ne=/^[A-Za-z0-9_.-]{1,64}$/;function _e(s,r,o,c){const n={};r?Ne.test(r)||(n.username="login.badUsername"):n.username="login.usernameRequired";const u=[...o].length;return u?s==="setup"&&u<8?n.password="login.passwordShort":u>128||new TextEncoder().encode(o).length>512?n.password="login.passwordLong":s==="setup"&&o!==c&&(n.confirm="login.mismatch"):n.password="login.passwordRequired",n}function Ae(s){if(!(s instanceof I))return null;if(s.code==="invalid_credentials")return{key:"login.invalidCredentials"};if(s.code==="setup_required")return{key:"login.needsSetup",switchTo:"setup"};if(s.code==="setup_already_completed")return{key:"login.alreadySetUp",switchTo:"login"};if(s.code==="permission_denied")return{key:"login.setupPeer"};if(s.code==="rate_limited"){const r=s.retryAfter??60;return{key:"login.rateLimited",params:{n:r},wait:r}}return null}function Pe(s){return s instanceof SyntaxError?!0:s instanceof I&&(s.status===404||s.status===401&&(!s.code||s.code==="authentication_required"))}async function Ce(s,r){try{return ve(await be(s,r))}catch(o){if(!Pe(o))throw o;return!(o instanceof I)||o.status!==404||await Te(s,r)?"token":"no-api"}}function Le(s,r,o){try{const{profiles:c,activeId:n}=le(),u=Ee(c,s,r,o);if(!u)return"login.stale";ce({profiles:u,activeId:n})}catch{return"settings.saveError"}return null}async function De(s,r,o,c){let n;try{n=await Se(r,o,c)}catch(u){return Ae(u)??{error:u}}try{ae(s,r,n.token,n.expires_at)}catch{return{key:"settings.saveError"}}return null}function Re(s,r){const{kind:o,failure:c,attempt:n,ended:u,rejected:h}=s;return o==="no-api"?null:c!==null?{tone:"negative",text:typeof c=="string"?c:r(c.key,c.params),focus:!0,id:n}:u?{tone:"informative",text:r("login.sessionEnded"),focus:!1,id:0}:h&&o==="token"?{tone:"negative",text:r("login.rejected"),focus:!1,id:0}:null}const Me=s=>typeof s!="string"&&s.key==="login.rateLimited";function Ue(s,r){return Math.max(0,Math.ceil((s-r)/1e3))}function qe(s,r,o,c){const n=G(),u=ne(),[h]=l.useState(()=>re(s,r)),[a,x]=l.useState(null),[y,j]=l.useState({attempt:0,error:null});l.useEffect(()=>{const i=new AbortController;return Ce(r,i.signal).then(g=>x(g),g=>{i.signal.aborted||j(m=>({...m,error:g instanceof Error?g:new Error(String(g))}))}),()=>i.abort()},[r,y.attempt]);const[p,N]=l.useState(""),d=oe(r),[e,_]=l.useState(d?q.username:""),[f,k]=l.useState(d?q.password:""),[v,F]=l.useState(""),[A,J]=l.useState(!1),[B,H]=l.useState(!1),[P,O]=l.useState({}),[C,b]=l.useState(null),[W,X]=l.useState(0),[T,Y]=l.useState(0),[S,z]=l.useState(Date.now);l.useEffect(()=>{if(T<=S)return;const i=setTimeout(()=>z(Date.now()),(T-S)%1e3||1e3);return()=>clearTimeout(i)},[T,S]);const w=Ue(T,S),L=(i,g)=>m=>{g(m),P[i]&&O(({[i]:M,...se})=>se)},ee=()=>{if(!p.trim())return;const i=Le(s,r,p);i?b({key:i}):location.reload()},te=async i=>{const g=_e(i,e,f,v);if(O(g),Object.keys(g).length)return;H(!0);const m=await De(s,r,i,{username:e,password:f});if(!m){location.reload();return}if(H(!1),"error"in m){b(n("login.failed",{error:ie(m.error,n)}));return}if(m.wait){const M=Date.now();z(M),Y(M+m.wait*1e3)}m.switchTo&&(x(m.switchTo),F("")),b(m)},D=a==="setup"||a==="login",R=i=>P[i]?n(P[i]):void 0;return{kind:a,discoveryError:y.error,retryDiscovery:()=>j(i=>({attempt:i.attempt+1,error:null})),title:n(a==="no-api"?"login.noApiTitle":a==="setup"?"login.setupTitle":a==="token"?"login.title":"login.passwordTitle"),note:a==="no-api"?n("login.noApiNote"):a==="setup"?n("login.setupNote",{backend:o}):a==="login"?n("login.connectedTo",{backend:o}):n("login.note",{backend:o}),demoNote:d&&a==="login"?n("login.demoNote",q):null,alert:Re({kind:a,failure:C&&!w&&Me(C)?null:C,attempt:W,ended:h,rejected:c},n),busy:B,token:p,setToken:N,username:e,setUsername:L("username",_),usernameError:R("username"),password:f,setPassword:L("password",k),passwordError:R("password"),confirm:v,setConfirm:L("confirm",F),confirmError:R("confirm"),submit:()=>{B||w||a==="no-api"||(b(null),X(i=>i+1),D?te(a):ee())},canSubmit:a!=="no-api"&&!w&&(D||!!p.trim()),submitText:w?n("login.retryIn",{n:w}):n(a==="setup"?"login.create":a==="login"?"login.signIn":"login.submit"),secretType:A?"text":"password",toggle:()=>J(i=>!i),toggleText:n(D?A?"login.hidePassword":"login.showPassword":A?"settings.hideToken":"settings.showToken"),guideHref:K(u),requirementsHref:K(u,"no-native-api")}}function Q({className:s,...r}){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:10,height:10,viewBox:"0 0 12 12","aria-hidden":"true",focusable:"false",className:ue("rp-icon rp-linLine truncated
@@ -1,2 +0,0 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./LoginShowcase-CyHbTm5w.js","./vendor-react-Bf71BWbF.js","./index-BNBwb-FJ.js","./index-C8vJM6q6.css"])))=>i.map(i=>d[i]);
import{u as G,a as ne,e as re,d as K,A as q,i as oe,b as ie,s as ae,r as le,w as ce,n as V,c as ue,f as de,L as U,h as me,g as ge,P as pe,S as fe,l as he,E as Z,j as we,I as xe,T as E,B as ye,k as je,_ as ke}from"./index-BNBwb-FJ.js";import{r as l,j as t}from"./vendor-react-Bf71BWbF.js";import{D as I,s as ve,d as be,a as Te,o as Se}from"./auth-TcOYUrrj.js";function Ee(s,r,o,c){return s.some(n=>n.id===r&&V(n.api)===V(o))?s.map(n=>n.id===r?{...n,token:c.trim()}:n):null}const Ne=/^[A-Za-z0-9_.-]{1,64}$/;function Ae(s,r,o,c){const n={};r?Ne.test(r)||(n.username="login.badUsername"):n.username="login.usernameRequired";const u=[...o].length;return u?s==="setup"&&u<8?n.password="login.passwordShort":u>128||new TextEncoder().encode(o).length>512?n.password="login.passwordLong":s==="setup"&&o!==c&&(n.confirm="login.mismatch"):n.password="login.passwordRequired",n}function Pe(s){if(!(s instanceof q))return null;if(s.code==="invalid_credentials")return{key:"login.invalidCredentials"};if(s.code==="setup_required")return{key:"login.needsSetup",switchTo:"setup"};if(s.code==="setup_already_completed")return{key:"login.alreadySetUp",switchTo:"login"};if(s.code==="permission_denied")return{key:"login.setupPeer"};if(s.code==="rate_limited"){const r=s.retryAfter??60;return{key:"login.rateLimited",params:{n:r},wait:r}}return null}function _e(s){return s instanceof SyntaxError?!0:s instanceof q&&(s.status===404||s.status===401||s.status===403)}async function Ce(s,r){try{return ve(await be(s,r))}catch(o){if(!_e(o))throw o;return!(o instanceof q)||o.status!==404||await Te(s,r)?"token":"no-api"}}function Le(s,r,o){try{const{profiles:c,activeId:n}=le(),u=Ee(c,s,r,o);if(!u)return"login.stale";ce({profiles:u,activeId:n})}catch{return"settings.saveError"}return null}async function De(s,r,o,c){let n;try{n=await Se(r,o,c)}catch(u){return Pe(u)??{error:u}}try{ae(s,r,n.token,n.expires_at)}catch{return{key:"settings.saveError"}}return null}function Re(s,r){const{kind:o,failure:c,attempt:n,ended:u,rejected:h}=s;return o==="no-api"?null:c!==null?{tone:"negative",text:typeof c=="string"?c:r(c.key,c.params),focus:!0,id:n}:u?{tone:"informative",text:r("login.sessionEnded"),focus:!1,id:0}:h&&o==="token"?{tone:"negative",text:r("login.rejected"),focus:!1,id:0}:null}const Me=s=>typeof s!="string"&&s.key==="login.rateLimited";function Ue(s,r){return Math.max(0,Math.ceil((s-r)/1e3))}function Ie(s,r,o,c){const n=G(),u=ne(),[h]=l.useState(()=>re(s,r)),[a,x]=l.useState(null),[y,j]=l.useState({attempt:0,error:null});l.useEffect(()=>{const i=new AbortController;return Ce(r,i.signal).then(g=>x(g),g=>{i.signal.aborted||j(m=>({...m,error:g instanceof Error?g:new Error(String(g))}))}),()=>i.abort()},[r,y.attempt]);const[p,N]=l.useState(""),d=oe(r),[e,A]=l.useState(d?I.username:""),[f,k]=l.useState(d?I.password:""),[v,F]=l.useState(""),[P,J]=l.useState(!1),[B,H]=l.useState(!1),[_,O]=l.useState({}),[C,b]=l.useState(null),[W,X]=l.useState(0),[T,Y]=l.useState(0),[S,z]=l.useState(Date.now);l.useEffect(()=>{if(T<=S)return;const i=setTimeout(()=>z(Date.now()),(T-S)%1e3||1e3);return()=>clearTimeout(i)},[T,S]);const w=Ue(T,S),L=(i,g)=>m=>{g(m),_[i]&&O(({[i]:M,...se})=>se)},ee=()=>{if(!p.trim())return;const i=Le(s,r,p);i?b({key:i}):location.reload()},te=async i=>{const g=Ae(i,e,f,v);if(O(g),Object.keys(g).length)return;H(!0);const m=await De(s,r,i,{username:e,password:f});if(!m){location.reload();return}if(H(!1),"error"in m){b(n("login.failed",{error:ie(m.error,n)}));return}if(m.wait){const M=Date.now();z(M),Y(M+m.wait*1e3)}m.switchTo&&(x(m.switchTo),F("")),b(m)},D=a==="setup"||a==="login",R=i=>_[i]?n(_[i]):void 0;return{kind:a,discoveryError:y.error,retryDiscovery:()=>j(i=>({attempt:i.attempt+1,error:null})),title:n(a==="no-api"?"login.noApiTitle":a==="setup"?"login.setupTitle":a==="token"?"login.title":"login.passwordTitle"),note:a==="no-api"?n("login.noApiNote"):a==="setup"?n("login.setupNote",{backend:o}):a==="login"?n("login.connectedTo",{backend:o}):n("login.note",{backend:o}),demoNote:d&&a==="login"?n("login.demoNote",I):null,alert:Re({kind:a,failure:C&&!w&&Me(C)?null:C,attempt:W,ended:h,rejected:c},n),busy:B,token:p,setToken:N,username:e,setUsername:L("username",A),usernameError:R("username"),password:f,setPassword:L("password",k),passwordError:R("password"),confirm:v,setConfirm:L("confirm",F),confirmError:R("confirm"),submit:()=>{B||w||a==="no-api"||(b(null),X(i=>i+1),D?te(a):ee())},canSubmit:a!=="no-api"&&!w&&(D||!!p.trim()),submitText:w?n("login.retryIn",{n:w}):n(a==="setup"?"login.create":a==="login"?"login.signIn":"login.submit"),secretType:P?"text":"password",toggle:()=>J(i=>!i),toggleText:n(D?P?"login.hidePassword":"login.showPassword":P?"settings.hideToken":"settings.showToken"),guideHref:K(u),requirementsHref:K(u,"no-native-api")}}function Q({className:s,...r}){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:10,height:10,viewBox:"0 0 12 12","aria-hidden":"true",focusable:"false",className:ue("rp-icon rp-link-out",s),...r,children:t.jsx("Line truncated
@@ -1 +0,0 @@
import{j as N,r as B}from"./vendor-react-Bf71BWbF.js";import{u as W1,f as j1,aM as K1}from"./index-BNBwb-FJ.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,J=1/120,h1=1500,e1=430,C=48,q1=e1*e1/(2*h1),H1=Math.max(2.2*R,R+q1+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 J1(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
@@ -0,0 +1 @@
import{j as U,r as I}from"./vendor-react-Bf71BWbF.js";import{fD as O1,u as K1,a as U1,f as N1,a6 as V1,aQ as X1}from"./index-Bw0aJc9a.js";function Q1({label:r,className:c,isDisabled:f,ref:e,canvasRef:l}){return U.jsx("button",{ref:e,type:"button",className:c,"aria-label":r,disabled:f,children:U.jsx("canvas",{ref:l})})}const q1=[["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"]],N={width:940,height:1192},K=1.4,v=52,Z=72,f1=500,J1=250,$=22,Y=22,i1=Y+2,l1=16,u1=12,Y1=56,A1=17,E=9,D1=18,q=1/120,h1=1500,e1=430,B=48,Z1=e1*e1/(2*h1),H1=Math.max(2.2*v,v+Z1+4),z1=200,_1=z1*h1/(2*e1),J=.84*v*N.width/N.height/2,d1=.84*v/2;function C1(r,c){let f=0;for(;r>=1e3&&f<c.length-1;f++)r/=1e3;return[r,f]}function O(r,c){const f=["unit.megabyte","unit.gigabyte","unit.terabyte","unit.petabyte"],[e,l]=C1(r,f);return O1(e,c,f[l],l?2:1)}function G1(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 ee(r,c){const f=["unit.megabitPerSecond","unit.gigabitPerSecond","unit.terabitPerSecond","unit.petabitPerSecond"],[e,l]=C1(G1(r),f);return O1(e,c,f[l],Math.round(e*10)%10?1:0)}function I1(r){const c=Math.pow(.9,r);return{speed:_1-(_1-110)*c,gap:H1+(205-H1)*c,space:z1+70*c,swing:r<6?0:34*(1-Math.pow(.8,r-5)),drift:r>=6}}function te(r)Line truncated
@@ -0,0 +1,3 @@
import{j as r,r as x}from"./vendor-react-Bf71BWbF.js";import{aT as P,u as L,a6 as O,a as D,aI as B,H as T,B as W,ex as H,bP as k,ey as C,aN as I,a4 as N,aw as _,aa as q,aF as J,bI as G,ez as K,dl as V,eA as z,aL as S,aJ as F,aK as U,bt as Q,T as X,cN as Y,aM as Z,E as ee}from"./index-Bw0aJc9a.js";import{F as te}from"./FactStrip-DtkOGBRy.js";import{u as se,h as ae,C as re,t as oe}from"./layout-BWzq8YqC.js";import{D as ne}from"./Table-Km6Zv-S8.js";import{A as le}from"./ActionGroup-DLxTuKht.js";import{d as ie,e as ce}from"./files-BxEOxSF8.js";import{r as ge}from"./recorder-DlDpPhd4.js";import"./useGridSelectionCheckbox-COXIVEmS.js";import"./Virtualizer-DCY9HC9Z.js";import"./ListLayout-_fDlx5XY.js";function ue({label:a,rows:t,columns:e}){const n=P(),{ref:s,tip:o,show:c,hide:p}=se();return r.jsxs("div",{className:"rp-heatmap rp-chart-hover",ref:s,onPointerLeave:p,role:"group","aria-label":a,"aria-describedby":n,style:{"--cols":e.length},children:[t.map(i=>{const g=Math.max(...i.counts);return r.jsxs("div",{className:"row",children:[r.jsx("div",{className:"head",children:i.label}),r.jsx("div",{className:"cells",children:i.counts.map((b,v)=>r.jsx("span",{className:"cell t"+ae(b,g),style:{"--tone":i.color},onPointerMove:d=>c(d,[i.titles[v]]),role:"img","aria-label":i.titles[v]},v))})]},i.id)}),e.length>0&&r.jsxs("div",{className:"row times","aria-hidden":"true",children:[r.jsx("div",{className:"head"}),r.jsxs("div",{className:"ends",children:[r.jsx("span",{children:e[0]}),e.length>2&&r.jsx("span",{children:e[Math.floor(e.length/2)]}),e.length>1&&r.jsx("span",{children:e[e.length-1]})]})]}),r.jsx(re,{tip:o})]})}const A=new WeakMap;function E(a){let t=A.get(a);return t===void 0&&A.set(a,t=Date.parse(a.ts)),t}const M=["error","warn","info","debug","trace"];function de(a,t,e,n=24){const s=e?M.indexOf(e):M.length-1,o=M.filter((u,h)=>t.includes(u)&&h<=s),c=a.map(E).filter(Number.isFinite);if(!c.length)return{rows:o.map(u=>({level:u,counts:[]})),buckets:[],width:0,busiest:null};const p=Math.min(...c),i=Math.max(...c),g=oe(p,i,n),b=g.length>1?g[1]-g[0]:Math.max(i-p,6e4),v=new Map(o.map(u=>[u,new Array(g.length).fill(0)])),d=new Array(g.length).fill(0),j=new Array(g.length).fill(0);for(const u of a){const h=E(u),w=v.get(u.level);if(!w||!Number.isFinite(h))continue;const y=Math.min(g.length-1,Math.floor((h-g[0])/b));w[y]++,d[y]++,u.level==="error"&&j[y]++}const f=u=>u.reduce((h,w,y)=>w>u[h]?y:h,0),m=j.reduce((u,h)=>u+h,0),l=f(m?j:d);return{rows:o.map(u=>({level:u,counts:v.get(u)})),buckets:g,width:b,busiest:{start:g[l],count:m?j[l]:d[l],errors:m}}}function pe({records:a,offered:t,minimum:e,setMinimum:n}){const s=L(),o=O[D()],c=B(),p=x.useMemo(()=>de(a,t,e),[a,t,e]),i=x.useMemo(()=>new Intl.DateTimeFormat(o,{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),[o]),g=x.useCallback(f=>`${i.format(f)}–${i.format(f+p.width)}`,[i,p.width]),b=x.useMemo(()=>{const f=Object.keys(T).map(m=>{const l=s(T[m]);return[m,{text:l,label:r.jsxs(W,{quiet:!0,small:!0,className:m===e?"current":void 0,label:s(m===e?"log.chart.current":"log.chart.minimum",{level:l}),onPress:()=>n(m),children:[m===e&&r.jsx(H,{}),l]})}]});return new Map(f)},[e,n,s]),v=x.useMemo(()=>{const f={error:c.negative,warn:c.notice,info:c.info,debug:c.subtle,trace:c.muted},m=p.buckets.map(g);return{columns:p.buckets.map(l=>i.format(l)),rows:p.rows.map(l=>{const{text:u,label:h}=b.get(l.level);return{id:l.level,color:f[l.level],label:h,counts:l.counts,titles:l.counts.map((w,y)=>s("log.chart.cell",{time:m[y],level:u,n:w}))}})}},[p,g,i,b,c,s]);if(!a.length)return null;const d=p.busiest,j=d?d.errors?[{label:s("log.chart.errors"),value:s("log.chart.count",{n:d.errors}),icon:r.jsx(k,{}),tone:"negative"},{label:s("log.chart.peakErrors"),icon:r.jsx(C,{}),tint:"c1",value:g(d.start),caption:s("log.chart.count",{n:d.count})}]:[{label:s("log.chart.errors"),value:s("log.chart.count",{n:0}),icon:r.jsx(k,{}),tint:"c5"},{label:s("log.chart.peak"),icon:r.jsx(C,{}),tint:"c1",value:g(d.start),caption:s("log.chart.count",{n:d.count})}]:[];return r.jsxs("div",{className:"rp-chart-page",children:[r.jsx(te,{facts:j}),r.jsx(I,{title:s("log.chart.title"),note:s("log.chart.sample",{n:a.length}),children:r.jsx(ue,{label:s("log.chart.title"),columns:v.columns,rows:v.rows})})]})}const R=["trace","debug","info","warn","error"],me={trace:"muted",debug:"neutral",info:"info",warn:"warn",error:"err"},$=new WeakMap;function he(a,t,e){const n=$.get(a);if(n&&n.locale===t)return n.row;const s={id:a.id,timestamp:_(a.ts,t),iso:a.ts,levelText:N(T,a.level,e),tone:me[a.level],target:a.target,gap:!1,message:a.message+(a.fields?" "+Object.entries(a.fields).map(([o,c])=>`${o}=${typeof c=="string"?c:JSON.stringify(c)}`).join(" "):"")};return $.set(a,{locale:t,row:s}),s}function fe(a,t,e,n,s,o=new Set,c){const p=i=>!!c&&R.indexOf(i)<R.indexOf(c);return{rows:a.flatMap(i=>{const g=he(i,n,s);return o.has(i)?[{...g,id:`gap ${i.id}`,timestamp:"",iso:"",levelText:"",target:"",gap:!0,message:s("log.gap")},g]:[g]}),levels:t.map(i=>Line truncated
`)+`
`}const we=[];function ye({go:a}){const t=L(),e=O[D()],n=q(),s=J(),[o,c]=x.useState("info"),p=x.useCallback(y=>c(y),[]),[i,g]=x.useState(""),[b,v]=x.useState(!1),d=n.data?.resources.logs,j=d?.filters?.includes("target")??!1,f=G(j?i.trim():""),m=ve(o,d?.levels),l=K({level:m,target:f,paused:b}),u=V(n.data?.resources.runtime_settings.available??!1).data,h=u?.log?.level,w=x.useMemo(()=>fe(l.records,d?.levels??[],s.data?.engine.name,e,t,l.gaps,h),[l.records,l.gaps,d,s.data,e,t,h]);return{...w,empty:xe(u?.recording?.logs,!!f,t),status:be(l.connected,!!l.error,b,l.pending,z,t),records:l.records,offered:d?.levels??we,level:m??"",setLevel:p,filtersTarget:j,target:i,setTarget:g,paused:b,setPaused:v,error:n.error??l.error,loading:!n.error&&!l.error&&!l.connected&&!l.records.length,clear:l.clear,openRecording:n.data?.resources.runtime_settings.available?()=>a("settings","card=runtime"):null,retry:n.error?n.refetch:l.retry,export:()=>ie(ce(w.exportBase,"txt"),je(l.records,l.gaps,t),"text/plain;charset=utf-8")}}function $e({go:a}){const t=L(),e=ye({go:a}),n=x.useMemo(()=>[{id:"ts",label:t("ui.time"),minWidth:200,grow:0,drop:2,render:o=>!o.gap&&r.jsx(S,{className:"rp-code",text:o.iso,children:o.timestamp})},{id:"level",label:t("log.level"),minWidth:90,grow:0,drop:3,render:o=>!o.gap&&r.jsx(F,{small:!0,tone:o.tone,children:o.levelText})},{id:"target",label:t("log.target"),minWidth:160,grow:0,drop:1,render:o=>r.jsx("span",{className:"rp-code",children:o.target??"—"})},{id:"message",label:t("log.message"),minWidth:280,grow:3,isRowHeader:!0,render:o=>r.jsx(S,{children:o.message})}],[t]),s=x.useCallback(o=>r.jsx(U,{inline:!0,items:o.gap?[[t("log.message"),o.message]]:[[t("ui.time"),o.timestamp],[t("log.level"),o.levelText],[t("log.target"),o.target??"—"],[t("log.message"),o.message]]}),[t]);return r.jsxs("div",{className:"rp-page",children:[r.jsxs("div",{className:"rp-toolbar",children:[r.jsx(Q,{side:!0,label:t("log.level"),value:e.level,onChange:e.setLevel,items:e.levels}),e.filtersTarget&&r.jsx(X,{search:!0,label:t("log.target"),value:e.target,width:240,placeholder:t("log.targetPlaceholder"),onChange:e.setTarget}),r.jsx(Y,{isSelected:e.paused,onChange:e.setPaused,children:t("log.pause")}),r.jsx(F,{small:!0,tone:e.status.tone,children:e.status.text}),e.recordedText&&r.jsx("span",{className:"rp-label",children:e.recordedText}),r.jsx("span",{className:"rp-grow"}),r.jsx(le,{actions:[{id:"clear",label:t("log.clear"),isDisabled:!e.rows.length,onAction:e.clear},{id:"export",label:t("log.export"),icon:r.jsx(Z,{}),isDisabled:!e.rows.length,onAction:e.export},...e.openRecording?[{id:"recording",label:t("ui.recordingSettings"),onAction:e.openRecording}]:[]]})]}),r.jsx(ee,{error:e.error,onRetry:e.retry}),r.jsx(pe,{records:e.records,offered:e.offered,minimum:e.level,setMinimum:e.setLevel}),r.jsx(ne,{label:t("nav.logs"),stream:!0,rows:e.rows,height:640,loading:e.loading,empty:e.empty,cols:n,detail:s})]})}export{$e as Logs};
@@ -1,3 +0,0 @@
import{j as a,r as b}from"./vendor-react-Bf71BWbF.js";import{aP as P,u as M,a5 as D,a as R,aE as B,dO as T,B as W,dP as H,bA as k,dQ as C,aJ as I,a3 as N,a4 as _,at as q,a8 as G,aB as J,bu as V,dR as K,c_ as Q,dS as U,aH as S,aF as E,aG as z,b5 as X,T as Y,cA as Z,aI as ee,E as te}from"./index-BNBwb-FJ.js";import{F as se}from"./FactStrip-n2q1T87k.js";import{u as ae,h as re,C as oe,t as ne}from"./layout-wfdMYi2n.js";import{D as le}from"./Table-DyWJelc_.js";import{A as ie}from"./ActionGroup-BKxDwmnT.js";import{d as ce,e as ge}from"./files-BxEOxSF8.js";import{r as ue}from"./recorder-DlDpPhd4.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";function de({label:e,rows:s,columns:r}){const n=P(),{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 F=new WeakMap;function $(e){let s=F.get(e);return s===void 0&&F.set(e,s=Date.parse(e.ts)),s}const L=["error","warn","info","debug","trace"];function pe(e,s,r,n=24){const t=r?L.indexOf(r):L.length-1,m=L.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=M(),m=D[R()],l=B(),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(H,{}),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(I,{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 A=["trace","debug","info","warn","error"],he={trace:"muted",debug:"neutral",info:"info",warn:"warn",error:"err"},O=new WeakMap;function fe(e,s,r){const n=O.get(e);if(n&&n.locale===s)return n.row;const t={id:e.id,timestamp:q(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 O.set(e,{locale:s,row:t}),t}function xe(e,s,r,n,t,m=new Set,l){const p=o=>!!l&&A.indexOf(o)<A.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=M(),s=D[R()],r=G(),n=J(),[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 De(){const e=M(),s=Te(),r=b.useMemo(()=>[{id:"ts",label:e("ui.time"),minWidth:200,grow:0,drop:2,render:t=>!t.gap&&a.jsx(S,{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(S,{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{De as Logs};
@@ -1 +1 @@
import{j as e}from"./vendor-react-Bf71BWbF.js";import{u as s,ag as a,T as c}from"./index-BNBwb-FJ.js";import{d as i}from"./Virtualizer-DipGMcji.js";import{$ as b}from"./useFilter-jz02VVEB.js";import{$ as f}from"./ListLayout-F74Z1Dpf.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,ai as a,T as c}from"./index-Bw0aJc9a.js";import{d as i}from"./Virtualizer-DCY9HC9Z.js";import{$ as b}from"./useFilter-Tjznm3lB.js";import{$ as f}from"./ListLayout-_fDlx5XY.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};
@@ -0,0 +1,5 @@
import{r as y,j as o}from"./vendor-react-Bf71BWbF.js";import{u as ne,aT as Fn,L as On,B as X,aW as ke,bA as Be,a6 as Pe,a as me,aa as rn,ad as ln,ac as de,ae as In,af as dn,c_ as En,aI as $n,E as cn,j as Bn,ak as Wn,a_ as ee,bM as un,bN as qn,bP as Hn,aN as Un,bB as mn,bs as Vn,a3 as ye,bQ as zn,aL as ce,aO as Qn,br as pn,aJ as Kn,bS as Jn,aj as Xn,T as K,bt as Fe,y as Me,z as Yn,q as W,Q as fn,dN as Ze,U as je,dO as xe,V as Zn,F as es,dP as hn,dQ as ns,a9 as ss,M as Se,dR as bn,ay as as,b7 as os,as as ts,at as rs,a4 as en,aw as is,av as Le,a5 as Oe,bc as ls,cK as ds,bm as G,cT as ge,de as We,b as Ne,dd as cs,bg as us,dS as ms,by as ps,dT as nn,cS as fs,dU as hs,dV as bs,cO as vs,ap as gs,aF as ks,ag as ys,cP as js,dW as xs,dX as Ns,d9 as ws,bj as Ps,bk as Ms,a0 as Ge,dY as Ss,dZ as Ts,d_ as _s,cW as Cs,cU as sn,bx as As,ah as Ls,I as Gs,cN as an,du as Ds,dt as Rs}from"./index-Bw0aJc9a.js";import{F as Fs}from"./FactStrip-DtkOGBRy.js";import{u as Os,C as Is,p as Es}from"./layout-BWzq8YqC.js";import{D as vn,c as $s}from"./Table-Km6Zv-S8.js";import{T as Bs}from"./TimeCell-DKHUJpad.js";import{M as Ws}from"./ActionGroup-DLxTuKht.js";import{A as qs}from"./AddCircle-D11CyK2n.js";import{u as Hs}from"./outbounds-DMhWS-9H.js";import{p as Us,b as Vs}from"./policyText-CltaDVEo.js";import{a as Ie}from"./setup-DLvQ_6ZI.js";import{u as zs}from"./useRefreshAll-D0DryBsY.js";import{$ as Qs}from"./useFilter-Tjznm3lB.js";import{p as Ks}from"./probe-D0Quphno.js";import{o as Js,P as Xs}from"./openGroup-Dk9B33qx.js";import{n as Ys}from"./nav-DONyavaI.js";import"./useGridSelectionCheckbox-COXIVEmS.js";import"./Virtualizer-DCY9HC9Z.js";import"./ListLayout-_fDlx5XY.js";function on({kind:e,color:a}){return o.jsx("i",{className:"rp-marker "+e,style:a?{color:a}:void 0,"aria-hidden":"true"})}function Zs({label:e,groups:a,legend:n,max:s,fmt:l,limit:t=10,showAll:r}){const b=ne(),c=Fn(),{ref:i,tip:f,show:u,hide:h}=Os(),[d,m]=y.useState(new Set),p=[0,s/4,s/2,3*s/4,s],j=w=>Math.min(100,w/s*100);return o.jsxs("div",{className:"rp-markerplot rp-chart-hover",ref:i,onPointerLeave:h,role:"group","aria-label":e,"aria-describedby":c,children:[o.jsx("ul",{className:"legend",children:n.map(w=>o.jsxs("li",{children:[o.jsx(on,{kind:w.kind}),w.label]},w.kind))}),o.jsxs("div",{className:"axis","aria-hidden":"true",children:[o.jsx("span",{}),o.jsx("div",{className:"scale",children:p.map(w=>o.jsx("span",{style:{insetInlineStart:`${j(w)}%`},children:l(w)},w))}),o.jsx("span",{})]}),a.map(w=>o.jsxs("section",{"aria-label":w.label,children:[a.length>1&&o.jsx("h4",{className:"rp-label",children:w.label}),(d.has(w.id)?w.rows:w.rows.slice(0,t)).map(g=>{const P=Object.values(g.values).filter(x=>x!==void 0),C=j(Math.min(...P)),F=j(Math.max(...P));return o.jsxs("div",{className:"row",onPointerMove:x=>u(x,[g.label,...g.details]),children:[o.jsx("span",{className:"name",children:g.href?o.jsx(On,{appearance:"link",href:g.href,children:g.label}):g.label}),o.jsxs("div",{className:"track",role:"img","aria-label":g.label+b("ui.separator")+g.description,children:[p.map(x=>o.jsx("i",{className:"grid",style:{insetInlineStart:`${j(x)}%`}},x)),F>C&&o.jsx("i",{className:"span",style:{insetInlineStart:`${C}%`,width:`${F-C}%`}}),["tick","diamond","dot"].map(x=>g.values[x]===void 0?null:o.jsx("span",{className:"at "+x+(g.values[x]>s?" over":""),style:{insetInlineStart:`${j(g.values[x])}%`},children:o.jsx(on,{kind:x,color:x==="dot"?g.tone:void 0})},x))]}),o.jsx("span",{className:"value",children:g.text})]},g.id)}),!d.has(w.id)&&w.rows.length>t&&o.jsx("div",{className:"row more",children:o.jsx(X,{quiet:!0,small:!0,onPress:()=>m(g=>new Set([...g,w.id])),children:r(w.rows.length)})}),w.notes.map(g=>o.jsx("p",{className:"rp-note note",children:g},g))]},w.id)),o.jsx(Is,{tip:f})]})}function ea(e,a,n,s){const l=ke(s),t=new Map((a??[]).map(i=>[i.id,i.name])),r=new Map,b=(i,f)=>{let u=r.get(i);return u||r.set(i,u={id:i,label:f,rows:[],missing:[]}),u};for(const i of e){const f=Be(i),u=n==="protocol"?[["protocol:"+(i.protocol??""),i.protocol??null]]:i.group_ids.length?i.group_ids.map(h=>["group:"+h,t.get(h)??h]):[["group:",null]];for(const[h,d]of u){const m=b(h,d);f?.state==="healthy"&&f.latency_ms!==null?m.rows.push({id:i.id,name:i.name,latest:f.latency_ms,moving:f.moving_avg_ms,avg10:f.avg10_ms}):m.missing.push({id:i.id,name:i.name,state:f?.state==="unavailable"?"unavailable":"unmeasured"})}}const c=[...r.values()];for(const i of c)i.rows.sort((f,u)=>f.latest-u.latest||l(f.name,u.name)),i.missing.sort((f,u)=>l(f.name,u.name));return c.sort((i,f)=>(i.label===null?1:0)-(f.label===null?1:0)||l(i.label??"",f.label??""))}function na(e){const a=e.flatMap(n=>n.rows);return{moving:a.some(n=>n.moving!==null),avg10:a.some(n=>n.avg10!==null)}}function sa(e){const a=e.flatMap(l=>l.rows.flatMap(t=>[t.latest,t.moving??t.latest])).sort((l,t)=>l-t),n=Math.max(10,(Es(a,90)??0)*1.25),s=n<=100?20:n<=500?100:n<=2e3?500:1e3;return Math.ceil(n/s)*s}function aa(){const e=Pe[me()],a=rn().data?.resources,n=ln(de(a,Line truncated
`,r.from-1)+1,c=/^[ \t]*$/.test(e.slice(b,r.from))?b:r.from,i=l.children.find(p=>p.from===r.from);if(i){for(;n[t+1]?.from<i.to;)t++;if(i.line===i.endLine)continue;const p=fn(e,i,n),j=p.find(g=>g.name==="url"),w=p.find(g=>g.name==="interval");s.push({from:c,to:i.to,block:i,tag:i.name,host:j?we(W(j.value)):null,interval:w?ca(W(w.value)):null,fields:p,parts:null});continue}const f=n[t+1];f&&e.slice(f.from,f.to)===":"&&!e.slice(f.to).startsWith("//")&&(t+=2);const u=n[t];if(!u||u.from>=l.close)break;if(u.kind!=="quoted")for(;n[t+1]?.from===n[t].to&&!/[(){}]/.test(e.slice(n[t+1].from,n[t+1].to));)t++;if(e[n[t+1]?.from]==="(")for(t++;n[t+1]&&!(e[n[t].from]===")"&&n[t].parens===1);)t++;let h=n[t].to,d;n[t+1]?.kind==="comment"&&n[t+1].line===n[t].line&&(d=e.slice(n[t+1].from,n[t+1].to),h=n[++t].to);const m=ua(e.slice(c,h));m&&s.push({from:c,to:h,tag:m.tag,host:we(m.url),interval:null,fields:[],parts:m,comment:d})}return s}function ma(e){return yn(e).map(({tag:a,host:n,interval:s})=>({tag:a,host:n,interval:s}))}function pa(e,a,n){const s=yn(e).find(c=>c.tag===a);if(!s||s.interval===n)return e;const l=e.slice(s.from,s.to).match(/^[ \t]*/)?.[0]??" ",t=l+(l.includes(" ")?" ":" ");if(s.parts){const c=[`${l}${Zn(a)}: {`,`${t}url: ${je(s.parts.url)}`];return s.parts.ua!==null&&c.push(`${t}ua: ${je(s.parts.ua)}`),c.push(`${t}interval: '${n}s'`,`${l}}${s.comment?" "+s.comment:""}`),e.slice(0,s.from)+c.join(`
`)+e.slice(s.to)}const r=s.fields.find(c=>c.name==="interval");if(r)return e.slice(0,r.valueFrom)+` '${n}s'`+e.slice(r.valueTo);if(!s.block)return e;const b=e.lastIndexOf(`
`,s.block.close-1)+1;return e.slice(0,b)+`${t}interval: '${n}s'
`+e.slice(b)}function fa(e,a,n,s){const l=Be(e),t=l?.state==="healthy"&&l.latency_ms!=null;return{id:e.id,name:e.name,protocol:e.protocol??"—",latency:t?ee(l.latency_ms,s):l?.state==="unavailable"?s("ui.unavailable"):"—",latencyClass:t?`ms ${mn(l.latency_ms)??""}`.trimEnd():l?.state==="unavailable"?"ms err":"ms",groups:e.group_ids.length?ye(n,e.group_ids.map(r=>a.get(r)??r)):"—",probeLabel:s("nodes.probe",{name:e.name}),joinLabel:s("nodes.joinGroup",{name:e.name}),removeLabel:s("nodes.remove",{name:e.name})}}const ha=e=>ls(Be(e)),Ee=(e,a)=>Se(e).filter(n=>bn(n).subtags.includes(a)).map(n=>n.name),ba=(e,a)=>Se(e).some(n=>bn(n).rules.some(s=>Me(s).tokens.some(l=>(l.kind==="text"||l.kind==="quoted")&&W(s.slice(l.from,l.to))===a)));function va(e,a,n){return{here:Ee(a.content??"",n),elsewhere:e.filter(s=>s.id!==a.id&&Ee(s.content??"",n).length>0||ba(s.content??"",n))}}function ga(e,a,n,s){const l=new Map;for(const p of a){if(!p.provider_id||!p.subscription_tag)continue;const j=l.get(p.provider_id)??new Set;j.add(p.subscription_tag),l.set(p.provider_id,j)}const t=p=>{const j=l.get(p);return j?.size===1?[...j][0]:void 0},r=p=>{const j=we(p.url_redacted),w=j?n.filter(g=>g.host===j):[];return w.length===1?w[0].tag:void 0},b=new Map,c=e.filter(p=>p.kind==="subscription");for(const p of c){const j=t(p.id)??r(p);j&&b.set(p.id,j)}const i=c.filter(p=>!b.has(p.id)),f=new Set(b.values()),u=n.filter(p=>!f.has(p.tag));i.length===1&&u.length===1&&b.set(i[0].id,u[0].tag);const h=e.map(p=>{const j=t(p.id);return{...p,displayName:b.get(p.id)??p.name,configTag:p.kind==="subscription"&&j&&n.filter(w=>w.tag===j).length===1?j:void 0,sourceTag:p.kind==="subscription"?p.name:void 0}}),d={builtin:0,unattributed:0};for(const p of a)p.provider_id==null&&d[hn(p)]++;const m=[];for(const p of["builtin","unattributed"]){const j=d[p];j&&m.push({id:ns(p,e),name:s(p==="builtin"?"nodes.kind.builtin":"nodes.kind.unattributed"),kind:p,url_redacted:null,node_count:j,updated_at:null,expires_at:null,traffic:null,status:"ok",last_error:null})}return{list:[...m,...h]}}function ka(e,a){return a!==null&&e.some(n=>n.id===a)?a:(e.find(n=>n.kind!=="builtin"&&n.kind!=="unattributed")??e[0])?.id??null}function ya(e,a,n){return e.filter(s=>a===void 0||(a===null?s.provider_id==null&&hn(s)==="builtin"==(n==="builtin"):s.provider_id===a))}function ja(e,a){const n=new Map(e.map(s=>[s.id,s.displayName??s.name]));return s=>n.get(ss(s,a))??"—"}function xa(e,a,n,s,l,t,r){const b=a.trim(),c=e.filter(d=>(!b||t(d.name,b))&&(!n||d.group_ids.includes(n))&&(!s||d.protocol===s)),i=l.direction==="ascending"?1:-1,f=ke(r),u=l.column==="latency"?new Map(c.map(d=>[d.id,ha(d)])):new Map,h={name:(d,m)=>f(d.name,m.name),protocol:(d,m)=>f(d.protocol??"",m.protocol??""),latency:(d,m)=>ds(u.get(d.id),u.get(m.id))||f(d.name,m.name)};return c.sort((d,m)=>i*(h[l.column]??h.name)(d,m))}const $e=[3600,21600,43200,86400];function qe(e,a,n){return e===0?n("nodes.manualOnly"):$e.includes(e)?n("nodes.everyHours",{n:e/3600}):as(String(e),a)}function jn(e,a,n){return[0,...$e,...e===null||e===0||$e.includes(e)?[]:[e]].map(s=>({id:String(s),label:qe(s,a,n)}))}function Na(e,a){const n={name:e.name.trim(),kind:"subscription",url:e.value.trim()},s=Number(e.interval);a?.update_interval!==void 0&&e.interval&&s!==a.update_interval&&(n.update_interval=s);const l=e.agent.trim();return a?.user_agent!==void 0&&l&&l!==a.user_agent&&(n.user_agent=l),a?.cache!==void 0&&e.cache!==null&&e.cache!==a.cache&&(n.cache=e.cache),n}function wa(e,a,n,s){const l={subscription:"nodes.kind.subscription",file:"nodes.kind.file",inline:"nodes.kind.inline",builtin:"nodes.kind.builtin",unattributed:"nodes.kind.unattributed"},t={ok:"nodes.status.ok",stale:"nodes.status.stale",error:"nodes.status.error"},r={ok:"ok",stale:"warn",error:"err"},b=e.kind==="builtin"||e.kind==="unattributed",c=e.traffic?os(e.traffic.upload_bytes,e.traffic.download_bytes):null,i=e.kind==="subscription"?a:void 0,f=e.displayName??e.name;return{id:e.id,name:f,url:e.url_redacted??void 0,kind:en(l,e.kind,s),count:Oe(e.node_count,n),usage:c===null?"—":e.traffic?.total_bytes?s("ui.fraction",{part:Le(c,n),whole:Le(e.traffic.total_bytes,n)}):Le(c,n),updatedAt:b?null:e.updated_at,expires:e.expires_at?is(e.expires_at,n):"—",interval:i==null?"—":qe(i,n,s),intervalValue:i==null?"":String(i),hasInterval:i!==void 0,intervalLabel:s("nodes.intervalOf",{name:f}),intervals:i===void 0?[]:jn(i,n,s),status:b?null:en(t,e.status,s),tone:r[e.status],error:e.last_error?ts(rs(e.last_error.code,e.last_error.message,s),s):void 0,refreshLabel:s("nodes.refresh",{name:f}),removeLabel:s("nodes.remove",{name:f})}}const xn=e=>/^[a-z][a-z0-9+.-]*:\/\/\S+$/i.test(e.trim());function Pa(e,a,n,s){const l=a.trim();return e!=="provider"&&e!=="node"||!l&&!n.trim()?null:l?e==="node"?xn(n)?null:s("nodes.linkInvalid"):xe(l)?Ie(n)?null:s("nodes.urlInvalid"):s("nodes.nameInvalid"):s("nodes.nameMissing")}function Ma(e){const a=ne(),n=Pe[me()],{refresh:s}=e,l=new Map(e.entries.map(r=>[r.t Line truncated
@@ -1,5 +0,0 @@
import{r as j,j as t}from"./vendor-react-Bf71BWbF.js";import{u as U,aP as Qe,B as G,cB as ve,aS as q,a8 as _e,ab as Se,aa as ee,ac as Xe,a as ie,aE as Ye,E as Te,j as Ze,ai as en,aW as H,bx as Ce,by as nn,bA as sn,aJ as an,cv as Le,b4 as tn,a2 as De,aH as ne,aK as on,bn as Re,aF as rn,bD as ln,ah as $e,T as K,b5 as me,y as Ae,O as dn,q as se,U as cn,R as ke,F as un,da as Fe,db as mn,dc as Ge,av as pn,a$ as bn,ap as vn,aq as hn,a3 as Ne,at as fn,as as ce,a4 as ae,b6 as gn,cw as xn,a5 as he,be as C,cF as pe,cV as fe,b as ge,cU as jn,bf as yn,K as We,dd as kn,cL as Nn,de as we,cE as wn,ad as Pn,df as Mn,dg as _n,cC as Sn,dh as Tn,bi as Cn,bj as Ln,di as Dn,cG as Rn,br as $n,af as An,I as Fn,cA as Gn,d2 as Wn}from"./index-BNBwb-FJ.js";import{F as En}from"./FactStrip-n2q1T87k.js";import{u as In,C as Bn,p as On}from"./layout-wfdMYi2n.js";import{D as Ee,c as Hn}from"./Table-DyWJelc_.js";import{T as qn}from"./TimeCell-DUt0i0gi.js";import{A as Un}from"./AddCircle-CIj8X2wL.js";import{u as Vn}from"./outbounds-DPmb26w8.js";import{p as zn,b as Kn}from"./policyText-CmeXgUK2.js";import{a as Ie}from"./setup-d2VGFWY1.js";import{$ as Jn}from"./useFilter-jz02VVEB.js";import{p as Qn}from"./probe-BZEn7bbG.js";import{P as Xn}from"./PolicyPicker-BmHzmXzJ.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.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 Yn({label:e,groups:s,legend:n,max:a,fmt:l,limit:o=10,showAll:c}){const r=U(),u=Qe(),{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(G,{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(Bn,{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=Xe(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=U(),s=ie(),n=Ye(),{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.lenLine 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[Fe(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&&Fe(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"):Ge(l)?Ie(n)?null:a("nodes.urlInvalid"):a("nodes.nameInvalid"):a("nodes.nameMissing")}function js(e){const s=U(),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 S,j as t}from"./vendor-react-Bf71BWbF.js";import{an as K,ao as C,ap as I,aq as M,ar as $,as as x,at as B,a4 as g,au as G,av as J,aw as q,ax as z,u as O,a as Q,a5 as X,a8 as Y,ay as Z,aa as A,az as ee,aA as te,aB as ae,aC as se,aD as re,aE as oe,aF as y,E as L,L as P,aG as N,aH as F,aI as ie,aJ as w,aK as ne,ai as H,aL as le,aM as ce,j as T,aN as de,B as pe,aO as ue}from"./index-BNBwb-FJ.js";import{d as ve,e as me}from"./files-BxEOxSF8.js";import{D as he,t as V}from"./Table-DyWJelc_.js";import{A as fe}from"./ActionGroup-BKxDwmnT.js";import{D as xe}from"./DaeCode-B8yPDjSE.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";const W={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 W[o]?s(W[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,a,r=!1){const i=o.ebpf,n=i?.maps?.conn_state,c=(p,u)=>{const m=ge(u,r,e);return m?{label:e(p),value:E(u,e),help:m}:[e(p),E(u,e)]},d=i?.maps?.state??"unknown";return[c("ov.f.kind",o.kind),c("ov.f.state",o.state),...o.visibility==="partial"&&i?[]:[c("ov.f.visibility",o.visibility)],...i?[c("ov.f.backend",i.backend),c("ov.f.programs",i.programs),c("ov.f.hooks",i.hooks),c("ov.f.routing",i.routing.state),c("ov.f.health",i.health),...d==="partial"&&n&&!n.occupancy_known?[[e("ov.f.maps"),e("ov.mapCapacity",{capacity:g(n.capacity,a)})]]:[c("ov.f.maps",d),[e("ov.f.connState"),n?.occupancy_known&&n.occupancy!==null?e("ui.fraction",{part:g(n.occupancy,a),whole:g(n.capacity,a)}):n?e("ov.occupancyUnknown",{capacity:g(n.capacity,a)}):s]]]:[]]}const je={service:"ov.v.cgroupService",shared:"ov.v.cgroupShared"},ye={service:"ov.cgroupHelp.service",shared:"ov.cgroupHelp.shared"};function we(o,s,e,a=[],r=!1){const i=o.cgroup?.scope,n=p=>{const u=z(p??null);return u===null?"—":g(u,e)},c=[["ov.f.rss",x(o.process?.rss_bytes??null,e)],["ov.f.cgroupCurrent",x(o.cgroup?.current_bytes??null,e)],["ov.f.cgroupLimit",r&&o.cgroup?.limit_bytes===null?s("ov.noLimit"):x(o.cgroup?.limit_bytes??null,e)],["ov.f.cgroupScope",i&&i!=="unknown"?s(je[i]):"—"],["ov.f.oomHigh",n(o.cgroup?.events?.high)],["ov.f.oom",n(o.cgroup?.events?.oom)],["ov.f.oomKill",n(o.cgroup?.events?.oom_kill)],["ov.f.ebpfBytes",x(o.kernel?.ebpf_bytes??null,e)]],d=[...a,...i==="unknown"?["ov.f.cgroupScope"]:[],...o.kernel?[]:["ov.f.ebpfBytes"]];return c.filter(([p])=>!d.includes(p)).map(([p,u])=>p==="ov.f.cgroupScope"&&i&&i!=="unknown"?{label:s(p),value:u,help:{title:s(p),text:s("ui.valuePair",{label:u,value:s(ye[i])})}}:[s(p),u])}function ke(o,s,e,a){const{capabilities:r,runtime:i,version:n,memory:c,datapath:d,limits:p=[]}=o,u=i?.lifecycle.state,m=i?.generation.config_revision??i?.generation.active_id??"—",v=i?.last_reload,k=i?.process.cpu_percent,b=K(c?.cgroup?.current_bytes??null,c?.cgroup?.limit_bytes??null),h=l=>l===null?"—":g(l,e),f=(l,j)=>l?"ready":j?"loading":"unavailable";return{status:q(u,d?.state,a(s.capabilities||s.runtime?"ov.loading":"ov.unknown"),a),strip:[{label:a("ov.config"),value:G(m),full:m,help:{title:a("ov.config"),text:a("ov.configHelp")}},[a("ov.uptime"),J(i?.lifecycle.uptime_seconds??null,e)],[a("ov.cpu"),k==null?"—":a("ui.percent",{n:g(k,e,1)})],[a("ov.lastReload"),v?B(v.finished_at,e):"—"]],reload:v?{tooltip:v.operation_id,tone:v.status==="succeeded"?"ok":v.status==="failed"?"err":"warn",text:a(v.status==="succeeded"?"ov.succeeded":v.status==="failed"?"ov.failed":"ov.running")}:null,engine:{state:f(!!n,s.version),fields:n?[[a("ov.f.engine"),n.engine.name+" "+n.engine.version],[a("ov.f.api"),a("ui.apiVersion",{name:n.api.name,major:n.api.major,status:n.api.status})],[a("ov.f.build"),[n.build?.revision,n.build?.target].filter(Boolean).join(a("ui.separator"))||"—"],[a("ov.f.instance"),i?.instance_id??"—"],[a("ov.f.started"),B(i?.lifecycle.started_at??null,e)],[a("ov.f.activated"),B(i?.generation.activated_at??null,e)]]:[],profiles:r?.profiles.map(l=>({id:l,text:a(l==="base"?"ov.profileBase":"ov.profileFull")}))??[]},counters:{state:f(!!i,s.capabilities||s.runtime),fields:i?[[a("ov.f.tcp"),h(i.traffic.connections.tcp)],[a("ov.f.udp"),h(i.traffic.connections.udp)],[a("ov.f.total"),h(i.traffic.connections.total)],[a("ui.upload"),x(i.traffic.bytes.upload,e)],[a("ui.download"),x(i.traffic.bytes.download,e)],{label:a("ov.f.rateWindLine truncated
@@ -0,0 +1 @@
import{r as B,j as t}from"./vendor-react-Bf71BWbF.js";import{ap as K,aq as $,ar as I,as as P,at as M,au as G,av as b,aw as D,ax as J,ay as z,az as Q,aA as X,h as u,a5 as _,aB as Y,u as T,a as Z,a6 as ee,aa as te,aC as ae,ac as R,aD as se,aE as re,aF as oe,aG as ie,aH as ne,aI as ce,aJ as w,E as N,L as V,aK as H,aL as A,aM as le,aN as k,aO as de,ak as S,aP as pe,aQ as ue,j as U,aR as ve,B as me,aS as he}from"./index-Bw0aJc9a.js";import{d as fe,e as ge}from"./files-BxEOxSF8.js";import{D as xe,t as O}from"./Table-Km6Zv-S8.js";import{A as be}from"./ActionGroup-DLxTuKht.js";import{D as ye}from"./DaeCode-B8yPDjSE.js";import"./useGridSelectionCheckbox-COXIVEmS.js";import"./Virtualizer-DCY9HC9Z.js";import"./ListLayout-_fDlx5XY.js";const je={connections:u("connections",{tab:"list"}),flows:u("flows",{tab:"records"}),routing_trace:u("rules",{tab:"trace"}),dns_query:u("dns",{tab:"query"}),dns_cache:u("dns",{tab:"cache"}),dns_log:u("dns",{tab:"log"}),events:u("events"),probes:u("nodes",{tab:"latency"}),traffic_history:u("activity"),memory_history:u("activity"),runtime_outbounds:u("activity"),logs:u("logs"),providers:u("nodes"),rules:u("rules",{tab:"list"}),config:u("config"),config_validate:u("config",{tab:"validate"}),runtime_settings:u("settings",{card:"runtime"}),geodata:u("settings",{card:"geodata"})},W={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 F(o,s){return W[o]?s(W[o]):o}function we(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 ke(o,s,e,a){if(o!=="unknown"||!s.length)return;const r=new Intl.ListFormat(a,{type:"conjunction"}).format(s);return{title:e("ov.v.notVerified"),text:e("ov.notVerifiedHelp",{hooks:r})}}function _e(o,s,e,a,r=!1,i=[]){const c=o.ebpf,d=c?.maps?.conn_state,l=(f,h)=>{const v=we(h,r,e);return v?{label:e(f),value:F(h,e),help:v}:[e(f),F(h,e)]},p=c?.maps?.state??"unknown",m=c&&ke(c.hooks,i,e,a);return[l("ov.f.kind",o.kind),l("ov.f.state",o.state),...o.visibility==="partial"&&c?[]:[l("ov.f.visibility",o.visibility)],...c?[l("ov.f.backend",c.backend),l("ov.f.programs",c.programs),m?{label:e("ov.f.hooks"),value:e("ov.v.notVerified"),help:m}:l("ov.f.hooks",c.hooks),l("ov.f.routing",c.routing.state),l("ov.f.health",c.health),...p==="partial"&&d&&!d.occupancy_known?[[e("ov.f.maps"),e("ov.mapCapacity",{capacity:_(d.capacity,a)})]]:[l("ov.f.maps",p),[e("ov.f.connState"),d?.occupancy_known&&d.occupancy!==null?e("ui.fraction",{part:_(d.occupancy,a),whole:_(d.capacity,a)}):d?e("ov.occupancyUnknown",{capacity:_(d.capacity,a)}):s]]]:[]]}const Le={service:"ov.v.cgroupService",shared:"ov.v.cgroupShared"},Ne={service:"ov.cgroupHelp.service",shared:"ov.cgroupHelp.shared"};function He(o,s,e,a=[],r=!1){const i=o.cgroup?.scope,c=p=>{const m=Y(p??null);return m===null?"—":_(m,e)},d=[["ov.f.rss",b(o.process?.rss_bytes??null,e)],["ov.f.cgroupCurrent",b(o.cgroup?.current_bytes??null,e)],["ov.f.cgroupLimit",r&&o.cgroup?.limit_bytes===null?s("ov.noLimit"):b(o.cgroup?.limit_bytes??null,e)],["ov.f.cgroupScope",i&&i!=="unknown"?s(Le[i]):"—"],["ov.f.oomHigh",c(o.cgroup?.events?.high)],["ov.f.oom",c(o.cgroup?.events?.oom)],["ov.f.oomKill",c(o.cgroup?.events?.oom_kill)],["ov.f.ebpfBytes",b(o.kernel?.ebpf_bytes??null,e)]],l=[...a,...i==="unknown"?["ov.f.cgroupScope"]:[],...o.kernel?[]:["ov.f.ebpfBytes"]];return d.filter(([p])=>!l.includes(p)).map(([p,m])=>p==="ov.f.cgroupScope"&&i&&i!=="unknown"?{label:s(p),value:m,help:{title:s(p),text:s("ui.valuePair",{label:m,value:s(Ne[i])})}}:[s(p),m])}function Se(o,s,e,a){const{capabilities:r,runtime:i,version:c,memory:d,datapath:l,limits:p=[]}=o,m=K(c).uncheckedHooks,f=i?.lifecycle.state,h=i?.generation.config_revision??"—",v=i?.last_reload,y=$(d?.cgroup?.current_bytes??null,d?.cgroup?.limit_bytes??null),g=n=>n===null?"—":_(n,e),x=(n,j)=>n?"ready":j?"loading":"unavailable";return{status:X(f,l?.state,a(s.capabilities||s.runtime?"ov.loading":"ov.unknown"),a),strip:[{label:a("ov.config"),value:J(h),full:h,help:{title:a("ov.config"),text:a("config.revisionHelp")}},[a("ov.uptime"),z(i?.lifecycle.uptime_seconds??null,e)],[a("ov.cpu"),Q(i?.process.cpu_percent,a)],[a("ov.lastReload"),v?D(v.finished_at,e):"—"]],reload:v?{tooltip:v.operation_id,tone:v.status==="succeeded"?"ok":v.status==="failed"?"err":"warn",text:a(v.status==="succeeded"?"ov.succeeded":v.status==="failed"?"ov.failed":"ov.running")}:null,engine:{state:Line truncated
@@ -0,0 +1,2 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Arrange-BwxzZLbt.js","./vendor-react-Bf71BWbF.js","./index-Bw0aJc9a.js","./index-7R3bVGRM.css","./Virtualizer-DCY9HC9Z.js","./ListLayout-_fDlx5XY.js","./DaeCode-B8yPDjSE.js","./policyText-CltaDVEo.js","./openGroup-Dk9B33qx.js","./useFilter-Tjznm3lB.js","./ActionGroup-DLxTuKht.js","./useGridSelectionCheckbox-COXIVEmS.js","./nav-BASDWt23.js","./Arrange-Dd3j3leY.css"])))=>i.map(i=>d[i]);
import{bT as it,bU as ot,bV as rt,bW as pe,bX as te,bY as Ie,bZ as nt,b_ as at,b$ as lt,c0 as st,c1 as je,c2 as re,c3 as ne,c4 as me,c5 as G,c6 as W,c7 as q,c8 as ee,c9 as ct,ca as ae,cb as Ke,cc as dt,cd as ut,ce as He,cf as pt,cg as de,ch as fe,ci as Oe,cj as ue,ck as ft,cl as ke,cm as Se,cn as he,co as be,cp as Fe,cq as ht,cr as bt,cs as mt,ct as Be,cu as gt,cv as yt,cw as le,cx as vt,cy as xt,cz as $t,cA as kt,cB as wt,cC as Pt,cD as It,cE as St,cF as Et,cG as Dt,cH as Mt,cI as jt,M as Ct,b as ce,cJ as Nt,a4 as _t,bc as Ge,bB as Tt,a_ as Lt,K as zt,cK as At,aW as Rt,a5 as Kt,u as B,a6 as Ht,a as Ot,ak as we,bC as Ft,cL as ge,c as ye,T as Ee,br as Bt,cM as Gt,cN as Ue,ah as Ve,I as Ut,B as Y,aj as Vt,bd as Wt,aa as qt,ae as Yt,ac as ve,ad as Xt,bA as Jt,cO as Qt,ag as Zt,cP as ei,bj as ti,bk as ii,cQ as oi,bL as ri,cR as We,cS as qe,R as ni,bm as U,cT as ai,cU as li,bg as si,cV as ci,cW as di,A as ui,E as Ye,cX as pi,bx as fi,j as Xe,aN as hi,bQ as bi,aO as mi,aJ as se,bw as gi,cY as yi,aK as vi,bs as xi,cZ as $i,_ as ki}from"./index-Bw0aJc9a.js";import{r as f,$ as S,j as c}from"./vendor-react-Bf71BWbF.js";import{M as wi}from"./ActionGroup-DLxTuKht.js";import{$ as Pi,a as Ii,b as Si,c as Ei,d as Di}from"./useGridSelectionCheckbox-COXIVEmS.js";import{$ as Mi,a as F,b as xe,c as J,d as ji}from"./Virtualizer-DCY9HC9Z.js";import{$ as Ci}from"./useFilter-Tjznm3lB.js";import{g as Ni,a as _i}from"./policyText-CltaDVEo.js";import{P as Ti,o as Li}from"./openGroup-Dk9B33qx.js";import{p as Je}from"./nav-BASDWt23.js";const De=new WeakMap;function Pe(i,t){let{id:e}=De.get(i)??{};if(!e)throw new Error("Unknown list");return`${e}-${zi(t)}`}function zi(i){return typeof i=="string"?i.replace(/\s*/g,""):""+i}function Ai(i,t,e){let{isVirtualized:o,keyboardDelegate:r,layoutDelegate:n,onAction:s,disallowTypeAhead:l,linkBehavior:a="action",keyboardNavigationBehavior:p="arrow",escapeKeyBehavior:d="clearSelection",shouldSelectOnPressUp:v}=i;!i["aria-label"]&&!i["aria-labelledby"]&&console.warn("An aria-label or aria-labelledby prop is required for accessibility.");let{listProps:h}=it({selectionManager:t.selectionManager,collection:t.collection,disabledKeys:t.disabledKeys,ref:e,keyboardDelegate:r,layoutDelegate:n,isVirtualized:o,selectOnFocus:t.selectionManager.selectionBehavior==="replace",shouldFocusWrap:i.shouldFocusWrap,linkBehavior:a,disallowTypeAhead:l,autoFocus:i.autoFocus,escapeKeyBehavior:d,UNSTABLE_focusOnEntry:i.UNSTABLE_focusOnEntry}),g=ot(i.id);De.set(t,{id:g,onAction:s,linkBehavior:a,keyboardNavigationBehavior:p,shouldSelectOnPressUp:v});let x=Pi({selectionManager:t.selectionManager,hasItemActions:!!s}),P=rt(e,{isDisabled:t.collection.size!==0}),m=pe(i,{labelable:!0}),b=te(m,{role:"grid",id:g,"aria-multiselectable":t.selectionManager.selectionMode==="multiple"?"true":void 0},t.collection.size===0?{tabIndex:P?-1:0}:h,x);return o&&(b["aria-rowcount"]=t.collection.size,b["aria-colcount"]=1),Ii({},t),{gridProps:b}}const Ce={expand:{ltr:"ArrowRight",rtl:"ArrowLeft"},collapse:{ltr:"ArrowLeft",rtl:"ArrowRight"}};function Ri(i,t,e){let{node:o,isVirtualized:r,focusMode:n="row",allowsArrowNavigation:s}=i,{direction:l}=Ie(),{onAction:a,linkBehavior:p,keyboardNavigationBehavior:d,shouldSelectOnPressUp:v}=De.get(t),h=nt(),g=f.useRef(null),x=()=>{if(e.current!==null){if(n==="child"){if(je(e.current)&&e.current!==re(ne(e.current)))return;let D=me(e.current,{tabbable:!0}).firstChild();if(D){G(D),W(D,{containingElement:q(D)});return}}(g.current!=null&&o.key!==g.current||!je(e.current))&&G(e.current)}},P={},m=i.hasChildItems,b=t.selectionManager.isLink(o.key);if(o!=null&&"expandedKeys"in t){let u=t.collection.getChildren?.(o.key);m=m||[...u??[]].length>1,a==null&&!b&&t.selectionManager.selectionMode==="none"&&m&&(a=()=>t.toggleKey(o.key));let D=m?t.expandedKeys.has(o.key):void 0,w=1,j=o.index;if(o.level>=0&&o?.parentKey!=null){let C=t.collection.getItem(o.parentKey);if(C){let z=Ki(C,t.collection);w=[...z].filter(R=>R.type==="item").length,j>0&&z[0].type!=="item"&&(j-=1)}}else w=[...t.collection].filter(C=>C.level===0&&C.type==="item").length;P={"aria-expanded":D,"aria-level":o.level+1,"aria-posinset":j+1,"aria-setsize":w}}let{itemProps:$,...I}=at({selectionManager:t.selectionManager,key:o.key,ref:e,isVirtualized:r,shouldSelectOnPressUp:i.shouldSelectOnPressUp||v,onAction:a||o.props?.onAction?lt(o.props?.onAction,a?()=>a(o.key):void 0):void 0,focus:x,linkBehavior:p}),M=u=>{let D=re(ne(e.current));if(!ae(u.currentTarget,ee(u))||!e.current||!D)return;let w=me(e.current);if(w.currentNode=D,!Ne(u,t,o,m,l,D,e.current,s))switch(u.key){case"ArrowLeft":if(d==="arrow"){let j=l==="rtl"?w.nextNode():w.previousNode();if(j)u.preventDefault(),u.stopPropagation(),G(j),W(j,{containingElement:q(e.current)});else if(u.preventDefault(),u.stopPropagation(),l==="rtl")G(e.current),W(e.current,{containingElement:q(e.current)});else{w.currentNode=e.current;let C=_e(w);C&&(G(C),W(C,{containingElement:q(e.current)}))}}break;case"ArrowRight":if(d==="arrow"){lLine truncated
@@ -1,2 +0,0 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Arrange-BvqJLS4m.js","./vendor-react-Bf71BWbF.js","./index-BNBwb-FJ.js","./index-C8vJM6q6.css","./Virtualizer-DipGMcji.js","./ListLayout-F74Z1Dpf.js","./DaeCode-B8yPDjSE.js","./policyText-CmeXgUK2.js","./PolicyPicker-BmHzmXzJ.js","./useFilter-jz02VVEB.js","./useGridSelectionCheckbox-CrCOlZv8.js","./Arrange-Dd3j3leY.css"])))=>i.map(i=>d[i]);
import{bE as et,bF as tt,bG as it,bH as pe,bI as ie,bJ as Pe,bK as rt,bL as at,bM as ot,bN as nt,bO as De,bP as oe,bQ as ne,bR as me,bS as V,bT as q,bU as J,bV as ee,bW as lt,bX as le,bY as Ke,bZ as st,b_ as ct,b$ as He,c0 as dt,c1 as de,c2 as fe,c3 as Fe,c4 as ue,c5 as ut,c6 as $e,c7 as Ie,c8 as he,c9 as be,ca as Oe,cb as pt,cc as ft,cd as ht,ce as Be,cf as bt,cg as mt,ch as se,ci as gt,cj as yt,ck as vt,cl as xt,cm as $t,cn as kt,co as wt,cp as Pt,cq as It,cr as St,cs as Et,ct as Dt,b as te,cu as Mt,a3 as jt,b6 as Ge,cv as Ct,aW as Nt,J as Tt,cw as _t,aS as Lt,a4 as zt,u as G,a5 as At,a as Rt,ai as ke,cx as Kt,cy as ge,c as ye,T as Se,bn as Ht,cz as Ft,cA as Ve,af as Ue,I as Ot,B as A,ah as Bt,b7 as Gt,a8 as Vt,ac as Ut,aa as Me,ab as Wt,cB as qt,cC as Jt,K as Yt,bi as Qt,bj as Xt,bw as Zt,cD as We,cE as qe,Q as ei,be as U,cF as ti,cG as ii,bf as ri,cH as ai,A as oi,E as Je,j as je,cI as ni,br as li,aJ as si,cJ as ci,_ as di,bB as ui,aK as pi,aF as ce,bq as fi,bD as hi,cK as bi,aG as mi,b4 as gi}from"./index-BNBwb-FJ.js";import{r as g,$ as P,j as l}from"./vendor-react-Bf71BWbF.js";import{$ as yi,a as vi,b as xi,c as $i,d as ki}from"./useGridSelectionCheckbox-CrCOlZv8.js";import{$ as wi,a as B,b as ve,c as Q,d as Pi}from"./Virtualizer-DipGMcji.js";import{$ as Ii}from"./useFilter-jz02VVEB.js";import{g as Si,a as Ei}from"./policyText-CmeXgUK2.js";import{P as Di}from"./PolicyPicker-BmHzmXzJ.js";const Ee=new WeakMap;function we(i,t){let{id:e}=Ee.get(i)??{};if(!e)throw new Error("Unknown list");return`${e}-${Mi(t)}`}function Mi(i){return typeof i=="string"?i.replace(/\s*/g,""):""+i}function ji(i,t,e){let{isVirtualized:r,keyboardDelegate:a,layoutDelegate:n,onAction:s,disallowTypeAhead:c,linkBehavior:o="action",keyboardNavigationBehavior:d="arrow",escapeKeyBehavior:p="clearSelection",shouldSelectOnPressUp:m}=i;!i["aria-label"]&&!i["aria-labelledby"]&&console.warn("An aria-label or aria-labelledby prop is required for accessibility.");let{listProps:x}=et({selectionManager:t.selectionManager,collection:t.collection,disabledKeys:t.disabledKeys,ref:e,keyboardDelegate:a,layoutDelegate:n,isVirtualized:r,selectOnFocus:t.selectionManager.selectionBehavior==="replace",shouldFocusWrap:i.shouldFocusWrap,linkBehavior:o,disallowTypeAhead:c,autoFocus:i.autoFocus,escapeKeyBehavior:p,UNSTABLE_focusOnEntry:i.UNSTABLE_focusOnEntry}),f=tt(i.id);Ee.set(t,{id:f,onAction:s,linkBehavior:o,keyboardNavigationBehavior:d,shouldSelectOnPressUp:m});let h=yi({selectionManager:t.selectionManager,hasItemActions:!!s}),$=it(e,{isDisabled:t.collection.size!==0}),b=pe(i,{labelable:!0}),v=ie(b,{role:"grid",id:f,"aria-multiselectable":t.selectionManager.selectionMode==="multiple"?"true":void 0},t.collection.size===0?{tabIndex:$?-1:0}:x,h);return r&&(v["aria-rowcount"]=t.collection.size,v["aria-colcount"]=1),vi({},t),{gridProps:v}}const Ce={expand:{ltr:"ArrowRight",rtl:"ArrowLeft"},collapse:{ltr:"ArrowLeft",rtl:"ArrowRight"}};function Ci(i,t,e){let{node:r,isVirtualized:a,focusMode:n="row",allowsArrowNavigation:s}=i,{direction:c}=Pe(),{onAction:o,linkBehavior:d,keyboardNavigationBehavior:p,shouldSelectOnPressUp:m}=Ee.get(t),x=rt(),f=g.useRef(null),h=()=>{if(e.current!==null){if(n==="child"){if(De(e.current)&&e.current!==oe(ne(e.current)))return;let E=me(e.current,{tabbable:!0}).firstChild();if(E){V(E),q(E,{containingElement:J(E)});return}}(f.current!=null&&r.key!==f.current||!De(e.current))&&V(e.current)}},$={},b=i.hasChildItems,v=t.selectionManager.isLink(r.key);if(r!=null&&"expandedKeys"in t){let u=t.collection.getChildren?.(r.key);b=b||[...u??[]].length>1,o==null&&!v&&t.selectionManager.selectionMode==="none"&&b&&(o=()=>t.toggleKey(r.key));let E=b?t.expandedKeys.has(r.key):void 0,w=1,D=r.index;if(r.level>=0&&r?.parentKey!=null){let M=t.collection.getItem(r.parentKey);if(M){let R=Ni(M,t.collection);w=[...R].filter(K=>K.type==="item").length,D>0&&R[0].type!=="item"&&(D-=1)}}else w=[...t.collection].filter(M=>M.level===0&&M.type==="item").length;$={"aria-expanded":E,"aria-level":r.level+1,"aria-posinset":D+1,"aria-setsize":w}}let{itemProps:I,...j}=at({selectionManager:t.selectionManager,key:r.key,ref:e,isVirtualized:a,shouldSelectOnPressUp:i.shouldSelectOnPressUp||m,onAction:o||r.props?.onAction?ot(r.props?.onAction,o?()=>o(r.key):void 0):void 0,focus:h,linkBehavior:d}),_=u=>{let E=oe(ne(e.current));if(!le(u.currentTarget,ee(u))||!e.current||!E)return;let w=me(e.current);if(w.currentNode=E,!Ne(u,t,r,b,c,E,e.current,s))switch(u.key){case"ArrowLeft":if(p==="arrow"){let D=c==="rtl"?w.nextNode():w.previousNode();if(D)u.preventDefault(),u.stopPropagation(),V(D),q(D,{containingElement:J(e.current)});else if(u.preventDefault(),u.stopPropagation(),c==="rtl")V(e.current),q(e.current,{containingElement:J(e.current)});else{w.currentNode=e.current;let M=Te(w);M&&(V(M),q(M,{containingElement:J(e.current)}))}}break;case"ArrowRight":if(p==="arrow"){let D=c==="rtl"?w.previousNode():w.nextNode();if(D)u.preventDefault(),u.stopPropagation(),V(D),q(D,{containingElement:JLine truncated
@@ -1 +0,0 @@
import{j as i}from"./vendor-react-Bf71BWbF.js";import{u as a,b5 as l}from"./index-BNBwb-FJ.js";import{c as m}from"./policyText-CmeXgUK2.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};
@@ -0,0 +1 @@
import{r as g,j as i}from"./vendor-react-Bf71BWbF.js";import{bk as ds,bA as us,a_ as cs,a3 as ee,a4 as Ie,by as Fe,aX as ps,h as be,c_ as ms,ac as C,c$ as bs,aw as qe,a6 as de,d0 as Oe,d1 as hs,d2 as fs,d3 as gs,q as xs,a7 as We,d4 as Ve,d5 as Ue,d6 as ys,a5 as ve,a0 as _e,d7 as ks,d8 as js,d9 as Be,y as vs,da as _s,db as Qe,dc as ws,bg as Ns,u as O,a as we,bG as Rs,aa as ue,ae as Ke,ad as Ls,dd as Cs,af as Hs,bH as qs,bm as oe,bq as Ss,Y as fe,bz as Ds,b3 as Ms,de as $e,c as Ps,df as Ts,dg as Es,cS as As,dh as Is,di as Fs,dj as Os,dk as Ws,ag as Ne,dl as Vs,dm as Ge,dn as Je,dp as ze,dq as Ye,dr as Xe,aL as he,aO as Ze,B,ds as Us,aj as Se,bt as ae,cN as Bs,bQ as es,aN as se,I as Qs,E as Re,dt as Ks,bs as ss,T as $,du as $s,bw as Gs,aJ as ns,bK as Js,dv as De,L as ke,bh as zs,bj as Ys,j as Xs,bx as Zs,bb as en,cY as sn,bR as nn,aK as ge}from"./index-Bw0aJc9a.js";import{u as rs,r as rn,b as tn,a as on}from"./flows-D3eabARZ.js";import{q as an}from"./dns-BCg5F0Tv.js";import{i as Me}from"./setup-DLvQ_6ZI.js";import{c as ln,C as dn}from"./Coverage-DhDWz2sB.js";import{w as un}from"./labels-Bgu_ZhL8.js";import{r as cn}from"./nav-xc_Z_1Qd.js";import{r as pn}from"./recorder-DlDpPhd4.js";import{p as mn}from"./probe-D0Quphno.js";import{u as bn,R as hn}from"./useQuickRule-BmFeKwTA.js";import{D as Le}from"./Table-Km6Zv-S8.js";import{D as Z}from"./DaeCode-B8yPDjSE.js";import"./useGridSelectionCheckbox-COXIVEmS.js";import"./Virtualizer-DCY9HC9Z.js";import"./ListLayout-_fDlx5XY.js";function is(e){const s=new Map;for(const t of e){const o=t.rule_id,a=o===null?null:t.rule_expression,c=t.rule_source,r=JSON.stringify([o,a,c]),d=s.get(r);d?d.count++:s.set(r,{id:o,expression:a,source:c,count:1,share:0})}const n=[...s.values()];for(const t of n)t.share=t.count/e.length;return n.sort((t,o)=>o.count-t.count)}const fn={domainSuffix:"example.com, example.org",domain:"www.example.com",geosite:"netflix, cn",dip:"10.0.0.0/8, 224.0.0.0/4",geoip:"cn, private",sip:"192.168.1.10",dport:"80, 443",sport:"53",pname:"curl, firefox",l4proto:"udp",qnameSuffix:"example.com, lan",qnameFull:"www.example.com",qnameKeyword:"tracker",qnameGeosite:"cn, category-ads-all",qtype:"A, AAAA, HTTPS",upstream:"alidns",answerIp:"0.0.0.0/32, 10.0.0.0/8",answerGeoip:"cn, private"},xe={kernel:"rule.sourceKernel",recomputed:"rule.sourceRecomputed",unknown:"rule.sourceUnknown"},gn={kernel:"rule.sourceHelp.kernel",recomputed:"rule.sourceHelp.recomputed",unknown:"rule.sourceHelp.unknown"};function ts(e,s){return s?Be(s):e.file==="<redacted>"?"":e.file}const Pe=(e,s,n)=>e?n("conn.ruleNoPosition"):s?n("ui.changeApplying"):void 0,xn={conditionInvalid:"rule.conditionInvalid",targetMissing:"rule.outboundMissing"};function yn(e,s,n,t=xn){return e.valid?s?null:n(t.targetMissing):e.mode==="pick"?e.pickError??n("rule.valuesMissing"):n(e.rawInvalid?t.conditionInvalid:"rule.conditionMissing")}function kn({loaded:e,busy:s,available:n,invalid:t,modeOffered:o},a){return!e||s?null:n?t?a(t):o?null:a("rule.resolveUnavailable"):a("rule.traceUnavailable")}function os(e,s,n,t,o,a,c=null){const r=de[a],d=new Map(s.map(p=>[p.id,p])),f=p=>{if(p)return d.get(p.source_id)},b=new Map,y=p=>{const u=p.source&&d.get(p.source.source_id);return u?u.writable?(b.has(u.id)||b.set(u.id,vs(u.content)),n(u,p,b.get(u.id))!==null?null:u.kind==="include"?o("rule.inInclude",{file:Be(u)}):o("rule.notLocated")):o("config.readOnlyAttempt"):o("rule.notLocated")},h=e.map(p=>{const u=f(p.source),L=p.source?ts(p.source,u):"",k=y(p);return{id:p.rule_id,number:p.kind==="fallback"?"—":ve(p.index+1,r),expression:p.expression,...t(p),position:p.source?L?`${L}:${p.source.line}`:o("rule.lineOnly",{n:p.source.line}):"—",removable:p.kind==="rule"&&k===null,editReason:k,removeReason:p.kind==="rule"?k:null,sourceQuery:u&&p.source?_e("",{tab:"source",source:u.id,line:String(p.source.line)}):null}}),x=e.find(p=>p.kind==="fallback");return{rows:h,positions:[...x?.source?y(x)===null?[{id:"end",label:o("rule.positionEnd")}]:[]:c?[c]:[],...e.filter((p,u)=>h[u].removable).map(p=>({id:p.rule_id,label:o("rule.positionBefore",{n:p.index+1}),desc:p.expression}))]}}function jn(e,s,n,t,o,a,c){const r=de[c],d=new Map(e.map(b=>[b.rule_id,b.expression])),f=new Map;for(const b of is(n?.flows??[]))b.id!==null&&d.get(b.id)===b.expression&&f.set(b.id,(f.get(b.id)??0)+b.count);return{...os(e,t,Qe,b=>({outbound:b.outbound??"",must:b.must,hits:f.has(b.rule_id)?ve(f.get(b.rule_id),r):"—"}),a,c),caption:s!==void 0?a("rule.dictionaryCaption",{n:e.length,generation:s}):null,outbounds:ys(o)}}function vn(e){const s=/\s*->\s*('[^']*'|"[^"]*"|\S+)$/.exec(e.expression);return e.kind==="rule"&&s&&s[1].toLowerCase()===We(e).toLowerCase()?e.expression.slice(0,s.index):e.expression}function _n(e,s,n,t,o,a){const c=Oe(t,e),r=[...new Set(hs(s,t).map(d=>d.name))];return{...os(s,t,(d,f,b)=>Ve(d,f,e,b),d=>({expression:vn(d),outbound:xs(We(d)),must:!1,hits:"—"}),o,a,c&&{id:"end",...gs(c.anchor,e,o)}),caption:n!==void 0?o("rule.dictionaryCaption",{n:s.length,gLine truncated
@@ -1 +0,0 @@
import{r as w,j as r}from"./vendor-react-Bf71BWbF.js";import{cL as He,Y as Je,cM as Ye,cB as Xe,b6 as vn,aY as re,a3 as K,b0 as _n,b1 as Nn,a5 as ee,at as ze,h as Mn,aT as ke,a2 as X,ax as Ln,a4 as oe,cv as Sn,aW as Ze,bj as Rn,$ as W,bi as Cn,G as Tn,cN as en,q as nn,cO as sn,cP as tn,cQ as rn,bb as Pn,cR as In,cS as Hn,y as Dn,cT as Fn,b8 as on,u as E,a as be,bs as En,a8 as le,ac as De,aa as F,ab as an,cU as On,bt as qn,be as me,b as An,X as Le,cV as ln,aH as J,aF as xe,cW as Wn,b9 as Bn,cE as Un,cX as Vn,cY as $n,cZ as Qn,ae as dn,c_ as Gn,c$ as Kn,bd as Jn,d0 as Yn,aK as fe,B,d1 as Xn,ah as we,b5 as te,cA as zn,bB as cn,aJ as ae,I as Zn,E as ie,d2 as es,b4 as je,T as Y,bq as ns,d3 as qe,aQ as ss,cx as ts,c as Ae,f as rs,bm as os,b3 as as,bp as is,j as Fe,aG as ye,L as We,ai as un,bg as ls,br as ds,cK as cs,bC as us}from"./index-BNBwb-FJ.js";import{u as ve,r as ps,a as Ee,b as ms,c as fs}from"./flows-CMFlFH_d.js";import{q as bs}from"./dns-CvJ19DpX.js";import{i as Be}from"./setup-d2VGFWY1.js";import{w as A}from"./labels-Bgu_ZhL8.js";import{g as hs}from"./policyText-CmeXgUK2.js";import{a as gs,t as xs,b as ws,p as pn,r as ys}from"./link-CIkWI7An.js";import{r as ks}from"./nav-DKmRxmdR.js";import{r as js}from"./recorder-DlDpPhd4.js";import{p as vs}from"./probe-BZEn7bbG.js";import{D as _e}from"./Table-DyWJelc_.js";import{D as se}from"./DaeCode-B8yPDjSE.js";import{T as _s}from"./TimeCell-DUt0i0gi.js";import{u as Ns}from"./outbounds-DPmb26w8.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";const Ms=["client","rule","outbound","node"],Ls=e=>new Map(e.map(n=>[n.id,n.name])),Te="\0";function Ss(e,n){return e.rule_id?n.get(e.rule_id)?.expression===e.rule_expression?e.rule_id:e.rule_id+Te+e.rule_expression:void 0}function mn(e,n,s,a){switch(n){case"client":{const t=Je(e.input?.src??void 0);return{label:t??"unknown",unknown:!t}}case"rule":return e.rule_expression?{label:e.rule_expression,unknown:!1,key:Ss(e,a)}:{label:"unknown",unknown:!0};case"outbound":return e.outbound?{label:e.outbound,unknown:!1}:{label:"unknown",unknown:!0};case"node":{if(He(e.outbound))return null;const t=e.chain.at(-1)??null;return t?{label:s.get(t)??t,unknown:!1,key:t}:{label:"unknown",unknown:!0}}}}const pe=(e,n)=>xs(e,n.unknown?"":n.key??n.label),fn=e=>gs(e,Ms)?.kind,Rs=new Map;function bn(e,n,s){const a=fn(n);if(!a)return[];const t=new Map(s.map(o=>[o.rule_id,o]));return e.filter(o=>{const l=mn(o,a,Rs,t);return l!==null&&pe(a,l)===n})}function Cs(e,n,s,a){const t=e.slice(0,e.indexOf(":")),o=e.slice(e.indexOf(":")+1);return o===""?a(null):t==="rule"?o.includes(Te)?o.slice(o.indexOf(Te)+1):n.find(l=>l.rule_id===o)?.expression??o:t==="node"?s.get(o)??o:t==="client"?o:a(o)}function Ts(e,n,s,a,t="rule"){const o=Ls(s),l=new Map(n.map(g=>[g.id,g])),i=new Map(n.map(g=>[g.name,g])),d=new Map(s.map(g=>[g.id,g])),c=new Map(a.map(g=>[g.rule_id,g])),m=new Map,u=new Map,p=new Map,j=new Map,h=(g,x)=>{const M=g+">"+x;let k=j.get(M);return k||j.set(M,k={source:g,target:x,count:0}),k},f=(g,x,M=!1)=>{const k=pe("node",{key:g,label:x,unknown:M});let T=p.get(k);if(!T){const H=M?void 0:d.get(g),R=H&&Xe(H);p.set(k,T={id:k,label:x,count:0,unknown:M||void 0,latency:vn(R),unavailable:R?.state==="unavailable"})}return T},b=(g,x=!1)=>{const M=pe("outbound",{label:g,unknown:x});let k=u.get(M);if(k)return k;const T=x?void 0:i.get(g),H=x?{groups:[],member:null}:Ye(g,T?.selection.tcp_member_id?"tcp":"udp",i,l,d),R=H.groups.map(Q=>({name:Q.name,kind:Q.policy.kind,policy:Q.policy.native})),U=H.member,V=x?"unknown":g==="direct"||g==="block"?g:R.length?"group":"unknown";return k={id:M,label:g,count:0,unknown:x||void 0,kind:V,groups:R,node:U&&f(U,o.get(U)??U).id},u.set(M,k),k.node&&h(M,k.node),k},v=(g,x,M=!1)=>{let k=m.get(g);return k||m.set(g,k={id:g,label:x,count:0,unknown:M||void 0,outbound:null,must:!1,fallback:!1}),k};if(t==="rule")for(const g of a){const x=v(pe("rule",{key:g.rule_id,label:g.expression}),g.expression);x.must=g.must,x.fallback=g.kind==="fallback",g.outbound&&(x.outbound=b(g.outbound).id,h(x.id,x.outbound))}const _=[t,"outbound","node"];for(const g of e){let x;for(const M of _){const k=mn(g,M,o,c);if(!k)break;const T=M==="outbound"?b(k.label,k.unknown):M==="node"?f(k.key??k.label,k.label,k.unknown):v(pe(M,k),k.label,k.unknown);T.count++,x&&h(x.id,T.id).count++,x=T}}for(const g of n)b(g.name);const S=new Set([...m.values()].map(g=>g.outbound)),N=new Set([...u.values()].flatMap(g=>g.groups.slice(1).map(x=>x.name))),P=[...u.values()].filter(g=>g.count||S.has(g.id)||!N.has(g.label)),I=new Set(P.map(g=>g.id));return{by:t,leaves:[...m.values()],outbounds:P,nodes:[...p.values()],links:[...j.values()].filter(g=>I.has(g.source)||I.has(g.target))}}const Ue=new WeakMap;function Oe(e){const n=Ue.get(e);if(n)return n;const s=new Map,a=new Map,t=new Map;for(const i of e.links){for(const[d,c]of[[s,i.source],[a,i.target]]){let m=d.get(c);m||d.set(c,m=[]),m.push(i)}(!t.has(i.source)||t.get(i.source).couLine truncated
@@ -1 +0,0 @@
import{r as h,j as i}from"./vendor-react-Bf71BWbF.js";import{Z as L,$ as v,a0 as H,a1 as S,a2 as A,a3 as I,a4 as O,a5 as R,a6 as _,a7 as P,u as E,a as Q,a8 as V,a9 as B,aa as y,ab as D,ac as F,ad as z,ae as G,af as Z,ag as J,T as U,B as w,ah as W,E as X,j as Y,ai as ee,aj as se,ak as ae,al as te,am as ne}from"./index-BNBwb-FJ.js";import{u as re}from"./flows-CMFlFH_d.js";import{d as oe}from"./nav-DuA2h3KP.js";import{r as ie}from"./nav-DKmRxmdR.js";import{s as de}from"./nav-D5WY5Qjf.js";import{c as ce,s as le,a as ue}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(le(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(l=>l.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(ue,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:l}of n.entries){if(c.length===d)break;l.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})),l=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})),u=re(y(c,"rules",{whileLoading:!1})),p=[n,s,l,f,g,b,u],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(l.data,g.data,d),[l.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(u.data,d),[u.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:l,retry:f,loading:g,select:b}=$e(t,a);return i.jsx(Z,{title:e("search"),hideTitle:!0,isOpen:!0,onOpenChange:u=>{u||a()},children:i.jsxs(J,{inputValue:d,onInputChange:r,children:[i.jsxs("div",{className:"rp-toolbar",children:[i.jsx(U,{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(W,{})})]}),l&&i.jsx(X,{error:l,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(Y,{}):i.jsx(ee,{children:e("search.none")})),i.jsx(se,{"aria-label":e("search")Line truncated
@@ -0,0 +1 @@
import{r as h,j as d}from"./vendor-react-Bf71BWbF.js";import{$ as w,a0 as f,a1 as I,a2 as O,a3 as D,a4 as P,a5 as M,a6 as T,a7 as L,a8 as Q,a9 as V,u as q,a as B,aa as F,ab as z,ac as v,ad as G,ae as J,af as U,ag as W,ah as X,ai as Y,T as Z,B as E,aj as ee,E as se,j as te,ak as ae,al as ne,am as ie,an as re,ao as oe}from"./index-Bw0aJc9a.js";import{u as de,a as le}from"./flows-D3eabARZ.js";import{d as ce}from"./nav-CdRBQuvD.js";import{r as ue}from"./nav-xc_Z_1Qd.js";import{f as pe}from"./nav-CS6FFQFP.js";import{s as me}from"./nav-D5WY5Qjf.js";import{c as he,s as fe,a as ge}from"./nav-BFiTWnsa.js";import{c as be}from"./nav-Wiib71Wo.js";import{n as ye}from"./nav-DONyavaI.js";import{p as xe}from"./nav-BASDWt23.js";const g=(t,a,e,r,i,o="")=>({hit:{id:a,label:e,description:r,route:i,query:o},keys:t.flatMap(n=>n==null?[]:[n.toLowerCase()])});function ve(t,a,e){const r=s=>Q(s,t),i=t?.resources,o=a?.sources.find(s=>s.kind==="main"),n=[...be().map(s=>({path:"connections",params:{tab:s.id},titleKey:s.titleKey})),...ye(i).map(s=>({path:"nodes",params:{tab:s.id},titleKey:s.titleKey})),...xe().map(s=>({path:"policies",params:{tab:s.id},titleKey:s.titleKey})),...pe(i).map(s=>({path:"flows",params:{tab:s.id},titleKey:s.titleKey})),...ue(i).map(s=>({path:"rules",params:{tab:s.id},titleKey:s.titleKey})),...ce(i).map(s=>({path:"dns",params:{tab:s.id},titleKey:s.titleKey})),...he(fe(i,o)).map(s=>({path:"config",params:{tab:s.id},titleKey:s.titleKey})),...me(i).map(s=>({path:"settings",params:{card:s.id},titleKey:s.titleKey}))];return[...w.filter(s=>s.nav&&r(s.path)).map(s=>({route:s.path,query:"",title:e(s.nav.titleKey),parent:""})),...n.filter(s=>r(s.path)).map(s=>({route:s.path,query:f("",s.params),title:e(s.titleKey),parent:e(w.find(c=>c.path===s.path).nav.titleKey)}))].map(s=>g([s.title,s.parent&&s.parent+" "+s.title],`page:${s.route}?${s.query}`,s.title,s.parent||void 0,s.route,s.query))}function $e(t,a){return I(t).map(e=>g([e.domain,e.dst,e.src],`connection:${e.id}`,e.domain||e.dst||e.src||e.id,O(e,a),"connections",f("",{id:e.id})))}function je(t,a,e){const r=a?.providers??[],i=o=>f("",{provider:V(o,r),q:o.name});return(t??[]).map(o=>g([o.name],`node:${o.id}`,o.name,D(e,o.group_ids)||void 0,"nodes",i(o)))}function Ke(t){return(t??[]).map(a=>g([a.name],`group:${a.id}`,a.name,a.policy.native,"policies",f("",{group:a.id})))}function we(t,a){return(t?.providers??[]).map(e=>g([e.name],`provider:${e.id}`,e.name,a("search.nodeCount",{n:e.node_count}),"nodes",f("",{provider:e.id})))}function Le(t,a){return(t?.sources??[]).map(e=>g([e.path],`source:${e.id}`,e.path,P(ge,e.kind,a),"config",f("",{tab:"source",source:e.id})))}function Ee(t,a){return(t?.rules??[]).filter(e=>e.kind==="rule").map(e=>g([e.expression,e.outbound],`rule:${e.rule_id}`,e.expression,`#${M(e.index+1,T[a])} → ${e.outbound}`,"rules",f("",{tab:"list",rule:e.rule_id})))}function Me(t,a,e){return[{list:t?.request??[],title:e("rule.dns.request")},{list:t?.response??[],title:e("rule.dns.response")}].flatMap(({list:i,title:o})=>i.filter(n=>n.kind==="rule").map(n=>g([n.expression,L(n)],`dns-rule:${n.rule_id}`,n.expression,`${o} #${M(n.index+1,T[a])} → ${L(n)}`,"rules",f("",{tab:"dns"}))))}function Te(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},{id:"dnsRules",title:e("rule.dnsTitle"),entries:t.dnsRules}],partial:a?.truncated?e("conn.truncated"):null}}function qe(t,a){const e=t.trim().toLowerCase(),r=e?8:5,i=new Map;return{sections:a.sections.map(n=>{const l=[];for(const{hit:s,keys:c}of n.entries){if(l.length===r)break;c.some(b=>b.includes(e))&&(l.push(s),i.set(s.id,s))}return{id:n.id,title:n.title,items:l}}).filter(n=>n.items.length>0),byId:i,partial:a.partial}}function Re(t,a){const e=q(),r=B(),[i,o]=h.useState(""),n=F(),l=n.data?.resources,s=z(void 0,v(l,"connections",{whileLoading:!1})),c=G(v(l,"nodes",{whileLoading:!1})),b=J(v(l,"groups",{whileLoading:!1})),y=U(v(l,"providers",{whileLoading:!1})),x=W(v(l,"config",{whileLoading:!1})),u=de(v(l,"rules",{whileLoading:!1})),p=le(v(l,"dns_rules",{whileLoading:!1})),j=[n,s,c,b,y,x,u,p],R=h.useMemo(()=>ve(n.data,x.data,e),[n.data,x.data,e]),C=h.useMemo(()=>$e(s.data,e),[s.data,e]),N=h.useMemo(()=>je(c.data,y.data,r),[c.data,y.data,r]),k=h.useMemo(()=>Ke(b.data),[b.data]),H=h.useMemo(()=>we(y.data,e),[y.data,e]),_=h.useMemo(()=>Le(x.data,e),[x.data,e]),S=h.useMemo(()=>Ee(u.data,r),[u.data,r]),A=h.useMemo(()=>Me(p.data,r,e),[p.data,r,e]),$=qe(i,Te({pages:R,conns:C,nodes:N,groups:k,providers:H,sources:_,rules:S,dnsRules:A},s.data,e));return{q:i,setQ:o,sections:$.sections,partial:$.partial,openConnections:()=>{t("connections"),a()},empty:$.byId.size===0,errLine truncated
@@ -1 +0,0 @@
import{r as b,a as Ze,j as t}from"./vendor-react-Bf71BWbF.js";import{as as ue,dr as es,a2 as Me,h as ss,d as ts,a4 as le,A as Ne,dT as as,u as z,dU as ns,cE as Ve,dV as ze,n as xe,i as je,be as D,o as Ae,dW as rs,w as os,aX as is,dX as ls,a8 as fe,aB as qe,dY as cs,dZ as ds,r as us,d_ as gs,b as X,d$ as ps,e0 as fs,a5 as Pe,a as Re,c_ as Ke,a3 as ms,dO as hs,aJ as te,E as K,j as ge,I as bs,b5 as V,T as re,aF as _e,bB as oe,B as F,ay as vs,aa as ye,ad as xs,dg as js,e1 as ys,bh as ws,aC as ks,e2 as We,bk as Ns,bo as Te,L as Ie,aH as Ee,ap as _s,aq as Cs,e3 as Ss,e4 as Ps,ac as Rs,cV as Ls,cA as Ce,dD as Ds,cK as As,aG as Ts,d2 as pe,e5 as Fe,e6 as Is,e7 as Es,bn as Fs}from"./index-BNBwb-FJ.js";import{d as Us,c as Hs}from"./auth-TcOYUrrj.js";import{g as Le,c as Bs,a as ae,b as Os}from"./nav-D5WY5Qjf.js";import{D as Gs}from"./Table-DyWJelc_.js";import{T as Ms}from"./TimeCell-DUt0i0gi.js";import{A as Vs}from"./ActionGroup-BKxDwmnT.js";import{c as zs}from"./dns-CvJ19DpX.js";import{g as ce,m as qs,v as Ks}from"./geodata-DprMPspn.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";const Ue=["record_flows","record_logs","record_dns_log"],Se={record_flows:{state:"flows",label:"settings.recordFlows"},record_logs:{state:"logs",label:"settings.recordLogs"},record_dns_log:{state:"dns_log",label:"settings.recordDnsLog"}},Ws={auto:"settings.record.auto",on:"settings.record.on",off:"settings.record.off"},$s=s=>s==="auto"?"auto":s==="on";function Js(s,e,a,n){const r=a?!a.allowed:!1;return{id:s,label:n(Se[s].label),value:e,items:["auto","on","off"].map(o=>({id:o,label:n(o==="auto"&&s==="record_flows"?"settings.record.autoFlows":Ws[o])})),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 Xs=60,Ys=(s,e)=>s==="auto"?e("settings.recordFlowsAuto",{n:Xs}):null,Zs=["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 et(s,e,a,n,r){const o=de[s];return{id:s,value:e,label:r(o.label),invalid:!/^\d+$/.test(e)||Number(e)<o.floor||a!==void 0&&Number(e)>a,description:a===void 0?r("settings.rangeMin",{min:le(o.floor,n)}):r("settings.range",{min:le(o.floor,n),max:le(a,n)})}}function st(s,e){return s.map(a=>({id:a.kind,kind:a.kind,size:ue(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 tt(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 at(s,e){return s?null:e("settings.noProfile")}function nt({busy:s,invalid:e,changed:a},n){return s?null:e?n("settings.runtimeInvalid",{field:e}):a?null:n("config.noChanges")}function rt({ready:s,busy:e,count:a},n){return s&&!e&&!a?n("settings.noSubscriptions"):null}function $e({busy:s,loaded:e,failed:a},n){return!s&&!e&&a?n("settings.geodataUnread"):null}function ot(s,e,a,n){const r=s?.resources;if(!r?.geodata.available||r.geodata.can_update!==!0||Le(r))return null;const o=es(e),i=o.reason("geodata",s);if(i?.code!=="no-download-urls")return null;const l=Me(n,i.settings.map(j=>o.settingName(j.key)));return{text:a("settings.geodataFromConfig",{keys:l}),docs:{href:ts(n,"state-db"),text:a("ov.lim.docsStateDb")},config:r.config.available?{href:ss("config",{tab:"source"}),text:a("nav.config")}:void 0}}function it(s,e){return s.flatMap(a=>a.items).find(a=>a.id===e)?.label??e}function lt(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 ct(s,e,a,n){try{const r=await as(s,e).discovery(a);if(!r||!Line truncated
@@ -0,0 +1 @@
import{r as h,a as ss,j as t}from"./vendor-react-Bf71BWbF.js";import{av as fe,ap as ts,a3 as Ve,h as as,d as qe,a5 as ue,A as Ne,eB as ns,u as W,eC as rs,cS as ze,eD as Ke,n as je,i as ye,bm as F,o as Ae,eE as os,w as is,a$ as ls,eF as cs,aa as ve,aF as We,eG as ds,eH as us,r as gs,eI as ps,bq as be,eJ as fs,eK as ms,a6 as Pe,a as Re,dl as $e,a4 as hs,H as vs,aN as ne,E as Q,j as me,I as bs,bt as V,T as le,aJ as _e,bQ as ce,B as T,aC as xs,ac as we,af as js,dV as ys,eL as ws,bi as ks,aG as Ns,eM as Je,b as Te,bn as _s,bu as Ie,L as Ce,aL as Ee,as as Cs,at as Ss,eN as Ps,eO as Rs,ae as Ls,de as Ds,cN as Se,em as As,cY as Ts,aK as Is,dt as he,eP as Ue,eQ as Es,eR as Us,eS as Hs,br as Fs}from"./index-Bw0aJc9a.js";import{d as Bs,c as Os}from"./auth-DzCdgIKH.js";import{g as Le,c as Gs,a as re,b as Ms}from"./nav-D5WY5Qjf.js";import{D as Vs}from"./Table-Km6Zv-S8.js";import{T as qs}from"./TimeCell-DKHUJpad.js";import{A as zs}from"./ActionGroup-DLxTuKht.js";import{c as Ks}from"./dns-BCg5F0Tv.js";import{u as Ws}from"./useRefreshAll-D0DryBsY.js";import{g as ge,v as $s}from"./geodata-De9_qBkH.js";import"./useGridSelectionCheckbox-COXIVEmS.js";import"./Virtualizer-DCY9HC9Z.js";import"./ListLayout-_fDlx5XY.js";const He=["record_flows","record_logs","record_dns_log"],pe={record_flows:{state:"flows",label:"settings.recordFlows"},record_logs:{state:"logs",label:"settings.recordLogs"},record_dns_log:{state:"dns_log",label:"settings.recordDnsLog"}},Js={auto:"settings.record.auto",on:"settings.record.on",off:"settings.record.off"},Qs=s=>s;function Ys(s,e,a,n){const r=a?!a.allowed:!1;return{id:s,label:n(pe[s].label),value:e,items:["auto","on","off"].map(o=>({id:o,label:n(o==="auto"&&s==="record_flows"?"settings.record.autoFlows":Js[o])})),disabled:r,tone:r?"muted":a?.active?"ok":"neutral",status:n(r?"settings.recordingForbidden":a?.active?"settings.recordingActive":"settings.recordingIdle")}}function Xs(s,e){if(!s)return null;const a=s.grace_remaining_seconds??0;return a>0?e("settings.recordingGrace",{n:a}):s.events?e(s.events.active?"settings.recordingEvents":"settings.recordingDetached"):null}const Zs=60,et=(s,e)=>s==="auto"?e("settings.recordFlowsAuto",{n:Zs}):null,st=["log.buffered_records","dns_log.max_records","flows.max_flows","flows.retention_seconds"],ie={"log.buffered_records":{read:s=>s.log?.buffered_records,write:(s,e)=>{(s.log??={}).buffered_records=e},label:"settings.logBuffer"},"dns_log.max_records":{read:s=>s.dns_log?.max_records,write:(s,e)=>{(s.dns_log??={}).max_records=e},label:"settings.dnsLogSize"},"flows.max_flows":{read:s=>s.flows?.max_flows,write:(s,e)=>{(s.flows??={}).max_flows=e},label:"settings.flowsMax"},"flows.retention_seconds":{read:s=>s.flows?.retention_seconds,write:(s,e)=>{(s.flows??={}).retention_seconds=e},label:"settings.flowsRetention"}};function tt(s,e,a,n,r,o){const i=ie[s];return{id:s,value:e,label:o(i.label),invalid:!/^\d+$/.test(e)||Number(e)<a||n!==void 0&&Number(e)>n,description:n===void 0?o("settings.rangeMin",{min:ue(a,r)}):o("settings.range",{min:ue(a,r),max:ue(n,r)})}}function at(s,e){return s.map(a=>({id:a.kind,kind:a.kind,size:fe(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 nt(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",{requestId:e.requestId}):"",error:!!e.error,id:e.id??0}:null}}function rt(s,e){return s?null:e("settings.noProfile")}function ot({busy:s,invalid:e},a){return!s&&e?a("settings.runtimeInvalid",{field:e}):null}function Qe({busy:s,loaded:e,failed:a},n){return!s&&!e&&a?n("settings.geodataUnread"):null}function it(s,e,a,n){const r=s?.resources;if(!r?.geodata.available||r.geodata.can_update!==!0||Le(r))return null;const o=ts(e),i=o.reason("geodata",s);if(i?.code!=="no-download-urls")return null;const l=Ve(n,i.settings.map(w=>o.settingName(w.key)));return{text:a("settings.geodataFromConfig",{keys:l}),docs:{href:qe(n,"state-db"),text:a("ov.lim.docsStateDb")},config:r.config.available?{href:as("config",{tab:"source"}),text:a("nav.config")}:void 0}}function lt(s,e){return s.flatMap(a=>a.items).find(a=>a.id===e)?.label??e}function ct(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 dt(s,e,a,n){try{const r=await ns(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:StLine truncated
@@ -1 +0,0 @@
import{r as x,j as r}from"./vendor-react-Bf71BWbF.js";import{aE as k,eQ as P,eR as S}from"./index-BNBwb-FJ.js";import{u as T,C as B,f as R,n as W,g as j}from"./layout-wfdMYi2n.js";import{G as v,C as L}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 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:E,showAt:M,hide:b}=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){b();return}M({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:E}),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=R(n,n.currentTarget,e);w(s.x<0||s.x>e.width||s.y<2||s.y>e.height-2?null:W(t.map(d),s.x))},children:[r.jsx("defs",{children:r.jsx(v,{id:g,color:l})}),r.jsx(L,{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 x,j as r}from"./vendor-react-Bf71BWbF.js";import{aI as k,fx as P,fy as S}from"./index-Bw0aJc9a.js";import{u as T,C as B,f as W,n as v,g as j}from"./layout-BWzq8YqC.js";import{G as I,C as L}from"./AreaCurve-BriPYJva.js";import"./array-C0P64tl-.js";function R(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,y]=x.useState(null),[u,e]=P(Math.round,120),{tip:M,showAt:b,hide:E}=T(),c=i.filter(n=>n!==null),w=[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,w,[(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:R(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:()=>y(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);y(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(I,{id:g,color:l})}),r.jsx(L,{points:i.map((n,s)=>n===null?null:{x:d(t[s]),y:a(n)}),baseline:a(Math.max(0,w[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};
@@ -1 +1 @@
import{r as f,$,b as Vt,j as E}from"./vendor-react-Bf71BWbF.js";import{ef as Ot,eg as He,eh as Ut,ei as Qe,bV as ee,ej as _t,ek as ie,el as he,em as ht,en as N,eo as jt,ep as Yt,eq as ft,er as Xt,es as Ke,ck as yt,bJ as ae,et as Gt,bF as Be,bH as Y,bX as fe,bG as qt,bI as L,eu as D,ev as be,ew as Le,ex as Qt,bL as pt,bR as Pe,bO as Je,bP as ve,bQ as Ie,bS as Z,bW as Jt,bT as de,bU as ce,ey as gt,ez as Zt,eA as Ze,bM as el,eB as tl,bN as ll,eC as il,eD as rl,c7 as Se,bY as bt,b_ as Ve,bZ as nl,eE as Oe,c4 as H,c2 as me,c8 as le,cp as ol,eF as al,ce as et,c3 as se,eG as sl,cl as dl,c6 as ye,ca as Me,cn as cl,cf as ul,cm as hl,co as fl,cq as yl,eH as pl,c5 as Ce,b$ as Ue,cd as mt,c9 as W,eI as $t,cb as gl,cg as bl,ch as ze,eJ as tt,eK as ml,eL as $l,eM as De,eN as xl,cr as wl,cs as vl,ct as Cl,u as xt,aQ as lt,f as kl,j as Kl,ai as Il,bl as Rl,e5 as wt,c as vt,eO as Sl,eP as Ml,aH as Dl}from"./index-BNBwb-FJ.js";import{$ as El,a as Pl,e as zl,b as Tl,c as Ct,d as kt}from"./useGridSelectionCheckbox-CrCOlZv8.js";import{a as Nl,c as oe,b as ue,d as Hl}from"./Virtualizer-DipGMcji.js";import{$ as Wl}from"./ListLayout-F74Z1Dpf.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 import{r as f,$,b as Vt,j as E}from"./vendor-react-Bf71BWbF.js";import{eY as Ot,eZ as He,e_ as Ut,e$ as Ze,c8 as ee,f0 as _t,f1 as ie,f2 as he,f3 as ht,f4 as N,f5 as jt,f6 as Yt,f7 as ft,f8 as Xt,f9 as Ke,cz as yt,bY as ae,fa as Gt,bU as Be,bW as Y,ca as fe,bV as qt,bX as L,fb as D,fc as be,fd as Le,fe as Zt,b_ as pt,c4 as Pe,c1 as Qe,c2 as ve,c3 as Ie,c5 as J,c9 as Qt,c6 as de,c7 as ce,ff as gt,fg as Jt,fh as Je,b$ as el,fi as tl,c0 as ll,fj as il,fk as rl,cm as Se,cb as bt,cd as Ve,cc as nl,fl as Oe,cj as H,ch as me,cn as le,cE as ol,fm as al,ct as et,ci as se,fn as sl,cA as dl,cl as ye,cp as Me,cC as cl,cu as ul,cB as hl,cD as fl,cF as yl,fo as pl,ck as Ce,ce as Ue,cs as mt,co as W,fp as $t,cq as gl,cv as bl,cw as ze,fq as tt,fr as ml,fs as $l,ft as De,fu as xl,cG as wl,cH as vl,cI as Cl,u as xt,aU as lt,f as kl,j as Kl,ak as Il,bo as Rl,eP as wt,c as vt,fv as Sl,fw as Ml,aL as Dl}from"./index-Bw0aJc9a.js";import{$ as El,a as Pl,e as zl,b as Tl,c as Ct,d as kt}from"./useGridSelectionCheckbox-COXIVEmS.js";import{a as Nl,c as oe,b as ue,d as Hl}from"./Virtualizer-DCY9HC9Z.js";import{$ as Wl}from"./ListLayout-_fDlx5XY.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=Ze(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=Ze(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
@@ -0,0 +1 @@
import{j as s}from"./vendor-react-Bf71BWbF.js";import{a6 as t,a as r,eO as i,aL as l,eN as n,aw as m}from"./index-Bw0aJc9a.js";function p({at:e}){const o=t[r()],a=i();return s.jsx(l,{text:e?m(e,o):void 0,children:n(e,o,a)})}export{p as T};
@@ -1 +0,0 @@
import{j as s}from"./vendor-react-Bf71BWbF.js";import{a5 as t,a as r,e4 as i,aH as l,e3 as n,at as m}from"./index-BNBwb-FJ.js";function p({at:e}){const o=t[r()],a=i();return s.jsx(l,{text:e?m(e,o):void 0,children:n(e,o,a)})}export{p as T};
@@ -1 +1 @@
import{bJ as H,bV as te,bX as ie,eS as ne,eT as le,bQ as se,eg as F,eJ as T,eL as re,eU as oe,c4 as ae,eV as he}from"./index-BNBwb-FJ.js";import{r as f,$ as S,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 Y(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=Y(s,a,t.edge,t.axis,t.threshold)),s.area===0)return null;let w=t.axis==="x"?"width":"height",z=h[w]-a[w],$=!this.hasSnappedToEdge;if(this.hasSnappedToEdge=!0,!($||z!==0||r))Line truncated import{bY as H,c8 as te,ca as ie,fz as ne,fA as le,c3 as se,eZ as F,fq as _,fs as re,fB as oe,cj as ae,fC as he}from"./index-Bw0aJc9a.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
@@ -1 +1 @@
import{D as i}from"./auth-TcOYUrrj.js";import{A as r,o as p}from"./index-BNBwb-FJ.js";import"./vendor-react-Bf71BWbF.js";const a="demo-session-",h=12*36e5;function u(){return{mode:"password",setup_required:!1}}const c={auth_setup:"/api/v1/auth/setup",auth_login:"/api/v1/auth/login"};function w(e,t){if(e==="setup")throw new r(409,"setup_already_completed","Setup already completed");if(t.username!==i.username||t.password!==i.password)throw new r(401,"invalid_credentials","Invalid credentials");return{token:a+p(),expires_at:new Date(Date.now()+h).toISOString()}}function v(e){return!!e?.startsWith(a)}function y(e){return{...e,discovery:async t=>{const o=await e.discovery(t);return"status"in o?{...o,links:{...o.links,...c,auth_logout:"/api/v1/auth/logout"},auth:{...u(),anonymous_loopback:!1}}:o}}}function _(e){const t=()=>Promise.reject(new r(401,"authentication_required","Authentication required")),o=async n=>(n?.throwIfAborted(),{name:"dae/honk-native",api_major:1,links:{...c},auth:u()});return new Proxy(e,{get:(n,s,d)=>s==="discovery"?o:typeof Reflect.get(n,s,d)=="function"?t:void 0})}export{u as mockDiscovery,w as mockOpenSession,v as mockSessionValid,_ as refuseWithoutSession,y as withPasswordAuth}; import{D as i}from"./auth-DzCdgIKH.js";import{A as r,o as p}from"./index-Bw0aJc9a.js";import"./vendor-react-Bf71BWbF.js";const a="demo-session-",l=12*36e5;function u(){return{mode:"password",setup_required:!1}}const c={auth_setup:"/api/v1/auth/setup",auth_login:"/api/v1/auth/login"};function w(e,t){if(e==="setup")throw new r(409,"setup_already_completed","Setup already completed");if(t.username!==i.username||t.password!==i.password)throw new r(401,"invalid_credentials","Invalid credentials");return{token:a+p(),expires_at:new Date(Date.now()+l).toISOString()}}function v(e){return!!e?.startsWith(a)}function y(e){return{...e,discovery:async t=>{const o=await e.discovery(t);return"status"in o?{...o,links:{...o.links,...c,auth_logout:"/api/v1/auth/logout"},auth:{...u(),anonymous_loopback:!1}}:o}}}function _(e){const t=()=>Promise.reject(new r(401,"authentication_required","Authentication required")),o=async n=>(n?.throwIfAborted(),{name:"daeuniverse/native",api_major:1,links:{...c},auth:u()});return new Proxy(e,{get:(n,s,d)=>s==="discovery"?o:typeof Reflect.get(n,s,d)=="function"?t:void 0})}export{u as mockDiscovery,w as mockOpenSession,v as mockSessionValid,_ as refuseWithoutSession,y as withPasswordAuth};
@@ -0,0 +1,2 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./auth-BReGn39D.js","./index-Bw0aJc9a.js","./vendor-react-Bf71BWbF.js","./index-7R3bVGRM.css"])))=>i.map(i=>d[i]);
import{i as r,eT as s,eU as c,dN as u,_ as d}from"./index-Bw0aJc9a.js";const n=(o,e)=>new URL(o.replace(/\/+$/,"")+e,globalThis.location?.href),p=()=>d(()=>import("./auth-BReGn39D.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),w={username:"demo",password:"demo"};async function l(o,e){if(r(o))return(await p()).mockDiscovery();const t=await s(n(o,"/api"),{headers:{Accept:"application/json"},cache:"no-store",signal:e});if(!t.ok)throw await c(t);const a=await t.json();if(a.name==="dae/honk-native")throw new u("login.engineOutdated");return a.auth}async function f(o,e){return(await s(n(o,"/api/v1/capabilities"),{headers:{Accept:"application/json"},cache:"no-store",signal:e})).status!==404}function m(o){return o.mode!=="password"?"token":o.setup_required?"setup":"login"}async function A(o,e,t,a){if(r(o))return(await p()).mockOpenSession(e,t);const i=await s(n(o,`/api/v1/auth/${e}`),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t),cache:"no-store",signal:a},e==="setup");if(!i.ok)throw await c(i);return i.json()}async function v(o,e,t){if(r(o))return;const a=await s(n(o,"/api/v1/auth/logout"),{method:"POST",headers:{Accept:"application/json",Authorization:"Bearer "+e},cache:"no-store",signal:t});if(!a.ok&&a.status!==401)throw await c(a)}export{w as D,f as a,v as c,l as d,A as o,m as s};
@@ -1,2 +0,0 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./auth-kokL-_Tb.js","./index-BNBwb-FJ.js","./vendor-react-Bf71BWbF.js","./index-C8vJM6q6.css"])))=>i.map(i=>d[i]);
import{i as r,e8 as a,e9 as c,_ as u}from"./index-BNBwb-FJ.js";const n=(o,e)=>new URL(o.replace(/\/+$/,"")+e,globalThis.location?.href),p=()=>u(()=>import("./auth-kokL-_Tb.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),d={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{d as D,w as a,A as c,l as d,m as o,f as s};
@@ -0,0 +1 @@
import{r as m}from"./vendor-react-Bf71BWbF.js";import{bG as h,bH as g,aa as b,dI as w,ac as _,dK as L,A as C,W as v,cQ as y,dM as M,eV as E}from"./index-Bw0aJc9a.js";const x=100;function G(t){const s=L(t,t?.resources.dns_log.max_page_size);return s===void 0?void 0:Math.min(x,s)}async function z(t,s,n){try{return{page:await t(s),limit:s.limit}}catch(e){const{limit:a}=s;if(!(e instanceof C&&e.status===503&&e.code==="snapshot_unavailable"&&e.retryAfter!==null)||a===void 0||a<2)throw e;await v(e.retryAfter,n);const r=Math.ceil(a/4);return{page:await t({...s,limit:r}),limit:r}}}async function I(t,s){const n=()=>M(e=>t.dnsCache({cursor:e,limit:E,detail:"summary"},s),(e,a)=>e?(e.entries.push(...a.entries),e):{...a,entries:[...a.entries]});try{return await n()}catch(e){if(!(e instanceof C&&e.status===503&&e.code==="snapshot_unavailable"&&e.transient))throw e;return await v(e.retryAfter,s),n()}}function U(){const t=h(),{busy:s,run:n,cancel:e}=g({rethrow:!0});return{busy:s!==null,cancel:e,flush:m.useCallback(()=>n("flush",a=>A(t,a)),[t,n])}}function F(t,s=!0){const n=h(),e=t.name?.trim()||void 0,a=t.type&&t.type!=="all"?t.type:void 0,c=t.src?.trim()||void 0,r=b().data,o=G(r),i=w({key:["dnsLog",{name:e,type:a,src:c,limit:o}],fetch:async u=>{const l=await z(f=>n.dnsLog(f,u),{name:e,type:a,src:c,limit:o},u);return{...l.page,limit:l.limit}}},{enabled:s});return{...i,limit:i.data?i.data.limit:o}}const p=new WeakMap,d=new WeakMap;async function P(t,s){const n=d.get(t)??0,e=await I(t,s);return(d.get(t)??0)===n&&p.set(t,{at:Date.now(),list:{...e,entries:[]}}),e}const k=t=>{d.set(t,(d.get(t)??0)+1),p.delete(t)};function A(t,s){return t.flushDnsCache(s).finally(()=>k(t))}function S(t,s,n){return t.deleteDnsEntry(s,n).finally(()=>k(t))}function W(t,s){const n=p.get(t);return n&&Date.now()-n.at<y.background?Promise.resolve(n.list):t.dnsCache({limit:1,detail:"summary"},s)}function N(t=!0,s=!1){const n=h();return w({key:["dnsCache"],every:y.lists,fetch:e=>P(n,e)},{enabled:t,paused:s})}function H(t=!0,s=!1){const n=h();return w({key:["dnsCache",{usage:!0}],every:y.background,fetch:e=>W(n,e)},{enabled:t,paused:s})}function K(t=!1){const s=h(),n=b(),e=n.data?.resources,a=N(_(e,"dns_cache",{whileLoading:!1})&&!!e?.dns_cache.read,t),{refetch:c}=a,{busy:r,error:o,run:i,cancel:u}=g({rethrow:!0});return{capabilities:n,cache:a,busy:r,error:o,cancel:u,remove:m.useCallback(l=>i(l,async f=>{const D=await S(s,l,f);return c(),D}),[s,i,c]),flush:m.useCallback(()=>i("flush",async l=>{const f=await A(s,l);return c(),f}),[s,i,c])}}async function Q(t,s,n,e,a){const c=Math.max(1,Math.floor(e));let r;for(let o=0;o<n.length;o+=c){a.throwIfAborted();const i=n.slice(o,o+c),u=await t(s,i,a);a.throwIfAborted(),r?r.results.push(...u.results):r={...u,results:[...u.results]}}if(!r)throw new Error("DNS query requires at least one record type");return r}export{K as a,H as b,U as c,Q as q,F as u};
@@ -1 +0,0 @@
import{r as m}from"./vendor-react-Bf71BWbF.js";import{bs as d,bt as g,a8 as b,d5 as w,aa as D,d4 as _,A as L,V as E,d7 as y,d8 as M,ea as x}from"./index-BNBwb-FJ.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:a}=t;if(!(s instanceof L&&s.status===503&&s.code==="temporarily_unavailable"&&s.retryAfter!==null)||a===void 0||a<2)throw s;await E(s.retryAfter,n);const c=Math.ceil(a/4);return{page:await e({...t,limit:c}),limit:c}}}function P(e,t){let n=x;return M(async s=>{const a=await C(r=>e.dnsCache(r,t),{cursor:s,limit:n,detail:"summary"},t);return n=a.limit,a.page},(s,a)=>s?(s.entries.push(...a.entries),s):{...a,entries:[...a.entries]})}function W(){const e=d(),{busy:t,run:n,cancel:s}=g({rethrow:!0});return{busy:t!==null,cancel:s,flush:m.useCallback(()=>n("flush",a=>k(e,a)),[e,n])}}function F(e,t=!0){const n=d(),s=e.name?.trim()||void 0,a=e.type&&e.type!=="all"?e.type:void 0,r=e.src?.trim()||void 0,c=b().data,o=G(c),i=w({key:["dnsLog",{name:s,type:a,src:r,limit:o}],fetch:async u=>{const l=await C(f=>n.dnsLog(f,u),{name:s,type:a,src:r,limit:o},u);return{...l.page,limit:l.limit}}},{enabled:t});return{...i,limit:i.data?i.data.limit:o}}const p=new WeakMap,h=new WeakMap;async function S(e,t){const n=h.get(e)??0,s=await P(e,t);return(h.get(e)??0)===n&&p.set(e,{at:Date.now(),list:{...s,entries:[]}}),s}const v=e=>{h.set(e,(h.get(e)??0)+1),p.delete(e)};function k(e,t){return e.flushDnsCache(t).finally(()=>v(e))}function I(e,t,n){return e.deleteDnsEntry(t,n).finally(()=>v(e))}function N(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 O(e=!0,t=!1){const n=d();return w({key:["dnsCache"],every:y.lists,fetch:s=>S(n,s)},{enabled:e,paused:t})}function T(e=!0,t=!1){const n=d();return w({key:["dnsCache",{usage:!0}],every:y.background,fetch:s=>N(n,s)},{enabled:e,paused:t})}function V(e=!1){const t=d(),n=b(),s=n.data?.resources,a=O(D(s,"dns_cache",{whileLoading:!1})&&!!s?.dns_cache.read,e),{refetch:r}=a,{busy:c,error:o,run:i,cancel:u}=g({rethrow:!0});return{capabilities:n,cache:a,busy:c,error:o,cancel:u,remove:m.useCallback(l=>i(l,async f=>{const A=await I(t,l,f);return r(),A}),[t,i,r]),flush:m.useCallback(()=>i("flush",async l=>{const f=await k(t,l);return r(),f}),[t,i,r])}}async function X(e,t,n,s,a){const r=Math.max(1,Math.floor(s));let c;for(let o=0;o<n.length;o+=r){a.throwIfAborted();const i=n.slice(o,o+r),u=await e(t,i,a);a.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{V as a,T as b,W as c,X as q,C as s,F as u};
@@ -1 +0,0 @@
import{bs as c,a8 as f,d4 as y,d5 as d,d6 as _,d7 as h,d8 as w,d9 as g}from"./index-BNBwb-FJ.js";async function v(s,{input:r,resolve:a,recordTypes:p},u){if(a!=="query")return s.routingTrace({input:r,resolve:a},u);const l=await s.dnsQuery(r.domain,p,u),i=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(t=>t.type===e.type).map(t=>t.data),selected_ip:e.type==="A"||e.type==="AAAA"?(e.answers??[]).find(t=>t.type===e.type)?.data??null:null,error:null})),o=[...new Set(["A","AAAA"].flatMap(e=>i.find(t=>t.qtype===e&&t.selected_ip)?.selected_ip??[]))],n=[];for(const e of o.length?o:[null])n.push(await s.routingTrace({input:e?{...r,dst_ip:e}:r,resolve:"none"},u));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:i}}function b({connection_id:s,network:r="all",state:a="all"}={},p=!0){const u=c(),{data:l,error:i}=f(),o=y(l,l?.resources.flows.max_page_size);return d({key:["flows",{connection_id:s,network:r,state:a,limit:o}],every:h.lists,fetch:n=>w(e=>u.flows({network:r,state:a,connection_id:s,cursor:e,limit:o,detail:"full"},n),(e,t)=>e?(e.flows.push(...t.flows),e):{...t,flows:[...t.flows]})},_(l,i,p))}function k(s){const r=c();return d({key:["flow",{id:s}],fetch:a=>s?r.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 r=c();return d({key:["rules"],every:0,fetch:a=>r.rules(a)},{enabled:s})}function q(s=!0){const r=c();return d({key:["dnsRules"],every:0,fetch:a=>r.dnsRules(a)},{enabled:s})}export{b as a,q as b,k as c,v as r,m as u};
@@ -0,0 +1 @@
import{bG as i,dI as c,c$ as w,dJ as p,aa as y,dK as h,dL as g,cQ as m,dM as _}from"./index-Bw0aJc9a.js";async function A(e,{input:r,resolve:s,recordTypes:f},u){if(s!=="query")return{traces:[await e.routingTrace({input:r,resolve:s},u)],query:null};const o=await e.dnsQuery(r.domain,f,u),l=[...new Set(["A","AAAA"].flatMap(t=>o.results.filter(n=>n.type===t).map(w).find(Boolean)??[]))],a=[];for(const t of l.length?l:[null])a.push(await e.routingTrace({input:t?{...r,dst_ip:t}:r,resolve:"none"},u));if(a.some(t=>t.instance_id!==a[0].instance_id||t.generation_id!==a[0].generation_id))throw p(409,"snapshot_unavailable","The routing generation changed during simulation; retry the query","ui.errGenerationChanged");return{traces:a,query:o}}function v({connection_id:e,network:r="all",state:s="all"}={},f=!0){const u=i(),{data:o,error:l}=y(),a=h(o,o?.resources.flows.max_page_size);return c({key:["flows",{connection_id:e,network:r,state:s,limit:a}],every:m.lists,fetch:t=>_(n=>u.flows({network:r,state:s,connection_id:e,cursor:n,limit:a,detail:"full"},t),(n,d)=>n?(n.flows.push(...d.flows),n):{...d,flows:[...d.flows]})},g(o,l,f))}function R(e){const r=i();return c({key:["flow",{id:e}],fetch:s=>e?r.flow(e,s):Promise.resolve(null),acceptEvent:s=>s.event!=="flow.updated"||s.data.resource_id===e},{enabled:e!==null})}function k(e=!0){const r=i();return c({key:["rules"],every:0,fetch:s=>r.rules(s)},{enabled:e})}function q(e=!0){const r=i();return c({key:["dnsRules"],every:0,fetch:s=>r.dnsRules(s)},{enabled:e})}export{q as a,v as b,R as c,A as r,k as u};
@@ -1 +1 @@
const p=["fastly","cdn","testingcf"];function s(t,a,o,n,g){const c=e=>`https://raw.githubusercontent.com/${a}/release/${e}`,l=(e,i)=>`https://${e}.jsdelivr.net/gh/${a}@release/${i}`,r=Object.keys(o);return{id:t,urls:Object.fromEntries(r.map(e=>[e,[c(o[e]),l("fastly",o[e])]])),mirrors:Object.fromEntries(r.map(e=>[e,p.slice(1).map(i=>l(i,o[e]))])),sizes:n,categories:g}}const d={geosite:["abema","apple","applemusic","bahamut","bilibili","biliintl","cloudflare","cn","ehentai","github","google","microsoft","netflix","onedrive","openai","pixiv","private","proxy","proxymedia","spotify","telegram","tiktok","twitter","youtube"],geoip:["apple","bilibili","cloudflare","cloudfront","cn","facebook","google","jp","netflix","private","telegram","twitter"]},u=[s("metacubex","MetaCubeX/meta-rules-dat",{geosite:"geosite.dat",geoip:"geoip.dat"},{geosite:42e5,geoip:166e5},null),s("metacubex-lite","MetaCubeX/meta-rules-dat",{geosite:"geosite-lite.dat",geoip:"geoip-lite.dat"},{geosite:176e3,geoip:207e3},d),s("loyalsoldier","Loyalsoldier/v2ray-rules-dat",{geosite:"geosite.dat",geoip:"geoip.dat"},{geosite:111e5,geoip:169e5},null)],m=t=>u.find(a=>a.id===t),b=m("metacubex"),f=4,x={min:6,max:168};function v(t){return/^https?:\/\/(?![^/?#]*@)[^#]*$/.test(t)&&URL.canParse(t)&&[...t].length<=4096}export{x as a,b as d,u as g,f as m,v}; const p=["fastly","cdn","testingcf"];function s(t,i,o,g,n){const c=e=>`https://raw.githubusercontent.com/${i}/release/${e}`,l=(e,a)=>`https://${e}.jsdelivr.net/gh/${i}@release/${a}`,r=Object.keys(o);return{id:t,urls:Object.fromEntries(r.map(e=>[e,[c(o[e]),l("fastly",o[e])]])),mirrors:Object.fromEntries(r.map(e=>[e,p.slice(1).map(a=>l(a,o[e]))])),sizes:g,categories:n}}const d={geosite:["abema","apple","applemusic","bahamut","bilibili","biliintl","cloudflare","cn","ehentai","github","google","microsoft","netflix","onedrive","openai","pixiv","private","proxy","proxymedia","spotify","telegram","tiktok","twitter","youtube"],geoip:["apple","bilibili","cloudflare","cloudfront","cn","facebook","google","jp","netflix","private","telegram","twitter"]},u=[s("metacubex","MetaCubeX/meta-rules-dat",{geosite:"geosite.dat",geoip:"geoip.dat"},{geosite:42e5,geoip:166e5},null),s("metacubex-lite","MetaCubeX/meta-rules-dat",{geosite:"geosite-lite.dat",geoip:"geoip-lite.dat"},{geosite:176e3,geoip:207e3},d),s("loyalsoldier","Loyalsoldier/v2ray-rules-dat",{geosite:"geosite.dat",geoip:"geoip.dat"},{geosite:111e5,geoip:169e5},null)],b=t=>u.find(i=>i.id===t),m=b("metacubex");function f(t){return/^https?:\/\/(?![^/?#]*@)[^#]*$/.test(t)&&URL.canParse(t)&&[...t].length<=4096}export{m as d,u as g,f as v};
@@ -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-flavour=main][data-scheme=dark]{--rp-base:#191724;--rp-surface:#1f1d2e;--rp-overlay:#26233a;--rp-muted:#6e6a86;--rp-subtle:#908caa;--rp-text:#e0def4;--rp-love:#eb6f92;--rp-gold:#f6c177;--rp-rose:#ebbcba;--rp-pine:#31748f;--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:#21202e;--rp-hl-med:#403d52;--rp-hl-high:#524f67;--rp-shadow:0 1px 2px #00000059;--rp-on-accent:#fff;--rp-negative-tile-text:var(--rp-negative)}: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-negLine truncated
@@ -1,64 +0,0 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./fonts-sc-DWPGxLPK.css","./fonts-tc-B6Zt5HQN.css","./SearchDialog-BrTpocW0.js","./vendor-react-Bf71BWbF.js","./flows-CMFlFH_d.js","./nav-DuA2h3KP.js","./nav-DKmRxmdR.js","./nav-D5WY5Qjf.js","./nav-BeFLfZq8.js","./index-DwWqXSpV.js","./geodata-DprMPspn.js","./auth-kokL-_Tb.js","./auth-TcOYUrrj.js","./AreaChart-D20yx2yz.js","./layout-wfdMYi2n.js","./AreaCurve-BriPYJva.js","./array-C0P64tl-.js","./Sparkline-D9jmRGJ6.js","./Donut-C-REp4Mf.js","./NodeSearch-B91jhtS3.js","./Virtualizer-DipGMcji.js","./useFilter-jz02VVEB.js","./ListLayout-F74Z1Dpf.js","./Overview-CuiLM_k-.js","./files-BxEOxSF8.js","./Table-DyWJelc_.js","./useGridSelectionCheckbox-CrCOlZv8.js","./ActionGroup-BKxDwmnT.js","./DaeCode-B8yPDjSE.js","./Connections-B3chbGPe.js","./FactStrip-n2q1T87k.js","./ranked-B09X8uKl.js","./TimeCell-DUt0i0gi.js","./link-CIkWI7An.js","./labels-Bgu_ZhL8.js","./outbounds-DPmb26w8.js","./Dns-CTpwVfIj.js","./dns-CvJ19DpX.js","./Policies-DiLR7S4N.js","./policyText-CmeXgUK2.js","./PolicyPicker-BmHzmXzJ.js","./Rules-DVu2iSwz.js","./setup-d2VGFWY1.js","./recorder-DlDpPhd4.js","./probe-BZEn7bbG.js","./Rules-l5FnUA9B.css","./Nodes-CnRnSpMd.js","./AddCircle-CIj8X2wL.js","./Config-DgoxfEHn.js","./vendor-editor-CF5uj9id.js","./Events-M5fPrUeR.js","./Logs-sKihIR9Z.js","./Settings-DCKpUXHp.js","./Login-DgzaXVol.js"])))=>i.map(i=>d[i]);
import{$ as E,r as c,c as Up,s as Xs,a as Qt,b as Fc,j as f,d as zp}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 qp="modulepreload",Wp=function(t,e){return new URL(t,e).href},Na={},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 a=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),u=l?.nonce||l?.getAttribute("nonce");i=o(n.map(d=>{if(d=Wp(d,r),d in Na)return;Na[d]=!0;const m=d.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(!!r)for(let y=a.length-1;y>=0;y--){const g=a[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":qp,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 a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};function ot(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}const te=typeof document<"u"?E.useLayoutEffect:()=>{},_c={prefix:String(Math.round(Math.random()*1e10)),current:0},Ac=E.createContext(_c),Gp=E.createContext(!1);let Di=new WeakMap;function Jp(t=!1){let e=c.useContext(Ac),n=c.useRef(null);if(n.current===null&&!t){let r=E.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(r){let i=Di.get(r);i==null?Di.set(r,{id:e.current,state:r.memoizedState}):r.memoizedState!==i.state&&(e.current=i.id,Di.delete(r))}n.current=++e.current}return n.current}function Yp(t){let e=c.useContext(Ac),n=Jp(!!t),r=`react-aria${e.prefix}`;return t||`${r}-${n}`}function Xp(t){let e=E.useId(),[n]=c.useState(Je()),r=n?"react-aria":`react-aria${_c.prefix}`;return t||`${r}-${e}`}const Zp=typeof E.useId=="function"?Xp:Yp;function Qp(){return!1}function eh(){return!0}function th(t){return()=>{}}function Je(){return typeof E.useSyncExternalStore=="function"?E.useSyncExternalStore(th,Qp,eh):c.useContext(Gp)}function nh(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)});te(()=>{r.current=e,i.current&&s.current()});let o=c.useCallback(a=>{i.current=a(r.current),s.current()},[s]);return[e,o]}let rh=!!(typeof window<"u"&&window.document&&window.document.createElement),mn=new Map,un;typeof FinalizationRegistry<"u"&&(un=new FinalizationRegistry(t=>{mn.delete(t)}));let Ki=new WeakMap;function de(t){let[e,n]=c.useState(t),r=c.useRef(null),i=Zp(e),s=c.useRef(null),o=Ki.get(s);if(un&&o!==i&&(o!=null&&un.unregister(s),un.register(s,i,s),Ki.set(s,i)),rh){const a=mn.get(i);a&&!a.includes(r)?a.push(r):mn.set(i,[r])}return te(()=>{let a=i;return()=>{un&&(un.unregister(s),Ki.delete(s)),mn.delete(a)}},[i]),c.useEffect(()=>{let a=r.current;return a&&n(a),()=>{a&&(r.current=null)}}),i}function ih(t,e){if(t===e)return t;let n=mn.get(t);if(n)return n.forEach(i=>i.current=e),e;let r=mn.get(e);return r?(r.forEach(i=>i.current=t),t):e}function rt(t=[]){let e=de(),[n,r]=nh(e),i=c.useCallback(()=>{r(function*(){yield e,yield document.getElementById(e)?e:void 0})},[e,r]);return te(i,[e,i,...t]),n}function Nt(...t){return t.length===1&&t[0]?t[0]:e=>{let n=!1;const r=t.map(i=>{const s=La(i,e);return n||=typeof s=="function",s});if(n)return()=>{r.forEach((i,s)=>{typeof i=="function"?i():La(t[s],null)})}}}function La(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]=Up(s,o):i==="id"&&s&&o?e.id=ih(s,o):i==="ref"&&s&&o?e.ref=Nt(s,o):e[i]=o!==void 0?o:s}}retuLine truncated
@layer {
[${qa}] {
touch-action: pan-x pan-y pinch-zoom;
}
}
`.trim(),C.head.prepend(j)},[p]),c.useEffect(()=>{let C=g.current;return()=>{m||Va(C.target??void 0);for(let j of C.disposables)j();C.disposables=[]}},[m]),{isPressed:l||b,pressProps:A(h,H,{[qa]:!0})}}function fo(t){return t.tagName==="A"&&t.hasAttribute("href")}function Fi(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&&!Mu(i,n)||i instanceof xe(i).HTMLTextAreaElement||i.isContentEditable)&&!((s==="link"||!s&&fo(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 Im(t){return t instanceof HTMLInputElement?!1:t instanceof HTMLButtonElement?t.type!=="submit"&&t.type!=="reset":!fo(t)}function Wa(t,e){return _e()&&e==="Enter"?!1:t instanceof HTMLInputElement?e==="Enter"&&(t.type==="checkbox"||t.type==="radio")?!1:!Mu(t,e):Im(t)}const jm=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Mu(t,e){return t.type==="checkbox"||t.type==="radio"?e===" ":jm.has(t.type)}function Dm(t,e){let{elementType:n="a",onPress:r,onPressStart:i,onPressEnd:s,onPressChange:o,onClick:a,isDisabled:l,...u}=t,d={};n!=="a"&&(d={role:"link",tabIndex:l?void 0:0});let{focusableProps:m}=Lt(t,e),{pressProps:p,isPressed:h}=qt({onPress:r,onPressStart:i,onPressEnd:s,onPressChange:o,onClick:a,isDisabled:l,ref:e}),b=X(u,{labelable:!0}),y=A(m,p),g=Cn(),v=li(t);return{isPressed:h,linkProps:A(b,v,{...y,...d,"aria-disabled":l||void 0,"aria-current":t["aria-current"],onClick:$=>{p.onClick?.($),eu($,g,t.href,t.routerOptions)}})}}function Tn(t){let{isDisabled:e,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=t,s=c.useRef({isFocusWithin:!1}),{addGlobalListener:o,removeAllGlobalListeners:a}=pi(),l=c.useCallback(m=>{Z(m.currentTarget,_(m))&&s.current.isFocusWithin&&!Z(m.currentTarget,m.relatedTarget)&&(s.current.isFocusWithin=!1,a(),n&&n(m),i&&i(!1))},[n,i,s,a]),u=Wc(l),d=c.useCallback(m=>{if(!Z(m.currentTarget,_(m)))return;let p=_(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=_(g);if(s.current.isFocusWithin&&!Z(y,v)){let $=new h.defaultView.FocusEvent("blur",{relatedTarget:v});qc($,y);let x=no($);l(x)}},{capture:!0})}},[r,i,u,o,l]);return e?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:l}}}function je(t={}){let{autoFocus:e=!1,isTextInput:n,within:r}=t,i=c.useRef({isFocused:!1,isFocusVisible:e||Rt()}),[s,o]=c.useState(!1),[a,l]=c.useState(()=>i.current.isFocused&&i.current.isFocusVisible),u=c.useCallback(()=>l(i.current.isFocused&&i.current.isFocusVisible),[]),d=c.useCallback(h=>{i.current.isFocused=h,i.current.isFocusVisible=Rt(),o(h),u()},[u]);Lh(h=>{i.current.isFocusVisible=h,u()},[n,s],{enabled:s,isTextInput:n});let{focusProps:m}=oo({isDisabled:r,onFocusChange:d}),{focusWithinProps:p}=Tn({isDisabled:!r,onFocusWithinChange:d});return{isFocused:s,isFocusVisible:a,focusProps:r?p:m}}let hs=!1,xr=0;function Km(){hs=!0,setTimeout(()=>{hs=!1},500)}function Ga(t){t.pointerType==="touch"&&Km()}function Fm(){let t=ne(null);if(!(typeof t>"u"))return xr===0&&typeof PointerEvent<"u"&&t.addEventListener("pointerup",Ga),xr++,()=>{xr--,!(xr>0)&&typeof PointerEvent<"u"&&t.removeEventListener("pointerup",Ga)}}function ke(t){let{onHoverStart:e,onHoverChange:n,onHoverEnd:r,isDisabled:i}=t,[s,o]=c.useState(!1),a=c.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;c.useEffect(Fm,[]);let{addGlobalListener:l,removeAllGlobalListeners:u}=pi(),{hoverProps:d,triggerHoverEnd:m}=c.useMemo(()=>{let p=(y,g)=>{if(a.pointerType=g,i||g==="touch"||a.isHovered||!Z(y.currentTarget,_(y)))return;a.isHovered=!0;let v=y.currentTarget;a.target=v,l(ne(_(y)),"pointerover",$=>{a.isHovered&&a.target&&!Z(a.target,_($))&&h($,$.pointerType)},{capture:!0}),e&&e({type:"hoverstart",target:v,pointerType:g}),n&&n(!0),o(!0)},h=(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),o(!1))},b={};return typeof PointerEvent<"u"&&(b.onPointerEnter=y=>{hs&&y.pointerType==="mouse"||p(y,y.pointerType)},b.onPointerLeave=y=>{!i&&Z(y.currentTarget,_(y))&&h(y,y.pointerType)}),{hoverProps:b,triggerHoverEnd:h}},[e,n,r,i,a,l,u]);return c.useEffect(()=>{i&&m({currentTarget:a.target},a.pointerType)},[i]),{hoverProps:d,isHovered:s}}const _m=c.createContext(null),po=c.forwardRef(function(e,n){[e,n]=ae(e,n,_m);let r=e.href&&!e.isDisabled?"a":"span",{linkProps:i,isPressed:s}=Dm({...e,elementType:r},n),o=Q[r],{hoverProps:a,isHovered:l}=ke(e),{focusProps:u,isFocused:d,isFocusVisible:m}=je(),p=ie({...e,defaultClassName:"react-aria-Link",values:{isCurrent:!!e["aria-current"],isDisabled:e.isDisabled||!1,isPressed:s,isHovered:l,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()}},a=d=>{let m=_(d),p=d.relatedTarget;p&&An(p)?(p.focus({preventScroll:!0}),El(p,An(m))):p||m.parentElement?.closest("[tabindex]")?.focus({preventScroll:!0})},l=HTMLElement.prototype.focus;Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(d){let m=se(),p=m!=null&&An(m);l.call(this,{...d,preventScroll:!0}),(!d||!d.preventScroll)&&El(this,p)}});let u=ot(bn(document,"touchstart",r,{passive:!1,capture:!0}),bn(document,"touchmove",o,{passive:!1,capture:!0}),bn(document,"blur",a,!0));return()=>{t(),u(),i.remove(),Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:l})}}function El(t,e){e||!On?Sl(t):On.addEventListener("resize",()=>Sl(t),{once:!0})}function Sl(t){let e=document.scrollingElement||document.documentElement,n=t;for(;n&&n!==e;){let r=mo(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;On&&(o=Math.min(o,On.offsetTop+On.height));let a=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+a)),behavior:"smooth"})}}n=r.parentElement}}function rg(t,e){let{triggerRef:n,popoverRef:r,groupRef:i,isNonModal:s,isKeyboardDismissDisabled:o,shouldCloseOnInteractOutside:a,...l}=t,u=l.trigger==="SubmenuTrigger",{overlayProps:d,underlayProps:m}=hd({isOpen:e.isOpen,onClose:e.close,shouldCloseOnBlur:!0,isDismissable:!s||u,isKeyboardDismissDisabled:o,shouldCloseOnInteractOutside:a},i??r),{overlayProps:p,arrowProps:h,placement:b,triggerAnchorPoint:y}=pd({...l,targetRef:n,overlayRef:r,isOpen:e.isOpen,onClose:s&&!u?e.close:null,getTargetRect:l.getTargetRect??(e.point?()=>new DOMRect(e.point.x,e.point.y,0,0):void 0)});md({isDisabled:s||!e.isOpen}),c.useEffect(()=>{if(e.isOpen&&r.current)return s?Bb(i?.current??r.current):ud([i?.current??r.current],{shouldUseInert:!0})},[s,e.isOpen,r,i]);let{focusWithinProps:g}=Tn(t);return{popoverProps:A(d,p,g),arrowProps:h,underlayProps:m,placement:b,triggerAnchorPoint:y}}var bd={};bd={dismiss:"Dismiss"};var gd={};gd={dismiss:"取消"};var yd={};yd={dismiss:"關閉"};var vd={};vd={"ar-AE":S,"bg-BG":S,"cs-CZ":S,"da-DK":S,"de-DE":S,"el-GR":S,"en-US":bd,"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":gd,"zh-TW":yd};function ig(t){return t&&t.__esModule?t.default:t}function Es(t){let{onDismiss:e,...n}=t,r=en(ig(vd),"@react-aria/overlays"),i=or(n,r.format("dismiss")),s=()=>{e&&e()};return E.createElement(bo,null,E.createElement("button",{...i,tabIndex:-1,onClick:s,style:{width:1,height:1}}))}const $d=E.forwardRef(({children:t,...e},n)=>{let r=c.useRef(!1),i=c.useContext(Jn),s=A(i||{},{...e,register(){r.current=!0,i&&i.register()}});return s.ref=we(n||i?.ref),ao(i,s.ref),c.useEffect(()=>{r.current||(r.current=!0)},[]),E.createElement(Jn.Provider,{value:s},t)});function sg({children:t}){let e=c.useMemo(()=>({register:()=>{}}),[]);return E.createElement(Jn.Provider,{value:e},t)}const og=c.createContext({});function Do(){return c.useContext(og)??{}}const xd=E.createContext(null);function Ss(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:a}=Do();if(!t.portalContainer&&a&&(n=a()),!n)return null;let l=t.children;return t.disableFocusManagement||(l=E.createElement(Po,{restoreFocus:!0,contain:(t.shouldContainFocus||i)&&!r},l)),l=E.createElement(xd.Provider,{value:o},E.createElement(sg,null,E.createElement(Wn.Provider,{value:null},l))),Fc.createPortal(l,n)}function wd(){let e=c.useContext(xd)?.setContain;te(()=>{e?.(!0)},[e])}function ur(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]),a=c.useCallback(()=>{n(!e)},[n,e]);return{isOpen:e,setOpen:n,open:s,close:o,toggle:a,point:r,setPoint:i}}function dr(t,e=!0){let[n,r]=c.useState(!0),i=n&&e;return te(()=>{if(i&&t.current&&"getAnimations"in t.current)for(let s of t.current.getAnimations())s instanceof CSSTransition&&s.cancel()},[t,i]),Ed(t,i,c.useCallback(()=>r(!1),[])),i}function Xn(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 Ed(t,i,c.useCallback(()=>{r(s=>s==="exiting"?"closed":s)},[])),i}function Ed(t,e,n){te(()=>{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(`
`),a=Cr.get(o);a&&Et.close(a);const l=Et.add({kind:t,text:i,detail:s,action:r},{timeout:r?void 0:5e3,onClose:()=>{Cr.get(o)===l&&Cr.delete(o)}});Cr.set(o,l)},Ky=(t,e,n,r)=>{const i=Yo(t,e,n);Le(i.kind,i.text,{detail:i.detail,action:r})},Fy={positive:iy,negative:Cs,info:of,neutral:null};function _y({placement:t="bottom"}){const[e,n="center"]=t.split(" "),r=ee(),[i,s]=c.useState(!1);return c.useEffect(()=>{i?Et.pauseAll():Et.resumeAll()},[i]),c.useEffect(()=>Et.subscribe(()=>{Et.visibleToasts.length===0&&s(!1)}),[]),c.useEffect(()=>{if(!i)return;const o=a=>{if(a.key!=="Escape")return;(a.target?.closest?.(".rp-toasts")||!document.querySelector(bf))&&s(!1)};return addEventListener("keydown",o),()=>removeEventListener("keydown",o)},[i]),f.jsxs(_0,{queue:Et,className:W("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:()=>Et.clear(),children:r("toast.clearAll")}),f.jsx(Ne,{className:"rp-btn sm",onPress:()=>s(!1),children:r("toast.collapse")})]}),f.jsx(Ay,{expanded:i,edge:e,onExpand:()=>s(!0)})]})}function Ay({expanded:t,edge:e,onExpand:n}){const r=c.useContext($i),i=r.visibleToasts;return f.jsx(Qd,{className:"rp-toast-list",children:({toast:s})=>{const o=i.indexOf(s);return f.jsx(Oy,{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 Oy({item:t,state:e,depth:n,count:r,background:i,more:s}){const o=ee(),a=Fy[t.content.kind],{text:l,detail:u,action:d}=t.content;return f.jsxs(A0,{toast:t,className:W("rp-toast",t.content.kind,i&&"background"),style:{zIndex:r-n,"--i":Math.min(n,3)},inert:i||void 0,children:[f.jsxs(O0,{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:l}),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":o("close"),children:f.jsx(zo,{})}),(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:W(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 Vn=null;const Rs=new Set,Ms=()=>Rs.forEach(t=>t());typeof window<"u"&&(addEventListener("beforeinstallprompt",t=>{t.preventDefault(),Vn=t,Ms()}),addEventListener("appinstalled",()=>{Vn=null,Ms()}));function M7(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 N7(){const t=ee(),e=c.useSyncExternalStore(n=>(Rs.add(n),()=>Rs.delete(n)),()=>Vn,()=>null);return e?async()=>{if(Vn!==e)return!1;Vn=null,Ms();try{return await e.prompt(),(await e.userChoice).outcome==="accepted"}catch(n){return Le("negative",t("settings.installFailed"),{detail:xi(n,t)}),!1}}:null}function Ns({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:W("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 By({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:W("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
`)),l=c.useRef(null),u=c.useRef(!1),d=c.useCallback(m=>(l.current=m,()=>{u.current=m.contains(document.activeElement),l.current=null}),[]);return c.useLayoutEffect(()=>{a&&s.current?.contains(document.activeElement)&&l.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(q0,{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(G0,{id:m,className:"rp-btn",children:p},m))]}),a&&f.jsx("div",{ref:d,className:"rp-segpick",children:f.jsx(Jy,{bare:!0,label:r,value:e,onChange:n,isDisabled:i,items:t.map(([m,p])=>({id:m,label:p}))})})]})}function I7({children:t,isSelected:e,onChange:n,isDisabled:r,"aria-label":i,"aria-describedby":s}){return f.jsxs(l0,{className:"rp-switch",isSelected:e,onChange:n,isDisabled:r,"aria-label":i,"aria-describedby":s,children:[f.jsx("span",{className:"track"}),t]})}function Yy({label:t,width:e,search:n,large:r,side:i,className:s,placeholder:o,description:a,error:l,action:u,reveal:d,prefix:m,suffix:p,autoComplete:h,spellCheck:b,...y}){const g=ee(),v=c.useId(),$=l?{isInvalid:!0,validationBehavior:"aria"}:{};if(n)return f.jsxs(Jg,{...$,...y,"aria-label":t,className:W("rp-search-field",s),style:e?{width:e}:void 0,children:[f.jsxs("span",{className:W("rp-input",r&&"lg"),children:[f.jsx(Ns,{}),f.jsx(tl,{placeholder:o??t,autoComplete:h,spellCheck:b}),f.jsx(Ne,{className:"clear","aria-label":g("clear"),children:f.jsx(zo,{})})]}),l&&f.jsxs(Za,{className:"rp-field-error",children:[f.jsx(Cs,{}),l]})]});const x=f.jsxs("span",{className:W("rp-input",(i||!!u)&&"rp-grow",(m||p)&&"affixed"),children:[m&&f.jsx("span",{className:"affix",id:`${v}-prefix`,children:m}),f.jsx(tl,{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(Vy,{}):f.jsx(By,{})})]});return f.jsxs(C0,{...$,...y,"aria-describedby":[m&&`${v}-prefix`,p&&`${v}-suffix`].filter(Boolean).join(" ")||void 0,className:W(i?"rp-cluster":"rp-field",s),style:e?{width:e}:void 0,children:[f.jsx(Nu,{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}),l&&f.jsxs(Za,{className:"rp-field-error",children:[f.jsx(Cs,{}),l]})]})}function j7({title:t,children:e,...n}){return f.jsxs(Dg,{...n,className:"rp-disclosure",children:[f.jsx(ho,{level:3,children:f.jsxs(Ne,{slot:"trigger",className:"rp-btn quiet rp-disclosure-trigger",children:[f.jsx(Jt,{}),t]})}),f.jsx(Kg,{className:"rp-disclosure-panel",children:f.jsx("div",{className:"rp-disclosure-content",children:e})})]})}function D7({children:t}){return f.jsx(Lg,{className:"rp-col",allowsMultipleExpanded:!0,children:t})}function na({trigger:t,title:e,children:n,footer:r,narrow:i,alert:s,isOpen:o,onOpenChange:a,hideTitle:l,locked:u,reason:d}){const m=f.jsx(Oo,{className:"rp-underlay",isDismissable:!s&&!u,isKeyboardDismissDisabled:u,isOpen:o,onOpenChange:a,children:f.jsx(Ad,{className:W("rp-modal",i&&"narrow"),children:f.jsx(Wr,{className:"rp-dialog",role:s?"alertdialog":"dialog","aria-label":l?e:void 0,children:({close:p})=>f.jsxs(hf,{reason:r?d:null,children:[!l&&f.jsx(ho,{slot:"title",children:e}),typeof n=="function"?n(p):n,r&&f.jsx("div",{className:"foot",children:r(p)})]})})})});return t?f.jsxs(Dd,{children:[t,m]}):m}function ra({trigger:t,triggerRef:e,isOpen:n,onOpenChange:r,title:i,label:s,subtitle:o,placement:a="top start",children:l}){const u=f.jsx(yi,{className:i?"rp-popover rp-popover-dialog":"rp-popover",placement:a,...t?{}:{triggerRef:e,isOpen:n,onOpenChange:r},children:i?f.jsx(Wr,{className:"rp-popover-body",children:({close:d})=>f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"rp-popover-head",children:[f.jsx(ho,{slot:"title",children:i}),o]}),l(d)]})}):f.jsx(Wr,{className:"rp-popover-note","aria-label":s,children:({close:d})=>l(d)})});return t?f.jsxs(Dd,{children:[t,u]}):u}function xf({title:t,isOpen:e,onCancel:n,confirmLabel:r,onConfirm:i,tone:s="negative",isPending:o,isDisabled:a,reason:l,error:u,children:d}){const m=ee();return f.jsxs(na,{title:t,narrow:!0,alert:s==="negative",isOpen:e,reason:l,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:a,isPending:o,onPress:i,children:r})]}),children:[u&&f.jsx(Zo,{takeFocus:!0,children:u.text},u.id),d]})}function K7({label:t,confirmationText:e,isDisabled:n,isPending:r,onConfirm:i,onAbort:s,open:o,setOpen:a}){const l=ee(),[u,d]=c.useState(!1),[m,p]=c.useState(!1),[h,b]=c Line truncated
`)}),a="",l=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"&&(a=y),b==="data"&&u.push(y),b==="id"&&!y.includes("\0")&&(l=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 Hn(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 B1=3,_s=new Set,As=new Set;let Af=null;function ic(){Af=[..._s].reduce((t,e)=>t&&t.until>=e.until?t:e,null),As.forEach(t=>t())}const V1=()=>Af;function H1(t){return As.add(t),()=>void As.delete(t)}async function U1(t,e,n){if(e<=B1)return Hn(e,n);const r={status:t,until:Date.now()+e*1e3};_s.add(r),ic();try{await Hn(e,n)}finally{_s.delete(r),ic()}}const G7=["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"],z1={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 J7(t){return z1[t.toLowerCase().replace(/\(.*$/,"")]}const Y7=["select","urltest","roundrobin","fallback","score","fixed","min_moving_avg","min_avg10","min_last_delay","loadbalance"],X7=[{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"}],ei=["direct","block"],Z7=[...ei,...ei.map(t=>`${t}(must)`)],Pn=t=>t!=null&&ei.includes(t);function Q7(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 q1={warm:0,unknown:1,mixed:2,cold:3},W1={tcp_connect:0,http_headers:1,http_round_trip:2,quic_handshake:3,mixed:4,unknown:5,dns_round_trip:6};function G1(t){const e=n=>(q1[n.warmth]??1)*100+(W1[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=>G1(t.health),Y1=t=>t?.state==="healthy"&&t.latency_ms!=null?t.latency_ms:void 0,X1=(t,e)=>(t??1/0)-(e??1/0)||0;function Z1(t){const e=t?js(...t.outbounds.map(r=>r.download_bytes)):null,n=(t?.outbounds??[]).map(r=>({name:r.name,kind:r.kind,bytes:De(r.download_bytes),percent:sa(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 Q1(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 ev=t=>Pn(t.protocol)?"builtin":"unattributed";function tv(t,e){let n=t;for(;e.some(r=>r.id===n);)n+="-";return n}const e$=(t,e)=>t.provider_id??tv(ev(t),e);function Of(t){if(t)return Q1(t.startsWith("[")?t.slice(1,t.indexOf("]")):t.split(":").length===2?t.split(":")[0]:t)}function fa(t,e){return t==="direct"?e("ui.direct"):t==="block"?e("ui.block"):t===null||t==="unknown"?e("ui.unknown"):t}const nv=(t,e)=>t.map(n=>e?.get(n)??n);function rv(t,e,n){return Pn(t.outbound)?e?fa(t.outbound,e):t.outbound:nv(t.chain,n).join(" → ")||"—"}function t$(t,e,n){if(Pn(t.outbound))return fa(t.outbound,e);const r=t.chain.at(-1);return r?n?.get(r)??r:t.outbound&&t.outbound!=="unknown"?t.outbound:"—"}const n$=(t,e,n)=>t.chain.length>1?rv(t,e,n):null,iv={starting:"lifecycle.starting",running:"lifecycle.running",reloading:"lifecycle.reloading",suspended:"lifecycle.suspended",draining:"lifecycle.draining",degraded:"lifecycle.degraded",failed:"lifecycle.failed"},sv=t=>t==="running"?"ok":t==="failed"?"err":"warn",ov=t=>t>90?"err":t>75?"warn":"ok",r$=t=>t.closed?t.skipped?"info":"positive":"negative",i$={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 av(t){return t?[...t.tcp.map(e=>({...e,network:"tcp"})),...t.udp.map(e=>({...e,network:"udp"}))]:[]}const Bf=["stream.ready","runtime.updated","flow.updated","flow.gap","operation.updated","generation.changed"],l Line truncated
`&&i++,o++;continue}const l=o,u=i;let d="text";if(a==="#")for(d="comment";o<t.length&&t[o]!==`
`;)o++;else if(a==="'"||a==='"')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===a)break}else if("{}:(),".includes(a))d="symbol",o++;else if(a==="-"&&t[o+1]===">")o+=2;else for(;o<t.length&&!/[\s{}:(),'"]/.test(t[o])&&!(t[o]==="-"&&t[o+1]===">");)o++;const m={from:l,to:o,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 h=e[p],b={name:h?on(t.slice(h.from,h.to)):"",from:h?.from??l,open:l,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"&&a==="}"){const p=r.pop();p&&(p.close=l,p.to=o,p.endLine=i)}else d==="symbol"&&a==="("?s++:d==="symbol"&&a===")"&&(s=Math.max(0,s-1));e.push(m)}return{blocks:n,tokens:e}}function u2(t){if(/[\r\n]/.test(t))return!1;let e=0;for(const n of Ie(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 on=t=>/^['"]/.test(t)?t.slice(1,-1):t;function sp(t){const e=Ie(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 xa(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 a=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 l=n[s+1];o.parens===0&&(o.kind==="text"||o.kind==="quoted")&&l&&t.slice(l.from,l.to)===":"?(i={name:on(a),from:o.from,to:l.to,valueFrom:l.to,valueTo:l.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 d2(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 $$(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 a=o===-1?s:Math.min(o,s);const l=e.children.find(u=>u.from>=r&&u.from<=a);if(l){const u=t.indexOf(`
`,l.to);a=u===-1?s:Math.min(u,s)}n.push({from:r,to:a,block:l}),r=a+1}return n}function f2(t){const{blocks:e}=Ie(t);return e.filter(n=>n.name==="include").flatMap(n=>d2(t,n).map(r=>on(sp(r).trim()))).filter(Boolean)}const dc=t=>/[*?]/.test(t);function p2(t,e){const n=t.replace(/^\.\//,"").split(/([*?])/).map(r=>r==="*"?"[^/]*":r==="?"?"[^/]":r.replace(/[.+^${}()|[\]\\]/g,"\\$&")).join("");return new RegExp("^"+n+"$").test(e)}const h2=(t,e)=>t.some(n=>p2(n,e));function fc(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 x$(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=>f2(r.content).map(i=>fc(e.path,i)));return r=>h2(n,fc(e.path,r))}function w$(t){for(const e of t.map(n=>n.replace(/^\.\//,""))){const n=e.lastIndexOf("/");if(n>0&&dc(e.slice(n))&&!dc(e.slice(0,n)))return e.slice(0,n+1)}return""}function op(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 E$(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")||op(i+"name"+s)||e.some(o=>o.pattern===n)||e.push({pattern:n,prefix:i,suffix:s})}return e}function S$(t,e){if(t.includes("/"))return"config.newSourceNameSlash";const n=op(e.prefix+t+e.suffix);return n==="config.newSourceControl"?"config.newSourceNameControl":n}function m2(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 ap(t=!0){const e=oe();return Ee({key:["config"],every:0,fetch:n=>e.config(n)},{enabled:t})}function wa(t,e){return t.config(e)}async function lp(t){return t.content!==void 0&&await K1(t.content)===t.content_sha256}function b2(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 lp(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 g2(t){const e=c.useMemo(()=>t?[t]:[],[t]),n=b2(e);return t?n(t)??null:null}function y2(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 pc=t=>new TextEncoder().encode(t).length,hc=t=>Sn(413,"request_too_large",`Configuration exceeds the ${t}-byte limit`,"config.tooLarge",{limit:t});function v2(t,e,n){const[r]=[{limit:t.content,size:pc(e)},{limit:t.body,size:pc(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 mc(t,e,n,r){const i=v2(t,e,n);if(i?.exceeded)throw hc(i.limit);return r().catch(s=>{throw s instanceof $e&&s.status===413&&i?hc(i.limit):s})}function cp(t,e,n){return sn(t,e,n).catch(r=>{throw n.aborted||r instanceof he?r:(Nn(),new he("ui.operationUnknown"))})}async function $2(t,e,n){const r=await cp(t,await t.createConfigSource(e,"",n),n);jt(r,"reload"),n.throwIfAborted();const i=await wa(t,n).catch(()=>(n.throwIfAborted(),null));return i&&(m2(i.sources,e)?.id??null)}function P$(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 $2(e,i,s).finally(t)})),[e,r,t])}}function up(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,a=r?.resources.config.max_bytes,l=i?.max_bytes,u=c.useCallback((v,$)=>mc({content:l,body:o},v.sources.map(x=>x.content??"").join(""),v,()=>n.validateConfig(v,$)),[n,l,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 lp(v))throw new he("config.incomplete");x.throwIfAborted();const w=typeof $=="string"?$:$(v.content);if(w===null)return;if(s&&v.kind==="main"&&v.path!=="<redacted>"){const P=await u({sources:[{id:v.id,path:v.path,content:w}],mode:"full"},x);if(x.throwIfAborted(),!P.valid)return{diagnostics:P.diagnostics}}const R=await mc({content:a,body:o},w,{content:w},()=>n.replaceConfigSource(v.id,w,Yf(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=xa(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 k2(t,o,h,g,n);const v=[b,...h.map(x=>x.from),o.close],$=v.slice(0,-1).flatMap((x,w)=>{const R=t.slice(x,v[w+1]).trim();return R?[g+R]:[]});return Pa(t.slice(0,b)+`
`+$.map(x=>x+`
`).join("")+p+t.slice(o.close),e,n)}const a=s.at(-1),l=a?t.slice(a.open+1,a.close).match(/\n([ \t]+)\S/)?.[1]??" ":" ",u=[`${l}${fp(e)} {`,...n.filters.map(d=>`${l}${l}filter: ${d}`),...n.policy?[`${l}${l}policy: ${n.policy}`]:[],`${l}}`].join(`
`);if(a){const d=t.lastIndexOf(`
`,a.close-1)+1,m=/^[ \t]*$/.test(t.slice(d,a.close))?d:a.close;return t.slice(0,m)+(t[m-1]===`
`?"":`
`)+u+`
`+t.slice(m)}return`${t.replace(/\n+$/,"")}
group {
${u}
}
`}function k2(t,e,n,r,i){const s=n.filter(p=>p.name==="filter"),o=n.filter(p=>p.name==="policy"),a=[],l=p=>t.indexOf(`
`,p)+1,u=p=>{const h=t.lastIndexOf(`
`,p.from-1)+1,b=l(p.to),y=/^[ \t\r]*$/.test(t.slice(h,p.from))&&b>0&&/^[ \t\r]*$/.test(t.slice(p.to,b-1));a.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];a.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?l(s.at(-1).to):o.length?t.lastIndexOf(`
`,o[0].from-1)+1:l(e.open);a.push({from:p,to:p,text:m})}return a.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 nr(t,e){const n=Ie(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 a=n[o];if(a.parens!==1)return null;if(s){if(a.kind!=="text"&&a.kind!=="quoted"||a.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 ni=(t,e)=>t.flatMap(n=>(nr(n,e)??[]).map(on));function M$(t){return ni(t.filters,"name")}function N$(t){return{names:ni(t.filters,"name"),subtags:ni(t.filters,"subtag"),rules:t.filters.filter(e=>nr(e,"name")===null&&nr(e,"subtag")===null)}}function L$(t,e,n){return t.filters.every(r=>{const i=nr(r,e);return i!==null&&i.every(s=>on(s)===n)})}function Li(t,e,n,r,i){const s=Sa(t).find(p=>p.name===e);if(!s&&!r.length)return t;const o=new Set(i),a=new Set(ni(s?.filters??[],n).filter(p=>!o.has(p))),l=[...new Set(r)].filter(p=>!a.has(p)&&!o.has(p)),u=p=>l.map(p.length&&p.every(h=>h.startsWith("'"))?Ni:fp);let d=!l.length;const m=[];for(const p of s?.filters??[]){const h=nr(p,n);if(h===null){m.push(p);continue}const b=h.filter(g=>!o.has(on(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:Pa(t,e,{filters:m,policy:s?.policy??null})}const T2=(t,e,n)=>Li(t,e,"name",n,[]),R2=(t,e,n)=>Li(t,e,"name",[],n),M2=(t,e,n)=>Li(t,e,"subtag",n,[]),N2=(t,e,n)=>Li(t,e,"subtag",[],n);function pp(t,e){const n=[];let r=0,i=null,s=0;for(let o=0;o<t.length;o++){const a=t[o];i?a==="\\"?o++:a===i&&(i=null):a==="'"||a==='"'?i=a:a==="("?r++:a===")"?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 L2(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 pp(n.slice(r.length+1,-1),",")){const a=/^keyword:\s*/.exec(o),l=/^regex:\s*/.exec(o),u=on((a??l?o.slice((a??l)[0].length):o).trim());if(u)if(a)s.push(d=>d.includes(u));else if(l){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 I2(t){const e=pp(t,"&&").map(L2);return e.every(n=>n!==null)&&e.length?e:null}function j2(t){const e=t.map(I2).filter(n=>n!==null);if(!e.length){const n=t.some(r=>r.startsWith("group("));return r=>!n&&!Pn(r.name)}return n=>e.some(r=>(!Pn(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 I$=(t,e)=>j2(t)(e);function D2(t,e){switch(e.kind){case"addNode":return T2(t,e.group,[e.value]);case"removeNode":return R2(t,e.group,[e.value]);case"addSubscription":return M2(t,e.group,[e.value]);case"removeSubscription":return N2(t,e.group,[e.value]);case"createGroup":return Sa(t).some(n=>n.name===e.group)?t:Pa(t,e.group,{filters:[],policy:e.policy})}}const j$=(t,e)=>e.reduce(D2,t),D$=["domainSuffix","domain","geosite","dip","geoip","sip","dport","sport","pname","l4proto"],yc=["qnameSuffix","qnameFull","qnameKeyword","qnameGeosite","qtype","sip"],K$={request:yc,response:[...yc,"upstream","answerIp","answerGeoip"]};function F$(t,e){const n=e.split(/[,\s]+/).map(i=>i.trim()).filter(Boolean);if(n.some(i=>K2.test(i)||i.includes(":")&&!ip(i)))return null;const r=F2(t,n);return u2(r)&&!r.includes("->")?r:null}const K2=/[()'"#{}]|&&|->/;function F2(t,e){const n=e.map(s=>s.includes(":")?Ni(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})`;case"qnameSuffix":return`qname(${i("suffix")})`;case"qnameFull":return`qname(${i("full")})`;case"qnameKeyword":return`qname(${i("keyword")})`;case"qnameGeosite":return`qname(${i("geosite")})`;case"qtype":return`qtype(${r})`;case"upstream":return`upstream(${r})`;case"answerIp":return`ip(${r})`;case"answerGeoip":return`ip(${i("geoip")})`}}function _$(t,e){const r=t.map(i=>i.id===e?.id?e.content:i.content).flatMap(i=>i===void 0?[]:Sa(i));return[...new Map(r.map(({name:i,written:s})=>[s,{name:i,written:s}])).values()]}const qs=t=>t.path==="<redacted>"||t.path==="",_2=t=>qs(t)?t.kind==="main"?"config.dae":`${t.kind}-${t.id.slice(0,8)}.dae`:t.path.split("/").pop()||"config.dae";function A$(t,e){c Line truncated
`,d.from-1)+1,w=i.indexOf(`
`,m.to),R=w===-1?i.length:w+1;return{from:x,to:R,indent:i.slice(x,d.from),text:i.slice(x,R),target:{from:y.to,to:m.to}}}function O2(t,e,n){return hp(t,e,{within:r=>r.filter(i=>i.name==="routing"),fallbacks:["fallback"],target:(e.outbound??"")+(e.must?"(must)":"")},n)}const B2=t=>t.action==="upstream"||t.action==="requery"?t.upstream??"":t.action,is=(t,e)=>t.filter(n=>n.name===e),mp=(t,e)=>is(t,"dns").flatMap(n=>is(n.children,"routing")).flatMap(n=>is(n.children,e));function B$(t,e,n,r){return hp(t,e,{within:i=>mp(i,n),fallbacks:["fallback","default"],target:B2(e),foldCase:!0},r)}function V$(t,e){const n=t.flatMap(m=>m.content===void 0?[]:mp(Ie(m.content).blocks,e).map(p=>({source:m,text:m.content,block:p})));if(n.length!==1||!n[0].source.writable)return null;const{source:r,text:i,block:s}=n[0],o=i.lastIndexOf(`
`,s.close-1)+1,a=i.slice(o,s.close);if(o<=s.open||!/^[ \t]*$/.test(a))return null;const l=i.indexOf(`
`,s.close),u=l===-1?i.length:l+1,d=i.slice(s.open+1,s.close).match(/\n([ \t]+)\S/)?.[1]??a+(a.slice(0,a.length/s.depth)||" ");return{source:r,anchor:{from:o,to:u,indent:d,text:i.slice(o,u)}}}function H$(t,e=Ie(t)){return e.blocks.filter(n=>n.name==="dns").flatMap(n=>n.children.filter(r=>r.name==="upstream")).flatMap(n=>xa(t,n,e.tokens).map(r=>t.slice(r.from,e.tokens.find(i=>i.from===r.from).to)))}const Ca=(t,e,n=!1)=>`${t} -> ${e}${n?"(must)":""}`,U$=t=>[...t.map(e=>e.name),...ei].map(e=>({id:e,label:e}));function z$(t,e,n,r,i){return t.slice(e.from,e.to)===e.text?t.slice(0,e.from)+`${e.indent}${Ca(n,r,i)}
`+t.slice(e.from):null}function q$(t,e,n,r){return e.target&&t.slice(e.from,e.to)===e.text?t.slice(0,e.target.from)+` ${n}${r?"(must)":""}`+t.slice(e.target.to):null}function W$(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=Ie(n),i=e.map(a=>({rule:a,anchor:O2(t,a.before,r)}));if(i.some(a=>!a.anchor))return null;i.sort((a,l)=>a.anchor.from-l.anchor.from||a.rule.id-l.rule.id);let s="",o=0;for(const{rule:a,anchor:l}of i)s+=n.slice(o,l.from)+l.indent+Ca(a.condition,a.outbound,a.must)+`
`,o=l.from;return s+n.slice(o)}function ka(t){const e=new Map;for(const n of t)e.set(n.sourceId,[...e.get(n.sourceId)??[],n]);return[...e.values()]}function vc(t,e,n,r){const i=e??(t instanceof $e&&t.status===422?t.details?.diagnostics??null:null);if(!i)return{text:Sy(Yo(t,r,r("ui.writeFailed")),r),lines:[]};const s=i.filter(a=>a.level==="error").length,o=A2(i);return{text:o?r("config.writeRestart",{n:o}):s?r("ui.writeInvalid",{n:s}):r("rule.refused"),lines:i.map(a=>{const l=Jo(Go(a.code,a.message,r),r),u=n.find(d=>d.id===a.source_id);return a.line===null?l:r("config.atFile",{file:u?_2(u):a.source_id,line:a.line,message:l})})}}function G$(t,e,n){const r=ka(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:Ca(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 $c=()=>void Nn();function U2(){const t=ee(),e=up($c,{rethrow:!0}),n=dp().applying,r=c.useRef(null);c.useEffect(()=>()=>r.current?.abort(),[]);const i=async(l,u)=>{let d=[],m;try{if(d=(await wa(oe(),u)).sources,u.aborted)return;const p=d.find(b=>b.id===l[0].sourceId),h=p&&await e.apply(p,()=>m=V2(p,l));return!p||m===null?($c(),{written:!1,failure:{text:t("rule.stale"),lines:[]}}):h?h.diagnostics?{written:!1,failure:vc(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:vc(p,null,d,t)}}},s=async(l,u)=>{let d=0;for(const m of ka(l)){const p=await i(m,u);if(!p)return;p.written&&$n.remove(m.map(b=>b.id));const h=p.written?m.length:0;if(p.failure)return{written:d+h,failure:H2(p.failure,d&&d+h,l.length-d-h,t)};d+=h}return{written:d,failure:null}};return{apply:async l=>{if(!$n.begin())return;const u=new AbortController;r.current=u;try{return await s(l,u.signal)}finally{r.current===u&&(r.current=null),$n.end()}},busy:n,cancel:()=>{r.current?.abort(),e.cancel()}}}function z2(){const t=ee(),{rules:e}=dp(),{apply:n,busy:r}=U2(),i=ka(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&&($n.fail(s.failure),Le(s.failure?"negative":"positive",s.failure?s.failure.text:t("rule.applied",{n:e.length})))}}}function q2(t,e,n,r){return Object.keys(Os).filter(i=>t(i)||e===i).map(i=>({id:i,label:r(Os[i]),isPending:e===i,isDisabled:!!e,onAction:()=>n(i)}))}function W2(t,e,n){const r=ee(),i=Qv(t,e,n),s=o=>void i.run(o).then(a=>{a&&Le("positive",r("ov.operationResult",{action:r(Os[o]),status:r("ov.succeeded"),id:a.operation_id}))},a=>Ky(a,r,r("ov.operationError")));return{canRun:i.canRun,busy:i.busy,run:s,actions:q2(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:W("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 bp({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:W("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:W("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(l=>l.from>=i&&l.to<=r.from);if(s.some(l=>l.depth!==1))return[];const o=s.findIndex(l=>l.parens===0&&t.slice(l.from,l.to)==="->"),a=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:a}]})}function D5(t){const{blocks:e,tokens:n}=Ie(t),r=Cp(t,e,n).find(i=>i.target);return r?r.target==="direct"?{mode:"direct"}:{mode:"global",target:r.target}:{mode:"rule"}}function K5(t,e){const n=Ie(t);for(const p of Cp(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}=Ie(t),s=r.find(p=>p.name==="routing");if(!s)throw new he("act.modeNoRouting");const a=t.slice(s.open+1,s.close).match(/\n([ \t]+)\S/)?.[1]??" ";let l=s.open+1;t[l]===`
`&&l++;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);l=x!==-1&&x<s.close?x+1:v.to;const w=i[p+5];if(w&&w.from<l&&w.kind!=="comment")throw new he("act.modeInterleaved",d(w.from))}const m=e.mode==="direct"?"direct":e.target;return t.slice(0,l)+(t[l-1]===`
`?"":`
`)+`${a}l4proto(tcp, udp) -> ${m} ${Pp}
`+t.slice(l)}const F5=(t,e)=>t.mode===e.mode&&(t.mode!=="global"||e.mode!=="global"||t.target===e.target),Nc=["ok","warn","err"];function _5(t,e,n,r){const i=sv(t),s=t?Sp(iv,t,r):n;return!t||e!=="degraded"&&e!=="failed"?{tone:i,text:s,href:null}:{tone:Nc[Math.max(Nc.indexOf(i),e==="failed"?2:1)],text:r(e==="failed"?"ov.status.datapathFailed":"ov.status.datapathDegraded",{status:s}),href:nt("overview",{card:"datapath"})}}const kp={rule:"mode.rule",direct:"mode.direct",global:"mode.global"};function A5(t,e,n,r,i,s,o=!0){const a=r?e??t:t,l=a.mode==="global"?a.target:(t.mode==="global"?t.target:n[0]?.name)??"";return{mode:o?a.mode:"",target:o?l:"",targetText:o&&l||"—",writable:r,dirty:r&&e!==null&&!F5(e,t),incomplete:a.mode==="global"&&!l,status:s(i?"act.modeReadOnly":"act.modeUnavailable"),readOnly:i&&!r,modes:["rule","direct","global"].map(u=>[u,s(kp[u])]),targets:n.map(u=>({id:u.name,label:u.name}))}}function O5({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 B5=t=>t.event!=="runtime.updated"&&t.event!=="flow.updated"&&!cv(t),V5=8;function H5(t,e){const n=[];for(const r of t){const i=dv(r,e),s=[r.event,i.key,...Object.entries(i.params??{}).map(([l,u])=>`${l}=${String(u)}`)].join("|"),o=n[n.length-1];if(o&&o.key===s){o.count+=1;continue}if(n.length===V5)break;const a=Object.fromEntries(Object.entries(i.params??{}).map(([l,u])=>[l,typeof u=="string"?fv(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:Sp(lv,r.event,e),value:e(i.key,a)}),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 U5(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 z5(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 a=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:Y1(a),alive:a?.state==="unavailable"?!1:a?.state==="healthy"?!0:void 0,unavailable:a?.state==="unavailable",healthError:a?.error?by(a.error,n):void 0}}),s=i.find(o=>o.id===e)??i.find(o=>o.tcp!==void 0)??i.find(o=>!Pn(o.name))??i[0];return{options:i,big:i.length>12,id:s?.id??"",name:s?.name??"",latency:s?.alive&&s.tcp!==void 0?wf(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 q5={ok:"act.memoryOk",warn:"act.memoryHigh",err:"act.memoryNearLimit"};function W5(t,e,n,r,i="en",s){const o=sa(e?.cgroup?.current_bytes??null,e?.cgroup?.limit_bytes??null),a=o===null?null:ov(o),{tone:l,text:u}=_5(t?.lifecycle.state,s,n(r===!1?"act.modeUnavailable":"ui.loading"),n);return{status:{tone:l,text:u},download:Ds(t?.traffic.rates?.download_bytes_per_second??null,i),upload:Ds(t?.traffic.rates?.upload_bytes_per_second??null,i),connections:t?.traffic.connections.total==null?"—":En(t.traffic.connections.total,i),rss:Xt(e?.process?.rss_bytes??null,i),memoryBadge:a===null?null:{tone:a,text:n(q5[a])}}}function G5(t,e,n,r){const i=Z1(t);return{since:t?r("act.since",{t:e1(t.counter_since,e)}):"",total:Xt(i.total,e),rows:i.rows.map((s,o)=>({name:fa(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 J5(t,e,n,r,i){return j5(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 Y5(){const t=ee(),e=oe(),n=P2(B5);return{rows:c.useMemo(()=>H5(n.records,t),[n.records,t]),total:n.records.length,error:n.error,retry:()=>void Nn().then(()=>Ov(e)),loading:!n.error&&n.available===null,empty:t(n.available===!1?"event.unavailable":"act.noIssues")}}const X5=(t,e)=>t.kind==="invalid"?{kind:"negative",text:e("ui.writeInvalid",{n:t.errors})}:t.kind==="failed"?Yo(t.error,e,e("ui.writeFailed")):null;function Z5(){const t=He().data?.resources,e=tt(t,"config",{whileLoading:!1})&&t?.config.writable===!0&&t?.config.content===!0,n=ap(tt(t,"config",{whileLoading:!1})),r=up(n.refetch,{rethrow:!0}),i=n.data?.sources.find(d=>d.kind==="main"&&d.writable)??null,s=g2(i),o=s?i:null,a=s===!1,l=c.useMemo(()=>n.error??(a?new he("config.incomplete"):null),[n.error,a]),{apply:u}=r;return{main:o,writable:e,busy:r.busy!==null,error:l,retry:n.refetch,apply:c.useCallback(async(d,m=o??void 0)=>{if(!m)return{kind:"failed",error:l??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
`),settingName:t=>`experimental.native_api.${t}`,redactedSections:t=>t.filter(e=>e.name==="experimental"&&e.children.some(n=>n.name==="native_api")).map(e=>({block:e,name:"experimental.native_api"}))},o3={id:"unknown",reason:()=>{},holdsCredentials:()=>!1,snippet:t=>t.map(({key:e,value:n})=>`${e}: ${n}`).join(`
`),settingName:t=>t,redactedSections:()=>[]};function a3(t){switch(t?.api.name){case"dae/honk-native":return s3;default:return o3}}const Ic={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"},l3=["configNotLoaded","configReadOnly","mainReadOnly","recordOff","geodataUpdate","geodataUnreadable","notRunning","flowsIdle","notProvided"],c3={"recorder-off":"recordOff","starting-or-stopping":"notRunning","geodata-mismatch":"geodataUnreadable"},u3={"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 d3(t,e,n,r){const i=t.resources,s=a3(e),o=v=>s.reason(v,t),a=new Map,l=(v,$,x=Ic[$])=>{const w=a.get(v)??[];w.push({id:$,label:n(x)}),a.set(v,w)},u=(v,$)=>({href:Ma(r,v),text:n($),external:!0}),d=(v,$)=>({label:n("ov.lim.why"),text:n(v),link:$}),m=v=>{const $=v.find(k=>k!==void 0),x=$&&u3[$.code];if(!x)return;const w=x.docs&&u(...x.docs),R=v.flatMap(k=>k&&"settings"in k?k.settings:[]);return R.length>0?{label:n("ov.lim.howTo"),text:n(x.text),snippet:s.snippet(R),link:w}:d(x.text,w)},p=i.config.available?i.config.writable!==!0?"configReadOnly":null:"configNotLoaded";p&&l(p,"config");const h=!i.config_validate.available&&p==="configNotLoaded";h&&l("configNotLoaded","config_validate"),(i.nodes.can_manage===!1||i.providers.can_manage===!1)&&l(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(Ic)){const $=i[v];if(v==="config"||v==="config_validate"&&h)continue;const x=v==="flows"&&$.available&&i.flows.recording==="off";if(x||!$.available){const w=o(v)?.code;l((w&&c3[w])??(x?"flowsIdle":"notProvided"),v)}else v==="geodata"&&i.geodata.can_update!==!0&&l(p??"geodataUpdate",v),v==="providers"&&i.providers.can_refresh===!1&&l("notRunning","subscriptions","ov.lim.subscriptions"),v==="connections"&&i.connections.can_close===!1&&l("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,w=()=>$.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(w())};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(w())};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(w())};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=w().some(k=>k?.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 l3.flatMap(v=>{const $=a.get(v);if(!$)return[];const{named:x=[],...w}=g(v,$),R=$.filter(k=>!x.includes(k.id));return[{cause:v,...w,items:$,features:R.length>0?hy(r,$.map(k=>k.label)):void 0}]})}function f3(){const t=ee(),e=Mn(),n=ct[e],r=Ra(),i=He(),s=i.data?.resources,o=qv(tt(s,"runtime",{whileLoading:!1})),a=Zv(tt(s,"runtime_memory",{whileLoading:!1})),l=Yv(tt(s,"datapath",{whileLoading:!1})),[u,d]=c.useState("live"),m=Rc[u]??120,p=M5(i.data,a.data),h=Gv(m,i.data),b=L5(o.data),y=c.useMemo(()=>h.data?I5(h.data):[],[h.data]),g=c.useMemo(()=>Mc(b,y,m),[b,y,m]),v=c.useMemo(()=>Mc(b,y,Rc.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(()=>[ Line truncated
@@ -0,0 +1,66 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./fonts-sc-DWPGxLPK.css","./fonts-tc-B6Zt5HQN.css","./SearchDialog-CtHURV7c.js","./vendor-react-Bf71BWbF.js","./flows-D3eabARZ.js","./nav-CdRBQuvD.js","./nav-xc_Z_1Qd.js","./nav-CS6FFQFP.js","./nav-D5WY5Qjf.js","./nav-BFiTWnsa.js","./nav-Wiib71Wo.js","./nav-DONyavaI.js","./nav-BASDWt23.js","./index-DVuHL8NL.js","./geodata-De9_qBkH.js","./auth-BReGn39D.js","./auth-DzCdgIKH.js","./AreaChart-CO6S-Jvj.js","./layout-BWzq8YqC.js","./AreaCurve-BriPYJva.js","./array-C0P64tl-.js","./Sparkline-m5Y8yApW.js","./Donut-BeIly43C.js","./NodeSearch-aCbtGtHA.js","./Virtualizer-DCY9HC9Z.js","./useFilter-Tjznm3lB.js","./ListLayout-_fDlx5XY.js","./Overview-D8AoxOgR.js","./files-BxEOxSF8.js","./Table-Km6Zv-S8.js","./useGridSelectionCheckbox-COXIVEmS.js","./ActionGroup-DLxTuKht.js","./DaeCode-B8yPDjSE.js","./Connections-EJJs6m0v.js","./FactStrip-DtkOGBRy.js","./ranked-SM2ov7Tw.js","./TimeCell-DKHUJpad.js","./labels-Bgu_ZhL8.js","./useQuickRule-BmFeKwTA.js","./outbounds-DMhWS-9H.js","./Flows-CFBMKQ6x.js","./Coverage-DhDWz2sB.js","./policyText-CltaDVEo.js","./Flows-l5FnUA9B.css","./Dns-4ANKlqye.js","./dns-BCg5F0Tv.js","./Policies-Dgwc4tfn.js","./openGroup-Dk9B33qx.js","./Rules-DPrYBlNM.js","./setup-DLvQ_6ZI.js","./recorder-DlDpPhd4.js","./probe-D0Quphno.js","./Nodes-Cccfa5J0.js","./AddCircle-D11CyK2n.js","./useRefreshAll-D0DryBsY.js","./Config-163650iV.js","./vendor-editor-2EGeBPxF.js","./Events-CoPt5zKa.js","./Logs-CVSaRJiC.js","./Settings-pRdLRQRD.js","./Login-CpQFWFRI.js"])))=>i.map(i=>d[i]);
import{$ as w,r as u,c as Eh,s as lo,a as rn,b as Qc,j as f,d as Sh}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 Ph="modulepreload",kh=function(t,e){return new URL(t,e).href},Ba={},he=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const a=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),c=l?.nonce||l?.getAttribute("nonce");i=o(n.map(d=>{if(d=kh(d,r),d in Ba)return;Ba[d]=!0;const p=d.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(!!r)for(let v=a.length-1;v>=0;v--){const m=a[v];if(m.href===d&&(!p||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${h}`))return;const g=document.createElement("link");if(g.rel=p?"stylesheet":Ph,p||(g.as="script"),g.crossOrigin="",g.href=d,c&&g.setAttribute("nonce",c),document.head.appendChild(g),p)return new Promise((v,m)=>{g.addEventListener("load",v),g.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};function ct(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}const te=typeof document<"u"?w.useLayoutEffect:()=>{},eu={prefix:String(Math.round(Math.random()*1e10)),current:0},tu=w.createContext(eu),Ch=w.createContext(!1);let Ui=new WeakMap;function Th(t=!1){let e=u.useContext(tu),n=u.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=Ui.get(r);i==null?Ui.set(r,{id:e.current,state:r.memoizedState}):r.memoizedState!==i.state&&(e.current=i.id,Ui.delete(r))}n.current=++e.current}return n.current}function Rh(t){let e=u.useContext(tu),n=Th(!!t),r=`react-aria${e.prefix}`;return t||`${r}-${n}`}function Mh(t){let e=w.useId(),[n]=u.useState(et()),r=n?"react-aria":`react-aria${eu.prefix}`;return t||`${r}-${e}`}const Nh=typeof w.useId=="function"?Mh:Rh;function Lh(){return!1}function Ih(){return!0}function jh(t){return()=>{}}function et(){return typeof w.useSyncExternalStore=="function"?w.useSyncExternalStore(jh,Lh,Ih):u.useContext(Ch)}function Dh(t){let[e,n]=u.useState(t),r=u.useRef(e),i=u.useRef(null),s=u.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)});te(()=>{r.current=e,i.current&&s.current()});let o=u.useCallback(a=>{i.current=a(r.current),s.current()},[s]);return[e,o]}let Kh=!!(typeof window<"u"&&window.document&&window.document.createElement),gn=new Map,fn;typeof FinalizationRegistry<"u"&&(fn=new FinalizationRegistry(t=>{gn.delete(t)}));let qi=new WeakMap;function fe(t){let[e,n]=u.useState(t),r=u.useRef(null),i=Nh(e),s=u.useRef(null),o=qi.get(s);if(fn&&o!==i&&(o!=null&&fn.unregister(s),fn.register(s,i,s),qi.set(s,i)),Kh){const a=gn.get(i);a&&!a.includes(r)?a.push(r):gn.set(i,[r])}return te(()=>{let a=i;return()=>{fn&&(fn.unregister(s),qi.delete(s)),gn.delete(a)}},[i]),u.useEffect(()=>{let a=r.current;return a&&n(a),()=>{a&&(r.current=null)}}),i}function _h(t,e){if(t===e)return t;let n=gn.get(t);if(n)return n.forEach(i=>i.current=e),e;let r=gn.get(e);return r?(r.forEach(i=>i.current=t),t):e}function ot(t=[]){let e=fe(),[n,r]=Dh(e),i=u.useCallback(()=>{r(function*(){yield e,yield document.getElementById(e)?e:void 0})},[e,r]);return te(i,[e,i,...t]),n}function Ft(...t){return t.length===1&&t[0]?t[0]:e=>{let n=!1;const r=t.map(i=>{const s=Ha(i,e);return n||=typeof s=="function",s});if(n)return()=>{r.forEach((i,s)=>{typeof i=="function"?i():Ha(t[s],null)})}}}function Ha(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]=ct(s,o):(i==="className"||i==="UNSAFE_className")&&typeof s=="string"&&typeof o=="string"?e[i]=Eh(s,o):i==="id"&&s&&o?e.id=_h(s,o):i==="ref"&&s&&o?e.ref=Ft(s,o):e[i]=o!==void 0?o:s}}retuLine truncated
@layer {
[${nl}] {
touch-action: pan-x pan-y pinch-zoom;
}
}
`.trim(),T.head.prepend(j)},[h]),u.useEffect(()=>{let T=m.current;return()=>{p||Za(T.target??void 0);for(let j of T.disposables)j();T.disposables=[]}},[p]),{isPressed:l||g,pressProps:A(b,U,{[nl]:!0})}}function Eo(t){return t.tagName==="A"&&t.hasAttribute("href")}function zi(t,e){const{key:n,code:r}=t,i=e,s=i.getAttribute("role");return(n==="Enter"||n===" "||n==="Spacebar"||r==="Space")&&!(i instanceof we(i).HTMLInputElement&&!zu(i,n)||i instanceof we(i).HTMLTextAreaElement||i.isContentEditable)&&!((s==="link"||!s&&Eo(i))&&n!=="Enter")}function Ht(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 fb(t){return t instanceof HTMLInputElement?!1:t instanceof HTMLButtonElement?t.type!=="submit"&&t.type!=="reset":!Eo(t)}function rl(t,e){return He()&&e==="Enter"?!1:t instanceof HTMLInputElement?e==="Enter"&&(t.type==="checkbox"||t.type==="radio")?!1:!zu(t,e):fb(t)}const pb=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function zu(t,e){return t.type==="checkbox"||t.type==="radio"?e===" ":pb.has(t.type)}function hb(t,e){let{elementType:n="a",onPress:r,onPressStart:i,onPressEnd:s,onPressChange:o,onClick:a,isDisabled:l,...c}=t,d={};n!=="a"&&(d={role:"link",tabIndex:l?void 0:0});let{focusableProps:p}=At(t,e),{pressProps:h,isPressed:b}=Zt({onPress:r,onPressStart:i,onPressEnd:s,onPressChange:o,onClick:a,isDisabled:l,ref:e}),g=X(c,{labelable:!0}),v=A(p,h),m=Tn(),y=hi(t);return{isPressed:b,linkProps:A(g,y,{...v,...d,"aria-disabled":l||void 0,"aria-current":t["aria-current"],onClick:$=>{h.onClick?.($),bu($,m,t.href,t.routerOptions)}})}}function Mn(t){let{isDisabled:e,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=t,s=u.useRef({isFocusWithin:!1}),{addGlobalListener:o,removeAllGlobalListeners:a}=vi(),l=u.useCallback(p=>{Z(p.currentTarget,F(p))&&s.current.isFocusWithin&&!Z(p.currentTarget,p.relatedTarget)&&(s.current.isFocusWithin=!1,a(),n&&n(p),i&&i(!1))},[n,i,s,a]),c=cu(l),d=u.useCallback(p=>{if(!Z(p.currentTarget,F(p)))return;let h=F(p);const b=ne(h),g=se(b);if(!s.current.isFocusWithin&&g===h){r&&r(p),i&&i(!0),s.current.isFocusWithin=!0,c(p);let v=p.currentTarget;o(b,"focus",m=>{let y=F(m);if(s.current.isFocusWithin&&!Z(v,y)){let $=new b.defaultView.FocusEvent("blur",{relatedTarget:y});lu($,v);let x=ho($);l(x)}},{capture:!0})}},[r,i,c,o,l]);return e?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:l}}}function Ke(t={}){let{autoFocus:e=!1,isTextInput:n,within:r}=t,i=u.useRef({isFocused:!1,isFocusVisible:e||Kt()}),[s,o]=u.useState(!1),[a,l]=u.useState(()=>i.current.isFocused&&i.current.isFocusVisible),c=u.useCallback(()=>l(i.current.isFocused&&i.current.isFocusVisible),[]),d=u.useCallback(b=>{i.current.isFocused=b,i.current.isFocusVisible=Kt(),o(b),c()},[c]);dm(b=>{i.current.isFocusVisible=b,c()},[n,s],{enabled:s,isTextInput:n});let{focusProps:p}=yo({isDisabled:r,onFocusChange:d}),{focusWithinProps:h}=Mn({isDisabled:!r,onFocusWithinChange:d});return{isFocused:s,isFocusVisible:a,focusProps:r?h:p}}let Ss=!1,Pr=0;function mb(){Ss=!0,setTimeout(()=>{Ss=!1},500)}function il(t){t.pointerType==="touch"&&mb()}function bb(){let t=ne(null);if(!(typeof t>"u"))return Pr===0&&typeof PointerEvent<"u"&&t.addEventListener("pointerup",il),Pr++,()=>{Pr--,!(Pr>0)&&typeof PointerEvent<"u"&&t.removeEventListener("pointerup",il)}}function Ne(t){let{onHoverStart:e,onHoverChange:n,onHoverEnd:r,isDisabled:i}=t,[s,o]=u.useState(!1),a=u.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;u.useEffect(bb,[]);let{addGlobalListener:l,removeAllGlobalListeners:c}=vi(),{hoverProps:d,triggerHoverEnd:p}=u.useMemo(()=>{let h=(v,m)=>{if(a.pointerType=m,i||m==="touch"||a.isHovered||!Z(v.currentTarget,F(v)))return;a.isHovered=!0;let y=v.currentTarget;a.target=y,l(ne(F(v)),"pointerover",$=>{a.isHovered&&a.target&&!Z(a.target,F($))&&b($,$.pointerType)},{capture:!0}),e&&e({type:"hoverstart",target:y,pointerType:m}),n&&n(!0),o(!0)},b=(v,m)=>{let y=a.target;a.pointerType="",a.target=null,!(m==="touch"||!a.isHovered||!y)&&(a.isHovered=!1,c(),r&&r({type:"hoverend",target:y,pointerType:m}),n&&n(!1),o(!1))},g={};return typeof PointerEvent<"u"&&(g.onPointerEnter=v=>{Ss&&v.pointerType==="mouse"||h(v,v.pointerType)},g.onPointerLeave=v=>{!i&&Z(v.currentTarget,F(v))&&b(v,v.pointerType)}),{hoverProps:g,triggerHoverEnd:b}},[e,n,r,i,a,l,c]);return u.useEffect(()=>{i&&p({currentTarget:a.target},a.pointerType)},[i]),{hoverProps:d,isHovered:s}}const gb=u.createContext(null),So=u.forwardRef(function(e,n){[e,n]=ae(e,n,gb);let r=e.href&&!e.isDisabled?"a":"span",{linkProps:i,isPressed:s}=hb({...e,elementType:r},n),o=ee[r],{hoverProps:a,isHovered:l}=Ne(e),{focusProps:c,isFocused:d,isFocusVisible:p}=Ke(),h=ie({...e,defaultClassName:"react-aria-Link",values:{isCurrent:!!e["aria-current"],isDisabled:e.isDisabled||!1,isPressed:s,isHovered:l,isFocused:d,isF 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()}},a=d=>{let p=F(d),h=d.relatedTarget;h&&Hn(h)?(h.focus({preventScroll:!0}),Il(h,Hn(p))):h||p.parentElement?.closest("[tabindex]")?.focus({preventScroll:!0})},l=HTMLElement.prototype.focus;Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(d){let p=se(),h=p!=null&&Hn(p);l.call(this,{...d,preventScroll:!0}),(!d||!d.preventScroll)&&Il(this,h)}});let c=ct(yn(document,"touchstart",r,{passive:!1,capture:!0}),yn(document,"touchmove",o,{passive:!1,capture:!0}),yn(document,"blur",a,!0));return()=>{t(),c(),i.remove(),Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:l})}}function Il(t,e){e||!Vn?jl(t):Vn.addEventListener("resize",()=>jl(t),{once:!0})}function jl(t){let e=document.scrollingElement||document.documentElement,n=t;for(;n&&n!==e;){let r=ko(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;Vn&&(o=Math.min(o,Vn.offsetTop+Vn.height));let a=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+a)),behavior:"smooth"})}}n=r.parentElement}}function Kg(t,e){let{triggerRef:n,popoverRef:r,groupRef:i,isNonModal:s,isKeyboardDismissDisabled:o,shouldCloseOnInteractOutside:a,...l}=t,c=l.trigger==="SubmenuTrigger",{overlayProps:d,underlayProps:p}=Md({isOpen:e.isOpen,onClose:e.close,shouldCloseOnBlur:!0,isDismissable:!s||c,isKeyboardDismissDisabled:o,shouldCloseOnInteractOutside:a},i??r),{overlayProps:h,arrowProps:b,placement:g,triggerAnchorPoint:v}=Rd({...l,targetRef:n,overlayRef:r,isOpen:e.isOpen,onClose:s&&!c?e.close:null,getTargetRect:l.getTargetRect??(e.point?()=>new DOMRect(e.point.x,e.point.y,0,0):void 0)});Nd({isDisabled:s||!e.isOpen}),u.useEffect(()=>{if(e.isOpen&&r.current)return s?$g(i?.current??r.current):kd([i?.current??r.current],{shouldUseInert:!0})},[s,e.isOpen,r,i]);let{focusWithinProps:m}=Mn(t);return{popoverProps:A(d,h,m),arrowProps:b,underlayProps:p,placement:g,triggerAnchorPoint:v}}var Ld={};Ld={dismiss:"Dismiss"};var Id={};Id={dismiss:"取消"};var jd={};jd={dismiss:"關閉"};var Dd={};Dd={"ar-AE":P,"bg-BG":P,"cs-CZ":P,"da-DK":P,"de-DE":P,"el-GR":P,"en-US":Ld,"es-ES":P,"et-EE":P,"fi-FI":P,"fr-FR":P,"he-IL":P,"hr-HR":P,"hu-HU":P,"it-IT":P,"ja-JP":P,"ko-KR":P,"lt-LT":P,"lv-LV":P,"nb-NO":P,"nl-NL":P,"pl-PL":P,"pt-BR":P,"pt-PT":P,"ro-RO":P,"ru-RU":P,"sk-SK":P,"sl-SI":P,"sr-SP":P,"sv-SE":P,"tr-TR":P,"uk-UA":P,"zh-CN":Id,"zh-TW":jd};function _g(t){return t&&t.__esModule?t.default:t}function Is(t){let{onDismiss:e,...n}=t,r=sn(_g(Dd),"@react-aria/overlays"),i=ur(n,r.format("dismiss")),s=()=>{e&&e()};return w.createElement($i,null,w.createElement("button",{...i,tabIndex:-1,onClick:s,style:{width:1,height:1}}))}const Kd=w.forwardRef(({children:t,...e},n)=>{let r=u.useRef(!1),i=u.useContext(Zn),s=A(i||{},{...e,register(){r.current=!0,i&&i.register()}});return s.ref=Ee(n||i?.ref),vo(i,s.ref),u.useEffect(()=>{r.current||(r.current=!0)},[]),w.createElement(Zn.Provider,{value:s},t)});function Fg({children:t}){let e=u.useMemo(()=>({register:()=>{}}),[]);return w.createElement(Zn.Provider,{value:e},t)}const Ag=u.createContext({});function qo(){return u.useContext(Ag)??{}}const _d=w.createContext(null);function js(t){let e=et(),{portalContainer:n=e?null:document.body,isExiting:r}=t,[i,s]=u.useState(!1),o=u.useMemo(()=>({contain:i,setContain:s}),[i,s]),{getContainer:a}=qo();if(!t.portalContainer&&a&&(n=a()),!n)return null;let l=t.children;return t.disableFocusManagement||(l=w.createElement(Do,{restoreFocus:!0,contain:(t.shouldContainFocus||i)&&!r},l)),l=w.createElement(_d.Provider,{value:o},w.createElement(Fg,null,w.createElement(Jn.Provider,{value:null},l))),Qc.createPortal(l,n)}function Fd(){let e=u.useContext(_d)?.setContain;te(()=>{e?.(!0)},[e])}function hr(t){let[e,n]=qe(t.isOpen,t.defaultOpen||!1,t.onOpenChange),[r,i]=u.useState(null);const s=u.useCallback(()=>{n(!0)},[n]),o=u.useCallback(()=>{n(!1)},[n]),a=u.useCallback(()=>{n(!e)},[n,e]);return{isOpen:e,setOpen:n,open:s,close:o,toggle:a,point:r,setPoint:i}}function mr(t,e=!0){let[n,r]=u.useState(!0),i=n&&e;return te(()=>{if(i&&t.current&&"getAnimations"in t.current)for(let s of t.current.getAnimations())s instanceof CSSTransition&&s.cancel()},[t,i]),Ad(t,i,u.useCallback(()=>r(!1),[])),i}function er(t,e){let[n,r]=u.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 Ad(t,i,u.useCallback(()=>{r(s=>s==="exiting"?"closed":s)},[])),i}function Ad(t,e,n){te(()=>{if(e&&t.current){if(!("getAnimations"in t.current)){n();return}let r=t.current.getAnimations();if(r.length== Line truncated
${n}`:""} (request_id: ${i})`);const s=[t,e,n??""].join(`
`),o=Mr.get(s);o&&Mt.close(o);const a=Mt.add({kind:t,text:e,detail:n,action:r},{timeout:r?void 0:5e3,onClose:()=>{Mr.get(s)===a&&Mr.delete(s)}});Mr.set(s,a)},h1=(t,e,n,r)=>{const i=aa(t,e,n);Me(i.kind,i.text,{detail:i.detail,requestId:i.requestId,action:r})},Ff=(t,e)=>({detail:sa(t,e,!1),requestId:oa(t)}),m1={positive:_y,negative:Ks,info:wf,neutral:null};function b1({placement:t="bottom"}){const[e,n="center"]=t.split(" "),r=Q(),[i,s]=u.useState(!1);return u.useEffect(()=>{i?Mt.pauseAll():Mt.resumeAll()},[i]),u.useEffect(()=>Mt.subscribe(()=>{Mt.visibleToasts.length===0&&s(!1)}),[]),u.useEffect(()=>{if(!i)return;const o=a=>{if(a.key!=="Escape")return;(a.target?.closest?.(".rp-toasts")||!document.querySelector(Kf))&&s(!1)};return addEventListener("keydown",o),()=>removeEventListener("keydown",o)},[i]),f.jsxs(gy,{queue:Mt,className:G("rp-toasts",i&&"expanded"),"data-placement":e,"data-align":n,children:[i&&f.jsx(De,{className:"rp-toast-underlay","aria-label":r("toast.collapse"),onPress:()=>s(!1)}),i&&f.jsxs("div",{className:"rp-toast-controls",children:[f.jsx(De,{className:"rp-btn sm",onPress:()=>Mt.clear(),children:r("toast.clearAll")}),f.jsx(De,{className:"rp-btn sm",onPress:()=>s(!1),children:r("toast.collapse")})]}),f.jsx(g1,{expanded:i,edge:e,onExpand:()=>s(!0)})]})}function g1({expanded:t,edge:e,onExpand:n}){const r=u.useContext(Ci),i=r.visibleToasts;return f.jsx(bf,{className:"rp-toast-list",children:({toast:s})=>{const o=i.indexOf(s);return f.jsx(y1,{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 y1({item:t,state:e,depth:n,count:r,background:i,more:s}){const o=Q(),a=m1[t.content.kind],{text:l,detail:c,action:d}=t.content;return f.jsxs(yy,{toast:t,className:G("rp-toast",t.content.kind,i&&"background"),style:{zIndex:r-n,"--i":Math.min(n,3)},inert:i||void 0,children:[f.jsxs(vy,{className:"body",children:[a&&f.jsx("span",{className:"icon",children:f.jsx(a,{})}),f.jsxs("div",{className:"msg",children:[f.jsx(zr,{slot:"title",elementType:"div",className:"summary",children:l}),c&&f.jsx(zr,{slot:"description",elementType:"div",className:"detail",children:c})]})]}),f.jsx(De,{slot:"close",className:"rp-btn quiet icon close","aria-label":o("ui.close"),children:f.jsx(ta,{})}),(s||d)&&f.jsxs("div",{className:"foot",children:[s&&f.jsxs(De,{className:"rp-btn sm quiet more",onPress:s.onExpand,children:[f.jsx(tn,{className:G(s.edge==="bottom"&&"up")}),o("toast.showAllCount",{n:r})]}),d&&f.jsx(De,{className:"rp-btn action",onPress:()=>{d.onAction(),d.closeOnAction&&e.close(t.key)},children:d.label})]})]})}let Un=null;const Fs=new Set,As=()=>Fs.forEach(t=>t());typeof window<"u"&&(addEventListener("beforeinstallprompt",t=>{t.preventDefault(),Un=t,As()}),addEventListener("appinstalled",()=>{Un=null,As()}));function x$(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 w$(){const t=Q(),e=u.useSyncExternalStore(n=>(Fs.add(n),()=>Fs.delete(n)),()=>Un,()=>null);return e?async()=>{if(Un!==e)return!1;Un=null,As();try{return await e.prompt(),(await e.userChoice).outcome==="accepted"}catch(n){return Me("negative",t("settings.installFailed"),Ff(n,t)),!1}}:null}function Os({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:G("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 v1({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:G("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 Line truncated
`)),l=u.useRef(null),c=u.useRef(!1),d=u.useCallback(p=>(l.current=p,()=>{c.current=p.contains(document.activeElement),l.current=null}),[]);return u.useLayoutEffect(()=>{a&&s.current?.contains(document.activeElement)&&l.current?.querySelector("button")?.focus(),!a&&c.current&&s.current?.querySelector("[data-selected]")?.focus(),c.current=!1},[s,a]),f.jsxs("div",{className:"rp-segfit","data-collapsed":a||void 0,children:[f.jsxs(Py,{ref:s,className:"rp-seg","aria-label":r,isDisabled:i,selectionMode:"single",disallowEmptySelection:!0,selectedKeys:[e],onSelectionChange:p=>{const h=[...p][0];h!=null&&n(String(h))},children:[o&&f.jsx("span",{className:"rp-slider","data-still":o.still||void 0,style:{left:o.x,width:o.w}}),t.map(([p,h])=>f.jsx(Cy,{id:p,className:"rp-btn",children:h},p))]}),a&&f.jsx("div",{ref:d,className:"rp-segpick",children:f.jsx(k1,{bare:!0,label:r,value:e,onChange:n,isDisabled:i,items:t.map(([p,h])=>({id:p,label:h}))})})]})}function S$({children:t,isSelected:e,onChange:n,isDisabled:r,"aria-label":i,"aria-describedby":s}){return f.jsxs(B0,{className:"rp-switch",isSelected:e,onChange:n,isDisabled:r,"aria-label":i,"aria-describedby":s,children:[f.jsx("span",{className:"track"}),t]})}function C1({label:t,width:e,search:n,large:r,side:i,className:s,placeholder:o,description:a,error:l,action:c,reveal:d,prefix:p,suffix:h,autoComplete:b,spellCheck:g,...v}){const m=Q(),y=u.useId(),$=l?{isInvalid:!0,validationBehavior:"aria"}:{};if(n)return f.jsxs(T0,{...$,...v,"aria-label":t,className:G("rp-search-field",s),style:e?{width:e}:void 0,children:[f.jsxs("span",{className:G("rp-input",r&&"lg"),children:[f.jsx(Os,{}),f.jsx(dl,{placeholder:o??t,autoComplete:b,spellCheck:g}),f.jsx(De,{className:"clear","aria-label":m("ui.clear"),children:f.jsx(ta,{})})]}),l&&f.jsxs(ll,{className:"rp-field-error",children:[f.jsx(Ks,{}),l]})]});const x=f.jsxs("span",{className:G("rp-input",(i||!!c)&&"rp-grow",(p||h)&&"affixed"),children:[p&&f.jsx("span",{className:"affix",id:`${y}-prefix`,children:p}),f.jsx(dl,{placeholder:o,autoComplete:b,spellCheck:g}),h&&f.jsx("span",{className:"affix",id:`${y}-suffix`,children:h}),d&&f.jsx(De,{className:"reveal","aria-label":d.label,onPress:d.onToggle,children:d.shown?f.jsx($1,{}):f.jsx(v1,{})})]});return f.jsxs(sy,{...$,...v,"aria-describedby":[p&&`${y}-prefix`,h&&`${y}-suffix`].filter(Boolean).join(" ")||void 0,className:G(i?"rp-cluster":"rp-field",s),style:e?{width:e}:void 0,children:[f.jsx(Wu,{className:"rp-label",children:t}),c?f.jsxs("div",{className:"rp-toolbar",children:[x,c]}):x,a&&f.jsx(zr,{slot:"description",className:"rp-label",children:a}),l&&f.jsxs(ll,{className:"rp-field-error",children:[f.jsx(Ks,{}),l]})]})}function P$({label:t,value:e,description:n}){const r=u.useId();return f.jsxs("div",{className:"rp-field",role:"group","aria-labelledby":`${r}-label`,"aria-describedby":n&&`${r}-help`,children:[f.jsx("span",{className:"lbl",id:`${r}-label`,children:t}),f.jsx("span",{children:e}),n&&f.jsx("span",{className:"rp-label",id:`${r}-help`,children:n})]})}function k$({title:t,children:e,...n}){return f.jsxs(h0,{...n,className:"rp-disclosure",children:[f.jsx(Po,{level:3,children:f.jsxs(De,{slot:"trigger",className:"rp-btn quiet rp-disclosure-trigger",children:[f.jsx(tn,{}),t]})}),f.jsx(m0,{className:"rp-disclosure-panel",children:f.jsx("div",{className:"rp-disclosure-content",children:e})})]})}function C$({children:t}){return f.jsx(d0,{className:"rp-col",allowsMultipleExpanded:!0,children:t})}function da({trigger:t,title:e,children:n,footer:r,narrow:i,alert:s,isOpen:o,onOpenChange:a,hideTitle:l,locked:c,reason:d}){const p=f.jsx(Jo,{className:"rp-underlay",isDismissable:!s&&!c,isKeyboardDismissDisabled:c,isOpen:o,onOpenChange:a,children:f.jsx(tf,{className:G("rp-modal",i&&"narrow"),children:f.jsx(Zr,{className:"rp-dialog",role:s?"alertdialog":"dialog","aria-label":l?e:void 0,children:({close:h})=>f.jsxs(If,{reason:r?d:null,children:[!l&&f.jsx(Po,{slot:"title",children:e}),typeof n=="function"?n(h):n,r&&f.jsx("div",{className:"foot",children:r(h)})]})})})});return t?f.jsxs(Xd,{children:[t,p]}):p}function fa({trigger:t,triggerRef:e,isOpen:n,onOpenChange:r,title:i,label:s,subtitle:o,placement:a="top start",children:l}){const c=f.jsx(Pi,{className:i?"rp-popover rp-popover-dialog":"rp-popover",placement:a,...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(Po,{slot:"title",children:i}),o]}),l(d)]})}):f.jsx(Zr,{className:"rp-popover-note","aria-label":s,children:({close:d})=>l(d)})});return t?f.jsxs(Xd,{children:[t,c]}):c}function pa({title:t,isOpen:e,onCancel:n,confirmLabel:r,onConfirm:i,tone:s="negative",isPending:o,isDisabled:a,reason:l,error:c,children:d}){const p=Q();return f.jsxs(da,{title:t,narrow:!0,alert:s==="negative",isOpen:e,reason:l,onOpenChange:h=>{h||n()},footer:()=>f.jsxs(f.Fragment,{children:[f.jsx(be,{onPress:n,children:p("ui Line truncated
`)}),a="",l=void 0,c=[];return}if(h.startsWith(":"))return;const b=h.indexOf(":"),g=b<0?h:h.slice(0,b);let v=b<0?"":h.slice(b+1);v.startsWith(" ")&&(v=v.slice(1)),g==="event"&&(a=v),g==="data"&&c.push(v),g==="id"&&!v.includes("\0")&&(l=v)},p=()=>{i.cancel(n?.reason).catch(()=>{})};n?.addEventListener("abort",p,{once:!0});try{for(;;){const{value:h,done:b}=await i.read();n?.throwIfAborted(),r?.(),o+=s.decode(h,{stream:!b});let g=0;for(let v=0;v<o.length;v++){const m=o[v];if(!(m!=="\r"&&m!==`
`)){if(m==="\r"&&v===o.length-1&&!b)break;d(o.slice(g,v)),m==="\r"&&o[v+1]===`
`&&v++,g=v+1}}if(o=o.slice(g),b)break}}finally{n?.removeEventListener("abort",p),await i.cancel().catch(()=>{}),i.releaseLock()}}function qn(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 gv=3,Ys=new Set,Js=new Set;let fp=null;function bc(){fp=[...Ys].reduce((t,e)=>t&&t.until>=e.until?t:e,null),Js.forEach(t=>t())}const yv=()=>fp;function vv(t){return Js.add(t),()=>void Js.delete(t)}async function $v(t,e,n){if(e<=gv)return qn(e,n);const r={status:t,until:Date.now()+e*1e3};Ys.add(r),bc();try{await qn(e,n)}finally{Ys.delete(r),bc()}}const H$=["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"],xv={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 V$(t){return xv[t.toLowerCase().replace(/\(.*$/,"")]}const U$=["select","urltest","roundrobin","fallback","score","fixed","min_moving_avg","min_avg10","min_last_delay","loadbalance"],q$=[{id:"min_moving_avg",label:"policy.kind.urltest",description:"arrange.policy.fastestHint"},{id:"score",label:"policy.kind.score",description:"arrange.policy.scoreHint"},{id:"fallback",label:"policy.kind.fallback",description:"arrange.policy.fallbackHint"},{id:"roundrobin",label:"arrange.policy.spread",description:"arrange.policy.spreadHint"},{id:"select",label:"policy.kind.selector",description:"arrange.policy.manualHint"}],si=["direct","block"],z$=[...si,...si.map(t=>`${t}(must)`)],Cn=t=>t!=null&&si.includes(t);function W$(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 wv={warm:0,unknown:1,mixed:2,cold:3},Ev={http_headers:0,http_round_trip:1,quic_handshake:2,tcp_connect:3,mixed:4,unknown:5,dns_round_trip:6};function Sv(t){const e=i=>(wv[i.warmth]??1)*10+(Ev[i.measurement]??5),n=t.filter(i=>i.transport==="tcp"&&i.purpose==="data"),r=Math.min(...n.map(e));return Pv(n.filter(i=>e(i)===r))}function Pv(t){const e=[...t].sort((n,r)=>(n.ip_version==="ipv4"?0:1)-(r.ip_version==="ipv4"?0:1));return e.find(n=>n.state==="healthy"&&n.latency_ms!=null)??e.find(n=>n.state==="healthy")??e.find(n=>n.state==="unavailable")??e[0]}const kv=t=>Sv(t.health),Cv=t=>t?.state==="healthy"&&t.latency_ms!=null?t.latency_ms:void 0,Tv=(t,e)=>(t??1/0)-(e??1/0)||0;function Rv(t){const e=t?Vs(...t.outbounds.map(r=>r.download_bytes)):null,n=(t?.outbounds??[]).map(r=>({name:r.name,kind:r.kind,bytes:Ae(r.download_bytes),percent:qf(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 G$(t){return t.type!=="A"&&t.type!=="AAAA"?null:(t.answers??[]).find(e=>e.type===t.type)?.data??null}function Mv(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 Nv=t=>Cn(t.protocol)?"builtin":"unattributed";function Lv(t,e){let n=t;for(;e.some(r=>r.id===n);)n+="-";return n}const Iv=(t,e)=>t.provider_id??Lv(Nv(t),e);function pp(t){if(t)return Mv(t.startsWith("[")?t.slice(1,t.indexOf("]")):t.split(":").length===2?t.split(":")[0]:t)}const Y$=t=>t?.match(/^(?:\[[^\]]+\]|[^:]+):(\d+)$/)?.[1];function xa(t,e){return t==="direct"?e("ui.direct"):t==="block"?e("ui.block"):t===null||t==="unknown"?e("ui.unknown"):t}const jv=(t,e)=>t.map(n=>e?.get(n)??n);function Dv(t,e,n){return Cn(t.outbound)?e?xa(t.outbound,e):t.outbound:jv(t.chain,n).join(" → ")||"—"}function J$(t,e,n){if(Cn(t.outbound))return xa(t.outbound,e);const r=t.chain.at(-1);return r?n?.get(r)??r:t.outbound&&t.outbound!=="unknown"?t.outbound:"—"}const X$=(t,e,n)=>t.chain.length>1?Dv(t,e,n):null,Kv={starting:"lifecycle.starting",running:"lifecycle.running",reloading:"lifecycle.reloading",suspended:"lifecycle.suspended",draining:"lifecycle.draining",degraded:"lifecycle.degraded",failed:"lifecycle.failed"},_v=t=>t==="running"?"ok":t==="failed"?"err":"warn",Z$=t=>t>90?"err":t>75?"warn":"ok",Q$=t=>t.closed?t.skipped?"info":"positive":" Line truncated
`&&i++,o++;continue}const l=o,c=i;let d="text";if(a==="#")for(d="comment";o<t.length&&t[o]!==`
`;)o++;else if(a==="'"||a==='"')for(d="quoted",o++;o<t.length;){const h=t[o++];if(h===`
`&&i++,h==="\\"&&o<t.length)t[o]===`
`&&i++,o++;else if(h===a)break}else if("{}:(),".includes(a))d="symbol",o++;else if(a==="-"&&t[o+1]===">")o+=2;else for(;o<t.length&&!/[\s{}:(),'"]/.test(t[o])&&!(t[o]==="-"&&t[o+1]===">");)o++;const p={from:l,to:o,line:c,kind:d,depth:r.length,parens:s};if(d==="symbol"&&a==="{"){let h=e.length-1;for(;h>=0&&(e[h].kind==="comment"||t.slice(e[h].from,e[h].to)===":");)h--;const b=e[h],g={name:b?ht(t.slice(b.from,b.to)):"",from:b?.from??l,open:l,close:t.length,to:t.length,line:b?.line??i,endLine:i,depth:r.length,children:[]};(r.at(-1)?.children??n).push(g),r.push(g)}else if(d==="symbol"&&a==="}"){const h=r.pop();h&&(h.close=l,h.to=o,h.endLine=i)}else d==="symbol"&&a==="("?s++:d==="symbol"&&a===")"&&(s=Math.max(0,s-1));e.push(p)}return{blocks:n,tokens:e}}function H2(t){if(/[\r\n]/.test(t))return!1;let e=0;for(const n of Ce(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 ht=t=>/^['"]/.test(t)?t.slice(1,-1):t;function Np(t){const e=Ce(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 Na(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 a=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 l=n[s+1];o.parens===0&&(o.kind==="text"||o.kind==="quoted")&&l&&t.slice(l.from,l.to)===":"?(i={name:ht(a),from:o.from,to:l.to,valueFrom:l.to,valueTo:l.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 V2(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 mx(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 a=o===-1?s:Math.min(o,s);const l=e.children.find(c=>c.from>=r&&c.from<=a);if(l){const c=t.indexOf(`
`,l.to);a=c===-1?s:Math.min(c,s)}n.push({from:r,to:a,block:l}),r=a+1}return n}function U2(t){const{blocks:e}=Ce(t);return e.filter(n=>n.name==="include").flatMap(n=>V2(t,n).map(r=>ht(Np(r).trim()))).filter(Boolean)}const Ec=t=>/[*?]/.test(t);function q2(t,e){const n=t.replace(/^\.\//,"").split(/([*?])/).map(r=>r==="*"?"[^/]*":r==="?"?"[^/]":r.replace(/[.+^${}()|[\]\\]/g,"\\$&")).join("");return new RegExp("^"+n+"$").test(e)}const z2=(t,e)=>t.some(n=>q2(n,e));function Sc(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 bx(t){const e=t.find(r=>r.kind==="main");if(!e)return null;const n=t.flatMap(r=>U2(r.content).map(i=>Sc(e.path,i)));return r=>z2(n,Sc(e.path,r))}function gx(t){for(const e of t.map(n=>n.replace(/^\.\//,""))){const n=e.lastIndexOf("/");if(n>0&&Ec(e.slice(n))&&!Ec(e.slice(0,n)))return e.slice(0,n+1)}return""}function Lp(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 yx(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")||Lp(i+"name"+s)||e.some(o=>o.pattern===n)||e.push({pattern:n,prefix:i,suffix:s})}return e}function vx(t,e){if(t.includes("/"))return"config.newSourceNameSlash";const n=Lp(e.prefix+t+e.suffix);return n==="config.newSourceControl"?"config.newSourceNameControl":n}function W2(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 Ip(t=!0){const e=oe();return Se({key:["config"],every:0,fetch:n=>e.config(n)},{enabled:t})}function La(t,e){return t.config(e)}async function jp(t){return t.content!==void 0&&await fv(t.content)===t.content_sha256}function G2(t){const[e,n]=u.useState(new Map);return u.useEffect(()=>{let r=!0;return Promise.all(t.map(async i=>[i.id,{digest:i.content_sha256,content:i.content,complete:await jp(i)}])).then(i=>{r&&n(new Map(i))}),()=>{r=!1}},[t]),u.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 Y2(t){const e=u.useMemo(()=>t?[t]:[],[t]),n=G2(e);return t?n(t)??null:null}function J2(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 de("config.diskAhead"),lastRefused:r}:{error:t,lastRefused:i}}const Pc=t=>new TextEncoder().encode(t).length,kc=t=>kn(413,"request_too_large",`Configuration exceeds the ${t}-byte limit`,"config.tooLarge",{limit:t});function X2(t,e,n){const[r]=[{limit:t.content,size:Pc(e)},{limit:t.body,size:Pc(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 Cc(t,e,n,r){const i=X2(t,e,n);if(i?.exceeded)throw kc(i.limit);return r().catch(s=>{throw s instanceof me&&s.status===413&&i?kc(i.limit):s})}function Dp(t,e,n){return Bt(t,e,n).catch(r=>{throw n.aborted||r instanceof de?r:(ln(),new de("ui.operationUnknown"))})}async function Z2(t,e,n){const r=await t.createConfigSource(e,"",n).catch(o=>{throw jn(o)??o}),i=await Dp(t,r,n);Tt(i,"reload"),n.throwIfAborted();const s=await La(t,n).catch(()=>(n.throwIfAborted(),null));return s&&(W2(s.sources,e)?.id??null)}function $x(t){const e=oe(),{busy:n,run:r}=pt({rethrow:!0});return{busy:n!==null,create:u.useCallback(i=>r("create",async s=>({id:await Z2(e,i,s).finally(t)})),[e,r,t])}}function Kp(t,{rethrow:e=!1}={}){const n=oe(),r=ze().data,i=r?.resources.config_validate,s=i?.available===!0&&i.modes?.includes("full")===!0,o=r?.limits.max_json_body_bytes,a=r?.resources.config.max_bytes,l=i?.max_bytes,c=u.useCallback((y,$)=>Cc({content:l,body:o},y.sources.map(x=>x.content??"").join(""),y,()=>n.validateConfig(y,$)),[n,l,o]),{busy:d,error:p,run:h,cancel:b}=pt({rethrow:e}),[g,v]=u.useState(null),m=u.useRef(null);return{busy:d,cancel:b,error:p,errorSource:p?g:null,validate:u.useCallback(y=>h("validate",$=>(v(y.sources.length===1?y.sources[0].id??null:null),c(y,$))),[c,h]),apply:u.useCallback((y,$)=>h("save",async x=>{if(v(y.id),!y.writable)throw new de("config.readOnly");if(!await jp(y))throw new de("config.incomplete");x.throwIfAborted();const E=typeof $=="string"?$:$(y.content);if(E===null)return;if(s&&y.kind==="main"&&y.path!=="<redacted>"){const S=await c({sources:[{id:y.id,path:y.path,content:E}],mode:"full"},x);if(x.throwIfAborted(),!S.valid)return{diagnostics:S.diagnostics}}const R=await Cc({content:a,body:o},E,{content:E},()=>n.replaceConfigSource(y.id,E,Ep(y.content_sha256),x)).catch(async S=>{if(S instanceof me&&S Line truncated
`,o.from-1)+1,p=t.slice(d,o.from),h=/^\s*$/.test(p)?p:" ",b=Na(t,o,i),g=o.open+1,m=t.slice(g,o.close).match(/\n([ \t]+)\S/)?.[1]??h+(h||" ");if(o.line!==o.endLine)return s5(t,o,b,m,n);const y=[g,...b.map(x=>x.from),o.close],$=y.slice(0,-1).flatMap((x,E)=>{const R=t.slice(x,y[E+1]).trim();return R?[m+R]:[]});return Da(t.slice(0,g)+`
`+$.map(x=>x+`
`).join("")+h+t.slice(o.close),e,n)}const a=s.at(-1),l=a?t.slice(a.open+1,a.close).match(/\n([ \t]+)\S/)?.[1]??" ":" ",c=[`${l}${Fp(e)} {`,...n.filters.map(d=>`${l}${l}filter: ${d}`),...n.policy?[`${l}${l}policy: ${n.policy}`]:[],`${l}}`].join(`
`);if(a){const d=t.lastIndexOf(`
`,a.close-1)+1,p=/^[ \t]*$/.test(t.slice(d,a.close))?d:a.close;return t.slice(0,p)+(t[p-1]===`
`?"":`
`)+c+`
`+t.slice(p)}return`${t.replace(/\n+$/,"")}
group {
${c}
}
`}function s5(t,e,n,r,i){const s=n.filter(h=>h.name==="filter"),o=n.filter(h=>h.name==="policy"),a=[],l=h=>t.indexOf(`
`,h)+1,c=h=>{const b=t.lastIndexOf(`
`,h.from-1)+1,g=l(h.to),v=/^[ \t\r]*$/.test(t.slice(b,h.from))&&g>0&&/^[ \t\r]*$/.test(t.slice(h.to,g-1));a.push(v?{from:b,to:g,text:""}:{from:h.from,to:h.to,text:""})},d=(h,b)=>{if(h.value===b)return;const g=/^\s*/.exec(t.slice(h.valueFrom,h.valueTo))[0];a.push({from:h.valueFrom+g.length,to:h.valueTo,text:(g?"":" ")+b})};s.forEach((h,b)=>b<i.filters.length?d(h,i.filters[b]):c(h)),o.slice(0,-1).forEach(c),o.length&&(i.policy?d(o.at(-1),i.policy):c(o.at(-1)));const p=[...i.filters.slice(s.length).map(h=>`${r}filter: ${h}
`),...i.policy&&!o.length?[`${r}policy: ${i.policy}
`]:[]].join("");if(p){const h=s.length?l(s.at(-1).to):o.length?t.lastIndexOf(`
`,o[0].from-1)+1:l(e.open);a.push({from:h,to:h,text:p})}return a.sort((h,b)=>b.from-h.from||b.to-h.to).reduce((h,b)=>h.slice(0,b.from)+b.text+h.slice(b.to),t)}function or(t,e){const n=Ce(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 a=n[o];if(a.parens!==1)return null;if(s){if(a.kind!=="text"&&a.kind!=="quoted"||a.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 ai=(t,e)=>t.flatMap(n=>(or(n,e)??[]).map(ht));function Px(t){return ai(t.filters,"name")}function kx(t){return{names:ai(t.filters,"name"),subtags:ai(t.filters,"subtag"),rules:t.filters.filter(e=>or(e,"name")===null&&or(e,"subtag")===null)}}function Cx(t,e,n){return t.filters.every(r=>{const i=or(r,e);return i!==null&&i.every(s=>ht(s)===n)})}function Oi(t,e,n,r,i){const s=ja(t).find(h=>h.name===e);if(!s&&!r.length)return t;const o=new Set(i),a=new Set(ai(s?.filters??[],n).filter(h=>!o.has(h))),l=[...new Set(r)].filter(h=>!a.has(h)&&!o.has(h)),c=h=>l.map(h.length&&h.every(b=>b.startsWith("'"))?Ai:Fp);let d=!l.length;const p=[];for(const h of s?.filters??[]){const b=or(h,n);if(b===null){p.push(h);continue}const g=b.filter(m=>!o.has(ht(m))),v=d?g:[...g,...c(g)];d=!0,v.length&&p.push(`${n}(${v.join(", ")})`)}return d||p.push(`${n}(${c([]).join(", ")})`),s&&p.length===s.filters.length&&p.every((h,b)=>h===s.filters[b])||s?.filters.length&&!p.length?t:Da(t,e,{filters:p,policy:s?.policy??null})}const o5=(t,e,n)=>Oi(t,e,"name",n,[]),a5=(t,e,n)=>Oi(t,e,"name",[],n),l5=(t,e,n)=>Oi(t,e,"subtag",n,[]),c5=(t,e,n)=>Oi(t,e,"subtag",[],n);function Ap(t,e){const n=[];let r=0,i=null,s=0;for(let o=0;o<t.length;o++){const a=t[o];i?a==="\\"?o++:a===i&&(i=null):a==="'"||a==='"'?i=a:a==="("?r++:a===")"?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 u5(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 Ap(n.slice(r.length+1,-1),",")){const a=/^keyword:\s*/.exec(o),l=/^regex:\s*/.exec(o),c=ht((a??l?o.slice((a??l)[0].length):o).trim());if(c)if(a)s.push(d=>d.includes(c));else if(l){let d;try{d=new RegExp(c)}catch{return null}s.push(p=>d.test(p))}else i.push(c),s.push(d=>d===c)}return s.length?{call:r,negated:e,exact:i,tests:s}:null}function d5(t){const e=Ap(t,"&&").map(u5);return e.every(n=>n!==null)&&e.length?e:null}function f5(t){const e=t.map(d5).filter(n=>n!==null);if(!e.length){const n=t.some(r=>r.startsWith("group("));return r=>!n&&!Cn(r.name)}return n=>e.some(r=>(!Cn(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 Tx=(t,e)=>f5(t)(e);function p5(t,e){switch(e.kind){case"addNode":return o5(t,e.group,[e.value]);case"removeNode":return a5(t,e.group,[e.value]);case"addSubscription":return l5(t,e.group,[e.value]);case"removeSubscription":return c5(t,e.group,[e.value]);case"createGroup":return ja(t).some(n=>n.name===e.group)?t:Da(t,e.group,{filters:[],policy:e.policy})}}const Rx=(t,e)=>e.reduce(p5,t),h5=["domainSuffix","domain","geosite","dip","geoip","sip","dport","sport","pname","l4proto"],Mc=["qnameSuffix","qnameFull","qnameKeyword","qnameGeosite","qtype","sip"],Mx={request:Mc,response:[...Mc,"upstream","answerIp","answerGeoip"]};function Op(t,e){const n=e.split(/[,\s]+/).map(i=>i.trim()).filter(Boolean);if(n.some(i=>m5.test(i)||i.includes(":")&&!Mp(i)))return null;const r=b5(t,n);return H2(r)&&!r.includes("->")?r:null}const m5=/[()'"#{}]|&&|->/;function b5(t,e){const n=e.map(s=>s.includes(":")?Ai(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})`;case"qnameSuffix":return`qname(${i("suffix")})`;case"qnameFull":return`qname(${i("full")})`;case"qnameKeyword":return`qname(${i("keyword")})`;case"qnameGeosite":return`qname(${i("geosite")})`;case"qtype":return`qtype(${r})`;case"upstream":return`upstream(${r})`;case"answerIp":return`ip(${r})`;case"answerGeoip":return`ip(${i("geoip")})`}}function Nx(t,e){const r=t.map(i=>i.id===e?.id?e.content:i.content).flatMap(i=>i===void 0?[]:ja(i));return[...new Map(r.map(({name:i,written:s})=>[s,{name:i,written:s}])).values()]}const ro=t=>t.path==="<redacted>"||t.path==="",g5=t=>ro(t)?t.kind==="main"?"config.dae":`${t.kind}-${t.id.slice(0,8)}.dae`:t.path.split("/").pop()||"config.dae";function Lx(t,e){c Line truncated
`,d.from-1)+1,E=i.indexOf(`
`,p.to),R=E===-1?i.length:E+1;return{from:x,to:R,indent:i.slice(x,d.from),text:i.slice(x,R),target:{from:v.to,to:p.to}}}function Hp(t,e,n){return Bp(t,e,{within:r=>r.filter(i=>i.name==="routing"),fallbacks:["fallback"],target:(e.outbound??"")+(e.must?"(must)":"")},n)}const v5=t=>t.action==="upstream"||t.action==="requery"?t.upstream??"":t.action,Wn=(t,e)=>t.filter(n=>n.name===e),Vp=(t,e)=>Wn(t,"dns").flatMap(n=>Wn(n.children,"routing")).flatMap(n=>Wn(n.children,e));function Up(t,e,n,r){return Bp(t,e,{within:i=>Vp(i,n),fallbacks:["fallback","default"],target:v5(e),foldCase:!0},r)}function Ka(t,e){const n=d=>t.flatMap(p=>d(Ce(p.content).blocks).map(h=>({source:p,block:h}))),r=n(d=>Vp(d,e));if(r.length){const d=r.length===1?Nc(r[0].source,r[0].block):null;return d&&{source:d.source,anchor:d.anchor}}const i=n(d=>Wn(d,"dns").flatMap(p=>Wn(p.children,"routing"))),s=i.length===1?Nc(i[0].source,i[0].block):null;if(!s)return null;const{closing:o,anchor:a}=s,{indent:l}=a,c=l.startsWith(o)&&l.length>o.length?l.slice(o.length):" ";return{source:s.source,anchor:{...a,indent:l+c,open:`${l}${e} {
`,close:`${l}}
`}}}function Nc(t,e){const n=t.content;if(!t.writable)return null;const r=n.lastIndexOf(`
`,e.close-1)+1,i=n.slice(r,e.close);if(r<=e.open||!/^[ \t]*$/.test(i))return null;const s=n.indexOf(`
`,e.close),o=s===-1?n.length:s+1,a=n.slice(e.open+1,e.close).match(/\n([ \t]+)\S/)?.[1]??i+(i.slice(0,i.length/e.depth)||" ");return{source:t,anchor:{from:r,to:o,indent:a,text:n.slice(r,o)},closing:i}}function qp(t,e=Ce(t)){return e.blocks.filter(n=>n.name==="dns").flatMap(n=>n.children.filter(r=>r.name==="upstream")).flatMap(n=>Na(t,n,e.tokens).map(r=>({name:t.slice(r.from,e.tokens.find(i=>i.from===r.from).to),address:ht(r.value)})))}const jx=(t,e=Ce(t))=>qp(t,e).map(n=>n.name),_a=(t,e,n=!1)=>`${t} -> ${e}${n?"(must)":""}`,Dx=t=>[...t.map(e=>e.name),...si].map(e=>({id:e,label:e}));function Kx(t,e,n,r,i){return t.slice(e.from,e.to)===e.text?t.slice(0,e.from)+(e.open??"")+`${e.indent}${_a(n,r,i)}
`+(e.close??"")+t.slice(e.from):null}function _x(t,e,n,r){return e.target&&t.slice(e.from,e.to)===e.text?t.slice(0,e.target.from)+` ${n}${r?"(must)":""}`+t.slice(e.target.to):null}function Fx(t,e){return t.slice(e.from,e.to)===e.text?t.slice(0,e.from)+t.slice(e.to):null}const Ax={domainSuffix:"rule.kind.domainSuffix",domain:"rule.kind.domain",geosite:"rule.kind.geosite",dip:"rule.kind.dip",geoip:"rule.kind.geoip",sip:"rule.kind.sip",dport:"rule.kind.dport",sport:"rule.kind.sport",pname:"rule.kind.pname",l4proto:"rule.kind.l4proto",qnameSuffix:"rule.kind.domainSuffix",qnameFull:"rule.kind.domain",qnameKeyword:"rule.dns.kind.keyword",qnameGeosite:"rule.kind.geosite",qtype:"rule.dns.kind.qtype",upstream:"rule.dns.kind.upstream",answerIp:"rule.dns.kind.answerIp",answerGeoip:"rule.dns.kind.answerGeoip"},Ox={routing:"rule.list.routing",request:"rule.list.request",response:"rule.list.response"},Bx=t=>[...new Set(t.filter(e=>e.type==="A"||e.type==="AAAA").map(e=>e.data))];function hs(t,e="routing"){const n=t.domain?.replace(/\.$/,""),r=s=>s&&`${s}/${s.includes(":")?128:32}`;return(e==="routing"?[["domain",n],["domainSuffix",n],["dip",r(t.dip)],["sip",r(t.sip)]]:t.dns?e==="request"?[["qnameFull",n],["qnameSuffix",n],["sip",r(t.sip)]]:[...t.dns.answers.map(s=>["answerIp",r(s)]),["sip",r(t.sip)]]:[]).flatMap(([s,o])=>{const a=o?Op(s,o):null;return a?[{kind:s,condition:a}]:[]})}function Hx(t,e){const n=[];return e&&t.dns&&hs(t,"request").some(r=>r.kind!=="sip")&&n.push("request"),e&&t.dns?.answers.length&&hs(t,"response").some(r=>r.kind!=="sip")&&n.push("response"),hs(t).length&&n.push("routing"),n}const Vx=(t,e)=>{const n=e&&Op("qtype",e);return n?`${t} && ${n}`:t};function gt(t){return t.replace(/\s*->\s*("[^"]*"|'[^']*'|[^\s()'"]+)(\(must\))?\s*$/,"").replace(/\s+/g,"").replace(/"/g,"'")}function Ux(t,e,n,r){const i=d=>$5(d,e),s=n&&t.find(d=>d.rule_id===n.id&&i(d)&&(n.expression===null||gt(n.expression)===gt(d.expression))),o=t.find(d=>d.kind==="fallback"&&i(d)),a=t.find(i),l=d=>d===t[0]?r("conn.ruleTop"):r("rule.positionBefore",{n:d.index+1}),c=[...s?[{rule:s,label:r("conn.ruleBeforeMatched")}]:[],...o?[{rule:o,label:r("rule.positionEnd")}]:[],...a?[{rule:a,label:l(a)}]:[]];return c.filter((d,p)=>c.findIndex(h=>h.rule===d.rule)===p).map(({rule:d,label:p})=>({id:d.rule_id,label:p,desc:d.expression,matched:d===s,first:d===t[0]}))}function qx(t,e,n,r){const i=gt(e),s=c=>c.kind==="rule"&&c.outbound===n&&gt(c.expression)===i,o=c=>c.source?.source_id===r.source?.source_id,a=t.findIndex(c=>c.kind===r.kind&&o(c)&&gt(c.expression)===gt(r.expression));return((a<0?void 0:t.slice(0,a).reverse().find(c=>s(c)&&o(c)))??t.find(s))?.rule_id??null}function zx(t,e,n,r,i,s){const o=gt(r),a=d=>t==="routing"?d:d.toLowerCase(),l=e.find(d=>d.kind==="rule"&&a(d.target)===a(i)&&gt(d.expression)===o),c=t!=="routing";return l?s(c?"rule.dns.duplicateListed":"rule.duplicateListed",{n:l.index+1}):n.some(d=>d.list===t&&a(d.outbound)===a(i)&&gt(d.condition)===o)?s(c?"rule.dns.duplicateHeld":"rule.duplicateHeld"):null}function $5(t,e){const n=t&&e.find(r=>r.id===t.source?.source_id);return!!n?.writable&&Hp(n,t)!==null}function Wx(t,e,n){if(!e)return{before:t[0]?.id,moved:!1};const r=t.find(i=>i.id===e.id&&(n===e.generation||i.desc===e.desc));return r?{before:r.id,moved:!1}:{before:t[0]?.id,moved:!0}}function zp(t,e,n){return t?.open?{label:n("rule.dns.positionNew",{name:e}),desc:n("rule.dns.positionNewHelp",{name:e})}:{label:n("rule.positionLast"),desc:void 0}}function Gx(t,e,n,r){const i=c=>{const d=n.find(p=>p.id===c.source?.source_id);return!!d?.writable&&Up(d,c,t)!==null},s=e.find(c=>c.kind==="fallback"),o=s?.source?null:Ka(n,t),a=e.find(i),l=[...s?.source&&i(s)?[{id:s.rule_id,label:r("rule.positionEnd"),desc:s.expression,first:s===e[0]}]:[],...o?[{id:"end",...zp(o.anchor,t,r),first:!1}]:[],...a?[{id:a.rule_id,label:a===e[0]?r("conn.ruleTop"):r("rule.positionBefore",{n:a.index+1}),desc:a.expression,first:a===e[0]}]:[]];return l.filter((c,d)=>l.findIndex(p=>p.id===c.id)===d).map(c=>({...c,matched:!1}))}function Yx(t,e){const n=e.flatMap(s=>qp(s.content)),r=new Set(n.map(s=>s.name.toLowerCase())),i=[...new Set(t.flatMap(s=>s.upstream&&!r.has(s.upstream.toLowerCase())?[s.upstream]:[]))];return[...n,...i.map(s=>({name:s,address:null}))]}function Jx(t,e,n){const r=e.map(i=>({id:i,label:ht(i),...t==="response"?{desc:n("rule.dns.action.requery")}:{}}));return t==="request"?[...r,{id:"asis",label:"asis",desc:n("rule.dns.action.asis")},{id:"reject",label:"reject",desc:n("rule.dns.action.rejectQuery")}]:[{id:"accept",label:"accept",desc:n("rule.dns.action.accept")},{id:"reject",label:"reject",desc:n("rule.dns.action.rejectAnswer")},...r]}function x5(t,e){if(!e)return null;const n=Lc(e),r=t.filter(i=>ht(i.name).toLowerCase()===e.toLowerCase()||i.address!==null&&Lc(i.address)===n);return r.length===1?r[0].name:null}function Xx({list:t,seed:e,upstreams:n,outbound:r,position:i}){const s=t==="routing",o=s?e.outbound||null:t==="request"?x5(n,e.dns?.upstream): Line truncated
`).join("")+(h[0].anchor.close??"");a=c}return o+r.slice(a)}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 Ic(t,e,n,r){const i=e??(t instanceof me&&t.status===422?t.details?.diagnostics??null:null);if(!i){const a=aa(t,r,r("ui.writeFailed"));return{text:Wl(a,r),lines:[],...a.requestId?{toastText:Wl(a,r,!1),requestId:a.requestId}:{}}}const s=i.filter(a=>a.level==="error").length,o=y5(i);return{text:o?r("config.writeRestart",{n:o}):s?r("ui.writeInvalid",{n:s}):r("rule.refused"),lines:i.map(a=>{const l=ia(Ti(a.code,a.message,r),r),c=n.find(d=>d.id===a.source_id);return a.line===null?l:r("config.atFile",{file:c?g5(c):a.source_id,line:a.line,message:l})})}}function Qx(t,e,n,r,i){const s=Fa(t).length,o=t.filter(l=>l.list===e),a=t.length-o.length;return o.length?{title:i("rule.pending",{n:o.length}),files:s>1?i("rule.pendingFiles",{files:s},"files"):null,elsewhere:a?i("rule.pendingElsewhere",{n:a}):null,failure:n,rows:o.map(l=>({id:l.id,line:_a(l.condition,l.outbound,l.must),position:P5(l,r,i)}))}:null}function P5(t,e,n){return t.list!=="routing"&&!t.before?zp(Ka(e,t.list)?.anchor,t.list,n).label:t.before&&t.before.kind!=="fallback"?n("rule.positionBefore",{n:t.before.index+1}):n("rule.positionEnd")}function k5(t,e,n,r){return e?{text:r("rule.partial",{n:e,held:n}),lines:[t.text,...t.lines],...t.requestId?{requestId:t.requestId}:{}}:t}const jc=()=>void ln();function C5(){const t=Q(),e=Kp(jc,{rethrow:!0}),n=_p().applying,r=u.useRef(null);u.useEffect(()=>()=>r.current?.abort(),[]);const i=async(l,c)=>{let d=[],p;try{if(d=(await La(oe(),c)).sources,c.aborted)return;const h=d.find(g=>g.id===l[0].sourceId),b=h&&await e.apply(h,()=>p=S5(d,h,l));return!h||p===null?(jc(),{written:!1,failure:{text:t("rule.stale"),lines:[]}}):b?b.diagnostics?{written:!1,failure:Ic(null,b.diagnostics,d,t)}:{written:!0,failure:null}:void 0}catch(h){return c.aborted?void 0:{written:h instanceof de&&["ui.writtenNotApplied","ui.operationUnknown","ui.activationDegradedSaved","ui.activationDegradedUnconfirmed","ui.activationUnknown"].includes(h.key)&&h.details?.written!==!1,failure:Ic(h,null,d,t)}}},s=async(l,c)=>{let d=0;for(const p of Fa(l)){const h=await i(p,c);if(!h)return;h.written&&wn.remove(p.map(g=>g.id));const b=h.written?p.length:0;if(h.failure)return{written:d+b,failure:k5(h.failure,d&&d+b,l.length-d-b,t)};d+=b}return{written:d,failure:null}};return{apply:async l=>{if(!wn.begin())return;const c=new AbortController;r.current=c;try{return await s(l,c.signal)}finally{r.current===c&&(r.current=null),wn.end()}},busy:n,cancel:()=>{r.current?.abort(),e.cancel()}}}function T5(){const t=Q(),{rules:e}=_p(),{apply:n,busy:r}=C5(),i=Fa(e).length;return{count:e.length,label:i>1?t("rule.applyFiles",{n:e.length,files:i},"files"):t("rule.applyPending",{n:e.length}),busy:r,apply:async()=>{const s=await n(e);if(!s)return;if(wn.fail(s.failure),s.failure){Me("negative",s.failure.toastText??s.failure.text,{requestId:s.failure.requestId});return}const o=w5("rule.applied",t,e.length);Me("positive",o.text,{detail:o.detail})}}}function R5(t,e,n,r){return Object.keys(Xs).filter(i=>t(i)||e===i).map(i=>({id:i,label:r(Xs[i]),isPending:e===i,isDisabled:!!e,onAction:()=>n(i)}))}function M5(t,e,n){const r=Q(),i=M2(t,e,n),s=o=>void i.run(o).then(a=>{a&&Me("positive",r("ov.operationResult",{action:r(Xs[o]),status:r("ov.succeeded"),operationId:a.operation_id}))},a=>h1(a,r,r("ov.operationError")));return{canRun:i.canRun,busy:i.busy,run:s,actions:R5(i.canRun,i.busy,s,r)}}function N5({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:G("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 Wp({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:G("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.58 Line truncated
`,r.from-1)+1,s=n.filter(l=>l.from>=i&&l.to<=r.from);if(s.some(l=>l.depth!==1))return[];const o=s.findIndex(l=>l.parens===0&&t.slice(l.from,l.to)==="->"),a=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:a}]})}function w3(t){const{blocks:e,tokens:n}=Ce(t),r=ih(t,e,n).find(i=>i.target);return r?r.target==="direct"?{mode:"direct"}:{mode:"global",target:r.target}:{mode:"rule"}}function E3(t,e){const n=Ce(t);for(const h of ih(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}=Ce(t),s=r.find(h=>h.name==="routing");if(!s)throw new de("act.modeNoRouting");const a=t.slice(s.open+1,s.close).match(/\n([ \t]+)\S/)?.[1]??" ";let l=s.open+1;t[l]===`
`&&l++;let c=null;const d=h=>{const b=t.indexOf(`
`,h);return t.slice(t.lastIndexOf(`
`,h-1)+1,b===-1?void 0:b).trim()};for(let h=0;h<i.length;h++){const b=i[h];if(b.from<=s.open||b.to>s.close||b.depth!==1||b.parens!==0||t.slice(b.from,b.to)!=="->")continue;const g=i[h+1],v=i[h+2],m=i[h+3],y=i[h+4];if(!(g&&v&&m&&y&&t.slice(v.from,v.to)==="("&&t.slice(m.from,m.to)==="must"&&t.slice(y.from,y.to)===")")){c??=d(b.from);continue}if(c!==null)throw new de("act.modeInterleaved",c);const x=t.indexOf(`
`,y.to);l=x!==-1&&x<s.close?x+1:y.to;const E=i[h+5];if(E&&E.from<l&&E.kind!=="comment")throw new de("act.modeInterleaved",d(E.from))}const p=e.mode==="direct"?"direct":e.target;return t.slice(0,l)+(t[l-1]===`
`?"":`
`)+`${a}l4proto(tcp, udp) -> ${p} ${rh}
`+t.slice(l)}const S3=(t,e)=>t.mode===e.mode&&(t.mode!=="global"||e.mode!=="global"||t.target===e.target),Wc=["ok","warn","err"];function P3(t,e,n,r){const i=_v(t),s=t?nh(Kv,t,r):n;return!t||e!=="degraded"&&e!=="failed"?{tone:i,text:s,href:null}:{tone:Wc[Math.max(Wc.indexOf(i),e==="failed"?2:1)],text:r(e==="failed"?"ov.status.datapathFailed":"ov.status.datapathDegraded",{status:s}),href:xe("overview",{card:"datapath"})}}const sh={rule:"mode.rule",direct:"mode.direct",global:"mode.global"};function k3(t,e,n,r,i,s,o=!0){const a=r?e??t:t,l=a.mode==="global"?a.target:(t.mode==="global"?t.target:n[0]?.name)??"";return{mode:o?a.mode:"",target:o?l:"",targetText:o&&l||"—",writable:r,dirty:r&&e!==null&&!S3(e,t),incomplete:a.mode==="global"&&!l,status:s(i?"act.modeReadOnly":"act.modeUnavailable"),readOnly:i&&!r,modes:["rule","direct","global"].map(c=>[c,s(sh[c])]),targets:n.map(c=>({id:c.name,label:c.name}))}}function C3({writable:t,incomplete:e,status:n},r,i){return r?{mode:null,global:null}:t?{mode:e?i("act.globalMissing"):null,global:null}:{mode:null,global:n}}const T3=t=>t.event!=="runtime.updated"&&t.event!=="flow.updated"&&!Ov(t),R3=8;function M3(t,e){const n=[];for(const r of t){const i=Hv(r,e),s=[r.event,i.key,...Object.entries(i.params??{}).map(([l,c])=>`${l}=${String(c)}`)].join("|"),o=n[n.length-1];if(o&&o.key===s){o.count+=1;continue}if(n.length===R3)break;const a=Object.fromEntries(Object.entries(i.params??{}).map(([l,c])=>[l,typeof c=="string"?Vv(c):c]));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:nh(Av,r.event,e),value:e(i.key,a)}),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 N3(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 L3(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 a=kv(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:Cv(a),alive:a?.state==="unavailable"?!1:a?.state==="healthy"?!0:void 0,unavailable:a?.state==="unavailable",healthError:a?.error?Jy(a.error,n):void 0}}),s=i.find(o=>o.id===e)??i.find(o=>o.tcp!==void 0)??i.find(o=>!Cn(o.name))??i[0];return{options:i,big:i.length>12,id:s?.id??"",name:s?.name??"",latency:s?.alive&&s.tcp!==void 0?Wf(s.tcp,n):"—",latencyClass:s?.alive&&s.tcp!==void 0&&np(s.tcp)?"rp-big ms warn":"rp-big",tone:s?.alive?"ok":s?.unavailable?"err":"muted",status:s?.alive?null:n(s?.unavailable?"act.unavailable":"act.unknown"),healthError:s?.healthError}}function I3(t,e,n,r="en",i){const{tone:s,text:o}=P3(t?.lifecycle.state,i,e(n===!1?"act.modeUnavailable":"ui.loading"),e);return{status:{tone:s,text:o},download:qs(t?.traffic.rates?.download_bytes_per_second??null,r),upload:qs(t?.traffic.rates?.upload_bytes_per_second??null,r),connections:t?.traffic.connections.total==null?"—":Pn(t.traffic.connections.total,r),cpu:j1(t?.process.cpu_percent,e),cpuHelp:{title:e("act.cpu"),text:e("act.cpuHelp")}}}function j3(t,e,n,r){const i=Rv(t);return{since:t?r("act.since",{time:N1(t.counter_since,e)}):"",total:ir(i.total,e),rows:i.rows.map((s,o)=>({name:xa(s.name,r),value:s.percent===null?null:Math.round(s.percent),text:ir(s.bytes,e),href:xe("connections",{out:s.name}),color:s.kind==="builtin"&&s.name==="block"?n.love:n.cat[o%n.cat.length]}))}}function D3(t,e,n,r,i){return x3(t,e).map((s,o)=>({name:s.name,value:s.percent===null?ir(s.download,r):i("ui.share",{bytes:ir(s.download,r),percent:s.percent}),pct:s.percent??0,color:n.cat[o%n.cat.length],href:xe("connections",e==="dev"?{src:s.name}:{q:s.name})}))}function K3(){const t=Q(),e=oe(),n=r5(T3);return{rows:u.useMemo(()=>M3(n.records,t),[n.records,t]),total:n.records.length,error:n.error,retry:()=>void ln().then(()=>g2(e)),loading:!n.error&&n.available===null,empty:t(n.available===!1?"event.unavailable":"act.noIssues")}}const _3=(t,e)=>t.kind==="invalid"?{kind:"negative",text:e("ui.writeInvalid",{n:t.errors})}:t.kind==="failed"?aa(t.error,e,e("ui.writeFailed")):null;function F3(){const t=ze().data?.resources,e=Ye(t,"config",{whileLoading:!1})&&t?.config.writable===!0,n=Ip(Ye(t,"config",{whileLoading:!1})),r=Kp(n.refetch,{rethrow:!0}),i=n.data?.sources.find(d=>d.kind==="main"&&d.writable)??null,s=Y2(i),o=s?i:null,a=s===!1,l=u.useMemo(()=>n.error??(a?new de("config.incomplete"):null),[n.error,a]),{apply:c}=r;return{main:o,writable:e,busy:r.busy!==null,error:l,retry:n.refetch,apply:u.useCallback(async(d,p=o??void 0)=>{if(!p)return{kind:"failed",error:l??new de("config.incomplete")};try{const h=await c(p,d);return h?h.diagnostics?{kind:"invalid",errors:h.diagnostics.filter(b=>b.level==="error").length}:{kind:"ok"}:{kind:"cancelled"}}catch(h){return{kind:"failed",erro Line truncated
`),settingName:t=>`experimental.native_api.${t}`,redactedSections:t=>t.filter(e=>e.name==="experimental"&&e.children.some(n=>n.name==="native_api")).map(e=>({block:e,name:"experimental.native_api"})),daeText:!0},q3={id:"unknown",reason:()=>{},holdsCredentials:()=>!1,snippet:t=>t.map(({key:e,value:n})=>`${e}: ${n}`).join(`
`),settingName:t=>t,redactedSections:()=>[],daeText:!1,uncheckedHooks:[]};function ah(t){switch(t?.engine.name){case"honk":return U3;default:return q3}}function z3(){const t=Q(),e=ze().data?.resources,n=K2(Ye(e,"groups",{whileLoading:!1})),r=Ip(Ye(e,"config",{whileLoading:!1})),{main:i,writable:s,busy:o,error:a,retry:l,apply:c}=F3(),d=Ra().data,p=ah(d).daeText,h=p?(i??r.data?.sources.find(E=>E.kind==="main"))?.content:void 0,b=u.useMemo(()=>h==null?{mode:"rule"}:w3(h),[h]),[g,v]=u.useState(null),m=(p||!d)&&!!e?.config.available,y=k3(b,g,n.data??[],p&&s&&!!i,m,t,h!=null),$=B1(y.dirty,()=>v(null)),x=async()=>{if(!g||y.incomplete)return;const E=g,R=await c(S=>E3(S,E));if(R.kind==="ok"&&($.clear(),v(S=>S===E?null:S),Me("positive",t("act.modeApplied",{mode:t(sh[E.mode])}))),R.kind==="failed"&&R.error instanceof de&&R.error.key==="act.modeInterleaved"){Me("negative",t(R.error.key),{detail:R.error.detail??void 0});return}const k=_3(R,t);k&&Me(k.kind,k.text,{detail:k.detail,requestId:k.requestId})};return{...y,reasons:C3(y,o,t),error:a,retry:l,busy:o,pick:E=>{E==="global"?v({mode:E,target:y.target}):(E==="direct"||E==="rule")&&v({mode:E})},pickTarget:E=>v({mode:"global",target:E}),apply:()=>void x()}}const Yc={connections:"nav.connections",flows:"flow.records",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"},W3=["configNotLoaded","configReadOnly","mainReadOnly","recordOff","geodataUpdate","geodataUnreadable","notRunning","flowsIdle","notProvided"],G3={"recorder-off":"recordOff","starting-or-stopping":"notRunning","geodata-mismatch":"geodataUnreadable"},Y3={"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 J3(t,e,n,r){const i=t.resources,s=ah(e),o=y=>s.reason(y,t),a=new Map,l=(y,$,x=Yc[$])=>{const E=a.get(y)??[];E.push({id:$,label:n(x)}),a.set(y,E)},c=(y,$)=>({href:Oa(r,y),text:n($),external:!0}),d=(y,$)=>({label:n("ov.lim.why"),text:n(y),link:$}),p=y=>{const $=y.find(k=>k!==void 0),x=$&&Y3[$.code];if(!x)return;const E=x.docs&&c(...x.docs),R=y.flatMap(k=>k&&"settings"in k?k.settings:[]);return R.length>0?{label:n("ov.lim.howTo"),text:n(x.text),snippet:s.snippet(R),link:E}:d(x.text,E)},h=i.config.available?i.config.writable!==!0?"configReadOnly":null:"configNotLoaded";h&&l(h,"config");const b=!i.config_validate.available&&h==="configNotLoaded";b&&l("configNotLoaded","config_validate"),(i.nodes.can_manage===!1||i.providers.can_manage===!1)&&l(h??"mainReadOnly","manage","ov.lim.manage");const g=i.runtime_settings.available&&(i.runtime_settings.fields??[]).includes("record_flows");for(const y of Object.keys(Yc)){const $=i[y];if(y==="config"||y==="config_validate"&&b)continue;const x=y==="flows"&&$.available&&(i.flows.recording==="off"||i.flows.recording==="auto");if(x||!$.available){const E=o(y)?.code;l((E&&G3[E])??(x?"flowsIdle":"notProvided"),y)}else y==="geodata"&&i.geodata.can_update!==!0&&l(h??"geodataUpdate",y),y==="providers"&&i.providers.can_refresh===!1&&l("notRunning","subscriptions","ov.lim.subscriptions"),y==="connections"&&i.connections.can_close===!1&&l("notProvided","close","ov.lim.close")}const v=()=>{const y=i.geodata;if(y.assets?.length===0)return d("ov.lim.geoNoAssets");const $=p([o("geodata")]);if($)return $;if(y.configurable_sources===!0)return d("ov.lim.geoNoUrl",{href:xe("settings",{card:"geodata"}),text:n("settings.geodata")})},m=(y,$)=>{const x=$.length,E=()=>$.map(R=>o(R.id));switch(y){case"configNotLoaded":return{headline:n("ov.lim.h.configNotLoaded"),named:["config"],help:p([o("config")])};case"configReadOnly":return{headline:n("ov.lim.h.configReadOnly"),named:["config"],help:p([o("config")])};case"mainReadOnly":return{headline:n("ov.lim.h.mainReadOnly"),named:["manage"],help:p([o("manage")])};case"recordOff":return{headline:n("ov.lim.h.recordOff",{n:x}),help:p(E())};case"geodataUpdate":return{headline:n("ov.lim.h.geodataUpdate"),named:["geodata"],help:v()};case"geodataUnreadable":return{headline:n("ov.lim.h.geodataUnreadable"),named:["geodata"],help:p(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:p(E())};case"flowsIdle":return{headline:n(o("flows")?.code==="recorded-on-deman 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-flavour=main][data-scheme=dark]{--rp-base:#191724;--rp-surface:#1f1d2e;--rp-overlay:#26233a;--rp-muted:#6e6a86;--rp-subtle:#908caa;--rp-text:#e0def4;--rp-love:#eb6f92;--rp-gold:#f6c177;--rp-rose:#ebbcba;--rp-pine:#31748f;--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:#21202e;--rp-hl-med:#403d52;--rp-hl-high:#524f67;--rp-shadow:0 1px 2px #00000059;--rp-on-accent:#fff;--rp-negative-tile-text:var(--rp-negative)}: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-negLine truncated
@@ -0,0 +1,93 @@
import{A as b,m as Rt,o as dt,p as jt,q as me,t as Q,v as Lt,x as Te,y as ne,z as ut,C as Pt,D as Et,F as Tt,G as zt,H as Gt,J as Ut,K as Ft,M as pt,N as Ht,O as qt,Q as we,R as Bt,U as re,V as qe,W as Jt,X as Vt,Y as $e,Z as ue}from"./index-Bw0aJc9a.js";import{d as ie,v as Kt,g as Wt}from"./geodata-De9_qBkH.js";import{mockSessionValid as Xt,withPasswordAuth as Qt,refuseWithoutSession as Yt}from"./auth-BReGn39D.js";import"./vendor-react-Bf71BWbF.js";import"./auth-DzCdgIKH.js";const Ae=Date.now(),H=e=>new Date(Ae-e*1e3).toISOString(),te=e=>new Date(Ae+e*1e3).toISOString(),J=H(0),X="mock-instance-1",ye="40",ee={observed_at:J,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,checksum:"sha256sum",max_urls:4,interval_hours:{min:1,max:168,default:24},lifecycle:{file_values:"start",overrides_persist:!0}},rules:{available:!0,max_rules:4096},config:{available:!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"],filters:["level","target"],retention_seconds:86400,min_buffered_records:64,max_buffered_records:4096},dns_log:{available:!0,min_records:64,max_records:2048,max_page_size:500},dns_rules:{available:!0,max_rules:1024},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"],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"],min_flows:64,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}}},Zt={...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},dns_rules:{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,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}}},en={...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,create:!1}}},ze=[{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:"direLine 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: category-ads-all) -> reject
qname(suffix: lan, home.arpa) -> asis
qtype(HTTPS) && qname(geosite: cn) -> reject
qname(geosite: cn) -> alidns
fallback: cloudflare
}
response {
upstream(cloudflare) -> accept
ip(geoip: private) && !qname(geosite: cn) -> cloudflare
fallback: accept
}
}
}
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
}
`,on=`# 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
`,Be=`'香港 01 IPLC': 'vless://<redacted>'
'香港 02 BGP': 'vless://<redacted>'
'新加坡 01 2x': 'trojan://<redacted>'
'日本 01 2x': 'vless://<redacted>'
`,sn=`# Written by honk from the subscription; edits are lost on refresh.
skylink { filter: subtag(sub-c) }
`,rn=[{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"}],mt=[{id:"src-main",path:"/etc/honk/config.dae",kind:"main",writable:!0,loaded_at:H(3600),content:nn},{id:"src-rules",path:"/etc/honk/rules.dae",kind:"include",writable:!0,loaded_at:H(3600),content:on},{id:"src-sub-c",path:"/var/lib/honk/subscriptions/sub-c.dae",kind:"subscription",writable:!1,loaded_at:H(1800),content:Be,onDisk:Be.replaceAll("<redacted>","demo@edge.example.net:443")},{id:"src-generated",path:"/var/lib/honk/generated/skylink.dae",kind:"generated",writable:!1,loaded_at:H(1800),content:sn}],_t=mt.map(e=>e.id==="src-rules"?{...e,content:e.content+`
# Ads
`+Ge.map(t=>`${t.cond} -> ${t.target}
`).join("")}:e),an=_t.map(e=>e.id==="src-rules"?{...e,content:e.content+`domain(suffix: example.org) -> direct
`}:e);function gt(e=100){if(!Number.isSafeInteger(e)||e<1||e>1e3)throw new b(400,"invalid_request","Invalid page size");return e}function _e(e,t=1/0){const n=new Map;return(i,a={})=>{const{cursor:p,limit:u,...f}=a,l=gt(u),o=Rt([e,{...f,limit:l}]);for(const[s,d]of n)d.expires<=Date.now()&&n.delete(s);const[c,w,k]=p?.split(":")??[dt(),"0"],v=Number(w),h=p?n.get(c):{items:i,key:o,expires:Date.now()+3e4};if(!h||k!==void 0||h.key!==o||!Number.isSafeInteger(v)||p&&(v<1||v>=h.items.length))throw new b(e==="flows"?410:400,e==="flows"?"snapshot_expired":"invalid_request","Unknown or expired cursor");const _=h.items.slice(v,v+l);let M=0;const I=_.findIndex(s=>(M+=JSON.stringify(s).length)>t),r=v+(I<0?_.length:Math.max(1,I));return!p&&r<i.length&&(h.items=structuredClone(i),n.size>=32&&n.delete(n.keys().next().value),n.set(c,h)),{items:structuredClone(h.items.slice(v,r)),total:h.items.length,next_cursor:r<h.items.length?`${c}:${r}`:null}}}function W(e,t){if(e===void 0)throw new b(404,"resource_not_found",`${t} not found`);return e}function Re(e){const t=URL.parse(e);return t?t.origin+t.pathname+(t.search?"?[redacted]":""):null}const ln=new Set(["global","subscription","node","group","dns","routing","upstream","request","response","include"]),Je=new Set(Et),cn=new Set(Pt),dn=e=>e===""?0:e.replace(/\n$/,"").split(`
`).length;async function ce({onDisk:e,...t}){const n=e??t.content;return{...t,content_sha256:await jt(n),bytes:new TextEncoder().encode(n).length,line_count:dn(n)}}function ge(e,t,n=!1){const{blocks:i}=ne(e),a=i.filter(p=>p.name===t).flatMap(p=>ut(e,p).filter(u=>!u.block));return n&&!i.length&&a.push({from:0,to:e.length,block:void 0}),ht(e,a)}const un=(e,t)=>ht(e,ut(e,t).filter(n=>!n.block));function ht(e,t){return t.flatMap(({from:n,to:i})=>{const a=e.slice(0,n).split(`
`).length;return e.slice(n,i).split(`
`).map((p,u)=>({code:Tt(p).trim(),raw:p,line:a+u}))})}function ve(e){return[...ge(e,"include").filter(({code:t})=>t).map(({code:t,line:n})=>({path:me(t),line:n})),...ge(e,"routing",!0).flatMap(({code:t,line:n})=>{const i=/^include\s+(\S+)$/.exec(t);return i?[{path:me(i[1]),line:n}]:[]})]}const Ve=(e,t,n)=>e.filter(i=>Te(Q(t,n),Q(void 0,i.path)));function bt(e,t,n,i){const a=[],p=(o,c,w,k,v,h)=>a.push({level:w,source_id:e,line:o,column:c,span:null,code:k,message:v,...h?{params:h}:{}}),{blocks:u,tokens:f}=ne(t),l=o=>{o.depth===0&&!ln.has(o.name)&&p(o.line+1,1,"error","unknown_section",`Unknown section "${o.name}"`,{name:o.name}),o.close===t.length&&p(o.line+1,1,"error","section_not_closed",`Section "${o.name}" is never closed`,{name:o.name}),o.children.forEach(l)};u.forEach(l);for(const o of f)o.kind==="symbol"&&o.depth===0&&t[o.from]==="}"&&p(o.line+1,1,"error","brace_without_section","Closing brace without an open section");for(const{code:o,line:c}of ge(t,"global")){if(!o)continue;const w=/^([\w.-]+)\s*:\s*(.*)$/.exec(o);w?cn.has(w[1])||p(c,1,"error","unknown_key",`Unknown global setting "${w[1]}"`,{name:w[1]}):p(c,1,"error","not_a_setting",'Expected "<key>: <value>"')}return ge(t,"routing",!0).forEach(({code:o,raw:c,line:w})=>{if(!o||/^include\s+\S+$/.test(o))return;const k=/^fallback:\s*(\S+)$/.exec(o),v=/^(.+?)\s*->\s*(\S+)$/.exec(o),h=k?.[1]??v?.[2];if(!h){p(w,1,"error","not_a_rule",'Expected "<condition> -> <outbound>", "include <file>" or "fallback: <outbound>"');return}const _=h.replace(/\(.*\)$/,"");i==="full"&&!Je.has(h)&&!Je.has(_)&&!n.has(_)&&p(w,c.lastIndexOf(h)+1,"error","unknown_outbound",`No group named "${_}"`,{name:_}),v&&!/\w\(/.test(v[1])&&p(w,1,"warning","bare_condition","Condition has no function call; it will never match")}),a}function pn(e){return new Set(ne(e).blocks.filter(t=>t.name==="group").flatMap(t=>t.children.map(n=>n.name)))}function Ne(e,t,n=[]){const i=e.sources.map((u,f)=>({...u,id:u.id??`source-${f+1}`}));if(new Set(i.map(u=>u.id)).size!==i.length)throw new b(400,"invalid_request","Source IDs must be unique");const a=[];if(e.mode==="full"){const u=i[0]?.path,f=new Map([...n,...i].filter(o=>o.path).map(o=>[Q(void 0,o.path),o])),l=new Set(i.map(o=>o.path&&Q(void 0,o.path)));for(let o=0;o<i.length;o++){const c=i[o];for(const{path:w,line:k}of ve(c.content)){const v=Q(u,w);if(Lt(w)){for(const[_,M]of f)Te(v,_)&&!l.has(_)&&(l.add(_),i.push({...M,id:M.id??`source-${i.length+1}`}));continue}const h=f.get(v);h?l.has(v)||(l.add(v),i.push({...h,id:h.id??`source-${i.length+1}`})):a.push({source_id:c.id,line:k,column:1,span:null,level:"error",code:"include_not_found",message:`Include "${w}" cannot be resolved`,params:{path:w}})}}}const p=e.mode==="full"?new Set(i.flatMap(u=>[...pn(u.content)])):new Set;return a.push(...i.flatMap(u=>bt(u.id,u.content,p,e.mode))),{valid:!a.some(u=>u.level==="error"),diagnostics:a,generation_id:t,validated_at:new Date().toISOString()}}const Ke={request:"asis",response:"accept"},fn={request:["asis","reject"],response:["accept","reject"]};function mn(e,t){const n=e.flatMap(l=>zt(l.content)),i=l=>n.find(o=>o.toLowerCase()===l.toLowerCase())??l,a={request:[],response:[]},p={},u=(l,o)=>{const c=o.toLowerCase();return fn[l].includes(c)?{action:c,upstream:null}:{action:l==="request"?"upstream":"requery",upstream:i(o)}};for(const l of e){const{blocks:o}=ne(l.content),c=o.filter(w=>w.name==="dns").flatMap(w=>w.children.filter(k=>k.name==="routing"));for(const w of c)for(const k of w.children){const v=k.name;if(!(v!=="request"&&v!=="response"))for(const{code:h,raw:_,line:M}of un(l.content,k)){const I=/^(?:fallback|default):\s*('[^']*'|"[^"]*"|\S+)$/.exec(h),r=/^(.+?)\s*->\s*('[^']*'|"[^"]*"|\S+)$/.exec(h);if(!I&&!r)continue;const s=new TextEncoder().encode(_.slice(0,_.search(/\S/))).length+1,d={file:l.path.split("/").pop(),source_id:l.id,line:M,column:s};I?p[v]={rule_id:`${v}:fallback`,index:0,expression:h,...u(v,I[1]),source:d,kind:"fallback"}:a[v].push({rule_id:`${v}:${d.file}:${M}`,index:a[v].length,expression:h,...u(v,r[2]),source:d,kind:"rule"})}}}const f=l=>[...a[l],{...p[l]??{rule_id:`${l}:fallback`,expression:`fallback: ${Ke[l]}`,action:Ke[l],upstream:null,source:null,kind:"fallback"},index:a[l].length}];return{generation_id:t,request:f("request"),response:f("response")}}function _n(e,t,{enqueue:n,log:i,publish:a,eventData:p,trimLogs:u},f,l,o,c=!1){const w=c?tn:De,k=structuredClone(w),v=()=>{const g=structuredClone(k);return e.resources.geodata.configurable_sources===!0&&(g.geodata=o.settings()),g};let h=null,_=[],M;const I=()=>M??=Promise.all([Promise.all((c?_t:mt).map(ce)),c?Promise.all(an.map(ce)):null]).then(([g,O])=>(h=g,_=O??[...g],g));let r=40,s=0;const d=g=>g.kind==="main"||g.kind==="include";function m(g,O=_){const j=[],R=O.find(q=>q.kind==="main"),F=q=>{if(j.some(N=>N.id===q.id))return;const y=q.id===g?.id?g.content:q.content;j.push({id:q.id,path:q.path,content:y});for(const{path:N}of ve(y))Ve(O,R.path,N).forEach(F)};return R&&F(R),j}function x(g Line truncated
`),g),h&&(h=[..._],o.follow(C(h).rules.flatMap(R=>R.kind==="rule"?[R.expression]:[]))),r+=1,Object.assign(k,structuredClone(w),{observed_at:new Date().toISOString()}),i("info","honk::routing","Routing generation published.",{generation_id:String(r)});const j=String(r);return t.generation={...t.generation,active_id:j,config_revision:j,activated_at:new Date().toISOString()},a({id:"",event:"generation.changed",data:{...p(),generation_id:j,previous_generation_id:String(r-1)}}),j}async function D(g){await I();const O=W(_.find(R=>R.kind==="main"),"Main source"),j=await ce({...O,content:g(O.content),loaded_at:new Date().toISOString()});return()=>{if(_.find(R=>R.id===O.id)!==O)throw new b(412,"stale_revision","The main source changed before activation");return _=_.map(R=>R.id===O.id?j:R),S()}}function C(g){const O=g.find(A=>A.kind==="main"),j=new Map(g.map(A=>[Q(void 0,A.path),A])),R=new Map([...ft.rules,...Ge].map(A=>[A.cond+" -> "+A.target+(A.must?"(must)":""),A.id])),F=[];let q=null;const y=new Set,N=(A,E)=>{if(!y.has(A.id)){y.add(A.id),ge(A.content,"routing",E).forEach(({code:P,raw:G,line:B})=>{const L=/^include\s+(\S+)$/.exec(P);if(L){const He=j.get(Q(O.path,L[1]));He&&N(He,!0);return}const z=/^fallback:\s*(\S+)$/.exec(P),U=/^(.+?)\s*->\s*(\S+)$/.exec(P);if(!z&&!U)return;const K=G.search(/\S/),Ot=new TextEncoder().encode(G.slice(0,K)).length+1,le={file:A.path.split("/").pop(),source_id:A.id,line:B,column:Ot};if(z){q={outbound:z[1],source:le},F.push({rule_id:"fallback",index:F.length,expression:P,outbound:z[1],must:!1,source:le,kind:"fallback"});return}const Ct=U[2].endsWith("(must)"),Dt=U[2].replace(/\(must\)$/,"");F.push({rule_id:R.get(P)??`${le.file}:${le.line}`,index:F.length,expression:U[1],outbound:Dt,must:Ct,source:le,kind:"rule"})});for(const{path:P}of ve(A.content))Ve(g,O.path,P).forEach(G=>N(G,!0))}};return O&&N(O,!1),{rules:F,fallback:q}}const T=async()=>{await I();const{rules:g,fallback:O}=C(h);if(!O)throw new b(503,"snapshot_unavailable","The routing section has no fallback",null,null,1);return{generation_id:String(r),rules:g,fallback:O}};return{api:{rules:async g=>{if(g?.throwIfAborted(),!e.resources.rules.available)throw new b(404,"capability_not_supported","The rule list is unavailable");return T()},dnsRules:async g=>{if(g?.throwIfAborted(),!e.resources.dns_rules.available)throw new b(404,"capability_not_supported","The DNS rule list is unavailable");return await I(),mn(h.filter(d),String(r))},config:async g=>{if(g?.throwIfAborted(),!e.resources.config.available)throw new b(404,"capability_not_supported","Configuration readback is unavailable");await I();const O=h,j=String(r),R=f();return{generation_id:j,revision:j,sources:O.map(F=>({...F})),diagnostics:[...O.filter(d).flatMap(F=>bt(F.id,F.content,R,"full").filter(q=>q.level!=="error")),...c?rn:[]],secrets_redacted:!0}},validateConfig:async(g,O)=>{if(O?.throwIfAborted(),!e.resources.config_validate.available)throw new b(404,"capability_not_supported","Validation is unavailable");if(!e.resources.config_validate.modes?.includes(g.mode))throw new b(400,"invalid_request",`Mode ${g.mode} is not advertised`);return g.mode==="full"&&await I(),Ne(g,String(r),_.filter(d))},replaceConfigSource:async(g,O,j,R)=>{R?.throwIfAborted(),await I();const q=W(_.find(A=>A.id===g),"Configuration source");if(!e.resources.config.writable||!q.writable)throw new b(403,"permission_denied","This source is read-only");if(x(O,{content:O}),!j)throw new b(428,"precondition_required","If-Match is required");if(j.replace(/^"|"$/g,"")!==q.content_sha256)throw new b(412,"stale_revision","The source changed on disk; fetch it again before retrying");const y=Ne({sources:m({id:g,content:O}),mode:"full"},String(r));if(!y.valid)throw new b(422,"unsupported_value","Validation found errors; nothing was written",null,{diagnostics:y.diagnostics});const N=await ce({...q,content:O,loaded_at:new Date().toISOString()});return _=_.map(A=>A.id===g?N:A),i("info","honk::config","Configuration source replaced; reloading.",{source_id:g}),n("reload",()=>{const A=S();return{active_generation_id:A,datapath_generation_id:A}})},createConfigSource:async(g,O,j)=>{j?.throwIfAborted();const R=e.resources.config;if(!R.available||!R.create)throw new b(404,"capability_not_supported","Creating configuration sources is unavailable");if(!R.writable)throw new b(403,"permission_denied","Configuration writes are disabled");if(x(O,{path:g,content:O}),Ut(g)||new TextEncoder().encode(g).length>1024)throw new b(400,"invalid_request","path must be a relative .dae path with normal segments");await I();const F=W(_.find(P=>P.kind==="main"),"Main source"),q=Q(F.path,g),y=()=>{if(_.some(P=>Q(void 0,P.path)===q))throw new b(409,"state_conflict",`${g} already exists`);if(R.max_sources!==void 0&&_.length>=R.max_sources)throw new b(413,"request_too_large","Source count exceeds the advertised max_sources")};if(y(),!m().some(P=>ve(P.content).some(G=>Te(Q(F.path,G.path),q)))){const P={level:"error",source_id:F.id,line:null,column:nul Line truncated
`);e=e.slice(0,u.close)+`
`+l+`
`+e.slice(u.close);for(const o of f.reverse())e=e.slice(0,o.from)+e.slice(o.to);return e}function We(e){try{return e()}catch{throw new b(422,"unsupported_value","The value cannot be written to the configuration")}}const Xe=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function An(e,t,{enqueue:n,log:i,pending:a},p,u,f,l,o=!1,c=!1){const w=_e("nodes"),k=_e("providers"),v=structuredClone(bn),{nodes:h,groups:_}=hn(Number.isFinite(t)?t:120,o);for(const s of v)s.node_count=h.filter(d=>d.provider_id===s.id).length;o&&Object.assign(v.find(s=>s.id==="sub-c"),{status:"stale",last_error:de});const M=new Map,I=new Set;return{api:{nodes:async(s,d)=>{if(d?.throwIfAborted(),!e.resources.nodes.available)throw new b(404,"capability_not_supported","Nodes are unavailable");const m=w(s?.group_id?h.filter(x=>x.group_ids.includes(s.group_id)):h,s);return{observed_at:J,nodes:m.items,next_cursor:m.next_cursor}},groups:async s=>{if(s?.throwIfAborted(),!e.resources.groups.available)throw new b(404,"capability_not_supported","Groups are unavailable");return _.map(d=>({id:d.id,name:d.name,icon:d.icon,config_revision:d.config_revision,policy:{...d.policy},member_count:d.members.length,selection:{tcp_member_id:d.runtime.selection.tcp?.member_id??null,udp_member_id:d.runtime.selection.udp?.member_id??null}}))},group:async(s,d)=>{if(d?.throwIfAborted(),!e.resources.groups.available)throw new b(404,"capability_not_supported","Groups are unavailable");return structuredClone(W(_.find(m=>m.id===s),"Group"))},selectGroup:async(s,d,m)=>{m?.throwIfAborted();const x=W(_.find(g=>g.id===s),"Group"),S=!x.capabilities.can_select&&x.capabilities.can_override;if(!x.capabilities.can_select&&!S)throw new b(422,"unsupported_value","Group does not support manual selection");if(!x.members.some(g=>g.id===d.member_id))throw new b(422,"unsupported_value","Member is not in this group");const D=d.network==="both"?["tcp","udp"]:[d.network];let C=!1;for(const g of D){const O=x.runtime.selection[g]?.member_id;x.runtime.selection[g]={member_id:d.member_id,resolved_leaf_node_id:ke(d.member_id,g,h,_)?.id??null,source:S?"override":"runtime"},!(O===d.member_id||!x.config.interrupt_connections)&&(C=f(s,g)||C)}const T=(M.get(s)??0n)+1n;M.set(s,T);const $={group_id:s,member_id:d.member_id,network:d.network,source:S?"override":"runtime",selection_revision:String(T),connections_interrupted:C};return d.network!=="both"&&($.resolved_leaf_node_id=x.runtime.selection[d.network]?.resolved_leaf_node_id),$},clearGroupOverride:async(s,d,m)=>{m?.throwIfAborted();const x=W(_.find(T=>T.id===s),"Group");if(!x.capabilities.can_override)throw new b(409,"state_conflict","Group has no override to clear");const S=d==="both"?["tcp","udp"]:[d],D=gn(x);for(const T of S)x.runtime.selection[T]={member_id:D,resolved_leaf_node_id:ke(D,T,h,_)?.id??null,source:"policy"};const C=(M.get(s)??0n)+1n;return M.set(s,C),{group_id:s,network:d,selection_revision:String(C),connections_interrupted:!1,selection:structuredClone(x.runtime.selection)}},patchGroup:async(s,d,m,x)=>{x?.throwIfAborted();const S=W(_.find($=>$.id===s),"Group");if(m!=='"'+S.config_revision+'"')throw new b(412,"stale_revision","Group configuration revision changed");if(I.has(s))throw new b(409,"state_conflict","Group update is pending");const D=e.resources.groups.max_patch_operations;if(D!==void 0&&d.length>D)throw new b(413,"request_too_large","Too many patch operations");const C=xn(S,d),T=await u($=>In($,S.name,C));return I.add(s),n("group_update",()=>{I.delete(s);const $=T();return{group_id:s,config_revision:$}})},startProbe:async(s,d)=>{d?.throwIfAborted();const m=e.resources.probes;if(!m.available)throw new b(404,"capability_not_supported","Probes are unavailable");const x=s.ip_version==="any"?["ipv4","ipv6"]:[s.ip_version];if(!m.targets?.includes(s.target.type)||!m.kinds?.includes(s.kind)||s.transport.some(g=>!m.transports?.includes(g))||x.some(g=>!m.ip_versions?.includes(g)))throw new b(422,"unsupported_value","Probe dimensions are not advertised");const S=s.target,D=S.type==="group"?W(_.find(g=>g.id===S.group_id),"Group"):void 0;if(S.type==="node"&&W(h.find(g=>g.id===S.node_id),"Node"),!s.transport.length||s.transport.some(g=>D&&!D.capabilities.probe_transports.includes(g))||s.kind!=="dns"&&s.transport.some(g=>g!=="tcp"))throw new b(422,"unsupported_value","Unsupported probe dimensions");if(D&&Array.isArray(s.members)&&s.members.some(g=>!D.members.some(O=>O.id===g)))throw new b(422,"unsupported_value","Probe member is not in this group");const C=yt(s,h,_).length,T=m.limits;if(C>T.max_members_per_job||C*s.transport.length*x.length>T.max_results_per_job)throw new b(413,"request_too_large","Probe exceeds the advertised member or result limit");const $=structuredClone(s);return n("probe",()=>kn($,h,_,new Date().toISOString()))},providers:async(s,d)=>{if(d?.throwIfAborted(),!e.resources.providers.available)throw new b(404,"capability_not_supported","Providers are unavailable");const m=e.resources.providers.max_page_size??1e3;if(s?.limit Line truncated
`),g=We(()=>$.length?` ${qe(s.name)}: {
url: ${re(s.url)}
${$.join("")} }
`:` ${qe(s.name)}: ${re(s.url)}
`),O=await u(R=>R.replace(/^(subscription \{\n)/m,`$1${g}`));i("info","honk::subscription","Subscription added.",{provider:s.name});const j=()=>(O(),structuredClone(W(v.find(R=>R.name===s.name),"Provider")));return c?n("provider_create",j):j()},deleteProvider:async(s,d)=>{if(d?.throwIfAborted(),!e.resources.providers.can_manage)throw new b(404,"capability_not_supported","Provider management is unavailable");const m=v.findIndex(T=>T.id===s);if(m<0)return{deleted:0};if(v[m].kind==="inline")throw new b(404,"capability_not_supported","The inline provider is the node section itself");const x=v[m],S=Xe(x.name),D=await u(T=>T.replace(new RegExp(`^\\s*${S}:\\s*\\{\\n[\\s\\S]*?\\n\\s*\\}\\n|^\\s*${S}:.*\\n`,"m"),""));i("info","honk::subscription","Subscription removed.",{provider:x.name});const C=()=>(D(),{deleted:1});return c?n("provider_delete",C):C()},createNode:async(s,d)=>{if(d?.throwIfAborted(),!e.resources.nodes.can_manage)throw new b(404,"capability_not_supported","Node management is unavailable");const m=/^([a-z][a-z0-9+.-]*):\/\/\S+$/i.exec(s.link.trim())?.[1]?.toLowerCase();if(!m||!wn.includes(m))throw new b(422,"unsupported_value",`Unsupported share link scheme "${m??""}"`);if(h.some(C=>C.name===s.name))throw new b(409,"state_conflict",`An inline node named ${s.name} already exists`);const x=We(()=>` ${re(s.name)}: ${re(s.link.trim())}
`),S=await u(C=>C.replace(/^(node \{\n)/m,`$1${x}`));i("info","honk::config","Node added.",{node:s.name,protocol:m});const D=()=>(S(),structuredClone(W(h.find(C=>C.name===s.name),"Node")));return c?n("node_create",D):D()},deleteNode:async(s,d)=>{if(d?.throwIfAborted(),!e.resources.nodes.can_manage)throw new b(404,"capability_not_supported","Node management is unavailable");const m=h.find(D=>D.id===s);if(!m)return{deleted:0};if(m.provider_id!=="inline")throw new b(404,"capability_not_supported","Only inline nodes can be deleted; refresh or delete the provider instead");const x=await u(D=>D.replace(new RegExp(`^\\s*'${Xe(m.name)}':.*\\n`,"m"),""));i("info","honk::config","Node removed.",{node:m.name});const S=()=>(x(),{deleted:1});return c?n("node_delete",S):S()},geodata:async s=>{if(s?.throwIfAborted(),!e.resources.geodata.available)throw new b(404,"capability_not_supported","Geodata is unavailable");return l.status()},updateGeodata:async s=>{if(s?.throwIfAborted(),!e.resources.geodata.can_update)throw new b(404,"capability_not_supported","Geodata update is unavailable");if(a("geodata_update"))throw new b(409,"state_conflict","A geodata update is already queued or running");return n("geodata_update",()=>{const d=l.update();return i("info","honk::geodata","Geodata updated; reloading.",{assets:d.assets.map(m=>m.kind)}),p(),d})}},groupNames:()=>new Set(_.map(s=>s.name)),groupIds:()=>new Set(_.map(s=>s.id)),activate:(s,d)=>Sn(s,d,h,_,v)}}const $n=[{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 Nn(e,t,n,i,a,p=2500,u=!1){const f=new Map;let l=0;const o=new Set,c=[],w=new Map,k=new Map,v=()=>{for(;c.length&&Date.now()-Date.parse(c[0].data.observed_at)>t.retention_seconds*1e3;)c.shift();const y=c.length?Number(c[0].id.split(":")[1])-1:l,N=S.length?Number(S[0].id.split(":")[2])-1:C;for(const[A,E]of w)(E.position<(E.stream==="events"?y:N)||E.stream==="events"&&Date.now()-E.issued>t.retention_seconds*1e3)&&(w.delete(A),k.delete(JSON.stringify([E.stream,E.filter,E.position])))},h=(y,N,A)=>{const E=JSON.stringify([y,N,A]),P=k.get(E);if(P)return P;const G=dt();return w.set(G,{stream:y,filter:N,position:A,issued:Date.now()}),k.set(E,G),G},_=(y,N,A,E)=>{if(y===void 0)return E;v();const P=w.get(y);if(!P||P.stream!==N||P.filter!==A)throw new b(409,"event_cursor_expired","The stream cursor cannot be replayed");return P.position};let M;const I=()=>({instance_id:X,observed_at:new Date().toISOString()});function r(y){y.id=`${X}:${++l}`,c.push(y),c.length>t.max_buffered_events&&c.shift(),v(),o.forEach(N=>N(y))}function s(){n.observed_at=new Date().toISOString(),r({id:"",event:"runtime.updated",data:{...I(),href:"/api/v1/runtime"}})}const d=(y,N)=>{const A="op-"+(f.size+1),E=new Date().toISOString(),P={operation_id:A,kind:y,created_at:E,started_at:E};f.set(A,{...P,finished_at:null,status:"running",result:null,error:null,retryAfter:1}),r({id:"",event:"operation.updated",data:{...I(),resource_id:A,status:"running",href:"/api/v1/operations/"+A}}),setTimeout(()=>{try{f.set(A,{...P,status:"succeeded",result:N(),error:null,finished_at:new Date().toISOString()})}catch(L){f.set(A,{...P,status:"failed",finished_at:new Date().toISOString(),result:null,error:L instanceof b?{code:L.code,message:L.message,details:L.details}:{code:"operation_failed",message:L instanceof Error?L.message:String(L)}})}const B=f.get(A);y==="reload"&&(B.status==="succeeded"||B.status==="failed")&&(n.last_reload={operation_id:A,status:B.status,finished_at:B.finished_at,error:B.error}),r({id:"",event:"operation.updated",data:{...I(),resource_id:A,status:B.status,href:"/api/v1/operations/"+A}}),s()},1e3);const G="/api/v1/operations/"+A;return{operation_id:A,kind:y,status:"queued",href:G,retryAfter:1}},m=async(y,N)=>(N?.throwIfAborted(),structuredClone(W(f.get(y),"Operation"))),x=["trace","debug","info","warn","error"],S=[],D=new Set;let C=0;function T(){const y=i()?.buffered_records??1/0;S.length>y&&S.splice(0,S.length-y),v()}const $=(y,N,A,E=null,P=Date.now())=>{const G={id:`${X}:logs:${++C}`,ts:new Date(P).toISOString(),level:y,target:N,message:A,fields:E};S.p Line truncated
@@ -1,93 +0,0 @@
import{A as h,m as jt,o as ut,p as Pt,q as me,t as Q,v as Lt,x as Te,y as ne,z as pt,C as Et,D as Tt,F as Gt,G as zt,H as Ut,J as Ft,K as ft,M as Ht,N as Bt,O as we,Q as Jt,R as re,U as Be,V as Vt,W as Wt,X as Ae,Y as ue}from"./index-BNBwb-FJ.js";import{d as ie,m as Je,v as Kt,g as qt,a as Xt}from"./geodata-DprMPspn.js";import{mockSessionValid as Qt,withPasswordAuth as Yt,refuseWithoutSession as Zt}from"./auth-kokL-_Tb.js";import"./vendor-react-Bf71BWbF.js";import"./auth-TcOYUrrj.js";const Ie=Date.now(),B=e=>new Date(Ie-e*1e3).toISOString(),te=e=>new Date(Ie+e*1e3).toISOString(),J=B(0),K="mock-instance-1",Ce="40",ee={observed_at:J,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"],retention_seconds:86400,max_buffered_records:4096},dns_log:{available:!0,max_records:2048,max_page_size:500},dns_rules:{available:!0,max_rules:1024},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}}},en={...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},dns_rules:{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}}},tn={...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: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: category-ads-all) -> reject
qname(suffix: lan, home.arpa) -> asis
qtype(HTTPS) && qname(geosite: cn) -> reject
qname(geosite: cn) -> alidns
fallback: cloudflare
}
response {
upstream(cloudflare) -> accept
ip(geoip: private) && !qname(geosite: cn) -> cloudflare
fallback: accept
}
}
}
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
}
`,sn=`# 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
`,Ve=`'香港 01 IPLC': 'vless://<redacted>'
'香港 02 BGP': 'vless://<redacted>'
'新加坡 01 2x': 'trojan://<redacted>'
'日本 01 2x': 'vless://<redacted>'
`,rn=`# Written by honk from the subscription; edits are lost on refresh.
skylink { filter: subtag(sub-c) }
`,an=[{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"}],_t=[{id:"src-main",path:"/etc/honk/config.dae",kind:"main",writable:!0,loaded_at:B(3600),content:on},{id:"src-rules",path:"/etc/honk/rules.dae",kind:"include",writable:!0,loaded_at:B(3600),content:sn},{id:"src-sub-c",path:"/var/lib/honk/subscriptions/sub-c.dae",kind:"subscription",writable:!1,loaded_at:B(1800),content:Ve,onDisk:Ve.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:rn}],gt=_t.map(e=>e.id==="src-rules"?{...e,content:e.content+`
# Ads
`+ze.map(n=>`${n.cond} -> ${n.target}
`).join("")}:e),ln=gt.map(e=>e.id==="src-rules"?{...e,content:e.content+`domain(suffix: example.org) -> direct
`}:e);function ht(e=100){if(!Number.isSafeInteger(e)||e<1||e>1e3)throw new h(400,"invalid_request","Invalid page size");return e}function _e(e,n=1/0){const s=new Map;return(r,i={})=>{const{cursor:p,limit:l,...f}=i,a=ht(l),o=jt([e,f]);for(const[c,d]of s)d.expires<=Date.now()&&s.delete(c);const[u,b,k]=p?.split(":")??[ut(),"0"],m=Number(b),_=p?s.get(u):{items:r,key:o,expires:Date.now()+3e4};if(!_||k!==void 0||_.key!==o||!Number.isSafeInteger(m)||p&&(m<1||m>=_.items.length))throw new h(e==="flows"?410:400,e==="flows"?"snapshot_expired":"invalid_request","Unknown or expired cursor");const y=_.items.slice(m,m+a);let A=0;const S=y.findIndex(c=>(A+=JSON.stringify(c).length)>n),t=m+(S<0?y.length:Math.max(1,S));return!p&&t<r.length&&(_.items=structuredClone(r),s.size>=32&&s.delete(s.keys().next().value),s.set(u,_)),{items:structuredClone(_.items.slice(m,t)),total:_.items.length,next_cursor:t<_.items.length?`${u}:${t}`: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 cn=new Set(["global","subscription","node","group","dns","routing","upstream","request","response","include"]),We=new Set(Tt),dn=new Set(Et),un=e=>e===""?0:e.replace(/\n$/,"").split(`
`).length;async function ce({onDisk:e,...n}){const s=e??n.content;return{...n,content_sha256:await Pt(s),bytes:new TextEncoder().encode(s).length,line_count:un(s)}}function ge(e,n,s=!1){const{blocks:r}=ne(e),i=r.filter(p=>p.name===n).flatMap(p=>pt(e,p).filter(l=>!l.block));return s&&!r.length&&i.push({from:0,to:e.length,block:void 0}),bt(e,i)}const pn=(e,n)=>bt(e,pt(e,n).filter(s=>!s.block));function bt(e,n){return n.flatMap(({from:s,to:r})=>{const i=e.slice(0,s).split(`
`).length;return e.slice(s,r).split(`
`).map((p,l)=>({code:Gt(p).trim(),raw:p,line:i+l}))})}function ve(e){return[...ge(e,"include").filter(({code:n})=>n).map(({code:n,line:s})=>({path:me(n),line:s})),...ge(e,"routing",!0).flatMap(({code:n,line:s})=>{const r=/^include\s+(\S+)$/.exec(n);return r?[{path:me(r[1]),line:s}]:[]})]}const Ke=(e,n,s)=>e.filter(r=>Te(Q(n,s),Q(void 0,r.path)));function wt(e,n,s,r){const i=[],p=(o,u,b,k,m)=>i.push({level:b,source_id:e,line:o,column:u,span:null,code:k,message:m}),{blocks:l,tokens:f}=ne(n),a=o=>{o.depth===0&&!cn.has(o.name)&&p(o.line+1,1,"error","unknown_section",`Unknown section "${o.name}"`),o.close===n.length&&p(o.line+1,1,"error","section_not_closed",`Section "${o.name}" is never closed`),o.children.forEach(a)};l.forEach(a);for(const o of f)o.kind==="symbol"&&o.depth===0&&n[o.from]==="}"&&p(o.line+1,1,"error","brace_without_section","Closing brace without an open section");for(const{code:o,line:u}of ge(n,"global")){if(!o)continue;const b=/^([\w.-]+)\s*:\s*(.*)$/.exec(o);b?dn.has(b[1])||p(u,1,"error","unknown_key",`Unknown global setting "${b[1]}"`):p(u,1,"error","not_a_setting",'Expected "<key>: <value>"')}return ge(n,"routing",!0).forEach(({code:o,raw:u,line:b})=>{if(!o||/^include\s+\S+$/.test(o))return;const k=/^fallback:\s*(\S+)$/.exec(o),m=/^(.+?)\s*->\s*(\S+)$/.exec(o),_=k?.[1]??m?.[2];if(!_){p(b,1,"error","not_a_rule",'Expected "<condition> -> <outbound>", "include <file>" or "fallback: <outbound>"');return}const y=_.replace(/\(.*\)$/,"");r==="full"&&!We.has(_)&&!We.has(y)&&!s.has(y)&&p(b,u.lastIndexOf(_)+1,"error","unknown_outbound",`No group named "${y}"`),m&&!/\w\(/.test(m[1])&&p(b,1,"warning","bare_condition","Condition has no function call; it will never match")}),i}function fn(e){return new Set(ne(e).blocks.filter(n=>n.name==="group").flatMap(n=>n.children.map(s=>s.name)))}function $e(e,n,s=[]){const r=e.sources.map((l,f)=>({...l,id:l.id??`source-${f+1}`}));if(new Set(r.map(l=>l.id)).size!==r.length)throw new h(400,"invalid_request","Source IDs must be unique");const i=[];if(e.mode==="full"){const l=r[0]?.path,f=new Map([...s,...r].filter(o=>o.path).map(o=>[Q(void 0,o.path),o])),a=new Set(r.map(o=>o.path&&Q(void 0,o.path)));for(let o=0;o<r.length;o++){const u=r[o];for(const{path:b,line:k}of ve(u.content)){const m=Q(l,b);if(Lt(b)){for(const[y,A]of f)Te(m,y)&&!a.has(y)&&(a.add(y),r.push({...A,id:A.id??`source-${r.length+1}`}));continue}const _=f.get(m);_?a.has(m)||(a.add(m),r.push({..._,id:_.id??`source-${r.length+1}`})):i.push({source_id:u.id,line:k,column:1,span:null,level:"error",code:"include_not_found",message:`Include "${b}" cannot be resolved`})}}}const p=e.mode==="full"?new Set(r.flatMap(l=>[...fn(l.content)])):new Set;return i.push(...r.flatMap(l=>wt(l.id,l.content,p,e.mode))),{valid:!i.some(l=>l.level==="error"),diagnostics:i,generation_id:n,validated_at:new Date().toISOString()}}const qe={request:"asis",response:"accept"},mn={request:["asis","reject"],response:["accept","reject"]};function _n(e,n){const s=e.flatMap(a=>zt(a.content)),r=a=>s.find(o=>o.toLowerCase()===a.toLowerCase())??a,i={request:[],response:[]},p={},l=(a,o)=>{const u=o.toLowerCase();return mn[a].includes(u)?{action:u,upstream:null}:{action:a==="request"?"upstream":"requery",upstream:r(o)}};for(const a of e){const{blocks:o}=ne(a.content),u=o.filter(b=>b.name==="dns").flatMap(b=>b.children.filter(k=>k.name==="routing"));for(const b of u)for(const k of b.children){const m=k.name;if(!(m!=="request"&&m!=="response"))for(const{code:_,raw:y,line:A}of pn(a.content,k)){const S=/^(?:fallback|default):\s*('[^']*'|"[^"]*"|\S+)$/.exec(_),t=/^(.+?)\s*->\s*('[^']*'|"[^"]*"|\S+)$/.exec(_);if(!S&&!t)continue;const c=new TextEncoder().encode(y.slice(0,y.search(/\S/))).length+1,d={file:a.path.split("/").pop(),source_id:a.id,line:A,column:c};S?p[m]={rule_id:`${m}:fallback`,index:0,expression:_,...l(m,S[1]),source:d,kind:"fallback"}:i[m].push({rule_id:`${m}:${d.file}:${A}`,index:i[m].length,expression:_,...l(m,t[2]),source:d,kind:"rule"})}}}const f=a=>[...i[a],{...p[a]??{rule_id:`${a}:fallback`,expression:`fallback: ${qe[a]}`,action:qe[a],upstream:null,source:null,kind:"fallback"},index:i[a].length}];return{generation_id:n,request:f("request"),response:f("response")}}function gn(e,n,{enqueue:s,log:r,publish:i,eventData:p,trimLogs:l},f,a,o,u=!1){const b=u?nn:De,k=structuredClone(b),m=()=>{const v=structuredClone(k);return e.resources.geodata.configurable_sources===!0&&(v.geodata=o.settings()),v};let _=null,y=[],A;const S=()=>A??=Promise.all([Promise.all((u?gt:_t).map(ce)),u?Promise.all(ln.map(ce)):null]).then(([v,M])=>(_=v,y=M??[...v],v));let t=40,c=0;const d=v=>v.kind==="main"||v.kind==="include";function g(v,M=y){const P=[],E=M.find(U=>U.kind==="main"),H=U=>{if(P.some(O=>O.id===U.id))return;const w=U.id===v?.id?v.content:U.content;P.push({id:U.id,path:U.path,content:w});for(const{path:O}of ve(w))Ke(M,E.path,O).forEach(H)};return E&&H(E),P}function N(v,M){const P=H=>new TextEncoder().encode(H).length;if(P(JSON.stringify(M))>e.limits.max Line truncated
`),v),_&&(_=[...y],o.follow(C(_).rules.flatMap(E=>E.kind==="rule"?[E.expression]:[]))),t+=1,Object.assign(k,structuredClone(b),{observed_at:new Date().toISOString()}),r("info","honk::routing","Routing generation published.",{generation_id:String(t)});const P=String(t);return n.generation={...n.generation,active_id:P,config_revision:P,activated_at:new Date().toISOString()},i({id:"",event:"generation.changed",data:{...p(),generation_id:P,previous_generation_id:String(t-1)}}),P}async function D(v){await S();const M=W(y.find(E=>E.kind==="main"),"Main source"),P=await ce({...M,content:v(M.content),loaded_at:new Date().toISOString()});return()=>{if(y.find(E=>E.id===M.id)!==M)throw new h(412,"stale_revision","The main source changed before activation");return y=y.map(E=>E.id===M.id?P:E),I()}}function C(v){const M=v.find($=>$.kind==="main"),P=new Map(v.map($=>[Q(void 0,$.path),$])),E=new Map([...mt.rules,...ze].map($=>[$.cond+" -> "+$.target+($.must?"(must)":""),$.id])),H=[];let U=null;const w=new Set,O=($,L)=>{if(!w.has($.id)){w.add($.id),ge($.content,"routing",L).forEach(({code:j,raw:F,line:R})=>{const z=/^include\s+(\S+)$/.exec(j);if(z){const He=P.get(Q(M.path,z[1]));He&&O(He,!0);return}const T=/^fallback:\s*(\S+)$/.exec(j),q=/^(.+?)\s*->\s*(\S+)$/.exec(j);if(!T&&!q)return;const X=F.search(/\S/),Ct=new TextEncoder().encode(F.slice(0,X)).length+1,le={file:$.path.split("/").pop(),source_id:$.id,line:R,column:Ct};if(T){U={outbound:T[1],source:le},H.push({rule_id:"fallback",index:H.length,expression:j,outbound:T[1],must:!1,source:le,kind:"fallback"});return}const Dt=q[2].endsWith("(must)"),Rt=q[2].replace(/\(must\)$/,"");H.push({rule_id:E.get(j)??`${le.file}:${le.line}`,index:H.length,expression:q[1],outbound:Rt,must:Dt,source:le,kind:"rule"})});for(const{path:j}of ve($.content))Ke(v,M.path,j).forEach(F=>O(F,!0))}};return M&&O(M,!1),{rules:H,fallback:U}}const G=async()=>{await S();const{rules:v,fallback:M}=C(_);if(!M)throw new h(503,"snapshot_unavailable","The routing section has no fallback",null,null,1);return{generation_id:String(t),rules:v,fallback:M}};return{api:{rules:async v=>{if(v?.throwIfAborted(),!e.resources.rules.available)throw new h(404,"capability_not_supported","The rule list is unavailable");return G()},dnsRules:async v=>{if(v?.throwIfAborted(),!e.resources.dns_rules.available)throw new h(404,"capability_not_supported","The DNS rule list is unavailable");return await S(),_n(_.filter(d),String(t))},config:async v=>{if(v?.throwIfAborted(),!e.resources.config.available)throw new h(404,"capability_not_supported","Configuration readback is unavailable");await S();const M=_,P=String(t),E=f();return{generation_id:P,revision:P,sources:M.map(H=>e.resources.config.content?{...H}:{...H,content:void 0}),diagnostics:[...M.filter(d).flatMap(H=>wt(H.id,H.content,E,"full").filter(U=>U.level!=="error")),...u?an:[]],secrets_redacted:!0}},validateConfig:async(v,M)=>{if(M?.throwIfAborted(),!e.resources.config_validate.available)throw new h(404,"capability_not_supported","Validation is unavailable");if(!e.resources.config_validate.modes?.includes(v.mode))throw new h(400,"invalid_request",`Mode ${v.mode} is not advertised`);return v.mode==="full"&&await S(),$e(v,String(t),y.filter(d))},replaceConfigSource:async(v,M,P,E)=>{E?.throwIfAborted(),await S();const U=W(y.find($=>$.id===v),"Configuration source");if(!e.resources.config.writable||!U.writable)throw new h(403,"permission_denied","This source is read-only");if(N(M,{content:M}),!P)throw new h(428,"precondition_required","If-Match is required");if(P.replace(/^"|"$/g,"")!==U.content_sha256)throw new h(412,"stale_revision","The source changed on disk; fetch it again before retrying");const w=$e({sources:g({id:v,content:M}),mode:"full"},String(t));if(!w.valid)throw new h(422,"unsupported_value","Validation found errors; nothing was written",null,{diagnostics:w.diagnostics});const O=await ce({...U,content:M,loaded_at:new Date().toISOString()});return y=y.map($=>$.id===v?O:$),r("info","honk::config","Configuration source replaced; reloading.",{source_id:v}),s("reload",()=>{const $=I();return{active_generation_id:$,datapath_generation_id:$}})},createConfigSource:async(v,M,P)=>{P?.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(N(M,{path:v,content:M}),Ut(v)||new TextEncoder().encode(v).length>1024)throw new h(400,"invalid_request","path must be a relative .dae path with normal segments");await S();const H=W(y.find(j=>j.kind==="main"),"Main source"),U=Q(H.path,v),w=()=>{if(y.some(j=>Q(void 0,j.path)===U))throw new h(409,"state_conflict",`${v} already exists`);if(E.max_sources!==void 0&&y.length>=E.max_sources)throw new h(413,"request_too_large","Source count exceeds the advertised max_sources")};if(w(),!g().some(j=>ve(j.content).some(F=>Te(Q(H.path,F.path),U)))){const j={le Line truncated
`);e=e.slice(0,l.close)+`
`+a+`
`+e.slice(l.close);for(const o of f.reverse())e=e.slice(0,o.from)+e.slice(o.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 $n(e,n,{enqueue:s,log:r,pending:i},p,l,f,a,o=!1){const u=_e("nodes"),b=_e("providers"),k=structuredClone(wn),{nodes:m,groups:_}=bn(Number.isFinite(n)?n:120,o);for(const t of k)t.node_count=m.filter(c=>c.provider_id===t.id).length;o&&Object.assign(k.find(t=>t.id==="sub-c"),{status:"stale",last_error:de});const y=new Map,A=new Set;return{api:{nodes:async(t,c)=>{if(c?.throwIfAborted(),!e.resources.nodes.available)throw new h(404,"capability_not_supported","Nodes are unavailable");const d=u(t?.group_id?m.filter(g=>g.group_ids.includes(t.group_id)):m,t);return{observed_at:J,nodes:d.items,next_cursor:d.next_cursor}},groups:async t=>{if(t?.throwIfAborted(),!e.resources.groups.available)throw new h(404,"capability_not_supported","Groups are unavailable");return _.map(c=>({id:c.id,name:c.name,icon:c.icon,config_revision:c.config_revision,policy:{...c.policy},member_count:c.members.length,selection:{tcp_member_id:c.runtime.selection.tcp?.member_id??null,udp_member_id:c.runtime.selection.udp?.member_id??null}}))},group:async(t,c)=>{if(c?.throwIfAborted(),!e.resources.groups.available)throw new h(404,"capability_not_supported","Groups are unavailable");return structuredClone(W(_.find(d=>d.id===t),"Group"))},selectGroup:async(t,c,d)=>{d?.throwIfAborted();const g=W(_.find(x=>x.id===t),"Group"),N=!g.capabilities.can_select&&g.capabilities.can_override;if(!g.capabilities.can_select&&!N)throw new h(404,"capability_not_supported","Group does not support manual selection");W(g.members.find(x=>x.id===c.member_id),"Group member");const I=c.network==="both"?["tcp","udp"]:[c.network];let D=!1;for(const x of I){const v=g.runtime.selection[x]?.member_id;g.runtime.selection[x]={member_id:c.member_id,resolved_leaf_node_id:ye(c.member_id,x,m,_)?.id??null,source:N?"override":"runtime"},!(v===c.member_id||!g.config.interrupt_connections)&&(D=f(t,x)||D)}const C=(y.get(t)??0n)+1n;y.set(t,C);const G={group_id:t,member_id:c.member_id,network:c.network,source:N?"override":"runtime",selection_revision:String(C),connections_interrupted:D};return c.network!=="both"&&(G.resolved_leaf_node_id=g.runtime.selection[c.network]?.resolved_leaf_node_id),G},clearGroupOverride:async(t,c,d)=>{d?.throwIfAborted();const g=W(_.find(C=>C.id===t),"Group");if(!g.capabilities.can_override)throw new h(409,"state_conflict","Group has no override to clear");const N=c==="both"?["tcp","udp"]:[c],I=hn(g);for(const C of N)g.runtime.selection[C]={member_id:I,resolved_leaf_node_id:ye(I,C,m,_)?.id??null,source:"policy"};const D=(y.get(t)??0n)+1n;return y.set(t,D),{group_id:t,network:c,selection_revision:String(D),connections_interrupted:!1,selection:structuredClone(g.runtime.selection)}},patchGroup:async(t,c,d,g)=>{g?.throwIfAborted();const N=W(_.find(G=>G.id===t),"Group");if(d!=='"'+N.config_revision+'"')throw new h(412,"stale_revision","Group configuration revision changed");if(A.has(t))throw new h(409,"state_conflict","Group update is pending");const I=e.resources.groups.max_patch_operations;if(I!==void 0&&c.length>I)throw new h(413,"request_too_large","Too many patch operations");const D=Sn(N,c),C=await l(G=>An(G,N.name,D));return A.add(t),s("group_update",()=>{A.delete(t);const G=C();return{group_id:t,config_revision:G}})},startProbe:async(t,c)=>{c?.throwIfAborted();const d=e.resources.probes;if(!d.available)throw new h(404,"capability_not_supported","Probes are unavailable");const g=t.ip_version==="any"?["ipv4","ipv6"]:[t.ip_version];if(!d.targets?.includes(t.target.type)||!d.kinds?.includes(t.kind)||!d.purposes?.includes(t.purpose)||t.transport.some(x=>!d.transports?.includes(x))||g.some(x=>!d.ip_versions?.includes(x)))throw new h(422,"unsupported_value","Probe dimensions are not advertised");const N=t.target,I=N.type==="group"?W(_.find(x=>x.id===N.group_id),"Group"):void 0;if(N.type==="node"&&W(m.find(x=>x.id===N.node_id),"Node"),!t.transport.length||t.transport.some(x=>I&&!I.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(I&&Array.isArray(t.members)&&t.members.some(x=>!I.members.some(v=>v.id===x)))throw new h(422,"unsupported_value","Probe member is not in this group");const D=kt(t,m,_).length,C=d.limits;if(D>C.max_members_per_job||D*t.transport.length*g.length>C.max_results_per_job)throw new h(413,"request_too_large","Probe exceeds the advertised member or result limit");const G=structuredClone(t);return s("probe",()=>xn(G,m,_,new Date().toISOString()))},providers:async(t,c)=>{if(c?.throwIfAborted(),!e.resources.providers.available)throw new h(404,"capability_not_supported","Providers are unavailable");const d=e.resources. Line truncated
`),x=Xe(()=>G.length?` ${Be(t.name)}: {
url: ${re(t.url)}
${G.join("")} }
`:` ${Be(t.name)}: ${re(t.url)}
`),v=await l(M=>M.replace(/^(subscription \{\n)/m,`$1${x}`));return r("info","honk::subscription","Subscription added.",{provider:t.name}),v(),structuredClone(W(k.find(M=>M.name===t.name),"Provider"))},deleteProvider:async(t,c)=>{if(c?.throwIfAborted(),!e.resources.providers.can_manage)throw new h(404,"capability_not_supported","Provider management is unavailable");const d=k.findIndex(D=>D.id===t);if(d<0)return{deleted:0};if(k[d].kind==="inline")throw new h(404,"capability_not_supported","The inline provider is the node section itself");const g=k[d],N=Qe(g.name),I=await l(D=>D.replace(new RegExp(`^\\s*${N}:\\s*\\{\\n[\\s\\S]*?\\n\\s*\\}\\n|^\\s*${N}:.*\\n`,"m"),""));return r("info","honk::subscription","Subscription removed.",{provider:g.name}),I(),{deleted:1}},createNode:async(t,c)=>{if(c?.throwIfAborted(),!e.resources.nodes.can_manage)throw new h(404,"capability_not_supported","Node management is unavailable");const d=/^([a-z][a-z0-9+.-]*):\/\/\S+$/i.exec(t.link.trim())?.[1]?.toLowerCase();if(!d||!vn.includes(d))throw new h(422,"unsupported_value",`Unsupported share link scheme "${d??""}"`);if(m.some(I=>I.name===t.name))throw new h(409,"state_conflict",`An inline node named ${t.name} already exists`);const g=Xe(()=>` ${re(t.name)}: ${re(t.link.trim())}
`),N=await l(I=>I.replace(/^(node \{\n)/m,`$1${g}`));return r("info","honk::config","Node added.",{node:t.name,protocol:d}),N(),structuredClone(W(m.find(I=>I.name===t.name),"Node"))},deleteNode:async(t,c)=>{if(c?.throwIfAborted(),!e.resources.nodes.can_manage)throw new h(404,"capability_not_supported","Node management is unavailable");const d=m.find(N=>N.id===t);if(!d)return{deleted:0};if(d.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(N=>N.replace(new RegExp(`^\\s*'${Qe(d.name)}':.*\\n`,"m"),""));return r("info","honk::config","Node removed.",{node:d.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 a.status()},updateGeodata:async t=>{if(t?.throwIfAborted(),!e.resources.geodata.can_update)throw new h(404,"capability_not_supported","Geodata update is unavailable");if(i("geodata_update"))throw new h(409,"state_conflict","A geodata update is already queued or running");return s("geodata_update",()=>{const c=a.update();return r("info","honk::geodata","Geodata updated; reloading.",{assets:c.assets.map(d=>d.kind)}),p(),c})}},groupNames:()=>new Set(_.map(t=>t.name)),groupIds:()=>new Set(_.map(t=>t.id)),activate:(t,c)=>In(t,c,m,_,k)}}const Nn=[{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 Mn(e,n,s,r,i,p=2500,l=!1){const f=new Map;let a=0;const o=new Set,u=[],b=new Map,k=new Map,m=()=>{for(;u.length&&Date.now()-Date.parse(u[0].data.observed_at)>n.retention_seconds*1e3;)u.shift();const w=u.length?Number(u[0].id.split(":")[1])-1:a,O=I.length?Number(I[0].id.split(":")[2])-1:C;for(const[$,L]of b)(L.position<(L.stream==="events"?w:O)||L.stream==="events"&&Date.now()-L.issued>n.retention_seconds*1e3)&&(b.delete($),k.delete(JSON.stringify([L.stream,L.filter,L.position])))},_=(w,O,$)=>{const L=JSON.stringify([w,O,$]),j=k.get(L);if(j)return j;const F=ut();return b.set(F,{stream:w,filter:O,position:$,issued:Date.now()}),k.set(L,F),F},y=(w,O,$,L)=>{if(w===void 0)return L;m();const j=b.get(w);if(!j||j.stream!==O||j.filter!==$)throw new h(409,"event_cursor_expired","The stream cursor cannot be replayed");return j.position};let A;const S=()=>({instance_id:K,observed_at:new Date().toISOString()});function t(w){w.id=`${K}:${++a}`,u.push(w),u.length>n.max_buffered_events&&u.shift(),m(),o.forEach(O=>O(w))}function c(){s.observed_at=new Date().toISOString(),t({id:"",event:"runtime.updated",data:{...S(),href:"/api/v1/runtime"}})}const d=(w,O)=>{const $="op-"+(f.size+1),L=new Date().toISOString(),j={operation_id:$,kind:w,created_at:L,started_at:L};f.set($,{...j,finished_at:null,status:"running",result:null,error:null,retryAfter:1}),t({id:"",event:"operation.updated",data:{...S(),resource_id:$,status:"running",href:"/api/v1/operations/"+$}}),setTimeout(()=>{try{f.set($,{...j,status:"succeeded",result:O(),error:null,finished_at:new Date().toISOString()})}catch(z){f.set($,{...j,status:"failed",finished_at:new Date().toISOString(),result:null,error:z instanceof h?{code:z.code,message:z.message,details:z.details}:{code:"operation_failed",message:z instanceof Error?z.message:String(z)}})}const R=f.get($);w==="reload"&&(R.status==="succeeded"||R.status==="failed")&&(s.last_reload={operation_id:$,status:R.status,finished_at:R.finished_at,error:R.error}),t({id:"",event:"operation.updated",data:{...S(),resource_id:$,status:R.status,href:"/api/v1/operations/"+$}}),c()},1e3);const F="/api/v1/operations/"+$;return{operation_id:$,kind:w,status:"queued",href:F,retryAfter:1}},g=async(w,O)=>(O?.throwIfAborted(),structuredClone(W(f.get(w),"Operation"))),N=["trace","debug","info","warn","error"],I=[],D=new Set;let C=0;function G(){const w=r().buffered_records;I.length>w&&I.splice(0,I.length-w),m()}const x=(w,O,$,L=null,j=Date.now())=>{const F={id:`${K}:logs:${++C}`,ts:new Date(j).toISOString(),level:w,target:O,message:$,fields:L};I.push(F),G(),D.forEach(R=>R(F))},v=[()=>x("info","honk::routing","Routing generation p Line truncated
@@ -1 +1 @@
import{r as m,j as g}from"./vendor-react-Bf71BWbF.js";import{eQ as p}from"./index-BNBwb-FJ.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 import{r as m,j as g}from"./vendor-react-Bf71BWbF.js";import{fx as p}from"./index-Bw0aJc9a.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 +0,0 @@
import{h as t,cQ as l}from"./index-BNBwb-FJ.js";const a=(n,e)=>`${n}:${e}`;function o(n,e){const r=n.indexOf(":"),s=n.slice(0,r);return r>0&&e.includes(s)?{kind:s,value:n.slice(r+1)}:null}const i=(n,e)=>e&&n?t("rules",{tab:"list",rule:n}):void 0;function c(n,e=l){return n?o(n,e):null}function d(n,e="list"){return t("rules",{tab:e,add:a(n.kind,n.value)})}export{o as a,d as b,c as p,i as r,a as t};
@@ -0,0 +1 @@
const e=JSON.parse(`{"about.api":"API","about.contract":"Contract commit","about.credits":"Fonts Noto Sans TC/SC (OFL); icons Adobe Spectrum (Apache-2.0); palettes from Rosé Pine, Catppuccin, Nord, Kary Pro Colors, Ant Design, Arco Design and Semi Design.","about.duck":"Pet me","about.engine":"Engine","about.license":"License","about.privacy":"doona talks only to the backend you connect it to. It collects no data and sends nothing anywhere else.","about.quack":"Honk!","about.tagline":"Web UI for {engine}","about.title":"About doona","act.active":"Active connections","act.cgroup":"cgroup used","act.cpu":"CPU usage","act.cpuHelp":"The share of one CPU core that the process uses. A value above 100% means it uses more than one core.","act.d7":"7 d","act.devices":"Devices","act.domains":"Domains","act.download":"Download","act.emptyHistory":"No history samples yet","act.global":"Global mode outbound","act.globalMissing":"Global mode needs an outbound","act.good":"Good","act.h1":"1 h","act.h24":"24 h","act.h6":"6 h","act.historyRange":"History range","act.issues":"Notifications","act.latency":"Latency","act.limited":{"one":"{n} feature is off","other":"{n} features are off"},"act.live":"Live","act.m10":"10 min","act.memory":"Memory","act.mode":"Outbound mode","act.modeApplied":"Outbound mode written to the configuration and reloaded: {mode}","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.modeNoRouting":"The main configuration has no routing section","act.modeReadOnly":"Read-only","act.modeReadOnlyAction":"Make the main file writable by honk and keep native_api in its own include file.","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.modeUnavailable":"Not provided by this backend","act.modeWhyReadOnly":"Why is the mode read-only?","act.noConnections":"This backend does not provide connections","act.noHistory":"This backend does not provide history","act.noIssues":"No issues require attention","act.noOutbounds":"This backend does not provide outbound counters","act.node":"Node","act.nodePickHelp":"Selecting a node changes only the latency shown on this card; routing is unchanged.","act.noticeRepeat":{"one":"{n} time","other":"{n} times"},"act.outUsage":"Outbound downloads","act.rankingEmpty":"No connections to rank","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.readOnlyDocs":"Read-only sources","act.rss":"Resident memory","act.sampling":"Sampling","act.since":"Since {time}","act.topDevices":"Top traffic","act.traffic":"Traffic","act.truncated":"Truncated","act.unavailable":"Unavailable","act.unknown":"Unknown","act.upload":"Upload","act.viewAll":"View all","act.viewDetails":"View details","arrange.addSelected":"Add to group","arrange.applied":{"one":"Applied {n} change and reloaded.","other":"Applied {n} changes and reloaded."},"arrange.applyNote":"Applying validates the whole configuration first, then writes and reloads; nothing is written if validation fails.","arrange.badName":"Use only letters, digits, underscores, periods and hyphens.","arrange.byName":"Nodes added by name","arrange.byRule":"Selected by rules","arrange.bySubscription":"Whole subscriptions","arrange.change.addNode":"Add node {name} to {group}","arrange.change.addSubscription":"Add the whole subscription {name} to {group}","arrange.change.createGroup":"Create group {group}","arrange.change.removeNode":"Remove node {name} from {group}","arrange.change.removeSubscription":"Remove subscription {name} from {group}","arrange.clear":"Clear selection","arrange.create":"Create","arrange.discard":"Discard all","arrange.drag":"Drag {name}","arrange.dropHint":"Drop here to add","arrange.dropInto":"Drop into group {group}","arrange.editSource":"Change them in the configuration source","arrange.emptyNew":"Group {group} has no members yet; a group without members holds every node, so add a node or subscription first.","arrange.failed":"Could not apply: {error}","arrange.groupName":"Group name","arrange.groupNameHint":"Letters, digits, underscores, periods and hyphens only.","arrange.holdsAll":"This group has no filter, so it holds every node.","arrange.lastMember":"This is the group's last filter; removing it would make the group hold every node.","arrange.memberCount":{"one":"{n} node","other":"{n} nodes"},"arrange.new":"New","arrange.newGroup":"New group","arrange.newGroupNote":"Add at least one node or subscription after creating it; a group with no members holds every node, so it cannot be applied.","arrange.noMain":"The main configuration is not fully available, so it cannot be arranged Line truncated
@@ -1 +0,0 @@
const e=JSON.parse(`{"about.api":"API","about.close":"Close","about.contract":"Contract commit","about.credits":"Fonts Noto Sans TC/SC (OFL); icons Adobe Spectrum (Apache-2.0); palettes from Rosé Pine, Catppuccin, Nord, Kary Pro Colors, Ant Design, Arco Design and Semi Design.","about.duck":"Pet me","about.engine":"Engine","about.license":"License","about.privacy":"doona talks only to the backend you connect it to. It collects no data and sends nothing anywhere else.","about.quack":"Honk!","about.tagline":"Web UI for {engine}","about.title":"About doona","act.active":"Active connections","act.cgroup":"cgroup used","act.d7":"7 d","act.devices":"Devices","act.domains":"Domains","act.download":"Download","act.emptyHistory":"No history samples yet","act.global":"Global target","act.globalMissing":"Global mode needs a target group","act.good":"Good","act.h1":"1 h","act.h24":"24 h","act.h6":"6 h","act.historyRange":"History range","act.issues":"Notifications","act.latency":"Latency","act.limited":{"one":"{n} feature is off","other":"{n} features are off"},"act.live":"Live","act.m10":"10 min","act.memory":"Memory","act.memoryHigh":"High","act.memoryNearLimit":"Near limit","act.memoryOk":"Normal","act.mode":"Outbound mode","act.modeApplied":"Outbound mode written to the configuration and reloaded: {mode}","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.modeNoRouting":"The main configuration has no routing section","act.modeReadOnly":"Read-only","act.modeReadOnlyAction":"Make the main file writable by honk and keep native_api in its own include file.","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.modeUnavailable":"Not provided by this backend","act.modeWhyReadOnly":"Why is the mode read-only?","act.noConnections":"This backend does not provide connections","act.noHistory":"This backend does not provide history","act.noIssues":"No issues require attention","act.noOutbounds":"This backend does not provide outbound counters","act.node":"Node","act.noticeRepeat":{"one":"{n} time","other":"{n} times"},"act.outUsage":"Outbound downloads","act.rankingEmpty":"No connections to rank","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.readOnlyDocs":"Read-only sources","act.rss":"Resident memory","act.sampling":"Sampling","act.since":"Since {t}","act.topDevices":"Top traffic","act.traffic":"Traffic","act.truncated":"Truncated","act.unavailable":"Unavailable","act.unknown":"Unknown","act.upload":"Upload","act.viewAll":"View all","act.viewDetails":"View details","arrange.addSelected":"Add to group","arrange.applied":{"one":"Applied {n} change and reloaded.","other":"Applied {n} changes and reloaded."},"arrange.applyNote":"Applying validates the whole configuration first, then writes and reloads; nothing is written if validation fails.","arrange.badName":"Use only letters, digits, underscores, periods and hyphens.","arrange.byName":"Nodes added by name","arrange.byRule":"Selected by rules","arrange.bySubscription":"Whole subscriptions","arrange.change.addNode":"Add node {name} to {group}","arrange.change.addSubscription":"Add the whole subscription {name} to {group}","arrange.change.createGroup":"Create group {group}","arrange.change.removeNode":"Remove node {name} from {group}","arrange.change.removeSubscription":"Remove subscription {name} from {group}","arrange.clear":"Clear selection","arrange.create":"Create","arrange.discard":"Discard all","arrange.drag":"Drag {name}","arrange.dropHint":"Drop here to add","arrange.dropInto":"Drop into group {group}","arrange.editSource":"Change them in the configuration source","arrange.emptyNew":"Group {group} has no members yet; a group without members holds every node, so add a node or subscription first.","arrange.failed":"Could not apply: {error}","arrange.groupName":"Group name","arrange.groupNameHint":"Letters, digits, underscores, periods and hyphens only.","arrange.holdsAll":"This group has no filter, so it holds every node.","arrange.lastMember":"This is the group's last filter; removing it would make the group hold every node.","arrange.memberCount":{"one":"{n} node","other":"{n} nodes"},"arrange.new":"New","arrange.newGroup":"New group","arrange.newGroupNote":"Add at least one node or subscription after creating it; a group with no members holds every node, so it cannot be applied.","arrange.noMain":"The main configuration is not fully available, so it cannot be arranged here.","arrange.nodes":"Nodes","arrange.note":"Drag a node or subscription from the right onto a group to add it, or select rows and use Add to gro Line truncated
@@ -0,0 +1 @@
const e=JSON.parse('{"about.api":"API","about.contract":"契约提交","about.credits":"字体 Noto Sans TC/SC(OFL);图标 Adobe Spectrum(Apache-2.0);配色来自 Rosé Pine、Catppuccin、Nord、Kary Pro Colors、Ant Design、Arco Design 与 Semi Design。","about.duck":"摸摸我","about.engine":"引擎","about.license":"许可证","about.privacy":"doona 只与你连接的后端通信,不收集数据,也不发送到其他地方。","about.quack":"嘎!","about.tagline":"{engine} 的 Web 界面","about.title":"关于 doona","act.active":"活动连接","act.cgroup":"cgroup 已用","act.cpu":"CPU 使用率","act.cpuHelp":"进程占用单个 CPU 核心的百分比。超过 100% 表示使用了一个以上的核心。","act.d7":"7 天","act.devices":"设备","act.domains":"域名","act.download":"下载","act.emptyHistory":"暂无历史样本","act.global":"全局模式出站","act.globalMissing":"全局模式须指定出站","act.good":"良好","act.h1":"1 小时","act.h24":"24 小时","act.h6":"6 小时","act.historyRange":"历史范围","act.issues":"通知与问题","act.latency":"延迟","act.limited":"{n} 项功能未开启","act.live":"实时","act.m10":"10 分钟","act.memory":"内存","act.mode":"出站模式","act.modeApplied":"出站模式已写入配置并重载:{mode}","act.modeInterleaved":"routing 区段有普通规则排在 must 规则前面。请先把 must 规则移到 routing 区段最前面,再切换出站模式。","act.modeNoRouting":"主配置未包含 routing 区段","act.modeReadOnly":"只读","act.modeReadOnlyAction":"请确认 honk 对主配置文件有写入权限,并将 native_api 设置放在独立的 include 文件。","act.modeReadOnlyReason":"honk 须允许配置写入,且控制端已设置身份验证。主配置若含 native_api 或 clash_api 的密钥字段或嵌套区块,会标记为只读。配置含当前的监听密钥时也一样。","act.modeUnavailable":"此后端不提供","act.modeWhyReadOnly":"查看只读原因","act.noConnections":"此后端不提供连接","act.noHistory":"此后端不提供历史数据","act.noIssues":"当前没有需要处理的问题","act.noOutbounds":"此后端不提供出站统计","act.node":"节点","act.nodePickHelp":"选择节点只会更改此卡片显示的延迟,不会更改路由。","act.noticeRepeat":"重复 {n} 次","act.outUsage":"出站下载量","act.rankingEmpty":"当前没有可排行的连接","act.rankingScope":"按当前可见连接的下载量排序,占比以全部可见数据计算。","act.rankingTruncated":"连接列表已截断,排行仅涵盖已获取的数据。","act.readOnlyDocs":"只读的配置文件","act.rss":"常驻内存","act.sampling":"采样中","act.since":"自 {time} 起","act.topDevices":"流量排行","act.traffic":"流量","act.truncated":"已截断","act.unavailable":"不可用","act.unknown":"未知","act.upload":"上传","act.viewAll":"查看全部","act.viewDetails":"查看详情","arrange.addSelected":"加入组","arrange.applied":"已应用 {n} 项更改并重载。","arrange.applyNote":"应用时会先校验整份配置,写入后重载;校验失败时不会写入。","arrange.badName":"名称只能使用英文字母、数字、下划线、句点和连字符。","arrange.byName":"按名称加入的节点","arrange.byRule":"由规则选入","arrange.bySubscription":"整个订阅","arrange.change.addNode":"将节点 {name} 加入 {group}","arrange.change.addSubscription":"将订阅 {name} 整个加入 {group}","arrange.change.createGroup":"创建组 {group}","arrange.change.removeNode":"从 {group} 移除节点 {name}","arrange.change.removeSubscription":"从 {group} 移除订阅 {name}","arrange.clear":"清除选择","arrange.create":"创建","arrange.discard":"全部放弃","arrange.drag":"拖动 {name}","arrange.dropHint":"拖动至此加入","arrange.dropInto":"拖放到组 {group}","arrange.editSource":"在配置来源中修改","arrange.emptyNew":"组 {group} 尚无成员;没有成员的组会包含所有节点,请先加入节点或订阅。","arrange.failed":"无法应用:{error}","arrange.groupName":"组名称","arrange.groupNameHint":"只能使用英文字母、数字、下划线、句点和连字符。","arrange.holdsAll":"此组没有任何筛选条件,因此包含所有节点。","arrange.lastMember":"此为组的最后一个条件;移除后组会包含所有节点。","arrange.memberCount":"{n} 个节点","arrange.new":"新建","arrange.newGroup":"新建组","arrange.newGroupNote":"创建后请加入至少一个节点或订阅;没有成员的组会包含所有节点,因此无法应用。","arrange.noMain":"主配置的内容未完整提供,无法在此编排。","arrange.nodes":"节点","arrange.note":"将右侧的节点或订阅拖动至组即可加入,也可勾选后使用下方的“加入组”。更改会先暂存,点击“检查并应用”后一次写入。","arrange.pending":"{n} 项更改尚未应用","arrange.penLine truncated
@@ -1 +0,0 @@
const e=JSON.parse('{"about.api":"API","about.close":"关闭","about.contract":"契约提交","about.credits":"字体 Noto Sans TC/SC(OFL);图标 Adobe Spectrum(Apache-2.0);配色来自 Rosé Pine、Catppuccin、Nord、Kary Pro Colors、Ant Design、Arco Design 与 Semi Design。","about.duck":"摸摸我","about.engine":"引擎","about.license":"许可证","about.privacy":"doona 只与你连接的后端通信,不收集数据,也不发送到其他地方。","about.quack":"嘎!","about.tagline":"{engine} 的 Web 界面","about.title":"关于 doona","act.active":"活动连接","act.cgroup":"cgroup 已用","act.d7":"7 天","act.devices":"设备","act.domains":"域名","act.download":"下载","act.emptyHistory":"暂无历史样本","act.global":"全局目标","act.globalMissing":"全局模式须指定目标组","act.good":"良好","act.h1":"1 小时","act.h24":"24 小时","act.h6":"6 小时","act.historyRange":"历史范围","act.issues":"通知与问题","act.latency":"延迟","act.limited":"{n} 项功能未开启","act.live":"实时","act.m10":"10 分钟","act.memory":"内存","act.memoryHigh":"偏高","act.memoryNearLimit":"接近上限","act.memoryOk":"正常","act.mode":"出站模式","act.modeApplied":"出站模式已写入配置并重载:{mode}","act.modeInterleaved":"路由区段有普通规则排在 must 规则前面。请先把 must 规则移到路由区段最前面,再切换出站模式。","act.modeNoRouting":"主配置未包含 routing 区段","act.modeReadOnly":"只读","act.modeReadOnlyAction":"请确认 honk 对主配置文件有写入权限,并将 native_api 设置放在独立的 include 文件。","act.modeReadOnlyReason":"honk 须允许配置写入,且控制端已设置身份验证。主配置若含 native_api 或 clash_api 的密钥字段或嵌套区块,会标记为只读。配置含当前的监听密钥时也一样。","act.modeUnavailable":"此后端不提供","act.modeWhyReadOnly":"查看只读原因","act.noConnections":"此后端不提供连接","act.noHistory":"此后端不提供历史数据","act.noIssues":"当前没有需要处理的问题","act.noOutbounds":"此后端不提供出站统计","act.node":"节点","act.noticeRepeat":"重复 {n} 次","act.outUsage":"出站下载量","act.rankingEmpty":"当前没有可排行的连接","act.rankingScope":"按当前可见连接的下载量排序,占比以全部可见数据计算。","act.rankingTruncated":"连接列表已截断,排行仅涵盖已获取的数据。","act.readOnlyDocs":"只读的配置文件","act.rss":"常驻内存","act.sampling":"采样中","act.since":"自 {t} 起","act.topDevices":"流量排行","act.traffic":"流量","act.truncated":"已截断","act.unavailable":"不可用","act.unknown":"未知","act.upload":"上传","act.viewAll":"查看全部","act.viewDetails":"查看详情","arrange.addSelected":"加入组","arrange.applied":"已应用 {n} 项更改并重载。","arrange.applyNote":"应用时会先校验整份配置,写入后重载;校验失败时不会写入。","arrange.badName":"名称只能使用英文字母、数字、下划线、句点和连字符。","arrange.byName":"按名称加入的节点","arrange.byRule":"由规则选入","arrange.bySubscription":"整个订阅","arrange.change.addNode":"将节点 {name} 加入 {group}","arrange.change.addSubscription":"将订阅 {name} 整个加入 {group}","arrange.change.createGroup":"创建组 {group}","arrange.change.removeNode":"从 {group} 移除节点 {name}","arrange.change.removeSubscription":"从 {group} 移除订阅 {name}","arrange.clear":"清除选择","arrange.create":"创建","arrange.discard":"全部放弃","arrange.drag":"拖动 {name}","arrange.dropHint":"拖动至此加入","arrange.dropInto":"拖放到组 {group}","arrange.editSource":"在配置来源中修改","arrange.emptyNew":"组 {group} 尚无成员;没有成员的组会包含所有节点,请先加入节点或订阅。","arrange.failed":"无法应用:{error}","arrange.groupName":"组名称","arrange.groupNameHint":"只能使用英文字母、数字、下划线、句点和连字符。","arrange.holdsAll":"此组没有任何筛选条件,因此包含所有节点。","arrange.lastMember":"此为组的最后一个条件;移除后组会包含所有节点。","arrange.memberCount":"{n} 个节点","arrange.new":"新建","arrange.newGroup":"新建组","arrange.newGroupNote":"创建后请加入至少一个节点或订阅;没有成员的组会包含所有节点,因此无法应用。","arrange.noMain":"主配置的内容未完整提供,无法在此编排。","arrange.nodes":"节点","arrange.note":"将右侧的节点或订阅拖动至组即可加入,也可勾选后使用下方的“加入组”。更改会先暂存,点击“检查并应用”后一次写入。","arrange.pending":"{n} 项更改尚未应用","arrange.pendingRegion":"待应用的更改","arrange.policy":"选择方式","arrange.policy.fallback":"按顺序备用","arrange.policy.fallbackLine truncated
@@ -1 +0,0 @@
const e=JSON.parse('{"about.api":"API","about.close":"關閉","about.contract":"契約提交","about.credits":"字型 Noto Sans TC/SC(OFL);圖示 Adobe Spectrum(Apache-2.0);配色來自 Rosé Pine、Catppuccin、Nord、Kary Pro Colors、Ant Design、Arco Design 與 Semi Design。","about.duck":"摸摸我","about.engine":"引擎","about.license":"授權","about.privacy":"doona 只與你連線的後端通訊,不收集資料,也不傳送到其他地方。","about.quack":"嘎!","about.tagline":"{engine} 的 Web 介面","about.title":"關於 doona","act.active":"活動連線","act.cgroup":"cgroup 已用","act.d7":"7 天","act.devices":"裝置","act.domains":"網域","act.download":"下載","act.emptyHistory":"尚無歷史樣本","act.global":"全域目標","act.globalMissing":"全域模式須指定目標群組","act.good":"良好","act.h1":"1 小時","act.h24":"24 小時","act.h6":"6 小時","act.historyRange":"歷史範圍","act.issues":"通知與問題","act.latency":"延遲","act.limited":"{n} 項功能未開啟","act.live":"即時","act.m10":"10 分鐘","act.memory":"記憶體","act.memoryHigh":"偏高","act.memoryNearLimit":"接近上限","act.memoryOk":"正常","act.mode":"出站模式","act.modeApplied":"出站模式已寫入組態並重載:{mode}","act.modeInterleaved":"路由區段有一般規則排在 must 規則前面。請先把 must 規則移到路由區段最前面,再切換出站模式。","act.modeNoRouting":"主組態未包含 routing 區段","act.modeReadOnly":"唯讀","act.modeReadOnlyAction":"請確認 honk 對主組態檔案有寫入權限,並將 native_api 設定放在獨立的 include 檔案。","act.modeReadOnlyReason":"honk 須允許組態寫入,且控制端已設定驗證。主組態若含 native_api 或 clash_api 的密鑰欄位或巢狀區塊,會標記為唯讀。組態含目前的監聽密鑰時也一樣。","act.modeUnavailable":"此後端不提供","act.modeWhyReadOnly":"查看唯讀原因","act.noConnections":"此後端不提供連線","act.noHistory":"此後端不提供歷史資料","act.noIssues":"目前沒有需要處理的問題","act.noOutbounds":"此後端不提供出站統計","act.node":"節點","act.noticeRepeat":"重複 {n} 次","act.outUsage":"出站下載量","act.rankingEmpty":"目前沒有可排行的連線","act.rankingScope":"依目前可見連線的下載量排序,佔比以全部可見資料計算。","act.rankingTruncated":"連線清單已截斷,排行僅涵蓋已取得的資料。","act.readOnlyDocs":"唯讀的組態檔案","act.rss":"常駐記憶體","act.sampling":"取樣中","act.since":"自 {t} 起","act.topDevices":"流量排行","act.traffic":"流量","act.truncated":"已截斷","act.unavailable":"無法使用","act.unknown":"未知","act.upload":"上傳","act.viewAll":"查看全部","act.viewDetails":"查看詳情","arrange.addSelected":"加入群組","arrange.applied":"已套用 {n} 項變更並重載。","arrange.applyNote":"套用時會先驗證整份組態,寫入後重載;驗證失敗時不會寫入。","arrange.badName":"名稱只能使用英文字母、數字、底線、句點與連字號。","arrange.byName":"依名稱加入的節點","arrange.byRule":"由規則選入","arrange.bySubscription":"整個訂閱","arrange.change.addNode":"將節點 {name} 加入 {group}","arrange.change.addSubscription":"將訂閱 {name} 整個加入 {group}","arrange.change.createGroup":"建立群組 {group}","arrange.change.removeNode":"從 {group} 移除節點 {name}","arrange.change.removeSubscription":"從 {group} 移除訂閱 {name}","arrange.clear":"清除選取","arrange.create":"建立","arrange.discard":"全部捨棄","arrange.drag":"拖曳 {name}","arrange.dropHint":"拖曳至此加入","arrange.dropInto":"拖放到群組 {group}","arrange.editSource":"在組態來源中修改","arrange.emptyNew":"群組 {group} 尚無成員;沒有成員的群組會包含所有節點,請先加入節點或訂閱。","arrange.failed":"無法套用:{error}","arrange.groupName":"群組名稱","arrange.groupNameHint":"只能使用英文字母、數字、底線、句點與連字號。","arrange.holdsAll":"此群組沒有任何篩選條件,因此包含所有節點。","arrange.lastMember":"此為群組的最後一個條件;移除後群組會包含所有節點。","arrange.memberCount":"{n} 個節點","arrange.new":"新增","arrange.newGroup":"新增群組","arrange.newGroupNote":"建立後請加入至少一個節點或訂閱;沒有成員的群組會包含所有節點,因此無法套用。","arrange.noMain":"主組態的內容未完整提供,無法在此編排。","arrange.nodes":"節點","arrange.note":"將右側的節點或訂閱拖曳至群組即可加入,亦可勾選後使用下方的「加入群組」。變更會先暫存,按「檢查並套用」後一次寫入。","arrange.pending":"{n} 項變更尚未套用","arrange.pendingRegion":"待套用的變更","arrange.policy":"選擇方式","arrange.policy.fallback":"依序Line truncated
@@ -0,0 +1 @@
const e=JSON.parse('{"about.api":"API","about.contract":"契約提交","about.credits":"字型 Noto Sans TC/SC(OFL);圖示 Adobe Spectrum(Apache-2.0);配色來自 Rosé Pine、Catppuccin、Nord、Kary Pro Colors、Ant Design、Arco Design 與 Semi Design。","about.duck":"摸摸我","about.engine":"引擎","about.license":"授權","about.privacy":"doona 只與你連線的後端通訊,不收集資料,也不傳送到其他地方。","about.quack":"嘎!","about.tagline":"{engine} 的 Web 介面","about.title":"關於 doona","act.active":"活動連線","act.cgroup":"cgroup 已用","act.cpu":"CPU 使用率","act.cpuHelp":"行程佔用單一 CPU 核心的百分比。超過 100% 表示使用了一個以上的核心。","act.d7":"7 天","act.devices":"裝置","act.domains":"網域","act.download":"下載","act.emptyHistory":"尚無歷史樣本","act.global":"全域模式出站","act.globalMissing":"全域模式須指定出站","act.good":"良好","act.h1":"1 小時","act.h24":"24 小時","act.h6":"6 小時","act.historyRange":"歷史範圍","act.issues":"通知與問題","act.latency":"延遲","act.limited":"{n} 項功能未開啟","act.live":"即時","act.m10":"10 分鐘","act.memory":"記憶體","act.mode":"出站模式","act.modeApplied":"出站模式已寫入組態並重載:{mode}","act.modeInterleaved":"routing 區段有一般規則排在 must 規則前面。請先把 must 規則移到 routing 區段最前面,再切換出站模式。","act.modeNoRouting":"主組態未包含 routing 區段","act.modeReadOnly":"唯讀","act.modeReadOnlyAction":"請確認 honk 對主組態檔案有寫入權限,並將 native_api 設定放在獨立的 include 檔案。","act.modeReadOnlyReason":"honk 須允許組態寫入,且控制端已設定驗證。主組態若含 native_api 或 clash_api 的密鑰欄位或巢狀區塊,會標記為唯讀。組態含目前的監聽密鑰時也一樣。","act.modeUnavailable":"此後端不提供","act.modeWhyReadOnly":"檢視唯讀原因","act.noConnections":"此後端不提供連線","act.noHistory":"此後端不提供歷史資料","act.noIssues":"目前沒有需要處理的問題","act.noOutbounds":"此後端不提供出站統計","act.node":"節點","act.nodePickHelp":"選取節點只會變更此卡片顯示的延遲,不會變更路由。","act.noticeRepeat":"重複 {n} 次","act.outUsage":"出站下載量","act.rankingEmpty":"目前沒有可排行的連線","act.rankingScope":"依目前可見連線的下載量排序,佔比以全部可見資料計算。","act.rankingTruncated":"連線清單已截斷,排行僅涵蓋已取得的資料。","act.readOnlyDocs":"唯讀的組態檔案","act.rss":"常駐記憶體","act.sampling":"取樣中","act.since":"自 {time} 起","act.topDevices":"流量排行","act.traffic":"流量","act.truncated":"已截斷","act.unavailable":"無法使用","act.unknown":"未知","act.upload":"上傳","act.viewAll":"檢視全部","act.viewDetails":"檢視詳情","arrange.addSelected":"加入群組","arrange.applied":"已套用 {n} 項變更並重載。","arrange.applyNote":"套用時會先驗證整份組態,寫入後重載;驗證失敗時不會寫入。","arrange.badName":"名稱只能使用英文字母、數字、底線、句點與連字號。","arrange.byName":"依名稱加入的節點","arrange.byRule":"由規則選入","arrange.bySubscription":"整個訂閱","arrange.change.addNode":"將節點 {name} 加入 {group}","arrange.change.addSubscription":"將訂閱 {name} 整個加入 {group}","arrange.change.createGroup":"建立群組 {group}","arrange.change.removeNode":"從 {group} 移除節點 {name}","arrange.change.removeSubscription":"從 {group} 移除訂閱 {name}","arrange.clear":"清除選取","arrange.create":"建立","arrange.discard":"全部捨棄","arrange.drag":"拖曳 {name}","arrange.dropHint":"拖曳至此加入","arrange.dropInto":"拖放到群組 {group}","arrange.editSource":"在組態來源中修改","arrange.emptyNew":"群組 {group} 尚無成員;沒有成員的群組會包含所有節點,請先加入節點或訂閱。","arrange.failed":"無法套用:{error}","arrange.groupName":"群組名稱","arrange.groupNameHint":"只能使用英文字母、數字、底線、句點與連字號。","arrange.holdsAll":"此群組沒有任何篩選條件,因此包含所有節點。","arrange.lastMember":"此為群組的最後一個條件;移除後群組會包含所有節點。","arrange.memberCount":"{n} 個節點","arrange.new":"新增","arrange.newGroup":"新增群組","arrange.newGroupNote":"建立後請加入至少一個節點或訂閱;沒有成員的群組會包含所有節點,因此無法套用。","arrange.noMain":"主組態的內容未完整提供,無法在此編排。","arrange.nodes":"節點","arrange.note":"將右側的節點或訂閱拖曳至群組即可加入,亦可勾選後使用下方的「加入群組」。變更會先暫存,按「檢查並套用」後一次寫入。","arrange.pending":"{n} 項Line truncated
@@ -0,0 +1 @@
function e(){return[{id:"groups",titleKey:"policy.tab.groups"},{id:"arrange",titleKey:"policy.tab.arrange"}]}export{e as p};
@@ -0,0 +1 @@
function n(i,e){return!!e&&i?.config.writable===!0&&e.writable}function t(i){return[{id:"modules",titleKey:"config.tabModules"},...i?[{id:"setup",titleKey:"config.wizard"}]:[],{id:"source",titleKey:"config.tabSource"},{id:"validate",titleKey:"config.tabValidate"}]}const c={main:"config.kind.main",include:"config.kind.include",subscription:"config.kind.subscription",generated:"config.kind.generated"};export{c as a,t as c,n as s};
@@ -1 +0,0 @@
function n(i,e){return!!e&&i?.config.writable===!0&&e.writable&&e.content!==void 0}function t(i){return[{id:"modules",titleKey:"config.tabModules"},...i?[{id:"setup",titleKey:"config.wizard"}]:[],{id:"source",titleKey:"config.tabSource"},{id:"validate",titleKey:"config.tabValidate"}]}const o={main:"config.kind.main",include:"config.kind.include",subscription:"config.kind.subscription",generated:"config.kind.generated"};export{o as a,t as c,n as s};
@@ -0,0 +1 @@
import{ac as r}from"./index-Bw0aJc9a.js";function t(e){return r(e,"flows",{whileLoading:!0})?[{id:"map",titleKey:"flow.tab.map"},{id:"records",titleKey:"flow.tab.records"}]:[]}export{t as f};
@@ -1 +1 @@
import{aa as e}from"./index-BNBwb-FJ.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_cache",{whileLoading:!0})?[{id:"cache",titleKey:"ui.cache"}]:[],...e(t,"dns_query",{whileLoading:!0})?[{id:"query",titleKey:"dns.query"}]:[]]}export{d}; import{ac as e}from"./index-Bw0aJc9a.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_cache",{whileLoading:!0})?[{id:"cache",titleKey:"ui.cache"}]:[],...e(t,"dns_query",{whileLoading:!0})?[{id:"query",titleKey:"dns.query"}]:[]]}export{d};
@@ -1 +0,0 @@
import{aa as l}from"./index-BNBwb-FJ.js";function r(e){const t=l(e,"flows",{whileLoading:!0}),i=l(e,"rules",{whileLoading:!1});return[...t||i?[{id:"list",titleKey:"rule.listTitle"}]:[],...l(e,"dns_rules",{whileLoading:!1})?[{id:"dns",titleKey:"rule.dnsTitle"}]:[],...t?[{id:"map",titleKey:"rule.map"}]:[],...t?[{id:"flows",titleKey:"rule.flows"}]:[],...l(e,"routing_trace",{whileLoading:!0})?[{id:"trace",titleKey:"rule.trace"}]:[]]}export{r};
@@ -0,0 +1 @@
import{ac as t}from"./index-Bw0aJc9a.js";function i(e){return t(e,"nodes",{whileLoading:!0})?[{id:"list",titleKey:"nodes.tab.list"},{id:"latency",titleKey:"nodes.tab.latency"}]:[]}export{i as n};
@@ -0,0 +1 @@
function t(){return[{id:"traffic",titleKey:"conn.tab.traffic"},{id:"list",titleKey:"conn.tab.list"}]}export{t as c};
@@ -0,0 +1 @@
import{ac as l}from"./index-Bw0aJc9a.js";function a(e){const t=l(e,"flows",{whileLoading:!0}),i=l(e,"rules",{whileLoading:!1});return[...t||i?[{id:"list",titleKey:"rule.listTitle"}]:[],...l(e,"dns_rules",{whileLoading:!1})?[{id:"dns",titleKey:"rule.dnsTitle"}]:[],...l(e,"routing_trace",{whileLoading:!0})?[{id:"trace",titleKey:"rule.trace"}]:[]]}export{a as r};
@@ -0,0 +1 @@
import{j as c}from"./vendor-react-Bf71BWbF.js";import{u as p,bt as a,bG as l,d$ as n}from"./index-Bw0aJc9a.js";import{c as u}from"./policyText-CltaDVEo.js";function d({value:e,onChange:o,isDisabled:s}){const i=p(),{selected:t,items:r}=u(e,i);return c.jsx(a,{label:i("arrange.policy"),value:t,onChange:o,items:r,isDisabled:s})}function x(e,o){l().groups().then(s=>e("policies",n(s,o)),()=>e("policies"))}export{d as P,x as o};
@@ -0,0 +1 @@
import{r as t}from"./vendor-react-Bf71BWbF.js";import{aa as d,ae as u,ac as r,ad as n}from"./index-Bw0aJc9a.js";function m(){const s=d().data?.resources,e=u(r(s,"groups",{whileLoading:!1})),o=n(r(s,"nodes",{whileLoading:!1}));return t.useMemo(()=>new Map([...(e.data??[]).map(a=>[a.id,a.name]),...(o.data??[]).map(a=>[a.id,a.name])]),[e.data,o.data])}export{m as u};
@@ -1 +0,0 @@
import{r as t}from"./vendor-react-Bf71BWbF.js";import{a8 as u,ac as d,aa as r,ab as n}from"./index-BNBwb-FJ.js";function m(){const s=u().data?.resources,e=d(r(s,"groups",{whileLoading:!1})),o=n(r(s,"nodes",{whileLoading:!1}));return t.useMemo(()=>new Map([...(e.data??[]).map(a=>[a.id,a.name]),...(o.data??[]).map(a=>[a.id,a.name])]),[e.data,o.data])}export{m as u};
@@ -1 +1 @@
import{dF as c,de as o,a3 as l,dG as m,cT as t}from"./index-BNBwb-FJ.js";const r="select";function u(e,s){const a=o.find(n=>n.id===(e??r));return a?s(a.label):e}function p(e,s){const a=o.some(d=>d.id===(e.native??r)),n=e.native&&a?u(e.native,s):l(m,e.kind,s),i=e.native||e.kind;return n===i?{label:n}:{label:n,id:i}}function g(e,s){const a=o.map(n=>({id:n.id,label:s(n.label),desc:s(n.description)}));return{selected:e??r,items:e&&!a.some(n=>n.id===e)?[{id:e,label:e},...a]:a}}const b={invalid:"arrange.badName",taken:"arrange.takenName"};function k(e,s,a){const n=c(e,s);return n?a(b[n]):null}function P(e,s,a){return e.every(n=>a?.filters.includes(n)||t(n))&&(s===(a?.policy??null)||t(s??""))}export{P as a,k as b,g as c,p as g,u as p}; import{en as c,dT as o,a4 as l,eo as m,da as t}from"./index-Bw0aJc9a.js";const r="select";function u(e,s){const a=o.find(n=>n.id===(e??r));return a?s(a.label):e}function p(e,s){const a=o.some(d=>d.id===(e.native??r)),n=e.native&&a?u(e.native,s):l(m,e.kind,s),i=e.native||e.kind;return n===i?{label:n}:{label:n,id:i}}function g(e,s){const a=o.map(n=>({id:n.id,label:s(n.label),desc:s(n.description)}));return{selected:e??r,items:e&&!a.some(n=>n.id===e)?[{id:e,label:e},...a]:a}}const b={invalid:"arrange.badName",taken:"arrange.takenName"};function k(e,s,a){const n=c(e,s);return n?a(b[n]):null}function P(e,s,a){return e.every(n=>a?.filters.includes(n)||t(n))&&(s===(a?.policy??null)||t(s??""))}export{P as a,k as b,g as c,p as g,u as p};
@@ -1 +0,0 @@
import{dj as d}from"./index-BNBwb-FJ.js";function p(i,l,n,r){const t=i.results.filter(e=>e.member_id===l),o=t.find(e=>e.state==="healthy"&&e.latency_ms!=null);if(o)return{kind:"positive",text:r("nodes.probed",{name:n,n:d(o.latency_ms)})};if(t.length&&t.every(e=>e.state==="unavailable"))return{kind:"negative",text:r("nodes.probeFailed",{name:n})};const s=t.find(e=>e.error)?.error;return{kind:"neutral",text:s?r("nodes.probeUnknownWhy",{name:n,error:s}):r("nodes.probeUnknown",{name:n})}}export{p};
@@ -0,0 +1 @@
import{e0 as d,e1 as l,e2 as p,e3 as b}from"./index-Bw0aJc9a.js";function c(i,a,r,e){const t=i.results.filter(n=>n.member_id===a),o=d(t);if(o?.state==="healthy"&&o.latency_ms!=null)return{kind:"positive",text:e("nodes.probed",{name:r,n:l(o.latency_ms)})};if(o?.state==="unavailable")return{kind:"negative",text:e("nodes.probeFailed",{name:r})};const s=t.find(n=>n.error&&p(n.error))?.error;return{kind:"neutral",text:s?e("nodes.probeUnknownWhy",{name:r,error:b(s,e)}):e("nodes.probeUnknown",{name:r})}}export{c as p};
@@ -1 +1 @@
import{r as f,j as s}from"./vendor-react-Bf71BWbF.js";import{u as E,aP as R,aQ as L}from"./index-BNBwb-FJ.js";import{u as Q,l as S,b as W,c as _,d as M,C as q}from"./layout-wfdMYi2n.js";const o=12;function G({label:y,points:c,marks:d=[],rows:m=[],fmt:h,maxHeight:a=160}){const r=E(),P=R(),[T,l]=L(),{ref:k,tip:C,show:g,hide:A}=Q(),x=f.useMemo(()=>S(c.map(e=>e.value)),[c]),B=f.useMemo(()=>{const e=W(x,l&&l<480?4:8);return l!==null&&l<360?e.filter((t,n)=>n%2===0):e},[x,l]),u=Math.max((l??0)-o*2,1),i=e=>o+M(e,x)*u,p=c.length>400?2:c.length>120?3:4,{ys:j,hidden:D}=f.useMemo(()=>l?_(c.map(e=>o+M(e.value,x)*u),p,(a-36)/2):{ys:[],hidden:[]},[c,x,u,p,a,l]),N=Math.max(24,2*(Math.max(0,...j.map(e=>Math.abs(e??0)))+p+2)),v=N+36;return s.jsx("div",{className:"rp-swarm",ref:T,children:s.jsxs("div",{className:"rp-chart-hover",ref:k,onPointerLeave:A,children:[l!==null&&s.jsxs("svg",{width:l,height:v,role:"img","aria-label":y,"aria-describedby":P,children:[B.map(e=>{const t=i(e)>=l-o-1;return s.jsxs("g",{children:[s.jsx("line",{className:"grid",x1:i(e),x2:i(e),y1:16,y2:v-18}),s.jsx("text",{className:"tick",x:t?l:i(e),y:v-4,textAnchor:t?"end":"middle",children:h(e)})]},e)}),c.map((e,t)=>j[t]===null||j[t]===void 0?null:s.jsx("circle",{cx:i(e.value),cy:16+N/2+j[t],r:p,fill:e.color,onPointerMove:n=>g(n,e.lines)},e.id)),D.map(e=>s.jsxs("text",{className:"more",x:e.x,y:12,textAnchor:"middle",children:["+",e.count]},e.x)),d.map((e,t)=>{const n=i(e.value),b=n<96||t%2===1&&n<l-120;return s.jsxs("g",{className:"mark",children:[s.jsx("line",{x1:n,x2:n,y1:14,y2:v-18}),l>=360&&s.jsx("text",{x:n,y:10,textAnchor:b?"start":"end",dx:b?4:-4,children:e.label})]},e.label)})]}),l!==null&&m.length>0&&s.jsx("div",{className:"rp-strips",children:m.map(e=>s.jsxs("div",{className:"rp-strip-row",children:[s.jsxs("div",{className:"rp-row",children:[s.jsx("span",{className:"name",children:e.label}),s.jsx("span",{className:"rp-note",children:e.detail})]}),s.jsxs("svg",{width:l,height:20,role:"img","aria-label":r("ui.valuePair",{label:e.label,value:e.detail}),children:[s.jsx("line",{className:"grid",x1:o,x2:o+u,y1:10,y2:10}),e.points.map(t=>s.jsx("circle",{cx:i(t.value),cy:10,r:4,fill:t.color,onPointerMove:n=>g(n,t.lines)},t.id)),e.mark!==void 0&&s.jsx("line",{className:"median",x1:i(e.mark),x2:i(e.mark),y1:-2,y2:22})]})]},e.id))}),s.jsx(q,{tip:C})]})})}function I(y,c){const d=new Map;for(const a of y)d.set(a,(d.get(a)??0)+1);const m=(a,r)=>a===r?0:a===null?1:r===null||a<r?-1:1,h=[...d].map(([a,r])=>({key:a,count:r})).sort((a,r)=>r.count-a.count||m(a.key,r.key));return{top:h.slice(0,c),rest:h.slice(c).reduce((a,r)=>a+r.count,0)}}export{G as B,I as r}; import{r as f,j as s}from"./vendor-react-Bf71BWbF.js";import{u as E,aT as R,aU as L}from"./index-Bw0aJc9a.js";import{u as S,l as U,b as W,c as _,d as M,C as q}from"./layout-BWzq8YqC.js";const o=12;function G({label:y,points:c,marks:d=[],rows:m=[],fmt:h,maxHeight:a=160}){const r=E(),T=R(),[k,l]=L(),{ref:C,tip:P,show:g,hide:A}=S(),x=f.useMemo(()=>U(c.map(e=>e.value)),[c]),B=f.useMemo(()=>{const e=W(x,l&&l<480?4:8);return l!==null&&l<360?e.filter((t,n)=>n%2===0):e},[x,l]),u=Math.max((l??0)-o*2,1),i=e=>o+M(e,x)*u,p=c.length>400?2:c.length>120?3:4,{ys:j,hidden:D}=f.useMemo(()=>l?_(c.map(e=>o+M(e.value,x)*u),p,(a-36)/2):{ys:[],hidden:[]},[c,x,u,p,a,l]),N=Math.max(24,2*(Math.max(0,...j.map(e=>Math.abs(e??0)))+p+2)),v=N+36;return s.jsx("div",{className:"rp-swarm",ref:k,children:s.jsxs("div",{className:"rp-chart-hover",ref:C,onPointerLeave:A,children:[l!==null&&s.jsxs("svg",{width:l,height:v,role:"img","aria-label":y,"aria-describedby":T,children:[B.map(e=>{const t=i(e)>=l-o-1;return s.jsxs("g",{children:[s.jsx("line",{className:"grid",x1:i(e),x2:i(e),y1:16,y2:v-18}),s.jsx("text",{className:"tick",x:t?l:i(e),y:v-4,textAnchor:t?"end":"middle",children:h(e)})]},e)}),c.map((e,t)=>j[t]===null||j[t]===void 0?null:s.jsx("circle",{cx:i(e.value),cy:16+N/2+j[t],r:p,fill:e.color,onPointerMove:n=>g(n,e.lines)},e.id)),D.map(e=>s.jsxs("text",{className:"more",x:e.x,y:12,textAnchor:"middle",children:["+",e.count]},e.x)),d.map((e,t)=>{const n=i(e.value),b=n<96||t%2===1&&n<l-120;return s.jsxs("g",{className:"mark",children:[s.jsx("line",{x1:n,x2:n,y1:14,y2:v-18}),l>=360&&s.jsx("text",{x:n,y:10,textAnchor:b?"start":"end",dx:b?4:-4,children:e.label})]},e.label)})]}),l!==null&&m.length>0&&s.jsx("div",{className:"rp-strips",children:m.map(e=>s.jsxs("div",{className:"rp-strip-row",children:[s.jsxs("div",{className:"rp-row",children:[s.jsx("span",{className:"name",children:e.label}),s.jsx("span",{className:"rp-note",children:e.detail})]}),s.jsxs("svg",{width:l,height:20,role:"img","aria-label":r("ui.valuePair",{label:e.label,value:e.detail}),children:[s.jsx("line",{className:"grid",x1:o,x2:o+u,y1:10,y2:10}),e.points.map(t=>s.jsx("circle",{cx:i(t.value),cy:10,r:4,fill:t.color,onPointerMove:n=>g(n,t.lines)},t.id)),e.mark!==void 0&&s.jsx("line",{className:"median",x1:i(e.mark),x2:i(e.mark),y1:-2,y2:22})]})]},e.id))}),s.jsx(q,{tip:P})]})})}function I(y,c){const d=new Map;for(const a of y)d.set(a,(d.get(a)??0)+1);const m=(a,r)=>a===r?0:a===null?1:r===null||a<r?-1:1,h=[...d].map(([a,r])=>({key:a,count:r})).sort((a,r)=>r.count-a.count||m(a.key,r.key));return{top:h.slice(0,c),rest:h.slice(c).reduce((a,r)=>a+r.count,0)}}export{G as B,I as r};
@@ -1,11 +1,11 @@
import{R as h,y as q,dE as F,K as I,O as P,z as L,q as z,U as J}from"./index-BNBwb-FJ.js";const T="standard",y=["# dae presets: the local network manager, the LAN and multicast stay off the proxy","pname(NetworkManager) -> direct","dip(224.0.0.0/3, 'ff00::/8') -> direct","dip(geoip:private) -> direct","# Block UDP/443","l4proto(udp) && dport(443) -> block"],k=["# BanAD, BanProgramAD","domain(geosite:category-ads-all) -> block"],w=["# GoogleCN, SteamCN","domain(geosite:google-cn, geosite:category-games@cn) -> direct"],$=["# ChinaDomain, ChinaCompanyIp, GEOIP CN","domain(geosite:cn) -> direct","dip(geoip:cn) -> direct"],v=e=>["# Telegram",`domain(geosite:telegram) -> ${e}`,`dip(geoip:telegram) -> ${e}`],_=e=>["# ProxyMedia",`domain(geosite:youtube, geosite:netflix, geosite:disney, geosite:hbo, geosite:primevideo, geosite:twitch, geosite:spotify) -> ${e}`],S=e=>["# ProxyGFWlist",`domain(geosite:gfw) -> ${e}`],K="filter: !name('direct', 'block')",B=(e,o,n,t=n[0])=>({name:e,label:o,lines:[`filter: group(${n.map(h).join(", ")})`,K,"policy: select",`default: ${h(t)}`]}),R=(e,o,n)=>({name:e,label:o,lines:[`filter: name(regex: ${h(n)})`,"policy: min_moving_avg"]}),r={proxy:"节点选择",auto:"自动选择",hk:["香港节点","港|HK|Hong Kong|HongKong"],jp:["日本节点","日|JP|Japan|Tokyo"],us:["美国节点","美|US|United States|America"],tw:["台湾节点","台|TW|Taiwan"],sg:["狮城节点","新加坡|獅城|狮城|SG|Singapore"],kr:["韩国节点","韓|韩|KR|Korea"],telegram:"电报消息",media:"国外媒体",apple:"苹果服务",ai:"Ai平台",youtube:"油管视频",netflix:"奈飞视频",bahamut:"巴哈姆特"},C=B("proxy",r.proxy,["auto"]),N={name:"auto",label:r.auto,lines:[K,"policy: min_moving_avg"]},b=["hk","jp","us","tw","sg","kr"].map(e=>R(e,r[e][0],r[e][1])),f=(e,o,n=["proxy","auto"],t)=>B(e,o,n,t),j={global:{rules:[...y],fallback:"{group}",groups:[]},bypass:{rules:[...y,...k,...w,...$],fallback:"{group}",groups:[]},gfw:{rules:[...y,...k,...v("{group}"),...S("{group}")],fallback:"direct",groups:[]},mini:{rules:[...y,...k,...w,...v("proxy"),..._("proxy"),...S("proxy"),...$],fallback:"proxy",groups:[C,N]},standard:{rules:[...y,...k,...w,"# Microsoft","domain(geosite:microsoft) -> direct","# Apple","domain(geosite:apple) -> apple",...v("telegram"),..._("media"),...S("proxy"),...$],fallback:"proxy",groups:[C,N,f("telegram",r.telegram),f("media",r.media),f("apple",r.apple)]},full:{rules:[...y,...k,...w,"# Bing, OneDrive, Microsoft","domain(geosite:microsoft) -> direct","# Apple","domain(geosite:apple) -> direct",...v("telegram"),"# AI, OpenAi","domain(geosite:openai) -> ai","# NetEaseMusic","domain(geosite:netease) -> direct","# Epic, Origin, Sony, Steam, Nintendo","domain(geosite:category-games) -> direct","# YouTube","domain(geosite:youtube) -> youtube","# Netflix","domain(geosite:netflix) -> netflix","# Bahamut","domain(geosite:bahamut) -> bahamut","# BilibiliHMT, Bilibili","domain(geosite:bilibili) -> direct",..._("media"),...S("proxy"),...$],fallback:"proxy",groups:[B("proxy",r.proxy,["auto",...b.map(e=>e.name)]),N,...b,f("telegram",r.telegram,["proxy","auto",...b.map(e=>e.name)]),f("ai",r.ai,["proxy","auto",...b.map(e=>e.name)]),f("youtube",r.youtube,["proxy","auto",...b.map(e=>e.name)]),f("netflix",r.netflix,["proxy","auto",...b.map(e=>e.name)]),f("bahamut",r.bahamut,["tw","proxy","auto"]),f("media",r.media,["proxy","auto",...b.map(e=>e.name)])]}},W={listenerPort:"12345",defaultDns:"tls://1.1.1.1:853",chinaDns:"udp://223.5.5.5:53"},V=e=>/^\d+$/.test(e)&&Number(e)>=1&&Number(e)<=65535;function Z(e){return V(e.listenerPort)&&!!e.defaultDns.trim()&&!!e.chinaDns.trim()}const O=e=>/^https?:\/\/\S+$/.test(e.trim());function ee(e){const o=e.map(n=>n.name.trim()||n.tag).filter(n=>!!n);return new Set(o).size===o.length&&e.every(n=>n.raw!==void 0||!!n.name.trim()&&O(n.url))}function oe(e){const o=new Set(e.map(t=>t.name.trim()||t.tag));let n=e.length+1;for(;o.has(`sub-${n}`);)n++;return`sub-${n}`}function ne(e){const{blocks:o,tokens:n}=q(e),t=[];for(const[l,c]of o.filter(i=>i.name==="subscription").entries()){const i=P(e,c,n);if(e.slice(c.open+1,c.close).trim())for(const a of L(e,c)){const m=e.slice(a.from,a.to),d=i.filter(A=>A.from>=a.from&&A.to<=a.to),g=a.block?void 0:d.length===1?d[0]:void 0,x=g&&/^(['"])(.*)\1(\([^()]*\))$/.exec(g.value),D=x?x[2]:g?z(g.value):"";g&&O(D)?t.push({name:g.name,url:D,...x?{suffix:x[3]}:{},raw:m,section:l}):t.push({name:"",url:"",raw:m,section:l,...a.block||g?{tag:a.block?.name??g.name}:{}})}}const s=I(e)[0]?.written??null,p=o.find(l=>l.name==="global"),u=p?P(e,p,n).find(l=>l.name==="lan_interface")?.value:void 0;return{subscriptions:t,group:s,rules:"keep",lanInterface:u&&u!=="auto"?u:"",...W}}function E(e){return["subscription {",...e.subscriptions.map(U),"}"]}const U=e=>e.raw??` ${J(e.name.trim())}: ${h(e.url.trim())}${e.suffix??""}`,H="proxy";function G(e,o){const n=e.group??H,t=s=>" "+s.replaceAll("{group}",n);return["routing {",...j[o].rules.map(t),t(`fallback: ${j[Line truncated import{U as h,y as E,ep as F,M as I,Q as P,z as L,q as z,V as J}from"./index-Bw0aJc9a.js";const M="standard",y=["# dae presets: the local network manager, the LAN and multicast stay off the proxy","pname(NetworkManager) -> direct","dip(224.0.0.0/3, 'ff00::/8') -> direct","dip(geoip:private) -> direct","# Block UDP/443","l4proto(udp) && dport(443) -> block"],k=["# BanAD, BanProgramAD","domain(geosite:category-ads-all) -> block"],w=["# GoogleCN, SteamCN","domain(geosite:google-cn, geosite:category-games@cn) -> direct"],$=["# ChinaDomain, ChinaCompanyIp, GEOIP CN","domain(geosite:cn) -> direct","dip(geoip:cn) -> direct"],v=e=>["# Telegram",`domain(geosite:telegram) -> ${e}`,`dip(geoip:telegram) -> ${e}`],_=e=>["# ProxyMedia",`domain(geosite:youtube, geosite:netflix, geosite:disney, geosite:hbo, geosite:primevideo, geosite:twitch, geosite:spotify) -> ${e}`],S=e=>["# ProxyGFWlist",`domain(geosite:gfw) -> ${e}`],K="filter: !name('direct', 'block')",B=(e,o,n,t=n[0])=>({name:e,label:o,lines:[`filter: group(${n.map(h).join(", ")})`,K,"policy: select",`default: ${h(t)}`]}),V=(e,o,n)=>({name:e,label:o,lines:[`filter: name(regex: ${h(n)})`,"policy: min_moving_avg"]}),r={proxy:"节点选择",auto:"自动选择",hk:["香港节点","港|HK|Hong Kong|HongKong"],jp:["日本节点","日|JP|Japan|Tokyo"],us:["美国节点","美|US|United States|America"],tw:["台湾节点","台|TW|Taiwan"],sg:["狮城节点","新加坡|獅城|狮城|SG|Singapore"],kr:["韩国节点","韓|韩|KR|Korea"],telegram:"电报消息",media:"国外媒体",apple:"苹果服务",ai:"Ai平台",youtube:"油管视频",netflix:"奈飞视频",bahamut:"巴哈姆特"},T=B("proxy",r.proxy,["auto"]),N={name:"auto",label:r.auto,lines:[K,"policy: min_moving_avg"]},b=["hk","jp","us","tw","sg","kr"].map(e=>V(e,r[e][0],r[e][1])),f=(e,o,n=["proxy","auto"],t)=>B(e,o,n,t),j={global:{rules:[...y],fallback:"{group}",groups:[]},bypass:{rules:[...y,...k,...w,...$],fallback:"{group}",groups:[]},gfw:{rules:[...y,...k,...v("{group}"),...S("{group}")],fallback:"direct",groups:[]},mini:{rules:[...y,...k,...w,...v("proxy"),..._("proxy"),...S("proxy"),...$],fallback:"proxy",groups:[T,N]},standard:{rules:[...y,...k,...w,"# Microsoft","domain(geosite:microsoft) -> direct","# Apple","domain(geosite:apple) -> apple",...v("telegram"),..._("media"),...S("proxy"),...$],fallback:"proxy",groups:[T,N,f("telegram",r.telegram),f("media",r.media),f("apple",r.apple)]},full:{rules:[...y,...k,...w,"# Bing, OneDrive, Microsoft","domain(geosite:microsoft) -> direct","# Apple","domain(geosite:apple) -> direct",...v("telegram"),"# AI, OpenAi","domain(geosite:openai) -> ai","# NetEaseMusic","domain(geosite:netease) -> direct","# Epic, Origin, Sony, Steam, Nintendo","domain(geosite:category-games) -> direct","# YouTube","domain(geosite:youtube) -> youtube","# Netflix","domain(geosite:netflix) -> netflix","# Bahamut","domain(geosite:bahamut) -> bahamut","# BilibiliHMT, Bilibili","domain(geosite:bilibili) -> direct",..._("media"),...S("proxy"),...$],fallback:"proxy",groups:[B("proxy",r.proxy,["auto",...b.map(e=>e.name)]),N,...b,f("telegram",r.telegram,["proxy","auto",...b.map(e=>e.name)]),f("ai",r.ai,["proxy","auto",...b.map(e=>e.name)]),f("youtube",r.youtube,["proxy","auto",...b.map(e=>e.name)]),f("netflix",r.netflix,["proxy","auto",...b.map(e=>e.name)]),f("bahamut",r.bahamut,["tw","proxy","auto"]),f("media",r.media,["proxy","auto",...b.map(e=>e.name)])]}},W={listenerPort:"12345",defaultDns:"tls://1.1.1.1:853",chinaDns:"udp://223.5.5.5:53"},Q=e=>/^\d+$/.test(e)&&Number(e)>=1&&Number(e)<=65535;function Z(e){return Q(e.listenerPort)&&!!e.defaultDns.trim()&&!!e.chinaDns.trim()}const O=e=>/^https?:\/\/\S+$/.test(e.trim());function ee(e){const o=e.map(n=>n.name.trim()||n.tag).filter(n=>!!n);return new Set(o).size===o.length&&e.every(n=>n.raw!==void 0||!!n.name.trim()&&O(n.url))}function oe(e){const o=new Set(e.map(t=>t.name.trim()||t.tag));let n=e.length+1;for(;o.has(`sub-${n}`);)n++;return`sub-${n}`}function ne(e){const{blocks:o,tokens:n}=E(e),t=[];for(const[l,c]of o.filter(i=>i.name==="subscription").entries()){const i=P(e,c,n);if(e.slice(c.open+1,c.close).trim())for(const a of L(e,c)){const m=e.slice(a.from,a.to),d=i.filter(A=>A.from>=a.from&&A.to<=a.to),g=a.block?void 0:d.length===1?d[0]:void 0,x=g&&/^(['"])(.*)\1(\([^()]*\))$/.exec(g.value),D=x?x[2]:g?z(g.value):"";g&&O(D)?t.push({name:g.name,url:D,...x?{suffix:x[3]}:{},raw:m,section:l}):t.push({name:"",url:"",raw:m,section:l,...a.block||g?{tag:a.block?.name??g.name}:{}})}}const s=I(e)[0]?.written??null,p=o.find(l=>l.name==="global"),u=p?P(e,p,n).find(l=>l.name==="lan_interface")?.value:void 0;return{subscriptions:t,group:s,rules:"keep",lanInterface:u&&u!=="auto"?u:"",...W}}function C(e){return["subscription {",...e.subscriptions.map(U),"}"]}const U=e=>e.raw??` ${J(e.name.trim())}: ${h(e.url.trim())}${e.suffix??""}`,H="proxy";function G(e,o){const n=e.group??H,t=s=>" "+s.replaceAll("{group}",n);return["routing {",...j[o].rules.map(t),t(`fallback: ${j[Line truncated
`);const{blocks:n}=q(e),t=[],s=n.filter(i=>i.name==="subscription");for(const[i,a]of s.entries()){const d=o.subscriptions.filter(g=>(g.section??s.length-1)===i).map(U);d.join(` `);const{blocks:n}=E(e),t=[],s=n.filter(i=>i.name==="subscription");for(const[i,a]of s.entries()){const d=o.subscriptions.filter(g=>(g.section??s.length-1)===i).map(U);d.join(`
`)!==F(e,a).join(` `)!==F(e,a).join(`
`)&&t.push({from:a.open+1,to:a.close,text:` `)&&t.push({from:a.open+1,to:a.close,text:`
`+d.join(` `+d.join(`
`)+` `)+`
`})}const p=[];!s.length&&o.subscriptions.length&&p.push(E(o).join(` `})}const p=[];!s.length&&o.subscriptions.length&&p.push(C(o).join(`
`));const u=n.find(i=>i.name==="group"),l=M(I(e).map(i=>i.name),o.rules);if(!u&&l.length)p.push(["group {",...l,"}"].join(` `));const u=n.find(i=>i.name==="group"),l=q(I(e).map(i=>i.name),o.rules);if(!u&&l.length)p.push(["group {",...l,"}"].join(`
`));else if(u&&l.length){const i=e.lastIndexOf(` `));else if(u&&l.length){const i=e.lastIndexOf(`
`,u.close-1)+1,a=!/^[ \t]*$/.test(e.slice(i,u.close));t.push({from:a?u.close:i,to:a?u.close:i,text:(a?` `,u.close-1)+1,a=!/^[ \t]*$/.test(e.slice(i,u.close));t.push({from:a?u.close:i,to:a?u.close:i,text:(a?`
`:"")+l.join(` `:"")+l.join(`
@@ -16,4 +16,4 @@ import{R as h,y as q,dE as F,K as I,O as P,z as L,q as z,U as J}from"./index-BNB
`+p.join(` `+p.join(`
`)+` `)+`
`),c}export{O as a,H as b,Z as c,T as d,V as i,oe as n,ne as r,j as t,ee as v,te as w}; `),c}export{O as a,H as b,Z as c,M as d,Q as i,oe as n,ne as r,j as t,ee as v,te as w};
@@ -1 +1 @@
import{ck as p}from"./index-BNBwb-FJ.js";import{r}from"./vendor-react-Bf71BWbF.js";function d(h){let a=p({usage:"search",...h}),o=r.useCallback((l,e)=>e.length===0?!0:(l=l.normalize("NFC"),e=e.normalize("NFC"),a.compare(l.slice(0,e.length),e)===0),[a]),c=r.useCallback((l,e)=>e.length===0?!0:(l=l.normalize("NFC"),e=e.normalize("NFC"),a.compare(l.slice(-e.length),e)===0),[a]),f=r.useCallback((l,e)=>{if(e.length===0)return!0;l=l.normalize("NFC"),e=e.normalize("NFC");let t=0,m=e.length;for(;t+m<=l.length;t++){let n=l.slice(t,t+m);if(a.compare(e,n)===0)return!0}return!1},[a]);return r.useMemo(()=>({startsWith:o,endsWith:c,contains:f}),[o,c,f])}export{d as $}; import{cz as p}from"./index-Bw0aJc9a.js";import{r}from"./vendor-react-Bf71BWbF.js";function $(h){let a=p({usage:"search",...h}),o=r.useCallback((l,e)=>e.length===0?!0:(l=l.normalize("NFC"),e=e.normalize("NFC"),a.compare(l.slice(0,e.length),e)===0),[a]),c=r.useCallback((l,e)=>e.length===0?!0:(l=l.normalize("NFC"),e=e.normalize("NFC"),a.compare(l.slice(-e.length),e)===0),[a]),f=r.useCallback((l,e)=>{if(e.length===0)return!0;l=l.normalize("NFC"),e=e.normalize("NFC");let t=0,m=e.length;for(;t+m<=l.length;t++){let n=l.slice(t,t+m);if(a.compare(e,n)===0)return!0}return!1},[a]);return r.useMemo(()=>({startsWith:o,endsWith:c,contains:f}),[o,c,f])}export{$};
@@ -1 +1 @@
import{r as i}from"./vendor-react-Bf71BWbF.js";import{eg as D,eu as l,ev as b,ex as M,eD as F,ew as v,bF as S}from"./index-BNBwb-FJ.js";function I(e,t){const u=i.useRef(!0),c=i.useRef(null);let n=D(e);i.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]),i.useEffect(()=>{let r=c.current;u.current?u.current=!1:(!r||t.some((a,o)=>!Object.is(a,r[o])))&&n(),c.current=t},t)}const k=i.createContext(null),P=i.createContext(null);var E={};E={deselectedItem:e=>`${e.item} not selected.`,select:"Select",selectedCount:(e,t)=>`${t.plural(e.count,{"=0":"No items selected",one:()=>`${t.number(e.count)} item selected`,other:()=>`${t.number(e.count)} items selected`})}.`,selectedAll:"All items selected.",selectedItem:e=>`${e.item} selected.`,longPressToSelect:"Long press to enter selection mode."};var p={};p={deselectedItem:e=>`未选择 ${e.item}。`,longPressToSelect:"长按以进入选择模式。",select:"选择",selectedAll:"已选择所有项目。",selectedCount:(e,t)=>`${t.plural(e.count,{"=0":"未选择项目",one:()=>`已选择 ${t.number(e.count)} 个项目`,other:()=>`已选择 ${t.number(e.count)} 个项目`})}。`,selectedItem:e=>`已选择 ${e.item}。`};var x={};x={deselectedItem:e=>`未選取「${e.item}」。`,longPressToSelect:"長按以進入選擇模式。",select:"選取",selectedAll:"已選取所有項目。",selectedCount:(e,t)=>`${t.plural(e.count,{"=0":"未選取任何項目",one:()=>`已選取 ${t.number(e.count)} 個項目`,other:()=>`已選取 ${t.number(e.count)} 個項目`})}。`,selectedItem:e=>`已選取「${e.item}」。`};var m={};m={"ar-AE":l,"bg-BG":l,"cs-CZ":l,"da-DK":l,"de-DE":l,"el-GR":l,"en-US":E,"es-ES":l,"et-EE":l,"fi-FI":l,"fr-FR":l,"he-IL":l,"hr-HR":l,"hu-HU":l,"it-IT":l,"ja-JP":l,"ko-KR":l,"lt-LT":l,"lv-LV":l,"nb-NO":l,"nl-NL":l,"pl-PL":l,"pt-BR":l,"pt-PT":l,"ro-RO":l,"ru-RU":l,"sk-SK":l,"sl-SI":l,"sr-SP":l,"sv-SE":l,"tr-TR":l,"uk-UA":l,"zh-CN":p,"zh-TW":x};function A(e){return e&&e.__esModule?e.default:e}function B(e,t){let{getRowText:u=o=>t.collection.getTextValue?.(o)??t.collection.getItem(o)?.textValue}=e,c=b(A(m),"@react-aria/grid"),n=t.selectionManager.rawSelection,r=i.useRef(n),a=i.useCallback(()=>{if(!t.selectionManager.isFocused||n===r.current){r.current=n;return}let o=g(n,r.current),d=g(r.current,n),h=t.selectionManager.selectionBehavior==="replace",$=[];if(t.selectionManager.selectedKeys.size===1&&h){let s=t.selectionManager.selectedKeys.keys().next().value;if(s!=null&&t.collection.getItem(s)){let f=u(s);f&&$.push(c.format("selectedItem",{item:f}))}}else if(o.size===1&&d.size===0){let s=o.keys().next().value;if(s!=null){let f=u(s);f&&$.push(c.format("selectedItem",{item:f}))}}else if(d.size===1&&o.size===0){let s=d.keys().next().value;if(s!=null&&t.collection.getItem(s)){let f=u(s);f&&$.push(c.format("deselectedItem",{item:f}))}}t.selectionManager.selectionMode==="multiple"&&($.length===0||n==="all"||n.size>1||r.current==="all"||r.current?.size>1)&&$.push(n==="all"?c.format("selectedAll"):c.format("selectedCount",{count:n.size})),$.length>0&&M($.join(" ")),r.current=n},[n,t.selectionManager.selectedKeys,t.selectionManager.isFocused,t.selectionManager.selectionBehavior,t.selectionManager.selectionMode,t.collection,u,c]);I(()=>{if(t.selectionManager.isFocused)a();else{let o=requestAnimationFrame(a);return()=>cancelAnimationFrame(o)}},[n,t.selectionManager.isFocused])}function g(e,t){let u=new Set;if(e==="all"||t==="all")return u;for(let c of e.keys())t.has(c)||u.add(c);return u}function y(e){return e&&e.__esModule?e.default:e}function K(e){let t=b(y(m),"@react-aria/grid"),u=F(),c=(u==="pointer"||u==="virtual"||u==null)&&typeof window<"u"&&"ontouchstart"in window,n=i.useMemo(()=>{let a=e.selectionManager.selectionMode,o=e.selectionManager.selectionBehavior,d;return c&&(d=t.format("longPressToSelect")),o==="replace"&&a!=="none"&&e.hasItemActions?d:void 0},[e.selectionManager.selectionMode,e.selectionManager.selectionBehavior,e.hasItemActions,t,c]);return v(n)}function C(e){return e&&e.__esModule?e.default:e}function z(e,t){let{key:u}=e,c=t.selectionManager,n=S(),r=!t.selectionManager.canSelectItem(u),a=t.selectionManager.isSelected(u),o=()=>c.toggleSelection(u);const d=b(C(m),"@react-aria/grid");return{checkboxProps:{id:n,"aria-label":d.format("select"),isSelected:a,isDisabled:r,onChange:o}}}export{K as $,B as a,z as b,k as c,P as d,I as e}; import{r as i}from"./vendor-react-Bf71BWbF.js";import{eZ as M,fb as l,fc as b,fe as D,fk as F,fd as S,bU as v}from"./index-Bw0aJc9a.js";function I(e,t){const u=i.useRef(!0),c=i.useRef(null);let n=M(e);i.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]),i.useEffect(()=>{let r=c.current;u.current?u.current=!1:(!r||t.some((a,o)=>!Object.is(a,r[o])))&&n(),c.current=t},t)}const k=i.createContext(null),P=i.createContext(null);var E={};E={deselectedItem:e=>`${e.item} not selected.`,select:"Select",selectedCount:(e,t)=>`${t.plural(e.count,{"=0":"No items selected",one:()=>`${t.number(e.count)} item selected`,other:()=>`${t.number(e.count)} items selected`})}.`,selectedAll:"All items selected.",selectedItem:e=>`${e.item} selected.`,longPressToSelect:"Long press to enter selection mode."};var p={};p={deselectedItem:e=>`未选择 ${e.item}。`,longPressToSelect:"长按以进入选择模式。",select:"选择",selectedAll:"已选择所有项目。",selectedCount:(e,t)=>`${t.plural(e.count,{"=0":"未选择项目",one:()=>`已选择 ${t.number(e.count)} 个项目`,other:()=>`已选择 ${t.number(e.count)} 个项目`})}。`,selectedItem:e=>`已选择 ${e.item}。`};var x={};x={deselectedItem:e=>`未選取「${e.item}」。`,longPressToSelect:"長按以進入選擇模式。",select:"選取",selectedAll:"已選取所有項目。",selectedCount:(e,t)=>`${t.plural(e.count,{"=0":"未選取任何項目",one:()=>`已選取 ${t.number(e.count)} 個項目`,other:()=>`已選取 ${t.number(e.count)} 個項目`})}。`,selectedItem:e=>`已選取「${e.item}」。`};var m={};m={"ar-AE":l,"bg-BG":l,"cs-CZ":l,"da-DK":l,"de-DE":l,"el-GR":l,"en-US":E,"es-ES":l,"et-EE":l,"fi-FI":l,"fr-FR":l,"he-IL":l,"hr-HR":l,"hu-HU":l,"it-IT":l,"ja-JP":l,"ko-KR":l,"lt-LT":l,"lv-LV":l,"nb-NO":l,"nl-NL":l,"pl-PL":l,"pt-BR":l,"pt-PT":l,"ro-RO":l,"ru-RU":l,"sk-SK":l,"sl-SI":l,"sr-SP":l,"sv-SE":l,"tr-TR":l,"uk-UA":l,"zh-CN":p,"zh-TW":x};function A(e){return e&&e.__esModule?e.default:e}function B(e,t){let{getRowText:u=o=>t.collection.getTextValue?.(o)??t.collection.getItem(o)?.textValue}=e,c=b(A(m),"@react-aria/grid"),n=t.selectionManager.rawSelection,r=i.useRef(n),a=i.useCallback(()=>{if(!t.selectionManager.isFocused||n===r.current){r.current=n;return}let o=g(n,r.current),d=g(r.current,n),h=t.selectionManager.selectionBehavior==="replace",$=[];if(t.selectionManager.selectedKeys.size===1&&h){let s=t.selectionManager.selectedKeys.keys().next().value;if(s!=null&&t.collection.getItem(s)){let f=u(s);f&&$.push(c.format("selectedItem",{item:f}))}}else if(o.size===1&&d.size===0){let s=o.keys().next().value;if(s!=null){let f=u(s);f&&$.push(c.format("selectedItem",{item:f}))}}else if(d.size===1&&o.size===0){let s=d.keys().next().value;if(s!=null&&t.collection.getItem(s)){let f=u(s);f&&$.push(c.format("deselectedItem",{item:f}))}}t.selectionManager.selectionMode==="multiple"&&($.length===0||n==="all"||n.size>1||r.current==="all"||r.current?.size>1)&&$.push(n==="all"?c.format("selectedAll"):c.format("selectedCount",{count:n.size})),$.length>0&&D($.join(" ")),r.current=n},[n,t.selectionManager.selectedKeys,t.selectionManager.isFocused,t.selectionManager.selectionBehavior,t.selectionManager.selectionMode,t.collection,u,c]);I(()=>{if(t.selectionManager.isFocused)a();else{let o=requestAnimationFrame(a);return()=>cancelAnimationFrame(o)}},[n,t.selectionManager.isFocused])}function g(e,t){let u=new Set;if(e==="all"||t==="all")return u;for(let c of e.keys())t.has(c)||u.add(c);return u}function y(e){return e&&e.__esModule?e.default:e}function K(e){let t=b(y(m),"@react-aria/grid"),u=F(),c=(u==="pointer"||u==="virtual"||u==null)&&typeof window<"u"&&"ontouchstart"in window,n=i.useMemo(()=>{let a=e.selectionManager.selectionMode,o=e.selectionManager.selectionBehavior,d;return c&&(d=t.format("longPressToSelect")),o==="replace"&&a!=="none"&&e.hasItemActions?d:void 0},[e.selectionManager.selectionMode,e.selectionManager.selectionBehavior,e.hasItemActions,t,c]);return S(n)}function C(e){return e&&e.__esModule?e.default:e}function z(e,t){let{key:u}=e,c=t.selectionManager,n=v(),r=!t.selectionManager.canSelectItem(u),a=t.selectionManager.isSelected(u),o=()=>c.toggleSelection(u);const d=b(C(m),"@react-aria/grid");return{checkboxProps:{id:n,"aria-label":d.format("select"),isSelected:a,isDisabled:r,onChange:o}}}export{K as $,B as a,z as b,k as c,P as d,I as e};
@@ -0,0 +1 @@
import{j as n,r as ie}from"./vendor-react-Bf71BWbF.js";import{u as ue,ah as ge,I as Q,E as Le,bt as q,cN as De,du as Re,L as Ae,B as H,aa as Ne,ac as F,ag as Ce,ae as Oe,dw as Pe,dx as ke,dy as Se,d1 as Te,d6 as Ee,d2 as Me,dz as Ie,bf as _e,dA as qe,dB as He,dn as Fe,a7 as Be,dC as Ge,bK as We,dD as Ke,d7 as ze,dE as Qe,dF as le,dq as Ue,bm as g,dG as Je,dk as oe,a0 as ae,bG as Ve,dH as Xe,db as Ye,d0 as Ze,d4 as $e}from"./index-Bw0aJc9a.js";import{D as es}from"./DaeCode-B8yPDjSE.js";import{u as ss,a as ts}from"./flows-D3eabARZ.js";function as({dialog:e}){const r=ue();return n.jsxs(ge,{title:r("rule.add"),narrow:!0,isOpen:!!e,reason:e?.reason,onOpenChange:i=>{i||e?.close()},footer:()=>n.jsxs(n.Fragment,{children:[n.jsx(H,{onPress:()=>e?.close(),children:r("ui.cancel")}),e?.copyable&&n.jsx(H,{isDisabled:!e.copyReady,onPress:e.copy,children:r("rule.copy")}),n.jsx(H,{isDisabled:e?.disabled,isPending:e?.busy,onPress:()=>e?.applyNow(),children:r("rule.addApply")}),n.jsx(H,{accent:!0,isDisabled:e?.disabled||e?.busy,onPress:()=>e?.hold(),children:r("rule.hold")})]}),children:[e?.failure&&n.jsx(Q,{takeFocus:!0,children:e.failure.text},e.failure.id),e&&n.jsxs("div",{className:"rp-list",children:[e.failure?.lines.map((i,p)=>n.jsx("span",{className:"rp-label",children:i},p)),n.jsx(Le,{error:e.loadError,onRetry:e.retry}),n.jsx("span",{className:"rp-label",children:r("rule.holdHelp")}),e.lists&&n.jsx(q,{isDisabled:e.busy,label:r("rule.list"),value:e.list,onChange:e.setList,items:e.lists}),e.targets&&n.jsx(q,{isDisabled:e.busy,label:r("rule.kind"),value:e.target,onChange:e.setTarget,items:e.targets}),e.type&&n.jsx(De,{isSelected:e.typed,isDisabled:e.busy,onChange:e.setTyped,children:e.type}),n.jsxs("div",{className:"rp-toolbar top",children:[n.jsx(q,{isDisabled:e.busy,label:e.targetLabel,value:e.outbound,onChange:e.setOutbound,items:e.outbounds}),e.writable?e.positions.length===1?n.jsx(Re,{label:r("rule.position"),value:e.positions[0].label,description:e.positions[0].desc}):n.jsx(q,{isDisabled:e.busy||!e.positions.length,label:r("rule.position"),value:e.before,onChange:e.setBefore,items:e.positions}):null]}),e.current&&n.jsx("span",{className:"rp-label",children:e.current}),e.unchanged&&n.jsx(Q,{tone:"informative",children:r("rule.unchanged")}),e.moved&&n.jsx(Q,{tone:"informative",children:r("conn.ruleMoved")}),e.beforeMatched&&!e.moved&&n.jsx("p",{className:"rp-note",children:r("rule.beforeMatchedNote")}),e.earlier&&!e.moved&&n.jsx("p",{className:"rp-note",children:r("rule.earlierMayMatch")}),e.unplaceable&&(e.configHref?n.jsxs("p",{className:"rp-note",children:[r("rule.dns.noPlace")," ",n.jsx(Ae,{appearance:"link",external:!0,href:e.configHref,children:r("dns.openConfig")})]}):n.jsx("p",{className:"rp-note",children:r("conn.ruleNoPosition")})),e.duplicate&&n.jsx("p",{className:"rp-note",children:e.duplicate}),n.jsx(es,{text:e.preview})]})]})}async function ns(e){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}const r=document.createElement("textarea");r.value=e,r.setAttribute("readonly",""),r.style.position="fixed",r.style.opacity="0",document.body.append(r),r.select();try{return document.execCommand("copy")}catch{return!1}finally{r.remove()}}function us(e,{queryAgain:r}={}){const i=ue(),p=Ne().data?.resources,U=F(p,"rules",{whileLoading:!1}),N=F(p,"dns_rules",{whileLoading:!1}),J=F(p,"config",{whileLoading:!1})&&p?.config.writable===!0,[t,m]=ie.useState(null),[ce,B]=ie.useState(null),C=!!t,u=t?.list==="routing",a=t&&t.list!=="routing"?t.list:null,x=J&&(u?U:N),f=ss(U&&C&&t.lists.includes("routing")),L=ts(N&&C&&t.lists.some(s=>s!=="routing")),v=Ce(J&&C),G=F(p,"groups",{whileLoading:!1}),O=Oe(C&&G&&t.lists.includes("routing")),W=()=>{t?.lists.includes("routing")&&f.refetch(),a&&L.refetch(),v.refetch(),G&&t?.lists.includes("routing")&&O.refetch()},w=Pe(),b=v.data?.sources??[],P=a?L.data?.[a]:void 0,k=u?f.data?.generation_id:L.data?.generation_id,D=u?ke(f.data?.rules??[],b,t.seed.matched,i):a?Se(a,P??[],b,i):[],V=a?Te(P??[],b):[],de=u?Ee(O.data??[]):a?Me(a,[...new Set(V.map(s=>s.name))],i):[],pe=u?!G||!!O.data:!x||!!v.data,c=t?.outbound??"",K=s=>{const o=D.find(l=>l.id===s);return o&&k?{generation:k,id:o.id,desc:o.desc}:null},{before:d,moved:X}=Ie(D,t?.pin??null,k),Y=t&&!t.pin?K(d):null;Y&&m({...t,pin:Y});const S=t?_e(t.seed,t.list):[],h=S[t?.target??0],z=a?t?.seed.dns?.type??null:null,T=h?qe(h.condition,t?.typed?z:null):"",R=s=>{t&&!w.busy&&m({...t,...s})},Z=()=>{w.busy&&(w.cancel(),W()),m(null),B(null)},fe=()=>(g("negative",i("rule.stale")),W(),null),be=()=>{if(u){const l=f.data?.rules.find(j=>j.rule_id===d),A=b.find(j=>j.id===l?.source?.source_id);return l&&A&&Ye(A,l)?{list:"routing",before:l,sourceId:A.id}:null}if(!a)return null;if(d==="end"){const l=Ze(b,a);return l&&{list:a,before:null,sourceId:l.source.id}}const s=P?.find(l=>l.rule_id===d),o=b.find(l=>l.id===s?.source?.source_id);return s&&o&&$e(o,s,a)?{list:a,before:s,sourceId:o.id}:null},$=()=>{const s=hLine truncated
Loaded 100 of 167 files, more files were not shown because too many files have changed in this diff. Show more