dsh-mobile 0.8.7 → 0.8.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"mobile-layout.js","names":["useSyncExternalStore","useRef","useState","createElement"],"sources":["../src/mobile-layout-attributes.ts","../src/mobile-layout-messages.ts","../src/session-prefetch.ts","../src/mobile-layout.ts"],"sourcesContent":["/**\n * Root marker the dedicated layout publishes for its wide/narrow band.\n *\n * The band depends on the device screen size, which a media query cannot read,\n * so the layout decides it in JS and writes this attribute on `.dshm-shell`:\n * `\"1\"` docks the sidebar, anything else — `\"0\"`, or no marker — is the overlay\n * drawer. The stylesheet and the sidebar scroll adapter both follow the marker,\n * so the band has exactly one owner.\n *\n * This module stays free of imports: the dedicated layout bundle and the native\n * client bundle both use it, and neither should pull the other in.\n */\nexport const WIDE_LAYOUT_ATTRIBUTE = 'data-dshm-wide'\n","export type MobileLayoutLanguage = 'it' | 'en' | 'zh'\n\nexport const MOBILE_LAYOUT_MESSAGES = Object.freeze({\n it: Object.freeze({ closePanels: 'Chiudi pannelli', workspaceNavigation: 'Navigazione area di lavoro e sessioni', backToConversation: 'Torna alla conversazione' }),\n en: Object.freeze({ closePanels: 'Close panels', workspaceNavigation: 'Workspace and session navigation', backToConversation: 'Back to conversation' }),\n zh: Object.freeze({ closePanels: '关闭浮层', workspaceNavigation: '工作区与会话导航', backToConversation: '返回会话' }),\n})\n","/**\n * Session prefetch for the dedicated Mobile frontend.\n *\n * Switching sessions tears down the client Session instance and its live\n * stream; switching back performs a full re-open. On the host, if the target\n * was evicted from DSH session-query's prepared-session LRU, the gateway must\n * decompress and parse the whole session log before `session/follow` can\n * answer. This module warms that cache for the session the user just left (the\n * most likely switch-back target) after a switch settles, so a follow-back hits\n * warm.\n *\n * Guardrails (per issue #291): read-only (never activates an Agent), at most one\n * target per switch, per-session cooldown, bounded settle/timeout, and silent\n * failure that never affects normal requests or live streams. The feature is\n * opt-in and disabled by default.\n */\n\nexport interface SessionPrefetchConfig {\n /** Master switch; disabled by default so the behavior is opt-in. */\n readonly enabled: boolean\n /** How long to wait for further switches before warming the MRU session (ms). */\n readonly settleMs: number\n /** Per-session cooldown between prefetches of the same session (ms). */\n readonly cooldownMs: number\n /** Hard deadline for one prefetch request (ms). */\n readonly timeoutMs: number\n /** Maximum number of targets warmed per switch (bounded to avoid bursty work). */\n readonly maxTargetsPerSwitch: number\n}\n\nexport const SESSION_PREFETCH_DEFAULTS: Readonly<SessionPrefetchConfig> = {\n enabled: false,\n settleMs: 1500,\n cooldownMs: 60_000,\n timeoutMs: 20_000,\n maxTargetsPerSwitch: 1,\n}\n\n/**\n * Storage key for the opt-in switch.\n *\n * The setting row lives in the client bundle while the tracker lives in the\n * layout bundle (tsdown.config.ts emits them separately and inlines this module\n * into each), so a module-level singleton cannot carry the value across. The\n * layout bundle owns the persisted state instead; the row notifies it through\n * both the storage event (other tabs) and a custom event (same page).\n */\nexport const SESSION_PREFETCH_STORAGE_KEY = 'dsh-mobile.session-prefetch.enabled'\nexport const SESSION_PREFETCH_EVENT = 'dsh-mobile:session-prefetch-change'\n\n/** Read the persisted opt-in. Defaults to off; unreadable storage keeps it off. */\nexport function readSessionPrefetchEnabled(storage?: Pick<Storage, 'getItem'>): boolean {\n try {\n const store = storage ?? globalThis.localStorage\n return store?.getItem(SESSION_PREFETCH_STORAGE_KEY) === 'true'\n } catch {\n return false\n }\n}\n\n/** Persist the opt-in and notify the layout bundle in the same page. */\nexport function writeSessionPrefetchEnabled(enabled: boolean, storage?: Pick<Storage, 'setItem'>): void {\n try {\n const store = storage ?? globalThis.localStorage\n store?.setItem(SESSION_PREFETCH_STORAGE_KEY, String(enabled))\n } catch {\n /* Blocked storage still lets this page react through the event below. */\n }\n try {\n globalThis.dispatchEvent?.(new CustomEvent(SESSION_PREFETCH_EVENT, { detail: { enabled } }))\n } catch {\n /* CustomEvent is missing in some test environments; the storage event still applies. */\n }\n}\n\n/**\n * Subscribe to opt-in changes coming from either bundle. The listener is not\n * called with the initial value; read it once with readSessionPrefetchEnabled().\n */\nexport function subscribeSessionPrefetchEnabled(listener: (enabled: boolean) => void): () => void {\n const onStorage = (event: StorageEvent): void => {\n if (event.key !== null && event.key !== SESSION_PREFETCH_STORAGE_KEY) return\n listener(readSessionPrefetchEnabled())\n }\n const onCustom = (event: Event): void => {\n const detail = (event as CustomEvent<{ enabled?: boolean }>).detail\n listener(detail?.enabled ?? readSessionPrefetchEnabled())\n }\n globalThis.addEventListener?.('storage', onStorage)\n globalThis.addEventListener?.(SESSION_PREFETCH_EVENT, onCustom)\n return () => {\n globalThis.removeEventListener?.('storage', onStorage)\n globalThis.removeEventListener?.(SESSION_PREFETCH_EVENT, onCustom)\n }\n}\n\n/** Apply the persisted opt-in onto a base config. */\nexport function sessionPrefetchConfigFrom(enabled: boolean, base: Readonly<SessionPrefetchConfig> = SESSION_PREFETCH_DEFAULTS): SessionPrefetchConfig {\n return { ...base, enabled }\n}\n\n/** Outcome of deciding whether a session switch should warm an MRU target. */\nexport type PrefetchDecision =\n | { readonly action: 'warm'; readonly target: string }\n | { readonly action: 'skip'; readonly reason: 'disabled' | 'no-previous' | 'same-session' | 'cooldown' | 'limit' }\n\nexport interface PrefetchClock {\n now(): number\n}\n\n/** In-memory per-session cooldown ledger plus MRU switch tracking (pure). */\nexport class SessionPrefetchTracker {\n private readonly cooldownUntil = new Map<string, number>()\n private previousSession: string | undefined\n private lastSwitchAt = 0\n\n constructor(\n private readonly config: Readonly<SessionPrefetchConfig>,\n private readonly clock: PrefetchClock = { now: () => Date.now() },\n ) {}\n\n /** The effective opt-in this tracker was built with (read-only, for rebuilds). */\n get enabled(): boolean {\n return this.config.enabled\n }\n\n /** Record that the UI switched to `sessionId`; returns the switch outcome. */\n switchTo(sessionId: string): PrefetchDecision {\n if (sessionId === '') return { action: 'skip', reason: 'no-previous' }\n const previous = this.previousSession\n this.previousSession = sessionId\n this.lastSwitchAt = this.clock.now()\n if (previous === undefined) return { action: 'skip', reason: 'no-previous' }\n if (previous === sessionId) return { action: 'skip', reason: 'same-session' }\n if (!this.config.enabled) return { action: 'skip', reason: 'disabled' }\n const cooldownUntil = this.cooldownUntil.get(previous) ?? 0\n if (this.clock.now() < cooldownUntil) return { action: 'skip', reason: 'cooldown' }\n this.cooldownUntil.set(previous, this.clock.now() + this.config.cooldownMs)\n return { action: 'warm', target: previous }\n }\n\n /** Whether the switch already passed the settle window (pure predicate). */\n settled(now = this.clock.now()): boolean {\n return now - this.lastSwitchAt >= this.config.settleMs\n }\n\n /** Forget state (used when the client unmounts). */\n reset(): void {\n this.cooldownUntil.clear()\n this.previousSession = undefined\n this.lastSwitchAt = 0\n }\n}\n\n/**\n * Fire a read-only `session/projections` prefetch, silently ignoring failures.\n *\n * The upstream RPC takes a single `request` parameter and the gateway validates\n * wire names exactly (`assertExactArguments`), so the envelope must be\n * `payload.args.request.sessionId` — the same shape every other call site in\n * this repo uses (scripts/smoke-client-module-settings.mjs, smoke-draft-transfer.mjs).\n * A bare `args.sessionId` is rejected with `gateway/arguments-invalid`.\n */\nexport function prefetchSession(request: (path: string, init?: RequestInit) => Promise<Response>, sessionId: string, timeoutMs: number): () => void {\n const controller = new AbortController()\n const timer = setTimeout(() => controller.abort(), timeoutMs)\n void (async () => {\n try {\n const response = await request('/api/session/projections', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n type: 'client-request',\n rpcId: prefetchRpcId(),\n method: 'session/projections',\n payload: { args: { request: { sessionId } } },\n }),\n signal: controller.signal,\n })\n if (!response.ok) {\n // Best-effort: a rejected prefetch is not an error the user should see,\n // but it must not be mistaken for a warm cache either.\n return\n }\n } catch {\n /* Prefetch is best-effort and never affects normal requests. */\n } finally {\n clearTimeout(timer)\n }\n })()\n return () => {\n controller.abort()\n clearTimeout(timer)\n }\n}\n\n/** Unique per attempt; the upstream does not document a format, so prefer a real UUID. */\nfunction prefetchRpcId(): string {\n const cryptoApi = globalThis.crypto as Crypto | undefined\n if (cryptoApi?.randomUUID !== undefined) return cryptoApi.randomUUID()\n return `dsh-mobile-prefetch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`\n}\n","import { createElement, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react'\nimport type { ReactNode } from 'react'\nimport { WIDE_LAYOUT_ATTRIBUTE } from './mobile-layout-attributes.js'\nimport { MOBILE_LAYOUT_MESSAGES, type MobileLayoutLanguage } from './mobile-layout-messages.js'\nimport {\n SESSION_PREFETCH_DEFAULTS,\n SessionPrefetchTracker,\n prefetchSession,\n readSessionPrefetchEnabled,\n sessionPrefetchConfigFrom,\n subscribeSessionPrefetchEnabled,\n} from './session-prefetch.js'\n\nexport { MOBILE_LAYOUT_MESSAGES } from './mobile-layout-messages.js'\nexport type { MobileLayoutLanguage } from './mobile-layout-messages.js'\n\ninterface SessionState {\n readonly current?: string\n readonly byId: Readonly<Record<string, { readonly blank?: boolean; readonly title?: string } | undefined>>\n}\n\ninterface MobileRootProps {\n readonly renderSlot: (\n name: string,\n owner: Record<string, unknown>,\n options?: { readonly entryKey?: string | null; readonly fallback?: ReactNode },\n ) => ReactNode\n readonly useSessions: <T>(selector: (state: SessionState) => T) => T\n}\n\n/** Root contribution carrying one observable hook into the standard kit. */\ninterface RootHookContribution {\n readonly hooks: Readonly<Record<string, {\n readonly getSnapshot: () => unknown\n readonly subscribe: (listener: () => void) => () => void\n }>>\n}\n\ninterface MobileClientContext {\n readonly effect: (effect: () => void | (() => void), label?: string) => void\n readonly get: (name: string) => unknown\n readonly on: (event: string, listener: (value: ThemeSnapshot) => void) => () => void\n readonly reflect: { provide: (name: string, value: unknown) => () => void | Promise<void> }\n readonly slots: {\n register: <Props>(options: Record<string, unknown>, component: (props: Props) => ReactNode) => () => void\n entries: (name: string) => readonly { readonly options: { readonly key?: string } }[]\n subscribe: (name: string, listener: () => void) => () => void\n /**\n * Publish a root standard hook. The official layout owns `panelInfo`, so\n * replacing that module means replacing the owner too.\n */\n provideRoot?: (contribution: RootHookContribution) => () => void\n }\n readonly theme: { getTheme: () => ThemeSnapshot }\n}\n\ninterface ThemeSnapshot {\n readonly active: {\n readonly colorScheme: 'dark' | 'light'\n readonly tokens: Readonly<Record<string, string>>\n }\n}\n\ninterface LayoutSnapshot {\n readonly sidebarOpen: boolean\n readonly detailsOpen: boolean\n readonly rightbarTrack: boolean\n readonly rightbarFullscreen: boolean\n readonly panelInfo: PanelInfoSnapshot\n}\n\n/**\n * Panel selection as the standard `usePanelInfo` hook reports it: a null\n * `activePanelId` means the conversation owns the center column.\n */\ninterface PanelInfoSnapshot {\n readonly activePanelId: string | null\n}\n\n/** Optional DSH 0.1.5 right-Sidebar controls used by a Mobile close gesture. */\nexport interface SidebarRightControl {\n isExpanded(): boolean\n toggleExpanded(): void\n}\n\n/** Whether an optional service value supports the public right-Sidebar controls. */\nexport function isSidebarRightControl(value: unknown): value is SidebarRightControl {\n if (typeof value !== 'object' || value === null) return false\n const candidate = value as Partial<SidebarRightControl>\n return typeof candidate.isExpanded === 'function' && typeof candidate.toggleExpanded === 'function'\n}\n\n/**\n * Viewport width at which the dedicated layout treats the sidebar as a\n * persistent desktop panel instead of an overlay drawer. Narrow screens\n * keep the overlay behavior byte-for-byte.\n */\nexport const WIDE_LAYOUT_MIN_WIDTH_PX = 900\n/**\n * Shorter-side floor for the persistent sidebar, measured on the *device*: a\n * landscape phone is wider than the width threshold while its screen's short\n * side is still a phone's. Docking a 932x430 phone hid the conversation behind a\n * permanent rail and removed the panel return bar, so width alone is not enough\n * evidence of a tablet-sized viewport.\n *\n * The measurement must come from `screen`, not the viewport: a Pad 9 Pro Max in\n * landscape (1363x860 viewport, 1364x909 screen) reports `innerHeight: 441`\n * while the soft keyboard is open, and a viewport-height floor would flip a\n * docked tablet into the drawer layout mid-sentence.\n */\nexport const WIDE_LAYOUT_MIN_SHORTER_SIDE_PX = 600\n/** Re-exported so the layout's own tests and callers keep one import site. */\nexport { WIDE_LAYOUT_ATTRIBUTE }\n/**\n * Narrow band that still has room for a folded 56px rail beside the\n * conversation: the pre-existing 721-899px phone rule plus any narrow viewport\n * that is wide enough for the rail, such as a landscape phone.\n */\nconst FOLDED_RAIL_OFFSET_QUERY = '(min-width:721px)'\nconst RIGHTBAR_MIN_WIDTH_PX = 300\nconst RIGHTBAR_MAX_WIDTH_PX = 460\nconst RIGHTBAR_CENTER_MIN_WIDTH_PX = 400\nconst RIGHTBAR_DEFAULT_RATIO = 0.45\nconst SIDEBAR_EXPANDED_WIDTH_PX = 340\nconst SIDEBAR_COLLAPSED_WIDTH_PX = 56\n\n/**\n * The device's shorter side in CSS pixels, independent of rotation and of the\n * soft keyboard. Falls back to the viewport only where `screen` reports nothing\n * usable (SSR, minimal DOM stubs).\n * @param screenWidth - `screen.width`, or `undefined` without a screen.\n * @param screenHeight - `screen.height`, or `undefined` without a screen.\n * @param viewportWidth - the viewport width, used for the fallback.\n * @param viewportHeight - the viewport height, used for the fallback.\n * @returns the shorter side in CSS pixels.\n */\nexport function resolveDeviceShortSide(\n screenWidth: number | undefined,\n screenHeight: number | undefined,\n viewportWidth: number,\n viewportHeight: number,\n): number {\n return typeof screenWidth === 'number' && typeof screenHeight === 'number'\n && screenWidth > 0 && screenHeight > 0\n ? Math.min(screenWidth, screenHeight)\n : Math.min(viewportWidth, viewportHeight)\n}\n\n/**\n * Whether the dedicated layout should dock the sidebar as a persistent column.\n * @param viewportWidth - the viewport width in CSS pixels; a narrow window is\n * never wide, whatever the screen behind it measures.\n * @param deviceShortSide - the device's shorter side, from {@link resolveDeviceShortSide}.\n * @returns whether the viewport and the device are both large enough.\n */\nexport function isWideViewportLayout(viewportWidth: number, deviceShortSide: number): boolean {\n return viewportWidth >= WIDE_LAYOUT_MIN_WIDTH_PX\n && deviceShortSide >= WIDE_LAYOUT_MIN_SHORTER_SIDE_PX\n}\n\n/** Resolved right-panel presentation for the dedicated responsive layout. */\nexport interface MobileRightbarLayout {\n readonly docked: boolean\n readonly width: number\n}\n\n/** Preserve a readable conversation width before turning a requested right track into a docked column. */\nexport function resolveMobileRightbarLayout(\n viewportWidth: number,\n wideViewport: boolean,\n sidebarOpen: boolean,\n track: boolean,\n fullscreen: boolean,\n): MobileRightbarLayout {\n const overlayWidth = wideViewport\n ? Math.min(viewportWidth * 0.94, RIGHTBAR_MAX_WIDTH_PX)\n : viewportWidth\n if (!track || fullscreen || (!wideViewport && sidebarOpen)) {\n return Object.freeze({ docked: false, width: overlayWidth })\n }\n const sidebarWidth = wideViewport && sidebarOpen\n ? SIDEBAR_EXPANDED_WIDTH_PX\n : SIDEBAR_COLLAPSED_WIDTH_PX\n const available = Math.floor(viewportWidth - sidebarWidth - RIGHTBAR_CENTER_MIN_WIDTH_PX)\n if (available < RIGHTBAR_MIN_WIDTH_PX) return Object.freeze({ docked: false, width: overlayWidth })\n const preferred = Math.min(\n RIGHTBAR_MAX_WIDTH_PX,\n Math.max(RIGHTBAR_MIN_WIDTH_PX, Math.round(viewportWidth * RIGHTBAR_DEFAULT_RATIO)),\n )\n return Object.freeze({ docked: true, width: Math.min(preferred, available) })\n}\n\n/** Whether an overlay drawer needs the modal scrim without dimming a docked desktop panel. */\nexport function isMobileScrimOpen(\n sidebarOpen: boolean,\n detailsModalOpen: boolean,\n wideViewport: boolean,\n): boolean {\n return (!wideViewport && sidebarOpen) || detailsModalOpen\n}\n\n/**\n * Query matching devices whose primary pointer cannot hover: the phones and\n * tablets where focusing an editor raises a soft keyboard the user did not ask\n * for. A desktop keeps stock behaviour because it has a real keyboard already.\n */\nexport const TOUCH_PRIMARY_QUERY = '(hover: none), (pointer: coarse)'\n\n/** The stock composer wrapper, which owns everything the phone adapter edits. */\nconst COMPOSER_CARD_SELECTOR = '[data-composer-card]'\n\n/** The composer's editing host, whichever contenteditable flavour it boots with. */\nconst COMPOSER_EDITOR_SELECTOR = `${COMPOSER_CARD_SELECTOR} :is([contenteditable=\"true\"],[contenteditable=\"plaintext-only\"],[contenteditable=\"\"])`\n\n/** The composer's Add trigger, whose menu must open without summoning the IME. */\nconst COMPOSER_COMMAND_TRIGGER_SELECTOR = `${COMPOSER_CARD_SELECTOR} button[aria-haspopup=\"listbox\"]`\n\n/**\n * Whether a focus target belongs to the composer, which owns its own keyboard\n * decision and must never be blurred by a suppression window.\n * @param target - the focus target, already narrowed to an element.\n * @returns whether the target sits inside the composer card.\n */\nexport function isComposerOwnedFocus(target: Element | null): boolean {\n return target !== null && target.closest(COMPOSER_CARD_SELECTOR) !== null\n}\n\n/**\n * Whether a click opens a different Session, rather than its menu or current row.\n * @param target - the click target in the workspace sidebar.\n * @returns whether the Session selection can change.\n */\nexport function isSessionRowNavigation(target: Element | null): boolean {\n if (target === null) return false\n const row = target.closest('[role=\"treeitem\"][aria-selected]')\n if (row === null || row.getAttribute('aria-selected') === 'true') return false\n const action = target.closest('button,[role=\"button\"]')\n return action === null || action === row\n}\n\n/**\n * Decide how one pointer event changes the composer's soft keyboard.\n *\n * The Add button's own mousedown calls `keepDraftFocus`, which focuses the draft\n * on purpose so the caret survives the menu; on a phone that focus is what\n * raises the keyboard. `inputmode=\"none\"` withholds the IME without moving focus\n * or the caret, so the menu, the caret, and the draft all keep stock behaviour.\n * @param target - the pointer target, already narrowed to an element.\n * @param touchPrimary - whether the device's primary pointer cannot hover.\n * @returns `withhold` for the Add trigger, `restore` for any other tap, and\n * `ignore` where no soft keyboard exists to withhold.\n */\nexport function resolveComposerImePolicy(\n target: Element | null,\n touchPrimary: boolean,\n): 'ignore' | 'restore' | 'withhold' {\n if (!touchPrimary || target === null) return 'ignore'\n return target.closest(COMPOSER_COMMAND_TRIGGER_SELECTOR) === null ? 'restore' : 'withhold'\n}\n\n/**\n * Whether a tap landed on the stock Send, Queue, or Steer primary button.\n * Stop uses a square SVG; Add, attachment, and plugin buttons are separate actions.\n * @param target - the click target in the composer card.\n * @returns whether the enabled primary action carries the send arrow.\n */\nexport function isComposerActionTap(target: Element | null): boolean {\n if (target === null) return false\n const action = target.closest('button[class*=\"_primary\"]')\n return action !== null && action.closest(COMPOSER_CARD_SELECTOR) !== null\n && !action.hasAttribute('disabled') && action.getAttribute('aria-disabled') !== 'true'\n && action.querySelector('svg path') !== null\n}\n\n/** Text, reference chips, and the stock attachment rail all contribute to a draft. */\nfunction composerHasDraft(editor: HTMLElement, card: Element): boolean {\n return (editor.textContent ?? '').replaceAll('\\u200b', '').trim() !== ''\n || editor.querySelector('[contenteditable=\"false\"],[data-lexical-decorator],img') !== null\n || card.querySelector('[data-slot=\"conversation.input.attachments\"] [role=\"group\"] > *') !== null\n}\n\n/**\n * Collapse an on-screen keyboard after a trusted touch Send consumes the focused\n * draft. Consumption may be asynchronous; input, navigation, composition, or\n * another gesture cancels the observation. DSH owns optimistic sends and any\n * later failure restoration; this listener never submits or modifies the draft.\n * @param onConsumed - called immediately before blurring to suppress DSH autofocus.\n * @returns disposer for pointer, composition, focus, and draft observations.\n */\nexport function installComposerSendKeyboardPolicy(onConsumed: () => void): () => void {\n let touchButton: Element | null = null\n let cancelPending = (): void => {}\n const composing = new WeakSet<Element>()\n let compositionEndedAt = -Infinity\n const elementTarget = (target: EventTarget | null): Element | null => target instanceof Element ? target : null\n const onPointerDown = (event: PointerEvent): void => {\n cancelPending()\n const target = elementTarget(event.target)\n touchButton = event.isTrusted && (event.pointerType === 'touch' || event.pointerType === 'pen')\n && isComposerActionTap(target) ? target?.closest('button') ?? null : null\n }\n const onClick = (event: MouseEvent): void => {\n const action = touchButton\n touchButton = null\n const target = elementTarget(event.target)\n const active = document.activeElement\n const nativeState = window.__DSH_MOBILE_KEYBOARD_STATE__\n if (!event.isTrusted || event.detail === 0 || action === null || target?.closest('button') !== action\n || !isComposerActionTap(target) || !window.matchMedia(TOUCH_PRIMARY_QUERY).matches\n || (window.__DSH_MOBILE_NATIVE__ !== undefined\n && (nativeState?.noHardwareKeyboard !== true || nativeState.imeVisible !== true))\n || !(active instanceof HTMLElement) || !active.matches(COMPOSER_EDITOR_SELECTOR)\n || composing.has(active) || performance.now() - compositionEndedAt < 10) return\n const editor = active\n const composerCard = editor.closest(COMPOSER_CARD_SELECTOR)\n if (composerCard === null || action.closest(COMPOSER_CARD_SELECTOR) !== composerCard || !composerHasDraft(editor, composerCard)) return\n const card = composerCard\n const sessionOwner = card.closest('[data-conversation-session]')\n const sessionId = sessionOwner?.getAttribute('data-conversation-session')\n const currentEditor = (): boolean => editor.isConnected && editor.closest(COMPOSER_CARD_SELECTOR) === card\n && card.closest('[data-conversation-session]') === sessionOwner\n && sessionOwner?.getAttribute('data-conversation-session') === sessionId\n && document.activeElement === editor\n cancelPending()\n let frame = 0\n const observer = new MutationObserver(check)\n const expiry = window.setTimeout(() => { cancelPending() }, 30_000)\n cancelPending = (): void => {\n observer.disconnect()\n window.clearTimeout(expiry)\n window.cancelAnimationFrame(frame)\n cancelPending = () => {}\n }\n function check(): void {\n if (!currentEditor()) {\n cancelPending()\n return\n }\n if (composerHasDraft(editor, card) || ['adjudicating', 'submitting'].includes(editor.dataset.phase ?? '')) return\n if (frame !== 0) return\n frame = window.requestAnimationFrame(() => {\n frame = window.requestAnimationFrame(() => {\n frame = 0\n if (!currentEditor() || composerHasDraft(editor, card)\n || ['adjudicating', 'submitting'].includes(editor.dataset.phase ?? '')) return\n cancelPending()\n onConsumed()\n editor.blur()\n })\n })\n }\n observer.observe(card, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: ['data-phase', 'contenteditable'] })\n // The capture listener runs before React's onClick; the first frame reads its result.\n frame = window.requestAnimationFrame(() => { frame = 0; check() })\n }\n const onCompositionStart = (event: CompositionEvent): void => {\n const target = elementTarget(event.target)\n if (target !== null) composing.add(target)\n cancelPending()\n }\n const onCompositionEnd = (event: CompositionEvent): void => {\n const target = elementTarget(event.target)\n if (target !== null) composing.delete(target)\n compositionEndedAt = performance.now()\n }\n const onTyping = (): void => { touchButton = null; cancelPending() }\n const onFocus = (): void => { cancelPending() }\n document.addEventListener('pointerdown', onPointerDown, true)\n document.addEventListener('click', onClick, true)\n document.addEventListener('compositionstart', onCompositionStart, true)\n document.addEventListener('compositionend', onCompositionEnd, true)\n document.addEventListener('keydown', onTyping, true)\n document.addEventListener('input', onTyping, true)\n document.addEventListener('focusin', onFocus, true)\n return () => {\n cancelPending()\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('click', onClick, true)\n document.removeEventListener('compositionstart', onCompositionStart, true)\n document.removeEventListener('compositionend', onCompositionEnd, true)\n document.removeEventListener('keydown', onTyping, true)\n document.removeEventListener('input', onTyping, true)\n document.removeEventListener('focusin', onFocus, true)\n }\n}\n\n/**\n * Close the details drawer from its scrim, collapsing the DSH 0.1.5 right\n * Sidebar first when that optional service owns the visible content.\n */\nexport function closeDetailsFromScrim(sidebarRight: unknown, closeDetails: () => void): void {\n if (isSidebarRightControl(sidebarRight) && sidebarRight.isExpanded()) {\n sidebarRight.toggleExpanded()\n }\n closeDetails()\n}\n\n/** The device and viewport facts the layout decision needs, read live. */\nfunction readViewport(): { width: number, height: number, shortSide: number } {\n const width = window.innerWidth\n const height = window.innerHeight\n const screen = window.screen as { width?: number, height?: number } | undefined\n return {\n width,\n height,\n shortSide: resolveDeviceShortSide(screen?.width, screen?.height, width, height),\n }\n}\n\n/**\n * Reads the live device and viewport; unknown environments (SSR, tests) stay\n * narrow. `screen` is what distinguishes a tablet from a landscape phone and\n * what keeps a docked tablet docked while its soft keyboard is open.\n */\nfunction viewportIsWide(): boolean {\n if (typeof window === 'undefined') return false\n const viewport = readViewport()\n return isWideViewportLayout(viewport.width, viewport.shortSide)\n}\n\n/** Resolve the supported language used by the dedicated mobile layout. */\nexport function resolveMobileLayoutLanguage(\n documentLanguage: string,\n browserLanguages: readonly string[],\n): MobileLayoutLanguage {\n return [documentLanguage, ...browserLanguages]\n .map(value => value.trim().toLowerCase().split(/[-_]/u)[0])\n .find((value): value is MobileLayoutLanguage => value === 'it' || value === 'en' || value === 'zh') ?? 'en'\n}\n\nclass MobileLayoutController {\n // Wide viewports start with the persistent sidebar open; applying the\n // layout again (reconnect, refocus) reuses the module singleton below,\n // so an explicit user collapse is never reset.\n private snapshot: LayoutSnapshot = Object.freeze({\n sidebarOpen: viewportIsWide(),\n detailsOpen: false,\n rightbarTrack: false,\n rightbarFullscreen: false,\n panelInfo: Object.freeze({ activePanelId: null }),\n })\n private readonly listeners = new Set<() => void>()\n private hasMainPanel: ((id: string) => boolean) | undefined\n // Pending workspace/session navigation, cancelled whenever a newer one\n // starts. Mirrors the official LayoutController's navigation controller.\n private navigation = new AbortController()\n\n readonly subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n }\n\n readonly getSnapshot = (): LayoutSnapshot => this.snapshot\n\n /**\n * The panel store on the layout service itself (`ctx.layout.panelInfo`),\n * mirroring the official LayoutController of DSH 0.1.7-rc.2+. The root hook\n * wired in `apply` feeds `usePanelInfo` rendering; rc.2 client plugins read\n * this service member directly. Without it `dsh-client-ui-plugin-manager`\n * fails activation on the dedicated mobile frontend (\"web boot: 1 entry did\n * not activate\") and `dsh-client-ui-open-in-app` throws the first time its\n * shortcut target runs.\n */\n readonly panelInfo = {\n getSnapshot: (): PanelInfoSnapshot => this.getSnapshot().panelInfo,\n subscribe: (listener: () => void): (() => void) => this.subscribe(listener),\n }\n\n toggleSidebar(): void {\n this.update({ sidebarOpen: !this.snapshot.sidebarOpen })\n }\n\n openDetails(): void {\n this.update({ detailsOpen: true })\n }\n\n closeDetails(): void {\n this.update({ detailsOpen: false, rightbarTrack: false, rightbarFullscreen: false })\n }\n\n closeSidebar(): void {\n this.update({ sidebarOpen: false })\n }\n\n /**\n * Invalidate the previous navigation and hand back a fresh signal. The\n * workspace controller wraps this around \"open a workspace\" and \"fork a\n * session\" (dsh-client-ui-workspace) — the path behind the sidebar's\n * new-session button. Without it startSession throws inside a\n * `.catch(reason => console.warn('new session failed:', reason))`, so the\n * button silently did nothing.\n */\n beginNavigation(): AbortSignal {\n this.navigation.abort()\n this.navigation = new AbortController()\n return this.navigation.signal\n }\n\n /** Invalidate pending navigations when this layout unloads. */\n dispose(): void {\n this.navigation.abort()\n }\n\n /** Bind panel validation to the live slot registry owned by this application. */\n bindMainPanelRegistry(hasMainPanel: (id: string) => boolean): () => void {\n this.hasMainPanel = hasMainPanel\n return () => {\n if (this.hasMainPanel === hasMainPanel) this.hasMainPanel = undefined\n }\n }\n\n /** Preserve the native seat's distinction between a docked track and fullscreen. */\n openRightbar(track = true, fullscreen = false): void {\n this.update({ detailsOpen: true, rightbarTrack: track, rightbarFullscreen: fullscreen })\n }\n\n /** Hide the right panel. */\n closeRightbar(): void {\n this.closeDetails()\n }\n\n /**\n * Select the main panel rendered in the center column; null means the\n * conversation. Mirrors the official LayoutController so the `panelInfo`\n * root hook stays truthful. Selecting a panel while the narrow overlay\n * drawer covers the center column dismisses that drawer — the user asked to\n * see the panel, not the navigation over it — while a docked wide sidebar\n * stays open.\n */\n selectPanel(panelId: string | null): void {\n if (panelId !== null && this.hasMainPanel?.(panelId) !== true) {\n throw new Error(`layout.selectPanel: main panel \"${panelId}\" is not registered`)\n }\n this.navigation.abort()\n const dismissDrawer = this.snapshot.sidebarOpen && !viewportIsWide()\n const samePanel = this.snapshot.panelInfo.activePanelId === panelId\n if (!dismissDrawer && samePanel) return\n this.update({\n ...(dismissDrawer ? { sidebarOpen: false } : {}),\n ...(samePanel ? {} : { panelInfo: Object.freeze({ activePanelId: panelId }) }),\n })\n }\n\n /** Drop a selected panel once no main-slot entry declares it. */\n retainMainPanels(panelIds: readonly string[]): void {\n const active = this.snapshot.panelInfo.activePanelId\n if (active !== null && !panelIds.includes(active)) {\n this.update({ panelInfo: Object.freeze({ activePanelId: null }) })\n }\n }\n\n private update(next: Partial<LayoutSnapshot>): void {\n const snapshot = Object.freeze({ ...this.snapshot, ...next })\n if (\n snapshot.sidebarOpen === this.snapshot.sidebarOpen\n && snapshot.detailsOpen === this.snapshot.detailsOpen\n && snapshot.rightbarTrack === this.snapshot.rightbarTrack\n && snapshot.rightbarFullscreen === this.snapshot.rightbarFullscreen\n && snapshot.panelInfo === this.snapshot.panelInfo\n ) return\n this.snapshot = snapshot\n for (const listener of this.listeners) listener()\n }\n}\n\nclass ThemePresenter {\n private appliedTokens: string[] = []\n private readonly meta = document.createElement('meta')\n\n constructor() {\n this.meta.name = 'theme-color'\n }\n\n apply(snapshot: ThemeSnapshot): void {\n const scheme = snapshot.active.colorScheme\n document.documentElement.style.colorScheme = scheme\n document.body.toggleAttribute('data-ds-dark-theme', scheme === 'dark')\n for (const name of this.appliedTokens) document.body.style.removeProperty(name)\n this.appliedTokens = []\n for (const [name, value] of Object.entries(snapshot.active.tokens)) {\n document.body.style.setProperty(name, value)\n this.appliedTokens.push(name)\n }\n this.meta.content = getComputedStyle(document.body).backgroundColor\n if (!this.meta.isConnected) document.head.append(this.meta)\n }\n\n dispose(): void {\n document.documentElement.style.removeProperty('color-scheme')\n document.body.removeAttribute('data-ds-dark-theme')\n for (const name of this.appliedTokens) document.body.style.removeProperty(name)\n this.meta.remove()\n }\n}\n\nexport const MOBILE_LAYOUT_STYLES = `\nhtml,body,#root{width:100%;height:100%;overflow:hidden}\n/* Definite height bounds the transcript on engines without dvh. Isolation keeps\n shell descendants below positive-z-index portals attached to document.body. */\n.dshm-shell{-webkit-text-size-adjust:100%;text-size-adjust:100%;position:relative;isolation:isolate;display:grid;grid-template-rows:minmax(0,1fr);width:100%;height:100%;height:100dvh;min-width:0;overflow:hidden;background:var(--dsw-alias-bg-base,#fff)}\n/* The mobile root owns its Grid geometry. Layered important rules keep broad\n unlayered skin rules from collapsing virtualized views to the header height.\n The wide/narrow band is the root attribute, not a media query: the decision\n needs the device screen size, which a media query cannot read. */\n@layer dsh-mobile-layout{\n.dshm-shell{display:grid!important;grid-template-rows:minmax(0,1fr)!important;grid-template-columns:minmax(0,1fr)!important}\n.dshm-shell[${WIDE_LAYOUT_ATTRIBUTE}=\"1\"]{grid-template-columns:auto minmax(0,1fr)!important}\n}\n.dshm-main{grid-area:1/1;position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;margin-right:0;overflow:hidden;transition:margin-right var(--ds-transition-duration-slow,190ms) var(--ds-ease-in-out,ease)}\n.dshm-mainContent{position:relative;flex:1;min-width:0;min-height:0;overflow:hidden}\n.dshm-shell[data-rightbar-docked=true] .dshm-main{margin-right:var(--dshm-rightbar-width)}\n.dshm-shell[data-rightbar-docked=true] .dshm-details{position:absolute;width:var(--dshm-rightbar-width);box-shadow:none;padding-top:0}\n/* Draw above the native absolute panel without consuming its width or\n intercepting controls; only docked mode needs this column separator. */\n.dshm-shell[data-rightbar-docked=true] .dshm-details::after{content:\"\";position:absolute;inset:0 auto 0 0;width:.5px;background:var(--dsw-alias-border-l4);z-index:11;pointer-events:none}\n/* The native panel paints itself at 100vw in fullscreen mode. Inside the\n docked overlay (94vw/460px, overflow:hidden) that layout was clipped to the\n right edge of the track, so the header slid out of view and the body showed\n only clipped line tails. A fullscreen panel owns the whole viewport. */\n.dshm-shell[data-rightbar-fullscreen=true] .dshm-details{inset:0;width:100vw;max-width:100vw;box-shadow:none}\n.dshm-main>*,.dshm-main>*>*{min-width:0}\n.dshm-drawer{position:fixed;z-index:70;inset:0 auto 0 0;box-sizing:border-box;width:56px;max-width:100%;padding-top:env(safe-area-inset-top);overflow:hidden;background-color:Canvas;background-image:linear-gradient(var(--dsw-alias-bg-layer-1,#f8fafc),var(--dsw-alias-bg-layer-1,#f8fafc));box-shadow:none;will-change:width;transition:width 240ms cubic-bezier(.22,1,.36,1),box-shadow 240ms ease}\n.dshm-drawer[data-open=true]{width:min(88vw,340px);box-shadow:18px 0 46px rgb(15 23 42 / 18%)}\n.dshm-drawer[data-open=false]{pointer-events:auto;visibility:visible}\n.dshm-drawer>*{width:100%!important;height:100%!important;transform:translateX(-6px);opacity:.94;transition:transform 220ms cubic-bezier(.22,1,.36,1),opacity 160ms ease-out}\n.dshm-drawer[data-open=true]>*{transform:translateX(0);opacity:1}\n.dshm-drawer[data-open=false]>*{width:56px!important}\n/* Folded icon rail: on narrow viewports the drawer is fixed, so give the main\n content the same 56px offset the wide grid already provides. The width floor\n keeps phone-width headers on their own inset; the band itself is the root\n attribute, so a landscape phone gets the offset too. The drawer's folded state\n owns this offset independently of nested-pane markers. */\n@media${FOLDED_RAIL_OFFSET_QUERY}{.dshm-shell:not([${WIDE_LAYOUT_ATTRIBUTE}=\"1\"]):has(.dshm-drawer[data-open=false]:not([data-right-modal=true])) .dshm-main{margin-left:56px}}\n/* display:none also suppresses fixed descendants installed by the phone adapter. */\n.dshm-drawer[data-right-modal=true]{display:none!important}\n.dshm-details{position:fixed;z-index:80;inset:0 0 0 auto;box-sizing:border-box;width:min(94vw,460px);max-width:100%;padding-top:env(safe-area-inset-top);overflow:hidden;background-color:Canvas;background-image:linear-gradient(var(--dsw-alias-bg-layer-1,#fff),var(--dsw-alias-bg-layer-1,#fff));box-shadow:-18px 0 46px rgb(15 23 42 / 18%);transform:translateX(104%);transition:transform 190ms cubic-bezier(.22,1,.36,1)}\n.dshm-details[data-open=true]{transform:translateX(0)}\n.dshm-details[data-open=false]{pointer-events:none;visibility:hidden;transition:transform 190ms cubic-bezier(.22,1,.36,1),visibility 0s linear 190ms}\n/* An absent marker is the narrow default: static fixtures and the first paint\n before React mounts keep the overlay geometry rather than a half-docked shell. */\n.dshm-shell:not([${WIDE_LAYOUT_ATTRIBUTE}=\"1\"]) .dshm-details{width:100%;max-width:100%;box-shadow:none}\n.dshm-shell:not([${WIDE_LAYOUT_ATTRIBUTE}=\"1\"]) .dshm-details [data-sidebar-right-toggle],.dshm-shell:not([${WIDE_LAYOUT_ATTRIBUTE}=\"1\"]) .dshm-details [data-sidebar-right-mode]{min-width:48px;min-height:48px}\n.dshm-scrim{position:fixed;z-index:65;inset:0;border:0;background:rgb(15 23 42 / 40%);opacity:0;pointer-events:none;transition:opacity 180ms ease-out}\n.dshm-scrim[data-open=true]{opacity:1;pointer-events:auto}\n.dshm-overlay{position:fixed;z-index:90;inset:0;pointer-events:none}.dshm-overlay>*{pointer-events:auto}\n/* Reserve navigation space instead of covering a panel's own save controls. */\n.dshm-panelNav{display:flex;align-items:center;flex-shrink:0;min-height:56px;box-sizing:border-box;padding:max(4px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) 4px max(68px,env(safe-area-inset-left));border-bottom:.5px solid var(--dsw-alias-border-l4);background-color:Canvas;background-image:linear-gradient(var(--dsw-alias-bg-base,#fff),var(--dsw-alias-bg-base,#fff))}\n.dshm-panelBack{display:inline-flex;align-items:center;gap:8px;min-width:48px;min-height:48px;padding:8px 12px;border:0;border-radius:8px;background:transparent;color:var(--dsw-alias-label-primary,#171a21);font:inherit;font-size:14px;line-height:1.4;text-align:left;cursor:pointer}\n.dshm-panelBack:hover{background:var(--dsw-alias-interactive-bg-hover,#f1f3f6)}\n.dshm-panelBack:active{background:var(--dsw-alias-interactive-bg-active,#e9ecef)}\n.dshm-panelBack:disabled{opacity:.5;cursor:default}\n.dshm-panelBack:focus-visible{outline:2px solid var(--dsw-alias-label-primary,#171a21);outline-offset:2px}\n.dshm-panelBack svg{width:20px;height:20px;flex-shrink:0}\n.dshm-shell header{min-width:0}\n/* A panel owns its header padding; only conversation content clears the rail. */\n.dshm-shell :where(.dshm-main:not([data-dsh-panel=\"1\"])) header{padding-left:52px}\n/* Keep focused editables above Safari's 16px zoom threshold while retaining\n the DSH content-font preference and larger inherited text. Stock menus\n portal into document.body, so the floor scopes from the body itself. */\nbody:has(.dshm-shell) :is(input,textarea,[contenteditable=true],[contenteditable=plaintext-only],[contenteditable=\"\"]){font-size:max(16px,1em,var(--dsh-content-font-size,1em))!important}\n.dshm-shell table{display:block;max-width:100%;overflow-x:auto}\n.dshm-shell pre{max-width:100%;overflow-x:auto}\n.dshm-shell img,.dshm-shell video,.dshm-shell canvas,.dshm-shell svg{max-width:100%}\n.dshm-shell [data-disclosure-row]{min-width:0;max-width:100%}\n.dshm-shell [data-disclosure-row]>*{min-width:0;overflow-wrap:anywhere}\n.dshm-shell [data-context-fields]>*{min-width:0}\n.dshm-shell [class*=\"_body\"]{max-width:100%;overflow-wrap:anywhere}\n@media(max-width:420px){.dshm-shell [data-context-fields]>*{display:grid;grid-template-columns:1fr!important;gap:4px}.dshm-shell [class*=\"_ioSection\"]{grid-template-columns:1fr!important}}\n@media(max-width:600px){\n.dshm-shell [data-question-key],.dshm-shell [data-plan-review-key]{box-sizing:border-box;width:100%;height:auto!important;min-width:0;flex:none!important;align-self:flex-end;padding:6px max(10px,env(safe-area-inset-left)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-right))!important}\n.dshm-shell [data-question-key]>section,.dshm-shell [data-plan-review-key]>section{width:100%;height:auto!important;min-height:0!important;max-width:none!important;max-height:min(68dvh,520px)!important;border-radius:16px!important}\n.dshm-shell [data-question-scroll],.dshm-shell [data-plan-review-scroll]{flex:0 1 auto!important;min-height:0!important;max-height:min(42dvh,360px)!important;overscroll-behavior:contain;scroll-padding-bottom:12px}\n.dshm-shell [data-question-key]>section>header{display:flex!important;visibility:visible!important;flex:none!important;gap:8px!important;padding:12px 8px 4px 14px!important}\n.dshm-shell [data-question-key]>section>header h2{min-width:0;overflow-wrap:anywhere;font-size:16px!important;line-height:22px!important}\n.dshm-shell [data-question-key]>section>header button{min-width:40px;min-height:40px}\n.dshm-shell [data-question-key] [role=radio],.dshm-shell [data-question-key] [role=checkbox]{min-height:48px!important;touch-action:manipulation}\n.dshm-shell [data-question-key]>section>footer{display:grid!important;grid-template-columns:auto minmax(0,1fr);align-items:center!important;flex:none!important;gap:6px 8px!important;margin-top:4px!important;padding:6px 10px 10px!important}\n.dshm-shell [data-question-key]>section>footer>:last-child{grid-column:1/-1;display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:8px!important}\n.dshm-shell [data-question-key]>section>footer>:last-child button{width:100%;min-height:44px}\n.dshm-shell [data-plan-review-key]>section>div:last-child{display:grid!important;grid-template-columns:1fr;gap:8px!important;padding:8px 12px 10px!important}\n.dshm-shell [data-plan-review-key]>section>div:last-child>div:last-child{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:8px!important}\n.dshm-shell [data-plan-review-key]>section>div:last-child>div:last-child>button:first-child{grid-column:1/-1}\n.dshm-shell [data-plan-review-key]>section>div:last-child button{width:100%;min-height:44px}\n}\n/* Wide band: the shell carries the decision, so these rules follow the same\n device+viewport test as the JS. An absent attribute is the narrow default. */\n.dshm-shell[${WIDE_LAYOUT_ATTRIBUTE}=\"1\"]{grid-template-columns:auto minmax(0,1fr)}\n/* The wide drawer is a static grid column, not an overlay: it occupies its own\n track and never overlaps the conversation. Keeping a z-index here made it\n outrank the conversation column, so a dialog a plugin mounts inside the\n composer's own stacking context lost its left edge behind the opaque rail.\n A static column needs no layer, so it stays in normal flow order. */\n.dshm-shell[${WIDE_LAYOUT_ATTRIBUTE}=\"1\"] .dshm-drawer{position:static;grid-area:1/1;box-shadow:none;z-index:auto}\n.dshm-shell[${WIDE_LAYOUT_ATTRIBUTE}=\"1\"] .dshm-drawer[data-open=true]{width:340px;box-shadow:none}\n.dshm-shell[${WIDE_LAYOUT_ATTRIBUTE}=\"1\"] .dshm-drawer[data-open=false]{width:56px}\n/* The conversation column outranks that column so an in-shell modal opened from\n it is not clipped by the navigation rail. It stays below the scrim (65), the\n detail panel (80) and the shell overlay (90), so a modal shell surface still\n dims and covers it. Only the wide grid needs this: on a phone the drawer is a\n floating overlay and must keep covering the conversation. */\n.dshm-shell[${WIDE_LAYOUT_ATTRIBUTE}=\"1\"] .dshm-main{grid-area:1/2;z-index:1}\n@media(prefers-reduced-motion:reduce){.dshm-drawer,.dshm-details,.dshm-scrim,.dshm-drawer>*,.dshm-main{transition:none!important}}\n/* Touch adaptation changes control boxes, not invisible hit regions. Root opt-out\n retains pane geometry too; nested opt-out preserves a widget's own controls.\n DSH's plugin cards open through a cardTitle/cardOpen button whose ::after\n overlay already owns the whole card hit area; the floor only inflated that\n title box and pushed each description away from its card title. */\n@media(pointer:coarse){\n.dshm-main[data-dsh-panel=\"1\"] .dshm-mainContent:has(>[data-slot=\"main\"]>:not([data-dsh-adapt=\"off\"])):not(:has(>[data-slot=\"main\"]>[data-dsh-adapt=\"off\"])){overflow-y:auto;overscroll-behavior:contain}\n.dshm-main[data-dsh-panel=\"1\"] .dshm-mainContent>[data-slot=\"main\"]>:not([data-dsh-adapt=\"off\"]){max-width:100%;box-sizing:border-box}\n.dshm-main[data-dsh-panel=\"1\"] [data-slot=\"main\"]>:not([data-dsh-adapt=\"off\"]) :is(button,[role=\"button\"],select,input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]):not([type=color]):not([type=file]):not([type=image])):not([role=\"switch\"],[role=\"checkbox\"],[role=\"radio\"],[role=\"slider\"],button[class*=\"_cardTitle\"][class*=\"_cardOpen\"],[data-dsh-adapt=\"off\"],[data-dsh-adapt=\"off\"] *){min-width:44px!important;min-height:44px!important}\n.dshm-main[data-dsh-panel=\"1\"] [data-slot=\"main\"]>:not([data-dsh-adapt=\"off\"]) :is(button,[role=\"button\"],a):not([data-dsh-adapt=\"off\"],[data-dsh-adapt=\"off\"] *){touch-action:manipulation}\n}\n`\n\nfunction MobileAppFrame(props: MobileRootProps & {\n readonly controller: MobileLayoutController\n readonly requestDetailsClose: () => void\n}): ReactNode {\n const state = useSyncExternalStore(props.controller.subscribe, props.controller.getSnapshot)\n const suppressKeyboardUntil = useRef(0)\n const suppressComposerUntil = useRef(0)\n const previousPanelId = useRef(state.panelInfo.activePanelId)\n const navigationIme = useRef(new Map<HTMLElement, string | null>())\n const restoreNavigationIme = (): void => {\n for (const [editor, previous] of navigationIme.current) {\n if (editor.getAttribute('inputmode') !== 'none') continue\n if (previous === null) editor.removeAttribute('inputmode')\n else editor.setAttribute('inputmode', previous)\n }\n navigationIme.current.clear()\n }\n useLayoutEffect(() => {\n const previous = previousPanelId.current\n previousPanelId.current = state.panelInfo.activePanelId\n if (previous === null || state.panelInfo.activePanelId !== null\n || !window.matchMedia(TOUCH_PRIMARY_QUERY).matches) return\n // All panel exits precede the remounted composer's passive autofocus.\n restoreNavigationIme()\n suppressComposerUntil.current = performance.now() + 500\n const active = document.activeElement\n if (active instanceof HTMLElement && active.matches(COMPOSER_EDITOR_SELECTOR)) active.blur()\n }, [state.panelInfo.activePanelId])\n // The width decides whether the window is big enough and the device's shorter\n // side decides whether it is a tablet: width alone would dock a landscape\n // phone, and the viewport height alone would undock a tablet whose soft\n // keyboard is open (Pad 9 Pro Max reports innerHeight 441 in landscape).\n // `resize` fires on rotation, window resizing and keyboard-driven viewport\n // changes, so both facts are re-read with the same frame-coalesced measurement.\n const [viewport, setViewport] = useState(readViewport)\n useEffect(() => {\n let frame: number | undefined\n const resize = (): void => {\n if (frame !== undefined) return\n frame = window.requestAnimationFrame(() => {\n frame = undefined\n setViewport(readViewport())\n })\n }\n window.addEventListener('resize', resize)\n return () => {\n window.removeEventListener('resize', resize)\n if (frame !== undefined) window.cancelAnimationFrame(frame)\n }\n }, [])\n const viewportWidth = viewport.width\n const wideViewport = isWideViewportLayout(viewport.width, viewport.shortSide)\n const rightbar = resolveMobileRightbarLayout(\n viewport.width,\n wideViewport,\n state.sidebarOpen,\n state.rightbarTrack,\n state.rightbarFullscreen,\n )\n const rightbarDocked = state.detailsOpen && rightbar.docked\n // DSH reports a fullscreen panel through the layout service; the overlay has\n // to hand over the whole viewport instead of its docked track (see the\n // `data-rightbar-fullscreen` rule). Phones derive fullscreen from their\n // width, so the flag is already set there.\n const rightbarFullscreen = state.detailsOpen && state.rightbarFullscreen\n // The panel owns the viewport on phones (no column fits) and in fullscreen on\n // a wider screen, so the conversation behind it is inert and needs no scrim.\n const rightbarFullWidth = state.detailsOpen && !rightbarDocked && (!wideViewport || rightbarFullscreen)\n const [documentLanguage, setDocumentLanguage] = useState(document.documentElement.lang)\n const browserLanguages = navigator.languages.length > 0 ? navigator.languages : [navigator.language]\n const language = resolveMobileLayoutLanguage(documentLanguage, browserLanguages)\n const messages = MOBILE_LAYOUT_MESSAGES[language]\n const scrimOpen = !rightbarFullWidth && isMobileScrimOpen(state.sidebarOpen, state.detailsOpen && !rightbarDocked, wideViewport)\n const activeSessionId = props.useSessions(session => {\n const current = session.current\n return current !== undefined && session.byId[current]?.blank === false ? current : undefined\n })\n const hasSession = activeSessionId !== undefined\n\n // Warm DSH session-query's prepared-session cache for the session the user just\n // left after a switch settles (issue #291). Opt-in via the session-prefetch\n // configuration; silent, read-only and bounded so it never disturbs normal\n // requests or live streams.\n const prefetchEnabled = useSyncExternalStore(\n subscribeSessionPrefetchEnabled,\n readSessionPrefetchEnabled,\n () => false,\n )\n const prefetchTracker = useRef<SessionPrefetchTracker | undefined>(undefined)\n const prefetchTimer = useRef<number | undefined>(undefined)\n const prefetchDispose = useRef<(() => void) | undefined>(undefined)\n // Rebuild the tracker when the opt-in flips: the switch is part of the config,\n // and a stale tracker would keep answering `skip('disabled')` (or keep warming\n // after the user turned it off).\n if (prefetchTracker.current === undefined || prefetchTracker.current.enabled !== prefetchEnabled) {\n prefetchTracker.current = new SessionPrefetchTracker(sessionPrefetchConfigFrom(prefetchEnabled))\n }\n useEffect(() => {\n if (activeSessionId === undefined) return\n const decision = prefetchTracker.current!.switchTo(activeSessionId)\n if (decision.action !== 'warm') return\n const target = decision.target\n if (prefetchTimer.current !== undefined) clearTimeout(prefetchTimer.current)\n prefetchTimer.current = window.setTimeout(() => {\n prefetchTimer.current = undefined\n // Keep the disposer: leaving the session (or unmounting) should abort a\n // request that would otherwise run to its timeout in the background.\n prefetchDispose.current?.()\n prefetchDispose.current = prefetchSession(fetch, target, SESSION_PREFETCH_DEFAULTS.timeoutMs)\n }, SESSION_PREFETCH_DEFAULTS.settleMs)\n return () => {\n if (prefetchTimer.current !== undefined) { clearTimeout(prefetchTimer.current); prefetchTimer.current = undefined }\n prefetchDispose.current?.()\n prefetchDispose.current = undefined\n }\n }, [activeSessionId, prefetchEnabled])\n\n useEffect(() => {\n const observer = new MutationObserver(() => { setDocumentLanguage(document.documentElement.lang) })\n observer.observe(document.documentElement, { attributes: true, attributeFilter: ['lang'] })\n return () => { observer.disconnect() }\n }, [])\n\n useEffect(() => {\n if (!hasSession) props.controller.closeDetails()\n }, [hasSession, props.controller])\n\n // Mirror the stock layout: project the current session title into the\n // browser tab, restoring the product title when no session is selected.\n const sessionTitle = props.useSessions(session =>\n session.current === undefined ? undefined : session.byId[session.current]?.title,\n )\n useEffect(() => {\n const productTitle = document.title\n if (sessionTitle !== undefined) document.title = `${sessionTitle} — ${productTitle}`\n return () => { document.title = productTitle }\n }, [sessionTitle])\n\n useEffect(() => {\n const elementTarget = (target: EventTarget | null): Element | null =>\n target instanceof Element ? target : null\n const suppressAutofocus = (event: FocusEvent): void => {\n const target = elementTarget(event.target)\n if (target === null) return\n const editable = target instanceof HTMLElement && (target.matches('input,textarea') || target.isContentEditable)\n if (!editable) return\n if (isComposerOwnedFocus(target)) {\n if (performance.now() < suppressComposerUntil.current) target.blur()\n return\n }\n if (performance.now() >= suppressKeyboardUntil.current) return\n target.blur()\n }\n const suppressBranchAutofocus = (event: MouseEvent): void => {\n if (!(event.target instanceof Element)) return\n const branch = event.target.closest('button[aria-label*=\"分支\"],button[aria-label*=\"Branch\"],button[aria-label*=\"branch\"],button[aria-label*=\"Ramo\"],button[aria-label*=\"ramo\"]')\n if (branch === null || branch.hasAttribute('disabled') || branch.getAttribute('aria-disabled') === 'true') return\n suppressKeyboardUntil.current = performance.now() + 700\n window.setTimeout(() => {\n const active = document.activeElement\n if (active instanceof HTMLElement && (active.matches('input,textarea') || active.isContentEditable)) active.blur()\n }, 0)\n }\n // The native composer deliberately preserves editor focus when its Add menu\n // opens, and on a phone that focus summons the soft keyboard. Withholding the\n // IME leaves the focus, the caret, and the draft exactly as stock left them;\n // any other tap restores the keyboard.\n const applyComposerImePolicy = (event: PointerEvent): void => {\n const target = elementTarget(event.target)\n // A deliberate tap in the composer ends the navigation-only suppression\n // before focus can reach the editor. The Add trigger then reclaims its\n // existing inputmode=\"none\" policy below.\n if (isComposerOwnedFocus(target)) {\n suppressComposerUntil.current = 0\n restoreNavigationIme()\n }\n const policy = resolveComposerImePolicy(\n target,\n window.matchMedia(TOUCH_PRIMARY_QUERY).matches,\n )\n if (policy === 'ignore') return\n for (const editor of document.querySelectorAll<HTMLElement>(COMPOSER_EDITOR_SELECTOR)) {\n if (policy === 'withhold') editor.setAttribute('inputmode', 'none')\n else if (editor.getAttribute('inputmode') === 'none') editor.removeAttribute('inputmode')\n }\n }\n document.addEventListener('focusin', suppressAutofocus, true)\n document.addEventListener('click', suppressBranchAutofocus, true)\n // A finger tap never fires mousedown on Android, and this has to land before\n // the trigger's own focus, so it runs on capture for pointerdown.\n document.addEventListener('pointerdown', applyComposerImePolicy, true)\n const disposeSendKeyboard = installComposerSendKeyboardPolicy(() => {\n suppressComposerUntil.current = performance.now() + 700\n })\n return () => {\n document.removeEventListener('focusin', suppressAutofocus, true)\n document.removeEventListener('click', suppressBranchAutofocus, true)\n document.removeEventListener('pointerdown', applyComposerImePolicy, true)\n disposeSendKeyboard()\n restoreNavigationIme()\n // A withheld editor outliving the surface would strand the composer without\n // a keyboard for the rest of the session.\n for (const editor of document.querySelectorAll<HTMLElement>(`${COMPOSER_CARD_SELECTOR} [inputmode=\"none\"]`)) {\n editor.removeAttribute('inputmode')\n }\n }\n }, [])\n\n // Session navigation on touch withholds upstream composer autofocus; only a\n // narrow overlay drawer closes after the row's own click handler completes.\n const closeDrawerAfterSessionAction = (event: { readonly target: EventTarget | null }): void => {\n if (!(event.target instanceof Element)) return\n if (isSessionRowNavigation(event.target) && window.matchMedia(TOUCH_PRIMARY_QUERY).matches) {\n const deadline = performance.now() + 500\n suppressComposerUntil.current = deadline\n for (const editor of document.querySelectorAll<HTMLElement>(COMPOSER_EDITOR_SELECTOR)) {\n if (!navigationIme.current.has(editor)) navigationIme.current.set(editor, editor.getAttribute('inputmode'))\n editor.setAttribute('inputmode', 'none')\n if (document.activeElement === editor) editor.blur()\n }\n window.setTimeout(() => {\n if (suppressComposerUntil.current !== deadline) return\n suppressComposerUntil.current = 0\n restoreNavigationIme()\n }, 500)\n }\n if (viewportIsWide()) return\n const row = event.target.closest<HTMLElement>('[role=\"treeitem\"][aria-selected]')\n const action = event.target.closest('button,[role=\"button\"]')\n const startsSession = action?.matches('button[class*=\"_newSession\"],button[class*=\"_brand\"]')\n || /新建会话|新会话|new session|new conversation|nuova sessione|nuova conversazione/i.test(action?.getAttribute('aria-label') ?? '')\n if (row === null && !startsSession) return\n if (row !== null && action !== null && action !== row) return\n suppressKeyboardUntil.current = performance.now() + 500\n // Let the session row finish its own click handler before unmounting the drawer.\n window.setTimeout(() => {\n props.controller.closeSidebar()\n const active = document.activeElement\n if (active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement) active.blur()\n }, 0)\n }\n\n return createElement('div', {\n className: 'dshm-shell', lang: language,\n // The stylesheet follows this marker instead of a media query: the band\n // depends on `screen`, which CSS cannot read. It is part of the first render,\n // so a tablet never paints the drawer band and then reflows.\n [WIDE_LAYOUT_ATTRIBUTE]: wideViewport ? '1' : '0',\n 'data-rightbar-docked': rightbarDocked,\n 'data-rightbar-fullscreen': rightbarFullscreen,\n style: { '--dshm-rightbar-width': `${rightbar.width}px` },\n },\n createElement('main', {\n className: 'dshm-main',\n 'data-dsh-mobile-session': activeSessionId,\n ...(rightbarFullWidth ? { inert: '', 'aria-hidden': true } : {}),\n // Legacy dsh-web community plugins use semantic pane attributes as their\n // compatibility path when the stock CSS-module column names are absent.\n 'data-pane': 'conversation',\n // A third-party panel is open: the host owes its controls a touch-sized hit area\n // (see the plugin-panel block in MOBILE_LAYOUT_STYLES).\n 'data-dsh-panel': state.panelInfo.activePanelId === null ? '0' : '1',\n },\n state.panelInfo.activePanelId !== null && !wideViewport ? createElement('div', {\n className: 'dshm-panelNav',\n }, createElement('button', {\n type: 'button',\n className: 'dshm-panelBack',\n 'aria-label': messages.backToConversation,\n disabled: state.sidebarOpen,\n onClick: () => { props.controller.selectPanel(null) },\n }, createElement('svg', {\n 'aria-hidden': true, viewBox: '0 0 24 24', fill: 'none',\n }, createElement('path', {\n d: 'M15 5l-7 7 7 7',\n stroke: 'currentColor', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round',\n })), createElement('span', null, messages.backToConversation))) : null,\n createElement('div', { className: 'dshm-mainContent' }, props.renderSlot('main', {}, {\n entryKey: state.panelInfo.activePanelId ?? 'conversation',\n fallback: props.renderSlot('conversation', {}),\n }))),\n createElement('button', {\n 'aria-label': messages.closePanels,\n className: 'dshm-scrim',\n // A persistent wide sidebar needs no dimming; the scrim only covers\n // the narrow overlay drawer and the details panel.\n 'data-open': scrimOpen,\n 'aria-hidden': !scrimOpen,\n onClick: () => {\n if (!scrimOpen) return\n state.detailsOpen ? props.requestDetailsClose() : props.controller.closeSidebar()\n },\n tabIndex: scrimOpen ? 0 : -1,\n type: 'button',\n }),\n createElement('aside', {\n 'aria-label': messages.workspaceNavigation,\n className: 'dshm-drawer',\n 'data-pane': 'sidebar',\n 'data-open': state.sidebarOpen,\n // The phone adapter promotes the whale toggle to a fixed high layer.\n // Remove that entire navigation surface while the right modal owns focus.\n 'data-right-modal': state.detailsOpen && !rightbarDocked,\n ...(state.detailsOpen && !rightbarDocked ? { inert: '', 'aria-hidden': true } : {}),\n // Community rows collapse their label when an ancestor carries this marker.\n ...(state.sidebarOpen ? {} : { 'data-sidebar-collapsed': '' }),\n onClickCapture: closeDrawerAfterSessionAction,\n }, props.renderSlot('sidebar', {\n collapsed: !state.sidebarOpen,\n width: state.sidebarOpen ? 340 : 56,\n })),\n createElement('aside', {\n 'aria-hidden': !state.detailsOpen,\n className: 'dshm-details',\n 'data-open': state.detailsOpen,\n ...(state.detailsOpen ? {} : { inert: '' }),\n }, [\n // DSH 0.1.3 and earlier bind details to a Session. Newer DSH owns the\n // Session decision inside its root-scoped rightbar occupant, so that\n // occupant must stay mounted even while no Session is selected.\n hasSession ? props.renderSlot('details', {}) : undefined,\n props.renderSlot('rightbar', {\n width: rightbar.width,\n viewportWidth,\n // The official frame reports whether a persistent column still fits\n // (normal.rightbar > 0); this layout renders the right panel in the\n // details overlay, which needs no column space. Reporting false would\n // make RightbarSeat force the surface closed immediately after opening\n // it (ui-sidebar-right: `shown && !fullscreen && !canShow` ->\n // actions.setExpanded(false)), so the panel could never stay open on a\n // phone-width viewport.\n canShow: true,\n }),\n ]),\n createElement('div', { className: 'dshm-overlay', 'data-shell-overlay': true }, props.renderSlot('shell.overlay', {})),\n )\n}\n\n// One controller per document: re-applying the layout (reconnect, tab\n// refocus) must not reset the user's explicit sidebar toggle.\nlet sharedController: MobileLayoutController | undefined\n\n/** Replace the desktop layout module on the authenticated mobile surface. */\nexport function apply(ctx: MobileClientContext): void {\n sharedController ??= new MobileLayoutController()\n const controller = sharedController\n ctx.effect(() => {\n const style = document.createElement('style')\n style.dataset.plugin = 'dsh-mobile-layout'\n style.textContent = MOBILE_LAYOUT_STYLES\n document.head.append(style)\n const disposeMainPanelRegistry = controller.bindMainPanelRegistry(id =>\n ctx.slots.entries('main').some(entry => entry.options.key === id))\n const disposeService = ctx.reflect.provide('layout', controller)\n // The official layout owns the root `panelInfo` hook; replacing the layout\n // module means replacing that owner. Without it every registration that\n // declares the standard `usePanelInfo` prop fails assembly\n // (\"strict standard hook 'panelInfo' has no source\") and renders as a dead\n // cell — the workspace sidebar's session list lives exactly there.\n const disposePanelInfo = typeof ctx.slots.provideRoot === 'function'\n ? ctx.slots.provideRoot({ hooks: { panelInfo: controller.panelInfo } })\n : () => {}\n const requestDetailsClose = (): void => {\n closeDetailsFromScrim(ctx.get('sidebarRight'), () => { controller.closeDetails() })\n }\n const disposeRoot = ctx.slots.register<MobileRootProps>({\n name: 'root',\n children: {\n sidebar: { kind: 'single', scope: 'root' },\n conversation: { kind: 'single', scope: 'session-maybe' },\n // The conversation panel moved into this keyed slot in DSH 0.1.5;\n // without the declaration the center column stays blank.\n main: { kind: 'keyed', scope: 'root' },\n rightbar: { kind: 'single', scope: 'root' },\n details: { kind: 'single', scope: 'session' },\n 'shell.overlay': { kind: 'list', scope: 'root' },\n },\n }, props => createElement(MobileAppFrame, {\n ...props,\n controller,\n // sidebarRight is registered after the layout it depends on, so resolve\n // the optional service at gesture time rather than caching it at boot.\n requestDetailsClose,\n }))\n const onNativeBack = (event: Event): void => {\n if (!event.cancelable || event.defaultPrevented) return\n const state = controller.getSnapshot()\n if (state.detailsOpen) {\n event.preventDefault()\n requestDetailsClose()\n } else if (!viewportIsWide() && state.sidebarOpen) {\n event.preventDefault()\n controller.closeSidebar()\n } else if (state.panelInfo.activePanelId !== null) {\n event.preventDefault()\n controller.selectPanel(null)\n }\n }\n window.addEventListener('dsh-mobile:native-back', onNativeBack)\n const retainMainPanels = (): void => {\n controller.retainMainPanels(ctx.slots.entries('main').flatMap(entry =>\n entry.options.key === undefined ? [] : [entry.options.key]))\n }\n const disposePanels = ctx.slots.subscribe('main', retainMainPanels)\n retainMainPanels()\n return () => {\n window.removeEventListener('dsh-mobile:native-back', onNativeBack)\n controller.dispose()\n disposePanels()\n disposeRoot()\n disposePanelInfo()\n void disposeService()\n disposeMainPanelRegistry()\n style.remove()\n }\n }, 'dsh-mobile: dedicated root layout')\n\n ctx.effect(() => {\n const presenter = new ThemePresenter()\n presenter.apply(ctx.theme.getTheme())\n const off = ctx.on('theme/change', snapshot => { presenter.apply(snapshot) })\n return () => { off(); presenter.dispose() }\n }, 'dsh-mobile: theme presenter')\n}\n\n/** Preserve the official layout module's dependency ordering. */\nexport const inject: readonly string[] = ['slots', 'theme']\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAYA,MAAa,wBAAwB;;ECVrC,MAAa,yBAAyB,OAAO,OAAO;GAClD,IAAI,OAAO,OAAO;IAAE,aAAa;IAAmB,qBAAqB;IAAyC,oBAAoB;GAA2B,CAAC;GAClK,IAAI,OAAO,OAAO;IAAE,aAAa;IAAgB,qBAAqB;IAAoC,oBAAoB;GAAuB,CAAC;GACtJ,IAAI,OAAO,OAAO;IAAE,aAAa;IAAQ,qBAAqB;IAAY,oBAAoB;GAAO,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MACrB,WAAW,YAAY,IAAI;KAC7B;IACF;IACA,OAAO,iBAAiB,0BAA0B,YAAY;IAC9D,MAAM,yBAA+B;KACnC,WAAW,iBAAiB,IAAI,MAAM,QAAQ,MAAM,CAAC,CAAC,SAAQ,UAC5D,MAAM,QAAQ,QAAQ,KAAA,IAAY,CAAC,IAAI,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC;IAC/D;IACA,MAAM,gBAAgB,IAAI,MAAM,UAAU,QAAQ,gBAAgB;IAClE,iBAAiB;IACjB,aAAa;KACX,OAAO,oBAAoB,0BAA0B,YAAY;KACjE,WAAW,QAAQ;KACnB,cAAc;KACd,YAAY;KACZ,iBAAiB;KACjB,eAAoB;KACpB,yBAAyB;KACzB,MAAM,OAAO;IACf;GACF,GAAG,mCAAmC;GAEtC,IAAI,aAAa;IACf,MAAM,YAAY,IAAI,eAAe;IACrC,UAAU,MAAM,IAAI,MAAM,SAAS,CAAC;IACpC,MAAM,MAAM,IAAI,GAAG,iBAAgB,aAAY;KAAE,UAAU,MAAM,QAAQ;IAAE,CAAC;IAC5E,aAAa;KAAE,IAAI;KAAG,UAAU,QAAQ;IAAE;GAC5C,GAAG,6BAA6B;EAClC;;EAGA,MAAa,SAA4B,CAAC,SAAS,OAAO"}
1
+ {"version":3,"file":"mobile-layout.js","names":["COMPOSER_CARD_SELECTOR","COMPOSER_EDITOR_SELECTOR","useSyncExternalStore","useRef","useState","createElement"],"sources":["../src/mobile-layout-attributes.ts","../src/mobile-layout-messages.ts","../src/composer-collapse.ts","../src/session-prefetch.ts","../src/mobile-layout.ts"],"sourcesContent":["/**\n * Root marker the dedicated layout publishes for its wide/narrow band.\n *\n * The band depends on the device screen size, which a media query cannot read,\n * so the layout decides it in JS and writes this attribute on `.dshm-shell`:\n * `\"1\"` docks the sidebar, anything else — `\"0\"`, or no marker — is the overlay\n * drawer. The stylesheet and the sidebar scroll adapter both follow the marker,\n * so the band has exactly one owner.\n *\n * This module stays free of imports: the dedicated layout bundle and the native\n * client bundle both use it, and neither should pull the other in.\n */\nexport const WIDE_LAYOUT_ATTRIBUTE = 'data-dshm-wide'\n","export type MobileLayoutLanguage = 'it' | 'en' | 'zh'\n\nexport const MOBILE_LAYOUT_MESSAGES = Object.freeze({\n it: Object.freeze({ closePanels: 'Chiudi pannelli', workspaceNavigation: 'Navigazione area di lavoro e sessioni', backToConversation: 'Torna alla conversazione', composerRestore: 'Mostra il campo di scrittura' }),\n en: Object.freeze({ closePanels: 'Close panels', workspaceNavigation: 'Workspace and session navigation', backToConversation: 'Back to conversation', composerRestore: 'Show composer' }),\n zh: Object.freeze({ closePanels: '关闭浮层', workspaceNavigation: '工作区与会话导航', backToConversation: '返回会话', composerRestore: '展开输入框' }),\n})\n","/**\n * Reading-mode composer collapse for the dedicated Mobile layout (issue #194).\n *\n * While the user scrolls down through a long conversation, the composer keeps\n * its full multi-row height and crowds the reading area. This module tracks the\n * conversation scroller and collapses the composer once the user has scrolled\n * down past roughly one viewport while reading, then expands it again when the\n * user scrolls back up toward the top (reading is done, input is likely).\n *\n * The feature is opt-in and disabled by default, so existing layouts are never\n * silently changed. Collapse is a CSS-only presentation toggle driven by a\n * data- attribute on the document element; the composer and its draft stay owned\n * by DSH. A collapse is always recoverable: tapping the collapsed card, focusing\n * the composer, opening the keyboard, having a draft, a running reply, or\n * scrolling toward the top expands it again.\n */\n\nexport type ComposerCollapseState = 'expanded' | 'collapsed'\n\nexport interface ComposerCollapseConfig {\n /** Master switch; disabled by default so the behavior is opt-in. */\n readonly enabled: boolean\n /** Scroll distance (px) that counts as \"reading down\" past one viewport. */\n readonly collapseThresholdPx: number\n /** A downward run resets when the user scrolls up at least this far (px). */\n readonly reverseResetPx: number\n}\n\nexport const COMPOSER_COLLAPSE_DEFAULTS: Readonly<ComposerCollapseConfig> = {\n enabled: false,\n collapseThresholdPx: 480,\n reverseResetPx: 80,\n}\n\n/**\n * Track cumulative reading progress across scroll events. This is the only\n * collapse policy: a decision table plus accumulated progress, kept out of the\n * component so it stays testable without a DOM.\n */\nexport class ComposerCollapseTracker {\n private readingProgress = 0\n private reverseProgress = 0\n private state: ComposerCollapseState = 'expanded'\n private config: Readonly<ComposerCollapseConfig>\n\n constructor(config: Readonly<ComposerCollapseConfig>) {\n this.config = config\n }\n\n /** Whether the opt-in switch is currently on. */\n get enabled(): boolean {\n return this.config.enabled\n }\n\n /** Update whether collapse is enabled (the user's settings toggle). */\n setEnabled(enabled: boolean): void {\n this.config = { ...this.config, enabled }\n if (!enabled) this.reset()\n }\n\n /**\n * Feed one scroll sample; returns the resulting presentation state.\n *\n * reverseResetPx is a deliberate dead zone: a collapsed composer stays\n * collapsed until the user scrolls back up at least that far, so a 1px jitter\n * does not flip the layout on every frame.\n */\n sample(deltaY: number): ComposerCollapseState {\n if (!this.config.enabled) {\n this.reset()\n return this.state\n }\n if (this.state === 'collapsed') {\n if (deltaY > 0) {\n // Still reading down; restart any pending reverse run.\n this.reverseProgress = 0\n return this.state\n }\n this.reverseProgress += -deltaY\n if (this.reverseProgress >= Math.max(this.config.reverseResetPx, 1)) this.reset()\n return this.state\n }\n if (deltaY < 0) {\n // Scrolling up reduces reading intent.\n this.readingProgress = Math.max(0, this.readingProgress + deltaY)\n this.reverseProgress = 0\n return this.state\n }\n this.readingProgress += deltaY\n this.reverseProgress = 0\n if (this.readingProgress >= this.config.collapseThresholdPx) this.state = 'collapsed'\n return this.state\n }\n\n /** User interacted with the composer (focus, tap, keyboard, draft): expand. */\n expand(): void {\n this.reset()\n }\n\n get stateValue(): ComposerCollapseState {\n return this.state\n }\n\n /** @internal exposed for tests */\n progress(): number {\n return this.readingProgress\n }\n\n private reset(): void {\n this.state = 'expanded'\n this.readingProgress = 0\n this.reverseProgress = 0\n }\n}\n\n/**\n * Storage key for the opt-in switch.\n *\n * The setting row lives in the client bundle while the tracker lives in the\n * layout bundle, and tsdown.config.ts emits those as two independent CJS modules\n * that each inline this file. A module-level singleton therefore cannot carry the\n * value across: the row would flip its own copy while the layout kept the\n * boot-time value, and the toggle would only apply after a reload. The persisted\n * flag plus the two events below are the shared state instead, mirroring the\n * session-prefetch opt-in.\n */\nexport const COMPOSER_COLLAPSE_STORAGE_KEY = 'dsh-mobile.composer-collapse.enabled'\nexport const COMPOSER_COLLAPSE_EVENT = 'dsh-mobile:composer-collapse-change'\n\n/**\n * Last value written in this page when storage refused the write.\n *\n * This is a per-bundle fallback for the blocked-storage case only: it is not the\n * cross-bundle transport (that is the persisted flag plus the events above). It\n * exists so a switch that cannot be persisted still reads back as flipped in the\n * same page, instead of the row snapping back while the layout obeys the event.\n */\nlet unpersistedEnabled: boolean | undefined\n\n/** Read the persisted opt-in. Defaults to off; unreadable storage keeps it off. */\nexport function readComposerCollapseEnabled(storage?: Pick<Storage, 'getItem'> | null): boolean {\n try {\n // Resolved inside the try: a restricted WebView can throw from the getter.\n const resolved = storage === undefined ? globalThis.localStorage : storage\n const stored = resolved?.getItem(COMPOSER_COLLAPSE_STORAGE_KEY) ?? null\n if (stored !== null) return stored === 'true'\n return storage === undefined ? unpersistedEnabled ?? false : false\n } catch {\n return storage === undefined ? unpersistedEnabled ?? false : false\n }\n}\n\n/** Persist the opt-in and notify the layout bundle in the same page. */\nexport function writeComposerCollapseEnabled(enabled: boolean, storage?: Pick<Storage, 'setItem'> | null): void {\n try {\n const resolved = storage === undefined ? globalThis.localStorage : storage\n if (resolved === null) throw new Error('storage unavailable')\n resolved.setItem(COMPOSER_COLLAPSE_STORAGE_KEY, String(enabled))\n if (storage === undefined) unpersistedEnabled = undefined\n } catch {\n // Blocked storage still lets this page react through the event below, and the\n // in-page read has to agree with it or the row and the layout diverge.\n if (storage === undefined) unpersistedEnabled = enabled\n }\n try {\n globalThis.dispatchEvent?.(new CustomEvent(COMPOSER_COLLAPSE_EVENT, { detail: { enabled } }))\n } catch {\n /* CustomEvent is missing in some test environments; the storage event still applies. */\n }\n}\n\n/**\n * Subscribe to opt-in changes coming from either bundle. The listener is not\n * called with the initial value; read it once with readComposerCollapseEnabled().\n */\nexport function subscribeComposerCollapseEnabled(listener: (enabled: boolean) => void): () => void {\n const onStorage = (event: StorageEvent): void => {\n if (event.key !== null && event.key !== COMPOSER_COLLAPSE_STORAGE_KEY) return\n listener(readComposerCollapseEnabled())\n }\n const onCustom = (event: Event): void => {\n const detail = (event as CustomEvent<{ enabled?: boolean }>).detail\n listener(detail?.enabled ?? readComposerCollapseEnabled())\n }\n globalThis.addEventListener?.('storage', onStorage)\n globalThis.addEventListener?.(COMPOSER_COLLAPSE_EVENT, onCustom)\n return () => {\n globalThis.removeEventListener?.('storage', onStorage)\n globalThis.removeEventListener?.(COMPOSER_COLLAPSE_EVENT, onCustom)\n }\n}\n\n/** Apply the persisted opt-in onto a base config. */\nexport function composerCollapseConfigFrom(\n enabled: boolean,\n base: Readonly<ComposerCollapseConfig> = COMPOSER_COLLAPSE_DEFAULTS,\n): ComposerCollapseConfig {\n return { ...base, enabled }\n}\n\n/**\n * 软键盘开合监听。\n * 键盘弹起(visualViewport 缩小)意味着用户要输入,应展开收起态。\n * 封装在这里而不是 layout,是为了让 layout 源码不含 visualViewport——\n * 那里只用 window.innerWidth 判宽屏,否则软键盘缩小可视视口会把手机误判成宽屏。\n */\nexport function onViewportResize(handler: () => void): () => void {\n const viewport = globalThis.visualViewport\n if (viewport === null || viewport === undefined) return () => {}\n viewport.addEventListener('resize', handler)\n return () => { viewport.removeEventListener('resize', handler) }\n}\n\n/**\n * DOM wiring for reading mode. Kept here rather than in mobile-layout.ts so the\n * behavior can be exercised against a real scroll container in the browser\n * fixture, and so the layout source keeps its width-only viewport guard.\n */\nexport interface ComposerReadingModeOptions {\n /** Localized label rendered on the collapsed card. */\n readonly restoreLabel: string\n /** Whether the active session is streaming a reply right now. */\n readonly isRunning: () => boolean\n /** Injected in tests; defaults to the live document. */\n readonly doc?: Document\n}\n\nexport interface ComposerReadingModeHandle {\n /** Force the composer back open (session switch, running reply, teardown). */\n expand(): void\n dispose(): void\n}\n\nconst COLLAPSED_ATTRIBUTE = 'data-dsh-mobile-composer-collapsed'\nconst RESTORE_LABEL_PROPERTY = '--dshm-composer-restore-label'\nconst CONVERSATION_SCROLL_SELECTOR = '[data-conversation-scroll]'\nconst COMPOSER_CARD_SELECTOR = '[data-composer-card]'\nconst COMPOSER_EDITOR_SELECTOR = `${COMPOSER_CARD_SELECTOR} :is([contenteditable=\"true\"],[contenteditable=\"plaintext-only\"],[contenteditable=\"\"],textarea)`\n\n/**\n * Install the reading-mode collapse. Opt-in through the persisted switch, off by\n * default; the composer and its draft stay owned by DSH, this only toggles a\n * presentation attribute on the document element.\n */\nexport function installComposerReadingMode(options: ComposerReadingModeOptions): ComposerReadingModeHandle {\n const doc = options.doc ?? globalThis.document\n const root = doc.documentElement\n const tracker = new ComposerCollapseTracker(composerCollapseConfigFrom(readComposerCollapseEnabled()))\n let collapsed = false\n const view = doc.defaultView\n const apply = (next: boolean): void => {\n if (collapsed === next) return\n collapsed = next\n root.setAttribute(COLLAPSED_ATTRIBUTE, next ? 'true' : 'false')\n }\n const expand = (): void => {\n tracker.expand()\n apply(false)\n }\n // The label travels as a custom property: the collapsed card is DSH-owned\n // React output, so a generated label is safer than an injected child.\n root.style.setProperty(RESTORE_LABEL_PROPERTY, JSON.stringify(options.restoreLabel))\n const scroller = (): HTMLElement | undefined => {\n const found = doc.querySelector(CONVERSATION_SCROLL_SELECTOR)\n return found instanceof (view?.HTMLElement ?? Object) ? found as HTMLElement : undefined\n }\n // The document itself never scrolls (html/body/#root are height:100% with\n // overflow:hidden); the conversation scrolls inside the container above, so its\n // scrollTop is the only truthful reading progress.\n let lastTop = scroller()?.scrollTop ?? 0\n let rafPending = false\n const sample = (): void => {\n rafPending = false\n const port = scroller()\n if (port === undefined) return\n const top = port.scrollTop\n const delta = top - lastTop\n lastTop = top\n // A streaming reply returns the composer phase to plain, so Stop has to stay\n // reachable: never collapse away an active generation. A draft is the same\n // promise from the other side: the composer is the only place it is visible,\n // so a scroll that lands after the draft was typed must not hide it either.\n if (busy()) {\n expand()\n return\n }\n apply(tracker.sample(delta) === 'collapsed')\n };\n const onScroll = (event: Event): void => {\n const target = event.target\n if (target === null || !(target as Element).hasAttribute?.(CONVERSATION_SCROLL_SELECTOR.slice(1, -1))) return\n if (rafPending) return\n rafPending = true\n if (view === null) { sample(); return }\n view.requestAnimationFrame(sample)\n };\n // A draft or an in-flight submission is only visible in the composer, so a\n // collapse there would look like data loss.\n const busy = (): boolean => {\n if (options.isRunning()) return true\n const card = doc.querySelector(COMPOSER_CARD_SELECTOR)\n const editor = card?.querySelector<HTMLElement>(COMPOSER_EDITOR_SELECTOR) ?? null\n if (editor === null) return false\n // Any phase other than plain means the composer is mid-submit. Deny-listing\n // the non-plain phases instead of allow-listing the in-flight ones keeps this\n // correct across DSH versions: the union is plain | adjudicating | claimed |\n // submitting where I could read it, and other releases report extra names\n // (e.g. sending) that must block too, not fall through to 'not busy'.\n const phase = editor.dataset.phase ?? ''\n if (phase !== '' && phase !== 'plain') return true\n // Focus is the keyboard window: the user opened the composer and the soft\n // keyboard is up, so collapsing would take the editor out from under it.\n const focused = (doc as Document).activeElement\n if (focused !== null && card !== null && card.contains(focused)) return true\n const text = (editor as HTMLTextAreaElement).value ?? editor.textContent ?? ''\n return text.trim() !== ''\n };\n const guard = (): void => { if (busy()) expand() }\n const onPointerDown = (event: Event): void => {\n if (!collapsed) return\n const target = event.target\n if (target === null || !(target instanceof (view?.Element ?? Object))) return\n if ((target as Element).closest(COMPOSER_CARD_SELECTOR) === null) return\n expand()\n };\n const onFocusIn = (): void => { expand() }\n // The composer card is DSH's React output: it is replaced when a conversation\n // goes from empty to active, so the observed set is refreshed, not captured once.\n let observed: HTMLElement[] = []\n const observeCards = (): void => {\n const cards = [...doc.querySelectorAll<HTMLElement>(COMPOSER_CARD_SELECTOR)]\n if (cards.length === observed.length && cards.every((card, index) => card === observed[index])) return\n observer.disconnect()\n for (const card of cards) {\n observer.observe(card, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: ['data-phase'] })\n }\n observed = cards\n }\n const observer = new (view?.MutationObserver ?? MutationObserver)(() => { observeCards(); guard() })\n observeCards()\n doc.addEventListener('scroll', onScroll, { passive: true, capture: true })\n doc.addEventListener('pointerdown', onPointerDown, true)\n doc.addEventListener('focusin', onFocusIn, true)\n const stopPreference = subscribeComposerCollapseEnabled(enabled => {\n tracker.setEnabled(enabled)\n if (!enabled) expand()\n })\n const stopViewport = onViewportResize(onFocusIn)\n return {\n expand,\n dispose(): void {\n doc.removeEventListener('scroll', onScroll, { capture: true })\n doc.removeEventListener('pointerdown', onPointerDown, true)\n doc.removeEventListener('focusin', onFocusIn, true)\n stopViewport()\n stopPreference()\n observer.disconnect()\n root.style.removeProperty(RESTORE_LABEL_PROPERTY)\n apply(false)\n },\n }\n}\n\n/**\n * The slice of the Session summary reading mode needs. Kept structural so the\n * selector can be unit-tested without a Session store.\n */\nexport interface ReadingModeSessionState {\n readonly current?: string\n readonly byId: Readonly<Record<string, { readonly running?: boolean } | undefined>>\n}\n\n/**\n * Whether the active session is streaming a reply. A running reply is not a\n * composer phase: `data-phase` returns to `plain` as soon as the submission is\n * accepted, so this flag is the only truthful signal for the streaming window.\n */\nexport function selectActiveSessionRunning(state: ReadingModeSessionState): boolean {\n const current = state.current\n return current !== undefined && state.byId[current]?.running === true\n}\n","/**\n * Session prefetch for the dedicated Mobile frontend.\n *\n * Switching sessions tears down the client Session instance and its live\n * stream; switching back performs a full re-open. On the host, if the target\n * was evicted from DSH session-query's prepared-session LRU, the gateway must\n * decompress and parse the whole session log before `session/follow` can\n * answer. This module warms that cache for the session the user just left (the\n * most likely switch-back target) after a switch settles, so a follow-back hits\n * warm.\n *\n * Guardrails (per issue #291): read-only (never activates an Agent), at most one\n * target per switch, per-session cooldown, bounded settle/timeout, and silent\n * failure that never affects normal requests or live streams. The feature is\n * opt-in and disabled by default.\n */\n\nexport interface SessionPrefetchConfig {\n /** Master switch; disabled by default so the behavior is opt-in. */\n readonly enabled: boolean\n /** How long to wait for further switches before warming the MRU session (ms). */\n readonly settleMs: number\n /** Per-session cooldown between prefetches of the same session (ms). */\n readonly cooldownMs: number\n /** Hard deadline for one prefetch request (ms). */\n readonly timeoutMs: number\n /** Maximum number of targets warmed per switch (bounded to avoid bursty work). */\n readonly maxTargetsPerSwitch: number\n}\n\nexport const SESSION_PREFETCH_DEFAULTS: Readonly<SessionPrefetchConfig> = {\n enabled: false,\n settleMs: 1500,\n cooldownMs: 60_000,\n timeoutMs: 20_000,\n maxTargetsPerSwitch: 1,\n}\n\n/**\n * Storage key for the opt-in switch.\n *\n * The setting row lives in the client bundle while the tracker lives in the\n * layout bundle (tsdown.config.ts emits them separately and inlines this module\n * into each), so a module-level singleton cannot carry the value across. The\n * layout bundle owns the persisted state instead; the row notifies it through\n * both the storage event (other tabs) and a custom event (same page).\n */\nexport const SESSION_PREFETCH_STORAGE_KEY = 'dsh-mobile.session-prefetch.enabled'\nexport const SESSION_PREFETCH_EVENT = 'dsh-mobile:session-prefetch-change'\n\n/** Read the persisted opt-in. Defaults to off; unreadable storage keeps it off. */\nexport function readSessionPrefetchEnabled(storage?: Pick<Storage, 'getItem'>): boolean {\n try {\n const store = storage ?? globalThis.localStorage\n return store?.getItem(SESSION_PREFETCH_STORAGE_KEY) === 'true'\n } catch {\n return false\n }\n}\n\n/** Persist the opt-in and notify the layout bundle in the same page. */\nexport function writeSessionPrefetchEnabled(enabled: boolean, storage?: Pick<Storage, 'setItem'>): void {\n try {\n const store = storage ?? globalThis.localStorage\n store?.setItem(SESSION_PREFETCH_STORAGE_KEY, String(enabled))\n } catch {\n /* Blocked storage still lets this page react through the event below. */\n }\n try {\n globalThis.dispatchEvent?.(new CustomEvent(SESSION_PREFETCH_EVENT, { detail: { enabled } }))\n } catch {\n /* CustomEvent is missing in some test environments; the storage event still applies. */\n }\n}\n\n/**\n * Subscribe to opt-in changes coming from either bundle. The listener is not\n * called with the initial value; read it once with readSessionPrefetchEnabled().\n */\nexport function subscribeSessionPrefetchEnabled(listener: (enabled: boolean) => void): () => void {\n const onStorage = (event: StorageEvent): void => {\n if (event.key !== null && event.key !== SESSION_PREFETCH_STORAGE_KEY) return\n listener(readSessionPrefetchEnabled())\n }\n const onCustom = (event: Event): void => {\n const detail = (event as CustomEvent<{ enabled?: boolean }>).detail\n listener(detail?.enabled ?? readSessionPrefetchEnabled())\n }\n globalThis.addEventListener?.('storage', onStorage)\n globalThis.addEventListener?.(SESSION_PREFETCH_EVENT, onCustom)\n return () => {\n globalThis.removeEventListener?.('storage', onStorage)\n globalThis.removeEventListener?.(SESSION_PREFETCH_EVENT, onCustom)\n }\n}\n\n/** Apply the persisted opt-in onto a base config. */\nexport function sessionPrefetchConfigFrom(enabled: boolean, base: Readonly<SessionPrefetchConfig> = SESSION_PREFETCH_DEFAULTS): SessionPrefetchConfig {\n return { ...base, enabled }\n}\n\n/** Outcome of deciding whether a session switch should warm an MRU target. */\nexport type PrefetchDecision =\n | { readonly action: 'warm'; readonly target: string }\n | { readonly action: 'skip'; readonly reason: 'disabled' | 'no-previous' | 'same-session' | 'cooldown' | 'limit' }\n\nexport interface PrefetchClock {\n now(): number\n}\n\n/** In-memory per-session cooldown ledger plus MRU switch tracking (pure). */\nexport class SessionPrefetchTracker {\n private readonly cooldownUntil = new Map<string, number>()\n private previousSession: string | undefined\n private lastSwitchAt = 0\n\n constructor(\n private readonly config: Readonly<SessionPrefetchConfig>,\n private readonly clock: PrefetchClock = { now: () => Date.now() },\n ) {}\n\n /** The effective opt-in this tracker was built with (read-only, for rebuilds). */\n get enabled(): boolean {\n return this.config.enabled\n }\n\n /** Record that the UI switched to `sessionId`; returns the switch outcome. */\n switchTo(sessionId: string): PrefetchDecision {\n if (sessionId === '') return { action: 'skip', reason: 'no-previous' }\n const previous = this.previousSession\n this.previousSession = sessionId\n this.lastSwitchAt = this.clock.now()\n if (previous === undefined) return { action: 'skip', reason: 'no-previous' }\n if (previous === sessionId) return { action: 'skip', reason: 'same-session' }\n if (!this.config.enabled) return { action: 'skip', reason: 'disabled' }\n const cooldownUntil = this.cooldownUntil.get(previous) ?? 0\n if (this.clock.now() < cooldownUntil) return { action: 'skip', reason: 'cooldown' }\n this.cooldownUntil.set(previous, this.clock.now() + this.config.cooldownMs)\n return { action: 'warm', target: previous }\n }\n\n /** Whether the switch already passed the settle window (pure predicate). */\n settled(now = this.clock.now()): boolean {\n return now - this.lastSwitchAt >= this.config.settleMs\n }\n\n /** Forget state (used when the client unmounts). */\n reset(): void {\n this.cooldownUntil.clear()\n this.previousSession = undefined\n this.lastSwitchAt = 0\n }\n}\n\n/**\n * Fire a read-only `session/projections` prefetch, silently ignoring failures.\n *\n * The upstream RPC takes a single `request` parameter and the gateway validates\n * wire names exactly (`assertExactArguments`), so the envelope must be\n * `payload.args.request.sessionId` — the same shape every other call site in\n * this repo uses (scripts/smoke-client-module-settings.mjs, smoke-draft-transfer.mjs).\n * A bare `args.sessionId` is rejected with `gateway/arguments-invalid`.\n */\nexport function prefetchSession(request: (path: string, init?: RequestInit) => Promise<Response>, sessionId: string, timeoutMs: number): () => void {\n const controller = new AbortController()\n const timer = setTimeout(() => controller.abort(), timeoutMs)\n void (async () => {\n try {\n const response = await request('/api/session/projections', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n type: 'client-request',\n rpcId: prefetchRpcId(),\n method: 'session/projections',\n payload: { args: { request: { sessionId } } },\n }),\n signal: controller.signal,\n })\n if (!response.ok) {\n // Best-effort: a rejected prefetch is not an error the user should see,\n // but it must not be mistaken for a warm cache either.\n return\n }\n } catch {\n /* Prefetch is best-effort and never affects normal requests. */\n } finally {\n clearTimeout(timer)\n }\n })()\n return () => {\n controller.abort()\n clearTimeout(timer)\n }\n}\n\n/** Unique per attempt; the upstream does not document a format, so prefer a real UUID. */\nfunction prefetchRpcId(): string {\n const cryptoApi = globalThis.crypto as Crypto | undefined\n if (cryptoApi?.randomUUID !== undefined) return cryptoApi.randomUUID()\n return `dsh-mobile-prefetch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`\n}\n","import { createElement, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react'\nimport type { ReactNode } from 'react'\nimport type { ComposerReadingModeHandle } from './composer-collapse.js'\nimport { WIDE_LAYOUT_ATTRIBUTE } from './mobile-layout-attributes.js'\nimport { MOBILE_LAYOUT_MESSAGES, type MobileLayoutLanguage } from './mobile-layout-messages.js'\nimport {\n installComposerReadingMode,\n readComposerCollapseEnabled,\n selectActiveSessionRunning,\n subscribeComposerCollapseEnabled,\n} from './composer-collapse.js'\nimport {\n SESSION_PREFETCH_DEFAULTS,\n SessionPrefetchTracker,\n prefetchSession,\n readSessionPrefetchEnabled,\n sessionPrefetchConfigFrom,\n subscribeSessionPrefetchEnabled,\n} from './session-prefetch.js'\n\nexport { MOBILE_LAYOUT_MESSAGES } from './mobile-layout-messages.js'\nexport type { MobileLayoutLanguage } from './mobile-layout-messages.js'\nexport type { ComposerReadingModeHandle } from './composer-collapse.js'\n// Re-exported so the browser fixture can drive the shipped layout bundle directly;\n// this file already publishes the other DOM policies it installs.\nexport { installComposerReadingMode, readComposerCollapseEnabled, selectActiveSessionRunning } from './composer-collapse.js'\n\ninterface SessionState {\n readonly current?: string\n readonly byId: Readonly<Record<string, { readonly blank?: boolean; readonly title?: string; readonly running?: boolean } | undefined>>\n}\n\ninterface MobileRootProps {\n readonly renderSlot: (\n name: string,\n owner: Record<string, unknown>,\n options?: { readonly entryKey?: string | null; readonly fallback?: ReactNode },\n ) => ReactNode\n readonly useSessions: <T>(selector: (state: SessionState) => T) => T\n}\n\n/** Root contribution carrying one observable hook into the standard kit. */\ninterface RootHookContribution {\n readonly hooks: Readonly<Record<string, {\n readonly getSnapshot: () => unknown\n readonly subscribe: (listener: () => void) => () => void\n }>>\n}\n\ninterface MobileClientContext {\n readonly effect: (effect: () => void | (() => void), label?: string) => void\n readonly get: (name: string) => unknown\n readonly on: (event: string, listener: (value: ThemeSnapshot) => void) => () => void\n readonly reflect: { provide: (name: string, value: unknown) => () => void | Promise<void> }\n readonly slots: {\n register: <Props>(options: Record<string, unknown>, component: (props: Props) => ReactNode) => () => void\n entries: (name: string) => readonly { readonly options: { readonly key?: string } }[]\n subscribe: (name: string, listener: () => void) => () => void\n /**\n * Publish a root standard hook. The official layout owns `panelInfo`, so\n * replacing that module means replacing the owner too.\n */\n provideRoot?: (contribution: RootHookContribution) => () => void\n }\n readonly theme: { getTheme: () => ThemeSnapshot }\n}\n\ninterface ThemeSnapshot {\n readonly active: {\n readonly colorScheme: 'dark' | 'light'\n readonly tokens: Readonly<Record<string, string>>\n }\n}\n\ninterface LayoutSnapshot {\n readonly sidebarOpen: boolean\n readonly detailsOpen: boolean\n readonly rightbarTrack: boolean\n readonly rightbarFullscreen: boolean\n readonly panelInfo: PanelInfoSnapshot\n}\n\n/**\n * Panel selection as the standard `usePanelInfo` hook reports it: a null\n * `activePanelId` means the conversation owns the center column.\n */\ninterface PanelInfoSnapshot {\n readonly activePanelId: string | null\n}\n\n/** Optional DSH 0.1.5 right-Sidebar controls used by a Mobile close gesture. */\nexport interface SidebarRightControl {\n isExpanded(): boolean\n toggleExpanded(): void\n}\n\n/** Whether an optional service value supports the public right-Sidebar controls. */\nexport function isSidebarRightControl(value: unknown): value is SidebarRightControl {\n if (typeof value !== 'object' || value === null) return false\n const candidate = value as Partial<SidebarRightControl>\n return typeof candidate.isExpanded === 'function' && typeof candidate.toggleExpanded === 'function'\n}\n\n/**\n * Viewport width at which the dedicated layout treats the sidebar as a\n * persistent desktop panel instead of an overlay drawer. Narrow screens\n * keep the overlay behavior byte-for-byte.\n */\nexport const WIDE_LAYOUT_MIN_WIDTH_PX = 900\n/**\n * Shorter-side floor for the persistent sidebar, measured on the *device*: a\n * landscape phone is wider than the width threshold while its screen's short\n * side is still a phone's. Docking a 932x430 phone hid the conversation behind a\n * permanent rail and removed the panel return bar, so width alone is not enough\n * evidence of a tablet-sized viewport.\n *\n * The measurement must come from `screen`, not the viewport: a Pad 9 Pro Max in\n * landscape (1363x860 viewport, 1364x909 screen) reports `innerHeight: 441`\n * while the soft keyboard is open, and a viewport-height floor would flip a\n * docked tablet into the drawer layout mid-sentence.\n */\nexport const WIDE_LAYOUT_MIN_SHORTER_SIDE_PX = 600\n/** Re-exported so the layout's own tests and callers keep one import site. */\nexport { WIDE_LAYOUT_ATTRIBUTE }\n/**\n * Narrow band that still has room for a folded 56px rail beside the\n * conversation: the pre-existing 721-899px phone rule plus any narrow viewport\n * that is wide enough for the rail, such as a landscape phone.\n */\nconst FOLDED_RAIL_OFFSET_QUERY = '(min-width:721px)'\nconst RIGHTBAR_MIN_WIDTH_PX = 300\nconst RIGHTBAR_MAX_WIDTH_PX = 460\nconst RIGHTBAR_CENTER_MIN_WIDTH_PX = 400\nconst RIGHTBAR_DEFAULT_RATIO = 0.45\nconst SIDEBAR_EXPANDED_WIDTH_PX = 340\nconst SIDEBAR_COLLAPSED_WIDTH_PX = 56\n\n/**\n * The device's shorter side in CSS pixels, independent of rotation and of the\n * soft keyboard. Falls back to the viewport only where `screen` reports nothing\n * usable (SSR, minimal DOM stubs).\n * @param screenWidth - `screen.width`, or `undefined` without a screen.\n * @param screenHeight - `screen.height`, or `undefined` without a screen.\n * @param viewportWidth - the viewport width, used for the fallback.\n * @param viewportHeight - the viewport height, used for the fallback.\n * @returns the shorter side in CSS pixels.\n */\nexport function resolveDeviceShortSide(\n screenWidth: number | undefined,\n screenHeight: number | undefined,\n viewportWidth: number,\n viewportHeight: number,\n): number {\n return typeof screenWidth === 'number' && typeof screenHeight === 'number'\n && screenWidth > 0 && screenHeight > 0\n ? Math.min(screenWidth, screenHeight)\n : Math.min(viewportWidth, viewportHeight)\n}\n\n/**\n * Whether the dedicated layout should dock the sidebar as a persistent column.\n * @param viewportWidth - the viewport width in CSS pixels; a narrow window is\n * never wide, whatever the screen behind it measures.\n * @param deviceShortSide - the device's shorter side, from {@link resolveDeviceShortSide}.\n * @returns whether the viewport and the device are both large enough.\n */\nexport function isWideViewportLayout(viewportWidth: number, deviceShortSide: number): boolean {\n return viewportWidth >= WIDE_LAYOUT_MIN_WIDTH_PX\n && deviceShortSide >= WIDE_LAYOUT_MIN_SHORTER_SIDE_PX\n}\n\n/** Resolved right-panel presentation for the dedicated responsive layout. */\nexport interface MobileRightbarLayout {\n readonly docked: boolean\n readonly width: number\n}\n\n/** Preserve a readable conversation width before turning a requested right track into a docked column. */\nexport function resolveMobileRightbarLayout(\n viewportWidth: number,\n wideViewport: boolean,\n sidebarOpen: boolean,\n track: boolean,\n fullscreen: boolean,\n): MobileRightbarLayout {\n const overlayWidth = wideViewport\n ? Math.min(viewportWidth * 0.94, RIGHTBAR_MAX_WIDTH_PX)\n : viewportWidth\n if (!track || fullscreen || (!wideViewport && sidebarOpen)) {\n return Object.freeze({ docked: false, width: overlayWidth })\n }\n const sidebarWidth = wideViewport && sidebarOpen\n ? SIDEBAR_EXPANDED_WIDTH_PX\n : SIDEBAR_COLLAPSED_WIDTH_PX\n const available = Math.floor(viewportWidth - sidebarWidth - RIGHTBAR_CENTER_MIN_WIDTH_PX)\n if (available < RIGHTBAR_MIN_WIDTH_PX) return Object.freeze({ docked: false, width: overlayWidth })\n const preferred = Math.min(\n RIGHTBAR_MAX_WIDTH_PX,\n Math.max(RIGHTBAR_MIN_WIDTH_PX, Math.round(viewportWidth * RIGHTBAR_DEFAULT_RATIO)),\n )\n return Object.freeze({ docked: true, width: Math.min(preferred, available) })\n}\n\n/** Whether an overlay drawer needs the modal scrim without dimming a docked desktop panel. */\nexport function isMobileScrimOpen(\n sidebarOpen: boolean,\n detailsModalOpen: boolean,\n wideViewport: boolean,\n): boolean {\n return (!wideViewport && sidebarOpen) || detailsModalOpen\n}\n\n/**\n * Query matching devices whose primary pointer cannot hover: the phones and\n * tablets where focusing an editor raises a soft keyboard the user did not ask\n * for. A desktop keeps stock behaviour because it has a real keyboard already.\n */\nexport const TOUCH_PRIMARY_QUERY = '(hover: none), (pointer: coarse)'\n\n/** The stock composer wrapper, which owns everything the phone adapter edits. */\nconst COMPOSER_CARD_SELECTOR = '[data-composer-card]'\n\n/** The composer's editing host, whichever contenteditable flavour it boots with. */\nconst COMPOSER_EDITOR_SELECTOR = `${COMPOSER_CARD_SELECTOR} :is([contenteditable=\"true\"],[contenteditable=\"plaintext-only\"],[contenteditable=\"\"])`\n\n/** The composer's Add trigger, whose menu must open without summoning the IME. */\nconst COMPOSER_COMMAND_TRIGGER_SELECTOR = `${COMPOSER_CARD_SELECTOR} button[aria-haspopup=\"listbox\"]`\n\n/**\n * Whether a focus target belongs to the composer, which owns its own keyboard\n * decision and must never be blurred by a suppression window.\n * @param target - the focus target, already narrowed to an element.\n * @returns whether the target sits inside the composer card.\n */\nexport function isComposerOwnedFocus(target: Element | null): boolean {\n return target !== null && target.closest(COMPOSER_CARD_SELECTOR) !== null\n}\n\n/**\n * Whether a click opens a different Session, rather than its menu or current row.\n * @param target - the click target in the workspace sidebar.\n * @returns whether the Session selection can change.\n */\nexport function isSessionRowNavigation(target: Element | null): boolean {\n if (target === null) return false\n const row = target.closest('[role=\"treeitem\"][aria-selected]')\n if (row === null || row.getAttribute('aria-selected') === 'true') return false\n const action = target.closest('button,[role=\"button\"]')\n return action === null || action === row\n}\n\n/**\n * Decide how one pointer event changes the composer's soft keyboard.\n *\n * The Add button's own mousedown calls `keepDraftFocus`, which focuses the draft\n * on purpose so the caret survives the menu; on a phone that focus is what\n * raises the keyboard. `inputmode=\"none\"` withholds the IME without moving focus\n * or the caret, so the menu, the caret, and the draft all keep stock behaviour.\n * @param target - the pointer target, already narrowed to an element.\n * @param touchPrimary - whether the device's primary pointer cannot hover.\n * @returns `withhold` for the Add trigger, `restore` for any other tap, and\n * `ignore` where no soft keyboard exists to withhold.\n */\nexport function resolveComposerImePolicy(\n target: Element | null,\n touchPrimary: boolean,\n): 'ignore' | 'restore' | 'withhold' {\n if (!touchPrimary || target === null) return 'ignore'\n return target.closest(COMPOSER_COMMAND_TRIGGER_SELECTOR) === null ? 'restore' : 'withhold'\n}\n\n/**\n * Whether a tap landed on the stock Send, Queue, or Steer primary button.\n * Stop uses a square SVG; Add, attachment, and plugin buttons are separate actions.\n * @param target - the click target in the composer card.\n * @returns whether the enabled primary action carries the send arrow.\n */\nexport function isComposerActionTap(target: Element | null): boolean {\n if (target === null) return false\n const action = target.closest('button[class*=\"_primary\"]')\n return action !== null && action.closest(COMPOSER_CARD_SELECTOR) !== null\n && !action.hasAttribute('disabled') && action.getAttribute('aria-disabled') !== 'true'\n && action.querySelector('svg path') !== null\n}\n\n/** Text, reference chips, and the stock attachment rail all contribute to a draft. */\nfunction composerHasDraft(editor: HTMLElement, card: Element): boolean {\n return (editor.textContent ?? '').replaceAll('\\u200b', '').trim() !== ''\n || editor.querySelector('[contenteditable=\"false\"],[data-lexical-decorator],img') !== null\n || card.querySelector('[data-slot=\"conversation.input.attachments\"] [role=\"group\"] > *') !== null\n}\n\n/**\n * Collapse an on-screen keyboard after a trusted touch Send consumes the focused\n * draft. Consumption may be asynchronous; input, navigation, composition, or\n * another gesture cancels the observation. DSH owns optimistic sends and any\n * later failure restoration; this listener never submits or modifies the draft.\n * @param onConsumed - called immediately before blurring to suppress DSH autofocus.\n * @returns disposer for pointer, composition, focus, and draft observations.\n */\nexport function installComposerSendKeyboardPolicy(onConsumed: () => void): () => void {\n let touchButton: Element | null = null\n let cancelPending = (): void => {}\n const composing = new WeakSet<Element>()\n let compositionEndedAt = -Infinity\n const elementTarget = (target: EventTarget | null): Element | null => target instanceof Element ? target : null\n const onPointerDown = (event: PointerEvent): void => {\n cancelPending()\n const target = elementTarget(event.target)\n touchButton = event.isTrusted && (event.pointerType === 'touch' || event.pointerType === 'pen')\n && isComposerActionTap(target) ? target?.closest('button') ?? null : null\n }\n const onClick = (event: MouseEvent): void => {\n const action = touchButton\n touchButton = null\n const target = elementTarget(event.target)\n const active = document.activeElement\n const nativeState = window.__DSH_MOBILE_KEYBOARD_STATE__\n if (!event.isTrusted || event.detail === 0 || action === null || target?.closest('button') !== action\n || !isComposerActionTap(target) || !window.matchMedia(TOUCH_PRIMARY_QUERY).matches\n || (window.__DSH_MOBILE_NATIVE__ !== undefined\n && (nativeState?.noHardwareKeyboard !== true || nativeState.imeVisible !== true))\n || !(active instanceof HTMLElement) || !active.matches(COMPOSER_EDITOR_SELECTOR)\n || composing.has(active) || performance.now() - compositionEndedAt < 10) return\n const editor = active\n const composerCard = editor.closest(COMPOSER_CARD_SELECTOR)\n if (composerCard === null || action.closest(COMPOSER_CARD_SELECTOR) !== composerCard || !composerHasDraft(editor, composerCard)) return\n const card = composerCard\n const sessionOwner = card.closest('[data-conversation-session]')\n const sessionId = sessionOwner?.getAttribute('data-conversation-session')\n const currentEditor = (): boolean => editor.isConnected && editor.closest(COMPOSER_CARD_SELECTOR) === card\n && card.closest('[data-conversation-session]') === sessionOwner\n && sessionOwner?.getAttribute('data-conversation-session') === sessionId\n && document.activeElement === editor\n cancelPending()\n let frame = 0\n const observer = new MutationObserver(check)\n const expiry = window.setTimeout(() => { cancelPending() }, 30_000)\n cancelPending = (): void => {\n observer.disconnect()\n window.clearTimeout(expiry)\n window.cancelAnimationFrame(frame)\n cancelPending = () => {}\n }\n function check(): void {\n if (!currentEditor()) {\n cancelPending()\n return\n }\n if (composerHasDraft(editor, card) || ['adjudicating', 'submitting'].includes(editor.dataset.phase ?? '')) return\n if (frame !== 0) return\n frame = window.requestAnimationFrame(() => {\n frame = window.requestAnimationFrame(() => {\n frame = 0\n if (!currentEditor() || composerHasDraft(editor, card)\n || ['adjudicating', 'submitting'].includes(editor.dataset.phase ?? '')) return\n cancelPending()\n onConsumed()\n editor.blur()\n })\n })\n }\n observer.observe(card, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: ['data-phase', 'contenteditable'] })\n // The capture listener runs before React's onClick; the first frame reads its result.\n frame = window.requestAnimationFrame(() => { frame = 0; check() })\n }\n const onCompositionStart = (event: CompositionEvent): void => {\n const target = elementTarget(event.target)\n if (target !== null) composing.add(target)\n cancelPending()\n }\n const onCompositionEnd = (event: CompositionEvent): void => {\n const target = elementTarget(event.target)\n if (target !== null) composing.delete(target)\n compositionEndedAt = performance.now()\n }\n const onTyping = (): void => { touchButton = null; cancelPending() }\n const onFocus = (): void => { cancelPending() }\n document.addEventListener('pointerdown', onPointerDown, true)\n document.addEventListener('click', onClick, true)\n document.addEventListener('compositionstart', onCompositionStart, true)\n document.addEventListener('compositionend', onCompositionEnd, true)\n document.addEventListener('keydown', onTyping, true)\n document.addEventListener('input', onTyping, true)\n document.addEventListener('focusin', onFocus, true)\n return () => {\n cancelPending()\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('click', onClick, true)\n document.removeEventListener('compositionstart', onCompositionStart, true)\n document.removeEventListener('compositionend', onCompositionEnd, true)\n document.removeEventListener('keydown', onTyping, true)\n document.removeEventListener('input', onTyping, true)\n document.removeEventListener('focusin', onFocus, true)\n }\n}\n\n/**\n * Close the details drawer from its scrim, collapsing the DSH 0.1.5 right\n * Sidebar first when that optional service owns the visible content.\n */\nexport function closeDetailsFromScrim(sidebarRight: unknown, closeDetails: () => void): void {\n if (isSidebarRightControl(sidebarRight) && sidebarRight.isExpanded()) {\n sidebarRight.toggleExpanded()\n }\n closeDetails()\n}\n\n/** The device and viewport facts the layout decision needs, read live. */\nfunction readViewport(): { width: number, height: number, shortSide: number } {\n const width = window.innerWidth\n const height = window.innerHeight\n const screen = window.screen as { width?: number, height?: number } | undefined\n return {\n width,\n height,\n shortSide: resolveDeviceShortSide(screen?.width, screen?.height, width, height),\n }\n}\n\n/**\n * Reads the live device and viewport; unknown environments (SSR, tests) stay\n * narrow. `screen` is what distinguishes a tablet from a landscape phone and\n * what keeps a docked tablet docked while its soft keyboard is open.\n */\nfunction viewportIsWide(): boolean {\n if (typeof window === 'undefined') return false\n const viewport = readViewport()\n return isWideViewportLayout(viewport.width, viewport.shortSide)\n}\n\n/** Resolve the supported language used by the dedicated mobile layout. */\nexport function resolveMobileLayoutLanguage(\n documentLanguage: string,\n browserLanguages: readonly string[],\n): MobileLayoutLanguage {\n return [documentLanguage, ...browserLanguages]\n .map(value => value.trim().toLowerCase().split(/[-_]/u)[0])\n .find((value): value is MobileLayoutLanguage => value === 'it' || value === 'en' || value === 'zh') ?? 'en'\n}\n\nclass MobileLayoutController {\n // Wide viewports start with the persistent sidebar open; applying the\n // layout again (reconnect, refocus) reuses the module singleton below,\n // so an explicit user collapse is never reset.\n private snapshot: LayoutSnapshot = Object.freeze({\n sidebarOpen: viewportIsWide(),\n detailsOpen: false,\n rightbarTrack: false,\n rightbarFullscreen: false,\n panelInfo: Object.freeze({ activePanelId: null }),\n })\n private readonly listeners = new Set<() => void>()\n private hasMainPanel: ((id: string) => boolean) | undefined\n // Pending workspace/session navigation, cancelled whenever a newer one\n // starts. Mirrors the official LayoutController's navigation controller.\n private navigation = new AbortController()\n\n readonly subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n }\n\n readonly getSnapshot = (): LayoutSnapshot => this.snapshot\n\n /**\n * The panel store on the layout service itself (`ctx.layout.panelInfo`),\n * mirroring the official LayoutController of DSH 0.1.7-rc.2+. The root hook\n * wired in `apply` feeds `usePanelInfo` rendering; rc.2 client plugins read\n * this service member directly. Without it `dsh-client-ui-plugin-manager`\n * fails activation on the dedicated mobile frontend (\"web boot: 1 entry did\n * not activate\") and `dsh-client-ui-open-in-app` throws the first time its\n * shortcut target runs.\n */\n readonly panelInfo = {\n getSnapshot: (): PanelInfoSnapshot => this.getSnapshot().panelInfo,\n subscribe: (listener: () => void): (() => void) => this.subscribe(listener),\n }\n\n toggleSidebar(): void {\n this.update({ sidebarOpen: !this.snapshot.sidebarOpen })\n }\n\n openDetails(): void {\n this.update({ detailsOpen: true })\n }\n\n closeDetails(): void {\n this.update({ detailsOpen: false, rightbarTrack: false, rightbarFullscreen: false })\n }\n\n closeSidebar(): void {\n this.update({ sidebarOpen: false })\n }\n\n /**\n * Invalidate the previous navigation and hand back a fresh signal. The\n * workspace controller wraps this around \"open a workspace\" and \"fork a\n * session\" (dsh-client-ui-workspace) — the path behind the sidebar's\n * new-session button. Without it startSession throws inside a\n * `.catch(reason => console.warn('new session failed:', reason))`, so the\n * button silently did nothing.\n */\n beginNavigation(): AbortSignal {\n this.navigation.abort()\n this.navigation = new AbortController()\n return this.navigation.signal\n }\n\n /** Invalidate pending navigations when this layout unloads. */\n dispose(): void {\n this.navigation.abort()\n }\n\n /** Bind panel validation to the live slot registry owned by this application. */\n bindMainPanelRegistry(hasMainPanel: (id: string) => boolean): () => void {\n this.hasMainPanel = hasMainPanel\n return () => {\n if (this.hasMainPanel === hasMainPanel) this.hasMainPanel = undefined\n }\n }\n\n /** Preserve the native seat's distinction between a docked track and fullscreen. */\n openRightbar(track = true, fullscreen = false): void {\n this.update({ detailsOpen: true, rightbarTrack: track, rightbarFullscreen: fullscreen })\n }\n\n /** Hide the right panel. */\n closeRightbar(): void {\n this.closeDetails()\n }\n\n /**\n * Select the main panel rendered in the center column; null means the\n * conversation. Mirrors the official LayoutController so the `panelInfo`\n * root hook stays truthful. Selecting a panel while the narrow overlay\n * drawer covers the center column dismisses that drawer — the user asked to\n * see the panel, not the navigation over it — while a docked wide sidebar\n * stays open.\n */\n selectPanel(panelId: string | null): void {\n if (panelId !== null && this.hasMainPanel?.(panelId) !== true) {\n throw new Error(`layout.selectPanel: main panel \"${panelId}\" is not registered`)\n }\n this.navigation.abort()\n const dismissDrawer = this.snapshot.sidebarOpen && !viewportIsWide()\n const samePanel = this.snapshot.panelInfo.activePanelId === panelId\n if (!dismissDrawer && samePanel) return\n this.update({\n ...(dismissDrawer ? { sidebarOpen: false } : {}),\n ...(samePanel ? {} : { panelInfo: Object.freeze({ activePanelId: panelId }) }),\n })\n }\n\n /** Drop a selected panel once no main-slot entry declares it. */\n retainMainPanels(panelIds: readonly string[]): void {\n const active = this.snapshot.panelInfo.activePanelId\n if (active !== null && !panelIds.includes(active)) {\n this.update({ panelInfo: Object.freeze({ activePanelId: null }) })\n }\n }\n\n private update(next: Partial<LayoutSnapshot>): void {\n const snapshot = Object.freeze({ ...this.snapshot, ...next })\n if (\n snapshot.sidebarOpen === this.snapshot.sidebarOpen\n && snapshot.detailsOpen === this.snapshot.detailsOpen\n && snapshot.rightbarTrack === this.snapshot.rightbarTrack\n && snapshot.rightbarFullscreen === this.snapshot.rightbarFullscreen\n && snapshot.panelInfo === this.snapshot.panelInfo\n ) return\n this.snapshot = snapshot\n for (const listener of this.listeners) listener()\n }\n}\n\nclass ThemePresenter {\n private appliedTokens: string[] = []\n private readonly meta = document.createElement('meta')\n\n constructor() {\n this.meta.name = 'theme-color'\n }\n\n apply(snapshot: ThemeSnapshot): void {\n const scheme = snapshot.active.colorScheme\n document.documentElement.style.colorScheme = scheme\n document.body.toggleAttribute('data-ds-dark-theme', scheme === 'dark')\n for (const name of this.appliedTokens) document.body.style.removeProperty(name)\n this.appliedTokens = []\n for (const [name, value] of Object.entries(snapshot.active.tokens)) {\n document.body.style.setProperty(name, value)\n this.appliedTokens.push(name)\n }\n this.meta.content = getComputedStyle(document.body).backgroundColor\n if (!this.meta.isConnected) document.head.append(this.meta)\n }\n\n dispose(): void {\n document.documentElement.style.removeProperty('color-scheme')\n document.body.removeAttribute('data-ds-dark-theme')\n for (const name of this.appliedTokens) document.body.style.removeProperty(name)\n this.meta.remove()\n }\n}\n\nexport const MOBILE_LAYOUT_STYLES = `\nhtml,body,#root{width:100%;height:100%;overflow:hidden}\n/* Definite height bounds the transcript on engines without dvh. Isolation keeps\n shell descendants below positive-z-index portals attached to document.body. */\n.dshm-shell{-webkit-text-size-adjust:100%;text-size-adjust:100%;position:relative;isolation:isolate;display:grid;grid-template-rows:minmax(0,1fr);width:100%;height:100%;height:100dvh;min-width:0;overflow:hidden;background:var(--dsw-alias-bg-base,#fff)}\n/* The mobile root owns its Grid geometry. Layered important rules keep broad\n unlayered skin rules from collapsing virtualized views to the header height.\n The wide/narrow band is the root attribute, not a media query: the decision\n needs the device screen size, which a media query cannot read. */\n@layer dsh-mobile-layout{\n.dshm-shell{display:grid!important;grid-template-rows:minmax(0,1fr)!important;grid-template-columns:minmax(0,1fr)!important}\n.dshm-shell[${WIDE_LAYOUT_ATTRIBUTE}=\"1\"]{grid-template-columns:auto minmax(0,1fr)!important}\n}\n.dshm-main{grid-area:1/1;position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;margin-right:0;overflow:hidden;transition:margin-right var(--ds-transition-duration-slow,190ms) var(--ds-ease-in-out,ease)}\n.dshm-mainContent{position:relative;flex:1;min-width:0;min-height:0;overflow:hidden}\n.dshm-shell[data-rightbar-docked=true] .dshm-main{margin-right:var(--dshm-rightbar-width)}\n.dshm-shell[data-rightbar-docked=true] .dshm-details{position:absolute;width:var(--dshm-rightbar-width);box-shadow:none;padding-top:0}\n/* Draw above the native absolute panel without consuming its width or\n intercepting controls; only docked mode needs this column separator. */\n.dshm-shell[data-rightbar-docked=true] .dshm-details::after{content:\"\";position:absolute;inset:0 auto 0 0;width:.5px;background:var(--dsw-alias-border-l4);z-index:11;pointer-events:none}\n/* The native panel paints itself at 100vw in fullscreen mode. Inside the\n docked overlay (94vw/460px, overflow:hidden) that layout was clipped to the\n right edge of the track, so the header slid out of view and the body showed\n only clipped line tails. A fullscreen panel owns the whole viewport. */\n.dshm-shell[data-rightbar-fullscreen=true] .dshm-details{inset:0;width:100vw;max-width:100vw;box-shadow:none}\n.dshm-main>*,.dshm-main>*>*{min-width:0}\n.dshm-drawer{position:fixed;z-index:70;inset:0 auto 0 0;box-sizing:border-box;width:56px;max-width:100%;padding-top:env(safe-area-inset-top);overflow:hidden;background-color:Canvas;background-image:linear-gradient(var(--dsw-alias-bg-layer-1,#f8fafc),var(--dsw-alias-bg-layer-1,#f8fafc));box-shadow:none;will-change:width;transition:width 240ms cubic-bezier(.22,1,.36,1),box-shadow 240ms ease}\n.dshm-drawer[data-open=true]{width:min(88vw,340px);box-shadow:18px 0 46px rgb(15 23 42 / 18%)}\n.dshm-drawer[data-open=false]{pointer-events:auto;visibility:visible}\n.dshm-drawer>*{width:100%!important;height:100%!important;transform:translateX(-6px);opacity:.94;transition:transform 220ms cubic-bezier(.22,1,.36,1),opacity 160ms ease-out}\n.dshm-drawer[data-open=true]>*{transform:translateX(0);opacity:1}\n.dshm-drawer[data-open=false]>*{width:56px!important}\n/* Folded icon rail: on narrow viewports the drawer is fixed, so give the main\n content the same 56px offset the wide grid already provides. The width floor\n keeps phone-width headers on their own inset; the band itself is the root\n attribute, so a landscape phone gets the offset too. The drawer's folded state\n owns this offset independently of nested-pane markers. */\n@media${FOLDED_RAIL_OFFSET_QUERY}{.dshm-shell:not([${WIDE_LAYOUT_ATTRIBUTE}=\"1\"]):has(.dshm-drawer[data-open=false]:not([data-right-modal=true])) .dshm-main{margin-left:56px}}\n/* display:none also suppresses fixed descendants installed by the phone adapter. */\n.dshm-drawer[data-right-modal=true]{display:none!important}\n.dshm-details{position:fixed;z-index:80;inset:0 0 0 auto;box-sizing:border-box;width:min(94vw,460px);max-width:100%;padding-top:env(safe-area-inset-top);overflow:hidden;background-color:Canvas;background-image:linear-gradient(var(--dsw-alias-bg-layer-1,#fff),var(--dsw-alias-bg-layer-1,#fff));box-shadow:-18px 0 46px rgb(15 23 42 / 18%);transform:translateX(104%);transition:transform 190ms cubic-bezier(.22,1,.36,1)}\n.dshm-details[data-open=true]{transform:translateX(0)}\n.dshm-details[data-open=false]{pointer-events:none;visibility:hidden;transition:transform 190ms cubic-bezier(.22,1,.36,1),visibility 0s linear 190ms}\n/* An absent marker is the narrow default: static fixtures and the first paint\n before React mounts keep the overlay geometry rather than a half-docked shell. */\n.dshm-shell:not([${WIDE_LAYOUT_ATTRIBUTE}=\"1\"]) .dshm-details{width:100%;max-width:100%;box-shadow:none}\n.dshm-shell:not([${WIDE_LAYOUT_ATTRIBUTE}=\"1\"]) .dshm-details [data-sidebar-right-toggle],.dshm-shell:not([${WIDE_LAYOUT_ATTRIBUTE}=\"1\"]) .dshm-details [data-sidebar-right-mode]{min-width:48px;min-height:48px}\n.dshm-scrim{position:fixed;z-index:65;inset:0;border:0;background:rgb(15 23 42 / 40%);opacity:0;pointer-events:none;transition:opacity 180ms ease-out}\n.dshm-scrim[data-open=true]{opacity:1;pointer-events:auto}\n.dshm-overlay{position:fixed;z-index:90;inset:0;pointer-events:none}.dshm-overlay>*{pointer-events:auto}\n/* Reserve navigation space instead of covering a panel's own save controls. */\n.dshm-panelNav{display:flex;align-items:center;flex-shrink:0;min-height:56px;box-sizing:border-box;padding:max(4px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) 4px max(68px,env(safe-area-inset-left));border-bottom:.5px solid var(--dsw-alias-border-l4);background-color:Canvas;background-image:linear-gradient(var(--dsw-alias-bg-base,#fff),var(--dsw-alias-bg-base,#fff))}\n.dshm-panelBack{display:inline-flex;align-items:center;gap:8px;min-width:48px;min-height:48px;padding:8px 12px;border:0;border-radius:8px;background:transparent;color:var(--dsw-alias-label-primary,#171a21);font:inherit;font-size:14px;line-height:1.4;text-align:left;cursor:pointer}\n.dshm-panelBack:hover{background:var(--dsw-alias-interactive-bg-hover,#f1f3f6)}\n.dshm-panelBack:active{background:var(--dsw-alias-interactive-bg-active,#e9ecef)}\n.dshm-panelBack:disabled{opacity:.5;cursor:default}\n.dshm-panelBack:focus-visible{outline:2px solid var(--dsw-alias-label-primary,#171a21);outline-offset:2px}\n.dshm-panelBack svg{width:20px;height:20px;flex-shrink:0}\n.dshm-shell header{min-width:0}\n/* A panel owns its header padding; only conversation content clears the rail. */\n.dshm-shell :where(.dshm-main:not([data-dsh-panel=\"1\"])) header{padding-left:52px}\n/* Keep focused editables above Safari's 16px zoom threshold while retaining\n the DSH content-font preference and larger inherited text. Stock menus\n portal into document.body, so the floor scopes from the body itself. */\nbody:has(.dshm-shell) :is(input,textarea,[contenteditable=true],[contenteditable=plaintext-only],[contenteditable=\"\"]){font-size:max(16px,1em,var(--dsh-content-font-size,1em))!important}\n.dshm-shell table{display:block;max-width:100%;overflow-x:auto}\n.dshm-shell pre{max-width:100%;overflow-x:auto}\n.dshm-shell img,.dshm-shell video,.dshm-shell canvas,.dshm-shell svg{max-width:100%}\n.dshm-shell [data-disclosure-row]{min-width:0;max-width:100%}\n.dshm-shell [data-disclosure-row]>*{min-width:0;overflow-wrap:anywhere}\n.dshm-shell [data-context-fields]>*{min-width:0}\n.dshm-shell [class*=\"_body\"]{max-width:100%;overflow-wrap:anywhere}\n@media(max-width:420px){.dshm-shell [data-context-fields]>*{display:grid;grid-template-columns:1fr!important;gap:4px}.dshm-shell [class*=\"_ioSection\"]{grid-template-columns:1fr!important}}\n@media(max-width:600px){\n.dshm-shell [data-question-key],.dshm-shell [data-plan-review-key]{box-sizing:border-box;width:100%;height:auto!important;min-width:0;flex:none!important;align-self:flex-end;padding:6px max(10px,env(safe-area-inset-left)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-right))!important}\n.dshm-shell [data-question-key]>section,.dshm-shell [data-plan-review-key]>section{width:100%;height:auto!important;min-height:0!important;max-width:none!important;max-height:min(68dvh,520px)!important;border-radius:16px!important}\n.dshm-shell [data-question-scroll],.dshm-shell [data-plan-review-scroll]{flex:0 1 auto!important;min-height:0!important;max-height:min(42dvh,360px)!important;overscroll-behavior:contain;scroll-padding-bottom:12px}\n.dshm-shell [data-question-key]>section>header{display:flex!important;visibility:visible!important;flex:none!important;gap:8px!important;padding:12px 8px 4px 14px!important}\n.dshm-shell [data-question-key]>section>header h2{min-width:0;overflow-wrap:anywhere;font-size:16px!important;line-height:22px!important}\n.dshm-shell [data-question-key]>section>header button{min-width:40px;min-height:40px}\n.dshm-shell [data-question-key] [role=radio],.dshm-shell [data-question-key] [role=checkbox]{min-height:48px!important;touch-action:manipulation}\n.dshm-shell [data-question-key]>section>footer{display:grid!important;grid-template-columns:auto minmax(0,1fr);align-items:center!important;flex:none!important;gap:6px 8px!important;margin-top:4px!important;padding:6px 10px 10px!important}\n.dshm-shell [data-question-key]>section>footer>:last-child{grid-column:1/-1;display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:8px!important}\n.dshm-shell [data-question-key]>section>footer>:last-child button{width:100%;min-height:44px}\n.dshm-shell [data-plan-review-key]>section>div:last-child{display:grid!important;grid-template-columns:1fr;gap:8px!important;padding:8px 12px 10px!important}\n.dshm-shell [data-plan-review-key]>section>div:last-child>div:last-child{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:8px!important}\n.dshm-shell [data-plan-review-key]>section>div:last-child>div:last-child>button:first-child{grid-column:1/-1}\n.dshm-shell [data-plan-review-key]>section>div:last-child button{width:100%;min-height:44px}\n}\n/* Wide band: the shell carries the decision, so these rules follow the same\n device+viewport test as the JS. An absent attribute is the narrow default. */\n.dshm-shell[${WIDE_LAYOUT_ATTRIBUTE}=\"1\"]{grid-template-columns:auto minmax(0,1fr)}\n/* The wide drawer is a static grid column, not an overlay: it occupies its own\n track and never overlaps the conversation. Keeping a z-index here made it\n outrank the conversation column, so a dialog a plugin mounts inside the\n composer's own stacking context lost its left edge behind the opaque rail.\n A static column needs no layer, so it stays in normal flow order. */\n.dshm-shell[${WIDE_LAYOUT_ATTRIBUTE}=\"1\"] .dshm-drawer{position:static;grid-area:1/1;box-shadow:none;z-index:auto}\n.dshm-shell[${WIDE_LAYOUT_ATTRIBUTE}=\"1\"] .dshm-drawer[data-open=true]{width:340px;box-shadow:none}\n.dshm-shell[${WIDE_LAYOUT_ATTRIBUTE}=\"1\"] .dshm-drawer[data-open=false]{width:56px}\n/* The conversation column outranks that column so an in-shell modal opened from\n it is not clipped by the navigation rail. It stays below the scrim (65), the\n detail panel (80) and the shell overlay (90), so a modal shell surface still\n dims and covers it. Only the wide grid needs this: on a phone the drawer is a\n floating overlay and must keep covering the conversation. */\n.dshm-shell[${WIDE_LAYOUT_ATTRIBUTE}=\"1\"] .dshm-main{grid-area:1/2;z-index:1}\n@media(prefers-reduced-motion:reduce){.dshm-drawer,.dshm-details,.dshm-scrim,.dshm-drawer>*,.dshm-main{transition:none!important}}\n/* Touch adaptation changes control boxes, not invisible hit regions. Root opt-out\n retains pane geometry too; nested opt-out preserves a widget's own controls.\n DSH's plugin cards open through a cardTitle/cardOpen button whose ::after\n overlay already owns the whole card hit area; the floor only inflated that\n title box and pushed each description away from its card title. */\n@media(pointer:coarse){\n.dshm-main[data-dsh-panel=\"1\"] .dshm-mainContent:has(>[data-slot=\"main\"]>:not([data-dsh-adapt=\"off\"])):not(:has(>[data-slot=\"main\"]>[data-dsh-adapt=\"off\"])){overflow-y:auto;overscroll-behavior:contain}\n.dshm-main[data-dsh-panel=\"1\"] .dshm-mainContent>[data-slot=\"main\"]>:not([data-dsh-adapt=\"off\"]){max-width:100%;box-sizing:border-box}\n.dshm-main[data-dsh-panel=\"1\"] [data-slot=\"main\"]>:not([data-dsh-adapt=\"off\"]) :is(button,[role=\"button\"],select,input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]):not([type=color]):not([type=file]):not([type=image])):not([role=\"switch\"],[role=\"checkbox\"],[role=\"radio\"],[role=\"slider\"],button[class*=\"_cardTitle\"][class*=\"_cardOpen\"],[data-dsh-adapt=\"off\"],[data-dsh-adapt=\"off\"] *){min-width:44px!important;min-height:44px!important}\n.dshm-main[data-dsh-panel=\"1\"] [data-slot=\"main\"]>:not([data-dsh-adapt=\"off\"]) :is(button,[role=\"button\"],a):not([data-dsh-adapt=\"off\"],[data-dsh-adapt=\"off\"] *){touch-action:manipulation}\n}\n/* Reading mode (issue #194): after scrolling down a long conversation the\n composer editor collapses so the reading area is unobstructed. The card stays\n and keeps the upstream Send/Stop row; its generated label is the way back, and\n the text comes from --dshm-composer-restore-label so nothing is injected into\n the React-managed card. Opt-in, off by default. */\n[data-dsh-mobile-composer-collapsed=\"true\"] [data-composer-card] :is([contenteditable=\"true\"],[contenteditable=\"plaintext-only\"],[contenteditable=\"\"],textarea){display:none!important}\n[data-dsh-mobile-composer-collapsed=\"true\"] [data-composer-card]{\n padding-top:6px!important;padding-bottom:6px!important;min-height:0!important;cursor:pointer}\n[data-dsh-mobile-composer-collapsed=\"true\"] [data-composer-card]::before{\n content:var(--dshm-composer-restore-label, \"\");display:flex;align-items:center;\n justify-content:center;min-height:44px;font-size:13px;opacity:.75;pointer-events:none}\n`\n\nfunction MobileAppFrame(props: MobileRootProps & {\n readonly controller: MobileLayoutController\n readonly requestDetailsClose: () => void\n}): ReactNode {\n const state = useSyncExternalStore(props.controller.subscribe, props.controller.getSnapshot)\n const suppressKeyboardUntil = useRef(0)\n const suppressComposerUntil = useRef(0)\n const previousPanelId = useRef(state.panelInfo.activePanelId)\n const navigationIme = useRef(new Map<HTMLElement, string | null>())\n const restoreNavigationIme = (): void => {\n for (const [editor, previous] of navigationIme.current) {\n if (editor.getAttribute('inputmode') !== 'none') continue\n if (previous === null) editor.removeAttribute('inputmode')\n else editor.setAttribute('inputmode', previous)\n }\n navigationIme.current.clear()\n }\n useLayoutEffect(() => {\n const previous = previousPanelId.current\n previousPanelId.current = state.panelInfo.activePanelId\n if (previous === null || state.panelInfo.activePanelId !== null\n || !window.matchMedia(TOUCH_PRIMARY_QUERY).matches) return\n // All panel exits precede the remounted composer's passive autofocus.\n restoreNavigationIme()\n suppressComposerUntil.current = performance.now() + 500\n const active = document.activeElement\n if (active instanceof HTMLElement && active.matches(COMPOSER_EDITOR_SELECTOR)) active.blur()\n }, [state.panelInfo.activePanelId])\n // The width decides whether the window is big enough and the device's shorter\n // side decides whether it is a tablet: width alone would dock a landscape\n // phone, and the viewport height alone would undock a tablet whose soft\n // keyboard is open (Pad 9 Pro Max reports innerHeight 441 in landscape).\n // `resize` fires on rotation, window resizing and keyboard-driven viewport\n // changes, so both facts are re-read with the same frame-coalesced measurement.\n const [viewport, setViewport] = useState(readViewport)\n useEffect(() => {\n let frame: number | undefined\n const resize = (): void => {\n if (frame !== undefined) return\n frame = window.requestAnimationFrame(() => {\n frame = undefined\n setViewport(readViewport())\n })\n }\n window.addEventListener('resize', resize)\n return () => {\n window.removeEventListener('resize', resize)\n if (frame !== undefined) window.cancelAnimationFrame(frame)\n }\n }, [])\n const viewportWidth = viewport.width\n const wideViewport = isWideViewportLayout(viewport.width, viewport.shortSide)\n const rightbar = resolveMobileRightbarLayout(\n viewport.width,\n wideViewport,\n state.sidebarOpen,\n state.rightbarTrack,\n state.rightbarFullscreen,\n )\n const rightbarDocked = state.detailsOpen && rightbar.docked\n // DSH reports a fullscreen panel through the layout service; the overlay has\n // to hand over the whole viewport instead of its docked track (see the\n // `data-rightbar-fullscreen` rule). Phones derive fullscreen from their\n // width, so the flag is already set there.\n const rightbarFullscreen = state.detailsOpen && state.rightbarFullscreen\n // The panel owns the viewport on phones (no column fits) and in fullscreen on\n // a wider screen, so the conversation behind it is inert and needs no scrim.\n const rightbarFullWidth = state.detailsOpen && !rightbarDocked && (!wideViewport || rightbarFullscreen)\n const [documentLanguage, setDocumentLanguage] = useState(document.documentElement.lang)\n const browserLanguages = navigator.languages.length > 0 ? navigator.languages : [navigator.language]\n const language = resolveMobileLayoutLanguage(documentLanguage, browserLanguages)\n const messages = MOBILE_LAYOUT_MESSAGES[language]\n const scrimOpen = !rightbarFullWidth && isMobileScrimOpen(state.sidebarOpen, state.detailsOpen && !rightbarDocked, wideViewport)\n const activeSessionId = props.useSessions(session => {\n const current = session.current\n return current !== undefined && session.byId[current]?.blank === false ? current : undefined\n })\n const hasSession = activeSessionId !== undefined\n\n // Warm DSH session-query's prepared-session cache for the session the user just\n // left after a switch settles (issue #291). Opt-in via the session-prefetch\n // configuration; silent, read-only and bounded so it never disturbs normal\n // requests or live streams.\n const prefetchEnabled = useSyncExternalStore(\n subscribeSessionPrefetchEnabled,\n readSessionPrefetchEnabled,\n () => false,\n )\n const prefetchTracker = useRef<SessionPrefetchTracker | undefined>(undefined)\n const prefetchTimer = useRef<number | undefined>(undefined)\n const prefetchDispose = useRef<(() => void) | undefined>(undefined)\n // Rebuild the tracker when the opt-in flips: the switch is part of the config,\n // and a stale tracker would keep answering `skip('disabled')` (or keep warming\n // after the user turned it off).\n if (prefetchTracker.current === undefined || prefetchTracker.current.enabled !== prefetchEnabled) {\n prefetchTracker.current = new SessionPrefetchTracker(sessionPrefetchConfigFrom(prefetchEnabled))\n }\n useEffect(() => {\n if (activeSessionId === undefined) return\n const decision = prefetchTracker.current!.switchTo(activeSessionId)\n if (decision.action !== 'warm') return\n const target = decision.target\n if (prefetchTimer.current !== undefined) clearTimeout(prefetchTimer.current)\n prefetchTimer.current = window.setTimeout(() => {\n prefetchTimer.current = undefined\n // Keep the disposer: leaving the session (or unmounting) should abort a\n // request that would otherwise run to its timeout in the background.\n prefetchDispose.current?.()\n prefetchDispose.current = prefetchSession(fetch, target, SESSION_PREFETCH_DEFAULTS.timeoutMs)\n }, SESSION_PREFETCH_DEFAULTS.settleMs)\n return () => {\n if (prefetchTimer.current !== undefined) { clearTimeout(prefetchTimer.current); prefetchTimer.current = undefined }\n prefetchDispose.current?.()\n prefetchDispose.current = undefined\n }\n }, [activeSessionId, prefetchEnabled])\n // Reading mode (issue #194): while the user scrolls down a long conversation,\n // collapse the composer editor so the reading area is unobstructed; tapping the\n // collapsed card, focusing the composer, opening the keyboard, scrolling back up,\n // having a draft, or a running reply expands it again. Opt-in, off by default\n // (see COMPOSER_COLLAPSE_DEFAULTS). The composer and its draft stay owned by DSH;\n // this only toggles presentation.\n //\n // The switch is read from the persisted flag rather than a module singleton: the\n // settings row ships in the client bundle while this file is inlined into the\n // layout bundle, so two copies would each hold their own value and the toggle\n // would only apply after a reload.\n const collapseEnabled = useSyncExternalStore(\n subscribeComposerCollapseEnabled,\n readComposerCollapseEnabled,\n () => false,\n )\n // A running reply is not a composer phase: DSH reports it on the Session summary,\n // and data-phase returns to plain as soon as the submission is accepted, so the\n // phase alone would let the composer vanish mid-stream. Read the real flag.\n const activeRunning = props.useSessions(selectActiveSessionRunning)\n const runningRef = useRef(activeRunning)\n runningRef.current = activeRunning\n const active = collapseEnabled && hasSession\n const readingMode = useRef<ComposerReadingModeHandle | undefined>(undefined)\n // The DOM wiring lives in installComposerReadingMode so the scroll container,\n // the dead zone and the guards can be driven in a browser fixture, not only\n // asserted from source text.\n useEffect(() => {\n if (!active) return\n const installed = installComposerReadingMode({\n restoreLabel: messages.composerRestore,\n isRunning: () => runningRef.current,\n })\n readingMode.current = installed\n if (runningRef.current) installed.expand()\n return () => {\n readingMode.current = undefined\n installed.dispose()\n }\n // activeSessionId tears the mode down and reinstalls it, so a collapse never\n // leaks into the next conversation and the new scroller starts bound.\n }, [active, activeSessionId, messages.composerRestore])\n useEffect(() => {\n if (!activeRunning) return\n // Reset the dead zone too: without this the next downward scroll immediately\n // re-collapses the composer the user just came back for.\n readingMode.current?.expand()\n document.documentElement.setAttribute('data-dsh-mobile-composer-collapsed', 'false')\n }, [activeRunning])\n\n useEffect(() => {\n const observer = new MutationObserver(() => { setDocumentLanguage(document.documentElement.lang) })\n observer.observe(document.documentElement, { attributes: true, attributeFilter: ['lang'] })\n return () => { observer.disconnect() }\n }, [])\n\n useEffect(() => {\n if (!hasSession) props.controller.closeDetails()\n }, [hasSession, props.controller])\n\n // Mirror the stock layout: project the current session title into the\n // browser tab, restoring the product title when no session is selected.\n const sessionTitle = props.useSessions(session =>\n session.current === undefined ? undefined : session.byId[session.current]?.title,\n )\n useEffect(() => {\n const productTitle = document.title\n if (sessionTitle !== undefined) document.title = `${sessionTitle} — ${productTitle}`\n return () => { document.title = productTitle }\n }, [sessionTitle])\n\n useEffect(() => {\n const elementTarget = (target: EventTarget | null): Element | null =>\n target instanceof Element ? target : null\n const suppressAutofocus = (event: FocusEvent): void => {\n const target = elementTarget(event.target)\n if (target === null) return\n const editable = target instanceof HTMLElement && (target.matches('input,textarea') || target.isContentEditable)\n if (!editable) return\n if (isComposerOwnedFocus(target)) {\n if (performance.now() < suppressComposerUntil.current) target.blur()\n return\n }\n if (performance.now() >= suppressKeyboardUntil.current) return\n target.blur()\n }\n const suppressBranchAutofocus = (event: MouseEvent): void => {\n if (!(event.target instanceof Element)) return\n const branch = event.target.closest('button[aria-label*=\"分支\"],button[aria-label*=\"Branch\"],button[aria-label*=\"branch\"],button[aria-label*=\"Ramo\"],button[aria-label*=\"ramo\"]')\n if (branch === null || branch.hasAttribute('disabled') || branch.getAttribute('aria-disabled') === 'true') return\n suppressKeyboardUntil.current = performance.now() + 700\n window.setTimeout(() => {\n const active = document.activeElement\n if (active instanceof HTMLElement && (active.matches('input,textarea') || active.isContentEditable)) active.blur()\n }, 0)\n }\n // The native composer deliberately preserves editor focus when its Add menu\n // opens, and on a phone that focus summons the soft keyboard. Withholding the\n // IME leaves the focus, the caret, and the draft exactly as stock left them;\n // any other tap restores the keyboard.\n const applyComposerImePolicy = (event: PointerEvent): void => {\n const target = elementTarget(event.target)\n // A deliberate tap in the composer ends the navigation-only suppression\n // before focus can reach the editor. The Add trigger then reclaims its\n // existing inputmode=\"none\" policy below.\n if (isComposerOwnedFocus(target)) {\n suppressComposerUntil.current = 0\n restoreNavigationIme()\n }\n const policy = resolveComposerImePolicy(\n target,\n window.matchMedia(TOUCH_PRIMARY_QUERY).matches,\n )\n if (policy === 'ignore') return\n for (const editor of document.querySelectorAll<HTMLElement>(COMPOSER_EDITOR_SELECTOR)) {\n if (policy === 'withhold') editor.setAttribute('inputmode', 'none')\n else if (editor.getAttribute('inputmode') === 'none') editor.removeAttribute('inputmode')\n }\n }\n document.addEventListener('focusin', suppressAutofocus, true)\n document.addEventListener('click', suppressBranchAutofocus, true)\n // A finger tap never fires mousedown on Android, and this has to land before\n // the trigger's own focus, so it runs on capture for pointerdown.\n document.addEventListener('pointerdown', applyComposerImePolicy, true)\n const disposeSendKeyboard = installComposerSendKeyboardPolicy(() => {\n suppressComposerUntil.current = performance.now() + 700\n })\n return () => {\n document.removeEventListener('focusin', suppressAutofocus, true)\n document.removeEventListener('click', suppressBranchAutofocus, true)\n document.removeEventListener('pointerdown', applyComposerImePolicy, true)\n disposeSendKeyboard()\n restoreNavigationIme()\n // A withheld editor outliving the surface would strand the composer without\n // a keyboard for the rest of the session.\n for (const editor of document.querySelectorAll<HTMLElement>(`${COMPOSER_CARD_SELECTOR} [inputmode=\"none\"]`)) {\n editor.removeAttribute('inputmode')\n }\n }\n }, [])\n\n // Session navigation on touch withholds upstream composer autofocus; only a\n // narrow overlay drawer closes after the row's own click handler completes.\n const closeDrawerAfterSessionAction = (event: { readonly target: EventTarget | null }): void => {\n if (!(event.target instanceof Element)) return\n if (isSessionRowNavigation(event.target) && window.matchMedia(TOUCH_PRIMARY_QUERY).matches) {\n const deadline = performance.now() + 500\n suppressComposerUntil.current = deadline\n for (const editor of document.querySelectorAll<HTMLElement>(COMPOSER_EDITOR_SELECTOR)) {\n if (!navigationIme.current.has(editor)) navigationIme.current.set(editor, editor.getAttribute('inputmode'))\n editor.setAttribute('inputmode', 'none')\n if (document.activeElement === editor) editor.blur()\n }\n window.setTimeout(() => {\n if (suppressComposerUntil.current !== deadline) return\n suppressComposerUntil.current = 0\n restoreNavigationIme()\n }, 500)\n }\n if (viewportIsWide()) return\n const row = event.target.closest<HTMLElement>('[role=\"treeitem\"][aria-selected]')\n const action = event.target.closest('button,[role=\"button\"]')\n const startsSession = action?.matches('button[class*=\"_newSession\"],button[class*=\"_brand\"]')\n || /新建会话|新会话|new session|new conversation|nuova sessione|nuova conversazione/i.test(action?.getAttribute('aria-label') ?? '')\n if (row === null && !startsSession) return\n if (row !== null && action !== null && action !== row) return\n suppressKeyboardUntil.current = performance.now() + 500\n // Let the session row finish its own click handler before unmounting the drawer.\n window.setTimeout(() => {\n props.controller.closeSidebar()\n const active = document.activeElement\n if (active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement) active.blur()\n }, 0)\n }\n\n return createElement('div', {\n className: 'dshm-shell', lang: language,\n // The stylesheet follows this marker instead of a media query: the band\n // depends on `screen`, which CSS cannot read. It is part of the first render,\n // so a tablet never paints the drawer band and then reflows.\n [WIDE_LAYOUT_ATTRIBUTE]: wideViewport ? '1' : '0',\n 'data-rightbar-docked': rightbarDocked,\n 'data-rightbar-fullscreen': rightbarFullscreen,\n style: { '--dshm-rightbar-width': `${rightbar.width}px` },\n },\n createElement('main', {\n className: 'dshm-main',\n 'data-dsh-mobile-session': activeSessionId,\n ...(rightbarFullWidth ? { inert: '', 'aria-hidden': true } : {}),\n // Legacy dsh-web community plugins use semantic pane attributes as their\n // compatibility path when the stock CSS-module column names are absent.\n 'data-pane': 'conversation',\n // A third-party panel is open: the host owes its controls a touch-sized hit area\n // (see the plugin-panel block in MOBILE_LAYOUT_STYLES).\n 'data-dsh-panel': state.panelInfo.activePanelId === null ? '0' : '1',\n },\n state.panelInfo.activePanelId !== null && !wideViewport ? createElement('div', {\n className: 'dshm-panelNav',\n }, createElement('button', {\n type: 'button',\n className: 'dshm-panelBack',\n 'aria-label': messages.backToConversation,\n disabled: state.sidebarOpen,\n onClick: () => { props.controller.selectPanel(null) },\n }, createElement('svg', {\n 'aria-hidden': true, viewBox: '0 0 24 24', fill: 'none',\n }, createElement('path', {\n d: 'M15 5l-7 7 7 7',\n stroke: 'currentColor', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round',\n })), createElement('span', null, messages.backToConversation))) : null,\n createElement('div', { className: 'dshm-mainContent' }, props.renderSlot('main', {}, {\n entryKey: state.panelInfo.activePanelId ?? 'conversation',\n fallback: props.renderSlot('conversation', {}),\n }))),\n createElement('button', {\n 'aria-label': messages.closePanels,\n className: 'dshm-scrim',\n // A persistent wide sidebar needs no dimming; the scrim only covers\n // the narrow overlay drawer and the details panel.\n 'data-open': scrimOpen,\n 'aria-hidden': !scrimOpen,\n onClick: () => {\n if (!scrimOpen) return\n state.detailsOpen ? props.requestDetailsClose() : props.controller.closeSidebar()\n },\n tabIndex: scrimOpen ? 0 : -1,\n type: 'button',\n }),\n createElement('aside', {\n 'aria-label': messages.workspaceNavigation,\n className: 'dshm-drawer',\n 'data-pane': 'sidebar',\n 'data-open': state.sidebarOpen,\n // The phone adapter promotes the whale toggle to a fixed high layer.\n // Remove that entire navigation surface while the right modal owns focus.\n 'data-right-modal': state.detailsOpen && !rightbarDocked,\n ...(state.detailsOpen && !rightbarDocked ? { inert: '', 'aria-hidden': true } : {}),\n // Community rows collapse their label when an ancestor carries this marker.\n ...(state.sidebarOpen ? {} : { 'data-sidebar-collapsed': '' }),\n onClickCapture: closeDrawerAfterSessionAction,\n }, props.renderSlot('sidebar', {\n collapsed: !state.sidebarOpen,\n width: state.sidebarOpen ? 340 : 56,\n })),\n createElement('aside', {\n 'aria-hidden': !state.detailsOpen,\n className: 'dshm-details',\n 'data-open': state.detailsOpen,\n ...(state.detailsOpen ? {} : { inert: '' }),\n }, [\n // DSH 0.1.3 and earlier bind details to a Session. Newer DSH owns the\n // Session decision inside its root-scoped rightbar occupant, so that\n // occupant must stay mounted even while no Session is selected.\n hasSession ? props.renderSlot('details', {}) : undefined,\n props.renderSlot('rightbar', {\n width: rightbar.width,\n viewportWidth,\n // The official frame reports whether a persistent column still fits\n // (normal.rightbar > 0); this layout renders the right panel in the\n // details overlay, which needs no column space. Reporting false would\n // make RightbarSeat force the surface closed immediately after opening\n // it (ui-sidebar-right: `shown && !fullscreen && !canShow` ->\n // actions.setExpanded(false)), so the panel could never stay open on a\n // phone-width viewport.\n canShow: true,\n }),\n ]),\n createElement('div', { className: 'dshm-overlay', 'data-shell-overlay': true }, props.renderSlot('shell.overlay', {})),\n )\n}\n\n// One controller per document: re-applying the layout (reconnect, tab\n// refocus) must not reset the user's explicit sidebar toggle.\nlet sharedController: MobileLayoutController | undefined\n\n/** Replace the desktop layout module on the authenticated mobile surface. */\nexport function apply(ctx: MobileClientContext): void {\n sharedController ??= new MobileLayoutController()\n const controller = sharedController\n ctx.effect(() => {\n const style = document.createElement('style')\n style.dataset.plugin = 'dsh-mobile-layout'\n style.textContent = MOBILE_LAYOUT_STYLES\n document.head.append(style)\n const disposeMainPanelRegistry = controller.bindMainPanelRegistry(id =>\n ctx.slots.entries('main').some(entry => entry.options.key === id))\n const disposeService = ctx.reflect.provide('layout', controller)\n // The official layout owns the root `panelInfo` hook; replacing the layout\n // module means replacing that owner. Without it every registration that\n // declares the standard `usePanelInfo` prop fails assembly\n // (\"strict standard hook 'panelInfo' has no source\") and renders as a dead\n // cell — the workspace sidebar's session list lives exactly there.\n const disposePanelInfo = typeof ctx.slots.provideRoot === 'function'\n ? ctx.slots.provideRoot({ hooks: { panelInfo: controller.panelInfo } })\n : () => {}\n const requestDetailsClose = (): void => {\n closeDetailsFromScrim(ctx.get('sidebarRight'), () => { controller.closeDetails() })\n }\n const disposeRoot = ctx.slots.register<MobileRootProps>({\n name: 'root',\n children: {\n sidebar: { kind: 'single', scope: 'root' },\n conversation: { kind: 'single', scope: 'session-maybe' },\n // The conversation panel moved into this keyed slot in DSH 0.1.5;\n // without the declaration the center column stays blank.\n main: { kind: 'keyed', scope: 'root' },\n rightbar: { kind: 'single', scope: 'root' },\n details: { kind: 'single', scope: 'session' },\n 'shell.overlay': { kind: 'list', scope: 'root' },\n },\n }, props => createElement(MobileAppFrame, {\n ...props,\n controller,\n // sidebarRight is registered after the layout it depends on, so resolve\n // the optional service at gesture time rather than caching it at boot.\n requestDetailsClose,\n }))\n const onNativeBack = (event: Event): void => {\n if (!event.cancelable || event.defaultPrevented) return\n const state = controller.getSnapshot()\n if (state.detailsOpen) {\n event.preventDefault()\n requestDetailsClose()\n } else if (!viewportIsWide() && state.sidebarOpen) {\n event.preventDefault()\n controller.closeSidebar()\n } else if (state.panelInfo.activePanelId !== null) {\n event.preventDefault()\n controller.selectPanel(null)\n }\n }\n window.addEventListener('dsh-mobile:native-back', onNativeBack)\n const retainMainPanels = (): void => {\n controller.retainMainPanels(ctx.slots.entries('main').flatMap(entry =>\n entry.options.key === undefined ? [] : [entry.options.key]))\n }\n const disposePanels = ctx.slots.subscribe('main', retainMainPanels)\n retainMainPanels()\n return () => {\n window.removeEventListener('dsh-mobile:native-back', onNativeBack)\n controller.dispose()\n disposePanels()\n disposeRoot()\n disposePanelInfo()\n void disposeService()\n disposeMainPanelRegistry()\n style.remove()\n }\n }, 'dsh-mobile: dedicated root layout')\n\n ctx.effect(() => {\n const presenter = new ThemePresenter()\n presenter.apply(ctx.theme.getTheme())\n const off = ctx.on('theme/change', snapshot => { presenter.apply(snapshot) })\n return () => { off(); presenter.dispose() }\n }, 'dsh-mobile: theme presenter')\n}\n\n/** Preserve the official layout module's dependency ordering. */\nexport const inject: readonly string[] = ['slots', 'theme']\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAYA,MAAa,wBAAwB;;ECVrC,MAAa,yBAAyB,OAAO,OAAO;GAClD,IAAI,OAAO,OAAO;IAAE,aAAa;IAAmB,qBAAqB;IAAyC,oBAAoB;IAA4B,iBAAiB;GAA+B,CAAC;GACnN,IAAI,OAAO,OAAO;IAAE,aAAa;IAAgB,qBAAqB;IAAoC,oBAAoB;IAAwB,iBAAiB;GAAgB,CAAC;GACxL,IAAI,OAAO,OAAO;IAAE,aAAa;IAAQ,qBAAqB;IAAY,oBAAoB;IAAQ,iBAAiB;GAAQ,CAAC;EAClI,CAAC;;ECsBD,MAAa,6BAA+D;GAC1E,SAAS;GACT,qBAAqB;GACrB,gBAAgB;EAClB;;;;;;EAOA,IAAa,0BAAb,MAAqC;GACnC,kBAA0B;GAC1B,kBAA0B;GAC1B,QAAuC;GACvC;GAEA,YAAY,QAA0C;IACpD,KAAK,SAAS;GAChB;;GAGA,IAAI,UAAmB;IACrB,OAAO,KAAK,OAAO;GACrB;;GAGA,WAAW,SAAwB;IACjC,KAAK,SAAS;KAAE,GAAG,KAAK;KAAQ;IAAQ;IACxC,IAAI,CAAC,SAAS,KAAK,MAAM;GAC3B;;;;;;;;GASA,OAAO,QAAuC;IAC5C,IAAI,CAAC,KAAK,OAAO,SAAS;KACxB,KAAK,MAAM;KACX,OAAO,KAAK;IACd;IACA,IAAI,KAAK,UAAU,aAAa;KAC9B,IAAI,SAAS,GAAG;MAEd,KAAK,kBAAkB;MACvB,OAAO,KAAK;KACd;KACA,KAAK,mBAAmB,CAAC;KACzB,IAAI,KAAK,mBAAmB,KAAK,IAAI,KAAK,OAA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
  "private": false,
5
5
  "description": "DeepSeek Harness 移动端适配与安全访问插件,支持局域网、远程连接、Android App 和手机浏览器。",
6
6
  "icon": "assets/brand/plugin-icon.png",
@@ -140,6 +140,7 @@
140
140
  "smoke:push-settings": "node ./scripts/smoke-mobile-push-settings.mjs",
141
141
  "smoke:voice-session": "node ./scripts/smoke-voice-session.mjs",
142
142
  "smoke:composer-keyboard": "node ./scripts/smoke-composer-keyboard.mjs",
143
+ "smoke:composer-reading-mode": "node ./scripts/smoke-composer-reading-mode.mjs",
143
144
  "smoke:mobile-compat": "node ./scripts/smoke-mobile-compat.mjs",
144
145
  "smoke:boot-feedback": "node ./scripts/smoke-mobile-boot-feedback.mjs",
145
146
  "smoke:composer-overflow": "node ./scripts/smoke-composer-overflow.mjs",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mobile-question-fixes",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "private": true,
5
5
  "description": "Scoped question-card scrolling and touch-keyboard fixes for DSH Web.",
6
6
  "type": "module",