@linxin666/dsh-client-ui-skin-center 0.4.7 → 0.4.9

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.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":["copyText","useState","useSyncExternalStore","subscribeWallpaperInstallFaces","getWallpaperInstallFaces","css","useSyncExternalStore","useState","css","useSyncExternalStore","useState","css","useRef","useCallback","useState","useSyncExternalStore","useRef","css","isRecord"],"sources":["../src/client/runtime/effect-ledger.ts","../src/client/runtime/semantic-adapter.ts","../src/client/runtime/shell-rendering.ts","../src/client/runtime/backdrop-scene.ts","../src/client/runtime/decoration-layers.ts","../src/client/runtime/skin-controller.ts","../src/client/runtime/boot.ts","../src/client/plugin-install-faces.ts","../src/client/ExternalWallpaperNotice.tsx","../src/client/DelegatedSkinCard.tsx","../src/core/delegated-skins.ts","../src/client/delegated-skin-handle.ts","../src/client/CustomThemePanel.tsx","../src/client/SliderControl.tsx","../src/client/SkinCenter.tsx","../src/core/background.ts","../src/client/background.ts","../src/core/background-scope.ts","../src/core/wallpaper-handoff.ts","../src/client/runtime/external-wallpaper-engine.ts","../src/client/runtime/delegated-theme.ts","../src/external-wallpaper.ts","../src/client/locales.ts","../src/client/preview-coordinator.ts","../src/core/custom-theme.ts","../src/client/custom-theme-controller.ts","../src/client/settings-section.ts","../src/client/settings-entry-id.ts","../src/client/telemetry.ts","../src/client/index.ts"],"sourcesContent":["/**\n * Effect ledger (issue #506, contract section 6).\n *\n * Every runtime effect a skin activation creates — style tags, CSS variable\n * overrides, decoration-layer content, listeners, hook cleanups — is recorded\n * here as an append-only entry bound to its activation identity. Switching\n * skins releases the old activation's entries in reverse order; disposal is\n * idempotent and may run 0, 1 or N times.\n *\n * lifecycleScope split:\n * - \"activation\": everything injectable — released on every skin switch;\n * - \"component\": skin static assets and the user's selection — survive\n * switches, reloads and HMR. The ledger only tracks activation scope.\n *\n * Pure logic, no DOM types required (entries are opaque teardown closures).\n */\n\nexport type EffectKind = 'create' | 'bind' | 'replace' | 'release' | 'cleanup-failed'\n\nexport interface EffectLedgerEntry {\n /** Monotonic sequence number (append-only). */\n seq: number\n activationId: number\n kind: EffectKind\n /** Human-readable label for diagnostics (e.g. \"style:skin.css\"). */\n label: string\n /** For replace: the seq of the superseded entry. */\n replacesSeq?: number\n at: number\n}\n\ninterface LiveEffect {\n seq: number\n label: string\n teardown: () => void\n released: boolean\n}\n\nexport interface EffectLedger {\n /** Start a new activation identity. Returns its id. */\n beginActivation(): number\n /**\n * Record an effect under the activation. The teardown must be idempotent.\n * Throws if the activation was already disposed (fail-closed: no orphan\n * effects after a switch).\n */\n record(activationId: number, label: string, teardown: () => void): number\n /**\n * Record that `label` replaces a previous entry (e.g. decoration-layer\n * content swap). The replaced entry is released immediately.\n */\n replace(activationId: number, label: string, previousSeq: number | undefined, teardown: () => void): number\n /**\n * Release every live effect of the activation, newest first. Idempotent;\n * individual teardown failures are caught and logged as cleanup-failed\n * entries (one failing teardown never blocks the rest).\n */\n disposeActivation(activationId: number): void\n /** Whether disposeActivation has run for this activation. */\n isDisposed(activationId: number): boolean\n /** Read-only view of the append-only log (diagnostics / tests). */\n entries(): readonly EffectLedgerEntry[]\n}\n\nexport function createEffectLedger(now: () => number = () => Date.now()): EffectLedger {\n let seq = 0\n let nextActivation = 1\n const log: EffectLedgerEntry[] = []\n const live = new Map<number, LiveEffect[]>()\n const disposed = new Set<number>()\n\n function push(activationId: number, kind: EffectKind, label: string, replacesSeq?: number): number {\n seq += 1\n log.push({ seq, activationId, kind, label, replacesSeq, at: now() })\n return seq\n }\n\n function release(effect: LiveEffect, activationId: number): void {\n if (effect.released) return\n effect.released = true\n push(activationId, 'release', effect.label)\n try {\n effect.teardown()\n } catch {\n // A failing teardown must never block the remaining cleanup; the\n // failure itself is a ledger fact for diagnostics.\n push(activationId, 'cleanup-failed', effect.label)\n }\n }\n\n return {\n beginActivation() {\n const id = nextActivation++\n live.set(id, [])\n push(id, 'create', 'activation')\n return id\n },\n\n record(activationId, label, teardown) {\n const bucket = live.get(activationId)\n if (!bucket || disposed.has(activationId)) {\n throw new Error(`effect \"${label}\" recorded on disposed/unknown activation ${activationId}`)\n }\n const entrySeq = push(activationId, 'create', label)\n bucket.push({ seq: entrySeq, label, teardown, released: false })\n return entrySeq\n },\n\n replace(activationId, label, previousSeq, teardown) {\n const bucket = live.get(activationId)\n if (!bucket || disposed.has(activationId)) {\n throw new Error(`effect \"${label}\" replaced on disposed/unknown activation ${activationId}`)\n }\n if (previousSeq !== undefined) {\n const previous = bucket.find((e) => e.seq === previousSeq)\n if (previous) release(previous, activationId)\n }\n const entrySeq = push(activationId, 'replace', label, previousSeq)\n bucket.push({ seq: entrySeq, label, teardown, released: false })\n return entrySeq\n },\n\n disposeActivation(activationId) {\n if (disposed.has(activationId)) return\n disposed.add(activationId)\n const bucket = live.get(activationId) ?? []\n for (const effect of [...bucket].reverse()) release(effect, activationId)\n },\n\n isDisposed(activationId) {\n return disposed.has(activationId)\n },\n\n entries() {\n return log\n },\n }\n}\n","/**\n * Semantic adapter (issue #506, contract section 6, L2 compat adapter).\n *\n * One merged MutationObserver that stamps the semantic-attribute enumeration\n * (contracts/semantic-attrs-v1.md) onto the official shell DOM and onto\n * plugin roots that already expose stable anchors. This is explicitly a\n * COMPAT adapter — not a permanent public contract:\n * - official areas migrate to first-party attributes when the upstream\n * theme seam lands (then these rules are re-evaluated for deletion);\n * - third-party plugin areas stay here long-term (plugins that opt in\n * output the attributes themselves and the adapter becomes a no-op).\n *\n * Properties:\n * - merged: a single observer handles every rule;\n * - batched: one delivery collects its records before any rule runs, so a\n * session switch that mounts thousands of nodes does not re-walk and\n * re-match the same ancestors once per node (issue #1870);\n * - idempotent: re-tagging an already-correct element is a no-op, so React\n * re-renders simply get re-stamped when their nodes are re-added;\n * - fail-closed diagnostics: rules that match nothing and selectors the\n * engine rejects are reported, never thrown into the page;\n * - the adapter never REMOVES attributes it did not set; disposal only\n * disconnects the observer (stamping is cosmetic and scopes itself under\n * html[data-dsh-skin] consumers).\n * @module @linxin666/dsh-client-ui-skin-center/runtime/semantic-adapter\n */\n\nexport type SemanticAttr = 'data-dsh-surface' | 'data-dsh-part' | 'data-dsh-plugin'\n\nexport interface SemanticRule {\n /** CSS selector matched against added/existing elements. */\n selector: string\n /** Attribute(s) applied on match. */\n attrs: readonly (readonly [SemanticAttr, string])[]\n /** Why this rule exists / what it anchors (audit trail). */\n note: string\n}\n\n/**\n * The v1 rule table. Single ownership: only the skin-center edits this.\n * Anchors verified against @deepseek-ai rc.7 (see docs/archive survey).\n */\nexport const SEMANTIC_RULES_V1: readonly SemanticRule[] = [\n // ---- surfaces (official shell) ----\n { selector: '[data-slot=\"root\"]', attrs: [['data-dsh-surface', 'root']], note: 'ui-renderer root outlet' },\n { selector: '[data-slot=\"sidebar\"]', attrs: [['data-dsh-surface', 'sidebar']], note: 'layout sidebar outlet' },\n {\n selector: '[data-slot=\"conversation\"], [class*=\"centerCol\"]',\n attrs: [['data-dsh-surface', 'conversation']],\n note: 'conversation column: legacy conversation outlet; since dsh 0.1.7 the column carries no data hook, so the css-module suffix (hash prefix varies, suffix stable) is the anchor',\n },\n { selector: '[data-slot=\"conversation.session.header\"]', attrs: [['data-dsh-surface', 'session-header']], note: 'conversation header outlet' },\n { selector: '[data-slot=\"conversation.composer\"]', attrs: [['data-dsh-surface', 'composer']], note: 'composer chain outlet' },\n {\n selector: '[data-slot=\"details\"], [data-rightbar-col]',\n attrs: [['data-dsh-surface', 'details']],\n note: 'details column: legacy details outlet; since dsh 0.1.7 the right sidebar column carries the official data-rightbar-col hook (0-width while collapsed, so stamping it paints nothing when closed)',\n },\n { selector: '[data-shell-overlay]', attrs: [['data-dsh-surface', 'overlay']], note: 'frame overlay attribute' },\n { selector: '[data-slot=\"shell.overlay\"]', attrs: [['data-dsh-surface', 'overlay']], note: 'shell overlay outlet' },\n {\n selector: '[role=\"dialog\"]:has([data-slot=\"settings.section\"])',\n attrs: [['data-dsh-surface', 'settings']],\n note: 'settings dialog (composite: dialog containing the section outlet)',\n },\n // ---- shell parts ----\n { selector: '[data-chat-flow-kind]', attrs: [['data-dsh-part', 'message-row']], note: 'chat flow item' },\n { selector: '[data-streaming]', attrs: [['data-dsh-part', 'message-body']], note: 'assistant markdown root' },\n { selector: '[data-conversation-scroll]', attrs: [['data-dsh-part', 'scrollport']], note: 'conversation scrollport' },\n {\n selector: 'textarea[data-phase], [data-composer-input]',\n attrs: [['data-dsh-part', 'composer-input']],\n note: 'composer input: legacy textarea; current shells render a Lexical contenteditable carrying data-composer-input',\n },\n { selector: '[data-decoration=\"chip\"]', attrs: [['data-dsh-part', 'composer-chip']], note: 'composer reference chip' },\n { selector: '[data-queue-dock]', attrs: [['data-dsh-part', 'queue-dock']], note: 'queued turns dock' },\n { selector: '[data-turn-tail]', attrs: [['data-dsh-part', 'turn-tail']], note: 'turn tail row' },\n { selector: '[data-side]', attrs: [['data-dsh-part', 'resize-handle']], note: 'column resize handle' },\n {\n selector: 'button[class*=\"newSession\"]',\n attrs: [['data-dsh-part', 'new-session']],\n note: 'sidebar new-session action (compat seam shields skins from localized labels)',\n },\n // ---- plugin roots (plugins without stable anchors opt in via AGENTS.md) ----\n {\n selector: '[data-dsh-taskboard-view], [data-dsh-taskboard-board]',\n attrs: [['data-dsh-plugin', 'task-board']],\n note: 'task-board panel/board (the sidebar row is shell-owned: its glyph carries data-dsh-panel-entry and the family rule below stamps the row)',\n },\n {\n selector: '[data-dsh-ssh-view]',\n attrs: [['data-dsh-plugin', 'ssh']],\n note: 'ssh panel (the sidebar row is shell-owned: its glyph carries data-dsh-panel-entry and the family rule below stamps the row)',\n },\n {\n selector: '[data-gitgraph-chip-anchor], [data-gitgraph-dialog]',\n attrs: [['data-dsh-plugin', 'git-graph']],\n note: 'git-graph chip/dialog',\n },\n {\n selector: '[data-dsh-pet-root]',\n attrs: [['data-dsh-plugin', 'pet']],\n note: 'pet global root',\n },\n // ---- family parts ----\n {\n selector: '[class*=\"panelRow\"]:has([data-dsh-panel-entry])',\n attrs: [['data-dsh-part', 'sidebar-entry']],\n note: 'a plugin-registered sidebar row (sidebar.panellist): the shell owns the row box and stamps no hook of its own, so the row is recognised by its css-module class plus the glyph identity the registering plugin outputs — same compat technique as newSession',\n },\n]\n\n/**\n * The anchors the rule table keys on, as one attribute filter for the\n * observer: a glyph or row anchor that is SET on an element already in the\n * tree must re-anchor its ancestors exactly like a newly inserted one.\n */\nconst ANCHOR_ATTRIBUTES: readonly string[] = [\n 'data-dsh-panel-entry',\n 'data-dsh-surface',\n 'data-dsh-part',\n 'data-dsh-plugin',\n 'data-slot',\n 'data-chat-flow-kind',\n 'data-conversation-scroll',\n 'data-turn-tail',\n 'data-composer-input',\n 'data-queue-dock',\n 'data-rightbar-col',\n 'data-shell-overlay',\n 'data-dsh-taskboard-view',\n 'data-dsh-taskboard-board',\n 'data-dsh-ssh-view',\n 'data-dsh-pet-root',\n 'data-gitgraph-chip-anchor',\n 'data-gitgraph-dialog',\n 'data-decoration',\n 'data-streaming',\n 'data-side',\n 'data-phase',\n]\n// 'class' is deliberately absent: React sets className when it creates the\n// element, so a row whose class matters already carries it when the childList\n// record arrives, and class toggles are by far the most frequent attribute\n// traffic on the page. The filter stays on identity anchors.\n\n/**\n * Selector shapes whose verdict depends on the element's DESCENDANTS or on\n * its position among its siblings, rather than on the element alone.\n *\n * Everything outside this list is \"self-only\": inserting a descendant cannot\n * change whether the element itself matches. Splitting the table on that\n * boundary is what keeps the ancestor walk cheap without weakening what the\n * walk is FOR (issue #1732) — re-anchoring an ANCESTOR when a late descendant\n * turns out to be the anchor that ancestor keys on.\n */\nconst DESCENDANT_SENSITIVE_PSEUDO = /:has\\(|:empty|:first-child|:last-child|:only-child|:first-of-type|:last-of-type|:only-of-type|:nth-/\n\n/**\n * Attribute names a selector references. Deliberately a plain scan of the\n * bracket contents rather than a parsed selector: it also finds a reference\n * nested INSIDE a functional pseudo-class, which is what lets\n * `[role=\"dialog\"]:has([data-slot=\"settings.section\"])` answer to a late\n * data-slot flip on an element inside the dialog.\n */\nconst SELECTOR_ATTRIBUTE = /\\[([A-Za-z0-9_-]+)/g\n\nconst attributeReferences = (selector: string): ReadonlySet<string> => {\n const names = new Set<string>()\n for (const found of selector.matchAll(SELECTOR_ATTRIBUTE)) names.add(found[1])\n return names\n}\n\ninterface RuleTraits {\n /** True when a descendant or sibling change can flip this rule's verdict. */\n readonly descendantSensitive: boolean\n /** Every attribute the selector names, functional pseudo-classes included. */\n readonly attributes: ReadonlySet<string>\n}\n\n/**\n * Rule traits derived from the selector text ONCE, at module load, never per\n * element. The classification is what every batching decision below reads;\n * re-deriving it inside the walk would reintroduce exactly the per-node work\n * this change removes (issue #1870).\n */\nconst RULE_TRAITS: readonly RuleTraits[] = SEMANTIC_RULES_V1.map((rule) => ({\n descendantSensitive: DESCENDANT_SENSITIVE_PSEUDO.test(rule.selector),\n attributes: attributeReferences(rule.selector),\n}))\n\n/**\n * Safety bound of the ancestor walk, NOT a depth ceiling.\n *\n * The walk's normal terminator is the observed root: every node the observer\n * can report is inside document.body, so the walk returns there (measured —\n * with this bound removed the walk still stops at body on every delivery).\n * This constant only fires for a change inside a subtree that is not connected\n * to the observed root at all, where there is no ancestor to anchor yet and\n * the node's own childList delivery stamps it once it IS attached.\n *\n * It is deliberately far above any real markup depth (the shell's own sidebar\n * row is three hops deep) instead of a small number that would silently leave\n * a deeper row unanchored — which is the very defect this walk exists to fix\n * (issue #1732). A measured sweep anchors through 23 wrapper levels and misses\n * from 24, i.e. only past the point where the tree is pathological.\n *\n * Narrowing WHICH rules a hop applies does not make the hop count safe to drop\n * (issue #1870): a childList record only ever flips a descendant-sensitive\n * rule, and an attributes record only the rules naming the attribute that\n * actually changed, so a hop now costs one matches() call per APPLICABLE rule\n * instead of one per rule in the table. The bound stays as the backstop it has\n * always been.\n */\nconst ANCESTOR_HOPS = 24\n\nexport interface SemanticAdapterDiagnostics {\n /** Rules whose selector the engine rejects (dropped, never retried). */\n invalidRules: string[]\n /** Rules that matched zero elements in the latest full pass. */\n unmatchedRules: string[]\n /** Total attributes stamped since start. */\n stamped: number\n}\n\nexport interface SemanticAdapter {\n start(): void\n stop(): void\n diagnostics(): SemanticAdapterDiagnostics\n readonly running: boolean\n}\n\ninterface LiveRule extends RuleTraits {\n rule: SemanticRule\n /** False once the engine rejected the selector. */\n usable: boolean\n /** Elements matched in the latest full pass. */\n matchedInPass: number\n}\n\nexport function createSemanticAdapter(doc: Document): SemanticAdapter {\n const rules: LiveRule[] = SEMANTIC_RULES_V1.map((rule, index) => ({\n rule,\n usable: true,\n matchedInPass: 0,\n descendantSensitive: RULE_TRAITS[index].descendantSensitive,\n attributes: RULE_TRAITS[index].attributes,\n }))\n /**\n * The subset a childList delivery may walk: inserting a descendant can flip\n * a descendant-sensitive rule on an ancestor and nothing else. A self-only\n * ancestor was already rule-checked when it was added (or by fullPass), and\n * its verdict cannot change because something inside it grew, so\n * re-evaluating it is the cost, not the correctness, of the walk.\n */\n const descendantSensitiveRules: readonly LiveRule[] = rules.filter((live) => live.descendantSensitive)\n let observer: MutationObserver | null = null\n let stamped = 0\n let running = false\n\n const applyRule = (live: LiveRule, el: Element): void => {\n if (!live.usable) return\n let hit = false\n try {\n hit = el.matches(live.rule.selector)\n } catch {\n live.usable = false\n return\n }\n if (!hit) return\n live.matchedInPass += 1\n for (const [name, value] of live.rule.attrs) {\n if (el.getAttribute(name) !== value) {\n el.setAttribute(name, value)\n stamped += 1\n }\n }\n }\n\n const applyToTree = (rootEl: Element): void => {\n for (const live of rules) {\n if (!live.usable) continue\n applyRule(live, rootEl)\n let matches: Element[] = []\n try {\n matches = Array.from(rootEl.querySelectorAll(live.rule.selector))\n } catch {\n live.usable = false\n continue\n }\n for (const el of matches) applyRule(live, el)\n }\n }\n\n const fullPass = (): void => {\n for (const live of rules) live.matchedInPass = 0\n if (doc.documentElement) applyToTree(doc.documentElement)\n }\n\n /**\n * Re-anchor one changed node's ancestor chain with the rules that change\n * could actually have flipped.\n *\n * applyToTree only walks DOWNWARD: a rule whose selector matches an ancestor\n * of the changed node (the panel-list row is recognised by the glyph INSIDE\n * it) is never re-evaluated when that descendant arrives. React mounts the\n * row first and the registering plugin's glyph a tick later, so without this\n * the row keeps no anchor at all until something forces a full pass\n * (issue #1732). The walk is bounded, stops at the document root, and\n * carries only the rules the reported change can flip: the caller's batch has\n * already deduplicated the hops it shares with sibling records, so a hop\n * costs one matches() call per applicable rule, not one per rule in the table\n * (issue #1870).\n */\n const reanchorAncestors = (node: Element, subset: readonly LiveRule[]): void => {\n if (subset.length === 0) return\n const root = doc.body ?? doc.documentElement\n let current: Element | null = node\n for (let hop = 0; current !== null && hop <= ANCESTOR_HOPS; hop += 1) {\n for (const live of subset) {\n if (live.usable) applyRule(live, current)\n }\n // Stop at the observed root: going further cannot reach a node the\n // observer is even watching, and body is the ceiling it was given.\n if (current === root || current === doc.documentElement) return\n current = current.parentElement\n }\n }\n\n /**\n * Drop added roots that another root of the same delivery already contains:\n * applyToTree on the containing root scans the nested one as part of its own\n * subtree, and the containing root's own ancestor walk covers the nested\n * root's ancestors, so re-scanning it is pure duplicate work. Membership is a\n * Set probe per ancestor hop — no selector-engine call — which keeps a\n * delivery that mounts a whole subtree at once linear in that subtree.\n */\n const topmostRoots = (roots: ReadonlySet<Element>): Element[] => {\n const kept: Element[] = []\n for (const candidate of roots) {\n let parent = candidate.parentElement\n let nested = false\n while (parent !== null) {\n if (roots.has(parent)) {\n nested = true\n break\n }\n if (parent === doc.documentElement) break\n parent = parent.parentElement\n }\n if (!nested) kept.push(candidate)\n }\n return kept\n }\n\n return {\n get running() {\n return running\n },\n\n start() {\n if (running) return\n running = true\n fullPass()\n observer = new doc.defaultView!.MutationObserver((records) => {\n try {\n // The delivery is collected BEFORE any rule runs. Records of one\n // batch share ancestors and even targets, and re-walking them once\n // per record is what turned a session switch into tens of thousands\n // of matches() calls (issue #1870).\n const roots = new Set<Element>()\n const byAttribute = new Map<string, Set<Element>>()\n for (const record of records) {\n if (record.type === 'attributes') {\n // Only a rule that NAMES the attribute can flip because of it.\n // No rule in the table names the attributes the adapter itself\n // stamps, so every stamp it writes is an echo that now costs\n // zero rule evaluations instead of a full ancestor walk.\n const target = record.target.nodeType === 1 ? record.target as Element : null\n const name = record.attributeName\n if (target === null || name === null) continue\n const seen = byAttribute.get(name)\n if (seen === undefined) byAttribute.set(name, new Set([target]))\n else seen.add(target)\n continue\n }\n if (record.type !== 'childList') continue\n for (const node of Array.from(record.addedNodes)) {\n if (node.nodeType !== 1) continue\n roots.add(node as Element)\n }\n }\n\n // An added root keeps the full treatment, unchanged: every rule on\n // the root itself and on its whole subtree. Only the walk ABOVE it\n // is narrowed.\n for (const root of topmostRoots(roots)) {\n applyToTree(root)\n // The added subtree may itself be the glyph a row wants; the row\n // is an ANCESTOR of it and applyToTree never looks up (#1732).\n reanchorAncestors(root.parentElement ?? root, descendantSensitiveRules)\n }\n\n // A glyph whose ANCHOR is set on an element already in the tree (a\n // re-render that flips the attribute instead of replacing the node)\n // is the same signal, and childList alone never sees it.\n for (const [name, targets] of byAttribute) {\n const onTarget: LiveRule[] = []\n const onAncestors: LiveRule[] = []\n for (const live of rules) {\n if (!live.attributes.has(name)) continue\n onTarget.push(live)\n // An ancestor's verdict can only change when the rule reads\n // through the descendant that just changed its attribute.\n if (live.descendantSensitive) onAncestors.push(live)\n }\n if (onTarget.length === 0) continue\n for (const target of targets) {\n for (const live of onTarget) applyRule(live, target)\n reanchorAncestors(target.parentElement ?? target, onAncestors)\n }\n }\n } catch {\n // Fail-closed: a tagging error must never break the host page.\n }\n })\n observer.observe(doc.body ?? doc.documentElement, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: [...ANCHOR_ATTRIBUTES],\n })\n },\n\n stop() {\n running = false\n observer?.disconnect()\n observer = null\n },\n\n diagnostics() {\n return {\n invalidRules: rules.filter((r) => !r.usable).map((r) => r.rule.selector),\n unmatchedRules: rules.filter((r) => r.usable && r.matchedInPass === 0).map((r) => r.rule.selector),\n stamped,\n }\n },\n }\n}\n","/**\n * Shared shell rendering corrections for every visual mode owned by the skin\n * center (issue #954). The official shell exposes stable slot / composer\n * anchors, while the workspace-list fade itself is still a CSS-module class.\n * Keep that fallback scoped below sidebar.workspaces so an unrelated animation\n * or overlay whose class contains \"fade\" is never affected.\n *\n * The stylesheet is inert for the stock look: a catalog skin or a custom theme\n * must be active. The wallpaper mode left this adapter with the built-in\n * Wallpaper Engine bridge (issue #39): the delegated plugin owns the shell\n * corrections for its own backdrop, and this plugin's visual work stands down\n * entirely while that plugin renders. The sheet is installed once per runtime\n * and removed with that runtime, so disabling the plugin restores the shell\n * unchanged.\n * @module @linxin666/dsh-client-ui-skin-center/runtime/shell-rendering\n */\n\n/** Marker owned by the shared shell-rendering stylesheet. */\nexport const SHELL_RENDERING_STYLE_ATTR = 'data-dsh-shell-rendering'\n\n/** Fallback composer seat height for scrollport bottom clearance (px). */\nexport const DEFAULT_COMPOSER_CLEARANCE_PX = 100\n\nconst ACTIVE_VISUAL_SELECTOR = [\n 'html[data-dsh-skin]',\n 'html[data-dsh-custom-theme]:not([data-dsh-skin])',\n].join(', ')\n\nconst COMPOSER_SEAT_SELECTORS = [\n '[data-slot=\"conversation.composer\"]',\n '[data-composer-seat]',\n '[data-dsh-surface=\"composer\"]',\n]\n\n/** Build the inert-by-default public rendering corrections. */\nexport function shellRenderingCss(): string {\n const scopes = ACTIVE_VISUAL_SELECTOR.split(', ')\n const scoped = (selector: string): string => scopes.map(scope => `${scope} ${selector}`).join(',\\n')\n return `\n /* Viewport lock: prevent outer page scrollbar and viewport\n displacement during element focus/scrollIntoView. */\n ${ACTIVE_VISUAL_SELECTOR},\n ${scoped('body')} {\n height: 100% !important;\n width: 100% !important;\n overflow: hidden !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n ${scoped('[data-slot=\"sidebar.workspaces\"] [class*=\"_fade\"]')} {\n background: none !important;\n background-image: none !important;\n }\n ${scoped('[data-composer-card] textarea[data-phase]::placeholder')},\n ${scoped('textarea[data-dsh-part=\"composer-input\"]::placeholder')} {\n color: var(--dsw-alias-label-secondary, var(--dsw-alias-label-caption)) !important;\n -webkit-text-fill-color: var(--dsw-alias-label-secondary, var(--dsw-alias-label-caption)) !important;\n opacity: 1 !important;\n }\n ${scoped('[data-phase=\"active\"] [data-slot=\"conversation.input.dock\"] > *')},\n ${scoped('[data-phase=\"active\"] [data-slot=\"conversation.composer.dock\"] > *')},\n ${scoped('[data-phase=\"active\"] [data-slot=\"conversation.composer.dock\"] + *')} {\n /* One skin-driven accessory surface for task and statistics docks. Skins\n automatically follow their existing semantic theme tokens and may\n override the --dsh-composer-accessory-* variables for a stronger\n signature without coupling this adapter to a specific catalog skin.\n\n The third head covers an accessory that is a SIBLING of the dock slot\n host rather than a child of it. The slot host is display: contents, so\n the shell lays its children out as items of the surrounding dock row\n and the child heads reach them; 0.1.7's context meter was placed beside\n that host instead of inside it, so it shared the row with the\n statistics pill but stayed bare (issue #1715) -- one line, two looks.\n The adjacent-sibling head keeps the row uniform without naming any\n hashed class or localized label, and covers whatever future accessory\n the shell seats next to the dock. The plate lands on the accessory's\n own seat, never on a trigger inside it, so a component's own hover\n feedback keeps painting on top. */\n background: var(--dsh-composer-accessory-bg, var(--dsw-specific-tip, var(--dsw-alias-bg-layer-1))) !important;\n color: var(--dsh-composer-accessory-color, var(--dsw-alias-label-tertiary)) !important;\n border: var(--dsh-composer-accessory-border, none) !important;\n border-radius: var(--dsh-composer-accessory-radius, 12px) !important;\n box-shadow: var(--dsh-composer-accessory-shadow, var(--dsw-shadow-lv1, 0 2px 10px rgba(7, 20, 38, 0.18)));\n backdrop-filter: blur(var(--dsh-composer-accessory-blur, var(--dsh-input-card-blur, 10px))) !important;\n -webkit-backdrop-filter: blur(var(--dsh-composer-accessory-blur, var(--dsh-input-card-blur, 10px))) !important;\n }\n ${scoped('[data-phase=\"active\"] [data-slot=\"conversation.composer.dock\"] > *')},\n ${scoped('[data-phase=\"active\"] [data-slot=\"conversation.composer.dock\"] + *')} {\n /* Same metrics for a dock child and for the sibling seat beside the dock\n slot host, so the two accessories of one row end up the same height:\n the plate must not make one of them look like a different control. */\n margin-top: var(--dsh-composer-accessory-gap, 4px);\n margin-bottom: var(--dsh-composer-accessory-gap, 4px);\n padding-top: 2px;\n padding-bottom: 2px;\n }\n ${scoped('[data-slot=\"conversation.input.dock\"] > [data-goal-bar=\"true\"][data-goal-bar=\"true\"][data-goal-bar=\"true\"]')} {\n /* The host goal dock spans the full composer seat and contains its own\n centered compact bar. Do not paint the outer dock as an accessory: that\n creates a viewport-wide veil behind the active-goal chip. The repeated\n stable marker deliberately raises specificity above catalog-skin dock\n selectors that load after this shared adapter. */\n background: transparent !important;\n border: 0 !important;\n border-radius: 0 !important;\n box-shadow: none !important;\n backdrop-filter: none !important;\n -webkit-backdrop-filter: none !important;\n }\n ${scoped('[data-phase=\"active\"] [data-slot=\"conversation.input.dock\"] > [data-queue-dock]')} {\n /* The native queue dock stacks two boxes inside the input dock: a root\n wrapper that only supplies the shared dock inset, and the panel inside\n it that paints its own --dsw-specific-tip fill. Painting the wrapper as\n an accessory adds a second opaque plate one dock inset (8px) wider than\n the panel on each side, which reads as an extra sheet of paper under\n the queue (issue #1572). Reset the accessory surface so the panel stays\n the single layer; the wrapper keeps its inset, so the panel remains\n aligned with the composer card. */\n background: transparent !important;\n border: 0 !important;\n border-radius: 0 !important;\n box-shadow: none !important;\n backdrop-filter: none !important;\n -webkit-backdrop-filter: none !important;\n }\n ${scoped('[data-phase=\"active\"] [data-slot=\"conversation.composer.dock\"] + *')} {\n /* Dropping blur on the sibling seat only (issue #1757 / dsh-skins#21). The\n adjacent sibling head added for #1715 lands on ContextMeter's seat\n (span.JObwrW_root). A non-none backdrop-filter makes that seat the\n containing block for its position:fixed descendants, causing its hover\n tooltip and click-open panel to resolve against the seat instead of the\n viewport and push 740px+ horizontal scrollable overflow into the\n conversation scrollport (causing scrollbar flicker on mouse enter/leave).\n The seat's background (--dsh-composer-accessory-bg, default --dsw-specific-tip)\n is fully opaque, so the blur on that element is invisible anyway and\n dropping it restores viewport positioning with zero visual change. */\n backdrop-filter: none !important;\n -webkit-backdrop-filter: none !important;\n }\n ${scoped('[data-conversation-scroll]')},\n ${scoped('[data-dsh-part=\"scrollport\"]')} {\n /* The composer is the scrollport's final in-flow child. Reserving physical\n padding after it lifts the active dock by one composer height and also\n shifts the hero above center. */\n padding-bottom: 0 !important;\n }\n /* #978 / #1133: Line-level scroll-margin retains scrollIntoView() clearance\n above the sticky composer without placing a scrollport-level scroll-padding\n that breaks browser caret-reveal geometry (which caused micro-scrolling on\n every keystroke while reading history). */\n ${scoped('[data-conversation-scroll] [data-chat-anchor-key]')},\n ${scoped('[data-conversation-scroll] [data-chat-flow-kind]')},\n ${scoped('[data-conversation-scroll] [data-dsh-part=\"message-row\"]')},\n ${scoped('[data-conversation-scroll] [data-turn-tail]')},\n ${scoped('[data-conversation-scroll] [class*=\"_userRow\"]')},\n ${scoped('[data-conversation-scroll] [class*=\"_compactionRow\"]')},\n ${scoped('[data-conversation-scroll] [class*=\"_contextRow\"]')},\n ${scoped('[data-conversation-scroll] [class*=\"_turnErrorRow\"]')} {\n scroll-margin-bottom: var(--dsh-composer-height, ${DEFAULT_COMPOSER_CLEARANCE_PX}px) !important;\n }\n /* dsh 0.1.7 turned the right sidebar panel shell into an always-mounted,\n always-visible positioning box (only its inner dockkit surfaces hide\n while the panel is closed). Skin rules written for the older shell plate\n that shell element and, with the panel closed, cover the conversation\n area with a phantom column. Strip paint from the closed shell whatever\n the active skin; an open panel ([data-sidebar-right-open]) keeps every\n skin paint. The attribute predates the layout change, so the rule is a\n no-op on older shells. */\n ${scoped('[data-slot=\"rightbar.session\"] > [data-sidebar-right-panel]:not([data-sidebar-right-open])')} {\n background: none !important;\n background-color: transparent !important;\n background-image: none !important;\n border-color: transparent !important;\n box-shadow: none !important;\n }\n /* #1117: The upstream recommended badge pairs two background-fill tokens\n as bg + text — in dark mode, skins like Blue Fantasy collapse them to\n near-identical dark navy values (contrast ~1:1). Override the text\n color to a readable foreground and tweak the background for contrast.\n The dark-theme attribute lives on <body>, so it belongs inside the\n scoped selector: prefixing the already-scoped list produced\n \"body ... html ...\", a descendant chain that can never match (#1490). */\n ${scoped('body[data-ds-dark-theme] [data-question-key] [class*=\"_badge\"]')},\n ${scoped('body[data-ds-dark-theme] [data-question-scroll] [class*=\"_badge\"]')} {\n color: var(--dsw-alias-label-primary, #ffffff) !important;\n background: var(--dsw-alias-interactive-bg-active, color-mix(in srgb, var(--dsw-alias-button-info-fill, #4a5fa8) 50%, transparent)) !important;\n }\n `\n}\n\n/** Install the shared corrections and return their idempotent teardown. */\nexport function installShellRenderingAdapter(doc: Document): () => void {\n if (doc.head === null) return () => {}\n const existing = doc.head.querySelector<HTMLStyleElement>(`style[${SHELL_RENDERING_STYLE_ATTR}]`)\n if (existing !== null) return () => {}\n\n const style = doc.createElement('style')\n style.setAttribute(SHELL_RENDERING_STYLE_ATTR, '')\n style.textContent = shellRenderingCss()\n doc.head.appendChild(style)\n\n const win = doc.defaultView\n try { win?.scrollTo?.(0, 0) } catch {}\n const composerSelector = COMPOSER_SEAT_SELECTORS.join(', ')\n let resizeObserver: ResizeObserver | null = null\n let mutationObserver: MutationObserver | null = null\n let observedComposer: Element | null = null\n let appliedHeight = ''\n let scheduledFrame: number | null = null\n let disposed = false\n\n // The shell mounts one composer seat per conversation; keep the resolved\n // element while it stays connected instead of re-querying the body for every\n // mutation batch (issue #954 follow-up: streaming produced many queries/s).\n const resolveComposer = (): Element | null => {\n if (observedComposer !== null && observedComposer.isConnected) return observedComposer\n return doc.body === null ? null : doc.body.querySelector(composerSelector)\n }\n\n const syncHeight = (): void => {\n if (doc.body === null) return\n const composer = resolveComposer()\n if (composer === null) return\n if (observedComposer !== composer) {\n if (observedComposer !== null && resizeObserver !== null) {\n resizeObserver.unobserve(observedComposer)\n }\n observedComposer = composer\n if (resizeObserver !== null) {\n resizeObserver.observe(composer)\n }\n }\n const rect = composer.getBoundingClientRect()\n if (rect.height <= 0) return\n const root = doc.documentElement\n const next = `${Math.ceil(rect.height)}px`\n // Skip the custom-property write (and its forced style invalidation) while\n // the measured height still matches what is already applied.\n if (next === appliedHeight || root === null) return\n appliedHeight = next\n root.style.setProperty('--dsh-composer-height', next)\n }\n\n // Coalesce mutation bursts into at most one measure/write per frame; the\n // disposer cancels whatever is still scheduled.\n const scheduleSync = (): void => {\n if (scheduledFrame !== null || disposed) return\n if (win === null || typeof win.requestAnimationFrame !== 'function') {\n syncHeight()\n return\n }\n scheduledFrame = win.requestAnimationFrame(() => {\n scheduledFrame = null\n if (disposed) return\n syncHeight()\n })\n }\n\n if (win !== null && typeof win.ResizeObserver === 'function') {\n resizeObserver = new win.ResizeObserver(() => syncHeight())\n }\n\n if (win !== null && typeof win.MutationObserver === 'function' && doc.body !== null) {\n mutationObserver = new win.MutationObserver(() => scheduleSync())\n mutationObserver.observe(doc.body, { childList: true, subtree: true })\n }\n\n syncHeight()\n\n return () => {\n if (disposed) return\n disposed = true\n if (scheduledFrame !== null) {\n if (win !== null && typeof win.cancelAnimationFrame === 'function') win.cancelAnimationFrame(scheduledFrame)\n scheduledFrame = null\n }\n if (resizeObserver !== null) {\n resizeObserver.disconnect()\n resizeObserver = null\n }\n if (mutationObserver !== null) {\n mutationObserver.disconnect()\n mutationObserver = null\n }\n observedComposer = null\n appliedHeight = ''\n doc.documentElement?.style.removeProperty('--dsh-composer-height')\n style.remove()\n }\n}\n","/**\n * Unified \"backdrop visible\" scene marker (issue #777).\n *\n * A skin with painted background media or a mounted Wallpaper Engine\n * wallpaper both put real backdrop art behind the app. The two runtime\n * controllers (skin-controller and wallpaper) report their mount state\n * through setSceneBackdropActive(); this module folds them into ONE body /\n * html marker `data-dsh-backdrop-active` and installs the shared composer\n * seat neutralizer that keys on it.\n *\n * The shell's active composer seat paints a bottom occlusion gradient under\n * the sticky input card (rc.8: a linear gradient to --dsw-alias-bg-base,\n * z-index 7). Backdrop scenes intentionally remove that seat-wide gradient in\n * both active and hero phases so wallpaper art remains unobstructed down to the\n * viewport edge. Skin-provided seat-wide ::before masks are neutralized too.\n * Composer task/statistics surfaces are styled by the shared shell adapter\n * from skin theme tokens, not by this scene layer.\n *\n * The input card itself ([data-composer-card], the official shell's stable card\n * anchor) keeps its translucent tint and gains the configurable backdrop blur\n * (default INPUT_FROST_BLUR_PX).\n *\n * The card rule is enabled only while the conversation actually has message\n * content (data-dsh-conversation-content): an empty conversation has no正文 to\n * occlude, so the input keeps its normal hero appearance without a frost flash.\n * The strength is provided by --dsh-input-card-blur and falls back to the\n * compatibility default when the setting has not loaded yet.\n *\n * The marker is body/html level (managed outside the surface/part/plugin\n * enum, see contracts/semantic-attrs-v1.md) and survives a neutralizer\n * teardown; the style is inert whenever the marker is absent.\n * @module @linxin666/dsh-client-ui-skin-center/runtime/backdrop-scene\n */\n\n/** Shared marker: set on html + body while a source reports backdrop art. */\nexport const BACKDROP_ACTIVE_ATTR = 'data-dsh-backdrop-active'\n\n/** The shared composer-seat neutralizer style's own attribute. */\nexport const SCENE_NEUTRALIZER_ATTR = 'data-dsh-scene-neutralizer'\n\n/**\n * Attribute of the composer frost follower: a body-level, fixed, empty element\n * sized to the input card's border box while a scene is active.\n *\n * It exists because the frost must NOT be painted on the card. A non-none\n * backdrop-filter (like transform, filter, contain or perspective) makes an\n * element the CONTAINING BLOCK for its fixed-position descendants, and the\n * official shell renders its tooltips inside the composer card: the composer\n * send arrow's bubble is position: fixed, so with the frost on the card it\n * resolved its viewport coordinates against the card, landed far outside it\n * but still inside the conversation scrollport, added its own height to\n * scrollHeight, and every hover clamped the scroll to the new bottom — the\n * whole conversation jumped by hundreds of pixels and snapped back on the\n * next frame (issue #1724). Documented throughout the catalog skins as the\n * reason a card ancestor never carries a filter.\n *\n * A body-level sibling is not an ancestor of the card, so it may carry the\n * blur; because nested backdrop-filters do not compose, the card itself must\n * stay filter-free for the follower's blur to read through its translucent\n * fill. The element is empty and pointer-events:none, and it is a sibling of\n * the app root, never inside the scrollport.\n */\nexport const COMPOSER_FROST_ATTR = 'data-dsh-composer-frost'\n\n/** Stacking rung of the follower: above the skin art layers, below the shell. */\nconst COMPOSER_FROST_Z_INDEX = '-1'\n\n/** Conversation-content marker: set while the active conversation has rows. */\nexport const CONVERSATION_CONTENT_ATTR = 'data-dsh-conversation-content'\n\n/**\n * Stable shell scrollport scoped row selectors. Official builds emit the chat\n * anchor; the CSS-module suffix fallbacks retain compatibility with older\n * shells without returning to a body-wide topic/session query.\n */\nconst ACTIVE_CONVERSATION_CONTENT_SELECTOR = [\n '[data-conversation-scroll] [data-chat-anchor-key]',\n '[data-conversation-scroll] [class*=\"_userRow\"]',\n '[data-conversation-scroll] [class*=\"_compactionRow\"]',\n '[data-conversation-scroll] [class*=\"_contextRow\"]',\n '[data-conversation-scroll] [class*=\"_turnErrorRow\"]',\n].join(', ')\n\n/**\n * One source that can make backdrop art visible.\n *\n * Only `skin` reports through this module now: the wallpaper source belongs\n * to the delegated `dsh-plugin-wallpaper-engine`, which paints its own glass\n * and its own backdrop. Its presence is reported through\n * {@link setComposerFrostSuppressed} instead of the marker, because the skin\n * center must not claim the wallpaper's scene.\n */\nexport type BackdropSource = 'skin' | 'wallpaper'\n\n/**\n * Documents whose composer frost is suppressed by an external owner.\n *\n * The delegated wallpaper plugin paints a fixed frosted composer of its own,\n * and two fixed `backdrop-filter` stacks sample a shell the other one relaid,\n * so the skin center must not add a second one. A plain flag (rather than the\n * backdrop marker) keeps the two concerns apart: suppressing the frost must\n * not retract the skin's own backdrop marker or the seat neutralizer, which\n * the skin still needs.\n */\nconst frostSuppressed = new WeakSet<Document>()\n\n/**\n * Suppress (or restore) the composer frost follower for one document.\n *\n * Called by the external-plugin interop watcher while\n * `body[data-we-wallpaper]` is present. Idempotent, and it re-evaluates the\n * follower immediately, so the suppression applies even when the backdrop and\n * conversation markers are unchanged.\n * @param doc - the document whose frost is gated.\n * @param suppressed - true while an external owner paints the composer glass.\n */\nexport function setComposerFrostSuppressed(doc: Document, suppressed: boolean): void {\n if (suppressed) frostSuppressed.add(doc)\n else frostSuppressed.delete(doc)\n syncComposerFrost(doc)\n}\n\n/** Compatibility default for the input-card backdrop blur strength (px). */\nexport const INPUT_FROST_BLUR_PX = 10\n\nconst sourceSets = new WeakMap<Document, Set<BackdropSource>>()\nconst contentObservers = new WeakMap<Document, MutationObserver>()\nconst contentFrames = new WeakMap<Document, number>()\n\n/** Write a marker attribute only when the desired state is not applied yet. */\nfunction applyMarker(el: Element | null, attr: string, active: boolean): void {\n if (el === null) return\n if (active) {\n if (el.getAttribute(attr) !== 'true') el.setAttribute(attr, 'true')\n return\n }\n if (el.hasAttribute(attr)) el.removeAttribute(attr)\n}\n\n/**\n * Report one source's backdrop-art presence. The marker stays on while any\n * source is active, so the skin and wallpaper controllers never clobber each\n * other across their mount/unmount cycles.\n */\nexport function setSceneBackdropActive(doc: Document, source: BackdropSource, active: boolean): void {\n let sources = sourceSets.get(doc)\n if (sources === undefined) {\n sources = new Set()\n sourceSets.set(doc, sources)\n }\n if (active) sources.add(source)\n else sources.delete(source)\n syncMarker(doc, sources)\n}\n\n/** Reflect the source set onto html/body and ensure the neutralizer on use. */\nfunction syncMarker(doc: Document, sources: Set<BackdropSource>): void {\n const active = sources.size > 0\n applyMarker(doc.body, BACKDROP_ACTIVE_ATTR, active)\n applyMarker(doc.documentElement, BACKDROP_ACTIVE_ATTR, active)\n if (active) {\n ensureSceneNeutralizer(doc)\n startContentObserver(doc)\n } else {\n stopContentObserver(doc)\n }\n // The frost gate is the marker pair, so every path that changes either one\n // re-evaluates it: a scene mount/unmount, and the conversation-content flip\n // the observer above reports.\n syncComposerFrost(doc)\n}\n\n/**\n * Track whether the active conversation scrollport has message rows for the\n * frost gate. Topic pickers and outgoing session trees can retain their own\n * data-chat-anchor-key nodes during a switch; a body-wide query would count\n * those stale rows and flash the composer frost over the new empty topic.\n */\nfunction updateConversationContent(doc: Document): void {\n const has = doc.body !== null && doc.body.querySelector(ACTIVE_CONVERSATION_CONTENT_SELECTOR) !== null\n applyMarker(doc.body, CONVERSATION_CONTENT_ATTR, has)\n applyMarker(doc.documentElement, CONVERSATION_CONTENT_ATTR, has)\n // The composer frost is gated on this marker, so the flip must reach it.\n syncComposerFrost(doc)\n}\n\n/**\n * Coalesce the mutation bursts of a streaming conversation into one content\n * check per frame; a check scheduled for a document that stopped observing is\n * dropped so a late frame can never re-add the marker after teardown.\n */\nfunction scheduleConversationContent(doc: Document): void {\n if (contentFrames.has(doc)) return\n const win = doc.defaultView\n if (win === null || typeof win.requestAnimationFrame !== 'function') {\n updateConversationContent(doc)\n return\n }\n contentFrames.set(doc, win.requestAnimationFrame(() => {\n contentFrames.delete(doc)\n if (!contentObservers.has(doc)) return\n updateConversationContent(doc)\n }))\n}\n\n/** Observe the conversation tree while a backdrop is visible. */\nfunction startContentObserver(doc: Document): void {\n if (contentObservers.has(doc)) return\n updateConversationContent(doc)\n const win = doc.defaultView\n if (win === null || typeof win.MutationObserver !== 'function') return\n const observer = new win.MutationObserver(() => scheduleConversationContent(doc))\n observer.observe(doc.body ?? doc.documentElement, { childList: true, subtree: true })\n contentObservers.set(doc, observer)\n}\n\n/** Stop the content observer, cancel pending work and drop the marker. */\nfunction stopContentObserver(doc: Document): void {\n const frame = contentFrames.get(doc)\n if (frame !== undefined) {\n const win = doc.defaultView\n if (win !== null && typeof win.cancelAnimationFrame === 'function') win.cancelAnimationFrame(frame)\n contentFrames.delete(doc)\n }\n const observer = contentObservers.get(doc)\n if (observer !== undefined) {\n observer.disconnect()\n contentObservers.delete(doc)\n }\n applyMarker(doc.body, CONVERSATION_CONTENT_ATTR, false)\n applyMarker(doc.documentElement, CONVERSATION_CONTENT_ATTR, false)\n syncComposerFrost(doc)\n}\n\n/**\n * Install the shared composer-seat neutralizer, keyed by head presence so a\n * cleared head (tests) or a re-mount re-creates it. Without the marker the\n * rules are inert, so the style can outlive a single mount without changing\n * any other look.\n *\n * The composer card is deliberately absent from this sheet: its frost rides\n * {@link COMPOSER_FROST_ATTR} instead, because no rule here may put a\n * containing-block property back on the card (issue #1724).\n */\nexport function ensureSceneNeutralizer(doc: Document): void {\n if (doc.head === null) return\n if (doc.head.querySelector(`style[${SCENE_NEUTRALIZER_ATTR}]`) !== null) return\n const style = doc.createElement('style')\n style.setAttribute(SCENE_NEUTRALIZER_ATTR, '')\n style.textContent = `\n html[data-dsh-backdrop-active] [data-composer-seat],\n html[data-dsh-backdrop-active] [data-composer-seat]::before {\n background: none !important;\n backdrop-filter: none !important;\n -webkit-backdrop-filter: none !important;\n }\n html[data-dsh-backdrop-active][data-dsh-conversation-content] [${COMPOSER_FROST_ATTR}] {\n backdrop-filter: blur(var(--dsh-input-card-blur, ${INPUT_FROST_BLUR_PX}px)) !important;\n -webkit-backdrop-filter: blur(var(--dsh-input-card-blur, ${INPUT_FROST_BLUR_PX}px)) !important;\n }\n `\n doc.head.appendChild(style)\n}\n\n/** One observed document's frost follower: the element and its measure loop. */\ninterface FrostFollower {\n el: HTMLElement\n resizeObserver: ResizeObserver | null\n /** The card the resize observer currently watches (a switch replaces it). */\n observed: Element | null\n /** Viewport listener: a window resize moves the card without any mutation. */\n onResize: (() => void) | null\n frame: number | null\n /** Last applied border box, so an unchanged frame writes nothing. */\n applied: string\n}\n\nconst frostFollowers = new WeakMap<Document, FrostFollower>()\n\n/** The composer card the frost tracks, or null while none is mounted. */\nfunction composerCardOf(doc: Document): HTMLElement | null {\n return doc.body === null ? null : doc.body.querySelector<HTMLElement>('[data-composer-card]')\n}\n\n/**\n * Create the follower on first use and keep it sized to the composer card.\n *\n * The element is empty, fixed and inert: it paints nothing of its own, and it\n * receives no pointer events, so it can never take a tap from the composer or\n * the sidebar. Sizing uses one measure per animation frame (the shape\n * shell-rendering.ts uses for the composer height) rather than a per-mutation\n * read, and writes only when the box actually changed.\n */\nfunction syncFrostFollower(doc: Document): void {\n const follower = frostFollowers.get(doc)\n if (follower === undefined) return\n const card = composerCardOf(doc)\n if (card === null) return\n // A conversation switch replaces the composer card; move the observation to\n // the node we now track (this runs inside the coalesced content check).\n if (follower.observed !== card) {\n if (follower.observed !== null) follower.resizeObserver?.unobserve(follower.observed)\n follower.observed = card\n follower.resizeObserver?.observe(card)\n follower.applied = ''\n }\n const rect = card.getBoundingClientRect()\n if (rect.width <= 0 || rect.height <= 0) return\n // The follower paints the card's own shape, including a skin's radius\n // override, so the blurred region never reads as a rectangle behind a\n // rounded card. Read per apply: a skin may change it after mount.\n const radius = doc.defaultView?.getComputedStyle(card).borderRadius ?? ''\n const box = [rect.top, rect.left, rect.width, rect.height, radius]\n .map((value) => typeof value === 'number' ? Math.round(value) : value)\n .join('|')\n if (box === follower.applied) return\n follower.applied = box\n const style = follower.el.style\n style.top = `${Math.round(rect.top)}px`\n style.left = `${Math.round(rect.left)}px`\n style.width = `${Math.round(rect.width)}px`\n style.height = `${Math.round(rect.height)}px`\n style.borderRadius = radius\n}\n\n/** Coalesce a burst of geometry changes into one measurement per frame. */\nfunction scheduleFrostSync(doc: Document): void {\n const follower = frostFollowers.get(doc)\n if (follower === undefined || follower.frame !== null) return\n const win = doc.defaultView\n if (win === null || typeof win.requestAnimationFrame !== 'function') {\n syncFrostFollower(doc)\n return\n }\n follower.frame = win.requestAnimationFrame(() => {\n follower.frame = null\n if (!frostFollowers.has(doc)) return\n syncFrostFollower(doc)\n })\n}\n\n/** Mount the follower while a scene is visible and start tracking the card. */\nfunction startFrostFollower(doc: Document): void {\n if (frostFollowers.has(doc) || doc.body === null) return\n const el = doc.createElement('div')\n el.setAttribute(COMPOSER_FROST_ATTR, '')\n el.setAttribute('aria-hidden', 'true')\n const style = el.style\n style.position = 'fixed'\n style.pointerEvents = 'none'\n style.zIndex = COMPOSER_FROST_Z_INDEX\n style.borderRadius = 'inherit'\n const follower: FrostFollower = { el, resizeObserver: null, observed: null, onResize: null, frame: null, applied: '' }\n // A body-level sibling, appended after the app root so the shell's own\n // layers (and any skin decoration) keep their place; the rung above decides\n // paint order, not the append position.\n doc.body.appendChild(el)\n frostFollowers.set(doc, follower)\n const win = doc.defaultView\n if (win !== null && typeof win.ResizeObserver === 'function') {\n follower.resizeObserver = new win.ResizeObserver(() => scheduleFrostSync(doc))\n }\n if (win !== null && typeof win.addEventListener === 'function') {\n follower.onResize = () => scheduleFrostSync(doc)\n win.addEventListener('resize', follower.onResize)\n }\n syncFrostFollower(doc)\n}\n\n/** Remove the follower and stop every loop that fed it. */\nfunction stopFrostFollower(doc: Document): void {\n const follower = frostFollowers.get(doc)\n if (follower === undefined) return\n frostFollowers.delete(doc)\n const win = doc.defaultView\n // Cancel whatever is queued BEFORE the element goes: a frame that still held\n // a reference would otherwise re-apply a box to a detached node.\n if (follower.frame !== null && win !== null && typeof win.cancelAnimationFrame === 'function') {\n win.cancelAnimationFrame(follower.frame)\n follower.frame = null\n }\n follower.resizeObserver?.disconnect()\n follower.resizeObserver = null\n if (follower.onResize !== null) {\n win?.removeEventListener('resize', follower.onResize)\n follower.onResize = null\n }\n follower.el.remove()\n}\n\n/**\n * Attach the composer frost to the current scene state. Called from the shared\n * marker sync so the follower exists exactly while a backdrop is visible and\n * the conversation has content — the same gate the card's old frost rule used.\n *\n * The follower tracks the card through a ResizeObserver on the card itself and\n * one interval-free re-schedule on every re-mount, so a conversation switch\n * that replaces the composer keeps the frost aligned without a polling loop.\n */\nexport function syncComposerFrost(doc: Document): void {\n const wanted = doc.body !== null && doc.body.hasAttribute(BACKDROP_ACTIVE_ATTR)\n && doc.body.hasAttribute(CONVERSATION_CONTENT_ATTR)\n if (!wanted || frostSuppressed.has(doc)) {\n stopFrostFollower(doc)\n return\n }\n startFrostFollower(doc)\n}\n","/**\n * Fixed decoration layers (issue #506, contract section 6).\n *\n * Six skin-center-owned, non-interactive containers mounted once per\n * document (component scope): background / ambient / top / bottom / sidebar /\n * foreground. Skins fill them per activation (background media, scrims,\n * strips); the CONTENT is activation scope — on every switch the controller\n * replaces it through the effect ledger.\n *\n * Guarantees:\n * - pointer-events: none always (decoration must never eat clicks);\n * - the layer elements themselves survive skin switches, reloads of the\n * skin runtime, and HMR (ensure* is idempotent);\n * - stacking stays below the official shell overlay: background/ambient sit\n * behind the app, the strip/foreground layers use moderate z-indices that\n * lose to dialogs/overlays (official overlay paints above 1000);\n * - the background layer carries its own compositor layer (will-change:\n * transform): a full-viewport skin background image is expensive to\n * re-rasterize, and without isolation Chromium re-rasterizes it in\n * horizontal bands whenever unrelated repaint bursts (streaming chat,\n * animated pets, overlay menus) invalidate the same area — visible as\n * vertical band flicker (issue #1013).\n * @module @linxin666/dsh-client-ui-skin-center/runtime/decoration-layers\n */\n\nexport const DECORATION_LAYER_NAMES = [\n 'background',\n 'ambient',\n 'top',\n 'bottom',\n 'sidebar',\n 'foreground',\n] as const\n\nexport type DecorationLayerName = (typeof DECORATION_LAYER_NAMES)[number]\n\nexport type DecorationLayers = Record<DecorationLayerName, HTMLElement>\n\nconst LAYER_ATTR = 'data-dsh-skin-layer'\n\n/**\n * Per-layer paint order. The background sits at -2: negative z-index\n * elements paint ABOVE the html/body backgrounds (so a skin's own opaque\n * root background-color renders BEHIND its art — the v1 layering) yet below\n * every panel surface. It shares -2 with the WE scrim, which never paints\n * at the same time (an active WE wallpaper suppresses skin media, enforced\n * by the controller). The skin-background blur veil (-1) still samples the\n * art above it. Ambient effects paint above the veils; the strip/foreground\n * layers stay below the official overlay band (>=1000).\n */\nconst LAYER_STYLE: Record<DecorationLayerName, string> = {\n // Explicit longhands only: the inset shorthand has burned us once (a\n // mid-session layer lost its bottom edge), longhands parse everywhere.\n background: 'position:fixed;top:0;right:0;bottom:0;left:0;z-index:-2;pointer-events:none;will-change:transform;',\n ambient: 'position:fixed;top:0;right:0;bottom:0;left:0;z-index:30;pointer-events:none;',\n top: 'position:fixed;top:0;left:0;right:0;z-index:40;pointer-events:none;',\n bottom: 'position:fixed;bottom:0;left:0;right:0;z-index:40;pointer-events:none;',\n sidebar: 'position:fixed;top:0;bottom:0;left:0;z-index:40;pointer-events:none;',\n foreground: 'position:fixed;top:0;right:0;bottom:0;left:0;z-index:41;pointer-events:none;',\n}\n\nfunction ensureOne(doc: Document, name: DecorationLayerName): HTMLElement {\n const existing = doc.querySelector<HTMLElement>(`[${LAYER_ATTR}=\"${name}\"]`)\n if (existing) {\n // Never trust a previous writer's styles: re-assert invariants.\n existing.style.cssText = LAYER_STYLE[name]\n return existing\n }\n const el = doc.createElement('div')\n el.setAttribute(LAYER_ATTR, name)\n el.setAttribute('aria-hidden', 'true')\n el.style.cssText = LAYER_STYLE[name]\n doc.body.appendChild(el)\n return el\n}\n\n/**\n * Ensure all six layers exist and return their handles. Idempotent; safe to\n * call on every activation.\n */\nexport function ensureDecorationLayers(doc: Document): DecorationLayers {\n return {\n background: ensureOne(doc, 'background'),\n ambient: ensureOne(doc, 'ambient'),\n top: ensureOne(doc, 'top'),\n bottom: ensureOne(doc, 'bottom'),\n sidebar: ensureOne(doc, 'sidebar'),\n foreground: ensureOne(doc, 'foreground'),\n }\n}\n\n/**\n * Replace one layer's content (activation scope). Returns a teardown that\n * removes exactly the nodes this call added — idempotent, ledger-ready.\n */\nexport function setLayerContent(\n layer: HTMLElement,\n nodes: Iterable<Node>,\n): () => void {\n const added = [...nodes]\n for (const node of added) layer.appendChild(node)\n let done = false\n return () => {\n if (done) return\n done = true\n for (const node of added) node.parentNode?.removeChild(node)\n }\n}\n\n/** Remove every node an activation left in a layer (used on dispose). */\nexport function clearLayer(layer: HTMLElement): void {\n while (layer.firstChild) layer.removeChild(layer.firstChild)\n}\n\n/**\n * Build the background media element for a manifest backgroundMedia layer.\n * Returns null when the theme variant has no media. The element fills the\n * background layer; the scrim (when declared) is a sibling overlay.\n */\nexport function buildBackgroundMedia(\n doc: Document,\n layer: { type: 'image' | 'video'; src: string; scrim?: string },\n assetBase: string,\n): HTMLElement[] {\n const nodes: HTMLElement[] = []\n const fullBleed = 'position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;object-fit:cover;'\n if (layer.type === 'image') {\n const img = doc.createElement('img')\n img.src = `${assetBase}/${layer.src}`\n img.alt = ''\n img.setAttribute('aria-hidden', 'true')\n img.style.cssText = fullBleed\n nodes.push(img)\n } else {\n const video = doc.createElement('video')\n video.src = `${assetBase}/${layer.src}`\n video.muted = true\n video.loop = true\n video.autoplay = true\n video.playsInline = true\n video.setAttribute('aria-hidden', 'true')\n video.style.cssText = fullBleed\n nodes.push(video)\n }\n if (layer.scrim) {\n const scrim = doc.createElement('div')\n scrim.setAttribute('aria-hidden', 'true')\n scrim.style.cssText = `position:absolute;inset:0;background:${layer.scrim};`\n nodes.push(scrim)\n }\n return nodes\n}\n","/**\n * Skin runtime controller (issue #506, contract section 8) — the browser\n * switch engine. One switch is one NEW activation identity:\n *\n * switchTo(id):\n * 1. seq = ++latestRequest (latest-request-wins)\n * 2. activation = ledger.beginActivation()\n * 3. fetch stylesheet (+ patches) (already scoped + whitelisted host-side)\n * 4. install <style> tags, background media, hooks (all ledger-recorded)\n * 5. if seq is stale -> dispose this activation and bail\n * 6. flip html[data-dsh-skin] (the atomic visual cut)\n * 7. dispose the previous activation\n * 8. persist the selection\n *\n * Every step before the flip is discardable; a stale or failed switch leaves\n * the previous skin fully intact. hooks import/apply errors are caught: the\n * static part (stylesheet, media) stays active — the escape hatch can never\n * take the skin down with it.\n *\n * lifecycleScope split: the ledger tracks activation scope; the catalog\n * snapshot, the decoration layer elements and the persisted selection are\n * component scope and survive every switch.\n *\n * One activation is an exception to \"an external owner always wins\": the one\n * the user just asked for (issue #49). It paints once even while\n * `suppressSkin()` reports another owner, because the public\n * `html[data-dsh-skin]` stamp IS the signal that owner keys its hand-back on.\n * The claim is bounded and one-shot - see {@link USER_INITIATED_YIELD_GRACE_MS}.\n * @module @linxin666/dsh-client-ui-skin-center/runtime/skin-controller\n */\n\nimport type { EffectLedger } from './effect-ledger.ts'\nimport { buildBackgroundMedia, clearLayer, ensureDecorationLayers } from './decoration-layers.ts'\nimport type { DecorationLayers } from './decoration-layers.ts'\nimport { setSceneBackdropActive } from './backdrop-scene.ts'\n\n/**\n * The delegated-plugin payload a delegated skin's catalog row carries.\n *\n * It is the whole of what the controller needs: the entry is recognized as a\n * delegated skin by this field existing. Everything else on it is card copy and\n * install wiring, and the controller reads none of it.\n */\nexport interface DelegatedSkinPayload {\n /** npm package spec the card installs through the plugin manager. */\n package: string\n /** Upstream repository (docs, issues, changelog). */\n repository: string\n /** The attribute the delegated plugin stamps on body while it owns the page. */\n bodyAttr: string\n /** The attribute it stamps while it can hand the page back (capability). */\n handoffAttr: string\n /** Whether the delegated package is installed in this profile. */\n installed: boolean\n}\n\n/** Catalog entry shape the controller needs (mirrors the v2 catalog route). */\nexport interface ControllerSkinEntry {\n manifest: {\n id: string\n /**\n * Absent for a delegated skin: that plugin owns the stylesheet, the\n * background and the visual, so this package loads none of them.\n */\n contributes?: {\n stylesheet: string\n patches?: string\n backgroundMedia?: {\n light?: { type: 'image' | 'video'; src: string; scrim?: string }\n dark?: { type: 'image' | 'video'; src: string; scrim?: string }\n }\n }\n /** Present exactly for a delegated skin; absent for every asset skin. */\n delegated?: DelegatedSkinPayload\n facets?: { client?: { entry: string; apiVersion: string } }\n }\n}\n\n/**\n * Whether this entry's visual belongs to a delegated plugin.\n *\n * A delegated skin is a real selection, not a stand-down: it is persisted,\n * adopted on boot, and shown as the active row. What it never does is paint.\n * @param entry - a catalog entry, or null.\n * @returns true when the entry is a delegated skin.\n */\nexport function isDelegatedEntry(entry: ControllerSkinEntry | null): boolean {\n return entry?.manifest.delegated !== undefined\n}\n\nexport interface SkinControllerDeps {\n doc: Document\n ledger: EffectLedger\n /** Same-origin base of the v2 API (default /api/skin-center/v2). */\n apiBase?: string\n /** fetch injection for tests. */\n fetchImpl?: typeof fetch\n /** Persist the selection (POST /active by default). */\n persist?: (id: string | null) => Promise<void>\n /** Current light/dark theme (defaults to body[data-ds-dark-theme]). */\n themeGet?: () => 'light' | 'dark'\n /**\n * Theme-change subscription. The default observes the official\n * body[data-ds-dark-theme] attribute (the same ground truth v1 skins\n * used), so hooks get live theme flips out of the box.\n */\n themeSubscribe?: (listener: (theme: 'light' | 'dark') => void) => () => void\n /**\n * Stylesheet loader seam. Default installs a <link rel=\"stylesheet\"> and\n * awaits its load (relative url() inside the served CSS resolves against\n * the route URL — inlining into <style> would break asset resolution).\n */\n loadStylesheet?: (href: string) => Promise<void>\n /** hooks.mjs dynamic import seam for tests. */\n importHooks?: (url: string) => Promise<unknown>\n /**\n * External stand-down (issue #39): when this returns true another plugin\n * owns the whole visual — the delegated `dsh-plugin-wallpaper-engine` is\n * rendering a wallpaper — and a skin must not be painted at all, because\n * that plugin rewrites the same shell and paints its own glass.\n *\n * The user's chosen skin is still remembered (and still persisted when they\n * apply one), so it returns untouched the moment the wallpaper stops; only\n * the painting is withheld. Re-evaluated on every activation and on\n * refresh().\n */\n suppressSkin?: () => boolean\n /** Diagnostics sink (switch failures, hook errors). */\n onError?: (message: string, error: unknown) => void\n}\n\n/**\n * How long a user-initiated activation may hold the stage while another\n * plugin still owns the visual (issue #49).\n *\n * The claim exists to make the request VISIBLE on the public\n * `html[data-dsh-skin]` stamp, not to compete for the backdrop. The hand-back\n * itself is DOM-level (the other plugin observes that stamp and clears its\n * own), so this window only has to cover that round trip; when it expires\n * without a hand-back the activation withdraws and the remembered selection\n * repaints the moment that owner stops.\n */\nexport const USER_INITIATED_YIELD_GRACE_MS = 1500\n\n/** Per-activation options the card threads down from its own controls. */\nexport interface SkinActivationOptions {\n /**\n * True when the user just asked for this activation from the card (try-on,\n * apply, or re-apply of the skin already on). Such an activation CLAIMS THE\n * STAGE: it paints once even while {@link SkinControllerDeps.suppressSkin}\n * reports another owner, so `html[data-dsh-skin]` flips and that owner can\n * give the page back (issue #49).\n *\n * The claim is one-shot and bounded (it withdraws after\n * {@link USER_INITIATED_YIELD_GRACE_MS}), and it means nothing for the stock\n * look: a withheld stock preview has nothing to paint, so it keeps\n * reporting itself as stood down.\n */\n userInitiated?: boolean\n}\n\n/**\n * How one activation treats the persisted selection (issue #54).\n *\n * - `commit` - the user chose this in the card: it becomes the committed\n * selection AND is POSTed, so every other client follows.\n * - `preview` - a try-on (or an internal re-paint): the committed selection is\n * untouched and nothing is written.\n * - `adopt` - this page is mirroring a selection ANOTHER client already\n * persisted (boot recovery, the persisted-selection follower). It becomes\n * this page's committed selection so try-on restores it and the poll sees it\n * as applied, but it is never written back: a reader that writes can\n * overwrite a newer choice the other client has since made.\n */\nexport type SkinActivationMode = 'commit' | 'preview' | 'adopt'\n\nexport interface SkinControllerState {\n /** The currently applied skin (null = stock look). */\n active: string | null\n /**\n * True while a skin is selected but withheld because another plugin owns the\n * visual (see {@link SkinControllerDeps.suppressSkin}). The selection is\n * intact and repaints as soon as that plugin stops.\n */\n stoodDown: boolean\n /** The previewed skin id (null = the stock look is being previewed). */\n trying: string | null\n /** Whether a try-on preview is live (distinguishes previewing the stock\n * look from having no preview). */\n previewing: boolean\n}\n\nexport interface SkinController {\n /** Current applied skin id (null = stock look). */\n readonly active: string | null\n /** The fixed decoration layer handles (component scope). */\n readonly layers: DecorationLayers\n /**\n * Switch to a skin (or null for stock). Latest request wins; resolves to\n * the id that is actually active after this call settles (which may be a\n * newer one if a later switch superseded it).\n */\n switchTo(id: string | null, entry: ControllerSkinEntry | null, options?: SkinActivationOptions): Promise<string | null>\n /**\n * Preview a skin without persisting it. The committed skin is remembered;\n * exitTryOn() restores it. Try-on of the stock look passes null.\n */\n tryOn(id: string | null, entry: ControllerSkinEntry | null, options?: SkinActivationOptions): Promise<string | null>\n /**\n * Adopt a selection another client already persisted, without writing it\n * back (issue #54). The activation is a COMMIT - the selection becomes the\n * committed one try-on restores and a later poll sees it as applied - but\n * the value is not POSTed, because this page did not choose it. The two\n * reader paths (boot recovery and the persisted-selection follower) use\n * this: they mirror another client's choice, and mirroring must never\n * overwrite a newer choice that client has since made.\n */\n adopt(id: string | null, entry: ControllerSkinEntry | null, options?: SkinActivationOptions): Promise<string | null>\n /** Leave the preview, restoring the committed skin. */\n exitTryOn(): Promise<string | null>\n /** React-friendly store: subscribe + snapshot of {active, trying}. */\n subscribe(listener: () => void): () => void\n getState(): SkinControllerState\n /**\n * Re-apply the current committed skin without persisting (e.g. the\n * wallpaper bridge just toggled, flipping background-media priority).\n * A full fresh activation — latest-request-wins keeps it race-safe.\n */\n refresh(): Promise<string | null>\n /**\n * True while a switch (including the boot recovery that reads the persisted\n * selection) is in flight. A page that recovers its selection asynchronously\n * must be allowed to finish before any follower converges on a selection,\n * or the late convergence supersedes the in-flight activation and the boot\n * switch is discarded as stale (issue #1805).\n */\n isSwitching(): boolean\n /** Dispose the current activation (e.g. on plugin teardown). */\n shutdown(): void\n}\n\ninterface HooksModule {\n default?: () => { apply(ctx: unknown): void; dispose?: () => void }\n}\n\nexport function createSkinController(deps: SkinControllerDeps): SkinController {\n const doc = deps.doc\n const ledger = deps.ledger\n const apiBase = deps.apiBase ?? '/api/skin-center/v2'\n const fetchImpl = deps.fetchImpl ?? fetch.bind(doc.defaultView)\n const layers = ensureDecorationLayers(doc)\n const onError = deps.onError ?? (() => {})\n\n const themeGet = deps.themeGet ?? (() =>\n (doc.body?.hasAttribute('data-ds-dark-theme') ? 'dark' : 'light'))\n const themeSubscribe = deps.themeSubscribe ?? ((listener) => {\n let last = themeGet()\n const observer = new doc.defaultView!.MutationObserver(() => {\n const next = themeGet()\n if (next !== last) {\n last = next\n listener(next)\n }\n })\n if (doc.body) observer.observe(doc.body, { attributes: true, attributeFilter: ['data-ds-dark-theme'] })\n return () => observer.disconnect()\n })\n /**\n * Re-paint the current activation's background media for the live\n * light/dark theme (the controller owns the layer, so a theme flip must\n * swap the variant the same way an activation does). No-op when there is\n * nothing painted or the manifest carries no backgroundMedia.\n */\n function repaintBackgroundForTheme(): void {\n if (active === null || currentActivation === null || lastEntry === null) return\n // A withheld skin has no paint to repaint (issue #39).\n if (stoodDown) return\n const media = lastEntry.manifest.contributes?.backgroundMedia\n if (!media) return\n const variant = themeGet() === 'dark' ? (media.dark ?? media.light) : (media.light ?? media.dark)\n if (!variant) return\n const assetBase = `${apiBase}/skins/${lastEntry.manifest.id}`\n setBackgroundLayer(currentActivation, buildBackgroundMedia(doc, variant, assetBase))\n }\n const unsubscribeTheme = themeSubscribe(() => repaintBackgroundForTheme())\n const loadStylesheet = deps.loadStylesheet ?? ((href: string) => new Promise<void>((resolveLink, rejectLink) => {\n const link = doc.createElement('link')\n link.rel = 'stylesheet'\n link.href = href\n const timer = setTimeout(() => rejectLink(new Error(`stylesheet load timeout: ${href}`)), 15000)\n link.onload = () => { clearTimeout(timer); resolveLink() }\n link.onerror = () => { clearTimeout(timer); rejectLink(new Error(`stylesheet load failed: ${href}`)) }\n doc.head.appendChild(link)\n }))\n\n let latestRequest = 0\n /**\n * True from the moment a switch begins until the newest switch settles. A\n * page that recovers its selection asynchronously (the desktop client boots\n * without the tapIndex stamp) has an activation in flight while other\n * subsystems start publishing, and an external verdict flip read during that\n * window is replayed after it settles instead of racing it (issue #1805).\n */\n let switching = false\n /** An external verdict flip observed while a switch was in flight. */\n let refreshQueued = false\n let currentActivation: number | null = null\n const initialSkinId = doc.documentElement?.getAttribute('data-dsh-skin') || null\n let active: string | null = initialSkinId\n /** The committed selection try-on restores (component scope). */\n let committed: { id: string | null; entry: ControllerSkinEntry | null } = { id: initialSkinId, entry: null }\n /** Last non-null applied entry, so refresh() can re-activate it. */\n let lastEntry: ControllerSkinEntry | null = null\n /** Last evaluated stand-down verdict (refresh() skips no-ops). */\n let lastSuppressed: boolean | null = deps.suppressSkin?.() === true\n let trying: string | null = null\n let previewing = false\n const listeners = new Set<() => void>()\n // React's useSyncExternalStore requires a CACHED snapshot: getSnapshot must\n // return the same reference until the state actually changes, or the store\n // consumer loops forever (and the settings card crashes blank).\n let stoodDown = lastSuppressed === true\n let stateSnapshot: SkinControllerState = { active: initialSkinId, stoodDown, trying: null, previewing: false }\n const emit = (): void => {\n stateSnapshot = { active, stoodDown, trying, previewing }\n for (const listener of listeners) listener()\n }\n\n /**\n * Install one stylesheet as a tracked <link> (the load itself happened in\n * loadStylesheet; here we only register the teardown). Links keep relative\n * url() resolution intact — a <style> tag would resolve them against the\n * document and 404 every skin asset.\n */\n function trackStylesheet(activation: number, label: string, href: string): void {\n const link = doc.head.querySelector<HTMLLinkElement>(`link[href=\"${href}\"]`)\n ledger.record(activation, `style:${label}`, () => link?.remove())\n }\n\n /**\n * Paint the skin background art into the `background` decoration layer\n * (z-index:-2) with a snapshot for the activation ledger. Only the CURRENT\n * activation may restore: when an older activation is disposed after a\n * newer one already re-painted the layer, restoring its snapshot would\n * clobber the newer paint.\n *\n * Two reasons the art lives in the layer, not on `document.body`:\n * - Chromium's backdrop-filter does not sample the canvas/body background,\n * so the skin-center blur layer (z-index:-1) could never blur body-painted\n * art (issue #732 defect A). A real fixed element IS sampled, so after\n * this change the same blur + scrim controls work on the skin backdrop\n * just like they already do on the Wallpaper Engine layers (issue #777).\n * - dragon-heir hooks expect the art in ctx.layers.background (they swap\n * the painted img and apply the v1 filter lift); the layer is the v2\n * contract and body painting was a leftover half-migration.\n * The body's own opaque background is forced transparent while art is\n * mounted, or the shell's static panels would cover the negative-z layer.\n */\n function setBackgroundLayer(activation: number, nodes: HTMLElement[]): void {\n const style = doc.body.style\n const previousBackgroundColor = style.getPropertyValue('background-color')\n const previousBackgroundImage = style.getPropertyValue('background-image')\n const restore = (): void => {\n if (currentActivation !== activation) return\n clearLayer(layers.background)\n setSceneBackdropActive(doc, 'skin', false)\n if (previousBackgroundColor === '') style.removeProperty('background-color')\n else style.setProperty('background-color', previousBackgroundColor)\n if (previousBackgroundImage === '') style.removeProperty('background-image')\n else style.setProperty('background-image', previousBackgroundImage)\n }\n clearLayer(layers.background)\n if (nodes.length > 0) {\n for (const node of nodes) layers.background.appendChild(node)\n style.setProperty('background-color', 'transparent')\n style.setProperty('background-image', 'none')\n setSceneBackdropActive(doc, 'skin', true)\n } else {\n setSceneBackdropActive(doc, 'skin', false)\n if (previousBackgroundColor === '') style.removeProperty('background-color')\n else style.setProperty('background-color', previousBackgroundColor)\n if (previousBackgroundImage === '') style.removeProperty('background-image')\n else style.setProperty('background-image', previousBackgroundImage)\n }\n ledger.record(activation, 'background:layer', restore)\n }\n\n function installBackground(\n activation: number,\n entry: ControllerSkinEntry,\n ): void {\n const media = entry.manifest.contributes?.backgroundMedia\n if (!media) {\n setBackgroundLayer(activation, [])\n return\n }\n // An external owner (the delegated wallpaper plugin) withholds the whole\n // skin, background media included, before this is reached (see\n // switchInternal); nothing to arbitrate here.\n const variant = themeGet() === 'dark' ? (media.dark ?? media.light) : (media.light ?? media.dark)\n if (!variant) {\n setBackgroundLayer(activation, [])\n return\n }\n const assetBase = `${apiBase}/skins/${entry.manifest.id}`\n setBackgroundLayer(activation, buildBackgroundMedia(doc, variant, assetBase))\n }\n\n async function installHooks(activation: number, entry: ControllerSkinEntry): Promise<void> {\n const facet = entry.manifest.facets?.client\n if (!facet) return\n const importHooks = deps.importHooks ?? ((url: string) => import(/* @vite-ignore */ url))\n try {\n const mod = (await importHooks(`${apiBase}/skins/${entry.manifest.id}/hooks.mjs`)) as HooksModule\n const factory = mod?.default\n if (typeof factory !== 'function') throw new Error('hooks.mjs must default-export defineSkinHooks()')\n const hooks = factory()\n if (typeof hooks?.apply !== 'function') throw new Error('defineSkinHooks() must return { apply }')\n const cleanups: Array<() => void> = []\n const ctx = {\n skinId: entry.manifest.id,\n scopeAttr: entry.manifest.id,\n assetBase: `${apiBase}/skins/${entry.manifest.id}`,\n layers,\n theme: {\n get: themeGet,\n subscribe: themeSubscribe,\n },\n onCleanup: (fn: () => void) => {\n cleanups.push(fn)\n },\n }\n hooks.apply(ctx)\n ledger.record(activation, 'hooks', () => {\n try {\n hooks.dispose?.()\n } catch (error) {\n onError(`hooks dispose failed for ${entry.manifest.id}`, error)\n }\n for (const cleanup of cleanups.reverse()) {\n try {\n cleanup()\n } catch (error) {\n onError(`hooks cleanup failed for ${entry.manifest.id}`, error)\n }\n }\n })\n } catch (error) {\n // The escape hatch never takes the static skin down with it.\n onError(`hooks failed for ${entry.manifest.id}; static skin stays active`, error)\n }\n }\n\n async function persist(id: string | null): Promise<void> {\n if (deps.persist) {\n await deps.persist(id)\n return\n }\n await fetchImpl(`${apiBase}/active`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ active: id }),\n })\n }\n\n async function switchInternal(\n id: string | null,\n entry: ControllerSkinEntry | null,\n mode: SkinActivationMode,\n options?: SkinActivationOptions,\n ): Promise<string | null> {\n const seq = ++latestRequest\n switching = true\n const activation = ledger.beginActivation()\n // External stand-down (issue #39): another plugin owns the visual, so this\n // activation is recorded and persisted but nothing is painted. `active`\n // still names the user's choice, which is what the card shows and what\n // repaints the moment that plugin stops.\n //\n // A user-initiated activation of a real skin is the one exception (issue\n // #49): it claims the stage, so the public `html[data-dsh-skin]` stamp\n // flips and that owner can see the request and hand the page back. The\n // claim needs a skin to paint, so the stock look keeps reporting itself as\n // stood down rather than claiming a stage it does not use.\n const suppressed = deps.suppressSkin?.() === true\n // A delegated skin has no stylesheet of its own: the plugin that owns the\n // page paints it. The activation is still a real one (it persists the\n // selection and records the row as active), it simply paints nothing and\n // leaves html[data-dsh-skin] off, which is the very signal that plugin\n // reads to stand down. It never claims the stage: there is no paint to\n // claim one with.\n const delegated = isDelegatedEntry(entry)\n const claimsStage = options?.userInitiated === true && id !== null && entry !== null && !delegated\n const withheld = suppressed && !claimsStage\n try {\n if (!withheld && !delegated && id !== null && entry !== null) {\n const stylesheetHref = `${apiBase}/skins/${id}/stylesheet`\n const patchesHref = entry.manifest.contributes?.patches !== undefined\n ? `${apiBase}/skins/${id}/patches`\n : null\n await loadStylesheet(stylesheetHref)\n trackStylesheet(activation, 'stylesheet', stylesheetHref)\n if (patchesHref !== null) {\n await loadStylesheet(patchesHref).catch(() => {})\n trackStylesheet(activation, 'patches', patchesHref)\n }\n if (seq !== latestRequest) throw new StaleSwitch()\n installBackground(activation, entry)\n await installHooks(activation, entry)\n } else {\n // Stock / entryless / withheld switch owns the background layer too: it\n // must clear a previous skin's paint (the old activation's restore is\n // skipped as stale by the ownership gate).\n setBackgroundLayer(activation, [])\n }\n if (seq !== latestRequest) throw new StaleSwitch()\n\n // The atomic cut: attribute first, then retire the old activation. A\n // withheld skin leaves the stamp off, which is what actually removes the\n // skin's CSS from the page. A delegated skin leaves it off for the same\n // reason from the other side: its owner reads the stamp.\n if (id === null || withheld || delegated) doc.documentElement.removeAttribute('data-dsh-skin')\n else doc.documentElement.setAttribute('data-dsh-skin', id)\n const previous = currentActivation\n currentActivation = activation\n active = id\n // Stood down is only ever the EXTERNAL verdict: a wallpaper rendering\n // over whatever is selected. A delegated skin on its own is not stood\n // down, it is simply painted by its plugin rather than here.\n stoodDown = withheld\n // This activation already applied the current verdict, so refresh() must\n // not read it as a change and re-switch on the next call.\n lastSuppressed = withheld\n if (entry !== null) lastEntry = entry\n if (mode === 'preview') {\n previewing = id !== committed.id\n trying = previewing ? id : null\n } else {\n // 'commit' and 'adopt' both settle the selection: try-on restores it\n // and the follower sees it as already applied. Only 'commit' writes it\n // back, which is the whole difference (issue #54).\n committed = { id, entry }\n trying = null\n previewing = false\n }\n emit()\n if (previous !== null) ledger.disposeActivation(previous)\n // A claim the external owner never answers must not sit on top of that\n // owner's visual: re-check once the hand-back window is over (issue #49).\n // Recorded while this activation is still the current one, because the\n // settleSwitch below may replay a queued verdict flip, and that opens a\n // newer activation which disposes this one (and its window) right away.\n if (claimsStage && suppressed) scheduleYieldCheck(activation)\n // The paint has changed and the previous activation is retired: this is\n // the point an external verdict flip must be able to take over.\n // Persisting is a separate, unscheduled round-trip (POST /active can hang\n // on a paired desktop) and must not hold the page on a superseded paint\n // (issue #1805).\n settleSwitch(seq)\n if (mode === 'commit') {\n await persist(id).catch((error) => onError('failed to persist the skin selection', error))\n }\n return active\n } catch (error) {\n ledger.disposeActivation(activation)\n if (error instanceof StaleSwitch) return active\n if (currentActivation === null) {\n active = null\n stoodDown = false\n committed = { id: null, entry: null }\n doc.documentElement.removeAttribute('data-dsh-skin')\n emit()\n }\n onError(`switch to ${id ?? 'stock'} failed; previous skin intact`, error)\n return active\n } finally {\n // Safety net for the paths that bail before the atomic cut (a stale\n // switch, or a failed stylesheet load). The normal path already settled\n // before persisting, so this is a no-op there.\n settleSwitch(seq)\n }\n }\n\n /**\n * The visual half of a switch is done: release the in-flight flag and replay\n * a verdict flip that arrived while it was loading.\n *\n * Called at the atomic cut, NOT after the persist round-trip. POST /active\n * has no timeout and can hang on a paired desktop, and a page that has\n * already painted must still yield to an external owner the moment that\n * owner's verdict flips - waiting for the write would leave the skin painted\n * over the wallpaper (issue #1805). Idempotent, so the failure paths can\n * call it again from the switch's `finally`.\n */\n function settleSwitch(seq: number): void {\n // An older switch settling late must not report an in-flight newer switch\n // as settled (issue #1805).\n if (seq !== latestRequest) return\n if (!switching && !refreshQueued) return\n switching = false\n // A verdict flip that arrived while this switch was loading: it sampled its\n // verdict before the flip, so replay the flip now that nothing is in\n // flight. Dropping it would leave the page on a paint the external owner\n // already superseded (issue #39 handoff, issue #1805).\n if (refreshQueued) {\n refreshQueued = false\n void refresh()\n }\n }\n\n /**\n * Re-check a stage claim once the hand-back window is over (issue #49).\n *\n * The claim is a request, not permission: if the external owner still\n * reports itself active at the end of the window, this activation withdraws\n * through the ordinary withheld path, so a peer that never answers the\n * `html[data-dsh-skin]` stamp cannot leave the skin painted over its visual.\n *\n * Three ways the check stands down without acting, each correct:\n * - a newer activation replaced this one (it applies its own verdict, and\n * a newer claim brings its own window);\n * - another switch is in flight (that switch sampled the verdict itself);\n * - the owner handed the page back (the paint is what the user asked for,\n * and `refresh()` already sees a matching verdict, so it is left alone).\n *\n * The timer is ledger-recorded, so superseding this activation or shutting\n * the runtime down cancels it.\n * @param activation - the claiming activation this window belongs to.\n */\n function scheduleYieldCheck(activation: number): void {\n const timer = setTimeout(() => {\n if (activation !== currentActivation) return\n if (switching) return\n if (deps.suppressSkin?.() !== true) return\n void switchInternal(active, active === null ? null : lastEntry, 'preview')\n }, USER_INITIATED_YIELD_GRACE_MS)\n ledger.record(activation, 'yield:claim-window', () => clearTimeout(timer))\n }\n\n /**\n * Re-apply the current selection under the current external verdict.\n *\n * A switch already in flight sampled the verdict before this call, so this\n * defers the flip instead of opening a second activation: the second one\n * would bump the request sequence and cancel the first, which is how the\n * desktop boot lost its persisted selection (issue #1805).\n */\n async function refresh(): Promise<string | null> {\n const suppressed = deps.suppressSkin?.() === true\n if (suppressed === lastSuppressed) return active\n if (switching) {\n refreshQueued = true\n return active\n }\n lastSuppressed = suppressed\n if (active !== null && lastEntry === null) return active\n // Re-apply the SAME logical selection: switchInternal decides whether it\n // paints or withholds, so a wallpaper starting or stopping flips the page\n // without touching what the user chose. Preview mode keeps this a pure\n // repaint: the committed selection is already this one, and a repaint must\n // never write (issue #54).\n return await switchInternal(active, active === null ? null : lastEntry, 'preview')\n }\n\n return {\n get active() {\n return active\n },\n get layers() {\n return layers\n },\n\n async switchTo(id, entry, options) {\n return await switchInternal(id, entry, 'commit', options)\n },\n\n async tryOn(id, entry, options) {\n return await switchInternal(id, entry, 'preview', options)\n },\n\n async adopt(id, entry, options) {\n return await switchInternal(id, entry, 'adopt', options)\n },\n\n async exitTryOn() {\n const result = await switchInternal(committed.id, committed.entry, 'preview')\n return result\n },\n\n subscribe(listener) {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n\n getState() {\n return stateSnapshot\n },\n\n isSwitching() {\n return switching\n },\n\n refresh,\n\n shutdown() {\n latestRequest += 1\n unsubscribeTheme()\n if (currentActivation !== null) {\n ledger.disposeActivation(currentActivation)\n currentActivation = null\n }\n active = null\n stoodDown = false\n trying = null\n previewing = false\n committed = { id: null, entry: null }\n emit()\n doc.documentElement.removeAttribute('data-dsh-skin')\n },\n }\n}\n\nclass StaleSwitch extends Error {\n constructor() {\n super('superseded by a newer switch')\n }\n}\n","/**\n * Browser boot wiring for the v2 skin runtime (issue #506): one store per\n * document that owns the effect ledger, the skin controller, the semantic\n * adapter and the catalog snapshot. The settings card consumes the store;\n * the store outlives the card (settings panels unmount on close), so a\n * try-on preview survives closing and reopening the panel.\n *\n * Boot sequence: fetch the catalog snapshot once, read the persisted active\n * selection, and activate it (the tapIndex adapter already stamped the\n * attribute and preloaded the stylesheet for first paint; the controller\n * re-installs under ledger ownership so later switches stay atomic).\n * @module @linxin666/dsh-client-ui-skin-center/runtime/boot\n */\n\nimport { createEffectLedger } from './effect-ledger.ts'\nimport { createSemanticAdapter } from './semantic-adapter.ts'\nimport type { SemanticAdapter } from './semantic-adapter.ts'\nimport { installShellRenderingAdapter } from './shell-rendering.ts'\nimport { setComposerFrostSuppressed } from './backdrop-scene.ts'\nimport { createSkinController } from './skin-controller.ts'\nimport type { ControllerSkinEntry, SkinController } from './skin-controller.ts'\n\n/**\n * Display-ready catalog entry (manifest + origin), as served by /v2/catalog.\n *\n * `origin: 'delegated'` rows are skins whose visual is another plugin's: they\n * carry a `delegated` payload and no `contributes`. The card renders them as\n * their own row and the controller withholds their paint (see\n * skin-controller.ts); everything else about them behaves like an asset skin.\n */\nexport interface CatalogSkin {\n origin: 'builtin' | 'user' | 'delegated'\n warnings: string[]\n manifest: ControllerSkinEntry['manifest'] & {\n name: string\n nameEn: string\n tagline?: string\n description?: string\n /**\n * Locale key of a delegated skin's body copy, where the row names a look\n * rather than describing one. Asset skins carry no key: their manifest\n * description is a single-language string they do not render as body copy.\n */\n descriptionKey?: string\n accent?: string\n order?: number\n author?: string\n license?: string\n attribution?: string\n preview?: { light: string; dark: string }\n tags?: string[]\n }\n}\n\n/** A catalog row whose visual belongs to a delegated plugin. */\nexport function isDelegatedCatalogSkin(skin: CatalogSkin): boolean {\n return skin.manifest.delegated !== undefined\n}\n\nexport interface CatalogDiagnostic {\n subject: string\n origin: string\n errors: string[]\n}\n\nexport interface SkinRuntimeStore {\n readonly controller: SkinController\n readonly adapter: SemanticAdapter\n /**\n * The document this store owns. Everything the runtime touches - the\n * adapter, the stylesheet links, the selection poll - is keyed on it, so a\n * store never reaches into the ambient global document.\n */\n readonly doc: Document\n /** The owning window; timers and events go through it, never through globals. */\n readonly window: Window\n /** The skin-center API root this store reads and writes selection state under. */\n readonly apiBase: string\n /** The fetch seat this store uses (injectable for tests). */\n readonly fetchImpl: typeof fetch\n /** Loaded catalog snapshot (null until the first fetch resolves). */\n catalog(): CatalogSkin[] | null\n diagnostics(): CatalogDiagnostic[]\n /** Re-fetch the catalog (e.g. after the user drops a new skin directory). */\n refreshCatalog(): Promise<void>\n /** Find one entry in the current snapshot by id. */\n find(id: string): CatalogSkin | null\n /** Fires on catalog loads AND controller state transitions. */\n subscribe(listener: () => void): () => void\n /** Stop the semantic adapter and dispose the current activation. */\n shutdown(): void\n}\n\nexport interface BootOptions {\n doc?: Document\n apiBase?: string\n fetchImpl?: typeof fetch\n /**\n * External stand-down (issue #39): true while the delegated wallpaper plugin\n * owns the visual, which withholds the skin entirely (its CSS, background\n * media, hooks and backdrop marker). The user's selection is kept.\n */\n suppressSkin?: () => boolean\n /**\n * Composer-frost ownership: true while the delegated wallpaper plugin paints\n * its own composer glass, so this runtime must not mount a second one.\n */\n suppressComposerFrost?: () => boolean\n}\n\nexport function bootSkinRuntime(options: BootOptions = {}): SkinRuntimeStore {\n const doc = options.doc ?? document\n const apiBase = options.apiBase ?? '/api/skin-center/v2'\n const fetchImpl = options.fetchImpl ?? fetch.bind(doc.defaultView)\n\n const ledger = createEffectLedger()\n const controller = createSkinController({\n doc,\n ledger,\n apiBase,\n fetchImpl,\n suppressSkin: options.suppressSkin,\n // Switches fail closed to the previous skin; failures must still be\n // observable in the console (they are never thrown to the card).\n onError: (message, error) => {\n console.error(`[skin-center] ${message}`, error)\n },\n })\n const adapter = createSemanticAdapter(doc)\n adapter.start()\n const disposeShellRendering = installShellRenderingAdapter(doc)\n // Seed the frost gate before any skin activation: a page that boots with an\n // external wallpaper already rendering must never mount a second glass.\n setComposerFrostSuppressed(doc, options.suppressComposerFrost?.() === true)\n\n let catalog: CatalogSkin[] | null = null\n let diagnostics: CatalogDiagnostic[] = []\n // Two distinct roles, deliberately kept apart: store SUBSCRIBERS wake on\n // every emit(), while TEARDOWNS run only from shutdown(). They used to share\n // one set, and because emit() invokes every member, the window-listener\n // removal registered below ran on the very first catalog load — unsubscribing\n // the 'dsh-skin-applied' handler for the rest of the page (issue #1740).\n const listeners = new Set<() => void>()\n const teardowns = new Set<() => void>()\n const emit = (): void => {\n for (const listener of listeners) listener()\n }\n\n async function refreshCatalog(): Promise<void> {\n const res = await fetchImpl(`${apiBase}/catalog`)\n if (!res.ok) throw new Error(`catalog fetch -> ${res.status}`)\n const payload = (await res.json()) as {\n ok: boolean\n skins?: CatalogSkin[]\n diagnostics?: CatalogDiagnostic[]\n }\n catalog = payload.skins ?? []\n diagnostics = payload.diagnostics ?? []\n emit()\n }\n\n const store: SkinRuntimeStore = {\n controller,\n adapter,\n doc,\n window: doc.defaultView ?? window,\n apiBase,\n fetchImpl,\n catalog: () => catalog,\n diagnostics: () => diagnostics,\n refreshCatalog,\n find(id) {\n return catalog?.find((s) => s.manifest.id === id) ?? null\n },\n subscribe(listener) {\n const off = controller.subscribe(listener)\n listeners.add(listener)\n return () => {\n off()\n listeners.delete(listener)\n }\n },\n shutdown() {\n adapter.stop()\n disposeShellRendering()\n controller.shutdown()\n for (const teardown of [...teardowns]) teardown()\n teardowns.clear()\n listeners.clear()\n },\n }\n\n // E2e/acceptance handle: exposes the boot store on the window for\n // scripted probes (see tests and the acceptance checklist).\n {\n const root = doc.defaultView as { __skinRuntime?: SkinRuntimeStore } & Window\n root.__skinRuntime = store\n }\n\n // Initial activation: apply the persisted selection from the snapshot.\n //\n // Every switch here ADOPTS (issue #54). Boot is a READER: the selection it\n // applies was written by whoever chose it - this page on an earlier load, or\n // another client sharing the DSH home. Committing it back would make this\n // page's own view of the selection authoritative, so a page booting from a\n // stale `html[data-dsh-skin]` stamp would overwrite a newer choice another\n // client has since saved (the desktop and web profiles share one\n // skin-center-active.json, and both read it on boot).\n void (async () => {\n try {\n await refreshCatalog()\n let active = doc.documentElement?.getAttribute('data-dsh-skin') || null\n if (!active) {\n const res = await fetchImpl(`${apiBase}/active`)\n const payload = (await res.json()) as { ok: boolean; active?: string | null }\n active = payload.ok && typeof payload.active === 'string' ? payload.active : null\n }\n if (active === null) return\n let entry = store.find(active)\n if (entry === null) {\n // A selection no catalog row answers for: its files are gone, or it\n // names a delegated skin this build does not know. A delegated row is\n // listed whether or not its plugin is installed, so it resolves here\n // and only a truly unknown id lands on this fallback.\n const defaultEntry = store.find('blue-fantasy')\n if (defaultEntry !== null) {\n await controller.adopt('blue-fantasy', defaultEntry as ControllerSkinEntry)\n } else {\n await controller.adopt(null, null)\n }\n return\n }\n await controller.adopt(active, entry as ControllerSkinEntry)\n } catch {\n // Fail-closed: boot into the stock look; the card surfaces catalog\n // errors through diagnostics().\n await controller.adopt(null, null).catch(() => {})\n }\n })()\n\n // The workshop announcement converges this page on a skin installed while\n // it was open; the runtime store owns that listener for its own lifetime.\n teardowns.add(trackSkinAppliedEvents(store))\n\n return store\n}\n\n/**\n * Install the skin-applied contract: a window event carrying the applied skin\n * id makes this page converge on that skin immediately.\n *\n * The v1 runtime booted through a full document reload, so any page that\n * switched the skin could assume the next load picked the new selection up -\n * the workshop card simply reloaded. The v2 runtime applies in place, so the\n * page that is already open has to converge on the write, and the workshop\n * installs the skin files itself. Legacy-bridge pages announce through that\n * reload event; wiring it here keeps one converge path instead of two.\n * @param store - the runtime store the event converges.\n * @param win - the window whose document the runtime owns.\n * @returns the idempotent listener teardown.\n */\nexport function trackSkinAppliedEvents(store: SkinRuntimeStore): () => void {\n const win = store.window\n const onApplied = (event: Event): void => {\n const detail = (event as CustomEvent<{ id?: unknown }>).detail\n if (detail === null || typeof detail !== 'object') return\n const id = (detail as { id?: unknown }).id\n if (typeof id !== 'string' || id === '') return\n void convergeOnSkin(store, id)\n }\n win.addEventListener('dsh-skin-applied', onApplied)\n return () => { win.removeEventListener('dsh-skin-applied', onApplied) }\n}\n\n/** Polling cadence for a selection changed outside this page. */\nconst SELECTION_POLL_MS = 2000\n\n/** Read the persisted selection; undefined when the endpoint cannot answer. */\nasync function fetchPersistedSelection(store: SkinRuntimeStore): Promise<string | null | undefined> {\n let res: Response\n try {\n res = await store.fetchImpl(`${store.apiBase}/active`)\n } catch {\n return undefined\n }\n if (!res.ok) return undefined\n let payload: { ok?: boolean; active?: unknown }\n try {\n payload = (await res.json()) as { ok?: boolean; active?: unknown }\n } catch {\n return undefined\n }\n if (payload.ok !== true) return undefined\n return typeof payload.active === 'string' && payload.active !== '' ? payload.active : null\n}\n\n/**\n * Read the persisted selection for a follower that may converge on it:\n * undefined while a switch is in flight, before AND after the read.\n *\n * A switch in flight owns the page's activation, and converging on a selection\n * read during that window supersedes it (that follower switch opens a newer\n * request). The desktop client boots exactly that way - no tapIndex stamp, so\n * its selection arrives from GET /active while the wallpaper watcher is\n * already publishing - and the follower would strand the page on the boot\n * activation's stale paint (issue #1805).\n *\n * The check brackets the request on both sides because a switch can start while\n * the GET is in flight: the value this read returns is then already older than\n * the page's activation, and converging on it would supersede that switch. The\n * read is not lost either way - the next poll sees the same value once the\n * switch has settled.\n */\nasync function readPersistedSelection(store: SkinRuntimeStore): Promise<string | null | undefined> {\n if (store.controller.isSwitching()) return undefined\n const selection = await fetchPersistedSelection(store)\n if (store.controller.isSwitching()) return undefined\n return selection\n}\n\n/**\n * Converge on the skin the persisted selection names, re-reading the catalog\n * first when the id is not in the current snapshot (a workshop install lands\n * after the page read the catalog).\n *\n * Convergence ADOPTS the selection (issue #54): this page is following a choice\n * made elsewhere, so it applies that choice without writing it back. The value\n * it is converging on was already persisted by whoever made it, and echoing it\n * would let a reader overwrite a newer write - the second page to boot would\n * win regardless of which choice was newer.\n */\nasync function convergeOnSelection(store: SkinRuntimeStore, id: string | null): Promise<void> {\n if (id !== null && store.find(id) === null) {\n try {\n await store.refreshCatalog()\n } catch {\n // A failed re-read keeps the current snapshot; a skin already in it\n // still converges.\n }\n }\n if (id === null) {\n await store.controller.adopt(null, null)\n return\n }\n const entry = store.find(id)\n if (entry === null) return\n await store.controller.adopt(id, entry as ControllerSkinEntry)\n}\n\n/** Converge on an announced skin id, re-reading the catalog when it is new. */\nasync function convergeOnSkin(store: SkinRuntimeStore, id: string): Promise<void> {\n await convergeOnSelection(store, id)\n}\n\n/**\n * Install the skin-applied contract: a window event carrying the applied skin\n * id makes this page converge on that skin immediately.\n *\n * The v1 runtime booted through a full document reload, so any page that\n * switched the skin could assume the next load picked the new selection up -\n * the workshop card simply reloaded. The v2 runtime applies in place, so the\n * page already open has to converge on the write, and the workshop installs\n * the skin files itself. The workshop card announces through that reload\n * event; this is the one converge path for it.\n * @param store - the booted runtime store.\n * @returns the idempotent teardown of the listener.\n */\nexport function watchSkinAppliedEvents(store: SkinRuntimeStore): () => void {\n return trackSkinAppliedEvents(store)\n}\n\n/**\n * Follow the persisted selection while this page is open.\n *\n * Applying a skin and saving that choice are one action in the GUI, but the\n * choice is persisted for the NEXT page load. The conventional route is the\n * official settings form: it writes the settings row this plugin owns, the\n * Host applies it, and nothing inside this page is told. That row is seeded\n * from the skin center's own configuration, so the two are the same choice\n * written twice, and this page reads it back rather than assuming it owns\n * every write (issue #1740).\n *\n * The poll only reads: it never writes the selection back (it converges through\n * `controller.adopt`, issue #54), it skips a value already applied, and it\n * stops while the page is hidden.\n * @param store - the booted runtime store.\n * @param intervalMs - polling cadence in milliseconds.\n * @returns the idempotent teardown of the poll.\n */\nexport function watchPersistedSelection(\n store: SkinRuntimeStore,\n intervalMs: number = SELECTION_POLL_MS,\n): () => void {\n let applied: string | null | undefined\n // Window timers, not the ambient ones: the two are different types once\n // Node's globals are in the program (index.ts / boot.ts both are).\n let timer: number | null = null\n let stopped = false\n\n const tick = async (): Promise<void> => {\n if (stopped) return\n const next = await readPersistedSelection(store)\n if (stopped || next === undefined || next === applied) return\n applied = next\n await convergeOnSelection(store, next)\n }\n\n const stopTimer = (): void => {\n if (timer !== null) store.window.clearInterval(timer)\n timer = null\n }\n const startTimer = (): void => {\n if (stopped || timer !== null) return\n timer = store.window.setInterval(() => { void tick() }, intervalMs)\n }\n\n void (async () => {\n // Seed the baseline from what this page actually ends up showing, not from\n // a blind disk read (issue #54). Boot adopts the id its own\n // `data-dsh-skin` stamp names, or the persisted selection when there is no\n // stamp; when the two differ, another client wrote a newer choice while\n // this page was loading, and the page must still converge on it. Seeding\n // the disk value unconditionally would mark that newer choice \"already\n // applied\" and strand the page on the older skin.\n //\n // `undefined` leaves the baseline unset, so the first tick converges on\n // the persisted selection. That used to be the thing this seeding avoided -\n // re-activating restarts the skin runtime's own work - but converging is\n // an ADOPT now, so the cost is a repaint and never a write.\n const stamp = store.doc.documentElement?.getAttribute('data-dsh-skin') || null\n const persisted = await fetchPersistedSelection(store)\n applied = persisted === undefined\n ? undefined\n : (stamp === null || stamp === persisted ? persisted : undefined)\n if (!stopped) startTimer()\n })()\n\n // A hidden page polls for nothing, and comes back to whatever was applied\n // while it was away, so the cadence follows the document's visibility.\n const onVisibility = (): void => {\n if (store.doc.visibilityState === 'visible') {\n startTimer()\n void tick()\n } else {\n stopTimer()\n }\n }\n store.doc.addEventListener('visibilitychange', onVisibility)\n\n return () => {\n stopped = true\n stopTimer()\n store.doc.removeEventListener('visibilitychange', onVisibility)\n }\n}\n","/**\n * One-click install of a plugin this package points at, through the host.\n *\n * Two of this package's surfaces are delegated to other plugins rather than\n * implemented here — wallpapers to `dsh-plugin-wallpaper-engine` (issue #39)\n * and a whole-GUI theme to `dsh-claude-style` (see\n * core/delegated-skins.ts) — and a pointer is only useful if the user can act\n * on it. Both install through whichever plugin-management face the running host\n * publishes: the same call the official Plugins page and the Workshop store\n * make, rather than a writer of this package's own.\n *\n * Two faces are bridged, each OPTIONAL and each resolved through\n * `ctx.inject` (never the module-level inject array, which would park this\n * plugin on hosts that publish neither):\n *\n * - `remote.pluginManager` — the official in-process manager's client remote\n * namespace. The API gateway registers every namespace as the service\n * `remote.<namespace>`, and `installBundle` is the very call the official\n * Plugins page makes, so this works on the packaged Desktop client too,\n * where the CLI refuses the application-owned profile.\n * - `pluginManager` — the family face published by\n * `@linxin666/dsh-client-ui-plugin-manager`, kept as the fallback for hosts\n * that publish no official remote.\n *\n * When neither face is present the caller keeps its read-only copy-command\n * fallback.\n *\n * CONTRACT OBSERVATION: repository rules forbid cross-package value imports, so\n * the members this module calls are re-declared here. Both sides must stay\n * compatible on the wire.\n * @module @linxin666/dsh-client-ui-skin-center/plugin-install-faces\n */\n\nimport type { Context } from '@deepseek-ai/cordis'\n\n/** Result envelope every `remote.<namespace>` method resolves with. */\nexport type NativeRemoteResult<T> =\n | { ok: true; value: T }\n | { ok: false; error: { code?: string; message?: string } }\n\n/** The official in-process plugin manager's client remote namespace. */\nexport interface NativePluginManagerService {\n /**\n * Install (or update) one package spec through the official manager.\n * @param spec - package spec, e.g. `@scope/pkg` or `@scope/pkg@1.2.3`.\n * @param options - activation choice and the request id the run is tracked under.\n */\n installBundle(spec: string, options?: { enabled?: boolean; requestId?: string }): Promise<NativeRemoteResult<unknown>>\n}\n\n/** The family plugin-manager face (mirrors its frozen cross-plugin contract). */\nexport interface FamilyPluginManagerService {\n /** Whether this browser has loopback authority over the host routes. */\n readonly isLoopback: boolean\n /** Install one plugin from an npm spec or git URL. */\n install(spec: string): Promise<unknown>\n}\n\n/**\n * The official Plugins page's navigation face.\n *\n * Installing a plugin leaves the reader with one question the installer cannot\n * answer: where to turn it on, and what it installed. The official panel already\n * renders enablement, uninstall and install diagnostics, so a row that just\n * installed something hands the reader there instead of growing a management\n * surface of its own. Same face the Workshop store uses.\n */\nexport interface PluginNavigationService {\n /**\n * Open one installed bundle's page in the official Plugins panel.\n * @param packageName - installed dependency (package) name.\n */\n openBundle(packageName: string): void\n}\n\n/** The faces this module bridged, any of which may be absent. */\nexport interface InstallFaces {\n readonly native: NativePluginManagerService | null\n readonly family: FamilyPluginManagerService | null\n readonly navigation: PluginNavigationService | null\n}\n\nlet faces: InstallFaces = { native: null, family: null, navigation: null }\nconst listeners = new Set<() => void>()\n\n/** Current faces snapshot (a cached reference, safe for useSyncExternalStore). */\nexport function getInstallFaces(): InstallFaces {\n return faces\n}\n\n/** Subscribe to face changes; returns the unsubscribe function. */\nexport function subscribeInstallFaces(listener: () => void): () => void {\n listeners.add(listener)\n return () => { listeners.delete(listener) }\n}\n\n/** Merge one face change into the snapshot and notify subscribers. */\nfunction patchFaces(patch: Partial<InstallFaces>): void {\n faces = { ...faces, ...patch }\n for (const listener of listeners) listener()\n}\n\n/**\n * npm package name (optionally scoped, lowercase) plus the optional concrete\n * version/tag suffix npm accepts. Mirrors the store's own rule so this module\n * can never hand a manager a spec the store would have rejected.\n */\nconst NPM_SPEC = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*(?:@[0-9A-Za-z][0-9A-Za-z._-]*)?$/\n\n/**\n * Whether one install spec is safe to hand to a plugin manager.\n * @param spec - the candidate spec.\n * @returns true for a plain npm package name (optionally `pkg@version`).\n */\nexport function isInstallSpecValid(spec: string): boolean {\n return NPM_SPEC.test(spec)\n}\n\n/**\n * Bridge both optional faces into the module store. Uses `ctx.inject` so each\n * face stays optional: the inner callback runs when the face is provided and is\n * disposed when it goes away, which clears the store.\n * @param ctx - the client root context.\n */\nexport function bridgeInstallFaces(ctx: Context): void {\n ctx.inject(['remote.pluginManager'], (inner) => {\n inner.effect(() => {\n patchFaces({ native: (inner.get('remote.pluginManager') as NativePluginManagerService | undefined) ?? null })\n return () => { patchFaces({ native: null }) }\n }, 'ui-skin-center: official pluginManager bridge')\n })\n ctx.inject(['pluginManager'], (inner) => {\n inner.effect(() => {\n patchFaces({ family: (inner.get('pluginManager') as FamilyPluginManagerService | undefined) ?? null })\n return () => { patchFaces({ family: null }) }\n }, 'ui-skin-center: family pluginManager bridge')\n })\n ctx.inject(['pluginNavigation'], (inner) => {\n inner.effect(() => {\n patchFaces({ navigation: (inner.get('pluginNavigation') as PluginNavigationService | undefined) ?? null })\n return () => { patchFaces({ navigation: null }) }\n }, 'ui-skin-center: official pluginNavigation bridge')\n })\n}\n\n/** Outcome of one install attempt. */\nexport type InstallOutcome =\n | { kind: 'installed' }\n | { kind: 'no-manager' }\n | { kind: 'failed'; message: string }\n\n/**\n * Install one spec through whichever management face is available.\n *\n * The official in-process manager is preferred whenever it is published: it is\n * the same call the official Plugins page makes and the only writer on the\n * packaged Desktop client. The family face is the fallback.\n *\n * @param spec - validated package spec.\n * @param requestId - id the run is tracked under.\n * @returns the outcome; never throws.\n */\nexport async function installPluginSpec(spec: string, requestId: string): Promise<InstallOutcome> {\n const useNative = faces.native !== null && typeof faces.native.installBundle === 'function'\n const useFamily = faces.family !== null && typeof faces.family.install === 'function'\n if (!isInstallSpecValid(spec)) {\n return { kind: 'failed', message: 'invalid install spec' }\n }\n if (!useNative && !useFamily) return { kind: 'no-manager' }\n try {\n if (useNative) {\n const result = await faces.native!.installBundle(spec, { enabled: true, requestId })\n if (result !== null && typeof result === 'object' && result.ok === false) {\n const error = (result as { error?: { code?: string; message?: string } }).error\n return { kind: 'failed', message: error?.message ?? error?.code ?? 'install failed' }\n }\n return { kind: 'installed' }\n }\n await faces.family!.install(spec)\n return { kind: 'installed' }\n } catch (error) {\n return { kind: 'failed', message: error instanceof Error ? error.message : String(error) }\n }\n}\n","/**\n * External Wallpaper Engine plugin pointer (issue #39, migration round).\n *\n * Wallpaper support no longer ships inside the skin center: it is delegated to\n * `dsh-plugin-wallpaper-engine`. This card occupies the place the wallpaper\n * controls used to, so the feature stays discoverable where users expect it.\n * The plugin is a recommended Workshop item, so the card offers a ONE-CLICK\n * INSTALL through whichever plugin-management face the host publishes\n * (see external-wallpaper-install.ts) and falls back to the copy-command line\n * when the host publishes none.\n *\n * Three states, all driven by the read-only host probe\n * (see src/external-wallpaper.ts):\n * - not installed, with a management face: the recommended badge plus an\n * Install button;\n * - not installed, no face: the copy-command fallback;\n * - installed: states that wallpapers are configured there, and that an\n * active wallpaper pauses this card's skin.\n *\n * Nothing renders when the probe cannot be reached, so an older host never\n * shows a false \"not installed\" prompt.\n */\nimport { useEffect, useState, useSyncExternalStore, type ReactNode } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport {\n getWallpaperInstallFaces,\n installPluginSpec,\n isInstallSpecValid,\n subscribeWallpaperInstallFaces,\n} from './external-wallpaper-install.ts'\nimport css from './skin-center.module.css'\n\n/** Host base path of the probe (mirrors src/routes-v2.ts). */\nconst EXTERNAL_WALLPAPER_API = '/api/skin-center/v2/external-wallpaper'\n\n/** The probe payload, as far as this pointer reads it. */\ninterface ExternalWallpaperPayload {\n ok?: boolean\n installed?: boolean\n packageName?: string\n repository?: string\n installCommand?: string\n /** npm spec the one-click install hands to the plugin manager. */\n npm?: string\n}\n\n/** The payload narrowed to what the pointer renders. */\ninterface ExternalWallpaperState {\n installed: boolean\n packageName: string\n repository: string\n installCommand: string\n npm: string\n}\n\n/** Fallbacks used only when the host omits a field. */\nconst FALLBACK = {\n packageName: 'dsh-plugin-wallpaper-engine',\n repository: 'https://github.com/elysia395/dsh-wallpaper-engine',\n installCommand: 'dsh plugin --profile web add dsh-plugin-wallpaper-engine',\n npm: 'dsh-plugin-wallpaper-engine',\n}\n\n/** The copyable command line, used when no management face is available. */\nasync function copyText(text: string): Promise<boolean> {\n try {\n await navigator.clipboard.writeText(text)\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Render the delegated-plugin pointer, or nothing when the probe cannot be\n * reached.\n * @param props - the card's locale seat.\n * @returns the pointer, or null.\n */\nexport function ExternalWallpaperNotice({ t }: { t: PropsLocale<'skinCenter'>['t'] }): ReactNode {\n const [state, setState] = useState<ExternalWallpaperState | null>(null)\n const faces = useSyncExternalStore(subscribeWallpaperInstallFaces, getWallpaperInstallFaces)\n const [installing, setInstalling] = useState(false)\n const [notice, setNotice] = useState<'copied' | 'failed' | null>(null)\n const [error, setError] = useState<string | null>(null)\n\n useEffect(() => {\n let cancelled = false\n void fetch(EXTERNAL_WALLPAPER_API)\n .then((res) => (res.ok ? res.json() as Promise<ExternalWallpaperPayload> : null))\n .then((payload) => {\n if (cancelled || payload?.ok !== true) return\n setState({\n installed: payload.installed === true,\n packageName: typeof payload.packageName === 'string' && payload.packageName !== ''\n ? payload.packageName\n : FALLBACK.packageName,\n repository: typeof payload.repository === 'string' && payload.repository !== ''\n ? payload.repository\n : FALLBACK.repository,\n installCommand: typeof payload.installCommand === 'string' && payload.installCommand !== ''\n ? payload.installCommand\n : FALLBACK.installCommand,\n npm: typeof payload.npm === 'string' && payload.npm !== '' ? payload.npm : FALLBACK.npm,\n })\n })\n .catch(() => {\n // Offline, fenced, or a host without the route: stay silent rather\n // than claim the plugin is missing.\n })\n return () => { cancelled = true }\n }, [])\n\n if (state === null) return null\n\n // A manager exists when either face is published; installPluginSpec itself\n // prefers the official in-process manager.\n const canInstall = faces.native !== null || faces.family !== null\n const spec = state.npm\n\n const onInstall = (): void => {\n if (installing || !isInstallSpecValid(spec)) return\n setInstalling(true)\n setError(null)\n setNotice(null)\n const cryptoObj = typeof window === 'undefined' ? undefined : window.crypto\n const requestId = cryptoObj && typeof cryptoObj.randomUUID === 'function'\n ? cryptoObj.randomUUID()\n : 'skin-center-wallpaper-' + spec\n void installPluginSpec(spec, requestId).then((outcome) => {\n // 'installed' needs no message: the probe re-reads on the next mount, and\n // a host that hot-reloads the row reports the new plugin itself.\n if (outcome.kind === 'failed') setError(outcome.message)\n }).finally(() => { setInstalling(false) })\n }\n\n const onCopy = (): void => {\n void copyText(state.installCommand).then((ok) => { setNotice(ok ? 'copied' : 'failed') })\n }\n\n return (\n <div className={css.externalWallpaperNotice} role=\"status\">\n <div className={css.externalWallpaperTitle}>\n {state.installed ? t('externalWallpaperReadyTitle') : t('externalWallpaperMissingTitle')}\n </div>\n {!state.installed && (\n <span className={css.externalWallpaperBadge}>{t('externalWallpaperRecommended')}</span>\n )}\n <p className={css.externalWallpaperBody}>\n {state.installed\n ? t('externalWallpaperReadyBody')\n : t('externalWallpaperMissingBody', { package: state.packageName })}\n </p>\n {!state.installed && (\n <div className={css.externalWallpaperActions}>\n {canInstall && (\n <button\n type=\"button\"\n className={css.button + ' ' + css.buttonPrimary}\n disabled={installing}\n onClick={onInstall}\n >\n {installing ? t('externalWallpaperInstalling') : t('externalWallpaperInstall')}\n </button>\n )}\n {!canInstall && (\n <code className={css.externalWallpaperCommand}>{state.installCommand}</code>\n )}\n <button type=\"button\" className={css.button} disabled={installing} onClick={onCopy}>\n {notice === 'copied' ? t('externalWallpaperCopied') : t('externalWallpaperCopyCommand')}\n </button>\n </div>\n )}\n {error !== null && (\n <p className={css.externalWallpaperError} role=\"alert\">\n {t('externalWallpaperInstallFailed', { reason: error })}\n </p>\n )}\n <a\n className={css.externalWallpaperLink}\n href={state.repository}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {t('externalWallpaperLink')}\n </a>\n </div>\n )\n}\n","/**\n * The delegated-skin row: a skin whose visual is another plugin's.\n *\n * It renders where the wallpaper controls used to live and where a skin's own\n * card lives now, because it is both: it is a selection (apply it, and it is\n * remembered across a reload) and an install prompt (the plugin that paints it\n * is a separate package). The row is listed whether or not that package is\n * installed, because an installed-and-enabled plugin that the card hid until\n * the user went to the store is a plugin nobody finds.\n *\n * It is a full-width bar ABOVE the skin grid, not a tile among them: it has no\n * preview image (the plugin paints, and this package holds no screenshot of\n * it), so a tile sized for a 16:9 thumbnail would be mostly empty. The bar\n * carries the same head / tagline / actions shape as the custom-theme card\n * below the grid, so the two non-asset looks read as the same kind of row.\n *\n * The body is the LOOK, not the row's state: a short description of what\n * applying it gives you. State belongs to the badge (this row is active) and\n * to the buttons (you can pick it, or you cannot, and here is the button that\n * fixes that). Prose about the row's own state sat where a reader looks for a\n * description of the theme, and said nothing they could not already see.\n *\n * Two states still earn one line each, because in both the row withholds the\n * selection buttons and silence would read as a bug: a plugin that cannot hand\n * the page back yet, and a descriptor the installed package has outgrown.\n *\n * Three states, all read from two sources and never guessed:\n *\n * - not installed: the one-click install through whichever plugin-management\n * face the host publishes, or the exact command when it publishes none;\n * - installed but not live: the plugin is wired into this profile but its\n * browser half is not on the page, so this row cannot paint yet. The row\n * says so instead of offering an apply that would deliver nothing;\n * - live: the plugin paints. Try-on and apply are offered, because from here\n * the selection is a normal one and every other skin, the stock look and a\n * running wallpaper all take the page back.\n *\n * A live plugin that does NOT advertise the handoff attribute is a build that\n * cannot stand down. Offering apply on it would let the user select this skin\n * and then pick a real skin over it, which is the broken overlap the whole\n * delegation exists to prevent, so the row says the plugin has to be updated\n * and still lets them look at it.\n *\n * The state that needs care is ABSENT markers while a skin is painted. That is\n * what a working handoff looks like from out here: the plugin is installed,\n * running, and standing down because this card's own skin owns the page. Read\n * as \"not running\" it both lies and strands the reader — no buttons, no way\n * back — so the row takes {@link DelegatedSkinCardProps.yieldedToSkin} from the\n * card (which knows what is painted), says the plugin yielded, and keeps the\n * try-on / apply buttons: switching back is exactly the action that hands the\n * page over again.\n *\n * Everything the peer publishes is read, never written: the two attributes\n * (see runtime/delegated-theme.ts) and the install call the host itself makes.\n * @module @linxin666/dsh-client-ui-skin-center/DelegatedSkinCard\n */\nimport { useState, useSyncExternalStore, type ReactNode } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\n\nimport type { SkinCenterKey } from './locales.ts'\n\nimport {\n getInstallFaces,\n installPluginSpec,\n isInstallSpecValid,\n subscribeInstallFaces,\n} from './plugin-install-faces.ts'\nimport type { CatalogSkin } from './runtime/boot.ts'\nimport type { DelegatedThemeState } from './runtime/delegated-theme.ts'\nimport css from './skin-center.module.css'\n\n/** The delegated payload a delegated row's manifest carries. */\ninterface DelegatedPayload {\n package: string\n repository: string\n installCommand: string\n bodyAttr: string\n handoffAttr: string\n installed: boolean\n signals: string[]\n descriptorMatches: boolean | null\n}\n\n/** Business face the card injects; the row needs only the theme state. */\nexport interface DelegatedSkinCardProps {\n t: PropsLocale<'skinCenter'>['t']\n skin: CatalogSkin\n /** Whether the delegated plugin is on this page, and whether it can yield. */\n theme: DelegatedThemeState\n isActive: boolean\n isTrying: boolean\n /**\n * True when this row has no markers of its own but a real skin is painted:\n * the delegated plugin is running and standing down for that skin, which is\n * the handoff working, not a plugin that failed to load.\n */\n yieldedToSkin: boolean\n busy: boolean\n disabled: boolean\n onTryOn: () => void\n onExitTryOn: () => void\n onApply: () => void\n /** Re-read the catalog after a successful install (the probe moves). */\n onInstalled: () => void\n}\n\n/** The copyable command line, used when no management face is available. */\nasync function copyText(text: string): Promise<boolean> {\n try {\n await navigator.clipboard.writeText(text)\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Render one delegated-skin row.\n * @param props - the row's locale seat, its catalog entry and the card's actions.\n * @returns the row.\n */\nexport function DelegatedSkinCard(props: DelegatedSkinCardProps): ReactNode {\n const { t, skin, theme, isActive, isTrying, yieldedToSkin, busy, disabled } = props\n const manifest = skin.manifest as CatalogSkin['manifest'] & { delegated: DelegatedPayload }\n const payload = manifest.delegated\n const accent = manifest.accent ?? '#98a1ab'\n // The registry names the dictionary key rather than carrying the words, so\n // the body follows the interface language. The one narrowing cast lives here:\n // core cannot import the client's key union, and a missing key would render\n // the key itself, which is loud enough to catch.\n const description = t(manifest.descriptionKey as SkinCenterKey)\n const faces = useSyncExternalStore(subscribeInstallFaces, getInstallFaces)\n const [installing, setInstalling] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [notice, setNotice] = useState<'copied' | 'failed' | null>(null)\n\n const canInstall = faces.native !== null || faces.family !== null\n const spec = payload.package\n // The row is applicable when the plugin can own the page: it owns it now\n // (live and able to yield back), or it will the moment nothing else paints\n // (yielded to the skin this card has selected). A plugin that is installed\n // but neither live nor yielding is not on this page at all.\n const applicable = payload.installed && theme.live\n ? theme.canYield\n : payload.installed && yieldedToSkin\n const claimable = payload.installed && theme.live && !theme.canYield\n\n const onInstall = (): void => {\n if (installing || !isInstallSpecValid(spec)) return\n setInstalling(true)\n setError(null)\n const cryptoObj = typeof window === 'undefined' ? undefined : window.crypto\n const requestId = cryptoObj && typeof cryptoObj.randomUUID === 'function'\n ? cryptoObj.randomUUID()\n : 'skin-center-delegated-' + spec\n void installPluginSpec(spec, requestId).then((outcome) => {\n if (outcome.kind === 'failed') {\n setError(outcome.message)\n return\n }\n if (outcome.kind === 'installed') props.onInstalled()\n }).finally(() => { setInstalling(false) })\n }\n\n const onCopy = (): void => {\n void copyText(payload.installCommand).then((ok) => { setNotice(ok ? 'copied' : 'failed') })\n }\n\n // One line, and only where the row withholds the selection buttons: the\n // reason it withholds them. Everything else about the state is already on\n // screen (the badge says active, the buttons say pickable).\n const blocker = claimable\n ? t('delegatedSkinNoHandoff')\n : payload.installed && !applicable && !yieldedToSkin\n ? t('delegatedSkinNotRunning')\n : null\n\n return (\n <div className={`${css.card} ${css.delegatedCard}`} data-delegated-skin={manifest.id}>\n <div className={css.cardHead}>\n <span className={css.swatch} style={{ background: accent }} aria-hidden=\"true\" />\n <span className={css.cardName} title={manifest.nameEn}>{manifest.nameEn}</span>\n <span className={css.delegatedBadge}>{t('delegatedSkinBadge')}</span>\n {(isActive || isTrying) && (\n <span className={`${css.badge} ${isActive && !isTrying ? css.badgeActive : css.badgeTrying}`}>\n {isActive && !isTrying ? t('active') : t('tryingOn')}\n </span>\n )}\n </div>\n <div className={css.cardTagline} title={manifest.tagline ?? ''}>{manifest.tagline ?? ''}</div>\n <p className={css.delegatedDescription}>{description}</p>\n {blocker !== null && <p className={css.delegatedStatus} role=\"status\">{blocker}</p>}\n {error !== null && (\n <p className={css.delegatedStatus} role=\"alert\">{t('delegatedSkinInstallFailed', { reason: error })}</p>\n )}\n {payload.descriptorMatches === false && (\n <p className={css.delegatedStatus} role=\"alert\">{t('delegatedSkinDescriptorMismatch')}</p>\n )}\n <div className={css.actions}>\n {!payload.installed && (\n <>\n {canInstall ? (\n <button\n type=\"button\"\n className={`${css.button} ${css.buttonPrimary}`}\n disabled={installing || disabled}\n onClick={onInstall}\n >\n {installing ? t('delegatedSkinInstalling') : t('delegatedSkinInstall')}\n </button>\n ) : (\n <code className={css.externalWallpaperCommand}>{payload.installCommand}</code>\n )}\n <button type=\"button\" className={css.button} disabled={installing || disabled} onClick={onCopy}>\n {notice === 'copied' ? t('externalWallpaperCopied') : t('externalWallpaperCopyCommand')}\n </button>\n </>\n )}\n {payload.installed && faces.navigation !== null && (\n <button type=\"button\" className={css.button} onClick={() => { faces.navigation?.openBundle(spec) }}>\n {t('delegatedSkinManage')}\n </button>\n )}\n {applicable && (\n isActive && !isTrying ? (\n <button type=\"button\" className={`${css.button} ${css.buttonGhost}`} disabled>\n {t('tryOn')}\n </button>\n ) : (\n <>\n <button\n type=\"button\"\n className={`${css.button} ${css.buttonPrimary}`}\n disabled={busy || disabled}\n onClick={isTrying ? props.onExitTryOn : props.onTryOn}\n >\n {isTrying ? t('exitTryOn') : t('tryOn')}\n </button>\n <button type=\"button\" className={css.button} disabled={busy || disabled} onClick={props.onApply}>\n {busy ? t('applying') : t('apply')}\n </button>\n </>\n )\n )}\n </div>\n <a\n className={css.delegatedLink}\n href={payload.repository}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {t('delegatedSkinLink')}\n </a>\n </div>\n )\n}\n","/**\n * Delegated skins: a skin whose visual is produced by ANOTHER plugin.\n *\n * Every skin in this package is a pure asset directory under skins/<id>/\n * (see contracts/README.md): this package loads the CSS, paints the\n * background media and stamps html[data-dsh-skin]. That model cannot express a\n * whole-GUI theme another package ships as a plugin, and pretending otherwise\n * is what the v1 package / wiring / bodyAttr manifest fields used to attempt,\n * which is why v2 deprecated them.\n *\n * A delegated skin is the one narrow exception, deliberately the same shape\n * as the Wallpaper Engine delegation (issue #39): the other plugin owns the\n * visual, this package keeps only the selection.\n *\n * - The delegated plugin is a separate, independently versioned package. It\n * is NOT vendored, forked or bundled here; this module only names it,\n * probes whether this profile installed it, and offers the one-click\n * install through the official plugin-management faces.\n * - The row is listed whether or not the plugin is installed, because a row\n * the user cannot use yet IS the install prompt.\n * - Applying it is a normal skin selection: it persists, it is adopted on\n * boot, and selecting anything else hands the page back. What it does not\n * do is paint, because the delegated plugin paints. See\n * src/client/runtime/skin-controller.ts for the withheld activation and\n * src/client/runtime/delegated-theme.ts for the live marker contract.\n * - The handoff is one-way and attribute-only: this package never writes an\n * attribute a delegated plugin owns, and the plugin reads the public\n * html[data-dsh-skin] stamp to stand down. See\n * contracts/semantic-attrs-v1.md.\n *\n * The registry below is the built-in copy of each delegated plugin's own\n * descriptor, because a card must be able to offer an install BEFORE the\n * package exists on disk. When the package IS installed its own descriptor\n * file is read back and compared, so a rename upstream surfaces as a catalog\n * warning instead of a silently dead handoff.\n * @module @linxin666/dsh-client-ui-skin-center/core/delegated-skins\n */\n\nimport { join } from 'node:path'\n\nimport {\n detectProfilePlugin,\n installedPackageDir,\n profilePluginPaths,\n readJsonIfFile,\n} from './profile-plugin-probe.ts'\n\n/** A delegated plugin, as this package knows it. */\nexport interface DelegatedSkinDescriptor {\n /** Persisted selection value; also the card row id. Lowercase kebab-case. */\n id: string\n /** npm package spec the one-click install hands to the plugin manager. */\n package: string\n /** Upstream repository (docs, issues, changelog). */\n repository: string\n /** The command the card copies when no management face is published. */\n installCommand: string\n /** The attribute the plugin stamps on body while it owns the page. */\n bodyAttr: string\n /**\n * The attribute the plugin stamps on body while it can hand the page back.\n * Its PRESENCE is the capability signal: a build without it cannot stand\n * down for a skin, so the row must not be offered as applicable.\n */\n handoffAttr: string\n /** The plugin's cordis row id, for diagnostics and profile inspection. */\n wiringId: string\n /** Card copy: the plugin owns the wording, this is what it ships. */\n name: string\n nameEn: string\n /** One line naming the look. */\n tagline: string\n /**\n * The locale key holding the row's body copy, not the copy itself.\n *\n * The body is what the reader reads about the look, so it has to follow the\n * interface language like every other string on this card. Keeping the text\n * here would ship one language to everyone and walk straight past the\n * zh/en/ru parity gate, so the registry names the key and the dictionary\n * (client/locales.ts) owns the words. Typed as a plain string because core\n * cannot import the client's key union; the row narrows it once.\n */\n descriptionKey: string\n /** #rrggbb swatch shown where a skin would show a preview image. */\n accent: string\n}\n\n/**\n * The Claude Code Desktop theme, as a delegated skin.\n *\n * The plugin is dsh-claude-style (https://github.com/Nwflower/dsh-claude-style),\n * which repaints the whole GUI as Claude Code Desktop. It is a peer project:\n * this package neither vendors it nor edits it, and every field below is\n * either its own published value or the contract it agreed to.\n */\nexport const CLAUDE_STYLE_SKIN: DelegatedSkinDescriptor = {\n id: 'claude-style',\n package: 'dsh-claude-style',\n repository: 'https://github.com/Nwflower/dsh-claude-style',\n installCommand: 'dsh plugin --profile web add dsh-claude-style',\n // Its own body marker: the value is the build id, the presence is the claim.\n bodyAttr: 'data-dsh-claude-style',\n // Added by the handoff contract; absent on every build that predates it.\n handoffAttr: 'data-dsh-claude-style-handoff',\n wiringId: 'ui-skin-claude-style',\n name: 'Claude Code Style',\n nameEn: 'Claude Code Style',\n tagline: 'Claude Code Desktop theme, provided by the dsh-claude-style plugin',\n descriptionKey: 'delegatedSkinDescriptionClaudeStyle',\n accent: '#d97757',\n}\n\n/** Every delegated skin this package knows. Order is the card's row order. */\nexport const DELEGATED_SKINS: readonly DelegatedSkinDescriptor[] = Object.freeze([\n CLAUDE_STYLE_SKIN,\n])\n\n/**\n * The delegated skin with this id, or null.\n * @param id - a persisted selection value.\n * @returns the descriptor, or null when the id is an asset skin or unknown.\n */\nexport function findDelegatedSkin(id: string): DelegatedSkinDescriptor | null {\n return DELEGATED_SKINS.find((skin) => skin.id === id) ?? null\n}\n\n/** Whether this id names a delegated skin (an asset skin resolves to false). */\nexport function isDelegatedSkinId(id: string): boolean {\n return findDelegatedSkin(id) !== null\n}\n\n/** The fields of a delegated descriptor this package acts on. */\nexport interface DelegatedDescriptorFields {\n id: string\n package: string\n bodyAttr: string\n wiringId: string | null\n}\n\n/**\n * Parse a delegated plugin's own descriptor file.\n *\n * The shape is the v1 delegated-skin manifest the peer already ships: an id, a\n * package, the attribute it stamps, and the wiring row it inserts. Only the\n * fields this package acts on are read, each one type-checked; anything else\n * is ignored rather than rejected, because the file belongs to another package\n * and this one must not become a second validator for it.\n * @param input - the parsed JSON (or anything else).\n * @returns the fields this package understands, or null when the core ones\n * are missing or of the wrong type.\n */\nexport function parseDelegatedDescriptor(input: unknown): DelegatedDescriptorFields | null {\n if (typeof input !== 'object' || input === null || Array.isArray(input)) return null\n const record = input as Record<string, unknown>\n const id = record.id\n const pkg = record.package\n const bodyAttr = record.bodyAttr\n if (typeof id !== 'string' || id === '') return null\n if (typeof pkg !== 'string' || pkg === '') return null\n if (typeof bodyAttr !== 'string' || bodyAttr === '') return null\n const wiring = record.wiring\n const wiringId = typeof wiring === 'object' && wiring !== null && !Array.isArray(wiring)\n && typeof (wiring as Record<string, unknown>).id === 'string'\n ? (wiring as Record<string, unknown>).id as string\n : null\n return { id, package: pkg, bodyAttr, wiringId }\n}\n\n/**\n * Read a delegated package's own descriptor file from the installed tree.\n * @param profileDir - the active profile's root directory.\n * @param packageName - the installed package.\n * @returns the parsed fields, or null when the file is absent or unreadable.\n */\nexport function readInstalledDescriptor(\n profileDir: string,\n packageName: string,\n): DelegatedDescriptorFields | null {\n const dir = installedPackageDir(profileDir, packageName)\n return parseDelegatedDescriptor(readJsonIfFile(join(dir, 'skin.json')))\n}\n\n/** Injection seam so tests never touch the real profile layout. */\nexport interface DelegatedSkinDeps {\n /** Explicit harness home / profile (tests), else the live layout. */\n home?: string\n profile?: string\n /** Registry override; defaults to DELEGATED_SKINS. */\n skins?: readonly DelegatedSkinDescriptor[]\n}\n\n/** One row of the catalog: the descriptor plus what this profile reports. */\nexport interface DelegatedSkinRow {\n descriptor: DelegatedSkinDescriptor\n /** Whether the delegated package is installed in this profile. */\n installed: boolean\n /** Probe signal names, for diagnostics. */\n signals: string[]\n /**\n * Whether the installed package's own descriptor agrees with this copy.\n * Null when the package is not installed (nothing to compare) or its\n * descriptor could not be read. False is a real mismatch and is surfaced to\n * the card: a renamed attribute or package would otherwise hand the page to\n * a plugin that never hears about it.\n */\n descriptorMatches: boolean | null\n}\n\n/**\n * Build one catalog row per delegated skin.\n *\n * The row is built whether or not the plugin is installed: a listed row with\n * installed=false is the install prompt, which is the whole point of a\n * delegated skin. The descriptor comparison is advisory, a mismatch becomes a\n * descriptorMatches=false the card can explain, and never a thrown error or a\n * skipped row.\n * @param deps - test seams; the live profile otherwise.\n * @returns one row per registry entry, in registry order.\n */\nexport function delegatedSkinRows(deps: DelegatedSkinDeps = {}): DelegatedSkinRow[] {\n const registry = deps.skins ?? DELEGATED_SKINS\n let profileDir: string | null = null\n try {\n profileDir = profilePluginPaths({ home: deps.home, profile: deps.profile }).profileDir\n } catch {\n profileDir = null\n }\n return registry.map((descriptor) => {\n const probe = detectProfilePlugin(descriptor.package, { home: deps.home, profile: deps.profile })\n let descriptorMatches: boolean | null = null\n if (probe.installed && profileDir !== null) {\n const installed = readInstalledDescriptor(profileDir, descriptor.package)\n descriptorMatches = installed === null\n ? null\n : installed.id === descriptor.id\n && installed.package === descriptor.package\n && installed.bodyAttr === descriptor.bodyAttr\n }\n return { descriptor, installed: probe.installed, signals: probe.signals, descriptorMatches }\n })\n}\n","/**\n * The delegated-skin face the skin center injects into its card.\n *\n * A delegated skin (src/core/delegated-skins.ts) is painted by another\n * plugin, so the card cannot decide on its own whether that plugin is on the\n * page: the answer is the plugin's own document marker, watched in\n * runtime/delegated-theme.ts. This handle is the read-only projection of that\n * watcher the card renders from.\n *\n * It carries no controls. Nothing here writes the other plugin's attributes\n * and nothing here installs or disables it; the row's Install button goes\n * through the host's own plugin manager (plugin-install-faces.ts).\n */\nimport { DELEGATED_SKINS } from '../core/delegated-skins.ts'\nimport type { DelegatedThemeState } from './runtime/delegated-theme.ts'\n\n/** What the card needs to know about one delegated plugin. */\nexport interface DelegatedSkinHandle {\n /** The delegated skin ids this build knows, in card row order. */\n ids(): string[]\n /** Whether that plugin is on this page, and whether it can stand down. */\n state(id: string): DelegatedThemeState\n /** Observe a change in {@link state} for any delegated skin. */\n subscribe(listener: () => void): () => void\n}\n\n/**\n * Build the card's delegated-skin face over a state reader.\n * @param read - the current state of one delegated skin id.\n * @param subscribe - subscribe to changes of any of them.\n * @returns the handle the card consumes.\n */\nexport function createDelegatedSkinHandle(\n read: (id: string) => DelegatedThemeState,\n subscribe: (listener: () => void) => () => void,\n): DelegatedSkinHandle {\n return {\n ids: () => DELEGATED_SKINS.map((skin) => skin.id),\n state: read,\n subscribe,\n }\n}\n","import { useEffect, useState, useSyncExternalStore, type ReactNode } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\n\nimport type { CustomThemeController, CustomThemeScheme } from './custom-theme-controller.ts'\nimport css from './skin-center.module.css'\n\ntype ColorKey = 'accent' | 'background' | 'foreground'\n\nexport interface CustomThemeCardProps {\n t: PropsLocale<'skinCenter'>['t']\n customTheme: CustomThemeController\n scheme: CustomThemeScheme\n setScheme(scheme: CustomThemeScheme): void\n isActive: boolean\n isTrying: boolean\n busy: boolean\n disabled: boolean\n onTryOn(): void\n onExitTryOn(): void\n onApply(): void\n}\n\nexport function CustomThemeCard(props: CustomThemeCardProps): ReactNode {\n const {\n t, customTheme, scheme, setScheme, isActive, isTrying, busy, disabled,\n onTryOn, onExitTryOn, onApply,\n } = props\n const customThemeState = useSyncExternalStore(customTheme.subscribe, customTheme.getState)\n const profile = customTheme.profile(scheme)\n const [expanded, setExpanded] = useState(false)\n const [draftColors, setDraftColors] = useState<Record<ColorKey, string>>({\n accent: profile.accent,\n background: profile.background,\n foreground: profile.foreground,\n })\n\n useEffect(() => {\n setDraftColors({\n accent: profile.accent,\n background: profile.background,\n foreground: profile.foreground,\n })\n }, [scheme, profile.accent, profile.background, profile.foreground])\n\n const setDraft = (key: ColorKey, value: string): void => {\n setDraftColors(current => ({ ...current, [key]: value }))\n }\n const commitColor = (key: ColorKey): void => {\n const value = draftColors[key]\n if (/^#[0-9a-f]{6}$/i.test(value)) customTheme.setProfileValue(scheme, key, value)\n else setDraft(key, profile[key])\n }\n const colorField = (key: ColorKey, label: string): ReactNode => {\n const draft = draftColors[key]\n const pickerValue = /^#[0-9a-f]{6}$/i.test(draft) ? draft : profile[key]\n return (\n <label className={css.customThemeField} key={key}>\n <span className={css.customThemeFieldLabel}>{label}</span>\n <span className={css.customThemeInputRow}>\n <input\n className={css.customThemeColor}\n type=\"color\"\n value={pickerValue}\n aria-label={label}\n disabled={disabled}\n onChange={(event) => {\n const value = event.target.value\n setDraft(key, value)\n customTheme.setProfileValue(scheme, key, value)\n }}\n />\n <input\n className={css.customThemeHex}\n type=\"text\"\n value={draft}\n inputMode=\"text\"\n maxLength={7}\n spellCheck={false}\n aria-label={`${label} hex`}\n disabled={disabled}\n onChange={(event) => { setDraft(key, event.target.value) }}\n onBlur={() => { commitColor(key) }}\n onKeyDown={(event) => {\n if (event.key === 'Enter') event.currentTarget.blur()\n }}\n />\n </span>\n </label>\n )\n }\n\n return (\n <div className={`${css.card} ${css.customThemeCard}`} data-dsh-custom-theme-card=\"\">\n <div className={css.cardHead}>\n <span className={css.swatch} style={{ background: profile.accent }} aria-hidden=\"true\" />\n <span className={css.cardName}>{t('customThemeTitle')}</span>\n {(isActive || isTrying) && (\n <span className={`${css.badge} ${isActive ? css.badgeActive : css.badgeTrying}`}>\n {isActive ? t('active') : t('tryingOn')}\n </span>\n )}\n </div>\n <div className={css.cardTagline}>{t('customThemeTagline')}</div>\n {customThemeState.writeError !== null && (\n <div className={css.error} role=\"alert\">\n {t('customThemeSaveFailed')}\n </div>\n )}\n <div className={css.actions}>\n {isActive && !isTrying ? (\n <button type=\"button\" className={`${css.button} ${css.buttonGhost}`} disabled>{t('tryOn')}</button>\n ) : isTrying ? (\n <button type=\"button\" className={`${css.button} ${css.buttonPrimary}`} disabled={disabled} onClick={onExitTryOn}>\n {t('exitTryOn')}\n </button>\n ) : (\n <button type=\"button\" className={`${css.button} ${css.buttonPrimary}`} disabled={disabled} onClick={onTryOn}>\n {busy ? t('loading') : t('tryOn')}\n </button>\n )}\n <button type=\"button\" className={css.button} disabled={disabled} onClick={onApply}>\n {busy ? t('applying') : t('apply')}\n </button>\n <button\n type=\"button\"\n className={css.button}\n aria-expanded={expanded}\n disabled={disabled}\n onClick={() => { setExpanded(value => !value) }}\n >\n {expanded ? t('customThemeCloseEdit') : t('customThemeEdit')}\n </button>\n </div>\n\n {expanded && (\n <div className={css.customThemeEditor}>\n <div className={css.customThemeScheme} role=\"group\" aria-label={t('customThemeMode')}>\n <span className={css.themeLabel}>{t('customThemeMode')}</span>\n <button\n type=\"button\"\n aria-pressed={scheme === 'light'}\n className={`${css.themeButton} ${scheme === 'light' ? css.themeButtonActive : ''}`}\n disabled={disabled}\n onClick={() => { setScheme('light') }}\n >\n {t('customThemeLight')}\n </button>\n <button\n type=\"button\"\n aria-pressed={scheme === 'dark'}\n className={`${css.themeButton} ${scheme === 'dark' ? css.themeButtonActive : ''}`}\n disabled={disabled}\n onClick={() => { setScheme('dark') }}\n >\n {t('customThemeDark')}\n </button>\n </div>\n\n <div className={css.customThemeFields}>\n {colorField('accent', t('customThemeAccent'))}\n {colorField('background', t('customThemeBackground'))}\n {colorField('foreground', t('customThemeForeground'))}\n </div>\n\n <label className={css.customThemeContrast}>\n <span className={css.backgroundHead}>\n <span className={css.customThemeFieldLabel}>{t('customThemeContrast')}</span>\n <span className={css.backgroundValue} aria-hidden=\"true\">{profile.contrast}</span>\n </span>\n <input\n className={css.backgroundRange}\n type=\"range\"\n min=\"0\"\n max=\"100\"\n step=\"1\"\n value={profile.contrast}\n aria-label={t('customThemeContrast')}\n aria-valuetext={String(profile.contrast)}\n disabled={disabled}\n onChange={(event) => { customTheme.setProfileValue(scheme, 'contrast', Number(event.target.value)) }}\n />\n </label>\n\n <div className={css.customThemeFooter}>\n <span className={css.backgroundHintMuted}>{t('customThemeResetHint')}</span>\n <button type=\"button\" className={css.button} disabled={disabled} onClick={() => { customTheme.reset(scheme) }}>\n {t('customThemeReset')}\n </button>\n </div>\n </div>\n )}\n </div>\n )\n}\n","/**\n * A drag-smooth range slider that decouples the visible value from the\n * external store while the user drags (issue #725).\n *\n * Binding <input type=\"range\"> directly to a useSyncExternalStore value\n * causes two defects during drag:\n * 1. Snapping back: the store subscription re-reads the scope snapshot while\n * the async scope.set() write is still in flight, resetting the thumb\n * to the old value mid-drag.\n * 2. Lag and stale labels: every onChange drives a full set -> publish ->\n * React render cycle, and the displayed number only updates once the\n * external store settles instead of following the thumb.\n *\n * This control keeps the input effectively uncontrolled: the browser moves\n * the thumb on the compositor thread with zero React involvement while\n * dragging, onInput reports the live value (one callback per animation\n * frame) so labels update in real time, and the final value is committed to\n * the external store through the native change event, which fires once per\n * completed pointer interaction (pointer release). Keyboard-only users get\n * an explicit commit path through onBlur and the Enter/Escape keydown\n * handlers, because not every engine fires the native change event for\n * range inputs on blur or Enter (jsdom does not; behavior varies by\n * browser). A pointer cancel aborts without committing, and the external\n * value is re-synced into the DOM only while the user is neither dragging\n * nor keyboard-focusing the input.\n * @module @linxin666/dsh-client-ui-skin-center/slider-control\n */\nimport { useCallback, useEffect, useRef, type ReactNode } from 'react'\n\n/** Props for the drag-smooth slider control. */\nexport interface SliderControlProps {\n /** External value from the store (initial value + sync target). */\n value: number\n min?: number\n max?: number\n step?: number\n /** Committed on drag end / keyboard change; callers persist to the store here. */\n onChange: (value: number) => void\n /** Live value during interaction, throttled to one callback per frame. */\n onChanging?: (value: number) => void\n className?: string\n id?: string\n ariaLabel?: string\n ariaValuetext?: string\n}\n\n/**\n * A range slider that stays smooth during drag (issue #725).\n *\n * @param props - slider props.\n * @returns the range input element.\n */\nexport function SliderControl({\n value: externalValue,\n min = 0,\n max = 100,\n step = 1,\n onChange,\n onChanging,\n className,\n id,\n ariaLabel,\n ariaValuetext,\n}: SliderControlProps): ReactNode {\n const inputRef = useRef<HTMLInputElement | null>(null)\n const draggingRef = useRef(false)\n const rafRef = useRef<number | null>(null)\n const liveRef = useRef(0)\n const lastCommittedRef = useRef<number | null>(null)\n const onChangingRef = useRef(onChanging)\n onChangingRef.current = onChanging\n\n // Commit through the NATIVE change event (React's onChange is synthesized\n // from 'input' for range inputs, which would commit on every move). The\n // native change event fires exactly once per completed pointer interaction.\n const commitRef = useRef(onChange)\n commitRef.current = onChange\n\n /**\n * Persist a value to the external store, de-duplicated against the last\n * committed value so the explicit keyboard/onBlur commit paths never\n * double-fire alongside the native change event (which real browsers also\n * emit on blur or Enter for range inputs).\n */\n const commit = useCallback((value: number): void => {\n if (lastCommittedRef.current === value) return\n lastCommittedRef.current = value\n commitRef.current(value)\n }, [])\n\n const commitCurrent = useCallback((): void => {\n const input = inputRef.current\n if (input === null) return\n draggingRef.current = false\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current)\n rafRef.current = null\n }\n commit(Number(input.value))\n }, [commit])\n\n // Sync the external value into the DOM input, unless the user is dragging\n // or keyboard-focusing the input (the native change event already carries\n // the committed keyboard value; overwriting here would snap the thumb).\n useEffect(() => {\n const input = inputRef.current\n if (input !== null && !draggingRef.current && input !== input.ownerDocument.activeElement) {\n input.value = String(externalValue)\n }\n }, [externalValue])\n\n useEffect(() => {\n const input = inputRef.current\n if (input === null) return\n const listener = (): void => {\n draggingRef.current = false\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current)\n rafRef.current = null\n }\n commit(Number(input.value))\n }\n input.addEventListener('change', listener)\n return (): void => {\n input.removeEventListener('change', listener)\n }\n }, [commit])\n\n // Release the pending frame on unmount.\n useEffect(() => {\n return (): void => {\n if (rafRef.current !== null) cancelAnimationFrame(rafRef.current)\n }\n }, [])\n\n /** Throttled live-value reporter: fires onChanging at most once per frame. */\n const reportLive = useCallback((value: number): void => {\n liveRef.current = value\n if (rafRef.current !== null) return\n rafRef.current = requestAnimationFrame(() => {\n rafRef.current = null\n onChangingRef.current?.(liveRef.current)\n })\n }, [])\n\n const startDrag = useCallback(() => {\n draggingRef.current = true\n }, [])\n\n /** Abort the interaction (pointer cancel): no value is committed. */\n const cancelDrag = useCallback(() => {\n draggingRef.current = false\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current)\n rafRef.current = null\n }\n }, [])\n\n const onInput = useCallback((event: React.FormEvent<HTMLInputElement>) => {\n reportLive(Number(event.currentTarget.value))\n }, [reportLive])\n\n // Commit on blur so keyboard-only users persist the value even when the\n // engine never fires the native change event for range inputs on blur.\n const commitOnBlur = useCallback((): void => {\n if (draggingRef.current) return\n commitCurrent()\n }, [commitCurrent])\n\n // Enter/Escape are the explicit keyboard commit keys for range inputs.\n const onKeyDown = useCallback((event: React.KeyboardEvent<HTMLInputElement>): void => {\n if (event.key !== 'Enter' && event.key !== 'Escape') return\n if (draggingRef.current) return\n commitCurrent()\n }, [commitCurrent])\n\n return (\n <input\n ref={inputRef}\n id={id}\n className={className}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n defaultValue={externalValue}\n aria-label={ariaLabel}\n aria-valuetext={ariaValuetext}\n onPointerDown={startDrag}\n onPointerCancel={cancelDrag}\n onInput={onInput}\n onBlur={commitOnBlur}\n onKeyDown={onKeyDown}\n />\n )\n}","/**\n * The skin-center card: rendered as the content of a first-level settings\n * section, listing the official stock look plus every installed skin in the\n * v2 catalog (package-shipped built-ins + user dirs under $DSH_HOME/skins).\n *\n * v2 architecture (issue #506): skins are pure asset directories loaded by\n * the skin-center runtime. Try-on and apply both go through the same atomic\n * switch engine (src/client/runtime/skin-controller.ts) — try-on simply\n * skips persistence, and apply is one click with NO page reload, no\n * cordis.patch.yml rewrite, no boot-graph regeneration. The \"trying on\"\n * badge tracks the controller's live state, so closing and reopening the\n * settings panel keeps showing the skin that is still being previewed.\n * Copy rides the standard `t` seat; the theme preview control drives the\n * official theme service (persisted, same as the Appearance row).\n */\nimport { useEffect, useRef, useState, useSyncExternalStore, type ReactNode } from 'react'\nimport type { DelegatedThemeState } from './runtime/delegated-theme.ts'\nimport type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { ThemeSnapshot } from '@deepseek-ai/dsh-client-ui-theme/client'\nimport type { SkinActivationOptions } from './runtime/skin-controller.ts'\nimport type { CatalogSkin, SkinRuntimeStore } from './runtime/boot.ts'\nimport { isDelegatedCatalogSkin } from './runtime/boot.ts'\nimport type { SkinBackgroundHandle } from './background.ts'\nimport type { ExternalWallpaperHandle } from './external-wallpaper-handle.ts'\nimport type { PreviewCoordinator } from './preview-coordinator.ts'\nimport type { CustomThemeController } from './custom-theme-controller.ts'\nimport { ExternalWallpaperNotice } from './ExternalWallpaperNotice.tsx'\nimport { DelegatedSkinCard } from './DelegatedSkinCard.tsx'\nimport { createDelegatedSkinHandle, type DelegatedSkinHandle } from './delegated-skin-handle.ts'\nimport { CustomThemeCard } from './CustomThemePanel.tsx'\nimport { SliderControl } from './SliderControl.tsx'\nimport css from './skin-center.module.css'\n\n/** Business face the skin-center apply() injects into the card. */\nexport interface SkinCenterInjected {\n /** The v2 skin runtime store (controller + catalog). */\n runtime: SkinRuntimeStore\n theme: {\n getTheme(): ThemeSnapshot\n subscribe(listener: () => void): () => void\n setTheme(id: 'light' | 'dark'): void\n }\n /** Background occluder over the shared skin-background namespace. */\n background: SkinBackgroundHandle\n /** The delegated Wallpaper Engine plugin this card points at (issue #39). */\n externalWallpaper: ExternalWallpaperHandle\n /** Skins whose visual is another plugin's (see core/delegated-skins.ts). */\n delegated: DelegatedSkinHandle\n /** One serialized preview session shared by skins, wallpapers and themes. */\n preview: PreviewCoordinator\n /** User palette derived from the official stock theme. */\n customTheme: CustomThemeController\n}\n\n/** Plugin-card component props: locale seat + injected face. */\nexport type SkinCenterComponentProps =\n PropsLocale<'skinCenter'> & SkinCenterInjected\n\n/** The apply target of the official stock-look card. */\nconst OFFICIAL = 'official'\n\n/** Stand-in for a host that injects no delegated-skin face: nothing is live. */\nconst INERT_DELEGATED = createDelegatedSkinHandle(\n () => ({ live: false, canYield: false }),\n () => () => {},\n)\n\n/**\n * Live-label helper: the shown value follows the in-drag thumb immediately,\n * and falls back to the store value once the store settles (issue #725).\n */\nfunction useLiveValue(value: number): [number, (v: number | null) => void] {\n const [live, setLive] = useState<number | null>(null)\n useEffect(() => {\n setLive(null)\n }, [value])\n return [live ?? value, setLive]\n}\n\n/**\n * Render the skin-center card: a static header naming the plugin, with the\n * always-visible skin list (official default + every installed skin; try-on /\n * theme preview / one-click apply) rendered below it.\n * @param props - card props.\n * @returns the plugin card.\n */\nexport function SkinCenter({ t, runtime, theme, background, externalWallpaper, delegated, preview, customTheme }: SkinCenterComponentProps) {\n const snapshot = useSyncExternalStore((listener) => theme.subscribe(listener), () => theme.getTheme())\n const enabled = useSyncExternalStore(background.subscribe, background.enabled)\n const opacity = useSyncExternalStore(background.subscribe, background.opacity)\n const blurEmpty = useSyncExternalStore(background.subscribe, background.blurEmpty)\n const blurContent = useSyncExternalStore(background.subscribe, background.blurContent)\n const inputCardBlur = useSyncExternalStore(background.subscribe, background.inputCardBlur)\n const bubbleOpacity = useSyncExternalStore(background.subscribe, background.bubbleOpacity)\n const bubbleBlur = useSyncExternalStore(background.subscribe, background.bubbleBlur)\n const [shownOpacity, setShownOpacity] = useLiveValue(opacity)\n const [shownBlurEmpty, setShownBlurEmpty] = useLiveValue(blurEmpty)\n const [shownBlurContent, setShownBlurContent] = useLiveValue(blurContent)\n const [shownInputCardBlur, setShownInputCardBlur] = useLiveValue(inputCardBlur)\n const [shownBubbleOpacity, setShownBubbleOpacity] = useLiveValue(bubbleOpacity)\n const [shownBubbleBlur, setShownBubbleBlur] = useLiveValue(bubbleBlur)\n const catalog = useSyncExternalStore(runtime.subscribe, runtime.catalog)\n // Delegated rows render as bars above the grid; the grid holds only the\n // asset skins this package loads, each with a preview image to show.\n const delegatedEntries = (catalog ?? []).filter(isDelegatedCatalogSkin)\n const isAssetSkin = (entry: CatalogSkin): boolean => !isDelegatedCatalogSkin(entry)\n const state = useSyncExternalStore(runtime.subscribe, runtime.controller.getState)\n const customThemeState = useSyncExternalStore(customTheme.subscribe, customTheme.getState)\n const activeId = state.active\n const previewing = state.previewing\n const tryingId = state.trying\n const activeEntry = activeId === null ? null : runtime.find(activeId)\n const backdropActive = activeEntry?.manifest.contributes?.backgroundMedia !== undefined\n // A delegated row re-renders on the plugin's own markers, not on the catalog.\n // The handle is a pure read, so a host that renders the card without it\n // gets every delegated row reported as not running rather than a blank card.\n const delegatedSkins = delegated ?? INERT_DELEGATED\n const [delegatedStates, setDelegatedStates] = useState<Record<string, DelegatedThemeState>>({})\n useEffect(() => {\n const read = (): void => {\n const next: Record<string, DelegatedThemeState> = {}\n for (const id of delegatedSkins.ids()) next[id] = delegatedSkins.state(id)\n setDelegatedStates(next)\n }\n read()\n return delegatedSkins.subscribe(read)\n }, [delegatedSkins])\n /**\n * Whether an asset skin this card selected is standing on the delegated\n * plugin.\n *\n * The plugin's markers vanish while it yields, which from out here looks\n * exactly like a plugin that never loaded. The card knows the difference:\n * with the delegated row itself selected, absent markers mean the plugin\n * owns the page; with a real skin selected, absent markers mean the plugin\n * stood down for that skin, which is the handoff working. Stock look\n * (activeId null) is neither, and says so.\n */\n const delegatedSelected = activeEntry !== null && isDelegatedCatalogSkin(activeEntry)\n const assetSkinPainted = activeId !== null && !delegatedSelected\n const paintsOverDelegated = (entry: CatalogSkin, state: DelegatedThemeState | undefined): boolean =>\n assetSkinPainted && activeId !== entry.manifest.id && state?.live !== true\n const [busyId, setBusyId] = useState<string | null>(null)\n const [error, setError] = useState<string | null>(null)\n const [verifying, setVerifying] = useState(false)\n const [verifySummary, setVerifySummary] = useState<{\n total: number\n valid: number\n issues: number\n repaired?: string[]\n repairFailed?: Array<{ id: string; error: string }>\n } | null>(null)\n const [verifyReports, setVerifyReports] = useState<Record<string, { status: string; hooksTrusted: boolean; mismatches: string[]; missing: string[] }>>({})\n const [confirmUninstallId, setConfirmUninstallId] = useState<string | null>(null)\n const [uninstallingId, setUninstallingId] = useState<string | null>(null)\n // Bulk maintenance (update all / uninstall all). The two buttons drive the\n // existing per-skin repair and uninstall routes one id at a time rather than\n // adding a second mutating endpoint: the report route is the only new\n // surface, and every write still goes through the individually tested path.\n const [bulk, setBulk] = useState<{ phase: 'idle' | 'checking' | 'updating' | 'uninstalling'; done: number; total: number; failed: number; note: string } | null>(null)\n const [uninstallAllArmed, setUninstallAllArmed] = useState(false)\n // Unmount guard: once the card is gone, pending async completions must not\n // setState (the controller itself owns the skin state and lives on).\n const mounted = useRef(false)\n // Latest-click-wins token; a newer click invalidates older completions.\n const requestSeq = useRef(0)\n useEffect(() => {\n mounted.current = true\n return () => { mounted.current = false }\n }, [])\n\n const run = (target: string, action: () => Promise<string | null>): void => {\n const seq = ++requestSeq.current\n setError(null)\n setBusyId(target)\n void action()\n .catch(() => {\n if (!mounted.current || seq !== requestSeq.current) return\n setError(t('applyFailed'))\n })\n .finally(() => {\n if (!mounted.current || seq !== requestSeq.current) return\n setBusyId(null)\n })\n }\n\n // Try-on and apply are the two activations the user just asked for, so\n // they CLAIM THE STAGE: while the delegated wallpaper plugin renders, one of\n // them still paints once, which flips the public `html[data-dsh-skin]` stamp\n // that plugin keys its hand-back on (issue #49). Every other path - the boot\n // activation, the persisted-selection follower, refresh() - honors the\n // stand-down unchanged.\n const tryOn = (entry: CatalogSkin): void => {\n run(entry.manifest.id, () => preview.runSkin(() => runtime.controller.tryOn(entry.manifest.id, entry, { userInitiated: true })))\n }\n\n const tryOnOfficial = (): void => {\n run(OFFICIAL, () => preview.runSkin(() => runtime.controller.tryOn(null, null)))\n }\n\n const exitTryOn = (): void => {\n run(tryingId ?? OFFICIAL, () => preview.runSkin(() => runtime.controller.exitTryOn()))\n }\n\n const restoreCommittedSkin = async (state: { active: string | null }): Promise<void> => {\n const entry = state.active === null ? null : runtime.find(state.active)\n if (state.active !== null && entry === null) {\n throw new Error(`cannot restore skin ${state.active}`)\n }\n const restored = await runtime.controller.switchTo(state.active, entry)\n if (restored !== state.active) {\n throw new Error(`skin ${state.active ?? 'stock'} did not restore`)\n }\n }\n\n const switchAndDeactivateCustomTheme = async (\n target: string | null,\n entry: CatalogSkin | null,\n options?: SkinActivationOptions,\n ): Promise<string | null> => {\n const previous = { ...runtime.controller.getState() }\n const active = await runtime.controller.switchTo(target, entry, options)\n if (active !== target) {\n throw new Error(`${target === null ? 'stock theme' : `skin ${target}`} did not activate`)\n }\n try {\n await customTheme.deactivate()\n return active\n } catch (error) {\n try {\n await restoreCommittedSkin(previous)\n } catch (rollbackError) {\n throw new AggregateError([error, rollbackError], 'skin switch cleanup and rollback failed')\n }\n throw error\n }\n }\n\n const restoreOfficialLook = async (): Promise<string | null> => {\n // The delegated wallpaper plugin owns its own selection, so restoring the\n // stock skin never touches it (issue #39): the skin center only manages\n // skins, the wallpaper keeps rendering behind them.\n return await switchAndDeactivateCustomTheme(null, null)\n }\n\n /**\n * One-click apply: atomic client-side switch + persisted selection. No\n * reload, no boot-graph wait — the tapIndex adapter makes the next page\n * load boot straight into this skin.\n * @param target - skin id, or `official` for the stock look.\n */\n const applySkin = (target: string): void => {\n if (target === OFFICIAL) {\n run(OFFICIAL, () => preview.runSkin(restoreOfficialLook))\n return\n }\n const entry = runtime.find(target)\n if (entry === null) {\n setError(t('applyFailed'))\n return\n }\n run(target, () => preview.runSkin(() => switchAndDeactivateCustomTheme(target, entry, { userInitiated: true })))\n }\n\n const tryOnCustomTheme = (): void => {\n run('custom-theme', () => preview.runCustomTheme(async () => {\n const active = await runtime.controller.tryOn(null, null)\n if (active !== null) throw new Error('stock preview did not activate')\n customTheme.tryOn()\n return active\n }))\n }\n\n const exitCustomThemeTryOn = (): void => {\n run('custom-theme', () => preview.runCustomTheme(async () => {\n customTheme.exitTryOn()\n return await runtime.controller.exitTryOn()\n }))\n }\n\n const applyCustomTheme = (): void => {\n run('custom-theme', () => preview.runCustomTheme(async () => {\n await customTheme.apply()\n const active = await runtime.controller.switchTo(null, null)\n if (active !== null) {\n await customTheme.deactivate()\n throw new Error('stock theme did not activate')\n }\n return active\n }))\n }\n\n const handleVerify = async (): Promise<void> => {\n setVerifying(true)\n setError(null)\n try {\n const res = await fetch('/api/skin-center/v2/verify', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ autoRepair: true }),\n })\n const json = (await res.json().catch(() => null)) as {\n ok?: boolean\n total?: number\n valid?: number\n issues?: number\n repaired?: string[]\n repairFailed?: Array<{ id: string; error: string }>\n details?: Array<{ id: string; status: string; hooksTrusted: boolean; mismatches: string[]; missing: string[] }>\n } | null\n if (!res.ok || json?.ok !== true) {\n throw new Error('verify failed')\n }\n if (!mounted.current) return\n setVerifySummary({\n total: json.total ?? 0,\n valid: json.valid ?? 0,\n issues: json.issues ?? 0,\n repaired: json.repaired ?? [],\n repairFailed: json.repairFailed ?? [],\n })\n const map: Record<string, { status: string; hooksTrusted: boolean; mismatches: string[]; missing: string[] }> = {}\n for (const item of json.details ?? []) {\n map[item.id] = item\n }\n setVerifyReports(map)\n if (json.repaired && json.repaired.length > 0) {\n await runtime.refreshCatalog()\n if (activeId && json.repaired.includes(activeId)) {\n const freshEntry = runtime.find(activeId)\n if (freshEntry) {\n await preview.runSkin(() => switchAndDeactivateCustomTheme(activeId, freshEntry))\n }\n }\n }\n } catch {\n if (mounted.current) setError(t('applyFailed'))\n } finally {\n if (mounted.current) setVerifying(false)\n }\n }\n\n /** Repair every installed skin the market publishes a newer release of. */\n const handleUpdateAll = async (): Promise<void> => {\n setError(null)\n setBulk({ phase: 'checking', done: 0, total: 0, failed: 0, note: '' })\n let targets: string[]\n try {\n const res = await fetch('/api/skin-center/v2/skins/versions', { cache: 'no-store' })\n const json = (await res.json().catch(() => null)) as {\n ok?: boolean\n rows?: Array<{ id: string; outdated: boolean }>\n } | null\n if (!res.ok || json?.ok !== true || !Array.isArray(json.rows)) {\n throw new Error('versions-unavailable')\n }\n targets = json.rows.filter((row) => row.outdated).map((row) => row.id)\n } catch {\n if (mounted.current) {\n setBulk(null)\n setError(t('marketUnreachable'))\n }\n return\n }\n if (!mounted.current) return\n if (targets.length === 0) {\n setBulk({ phase: 'idle', done: 0, total: 0, failed: 0, note: t('updateAllNone') })\n return\n }\n let done = 0\n let failed = 0\n for (const id of targets) {\n setBulk({ phase: 'updating', done, total: targets.length, failed, note: '' })\n try {\n const res = await fetch(`/api/skin-center/v2/skins/${encodeURIComponent(id)}/repair`, { method: 'POST' })\n if (!res.ok) failed++\n } catch {\n failed++\n }\n done++\n }\n await runtime.refreshCatalog()\n if (!mounted.current) return\n if (activeId !== null) {\n const freshEntry = runtime.find(activeId)\n if (freshEntry) {\n await preview.runSkin(() => switchAndDeactivateCustomTheme(activeId, freshEntry))\n }\n }\n setBulk({\n phase: 'idle',\n done,\n total: targets.length,\n failed,\n note: failed === 0 ? t('updateAllDone', { count: done }) : t('updateAllFailed', { count: failed }),\n })\n }\n\n /**\n * Uninstall every market-installed skin, including the active one. Builtins\n * are never touched: they ship inside the package and are replaced by\n * upgrading it. The first tap only arms the button, matching the per-skin\n * uninstall affordance, because this cannot be undone.\n */\n const handleUninstallAll = async (): Promise<void> => {\n const targets = (catalog ?? []).filter((skin) => skin.origin === 'user')\n if (!uninstallAllArmed) {\n if (targets.length === 0) {\n setBulk({ phase: 'idle', done: 0, total: 0, failed: 0, note: t('bulkNoUserSkins') })\n return\n }\n setUninstallAllArmed(true)\n return\n }\n setUninstallAllArmed(false)\n setError(null)\n const wasActive = activeId\n const wasTrying = tryingId\n if (wasTrying !== null && targets.some((skin) => skin.manifest.id === wasTrying)) {\n await preview.runSkin(() => runtime.controller.exitTryOn())\n }\n let done = 0\n let failed = 0\n for (const skin of targets) {\n setBulk({ phase: 'uninstalling', done, total: targets.length, failed, note: '' })\n try {\n const res = await fetch(`/api/skin-center/v2/skins/${encodeURIComponent(skin.manifest.id)}/uninstall`, { method: 'POST' })\n if (!res.ok) failed++\n } catch {\n failed++\n }\n done++\n }\n await runtime.refreshCatalog()\n if (wasActive !== null && targets.some((skin) => skin.manifest.id === wasActive)) {\n await preview.runSkin(restoreOfficialLook)\n }\n if (!mounted.current) return\n setBulk({\n phase: 'idle',\n done,\n total: targets.length,\n failed,\n note: failed === 0 ? t('uninstallAllDone', { count: done }) : t('uninstallAllFailed', { count: failed }),\n })\n }\n\n const handleUninstall = async (entry: CatalogSkin): Promise<void> => {\n const id = entry.manifest.id\n setUninstallingId(id)\n setError(null)\n try {\n if (tryingId === id) {\n await preview.runSkin(() => runtime.controller.exitTryOn())\n }\n if (activeId === id) {\n await preview.runSkin(restoreOfficialLook)\n }\n const res = await fetch(`/api/skin-center/v2/skins/${encodeURIComponent(id)}/uninstall`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n })\n const json = (await res.json().catch(() => null)) as { ok?: boolean } | null\n if (!res.ok || json?.ok !== true) {\n throw new Error('uninstall failed')\n }\n await runtime.refreshCatalog()\n if (mounted.current) setConfirmUninstallId(null)\n } catch {\n if (mounted.current) setError(t('uninstallFailed'))\n } finally {\n if (mounted.current) setUninstallingId(null)\n }\n }\n\n const dark = document.body.hasAttribute('data-ds-dark-theme')\n // Asset root for the preview thumbnails (the store exposes it; tests that\n // stub the store without it fall back to the default mount point).\n const apiBase = runtime.apiBase ?? '/api/skin-center/v2'\n\n /** One row: try-on control + apply button + optional uninstall. Shared by the official card and every skin card. */\n const actionButtons = (opts: {\n key: string\n entry?: CatalogSkin\n isActive: boolean\n isTrying: boolean\n onTryOn: () => void\n applyLabel: string\n }): ReactNode => {\n const isUser = opts.entry?.origin === 'user'\n const isConfirming = isUser && confirmUninstallId === opts.key\n return (\n <div className={css.actions}>\n {opts.isActive && !opts.isTrying ? (\n <button type=\"button\" className={`${css.button} ${css.buttonGhost}`} disabled>\n {t('tryOn')}\n </button>\n ) : opts.isTrying ? (\n <button type=\"button\" className={`${css.button} ${css.buttonPrimary}`} disabled={busyId !== null || uninstallingId !== null} onClick={exitTryOn}>\n {t('exitTryOn')}\n </button>\n ) : (\n <button\n type=\"button\"\n className={`${css.button} ${css.buttonPrimary}`}\n disabled={busyId !== null || uninstallingId !== null}\n onClick={opts.onTryOn}\n >\n {busyId === opts.key ? t('loading') : t('tryOn')}\n </button>\n )}\n <button\n type=\"button\"\n className={css.button}\n disabled={busyId !== null || uninstallingId !== null}\n onClick={() => { applySkin(opts.key) }}\n >\n {busyId === opts.key ? t('applying') : opts.applyLabel}\n </button>\n {isUser && (\n isConfirming ? (\n <>\n <button\n type=\"button\"\n className={`${css.button} ${css.buttonDangerConfirm}`}\n disabled={busyId !== null || uninstallingId !== null}\n onClick={() => { if (opts.entry) void handleUninstall(opts.entry) }}\n >\n {uninstallingId === opts.key ? t('uninstalling') : t('confirm')}\n </button>\n <button\n type=\"button\"\n className={css.button}\n disabled={uninstallingId !== null}\n onClick={() => { setConfirmUninstallId(null) }}\n >\n {t('cancel')}\n </button>\n </>\n ) : (\n <button\n type=\"button\"\n className={`${css.button} ${css.buttonDanger}`}\n disabled={busyId !== null || uninstallingId !== null}\n onClick={() => { setConfirmUninstallId(opts.key) }}\n >\n {t('uninstall')}\n </button>\n )\n )}\n </div>\n )\n }\n\n return (\n <li className={css.pluginCard}>\n <div className={css.cardHeaderStatic}>\n <span className={css.headText}>\n <span className={css.pluginName}>\n {t('title')}\n <span className={css.titleBadge}>{String(catalog?.length ?? 0)}</span>\n </span>\n <span className={css.cardDescription} title={t('cardDescription')}>{t('cardDescription')}</span>\n </span>\n </div>\n\n <div className={css.cardBody}>\n <ExternalWallpaperNotice t={t} />\n {state.stoodDown && (\n <div className={css.externalWallpaperNotice} role=\"status\">\n <div className={css.externalWallpaperTitle}>{t('stoodDownTitle')}</div>\n <p className={css.externalWallpaperBody}>{t('stoodDownBody')}</p>\n </div>\n )}\n <div className={css.enableRow}>\n <span className={css.enableLabel} title={t('enabled')}>{t('enabled')}</span>\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={enabled}\n aria-label={t('enabled')}\n className={enabled ? css.switch + ' ' + css.switchOn : css.switch}\n onClick={() => { background.setEnabled(!enabled) }}\n >\n <span className={css.switchThumb} />\n </button>\n <p className={css.enableHint}>{t('enabledHint')}</p>\n </div>\n {enabled\n ? (\n <>\n <div className={css.head}>\n <div className={css.intro} title={t('intro')}>{t('intro')}</div>\n <div className={css.toolbar}>\n <div className={css.themeRow}>\n <span className={css.themeLabel}>{t('theme')}</span>\n <button\n type=\"button\"\n className={`${css.themeButton} ${dark ? '' : css.themeButtonActive}`}\n onClick={() => { theme.setTheme('light') }}\n >\n {t('themeLight')}\n </button>\n <button\n type=\"button\"\n className={`${css.themeButton} ${dark ? css.themeButtonActive : ''}`}\n onClick={() => { theme.setTheme('dark') }}\n >\n {t('themeDark')}\n </button>\n </div>\n <div className={css.actionRow}>\n <button\n type=\"button\"\n className={css.themeButton}\n disabled={verifying || busyId !== null || uninstallingId !== null}\n onClick={() => { void handleVerify() }}\n >\n {verifying ? t('verifyingIntegrity') : t('verifyIntegrity')}\n </button>\n <button\n type=\"button\"\n className={css.themeButton}\n disabled={bulk !== null && bulk.phase !== 'idle' || verifying || busyId !== null || uninstallingId !== null}\n onClick={() => { void handleUpdateAll() }}\n >\n {bulk?.phase === 'checking'\n ? t('updateAllChecking')\n : bulk?.phase === 'updating'\n ? t('updateAllRunning', { done: bulk.done, total: bulk.total })\n : t('updateAll')}\n </button>\n <button\n type=\"button\"\n className={`${css.themeButton} ${uninstallAllArmed ? css.buttonDangerConfirm : css.buttonDanger}`}\n disabled={bulk !== null && bulk.phase !== 'idle' || verifying || busyId !== null || uninstallingId !== null}\n onClick={() => { void handleUninstallAll() }}\n >\n {bulk?.phase === 'uninstalling'\n ? t('uninstallAllRunning', { done: bulk.done, total: bulk.total })\n : uninstallAllArmed\n ? t('confirm')\n : t('uninstallAll')}\n </button>\n </div>\n </div>\n {bulk !== null && bulk.note !== '' && (\n <div className={bulk.failed > 0 ? css.verifySummaryWarning : css.verifySummarySuccess}>\n {bulk.note}\n </div>\n )}\n {verifySummary !== null && (\n <div className={`${css.verifySummary} ${verifySummary.issues === 0 ? css.verifySummarySuccess : css.verifySummaryWarning}`}>\n {verifySummary.repaired && verifySummary.repaired.length > 0 && verifySummary.issues === 0\n ? t('verifyRepaired', { count: verifySummary.repaired.length })\n : verifySummary.issues === 0\n ? t('verifyAllPassed', { count: verifySummary.total })\n : verifySummary.repaired && verifySummary.repaired.length > 0\n ? `${t('verifyRepaired', { count: verifySummary.repaired.length })}, ${t('verifyFoundIssues', { count: verifySummary.issues })}`\n : t('verifyFoundIssues', { count: verifySummary.issues })}\n </div>\n )}\n </div>\n\n <div className={css.backgroundRow}>\n <div className={css.backgroundHead}>\n <span className={css.backgroundLabel}>{t('backgroundOpacity')}</span>\n <span className={css.backgroundValue} aria-hidden=\"true\">{shownOpacity}%</span>\n </div>\n <SliderControl\n id=\"skin-center-background-opacity\"\n className={css.backgroundRange}\n min={0}\n max={100}\n step={5}\n value={opacity}\n ariaValuetext={shownOpacity + '%'}\n ariaLabel={t('backgroundOpacity')}\n onChanging={setShownOpacity}\n onChange={(value) => { background.set(value) }}\n />\n <p className={backdropActive ? css.backgroundHint : css.backgroundHintMuted}>\n {backdropActive ? t('backgroundHint') : t('backgroundHintInert')}\n </p>\n </div>\n <div className={css.backgroundRow}>\n <div className={css.backgroundHead}>\n <span className={css.backgroundLabel}>{t('backgroundBlurEmpty')}</span>\n <span className={css.backgroundValue} aria-hidden=\"true\">{shownBlurEmpty}px</span>\n </div>\n <SliderControl\n id=\"skin-center-background-blur-empty\"\n className={css.backgroundRange}\n min={0}\n max={20}\n step={1}\n value={blurEmpty}\n ariaValuetext={shownBlurEmpty + 'px'}\n ariaLabel={t('backgroundBlurEmpty')}\n onChanging={setShownBlurEmpty}\n onChange={(value) => { background.setBlurEmpty(value) }}\n />\n <div className={css.backgroundHead}>\n <span className={css.backgroundLabel}>{t('backgroundBlurContent')}</span>\n <span className={css.backgroundValue} aria-hidden=\"true\">{shownBlurContent}px</span>\n </div>\n <SliderControl\n id=\"skin-center-background-blur-content\"\n className={css.backgroundRange}\n min={0}\n max={20}\n step={1}\n value={blurContent}\n ariaValuetext={shownBlurContent + 'px'}\n ariaLabel={t('backgroundBlurContent')}\n onChanging={setShownBlurContent}\n onChange={(value) => { background.setBlurContent(value) }}\n />\n <p className={backdropActive ? css.backgroundHint : css.backgroundHintMuted}>\n {backdropActive ? t('backgroundBlurHint') : t('backgroundBlurInert')}\n </p>\n </div>\n\n\n <div className={css.backgroundRow}>\n <div className={css.backgroundHead}>\n <span className={css.backgroundLabel}>{t('inputCardBlur')}</span>\n <span className={css.backgroundValue} aria-hidden=\"true\">{shownInputCardBlur}px</span>\n </div>\n <SliderControl\n id=\"skin-center-input-card-blur\"\n className={css.backgroundRange}\n min={0}\n max={20}\n step={1}\n value={inputCardBlur}\n ariaValuetext={shownInputCardBlur + 'px'}\n ariaLabel={t('inputCardBlur')}\n onChanging={setShownInputCardBlur}\n onChange={(value) => { background.setInputCardBlur(value) }}\n />\n <p className={css.backgroundHint}>{t('inputCardBlurHint')}</p>\n </div>\n\n <div className={css.backgroundRow}>\n <div className={css.backgroundHead}>\n <span className={css.backgroundLabel}>{t('bubbleOpacity')}</span>\n <span className={css.backgroundValue} aria-hidden=\"true\">{shownBubbleOpacity}%</span>\n </div>\n <SliderControl\n id=\"skin-center-bubble-opacity\"\n className={css.backgroundRange}\n min={0}\n max={100}\n step={5}\n value={bubbleOpacity}\n ariaValuetext={shownBubbleOpacity + '%'}\n ariaLabel={t('bubbleOpacity')}\n onChanging={setShownBubbleOpacity}\n onChange={(value) => { background.setBubbleOpacity(value) }}\n />\n <p className={css.backgroundHint}>{t('bubbleOpacityHint')}</p>\n </div>\n\n <div className={css.backgroundRow}>\n <div className={css.backgroundHead}>\n <span className={css.backgroundLabel}>{t('bubbleBlur')}</span>\n <span className={css.backgroundValue} aria-hidden=\"true\">{shownBubbleBlur}px</span>\n </div>\n <SliderControl\n id=\"skin-center-bubble-blur\"\n className={css.backgroundRange}\n min={0}\n max={20}\n step={1}\n value={bubbleBlur}\n ariaValuetext={shownBubbleBlur + 'px'}\n ariaLabel={t('bubbleBlur')}\n onChanging={setShownBubbleBlur}\n onChange={(value) => { background.setBubbleBlur(value) }}\n />\n <p className={css.backgroundHint}>{t('bubbleBlurHint')}</p>\n </div>\n\n\n {error !== null && <div className={css.error}>{error}</div>}\n\n <div className={css.list}>\n {delegatedEntries.map(entry => {\n const id = entry.manifest.id\n // A delegated skin is selected through the same switch\n // engine as any other, and paints through its own\n // plugin; the row renders that plugin's state instead of\n // a preview image and an uninstall this card has no\n // route for. It sits ABOVE the grid, beside the\n // custom-theme row below it: the two looks this package\n // does not paint are the two it lists as bars, and the\n // grid is for the asset directories it does load.\n return (\n <DelegatedSkinCard\n key={id}\n t={t}\n skin={entry}\n theme={delegatedStates[id] ?? { live: false, canYield: false }}\n isActive={id === activeId && !previewing}\n isTrying={previewing && id === tryingId}\n yieldedToSkin={paintsOverDelegated(entry, delegatedStates[id])}\n busy={busyId === id}\n disabled={busyId !== null || uninstallingId !== null}\n onTryOn={() => { tryOn(entry) }}\n onExitTryOn={exitTryOn}\n onApply={() => { applySkin(id) }}\n onInstalled={() => { void runtime.refreshCatalog() }}\n />\n )\n })}\n <div className={css.skinGrid}>\n {(() => {\n const isActive = activeId === null && !previewing && !customThemeState.applied\n const isTrying = previewing && tryingId === null && !customThemeState.previewing\n const badge = isActive ? t('active') : isTrying ? t('tryingOn') : null\n return (\n <div className={`${css.card} ${css.skinCard}`} key={OFFICIAL}>\n <div className={css.thumbWrap}>\n <div className={css.thumbEmpty} aria-hidden=\"true\" />\n {badge !== null && (\n <span className={`${css.badge} ${isActive ? css.badgeActive : css.badgeTrying}`}>\n {badge}\n </span>\n )}\n </div>\n <div className={css.cardHead}>\n <span className={css.swatch} style={{ background: '#98a1ab' }} aria-hidden=\"true\" />\n <span className={css.cardName} title={t('official')}>{t('official')}</span>\n </div>\n <div className={css.cardTagline} title={t('officialTagline')}>{t('officialTagline')}</div>\n {actionButtons({\n key: OFFICIAL,\n isActive,\n isTrying,\n onTryOn: tryOnOfficial,\n applyLabel: t('restore'),\n })}\n </div>\n )\n })()}\n\n {(catalog ?? []).filter(isAssetSkin).map(entry => {\n const id = entry.manifest.id\n const isActive = id === activeId && !previewing\n const isTrying = previewing && id === tryingId\n const badge = isActive ? t('active') : isTrying ? t('tryingOn') : null\n const report = verifyReports[id]\n // The thumbnail follows the live light/dark scheme, falling\n // back to the other variant when a skin ships only one.\n const previewPath = dark\n ? (entry.manifest.preview?.dark ?? entry.manifest.preview?.light)\n : (entry.manifest.preview?.light ?? entry.manifest.preview?.dark)\n const previewSrc = previewPath === undefined\n ? null\n : `${apiBase}/skins/${encodeURIComponent(id)}/${previewPath}`\n return (\n <div className={`${css.card} ${css.skinCard}`} key={id}>\n <div className={css.thumbWrap}>\n {previewSrc !== null\n ? <img className={css.thumb} src={previewSrc} alt={entry.manifest.nameEn} loading=\"lazy\" />\n : (\n <div\n className={css.thumbEmpty}\n style={{ background: entry.manifest.accent ?? undefined }}\n aria-hidden=\"true\"\n />\n )}\n {report && (\n <span\n className={`${css.badge} ${css.thumbReport} ${\n report.status === 'valid'\n ? css.badgeSuccess\n : report.status === 'tampered'\n ? css.badgeWarning\n : css.badgeDanger\n }`}\n title={\n report.status === 'valid'\n ? t('integrityValid')\n : [...report.mismatches, ...report.missing].join(', ') || report.status\n }\n >\n {report.status === 'valid'\n ? t('integrityValid')\n : report.status === 'tampered'\n ? t('integrityTampered')\n : report.status === 'missing-files'\n ? t('integrityMissing')\n : t('integrityHooksRefused')}\n </span>\n )}\n {badge !== null && (\n <span className={`${css.badge} ${isActive ? css.badgeActive : css.badgeTrying}`}>\n {badge}\n </span>\n )}\n </div>\n <div className={css.cardHead}>\n <span\n className={css.swatch}\n style={{ background: entry.manifest.accent ?? '#98a1ab' }}\n aria-hidden=\"true\"\n />\n <span className={css.cardName} title={entry.manifest.nameEn}>{entry.manifest.nameEn}</span>\n </div>\n <div className={css.cardTagline} title={entry.manifest.tagline ?? ''}>\n {entry.manifest.tagline ?? ''}\n </div>\n {report && report.status !== 'valid' && (\n <div className={css.integrityNote}>\n {[\n report.mismatches.length > 0 ? `${t('integrityTampered')}: ${report.mismatches.join(', ')}` : null,\n report.missing.length > 0 ? `${t('integrityMissing')}: ${report.missing.join(', ')}` : null,\n ].filter(Boolean).join(' | ')}\n </div>\n )}\n {actionButtons({\n key: id,\n entry,\n isActive,\n isTrying,\n onTryOn: () => { tryOn(entry) },\n applyLabel: t('apply'),\n })}\n </div>\n )\n })}\n </div>\n\n <CustomThemeCard\n t={t}\n customTheme={customTheme}\n scheme={dark ? 'dark' : 'light'}\n setScheme={scheme => { theme.setTheme(scheme) }}\n isActive={customThemeState.applied && activeId === null && !previewing}\n isTrying={customThemeState.previewing}\n busy={busyId === 'custom-theme'}\n disabled={busyId !== null}\n onTryOn={tryOnCustomTheme}\n onExitTryOn={exitCustomThemeTryOn}\n onApply={applyCustomTheme}\n />\n </div>\n </>\n )\n : (\n <p className={css.offNote} role=\"status\">{t('offNote')}</p>\n )}\n </div>\n </li>\n )\n}\n\n/** Props the settings section binds for the skin-center card page. */\nexport type SkinCenterSectionProps =\n PropsRuntime<'settings.section'>\n & PropsLocale<'skinCenter'>\n & SkinCenterInjected\n\n/** Render the skin-center card as a first-level settings page. */\nexport function SkinCenterSection(props: SkinCenterSectionProps): ReactNode {\n const { t, runtime, theme, background, externalWallpaper, delegated, preview, customTheme } = props\n return (\n <ul className={css.sectionList}>\n <SkinCenter\n t={t}\n runtime={runtime}\n theme={theme}\n background={background}\n externalWallpaper={externalWallpaper}\n delegated={delegated}\n preview={preview}\n customTheme={customTheme}\n />\n </ul>\n )\n}\n","/**\n * Shared skin-background preference contract (issue #996): the six values the\n * skin-center card edits — master switch, backdrop occlusion, per-state\n * backdrop blur, composer-card blur, and bubble opacity.\n *\n * These used to live only in the `skin-background` settings namespace, which\n * the remote pairing channel fences as loopback-only, so a paired remote\n * desktop always read defaults and silently dropped writes. They now persist\n * in the skin center's own v2 state (POST /api/skin-center/v2/active), which\n * rides the same allow-listed channel as skin switching. This module is the\n * dependency-free source of truth both halves (host routes / migration and\n * the browser controller) share.\n * @module @linxin666/dsh-client-ui-skin-center/core/background\n */\n\n/** Skin-background preference set persisted in the v2 active state file. */\nexport interface SkinBackgroundConfig {\n /** Master switch for the skin center. */\n enabled?: boolean\n /** Background occlusion 0-100 (0 = no extra veil, 100 = fully obscured). */\n backgroundOpacity?: number\n /** Empty-conversation backdrop blur, 0-20 px (0 disables). */\n backgroundBlurEmpty?: number\n /** With-content backdrop blur, 0-20 px (0 disables). */\n backgroundBlurContent?: number\n /** Composer-card backdrop blur, 0-20 px. */\n inputCardBlur?: number\n /** Message bubble opacity 0-100, for skins exposing bubble alpha. */\n bubbleOpacity?: number\n /** Message-bubble backdrop blur 0-20 px, for skins exposing bubble blur. */\n bubbleBlur?: number\n}\n\n/** Effective value of every field when the state carries none. */\nexport const SKIN_BACKGROUND_DEFAULTS: Readonly<Required<SkinBackgroundConfig>> = {\n enabled: true,\n backgroundOpacity: 0,\n backgroundBlurEmpty: 0,\n backgroundBlurContent: 0,\n inputCardBlur: 10,\n bubbleOpacity: 50,\n bubbleBlur: 10,\n}\n\n/** The fields normalize/sanitize know about; unknown keys are dropped. */\nexport const SKIN_BACKGROUND_FIELDS = Object.keys(SKIN_BACKGROUND_DEFAULTS) as Array<keyof SkinBackgroundConfig>\n\nfunction clampInt(value: number, min: number, max: number): number {\n return Math.max(min, Math.min(max, Math.round(value)))\n}\n\nconst RANGES: Record<Exclude<keyof SkinBackgroundConfig, 'enabled'>, [number, number]> = {\n backgroundOpacity: [0, 100],\n backgroundBlurEmpty: [0, 20],\n backgroundBlurContent: [0, 20],\n inputCardBlur: [0, 20],\n bubbleOpacity: [0, 100],\n bubbleBlur: [0, 20],\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * Lenient normalization for stored/legacy data: unknown keys and wrongly\n * typed fields are dropped, numeric fields are clamped into range. Never\n * fails; a non-object input yields an empty config.\n */\nexport function normalizeSkinBackground(value: unknown): SkinBackgroundConfig {\n if (!isRecord(value)) return {}\n const out: SkinBackgroundConfig = {}\n if (typeof value.enabled === 'boolean') out.enabled = value.enabled\n for (const field of Object.keys(RANGES) as Array<keyof typeof RANGES>) {\n const raw = value[field]\n if (typeof raw !== 'number' || !Number.isFinite(raw)) continue\n const [min, max] = RANGES[field]\n out[field] = clampInt(raw, min, max)\n }\n return out\n}\n\n/**\n * Strict validation for the POST /active write surface: a background value\n * must be an object whose known fields are correctly typed (numbers are then\n * clamped). Returns null for anything else so the route can answer 400.\n */\nexport function sanitizeSkinBackground(value: unknown): SkinBackgroundConfig | null {\n if (!isRecord(value)) return null\n if (value.enabled !== undefined && typeof value.enabled !== 'boolean') return null\n for (const field of Object.keys(RANGES) as Array<keyof typeof RANGES>) {\n const raw = value[field]\n if (raw !== undefined && (typeof raw !== 'number' || !Number.isFinite(raw))) return null\n }\n return normalizeSkinBackground(value)\n}\n\n/** Fill every absent field from {@link SKIN_BACKGROUND_DEFAULTS}. */\nexport function resolveSkinBackground(value: SkinBackgroundConfig | null | undefined): Required<SkinBackgroundConfig> {\n return { ...SKIN_BACKGROUND_DEFAULTS, ...(value ?? {}) }\n}\n\n/** True when at least one field departs from its default (customized data). */\nexport function hasCustomSkinBackground(value: SkinBackgroundConfig): boolean {\n return SKIN_BACKGROUND_FIELDS.some((field) => value[field] !== undefined && value[field] !== SKIN_BACKGROUND_DEFAULTS[field])\n}\n","/**\n * Background-scrim handle for the skin center: applies the chosen occlusion\n * to the page's backdrop, plus an optional per-state Gaussian blur of that\n * backdrop.\n *\n * Occlusion is a CSS variable on `document.body` (--dsw-skin-scrim), which\n * backdrop-painting skins (blue-fantasy / whale-song) read inside their\n * setBackdrop() so the veil stays in sync across theme flips and try-on\n * restores. The official stock look paints no backdrop, so the variable is\n * inert there — the value still persists so it is ready for the next backdrop\n * skin.\n *\n * The Gaussian blur targets the same painted backdrop through a fixed child\n * of `document.body` using backdrop-filter: it samples the body's own\n * background painted behind it. Separate strengths apply to the empty\n * conversation and the conversation-with-content states, detected from the\n * shell's stable message-row class suffixes (hash prefix varies, suffix is\n * stable). When the active blur is 0 no element exists, so there is no GPU\n * cost. Blur never changes the occlusion behavior above.\n *\n * Occlusion values are 0-100 (0 = no extra veil, 100 = fully obscured); they\n * are written through as a 0..1 alpha for the CSS variable. Blur values are\n * 0-20 px. Dragging the controls applies instantly (live).\n *\n * Persistence (issue #996): the controller owns no settings scope — the\n * remote pairing channel fences settings.* as loopback-only, which is what\n * stranded remote clients on defaults. The caller hands in the initial\n * values and a `persist` callback (the v2 /active channel); later external\n * edits (the official settings page locally, the refetched state remotely)\n * arrive through `init()`.\n */\nimport {\n resolveSkinBackground,\n SKIN_BACKGROUND_DEFAULTS,\n type SkinBackgroundConfig,\n} from '../core/background.ts'\n\n/** The namespace string the Host registers (mirrors src/index.ts). */\nexport const SKIN_BACKGROUND_NS = 'skin-background'\n\n/** Field of the background value inside the namespace section. */\nexport const OPACITY_FIELD = 'backgroundOpacity'\n\n/** Field of the empty-conversation backdrop blur inside the namespace section. */\nexport const BLUR_EMPTY_FIELD = 'backgroundBlurEmpty'\n\n/** Field of the with-content backdrop blur inside the namespace section. */\nexport const BLUR_CONTENT_FIELD = 'backgroundBlurContent'\n\n/** Field of the composer card backdrop blur inside the namespace section. */\nexport const INPUT_CARD_BLUR_FIELD = 'inputCardBlur'\n\n/** CSS custom property written to document.body and read by backdrop skins. */\nexport const SCRIM_VAR = '--dsw-skin-scrim'\n\n/** Field of the message bubble opacity inside the namespace section. */\nexport const BUBBLE_OPACITY_FIELD = 'bubbleOpacity'\n\n/** CSS custom property consumed by skins that expose translucent bubbles. */\nexport const BUBBLE_ALPHA_VAR = '--dsh-skin-bubble-alpha'\n\n/** Field of the message bubble blur inside the namespace section. */\nexport const BUBBLE_BLUR_FIELD = 'bubbleBlur'\n\n/** CSS custom property consumed by skins that expose a bubble backdrop blur. */\nexport const BUBBLE_BLUR_VAR = '--dsh-skin-bubble-blur'\n\n/** CSS custom property consumed by the shared composer neutralizer. */\nexport const INPUT_CARD_BLUR_VAR = '--dsh-input-card-blur'\n\n/** Default occlusion (0 = no extra veil) when the section carries none. */\nexport const DEFAULT_OPACITY = SKIN_BACKGROUND_DEFAULTS.backgroundOpacity\n\n/** Default message bubble opacity percentage. */\nexport const DEFAULT_BUBBLE_OPACITY = SKIN_BACKGROUND_DEFAULTS.bubbleOpacity\n\n/** Default message bubble backdrop blur in px. */\nexport const DEFAULT_BUBBLE_BLUR = SKIN_BACKGROUND_DEFAULTS.bubbleBlur\n\n/** Default blur (0 = disabled) when the section carries none. */\nexport const DEFAULT_BLUR = SKIN_BACKGROUND_DEFAULTS.backgroundBlurEmpty\n\n/** The face the skin-center card injects for the background control. */\nexport interface SkinBackgroundHandle {\n /** Current master switch (true when the plugin is on). */\n enabled(): boolean\n /** Toggle + persist the master switch. */\n setEnabled(value: boolean): void\n /** Current occlusion 0-100 (also the getSnapshot seat for useSyncExternalStore). */\n opacity(): number\n /** Current empty-conversation backdrop blur 0-20 px. */\n blurEmpty(): number\n /** Current with-content backdrop blur 0-20 px. */\n blurContent(): number\n /** Current input-card backdrop blur 0-20 px. */\n inputCardBlur(): number\n /** Current message bubble opacity 0-100. */\n bubbleOpacity(): number\n /** Current message bubble backdrop blur 0-20 px. */\n bubbleBlur(): number\n /** Observe a change in the applied values. */\n subscribe(listener: () => void): () => void\n /** Apply + persist a new occlusion. */\n set(opacity: number): void\n /** Apply + persist a new empty-conversation backdrop blur (0-20 px). */\n setBlurEmpty(value: number): void\n /** Apply + persist a new with-content backdrop blur (0-20 px). */\n setBlurContent(value: number): void\n /** Apply + persist a new input-card backdrop blur (0-20 px). */\n setInputCardBlur(value: number): void\n /** Apply + persist a new message bubble opacity (0-100). */\n setBubbleOpacity(value: number): void\n /** Apply + persist a new message bubble backdrop blur (0-20 px). */\n setBubbleBlur(value: number): void\n /** Tear down the blur element and MutationObserver. */\n dispose(): void\n}\n\n/**\n * Selector for a conversation message row inside the shell's center column.\n * Official shell message rows carry `data-chat-anchor-key`; the\n * `data-pane=\"conversation\"` attribute is stamped by the dsh-web-all compat\n * shim on the center column, where the _userRow / _compactionRow /\n * _contextRow / _turnErrorRow suffixes are CSS-module message-row classes\n * (hash prefix varies, suffix is stable).\n */\nconst CONVERSATION_CONTENT_SELECTOR = [\n '[data-chat-anchor-key]',\n '[data-pane=\"conversation\"] [class*=\"_userRow\"]',\n '[data-pane=\"conversation\"] [class*=\"_compactionRow\"]',\n '[data-pane=\"conversation\"] [class*=\"_contextRow\"]',\n '[data-pane=\"conversation\"] [class*=\"_turnErrorRow\"]',\n].join(', ')\n\n/**\n * Own the background preference set: apply the values to the body instantly\n * and persist user edits through the caller-provided channel.\n */\nexport class BackgroundController implements SkinBackgroundHandle {\n private enabledValue = SKIN_BACKGROUND_DEFAULTS.enabled\n private opacityValue = SKIN_BACKGROUND_DEFAULTS.backgroundOpacity\n private blurEmptyValue = SKIN_BACKGROUND_DEFAULTS.backgroundBlurEmpty\n private blurContentValue = SKIN_BACKGROUND_DEFAULTS.backgroundBlurContent\n private inputCardBlurValue = SKIN_BACKGROUND_DEFAULTS.inputCardBlur\n private bubbleOpacityValue = SKIN_BACKGROUND_DEFAULTS.bubbleOpacity\n private bubbleBlurValue = SKIN_BACKGROUND_DEFAULTS.bubbleBlur\n private readonly listeners = new Set<() => void>()\n private readonly persist: (next: SkinBackgroundConfig) => void\n /** The fixed backdrop-filter element, present only while active blur > 0. */\n private blurElement: HTMLDivElement | null = null\n /** Currently applied backdrop-filter blur px (cached to avoid redundant style writes during streaming). */\n private appliedBlur: number | null = null\n /** The body MutationObserver, installed lazily once a blur is active. */\n private observer: MutationObserver | null = null\n /** Pending requestAnimationFrame id for a coalesced recheck. */\n private rafId: number | null = null\n /** Guard: after dispose no scheduled work may reinstall anything. */\n private disposed = false\n\n /**\n * @param initial - values known at construction (the local settings scope\n * snapshot on loopback); null starts from defaults until init() arrives.\n * @param persist - persistence channel for user edits (v2 /active POST).\n */\n constructor(initial: SkinBackgroundConfig | null, persist: (next: SkinBackgroundConfig) => void) {\n this.persist = persist\n if (initial !== null) this.assign(initial)\n this.applyOcclusion()\n this.applyInputCardBlur()\n this.applyBubbleOpacity()\n this.applyBubbleBlur()\n this.syncBlur()\n }\n\n /**\n * Replace the current values with externally sourced ones (the refetched\n * v2 state, or a live settings-scope publish). Never persists — the source\n * already owns the stored copy; the caller decides whether to forward the\n * change into the v2 store.\n */\n init(next: SkinBackgroundConfig | null): void {\n if (this.disposed) return\n this.assign(next ?? {})\n this.applyOcclusion()\n this.applyInputCardBlur()\n this.applyBubbleOpacity()\n this.applyBubbleBlur()\n this.syncBlur()\n this.publish()\n }\n\n /** The current values as a persistable config (every field concrete). */\n snapshot(): SkinBackgroundConfig {\n return {\n enabled: this.enabledValue,\n backgroundOpacity: this.opacityValue,\n backgroundBlurEmpty: this.blurEmptyValue,\n backgroundBlurContent: this.blurContentValue,\n inputCardBlur: this.inputCardBlurValue,\n bubbleOpacity: this.bubbleOpacityValue,\n bubbleBlur: this.bubbleBlurValue,\n }\n }\n\n enabled = (): boolean => this.enabledValue\n\n setEnabled(value: boolean): void {\n this.enabledValue = value\n this.applyOcclusion()\n this.applyInputCardBlur()\n this.applyBubbleOpacity()\n this.applyBubbleBlur()\n this.syncBlur()\n this.publish()\n this.persist(this.snapshot())\n }\n\n opacity = (): number => this.opacityValue\n\n blurEmpty = (): number => this.blurEmptyValue\n\n blurContent = (): number => this.blurContentValue\n\n inputCardBlur = (): number => this.inputCardBlurValue\n\n bubbleOpacity = (): number => this.bubbleOpacityValue\n\n bubbleBlur = (): number => this.bubbleBlurValue\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n }\n\n set(opacity: number): void {\n this.opacityValue = this.clampPercent(opacity)\n this.applyOcclusion()\n this.publish()\n this.persist(this.snapshot())\n }\n\n setBlurEmpty(value: number): void {\n this.blurEmptyValue = this.clampBlur(value)\n this.ensureObserver()\n this.syncBlur()\n this.publish()\n this.persist(this.snapshot())\n }\n\n setBlurContent(value: number): void {\n this.blurContentValue = this.clampBlur(value)\n this.ensureObserver()\n this.syncBlur()\n this.publish()\n this.persist(this.snapshot())\n }\n\n setInputCardBlur(value: number): void {\n this.inputCardBlurValue = this.clampBlur(value)\n this.applyInputCardBlur()\n this.publish()\n this.persist(this.snapshot())\n }\n\n setBubbleOpacity(value: number): void {\n this.bubbleOpacityValue = this.clampPercent(value)\n this.applyBubbleOpacity()\n this.publish()\n this.persist(this.snapshot())\n }\n\n setBubbleBlur(value: number): void {\n this.bubbleBlurValue = this.clampBlur(value)\n this.applyBubbleBlur()\n this.publish()\n this.persist(this.snapshot())\n }\n\n dispose(): void {\n this.disposed = true\n if (this.rafId !== null) {\n cancelAnimationFrame(this.rafId)\n this.rafId = null\n }\n this.removeBlurElement()\n document.body.style.removeProperty(INPUT_CARD_BLUR_VAR)\n document.body.style.removeProperty(BUBBLE_ALPHA_VAR)\n document.body.style.removeProperty(BUBBLE_BLUR_VAR)\n if (this.observer !== null) {\n this.observer.disconnect()\n this.observer = null\n }\n }\n\n /** Copy one config into the live fields, defaults filling the gaps. */\n private assign(config: SkinBackgroundConfig): void {\n const resolved = resolveSkinBackground(config)\n this.enabledValue = resolved.enabled\n this.opacityValue = resolved.backgroundOpacity\n this.blurEmptyValue = resolved.backgroundBlurEmpty\n this.blurContentValue = resolved.backgroundBlurContent\n this.inputCardBlurValue = resolved.inputCardBlur\n this.bubbleOpacityValue = resolved.bubbleOpacity\n this.bubbleBlurValue = resolved.bubbleBlur\n }\n\n private clampBlur(value: number): number {\n return Math.max(0, Math.min(20, Math.round(value)))\n }\n\n private clampPercent(value: number): number {\n return Math.max(0, Math.min(100, Math.round(value)))\n }\n\n private applyInputCardBlur(): void {\n if (!this.enabledValue) {\n document.body.style.removeProperty(INPUT_CARD_BLUR_VAR)\n return\n }\n document.body.style.setProperty(INPUT_CARD_BLUR_VAR, this.inputCardBlurValue + 'px')\n }\n\n private applyBubbleOpacity(): void {\n if (!this.enabledValue) {\n document.body.style.removeProperty(BUBBLE_ALPHA_VAR)\n return\n }\n document.body.style.setProperty(BUBBLE_ALPHA_VAR, String(this.bubbleOpacityValue / 100))\n }\n\n private applyBubbleBlur(): void {\n if (!this.enabledValue) {\n document.body.style.removeProperty(BUBBLE_BLUR_VAR)\n return\n }\n document.body.style.setProperty(BUBBLE_BLUR_VAR, this.bubbleBlurValue + 'px')\n }\n\n /** Write the current occlusion onto the body CSS variable (0..1 alpha). */\n private applyOcclusion(): void {\n if (!this.enabledValue) {\n document.body.style.removeProperty(SCRIM_VAR)\n return\n }\n document.body.style.setProperty(SCRIM_VAR, String(this.opacityValue / 100))\n }\n\n /**\n * Apply the active blur: empty or with-content strength depending on the\n * conversation state. A value > 0 ensures the fixed blur element exists\n * with the matching backdrop-filter; 0 removes it.\n */\n private syncBlur(): void {\n if (this.disposed) return\n if (this.hasExternalWallpaper()) {\n // The delegated wallpaper plugin paints its own glass over its own\n // backdrop, and this layer would sample a shell that plugin relaid\n // (issue #39). Both the layer and the skin it belongs to stand down\n // while that plugin renders.\n this.removeBlurElement()\n return\n }\n if (!this.enabledValue) {\n this.removeBlurElement()\n return\n }\n this.ensureObserver()\n const active = this.hasConversationContent() ? this.blurContentValue : this.blurEmptyValue\n if (active > 0) this.ensureBlurElement(active)\n else this.removeBlurElement()\n }\n\n /** True when the conversation pane hosts at least one message row. */\n private hasConversationContent(): boolean {\n return document.querySelector(CONVERSATION_CONTENT_SELECTOR) !== null\n }\n\n /**\n * True while the delegated Wallpaper Engine plugin renders a wallpaper.\n *\n * The marker is the plugin's own stable `body` attribute (issue #39); this\n * layer reads it, never writes it.\n */\n private hasExternalWallpaper(): boolean {\n return document.body?.hasAttribute('data-we-wallpaper') === true\n }\n\n /** Create (if needed) and size the fixed backdrop-filter element. */\n private ensureBlurElement(active: number): void {\n if (this.blurElement === null) {\n const element = document.createElement('div')\n element.style.position = 'fixed'\n element.style.inset = '0'\n element.style.zIndex = '-1'\n element.style.pointerEvents = 'none'\n element.setAttribute('aria-hidden', 'true')\n this.blurElement = element\n document.body.appendChild(element)\n this.appliedBlur = null\n }\n if (this.appliedBlur === active) return\n this.appliedBlur = active\n const blur = 'blur(' + active + 'px)'\n this.blurElement.style.backdropFilter = blur\n // Safari: the vendor-prefixed form is only reachable via setProperty.\n this.blurElement.style.setProperty('-webkit-backdrop-filter', blur)\n }\n\n /** Remove the fixed blur element, if present. */\n private removeBlurElement(): void {\n if (this.blurElement === null) return\n this.blurElement.remove()\n this.blurElement = null\n this.appliedBlur = null\n }\n\n /**\n * Install the MutationObserver on document.body only when either blur\n * field is active, so a fully-disabled blur never pays the observation\n * cost. Runs lazily on the first non-zero set.\n */\n private ensureObserver(): void {\n if (this.disposed || this.observer !== null) return\n if (this.blurEmptyValue <= 0 && this.blurContentValue <= 0) return\n this.observer = new MutationObserver(() => this.scheduleRecheck())\n // ONE registration, both triggers. Two observe() calls on the same node\n // would REPLACE each other: the second options object drops `subtree`, so\n // the conversation-row watch would silently stop firing. The class filter\n // covers the row flips and the external marker covers the wallpaper.\n this.observer.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['class', 'data-we-wallpaper'],\n })\n }\n\n /** Coalesce burst mutations into one rAF-delayed recheck. */\n private scheduleRecheck(): void {\n if (this.disposed || this.rafId !== null) return\n this.rafId = requestAnimationFrame(() => {\n this.rafId = null\n if (this.disposed) return\n this.syncBlur()\n })\n }\n\n private publish(): void {\n for (const listener of this.listeners) listener()\n }\n}\n","/**\n * Safe reconciliation helpers for the legacy skin-background settings scope.\n *\n * The scope's resolved value contains schema defaults, while its raw user layer\n * contains only fields explicitly stored by the user. The v2 active-state\n * document is authoritative, so a scope update may merge only those raw fields\n * into the live background values.\n */\nimport {\n normalizeSkinBackground,\n SKIN_BACKGROUND_FIELDS,\n type SkinBackgroundConfig,\n} from './background.ts'\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/** Return the known, explicitly stored skin-background fields from a user layer. */\nexport function extractSkinBackgroundUserLayer(value: unknown): SkinBackgroundConfig | null {\n if (!isRecord(value)) return null\n const normalized = normalizeSkinBackground(value)\n const knownFields = Object.keys(normalized) as Array<keyof SkinBackgroundConfig>\n if (knownFields.length === 0) return null\n const owned: SkinBackgroundConfig = {}\n for (const field of knownFields) {\n ;(owned as Record<string, unknown>)[field] = normalized[field]\n }\n return owned\n}\n\n/**\n * Build a v2-safe patch from the raw user layer. Absent fields, including\n * schema-default fields absent from the user layer, never enter the patch.\n */\nexport function skinBackgroundUserPatch(current: SkinBackgroundConfig, user: unknown): SkinBackgroundConfig | null {\n const userConfig = extractSkinBackgroundUserLayer(user)\n if (userConfig === null) return null\n const patch: SkinBackgroundConfig = {}\n for (const field of SKIN_BACKGROUND_FIELDS) {\n if (!Object.hasOwn(userConfig, field)) continue\n const value = userConfig[field]\n if (value === undefined || value === current[field]) continue\n ;(patch as Record<string, unknown>)[field] = value\n }\n return Object.keys(patch).length === 0 ? null : patch\n}\n\nexport interface SkinBackgroundScopeSnapshot {\n revision: number | undefined\n user: unknown\n}\n\nexport interface SkinBackgroundScopeReconcileResult {\n accepted: boolean\n revision: number | undefined\n lastUserJson: string\n patch: SkinBackgroundConfig | null\n}\n\n/** Deterministic serialization of the user layer for content-based dedup. */\nexport function serializeSkinBackgroundUserLayer(user: unknown): string {\n const extracted = extractSkinBackgroundUserLayer(user)\n return extracted === null ? '' : JSON.stringify(extracted)\n}\n\n/**\n * Full reconciliation state the browser glue keeps across scope publications.\n * It adds boot ordering to the revision/content fence so the settings\n * document's initial sync can never be mistaken for a settings-page edit\n * (#1375): a legacy user layer carrying stale explicit values (zeros written\n * by the pre-#1107 bug family) would otherwise patch — and persist over — the\n * authoritative v2 state on every boot where the document and the v2 GET\n * finish in the unlucky order.\n */\nexport interface SkinBackgroundReconcileState {\n /** Whether the authoritative v2 GET has completed and applied its values. */\n v2Loaded: boolean\n /** Whether the one-shot boot document sync (first revisioned publication) was consumed. */\n bootSyncSeen: boolean\n /** Last namespace revision seen (published, or seeded at construction). */\n lastRevision: number | undefined\n /** Serialized user layer seen last, for content-based replay dedup. */\n lastUserJson: string\n}\n\n/** Seed the reconcile state from the scope snapshot visible at construction. */\nexport function initialSkinBackgroundReconcileState(\n snapshot: SkinBackgroundScopeSnapshot,\n): SkinBackgroundReconcileState {\n return {\n v2Loaded: false,\n bootSyncSeen: false,\n lastRevision: snapshot.revision,\n lastUserJson: serializeSkinBackgroundUserLayer(snapshot.user),\n }\n}\n\n/**\n * Fold one scope publication into the reconcile state and produce the v2-safe\n * patch to merge into the live background values (null = nothing to apply).\n *\n * The boot document never merges, whichever order it lands in:\n * - a publication seen before the v2 GET completes is only recorded, so the\n * post-load check reads it as the unchanged boot snapshot, not an edit;\n * - the first revisioned publication of the plugin's lifetime (the document\n * resync itself) is consumed as the boot sync even when it lands after the\n * GET, because a genuine settings-page edit can only follow the document.\n */\nexport function reconcileSkinBackgroundPublication(\n state: SkinBackgroundReconcileState,\n current: SkinBackgroundConfig,\n snapshot: SkinBackgroundScopeSnapshot,\n): { state: SkinBackgroundReconcileState; patch: SkinBackgroundConfig | null } {\n const seen: SkinBackgroundReconcileState = {\n ...state,\n lastRevision: snapshot.revision ?? state.lastRevision,\n lastUserJson: serializeSkinBackgroundUserLayer(snapshot.user),\n }\n if (!state.v2Loaded) return { state: seen, patch: null }\n if (!state.bootSyncSeen) {\n return {\n state: snapshot.revision === undefined ? seen : { ...seen, bootSyncSeen: true },\n patch: null,\n }\n }\n const result = reconcileSkinBackgroundScope(current, snapshot, state.lastRevision, state.lastUserJson)\n return { state: seen, patch: result.patch }\n}\n\n/**\n * Accept a scope publication only when its namespace revision is new AND the\n * user layer has actually changed. A revision bump with identical user-layer\n * content is a replay (settings-mirror resync, WS reconnect, or another\n * plugin writing to the global settings document) and must not overwrite the\n * authoritative v2 state.\n */\nexport function reconcileSkinBackgroundScope(\n current: SkinBackgroundConfig,\n snapshot: SkinBackgroundScopeSnapshot,\n lastRevision: number | undefined,\n lastUserJson: string | undefined,\n): SkinBackgroundScopeReconcileResult {\n const currentUserJson = serializeSkinBackgroundUserLayer(snapshot.user)\n if (\n snapshot.revision === undefined\n || snapshot.revision === lastRevision\n || currentUserJson === lastUserJson\n || currentUserJson === ''\n ) {\n return {\n accepted: false,\n revision: snapshot.revision ?? lastRevision,\n lastUserJson: currentUserJson,\n patch: null,\n }\n }\n return {\n accepted: true,\n revision: snapshot.revision,\n lastUserJson: currentUserJson,\n patch: skinBackgroundUserPatch(current, snapshot.user),\n }\n}\n","/**\n * First-screen handoff contract with the delegated wallpaper plugin (issue #51).\n *\n * The browser's first paint is decided by the delivered document, and the\n * delegated plugin's `body[data-we-wallpaper]` marker only exists after its\n * own client chain has run. The host half therefore withholds the skin from\n * the document when the peer's persisted selection names a wallpaper, and\n * stamps this attribute so the browser half knows the withholding was a\n * PREDICTION rather than an observed verdict.\n *\n * The attribute is a first-screen prediction, never a verdict: it stands down\n * the skin for the window in which the peer's marker is expected to arrive, and\n * then expires on its own (see\n * src/client/runtime/external-wallpaper-engine.ts). The marker remains the only\n * thing that decides the page once the peer has spoken.\n *\n * Shared by both halves of this package (host stamps it, browser reads it), so\n * it lives in `core/` rather than in either runtime.\n * @module @linxin666/dsh-client-ui-skin-center/core/wallpaper-handoff\n */\n\n/**\n * The `<html>` attribute the host stamps when it withheld the skin from a\n * document because the delegated wallpaper plugin's persisted selection says a\n * wallpaper is about to render. Presence means \"the skin is withheld for a\n * predicted wallpaper\"; the value carries nothing.\n */\nexport const WALLPAPER_EXPECTED_ATTR = 'data-dsh-wallpaper-expected'\n\n/**\n * How long a first-screen prediction stands down the skin before it expires on\n * its own.\n *\n * The prediction covers exactly one window: the peer's client chain resolving\n * its persisted selection and stamping its marker, measured at roughly\n * 300ms-1s. This is the same bounded hand-back window the user-initiated\n * stage claim uses (USER_INITIATED_YIELD_GRACE_MS in skin-controller.ts), for\n * the same reason: the peer's answer is the live marker, and this only has to\n * cover the round trip to it.\n *\n * Expiry is what keeps a wrong prediction from stranding the page. A wallpaper\n * that never renders (a broken file, a decode failure) never stamps the\n * marker, so the window is the only thing standing between that user and their\n * skin. When it closes, the boot activation paints the remembered selection.\n */\nexport const PREDICTED_WALLPAPER_GRACE_MS = 1500\n","/**\n * External Wallpaper Engine plugin interop (issue #39, migration round).\n *\n * The skin center no longer ships a Wallpaper Engine bridge: wallpaper support\n * is delegated to `dsh-plugin-wallpaper-engine`, which owns the WE library,\n * the wallpaper rendering and the theme follows the wallpaper. That plugin\n * signals an active wallpaper on the document itself with the stable\n * `body[data-we-wallpaper]` attribute (it stamps the attribute while a\n * wallpaper renders and removes it when playback stops).\n *\n * While that attribute is present the skin center stands its own visual work\n * down, so the wallpaper owns the backdrop:\n *\n * - the composer frost follower is not mounted (the wallpaper plugin paints\n * its own glass, and two fixed `backdrop-filter` stacks sample a shell the\n * other one relaid);\n * - the skin manifest's `backgroundMedia` is not painted, so the wallpaper is\n * never covered by skin art (this replaces the old in-house priority rule);\n * - the active skin keeps its token remaps and patches, which remain correct\n * over a wallpaper because every skin already yields its opaque plates to\n * `body[data-we-wallpaper]` (see the catalog skins and\n * contracts/semantic-attrs-v1.md).\n *\n * The watcher is attribute-only and read-only: it never writes the other\n * plugin's marker, never mounts a layer of its own, and reports through a\n * plain callback so the two consumers (the skin controller's background-media\n * gate and the scene marker) stay independent.\n * @module @linxin666/dsh-client-ui-skin-center/runtime/external-wallpaper-engine\n */\n\nimport { WALLPAPER_EXPECTED_ATTR } from '../../core/wallpaper-handoff.ts'\n\n/**\n * The stable attribute `dsh-plugin-wallpaper-engine` stamps on `body` while a\n * wallpaper is rendering. This is the plugin's public interop contract, the\n * same one other third-party plugins key on.\n */\nexport const EXTERNAL_WE_ACTIVE_ATTR = 'data-we-wallpaper'\n\n/** The element the attribute is stamped on. */\nexport const EXTERNAL_WE_ACTIVE_TARGET = 'body'\n\n/** True when the external wallpaper plugin currently renders a wallpaper. */\nexport function externalWallpaperEngineActive(doc: Document): boolean {\n return doc.body?.hasAttribute(EXTERNAL_WE_ACTIVE_ATTR) === true\n}\n\n/**\n * True when the host withheld this document's skin for a PREDICTED wallpaper\n * (issue #51), and no marker has arrived yet to confirm or deny it.\n *\n * This is what closes the second half of the flash. The host can pre-judge the\n * first screen from the peer's persisted selection, but the browser half boots\n * asynchronously: with no stamp in the document it recovers the selection from\n * GET /active and activates it, which is exactly the switch that would paint a\n * frame of skin into the gap the host just left. The prediction is what tells\n * that switch to stand down until the peer's marker speaks.\n *\n * It expires (see {@link releasePrediction}) rather than standing forever: a\n * wallpaper that never renders must not keep the user off their own skin.\n * @param doc - the document the host stamped.\n * @returns true while a prediction is outstanding.\n */\nexport function externalWallpaperPredicted(doc: Document): boolean {\n return doc.documentElement?.hasAttribute(WALLPAPER_EXPECTED_ATTR) === true\n}\n\n/**\n * Drop the host's prediction from the document, so a later read reports none.\n *\n * Called once the peer's marker has answered (either way) or the grace window\n * has closed. The attribute is this package's own - the host half stamped it\n * and no other plugin reads it - so clearing it here only ends this package's\n * own first-screen bookkeeping and never touches the peer's marker.\n * @param doc - the document the host stamped.\n */\nexport function releasePrediction(doc: Document): void {\n doc.documentElement?.removeAttribute(WALLPAPER_EXPECTED_ATTR)\n}\n\n/**\n * Observe the external plugin's active marker.\n *\n * The callback fires once immediately with the current state (so a page that\n * boots with a wallpaper already rendering never paints a frame of skin art\n * first), then on every flip while the returned teardown is live.\n *\n * @param doc - the document whose `body` carries the marker.\n * @param listener - called with the new state on every change.\n * @returns the idempotent teardown.\n */\nexport function watchExternalWallpaperEngine(\n doc: Document,\n listener: (active: boolean) => void,\n): () => void {\n let last = false\n let stopped = false\n\n const read = (): boolean => externalWallpaperEngineActive(doc)\n\n const report = (): void => {\n if (stopped) return\n const next = read()\n if (next === last) return\n last = next\n listener(next)\n }\n\n // Wrapped in a try/catch by construction: an unknown attribute at boot is\n // simply \"not active\", never an error path.\n try {\n last = read()\n listener(last)\n } catch {\n // An unreadable body (a detached document) leaves the default: inactive.\n }\n\n const win = doc.defaultView\n if (win === null || typeof win.MutationObserver !== 'function') {\n return () => { stopped = true }\n }\n const observer = new win.MutationObserver(report)\n observer.observe(doc.body ?? doc.documentElement, {\n attributes: true,\n attributeFilter: [EXTERNAL_WE_ACTIVE_ATTR],\n })\n return () => {\n stopped = true\n observer.disconnect()\n }\n}\n","/**\n * Delegated theme interop: is the plugin that owns a delegated skin's visual\n * actually on this page, and can it give the page back?\n *\n * A delegated skin (src/core/delegated-skins.ts) is selected, persisted and\n * adopted exactly like an asset skin, but this package paints none of it: the\n * delegated plugin mounts its own bundle from its own client chain. Two\n * attributes on the document say what it is doing, and both are its own public\n * contract. This module reads them; it never writes them.\n *\n * body[data-dsh-claude-style] the plugin is live: its stylesheet is\n * mounted and its body attributes are\n * stamped. The value is its build id.\n * body[data-dsh-claude-style-handoff] the running build watches for an\n * external owner and stands down when\n * one appears. Its PRESENCE is the\n * capability: a build without it\n * cannot yield, so the card must not\n * let the user select this skin and\n * then pick another one over it.\n *\n * Why the capability matters: the two packages repaint the same shell. If this\n * package stamped html[data-dsh-skin] while the peer kept painting, the result\n * is the degraded-glass, double-backdrop-filter page the Wallpaper Engine\n * delegation was built to end. Refusing to offer the row is the honest answer\n * on an old build; the fix belongs in the plugin, not in a skin-center\n * workaround.\n *\n * Attribute-only and read-only, exactly like the wallpaper interop next to it\n * (runtime/external-wallpaper-engine.ts): one MutationObserver over the known\n * attributes, a callback on every flip, and nothing else.\n * @module @linxin666/dsh-client-ui-skin-center/runtime/delegated-theme\n */\n\n/** What one delegated plugin is doing on this page. */\nexport interface DelegatedThemeState {\n /** True while the plugin stamps its own body attribute (it is live). */\n live: boolean\n /** True while the plugin advertises that it can stand down for an owner. */\n canYield: boolean\n}\n\n/** The attributes one delegated plugin owns, as its descriptor names them. */\nexport interface DelegatedThemeMarkers {\n /** The plugin's own live marker on body. */\n bodyAttr: string\n /** The plugin's handoff-capability marker on body. */\n handoffAttr: string\n}\n\n/**\n * Read one delegated plugin's state from the document.\n * @param doc - the document the plugin stamps.\n * @param markers - the two attributes that plugin owns.\n * @returns whether it is live, and whether it can stand down.\n */\nexport function delegatedThemeState(\n doc: Document,\n markers: DelegatedThemeMarkers,\n): DelegatedThemeState {\n const body = doc.body\n if (body === null) return { live: false, canYield: false }\n return {\n live: body.hasAttribute(markers.bodyAttr),\n canYield: body.hasAttribute(markers.handoffAttr),\n }\n}\n\n/**\n * Observe one delegated plugin's markers.\n *\n * The callback fires once immediately with the current state, so a page that\n * boots while the plugin is already live never renders a row that claims it is\n * not, then on every flip while the returned teardown is live.\n *\n * @param doc - the document whose body carries the markers.\n * @param markers - the two attributes that plugin owns.\n * @param listener - called with the new state on every change.\n * @returns the idempotent teardown.\n */\nexport function watchDelegatedTheme(\n doc: Document,\n markers: DelegatedThemeMarkers,\n listener: (state: DelegatedThemeState) => void,\n): () => void {\n let last: DelegatedThemeState | null = null\n let stopped = false\n\n const report = (): void => {\n if (stopped) return\n const next = delegatedThemeState(doc, markers)\n if (last !== null && next.live === last.live && next.canYield === last.canYield) return\n last = next\n listener(next)\n }\n\n try {\n last = delegatedThemeState(doc, markers)\n listener(last)\n } catch {\n // A detached document (no body yet) leaves the default: not live.\n last = { live: false, canYield: false }\n }\n\n const win = doc.defaultView\n if (win === null || typeof win.MutationObserver !== 'function') {\n return () => { stopped = true }\n }\n const observer = new win.MutationObserver(report)\n const target = doc.body ?? doc.documentElement\n if (target !== null) {\n observer.observe(target, {\n attributes: true,\n attributeFilter: [markers.bodyAttr, markers.handoffAttr],\n })\n }\n return () => {\n stopped = true\n observer.disconnect()\n }\n}\n","/**\n * External Wallpaper Engine plugin probe (issue #39, migration round).\n *\n * Wallpaper support no longer ships inside the skin center: it is delegated to\n * `dsh-plugin-wallpaper-engine`, which owns the WE library scan, the video /\n * web / scene rendering paths, the wallpaper settings surface and the theme\n * that follows the wallpaper. The skin center keeps only the skin side, and\n * interoperates with that plugin through its public document marker\n * `body[data-we-wallpaper]` (see\n * src/client/runtime/external-wallpaper-engine.ts).\n *\n * This module is the READ-ONLY half of that relationship: it reports whether\n * the external plugin is installed in this profile, so the card can point the\n * user at it instead of offering a wallpaper feature of its own. It never\n * installs, removes, disables or rewrites anything; installation is the user's,\n * performed through the official plugin manager.\n *\n * The reads themselves are the shared profile probe\n * (core/profile-plugin-probe.ts), which the delegated-skin registry asks the\n * same questions. This file keeps the wallpaper-specific constants, the report\n * shape, and the peer's own persisted selection read.\n *\n * That persisted read is the FIRST-SCREEN prediction (issue #51). The runtime\n * withholds the skin off `body[data-we-wallpaper]`, which that plugin stamps\n * from its own client chain a few hundred milliseconds into the boot - later\n * than the browser's first paint, which the document itself decides. So the\n * first screen would paint the skin and then cut to the wallpaper, and this\n * package reads the peer's own persisted selection synchronously to pre-judge\n * the first screen instead. The prediction is exactly that: the runtime still\n * decides on the marker, and a prediction the peer never confirms costs one\n * extra stylesheet fetch when the boot activation repaints the skin.\n * @module @linxin666/dsh-client-ui-skin-center/external-wallpaper\n */\n\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nimport {\n SIGNAL_CORDIS_ROW,\n SIGNAL_PROFILE_DEPENDENCY,\n detectProfilePlugin,\n manifestNamesPlugin,\n patchNamesPlugin,\n profilePluginPaths,\n readJsonIfFile,\n type ProfilePluginPaths,\n} from './core/profile-plugin-probe.ts'\nimport { firstNonBlank } from './harness-home.ts'\n\n/** The delegated wallpaper plugin this package interoperates with. */\nexport const EXTERNAL_WE_PLUGIN = 'dsh-plugin-wallpaper-engine'\n\n/** Upstream repository of the delegated plugin (install + docs pointer). */\nexport const EXTERNAL_WE_REPO = 'https://github.com/elysia395/dsh-wallpaper-engine'\n\n/** The install command the card shows when the plugin is missing. */\nexport const EXTERNAL_WE_INSTALL_COMMAND = 'dsh plugin --profile web add ' + EXTERNAL_WE_PLUGIN\n\n/** What the probe found, and which signal found it. */\nexport interface ExternalWallpaperReport {\n /** True when the delegated plugin is installed in this profile. */\n installed: boolean\n /** The signal names that matched, in report order. Empty when not installed. */\n signals: string[]\n /** The delegated plugin's package name (always present). */\n packageName: string\n /** Upstream repository URL, so the card can link install and docs. */\n repository: string\n /** The exact install command to show the user. */\n installCommand: string\n /** The npm package spec the card hands to the plugin manager. */\n npm: string\n}\n\nexport { SIGNAL_CORDIS_ROW, SIGNAL_PROFILE_DEPENDENCY }\n\n/**\n * Whether a package.json dependency map names the delegated plugin.\n *\n * Matched by key only: a `link:`, a `file:`, a caret range and a bare tag all\n * put the same key in the map, and the version range is not this probe's\n * business.\n * @param manifest - parsed profile package.json, or null.\n * @param packageName - the package to look for (defaults to the delegated one).\n * @returns true when any dependency section names the plugin.\n */\nexport function manifestNamesExternalWallpaper(\n manifest: Record<string, unknown> | null,\n packageName: string = EXTERNAL_WE_PLUGIN,\n): boolean {\n return manifestNamesPlugin(manifest, packageName)\n}\n\n/**\n * Whether a cordis patch layer activates a row naming the delegated plugin.\n *\n * The row form is `name: 'dsh-plugin-wallpaper-engine'` under an insert list\n * or an id-targeted override; both spell the same package string, so the probe\n * looks for the package name as a quoted or bare scalar. A DISABLED row still\n * means the plugin is installed and wired (the loader keeps it mounted as\n * inactive), which is a real installation the card must not offer to install\n * again.\n * @param patch - raw cordis.patch.yml text, or null.\n * @param packageName - the package to look for (defaults to the delegated one).\n * @returns true when the text names the plugin.\n */\nexport function patchNamesExternalWallpaper(\n patch: string | null,\n packageName: string = EXTERNAL_WE_PLUGIN,\n): boolean {\n return patchNamesPlugin(patch, packageName)\n}\n\n/** Paths the probe reads, resolved once. */\nexport type ExternalWallpaperPaths = ProfilePluginPaths\n\n/**\n * Resolve the files the probe reads for a harness home / profile pair. The\n * profile patch comes first, then the harness-home patch layer, then the\n * profile's own composition file, so an install written by any of the\n * manager's paths is seen.\n * @param options - explicit harness home / profile (tests), else the live layout.\n * @returns the paths, whether or not they exist.\n */\nexport function externalWallpaperPaths(\n options: { home?: string; profile?: string } = {},\n): ExternalWallpaperPaths {\n return profilePluginPaths(options)\n}\n\n/**\n * Probe this profile for the delegated Wallpaper Engine plugin.\n *\n * Never throws: an unreadable or missing input is \"no signal\" and the report\n * simply says not installed. The probe only reads.\n * @param options - explicit harness home / profile (tests), else the live layout.\n * @returns the report the card and the API render.\n */\nexport function detectExternalWallpaperEngine(\n options: { home?: string; profile?: string } = {},\n): ExternalWallpaperReport {\n const probe = detectProfilePlugin(EXTERNAL_WE_PLUGIN, options)\n return {\n installed: probe.installed,\n signals: probe.signals,\n packageName: EXTERNAL_WE_PLUGIN,\n repository: EXTERNAL_WE_REPO,\n installCommand: EXTERNAL_WE_INSTALL_COMMAND,\n // The registry name and the install spec are the same string for this\n // package; it stays its own field so a pinned dist-tag can diverge later.\n npm: EXTERNAL_WE_PLUGIN,\n }\n}\n\n/** Environment variable the peer's own host reads its data directory from. */\nexport const EXTERNAL_WE_DATA_DIR_ENV = 'DSH_WE_DATA_DIR'\n\n/** The peer's default data directory, under the user's home. */\nexport const EXTERNAL_WE_DEFAULT_DATA_DIR = '.dsh-wallpaper-engine'\n\n/** The file that directory carries, where the peer persists its selection. */\nexport const EXTERNAL_WE_CONFIG_FILE = 'config.json'\n\n/**\n * The peer's data directory: its own `$DSH_WE_DATA_DIR` override when set, and\n * the documented default under the user's home otherwise. The host file is the\n * only source of truth for the selection; this override moves where it lives\n * and changes nothing else.\n * @param env - the environment to read (tests), else this process's.\n * @returns an absolute directory path.\n */\nexport function externalWallpaperDataDir(env: NodeJS.ProcessEnv = process.env): string {\n return firstNonBlank(env[EXTERNAL_WE_DATA_DIR_ENV]) ?? join(homedir(), EXTERNAL_WE_DEFAULT_DATA_DIR)\n}\n\n/**\n * The persisted-selection file the first-screen prediction reads.\n * @param env - the environment to read (tests), else this process's.\n * @returns an absolute file path, whether or not it exists.\n */\nexport function externalWallpaperConfigPath(env: NodeJS.ProcessEnv = process.env): string {\n return join(externalWallpaperDataDir(env), EXTERNAL_WE_CONFIG_FILE)\n}\n\n/**\n * Whether the peer's persisted selection names a wallpaper (issue #51).\n *\n * `settings.id` is that plugin's stable contract: its host owns the file and\n * writes the chosen wallpaper into it, so a non-empty id means the wallpaper is\n * what the next page load is about to bring up. Reading it synchronously is\n * what lets the first screen already be the wallpaper.\n *\n * This is a FIRST-SCREEN pre-judgment, not a second source of truth. The\n * runtime still decides on `body[data-we-wallpaper]`, which is the live\n * verdict, so a prediction the peer never confirms (a wallpaper that fails to\n * render and takes its marker with it) costs one stylesheet fetch when the\n * boot activation repaints the skin. It is therefore fail-OPEN toward the\n * skin: an absent, unreadable or malformed file means \"no wallpaper\", never a\n * reason to withhold the skin the user selected.\n * @param env - the environment to read (tests), else this process's.\n * @returns true when a wallpaper is persisted.\n */\nexport function persistedExternalWallpaperActive(env: NodeJS.ProcessEnv = process.env): boolean {\n try {\n const config = readJsonIfFile(externalWallpaperConfigPath(env))\n if (config === null) return false\n const settings = config.settings\n if (typeof settings !== 'object' || settings === null || Array.isArray(settings)) return false\n const id = (settings as Record<string, unknown>).id\n return typeof id === 'string' && id.trim() !== ''\n } catch {\n // Fail toward the skin: an unreadable peer file must not cost a user\n // their skin.\n return false\n }\n}\n","/**\n * Skin-center locale dictionaries. The plugin-card name, its description,\n * and every control of the in-GUI skin center is localized through the\n * standard `t` seat.\n */\n\n/** Copy keys owned by this plugin. */\nexport type SkinCenterKey =\n | 'title'\n | 'cardDescription'\n | 'externalWallpaperReadyTitle'\n | 'externalWallpaperReadyBody'\n | 'externalWallpaperMissingTitle'\n | 'externalWallpaperMissingBody'\n | 'externalWallpaperLink'\n | 'externalWallpaperRecommended'\n | 'externalWallpaperInstall'\n | 'externalWallpaperInstalling'\n | 'externalWallpaperCopyCommand'\n | 'externalWallpaperCopied'\n | 'externalWallpaperInstallFailed'\n | 'delegatedSkinBadge'\n | 'delegatedSkinDescriptionClaudeStyle'\n | 'delegatedSkinNotRunning'\n | 'delegatedSkinManage'\n | 'delegatedSkinNoHandoff'\n | 'delegatedSkinInstall'\n | 'delegatedSkinInstalling'\n | 'delegatedSkinInstallFailed'\n | 'delegatedSkinDescriptorMismatch'\n | 'delegatedSkinLink'\n | 'stoodDownTitle'\n | 'stoodDownBody'\n | 'enabled'\n | 'enabledHint'\n | 'offNote'\n | 'intro'\n | 'official'\n | 'officialTagline'\n | 'active'\n | 'tryingOn'\n | 'tryOn'\n | 'loading'\n | 'exitTryOn'\n | 'apply'\n | 'applying'\n | 'restore'\n | 'applyFailed'\n | 'appliedUnconfirmed'\n | 'appliedNeedRestart'\n | 'theme'\n | 'themeLight'\n | 'themeDark'\n | 'tryOnError'\n | 'backgroundOpacity'\n | 'backgroundBlurEmpty'\n | 'backgroundBlurContent'\n | 'inputCardBlur'\n | 'inputCardBlurHint'\n | 'bubbleOpacity'\n | 'bubbleOpacityHint'\n | 'bubbleBlur'\n | 'bubbleBlurHint'\n | 'backgroundBlurHint'\n | 'backgroundBlurInert'\n | 'backgroundHint'\n | 'backgroundHintInert'\n | 'wallpaperTitle'\n | 'wallpaperEnable'\n | 'wallpaperHint'\n | 'wallpaperLoadError'\n | 'wallpaperLibraryFound'\n | 'wallpaperLibraryManual'\n | 'wallpaperRefresh'\n | 'wallpaperMode'\n | 'wallpaperModeLive'\n | 'wallpaperModeFrame'\n | 'wallpaperFit'\n | 'wallpaperFitCover'\n | 'wallpaperFitContain'\n | 'wallpaperFitFill'\n | 'wallpaperClear'\n | 'wallpaperDim'\n | 'wallpaperOpacity'\n | 'wallpaperBlur'\n | 'wallpaperPauseHidden'\n | 'wallpaperSound'\n | 'wallpaperSoundHint'\n | 'wallpaperVolume'\n | 'wallpaperImport'\n | 'wallpaperImportHint'\n | 'wallpaperReimport'\n | 'wallpaperRemove'\n | 'wallpaperUpdateAvailable'\n | 'wallpaperEmpty'\n | 'wallpaperTypeVideo'\n | 'wallpaperTypeWeb'\n | 'wallpaperTypeScene'\n | 'wallpaperTypeApp'\n | 'wallpaperLoadMore'\n | 'wallpaperDirs'\n | 'wallpaperDirsEmpty'\n | 'wallpaperDirsHint'\n | 'wallpaperDirPlaceholder'\n | 'wallpaperDirAdd'\n | 'wallpaperDirBrowse'\n | 'wallpaperDirBrowseHint'\n | 'wallpaperDirBrowseFailed'\n | 'wallpaperDirBrowseTitle'\n | 'wallpaperDirBrowseChoose'\n | 'wallpaperDirBrowseEmpty'\n | 'wallpaperDirBrowseHidden'\n | 'wallpaperDirBrowseTruncated'\n | 'wallpaperSaveFailed'\n | 'wallpaperRatingAll'\n | 'wallpaperRatingG'\n | 'wallpaperRatingPg13'\n | 'wallpaperRatingR18'\n | 'wallpaperPagePrev'\n | 'wallpaperPageNext'\n | 'wallpaperPageJump'\n | 'wallpaperPageTotal'\n | 'customThemeTitle'\n | 'customThemeTagline'\n | 'customThemeEdit'\n | 'customThemeCloseEdit'\n | 'customThemeMode'\n | 'customThemeLight'\n | 'customThemeDark'\n | 'customThemeAccent'\n | 'customThemeBackground'\n | 'customThemeForeground'\n | 'customThemeContrast'\n | 'customThemeReset'\n | 'customThemeResetHint'\n | 'customThemeSaveFailed'\n | 'uninstall'\n | 'uninstalling'\n | 'uninstallConfirm'\n | 'uninstallFailed'\n | 'verifyIntegrity'\n | 'verifyingIntegrity'\n | 'verifyAllPassed'\n | 'verifyFoundIssues'\n | 'integrityValid'\n | 'integrityTampered'\n | 'integrityMissing'\n | 'integrityHooksRefused'\n | 'cancel'\n | 'confirm'\n | 'verifyRepaired'\n | 'verifyRepairFailed'\n | 'repair'\n | 'repairing'\n | 'repaired'\n | 'updateAll'\n | 'updateAllChecking'\n | 'updateAllRunning'\n | 'updateAllNone'\n | 'updateAllDone'\n | 'updateAllFailed'\n | 'uninstallAll'\n | 'uninstallAllConfirm'\n | 'uninstallAllRunning'\n | 'uninstallAllDone'\n | 'uninstallAllFailed'\n | 'marketUnreachable'\n | 'bulkNoUserSkins'\n\nexport const en: Record<SkinCenterKey, string> = {\n title: 'Skin Center',\n cardDescription: 'Try on any installed skin live in the GUI — exit restores instantly, applying persists in one click.',\n externalWallpaperReadyTitle: 'Wallpapers are handled by another plugin',\n externalWallpaperReadyBody: 'Wallpaper Engine support comes from the {package} plugin, which owns the wallpaper library, rendering and settings. While it renders a wallpaper it takes over the backdrop, and this card keeps the skin on top of it: the skin\\'s own background art steps aside and the composer frost yields to the plugin\\'s glass.',\n externalWallpaperMissingTitle: 'Wallpaper Engine support moved to its own plugin',\n externalWallpaperMissingBody: 'This card no longer bundles a Wallpaper Engine bridge. To use Wallpaper Engine wallpapers, install {package} with the command below and restart dsh; it adds its own settings page for the wallpaper library, rendering and glass.',\n externalWallpaperLink: 'Open the wallpaper plugin docs',\n externalWallpaperRecommended: 'Recommended',\n externalWallpaperInstall: 'Install',\n externalWallpaperInstalling: 'Installing...',\n externalWallpaperCopyCommand: 'Copy command',\n externalWallpaperCopied: 'Copied',\n externalWallpaperInstallFailed: 'Install failed: {reason}',\n delegatedSkinBadge: 'Plugin theme',\n delegatedSkinDescriptionClaudeStyle:\n 'The whole GUI as Claude Code Desktop: warm ivory canvas, serif body text, the ember accent, a pixel mascot on the composer and the chat-area behaviours Claude Code is known for. Its own settings page stays reachable while another skin is on screen.',\n delegatedSkinNotRunning: 'The plugin is installed but not running here. Enable it in Plugins, then reopen this page.',\n delegatedSkinNoHandoff: 'The running plugin build cannot hand the page back to a skin, so it cannot be selected from here. Update dsh-claude-style.',\n delegatedSkinInstall: 'Install now',\n delegatedSkinManage: 'Manage in Plugins',\n delegatedSkinInstalling: 'Installing...',\n delegatedSkinInstallFailed: 'Install failed: {reason}',\n delegatedSkinDescriptorMismatch: 'The installed plugin declares a different skin id or attribute than this card knows. Update the plugin.',\n delegatedSkinLink: 'Open the plugin docs',\n stoodDownTitle: 'Skin paused while the wallpaper is active',\n stoodDownBody: 'Your skin is still selected, but it is not painted while the wallpaper plugin renders a wallpaper: the two cannot share the backdrop. Stop the wallpaper there and the skin comes back on its own.',\n enabled: 'Enable skin center',\n enabledHint: 'When off, try-on, apply and background controls are disabled; turn it back on to resume.',\n offNote: 'The skin center is turned off.',\n intro: 'Try on any skin live — it takes effect instantly, exit restores the current look. Apply persists it across restarts.',\n official: 'Official default',\n officialTagline: 'The stock DSH look with no skin applied.',\n active: 'Active',\n tryingOn: 'Trying on',\n tryOn: 'Try on',\n loading: 'Loading…',\n exitTryOn: 'Exit try-on',\n apply: 'Apply',\n applying: 'Applying…',\n restore: 'Restore',\n applyFailed: 'Apply failed',\n appliedUnconfirmed: 'Applied, but the change has not been confirmed — refresh the page in dev mode; packaged installs (DSH Desktop) need an app restart',\n appliedNeedRestart: 'Applied and confirmed, but the host did not hot-reload — restart dsh to take effect',\n theme: 'Theme preview',\n themeLight: 'Light',\n themeDark: 'Dark',\n tryOnError: 'Try-on failed — see console',\n backgroundOpacity: 'Background occlusion',\n backgroundBlurEmpty: 'Blur when empty',\n backgroundBlurContent: 'Blur with content',\n inputCardBlur: 'Input card blur',\n inputCardBlurHint: 'Blurs only the area behind the input card while backdrop art is visible; it does not blur the entire wallpaper.',\n bubbleOpacity: 'Bubble opacity',\n bubbleOpacityHint: 'Controls translucent message bubbles for skins that expose bubble alpha, such as Whale Mom.',\n bubbleBlur: 'Bubble blur',\n bubbleBlurHint: 'Blurs the backdrop behind translucent message bubbles; independent of bubble opacity, 0 disables.',\n backgroundBlurHint: 'Applies a separate Gaussian blur to the backdrop for the empty conversation and the conversation with content; 0 disables.',\n backgroundBlurInert: 'Visible only with skins that paint a backdrop; the official default has none.',\n backgroundHint: 'Instantly veils the backdrop behind the panels — higher values obscure the art to help you focus.',\n backgroundHintInert: 'Only applies to skins that paint a backdrop (Blue Fantasy / Whale Song). Applies to the official default automatically once such a skin is active.',\n wallpaperTitle: 'Wallpaper Engine',\n wallpaperEnable: 'Enable wallpapers',\n wallpaperHint: 'Use your local Wallpaper Engine library as the GUI backdrop: video, web, and scene wallpapers render live (scene wallpapers need WebGL). On macOS there is no Wallpaper Engine library, so the feature starts off — turn it on, then add a folder of videos.',\n wallpaperLoadError: 'Wallpaper library failed to load',\n wallpaperLibraryFound: 'Wallpaper Engine library detected',\n wallpaperLibraryManual: 'Folders you added',\n wallpaperRefresh: 'Refresh',\n wallpaperMode: 'Render mode',\n wallpaperModeLive: 'Live',\n wallpaperModeFrame: 'Static frame',\n wallpaperFit: 'Sizing mode',\n wallpaperFitCover: 'Cover (fill)',\n wallpaperFitContain: 'Fit (entire image)',\n wallpaperFitFill: 'Stretch',\n wallpaperClear: 'Turn off wallpaper',\n wallpaperDim: 'Wallpaper dimming',\n wallpaperOpacity: 'Wallpaper opacity',\n wallpaperBlur: 'Wallpaper blur',\n wallpaperPauseHidden: 'Pause when window hidden',\n wallpaperSound: 'Wallpaper sound',\n wallpaperSoundHint: 'Play video wallpaper audio. The browser may keep it silent until you click or press a key once.',\n wallpaperVolume: 'Wallpaper volume',\n wallpaperImport: 'Import',\n wallpaperImportHint: 'Copy this wallpaper into local storage, so it keeps working even if the Steam library moves or changes',\n wallpaperReimport: 'Update',\n wallpaperRemove: 'Remove',\n wallpaperUpdateAvailable: 'The workshop original changed since import — update the local copy',\n wallpaperEmpty: 'No wallpapers found. Add a folder of videos below, or subscribe in the Wallpaper Engine workshop on Windows.',\n wallpaperTypeVideo: 'Video',\n wallpaperTypeWeb: 'Web',\n wallpaperTypeScene: 'Scene (static)',\n wallpaperTypeApp: 'Unsupported',\n wallpaperLoadMore: 'Load more',\n wallpaperDirs: 'Manual folders',\n wallpaperDirsEmpty: 'No folders yet — add one to load its videos.',\n wallpaperDirsHint: 'On macOS: pick a folder of .mp4/.webm videos (or a wallpaper project folder). On Windows, folders extend the auto-detected Wallpaper Engine library.',\n wallpaperDirPlaceholder: '/path/to/wallpapers or ~/Movies/wallpapers',\n wallpaperDirAdd: 'Add',\n wallpaperDirBrowse: 'Browse…',\n wallpaperDirBrowseHint: 'Pick a folder with the system file manager (Finder / Explorer)',\n wallpaperDirBrowseFailed: 'Could not open the system folder picker — type the path manually instead',\n wallpaperDirBrowseTitle: 'Select a folder',\n wallpaperDirBrowseChoose: 'Use this folder',\n wallpaperDirBrowseEmpty: 'No subfolders',\n wallpaperDirBrowseHidden: 'Show hidden folders',\n wallpaperDirBrowseTruncated: 'Too many folders to list; only the beginning is shown.',\n wallpaperSaveFailed: 'Could not save wallpaper settings.',\n wallpaperRatingAll: 'All',\n wallpaperRatingG: 'G',\n wallpaperRatingPg13: 'PG-13',\n wallpaperRatingR18: 'R18',\n wallpaperPagePrev: 'Previous',\n wallpaperPageNext: 'Next',\n wallpaperPageJump: 'Go',\n wallpaperPageTotal: 'Page {page} / {total}',\n customThemeTitle: 'Custom theme',\n customThemeTagline: 'A separately saved palette derived from the official default theme.',\n customThemeEdit: 'Edit',\n customThemeCloseEdit: 'Collapse',\n customThemeMode: 'Editing mode',\n customThemeLight: 'Light',\n customThemeDark: 'Dark',\n customThemeAccent: 'Accent',\n customThemeBackground: 'Background',\n customThemeForeground: 'Foreground',\n customThemeContrast: 'Contrast',\n customThemeReset: 'Restore current mode default',\n customThemeResetHint: 'Only resets the selected light or dark profile.',\n customThemeSaveFailed: 'Could not save custom theme changes.',\n uninstall: 'Uninstall',\n uninstalling: 'Uninstalling…',\n uninstallConfirm: 'Are you sure you want to uninstall \"{name}\"? Local files will be deleted.',\n uninstallFailed: 'Uninstall failed',\n verifyIntegrity: 'Verify integrity',\n verifyingIntegrity: 'Verifying…',\n verifyAllPassed: 'All {count} installed skin(s) passed integrity verification',\n verifyFoundIssues: 'Found {count} skin(s) with integrity issues',\n integrityValid: 'Verified',\n integrityTampered: 'Modified',\n integrityMissing: 'Missing files',\n integrityHooksRefused: 'Hooks refused',\n cancel: 'Cancel',\n confirm: 'Confirm',\n verifyRepaired: 'Successfully repaired {count} skin(s) with integrity issues',\n verifyRepairFailed: 'Failed to repair {count} skin(s)',\n updateAll: 'Update all',\n updateAllChecking: 'Checking versions…',\n updateAllRunning: 'Updating {done}/{total}…',\n updateAllNone: 'All installed skins are up to date',\n updateAllDone: 'Updated {count} skin(s)',\n updateAllFailed: '{count} skin(s) failed to update',\n uninstallAll: 'Uninstall all',\n uninstallAllConfirm: 'Uninstall all {count} market-installed skin(s)? Their local files are deleted permanently and the GUI returns to the default look.',\n uninstallAllRunning: 'Uninstalling {done}/{total}…',\n uninstallAllDone: 'Uninstalled {count} skin(s)',\n uninstallAllFailed: '{count} skin(s) failed to uninstall',\n marketUnreachable: 'Could not reach the skin market to read versions',\n bulkNoUserSkins: 'No market-installed skins to act on',\n repair: 'Repair',\n repairing: 'Repairing…',\n repaired: 'Repaired',\n}\n\nexport const zh: Record<SkinCenterKey, string> = {\n title: '皮肤',\n cardDescription: '在 GUI 内即时试穿任意皮肤,退出即完全还原;应用一键完成并自动刷新。',\n externalWallpaperReadyTitle: '壁纸已由独立插件接管',\n externalWallpaperReadyBody: 'Wallpaper Engine 壁纸来自 {package} 插件,壁纸库、渲染与设置都归它管。它渲染壁纸时会接管背景,本卡片让皮肤叠在其之上:皮肤自身的背景图让路,输入卡磨砂也让给该插件的玻璃。',\n externalWallpaperMissingTitle: 'Wallpaper Engine 支持已独立成插件',\n externalWallpaperMissingBody: '本卡片不再自带 Wallpaper Engine 桥。要使用 Wallpaper Engine 壁纸,请用下面的命令安装 {package} 并重启 dsh;它自带壁纸库、渲染与玻璃的设置页。',\n externalWallpaperLink: '打开壁纸插件文档',\n externalWallpaperRecommended: '推荐',\n externalWallpaperInstall: '一键安装',\n externalWallpaperInstalling: '安装中…',\n externalWallpaperCopyCommand: '复制命令',\n externalWallpaperCopied: '已复制',\n externalWallpaperInstallFailed: '安装失败:{reason}',\n delegatedSkinBadge: '插件皮肤',\n delegatedSkinDescriptionClaudeStyle:\n '整副界面就是 Claude Code Desktop:暖米色画布、衬线正文、余烬橙强调色、输入框上沿的像素吉祥物,以及 Claude Code 那些对话区交互。它自带的设置页在别的皮肤在屏时照常可用。',\n delegatedSkinNotRunning: '插件已安装但当前页面没有运行。请在「插件」中启用它,然后刷新本页。',\n delegatedSkinNoHandoff: '当前运行的插件版本无法在皮肤之间让出页面,因此这里不能选用它。请更新 dsh-claude-style。',\n delegatedSkinInstall: '一键安装',\n delegatedSkinManage: '在插件页管理',\n delegatedSkinInstalling: '安装中…',\n delegatedSkinInstallFailed: '安装失败:{reason}',\n delegatedSkinDescriptorMismatch: '已安装的插件声明的皮肤 id 或属性与本卡片记录的不一致,请更新插件。',\n delegatedSkinLink: '打开插件文档',\n stoodDownTitle: '壁纸启用期间皮肤已暂停',\n stoodDownBody: '你选择的皮肤仍然保留,但在壁纸插件渲染壁纸期间不会绘制:两者的背景无法共存。在该插件里停止壁纸,皮肤会自动恢复。',\n enabled: '启用皮肤中心',\n enabledHint: '关闭后停用试穿、应用与背景控件,重新打开即恢复。',\n offNote: '皮肤中心已关闭。',\n intro: '任意皮肤可即时试穿,退出即完全还原;「应用」一键持久化,页面自动刷新生效。',\n official: '官方默认',\n officialTagline: '还原 DSH 官方默认外观,不应用任何皮肤。',\n active: '当前激活',\n tryingOn: '试穿中',\n tryOn: '试穿',\n loading: '加载中…',\n exitTryOn: '退出试穿',\n apply: '应用',\n applying: '应用中…',\n restore: '恢复默认',\n applyFailed: '应用失败',\n appliedUnconfirmed: '已写入配置但尚未确认生效——开发模式请刷新页面;打包版(DSH Desktop)需重启应用后生效',\n appliedNeedRestart: '已写入配置并确认生效,但宿主未热重载——请重启 dsh 后生效',\n theme: '主题预览',\n themeLight: '亮色',\n themeDark: '暗色',\n tryOnError: '试穿失败,详见控制台',\n backgroundOpacity: '背景遮挡',\n backgroundBlurEmpty: '空对话背景模糊',\n backgroundBlurContent: '有对话背景模糊',\n inputCardBlur: '输入卡模糊',\n inputCardBlurHint: '仅模糊输入卡背后的区域,不会让整张壁纸变糊。',\n bubbleOpacity: '气泡不透明度',\n bubbleOpacityHint: '调节支持气泡 alpha 的皮肤消息气泡,例如鲸鱼妈妈。',\n bubbleBlur: '气泡模糊程度',\n bubbleBlurHint: '模糊半透明消息气泡背后的区域,与「气泡不透明度」相互独立,0 为关闭。',\n backgroundBlurHint: '对话为空与有内容时分别应用不同的背景高斯模糊强度,0 为关闭。',\n backgroundBlurInert: '仅对带背景图插画的皮肤可见;官方默认无背景图。',\n backgroundHint: '即时为面板背后的背景加遮罩——数值越高越能弱化插画,帮你集中注意力。',\n backgroundHintInert: '仅对带背景图插画的皮肤(蓝色幻想 / 鲸吟)生效;官方默认无背景图,该滑块对这些皮肤自动生效。',\n wallpaperTitle: 'Wallpaper Engine',\n wallpaperEnable: '启用动态壁纸',\n wallpaperHint: '把本机 Wallpaper Engine 壁纸库用作 GUI 背景:视频、网页与场景壁纸均动态渲染(场景壁纸需要 WebGL)。macOS 没有 Wallpaper Engine 壁纸库,该功能默认关闭;开启后添加一个存放视频的目录即可。',\n wallpaperLoadError: '壁纸库加载失败',\n wallpaperLibraryFound: '已检测到 Wallpaper Engine 壁纸库',\n wallpaperLibraryManual: '来自你添加的目录',\n wallpaperRefresh: '刷新',\n wallpaperMode: '渲染模式',\n wallpaperModeLive: '动态',\n wallpaperModeFrame: '静态帧',\n wallpaperFit: '适应方式',\n wallpaperFitCover: '铺满裁剪',\n wallpaperFitContain: '完整缩放',\n wallpaperFitFill: '拉伸铺满',\n wallpaperClear: '关闭壁纸',\n wallpaperDim: '壁纸暗化',\n wallpaperOpacity: '壁纸不透明度',\n wallpaperBlur: '壁纸模糊',\n wallpaperPauseHidden: '窗口隐藏时暂停',\n wallpaperSound: '壁纸声音',\n wallpaperSoundHint: '播放视频壁纸的声音。浏览器可能在首次点击或按键前保持静音。',\n wallpaperVolume: '壁纸音量',\n wallpaperImport: '导入',\n wallpaperImportHint: '把该壁纸复制到本地存储,Steam 库迁移或变动后仍可继续使用',\n wallpaperReimport: '更新',\n wallpaperRemove: '移除',\n wallpaperUpdateAvailable: '工坊原件在导入后有更新——同步更新本地副本',\n wallpaperEmpty: '未发现壁纸。请在下方添加一个存放视频的目录;Windows 上也可先在 Wallpaper Engine 创意工坊订阅。',\n wallpaperTypeVideo: '视频',\n wallpaperTypeWeb: '网页',\n wallpaperTypeScene: '场景(静态)',\n wallpaperTypeApp: '不支持',\n wallpaperLoadMore: '加载更多',\n wallpaperDirs: '手动目录',\n wallpaperDirsEmpty: '还没有目录——添加一个以加载其中的视频。',\n wallpaperDirsHint: 'macOS:选择一个存放 .mp4/.webm 视频的目录(或单个壁纸项目文件夹)。Windows:这里添加的目录会扩展自动检测到的 Wallpaper Engine 壁纸库。',\n wallpaperDirPlaceholder: '/path/to/wallpapers 或 ~/Movies/wallpapers',\n wallpaperDirAdd: '添加',\n wallpaperDirBrowse: '浏览…',\n wallpaperDirBrowseHint: '通过系统文件管理器(访达 / 资源管理器)选择文件夹',\n wallpaperDirBrowseFailed: '无法打开系统目录选择框——请手动输入路径',\n wallpaperDirBrowseTitle: '选择文件夹',\n wallpaperDirBrowseChoose: '使用此目录',\n wallpaperDirBrowseEmpty: '没有子目录',\n wallpaperDirBrowseHidden: '显示隐藏目录',\n wallpaperDirBrowseTruncated: '目录过多,仅显示开头部分。',\n wallpaperSaveFailed: '壁纸设置保存失败。',\n wallpaperRatingAll: '全部',\n wallpaperRatingG: 'G',\n wallpaperRatingPg13: 'PG-13',\n wallpaperRatingR18: 'R18',\n wallpaperPagePrev: '上一页',\n wallpaperPageNext: '下一页',\n wallpaperPageJump: '跳转',\n wallpaperPageTotal: '第 {page} / {total} 页',\n customThemeTitle: '自定义主题',\n customThemeTagline: '基于官方默认主题生成并独立保存的配色方案。',\n customThemeEdit: '编辑',\n customThemeCloseEdit: '收起',\n customThemeMode: '编辑模式',\n customThemeLight: '浅色',\n customThemeDark: '深色',\n customThemeAccent: '强调色',\n customThemeBackground: '背景色',\n customThemeForeground: '前景色',\n customThemeContrast: '对比度',\n customThemeReset: '恢复当前模式默认',\n customThemeResetHint: '只重置当前选择的浅色或深色配置。',\n customThemeSaveFailed: '自定义主题修改保存失败。',\n uninstall: '卸载',\n uninstalling: '卸载中…',\n uninstallConfirm: '确定要卸载皮肤「{name}」吗?本地文件将被永久删除。',\n uninstallFailed: '卸载失败',\n verifyIntegrity: '验证完整性',\n verifyingIntegrity: '正在验证…',\n verifyAllPassed: '所有 {count} 款已安装皮肤完整性正常',\n verifyFoundIssues: '发现 {count} 款皮肤存在完整性异常',\n verifyRepaired: '已自动修复 {count} 款皮肤的完整性异常',\n verifyRepairFailed: '{count} 款皮肤自动修复失败',\n updateAll: '全部更新',\n updateAllChecking: '正在检查版本…',\n updateAllRunning: '正在更新 {done}/{total}…',\n updateAllNone: '所有已安装皮肤均为最新版本',\n updateAllDone: '已更新 {count} 款皮肤',\n updateAllFailed: '{count} 款皮肤更新失败',\n uninstallAll: '全部卸载',\n uninstallAllConfirm: '确定要卸载全部 {count} 款市场安装的皮肤吗?本地文件将被永久删除,界面回到默认外观。',\n uninstallAllRunning: '正在卸载 {done}/{total}…',\n uninstallAllDone: '已卸载 {count} 款皮肤',\n uninstallAllFailed: '{count} 款皮肤卸载失败',\n marketUnreachable: '无法连接皮肤市场以读取版本',\n bulkNoUserSkins: '没有可操作的市场安装皮肤',\n repair: '修复',\n repairing: '修复中…',\n repaired: '已修复',\n integrityValid: '完整',\n integrityTampered: '文件已修改',\n integrityMissing: '缺少文件',\n integrityHooksRefused: 'Hooks 已拒绝',\n cancel: '取消',\n confirm: '确定',\n}\n","/**\n * Serializes skin and theme previews into one preview session (issue #39\n * migration round: the wallpaper dimension left with the built-in Wallpaper\n * Engine bridge, so this coordinator no longer arbitrates it).\n *\n * A transition in one dimension fully retires the other dimension's preview\n * before it starts, so async skin switches cannot race theme publishes.\n */\nexport interface PreviewSkinController {\n getState(): { previewing: boolean }\n exitTryOn(): Promise<string | null>\n}\n\nexport interface PreviewCustomThemeController {\n getState(): { previewing: boolean }\n exitTryOn(): void\n suspend(): void\n resume(): void\n}\n\nexport class PreviewCoordinator {\n private tail: Promise<void> = Promise.resolve()\n\n constructor(\n private readonly skin: PreviewSkinController,\n private readonly customTheme?: PreviewCustomThemeController,\n ) {}\n\n runSkin<T>(action: () => Promise<T>): Promise<T> {\n return this.enqueue(async () => {\n if (this.customTheme?.getState().previewing === true) this.customTheme.exitTryOn()\n this.customTheme?.suspend()\n try {\n return await action()\n } finally {\n if (!this.skin.getState().previewing) this.customTheme?.resume()\n }\n })\n }\n\n runCustomTheme<T>(action: () => Promise<T>): Promise<T> {\n return this.enqueue(async () => {\n const continuingCustomPreview = this.customTheme?.getState().previewing === true\n if (!continuingCustomPreview && this.skin.getState().previewing) await this.skin.exitTryOn()\n this.customTheme?.resume()\n return await action()\n })\n }\n\n private enqueue<T>(action: () => Promise<T>): Promise<T> {\n const run = this.tail.then(action, action)\n this.tail = run.then(() => undefined, () => undefined)\n return run\n }\n}\n","/** Versioned user theme derived from the official stock theme. */\n\nexport const SKIN_CUSTOM_THEME_NS = 'skin-custom-theme'\nexport const CUSTOM_THEME_VERSION = 1 as const\n\nexport interface CustomThemeProfile {\n accent: string\n background: string\n foreground: string\n contrast: number\n}\n\nexport interface CustomThemeConfig {\n version: number\n applied: boolean\n light: CustomThemeProfile\n dark: CustomThemeProfile\n}\n\nexport const CUSTOM_THEME_DEFAULTS: Readonly<CustomThemeConfig> = {\n version: CUSTOM_THEME_VERSION,\n applied: false,\n light: {\n accent: '#4d6bfe',\n background: '#f7f8fa',\n foreground: '#262626',\n contrast: 50,\n },\n dark: {\n accent: '#7c91ff',\n background: '#171719',\n foreground: '#f3f3f3',\n contrast: 50,\n },\n}\n\n/** The complete token surface this feature may emit. */\nexport const CUSTOM_THEME_ALLOWED_TOKENS = [\n '--dsw-alias-bg-base',\n '--dsw-alias-bg-layer-1',\n '--dsw-alias-bg-layer-2',\n '--dsw-alias-bg-layer-3',\n '--dsw-alias-bg-multi-select',\n '--dsw-alias-bg-overlay',\n '--dsw-alias-bg-skeleton',\n '--dsw-alias-border-l1',\n '--dsw-alias-border-l2',\n '--dsw-alias-border-l3',\n '--dsw-alias-border-l4',\n '--dsw-alias-brand-primary',\n '--dsw-alias-brand-primary-invert',\n '--dsw-alias-brand-text',\n '--dsw-alias-button-primary-dimmed',\n '--dsw-alias-button-primary-fill',\n '--dsw-alias-button-primary-hover',\n '--dsw-alias-interactive-bg-active',\n '--dsw-alias-interactive-bg-hover',\n '--dsw-alias-interactive-bg-hover-accent',\n '--dsw-alias-label-dimmed',\n '--dsw-alias-label-primary',\n '--dsw-alias-label-primary-foreground',\n '--dsw-alias-label-secondary',\n '--dsw-alias-label-tertiary',\n '--dsw-alias-markdown-code-block',\n '--dsw-alias-markdown-code-block-banner',\n '--dsw-alias-markdown-inline-code',\n '--dsw-alias-scrollbar-bg-l1',\n '--dsw-alias-scrollbar-hover-l1',\n '--dsw-alias-toast-bg',\n '--dsw-alias-tooltip-bg',\n '--dsw-specific-bubble',\n '--dsw-specific-bubble-highlight',\n '--dsw-specific-input-major',\n '--dsw-specific-menu',\n '--dsw-specific-selector',\n '--dsw-specific-sidebar-fill',\n '--dsw-specific-sidebar-nav-item-active',\n '--dsw-specific-sidebar-nav-item-active-accent',\n '--dsw-specific-sidebar-nav-item-hover',\n] as const\n\ntype UnknownRecord = Record<string, unknown>\n\nfunction record(value: unknown): UnknownRecord {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? value as UnknownRecord\n : {}\n}\n\nfunction color(value: unknown, fallback: string): string {\n return typeof value === 'string' && /^#[0-9a-f]{6}$/i.test(value)\n ? value.toLowerCase()\n : fallback\n}\n\nfunction contrast(value: unknown, fallback: number): number {\n if (typeof value !== 'number' || !Number.isFinite(value)) return fallback\n return Math.max(0, Math.min(100, Math.round(value)))\n}\n\nfunction normalizeProfile(value: unknown, fallback: Readonly<CustomThemeProfile>): CustomThemeProfile {\n const source = record(value)\n return {\n accent: color(source.accent, fallback.accent),\n background: color(source.background, fallback.background),\n foreground: color(source.foreground, fallback.foreground),\n contrast: contrast(source.contrast, fallback.contrast),\n }\n}\n\n/** Normalize untrusted settings data into the current contract version. */\nexport function normalizeCustomThemeConfig(value: unknown): CustomThemeConfig {\n const source = record(value)\n if (source.version !== undefined && source.version !== CUSTOM_THEME_VERSION) {\n return {\n version: CUSTOM_THEME_VERSION,\n applied: false,\n light: { ...CUSTOM_THEME_DEFAULTS.light },\n dark: { ...CUSTOM_THEME_DEFAULTS.dark },\n }\n }\n return {\n version: CUSTOM_THEME_VERSION,\n applied: source.applied === true,\n light: normalizeProfile(source.light, CUSTOM_THEME_DEFAULTS.light),\n dark: normalizeProfile(source.dark, CUSTOM_THEME_DEFAULTS.dark),\n }\n}\n\nfunction mix(a: string, aPercent: number, b: string): string {\n return `color-mix(in srgb, ${a} ${aPercent}%, ${b})`\n}\n\nfunction declarations(profile: CustomThemeProfile): Array<[typeof CUSTOM_THEME_ALLOWED_TOKENS[number], string]> {\n const { accent, background, foreground } = profile\n const depth1 = 2 + Math.round(profile.contrast * 0.12)\n const depth2 = depth1 + 4\n const depth3 = depth2 + 4\n const border = 12 + Math.round(profile.contrast * 0.18)\n const mutedText = 60 + Math.round(profile.contrast * 0.2)\n return [\n ['--dsw-alias-bg-base', background],\n ['--dsw-alias-bg-layer-1', mix(background, 100 - depth1, foreground)],\n ['--dsw-alias-bg-layer-2', mix(background, 100 - depth2, foreground)],\n ['--dsw-alias-bg-layer-3', mix(background, 100 - depth3, foreground)],\n ['--dsw-alias-bg-multi-select', mix(background, 84, accent)],\n ['--dsw-alias-bg-overlay', mix(background, 90 - Math.round(profile.contrast * 0.08), foreground)],\n ['--dsw-alias-bg-skeleton', mix(background, 82, foreground)],\n ['--dsw-alias-border-l1', mix(background, 100 - border, foreground)],\n ['--dsw-alias-border-l2', mix(background, 100 - Math.max(8, border - 5), foreground)],\n ['--dsw-alias-border-l3', mix(background, 100 - Math.max(5, border - 9), foreground)],\n ['--dsw-alias-border-l4', mix(background, 96, foreground)],\n ['--dsw-alias-brand-primary', accent],\n ['--dsw-alias-brand-primary-invert', background],\n ['--dsw-alias-brand-text', accent],\n ['--dsw-alias-button-primary-dimmed', mix(accent, 48, background)],\n ['--dsw-alias-button-primary-fill', accent],\n ['--dsw-alias-button-primary-hover', mix(accent, 82, foreground)],\n ['--dsw-alias-interactive-bg-active', mix(background, 78, accent)],\n ['--dsw-alias-interactive-bg-hover', mix(background, 100 - depth2, foreground)],\n ['--dsw-alias-interactive-bg-hover-accent', mix(background, 84, accent)],\n ['--dsw-alias-label-dimmed', mix(foreground, 42, background)],\n ['--dsw-alias-label-primary', foreground],\n ['--dsw-alias-label-primary-foreground', foreground],\n ['--dsw-alias-label-secondary', mix(foreground, mutedText, background)],\n ['--dsw-alias-label-tertiary', mix(foreground, Math.max(45, mutedText - 18), background)],\n ['--dsw-alias-markdown-code-block', mix(background, 100 - depth2, foreground)],\n ['--dsw-alias-markdown-code-block-banner', mix(background, 100 - depth3, foreground)],\n ['--dsw-alias-markdown-inline-code', mix(background, 86, accent)],\n ['--dsw-alias-scrollbar-bg-l1', mix(background, 94, foreground)],\n ['--dsw-alias-scrollbar-hover-l1', mix(background, 76, foreground)],\n ['--dsw-alias-toast-bg', mix(background, 100 - depth3, foreground)],\n ['--dsw-alias-tooltip-bg', mix(background, 28, foreground)],\n ['--dsw-specific-bubble', mix(background, 92, accent)],\n ['--dsw-specific-bubble-highlight', mix(background, 82, accent)],\n ['--dsw-specific-input-major', mix(background, 100 - depth1, foreground)],\n ['--dsw-specific-menu', mix(background, 100 - depth1, foreground)],\n ['--dsw-specific-selector', mix(background, 100 - depth2, foreground)],\n ['--dsw-specific-sidebar-fill', mix(background, 100 - depth1, foreground)],\n ['--dsw-specific-sidebar-nav-item-active', mix(background, 86, accent)],\n ['--dsw-specific-sidebar-nav-item-active-accent', accent],\n ['--dsw-specific-sidebar-nav-item-hover', mix(background, 100 - depth2, foreground)],\n ]\n}\n\nfunction block(selector: string, profile: CustomThemeProfile): string {\n const body = declarations(profile).map(([name, value]) => ` ${name}: ${value};`).join('\\n')\n return `${selector} {\\n${body}\\n}`\n}\n\n/** Build stock-only CSS from normalized, fixed token declarations. */\nexport function buildCustomThemeCss(value: unknown): string {\n const config = normalizeCustomThemeConfig(value)\n return [\n block('html[data-dsh-custom-theme]:not([data-dsh-skin]) body', config.light),\n block('html[data-dsh-custom-theme]:not([data-dsh-skin]) body[data-ds-dark-theme]', config.dark),\n ].join('\\n\\n')\n}\n","import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client'\n\nimport {\n CUSTOM_THEME_DEFAULTS,\n SKIN_CUSTOM_THEME_NS,\n buildCustomThemeCss,\n normalizeCustomThemeConfig,\n type CustomThemeConfig,\n type CustomThemeProfile,\n} from '../core/custom-theme.ts'\n\nexport type CustomThemeScheme = 'light' | 'dark'\n\nexport interface CustomThemeState {\n applied: boolean\n previewing: boolean\n visible: boolean\n writeError: string | null\n}\n\nexport interface CustomThemeControllerOptions {\n doc?: Document\n}\n\ntype CustomThemeField = keyof CustomThemeConfig & string\n\ninterface PendingWrite {\n field: CustomThemeField\n value: CustomThemeConfig[CustomThemeField]\n resolve(): void\n reject(error: unknown): void\n}\n\n/** Owns the custom-theme configuration section and its inert-by-default style. */\nexport class CustomThemeController {\n private readonly scope: ConfigForm<CustomThemeConfig>\n private readonly doc: Document\n private readonly style: HTMLStyleElement\n private readonly unsubscribe: () => void\n private readonly listeners = new Set<() => void>()\n private config: CustomThemeConfig\n private previewingValue = false\n private suspended = false\n private state: CustomThemeState\n private disposed = false\n private readonly writeQueue: PendingWrite[] = []\n private pendingWrites = 0\n private drainingWrites = false\n\n constructor(scope: ConfigForm<CustomThemeConfig>, options: CustomThemeControllerOptions = {}) {\n this.scope = scope\n this.doc = options.doc ?? document\n this.config = normalizeCustomThemeConfig(scope.getSnapshot().value)\n this.style = this.doc.createElement('style')\n this.style.dataset.dshCustomThemeStyle = ''\n this.doc.head.appendChild(this.style)\n this.state = { applied: this.config.applied, previewing: false, visible: false, writeError: null }\n this.syncDom()\n this.unsubscribe = scope.subscribe(() => {\n if (this.disposed || this.pendingWrites > 0) return\n this.syncFromScope()\n })\n }\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n }\n\n getState = (): CustomThemeState => this.state\n\n profile(scheme: CustomThemeScheme): CustomThemeProfile {\n return { ...this.config[scheme] }\n }\n\n setProfileValue(\n scheme: CustomThemeScheme,\n key: keyof CustomThemeProfile,\n value: string | number,\n ): void {\n const next = normalizeCustomThemeConfig({\n ...this.config,\n [scheme]: { ...this.config[scheme], [key]: value },\n })\n this.config = next\n this.clearWriteError()\n this.syncDom()\n this.publish()\n void this.queueWrite(scheme, { ...next[scheme] }).catch(error => { this.setWriteError(error) })\n }\n\n reset(scheme: CustomThemeScheme): void {\n const profile = { ...CUSTOM_THEME_DEFAULTS[scheme] }\n this.config = { ...this.config, [scheme]: profile }\n this.clearWriteError()\n this.syncDom()\n this.publish()\n void this.queueWrite(scheme, profile).catch(error => { this.setWriteError(error) })\n }\n\n tryOn(): void {\n this.previewingValue = true\n this.suspended = false\n this.syncDom()\n this.publish()\n }\n\n exitTryOn(): void {\n this.previewingValue = false\n this.suspended = false\n this.syncDom()\n this.publish()\n }\n\n async apply(): Promise<void> {\n this.config = { ...this.config, applied: true }\n this.previewingValue = false\n this.suspended = false\n this.syncDom()\n this.publish()\n await this.queueWrite('applied', true)\n if (!this.config.applied) throw new Error('custom theme activation was not persisted')\n }\n\n async deactivate(): Promise<void> {\n if (!this.config.applied) {\n this.previewingValue = false\n this.suspended = false\n this.syncDom()\n this.publish()\n return\n }\n this.config = { ...this.config, applied: false }\n this.previewingValue = false\n this.suspended = false\n this.syncDom()\n this.publish()\n if (this.scope.getSnapshot().status === 'unavailable') return\n await this.queueWrite('applied', false)\n if (this.config.applied) throw new Error('custom theme deactivation was not persisted')\n }\n\n suspend(): void {\n if (this.suspended) return\n this.suspended = true\n this.syncDom()\n this.publish()\n }\n\n resume(): void {\n if (!this.suspended) return\n this.suspended = false\n this.syncDom()\n this.publish()\n }\n\n dispose(): void {\n if (this.disposed) return\n this.disposed = true\n this.unsubscribe()\n this.listeners.clear()\n this.style.remove()\n this.doc.documentElement.removeAttribute('data-dsh-custom-theme')\n }\n\n private syncDom(): void {\n this.style.textContent = buildCustomThemeCss(this.config)\n const visible = (this.config.applied || this.previewingValue) && !this.suspended\n if (visible) this.doc.documentElement.setAttribute('data-dsh-custom-theme', 'true')\n else this.doc.documentElement.removeAttribute('data-dsh-custom-theme')\n this.state = {\n applied: this.config.applied,\n previewing: this.previewingValue,\n visible,\n writeError: this.state.writeError,\n }\n }\n\n private publish(): void {\n for (const listener of this.listeners) listener()\n }\n\n private syncFromScope(): void {\n this.config = normalizeCustomThemeConfig(this.scope.getSnapshot().value)\n this.syncDom()\n this.publish()\n }\n\n private clearWriteError(): void {\n if (this.state.writeError === null) return\n this.state = { ...this.state, writeError: null }\n }\n\n private setWriteError(error: unknown): void {\n this.state = {\n ...this.state,\n writeError: error instanceof Error ? error.message : String(error),\n }\n this.publish()\n }\n\n /**\n * Identity of the settings section a refused write addressed, for the error a\n * user sees. It carries the Host's own status and revision — which entry\n * answered, whether it can be written, and at which revision — and never any\n * stored configuration value, so a refused save can be diagnosed from the\n * message alone without exposing what the user configured.\n * @returns a short diagnostic fragment naming the section and its state.\n */\n private sectionState(): string {\n const snapshot = this.scope.getSnapshot()\n const revision = snapshot.revision === undefined ? 'none' : String(snapshot.revision)\n return `${SKIN_CUSTOM_THEME_NS}: status ${snapshot.status}, writable ${String(snapshot.writable)}, revision ${revision}`\n }\n\n private queueWrite<K extends CustomThemeField>(field: K, value: CustomThemeConfig[K]): Promise<void> {\n this.pendingWrites += 1\n const pending = new Promise<void>((resolve, reject) => {\n this.writeQueue.push({\n field,\n value,\n resolve,\n reject,\n } as PendingWrite)\n })\n void this.drainWrites()\n return pending\n }\n\n private async drainWrites(): Promise<void> {\n if (this.drainingWrites) return\n this.drainingWrites = true\n const settled: Array<\n { write: PendingWrite; ok: true }\n | { write: PendingWrite; ok: false; error: unknown }\n > = []\n while (this.writeQueue.length > 0) {\n const write = this.writeQueue.shift()\n if (write === undefined) break\n try {\n // The form contract answers `false` for a write the Host refused or\n // skipped, and rejects when the transport itself failed; both leave\n // the stored profile unchanged, so neither may count as saved.\n const accepted = await this.scope.set(write.field, write.value)\n if (!accepted) throw new Error(`the Host did not accept the custom theme setting (${this.sectionState()})`)\n } catch (error) {\n settled.push({ write, ok: false, error })\n continue\n } finally {\n this.pendingWrites -= 1\n }\n settled.push({ write, ok: true })\n }\n this.drainingWrites = false\n if (!this.disposed) this.syncFromScope()\n const failure = settled.find(result => !result.ok)\n if (!this.disposed && failure !== undefined && !failure.ok) {\n this.setWriteError(failure.error)\n }\n for (const result of settled) {\n if (result.ok) result.write.resolve()\n else result.write.reject(result.error)\n }\n }\n}\n","/**\n * One preference family as a section of this plugin's own configuration form.\n *\n * 0.1.7 addresses configuration as ONE form per profile entry\n * (`ctx.configForms.get(entryId)`) and serves a plugin's own `Config` schema\n * as its settings page; the previous cohort's per-namespace settings scopes\n * are gone. The skin center's three preference families are sections of that\n * one Config, so this wrapper projects the entry form onto one section: the\n * controllers keep addressing their own fields, and every write is queued on\n * the shared form as a path-addressed mutation.\n *\n * The projected fields are declared volatile in the Host schema, which is\n * what makes the Host accept the write, apply it live, and never remount the\n * row (see `Config` in src/index.ts).\n */\n\nimport type { ConfigForm, ConfigFormSnapshot } from '@deepseek-ai/dsh-client-ui-settings/client'\nimport type { SettingsPathOpView } from '@deepseek-ai/dsh-api-remotes/client'\n\n/** The JSON value one wire field write admits. */\ntype WireValue = Extract<SettingsPathOpView, { op: 'set' }>['value']\n\n/** Read one object-shaped layer of a form snapshot. */\nfunction layerOf(layer: unknown, key: string): unknown {\n return typeof layer === 'object' && layer !== null ? (layer as Record<string, unknown>)[key] : undefined\n}\n\n/**\n * Project one entry form onto the section behind `key`.\n * @param parent - the form of the profile entry that owns this section.\n * @param key - the section key inside the entry's Config.\n * @returns the section's form: its own value/user/base layers, and writes\n * addressed at `[key, field]` on the parent.\n */\nexport function settingsSection<T>(parent: ConfigForm<unknown>, key: string): ConfigForm<T> {\n let source: ConfigFormSnapshot<unknown> | undefined\n let projected: ConfigFormSnapshot<T> | undefined\n // The form contract promises a stable snapshot reference until the next\n // change; the parent's snapshot is that signal, so a projection of the same\n // parent snapshot is reused instead of rebuilt on every read.\n const project = (): ConfigFormSnapshot<T> => {\n const snapshot = parent.getSnapshot()\n if (projected !== undefined && source === snapshot) return projected\n source = snapshot\n projected = {\n status: snapshot.status,\n value: layerOf(snapshot.value, key) as T | undefined,\n base: layerOf(snapshot.base, key),\n user: layerOf(snapshot.user, key),\n revision: snapshot.revision,\n writable: snapshot.writable,\n }\n return projected\n }\n return {\n getSnapshot: project,\n subscribe: listener => parent.subscribe(listener),\n set: (field, value) => parent.mutate([{ op: 'set', path: [key, field], value: value as WireValue }]),\n unset: field => parent.mutate([{ op: 'unset', path: [key, field] }]),\n mutate: (ops, expectedRevision) => parent.mutate(ops.map(op => 'value' in op\n ? { op: 'set', path: [key, ...op.path], value: op.value }\n : { op: 'unset', path: [key, ...op.path] }), expectedRevision),\n }\n}\n","/**\n * Which profile entry row the skin center's settings form is bound to.\n *\n * 0.1.7 addresses configuration as one form per profile entry id, and this\n * package can be installed under two different rows: the family aggregate's\n * generated `web-ui-skin-center` row, or its own standalone bundle row\n * `ui-skin-center` (cordis.patch.yml, and the `name` the plugin exports).\n * `ctx.configForms` carries no package identity, so the only authority on which\n * row is live is the served-namespace list in the shared describe mirror.\n *\n * Issue #1769 / dsh-skins#17:\n * Under an aggregate install (@linxin666/dsh-web-all), freezing an entry id\n * before the describe mirror answers resulted in binding to 'ui-skin-center',\n * which does not exist in an aggregate profile. The Host answers\n * 'No configurable plugin entry \"ui-skin-center\"' and settings mutations fail.\n *\n * Deferred binding avoids guessing a row while the mirror is unready: the form\n * reports 'unavailable' and prevents writes until the mirror answers, and then\n * binds the row the Host actually serves.\n *\n * @module @linxin666/dsh-client-ui-skin-center/settings-entry-id\n */\nimport type { ConfigForm, ConfigFormSnapshot, ConfigForms } from '@deepseek-ai/dsh-client-ui-settings/client'\n\n/** Profile entry id the family aggregate's generated row carries. */\nconst AGGREGATE_ENTRY_ID = 'web-ui-skin-center'\n\n/**\n * This package's own declared plugin name, which is also the entry id its\n * standalone bundle patch row carries (cordis.patch.yml) and the `name` the\n * plugin exports (src/index.ts).\n */\nconst OWN_ENTRY_ID = 'ui-skin-center'\n\n/**\n * Profile entry ids this package's rows can be served under: its own standalone\n * row, the family aggregate's generated row, and the legacy background\n * namespace a profile that named the row after it still serves. The served\n * mirror decides which one is real; this list only ranks the candidates.\n */\nconst SKIN_CENTER_ENTRY_IDS: readonly string[] = [OWN_ENTRY_ID, AGGREGATE_ENTRY_ID, 'skin-background']\n\n/**\n * The entry id of the first skin-center row the Host says it serves, or `null`\n * when the mirror cannot say. `null` means \"unknown\", never \"none\": the mirror\n * is asynchronous, so an unreadable snapshot is a pre-boot window, not proof\n * that this package is absent.\n * @param forms - the shared configuration forms service.\n * @param candidates - entry ids to look for, in preference order.\n * @returns the served entry id, or `null` when the mirror cannot answer.\n */\nexport function servedEntryId(forms: ConfigForms, candidates: readonly string[] = SKIN_CENTER_ENTRY_IDS): string | null {\n let served: readonly string[] | undefined\n try {\n served = forms.describe().getSnapshot().view?.namespaces.map(view => view.ns)\n } catch {\n served = undefined\n }\n if (served === undefined) return null\n return candidates.find(id => served.includes(id)) ?? null\n}\n\n/**\n * The entry id to bind, which is this package's OWN row whenever the mirror\n * cannot name a skin-center row.\n *\n * @deprecated Prefer {@link boundConfigForm} which performs deferred binding\n * and avoids guessing rows that do not exist under aggregate installs.\n * @param forms - the shared configuration forms service.\n * @returns the entry id whose form the plugin should address.\n */\nexport function boundEntryId(forms: ConfigForms): string {\n return servedEntryId(forms) ?? OWN_ENTRY_ID\n}\n\n/**\n * Snapshot for a form whose entry is unserved or whose describe mirror has\n * not yet answered.\n */\nfunction unavailableSnapshot<T>(): ConfigFormSnapshot<T> {\n return {\n status: 'unavailable',\n value: undefined,\n base: undefined,\n user: undefined,\n revision: undefined,\n writable: false,\n }\n}\n\n/**\n * A deferred ConfigForm that binds the row actually served once the describe\n * mirror answers, and degrades to 'unavailable' without issuing silent writes to\n * guessed entry ids while the mirror is unready or absent.\n *\n * @param forms - the shared configuration forms service.\n * @param candidates - candidate entry ids in preference order.\n * @returns a ConfigForm delegating to the resolved entry's form.\n */\nexport function boundConfigForm<T>(\n forms: ConfigForms,\n candidates: readonly string[] = SKIN_CENTER_ENTRY_IDS,\n): ConfigForm<T> {\n const listeners = new Set<() => void>()\n let bound: ConfigForm<T> | undefined\n let boundId: string | undefined\n let offBound: (() => void) | undefined\n let subscribedToMirror = false\n // Re-entrancy guard: getSnapshot() lazily binds, bind() publishes, and a\n // listener that reads the form while the mirror is still unanswered would\n // otherwise re-enter bind() -> publish() -> getSnapshot() until the stack\n // overflows (the apply then throws and the whole web boot fails).\n let binding = false\n\n const resolve = (): string | null => {\n return servedEntryId(forms, candidates)\n }\n\n const publish = (): void => {\n for (const listener of [...listeners]) {\n listener()\n }\n }\n\n const bind = (): void => {\n if (binding) return\n binding = true\n try {\n ensureMirrorSubscription()\n const target = resolve()\n if (target === boundId) return\n offBound?.()\n offBound = undefined\n if (target === null) {\n // Unbinding is a change only when something was bound; an unanswered\n // mirror leaving the form unbound must not publish (the publish would\n // re-enter this bind through any listener reading the form).\n const hadBinding = bound !== undefined\n boundId = undefined\n bound = undefined\n if (hadBinding) publish()\n return\n }\n let form: ConfigForm<T>\n try {\n form = forms.get<T>(target)\n } catch {\n const hadBinding = bound !== undefined\n boundId = undefined\n bound = undefined\n if (hadBinding) publish()\n return\n }\n boundId = target\n bound = form\n offBound = form.subscribe(() => { publish() })\n publish()\n } finally {\n binding = false\n }\n }\n\n const ensureMirrorSubscription = (): void => {\n if (subscribedToMirror) return\n try {\n const describeFace = forms.describe()\n if (typeof describeFace?.subscribe === 'function') {\n describeFace.subscribe(() => { bind() })\n subscribedToMirror = true\n }\n if (typeof describeFace?.ensure === 'function') {\n void describeFace.ensure()\n }\n } catch {\n // Mirror not ready or does not support subscribe\n }\n }\n\n bind()\n\n return {\n getSnapshot: () => {\n if (bound === undefined) {\n bind()\n }\n return bound?.getSnapshot() ?? unavailableSnapshot<T>()\n },\n subscribe: (listener) => {\n ensureMirrorSubscription()\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n set: (field, value) => {\n if (bound === undefined) {\n bind()\n }\n return bound?.set(field, value) ?? Promise.resolve(false)\n },\n unset: (field) => {\n if (bound === undefined) {\n bind()\n }\n return bound?.unset(field) ?? Promise.resolve(false)\n },\n mutate: (ops, expectedRevision) => {\n if (bound === undefined) {\n bind()\n }\n return bound?.mutate(ops, expectedRevision) ?? Promise.resolve(false)\n },\n }\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/telemetry.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Anonymous install telemetry shared by the DSH Web UI family plugins.\n *\n * Once per UTC day per browser, each wired plugin sends one heartbeat to\n * the dsh-market edge API listing its package name (and version when known).\n * The payload carries no conversation data and no identifiers beyond a random\n * UUID generated in localStorage; the server hashes it with a deployment salt\n * before storage and never persists IP addresses. Sends are fire-and-forget:\n * failures stay silent and simply retry on a later mount or day. The system\n * is documented in docs/telemetry.md.\n */\n\nexport type TelemetryChannel = 'market' | 'npm' | 'unknown'\n\nexport interface TelemetryItem {\n /** npm package name or asset id, e.g. \"@linxin666/dsh-pet\" or \"skin:harbor\". */\n name: string\n /** Installed version when known; omitted otherwise. */\n version?: string\n /** Install channel when determinable (market = Workshop install). */\n channel?: TelemetryChannel\n}\n\nconst VISITOR_KEY = 'dsh-web-ui-telemetry-visitor'\nconst DAY_KEY_PREFIX = 'dsh-web-ui-telemetry-day:'\nconst ENDPOINT = 'https://dsh-market.com/api/telemetry/event'\n\n// Baked into each client bundle by shared/tsdown.client.ts (the package's own\n// package.json version at build time). Undefined in dev/test builds.\ndeclare const __DSH_PKG_VERSION__: string | undefined\n\n/** The building package's version, when the bundle carries it. */\nfunction bakedVersion(): string | undefined {\n try {\n return typeof __DSH_PKG_VERSION__ === 'string' && __DSH_PKG_VERSION__ !== ''\n ? __DSH_PKG_VERSION__\n : undefined\n } catch {\n return undefined\n }\n}\n\n/** Read or lazily create the anonymous visitor id; null when storage is unavailable. */\nfunction visitorId(): string | null {\n try {\n const existing = localStorage.getItem(VISITOR_KEY)\n if (existing && /^[A-Za-z0-9_-]{16,64}$/.test(existing)) return existing\n const fresh = crypto.randomUUID().replaceAll('-', '')\n localStorage.setItem(VISITOR_KEY, fresh)\n return fresh\n } catch {\n // Storage unavailable (privacy mode, sandboxed frame): report nothing.\n return null\n }\n}\n\n/** Drop stale per-day dedup keys so localStorage does not grow forever. */\nfunction pruneDayKeys(today: string): void {\n try {\n for (let index = localStorage.length - 1; index >= 0; index -= 1) {\n const key = localStorage.key(index)\n if (key !== null && key.startsWith(DAY_KEY_PREFIX) && key !== DAY_KEY_PREFIX + today) {\n localStorage.removeItem(key)\n }\n }\n } catch { /* best effort */ }\n}\n\n/**\n * Fire the daily heartbeat for the given items at most once per UTC day per\n * browser. Never throws and never blocks the caller. Items without an explicit\n * version inherit the bundle's baked build version.\n */\nexport function reportDailyHeartbeat(items: readonly TelemetryItem[]): void {\n try {\n if (items.length === 0) return\n const today = new Date().toISOString().slice(0, 10)\n // Automation contexts (CDP-driven QA browsers, fresh isolated profiles)\n // mint a new visitor id per run and would inflate instance counts.\n if (navigator.webdriver) return\n if (localStorage.getItem(DAY_KEY_PREFIX + today) !== null) return\n const visitor = visitorId()\n if (visitor === null) return\n pruneDayKeys(today)\n const payloadItems = items.map((item) => {\n const out: Record<string, string> = { name: item.name }\n const version = item.version ?? bakedVersion()\n if (version !== undefined) out.version = version\n if (item.channel !== undefined) out.channel = item.channel\n return out\n })\n const body = JSON.stringify({ kind: 'heartbeat', visitor, items: payloadItems })\n void fetch(ENDPOINT, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body,\n keepalive: true,\n }).then((response) => {\n // Mark the day only after an accepted send, so offline browsers retry\n // on a later mount instead of going dark until tomorrow.\n if (response.ok) localStorage.setItem(DAY_KEY_PREFIX + today, '1')\n }).catch(() => { /* unreachable endpoint: stay silent */ })\n } catch { /* never break the host UI over telemetry */ }\n}\n","/**\n * In-GUI skin center, browser half: registers the Skin Center as a first-level\n * settings section (`settings.section`) and boots the v2 skin runtime\n * (effect ledger + atomic switch controller + semantic adapter + catalog\n * store). The section lists the installed skins (shipped built-ins +\n * $DSH_HOME/skins), tries them on live, and applies in one click — no reload,\n * no cordis.patch.yml rewrite (issue #506). The plugin writes only DOM and\n * the settings document — no services, no events, no model access.\n *\n * Background preferences persist through the v2 /active channel instead of\n * the settings form (issue #996): the remote pairing channel fences\n * settings.* as loopback-only, so form-backed writes never reached the\n * server from a paired desktop. The legacy skin-background section is still\n * read as a live input for the settings page (loopback only); card edits flow\n * card -> POST /active, page edits flow section -> POST /active.\n *\n * 0.1.7 serves one configuration form per profile entry (the plugin's own\n * `Config`), so the three preference families this card owns are sections of\n * that one form (see settings-section.ts).\n */\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client'\nimport type { ThemeRuntime } from '@deepseek-ai/dsh-client-ui-theme/client'\n// Type-only: pulls the locale plugin's Context merge (ctx.locale).\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: pulls the settings-surface Context merge (ctx.configForms).\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\n// Type-only: pulls the ctx.slots merge (the renderer owns the slot registry since 0.1.2).\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\n// Type-only: pulls the generated Remote namespace (ctx.remote), including directoryPicker.\nimport type {} from '@deepseek-ai/dsh-api-remotes/client'\nimport { SkinCenterSection, type SkinCenterInjected } from './SkinCenter.tsx'\nimport { BackgroundController, SKIN_BACKGROUND_NS } from './background.ts'\nimport type { SkinBackgroundConfig } from '../core/background.ts'\nimport { initialSkinBackgroundReconcileState, reconcileSkinBackgroundPublication } from '../core/background-scope.ts'\nimport {\n externalWallpaperEngineActive,\n externalWallpaperPredicted,\n releasePrediction,\n watchExternalWallpaperEngine,\n} from './runtime/external-wallpaper-engine.ts'\nimport { PREDICTED_WALLPAPER_GRACE_MS } from '../core/wallpaper-handoff.ts'\nimport { setComposerFrostSuppressed } from './runtime/backdrop-scene.ts'\nimport { bridgeInstallFaces } from './plugin-install-faces.ts'\nimport { createDelegatedSkinHandle } from './delegated-skin-handle.ts'\nimport { delegatedThemeState, watchDelegatedTheme, type DelegatedThemeState } from './runtime/delegated-theme.ts'\nimport { DELEGATED_SKINS } from '../core/delegated-skins.ts'\nimport { EXTERNAL_WE_PLUGIN, EXTERNAL_WE_REPO } from '../external-wallpaper.ts'\nimport { en, zh, type SkinCenterKey } from './locales.ts'\nimport { bootSkinRuntime, watchPersistedSelection } from './runtime/boot.ts'\nimport { PreviewCoordinator } from './preview-coordinator.ts'\nimport { CustomThemeController } from './custom-theme-controller.ts'\nimport { SKIN_CUSTOM_THEME_NS, type CustomThemeConfig } from '../core/custom-theme.ts'\nimport { settingsSection } from './settings-section.ts'\nimport { boundConfigForm } from './settings-entry-id.ts'\nimport { reportDailyHeartbeat } from './telemetry.ts'\n\nexport type { SkinCenterComponentProps, SkinCenterInjected } from './SkinCenter.tsx'\nexport { bootSkinRuntime } from './runtime/boot.ts'\n\n/** Locale namespace owned by this plugin. */\nexport const NS = 'skinCenter'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** The skin-center card's copy. */\n skinCenter: SkinCenterKey\n }\n}\n\n/**\n * Domain-owned description of one settings namespace a family card binds.\n * Private upstream since 0.1.7 (the shared forms service addresses profile\n * entry ids, not namespaces), so the family binder's spec shape is declared\n * here.\n */\nexport interface SettingsFormSpec<S> {\n /** Family settings namespace; the binder resolves its profile entry id. */\n namespace: string\n /** Narrow one wire section; undefined keeps the value the Host resolved. */\n decode?: (section: unknown) => S | undefined\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n /**\n * Optional family settings binder provided by dsh-web-settings; absent\n * when that group plugin is not installed, so callers fall back to the\n * shared configuration forms service.\n */\n webUiSettings?: { bind<S>(spec: SettingsFormSpec<S>): ConfigForm<S> }\n }\n}\n\n/** The plugin's own configuration as the browser half reads it (plain values). */\ninterface SkinCenterSettings {\n 'skin-background'?: SkinBackgroundConfig\n 'skin-custom-theme'?: CustomThemeConfig\n}\n\n/**\n * The configuration form of this plugin's own profile entry.\n *\n * `ctx.configForms` addresses one form per profile entry id and carries no\n * package identity, so the entry is reached through the family binder, whose\n * namespace-to-entry mapping the settings group owns: `skin-background` is\n * the namespace this package has always owned, and the bridge resolves it to\n * whichever entry id the profile gave this row. A deployment without the\n * group serves no such mapping, so the shared forms service is asked which row\n * it actually serves via deferred binding: rather than freezing a guess while the\n * describe mirror is unanswered (#1769), `boundConfigForm` degrades to\n * 'unavailable' and binds whichever row the Host serves (`web-ui-skin-center`\n * under an aggregate install, or `ui-skin-center` under a standalone install).\n * @param ctx - client root context.\n * @returns the entry form carrying every preference family.\n */\nfunction bindConfigForm(ctx: ClientContext): ConfigForm<SkinCenterSettings> {\n const binder = ctx.get('webUiSettings')\n if (binder !== undefined && typeof binder.bind === 'function') {\n return binder.bind<SkinCenterSettings>({ namespace: SKIN_BACKGROUND_NS })\n }\n return boundConfigForm<SkinCenterSettings>(ctx.configForms)\n}\n\n/**\n * Required services: slots + locale (plugin card), theme (preview toggle) and\n * configForms (settings sections).\n *\n * The Remote faces this plugin used (the wallpaper panel's folder picker)\n * left with the built-in Wallpaper Engine bridge: wallpaper configuration now\n * belongs to `dsh-plugin-wallpaper-engine`, which owns its own directory\n * pickers. Dropping the `remote.directoryPicker` inject also releases the\n * parking it imposed, so the card mounts on a Host that serves no picker.\n */\nexport const inject = ['slots', 'locale', 'theme', 'configForms']\n\n/** Self-report item for the install heartbeat. */\nconst SELF_ITEM = [{ name: '@linxin666/dsh-client-ui-skin-center' }]\n\n/**\n * Beat the install heartbeat (docs/telemetry.md), enriching it with the\n * installed skin inventory (skin:<id> + version + channel) once the v2\n * catalog answers. Offline or pre-boot the beat stays package-only.\n */\nfunction beatHeartbeat(): void {\n reportDailyHeartbeat(SELF_ITEM)\n void fetch('/api/skin-center/v2/catalog')\n .then((res) => (res.ok ? res.json() : null))\n .then((catalog) => {\n if (!catalog || !Array.isArray(catalog.skins)) return\n const items = [...SELF_ITEM]\n for (const skin of catalog.skins) {\n const id = skin && skin.manifest && typeof skin.manifest.id === 'string' ? skin.manifest.id : ''\n if (!id) continue\n const item: { name: string; version?: string; channel?: 'market' | 'npm' | 'unknown' } = { name: 'skin:' + id }\n if (typeof skin.manifest.version === 'string') item.version = skin.manifest.version\n if (typeof skin.channel === 'string') item.channel = skin.channel\n items.push(item)\n }\n reportDailyHeartbeat(items.slice(0, 64))\n })\n .catch(() => { /* offline or fenced: the package-only beat already went out */ })\n}\n\n/**\n * Register the skin-center dictionaries, the body scope attribute, and the\n * Skin Center as a first-level settings section.\n * @param ctx - client root context.\n */\nexport function apply(ctx: ClientContext): void {\n // Anonymous install heartbeat (docs/telemetry.md): one beat per browser per\n // UTC day, package name plus installed-skin inventory, silent failure.\n beatHeartbeat()\n\n ctx.effect(() => {\n try {\n return ctx.locale.register(NS, { zh, en })\n } catch {\n return () => {}\n }\n }, 'ui-skin-center: dictionaries')\n\n // The card's own styles scope under this attribute so they keep applying\n // during try-on (when the active skin's attribute is retracted).\n ctx.effect(() => {\n document.body.dataset.dshSkinCenter = ''\n return () => { delete document.body.dataset.dshSkinCenter }\n }, 'ui-skin-center: body scope')\n\n const theme = ctx.get('theme') as ThemeRuntime\n const settings = bindConfigForm(ctx)\n // The v2 state channel: GET backfills on boot, edits POST back debounced.\n // The remote proxy rewrites this path into the allow-listed channel, so it\n // works from paired desktops where the settings form is fenced (#996).\n const V2_ACTIVE_URL = '/api/skin-center/v2/active'\n let persistTimer: ReturnType<typeof setTimeout> | null = null\n const postBackground = (next: SkinBackgroundConfig, keepalive = false): void => {\n void fetch(V2_ACTIVE_URL, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ background: next }),\n keepalive,\n }).catch(() => { /* offline or pre-boot: the in-memory values stay applied */ })\n }\n // Coalesce slider drags into one write; dispose flushes the pending one.\n const persistBackground = (next: SkinBackgroundConfig): void => {\n if (persistTimer !== null) clearTimeout(persistTimer)\n persistTimer = setTimeout(() => {\n persistTimer = null\n postBackground(next)\n }, 250)\n }\n const flushBackground = (): void => {\n if (persistTimer === null) return\n clearTimeout(persistTimer)\n persistTimer = null\n postBackground(background.snapshot(), true)\n }\n // The legacy section is an input face for the loopback settings page only.\n // Its resolved value contains schema defaults, so only the raw user layer may\n // be reconciled into the authoritative v2 state.\n const backgroundSection = settingsSection<SkinBackgroundConfig>(settings, SKIN_BACKGROUND_NS)\n const scopeConfig = (): SkinBackgroundConfig | null => {\n const value = backgroundSection.getSnapshot().value\n if (value === undefined || value === null) return null\n return value\n }\n const background = new BackgroundController(scopeConfig(), persistBackground)\n // Reconcile state for the legacy section (revision + user-layer fence, plus\n // the boot-sync gate #1375): the settings document's initial sync must never\n // be mistaken for a settings-page edit, whichever order it and the v2 GET\n // land in — stale legacy user-layer fields (e.g. zeros left by the pre-#1107\n // bugs) would otherwise patch and persist over the authoritative v2 state.\n let reconcileState = initialSkinBackgroundReconcileState(backgroundSection.getSnapshot())\n const reconcileScope = (): void => {\n const result = reconcileSkinBackgroundPublication(\n reconcileState,\n background.snapshot(),\n backgroundSection.getSnapshot(),\n )\n reconcileState = result.state\n if (result.patch === null) return\n const currentSnapshot = background.snapshot()\n background.init({ ...currentSnapshot, ...result.patch })\n persistBackground(background.snapshot())\n }\n // Refetch the authoritative v2 state once booted; it wins over the settings\n // snapshot (the migration may only have run with this boot).\n void fetch(V2_ACTIVE_URL)\n .then((res) => (res.ok ? res.json() as Promise<{ background?: SkinBackgroundConfig | null }> : null))\n .then((body) => {\n reconcileState = { ...reconcileState, v2Loaded: true }\n if (body?.background) background.init(body.background)\n // Reconcile only a section revision that changed while the v2 state was\n // loading; an unchanged revision is the legacy boot snapshot.\n reconcileScope()\n })\n .catch(() => {\n reconcileState = { ...reconcileState, v2Loaded: true }\n reconcileScope()\n })\n // Settings-page edits arrive through the form publish. The settings mirror\n // may republish this entry for any configuration change (including the other\n // two sections), so fence on the revision and use only explicitly stored\n // user fields — the user-layer content fence is what keeps an unrelated\n // republish from being read as an edit.\n ctx.effect(\n () => backgroundSection.subscribe(reconcileScope),\n 'ui-skin-center: background section sync',\n )\n // Tear the blur element + observer down when this plugin's fiber goes away.\n ctx.effect(() => () => {\n flushBackground()\n background.dispose()\n }, 'ui-skin-center: background dispose')\n const customTheme = new CustomThemeController(\n settingsSection<CustomThemeConfig>(settings, SKIN_CUSTOM_THEME_NS),\n )\n ctx.effect(() => () => customTheme.dispose(), 'ui-skin-center: custom theme dispose')\n // One-click install of the delegated plugins (issue #39, and the\n // delegated-skin rows): bridge whichever plugin-management face the host\n // publishes. Both are optional, so neither gates this plugin's activation.\n bridgeInstallFaces(ctx)\n\n // Delegated skins: a skin whose visual is another plugin's. This package\n // paints none of it, so the card's row is driven by that plugin's own\n // document markers. One observer per registered plugin, read-only, and torn\n // down with this fiber.\n const delegatedStates = new Map<string, DelegatedThemeState>()\n const delegatedListeners = new Set<() => void>()\n for (const descriptor of DELEGATED_SKINS) {\n delegatedStates.set(descriptor.id, delegatedThemeState(document, descriptor))\n }\n ctx.effect(() => {\n const stops = DELEGATED_SKINS.map((descriptor) => watchDelegatedTheme(\n document,\n { bodyAttr: descriptor.bodyAttr, handoffAttr: descriptor.handoffAttr },\n (state) => {\n delegatedStates.set(descriptor.id, state)\n for (const listener of delegatedListeners) listener()\n },\n ))\n return () => { for (const stop of stops) stop() }\n }, 'ui-skin-center: delegated theme interop')\n // The external Wallpaper Engine plugin owns wallpapers now (issue #39).\n // While it renders one, its `body[data-we-wallpaper]` marker stands this\n // plugin's own visual work down ENTIRELY: no skin CSS, no background art, no\n // hooks, no composer frost. That plugin rewrites the same shell and paints\n // its own glass, so anything this one paints would fight it.\n //\n // The state is read synchronously BEFORE the runtime boots, so a page that\n // loads with a wallpaper already rendering never paints a frame of skin\n // first. The watcher installed below then keeps it current.\n //\n // Reading it here is the second half of that guarantee, not the whole of it\n // (issue #51): the marker is stamped by the peer's own client chain, so it\n // is absent from the document this page loaded with, and a frame of skin is\n // already painted by the time it lands.\n //\n // The host half therefore stands the index injection down for a persisted\n // wallpaper selection and marks the document as withheld-for-prediction.\n // This read is the other half: the browser boot recovers the selection\n // asynchronously (GET /active, then a switch), so that first activation has\n // to stand down too, or the withheld document is refilled with a frame of\n // skin a few hundred milliseconds after it was served.\n //\n // The prediction is bounded and expires on its own. A wallpaper that never\n // renders never stamps the marker, and the window is then the only thing\n // between that user and their skin - so when it closes, the runtime applies\n // the remembered selection as usual. The marker remains the verdict.\n let externalWallpaperActive = externalWallpaperEngineActive(document)\n // True only while the host predicted a wallpaper and the peer has not yet\n // answered; released by whichever comes first.\n let externalWallpaperPredictedStill = externalWallpaperPredicted(document)\n const externalWallpaperListeners = new Set<() => void>()\n\n // The v2 skin runtime store: outlives the settings card so a try-on\n // preview survives closing and reopening the panel. An active external\n // wallpaper withholds the skin; a marker flip re-applies the user's\n // selection so the appearance changes without a reload.\n const runtime = bootSkinRuntime({\n suppressSkin: () => externalWallpaperActive || externalWallpaperPredictedStill,\n suppressComposerFrost: () => externalWallpaperActive,\n })\n ctx.effect(() => () => runtime.shutdown(), 'ui-skin-center: runtime shutdown')\n // Applying a skin and saving the choice are one action in the GUI, but the\n // choice only reaches the NEXT page load. This page therefore follows it\n // two ways: the skin-applied announcement (a workshop install, from any\n // page) and the persisted selection (the official settings form, which the\n // Host applies without telling this page). Issue #1740 owned by this\n // activation, so a cleared plugin row takes the listeners with it.\n ctx.effect(() => watchPersistedSelection(runtime), 'ui-skin-center: follow the persisted selection')\n // Follow the external plugin's marker: every flip notifies the card (so its\n // hints stay truthful) and re-applies the current skin, which is what paints\n // or withholds it without a reload. The first report carries the state the\n // boot above already used, so it is a no-op.\n ctx.effect(() => {\n // The peer's marker answering - either way - ends the host's prediction:\n // the live verdict now owns the page, and the mark that stood the boot\n // activation down has done its job. The very first report IS that answer,\n // so a page whose peer stamps the marker before this plugin boots releases\n // the prediction immediately rather than carrying it for the full window.\n const dropPrediction = (): void => {\n if (!externalWallpaperPredictedStill) return\n externalWallpaperPredictedStill = false\n releasePrediction(document)\n }\n const stopWatch = watchExternalWallpaperEngine(document, (active) => {\n dropPrediction()\n if (active === externalWallpaperActive) return\n externalWallpaperActive = active\n // The external plugin paints its own composer glass, so this runtime\n // yields the frost while the wallpaper renders (issue #39).\n setComposerFrostSuppressed(document, active)\n for (const listener of externalWallpaperListeners) listener()\n void runtime.controller.refresh()\n })\n // The peer never answered. A wallpaper that fails to render never stamps\n // the marker, so the prediction has to expire on its own or this page\n // would sit on the stock look until the next reload. Expiry is a normal\n // stand-down lift: the remembered skin applies through the ordinary\n // withheld path, so nothing about the recovery is special-cased.\n let graceTimer: ReturnType<typeof setTimeout> | null = null\n if (externalWallpaperPredictedStill) {\n graceTimer = setTimeout(() => {\n graceTimer = null\n dropPrediction()\n if (externalWallpaperActive) return\n for (const listener of externalWallpaperListeners) listener()\n void runtime.controller.refresh()\n }, PREDICTED_WALLPAPER_GRACE_MS)\n }\n return () => {\n stopWatch()\n if (graceTimer !== null) clearTimeout(graceTimer)\n dropPrediction()\n }\n }, 'ui-skin-center: external wallpaper engine interop')\n const preview = new PreviewCoordinator(runtime.controller, customTheme)\n const injected = (): SkinCenterInjected => ({\n runtime,\n preview,\n customTheme,\n theme: {\n getTheme: () => theme.getTheme(),\n subscribe: listener => ctx.on('theme/change', listener),\n setTheme: id => theme.setTheme(id),\n },\n background: {\n enabled: () => background.enabled(),\n setEnabled: value => background.setEnabled(value),\n opacity: () => background.opacity(),\n blurEmpty: () => background.blurEmpty(),\n blurContent: () => background.blurContent(),\n inputCardBlur: () => background.inputCardBlur(),\n bubbleOpacity: () => background.bubbleOpacity(),\n bubbleBlur: () => background.bubbleBlur(),\n subscribe: listener => background.subscribe(listener),\n set: opacity => background.set(opacity),\n setBlurEmpty: value => background.setBlurEmpty(value),\n setBlurContent: value => background.setBlurContent(value),\n setInputCardBlur: value => background.setInputCardBlur(value),\n setBubbleOpacity: value => background.setBubbleOpacity(value),\n setBubbleBlur: value => background.setBubbleBlur(value),\n dispose: () => background.dispose(),\n },\n externalWallpaper: {\n active: () => externalWallpaperActive,\n subscribe: (listener) => {\n externalWallpaperListeners.add(listener)\n return () => { externalWallpaperListeners.delete(listener) }\n },\n repository: EXTERNAL_WE_REPO,\n packageName: EXTERNAL_WE_PLUGIN,\n },\n delegated: createDelegatedSkinHandle(\n (id) => delegatedStates.get(id) ?? { live: false, canYield: false },\n (listener) => {\n delegatedListeners.add(listener)\n return () => { delegatedListeners.delete(listener) }\n },\n ),\n })\n\n // First-level settings section: the Skin Center card as its own top-level\n // settings page. Browsing and installing new skins happens in the DSH\n // Market store; this section manages the installed ones (try-on, apply,\n // wallpaper, custom theme).\n ctx.slots.inject('settings.section', () => {\n try {\n return ctx.slots.register({\n name: 'settings.section',\n id: 'skin-center',\n order: 120,\n label: () => ctx.locale.bind('skinCenter')('title'),\n locale: 'skinCenter',\n inject: injected,\n }, SkinCenterSection)\n } catch {\n return () => {}\n }\n })\n}\n"],"mappings":";;;;;;;;;EAgEA,SAAgB,mBAAmB,YAA0B,KAAK,IAAI,GAAiB;GACrF,IAAI,MAAM;GACV,IAAI,iBAAiB;GACrB,MAAM,MAA2B,CAAC;GAClC,MAAM,uBAAO,IAAI,IAA0B;GAC3C,MAAM,2BAAW,IAAI,IAAY;GAEjC,SAAS,KAAK,cAAsB,MAAkB,OAAe,aAA8B;IACjG,OAAO;IACP,IAAI,KAAK;KAAE;KAAK;KAAc;KAAM;KAAO;KAAa,IAAI,IAAI;IAAE,CAAC;IACnE,OAAO;GACT;GAEA,SAAS,QAAQ,QAAoB,cAA4B;IAC/D,IAAI,OAAO,UAAU;IACrB,OAAO,WAAW;IAClB,KAAK,cAAc,WAAW,OAAO,KAAK;IAC1C,IAAI;KACF,OAAO,SAAS;IAClB,QAAQ;KAGN,KAAK,cAAc,kBAAkB,OAAO,KAAK;IACnD;GACF;GAEA,OAAO;IACL,kBAAkB;KAChB,MAAM,KAAK;KACX,KAAK,IAAI,IAAI,CAAC,CAAC;KACf,KAAK,IAAI,UAAU,YAAY;KAC/B,OAAO;IACT;IAEA,OAAO,cAAc,OAAO,UAAU;KACpC,MAAM,SAAS,KAAK,IAAI,YAAY;KACpC,IAAI,CAAC,UAAU,SAAS,IAAI,YAAY,G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AAC;EACH"}
1
+ {"version":3,"file":"client.js","names":["copyText","useState","useSyncExternalStore","subscribeWallpaperInstallFaces","getWallpaperInstallFaces","css","useSyncExternalStore","useState","css","useSyncExternalStore","useState","css","useRef","useCallback","useState","useSyncExternalStore","useRef","css","isRecord"],"sources":["../src/client/runtime/effect-ledger.ts","../src/client/runtime/semantic-adapter.ts","../src/client/runtime/shell-rendering.ts","../src/client/runtime/backdrop-scene.ts","../src/client/runtime/decoration-layers.ts","../src/client/runtime/skin-controller.ts","../src/client/runtime/boot.ts","../src/client/plugin-install-faces.ts","../src/client/ExternalWallpaperNotice.tsx","../src/client/DelegatedSkinCard.tsx","../src/core/delegated-skins.ts","../src/client/delegated-skin-handle.ts","../src/client/CustomThemePanel.tsx","../src/client/SliderControl.tsx","../src/client/SkinCenter.tsx","../src/core/background.ts","../src/client/background.ts","../src/core/background-scope.ts","../src/core/wallpaper-handoff.ts","../src/client/runtime/external-wallpaper-engine.ts","../src/client/runtime/delegated-theme.ts","../src/external-wallpaper.ts","../src/client/locales.ts","../src/client/preview-coordinator.ts","../src/core/custom-theme.ts","../src/client/custom-theme-controller.ts","../src/client/settings-section.ts","../src/client/settings-entry-id.ts","../src/client/telemetry.ts","../src/client/index.ts"],"sourcesContent":["/**\n * Effect ledger (issue #506, contract section 6).\n *\n * Every runtime effect a skin activation creates — style tags, CSS variable\n * overrides, decoration-layer content, listeners, hook cleanups — is recorded\n * here as an append-only entry bound to its activation identity. Switching\n * skins releases the old activation's entries in reverse order; disposal is\n * idempotent and may run 0, 1 or N times.\n *\n * lifecycleScope split:\n * - \"activation\": everything injectable — released on every skin switch;\n * - \"component\": skin static assets and the user's selection — survive\n * switches, reloads and HMR. The ledger only tracks activation scope.\n *\n * Pure logic, no DOM types required (entries are opaque teardown closures).\n */\n\nexport type EffectKind = 'create' | 'bind' | 'replace' | 'release' | 'cleanup-failed'\n\nexport interface EffectLedgerEntry {\n /** Monotonic sequence number (append-only). */\n seq: number\n activationId: number\n kind: EffectKind\n /** Human-readable label for diagnostics (e.g. \"style:skin.css\"). */\n label: string\n /** For replace: the seq of the superseded entry. */\n replacesSeq?: number\n at: number\n}\n\ninterface LiveEffect {\n seq: number\n label: string\n teardown: () => void\n released: boolean\n}\n\nexport interface EffectLedger {\n /** Start a new activation identity. Returns its id. */\n beginActivation(): number\n /**\n * Record an effect under the activation. The teardown must be idempotent.\n * Throws if the activation was already disposed (fail-closed: no orphan\n * effects after a switch).\n */\n record(activationId: number, label: string, teardown: () => void): number\n /**\n * Record that `label` replaces a previous entry (e.g. decoration-layer\n * content swap). The replaced entry is released immediately.\n */\n replace(activationId: number, label: string, previousSeq: number | undefined, teardown: () => void): number\n /**\n * Release every live effect of the activation, newest first. Idempotent;\n * individual teardown failures are caught and logged as cleanup-failed\n * entries (one failing teardown never blocks the rest).\n */\n disposeActivation(activationId: number): void\n /** Whether disposeActivation has run for this activation. */\n isDisposed(activationId: number): boolean\n /** Read-only view of the append-only log (diagnostics / tests). */\n entries(): readonly EffectLedgerEntry[]\n}\n\nexport function createEffectLedger(now: () => number = () => Date.now()): EffectLedger {\n let seq = 0\n let nextActivation = 1\n const log: EffectLedgerEntry[] = []\n const live = new Map<number, LiveEffect[]>()\n const disposed = new Set<number>()\n\n function push(activationId: number, kind: EffectKind, label: string, replacesSeq?: number): number {\n seq += 1\n log.push({ seq, activationId, kind, label, replacesSeq, at: now() })\n return seq\n }\n\n function release(effect: LiveEffect, activationId: number): void {\n if (effect.released) return\n effect.released = true\n push(activationId, 'release', effect.label)\n try {\n effect.teardown()\n } catch {\n // A failing teardown must never block the remaining cleanup; the\n // failure itself is a ledger fact for diagnostics.\n push(activationId, 'cleanup-failed', effect.label)\n }\n }\n\n return {\n beginActivation() {\n const id = nextActivation++\n live.set(id, [])\n push(id, 'create', 'activation')\n return id\n },\n\n record(activationId, label, teardown) {\n const bucket = live.get(activationId)\n if (!bucket || disposed.has(activationId)) {\n throw new Error(`effect \"${label}\" recorded on disposed/unknown activation ${activationId}`)\n }\n const entrySeq = push(activationId, 'create', label)\n bucket.push({ seq: entrySeq, label, teardown, released: false })\n return entrySeq\n },\n\n replace(activationId, label, previousSeq, teardown) {\n const bucket = live.get(activationId)\n if (!bucket || disposed.has(activationId)) {\n throw new Error(`effect \"${label}\" replaced on disposed/unknown activation ${activationId}`)\n }\n if (previousSeq !== undefined) {\n const previous = bucket.find((e) => e.seq === previousSeq)\n if (previous) release(previous, activationId)\n }\n const entrySeq = push(activationId, 'replace', label, previousSeq)\n bucket.push({ seq: entrySeq, label, teardown, released: false })\n return entrySeq\n },\n\n disposeActivation(activationId) {\n if (disposed.has(activationId)) return\n disposed.add(activationId)\n const bucket = live.get(activationId) ?? []\n for (const effect of [...bucket].reverse()) release(effect, activationId)\n },\n\n isDisposed(activationId) {\n return disposed.has(activationId)\n },\n\n entries() {\n return log\n },\n }\n}\n","/**\n * Semantic adapter (issue #506, contract section 6, L2 compat adapter).\n *\n * One merged MutationObserver that stamps the semantic-attribute enumeration\n * (contracts/semantic-attrs-v1.md) onto the official shell DOM and onto\n * plugin roots that already expose stable anchors. This is explicitly a\n * COMPAT adapter — not a permanent public contract:\n * - official areas migrate to first-party attributes when the upstream\n * theme seam lands (then these rules are re-evaluated for deletion);\n * - third-party plugin areas stay here long-term (plugins that opt in\n * output the attributes themselves and the adapter becomes a no-op).\n *\n * Properties:\n * - merged: a single observer handles every rule;\n * - batched: one delivery collects its records before any rule runs, so a\n * session switch that mounts thousands of nodes does not re-walk and\n * re-match the same ancestors once per node (issue #1870);\n * - idempotent: re-tagging an already-correct element is a no-op, so React\n * re-renders simply get re-stamped when their nodes are re-added;\n * - fail-closed diagnostics: rules that match nothing and selectors the\n * engine rejects are reported, never thrown into the page;\n * - the adapter never REMOVES attributes it did not set; disposal only\n * disconnects the observer (stamping is cosmetic and scopes itself under\n * html[data-dsh-skin] consumers).\n * @module @linxin666/dsh-client-ui-skin-center/runtime/semantic-adapter\n */\n\nexport type SemanticAttr = 'data-dsh-surface' | 'data-dsh-part' | 'data-dsh-plugin'\n\nexport interface SemanticRule {\n /** CSS selector matched against added/existing elements. */\n selector: string\n /** Attribute(s) applied on match. */\n attrs: readonly (readonly [SemanticAttr, string])[]\n /** Why this rule exists / what it anchors (audit trail). */\n note: string\n}\n\n/**\n * The v1 rule table. Single ownership: only the skin-center edits this.\n * Anchors verified against @deepseek-ai rc.7 (see docs/archive survey).\n */\nexport const SEMANTIC_RULES_V1: readonly SemanticRule[] = [\n // ---- surfaces (official shell) ----\n { selector: '[data-slot=\"root\"]', attrs: [['data-dsh-surface', 'root']], note: 'ui-renderer root outlet' },\n { selector: '[data-slot=\"sidebar\"]', attrs: [['data-dsh-surface', 'sidebar']], note: 'layout sidebar outlet' },\n {\n selector: '[data-slot=\"conversation\"], [class*=\"centerCol\"]',\n attrs: [['data-dsh-surface', 'conversation']],\n note: 'conversation column: legacy conversation outlet; since dsh 0.1.7 the column carries no data hook, so the css-module suffix (hash prefix varies, suffix stable) is the anchor',\n },\n { selector: '[data-slot=\"conversation.session.header\"]', attrs: [['data-dsh-surface', 'session-header']], note: 'conversation header outlet' },\n { selector: '[data-slot=\"conversation.composer\"]', attrs: [['data-dsh-surface', 'composer']], note: 'composer chain outlet' },\n {\n selector: '[data-slot=\"details\"], [data-rightbar-col]',\n attrs: [['data-dsh-surface', 'details']],\n note: 'details column: legacy details outlet; since dsh 0.1.7 the right sidebar column carries the official data-rightbar-col hook (0-width while collapsed, so stamping it paints nothing when closed)',\n },\n { selector: '[data-shell-overlay]', attrs: [['data-dsh-surface', 'overlay']], note: 'frame overlay attribute' },\n { selector: '[data-slot=\"shell.overlay\"]', attrs: [['data-dsh-surface', 'overlay']], note: 'shell overlay outlet' },\n {\n selector: '[role=\"dialog\"]:has([data-slot=\"settings.section\"])',\n attrs: [['data-dsh-surface', 'settings']],\n note: 'settings dialog (composite: dialog containing the section outlet)',\n },\n // ---- shell parts ----\n { selector: '[data-chat-flow-kind]', attrs: [['data-dsh-part', 'message-row']], note: 'chat flow item' },\n { selector: '[data-streaming]', attrs: [['data-dsh-part', 'message-body']], note: 'assistant markdown root' },\n { selector: '[data-conversation-scroll]', attrs: [['data-dsh-part', 'scrollport']], note: 'conversation scrollport' },\n {\n selector: 'textarea[data-phase], [data-composer-input]',\n attrs: [['data-dsh-part', 'composer-input']],\n note: 'composer input: legacy textarea; current shells render a Lexical contenteditable carrying data-composer-input',\n },\n { selector: '[data-decoration=\"chip\"]', attrs: [['data-dsh-part', 'composer-chip']], note: 'composer reference chip' },\n { selector: '[data-queue-dock]', attrs: [['data-dsh-part', 'queue-dock']], note: 'queued turns dock' },\n { selector: '[data-turn-tail]', attrs: [['data-dsh-part', 'turn-tail']], note: 'turn tail row' },\n { selector: '[data-side]', attrs: [['data-dsh-part', 'resize-handle']], note: 'column resize handle' },\n {\n selector: 'button[class*=\"newSession\"]',\n attrs: [['data-dsh-part', 'new-session']],\n note: 'sidebar new-session action (compat seam shields skins from localized labels)',\n },\n // ---- plugin roots (plugins without stable anchors opt in via AGENTS.md) ----\n {\n selector: '[data-dsh-taskboard-view], [data-dsh-taskboard-board]',\n attrs: [['data-dsh-plugin', 'task-board']],\n note: 'task-board panel/board (the sidebar row is shell-owned: its glyph carries data-dsh-panel-entry and the family rule below stamps the row)',\n },\n {\n selector: '[data-dsh-ssh-view]',\n attrs: [['data-dsh-plugin', 'ssh']],\n note: 'ssh panel (the sidebar row is shell-owned: its glyph carries data-dsh-panel-entry and the family rule below stamps the row)',\n },\n {\n selector: '[data-gitgraph-chip-anchor], [data-gitgraph-dialog]',\n attrs: [['data-dsh-plugin', 'git-graph']],\n note: 'git-graph chip/dialog',\n },\n {\n selector: '[data-dsh-pet-root]',\n attrs: [['data-dsh-plugin', 'pet']],\n note: 'pet global root',\n },\n // ---- family parts ----\n {\n selector: '[class*=\"panelRow\"]:has([data-dsh-panel-entry])',\n attrs: [['data-dsh-part', 'sidebar-entry']],\n note: 'a plugin-registered sidebar row (sidebar.panellist): the shell owns the row box and stamps no hook of its own, so the row is recognised by its css-module class plus the glyph identity the registering plugin outputs — same compat technique as newSession',\n },\n]\n\n/**\n * The anchors the rule table keys on, as one attribute filter for the\n * observer: a glyph or row anchor that is SET on an element already in the\n * tree must re-anchor its ancestors exactly like a newly inserted one.\n */\nconst ANCHOR_ATTRIBUTES: readonly string[] = [\n 'data-dsh-panel-entry',\n 'data-dsh-surface',\n 'data-dsh-part',\n 'data-dsh-plugin',\n 'data-slot',\n 'data-chat-flow-kind',\n 'data-conversation-scroll',\n 'data-turn-tail',\n 'data-composer-input',\n 'data-queue-dock',\n 'data-rightbar-col',\n 'data-shell-overlay',\n 'data-dsh-taskboard-view',\n 'data-dsh-taskboard-board',\n 'data-dsh-ssh-view',\n 'data-dsh-pet-root',\n 'data-gitgraph-chip-anchor',\n 'data-gitgraph-dialog',\n 'data-decoration',\n 'data-streaming',\n 'data-side',\n 'data-phase',\n]\n// 'class' is deliberately absent: React sets className when it creates the\n// element, so a row whose class matters already carries it when the childList\n// record arrives, and class toggles are by far the most frequent attribute\n// traffic on the page. The filter stays on identity anchors.\n\n/**\n * Selector shapes whose verdict depends on the element's DESCENDANTS or on\n * its position among its siblings, rather than on the element alone.\n *\n * Everything outside this list is \"self-only\": inserting a descendant cannot\n * change whether the element itself matches. Splitting the table on that\n * boundary is what keeps the ancestor walk cheap without weakening what the\n * walk is FOR (issue #1732) — re-anchoring an ANCESTOR when a late descendant\n * turns out to be the anchor that ancestor keys on.\n */\nconst DESCENDANT_SENSITIVE_PSEUDO = /:has\\(|:empty|:first-child|:last-child|:only-child|:first-of-type|:last-of-type|:only-of-type|:nth-/\n\n/**\n * Attribute names a selector references. Deliberately a plain scan of the\n * bracket contents rather than a parsed selector: it also finds a reference\n * nested INSIDE a functional pseudo-class, which is what lets\n * `[role=\"dialog\"]:has([data-slot=\"settings.section\"])` answer to a late\n * data-slot flip on an element inside the dialog.\n */\nconst SELECTOR_ATTRIBUTE = /\\[([A-Za-z0-9_-]+)/g\n\nconst attributeReferences = (selector: string): ReadonlySet<string> => {\n const names = new Set<string>()\n for (const found of selector.matchAll(SELECTOR_ATTRIBUTE)) names.add(found[1])\n return names\n}\n\ninterface RuleTraits {\n /** True when a descendant or sibling change can flip this rule's verdict. */\n readonly descendantSensitive: boolean\n /** Every attribute the selector names, functional pseudo-classes included. */\n readonly attributes: ReadonlySet<string>\n}\n\n/**\n * Rule traits derived from the selector text ONCE, at module load, never per\n * element. The classification is what every batching decision below reads;\n * re-deriving it inside the walk would reintroduce exactly the per-node work\n * this change removes (issue #1870).\n */\nconst RULE_TRAITS: readonly RuleTraits[] = SEMANTIC_RULES_V1.map((rule) => ({\n descendantSensitive: DESCENDANT_SENSITIVE_PSEUDO.test(rule.selector),\n attributes: attributeReferences(rule.selector),\n}))\n\n/**\n * Safety bound of the ancestor walk, NOT a depth ceiling.\n *\n * The walk's normal terminator is the observed root: every node the observer\n * can report is inside document.body, so the walk returns there (measured —\n * with this bound removed the walk still stops at body on every delivery).\n * This constant only fires for a change inside a subtree that is not connected\n * to the observed root at all, where there is no ancestor to anchor yet and\n * the node's own childList delivery stamps it once it IS attached.\n *\n * It is deliberately far above any real markup depth (the shell's own sidebar\n * row is three hops deep) instead of a small number that would silently leave\n * a deeper row unanchored — which is the very defect this walk exists to fix\n * (issue #1732). A measured sweep anchors through 23 wrapper levels and misses\n * from 24, i.e. only past the point where the tree is pathological.\n *\n * Narrowing WHICH rules a hop applies does not make the hop count safe to drop\n * (issue #1870): a childList record only ever flips a descendant-sensitive\n * rule, and an attributes record only the rules naming the attribute that\n * actually changed, so a hop now costs one matches() call per APPLICABLE rule\n * instead of one per rule in the table. The bound stays as the backstop it has\n * always been.\n */\nconst ANCESTOR_HOPS = 24\n\nexport interface SemanticAdapterDiagnostics {\n /** Rules whose selector the engine rejects (dropped, never retried). */\n invalidRules: string[]\n /** Rules that matched zero elements in the latest full pass. */\n unmatchedRules: string[]\n /** Total attributes stamped since start. */\n stamped: number\n}\n\nexport interface SemanticAdapter {\n start(): void\n stop(): void\n diagnostics(): SemanticAdapterDiagnostics\n readonly running: boolean\n}\n\ninterface LiveRule extends RuleTraits {\n rule: SemanticRule\n /** False once the engine rejected the selector. */\n usable: boolean\n /** Elements matched in the latest full pass. */\n matchedInPass: number\n}\n\nexport function createSemanticAdapter(doc: Document): SemanticAdapter {\n const rules: LiveRule[] = SEMANTIC_RULES_V1.map((rule, index) => ({\n rule,\n usable: true,\n matchedInPass: 0,\n descendantSensitive: RULE_TRAITS[index].descendantSensitive,\n attributes: RULE_TRAITS[index].attributes,\n }))\n /**\n * The subset a childList delivery may walk: inserting a descendant can flip\n * a descendant-sensitive rule on an ancestor and nothing else. A self-only\n * ancestor was already rule-checked when it was added (or by fullPass), and\n * its verdict cannot change because something inside it grew, so\n * re-evaluating it is the cost, not the correctness, of the walk.\n */\n const descendantSensitiveRules: readonly LiveRule[] = rules.filter((live) => live.descendantSensitive)\n let observer: MutationObserver | null = null\n let stamped = 0\n let running = false\n\n const applyRule = (live: LiveRule, el: Element): void => {\n if (!live.usable) return\n let hit = false\n try {\n hit = el.matches(live.rule.selector)\n } catch {\n live.usable = false\n return\n }\n if (!hit) return\n live.matchedInPass += 1\n for (const [name, value] of live.rule.attrs) {\n if (el.getAttribute(name) !== value) {\n el.setAttribute(name, value)\n stamped += 1\n }\n }\n }\n\n const applyToTree = (rootEl: Element): void => {\n for (const live of rules) {\n if (!live.usable) continue\n applyRule(live, rootEl)\n let matches: Element[] = []\n try {\n matches = Array.from(rootEl.querySelectorAll(live.rule.selector))\n } catch {\n live.usable = false\n continue\n }\n for (const el of matches) applyRule(live, el)\n }\n }\n\n const fullPass = (): void => {\n for (const live of rules) live.matchedInPass = 0\n if (doc.documentElement) applyToTree(doc.documentElement)\n }\n\n /**\n * Re-anchor one changed node's ancestor chain with the rules that change\n * could actually have flipped.\n *\n * applyToTree only walks DOWNWARD: a rule whose selector matches an ancestor\n * of the changed node (the panel-list row is recognised by the glyph INSIDE\n * it) is never re-evaluated when that descendant arrives. React mounts the\n * row first and the registering plugin's glyph a tick later, so without this\n * the row keeps no anchor at all until something forces a full pass\n * (issue #1732). The walk is bounded, stops at the document root, and\n * carries only the rules the reported change can flip: the caller's batch has\n * already deduplicated the hops it shares with sibling records, so a hop\n * costs one matches() call per applicable rule, not one per rule in the table\n * (issue #1870).\n */\n const reanchorAncestors = (node: Element, subset: readonly LiveRule[]): void => {\n if (subset.length === 0) return\n const root = doc.body ?? doc.documentElement\n let current: Element | null = node\n for (let hop = 0; current !== null && hop <= ANCESTOR_HOPS; hop += 1) {\n for (const live of subset) {\n if (live.usable) applyRule(live, current)\n }\n // Stop at the observed root: going further cannot reach a node the\n // observer is even watching, and body is the ceiling it was given.\n if (current === root || current === doc.documentElement) return\n current = current.parentElement\n }\n }\n\n /**\n * Drop added roots that another root of the same delivery already contains:\n * applyToTree on the containing root scans the nested one as part of its own\n * subtree, and the containing root's own ancestor walk covers the nested\n * root's ancestors, so re-scanning it is pure duplicate work. Membership is a\n * Set probe per ancestor hop — no selector-engine call — which keeps a\n * delivery that mounts a whole subtree at once linear in that subtree.\n */\n const topmostRoots = (roots: ReadonlySet<Element>): Element[] => {\n const kept: Element[] = []\n for (const candidate of roots) {\n let parent = candidate.parentElement\n let nested = false\n while (parent !== null) {\n if (roots.has(parent)) {\n nested = true\n break\n }\n if (parent === doc.documentElement) break\n parent = parent.parentElement\n }\n if (!nested) kept.push(candidate)\n }\n return kept\n }\n\n return {\n get running() {\n return running\n },\n\n start() {\n if (running) return\n running = true\n fullPass()\n observer = new doc.defaultView!.MutationObserver((records) => {\n try {\n // The delivery is collected BEFORE any rule runs. Records of one\n // batch share ancestors and even targets, and re-walking them once\n // per record is what turned a session switch into tens of thousands\n // of matches() calls (issue #1870).\n const roots = new Set<Element>()\n const byAttribute = new Map<string, Set<Element>>()\n for (const record of records) {\n if (record.type === 'attributes') {\n // Only a rule that NAMES the attribute can flip because of it.\n // No rule in the table names the attributes the adapter itself\n // stamps, so every stamp it writes is an echo that now costs\n // zero rule evaluations instead of a full ancestor walk.\n const target = record.target.nodeType === 1 ? record.target as Element : null\n const name = record.attributeName\n if (target === null || name === null) continue\n const seen = byAttribute.get(name)\n if (seen === undefined) byAttribute.set(name, new Set([target]))\n else seen.add(target)\n continue\n }\n if (record.type !== 'childList') continue\n for (const node of Array.from(record.addedNodes)) {\n if (node.nodeType !== 1) continue\n roots.add(node as Element)\n }\n }\n\n // An added root keeps the full treatment, unchanged: every rule on\n // the root itself and on its whole subtree. Only the walk ABOVE it\n // is narrowed.\n for (const root of topmostRoots(roots)) {\n applyToTree(root)\n // The added subtree may itself be the glyph a row wants; the row\n // is an ANCESTOR of it and applyToTree never looks up (#1732).\n reanchorAncestors(root.parentElement ?? root, descendantSensitiveRules)\n }\n\n // A glyph whose ANCHOR is set on an element already in the tree (a\n // re-render that flips the attribute instead of replacing the node)\n // is the same signal, and childList alone never sees it.\n for (const [name, targets] of byAttribute) {\n const onTarget: LiveRule[] = []\n const onAncestors: LiveRule[] = []\n for (const live of rules) {\n if (!live.attributes.has(name)) continue\n onTarget.push(live)\n // An ancestor's verdict can only change when the rule reads\n // through the descendant that just changed its attribute.\n if (live.descendantSensitive) onAncestors.push(live)\n }\n if (onTarget.length === 0) continue\n for (const target of targets) {\n for (const live of onTarget) applyRule(live, target)\n reanchorAncestors(target.parentElement ?? target, onAncestors)\n }\n }\n } catch {\n // Fail-closed: a tagging error must never break the host page.\n }\n })\n observer.observe(doc.body ?? doc.documentElement, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: [...ANCHOR_ATTRIBUTES],\n })\n },\n\n stop() {\n running = false\n observer?.disconnect()\n observer = null\n },\n\n diagnostics() {\n return {\n invalidRules: rules.filter((r) => !r.usable).map((r) => r.rule.selector),\n unmatchedRules: rules.filter((r) => r.usable && r.matchedInPass === 0).map((r) => r.rule.selector),\n stamped,\n }\n },\n }\n}\n","/**\n * Shared shell rendering corrections for every visual mode owned by the skin\n * center (issue #954). The official shell exposes stable slot / composer\n * anchors, while the workspace-list fade itself is still a CSS-module class.\n * Keep that fallback scoped below sidebar.workspaces so an unrelated animation\n * or overlay whose class contains \"fade\" is never affected.\n *\n * The stylesheet is inert for the stock look: a catalog skin or a custom theme\n * must be active. The wallpaper mode left this adapter with the built-in\n * Wallpaper Engine bridge (issue #39): the delegated plugin owns the shell\n * corrections for its own backdrop, and this plugin's visual work stands down\n * entirely while that plugin renders. The sheet is installed once per runtime\n * and removed with that runtime, so disabling the plugin restores the shell\n * unchanged.\n * @module @linxin666/dsh-client-ui-skin-center/runtime/shell-rendering\n */\n\n/** Marker owned by the shared shell-rendering stylesheet. */\nexport const SHELL_RENDERING_STYLE_ATTR = 'data-dsh-shell-rendering'\n\n/** Fallback composer seat height for scrollport bottom clearance (px). */\nexport const DEFAULT_COMPOSER_CLEARANCE_PX = 100\n\nconst ACTIVE_VISUAL_SELECTOR = [\n 'html[data-dsh-skin]',\n 'html[data-dsh-custom-theme]:not([data-dsh-skin])',\n].join(', ')\n\nconst COMPOSER_SEAT_SELECTORS = [\n '[data-slot=\"conversation.composer\"]',\n '[data-composer-seat]',\n '[data-dsh-surface=\"composer\"]',\n]\n\n/** Build the inert-by-default public rendering corrections. */\nexport function shellRenderingCss(): string {\n const scopes = ACTIVE_VISUAL_SELECTOR.split(', ')\n const scoped = (selector: string): string => scopes.map(scope => `${scope} ${selector}`).join(',\\n')\n /* A body child that owns a full-viewport box is the one case where every\n head above is wrong: these are host shells, not skin paint. ${scoped(...)}\n would keep the guard inert exactly where the defect lives (the stock\n install), so this block stays unscoped on purpose. */\n return `\n /* macOS window-drag guard. The official base stylesheet turns every DIRECT\n body child into a \"-webkit-app-region: no-drag\" region (its selector\n spares only the app's own root element), so a body-level element that\n spans the viewport subtracts the whole window from the macOS draggable\n region and cancels the official [data-window-drag] chrome rows with it:\n the window can no longer be dragged by its title area, and macOS no\n longer runs the system double-click action (zoom to fit the screen)\n there. \"pointer-events: none\" does not exempt an element from that\n computation - only a declaration of its own does.\n\n Every element in the list is a shell this runtime mounts as a body\n child and declares non-interactive, so the guard has to be inline here\n rather than imported from the aggregate patch layer (#1907): a\n standalone install of the skin center never loads that layer, and the\n decoration layers below are mounted for the stock look too, which is\n why this rule is NOT scoped under the active-visual heads above.\n\n - [data-dsh-skin-layer]: the six fixed decoration layers\n (runtime/decoration-layers.ts);\n - [data-dsh-composer-frost]: the composer frost follower\n (runtime/backdrop-scene.ts);\n - [aria-hidden=\"true\"]: the skin backdrop-filter veil, which carries no\n data hook of its own (client/background.ts).\n\n \"initial\" is the initial value (\"none\"), which leaves the element and\n its whole subtree out of the app-region computation; the declaration\n must be !important because the official selector outranks this one. */\n html[data-platform=\"darwin\"] body > :is(\n [data-dsh-skin-layer],\n [data-dsh-composer-frost],\n [aria-hidden=\"true\"]\n ) {\n -webkit-app-region: initial !important;\n }\n /* Viewport lock: prevent outer page scrollbar and viewport\n displacement during element focus/scrollIntoView. */\n ${ACTIVE_VISUAL_SELECTOR},\n ${scoped('body')} {\n height: 100% !important;\n width: 100% !important;\n overflow: hidden !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n ${scoped('[data-slot=\"sidebar.workspaces\"] [class*=\"_fade\"]')} {\n background: none !important;\n background-image: none !important;\n }\n ${scoped('[data-composer-card] textarea[data-phase]::placeholder')},\n ${scoped('textarea[data-dsh-part=\"composer-input\"]::placeholder')} {\n color: var(--dsw-alias-label-secondary, var(--dsw-alias-label-caption)) !important;\n -webkit-text-fill-color: var(--dsw-alias-label-secondary, var(--dsw-alias-label-caption)) !important;\n opacity: 1 !important;\n }\n ${scoped('[data-phase=\"active\"] [data-slot=\"conversation.input.dock\"] > *')},\n ${scoped('[data-phase=\"active\"] [data-slot=\"conversation.composer.dock\"] > *')},\n ${scoped('[data-phase=\"active\"] [data-slot=\"conversation.composer.dock\"] + *')} {\n /* One skin-driven accessory surface for task and statistics docks. Skins\n automatically follow their existing semantic theme tokens and may\n override the --dsh-composer-accessory-* variables for a stronger\n signature without coupling this adapter to a specific catalog skin.\n\n The third head covers an accessory that is a SIBLING of the dock slot\n host rather than a child of it. The slot host is display: contents, so\n the shell lays its children out as items of the surrounding dock row\n and the child heads reach them; 0.1.7's context meter was placed beside\n that host instead of inside it, so it shared the row with the\n statistics pill but stayed bare (issue #1715) -- one line, two looks.\n The adjacent-sibling head keeps the row uniform without naming any\n hashed class or localized label, and covers whatever future accessory\n the shell seats next to the dock. The plate lands on the accessory's\n own seat, never on a trigger inside it, so a component's own hover\n feedback keeps painting on top. */\n background: var(--dsh-composer-accessory-bg, var(--dsw-specific-tip, var(--dsw-alias-bg-layer-1))) !important;\n color: var(--dsh-composer-accessory-color, var(--dsw-alias-label-tertiary)) !important;\n border: var(--dsh-composer-accessory-border, none) !important;\n border-radius: var(--dsh-composer-accessory-radius, 12px) !important;\n box-shadow: var(--dsh-composer-accessory-shadow, var(--dsw-shadow-lv1, 0 2px 10px rgba(7, 20, 38, 0.18)));\n backdrop-filter: blur(var(--dsh-composer-accessory-blur, var(--dsh-input-card-blur, 10px))) !important;\n -webkit-backdrop-filter: blur(var(--dsh-composer-accessory-blur, var(--dsh-input-card-blur, 10px))) !important;\n }\n ${scoped('[data-phase=\"active\"] [data-slot=\"conversation.composer.dock\"] > *')},\n ${scoped('[data-phase=\"active\"] [data-slot=\"conversation.composer.dock\"] + *')} {\n /* Same metrics for a dock child and for the sibling seat beside the dock\n slot host, so the two accessories of one row end up the same height:\n the plate must not make one of them look like a different control. */\n margin-top: var(--dsh-composer-accessory-gap, 4px);\n margin-bottom: var(--dsh-composer-accessory-gap, 4px);\n padding-top: 2px;\n padding-bottom: 2px;\n }\n ${scoped('[data-slot=\"conversation.input.dock\"] > [data-goal-bar=\"true\"][data-goal-bar=\"true\"][data-goal-bar=\"true\"]')} {\n /* The host goal dock spans the full composer seat and contains its own\n centered compact bar. Do not paint the outer dock as an accessory: that\n creates a viewport-wide veil behind the active-goal chip. The repeated\n stable marker deliberately raises specificity above catalog-skin dock\n selectors that load after this shared adapter. */\n background: transparent !important;\n border: 0 !important;\n border-radius: 0 !important;\n box-shadow: none !important;\n backdrop-filter: none !important;\n -webkit-backdrop-filter: none !important;\n }\n ${scoped('[data-phase=\"active\"] [data-slot=\"conversation.input.dock\"] > [data-queue-dock]')} {\n /* The native queue dock stacks two boxes inside the input dock: a root\n wrapper that only supplies the shared dock inset, and the panel inside\n it that paints its own --dsw-specific-tip fill. Painting the wrapper as\n an accessory adds a second opaque plate one dock inset (8px) wider than\n the panel on each side, which reads as an extra sheet of paper under\n the queue (issue #1572). Reset the accessory surface so the panel stays\n the single layer; the wrapper keeps its inset, so the panel remains\n aligned with the composer card. */\n background: transparent !important;\n border: 0 !important;\n border-radius: 0 !important;\n box-shadow: none !important;\n backdrop-filter: none !important;\n -webkit-backdrop-filter: none !important;\n }\n ${scoped('[data-phase=\"active\"] [data-slot=\"conversation.composer.dock\"] + *')} {\n /* Dropping blur on the sibling seat only (issue #1757 / dsh-skins#21). The\n adjacent sibling head added for #1715 lands on ContextMeter's seat\n (span.JObwrW_root). A non-none backdrop-filter makes that seat the\n containing block for its position:fixed descendants, causing its hover\n tooltip and click-open panel to resolve against the seat instead of the\n viewport and push 740px+ horizontal scrollable overflow into the\n conversation scrollport (causing scrollbar flicker on mouse enter/leave).\n The seat's background (--dsh-composer-accessory-bg, default --dsw-specific-tip)\n is fully opaque, so the blur on that element is invisible anyway and\n dropping it restores viewport positioning with zero visual change. */\n backdrop-filter: none !important;\n -webkit-backdrop-filter: none !important;\n }\n ${scoped('[data-conversation-scroll]')},\n ${scoped('[data-dsh-part=\"scrollport\"]')} {\n /* The composer is the scrollport's final in-flow child. Reserving physical\n padding after it lifts the active dock by one composer height and also\n shifts the hero above center. */\n padding-bottom: 0 !important;\n }\n /* #978 / #1133: Line-level scroll-margin retains scrollIntoView() clearance\n above the sticky composer without placing a scrollport-level scroll-padding\n that breaks browser caret-reveal geometry (which caused micro-scrolling on\n every keystroke while reading history). */\n ${scoped('[data-conversation-scroll] [data-chat-anchor-key]')},\n ${scoped('[data-conversation-scroll] [data-chat-flow-kind]')},\n ${scoped('[data-conversation-scroll] [data-dsh-part=\"message-row\"]')},\n ${scoped('[data-conversation-scroll] [data-turn-tail]')},\n ${scoped('[data-conversation-scroll] [class*=\"_userRow\"]')},\n ${scoped('[data-conversation-scroll] [class*=\"_compactionRow\"]')},\n ${scoped('[data-conversation-scroll] [class*=\"_contextRow\"]')},\n ${scoped('[data-conversation-scroll] [class*=\"_turnErrorRow\"]')} {\n scroll-margin-bottom: var(--dsh-composer-height, ${DEFAULT_COMPOSER_CLEARANCE_PX}px) !important;\n }\n /* dsh 0.1.7 turned the right sidebar panel shell into an always-mounted,\n always-visible positioning box (only its inner dockkit surfaces hide\n while the panel is closed). Skin rules written for the older shell plate\n that shell element and, with the panel closed, cover the conversation\n area with a phantom column. Strip paint from the closed shell whatever\n the active skin; an open panel ([data-sidebar-right-open]) keeps every\n skin paint. The attribute predates the layout change, so the rule is a\n no-op on older shells. */\n ${scoped('[data-slot=\"rightbar.session\"] > [data-sidebar-right-panel]:not([data-sidebar-right-open])')} {\n background: none !important;\n background-color: transparent !important;\n background-image: none !important;\n border-color: transparent !important;\n box-shadow: none !important;\n }\n /* #1117: The upstream recommended badge pairs two background-fill tokens\n as bg + text — in dark mode, skins like Blue Fantasy collapse them to\n near-identical dark navy values (contrast ~1:1). Override the text\n color to a readable foreground and tweak the background for contrast.\n The dark-theme attribute lives on <body>, so it belongs inside the\n scoped selector: prefixing the already-scoped list produced\n \"body ... html ...\", a descendant chain that can never match (#1490). */\n ${scoped('body[data-ds-dark-theme] [data-question-key] [class*=\"_badge\"]')},\n ${scoped('body[data-ds-dark-theme] [data-question-scroll] [class*=\"_badge\"]')} {\n color: var(--dsw-alias-label-primary, #ffffff) !important;\n background: var(--dsw-alias-interactive-bg-active, color-mix(in srgb, var(--dsw-alias-button-info-fill, #4a5fa8) 50%, transparent)) !important;\n }\n `\n}\n\n/** Install the shared corrections and return their idempotent teardown. */\nexport function installShellRenderingAdapter(doc: Document): () => void {\n if (doc.head === null) return () => {}\n const existing = doc.head.querySelector<HTMLStyleElement>(`style[${SHELL_RENDERING_STYLE_ATTR}]`)\n if (existing !== null) return () => {}\n\n const style = doc.createElement('style')\n style.setAttribute(SHELL_RENDERING_STYLE_ATTR, '')\n style.textContent = shellRenderingCss()\n doc.head.appendChild(style)\n\n const win = doc.defaultView\n try { win?.scrollTo?.(0, 0) } catch {}\n const composerSelector = COMPOSER_SEAT_SELECTORS.join(', ')\n let resizeObserver: ResizeObserver | null = null\n let mutationObserver: MutationObserver | null = null\n let observedComposer: Element | null = null\n let appliedHeight = ''\n let scheduledFrame: number | null = null\n let disposed = false\n\n // The shell mounts one composer seat per conversation; keep the resolved\n // element while it stays connected instead of re-querying the body for every\n // mutation batch (issue #954 follow-up: streaming produced many queries/s).\n const resolveComposer = (): Element | null => {\n if (observedComposer !== null && observedComposer.isConnected) return observedComposer\n return doc.body === null ? null : doc.body.querySelector(composerSelector)\n }\n\n const syncHeight = (): void => {\n if (doc.body === null) return\n const composer = resolveComposer()\n if (composer === null) return\n if (observedComposer !== composer) {\n if (observedComposer !== null && resizeObserver !== null) {\n resizeObserver.unobserve(observedComposer)\n }\n observedComposer = composer\n if (resizeObserver !== null) {\n resizeObserver.observe(composer)\n }\n }\n const rect = composer.getBoundingClientRect()\n if (rect.height <= 0) return\n const root = doc.documentElement\n const next = `${Math.ceil(rect.height)}px`\n // Skip the custom-property write (and its forced style invalidation) while\n // the measured height still matches what is already applied.\n if (next === appliedHeight || root === null) return\n appliedHeight = next\n root.style.setProperty('--dsh-composer-height', next)\n }\n\n // Coalesce mutation bursts into at most one measure/write per frame; the\n // disposer cancels whatever is still scheduled.\n const scheduleSync = (): void => {\n if (scheduledFrame !== null || disposed) return\n if (win === null || typeof win.requestAnimationFrame !== 'function') {\n syncHeight()\n return\n }\n scheduledFrame = win.requestAnimationFrame(() => {\n scheduledFrame = null\n if (disposed) return\n syncHeight()\n })\n }\n\n if (win !== null && typeof win.ResizeObserver === 'function') {\n resizeObserver = new win.ResizeObserver(() => syncHeight())\n }\n\n if (win !== null && typeof win.MutationObserver === 'function' && doc.body !== null) {\n mutationObserver = new win.MutationObserver(() => scheduleSync())\n mutationObserver.observe(doc.body, { childList: true, subtree: true })\n }\n\n syncHeight()\n\n return () => {\n if (disposed) return\n disposed = true\n if (scheduledFrame !== null) {\n if (win !== null && typeof win.cancelAnimationFrame === 'function') win.cancelAnimationFrame(scheduledFrame)\n scheduledFrame = null\n }\n if (resizeObserver !== null) {\n resizeObserver.disconnect()\n resizeObserver = null\n }\n if (mutationObserver !== null) {\n mutationObserver.disconnect()\n mutationObserver = null\n }\n observedComposer = null\n appliedHeight = ''\n doc.documentElement?.style.removeProperty('--dsh-composer-height')\n style.remove()\n }\n}\n","/**\n * Unified \"backdrop visible\" scene marker (issue #777).\n *\n * A skin with painted background media or a mounted Wallpaper Engine\n * wallpaper both put real backdrop art behind the app. The two runtime\n * controllers (skin-controller and wallpaper) report their mount state\n * through setSceneBackdropActive(); this module folds them into ONE body /\n * html marker `data-dsh-backdrop-active` and installs the shared composer\n * seat neutralizer that keys on it.\n *\n * The shell's active composer seat paints a bottom occlusion gradient under\n * the sticky input card (rc.8: a linear gradient to --dsw-alias-bg-base,\n * z-index 7). Backdrop scenes intentionally remove that seat-wide gradient in\n * both active and hero phases so wallpaper art remains unobstructed down to the\n * viewport edge. Skin-provided seat-wide ::before masks are neutralized too.\n * Composer task/statistics surfaces are styled by the shared shell adapter\n * from skin theme tokens, not by this scene layer.\n *\n * The input card itself ([data-composer-card], the official shell's stable card\n * anchor) keeps its translucent tint and gains the configurable backdrop blur\n * (default INPUT_FROST_BLUR_PX).\n *\n * The card rule is enabled only while the conversation actually has message\n * content (data-dsh-conversation-content): an empty conversation has no正文 to\n * occlude, so the input keeps its normal hero appearance without a frost flash.\n * The strength is provided by --dsh-input-card-blur and falls back to the\n * compatibility default when the setting has not loaded yet.\n *\n * The marker is body/html level (managed outside the surface/part/plugin\n * enum, see contracts/semantic-attrs-v1.md) and survives a neutralizer\n * teardown; the style is inert whenever the marker is absent.\n * @module @linxin666/dsh-client-ui-skin-center/runtime/backdrop-scene\n */\n\n/** Shared marker: set on html + body while a source reports backdrop art. */\nexport const BACKDROP_ACTIVE_ATTR = 'data-dsh-backdrop-active'\n\n/** The shared composer-seat neutralizer style's own attribute. */\nexport const SCENE_NEUTRALIZER_ATTR = 'data-dsh-scene-neutralizer'\n\n/**\n * Attribute of the composer frost follower: a body-level, fixed, empty element\n * sized to the input card's border box while a scene is active.\n *\n * It exists because the frost must NOT be painted on the card. A non-none\n * backdrop-filter (like transform, filter, contain or perspective) makes an\n * element the CONTAINING BLOCK for its fixed-position descendants, and the\n * official shell renders its tooltips inside the composer card: the composer\n * send arrow's bubble is position: fixed, so with the frost on the card it\n * resolved its viewport coordinates against the card, landed far outside it\n * but still inside the conversation scrollport, added its own height to\n * scrollHeight, and every hover clamped the scroll to the new bottom — the\n * whole conversation jumped by hundreds of pixels and snapped back on the\n * next frame (issue #1724). Documented throughout the catalog skins as the\n * reason a card ancestor never carries a filter.\n *\n * A body-level sibling is not an ancestor of the card, so it may carry the\n * blur; because nested backdrop-filters do not compose, the card itself must\n * stay filter-free for the follower's blur to read through its translucent\n * fill. The element is empty and pointer-events:none, and it is a sibling of\n * the app root, never inside the scrollport.\n */\nexport const COMPOSER_FROST_ATTR = 'data-dsh-composer-frost'\n\n/** Stacking rung of the follower: above the skin art layers, below the shell. */\nconst COMPOSER_FROST_Z_INDEX = '-1'\n\n/** Conversation-content marker: set while the active conversation has rows. */\nexport const CONVERSATION_CONTENT_ATTR = 'data-dsh-conversation-content'\n\n/**\n * Stable shell scrollport scoped row selectors. Official builds emit the chat\n * anchor; the CSS-module suffix fallbacks retain compatibility with older\n * shells without returning to a body-wide topic/session query.\n */\nconst ACTIVE_CONVERSATION_CONTENT_SELECTOR = [\n '[data-conversation-scroll] [data-chat-anchor-key]',\n '[data-conversation-scroll] [class*=\"_userRow\"]',\n '[data-conversation-scroll] [class*=\"_compactionRow\"]',\n '[data-conversation-scroll] [class*=\"_contextRow\"]',\n '[data-conversation-scroll] [class*=\"_turnErrorRow\"]',\n].join(', ')\n\n/**\n * One source that can make backdrop art visible.\n *\n * Only `skin` reports through this module now: the wallpaper source belongs\n * to the delegated `dsh-plugin-wallpaper-engine`, which paints its own glass\n * and its own backdrop. Its presence is reported through\n * {@link setComposerFrostSuppressed} instead of the marker, because the skin\n * center must not claim the wallpaper's scene.\n */\nexport type BackdropSource = 'skin' | 'wallpaper'\n\n/**\n * Documents whose composer frost is suppressed by an external owner.\n *\n * The delegated wallpaper plugin paints a fixed frosted composer of its own,\n * and two fixed `backdrop-filter` stacks sample a shell the other one relaid,\n * so the skin center must not add a second one. A plain flag (rather than the\n * backdrop marker) keeps the two concerns apart: suppressing the frost must\n * not retract the skin's own backdrop marker or the seat neutralizer, which\n * the skin still needs.\n */\nconst frostSuppressed = new WeakSet<Document>()\n\n/**\n * Suppress (or restore) the composer frost follower for one document.\n *\n * Called by the external-plugin interop watcher while\n * `body[data-we-wallpaper]` is present. Idempotent, and it re-evaluates the\n * follower immediately, so the suppression applies even when the backdrop and\n * conversation markers are unchanged.\n * @param doc - the document whose frost is gated.\n * @param suppressed - true while an external owner paints the composer glass.\n */\nexport function setComposerFrostSuppressed(doc: Document, suppressed: boolean): void {\n if (suppressed) frostSuppressed.add(doc)\n else frostSuppressed.delete(doc)\n syncComposerFrost(doc)\n}\n\n/** Compatibility default for the input-card backdrop blur strength (px). */\nexport const INPUT_FROST_BLUR_PX = 10\n\nconst sourceSets = new WeakMap<Document, Set<BackdropSource>>()\nconst contentObservers = new WeakMap<Document, MutationObserver>()\nconst contentFrames = new WeakMap<Document, number>()\n\n/** Write a marker attribute only when the desired state is not applied yet. */\nfunction applyMarker(el: Element | null, attr: string, active: boolean): void {\n if (el === null) return\n if (active) {\n if (el.getAttribute(attr) !== 'true') el.setAttribute(attr, 'true')\n return\n }\n if (el.hasAttribute(attr)) el.removeAttribute(attr)\n}\n\n/**\n * Report one source's backdrop-art presence. The marker stays on while any\n * source is active, so the skin and wallpaper controllers never clobber each\n * other across their mount/unmount cycles.\n */\nexport function setSceneBackdropActive(doc: Document, source: BackdropSource, active: boolean): void {\n let sources = sourceSets.get(doc)\n if (sources === undefined) {\n sources = new Set()\n sourceSets.set(doc, sources)\n }\n if (active) sources.add(source)\n else sources.delete(source)\n syncMarker(doc, sources)\n}\n\n/** Reflect the source set onto html/body and ensure the neutralizer on use. */\nfunction syncMarker(doc: Document, sources: Set<BackdropSource>): void {\n const active = sources.size > 0\n applyMarker(doc.body, BACKDROP_ACTIVE_ATTR, active)\n applyMarker(doc.documentElement, BACKDROP_ACTIVE_ATTR, active)\n if (active) {\n ensureSceneNeutralizer(doc)\n startContentObserver(doc)\n } else {\n stopContentObserver(doc)\n }\n // The frost gate is the marker pair, so every path that changes either one\n // re-evaluates it: a scene mount/unmount, and the conversation-content flip\n // the observer above reports.\n syncComposerFrost(doc)\n}\n\n/**\n * Track whether the active conversation scrollport has message rows for the\n * frost gate. Topic pickers and outgoing session trees can retain their own\n * data-chat-anchor-key nodes during a switch; a body-wide query would count\n * those stale rows and flash the composer frost over the new empty topic.\n */\nfunction updateConversationContent(doc: Document): void {\n const has = doc.body !== null && doc.body.querySelector(ACTIVE_CONVERSATION_CONTENT_SELECTOR) !== null\n applyMarker(doc.body, CONVERSATION_CONTENT_ATTR, has)\n applyMarker(doc.documentElement, CONVERSATION_CONTENT_ATTR, has)\n // The composer frost is gated on this marker, so the flip must reach it.\n syncComposerFrost(doc)\n}\n\n/**\n * Coalesce the mutation bursts of a streaming conversation into one content\n * check per frame; a check scheduled for a document that stopped observing is\n * dropped so a late frame can never re-add the marker after teardown.\n */\nfunction scheduleConversationContent(doc: Document): void {\n if (contentFrames.has(doc)) return\n const win = doc.defaultView\n if (win === null || typeof win.requestAnimationFrame !== 'function') {\n updateConversationContent(doc)\n return\n }\n contentFrames.set(doc, win.requestAnimationFrame(() => {\n contentFrames.delete(doc)\n if (!contentObservers.has(doc)) return\n updateConversationContent(doc)\n }))\n}\n\n/** Observe the conversation tree while a backdrop is visible. */\nfunction startContentObserver(doc: Document): void {\n if (contentObservers.has(doc)) return\n updateConversationContent(doc)\n const win = doc.defaultView\n if (win === null || typeof win.MutationObserver !== 'function') return\n const observer = new win.MutationObserver(() => scheduleConversationContent(doc))\n observer.observe(doc.body ?? doc.documentElement, { childList: true, subtree: true })\n contentObservers.set(doc, observer)\n}\n\n/** Stop the content observer, cancel pending work and drop the marker. */\nfunction stopContentObserver(doc: Document): void {\n const frame = contentFrames.get(doc)\n if (frame !== undefined) {\n const win = doc.defaultView\n if (win !== null && typeof win.cancelAnimationFrame === 'function') win.cancelAnimationFrame(frame)\n contentFrames.delete(doc)\n }\n const observer = contentObservers.get(doc)\n if (observer !== undefined) {\n observer.disconnect()\n contentObservers.delete(doc)\n }\n applyMarker(doc.body, CONVERSATION_CONTENT_ATTR, false)\n applyMarker(doc.documentElement, CONVERSATION_CONTENT_ATTR, false)\n syncComposerFrost(doc)\n}\n\n/**\n * Install the shared composer-seat neutralizer, keyed by head presence so a\n * cleared head (tests) or a re-mount re-creates it. Without the marker the\n * rules are inert, so the style can outlive a single mount without changing\n * any other look.\n *\n * The composer card is deliberately absent from this sheet: its frost rides\n * {@link COMPOSER_FROST_ATTR} instead, because no rule here may put a\n * containing-block property back on the card (issue #1724).\n */\nexport function ensureSceneNeutralizer(doc: Document): void {\n if (doc.head === null) return\n if (doc.head.querySelector(`style[${SCENE_NEUTRALIZER_ATTR}]`) !== null) return\n const style = doc.createElement('style')\n style.setAttribute(SCENE_NEUTRALIZER_ATTR, '')\n style.textContent = `\n html[data-dsh-backdrop-active] [data-composer-seat],\n html[data-dsh-backdrop-active] [data-composer-seat]::before {\n background: none !important;\n backdrop-filter: none !important;\n -webkit-backdrop-filter: none !important;\n }\n html[data-dsh-backdrop-active][data-dsh-conversation-content] [${COMPOSER_FROST_ATTR}] {\n backdrop-filter: blur(var(--dsh-input-card-blur, ${INPUT_FROST_BLUR_PX}px)) !important;\n -webkit-backdrop-filter: blur(var(--dsh-input-card-blur, ${INPUT_FROST_BLUR_PX}px)) !important;\n }\n `\n doc.head.appendChild(style)\n}\n\n/** One observed document's frost follower: the element and its measure loop. */\ninterface FrostFollower {\n el: HTMLElement\n resizeObserver: ResizeObserver | null\n /** The card the resize observer currently watches (a switch replaces it). */\n observed: Element | null\n /** Viewport listener: a window resize moves the card without any mutation. */\n onResize: (() => void) | null\n frame: number | null\n /** Last applied border box, so an unchanged frame writes nothing. */\n applied: string\n}\n\nconst frostFollowers = new WeakMap<Document, FrostFollower>()\n\n/** The composer card the frost tracks, or null while none is mounted. */\nfunction composerCardOf(doc: Document): HTMLElement | null {\n return doc.body === null ? null : doc.body.querySelector<HTMLElement>('[data-composer-card]')\n}\n\n/**\n * Create the follower on first use and keep it sized to the composer card.\n *\n * The element is empty, fixed and inert: it paints nothing of its own, and it\n * receives no pointer events, so it can never take a tap from the composer or\n * the sidebar. Sizing uses one measure per animation frame (the shape\n * shell-rendering.ts uses for the composer height) rather than a per-mutation\n * read, and writes only when the box actually changed.\n */\nfunction syncFrostFollower(doc: Document): void {\n const follower = frostFollowers.get(doc)\n if (follower === undefined) return\n const card = composerCardOf(doc)\n if (card === null) return\n // A conversation switch replaces the composer card; move the observation to\n // the node we now track (this runs inside the coalesced content check).\n if (follower.observed !== card) {\n if (follower.observed !== null) follower.resizeObserver?.unobserve(follower.observed)\n follower.observed = card\n follower.resizeObserver?.observe(card)\n follower.applied = ''\n }\n const rect = card.getBoundingClientRect()\n if (rect.width <= 0 || rect.height <= 0) return\n // The follower paints the card's own shape, including a skin's radius\n // override, so the blurred region never reads as a rectangle behind a\n // rounded card. Read per apply: a skin may change it after mount.\n const radius = doc.defaultView?.getComputedStyle(card).borderRadius ?? ''\n const box = [rect.top, rect.left, rect.width, rect.height, radius]\n .map((value) => typeof value === 'number' ? Math.round(value) : value)\n .join('|')\n if (box === follower.applied) return\n follower.applied = box\n const style = follower.el.style\n style.top = `${Math.round(rect.top)}px`\n style.left = `${Math.round(rect.left)}px`\n style.width = `${Math.round(rect.width)}px`\n style.height = `${Math.round(rect.height)}px`\n style.borderRadius = radius\n}\n\n/** Coalesce a burst of geometry changes into one measurement per frame. */\nfunction scheduleFrostSync(doc: Document): void {\n const follower = frostFollowers.get(doc)\n if (follower === undefined || follower.frame !== null) return\n const win = doc.defaultView\n if (win === null || typeof win.requestAnimationFrame !== 'function') {\n syncFrostFollower(doc)\n return\n }\n follower.frame = win.requestAnimationFrame(() => {\n follower.frame = null\n if (!frostFollowers.has(doc)) return\n syncFrostFollower(doc)\n })\n}\n\n/** Mount the follower while a scene is visible and start tracking the card. */\nfunction startFrostFollower(doc: Document): void {\n if (frostFollowers.has(doc) || doc.body === null) return\n const el = doc.createElement('div')\n el.setAttribute(COMPOSER_FROST_ATTR, '')\n el.setAttribute('aria-hidden', 'true')\n const style = el.style\n style.position = 'fixed'\n style.pointerEvents = 'none'\n style.zIndex = COMPOSER_FROST_Z_INDEX\n style.borderRadius = 'inherit'\n const follower: FrostFollower = { el, resizeObserver: null, observed: null, onResize: null, frame: null, applied: '' }\n // A body-level sibling, appended after the app root so the shell's own\n // layers (and any skin decoration) keep their place; the rung above decides\n // paint order, not the append position.\n doc.body.appendChild(el)\n frostFollowers.set(doc, follower)\n const win = doc.defaultView\n if (win !== null && typeof win.ResizeObserver === 'function') {\n follower.resizeObserver = new win.ResizeObserver(() => scheduleFrostSync(doc))\n }\n if (win !== null && typeof win.addEventListener === 'function') {\n follower.onResize = () => scheduleFrostSync(doc)\n win.addEventListener('resize', follower.onResize)\n }\n syncFrostFollower(doc)\n}\n\n/** Remove the follower and stop every loop that fed it. */\nfunction stopFrostFollower(doc: Document): void {\n const follower = frostFollowers.get(doc)\n if (follower === undefined) return\n frostFollowers.delete(doc)\n const win = doc.defaultView\n // Cancel whatever is queued BEFORE the element goes: a frame that still held\n // a reference would otherwise re-apply a box to a detached node.\n if (follower.frame !== null && win !== null && typeof win.cancelAnimationFrame === 'function') {\n win.cancelAnimationFrame(follower.frame)\n follower.frame = null\n }\n follower.resizeObserver?.disconnect()\n follower.resizeObserver = null\n if (follower.onResize !== null) {\n win?.removeEventListener('resize', follower.onResize)\n follower.onResize = null\n }\n follower.el.remove()\n}\n\n/**\n * Attach the composer frost to the current scene state. Called from the shared\n * marker sync so the follower exists exactly while a backdrop is visible and\n * the conversation has content — the same gate the card's old frost rule used.\n *\n * The follower tracks the card through a ResizeObserver on the card itself and\n * one interval-free re-schedule on every re-mount, so a conversation switch\n * that replaces the composer keeps the frost aligned without a polling loop.\n */\nexport function syncComposerFrost(doc: Document): void {\n const wanted = doc.body !== null && doc.body.hasAttribute(BACKDROP_ACTIVE_ATTR)\n && doc.body.hasAttribute(CONVERSATION_CONTENT_ATTR)\n if (!wanted || frostSuppressed.has(doc)) {\n stopFrostFollower(doc)\n return\n }\n startFrostFollower(doc)\n}\n","/**\n * Fixed decoration layers (issue #506, contract section 6).\n *\n * Six skin-center-owned, non-interactive containers mounted once per\n * document (component scope): background / ambient / top / bottom / sidebar /\n * foreground. Skins fill them per activation (background media, scrims,\n * strips); the CONTENT is activation scope — on every switch the controller\n * replaces it through the effect ledger.\n *\n * Guarantees:\n * - pointer-events: none always (decoration must never eat clicks);\n * - the layer elements themselves survive skin switches, reloads of the\n * skin runtime, and HMR (ensure* is idempotent);\n * - stacking stays below the official shell overlay: background/ambient sit\n * behind the app, the strip/foreground layers use moderate z-indices that\n * lose to dialogs/overlays (official overlay paints above 1000);\n * - the background layer carries its own compositor layer (will-change:\n * transform): a full-viewport skin background image is expensive to\n * re-rasterize, and without isolation Chromium re-rasterizes it in\n * horizontal bands whenever unrelated repaint bursts (streaming chat,\n * animated pets, overlay menus) invalidate the same area — visible as\n * vertical band flicker (issue #1013).\n * @module @linxin666/dsh-client-ui-skin-center/runtime/decoration-layers\n */\n\nexport const DECORATION_LAYER_NAMES = [\n 'background',\n 'ambient',\n 'top',\n 'bottom',\n 'sidebar',\n 'foreground',\n] as const\n\nexport type DecorationLayerName = (typeof DECORATION_LAYER_NAMES)[number]\n\nexport type DecorationLayers = Record<DecorationLayerName, HTMLElement>\n\nconst LAYER_ATTR = 'data-dsh-skin-layer'\n\n/**\n * Per-layer paint order. The background sits at -2: negative z-index\n * elements paint ABOVE the html/body backgrounds (so a skin's own opaque\n * root background-color renders BEHIND its art — the v1 layering) yet below\n * every panel surface. It shares -2 with the WE scrim, which never paints\n * at the same time (an active WE wallpaper suppresses skin media, enforced\n * by the controller). The skin-background blur veil (-1) still samples the\n * art above it. Ambient effects paint above the veils; the strip/foreground\n * layers stay below the official overlay band (>=1000).\n */\nconst LAYER_STYLE: Record<DecorationLayerName, string> = {\n // Explicit longhands only: the inset shorthand has burned us once (a\n // mid-session layer lost its bottom edge), longhands parse everywhere.\n background: 'position:fixed;top:0;right:0;bottom:0;left:0;z-index:-2;pointer-events:none;will-change:transform;',\n ambient: 'position:fixed;top:0;right:0;bottom:0;left:0;z-index:30;pointer-events:none;',\n top: 'position:fixed;top:0;left:0;right:0;z-index:40;pointer-events:none;',\n bottom: 'position:fixed;bottom:0;left:0;right:0;z-index:40;pointer-events:none;',\n sidebar: 'position:fixed;top:0;bottom:0;left:0;z-index:40;pointer-events:none;',\n foreground: 'position:fixed;top:0;right:0;bottom:0;left:0;z-index:41;pointer-events:none;',\n}\n\nfunction ensureOne(doc: Document, name: DecorationLayerName): HTMLElement {\n const existing = doc.querySelector<HTMLElement>(`[${LAYER_ATTR}=\"${name}\"]`)\n if (existing) {\n // Never trust a previous writer's styles: re-assert invariants.\n existing.style.cssText = LAYER_STYLE[name]\n return existing\n }\n const el = doc.createElement('div')\n el.setAttribute(LAYER_ATTR, name)\n el.setAttribute('aria-hidden', 'true')\n el.style.cssText = LAYER_STYLE[name]\n doc.body.appendChild(el)\n return el\n}\n\n/**\n * Ensure all six layers exist and return their handles. Idempotent; safe to\n * call on every activation.\n */\nexport function ensureDecorationLayers(doc: Document): DecorationLayers {\n return {\n background: ensureOne(doc, 'background'),\n ambient: ensureOne(doc, 'ambient'),\n top: ensureOne(doc, 'top'),\n bottom: ensureOne(doc, 'bottom'),\n sidebar: ensureOne(doc, 'sidebar'),\n foreground: ensureOne(doc, 'foreground'),\n }\n}\n\n/**\n * Replace one layer's content (activation scope). Returns a teardown that\n * removes exactly the nodes this call added — idempotent, ledger-ready.\n */\nexport function setLayerContent(\n layer: HTMLElement,\n nodes: Iterable<Node>,\n): () => void {\n const added = [...nodes]\n for (const node of added) layer.appendChild(node)\n let done = false\n return () => {\n if (done) return\n done = true\n for (const node of added) node.parentNode?.removeChild(node)\n }\n}\n\n/** Remove every node an activation left in a layer (used on dispose). */\nexport function clearLayer(layer: HTMLElement): void {\n while (layer.firstChild) layer.removeChild(layer.firstChild)\n}\n\n/**\n * Build the background media element for a manifest backgroundMedia layer.\n * Returns null when the theme variant has no media. The element fills the\n * background layer; the scrim (when declared) is a sibling overlay.\n */\nexport function buildBackgroundMedia(\n doc: Document,\n layer: { type: 'image' | 'video'; src: string; scrim?: string },\n assetBase: string,\n): HTMLElement[] {\n const nodes: HTMLElement[] = []\n const fullBleed = 'position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;object-fit:cover;'\n if (layer.type === 'image') {\n const img = doc.createElement('img')\n img.src = `${assetBase}/${layer.src}`\n img.alt = ''\n img.setAttribute('aria-hidden', 'true')\n img.style.cssText = fullBleed\n nodes.push(img)\n } else {\n const video = doc.createElement('video')\n video.src = `${assetBase}/${layer.src}`\n video.muted = true\n video.loop = true\n video.autoplay = true\n video.playsInline = true\n video.setAttribute('aria-hidden', 'true')\n video.style.cssText = fullBleed\n nodes.push(video)\n }\n if (layer.scrim) {\n const scrim = doc.createElement('div')\n scrim.setAttribute('aria-hidden', 'true')\n scrim.style.cssText = `position:absolute;inset:0;background:${layer.scrim};`\n nodes.push(scrim)\n }\n return nodes\n}\n","/**\n * Skin runtime controller (issue #506, contract section 8) — the browser\n * switch engine. One switch is one NEW activation identity:\n *\n * switchTo(id):\n * 1. seq = ++latestRequest (latest-request-wins)\n * 2. activation = ledger.beginActivation()\n * 3. fetch stylesheet (+ patches) (already scoped + whitelisted host-side)\n * 4. install <style> tags, background media, hooks (all ledger-recorded)\n * 5. if seq is stale -> dispose this activation and bail\n * 6. flip html[data-dsh-skin] (the atomic visual cut)\n * 7. dispose the previous activation\n * 8. persist the selection\n *\n * Every step before the flip is discardable; a stale or failed switch leaves\n * the previous skin fully intact. hooks import/apply errors are caught: the\n * static part (stylesheet, media) stays active — the escape hatch can never\n * take the skin down with it.\n *\n * lifecycleScope split: the ledger tracks activation scope; the catalog\n * snapshot, the decoration layer elements and the persisted selection are\n * component scope and survive every switch.\n *\n * One activation is an exception to \"an external owner always wins\": the one\n * the user just asked for (issue #49). It paints once even while\n * `suppressSkin()` reports another owner, because the public\n * `html[data-dsh-skin]` stamp IS the signal that owner keys its hand-back on.\n * The claim is bounded and one-shot - see {@link USER_INITIATED_YIELD_GRACE_MS}.\n * @module @linxin666/dsh-client-ui-skin-center/runtime/skin-controller\n */\n\nimport type { EffectLedger } from './effect-ledger.ts'\nimport { buildBackgroundMedia, clearLayer, ensureDecorationLayers } from './decoration-layers.ts'\nimport type { DecorationLayers } from './decoration-layers.ts'\nimport { setSceneBackdropActive } from './backdrop-scene.ts'\n\n/**\n * The delegated-plugin payload a delegated skin's catalog row carries.\n *\n * It is the whole of what the controller needs: the entry is recognized as a\n * delegated skin by this field existing. Everything else on it is card copy and\n * install wiring, and the controller reads none of it.\n */\nexport interface DelegatedSkinPayload {\n /** npm package spec the card installs through the plugin manager. */\n package: string\n /** Upstream repository (docs, issues, changelog). */\n repository: string\n /** The attribute the delegated plugin stamps on body while it owns the page. */\n bodyAttr: string\n /** The attribute it stamps while it can hand the page back (capability). */\n handoffAttr: string\n /** Whether the delegated package is installed in this profile. */\n installed: boolean\n}\n\n/** Catalog entry shape the controller needs (mirrors the v2 catalog route). */\nexport interface ControllerSkinEntry {\n manifest: {\n id: string\n /**\n * Absent for a delegated skin: that plugin owns the stylesheet, the\n * background and the visual, so this package loads none of them.\n */\n contributes?: {\n stylesheet: string\n patches?: string\n backgroundMedia?: {\n light?: { type: 'image' | 'video'; src: string; scrim?: string }\n dark?: { type: 'image' | 'video'; src: string; scrim?: string }\n }\n }\n /** Present exactly for a delegated skin; absent for every asset skin. */\n delegated?: DelegatedSkinPayload\n facets?: { client?: { entry: string; apiVersion: string } }\n }\n}\n\n/**\n * Whether this entry's visual belongs to a delegated plugin.\n *\n * A delegated skin is a real selection, not a stand-down: it is persisted,\n * adopted on boot, and shown as the active row. What it never does is paint.\n * @param entry - a catalog entry, or null.\n * @returns true when the entry is a delegated skin.\n */\nexport function isDelegatedEntry(entry: ControllerSkinEntry | null): boolean {\n return entry?.manifest.delegated !== undefined\n}\n\nexport interface SkinControllerDeps {\n doc: Document\n ledger: EffectLedger\n /** Same-origin base of the v2 API (default /api/skin-center/v2). */\n apiBase?: string\n /** fetch injection for tests. */\n fetchImpl?: typeof fetch\n /** Persist the selection (POST /active by default). */\n persist?: (id: string | null) => Promise<void>\n /** Current light/dark theme (defaults to body[data-ds-dark-theme]). */\n themeGet?: () => 'light' | 'dark'\n /**\n * Theme-change subscription. The default observes the official\n * body[data-ds-dark-theme] attribute (the same ground truth v1 skins\n * used), so hooks get live theme flips out of the box.\n */\n themeSubscribe?: (listener: (theme: 'light' | 'dark') => void) => () => void\n /**\n * Stylesheet loader seam. Default installs a <link rel=\"stylesheet\"> and\n * awaits its load (relative url() inside the served CSS resolves against\n * the route URL — inlining into <style> would break asset resolution).\n */\n loadStylesheet?: (href: string) => Promise<void>\n /** hooks.mjs dynamic import seam for tests. */\n importHooks?: (url: string) => Promise<unknown>\n /**\n * External stand-down (issue #39): when this returns true another plugin\n * owns the whole visual — the delegated `dsh-plugin-wallpaper-engine` is\n * rendering a wallpaper — and a skin must not be painted at all, because\n * that plugin rewrites the same shell and paints its own glass.\n *\n * The user's chosen skin is still remembered (and still persisted when they\n * apply one), so it returns untouched the moment the wallpaper stops; only\n * the painting is withheld. Re-evaluated on every activation and on\n * refresh().\n */\n suppressSkin?: () => boolean\n /** Diagnostics sink (switch failures, hook errors). */\n onError?: (message: string, error: unknown) => void\n}\n\n/**\n * How long a user-initiated activation may hold the stage while another\n * plugin still owns the visual (issue #49).\n *\n * The claim exists to make the request VISIBLE on the public\n * `html[data-dsh-skin]` stamp, not to compete for the backdrop. The hand-back\n * itself is DOM-level (the other plugin observes that stamp and clears its\n * own), so this window only has to cover that round trip; when it expires\n * without a hand-back the activation withdraws and the remembered selection\n * repaints the moment that owner stops.\n */\nexport const USER_INITIATED_YIELD_GRACE_MS = 1500\n\n/** Per-activation options the card threads down from its own controls. */\nexport interface SkinActivationOptions {\n /**\n * True when the user just asked for this activation from the card (try-on,\n * apply, or re-apply of the skin already on). Such an activation CLAIMS THE\n * STAGE: it paints once even while {@link SkinControllerDeps.suppressSkin}\n * reports another owner, so `html[data-dsh-skin]` flips and that owner can\n * give the page back (issue #49).\n *\n * The claim is one-shot and bounded (it withdraws after\n * {@link USER_INITIATED_YIELD_GRACE_MS}), and it means nothing for the stock\n * look: a withheld stock preview has nothing to paint, so it keeps\n * reporting itself as stood down.\n */\n userInitiated?: boolean\n}\n\n/**\n * How one activation treats the persisted selection (issue #54).\n *\n * - `commit` - the user chose this in the card: it becomes the committed\n * selection AND is POSTed, so every other client follows.\n * - `preview` - a try-on (or an internal re-paint): the committed selection is\n * untouched and nothing is written.\n * - `adopt` - this page is mirroring a selection ANOTHER client already\n * persisted (boot recovery, the persisted-selection follower). It becomes\n * this page's committed selection so try-on restores it and the poll sees it\n * as applied, but it is never written back: a reader that writes can\n * overwrite a newer choice the other client has since made.\n */\nexport type SkinActivationMode = 'commit' | 'preview' | 'adopt'\n\nexport interface SkinControllerState {\n /** The currently applied skin (null = stock look). */\n active: string | null\n /**\n * True while a skin is selected but withheld because another plugin owns the\n * visual (see {@link SkinControllerDeps.suppressSkin}). The selection is\n * intact and repaints as soon as that plugin stops.\n */\n stoodDown: boolean\n /** The previewed skin id (null = the stock look is being previewed). */\n trying: string | null\n /** Whether a try-on preview is live (distinguishes previewing the stock\n * look from having no preview). */\n previewing: boolean\n}\n\nexport interface SkinController {\n /** Current applied skin id (null = stock look). */\n readonly active: string | null\n /** The fixed decoration layer handles (component scope). */\n readonly layers: DecorationLayers\n /**\n * Switch to a skin (or null for stock). Latest request wins; resolves to\n * the id that is actually active after this call settles (which may be a\n * newer one if a later switch superseded it).\n */\n switchTo(id: string | null, entry: ControllerSkinEntry | null, options?: SkinActivationOptions): Promise<string | null>\n /**\n * Preview a skin without persisting it. The committed skin is remembered;\n * exitTryOn() restores it. Try-on of the stock look passes null.\n */\n tryOn(id: string | null, entry: ControllerSkinEntry | null, options?: SkinActivationOptions): Promise<string | null>\n /**\n * Adopt a selection another client already persisted, without writing it\n * back (issue #54). The activation is a COMMIT - the selection becomes the\n * committed one try-on restores and a later poll sees it as applied - but\n * the value is not POSTed, because this page did not choose it. The two\n * reader paths (boot recovery and the persisted-selection follower) use\n * this: they mirror another client's choice, and mirroring must never\n * overwrite a newer choice that client has since made.\n */\n adopt(id: string | null, entry: ControllerSkinEntry | null, options?: SkinActivationOptions): Promise<string | null>\n /** Leave the preview, restoring the committed skin. */\n exitTryOn(): Promise<string | null>\n /** React-friendly store: subscribe + snapshot of {active, trying}. */\n subscribe(listener: () => void): () => void\n getState(): SkinControllerState\n /**\n * Re-apply the current committed skin without persisting (e.g. the\n * wallpaper bridge just toggled, flipping background-media priority).\n * A full fresh activation — latest-request-wins keeps it race-safe.\n */\n refresh(): Promise<string | null>\n /**\n * True while a switch (including the boot recovery that reads the persisted\n * selection) is in flight. A page that recovers its selection asynchronously\n * must be allowed to finish before any follower converges on a selection,\n * or the late convergence supersedes the in-flight activation and the boot\n * switch is discarded as stale (issue #1805).\n */\n isSwitching(): boolean\n /** Dispose the current activation (e.g. on plugin teardown). */\n shutdown(): void\n}\n\ninterface HooksModule {\n default?: () => { apply(ctx: unknown): void; dispose?: () => void }\n}\n\nexport function createSkinController(deps: SkinControllerDeps): SkinController {\n const doc = deps.doc\n const ledger = deps.ledger\n const apiBase = deps.apiBase ?? '/api/skin-center/v2'\n const fetchImpl = deps.fetchImpl ?? fetch.bind(doc.defaultView)\n const layers = ensureDecorationLayers(doc)\n const onError = deps.onError ?? (() => {})\n\n const themeGet = deps.themeGet ?? (() =>\n (doc.body?.hasAttribute('data-ds-dark-theme') ? 'dark' : 'light'))\n const themeSubscribe = deps.themeSubscribe ?? ((listener) => {\n let last = themeGet()\n const observer = new doc.defaultView!.MutationObserver(() => {\n const next = themeGet()\n if (next !== last) {\n last = next\n listener(next)\n }\n })\n if (doc.body) observer.observe(doc.body, { attributes: true, attributeFilter: ['data-ds-dark-theme'] })\n return () => observer.disconnect()\n })\n /**\n * Re-paint the current activation's background media for the live\n * light/dark theme (the controller owns the layer, so a theme flip must\n * swap the variant the same way an activation does). No-op when there is\n * nothing painted or the manifest carries no backgroundMedia.\n */\n function repaintBackgroundForTheme(): void {\n if (active === null || currentActivation === null || lastEntry === null) return\n // A withheld skin has no paint to repaint (issue #39).\n if (stoodDown) return\n const media = lastEntry.manifest.contributes?.backgroundMedia\n if (!media) return\n const variant = themeGet() === 'dark' ? (media.dark ?? media.light) : (media.light ?? media.dark)\n if (!variant) return\n const assetBase = `${apiBase}/skins/${lastEntry.manifest.id}`\n setBackgroundLayer(currentActivation, buildBackgroundMedia(doc, variant, assetBase))\n }\n const unsubscribeTheme = themeSubscribe(() => repaintBackgroundForTheme())\n const loadStylesheet = deps.loadStylesheet ?? ((href: string) => new Promise<void>((resolveLink, rejectLink) => {\n const link = doc.createElement('link')\n link.rel = 'stylesheet'\n link.href = href\n const timer = setTimeout(() => rejectLink(new Error(`stylesheet load timeout: ${href}`)), 15000)\n link.onload = () => { clearTimeout(timer); resolveLink() }\n link.onerror = () => { clearTimeout(timer); rejectLink(new Error(`stylesheet load failed: ${href}`)) }\n doc.head.appendChild(link)\n }))\n\n let latestRequest = 0\n /**\n * True from the moment a switch begins until the newest switch settles. A\n * page that recovers its selection asynchronously (the desktop client boots\n * without the tapIndex stamp) has an activation in flight while other\n * subsystems start publishing, and an external verdict flip read during that\n * window is replayed after it settles instead of racing it (issue #1805).\n */\n let switching = false\n /** An external verdict flip observed while a switch was in flight. */\n let refreshQueued = false\n let currentActivation: number | null = null\n const initialSkinId = doc.documentElement?.getAttribute('data-dsh-skin') || null\n let active: string | null = initialSkinId\n /** The committed selection try-on restores (component scope). */\n let committed: { id: string | null; entry: ControllerSkinEntry | null } = { id: initialSkinId, entry: null }\n /** Last non-null applied entry, so refresh() can re-activate it. */\n let lastEntry: ControllerSkinEntry | null = null\n /** Last evaluated stand-down verdict (refresh() skips no-ops). */\n let lastSuppressed: boolean | null = deps.suppressSkin?.() === true\n let trying: string | null = null\n let previewing = false\n const listeners = new Set<() => void>()\n // React's useSyncExternalStore requires a CACHED snapshot: getSnapshot must\n // return the same reference until the state actually changes, or the store\n // consumer loops forever (and the settings card crashes blank).\n let stoodDown = lastSuppressed === true\n let stateSnapshot: SkinControllerState = { active: initialSkinId, stoodDown, trying: null, previewing: false }\n const emit = (): void => {\n stateSnapshot = { active, stoodDown, trying, previewing }\n for (const listener of listeners) listener()\n }\n\n /**\n * Install one stylesheet as a tracked <link> (the load itself happened in\n * loadStylesheet; here we only register the teardown). Links keep relative\n * url() resolution intact — a <style> tag would resolve them against the\n * document and 404 every skin asset.\n */\n function trackStylesheet(activation: number, label: string, href: string): void {\n const link = doc.head.querySelector<HTMLLinkElement>(`link[href=\"${href}\"]`)\n ledger.record(activation, `style:${label}`, () => link?.remove())\n }\n\n /**\n * Paint the skin background art into the `background` decoration layer\n * (z-index:-2) with a snapshot for the activation ledger. Only the CURRENT\n * activation may restore: when an older activation is disposed after a\n * newer one already re-painted the layer, restoring its snapshot would\n * clobber the newer paint.\n *\n * Two reasons the art lives in the layer, not on `document.body`:\n * - Chromium's backdrop-filter does not sample the canvas/body background,\n * so the skin-center blur layer (z-index:-1) could never blur body-painted\n * art (issue #732 defect A). A real fixed element IS sampled, so after\n * this change the same blur + scrim controls work on the skin backdrop\n * just like they already do on the Wallpaper Engine layers (issue #777).\n * - dragon-heir hooks expect the art in ctx.layers.background (they swap\n * the painted img and apply the v1 filter lift); the layer is the v2\n * contract and body painting was a leftover half-migration.\n * The body's own opaque background is forced transparent while art is\n * mounted, or the shell's static panels would cover the negative-z layer.\n */\n function setBackgroundLayer(activation: number, nodes: HTMLElement[]): void {\n const style = doc.body.style\n const previousBackgroundColor = style.getPropertyValue('background-color')\n const previousBackgroundImage = style.getPropertyValue('background-image')\n const restore = (): void => {\n if (currentActivation !== activation) return\n clearLayer(layers.background)\n setSceneBackdropActive(doc, 'skin', false)\n if (previousBackgroundColor === '') style.removeProperty('background-color')\n else style.setProperty('background-color', previousBackgroundColor)\n if (previousBackgroundImage === '') style.removeProperty('background-image')\n else style.setProperty('background-image', previousBackgroundImage)\n }\n clearLayer(layers.background)\n if (nodes.length > 0) {\n for (const node of nodes) layers.background.appendChild(node)\n style.setProperty('background-color', 'transparent')\n style.setProperty('background-image', 'none')\n setSceneBackdropActive(doc, 'skin', true)\n } else {\n setSceneBackdropActive(doc, 'skin', false)\n if (previousBackgroundColor === '') style.removeProperty('background-color')\n else style.setProperty('background-color', previousBackgroundColor)\n if (previousBackgroundImage === '') style.removeProperty('background-image')\n else style.setProperty('background-image', previousBackgroundImage)\n }\n ledger.record(activation, 'background:layer', restore)\n }\n\n function installBackground(\n activation: number,\n entry: ControllerSkinEntry,\n ): void {\n const media = entry.manifest.contributes?.backgroundMedia\n if (!media) {\n setBackgroundLayer(activation, [])\n return\n }\n // An external owner (the delegated wallpaper plugin) withholds the whole\n // skin, background media included, before this is reached (see\n // switchInternal); nothing to arbitrate here.\n const variant = themeGet() === 'dark' ? (media.dark ?? media.light) : (media.light ?? media.dark)\n if (!variant) {\n setBackgroundLayer(activation, [])\n return\n }\n const assetBase = `${apiBase}/skins/${entry.manifest.id}`\n setBackgroundLayer(activation, buildBackgroundMedia(doc, variant, assetBase))\n }\n\n async function installHooks(activation: number, entry: ControllerSkinEntry): Promise<void> {\n const facet = entry.manifest.facets?.client\n if (!facet) return\n const importHooks = deps.importHooks ?? ((url: string) => import(/* @vite-ignore */ url))\n try {\n const mod = (await importHooks(`${apiBase}/skins/${entry.manifest.id}/hooks.mjs`)) as HooksModule\n const factory = mod?.default\n if (typeof factory !== 'function') throw new Error('hooks.mjs must default-export defineSkinHooks()')\n const hooks = factory()\n if (typeof hooks?.apply !== 'function') throw new Error('defineSkinHooks() must return { apply }')\n const cleanups: Array<() => void> = []\n const ctx = {\n skinId: entry.manifest.id,\n scopeAttr: entry.manifest.id,\n assetBase: `${apiBase}/skins/${entry.manifest.id}`,\n layers,\n theme: {\n get: themeGet,\n subscribe: themeSubscribe,\n },\n onCleanup: (fn: () => void) => {\n cleanups.push(fn)\n },\n }\n hooks.apply(ctx)\n ledger.record(activation, 'hooks', () => {\n try {\n hooks.dispose?.()\n } catch (error) {\n onError(`hooks dispose failed for ${entry.manifest.id}`, error)\n }\n for (const cleanup of cleanups.reverse()) {\n try {\n cleanup()\n } catch (error) {\n onError(`hooks cleanup failed for ${entry.manifest.id}`, error)\n }\n }\n })\n } catch (error) {\n // The escape hatch never takes the static skin down with it.\n onError(`hooks failed for ${entry.manifest.id}; static skin stays active`, error)\n }\n }\n\n async function persist(id: string | null): Promise<void> {\n if (deps.persist) {\n await deps.persist(id)\n return\n }\n await fetchImpl(`${apiBase}/active`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ active: id }),\n })\n }\n\n async function switchInternal(\n id: string | null,\n entry: ControllerSkinEntry | null,\n mode: SkinActivationMode,\n options?: SkinActivationOptions,\n ): Promise<string | null> {\n const seq = ++latestRequest\n switching = true\n const activation = ledger.beginActivation()\n // External stand-down (issue #39): another plugin owns the visual, so this\n // activation is recorded and persisted but nothing is painted. `active`\n // still names the user's choice, which is what the card shows and what\n // repaints the moment that plugin stops.\n //\n // A user-initiated activation of a real skin is the one exception (issue\n // #49): it claims the stage, so the public `html[data-dsh-skin]` stamp\n // flips and that owner can see the request and hand the page back. The\n // claim needs a skin to paint, so the stock look keeps reporting itself as\n // stood down rather than claiming a stage it does not use.\n const suppressed = deps.suppressSkin?.() === true\n // A delegated skin has no stylesheet of its own: the plugin that owns the\n // page paints it. The activation is still a real one (it persists the\n // selection and records the row as active), it simply paints nothing and\n // leaves html[data-dsh-skin] off, which is the very signal that plugin\n // reads to stand down. It never claims the stage: there is no paint to\n // claim one with.\n const delegated = isDelegatedEntry(entry)\n const claimsStage = options?.userInitiated === true && id !== null && entry !== null && !delegated\n const withheld = suppressed && !claimsStage\n try {\n if (!withheld && !delegated && id !== null && entry !== null) {\n const stylesheetHref = `${apiBase}/skins/${id}/stylesheet`\n const patchesHref = entry.manifest.contributes?.patches !== undefined\n ? `${apiBase}/skins/${id}/patches`\n : null\n await loadStylesheet(stylesheetHref)\n trackStylesheet(activation, 'stylesheet', stylesheetHref)\n if (patchesHref !== null) {\n await loadStylesheet(patchesHref).catch(() => {})\n trackStylesheet(activation, 'patches', patchesHref)\n }\n if (seq !== latestRequest) throw new StaleSwitch()\n installBackground(activation, entry)\n await installHooks(activation, entry)\n } else {\n // Stock / entryless / withheld switch owns the background layer too: it\n // must clear a previous skin's paint (the old activation's restore is\n // skipped as stale by the ownership gate).\n setBackgroundLayer(activation, [])\n }\n if (seq !== latestRequest) throw new StaleSwitch()\n\n // The atomic cut: attribute first, then retire the old activation. A\n // withheld skin leaves the stamp off, which is what actually removes the\n // skin's CSS from the page. A delegated skin leaves it off for the same\n // reason from the other side: its owner reads the stamp.\n if (id === null || withheld || delegated) doc.documentElement.removeAttribute('data-dsh-skin')\n else doc.documentElement.setAttribute('data-dsh-skin', id)\n const previous = currentActivation\n currentActivation = activation\n active = id\n // Stood down is only ever the EXTERNAL verdict: a wallpaper rendering\n // over whatever is selected. A delegated skin on its own is not stood\n // down, it is simply painted by its plugin rather than here.\n stoodDown = withheld\n // This activation already applied the current verdict, so refresh() must\n // not read it as a change and re-switch on the next call.\n lastSuppressed = withheld\n if (entry !== null) lastEntry = entry\n if (mode === 'preview') {\n previewing = id !== committed.id\n trying = previewing ? id : null\n } else {\n // 'commit' and 'adopt' both settle the selection: try-on restores it\n // and the follower sees it as already applied. Only 'commit' writes it\n // back, which is the whole difference (issue #54).\n committed = { id, entry }\n trying = null\n previewing = false\n }\n emit()\n if (previous !== null) ledger.disposeActivation(previous)\n // A claim the external owner never answers must not sit on top of that\n // owner's visual: re-check once the hand-back window is over (issue #49).\n // Recorded while this activation is still the current one, because the\n // settleSwitch below may replay a queued verdict flip, and that opens a\n // newer activation which disposes this one (and its window) right away.\n if (claimsStage && suppressed) scheduleYieldCheck(activation)\n // The paint has changed and the previous activation is retired: this is\n // the point an external verdict flip must be able to take over.\n // Persisting is a separate, unscheduled round-trip (POST /active can hang\n // on a paired desktop) and must not hold the page on a superseded paint\n // (issue #1805).\n settleSwitch(seq)\n if (mode === 'commit') {\n await persist(id).catch((error) => onError('failed to persist the skin selection', error))\n }\n return active\n } catch (error) {\n ledger.disposeActivation(activation)\n if (error instanceof StaleSwitch) return active\n if (currentActivation === null) {\n active = null\n stoodDown = false\n committed = { id: null, entry: null }\n doc.documentElement.removeAttribute('data-dsh-skin')\n emit()\n }\n onError(`switch to ${id ?? 'stock'} failed; previous skin intact`, error)\n return active\n } finally {\n // Safety net for the paths that bail before the atomic cut (a stale\n // switch, or a failed stylesheet load). The normal path already settled\n // before persisting, so this is a no-op there.\n settleSwitch(seq)\n }\n }\n\n /**\n * The visual half of a switch is done: release the in-flight flag and replay\n * a verdict flip that arrived while it was loading.\n *\n * Called at the atomic cut, NOT after the persist round-trip. POST /active\n * has no timeout and can hang on a paired desktop, and a page that has\n * already painted must still yield to an external owner the moment that\n * owner's verdict flips - waiting for the write would leave the skin painted\n * over the wallpaper (issue #1805). Idempotent, so the failure paths can\n * call it again from the switch's `finally`.\n */\n function settleSwitch(seq: number): void {\n // An older switch settling late must not report an in-flight newer switch\n // as settled (issue #1805).\n if (seq !== latestRequest) return\n if (!switching && !refreshQueued) return\n switching = false\n // A verdict flip that arrived while this switch was loading: it sampled its\n // verdict before the flip, so replay the flip now that nothing is in\n // flight. Dropping it would leave the page on a paint the external owner\n // already superseded (issue #39 handoff, issue #1805).\n if (refreshQueued) {\n refreshQueued = false\n void refresh()\n }\n }\n\n /**\n * Re-check a stage claim once the hand-back window is over (issue #49).\n *\n * The claim is a request, not permission: if the external owner still\n * reports itself active at the end of the window, this activation withdraws\n * through the ordinary withheld path, so a peer that never answers the\n * `html[data-dsh-skin]` stamp cannot leave the skin painted over its visual.\n *\n * Three ways the check stands down without acting, each correct:\n * - a newer activation replaced this one (it applies its own verdict, and\n * a newer claim brings its own window);\n * - another switch is in flight (that switch sampled the verdict itself);\n * - the owner handed the page back (the paint is what the user asked for,\n * and `refresh()` already sees a matching verdict, so it is left alone).\n *\n * The timer is ledger-recorded, so superseding this activation or shutting\n * the runtime down cancels it.\n * @param activation - the claiming activation this window belongs to.\n */\n function scheduleYieldCheck(activation: number): void {\n const timer = setTimeout(() => {\n if (activation !== currentActivation) return\n if (switching) return\n if (deps.suppressSkin?.() !== true) return\n void switchInternal(active, active === null ? null : lastEntry, 'preview')\n }, USER_INITIATED_YIELD_GRACE_MS)\n ledger.record(activation, 'yield:claim-window', () => clearTimeout(timer))\n }\n\n /**\n * Re-apply the current selection under the current external verdict.\n *\n * A switch already in flight sampled the verdict before this call, so this\n * defers the flip instead of opening a second activation: the second one\n * would bump the request sequence and cancel the first, which is how the\n * desktop boot lost its persisted selection (issue #1805).\n */\n async function refresh(): Promise<string | null> {\n const suppressed = deps.suppressSkin?.() === true\n if (suppressed === lastSuppressed) return active\n if (switching) {\n refreshQueued = true\n return active\n }\n lastSuppressed = suppressed\n if (active !== null && lastEntry === null) return active\n // Re-apply the SAME logical selection: switchInternal decides whether it\n // paints or withholds, so a wallpaper starting or stopping flips the page\n // without touching what the user chose. Preview mode keeps this a pure\n // repaint: the committed selection is already this one, and a repaint must\n // never write (issue #54).\n return await switchInternal(active, active === null ? null : lastEntry, 'preview')\n }\n\n return {\n get active() {\n return active\n },\n get layers() {\n return layers\n },\n\n async switchTo(id, entry, options) {\n return await switchInternal(id, entry, 'commit', options)\n },\n\n async tryOn(id, entry, options) {\n return await switchInternal(id, entry, 'preview', options)\n },\n\n async adopt(id, entry, options) {\n return await switchInternal(id, entry, 'adopt', options)\n },\n\n async exitTryOn() {\n const result = await switchInternal(committed.id, committed.entry, 'preview')\n return result\n },\n\n subscribe(listener) {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n\n getState() {\n return stateSnapshot\n },\n\n isSwitching() {\n return switching\n },\n\n refresh,\n\n shutdown() {\n latestRequest += 1\n unsubscribeTheme()\n if (currentActivation !== null) {\n ledger.disposeActivation(currentActivation)\n currentActivation = null\n }\n active = null\n stoodDown = false\n trying = null\n previewing = false\n committed = { id: null, entry: null }\n emit()\n doc.documentElement.removeAttribute('data-dsh-skin')\n },\n }\n}\n\nclass StaleSwitch extends Error {\n constructor() {\n super('superseded by a newer switch')\n }\n}\n","/**\n * Browser boot wiring for the v2 skin runtime (issue #506): one store per\n * document that owns the effect ledger, the skin controller, the semantic\n * adapter and the catalog snapshot. The settings card consumes the store;\n * the store outlives the card (settings panels unmount on close), so a\n * try-on preview survives closing and reopening the panel.\n *\n * Boot sequence: fetch the catalog snapshot once, read the persisted active\n * selection, and activate it (the tapIndex adapter already stamped the\n * attribute and preloaded the stylesheet for first paint; the controller\n * re-installs under ledger ownership so later switches stay atomic).\n * @module @linxin666/dsh-client-ui-skin-center/runtime/boot\n */\n\nimport { createEffectLedger } from './effect-ledger.ts'\nimport { createSemanticAdapter } from './semantic-adapter.ts'\nimport type { SemanticAdapter } from './semantic-adapter.ts'\nimport { installShellRenderingAdapter } from './shell-rendering.ts'\nimport { setComposerFrostSuppressed } from './backdrop-scene.ts'\nimport { createSkinController } from './skin-controller.ts'\nimport type { ControllerSkinEntry, SkinController } from './skin-controller.ts'\n\n/**\n * Display-ready catalog entry (manifest + origin), as served by /v2/catalog.\n *\n * `origin: 'delegated'` rows are skins whose visual is another plugin's: they\n * carry a `delegated` payload and no `contributes`. The card renders them as\n * their own row and the controller withholds their paint (see\n * skin-controller.ts); everything else about them behaves like an asset skin.\n */\nexport interface CatalogSkin {\n origin: 'builtin' | 'user' | 'delegated'\n warnings: string[]\n manifest: ControllerSkinEntry['manifest'] & {\n name: string\n nameEn: string\n tagline?: string\n description?: string\n /**\n * Locale key of a delegated skin's body copy, where the row names a look\n * rather than describing one. Asset skins carry no key: their manifest\n * description is a single-language string they do not render as body copy.\n */\n descriptionKey?: string\n accent?: string\n order?: number\n author?: string\n license?: string\n attribution?: string\n preview?: { light: string; dark: string }\n tags?: string[]\n }\n}\n\n/** A catalog row whose visual belongs to a delegated plugin. */\nexport function isDelegatedCatalogSkin(skin: CatalogSkin): boolean {\n return skin.manifest.delegated !== undefined\n}\n\nexport interface CatalogDiagnostic {\n subject: string\n origin: string\n errors: string[]\n}\n\nexport interface SkinRuntimeStore {\n readonly controller: SkinController\n readonly adapter: SemanticAdapter\n /**\n * The document this store owns. Everything the runtime touches - the\n * adapter, the stylesheet links, the selection poll - is keyed on it, so a\n * store never reaches into the ambient global document.\n */\n readonly doc: Document\n /** The owning window; timers and events go through it, never through globals. */\n readonly window: Window\n /** The skin-center API root this store reads and writes selection state under. */\n readonly apiBase: string\n /** The fetch seat this store uses (injectable for tests). */\n readonly fetchImpl: typeof fetch\n /** Loaded catalog snapshot (null until the first fetch resolves). */\n catalog(): CatalogSkin[] | null\n diagnostics(): CatalogDiagnostic[]\n /** Re-fetch the catalog (e.g. after the user drops a new skin directory). */\n refreshCatalog(): Promise<void>\n /** Find one entry in the current snapshot by id. */\n find(id: string): CatalogSkin | null\n /** Fires on catalog loads AND controller state transitions. */\n subscribe(listener: () => void): () => void\n /** Stop the semantic adapter and dispose the current activation. */\n shutdown(): void\n}\n\nexport interface BootOptions {\n doc?: Document\n apiBase?: string\n fetchImpl?: typeof fetch\n /**\n * External stand-down (issue #39): true while the delegated wallpaper plugin\n * owns the visual, which withholds the skin entirely (its CSS, background\n * media, hooks and backdrop marker). The user's selection is kept.\n */\n suppressSkin?: () => boolean\n /**\n * Composer-frost ownership: true while the delegated wallpaper plugin paints\n * its own composer glass, so this runtime must not mount a second one.\n */\n suppressComposerFrost?: () => boolean\n}\n\nexport function bootSkinRuntime(options: BootOptions = {}): SkinRuntimeStore {\n const doc = options.doc ?? document\n const apiBase = options.apiBase ?? '/api/skin-center/v2'\n const fetchImpl = options.fetchImpl ?? fetch.bind(doc.defaultView)\n\n const ledger = createEffectLedger()\n const controller = createSkinController({\n doc,\n ledger,\n apiBase,\n fetchImpl,\n suppressSkin: options.suppressSkin,\n // Switches fail closed to the previous skin; failures must still be\n // observable in the console (they are never thrown to the card).\n onError: (message, error) => {\n console.error(`[skin-center] ${message}`, error)\n },\n })\n const adapter = createSemanticAdapter(doc)\n adapter.start()\n const disposeShellRendering = installShellRenderingAdapter(doc)\n // Seed the frost gate before any skin activation: a page that boots with an\n // external wallpaper already rendering must never mount a second glass.\n setComposerFrostSuppressed(doc, options.suppressComposerFrost?.() === true)\n\n let catalog: CatalogSkin[] | null = null\n let diagnostics: CatalogDiagnostic[] = []\n // Two distinct roles, deliberately kept apart: store SUBSCRIBERS wake on\n // every emit(), while TEARDOWNS run only from shutdown(). They used to share\n // one set, and because emit() invokes every member, the window-listener\n // removal registered below ran on the very first catalog load — unsubscribing\n // the 'dsh-skin-applied' handler for the rest of the page (issue #1740).\n const listeners = new Set<() => void>()\n const teardowns = new Set<() => void>()\n const emit = (): void => {\n for (const listener of listeners) listener()\n }\n\n async function refreshCatalog(): Promise<void> {\n const res = await fetchImpl(`${apiBase}/catalog`)\n if (!res.ok) throw new Error(`catalog fetch -> ${res.status}`)\n const payload = (await res.json()) as {\n ok: boolean\n skins?: CatalogSkin[]\n diagnostics?: CatalogDiagnostic[]\n }\n catalog = payload.skins ?? []\n diagnostics = payload.diagnostics ?? []\n emit()\n }\n\n const store: SkinRuntimeStore = {\n controller,\n adapter,\n doc,\n window: doc.defaultView ?? window,\n apiBase,\n fetchImpl,\n catalog: () => catalog,\n diagnostics: () => diagnostics,\n refreshCatalog,\n find(id) {\n return catalog?.find((s) => s.manifest.id === id) ?? null\n },\n subscribe(listener) {\n const off = controller.subscribe(listener)\n listeners.add(listener)\n return () => {\n off()\n listeners.delete(listener)\n }\n },\n shutdown() {\n adapter.stop()\n disposeShellRendering()\n controller.shutdown()\n for (const teardown of [...teardowns]) teardown()\n teardowns.clear()\n listeners.clear()\n },\n }\n\n // E2e/acceptance handle: exposes the boot store on the window for\n // scripted probes (see tests and the acceptance checklist).\n {\n const root = doc.defaultView as { __skinRuntime?: SkinRuntimeStore } & Window\n root.__skinRuntime = store\n }\n\n // Initial activation: apply the persisted selection from the snapshot.\n //\n // Every switch here ADOPTS (issue #54). Boot is a READER: the selection it\n // applies was written by whoever chose it - this page on an earlier load, or\n // another client sharing the DSH home. Committing it back would make this\n // page's own view of the selection authoritative, so a page booting from a\n // stale `html[data-dsh-skin]` stamp would overwrite a newer choice another\n // client has since saved (the desktop and web profiles share one\n // skin-center-active.json, and both read it on boot).\n void (async () => {\n try {\n await refreshCatalog()\n let active = doc.documentElement?.getAttribute('data-dsh-skin') || null\n if (!active) {\n const res = await fetchImpl(`${apiBase}/active`)\n const payload = (await res.json()) as { ok: boolean; active?: string | null }\n active = payload.ok && typeof payload.active === 'string' ? payload.active : null\n }\n if (active === null) return\n let entry = store.find(active)\n if (entry === null) {\n // A selection no catalog row answers for: its files are gone, or it\n // names a delegated skin this build does not know. A delegated row is\n // listed whether or not its plugin is installed, so it resolves here\n // and only a truly unknown id lands on this fallback.\n const defaultEntry = store.find('blue-fantasy')\n if (defaultEntry !== null) {\n await controller.adopt('blue-fantasy', defaultEntry as ControllerSkinEntry)\n } else {\n await controller.adopt(null, null)\n }\n return\n }\n await controller.adopt(active, entry as ControllerSkinEntry)\n } catch {\n // Fail-closed: boot into the stock look; the card surfaces catalog\n // errors through diagnostics().\n await controller.adopt(null, null).catch(() => {})\n }\n })()\n\n // The workshop announcement converges this page on a skin installed while\n // it was open; the runtime store owns that listener for its own lifetime.\n teardowns.add(trackSkinAppliedEvents(store))\n\n return store\n}\n\n/**\n * Install the skin-applied contract: a window event carrying the applied skin\n * id makes this page converge on that skin immediately.\n *\n * The v1 runtime booted through a full document reload, so any page that\n * switched the skin could assume the next load picked the new selection up -\n * the workshop card simply reloaded. The v2 runtime applies in place, so the\n * page that is already open has to converge on the write, and the workshop\n * installs the skin files itself. Legacy-bridge pages announce through that\n * reload event; wiring it here keeps one converge path instead of two.\n * @param store - the runtime store the event converges.\n * @param win - the window whose document the runtime owns.\n * @returns the idempotent listener teardown.\n */\nexport function trackSkinAppliedEvents(store: SkinRuntimeStore): () => void {\n const win = store.window\n const onApplied = (event: Event): void => {\n const detail = (event as CustomEvent<{ id?: unknown }>).detail\n if (detail === null || typeof detail !== 'object') return\n const id = (detail as { id?: unknown }).id\n if (typeof id !== 'string' || id === '') return\n void convergeOnSkin(store, id)\n }\n win.addEventListener('dsh-skin-applied', onApplied)\n return () => { win.removeEventListener('dsh-skin-applied', onApplied) }\n}\n\n/** Polling cadence for a selection changed outside this page. */\nconst SELECTION_POLL_MS = 2000\n\n/** Read the persisted selection; undefined when the endpoint cannot answer. */\nasync function fetchPersistedSelection(store: SkinRuntimeStore): Promise<string | null | undefined> {\n let res: Response\n try {\n res = await store.fetchImpl(`${store.apiBase}/active`)\n } catch {\n return undefined\n }\n if (!res.ok) return undefined\n let payload: { ok?: boolean; active?: unknown }\n try {\n payload = (await res.json()) as { ok?: boolean; active?: unknown }\n } catch {\n return undefined\n }\n if (payload.ok !== true) return undefined\n return typeof payload.active === 'string' && payload.active !== '' ? payload.active : null\n}\n\n/**\n * Read the persisted selection for a follower that may converge on it:\n * undefined while a switch is in flight, before AND after the read.\n *\n * A switch in flight owns the page's activation, and converging on a selection\n * read during that window supersedes it (that follower switch opens a newer\n * request). The desktop client boots exactly that way - no tapIndex stamp, so\n * its selection arrives from GET /active while the wallpaper watcher is\n * already publishing - and the follower would strand the page on the boot\n * activation's stale paint (issue #1805).\n *\n * The check brackets the request on both sides because a switch can start while\n * the GET is in flight: the value this read returns is then already older than\n * the page's activation, and converging on it would supersede that switch. The\n * read is not lost either way - the next poll sees the same value once the\n * switch has settled.\n */\nasync function readPersistedSelection(store: SkinRuntimeStore): Promise<string | null | undefined> {\n if (store.controller.isSwitching()) return undefined\n const selection = await fetchPersistedSelection(store)\n if (store.controller.isSwitching()) return undefined\n return selection\n}\n\n/**\n * Converge on the skin the persisted selection names, re-reading the catalog\n * first when the id is not in the current snapshot (a workshop install lands\n * after the page read the catalog).\n *\n * Convergence ADOPTS the selection (issue #54): this page is following a choice\n * made elsewhere, so it applies that choice without writing it back. The value\n * it is converging on was already persisted by whoever made it, and echoing it\n * would let a reader overwrite a newer write - the second page to boot would\n * win regardless of which choice was newer.\n */\nasync function convergeOnSelection(store: SkinRuntimeStore, id: string | null): Promise<void> {\n if (id !== null && store.find(id) === null) {\n try {\n await store.refreshCatalog()\n } catch {\n // A failed re-read keeps the current snapshot; a skin already in it\n // still converges.\n }\n }\n if (id === null) {\n await store.controller.adopt(null, null)\n return\n }\n const entry = store.find(id)\n if (entry === null) return\n await store.controller.adopt(id, entry as ControllerSkinEntry)\n}\n\n/** Converge on an announced skin id, re-reading the catalog when it is new. */\nasync function convergeOnSkin(store: SkinRuntimeStore, id: string): Promise<void> {\n await convergeOnSelection(store, id)\n}\n\n/**\n * Install the skin-applied contract: a window event carrying the applied skin\n * id makes this page converge on that skin immediately.\n *\n * The v1 runtime booted through a full document reload, so any page that\n * switched the skin could assume the next load picked the new selection up -\n * the workshop card simply reloaded. The v2 runtime applies in place, so the\n * page already open has to converge on the write, and the workshop installs\n * the skin files itself. The workshop card announces through that reload\n * event; this is the one converge path for it.\n * @param store - the booted runtime store.\n * @returns the idempotent teardown of the listener.\n */\nexport function watchSkinAppliedEvents(store: SkinRuntimeStore): () => void {\n return trackSkinAppliedEvents(store)\n}\n\n/**\n * Follow the persisted selection while this page is open.\n *\n * Applying a skin and saving that choice are one action in the GUI, but the\n * choice is persisted for the NEXT page load. The conventional route is the\n * official settings form: it writes the settings row this plugin owns, the\n * Host applies it, and nothing inside this page is told. That row is seeded\n * from the skin center's own configuration, so the two are the same choice\n * written twice, and this page reads it back rather than assuming it owns\n * every write (issue #1740).\n *\n * The poll only reads: it never writes the selection back (it converges through\n * `controller.adopt`, issue #54), it skips a value already applied, and it\n * stops while the page is hidden.\n * @param store - the booted runtime store.\n * @param intervalMs - polling cadence in milliseconds.\n * @returns the idempotent teardown of the poll.\n */\nexport function watchPersistedSelection(\n store: SkinRuntimeStore,\n intervalMs: number = SELECTION_POLL_MS,\n): () => void {\n let applied: string | null | undefined\n // Window timers, not the ambient ones: the two are different types once\n // Node's globals are in the program (index.ts / boot.ts both are).\n let timer: number | null = null\n let stopped = false\n\n const tick = async (): Promise<void> => {\n if (stopped) return\n const next = await readPersistedSelection(store)\n if (stopped || next === undefined || next === applied) return\n applied = next\n await convergeOnSelection(store, next)\n }\n\n const stopTimer = (): void => {\n if (timer !== null) store.window.clearInterval(timer)\n timer = null\n }\n const startTimer = (): void => {\n if (stopped || timer !== null) return\n timer = store.window.setInterval(() => { void tick() }, intervalMs)\n }\n\n void (async () => {\n // Seed the baseline from what this page actually ends up showing, not from\n // a blind disk read (issue #54). Boot adopts the id its own\n // `data-dsh-skin` stamp names, or the persisted selection when there is no\n // stamp; when the two differ, another client wrote a newer choice while\n // this page was loading, and the page must still converge on it. Seeding\n // the disk value unconditionally would mark that newer choice \"already\n // applied\" and strand the page on the older skin.\n //\n // `undefined` leaves the baseline unset, so the first tick converges on\n // the persisted selection. That used to be the thing this seeding avoided -\n // re-activating restarts the skin runtime's own work - but converging is\n // an ADOPT now, so the cost is a repaint and never a write.\n const stamp = store.doc.documentElement?.getAttribute('data-dsh-skin') || null\n const persisted = await fetchPersistedSelection(store)\n applied = persisted === undefined\n ? undefined\n : (stamp === null || stamp === persisted ? persisted : undefined)\n if (!stopped) startTimer()\n })()\n\n // A hidden page polls for nothing, and comes back to whatever was applied\n // while it was away, so the cadence follows the document's visibility.\n const onVisibility = (): void => {\n if (store.doc.visibilityState === 'visible') {\n startTimer()\n void tick()\n } else {\n stopTimer()\n }\n }\n store.doc.addEventListener('visibilitychange', onVisibility)\n\n return () => {\n stopped = true\n stopTimer()\n store.doc.removeEventListener('visibilitychange', onVisibility)\n }\n}\n","/**\n * One-click install of a plugin this package points at, through the host.\n *\n * Two of this package's surfaces are delegated to other plugins rather than\n * implemented here — wallpapers to `dsh-plugin-wallpaper-engine` (issue #39)\n * and a whole-GUI theme to `dsh-claude-style` (see\n * core/delegated-skins.ts) — and a pointer is only useful if the user can act\n * on it. Both install through whichever plugin-management face the running host\n * publishes: the same call the official Plugins page and the Workshop store\n * make, rather than a writer of this package's own.\n *\n * Two faces are bridged, each OPTIONAL and each resolved through\n * `ctx.inject` (never the module-level inject array, which would park this\n * plugin on hosts that publish neither):\n *\n * - `remote.pluginManager` — the official in-process manager's client remote\n * namespace. The API gateway registers every namespace as the service\n * `remote.<namespace>`, and `installBundle` is the very call the official\n * Plugins page makes, so this works on the packaged Desktop client too,\n * where the CLI refuses the application-owned profile.\n * - `pluginManager` — the family face published by\n * `@linxin666/dsh-client-ui-plugin-manager`, kept as the fallback for hosts\n * that publish no official remote.\n *\n * When neither face is present the caller keeps its read-only copy-command\n * fallback.\n *\n * CONTRACT OBSERVATION: repository rules forbid cross-package value imports, so\n * the members this module calls are re-declared here. Both sides must stay\n * compatible on the wire.\n * @module @linxin666/dsh-client-ui-skin-center/plugin-install-faces\n */\n\nimport type { Context } from '@deepseek-ai/cordis'\n\n/** Result envelope every `remote.<namespace>` method resolves with. */\nexport type NativeRemoteResult<T> =\n | { ok: true; value: T }\n | { ok: false; error: { code?: string; message?: string } }\n\n/** The official in-process plugin manager's client remote namespace. */\nexport interface NativePluginManagerService {\n /**\n * Install (or update) one package spec through the official manager.\n * @param spec - package spec, e.g. `@scope/pkg` or `@scope/pkg@1.2.3`.\n * @param options - activation choice and the request id the run is tracked under.\n */\n installBundle(spec: string, options?: { enabled?: boolean; requestId?: string }): Promise<NativeRemoteResult<unknown>>\n}\n\n/** The family plugin-manager face (mirrors its frozen cross-plugin contract). */\nexport interface FamilyPluginManagerService {\n /** Whether this browser has loopback authority over the host routes. */\n readonly isLoopback: boolean\n /** Install one plugin from an npm spec or git URL. */\n install(spec: string): Promise<unknown>\n}\n\n/**\n * The official Plugins page's navigation face.\n *\n * Installing a plugin leaves the reader with one question the installer cannot\n * answer: where to turn it on, and what it installed. The official panel already\n * renders enablement, uninstall and install diagnostics, so a row that just\n * installed something hands the reader there instead of growing a management\n * surface of its own. Same face the Workshop store uses.\n */\nexport interface PluginNavigationService {\n /**\n * Open one installed bundle's page in the official Plugins panel.\n * @param packageName - installed dependency (package) name.\n */\n openBundle(packageName: string): void\n}\n\n/** The faces this module bridged, any of which may be absent. */\nexport interface InstallFaces {\n readonly native: NativePluginManagerService | null\n readonly family: FamilyPluginManagerService | null\n readonly navigation: PluginNavigationService | null\n}\n\nlet faces: InstallFaces = { native: null, family: null, navigation: null }\nconst listeners = new Set<() => void>()\n\n/** Current faces snapshot (a cached reference, safe for useSyncExternalStore). */\nexport function getInstallFaces(): InstallFaces {\n return faces\n}\n\n/** Subscribe to face changes; returns the unsubscribe function. */\nexport function subscribeInstallFaces(listener: () => void): () => void {\n listeners.add(listener)\n return () => { listeners.delete(listener) }\n}\n\n/** Merge one face change into the snapshot and notify subscribers. */\nfunction patchFaces(patch: Partial<InstallFaces>): void {\n faces = { ...faces, ...patch }\n for (const listener of listeners) listener()\n}\n\n/**\n * npm package name (optionally scoped, lowercase) plus the optional concrete\n * version/tag suffix npm accepts. Mirrors the store's own rule so this module\n * can never hand a manager a spec the store would have rejected.\n */\nconst NPM_SPEC = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*(?:@[0-9A-Za-z][0-9A-Za-z._-]*)?$/\n\n/**\n * Whether one install spec is safe to hand to a plugin manager.\n * @param spec - the candidate spec.\n * @returns true for a plain npm package name (optionally `pkg@version`).\n */\nexport function isInstallSpecValid(spec: string): boolean {\n return NPM_SPEC.test(spec)\n}\n\n/**\n * Bridge both optional faces into the module store. Uses `ctx.inject` so each\n * face stays optional: the inner callback runs when the face is provided and is\n * disposed when it goes away, which clears the store.\n * @param ctx - the client root context.\n */\nexport function bridgeInstallFaces(ctx: Context): void {\n ctx.inject(['remote.pluginManager'], (inner) => {\n inner.effect(() => {\n patchFaces({ native: (inner.get('remote.pluginManager') as NativePluginManagerService | undefined) ?? null })\n return () => { patchFaces({ native: null }) }\n }, 'ui-skin-center: official pluginManager bridge')\n })\n ctx.inject(['pluginManager'], (inner) => {\n inner.effect(() => {\n patchFaces({ family: (inner.get('pluginManager') as FamilyPluginManagerService | undefined) ?? null })\n return () => { patchFaces({ family: null }) }\n }, 'ui-skin-center: family pluginManager bridge')\n })\n ctx.inject(['pluginNavigation'], (inner) => {\n inner.effect(() => {\n patchFaces({ navigation: (inner.get('pluginNavigation') as PluginNavigationService | undefined) ?? null })\n return () => { patchFaces({ navigation: null }) }\n }, 'ui-skin-center: official pluginNavigation bridge')\n })\n}\n\n/** Outcome of one install attempt. */\nexport type InstallOutcome =\n | { kind: 'installed' }\n | { kind: 'no-manager' }\n | { kind: 'failed'; message: string }\n\n/**\n * Install one spec through whichever management face is available.\n *\n * The official in-process manager is preferred whenever it is published: it is\n * the same call the official Plugins page makes and the only writer on the\n * packaged Desktop client. The family face is the fallback.\n *\n * @param spec - validated package spec.\n * @param requestId - id the run is tracked under.\n * @returns the outcome; never throws.\n */\nexport async function installPluginSpec(spec: string, requestId: string): Promise<InstallOutcome> {\n const useNative = faces.native !== null && typeof faces.native.installBundle === 'function'\n const useFamily = faces.family !== null && typeof faces.family.install === 'function'\n if (!isInstallSpecValid(spec)) {\n return { kind: 'failed', message: 'invalid install spec' }\n }\n if (!useNative && !useFamily) return { kind: 'no-manager' }\n try {\n if (useNative) {\n const result = await faces.native!.installBundle(spec, { enabled: true, requestId })\n if (result !== null && typeof result === 'object' && result.ok === false) {\n const error = (result as { error?: { code?: string; message?: string } }).error\n return { kind: 'failed', message: error?.message ?? error?.code ?? 'install failed' }\n }\n return { kind: 'installed' }\n }\n await faces.family!.install(spec)\n return { kind: 'installed' }\n } catch (error) {\n return { kind: 'failed', message: error instanceof Error ? error.message : String(error) }\n }\n}\n","/**\n * External Wallpaper Engine plugin pointer (issue #39, migration round).\n *\n * Wallpaper support no longer ships inside the skin center: it is delegated to\n * `dsh-plugin-wallpaper-engine`. This card occupies the place the wallpaper\n * controls used to, so the feature stays discoverable where users expect it.\n * The plugin is a recommended Workshop item, so the card offers a ONE-CLICK\n * INSTALL through whichever plugin-management face the host publishes\n * (see external-wallpaper-install.ts) and falls back to the copy-command line\n * when the host publishes none.\n *\n * Three states, all driven by the read-only host probe\n * (see src/external-wallpaper.ts):\n * - not installed, with a management face: the recommended badge plus an\n * Install button;\n * - not installed, no face: the copy-command fallback;\n * - installed: states that wallpapers are configured there, and that an\n * active wallpaper pauses this card's skin.\n *\n * Nothing renders when the probe cannot be reached, so an older host never\n * shows a false \"not installed\" prompt.\n */\nimport { useEffect, useState, useSyncExternalStore, type ReactNode } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport {\n getWallpaperInstallFaces,\n installPluginSpec,\n isInstallSpecValid,\n subscribeWallpaperInstallFaces,\n} from './external-wallpaper-install.ts'\nimport css from './skin-center.module.css'\n\n/** Host base path of the probe (mirrors src/routes-v2.ts). */\nconst EXTERNAL_WALLPAPER_API = '/api/skin-center/v2/external-wallpaper'\n\n/** The probe payload, as far as this pointer reads it. */\ninterface ExternalWallpaperPayload {\n ok?: boolean\n installed?: boolean\n packageName?: string\n repository?: string\n installCommand?: string\n /** npm spec the one-click install hands to the plugin manager. */\n npm?: string\n}\n\n/** The payload narrowed to what the pointer renders. */\ninterface ExternalWallpaperState {\n installed: boolean\n packageName: string\n repository: string\n installCommand: string\n npm: string\n}\n\n/** Fallbacks used only when the host omits a field. */\nconst FALLBACK = {\n packageName: 'dsh-plugin-wallpaper-engine',\n repository: 'https://github.com/elysia395/dsh-wallpaper-engine',\n installCommand: 'dsh plugin --profile web add dsh-plugin-wallpaper-engine',\n npm: 'dsh-plugin-wallpaper-engine',\n}\n\n/** The copyable command line, used when no management face is available. */\nasync function copyText(text: string): Promise<boolean> {\n try {\n await navigator.clipboard.writeText(text)\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Render the delegated-plugin pointer, or nothing when the probe cannot be\n * reached.\n * @param props - the card's locale seat.\n * @returns the pointer, or null.\n */\nexport function ExternalWallpaperNotice({ t }: { t: PropsLocale<'skinCenter'>['t'] }): ReactNode {\n const [state, setState] = useState<ExternalWallpaperState | null>(null)\n const faces = useSyncExternalStore(subscribeWallpaperInstallFaces, getWallpaperInstallFaces)\n const [installing, setInstalling] = useState(false)\n const [notice, setNotice] = useState<'copied' | 'failed' | null>(null)\n const [error, setError] = useState<string | null>(null)\n\n useEffect(() => {\n let cancelled = false\n void fetch(EXTERNAL_WALLPAPER_API)\n .then((res) => (res.ok ? res.json() as Promise<ExternalWallpaperPayload> : null))\n .then((payload) => {\n if (cancelled || payload?.ok !== true) return\n setState({\n installed: payload.installed === true,\n packageName: typeof payload.packageName === 'string' && payload.packageName !== ''\n ? payload.packageName\n : FALLBACK.packageName,\n repository: typeof payload.repository === 'string' && payload.repository !== ''\n ? payload.repository\n : FALLBACK.repository,\n installCommand: typeof payload.installCommand === 'string' && payload.installCommand !== ''\n ? payload.installCommand\n : FALLBACK.installCommand,\n npm: typeof payload.npm === 'string' && payload.npm !== '' ? payload.npm : FALLBACK.npm,\n })\n })\n .catch(() => {\n // Offline, fenced, or a host without the route: stay silent rather\n // than claim the plugin is missing.\n })\n return () => { cancelled = true }\n }, [])\n\n if (state === null) return null\n\n // A manager exists when either face is published; installPluginSpec itself\n // prefers the official in-process manager.\n const canInstall = faces.native !== null || faces.family !== null\n const spec = state.npm\n\n const onInstall = (): void => {\n if (installing || !isInstallSpecValid(spec)) return\n setInstalling(true)\n setError(null)\n setNotice(null)\n const cryptoObj = typeof window === 'undefined' ? undefined : window.crypto\n const requestId = cryptoObj && typeof cryptoObj.randomUUID === 'function'\n ? cryptoObj.randomUUID()\n : 'skin-center-wallpaper-' + spec\n void installPluginSpec(spec, requestId).then((outcome) => {\n // 'installed' needs no message: the probe re-reads on the next mount, and\n // a host that hot-reloads the row reports the new plugin itself.\n if (outcome.kind === 'failed') setError(outcome.message)\n }).finally(() => { setInstalling(false) })\n }\n\n const onCopy = (): void => {\n void copyText(state.installCommand).then((ok) => { setNotice(ok ? 'copied' : 'failed') })\n }\n\n return (\n <div className={css.externalWallpaperNotice} role=\"status\">\n <div className={css.externalWallpaperTitle}>\n {state.installed ? t('externalWallpaperReadyTitle') : t('externalWallpaperMissingTitle')}\n </div>\n {!state.installed && (\n <span className={css.externalWallpaperBadge}>{t('externalWallpaperRecommended')}</span>\n )}\n <p className={css.externalWallpaperBody}>\n {state.installed\n ? t('externalWallpaperReadyBody')\n : t('externalWallpaperMissingBody', { package: state.packageName })}\n </p>\n {!state.installed && (\n <div className={css.externalWallpaperActions}>\n {canInstall && (\n <button\n type=\"button\"\n className={css.button + ' ' + css.buttonPrimary}\n disabled={installing}\n onClick={onInstall}\n >\n {installing ? t('externalWallpaperInstalling') : t('externalWallpaperInstall')}\n </button>\n )}\n {!canInstall && (\n <code className={css.externalWallpaperCommand}>{state.installCommand}</code>\n )}\n <button type=\"button\" className={css.button} disabled={installing} onClick={onCopy}>\n {notice === 'copied' ? t('externalWallpaperCopied') : t('externalWallpaperCopyCommand')}\n </button>\n </div>\n )}\n {error !== null && (\n <p className={css.externalWallpaperError} role=\"alert\">\n {t('externalWallpaperInstallFailed', { reason: error })}\n </p>\n )}\n <a\n className={css.externalWallpaperLink}\n href={state.repository}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {t('externalWallpaperLink')}\n </a>\n </div>\n )\n}\n","/**\n * The delegated-skin row: a skin whose visual is another plugin's.\n *\n * It renders where the wallpaper controls used to live and where a skin's own\n * card lives now, because it is both: it is a selection (apply it, and it is\n * remembered across a reload) and an install prompt (the plugin that paints it\n * is a separate package). The row is listed whether or not that package is\n * installed, because an installed-and-enabled plugin that the card hid until\n * the user went to the store is a plugin nobody finds.\n *\n * It is a full-width bar ABOVE the skin grid, not a tile among them: it has no\n * preview image (the plugin paints, and this package holds no screenshot of\n * it), so a tile sized for a 16:9 thumbnail would be mostly empty. The bar\n * carries the same head / tagline / actions shape as the custom-theme card\n * below the grid, so the two non-asset looks read as the same kind of row.\n *\n * The body is the LOOK, not the row's state: a short description of what\n * applying it gives you. State belongs to the badge (this row is active) and\n * to the buttons (you can pick it, or you cannot, and here is the button that\n * fixes that). Prose about the row's own state sat where a reader looks for a\n * description of the theme, and said nothing they could not already see.\n *\n * Two states still earn one line each, because in both the row withholds the\n * selection buttons and silence would read as a bug: a plugin that cannot hand\n * the page back yet, and a descriptor the installed package has outgrown.\n *\n * Three states, all read from two sources and never guessed:\n *\n * - not installed: the one-click install through whichever plugin-management\n * face the host publishes, or the exact command when it publishes none;\n * - installed but not live: the plugin is wired into this profile but its\n * browser half is not on the page, so this row cannot paint yet. The row\n * says so instead of offering an apply that would deliver nothing;\n * - live: the plugin paints. Try-on and apply are offered, because from here\n * the selection is a normal one and every other skin, the stock look and a\n * running wallpaper all take the page back.\n *\n * A live plugin that does NOT advertise the handoff attribute is a build that\n * cannot stand down. Offering apply on it would let the user select this skin\n * and then pick a real skin over it, which is the broken overlap the whole\n * delegation exists to prevent, so the row says the plugin has to be updated\n * and still lets them look at it.\n *\n * The state that needs care is ABSENT markers while a skin is painted. That is\n * what a working handoff looks like from out here: the plugin is installed,\n * running, and standing down because this card's own skin owns the page. Read\n * as \"not running\" it both lies and strands the reader — no buttons, no way\n * back — so the row takes {@link DelegatedSkinCardProps.yieldedToSkin} from the\n * card (which knows what is painted), says the plugin yielded, and keeps the\n * try-on / apply buttons: switching back is exactly the action that hands the\n * page over again.\n *\n * Everything the peer publishes is read, never written: the two attributes\n * (see runtime/delegated-theme.ts) and the install call the host itself makes.\n * @module @linxin666/dsh-client-ui-skin-center/DelegatedSkinCard\n */\nimport { useState, useSyncExternalStore, type ReactNode } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\n\nimport type { SkinCenterKey } from './locales.ts'\n\nimport {\n getInstallFaces,\n installPluginSpec,\n isInstallSpecValid,\n subscribeInstallFaces,\n} from './plugin-install-faces.ts'\nimport type { CatalogSkin } from './runtime/boot.ts'\nimport type { DelegatedThemeState } from './runtime/delegated-theme.ts'\nimport css from './skin-center.module.css'\n\n/** The delegated payload a delegated row's manifest carries. */\ninterface DelegatedPayload {\n package: string\n repository: string\n installCommand: string\n bodyAttr: string\n handoffAttr: string\n installed: boolean\n signals: string[]\n descriptorMatches: boolean | null\n}\n\n/** Business face the card injects; the row needs only the theme state. */\nexport interface DelegatedSkinCardProps {\n t: PropsLocale<'skinCenter'>['t']\n skin: CatalogSkin\n /** Whether the delegated plugin is on this page, and whether it can yield. */\n theme: DelegatedThemeState\n isActive: boolean\n isTrying: boolean\n /**\n * True when this row has no markers of its own but a real skin is painted:\n * the delegated plugin is running and standing down for that skin, which is\n * the handoff working, not a plugin that failed to load.\n */\n yieldedToSkin: boolean\n busy: boolean\n disabled: boolean\n onTryOn: () => void\n onExitTryOn: () => void\n onApply: () => void\n /** Re-read the catalog after a successful install (the probe moves). */\n onInstalled: () => void\n}\n\n/** The copyable command line, used when no management face is available. */\nasync function copyText(text: string): Promise<boolean> {\n try {\n await navigator.clipboard.writeText(text)\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Render one delegated-skin row.\n * @param props - the row's locale seat, its catalog entry and the card's actions.\n * @returns the row.\n */\nexport function DelegatedSkinCard(props: DelegatedSkinCardProps): ReactNode {\n const { t, skin, theme, isActive, isTrying, yieldedToSkin, busy, disabled } = props\n const manifest = skin.manifest as CatalogSkin['manifest'] & { delegated: DelegatedPayload }\n const payload = manifest.delegated\n const accent = manifest.accent ?? '#98a1ab'\n // The registry names the dictionary key rather than carrying the words, so\n // the body follows the interface language. The one narrowing cast lives here:\n // core cannot import the client's key union, and a missing key would render\n // the key itself, which is loud enough to catch.\n const description = t(manifest.descriptionKey as SkinCenterKey)\n const faces = useSyncExternalStore(subscribeInstallFaces, getInstallFaces)\n const [installing, setInstalling] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [notice, setNotice] = useState<'copied' | 'failed' | null>(null)\n\n const canInstall = faces.native !== null || faces.family !== null\n const spec = payload.package\n // The row is applicable when the plugin can own the page: it owns it now\n // (live and able to yield back), or it will the moment nothing else paints\n // (yielded to the skin this card has selected). A plugin that is installed\n // but neither live nor yielding is not on this page at all.\n const applicable = payload.installed && theme.live\n ? theme.canYield\n : payload.installed && yieldedToSkin\n const claimable = payload.installed && theme.live && !theme.canYield\n\n const onInstall = (): void => {\n if (installing || !isInstallSpecValid(spec)) return\n setInstalling(true)\n setError(null)\n const cryptoObj = typeof window === 'undefined' ? undefined : window.crypto\n const requestId = cryptoObj && typeof cryptoObj.randomUUID === 'function'\n ? cryptoObj.randomUUID()\n : 'skin-center-delegated-' + spec\n void installPluginSpec(spec, requestId).then((outcome) => {\n if (outcome.kind === 'failed') {\n setError(outcome.message)\n return\n }\n if (outcome.kind === 'installed') props.onInstalled()\n }).finally(() => { setInstalling(false) })\n }\n\n const onCopy = (): void => {\n void copyText(payload.installCommand).then((ok) => { setNotice(ok ? 'copied' : 'failed') })\n }\n\n // One line, and only where the row withholds the selection buttons: the\n // reason it withholds them. Everything else about the state is already on\n // screen (the badge says active, the buttons say pickable).\n const blocker = claimable\n ? t('delegatedSkinNoHandoff')\n : payload.installed && !applicable && !yieldedToSkin\n ? t('delegatedSkinNotRunning')\n : null\n\n return (\n <div className={`${css.card} ${css.delegatedCard}`} data-delegated-skin={manifest.id}>\n <div className={css.cardHead}>\n <span className={css.swatch} style={{ background: accent }} aria-hidden=\"true\" />\n <span className={css.cardName} title={manifest.nameEn}>{manifest.nameEn}</span>\n <span className={css.delegatedBadge}>{t('delegatedSkinBadge')}</span>\n {(isActive || isTrying) && (\n <span className={`${css.badge} ${isActive && !isTrying ? css.badgeActive : css.badgeTrying}`}>\n {isActive && !isTrying ? t('active') : t('tryingOn')}\n </span>\n )}\n </div>\n <div className={css.cardTagline} title={manifest.tagline ?? ''}>{manifest.tagline ?? ''}</div>\n <p className={css.delegatedDescription}>{description}</p>\n {blocker !== null && <p className={css.delegatedStatus} role=\"status\">{blocker}</p>}\n {error !== null && (\n <p className={css.delegatedStatus} role=\"alert\">{t('delegatedSkinInstallFailed', { reason: error })}</p>\n )}\n {payload.descriptorMatches === false && (\n <p className={css.delegatedStatus} role=\"alert\">{t('delegatedSkinDescriptorMismatch')}</p>\n )}\n <div className={css.actions}>\n {!payload.installed && (\n <>\n {canInstall ? (\n <button\n type=\"button\"\n className={`${css.button} ${css.buttonPrimary}`}\n disabled={installing || disabled}\n onClick={onInstall}\n >\n {installing ? t('delegatedSkinInstalling') : t('delegatedSkinInstall')}\n </button>\n ) : (\n <code className={css.externalWallpaperCommand}>{payload.installCommand}</code>\n )}\n <button type=\"button\" className={css.button} disabled={installing || disabled} onClick={onCopy}>\n {notice === 'copied' ? t('externalWallpaperCopied') : t('externalWallpaperCopyCommand')}\n </button>\n </>\n )}\n {payload.installed && faces.navigation !== null && (\n <button type=\"button\" className={css.button} onClick={() => { faces.navigation?.openBundle(spec) }}>\n {t('delegatedSkinManage')}\n </button>\n )}\n {applicable && (\n isActive && !isTrying ? (\n <button type=\"button\" className={`${css.button} ${css.buttonGhost}`} disabled>\n {t('tryOn')}\n </button>\n ) : (\n <>\n <button\n type=\"button\"\n className={`${css.button} ${css.buttonPrimary}`}\n disabled={busy || disabled}\n onClick={isTrying ? props.onExitTryOn : props.onTryOn}\n >\n {isTrying ? t('exitTryOn') : t('tryOn')}\n </button>\n <button type=\"button\" className={css.button} disabled={busy || disabled} onClick={props.onApply}>\n {busy ? t('applying') : t('apply')}\n </button>\n </>\n )\n )}\n </div>\n <a\n className={css.delegatedLink}\n href={payload.repository}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {t('delegatedSkinLink')}\n </a>\n </div>\n )\n}\n","/**\n * Delegated skins: a skin whose visual is produced by ANOTHER plugin.\n *\n * Every skin in this package is a pure asset directory under skins/<id>/\n * (see contracts/README.md): this package loads the CSS, paints the\n * background media and stamps html[data-dsh-skin]. That model cannot express a\n * whole-GUI theme another package ships as a plugin, and pretending otherwise\n * is what the v1 package / wiring / bodyAttr manifest fields used to attempt,\n * which is why v2 deprecated them.\n *\n * A delegated skin is the one narrow exception, deliberately the same shape\n * as the Wallpaper Engine delegation (issue #39): the other plugin owns the\n * visual, this package keeps only the selection.\n *\n * - The delegated plugin is a separate, independently versioned package. It\n * is NOT vendored, forked or bundled here; this module only names it,\n * probes whether this profile installed it, and offers the one-click\n * install through the official plugin-management faces.\n * - The row is listed whether or not the plugin is installed, because a row\n * the user cannot use yet IS the install prompt.\n * - Applying it is a normal skin selection: it persists, it is adopted on\n * boot, and selecting anything else hands the page back. What it does not\n * do is paint, because the delegated plugin paints. See\n * src/client/runtime/skin-controller.ts for the withheld activation and\n * src/client/runtime/delegated-theme.ts for the live marker contract.\n * - The handoff is one-way and attribute-only: this package never writes an\n * attribute a delegated plugin owns, and the plugin reads the public\n * html[data-dsh-skin] stamp to stand down. See\n * contracts/semantic-attrs-v1.md.\n *\n * The registry below is the built-in copy of each delegated plugin's own\n * descriptor, because a card must be able to offer an install BEFORE the\n * package exists on disk. When the package IS installed its own descriptor\n * file is read back and compared, so a rename upstream surfaces as a catalog\n * warning instead of a silently dead handoff.\n * @module @linxin666/dsh-client-ui-skin-center/core/delegated-skins\n */\n\nimport { join } from 'node:path'\n\nimport {\n detectProfilePlugin,\n installedPackageDir,\n profilePluginPaths,\n readJsonIfFile,\n} from './profile-plugin-probe.ts'\n\n/** A delegated plugin, as this package knows it. */\nexport interface DelegatedSkinDescriptor {\n /** Persisted selection value; also the card row id. Lowercase kebab-case. */\n id: string\n /** npm package spec the one-click install hands to the plugin manager. */\n package: string\n /** Upstream repository (docs, issues, changelog). */\n repository: string\n /** The command the card copies when no management face is published. */\n installCommand: string\n /** The attribute the plugin stamps on body while it owns the page. */\n bodyAttr: string\n /**\n * The attribute the plugin stamps on body while it can hand the page back.\n * Its PRESENCE is the capability signal: a build without it cannot stand\n * down for a skin, so the row must not be offered as applicable.\n */\n handoffAttr: string\n /** The plugin's cordis row id, for diagnostics and profile inspection. */\n wiringId: string\n /** Card copy: the plugin owns the wording, this is what it ships. */\n name: string\n nameEn: string\n /** One line naming the look. */\n tagline: string\n /**\n * The locale key holding the row's body copy, not the copy itself.\n *\n * The body is what the reader reads about the look, so it has to follow the\n * interface language like every other string on this card. Keeping the text\n * here would ship one language to everyone and walk straight past the\n * zh/en/ru parity gate, so the registry names the key and the dictionary\n * (client/locales.ts) owns the words. Typed as a plain string because core\n * cannot import the client's key union; the row narrows it once.\n */\n descriptionKey: string\n /** #rrggbb swatch shown where a skin would show a preview image. */\n accent: string\n}\n\n/**\n * The Claude Code Desktop theme, as a delegated skin.\n *\n * The plugin is dsh-claude-style (https://github.com/Nwflower/dsh-claude-style),\n * which repaints the whole GUI as Claude Code Desktop. It is a peer project:\n * this package neither vendors it nor edits it, and every field below is\n * either its own published value or the contract it agreed to.\n */\nexport const CLAUDE_STYLE_SKIN: DelegatedSkinDescriptor = {\n id: 'claude-style',\n package: 'dsh-claude-style',\n repository: 'https://github.com/Nwflower/dsh-claude-style',\n installCommand: 'dsh plugin --profile web add dsh-claude-style',\n // Its own body marker: the value is the build id, the presence is the claim.\n bodyAttr: 'data-dsh-claude-style',\n // Added by the handoff contract; absent on every build that predates it.\n handoffAttr: 'data-dsh-claude-style-handoff',\n wiringId: 'ui-skin-claude-style',\n name: 'Claude Code Style',\n nameEn: 'Claude Code Style',\n tagline: 'Claude Code Desktop theme, provided by the dsh-claude-style plugin',\n descriptionKey: 'delegatedSkinDescriptionClaudeStyle',\n accent: '#d97757',\n}\n\n/** Every delegated skin this package knows. Order is the card's row order. */\nexport const DELEGATED_SKINS: readonly DelegatedSkinDescriptor[] = Object.freeze([\n CLAUDE_STYLE_SKIN,\n])\n\n/**\n * The delegated skin with this id, or null.\n * @param id - a persisted selection value.\n * @returns the descriptor, or null when the id is an asset skin or unknown.\n */\nexport function findDelegatedSkin(id: string): DelegatedSkinDescriptor | null {\n return DELEGATED_SKINS.find((skin) => skin.id === id) ?? null\n}\n\n/** Whether this id names a delegated skin (an asset skin resolves to false). */\nexport function isDelegatedSkinId(id: string): boolean {\n return findDelegatedSkin(id) !== null\n}\n\n/** The fields of a delegated descriptor this package acts on. */\nexport interface DelegatedDescriptorFields {\n id: string\n package: string\n bodyAttr: string\n wiringId: string | null\n}\n\n/**\n * Parse a delegated plugin's own descriptor file.\n *\n * The shape is the v1 delegated-skin manifest the peer already ships: an id, a\n * package, the attribute it stamps, and the wiring row it inserts. Only the\n * fields this package acts on are read, each one type-checked; anything else\n * is ignored rather than rejected, because the file belongs to another package\n * and this one must not become a second validator for it.\n * @param input - the parsed JSON (or anything else).\n * @returns the fields this package understands, or null when the core ones\n * are missing or of the wrong type.\n */\nexport function parseDelegatedDescriptor(input: unknown): DelegatedDescriptorFields | null {\n if (typeof input !== 'object' || input === null || Array.isArray(input)) return null\n const record = input as Record<string, unknown>\n const id = record.id\n const pkg = record.package\n const bodyAttr = record.bodyAttr\n if (typeof id !== 'string' || id === '') return null\n if (typeof pkg !== 'string' || pkg === '') return null\n if (typeof bodyAttr !== 'string' || bodyAttr === '') return null\n const wiring = record.wiring\n const wiringId = typeof wiring === 'object' && wiring !== null && !Array.isArray(wiring)\n && typeof (wiring as Record<string, unknown>).id === 'string'\n ? (wiring as Record<string, unknown>).id as string\n : null\n return { id, package: pkg, bodyAttr, wiringId }\n}\n\n/**\n * Read a delegated package's own descriptor file from the installed tree.\n * @param profileDir - the active profile's root directory.\n * @param packageName - the installed package.\n * @returns the parsed fields, or null when the file is absent or unreadable.\n */\nexport function readInstalledDescriptor(\n profileDir: string,\n packageName: string,\n): DelegatedDescriptorFields | null {\n const dir = installedPackageDir(profileDir, packageName)\n return parseDelegatedDescriptor(readJsonIfFile(join(dir, 'skin.json')))\n}\n\n/** Injection seam so tests never touch the real profile layout. */\nexport interface DelegatedSkinDeps {\n /** Explicit harness home / profile (tests), else the live layout. */\n home?: string\n profile?: string\n /** Registry override; defaults to DELEGATED_SKINS. */\n skins?: readonly DelegatedSkinDescriptor[]\n}\n\n/** One row of the catalog: the descriptor plus what this profile reports. */\nexport interface DelegatedSkinRow {\n descriptor: DelegatedSkinDescriptor\n /** Whether the delegated package is installed in this profile. */\n installed: boolean\n /** Probe signal names, for diagnostics. */\n signals: string[]\n /**\n * Whether the installed package's own descriptor agrees with this copy.\n * Null when the package is not installed (nothing to compare) or its\n * descriptor could not be read. False is a real mismatch and is surfaced to\n * the card: a renamed attribute or package would otherwise hand the page to\n * a plugin that never hears about it.\n */\n descriptorMatches: boolean | null\n}\n\n/**\n * Build one catalog row per delegated skin.\n *\n * The row is built whether or not the plugin is installed: a listed row with\n * installed=false is the install prompt, which is the whole point of a\n * delegated skin. The descriptor comparison is advisory, a mismatch becomes a\n * descriptorMatches=false the card can explain, and never a thrown error or a\n * skipped row.\n * @param deps - test seams; the live profile otherwise.\n * @returns one row per registry entry, in registry order.\n */\nexport function delegatedSkinRows(deps: DelegatedSkinDeps = {}): DelegatedSkinRow[] {\n const registry = deps.skins ?? DELEGATED_SKINS\n let profileDir: string | null = null\n try {\n profileDir = profilePluginPaths({ home: deps.home, profile: deps.profile }).profileDir\n } catch {\n profileDir = null\n }\n return registry.map((descriptor) => {\n const probe = detectProfilePlugin(descriptor.package, { home: deps.home, profile: deps.profile })\n let descriptorMatches: boolean | null = null\n if (probe.installed && profileDir !== null) {\n const installed = readInstalledDescriptor(profileDir, descriptor.package)\n descriptorMatches = installed === null\n ? null\n : installed.id === descriptor.id\n && installed.package === descriptor.package\n && installed.bodyAttr === descriptor.bodyAttr\n }\n return { descriptor, installed: probe.installed, signals: probe.signals, descriptorMatches }\n })\n}\n","/**\n * The delegated-skin face the skin center injects into its card.\n *\n * A delegated skin (src/core/delegated-skins.ts) is painted by another\n * plugin, so the card cannot decide on its own whether that plugin is on the\n * page: the answer is the plugin's own document marker, watched in\n * runtime/delegated-theme.ts. This handle is the read-only projection of that\n * watcher the card renders from.\n *\n * It carries no controls. Nothing here writes the other plugin's attributes\n * and nothing here installs or disables it; the row's Install button goes\n * through the host's own plugin manager (plugin-install-faces.ts).\n */\nimport { DELEGATED_SKINS } from '../core/delegated-skins.ts'\nimport type { DelegatedThemeState } from './runtime/delegated-theme.ts'\n\n/** What the card needs to know about one delegated plugin. */\nexport interface DelegatedSkinHandle {\n /** The delegated skin ids this build knows, in card row order. */\n ids(): string[]\n /** Whether that plugin is on this page, and whether it can stand down. */\n state(id: string): DelegatedThemeState\n /** Observe a change in {@link state} for any delegated skin. */\n subscribe(listener: () => void): () => void\n}\n\n/**\n * Build the card's delegated-skin face over a state reader.\n * @param read - the current state of one delegated skin id.\n * @param subscribe - subscribe to changes of any of them.\n * @returns the handle the card consumes.\n */\nexport function createDelegatedSkinHandle(\n read: (id: string) => DelegatedThemeState,\n subscribe: (listener: () => void) => () => void,\n): DelegatedSkinHandle {\n return {\n ids: () => DELEGATED_SKINS.map((skin) => skin.id),\n state: read,\n subscribe,\n }\n}\n","import { useEffect, useState, useSyncExternalStore, type ReactNode } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\n\nimport type { CustomThemeController, CustomThemeScheme } from './custom-theme-controller.ts'\nimport css from './skin-center.module.css'\n\ntype ColorKey = 'accent' | 'background' | 'foreground'\n\nexport interface CustomThemeCardProps {\n t: PropsLocale<'skinCenter'>['t']\n customTheme: CustomThemeController\n scheme: CustomThemeScheme\n setScheme(scheme: CustomThemeScheme): void\n isActive: boolean\n isTrying: boolean\n busy: boolean\n disabled: boolean\n onTryOn(): void\n onExitTryOn(): void\n onApply(): void\n}\n\nexport function CustomThemeCard(props: CustomThemeCardProps): ReactNode {\n const {\n t, customTheme, scheme, setScheme, isActive, isTrying, busy, disabled,\n onTryOn, onExitTryOn, onApply,\n } = props\n const customThemeState = useSyncExternalStore(customTheme.subscribe, customTheme.getState)\n const profile = customTheme.profile(scheme)\n const [expanded, setExpanded] = useState(false)\n const [draftColors, setDraftColors] = useState<Record<ColorKey, string>>({\n accent: profile.accent,\n background: profile.background,\n foreground: profile.foreground,\n })\n\n useEffect(() => {\n setDraftColors({\n accent: profile.accent,\n background: profile.background,\n foreground: profile.foreground,\n })\n }, [scheme, profile.accent, profile.background, profile.foreground])\n\n const setDraft = (key: ColorKey, value: string): void => {\n setDraftColors(current => ({ ...current, [key]: value }))\n }\n const commitColor = (key: ColorKey): void => {\n const value = draftColors[key]\n if (/^#[0-9a-f]{6}$/i.test(value)) customTheme.setProfileValue(scheme, key, value)\n else setDraft(key, profile[key])\n }\n const colorField = (key: ColorKey, label: string): ReactNode => {\n const draft = draftColors[key]\n const pickerValue = /^#[0-9a-f]{6}$/i.test(draft) ? draft : profile[key]\n return (\n <label className={css.customThemeField} key={key}>\n <span className={css.customThemeFieldLabel}>{label}</span>\n <span className={css.customThemeInputRow}>\n <input\n className={css.customThemeColor}\n type=\"color\"\n value={pickerValue}\n aria-label={label}\n disabled={disabled}\n onChange={(event) => {\n const value = event.target.value\n setDraft(key, value)\n customTheme.setProfileValue(scheme, key, value)\n }}\n />\n <input\n className={css.customThemeHex}\n type=\"text\"\n value={draft}\n inputMode=\"text\"\n maxLength={7}\n spellCheck={false}\n aria-label={`${label} hex`}\n disabled={disabled}\n onChange={(event) => { setDraft(key, event.target.value) }}\n onBlur={() => { commitColor(key) }}\n onKeyDown={(event) => {\n if (event.key === 'Enter') event.currentTarget.blur()\n }}\n />\n </span>\n </label>\n )\n }\n\n return (\n <div className={`${css.card} ${css.customThemeCard}`} data-dsh-custom-theme-card=\"\">\n <div className={css.cardHead}>\n <span className={css.swatch} style={{ background: profile.accent }} aria-hidden=\"true\" />\n <span className={css.cardName}>{t('customThemeTitle')}</span>\n {(isActive || isTrying) && (\n <span className={`${css.badge} ${isActive ? css.badgeActive : css.badgeTrying}`}>\n {isActive ? t('active') : t('tryingOn')}\n </span>\n )}\n </div>\n <div className={css.cardTagline}>{t('customThemeTagline')}</div>\n {customThemeState.writeError !== null && (\n <div className={css.error} role=\"alert\">\n {t('customThemeSaveFailed')}\n </div>\n )}\n <div className={css.actions}>\n {isActive && !isTrying ? (\n <button type=\"button\" className={`${css.button} ${css.buttonGhost}`} disabled>{t('tryOn')}</button>\n ) : isTrying ? (\n <button type=\"button\" className={`${css.button} ${css.buttonPrimary}`} disabled={disabled} onClick={onExitTryOn}>\n {t('exitTryOn')}\n </button>\n ) : (\n <button type=\"button\" className={`${css.button} ${css.buttonPrimary}`} disabled={disabled} onClick={onTryOn}>\n {busy ? t('loading') : t('tryOn')}\n </button>\n )}\n <button type=\"button\" className={css.button} disabled={disabled} onClick={onApply}>\n {busy ? t('applying') : t('apply')}\n </button>\n <button\n type=\"button\"\n className={css.button}\n aria-expanded={expanded}\n disabled={disabled}\n onClick={() => { setExpanded(value => !value) }}\n >\n {expanded ? t('customThemeCloseEdit') : t('customThemeEdit')}\n </button>\n </div>\n\n {expanded && (\n <div className={css.customThemeEditor}>\n <div className={css.customThemeScheme} role=\"group\" aria-label={t('customThemeMode')}>\n <span className={css.themeLabel}>{t('customThemeMode')}</span>\n <button\n type=\"button\"\n aria-pressed={scheme === 'light'}\n className={`${css.themeButton} ${scheme === 'light' ? css.themeButtonActive : ''}`}\n disabled={disabled}\n onClick={() => { setScheme('light') }}\n >\n {t('customThemeLight')}\n </button>\n <button\n type=\"button\"\n aria-pressed={scheme === 'dark'}\n className={`${css.themeButton} ${scheme === 'dark' ? css.themeButtonActive : ''}`}\n disabled={disabled}\n onClick={() => { setScheme('dark') }}\n >\n {t('customThemeDark')}\n </button>\n </div>\n\n <div className={css.customThemeFields}>\n {colorField('accent', t('customThemeAccent'))}\n {colorField('background', t('customThemeBackground'))}\n {colorField('foreground', t('customThemeForeground'))}\n </div>\n\n <label className={css.customThemeContrast}>\n <span className={css.backgroundHead}>\n <span className={css.customThemeFieldLabel}>{t('customThemeContrast')}</span>\n <span className={css.backgroundValue} aria-hidden=\"true\">{profile.contrast}</span>\n </span>\n <input\n className={css.backgroundRange}\n type=\"range\"\n min=\"0\"\n max=\"100\"\n step=\"1\"\n value={profile.contrast}\n aria-label={t('customThemeContrast')}\n aria-valuetext={String(profile.contrast)}\n disabled={disabled}\n onChange={(event) => { customTheme.setProfileValue(scheme, 'contrast', Number(event.target.value)) }}\n />\n </label>\n\n <div className={css.customThemeFooter}>\n <span className={css.backgroundHintMuted}>{t('customThemeResetHint')}</span>\n <button type=\"button\" className={css.button} disabled={disabled} onClick={() => { customTheme.reset(scheme) }}>\n {t('customThemeReset')}\n </button>\n </div>\n </div>\n )}\n </div>\n )\n}\n","/**\n * A drag-smooth range slider that decouples the visible value from the\n * external store while the user drags (issue #725).\n *\n * Binding <input type=\"range\"> directly to a useSyncExternalStore value\n * causes two defects during drag:\n * 1. Snapping back: the store subscription re-reads the scope snapshot while\n * the async scope.set() write is still in flight, resetting the thumb\n * to the old value mid-drag.\n * 2. Lag and stale labels: every onChange drives a full set -> publish ->\n * React render cycle, and the displayed number only updates once the\n * external store settles instead of following the thumb.\n *\n * This control keeps the input effectively uncontrolled: the browser moves\n * the thumb on the compositor thread with zero React involvement while\n * dragging, onInput reports the live value (one callback per animation\n * frame) so labels update in real time, and the final value is committed to\n * the external store through the native change event, which fires once per\n * completed pointer interaction (pointer release). Keyboard-only users get\n * an explicit commit path through onBlur and the Enter/Escape keydown\n * handlers, because not every engine fires the native change event for\n * range inputs on blur or Enter (jsdom does not; behavior varies by\n * browser). A pointer cancel aborts without committing, and the external\n * value is re-synced into the DOM only while the user is neither dragging\n * nor keyboard-focusing the input.\n * @module @linxin666/dsh-client-ui-skin-center/slider-control\n */\nimport { useCallback, useEffect, useRef, type ReactNode } from 'react'\n\n/** Props for the drag-smooth slider control. */\nexport interface SliderControlProps {\n /** External value from the store (initial value + sync target). */\n value: number\n min?: number\n max?: number\n step?: number\n /** Committed on drag end / keyboard change; callers persist to the store here. */\n onChange: (value: number) => void\n /** Live value during interaction, throttled to one callback per frame. */\n onChanging?: (value: number) => void\n className?: string\n id?: string\n ariaLabel?: string\n ariaValuetext?: string\n}\n\n/**\n * A range slider that stays smooth during drag (issue #725).\n *\n * @param props - slider props.\n * @returns the range input element.\n */\nexport function SliderControl({\n value: externalValue,\n min = 0,\n max = 100,\n step = 1,\n onChange,\n onChanging,\n className,\n id,\n ariaLabel,\n ariaValuetext,\n}: SliderControlProps): ReactNode {\n const inputRef = useRef<HTMLInputElement | null>(null)\n const draggingRef = useRef(false)\n const rafRef = useRef<number | null>(null)\n const liveRef = useRef(0)\n const lastCommittedRef = useRef<number | null>(null)\n const onChangingRef = useRef(onChanging)\n onChangingRef.current = onChanging\n\n // Commit through the NATIVE change event (React's onChange is synthesized\n // from 'input' for range inputs, which would commit on every move). The\n // native change event fires exactly once per completed pointer interaction.\n const commitRef = useRef(onChange)\n commitRef.current = onChange\n\n /**\n * Persist a value to the external store, de-duplicated against the last\n * committed value so the explicit keyboard/onBlur commit paths never\n * double-fire alongside the native change event (which real browsers also\n * emit on blur or Enter for range inputs).\n */\n const commit = useCallback((value: number): void => {\n if (lastCommittedRef.current === value) return\n lastCommittedRef.current = value\n commitRef.current(value)\n }, [])\n\n const commitCurrent = useCallback((): void => {\n const input = inputRef.current\n if (input === null) return\n draggingRef.current = false\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current)\n rafRef.current = null\n }\n commit(Number(input.value))\n }, [commit])\n\n // Sync the external value into the DOM input, unless the user is dragging\n // or keyboard-focusing the input (the native change event already carries\n // the committed keyboard value; overwriting here would snap the thumb).\n useEffect(() => {\n const input = inputRef.current\n if (input !== null && !draggingRef.current && input !== input.ownerDocument.activeElement) {\n input.value = String(externalValue)\n }\n }, [externalValue])\n\n useEffect(() => {\n const input = inputRef.current\n if (input === null) return\n const listener = (): void => {\n draggingRef.current = false\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current)\n rafRef.current = null\n }\n commit(Number(input.value))\n }\n input.addEventListener('change', listener)\n return (): void => {\n input.removeEventListener('change', listener)\n }\n }, [commit])\n\n // Release the pending frame on unmount.\n useEffect(() => {\n return (): void => {\n if (rafRef.current !== null) cancelAnimationFrame(rafRef.current)\n }\n }, [])\n\n /** Throttled live-value reporter: fires onChanging at most once per frame. */\n const reportLive = useCallback((value: number): void => {\n liveRef.current = value\n if (rafRef.current !== null) return\n rafRef.current = requestAnimationFrame(() => {\n rafRef.current = null\n onChangingRef.current?.(liveRef.current)\n })\n }, [])\n\n const startDrag = useCallback(() => {\n draggingRef.current = true\n }, [])\n\n /** Abort the interaction (pointer cancel): no value is committed. */\n const cancelDrag = useCallback(() => {\n draggingRef.current = false\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current)\n rafRef.current = null\n }\n }, [])\n\n const onInput = useCallback((event: React.FormEvent<HTMLInputElement>) => {\n reportLive(Number(event.currentTarget.value))\n }, [reportLive])\n\n // Commit on blur so keyboard-only users persist the value even when the\n // engine never fires the native change event for range inputs on blur.\n const commitOnBlur = useCallback((): void => {\n if (draggingRef.current) return\n commitCurrent()\n }, [commitCurrent])\n\n // Enter/Escape are the explicit keyboard commit keys for range inputs.\n const onKeyDown = useCallback((event: React.KeyboardEvent<HTMLInputElement>): void => {\n if (event.key !== 'Enter' && event.key !== 'Escape') return\n if (draggingRef.current) return\n commitCurrent()\n }, [commitCurrent])\n\n return (\n <input\n ref={inputRef}\n id={id}\n className={className}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n defaultValue={externalValue}\n aria-label={ariaLabel}\n aria-valuetext={ariaValuetext}\n onPointerDown={startDrag}\n onPointerCancel={cancelDrag}\n onInput={onInput}\n onBlur={commitOnBlur}\n onKeyDown={onKeyDown}\n />\n )\n}","/**\n * The skin-center card: rendered as the content of a first-level settings\n * section, listing the official stock look plus every installed skin in the\n * v2 catalog (package-shipped built-ins + user dirs under $DSH_HOME/skins).\n *\n * v2 architecture (issue #506): skins are pure asset directories loaded by\n * the skin-center runtime. Try-on and apply both go through the same atomic\n * switch engine (src/client/runtime/skin-controller.ts) — try-on simply\n * skips persistence, and apply is one click with NO page reload, no\n * cordis.patch.yml rewrite, no boot-graph regeneration. The \"trying on\"\n * badge tracks the controller's live state, so closing and reopening the\n * settings panel keeps showing the skin that is still being previewed.\n * Copy rides the standard `t` seat; the theme preview control drives the\n * official theme service (persisted, same as the Appearance row).\n */\nimport { useEffect, useRef, useState, useSyncExternalStore, type ReactNode } from 'react'\nimport type { DelegatedThemeState } from './runtime/delegated-theme.ts'\nimport type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { ThemeSnapshot } from '@deepseek-ai/dsh-client-ui-theme/client'\nimport type { SkinActivationOptions } from './runtime/skin-controller.ts'\nimport type { CatalogSkin, SkinRuntimeStore } from './runtime/boot.ts'\nimport { isDelegatedCatalogSkin } from './runtime/boot.ts'\nimport type { SkinBackgroundHandle } from './background.ts'\nimport type { ExternalWallpaperHandle } from './external-wallpaper-handle.ts'\nimport type { PreviewCoordinator } from './preview-coordinator.ts'\nimport type { CustomThemeController } from './custom-theme-controller.ts'\nimport { ExternalWallpaperNotice } from './ExternalWallpaperNotice.tsx'\nimport { DelegatedSkinCard } from './DelegatedSkinCard.tsx'\nimport { createDelegatedSkinHandle, type DelegatedSkinHandle } from './delegated-skin-handle.ts'\nimport { CustomThemeCard } from './CustomThemePanel.tsx'\nimport { SliderControl } from './SliderControl.tsx'\nimport css from './skin-center.module.css'\n\n/** Business face the skin-center apply() injects into the card. */\nexport interface SkinCenterInjected {\n /** The v2 skin runtime store (controller + catalog). */\n runtime: SkinRuntimeStore\n theme: {\n getTheme(): ThemeSnapshot\n subscribe(listener: () => void): () => void\n setTheme(id: 'light' | 'dark'): void\n }\n /** Background occluder over the shared skin-background namespace. */\n background: SkinBackgroundHandle\n /** The delegated Wallpaper Engine plugin this card points at (issue #39). */\n externalWallpaper: ExternalWallpaperHandle\n /** Skins whose visual is another plugin's (see core/delegated-skins.ts). */\n delegated: DelegatedSkinHandle\n /** One serialized preview session shared by skins, wallpapers and themes. */\n preview: PreviewCoordinator\n /** User palette derived from the official stock theme. */\n customTheme: CustomThemeController\n}\n\n/** Plugin-card component props: locale seat + injected face. */\nexport type SkinCenterComponentProps =\n PropsLocale<'skinCenter'> & SkinCenterInjected\n\n/** The apply target of the official stock-look card. */\nconst OFFICIAL = 'official'\n\n/** Stand-in for a host that injects no delegated-skin face: nothing is live. */\nconst INERT_DELEGATED = createDelegatedSkinHandle(\n () => ({ live: false, canYield: false }),\n () => () => {},\n)\n\n/**\n * Live-label helper: the shown value follows the in-drag thumb immediately,\n * and falls back to the store value once the store settles (issue #725).\n */\nfunction useLiveValue(value: number): [number, (v: number | null) => void] {\n const [live, setLive] = useState<number | null>(null)\n useEffect(() => {\n setLive(null)\n }, [value])\n return [live ?? value, setLive]\n}\n\n/**\n * Render the skin-center card: a static header naming the plugin, with the\n * always-visible skin list (official default + every installed skin; try-on /\n * theme preview / one-click apply) rendered below it.\n * @param props - card props.\n * @returns the plugin card.\n */\nexport function SkinCenter({ t, runtime, theme, background, externalWallpaper, delegated, preview, customTheme }: SkinCenterComponentProps) {\n const snapshot = useSyncExternalStore((listener) => theme.subscribe(listener), () => theme.getTheme())\n const enabled = useSyncExternalStore(background.subscribe, background.enabled)\n const opacity = useSyncExternalStore(background.subscribe, background.opacity)\n const blurEmpty = useSyncExternalStore(background.subscribe, background.blurEmpty)\n const blurContent = useSyncExternalStore(background.subscribe, background.blurContent)\n const inputCardBlur = useSyncExternalStore(background.subscribe, background.inputCardBlur)\n const bubbleOpacity = useSyncExternalStore(background.subscribe, background.bubbleOpacity)\n const bubbleBlur = useSyncExternalStore(background.subscribe, background.bubbleBlur)\n const [shownOpacity, setShownOpacity] = useLiveValue(opacity)\n const [shownBlurEmpty, setShownBlurEmpty] = useLiveValue(blurEmpty)\n const [shownBlurContent, setShownBlurContent] = useLiveValue(blurContent)\n const [shownInputCardBlur, setShownInputCardBlur] = useLiveValue(inputCardBlur)\n const [shownBubbleOpacity, setShownBubbleOpacity] = useLiveValue(bubbleOpacity)\n const [shownBubbleBlur, setShownBubbleBlur] = useLiveValue(bubbleBlur)\n const catalog = useSyncExternalStore(runtime.subscribe, runtime.catalog)\n // Delegated rows render as bars above the grid; the grid holds only the\n // asset skins this package loads, each with a preview image to show.\n const delegatedEntries = (catalog ?? []).filter(isDelegatedCatalogSkin)\n const isAssetSkin = (entry: CatalogSkin): boolean => !isDelegatedCatalogSkin(entry)\n const state = useSyncExternalStore(runtime.subscribe, runtime.controller.getState)\n const customThemeState = useSyncExternalStore(customTheme.subscribe, customTheme.getState)\n const activeId = state.active\n const previewing = state.previewing\n const tryingId = state.trying\n const activeEntry = activeId === null ? null : runtime.find(activeId)\n const backdropActive = activeEntry?.manifest.contributes?.backgroundMedia !== undefined\n // A delegated row re-renders on the plugin's own markers, not on the catalog.\n // The handle is a pure read, so a host that renders the card without it\n // gets every delegated row reported as not running rather than a blank card.\n const delegatedSkins = delegated ?? INERT_DELEGATED\n const [delegatedStates, setDelegatedStates] = useState<Record<string, DelegatedThemeState>>({})\n useEffect(() => {\n const read = (): void => {\n const next: Record<string, DelegatedThemeState> = {}\n for (const id of delegatedSkins.ids()) next[id] = delegatedSkins.state(id)\n setDelegatedStates(next)\n }\n read()\n return delegatedSkins.subscribe(read)\n }, [delegatedSkins])\n /**\n * Whether an asset skin this card selected is standing on the delegated\n * plugin.\n *\n * The plugin's markers vanish while it yields, which from out here looks\n * exactly like a plugin that never loaded. The card knows the difference:\n * with the delegated row itself selected, absent markers mean the plugin\n * owns the page; with a real skin selected, absent markers mean the plugin\n * stood down for that skin, which is the handoff working. Stock look\n * (activeId null) is neither, and says so.\n */\n const delegatedSelected = activeEntry !== null && isDelegatedCatalogSkin(activeEntry)\n const assetSkinPainted = activeId !== null && !delegatedSelected\n const paintsOverDelegated = (entry: CatalogSkin, state: DelegatedThemeState | undefined): boolean =>\n assetSkinPainted && activeId !== entry.manifest.id && state?.live !== true\n const [busyId, setBusyId] = useState<string | null>(null)\n const [error, setError] = useState<string | null>(null)\n const [verifying, setVerifying] = useState(false)\n const [verifySummary, setVerifySummary] = useState<{\n total: number\n valid: number\n issues: number\n repaired?: string[]\n repairFailed?: Array<{ id: string; error: string }>\n } | null>(null)\n const [verifyReports, setVerifyReports] = useState<Record<string, { status: string; hooksTrusted: boolean; mismatches: string[]; missing: string[] }>>({})\n const [confirmUninstallId, setConfirmUninstallId] = useState<string | null>(null)\n const [uninstallingId, setUninstallingId] = useState<string | null>(null)\n // Bulk maintenance (update all / uninstall all). The two buttons drive the\n // existing per-skin repair and uninstall routes one id at a time rather than\n // adding a second mutating endpoint: the report route is the only new\n // surface, and every write still goes through the individually tested path.\n const [bulk, setBulk] = useState<{ phase: 'idle' | 'checking' | 'updating' | 'uninstalling'; done: number; total: number; failed: number; note: string } | null>(null)\n const [uninstallAllArmed, setUninstallAllArmed] = useState(false)\n // Unmount guard: once the card is gone, pending async completions must not\n // setState (the controller itself owns the skin state and lives on).\n const mounted = useRef(false)\n // Latest-click-wins token; a newer click invalidates older completions.\n const requestSeq = useRef(0)\n useEffect(() => {\n mounted.current = true\n return () => { mounted.current = false }\n }, [])\n\n const run = (target: string, action: () => Promise<string | null>): void => {\n const seq = ++requestSeq.current\n setError(null)\n setBusyId(target)\n void action()\n .catch(() => {\n if (!mounted.current || seq !== requestSeq.current) return\n setError(t('applyFailed'))\n })\n .finally(() => {\n if (!mounted.current || seq !== requestSeq.current) return\n setBusyId(null)\n })\n }\n\n // Try-on and apply are the two activations the user just asked for, so\n // they CLAIM THE STAGE: while the delegated wallpaper plugin renders, one of\n // them still paints once, which flips the public `html[data-dsh-skin]` stamp\n // that plugin keys its hand-back on (issue #49). Every other path - the boot\n // activation, the persisted-selection follower, refresh() - honors the\n // stand-down unchanged.\n const tryOn = (entry: CatalogSkin): void => {\n run(entry.manifest.id, () => preview.runSkin(() => runtime.controller.tryOn(entry.manifest.id, entry, { userInitiated: true })))\n }\n\n const tryOnOfficial = (): void => {\n run(OFFICIAL, () => preview.runSkin(() => runtime.controller.tryOn(null, null)))\n }\n\n const exitTryOn = (): void => {\n run(tryingId ?? OFFICIAL, () => preview.runSkin(() => runtime.controller.exitTryOn()))\n }\n\n const restoreCommittedSkin = async (state: { active: string | null }): Promise<void> => {\n const entry = state.active === null ? null : runtime.find(state.active)\n if (state.active !== null && entry === null) {\n throw new Error(`cannot restore skin ${state.active}`)\n }\n const restored = await runtime.controller.switchTo(state.active, entry)\n if (restored !== state.active) {\n throw new Error(`skin ${state.active ?? 'stock'} did not restore`)\n }\n }\n\n const switchAndDeactivateCustomTheme = async (\n target: string | null,\n entry: CatalogSkin | null,\n options?: SkinActivationOptions,\n ): Promise<string | null> => {\n const previous = { ...runtime.controller.getState() }\n const active = await runtime.controller.switchTo(target, entry, options)\n if (active !== target) {\n throw new Error(`${target === null ? 'stock theme' : `skin ${target}`} did not activate`)\n }\n try {\n await customTheme.deactivate()\n return active\n } catch (error) {\n try {\n await restoreCommittedSkin(previous)\n } catch (rollbackError) {\n throw new AggregateError([error, rollbackError], 'skin switch cleanup and rollback failed')\n }\n throw error\n }\n }\n\n const restoreOfficialLook = async (): Promise<string | null> => {\n // The delegated wallpaper plugin owns its own selection, so restoring the\n // stock skin never touches it (issue #39): the skin center only manages\n // skins, the wallpaper keeps rendering behind them.\n return await switchAndDeactivateCustomTheme(null, null)\n }\n\n /**\n * One-click apply: atomic client-side switch + persisted selection. No\n * reload, no boot-graph wait — the tapIndex adapter makes the next page\n * load boot straight into this skin.\n * @param target - skin id, or `official` for the stock look.\n */\n const applySkin = (target: string): void => {\n if (target === OFFICIAL) {\n run(OFFICIAL, () => preview.runSkin(restoreOfficialLook))\n return\n }\n const entry = runtime.find(target)\n if (entry === null) {\n setError(t('applyFailed'))\n return\n }\n run(target, () => preview.runSkin(() => switchAndDeactivateCustomTheme(target, entry, { userInitiated: true })))\n }\n\n const tryOnCustomTheme = (): void => {\n run('custom-theme', () => preview.runCustomTheme(async () => {\n const active = await runtime.controller.tryOn(null, null)\n if (active !== null) throw new Error('stock preview did not activate')\n customTheme.tryOn()\n return active\n }))\n }\n\n const exitCustomThemeTryOn = (): void => {\n run('custom-theme', () => preview.runCustomTheme(async () => {\n customTheme.exitTryOn()\n return await runtime.controller.exitTryOn()\n }))\n }\n\n const applyCustomTheme = (): void => {\n run('custom-theme', () => preview.runCustomTheme(async () => {\n await customTheme.apply()\n const active = await runtime.controller.switchTo(null, null)\n if (active !== null) {\n await customTheme.deactivate()\n throw new Error('stock theme did not activate')\n }\n return active\n }))\n }\n\n const handleVerify = async (): Promise<void> => {\n setVerifying(true)\n setError(null)\n try {\n const res = await fetch('/api/skin-center/v2/verify', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ autoRepair: true }),\n })\n const json = (await res.json().catch(() => null)) as {\n ok?: boolean\n total?: number\n valid?: number\n issues?: number\n repaired?: string[]\n repairFailed?: Array<{ id: string; error: string }>\n details?: Array<{ id: string; status: string; hooksTrusted: boolean; mismatches: string[]; missing: string[] }>\n } | null\n if (!res.ok || json?.ok !== true) {\n throw new Error('verify failed')\n }\n if (!mounted.current) return\n setVerifySummary({\n total: json.total ?? 0,\n valid: json.valid ?? 0,\n issues: json.issues ?? 0,\n repaired: json.repaired ?? [],\n repairFailed: json.repairFailed ?? [],\n })\n const map: Record<string, { status: string; hooksTrusted: boolean; mismatches: string[]; missing: string[] }> = {}\n for (const item of json.details ?? []) {\n map[item.id] = item\n }\n setVerifyReports(map)\n if (json.repaired && json.repaired.length > 0) {\n await runtime.refreshCatalog()\n if (activeId && json.repaired.includes(activeId)) {\n const freshEntry = runtime.find(activeId)\n if (freshEntry) {\n await preview.runSkin(() => switchAndDeactivateCustomTheme(activeId, freshEntry))\n }\n }\n }\n } catch {\n if (mounted.current) setError(t('applyFailed'))\n } finally {\n if (mounted.current) setVerifying(false)\n }\n }\n\n /** Repair every installed skin the market publishes a newer release of. */\n const handleUpdateAll = async (): Promise<void> => {\n setError(null)\n setBulk({ phase: 'checking', done: 0, total: 0, failed: 0, note: '' })\n let targets: string[]\n try {\n const res = await fetch('/api/skin-center/v2/skins/versions', { cache: 'no-store' })\n const json = (await res.json().catch(() => null)) as {\n ok?: boolean\n rows?: Array<{ id: string; outdated: boolean }>\n } | null\n if (!res.ok || json?.ok !== true || !Array.isArray(json.rows)) {\n throw new Error('versions-unavailable')\n }\n targets = json.rows.filter((row) => row.outdated).map((row) => row.id)\n } catch {\n if (mounted.current) {\n setBulk(null)\n setError(t('marketUnreachable'))\n }\n return\n }\n if (!mounted.current) return\n if (targets.length === 0) {\n setBulk({ phase: 'idle', done: 0, total: 0, failed: 0, note: t('updateAllNone') })\n return\n }\n let done = 0\n let failed = 0\n for (const id of targets) {\n setBulk({ phase: 'updating', done, total: targets.length, failed, note: '' })\n try {\n const res = await fetch(`/api/skin-center/v2/skins/${encodeURIComponent(id)}/repair`, { method: 'POST' })\n if (!res.ok) failed++\n } catch {\n failed++\n }\n done++\n }\n await runtime.refreshCatalog()\n if (!mounted.current) return\n if (activeId !== null) {\n const freshEntry = runtime.find(activeId)\n if (freshEntry) {\n await preview.runSkin(() => switchAndDeactivateCustomTheme(activeId, freshEntry))\n }\n }\n setBulk({\n phase: 'idle',\n done,\n total: targets.length,\n failed,\n note: failed === 0 ? t('updateAllDone', { count: done }) : t('updateAllFailed', { count: failed }),\n })\n }\n\n /**\n * Uninstall every market-installed skin, including the active one. Builtins\n * are never touched: they ship inside the package and are replaced by\n * upgrading it. The first tap only arms the button, matching the per-skin\n * uninstall affordance, because this cannot be undone.\n */\n const handleUninstallAll = async (): Promise<void> => {\n const targets = (catalog ?? []).filter((skin) => skin.origin === 'user')\n if (!uninstallAllArmed) {\n if (targets.length === 0) {\n setBulk({ phase: 'idle', done: 0, total: 0, failed: 0, note: t('bulkNoUserSkins') })\n return\n }\n setUninstallAllArmed(true)\n return\n }\n setUninstallAllArmed(false)\n setError(null)\n const wasActive = activeId\n const wasTrying = tryingId\n if (wasTrying !== null && targets.some((skin) => skin.manifest.id === wasTrying)) {\n await preview.runSkin(() => runtime.controller.exitTryOn())\n }\n let done = 0\n let failed = 0\n for (const skin of targets) {\n setBulk({ phase: 'uninstalling', done, total: targets.length, failed, note: '' })\n try {\n const res = await fetch(`/api/skin-center/v2/skins/${encodeURIComponent(skin.manifest.id)}/uninstall`, { method: 'POST' })\n if (!res.ok) failed++\n } catch {\n failed++\n }\n done++\n }\n await runtime.refreshCatalog()\n if (wasActive !== null && targets.some((skin) => skin.manifest.id === wasActive)) {\n await preview.runSkin(restoreOfficialLook)\n }\n if (!mounted.current) return\n setBulk({\n phase: 'idle',\n done,\n total: targets.length,\n failed,\n note: failed === 0 ? t('uninstallAllDone', { count: done }) : t('uninstallAllFailed', { count: failed }),\n })\n }\n\n const handleUninstall = async (entry: CatalogSkin): Promise<void> => {\n const id = entry.manifest.id\n setUninstallingId(id)\n setError(null)\n try {\n if (tryingId === id) {\n await preview.runSkin(() => runtime.controller.exitTryOn())\n }\n if (activeId === id) {\n await preview.runSkin(restoreOfficialLook)\n }\n const res = await fetch(`/api/skin-center/v2/skins/${encodeURIComponent(id)}/uninstall`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n })\n const json = (await res.json().catch(() => null)) as { ok?: boolean } | null\n if (!res.ok || json?.ok !== true) {\n throw new Error('uninstall failed')\n }\n await runtime.refreshCatalog()\n if (mounted.current) setConfirmUninstallId(null)\n } catch {\n if (mounted.current) setError(t('uninstallFailed'))\n } finally {\n if (mounted.current) setUninstallingId(null)\n }\n }\n\n const dark = document.body.hasAttribute('data-ds-dark-theme')\n // Asset root for the preview thumbnails (the store exposes it; tests that\n // stub the store without it fall back to the default mount point).\n const apiBase = runtime.apiBase ?? '/api/skin-center/v2'\n\n /** One row: try-on control + apply button + optional uninstall. Shared by the official card and every skin card. */\n const actionButtons = (opts: {\n key: string\n entry?: CatalogSkin\n isActive: boolean\n isTrying: boolean\n onTryOn: () => void\n applyLabel: string\n }): ReactNode => {\n const isUser = opts.entry?.origin === 'user'\n const isConfirming = isUser && confirmUninstallId === opts.key\n return (\n <div className={css.actions}>\n {opts.isActive && !opts.isTrying ? (\n <button type=\"button\" className={`${css.button} ${css.buttonGhost}`} disabled>\n {t('tryOn')}\n </button>\n ) : opts.isTrying ? (\n <button type=\"button\" className={`${css.button} ${css.buttonPrimary}`} disabled={busyId !== null || uninstallingId !== null} onClick={exitTryOn}>\n {t('exitTryOn')}\n </button>\n ) : (\n <button\n type=\"button\"\n className={`${css.button} ${css.buttonPrimary}`}\n disabled={busyId !== null || uninstallingId !== null}\n onClick={opts.onTryOn}\n >\n {busyId === opts.key ? t('loading') : t('tryOn')}\n </button>\n )}\n <button\n type=\"button\"\n className={css.button}\n disabled={busyId !== null || uninstallingId !== null}\n onClick={() => { applySkin(opts.key) }}\n >\n {busyId === opts.key ? t('applying') : opts.applyLabel}\n </button>\n {isUser && (\n isConfirming ? (\n <>\n <button\n type=\"button\"\n className={`${css.button} ${css.buttonDangerConfirm}`}\n disabled={busyId !== null || uninstallingId !== null}\n onClick={() => { if (opts.entry) void handleUninstall(opts.entry) }}\n >\n {uninstallingId === opts.key ? t('uninstalling') : t('confirm')}\n </button>\n <button\n type=\"button\"\n className={css.button}\n disabled={uninstallingId !== null}\n onClick={() => { setConfirmUninstallId(null) }}\n >\n {t('cancel')}\n </button>\n </>\n ) : (\n <button\n type=\"button\"\n className={`${css.button} ${css.buttonDanger}`}\n disabled={busyId !== null || uninstallingId !== null}\n onClick={() => { setConfirmUninstallId(opts.key) }}\n >\n {t('uninstall')}\n </button>\n )\n )}\n </div>\n )\n }\n\n return (\n <li className={css.pluginCard}>\n <div className={css.cardHeaderStatic}>\n <span className={css.headText}>\n <span className={css.pluginName}>\n {t('title')}\n <span className={css.titleBadge}>{String(catalog?.length ?? 0)}</span>\n </span>\n <span className={css.cardDescription} title={t('cardDescription')}>{t('cardDescription')}</span>\n </span>\n </div>\n\n <div className={css.cardBody}>\n <ExternalWallpaperNotice t={t} />\n {state.stoodDown && (\n <div className={css.externalWallpaperNotice} role=\"status\">\n <div className={css.externalWallpaperTitle}>{t('stoodDownTitle')}</div>\n <p className={css.externalWallpaperBody}>{t('stoodDownBody')}</p>\n </div>\n )}\n <div className={css.enableRow}>\n <span className={css.enableLabel} title={t('enabled')}>{t('enabled')}</span>\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={enabled}\n aria-label={t('enabled')}\n className={enabled ? css.switch + ' ' + css.switchOn : css.switch}\n onClick={() => { background.setEnabled(!enabled) }}\n >\n <span className={css.switchThumb} />\n </button>\n <p className={css.enableHint}>{t('enabledHint')}</p>\n </div>\n {enabled\n ? (\n <>\n <div className={css.head}>\n <div className={css.intro} title={t('intro')}>{t('intro')}</div>\n <div className={css.toolbar}>\n <div className={css.themeRow}>\n <span className={css.themeLabel}>{t('theme')}</span>\n <button\n type=\"button\"\n className={`${css.themeButton} ${dark ? '' : css.themeButtonActive}`}\n onClick={() => { theme.setTheme('light') }}\n >\n {t('themeLight')}\n </button>\n <button\n type=\"button\"\n className={`${css.themeButton} ${dark ? css.themeButtonActive : ''}`}\n onClick={() => { theme.setTheme('dark') }}\n >\n {t('themeDark')}\n </button>\n </div>\n <div className={css.actionRow}>\n <button\n type=\"button\"\n className={css.themeButton}\n disabled={verifying || busyId !== null || uninstallingId !== null}\n onClick={() => { void handleVerify() }}\n >\n {verifying ? t('verifyingIntegrity') : t('verifyIntegrity')}\n </button>\n <button\n type=\"button\"\n className={css.themeButton}\n disabled={bulk !== null && bulk.phase !== 'idle' || verifying || busyId !== null || uninstallingId !== null}\n onClick={() => { void handleUpdateAll() }}\n >\n {bulk?.phase === 'checking'\n ? t('updateAllChecking')\n : bulk?.phase === 'updating'\n ? t('updateAllRunning', { done: bulk.done, total: bulk.total })\n : t('updateAll')}\n </button>\n <button\n type=\"button\"\n className={`${css.themeButton} ${uninstallAllArmed ? css.buttonDangerConfirm : css.buttonDanger}`}\n disabled={bulk !== null && bulk.phase !== 'idle' || verifying || busyId !== null || uninstallingId !== null}\n onClick={() => { void handleUninstallAll() }}\n >\n {bulk?.phase === 'uninstalling'\n ? t('uninstallAllRunning', { done: bulk.done, total: bulk.total })\n : uninstallAllArmed\n ? t('confirm')\n : t('uninstallAll')}\n </button>\n </div>\n </div>\n {bulk !== null && bulk.note !== '' && (\n <div className={bulk.failed > 0 ? css.verifySummaryWarning : css.verifySummarySuccess}>\n {bulk.note}\n </div>\n )}\n {verifySummary !== null && (\n <div className={`${css.verifySummary} ${verifySummary.issues === 0 ? css.verifySummarySuccess : css.verifySummaryWarning}`}>\n {verifySummary.repaired && verifySummary.repaired.length > 0 && verifySummary.issues === 0\n ? t('verifyRepaired', { count: verifySummary.repaired.length })\n : verifySummary.issues === 0\n ? t('verifyAllPassed', { count: verifySummary.total })\n : verifySummary.repaired && verifySummary.repaired.length > 0\n ? `${t('verifyRepaired', { count: verifySummary.repaired.length })}, ${t('verifyFoundIssues', { count: verifySummary.issues })}`\n : t('verifyFoundIssues', { count: verifySummary.issues })}\n </div>\n )}\n </div>\n\n <div className={css.backgroundRow}>\n <div className={css.backgroundHead}>\n <span className={css.backgroundLabel}>{t('backgroundOpacity')}</span>\n <span className={css.backgroundValue} aria-hidden=\"true\">{shownOpacity}%</span>\n </div>\n <SliderControl\n id=\"skin-center-background-opacity\"\n className={css.backgroundRange}\n min={0}\n max={100}\n step={5}\n value={opacity}\n ariaValuetext={shownOpacity + '%'}\n ariaLabel={t('backgroundOpacity')}\n onChanging={setShownOpacity}\n onChange={(value) => { background.set(value) }}\n />\n <p className={backdropActive ? css.backgroundHint : css.backgroundHintMuted}>\n {backdropActive ? t('backgroundHint') : t('backgroundHintInert')}\n </p>\n </div>\n <div className={css.backgroundRow}>\n <div className={css.backgroundHead}>\n <span className={css.backgroundLabel}>{t('backgroundBlurEmpty')}</span>\n <span className={css.backgroundValue} aria-hidden=\"true\">{shownBlurEmpty}px</span>\n </div>\n <SliderControl\n id=\"skin-center-background-blur-empty\"\n className={css.backgroundRange}\n min={0}\n max={20}\n step={1}\n value={blurEmpty}\n ariaValuetext={shownBlurEmpty + 'px'}\n ariaLabel={t('backgroundBlurEmpty')}\n onChanging={setShownBlurEmpty}\n onChange={(value) => { background.setBlurEmpty(value) }}\n />\n <div className={css.backgroundHead}>\n <span className={css.backgroundLabel}>{t('backgroundBlurContent')}</span>\n <span className={css.backgroundValue} aria-hidden=\"true\">{shownBlurContent}px</span>\n </div>\n <SliderControl\n id=\"skin-center-background-blur-content\"\n className={css.backgroundRange}\n min={0}\n max={20}\n step={1}\n value={blurContent}\n ariaValuetext={shownBlurContent + 'px'}\n ariaLabel={t('backgroundBlurContent')}\n onChanging={setShownBlurContent}\n onChange={(value) => { background.setBlurContent(value) }}\n />\n <p className={backdropActive ? css.backgroundHint : css.backgroundHintMuted}>\n {backdropActive ? t('backgroundBlurHint') : t('backgroundBlurInert')}\n </p>\n </div>\n\n\n <div className={css.backgroundRow}>\n <div className={css.backgroundHead}>\n <span className={css.backgroundLabel}>{t('inputCardBlur')}</span>\n <span className={css.backgroundValue} aria-hidden=\"true\">{shownInputCardBlur}px</span>\n </div>\n <SliderControl\n id=\"skin-center-input-card-blur\"\n className={css.backgroundRange}\n min={0}\n max={20}\n step={1}\n value={inputCardBlur}\n ariaValuetext={shownInputCardBlur + 'px'}\n ariaLabel={t('inputCardBlur')}\n onChanging={setShownInputCardBlur}\n onChange={(value) => { background.setInputCardBlur(value) }}\n />\n <p className={css.backgroundHint}>{t('inputCardBlurHint')}</p>\n </div>\n\n <div className={css.backgroundRow}>\n <div className={css.backgroundHead}>\n <span className={css.backgroundLabel}>{t('bubbleOpacity')}</span>\n <span className={css.backgroundValue} aria-hidden=\"true\">{shownBubbleOpacity}%</span>\n </div>\n <SliderControl\n id=\"skin-center-bubble-opacity\"\n className={css.backgroundRange}\n min={0}\n max={100}\n step={5}\n value={bubbleOpacity}\n ariaValuetext={shownBubbleOpacity + '%'}\n ariaLabel={t('bubbleOpacity')}\n onChanging={setShownBubbleOpacity}\n onChange={(value) => { background.setBubbleOpacity(value) }}\n />\n <p className={css.backgroundHint}>{t('bubbleOpacityHint')}</p>\n </div>\n\n <div className={css.backgroundRow}>\n <div className={css.backgroundHead}>\n <span className={css.backgroundLabel}>{t('bubbleBlur')}</span>\n <span className={css.backgroundValue} aria-hidden=\"true\">{shownBubbleBlur}px</span>\n </div>\n <SliderControl\n id=\"skin-center-bubble-blur\"\n className={css.backgroundRange}\n min={0}\n max={20}\n step={1}\n value={bubbleBlur}\n ariaValuetext={shownBubbleBlur + 'px'}\n ariaLabel={t('bubbleBlur')}\n onChanging={setShownBubbleBlur}\n onChange={(value) => { background.setBubbleBlur(value) }}\n />\n <p className={css.backgroundHint}>{t('bubbleBlurHint')}</p>\n </div>\n\n\n {error !== null && <div className={css.error}>{error}</div>}\n\n <div className={css.list}>\n {delegatedEntries.map(entry => {\n const id = entry.manifest.id\n // A delegated skin is selected through the same switch\n // engine as any other, and paints through its own\n // plugin; the row renders that plugin's state instead of\n // a preview image and an uninstall this card has no\n // route for. It sits ABOVE the grid, beside the\n // custom-theme row below it: the two looks this package\n // does not paint are the two it lists as bars, and the\n // grid is for the asset directories it does load.\n return (\n <DelegatedSkinCard\n key={id}\n t={t}\n skin={entry}\n theme={delegatedStates[id] ?? { live: false, canYield: false }}\n isActive={id === activeId && !previewing}\n isTrying={previewing && id === tryingId}\n yieldedToSkin={paintsOverDelegated(entry, delegatedStates[id])}\n busy={busyId === id}\n disabled={busyId !== null || uninstallingId !== null}\n onTryOn={() => { tryOn(entry) }}\n onExitTryOn={exitTryOn}\n onApply={() => { applySkin(id) }}\n onInstalled={() => { void runtime.refreshCatalog() }}\n />\n )\n })}\n <div className={css.skinGrid}>\n {(() => {\n const isActive = activeId === null && !previewing && !customThemeState.applied\n const isTrying = previewing && tryingId === null && !customThemeState.previewing\n const badge = isActive ? t('active') : isTrying ? t('tryingOn') : null\n return (\n <div className={`${css.card} ${css.skinCard}`} key={OFFICIAL}>\n <div className={css.thumbWrap}>\n <div className={css.thumbEmpty} aria-hidden=\"true\" />\n {badge !== null && (\n <span className={`${css.badge} ${isActive ? css.badgeActive : css.badgeTrying}`}>\n {badge}\n </span>\n )}\n </div>\n <div className={css.cardHead}>\n <span className={css.swatch} style={{ background: '#98a1ab' }} aria-hidden=\"true\" />\n <span className={css.cardName} title={t('official')}>{t('official')}</span>\n </div>\n <div className={css.cardTagline} title={t('officialTagline')}>{t('officialTagline')}</div>\n {actionButtons({\n key: OFFICIAL,\n isActive,\n isTrying,\n onTryOn: tryOnOfficial,\n applyLabel: t('restore'),\n })}\n </div>\n )\n })()}\n\n {(catalog ?? []).filter(isAssetSkin).map(entry => {\n const id = entry.manifest.id\n const isActive = id === activeId && !previewing\n const isTrying = previewing && id === tryingId\n const badge = isActive ? t('active') : isTrying ? t('tryingOn') : null\n const report = verifyReports[id]\n // The thumbnail follows the live light/dark scheme, falling\n // back to the other variant when a skin ships only one.\n const previewPath = dark\n ? (entry.manifest.preview?.dark ?? entry.manifest.preview?.light)\n : (entry.manifest.preview?.light ?? entry.manifest.preview?.dark)\n const previewSrc = previewPath === undefined\n ? null\n : `${apiBase}/skins/${encodeURIComponent(id)}/${previewPath}`\n return (\n <div className={`${css.card} ${css.skinCard}`} key={id}>\n <div className={css.thumbWrap}>\n {previewSrc !== null\n ? <img className={css.thumb} src={previewSrc} alt={entry.manifest.nameEn} loading=\"lazy\" />\n : (\n <div\n className={css.thumbEmpty}\n style={{ background: entry.manifest.accent ?? undefined }}\n aria-hidden=\"true\"\n />\n )}\n {report && (\n <span\n className={`${css.badge} ${css.thumbReport} ${\n report.status === 'valid'\n ? css.badgeSuccess\n : report.status === 'tampered'\n ? css.badgeWarning\n : css.badgeDanger\n }`}\n title={\n report.status === 'valid'\n ? t('integrityValid')\n : [...report.mismatches, ...report.missing].join(', ') || report.status\n }\n >\n {report.status === 'valid'\n ? t('integrityValid')\n : report.status === 'tampered'\n ? t('integrityTampered')\n : report.status === 'missing-files'\n ? t('integrityMissing')\n : t('integrityHooksRefused')}\n </span>\n )}\n {badge !== null && (\n <span className={`${css.badge} ${isActive ? css.badgeActive : css.badgeTrying}`}>\n {badge}\n </span>\n )}\n </div>\n <div className={css.cardHead}>\n <span\n className={css.swatch}\n style={{ background: entry.manifest.accent ?? '#98a1ab' }}\n aria-hidden=\"true\"\n />\n <span className={css.cardName} title={entry.manifest.nameEn}>{entry.manifest.nameEn}</span>\n </div>\n <div className={css.cardTagline} title={entry.manifest.tagline ?? ''}>\n {entry.manifest.tagline ?? ''}\n </div>\n {report && report.status !== 'valid' && (\n <div className={css.integrityNote}>\n {[\n report.mismatches.length > 0 ? `${t('integrityTampered')}: ${report.mismatches.join(', ')}` : null,\n report.missing.length > 0 ? `${t('integrityMissing')}: ${report.missing.join(', ')}` : null,\n ].filter(Boolean).join(' | ')}\n </div>\n )}\n {actionButtons({\n key: id,\n entry,\n isActive,\n isTrying,\n onTryOn: () => { tryOn(entry) },\n applyLabel: t('apply'),\n })}\n </div>\n )\n })}\n </div>\n\n <CustomThemeCard\n t={t}\n customTheme={customTheme}\n scheme={dark ? 'dark' : 'light'}\n setScheme={scheme => { theme.setTheme(scheme) }}\n isActive={customThemeState.applied && activeId === null && !previewing}\n isTrying={customThemeState.previewing}\n busy={busyId === 'custom-theme'}\n disabled={busyId !== null}\n onTryOn={tryOnCustomTheme}\n onExitTryOn={exitCustomThemeTryOn}\n onApply={applyCustomTheme}\n />\n </div>\n </>\n )\n : (\n <p className={css.offNote} role=\"status\">{t('offNote')}</p>\n )}\n </div>\n </li>\n )\n}\n\n/** Props the settings section binds for the skin-center card page. */\nexport type SkinCenterSectionProps =\n PropsRuntime<'settings.section'>\n & PropsLocale<'skinCenter'>\n & SkinCenterInjected\n\n/** Render the skin-center card as a first-level settings page. */\nexport function SkinCenterSection(props: SkinCenterSectionProps): ReactNode {\n const { t, runtime, theme, background, externalWallpaper, delegated, preview, customTheme } = props\n return (\n <ul className={css.sectionList}>\n <SkinCenter\n t={t}\n runtime={runtime}\n theme={theme}\n background={background}\n externalWallpaper={externalWallpaper}\n delegated={delegated}\n preview={preview}\n customTheme={customTheme}\n />\n </ul>\n )\n}\n","/**\n * Shared skin-background preference contract (issue #996): the six values the\n * skin-center card edits — master switch, backdrop occlusion, per-state\n * backdrop blur, composer-card blur, and bubble opacity.\n *\n * These used to live only in the `skin-background` settings namespace, which\n * the remote pairing channel fences as loopback-only, so a paired remote\n * desktop always read defaults and silently dropped writes. They now persist\n * in the skin center's own v2 state (POST /api/skin-center/v2/active), which\n * rides the same allow-listed channel as skin switching. This module is the\n * dependency-free source of truth both halves (host routes / migration and\n * the browser controller) share.\n * @module @linxin666/dsh-client-ui-skin-center/core/background\n */\n\n/** Skin-background preference set persisted in the v2 active state file. */\nexport interface SkinBackgroundConfig {\n /** Master switch for the skin center. */\n enabled?: boolean\n /** Background occlusion 0-100 (0 = no extra veil, 100 = fully obscured). */\n backgroundOpacity?: number\n /** Empty-conversation backdrop blur, 0-20 px (0 disables). */\n backgroundBlurEmpty?: number\n /** With-content backdrop blur, 0-20 px (0 disables). */\n backgroundBlurContent?: number\n /** Composer-card backdrop blur, 0-20 px. */\n inputCardBlur?: number\n /** Message bubble opacity 0-100, for skins exposing bubble alpha. */\n bubbleOpacity?: number\n /** Message-bubble backdrop blur 0-20 px, for skins exposing bubble blur. */\n bubbleBlur?: number\n}\n\n/** Effective value of every field when the state carries none. */\nexport const SKIN_BACKGROUND_DEFAULTS: Readonly<Required<SkinBackgroundConfig>> = {\n enabled: true,\n backgroundOpacity: 0,\n backgroundBlurEmpty: 0,\n backgroundBlurContent: 0,\n inputCardBlur: 10,\n bubbleOpacity: 50,\n bubbleBlur: 10,\n}\n\n/** The fields normalize/sanitize know about; unknown keys are dropped. */\nexport const SKIN_BACKGROUND_FIELDS = Object.keys(SKIN_BACKGROUND_DEFAULTS) as Array<keyof SkinBackgroundConfig>\n\nfunction clampInt(value: number, min: number, max: number): number {\n return Math.max(min, Math.min(max, Math.round(value)))\n}\n\nconst RANGES: Record<Exclude<keyof SkinBackgroundConfig, 'enabled'>, [number, number]> = {\n backgroundOpacity: [0, 100],\n backgroundBlurEmpty: [0, 20],\n backgroundBlurContent: [0, 20],\n inputCardBlur: [0, 20],\n bubbleOpacity: [0, 100],\n bubbleBlur: [0, 20],\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * Lenient normalization for stored/legacy data: unknown keys and wrongly\n * typed fields are dropped, numeric fields are clamped into range. Never\n * fails; a non-object input yields an empty config.\n */\nexport function normalizeSkinBackground(value: unknown): SkinBackgroundConfig {\n if (!isRecord(value)) return {}\n const out: SkinBackgroundConfig = {}\n if (typeof value.enabled === 'boolean') out.enabled = value.enabled\n for (const field of Object.keys(RANGES) as Array<keyof typeof RANGES>) {\n const raw = value[field]\n if (typeof raw !== 'number' || !Number.isFinite(raw)) continue\n const [min, max] = RANGES[field]\n out[field] = clampInt(raw, min, max)\n }\n return out\n}\n\n/**\n * Strict validation for the POST /active write surface: a background value\n * must be an object whose known fields are correctly typed (numbers are then\n * clamped). Returns null for anything else so the route can answer 400.\n */\nexport function sanitizeSkinBackground(value: unknown): SkinBackgroundConfig | null {\n if (!isRecord(value)) return null\n if (value.enabled !== undefined && typeof value.enabled !== 'boolean') return null\n for (const field of Object.keys(RANGES) as Array<keyof typeof RANGES>) {\n const raw = value[field]\n if (raw !== undefined && (typeof raw !== 'number' || !Number.isFinite(raw))) return null\n }\n return normalizeSkinBackground(value)\n}\n\n/** Fill every absent field from {@link SKIN_BACKGROUND_DEFAULTS}. */\nexport function resolveSkinBackground(value: SkinBackgroundConfig | null | undefined): Required<SkinBackgroundConfig> {\n return { ...SKIN_BACKGROUND_DEFAULTS, ...(value ?? {}) }\n}\n\n/** True when at least one field departs from its default (customized data). */\nexport function hasCustomSkinBackground(value: SkinBackgroundConfig): boolean {\n return SKIN_BACKGROUND_FIELDS.some((field) => value[field] !== undefined && value[field] !== SKIN_BACKGROUND_DEFAULTS[field])\n}\n","/**\n * Background-scrim handle for the skin center: applies the chosen occlusion\n * to the page's backdrop, plus an optional per-state Gaussian blur of that\n * backdrop.\n *\n * Occlusion is a CSS variable on `document.body` (--dsw-skin-scrim), which\n * backdrop-painting skins (blue-fantasy / whale-song) read inside their\n * setBackdrop() so the veil stays in sync across theme flips and try-on\n * restores. The official stock look paints no backdrop, so the variable is\n * inert there — the value still persists so it is ready for the next backdrop\n * skin.\n *\n * The Gaussian blur targets the same painted backdrop through a fixed child\n * of `document.body` using backdrop-filter: it samples the body's own\n * background painted behind it. Separate strengths apply to the empty\n * conversation and the conversation-with-content states, detected from the\n * shell's stable message-row class suffixes (hash prefix varies, suffix is\n * stable). When the active blur is 0 no element exists, so there is no GPU\n * cost. Blur never changes the occlusion behavior above.\n *\n * Occlusion values are 0-100 (0 = no extra veil, 100 = fully obscured); they\n * are written through as a 0..1 alpha for the CSS variable. Blur values are\n * 0-20 px. Dragging the controls applies instantly (live).\n *\n * Persistence (issue #996): the controller owns no settings scope — the\n * remote pairing channel fences settings.* as loopback-only, which is what\n * stranded remote clients on defaults. The caller hands in the initial\n * values and a `persist` callback (the v2 /active channel); later external\n * edits (the official settings page locally, the refetched state remotely)\n * arrive through `init()`.\n */\nimport {\n resolveSkinBackground,\n SKIN_BACKGROUND_DEFAULTS,\n type SkinBackgroundConfig,\n} from '../core/background.ts'\n\n/** The namespace string the Host registers (mirrors src/index.ts). */\nexport const SKIN_BACKGROUND_NS = 'skin-background'\n\n/** Field of the background value inside the namespace section. */\nexport const OPACITY_FIELD = 'backgroundOpacity'\n\n/** Field of the empty-conversation backdrop blur inside the namespace section. */\nexport const BLUR_EMPTY_FIELD = 'backgroundBlurEmpty'\n\n/** Field of the with-content backdrop blur inside the namespace section. */\nexport const BLUR_CONTENT_FIELD = 'backgroundBlurContent'\n\n/** Field of the composer card backdrop blur inside the namespace section. */\nexport const INPUT_CARD_BLUR_FIELD = 'inputCardBlur'\n\n/** CSS custom property written to document.body and read by backdrop skins. */\nexport const SCRIM_VAR = '--dsw-skin-scrim'\n\n/** Field of the message bubble opacity inside the namespace section. */\nexport const BUBBLE_OPACITY_FIELD = 'bubbleOpacity'\n\n/** CSS custom property consumed by skins that expose translucent bubbles. */\nexport const BUBBLE_ALPHA_VAR = '--dsh-skin-bubble-alpha'\n\n/** Field of the message bubble blur inside the namespace section. */\nexport const BUBBLE_BLUR_FIELD = 'bubbleBlur'\n\n/** CSS custom property consumed by skins that expose a bubble backdrop blur. */\nexport const BUBBLE_BLUR_VAR = '--dsh-skin-bubble-blur'\n\n/** CSS custom property consumed by the shared composer neutralizer. */\nexport const INPUT_CARD_BLUR_VAR = '--dsh-input-card-blur'\n\n/** Default occlusion (0 = no extra veil) when the section carries none. */\nexport const DEFAULT_OPACITY = SKIN_BACKGROUND_DEFAULTS.backgroundOpacity\n\n/** Default message bubble opacity percentage. */\nexport const DEFAULT_BUBBLE_OPACITY = SKIN_BACKGROUND_DEFAULTS.bubbleOpacity\n\n/** Default message bubble backdrop blur in px. */\nexport const DEFAULT_BUBBLE_BLUR = SKIN_BACKGROUND_DEFAULTS.bubbleBlur\n\n/** Default blur (0 = disabled) when the section carries none. */\nexport const DEFAULT_BLUR = SKIN_BACKGROUND_DEFAULTS.backgroundBlurEmpty\n\n/** The face the skin-center card injects for the background control. */\nexport interface SkinBackgroundHandle {\n /** Current master switch (true when the plugin is on). */\n enabled(): boolean\n /** Toggle + persist the master switch. */\n setEnabled(value: boolean): void\n /** Current occlusion 0-100 (also the getSnapshot seat for useSyncExternalStore). */\n opacity(): number\n /** Current empty-conversation backdrop blur 0-20 px. */\n blurEmpty(): number\n /** Current with-content backdrop blur 0-20 px. */\n blurContent(): number\n /** Current input-card backdrop blur 0-20 px. */\n inputCardBlur(): number\n /** Current message bubble opacity 0-100. */\n bubbleOpacity(): number\n /** Current message bubble backdrop blur 0-20 px. */\n bubbleBlur(): number\n /** Observe a change in the applied values. */\n subscribe(listener: () => void): () => void\n /** Apply + persist a new occlusion. */\n set(opacity: number): void\n /** Apply + persist a new empty-conversation backdrop blur (0-20 px). */\n setBlurEmpty(value: number): void\n /** Apply + persist a new with-content backdrop blur (0-20 px). */\n setBlurContent(value: number): void\n /** Apply + persist a new input-card backdrop blur (0-20 px). */\n setInputCardBlur(value: number): void\n /** Apply + persist a new message bubble opacity (0-100). */\n setBubbleOpacity(value: number): void\n /** Apply + persist a new message bubble backdrop blur (0-20 px). */\n setBubbleBlur(value: number): void\n /** Tear down the blur element and MutationObserver. */\n dispose(): void\n}\n\n/**\n * Selector for a conversation message row inside the shell's center column.\n * Official shell message rows carry `data-chat-anchor-key`; the\n * `data-pane=\"conversation\"` attribute is stamped by the dsh-web-all compat\n * shim on the center column, where the _userRow / _compactionRow /\n * _contextRow / _turnErrorRow suffixes are CSS-module message-row classes\n * (hash prefix varies, suffix is stable).\n */\nconst CONVERSATION_CONTENT_SELECTOR = [\n '[data-chat-anchor-key]',\n '[data-pane=\"conversation\"] [class*=\"_userRow\"]',\n '[data-pane=\"conversation\"] [class*=\"_compactionRow\"]',\n '[data-pane=\"conversation\"] [class*=\"_contextRow\"]',\n '[data-pane=\"conversation\"] [class*=\"_turnErrorRow\"]',\n].join(', ')\n\n/**\n * Own the background preference set: apply the values to the body instantly\n * and persist user edits through the caller-provided channel.\n */\nexport class BackgroundController implements SkinBackgroundHandle {\n private enabledValue = SKIN_BACKGROUND_DEFAULTS.enabled\n private opacityValue = SKIN_BACKGROUND_DEFAULTS.backgroundOpacity\n private blurEmptyValue = SKIN_BACKGROUND_DEFAULTS.backgroundBlurEmpty\n private blurContentValue = SKIN_BACKGROUND_DEFAULTS.backgroundBlurContent\n private inputCardBlurValue = SKIN_BACKGROUND_DEFAULTS.inputCardBlur\n private bubbleOpacityValue = SKIN_BACKGROUND_DEFAULTS.bubbleOpacity\n private bubbleBlurValue = SKIN_BACKGROUND_DEFAULTS.bubbleBlur\n private readonly listeners = new Set<() => void>()\n private readonly persist: (next: SkinBackgroundConfig) => void\n /** The fixed backdrop-filter element, present only while active blur > 0. */\n private blurElement: HTMLDivElement | null = null\n /** Currently applied backdrop-filter blur px (cached to avoid redundant style writes during streaming). */\n private appliedBlur: number | null = null\n /** The body MutationObserver, installed lazily once a blur is active. */\n private observer: MutationObserver | null = null\n /** Pending requestAnimationFrame id for a coalesced recheck. */\n private rafId: number | null = null\n /** Guard: after dispose no scheduled work may reinstall anything. */\n private disposed = false\n\n /**\n * @param initial - values known at construction (the local settings scope\n * snapshot on loopback); null starts from defaults until init() arrives.\n * @param persist - persistence channel for user edits (v2 /active POST).\n */\n constructor(initial: SkinBackgroundConfig | null, persist: (next: SkinBackgroundConfig) => void) {\n this.persist = persist\n if (initial !== null) this.assign(initial)\n this.applyOcclusion()\n this.applyInputCardBlur()\n this.applyBubbleOpacity()\n this.applyBubbleBlur()\n this.syncBlur()\n }\n\n /**\n * Replace the current values with externally sourced ones (the refetched\n * v2 state, or a live settings-scope publish). Never persists — the source\n * already owns the stored copy; the caller decides whether to forward the\n * change into the v2 store.\n */\n init(next: SkinBackgroundConfig | null): void {\n if (this.disposed) return\n this.assign(next ?? {})\n this.applyOcclusion()\n this.applyInputCardBlur()\n this.applyBubbleOpacity()\n this.applyBubbleBlur()\n this.syncBlur()\n this.publish()\n }\n\n /** The current values as a persistable config (every field concrete). */\n snapshot(): SkinBackgroundConfig {\n return {\n enabled: this.enabledValue,\n backgroundOpacity: this.opacityValue,\n backgroundBlurEmpty: this.blurEmptyValue,\n backgroundBlurContent: this.blurContentValue,\n inputCardBlur: this.inputCardBlurValue,\n bubbleOpacity: this.bubbleOpacityValue,\n bubbleBlur: this.bubbleBlurValue,\n }\n }\n\n enabled = (): boolean => this.enabledValue\n\n setEnabled(value: boolean): void {\n this.enabledValue = value\n this.applyOcclusion()\n this.applyInputCardBlur()\n this.applyBubbleOpacity()\n this.applyBubbleBlur()\n this.syncBlur()\n this.publish()\n this.persist(this.snapshot())\n }\n\n opacity = (): number => this.opacityValue\n\n blurEmpty = (): number => this.blurEmptyValue\n\n blurContent = (): number => this.blurContentValue\n\n inputCardBlur = (): number => this.inputCardBlurValue\n\n bubbleOpacity = (): number => this.bubbleOpacityValue\n\n bubbleBlur = (): number => this.bubbleBlurValue\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n }\n\n set(opacity: number): void {\n this.opacityValue = this.clampPercent(opacity)\n this.applyOcclusion()\n this.publish()\n this.persist(this.snapshot())\n }\n\n setBlurEmpty(value: number): void {\n this.blurEmptyValue = this.clampBlur(value)\n this.ensureObserver()\n this.syncBlur()\n this.publish()\n this.persist(this.snapshot())\n }\n\n setBlurContent(value: number): void {\n this.blurContentValue = this.clampBlur(value)\n this.ensureObserver()\n this.syncBlur()\n this.publish()\n this.persist(this.snapshot())\n }\n\n setInputCardBlur(value: number): void {\n this.inputCardBlurValue = this.clampBlur(value)\n this.applyInputCardBlur()\n this.publish()\n this.persist(this.snapshot())\n }\n\n setBubbleOpacity(value: number): void {\n this.bubbleOpacityValue = this.clampPercent(value)\n this.applyBubbleOpacity()\n this.publish()\n this.persist(this.snapshot())\n }\n\n setBubbleBlur(value: number): void {\n this.bubbleBlurValue = this.clampBlur(value)\n this.applyBubbleBlur()\n this.publish()\n this.persist(this.snapshot())\n }\n\n dispose(): void {\n this.disposed = true\n if (this.rafId !== null) {\n cancelAnimationFrame(this.rafId)\n this.rafId = null\n }\n this.removeBlurElement()\n document.body.style.removeProperty(INPUT_CARD_BLUR_VAR)\n document.body.style.removeProperty(BUBBLE_ALPHA_VAR)\n document.body.style.removeProperty(BUBBLE_BLUR_VAR)\n if (this.observer !== null) {\n this.observer.disconnect()\n this.observer = null\n }\n }\n\n /** Copy one config into the live fields, defaults filling the gaps. */\n private assign(config: SkinBackgroundConfig): void {\n const resolved = resolveSkinBackground(config)\n this.enabledValue = resolved.enabled\n this.opacityValue = resolved.backgroundOpacity\n this.blurEmptyValue = resolved.backgroundBlurEmpty\n this.blurContentValue = resolved.backgroundBlurContent\n this.inputCardBlurValue = resolved.inputCardBlur\n this.bubbleOpacityValue = resolved.bubbleOpacity\n this.bubbleBlurValue = resolved.bubbleBlur\n }\n\n private clampBlur(value: number): number {\n return Math.max(0, Math.min(20, Math.round(value)))\n }\n\n private clampPercent(value: number): number {\n return Math.max(0, Math.min(100, Math.round(value)))\n }\n\n private applyInputCardBlur(): void {\n if (!this.enabledValue) {\n document.body.style.removeProperty(INPUT_CARD_BLUR_VAR)\n return\n }\n document.body.style.setProperty(INPUT_CARD_BLUR_VAR, this.inputCardBlurValue + 'px')\n }\n\n private applyBubbleOpacity(): void {\n if (!this.enabledValue) {\n document.body.style.removeProperty(BUBBLE_ALPHA_VAR)\n return\n }\n document.body.style.setProperty(BUBBLE_ALPHA_VAR, String(this.bubbleOpacityValue / 100))\n }\n\n private applyBubbleBlur(): void {\n if (!this.enabledValue) {\n document.body.style.removeProperty(BUBBLE_BLUR_VAR)\n return\n }\n document.body.style.setProperty(BUBBLE_BLUR_VAR, this.bubbleBlurValue + 'px')\n }\n\n /** Write the current occlusion onto the body CSS variable (0..1 alpha). */\n private applyOcclusion(): void {\n if (!this.enabledValue) {\n document.body.style.removeProperty(SCRIM_VAR)\n return\n }\n document.body.style.setProperty(SCRIM_VAR, String(this.opacityValue / 100))\n }\n\n /**\n * Apply the active blur: empty or with-content strength depending on the\n * conversation state. A value > 0 ensures the fixed blur element exists\n * with the matching backdrop-filter; 0 removes it.\n */\n private syncBlur(): void {\n if (this.disposed) return\n if (this.hasExternalWallpaper()) {\n // The delegated wallpaper plugin paints its own glass over its own\n // backdrop, and this layer would sample a shell that plugin relaid\n // (issue #39). Both the layer and the skin it belongs to stand down\n // while that plugin renders.\n this.removeBlurElement()\n return\n }\n if (!this.enabledValue) {\n this.removeBlurElement()\n return\n }\n this.ensureObserver()\n const active = this.hasConversationContent() ? this.blurContentValue : this.blurEmptyValue\n if (active > 0) this.ensureBlurElement(active)\n else this.removeBlurElement()\n }\n\n /** True when the conversation pane hosts at least one message row. */\n private hasConversationContent(): boolean {\n return document.querySelector(CONVERSATION_CONTENT_SELECTOR) !== null\n }\n\n /**\n * True while the delegated Wallpaper Engine plugin renders a wallpaper.\n *\n * The marker is the plugin's own stable `body` attribute (issue #39); this\n * layer reads it, never writes it.\n */\n private hasExternalWallpaper(): boolean {\n return document.body?.hasAttribute('data-we-wallpaper') === true\n }\n\n /** Create (if needed) and size the fixed backdrop-filter element. */\n private ensureBlurElement(active: number): void {\n if (this.blurElement === null) {\n const element = document.createElement('div')\n element.style.position = 'fixed'\n element.style.inset = '0'\n element.style.zIndex = '-1'\n element.style.pointerEvents = 'none'\n element.setAttribute('aria-hidden', 'true')\n this.blurElement = element\n document.body.appendChild(element)\n this.appliedBlur = null\n }\n if (this.appliedBlur === active) return\n this.appliedBlur = active\n const blur = 'blur(' + active + 'px)'\n this.blurElement.style.backdropFilter = blur\n // Safari: the vendor-prefixed form is only reachable via setProperty.\n this.blurElement.style.setProperty('-webkit-backdrop-filter', blur)\n }\n\n /** Remove the fixed blur element, if present. */\n private removeBlurElement(): void {\n if (this.blurElement === null) return\n this.blurElement.remove()\n this.blurElement = null\n this.appliedBlur = null\n }\n\n /**\n * Install the MutationObserver on document.body only when either blur\n * field is active, so a fully-disabled blur never pays the observation\n * cost. Runs lazily on the first non-zero set.\n */\n private ensureObserver(): void {\n if (this.disposed || this.observer !== null) return\n if (this.blurEmptyValue <= 0 && this.blurContentValue <= 0) return\n this.observer = new MutationObserver(() => this.scheduleRecheck())\n // ONE registration, both triggers. Two observe() calls on the same node\n // would REPLACE each other: the second options object drops `subtree`, so\n // the conversation-row watch would silently stop firing. The class filter\n // covers the row flips and the external marker covers the wallpaper.\n this.observer.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['class', 'data-we-wallpaper'],\n })\n }\n\n /** Coalesce burst mutations into one rAF-delayed recheck. */\n private scheduleRecheck(): void {\n if (this.disposed || this.rafId !== null) return\n this.rafId = requestAnimationFrame(() => {\n this.rafId = null\n if (this.disposed) return\n this.syncBlur()\n })\n }\n\n private publish(): void {\n for (const listener of this.listeners) listener()\n }\n}\n","/**\n * Safe reconciliation helpers for the legacy skin-background settings scope.\n *\n * The scope's resolved value contains schema defaults, while its raw user layer\n * contains only fields explicitly stored by the user. The v2 active-state\n * document is authoritative, so a scope update may merge only those raw fields\n * into the live background values.\n */\nimport {\n normalizeSkinBackground,\n SKIN_BACKGROUND_FIELDS,\n type SkinBackgroundConfig,\n} from './background.ts'\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/** Return the known, explicitly stored skin-background fields from a user layer. */\nexport function extractSkinBackgroundUserLayer(value: unknown): SkinBackgroundConfig | null {\n if (!isRecord(value)) return null\n const normalized = normalizeSkinBackground(value)\n const knownFields = Object.keys(normalized) as Array<keyof SkinBackgroundConfig>\n if (knownFields.length === 0) return null\n const owned: SkinBackgroundConfig = {}\n for (const field of knownFields) {\n ;(owned as Record<string, unknown>)[field] = normalized[field]\n }\n return owned\n}\n\n/**\n * Build a v2-safe patch from the raw user layer. Absent fields, including\n * schema-default fields absent from the user layer, never enter the patch.\n */\nexport function skinBackgroundUserPatch(current: SkinBackgroundConfig, user: unknown): SkinBackgroundConfig | null {\n const userConfig = extractSkinBackgroundUserLayer(user)\n if (userConfig === null) return null\n const patch: SkinBackgroundConfig = {}\n for (const field of SKIN_BACKGROUND_FIELDS) {\n if (!Object.hasOwn(userConfig, field)) continue\n const value = userConfig[field]\n if (value === undefined || value === current[field]) continue\n ;(patch as Record<string, unknown>)[field] = value\n }\n return Object.keys(patch).length === 0 ? null : patch\n}\n\nexport interface SkinBackgroundScopeSnapshot {\n revision: number | undefined\n user: unknown\n}\n\nexport interface SkinBackgroundScopeReconcileResult {\n accepted: boolean\n revision: number | undefined\n lastUserJson: string\n patch: SkinBackgroundConfig | null\n}\n\n/** Deterministic serialization of the user layer for content-based dedup. */\nexport function serializeSkinBackgroundUserLayer(user: unknown): string {\n const extracted = extractSkinBackgroundUserLayer(user)\n return extracted === null ? '' : JSON.stringify(extracted)\n}\n\n/**\n * Full reconciliation state the browser glue keeps across scope publications.\n * It adds boot ordering to the revision/content fence so the settings\n * document's initial sync can never be mistaken for a settings-page edit\n * (#1375): a legacy user layer carrying stale explicit values (zeros written\n * by the pre-#1107 bug family) would otherwise patch — and persist over — the\n * authoritative v2 state on every boot where the document and the v2 GET\n * finish in the unlucky order.\n */\nexport interface SkinBackgroundReconcileState {\n /** Whether the authoritative v2 GET has completed and applied its values. */\n v2Loaded: boolean\n /** Whether the one-shot boot document sync (first revisioned publication) was consumed. */\n bootSyncSeen: boolean\n /** Last namespace revision seen (published, or seeded at construction). */\n lastRevision: number | undefined\n /** Serialized user layer seen last, for content-based replay dedup. */\n lastUserJson: string\n}\n\n/** Seed the reconcile state from the scope snapshot visible at construction. */\nexport function initialSkinBackgroundReconcileState(\n snapshot: SkinBackgroundScopeSnapshot,\n): SkinBackgroundReconcileState {\n return {\n v2Loaded: false,\n bootSyncSeen: false,\n lastRevision: snapshot.revision,\n lastUserJson: serializeSkinBackgroundUserLayer(snapshot.user),\n }\n}\n\n/**\n * Fold one scope publication into the reconcile state and produce the v2-safe\n * patch to merge into the live background values (null = nothing to apply).\n *\n * The boot document never merges, whichever order it lands in:\n * - a publication seen before the v2 GET completes is only recorded, so the\n * post-load check reads it as the unchanged boot snapshot, not an edit;\n * - the first revisioned publication of the plugin's lifetime (the document\n * resync itself) is consumed as the boot sync even when it lands after the\n * GET, because a genuine settings-page edit can only follow the document.\n */\nexport function reconcileSkinBackgroundPublication(\n state: SkinBackgroundReconcileState,\n current: SkinBackgroundConfig,\n snapshot: SkinBackgroundScopeSnapshot,\n): { state: SkinBackgroundReconcileState; patch: SkinBackgroundConfig | null } {\n const seen: SkinBackgroundReconcileState = {\n ...state,\n lastRevision: snapshot.revision ?? state.lastRevision,\n lastUserJson: serializeSkinBackgroundUserLayer(snapshot.user),\n }\n if (!state.v2Loaded) return { state: seen, patch: null }\n if (!state.bootSyncSeen) {\n return {\n state: snapshot.revision === undefined ? seen : { ...seen, bootSyncSeen: true },\n patch: null,\n }\n }\n const result = reconcileSkinBackgroundScope(current, snapshot, state.lastRevision, state.lastUserJson)\n return { state: seen, patch: result.patch }\n}\n\n/**\n * Accept a scope publication only when its namespace revision is new AND the\n * user layer has actually changed. A revision bump with identical user-layer\n * content is a replay (settings-mirror resync, WS reconnect, or another\n * plugin writing to the global settings document) and must not overwrite the\n * authoritative v2 state.\n */\nexport function reconcileSkinBackgroundScope(\n current: SkinBackgroundConfig,\n snapshot: SkinBackgroundScopeSnapshot,\n lastRevision: number | undefined,\n lastUserJson: string | undefined,\n): SkinBackgroundScopeReconcileResult {\n const currentUserJson = serializeSkinBackgroundUserLayer(snapshot.user)\n if (\n snapshot.revision === undefined\n || snapshot.revision === lastRevision\n || currentUserJson === lastUserJson\n || currentUserJson === ''\n ) {\n return {\n accepted: false,\n revision: snapshot.revision ?? lastRevision,\n lastUserJson: currentUserJson,\n patch: null,\n }\n }\n return {\n accepted: true,\n revision: snapshot.revision,\n lastUserJson: currentUserJson,\n patch: skinBackgroundUserPatch(current, snapshot.user),\n }\n}\n","/**\n * First-screen handoff contract with the delegated wallpaper plugin (issue #51).\n *\n * The browser's first paint is decided by the delivered document, and the\n * delegated plugin's `body[data-we-wallpaper]` marker only exists after its\n * own client chain has run. The host half therefore withholds the skin from\n * the document when the peer's persisted selection names a wallpaper, and\n * stamps this attribute so the browser half knows the withholding was a\n * PREDICTION rather than an observed verdict.\n *\n * The attribute is a first-screen prediction, never a verdict: it stands down\n * the skin for the window in which the peer's marker is expected to arrive, and\n * then expires on its own (see\n * src/client/runtime/external-wallpaper-engine.ts). The marker remains the only\n * thing that decides the page once the peer has spoken.\n *\n * Shared by both halves of this package (host stamps it, browser reads it), so\n * it lives in `core/` rather than in either runtime.\n * @module @linxin666/dsh-client-ui-skin-center/core/wallpaper-handoff\n */\n\n/**\n * The `<html>` attribute the host stamps when it withheld the skin from a\n * document because the delegated wallpaper plugin's persisted selection says a\n * wallpaper is about to render. Presence means \"the skin is withheld for a\n * predicted wallpaper\"; the value carries nothing.\n */\nexport const WALLPAPER_EXPECTED_ATTR = 'data-dsh-wallpaper-expected'\n\n/**\n * How long a first-screen prediction stands down the skin before it expires on\n * its own.\n *\n * The prediction covers exactly one window: the peer's client chain resolving\n * its persisted selection and stamping its marker, measured at roughly\n * 300ms-1s. This is the same bounded hand-back window the user-initiated\n * stage claim uses (USER_INITIATED_YIELD_GRACE_MS in skin-controller.ts), for\n * the same reason: the peer's answer is the live marker, and this only has to\n * cover the round trip to it.\n *\n * Expiry is what keeps a wrong prediction from stranding the page. A wallpaper\n * that never renders (a broken file, a decode failure) never stamps the\n * marker, so the window is the only thing standing between that user and their\n * skin. When it closes, the boot activation paints the remembered selection.\n */\nexport const PREDICTED_WALLPAPER_GRACE_MS = 1500\n","/**\n * External Wallpaper Engine plugin interop (issue #39, migration round).\n *\n * The skin center no longer ships a Wallpaper Engine bridge: wallpaper support\n * is delegated to `dsh-plugin-wallpaper-engine`, which owns the WE library,\n * the wallpaper rendering and the theme follows the wallpaper. That plugin\n * signals an active wallpaper on the document itself with the stable\n * `body[data-we-wallpaper]` attribute (it stamps the attribute while a\n * wallpaper renders and removes it when playback stops).\n *\n * While that attribute is present the skin center stands its own visual work\n * down, so the wallpaper owns the backdrop:\n *\n * - the composer frost follower is not mounted (the wallpaper plugin paints\n * its own glass, and two fixed `backdrop-filter` stacks sample a shell the\n * other one relaid);\n * - the skin manifest's `backgroundMedia` is not painted, so the wallpaper is\n * never covered by skin art (this replaces the old in-house priority rule);\n * - the active skin keeps its token remaps and patches, which remain correct\n * over a wallpaper because every skin already yields its opaque plates to\n * `body[data-we-wallpaper]` (see the catalog skins and\n * contracts/semantic-attrs-v1.md).\n *\n * The watcher is attribute-only and read-only: it never writes the other\n * plugin's marker, never mounts a layer of its own, and reports through a\n * plain callback so the two consumers (the skin controller's background-media\n * gate and the scene marker) stay independent.\n * @module @linxin666/dsh-client-ui-skin-center/runtime/external-wallpaper-engine\n */\n\nimport { WALLPAPER_EXPECTED_ATTR } from '../../core/wallpaper-handoff.ts'\n\n/**\n * The stable attribute `dsh-plugin-wallpaper-engine` stamps on `body` while a\n * wallpaper is rendering. This is the plugin's public interop contract, the\n * same one other third-party plugins key on.\n */\nexport const EXTERNAL_WE_ACTIVE_ATTR = 'data-we-wallpaper'\n\n/** The element the attribute is stamped on. */\nexport const EXTERNAL_WE_ACTIVE_TARGET = 'body'\n\n/** True when the external wallpaper plugin currently renders a wallpaper. */\nexport function externalWallpaperEngineActive(doc: Document): boolean {\n return doc.body?.hasAttribute(EXTERNAL_WE_ACTIVE_ATTR) === true\n}\n\n/**\n * True when the host withheld this document's skin for a PREDICTED wallpaper\n * (issue #51), and no marker has arrived yet to confirm or deny it.\n *\n * This is what closes the second half of the flash. The host can pre-judge the\n * first screen from the peer's persisted selection, but the browser half boots\n * asynchronously: with no stamp in the document it recovers the selection from\n * GET /active and activates it, which is exactly the switch that would paint a\n * frame of skin into the gap the host just left. The prediction is what tells\n * that switch to stand down until the peer's marker speaks.\n *\n * It expires (see {@link releasePrediction}) rather than standing forever: a\n * wallpaper that never renders must not keep the user off their own skin.\n * @param doc - the document the host stamped.\n * @returns true while a prediction is outstanding.\n */\nexport function externalWallpaperPredicted(doc: Document): boolean {\n return doc.documentElement?.hasAttribute(WALLPAPER_EXPECTED_ATTR) === true\n}\n\n/**\n * Drop the host's prediction from the document, so a later read reports none.\n *\n * Called once the peer's marker has answered (either way) or the grace window\n * has closed. The attribute is this package's own - the host half stamped it\n * and no other plugin reads it - so clearing it here only ends this package's\n * own first-screen bookkeeping and never touches the peer's marker.\n * @param doc - the document the host stamped.\n */\nexport function releasePrediction(doc: Document): void {\n doc.documentElement?.removeAttribute(WALLPAPER_EXPECTED_ATTR)\n}\n\n/**\n * Observe the external plugin's active marker.\n *\n * The callback fires once immediately with the current state (so a page that\n * boots with a wallpaper already rendering never paints a frame of skin art\n * first), then on every flip while the returned teardown is live.\n *\n * @param doc - the document whose `body` carries the marker.\n * @param listener - called with the new state on every change.\n * @returns the idempotent teardown.\n */\nexport function watchExternalWallpaperEngine(\n doc: Document,\n listener: (active: boolean) => void,\n): () => void {\n let last = false\n let stopped = false\n\n const read = (): boolean => externalWallpaperEngineActive(doc)\n\n const report = (): void => {\n if (stopped) return\n const next = read()\n if (next === last) return\n last = next\n listener(next)\n }\n\n // Wrapped in a try/catch by construction: an unknown attribute at boot is\n // simply \"not active\", never an error path.\n try {\n last = read()\n listener(last)\n } catch {\n // An unreadable body (a detached document) leaves the default: inactive.\n }\n\n const win = doc.defaultView\n if (win === null || typeof win.MutationObserver !== 'function') {\n return () => { stopped = true }\n }\n const observer = new win.MutationObserver(report)\n observer.observe(doc.body ?? doc.documentElement, {\n attributes: true,\n attributeFilter: [EXTERNAL_WE_ACTIVE_ATTR],\n })\n return () => {\n stopped = true\n observer.disconnect()\n }\n}\n","/**\n * Delegated theme interop: is the plugin that owns a delegated skin's visual\n * actually on this page, and can it give the page back?\n *\n * A delegated skin (src/core/delegated-skins.ts) is selected, persisted and\n * adopted exactly like an asset skin, but this package paints none of it: the\n * delegated plugin mounts its own bundle from its own client chain. Two\n * attributes on the document say what it is doing, and both are its own public\n * contract. This module reads them; it never writes them.\n *\n * body[data-dsh-claude-style] the plugin is live: its stylesheet is\n * mounted and its body attributes are\n * stamped. The value is its build id.\n * body[data-dsh-claude-style-handoff] the running build watches for an\n * external owner and stands down when\n * one appears. Its PRESENCE is the\n * capability: a build without it\n * cannot yield, so the card must not\n * let the user select this skin and\n * then pick another one over it.\n *\n * Why the capability matters: the two packages repaint the same shell. If this\n * package stamped html[data-dsh-skin] while the peer kept painting, the result\n * is the degraded-glass, double-backdrop-filter page the Wallpaper Engine\n * delegation was built to end. Refusing to offer the row is the honest answer\n * on an old build; the fix belongs in the plugin, not in a skin-center\n * workaround.\n *\n * Attribute-only and read-only, exactly like the wallpaper interop next to it\n * (runtime/external-wallpaper-engine.ts): one MutationObserver over the known\n * attributes, a callback on every flip, and nothing else.\n * @module @linxin666/dsh-client-ui-skin-center/runtime/delegated-theme\n */\n\n/** What one delegated plugin is doing on this page. */\nexport interface DelegatedThemeState {\n /** True while the plugin stamps its own body attribute (it is live). */\n live: boolean\n /** True while the plugin advertises that it can stand down for an owner. */\n canYield: boolean\n}\n\n/** The attributes one delegated plugin owns, as its descriptor names them. */\nexport interface DelegatedThemeMarkers {\n /** The plugin's own live marker on body. */\n bodyAttr: string\n /** The plugin's handoff-capability marker on body. */\n handoffAttr: string\n}\n\n/**\n * Read one delegated plugin's state from the document.\n * @param doc - the document the plugin stamps.\n * @param markers - the two attributes that plugin owns.\n * @returns whether it is live, and whether it can stand down.\n */\nexport function delegatedThemeState(\n doc: Document,\n markers: DelegatedThemeMarkers,\n): DelegatedThemeState {\n const body = doc.body\n if (body === null) return { live: false, canYield: false }\n return {\n live: body.hasAttribute(markers.bodyAttr),\n canYield: body.hasAttribute(markers.handoffAttr),\n }\n}\n\n/**\n * Observe one delegated plugin's markers.\n *\n * The callback fires once immediately with the current state, so a page that\n * boots while the plugin is already live never renders a row that claims it is\n * not, then on every flip while the returned teardown is live.\n *\n * @param doc - the document whose body carries the markers.\n * @param markers - the two attributes that plugin owns.\n * @param listener - called with the new state on every change.\n * @returns the idempotent teardown.\n */\nexport function watchDelegatedTheme(\n doc: Document,\n markers: DelegatedThemeMarkers,\n listener: (state: DelegatedThemeState) => void,\n): () => void {\n let last: DelegatedThemeState | null = null\n let stopped = false\n\n const report = (): void => {\n if (stopped) return\n const next = delegatedThemeState(doc, markers)\n if (last !== null && next.live === last.live && next.canYield === last.canYield) return\n last = next\n listener(next)\n }\n\n try {\n last = delegatedThemeState(doc, markers)\n listener(last)\n } catch {\n // A detached document (no body yet) leaves the default: not live.\n last = { live: false, canYield: false }\n }\n\n const win = doc.defaultView\n if (win === null || typeof win.MutationObserver !== 'function') {\n return () => { stopped = true }\n }\n const observer = new win.MutationObserver(report)\n const target = doc.body ?? doc.documentElement\n if (target !== null) {\n observer.observe(target, {\n attributes: true,\n attributeFilter: [markers.bodyAttr, markers.handoffAttr],\n })\n }\n return () => {\n stopped = true\n observer.disconnect()\n }\n}\n","/**\n * External Wallpaper Engine plugin probe (issue #39, migration round).\n *\n * Wallpaper support no longer ships inside the skin center: it is delegated to\n * `dsh-plugin-wallpaper-engine`, which owns the WE library scan, the video /\n * web / scene rendering paths, the wallpaper settings surface and the theme\n * that follows the wallpaper. The skin center keeps only the skin side, and\n * interoperates with that plugin through its public document marker\n * `body[data-we-wallpaper]` (see\n * src/client/runtime/external-wallpaper-engine.ts).\n *\n * This module is the READ-ONLY half of that relationship: it reports whether\n * the external plugin is installed in this profile, so the card can point the\n * user at it instead of offering a wallpaper feature of its own. It never\n * installs, removes, disables or rewrites anything; installation is the user's,\n * performed through the official plugin manager.\n *\n * The reads themselves are the shared profile probe\n * (core/profile-plugin-probe.ts), which the delegated-skin registry asks the\n * same questions. This file keeps the wallpaper-specific constants, the report\n * shape, and the peer's own persisted selection read.\n *\n * That persisted read is the FIRST-SCREEN prediction (issue #51). The runtime\n * withholds the skin off `body[data-we-wallpaper]`, which that plugin stamps\n * from its own client chain a few hundred milliseconds into the boot - later\n * than the browser's first paint, which the document itself decides. So the\n * first screen would paint the skin and then cut to the wallpaper, and this\n * package reads the peer's own persisted selection synchronously to pre-judge\n * the first screen instead. The prediction is exactly that: the runtime still\n * decides on the marker, and a prediction the peer never confirms costs one\n * extra stylesheet fetch when the boot activation repaints the skin.\n * @module @linxin666/dsh-client-ui-skin-center/external-wallpaper\n */\n\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nimport {\n SIGNAL_CORDIS_ROW,\n SIGNAL_PROFILE_DEPENDENCY,\n detectProfilePlugin,\n manifestNamesPlugin,\n patchNamesPlugin,\n profilePluginPaths,\n readJsonIfFile,\n type ProfilePluginPaths,\n} from './core/profile-plugin-probe.ts'\nimport { firstNonBlank } from './harness-home.ts'\n\n/** The delegated wallpaper plugin this package interoperates with. */\nexport const EXTERNAL_WE_PLUGIN = 'dsh-plugin-wallpaper-engine'\n\n/** Upstream repository of the delegated plugin (install + docs pointer). */\nexport const EXTERNAL_WE_REPO = 'https://github.com/elysia395/dsh-wallpaper-engine'\n\n/** The install command the card shows when the plugin is missing. */\nexport const EXTERNAL_WE_INSTALL_COMMAND = 'dsh plugin --profile web add ' + EXTERNAL_WE_PLUGIN\n\n/** What the probe found, and which signal found it. */\nexport interface ExternalWallpaperReport {\n /** True when the delegated plugin is installed in this profile. */\n installed: boolean\n /** The signal names that matched, in report order. Empty when not installed. */\n signals: string[]\n /** The delegated plugin's package name (always present). */\n packageName: string\n /** Upstream repository URL, so the card can link install and docs. */\n repository: string\n /** The exact install command to show the user. */\n installCommand: string\n /** The npm package spec the card hands to the plugin manager. */\n npm: string\n}\n\nexport { SIGNAL_CORDIS_ROW, SIGNAL_PROFILE_DEPENDENCY }\n\n/**\n * Whether a package.json dependency map names the delegated plugin.\n *\n * Matched by key only: a `link:`, a `file:`, a caret range and a bare tag all\n * put the same key in the map, and the version range is not this probe's\n * business.\n * @param manifest - parsed profile package.json, or null.\n * @param packageName - the package to look for (defaults to the delegated one).\n * @returns true when any dependency section names the plugin.\n */\nexport function manifestNamesExternalWallpaper(\n manifest: Record<string, unknown> | null,\n packageName: string = EXTERNAL_WE_PLUGIN,\n): boolean {\n return manifestNamesPlugin(manifest, packageName)\n}\n\n/**\n * Whether a cordis patch layer activates a row naming the delegated plugin.\n *\n * The row form is `name: 'dsh-plugin-wallpaper-engine'` under an insert list\n * or an id-targeted override; both spell the same package string, so the probe\n * looks for the package name as a quoted or bare scalar. A DISABLED row still\n * means the plugin is installed and wired (the loader keeps it mounted as\n * inactive), which is a real installation the card must not offer to install\n * again.\n * @param patch - raw cordis.patch.yml text, or null.\n * @param packageName - the package to look for (defaults to the delegated one).\n * @returns true when the text names the plugin.\n */\nexport function patchNamesExternalWallpaper(\n patch: string | null,\n packageName: string = EXTERNAL_WE_PLUGIN,\n): boolean {\n return patchNamesPlugin(patch, packageName)\n}\n\n/** Paths the probe reads, resolved once. */\nexport type ExternalWallpaperPaths = ProfilePluginPaths\n\n/**\n * Resolve the files the probe reads for a harness home / profile pair. The\n * profile patch comes first, then the harness-home patch layer, then the\n * profile's own composition file, so an install written by any of the\n * manager's paths is seen.\n * @param options - explicit harness home / profile (tests), else the live layout.\n * @returns the paths, whether or not they exist.\n */\nexport function externalWallpaperPaths(\n options: { home?: string; profile?: string } = {},\n): ExternalWallpaperPaths {\n return profilePluginPaths(options)\n}\n\n/**\n * Probe this profile for the delegated Wallpaper Engine plugin.\n *\n * Never throws: an unreadable or missing input is \"no signal\" and the report\n * simply says not installed. The probe only reads.\n * @param options - explicit harness home / profile (tests), else the live layout.\n * @returns the report the card and the API render.\n */\nexport function detectExternalWallpaperEngine(\n options: { home?: string; profile?: string } = {},\n): ExternalWallpaperReport {\n const probe = detectProfilePlugin(EXTERNAL_WE_PLUGIN, options)\n return {\n installed: probe.installed,\n signals: probe.signals,\n packageName: EXTERNAL_WE_PLUGIN,\n repository: EXTERNAL_WE_REPO,\n installCommand: EXTERNAL_WE_INSTALL_COMMAND,\n // The registry name and the install spec are the same string for this\n // package; it stays its own field so a pinned dist-tag can diverge later.\n npm: EXTERNAL_WE_PLUGIN,\n }\n}\n\n/** Environment variable the peer's own host reads its data directory from. */\nexport const EXTERNAL_WE_DATA_DIR_ENV = 'DSH_WE_DATA_DIR'\n\n/** The peer's default data directory, under the user's home. */\nexport const EXTERNAL_WE_DEFAULT_DATA_DIR = '.dsh-wallpaper-engine'\n\n/** The file that directory carries, where the peer persists its selection. */\nexport const EXTERNAL_WE_CONFIG_FILE = 'config.json'\n\n/**\n * The peer's data directory: its own `$DSH_WE_DATA_DIR` override when set, and\n * the documented default under the user's home otherwise. The host file is the\n * only source of truth for the selection; this override moves where it lives\n * and changes nothing else.\n * @param env - the environment to read (tests), else this process's.\n * @returns an absolute directory path.\n */\nexport function externalWallpaperDataDir(env: NodeJS.ProcessEnv = process.env): string {\n return firstNonBlank(env[EXTERNAL_WE_DATA_DIR_ENV]) ?? join(homedir(), EXTERNAL_WE_DEFAULT_DATA_DIR)\n}\n\n/**\n * The persisted-selection file the first-screen prediction reads.\n * @param env - the environment to read (tests), else this process's.\n * @returns an absolute file path, whether or not it exists.\n */\nexport function externalWallpaperConfigPath(env: NodeJS.ProcessEnv = process.env): string {\n return join(externalWallpaperDataDir(env), EXTERNAL_WE_CONFIG_FILE)\n}\n\n/**\n * Whether the peer's persisted selection names a wallpaper (issue #51).\n *\n * `settings.id` is that plugin's stable contract: its host owns the file and\n * writes the chosen wallpaper into it, so a non-empty id means the wallpaper is\n * what the next page load is about to bring up. Reading it synchronously is\n * what lets the first screen already be the wallpaper.\n *\n * This is a FIRST-SCREEN pre-judgment, not a second source of truth. The\n * runtime still decides on `body[data-we-wallpaper]`, which is the live\n * verdict, so a prediction the peer never confirms (a wallpaper that fails to\n * render and takes its marker with it) costs one stylesheet fetch when the\n * boot activation repaints the skin. It is therefore fail-OPEN toward the\n * skin: an absent, unreadable or malformed file means \"no wallpaper\", never a\n * reason to withhold the skin the user selected.\n * @param env - the environment to read (tests), else this process's.\n * @returns true when a wallpaper is persisted.\n */\nexport function persistedExternalWallpaperActive(env: NodeJS.ProcessEnv = process.env): boolean {\n try {\n const config = readJsonIfFile(externalWallpaperConfigPath(env))\n if (config === null) return false\n const settings = config.settings\n if (typeof settings !== 'object' || settings === null || Array.isArray(settings)) return false\n const id = (settings as Record<string, unknown>).id\n return typeof id === 'string' && id.trim() !== ''\n } catch {\n // Fail toward the skin: an unreadable peer file must not cost a user\n // their skin.\n return false\n }\n}\n","/**\n * Skin-center locale dictionaries. The plugin-card name, its description,\n * and every control of the in-GUI skin center is localized through the\n * standard `t` seat.\n */\n\n/** Copy keys owned by this plugin. */\nexport type SkinCenterKey =\n | 'title'\n | 'cardDescription'\n | 'externalWallpaperReadyTitle'\n | 'externalWallpaperReadyBody'\n | 'externalWallpaperMissingTitle'\n | 'externalWallpaperMissingBody'\n | 'externalWallpaperLink'\n | 'externalWallpaperRecommended'\n | 'externalWallpaperInstall'\n | 'externalWallpaperInstalling'\n | 'externalWallpaperCopyCommand'\n | 'externalWallpaperCopied'\n | 'externalWallpaperInstallFailed'\n | 'delegatedSkinBadge'\n | 'delegatedSkinDescriptionClaudeStyle'\n | 'delegatedSkinNotRunning'\n | 'delegatedSkinManage'\n | 'delegatedSkinNoHandoff'\n | 'delegatedSkinInstall'\n | 'delegatedSkinInstalling'\n | 'delegatedSkinInstallFailed'\n | 'delegatedSkinDescriptorMismatch'\n | 'delegatedSkinLink'\n | 'stoodDownTitle'\n | 'stoodDownBody'\n | 'enabled'\n | 'enabledHint'\n | 'offNote'\n | 'intro'\n | 'official'\n | 'officialTagline'\n | 'active'\n | 'tryingOn'\n | 'tryOn'\n | 'loading'\n | 'exitTryOn'\n | 'apply'\n | 'applying'\n | 'restore'\n | 'applyFailed'\n | 'appliedUnconfirmed'\n | 'appliedNeedRestart'\n | 'theme'\n | 'themeLight'\n | 'themeDark'\n | 'tryOnError'\n | 'backgroundOpacity'\n | 'backgroundBlurEmpty'\n | 'backgroundBlurContent'\n | 'inputCardBlur'\n | 'inputCardBlurHint'\n | 'bubbleOpacity'\n | 'bubbleOpacityHint'\n | 'bubbleBlur'\n | 'bubbleBlurHint'\n | 'backgroundBlurHint'\n | 'backgroundBlurInert'\n | 'backgroundHint'\n | 'backgroundHintInert'\n | 'wallpaperTitle'\n | 'wallpaperEnable'\n | 'wallpaperHint'\n | 'wallpaperLoadError'\n | 'wallpaperLibraryFound'\n | 'wallpaperLibraryManual'\n | 'wallpaperRefresh'\n | 'wallpaperMode'\n | 'wallpaperModeLive'\n | 'wallpaperModeFrame'\n | 'wallpaperFit'\n | 'wallpaperFitCover'\n | 'wallpaperFitContain'\n | 'wallpaperFitFill'\n | 'wallpaperClear'\n | 'wallpaperDim'\n | 'wallpaperOpacity'\n | 'wallpaperBlur'\n | 'wallpaperPauseHidden'\n | 'wallpaperSound'\n | 'wallpaperSoundHint'\n | 'wallpaperVolume'\n | 'wallpaperImport'\n | 'wallpaperImportHint'\n | 'wallpaperReimport'\n | 'wallpaperRemove'\n | 'wallpaperUpdateAvailable'\n | 'wallpaperEmpty'\n | 'wallpaperTypeVideo'\n | 'wallpaperTypeWeb'\n | 'wallpaperTypeScene'\n | 'wallpaperTypeApp'\n | 'wallpaperLoadMore'\n | 'wallpaperDirs'\n | 'wallpaperDirsEmpty'\n | 'wallpaperDirsHint'\n | 'wallpaperDirPlaceholder'\n | 'wallpaperDirAdd'\n | 'wallpaperDirBrowse'\n | 'wallpaperDirBrowseHint'\n | 'wallpaperDirBrowseFailed'\n | 'wallpaperDirBrowseTitle'\n | 'wallpaperDirBrowseChoose'\n | 'wallpaperDirBrowseEmpty'\n | 'wallpaperDirBrowseHidden'\n | 'wallpaperDirBrowseTruncated'\n | 'wallpaperSaveFailed'\n | 'wallpaperRatingAll'\n | 'wallpaperRatingG'\n | 'wallpaperRatingPg13'\n | 'wallpaperRatingR18'\n | 'wallpaperPagePrev'\n | 'wallpaperPageNext'\n | 'wallpaperPageJump'\n | 'wallpaperPageTotal'\n | 'customThemeTitle'\n | 'customThemeTagline'\n | 'customThemeEdit'\n | 'customThemeCloseEdit'\n | 'customThemeMode'\n | 'customThemeLight'\n | 'customThemeDark'\n | 'customThemeAccent'\n | 'customThemeBackground'\n | 'customThemeForeground'\n | 'customThemeContrast'\n | 'customThemeReset'\n | 'customThemeResetHint'\n | 'customThemeSaveFailed'\n | 'uninstall'\n | 'uninstalling'\n | 'uninstallConfirm'\n | 'uninstallFailed'\n | 'verifyIntegrity'\n | 'verifyingIntegrity'\n | 'verifyAllPassed'\n | 'verifyFoundIssues'\n | 'integrityValid'\n | 'integrityTampered'\n | 'integrityMissing'\n | 'integrityHooksRefused'\n | 'cancel'\n | 'confirm'\n | 'verifyRepaired'\n | 'verifyRepairFailed'\n | 'repair'\n | 'repairing'\n | 'repaired'\n | 'updateAll'\n | 'updateAllChecking'\n | 'updateAllRunning'\n | 'updateAllNone'\n | 'updateAllDone'\n | 'updateAllFailed'\n | 'uninstallAll'\n | 'uninstallAllConfirm'\n | 'uninstallAllRunning'\n | 'uninstallAllDone'\n | 'uninstallAllFailed'\n | 'marketUnreachable'\n | 'bulkNoUserSkins'\n\nexport const en: Record<SkinCenterKey, string> = {\n title: 'Skin Center',\n cardDescription: 'Try on any installed skin live in the GUI — exit restores instantly, applying persists in one click.',\n externalWallpaperReadyTitle: 'Wallpapers are handled by another plugin',\n externalWallpaperReadyBody: 'Wallpaper Engine support comes from the {package} plugin, which owns the wallpaper library, rendering and settings. While it renders a wallpaper it takes over the backdrop, and this card keeps the skin on top of it: the skin\\'s own background art steps aside and the composer frost yields to the plugin\\'s glass.',\n externalWallpaperMissingTitle: 'Wallpaper Engine support moved to its own plugin',\n externalWallpaperMissingBody: 'This card no longer bundles a Wallpaper Engine bridge. To use Wallpaper Engine wallpapers, install {package} with the command below and restart dsh; it adds its own settings page for the wallpaper library, rendering and glass.',\n externalWallpaperLink: 'Open the wallpaper plugin docs',\n externalWallpaperRecommended: 'Recommended',\n externalWallpaperInstall: 'Install',\n externalWallpaperInstalling: 'Installing...',\n externalWallpaperCopyCommand: 'Copy command',\n externalWallpaperCopied: 'Copied',\n externalWallpaperInstallFailed: 'Install failed: {reason}',\n delegatedSkinBadge: 'Plugin theme',\n delegatedSkinDescriptionClaudeStyle:\n 'The whole GUI as Claude Code Desktop: warm ivory canvas, serif body text, the ember accent, a pixel mascot on the composer and the chat-area behaviours Claude Code is known for. Its own settings page stays reachable while another skin is on screen.',\n delegatedSkinNotRunning: 'The plugin is installed but not running here. Enable it in Plugins, then reopen this page.',\n delegatedSkinNoHandoff: 'The running plugin build cannot hand the page back to a skin, so it cannot be selected from here. Update dsh-claude-style.',\n delegatedSkinInstall: 'Install now',\n delegatedSkinManage: 'Manage in Plugins',\n delegatedSkinInstalling: 'Installing...',\n delegatedSkinInstallFailed: 'Install failed: {reason}',\n delegatedSkinDescriptorMismatch: 'The installed plugin declares a different skin id or attribute than this card knows. Update the plugin.',\n delegatedSkinLink: 'Open the plugin docs',\n stoodDownTitle: 'Skin paused while the wallpaper is active',\n stoodDownBody: 'Your skin is still selected, but it is not painted while the wallpaper plugin renders a wallpaper: the two cannot share the backdrop. Stop the wallpaper there and the skin comes back on its own.',\n enabled: 'Enable skin center',\n enabledHint: 'When off, try-on, apply and background controls are disabled; turn it back on to resume.',\n offNote: 'The skin center is turned off.',\n intro: 'Try on any skin live — it takes effect instantly, exit restores the current look. Apply persists it across restarts.',\n official: 'Official default',\n officialTagline: 'The stock DSH look with no skin applied.',\n active: 'Active',\n tryingOn: 'Trying on',\n tryOn: 'Try on',\n loading: 'Loading…',\n exitTryOn: 'Exit try-on',\n apply: 'Apply',\n applying: 'Applying…',\n restore: 'Restore',\n applyFailed: 'Apply failed',\n appliedUnconfirmed: 'Applied, but the change has not been confirmed — refresh the page in dev mode; packaged installs (DSH Desktop) need an app restart',\n appliedNeedRestart: 'Applied and confirmed, but the host did not hot-reload — restart dsh to take effect',\n theme: 'Theme preview',\n themeLight: 'Light',\n themeDark: 'Dark',\n tryOnError: 'Try-on failed — see console',\n backgroundOpacity: 'Background occlusion',\n backgroundBlurEmpty: 'Blur when empty',\n backgroundBlurContent: 'Blur with content',\n inputCardBlur: 'Input card blur',\n inputCardBlurHint: 'Blurs only the area behind the input card while backdrop art is visible; it does not blur the entire wallpaper.',\n bubbleOpacity: 'Bubble opacity',\n bubbleOpacityHint: 'Controls translucent message bubbles for skins that expose bubble alpha, such as Whale Mom.',\n bubbleBlur: 'Bubble blur',\n bubbleBlurHint: 'Blurs the backdrop behind translucent message bubbles; independent of bubble opacity, 0 disables.',\n backgroundBlurHint: 'Applies a separate Gaussian blur to the backdrop for the empty conversation and the conversation with content; 0 disables.',\n backgroundBlurInert: 'Visible only with skins that paint a backdrop; the official default has none.',\n backgroundHint: 'Instantly veils the backdrop behind the panels — higher values obscure the art to help you focus.',\n backgroundHintInert: 'Only applies to skins that paint a backdrop (Blue Fantasy / Whale Song). Applies to the official default automatically once such a skin is active.',\n wallpaperTitle: 'Wallpaper Engine',\n wallpaperEnable: 'Enable wallpapers',\n wallpaperHint: 'Use your local Wallpaper Engine library as the GUI backdrop: video, web, and scene wallpapers render live (scene wallpapers need WebGL). On macOS there is no Wallpaper Engine library, so the feature starts off — turn it on, then add a folder of videos.',\n wallpaperLoadError: 'Wallpaper library failed to load',\n wallpaperLibraryFound: 'Wallpaper Engine library detected',\n wallpaperLibraryManual: 'Folders you added',\n wallpaperRefresh: 'Refresh',\n wallpaperMode: 'Render mode',\n wallpaperModeLive: 'Live',\n wallpaperModeFrame: 'Static frame',\n wallpaperFit: 'Sizing mode',\n wallpaperFitCover: 'Cover (fill)',\n wallpaperFitContain: 'Fit (entire image)',\n wallpaperFitFill: 'Stretch',\n wallpaperClear: 'Turn off wallpaper',\n wallpaperDim: 'Wallpaper dimming',\n wallpaperOpacity: 'Wallpaper opacity',\n wallpaperBlur: 'Wallpaper blur',\n wallpaperPauseHidden: 'Pause when window hidden',\n wallpaperSound: 'Wallpaper sound',\n wallpaperSoundHint: 'Play video wallpaper audio. The browser may keep it silent until you click or press a key once.',\n wallpaperVolume: 'Wallpaper volume',\n wallpaperImport: 'Import',\n wallpaperImportHint: 'Copy this wallpaper into local storage, so it keeps working even if the Steam library moves or changes',\n wallpaperReimport: 'Update',\n wallpaperRemove: 'Remove',\n wallpaperUpdateAvailable: 'The workshop original changed since import — update the local copy',\n wallpaperEmpty: 'No wallpapers found. Add a folder of videos below, or subscribe in the Wallpaper Engine workshop on Windows.',\n wallpaperTypeVideo: 'Video',\n wallpaperTypeWeb: 'Web',\n wallpaperTypeScene: 'Scene (static)',\n wallpaperTypeApp: 'Unsupported',\n wallpaperLoadMore: 'Load more',\n wallpaperDirs: 'Manual folders',\n wallpaperDirsEmpty: 'No folders yet — add one to load its videos.',\n wallpaperDirsHint: 'On macOS: pick a folder of .mp4/.webm videos (or a wallpaper project folder). On Windows, folders extend the auto-detected Wallpaper Engine library.',\n wallpaperDirPlaceholder: '/path/to/wallpapers or ~/Movies/wallpapers',\n wallpaperDirAdd: 'Add',\n wallpaperDirBrowse: 'Browse…',\n wallpaperDirBrowseHint: 'Pick a folder with the system file manager (Finder / Explorer)',\n wallpaperDirBrowseFailed: 'Could not open the system folder picker — type the path manually instead',\n wallpaperDirBrowseTitle: 'Select a folder',\n wallpaperDirBrowseChoose: 'Use this folder',\n wallpaperDirBrowseEmpty: 'No subfolders',\n wallpaperDirBrowseHidden: 'Show hidden folders',\n wallpaperDirBrowseTruncated: 'Too many folders to list; only the beginning is shown.',\n wallpaperSaveFailed: 'Could not save wallpaper settings.',\n wallpaperRatingAll: 'All',\n wallpaperRatingG: 'G',\n wallpaperRatingPg13: 'PG-13',\n wallpaperRatingR18: 'R18',\n wallpaperPagePrev: 'Previous',\n wallpaperPageNext: 'Next',\n wallpaperPageJump: 'Go',\n wallpaperPageTotal: 'Page {page} / {total}',\n customThemeTitle: 'Custom theme',\n customThemeTagline: 'A separately saved palette derived from the official default theme.',\n customThemeEdit: 'Edit',\n customThemeCloseEdit: 'Collapse',\n customThemeMode: 'Editing mode',\n customThemeLight: 'Light',\n customThemeDark: 'Dark',\n customThemeAccent: 'Accent',\n customThemeBackground: 'Background',\n customThemeForeground: 'Foreground',\n customThemeContrast: 'Contrast',\n customThemeReset: 'Restore current mode default',\n customThemeResetHint: 'Only resets the selected light or dark profile.',\n customThemeSaveFailed: 'Could not save custom theme changes.',\n uninstall: 'Uninstall',\n uninstalling: 'Uninstalling…',\n uninstallConfirm: 'Are you sure you want to uninstall \"{name}\"? Local files will be deleted.',\n uninstallFailed: 'Uninstall failed',\n verifyIntegrity: 'Verify integrity',\n verifyingIntegrity: 'Verifying…',\n verifyAllPassed: 'All {count} installed skin(s) passed integrity verification',\n verifyFoundIssues: 'Found {count} skin(s) with integrity issues',\n integrityValid: 'Verified',\n integrityTampered: 'Modified',\n integrityMissing: 'Missing files',\n integrityHooksRefused: 'Hooks refused',\n cancel: 'Cancel',\n confirm: 'Confirm',\n verifyRepaired: 'Successfully repaired {count} skin(s) with integrity issues',\n verifyRepairFailed: 'Failed to repair {count} skin(s)',\n updateAll: 'Update all',\n updateAllChecking: 'Checking versions…',\n updateAllRunning: 'Updating {done}/{total}…',\n updateAllNone: 'All installed skins are up to date',\n updateAllDone: 'Updated {count} skin(s)',\n updateAllFailed: '{count} skin(s) failed to update',\n uninstallAll: 'Uninstall all',\n uninstallAllConfirm: 'Uninstall all {count} market-installed skin(s)? Their local files are deleted permanently and the GUI returns to the default look.',\n uninstallAllRunning: 'Uninstalling {done}/{total}…',\n uninstallAllDone: 'Uninstalled {count} skin(s)',\n uninstallAllFailed: '{count} skin(s) failed to uninstall',\n marketUnreachable: 'Could not reach the skin market to read versions',\n bulkNoUserSkins: 'No market-installed skins to act on',\n repair: 'Repair',\n repairing: 'Repairing…',\n repaired: 'Repaired',\n}\n\nexport const zh: Record<SkinCenterKey, string> = {\n title: '皮肤',\n cardDescription: '在 GUI 内即时试穿任意皮肤,退出即完全还原;应用一键完成并自动刷新。',\n externalWallpaperReadyTitle: '壁纸已由独立插件接管',\n externalWallpaperReadyBody: 'Wallpaper Engine 壁纸来自 {package} 插件,壁纸库、渲染与设置都归它管。它渲染壁纸时会接管背景,本卡片让皮肤叠在其之上:皮肤自身的背景图让路,输入卡磨砂也让给该插件的玻璃。',\n externalWallpaperMissingTitle: 'Wallpaper Engine 支持已独立成插件',\n externalWallpaperMissingBody: '本卡片不再自带 Wallpaper Engine 桥。要使用 Wallpaper Engine 壁纸,请用下面的命令安装 {package} 并重启 dsh;它自带壁纸库、渲染与玻璃的设置页。',\n externalWallpaperLink: '打开壁纸插件文档',\n externalWallpaperRecommended: '推荐',\n externalWallpaperInstall: '一键安装',\n externalWallpaperInstalling: '安装中…',\n externalWallpaperCopyCommand: '复制命令',\n externalWallpaperCopied: '已复制',\n externalWallpaperInstallFailed: '安装失败:{reason}',\n delegatedSkinBadge: '插件皮肤',\n delegatedSkinDescriptionClaudeStyle:\n '整副界面就是 Claude Code Desktop:暖米色画布、衬线正文、余烬橙强调色、输入框上沿的像素吉祥物,以及 Claude Code 那些对话区交互。它自带的设置页在别的皮肤在屏时照常可用。',\n delegatedSkinNotRunning: '插件已安装但当前页面没有运行。请在「插件」中启用它,然后刷新本页。',\n delegatedSkinNoHandoff: '当前运行的插件版本无法在皮肤之间让出页面,因此这里不能选用它。请更新 dsh-claude-style。',\n delegatedSkinInstall: '一键安装',\n delegatedSkinManage: '在插件页管理',\n delegatedSkinInstalling: '安装中…',\n delegatedSkinInstallFailed: '安装失败:{reason}',\n delegatedSkinDescriptorMismatch: '已安装的插件声明的皮肤 id 或属性与本卡片记录的不一致,请更新插件。',\n delegatedSkinLink: '打开插件文档',\n stoodDownTitle: '壁纸启用期间皮肤已暂停',\n stoodDownBody: '你选择的皮肤仍然保留,但在壁纸插件渲染壁纸期间不会绘制:两者的背景无法共存。在该插件里停止壁纸,皮肤会自动恢复。',\n enabled: '启用皮肤中心',\n enabledHint: '关闭后停用试穿、应用与背景控件,重新打开即恢复。',\n offNote: '皮肤中心已关闭。',\n intro: '任意皮肤可即时试穿,退出即完全还原;「应用」一键持久化,页面自动刷新生效。',\n official: '官方默认',\n officialTagline: '还原 DSH 官方默认外观,不应用任何皮肤。',\n active: '当前激活',\n tryingOn: '试穿中',\n tryOn: '试穿',\n loading: '加载中…',\n exitTryOn: '退出试穿',\n apply: '应用',\n applying: '应用中…',\n restore: '恢复默认',\n applyFailed: '应用失败',\n appliedUnconfirmed: '已写入配置但尚未确认生效——开发模式请刷新页面;打包版(DSH Desktop)需重启应用后生效',\n appliedNeedRestart: '已写入配置并确认生效,但宿主未热重载——请重启 dsh 后生效',\n theme: '主题预览',\n themeLight: '亮色',\n themeDark: '暗色',\n tryOnError: '试穿失败,详见控制台',\n backgroundOpacity: '背景遮挡',\n backgroundBlurEmpty: '空对话背景模糊',\n backgroundBlurContent: '有对话背景模糊',\n inputCardBlur: '输入卡模糊',\n inputCardBlurHint: '仅模糊输入卡背后的区域,不会让整张壁纸变糊。',\n bubbleOpacity: '气泡不透明度',\n bubbleOpacityHint: '调节支持气泡 alpha 的皮肤消息气泡,例如鲸鱼妈妈。',\n bubbleBlur: '气泡模糊程度',\n bubbleBlurHint: '模糊半透明消息气泡背后的区域,与「气泡不透明度」相互独立,0 为关闭。',\n backgroundBlurHint: '对话为空与有内容时分别应用不同的背景高斯模糊强度,0 为关闭。',\n backgroundBlurInert: '仅对带背景图插画的皮肤可见;官方默认无背景图。',\n backgroundHint: '即时为面板背后的背景加遮罩——数值越高越能弱化插画,帮你集中注意力。',\n backgroundHintInert: '仅对带背景图插画的皮肤(蓝色幻想 / 鲸吟)生效;官方默认无背景图,该滑块对这些皮肤自动生效。',\n wallpaperTitle: 'Wallpaper Engine',\n wallpaperEnable: '启用动态壁纸',\n wallpaperHint: '把本机 Wallpaper Engine 壁纸库用作 GUI 背景:视频、网页与场景壁纸均动态渲染(场景壁纸需要 WebGL)。macOS 没有 Wallpaper Engine 壁纸库,该功能默认关闭;开启后添加一个存放视频的目录即可。',\n wallpaperLoadError: '壁纸库加载失败',\n wallpaperLibraryFound: '已检测到 Wallpaper Engine 壁纸库',\n wallpaperLibraryManual: '来自你添加的目录',\n wallpaperRefresh: '刷新',\n wallpaperMode: '渲染模式',\n wallpaperModeLive: '动态',\n wallpaperModeFrame: '静态帧',\n wallpaperFit: '适应方式',\n wallpaperFitCover: '铺满裁剪',\n wallpaperFitContain: '完整缩放',\n wallpaperFitFill: '拉伸铺满',\n wallpaperClear: '关闭壁纸',\n wallpaperDim: '壁纸暗化',\n wallpaperOpacity: '壁纸不透明度',\n wallpaperBlur: '壁纸模糊',\n wallpaperPauseHidden: '窗口隐藏时暂停',\n wallpaperSound: '壁纸声音',\n wallpaperSoundHint: '播放视频壁纸的声音。浏览器可能在首次点击或按键前保持静音。',\n wallpaperVolume: '壁纸音量',\n wallpaperImport: '导入',\n wallpaperImportHint: '把该壁纸复制到本地存储,Steam 库迁移或变动后仍可继续使用',\n wallpaperReimport: '更新',\n wallpaperRemove: '移除',\n wallpaperUpdateAvailable: '工坊原件在导入后有更新——同步更新本地副本',\n wallpaperEmpty: '未发现壁纸。请在下方添加一个存放视频的目录;Windows 上也可先在 Wallpaper Engine 创意工坊订阅。',\n wallpaperTypeVideo: '视频',\n wallpaperTypeWeb: '网页',\n wallpaperTypeScene: '场景(静态)',\n wallpaperTypeApp: '不支持',\n wallpaperLoadMore: '加载更多',\n wallpaperDirs: '手动目录',\n wallpaperDirsEmpty: '还没有目录——添加一个以加载其中的视频。',\n wallpaperDirsHint: 'macOS:选择一个存放 .mp4/.webm 视频的目录(或单个壁纸项目文件夹)。Windows:这里添加的目录会扩展自动检测到的 Wallpaper Engine 壁纸库。',\n wallpaperDirPlaceholder: '/path/to/wallpapers 或 ~/Movies/wallpapers',\n wallpaperDirAdd: '添加',\n wallpaperDirBrowse: '浏览…',\n wallpaperDirBrowseHint: '通过系统文件管理器(访达 / 资源管理器)选择文件夹',\n wallpaperDirBrowseFailed: '无法打开系统目录选择框——请手动输入路径',\n wallpaperDirBrowseTitle: '选择文件夹',\n wallpaperDirBrowseChoose: '使用此目录',\n wallpaperDirBrowseEmpty: '没有子目录',\n wallpaperDirBrowseHidden: '显示隐藏目录',\n wallpaperDirBrowseTruncated: '目录过多,仅显示开头部分。',\n wallpaperSaveFailed: '壁纸设置保存失败。',\n wallpaperRatingAll: '全部',\n wallpaperRatingG: 'G',\n wallpaperRatingPg13: 'PG-13',\n wallpaperRatingR18: 'R18',\n wallpaperPagePrev: '上一页',\n wallpaperPageNext: '下一页',\n wallpaperPageJump: '跳转',\n wallpaperPageTotal: '第 {page} / {total} 页',\n customThemeTitle: '自定义主题',\n customThemeTagline: '基于官方默认主题生成并独立保存的配色方案。',\n customThemeEdit: '编辑',\n customThemeCloseEdit: '收起',\n customThemeMode: '编辑模式',\n customThemeLight: '浅色',\n customThemeDark: '深色',\n customThemeAccent: '强调色',\n customThemeBackground: '背景色',\n customThemeForeground: '前景色',\n customThemeContrast: '对比度',\n customThemeReset: '恢复当前模式默认',\n customThemeResetHint: '只重置当前选择的浅色或深色配置。',\n customThemeSaveFailed: '自定义主题修改保存失败。',\n uninstall: '卸载',\n uninstalling: '卸载中…',\n uninstallConfirm: '确定要卸载皮肤「{name}」吗?本地文件将被永久删除。',\n uninstallFailed: '卸载失败',\n verifyIntegrity: '验证完整性',\n verifyingIntegrity: '正在验证…',\n verifyAllPassed: '所有 {count} 款已安装皮肤完整性正常',\n verifyFoundIssues: '发现 {count} 款皮肤存在完整性异常',\n verifyRepaired: '已自动修复 {count} 款皮肤的完整性异常',\n verifyRepairFailed: '{count} 款皮肤自动修复失败',\n updateAll: '全部更新',\n updateAllChecking: '正在检查版本…',\n updateAllRunning: '正在更新 {done}/{total}…',\n updateAllNone: '所有已安装皮肤均为最新版本',\n updateAllDone: '已更新 {count} 款皮肤',\n updateAllFailed: '{count} 款皮肤更新失败',\n uninstallAll: '全部卸载',\n uninstallAllConfirm: '确定要卸载全部 {count} 款市场安装的皮肤吗?本地文件将被永久删除,界面回到默认外观。',\n uninstallAllRunning: '正在卸载 {done}/{total}…',\n uninstallAllDone: '已卸载 {count} 款皮肤',\n uninstallAllFailed: '{count} 款皮肤卸载失败',\n marketUnreachable: '无法连接皮肤市场以读取版本',\n bulkNoUserSkins: '没有可操作的市场安装皮肤',\n repair: '修复',\n repairing: '修复中…',\n repaired: '已修复',\n integrityValid: '完整',\n integrityTampered: '文件已修改',\n integrityMissing: '缺少文件',\n integrityHooksRefused: 'Hooks 已拒绝',\n cancel: '取消',\n confirm: '确定',\n}\n","/**\n * Serializes skin and theme previews into one preview session (issue #39\n * migration round: the wallpaper dimension left with the built-in Wallpaper\n * Engine bridge, so this coordinator no longer arbitrates it).\n *\n * A transition in one dimension fully retires the other dimension's preview\n * before it starts, so async skin switches cannot race theme publishes.\n */\nexport interface PreviewSkinController {\n getState(): { previewing: boolean }\n exitTryOn(): Promise<string | null>\n}\n\nexport interface PreviewCustomThemeController {\n getState(): { previewing: boolean }\n exitTryOn(): void\n suspend(): void\n resume(): void\n}\n\nexport class PreviewCoordinator {\n private tail: Promise<void> = Promise.resolve()\n\n constructor(\n private readonly skin: PreviewSkinController,\n private readonly customTheme?: PreviewCustomThemeController,\n ) {}\n\n runSkin<T>(action: () => Promise<T>): Promise<T> {\n return this.enqueue(async () => {\n if (this.customTheme?.getState().previewing === true) this.customTheme.exitTryOn()\n this.customTheme?.suspend()\n try {\n return await action()\n } finally {\n if (!this.skin.getState().previewing) this.customTheme?.resume()\n }\n })\n }\n\n runCustomTheme<T>(action: () => Promise<T>): Promise<T> {\n return this.enqueue(async () => {\n const continuingCustomPreview = this.customTheme?.getState().previewing === true\n if (!continuingCustomPreview && this.skin.getState().previewing) await this.skin.exitTryOn()\n this.customTheme?.resume()\n return await action()\n })\n }\n\n private enqueue<T>(action: () => Promise<T>): Promise<T> {\n const run = this.tail.then(action, action)\n this.tail = run.then(() => undefined, () => undefined)\n return run\n }\n}\n","/** Versioned user theme derived from the official stock theme. */\n\nexport const SKIN_CUSTOM_THEME_NS = 'skin-custom-theme'\nexport const CUSTOM_THEME_VERSION = 1 as const\n\nexport interface CustomThemeProfile {\n accent: string\n background: string\n foreground: string\n contrast: number\n}\n\nexport interface CustomThemeConfig {\n version: number\n applied: boolean\n light: CustomThemeProfile\n dark: CustomThemeProfile\n}\n\nexport const CUSTOM_THEME_DEFAULTS: Readonly<CustomThemeConfig> = {\n version: CUSTOM_THEME_VERSION,\n applied: false,\n light: {\n accent: '#4d6bfe',\n background: '#f7f8fa',\n foreground: '#262626',\n contrast: 50,\n },\n dark: {\n accent: '#7c91ff',\n background: '#171719',\n foreground: '#f3f3f3',\n contrast: 50,\n },\n}\n\n/** The complete token surface this feature may emit. */\nexport const CUSTOM_THEME_ALLOWED_TOKENS = [\n '--dsw-alias-bg-base',\n '--dsw-alias-bg-layer-1',\n '--dsw-alias-bg-layer-2',\n '--dsw-alias-bg-layer-3',\n '--dsw-alias-bg-multi-select',\n '--dsw-alias-bg-overlay',\n '--dsw-alias-bg-skeleton',\n '--dsw-alias-border-l1',\n '--dsw-alias-border-l2',\n '--dsw-alias-border-l3',\n '--dsw-alias-border-l4',\n '--dsw-alias-brand-primary',\n '--dsw-alias-brand-primary-invert',\n '--dsw-alias-brand-text',\n '--dsw-alias-button-primary-dimmed',\n '--dsw-alias-button-primary-fill',\n '--dsw-alias-button-primary-hover',\n '--dsw-alias-interactive-bg-active',\n '--dsw-alias-interactive-bg-hover',\n '--dsw-alias-interactive-bg-hover-accent',\n '--dsw-alias-label-dimmed',\n '--dsw-alias-label-primary',\n '--dsw-alias-label-primary-foreground',\n '--dsw-alias-label-secondary',\n '--dsw-alias-label-tertiary',\n '--dsw-alias-markdown-code-block',\n '--dsw-alias-markdown-code-block-banner',\n '--dsw-alias-markdown-inline-code',\n '--dsw-alias-scrollbar-bg-l1',\n '--dsw-alias-scrollbar-hover-l1',\n '--dsw-alias-toast-bg',\n '--dsw-alias-tooltip-bg',\n '--dsw-specific-bubble',\n '--dsw-specific-bubble-highlight',\n '--dsw-specific-input-major',\n '--dsw-specific-menu',\n '--dsw-specific-selector',\n '--dsw-specific-sidebar-fill',\n '--dsw-specific-sidebar-nav-item-active',\n '--dsw-specific-sidebar-nav-item-active-accent',\n '--dsw-specific-sidebar-nav-item-hover',\n] as const\n\ntype UnknownRecord = Record<string, unknown>\n\nfunction record(value: unknown): UnknownRecord {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? value as UnknownRecord\n : {}\n}\n\nfunction color(value: unknown, fallback: string): string {\n return typeof value === 'string' && /^#[0-9a-f]{6}$/i.test(value)\n ? value.toLowerCase()\n : fallback\n}\n\nfunction contrast(value: unknown, fallback: number): number {\n if (typeof value !== 'number' || !Number.isFinite(value)) return fallback\n return Math.max(0, Math.min(100, Math.round(value)))\n}\n\nfunction normalizeProfile(value: unknown, fallback: Readonly<CustomThemeProfile>): CustomThemeProfile {\n const source = record(value)\n return {\n accent: color(source.accent, fallback.accent),\n background: color(source.background, fallback.background),\n foreground: color(source.foreground, fallback.foreground),\n contrast: contrast(source.contrast, fallback.contrast),\n }\n}\n\n/** Normalize untrusted settings data into the current contract version. */\nexport function normalizeCustomThemeConfig(value: unknown): CustomThemeConfig {\n const source = record(value)\n if (source.version !== undefined && source.version !== CUSTOM_THEME_VERSION) {\n return {\n version: CUSTOM_THEME_VERSION,\n applied: false,\n light: { ...CUSTOM_THEME_DEFAULTS.light },\n dark: { ...CUSTOM_THEME_DEFAULTS.dark },\n }\n }\n return {\n version: CUSTOM_THEME_VERSION,\n applied: source.applied === true,\n light: normalizeProfile(source.light, CUSTOM_THEME_DEFAULTS.light),\n dark: normalizeProfile(source.dark, CUSTOM_THEME_DEFAULTS.dark),\n }\n}\n\nfunction mix(a: string, aPercent: number, b: string): string {\n return `color-mix(in srgb, ${a} ${aPercent}%, ${b})`\n}\n\nfunction declarations(profile: CustomThemeProfile): Array<[typeof CUSTOM_THEME_ALLOWED_TOKENS[number], string]> {\n const { accent, background, foreground } = profile\n const depth1 = 2 + Math.round(profile.contrast * 0.12)\n const depth2 = depth1 + 4\n const depth3 = depth2 + 4\n const border = 12 + Math.round(profile.contrast * 0.18)\n const mutedText = 60 + Math.round(profile.contrast * 0.2)\n return [\n ['--dsw-alias-bg-base', background],\n ['--dsw-alias-bg-layer-1', mix(background, 100 - depth1, foreground)],\n ['--dsw-alias-bg-layer-2', mix(background, 100 - depth2, foreground)],\n ['--dsw-alias-bg-layer-3', mix(background, 100 - depth3, foreground)],\n ['--dsw-alias-bg-multi-select', mix(background, 84, accent)],\n ['--dsw-alias-bg-overlay', mix(background, 90 - Math.round(profile.contrast * 0.08), foreground)],\n ['--dsw-alias-bg-skeleton', mix(background, 82, foreground)],\n ['--dsw-alias-border-l1', mix(background, 100 - border, foreground)],\n ['--dsw-alias-border-l2', mix(background, 100 - Math.max(8, border - 5), foreground)],\n ['--dsw-alias-border-l3', mix(background, 100 - Math.max(5, border - 9), foreground)],\n ['--dsw-alias-border-l4', mix(background, 96, foreground)],\n ['--dsw-alias-brand-primary', accent],\n ['--dsw-alias-brand-primary-invert', background],\n ['--dsw-alias-brand-text', accent],\n ['--dsw-alias-button-primary-dimmed', mix(accent, 48, background)],\n ['--dsw-alias-button-primary-fill', accent],\n ['--dsw-alias-button-primary-hover', mix(accent, 82, foreground)],\n ['--dsw-alias-interactive-bg-active', mix(background, 78, accent)],\n ['--dsw-alias-interactive-bg-hover', mix(background, 100 - depth2, foreground)],\n ['--dsw-alias-interactive-bg-hover-accent', mix(background, 84, accent)],\n ['--dsw-alias-label-dimmed', mix(foreground, 42, background)],\n ['--dsw-alias-label-primary', foreground],\n ['--dsw-alias-label-primary-foreground', foreground],\n ['--dsw-alias-label-secondary', mix(foreground, mutedText, background)],\n ['--dsw-alias-label-tertiary', mix(foreground, Math.max(45, mutedText - 18), background)],\n ['--dsw-alias-markdown-code-block', mix(background, 100 - depth2, foreground)],\n ['--dsw-alias-markdown-code-block-banner', mix(background, 100 - depth3, foreground)],\n ['--dsw-alias-markdown-inline-code', mix(background, 86, accent)],\n ['--dsw-alias-scrollbar-bg-l1', mix(background, 94, foreground)],\n ['--dsw-alias-scrollbar-hover-l1', mix(background, 76, foreground)],\n ['--dsw-alias-toast-bg', mix(background, 100 - depth3, foreground)],\n ['--dsw-alias-tooltip-bg', mix(background, 28, foreground)],\n ['--dsw-specific-bubble', mix(background, 92, accent)],\n ['--dsw-specific-bubble-highlight', mix(background, 82, accent)],\n ['--dsw-specific-input-major', mix(background, 100 - depth1, foreground)],\n ['--dsw-specific-menu', mix(background, 100 - depth1, foreground)],\n ['--dsw-specific-selector', mix(background, 100 - depth2, foreground)],\n ['--dsw-specific-sidebar-fill', mix(background, 100 - depth1, foreground)],\n ['--dsw-specific-sidebar-nav-item-active', mix(background, 86, accent)],\n ['--dsw-specific-sidebar-nav-item-active-accent', accent],\n ['--dsw-specific-sidebar-nav-item-hover', mix(background, 100 - depth2, foreground)],\n ]\n}\n\nfunction block(selector: string, profile: CustomThemeProfile): string {\n const body = declarations(profile).map(([name, value]) => ` ${name}: ${value};`).join('\\n')\n return `${selector} {\\n${body}\\n}`\n}\n\n/** Build stock-only CSS from normalized, fixed token declarations. */\nexport function buildCustomThemeCss(value: unknown): string {\n const config = normalizeCustomThemeConfig(value)\n return [\n block('html[data-dsh-custom-theme]:not([data-dsh-skin]) body', config.light),\n block('html[data-dsh-custom-theme]:not([data-dsh-skin]) body[data-ds-dark-theme]', config.dark),\n ].join('\\n\\n')\n}\n","import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client'\n\nimport {\n CUSTOM_THEME_DEFAULTS,\n SKIN_CUSTOM_THEME_NS,\n buildCustomThemeCss,\n normalizeCustomThemeConfig,\n type CustomThemeConfig,\n type CustomThemeProfile,\n} from '../core/custom-theme.ts'\n\nexport type CustomThemeScheme = 'light' | 'dark'\n\nexport interface CustomThemeState {\n applied: boolean\n previewing: boolean\n visible: boolean\n writeError: string | null\n}\n\nexport interface CustomThemeControllerOptions {\n doc?: Document\n}\n\ntype CustomThemeField = keyof CustomThemeConfig & string\n\ninterface PendingWrite {\n field: CustomThemeField\n value: CustomThemeConfig[CustomThemeField]\n resolve(): void\n reject(error: unknown): void\n}\n\n/** Owns the custom-theme configuration section and its inert-by-default style. */\nexport class CustomThemeController {\n private readonly scope: ConfigForm<CustomThemeConfig>\n private readonly doc: Document\n private readonly style: HTMLStyleElement\n private readonly unsubscribe: () => void\n private readonly listeners = new Set<() => void>()\n private config: CustomThemeConfig\n private previewingValue = false\n private suspended = false\n private state: CustomThemeState\n private disposed = false\n private readonly writeQueue: PendingWrite[] = []\n private pendingWrites = 0\n private drainingWrites = false\n\n constructor(scope: ConfigForm<CustomThemeConfig>, options: CustomThemeControllerOptions = {}) {\n this.scope = scope\n this.doc = options.doc ?? document\n this.config = normalizeCustomThemeConfig(scope.getSnapshot().value)\n this.style = this.doc.createElement('style')\n this.style.dataset.dshCustomThemeStyle = ''\n this.doc.head.appendChild(this.style)\n this.state = { applied: this.config.applied, previewing: false, visible: false, writeError: null }\n this.syncDom()\n this.unsubscribe = scope.subscribe(() => {\n if (this.disposed || this.pendingWrites > 0) return\n this.syncFromScope()\n })\n }\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n }\n\n getState = (): CustomThemeState => this.state\n\n profile(scheme: CustomThemeScheme): CustomThemeProfile {\n return { ...this.config[scheme] }\n }\n\n setProfileValue(\n scheme: CustomThemeScheme,\n key: keyof CustomThemeProfile,\n value: string | number,\n ): void {\n const next = normalizeCustomThemeConfig({\n ...this.config,\n [scheme]: { ...this.config[scheme], [key]: value },\n })\n this.config = next\n this.clearWriteError()\n this.syncDom()\n this.publish()\n void this.queueWrite(scheme, { ...next[scheme] }).catch(error => { this.setWriteError(error) })\n }\n\n reset(scheme: CustomThemeScheme): void {\n const profile = { ...CUSTOM_THEME_DEFAULTS[scheme] }\n this.config = { ...this.config, [scheme]: profile }\n this.clearWriteError()\n this.syncDom()\n this.publish()\n void this.queueWrite(scheme, profile).catch(error => { this.setWriteError(error) })\n }\n\n tryOn(): void {\n this.previewingValue = true\n this.suspended = false\n this.syncDom()\n this.publish()\n }\n\n exitTryOn(): void {\n this.previewingValue = false\n this.suspended = false\n this.syncDom()\n this.publish()\n }\n\n async apply(): Promise<void> {\n this.config = { ...this.config, applied: true }\n this.previewingValue = false\n this.suspended = false\n this.syncDom()\n this.publish()\n await this.queueWrite('applied', true)\n if (!this.config.applied) throw new Error('custom theme activation was not persisted')\n }\n\n async deactivate(): Promise<void> {\n if (!this.config.applied) {\n this.previewingValue = false\n this.suspended = false\n this.syncDom()\n this.publish()\n return\n }\n this.config = { ...this.config, applied: false }\n this.previewingValue = false\n this.suspended = false\n this.syncDom()\n this.publish()\n if (this.scope.getSnapshot().status === 'unavailable') return\n await this.queueWrite('applied', false)\n if (this.config.applied) throw new Error('custom theme deactivation was not persisted')\n }\n\n suspend(): void {\n if (this.suspended) return\n this.suspended = true\n this.syncDom()\n this.publish()\n }\n\n resume(): void {\n if (!this.suspended) return\n this.suspended = false\n this.syncDom()\n this.publish()\n }\n\n dispose(): void {\n if (this.disposed) return\n this.disposed = true\n this.unsubscribe()\n this.listeners.clear()\n this.style.remove()\n this.doc.documentElement.removeAttribute('data-dsh-custom-theme')\n }\n\n private syncDom(): void {\n this.style.textContent = buildCustomThemeCss(this.config)\n const visible = (this.config.applied || this.previewingValue) && !this.suspended\n if (visible) this.doc.documentElement.setAttribute('data-dsh-custom-theme', 'true')\n else this.doc.documentElement.removeAttribute('data-dsh-custom-theme')\n this.state = {\n applied: this.config.applied,\n previewing: this.previewingValue,\n visible,\n writeError: this.state.writeError,\n }\n }\n\n private publish(): void {\n for (const listener of this.listeners) listener()\n }\n\n private syncFromScope(): void {\n this.config = normalizeCustomThemeConfig(this.scope.getSnapshot().value)\n this.syncDom()\n this.publish()\n }\n\n private clearWriteError(): void {\n if (this.state.writeError === null) return\n this.state = { ...this.state, writeError: null }\n }\n\n private setWriteError(error: unknown): void {\n this.state = {\n ...this.state,\n writeError: error instanceof Error ? error.message : String(error),\n }\n this.publish()\n }\n\n /**\n * Identity of the settings section a refused write addressed, for the error a\n * user sees. It carries the Host's own status and revision — which entry\n * answered, whether it can be written, and at which revision — and never any\n * stored configuration value, so a refused save can be diagnosed from the\n * message alone without exposing what the user configured.\n * @returns a short diagnostic fragment naming the section and its state.\n */\n private sectionState(): string {\n const snapshot = this.scope.getSnapshot()\n const revision = snapshot.revision === undefined ? 'none' : String(snapshot.revision)\n return `${SKIN_CUSTOM_THEME_NS}: status ${snapshot.status}, writable ${String(snapshot.writable)}, revision ${revision}`\n }\n\n private queueWrite<K extends CustomThemeField>(field: K, value: CustomThemeConfig[K]): Promise<void> {\n this.pendingWrites += 1\n const pending = new Promise<void>((resolve, reject) => {\n this.writeQueue.push({\n field,\n value,\n resolve,\n reject,\n } as PendingWrite)\n })\n void this.drainWrites()\n return pending\n }\n\n private async drainWrites(): Promise<void> {\n if (this.drainingWrites) return\n this.drainingWrites = true\n const settled: Array<\n { write: PendingWrite; ok: true }\n | { write: PendingWrite; ok: false; error: unknown }\n > = []\n while (this.writeQueue.length > 0) {\n const write = this.writeQueue.shift()\n if (write === undefined) break\n try {\n // The form contract answers `false` for a write the Host refused or\n // skipped, and rejects when the transport itself failed; both leave\n // the stored profile unchanged, so neither may count as saved.\n const accepted = await this.scope.set(write.field, write.value)\n if (!accepted) throw new Error(`the Host did not accept the custom theme setting (${this.sectionState()})`)\n } catch (error) {\n settled.push({ write, ok: false, error })\n continue\n } finally {\n this.pendingWrites -= 1\n }\n settled.push({ write, ok: true })\n }\n this.drainingWrites = false\n if (!this.disposed) this.syncFromScope()\n const failure = settled.find(result => !result.ok)\n if (!this.disposed && failure !== undefined && !failure.ok) {\n this.setWriteError(failure.error)\n }\n for (const result of settled) {\n if (result.ok) result.write.resolve()\n else result.write.reject(result.error)\n }\n }\n}\n","/**\n * One preference family as a section of this plugin's own configuration form.\n *\n * 0.1.7 addresses configuration as ONE form per profile entry\n * (`ctx.configForms.get(entryId)`) and serves a plugin's own `Config` schema\n * as its settings page; the previous cohort's per-namespace settings scopes\n * are gone. The skin center's three preference families are sections of that\n * one Config, so this wrapper projects the entry form onto one section: the\n * controllers keep addressing their own fields, and every write is queued on\n * the shared form as a path-addressed mutation.\n *\n * The projected fields are declared volatile in the Host schema, which is\n * what makes the Host accept the write, apply it live, and never remount the\n * row (see `Config` in src/index.ts).\n */\n\nimport type { ConfigForm, ConfigFormSnapshot } from '@deepseek-ai/dsh-client-ui-settings/client'\nimport type { SettingsPathOpView } from '@deepseek-ai/dsh-api-remotes/client'\n\n/** The JSON value one wire field write admits. */\ntype WireValue = Extract<SettingsPathOpView, { op: 'set' }>['value']\n\n/** Read one object-shaped layer of a form snapshot. */\nfunction layerOf(layer: unknown, key: string): unknown {\n return typeof layer === 'object' && layer !== null ? (layer as Record<string, unknown>)[key] : undefined\n}\n\n/**\n * Project one entry form onto the section behind `key`.\n * @param parent - the form of the profile entry that owns this section.\n * @param key - the section key inside the entry's Config.\n * @returns the section's form: its own value/user/base layers, and writes\n * addressed at `[key, field]` on the parent.\n */\nexport function settingsSection<T>(parent: ConfigForm<unknown>, key: string): ConfigForm<T> {\n let source: ConfigFormSnapshot<unknown> | undefined\n let projected: ConfigFormSnapshot<T> | undefined\n // The form contract promises a stable snapshot reference until the next\n // change; the parent's snapshot is that signal, so a projection of the same\n // parent snapshot is reused instead of rebuilt on every read.\n const project = (): ConfigFormSnapshot<T> => {\n const snapshot = parent.getSnapshot()\n if (projected !== undefined && source === snapshot) return projected\n source = snapshot\n projected = {\n status: snapshot.status,\n value: layerOf(snapshot.value, key) as T | undefined,\n base: layerOf(snapshot.base, key),\n user: layerOf(snapshot.user, key),\n revision: snapshot.revision,\n writable: snapshot.writable,\n }\n return projected\n }\n return {\n getSnapshot: project,\n subscribe: listener => parent.subscribe(listener),\n set: (field, value) => parent.mutate([{ op: 'set', path: [key, field], value: value as WireValue }]),\n unset: field => parent.mutate([{ op: 'unset', path: [key, field] }]),\n mutate: (ops, expectedRevision) => parent.mutate(ops.map(op => 'value' in op\n ? { op: 'set', path: [key, ...op.path], value: op.value }\n : { op: 'unset', path: [key, ...op.path] }), expectedRevision),\n }\n}\n","/**\n * Which profile entry row the skin center's settings form is bound to.\n *\n * 0.1.7 addresses configuration as one form per profile entry id, and this\n * package can be installed under two different rows: the family aggregate's\n * generated `web-ui-skin-center` row, or its own standalone bundle row\n * `ui-skin-center` (cordis.patch.yml, and the `name` the plugin exports).\n * `ctx.configForms` carries no package identity, so the only authority on which\n * row is live is the served-namespace list in the shared describe mirror.\n *\n * Issue #1769 / dsh-skins#17:\n * Under an aggregate install (@linxin666/dsh-web-all), freezing an entry id\n * before the describe mirror answers resulted in binding to 'ui-skin-center',\n * which does not exist in an aggregate profile. The Host answers\n * 'No configurable plugin entry \"ui-skin-center\"' and settings mutations fail.\n *\n * Deferred binding avoids guessing a row while the mirror is unready: the form\n * reports 'unavailable' and prevents writes until the mirror answers, and then\n * binds the row the Host actually serves.\n *\n * @module @linxin666/dsh-client-ui-skin-center/settings-entry-id\n */\nimport type { ConfigForm, ConfigFormSnapshot, ConfigForms } from '@deepseek-ai/dsh-client-ui-settings/client'\n\n/** Profile entry id the family aggregate's generated row carries. */\nconst AGGREGATE_ENTRY_ID = 'web-ui-skin-center'\n\n/**\n * This package's own declared plugin name, which is also the entry id its\n * standalone bundle patch row carries (cordis.patch.yml) and the `name` the\n * plugin exports (src/index.ts).\n */\nconst OWN_ENTRY_ID = 'ui-skin-center'\n\n/**\n * Profile entry ids this package's rows can be served under: its own standalone\n * row, the family aggregate's generated row, and the legacy background\n * namespace a profile that named the row after it still serves. The served\n * mirror decides which one is real; this list only ranks the candidates.\n */\nconst SKIN_CENTER_ENTRY_IDS: readonly string[] = [OWN_ENTRY_ID, AGGREGATE_ENTRY_ID, 'skin-background']\n\n/**\n * The entry id of the first skin-center row the Host says it serves, or `null`\n * when the mirror cannot say. `null` means \"unknown\", never \"none\": the mirror\n * is asynchronous, so an unreadable snapshot is a pre-boot window, not proof\n * that this package is absent.\n * @param forms - the shared configuration forms service.\n * @param candidates - entry ids to look for, in preference order.\n * @returns the served entry id, or `null` when the mirror cannot answer.\n */\nexport function servedEntryId(forms: ConfigForms, candidates: readonly string[] = SKIN_CENTER_ENTRY_IDS): string | null {\n let served: readonly string[] | undefined\n try {\n served = forms.describe().getSnapshot().view?.namespaces.map(view => view.ns)\n } catch {\n served = undefined\n }\n if (served === undefined) return null\n return candidates.find(id => served.includes(id)) ?? null\n}\n\n/**\n * The entry id to bind, which is this package's OWN row whenever the mirror\n * cannot name a skin-center row.\n *\n * @deprecated Prefer {@link boundConfigForm} which performs deferred binding\n * and avoids guessing rows that do not exist under aggregate installs.\n * @param forms - the shared configuration forms service.\n * @returns the entry id whose form the plugin should address.\n */\nexport function boundEntryId(forms: ConfigForms): string {\n return servedEntryId(forms) ?? OWN_ENTRY_ID\n}\n\n/**\n * Snapshot for a form whose entry is unserved or whose describe mirror has\n * not yet answered.\n */\nfunction unavailableSnapshot<T>(): ConfigFormSnapshot<T> {\n return {\n status: 'unavailable',\n value: undefined,\n base: undefined,\n user: undefined,\n revision: undefined,\n writable: false,\n }\n}\n\n/**\n * A deferred ConfigForm that binds the row actually served once the describe\n * mirror answers, and degrades to 'unavailable' without issuing silent writes to\n * guessed entry ids while the mirror is unready or absent.\n *\n * @param forms - the shared configuration forms service.\n * @param candidates - candidate entry ids in preference order.\n * @returns a ConfigForm delegating to the resolved entry's form.\n */\nexport function boundConfigForm<T>(\n forms: ConfigForms,\n candidates: readonly string[] = SKIN_CENTER_ENTRY_IDS,\n): ConfigForm<T> {\n const listeners = new Set<() => void>()\n let bound: ConfigForm<T> | undefined\n let boundId: string | undefined\n let offBound: (() => void) | undefined\n let subscribedToMirror = false\n // Re-entrancy guard: getSnapshot() lazily binds, bind() publishes, and a\n // listener that reads the form while the mirror is still unanswered would\n // otherwise re-enter bind() -> publish() -> getSnapshot() until the stack\n // overflows (the apply then throws and the whole web boot fails).\n let binding = false\n\n const resolve = (): string | null => {\n return servedEntryId(forms, candidates)\n }\n\n const publish = (): void => {\n for (const listener of [...listeners]) {\n listener()\n }\n }\n\n const bind = (): void => {\n if (binding) return\n binding = true\n try {\n ensureMirrorSubscription()\n const target = resolve()\n if (target === boundId) return\n offBound?.()\n offBound = undefined\n if (target === null) {\n // Unbinding is a change only when something was bound; an unanswered\n // mirror leaving the form unbound must not publish (the publish would\n // re-enter this bind through any listener reading the form).\n const hadBinding = bound !== undefined\n boundId = undefined\n bound = undefined\n if (hadBinding) publish()\n return\n }\n let form: ConfigForm<T>\n try {\n form = forms.get<T>(target)\n } catch {\n const hadBinding = bound !== undefined\n boundId = undefined\n bound = undefined\n if (hadBinding) publish()\n return\n }\n boundId = target\n bound = form\n offBound = form.subscribe(() => { publish() })\n publish()\n } finally {\n binding = false\n }\n }\n\n const ensureMirrorSubscription = (): void => {\n if (subscribedToMirror) return\n try {\n const describeFace = forms.describe()\n if (typeof describeFace?.subscribe === 'function') {\n describeFace.subscribe(() => { bind() })\n subscribedToMirror = true\n }\n if (typeof describeFace?.ensure === 'function') {\n void describeFace.ensure()\n }\n } catch {\n // Mirror not ready or does not support subscribe\n }\n }\n\n bind()\n\n return {\n getSnapshot: () => {\n if (bound === undefined) {\n bind()\n }\n return bound?.getSnapshot() ?? unavailableSnapshot<T>()\n },\n subscribe: (listener) => {\n ensureMirrorSubscription()\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n set: (field, value) => {\n if (bound === undefined) {\n bind()\n }\n return bound?.set(field, value) ?? Promise.resolve(false)\n },\n unset: (field) => {\n if (bound === undefined) {\n bind()\n }\n return bound?.unset(field) ?? Promise.resolve(false)\n },\n mutate: (ops, expectedRevision) => {\n if (bound === undefined) {\n bind()\n }\n return bound?.mutate(ops, expectedRevision) ?? Promise.resolve(false)\n },\n }\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/telemetry.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Anonymous install telemetry shared by the DSH Web UI family plugins.\n *\n * Once per UTC day per browser, each wired plugin sends one heartbeat to\n * the dsh-market edge API listing its package name (and version when known).\n * The payload carries no conversation data and no identifiers beyond a random\n * UUID generated in localStorage; the server hashes it with a deployment salt\n * before storage and never persists IP addresses. Sends are fire-and-forget:\n * failures stay silent and simply retry on a later mount or day. The system\n * is documented in docs/telemetry.md.\n */\n\nexport type TelemetryChannel = 'market' | 'npm' | 'unknown'\n\nexport interface TelemetryItem {\n /** npm package name or asset id, e.g. \"@linxin666/dsh-pet\" or \"skin:harbor\". */\n name: string\n /** Installed version when known; omitted otherwise. */\n version?: string\n /** Install channel when determinable (market = Workshop install). */\n channel?: TelemetryChannel\n}\n\nconst VISITOR_KEY = 'dsh-web-ui-telemetry-visitor'\nconst DAY_KEY_PREFIX = 'dsh-web-ui-telemetry-day:'\nconst ENDPOINT = 'https://dsh-market.com/api/telemetry/event'\n\n// Baked into each client bundle by shared/tsdown.client.ts (the package's own\n// package.json version at build time). Undefined in dev/test builds.\ndeclare const __DSH_PKG_VERSION__: string | undefined\n\n/** The building package's version, when the bundle carries it. */\nfunction bakedVersion(): string | undefined {\n try {\n return typeof __DSH_PKG_VERSION__ === 'string' && __DSH_PKG_VERSION__ !== ''\n ? __DSH_PKG_VERSION__\n : undefined\n } catch {\n return undefined\n }\n}\n\n/** Read or lazily create the anonymous visitor id; null when storage is unavailable. */\nfunction visitorId(): string | null {\n try {\n const existing = localStorage.getItem(VISITOR_KEY)\n if (existing && /^[A-Za-z0-9_-]{16,64}$/.test(existing)) return existing\n const fresh = crypto.randomUUID().replaceAll('-', '')\n localStorage.setItem(VISITOR_KEY, fresh)\n return fresh\n } catch {\n // Storage unavailable (privacy mode, sandboxed frame): report nothing.\n return null\n }\n}\n\n/** Drop stale per-day dedup keys so localStorage does not grow forever. */\nfunction pruneDayKeys(today: string): void {\n try {\n for (let index = localStorage.length - 1; index >= 0; index -= 1) {\n const key = localStorage.key(index)\n if (key !== null && key.startsWith(DAY_KEY_PREFIX) && key !== DAY_KEY_PREFIX + today) {\n localStorage.removeItem(key)\n }\n }\n } catch { /* best effort */ }\n}\n\n/**\n * Fire the daily heartbeat for the given items at most once per UTC day per\n * browser. Never throws and never blocks the caller. Items without an explicit\n * version inherit the bundle's baked build version.\n */\nexport function reportDailyHeartbeat(items: readonly TelemetryItem[]): void {\n try {\n if (items.length === 0) return\n const today = new Date().toISOString().slice(0, 10)\n // Automation contexts (CDP-driven QA browsers, fresh isolated profiles)\n // mint a new visitor id per run and would inflate instance counts.\n if (navigator.webdriver) return\n if (localStorage.getItem(DAY_KEY_PREFIX + today) !== null) return\n const visitor = visitorId()\n if (visitor === null) return\n pruneDayKeys(today)\n const payloadItems = items.map((item) => {\n const out: Record<string, string> = { name: item.name }\n const version = item.version ?? bakedVersion()\n if (version !== undefined) out.version = version\n if (item.channel !== undefined) out.channel = item.channel\n return out\n })\n const body = JSON.stringify({ kind: 'heartbeat', visitor, items: payloadItems })\n void fetch(ENDPOINT, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body,\n keepalive: true,\n }).then((response) => {\n // Mark the day only after an accepted send, so offline browsers retry\n // on a later mount instead of going dark until tomorrow.\n if (response.ok) localStorage.setItem(DAY_KEY_PREFIX + today, '1')\n }).catch(() => { /* unreachable endpoint: stay silent */ })\n } catch { /* never break the host UI over telemetry */ }\n}\n","/**\n * In-GUI skin center, browser half: registers the Skin Center as a first-level\n * settings section (`settings.section`) and boots the v2 skin runtime\n * (effect ledger + atomic switch controller + semantic adapter + catalog\n * store). The section lists the installed skins (shipped built-ins +\n * $DSH_HOME/skins), tries them on live, and applies in one click — no reload,\n * no cordis.patch.yml rewrite (issue #506). The plugin writes only DOM and\n * the settings document — no services, no events, no model access.\n *\n * Background preferences persist through the v2 /active channel instead of\n * the settings form (issue #996): the remote pairing channel fences\n * settings.* as loopback-only, so form-backed writes never reached the\n * server from a paired desktop. The legacy skin-background section is still\n * read as a live input for the settings page (loopback only); card edits flow\n * card -> POST /active, page edits flow section -> POST /active.\n *\n * 0.1.7 serves one configuration form per profile entry (the plugin's own\n * `Config`), so the three preference families this card owns are sections of\n * that one form (see settings-section.ts).\n */\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client'\nimport type { ThemeRuntime } from '@deepseek-ai/dsh-client-ui-theme/client'\n// Type-only: pulls the locale plugin's Context merge (ctx.locale).\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: pulls the settings-surface Context merge (ctx.configForms).\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\n// Type-only: pulls the ctx.slots merge (the renderer owns the slot registry since 0.1.2).\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\n// Type-only: pulls the generated Remote namespace (ctx.remote), including directoryPicker.\nimport type {} from '@deepseek-ai/dsh-api-remotes/client'\nimport { SkinCenterSection, type SkinCenterInjected } from './SkinCenter.tsx'\nimport { BackgroundController, SKIN_BACKGROUND_NS } from './background.ts'\nimport type { SkinBackgroundConfig } from '../core/background.ts'\nimport { initialSkinBackgroundReconcileState, reconcileSkinBackgroundPublication } from '../core/background-scope.ts'\nimport {\n externalWallpaperEngineActive,\n externalWallpaperPredicted,\n releasePrediction,\n watchExternalWallpaperEngine,\n} from './runtime/external-wallpaper-engine.ts'\nimport { PREDICTED_WALLPAPER_GRACE_MS } from '../core/wallpaper-handoff.ts'\nimport { setComposerFrostSuppressed } from './runtime/backdrop-scene.ts'\nimport { bridgeInstallFaces } from './plugin-install-faces.ts'\nimport { createDelegatedSkinHandle } from './delegated-skin-handle.ts'\nimport { delegatedThemeState, watchDelegatedTheme, type DelegatedThemeState } from './runtime/delegated-theme.ts'\nimport { DELEGATED_SKINS } from '../core/delegated-skins.ts'\nimport { EXTERNAL_WE_PLUGIN, EXTERNAL_WE_REPO } from '../external-wallpaper.ts'\nimport { en, zh, type SkinCenterKey } from './locales.ts'\nimport { bootSkinRuntime, watchPersistedSelection } from './runtime/boot.ts'\nimport { PreviewCoordinator } from './preview-coordinator.ts'\nimport { CustomThemeController } from './custom-theme-controller.ts'\nimport { SKIN_CUSTOM_THEME_NS, type CustomThemeConfig } from '../core/custom-theme.ts'\nimport { settingsSection } from './settings-section.ts'\nimport { boundConfigForm } from './settings-entry-id.ts'\nimport { reportDailyHeartbeat } from './telemetry.ts'\n\nexport type { SkinCenterComponentProps, SkinCenterInjected } from './SkinCenter.tsx'\nexport { bootSkinRuntime } from './runtime/boot.ts'\n\n/** Locale namespace owned by this plugin. */\nexport const NS = 'skinCenter'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** The skin-center card's copy. */\n skinCenter: SkinCenterKey\n }\n}\n\n/**\n * Domain-owned description of one settings namespace a family card binds.\n * Private upstream since 0.1.7 (the shared forms service addresses profile\n * entry ids, not namespaces), so the family binder's spec shape is declared\n * here.\n */\nexport interface SettingsFormSpec<S> {\n /** Family settings namespace; the binder resolves its profile entry id. */\n namespace: string\n /** Narrow one wire section; undefined keeps the value the Host resolved. */\n decode?: (section: unknown) => S | undefined\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n /**\n * Optional family settings binder provided by dsh-web-settings; absent\n * when that group plugin is not installed, so callers fall back to the\n * shared configuration forms service.\n */\n webUiSettings?: { bind<S>(spec: SettingsFormSpec<S>): ConfigForm<S> }\n }\n}\n\n/** The plugin's own configuration as the browser half reads it (plain values). */\ninterface SkinCenterSettings {\n 'skin-background'?: SkinBackgroundConfig\n 'skin-custom-theme'?: CustomThemeConfig\n}\n\n/**\n * The configuration form of this plugin's own profile entry.\n *\n * `ctx.configForms` addresses one form per profile entry id and carries no\n * package identity, so the entry is reached through the family binder, whose\n * namespace-to-entry mapping the settings group owns: `skin-background` is\n * the namespace this package has always owned, and the bridge resolves it to\n * whichever entry id the profile gave this row. A deployment without the\n * group serves no such mapping, so the shared forms service is asked which row\n * it actually serves via deferred binding: rather than freezing a guess while the\n * describe mirror is unanswered (#1769), `boundConfigForm` degrades to\n * 'unavailable' and binds whichever row the Host serves (`web-ui-skin-center`\n * under an aggregate install, or `ui-skin-center` under a standalone install).\n * @param ctx - client root context.\n * @returns the entry form carrying every preference family.\n */\nfunction bindConfigForm(ctx: ClientContext): ConfigForm<SkinCenterSettings> {\n const binder = ctx.get('webUiSettings')\n if (binder !== undefined && typeof binder.bind === 'function') {\n return binder.bind<SkinCenterSettings>({ namespace: SKIN_BACKGROUND_NS })\n }\n return boundConfigForm<SkinCenterSettings>(ctx.configForms)\n}\n\n/**\n * Required services: slots + locale (plugin card), theme (preview toggle) and\n * configForms (settings sections).\n *\n * The Remote faces this plugin used (the wallpaper panel's folder picker)\n * left with the built-in Wallpaper Engine bridge: wallpaper configuration now\n * belongs to `dsh-plugin-wallpaper-engine`, which owns its own directory\n * pickers. Dropping the `remote.directoryPicker` inject also releases the\n * parking it imposed, so the card mounts on a Host that serves no picker.\n */\nexport const inject = ['slots', 'locale', 'theme', 'configForms']\n\n/** Self-report item for the install heartbeat. */\nconst SELF_ITEM = [{ name: '@linxin666/dsh-client-ui-skin-center' }]\n\n/**\n * Beat the install heartbeat (docs/telemetry.md), enriching it with the\n * installed skin inventory (skin:<id> + version + channel) once the v2\n * catalog answers. Offline or pre-boot the beat stays package-only.\n */\nfunction beatHeartbeat(): void {\n reportDailyHeartbeat(SELF_ITEM)\n void fetch('/api/skin-center/v2/catalog')\n .then((res) => (res.ok ? res.json() : null))\n .then((catalog) => {\n if (!catalog || !Array.isArray(catalog.skins)) return\n const items = [...SELF_ITEM]\n for (const skin of catalog.skins) {\n const id = skin && skin.manifest && typeof skin.manifest.id === 'string' ? skin.manifest.id : ''\n if (!id) continue\n const item: { name: string; version?: string; channel?: 'market' | 'npm' | 'unknown' } = { name: 'skin:' + id }\n if (typeof skin.manifest.version === 'string') item.version = skin.manifest.version\n if (typeof skin.channel === 'string') item.channel = skin.channel\n items.push(item)\n }\n reportDailyHeartbeat(items.slice(0, 64))\n })\n .catch(() => { /* offline or fenced: the package-only beat already went out */ })\n}\n\n/**\n * Register the skin-center dictionaries, the body scope attribute, and the\n * Skin Center as a first-level settings section.\n * @param ctx - client root context.\n */\nexport function apply(ctx: ClientContext): void {\n // Anonymous install heartbeat (docs/telemetry.md): one beat per browser per\n // UTC day, package name plus installed-skin inventory, silent failure.\n beatHeartbeat()\n\n ctx.effect(() => {\n try {\n return ctx.locale.register(NS, { zh, en })\n } catch {\n return () => {}\n }\n }, 'ui-skin-center: dictionaries')\n\n // The card's own styles scope under this attribute so they keep applying\n // during try-on (when the active skin's attribute is retracted).\n ctx.effect(() => {\n document.body.dataset.dshSkinCenter = ''\n return () => { delete document.body.dataset.dshSkinCenter }\n }, 'ui-skin-center: body scope')\n\n const theme = ctx.get('theme') as ThemeRuntime\n const settings = bindConfigForm(ctx)\n // The v2 state channel: GET backfills on boot, edits POST back debounced.\n // The remote proxy rewrites this path into the allow-listed channel, so it\n // works from paired desktops where the settings form is fenced (#996).\n const V2_ACTIVE_URL = '/api/skin-center/v2/active'\n let persistTimer: ReturnType<typeof setTimeout> | null = null\n const postBackground = (next: SkinBackgroundConfig, keepalive = false): void => {\n void fetch(V2_ACTIVE_URL, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ background: next }),\n keepalive,\n }).catch(() => { /* offline or pre-boot: the in-memory values stay applied */ })\n }\n // Coalesce slider drags into one write; dispose flushes the pending one.\n const persistBackground = (next: SkinBackgroundConfig): void => {\n if (persistTimer !== null) clearTimeout(persistTimer)\n persistTimer = setTimeout(() => {\n persistTimer = null\n postBackground(next)\n }, 250)\n }\n const flushBackground = (): void => {\n if (persistTimer === null) return\n clearTimeout(persistTimer)\n persistTimer = null\n postBackground(background.snapshot(), true)\n }\n // The legacy section is an input face for the loopback settings page only.\n // Its resolved value contains schema defaults, so only the raw user layer may\n // be reconciled into the authoritative v2 state.\n const backgroundSection = settingsSection<SkinBackgroundConfig>(settings, SKIN_BACKGROUND_NS)\n const scopeConfig = (): SkinBackgroundConfig | null => {\n const value = backgroundSection.getSnapshot().value\n if (value === undefined || value === null) return null\n return value\n }\n const background = new BackgroundController(scopeConfig(), persistBackground)\n // Reconcile state for the legacy section (revision + user-layer fence, plus\n // the boot-sync gate #1375): the settings document's initial sync must never\n // be mistaken for a settings-page edit, whichever order it and the v2 GET\n // land in — stale legacy user-layer fields (e.g. zeros left by the pre-#1107\n // bugs) would otherwise patch and persist over the authoritative v2 state.\n let reconcileState = initialSkinBackgroundReconcileState(backgroundSection.getSnapshot())\n const reconcileScope = (): void => {\n const result = reconcileSkinBackgroundPublication(\n reconcileState,\n background.snapshot(),\n backgroundSection.getSnapshot(),\n )\n reconcileState = result.state\n if (result.patch === null) return\n const currentSnapshot = background.snapshot()\n background.init({ ...currentSnapshot, ...result.patch })\n persistBackground(background.snapshot())\n }\n // Refetch the authoritative v2 state once booted; it wins over the settings\n // snapshot (the migration may only have run with this boot).\n void fetch(V2_ACTIVE_URL)\n .then((res) => (res.ok ? res.json() as Promise<{ background?: SkinBackgroundConfig | null }> : null))\n .then((body) => {\n reconcileState = { ...reconcileState, v2Loaded: true }\n if (body?.background) background.init(body.background)\n // Reconcile only a section revision that changed while the v2 state was\n // loading; an unchanged revision is the legacy boot snapshot.\n reconcileScope()\n })\n .catch(() => {\n reconcileState = { ...reconcileState, v2Loaded: true }\n reconcileScope()\n })\n // Settings-page edits arrive through the form publish. The settings mirror\n // may republish this entry for any configuration change (including the other\n // two sections), so fence on the revision and use only explicitly stored\n // user fields — the user-layer content fence is what keeps an unrelated\n // republish from being read as an edit.\n ctx.effect(\n () => backgroundSection.subscribe(reconcileScope),\n 'ui-skin-center: background section sync',\n )\n // Tear the blur element + observer down when this plugin's fiber goes away.\n ctx.effect(() => () => {\n flushBackground()\n background.dispose()\n }, 'ui-skin-center: background dispose')\n const customTheme = new CustomThemeController(\n settingsSection<CustomThemeConfig>(settings, SKIN_CUSTOM_THEME_NS),\n )\n ctx.effect(() => () => customTheme.dispose(), 'ui-skin-center: custom theme dispose')\n // One-click install of the delegated plugins (issue #39, and the\n // delegated-skin rows): bridge whichever plugin-management face the host\n // publishes. Both are optional, so neither gates this plugin's activation.\n bridgeInstallFaces(ctx)\n\n // Delegated skins: a skin whose visual is another plugin's. This package\n // paints none of it, so the card's row is driven by that plugin's own\n // document markers. One observer per registered plugin, read-only, and torn\n // down with this fiber.\n const delegatedStates = new Map<string, DelegatedThemeState>()\n const delegatedListeners = new Set<() => void>()\n for (const descriptor of DELEGATED_SKINS) {\n delegatedStates.set(descriptor.id, delegatedThemeState(document, descriptor))\n }\n ctx.effect(() => {\n const stops = DELEGATED_SKINS.map((descriptor) => watchDelegatedTheme(\n document,\n { bodyAttr: descriptor.bodyAttr, handoffAttr: descriptor.handoffAttr },\n (state) => {\n delegatedStates.set(descriptor.id, state)\n for (const listener of delegatedListeners) listener()\n },\n ))\n return () => { for (const stop of stops) stop() }\n }, 'ui-skin-center: delegated theme interop')\n // The external Wallpaper Engine plugin owns wallpapers now (issue #39).\n // While it renders one, its `body[data-we-wallpaper]` marker stands this\n // plugin's own visual work down ENTIRELY: no skin CSS, no background art, no\n // hooks, no composer frost. That plugin rewrites the same shell and paints\n // its own glass, so anything this one paints would fight it.\n //\n // The state is read synchronously BEFORE the runtime boots, so a page that\n // loads with a wallpaper already rendering never paints a frame of skin\n // first. The watcher installed below then keeps it current.\n //\n // Reading it here is the second half of that guarantee, not the whole of it\n // (issue #51): the marker is stamped by the peer's own client chain, so it\n // is absent from the document this page loaded with, and a frame of skin is\n // already painted by the time it lands.\n //\n // The host half therefore stands the index injection down for a persisted\n // wallpaper selection and marks the document as withheld-for-prediction.\n // This read is the other half: the browser boot recovers the selection\n // asynchronously (GET /active, then a switch), so that first activation has\n // to stand down too, or the withheld document is refilled with a frame of\n // skin a few hundred milliseconds after it was served.\n //\n // The prediction is bounded and expires on its own. A wallpaper that never\n // renders never stamps the marker, and the window is then the only thing\n // between that user and their skin - so when it closes, the runtime applies\n // the remembered selection as usual. The marker remains the verdict.\n let externalWallpaperActive = externalWallpaperEngineActive(document)\n // True only while the host predicted a wallpaper and the peer has not yet\n // answered; released by whichever comes first.\n let externalWallpaperPredictedStill = externalWallpaperPredicted(document)\n const externalWallpaperListeners = new Set<() => void>()\n\n // The v2 skin runtime store: outlives the settings card so a try-on\n // preview survives closing and reopening the panel. An active external\n // wallpaper withholds the skin; a marker flip re-applies the user's\n // selection so the appearance changes without a reload.\n const runtime = bootSkinRuntime({\n suppressSkin: () => externalWallpaperActive || externalWallpaperPredictedStill,\n suppressComposerFrost: () => externalWallpaperActive,\n })\n ctx.effect(() => () => runtime.shutdown(), 'ui-skin-center: runtime shutdown')\n // Applying a skin and saving the choice are one action in the GUI, but the\n // choice only reaches the NEXT page load. This page therefore follows it\n // two ways: the skin-applied announcement (a workshop install, from any\n // page) and the persisted selection (the official settings form, which the\n // Host applies without telling this page). Issue #1740 owned by this\n // activation, so a cleared plugin row takes the listeners with it.\n ctx.effect(() => watchPersistedSelection(runtime), 'ui-skin-center: follow the persisted selection')\n // Follow the external plugin's marker: every flip notifies the card (so its\n // hints stay truthful) and re-applies the current skin, which is what paints\n // or withholds it without a reload. The first report carries the state the\n // boot above already used, so it is a no-op.\n ctx.effect(() => {\n // The peer's marker answering - either way - ends the host's prediction:\n // the live verdict now owns the page, and the mark that stood the boot\n // activation down has done its job. The very first report IS that answer,\n // so a page whose peer stamps the marker before this plugin boots releases\n // the prediction immediately rather than carrying it for the full window.\n const dropPrediction = (): void => {\n if (!externalWallpaperPredictedStill) return\n externalWallpaperPredictedStill = false\n releasePrediction(document)\n }\n const stopWatch = watchExternalWallpaperEngine(document, (active) => {\n dropPrediction()\n if (active === externalWallpaperActive) return\n externalWallpaperActive = active\n // The external plugin paints its own composer glass, so this runtime\n // yields the frost while the wallpaper renders (issue #39).\n setComposerFrostSuppressed(document, active)\n for (const listener of externalWallpaperListeners) listener()\n void runtime.controller.refresh()\n })\n // The peer never answered. A wallpaper that fails to render never stamps\n // the marker, so the prediction has to expire on its own or this page\n // would sit on the stock look until the next reload. Expiry is a normal\n // stand-down lift: the remembered skin applies through the ordinary\n // withheld path, so nothing about the recovery is special-cased.\n let graceTimer: ReturnType<typeof setTimeout> | null = null\n if (externalWallpaperPredictedStill) {\n graceTimer = setTimeout(() => {\n graceTimer = null\n dropPrediction()\n if (externalWallpaperActive) return\n for (const listener of externalWallpaperListeners) listener()\n void runtime.controller.refresh()\n }, PREDICTED_WALLPAPER_GRACE_MS)\n }\n return () => {\n stopWatch()\n if (graceTimer !== null) clearTimeout(graceTimer)\n dropPrediction()\n }\n }, 'ui-skin-center: external wallpaper engine interop')\n const preview = new PreviewCoordinator(runtime.controller, customTheme)\n const injected = (): SkinCenterInjected => ({\n runtime,\n preview,\n customTheme,\n theme: {\n getTheme: () => theme.getTheme(),\n subscribe: listener => ctx.on('theme/change', listener),\n setTheme: id => theme.setTheme(id),\n },\n background: {\n enabled: () => background.enabled(),\n setEnabled: value => background.setEnabled(value),\n opacity: () => background.opacity(),\n blurEmpty: () => background.blurEmpty(),\n blurContent: () => background.blurContent(),\n inputCardBlur: () => background.inputCardBlur(),\n bubbleOpacity: () => background.bubbleOpacity(),\n bubbleBlur: () => background.bubbleBlur(),\n subscribe: listener => background.subscribe(listener),\n set: opacity => background.set(opacity),\n setBlurEmpty: value => background.setBlurEmpty(value),\n setBlurContent: value => background.setBlurContent(value),\n setInputCardBlur: value => background.setInputCardBlur(value),\n setBubbleOpacity: value => background.setBubbleOpacity(value),\n setBubbleBlur: value => background.setBubbleBlur(value),\n dispose: () => background.dispose(),\n },\n externalWallpaper: {\n active: () => externalWallpaperActive,\n subscribe: (listener) => {\n externalWallpaperListeners.add(listener)\n return () => { externalWallpaperListeners.delete(listener) }\n },\n repository: EXTERNAL_WE_REPO,\n packageName: EXTERNAL_WE_PLUGIN,\n },\n delegated: createDelegatedSkinHandle(\n (id) => delegatedStates.get(id) ?? { live: false, canYield: false },\n (listener) => {\n delegatedListeners.add(listener)\n return () => { delegatedListeners.delete(listener) }\n },\n ),\n })\n\n // First-level settings section: the Skin Center card as its own top-level\n // settings page. Browsing and installing new skins happens in the DSH\n // Market store; this section manages the installed ones (try-on, apply,\n // wallpaper, custom theme).\n ctx.slots.inject('settings.section', () => {\n try {\n return ctx.slots.register({\n name: 'settings.section',\n id: 'skin-center',\n order: 120,\n label: () => ctx.locale.bind('skinCenter')('title'),\n locale: 'skinCenter',\n inject: injected,\n }, SkinCenterSection)\n } catch {\n return () => {}\n }\n })\n}\n"],"mappings":";;;;;;;;;EAgEA,SAAgB,mBAAmB,YAA0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