Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix(library): 来源说「没有」按告知项报一个数,不占问题清单

longmeidaocd7052bb97ea
diff --git a/frontend/src/islands/library-processing.tsx b/frontend/src/islands/library-processing.tsx
index 0ffd1f8a1..c36cf2348 100644
--- a/frontend/src/islands/library-processing.tsx
+++ b/frontend/src/islands/library-processing.tsx
@@ -11,7 +11,7 @@ export interface LibraryProcessingIssue { asset_id: number | null; title?: strin
export interface LibraryProcessingData extends JobState {
stage?: string; scanned?: number; identified?: number; candidates?: number; covers?: number;
issue_count?: number; issue_preview?: LibraryProcessingIssue[]; issues_log?: string;
- error_count?: number;
+ notes?: Record<string, number>;
issues_truncated?: boolean; retryable_asset_ids?: number[];
current_asset_id?: number | null; current_asset_name?: string; current_action?: string;
current_started_at?: number; last_progress_at?: number; stalled?: boolean; waited_seconds?: number;
@@ -25,6 +25,16 @@ const ACTION_LABELS: Record<string, string> = {
reading_local: '读取本地资料', querying_metadata: '查询外部资料',
fetching_cover: '采集缺失封面', writing_candidates: '保存资料候选',
};
+/* 来源说「没有」按类型报一个数,不进问题清单:馆藏里大量独立资源和创作者作品
+ 任何目录站都收不到,它们不是待办。键与 `library_processing.MISS_MESSAGES` 同源。 */
+const NOTE_LABELS: Record<string, string> = { querying_metadata: '没有资料', fetching_cover: '没有封面' };
+
+function notesLine(notes: Record<string, number>): string {
+ const parts = Object.entries(notes)
+ .filter(([key, count]) => NOTE_LABELS[key] && count > 0)
+ .map(([key, count]) => `${NOTE_LABELS[key]} ${count} 部`);
+ return parts.length ? `外部来源${parts.join('、')},7 天内不再问。` : '';
+}
function currentLine(state: LibraryProcessingData): string {
const action = ACTION_LABELS[state.current_action || ''] || state.stage || '正在处理';
@@ -109,13 +119,14 @@ export function LibraryProcessing({ data, error, toast, onComplete, mode, monito
/* 进度条讲的是卡片上那个按钮此刻在做什么,留在卡片里;结果和故障讲的是这一趟任务
的下场,挂在卡片外面,和链接管理、资源同步那两块同一个写法。 */
const issues = state.issue_preview || [];
+ const notes = notesLine(state.notes || {});
const retryable = state.status === 'failed' && !!state.retryable_asset_ids?.length;
/* 问题清单收进那条错误 Note 的折叠里:卡片下面先看到的应该是「这一趟怎么了」,
逐条明细是要展开才读的东西。完整清单在状态给出的日志文件里,界面只留前 20 条。 */
const issueDetails = issues.length ? {
label: state.issues_truncated
- ? `${state.status === 'complete'?'采集记录':'问题清单'}:共 ${state.issue_count || 0} 项,展开查看前 ${issues.length} 项`
- : `${state.status === 'complete'?'采集记录':'问题清单'}:共 ${state.issue_count || 0} 项`,
+ ? `问题清单:共 ${state.issue_count || 0} 项,展开查看前 ${issues.length} 项`
+ : `问题清单:共 ${state.issue_count || 0} 项`,
items: issues.map(issue => ({
label: issue.title || (issue.asset_id ? `视频 ${issue.asset_id}` : '媒体来源'),
href: issue.asset_id ? `/item/${issue.asset_id}` : '',
@@ -147,7 +158,8 @@ export function LibraryProcessing({ data, error, toast, onComplete, mode, monito
{ variant: 'warning', label: '处理较慢', filled: true }) }} />}
{(problem || state.status === 'failed') && <div role="alert" onClick={event=>{if((event.target as HTMLElement).closest('[data-note-action]'))retry();}} dangerouslySetInnerHTML={{ __html: noteHtml(problem || state.error || '处理未完成,请重试', { variant: 'error',filled:true,actionLabel:retryable?'重试未完成项':'',details:issueDetails }) }} />}
{receipt && <div class="library-processing-result" dangerouslySetInnerHTML={{ __html: noteHtml(`已扫描 ${state.scanned || 0} 个文件,识别 ${state.identified || 0} 个番号,整理 ${state.candidates || 0} 组资料候选。`, { variant: 'success', label: '处理完成' }) }} />}
- {state.status === 'complete' && issueDetails && <div dangerouslySetInnerHTML={{__html:noteHtml(`${state.issue_count || 0} 项采集记录`,{variant:'secondary',details:issueDetails})}} />}
+ {state.status !== 'running' && !!notes && <div dangerouslySetInnerHTML={{__html:noteHtml(
+ notes + (state.issues_log ? ` 完整记录:${state.issues_log}` : ''), { variant: 'secondary' })}} />}
</div>
</>;
}
diff --git a/frontend/test/library-processing.test.tsx b/frontend/test/library-processing.test.tsx
index fd86319ea..f08a02ebe 100644
--- a/frontend/test/library-processing.test.tsx
+++ b/frontend/test/library-processing.test.tsx
@@ -4,13 +4,17 @@ import { act } from 'preact/test-utils';
import { LibraryProcessing } from '../src/islands/library-processing';
let host: HTMLDivElement;
-it('没有来源资料显示中性记录且不提供失败重试',async()=>{
+it('来源说没有只报一个数,不算问题也不提供失败重试',async()=>{
host=document.createElement('div');document.body.append(host);
- await act(async()=>render(h(LibraryProcessing,{data:{status:'complete',error_count:0,issue_count:1,issue_preview:[{asset_id:1,title:'孤立资源',message:'来源未收录',severity:'info'}]},error:'',toast:vi.fn(),preview:true}),host));
- expect(host.textContent).toContain('1 项采集记录');
+ await act(async()=>render(h(LibraryProcessing,{data:{status:'complete',issue_count:0,issue_preview:[],
+ notes:{querying_metadata:30,fetching_cover:162},
+ issues_log:'C:\peach-data\state\library-processing-one.issues.jsonl'},
+ error:'',toast:vi.fn(),preview:true}),host));
+ expect(host.textContent).toContain('外部来源没有资料 30 部、没有封面 162 部,7 天内不再问。');
+ expect(host.textContent).toContain('C:\peach-data\state\library-processing-one.issues.jsonl');
expect(host.querySelector('.geist-note-error')).toBeNull();
expect(host.textContent).not.toContain('重试未完成项');
- expect(host.querySelector('.geist-note-details a')?.getAttribute('href')).toBe('/item/1');
+ expect(host.querySelector('.geist-note-details')).toBeNull();
});
it('三种扫描采集方式使用分体菜单并提交对应阶段', async () => {
const bodies: object[] = [];
diff --git a/src/peach/library_processing.py b/src/peach/library_processing.py
index c2e52b0f1..524932fcc 100644
--- a/src/peach/library_processing.py
+++ b/src/peach/library_processing.py
@@ -67,8 +67,12 @@ def describe_failure(error):
if isinstance(error, (Unavailable, SourcePaused, httpx.TransportError)) and text:
return text
return f'处理出错({type(error).__name__})'
+#: 来源说「没有」不是待办:馆藏里本来就有大量独立资源和创作者作品,任何目录站都收不到
+#: 它们。逐条记在日志里备查,界面只按这两类各报一个数(`state['notes']`),不进问题清单。
MISS_MESSAGES = {'querying_metadata': '外部来源没有这部片的资料,7 天内不再问',
'fetching_cover': '外部来源没有这部片的封面,7 天内不再问'}
+#: 日志里的写法反查回上面的键,界面按键取自己的短标签。
+NOTE_KEYS = {message: key for key, message in MISS_MESSAGES.items()}
#: 状态文件与候选 CSV 的落盘节流。页面轮询读的是内存里的任务快照,文件只为进程没了
#: 之后还能看到最后状态;候选 CSV 随处理进度越写越大,每条资产都重写一遍是平方级开销。
@@ -270,8 +274,32 @@ def decorate(state, *, now=None):
def _issue_classification(message, retryable):
- informational = message in MISS_MESSAGES.values()
- return informational, 'info' if informational else 'error', retryable and not informational
+ """这条记录写进日志的级别,以及它值不值得重试。告知项两样都不是问题。"""
+ note = NOTE_KEYS.get(message)
+ return 'info' if note else 'error', retryable and not note
+
+
+def _record_issue(state, log_path, record):
+ """把一条记录写进日志,并按类型计进状态。
+
+ 告知项只按类型各记一个数:它们占着那 20 条预览的话,一条真问题就被几百条
+ 「来源没有这部片」挤出屏幕,而全库有大量片子任何目录站都收不到。
+ """
+ with open(log_path, 'a', encoding='utf-8') as handle:
+ handle.write(json.dumps(record, ensure_ascii=False) + '\n')
+ note = NOTE_KEYS.get(record['message'])
+ if note:
+ state['notes'][note] = state['notes'].get(note, 0) + 1
+ return
+ state['issue_count'] += 1
+ if len(state['issue_preview']) < ISSUE_PREVIEW_LIMIT:
+ state['issue_preview'].append({key: record[key] for key in
+ ('asset_id', 'title', 'path', 'message', 'severity')})
+ else:
+ state['issues_truncated'] = True
+ asset_id = record['asset_id']
+ if record['retryable'] and asset_id is not None and asset_id not in state['retryable_asset_ids']:
+ state['retryable_asset_ids'].append(asset_id)
def snapshot(config):
@@ -292,25 +320,31 @@ def snapshot(config):
_save(state_path(config), state)
except Timeout:
pass
- if 'error_count' not in state and state.get('status') in ('complete', 'failed') and state.get('job_id'):
+ # 状态文件没有 `notes` 时按日志重算:每条记录都在日志里,告知项和问题分得开。
+ # 行数对不上说明日志被截断过,那时宁可原样显示。
+ if 'notes' not in state and state.get('status') in ('complete', 'failed') and state.get('job_id'):
try:
- count, errors, retryable = 0, 0, set()
+ count, problems, notes, retryable = 0, 0, {}, set()
with issues_path(config, state['job_id']).open(encoding='utf-8') as handle:
for line in handle:
item = json.loads(line)
count += 1
- if item.get('message') not in MISS_MESSAGES.values():
- errors += 1
- if item.get('retryable') and item.get('asset_id') is not None:
- retryable.add(item['asset_id'])
+ key = NOTE_KEYS.get(item.get('message'))
+ if key:
+ notes[key] = notes.get(key, 0) + 1
+ continue
+ problems += 1
+ if item.get('retryable') and item.get('asset_id') is not None:
+ retryable.add(item['asset_id'])
if count == state.get('issue_count'):
- state['error_count'] = errors
- state['retryable_asset_ids'] = sorted(retryable)
- for item in state.get('issue_preview', []):
- item['severity'] = 'info' if item.get('message') in MISS_MESSAGES.values() else 'error'
+ preview = [item for item in state.get('issue_preview', [])
+ if item.get('message') not in NOTE_KEYS]
+ state.update(notes=notes, issue_count=problems, issue_preview=preview,
+ issues_truncated=problems > len(preview),
+ retryable_asset_ids=sorted(retryable))
if state.get('error') == f'{count} 项需要处理,请查看详情并重试。':
- state['status'] = 'failed' if errors else 'complete'
- state['error'] = f'{errors} 项需要处理,请查看详情并重试。' if errors else ''
+ state['status'] = 'failed' if problems else 'complete'
+ state['error'] = f'{problems} 项需要处理,请查看详情并重试。' if problems else ''
except (OSError, ValueError, TypeError):
pass
return decorate(state)
@@ -626,7 +660,7 @@ def process_library(config, db_path, candidate_root, cover_root, *, location='co
state = dict(job_id=job_id or uuid.uuid4().hex, status='running',
stage='读取本地资料' if retrying else '扫描文件',
checked=0, total=0, scanned=0, identified=0, candidates=0, covers=0,
- issue_count=0, error_count=0, issue_preview=[], issues_truncated=False,
+ issue_count=0, issue_preview=[], issues_truncated=False, notes={},
retryable_asset_ids=[],
last_progress_at=time.time(), progress_seq=0,
current_asset_id=None, current_asset_name='', current_action='',
@@ -667,20 +701,11 @@ def process_library(config, db_path, candidate_root, cover_root, *, location='co
asset_id = asset.get('id')
title = str(asset.get('catalog_title') or '') or Path(str(asset.get('name') or '')).name
asset_path = str(asset.get('path') or '')
- informational, severity, retryable = _issue_classification(message, retryable)
- with open(log_path, 'a', encoding='utf-8') as handle:
- handle.write(json.dumps({'asset_id': asset_id, 'title': title, 'path': asset_path,
- 'message': message, 'severity': severity, 'failed_action': action, 'retryable': retryable,
- 'last_failed_at': time.time()}, ensure_ascii=False) + '\n')
- state['issue_count'] += 1
- state['error_count'] += not informational
- if len(state['issue_preview']) < ISSUE_PREVIEW_LIMIT:
- state['issue_preview'].append(dict(asset_id=asset_id, title=title,
- path=asset_path, message=message, severity=severity))
- else:
- state['issues_truncated'] = True
- if retryable and asset_id is not None and asset_id not in state['retryable_asset_ids']:
- state['retryable_asset_ids'].append(asset_id)
+ severity, retryable = _issue_classification(message, retryable)
+ _record_issue(state, log_path, {
+ 'asset_id': asset_id, 'title': title, 'path': asset_path, 'message': message,
+ 'severity': severity, 'failed_action': action, 'retryable': retryable,
+ 'last_failed_at': time.time()})
state['last_progress_at'] = time.time()
flush_state()
report(dict(state))
@@ -834,9 +859,9 @@ def process_library(config, db_path, candidate_root, cover_root, *, location='co
current_asset_id=None, current_asset_name='', current_action='',
current_started_at=None, current_deadline_at=None)
flush_candidates(force=True)
- update(status='failed' if state['error_count'] else 'complete', stage='处理结束',
+ update(status='failed' if state['issue_count'] else 'complete', stage='处理结束',
checked=len(rows),
- error=f"{state['error_count']} 项需要处理,请查看详情并重试。" if state['error_count'] else '',
+ error=f"{state['issue_count']} 项需要处理,请查看详情并重试。" if state['issue_count'] else '',
completed_at=time.time(), current_asset_id=None, current_asset_name='',
current_action='', current_started_at=None, current_deadline_at=None)
except Exception:
diff --git a/tests/test_complexity_ratchet.py b/tests/test_complexity_ratchet.py
index 29e14852f..c5b529d93 100644
--- a/tests/test_complexity_ratchet.py
+++ b/tests/test_complexity_ratchet.py
@@ -25,7 +25,7 @@ LIMIT = 30
#: 键是 `<仓库相对路径>:<限定名>`,值是盘点当天的分支数。
BASELINE: dict[str, int] = {
- "src/peach/library_processing.py:process_library": 72,
+ "src/peach/library_processing.py:process_library": 67,
"src/peach/web_batch.py:q_ads": 85,
"scripts/scrape_codes.py:_scrape": 77,
"scripts/localize_performer_names.py:collect": 64,
diff --git a/tests/test_metadata_library.py b/tests/test_metadata_library.py
index a84af9d05..5d8aa108d 100644
--- a/tests/test_metadata_library.py
+++ b/tests/test_metadata_library.py
@@ -547,7 +547,8 @@ class LibraryNfoTests(unittest.TestCase):
first = run()
self.assertEqual((provider.query.call_count, provider.community.call_count), (1, 1))
self.assertEqual([row['message'] for row in first['issue_preview']],
- ['外部来源没有这部片的资料,7 天内不再问', '封面未取得:来源返回 HTTP 503'])
+ ['封面未取得:来源返回 HTTP 503'], '来源说没有只报一个数,不占问题清单')
+ self.assertEqual(first['notes'], {'querying_metadata': 1})
recorded = json.loads(misses_path(config).read_text(encoding='utf-8'))
self.assertEqual(list(recorded), ['r18dev', 'community'])
self.assertEqual(list(recorded['r18dev']), ['STP-26232'])
@@ -556,21 +557,28 @@ class LibraryNfoTests(unittest.TestCase):
second = run()
self.assertEqual((provider.query.call_count, provider.community.call_count), (1, 1), '资料 7 天内不再问')
self.assertEqual(provider.cover.call_count, 2, '封面上次是来源故障,这次照问')
- self.assertEqual([row['message'] for row in second['issue_preview']],
- ['外部来源没有这部片的资料,7 天内不再问', '外部来源没有这部片的封面,7 天内不再问'])
+ self.assertEqual(second['issue_preview'], [])
+ self.assertEqual(second['notes'], {'querying_metadata': 1, 'fetching_cover': 1})
self.assertEqual(second['retryable_asset_ids'], [])
- self.assertEqual((second['status'], second['error_count']), ('complete', 0))
- self.assertTrue(all(row['severity'] == 'info' for row in second['issue_preview']))
- self.assertEqual((first['status'], first['error_count']), ('failed', 1))
- stored = dict(second, status='failed', error='2 项需要处理,请查看详情并重试。')
- stored.pop('error_count')
+ self.assertEqual((second['status'], second['issue_count']), ('complete', 0))
+ self.assertEqual((first['status'], first['issue_count']), ('failed', 1))
+ # 状态文件里没有 `notes` 的任务,读出来要按日志把告知项和问题分开重算。
+ stored = dict(second, status='failed', error='2 项需要处理,请查看详情并重试。', issue_count=2,
+ issue_preview=[{'asset_id': 1, 'title': 'STP-26232.mp4', 'path': '',
+ 'message': message, 'severity': 'error'}
+ for message in ('外部来源没有这部片的资料,7 天内不再问',
+ '外部来源没有这部片的封面,7 天内不再问')])
+ stored.pop('notes')
state_path(config).write_text(json.dumps(stored), encoding='utf-8')
- self.assertEqual(snapshot(config)['status'], 'complete')
+ projected = snapshot(config)
+ self.assertEqual((projected['status'], projected['issue_count'], projected['issue_preview']),
+ ('complete', 0, []))
+ self.assertEqual(projected['notes'], {'querying_metadata': 1, 'fetching_cover': 1})
self.assertEqual(json.loads(state_path(config).read_text(encoding='utf-8'))['status'], 'failed')
third = run()
self.assertEqual((provider.query.call_count, provider.cover.call_count), (1, 2))
- self.assertEqual(third['issue_count'], 2)
+ self.assertEqual(third['issue_count'], 0)
self.assertEqual((third['status'], third['retryable_asset_ids']), ('complete', []))
run(retry_ids=[1])
diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.js
index e08e359fe..456856554 100644
--- a/web/dist/peach-ui.js
+++ b/web/dist/peach-ui.js
@@ -39,56 +39,56 @@ function F(e) {
function de(e, t) {
this.props = e, this.context = t;
}
-function I(e, t) {
- if (t == null) return e.__ ? I(e.__, e.__i + 1) : null;
+function fe(e, t) {
+ if (t == null) return e.__ ? fe(e.__, e.__i + 1) : null;
for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e;
- return typeof e.type == "function" ? I(e) : null;
+ return typeof e.type == "function" ? fe(e) : null;
}
-function fe(e) {
+function pe(e) {
if (e.__P && e.__d) {
var t = e.__v, n = t.__e, r = [], i = [], a = P({}, t);
- a.__v = t.__v + 1, w.vnode && w.vnode(a), Ce(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? I(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, Te(r, a, i), t.__e = t.__ = null, a.__e != n && pe(a);
+ a.__v = t.__v + 1, w.vnode && w.vnode(a), we(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? fe(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, Ee(r, a, i), t.__e = t.__ = null, a.__e != n && me(a);
}
}
-function pe(e) {
+function me(e) {
if ((e = e.__) != null && e.__c != null) return e.__e = e.__c.base = null, e.__k.some(function(t) {
if (t != null && t.__e != null) return e.__e = e.__c.base = t.__e;
- }), pe(e);
+ }), me(e);
}
-function me(e) {
- (!e.__d && (e.__d = !0) && D.push(e) && !he.__r++ || O != w.debounceRendering) && ((O = w.debounceRendering) || k)(he);
+function he(e) {
+ (!e.__d && (e.__d = !0) && D.push(e) && !ge.__r++ || O != w.debounceRendering) && ((O = w.debounceRendering) || k)(ge);
}
-function he() {
+function ge() {
try {
- for (var e, t = 1; D.length;) D.length > t && D.sort(A), e = D.shift(), t = D.length, fe(e);
+ for (var e, t = 1; D.length;) D.length > t && D.sort(A), e = D.shift(), t = D.length, pe(e);
} finally {
- D.length = he.__r = 0;
+ D.length = ge.__r = 0;
}
}
-function ge(e, t, n, r, i, a, o, s, c, l, u) {
+function _e(e, t, n, r, i, a, o, s, c, l, u) {
var d, f, p, m, h, g, _ = r && r.__k || ae, v = t.length;
- for (c = _e(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || ie, p.__i = d, g = Ce(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && Oe(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = ve(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
+ for (c = ve(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || ie, p.__i = d, g = we(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && ke(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = ye(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
return n.__e = h, c;
}
-function _e(e, t, n, r, i) {
+function ve(e, t, n, r, i) {
var a, o, s, c, l, u = n.length, d = u, f = 0;
- for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = ue(null, o, null, null, null) : se(o) ? o = e.__k[a] = ue(F, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = ue(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = ye(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
- if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = I(s)), ke(s, s));
+ for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = ue(null, o, null, null, null) : se(o) ? o = e.__k[a] = ue(F, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = ue(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = be(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
+ if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = fe(s)), Ae(s, s));
return r;
}
-function ve(e, t, n) {
+function ye(e, t, n) {
var r, i;
if (typeof e.type == "function") {
- for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = ve(r[i], t, n));
+ for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = ye(r[i], t, n));
return t;
}
- e.__e != t && (t && e.type && !t.parentNode && (t = I(e)), t = n.insertBefore(e.__e, t || null));
+ e.__e != t && (t && e.type && !t.parentNode && (t = fe(e)), t = n.insertBefore(e.__e, t || null));
do
t &&= t.nextSibling;
while (t != null && t.nodeType == 8);
return t;
}
-function ye(e, t, n, r) {
+function be(e, t, n, r) {
var i, a, o, s = e.key, c = e.type, l = t[n], u = l != null && !(2 & l.__u);
if (l === null && s == null || u && s == l.key && c == l.type) return n;
if (r > +!!u) {
@@ -96,16 +96,16 @@ function ye(e, t, n, r) {
}
return -1;
}
-function be(e, t, n) {
+function xe(e, t, n) {
t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || oe.test(t) ? n : n + "px";
}
-function xe(e, t, n, r, i) {
+function Se(e, t, n, r, i) {
var a, o;
n: if (t == "style") {
if (typeof n == "string") e.style.cssText = n;
else {
- if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || be(e.style, t, "");
- if (n) for (t in n) r && n[t] == r[t] || be(e.style, t, n[t]);
+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || xe(e.style, t, "");
+ if (n) for (t in n) r && n[t] == r[t] || xe(e.style, t, n[t]);
}
} else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(te, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l ||= {}, e.l[t + a] = n, n ? r ? n[M] = r[M] : (n[M] = ne, e.addEventListener(t, a ? N : re, a)) : e.removeEventListener(t, a ? N : re, a);
else {
@@ -117,7 +117,7 @@ function xe(e, t, n, r, i) {
typeof n == "function" || (n == null || !1 === n && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
}
}
-function Se(e) {
+function Ce(e) {
return function(t) {
if (this.l) {
var n = this.l[t.type + e];
@@ -127,19 +127,19 @@ function Se(e) {
}
};
}
-function Ce(e, t, n, r, i, a, o, s, c, l) {
+function we(e, t, n, r, i, a, o, s, c, l) {
var u, d, f, p, m, h, g, _, v, y, b, x, S, C, T, E, D = t.type;
if (t.constructor !== void 0) return null;
128 & n.__u && (c = !!(32 & n.__u), a = [s = t.__e = n.__e]), (u = w.__b) && u(t);
n: if (typeof D == "function") {
d = o.length;
try {
- if (v = t.props, y = D.prototype && D.prototype.render, b = (u = D.contextType) && r[u.__c], x = u ? b ? b.props.value : u.__ : r, n.__c ? _ = (f = t.__c = n.__c).__ = f.__E : (y ? t.__c = f = new D(v, x) : (t.__c = f = new de(v, x), f.constructor = D, f.render = Ae), b && b.sub(f), f.state || (f.state = {}), f.__n = r, p = f.__d = !0, f.__h = [], f._sb = []), y && f.__s == null && (f.__s = f.state), y && D.getDerivedStateFromProps != null && (f.__s == f.state && (f.__s = P({}, f.__s)), P(f.__s, D.getDerivedStateFromProps(v, f.__s))), m = f.props, h = f.state, f.__v = t, p) y && D.getDerivedStateFromProps == null && f.componentWillMount != null && f.componentWillMount(), y && f.componentDidMount != null && f.__h.push(f.componentDidMount);
+ if (v = t.props, y = D.prototype && D.prototype.render, b = (u = D.contextType) && r[u.__c], x = u ? b ? b.props.value : u.__ : r, n.__c ? _ = (f = t.__c = n.__c).__ = f.__E : (y ? t.__c = f = new D(v, x) : (t.__c = f = new de(v, x), f.constructor = D, f.render = je), b && b.sub(f), f.state || (f.state = {}), f.__n = r, p = f.__d = !0, f.__h = [], f._sb = []), y && f.__s == null && (f.__s = f.state), y && D.getDerivedStateFromProps != null && (f.__s == f.state && (f.__s = P({}, f.__s)), P(f.__s, D.getDerivedStateFromProps(v, f.__s))), m = f.props, h = f.state, f.__v = t, p) y && D.getDerivedStateFromProps == null && f.componentWillMount != null && f.componentWillMount(), y && f.componentDidMount != null && f.__h.push(f.componentDidMount);
else {
if (y && D.getDerivedStateFromProps == null && v !== m && f.componentWillReceiveProps != null && f.componentWillReceiveProps(v, x), t.__v == n.__v || !f.__e && f.shouldComponentUpdate != null && !1 === f.shouldComponentUpdate(v, f.__s, x)) {
t.__v != n.__v && (f.props = v, f.state = f.__s, f.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {
e && (e.__ = t);
- }), ae.push.apply(f.__h, f._sb), f._sb = [], f.__h.length && o.push(f), s = I(n);
+ }), ae.push.apply(f.__h, f._sb), f._sb = [], f.__h.length && o.push(f), s = fe(n);
break n;
}
f.componentWillUpdate != null && f.componentWillUpdate(v, f.__s, x), y && f.componentDidUpdate != null && f.__h.push(function() {
@@ -150,7 +150,7 @@ function Ce(e, t, n, r, i, a, o, s, c, l) {
else do
f.__d = !1, S && S(t), u = f.render(f.props, f.state, f.context), f.state = f.__s;
while (f.__d && ++C < 25);
- f.state = f.__s, f.getChildContext != null && (r = P(P({}, r), f.getChildContext())), y && !p && f.getSnapshotBeforeUpdate != null && (g = f.getSnapshotBeforeUpdate(m, h)), T = u != null && u.type === F && u.key == null ? Ee(u.props.children) : u, s = ge(e, se(T) ? T : [T], t, n, r, i, a, o, s, c, l), f.base = t.__e, t.__u &= -161, f.__h.length && o.push(f), _ && (f.__E = f.__ = null);
+ f.state = f.__s, f.getChildContext != null && (r = P(P({}, r), f.getChildContext())), y && !p && f.getSnapshotBeforeUpdate != null && (g = f.getSnapshotBeforeUpdate(m, h)), T = u != null && u.type === F && u.key == null ? De(u.props.children) : u, s = _e(e, se(T) ? T : [T], t, n, r, i, a, o, s, c, l), f.base = t.__e, t.__u &= -161, f.__h.length && o.push(f), _ && (f.__E = f.__ = null);
} catch (e) {
if (o.length = d, t.__v = null, c || a != null) {
if (e.then) {
@@ -158,16 +158,16 @@ function Ce(e, t, n, r, i, a, o, s, c, l) {
a != null && (a[a.indexOf(s)] = null), t.__e = s;
} else if (a != null) for (E = a.length; E--;) ce(a[E]);
} else t.__e = n.__e;
- t.__k ??= n.__k || [], e.then || we(t), w.__e(e, t, n);
+ t.__k ??= n.__k || [], e.then || Te(t), w.__e(e, t, n);
}
- } else a == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : s = t.__e = De(n.__e, t, n, r, i, a, o, c, l);
+ } else a == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : s = t.__e = Oe(n.__e, t, n, r, i, a, o, c, l);
return (u = w.diffed) && u(t), 128 & t.__u ? void 0 : s;
}
-function we(e) {
- e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(we));
+function Te(e) {
+ e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(Te));
}
-function Te(e, t, n) {
- for (var r = 0; r < n.length; r++) Oe(n[r], n[++r], n[++r]);
+function Ee(e, t, n) {
+ for (var r = 0; r < n.length; r++) ke(n[r], n[++r], n[++r]);
w.__c && w.__c(t, e), e.some(function(t) {
try {
e = t.__h, t.__h = [], e.some(function(e) {
@@ -178,10 +178,10 @@ function Te(e, t, n) {
}
});
}
-function Ee(e) {
- return typeof e != "object" || !e || e.__b > 0 ? e : se(e) ? e.map(Ee) : e.constructor === void 0 ? P({}, e) : null;
+function De(e) {
+ return typeof e != "object" || !e || e.__b > 0 ? e : se(e) ? e.map(De) : e.constructor === void 0 ? P({}, e) : null;
}
-function De(e, t, n, r, i, a, o, s, c) {
+function Oe(e, t, n, r, i, a, o, s, c) {
var l, u, d, f, p, m, h, g = n.props || ie, _ = t.props, v = t.type;
if (v == "svg" ? i = "http://www.w3.org/2000/svg" : v == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i ||= "http://www.w3.org/1999/xhtml", a != null) {
for (l = 0; l < a.length; l++) if ((p = a[l]) && "setAttribute" in p == !!v && (v ? p.localName == v : p.nodeType == 3)) {
@@ -196,15 +196,15 @@ function De(e, t, n, r, i, a, o, s, c) {
if (v == null) g === _ || s && e.data == _ || (e.data = _);
else {
if (a = v == "textarea" && _.defaultValue != null ? null : a && C.call(e.childNodes), !s && a != null) for (g = {}, l = 0; l < e.attributes.length; l++) g[(p = e.attributes[l]).name] = p.value;
- for (l in g) p = g[l], l == "dangerouslySetInnerHTML" ? d = p : l == "children" || l in _ || l == "value" && "defaultValue" in _ || l == "checked" && "defaultChecked" in _ || xe(e, l, null, p, i);
- for (l in _) p = _[l], l == "children" ? f = p : l == "dangerouslySetInnerHTML" ? u = p : l == "value" ? m = p : l == "checked" ? h = p : s && typeof p != "function" || g[l] === p || xe(e, l, p, g[l], i);
+ for (l in g) p = g[l], l == "dangerouslySetInnerHTML" ? d = p : l == "children" || l in _ || l == "value" && "defaultValue" in _ || l == "checked" && "defaultChecked" in _ || Se(e, l, null, p, i);
+ for (l in _) p = _[l], l == "children" ? f = p : l == "dangerouslySetInnerHTML" ? u = p : l == "value" ? m = p : l == "checked" ? h = p : s && typeof p != "function" || g[l] === p || Se(e, l, p, g[l], i);
if (u) s || d && (u.__html == d.__html || u.__html == e.innerHTML) || (e.innerHTML = u.__html), t.__k = [];
- else if (d && (e.innerHTML = ""), ge(t.type == "template" ? e.content : e, se(f) ? f : [f], t, n, r, v == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, a, o, a ? a[0] : n.__k && I(n, 0), s, c), a != null) for (l = a.length; l--;) ce(a[l]);
- s && v != "textarea" || (l = "value", v == "progress" && m == null ? e.removeAttribute("value") : m != null && (m !== e[l] || v == "progress" && !m || v == "option" && m != g[l]) && xe(e, l, m, g[l], i), l = "checked", h != null && h != e[l] && xe(e, l, h, g[l], i));
+ else if (d && (e.innerHTML = ""), _e(t.type == "template" ? e.content : e, se(f) ? f : [f], t, n, r, v == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, a, o, a ? a[0] : n.__k && fe(n, 0), s, c), a != null) for (l = a.length; l--;) ce(a[l]);
+ s && v != "textarea" || (l = "value", v == "progress" && m == null ? e.removeAttribute("value") : m != null && (m !== e[l] || v == "progress" && !m || v == "option" && m != g[l]) && Se(e, l, m, g[l], i), l = "checked", h != null && h != e[l] && Se(e, l, h, g[l], i));
}
return e;
}
-function Oe(e, t, n) {
+function ke(e, t, n) {
try {
if (typeof e == "function") {
var r = typeof e.__u == "function";
@@ -214,9 +214,9 @@ function Oe(e, t, n) {
w.__e(e, n);
}
}
-function ke(e, t, n) {
+function Ae(e, t, n) {
var r, i;
- if (w.unmount && w.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || Oe(r, null, t)), (r = e.__c) != null) {
+ if (w.unmount && w.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || ke(r, null, t)), (r = e.__c) != null) {
if (r.componentWillUnmount) try {
r.componentWillUnmount();
} catch (e) {
@@ -224,15 +224,15 @@ function ke(e, t, n) {
}
r.base = r.__P = r.__n = null;
}
- if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && ke(r[i], t, n || typeof e.type != "function");
+ if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && Ae(r[i], t, n || typeof e.type != "function");
n || ce(e.__e), e.__c = e.__ = e.__e = void 0;
}
-function Ae(e, t, n) {
+function je(e, t, n) {
return this.constructor(e, n);
}
-function je(e, t, n) {
+function Me(e, t, n) {
var r, i, a, o;
- t == document && (t = document.documentElement), w.__ && w.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], Ce(t, e = (!r && n || t).__k = le(F, null, [e]), i || ie, ie, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? C.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), Te(a, e, o), e.props.children = null;
+ t == document && (t = document.documentElement), w.__ && w.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], we(t, e = (!r && n || t).__k = le(F, null, [e]), i || ie, ie, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? C.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), Ee(a, e, o), e.props.children = null;
}
C = ae.slice, w = { __e: function(e, t, n, r) {
for (var i, a, o; t = t.__;) if ((i = t.__c) && !i.__) try {
@@ -245,20 +245,20 @@ C = ae.slice, w = { __e: function(e, t, n, r) {
return e != null && e.constructor === void 0;
}, de.prototype.setState = function(e, t) {
var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = P({}, this.state);
- typeof e == "function" && (e = e(P({}, n), this.props)), e && P(n, e), e != null && this.__v && (t && this._sb.push(t), me(this));
+ typeof e == "function" && (e = e(P({}, n), this.props)), e && P(n, e), e != null && this.__v && (t && this._sb.push(t), he(this));
}, de.prototype.forceUpdate = function(e) {
- this.__v && (this.__e = !0, e && this.__h.push(e), me(this));
+ this.__v && (this.__e = !0, e && this.__h.push(e), he(this));
}, de.prototype.render = F, D = [], k = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, A = function(e, t) {
return e.__v.__b - t.__v.__b;
-}, he.__r = 0, j = Math.random().toString(8), ee = "__d" + j, M = "__a" + j, te = /(PointerCapture)$|Capture$/i, ne = 0, re = Se(!1), N = Se(!0);
+}, ge.__r = 0, j = Math.random().toString(8), ee = "__d" + j, M = "__a" + j, te = /(PointerCapture)$|Capture$/i, ne = 0, re = Ce(!1), N = Ce(!0);
//#endregion
//#region src/sort-preferences.ts
-function Me(e, t, n) {
+function Ne(e, t, n) {
return e === "seed" ? "" : e === t && n === "asc" ? "asc" : "desc";
}
//#endregion
//#region src/number-setting.ts
-var Ne = {
+var Pe = {
loginDaysSetting: {
min: 1,
max: 365,
@@ -306,17 +306,17 @@ var Ne = {
fallback: 60
}
};
-function Pe(e, t, n, r) {
+function Fe(e, t, n, r) {
return Number.isInteger(e) && e >= t && e <= n ? e : r;
}
-function Fe(e, t, n) {
+function Ie(e, t, n) {
let r = e.querySelector("input[type=number]"), i = e.querySelector("[role=switch]"), a = e.querySelector(".board-number-fields");
r && (r.disabled = n, t !== null && t > 0 && (r.value = String(t))), i && (i.disabled = n, t !== null && (i.checked = t > 0)), a && t !== null && (a.hidden = t === 0);
}
-function Ie(e, t, n, r, i) {
- let a = Ne[t];
+function Le(e, t, n, r, i) {
+ let a = Pe[t];
if (!a) return !1;
- let { min: o, max: s, unit: c, optional: l, fallback: u } = a, d = `peach.number.${t}`, f = Pe(Number(localStorage.getItem(d)), o, s, r > 0 ? r : u), p = document.createElement("div");
+ let { min: o, max: s, unit: c, optional: l, fallback: u } = a, d = `peach.number.${t}`, f = Fe(Number(localStorage.getItem(d)), o, s, r > 0 ? r : u), p = document.createElement("div");
p.className = "board-optional-number";
let m = document.createElement("div");
m.className = "board-number-fields", m.hidden = !!l && r === 0;
@@ -351,37 +351,37 @@ function Ie(e, t, n, r, i) {
}
//#endregion
//#region src/board-metrics.ts
-var L = (e) => String(e ?? "").replace(/[&<>"']/g, (e) => ({
+var I = (e) => String(e ?? "").replace(/[&<>"']/g, (e) => ({
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
"\"": "&quot;",
"'": "&#39;"
})[e]);
-function Le(e, t, n, r = "chart-no-axes-combined") {
- return `<span class="board-stat-label"><span class="board-stat-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><use href="#i-${/^[a-z0-9-]+$/.test(r) ? r : "database"}"/></svg></span>${L(e)}</span><b class="board-stat-value">${L(t)}</b><small class="board-stat-footer">${L(n || "当前记录")}</small>`;
+function Re(e, t, n, r = "chart-no-axes-combined") {
+ return `<span class="board-stat-label"><span class="board-stat-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><use href="#i-${/^[a-z0-9-]+$/.test(r) ? r : "database"}"/></svg></span>${I(e)}</span><b class="board-stat-value">${I(t)}</b><small class="board-stat-footer">${I(n || "当前记录")}</small>`;
}
-function Re(e, t, n) {
+function ze(e, t, n) {
if (!Number.isFinite(n) || n <= 0) return "";
let r = Math.max(0, Math.min(n, Number.isFinite(t) ? t : 0)), i = r / n * 100;
- return `<div class="board-job-progress" role="progressbar" aria-label="${L(e)}" aria-valuemin="0" aria-valuemax="${n}" aria-valuenow="${r}"><svg width="36" height="36" viewBox="0 0 36 36" aria-hidden="true"><circle class="board-job-track" cx="18" cy="18" r="15"/><circle class="board-job-fill" cx="18" cy="18" r="15" pathLength="100" stroke-dasharray="${i} ${100 - i}" transform="rotate(-90 18 18)"/></svg><span>${L(e)}<small>${Math.round(i)}%</small></span></div>`;
+ return `<div class="board-job-progress" role="progressbar" aria-label="${I(e)}" aria-valuemin="0" aria-valuemax="${n}" aria-valuenow="${r}"><svg width="36" height="36" viewBox="0 0 36 36" aria-hidden="true"><circle class="board-job-track" cx="18" cy="18" r="15"/><circle class="board-job-fill" cx="18" cy="18" r="15" pathLength="100" stroke-dasharray="${i} ${100 - i}" transform="rotate(-90 18 18)"/></svg><span>${I(e)}<small>${Math.round(i)}%</small></span></div>`;
}
-function ze(e, t) {
+function Be(e, t) {
let n = e.filter((e) => Number.isFinite(e.score) && e.score > 0), r = n.reduce((e, t) => e + t.score, 0);
if (!r) return "";
let i = 0, a = n.map((e, t) => {
- let n = e.score / r * 100, a = `<circle cx="100" cy="100" r="72" pathLength="100" fill="none" stroke="var(--chart-${t % 4})" stroke-width="22" stroke-dasharray="${n} ${100 - n}" stroke-dashoffset="${-i}"><title>${L(e.name)}:${e.score.toLocaleString()}</title></circle>`;
+ let n = e.score / r * 100, a = `<circle cx="100" cy="100" r="72" pathLength="100" fill="none" stroke="var(--chart-${t % 4})" stroke-width="22" stroke-dasharray="${n} ${100 - n}" stroke-dashoffset="${-i}"><title>${I(e.name)}:${e.score.toLocaleString()}</title></circle>`;
return i += n, a;
}).join("");
- return `<svg class="board-distribution" viewBox="0 0 200 200" role="img" aria-label="${L(t)}"><g transform="rotate(-90 100 100)">${a}</g><text x="100" y="100" text-anchor="middle" dominant-baseline="middle">${L(t)}</text></svg>`;
+ return `<svg class="board-distribution" viewBox="0 0 200 200" role="img" aria-label="${I(t)}"><g transform="rotate(-90 100 100)">${a}</g><text x="100" y="100" text-anchor="middle" dominant-baseline="middle">${I(t)}</text></svg>`;
}
-function Be(e, t) {
+function Ve(e, t) {
let n = e.filter((e) => Number.isFinite(e.score) && e.score > 0).slice().sort((e, t) => t.score - e.score).slice(0, 8);
if (!n.length) return "";
- let r = n[0].score, i = n.map((e) => `<li><span class="board-rank-fill" style="width:${(e.score / r * 100).toFixed(2)}%"></span><span>${L(e.name)}</span><b>${e.score.toLocaleString()}</b></li>`).join("");
- return `<ol class="board-ranked-chart" aria-label="${L(t)}">${i}</ol>`;
+ let r = n[0].score, i = n.map((e) => `<li><span class="board-rank-fill" style="width:${(e.score / r * 100).toFixed(2)}%"></span><span>${I(e.name)}</span><b>${e.score.toLocaleString()}</b></li>`).join("");
+ return `<ol class="board-ranked-chart" aria-label="${I(t)}">${i}</ol>`;
}
-function Ve(e, t) {
+function He(e, t) {
let n = e.filter((e) => Number.isFinite(e.score) && e.score > 0).slice().sort((e, t) => t.score - e.score).slice(0, 6);
if (n.length < 3) return "";
let r = Math.max(...n.map((e) => e.score)), i = n.length, a = (e, t) => {
@@ -394,30 +394,30 @@ function Ve(e, t) {
100
].map((e) => `<polygon points="${o(() => e)}" class="board-radar-grid"/>`).join(""), c = n.map((e, t) => {
let [n, r] = a(t, 116);
- return `<text x="${n}" y="${r}" text-anchor="${n < 145 ? "end" : n > 175 ? "start" : "middle"}">${L(e.name)}</text>`;
+ return `<text x="${n}" y="${r}" text-anchor="${n < 145 ? "end" : n > 175 ? "start" : "middle"}">${I(e.name)}</text>`;
}).join("");
- return `<svg class="board-radar" viewBox="0 0 320 280" role="img" aria-label="${L(t)}"><title>${L(n.map((e) => `${e.name} ${e.score}`).join(","))}</title>${s}<polygon points="${o((e) => n[e].score / r * 100)}" class="board-radar-value"/>${c}</svg>`;
+ return `<svg class="board-radar" viewBox="0 0 320 280" role="img" aria-label="${I(t)}"><title>${I(n.map((e) => `${e.name} ${e.score}`).join(","))}</title>${s}<polygon points="${o((e) => n[e].score / r * 100)}" class="board-radar-value"/>${c}</svg>`;
}
//#endregion
//#region node_modules/preact/hooks/dist/hooks.module.js
-var He, R, Ue, We, Ge = 0, Ke = [], z = w, qe = z.__b, Je = z.__r, Ye = z.diffed, Xe = z.__c, Ze = z.unmount, Qe = z.__;
-function $e(e, t) {
- z.__h && z.__h(R, e, Ge || t), Ge = 0;
- var n = R.__H || (R.__H = {
+var Ue, L, We, Ge, Ke = 0, qe = [], R = w, Je = R.__b, Ye = R.__r, Xe = R.diffed, Ze = R.__c, Qe = R.unmount, $e = R.__;
+function et(e, t) {
+ R.__h && R.__h(L, e, Ke || t), Ke = 0;
+ var n = L.__H || (L.__H = {
__: [],
__h: []
});
return e >= n.__.length && n.__.push({}), n.__[e];
}
-function B(e) {
- return Ge = 1, et(lt, e);
+function z(e) {
+ return Ke = 1, tt(ut, e);
}
-function et(e, t, n) {
- var r = $e(He++, 2);
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : lt(void 0, t), function(e) {
+function tt(e, t, n) {
+ var r = et(Ue++, 2);
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : ut(void 0, t), function(e) {
var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
- }], r.__c = R, !R.__f)) {
+ }], r.__c = L, !L.__f)) {
var i = function(e, t, n) {
if (!r.__c.__H) return !0;
var i = !1, o = r.__c.props !== e;
@@ -433,116 +433,116 @@ function et(e, t, n) {
}
return !i || o;
};
- R.__f = !0;
- var a = R.shouldComponentUpdate, o = R.componentWillUpdate;
- R.componentWillUpdate = function(e, t, n) {
+ L.__f = !0;
+ var a = L.shouldComponentUpdate, o = L.componentWillUpdate;
+ L.componentWillUpdate = function(e, t, n) {
if (this.__e) {
var r = a;
a = void 0, i(e, t, n), a = r;
}
o && o.call(this, e, t, n);
- }, R.shouldComponentUpdate = i;
+ }, L.shouldComponentUpdate = i;
}
return r.__N || r.__;
}
-function V(e, t) {
- var n = $e(He++, 3);
- !z.__s && ct(n.__H, t) && (n.__ = e, n.u = t, R.__H.__h.push(n));
+function B(e, t) {
+ var n = et(Ue++, 3);
+ !R.__s && lt(n.__H, t) && (n.__ = e, n.u = t, L.__H.__h.push(n));
}
-function tt(e, t) {
- var n = $e(He++, 4);
- !z.__s && ct(n.__H, t) && (n.__ = e, n.u = t, R.__h.push(n));
+function nt(e, t) {
+ var n = et(Ue++, 4);
+ !R.__s && lt(n.__H, t) && (n.__ = e, n.u = t, L.__h.push(n));
}
-function H(e) {
- return Ge = 5, nt(function() {
+function V(e) {
+ return Ke = 5, rt(function() {
return { current: e };
}, []);
}
-function nt(e, t) {
- var n = $e(He++, 7);
- return ct(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
+function rt(e, t) {
+ var n = et(Ue++, 7);
+ return lt(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
}
-function rt() {
- for (var e; e = Ke.shift();) {
+function it() {
+ for (var e; e = qe.shift();) {
var t = e.__H;
if (e.__P && t) try {
- t.__h.some(ot), t.__h.some(st), t.__h = [];
+ t.__h.some(st), t.__h.some(ct), t.__h = [];
} catch (n) {
- t.__h = [], z.__e(n, e.__v);
+ t.__h = [], R.__e(n, e.__v);
}
}
}
-z.__b = function(e) {
- R = null, qe && qe(e);
-}, z.__ = function(e, t) {
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Qe && Qe(e, t);
-}, z.__r = function(e) {
- Je && Je(e), He = 0;
- var t = (R = e.__c).__H;
- t && (Ue === R ? (t.__h = [], R.__h = [], t.__.some(function(e) {
+R.__b = function(e) {
+ L = null, Je && Je(e);
+}, R.__ = function(e, t) {
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), $e && $e(e, t);
+}, R.__r = function(e) {
+ Ye && Ye(e), Ue = 0;
+ var t = (L = e.__c).__H;
+ t && (We === L ? (t.__h = [], L.__h = [], t.__.some(function(e) {
e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
- })) : (t.__h.some(ot), t.__h.some(st), t.__h = [], He = 0)), Ue = R;
-}, z.diffed = function(e) {
- Ye && Ye(e);
+ })) : (t.__h.some(st), t.__h.some(ct), t.__h = [], Ue = 0)), We = L;
+}, R.diffed = function(e) {
+ Xe && Xe(e);
var t = e.__c;
- t && t.__H && (t.__H.__h.length && (Ke.push(t) !== 1 && We === z.requestAnimationFrame || ((We = z.requestAnimationFrame) || at)(rt)), t.__H.__.some(function(e) {
+ t && t.__H && (t.__H.__h.length && (qe.push(t) !== 1 && Ge === R.requestAnimationFrame || ((Ge = R.requestAnimationFrame) || ot)(it)), t.__H.__.some(function(e) {
e.u &&= (e.__H = e.u, void 0);
- })), Ue = R = null;
-}, z.__c = function(e, t) {
+ })), We = L = null;
+}, R.__c = function(e, t) {
t.some(function(e) {
try {
- e.__h.some(ot), e.__h = e.__h.filter(function(e) {
- return !e.__ || st(e);
+ e.__h.some(st), e.__h = e.__h.filter(function(e) {
+ return !e.__ || ct(e);
});
} catch (n) {
t.some(function(e) {
e.__h &&= [];
- }), t = [], z.__e(n, e.__v);
+ }), t = [], R.__e(n, e.__v);
}
- }), Xe && Xe(e, t);
-}, z.unmount = function(e) {
- Ze && Ze(e);
+ }), Ze && Ze(e, t);
+}, R.unmount = function(e) {
+ Qe && Qe(e);
var t, n = e.__c;
n && n.__H && (n.__H.__.some(function(e) {
try {
- ot(e);
+ st(e);
} catch (e) {
t = e;
}
- }), n.__H = void 0, t && z.__e(t, n.__v));
+ }), n.__H = void 0, t && R.__e(t, n.__v));
};
-var it = typeof requestAnimationFrame == "function";
-function at(e) {
+var at = typeof requestAnimationFrame == "function";
+function ot(e) {
var t, n = function() {
- clearTimeout(r), it && cancelAnimationFrame(t), setTimeout(e);
+ clearTimeout(r), at && cancelAnimationFrame(t), setTimeout(e);
}, r = setTimeout(n, 35);
- it && (t = requestAnimationFrame(n));
-}
-function ot(e) {
- var t = R, n = e.__c;
- typeof n == "function" && (e.__c = void 0, n()), R = t;
+ at && (t = requestAnimationFrame(n));
}
function st(e) {
- var t = R;
- e.__c = e.__(), R = t;
+ var t = L, n = e.__c;
+ typeof n == "function" && (e.__c = void 0, n()), L = t;
+}
+function ct(e) {
+ var t = L;
+ e.__c = e.__(), L = t;
}
-function ct(e, t) {
+function lt(e, t) {
return !e || e.length !== t.length || t.some(function(t, n) {
return t !== e[n];
});
}
-function lt(e, t) {
+function ut(e, t) {
return typeof t == "function" ? t(e) : t;
}
//#endregion
//#region src/api.ts
-var ut = class extends Error {
+var dt = class extends Error {
status;
body;
constructor(e, t, n = null) {
super(a(e, t)), this.name = "ApiError", this.status = t, this.body = n;
}
-}, dt = (e) => {
+}, ft = (e) => {
if (!e || typeof e != "object") return "";
let t = e;
for (let e of [
@@ -554,8 +554,8 @@ var ut = class extends Error {
if (typeof n == "string" && n) return n;
}
return "";
-}, U = (e) => a(e);
-async function W(e, t) {
+}, H = (e) => a(e);
+async function U(e, t) {
let n = await fetch(e, {
headers: { Accept: "application/json" },
credentials: "same-origin",
@@ -564,10 +564,10 @@ async function W(e, t) {
try {
r = await n.json();
} catch {}
- if (!n.ok) throw new ut(dt(r) || `请求失败(${n.status})`, n.status);
+ if (!n.ok) throw new dt(ft(r) || `请求失败(${n.status})`, n.status);
return r;
}
-async function ft(e, t, n = "POST", r) {
+async function pt(e, t, n = "POST", r) {
let i = await fetch(e, {
method: n,
...r ? { signal: r } : {},
@@ -581,15 +581,15 @@ async function ft(e, t, n = "POST", r) {
try {
a = await i.json();
} catch {}
- if (!i.ok) throw new ut(dt(a) || `请求失败(${i.status})`, i.status, a);
+ if (!i.ok) throw new dt(ft(a) || `请求失败(${i.status})`, i.status, a);
return a;
}
//#endregion
//#region src/jobs.ts
-function pt(e, t = 0, n = 0) {
- return n > 0 ? Re(e, t, n) : p(e);
+function mt(e, t = 0, n = 0) {
+ return n > 0 ? ze(e, t, n) : p(e);
}
-async function mt(e) {
+async function ht(e) {
let t = e.pause || ((e) => new Promise((t) => setTimeout(t, e))), n = 0;
for (; e.active();) {
let r;
@@ -604,14 +604,14 @@ async function mt(e) {
await t(2e3);
}
}
-function ht(e) {
+function gt(e) {
let t = e.note || ((e) => h(e, {
label: "任务状态",
variant: "error"
- })), n = e.loading || p, r = e.progress || ((e, t, n) => pt(n || `已处理 ${e} / ${t}`, e, t)), i = e.container || ((e) => `<section class="followtask" data-geist-fieldset aria-label="任务进度"><div class="geist-fieldset-content">${e}</div></section>`), a = document.createElement("div");
+ })), n = e.loading || p, r = e.progress || ((e, t, n) => mt(n || `已处理 ${e} / ${t}`, e, t)), i = e.container || ((e) => `<section class="followtask" data-geist-fieldset aria-label="任务进度"><div class="geist-fieldset-content">${e}</div></section>`), a = document.createElement("div");
e.host.hidden = !0, a.dataset.followJob = "", a.setAttribute("aria-live", "polite"), e.host.prepend(a);
let o = e.storageKey || "peach-follow-job", s = sessionStorage.getItem(o) || void 0, c = !1;
- mt({
+ ht({
read: e.read,
active: () => !c && e.active() && a.isConnected,
keepWatching: e.watchIdle !== !1,
@@ -637,9 +637,9 @@ function ht(e) {
}
//#endregion
//#region node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
-var gt = 0;
+var _t = 0;
Array.isArray;
-function G(e, t, n, r, i, a) {
+function W(e, t, n, r, i, a) {
t ||= {};
var o, s, c = t;
if ("ref" in c) for (s in c = {}, t) s == "ref" ? o = t[s] : c[s] = t[s];
@@ -654,7 +654,7 @@ function G(e, t, n, r, i, a) {
__e: null,
__c: null,
constructor: void 0,
- __v: --gt,
+ __v: --_t,
__i: -1,
__u: 0,
__source: i,
@@ -665,35 +665,35 @@ function G(e, t, n, r, i, a) {
}
//#endregion
//#region src/link-button.tsx
-function _t({ href: e, children: t }) {
- return /* @__PURE__ */ G("a", {
+function vt({ href: e, children: t }) {
+ return /* @__PURE__ */ W("a", {
class: "board-link-button",
href: e,
- children: [/* @__PURE__ */ G("span", { children: t }), /* @__PURE__ */ G("svg", {
+ children: [/* @__PURE__ */ W("span", { children: t }), /* @__PURE__ */ W("svg", {
viewBox: "0 0 24 24",
"aria-hidden": "true",
- children: /* @__PURE__ */ G("use", { href: "#i-arrow-up" })
+ children: /* @__PURE__ */ W("use", { href: "#i-arrow-up" })
})]
});
}
//#endregion
//#region src/split-action.tsx
-function vt({ id: e, label: t, actions: n, busy: r }) {
- let i = H(null), a = H();
- tt(() => {
+function yt({ id: e, label: t, actions: n, busy: r }) {
+ let i = V(null), a = V();
+ nt(() => {
let e = i.current;
return a.current = b(e, e.querySelector(".splittoggle"), e.querySelector("[role=menu]")), () => a.current?.setOpen(!1);
- }, []), tt(() => {
+ }, []), nt(() => {
i.current?.querySelectorAll("button").forEach((e) => y(e, r)), r && a.current?.setOpen(!1);
}, [r]);
- let o = (e) => /* @__PURE__ */ G("svg", {
+ let o = (e) => /* @__PURE__ */ W("svg", {
viewBox: "0 0 24 24",
"aria-hidden": "true",
- children: /* @__PURE__ */ G("use", { href: `#i-${e}` })
+ children: /* @__PURE__ */ W("use", { href: `#i-${e}` })
}), s = (e) => {
r || (a.current?.setOpen(!1), e.run());
};
- return /* @__PURE__ */ G("div", {
+ return /* @__PURE__ */ W("div", {
ref: i,
class: "splitbutton board-button-group primary",
onClickCapture: (e) => {
@@ -710,13 +710,13 @@ function vt({ id: e, label: t, actions: n, busy: r }) {
e.key === "Tab" && a.current?.setOpen(!1);
},
children: [
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ W("button", {
type: "button",
class: "splitmain geist-button primary",
onClick: () => s(n[0]),
children: [o(n[0].icon), n[0].label]
}),
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ W("button", {
type: "button",
class: "splittoggle geist-button primary",
"aria-label": t,
@@ -725,16 +725,16 @@ function vt({ id: e, label: t, actions: n, busy: r }) {
"aria-controls": e,
children: o("chevron-down")
}),
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ W("div", {
class: "popmenu cardmenupanel",
id: e,
role: "menu",
hidden: !0,
- children: n.map((e) => /* @__PURE__ */ G("button", {
+ children: n.map((e) => /* @__PURE__ */ W("button", {
type: "button",
role: "menuitem",
onClick: () => s(e),
- children: [o(e.icon), /* @__PURE__ */ G("span", { children: e.label })]
+ children: [o(e.icon), /* @__PURE__ */ W("span", { children: e.label })]
}, e.label))
})
]
@@ -742,58 +742,65 @@ function vt({ id: e, label: t, actions: n, busy: r }) {
}
//#endregion
//#region src/islands/library-processing.tsx
-var yt = (e, t) => W("/api/library-processing", t), bt = {
+var bt = (e, t) => U("/api/library-processing", t), xt = {
reading_local: "读取本地资料",
querying_metadata: "查询外部资料",
fetching_cover: "采集缺失封面",
writing_candidates: "保存资料候选"
+}, St = {
+ querying_metadata: "没有资料",
+ fetching_cover: "没有封面"
};
-function xt(e) {
- let t = bt[e.current_action || ""] || e.stage || "正在处理", n = e.waited_seconds ? ` · 已等待 ${e.waited_seconds} 秒` : "";
+function Ct(e) {
+ let t = Object.entries(e).filter(([e, t]) => St[e] && t > 0).map(([e, t]) => `${St[e]} ${t} 部`);
+ return t.length ? `外部来源${t.join("、")},7 天内不再问。` : "";
+}
+function wt(e) {
+ let t = xt[e.current_action || ""] || e.stage || "正在处理", n = e.waited_seconds ? ` · 已等待 ${e.waited_seconds} 秒` : "";
return e.current_asset_name ? `当前:${e.current_asset_name} · ${t}${n}` : t + n;
}
-var St = "peach.library-processing.announced", Ct = 120;
-function wt(e, t, n) {
+var Tt = "peach.library-processing.announced", Et = 120;
+function Dt(e, t, n) {
if (e.status !== "complete") return;
- let r = !!e.job_id && !!e.completed_at && Date.now() / 1e3 - e.completed_at < Ct;
+ let r = !!e.job_id && !!e.completed_at && Date.now() / 1e3 - e.completed_at < Et;
if (!(!n && !r)) {
try {
- if (e.job_id && localStorage.getItem(St) === e.job_id) return;
- e.job_id && localStorage.setItem(St, e.job_id);
+ if (e.job_id && localStorage.getItem(Tt) === e.job_id) return;
+ e.job_id && localStorage.setItem(Tt, e.job_id);
} catch {}
t(`扫描与资料采集已完成:识别 ${e.identified || 0} 个番号,整理 ${e.candidates || 0} 组资料候选`);
}
}
-function Tt({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a, preview: o }) {
- let [s, c] = B(e || { status: "idle" }), [l, u] = B(t), [d, p] = B(!1), [m, _] = B(!1), v = H(new AbortController()), y = H(0), b = H(s.status), S = H(null);
- V(() => {
+function Ot({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a, preview: o }) {
+ let [s, c] = z(e || { status: "idle" }), [l, u] = z(t), [d, p] = z(!1), [m, _] = z(!1), v = V(new AbortController()), y = V(0), b = V(s.status), S = V(null);
+ B(() => {
S.current && x(S.current, ".geist-note-details", "library-issues");
}, [s, l]);
let C = d || s.status === "running";
async function w() {
let e = ++y.current;
- await mt({
- read: (e) => W("/api/library-processing", e),
+ await ht({
+ read: (e) => U("/api/library-processing", e),
active: () => !v.current.signal.aborted && y.current === e,
keepWatching: i === "notice" || !!a,
render: (e) => {
c(e), u("");
let t = e.status === "complete" && b.current === "running";
- t && i !== "notice" && _(!0), (t || i === "notice") && wt(e, n, t), b.current === "running" && (e.status === "complete" || e.status === "failed") && r?.(), b.current = e.status;
+ t && i !== "notice" && _(!0), (t || i === "notice") && Dt(e, n, t), b.current === "running" && (e.status === "complete" || e.status === "failed") && r?.(), b.current = e.status;
},
disconnected: () => u("连接中断,正在重新读取处理进度")
});
}
- V(() => (!o && (s.status === "running" || i === "notice" || a) && w(), () => v.current.abort()), []);
+ B(() => (!o && (s.status === "running" || i === "notice" || a) && w(), () => v.current.abort()), []);
async function T(e) {
if (!(C || o)) {
p(!0), u(""), _(!1);
try {
- let t = await ft("/api/library-processing", e, "POST", v.current.signal);
+ let t = await pt("/api/library-processing", e, "POST", v.current.signal);
if (v.current.signal.aborted) return;
b.current = t.status, c(t), p(!1), await w();
} catch (e) {
- v.current.signal.aborted || (u(U(e)), p(!1));
+ v.current.signal.aborted || (u(H(e)), p(!1));
}
}
}
@@ -805,8 +812,8 @@ function Tt({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a, p
};
if (i === "notice") {
if (!l && s.status !== "running" && s.status !== "failed") return null;
- let e = l || (s.status === "failed" ? "扫描与资料采集未完成" : xt(s) + (s.total ? ` · ${s.checked || 0} / ${s.total}` : ""));
- return /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: g(e, {
+ let e = l || (s.status === "failed" ? "扫描与资料采集未完成" : wt(s) + (s.total ? ` · ${s.checked || 0} / ${s.total}` : ""));
+ return /* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: g(e, {
variant: s.status === "failed" ? "error" : l || s.stalled ? "warning" : "gray",
href: "/data-cleanup#libraryProcessing",
label: l || s.status === "failed" ? "查看并处理" : "查看进度",
@@ -814,8 +821,8 @@ function Tt({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a, p
...s.status === "running" && s.total !== void 0 ? { max: s.total } : {}
}) } });
}
- let O = s.issue_preview || [], k = s.status === "failed" && !!s.retryable_asset_ids?.length, A = O.length ? {
- label: s.issues_truncated ? `${s.status === "complete" ? "采集记录" : "问题清单"}:共 ${s.issue_count || 0} 项,展开查看前 ${O.length} 项` : `${s.status === "complete" ? "采集记录" : "问题清单"}:共 ${s.issue_count || 0} 项`,
+ let O = s.issue_preview || [], k = Ct(s.notes || {}), A = s.status === "failed" && !!s.retryable_asset_ids?.length, j = O.length ? {
+ label: s.issues_truncated ? `问题清单:共 ${s.issue_count || 0} 项,展开查看前 ${O.length} 项` : `问题清单:共 ${s.issue_count || 0} 项`,
items: O.map((e) => ({
label: e.title || (e.asset_id ? `视频 ${e.asset_id}` : "媒体来源"),
href: e.asset_id ? `/item/${e.asset_id}` : "",
@@ -824,33 +831,33 @@ function Tt({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a, p
})),
footnote: s.issues_log ? `完整记录:${s.issues_log}` : ""
} : null;
- return /* @__PURE__ */ G(F, { children: [/* @__PURE__ */ G("section", {
+ return /* @__PURE__ */ W(F, { children: [/* @__PURE__ */ W("section", {
class: "cleanupfieldset",
"data-geist-fieldset": !0,
"aria-labelledby": "cleanupScrapingTitle",
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ W("div", {
class: "geist-fieldset-content library-processing",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: f("cleanupScrapingTitle", "扫描与采集") } }),
- /* @__PURE__ */ G("p", { children: "扫描媒体文件夹,导入已有资料,采集缺失信息。两段也可以分开跑:新盘刚接上时先只扫描,几万个文件登记完就能用;采集被网络拖住时只重跑采集,不必再扫一遍磁盘。" }),
- s.status === "running" && /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: f("cleanupScrapingTitle", "扫描与采集") } }),
+ /* @__PURE__ */ W("p", { children: "扫描媒体文件夹,导入已有资料,采集缺失信息。两段也可以分开跑:新盘刚接上时先只扫描,几万个文件登记完就能用;采集被网络拖住时只重跑采集,不必再扫一遍磁盘。" }),
+ s.status === "running" && /* @__PURE__ */ W("div", {
"aria-live": "polite",
- dangerouslySetInnerHTML: { __html: pt(s.total ? `${xt(s)} · ${s.checked || 0} / ${s.total} 个视频` : xt(s), s.checked, s.total) }
+ dangerouslySetInnerHTML: { __html: mt(s.total ? `${wt(s)} · ${s.checked || 0} / ${s.total} 个视频` : wt(s), s.checked, s.total) }
})
]
- }), /* @__PURE__ */ G("footer", {
+ }), /* @__PURE__ */ W("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
children: [
- /* @__PURE__ */ G(_t, {
+ /* @__PURE__ */ W(vt, {
href: "/scraping",
children: "来源和凭证"
}),
- !!s.candidates && /* @__PURE__ */ G(_t, {
+ !!s.candidates && /* @__PURE__ */ W(vt, {
href: "/review",
children: "复核资料"
}),
- (s.status !== "failed" || !k) && /* @__PURE__ */ G(vt, {
+ (s.status !== "failed" || !A) && /* @__PURE__ */ W(yt, {
id: "libraryProcessingMenu",
label: "更多扫描与采集方式",
busy: C,
@@ -874,12 +881,12 @@ function Tt({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a, p
})
]
})]
- }), /* @__PURE__ */ G("div", {
+ }), /* @__PURE__ */ W("div", {
class: "library-processing-outcome",
"aria-live": "polite",
ref: S,
children: [
- s.status === "running" && s.stalled && /* @__PURE__ */ G("div", {
+ s.status === "running" && s.stalled && /* @__PURE__ */ W("div", {
class: "library-processing-stalled",
dangerouslySetInnerHTML: { __html: h("这个项目处理时间较长,暂时没有新进展。可以继续等待,或在任务结束后重试未完成项。", {
variant: "warning",
@@ -887,7 +894,7 @@ function Tt({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a, p
filled: !0
}) }
}),
- (l || s.status === "failed") && /* @__PURE__ */ G("div", {
+ (l || s.status === "failed") && /* @__PURE__ */ W("div", {
role: "alert",
onClick: (e) => {
e.target.closest("[data-note-action]") && D();
@@ -895,33 +902,30 @@ function Tt({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a, p
dangerouslySetInnerHTML: { __html: h(l || s.error || "处理未完成,请重试", {
variant: "error",
filled: !0,
- actionLabel: k ? "重试未完成项" : "",
- details: A
+ actionLabel: A ? "重试未完成项" : "",
+ details: j
}) }
}),
- m && /* @__PURE__ */ G("div", {
+ m && /* @__PURE__ */ W("div", {
class: "library-processing-result",
dangerouslySetInnerHTML: { __html: h(`已扫描 ${s.scanned || 0} 个文件,识别 ${s.identified || 0} 个番号,整理 ${s.candidates || 0} 组资料候选。`, {
variant: "success",
label: "处理完成"
}) }
}),
- s.status === "complete" && A && /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: h(`${s.issue_count || 0} 项采集记录`, {
- variant: "secondary",
- details: A
- }) } })
+ s.status !== "running" && !!k && /* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: h(k + (s.issues_log ? ` 完整记录:${s.issues_log}` : ""), { variant: "secondary" }) } })
]
})] });
}
//#endregion
//#region src/management.ts
-function Et(e) {
+function kt(e) {
return e.filter((e) => ["115", "pikpak"].includes(e.location) && (e.roots === void 0 || e.roots.length > 0)).map((e) => e.location);
}
-function Dt(e, t) {
+function At(e, t) {
return t.filter((t) => e.some((e) => e.location === t));
}
-function Ot() {
+function jt() {
let e = [
["人工复核", "square-check-big"],
["高清版", "sparkles"],
@@ -966,7 +970,7 @@ function Ot() {
<div class="resourcesyncfooter geist-fieldset-footer" data-geist-fieldset-footer><button class="resourceaction primary" type="button" disabled>检查文件</button></div>
</div></section></div>`;
}
-function kt(e, t = !1, n = !1) {
+function Mt(e, t = !1, n = !1) {
if (t || n) return "";
let r = "<svg class=\"externalmark\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><use href=\"#i-external-link\"></use></svg>";
return `<details class="taste-history-guide"${e ? " open" : ""}>
@@ -980,17 +984,17 @@ function kt(e, t = !1, n = !1) {
<button type="button" class="geist-button taste-guide-skip">跳过</button>
</div></details>`;
}
-var At = "peach-taste-guide-dismissed";
-function jt(e, t) {
+var Nt = "peach-taste-guide-dismissed";
+function Pt(e, t) {
x(e, ".taste-history-guide", "taste-guide-collapse");
let n = e.querySelector(".taste-history-guide");
n?.querySelector(".taste-guide-skip")?.addEventListener("click", () => {
- t.setItem(At, "1"), n.remove();
+ t.setItem(Nt, "1"), n.remove();
});
}
//#endregion
//#region src/board-state-preview.tsx
-var Mt = [
+var Ft = [
["idle", "待开始"],
["loading", "页面加载"],
["preparing", "准备任务"],
@@ -1002,9 +1006,9 @@ var Mt = [
["complete", "任务完成"],
["expired", "状态已失效"],
["paused", "来源已暂停"]
-], K = ({ html: e }) => /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: e } });
-function Nt() {
- let [e, t] = B("running"), [n, r] = B(0), [i, a] = B(document.documentElement.dataset.theme === "dark"), [o, s] = B(38), c = {
+], G = ({ html: e }) => /* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: e } });
+function It() {
+ let [e, t] = z("running"), [n, r] = z(0), [i, a] = z(document.documentElement.dataset.theme === "dark"), [o, s] = z(38), c = {
status: e === "failed" ? "failed" : [
"running",
"preparing",
@@ -1026,19 +1030,19 @@ function Nt() {
issues_log: e === "failed" ? "peach-data\\state\\library-processing-preview.issues.jsonl" : "",
retryable_asset_ids: e === "failed" ? [7] : []
}, l = e === "disconnected" ? "连接中断,正在重新读取处理进度" : "";
- return /* @__PURE__ */ G("main", {
+ return /* @__PURE__ */ W("main", {
class: "board-state-preview",
children: [
- /* @__PURE__ */ G("header", { children: [/* @__PURE__ */ G("div", { children: [/* @__PURE__ */ G("h1", { children: "运行状态预览" }), /* @__PURE__ */ G("p", { children: "演示数据 · 不连接任务接口,不执行扫描或写入。" })] }), /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ W("header", { children: [/* @__PURE__ */ W("div", { children: [/* @__PURE__ */ W("h1", { children: "运行状态预览" }), /* @__PURE__ */ W("p", { children: "演示数据 · 不连接任务接口,不执行扫描或写入。" })] }), /* @__PURE__ */ W("button", {
class: "geist-button",
onClick: () => {
document.documentElement.dataset.theme = i ? "light" : "dark", a(!i);
},
children: i ? "浅色" : "深色"
})] }),
- /* @__PURE__ */ G("nav", {
+ /* @__PURE__ */ W("nav", {
"aria-label": "演示状态",
- children: Mt.map(([i, a]) => /* @__PURE__ */ G("button", {
+ children: Ft.map(([i, a]) => /* @__PURE__ */ W("button", {
class: "geist-button",
"aria-pressed": e === i,
onClick: () => {
@@ -1047,29 +1051,29 @@ function Nt() {
children: a
}))
}),
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ W("div", {
class: "board-preview-tools",
- children: [/* @__PURE__ */ G("label", { children: [
+ children: [/* @__PURE__ */ W("label", { children: [
"任务进度 ",
- /* @__PURE__ */ G("input", {
+ /* @__PURE__ */ W("input", {
type: "range",
min: "0",
max: "100",
value: o,
onInput: (e) => s(Number(e.currentTarget.value))
}),
- /* @__PURE__ */ G("output", { children: [o, "%"] })
- ] }), /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ W("output", { children: [o, "%"] })
+ ] }), /* @__PURE__ */ W("button", {
class: "geist-button",
onClick: () => r(n + 1),
children: "重播状态"
})]
}),
- /* @__PURE__ */ G("section", {
+ /* @__PURE__ */ W("section", {
"aria-label": "页面横幅",
children: [
- /* @__PURE__ */ G("h2", { children: "全局任务横幅" }),
- /* @__PURE__ */ G(Tt, {
+ /* @__PURE__ */ W("h2", { children: "全局任务横幅" }),
+ /* @__PURE__ */ W(Ot, {
data: c,
error: l,
mode: "notice",
@@ -1083,17 +1087,17 @@ function Nt() {
"retrying",
"reconnected",
"failed"
- ].includes(e) && /* @__PURE__ */ G("p", { children: "此状态不常驻全局横幅。" })
+ ].includes(e) && /* @__PURE__ */ W("p", { children: "此状态不常驻全局横幅。" })
]
}),
- /* @__PURE__ */ G("section", { children: [
- /* @__PURE__ */ G("h2", { children: "数据管理 · 扫描与采集" }),
- e === "loading" ? /* @__PURE__ */ G(K, { html: Ot() }) : /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ W("section", { children: [
+ /* @__PURE__ */ W("h2", { children: "数据管理 · 扫描与采集" }),
+ e === "loading" ? /* @__PURE__ */ W(G, { html: jt() }) : /* @__PURE__ */ W("div", {
class: "cleanupgrid",
- children: /* @__PURE__ */ G("div", {
+ children: /* @__PURE__ */ W("div", {
id: "libraryProcessing",
class: "cleanupscraping",
- children: /* @__PURE__ */ G(Tt, {
+ children: /* @__PURE__ */ W(Ot, {
data: c,
error: l,
preview: !0,
@@ -1101,52 +1105,52 @@ function Nt() {
}, `${e}-${n}-${o}`)
})
}),
- e === "complete" && /* @__PURE__ */ G(K, { html: h("已完成扫描与资料采集", {
+ e === "complete" && /* @__PURE__ */ W(G, { html: h("已完成扫描与资料采集", {
variant: "success",
label: "任务完成"
}) }),
- e === "expired" && /* @__PURE__ */ G(K, { html: h("任务状态已失效,请重新发起任务", { variant: "warning" }) }),
- e === "paused" && /* @__PURE__ */ G("span", {
+ e === "expired" && /* @__PURE__ */ W(G, { html: h("任务状态已失效,请重新发起任务", { variant: "warning" }) }),
+ e === "paused" && /* @__PURE__ */ W("span", {
class: "sbadge paused",
children: "已暂停"
})
] }),
- /* @__PURE__ */ G("section", { children: [/* @__PURE__ */ G("h2", { children: "关注检查与资源同步" }), /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ W("section", { children: [/* @__PURE__ */ W("h2", { children: "关注检查与资源同步" }), /* @__PURE__ */ W("div", {
class: "board-preview-grid",
- children: [/* @__PURE__ */ G("article", { children: [/* @__PURE__ */ G("h3", { children: "检查更新" }), /* @__PURE__ */ G(K, { html: e === "disconnected" ? h("暂时无法读取进度,正在重新连接…", { label: "任务状态" }) : e === "failed" ? h("检查失败:来源连接超时", {
+ children: [/* @__PURE__ */ W("article", { children: [/* @__PURE__ */ W("h3", { children: "检查更新" }), /* @__PURE__ */ W(G, { html: e === "disconnected" ? h("暂时无法读取进度,正在重新连接…", { label: "任务状态" }) : e === "failed" ? h("检查失败:来源连接超时", {
variant: "error",
actionLabel: "重试"
- }) : e === "running" || e === "retrying" || e === "reconnected" ? Re(`${e === "retrying" ? "第 2/3 次尝试,8 秒后重试 · " : ""}已完成 ${o}/100 个来源`, o, 100) : e === "preparing" ? p("正在准备检查任务…") : h(e === "complete" ? "已完成检查" : e === "paused" ? "已暂停自动检查" : e === "expired" ? "任务状态已失效,请重新发起任务" : "等待开始", { variant: e === "complete" ? "success" : "secondary" }) })] }), /* @__PURE__ */ G("article", { children: [
- /* @__PURE__ */ G("h3", { children: "连接与恢复" }),
- /* @__PURE__ */ G(K, { html: g(e === "disconnected" ? "暂时无法连接服务器,正在重连" : e === "reconnected" ? "连接已恢复,继续读取任务进度" : "连接正常", {
+ }) : e === "running" || e === "retrying" || e === "reconnected" ? ze(`${e === "retrying" ? "第 2/3 次尝试,8 秒后重试 · " : ""}已完成 ${o}/100 个来源`, o, 100) : e === "preparing" ? p("正在准备检查任务…") : h(e === "complete" ? "已完成检查" : e === "paused" ? "已暂停自动检查" : e === "expired" ? "任务状态已失效,请重新发起任务" : "等待开始", { variant: e === "complete" ? "success" : "secondary" }) })] }), /* @__PURE__ */ W("article", { children: [
+ /* @__PURE__ */ W("h3", { children: "连接与恢复" }),
+ /* @__PURE__ */ W(G, { html: g(e === "disconnected" ? "暂时无法连接服务器,正在重连" : e === "reconnected" ? "连接已恢复,继续读取任务进度" : "连接正常", {
variant: e === "disconnected" ? "warning" : "gray",
href: "#",
label: "查看状态"
}) }),
- /* @__PURE__ */ G("p", { children: "失去连接只影响进度读取;恢复连接后继续展示任务状态。" })
+ /* @__PURE__ */ W("p", { children: "失去连接只影响进度读取;恢复连接后继续展示任务状态。" })
] })]
})] }),
- /* @__PURE__ */ G("section", { children: [/* @__PURE__ */ G("h2", { children: "错误与加载状态一览" }), /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ W("section", { children: [/* @__PURE__ */ W("h2", { children: "错误与加载状态一览" }), /* @__PURE__ */ W("div", {
class: "board-preview-grid",
children: [
- /* @__PURE__ */ G("article", { children: [/* @__PURE__ */ G("h3", { children: "读取失败" }), /* @__PURE__ */ G(K, { html: h("无法读取状态,请重试", {
+ /* @__PURE__ */ W("article", { children: [/* @__PURE__ */ W("h3", { children: "读取失败" }), /* @__PURE__ */ W(G, { html: h("无法读取状态,请重试", {
variant: "error",
actionLabel: "重试"
}) })] }),
- /* @__PURE__ */ G("article", { children: [/* @__PURE__ */ G("h3", { children: "来源离线" }), /* @__PURE__ */ G(K, { html: h("媒体来源离线,请检查挂载状态", { variant: "warning" }) })] }),
- /* @__PURE__ */ G("article", { children: [/* @__PURE__ */ G("h3", { children: "没有待处理内容" }), /* @__PURE__ */ G(K, { html: h("没有待处理内容", { variant: "secondary" }) })] }),
- /* @__PURE__ */ G("article", { children: [/* @__PURE__ */ G("h3", { children: "等待响应" }), /* @__PURE__ */ G(K, { html: p("正在读取来源状态") })] })
+ /* @__PURE__ */ W("article", { children: [/* @__PURE__ */ W("h3", { children: "来源离线" }), /* @__PURE__ */ W(G, { html: h("媒体来源离线,请检查挂载状态", { variant: "warning" }) })] }),
+ /* @__PURE__ */ W("article", { children: [/* @__PURE__ */ W("h3", { children: "没有待处理内容" }), /* @__PURE__ */ W(G, { html: h("没有待处理内容", { variant: "secondary" }) })] }),
+ /* @__PURE__ */ W("article", { children: [/* @__PURE__ */ W("h3", { children: "等待响应" }), /* @__PURE__ */ W(G, { html: p("正在读取来源状态") })] })
]
})] })
]
});
}
-function Pt(e) {
- je(le(Nt, {}), e);
+function Lt(e) {
+ Me(le(It, {}), e);
}
//#endregion
//#region src/board-controls.ts
-function Ft(e) {
+function Rt(e) {
let t = Number(e.min) || 0, n = Number(e.max) || 100, r = Number(e.value), i = n > t ? Math.max(0, Math.min(100, (r - t) / (n - t) * 100)) : 0;
e.style.setProperty("--board-range-value", `${i}%`);
let a = e.closest(".dual-range");
@@ -1156,17 +1160,17 @@ function Ft(e) {
let c = a.getBoundingClientRect(), l = s.getBoundingClientRect(), u = l.right > c.right ? c.right - l.right : l.left < c.left ? c.left - l.left : 0;
u && s.style.setProperty("--range-tip-shift", `${Math.round(u)}px`), a.querySelectorAll(".board-range-tip").forEach((e) => e.toggleAttribute("data-range-active", e === s));
}
-function It() {
+function zt() {
let e = (e) => {
- e.querySelectorAll("input[type=range]").forEach(Ft), Bt(e), Rt(e), Vt(e);
+ e.querySelectorAll("input[type=range]").forEach(Rt), Ut(e), Vt(e), Wt(e);
};
e(document), new MutationObserver((t) => {
- for (let n of t) for (let t of n.addedNodes) t instanceof Element && (t.matches("input[type=range]") && Ft(t), e(t));
+ for (let n of t) for (let t of n.addedNodes) t instanceof Element && (t.matches("input[type=range]") && Rt(t), e(t));
}).observe(document.body, {
subtree: !0,
childList: !0
}), document.addEventListener("input", (e) => {
- e.target instanceof HTMLInputElement && e.target.type === "range" && Ft(e.target);
+ e.target instanceof HTMLInputElement && e.target.type === "range" && Rt(e.target);
});
let t = document.createElement("div");
t.className = "board-tooltip", t.id = "board-control-tooltip", t.role = "tooltip", t.hidden = !0, document.body.append(t);
@@ -1187,8 +1191,8 @@ function It() {
e.key === "Escape" && o();
}), document.addEventListener("scroll", o, !0), window.addEventListener("resize", o);
}
-var Lt = /* @__PURE__ */ new Map();
-function Rt(e) {
+var Bt = /* @__PURE__ */ new Map();
+function Vt(e) {
let t = ".managebar-menu,.board-local-nav:not(.settingscard>.board-local-nav)", n = [...e.querySelectorAll(t)];
e instanceof HTMLElement && e.matches(t) && n.push(e), n.forEach((e) => {
if (e.hasAttribute("data-board-tabs")) return;
@@ -1202,8 +1206,8 @@ function Rt(e) {
left: r.offsetLeft,
width: r.offsetWidth
};
- n(i), Lt.set(t, i);
- }, i = Lt.get(t);
+ n(i), Bt.set(t, i);
+ }, i = Bt.get(t);
i ? n(i) : r(), requestAnimationFrame(() => {
e.classList.add("board-tabs-ready"), requestAnimationFrame(r);
});
@@ -1223,15 +1227,15 @@ function Rt(e) {
o.observe(e);
});
}
-var zt = /* @__PURE__ */ new Map();
-function Bt(e) {
+var Ht = /* @__PURE__ */ new Map();
+function Ut(e) {
let t = ".iconswitch,.insightswitch,.insighttabs,.follow-workspace-switch", n = [...e.querySelectorAll(t)];
e instanceof HTMLElement && e.matches(t) && n.push(e), n.forEach((e) => {
if (e.hasAttribute("data-board-segments") || e.closest("[data-skeleton]")) return;
e.dataset.boardSegments = "true";
let t = document.createElement("span");
t.className = "board-segment-thumb", t.setAttribute("aria-hidden", "true"), e.prepend(t);
- let n = e.className + (e.getAttribute("aria-label") ?? ""), r = zt.get(n) ?? null, i = () => {
+ let n = e.className + (e.getAttribute("aria-label") ?? ""), r = Ht.get(n) ?? null, i = () => {
let i = e.querySelector("label:has(input:checked),button[aria-selected=true]");
if (!i || !i.offsetWidth) return;
let a = {
@@ -1240,7 +1244,7 @@ function Bt(e) {
w: i.offsetWidth,
h: i.offsetHeight
};
- m(t, r, a, "x"), r = a, zt.set(n, a);
+ m(t, r, a, "x"), r = a, Ht.set(n, a);
};
e.addEventListener("change", i);
let a = new MutationObserver(i);
@@ -1259,7 +1263,7 @@ function Bt(e) {
o.observe(e), i(), requestAnimationFrame(() => e.classList.add("board-segments-ready"));
});
}
-function Vt(e) {
+function Wt(e) {
let t = ".board-ranked-chart,.board-radar,.tasteranks,.board-heat-card,.board-sankey-card", n = [...e.querySelectorAll(t)];
e instanceof HTMLElement && e.matches(t) && n.push(e), n.forEach((e) => {
if (e.hasAttribute("data-board-chart")) return;
@@ -1277,7 +1281,7 @@ function Vt(e) {
n.observe(e);
});
}
-function Ht(e) {
+function Gt(e) {
e.querySelectorAll(".tasteranks,.insightranking").forEach((e, t) => {
if (e.children.length <= 5 || e.parentElement?.hasAttribute("data-expandable-ranks")) return;
let n = document.createElement("div");
@@ -1309,7 +1313,7 @@ function Ht(e) {
}
//#endregion
//#region node_modules/d3-array/src/max.js
-function Ut(e, t) {
+function Kt(e, t) {
let n;
if (t === void 0) for (let t of e) t != null && (n < t || n === void 0 && t >= t) && (n = t);
else {
@@ -1320,7 +1324,7 @@ function Ut(e, t) {
}
//#endregion
//#region node_modules/d3-array/src/min.js
-function Wt(e, t) {
+function qt(e, t) {
let n;
if (t === void 0) for (let t of e) t != null && (n > t || n === void 0 && t >= t) && (n = t);
else {
@@ -1331,7 +1335,7 @@ function Wt(e, t) {
}
//#endregion
//#region node_modules/d3-array/src/sum.js
-function Gt(e, t) {
+function Jt(e, t) {
let n = 0;
if (t === void 0) for (let t of e) (t = +t) && (n += t);
else {
@@ -1342,66 +1346,66 @@ function Gt(e, t) {
}
//#endregion
//#region node_modules/d3-sankey/src/align.js
-function Kt(e, t) {
+function Yt(e, t) {
return e.sourceLinks.length ? e.depth : t - 1;
}
//#endregion
//#region node_modules/d3-sankey/src/constant.js
-function qt(e) {
+function Xt(e) {
return function() {
return e;
};
}
//#endregion
//#region node_modules/d3-sankey/src/sankey.js
-function Jt(e, t) {
- return Xt(e.source, t.source) || e.index - t.index;
+function Zt(e, t) {
+ return $t(e.source, t.source) || e.index - t.index;
}
-function Yt(e, t) {
- return Xt(e.target, t.target) || e.index - t.index;
+function Qt(e, t) {
+ return $t(e.target, t.target) || e.index - t.index;
}
-function Xt(e, t) {
+function $t(e, t) {
return e.y0 - t.y0;
}
-function Zt(e) {
+function en(e) {
return e.value;
}
-function Qt(e) {
+function tn(e) {
return e.index;
}
-function $t(e) {
+function nn(e) {
return e.nodes;
}
-function en(e) {
+function rn(e) {
return e.links;
}
-function tn(e, t) {
+function an(e, t) {
let n = e.get(t);
if (!n) throw Error("missing: " + t);
return n;
}
-function nn({ nodes: e }) {
+function on({ nodes: e }) {
for (let t of e) {
let e = t.y0, n = e;
for (let n of t.sourceLinks) n.y0 = e + n.width / 2, e += n.width;
for (let e of t.targetLinks) e.y1 = n + e.width / 2, n += e.width;
}
}
-function rn() {
- let e = 0, t = 0, n = 1, r = 1, i = 24, a = 8, o, s = Qt, c = Kt, l, u, d = $t, f = en, p = 6;
+function sn() {
+ let e = 0, t = 0, n = 1, r = 1, i = 24, a = 8, o, s = tn, c = Yt, l, u, d = nn, f = rn, p = 6;
function m() {
let e = {
nodes: d.apply(null, arguments),
links: f.apply(null, arguments)
};
- return h(e), g(e), _(e), v(e), x(e), nn(e), e;
+ return h(e), g(e), _(e), v(e), x(e), on(e), e;
}
m.update = function(e) {
- return nn(e), e;
+ return on(e), e;
}, m.nodeId = function(e) {
- return arguments.length ? (s = typeof e == "function" ? e : qt(e), m) : s;
+ return arguments.length ? (s = typeof e == "function" ? e : Xt(e), m) : s;
}, m.nodeAlign = function(e) {
- return arguments.length ? (c = typeof e == "function" ? e : qt(e), m) : c;
+ return arguments.length ? (c = typeof e == "function" ? e : Xt(e), m) : c;
}, m.nodeSort = function(e) {
return arguments.length ? (l = e, m) : l;
}, m.nodeWidth = function(e) {
@@ -1409,9 +1413,9 @@ function rn() {
}, m.nodePadding = function(e) {
return arguments.length ? (a = o = +e, m) : a;
}, m.nodes = function(e) {
- return arguments.length ? (d = typeof e == "function" ? e : qt(e), m) : d;
+ return arguments.length ? (d = typeof e == "function" ? e : Xt(e), m) : d;
}, m.links = function(e) {
- return arguments.length ? (f = typeof e == "function" ? e : qt(e), m) : f;
+ return arguments.length ? (f = typeof e == "function" ? e : Xt(e), m) : f;
}, m.linkSort = function(e) {
return arguments.length ? (u = e, m) : u;
}, m.size = function(i) {
@@ -1427,12 +1431,12 @@ function rn() {
for (let [e, r] of t.entries()) {
r.index = e;
let { source: t, target: i } = r;
- typeof t != "object" && (t = r.source = tn(n, t)), typeof i != "object" && (i = r.target = tn(n, i)), t.sourceLinks.push(r), i.targetLinks.push(r);
+ typeof t != "object" && (t = r.source = an(n, t)), typeof i != "object" && (i = r.target = an(n, i)), t.sourceLinks.push(r), i.targetLinks.push(r);
}
if (u != null) for (let { sourceLinks: t, targetLinks: n } of e) t.sort(u), n.sort(u);
}
function g({ nodes: e }) {
- for (let t of e) t.value = t.fixedValue === void 0 ? Math.max(Gt(t.sourceLinks, Zt), Gt(t.targetLinks, Zt)) : t.fixedValue;
+ for (let t of e) t.value = t.fixedValue === void 0 ? Math.max(Jt(t.sourceLinks, en), Jt(t.targetLinks, en)) : t.fixedValue;
}
function _({ nodes: e }) {
let t = e.length, n = new Set(e), r = /* @__PURE__ */ new Set(), i = 0;
@@ -1457,7 +1461,7 @@ function rn() {
}
}
function y({ nodes: t }) {
- let r = Ut(t, (e) => e.depth) + 1, a = (n - e - i) / (r - 1), o = Array(r);
+ let r = Kt(t, (e) => e.depth) + 1, a = (n - e - i) / (r - 1), o = Array(r);
for (let n of t) {
let t = Math.max(0, Math.min(r - 1, Math.floor(c.call(null, n, r))));
n.layer = t, n.x0 = e + t * a, n.x1 = n.x0 + i, o[t] ? o[t].push(n) : o[t] = [n];
@@ -1466,7 +1470,7 @@ function rn() {
return o;
}
function b(e) {
- let n = Wt(e, (e) => (r - t - (e.length - 1) * o) / Gt(e, Zt));
+ let n = qt(e, (e) => (r - t - (e.length - 1) * o) / Jt(e, en));
for (let i of e) {
let e = t;
for (let t of i) {
@@ -1483,7 +1487,7 @@ function rn() {
}
function x(e) {
let n = y(e);
- o = Math.min(a, (r - t) / (Ut(n, (e) => e.length) - 1)), b(n);
+ o = Math.min(a, (r - t) / (Kt(n, (e) => e.length) - 1)), b(n);
for (let e = 0; e < p; ++e) {
let t = .99 ** e, r = Math.max(1 - t, (e + 1) / p);
C(n, t, r), S(n, t, r);
@@ -1502,7 +1506,7 @@ function rn() {
let i = (n / r - e.y0) * t;
e.y0 += i, e.y1 += i, D(e);
}
- l === void 0 && i.sort(Xt), w(i, n);
+ l === void 0 && i.sort($t), w(i, n);
}
}
function C(e, t, n) {
@@ -1518,7 +1522,7 @@ function rn() {
let i = (n / r - e.y0) * t;
e.y0 += i, e.y1 += i, D(e);
}
- l === void 0 && i.sort(Xt), w(i, n);
+ l === void 0 && i.sort($t), w(i, n);
}
}
function w(e, n) {
@@ -1539,12 +1543,12 @@ function rn() {
}
function D({ sourceLinks: e, targetLinks: t }) {
if (u === void 0) {
- for (let { source: { sourceLinks: e } } of t) e.sort(Yt);
- for (let { target: { targetLinks: t } } of e) t.sort(Jt);
+ for (let { source: { sourceLinks: e } } of t) e.sort(Qt);
+ for (let { target: { targetLinks: t } } of e) t.sort(Zt);
}
}
function O(e) {
- if (u === void 0) for (let { sourceLinks: t, targetLinks: n } of e) t.sort(Yt), n.sort(Jt);
+ if (u === void 0) for (let { sourceLinks: t, targetLinks: n } of e) t.sort(Qt), n.sort(Zt);
}
function k(e, t) {
let n = e.y0 - (e.sourceLinks.length - 1) * o / 2;
@@ -1574,15 +1578,15 @@ function rn() {
}
//#endregion
//#region node_modules/d3-path/src/path.js
-var an = Math.PI, on = 2 * an, q = 1e-6, sn = on - q;
-function cn() {
+var cn = Math.PI, ln = 2 * cn, K = 1e-6, un = ln - K;
+function dn() {
this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "";
}
-function ln() {
- return new cn();
+function fn() {
+ return new dn();
}
-cn.prototype = ln.prototype = {
- constructor: cn,
+dn.prototype = fn.prototype = {
+ constructor: dn,
moveTo: function(e, t) {
this._ += "M" + (this._x0 = this._x1 = +e) + "," + (this._y0 = this._y1 = +t);
},
@@ -1603,11 +1607,11 @@ cn.prototype = ln.prototype = {
var a = this._x1, o = this._y1, s = n - e, c = r - t, l = a - e, u = o - t, d = l * l + u * u;
if (i < 0) throw Error("negative radius: " + i);
if (this._x1 === null) this._ += "M" + (this._x1 = e) + "," + (this._y1 = t);
- else if (d > q) {
- if (!(Math.abs(u * s - c * l) > q) || !i) this._ += "L" + (this._x1 = e) + "," + (this._y1 = t);
+ else if (d > K) {
+ if (!(Math.abs(u * s - c * l) > K) || !i) this._ += "L" + (this._x1 = e) + "," + (this._y1 = t);
else {
- var f = n - a, p = r - o, m = s * s + c * c, h = f * f + p * p, g = Math.sqrt(m), _ = Math.sqrt(d), v = i * Math.tan((an - Math.acos((m + d - h) / (2 * g * _))) / 2), y = v / _, b = v / g;
- Math.abs(y - 1) > q && (this._ += "L" + (e + y * l) + "," + (t + y * u)), this._ += "A" + i + "," + i + ",0,0," + +(u * f > l * p) + "," + (this._x1 = e + b * s) + "," + (this._y1 = t + b * c);
+ var f = n - a, p = r - o, m = s * s + c * c, h = f * f + p * p, g = Math.sqrt(m), _ = Math.sqrt(d), v = i * Math.tan((cn - Math.acos((m + d - h) / (2 * g * _))) / 2), y = v / _, b = v / g;
+ Math.abs(y - 1) > K && (this._ += "L" + (e + y * l) + "," + (t + y * u)), this._ += "A" + i + "," + i + ",0,0," + +(u * f > l * p) + "," + (this._x1 = e + b * s) + "," + (this._y1 = t + b * c);
}
}
},
@@ -1615,7 +1619,7 @@ cn.prototype = ln.prototype = {
e = +e, t = +t, n = +n, a = !!a;
var o = n * Math.cos(r), s = n * Math.sin(r), c = e + o, l = t + s, u = 1 ^ a, d = a ? r - i : i - r;
if (n < 0) throw Error("negative radius: " + n);
- this._x1 === null ? this._ += "M" + c + "," + l : (Math.abs(this._x1 - c) > q || Math.abs(this._y1 - l) > q) && (this._ += "L" + c + "," + l), n && (d < 0 && (d = d % on + on), d > sn ? this._ += "A" + n + "," + n + ",0,1," + u + "," + (e - o) + "," + (t - s) + "A" + n + "," + n + ",0,1," + u + "," + (this._x1 = c) + "," + (this._y1 = l) : d > q && (this._ += "A" + n + "," + n + ",0," + +(d >= an) + "," + u + "," + (this._x1 = e + n * Math.cos(i)) + "," + (this._y1 = t + n * Math.sin(i))));
+ this._x1 === null ? this._ += "M" + c + "," + l : (Math.abs(this._x1 - c) > K || Math.abs(this._y1 - l) > K) && (this._ += "L" + c + "," + l), n && (d < 0 && (d = d % ln + ln), d > un ? this._ += "A" + n + "," + n + ",0,1," + u + "," + (e - o) + "," + (t - s) + "A" + n + "," + n + ",0,1," + u + "," + (this._x1 = c) + "," + (this._y1 = l) : d > K && (this._ += "A" + n + "," + n + ",0," + +(d >= cn) + "," + u + "," + (this._x1 = e + n * Math.cos(i)) + "," + (this._y1 = t + n * Math.sin(i))));
},
rect: function(e, t, n, r) {
this._ += "M" + (this._x0 = this._x1 = +e) + "," + (this._y0 = this._y1 = +t) + "h" + +n + "v" + +r + "h" + -n + "Z";
@@ -1626,71 +1630,71 @@ cn.prototype = ln.prototype = {
};
//#endregion
//#region node_modules/d3-shape/src/constant.js
-function un(e) {
+function pn(e) {
return function() {
return e;
};
}
//#endregion
//#region node_modules/d3-shape/src/point.js
-function dn(e) {
+function mn(e) {
return e[0];
}
-function fn(e) {
+function hn(e) {
return e[1];
}
//#endregion
//#region node_modules/d3-shape/src/array.js
-var pn = Array.prototype.slice;
+var gn = Array.prototype.slice;
//#endregion
//#region node_modules/d3-shape/src/link/index.js
-function mn(e) {
+function _n(e) {
return e.source;
}
-function hn(e) {
+function vn(e) {
return e.target;
}
-function gn(e) {
- var t = mn, n = hn, r = dn, i = fn, a = null;
+function yn(e) {
+ var t = _n, n = vn, r = mn, i = hn, a = null;
function o() {
- var o, s = pn.call(arguments), c = t.apply(this, s), l = n.apply(this, s);
- if (a ||= o = ln(), e(a, +r.apply(this, (s[0] = c, s)), +i.apply(this, s), +r.apply(this, (s[0] = l, s)), +i.apply(this, s)), o) return a = null, o + "" || null;
+ var o, s = gn.call(arguments), c = t.apply(this, s), l = n.apply(this, s);
+ if (a ||= o = fn(), e(a, +r.apply(this, (s[0] = c, s)), +i.apply(this, s), +r.apply(this, (s[0] = l, s)), +i.apply(this, s)), o) return a = null, o + "" || null;
}
return o.source = function(e) {
return arguments.length ? (t = e, o) : t;
}, o.target = function(e) {
return arguments.length ? (n = e, o) : n;
}, o.x = function(e) {
- return arguments.length ? (r = typeof e == "function" ? e : un(+e), o) : r;
+ return arguments.length ? (r = typeof e == "function" ? e : pn(+e), o) : r;
}, o.y = function(e) {
- return arguments.length ? (i = typeof e == "function" ? e : un(+e), o) : i;
+ return arguments.length ? (i = typeof e == "function" ? e : pn(+e), o) : i;
}, o.context = function(e) {
return arguments.length ? (a = e ?? null, o) : a;
}, o;
}
-function _n(e, t, n, r, i) {
+function bn(e, t, n, r, i) {
e.moveTo(t, n), e.bezierCurveTo(t = (t + r) / 2, n, t, i, r, i);
}
-function vn() {
- return gn(_n);
+function xn() {
+ return yn(bn);
}
//#endregion
//#region node_modules/d3-sankey/src/sankeyLinkHorizontal.js
-function yn(e) {
+function Sn(e) {
return [e.source.x1, e.y0];
}
-function bn(e) {
+function Cn(e) {
return [e.target.x0, e.y1];
}
-function xn() {
- return vn().source(yn).target(bn);
+function wn() {
+ return xn().source(Sn).target(Cn);
}
//#endregion
//#region src/board-sankey.ts
-function Sn(e = []) {
+function Tn(e = []) {
let n = e.filter((e) => e.source && e.target && Number.isFinite(e.value) && e.value > 0);
if (!n.length) return "";
- let r = [...new Set(n.map((e) => e.source))], i = [...new Set(n.map((e) => e.target))], a = rn().nodeId((e) => e.id).nodeWidth(10).nodePadding(22).extent([[155, 16], [535, 404]])({
+ let r = [...new Set(n.map((e) => e.source))], i = [...new Set(n.map((e) => e.target))], a = sn().nodeId((e) => e.id).nodeWidth(10).nodePadding(22).extent([[155, 16], [535, 404]])({
nodes: [...r.map((e) => ({
id: `source:${e}`,
name: e,
@@ -1705,13 +1709,13 @@ function Sn(e = []) {
target: `target:${e.target}`,
value: e.value
}))
- }), o = n.reduce((e, t) => e + t.value, 0), s = xn(), c = a.links.map((e) => {
+ }), o = n.reduce((e, t) => e + t.value, 0), s = wn(), c = a.links.map((e) => {
let n = e.source, i = e.target;
return `<path d="${s(e)}" stroke-width="${Math.max(.5, e.width || 0)}" style="--flow-color:var(--board-chart-${r.indexOf(n.name) % 6})" data-flow-source="${n.index}" data-flow-target="${i.index}" data-flow-value="${e.value}" data-flow-label="${t(n.name)} → ${t(i.name)}" tabindex="0" role="img" aria-label="${t(n.name)} → ${t(i.name)}:${e.value} 条线索"/>`;
}).join(""), l = a.nodes.map((e) => `<g data-flow-node="${e.index}" data-flow-value="${e.value}" data-flow-label="${t(e.name)}" tabindex="0" role="img" aria-label="${t(e.name)}:${e.value} 条线索"><rect x="${e.x0}" y="${e.y0}" width="10" height="${Math.max(1, (e.y1 || 0) - (e.y0 || 0))}" rx="5" fill="${e.side === "source" ? `var(--board-chart-${r.indexOf(e.name) % 6})` : "var(--color-text-secondary)"}"/><text x="${e.side === "source" ? 145 : 545}" y="${((e.y0 || 0) + (e.y1 || 0)) / 2}" text-anchor="${e.side === "source" ? "end" : "start"}" dominant-baseline="middle">${t(e.name.length > 18 ? e.name.slice(0, 16) + "…" : e.name)}<tspan x="${e.side === "source" ? 145 : 545}" dy="15">${e.side === "source" ? e.value?.toLocaleString() : ((e.value || 0) / o * 100).toFixed(1) + "%"}</tspan></text></g>`).join("");
return `<section class="board-sankey-card" data-sankey-card><header><h3>创作者线索来源</h3><b data-sankey-number>${o.toLocaleString()}</b><span data-sankey-label>条线索</span></header><div class="board-sankey-scroll"><svg viewBox="0 0 720 435" aria-label="来源网站与创作者线索"><g class="board-sankey-links">${c}</g><g class="board-sankey-nodes">${l}</g></svg></div><footer><span>来源网站</span><span>创作者 · 线索占比</span></footer></section>`;
}
-function Cn(e) {
+function En(e) {
e.querySelectorAll("[data-sankey-card]").forEach((e) => {
let t = [...e.querySelectorAll("[data-flow-source]")], n = [...e.querySelectorAll("[data-flow-node]")], r = e.querySelector("[data-sankey-number]"), i = e.querySelector("[data-sankey-label]"), a = r.textContent, o = () => {
t.forEach((e) => e.style.opacity = ""), n.forEach((e) => e.style.opacity = ""), r.textContent = a, i.textContent = "条线索";
@@ -1727,9 +1731,9 @@ function Cn(e) {
}
//#endregion
//#region src/board-analytics.ts
-var wn = (e) => Number.isFinite(e) && e >= 0;
-function Tn(e, n, r = "个视频") {
- let i = e.filter((e) => wn(e.value));
+var Dn = (e) => Number.isFinite(e) && e >= 0;
+function On(e, n, r = "个视频") {
+ let i = e.filter((e) => Dn(e.value));
if (!i.length) return "";
let a = i.reduce((e, t) => e + t.value, 0), o = Math.max(1, ...i.map((e) => e.value)) * 1.1, s = Math.min(22, 110 / Math.max(1, i.length)), c = Math.min(15, s * .68), l = i.map((e, n) => {
let i = 32 + n * s, a = e.value / o * 100;
@@ -1737,7 +1741,7 @@ function Tn(e, n, r = "个视频") {
}).join("");
return `<section class="board-radial-card" data-radial-card data-radial-total="${a}" data-radial-title="${t(n)}"><header><span data-radial-label>${t(n)}</span><b data-radial-number>${a.toLocaleString()}</b><small>${t(r)}</small></header><svg class="board-rings" viewBox="0 0 320 320" aria-label="${t(n)}">${l}</svg><div class="board-radial-tiles">${i.map((e, n) => `<button type="button" data-radial-tile="${n}" data-radial-value="${e.value}" data-radial-name="${t(e.name)}" aria-pressed="false" style="--ring-color:var(--board-chart-${n % 6})"><span><i aria-hidden="true"></i>${t(e.name)}</span><b>${e.value.toLocaleString()}</b>${e.detail ? `<small>${t(e.detail)}</small>` : ""}</button>`).join("")}</div></section>`;
}
-function En(e) {
+function kn(e) {
e.querySelectorAll("[data-radial-card]").forEach((e) => {
let t = [...e.querySelectorAll("[data-radial-tile]")], n = [...e.querySelectorAll("[data-radial-ring]")], r = e.querySelector("[data-radial-number]"), i = e.querySelector("[data-radial-label]"), a = -1, o = 0, s = 0, c = (c, l = 300) => {
e.dataset.radialFocus = String(c), t.forEach((e, t) => {
@@ -1774,7 +1778,7 @@ function En(e) {
}
});
}
-var Dn = [
+var An = [
"周一",
"周二",
"周三",
@@ -1783,11 +1787,11 @@ var Dn = [
"周六",
"周日"
];
-function On(e) {
+function jn(e) {
if (!e?.days?.length) return "<section class=\"board-activity-empty\"><h3>浏览活跃时间</h3><p>还没有可用于分析的口味网站访问记录。</p></section>";
let n = Array.from({ length: 7 }, () => Array(24).fill(0));
- for (let t of e.hours || []) Number.isInteger(t.weekday) && t.weekday >= 0 && t.weekday < 7 && Number.isInteger(t.hour) && t.hour >= 0 && t.hour < 24 && wn(t.count) && (n[t.weekday][t.hour] = (n[t.weekday][t.hour] || 0) + t.count);
- let r = Math.max(1, ...n.flat()), i = n.flat().reduce((e, t) => e + t, 0), a = n.map((e, t) => `<span class="board-heat-axis">${Dn[t]}</span>${e.map((e, n) => `<button type="button" data-heat-value="${e}" data-heat-label="${Dn[t]} ${n}:00" aria-label="${Dn[t]} ${n}:00,${e} 次访问" style="--heat:${e ? Math.max(12, e / r * 100) : 0}%"></button>`).join("")}`).join(""), o = e.days.filter((e) => /^\d{4}-\d{2}-\d{2}$/.test(e.date) && wn(e.count)).sort((e, t) => e.date.localeCompare(t.date));
+ for (let t of e.hours || []) Number.isInteger(t.weekday) && t.weekday >= 0 && t.weekday < 7 && Number.isInteger(t.hour) && t.hour >= 0 && t.hour < 24 && Dn(t.count) && (n[t.weekday][t.hour] = (n[t.weekday][t.hour] || 0) + t.count);
+ let r = Math.max(1, ...n.flat()), i = n.flat().reduce((e, t) => e + t, 0), a = n.map((e, t) => `<span class="board-heat-axis">${An[t]}</span>${e.map((e, n) => `<button type="button" data-heat-value="${e}" data-heat-label="${An[t]} ${n}:00" aria-label="${An[t]} ${n}:00,${e} 次访问" style="--heat:${e ? Math.max(12, e / r * 100) : 0}%"></button>`).join("")}`).join(""), o = e.days.filter((e) => /^\d{4}-\d{2}-\d{2}$/.test(e.date) && Dn(e.count)).sort((e, t) => e.date.localeCompare(t.date));
if (!o.length) return "";
let s = /* @__PURE__ */ new Date(`${o.at(-1).date}T00:00:00Z`), c = new Date(s);
c.setUTCDate(c.getUTCDate() - 90);
@@ -1799,7 +1803,7 @@ function On(e) {
}).join("");
return `<div class="board-activity-charts"><section class="board-heat-card" data-heat-card><header><h3>浏览活跃时间</h3><b data-heat-number>${i.toLocaleString()}</b><span data-heat-title data-heat-default="口味网站访问">口味网站访问</span></header><div class="board-heat-scroll"><div class="board-hour-grid"><span></span>${Array.from({ length: 24 }, (e, t) => `<span class="board-heat-axis">${t % 2 ? "" : t}</span>`).join("")}${a}</div></div><footer>星期 × 小时<span>${t(e.timezone || "UTC+08:00")}</span></footer></section><section class="board-heat-card" data-heat-card><header><h3>每日活跃</h3><b data-heat-number>${o.filter((e) => e.date >= c.toISOString().slice(0, 10)).reduce((e, t) => e + t.count, 0).toLocaleString()}</b><span data-heat-title data-heat-default="口味网站访问">口味网站访问</span></header><div class="board-day-grid">${d}</div><footer>${c.toISOString().slice(0, 10)}<span>${o.at(-1).date}</span></footer></section></div>`;
}
-function kn(e) {
+function Mn(e) {
e.querySelectorAll("[data-heat-card]").forEach((e) => {
let t = e.querySelector("[data-heat-number]"), n = e.querySelector("[data-heat-title]"), r = t.textContent;
e.querySelectorAll("[data-heat-value]").forEach((e) => {
@@ -1814,19 +1818,19 @@ function kn(e) {
}
//#endregion
//#region src/sidebar-groups.ts
-var An = (e) => e.replace(/[&<>"']/g, (e) => ({
+var Nn = (e) => e.replace(/[&<>"']/g, (e) => ({
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
"\"": "&quot;",
"'": "&#39;"
})[e]);
-function jn(e, t, n = "", r = "") {
+function Pn(e, t, n = "", r = "") {
if (!t) return "";
let i = `sidebar-group-${encodeURIComponent(e)}`;
- return `<details class="sec${r ? " cat-" + An(r) : ""}" data-sidebar-group="${An(e)}"><summary role="button" class="board-section-toggle"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-chevron-right"/></svg><span>${An(e)}</span></summary><div class="board-sidebar-body" id="${i}">${t}${n}</div></details>`;
+ return `<details class="sec${r ? " cat-" + Nn(r) : ""}" data-sidebar-group="${Nn(e)}"><summary role="button" class="board-section-toggle"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-chevron-right"/></svg><span>${Nn(e)}</span></summary><div class="board-sidebar-body" id="${i}">${t}${n}</div></details>`;
}
-function Mn(e) {
+function Fn(e) {
e.querySelectorAll("[data-sidebar-group]").forEach((e) => {
if (e.dataset.sidebarWired) return;
e.dataset.sidebarWired = "true";
@@ -1845,15 +1849,15 @@ function Mn(e) {
}));
});
}
-var Nn = !1;
-async function Pn(e, t) {
- if (Nn) return;
+var In = !1;
+async function Ln(e, t) {
+ if (In) return;
if (!document.startViewTransition || matchMedia("(prefers-reduced-motion: reduce)").matches) {
t();
return;
}
let n = e.getBoundingClientRect(), r = n.left + n.width / 2, i = n.top + n.height / 2, a = Math.hypot(Math.max(r, innerWidth - r), Math.max(i, innerHeight - i)) * 2.5, o = document.createElement("style");
- o.textContent = `::view-transition-old(root){animation:none}::view-transition-new(root){mix-blend-mode:normal;mask-image:radial-gradient(circle closest-side,#000 78%,#0006 88%,transparent);mask-repeat:no-repeat;will-change:mask-position,mask-size;animation:peach-theme-reveal 560ms cubic-bezier(.16,1,.3,1) both}@keyframes peach-theme-reveal{from{mask-position:${r}px ${i}px;mask-size:0px 0px}to{mask-position:${r - a / 2}px ${i - a / 2}px;mask-size:${a}px ${a}px}}`, Nn = !0, document.head.append(o);
+ o.textContent = `::view-transition-old(root){animation:none}::view-transition-new(root){mix-blend-mode:normal;mask-image:radial-gradient(circle closest-side,#000 78%,#0006 88%,transparent);mask-repeat:no-repeat;will-change:mask-position,mask-size;animation:peach-theme-reveal 560ms cubic-bezier(.16,1,.3,1) both}@keyframes peach-theme-reveal{from{mask-position:${r}px ${i}px;mask-size:0px 0px}to{mask-position:${r - a / 2}px ${i - a / 2}px;mask-size:${a}px ${a}px}}`, In = !0, document.head.append(o);
let s = document.documentElement;
s.dataset.themeSnapshot = "true";
let c = !1, l = () => {
@@ -1864,19 +1868,19 @@ async function Pn(e, t) {
} catch {
l();
} finally {
- delete s.dataset.themeSnapshot, o.remove(), Nn = !1;
+ delete s.dataset.themeSnapshot, o.remove(), In = !1;
}
}
//#endregion
//#region src/configuration-endpoints.ts
-var Fn = "/api/configuration";
+var Rn = "/api/configuration";
//#endregion
//#region src/react-slot.tsx
-function In({ mount: e, props: t }) {
- let n = H(null), r = H(null), i = H(t);
+function zn({ mount: e, props: t }) {
+ let n = V(null), r = V(null), i = V(t);
i.current = t;
- let [a, o] = B("");
- return V(() => {
+ let [a, o] = z("");
+ return B(() => {
let t = !1;
return import("/dist/peach-react.js").then((a) => {
if (t || !n.current) return;
@@ -1887,22 +1891,22 @@ function In({ mount: e, props: t }) {
}), () => {
t = !0, r.current?.unmount(), r.current = null;
};
- }, [e]), V(() => {
+ }, [e]), B(() => {
r.current?.update(t);
- }), a ? /* @__PURE__ */ G("p", {
+ }), a ? /* @__PURE__ */ W("p", {
class: "configbad",
role: "alert",
children: ["界面组件没有加载:", a]
- }) : /* @__PURE__ */ G("div", {
+ }) : /* @__PURE__ */ W("div", {
ref: n,
class: "peach-react"
});
}
//#endregion
//#region src/islands/configuration.tsx
-var Ln = (e, t) => W(Fn, t);
-function Rn({ receipt: e, data: t, error: n }) {
- if (n || !t) return /* @__PURE__ */ G("div", {
+var Bn = (e, t) => U(Rn, t);
+function Vn({ receipt: e, data: t, error: n }) {
+ if (n || !t) return /* @__PURE__ */ W("div", {
class: "configpage",
dangerouslySetInnerHTML: { __html: h(n || "没有读到配置", {
variant: "error",
@@ -1913,38 +1917,38 @@ function Rn({ receipt: e, data: t, error: n }) {
data: t,
receipt: e
};
- return /* @__PURE__ */ G("div", {
+ return /* @__PURE__ */ W("div", {
class: "configpage",
children: [
- t.startup ? /* @__PURE__ */ G("h2", {
+ t.startup ? /* @__PURE__ */ W("h2", {
class: "configgroup",
children: "通用"
}) : null,
- t.startup ? /* @__PURE__ */ G(In, {
+ t.startup ? /* @__PURE__ */ W(zn, {
mount: "mountGeneralSettings",
props: r
}) : null,
- /* @__PURE__ */ G("h2", {
+ /* @__PURE__ */ W("h2", {
class: "configgroup",
children: "媒体"
}),
- /* @__PURE__ */ G(In, {
+ /* @__PURE__ */ W(zn, {
mount: "mountMediaSettings",
props: r
}),
- t.peach_proxy || t.access ? /* @__PURE__ */ G("h2", {
+ t.peach_proxy || t.access ? /* @__PURE__ */ W("h2", {
class: "configgroup",
children: "网络与访问"
}) : null,
- t.peach_proxy || t.access ? /* @__PURE__ */ G(In, {
+ t.peach_proxy || t.access ? /* @__PURE__ */ W(zn, {
mount: "mountNetworkSettings",
props: r
}) : null,
- /* @__PURE__ */ G("h2", {
+ /* @__PURE__ */ W("h2", {
class: "configgroup",
children: "更新与维护"
}),
- /* @__PURE__ */ G(In, {
+ /* @__PURE__ */ W(zn, {
mount: "mountMaintenanceSettings",
props: r
})
@@ -1953,23 +1957,23 @@ function Rn({ receipt: e, data: t, error: n }) {
}
//#endregion
//#region node_modules/@preact/signals-core/dist/signals-core.module.js
-var zn = Symbol.for("preact-signals");
-function Bn() {
- if (Y > 1) Y--;
+var Hn = Symbol.for("preact-signals");
+function Un() {
+ if (J > 1) J--;
else {
var e, t = !1;
for ((function() {
- var e = Jn;
- for (Jn = void 0; e !== void 0;) {
+ var e = Zn;
+ for (Zn = void 0; e !== void 0;) {
var t = e.S;
if (t.v === e.v) for (var n = t.t; n !== void 0; n = n.x) n.i === e.i && (n.i = t.i);
e = e.o;
}
- })(); Wn !== void 0;) {
- var n = Wn;
- for (Wn = void 0, Gn++; n !== void 0;) {
+ })(); qn !== void 0;) {
+ var n = qn;
+ for (qn = void 0, Jn++; n !== void 0;) {
var r = n.u;
- if (n.u = void 0, n.f &= -3, !(8 & n.f) && Qn(n)) try {
+ if (n.u = void 0, n.f &= -3, !(8 & n.f) && tr(n)) try {
n.c();
} catch (n) {
t ||= (e = n, !0);
@@ -1977,116 +1981,116 @@ function Bn() {
n = r;
}
}
- if (Gn = 0, Y--, t) throw e;
+ if (Jn = 0, J--, t) throw e;
}
}
-function Vn(e) {
- if (Y > 0) return e();
- qn = ++Kn, Y++;
+function Wn(e) {
+ if (J > 0) return e();
+ Xn = ++Yn, J++;
try {
return e();
} finally {
- Bn();
+ Un();
}
}
-var Hn, J = void 0;
-function Un(e) {
- var t = J, n = Hn;
- J = void 0, Hn = void 0;
+var Gn, q = void 0;
+function Kn(e) {
+ var t = q, n = Gn;
+ q = void 0, Gn = void 0;
try {
return e();
} finally {
- J = t, Hn = n;
+ q = t, Gn = n;
}
}
-var Wn = void 0, Y = 0, Gn = 0, Kn = 0, qn = 0, Jn = void 0, Yn = 0;
-function Xn(e) {
- if (J !== void 0) {
+var qn = void 0, J = 0, Jn = 0, Yn = 0, Xn = 0, Zn = void 0, Qn = 0;
+function $n(e) {
+ if (q !== void 0) {
var t = e.n;
- if (t === void 0 || t.t !== J) return t = {
+ if (t === void 0 || t.t !== q) return t = {
i: 0,
S: e,
- p: J.s,
+ p: q.s,
n: void 0,
- t: J,
+ t: q,
e: void 0,
x: void 0,
r: t
- }, J.s !== void 0 && (J.s.n = t), J.s = t, e.n = t, 32 & J.f && e.S(t), t;
- if (t.i === -1) return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = J.s, t.n = void 0, J.s.n = t, J.s = t), t;
+ }, q.s !== void 0 && (q.s.n = t), q.s = t, e.n = t, 32 & q.f && e.S(t), t;
+ if (t.i === -1) return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = q.s, t.n = void 0, q.s.n = t, q.s = t), t;
}
}
-function X(e, t) {
+function Y(e, t) {
this.v = e, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;
}
-X.prototype.brand = zn, X.prototype.h = function() {
+Y.prototype.brand = Hn, Y.prototype.h = function() {
return !0;
-}, X.prototype.S = function(e) {
+}, Y.prototype.S = function(e) {
var t = this, n = this.t;
- n !== e && e.e === void 0 && (e.x = n, this.t = e, n === void 0 ? Un(function() {
+ n !== e && e.e === void 0 && (e.x = n, this.t = e, n === void 0 ? Kn(function() {
var e;
(e = t.W) == null || e.call(t);
}) : n.e = e);
-}, X.prototype.U = function(e) {
+}, Y.prototype.U = function(e) {
var t = this;
if (this.t !== void 0) {
var n = e.e, r = e.x;
- n !== void 0 && (n.x = r, e.e = void 0), r !== void 0 && (r.e = n, e.x = void 0), e === this.t && (this.t = r, r === void 0 && Un(function() {
+ n !== void 0 && (n.x = r, e.e = void 0), r !== void 0 && (r.e = n, e.x = void 0), e === this.t && (this.t = r, r === void 0 && Kn(function() {
var e;
(e = t.Z) == null || e.call(t);
}));
}
-}, X.prototype.subscribe = function(e) {
+}, Y.prototype.subscribe = function(e) {
var t = this;
- return sr(function() {
+ return lr(function() {
var n = t.value;
- Un(function() {
+ Kn(function() {
return e(n);
});
}, { name: "sub" });
-}, X.prototype.valueOf = function() {
+}, Y.prototype.valueOf = function() {
return this.value;
-}, X.prototype.toString = function() {
+}, Y.prototype.toString = function() {
return this.value + "";
-}, X.prototype.toJSON = function() {
+}, Y.prototype.toJSON = function() {
return this.value;
-}, X.prototype.peek = function() {
+}, Y.prototype.peek = function() {
var e = this;
- return Un(function() {
+ return Kn(function() {
return e.value;
});
-}, Object.defineProperty(X.prototype, "value", {
+}, Object.defineProperty(Y.prototype, "value", {
get: function() {
- var e = Xn(this);
+ var e = $n(this);
return e !== void 0 && (e.i = this.i), this.v;
},
set: function(e) {
if (e !== this.v) {
- if (Gn > 100) throw Error("Cycle detected");
+ if (Jn > 100) throw Error("Cycle detected");
(function(e) {
- Y !== 0 && Gn === 0 && e.l !== qn && (e.l = qn, Jn = {
+ J !== 0 && Jn === 0 && e.l !== Xn && (e.l = Xn, Zn = {
S: e,
v: e.v,
i: e.i,
- o: Jn
+ o: Zn
});
- })(this), this.v = e, this.i++, Yn++, Y++;
+ })(this), this.v = e, this.i++, Qn++, J++;
try {
for (var t = this.t; t !== void 0; t = t.x) t.t.N();
} finally {
- Bn();
+ Un();
}
}
}
});
-function Zn(e, t) {
- return new X(e, t);
+function er(e, t) {
+ return new Y(e, t);
}
-function Qn(e) {
+function tr(e) {
for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
return !1;
}
-function $n(e) {
+function nr(e) {
for (var t = e.s; t !== void 0; t = t.n) {
var n = t.S.n;
if (n !== void 0 && (t.r = n), t.S.n = t, t.i = -1, t.n === void 0) {
@@ -2095,81 +2099,81 @@ function $n(e) {
}
}
}
-function er(e) {
+function rr(e) {
for (var t = e.s, n = void 0; t !== void 0;) {
var r = t.p;
t.i === -1 ? (t.S.U(t), r !== void 0 && (r.n = t.n), t.n !== void 0 && (t.n.p = r)) : n = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = r;
}
e.s = n;
}
-function tr(e, t) {
- X.call(this, void 0, t), this.x = e, this.s = void 0, this.g = Yn - 1, this.f = 4;
+function X(e, t) {
+ Y.call(this, void 0, t), this.x = e, this.s = void 0, this.g = Qn - 1, this.f = 4;
}
-tr.prototype = new X(), tr.prototype.h = function() {
+X.prototype = new Y(), X.prototype.h = function() {
if (this.f &= -3, 1 & this.f) return !1;
- if ((36 & this.f) == 32 || (this.f &= -5, this.g === Yn)) return !0;
- if (this.g = Yn, this.f |= 1, this.i > 0 && !Qn(this)) return this.f &= -2, !0;
- var e = J;
+ if ((36 & this.f) == 32 || (this.f &= -5, this.g === Qn)) return !0;
+ if (this.g = Qn, this.f |= 1, this.i > 0 && !tr(this)) return this.f &= -2, !0;
+ var e = q;
try {
- $n(this), J = this;
+ nr(this), q = this;
var t = this.x();
(16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);
} catch (e) {
this.v = e, this.f |= 16, this.i++;
}
- return J = e, er(this), this.f &= -2, !0;
-}, tr.prototype.S = function(e) {
+ return q = e, rr(this), this.f &= -2, !0;
+}, X.prototype.S = function(e) {
if (this.t === void 0) {
this.f |= 36;
for (var t = this.s; t !== void 0; t = t.n) t.S.S(t);
}
- X.prototype.S.call(this, e);
-}, tr.prototype.U = function(e) {
- if (this.t !== void 0 && (X.prototype.U.call(this, e), this.t === void 0)) {
+ Y.prototype.S.call(this, e);
+}, X.prototype.U = function(e) {
+ if (this.t !== void 0 && (Y.prototype.U.call(this, e), this.t === void 0)) {
this.f &= -33;
for (var t = this.s; t !== void 0; t = t.n) t.S.U(t);
}
-}, tr.prototype.N = function() {
+}, X.prototype.N = function() {
if (!(2 & this.f)) {
this.f |= 6;
for (var e = this.t; e !== void 0; e = e.x) e.t.N();
}
-}, Object.defineProperty(tr.prototype, "value", { get: function() {
+}, Object.defineProperty(X.prototype, "value", { get: function() {
if (1 & this.f) throw Error("Cycle detected");
- var e = Xn(this);
+ var e = $n(this);
if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;
return this.v;
} });
-function nr(e, t) {
- return new tr(e, t);
+function ir(e, t) {
+ return new X(e, t);
}
-function rr(e) {
+function ar(e) {
var t = e.m;
if (e.m = void 0, typeof t == "function") {
- Y++;
- var n = J;
- J = void 0;
+ J++;
+ var n = q;
+ q = void 0;
try {
t();
} catch (t) {
- throw e.f &= -2, e.f |= 8, ir(e), t;
+ throw e.f &= -2, e.f |= 8, or(e), t;
} finally {
- J = n, Bn();
+ q = n, Un();
}
}
}
-function ir(e) {
+function or(e) {
for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);
- e.x = void 0, e.s = void 0, rr(e);
+ e.x = void 0, e.s = void 0, ar(e);
}
-function ar(e) {
- if (J !== this) throw Error("Out-of-order effect");
- er(this), J = e, this.f &= -2, 8 & this.f && ir(this), Bn();
+function sr(e) {
+ if (q !== this) throw Error("Out-of-order effect");
+ rr(this), q = e, this.f &= -2, 8 & this.f && or(this), Un();
}
-function or(e, t) {
- this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, Hn && Hn.push(this);
+function cr(e, t) {
+ this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, Gn && Gn.push(this);
}
-or.prototype.c = function() {
+cr.prototype.c = function() {
var e = this.S();
try {
if (8 & this.f || this.x === void 0) return;
@@ -2178,20 +2182,20 @@ or.prototype.c = function() {
} finally {
e();
}
-}, or.prototype.S = function() {
+}, cr.prototype.S = function() {
if (1 & this.f) throw Error("Cycle detected");
- this.f |= 1, this.f &= -9, rr(this), $n(this), Y++;
- var e = J;
- return J = this, ar.bind(this, e);
-}, or.prototype.N = function() {
- 2 & this.f || (this.f |= 2, this.u = Wn, Wn = this);
-}, or.prototype.d = function() {
- this.f |= 8, 1 & this.f || ir(this);
-}, or.prototype.dispose = function() {
+ this.f |= 1, this.f &= -9, ar(this), nr(this), J++;
+ var e = q;
+ return q = this, sr.bind(this, e);
+}, cr.prototype.N = function() {
+ 2 & this.f || (this.f |= 2, this.u = qn, qn = this);
+}, cr.prototype.d = function() {
+ this.f |= 8, 1 & this.f || or(this);
+}, cr.prototype.dispose = function() {
this.d();
};
-function sr(e, t) {
- var n = new or(e, t);
+function lr(e, t) {
+ var n = new cr(e, t);
try {
n.c();
} catch (e) {
@@ -2202,35 +2206,35 @@ function sr(e, t) {
}
//#endregion
//#region node_modules/@preact/signals/dist/signals.module.js
-var cr, lr, ur = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, dr = [];
-sr(function() {
- cr = this.N;
+var ur, dr, fr = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, pr = [];
+lr(function() {
+ ur = this.N;
})();
-function fr(e, t) {
+function mr(e, t) {
w[e] = t.bind(null, w[e] || function() {});
}
-function pr(e) {
- if (lr) {
- var t = lr;
- lr = void 0, t();
+function hr(e) {
+ if (dr) {
+ var t = dr;
+ dr = void 0, t();
}
- lr = e && e.S();
+ dr = e && e.S();
}
-function mr(e) {
- var t = this, n = e.data, r = gr(n);
+function gr(e) {
+ var t = this, n = e.data, r = vr(n);
r.name = "ReactiveDom", r.value = n;
- var i = nt(function() {
+ var i = rt(function() {
for (var e = t, n = t.__v; n = n.__;) if (n.__c) {
n.__c.__$f |= 4;
break;
}
- var i = nr(function() {
+ var i = ir(function() {
var e = r.value.value;
return e === 0 ? 0 : !0 === e ? "" : e || "";
- }), a = nr(function() {
+ }), a = ir(function() {
return !Array.isArray(i.value) && !E(i.value);
- }), o = sr(function() {
- if (this.N = yr, a.value) {
+ }), o = lr(function() {
+ if (this.N = xr, a.value) {
var t = i.value;
e.__v && e.__v.__e && e.__v.__e.nodeType === 3 && (e.__v.__e.data = t);
}
@@ -2241,14 +2245,14 @@ function mr(e) {
}, []), a = i[0], o = i[1];
return a.value ? o.peek() : o.value;
}
-mr.displayName = "ReactiveTextNode", Object.defineProperties(X.prototype, {
+gr.displayName = "ReactiveTextNode", Object.defineProperties(Y.prototype, {
constructor: {
configurable: !0,
value: void 0
},
type: {
configurable: !0,
- value: mr
+ value: gr
},
props: {
configurable: !0,
@@ -2263,35 +2267,35 @@ mr.displayName = "ReactiveTextNode", Object.defineProperties(X.prototype, {
configurable: !0,
value: 1
}
-}), fr("__b", function(e, t) {
- if (typeof t.type == "string") {
+}), mr("__b", function(e, t) {
+ if (hr(), typeof t.type == "string") {
var n, r = t.props;
for (var i in r) if (i !== "children") {
var a = r[i];
- a instanceof X && (n || (t.__np = n = {}), n[i] = a, r[i] = a.peek());
+ a instanceof Y && (n || (t.__np = n = {}), n[i] = a, r[i] = a.peek());
}
}
e(t);
-}), fr("__r", function(e, t) {
+}), mr("__r", function(e, t) {
if (e(t), t.type !== F) {
- pr();
+ hr();
var n, r = t.__c;
r && (r.__$f &= -2, (n = r.__$u) === void 0 && (r.__$u = n = function(e, t) {
var n;
- return sr(function() {
+ return lr(function() {
n = this;
}, { name: t }), n.c = e, n;
}(function(e) {
return function() {
var t;
- ur && ((t = this.y) == null || t.call(this)), e.__$f |= 1, e.setState({});
+ fr && ((t = this.y) == null || t.call(this)), e.__$f |= 1, e.setState({});
};
- }(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), pr(n);
+ }(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), hr(n);
}
-}), fr("__e", function(e, t, n, r) {
- pr(), e(t, n, r);
-}), fr("diffed", function(e, t) {
- pr();
+}), mr("__e", function(e, t, n, r) {
+ hr(), e(t, n, r);
+}), mr("diffed", function(e, t) {
+ hr();
var n;
if (typeof t.type == "string" && (n = t.__e)) {
var r = t.__np, i = t.props, a = n.U;
@@ -2301,25 +2305,25 @@ mr.displayName = "ReactiveTextNode", Object.defineProperties(X.prototype, {
}
if (r) for (var c in a || (a = {}, n.U = a), r) {
var l = a[c], u = r[c];
- l === void 0 ? (l = hr(n, c, u, i), a[c] = l) : l.o(u, i);
+ l === void 0 ? (l = _r(n, c, u, i), a[c] = l) : l.o(u, i);
}
}
e(t);
});
-function hr(e, t, n, r) {
- var i = t in e && e.ownerSVGElement === void 0, a = Zn(n);
+function _r(e, t, n, r) {
+ var i = t in e && e.ownerSVGElement === void 0, a = er(n);
return {
o: function(e, t) {
a.value = e, r = t;
},
- d: sr(function() {
- this.N = yr;
+ d: lr(function() {
+ this.N = xr;
var n = a.value.value;
r[t] !== n && (r[t] = n, i ? e[t] = n : n != null && (!1 !== n || t[4] === "-") ? e.setAttribute(t, n) : e.removeAttribute(t));
})
};
}
-fr("unmount", function(e, t) {
+mr("unmount", function(e, t) {
if (typeof t.type == "string") {
var n = t.__e;
if (n) {
@@ -2343,7 +2347,7 @@ fr("unmount", function(e, t) {
}
}
e(t);
-}), fr("__h", function(e, t, n, r) {
+}), mr("__h", function(e, t, n, r) {
r < 3 && (t.__$f |= 2), e(t, n, r);
}), de.prototype.shouldComponentUpdate = function(e, t) {
if (this.__R) return !0;
@@ -2357,55 +2361,55 @@ fr("unmount", function(e, t) {
for (var s in this.props) if (!(s in e)) return !0;
return !1;
};
-function gr(e, t) {
- return nt(function() {
- return Zn(e, t);
+function vr(e, t) {
+ return rt(function() {
+ return er(e, t);
}, []);
}
-var _r = function(e) {
+var yr = function(e) {
queueMicrotask(function() {
queueMicrotask(e);
});
};
-function vr() {
- Vn(function() {
- for (var e; e = dr.shift();) cr.call(e);
+function br() {
+ Wn(function() {
+ for (var e; e = pr.shift();) ur.call(e);
});
}
-function yr() {
- dr.push(this) === 1 && (w.requestAnimationFrame || _r)(vr);
+function xr() {
+ pr.push(this) === 1 && (w.requestAnimationFrame || yr)(br);
}
//#endregion
//#region src/state/quality-goals.ts
-var br = "/api/quality-goals?limit=200", xr = {
+var Sr = "/api/quality-goals?limit=200", Cr = {
data: null,
error: ""
-}, Sr = Zn(xr), Cr = 0, wr = nr(() => Sr.value);
-nr(() => Sr.value.data?.total ?? null);
-function Tr() {
- Cr += 1, Sr.value = xr;
+}, wr = er(Cr), Tr = 0, Er = ir(() => wr.value);
+ir(() => wr.value.data?.total ?? null);
+function Dr() {
+ Tr += 1, wr.value = Cr;
}
-async function Er(e) {
- let t = Cr += 1;
+async function Or(e) {
+ let t = Tr += 1;
try {
- let n = await W(br, e);
- return t === Cr && (Sr.value = {
+ let n = await U(Sr, e);
+ return t === Tr && (wr.value = {
data: n,
error: ""
}), n;
} catch (n) {
- throw !e?.aborted && t === Cr && (Sr.value = {
+ throw !e?.aborted && t === Tr && (wr.value = {
data: null,
- error: U(n)
+ error: H(n)
}), n;
}
}
//#endregion
//#region src/islands/quality-goals.tsx
-var Dr = (e, t) => Er(t), Or = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;
-function kr({ openItem: t, javTitleHtml: i, javDisplayName: a, srcBadge: o }) {
- let { data: s, error: c } = wr.value;
- if (c) return /* @__PURE__ */ G("div", {
+var kr = (e, t) => Or(t), Ar = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;
+function jr({ openItem: t, javTitleHtml: i, javDisplayName: a, srcBadge: o }) {
+ let { data: s, error: c } = Er.value;
+ if (c) return /* @__PURE__ */ W("div", {
class: "qualitylist",
dangerouslySetInnerHTML: { __html: h(c, {
variant: "error",
@@ -2413,58 +2417,58 @@ function kr({ openItem: t, javTitleHtml: i, javDisplayName: a, srcBadge: o }) {
}) }
});
let l = s?.items ?? [];
- return l.length ? /* @__PURE__ */ G("div", {
+ return l.length ? /* @__PURE__ */ W("div", {
class: "quality-workspace",
- children: [/* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: u("待升级", `${s?.total ?? l.length} 部作品`) } }), /* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: u("待升级", `${s?.total ?? l.length} 部作品`) } }), /* @__PURE__ */ W("div", {
class: "qualitylist",
- children: l.map((s) => /* @__PURE__ */ G("article", {
+ children: l.map((s) => /* @__PURE__ */ W("article", {
class: "qualityitem",
children: [
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ W("button", {
class: "qualitycover",
type: "button",
"aria-label": `打开 ${a(s)}`,
onClick: () => t(s.id),
- children: [/* @__PURE__ */ G("span", {
+ children: [/* @__PURE__ */ W("span", {
class: "qualityfallback",
children: "暂无预览"
- }), /* @__PURE__ */ G("img", {
- src: Or(s),
+ }), /* @__PURE__ */ W("img", {
+ src: Ar(s),
alt: "",
loading: "lazy",
onError: (e) => e.currentTarget.remove()
})]
}),
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ W("div", {
class: "qualitybody",
children: [
- /* @__PURE__ */ G("h3", { children: /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ W("h3", { children: /* @__PURE__ */ W("button", {
type: "button",
"data-middle-truncate": !0,
onClick: () => t(s.id),
dangerouslySetInnerHTML: { __html: i(s) }
}) }),
- /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ W("p", {
class: "mono",
children: [
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ W("span", {
style: "display:contents",
dangerouslySetInnerHTML: { __html: o(s.location, s.cost) }
}),
- /* @__PURE__ */ G("span", { children: e[s.location] ?? s.location }),
- /* @__PURE__ */ G("span", { children: n(s.duration) }),
- /* @__PURE__ */ G("span", { children: r(s.size ?? 0) })
+ /* @__PURE__ */ W("span", { children: e[s.location] ?? s.location }),
+ /* @__PURE__ */ W("span", { children: n(s.duration) }),
+ /* @__PURE__ */ W("span", { children: r(s.size ?? 0) })
]
}),
- s.reason ? /* @__PURE__ */ G("p", {
+ s.reason ? /* @__PURE__ */ W("p", {
class: "qualityreason",
children: s.reason
}) : null
]
}),
- /* @__PURE__ */ G("footer", {
+ /* @__PURE__ */ W("footer", {
class: "qualityactions",
- children: /* @__PURE__ */ G("button", {
+ children: /* @__PURE__ */ W("button", {
type: "button",
class: "geist-button",
onClick: () => t(s.id),
@@ -2474,44 +2478,44 @@ function kr({ openItem: t, javTitleHtml: i, javDisplayName: a, srcBadge: o }) {
]
}, s.id))
})]
- }) : /* @__PURE__ */ G("div", {
+ }) : /* @__PURE__ */ W("div", {
class: "qualitylist",
dangerouslySetInnerHTML: { __html: d("sparkles", "没有标记中的高清版目标", "现有版本都已满足条件,或还没有加入追踪。") }
});
}
//#endregion
//#region src/islands/scraping.tsx
-var Ar = (e, t) => W("/api/scraping", t);
-function jr({ value: e, onChange: t }) {
- let n = H(null), r = H(t);
- return r.current = t, tt(() => {
+var Mr = (e, t) => U("/api/scraping", t);
+function Nr({ value: e, onChange: t }) {
+ let n = V(null), r = V(t);
+ return r.current = t, nt(() => {
let t = n.current;
t.innerHTML = _([["peach", "Peach 代理"], ["direct", "直接连接"]], e, { label: "连接方式" });
let i = S(t.firstElementChild), a = () => r.current(i.value);
return i.addEventListener("change", a), () => {
i.disabled = !0, i.removeEventListener("change", a), t.replaceChildren();
};
- }, []), /* @__PURE__ */ G("div", {
+ }, []), /* @__PURE__ */ W("div", {
ref: n,
class: "scraping-network"
});
}
-function Mr({ source: e, toast: t }) {
- let [n, r] = B(e), [i, a] = B(e.network), [s, c] = B(""), [l, u] = B(""), [d, p] = B("paste"), [m, g] = B(""), [_, v] = B(!1), [b, x] = B(""), [S, C] = B([]), w = H(null), T = H(null);
- tt(() => {
+function Pr({ source: e, toast: t }) {
+ let [n, r] = z(e), [i, a] = z(e.network), [s, c] = z(""), [l, u] = z(""), [d, p] = z("paste"), [m, g] = z(""), [_, v] = z(!1), [b, x] = z(""), [S, C] = z([]), w = V(null), T = V(null);
+ nt(() => {
T.current?.querySelectorAll("footer button").forEach((e) => y(e, _));
}, [_]);
- let E = H(new AbortController());
- V(() => () => E.current.abort(), []);
+ let E = V(new AbortController());
+ B(() => () => E.current.abort(), []);
async function D(n) {
if (!_) {
v(!0), x(""), C([]);
try {
if (n === "check") {
- let t = await ft("/api/scraping/check", { source: e.source }, "POST", E.current.signal);
+ let t = await pt("/api/scraping/check", { source: e.source }, "POST", E.current.signal);
E.current.signal.aborted || C(t.results);
} else {
- let a = await ft("/api/scraping/settings", {
+ let a = await pt("/api/scraping/settings", {
source: e.source,
network: i,
cookie: s,
@@ -2521,33 +2525,33 @@ function Mr({ source: e, toast: t }) {
E.current.signal.aborted || (r(a.saved), c(""), u(""), g(""), w.current && (w.current.value = ""), t(n === "revoke" ? "Cookie 已撤销" : "来源设置已保存"));
}
} catch (e) {
- E.current.signal.aborted || x(U(e));
+ E.current.signal.aborted || x(H(e));
} finally {
E.current.signal.aborted || v(!1);
}
}
}
- return /* @__PURE__ */ G("section", {
+ return /* @__PURE__ */ W("section", {
class: "scraping-source",
- children: /* @__PURE__ */ G("form", {
+ children: /* @__PURE__ */ W("form", {
ref: T,
class: "cleanupfieldset",
"data-geist-fieldset": !0,
onSubmit: (e) => {
e.preventDefault(), D("save");
},
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ W("div", {
class: "geist-fieldset-content scraping-fields",
children: [
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ W("div", {
class: "geist-fieldset-heading",
- children: [/* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: f(`scraping-${e.source}`, e.label) } }), /* @__PURE__ */ G("a", {
+ children: [/* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: f(`scraping-${e.source}`, e.label) } }), /* @__PURE__ */ W("a", {
class: "scraping-url externallink",
href: e.login,
target: "_blank",
rel: "noopener noreferrer",
children: [
- /* @__PURE__ */ G("img", {
+ /* @__PURE__ */ W("img", {
src: o({ source: e.source }),
alt: "",
width: "16",
@@ -2555,34 +2559,34 @@ function Mr({ source: e, toast: t }) {
loading: "lazy",
onError: (e) => e.currentTarget.remove()
}),
- /* @__PURE__ */ G("span", { children: e.login }),
- /* @__PURE__ */ G("svg", {
+ /* @__PURE__ */ W("span", { children: e.login }),
+ /* @__PURE__ */ W("svg", {
class: "externalmark",
viewBox: "0 0 24 24",
"aria-hidden": "true",
- children: /* @__PURE__ */ G("use", { href: "#i-external-link" })
+ children: /* @__PURE__ */ W("use", { href: "#i-external-link" })
})
]
})]
}),
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ W("div", {
class: "scraping-label",
- children: ["连接方式", /* @__PURE__ */ G(jr, {
+ children: ["连接方式", /* @__PURE__ */ W(Nr, {
value: i,
onChange: a
})]
}),
- i === "peach" && /* @__PURE__ */ G(_t, {
+ i === "peach" && /* @__PURE__ */ W(vt, {
href: "/configuration#peachProxy",
children: "配置 Peach 代理"
}),
- e.accepts_cookie && /* @__PURE__ */ G(F, { children: [
- /* @__PURE__ */ G("p", { children: n.cookie_saved ? "Cookie 已保存,登录是否有效请在抓取时确认。" : "需要登录时,任选一种方式提供 Cookie。" }),
- /* @__PURE__ */ G("div", {
+ e.accepts_cookie && /* @__PURE__ */ W(F, { children: [
+ /* @__PURE__ */ W("p", { children: n.cookie_saved ? "Cookie 已保存,登录是否有效请在抓取时确认。" : "需要登录时,任选一种方式提供 Cookie。" }),
+ /* @__PURE__ */ W("div", {
class: "insightswitch scraping-cookie-method",
role: "radiogroup",
"aria-label": "提供 Cookie 的方式(二选一)",
- children: [["paste", "粘贴 Cookie"], ["file", "导入文件"]].map(([t, n]) => /* @__PURE__ */ G("label", { children: [/* @__PURE__ */ G("input", {
+ children: [["paste", "粘贴 Cookie"], ["file", "导入文件"]].map(([t, n]) => /* @__PURE__ */ W("label", { children: [/* @__PURE__ */ W("input", {
type: "radio",
name: `cookie-method-${e.source}`,
value: t,
@@ -2590,29 +2594,29 @@ function Mr({ source: e, toast: t }) {
onChange: () => {
p(t), c(""), u(""), g("");
}
- }), /* @__PURE__ */ G("span", { children: n })] }, t))
+ }), /* @__PURE__ */ W("span", { children: n })] }, t))
}),
- d === "paste" ? /* @__PURE__ */ G("label", { children: ["Cookie", /* @__PURE__ */ G("input", {
+ d === "paste" ? /* @__PURE__ */ W("label", { children: ["Cookie", /* @__PURE__ */ W("input", {
class: "geist-input",
type: "password",
autoComplete: "off",
value: s,
disabled: _,
onInput: (e) => c(e.currentTarget.value)
- })] }) : /* @__PURE__ */ G("label", {
+ })] }) : /* @__PURE__ */ W("label", {
class: "scraping-file",
- children: ["Netscape Cookie 文件(.txt)", /* @__PURE__ */ G("span", {
+ children: ["Netscape Cookie 文件(.txt)", /* @__PURE__ */ W("span", {
class: "scraping-file-control",
children: [
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ W("span", {
class: "geist-button",
children: "选择文件"
}),
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ W("span", {
class: "scraping-file-name",
children: m || "未选择文件"
}),
- /* @__PURE__ */ G("input", {
+ /* @__PURE__ */ W("input", {
ref: w,
type: "file",
accept: ".txt",
@@ -2642,32 +2646,32 @@ function Mr({ source: e, toast: t }) {
})]
})
] }),
- b && /* @__PURE__ */ G("div", {
+ b && /* @__PURE__ */ W("div", {
role: "alert",
dangerouslySetInnerHTML: { __html: h(b, { variant: "error" }) }
}),
- S.map((t) => /* @__PURE__ */ G("div", {
+ S.map((t) => /* @__PURE__ */ W("div", {
role: "status",
dangerouslySetInnerHTML: { __html: h(`${e.label}${t.label === "来源页面" ? "" : " 高清图片"}:${t.ok ? "可连接" : "不能连接"}` + (t.width ? ` · ${t.width} × ${t.height}` : "") + (t.message ? `。${t.message}` : ""), { variant: t.ok ? "success" : "error" }) }
}, t.label))
]
- }), /* @__PURE__ */ G("footer", {
+ }), /* @__PURE__ */ W("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
children: [
- e.accepts_cookie && n.cookie_saved && /* @__PURE__ */ G("button", {
+ e.accepts_cookie && n.cookie_saved && /* @__PURE__ */ W("button", {
class: "geist-button",
type: "button",
onClick: () => void D("revoke"),
children: "撤销 Cookie"
}),
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ W("button", {
class: "geist-button",
type: "button",
onClick: () => void D("check"),
children: "检查连接"
}),
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ W("button", {
class: "geist-button primary",
type: "submit",
children: "保存"
@@ -2677,14 +2681,14 @@ function Mr({ source: e, toast: t }) {
})
});
}
-function Nr({ data: e, error: t, toast: n }) {
- let [r, i] = B(""), [a, o] = B(!1), [s, c] = B(""), [l, u] = B(""), d = H(null);
- tt(() => y(d.current, a), [a]);
- let m = H(new AbortController()), g = H(0);
+function Fr({ data: e, error: t, toast: n }) {
+ let [r, i] = z(""), [a, o] = z(!1), [s, c] = z(""), [l, u] = z(""), d = V(null);
+ nt(() => y(d.current, a), [a]);
+ let m = V(new AbortController()), g = V(0);
async function _(e = !1) {
let t = ++g.current;
- await mt({
- read: (e) => W("/api/scraping/cover", e),
+ await ht({
+ read: (e) => U("/api/scraping/cover", e),
active: () => !m.current.signal.aborted && t === g.current,
render: (t) => {
o(t.status === "running"), t.status === "running" && (e = !1), t.status === "failed" && !e && c(t.error || "采集未取得"), t.status === "complete" && !e && (u(t.result || "封面采集完成"), n(t.result || "封面采集完成"));
@@ -2692,37 +2696,37 @@ function Nr({ data: e, error: t, toast: n }) {
disconnected: () => c("连接中断,正在重新读取后台进度")
});
}
- V(() => (_(!0), () => m.current.abort()), []);
+ B(() => (_(!0), () => m.current.abort()), []);
async function v() {
if (!a) {
g.current++, o(!0), c(""), u("");
try {
- await ft("/api/scraping/cover", { code: r }, "POST", m.current.signal), await _();
+ await pt("/api/scraping/cover", { code: r }, "POST", m.current.signal), await _();
} catch (e) {
- m.current.signal.aborted || (o(!1), c(U(e)));
+ m.current.signal.aborted || (o(!1), c(H(e)));
}
}
}
- return t ? /* @__PURE__ */ G("div", {
+ return t ? /* @__PURE__ */ W("div", {
role: "alert",
dangerouslySetInnerHTML: { __html: h(t, { variant: "error" }) }
- }) : /* @__PURE__ */ G("div", {
+ }) : /* @__PURE__ */ W("div", {
class: "scraping-page",
children: [
- /* @__PURE__ */ G("p", { children: "高清图片可能需要代理才能下载,请先检查连接。" }),
- /* @__PURE__ */ G("section", {
+ /* @__PURE__ */ W("p", { children: "高清图片可能需要代理才能下载,请先检查连接。" }),
+ /* @__PURE__ */ W("section", {
class: "cleanupfieldset scraping-source",
"data-geist-fieldset": !0,
- children: /* @__PURE__ */ G("div", {
+ children: /* @__PURE__ */ W("div", {
class: "geist-fieldset-content scraping-fields",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: f("scraping-cover", "高清封面") } }),
- /* @__PURE__ */ G("form", {
+ /* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: f("scraping-cover", "高清封面") } }),
+ /* @__PURE__ */ W("form", {
class: "scraping-cover-form",
onSubmit: (e) => {
e.preventDefault(), v();
},
- children: [/* @__PURE__ */ G("input", {
+ children: [/* @__PURE__ */ W("input", {
class: "geist-input",
"aria-label": "馆藏番号",
required: !0,
@@ -2730,29 +2734,29 @@ function Nr({ data: e, error: t, toast: n }) {
disabled: a,
placeholder: "输入馆藏番号,如 ABW-232",
onInput: (e) => i(e.currentTarget.value)
- }), /* @__PURE__ */ G("button", {
+ }), /* @__PURE__ */ W("button", {
ref: d,
class: "geist-button primary",
type: "submit",
children: "抓取封面"
})]
}),
- a && /* @__PURE__ */ G("div", {
+ a && /* @__PURE__ */ W("div", {
"aria-live": "polite",
dangerouslySetInnerHTML: { __html: p("正在抓取封面") }
}),
- s && /* @__PURE__ */ G("div", {
+ s && /* @__PURE__ */ W("div", {
role: "alert",
dangerouslySetInnerHTML: { __html: h(s, { variant: "error" }) }
}),
- l && /* @__PURE__ */ G("div", {
+ l && /* @__PURE__ */ W("div", {
role: "status",
dangerouslySetInnerHTML: { __html: h(l) }
})
]
})
}),
- e?.sources.map((e) => /* @__PURE__ */ G(Mr, {
+ e?.sources.map((e) => /* @__PURE__ */ W(Pr, {
source: e,
toast: n
}, e.source))
@@ -2761,12 +2765,12 @@ function Nr({ data: e, error: t, toast: n }) {
}
//#endregion
//#region src/state/index.ts
-var Pr = { "quality-goals": {
- refresh: Er,
- reset: Tr
-} }, Fr = () => Object.keys(Pr);
-async function Ir(e) {
- let t = Pr[e];
+var Ir = { "quality-goals": {
+ refresh: Or,
+ reset: Dr
+} }, Lr = () => Object.keys(Ir);
+async function Rr(e) {
+ let t = Ir[e];
if (!t) throw Error(`未登记的共享 store:${String(e)}`);
try {
return await t.refresh(), !0;
@@ -2776,24 +2780,24 @@ async function Ir(e) {
}
//#endregion
//#region src/review-evidence.ts
-var Lr = (e = "") => /^https?:\/\//i.test(e) ? e : "";
-function Rr(e = "") {
- let n = Lr(e) || (e.startsWith("/") && !e.startsWith("//") ? e : "");
+var zr = (e = "") => /^https?:\/\//i.test(e) ? e : "";
+function Br(e = "") {
+ let n = zr(e) || (e.startsWith("/") && !e.startsWith("//") ? e : "");
return `<div class="reviewimage" data-review-picture><span class="reviewimageempty"${n ? " hidden" : ""}>未取得来源图片</span>${n ? `<img src="${t(n)}" alt="来源候选图片" loading="lazy">` : ""}</div>`;
}
-function zr(e) {
- let n = Lr(e.profile_url), r = (e.preview_assets || []).slice(0, 6), i = Math.max(0, Number(e.video_count || e.videos || 0));
+function Vr(e) {
+ let n = zr(e.profile_url), r = (e.preview_assets || []).slice(0, 6), i = Math.max(0, Number(e.video_count || e.videos || 0));
return `<section class="reviewidentityevidence"><h5>候选身份:${t(e.babepedia_name || "未标注")}</h5>
<div class="reviewevidenceactions">${n ? `<a class="geist-button externallink" href="${t(n)}" target="_blank" rel="noopener noreferrer">来源资料<svg class="externalmark" viewBox="0 0 24 24" aria-hidden="true"><use href="#i-external-link" /></svg></a>` : ""}
<button type="button" class="geist-button" data-entity-kind="creator" data-entity-name="${t(e.creator || "")}">查看全部 ${i.toLocaleString()} 部作品</button></div>
- ${Rr(e.preview_url)}
+ ${Br(e.preview_url)}
<p>通过后记录身份判断。</p>
${r.length ? `<h5>本地作品样本</h5><div class="reviewevidencesamples">${r.map((e) => `<div class="reviewevidencesample">
<button class="geist-button" type="button" data-review-open-item="${e.id}"><span data-middle-truncate title="${t(e.name)}">${t(e.name)}</span></button>
<button class="geist-button" type="button" data-review-reveal="${e.id}" aria-label="打开 ${t(e.name)} 的文件位置">文件位置</button>
</div>`).join("")}</div>` : "<p>暂无本地作品样本,打开全部作品核对。</p>"}</section>`;
}
-function Br(e) {
+function Hr(e) {
for (let t of e.querySelectorAll("[data-review-picture] img")) {
let e = () => {
t.hidden = !0;
@@ -2805,11 +2809,11 @@ function Br(e) {
}
//#endregion
//#region src/selection.ts
-function Vr(e, t, n, r, i, a = i || !e.has(r)) {
+function Ur(e, t, n, r, i, a = i || !e.has(r)) {
let o = n === null ? -1 : t.indexOf(n), s = t.indexOf(r);
return i && o >= 0 && s >= 0 ? t.slice(Math.min(o, s), Math.max(o, s) + 1).forEach((t) => e.add(t)) : a ? e.add(r) : e.delete(r), r;
}
-function Hr(e, t) {
+function Wr(e, t) {
let n = t.filter((t) => e.has(t)).length;
return {
count: n,
@@ -2817,16 +2821,16 @@ function Hr(e, t) {
mixed: n > 0 && n < t.length
};
}
-function Ur(e, t, n) {
+function Gr(e, t, n) {
t.forEach((t) => n ? e.add(t) : e.delete(t));
}
-function Wr({ count: e, label: t, all: n, summary: r, actions: i, locked: a = !1 }) {
+function Kr({ count: e, label: t, all: n, summary: r, actions: i, locked: a = !1 }) {
e && (e.textContent = t), n && (n.checked = r.all, n.indeterminate = r.mixed);
for (let e of i) e.disabled = !r.count || a;
}
//#endregion
//#region src/review-bulk.ts
-var Gr = () => ({
+var qr = () => ({
busy: !1,
category: "",
filter: "",
@@ -2837,7 +2841,7 @@ var Gr = () => ({
assets: /* @__PURE__ */ new Map(),
errors: /* @__PURE__ */ new Map()
});
-function Kr(e) {
+function Jr(e) {
let t = e?.querySelector(".reviewbulktoolbar");
if (!e || e.classList.contains("review-skeleton") || !t || t.offsetParent === null) return;
e.style.setProperty("--review-controls-height", `${t.getBoundingClientRect().height}px`);
@@ -2853,7 +2857,7 @@ function Kr(e) {
let o = i.getBoundingClientRect(), s = a.getBoundingClientRect();
e.style.setProperty("--review-pane-top", `${o.top}px`), e.style.setProperty("--review-pane-left", `${o.left}px`), e.style.setProperty("--review-pane-width", `${o.width}px`), e.style.setProperty("--review-pane-height", `${s.bottom - o.top}px`);
}
-function qr(e, t) {
+function Yr(e, t) {
let n = [[
"candidates",
t ? "按候选数量" : "全部待复核",
@@ -2869,7 +2873,7 @@ function qr(e, t) {
"list-filter"
]), n;
}
-function Jr(e, t) {
+function Xr(e, t) {
let n = /* @__PURE__ */ new Map();
for (let r of e) {
let e, i;
@@ -2886,10 +2890,10 @@ function Jr(e, t) {
}
return [...n.values()];
}
-function Yr(e, t, n, r, i) {
- e.anchor = Vr(e.selected, t, e.anchor, n, r, i);
+function Zr(e, t, n, r, i) {
+ e.anchor = Ur(e.selected, t, e.anchor, n, r, i);
}
-async function Xr(e, t, n, r) {
+async function Qr(e, t, n, r) {
let i = [], a = 0;
for (let o of e) {
if (!r()) break;
@@ -2900,7 +2904,7 @@ async function Xr(e, t, n, r) {
} catch (e) {
i.push({
key: o.key,
- message: U(e)
+ message: H(e)
});
}
}
@@ -2909,17 +2913,17 @@ async function Xr(e, t, n, r) {
failures: i
};
}
-function Zr(e) {
+function $r(e) {
return e.length ? [...new Set(e.flatMap((e) => e.candidates?.map((e) => e.source || "") || []))].filter((t) => t && e.every((e) => e.candidates?.filter((e) => e.source === t).length === 1)) : [];
}
-function Qr(e, t) {
+function ei(e, t) {
let n = e.querySelector(".reviewlist");
if (!n || !t.rows.length || t.locked) return;
let r = t.state, a = [...n.querySelectorAll("[data-review-key]")];
t.category !== void 0 && r.category !== t.category && (r.category = t.category, r.filter = "", r.groupBy = "candidates", r.anchor = null);
- let o = t.catalog || t.rows, s = qr(o, t.metadata);
+ let o = t.catalog || t.rows, s = Yr(o, t.metadata);
s.some((e) => e[0] === r.groupBy) || (r.groupBy = "candidates", r.filter = "");
- let c = Jr(o, r.groupBy);
+ let c = Xr(o, r.groupBy);
c.some((e) => e.key === r.filter) || (r.filter = "");
let u = () => [...n.querySelectorAll("[data-review-key]")].filter((e) => !e.closest("[hidden]")), d = () => u().filter((e) => r.selected.has(e.dataset.reviewKey)), f = () => t.rows.filter((e) => d().some((t) => t.dataset.reviewKey === e.item_key)), p = (e) => !e.querySelector("[data-review-status=\"approved\"]")?.disabled, m = (e, t = "") => {
let n = document.createElement("button");
@@ -2997,7 +3001,7 @@ function Qr(e, t) {
f.className = "reviewlist", s.append(c, d), o.append(s, f), n.append(o), d.onclick = () => {
if (r.busy) return;
let e = t.map((e) => e.dataset.reviewKey);
- Ur(r.selected, e, !e.every((e) => r.selected.has(e))), N();
+ Gr(r.selected, e, !e.every((e) => r.selected.has(e))), N();
}, ne.push(() => {
let e = t.every((e) => r.selected.has(e.dataset.reviewKey));
d.innerHTML = i(e ? "check-check-outline" : "check-check") + (e ? "清空本组" : "全选本组"), d.setAttribute("aria-pressed", String(e));
@@ -3014,7 +3018,7 @@ function Qr(e, t) {
e.className = "reviewpickname", e.append(...n.childNodes), n.classList.add("reviewpickheading"), n.append(i, e);
} else e.prepend(i);
let o = (e, n) => {
- Yr(r, u().map((e) => e.dataset.reviewKey), t, e, n), N();
+ Zr(r, u().map((e) => e.dataset.reviewKey), t, e, n), N();
};
if (i.addEventListener("mousedown", (e) => {
e.shiftKey && e.preventDefault();
@@ -3028,7 +3032,7 @@ function Qr(e, t) {
else if (n.key === "ArrowDown" || n.key === "ArrowUp") {
n.preventDefault();
let i = u(), a = i[i.indexOf(e) + (n.key === "ArrowDown" ? 1 : -1)];
- a && (r.anchor === null && (r.anchor = t), Yr(r, i.map((e) => e.dataset.reviewKey), a.dataset.reviewKey, !0, !0), N(), a.querySelector(".reviewpickitem input")?.focus());
+ a && (r.anchor === null && (r.anchor = t), Zr(r, i.map((e) => e.dataset.reviewKey), a.dataset.reviewKey, !0, !0), N(), a.querySelector(".reviewpickitem input")?.focus());
}
}
}), ne.push(() => {
@@ -3056,20 +3060,20 @@ function Qr(e, t) {
let re = "";
function N() {
let e = d(), n = e.length > 0 && e.length === u().length;
- w.innerHTML = i(n ? "check-check-outline" : "check-check") + (n ? "清空当前选择" : r.filter ? "全选当前分类" : "全选本页"), w.setAttribute("aria-pressed", String(n)), j.hidden = !e.length, Wr({
+ w.innerHTML = i(n ? "check-check-outline" : "check-check") + (n ? "清空当前选择" : r.filter ? "全选当前分类" : "全选本页"), w.setAttribute("aria-pressed", String(n)), j.hidden = !e.length, Kr({
count: D,
label: `已选 ${e.length} 项`,
- summary: Hr(r.selected, u().map((e) => e.dataset.reviewKey)),
+ summary: Wr(r.selected, u().map((e) => e.dataset.reviewKey)),
actions: [T, E]
}), T.disabled ||= e.some((e) => !p(e));
- let a = Zr(f());
+ let a = $r(f());
O.hidden = !t.metadata || !f().some((e) => (e.candidates?.length || 0) > 1);
let o = e.length && !a.length ? "所选项目无共同来源" : "统一选择来源", s = JSON.stringify([o, a]);
if (s !== re) {
re = s, O.innerHTML = _([["", o], ...a.map((e) => [e, e])], "", { label: "统一选择来源" });
let e = S(O.firstElementChild);
e.disabled = !a.length, e.addEventListener("change", () => {
- if (!(r.busy || !Zr(f()).includes(e.value))) {
+ if (!(r.busy || !$r(f()).includes(e.value))) {
for (let n of d()) {
let i = t.rows.find((e) => e.item_key === n.dataset.reviewKey).candidates.find((t) => t.source === e.value);
n.querySelectorAll("input[type=\"radio\"]").forEach((e) => {
@@ -3102,7 +3106,7 @@ function Qr(e, t) {
e instanceof KeyboardEvent && e.key === "Tab" || (e.preventDefault(), e.stopImmediatePropagation());
};
e.addEventListener("click", c, !0), e.addEventListener("keydown", c, !0);
- let l = 0, u = await Xr(a, async (e) => {
+ let l = 0, u = await Qr(a, async (e) => {
try {
return await t.submit(e);
} finally {
@@ -3119,9 +3123,9 @@ function Qr(e, t) {
let f = e.parentElement;
t.refresh(), f?.querySelector(".reviewbulktoolbar button")?.focus({ preventScroll: !0 });
}
- N(), Kr(e);
+ N(), Jr(e);
}
-function $r(e, t, n = 1) {
+function ti(e, t, n = 1) {
let r = (e, t) => Array.from({ length: t - e + 1 }, (t, n) => e + n);
if (n * 2 + 5 >= t) return r(1, t);
let i = Math.max(e - n, 1), a = Math.min(e + n, t), o = i > 2, s = a < t - 2;
@@ -3141,15 +3145,15 @@ function $r(e, t, n = 1) {
t
];
}
-function ei(e, t) {
+function ni(e, t) {
return Math.max(1, Math.ceil(e / t));
}
-function ti(e, t) {
+function ri(e, t) {
return Math.min(Math.max(1, Math.floor(e) || 1), t);
}
-function ni(e, t, n) {
+function ii(e, t, n) {
if (t <= 1) return "";
- let r = $r(e, t).map((t) => t === "…" ? "<li class=\"board-page-dots\" aria-hidden=\"true\">…</li>" : `<li><button type="button" class="board-page" data-page="${t}" aria-label="第 ${t} 页"${t === e ? " aria-current=\"page\"" : ""}>${t}</button></li>`).join("");
+ let r = ti(e, t).map((t) => t === "…" ? "<li class=\"board-page-dots\" aria-hidden=\"true\">…</li>" : `<li><button type="button" class="board-page" data-page="${t}" aria-label="第 ${t} 页"${t === e ? " aria-current=\"page\"" : ""}>${t}</button></li>`).join("");
return `<nav class="board-pagination" aria-label="${n}">
<button type="button" class="geist-button" data-page="${e - 1}"${e <= 1 ? " disabled" : ""}><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-chevron-left"></use></svg>上一页</button>
<ul>${r}</ul>
@@ -3158,10 +3162,10 @@ function ni(e, t, n) {
}
//#endregion
//#region src/native-image.ts
-function ri(e, t, n, r) {
+function ai(e, t, n, r) {
return e > 0 && t > 0 && e === n && t === r;
}
-function ii(e, t, n, r, i = 1) {
+function oi(e, t, n, r, i = 1) {
let a = Number.isFinite(i) && i > 0 ? i : 1;
e /= a, t /= a;
let o = [
@@ -3178,24 +3182,24 @@ function ii(e, t, n, r, i = 1) {
}
//#endregion
//#region src/avatar-picker.tsx
-var ai = {
+var si = {
gfriends: "图库",
history: "用过的"
};
-function oi({ kind: e, id: t, name: n, onPicked: r }) {
- let i = H(null), a = H(null), o = H(null), [s, l] = B(null), [u, d] = B(""), [f, p] = B(""), [m, h] = B(""), [g, _] = B(!1);
- V(() => {
+function ci({ kind: e, id: t, name: n, onPicked: r }) {
+ let i = V(null), a = V(null), o = V(null), [s, l] = z(null), [u, d] = z(""), [f, p] = z(""), [m, h] = z(""), [g, _] = z(!1);
+ B(() => {
if (!g || s) return;
let n = new AbortController();
- return W(`/api/avatar-choices?kind=${e}&id=${t}`, n.signal).then(l).catch((e) => {
- n.signal.aborted || d(U(e));
+ return U(`/api/avatar-choices?kind=${e}&id=${t}`, n.signal).then(l).catch((e) => {
+ n.signal.aborted || d(H(e));
}), () => n.abort();
}, [
g,
s,
e,
t
- ]), V(() => {
+ ]), B(() => {
c(a.current);
}, [g, s]);
let v = () => {
@@ -3207,15 +3211,15 @@ function oi({ kind: e, id: t, name: n, onPicked: r }) {
try {
await e(), y(), l(null), r();
} catch (e) {
- d(U(e));
+ d(H(e));
} finally {
p("");
}
- }, x = (n) => b(() => ft("/api/avatar-pick", {
+ }, x = (n) => b(() => pt("/api/avatar-pick", {
kind: e,
id: t,
ref: n.ref
- }), n.ref), S = () => b(() => ft("/api/avatar-pick", {
+ }), n.ref), S = () => b(() => pt("/api/avatar-pick", {
kind: e,
id: t,
url: m.trim()
@@ -3230,21 +3234,21 @@ function oi({ kind: e, id: t, name: n, onPicked: r }) {
throw Error(e?.error || `请求失败(${r.status})`);
}
}, "file"), w = s?.choices || [], T = (s?.matched_names || []).filter((e) => e !== n), E = s ? T.length ? `${n}:图库里按「${T.join("」「")}」找到的。` : w.length ? `${n}:换上的那张留在本机,随时能换回来。` : `${n}:图库里没有这个名字,用下面两种方式换。` : "正在找可用的图…", D = !!s && s.index_stale && !w.some((e) => e.source === "gfriends");
- return /* @__PURE__ */ G("div", {
+ return /* @__PURE__ */ W("div", {
class: "avatarpick",
- children: [/* @__PURE__ */ G("button", {
+ children: [/* @__PURE__ */ W("button", {
type: "button",
class: "avatarpick-open",
onClick: v,
"aria-haspopup": "dialog",
"aria-label": `更换${n}的头像`,
title: "更换头像",
- children: /* @__PURE__ */ G("svg", {
+ children: /* @__PURE__ */ W("svg", {
viewBox: "0 0 24 24",
"aria-hidden": "true",
- children: /* @__PURE__ */ G("use", { href: "#i-plus" })
+ children: /* @__PURE__ */ W("use", { href: "#i-plus" })
})
- }), /* @__PURE__ */ G("dialog", {
+ }), /* @__PURE__ */ W("dialog", {
ref: i,
class: "geist-modal avatarpick-popover",
"aria-label": "更换头像",
@@ -3252,90 +3256,90 @@ function oi({ kind: e, id: t, name: n, onPicked: r }) {
onClick: (e) => {
e.target === i.current && y();
},
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ W("div", {
class: "avatarpick-head",
children: [
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ W("span", {
class: "avatarpick-mark",
"aria-hidden": "true",
- children: /* @__PURE__ */ G("svg", {
+ children: /* @__PURE__ */ W("svg", {
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-user-round" })
+ children: /* @__PURE__ */ W("use", { href: "#i-user-round" })
})
}),
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ W("div", {
class: "avatarpick-headtext",
children: [
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ W("div", {
class: "avatarpick-title",
- children: [/* @__PURE__ */ G("h3", { children: "更换头像" }), !!w.length && /* @__PURE__ */ G("span", {
+ children: [/* @__PURE__ */ W("h3", { children: "更换头像" }), !!w.length && /* @__PURE__ */ W("span", {
class: "geist-badge",
children: [w.length, " 张可选"]
})]
}),
- /* @__PURE__ */ G("p", { children: E }),
- D && /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ W("p", { children: E }),
+ D && /* @__PURE__ */ W("p", {
class: "avatarpick-note",
children: "图库索引还没取过,只能从用过的图里选。"
}),
- u && /* @__PURE__ */ G("p", {
+ u && /* @__PURE__ */ W("p", {
class: "avatarpick-error",
role: "alert",
children: u
})
]
}),
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ W("button", {
type: "button",
class: "avatarpick-close",
onClick: y,
"aria-label": "关闭",
- children: /* @__PURE__ */ G("svg", {
+ children: /* @__PURE__ */ W("svg", {
viewBox: "0 0 24 24",
"aria-hidden": "true",
- children: /* @__PURE__ */ G("use", { href: "#i-x" })
+ children: /* @__PURE__ */ W("use", { href: "#i-x" })
})
})
]
- }), /* @__PURE__ */ G("div", {
+ }), /* @__PURE__ */ W("div", {
class: "avatarpick-panel",
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ W("div", {
class: "avatarpick-gridwrap",
- children: /* @__PURE__ */ G("div", {
+ children: /* @__PURE__ */ W("div", {
class: "avatarpick-grid",
role: "listbox",
"aria-label": "候选头像",
ref: a,
- children: w.map((n) => /* @__PURE__ */ G("button", {
+ children: w.map((n) => /* @__PURE__ */ W("button", {
type: "button",
role: "option",
"aria-selected": n.current,
disabled: !!f,
class: `avatarpick-cell${n.current ? " current" : ""}`,
- title: `${ai[n.source] || n.source} · ${n.label}` + (n.width ? ` · ${n.width}×${n.height}` : "") + (n.found_by ? ` · 按「${n.found_by}」找到` : ""),
+ title: `${si[n.source] || n.source} · ${n.label}` + (n.width ? ` · ${n.width}×${n.height}` : "") + (n.found_by ? ` · 按「${n.found_by}」找到` : ""),
onClick: () => x(n),
children: [
- /* @__PURE__ */ G("img", {
+ /* @__PURE__ */ W("img", {
loading: "lazy",
alt: "",
src: `/avatar-choice?kind=${e}&id=${t}&ref=${encodeURIComponent(n.ref)}`
}),
- /* @__PURE__ */ G("span", { children: n.label }),
- n.current && /* @__PURE__ */ G("b", { children: "在用" })
+ /* @__PURE__ */ W("span", { children: n.label }),
+ n.current && /* @__PURE__ */ W("b", { children: "在用" })
]
}, n.ref))
})
- }), /* @__PURE__ */ G("div", {
+ }), /* @__PURE__ */ W("div", {
class: "avatarpick-actions",
children: [
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ W("button", {
type: "button",
class: "geist-button",
disabled: !!f,
onClick: () => o.current?.click(),
children: "从本机选图片"
}),
- /* @__PURE__ */ G("input", {
+ /* @__PURE__ */ W("input", {
ref: o,
type: "file",
accept: "image/png,image/jpeg",
@@ -3345,16 +3349,16 @@ function oi({ kind: e, id: t, name: n, onPicked: r }) {
e.currentTarget.value = "", t && C(t);
}
}),
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ W("div", {
class: "avatarpick-url",
- children: [/* @__PURE__ */ G("input", {
+ children: [/* @__PURE__ */ W("input", {
type: "url",
class: "geist-input",
value: m,
placeholder: "https://…",
"aria-label": "图片地址",
onInput: (e) => h(e.currentTarget.value)
- }), /* @__PURE__ */ G("button", {
+ }), /* @__PURE__ */ W("button", {
type: "button",
class: "geist-button",
disabled: !m.trim() || !!f,
@@ -3368,15 +3372,15 @@ function oi({ kind: e, id: t, name: n, onPicked: r }) {
})]
});
}
-function si(e, t) {
- je(/* @__PURE__ */ G(oi, { ...t }), e);
+function li(e, t) {
+ Me(/* @__PURE__ */ W(ci, { ...t }), e);
}
-function ci(e) {
- je(null, e);
+function ui(e) {
+ Me(null, e);
}
//#endregion
//#region src/entity-skeleton.ts
-function li(e, t, n) {
+function di(e, t, n) {
return `<section data-skeleton="entity/${e}" role="status" aria-label="正在读取资料">
<span class="sr-only">正在读取资料</span><div aria-hidden="true">
<section class="entityhero"><div class="entityprofile"><div class="entityportrait ${e === "studio" || e === "agency" ? "square " : ""}skeleton"></div>
@@ -3390,27 +3394,27 @@ function li(e, t, n) {
}
//#endregion
//#region src/board-skeleton.ts
-var Z = (e = "60%") => `<span class="skeleton" style="width:${e}"></span>`, ui = () => `${Z("80%")}${Z("48%")}`, Q = (e, t) => e.repeat(t), di = (e, t = "metricstrip") => `<div class="${t}">${e.map((e) => `<div class="tastesummary"><span class="board-stat-label">${e}</span><b class="board-stat-value">${Z("45%")}</b><small class="board-stat-footer">${Z("60%")}</small></div>`).join("")}</div>`, fi = (e, t = "skeleton-tabs") => `<div class="${t}">${e.map((e) => `<span>${e}</span>`).join("")}</div>`, pi = (e, t) => `<div class="${t} skeleton-segments" data-board-segments="true">${e.map((e, t) => `<span${t === 0 ? " class=\"skeleton-segment-selected\"" : ""}>${e}</span>`).join("")}</div>`, mi = (e) => `<section class="board-radial-card"><header><span>${e}</span><b>${Z()}</b></header><div class="board-rings skeleton-rings"><span class="skeleton skeleton-ring"></span></div><div class="skeleton-lines">${ui()}</div></section>`, hi = (e) => `<section class="insightpanel"><header>${e}</header><div class="insightpanelbody skeleton-lines">${Q(ui(), 3)}</div></section>`, gi = (e) => `<button class="fbtn" type="button" disabled>${e}</button>`, _i = (e) => `<div class="fsechead" data-collapse-toolbar><h3>关注列表</h3><span class="fmeta">${Z("100px")}</span><div class="followtoolbaractions"><button class="fbtn primary followcheckall" disabled>${i("refresh-cw")}<span data-collapse-label>检查全部</span></button><div class="iconswitch" data-board-segments="true"><label>${i("layout-grid")}</label><label>${i("table")}</label></div><span class="fmanagesort" data-collapse-field>${i("sort")}${_([["checked", "检查时间"]], "checked", {
+var Z = (e = "60%") => `<span class="skeleton" style="width:${e}"></span>`, fi = () => `${Z("80%")}${Z("48%")}`, Q = (e, t) => e.repeat(t), pi = (e, t = "metricstrip") => `<div class="${t}">${e.map((e) => `<div class="tastesummary"><span class="board-stat-label">${e}</span><b class="board-stat-value">${Z("45%")}</b><small class="board-stat-footer">${Z("60%")}</small></div>`).join("")}</div>`, mi = (e, t = "skeleton-tabs") => `<div class="${t}">${e.map((e) => `<span>${e}</span>`).join("")}</div>`, hi = (e, t) => `<div class="${t} skeleton-segments" data-board-segments="true">${e.map((e, t) => `<span${t === 0 ? " class=\"skeleton-segment-selected\"" : ""}>${e}</span>`).join("")}</div>`, gi = (e) => `<section class="board-radial-card"><header><span>${e}</span><b>${Z()}</b></header><div class="board-rings skeleton-rings"><span class="skeleton skeleton-ring"></span></div><div class="skeleton-lines">${fi()}</div></section>`, _i = (e) => `<section class="insightpanel"><header>${e}</header><div class="insightpanelbody skeleton-lines">${Q(fi(), 3)}</div></section>`, vi = (e) => `<button class="fbtn" type="button" disabled>${e}</button>`, yi = (e) => `<div class="fsechead" data-collapse-toolbar><h3>关注列表</h3><span class="fmeta">${Z("100px")}</span><div class="followtoolbaractions"><button class="fbtn primary followcheckall" disabled>${i("refresh-cw")}<span data-collapse-label>检查全部</span></button><div class="iconswitch" data-board-segments="true"><label>${i("layout-grid")}</label><label>${i("table")}</label></div><span class="fmanagesort" data-collapse-field>${i("sort")}${_([["checked", "检查时间"]], "checked", {
label: "关注列表排序",
attr: "disabled"
-})}</span><button class="fbtn fmanagedir" disabled>${i("arrow-down")}</button>${e ? "" : gi(i("chevron-up") + "<span data-collapse-label>全部收起</span>")}</div></div>`, vi = () => `<div class="fsource frow"><span class="fchannelcheck">${Z("18px")}</span><b>${Z("85%")}</b><span class="fprovider">${Z("54px")}</span><span class="fmeta fchecked">${Z("40px")}</span><span class="fsourceactions"><span class="skeleton skeleton-icon"></span><span class="skeleton skeleton-icon"></span></span></div>`, yi = () => `<details class="fauthor" open><summary class="fauthorhead"><span class="favatar skeleton"></span><b>${Z("90px")}</b><span class="skeleton skeleton-icon"></span><span class="fmeta">${Z("40px")}</span><span class="board-author-actions"><button type="button" class="fbtn small" data-follow-author-select disabled>${i("check-check")}<span data-author-select-label>全选</span></button><span class="skeleton skeleton-icon"></span></span></summary><div class="fauthorsources">${Q(vi(), 3)}</div></details>`;
-function bi() {
- return `<div data-skeleton="detail" role="status" aria-label="正在读取作品详情"><div class="sgrid" aria-hidden="true"><div class="vwrap skeleton-detail-media skeleton"></div><aside class="side"><div class="sidecontent skeleton-lines">${Z("85%")}${Z("65%")}${Q(ui(), 4)}</div></aside></div></div>`;
+})}</span><button class="fbtn fmanagedir" disabled>${i("arrow-down")}</button>${e ? "" : vi(i("chevron-up") + "<span data-collapse-label>全部收起</span>")}</div></div>`, bi = () => `<div class="fsource frow"><span class="fchannelcheck">${Z("18px")}</span><b>${Z("85%")}</b><span class="fprovider">${Z("54px")}</span><span class="fmeta fchecked">${Z("40px")}</span><span class="fsourceactions"><span class="skeleton skeleton-icon"></span><span class="skeleton skeleton-icon"></span></span></div>`, xi = () => `<details class="fauthor" open><summary class="fauthorhead"><span class="favatar skeleton"></span><b>${Z("90px")}</b><span class="skeleton skeleton-icon"></span><span class="fmeta">${Z("40px")}</span><span class="board-author-actions"><button type="button" class="fbtn small" data-follow-author-select disabled>${i("check-check")}<span data-author-select-label>全选</span></button><span class="skeleton skeleton-icon"></span></span></summary><div class="fauthorsources">${Q(bi(), 3)}</div></details>`;
+function Si() {
+ return `<div data-skeleton="detail" role="status" aria-label="正在读取作品详情"><div class="sgrid" aria-hidden="true"><div class="vwrap skeleton-detail-media skeleton"></div><aside class="side"><div class="sidecontent skeleton-lines">${Z("85%")}${Z("65%")}${Q(fi(), 4)}</div></aside></div></div>`;
}
-function xi(e, t = {}) {
+function Ci(e, t = {}) {
let n = "";
- if (e === "/stats") n = `<div class="insightpage statsdashboard"><header class="insighttoolbar">${Z("38%")}</header>${di([
+ if (e === "/stats") n = `<div class="insightpage statsdashboard"><header class="insighttoolbar">${Z("38%")}</header>${pi([
"馆藏视频",
"看过",
"内容标签",
"使用空间"
- ])}<section class="insightdetail"><div class="insightdetailbody"><div class="board-inventory-charts">${mi("网盘与本地")}${mi("媒体库")}</div></div></section>${hi("内容标签")}</div>`;
- else if (e === "/taste") n = `<div class="tastepage"><header class="tastehead">${pi(["浏览器记录", "Peach 内部"], "insightswitch")}${Z("24%")}</header><div class="tastestate"></div>${di([
+ ])}<section class="insightdetail"><div class="insightdetailbody"><div class="board-inventory-charts">${gi("网盘与本地")}${gi("媒体库")}</div></div></section>${_i("内容标签")}</div>`;
+ else if (e === "/taste") n = `<div class="tastepage"><header class="tastehead">${hi(["浏览器记录", "Peach 内部"], "insightswitch")}${Z("24%")}</header><div class="tastestate"></div>${pi([
"浏览记录",
"口味维度",
"浏览候选",
"私有导出"
- ], "tastesummaries")}<section class="tastehero"><div class="insightcopy"><span>浏览器画像</span><div class="skeleton skeleton-radar"></div></div><div class="tastebars skeleton-lines">${Q(ui(), 4)}</div></section>${hi("口味分析")}<div class="board-activity-charts">${hi("浏览活动")}${hi("时间分布")}</div>${hi("标签")}</div>`;
+ ], "tastesummaries")}<section class="tastehero"><div class="insightcopy"><span>浏览器画像</span><div class="skeleton skeleton-radar"></div></div><div class="tastebars skeleton-lines">${Q(fi(), 4)}</div></section>${_i("口味分析")}<div class="board-activity-charts">${_i("浏览活动")}${_i("时间分布")}</div>${_i("标签")}</div>`;
else if (e === "/follow-manage") {
let e = t.followLayout === "table", r = e ? `<div class="ftableframe"><div class="ftablewrap"><table class="ftable"><thead><tr>${[
"选择",
@@ -3428,18 +3432,18 @@ function xi(e, t = {}) {
"40px",
"100px",
"60px"
- ].map((e) => `<td>${Z(e)}</td>`).join("")}</tr>`, 6)}</tbody></table></div></div>` : `<div class="board-follow-list">${Q(yi(), 4)}</div>`;
+ ].map((e) => `<td>${Z(e)}</td>`).join("")}</tr>`, 6)}</tbody></table></div></div>` : `<div class="board-follow-list">${Q(xi(), 4)}</div>`;
n = `<div class="follow followmanage"><div class="fmanageoverview">${[
"关注创作者",
"启用来源",
"检查失败",
"未看更新"
- ].map((e) => `<div><span>${e}</span><b>${Z()}</b></div>`).join("")}</div>${pi([
+ ].map((e) => `<div><span>${e}</span><b>${Z()}</b></div>`).join("")}</div>${hi([
"关注列表",
"添加关注",
"来源和凭证"
- ], "follow-workspace-switch")}<div class="fmain"><section class="fsec" data-follow-workspace-panel="list">${_i(e)}<div class="board-follow-selection"${e ? " hidden" : ""}><label>${l("disabled")}全选本页</label></div><div class="frows fsources" data-layout="${e ? "table" : "default"}">${r}<div class="followpagefooter"><div class="followpageinfo">${Z("120px")}${Z("100px")}</div></div></div></section></div></div>`;
- } else if (e === "/configuration") n = `<div class="configpage">${fi([
+ ], "follow-workspace-switch")}<div class="fmain"><section class="fsec" data-follow-workspace-panel="list">${yi(e)}<div class="board-follow-selection"${e ? " hidden" : ""}><label>${l("disabled")}全选本页</label></div><div class="frows fsources" data-layout="${e ? "table" : "default"}">${r}<div class="followpagefooter"><div class="followpageinfo">${Z("120px")}${Z("100px")}</div></div></div></section></div></div>`;
+ } else if (e === "/configuration") n = `<div class="configpage">${mi([
"通用",
"媒体",
"网络与访问",
@@ -3449,16 +3453,16 @@ function xi(e, t = {}) {
"正在进行",
"被挡下的",
"最近完成"
- ].map((e) => `<section class="activitysection"><h3 class="geist-fieldset-title">${e}</h3><div class="activity-runs"><article class="cleanupfieldset activity-run"><div class="geist-fieldset-content skeleton-lines">${Z("35%")}${ui()}</div></article></div></section>`).join("")}</div>`;
+ ].map((e) => `<section class="activitysection"><h3 class="geist-fieldset-title">${e}</h3><div class="activity-runs"><article class="cleanupfieldset activity-run"><div class="geist-fieldset-content skeleton-lines">${Z("35%")}${fi()}</div></article></div></section>`).join("")}</div>`;
else if (e === "/duplicates") n = `<div class="review"><div class="collection-summary">${Z("38%")}</div><div class="fsechead dupactions"><h3>批量保留</h3>${Z("40%")}</div>${Q(`<section class="dupgroup"><div class="duphead">${Z("45%")}</div><div class="duplist">${Q(`<div class="duprow"><span class="dupcover skeleton"></span><span class="dupmarks">${Z()}</span><span class="dupname">${Z("90%")}</span>${Z()}${Z()}${Z()}<span class="duppath">${Z("70%")}</span></div>`, 2)}</div></section>`, 2)}</div>`;
- else if (e === "/quality-goals") n = `<div class="quality-workspace"><div class="collection-summary"><strong>待升级</strong>${Z("20%")}</div><div class="qualitylist">${Q(`<article class="qualityitem"><span class="qualitycover skeleton"></span><div class="qualitybody skeleton-lines">${ui()}</div><footer class="qualityactions">${Z("80%")}</footer></article>`, 6)}</div></div>`;
- else if (e === "/playlists") n = `<section class="playlistpage"><header><div><h2>播放列表</h2><p>保存 Mix,按自己的顺序继续播放。</p></div><div class="playlistcreate skeleton-lines"><span>新播放列表</span>${Z("200px")}</div></header><div class="playlistcards">${Q(`<article class="card playlistcard"><div class="mixstack"><div class="pic skeleton"></div></div><div class="mixmeta"><span class="mav skeleton"></span><div class="mixcopy skeleton-lines">${ui()}</div></div></article>`, 6)}</div></section>`;
+ else if (e === "/quality-goals") n = `<div class="quality-workspace"><div class="collection-summary"><strong>待升级</strong>${Z("20%")}</div><div class="qualitylist">${Q(`<article class="qualityitem"><span class="qualitycover skeleton"></span><div class="qualitybody skeleton-lines">${fi()}</div><footer class="qualityactions">${Z("80%")}</footer></article>`, 6)}</div></div>`;
+ else if (e === "/playlists") n = `<section class="playlistpage"><header><div><h2>播放列表</h2><p>保存 Mix,按自己的顺序继续播放。</p></div><div class="playlistcreate skeleton-lines"><span>新播放列表</span>${Z("200px")}</div></header><div class="playlistcards">${Q(`<article class="card playlistcard"><div class="mixstack"><div class="pic skeleton"></div></div><div class="mixmeta"><span class="mav skeleton"></span><div class="mixcopy skeleton-lines">${fi()}</div></div></article>`, 6)}</div></section>`;
else return "";
return `<div class="board-page-skeleton" data-skeleton="board${e}" role="status" aria-label="正在读取页面"><div aria-hidden="true" inert>${n}</div></div>`;
}
//#endregion
//#region src/catalog-onboarding.ts
-var Si = [
+var wi = [
"loc",
"creator",
"performer",
@@ -3476,16 +3480,16 @@ var Si = [
"jav",
"thumb"
];
-function Ci() {
+function Ti() {
let e = (e) => Array(64).fill(e).join("");
return {
tiers: "<div class=\"tier catalog-placeholder\" aria-hidden=\"true\">" + e("<span class=\"av\"><span class=\"ring\"></span><span class=\"nm\">&nbsp;</span></span>") + "</div><div class=\"tier catalog-placeholder\" aria-hidden=\"true\">" + e("<span class=\"brandpill\"><span class=\"mk\"></span><span class=\"placeholder-name\">&nbsp;</span></span>") + "</div>",
tags: "<span class=\"catalog-placeholder placeholder-tags\" aria-hidden=\"true\">" + e("<span class=\"pill\">&nbsp;</span>") + "</span>"
};
}
-async function wi(e, t) {
+async function Ei(e, t) {
let n = new URLSearchParams();
- for (let t of Si) e[t] && n.set(t, e[t]);
+ for (let t of wi) e[t] && n.set(t, e[t]);
let [r, i] = await Promise.all([t("/api/facets?" + n), t("/api/items?" + n + "&limit=5")]), a = [...new Set([
...r.creators || [],
...r.tagperformers || [],
@@ -3496,7 +3500,7 @@ async function wi(e, t) {
return r.set("q", e), r.set("limit", "1"), (await t("/api/items?" + r)).total > 0 ? e : "";
}))).filter(Boolean);
}
-function Ti({ kind: e = "catalog", filtered: t = !1, jav: n = !1, configurable: r = !1, online: i = !1 } = {}) {
+function Di({ kind: e = "catalog", filtered: t = !1, jav: n = !1, configurable: r = !1, online: i = !1 } = {}) {
let a = r ? "<button class=\"geist-button primary\" data-empty-settings>添加内容</button>" : "", o = "<a class=\"geist-button" + (!r || i ? " primary" : "") + "\" href=\"/follow-manage?tab=add\">添加关注</a>";
if (t || n) return d("search", n ? "还没有符合条件的 JAV 作品" : "没有符合条件的内容", n ? "已扫描但尚未补充发行资料的视频可在全部内容中查看。" : "清除筛选或搜索条件后查看全部内容。", { actions: "<a class=\"geist-button primary\" href=\"/?loc=&thumb=0\">查看全部内容</a>" });
if (e !== "catalog") {
@@ -3517,7 +3521,7 @@ function Ti({ kind: e = "catalog", filtered: t = !1, jav: n = !1, configurable:
}
//#endregion
//#region src/sidebar.ts
-function Ei(e) {
+function Oi(e) {
return [
"/",
"/unseen",
@@ -3527,57 +3531,57 @@ function Ei(e) {
"/junk-files"
].includes(e) || /^\/(item|mix|parts|editions)\//.test(e) || /^\/playlists\/\d+\/\d+$/.test(e) || /^\/(performers|studios|creators|series|agencies)\/.+/.test(e);
}
-function Di(e, t) {
+function ki(e, t) {
return e.dataset.surface?.split("?")[0] === t.split("?")[0] && e.querySelector(".dnav") ? (e.dataset.surface = t, !1) : (e.dataset.surface = t, e.replaceChildren(), !0);
}
-function Oi(e) {
+function Ai(e) {
let t = /* @__PURE__ */ new Map();
for (let n of e) for (let e of new Set(n.tags || [])) t.set(e, (t.get(e) || 0) + 1);
return [...t].sort((e, t) => t[1] - e[1]).slice(0, 30);
}
//#endregion
//#region src/resource-sync.ts
-var $ = (e = 0) => Number(e).toLocaleString(), ki = {
+var $ = (e = 0) => Number(e).toLocaleString(), ji = {
local: "本地磁盘",
115: "115",
pikpak: "PikPak"
-}, Ai = (e) => v(s[e] ?? "database"), ji = (e, t, n) => `<article class="board-plain-stat resourcestat">
+}, Mi = (e) => v(s[e] ?? "database"), Ni = (e, t, n) => `<article class="board-plain-stat resourcestat">
<span class="board-plain-stat-head">${e}</span>
<strong>${t}</strong>
<span class="cleanupmeta">${n}</span></article>`;
-function Mi(e, t) {
+function Pi(e, t) {
let n = e.cache || {
files: 0,
bytes: 0
}, r = !!(e.missing || n.files);
- return `<div class="cleanupstats resourcestats">${(e.sources || []).map((e) => ji(`<span class="board-stat-tile resourcestat-tile">${Ai(e.location)}</span>${ki[e.location] || "媒体来源"}<span class="resourcestat-state ${e.online ? "online" : "offline"}">${e.online ? "可访问" : "离线,已跳过"}</span>`, e.online ? `${$(e.missing)} 项` : "—", [e.online ? `找不到文件 · 已检查 ${$(e.checked)} 项` : `馆藏中有 ${$(e.total)} 项`, e.unreadable ? `${$(e.unreadable)} 项读取失败,已跳过` : ""].filter(Boolean).join(" · "))).join("")}
- ${ji("待移入回收站", `${$(e.missing)} 项`, "")}
- ${ji("可清理的缓存", `${$(n.files)} 个`, n.files ? t(n.bytes) : "")}</div>
+ return `<div class="cleanupstats resourcestats">${(e.sources || []).map((e) => Ni(`<span class="board-stat-tile resourcestat-tile">${Mi(e.location)}</span>${ji[e.location] || "媒体来源"}<span class="resourcestat-state ${e.online ? "online" : "offline"}">${e.online ? "可访问" : "离线,已跳过"}</span>`, e.online ? `${$(e.missing)} 项` : "—", [e.online ? `找不到文件 · 已检查 ${$(e.checked)} 项` : `馆藏中有 ${$(e.total)} 项`, e.unreadable ? `${$(e.unreadable)} 项读取失败,已跳过` : ""].filter(Boolean).join(" · "))).join("")}
+ ${Ni("待移入回收站", `${$(e.missing)} 项`, "")}
+ ${Ni("可清理的缓存", `${$(n.files)} 个`, n.files ? t(n.bytes) : "")}</div>
${r ? h(`将把找不到文件的 ${$(e.missing)} 项馆藏记录移入回收站,并清理 ${$(n.files)} 个闲置缓存。`, { label: "清理内容" }) : ""}
<div class="resourceapplyrow geist-fieldset-footer" data-geist-fieldset-footer>${r ? "<button class=\"geist-button primary\" type=\"button\" id=\"resourceApply\">清理失效记录与缓存</button>" : "<p class=\"resourcesyncok\">已检查可访问的来源,没有待清理的记录或缓存。</p>"}</div>`;
}
//#endregion
//#region src/jav-artwork.ts
-function Ni(e) {
+function Fi(e) {
return [
"small",
"sleeve",
"preview"
].includes(String(e)) ? "small" : "big";
}
-function Pi(e) {
+function Ii(e) {
return {
- javLayout: Ni(e.javLayout),
- javImage: Fi(e.javLayout === "preview" ? "thumbnail" : e.javImage)
+ javLayout: Fi(e.javLayout),
+ javImage: Li(e.javLayout === "preview" ? "thumbnail" : e.javImage)
};
}
-function Fi(e) {
+function Li(e) {
return e === "thumbnail" ? "thumbnail" : "cover";
}
-function Ii(e, t) {
- return e.is_jav && e.code && e.has_cover && (Fi(t) === "cover" || !e.has_thumb) ? "cover" : e.has_thumb ? "thumbnail" : "";
+function Ri(e, t) {
+ return e.is_jav && e.code && e.has_cover && (Li(t) === "cover" || !e.has_thumb) ? "cover" : e.has_thumb ? "thumbnail" : "";
}
-function Li(e, t) {
+function zi(e, t) {
let n = Number(e?.px?.[0]), r = Number(e?.px?.[1]), i = Number(e?.x0);
if (!(n > 0 && r > 0 && t > 0) || !Number.isFinite(i)) return null;
let a = Math.min(1, Math.max(0, i / n)), o = n / r / t, s = (1 - a) * o;
@@ -3588,42 +3592,42 @@ function Li(e, t) {
left: l(c)
};
}
-function Ri(e, t) {
+function Bi(e, t) {
e.querySelectorAll("img[data-jav-image]").forEach((e) => {
- let n = e.dataset.javCover || "", r = e.dataset.javThumb || "", i = !!(n && (Fi(t) === "cover" || !r)), a = i ? n : r;
+ let n = e.dataset.javCover || "", r = e.dataset.javThumb || "", i = !!(n && (Li(t) === "cover" || !r)), a = i ? n : r;
e.classList.toggle("cover", i), e.classList.toggle("whole", i && e.dataset.javImageLayout !== "big"), e.classList.toggle("front", i && e.dataset.javImageLayout === "big"), e.classList.remove("panel"), e.removeAttribute("style"), e.closest(".pic")?.style.removeProperty("--cover-blur"), a && e.getAttribute("src") !== a && (e.src = a);
});
}
//#endregion
//#region src/islands.ts
-var zi = {
+var Vi = {
"library-processing": {
- load: yt,
- component: Tt
+ load: bt,
+ component: Ot
},
scraping: {
- load: Ar,
- component: Nr
+ load: Mr,
+ component: Fr
},
"quality-goals": {
- load: Dr,
- component: kr
+ load: kr,
+ component: jr
},
configuration: {
- load: Ln,
- component: Rn
+ load: Bn,
+ component: Vn
},
activity: { react: "activity" }
-}, Bi = () => Object.keys(zi), Vi = /* @__PURE__ */ new Map();
-async function Hi(e, t, n, r = {}) {
- let i = zi[e];
+}, Hi = () => Object.keys(Vi), Ui = /* @__PURE__ */ new Map();
+async function Wi(e, t, n, r = {}) {
+ let i = Vi[e];
if (!i) throw Error(`未注册的 island:${String(e)}`);
- Ki(t);
+ Ji(t);
let a = {
controller: new AbortController(),
painted: !1
};
- if (Vi.set(t, a), "react" in i) return Wi(i, t, n, a, r);
+ if (Ui.set(t, a), "react" in i) return Ki(i, t, n, a, r);
let o;
try {
o = {
@@ -3634,27 +3638,27 @@ async function Hi(e, t, n, r = {}) {
if (a.controller.signal.aborted) return;
o = {
data: null,
- error: U(e)
+ error: H(e)
};
}
- if (!Ui(t, a, r)) return;
+ if (!Gi(t, a, r)) return;
let s = {
...n,
...o
};
- je(le(i.component, s), t);
+ Me(le(i.component, s), t);
}
-function Ui(e, t, n) {
- return Vi.get(e) === t ? n.isCurrent && !n.isCurrent() ? (Vi.delete(e), !1) : (e.textContent = "", t.painted = !0, !0) : !1;
+function Gi(e, t, n) {
+ return Ui.get(e) === t ? n.isCurrent && !n.isCurrent() ? (Ui.delete(e), !1) : (e.textContent = "", t.painted = !0, !0) : !1;
}
-async function Wi(e, t, n, r, i) {
+async function Ki(e, t, n, r, i) {
let a = (await import("/dist/peach-react.js")).pages[e.react];
try {
await a.prefetch(n, r.controller.signal);
} catch {
if (r.controller.signal.aborted) return;
}
- if (!Ui(t, r, i)) return;
+ if (!Gi(t, r, i)) return;
let o = t.ownerDocument.createElement("div");
o.className = "peach-react", t.append(o);
let s = a.mount(o, n);
@@ -3662,10 +3666,10 @@ async function Wi(e, t, n, r, i) {
s.unmount(), o.remove();
};
}
-var Gi = (e) => !!e && Vi.has(e);
-function Ki(e) {
- let t = Vi.get(e);
- t && (t.controller.abort(), Vi.delete(e), t.dispose ? t.dispose() : t.painted && je(null, e));
+var qi = (e) => !!e && Ui.has(e);
+function Ji(e) {
+ let t = Ui.get(e);
+ t && (t.controller.abort(), Ui.delete(e), t.dispose ? t.dispose() : t.painted && Me(null, e));
}
//#endregion
-export { At as TASTE_GUIDE_KEY, On as activityChartsHtml, xi as boardPageSkeleton, Pe as boundedPreference, Ti as catalogEmptyHtml, wi as catalogSuggestions, ti as clampPage, Ot as cleanupSkeletonHtml, Et as cloudLocations, Dt as cloudPreferenceLocations, Gr as createReviewSelection, Sn as creatorSankeyHtml, bi as detailSkeletonHtml, ze as distributionChart, Ci as emptyCatalogLayout, li as entitySkeletonHtml, ht as followJobProgress, Jr as groupReviewRows, zr as identityEvidenceHtml, It as initBoardControls, Gi as islandMounted, Bi as islandNames, Ii as javImageKind, pt as jobActivityHtml, Re as jobProgressHtml, ri as matchesFaceSource, si as mountAvatarPicker, Pt as mountBoardStatePreview, Hi as mountIsland, Ie as mountNumberSetting, ii as nativeImageFit, Fi as normalizeJavImage, Ni as normalizeJavLayout, Pi as normalizeJavPreferences, ei as pageCount, ni as paginationHtml, Li as panelFrame, Me as preferredDirection, Ve as radarChart, Tn as radialCardHtml, Be as rankedChart, Ir as refreshStore, Mi as resourceScanHtml, Rr as reviewImageHtml, Ur as selectGroup, Vr as selectRange, Hr as selectionSummary, Ei as sidebarHasCatalogContent, jn as sidebarSectionHtml, Oi as sidebarTagCounts, Le as statCardBody, Fr as storeNames, Ft as syncBoardRange, Ri as syncJavImages, Fe as syncNumberSetting, Wr as syncSelectionToolbar, Di as syncSidebarSurface, kt as tasteHistoryGuideHtml, Pn as transitionTheme, ci as unmountAvatarPicker, Ki as unmountIsland, Kr as updateReviewSticky, mt as watchJob, kn as wireActivityCharts, Cn as wireCreatorSankey, Ht as wireExpandableRanks, Vt as wireGrowingCharts, En as wireRadialCards, Br as wireReviewPictures, Qr as wireReviewSelection, Mn as wireSidebarGroups, jt as wireTasteHistoryGuide };
+export { Nt as TASTE_GUIDE_KEY, jn as activityChartsHtml, Ci as boardPageSkeleton, Fe as boundedPreference, Di as catalogEmptyHtml, Ei as catalogSuggestions, ri as clampPage, jt as cleanupSkeletonHtml, kt as cloudLocations, At as cloudPreferenceLocations, qr as createReviewSelection, Tn as creatorSankeyHtml, Si as detailSkeletonHtml, Be as distributionChart, Ti as emptyCatalogLayout, di as entitySkeletonHtml, gt as followJobProgress, Xr as groupReviewRows, Vr as identityEvidenceHtml, zt as initBoardControls, qi as islandMounted, Hi as islandNames, Ri as javImageKind, mt as jobActivityHtml, ze as jobProgressHtml, ai as matchesFaceSource, li as mountAvatarPicker, Lt as mountBoardStatePreview, Wi as mountIsland, Le as mountNumberSetting, oi as nativeImageFit, Li as normalizeJavImage, Fi as normalizeJavLayout, Ii as normalizeJavPreferences, ni as pageCount, ii as paginationHtml, zi as panelFrame, Ne as preferredDirection, He as radarChart, On as radialCardHtml, Ve as rankedChart, Rr as refreshStore, Pi as resourceScanHtml, Br as reviewImageHtml, Gr as selectGroup, Ur as selectRange, Wr as selectionSummary, Oi as sidebarHasCatalogContent, Pn as sidebarSectionHtml, Ai as sidebarTagCounts, Re as statCardBody, Lr as storeNames, Rt as syncBoardRange, Bi as syncJavImages, Ie as syncNumberSetting, Kr as syncSelectionToolbar, ki as syncSidebarSurface, Mt as tasteHistoryGuideHtml, Ln as transitionTheme, ui as unmountAvatarPicker, Ji as unmountIsland, Jr as updateReviewSticky, ht as watchJob, Mn as wireActivityCharts, En as wireCreatorSankey, Gt as wireExpandableRanks, Wt as wireGrowingCharts, kn as wireRadialCards, Hr as wireReviewPictures, ei as wireReviewSelection, Fn as wireSidebarGroups, Pt as wireTasteHistoryGuide };