dsh-multipane 1.0.33 → 1.0.34

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 CHANGED
@@ -17,8 +17,362 @@ window.__ModuleLoader__.load({
17
17
  */
18
18
  const PLUGIN_LABEL = "多栏视图";
19
19
  /* 与 package.json 的 version 必须一致(发版时两处同改;check-names.cjs 会校验)。 */
20
- const PLUGIN_VERSION = "1.0.33";
20
+ const PLUGIN_VERSION = "1.0.34";
21
21
  const NPM_LATEST_URL = "https://registry.npmjs.org/dsh-multipane/latest";
22
+
23
+
24
+ //#region i18n
25
+ /**
26
+ * 中英切换:只读宿主的「当前语言」,文案自己查表。
27
+ *
28
+ * 为什么不直接 ctx.locale.register(ns, { zh, en }) + bind(ns):
29
+ * 宿主 translate() 的 fallback 链末端必定补 'en'(见 dsh-client-locale/lib/client.js,
30
+ * fallbackChain 末尾强制 push 'en'),只注册 en 字典时中文界面会落到英文;
31
+ * 而且注册表捕获的文案在语言切换时不会重算,做不到「切了就变」。
32
+ * 这里 t() 在**渲染时**现取,语言一变、界面重渲染,文案自然跟着变。
33
+ */
34
+ const I18N = { lang: "zh", ctx: void 0 };
35
+ /** 中文原文 → 英文。查不到就退回中文(宁可中文,也不要空白或 key)。 */
36
+ const I18N_EN = {
37
+ "多栏视图": "Multi-pane",
38
+ "石墨灰": "Graphite",
39
+ "雾蓝": "Mist blue",
40
+ "青绿": "Teal",
41
+ "草绿": "Grass",
42
+ "藕紫": "Mauve",
43
+ "雾玫": "Rose",
44
+ "琥珀": "Amber",
45
+ "细": "Thin",
46
+ "标准": "Normal",
47
+ "粗": "Thick",
48
+ "很粗": "Heavy",
49
+ "很淡": "Very light",
50
+ "偏淡": "Light",
51
+ "适中": "Medium",
52
+ "实色": "Solid",
53
+ "JSON 设置文件": "JSON settings file",
54
+ "不是有效的 JSON 文件": "Not a valid JSON file",
55
+ "文件内容不是设置对象": "This file does not contain a settings object",
56
+ "文件里没有可识别的设置项": "No recognizable settings in this file",
57
+ "文件里的设置项都不认识(可能来自别的插件)": "None of these settings are recognized (they may come from another plugin)",
58
+ "该标签页渲染失败:{0}": "This tab failed to render: {0}",
59
+ "多栏视图渲染失败:{0}": "Multi-pane failed to render: {0}",
60
+ "回到单栏视图": "Back to single pane",
61
+ "这个版本没有提供会话内容区域": "This version does not expose a session content area",
62
+ "sessions 服务不可用": "sessions service unavailable",
63
+ "正在打开会话…": "Opening session…",
64
+ "该会话暂时没有可用的绑定": "This session has no binding available yet",
65
+ "这个版本没有提供会话上下文": "This version does not expose session context",
66
+ "{0} — 已锁定(右键解锁后才能关闭)": "{0} — locked (right-click to unlock before closing)",
67
+ "{0} — {1}(右键可锁定)": "{0} — {1} (right-click to lock)",
68
+ "双击或中键关闭": "double-click or middle-click to close",
69
+ "中键关闭": "middle-click to close",
70
+ "关闭标签": "Close tab",
71
+ "关闭 {0}": "Close {0}",
72
+ "新会话": "New session",
73
+ "已失效会话": "Expired session",
74
+ "未命名会话": "Untitled session",
75
+ "松手:加到这一栏": "Drop: add to this pane",
76
+ "最多 {0} 栏": "Up to {0} panes",
77
+ "新建标签": "New tab",
78
+ "最多支持 {0} 栏": "Up to {0} panes supported",
79
+ "松手:在这一栏左侧新开一栏": "Drop: open a new pane to the left",
80
+ "松手:在这一栏右侧新开一栏": "Drop: open a new pane to the right",
81
+ "轮次": "Turns",
82
+ "用量": "Usage",
83
+ "缓存命中": "Cache hit",
84
+ "智能体": "Agent",
85
+ "没有可用的统计": "No stats available",
86
+ "收起右侧边栏": "Collapse right sidebar",
87
+ "打开右侧边栏": "Open right sidebar",
88
+ "更多操作": "More actions",
89
+ "更多": "More",
90
+ "暂无可用视图": "No views available",
91
+ "更多会话视图": "More session views",
92
+ "不显示": "Hidden",
93
+ "顶部": "Top",
94
+ "底部": "Bottom",
95
+ "会话视图切换条": "Session view switcher",
96
+ "每栏顶部(或底部)那一行视图切换条。内容自动跟随应用当前的视图列表,不写死任何一项;装了新插件、或插件新增了视图,会自动出现。下面每一项可单独开关、上下排序。": "The row of view tabs at the top (or bottom) of each pane. It follows the app's current view list instead of hard-coding entries, so new plugins and new views appear automatically. Each item below can be toggled and reordered.",
97
+ "视图切换条位置": "Switcher position",
98
+ "显示哪些视图、什么顺序": "Which views to show, in what order",
99
+ "共发现 {0} 个已注册视图。关掉的会被收进「…」按钮,点开还能选;顺序决定它们在条上的先后。": "{0} registered views found. Hidden ones go into the \"…\" button and stay selectable; the order sets their place in the bar.",
100
+ "暂无可用视图。": "No views available.",
101
+ "点击显示": "Click to show",
102
+ "点击隐藏(收进「…」)": "Click to hide (moves into \"…\")",
103
+ "显示 {0}": "Show {0}",
104
+ "上移": "Move up",
105
+ "上移 {0}": "Move {0} up",
106
+ "下移": "Move down",
107
+ "下移 {0}": "Move {0} down",
108
+ "恢复默认顺序与显示": "Restore default order and visibility",
109
+ "{0} 最暗": "{0} darkest",
110
+ "{0} 最亮": "{0} brightest",
111
+ "颜色": "Color",
112
+ "跟随全局": "Follow global",
113
+ "当前跟随全局色;点一下改成单独颜色": "Currently follows the global color; click for a separate color",
114
+ "点一下恢复跟随全局色": "Click to follow the global color again",
115
+ "已单独设置": "Custom color",
116
+ "选择颜色": "Choose color",
117
+ "选一个颜色(选完自动变成单独颜色)": "Pick a color (switches to a custom color automatically)",
118
+ "已导出:{0}": "Exported: {0}",
119
+ "已取消导出": "Export canceled",
120
+ "导出失败:{0}": "Export failed: {0}",
121
+ "已恢复 {0} 项设置(来自 {1})": "Restored {0} settings from {1}",
122
+ "恢复失败:{0}": "Restore failed: {0}",
123
+ "读取文件失败": "Could not read the file",
124
+ "设置备份": "Settings backup",
125
+ "导出一个 JSON 文件,换机器或重装后导回来即可还原全部外观与开关。文件只含本插件设置,不含会话内容。": "Export a JSON file and import it on another machine or after a reinstall to restore every appearance setting and toggle. The file contains only this plugin's settings, no session content.",
126
+ "导出设置文件": "Export settings file",
127
+ "从文件恢复": "Restore from file",
128
+ "激活会话": "Active session",
129
+ "打开并显示": "Open and shown",
130
+ "打开未显示": "Open but hidden",
131
+ "未打开会话": "Not open",
132
+ "会话 A": "Session A",
133
+ "会话 B": "Session B",
134
+ "悬停": "Hover",
135
+ "会话 C": "Session C",
136
+ "锁定": "Locked",
137
+ "拖文件到这里": "Drop files here",
138
+ "实时预览 · 实际大小": "Live preview · actual size",
139
+ "收起": "Collapse",
140
+ "展开": "Expand",
141
+ "收起高级项": "Collapse advanced",
142
+ "更多(高级项)": "More (advanced)",
143
+ "恢复本组默认": "Reset this group",
144
+ "全局线条颜色": "Global line color",
145
+ "所有线条默认用这个颜色;下面每一组都可以单独换成别的颜色。": "Every line uses this color by default; each group below can override it.",
146
+ "自定义": "Custom",
147
+ "自定义全局线条颜色": "Custom global line color",
148
+ "任意颜色;选完所有「跟随全局」的线都会变": "Any color; every line set to follow global will change",
149
+ "{0}(正在使用)": "{0} (in use)",
150
+ "栏间分隔条": "Pane divider",
151
+ "两栏之间那条竖线;悬停或拖动时自动变实色,方便对准。": "The vertical line between panes; it turns solid on hover or drag so you can aim.",
152
+ "平时浓度": "Idle opacity",
153
+ "不悬停、不拖动时有多浓": "Opacity when not hovering or dragging",
154
+ "粗细": "Thickness",
155
+ "标签页焦点线": "Tab focus line",
156
+ "激活标签底部那条横线;焦点栏最亮,其它栏更淡,悬停居中。": "The underline under the active tab; brightest in the focused pane, lighter in others, in between on hover.",
157
+ "焦点栏浓度": "Focused pane opacity",
158
+ "你正在操作的那一栏": "The pane you are working in",
159
+ "非焦点栏浓度": "Unfocused pane opacity",
160
+ "其它栏的激活标签": "Active tabs in other panes",
161
+ "悬停时浓度": "Hover opacity",
162
+ "鼠标移到非焦点栏上时,那一栏当前标签的下划线与淡底有多浓(把鼠标移到这一行,预览里会框出「悬停」标签)": "How strong the underline and tint are on a non-focused pane's active tab while the pointer is over it (hover this row to see the \"Hover\" tab outlined in the preview)",
163
+ "侧栏会话行": "Sidebar session rows",
164
+ "会话列表每一行的左竖线和底色,按四种状态区分:焦点 / 已打开并显示 / 已打开未显示 / 未打开。": "The left bar and background of each session-list row, by state: focused / open and shown / open but hidden / not open.",
165
+ "焦点行竖线浓度": "Focused row bar opacity",
166
+ "你正在看的那个会话": "The session you are viewing",
167
+ "焦点行底色浓度": "Focused row background opacity",
168
+ "焦点行竖线粗细": "Focused row bar thickness",
169
+ "最粗 8px;调这里最直观": "Up to 8px; the most visible knob",
170
+ "焦点行文字加粗": "Bold focused row text",
171
+ "默认不加粗(本机中文字体只有常规/粗两档,加粗会明显变重)": "Off by default (the CJK font here only has regular and bold, so bold looks much heavier)",
172
+ "打开显示行竖线浓度": "Shown-row bar opacity",
173
+ "已打开、并且是某一栏当前标签": "Open and the active tab of a pane",
174
+ "打开行底色浓度": "Open-row background opacity",
175
+ "「打开显示」和「打开未显示」共用": "Shared by \"open and shown\" and \"open but hidden\"",
176
+ "打开行竖线粗细": "Open-row bar thickness",
177
+ "「打开未显示」也画竖线": "Draw a bar for \"open but hidden\" too",
178
+ "默认不画:开过但没显示在屏幕上的会话,只保留底色": "Off by default: sessions that are open but not on screen only get the tint",
179
+ "未打开行文字亮度": "Unopened row text brightness",
180
+ "拖放提示": "Drag and drop",
181
+ "拖文件进窗口时的目标栏边框,拖标签时的虚线框、半屏预览、虚位标签,统一在这一组调。": "Target-pane border when dropping files, plus the dashed box, half-pane preview and placeholder tab when dragging tabs — all tuned here.",
182
+ "边框浓度": "Border opacity",
183
+ "边框、虚线、边缘线都用它": "Used for borders, dashed outlines and edge lines",
184
+ "目标栏蒙层浓度": "Target pane tint opacity",
185
+ "拖文件时整栏那层淡色": "The tint over the whole pane while dragging files",
186
+ "线条粗细": "Line thickness",
187
+ "半屏预览底色": "Half-pane preview color",
188
+ "拖到栏边缘「新开一栏」时那块半屏": "The half pane shown when dropping on an edge to open a new pane",
189
+ "虚位标签底色": "Placeholder tab color",
190
+ "拖到标签条时「松手:加到这一栏」那块": "The \"drop: add to this pane\" target on the tab bar",
191
+ "其它细节": "Other details",
192
+ "锁定标签的底色、标签重排时的插入竖线。": "Background of locked tabs, and the insertion line when reordering tabs.",
193
+ "锁定标签底色浓度": "Locked tab background opacity",
194
+ "重排插入线浓度": "Reorder insertion line opacity",
195
+ "拖动标签换位时,标出「将插到这里」的那条细竖线(平时不存在;把鼠标移到这一行才在预览里显示)": "The thin vertical line marking \"insert here\" while dragging a tab (not shown normally; hover this row to preview it)",
196
+ "运行中呼吸": "Running pulse",
197
+ "会话在执行任务时,它在侧栏那一行的底色会一浓一淡地「呼吸」,一眼就能看出哪个还在干活。按任务真实的运行状态判断,不是估的。": "While a session is running a task its sidebar row gently pulses, so you can see at a glance who is still working. Driven by real task state, not an estimate.",
198
+ "开启呼吸": "Enable pulse",
199
+ "关掉后静默,不占资源": "Silent and free when off",
200
+ "哪几类「正在跑」的会话要呼吸(可多选):": "Which running sessions should pulse (multi-select):",
201
+ "已激活": "Active",
202
+ "你现在正在看的那一行": "The row you are viewing now",
203
+ "已打开且显示": "Open and shown",
204
+ "已经拖进某一栏、并且是那一栏当前标签": "Dragged into a pane and active there",
205
+ "已打开未显示": "Open but hidden",
206
+ "打开了、但在后台标签里": "Open but in a background tab",
207
+ "未打开": "Not open",
208
+ "还在侧栏列表里、没拖进多栏的会话": "Still only in the sidebar, not dragged into a pane",
209
+ "跟随「已打开且显示」": "Same as \"open and shown\"",
210
+ "低点 / 高点 / 节奏都用「已打开且显示」那一组": "Low, high and tempo all use the \"open and shown\" group",
211
+ "亮度范围(最暗 ↔ 最亮)": "Brightness range (darkest ↔ brightest)",
212
+ "当前底板 {0}%": "Base {0}%",
213
+ "两个滑块之间就是呼吸范围": "The two handles define the pulse range",
214
+ "两个滑块之间就是呼吸范围;白线 = 当前底板 {0}%": "The two handles define the pulse range; white line = base {0}%",
215
+ "节奏": "Tempo",
216
+ "没有找到插件市场。请关闭这个窗口,改从左侧「插件市场」→「已安装」里更新本插件。": "Plugin marketplace not found. Close this window and update this plugin from \"Plugin marketplace\" → \"Installed\" on the left.",
217
+ "打开插件市场面板失败:": "Could not open the plugin marketplace panel: ",
218
+ "。请改从左侧「插件市场」更新。": ". Please update from \"Plugin marketplace\" on the left instead.",
219
+ "正在检查…": "Checking…",
220
+ "发现新版本 {0}": "New version {0} available",
221
+ "已是最新版本({0},{1} 检查)": "Up to date ({0}, checked {1})",
222
+ "插件市场未启用更新检查": "The marketplace does not support update checks",
223
+ "返回里没有版本信息": "No version info in the response",
224
+ "已是最新版本({0},{1} 检查);npm 上已有 {2},插件市场还没放行,稍后再点一次": "Up to date ({0}, checked {1}); npm already has {2} but the marketplace has not published it yet — try again shortly",
225
+ "返回里没有版本号": "No version number in the response",
226
+ "已是最新版本({0})": "Up to date ({0})",
227
+ "本机没有可用的插件市场(dshmarket),无法在这里自动安装。到「插件」页填 ": "No plugin marketplace (dshmarket) here, so this cannot install automatically. On the \"Plugins\" page, fill in ",
228
+ " 安装。": " to install.",
229
+ "检查失败:{0}": "Check failed: {0}",
230
+ "正在从 npm 下载…": "Downloading from npm…",
231
+ "已更新到 {0},重启 App 后生效": "Updated to {0}; restart the app to apply",
232
+ "更新失败:{0}": "Update failed: {0}",
233
+ "正在更新…": "Updating…",
234
+ "现在有 {0} 个会话正在运行。更新会替换插件文件,那个会话可能在半路读到新旧混着的代码而报错。确定要继续,就再点一次「仍然更新」。": "{0} sessions are running now. Updating replaces plugin files, so a running session may read a mix of old and new code and fail. Click \"Update anyway\" again to continue.",
235
+ "HTTP {0}{1}": "HTTP {0}{1}",
236
+ ":": ":",
237
+ "没有返回操作 id": "No operation id returned",
238
+ "已更新{0}{1}": "Updated{0}{1}",
239
+ "到 ": " to ",
240
+ ",重启 App 后生效": ", restart the app to apply",
241
+ ",刷新页面即可生效": ", refresh the page to apply",
242
+ "这个版本刚发布,市场还要等几分钟才能装。过会儿再点一次「立即更新」就行。": "This version was just published; the marketplace needs a few minutes. Click \"Update now\" again shortly.",
243
+ "正在更新… {0}%": "Updating… {0}%",
244
+ "等待超时,请到插件市场查看结果": "Timed out waiting; check the result in the plugin marketplace",
245
+ "已启用": "Enabled",
246
+ "已停用": "Disabled",
247
+ "把对话区变成可分栏的工作区:多个会话并排,各自有输入框、工具调用和插件面板。": "Turns the chat area into a splittable workspace: several sessions side by side, each with its own input box, tool calls and plugin panels.",
248
+ "当前版本 {0}": "Version {0}",
249
+ "检查中…": "Checking…",
250
+ "检查更新": "Check for updates",
251
+ "插件市场": "Plugin marketplace",
252
+ "基本": "Basics",
253
+ "总开关与入口": "Master switch and entry",
254
+ "启用{0}": "Enable {0}",
255
+ "已启用:打开 App 直接进入工作区,点左侧会话替换当前标签。": "Enabled: the app opens straight into the workspace; click a session on the left to replace the current tab.",
256
+ "未启用:保持原生单栏对话界面。": "Disabled: keeps the native single-pane chat UI.",
257
+ "界面元素": "UI elements",
258
+ "每一栏里显示什么": "What each pane shows",
259
+ "显示会话头": "Show session header",
260
+ "已关闭:每栏不显示标题 / 标准模式 / 子智能体 / 右侧按钮那一行。": "Off: panes hide the row with title / standard mode / sub-agents / right-side buttons.",
261
+ "已开启:每栏顶部显示标题、标准模式、子智能体、右侧按钮那一行。": "On: panes show the title, standard mode, sub-agents and right-side buttons row at the top.",
262
+ "显示视图切换条": "Show view switcher bar",
263
+ "已关闭:每栏不显示「对话 / 轨迹 / 上下文 …」那一行。": "Off: panes hide the \"Chat / Trace / Context …\" row.",
264
+ "已开启:每栏显示「对话 / 轨迹 / 上下文 …」那一行。位置与显示哪些视图,见下面两项。": "On: panes show the \"Chat / Trace / Context …\" row. Position and which views appear are set in the next two items.",
265
+ "双击关闭标签": "Double-click to close tabs",
266
+ "已关闭:双击标签不关闭(中键、× 仍然可用)。": "Off: double-clicking a tab does not close it (middle-click and × still work).",
267
+ "已开启:双击标签直接关闭(中键、× 也可用)。": "On: double-clicking a tab closes it (middle-click and × also work).",
268
+ "在侧边栏显示入口": "Show entry in sidebar",
269
+ "已关闭:侧边栏不显示本插件入口。": "Off: the sidebar hides this plugin's entry.",
270
+ "已开启:侧边栏显示本插件入口(默认)。": "On: the sidebar shows this plugin's entry (default).",
271
+ "外观": "Appearance",
272
+ "颜色、粗细、呼吸": "Colors, thickness, pulse",
273
+ "鼠标移到任一组上,上方预览会高亮对应元素;每组可单独换色,也可全部跟随全局色。": "Hover any group to highlight it in the preview above; each group can take its own color or follow the global one.",
274
+ "怎么用": "How to use",
275
+ "点左侧会话,替换当前标签;把会话拖进标签栏可新开标签。": "Click a session on the left to replace the current tab; drag a session onto the tab bar to open a new tab.",
276
+ "把会话拖到两栏之间的分隔条上,会在那里拆出一栏。": "Drag a session onto the divider between two panes to split a new pane there.",
277
+ "标签支持中键关闭、双击关闭;右键可锁定,锁定后要先解锁才能关。": "Tabs close on middle-click or double-click; right-click locks a tab, and a locked tab must be unlocked before it closes.",
278
+ "布局和启用状态存在本机,升级插件或重启 App 后自动恢复。": "Layout and enabled state are stored locally and restored after plugin upgrades or app restarts.",
279
+ "备份与恢复": "Backup and restore",
280
+ "导出 / 导入设置文件": "Export / import settings file",
281
+ "回到会话(退出设置)": "Back to sessions (leave settings)",
282
+ "进入会话": "Go to sessions",
283
+ "更新完成": "Update complete",
284
+ "更新没有完成": "Update did not finish",
285
+ "当前版本": "Current version",
286
+ "新版本": "New version",
287
+ "检查时间": "Checked at",
288
+ "刷新页面": "Refresh page",
289
+ "稍后": "Later",
290
+ "立即更新": "Update now",
291
+ "重新检查": "Check again",
292
+ "插件市场 · 已安装": "Plugin marketplace · Installed",
293
+ "关闭": "Close",
294
+ "启用后,对话区会变成 Hermes 式工作区:顶部一条标签栏,可并排多个会话,每个会话都有独立输入框。": "Once enabled the chat area becomes a workspace: a tab bar on top, several sessions side by side, each with its own input box.",
295
+ "未启用(保持原生单栏对话)": "Disabled (keep the native single-pane chat)",
296
+ "要回到会话:点左侧栏的「多栏视图」,或直接关掉本设置页。完整的外观设置在「多栏视图」里。": "To get back to the sessions, click \"Multi-pane\" in the left sidebar, or simply close this settings page. Full appearance settings live in \"Multi-pane\".",
297
+ "解锁标签": "Unlock tab",
298
+ "锁定标签": "Lock tab"
299
+ };
300
+ function isZhLang(id) {
301
+ return typeof id !== "string" || id === "" ? true : id.toLowerCase().startsWith("zh");
302
+ }
303
+ /** 宿主当前语言 id;拿不到就按中文(本插件母语是中文)。 */
304
+ function hostLangId() {
305
+ try {
306
+ const locale = I18N.ctx?.get?.("locale");
307
+ const active = locale?.getSnapshot?.()?.active;
308
+ if (typeof active === "string" && active !== "") return active;
309
+ } catch {
310
+ /* 宿主没有 locale 服务时按中文 */
311
+ }
312
+ return I18N.lang;
313
+ }
314
+ /**
315
+ * 取一条文案。params 是数组时 {0} {1} 按下标替换;
316
+ * 中文界面原样返回(不做替换,模板本来就在调用处插好了值)。
317
+ */
318
+ function t(text, params) {
319
+ const raw = typeof text === "string" ? text : String(text === void 0 || text === null ? "" : text);
320
+ const base = isZhLang(I18N.lang) ? raw : typeof I18N_EN[raw] === "string" ? I18N_EN[raw] : raw;
321
+ if (params === void 0 || params === null || base.indexOf("{") < 0) return base;
322
+ return base.replace(/\{(\d+)\}/g, (all, index) => {
323
+ const value = Array.isArray(params) ? params[Number(index)] : params[index];
324
+ return value === void 0 || value === null ? all : String(value);
325
+ });
326
+ }
327
+ /** 插件显示名:侧栏入口标签用它,跟随界面语言。 */
328
+ function pluginName() {
329
+ return t(PLUGIN_LABEL);
330
+ }
331
+ /** 设置页标题:中英都给(用户要求标题常显双语,正文随语言)。 */
332
+ function pluginTitle() {
333
+ return "多栏视图 (Multi-pane)";
334
+ }
335
+ /**
336
+ * 宿主侧(lib/index.js 的自更新路由)回的是中文错误串,
337
+ * 英文界面下按前几条已知形状翻一遍;认不出的原样显示。
338
+ */
339
+ const HOST_MESSAGE_PATTERNS = [
340
+ [/^下载失败:([\s\S]+)$/, "Download failed: {0}"],
341
+ [/^解压失败:([\s\S]+)$/, "Extraction failed: {0}"],
342
+ [/^包里没有 package\.json$/, "The package has no package.json"],
343
+ [/^包内版本是 ([\s\S]+),不是 ([\s\S]+)$/, "Package version is {0}, not {1}"],
344
+ [/^已安装 ([\s\S]+)$/, "Installed {0}"],
345
+ [/^version 参数不合法$/, "Invalid version parameter"]
346
+ ];
347
+ function hostMessage(text) {
348
+ const raw = String(text === void 0 || text === null ? "" : text);
349
+ if (raw === "" || isZhLang(I18N.lang)) return raw;
350
+ for (const rule of HOST_MESSAGE_PATTERNS) {
351
+ const matched = raw.match(rule[0]);
352
+ if (matched !== null) return t(rule[1], matched.slice(1));
353
+ }
354
+ return raw;
355
+ }
356
+ /**
357
+ * 宿主自己在会话头里那颗「更多/更多操作」按钮的文案,各语言都认 ——
358
+ * 名称取自宿主 DOM 的 aria-label,按宿主当前语言渲染,所以不能只比中文。
359
+ */
360
+ const HOST_MORE_LABELS = ["更多操作", "更多", "More actions", "More"];
361
+ function isHostMoreLabel(label) {
362
+ if (typeof label !== "string") return false;
363
+ return HOST_MORE_LABELS.some((text) => label === text || label.indexOf(text) >= 0);
364
+ }
365
+ /** 把宿主语言抄进 I18N.lang,并让整棵界面重渲染(借 prefs 的订阅者)。 */
366
+ function syncLang() {
367
+ const id = hostLangId();
368
+ I18N.lang = typeof id === "string" && id !== "" ? id : "zh";
369
+ try {
370
+ prefs.setLang(I18N.lang);
371
+ } catch {
372
+ /* prefs 还没建好(极早期调用)就先只更新 I18N.lang */
373
+ }
374
+ }
375
+ //#endregion
22
376
  /**
23
377
  * 插件市场把自己注册成客户端服务 `market`(`ctx.provide("market", …)`),
24
378
  * 并提供 render() 用来把它的完整面板嵌进任何宿主界面。
@@ -575,13 +929,13 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
575
929
  * 第一版用 L≈45-52% + 45% 透明度绘制,实际渲染对比只有 1.7-2.1,偏暗 —— 已废弃。
576
930
  */
577
931
  const LINE_COLORS = [
578
- { id: "graphite", name: "石墨灰", hex: "#a7aaaf" },
579
- { id: "mist-blue", name: "雾蓝", hex: "#7dabd9" },
580
- { id: "jade", name: "青绿", hex: "#82d3c8" },
581
- { id: "grass", name: "草绿", hex: "#7dd989" },
582
- { id: "violet", name: "藕紫", hex: "#a27fd7" },
583
- { id: "rose", name: "雾玫", hex: "#d5819a" },
584
- { id: "amber", name: "琥珀", hex: "#dfc377" }
932
+ { id: "graphite", get name() { return t("石墨灰"); }, hex: "#a7aaaf" },
933
+ { id: "mist-blue", get name() { return t("雾蓝"); }, hex: "#7dabd9" },
934
+ { id: "jade", get name() { return t("青绿"); }, hex: "#82d3c8" },
935
+ { id: "grass", get name() { return t("草绿"); }, hex: "#7dd989" },
936
+ { id: "violet", get name() { return t("藕紫"); }, hex: "#a27fd7" },
937
+ { id: "rose", get name() { return t("雾玫"); }, hex: "#d5819a" },
938
+ { id: "amber", get name() { return t("琥珀"); }, hex: "#dfc377" }
585
939
  ];
586
940
  const LINE_COLOR_IDS = LINE_COLORS.map((item) => item.id);
587
941
  const DEFAULT_LINE_COLOR = "graphite";
@@ -589,10 +943,10 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
589
943
  /* 线宽档位。**只作用于分隔条、拖动预览虚线框、虚位标签边框**;
590
944
  标签下方的焦点线固定 2px,不跟这个档位走(用户明确要求)。 */
591
945
  const LINE_WIDTHS = [
592
- { id: "thin", name: "细", px: 1 },
593
- { id: "normal", name: "标准", px: 2 },
594
- { id: "bold", name: "粗", px: 3 },
595
- { id: "heavy", name: "很粗", px: 4 }
946
+ { id: "thin", get name() { return t("细"); }, px: 1 },
947
+ { id: "normal", get name() { return t("标准"); }, px: 2 },
948
+ { id: "bold", get name() { return t("粗"); }, px: 3 },
949
+ { id: "heavy", get name() { return t("很粗"); }, px: 4 }
596
950
  ];
597
951
  const LINE_WIDTH_IDS = LINE_WIDTHS.map((item) => item.id);
598
952
  const DEFAULT_LINE_WIDTH = "normal";
@@ -613,11 +967,11 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
613
967
  以前分隔条是硬编码 85%,只能改颜色不能改浓淡(2026-11-07 用户要求可调)。
614
968
  默认 85% 与旧外观一致,升级后不会突变。 */
615
969
  const LINE_OPACITIES = [
616
- { id: "faint", name: "很淡", alpha: 0.3 },
617
- { id: "soft", name: "偏淡", alpha: 0.5 },
618
- { id: "medium", name: "适中", alpha: 0.7 },
619
- { id: "strong", name: "标准", alpha: 0.85 },
620
- { id: "solid", name: "实色", alpha: 1 }
970
+ { id: "faint", get name() { return t("很淡"); }, alpha: 0.3 },
971
+ { id: "soft", get name() { return t("偏淡"); }, alpha: 0.5 },
972
+ { id: "medium", get name() { return t("适中"); }, alpha: 0.7 },
973
+ { id: "strong", get name() { return t("标准"); }, alpha: 0.85 },
974
+ { id: "solid", get name() { return t("实色"); }, alpha: 1 }
621
975
  ];
622
976
  const LINE_OPACITY_IDS = LINE_OPACITIES.map((item) => item.id);
623
977
 
@@ -748,7 +1102,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
748
1102
  if (typeof window.showSaveFilePicker === "function") {
749
1103
  const handle = await window.showSaveFilePicker({
750
1104
  suggestedName: name,
751
- types: [{ description: "JSON 设置文件", accept: { "application/json": [".json"] } }]
1105
+ types: [{ description: t("JSON 设置文件"), accept: { "application/json": [".json"] } }]
752
1106
  });
753
1107
  const writable = await handle.createWritable();
754
1108
  await writable.write(text);
@@ -778,13 +1132,13 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
778
1132
  try {
779
1133
  parsed = JSON.parse(String(text === null || text === void 0 ? "" : text));
780
1134
  } catch {
781
- throw new Error("不是有效的 JSON 文件");
1135
+ throw new Error(t("不是有效的 JSON 文件"));
782
1136
  }
783
- if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("文件内容不是设置对象");
1137
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error(t("文件内容不是设置对象"));
784
1138
  const src = parsed.prefs !== null && typeof parsed.prefs === "object" ? parsed.prefs : parsed;
785
1139
  const ignore = ["tag", "version", "exportedAt", "prefs", "showSettings"];
786
1140
  const keys = Object.keys(src).filter((k) => ignore.indexOf(k) < 0);
787
- if (keys.length === 0) throw new Error("文件里没有可识别的设置项");
1141
+ if (keys.length === 0) throw new Error(t("文件里没有可识别的设置项"));
788
1142
  /* 只接受已知字段,其余忽略:别让陌生键混进 state。 */
789
1143
  const known = ["enabled", "showInSidebar", "titlebarDrag", "lineColor", "lineWidth", "lineOpacity", "appearance", "dblclickClose", "viewBarPlacement", "viewBarOrder", "viewBarHidden", "hostBar"];
790
1144
  const patch = {};
@@ -794,7 +1148,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
794
1148
  patch[k] = src[k];
795
1149
  applied += 1;
796
1150
  }
797
- if (applied === 0) throw new Error("文件里的设置项都不认识(可能来自别的插件)");
1151
+ if (applied === 0) throw new Error(t("文件里的设置项都不认识(可能来自别的插件)"));
798
1152
  prefs.update(patch);
799
1153
  return applied;
800
1154
  }
@@ -1005,6 +1359,24 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
1005
1359
  };
1006
1360
  prefs.state = prefs.read();
1007
1361
 
1362
+ /**
1363
+ * 语言变了:换一个 state 引用,让所有 usePrefs 订阅者重渲染。
1364
+ * **不落 localStorage**(write() 的落盘白名单里没有 lang),
1365
+ * 否则切一次语言就会改一次偏好文件的语义。
1366
+ */
1367
+ prefs.setLang = function setLang(id) {
1368
+ if (prefs.state.lang === id) return;
1369
+ prefs.state = { ...prefs.state, lang: id };
1370
+ prefs.listeners.forEach((listener) => {
1371
+ try {
1372
+ listener();
1373
+ } catch {
1374
+ /* 某个订阅者坏了不影响其它 */
1375
+ }
1376
+ });
1377
+ };
1378
+ syncLang();
1379
+
1008
1380
  /**
1009
1381
  * 把「当前是否停在设置页」同步到 `<html data-dsv-settings>`。
1010
1382
  *
@@ -1122,19 +1494,12 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
1122
1494
  }
1123
1495
 
1124
1496
  /**
1125
- * 把插件留在页面上的**全部**痕迹清掉(插件关掉 / 卸载时调用)。
1126
- *
1127
- * 三样都要清,少一样就会「关掉了但样式还在」:
1128
- * ① 样式表本身 —— 里面有 [data-row-key^="session:"]:not([data-dsv-row]) * { opacity: .5 },
1129
- * 这条**不需要任何行标记**,只要 style 还在,所有会话行的文字就一直是暗的;
1130
- * ② <html> 上的 --dsv-* 变量(43 个)—— 宿主侧栏行读的就是它们;
1131
- * ③ 行上的 data-dsv-row / data-dsv-pulse 与复用来的 _selected class。
1497
+ * 清掉我们写在宿主 <html> 上的 --dsv-* 变量(43 个)。
1498
+ * 宿主侧栏行读的就是它们,插件不启用时不该留在页面上。
1132
1499
  */
1133
- function clearAllDsvState() {
1500
+ function clearLineVars() {
1134
1501
  try {
1135
1502
  const el = document.documentElement;
1136
- const style = document.getElementById(STYLE_ID);
1137
- if (style !== null) style.remove();
1138
1503
  const names = [];
1139
1504
  for (let index = 0; index < el.style.length; index += 1) {
1140
1505
  const name = el.style.item(index);
@@ -1142,6 +1507,19 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
1142
1507
  }
1143
1508
  for (const name of names) el.style.removeProperty(name);
1144
1509
  el.removeAttribute("data-dsv-settings");
1510
+ } catch {
1511
+ /* 非浏览器环境 */
1512
+ }
1513
+ }
1514
+
1515
+ /**
1516
+ * 清掉宿主会话行上的标记(data-dsv-row / data-dsv-pulse / 复用来的 _selected)。
1517
+ *
1518
+ * 这是「关掉插件后会话列表还带着我们的样子」的总开关:样式表里所有作用于宿主侧栏的
1519
+ * 规则都挂在 [data-dsv-row] / [data-dsv-pulse] 上,标记一清,普通行立刻回官方样式。
1520
+ */
1521
+ function clearHostMarks() {
1522
+ try {
1145
1523
  for (const row of document.querySelectorAll("[data-dsv-row]")) row.removeAttribute("data-dsv-row");
1146
1524
  for (const row of document.querySelectorAll("[data-dsv-pulse]")) row.removeAttribute("data-dsv-pulse");
1147
1525
  for (const row of document.querySelectorAll('[data-row-key^="session:"]')) {
@@ -1154,6 +1532,22 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
1154
1532
  }
1155
1533
  }
1156
1534
 
1535
+ /**
1536
+ * 把插件留在页面上的**全部**痕迹清掉(卸载 / 关闭应用时调用)。
1537
+ * 插件只是「停用」时不走这里:那时只清行标记与根上变量,样式表留着 ——
1538
+ * 删掉它会让正开着的设置页闪一帧白板,重新启用也要等下一拍才补回来。
1539
+ */
1540
+ function clearAllDsvState() {
1541
+ try {
1542
+ const style = document.getElementById(STYLE_ID);
1543
+ if (style !== null) style.remove();
1544
+ } catch {
1545
+ /* 非浏览器环境 */
1546
+ }
1547
+ clearLineVars();
1548
+ clearHostMarks();
1549
+ }
1550
+
1157
1551
  /**
1158
1552
  * 让 `prefs.showSettings` 始终等于「当前面板是不是我们的设置页」。
1159
1553
  *
@@ -1222,11 +1616,11 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
1222
1616
  const pulse = (prefs.state.appearance ?? DEFAULT_APPEARANCE()).pulse;
1223
1617
  if (pulse === void 0 || pulse.enabled !== true) return false;
1224
1618
  if (prevRunning.ids.has(id) !== true) return false;
1225
- const t = pulse.targets ?? {};
1226
- if (mark === "focus") return t.active === true;
1227
- if (mark === "open") return t.openShown === true;
1228
- if (mark === "open-hidden") return t.openHidden === true;
1229
- return t.unopened === true;
1619
+ const targets = pulse.targets ?? {};
1620
+ if (mark === "focus") return targets.active === true;
1621
+ if (mark === "open") return targets.openShown === true;
1622
+ if (mark === "open-hidden") return targets.openHidden === true;
1623
+ return targets.unopened === true;
1230
1624
  }
1231
1625
  function applyPulseAttr(row, mark, id) {
1232
1626
  if (shouldPulse(mark, id)) {
@@ -1304,12 +1698,28 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
1304
1698
  let scheduled = false;
1305
1699
  const tick = () => {
1306
1700
  scheduled = false;
1701
+ /* 样式表 id 是全局唯一的。宿主热更新会同时跑新旧两份插件代码,
1702
+ 旧的一份可能还在删这张表 —— 每拍检查一次,缺了就补回来。 */
1703
+ if (
1704
+ (prefs.state.enabled === true || prefs.state.showSettings === true ||
1705
+ document.querySelector(".dsv-settings") !== null) &&
1706
+ document.getElementById(STYLE_ID) === null
1707
+ ) {
1708
+ installStyles();
1709
+ }
1307
1710
  /* 插件关掉后必须**停手并清掉标记**,否则会话列表还带着插件的高亮,
1308
1711
  但主区域已经还给宿主了 —— 两边对不上,用户看起来就是「关不掉」。 */
1309
1712
  if (prefs.state.enabled !== true) {
1310
- /* 样式表还在 = 还没清过(宿主重渲染会重建行,所以每次都清也没问题:
1311
- querySelectorAll 在没有标记时几乎零成本)。 */
1312
- if (document.getElementById(STYLE_ID) !== null) clearAllDsvState();
1713
+ /* 停用后跑的这一支:行标记每拍都清(宿主重渲染会重建行),
1714
+ 会话列表立刻回到官方样式;样式表本身**不能删** ——
1715
+ 设置页可能正开着,删了就会闪一帧白板,重新启用也得等下一拍。 */
1716
+ clearHostMarks();
1717
+ if (prefs.state.showSettings === true || document.querySelector(".dsv-settings") !== null) {
1718
+ if (document.getElementById(STYLE_ID) === null) installStyles();
1719
+ return;
1720
+ }
1721
+ /* 真的离开设置页了:连根上的 --dsv-* 变量一起清掉。 */
1722
+ clearLineVars();
1313
1723
  return;
1314
1724
  }
1315
1725
  try {
@@ -1318,8 +1728,17 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
1318
1728
  /* 忽略 */
1319
1729
  }
1320
1730
  };
1321
- /* 心跳:处理「状态自己变了」(焦点栏换标签、切栏等),这类变化不伴随 DOM 结构变动。 */
1322
- setInterval(tick, 700);
1731
+ /* 心跳:处理「状态自己变了」(焦点栏换标签、切栏等),这类变化不伴随 DOM 结构变动。
1732
+ 全局只留一个:apply() 每执行一次就会新建一条 interval,热更新/重载后旧的那条
1733
+ 没人清 —— 两条心跳各按各的 prefs 做「删样式 / 补样式」,页面就会来回闪。 */
1734
+ if (globalThis.__dsvMarksTimer !== void 0) {
1735
+ try {
1736
+ clearInterval(globalThis.__dsvMarksTimer);
1737
+ } catch {
1738
+ /* 忽略 */
1739
+ }
1740
+ }
1741
+ globalThis.__dsvMarksTimer = setInterval(tick, 700);
1323
1742
  /* 即时:宿主重渲染侧栏、行节点被重建时,新节点上没有标记 ——
1324
1743
  在同一个微任务里补,用户看不到裸形态那一帧。
1325
1744
  只观察 childList(节点增删);**不观察 attributes**:
@@ -1681,13 +2100,15 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
1681
2100
  焦点 = 3px 75% 左条 + 15% 底;已打开 = 2px 52% 左条 + 6% 底;未打开 = 无色。
1682
2101
  浓度压得很低,不抢注意力。 */
1683
2102
  [data-row-key^="session:"][data-dsv-row="open"]{background-clip:border-box!important;background-origin:border-box!important;background-color:var(--dsv-row-open-bg,rgba(167,170,175,.06))!important;background-image:linear-gradient(to right,var(--dsv-row-open-a,rgba(167,170,175,.52)) 0,var(--dsv-row-open-a,rgba(167,170,175,.52)) var(--dsv-row-w-open,2px),transparent var(--dsv-row-w-open,2px))!important;box-shadow:none!important;font-weight:400}
1684
- [data-row-key^="session:"][data-dsv-row="open"] *{opacity:.70}
2103
+ /* 已打开的会话行只换底色 + 左竖线,**不压文字透明度**:
2104
+ 以前这里写 *{opacity:.70},把行内的悬浮操作按钮也一起压暗了,按钮根本看不见。 */
1685
2105
  /* 已打开但**没有显示**(在标签里、不是当前激活标签):与「打开显示」同一套底色/文字,
1686
2106
  只是默认不画左竖线 —— 一眼能分出"这个开过但没在屏幕上"。 */
1687
2107
  [data-row-key^="session:"][data-dsv-row="open-hidden"]{background-clip:border-box!important;background-origin:border-box!important;background-color:var(--dsv-row-open-bg,rgba(167,170,175,.06))!important;background-image:var(--dsv-row-hidden-bar,none)!important;box-shadow:none!important;font-weight:400}
1688
- [data-row-key^="session:"][data-dsv-row="open-hidden"] *{opacity:.70}
1689
- /* 未打开的会话行:明显更暗更素,让"已打开"一眼跳出来 */
1690
- [data-row-key^="session:"]:not([data-dsv-row]) *{opacity:.50}
2108
+ /* 未打开的会话行(也就是绝大多数普通行):**一点都不要动**。
2109
+ 以前这里是 [data-row-key^="session:"]:not([data-dsv-row]) *{opacity:.50},
2110
+ 等于给所有普通行盖了一层蒙版 —— 置顶的行看不见、鼠标悬浮出来的操作按钮也看不见。
2111
+ 现在只有 data-dsv-row="focus"/"open"/"open-hidden" 的行有特殊样式。 */
1691
2112
  /* ── 运行中呼吸(2026-11-09 用户要求)──────────────────────────
1692
2113
  数据源:宿主 session.list 里的 row.running(官方状态,不猜)。
1693
2114
  呼吸的是**整行底色(底板)**;左竖线、文字、官方状态圆圈全部不动。
@@ -1922,9 +2343,9 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
1922
2343
  .dsv-pv-row[data-state="focus"]{background-color:var(--dsv-row-focus-bg,rgba(167,170,175,.15));background-image:linear-gradient(to right,var(--dsv-row-focus-a,rgba(167,170,175,.75)) 0,var(--dsv-row-focus-a,rgba(167,170,175,.75)) var(--dsv-row-w-focus,3px),transparent var(--dsv-row-w-focus,3px));font-weight:var(--dsv-row-fw,400)}
1923
2344
  /* 预览的文字亮度必须跟真实侧栏一致:真实侧栏是 [data-dsv-row] * { opacity }(只压子元素、不压底色),
1924
2345
  所以预览也只能压文字颜色,绝不能在行容器上写 opacity —— 否则呼吸底色被一并乘小,看着比别的状态暗。 */
1925
- .dsv-pv-row[data-state="open"]{background-color:var(--dsv-row-open-bg,rgba(167,170,175,.06));background-image:linear-gradient(to right,var(--dsv-row-open-a,rgba(167,170,175,.52)) 0,var(--dsv-row-open-a,rgba(167,170,175,.52)) var(--dsv-row-w-open,2px),transparent var(--dsv-row-w-open,2px));color:color-mix(in srgb,var(--dsh-text-strong-color,#e8eefc) 70%,transparent)}
1926
- .dsv-pv-row[data-state="open-hidden"]{background-color:var(--dsv-row-open-bg,rgba(167,170,175,.06));background-image:var(--dsv-row-hidden-bar,none);color:color-mix(in srgb,var(--dsh-text-strong-color,#e8eefc) 70%,transparent)}
1927
- .dsv-pv-row[data-state="none"],.dsv-pv-row:not([data-state]){color:color-mix(in srgb,var(--dsh-text-strong-color,#e8eefc) calc(var(--dsv-row-dim,.5) * 100%),transparent)}
2346
+ .dsv-pv-row[data-state="open"]{background-color:var(--dsv-row-open-bg,rgba(167,170,175,.06));background-image:linear-gradient(to right,var(--dsv-row-open-a,rgba(167,170,175,.52)) 0,var(--dsv-row-open-a,rgba(167,170,175,.52)) var(--dsv-row-w-open,2px),transparent var(--dsv-row-w-open,2px))}
2347
+ .dsv-pv-row[data-state="open-hidden"]{background-color:var(--dsv-row-open-bg,rgba(167,170,175,.06));background-image:var(--dsv-row-hidden-bar,none)}
2348
+ /* 普通行(未打开)在预览里也不要压暗:真实侧栏已经不再压暗,两边必须一致。 */
1928
2349
  .dsv-pv-main{flex:1 1 auto;min-width:0;display:flex;align-items:stretch;border-radius:6px;overflow:hidden;background:rgba(255,255,255,.02)}
1929
2350
  .dsv-pv-pane{flex:1 1 0;min-width:0;display:flex;flex-direction:column;position:relative}
1930
2351
  .dsv-pv-tabs{display:flex;align-items:center;gap:2px;padding:4px 4px 0;min-height:26px}
@@ -2007,6 +2428,10 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
2007
2428
 
2008
2429
  `;
2009
2430
 
2431
+ /* 模块一加载就把样式表装上。以前只在 apply() 里装,而宿主画设置页那一帧
2432
+ 可能比 apply() 早 —— 于是先闪一帧「没有样式的白板页」,再跳到正常样式。 */
2433
+ installStyles();
2434
+
2010
2435
  /**
2011
2436
  * Install the stylesheet once per document.
2012
2437
  */
@@ -2681,7 +3106,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
2681
3106
  render() {
2682
3107
  if (this.state.error !== null) {
2683
3108
  const message = this.state.error?.message ?? String(this.state.error);
2684
- return h("div", { className: "dsv-empty" }, `该标签页渲染失败:${message}`);
3109
+ return h("div", { className: "dsv-empty" }, t("该标签页渲染失败:{0}", [message]));
2685
3110
  }
2686
3111
  return this.props.children;
2687
3112
  }
@@ -2713,7 +3138,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
2713
3138
  return h(
2714
3139
  "div",
2715
3140
  { className: "dsv-empty" },
2716
- h("div", null, `多栏视图渲染失败:${message}`),
3141
+ h("div", null, t("多栏视图渲染失败:{0}", [message])),
2717
3142
  h(
2718
3143
  "button",
2719
3144
  {
@@ -2728,7 +3153,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
2728
3153
  }
2729
3154
  }
2730
3155
  },
2731
- "回到单栏视图"
3156
+ t("回到单栏视图")
2732
3157
  )
2733
3158
  );
2734
3159
  }
@@ -2783,7 +3208,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
2783
3208
  return null;
2784
3209
  }, []);
2785
3210
 
2786
- if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-empty" }, "这个版本没有提供会话内容区域");
3211
+ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-empty" }, t("这个版本没有提供会话内容区域"));
2787
3212
 
2788
3213
  // A blank tab is the host's own "new session" page: the content factory
2789
3214
  // rendered with no session in scope, which is exactly what the native
@@ -2795,11 +3220,11 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
2795
3220
  renderFactorySlot(CONTENT_FACTORY, { variant: "embedded", phase: "hero", hero: true })
2796
3221
  );
2797
3222
  }
2798
- if (sessions === void 0) return h("div", { className: "dsv-empty" }, "sessions 服务不可用");
3223
+ if (sessions === void 0) return h("div", { className: "dsv-empty" }, t("sessions 服务不可用"));
2799
3224
  if (reference === void 0) {
2800
- return h("div", { className: "dsv-empty" }, status === "pending" ? "正在打开会话…" : "该会话暂时没有可用的绑定");
3225
+ return h("div", { className: "dsv-empty" }, status === "pending" ? t("正在打开会话…") : t("该会话暂时没有可用的绑定"));
2801
3226
  }
2802
- if (typeof SessionProvider !== "function") return h("div", { className: "dsv-empty" }, "这个版本没有提供会话上下文");
3227
+ if (typeof SessionProvider !== "function") return h("div", { className: "dsv-empty" }, t("这个版本没有提供会话上下文"));
2803
3228
 
2804
3229
  /* Why the host's own header is not rendered here (2026-11-07 调查结论):
2805
3230
  宿主的会话头是 `conversation.header`,它由 `main.conversation` 那个面板条目
@@ -3186,10 +3611,12 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3186
3611
  /* 只接受落在栏内的投放。落在侧栏 / 底栏(正常不会有 drop 事件)一律丢弃,
3187
3612
  不做「兜底给焦点栏」—— 用户要的是「只能拖到显示区」。 */
3188
3613
  if (paneId === null || files.length === 0) return;
3189
- event.preventDefault();
3190
- event.stopPropagation();
3191
3614
  const intake = PANE_INTAKE.get(paneId);
3615
+ /* 没有可用的接收者(比如这一栏的输入框还没挂上)就**让宿主自己处理**,
3616
+ 绝不 preventDefault/stopPropagation 之后什么都不做 —— 那等于把文件吞掉。 */
3192
3617
  if (typeof intake !== "function") return;
3618
+ event.preventDefault();
3619
+ event.stopPropagation();
3193
3620
  try {
3194
3621
  intake(files);
3195
3622
  } catch (error) {
@@ -3296,8 +3723,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3296
3723
  actions.closeTab(paneId, tabId);
3297
3724
  };
3298
3725
  const hint = locked
3299
- ? `${label} — 已锁定(右键解锁后才能关闭)`
3300
- : `${label} — ${dblclickClose ? "双击或中键关闭" : "中键关闭"}(右键可锁定)`;
3726
+ ? t("{0} — 已锁定(右键解锁后才能关闭)", [label])
3727
+ : t("{0} — {1}(右键可锁定)", [label, dblclickClose ? t("双击或中键关闭") : t("中键关闭")]);
3301
3728
  return h(
3302
3729
  "div",
3303
3730
  {
@@ -3370,8 +3797,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3370
3797
  {
3371
3798
  type: "button",
3372
3799
  className: "dsv-tab-close",
3373
- title: "关闭标签",
3374
- "aria-label": `关闭 ${label}`,
3800
+ title: t("关闭标签"),
3801
+ "aria-label": t("关闭 {0}", [label]),
3375
3802
  onClick: (event) => {
3376
3803
  event.stopPropagation();
3377
3804
  event.preventDefault();
@@ -3470,10 +3897,10 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3470
3897
  const tabLabels = pane.tabs.map((tab) => {
3471
3898
  const row = tab.sessionId === null ? void 0 : rowMap.get(tab.sessionId);
3472
3899
  return tab.sessionId === null || row?.blank === true
3473
- ? "新会话"
3900
+ ? t("新会话")
3474
3901
  : row === void 0
3475
- ? "已失效会话"
3476
- : rowLabel(row) || "未命名会话";
3902
+ ? t("已失效会话")
3903
+ : rowLabel(row) || t("未命名会话");
3477
3904
  });
3478
3905
  /* 这一标签会不会画状态点,判据必须与下面 runState 完全一致(同一个函数算两次会漂):
3479
3906
  焦点栏的激活标签不画点;其余看宿主给的状态。 */
@@ -3697,9 +4124,9 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3697
4124
  : null,
3698
4125
  // 松手预览:这一栏会多出一个标签(不会新开栏)。
3699
4126
  hover !== null && hover.kind === "tab"
3700
- ? h("span", { className: "dsv-tab", "data-ghost": "1", key: "ghost-tab" }, "松手:加到这一栏")
4127
+ ? h("span", { className: "dsv-tab", "data-ghost": "1", key: "ghost-tab" }, t("松手:加到这一栏"))
3701
4128
  : hover !== null && hover.kind === "limit"
3702
- ? h("span", { className: "dsv-tab dsv-limit", key: "limit-tab" }, `最多 ${MAX_PANES} 栏`)
4129
+ ? h("span", { className: "dsv-tab dsv-limit", key: "limit-tab" }, t("最多 {0} 栏", [MAX_PANES]))
3703
4130
  : null
3704
4131
  ),
3705
4132
  h(
@@ -3707,8 +4134,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3707
4134
  {
3708
4135
  type: "button",
3709
4136
  className: "dsv-btn",
3710
- title: "新建标签",
3711
- "aria-label": "新建标签",
4137
+ title: t("新建标签"),
4138
+ "aria-label": t("新建标签"),
3712
4139
  onClick: () => actions.newTab(pane.id)
3713
4140
  },
3714
4141
  "+"
@@ -3939,7 +4366,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3939
4366
  (用户要求:切换条在底部时搬到最底那行的左侧,统计信息挪右边)。 */
3940
4367
  // 松手前就把结果画出来:这一侧会出现一栏、占一半宽。
3941
4368
  hover !== null && hover.kind === "split" ? h(DropPreview, { side: hover.side }) : null,
3942
- hover !== null && hover.kind === "limit" ? h("div", { className: "dsv-limit-toast" }, `最多支持 ${MAX_PANES} 栏`) : null
4369
+ hover !== null && hover.kind === "limit" ? h("div", { className: "dsv-limit-toast" }, t("最多支持 {0} 栏", [MAX_PANES])) : null
3943
4370
  );
3944
4371
  }
3945
4372
 
@@ -3959,7 +4386,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3959
4386
  h("span", { style: { width: "30px" }, "data-new": side === "left" ? "1" : "0" }),
3960
4387
  h("span", { style: { width: side === "left" ? "54px" : "30px" }, "data-new": side === "right" ? "1" : "0" })
3961
4388
  ),
3962
- h("span", { className: "dsv-droppreview-label" }, side === "left" ? "松手:在这一栏左侧新开一栏" : "松手:在这一栏右侧新开一栏")
4389
+ h("span", { className: "dsv-droppreview-label" }, side === "left" ? t("松手:在这一栏左侧新开一栏") : t("松手:在这一栏右侧新开一栏"))
3963
4390
  );
3964
4391
  }
3965
4392
 
@@ -4009,19 +4436,19 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
4009
4436
  const rounds = (Array.isArray(questions.settled) ? questions.settled.length : 0) + (Array.isArray(questions.active) ? questions.active.length : 0);
4010
4437
  if (!hasDock) {
4011
4438
  // Fallback(空白页 / 该会话还没挂上宿主统计行时):用 projection 里的数字顶着。
4012
- if (rounds > 0) items.push(h("span", { className: "dsv-stat", key: "rounds" }, h("span", { className: "dsv-stat-label" }, "轮次"), h("span", null, String(rounds))));
4439
+ if (rounds > 0) items.push(h("span", { className: "dsv-stat", key: "rounds" }, h("span", { className: "dsv-stat-label" }, t("轮次")), h("span", null, String(rounds))));
4013
4440
  const uncached = usage.uncachedInputTokens ?? 0;
4014
4441
  const cached = usage.cacheReadTokens ?? 0;
4015
4442
  const used = uncached + cached + (usage.outputTokens ?? 0);
4016
- if (used > 0) items.push(h("span", { className: "dsv-stat", key: "use" }, h("span", { className: "dsv-stat-label" }, "用量"), h("span", null, `${formatTokens(used)} tok`)));
4443
+ if (used > 0) items.push(h("span", { className: "dsv-stat", key: "use" }, h("span", { className: "dsv-stat-label" }, t("用量")), h("span", null, `${formatTokens(used)} tok`)));
4017
4444
  if (cached > 0 && uncached + cached > 0) {
4018
4445
  const rate = Math.round((cached / (cached + uncached)) * 100);
4019
- items.push(h("span", { className: "dsv-stat", key: "cache" }, h("span", { className: "dsv-stat-label" }, "缓存命中"), h("span", null, `${rate}%`)));
4446
+ items.push(h("span", { className: "dsv-stat", key: "cache" }, h("span", { className: "dsv-stat-label" }, t("缓存命中")), h("span", null, `${rate}%`)));
4020
4447
  }
4021
4448
  }
4022
4449
  const spent = formatDuration(timing.settledMs);
4023
- if (spent !== "") items.push(h("span", { className: "dsv-stat", key: "time" }, h("span", { className: "dsv-stat-label" }, "智能体"), h("span", null, spent)));
4024
- if (items.length === 0 && !hasDock) items.push(h("span", { className: "dsv-stat", key: "hint" }, "没有可用的统计"));
4450
+ if (spent !== "") items.push(h("span", { className: "dsv-stat", key: "time" }, h("span", { className: "dsv-stat-label" }, t("智能体")), h("span", null, spent)));
4451
+ if (items.length === 0 && !hasDock) items.push(h("span", { className: "dsv-stat", key: "hint" }, t("没有可用的统计")));
4025
4452
 
4026
4453
  /* 底栏布局随视图切换条的位置变(用户口径 2026-11-08):
4027
4454
  · 切换条在「顶部」 → 底栏保持原样,统计信息**居中**
@@ -4915,7 +5342,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
4915
5342
  window.clearTimeout(t2);
4916
5343
  };
4917
5344
  }, [measure]);
4918
- const label = open ? "收起右侧边栏" : "打开右侧边栏";
5345
+ const label = open ? t("收起右侧边栏") : t("打开右侧边栏");
4919
5346
  return h(
4920
5347
  "button",
4921
5348
  {
@@ -5011,7 +5438,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5011
5438
  /* 宿主的「更多操作」永远被收进我们这颗「⋯」(否则界面上会有两个"更多"),
5012
5439
  所以它不计入「一行需要多宽」—— 否则每栏都白算一颗按钮的宽度,
5013
5440
  明明放得下也会被判成两行。 */
5014
- if (label.indexOf("更多操作") >= 0) continue;
5441
+ if (isHostMoreLabel(label)) continue;
5015
5442
  fullNeed += r.width + 6;
5016
5443
  }
5017
5444
  if (fullNeed > 0 && typeof needRef.current === "function") needRef.current(Math.round(fullNeed));
@@ -5030,7 +5457,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5030
5457
  /* 用户口径:「右边那一组最多有一个菜单」—— 宿主自己的「更多操作」
5031
5458
  必须永远收进我们这个菜单,否则界面上会同时出现两个"更多"。
5032
5459
  (实测就是两个「更多操作」并排,用户一眼就看出来了。) */
5033
- const isHostMore = label === "更多操作" || label.indexOf("更多操作") >= 0;
5460
+ const isHostMore = isHostMoreLabel(label);
5034
5461
  const need = rect.width + 6;
5035
5462
  if (isHostMore === true || used + need > avail + 1) {
5036
5463
  entry.style.display = "none";
@@ -5071,8 +5498,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5071
5498
  {
5072
5499
  type: "button",
5073
5500
  className: "dsv-btn",
5074
- title: "更多",
5075
- "aria-label": "更多",
5501
+ title: t("更多"),
5502
+ "aria-label": t("更多"),
5076
5503
  "aria-haspopup": "menu",
5077
5504
  "aria-expanded": open ? "true" : "false",
5078
5505
  onClick: (event) => {
@@ -5094,7 +5521,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5094
5521
  ? void 0
5095
5522
  : { position: "fixed", left: `${pos.left}px`, top: `${pos.top}px`, zIndex: 90 }
5096
5523
  },
5097
- h("div", { className: "dsv-vmenu-head" }, "更多"),
5524
+ h("div", { className: "dsv-vmenu-head" }, t("更多")),
5098
5525
  ...items.map((item) =>
5099
5526
  h(
5100
5527
  "button",
@@ -5357,7 +5784,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5357
5784
  h(
5358
5785
  "div",
5359
5786
  { className: "dsv-viewtabs", role: "tablist", ref: rowRef },
5360
- visible.length === 0 && overflow.length === 0 ? h("span", { className: "dsv-viewempty" }, "暂无可用视图") : null,
5787
+ visible.length === 0 && overflow.length === 0 ? h("span", { className: "dsv-viewempty" }, t("暂无可用视图")) : null,
5361
5788
  ...visible.map((tab) =>
5362
5789
  h(
5363
5790
  "button",
@@ -5382,10 +5809,10 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5382
5809
  type: "button",
5383
5810
  className: "dsv-vmore",
5384
5811
  "data-active": activeInOverflow ? "1" : "0",
5385
- "aria-label": "更多会话视图",
5812
+ "aria-label": t("更多会话视图"),
5386
5813
  "aria-haspopup": "menu",
5387
5814
  "aria-expanded": menuOpen ? "true" : "false",
5388
- title: "更多会话视图",
5815
+ title: t("更多会话视图"),
5389
5816
  onClick: (event) => {
5390
5817
  const r = event.currentTarget.getBoundingClientRect();
5391
5818
  const up = placement === "bottom";
@@ -5419,7 +5846,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5419
5846
  : { position: "fixed", left: `${menuPos.left}px`, top: menuPos.top === void 0 ? "auto" : `${menuPos.top}px`, bottom: menuPos.bottom === void 0 ? "auto" : `${menuPos.bottom}px` }
5420
5847
 
5421
5848
  },
5422
- h("div", { className: "dsv-vmenu-head" }, "更多会话视图"),
5849
+ h("div", { className: "dsv-vmenu-head" }, t("更多会话视图")),
5423
5850
  ...overflow.map((tab) =>
5424
5851
  h(
5425
5852
  "button",
@@ -5475,7 +5902,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5475
5902
  };
5476
5903
  const reset = () => prefs.update({ viewBarOrder: [], viewBarHidden: [] });
5477
5904
 
5478
- const PLACEMENT_LABEL = { off: "不显示", top: "顶部", bottom: "底部" };
5905
+ const PLACEMENT_LABEL = { off: t("不显示"), top: t("顶部"), bottom: t("底部") };
5479
5906
 
5480
5907
  return [
5481
5908
  h(
@@ -5484,16 +5911,16 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5484
5911
  h(
5485
5912
  "div",
5486
5913
  { className: "dsv-card-text" },
5487
- h("div", { className: "dsv-card-title" }, "会话视图切换条"),
5914
+ h("div", { className: "dsv-card-title" }, t("会话视图切换条")),
5488
5915
  h(
5489
5916
  "div",
5490
5917
  { className: "dsv-card-desc" },
5491
- "每栏顶部(或底部)那一行视图切换条。内容自动跟随应用当前的视图列表,不写死任何一项;装了新插件、或插件新增了视图,会自动出现。下面每一项可单独开关、上下排序。"
5918
+ t("每栏顶部(或底部)那一行视图切换条。内容自动跟随应用当前的视图列表,不写死任何一项;装了新插件、或插件新增了视图,会自动出现。下面每一项可单独开关、上下排序。")
5492
5919
  )
5493
5920
  ),
5494
5921
  h(
5495
5922
  "div",
5496
- { className: "dsv-swatches", role: "radiogroup", "aria-label": "视图切换条位置" },
5923
+ { className: "dsv-swatches", role: "radiogroup", "aria-label": t("视图切换条位置") },
5497
5924
  /* 用户口径 2026-11-08:位置里不再提供「不显示」—— 关掉切换条由上面那个独立开关负责
5498
5925
  (它内部仍用 viewBarPlacement="off" 表示关闭)。当前处于 off 时选中态按「顶部」显示,
5499
5926
  免得两个按钮都不高亮。 */
@@ -5523,18 +5950,18 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5523
5950
  h(
5524
5951
  "div",
5525
5952
  { className: "dsv-card-text" },
5526
- h("div", { className: "dsv-card-title" }, "显示哪些视图、什么顺序"),
5953
+ h("div", { className: "dsv-card-title" }, t("显示哪些视图、什么顺序")),
5527
5954
  h(
5528
5955
  "div",
5529
5956
  { className: "dsv-card-desc" },
5530
- `共发现 ${tabs.length} 个已注册视图。关掉的会被收进「…」按钮,点开还能选;顺序决定它们在条上的先后。`
5957
+ t("共发现 {0} 个已注册视图。关掉的会被收进「…」按钮,点开还能选;顺序决定它们在条上的先后。", [tabs.length])
5531
5958
  )
5532
5959
  ),
5533
5960
  h(
5534
5961
  "div",
5535
5962
  { className: "dsv-viewlist", role: "list" },
5536
5963
  all.length === 0
5537
- ? h("div", { className: "dsv-viewlist-empty" }, "暂无可用视图。")
5964
+ ? h("div", { className: "dsv-viewlist-empty" }, t("暂无可用视图。"))
5538
5965
  : all.map((tab, index) =>
5539
5966
  h(
5540
5967
  "div",
@@ -5545,21 +5972,21 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5545
5972
  role: "switch",
5546
5973
  "aria-checked": isHidden(tab.id) ? "false" : "true",
5547
5974
  "data-on": isHidden(tab.id) ? "0" : "1",
5548
- title: isHidden(tab.id) ? "点击显示" : "点击隐藏(收进「…」)",
5975
+ title: isHidden(tab.id) ? t("点击显示") : t("点击隐藏(收进「…」)"),
5549
5976
  onClick: () => toggle(tab.id),
5550
- "aria-label": `显示 ${tab.label}`
5977
+ "aria-label": t("显示 {0}", [tab.label])
5551
5978
  }),
5552
5979
  h("span", { className: "dsv-viewname" }, tab.label),
5553
5980
  h("span", { className: "dsv-viewid" }, tab.id),
5554
5981
  h("span", { className: "dsv-viewmove" },
5555
- h("button", { type: "button", className: "dsv-viewarrow", disabled: index === 0 ? "disabled" : void 0, title: "上移", "aria-label": `上移 ${tab.label}`, onClick: () => move(tab.id, -1) }, "↑"),
5556
- h("button", { type: "button", className: "dsv-viewarrow", disabled: index === all.length - 1 ? "disabled" : void 0, title: "下移", "aria-label": `下移 ${tab.label}`, onClick: () => move(tab.id, 1) }, "↓")
5982
+ h("button", { type: "button", className: "dsv-viewarrow", disabled: index === 0 ? "disabled" : void 0, title: t("上移"), "aria-label": t("上移 {0}", [tab.label]), onClick: () => move(tab.id, -1) }, "↑"),
5983
+ h("button", { type: "button", className: "dsv-viewarrow", disabled: index === all.length - 1 ? "disabled" : void 0, title: t("下移"), "aria-label": t("下移 {0}", [tab.label]), onClick: () => move(tab.id, 1) }, "↓")
5557
5984
  )
5558
5985
  )
5559
5986
  )
5560
5987
  ),
5561
5988
  order.length > 0 || hidden.length > 0
5562
- ? h("button", { type: "button", className: "dsv-linkbtn", onClick: reset }, "恢复默认顺序与显示")
5989
+ ? h("button", { type: "button", className: "dsv-linkbtn", onClick: reset }, t("恢复默认顺序与显示"))
5563
5990
  : null
5564
5991
  )
5565
5992
  ];
@@ -5690,7 +6117,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5690
6117
  max: String(props.max),
5691
6118
  step: String(props.step ?? 1),
5692
6119
  value: String(props.valueMin),
5693
- "aria-label": `${props.label} 最暗`,
6120
+ "aria-label": t("{0} 最暗", [props.label]),
5694
6121
  onChange: (event) => props.onChange(Number(event.target.value), props.valueMax)
5695
6122
  }),
5696
6123
  h("input", {
@@ -5700,7 +6127,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5700
6127
  max: String(props.max),
5701
6128
  step: String(props.step ?? 1),
5702
6129
  value: String(props.valueMax),
5703
- "aria-label": `${props.label} 最亮`,
6130
+ "aria-label": t("{0} 最亮", [props.label]),
5704
6131
  onChange: (event) => props.onChange(props.valueMin, Number(event.target.value))
5705
6132
  })
5706
6133
  ),
@@ -5759,8 +6186,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5759
6186
  h(
5760
6187
  "div",
5761
6188
  { className: "dsv-ctl-head" },
5762
- h("span", { className: "dsv-ctl-label" }, "颜色"),
5763
- h("span", { className: "dsv-ctl-value" }, follow ? "跟随全局" : hex.toUpperCase())
6189
+ h("span", { className: "dsv-ctl-label" }, t("颜色")),
6190
+ h("span", { className: "dsv-ctl-value" }, follow ? t("跟随全局") : hex.toUpperCase())
5764
6191
  ),
5765
6192
  h(
5766
6193
  "div",
@@ -5772,16 +6199,16 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5772
6199
  className: "dsv-mini-btn",
5773
6200
  "data-on": follow ? "1" : "0",
5774
6201
  onClick: () => props.onChange(follow ? hex : ""),
5775
- title: follow ? "当前跟随全局色;点一下改成单独颜色" : "点一下恢复跟随全局色"
6202
+ title: follow ? t("当前跟随全局色;点一下改成单独颜色") : t("点一下恢复跟随全局色")
5776
6203
  },
5777
- follow ? "跟随全局" : "已单独设置"
6204
+ follow ? t("跟随全局") : t("已单独设置")
5778
6205
  ),
5779
6206
  h("input", {
5780
6207
  type: "color",
5781
6208
  className: "dsv-color-input",
5782
6209
  value: hex,
5783
- "aria-label": "选择颜色",
5784
- title: "选一个颜色(选完自动变成单独颜色)",
6210
+ "aria-label": t("选择颜色"),
6211
+ title: t("选一个颜色(选完自动变成单独颜色)"),
5785
6212
  onChange: (event) => props.onChange(event.target.value)
5786
6213
  })
5787
6214
  ),
@@ -5827,16 +6254,16 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5827
6254
  try {
5828
6255
  const name = await exportPrefsToFile();
5829
6256
  setError("");
5830
- setNote(`已导出:${name}`);
6257
+ setNote(t("已导出:{0}", [name]));
5831
6258
  } catch (err) {
5832
6259
  const msg = String((err && err.message) || err);
5833
6260
  if ((err && err.name) === "AbortError" || msg.indexOf("abort") >= 0) {
5834
- setNote("已取消导出");
6261
+ setNote(t("已取消导出"));
5835
6262
  setError("");
5836
6263
  return;
5837
6264
  }
5838
6265
  setNote("");
5839
- setError(`导出失败:${msg}`);
6266
+ setError(t("导出失败:{0}", [msg]));
5840
6267
  }
5841
6268
  };
5842
6269
  const doPick = () => {
@@ -5853,15 +6280,15 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5853
6280
  try {
5854
6281
  const count = importPrefsFromText(reader.result);
5855
6282
  setError("");
5856
- setNote(`已恢复 ${count} 项设置(来自 ${file.name})`);
6283
+ setNote(t("已恢复 {0} 项设置(来自 {1})", [count, file.name]));
5857
6284
  } catch (err) {
5858
6285
  setNote("");
5859
- setError(`恢复失败:${String((err && err.message) || err)}`);
6286
+ setError(t("恢复失败:{0}", [String((err && err.message) || err)]));
5860
6287
  }
5861
6288
  };
5862
6289
  reader.onerror = () => {
5863
6290
  setNote("");
5864
- setError("读取文件失败");
6291
+ setError(t("读取文件失败"));
5865
6292
  };
5866
6293
  reader.readAsText(file);
5867
6294
  };
@@ -5872,18 +6299,18 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5872
6299
  h(
5873
6300
  "div",
5874
6301
  { className: "dsv-card-text" },
5875
- h("div", { className: "dsv-card-title" }, "设置备份"),
6302
+ h("div", { className: "dsv-card-title" }, t("设置备份")),
5876
6303
  h(
5877
6304
  "div",
5878
6305
  { className: "dsv-card-desc" },
5879
- "导出一个 JSON 文件,换机器或重装后导回来即可还原全部外观与开关。文件只含本插件设置,不含会话内容。"
6306
+ t("导出一个 JSON 文件,换机器或重装后导回来即可还原全部外观与开关。文件只含本插件设置,不含会话内容。")
5880
6307
  )
5881
6308
  ),
5882
6309
  h(
5883
6310
  "div",
5884
6311
  { className: "dsv-backup-row" },
5885
- h("button", { type: "button", className: "dsv-primary", onClick: doExport }, "导出设置文件"),
5886
- h("button", { type: "button", className: "dsv-ghost", onClick: doPick }, "从文件恢复"),
6312
+ h("button", { type: "button", className: "dsv-primary", onClick: doExport }, t("导出设置文件")),
6313
+ h("button", { type: "button", className: "dsv-ghost", onClick: doPick }, t("从文件恢复")),
5887
6314
  h("input", {
5888
6315
  ref: fileRef,
5889
6316
  type: "file",
@@ -5903,7 +6330,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5903
6330
  松手(pointerup / pointercancel)立刻恢复,不用再点一次。 */
5904
6331
  const [freeze, setFreeze] = react.useState(false);
5905
6332
  react.useEffect(() => {
5906
- const isRange = (t) => t !== null && t !== void 0 && t.tagName === "INPUT" && t.type === "range";
6333
+ const isRange = (element) => element !== null && element !== void 0 && element.tagName === "INPUT" && element.type === "range";
5907
6334
  const down = (event) => {
5908
6335
  if (isRange(event.target)) setFreeze(true);
5909
6336
  };
@@ -5923,10 +6350,10 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5923
6350
  h(
5924
6351
  "div",
5925
6352
  { className: "dsv-pv-side" },
5926
- h("div", { className: "dsv-pv-row", "data-state": "focus", "data-pulse": (props.prefs?.appearance ?? {})?.pulse?.targets?.active === true ? "1" : "0" }, "激活会话"),
5927
- h("div", { className: "dsv-pv-row", "data-state": "open", "data-pulse": (props.prefs?.appearance ?? {})?.pulse?.targets?.openShown === true ? "1" : "0" }, "打开并显示"),
5928
- h("div", { className: "dsv-pv-row", "data-state": "open-hidden", "data-pulse": (props.prefs?.appearance ?? {})?.pulse?.targets?.openHidden === true ? "1" : "0" }, "打开未显示"),
5929
- h("div", { className: "dsv-pv-row", "data-state": "none", "data-pulse": (props.prefs?.appearance ?? {})?.pulse?.targets?.unopened === true ? "1" : "0" }, "未打开会话")
6353
+ h("div", { className: "dsv-pv-row", "data-state": "focus", "data-pulse": (props.prefs?.appearance ?? {})?.pulse?.targets?.active === true ? "1" : "0" }, t("激活会话")),
6354
+ h("div", { className: "dsv-pv-row", "data-state": "open", "data-pulse": (props.prefs?.appearance ?? {})?.pulse?.targets?.openShown === true ? "1" : "0" }, t("打开并显示")),
6355
+ h("div", { className: "dsv-pv-row", "data-state": "open-hidden", "data-pulse": (props.prefs?.appearance ?? {})?.pulse?.targets?.openHidden === true ? "1" : "0" }, t("打开未显示")),
6356
+ h("div", { className: "dsv-pv-row", "data-state": "none", "data-pulse": (props.prefs?.appearance ?? {})?.pulse?.targets?.unopened === true ? "1" : "0" }, t("未打开会话"))
5930
6357
  ),
5931
6358
  h(
5932
6359
  "div",
@@ -5937,10 +6364,10 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5937
6364
  h(
5938
6365
  "div",
5939
6366
  { className: "dsv-pv-tabs", "data-part": "tabline" },
5940
- h("div", { className: "dsv-pv-tab", "data-active": "1" }, "会话 A"),
6367
+ h("div", { className: "dsv-pv-tab", "data-active": "1" }, t("会话 A")),
5941
6368
  h("div", { className: "dsv-pv-caret", "data-part": "misc" }),
5942
- h("div", { className: "dsv-pv-tab" }, "会话 B"),
5943
- h("div", { className: "dsv-pv-tab", "data-hover": "1" }, "悬停")
6369
+ h("div", { className: "dsv-pv-tab" }, t("会话 B")),
6370
+ h("div", { className: "dsv-pv-tab", "data-hover": "1" }, t("悬停"))
5944
6371
  ),
5945
6372
  h("div", { className: "dsv-pv-body" })
5946
6373
  ),
@@ -5951,17 +6378,17 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
5951
6378
  h(
5952
6379
  "div",
5953
6380
  { className: "dsv-pv-tabs" },
5954
- h("div", { className: "dsv-pv-tab", "data-active": "1", "data-idle": "1" }, "会话 C"),
5955
- h("div", { className: "dsv-pv-tab", "data-locked": "1", "data-part": "misc" }, "锁定")
6381
+ h("div", { className: "dsv-pv-tab", "data-active": "1", "data-idle": "1" }, t("会话 C")),
6382
+ h("div", { className: "dsv-pv-tab", "data-locked": "1", "data-part": "misc" }, t("锁定"))
5956
6383
  ),
5957
6384
  h(
5958
6385
  "div",
5959
6386
  { className: "dsv-pv-body" },
5960
- h("div", { className: "dsv-pv-drop", "data-part": "drop" }, "拖文件到这里")
6387
+ h("div", { className: "dsv-pv-drop", "data-part": "drop" }, t("拖文件到这里"))
5961
6388
  )
5962
6389
  )
5963
6390
  ),
5964
- h("div", { className: "dsv-preview-tag" }, "实时预览 · 实际大小")
6391
+ h("div", { className: "dsv-preview-tag" }, t("实时预览 · 实际大小"))
5965
6392
  );
5966
6393
  }
5967
6394
 
@@ -6016,7 +6443,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6016
6443
  onClick: () => toggle(key),
6017
6444
  "aria-expanded": expanded[key] === true ? "true" : "false"
6018
6445
  },
6019
- expanded[key] === true ? "收起" : "展开"
6446
+ expanded[key] === true ? t("收起") : t("展开")
6020
6447
  )
6021
6448
  ),
6022
6449
  expanded[key] === true
@@ -6031,7 +6458,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6031
6458
  h(
6032
6459
  "button",
6033
6460
  { type: "button", className: "dsv-linkbtn", onClick: () => toggleAdv(key) },
6034
- advanced[key] === true ? "收起高级项" : "更多(高级项)"
6461
+ advanced[key] === true ? t("收起高级项") : t("更多(高级项)")
6035
6462
  ),
6036
6463
  advanced[key] === true ? h("div", { className: "dsv-group-adv" }, ...more) : null
6037
6464
  )
@@ -6039,7 +6466,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6039
6466
  h(
6040
6467
  "div",
6041
6468
  { className: "dsv-group-foot" },
6042
- h("button", { type: "button", className: "dsv-linkbtn", onClick: () => resetGroup(key) }, "恢复本组默认")
6469
+ h("button", { type: "button", className: "dsv-linkbtn", onClick: () => resetGroup(key) }, t("恢复本组默认"))
6043
6470
  )
6044
6471
  )
6045
6472
  : null
@@ -6051,12 +6478,12 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6051
6478
  h(
6052
6479
  "div",
6053
6480
  { className: "dsv-card-text" },
6054
- h("div", { className: "dsv-card-title" }, "全局线条颜色"),
6055
- h("div", { className: "dsv-card-desc" }, "所有线条默认用这个颜色;下面每一组都可以单独换成别的颜色。")
6481
+ h("div", { className: "dsv-card-title" }, t("全局线条颜色")),
6482
+ h("div", { className: "dsv-card-desc" }, t("所有线条默认用这个颜色;下面每一组都可以单独换成别的颜色。"))
6056
6483
  ),
6057
6484
  h(
6058
6485
  "div",
6059
- { className: "dsv-swatches", role: "radiogroup", "aria-label": "全局线条颜色" },
6486
+ { className: "dsv-swatches", role: "radiogroup", "aria-label": t("全局线条颜色") },
6060
6487
  LINE_COLORS.map((item) =>
6061
6488
  h(
6062
6489
  "button",
@@ -6079,16 +6506,16 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6079
6506
  h(
6080
6507
  "div",
6081
6508
  { className: "dsv-color-row" },
6082
- h("span", { className: "dsv-ctl-label" }, "自定义"),
6509
+ h("span", { className: "dsv-ctl-label" }, t("自定义")),
6083
6510
  h("input", {
6084
6511
  type: "color",
6085
6512
  className: "dsv-color-input",
6086
6513
  value: globalHex,
6087
- "aria-label": "自定义全局线条颜色",
6088
- title: "任意颜色;选完所有「跟随全局」的线都会变",
6514
+ "aria-label": t("自定义全局线条颜色"),
6515
+ title: t("任意颜色;选完所有「跟随全局」的线都会变"),
6089
6516
  onChange: (event) => prefs.update({ lineColor: event.target.value })
6090
6517
  }),
6091
- h("span", { className: "dsv-ctl-hint" }, `${globalHex.toUpperCase()}(正在使用)`)
6518
+ h("span", { className: "dsv-ctl-hint" }, t("{0}(正在使用)", [globalHex.toUpperCase()]))
6092
6519
  )
6093
6520
  );
6094
6521
 
@@ -6101,8 +6528,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6101
6528
  globalCard,
6102
6529
  card(
6103
6530
  "divider",
6104
- "栏间分隔条",
6105
- "两栏之间那条竖线;悬停或拖动时自动变实色,方便对准。",
6531
+ t("栏间分隔条"),
6532
+ t("两栏之间那条竖线;悬停或拖动时自动变实色,方便对准。"),
6106
6533
  [
6107
6534
  h(AppearanceColor, {
6108
6535
  key: "c",
@@ -6112,14 +6539,14 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6112
6539
  }),
6113
6540
  h(AppearanceSlider, {
6114
6541
  key: "a",
6115
- label: "平时浓度",
6116
- hint: "不悬停、不拖动时有多浓",
6542
+ label: t("平时浓度"),
6543
+ hint: t("不悬停、不拖动时有多浓"),
6117
6544
  value: a.divider.alpha,
6118
6545
  onChange: (value) => setGroup("divider", { alpha: value })
6119
6546
  }),
6120
6547
  h(AppearanceWidth, {
6121
6548
  key: "w",
6122
- label: "粗细",
6549
+ label: t("粗细"),
6123
6550
  value: a.divider.width,
6124
6551
  onChange: (value) => setGroup("divider", { width: value })
6125
6552
  })
@@ -6128,8 +6555,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6128
6555
  ),
6129
6556
  card(
6130
6557
  "tabline",
6131
- "标签页焦点线",
6132
- "激活标签底部那条横线;焦点栏最亮,其它栏更淡,悬停居中。",
6558
+ t("标签页焦点线"),
6559
+ t("激活标签底部那条横线;焦点栏最亮,其它栏更淡,悬停居中。"),
6133
6560
  [
6134
6561
  h(AppearanceColor, {
6135
6562
  key: "c",
@@ -6139,14 +6566,14 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6139
6566
  }),
6140
6567
  h(AppearanceSlider, {
6141
6568
  key: "f",
6142
- label: "焦点栏浓度",
6143
- hint: "你正在操作的那一栏",
6569
+ label: t("焦点栏浓度"),
6570
+ hint: t("你正在操作的那一栏"),
6144
6571
  value: a.tabline.focus,
6145
6572
  onChange: (value) => setGroup("tabline", { focus: value })
6146
6573
  }),
6147
6574
  h(AppearanceWidth, {
6148
6575
  key: "w",
6149
- label: "粗细",
6576
+ label: t("粗细"),
6150
6577
  value: a.tabline.width,
6151
6578
  onChange: (value) => setGroup("tabline", { width: value })
6152
6579
  })
@@ -6154,15 +6581,15 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6154
6581
  [
6155
6582
  h(AppearanceSlider, {
6156
6583
  key: "i",
6157
- label: "非焦点栏浓度",
6158
- hint: "其它栏的激活标签",
6584
+ label: t("非焦点栏浓度"),
6585
+ hint: t("其它栏的激活标签"),
6159
6586
  value: a.tabline.idle,
6160
6587
  onChange: (value) => setGroup("tabline", { idle: value })
6161
6588
  }),
6162
6589
  h(AppearanceSlider, {
6163
6590
  key: "h",
6164
- label: "悬停时浓度",
6165
- hint: "鼠标移到非焦点栏上时,那一栏当前标签的下划线与淡底有多浓(把鼠标移到这一行,预览里会框出「悬停」标签)",
6591
+ label: t("悬停时浓度"),
6592
+ hint: t("鼠标移到非焦点栏上时,那一栏当前标签的下划线与淡底有多浓(把鼠标移到这一行,预览里会框出「悬停」标签)"),
6166
6593
  value: a.tabline.hover,
6167
6594
  hl: "hovertab",
6168
6595
  onHl: setHover,
@@ -6172,8 +6599,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6172
6599
  ),
6173
6600
  card(
6174
6601
  "siderow",
6175
- "侧栏会话行",
6176
- "会话列表每一行的左竖线和底色,按四种状态区分:焦点 / 已打开并显示 / 已打开未显示 / 未打开。",
6602
+ t("侧栏会话行"),
6603
+ t("会话列表每一行的左竖线和底色,按四种状态区分:焦点 / 已打开并显示 / 已打开未显示 / 未打开。"),
6177
6604
  [
6178
6605
  h(AppearanceColor, {
6179
6606
  key: "c",
@@ -6183,29 +6610,29 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6183
6610
  }),
6184
6611
  h(AppearanceSlider, {
6185
6612
  key: "f",
6186
- label: "焦点行竖线浓度",
6187
- hint: "你正在看的那个会话",
6613
+ label: t("焦点行竖线浓度"),
6614
+ hint: t("你正在看的那个会话"),
6188
6615
  value: a.siderow.barFocus,
6189
6616
  onChange: (value) => setGroup("siderow", { barFocus: value })
6190
6617
  }),
6191
6618
  h(AppearanceSlider, {
6192
6619
  key: "fb",
6193
- label: "焦点行底色浓度",
6620
+ label: t("焦点行底色浓度"),
6194
6621
  value: a.siderow.bgFocus,
6195
6622
  onChange: (value) => setGroup("siderow", { bgFocus: value })
6196
6623
  }),
6197
6624
  h(AppearanceWidth, {
6198
6625
  key: "wf",
6199
- label: "焦点行竖线粗细",
6200
- hint: "最粗 8px;调这里最直观",
6626
+ label: t("焦点行竖线粗细"),
6627
+ hint: t("最粗 8px;调这里最直观"),
6201
6628
  max: 8,
6202
6629
  value: a.siderow.widthFocus,
6203
6630
  onChange: (value) => setGroup("siderow", { widthFocus: value })
6204
6631
  }),
6205
6632
  h(AppearanceSwitch, {
6206
6633
  key: "bold",
6207
- label: "焦点行文字加粗",
6208
- hint: "默认不加粗(本机中文字体只有常规/粗两档,加粗会明显变重)",
6634
+ label: t("焦点行文字加粗"),
6635
+ hint: t("默认不加粗(本机中文字体只有常规/粗两档,加粗会明显变重)"),
6209
6636
  value: a.siderow.bold === true,
6210
6637
  onChange: (value) => setGroup("siderow", { bold: value })
6211
6638
  })
@@ -6213,35 +6640,35 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6213
6640
  [
6214
6641
  h(AppearanceSlider, {
6215
6642
  key: "o",
6216
- label: "打开显示行竖线浓度",
6217
- hint: "已打开、并且是某一栏当前标签",
6643
+ label: t("打开显示行竖线浓度"),
6644
+ hint: t("已打开、并且是某一栏当前标签"),
6218
6645
  value: a.siderow.barOpen,
6219
6646
  onChange: (value) => setGroup("siderow", { barOpen: value })
6220
6647
  }),
6221
6648
  h(AppearanceSlider, {
6222
6649
  key: "ob",
6223
- label: "打开行底色浓度",
6224
- hint: "「打开显示」和「打开未显示」共用",
6650
+ label: t("打开行底色浓度"),
6651
+ hint: t("「打开显示」和「打开未显示」共用"),
6225
6652
  value: a.siderow.bgOpen,
6226
6653
  onChange: (value) => setGroup("siderow", { bgOpen: value })
6227
6654
  }),
6228
6655
  h(AppearanceWidth, {
6229
6656
  key: "wo",
6230
- label: "打开行竖线粗细",
6657
+ label: t("打开行竖线粗细"),
6231
6658
  max: 8,
6232
6659
  value: a.siderow.widthOpen,
6233
6660
  onChange: (value) => setGroup("siderow", { widthOpen: value })
6234
6661
  }),
6235
6662
  h(AppearanceSwitch, {
6236
6663
  key: "hiddenBar",
6237
- label: "「打开未显示」也画竖线",
6238
- hint: "默认不画:开过但没显示在屏幕上的会话,只保留底色",
6664
+ label: t("「打开未显示」也画竖线"),
6665
+ hint: t("默认不画:开过但没显示在屏幕上的会话,只保留底色"),
6239
6666
  value: a.siderow.hiddenBar === true,
6240
6667
  onChange: (value) => setGroup("siderow", { hiddenBar: value })
6241
6668
  }),
6242
6669
  h(AppearanceSlider, {
6243
6670
  key: "dim",
6244
- label: "未打开行文字亮度",
6671
+ label: t("未打开行文字亮度"),
6245
6672
  value: a.siderow.dimUnopened,
6246
6673
  onChange: (value) => setGroup("siderow", { dimUnopened: value })
6247
6674
  })
@@ -6249,8 +6676,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6249
6676
  ),
6250
6677
  card(
6251
6678
  "drop",
6252
- "拖放提示",
6253
- "拖文件进窗口时的目标栏边框,拖标签时的虚线框、半屏预览、虚位标签,统一在这一组调。",
6679
+ t("拖放提示"),
6680
+ t("拖文件进窗口时的目标栏边框,拖标签时的虚线框、半屏预览、虚位标签,统一在这一组调。"),
6254
6681
  [
6255
6682
  h(AppearanceColor, {
6256
6683
  key: "c",
@@ -6260,15 +6687,15 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6260
6687
  }),
6261
6688
  h(AppearanceSlider, {
6262
6689
  key: "a",
6263
- label: "边框浓度",
6264
- hint: "边框、虚线、边缘线都用它",
6690
+ label: t("边框浓度"),
6691
+ hint: t("边框、虚线、边缘线都用它"),
6265
6692
  value: a.drop.alpha,
6266
6693
  onChange: (value) => setGroup("drop", { alpha: value })
6267
6694
  }),
6268
6695
  h(AppearanceSlider, {
6269
6696
  key: "bg",
6270
- label: "目标栏蒙层浓度",
6271
- hint: "拖文件时整栏那层淡色",
6697
+ label: t("目标栏蒙层浓度"),
6698
+ hint: t("拖文件时整栏那层淡色"),
6272
6699
  value: a.drop.bg,
6273
6700
  onChange: (value) => setGroup("drop", { bg: value })
6274
6701
  })
@@ -6276,21 +6703,21 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6276
6703
  [
6277
6704
  h(AppearanceWidth, {
6278
6705
  key: "w",
6279
- label: "线条粗细",
6706
+ label: t("线条粗细"),
6280
6707
  value: a.drop.width,
6281
6708
  onChange: (value) => setGroup("drop", { width: value })
6282
6709
  }),
6283
6710
  h(AppearanceSlider, {
6284
6711
  key: "pb",
6285
- label: "半屏预览底色",
6286
- hint: "拖到栏边缘「新开一栏」时那块半屏",
6712
+ label: t("半屏预览底色"),
6713
+ hint: t("拖到栏边缘「新开一栏」时那块半屏"),
6287
6714
  value: a.drop.previewBg,
6288
6715
  onChange: (value) => setGroup("drop", { previewBg: value })
6289
6716
  }),
6290
6717
  h(AppearanceSlider, {
6291
6718
  key: "gb",
6292
- label: "虚位标签底色",
6293
- hint: "拖到标签条时「松手:加到这一栏」那块",
6719
+ label: t("虚位标签底色"),
6720
+ hint: t("拖到标签条时「松手:加到这一栏」那块"),
6294
6721
  value: a.drop.ghostBg,
6295
6722
  onChange: (value) => setGroup("drop", { ghostBg: value })
6296
6723
  })
@@ -6298,8 +6725,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6298
6725
  ),
6299
6726
  card(
6300
6727
  "misc",
6301
- "其它细节",
6302
- "锁定标签的底色、标签重排时的插入竖线。",
6728
+ t("其它细节"),
6729
+ t("锁定标签的底色、标签重排时的插入竖线。"),
6303
6730
  [
6304
6731
  h(AppearanceColor, {
6305
6732
  key: "c",
@@ -6309,14 +6736,14 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6309
6736
  }),
6310
6737
  h(AppearanceSlider, {
6311
6738
  key: "l",
6312
- label: "锁定标签底色浓度",
6739
+ label: t("锁定标签底色浓度"),
6313
6740
  value: a.misc.lockedBg,
6314
6741
  onChange: (value) => setGroup("misc", { lockedBg: value })
6315
6742
  }),
6316
6743
  h(AppearanceSlider, {
6317
6744
  key: "c2",
6318
- label: "重排插入线浓度",
6319
- hint: "拖动标签换位时,标出「将插到这里」的那条细竖线(平时不存在;把鼠标移到这一行才在预览里显示)",
6745
+ label: t("重排插入线浓度"),
6746
+ hint: t("拖动标签换位时,标出「将插到这里」的那条细竖线(平时不存在;把鼠标移到这一行才在预览里显示)"),
6320
6747
  value: a.misc.caret,
6321
6748
  hl: "caret",
6322
6749
  onHl: setHover,
@@ -6327,50 +6754,50 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6327
6754
  ),
6328
6755
  card(
6329
6756
  "pulse",
6330
- "运行中呼吸",
6331
- "会话在执行任务时,它在侧栏那一行的底色会一浓一淡地「呼吸」,一眼就能看出哪个还在干活。按任务真实的运行状态判断,不是估的。",
6757
+ t("运行中呼吸"),
6758
+ t("会话在执行任务时,它在侧栏那一行的底色会一浓一淡地「呼吸」,一眼就能看出哪个还在干活。按任务真实的运行状态判断,不是估的。"),
6332
6759
  [
6333
6760
  h(AppearanceSwitch, {
6334
6761
  key: "on",
6335
- label: "开启呼吸",
6336
- hint: "关掉后静默,不占资源",
6762
+ label: t("开启呼吸"),
6763
+ hint: t("关掉后静默,不占资源"),
6337
6764
  value: a.pulse.enabled,
6338
6765
  onChange: (value) => setGroup("pulse", { enabled: value })
6339
6766
  }),
6340
- h("div", { key: "tg-h", className: "dsv-ctl-hint" }, "哪几类「正在跑」的会话要呼吸(可多选):"),
6767
+ h("div", { key: "tg-h", className: "dsv-ctl-hint" }, t("哪几类「正在跑」的会话要呼吸(可多选):")),
6341
6768
  h(AppearanceSwitch, {
6342
6769
  key: "t1",
6343
- label: "已激活",
6344
- hint: "你现在正在看的那一行",
6770
+ label: t("已激活"),
6771
+ hint: t("你现在正在看的那一行"),
6345
6772
  value: a.pulse.targets.active,
6346
6773
  onChange: (value) => setGroup("pulse", { targets: { ...a.pulse.targets, active: value } })
6347
6774
  }),
6348
6775
  h(AppearanceSwitch, {
6349
6776
  key: "t2",
6350
- label: "已打开且显示",
6351
- hint: "已经拖进某一栏、并且是那一栏当前标签",
6777
+ label: t("已打开且显示"),
6778
+ hint: t("已经拖进某一栏、并且是那一栏当前标签"),
6352
6779
  value: a.pulse.targets.openShown,
6353
6780
  onChange: (value) => setGroup("pulse", { targets: { ...a.pulse.targets, openShown: value } })
6354
6781
  }),
6355
6782
  h(AppearanceSwitch, {
6356
6783
  key: "t3",
6357
- label: "已打开未显示",
6358
- hint: "打开了、但在后台标签里",
6784
+ label: t("已打开未显示"),
6785
+ hint: t("打开了、但在后台标签里"),
6359
6786
  value: a.pulse.targets.openHidden,
6360
6787
  onChange: (value) => setGroup("pulse", { targets: { ...a.pulse.targets, openHidden: value } })
6361
6788
  }),
6362
6789
  h(AppearanceSwitch, {
6363
6790
  key: "t4",
6364
- label: "未打开",
6365
- hint: "还在侧栏列表里、没拖进多栏的会话",
6791
+ label: t("未打开"),
6792
+ hint: t("还在侧栏列表里、没拖进多栏的会话"),
6366
6793
  value: a.pulse.targets.unopened,
6367
6794
  onChange: (value) => setGroup("pulse", { targets: { ...a.pulse.targets, unopened: value } })
6368
6795
  }),
6369
6796
  ...[
6370
- { key: "active", label: "已激活", plate: a.siderow.bgFocus },
6371
- { key: "openShown", label: "已打开且显示", plate: a.siderow.bgOpen },
6372
- { key: "openHidden", label: "已打开未显示", plate: a.siderow.bgOpen },
6373
- { key: "unopened", label: "未打开", plate: null }
6797
+ { key: "active", label: t("已激活"), plate: a.siderow.bgFocus },
6798
+ { key: "openShown", label: t("已打开且显示"), plate: a.siderow.bgOpen },
6799
+ { key: "openHidden", label: t("已打开未显示"), plate: a.siderow.bgOpen },
6800
+ { key: "unopened", label: t("未打开"), plate: null }
6374
6801
  ].map((item) => {
6375
6802
  const st = a.pulse.states[item.key];
6376
6803
  const following = item.key !== "openShown" && st.follow === true;
@@ -6388,27 +6815,27 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6388
6815
  ? null
6389
6816
  : h(AppearanceSwitch, {
6390
6817
  key: "follow",
6391
- label: "跟随「已打开且显示」",
6818
+ label: t("跟随「已打开且显示」"),
6392
6819
  value: st.follow === true,
6393
6820
  onChange: (v) => patch({ follow: v })
6394
6821
  }),
6395
6822
  following
6396
- ? h("div", { className: "dsv-ctl-hint" }, "低点 / 高点 / 节奏都用「已打开且显示」那一组")
6823
+ ? h("div", { className: "dsv-ctl-hint" }, t("低点 / 高点 / 节奏都用「已打开且显示」那一组"))
6397
6824
  : [
6398
6825
  h(AppearanceDualRange, {
6399
6826
  key: "range",
6400
- label: "亮度范围(最暗 ↔ 最亮)",
6827
+ label: t("亮度范围(最暗 ↔ 最亮)"),
6401
6828
  min: 0,
6402
6829
  max: 100,
6403
6830
  step: 1,
6404
6831
  valueMin: Math.round(eff.min * 100),
6405
6832
  valueMax: Math.round(eff.max * 100),
6406
6833
  mark: item.plate === null ? void 0 : item.plate * 100,
6407
- markTitle: item.plate === null ? "" : `当前底板 ${Math.round(item.plate * 100)}%`,
6834
+ markTitle: item.plate === null ? "" : t("当前底板 {0}%", [Math.round(item.plate * 100)]),
6408
6835
  hint:
6409
6836
  item.plate === null
6410
- ? "两个滑块之间就是呼吸范围"
6411
- : `两个滑块之间就是呼吸范围;白线 = 当前底板 ${Math.round(item.plate * 100)}%`,
6837
+ ? t("两个滑块之间就是呼吸范围")
6838
+ : t("两个滑块之间就是呼吸范围;白线 = 当前底板 {0}%", [Math.round(item.plate * 100)]),
6412
6839
  onChange: (minV, maxV) =>
6413
6840
  patch({
6414
6841
  min: Math.min(minV, maxV) / 100,
@@ -6417,7 +6844,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6417
6844
  }),
6418
6845
  h(AppearanceRange, {
6419
6846
  key: "period",
6420
- label: "节奏",
6847
+ label: t("节奏"),
6421
6848
  min: 5,
6422
6849
  max: 60,
6423
6850
  step: 1,
@@ -6482,7 +6909,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6482
6909
  return h(
6483
6910
  "div",
6484
6911
  { className: "dsv-market-fallback" },
6485
- "没有找到插件市场。请关闭这个窗口,改从左侧「插件市场」→「已安装」里更新本插件。"
6912
+ t("没有找到插件市场。请关闭这个窗口,改从左侧「插件市场」→「已安装」里更新本插件。")
6486
6913
  );
6487
6914
  }
6488
6915
  try {
@@ -6491,7 +6918,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6491
6918
  return h(
6492
6919
  "div",
6493
6920
  { className: "dsv-market-fallback" },
6494
- "打开插件市场面板失败:" + String((err && err.message) || err) + "。请改从左侧「插件市场」更新。"
6921
+ t("打开插件市场面板失败:") + String((err && err.message) || err) + t("。请改从左侧「插件市场」更新。")
6495
6922
  );
6496
6923
  }
6497
6924
  };
@@ -6500,7 +6927,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6500
6927
  const stampNow = () => new Date().toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" });
6501
6928
  setUpdate({
6502
6929
  phase: "checking",
6503
- text: "正在检查…",
6930
+ text: t("正在检查…"),
6504
6931
  canUpdate: false,
6505
6932
  opId: "",
6506
6933
  modal: false,
@@ -6533,7 +6960,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6533
6960
  if (compareVersion(regLatest, installedNow) > 0) {
6534
6961
  setUpdate({
6535
6962
  phase: "available",
6536
- text: `发现新版本 ${regLatest}`,
6963
+ text: t("发现新版本 {0}", [regLatest]),
6537
6964
  canUpdate: true,
6538
6965
  opId: "",
6539
6966
  modal: quiet !== true,
@@ -6548,7 +6975,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6548
6975
  } else {
6549
6976
  setUpdate({
6550
6977
  phase: "latest",
6551
- text: `已是最新版本(${installedNow},${stampNow()} 检查)`,
6978
+ text: t("已是最新版本({0},{1} 检查)", [installedNow, stampNow()]),
6552
6979
  canUpdate: false,
6553
6980
  opId: "",
6554
6981
  modal: false,
@@ -6565,20 +6992,20 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6565
6992
  const capsRes = await fetch(`${MARKET_CAPS_URL}?t=${Date.now()}`, { cache: "no-store" });
6566
6993
  if (capsRes.ok === true) {
6567
6994
  const caps = await capsRes.json();
6568
- if ((caps && caps.features && caps.features.check) !== true) throw new Error("插件市场未启用更新检查");
6995
+ if ((caps && caps.features && caps.features.check) !== true) throw new Error(t("插件市场未启用更新检查"));
6569
6996
  /* 必须带时间戳:市场对相同 URL 有服务端缓存,只写 force=1 仍会拿到旧结果,
6570
6997
  表现就是「明明有新版本却显示已是最新」(2026-11-10 实测:带与不带 t= 返回不同 latest)。 */
6571
6998
  const res = await fetch(`${MARKET_UPDATES_URL}?name=${PKG_NAME}&force=1&t=${Date.now()}`, { cache: "no-store" });
6572
6999
  if (res.ok !== true) throw new Error(`HTTP ${res.status}`);
6573
7000
  const data = await res.json();
6574
7001
  const info = data === null || data === void 0 ? void 0 : data.package;
6575
- if (info === void 0 || info === null) throw new Error("返回里没有版本信息");
7002
+ if (info === void 0 || info === null) throw new Error(t("返回里没有版本信息"));
6576
7003
  const installed = String(info.installedVersion ?? PLUGIN_VERSION);
6577
7004
  const latest = String(info.latestVersion ?? installed);
6578
7005
  if (info.updateAvailable === true) {
6579
7006
  setUpdate({
6580
7007
  phase: "available",
6581
- text: `发现新版本 ${latest}`,
7008
+ text: t("发现新版本 {0}", [latest]),
6582
7009
  canUpdate: true,
6583
7010
  opId: "",
6584
7011
  modal: quiet !== true,
@@ -6595,7 +7022,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6595
7022
  「观察期 / 防供应链投毒」这种解释对用户没意义,等真正失败再给一句人话。 */
6596
7023
  setUpdate({
6597
7024
  phase: "available",
6598
- text: `发现新版本 ${latest}`,
7025
+ text: t("发现新版本 {0}", [latest]),
6599
7026
  canUpdate: true,
6600
7027
  opId: "",
6601
7028
  modal: true,
@@ -6640,7 +7067,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6640
7067
  const retryLatest = String(retryInfo.latestVersion ?? regLatest);
6641
7068
  setUpdate({
6642
7069
  phase: "available",
6643
- text: `发现新版本 ${retryLatest}`,
7070
+ text: t("发现新版本 {0}", [retryLatest]),
6644
7071
  canUpdate: true,
6645
7072
  opId: "",
6646
7073
  modal: true,
@@ -6656,7 +7083,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6656
7083
  }
6657
7084
  setUpdate({
6658
7085
  phase: "latest",
6659
- text: `已是最新版本(${installed},${stamp()} 检查);npm 上已有 ${regLatest},插件市场还没放行,稍后再点一次`,
7086
+ text: t("已是最新版本({0},{1} 检查);npm 上已有 {2},插件市场还没放行,稍后再点一次", [installed, stamp(), regLatest]),
6660
7087
  canUpdate: false,
6661
7088
  opId: "",
6662
7089
  modal: false,
@@ -6669,7 +7096,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6669
7096
  }
6670
7097
  setUpdate({
6671
7098
  phase: "latest",
6672
- text: `已是最新版本(${installed},${stamp()} 检查)`,
7099
+ text: t("已是最新版本({0},{1} 检查)", [installed, stamp()]),
6673
7100
  canUpdate: false,
6674
7101
  opId: "",
6675
7102
  modal: false,
@@ -6685,21 +7112,21 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6685
7112
  if (res.ok !== true) throw new Error(`HTTP ${res.status}`);
6686
7113
  const data = await res.json();
6687
7114
  const latest = String((data && data.version) || "");
6688
- if (latest === "") throw new Error("返回里没有版本号");
7115
+ if (latest === "") throw new Error(t("返回里没有版本号"));
6689
7116
  const newer = compareVersion(latest, PLUGIN_VERSION) > 0;
6690
7117
  setUpdate({
6691
7118
  phase: newer ? "available" : "latest",
6692
- text: newer ? `发现新版本 ${latest}` : `已是最新版本(${PLUGIN_VERSION})`,
7119
+ text: newer ? t("发现新版本 {0}", [latest]) : t("已是最新版本({0})", [PLUGIN_VERSION]),
6693
7120
  canUpdate: false,
6694
7121
  opId: "",
6695
7122
  modal: newer && quiet !== true,
6696
7123
  installed: PLUGIN_VERSION,
6697
7124
  latest,
6698
- forceHint: newer ? "本机没有可用的插件市场(dshmarket),无法在这里自动安装。到「插件」页填 " + PKG_NAME + "@" + latest + " 安装。" : "",
7125
+ forceHint: newer ? t("本机没有可用的插件市场(dshmarket),无法在这里自动安装。到「插件」页填 ") + PKG_NAME + "@" + latest + t(" 安装。") : "",
6699
7126
  progress: null
6700
7127
  });
6701
7128
  } catch (err) {
6702
- setUpdate({ phase: "error", text: `检查失败:${String((err && err.message) || err)}`, canUpdate: false, opId: "" });
7129
+ setUpdate({ phase: "error", text: t("检查失败:{0}", [String((err && err.message) || err)]), canUpdate: false, opId: "" });
6703
7130
  }
6704
7131
  };
6705
7132
  /* 一进设置页就静默查一次(不弹窗):省得每次都要手动点,也避免「点了没反应」的错觉。
@@ -6712,7 +7139,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6712
7139
  }, []);
6713
7140
  const runUpdate = async () => {
6714
7141
  const target = update.latest !== "" ? update.latest : PLUGIN_VERSION;
6715
- setUpdate((prev) => ({ ...prev, phase: "updating", text: "正在从 npm 下载…", canUpdate: false, progress: 25 }));
7142
+ setUpdate((prev) => ({ ...prev, phase: "updating", text: t("正在从 npm 下载…"), canUpdate: false, progress: 25 }));
6716
7143
  try {
6717
7144
  const res = await fetch(`${SELF_UPDATE_URL}?t=${Date.now()}`, {
6718
7145
  method: "POST",
@@ -6727,13 +7154,13 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6727
7154
  }
6728
7155
  const ok = res.ok === true && body !== null && body.ok === true;
6729
7156
  if (ok !== true) {
6730
- const why = body === null || body === void 0 ? `HTTP ${res.status}` : String(body.message ?? "");
7157
+ const why = body === null || body === void 0 ? `HTTP ${res.status}` : hostMessage(String(body.message ?? ""));
6731
7158
  throw new Error(why === "" ? `HTTP ${res.status}` : why);
6732
7159
  }
6733
7160
  setUpdate((prev) => ({
6734
7161
  ...prev,
6735
7162
  phase: "done",
6736
- text: `已更新到 ${target},重启 App 后生效`,
7163
+ text: t("已更新到 {0},重启 App 后生效", [target]),
6737
7164
  canUpdate: false,
6738
7165
  progress: 100,
6739
7166
  forceHint: ""
@@ -6743,7 +7170,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6743
7170
  setUpdate((prev) => ({
6744
7171
  ...prev,
6745
7172
  phase: "error",
6746
- text: `更新失败:${String((err && err.message) || err)}`,
7173
+ text: t("更新失败:{0}", [String((err && err.message) || err)]),
6747
7174
  progress: null,
6748
7175
  modal: true
6749
7176
  }));
@@ -6751,7 +7178,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6751
7178
  }
6752
7179
  };
6753
7180
  const runUpdateLegacyUnused = async (force, confirmAgents) => {
6754
- setUpdate((prev) => ({ ...prev, phase: "updating", text: "正在更新…", canUpdate: false, progress: 0, agentsBusy: false }));
7181
+ setUpdate((prev) => ({ ...prev, phase: "updating", text: t("正在更新…"), canUpdate: false, progress: 0, agentsBusy: false }));
6755
7182
  try {
6756
7183
  const payload = { packageName: PKG_NAME };
6757
7184
  if (force === true) payload.force = true;
@@ -6780,7 +7207,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6780
7207
  progress: null,
6781
7208
  agentsBusy: true,
6782
7209
  busyAgents: list,
6783
- forceHint: `现在有 ${list.length || 1} 个会话正在运行。更新会替换插件文件,那个会话可能在半路读到新旧混着的代码而报错。确定要继续,就再点一次「仍然更新」。`
7210
+ forceHint: t("现在有 {0} 个会话正在运行。更新会替换插件文件,那个会话可能在半路读到新旧混着的代码而报错。确定要继续,就再点一次「仍然更新」。", [list.length || 1])
6784
7211
  }));
6785
7212
  return;
6786
7213
  }
@@ -6790,17 +7217,17 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6790
7217
  let detail = "";
6791
7218
  try {
6792
7219
  const body = await res.json();
6793
- detail = String(body.message ?? body.error ?? "");
7220
+ detail = hostMessage(String(body.message ?? body.error ?? ""));
6794
7221
  } catch {
6795
7222
  /* 忽略 */
6796
7223
  }
6797
- throw new Error(`HTTP ${res.status}${detail === "" ? "" : ":" + detail}`);
7224
+ throw new Error(t("HTTP {0}{1}", [res.status, detail === "" ? "" : t(":") + detail]));
6798
7225
  }
6799
7226
  const created = await res.json();
6800
7227
  /* 实测返回形状:{ schema, operation: { operationId, state, ... } } —— id 在 operation 里,不在顶层 */
6801
7228
  const createdOp = created === null || created === void 0 ? {} : created.operation ?? created;
6802
7229
  const opId = String((createdOp && createdOp.operationId) || (created && created.operationId) || "");
6803
- if (opId === "") throw new Error("没有返回操作 id");
7230
+ if (opId === "") throw new Error(t("没有返回操作 id"));
6804
7231
  setUpdate((prev) => ({ ...prev, opId }));
6805
7232
  for (let step = 0; step < 80; step += 1) {
6806
7233
  await new Promise((resolve) => setTimeout(resolve, 1500));
@@ -6818,7 +7245,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6818
7245
  setUpdate((prev) => ({
6819
7246
  ...prev,
6820
7247
  phase: "done",
6821
- text: `已更新${got === "" ? "" : "到 " + got}${needRestart ? ",重启 App 后生效" : ",刷新页面即可生效"}`,
7248
+ text: t("已更新{0}{1}", [got === "" ? "" : t("到 ") + got, needRestart ? t(",重启 App 后生效") : t(",刷新页面即可生效")]),
6822
7249
  canUpdate: false,
6823
7250
  opId,
6824
7251
  modal: true,
@@ -6836,10 +7263,10 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6836
7263
  setUpdate((prev) => ({
6837
7264
  ...prev,
6838
7265
  phase: "available",
6839
- text: `发现新版本 ${prev.latest}`,
7266
+ text: t("发现新版本 {0}", [prev.latest]),
6840
7267
  canUpdate: true,
6841
7268
  progress: null,
6842
- forceHint: "这个版本刚发布,市场还要等几分钟才能装。过会儿再点一次「立即更新」就行。"
7269
+ forceHint: t("这个版本刚发布,市场还要等几分钟才能装。过会儿再点一次「立即更新」就行。")
6843
7270
  }));
6844
7271
  return;
6845
7272
  }
@@ -6848,16 +7275,16 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6848
7275
  const pct = op.progress === null || op.progress === void 0 ? void 0 : op.progress.percent;
6849
7276
  setUpdate((prev) => ({
6850
7277
  ...prev,
6851
- text: typeof pct === "number" ? `正在更新… ${Math.round(pct)}%` : "正在更新…",
7278
+ text: typeof pct === "number" ? t("正在更新… {0}%", [Math.round(pct)]) : t("正在更新…"),
6852
7279
  progress: typeof pct === "number" ? pct : prev.progress
6853
7280
  }));
6854
7281
  }
6855
- throw new Error("等待超时,请到插件市场查看结果");
7282
+ throw new Error(t("等待超时,请到插件市场查看结果"));
6856
7283
  } catch (err) {
6857
7284
  setUpdate((prev) => ({
6858
7285
  ...prev,
6859
7286
  phase: "error",
6860
- text: `更新失败:${String((err && err.message) || err)}`,
7287
+ text: t("更新失败:{0}", [String((err && err.message) || err)]),
6861
7288
  opId: "",
6862
7289
  modal: true,
6863
7290
  progress: null
@@ -6877,18 +7304,18 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6877
7304
  h(
6878
7305
  "div",
6879
7306
  { className: "dsv-page-title-row" },
6880
- h("h2", { className: "dsv-page-title" }, PLUGIN_LABEL),
7307
+ h("h2", { className: "dsv-page-title" }, pluginTitle()),
6881
7308
  h(
6882
7309
  "span",
6883
7310
  { className: "dsv-badge", "data-on": p.enabled ? "1" : "0" },
6884
7311
  h("span", { className: "dsv-badge-dot", "aria-hidden": "true" }),
6885
- p.enabled ? "已启用" : "已停用"
7312
+ p.enabled ? t("已启用") : t("已停用")
6886
7313
  )
6887
7314
  ),
6888
7315
  h(
6889
7316
  "p",
6890
7317
  { className: "dsv-page-sub" },
6891
- "把对话区变成可分栏的工作区:多个会话并排,各自有输入框、工具调用和插件面板。"
7318
+ t("把对话区变成可分栏的工作区:多个会话并排,各自有输入框、工具调用和插件面板。")
6892
7319
  )
6893
7320
  ),
6894
7321
  /* 版本行:当前版本 + 检查更新 + 有新版本时的一键更新(走插件市场 API) */
@@ -6898,7 +7325,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6898
7325
  h(
6899
7326
  "span",
6900
7327
  { className: "dsv-update-text", "data-phase": update.phase },
6901
- update.text === "" ? `当前版本 ${PLUGIN_VERSION}` : update.text
7328
+ update.text === "" ? t("当前版本 {0}", [PLUGIN_VERSION]) : update.text
6902
7329
  ),
6903
7330
  h(
6904
7331
  "button",
@@ -6908,12 +7335,12 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6908
7335
  disabled: update.phase === "checking" || update.phase === "updating",
6909
7336
  onClick: checkUpdate
6910
7337
  },
6911
- update.phase === "checking" ? "检查中…" : "检查更新"
7338
+ update.phase === "checking" ? t("检查中…") : t("检查更新")
6912
7339
  ),
6913
7340
  h(
6914
7341
  "button",
6915
7342
  { type: "button", className: "dsv-mini-btn", onClick: openMarket },
6916
- "插件市场"
7343
+ t("插件市场")
6917
7344
  )
6918
7345
  ),
6919
7346
  /* ── 区块一:基本 ── */
@@ -6921,8 +7348,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6921
7348
  "div",
6922
7349
  { className: "dsv-section-head", key: "sec-basic" },
6923
7350
  h("span", { className: "dsv-section-bar", "aria-hidden": "true" }),
6924
- h("span", { className: "dsv-section-name" }, "基本"),
6925
- h("span", { className: "dsv-section-desc" }, "总开关与入口")
7351
+ h("span", { className: "dsv-section-name" }, t("基本")),
7352
+ h("span", { className: "dsv-section-desc" }, t("总开关与入口"))
6926
7353
  ),
6927
7354
  h(
6928
7355
  "div",
@@ -6930,11 +7357,11 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6930
7357
  h(
6931
7358
  "div",
6932
7359
  { className: "dsv-card-text" },
6933
- h("div", { className: "dsv-card-title" }, `启用${PLUGIN_LABEL}`),
7360
+ h("div", { className: "dsv-card-title" }, t("启用{0}", [pluginName()])),
6934
7361
  h(
6935
7362
  "div",
6936
7363
  { className: "dsv-card-desc" },
6937
- p.enabled ? "已启用:打开 App 直接进入工作区,点左侧会话替换当前标签。" : "未启用:保持原生单栏对话界面。"
7364
+ p.enabled ? t("已启用:打开 App 直接进入工作区,点左侧会话替换当前标签。") : t("未启用:保持原生单栏对话界面。")
6938
7365
  )
6939
7366
  ),
6940
7367
  h("button", {
@@ -6943,7 +7370,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6943
7370
  "data-on": p.enabled ? "1" : "0",
6944
7371
  role: "switch",
6945
7372
  "aria-checked": p.enabled ? "true" : "false",
6946
- "aria-label": `启用${PLUGIN_LABEL}`,
7373
+ "aria-label": t("启用{0}", [pluginName()]),
6947
7374
  onClick: toggle
6948
7375
  })
6949
7376
  ),
@@ -6952,8 +7379,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6952
7379
  "div",
6953
7380
  { className: "dsv-section-head", key: "sec-ui", style: { marginTop: "12px" } },
6954
7381
  h("span", { className: "dsv-section-bar", "aria-hidden": "true" }),
6955
- h("span", { className: "dsv-section-name" }, "界面元素"),
6956
- h("span", { className: "dsv-section-desc" }, "每一栏里显示什么")
7382
+ h("span", { className: "dsv-section-name" }, t("界面元素")),
7383
+ h("span", { className: "dsv-section-desc" }, t("每一栏里显示什么"))
6957
7384
  ),
6958
7385
  /* 会话头开关(用户口径 2026-11-08):标准模式 / 费用明细 / 子智能体 /
6959
7386
  右侧那组按钮,可以整条关掉,给窄栏腾空间。 */
@@ -6963,13 +7390,13 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6963
7390
  h(
6964
7391
  "div",
6965
7392
  { className: "dsv-card-text" },
6966
- h("div", { className: "dsv-card-title" }, "显示会话头"),
7393
+ h("div", { className: "dsv-card-title" }, t("显示会话头")),
6967
7394
  h(
6968
7395
  "div",
6969
7396
  { className: "dsv-card-desc" },
6970
7397
  p.hostBar === false
6971
- ? "已关闭:每栏不显示标题 / 标准模式 / 子智能体 / 右侧按钮那一行。"
6972
- : "已开启:每栏顶部显示标题、标准模式、子智能体、右侧按钮那一行。"
7398
+ ? t("已关闭:每栏不显示标题 / 标准模式 / 子智能体 / 右侧按钮那一行。")
7399
+ : t("已开启:每栏顶部显示标题、标准模式、子智能体、右侧按钮那一行。")
6973
7400
  )
6974
7401
  ),
6975
7402
  h("button", {
@@ -6978,7 +7405,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6978
7405
  "data-on": p.hostBar === false ? "0" : "1",
6979
7406
  role: "switch",
6980
7407
  "aria-checked": p.hostBar === false ? "false" : "true",
6981
- "aria-label": "显示会话头",
7408
+ "aria-label": t("显示会话头"),
6982
7409
  onClick: () => prefs.update({ hostBar: p.hostBar === false })
6983
7410
  })
6984
7411
  ),
@@ -6990,13 +7417,13 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6990
7417
  h(
6991
7418
  "div",
6992
7419
  { className: "dsv-card-text" },
6993
- h("div", { className: "dsv-card-title" }, "显示视图切换条"),
7420
+ h("div", { className: "dsv-card-title" }, t("显示视图切换条")),
6994
7421
  h(
6995
7422
  "div",
6996
7423
  { className: "dsv-card-desc" },
6997
7424
  p.viewBarPlacement === "off"
6998
- ? "已关闭:每栏不显示「对话 / 轨迹 / 上下文 …」那一行。"
6999
- : "已开启:每栏显示「对话 / 轨迹 / 上下文 …」那一行。位置与显示哪些视图,见下面两项。"
7425
+ ? t("已关闭:每栏不显示「对话 / 轨迹 / 上下文 …」那一行。")
7426
+ : t("已开启:每栏显示「对话 / 轨迹 / 上下文 …」那一行。位置与显示哪些视图,见下面两项。")
7000
7427
  )
7001
7428
  ),
7002
7429
  h("button", {
@@ -7005,7 +7432,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7005
7432
  "data-on": p.viewBarPlacement === "off" ? "0" : "1",
7006
7433
  role: "switch",
7007
7434
  "aria-checked": p.viewBarPlacement === "off" ? "false" : "true",
7008
- "aria-label": "显示视图切换条",
7435
+ "aria-label": t("显示视图切换条"),
7009
7436
  onClick: () =>
7010
7437
  prefs.update({ viewBarPlacement: p.viewBarPlacement === "off" ? "top" : "off" })
7011
7438
  })
@@ -7018,13 +7445,13 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7018
7445
  h(
7019
7446
  "div",
7020
7447
  { className: "dsv-card-text" },
7021
- h("div", { className: "dsv-card-title" }, "双击关闭标签"),
7448
+ h("div", { className: "dsv-card-title" }, t("双击关闭标签")),
7022
7449
  h(
7023
7450
  "div",
7024
7451
  { className: "dsv-card-desc" },
7025
7452
  p.dblclickClose === false
7026
- ? "已关闭:双击标签不关闭(中键、× 仍然可用)。"
7027
- : "已开启:双击标签直接关闭(中键、× 也可用)。"
7453
+ ? t("已关闭:双击标签不关闭(中键、× 仍然可用)。")
7454
+ : t("已开启:双击标签直接关闭(中键、× 也可用)。")
7028
7455
  )
7029
7456
  ),
7030
7457
  h("button", {
@@ -7033,7 +7460,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7033
7460
  "data-on": p.dblclickClose === false ? "0" : "1",
7034
7461
  role: "switch",
7035
7462
  "aria-checked": p.dblclickClose === false ? "false" : "true",
7036
- "aria-label": "双击关闭标签",
7463
+ "aria-label": t("双击关闭标签"),
7037
7464
  onClick: () => prefs.update({ dblclickClose: p.dblclickClose === false })
7038
7465
  })
7039
7466
  ),
@@ -7045,13 +7472,13 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7045
7472
  h(
7046
7473
  "div",
7047
7474
  { className: "dsv-card-text" },
7048
- h("div", { className: "dsv-card-title" }, "在侧边栏显示入口"),
7475
+ h("div", { className: "dsv-card-title" }, t("在侧边栏显示入口")),
7049
7476
  h(
7050
7477
  "div",
7051
7478
  { className: "dsv-card-desc" },
7052
7479
  p.showInSidebar === false
7053
- ? "已关闭:侧边栏不显示本插件入口。"
7054
- : "已开启:侧边栏显示本插件入口(默认)。"
7480
+ ? t("已关闭:侧边栏不显示本插件入口。")
7481
+ : t("已开启:侧边栏显示本插件入口(默认)。")
7055
7482
  )
7056
7483
  ),
7057
7484
  h("button", {
@@ -7060,7 +7487,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7060
7487
  "data-on": p.showInSidebar === false ? "0" : "1",
7061
7488
  role: "switch",
7062
7489
  "aria-checked": p.showInSidebar === false ? "false" : "true",
7063
- "aria-label": "在侧边栏显示入口",
7490
+ "aria-label": t("在侧边栏显示入口"),
7064
7491
  onClick: () => prefs.update({ showInSidebar: p.showInSidebar === false })
7065
7492
  })
7066
7493
  ),
@@ -7069,43 +7496,43 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7069
7496
  "div",
7070
7497
  { className: "dsv-section-head", key: "grp-line", style: { marginTop: "16px" } },
7071
7498
  h("span", { className: "dsv-section-bar", "aria-hidden": "true" }),
7072
- h("span", { className: "dsv-section-name" }, "外观"),
7073
- h("span", { className: "dsv-section-desc" }, "颜色、粗细、呼吸")
7499
+ h("span", { className: "dsv-section-name" }, t("外观")),
7500
+ h("span", { className: "dsv-section-desc" }, t("颜色、粗细、呼吸"))
7074
7501
  ),
7075
7502
  h(
7076
7503
  "p",
7077
7504
  { className: "dsv-hint", key: "grp-line-hint" },
7078
- "鼠标移到任一组上,上方预览会高亮对应元素;每组可单独换色,也可全部跟随全局色。"
7505
+ t("鼠标移到任一组上,上方预览会高亮对应元素;每组可单独换色,也可全部跟随全局色。")
7079
7506
  ),
7080
7507
  ...AppearanceControls({ prefs: p }),
7081
7508
  /* 用法提示收进虚线框,避免正文里散落一堆长句(纯排版) */
7082
7509
  h(
7083
7510
  "div",
7084
7511
  { className: "dsv-tips", key: "tips" },
7085
- h("div", { className: "dsv-tips-title" }, "怎么用"),
7512
+ h("div", { className: "dsv-tips-title" }, t("怎么用")),
7086
7513
  h(
7087
7514
  "div",
7088
7515
  { className: "dsv-tip" },
7089
7516
  h("span", { className: "dsv-tip-dot", "aria-hidden": "true" }),
7090
- h("span", null, "点左侧会话,替换当前标签;把会话拖进标签栏可新开标签。")
7517
+ h("span", null, t("点左侧会话,替换当前标签;把会话拖进标签栏可新开标签。"))
7091
7518
  ),
7092
7519
  h(
7093
7520
  "div",
7094
7521
  { className: "dsv-tip" },
7095
7522
  h("span", { className: "dsv-tip-dot", "aria-hidden": "true" }),
7096
- h("span", null, "把会话拖到两栏之间的分隔条上,会在那里拆出一栏。")
7523
+ h("span", null, t("把会话拖到两栏之间的分隔条上,会在那里拆出一栏。"))
7097
7524
  ),
7098
7525
  h(
7099
7526
  "div",
7100
7527
  { className: "dsv-tip" },
7101
7528
  h("span", { className: "dsv-tip-dot", "aria-hidden": "true" }),
7102
- h("span", null, "标签支持中键关闭、双击关闭;右键可锁定,锁定后要先解锁才能关。")
7529
+ h("span", null, t("标签支持中键关闭、双击关闭;右键可锁定,锁定后要先解锁才能关。"))
7103
7530
  ),
7104
7531
  h(
7105
7532
  "div",
7106
7533
  { className: "dsv-tip" },
7107
7534
  h("span", { className: "dsv-tip-dot", "aria-hidden": "true" }),
7108
- h("span", null, "布局和启用状态存在本机,升级插件或重启 App 后自动恢复。")
7535
+ h("span", null, t("布局和启用状态存在本机,升级插件或重启 App 后自动恢复。"))
7109
7536
  )
7110
7537
  ),
7111
7538
  /* ── 最后一块:备份与恢复(用户要求放在页面最末) ── */
@@ -7113,8 +7540,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7113
7540
  "div",
7114
7541
  { className: "dsv-section-head", key: "sec-backup", style: { marginTop: "18px" } },
7115
7542
  h("span", { className: "dsv-section-bar", "aria-hidden": "true" }),
7116
- h("span", { className: "dsv-section-name" }, "备份与恢复"),
7117
- h("span", { className: "dsv-section-desc" }, "导出 / 导入设置文件")
7543
+ h("span", { className: "dsv-section-name" }, t("备份与恢复")),
7544
+ h("span", { className: "dsv-section-desc" }, t("导出 / 导入设置文件"))
7118
7545
  ),
7119
7546
  h(PrefsBackupCard, { key: "backup" }),
7120
7547
  /* 底部「进入会话」:最面一个,和顶部那个同义。 */
@@ -7128,11 +7555,11 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7128
7555
  role: "button",
7129
7556
  tabIndex: 0,
7130
7557
  className: "dsv-enter dsv-enter-bottom",
7131
- title: "回到会话(退出设置)",
7558
+ title: t("回到会话(退出设置)"),
7132
7559
  onClick: onEnter,
7133
7560
  onKeyDown: (event) => { if (event.key === "Enter" || event.key === " ") { event.preventDefault(); onEnter(); } }
7134
7561
  },
7135
- h("span", { className: "dsv-enter-label" }, "进入会话")
7562
+ h("span", { className: "dsv-enter-label" }, t("进入会话"))
7136
7563
  )
7137
7564
  ),
7138
7565
  /* 更新弹窗:发现新版本时弹出来,版本对比 + 进度 + 一键更新/刷新,全程不用离开设置页 */
@@ -7151,7 +7578,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7151
7578
  h(
7152
7579
  "div",
7153
7580
  { className: "dsv-modal-title" },
7154
- update.phase === "done" ? "更新完成" : update.phase === "error" ? "更新没有完成" : `发现新版本 ${update.latest}`
7581
+ update.phase === "done" ? t("更新完成") : update.phase === "error" ? t("更新没有完成") : t("发现新版本 {0}", [update.latest])
7155
7582
  ),
7156
7583
  h(
7157
7584
  "div",
@@ -7159,7 +7586,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7159
7586
  h(
7160
7587
  "div",
7161
7588
  { className: "dsv-modal-row" },
7162
- h("span", null, "当前版本"),
7589
+ h("span", null, t("当前版本")),
7163
7590
  h("b", null, update.installed)
7164
7591
  ),
7165
7592
  update.phase === "done" || update.phase === "error"
@@ -7167,10 +7594,10 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7167
7594
  : h(
7168
7595
  "div",
7169
7596
  { className: "dsv-modal-row" },
7170
- h("span", null, "新版本"),
7597
+ h("span", null, t("新版本")),
7171
7598
  h("b", null, update.latest)
7172
7599
  ),
7173
- update.checkedAt !== "" ? h("div", { className: "dsv-modal-row" }, h("span", null, "检查时间"), h("b", null, update.checkedAt)) : null,
7600
+ update.checkedAt !== "" ? h("div", { className: "dsv-modal-row" }, h("span", null, t("检查时间")), h("b", null, update.checkedAt)) : null,
7174
7601
  update.progress === null || update.progress === void 0
7175
7602
  ? null
7176
7603
  : h(
@@ -7201,13 +7628,13 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7201
7628
  }
7202
7629
  }
7203
7630
  },
7204
- "刷新页面"
7631
+ t("刷新页面")
7205
7632
  )
7206
7633
  : [
7207
7634
  h(
7208
7635
  "button",
7209
7636
  { key: "later", type: "button", onClick: closeModal },
7210
- "稍后"
7637
+ t("稍后")
7211
7638
  ),
7212
7639
  h(
7213
7640
  "button",
@@ -7217,7 +7644,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7217
7644
  "data-primary": "1",
7218
7645
  onClick: update.canUpdate === true ? () => runUpdate() : () => checkUpdate()
7219
7646
  },
7220
- update.canUpdate === true ? "立即更新" : "重新检查"
7647
+ update.canUpdate === true ? t("立即更新") : t("重新检查")
7221
7648
  )
7222
7649
  ]
7223
7650
  )
@@ -7244,7 +7671,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7244
7671
  h(
7245
7672
  "div",
7246
7673
  { className: "dsv-market-head" },
7247
- h("span", { className: "dsv-market-title" }, "插件市场 · 已安装"),
7674
+ h("span", { className: "dsv-market-title" }, t("插件市场 · 已安装")),
7248
7675
  h(
7249
7676
  "button",
7250
7677
  {
@@ -7254,7 +7681,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7254
7681
  setMarketOpen(false);
7255
7682
  }
7256
7683
  },
7257
- "关闭"
7684
+ t("关闭")
7258
7685
  )
7259
7686
  ),
7260
7687
  h("div", { className: "dsv-market-body" }, renderMarketPanel())
@@ -7305,21 +7732,21 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7305
7732
  h(
7306
7733
  "p",
7307
7734
  { style: { margin: 0, fontSize: "13px", lineHeight: 1.65, opacity: 0.72 } },
7308
- "启用后,对话区会变成 Hermes 式工作区:顶部一条标签栏,可并排多个会话,每个会话都有独立输入框。"
7735
+ t("启用后,对话区会变成 Hermes 式工作区:顶部一条标签栏,可并排多个会话,每个会话都有独立输入框。")
7309
7736
  ),
7310
- switchCard(`启用${PLUGIN_LABEL}`, p.enabled ? "已启用" : "未启用(保持原生单栏对话)", p.enabled === true, `启用${PLUGIN_LABEL}`, toggle),
7737
+ switchCard(t("启用{0}", [pluginName()]), p.enabled ? t("已启用") : t("未启用(保持原生单栏对话)"), p.enabled === true, t("启用{0}", [pluginName()]), toggle),
7311
7738
  switchCard(
7312
- "在侧边栏显示入口",
7313
- p.showInSidebar === false ? "已关闭:侧边栏不显示本插件入口。" : "已开启:侧边栏显示本插件入口(默认)。",
7739
+ t("在侧边栏显示入口"),
7740
+ p.showInSidebar === false ? t("已关闭:侧边栏不显示本插件入口。") : t("已开启:侧边栏显示本插件入口(默认)。"),
7314
7741
  p.showInSidebar !== false,
7315
- "在侧边栏显示入口",
7742
+ t("在侧边栏显示入口"),
7316
7743
  () => prefs.update({ showInSidebar: p.showInSidebar === false })
7317
7744
  ),
7318
7745
  switchCard(
7319
- "双击关闭标签",
7320
- p.dblclickClose === false ? "已关闭:双击标签不关闭(中键、× 仍然可用)。" : "已开启:双击标签直接关闭(中键、× 也可用)。",
7746
+ t("双击关闭标签"),
7747
+ p.dblclickClose === false ? t("已关闭:双击标签不关闭(中键、× 仍然可用)。") : t("已开启:双击标签直接关闭(中键、× 也可用)。"),
7321
7748
  p.dblclickClose !== false,
7322
- "双击关闭标签",
7749
+ t("双击关闭标签"),
7323
7750
  () => prefs.update({ dblclickClose: p.dblclickClose === false })
7324
7751
  ),
7325
7752
  ...ViewBarControls({ prefs: p }),
@@ -7332,7 +7759,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7332
7759
  h(
7333
7760
  "p",
7334
7761
  { style: { margin: 0, fontSize: "12.5px", lineHeight: 1.7, opacity: 0.55 } },
7335
- "要回到会话:点左侧栏的「多栏视图」,或直接关掉本设置页。完整的外观设置在「多栏视图」里。"
7762
+ t("要回到会话:点左侧栏的「多栏视图」,或直接关掉本设置页。完整的外观设置在「多栏视图」里。")
7336
7763
  )
7337
7764
  );
7338
7765
  }
@@ -8578,6 +9005,23 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
8578
9005
  installStyles();
8579
9006
  syncSettingsFlag();
8580
9007
  SERVICES.ctx = ctx;
9008
+ /* 语言跟随宿主:DSH 设置里切中/英,本插件所有文案立刻跟着变(无需 reload)。 */
9009
+ ctx.effect(() => {
9010
+ I18N.ctx = ctx;
9011
+ syncLang();
9012
+ let off = null;
9013
+ try {
9014
+ const locale = ctx.get?.("locale");
9015
+ if (locale !== void 0 && locale !== null && typeof locale.subscribe === "function") {
9016
+ off = locale.subscribe(() => syncLang());
9017
+ }
9018
+ } catch {
9019
+ off = null;
9020
+ }
9021
+ return () => {
9022
+ if (typeof off === "function") off();
9023
+ };
9024
+ }, "dsh-split-view: follow host locale");
8581
9025
  /* 卸载时把写在 <html> 上的线条变量清掉(应用退出 / 插件重载)。 */
8582
9026
  ctx.effect(() => {
8583
9027
  applyLineVars();
@@ -8585,14 +9029,60 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
8585
9029
  }, "dsh-split-view: line color vars");
8586
9030
 
8587
9031
  /* 拖放定向:接管宿主的 `conversation.input.attachments` 槽位。
9032
+ **只在总开关打开时接管**:关掉插件后,宿主的附件栏、拖放、加号选文件必须全部原样工作。
8588
9033
  拿得到宿主原组件才接管;拿不到(宿主升级改了槽位形状)就不注册,
8589
9034
  行为退回宿主默认(多栏拖文件仍会加到每一栏),不会更差。 */
8590
9035
  ctx.effect(() => {
8591
9036
  let stopTracking = null;
8592
9037
  let disposeSlot = null;
9038
+ let sub = null;
9039
+ let active = false;
9040
+ /* 完全退场:拆监听、注销槽位、断开 inject 订阅、清掉每栏的接收入口。
9041
+ 重新打开时 sync() 会把这些原样装回来。 */
9042
+ const teardown = () => {
9043
+ active = false;
9044
+ if (stopTracking !== null) {
9045
+ try {
9046
+ stopTracking();
9047
+ } catch {
9048
+ /* 忽略 */
9049
+ }
9050
+ stopTracking = null;
9051
+ }
9052
+ if (disposeSlot !== null) {
9053
+ try {
9054
+ disposeSlot();
9055
+ } catch {
9056
+ /* 忽略 */
9057
+ }
9058
+ disposeSlot = null;
9059
+ }
9060
+ if (typeof sub === "function") {
9061
+ try {
9062
+ sub();
9063
+ } catch {
9064
+ /* 忽略 */
9065
+ }
9066
+ sub = null;
9067
+ }
9068
+ try {
9069
+ PANE_INTAKE.clear();
9070
+ } catch {
9071
+ /* 忽略 */
9072
+ }
9073
+ HOST_ATTACHMENTS = null;
9074
+ HOST_ATTACH_INJECT = {};
9075
+ try {
9076
+ setDropPaneTarget(null);
9077
+ setDragActiveFlag(false);
9078
+ } catch {
9079
+ /* 忽略 */
9080
+ }
9081
+ };
8593
9082
  /* 真正接管。宿主那个槽位可能比本插件晚注册,所以「读 entry + 注册」必须
8594
9083
  放在 inject 回调里等它就绪,不能在 effect 顶层直接读。 */
8595
9084
  const attach = () => {
9085
+ if (active !== true) return;
8596
9086
  if (disposeSlot !== null) return;
8597
9087
  const slots = service("slots");
8598
9088
  const entry = (slots?.entries?.("conversation.input.attachments") ?? [])[0];
@@ -8613,45 +9103,45 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
8613
9103
  SplitAttachmentsSlot
8614
9104
  );
8615
9105
  };
8616
- let sub = null;
8617
- try {
8618
- sub = ctx.slots.inject("conversation.input.attachments", attach);
8619
- } catch (error) {
8620
- console.warn("[split-view] 附件槽位 inject 失败:", error);
8621
- }
8622
- /* 槽位若已就绪,inject 可能已同步回调;再补一次幂等尝试。 */
8623
- try {
8624
- attach();
8625
- } catch (error) {
8626
- console.warn("[split-view] 接管附件槽位失败,拖放定向未启用:", error);
8627
- }
8628
- if (disposeSlot === null) {
8629
- console.warn("[split-view] 未找到应用附件槽位组件,拖放定向未启用(多栏拖文件仍会加到每一栏)");
8630
- }
8631
- return () => {
8632
- if (stopTracking !== null) {
8633
- try {
8634
- stopTracking();
8635
- } catch {
8636
- /* 忽略 */
9106
+ const sync = () => {
9107
+ const want = prefs.state.enabled === true;
9108
+ if (want === active) {
9109
+ if (want === true) {
9110
+ try {
9111
+ attach();
9112
+ } catch {
9113
+ /* 忽略 */
9114
+ }
8637
9115
  }
9116
+ return;
8638
9117
  }
8639
- if (typeof sub === "function") {
8640
- try {
8641
- sub();
8642
- } catch {
8643
- /* 忽略 */
8644
- }
9118
+ if (want !== true) {
9119
+ teardown();
9120
+ return;
8645
9121
  }
8646
- if (disposeSlot !== null) {
9122
+ active = true;
9123
+ try {
9124
+ sub = ctx.slots.inject("conversation.input.attachments", attach);
9125
+ } catch (error) {
9126
+ console.warn("[split-view] 附件槽位 inject 失败:", error);
9127
+ }
9128
+ try {
9129
+ attach();
9130
+ } catch (error) {
9131
+ console.warn("[split-view] 接管附件槽位失败,拖放定向未启用:", error);
9132
+ }
9133
+ };
9134
+ const off = prefs.subscribe(sync);
9135
+ sync();
9136
+ return () => {
9137
+ if (typeof off === "function") {
8647
9138
  try {
8648
- disposeSlot();
9139
+ off();
8649
9140
  } catch {
8650
9141
  /* 忽略 */
8651
9142
  }
8652
9143
  }
8653
- HOST_ATTACHMENTS = null;
8654
- HOST_ATTACH_INJECT = {};
9144
+ teardown();
8655
9145
  };
8656
9146
  }, "dsh-split-view: attachments drop routing");
8657
9147
 
@@ -8685,7 +9175,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
8685
9175
  return [
8686
9176
  {
8687
9177
  id: "dsv-tab-lock",
8688
- label: locked ? "解锁标签" : "锁定标签",
9178
+ label: locked ? t("解锁标签") : t("锁定标签"),
8689
9179
  separatorBefore: true,
8690
9180
  run: () => {
8691
9181
  if (typeof LIVE_APPLY !== "function") return;
@@ -8734,7 +9224,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
8734
9224
  name: "sidebar.panellist",
8735
9225
  id: PANEL_ID,
8736
9226
  order: 55,
8737
- label: () => PLUGIN_LABEL
9227
+ label: () => pluginName()
8738
9228
  },
8739
9229
  PanelIcon
8740
9230
  )
@@ -8773,7 +9263,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
8773
9263
  name: "settings.section",
8774
9264
  id: PANEL_ID,
8775
9265
  order: 60,
8776
- label: () => PLUGIN_LABEL
9266
+ label: () => pluginName()
8777
9267
  },
8778
9268
  SettingsSection
8779
9269
  )