@gluztm/dsh-guard 0.0.0-stage → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js ADDED
@@ -0,0 +1,1704 @@
1
+ /**
2
+ * Client half of @gluztm/dsh-guard — Cross-platform read-only health, masked key readiness,
3
+ * snapshot timeline, and Windows DSHGuard Desktop Console bridge for DeepSeek Harness.
4
+ *
5
+ * Strictly zero-secret-leak: never reads, slices, stores, or transmits API keys or tokens.
6
+ * Uses only React.createElement, useState, useEffect, and Component so lightweight ModuleLoader hosts stay compatible.
7
+ */
8
+ window.__ModuleLoader__.load({
9
+ id: '@gluztm/dsh-guard',
10
+ factory(require) {
11
+ const React = require('react')
12
+ const h = React.createElement
13
+
14
+ const SIDE_ID = 'dsh-guard'
15
+ const API_BASE = 'api/dsh-guard'
16
+ const STYLE_ID = 'dsh-guard-panel-styles-v241'
17
+ const VERSION = '2.4.1'
18
+ const REPO_FALLBACK = 'https://github.com/gluztm/DSHGuard'
19
+ const RELEASE_FALLBACK = 'https://github.com/gluztm/DSHGuard/releases/latest'
20
+ const INSTALLER_FALLBACK = 'https://github.com/gluztm/DSHGuard/releases/download/2.4.1/DSHGuard-Setup-2.4.1.exe'
21
+
22
+ const COPY = {
23
+ zh: {
24
+ brand: 'DSH 守护壳',
25
+ subtitle: '双轨体检 · 脱敏对账 · 快照回望',
26
+ versionPill: `v${VERSION}`,
27
+ refresh: '重新体检',
28
+ refreshing: '体检中',
29
+ langSwitch: 'EN',
30
+ healthy: '双轨配置健康',
31
+ unhealthy: (n) => `发现 ${n} 项异常`,
32
+ loading: '正在读取双轨配置、凭据键与快照状态…',
33
+ retry: '重试',
34
+ checkedAt: (t) => `最近体检 ${t}`,
35
+ tabOverview: '总览',
36
+ tabCreds: '凭据',
37
+ tabSnapshots: '快照',
38
+ kpiProfilesLabel: '双轨插件',
39
+ kpiProfilesSub: 'Web / 桌面启用',
40
+ kpiCredsLabel: '凭据就绪',
41
+ kpiCredsSub: '非空环境键',
42
+ kpiSnapsLabel: '变更快照',
43
+ kpiSnapsSub: '桌面守护存档',
44
+ supervisorTitleWinMissing: '安装 DSHGuard 桌面完整版',
45
+ supervisorBadgeWin: 'Windows · 免管理员',
46
+ supervisorDescWinMissing: '伴生插件仅负责 DSH 内只读体检;安装 Windows 桌面控制台可解锁以下日常高频能力:',
47
+ feat1Title: '四协议模型配置与测速',
48
+ feat1Sub: '自动补全 /v1 与 /v1beta',
49
+ feat2Title: 'CC Switch 多源导密钥',
50
+ feat2Sub: '文件拖入与跨端只读导入',
51
+ feat3Title: '插件批量查新防串轨',
52
+ feat3Sub: '万款市场插件安全升级',
53
+ feat4Title: '进程外救援与快照回滚',
54
+ feat4Sub: '启动崩溃时桌面一键还原',
55
+ btnDownloadExe: '直接下载 Windows 安装包 (.exe)',
56
+ btnViewRepo: '主页与动图预览',
57
+ btnRedetect: '已安装?重新检测',
58
+ supervisorTitleWinReady: 'DSHGuard 桌面控制台',
59
+ supervisorBadgeReady: '桌面控制台已就绪',
60
+ supervisorDescWinReady: '已对接本机桌面守护壳,支持四协议模型配置与测速、CC Switch 导入及快照回滚。',
61
+ btnOpenGuard: '打开 DSHGuard 桌面控制台',
62
+ btnOpeningGuard: '正在唤起…',
63
+ supervisorTitleOther: '跨平台只读体检模式',
64
+ supervisorDescOther: (plat) => `当前运行环境为 ${plat},伴生插件双轨体检、凭据脱敏对账与 /guard 命令已全部就绪;Windows 桌面完整版独立提供图形化模型配置、CC Switch 导入与进程外崩溃救援。`,
65
+ btnViewReleases: '查看 Windows 版 Releases',
66
+ profilesTitle: 'Web / 桌面双轨对账',
67
+ webTrack: 'Web 引擎',
68
+ desktopTrack: '桌面版',
69
+ missingDir: '未检测到该端配置目录',
70
+ bundlesLabel: '插件',
71
+ depsLabel: '依赖',
72
+ patchOk: (n) => (n > 0 ? `Patch 正常 · 禁 ${n} 项` : 'Patch 正常'),
73
+ patchMissing: '未建 cordis.patch.yml',
74
+ patchErr: (e) => `Patch 异常:${e}`,
75
+ pkgErr: 'package.json 解析异常',
76
+ missingInDeps: '清单缺依赖',
77
+ unregisteredDeps: '未登记插件',
78
+ issuesTitle: '诊断建议',
79
+ issueActionOpen: '在桌面控制台一键排查修复',
80
+ issueActionDownload: '下载桌面控制台辅助排查 (.exe)',
81
+ credsTitle: '凭据脱敏就绪度',
82
+ credsPrivacyHint: '严格零秘密原则:仅核对环境键是否非空,绝不读取、截断或传输真实密钥。',
83
+ credReadyBadge: (ready, total) => `已就绪 ${ready} / ${total}`,
84
+ credMissingFile: '未创建 .credentials.yaml',
85
+ credProgressPatch: (ready, total) => `cordis.patch.yml 引用键就绪 ${ready} / ${total}`,
86
+ credProgressFile: (nonEmpty, total) => `.credentials.yaml 非空键 ${nonEmpty} / ${total}`,
87
+ credStatusReady: '已就绪',
88
+ credStatusMissing: '未配置',
89
+ credNoRefs: '当前双端 cordis.patch.yml 暂未引用任何 apiKeyEnv 环境变量。',
90
+ credUpsellTitle: '需要图形化管理模型与密钥?',
91
+ credUpsellDesc: '在 DSHGuard 桌面版「凭据中心」可直接点击卡片编辑 OpenAI / Anthropic / Gemini 接口、测试单模型连通性,或从 CC Switch 与本地 Agent 一键导入。',
92
+ credUpsellOpen: '打开桌面端「凭据中心」',
93
+ credUpsellDownload: '下载桌面完整版开启「凭据中心」(.exe)',
94
+ snapshotsTitle: '变更前快照回望',
95
+ snapshotsTotal: (t) => `共 ${t} 份`,
96
+ snapshotsEmptyTitle: '暂无变更前快照存档',
97
+ snapshotsEmptyDesc: '使用 DSHGuard 桌面控制台执行插件安装、升级或切换配置前,系统都会自动存档以供随时回滚。',
98
+ snapItems: (n) => `${n} 项文件`,
99
+ snapNoReason: '操作前自动快照',
100
+ snapActionOpen: '在桌面端管理 / 回滚快照',
101
+ snapActionDownload: '下载 Windows 桌面版开启自动快照 (.exe)',
102
+ footerNote: `DSHGuard v${VERSION} · 严格零秘密只读伴生模式`,
103
+ footerHome: 'GitHub 主页',
104
+ errorRecover: '守护壳面板已触发渲染保护恢复',
105
+ guideDesc: '双端配置体检 · 凭据键就绪状态 · 快照历史 · 联动 DSHGuard 桌面端',
106
+ },
107
+ en: {
108
+ brand: 'DSHGuard',
109
+ subtitle: 'Dual-Track Health · Masked Keys · Snapshots',
110
+ versionPill: `v${VERSION}`,
111
+ refresh: 'Refresh',
112
+ refreshing: 'Checking',
113
+ langSwitch: '中',
114
+ healthy: 'Dual-Track Healthy',
115
+ unhealthy: (n) => `${n} Issue${n === 1 ? '' : 's'} Found`,
116
+ loading: 'Inspecting DSH profiles, credential readiness, and snapshots…',
117
+ retry: 'Retry',
118
+ checkedAt: (t) => `Checked ${t}`,
119
+ tabOverview: 'Overview',
120
+ tabCreds: 'Credentials',
121
+ tabSnapshots: 'Snapshots',
122
+ kpiProfilesLabel: 'Bundles',
123
+ kpiProfilesSub: 'Web / Desktop',
124
+ kpiCredsLabel: 'Key Slots',
125
+ kpiCredsSub: 'Non-empty env',
126
+ kpiSnapsLabel: 'Snapshots',
127
+ kpiSnapsSub: 'Guard backups',
128
+ supervisorTitleWinMissing: 'Install DSHGuard Desktop Console',
129
+ supervisorBadgeWin: 'Windows · Non-Admin',
130
+ supervisorDescWinMissing: 'This companion plugin stays strictly read-only. Install the Windows desktop app to unlock:',
131
+ feat1Title: '4-Protocol Model Setup & Ping',
132
+ feat1Sub: 'Auto /v1 & /v1beta endpoints',
133
+ feat2Title: 'CC Switch & Multi-Source Import',
134
+ feat2Sub: 'Drop configs or read local agents',
135
+ feat3Title: 'Safe Batch Plugin Updates',
136
+ feat3Sub: '10,700+ catalog, zero cross-track',
137
+ feat4Title: 'Out-of-Band Recovery & Rollback',
138
+ feat4Sub: 'Restore broken startups externally',
139
+ btnDownloadExe: 'Direct Download Windows Installer (.exe)',
140
+ btnViewRepo: 'Homepage & Visual Tour',
141
+ btnRedetect: 'Installed? Re-detect',
142
+ supervisorTitleWinReady: 'DSHGuard Desktop Console',
143
+ supervisorBadgeReady: 'Desktop Console Ready',
144
+ supervisorDescWinReady: 'Connected to your local DSHGuard executable for visual model configuration, CC Switch import, and snapshot rollback.',
145
+ btnOpenGuard: 'Open DSHGuard Desktop Console',
146
+ btnOpeningGuard: 'Launching…',
147
+ supervisorTitleOther: 'Cross-Platform Read-Only Mode',
148
+ supervisorDescOther: (plat) => `Running on ${plat} with full dual-track auditing, masked key checks, and /guard commands. Full out-of-band GUI tools run on Windows.`,
149
+ btnViewReleases: 'View Windows Releases',
150
+ profilesTitle: 'Web / Desktop Profile Alignment',
151
+ webTrack: 'Web Engine',
152
+ desktopTrack: 'Desktop',
153
+ missingDir: 'Profile directory not found',
154
+ bundlesLabel: 'Enabled',
155
+ depsLabel: 'Deps',
156
+ patchOk: (n) => (n > 0 ? `Patch OK · ${n} disabled` : 'Patch OK'),
157
+ patchMissing: 'No cordis.patch.yml',
158
+ patchErr: (e) => `Patch error: ${e}`,
159
+ pkgErr: 'Invalid package.json',
160
+ missingInDeps: 'Missing in deps',
161
+ unregisteredDeps: 'Unregistered deps',
162
+ issuesTitle: 'Diagnostics',
163
+ issueActionOpen: 'Troubleshoot in DSHGuard Desktop',
164
+ issueActionDownload: 'Download Windows Supervisor (.exe)',
165
+ credsTitle: 'Masked Credential Readiness',
166
+ credsPrivacyHint: 'Zero-secret guarantee: checks only whether key names are non-empty, never reading or transmitting secret values.',
167
+ credReadyBadge: (ready, total) => `${ready} / ${total} Ready`,
168
+ credMissingFile: '.credentials.yaml not found',
169
+ credProgressPatch: (ready, total) => `Referenced apiKeyEnv keys ready: ${ready} / ${total}`,
170
+ credProgressFile: (nonEmpty, total) => `Non-empty entries in .credentials.yaml: ${nonEmpty} / ${total}`,
171
+ credStatusReady: 'Ready',
172
+ credStatusMissing: 'Missing',
173
+ credNoRefs: 'No apiKeyEnv references detected in either cordis.patch.yml.',
174
+ credUpsellTitle: 'Configure models & keys visually',
175
+ credUpsellDesc: 'Use the desktop Credential Hub to edit OpenAI / Anthropic / Gemini endpoints, test model connectivity, or import non-subscription keys from CC Switch.',
176
+ credUpsellOpen: 'Open Credential Hub in Desktop',
177
+ credUpsellDownload: 'Download Desktop Console for Credential Hub (.exe)',
178
+ snapshotsTitle: 'Pre-Change Snapshot Timeline',
179
+ snapshotsTotal: (t) => `${t} total`,
180
+ snapshotsEmptyTitle: 'No pre-change snapshots yet',
181
+ snapshotsEmptyDesc: 'DSHGuard automatically saves config and plugin snapshots before any risky change on Windows so you can roll back cleanly.',
182
+ snapItems: (n) => `${n} files`,
183
+ snapNoReason: 'Automatic checkpoint',
184
+ snapActionOpen: 'Manage / Roll back in Desktop',
185
+ snapActionDownload: 'Download Windows App for Auto-Snapshots (.exe)',
186
+ footerNote: `DSHGuard v${VERSION} · Strictly Read-Only Companion`,
187
+ footerHome: 'GitHub',
188
+ errorRecover: 'Panel recovered by ErrorBoundary',
189
+ guideDesc: 'Dual-track health · Masked key readiness · Snapshots · DSHGuard Desktop bridge',
190
+ },
191
+ }
192
+
193
+ const CSS = `
194
+ @keyframes dshg-spin {
195
+ from { transform: rotate(0deg); }
196
+ to { transform: rotate(360deg); }
197
+ }
198
+ @keyframes dshg-pulse {
199
+ 0%, 100% { opacity: 1; }
200
+ 50% { opacity: 0.45; }
201
+ }
202
+ .dshg-root {
203
+ --dshg-card: var(--dsw-alias-card-fill, var(--dsw-alias-bg-layer-1, rgba(128, 128, 140, 0.08)));
204
+ --dshg-card-hover: var(--dsw-alias-card-fill-hover, var(--dsw-alias-bg-layer-2, rgba(128, 128, 140, 0.14)));
205
+ --dshg-fill: var(--dsw-alias-fill-l1, rgba(128, 128, 140, 0.11));
206
+ --dshg-fill-subtle: var(--dsw-alias-bg-layer-2, rgba(128, 128, 140, 0.06));
207
+ --dshg-border: var(--dsw-alias-border-l1, rgba(128, 128, 140, 0.18));
208
+ --dshg-border-strong: var(--dsw-alias-border-l2, rgba(128, 128, 140, 0.30));
209
+ --dshg-text: var(--dsw-alias-label-primary, inherit);
210
+ --dshg-text-2: var(--dsw-alias-label-secondary, rgba(128, 128, 140, 0.88));
211
+ --dshg-text-3: var(--dsw-alias-label-tertiary, rgba(128, 128, 140, 0.64));
212
+ --dshg-accent: var(--dsw-alias-brand-primary, #2563eb);
213
+ --dshg-accent-soft: rgba(37, 99, 235, 0.10);
214
+ --dshg-accent-border: rgba(59, 130, 246, 0.34);
215
+ --dshg-ok: #16a34a;
216
+ --dshg-ok-soft: rgba(34, 197, 94, 0.12);
217
+ --dshg-ok-border: rgba(34, 197, 94, 0.32);
218
+ --dshg-warn: #d97706;
219
+ --dshg-warn-soft: rgba(245, 158, 11, 0.12);
220
+ --dshg-warn-border: rgba(245, 158, 11, 0.34);
221
+ background: transparent;
222
+ color: var(--dshg-text);
223
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
224
+ display: flex;
225
+ flex-direction: column;
226
+ gap: 10px;
227
+ padding: 12px;
228
+ height: 100%;
229
+ box-sizing: border-box;
230
+ overflow-y: auto;
231
+ font-size: 12px;
232
+ line-height: 1.45;
233
+ }
234
+ .dshg-root[data-variant="main"] {
235
+ max-width: 780px;
236
+ margin: 0 auto;
237
+ padding: 20px 18px;
238
+ }
239
+ .dshg-card {
240
+ border: 1px solid var(--dshg-border);
241
+ background: var(--dshg-card);
242
+ border-radius: 12px;
243
+ padding: 11px 12px;
244
+ display: flex;
245
+ flex-direction: column;
246
+ gap: 9px;
247
+ }
248
+ .dshg-card-spotlight {
249
+ border: 1px solid var(--dshg-accent-border);
250
+ background: var(--dshg-accent-soft);
251
+ }
252
+ .dshg-header {
253
+ display: flex;
254
+ align-items: center;
255
+ justify-content: space-between;
256
+ gap: 8px;
257
+ }
258
+ .dshg-brand {
259
+ display: flex;
260
+ align-items: center;
261
+ gap: 9px;
262
+ min-width: 0;
263
+ }
264
+ .dshg-logo-wrap {
265
+ width: 34px;
266
+ height: 34px;
267
+ border-radius: 9px;
268
+ display: inline-flex;
269
+ align-items: center;
270
+ justify-content: center;
271
+ background: var(--dshg-accent-soft);
272
+ border: 1px solid var(--dshg-accent-border);
273
+ color: var(--dshg-accent);
274
+ flex-shrink: 0;
275
+ }
276
+ .dshg-title-row {
277
+ display: flex;
278
+ align-items: center;
279
+ gap: 6px;
280
+ flex-wrap: wrap;
281
+ }
282
+ .dshg-title {
283
+ font-size: 13.5px;
284
+ font-weight: 600;
285
+ line-height: 1.2;
286
+ letter-spacing: -0.01em;
287
+ }
288
+ .dshg-ver {
289
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
290
+ font-size: 11px;
291
+ font-weight: 500;
292
+ padding: 1px 6px;
293
+ border-radius: 99px;
294
+ border: 1px solid var(--dshg-border);
295
+ background: var(--dshg-fill);
296
+ color: var(--dshg-text-2);
297
+ }
298
+ .dshg-sub {
299
+ font-size: 11px;
300
+ color: var(--dshg-text-2);
301
+ margin-top: 2px;
302
+ }
303
+ .dshg-actions {
304
+ display: flex;
305
+ align-items: center;
306
+ gap: 5px;
307
+ flex-shrink: 0;
308
+ }
309
+ .dshg-btn {
310
+ display: inline-flex;
311
+ align-items: center;
312
+ justify-content: center;
313
+ gap: 6px;
314
+ height: 28px;
315
+ padding: 0 10px;
316
+ border-radius: 8px;
317
+ border: 1px solid var(--dshg-border);
318
+ background: var(--dshg-card);
319
+ color: var(--dshg-text);
320
+ font-size: 11.5px;
321
+ font-weight: 500;
322
+ cursor: pointer;
323
+ transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
324
+ text-decoration: none;
325
+ box-sizing: border-box;
326
+ white-space: nowrap;
327
+ }
328
+ .dshg-btn:hover:not(:disabled) {
329
+ background: var(--dshg-card-hover);
330
+ border-color: var(--dshg-border-strong);
331
+ }
332
+ .dshg-btn:disabled {
333
+ opacity: 0.58;
334
+ cursor: default;
335
+ }
336
+ .dshg-btn-icon {
337
+ width: 28px;
338
+ padding: 0;
339
+ }
340
+ .dshg-btn-primary {
341
+ background: var(--dshg-accent);
342
+ border-color: transparent;
343
+ color: #ffffff;
344
+ height: 34px;
345
+ padding: 0 14px;
346
+ font-size: 12.5px;
347
+ font-weight: 600;
348
+ width: 100%;
349
+ border-radius: 9px;
350
+ }
351
+ .dshg-btn-primary:hover:not(:disabled) {
352
+ background: var(--dshg-accent);
353
+ border-color: transparent;
354
+ opacity: 0.92;
355
+ }
356
+ .dshg-btn-row {
357
+ display: grid;
358
+ grid-template-columns: repeat(2, minmax(0, 1fr));
359
+ gap: 6px;
360
+ }
361
+ .dshg-btn-row .dshg-btn {
362
+ width: 100%;
363
+ padding: 0 8px;
364
+ font-size: 11px;
365
+ }
366
+ .dshg-spin {
367
+ animation: dshg-spin 0.9s linear infinite;
368
+ }
369
+ .dshg-badge {
370
+ display: inline-flex;
371
+ align-items: center;
372
+ gap: 5px;
373
+ padding: 2px 8px;
374
+ border-radius: 99px;
375
+ font-size: 11px;
376
+ font-weight: 500;
377
+ border: 1px solid transparent;
378
+ width: fit-content;
379
+ }
380
+ .dshg-dot {
381
+ width: 6px;
382
+ height: 6px;
383
+ border-radius: 50%;
384
+ background: currentColor;
385
+ animation: dshg-pulse 2.2s ease-in-out infinite;
386
+ }
387
+ .dshg-badge[data-tone="ok"] {
388
+ background: var(--dshg-ok-soft);
389
+ border-color: var(--dshg-ok-border);
390
+ color: #10b981;
391
+ }
392
+ .dshg-badge[data-tone="warn"] {
393
+ background: var(--dshg-warn-soft);
394
+ border-color: var(--dshg-warn-border);
395
+ color: #d97706;
396
+ }
397
+ .dshg-badge[data-tone="blue"] {
398
+ background: var(--dshg-accent-soft);
399
+ border-color: var(--dshg-accent-border);
400
+ color: #3b82f6;
401
+ }
402
+ .dshg-badge[data-tone="muted"] {
403
+ background: var(--dshg-fill);
404
+ border-color: var(--dshg-border);
405
+ color: var(--dshg-text-2);
406
+ }
407
+ .dshg-kpi-strip {
408
+ display: grid;
409
+ grid-template-columns: repeat(3, minmax(0, 1fr));
410
+ gap: 6px;
411
+ }
412
+ .dshg-kpi {
413
+ border: 1px solid var(--dshg-border);
414
+ background: var(--dshg-card);
415
+ border-radius: 10px;
416
+ padding: 8px 9px;
417
+ display: flex;
418
+ flex-direction: column;
419
+ gap: 2px;
420
+ text-align: left;
421
+ cursor: pointer;
422
+ color: var(--dshg-text);
423
+ transition: border-color 0.15s ease, background 0.15s ease;
424
+ }
425
+ .dshg-kpi:hover {
426
+ background: var(--dshg-card-hover);
427
+ border-color: var(--dshg-border-strong);
428
+ }
429
+ .dshg-kpi[data-active="true"] {
430
+ border-color: var(--dshg-accent-border);
431
+ background: var(--dshg-accent-soft);
432
+ }
433
+ .dshg-kpi-label {
434
+ font-size: 11px;
435
+ color: var(--dshg-text-2);
436
+ }
437
+ .dshg-kpi-val {
438
+ font-size: 14px;
439
+ font-weight: 600;
440
+ font-variant-numeric: tabular-nums;
441
+ line-height: 1.25;
442
+ }
443
+ .dshg-kpi-sub {
444
+ font-size: 11px;
445
+ color: var(--dshg-text-3);
446
+ white-space: nowrap;
447
+ overflow: hidden;
448
+ text-overflow: ellipsis;
449
+ }
450
+ .dshg-seg {
451
+ display: grid;
452
+ grid-template-columns: repeat(3, minmax(0, 1fr));
453
+ gap: 4px;
454
+ padding: 3px;
455
+ border-radius: 10px;
456
+ border: 1px solid var(--dshg-border);
457
+ background: var(--dshg-fill-subtle);
458
+ }
459
+ .dshg-seg-btn {
460
+ height: 27px;
461
+ border: 1px solid transparent;
462
+ border-radius: 7px;
463
+ background: transparent;
464
+ color: var(--dshg-text-2);
465
+ font-size: 11.5px;
466
+ font-weight: 500;
467
+ cursor: pointer;
468
+ display: inline-flex;
469
+ align-items: center;
470
+ justify-content: center;
471
+ gap: 5px;
472
+ transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
473
+ }
474
+ .dshg-seg-btn:hover {
475
+ color: var(--dshg-text);
476
+ }
477
+ .dshg-seg-btn[data-active="true"] {
478
+ background: var(--dshg-card);
479
+ border-color: var(--dshg-border);
480
+ color: var(--dshg-text);
481
+ font-weight: 600;
482
+ }
483
+ .dshg-seg-dot {
484
+ width: 5px;
485
+ height: 5px;
486
+ border-radius: 50%;
487
+ background: #f59e0b;
488
+ }
489
+ .dshg-sec-head {
490
+ display: flex;
491
+ align-items: center;
492
+ justify-content: space-between;
493
+ gap: 8px;
494
+ font-size: 12px;
495
+ font-weight: 600;
496
+ color: var(--dshg-text);
497
+ }
498
+ .dshg-sec-sub {
499
+ font-size: 11px;
500
+ color: var(--dshg-text-2);
501
+ line-height: 1.45;
502
+ }
503
+ .dshg-feat-grid {
504
+ display: grid;
505
+ grid-template-columns: repeat(2, minmax(0, 1fr));
506
+ gap: 6px;
507
+ }
508
+ .dshg-feat-item {
509
+ border: 1px solid var(--dshg-border);
510
+ background: var(--dshg-card);
511
+ border-radius: 9px;
512
+ padding: 8px 9px;
513
+ display: flex;
514
+ align-items: flex-start;
515
+ gap: 7px;
516
+ }
517
+ .dshg-feat-ico {
518
+ color: var(--dshg-accent);
519
+ flex-shrink: 0;
520
+ margin-top: 1px;
521
+ }
522
+ .dshg-feat-t {
523
+ font-size: 11.5px;
524
+ font-weight: 600;
525
+ line-height: 1.25;
526
+ }
527
+ .dshg-feat-s {
528
+ font-size: 11px;
529
+ color: var(--dshg-text-2);
530
+ margin-top: 2px;
531
+ line-height: 1.3;
532
+ }
533
+ .dshg-profile-grid {
534
+ display: grid;
535
+ grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
536
+ gap: 7px;
537
+ }
538
+ .dshg-subcard {
539
+ border: 1px solid var(--dshg-border);
540
+ border-radius: 9px;
541
+ padding: 9px 10px;
542
+ display: flex;
543
+ flex-direction: column;
544
+ gap: 6px;
545
+ background: var(--dshg-fill-subtle);
546
+ }
547
+ .dshg-row {
548
+ display: flex;
549
+ align-items: center;
550
+ justify-content: space-between;
551
+ gap: 6px;
552
+ font-size: 11.5px;
553
+ }
554
+ .dshg-pills {
555
+ display: flex;
556
+ flex-wrap: wrap;
557
+ gap: 5px;
558
+ }
559
+ .dshg-pill {
560
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
561
+ font-size: 11px;
562
+ padding: 2px 7px;
563
+ border-radius: 6px;
564
+ border: 1px solid var(--dshg-border);
565
+ background: var(--dshg-fill);
566
+ color: var(--dshg-text);
567
+ word-break: break-all;
568
+ }
569
+ .dshg-pill[data-tone="warn"] {
570
+ background: var(--dshg-warn-soft);
571
+ border-color: var(--dshg-warn-border);
572
+ color: #f59e0b;
573
+ }
574
+ .dshg-progress-wrap {
575
+ display: flex;
576
+ flex-direction: column;
577
+ gap: 5px;
578
+ }
579
+ .dshg-progress-track {
580
+ height: 5px;
581
+ border-radius: 99px;
582
+ background: var(--dshg-fill);
583
+ overflow: hidden;
584
+ }
585
+ .dshg-progress-fill {
586
+ height: 100%;
587
+ border-radius: 99px;
588
+ background: #22c55e;
589
+ transition: width 0.25s ease;
590
+ }
591
+ .dshg-cred-list {
592
+ display: flex;
593
+ flex-direction: column;
594
+ gap: 6px;
595
+ }
596
+ .dshg-cred-item {
597
+ border: 1px solid var(--dshg-border);
598
+ background: var(--dshg-fill-subtle);
599
+ border-radius: 9px;
600
+ padding: 7px 10px;
601
+ display: flex;
602
+ align-items: center;
603
+ justify-content: space-between;
604
+ gap: 8px;
605
+ }
606
+ .dshg-cred-key {
607
+ display: inline-flex;
608
+ align-items: center;
609
+ gap: 6px;
610
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
611
+ font-size: 11.5px;
612
+ font-weight: 500;
613
+ min-width: 0;
614
+ word-break: break-all;
615
+ }
616
+ .dshg-timeline {
617
+ display: flex;
618
+ flex-direction: column;
619
+ gap: 7px;
620
+ }
621
+ .dshg-snap-item {
622
+ border: 1px solid var(--dshg-border);
623
+ border-radius: 9px;
624
+ padding: 8px 10px;
625
+ display: flex;
626
+ flex-direction: column;
627
+ gap: 4px;
628
+ background: var(--dshg-fill-subtle);
629
+ }
630
+ .dshg-snap-head {
631
+ display: flex;
632
+ align-items: center;
633
+ justify-content: space-between;
634
+ gap: 6px;
635
+ }
636
+ .dshg-snap-title {
637
+ display: inline-flex;
638
+ align-items: center;
639
+ gap: 6px;
640
+ font-size: 12px;
641
+ font-weight: 500;
642
+ min-width: 0;
643
+ }
644
+ .dshg-track-dot {
645
+ width: 7px;
646
+ height: 7px;
647
+ border-radius: 50%;
648
+ flex-shrink: 0;
649
+ }
650
+ .dshg-mono {
651
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
652
+ font-size: 11px;
653
+ word-break: break-all;
654
+ color: var(--dshg-text-2);
655
+ }
656
+ .dshg-path-box {
657
+ border: 1px solid var(--dshg-border);
658
+ border-radius: 8px;
659
+ background: var(--dshg-fill-subtle);
660
+ padding: 6px 9px;
661
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
662
+ font-size: 11px;
663
+ color: var(--dshg-text-2);
664
+ word-break: break-all;
665
+ }
666
+ .dshg-empty {
667
+ border: 1px dashed var(--dshg-border-strong);
668
+ border-radius: 10px;
669
+ padding: 16px 12px;
670
+ display: flex;
671
+ flex-direction: column;
672
+ align-items: center;
673
+ text-align: center;
674
+ gap: 7px;
675
+ color: var(--dshg-text-2);
676
+ }
677
+ .dshg-notice {
678
+ padding: 8px 10px;
679
+ border-radius: 9px;
680
+ font-size: 11.5px;
681
+ border: 1px solid var(--dshg-accent-border);
682
+ background: var(--dshg-accent-soft);
683
+ color: var(--dshg-text);
684
+ }
685
+ .dshg-error {
686
+ padding: 8px 10px;
687
+ border-radius: 9px;
688
+ font-size: 11.5px;
689
+ border: 1px solid rgba(239, 68, 68, 0.4);
690
+ background: rgba(239, 68, 68, 0.11);
691
+ color: #f87171;
692
+ }
693
+ .dshg-footer {
694
+ display: flex;
695
+ align-items: center;
696
+ justify-content: space-between;
697
+ gap: 8px;
698
+ padding: 2px 4px 4px;
699
+ font-size: 11px;
700
+ color: var(--dshg-text-3);
701
+ }
702
+ .dshg-footer a {
703
+ color: var(--dshg-text-2);
704
+ text-decoration: none;
705
+ }
706
+ .dshg-footer a:hover {
707
+ color: var(--dshg-text);
708
+ text-decoration: underline;
709
+ }
710
+ `
711
+
712
+ function ensureStyles() {
713
+ if (typeof document === 'undefined' || !document.head) return
714
+ if (document.getElementById(STYLE_ID)) return
715
+ const el = document.createElement('style')
716
+ el.id = STYLE_ID
717
+ el.textContent = CSS
718
+ document.head.appendChild(el)
719
+ }
720
+
721
+ const store = {
722
+ lang: 'zh',
723
+ tab: 'overview',
724
+ loading: false,
725
+ launching: false,
726
+ error: '',
727
+ notice: '',
728
+ data: null,
729
+ checkedAt: 0,
730
+ }
731
+
732
+ const listeners = new Set()
733
+
734
+ function notify() {
735
+ for (const listener of listeners) {
736
+ try {
737
+ listener()
738
+ } catch {
739
+ // Ignore subscriber errors safely.
740
+ }
741
+ }
742
+ }
743
+
744
+ function patch(next) {
745
+ Object.assign(store, next)
746
+ notify()
747
+ }
748
+
749
+ function useStore() {
750
+ const [, bump] = React.useState(0)
751
+ React.useEffect(() => {
752
+ const fn = () => bump((n) => n + 1)
753
+ listeners.add(fn)
754
+ return () => listeners.delete(fn)
755
+ }, [])
756
+ return store
757
+ }
758
+
759
+ async function fetchOverview() {
760
+ if (store.loading || typeof fetch !== 'function') return
761
+ patch({ loading: true, error: '' })
762
+ try {
763
+ const res = await fetch(`${API_BASE}/overview`, {
764
+ cache: 'no-store',
765
+ credentials: 'same-origin',
766
+ headers: { accept: 'application/json' },
767
+ })
768
+ const json = await res.json()
769
+ if (!res.ok || !json || json.ok === false) {
770
+ throw new Error((json && json.error) || `HTTP ${res.status}`)
771
+ }
772
+ patch({
773
+ data: json,
774
+ checkedAt: json.checkedAt || Date.now(),
775
+ error: '',
776
+ })
777
+ } catch (err) {
778
+ patch({ error: err && err.message ? String(err.message) : 'Failed to inspect DSHGuard status' })
779
+ } finally {
780
+ patch({ loading: false })
781
+ }
782
+ }
783
+
784
+ async function launchDesktopGuard() {
785
+ if (store.launching || typeof fetch !== 'function') return
786
+ patch({ launching: true, notice: '', error: '' })
787
+ try {
788
+ const res = await fetch(`${API_BASE}/open`, {
789
+ method: 'POST',
790
+ cache: 'no-store',
791
+ credentials: 'same-origin',
792
+ headers: { accept: 'application/json' },
793
+ })
794
+ const json = await res.json()
795
+ if (!res.ok || !json || json.ok === false) {
796
+ throw new Error((json && json.error) || `HTTP ${res.status}`)
797
+ }
798
+ patch({ notice: json.message || 'DSHGuard action completed' })
799
+ } catch (err) {
800
+ patch({ error: err && err.message ? String(err.message) : 'Failed to launch DSHGuard' })
801
+ } finally {
802
+ patch({ launching: false })
803
+ }
804
+ }
805
+
806
+ function formatShortTime(value) {
807
+ if (!value) return ''
808
+ const d = new Date(value)
809
+ if (Number.isNaN(d.getTime())) return String(value)
810
+ const p = (n) => String(n).padStart(2, '0')
811
+ return `${d.getMonth() + 1}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`
812
+ }
813
+
814
+ function formatClockOnly(value) {
815
+ if (!value) return ''
816
+ const d = new Date(value)
817
+ if (Number.isNaN(d.getTime())) return String(value)
818
+ const p = (n) => String(n).padStart(2, '0')
819
+ return `${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`
820
+ }
821
+
822
+ /** Crisp Whale-Shield glyph rendered in currentColor for tabs & rail icons. */
823
+ function GuardIcon(props) {
824
+ const size = props && typeof props.size === 'number' && props.size > 0 ? props.size : 17
825
+ const active = Boolean(props && props.active)
826
+ return h(
827
+ 'svg',
828
+ {
829
+ width: size,
830
+ height: size,
831
+ viewBox: '0 0 24 24',
832
+ fill: 'none',
833
+ stroke: 'currentColor',
834
+ strokeWidth: active ? 2.1 : 1.75,
835
+ strokeLinecap: 'round',
836
+ strokeLinejoin: 'round',
837
+ 'aria-hidden': true,
838
+ focusable: false,
839
+ style: { display: 'block', flexShrink: 0 },
840
+ },
841
+ h('path', { d: 'M12 2.8 4.8 5.8v5.7c0 4.6 3.1 8.3 7.2 9.7 4.1-1.4 7.2-5.1 7.2-9.7V5.8L12 2.8Z' }),
842
+ h('path', { d: 'M8.5 13c.8-2 2.5-3 4.3-2.6 1.5.3 2.5 1.3 3.2 2.2.8-.6 1.4-1.3 1.7-2.2' }),
843
+ h('circle', { cx: '11', cy: '12.6', r: '0.65', fill: 'currentColor' }),
844
+ )
845
+ }
846
+
847
+ /** Flat outline SVG icon set (zero emoji). */
848
+ function SvgIcon({ name, size = 14, className = '' }) {
849
+ const common = {
850
+ width: size,
851
+ height: size,
852
+ viewBox: '0 0 24 24',
853
+ fill: 'none',
854
+ stroke: 'currentColor',
855
+ strokeWidth: 1.85,
856
+ strokeLinecap: 'round',
857
+ strokeLinejoin: 'round',
858
+ 'aria-hidden': true,
859
+ focusable: false,
860
+ className: className || undefined,
861
+ style: { display: 'block', flexShrink: 0 },
862
+ }
863
+ switch (name) {
864
+ case 'refresh':
865
+ return h(
866
+ 'svg',
867
+ common,
868
+ h('path', { d: 'M20 11a8.1 8.1 0 0 0-15.5-2m-.5-4v4h4' }),
869
+ h('path', { d: 'M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4' }),
870
+ )
871
+ case 'download':
872
+ return h(
873
+ 'svg',
874
+ common,
875
+ h('path', { d: 'M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2' }),
876
+ h('path', { d: 'M7 11l5 5 5-5' }),
877
+ h('path', { d: 'M12 4v12' }),
878
+ )
879
+ case 'external':
880
+ return h(
881
+ 'svg',
882
+ common,
883
+ h('path', { d: 'M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6' }),
884
+ h('path', { d: 'M11 13l9-9' }),
885
+ h('path', { d: 'M15 4h5v5' }),
886
+ )
887
+ case 'window':
888
+ return h(
889
+ 'svg',
890
+ common,
891
+ h('rect', { x: 3, y: 4, width: 18, height: 16, rx: 3 }),
892
+ h('path', { d: 'M3 9h18' }),
893
+ h('path', { d: 'M10 14.5l2.5-2.5 2.5 2.5' }),
894
+ )
895
+ case 'bolt':
896
+ return h('svg', common, h('path', { d: 'M13 3L4 14h7l-1 7 9-11h-7l1-7z' }))
897
+ case 'key':
898
+ return h(
899
+ 'svg',
900
+ common,
901
+ h('circle', { cx: 8.5, cy: 15.5, r: 4.5 }),
902
+ h('path', { d: 'M11.7 12.3L19 5' }),
903
+ h('path', { d: 'M16.5 7.5l2 2' }),
904
+ h('path', { d: 'M14 10l2 2' }),
905
+ )
906
+ case 'layers':
907
+ return h(
908
+ 'svg',
909
+ common,
910
+ h('path', { d: 'M12 3l9 4.5-9 4.5-9-4.5 9-4.5z' }),
911
+ h('path', { d: 'M3 12l9 4.5 9-4.5' }),
912
+ h('path', { d: 'M3 16.5l9 4.5 9-4.5' }),
913
+ )
914
+ case 'shield':
915
+ return h(
916
+ 'svg',
917
+ common,
918
+ h('path', { d: 'M12 3l7.5 3v6c0 4.5-3.2 8.2-7.5 9.5C7.7 20.2 4.5 16.5 4.5 12V6L12 3z' }),
919
+ h('path', { d: 'M9 12l2 2 4-4' }),
920
+ )
921
+ case 'clock':
922
+ return h(
923
+ 'svg',
924
+ common,
925
+ h('circle', { cx: 12, cy: 12, r: 9 }),
926
+ h('path', { d: 'M12 7v5l3 2' }),
927
+ )
928
+ case 'check':
929
+ return h('svg', common, h('path', { d: 'M5 12l5 5 9-9' }))
930
+ case 'alert':
931
+ return h(
932
+ 'svg',
933
+ common,
934
+ h('path', { d: 'M12 9v4' }),
935
+ h('path', { d: 'M10.4 4.3L3.1 17a1.8 1.8 0 0 0 1.6 2.7h14.6a1.8 1.8 0 0 0 1.6-2.7L13.6 4.3a1.8 1.8 0 0 0-3.2 0z' }),
936
+ h('circle', { cx: 12, cy: 16.3, r: 0.6, fill: 'currentColor' }),
937
+ )
938
+ default:
939
+ return null
940
+ }
941
+ }
942
+
943
+ class GuardErrorBoundary extends React.Component {
944
+ constructor(props) {
945
+ super(props)
946
+ this.state = { error: null }
947
+ }
948
+ static getDerivedStateFromError(error) {
949
+ return { error }
950
+ }
951
+ render() {
952
+ if (this.state.error) {
953
+ const t = COPY[store.lang] || COPY.zh
954
+ return h(
955
+ 'div',
956
+ { className: 'dshg-root' },
957
+ h(
958
+ 'div',
959
+ { className: 'dshg-card' },
960
+ h('div', { style: { fontWeight: 600, fontSize: 13 } }, t.errorRecover),
961
+ h(
962
+ 'div',
963
+ { style: { fontSize: 11.5, color: 'var(--dshg-text-2)' } },
964
+ String((this.state.error && this.state.error.message) || this.state.error),
965
+ ),
966
+ h(
967
+ 'button',
968
+ {
969
+ className: 'dshg-btn',
970
+ onClick: () => {
971
+ this.setState({ error: null })
972
+ void fetchOverview()
973
+ },
974
+ },
975
+ t.retry,
976
+ ),
977
+ ),
978
+ )
979
+ }
980
+ return this.props.children
981
+ }
982
+ }
983
+
984
+ function ProfileSubcard({ profile, t }) {
985
+ const isWeb = profile.target === 'web'
986
+ const trackName = isWeb ? t.webTrack : t.desktopTrack
987
+ const trackTone = isWeb ? 'blue' : 'ok'
988
+
989
+ if (!profile.exists) {
990
+ return h(
991
+ 'div',
992
+ { className: 'dshg-subcard' },
993
+ h(
994
+ 'div',
995
+ { className: 'dshg-row' },
996
+ h('span', { className: 'dshg-badge', 'data-tone': 'muted' }, trackName),
997
+ ),
998
+ h('div', { style: { fontSize: 11, color: 'var(--dshg-text-2)' } }, t.missingDir),
999
+ )
1000
+ }
1001
+
1002
+ const patchInfo = profile.patch || {}
1003
+ const patchText = !patchInfo.exists
1004
+ ? t.patchMissing
1005
+ : patchInfo.syntaxOk
1006
+ ? t.patchOk(patchInfo.disabledCount || 0)
1007
+ : t.patchErr(patchInfo.error || 'YAML')
1008
+ const patchTone = patchInfo.exists && !patchInfo.syntaxOk ? 'warn' : 'ok'
1009
+
1010
+ return h(
1011
+ 'div',
1012
+ { className: 'dshg-subcard' },
1013
+ h(
1014
+ 'div',
1015
+ { className: 'dshg-row' },
1016
+ h('span', { className: 'dshg-badge', 'data-tone': trackTone }, trackName),
1017
+ h(
1018
+ 'span',
1019
+ { style: { fontSize: 11, color: 'var(--dshg-text-2)', fontVariantNumeric: 'tabular-nums', whiteSpace: 'nowrap' } },
1020
+ `${profile.bundlesCount} ${t.bundlesLabel} · ${profile.dependenciesCount} ${t.depsLabel}`,
1021
+ ),
1022
+ ),
1023
+ h(
1024
+ 'div',
1025
+ { className: 'dshg-badge', 'data-tone': patchTone, style: { whiteSpace: 'nowrap' } },
1026
+ h(SvgIcon, { name: patchTone === 'ok' ? 'check' : 'alert', size: 11 }),
1027
+ patchText,
1028
+ ),
1029
+ !profile.packageJsonOk
1030
+ ? h('div', { style: { fontSize: 11, color: '#f59e0b' } }, t.pkgErr)
1031
+ : null,
1032
+ Array.isArray(profile.missingInDeps) && profile.missingInDeps.length > 0
1033
+ ? h(
1034
+ 'div',
1035
+ { className: 'dshg-pills' },
1036
+ h('span', { style: { fontSize: 11, color: '#f59e0b' } }, `${t.missingInDeps}:`),
1037
+ ...profile.missingInDeps.map((pkg) => h('span', { key: pkg, className: 'dshg-pill', 'data-tone': 'warn' }, pkg)),
1038
+ )
1039
+ : null,
1040
+ Array.isArray(profile.unregisteredDeps) && profile.unregisteredDeps.length > 0
1041
+ ? h(
1042
+ 'div',
1043
+ { className: 'dshg-pills' },
1044
+ h('span', { style: { fontSize: 11, color: '#f59e0b' } }, `${t.unregisteredDeps}:`),
1045
+ ...profile.unregisteredDeps.map((pkg) => h('span', { key: pkg, className: 'dshg-pill', 'data-tone': 'warn' }, pkg)),
1046
+ )
1047
+ : null,
1048
+ )
1049
+ }
1050
+
1051
+ function SupervisorCard({ platform, guard, installerUrl, releaseUrl, repoUrl, launching, t }) {
1052
+ const isWin = platform === 'win32'
1053
+ if (isWin && guard.installed) {
1054
+ return h(
1055
+ 'div',
1056
+ { className: 'dshg-card dshg-card-spotlight' },
1057
+ h(
1058
+ 'div',
1059
+ { className: 'dshg-sec-head' },
1060
+ h(
1061
+ 'span',
1062
+ { style: { display: 'inline-flex', alignItems: 'center', gap: 6 } },
1063
+ h(GuardIcon, { size: 15, active: true }),
1064
+ t.supervisorTitleWinReady,
1065
+ ),
1066
+ h(
1067
+ 'span',
1068
+ { className: 'dshg-badge', 'data-tone': 'ok' },
1069
+ h('span', { className: 'dshg-dot' }),
1070
+ t.supervisorBadgeReady,
1071
+ ),
1072
+ ),
1073
+ h('div', { className: 'dshg-sec-sub' }, t.supervisorDescWinReady),
1074
+ h('div', { className: 'dshg-path-box' }, guard.exePath || 'DSHGuard.exe'),
1075
+ h(
1076
+ 'button',
1077
+ {
1078
+ className: 'dshg-btn dshg-btn-primary',
1079
+ disabled: launching,
1080
+ onClick: () => void launchDesktopGuard(),
1081
+ },
1082
+ h(SvgIcon, { name: 'window', size: 15 }),
1083
+ launching ? t.btnOpeningGuard : t.btnOpenGuard,
1084
+ ),
1085
+ )
1086
+ }
1087
+
1088
+ if (isWin) {
1089
+ const feats = [
1090
+ { icon: 'bolt', title: t.feat1Title, sub: t.feat1Sub },
1091
+ { icon: 'key', title: t.feat2Title, sub: t.feat2Sub },
1092
+ { icon: 'layers', title: t.feat3Title, sub: t.feat3Sub },
1093
+ { icon: 'shield', title: t.feat4Title, sub: t.feat4Sub },
1094
+ ]
1095
+ return h(
1096
+ 'div',
1097
+ { className: 'dshg-card dshg-card-spotlight' },
1098
+ h(
1099
+ 'div',
1100
+ { className: 'dshg-sec-head' },
1101
+ h(
1102
+ 'span',
1103
+ { style: { display: 'inline-flex', alignItems: 'center', gap: 6 } },
1104
+ h(GuardIcon, { size: 15, active: true }),
1105
+ t.supervisorTitleWinMissing,
1106
+ ),
1107
+ h('span', { className: 'dshg-badge', 'data-tone': 'blue' }, t.supervisorBadgeWin),
1108
+ ),
1109
+ h('div', { className: 'dshg-sec-sub' }, t.supervisorDescWinMissing),
1110
+ h(
1111
+ 'div',
1112
+ { className: 'dshg-feat-grid' },
1113
+ ...feats.map((f) =>
1114
+ h(
1115
+ 'div',
1116
+ { key: f.title, className: 'dshg-feat-item' },
1117
+ h('div', { className: 'dshg-feat-ico' }, h(SvgIcon, { name: f.icon, size: 14 })),
1118
+ h(
1119
+ 'div',
1120
+ null,
1121
+ h('div', { className: 'dshg-feat-t' }, f.title),
1122
+ h('div', { className: 'dshg-feat-s' }, f.sub),
1123
+ ),
1124
+ ),
1125
+ ),
1126
+ ),
1127
+ h(
1128
+ 'a',
1129
+ {
1130
+ className: 'dshg-btn dshg-btn-primary',
1131
+ href: installerUrl,
1132
+ target: '_blank',
1133
+ rel: 'noopener noreferrer',
1134
+ },
1135
+ h(SvgIcon, { name: 'download', size: 15 }),
1136
+ t.btnDownloadExe,
1137
+ ),
1138
+ h(
1139
+ 'div',
1140
+ { className: 'dshg-btn-row' },
1141
+ h(
1142
+ 'a',
1143
+ {
1144
+ className: 'dshg-btn',
1145
+ href: repoUrl,
1146
+ target: '_blank',
1147
+ rel: 'noopener noreferrer',
1148
+ },
1149
+ h(SvgIcon, { name: 'external', size: 12 }),
1150
+ t.btnViewRepo,
1151
+ ),
1152
+ h(
1153
+ 'button',
1154
+ {
1155
+ className: 'dshg-btn',
1156
+ onClick: () => void fetchOverview(),
1157
+ },
1158
+ h(SvgIcon, { name: 'refresh', size: 12 }),
1159
+ t.btnRedetect,
1160
+ ),
1161
+ ),
1162
+ )
1163
+ }
1164
+
1165
+ return h(
1166
+ 'div',
1167
+ { className: 'dshg-card' },
1168
+ h(
1169
+ 'div',
1170
+ { className: 'dshg-sec-head' },
1171
+ h(
1172
+ 'span',
1173
+ { style: { display: 'inline-flex', alignItems: 'center', gap: 6 } },
1174
+ h(GuardIcon, { size: 15, active: true }),
1175
+ t.supervisorTitleOther,
1176
+ ),
1177
+ platform ? h('span', { className: 'dshg-badge', 'data-tone': 'muted' }, platform) : null,
1178
+ ),
1179
+ h('div', { className: 'dshg-sec-sub' }, t.supervisorDescOther(platform || 'POSIX')),
1180
+ h(
1181
+ 'div',
1182
+ { className: 'dshg-btn-row' },
1183
+ h(
1184
+ 'a',
1185
+ {
1186
+ className: 'dshg-btn',
1187
+ href: repoUrl,
1188
+ target: '_blank',
1189
+ rel: 'noopener noreferrer',
1190
+ },
1191
+ h(SvgIcon, { name: 'external', size: 12 }),
1192
+ t.btnViewRepo,
1193
+ ),
1194
+ h(
1195
+ 'a',
1196
+ {
1197
+ className: 'dshg-btn',
1198
+ href: releaseUrl,
1199
+ target: '_blank',
1200
+ rel: 'noopener noreferrer',
1201
+ },
1202
+ h(SvgIcon, { name: 'download', size: 12 }),
1203
+ t.btnViewReleases,
1204
+ ),
1205
+ ),
1206
+ )
1207
+ }
1208
+
1209
+ function GuardPanelInner({ variant }) {
1210
+ const snap = useStore()
1211
+ const t = COPY[snap.lang] || COPY.zh
1212
+
1213
+ React.useEffect(() => {
1214
+ ensureStyles()
1215
+ if (!store.data && !store.loading) {
1216
+ void fetchOverview()
1217
+ }
1218
+ }, [])
1219
+
1220
+ const data = snap.data
1221
+ const health = data && data.health
1222
+ const snapshots = data && data.snapshots
1223
+ const platform = (data && data.platform) || (health && health.platform) || ''
1224
+ const guard = (health && health.guard) || {}
1225
+ const releaseUrl = (guard && guard.releaseUrl) || (snapshots && snapshots.releaseUrl) || RELEASE_FALLBACK
1226
+ const installerUrl = (data && data.installerUrl) || (guard && guard.installerUrl) || (snapshots && snapshots.installerUrl) || INSTALLER_FALLBACK
1227
+ const repoUrl = (data && data.repoUrl) || (guard && guard.repoUrl) || REPO_FALLBACK
1228
+ const creds = (health && health.credentials) || {}
1229
+ const refKeys = Array.isArray(creds.referencedKeys) ? creds.referencedKeys : []
1230
+ const snapList = snapshots && Array.isArray(snapshots.snapshots) ? snapshots.snapshots : []
1231
+ const profiles = health && Array.isArray(health.profiles) ? health.profiles : []
1232
+
1233
+ const webProfile = profiles.find((p) => p.target === 'web')
1234
+ const deskProfile = profiles.find((p) => p.target === 'desktop')
1235
+ const kpiProfilesText = profiles.length
1236
+ ? `${webProfile && webProfile.exists ? webProfile.bundlesCount : 0} · ${deskProfile && deskProfile.exists ? deskProfile.bundlesCount : 0}`
1237
+ : '—'
1238
+ const refReadyCount = refKeys.filter((r) => r.ready).length
1239
+ const kpiCredsReady = refKeys.length > 0 ? refReadyCount : (creds.nonEmptyKeysCount || 0)
1240
+ const kpiCredsTotal = refKeys.length > 0 ? refKeys.length : (creds.totalKeysCount || 0)
1241
+ const kpiCredsText = health ? (creds.fileExists ? `${kpiCredsReady}/${kpiCredsTotal}` : '0/0') : '—'
1242
+ const kpiSnapsText = snapshots ? String(snapshots.total || 0) : '—'
1243
+
1244
+ const hasProfileIssues = Boolean(health && Array.isArray(health.issues) && health.issues.length > 0)
1245
+ const hasMissingCreds = Boolean(
1246
+ !creds.fileExists || (Array.isArray(creds.missingReferencedKeys) && creds.missingReferencedKeys.length > 0),
1247
+ )
1248
+
1249
+ const credRatioPct = kpiCredsTotal > 0 ? Math.min(100, Math.round((kpiCredsReady / kpiCredsTotal) * 100)) : 0
1250
+
1251
+ function renderDesktopCta(openLabel, downloadLabel) {
1252
+ if (platform === 'win32' && guard.installed) {
1253
+ return h(
1254
+ 'button',
1255
+ {
1256
+ className: 'dshg-btn dshg-btn-primary',
1257
+ disabled: snap.launching,
1258
+ onClick: () => void launchDesktopGuard(),
1259
+ },
1260
+ h(SvgIcon, { name: 'window', size: 14 }),
1261
+ snap.launching ? t.btnOpeningGuard : openLabel,
1262
+ )
1263
+ }
1264
+ if (platform === 'win32') {
1265
+ return h(
1266
+ 'a',
1267
+ {
1268
+ className: 'dshg-btn dshg-btn-primary',
1269
+ href: installerUrl,
1270
+ target: '_blank',
1271
+ rel: 'noopener noreferrer',
1272
+ },
1273
+ h(SvgIcon, { name: 'download', size: 14 }),
1274
+ downloadLabel,
1275
+ )
1276
+ }
1277
+ return h(
1278
+ 'a',
1279
+ {
1280
+ className: 'dshg-btn',
1281
+ href: repoUrl,
1282
+ target: '_blank',
1283
+ rel: 'noopener noreferrer',
1284
+ },
1285
+ h(SvgIcon, { name: 'external', size: 13 }),
1286
+ t.btnViewRepo,
1287
+ )
1288
+ }
1289
+
1290
+ return h(
1291
+ 'div',
1292
+ { className: 'dshg-root', 'data-variant': variant || 'dock' },
1293
+
1294
+ // Brand Header Card
1295
+ h(
1296
+ 'div',
1297
+ { className: 'dshg-card' },
1298
+ h(
1299
+ 'div',
1300
+ { className: 'dshg-header' },
1301
+ h(
1302
+ 'div',
1303
+ { className: 'dshg-brand' },
1304
+ h('div', { className: 'dshg-logo-wrap' }, h(GuardIcon, { size: 18, active: true })),
1305
+ h(
1306
+ 'div',
1307
+ null,
1308
+ h(
1309
+ 'div',
1310
+ { className: 'dshg-title-row' },
1311
+ h('span', { className: 'dshg-title' }, t.brand),
1312
+ h('span', { className: 'dshg-ver' }, t.versionPill),
1313
+ ),
1314
+ h('div', { className: 'dshg-sub' }, t.subtitle),
1315
+ ),
1316
+ ),
1317
+ h(
1318
+ 'div',
1319
+ { className: 'dshg-actions' },
1320
+ h(
1321
+ 'button',
1322
+ {
1323
+ className: 'dshg-btn dshg-btn-icon',
1324
+ disabled: snap.loading,
1325
+ title: t.refresh,
1326
+ 'aria-label': t.refresh,
1327
+ onClick: () => void fetchOverview(),
1328
+ },
1329
+ h(SvgIcon, { name: 'refresh', size: 14, className: snap.loading ? 'dshg-spin' : '' }),
1330
+ ),
1331
+ h(
1332
+ 'button',
1333
+ {
1334
+ className: 'dshg-btn',
1335
+ onClick: () => patch({ lang: snap.lang === 'zh' ? 'en' : 'zh' }),
1336
+ },
1337
+ t.langSwitch,
1338
+ ),
1339
+ ),
1340
+ ),
1341
+ health
1342
+ ? h(
1343
+ 'div',
1344
+ { className: 'dshg-row' },
1345
+ h(
1346
+ 'span',
1347
+ { className: 'dshg-badge', 'data-tone': health.healthy ? 'ok' : 'warn' },
1348
+ h('span', { className: 'dshg-dot' }),
1349
+ health.healthy ? t.healthy : t.unhealthy(health.issuesCount || 0),
1350
+ ),
1351
+ snap.checkedAt
1352
+ ? h(
1353
+ 'span',
1354
+ { style: { fontSize: 11, color: 'var(--dshg-text-3)', fontVariantNumeric: 'tabular-nums' } },
1355
+ t.checkedAt(formatClockOnly(snap.checkedAt)),
1356
+ )
1357
+ : null,
1358
+ )
1359
+ : null,
1360
+ ),
1361
+
1362
+ // Compact 3-Column KPI Strip
1363
+ data
1364
+ ? h(
1365
+ 'div',
1366
+ { className: 'dshg-kpi-strip' },
1367
+ h(
1368
+ 'button',
1369
+ {
1370
+ className: 'dshg-kpi',
1371
+ 'data-active': snap.tab === 'overview' ? 'true' : 'false',
1372
+ onClick: () => patch({ tab: 'overview' }),
1373
+ },
1374
+ h('span', { className: 'dshg-kpi-label' }, t.kpiProfilesLabel),
1375
+ h('span', { className: 'dshg-kpi-val' }, kpiProfilesText),
1376
+ h('span', { className: 'dshg-kpi-sub' }, t.kpiProfilesSub),
1377
+ ),
1378
+ h(
1379
+ 'button',
1380
+ {
1381
+ className: 'dshg-kpi',
1382
+ 'data-active': snap.tab === 'creds' ? 'true' : 'false',
1383
+ onClick: () => patch({ tab: 'creds' }),
1384
+ },
1385
+ h('span', { className: 'dshg-kpi-label' }, t.kpiCredsLabel),
1386
+ h('span', { className: 'dshg-kpi-val' }, kpiCredsText),
1387
+ h('span', { className: 'dshg-kpi-sub' }, t.kpiCredsSub),
1388
+ ),
1389
+ h(
1390
+ 'button',
1391
+ {
1392
+ className: 'dshg-kpi',
1393
+ 'data-active': snap.tab === 'snapshots' ? 'true' : 'false',
1394
+ onClick: () => patch({ tab: 'snapshots' }),
1395
+ },
1396
+ h('span', { className: 'dshg-kpi-label' }, t.kpiSnapsLabel),
1397
+ h('span', { className: 'dshg-kpi-val' }, kpiSnapsText),
1398
+ h('span', { className: 'dshg-kpi-sub' }, t.kpiSnapsSub),
1399
+ ),
1400
+ )
1401
+ : null,
1402
+
1403
+ // Segmented Control Tabs
1404
+ data
1405
+ ? h(
1406
+ 'div',
1407
+ { className: 'dshg-seg', role: 'tablist' },
1408
+ h(
1409
+ 'button',
1410
+ {
1411
+ className: 'dshg-seg-btn',
1412
+ role: 'tab',
1413
+ 'aria-selected': snap.tab === 'overview',
1414
+ 'data-active': snap.tab === 'overview' ? 'true' : 'false',
1415
+ onClick: () => patch({ tab: 'overview' }),
1416
+ },
1417
+ t.tabOverview,
1418
+ hasProfileIssues ? h('span', { className: 'dshg-seg-dot' }) : null,
1419
+ ),
1420
+ h(
1421
+ 'button',
1422
+ {
1423
+ className: 'dshg-seg-btn',
1424
+ role: 'tab',
1425
+ 'aria-selected': snap.tab === 'creds',
1426
+ 'data-active': snap.tab === 'creds' ? 'true' : 'false',
1427
+ onClick: () => patch({ tab: 'creds' }),
1428
+ },
1429
+ t.tabCreds,
1430
+ hasMissingCreds ? h('span', { className: 'dshg-seg-dot' }) : null,
1431
+ ),
1432
+ h(
1433
+ 'button',
1434
+ {
1435
+ className: 'dshg-seg-btn',
1436
+ role: 'tab',
1437
+ 'aria-selected': snap.tab === 'snapshots',
1438
+ 'data-active': snap.tab === 'snapshots' ? 'true' : 'false',
1439
+ onClick: () => patch({ tab: 'snapshots' }),
1440
+ },
1441
+ t.tabSnapshots,
1442
+ ),
1443
+ )
1444
+ : null,
1445
+
1446
+ snap.error ? h('div', { className: 'dshg-error' }, snap.error) : null,
1447
+ snap.notice ? h('div', { className: 'dshg-notice' }, snap.notice) : null,
1448
+
1449
+ !data && snap.loading
1450
+ ? h('div', { className: 'dshg-card', style: { color: 'var(--dshg-text-2)' } }, t.loading)
1451
+ : null,
1452
+
1453
+ // TAB 1: Overview
1454
+ data && snap.tab === 'overview'
1455
+ ? [
1456
+ h(SupervisorCard, {
1457
+ key: 'supervisor',
1458
+ platform,
1459
+ guard,
1460
+ installerUrl,
1461
+ releaseUrl,
1462
+ repoUrl,
1463
+ launching: snap.launching,
1464
+ t,
1465
+ }),
1466
+ health && profiles.length > 0
1467
+ ? h(
1468
+ 'div',
1469
+ { key: 'profiles', className: 'dshg-card' },
1470
+ h('div', { className: 'dshg-sec-head' }, h('span', null, t.profilesTitle)),
1471
+ h(
1472
+ 'div',
1473
+ { className: 'dshg-profile-grid' },
1474
+ ...profiles.map((p) => h(ProfileSubcard, { key: p.target, profile: p, t })),
1475
+ ),
1476
+ )
1477
+ : null,
1478
+ hasProfileIssues
1479
+ ? h(
1480
+ 'div',
1481
+ { key: 'issues', className: 'dshg-card' },
1482
+ h(
1483
+ 'div',
1484
+ { className: 'dshg-sec-head' },
1485
+ h('span', { style: { display: 'inline-flex', alignItems: 'center', gap: 6, color: '#f59e0b' } }, h(SvgIcon, { name: 'alert', size: 14 }), t.issuesTitle),
1486
+ ),
1487
+ ...health.issues.map((issue, idx) =>
1488
+ h('div', { key: idx, style: { fontSize: 11.5, color: '#f59e0b', wordBreak: 'break-word' } }, `• ${issue}`),
1489
+ ),
1490
+ platform === 'win32'
1491
+ ? renderDesktopCta(t.issueActionOpen, t.issueActionDownload)
1492
+ : null,
1493
+ )
1494
+ : null,
1495
+ ]
1496
+ : null,
1497
+
1498
+ // TAB 2: Masked Credentials Readiness
1499
+ data && snap.tab === 'creds' && health
1500
+ ? [
1501
+ h(
1502
+ 'div',
1503
+ { key: 'cred-status', className: 'dshg-card' },
1504
+ h(
1505
+ 'div',
1506
+ { className: 'dshg-sec-head' },
1507
+ h('span', { style: { display: 'inline-flex', alignItems: 'center', gap: 6 } }, h(SvgIcon, { name: 'key', size: 14 }), t.credsTitle),
1508
+ h(
1509
+ 'span',
1510
+ { className: 'dshg-badge', 'data-tone': creds.fileExists && !hasMissingCreds ? 'ok' : creds.fileExists ? 'warn' : 'muted' },
1511
+ creds.fileExists
1512
+ ? t.credReadyBadge(kpiCredsReady, kpiCredsTotal)
1513
+ : t.credMissingFile,
1514
+ ),
1515
+ ),
1516
+ h('div', { className: 'dshg-sec-sub' }, t.credsPrivacyHint),
1517
+ creds.fileExists
1518
+ ? h(
1519
+ 'div',
1520
+ { className: 'dshg-progress-wrap' },
1521
+ h(
1522
+ 'div',
1523
+ { className: 'dshg-row', style: { fontSize: 11, color: 'var(--dshg-text-2)' } },
1524
+ h(
1525
+ 'span',
1526
+ null,
1527
+ refKeys.length > 0
1528
+ ? t.credProgressPatch(refReadyCount, refKeys.length)
1529
+ : t.credProgressFile(creds.nonEmptyKeysCount || 0, creds.totalKeysCount || 0),
1530
+ ),
1531
+ h('span', { style: { fontVariantNumeric: 'tabular-nums' } }, `${credRatioPct}%`),
1532
+ ),
1533
+ h(
1534
+ 'div',
1535
+ { className: 'dshg-progress-track' },
1536
+ h('div', { className: 'dshg-progress-fill', style: { width: `${credRatioPct}%` } }),
1537
+ ),
1538
+ )
1539
+ : null,
1540
+ refKeys.length > 0
1541
+ ? h(
1542
+ 'div',
1543
+ { className: 'dshg-cred-list' },
1544
+ ...refKeys.map((item) =>
1545
+ h(
1546
+ 'div',
1547
+ { key: item.key, className: 'dshg-cred-item' },
1548
+ h(
1549
+ 'span',
1550
+ { className: 'dshg-cred-key' },
1551
+ h(SvgIcon, { name: 'key', size: 12 }),
1552
+ item.key,
1553
+ ),
1554
+ h(
1555
+ 'span',
1556
+ { className: 'dshg-badge', 'data-tone': item.ready ? 'ok' : 'warn' },
1557
+ h(SvgIcon, { name: item.ready ? 'check' : 'alert', size: 11 }),
1558
+ item.ready ? t.credStatusReady : t.credStatusMissing,
1559
+ ),
1560
+ ),
1561
+ ),
1562
+ )
1563
+ : h('div', { className: 'dshg-sec-sub' }, t.credNoRefs),
1564
+ ),
1565
+ h(
1566
+ 'div',
1567
+ { key: 'cred-upsell', className: 'dshg-card dshg-card-spotlight' },
1568
+ h('div', { className: 'dshg-sec-head' }, h('span', null, t.credUpsellTitle)),
1569
+ h('div', { className: 'dshg-sec-sub' }, t.credUpsellDesc),
1570
+ renderDesktopCta(t.credUpsellOpen, t.credUpsellDownload),
1571
+ ),
1572
+ ]
1573
+ : null,
1574
+
1575
+ // TAB 3: Snapshots Timeline
1576
+ data && snap.tab === 'snapshots' && snapshots
1577
+ ? h(
1578
+ 'div',
1579
+ { className: 'dshg-card' },
1580
+ h(
1581
+ 'div',
1582
+ { className: 'dshg-sec-head' },
1583
+ h('span', { style: { display: 'inline-flex', alignItems: 'center', gap: 6 } }, h(SvgIcon, { name: 'clock', size: 14 }), t.snapshotsTitle),
1584
+ h('span', { className: 'dshg-badge', 'data-tone': 'muted' }, t.snapshotsTotal(snapshots.total || 0)),
1585
+ ),
1586
+ snapList.length > 0
1587
+ ? [
1588
+ h(
1589
+ 'div',
1590
+ { key: 'list', className: 'dshg-timeline' },
1591
+ ...snapList.slice(0, 10).map((s) =>
1592
+ h(
1593
+ 'div',
1594
+ { key: s.id, className: 'dshg-snap-item' },
1595
+ h(
1596
+ 'div',
1597
+ { className: 'dshg-snap-head' },
1598
+ h(
1599
+ 'span',
1600
+ { className: 'dshg-snap-title' },
1601
+ h('span', {
1602
+ className: 'dshg-track-dot',
1603
+ style: { background: s.target === 'desktop' ? '#22c55e' : '#3b82f6' },
1604
+ }),
1605
+ s.reason || t.snapNoReason,
1606
+ ),
1607
+ h(
1608
+ 'span',
1609
+ { className: 'dshg-badge', 'data-tone': s.target === 'desktop' ? 'ok' : 'blue' },
1610
+ s.target === 'desktop' ? t.desktopTrack : t.webTrack,
1611
+ ),
1612
+ ),
1613
+ h(
1614
+ 'div',
1615
+ { className: 'dshg-row', style: { fontSize: 11, color: 'var(--dshg-text-2)' } },
1616
+ h('span', null, t.snapItems(s.itemCount || 0)),
1617
+ h('span', { style: { fontVariantNumeric: 'tabular-nums' } }, formatShortTime(s.createdAt)),
1618
+ ),
1619
+ h('div', { className: 'dshg-mono' }, s.id),
1620
+ ),
1621
+ ),
1622
+ ),
1623
+ h('div', { key: 'snap-cta' }, renderDesktopCta(t.snapActionOpen, t.snapActionDownload)),
1624
+ ]
1625
+ : h(
1626
+ 'div',
1627
+ { className: 'dshg-empty' },
1628
+ h('div', { style: { color: 'var(--dshg-text-2)' } }, h(SvgIcon, { name: 'clock', size: 22 })),
1629
+ h('div', { style: { fontWeight: 600, fontSize: 12, color: 'var(--dshg-text)' } }, t.snapshotsEmptyTitle),
1630
+ h('div', { style: { fontSize: 11, lineHeight: 1.5 } }, t.snapshotsEmptyDesc),
1631
+ renderDesktopCta(t.snapActionOpen, t.snapActionDownload),
1632
+ ),
1633
+ )
1634
+ : null,
1635
+
1636
+ // Subtle Footer
1637
+ h(
1638
+ 'div',
1639
+ { className: 'dshg-footer' },
1640
+ h('span', null, t.footerNote),
1641
+ h(
1642
+ 'a',
1643
+ { href: repoUrl, target: '_blank', rel: 'noopener noreferrer' },
1644
+ t.footerHome,
1645
+ ),
1646
+ ),
1647
+ )
1648
+ }
1649
+
1650
+ function GuardPanel(props) {
1651
+ return h(GuardErrorBoundary, null, h(GuardPanelInner, props || {}))
1652
+ }
1653
+
1654
+ function SidebarGuardTab() {
1655
+ return h(GuardPanel, { variant: 'dock' })
1656
+ }
1657
+
1658
+ function MainGuardPage() {
1659
+ return h(GuardPanel, { variant: 'main' })
1660
+ }
1661
+
1662
+ return {
1663
+ inject: ['slots', 'sidebarRightTabs'],
1664
+ apply(ctx) {
1665
+ if (ctx && typeof ctx.effect === 'function') {
1666
+ ctx.effect(() => {
1667
+ const tabs = typeof ctx.get === 'function' ? ctx.get('sidebarRightTabs') : ctx.sidebarRightTabs
1668
+ if (!tabs || typeof tabs.register !== 'function') return undefined
1669
+ return tabs.register({
1670
+ id: SIDE_ID,
1671
+ kind: SIDE_ID,
1672
+ priority: 'extension',
1673
+ title: () => (COPY[store.lang] || COPY.zh).brand,
1674
+ guide: [
1675
+ {
1676
+ id: SIDE_ID,
1677
+ order: 60,
1678
+ title: () => (COPY[store.lang] || COPY.zh).brand,
1679
+ description: () => (COPY[store.lang] || COPY.zh).guideDesc,
1680
+ icon: GuardIcon,
1681
+ },
1682
+ ],
1683
+ })
1684
+ }, 'dsh-guard: right-sidebar tab')
1685
+
1686
+ if (ctx.slots && typeof ctx.slots.inject === 'function' && typeof ctx.slots.register === 'function') {
1687
+ ctx.slots.inject('sidebar.right.pane.tab', () =>
1688
+ ctx.slots.register({ name: 'sidebar.right.pane.tab', key: SIDE_ID, order: 120 }, SidebarGuardTab),
1689
+ )
1690
+ ctx.slots.inject('sidebar.panellist', () =>
1691
+ ctx.slots.register(
1692
+ { name: 'sidebar.panellist', id: SIDE_ID, order: 55, label: () => (COPY[store.lang] || COPY.zh).brand },
1693
+ GuardIcon,
1694
+ ),
1695
+ )
1696
+ ctx.slots.inject('main', () =>
1697
+ ctx.slots.register({ name: 'main', key: SIDE_ID, locale: 'zh-CN' }, MainGuardPage),
1698
+ )
1699
+ }
1700
+ }
1701
+ },
1702
+ }
1703
+ },
1704
+ })