@huaqiu/dsh-tool-plugin-update 0.5.22 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +32 -10
- package/lib/client.js.map +1 -1
- package/package.json +3 -3
- package/src/client/index.ts +6 -8
package/lib/client.js
CHANGED
|
@@ -64,15 +64,40 @@ window.__ModuleLoader__.load({
|
|
|
64
64
|
applyBadge
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Re-insert the entry after the New Session row, in the family's intended
|
|
69
|
+
* order.
|
|
70
|
+
*
|
|
71
|
+
* The `familySelectors` array order is the single source of truth for visual
|
|
72
|
+
* order, so the rendered order is stable regardless of which plugin mounts
|
|
73
|
+
* first or of observer callback order — a re-render can never swap two rows.
|
|
74
|
+
* (Earlier builds used the `position: 'before' | 'after'` convention, which
|
|
75
|
+
* clustered rows by mount order and let a late-mounting `before` row steal the
|
|
76
|
+
* lead. The array order supersedes it; `position` remains only as a fallback
|
|
77
|
+
* for a row whose selector is absent from the family list.)
|
|
78
|
+
*/
|
|
68
79
|
function placeEntry(root, entry, options) {
|
|
69
80
|
const button = newSessionButton(root);
|
|
70
81
|
if (button === void 0) return false;
|
|
71
82
|
if (entry.parentElement !== root) {
|
|
72
83
|
const row = button.closest("[class*=\"logoRow\"]");
|
|
73
84
|
const base = row !== null && row.parentElement === root ? row : button;
|
|
74
|
-
const
|
|
75
|
-
const
|
|
85
|
+
const order = options.familySelectors;
|
|
86
|
+
const present = Array.from(root.children).filter((el) => el instanceof HTMLElement && el.matches(order.join(", "))).map((el) => ({
|
|
87
|
+
el,
|
|
88
|
+
idx: order.findIndex((sel) => el.matches(sel))
|
|
89
|
+
}));
|
|
90
|
+
const selfIndex = order.indexOf(options.rowSelector);
|
|
91
|
+
let anchor;
|
|
92
|
+
if (selfIndex === -1) anchor = options.position === "before" ? present.length > 0 ? present[0].el : base.nextElementSibling : present.length > 0 ? present[present.length - 1].el.nextElementSibling : base.nextElementSibling;
|
|
93
|
+
else {
|
|
94
|
+
const later = present.find((member) => member.idx > selfIndex);
|
|
95
|
+
if (later !== void 0) anchor = later.el;
|
|
96
|
+
else {
|
|
97
|
+
const earlier = [...present].reverse().find((member) => member.idx < selfIndex);
|
|
98
|
+
anchor = earlier !== void 0 ? earlier.el.nextElementSibling : base.nextElementSibling;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
76
101
|
root.insertBefore(entry, anchor ?? null);
|
|
77
102
|
}
|
|
78
103
|
return true;
|
|
@@ -158,10 +183,11 @@ window.__ModuleLoader__.load({
|
|
|
158
183
|
* family row means adding its selector here (and to no plugin-local list).
|
|
159
184
|
*/
|
|
160
185
|
const HUAQIU_SIDEBAR_ENTRY_FAMILY = [
|
|
186
|
+
"[data-hq-plugin-update-entry]",
|
|
161
187
|
"[data-hqcg-footprint-entry]",
|
|
162
188
|
"[data-hqcg-symbol-entry]",
|
|
163
189
|
"[data-hqcg-schematic-entry]",
|
|
164
|
-
"[data-hq-
|
|
190
|
+
"[data-hq-dummy-entry]"
|
|
165
191
|
];
|
|
166
192
|
/**
|
|
167
193
|
* Read the host UI language from `<html lang>`.
|
|
@@ -1815,10 +1841,6 @@ window.__ModuleLoader__.load({
|
|
|
1815
1841
|
fn();
|
|
1816
1842
|
} catch {}
|
|
1817
1843
|
});
|
|
1818
|
-
const labelState = {
|
|
1819
|
-
label: entryCopy(locale).label,
|
|
1820
|
-
tooltip: entryCopy(locale).tooltip
|
|
1821
|
-
};
|
|
1822
1844
|
const openView = () => {
|
|
1823
1845
|
ensureDesignTokens();
|
|
1824
1846
|
store.check().then((report) => {
|
|
@@ -1831,8 +1853,8 @@ window.__ModuleLoader__.load({
|
|
|
1831
1853
|
plugin: PLUGIN_ID,
|
|
1832
1854
|
icon: UPDATE_ICON,
|
|
1833
1855
|
css: ENTRY_CSS,
|
|
1834
|
-
label: () =>
|
|
1835
|
-
tooltip: () =>
|
|
1856
|
+
label: () => entryCopy(locale).label,
|
|
1857
|
+
tooltip: () => entryCopy(locale).tooltip,
|
|
1836
1858
|
refresh: { subscribe: refreshSubscribe },
|
|
1837
1859
|
badge: {
|
|
1838
1860
|
subscribe: (listener) => store.subscribe(listener),
|
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":[],"sources":["../../dsh-sidebar-entry/lib/index.mjs","../src/client/api.ts","../src/client/copy.ts","../src/client/icons.ts","../src/client/update-view.ts","../src/client/index.ts"],"sourcesContent":["//#region src/index.ts\n/** Find the sidebar shell root element, or undefined while not yet mounted. */\nfunction sidebarRoot() {\n\tconst column = document.querySelector(\"[data-pane=\\\"sidebar\\\"], [class*=\\\"sidebarCol\\\"]\");\n\tif (column === null) return void 0;\n\treturn column.querySelector(\"[class*=\\\"logoRow\\\"]\")?.parentElement ?? column.firstElementChild;\n}\n/** The New Session button: nested in the logo row on current shells, a direct child on legacy shells. */\nfunction newSessionButton(root) {\n\tconst nested = root.querySelector(\"button[class*=\\\"newSession\\\"]\");\n\tif (nested !== null) return nested;\n\tfor (const child of root.children) if (child.tagName === \"BUTTON\") return child;\n}\n/** Build the entry row (a detached button; insert once the shell is up). */\nfunction createEntry(options) {\n\tconst entry = document.createElement(\"button\");\n\tentry.type = \"button\";\n\tentry.setAttribute(options.rowAttribute, \"\");\n\tif (options.plugin !== void 0) {\n\t\tentry.setAttribute(\"data-dsh-plugin\", options.plugin);\n\t\tentry.setAttribute(\"data-dsh-part\", \"sidebar-entry\");\n\t}\n\tentry.className = options.css[\"entry\"] ?? \"\";\n\tconst labelSpan = document.createElement(\"span\");\n\tlabelSpan.className = options.css[\"entryLabel\"] ?? \"\";\n\tconst iconSpan = document.createElement(\"span\");\n\ticonSpan.className = options.css[\"entryIcon\"] ?? \"\";\n\ticonSpan.innerHTML = options.icon;\n\tentry.append(iconSpan, labelSpan);\n\tlet badgeSpan = null;\n\tconst applyBadge = () => {\n\t\tif (options.badge === void 0) return;\n\t\tconst count = options.badge.count();\n\t\tif (count <= 0) {\n\t\t\tbadgeSpan?.remove();\n\t\t\tbadgeSpan = null;\n\t\t\treturn;\n\t\t}\n\t\tif (badgeSpan === null) {\n\t\t\tbadgeSpan = document.createElement(\"span\");\n\t\t\tbadgeSpan.className = options.css[\"entryBadge\"] ?? \"\";\n\t\t\tentry.append(badgeSpan);\n\t\t}\n\t\tbadgeSpan.textContent = String(count);\n\t\tentry.setAttribute(\"data-has-badge\", \"\");\n\t};\n\tconst applyLabel = () => {\n\t\tentry.setAttribute(\"aria-label\", options.label());\n\t\tif (options.tooltip !== void 0) entry.setAttribute(\"title\", options.tooltip());\n\t\tlabelSpan.textContent = options.label();\n\t};\n\tapplyLabel();\n\tapplyBadge();\n\tentry.addEventListener(\"click\", options.onToggle);\n\treturn {\n\t\tentry,\n\t\tapplyLabel,\n\t\tapplyBadge\n\t};\n}\n/** Re-insert the entry after the New Session row (before the browser region). */\nfunction placeEntry(root, entry, options) {\n\tconst button = newSessionButton(root);\n\tif (button === void 0) return false;\n\tif (entry.parentElement !== root) {\n\t\tconst row = button.closest(\"[class*=\\\"logoRow\\\"]\");\n\t\tconst base = row !== null && row.parentElement === root ? row : button;\n\t\tconst family = Array.from(root.children).filter((el) => el instanceof HTMLElement && el.matches(options.familySelectors.join(\", \")));\n\t\tconst anchor = options.position === \"before\" ? family.length > 0 ? family[0] : base.nextElementSibling : family.length > 0 ? family[family.length - 1].nextElementSibling : base.nextElementSibling;\n\t\troot.insertBefore(entry, anchor ?? null);\n\t}\n\treturn true;\n}\n/**\n* Mount the sidebar entry, waiting for the shell to render and self-healing\n* on later React re-renders.\n* @param options - the row's attribute/icon/copy/action/ordering configuration.\n* @returns disposer removing the entry and its observers.\n*/\nfunction mountSidebarEntry(options) {\n\tif (typeof document !== \"undefined\" && document.querySelector(options.rowSelector) !== null) return () => {};\n\tconst { entry, applyLabel, applyBadge } = createEntry(options);\n\tlet root;\n\tlet placed = false;\n\tlet unsubscribeRefresh;\n\tif (options.refresh !== void 0) try {\n\t\tunsubscribeRefresh = options.refresh.subscribe(applyLabel);\n\t} catch {}\n\tlet unsubscribeBadge;\n\tif (options.badge !== void 0) try {\n\t\tunsubscribeBadge = options.badge.subscribe(applyBadge);\n\t} catch {}\n\tconst tryPlace = () => {\n\t\tif (root !== void 0 && !root.isConnected) {\n\t\t\trootObserver.disconnect();\n\t\t\troot = void 0;\n\t\t\tplaced = false;\n\t\t}\n\t\tif (placed) {\n\t\t\tif (document.body.contains(entry)) return;\n\t\t\trootObserver.disconnect();\n\t\t\troot = void 0;\n\t\t\tplaced = false;\n\t\t}\n\t\troot ??= sidebarRoot();\n\t\tif (root === void 0) return;\n\t\tplaced = placeEntry(root, entry, options);\n\t\tif (placed) rootObserver.observe(root, {\n\t\t\tchildList: true,\n\t\t\tsubtree: true\n\t\t});\n\t};\n\tconst waitObserver = new MutationObserver(() => {\n\t\ttryPlace();\n\t});\n\twaitObserver.observe(document.body, {\n\t\tchildList: true,\n\t\tsubtree: true\n\t});\n\tconst rootObserver = new MutationObserver(() => {\n\t\tif (root === void 0 || !root.isConnected) {\n\t\t\tplaced = false;\n\t\t\ttryPlace();\n\t\t\treturn;\n\t\t}\n\t\tif (!root.contains(entry)) placed = placeEntry(root, entry, options);\n\t});\n\toptions.active === void 0 || (() => {\n\t\tconst syncActive = () => {\n\t\t\tif (options.active.isOpen()) entry.dataset.active = \"true\";\n\t\t\telse delete entry.dataset.active;\n\t\t};\n\t\tconst unsubscribe = options.active.subscribe(syncActive);\n\t\tsyncActive();\n\t\treturn unsubscribe;\n\t})();\n\ttryPlace();\n\treturn () => {\n\t\twaitObserver.disconnect();\n\t\trootObserver.disconnect();\n\t\tunsubscribeRefresh?.();\n\t\tunsubscribeBadge?.();\n\t\tentry.remove();\n\t};\n}\n/**\n* Every row selector in the Huaqiu sidebar family, in intended visual order.\n*\n* Family ordering is only stable when every participating plugin passes the\n* SAME list to {@link mountSidebarEntry} — the core positions a row relative to\n* the family block, never relative to transient shell geometry. Adding a new\n* family row means adding its selector here (and to no plugin-local list).\n*/\nconst HUAQIU_SIDEBAR_ENTRY_FAMILY = [\n\t\"[data-hqcg-footprint-entry]\",\n\t\"[data-hqcg-symbol-entry]\",\n\t\"[data-hqcg-schematic-entry]\",\n\t\"[data-hq-plugin-update-entry]\"\n];\n/**\n* Read the host UI language from `<html lang>`.\n*\n* `dsh-client-locale` rewrites the attribute on every language change (dsh\n* web) and HQ Edge mirrors it, so this is the one source every family plugin\n* can read without importing a `locale` service.\n* @returns 'zh' / 'en', or undefined when the tag is absent or unsupported\n* (callers fall back to their own default).\n*/\nfunction detectHostLocale() {\n\tif (typeof document === \"undefined\") return void 0;\n\tconst tag = document.documentElement?.getAttribute(\"lang\");\n\tif (tag === null || tag === void 0 || tag === \"\") return void 0;\n\tconst primary = tag.toLowerCase().split(\"-\")[0];\n\treturn primary === \"zh\" || primary === \"en\" ? primary : void 0;\n}\n/**\n* Watch `<html lang>` and report every resolved change.\n*\n* Idempotent-safe: repeated calls share one observer and each caller gets its\n* own disposer; the observer disconnects when the last listener leaves.\n* @param listener - called with the newly resolved language.\n* @returns disposer removing this listener.\n*/\n/** Shared observer/listener set backing {@link observeHostLocale}. */\nconst localeListeners = /* @__PURE__ */ new Set();\nlet localeObserver = null;\nfunction observeHostLocale(listener) {\n\tif (typeof document === \"undefined\" || typeof MutationObserver === \"undefined\" || document.documentElement === null) return () => {};\n\tlet current = detectHostLocale();\n\tconst listeners = localeListeners;\n\tlisteners.add(listener);\n\tif (localeObserver === null) {\n\t\tlocaleObserver = new MutationObserver(() => {\n\t\t\tconst next = detectHostLocale();\n\t\t\tif (next === current) return;\n\t\t\tcurrent = next;\n\t\t\tfor (const fn of [...listeners]) try {\n\t\t\t\tfn(next);\n\t\t\t} catch {}\n\t\t});\n\t\tlocaleObserver.observe(document.documentElement, {\n\t\t\tattributes: true,\n\t\t\tattributeFilter: [\"lang\"]\n\t\t});\n\t}\n\treturn () => {\n\t\tlisteners.delete(listener);\n\t\tif (listeners.size === 0 && localeObserver !== null) {\n\t\t\tlocaleObserver.disconnect();\n\t\t\tlocaleObserver = null;\n\t\t}\n\t};\n}\n//#endregion\nexport { HUAQIU_SIDEBAR_ENTRY_FAMILY, detectHostLocale, mountSidebarEntry, observeHostLocale };\n","/**\n * Plugin-update API client (browser half).\n *\n * Every call is a same-origin fetch against the DSH webServer prefix route\n * (`/api/v1/huaqiu/plugin-update/…`) which the node half forwards to hq-edge.\n * Response shapes mirror hq-edge `apps/server/src/routes/plugin-updates.ts`.\n *\n * @module\n */\n\nexport const UPDATE_BASE = '/api/v1/huaqiu/plugin-update'\n\nexport interface PluginUpdateItem {\n name: string\n /** Version installed in the active bundle; null when the plugin is absent. */\n currentVersion: string | null\n availableVersion: string\n state: 'current' | 'update' | 'install' | 'blocked' | 'ignored'\n /** The block reason, or null when the item is not blocked. The server sends a\n * single code (`\"runtime-unknown\"`), so it is normalized before use. */\n blockedBy?: string | string[] | null\n ignored?: boolean\n reasons?: string[]\n notes?: string[]\n}\n\nexport interface RuntimeUpdateInfo {\n configured: boolean\n currentVersion?: string | null\n latest?: string | null\n updateAvailable: boolean\n checkedAt?: string | null\n lastError?: string | null\n}\n\nexport interface PluginUpdateReport {\n /** The evaluated release set; null while no manifest has been read. */\n manifestVersion: string | null\n pluginSetVersion?: string\n items: PluginUpdateItem[]\n actionableCount: number\n ignoredSet: boolean\n fetchedAt?: string\n lastError?: string | null\n runtime: RuntimeUpdateInfo\n}\n\nasync function request<T>(path: string, init?: RequestInit): Promise<T> {\n const res = await fetch(`${UPDATE_BASE}${path}`, {\n cache: 'no-store',\n ...init,\n headers: { 'content-type': 'application/json; charset=utf-8', ...(init?.headers ?? {}) },\n })\n const body = (await res.json().catch(() => null)) as T | null\n if (!res.ok) {\n const err = (body as { error?: string } | null)?.error ?? `HTTP ${res.status}`\n throw new Error(err)\n }\n if (body === null) throw new Error('empty response')\n return body\n}\n\n/** GET the cached (or empty-shell) plugin-update report. */\nexport function fetchReport(): Promise<PluginUpdateReport> {\n return request<PluginUpdateReport>('/report')\n}\n\n/** POST an explicit refresh; returns the freshly computed report. */\nexport function checkUpdates(): Promise<PluginUpdateReport> {\n return request<PluginUpdateReport>('/check', { method: 'POST' })\n}\n\nexport interface InstallResult {\n ok: boolean\n installedSetVersion?: string\n installed?: number\n skipped?: number\n restarting?: boolean\n error?: string\n}\n\n/** POST the install transaction for the confirmed set version. */\nexport function installSet(setVersion: string): Promise<InstallResult> {\n return request<InstallResult>('/install', {\n method: 'POST',\n body: JSON.stringify({ setVersion }),\n })\n}\n\n/** POST ignore for the current offer (set-scoped, persists across restarts). */\nexport function ignoreOffer(setVersion: string): Promise<unknown> {\n return request<unknown>('/ignore', { method: 'POST', body: JSON.stringify({ setVersion }) })\n}\n\n/** POST unignore for the set version (reverses an ignore). */\nexport function unignoreOffer(setVersion: string): Promise<unknown> {\n return request<unknown>('/unignore', { method: 'POST', body: JSON.stringify({ setVersion }) })\n}\n","/**\n * Localized copy for the plugin-update UI (browser half).\n *\n * zh is the fallback, matching the rest of the Huaqiu plugin family\n * (`<html lang>` drives the resolution via the shared sidebar-entry locale\n * helpers). The wording follows the shell's own plugin manager\n * (`ui-plugin-manager/src/client/locales.ts`) so both read as one product.\n *\n * @module\n */\n\nconst zh = {\n entryLabel: '插件更新',\n entryTooltip: '查看可用的插件更新',\n viewTitle: '插件更新',\n viewIntro: '检查并安装可用的插件更新',\n viewInfo: '在这里查看插件集的更新。标注为「被阻止」的插件因主机或 HQ Edge 版本不兼容而无法安装;已是最新的插件无需操作。',\n refresh: '刷新',\n close: '关闭',\n loading: '正在读取插件更新…',\n empty: '没有可用的插件更新',\n checkFailed: '检查更新失败,请重试',\n installAll: (count: number) => `安装 ${count} 项更新`,\n installOne: '安装',\n installing: '正在安装…(DSH 将自动重启)',\n nothingToInstall: '暂无可安装的更新',\n ignore: '忽略此版本',\n unignore: '恢复提醒',\n ignoredOffer: '已忽略当前插件集更新',\n groupCount: (count: number) => `${count} 个插件`,\n group: {\n actionable: '待处理',\n blocked: '无法安装',\n ignored: '已忽略',\n current: '已是最新',\n },\n state: {\n current: '当前',\n update: '可更新',\n install: '待安装',\n ignored: '已忽略',\n blocked: '被阻止',\n },\n blockedReason: {\n host: '不适用于当前 EDA 主机',\n 'hq-edge-version': '当前 HQ Edge 版本不兼容',\n 'runtime-unknown': 'HQ Edge 版本未知,无法校验',\n },\n runtime: {\n title: 'HQ Edge 运行时',\n current: '当前版本',\n latest: '最新版本',\n set: '发布插件集',\n checkedAt: '上次检查',\n source: '更新源',\n unknown: '版本未知',\n notConfigured: '未配置更新源',\n note: '运行时更新由 EDA 安装器处理',\n },\n lastError: '上次检查失败',\n installError: '安装失败',\n installSuccess: '更新已安装,正在重启 DSH…',\n}\n\nexport type UpdateCopy = typeof zh\n\nconst en: UpdateCopy = {\n entryLabel: 'Plugin Updates',\n entryTooltip: 'Review available plugin updates',\n viewTitle: 'Plugin Updates',\n viewIntro: 'Check for and install available plugin updates',\n viewInfo: 'Review the plugin set updates here. A plugin marked Blocked cannot be installed because its host or HQ Edge version is incompatible; a plugin marked Current needs no action.',\n refresh: 'Refresh',\n close: 'Close',\n loading: 'Reading plugin updates…',\n empty: 'No plugin updates available',\n checkFailed: 'Failed to check for updates — please retry',\n installAll: (count: number) => `Install ${count} update${count === 1 ? '' : 's'}`,\n installOne: 'Install',\n installing: 'Installing… (DSH will restart)',\n nothingToInstall: 'Nothing to install right now',\n ignore: 'Ignore this release',\n unignore: 'Show again',\n ignoredOffer: 'The current plugin-set update is ignored',\n groupCount: (count: number) => `${count} plugin${count === 1 ? '' : 's'}`,\n group: {\n actionable: 'Actionable',\n blocked: 'Blocked',\n ignored: 'Ignored',\n current: 'Up to date',\n },\n state: {\n current: 'Current',\n update: 'Update',\n install: 'Install',\n ignored: 'Ignored',\n blocked: 'Blocked',\n },\n blockedReason: {\n host: 'Not applicable to the current EDA host',\n 'hq-edge-version': 'Incompatible with the current HQ Edge version',\n 'runtime-unknown': 'HQ Edge version unknown — cannot verify',\n },\n runtime: {\n title: 'HQ Edge Runtime',\n current: 'Current version',\n latest: 'Latest version',\n set: 'Release set',\n checkedAt: 'Last checked',\n source: 'Update source',\n unknown: 'Version unknown',\n notConfigured: 'No update source configured',\n note: 'Runtime updates are handled by the EDA installer',\n },\n lastError: 'Last check failed',\n installError: 'Install failed',\n installSuccess: 'Update installed — restarting DSH…',\n}\n\nexport const COPY = { zh, en } as const\n","/**\n * Official DSH icon artwork, inlined as SVG strings.\n *\n * The paths are copied verbatim from `@deepseek-ai/dsh-client-ui-primitives`\n * (deepseek-harness `packages/client/ui-primitives/src/icons/index.tsx`) so the\n * Huaqiu plugin-update view draws the same glyphs as the shell's own plugin\n * manager. Only `currentColor` is used, so every glyph inherits the label ink\n * of whatever surface it sits on — the same contract the primitives rely on.\n *\n * The plugin renders plain DOM (never a React tree), so the artwork is exposed\n * as markup strings rather than components.\n *\n * @module\n */\n\n/** Stroke width of the primitives' \"Regular\" weight. */\nconst REGULAR = 1\n\n/** Stroke width of the primitives' \"Medium\" weight. */\nconst MEDIUM = 1.3\n\n/** Wrap paths in a 16×16 stroked glyph. */\nfunction glyph(size: number, strokeWidth: number, paths: readonly string[], viewBox = '0 0 16 16'): string {\n const body = paths.map((d) => `<path d=\"${d}\" stroke=\"currentColor\" />`).join('')\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${size}\" height=\"${size}\" viewBox=\"${viewBox}\" fill=\"none\" aria-hidden=\"true\" stroke-width=\"${strokeWidth}\" stroke-linecap=\"round\" stroke-linejoin=\"round\">${body}</svg>`\n}\n\n/** Wrap fill-only paths (the check glyph) in their own viewBox. */\nfunction fillGlyph(size: number, paths: readonly string[], viewBox: string): string {\n const body = paths.map((d) => `<path d=\"${d}\" fill=\"currentColor\" />`).join('')\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${size}\" height=\"${size}\" viewBox=\"${viewBox}\" fill=\"none\" aria-hidden=\"true\">${body}</svg>`\n}\n\n/**\n * The plugin pinwheel — the glyph the shell's own Plugins sidebar entry uses\n * (`IconPluginPinwheelOutlineRegular`). Shared by the sidebar row and the\n * package cards so both read as the same feature.\n */\nexport const PLUGIN_ICON = (size = 16): string =>\n glyph(size, REGULAR, [\n 'M7.84457 5.06199C11.6605 4.93876 14.7962 6.14848 14.8484 7.76397C14.8875 8.97461 13.1838 10.0696 10.7215 10.5942',\n 'M5.12742 8.07731C5.00419 4.26138 6.21391 1.12568 7.8294 1.07351C9.04004 1.03441 10.135 2.73808 10.6596 5.20037',\n 'M8.02457 10.6802C4.20865 10.8034 1.07294 9.5937 1.02077 7.97821C0.981678 6.76758 2.68535 5.67262 5.14763 5.14798',\n 'M10.7476 7.89535C10.8708 11.7113 9.66109 14.847 8.0456 14.8991C6.83496 14.9382 5.74 13.2346 5.21536 10.7723',\n ])\n\n/** The toolbar's refresh action (`IconRefreshOutlineRegular`). */\nexport const REFRESH_ICON = (size = 16): string =>\n glyph(size, REGULAR, [\n 'M14.5001 8C14.5 9.28552 14.1188 10.5422 13.4045 11.611C12.6903 12.6799 11.6752 13.5129 10.4875 14.0049C9.29982 14.4968 7.99295 14.6255 6.73212 14.3747C5.4713 14.124 4.31314 13.505 3.4041 12.596C2.49514 11.687 1.87614 10.5288 1.62537 9.26798C1.37459 8.00716 1.50331 6.70028 1.99525 5.51261C2.48719 4.32494 3.32025 3.30981 4.3891 2.59557C5.45795 1.88134 6.71458 1.50008 8.0001 1.5C9.9001 1.5 11.7001 2.3 13.0001 3.6L14.5001 5.1',\n 'M14.4999 1.5V5.1H10.8999',\n ])\n\n/** The panel's close action (`IconCloseOutlineMedium`). */\nexport const CLOSE_ICON = (size = 16): string =>\n glyph(size, MEDIUM, ['M2.5 2.5L13.5 13.5', 'M13.5 2.5L2.5 13.5'])\n\n/** The notice glyph (`IconWarningOutlineRegular`). */\nexport const WARNING_ICON = (size = 16): string =>\n glyph(size, REGULAR, [\n 'M8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5Z',\n 'M8 4.29199V9.79199',\n 'M8 10.708V11.708',\n ])\n\n/** The settled-state glyph (`IconCheckCircleFillRegular`). */\nexport const CHECK_CIRCLE_ICON = (size = 16): string =>\n fillGlyph(size, [\n 'M28.1936 14.6936L19.8066 23.0806C19.2373 23.65 18.7159 24.1742 18.24 24.5571C17.7389 24.9602 17.1365 25.3359 16.3657 25.458C15.9581 25.5225 15.5428 25.5225 15.1353 25.458C14.3645 25.3359 13.7621 24.9602 13.261 24.5571C12.7851 24.1742 12.2637 23.65 11.6943 23.0806L7.80737 19.1936L10.1936 16.8074L14.0806 20.6943C14.7033 21.317 15.0763 21.6873 15.377 21.9292C15.6523 22.1507 15.7109 22.1325 15.6626 22.1248C15.7208 22.1339 15.7802 22.1339 15.8384 22.1248C15.7901 22.1325 15.8486 22.1507 16.124 21.9292C16.4247 21.6873 16.7977 21.317 17.4204 20.6943L25.8074 12.3074L28.1936 14.6936Z',\n 'M32.8496 18.0005C32.8496 9.79906 26.2019 3.15137 18.0005 3.15137C9.79906 3.15137 3.15137 9.79906 3.15137 18.0005C3.15137 26.2019 9.79906 32.8496 18.0005 32.8496C26.2019 32.8496 32.8496 26.2019 32.8496 18.0005ZM35.7764 18.0005C35.7764 27.8173 27.8173 35.7764 18.0005 35.7764C8.18363 35.7764 0.224609 27.8173 0.224609 18.0005C0.224609 8.18363 8.18363 0.224609 18.0005 0.224609C27.8173 0.224609 35.7764 8.18363 35.7764 18.0005Z',\n ], '0 0 36 36')\n\n/** The install action (`IconDownloadOutlineRegular`). */\nexport const DOWNLOAD_ICON = (size = 16): string =>\n glyph(size, REGULAR, [\n 'M8 1.95317V10.0469',\n 'M4.25 6.29688L8 10.0469L11.75 6.29688',\n 'M1.5 10.0469V13.158C1.5 13.3937 1.60536 13.6198 1.79289 13.7865C1.98043 13.9532 2.23478 14.0469 2.5 14.0469H13.5C13.7652 14.0469 14.0196 13.9532 14.2071 13.7865C14.3946 13.6198 14.5 13.3937 14.5 13.158V10.0469',\n ])\n\n/** The head's info affordance (`IconInfoOutlineRegular`, fill-only artwork). */\nexport const INFO_ICON = (size = 11): string =>\n fillGlyph(size, [\n 'M12.5757 7.00012C12.5757 3.92085 10.0794 1.42463 7.00012 1.42456C3.9208 1.42456 1.42456 3.9208 1.42456 7.00012C1.42463 10.0794 3.92085 12.5757 7.00012 12.5757C10.0793 12.5756 12.5756 10.0793 12.5757 7.00012ZM13.8002 7.00012C13.8001 10.7559 10.7559 13.8001 7.00012 13.8002C3.2443 13.8002 0.199291 10.7559 0.199219 7.00012C0.199219 3.24426 3.24426 0.199219 7.00012 0.199219C10.7559 0.199291 13.8002 3.2443 13.8002 7.00012Z',\n 'M7.6127 3.18921V4.55986H6.38735V3.18921H7.6127Z',\n 'M7.6127 5.68921V10.8109H6.38735V5.68921H7.6127Z',\n ], '0 0 14 14')\n\n/** A folded section's chevron (`IconChevronDownOutlineRegular`). */\nexport const CHEVRON_DOWN_ICON = (size = 14): string =>\n glyph(size, REGULAR, ['M4 6L7.29289 9.29289C7.68342 9.68342 8.31658 9.68342 8.70711 9.29289L12 6'])\n","/**\n * Plugin-update review view (browser half).\n *\n * Plain-DOM panel (no React tree) so it can never disturb the DSH shell's\n * reconciliation — same rule as the sidebar entry rows. Rendered content:\n *\n * - head: title + intro + refresh toolbar (the shell plugin-manager head row)\n * - state-grouped sections, each a group head + package cards\n * (48px hairline-framed glyph, title row with a state tag, one-line\n * version transition, end actions) — the shell's card geometry\n * - a facts group for the independent HQ Edge runtime report\n * - footer actions (install / ignore / show again), with a toast that\n * reports the outcome of an install the way the shell's Toast does\n *\n * Every surface rides a `--dsw-alias-*` design token (see VIEW_CSS_TEXT), so\n * the panel follows the shell's light/dark theme and its focus-ring contract.\n *\n * @module\n */\nimport {\n checkUpdates,\n ignoreOffer,\n installSet,\n unignoreOffer,\n type PluginUpdateItem,\n type PluginUpdateReport,\n} from './api.js'\nimport type { UpdateCopy } from './copy.js'\nimport {\n CHECK_CIRCLE_ICON,\n CLOSE_ICON,\n DOWNLOAD_ICON,\n INFO_ICON,\n PLUGIN_ICON,\n REFRESH_ICON,\n WARNING_ICON,\n} from './icons.js'\n\nexport interface UpdateStoreLike {\n report(): PluginUpdateReport | null\n installing(): boolean\n refresh(): Promise<PluginUpdateReport | null>\n subscribe(listener: () => void): () => void\n}\n\n/** How long the outcome toast stays up, in milliseconds. */\nconst TOAST_HOLD_MS = 4000\n\nfunction el<K extends keyof HTMLElementTagNameMap>(\n tag: K,\n className = '',\n text?: string,\n): HTMLElementTagNameMap[K] {\n const node = document.createElement(tag)\n if (className.length > 0) node.className = className\n if (text !== undefined) node.textContent = text\n return node\n}\n\n/** A button carrying inline SVG artwork (the icon modules emit markup). */\nfunction iconButton(\n className: string,\n markup: string,\n label: string,\n onClick: () => void,\n): HTMLButtonElement {\n const button = el('button', className)\n button.type = 'button'\n button.setAttribute('aria-label', label)\n button.title = label\n button.innerHTML = markup\n button.addEventListener('click', onClick)\n return button\n}\n\n/**\n * Compact a package name to what a person calls it — the shell plugin\n * manager's own rule (`presentation.ts` `shortName`), so both UIs read the\n * same plugin by the same name.\n */\nexport function shortName(name: string): string {\n const unscoped = name.startsWith('@') ? name.slice(name.indexOf('/') + 1) : name\n return unscoped.replace(/^dsh-(?:host-|client-)?/, '')\n}\n\n/** Normalize the server's block reason to a list (it may arrive as a string). */\nfunction blockedByList(item: PluginUpdateItem): string[] {\n const by = item.blockedBy\n if (Array.isArray(by)) return by.filter((entry): entry is string => typeof entry === 'string')\n return typeof by === 'string' && by.length > 0 ? [by] : []\n}\n\n/** The tag tone a state reads as, matching the shell's Tag palette. */\nfunction stateTone(item: PluginUpdateItem): 'success' | 'info' | 'warning' | 'danger' | 'neutral' {\n switch (item.state) {\n case 'update':\n return 'info'\n case 'install':\n return 'warning'\n case 'blocked':\n return 'danger'\n case 'ignored':\n return 'neutral'\n case 'current':\n return 'success'\n }\n}\n\nfunction stateLabel(item: PluginUpdateItem, copy: UpdateCopy): string {\n switch (item.state) {\n case 'current':\n return copy.state.current\n case 'update':\n return copy.state.update\n case 'install':\n return copy.state.install\n case 'ignored':\n return copy.state.ignored\n case 'blocked':\n return copy.state.blocked\n }\n}\n\n/** The one-line version transition under a card's title. */\nfunction versionLine(item: PluginUpdateItem): string {\n switch (item.state) {\n case 'current':\n return item.currentVersion ?? item.availableVersion\n case 'install':\n return item.availableVersion\n default:\n // An absent plugin names only the version it would gain.\n return item.currentVersion === null\n ? item.availableVersion\n : `${item.currentVersion} → ${item.availableVersion}`\n }\n}\n\nfunction blockedReason(item: PluginUpdateItem, copy: UpdateCopy): string | undefined {\n const by = blockedByList(item)\n if (by.includes('host')) return copy.blockedReason.host\n if (by.includes('hq-edge-version')) return copy.blockedReason['hq-edge-version']\n if (by.includes('runtime-unknown')) return copy.blockedReason['runtime-unknown']\n return by.length > 0 ? by.join(', ') : undefined\n}\n\n/** One package card: glyph, name with its state tag, version line, end actions. */\nfunction packageCard(\n item: PluginUpdateItem,\n copy: UpdateCopy,\n installing: boolean,\n store: UpdateStoreLike,\n): HTMLLIElement {\n const card = el('li', 'hqpu-card')\n card.dataset.pluginName = item.name\n card.dataset.state = item.state\n // The full package name is the card's tooltip; the row shows the short name.\n card.title = `${item.name} · ${versionLine(item)}`\n\n const head = el('div', 'hqpu-card-head')\n\n const glyph = el('span', 'hqpu-card-icon')\n glyph.setAttribute('aria-hidden', 'true')\n glyph.innerHTML = PLUGIN_ICON(24)\n\n const main = el('div', 'hqpu-card-main')\n const titleRow = el('div', 'hqpu-title-row')\n const title = el('span', 'hqpu-card-title', shortName(item.name))\n const tag = el('span', 'hqpu-tag')\n tag.dataset.tone = stateTone(item)\n tag.textContent = stateLabel(item, copy)\n titleRow.append(title, tag)\n\n const desc = el('span', 'hqpu-card-desc', versionLine(item))\n\n main.append(titleRow, desc)\n head.append(glyph, main)\n\n const end = el('div', 'hqpu-card-end')\n if (item.state === 'update' || item.state === 'install') {\n const button = el('button', 'hqpu-btn hqpu-btn--sm hqpu-btn--primary')\n button.type = 'button'\n button.disabled = installing\n button.innerHTML = `${DOWNLOAD_ICON(13)}<span>${copy.installOne}</span>`\n button.addEventListener('click', () => {\n void runInstall(store, copy)\n })\n end.append(button)\n }\n head.append(end)\n card.append(head)\n\n // A block reason belongs to a blocked offer only.\n if (item.state === 'blocked') {\n const reason = blockedReason(item, copy)\n if (reason !== undefined) {\n card.append(el('p', 'hqpu-card-reason', reason))\n }\n }\n return card\n}\n\n/** A section: group head with its count, then the cards. */\nfunction group(\n heading: string,\n items: PluginUpdateItem[],\n copy: UpdateCopy,\n installing: boolean,\n store: UpdateStoreLike,\n): HTMLElement | null {\n if (items.length === 0) return null\n const section = el('section', 'hqpu-group')\n section.dataset.group = heading\n\n const head = el('div', 'hqpu-group-head')\n head.append(el('h3', 'hqpu-group-title', heading))\n head.append(el('span', 'hqpu-group-count', copy.groupCount(items.length)))\n\n const list = el('ul', 'hqpu-cards')\n for (const item of items) list.append(packageCard(item, copy, installing, store))\n\n section.append(head, list)\n return section\n}\n\n/** First-read placeholders, sharing the card and text-line layout. */\nfunction skeleton(copy: UpdateCopy): HTMLElement {\n const section = el('section', 'hqpu-group')\n section.setAttribute('role', 'status')\n section.dataset.loading = ''\n const head = el('div', 'hqpu-group-head')\n head.setAttribute('aria-hidden', 'true')\n const heading = el('span', 'hqpu-group-title hqpu-skeleton-text hqpu-skeleton-heading')\n const headingBar = el('span', 'hqpu-skeleton-fill hqpu-skeleton-bar')\n heading.append(headingBar)\n head.append(heading)\n\n const list = el('ul', 'hqpu-cards')\n list.setAttribute('aria-hidden', 'true')\n for (let index = 0; index < 3; index += 1) {\n const card = el('li', 'hqpu-card')\n const cardHead = el('div', 'hqpu-card-head')\n const glyph = el('span', 'hqpu-card-icon hqpu-skeleton-fill hqpu-skeleton-icon')\n const main = el('div', 'hqpu-card-main')\n const titleRow = el('div', 'hqpu-title-row')\n const title = el('span', 'hqpu-card-title hqpu-skeleton-text hqpu-skeleton-title')\n title.append(el('span', 'hqpu-skeleton-fill hqpu-skeleton-bar'))\n titleRow.append(title)\n const desc = el('span', 'hqpu-card-desc hqpu-skeleton-text hqpu-skeleton-desc')\n desc.append(el('span', 'hqpu-skeleton-fill hqpu-skeleton-bar'))\n main.append(titleRow, desc)\n cardHead.append(glyph, main)\n const end = el('div', 'hqpu-card-end')\n end.setAttribute('aria-hidden', 'true')\n cardHead.append(end)\n card.append(cardHead)\n list.append(card)\n }\n section.append(head, list)\n // The skeleton replaces the whole column, so label it for screen readers.\n section.setAttribute('aria-label', copy.loading)\n return section\n}\n\n/** The independent HQ Edge runtime report, as ruled fact rows. */\nfunction runtimeGroup(report: PluginUpdateReport, copy: UpdateCopy): HTMLElement {\n const section = el('section', 'hqpu-group')\n section.dataset.group = 'runtime'\n const head = el('div', 'hqpu-group-head')\n head.append(el('h3', 'hqpu-group-title', copy.runtime.title))\n section.append(head)\n\n const facts = el('dl', 'hqpu-facts')\n const runtime = report.runtime\n\n const row = (label: string, value: string, code = false): void => {\n const wrap = el('div')\n wrap.append(el('dt', '', label))\n const dd = el('dd')\n if (code) {\n const node = el('code', '', value)\n dd.append(node)\n } else {\n dd.textContent = value\n }\n wrap.append(dd)\n facts.append(wrap)\n }\n\n if (runtime.configured === false) {\n row(copy.runtime.source, copy.runtime.notConfigured)\n } else {\n row(copy.runtime.current, runtime.currentVersion ?? copy.runtime.unknown)\n if (runtime.updateAvailable && runtime.latest != null) {\n row(copy.runtime.latest, runtime.latest)\n }\n if (report.manifestVersion !== null) {\n row(copy.runtime.set, report.manifestVersion, true)\n }\n if (typeof runtime.checkedAt === 'string' && runtime.checkedAt.length > 0) {\n row(copy.runtime.checkedAt, new Date(runtime.checkedAt).toLocaleString())\n }\n }\n section.append(facts)\n\n section.append(el('p', 'hqpu-status', copy.runtime.note))\n if (typeof runtime.lastError === 'string' && runtime.lastError.length > 0) {\n const line = el('p', 'hqpu-status hqpu-status--dot')\n line.setAttribute('role', 'status')\n const dot = el('span', 'hqpu-dot')\n dot.dataset.state = 'error'\n line.append(dot, el('span', '', `${copy.lastError}: ${runtime.lastError}`))\n section.append(line)\n }\n return section\n}\n\nfunction renderList(\n section: HTMLElement,\n report: PluginUpdateReport | null,\n copy: UpdateCopy,\n installing: boolean,\n store: UpdateStoreLike,\n): void {\n section.textContent = ''\n if (report === null) {\n section.append(skeleton(copy))\n return\n }\n if (report.items.length === 0) {\n section.append(el('div', 'hqpu-empty', copy.empty))\n return\n }\n\n const byState = (state: PluginUpdateItem['state']): PluginUpdateItem[] =>\n report.items.filter((item) => item.state === state)\n\n // Most important first: what can be acted on, then what is refused, then\n // what was muted, then what is already settled.\n const order: Array<[string, PluginUpdateItem[]]> = [\n [copy.group.actionable, [...byState('update'), ...byState('install')]],\n [copy.group.blocked, byState('blocked')],\n [copy.group.ignored, byState('ignored')],\n [copy.group.current, byState('current')],\n ]\n for (const [heading, items] of order) {\n const node = group(heading, items, copy, installing, store)\n if (node !== null) section.append(node)\n }\n}\n\nfunction renderRuntime(\n section: HTMLElement,\n report: PluginUpdateReport | null,\n copy: UpdateCopy,\n): void {\n section.textContent = ''\n if (report === null) return\n section.append(runtimeGroup(report, copy))\n}\n\n/** Run the install transaction, then keep polling until the state settles. */\nasync function runInstall(store: UpdateStoreLike, copy: UpdateCopy): Promise<void> {\n const report = store.report()\n if (report === null) return\n // Without an evaluated set there is nothing to install: hq-edge has not read\n // a manifest yet, so the report is still its empty shell.\n if (report.manifestVersion === null) {\n showToast(copy.checkFailed, 'error')\n return\n }\n try {\n const result = await installSet(report.manifestVersion)\n if (result.error !== undefined) {\n showToast(`${copy.installError}: ${result.error}`, 'error')\n return\n }\n // The set activates atomically and DSH restarts. Keep polling the backend\n // state rather than trusting the response alone (spec §7.1).\n showToast(copy.installSuccess, 'success')\n void pollUntilSettled(store)\n } catch (err: unknown) {\n showToast(\n `${copy.installError}: ${err instanceof Error ? err.message : String(err)}`,\n 'error',\n )\n }\n}\n\n/** The single live toast; a new message replaces the one on screen. */\nlet toastHost: HTMLElement | null = null\nlet toastTimer: number | null = null\n\nfunction showToast(message: string, tone: 'success' | 'error'): void {\n if (toastHost === null) return\n if (toastTimer !== null) window.clearTimeout(toastTimer)\n toastHost.textContent = ''\n const toast = el('div', 'hqpu-toast')\n toast.setAttribute('role', 'status')\n const icon = el('span', 'hqpu-toast-icon')\n icon.dataset.tone = tone\n icon.innerHTML = tone === 'success' ? CHECK_CIRCLE_ICON(16) : WARNING_ICON(16)\n toast.append(icon, el('span', 'hqpu-toast-text', message))\n toastHost.append(toast)\n toastTimer = window.setTimeout(() => {\n toastHost?.replaceChildren()\n toastTimer = null\n }, TOAST_HOLD_MS)\n}\n\nfunction renderActions(\n bar: HTMLElement,\n report: PluginUpdateReport | null,\n copy: UpdateCopy,\n store: UpdateStoreLike,\n installing: boolean,\n): void {\n bar.textContent = ''\n if (report === null) return\n\n if (installing) {\n const line = el('span', 'hqpu-status hqpu-status--dot')\n const spinner = el('span', 'hqpu-spinner')\n line.append(spinner, el('span', '', copy.installing))\n bar.append(line)\n return\n }\n\n const actionable = report.items.filter(\n (item) => item.state === 'update' || item.state === 'install',\n ).length\n // Every write needs an evaluated set; hq-edge reports `null` until it has\n // read a manifest, and posting `null` would only earn a 400.\n const hasSet = report.manifestVersion !== null\n\n if (actionable === 0) {\n // The official page shows no install control when there is nothing to\n // commit, so mirror that with a muted line rather than a dead button.\n bar.append(el('span', 'hqpu-status', copy.nothingToInstall))\n } else {\n const installBtn = el('button', 'hqpu-btn hqpu-btn--primary')\n installBtn.type = 'button'\n installBtn.disabled = !hasSet || report.ignoredSet\n installBtn.innerHTML = `${DOWNLOAD_ICON(13)}<span>${copy.installAll(actionable)}</span>`\n installBtn.addEventListener('click', () => {\n void runInstall(store, copy)\n })\n bar.append(installBtn)\n }\n\n if (!hasSet) return\n\n if (report.ignoredSet) {\n const unignore = el('button', 'hqpu-btn hqpu-btn--outline hqpu-btn--sm', copy.unignore)\n unignore.type = 'button'\n unignore.addEventListener('click', () => {\n void unignoreOffer(report.manifestVersion as string)\n .then(() => store.refresh())\n .catch(() => undefined)\n })\n bar.append(unignore)\n } else if (actionable > 0) {\n const ignore = el('button', 'hqpu-btn hqpu-btn--ghost hqpu-btn--sm', copy.ignore)\n ignore.type = 'button'\n ignore.addEventListener('click', () => {\n void ignoreOffer(report.manifestVersion as string)\n .then(() => store.refresh())\n .catch(() => undefined)\n })\n bar.append(ignore)\n }\n}\n\n/** After an install, poll the backend until the update report settles\n * (installing flag clears or DSH restarts under us — the next load re-reads\n * the fresh state). */\nfunction pollUntilSettled(store: UpdateStoreLike): void {\n let attempts = 0\n const tick = (): void => {\n void store\n .refresh()\n .then((report) => {\n if (store.installing()) return\n if (report !== null && report.ignoredSet === false && attempts >= 2) return\n })\n .catch(() => undefined)\n .finally(() => {\n attempts += 1\n if (attempts < 10) {\n window.setTimeout(tick, 2000)\n }\n })\n }\n tick()\n}\n\n/**\n * Open (or focus) the update panel. Re-renders from the store; when the store\n * is stale the panel first refreshes the report.\n */\nexport function openUpdateView(store: UpdateStoreLike, copy: UpdateCopy): void {\n const existing = document.querySelector<HTMLElement>('[data-hq-plugin-update-view]')\n if (existing !== null) {\n existing.style.display = ''\n return\n }\n\n const overlay = el('div', 'hqpu-overlay')\n overlay.setAttribute('data-hq-plugin-update-view', '')\n overlay.addEventListener('click', (ev) => {\n if (ev.target === overlay) onClose()\n })\n\n const scrim = el('div', 'hqpu-scrim')\n const panel = el('div', 'hqpu-panel')\n panel.setAttribute('role', 'dialog')\n panel.setAttribute('aria-modal', 'true')\n panel.setAttribute('aria-label', copy.viewTitle)\n panel.tabIndex = -1\n\n // ── Head row: title + intro, refresh toolbar ──\n const head = el('div', 'hqpu-head')\n const headMain = el('div', 'hqpu-head-main')\n headMain.append(el('h1', 'hqpu-title', copy.viewTitle))\n const intro = el('p', 'hqpu-intro')\n intro.append(el('span', '', copy.viewIntro))\n const info = el('button', 'hqpu-info')\n info.type = 'button'\n info.setAttribute('aria-label', copy.viewInfo)\n info.title = copy.viewInfo\n info.innerHTML = INFO_ICON(11)\n intro.append(info)\n headMain.append(intro)\n\n const toolbar = el('div', 'hqpu-toolbar')\n const refreshBtn = iconButton('hqpu-icon-btn', REFRESH_ICON(16), copy.refresh, () => {\n void store.refresh()\n })\n toolbar.append(refreshBtn)\n const closeBtn = iconButton('hqpu-icon-btn', CLOSE_ICON(16), copy.close, () => {\n onClose()\n })\n toolbar.append(closeBtn)\n\n head.append(headMain, toolbar)\n panel.append(head)\n\n // ── Scrolling body: the centred column ──\n const scroll = el('div', 'hqpu-scroll')\n const column = el('div', 'hqpu-column')\n const listSection = el('div', 'hqpu-stack')\n const runtimeSection = el('div', 'hqpu-stack')\n const toastSection = el('div', 'hqpu-toast-host')\n column.append(listSection, runtimeSection, toastSection)\n scroll.append(column)\n panel.append(scroll)\n\n // ── Footer actions (ui-primitives Modal .footer) ──\n const footer = el('div', 'hqpu-footer')\n const actionBar = el('div', 'hqpu-actions')\n footer.append(actionBar)\n panel.append(footer)\n\n overlay.append(scrim, panel)\n document.body.appendChild(overlay)\n toastHost = toastSection\n panel.focus()\n\n const disposers: Array<() => void> = []\n\n const render = (): void => {\n const report = store.report()\n const installing = store.installing()\n const stale = report === null\n refreshBtn.disabled = stale\n if (stale) {\n listSection.textContent = ''\n listSection.append(skeleton(copy))\n } else {\n renderList(listSection, report, copy, installing, store)\n }\n renderRuntime(runtimeSection, report, copy)\n renderActions(actionBar, report, copy, store, installing)\n }\n\n const unsubscribe = store.subscribe(render)\n disposers.push(unsubscribe)\n\n // Refresh on open (bounded; never block the shell).\n void store.refresh().then(() => {\n // Store notification re-renders already; nothing extra to do.\n })\n\n // Escape closes, the shell-wide dialog contract.\n const onKeyDown = (ev: KeyboardEvent): void => {\n if (ev.key === 'Escape') {\n ev.stopPropagation()\n onClose()\n }\n }\n document.addEventListener('keydown', onKeyDown)\n disposers.push(() => document.removeEventListener('keydown', onKeyDown))\n\n function onClose(): void {\n for (const dispose of disposers) {\n try {\n dispose()\n } catch {\n /* already disposed */\n }\n }\n if (toastTimer !== null) window.clearTimeout(toastTimer)\n toastTimer = null\n if (toastHost === toastSection) toastHost = null\n overlay.remove()\n }\n\n render()\n}\n","/**\n * `@huaqiu/dsh-tool-plugin-update` — browser half.\n *\n * Mounts one sidebar toolbutton in the Huaqiu family block (\"插件更新\") with a\n * numeric badge equal to the actionable plugin-update count (spec §6.3/§7.1:\n * only compatible `update` + `install` items after host/HQ-Edge filtering and\n * after excluding the ignored offer; runtime updates are NOT counted). Click\n * opens the review/confirm/ignore modal.\n *\n * The authoritative state is the hq-edge report fetched through the plugin's\n * same-origin forwarding routes. A tiny in-memory store owns the latest report\n * + installing flag; the sidebar badge and the modal subscribe to it. No\n * timers beyond the install-poll and an idle 60 s refresh.\n *\n * @module\n */\nimport {\n HUAQIU_SIDEBAR_ENTRY_FAMILY,\n detectHostLocale,\n mountSidebarEntry,\n observeHostLocale,\n type HostLocale,\n} from '@huaqiu/dsh-sidebar-entry'\nimport { checkUpdates, fetchReport, type PluginUpdateReport } from './api.js'\nimport { COPY } from './copy.js'\nimport { PLUGIN_ICON } from './icons.js'\nimport { openUpdateView, type UpdateStoreLike } from './update-view.js'\n\n/** Stable data attributes identifying the injected entry row. */\nexport const UPDATE_ENTRY_SELECTOR = '[data-hq-plugin-update-entry]'\nexport const UPDATE_ENTRY_ATTRIBUTE = 'data-hq-plugin-update-entry'\n\n/** L2 semantic plugin id: rows carry data-dsh-plugin + data-dsh-part. */\nconst PLUGIN_ID = 'huaqiu-plugin-update'\n\n/** Row class names (defined by {@link ENTRY_CSS_TEXT}). */\nconst ENTRY_CSS: Record<string, string> = {\n entry: 'hqpu-sidebar-entry',\n entryIcon: 'hqpu-sidebar-entry__icon',\n entryLabel: 'hqpu-sidebar-entry__label',\n entryBadge: 'hqpu-sidebar-entry__badge',\n}\n\n/** Localized row copy: zh is the fallback, matching the family convention. */\nfunction entryCopy(lang: HostLocale | undefined): { label: string; tooltip: string } {\n return lang === 'en'\n ? { label: COPY.en.entryLabel, tooltip: COPY.en.entryTooltip }\n : { label: COPY.zh.entryLabel, tooltip: COPY.zh.entryTooltip }\n}\n\n/** The sidebar glyph — the same pinwheel the shell's own Plugins entry draws\n * (`IconPluginPinwheelOutlineRegular`), so both rows read as one feature. */\nexport const UPDATE_ICON = PLUGIN_ICON(16)\n\n/** Sidebar entry styles — matched to the family rows (same inset/padding/gap\n * as the shell's own Plugins entry, `SidebarRoot.module.css` `.panelRow`).\n * Every colour rides a `--dsw-alias-*` token so the row follows the shell's\n * light/dark theme; the badge foreground uses the toast label, the shell's\n * \"always light ink on a saturated surface\" token. */\nconst ENTRY_CSS_TEXT = `\n.hqpu-sidebar-entry {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n margin: 0 2px;\n min-height: 36px;\n padding: 7px 8px;\n background: transparent;\n border: none;\n border-radius: var(--dsw-radius-md);\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n font: inherit;\n line-height: 22px;\n text-align: left;\n white-space: nowrap;\n}\n.hqpu-sidebar-entry:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n.hqpu-sidebar-entry[data-active] {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-primary);\n}\n.hqpu-sidebar-entry:focus-visible {\n outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline-offset: -2px;\n}\n.hqpu-sidebar-entry__icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n}\n.hqpu-sidebar-entry__icon svg {\n display: block;\n width: 16px;\n height: 16px;\n}\n.hqpu-sidebar-entry__label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: 1;\n}\n.hqpu-sidebar-entry__badge {\n flex: none;\n min-width: 16px;\n height: 16px;\n padding: 0 5px;\n border-radius: 8px;\n background: var(--dsw-alias-state-error-primary);\n color: var(--dsw-alias-toast-label);\n font-size: 11px;\n line-height: 16px;\n font-weight: 500;\n text-align: center;\n font-variant-numeric: tabular-nums;\n}\n/* Collapsed rail: icon-only, centered — same 36px square the shell uses. */\n[data-sidebar-collapsed] .hqpu-sidebar-entry {\n justify-content: center;\n width: 36px;\n height: 36px;\n margin: 0;\n padding: 0;\n}\n[data-sidebar-collapsed] .hqpu-sidebar-entry__icon svg {\n width: 18px;\n height: 18px;\n}\n[data-sidebar-collapsed] .hqpu-sidebar-entry__label,\n[data-sidebar-collapsed] .hqpu-sidebar-entry__badge {\n display: none;\n}\n`\n\n/**\n * View styles (hqpu-*). Plain overlay + panel, drawn with the SAME design\n * tokens and geometry the shell's own plugin manager uses\n * (`ui-plugin-manager/src/client/PluginManagerPage.module.css` +\n * `ui-primitives/src/{Modal,Toast,Tag,StateDot}.module.css`), so this page\n * reads as part of the product rather than a bolt-on.\n *\n * Two rules keep it honest across themes:\n * 1. every colour is a `--dsw-alias-*` token — no literal hex/rgb, so light\n * and dark both come out right (the old sheet invented\n * `--dsw-alias-bg-surface` / `--dsw-alias-line-border` / `--dsw-alias-bg-badge`,\n * none of which exist, and so always fell back to a white panel);\n * 2. `color-mix()` tints come from the state token itself, so a palette\n * change moves fill and ink together.\n *\n * The chrome (panel, scrim, header, footer) follows `ui-primitives/Modal`,\n * because this view IS a dialog; the body follows `PluginManagerPage`, because\n * that is the content it heads. The one token the bundled shell does not\n * publish is backfilled by {@link ensureDesignTokens} — see the note there.\n */\nconst VIEW_CSS_TEXT = `\n/* ── Overlay + panel (ui-primitives Modal.module.css) ─────────────────── */\n.hqpu-overlay {\n position: fixed;\n inset: 0;\n z-index: 1000;\n display: flex;\n align-items: center;\n justify-content: center;\n /* The frame's own top inset keeps a tall card clear of the window chrome. */\n padding: max(24px, var(--dsh-frame-overlay-top, 24px)) 24px;\n}\n.hqpu-scrim {\n position: absolute;\n /* Only paint excludes the native caption; the root still blocks clicks. */\n inset: var(--dsh-frame-chrome-top, 0px) 0 0;\n background: var(--dsw-alias-bg-mask-1);\n animation: hqpu-fade var(--ds-transition-duration, 0.2s) var(--ds-ease-in-out, ease);\n}\n.hqpu-panel {\n position: relative;\n z-index: 1;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n gap: 20px;\n width: min(920px, 100%);\n max-height: 100%;\n overflow: hidden;\n border: 0;\n border-radius: var(--dsw-radius-panel);\n background: var(--dsw-alias-bg-layer-2);\n box-shadow: var(--dsw-elevation-prominent);\n color: var(--dsw-alias-label-primary);\n animation: hqpu-panel-in var(--ds-transition-duration, 0.2s) var(--ds-ease-in-out, ease);\n}\n.hqpu-panel:focus {\n outline: none;\n}\n@keyframes hqpu-fade {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n@keyframes hqpu-panel-in {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n/* ── Head row (ui-primitives Modal .header) ─────────────────────────────── */\n.hqpu-head {\n display: flex;\n flex: none;\n flex-wrap: wrap;\n align-items: flex-start;\n justify-content: space-between;\n gap: 16px;\n box-sizing: border-box;\n /* The official Title row: 22/14/12/24 — the toolbar sits 10px further right\n * than the body content on purpose, matching the shell's own close button. */\n padding: 22px 14px 12px 24px;\n}\n.hqpu-head-main {\n min-width: 0;\n max-width: 100%;\n}\n.hqpu-title {\n margin: 0;\n font-size: 20px;\n font-weight: 500;\n line-height: 28px;\n color: var(--dsw-alias-label-primary);\n}\n.hqpu-intro {\n display: flex;\n align-items: center;\n gap: 4px;\n margin: 4px 0 0;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n.hqpu-info {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n width: 20px;\n height: 20px;\n padding: 0;\n border: 0;\n border-radius: var(--dsw-radius-sm);\n background: transparent;\n color: var(--dsw-alias-label-caption);\n cursor: pointer;\n}\n.hqpu-info:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-secondary);\n}\n.hqpu-info:focus-visible {\n outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline-offset: 1px;\n}\n.hqpu-toolbar {\n display: flex;\n flex: none;\n align-items: center;\n gap: 16px;\n}\n\n/* ── Scrolling body: the page's centred column ────────────────────────── */\n.hqpu-scroll {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n box-sizing: border-box;\n /* The panel's 20px gap already separates this from the head and footer. */\n padding: 0 clamp(16px, 3vw, 32px) 4px;\n /* Anything that scrolls inside the panel draws the l2 thumb. */\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n}\n.hqpu-column {\n display: flex;\n flex-direction: column;\n gap: 24px;\n width: 100%;\n max-width: 880px;\n margin: 0 auto;\n}\n/* A stack of groups (or the single toast host) inside the column. */\n.hqpu-stack {\n display: flex;\n flex-direction: column;\n gap: 24px;\n}\n.hqpu-toast-host:empty {\n display: none;\n}\n\n/* ── Groups (PluginManagerPage .group) ────────────────────────────────── */\n.hqpu-group {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.hqpu-group-head {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.hqpu-group-title {\n flex: 1;\n min-width: 0;\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n line-height: 22px;\n color: var(--dsw-alias-label-primary);\n}\n.hqpu-group-count {\n flex: none;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-tertiary);\n font-variant-numeric: tabular-nums;\n}\n\n/* ── Cards (PluginManagerPage .card) ──────────────────────────────────── */\n.hqpu-cards {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n.hqpu-card {\n min-width: 0;\n /* The hover surface reaches 8px past the content on both sides. */\n margin: 0 -8px;\n border-radius: var(--dsw-radius-xl);\n}\n.hqpu-card:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n.hqpu-card-head {\n display: flex;\n align-items: center;\n gap: 14px;\n padding: 8px;\n}\n.hqpu-card-icon {\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 48px;\n height: 48px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-lg);\n color: var(--dsw-alias-label-secondary);\n}\n.hqpu-card-icon svg {\n display: block;\n width: 24px;\n height: 24px;\n}\n.hqpu-card-main {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.hqpu-title-row {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 8px;\n min-width: 0;\n}\n.hqpu-card-title {\n min-width: 0;\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n color: var(--dsw-alias-label-primary);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.hqpu-card-desc {\n font-size: 13px;\n line-height: 18px;\n color: var(--dsw-alias-label-tertiary);\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n overflow-wrap: anywhere;\n}\n.hqpu-card-end {\n position: relative;\n z-index: 1;\n display: inline-flex;\n flex: none;\n align-items: center;\n gap: 8px;\n}\n.hqpu-card-reason {\n margin: 0;\n padding: 0 8px 8px 70px;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-state-error-primary);\n overflow-wrap: anywhere;\n}\n\n/* ── Tags (ui-primitives Tag.module.css) ──────────────────────────────── */\n.hqpu-tag {\n display: inline-flex;\n align-items: center;\n flex: none;\n border-radius: 999px;\n corner-shape: round;\n padding: 1px 8px;\n font-size: 11px;\n font-weight: 500;\n line-height: 17px;\n white-space: nowrap;\n}\n.hqpu-tag[data-tone='success'] {\n background: color-mix(in srgb, var(--dsw-alias-state-success-primary) 10%, transparent);\n color: var(--dsw-alias-state-success-primary);\n}\n.hqpu-tag[data-tone='info'] {\n background: color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent);\n color: var(--dsw-alias-state-business-primary);\n}\n.hqpu-tag[data-tone='warning'] {\n background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 12%, transparent);\n color: var(--dsw-alias-state-warn-primary);\n}\n.hqpu-tag[data-tone='danger'] {\n background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent);\n color: var(--dsw-alias-state-error-primary);\n}\n.hqpu-tag[data-tone='neutral'] {\n background: var(--dsw-alias-bg-module-platform);\n color: var(--dsw-alias-label-secondary);\n}\n\n/* ── Fact rows (PluginManagerPage .facts / .rows) ─────────────────────── */\n.hqpu-facts {\n margin: 0;\n display: flex;\n flex-direction: column;\n}\n.hqpu-facts > div {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 16px;\n min-height: 44px;\n padding: 8px 2px;\n border-bottom: 0.5px solid var(--dsw-alias-border-l2);\n}\n.hqpu-facts > div:last-child {\n border-bottom: 0;\n}\n.hqpu-facts dt {\n flex: none;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n.hqpu-facts dd {\n min-width: 0;\n margin: 0;\n font-size: 13px;\n line-height: 20px;\n text-align: end;\n overflow-wrap: anywhere;\n color: var(--dsw-alias-label-primary);\n}\n.hqpu-facts code {\n padding: 2px 6px;\n border-radius: var(--dsw-radius-xs);\n background: var(--dsw-alias-bg-module-platform);\n font-family: var(--dsw-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);\n font-size: 12px;\n}\n\n/* ── Banner (PluginManagerPage .installSafety) ────────────────────────── */\n.hqpu-banner {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 10px 12px;\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-state-warn-tertiary);\n font-size: 12.5px;\n line-height: 18px;\n color: var(--dsw-alias-label-secondary);\n}\n.hqpu-banner > svg {\n flex: none;\n margin-top: 2px;\n color: var(--dsw-alias-state-warn-primary);\n}\n\n/* ── Status, empty, failure (PluginManagerPage .status / .empty / .failure) */\n.hqpu-status {\n margin: 0;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-tertiary);\n}\n.hqpu-status--dot {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n}\n.hqpu-failure {\n display: flex;\n align-items: center;\n gap: 10px;\n color: var(--dsw-alias-state-error-primary);\n}\n.hqpu-empty {\n padding: 32px 0;\n text-align: center;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-tertiary);\n}\n\n/* ── State dot + spinner (ui-primitives StateDot.module.css) ──────────── */\n.hqpu-dot {\n position: relative;\n display: inline-block;\n flex: none;\n width: 10px;\n height: 10px;\n}\n.hqpu-dot::after {\n content: '';\n position: absolute;\n inset: 20%;\n border-radius: 50%;\n corner-shape: round;\n background: currentColor;\n}\n.hqpu-dot[data-state='done'] { color: var(--dsw-alias-state-success-primary); }\n.hqpu-dot[data-state='warning'] { color: var(--dsw-alias-state-warn-primary); }\n.hqpu-dot[data-state='error'] { color: var(--dsw-alias-state-error-primary); }\n.hqpu-dot[data-state='idle'] { color: var(--dsw-alias-state-idle-primary); }\n.hqpu-spinner {\n flex: none;\n width: 14px;\n height: 14px;\n border-radius: 50%;\n border: 1.5px solid color-mix(in srgb, currentColor 25%, transparent);\n border-top-color: currentColor;\n animation: hqpu-spin 1.5s linear infinite;\n}\n@keyframes hqpu-spin {\n to { transform: rotate(360deg); }\n}\n\n/* ── Skeleton (PluginManagerPage .skeleton*) ──────────────────────────── */\n.hqpu-skeleton-fill {\n background: var(--dsw-alias-bg-skeleton);\n animation: hqpu-skeleton 2s cubic-bezier(0.36, 0, 0.64, 1) infinite;\n}\n.hqpu-skeleton-text {\n display: flex;\n align-items: center;\n height: 1lh;\n}\n.hqpu-skeleton-bar {\n width: 100%;\n height: 12px;\n border-radius: var(--dsw-radius-xs);\n}\n.hqpu-skeleton-heading { width: 96px; }\n.hqpu-skeleton-title { width: min(144px, 60%); }\n.hqpu-skeleton-desc { width: min(280px, 85%); }\n.hqpu-skeleton-icon { border-color: transparent; }\n@keyframes hqpu-skeleton {\n 0% { opacity: 1; }\n 40% { opacity: 0.6; }\n 80%, 100% { opacity: 1; }\n}\n\n/* ── Toast (ui-primitives Toast.module.css, held inside the panel) ────── */\n.hqpu-toast {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-alias-toast-bg);\n color: var(--dsw-alias-toast-label);\n font-size: 14px;\n line-height: 22px;\n box-shadow: var(--dsw-shadow-lv3);\n animation: hqpu-toast-in 160ms ease-out;\n}\n.hqpu-toast-icon {\n display: grid;\n place-items: center;\n flex: none;\n color: var(--dsw-alias-state-warn-label);\n}\n.hqpu-toast-icon[data-tone='success'] { color: var(--dsw-alias-state-success-primary); }\n.hqpu-toast-text { min-width: 0; }\n@keyframes hqpu-toast-in {\n from { opacity: 0; transform: translateY(-6px); }\n to { opacity: 1; transform: none; }\n}\n\n/* ── Buttons (PluginManagerPage .addButton / .iconButton) ─────────────── */\n.hqpu-icon-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n width: 28px;\n height: 28px;\n padding: 0;\n border: 0;\n border-radius: var(--dsw-radius-sm);\n background: transparent;\n color: var(--dsw-alias-label-caption);\n cursor: pointer;\n}\n.hqpu-icon-btn svg { display: block; }\n.hqpu-icon-btn:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-secondary);\n}\n.hqpu-icon-btn:disabled {\n opacity: 0.5;\n cursor: default;\n}\n.hqpu-icon-btn:focus-visible {\n outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline-offset: 1px;\n}\n.hqpu-btn {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n height: 32px;\n padding: 0 12px;\n border: 0;\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n cursor: pointer;\n}\n.hqpu-btn svg { display: block; }\n.hqpu-btn:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover-solid); }\n.hqpu-btn:disabled { opacity: 0.5; cursor: default; }\n.hqpu-btn:focus-visible {\n outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline-offset: 1px;\n}\n.hqpu-btn--primary {\n background: var(--dsw-alias-button-primary-fill);\n color: var(--dsw-alias-label-primary-foreground);\n}\n.hqpu-btn--primary:hover:not(:disabled) { background: var(--dsw-alias-button-primary-hover); }\n.hqpu-btn--outline {\n background: transparent;\n border: 0.5px solid var(--dsw-alias-border-l4);\n color: var(--dsw-alias-label-secondary);\n}\n.hqpu-btn--outline:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.hqpu-btn--ghost { background: transparent; color: var(--dsw-alias-label-secondary); }\n.hqpu-btn--ghost:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.hqpu-btn--danger { color: var(--dsw-alias-state-error-primary); }\n.hqpu-btn--sm { height: 28px; padding: 0 10px; font-size: 12.5px; }\n.hqpu-actions {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 8px;\n}\n\n/* ── Footer action row (ui-primitives Modal .footer) ───────────────────── */\n.hqpu-footer {\n display: flex;\n flex: none;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n padding: 0 24px 20px;\n}\n\n.hqpu-visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n\n/* ── Reduced motion: drop every decorative animation ──────────────────── */\n@media (prefers-reduced-motion: reduce) {\n .hqpu-scrim,\n .hqpu-panel,\n .hqpu-skeleton-fill,\n .hqpu-spinner,\n .hqpu-toast {\n animation: none;\n }\n}\n`\n\nconst STYLE_TAG_ID = 'data-plugin-css=\"huaqiu-plugin-update\"'\n\n/**\n * Design tokens the bundled DSH shell may not publish.\n *\n * hq-edge ships an older `ui-theme` build. A live probe of the running shell\n * (both themes) shows 13 of the tokens this stylesheet reads are absent:\n * `--dsw-radius-{xs,sm,md,lg,xl,panel}`, `--dsw-focus-ring-width`,\n * `--dsw-focus-ring-color`, `--dsw-alias-toast-label`,\n * `--dsw-alias-state-idle-primary`, `--dsw-font-mono`,\n * `--dsh-frame-overlay-top` and `--dsh-frame-chrome-top`.\n *\n * An unresolved `var()` is not an error — it silently degrades the property to\n * its initial value. That is how this panel once rendered with\n * `border-radius: 0px` and a 3px `auto` focus ring while every colour was\n * already correct.\n *\n * The last three (`--dsw-font-mono`, `--dsh-frame-*`) are deliberately NOT\n * backfilled: the shell's own primitives rely on the inline `var(…, fallback)`\n * form for those (`Modal.module.css`, `PluginManagerPage.module.css`), so this\n * sheet does too. Everything else is backfilled below with the canonical value\n * from `ui-theme/src/styles/{base,focus,design-platform}.css`.\n *\n * Values are feature-detected at runtime and scoped to this plugin's own roots\n * rather than `:root`, so a newer shell always wins and filling a gap can never\n * restyle the host.\n */\n\n/** The two roots this plugin styles: the view overlay (built in\n * update-view.ts) and the sidebar row ({@link ENTRY_CSS}.entry). */\nconst STYLE_ROOTS = '.hqpu-overlay, .hqpu-sidebar-entry'\n\n/** The shell's dark-theme carrier — audited live as `body[data-ds-dark-theme]`. */\nconst DARK_THEME_SELECTOR = 'body[data-ds-dark-theme]'\n\n/** Same roots, one rule per theme, for tokens whose official value flips. */\nconst DARK_STYLE_ROOTS = STYLE_ROOTS.split(',')\n .map((root) => `${DARK_THEME_SELECTOR} ${root.trim()}`)\n .join(',')\n\ntype DesignTokenFallback =\n | { token: string; value: string }\n | { token: string; value: { light: string; dark: string } }\n\nconst DESIGN_TOKEN_FALLBACKS: DesignTokenFallback[] = [\n // base.css — geometry; theme-invariant.\n { token: '--dsw-radius-xs', value: '4px' },\n { token: '--dsw-radius-sm', value: '8px' },\n { token: '--dsw-radius-md', value: '12px' },\n { token: '--dsw-radius-lg', value: '16px' },\n { token: '--dsw-radius-xl', value: '20px' },\n { token: '--dsw-radius-panel', value: '28px' },\n // focus.css — the standard ring geometry. The colour already falls back\n // inline in the sheet; publishing it too keeps the ring intact if that\n // fallback is ever edited away.\n { token: '--dsw-focus-ring-width', value: '2px' },\n { token: '--dsw-focus-ring-color', value: 'var(--dsw-alias-state-business-primary, #C7000B)' },\n // design-platform.css — `--dsw-static-neutral-bluish-00` is white in both\n // themes, which is exactly what the official alias resolves to.\n { token: '--dsw-alias-toast-label', value: 'var(--dsw-static-neutral-bluish-00, #fff)' },\n // The one token whose official value flips with the theme. `--dsw-static-*`\n // are theme-invariant, so one rule per carrier reproduces neutral-300\n // (light) / neutral-600 (dark) without knowing the current theme.\n {\n token: '--dsw-alias-state-idle-primary',\n value: {\n light: 'var(--dsw-static-neutral-300, #d4d4d4)',\n dark: 'var(--dsw-static-neutral-600, #545557)',\n },\n },\n]\n\nconst TOKEN_STYLE_TAG_ID = 'data-plugin-css=\"huaqiu-plugin-update-tokens\"'\n\n/**\n * Publish canonical values for the design tokens the shell is missing.\n *\n * Idempotent and cheap: safe to call on every open, so a shell that publishes\n * its tokens late still wins (the stale fallbacks are removed in that case).\n */\nexport function ensureDesignTokens(): void {\n if (typeof document === 'undefined' || document.body === null) return\n const probe = getComputedStyle(document.body)\n const missing = DESIGN_TOKEN_FALLBACKS.filter(\n (entry) => probe.getPropertyValue(entry.token).trim() === '',\n )\n\n const existing = document.querySelector<HTMLStyleElement>(`style[${TOKEN_STYLE_TAG_ID}]`)\n if (missing.length === 0) {\n existing?.remove()\n return\n }\n\n const flat = missing.filter(\n (entry): entry is { token: string; value: string } => typeof entry.value === 'string',\n )\n const themed = missing.filter(\n (entry): entry is { token: string; value: { light: string; dark: string } } =>\n typeof entry.value !== 'string',\n )\n\n const rules: string[] = []\n const lightDecls = [\n ...flat.map((entry) => ` ${entry.token}: ${entry.value};`),\n ...themed.map((entry) => ` ${entry.token}: ${entry.value.light};`),\n ]\n rules.push(`${STYLE_ROOTS} {\\n${lightDecls.join('\\n')}\\n}`)\n if (themed.length > 0) {\n const darkDecls = themed.map((entry) => ` ${entry.token}: ${entry.value.dark};`)\n rules.push(`${DARK_STYLE_ROOTS} {\\n${darkDecls.join('\\n')}\\n}`)\n }\n\n const tag = existing ?? document.createElement('style')\n tag.dataset.pluginCss = 'huaqiu-plugin-update-tokens'\n tag.textContent = rules.join('\\n')\n if (tag.parentNode === null) document.head.appendChild(tag)\n}\n\n/** Inject styles once (idempotent). */\nexport function injectUpdateStyles(): void {\n if (typeof document === 'undefined') return\n if (document.querySelector(`style[${STYLE_TAG_ID}]`) !== null) return\n const tag = document.createElement('style')\n tag.dataset.pluginCss = 'huaqiu-plugin-update'\n tag.textContent = `${ENTRY_CSS_TEXT}\\n${VIEW_CSS_TEXT}`\n document.head.appendChild(tag)\n}\n\n/** Minimal structural client context (dsh-client-runtime provides these). */\nexport interface ClientContext {\n get<T = unknown>(name: string): T | undefined\n effect?(fn: () => (() => void) | void, label?: string): void\n}\n\n/** In-memory update-report store shared by the badge and the modal. */\nclass UpdateStore implements UpdateStoreLike {\n private current: PluginUpdateReport | null = null\n private installingFlag = false\n private readonly listeners = new Set<() => void>()\n private refreshTimer: number | null = null\n\n report(): PluginUpdateReport | null {\n return this.current\n }\n\n installing(): boolean {\n return this.installingFlag\n }\n\n subscribe(listener: () => void): () => void {\n this.listeners.add(listener)\n return () => {\n this.listeners.delete(listener)\n }\n }\n\n /** Badge count per spec §6.3: actionable `update` + `install`, excluding the\n * ignored offer (the server already folds ignore into item states; keep the\n * client-side filter as a defensive second pass). */\n badgeCount(): number {\n const report = this.current\n if (report === null) return 0\n return report.items.filter(\n (item) => item.state === 'update' || item.state === 'install',\n ).length\n }\n\n private emit(): void {\n for (const listener of [...this.listeners]) {\n try {\n listener()\n } catch {\n /* one bad listener must not strand the rest */\n }\n }\n }\n\n async refresh(): Promise<PluginUpdateReport | null> {\n try {\n const report = await fetchReport()\n this.current = report\n this.emit()\n return report\n } catch {\n return this.current\n }\n }\n\n async check(): Promise<PluginUpdateReport | null> {\n try {\n const report = await checkUpdates()\n this.current = report\n this.emit()\n return report\n } catch {\n return this.current\n }\n }\n\n /** Mark the set as installing (set by the modal before the restart). */\n setInstalling(flag: boolean): void {\n this.installingFlag = flag\n this.emit()\n }\n\n /** Idle refresh while mounted (60 s) — no overlapping poll loop. */\n startIdleRefresh(): void {\n if (this.refreshTimer !== null) return\n this.refreshTimer = window.setInterval(() => {\n void this.refresh()\n }, 60_000) as unknown as number\n }\n\n stop(): void {\n if (this.refreshTimer !== null) {\n window.clearInterval(this.refreshTimer)\n this.refreshTimer = null\n }\n this.listeners.clear()\n }\n}\n\n/**\n * Client cordis inject: no service dependencies — the plugin reads the\n * hq-edge report purely through same-origin fetch (forwarded by its own node\n * half). `inject` stays empty so the loader never waits on another service.\n */\nexport const inject: string[] = []\n\n/**\n * Client plugin body — mount the sidebar toolbutton + review modal.\n * @param ctx - real cordis client context.\n * @returns disposer removing the row and all subscriptions.\n */\nexport function apply(ctx: ClientContext): () => void {\n if (typeof document === 'undefined') return () => {}\n injectUpdateStyles()\n ensureDesignTokens()\n\n const store = new UpdateStore()\n const copy = { zh: COPY.zh, en: COPY.en }\n const copyFor = (): typeof COPY.zh => (locale === 'en' ? copy.en : copy.zh)\n\n // Locale: re-render the row copy when <html lang> changes. The sidebar\n // helper subscribes via `refresh.subscribe`; we fan out to its listener.\n let locale: HostLocale | undefined = detectHostLocale()\n const localeSubscribers = new Set<() => void>()\n const refreshSubscribe = (listener: () => void): (() => void) => {\n localeSubscribers.add(listener)\n return () => {\n localeSubscribers.delete(listener)\n }\n }\n const unsubscribeLocale = observeHostLocale((next) => {\n locale = next\n for (const fn of [...localeSubscribers]) {\n try {\n fn()\n } catch {\n /* one bad subscriber must not strand the rest */\n }\n }\n })\n const labelState = { label: entryCopy(locale).label, tooltip: entryCopy(locale).tooltip }\n const applyLabel = (): void => {\n const c = entryCopy(locale)\n labelState.label = c.label\n labelState.tooltip = c.tooltip\n }\n\n const openView = (): void => {\n // Re-detect the shell's design tokens on every open: a shell that\n // publishes them after this plugin mounted must win, and one that never\n // does must keep the canonical fallbacks.\n ensureDesignTokens()\n // Always re-check on open so the review screen never shows stale data.\n void store.check().then((report) => {\n if (report !== null) openUpdateView(store, copyFor())\n })\n }\n\n const disposeEntry = mountSidebarEntry({\n rowAttribute: UPDATE_ENTRY_ATTRIBUTE,\n rowSelector: UPDATE_ENTRY_SELECTOR,\n plugin: PLUGIN_ID,\n icon: UPDATE_ICON,\n css: ENTRY_CSS,\n label: () => labelState.label,\n tooltip: () => labelState.tooltip,\n refresh: { subscribe: refreshSubscribe },\n badge: {\n subscribe: (listener) => store.subscribe(listener),\n count: () => store.badgeCount(),\n },\n onToggle: openView,\n position: 'after',\n familySelectors: HUAQIU_SIDEBAR_ENTRY_FAMILY,\n })\n\n store.startIdleRefresh()\n void store.refresh()\n\n const dispose = (): void => {\n try {\n disposeEntry()\n } catch {\n /* already disposed */\n }\n unsubscribeLocale()\n store.stop()\n }\n if (typeof ctx.effect === 'function') {\n // `ctx.effect` takes a SETUP function and calls it immediately, keeping\n // whatever it returns as the teardown. Passing `dispose` itself would run\n // the teardown synchronously — disconnecting the sidebar-entry observers\n // and stopping the store before the shell ever renders the sidebar, so the\n // row could never be placed. Hand it a factory that returns the teardown\n // instead (the same shape the sibling tool plugins use).\n ctx.effect(() => dispose, 'plugin-update')\n }\n return dispose\n}\n"],"mappings":";;;;;;;;EAEA,SAAS,cAAc;GACtB,MAAM,SAAS,SAAS,cAAc,kDAAkD;GACxF,IAAI,WAAW,MAAM,OAAO,KAAK;GACjC,OAAO,OAAO,cAAc,sBAAsB,CAAC,EAAE,iBAAiB,OAAO;EAC9E;;EAEA,SAAS,iBAAiB,MAAM;GAC/B,MAAM,SAAS,KAAK,cAAc,+BAA+B;GACjE,IAAI,WAAW,MAAM,OAAO;GAC5B,KAAK,MAAM,SAAS,KAAK,UAAU,IAAI,MAAM,YAAY,U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MAAM,CAAC,CAAC;IAAO,SAAS,UAAU,MAAM,CAAC,CAAC;GAAQ;GAOxF,MAAM,iBAAuB;IAI3B,mBAAmB;IAEnB,MAAW,MAAM,CAAC,CAAC,MAAM,WAAW;KAClC,IAAI,WAAW,MAAM,eAAe,OAAO,QAAQ,CAAC;IACtD,CAAC;GACH;GAEA,MAAM,eAAe,kBAAkB;IACrC,cAAc;IACd,aAAa;IACb,QAAQ;IACR,MAAM;IACN,KAAK;IACL,aAAa,WAAW;IACxB,eAAe,WAAW;IAC1B,SAAS,EAAE,WAAW,iBAAiB;IACvC,OAAO;KACL,YAAY,aAAa,MAAM,UAAU,QAAQ;KACjD,aAAa,MAAM,WAAW;IAChC;IACA,UAAU;IACV,UAAU;IACV,iBAAiB;GACnB,CAAC;GAED,MAAM,iBAAiB;GACvB,MAAW,QAAQ;GAEnB,MAAM,gBAAsB;IAC1B,IAAI;KACF,aAAa;IACf,QAAQ,CAER;IACA,kBAAkB;IAClB,MAAM,KAAK;GACb;GACA,IAAI,OAAO,IAAI,WAAW,YAOxB,IAAI,aAAa,SAAS,eAAe;GAE3C,OAAO;EACT"}
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../../dsh-sidebar-entry/lib/index.mjs","../src/client/api.ts","../src/client/copy.ts","../src/client/icons.ts","../src/client/update-view.ts","../src/client/index.ts"],"sourcesContent":["//#region src/index.ts\n/** Find the sidebar shell root element, or undefined while not yet mounted. */\nfunction sidebarRoot() {\n\tconst column = document.querySelector(\"[data-pane=\\\"sidebar\\\"], [class*=\\\"sidebarCol\\\"]\");\n\tif (column === null) return void 0;\n\treturn column.querySelector(\"[class*=\\\"logoRow\\\"]\")?.parentElement ?? column.firstElementChild;\n}\n/** The New Session button: nested in the logo row on current shells, a direct child on legacy shells. */\nfunction newSessionButton(root) {\n\tconst nested = root.querySelector(\"button[class*=\\\"newSession\\\"]\");\n\tif (nested !== null) return nested;\n\tfor (const child of root.children) if (child.tagName === \"BUTTON\") return child;\n}\n/** Build the entry row (a detached button; insert once the shell is up). */\nfunction createEntry(options) {\n\tconst entry = document.createElement(\"button\");\n\tentry.type = \"button\";\n\tentry.setAttribute(options.rowAttribute, \"\");\n\tif (options.plugin !== void 0) {\n\t\tentry.setAttribute(\"data-dsh-plugin\", options.plugin);\n\t\tentry.setAttribute(\"data-dsh-part\", \"sidebar-entry\");\n\t}\n\tentry.className = options.css[\"entry\"] ?? \"\";\n\tconst labelSpan = document.createElement(\"span\");\n\tlabelSpan.className = options.css[\"entryLabel\"] ?? \"\";\n\tconst iconSpan = document.createElement(\"span\");\n\ticonSpan.className = options.css[\"entryIcon\"] ?? \"\";\n\ticonSpan.innerHTML = options.icon;\n\tentry.append(iconSpan, labelSpan);\n\tlet badgeSpan = null;\n\tconst applyBadge = () => {\n\t\tif (options.badge === void 0) return;\n\t\tconst count = options.badge.count();\n\t\tif (count <= 0) {\n\t\t\tbadgeSpan?.remove();\n\t\t\tbadgeSpan = null;\n\t\t\treturn;\n\t\t}\n\t\tif (badgeSpan === null) {\n\t\t\tbadgeSpan = document.createElement(\"span\");\n\t\t\tbadgeSpan.className = options.css[\"entryBadge\"] ?? \"\";\n\t\t\tentry.append(badgeSpan);\n\t\t}\n\t\tbadgeSpan.textContent = String(count);\n\t\tentry.setAttribute(\"data-has-badge\", \"\");\n\t};\n\tconst applyLabel = () => {\n\t\tentry.setAttribute(\"aria-label\", options.label());\n\t\tif (options.tooltip !== void 0) entry.setAttribute(\"title\", options.tooltip());\n\t\tlabelSpan.textContent = options.label();\n\t};\n\tapplyLabel();\n\tapplyBadge();\n\tentry.addEventListener(\"click\", options.onToggle);\n\treturn {\n\t\tentry,\n\t\tapplyLabel,\n\t\tapplyBadge\n\t};\n}\n/**\n* Re-insert the entry after the New Session row, in the family's intended\n* order.\n*\n* The `familySelectors` array order is the single source of truth for visual\n* order, so the rendered order is stable regardless of which plugin mounts\n* first or of observer callback order — a re-render can never swap two rows.\n* (Earlier builds used the `position: 'before' | 'after'` convention, which\n* clustered rows by mount order and let a late-mounting `before` row steal the\n* lead. The array order supersedes it; `position` remains only as a fallback\n* for a row whose selector is absent from the family list.)\n*/\nfunction placeEntry(root, entry, options) {\n\tconst button = newSessionButton(root);\n\tif (button === void 0) return false;\n\tif (entry.parentElement !== root) {\n\t\tconst row = button.closest(\"[class*=\\\"logoRow\\\"]\");\n\t\tconst base = row !== null && row.parentElement === root ? row : button;\n\t\tconst order = options.familySelectors;\n\t\tconst present = Array.from(root.children).filter((el) => el instanceof HTMLElement && el.matches(order.join(\", \"))).map((el) => ({\n\t\t\tel,\n\t\t\tidx: order.findIndex((sel) => el.matches(sel))\n\t\t}));\n\t\tconst selfIndex = order.indexOf(options.rowSelector);\n\t\tlet anchor;\n\t\tif (selfIndex === -1) anchor = options.position === \"before\" ? present.length > 0 ? present[0].el : base.nextElementSibling : present.length > 0 ? present[present.length - 1].el.nextElementSibling : base.nextElementSibling;\n\t\telse {\n\t\t\tconst later = present.find((member) => member.idx > selfIndex);\n\t\t\tif (later !== void 0) anchor = later.el;\n\t\t\telse {\n\t\t\t\tconst earlier = [...present].reverse().find((member) => member.idx < selfIndex);\n\t\t\t\tanchor = earlier !== void 0 ? earlier.el.nextElementSibling : base.nextElementSibling;\n\t\t\t}\n\t\t}\n\t\troot.insertBefore(entry, anchor ?? null);\n\t}\n\treturn true;\n}\n/**\n* Mount the sidebar entry, waiting for the shell to render and self-healing\n* on later React re-renders.\n* @param options - the row's attribute/icon/copy/action/ordering configuration.\n* @returns disposer removing the entry and its observers.\n*/\nfunction mountSidebarEntry(options) {\n\tif (typeof document !== \"undefined\" && document.querySelector(options.rowSelector) !== null) return () => {};\n\tconst { entry, applyLabel, applyBadge } = createEntry(options);\n\tlet root;\n\tlet placed = false;\n\tlet unsubscribeRefresh;\n\tif (options.refresh !== void 0) try {\n\t\tunsubscribeRefresh = options.refresh.subscribe(applyLabel);\n\t} catch {}\n\tlet unsubscribeBadge;\n\tif (options.badge !== void 0) try {\n\t\tunsubscribeBadge = options.badge.subscribe(applyBadge);\n\t} catch {}\n\tconst tryPlace = () => {\n\t\tif (root !== void 0 && !root.isConnected) {\n\t\t\trootObserver.disconnect();\n\t\t\troot = void 0;\n\t\t\tplaced = false;\n\t\t}\n\t\tif (placed) {\n\t\t\tif (document.body.contains(entry)) return;\n\t\t\trootObserver.disconnect();\n\t\t\troot = void 0;\n\t\t\tplaced = false;\n\t\t}\n\t\troot ??= sidebarRoot();\n\t\tif (root === void 0) return;\n\t\tplaced = placeEntry(root, entry, options);\n\t\tif (placed) rootObserver.observe(root, {\n\t\t\tchildList: true,\n\t\t\tsubtree: true\n\t\t});\n\t};\n\tconst waitObserver = new MutationObserver(() => {\n\t\ttryPlace();\n\t});\n\twaitObserver.observe(document.body, {\n\t\tchildList: true,\n\t\tsubtree: true\n\t});\n\tconst rootObserver = new MutationObserver(() => {\n\t\tif (root === void 0 || !root.isConnected) {\n\t\t\tplaced = false;\n\t\t\ttryPlace();\n\t\t\treturn;\n\t\t}\n\t\tif (!root.contains(entry)) placed = placeEntry(root, entry, options);\n\t});\n\toptions.active === void 0 || (() => {\n\t\tconst syncActive = () => {\n\t\t\tif (options.active.isOpen()) entry.dataset.active = \"true\";\n\t\t\telse delete entry.dataset.active;\n\t\t};\n\t\tconst unsubscribe = options.active.subscribe(syncActive);\n\t\tsyncActive();\n\t\treturn unsubscribe;\n\t})();\n\ttryPlace();\n\treturn () => {\n\t\twaitObserver.disconnect();\n\t\trootObserver.disconnect();\n\t\tunsubscribeRefresh?.();\n\t\tunsubscribeBadge?.();\n\t\tentry.remove();\n\t};\n}\n/**\n* Every row selector in the Huaqiu sidebar family, in intended visual order.\n*\n* Family ordering is only stable when every participating plugin passes the\n* SAME list to {@link mountSidebarEntry} — the core positions a row relative to\n* the family block, never relative to transient shell geometry. Adding a new\n* family row means adding its selector here (and to no plugin-local list).\n*/\nconst HUAQIU_SIDEBAR_ENTRY_FAMILY = [\n\t\"[data-hq-plugin-update-entry]\",\n\t\"[data-hqcg-footprint-entry]\",\n\t\"[data-hqcg-symbol-entry]\",\n\t\"[data-hqcg-schematic-entry]\",\n\t\"[data-hq-dummy-entry]\"\n];\n/**\n* Read the host UI language from `<html lang>`.\n*\n* `dsh-client-locale` rewrites the attribute on every language change (dsh\n* web) and HQ Edge mirrors it, so this is the one source every family plugin\n* can read without importing a `locale` service.\n* @returns 'zh' / 'en', or undefined when the tag is absent or unsupported\n* (callers fall back to their own default).\n*/\nfunction detectHostLocale() {\n\tif (typeof document === \"undefined\") return void 0;\n\tconst tag = document.documentElement?.getAttribute(\"lang\");\n\tif (tag === null || tag === void 0 || tag === \"\") return void 0;\n\tconst primary = tag.toLowerCase().split(\"-\")[0];\n\treturn primary === \"zh\" || primary === \"en\" ? primary : void 0;\n}\n/**\n* Watch `<html lang>` and report every resolved change.\n*\n* Idempotent-safe: repeated calls share one observer and each caller gets its\n* own disposer; the observer disconnects when the last listener leaves.\n* @param listener - called with the newly resolved language.\n* @returns disposer removing this listener.\n*/\n/** Shared observer/listener set backing {@link observeHostLocale}. */\nconst localeListeners = /* @__PURE__ */ new Set();\nlet localeObserver = null;\nfunction observeHostLocale(listener) {\n\tif (typeof document === \"undefined\" || typeof MutationObserver === \"undefined\" || document.documentElement === null) return () => {};\n\tlet current = detectHostLocale();\n\tconst listeners = localeListeners;\n\tlisteners.add(listener);\n\tif (localeObserver === null) {\n\t\tlocaleObserver = new MutationObserver(() => {\n\t\t\tconst next = detectHostLocale();\n\t\t\tif (next === current) return;\n\t\t\tcurrent = next;\n\t\t\tfor (const fn of [...listeners]) try {\n\t\t\t\tfn(next);\n\t\t\t} catch {}\n\t\t});\n\t\tlocaleObserver.observe(document.documentElement, {\n\t\t\tattributes: true,\n\t\t\tattributeFilter: [\"lang\"]\n\t\t});\n\t}\n\treturn () => {\n\t\tlisteners.delete(listener);\n\t\tif (listeners.size === 0 && localeObserver !== null) {\n\t\t\tlocaleObserver.disconnect();\n\t\t\tlocaleObserver = null;\n\t\t}\n\t};\n}\n//#endregion\nexport { HUAQIU_SIDEBAR_ENTRY_FAMILY, detectHostLocale, mountSidebarEntry, observeHostLocale };\n","/**\n * Plugin-update API client (browser half).\n *\n * Every call is a same-origin fetch against the DSH webServer prefix route\n * (`/api/v1/huaqiu/plugin-update/…`) which the node half forwards to hq-edge.\n * Response shapes mirror hq-edge `apps/server/src/routes/plugin-updates.ts`.\n *\n * @module\n */\n\nexport const UPDATE_BASE = '/api/v1/huaqiu/plugin-update'\n\nexport interface PluginUpdateItem {\n name: string\n /** Version installed in the active bundle; null when the plugin is absent. */\n currentVersion: string | null\n availableVersion: string\n state: 'current' | 'update' | 'install' | 'blocked' | 'ignored'\n /** The block reason, or null when the item is not blocked. The server sends a\n * single code (`\"runtime-unknown\"`), so it is normalized before use. */\n blockedBy?: string | string[] | null\n ignored?: boolean\n reasons?: string[]\n notes?: string[]\n}\n\nexport interface RuntimeUpdateInfo {\n configured: boolean\n currentVersion?: string | null\n latest?: string | null\n updateAvailable: boolean\n checkedAt?: string | null\n lastError?: string | null\n}\n\nexport interface PluginUpdateReport {\n /** The evaluated release set; null while no manifest has been read. */\n manifestVersion: string | null\n pluginSetVersion?: string\n items: PluginUpdateItem[]\n actionableCount: number\n ignoredSet: boolean\n fetchedAt?: string\n lastError?: string | null\n runtime: RuntimeUpdateInfo\n}\n\nasync function request<T>(path: string, init?: RequestInit): Promise<T> {\n const res = await fetch(`${UPDATE_BASE}${path}`, {\n cache: 'no-store',\n ...init,\n headers: { 'content-type': 'application/json; charset=utf-8', ...(init?.headers ?? {}) },\n })\n const body = (await res.json().catch(() => null)) as T | null\n if (!res.ok) {\n const err = (body as { error?: string } | null)?.error ?? `HTTP ${res.status}`\n throw new Error(err)\n }\n if (body === null) throw new Error('empty response')\n return body\n}\n\n/** GET the cached (or empty-shell) plugin-update report. */\nexport function fetchReport(): Promise<PluginUpdateReport> {\n return request<PluginUpdateReport>('/report')\n}\n\n/** POST an explicit refresh; returns the freshly computed report. */\nexport function checkUpdates(): Promise<PluginUpdateReport> {\n return request<PluginUpdateReport>('/check', { method: 'POST' })\n}\n\nexport interface InstallResult {\n ok: boolean\n installedSetVersion?: string\n installed?: number\n skipped?: number\n restarting?: boolean\n error?: string\n}\n\n/** POST the install transaction for the confirmed set version. */\nexport function installSet(setVersion: string): Promise<InstallResult> {\n return request<InstallResult>('/install', {\n method: 'POST',\n body: JSON.stringify({ setVersion }),\n })\n}\n\n/** POST ignore for the current offer (set-scoped, persists across restarts). */\nexport function ignoreOffer(setVersion: string): Promise<unknown> {\n return request<unknown>('/ignore', { method: 'POST', body: JSON.stringify({ setVersion }) })\n}\n\n/** POST unignore for the set version (reverses an ignore). */\nexport function unignoreOffer(setVersion: string): Promise<unknown> {\n return request<unknown>('/unignore', { method: 'POST', body: JSON.stringify({ setVersion }) })\n}\n","/**\n * Localized copy for the plugin-update UI (browser half).\n *\n * zh is the fallback, matching the rest of the Huaqiu plugin family\n * (`<html lang>` drives the resolution via the shared sidebar-entry locale\n * helpers). The wording follows the shell's own plugin manager\n * (`ui-plugin-manager/src/client/locales.ts`) so both read as one product.\n *\n * @module\n */\n\nconst zh = {\n entryLabel: '插件更新',\n entryTooltip: '查看可用的插件更新',\n viewTitle: '插件更新',\n viewIntro: '检查并安装可用的插件更新',\n viewInfo: '在这里查看插件集的更新。标注为「被阻止」的插件因主机或 HQ Edge 版本不兼容而无法安装;已是最新的插件无需操作。',\n refresh: '刷新',\n close: '关闭',\n loading: '正在读取插件更新…',\n empty: '没有可用的插件更新',\n checkFailed: '检查更新失败,请重试',\n installAll: (count: number) => `安装 ${count} 项更新`,\n installOne: '安装',\n installing: '正在安装…(DSH 将自动重启)',\n nothingToInstall: '暂无可安装的更新',\n ignore: '忽略此版本',\n unignore: '恢复提醒',\n ignoredOffer: '已忽略当前插件集更新',\n groupCount: (count: number) => `${count} 个插件`,\n group: {\n actionable: '待处理',\n blocked: '无法安装',\n ignored: '已忽略',\n current: '已是最新',\n },\n state: {\n current: '当前',\n update: '可更新',\n install: '待安装',\n ignored: '已忽略',\n blocked: '被阻止',\n },\n blockedReason: {\n host: '不适用于当前 EDA 主机',\n 'hq-edge-version': '当前 HQ Edge 版本不兼容',\n 'runtime-unknown': 'HQ Edge 版本未知,无法校验',\n },\n runtime: {\n title: 'HQ Edge 运行时',\n current: '当前版本',\n latest: '最新版本',\n set: '发布插件集',\n checkedAt: '上次检查',\n source: '更新源',\n unknown: '版本未知',\n notConfigured: '未配置更新源',\n note: '运行时更新由 EDA 安装器处理',\n },\n lastError: '上次检查失败',\n installError: '安装失败',\n installSuccess: '更新已安装,正在重启 DSH…',\n}\n\nexport type UpdateCopy = typeof zh\n\nconst en: UpdateCopy = {\n entryLabel: 'Plugin Updates',\n entryTooltip: 'Review available plugin updates',\n viewTitle: 'Plugin Updates',\n viewIntro: 'Check for and install available plugin updates',\n viewInfo: 'Review the plugin set updates here. A plugin marked Blocked cannot be installed because its host or HQ Edge version is incompatible; a plugin marked Current needs no action.',\n refresh: 'Refresh',\n close: 'Close',\n loading: 'Reading plugin updates…',\n empty: 'No plugin updates available',\n checkFailed: 'Failed to check for updates — please retry',\n installAll: (count: number) => `Install ${count} update${count === 1 ? '' : 's'}`,\n installOne: 'Install',\n installing: 'Installing… (DSH will restart)',\n nothingToInstall: 'Nothing to install right now',\n ignore: 'Ignore this release',\n unignore: 'Show again',\n ignoredOffer: 'The current plugin-set update is ignored',\n groupCount: (count: number) => `${count} plugin${count === 1 ? '' : 's'}`,\n group: {\n actionable: 'Actionable',\n blocked: 'Blocked',\n ignored: 'Ignored',\n current: 'Up to date',\n },\n state: {\n current: 'Current',\n update: 'Update',\n install: 'Install',\n ignored: 'Ignored',\n blocked: 'Blocked',\n },\n blockedReason: {\n host: 'Not applicable to the current EDA host',\n 'hq-edge-version': 'Incompatible with the current HQ Edge version',\n 'runtime-unknown': 'HQ Edge version unknown — cannot verify',\n },\n runtime: {\n title: 'HQ Edge Runtime',\n current: 'Current version',\n latest: 'Latest version',\n set: 'Release set',\n checkedAt: 'Last checked',\n source: 'Update source',\n unknown: 'Version unknown',\n notConfigured: 'No update source configured',\n note: 'Runtime updates are handled by the EDA installer',\n },\n lastError: 'Last check failed',\n installError: 'Install failed',\n installSuccess: 'Update installed — restarting DSH…',\n}\n\nexport const COPY = { zh, en } as const\n","/**\n * Official DSH icon artwork, inlined as SVG strings.\n *\n * The paths are copied verbatim from `@deepseek-ai/dsh-client-ui-primitives`\n * (deepseek-harness `packages/client/ui-primitives/src/icons/index.tsx`) so the\n * Huaqiu plugin-update view draws the same glyphs as the shell's own plugin\n * manager. Only `currentColor` is used, so every glyph inherits the label ink\n * of whatever surface it sits on — the same contract the primitives rely on.\n *\n * The plugin renders plain DOM (never a React tree), so the artwork is exposed\n * as markup strings rather than components.\n *\n * @module\n */\n\n/** Stroke width of the primitives' \"Regular\" weight. */\nconst REGULAR = 1\n\n/** Stroke width of the primitives' \"Medium\" weight. */\nconst MEDIUM = 1.3\n\n/** Wrap paths in a 16×16 stroked glyph. */\nfunction glyph(size: number, strokeWidth: number, paths: readonly string[], viewBox = '0 0 16 16'): string {\n const body = paths.map((d) => `<path d=\"${d}\" stroke=\"currentColor\" />`).join('')\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${size}\" height=\"${size}\" viewBox=\"${viewBox}\" fill=\"none\" aria-hidden=\"true\" stroke-width=\"${strokeWidth}\" stroke-linecap=\"round\" stroke-linejoin=\"round\">${body}</svg>`\n}\n\n/** Wrap fill-only paths (the check glyph) in their own viewBox. */\nfunction fillGlyph(size: number, paths: readonly string[], viewBox: string): string {\n const body = paths.map((d) => `<path d=\"${d}\" fill=\"currentColor\" />`).join('')\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${size}\" height=\"${size}\" viewBox=\"${viewBox}\" fill=\"none\" aria-hidden=\"true\">${body}</svg>`\n}\n\n/**\n * The plugin pinwheel — the glyph the shell's own Plugins sidebar entry uses\n * (`IconPluginPinwheelOutlineRegular`). Shared by the sidebar row and the\n * package cards so both read as the same feature.\n */\nexport const PLUGIN_ICON = (size = 16): string =>\n glyph(size, REGULAR, [\n 'M7.84457 5.06199C11.6605 4.93876 14.7962 6.14848 14.8484 7.76397C14.8875 8.97461 13.1838 10.0696 10.7215 10.5942',\n 'M5.12742 8.07731C5.00419 4.26138 6.21391 1.12568 7.8294 1.07351C9.04004 1.03441 10.135 2.73808 10.6596 5.20037',\n 'M8.02457 10.6802C4.20865 10.8034 1.07294 9.5937 1.02077 7.97821C0.981678 6.76758 2.68535 5.67262 5.14763 5.14798',\n 'M10.7476 7.89535C10.8708 11.7113 9.66109 14.847 8.0456 14.8991C6.83496 14.9382 5.74 13.2346 5.21536 10.7723',\n ])\n\n/** The toolbar's refresh action (`IconRefreshOutlineRegular`). */\nexport const REFRESH_ICON = (size = 16): string =>\n glyph(size, REGULAR, [\n 'M14.5001 8C14.5 9.28552 14.1188 10.5422 13.4045 11.611C12.6903 12.6799 11.6752 13.5129 10.4875 14.0049C9.29982 14.4968 7.99295 14.6255 6.73212 14.3747C5.4713 14.124 4.31314 13.505 3.4041 12.596C2.49514 11.687 1.87614 10.5288 1.62537 9.26798C1.37459 8.00716 1.50331 6.70028 1.99525 5.51261C2.48719 4.32494 3.32025 3.30981 4.3891 2.59557C5.45795 1.88134 6.71458 1.50008 8.0001 1.5C9.9001 1.5 11.7001 2.3 13.0001 3.6L14.5001 5.1',\n 'M14.4999 1.5V5.1H10.8999',\n ])\n\n/** The panel's close action (`IconCloseOutlineMedium`). */\nexport const CLOSE_ICON = (size = 16): string =>\n glyph(size, MEDIUM, ['M2.5 2.5L13.5 13.5', 'M13.5 2.5L2.5 13.5'])\n\n/** The notice glyph (`IconWarningOutlineRegular`). */\nexport const WARNING_ICON = (size = 16): string =>\n glyph(size, REGULAR, [\n 'M8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5Z',\n 'M8 4.29199V9.79199',\n 'M8 10.708V11.708',\n ])\n\n/** The settled-state glyph (`IconCheckCircleFillRegular`). */\nexport const CHECK_CIRCLE_ICON = (size = 16): string =>\n fillGlyph(size, [\n 'M28.1936 14.6936L19.8066 23.0806C19.2373 23.65 18.7159 24.1742 18.24 24.5571C17.7389 24.9602 17.1365 25.3359 16.3657 25.458C15.9581 25.5225 15.5428 25.5225 15.1353 25.458C14.3645 25.3359 13.7621 24.9602 13.261 24.5571C12.7851 24.1742 12.2637 23.65 11.6943 23.0806L7.80737 19.1936L10.1936 16.8074L14.0806 20.6943C14.7033 21.317 15.0763 21.6873 15.377 21.9292C15.6523 22.1507 15.7109 22.1325 15.6626 22.1248C15.7208 22.1339 15.7802 22.1339 15.8384 22.1248C15.7901 22.1325 15.8486 22.1507 16.124 21.9292C16.4247 21.6873 16.7977 21.317 17.4204 20.6943L25.8074 12.3074L28.1936 14.6936Z',\n 'M32.8496 18.0005C32.8496 9.79906 26.2019 3.15137 18.0005 3.15137C9.79906 3.15137 3.15137 9.79906 3.15137 18.0005C3.15137 26.2019 9.79906 32.8496 18.0005 32.8496C26.2019 32.8496 32.8496 26.2019 32.8496 18.0005ZM35.7764 18.0005C35.7764 27.8173 27.8173 35.7764 18.0005 35.7764C8.18363 35.7764 0.224609 27.8173 0.224609 18.0005C0.224609 8.18363 8.18363 0.224609 18.0005 0.224609C27.8173 0.224609 35.7764 8.18363 35.7764 18.0005Z',\n ], '0 0 36 36')\n\n/** The install action (`IconDownloadOutlineRegular`). */\nexport const DOWNLOAD_ICON = (size = 16): string =>\n glyph(size, REGULAR, [\n 'M8 1.95317V10.0469',\n 'M4.25 6.29688L8 10.0469L11.75 6.29688',\n 'M1.5 10.0469V13.158C1.5 13.3937 1.60536 13.6198 1.79289 13.7865C1.98043 13.9532 2.23478 14.0469 2.5 14.0469H13.5C13.7652 14.0469 14.0196 13.9532 14.2071 13.7865C14.3946 13.6198 14.5 13.3937 14.5 13.158V10.0469',\n ])\n\n/** The head's info affordance (`IconInfoOutlineRegular`, fill-only artwork). */\nexport const INFO_ICON = (size = 11): string =>\n fillGlyph(size, [\n 'M12.5757 7.00012C12.5757 3.92085 10.0794 1.42463 7.00012 1.42456C3.9208 1.42456 1.42456 3.9208 1.42456 7.00012C1.42463 10.0794 3.92085 12.5757 7.00012 12.5757C10.0793 12.5756 12.5756 10.0793 12.5757 7.00012ZM13.8002 7.00012C13.8001 10.7559 10.7559 13.8001 7.00012 13.8002C3.2443 13.8002 0.199291 10.7559 0.199219 7.00012C0.199219 3.24426 3.24426 0.199219 7.00012 0.199219C10.7559 0.199291 13.8002 3.2443 13.8002 7.00012Z',\n 'M7.6127 3.18921V4.55986H6.38735V3.18921H7.6127Z',\n 'M7.6127 5.68921V10.8109H6.38735V5.68921H7.6127Z',\n ], '0 0 14 14')\n\n/** A folded section's chevron (`IconChevronDownOutlineRegular`). */\nexport const CHEVRON_DOWN_ICON = (size = 14): string =>\n glyph(size, REGULAR, ['M4 6L7.29289 9.29289C7.68342 9.68342 8.31658 9.68342 8.70711 9.29289L12 6'])\n","/**\n * Plugin-update review view (browser half).\n *\n * Plain-DOM panel (no React tree) so it can never disturb the DSH shell's\n * reconciliation — same rule as the sidebar entry rows. Rendered content:\n *\n * - head: title + intro + refresh toolbar (the shell plugin-manager head row)\n * - state-grouped sections, each a group head + package cards\n * (48px hairline-framed glyph, title row with a state tag, one-line\n * version transition, end actions) — the shell's card geometry\n * - a facts group for the independent HQ Edge runtime report\n * - footer actions (install / ignore / show again), with a toast that\n * reports the outcome of an install the way the shell's Toast does\n *\n * Every surface rides a `--dsw-alias-*` design token (see VIEW_CSS_TEXT), so\n * the panel follows the shell's light/dark theme and its focus-ring contract.\n *\n * @module\n */\nimport {\n checkUpdates,\n ignoreOffer,\n installSet,\n unignoreOffer,\n type PluginUpdateItem,\n type PluginUpdateReport,\n} from './api.js'\nimport type { UpdateCopy } from './copy.js'\nimport {\n CHECK_CIRCLE_ICON,\n CLOSE_ICON,\n DOWNLOAD_ICON,\n INFO_ICON,\n PLUGIN_ICON,\n REFRESH_ICON,\n WARNING_ICON,\n} from './icons.js'\n\nexport interface UpdateStoreLike {\n report(): PluginUpdateReport | null\n installing(): boolean\n refresh(): Promise<PluginUpdateReport | null>\n subscribe(listener: () => void): () => void\n}\n\n/** How long the outcome toast stays up, in milliseconds. */\nconst TOAST_HOLD_MS = 4000\n\nfunction el<K extends keyof HTMLElementTagNameMap>(\n tag: K,\n className = '',\n text?: string,\n): HTMLElementTagNameMap[K] {\n const node = document.createElement(tag)\n if (className.length > 0) node.className = className\n if (text !== undefined) node.textContent = text\n return node\n}\n\n/** A button carrying inline SVG artwork (the icon modules emit markup). */\nfunction iconButton(\n className: string,\n markup: string,\n label: string,\n onClick: () => void,\n): HTMLButtonElement {\n const button = el('button', className)\n button.type = 'button'\n button.setAttribute('aria-label', label)\n button.title = label\n button.innerHTML = markup\n button.addEventListener('click', onClick)\n return button\n}\n\n/**\n * Compact a package name to what a person calls it — the shell plugin\n * manager's own rule (`presentation.ts` `shortName`), so both UIs read the\n * same plugin by the same name.\n */\nexport function shortName(name: string): string {\n const unscoped = name.startsWith('@') ? name.slice(name.indexOf('/') + 1) : name\n return unscoped.replace(/^dsh-(?:host-|client-)?/, '')\n}\n\n/** Normalize the server's block reason to a list (it may arrive as a string). */\nfunction blockedByList(item: PluginUpdateItem): string[] {\n const by = item.blockedBy\n if (Array.isArray(by)) return by.filter((entry): entry is string => typeof entry === 'string')\n return typeof by === 'string' && by.length > 0 ? [by] : []\n}\n\n/** The tag tone a state reads as, matching the shell's Tag palette. */\nfunction stateTone(item: PluginUpdateItem): 'success' | 'info' | 'warning' | 'danger' | 'neutral' {\n switch (item.state) {\n case 'update':\n return 'info'\n case 'install':\n return 'warning'\n case 'blocked':\n return 'danger'\n case 'ignored':\n return 'neutral'\n case 'current':\n return 'success'\n }\n}\n\nfunction stateLabel(item: PluginUpdateItem, copy: UpdateCopy): string {\n switch (item.state) {\n case 'current':\n return copy.state.current\n case 'update':\n return copy.state.update\n case 'install':\n return copy.state.install\n case 'ignored':\n return copy.state.ignored\n case 'blocked':\n return copy.state.blocked\n }\n}\n\n/** The one-line version transition under a card's title. */\nfunction versionLine(item: PluginUpdateItem): string {\n switch (item.state) {\n case 'current':\n return item.currentVersion ?? item.availableVersion\n case 'install':\n return item.availableVersion\n default:\n // An absent plugin names only the version it would gain.\n return item.currentVersion === null\n ? item.availableVersion\n : `${item.currentVersion} → ${item.availableVersion}`\n }\n}\n\nfunction blockedReason(item: PluginUpdateItem, copy: UpdateCopy): string | undefined {\n const by = blockedByList(item)\n if (by.includes('host')) return copy.blockedReason.host\n if (by.includes('hq-edge-version')) return copy.blockedReason['hq-edge-version']\n if (by.includes('runtime-unknown')) return copy.blockedReason['runtime-unknown']\n return by.length > 0 ? by.join(', ') : undefined\n}\n\n/** One package card: glyph, name with its state tag, version line, end actions. */\nfunction packageCard(\n item: PluginUpdateItem,\n copy: UpdateCopy,\n installing: boolean,\n store: UpdateStoreLike,\n): HTMLLIElement {\n const card = el('li', 'hqpu-card')\n card.dataset.pluginName = item.name\n card.dataset.state = item.state\n // The full package name is the card's tooltip; the row shows the short name.\n card.title = `${item.name} · ${versionLine(item)}`\n\n const head = el('div', 'hqpu-card-head')\n\n const glyph = el('span', 'hqpu-card-icon')\n glyph.setAttribute('aria-hidden', 'true')\n glyph.innerHTML = PLUGIN_ICON(24)\n\n const main = el('div', 'hqpu-card-main')\n const titleRow = el('div', 'hqpu-title-row')\n const title = el('span', 'hqpu-card-title', shortName(item.name))\n const tag = el('span', 'hqpu-tag')\n tag.dataset.tone = stateTone(item)\n tag.textContent = stateLabel(item, copy)\n titleRow.append(title, tag)\n\n const desc = el('span', 'hqpu-card-desc', versionLine(item))\n\n main.append(titleRow, desc)\n head.append(glyph, main)\n\n const end = el('div', 'hqpu-card-end')\n if (item.state === 'update' || item.state === 'install') {\n const button = el('button', 'hqpu-btn hqpu-btn--sm hqpu-btn--primary')\n button.type = 'button'\n button.disabled = installing\n button.innerHTML = `${DOWNLOAD_ICON(13)}<span>${copy.installOne}</span>`\n button.addEventListener('click', () => {\n void runInstall(store, copy)\n })\n end.append(button)\n }\n head.append(end)\n card.append(head)\n\n // A block reason belongs to a blocked offer only.\n if (item.state === 'blocked') {\n const reason = blockedReason(item, copy)\n if (reason !== undefined) {\n card.append(el('p', 'hqpu-card-reason', reason))\n }\n }\n return card\n}\n\n/** A section: group head with its count, then the cards. */\nfunction group(\n heading: string,\n items: PluginUpdateItem[],\n copy: UpdateCopy,\n installing: boolean,\n store: UpdateStoreLike,\n): HTMLElement | null {\n if (items.length === 0) return null\n const section = el('section', 'hqpu-group')\n section.dataset.group = heading\n\n const head = el('div', 'hqpu-group-head')\n head.append(el('h3', 'hqpu-group-title', heading))\n head.append(el('span', 'hqpu-group-count', copy.groupCount(items.length)))\n\n const list = el('ul', 'hqpu-cards')\n for (const item of items) list.append(packageCard(item, copy, installing, store))\n\n section.append(head, list)\n return section\n}\n\n/** First-read placeholders, sharing the card and text-line layout. */\nfunction skeleton(copy: UpdateCopy): HTMLElement {\n const section = el('section', 'hqpu-group')\n section.setAttribute('role', 'status')\n section.dataset.loading = ''\n const head = el('div', 'hqpu-group-head')\n head.setAttribute('aria-hidden', 'true')\n const heading = el('span', 'hqpu-group-title hqpu-skeleton-text hqpu-skeleton-heading')\n const headingBar = el('span', 'hqpu-skeleton-fill hqpu-skeleton-bar')\n heading.append(headingBar)\n head.append(heading)\n\n const list = el('ul', 'hqpu-cards')\n list.setAttribute('aria-hidden', 'true')\n for (let index = 0; index < 3; index += 1) {\n const card = el('li', 'hqpu-card')\n const cardHead = el('div', 'hqpu-card-head')\n const glyph = el('span', 'hqpu-card-icon hqpu-skeleton-fill hqpu-skeleton-icon')\n const main = el('div', 'hqpu-card-main')\n const titleRow = el('div', 'hqpu-title-row')\n const title = el('span', 'hqpu-card-title hqpu-skeleton-text hqpu-skeleton-title')\n title.append(el('span', 'hqpu-skeleton-fill hqpu-skeleton-bar'))\n titleRow.append(title)\n const desc = el('span', 'hqpu-card-desc hqpu-skeleton-text hqpu-skeleton-desc')\n desc.append(el('span', 'hqpu-skeleton-fill hqpu-skeleton-bar'))\n main.append(titleRow, desc)\n cardHead.append(glyph, main)\n const end = el('div', 'hqpu-card-end')\n end.setAttribute('aria-hidden', 'true')\n cardHead.append(end)\n card.append(cardHead)\n list.append(card)\n }\n section.append(head, list)\n // The skeleton replaces the whole column, so label it for screen readers.\n section.setAttribute('aria-label', copy.loading)\n return section\n}\n\n/** The independent HQ Edge runtime report, as ruled fact rows. */\nfunction runtimeGroup(report: PluginUpdateReport, copy: UpdateCopy): HTMLElement {\n const section = el('section', 'hqpu-group')\n section.dataset.group = 'runtime'\n const head = el('div', 'hqpu-group-head')\n head.append(el('h3', 'hqpu-group-title', copy.runtime.title))\n section.append(head)\n\n const facts = el('dl', 'hqpu-facts')\n const runtime = report.runtime\n\n const row = (label: string, value: string, code = false): void => {\n const wrap = el('div')\n wrap.append(el('dt', '', label))\n const dd = el('dd')\n if (code) {\n const node = el('code', '', value)\n dd.append(node)\n } else {\n dd.textContent = value\n }\n wrap.append(dd)\n facts.append(wrap)\n }\n\n if (runtime.configured === false) {\n row(copy.runtime.source, copy.runtime.notConfigured)\n } else {\n row(copy.runtime.current, runtime.currentVersion ?? copy.runtime.unknown)\n if (runtime.updateAvailable && runtime.latest != null) {\n row(copy.runtime.latest, runtime.latest)\n }\n if (report.manifestVersion !== null) {\n row(copy.runtime.set, report.manifestVersion, true)\n }\n if (typeof runtime.checkedAt === 'string' && runtime.checkedAt.length > 0) {\n row(copy.runtime.checkedAt, new Date(runtime.checkedAt).toLocaleString())\n }\n }\n section.append(facts)\n\n section.append(el('p', 'hqpu-status', copy.runtime.note))\n if (typeof runtime.lastError === 'string' && runtime.lastError.length > 0) {\n const line = el('p', 'hqpu-status hqpu-status--dot')\n line.setAttribute('role', 'status')\n const dot = el('span', 'hqpu-dot')\n dot.dataset.state = 'error'\n line.append(dot, el('span', '', `${copy.lastError}: ${runtime.lastError}`))\n section.append(line)\n }\n return section\n}\n\nfunction renderList(\n section: HTMLElement,\n report: PluginUpdateReport | null,\n copy: UpdateCopy,\n installing: boolean,\n store: UpdateStoreLike,\n): void {\n section.textContent = ''\n if (report === null) {\n section.append(skeleton(copy))\n return\n }\n if (report.items.length === 0) {\n section.append(el('div', 'hqpu-empty', copy.empty))\n return\n }\n\n const byState = (state: PluginUpdateItem['state']): PluginUpdateItem[] =>\n report.items.filter((item) => item.state === state)\n\n // Most important first: what can be acted on, then what is refused, then\n // what was muted, then what is already settled.\n const order: Array<[string, PluginUpdateItem[]]> = [\n [copy.group.actionable, [...byState('update'), ...byState('install')]],\n [copy.group.blocked, byState('blocked')],\n [copy.group.ignored, byState('ignored')],\n [copy.group.current, byState('current')],\n ]\n for (const [heading, items] of order) {\n const node = group(heading, items, copy, installing, store)\n if (node !== null) section.append(node)\n }\n}\n\nfunction renderRuntime(\n section: HTMLElement,\n report: PluginUpdateReport | null,\n copy: UpdateCopy,\n): void {\n section.textContent = ''\n if (report === null) return\n section.append(runtimeGroup(report, copy))\n}\n\n/** Run the install transaction, then keep polling until the state settles. */\nasync function runInstall(store: UpdateStoreLike, copy: UpdateCopy): Promise<void> {\n const report = store.report()\n if (report === null) return\n // Without an evaluated set there is nothing to install: hq-edge has not read\n // a manifest yet, so the report is still its empty shell.\n if (report.manifestVersion === null) {\n showToast(copy.checkFailed, 'error')\n return\n }\n try {\n const result = await installSet(report.manifestVersion)\n if (result.error !== undefined) {\n showToast(`${copy.installError}: ${result.error}`, 'error')\n return\n }\n // The set activates atomically and DSH restarts. Keep polling the backend\n // state rather than trusting the response alone (spec §7.1).\n showToast(copy.installSuccess, 'success')\n void pollUntilSettled(store)\n } catch (err: unknown) {\n showToast(\n `${copy.installError}: ${err instanceof Error ? err.message : String(err)}`,\n 'error',\n )\n }\n}\n\n/** The single live toast; a new message replaces the one on screen. */\nlet toastHost: HTMLElement | null = null\nlet toastTimer: number | null = null\n\nfunction showToast(message: string, tone: 'success' | 'error'): void {\n if (toastHost === null) return\n if (toastTimer !== null) window.clearTimeout(toastTimer)\n toastHost.textContent = ''\n const toast = el('div', 'hqpu-toast')\n toast.setAttribute('role', 'status')\n const icon = el('span', 'hqpu-toast-icon')\n icon.dataset.tone = tone\n icon.innerHTML = tone === 'success' ? CHECK_CIRCLE_ICON(16) : WARNING_ICON(16)\n toast.append(icon, el('span', 'hqpu-toast-text', message))\n toastHost.append(toast)\n toastTimer = window.setTimeout(() => {\n toastHost?.replaceChildren()\n toastTimer = null\n }, TOAST_HOLD_MS)\n}\n\nfunction renderActions(\n bar: HTMLElement,\n report: PluginUpdateReport | null,\n copy: UpdateCopy,\n store: UpdateStoreLike,\n installing: boolean,\n): void {\n bar.textContent = ''\n if (report === null) return\n\n if (installing) {\n const line = el('span', 'hqpu-status hqpu-status--dot')\n const spinner = el('span', 'hqpu-spinner')\n line.append(spinner, el('span', '', copy.installing))\n bar.append(line)\n return\n }\n\n const actionable = report.items.filter(\n (item) => item.state === 'update' || item.state === 'install',\n ).length\n // Every write needs an evaluated set; hq-edge reports `null` until it has\n // read a manifest, and posting `null` would only earn a 400.\n const hasSet = report.manifestVersion !== null\n\n if (actionable === 0) {\n // The official page shows no install control when there is nothing to\n // commit, so mirror that with a muted line rather than a dead button.\n bar.append(el('span', 'hqpu-status', copy.nothingToInstall))\n } else {\n const installBtn = el('button', 'hqpu-btn hqpu-btn--primary')\n installBtn.type = 'button'\n installBtn.disabled = !hasSet || report.ignoredSet\n installBtn.innerHTML = `${DOWNLOAD_ICON(13)}<span>${copy.installAll(actionable)}</span>`\n installBtn.addEventListener('click', () => {\n void runInstall(store, copy)\n })\n bar.append(installBtn)\n }\n\n if (!hasSet) return\n\n if (report.ignoredSet) {\n const unignore = el('button', 'hqpu-btn hqpu-btn--outline hqpu-btn--sm', copy.unignore)\n unignore.type = 'button'\n unignore.addEventListener('click', () => {\n void unignoreOffer(report.manifestVersion as string)\n .then(() => store.refresh())\n .catch(() => undefined)\n })\n bar.append(unignore)\n } else if (actionable > 0) {\n const ignore = el('button', 'hqpu-btn hqpu-btn--ghost hqpu-btn--sm', copy.ignore)\n ignore.type = 'button'\n ignore.addEventListener('click', () => {\n void ignoreOffer(report.manifestVersion as string)\n .then(() => store.refresh())\n .catch(() => undefined)\n })\n bar.append(ignore)\n }\n}\n\n/** After an install, poll the backend until the update report settles\n * (installing flag clears or DSH restarts under us — the next load re-reads\n * the fresh state). */\nfunction pollUntilSettled(store: UpdateStoreLike): void {\n let attempts = 0\n const tick = (): void => {\n void store\n .refresh()\n .then((report) => {\n if (store.installing()) return\n if (report !== null && report.ignoredSet === false && attempts >= 2) return\n })\n .catch(() => undefined)\n .finally(() => {\n attempts += 1\n if (attempts < 10) {\n window.setTimeout(tick, 2000)\n }\n })\n }\n tick()\n}\n\n/**\n * Open (or focus) the update panel. Re-renders from the store; when the store\n * is stale the panel first refreshes the report.\n */\nexport function openUpdateView(store: UpdateStoreLike, copy: UpdateCopy): void {\n const existing = document.querySelector<HTMLElement>('[data-hq-plugin-update-view]')\n if (existing !== null) {\n existing.style.display = ''\n return\n }\n\n const overlay = el('div', 'hqpu-overlay')\n overlay.setAttribute('data-hq-plugin-update-view', '')\n overlay.addEventListener('click', (ev) => {\n if (ev.target === overlay) onClose()\n })\n\n const scrim = el('div', 'hqpu-scrim')\n const panel = el('div', 'hqpu-panel')\n panel.setAttribute('role', 'dialog')\n panel.setAttribute('aria-modal', 'true')\n panel.setAttribute('aria-label', copy.viewTitle)\n panel.tabIndex = -1\n\n // ── Head row: title + intro, refresh toolbar ──\n const head = el('div', 'hqpu-head')\n const headMain = el('div', 'hqpu-head-main')\n headMain.append(el('h1', 'hqpu-title', copy.viewTitle))\n const intro = el('p', 'hqpu-intro')\n intro.append(el('span', '', copy.viewIntro))\n const info = el('button', 'hqpu-info')\n info.type = 'button'\n info.setAttribute('aria-label', copy.viewInfo)\n info.title = copy.viewInfo\n info.innerHTML = INFO_ICON(11)\n intro.append(info)\n headMain.append(intro)\n\n const toolbar = el('div', 'hqpu-toolbar')\n const refreshBtn = iconButton('hqpu-icon-btn', REFRESH_ICON(16), copy.refresh, () => {\n void store.refresh()\n })\n toolbar.append(refreshBtn)\n const closeBtn = iconButton('hqpu-icon-btn', CLOSE_ICON(16), copy.close, () => {\n onClose()\n })\n toolbar.append(closeBtn)\n\n head.append(headMain, toolbar)\n panel.append(head)\n\n // ── Scrolling body: the centred column ──\n const scroll = el('div', 'hqpu-scroll')\n const column = el('div', 'hqpu-column')\n const listSection = el('div', 'hqpu-stack')\n const runtimeSection = el('div', 'hqpu-stack')\n const toastSection = el('div', 'hqpu-toast-host')\n column.append(listSection, runtimeSection, toastSection)\n scroll.append(column)\n panel.append(scroll)\n\n // ── Footer actions (ui-primitives Modal .footer) ──\n const footer = el('div', 'hqpu-footer')\n const actionBar = el('div', 'hqpu-actions')\n footer.append(actionBar)\n panel.append(footer)\n\n overlay.append(scrim, panel)\n document.body.appendChild(overlay)\n toastHost = toastSection\n panel.focus()\n\n const disposers: Array<() => void> = []\n\n const render = (): void => {\n const report = store.report()\n const installing = store.installing()\n const stale = report === null\n refreshBtn.disabled = stale\n if (stale) {\n listSection.textContent = ''\n listSection.append(skeleton(copy))\n } else {\n renderList(listSection, report, copy, installing, store)\n }\n renderRuntime(runtimeSection, report, copy)\n renderActions(actionBar, report, copy, store, installing)\n }\n\n const unsubscribe = store.subscribe(render)\n disposers.push(unsubscribe)\n\n // Refresh on open (bounded; never block the shell).\n void store.refresh().then(() => {\n // Store notification re-renders already; nothing extra to do.\n })\n\n // Escape closes, the shell-wide dialog contract.\n const onKeyDown = (ev: KeyboardEvent): void => {\n if (ev.key === 'Escape') {\n ev.stopPropagation()\n onClose()\n }\n }\n document.addEventListener('keydown', onKeyDown)\n disposers.push(() => document.removeEventListener('keydown', onKeyDown))\n\n function onClose(): void {\n for (const dispose of disposers) {\n try {\n dispose()\n } catch {\n /* already disposed */\n }\n }\n if (toastTimer !== null) window.clearTimeout(toastTimer)\n toastTimer = null\n if (toastHost === toastSection) toastHost = null\n overlay.remove()\n }\n\n render()\n}\n","/**\n * `@huaqiu/dsh-tool-plugin-update` — browser half.\n *\n * Mounts one sidebar toolbutton in the Huaqiu family block (\"插件更新\") with a\n * numeric badge equal to the actionable plugin-update count (spec §6.3/§7.1:\n * only compatible `update` + `install` items after host/HQ-Edge filtering and\n * after excluding the ignored offer; runtime updates are NOT counted). Click\n * opens the review/confirm/ignore modal.\n *\n * The authoritative state is the hq-edge report fetched through the plugin's\n * same-origin forwarding routes. A tiny in-memory store owns the latest report\n * + installing flag; the sidebar badge and the modal subscribe to it. No\n * timers beyond the install-poll and an idle 60 s refresh.\n *\n * @module\n */\nimport {\n HUAQIU_SIDEBAR_ENTRY_FAMILY,\n detectHostLocale,\n mountSidebarEntry,\n observeHostLocale,\n type HostLocale,\n} from '@huaqiu/dsh-sidebar-entry'\nimport { checkUpdates, fetchReport, type PluginUpdateReport } from './api.js'\nimport { COPY } from './copy.js'\nimport { PLUGIN_ICON } from './icons.js'\nimport { openUpdateView, type UpdateStoreLike } from './update-view.js'\n\n/** Stable data attributes identifying the injected entry row. */\nexport const UPDATE_ENTRY_SELECTOR = '[data-hq-plugin-update-entry]'\nexport const UPDATE_ENTRY_ATTRIBUTE = 'data-hq-plugin-update-entry'\n\n/** L2 semantic plugin id: rows carry data-dsh-plugin + data-dsh-part. */\nconst PLUGIN_ID = 'huaqiu-plugin-update'\n\n/** Row class names (defined by {@link ENTRY_CSS_TEXT}). */\nconst ENTRY_CSS: Record<string, string> = {\n entry: 'hqpu-sidebar-entry',\n entryIcon: 'hqpu-sidebar-entry__icon',\n entryLabel: 'hqpu-sidebar-entry__label',\n entryBadge: 'hqpu-sidebar-entry__badge',\n}\n\n/** Localized row copy: zh is the fallback, matching the family convention. */\nfunction entryCopy(lang: HostLocale | undefined): { label: string; tooltip: string } {\n return lang === 'en'\n ? { label: COPY.en.entryLabel, tooltip: COPY.en.entryTooltip }\n : { label: COPY.zh.entryLabel, tooltip: COPY.zh.entryTooltip }\n}\n\n/** The sidebar glyph — the same pinwheel the shell's own Plugins entry draws\n * (`IconPluginPinwheelOutlineRegular`), so both rows read as one feature. */\nexport const UPDATE_ICON = PLUGIN_ICON(16)\n\n/** Sidebar entry styles — matched to the family rows (same inset/padding/gap\n * as the shell's own Plugins entry, `SidebarRoot.module.css` `.panelRow`).\n * Every colour rides a `--dsw-alias-*` token so the row follows the shell's\n * light/dark theme; the badge foreground uses the toast label, the shell's\n * \"always light ink on a saturated surface\" token. */\nconst ENTRY_CSS_TEXT = `\n.hqpu-sidebar-entry {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n margin: 0 2px;\n min-height: 36px;\n padding: 7px 8px;\n background: transparent;\n border: none;\n border-radius: var(--dsw-radius-md);\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n font: inherit;\n line-height: 22px;\n text-align: left;\n white-space: nowrap;\n}\n.hqpu-sidebar-entry:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n.hqpu-sidebar-entry[data-active] {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-primary);\n}\n.hqpu-sidebar-entry:focus-visible {\n outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline-offset: -2px;\n}\n.hqpu-sidebar-entry__icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n}\n.hqpu-sidebar-entry__icon svg {\n display: block;\n width: 16px;\n height: 16px;\n}\n.hqpu-sidebar-entry__label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: 1;\n}\n.hqpu-sidebar-entry__badge {\n flex: none;\n min-width: 16px;\n height: 16px;\n padding: 0 5px;\n border-radius: 8px;\n background: var(--dsw-alias-state-error-primary);\n color: var(--dsw-alias-toast-label);\n font-size: 11px;\n line-height: 16px;\n font-weight: 500;\n text-align: center;\n font-variant-numeric: tabular-nums;\n}\n/* Collapsed rail: icon-only, centered — same 36px square the shell uses. */\n[data-sidebar-collapsed] .hqpu-sidebar-entry {\n justify-content: center;\n width: 36px;\n height: 36px;\n margin: 0;\n padding: 0;\n}\n[data-sidebar-collapsed] .hqpu-sidebar-entry__icon svg {\n width: 18px;\n height: 18px;\n}\n[data-sidebar-collapsed] .hqpu-sidebar-entry__label,\n[data-sidebar-collapsed] .hqpu-sidebar-entry__badge {\n display: none;\n}\n`\n\n/**\n * View styles (hqpu-*). Plain overlay + panel, drawn with the SAME design\n * tokens and geometry the shell's own plugin manager uses\n * (`ui-plugin-manager/src/client/PluginManagerPage.module.css` +\n * `ui-primitives/src/{Modal,Toast,Tag,StateDot}.module.css`), so this page\n * reads as part of the product rather than a bolt-on.\n *\n * Two rules keep it honest across themes:\n * 1. every colour is a `--dsw-alias-*` token — no literal hex/rgb, so light\n * and dark both come out right (the old sheet invented\n * `--dsw-alias-bg-surface` / `--dsw-alias-line-border` / `--dsw-alias-bg-badge`,\n * none of which exist, and so always fell back to a white panel);\n * 2. `color-mix()` tints come from the state token itself, so a palette\n * change moves fill and ink together.\n *\n * The chrome (panel, scrim, header, footer) follows `ui-primitives/Modal`,\n * because this view IS a dialog; the body follows `PluginManagerPage`, because\n * that is the content it heads. The one token the bundled shell does not\n * publish is backfilled by {@link ensureDesignTokens} — see the note there.\n */\nconst VIEW_CSS_TEXT = `\n/* ── Overlay + panel (ui-primitives Modal.module.css) ─────────────────── */\n.hqpu-overlay {\n position: fixed;\n inset: 0;\n z-index: 1000;\n display: flex;\n align-items: center;\n justify-content: center;\n /* The frame's own top inset keeps a tall card clear of the window chrome. */\n padding: max(24px, var(--dsh-frame-overlay-top, 24px)) 24px;\n}\n.hqpu-scrim {\n position: absolute;\n /* Only paint excludes the native caption; the root still blocks clicks. */\n inset: var(--dsh-frame-chrome-top, 0px) 0 0;\n background: var(--dsw-alias-bg-mask-1);\n animation: hqpu-fade var(--ds-transition-duration, 0.2s) var(--ds-ease-in-out, ease);\n}\n.hqpu-panel {\n position: relative;\n z-index: 1;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n gap: 20px;\n width: min(920px, 100%);\n max-height: 100%;\n overflow: hidden;\n border: 0;\n border-radius: var(--dsw-radius-panel);\n background: var(--dsw-alias-bg-layer-2);\n box-shadow: var(--dsw-elevation-prominent);\n color: var(--dsw-alias-label-primary);\n animation: hqpu-panel-in var(--ds-transition-duration, 0.2s) var(--ds-ease-in-out, ease);\n}\n.hqpu-panel:focus {\n outline: none;\n}\n@keyframes hqpu-fade {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n@keyframes hqpu-panel-in {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n/* ── Head row (ui-primitives Modal .header) ─────────────────────────────── */\n.hqpu-head {\n display: flex;\n flex: none;\n flex-wrap: wrap;\n align-items: flex-start;\n justify-content: space-between;\n gap: 16px;\n box-sizing: border-box;\n /* The official Title row: 22/14/12/24 — the toolbar sits 10px further right\n * than the body content on purpose, matching the shell's own close button. */\n padding: 22px 14px 12px 24px;\n}\n.hqpu-head-main {\n min-width: 0;\n max-width: 100%;\n}\n.hqpu-title {\n margin: 0;\n font-size: 20px;\n font-weight: 500;\n line-height: 28px;\n color: var(--dsw-alias-label-primary);\n}\n.hqpu-intro {\n display: flex;\n align-items: center;\n gap: 4px;\n margin: 4px 0 0;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n.hqpu-info {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n width: 20px;\n height: 20px;\n padding: 0;\n border: 0;\n border-radius: var(--dsw-radius-sm);\n background: transparent;\n color: var(--dsw-alias-label-caption);\n cursor: pointer;\n}\n.hqpu-info:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-secondary);\n}\n.hqpu-info:focus-visible {\n outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline-offset: 1px;\n}\n.hqpu-toolbar {\n display: flex;\n flex: none;\n align-items: center;\n gap: 16px;\n}\n\n/* ── Scrolling body: the page's centred column ────────────────────────── */\n.hqpu-scroll {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n box-sizing: border-box;\n /* The panel's 20px gap already separates this from the head and footer. */\n padding: 0 clamp(16px, 3vw, 32px) 4px;\n /* Anything that scrolls inside the panel draws the l2 thumb. */\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n}\n.hqpu-column {\n display: flex;\n flex-direction: column;\n gap: 24px;\n width: 100%;\n max-width: 880px;\n margin: 0 auto;\n}\n/* A stack of groups (or the single toast host) inside the column. */\n.hqpu-stack {\n display: flex;\n flex-direction: column;\n gap: 24px;\n}\n.hqpu-toast-host:empty {\n display: none;\n}\n\n/* ── Groups (PluginManagerPage .group) ────────────────────────────────── */\n.hqpu-group {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.hqpu-group-head {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.hqpu-group-title {\n flex: 1;\n min-width: 0;\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n line-height: 22px;\n color: var(--dsw-alias-label-primary);\n}\n.hqpu-group-count {\n flex: none;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-tertiary);\n font-variant-numeric: tabular-nums;\n}\n\n/* ── Cards (PluginManagerPage .card) ──────────────────────────────────── */\n.hqpu-cards {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n.hqpu-card {\n min-width: 0;\n /* The hover surface reaches 8px past the content on both sides. */\n margin: 0 -8px;\n border-radius: var(--dsw-radius-xl);\n}\n.hqpu-card:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n.hqpu-card-head {\n display: flex;\n align-items: center;\n gap: 14px;\n padding: 8px;\n}\n.hqpu-card-icon {\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 48px;\n height: 48px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-lg);\n color: var(--dsw-alias-label-secondary);\n}\n.hqpu-card-icon svg {\n display: block;\n width: 24px;\n height: 24px;\n}\n.hqpu-card-main {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.hqpu-title-row {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 8px;\n min-width: 0;\n}\n.hqpu-card-title {\n min-width: 0;\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n color: var(--dsw-alias-label-primary);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.hqpu-card-desc {\n font-size: 13px;\n line-height: 18px;\n color: var(--dsw-alias-label-tertiary);\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n overflow-wrap: anywhere;\n}\n.hqpu-card-end {\n position: relative;\n z-index: 1;\n display: inline-flex;\n flex: none;\n align-items: center;\n gap: 8px;\n}\n.hqpu-card-reason {\n margin: 0;\n padding: 0 8px 8px 70px;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-state-error-primary);\n overflow-wrap: anywhere;\n}\n\n/* ── Tags (ui-primitives Tag.module.css) ──────────────────────────────── */\n.hqpu-tag {\n display: inline-flex;\n align-items: center;\n flex: none;\n border-radius: 999px;\n corner-shape: round;\n padding: 1px 8px;\n font-size: 11px;\n font-weight: 500;\n line-height: 17px;\n white-space: nowrap;\n}\n.hqpu-tag[data-tone='success'] {\n background: color-mix(in srgb, var(--dsw-alias-state-success-primary) 10%, transparent);\n color: var(--dsw-alias-state-success-primary);\n}\n.hqpu-tag[data-tone='info'] {\n background: color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent);\n color: var(--dsw-alias-state-business-primary);\n}\n.hqpu-tag[data-tone='warning'] {\n background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 12%, transparent);\n color: var(--dsw-alias-state-warn-primary);\n}\n.hqpu-tag[data-tone='danger'] {\n background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent);\n color: var(--dsw-alias-state-error-primary);\n}\n.hqpu-tag[data-tone='neutral'] {\n background: var(--dsw-alias-bg-module-platform);\n color: var(--dsw-alias-label-secondary);\n}\n\n/* ── Fact rows (PluginManagerPage .facts / .rows) ─────────────────────── */\n.hqpu-facts {\n margin: 0;\n display: flex;\n flex-direction: column;\n}\n.hqpu-facts > div {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 16px;\n min-height: 44px;\n padding: 8px 2px;\n border-bottom: 0.5px solid var(--dsw-alias-border-l2);\n}\n.hqpu-facts > div:last-child {\n border-bottom: 0;\n}\n.hqpu-facts dt {\n flex: none;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n.hqpu-facts dd {\n min-width: 0;\n margin: 0;\n font-size: 13px;\n line-height: 20px;\n text-align: end;\n overflow-wrap: anywhere;\n color: var(--dsw-alias-label-primary);\n}\n.hqpu-facts code {\n padding: 2px 6px;\n border-radius: var(--dsw-radius-xs);\n background: var(--dsw-alias-bg-module-platform);\n font-family: var(--dsw-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);\n font-size: 12px;\n}\n\n/* ── Banner (PluginManagerPage .installSafety) ────────────────────────── */\n.hqpu-banner {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 10px 12px;\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-state-warn-tertiary);\n font-size: 12.5px;\n line-height: 18px;\n color: var(--dsw-alias-label-secondary);\n}\n.hqpu-banner > svg {\n flex: none;\n margin-top: 2px;\n color: var(--dsw-alias-state-warn-primary);\n}\n\n/* ── Status, empty, failure (PluginManagerPage .status / .empty / .failure) */\n.hqpu-status {\n margin: 0;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-tertiary);\n}\n.hqpu-status--dot {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n}\n.hqpu-failure {\n display: flex;\n align-items: center;\n gap: 10px;\n color: var(--dsw-alias-state-error-primary);\n}\n.hqpu-empty {\n padding: 32px 0;\n text-align: center;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-tertiary);\n}\n\n/* ── State dot + spinner (ui-primitives StateDot.module.css) ──────────── */\n.hqpu-dot {\n position: relative;\n display: inline-block;\n flex: none;\n width: 10px;\n height: 10px;\n}\n.hqpu-dot::after {\n content: '';\n position: absolute;\n inset: 20%;\n border-radius: 50%;\n corner-shape: round;\n background: currentColor;\n}\n.hqpu-dot[data-state='done'] { color: var(--dsw-alias-state-success-primary); }\n.hqpu-dot[data-state='warning'] { color: var(--dsw-alias-state-warn-primary); }\n.hqpu-dot[data-state='error'] { color: var(--dsw-alias-state-error-primary); }\n.hqpu-dot[data-state='idle'] { color: var(--dsw-alias-state-idle-primary); }\n.hqpu-spinner {\n flex: none;\n width: 14px;\n height: 14px;\n border-radius: 50%;\n border: 1.5px solid color-mix(in srgb, currentColor 25%, transparent);\n border-top-color: currentColor;\n animation: hqpu-spin 1.5s linear infinite;\n}\n@keyframes hqpu-spin {\n to { transform: rotate(360deg); }\n}\n\n/* ── Skeleton (PluginManagerPage .skeleton*) ──────────────────────────── */\n.hqpu-skeleton-fill {\n background: var(--dsw-alias-bg-skeleton);\n animation: hqpu-skeleton 2s cubic-bezier(0.36, 0, 0.64, 1) infinite;\n}\n.hqpu-skeleton-text {\n display: flex;\n align-items: center;\n height: 1lh;\n}\n.hqpu-skeleton-bar {\n width: 100%;\n height: 12px;\n border-radius: var(--dsw-radius-xs);\n}\n.hqpu-skeleton-heading { width: 96px; }\n.hqpu-skeleton-title { width: min(144px, 60%); }\n.hqpu-skeleton-desc { width: min(280px, 85%); }\n.hqpu-skeleton-icon { border-color: transparent; }\n@keyframes hqpu-skeleton {\n 0% { opacity: 1; }\n 40% { opacity: 0.6; }\n 80%, 100% { opacity: 1; }\n}\n\n/* ── Toast (ui-primitives Toast.module.css, held inside the panel) ────── */\n.hqpu-toast {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-alias-toast-bg);\n color: var(--dsw-alias-toast-label);\n font-size: 14px;\n line-height: 22px;\n box-shadow: var(--dsw-shadow-lv3);\n animation: hqpu-toast-in 160ms ease-out;\n}\n.hqpu-toast-icon {\n display: grid;\n place-items: center;\n flex: none;\n color: var(--dsw-alias-state-warn-label);\n}\n.hqpu-toast-icon[data-tone='success'] { color: var(--dsw-alias-state-success-primary); }\n.hqpu-toast-text { min-width: 0; }\n@keyframes hqpu-toast-in {\n from { opacity: 0; transform: translateY(-6px); }\n to { opacity: 1; transform: none; }\n}\n\n/* ── Buttons (PluginManagerPage .addButton / .iconButton) ─────────────── */\n.hqpu-icon-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n width: 28px;\n height: 28px;\n padding: 0;\n border: 0;\n border-radius: var(--dsw-radius-sm);\n background: transparent;\n color: var(--dsw-alias-label-caption);\n cursor: pointer;\n}\n.hqpu-icon-btn svg { display: block; }\n.hqpu-icon-btn:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-secondary);\n}\n.hqpu-icon-btn:disabled {\n opacity: 0.5;\n cursor: default;\n}\n.hqpu-icon-btn:focus-visible {\n outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline-offset: 1px;\n}\n.hqpu-btn {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n height: 32px;\n padding: 0 12px;\n border: 0;\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n cursor: pointer;\n}\n.hqpu-btn svg { display: block; }\n.hqpu-btn:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover-solid); }\n.hqpu-btn:disabled { opacity: 0.5; cursor: default; }\n.hqpu-btn:focus-visible {\n outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline-offset: 1px;\n}\n.hqpu-btn--primary {\n background: var(--dsw-alias-button-primary-fill);\n color: var(--dsw-alias-label-primary-foreground);\n}\n.hqpu-btn--primary:hover:not(:disabled) { background: var(--dsw-alias-button-primary-hover); }\n.hqpu-btn--outline {\n background: transparent;\n border: 0.5px solid var(--dsw-alias-border-l4);\n color: var(--dsw-alias-label-secondary);\n}\n.hqpu-btn--outline:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.hqpu-btn--ghost { background: transparent; color: var(--dsw-alias-label-secondary); }\n.hqpu-btn--ghost:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.hqpu-btn--danger { color: var(--dsw-alias-state-error-primary); }\n.hqpu-btn--sm { height: 28px; padding: 0 10px; font-size: 12.5px; }\n.hqpu-actions {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 8px;\n}\n\n/* ── Footer action row (ui-primitives Modal .footer) ───────────────────── */\n.hqpu-footer {\n display: flex;\n flex: none;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n padding: 0 24px 20px;\n}\n\n.hqpu-visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n\n/* ── Reduced motion: drop every decorative animation ──────────────────── */\n@media (prefers-reduced-motion: reduce) {\n .hqpu-scrim,\n .hqpu-panel,\n .hqpu-skeleton-fill,\n .hqpu-spinner,\n .hqpu-toast {\n animation: none;\n }\n}\n`\n\nconst STYLE_TAG_ID = 'data-plugin-css=\"huaqiu-plugin-update\"'\n\n/**\n * Design tokens the bundled DSH shell may not publish.\n *\n * hq-edge ships an older `ui-theme` build. A live probe of the running shell\n * (both themes) shows 13 of the tokens this stylesheet reads are absent:\n * `--dsw-radius-{xs,sm,md,lg,xl,panel}`, `--dsw-focus-ring-width`,\n * `--dsw-focus-ring-color`, `--dsw-alias-toast-label`,\n * `--dsw-alias-state-idle-primary`, `--dsw-font-mono`,\n * `--dsh-frame-overlay-top` and `--dsh-frame-chrome-top`.\n *\n * An unresolved `var()` is not an error — it silently degrades the property to\n * its initial value. That is how this panel once rendered with\n * `border-radius: 0px` and a 3px `auto` focus ring while every colour was\n * already correct.\n *\n * The last three (`--dsw-font-mono`, `--dsh-frame-*`) are deliberately NOT\n * backfilled: the shell's own primitives rely on the inline `var(…, fallback)`\n * form for those (`Modal.module.css`, `PluginManagerPage.module.css`), so this\n * sheet does too. Everything else is backfilled below with the canonical value\n * from `ui-theme/src/styles/{base,focus,design-platform}.css`.\n *\n * Values are feature-detected at runtime and scoped to this plugin's own roots\n * rather than `:root`, so a newer shell always wins and filling a gap can never\n * restyle the host.\n */\n\n/** The two roots this plugin styles: the view overlay (built in\n * update-view.ts) and the sidebar row ({@link ENTRY_CSS}.entry). */\nconst STYLE_ROOTS = '.hqpu-overlay, .hqpu-sidebar-entry'\n\n/** The shell's dark-theme carrier — audited live as `body[data-ds-dark-theme]`. */\nconst DARK_THEME_SELECTOR = 'body[data-ds-dark-theme]'\n\n/** Same roots, one rule per theme, for tokens whose official value flips. */\nconst DARK_STYLE_ROOTS = STYLE_ROOTS.split(',')\n .map((root) => `${DARK_THEME_SELECTOR} ${root.trim()}`)\n .join(',')\n\ntype DesignTokenFallback =\n | { token: string; value: string }\n | { token: string; value: { light: string; dark: string } }\n\nconst DESIGN_TOKEN_FALLBACKS: DesignTokenFallback[] = [\n // base.css — geometry; theme-invariant.\n { token: '--dsw-radius-xs', value: '4px' },\n { token: '--dsw-radius-sm', value: '8px' },\n { token: '--dsw-radius-md', value: '12px' },\n { token: '--dsw-radius-lg', value: '16px' },\n { token: '--dsw-radius-xl', value: '20px' },\n { token: '--dsw-radius-panel', value: '28px' },\n // focus.css — the standard ring geometry. The colour already falls back\n // inline in the sheet; publishing it too keeps the ring intact if that\n // fallback is ever edited away.\n { token: '--dsw-focus-ring-width', value: '2px' },\n { token: '--dsw-focus-ring-color', value: 'var(--dsw-alias-state-business-primary, #C7000B)' },\n // design-platform.css — `--dsw-static-neutral-bluish-00` is white in both\n // themes, which is exactly what the official alias resolves to.\n { token: '--dsw-alias-toast-label', value: 'var(--dsw-static-neutral-bluish-00, #fff)' },\n // The one token whose official value flips with the theme. `--dsw-static-*`\n // are theme-invariant, so one rule per carrier reproduces neutral-300\n // (light) / neutral-600 (dark) without knowing the current theme.\n {\n token: '--dsw-alias-state-idle-primary',\n value: {\n light: 'var(--dsw-static-neutral-300, #d4d4d4)',\n dark: 'var(--dsw-static-neutral-600, #545557)',\n },\n },\n]\n\nconst TOKEN_STYLE_TAG_ID = 'data-plugin-css=\"huaqiu-plugin-update-tokens\"'\n\n/**\n * Publish canonical values for the design tokens the shell is missing.\n *\n * Idempotent and cheap: safe to call on every open, so a shell that publishes\n * its tokens late still wins (the stale fallbacks are removed in that case).\n */\nexport function ensureDesignTokens(): void {\n if (typeof document === 'undefined' || document.body === null) return\n const probe = getComputedStyle(document.body)\n const missing = DESIGN_TOKEN_FALLBACKS.filter(\n (entry) => probe.getPropertyValue(entry.token).trim() === '',\n )\n\n const existing = document.querySelector<HTMLStyleElement>(`style[${TOKEN_STYLE_TAG_ID}]`)\n if (missing.length === 0) {\n existing?.remove()\n return\n }\n\n const flat = missing.filter(\n (entry): entry is { token: string; value: string } => typeof entry.value === 'string',\n )\n const themed = missing.filter(\n (entry): entry is { token: string; value: { light: string; dark: string } } =>\n typeof entry.value !== 'string',\n )\n\n const rules: string[] = []\n const lightDecls = [\n ...flat.map((entry) => ` ${entry.token}: ${entry.value};`),\n ...themed.map((entry) => ` ${entry.token}: ${entry.value.light};`),\n ]\n rules.push(`${STYLE_ROOTS} {\\n${lightDecls.join('\\n')}\\n}`)\n if (themed.length > 0) {\n const darkDecls = themed.map((entry) => ` ${entry.token}: ${entry.value.dark};`)\n rules.push(`${DARK_STYLE_ROOTS} {\\n${darkDecls.join('\\n')}\\n}`)\n }\n\n const tag = existing ?? document.createElement('style')\n tag.dataset.pluginCss = 'huaqiu-plugin-update-tokens'\n tag.textContent = rules.join('\\n')\n if (tag.parentNode === null) document.head.appendChild(tag)\n}\n\n/** Inject styles once (idempotent). */\nexport function injectUpdateStyles(): void {\n if (typeof document === 'undefined') return\n if (document.querySelector(`style[${STYLE_TAG_ID}]`) !== null) return\n const tag = document.createElement('style')\n tag.dataset.pluginCss = 'huaqiu-plugin-update'\n tag.textContent = `${ENTRY_CSS_TEXT}\\n${VIEW_CSS_TEXT}`\n document.head.appendChild(tag)\n}\n\n/** Minimal structural client context (dsh-client-runtime provides these). */\nexport interface ClientContext {\n get<T = unknown>(name: string): T | undefined\n effect?(fn: () => (() => void) | void, label?: string): void\n}\n\n/** In-memory update-report store shared by the badge and the modal. */\nclass UpdateStore implements UpdateStoreLike {\n private current: PluginUpdateReport | null = null\n private installingFlag = false\n private readonly listeners = new Set<() => void>()\n private refreshTimer: number | null = null\n\n report(): PluginUpdateReport | null {\n return this.current\n }\n\n installing(): boolean {\n return this.installingFlag\n }\n\n subscribe(listener: () => void): () => void {\n this.listeners.add(listener)\n return () => {\n this.listeners.delete(listener)\n }\n }\n\n /** Badge count per spec §6.3: actionable `update` + `install`, excluding the\n * ignored offer (the server already folds ignore into item states; keep the\n * client-side filter as a defensive second pass). */\n badgeCount(): number {\n const report = this.current\n if (report === null) return 0\n return report.items.filter(\n (item) => item.state === 'update' || item.state === 'install',\n ).length\n }\n\n private emit(): void {\n for (const listener of [...this.listeners]) {\n try {\n listener()\n } catch {\n /* one bad listener must not strand the rest */\n }\n }\n }\n\n async refresh(): Promise<PluginUpdateReport | null> {\n try {\n const report = await fetchReport()\n this.current = report\n this.emit()\n return report\n } catch {\n return this.current\n }\n }\n\n async check(): Promise<PluginUpdateReport | null> {\n try {\n const report = await checkUpdates()\n this.current = report\n this.emit()\n return report\n } catch {\n return this.current\n }\n }\n\n /** Mark the set as installing (set by the modal before the restart). */\n setInstalling(flag: boolean): void {\n this.installingFlag = flag\n this.emit()\n }\n\n /** Idle refresh while mounted (60 s) — no overlapping poll loop. */\n startIdleRefresh(): void {\n if (this.refreshTimer !== null) return\n this.refreshTimer = window.setInterval(() => {\n void this.refresh()\n }, 60_000) as unknown as number\n }\n\n stop(): void {\n if (this.refreshTimer !== null) {\n window.clearInterval(this.refreshTimer)\n this.refreshTimer = null\n }\n this.listeners.clear()\n }\n}\n\n/**\n * Client cordis inject: no service dependencies — the plugin reads the\n * hq-edge report purely through same-origin fetch (forwarded by its own node\n * half). `inject` stays empty so the loader never waits on another service.\n */\nexport const inject: string[] = []\n\n/**\n * Client plugin body — mount the sidebar toolbutton + review modal.\n * @param ctx - real cordis client context.\n * @returns disposer removing the row and all subscriptions.\n */\nexport function apply(ctx: ClientContext): () => void {\n if (typeof document === 'undefined') return () => {}\n injectUpdateStyles()\n ensureDesignTokens()\n\n const store = new UpdateStore()\n const copy = { zh: COPY.zh, en: COPY.en }\n const copyFor = (): typeof COPY.zh => (locale === 'en' ? copy.en : copy.zh)\n\n // Locale: re-render the row copy when <html lang> changes. The sidebar\n // helper subscribes via `refresh.subscribe`; we fan out to its listener.\n let locale: HostLocale | undefined = detectHostLocale()\n const localeSubscribers = new Set<() => void>()\n const refreshSubscribe = (listener: () => void): (() => void) => {\n localeSubscribers.add(listener)\n return () => {\n localeSubscribers.delete(listener)\n }\n }\n const unsubscribeLocale = observeHostLocale((next) => {\n locale = next\n for (const fn of [...localeSubscribers]) {\n try {\n fn()\n } catch {\n /* one bad subscriber must not strand the rest */\n }\n }\n })\n\n const openView = (): void => {\n // Re-detect the shell's design tokens on every open: a shell that\n // publishes them after this plugin mounted must win, and one that never\n // does must keep the canonical fallbacks.\n ensureDesignTokens()\n // Always re-check on open so the review screen never shows stale data.\n void store.check().then((report) => {\n if (report !== null) openUpdateView(store, copyFor())\n })\n }\n\n const disposeEntry = mountSidebarEntry({\n rowAttribute: UPDATE_ENTRY_ATTRIBUTE,\n rowSelector: UPDATE_ENTRY_SELECTOR,\n plugin: PLUGIN_ID,\n icon: UPDATE_ICON,\n css: ENTRY_CSS,\n // Read the live locale on every refresh (the locale observer fires\n // `refresh.subscribe`'s listener, which re-applies these) so the row\n // re-localizes when the host UI language changes — matching the sibling\n // family rows, which read a live `currentLang` variable the same way.\n label: () => entryCopy(locale).label,\n tooltip: () => entryCopy(locale).tooltip,\n refresh: { subscribe: refreshSubscribe },\n badge: {\n subscribe: (listener) => store.subscribe(listener),\n count: () => store.badgeCount(),\n },\n onToggle: openView,\n position: 'after',\n familySelectors: HUAQIU_SIDEBAR_ENTRY_FAMILY,\n })\n\n store.startIdleRefresh()\n void store.refresh()\n\n const dispose = (): void => {\n try {\n disposeEntry()\n } catch {\n /* already disposed */\n }\n unsubscribeLocale()\n store.stop()\n }\n if (typeof ctx.effect === 'function') {\n // `ctx.effect` takes a SETUP function and calls it immediately, keeping\n // whatever it returns as the teardown. Passing `dispose` itself would run\n // the teardown synchronously — disconnecting the sidebar-entry observers\n // and stopping the store before the shell ever renders the sidebar, so the\n // row could never be placed. Hand it a factory that returns the teardown\n // instead (the same shape the sibling tool plugins use).\n ctx.effect(() => dispose, 'plugin-update')\n }\n return dispose\n}\n"],"mappings":";;;;;;;;EAEA,SAAS,cAAc;GACtB,MAAM,SAAS,SAAS,cAAc,kDAAkD;GACxF,IAAI,WAAW,MAAM,OAAO,KAAK;GACjC,OAAO,OAAO,cAAc,sBAAsB,CAAC,EAAE,iBAAiB,OAAO;EAC9E;;EAEA,SAAS,iBAAiB,MAAM;GAC/B,MAAM,SAAS,KAAK,cAAc,+BAA+B;GACjE,IAAI,WAAW,MAAM,OAAO;GAC5B,KAAK,MAAM,SAAS,KAAK,UAAU,IAAI,MAAM,YAAY,UAAU,OAAO;EAC3E;;EAEA,SAAS,YAAY,SAAS;GAC7B,MAAM,QAAQ,SAAS,cAAc,QAAQ;GAC7C,MAAM,OAAO;GACb,MAAM,aAAa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gBAAiC,WAAW,OAAO,KAAK,KAAK,KAAK;GAIxE,IAAI,SAAiC,iBAAiB;GACtD,MAAM,oCAAoB,IAAI,IAAgB;GAC9C,MAAM,oBAAoB,aAAuC;IAC/D,kBAAkB,IAAI,QAAQ;IAC9B,aAAa;KACX,kBAAkB,OAAO,QAAQ;IACnC;GACF;GACA,MAAM,oBAAoB,mBAAmB,SAAS;IACpD,SAAS;IACT,KAAK,MAAM,MAAM,CAAC,GAAG,iBAAiB,GACpC,IAAI;KACF,GAAG;IACL,QAAQ,CAER;GAEJ,CAAC;GAED,MAAM,iBAAuB;IAI3B,mBAAmB;IAEnB,MAAW,MAAM,CAAC,CAAC,MAAM,WAAW;KAClC,IAAI,WAAW,MAAM,eAAe,OAAO,QAAQ,CAAC;IACtD,CAAC;GACH;GAEA,MAAM,eAAe,kBAAkB;IACrC,cAAc;IACd,aAAa;IACb,QAAQ;IACR,MAAM;IACN,KAAK;IAKL,aAAa,UAAU,MAAM,CAAC,CAAC;IAC/B,eAAe,UAAU,MAAM,CAAC,CAAC;IACjC,SAAS,EAAE,WAAW,iBAAiB;IACvC,OAAO;KACL,YAAY,aAAa,MAAM,UAAU,QAAQ;KACjD,aAAa,MAAM,WAAW;IAChC;IACA,UAAU;IACV,UAAU;IACV,iBAAiB;GACnB,CAAC;GAED,MAAM,iBAAiB;GACvB,MAAW,QAAQ;GAEnB,MAAM,gBAAsB;IAC1B,IAAI;KACF,aAAa;IACf,QAAQ,CAER;IACA,kBAAkB;IAClB,MAAM,KAAK;GACb;GACA,IAAI,OAAO,IAAI,WAAW,YAOxB,IAAI,aAAa,SAAS,eAAe;GAE3C,OAAO;EACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huaqiu/dsh-tool-plugin-update",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.mjs",
|
|
6
6
|
"types": "./lib/index.d.mts",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@deepseek-ai/dsh-host-webserver": "0.1.0-rc.8"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@huaqiu/dsh-plugin-log": "0.
|
|
35
|
-
"@huaqiu/dsh-sidebar-entry": "0.
|
|
34
|
+
"@huaqiu/dsh-plugin-log": "0.6.1",
|
|
35
|
+
"@huaqiu/dsh-sidebar-entry": "0.6.1"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"lib",
|
package/src/client/index.ts
CHANGED
|
@@ -991,12 +991,6 @@ export function apply(ctx: ClientContext): () => void {
|
|
|
991
991
|
}
|
|
992
992
|
}
|
|
993
993
|
})
|
|
994
|
-
const labelState = { label: entryCopy(locale).label, tooltip: entryCopy(locale).tooltip }
|
|
995
|
-
const applyLabel = (): void => {
|
|
996
|
-
const c = entryCopy(locale)
|
|
997
|
-
labelState.label = c.label
|
|
998
|
-
labelState.tooltip = c.tooltip
|
|
999
|
-
}
|
|
1000
994
|
|
|
1001
995
|
const openView = (): void => {
|
|
1002
996
|
// Re-detect the shell's design tokens on every open: a shell that
|
|
@@ -1015,8 +1009,12 @@ export function apply(ctx: ClientContext): () => void {
|
|
|
1015
1009
|
plugin: PLUGIN_ID,
|
|
1016
1010
|
icon: UPDATE_ICON,
|
|
1017
1011
|
css: ENTRY_CSS,
|
|
1018
|
-
|
|
1019
|
-
|
|
1012
|
+
// Read the live locale on every refresh (the locale observer fires
|
|
1013
|
+
// `refresh.subscribe`'s listener, which re-applies these) so the row
|
|
1014
|
+
// re-localizes when the host UI language changes — matching the sibling
|
|
1015
|
+
// family rows, which read a live `currentLang` variable the same way.
|
|
1016
|
+
label: () => entryCopy(locale).label,
|
|
1017
|
+
tooltip: () => entryCopy(locale).tooltip,
|
|
1020
1018
|
refresh: { subscribe: refreshSubscribe },
|
|
1021
1019
|
badge: {
|
|
1022
1020
|
subscribe: (listener) => store.subscribe(listener),
|