brumate 0.7.2 → 0.8.0

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.
Files changed (88) hide show
  1. package/dist/{boot-CMy0f_iC.d.ts → boot-BkUdiYOF.d.ts} +2 -2
  2. package/dist/cli.js +3 -2
  3. package/dist/cli.js.map +1 -1
  4. package/dist/{client-COm1iA6w.js → client-B0FXW5Kw.js} +48 -14
  5. package/dist/client-B0FXW5Kw.js.map +1 -0
  6. package/dist/{client-DnFF9_lv.d.ts → client-Cq6aTiDs.d.ts} +15 -7
  7. package/dist/{defer-Cesb-k2Q.js → defer-BMIMP4Hq.js} +2 -2
  8. package/dist/{defer-Cesb-k2Q.js.map → defer-BMIMP4Hq.js.map} +1 -1
  9. package/dist/{devtools-C9IEkgc1.js → devtools-B4prrxht.js} +257 -118
  10. package/dist/devtools-B4prrxht.js.map +1 -0
  11. package/dist/devtools-calls-DGW6nLZ2.js +249 -0
  12. package/dist/devtools-calls-DGW6nLZ2.js.map +1 -0
  13. package/dist/devtools-panel-B1nF1KB7.js +3978 -0
  14. package/dist/devtools-panel-B1nF1KB7.js.map +1 -0
  15. package/dist/error-catalog-DakxjSgj.js +308 -0
  16. package/dist/error-catalog-DakxjSgj.js.map +1 -0
  17. package/dist/error-catalog-VxLbz-6p.js +1 -0
  18. package/dist/{files-BuQvpBwF.js → files-D5GtxwEQ.js} +2 -2
  19. package/dist/{files-BuQvpBwF.js.map → files-D5GtxwEQ.js.map} +1 -1
  20. package/dist/index.d.ts +73 -18
  21. package/dist/index.js +11 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/{inspect-BSHv1_25.js → inspect-CGl5Y8q6.js} +581 -399
  24. package/dist/inspect-CGl5Y8q6.js.map +1 -0
  25. package/dist/{loader-CLKrJMqw.js → loader-BsaSuIoG.js} +4 -4
  26. package/dist/{loader-CLKrJMqw.js.map → loader-BsaSuIoG.js.map} +1 -1
  27. package/dist/{navigate-OHb0Uw1P.js → navigate-BlowKvhB.js} +13 -6
  28. package/dist/navigate-BlowKvhB.js.map +1 -0
  29. package/dist/{rpc-BAKbRWOT.js → rpc-C1jYVNAe.js} +5 -4
  30. package/dist/rpc-C1jYVNAe.js.map +1 -0
  31. package/dist/runtime/bundles.d.ts +1 -1
  32. package/dist/runtime/client.d.ts +2 -2
  33. package/dist/runtime/client.js +4 -3
  34. package/dist/runtime/devtools.d.ts +59 -1
  35. package/dist/runtime/devtools.js +1 -1
  36. package/dist/runtime/hot.d.ts +1 -1
  37. package/dist/runtime/hot.js +6 -2
  38. package/dist/runtime/hot.js.map +1 -1
  39. package/dist/runtime/loader.d.ts +2 -2
  40. package/dist/runtime/loader.js +2 -2
  41. package/dist/runtime/server.d.ts +1 -1
  42. package/dist/runtime/server.js +3 -2
  43. package/dist/runtime/signals.d.ts +1 -1
  44. package/dist/runtime/static-loader.d.ts +2 -2
  45. package/dist/runtime/static-loader.js +1 -1
  46. package/dist/runtime/store.d.ts +2 -2
  47. package/dist/runtime/store.js +1 -1
  48. package/dist/runtime/testing.d.ts +2 -2
  49. package/dist/runtime/testing.js +2 -2
  50. package/dist/search-params-Wg-0FsMj.js +148 -0
  51. package/dist/search-params-Wg-0FsMj.js.map +1 -0
  52. package/dist/{stream-RXLadXx1.js → serial-ioa17MuY.js} +67 -168
  53. package/dist/serial-ioa17MuY.js.map +1 -0
  54. package/dist/serial-ribg9NAj.js +1 -0
  55. package/dist/{server-BVObWh-w.js → server-BUuf7XPZ.js} +61 -16
  56. package/dist/server-BUuf7XPZ.js.map +1 -0
  57. package/dist/{server-0rS5vUW1.d.ts → server-DesBZv5g.d.ts} +8 -3
  58. package/dist/{search-params-C64liRBj.js → shared-CX_YacDm.js} +3 -148
  59. package/dist/shared-CX_YacDm.js.map +1 -0
  60. package/dist/{signals-DBnq9QRW.d.ts → signals-7VVD9C_H.d.ts} +2 -2
  61. package/dist/{static-loader-CxANokZ4.js → static-loader-C_en-4v8.js} +2 -2
  62. package/dist/{static-loader-CxANokZ4.js.map → static-loader-C_en-4v8.js.map} +1 -1
  63. package/dist/{static-loader-BYbXVJDY.d.ts → static-loader-UKnK11Em.d.ts} +2 -2
  64. package/dist/{store-xlTzAM_r.d.ts → store-9_oa0HG1.d.ts} +15 -2
  65. package/dist/{store-BIBAYZo-.js → store-Cy4EEyZ7.js} +148 -2
  66. package/dist/store-Cy4EEyZ7.js.map +1 -0
  67. package/dist/stream-read-BTsYstJY.js +22 -0
  68. package/dist/stream-read-BTsYstJY.js.map +1 -0
  69. package/dist/stream-read-Dek3HnqO.js +1 -0
  70. package/dist/vite.d.ts +1 -1
  71. package/dist/vite.js +37 -5
  72. package/dist/vite.js.map +1 -1
  73. package/package.json +7 -4
  74. package/skills/brumate/SKILL.md +6 -2
  75. package/skills/brumate/references/errors.md +21 -2
  76. package/skills/brumate/references/state.md +31 -0
  77. package/skills/brumate/references/syntax.md +45 -1
  78. package/dist/client-COm1iA6w.js.map +0 -1
  79. package/dist/devtools-C9IEkgc1.js.map +0 -1
  80. package/dist/devtools-panel-Doit__YG.js +0 -2018
  81. package/dist/devtools-panel-Doit__YG.js.map +0 -1
  82. package/dist/inspect-BSHv1_25.js.map +0 -1
  83. package/dist/navigate-OHb0Uw1P.js.map +0 -1
  84. package/dist/rpc-BAKbRWOT.js.map +0 -1
  85. package/dist/search-params-C64liRBj.js.map +0 -1
  86. package/dist/server-BVObWh-w.js.map +0 -1
  87. package/dist/store-BIBAYZo-.js.map +0 -1
  88. package/dist/stream-RXLadXx1.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtools-panel-B1nF1KB7.js","names":["describe","STYLE","openInEditor","STYLE","STYLE"],"sources":["../src/runtime/devtools-panel/dom.ts","../src/runtime/devtools-panel/format.ts","../src/runtime/devtools-panel/info.ts","../src/runtime/devtools-panel/copy.ts","../src/runtime/devtools-panel/activity.ts","../src/runtime/devtools-panel/stack.ts","../src/runtime/devtools-panel/call-detail.ts","../src/runtime/devtools-panel/workspace.ts","../src/runtime/devtools-panel/graph.ts","../src/runtime/devtools-panel/inspect.ts","../src/runtime/devtools-panel/issues.ts","../src/runtime/devtools-panel/page.ts","../src/runtime/devtools-panel/search.ts","../src/runtime/devtools-panel/shell.ts","../src/runtime/devtools-panel/style.ts","../src/runtime/devtools-panel/split.ts","../src/runtime/devtools-panel.ts"],"sourcesContent":["// Elements, icons and the small parts that the workspaces share.\n\nimport { trustedHTML } from '../trusted.ts';\n\nexport function element<K extends keyof HTMLElementTagNameMap>(\n tag: K,\n attributes: Record<string, string> = {},\n ...children: (Node | string)[]\n): HTMLElementTagNameMap[K] {\n const node = document.createElement(tag);\n for (const [name, value] of Object.entries(attributes)) {\n node.setAttribute(name, value);\n }\n node.append(...children);\n return node;\n}\n\nexport function svg(\n tag: string,\n attributes: Record<string, string | number>,\n ...children: Node[]\n): SVGElement {\n const node = document.createElementNS('http://www.w3.org/2000/svg', tag);\n for (const [name, value] of Object.entries(attributes)) {\n node.setAttribute(name, String(value));\n }\n node.append(...children);\n return node;\n}\n\n/**\n * The icons of the panel: strokes on a grid of 24, in the colour of the text.\n */\nexport const ICONS = {\n overview:\n '<rect x=\"3.5\" y=\"3.5\" width=\"7\" height=\"7\" rx=\"1.75\"/><rect x=\"13.5\" y=\"3.5\" width=\"7\" height=\"7\" rx=\"1.75\"/><rect x=\"3.5\" y=\"13.5\" width=\"7\" height=\"7\" rx=\"1.75\"/><rect x=\"13.5\" y=\"13.5\" width=\"7\" height=\"7\" rx=\"1.75\"/>',\n errors:\n '<path d=\"M10.3 4.6a2 2 0 0 1 3.4 0l7 12.2a2 2 0 0 1-1.7 3H5a2 2 0 0 1-1.7-3z\"/><path d=\"M12 9.5v4\"/><path d=\"M12 16.8v.2\"/>',\n scopes:\n '<rect x=\"9\" y=\"3\" width=\"6\" height=\"5\" rx=\"1.25\"/><rect x=\"3\" y=\"16\" width=\"6\" height=\"5\" rx=\"1.25\"/><rect x=\"15\" y=\"16\" width=\"6\" height=\"5\" rx=\"1.25\"/><path d=\"M12 8v4M6 16v-2.25A1.75 1.75 0 0 1 7.75 12h8.5A1.75 1.75 0 0 1 18 13.75V16\"/>',\n elements: '<path d=\"M5 4.5 18 10l-5.5 2L10 17.5z\"/><path d=\"m13 13 5.5 5.5\"/>',\n graph:\n '<circle cx=\"6\" cy=\"12\" r=\"2.5\"/><circle cx=\"18\" cy=\"6\" r=\"2.5\"/><circle cx=\"18\" cy=\"18\" r=\"2.5\"/><path d=\"m8.3 10.8 7.4-3.6M8.3 13.2l7.4 3.6\"/>',\n log: '<path d=\"M9 6h11M9 12h11M9 18h11\"/><path d=\"M4.5 6h.01M4.5 12h.01M4.5 18h.01\" stroke-width=\"2.6\"/>',\n loading: '<path d=\"M4 6h7M8 12h9M13 18h7\"/>',\n state:\n '<ellipse cx=\"12\" cy=\"6\" rx=\"7.5\" ry=\"2.75\"/><path d=\"M4.5 6v6c0 1.5 3.4 2.75 7.5 2.75s7.5-1.25 7.5-2.75V6\"/><path d=\"M4.5 12v6c0 1.5 3.4 2.75 7.5 2.75s7.5-1.25 7.5-2.75v-6\"/>',\n effects: '<path d=\"M19.5 12a7.5 7.5 0 1 1-2.2-5.3\"/><path d=\"M19.5 4v4h-4\"/>',\n navigation:\n '<path d=\"M4 7h11M4 7l3.5-3.5M4 7l3.5 3.5\"/><path d=\"M20 17H9M20 17l-3.5-3.5M20 17l-3.5 3.5\"/>',\n server:\n '<rect x=\"4\" y=\"4\" width=\"16\" height=\"6.5\" rx=\"1.5\"/><rect x=\"4\" y=\"13.5\" width=\"16\" height=\"6.5\" rx=\"1.5\"/><path d=\"M7.5 7.25h.01M7.5 16.75h.01\" stroke-width=\"2.6\"/>',\n timeline: '<circle cx=\"12\" cy=\"13\" r=\"7.5\"/><path d=\"M12 9.5V13l2.5 1.6M10 3h4\"/>',\n blocks:\n '<path d=\"M12 3.5 3.5 8 12 12.5 20.5 8z\"/><path d=\"M3.5 12 12 16.5 20.5 12M3.5 16 12 20.5 20.5 16\"/>',\n flash:\n '<path d=\"M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M5.6 18.4l2.1-2.1M16.3 7.7l2.1-2.1\"/><circle cx=\"12\" cy=\"12\" r=\"2.5\"/>',\n pick: '<circle cx=\"12\" cy=\"12\" r=\"7\"/><path d=\"M12 2.5v4M12 17.5v4M2.5 12h4M17.5 12h4\"/><circle cx=\"12\" cy=\"12\" r=\"1.2\" fill=\"currentColor\" stroke=\"none\"/>',\n close: '<path d=\"m6 9.5 6 6 6-6\"/>',\n trash:\n '<path d=\"M4.5 7h15M9.5 7V5a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v2M6.5 7l.9 12.1a1.5 1.5 0 0 0 1.5 1.4h6.2a1.5 1.5 0 0 0 1.5-1.4L17.5 7\"/>',\n pause: '<path d=\"M9 5.5v13M15 5.5v13\"/>',\n play: '<path d=\"M8 5.5v13l10.5-6.5z\"/>',\n fit: '<path d=\"M4 9V5a1 1 0 0 1 1-1h4M20 9V5a1 1 0 0 0-1-1h-4M4 15v4a1 1 0 0 0 1 1h4M20 15v4a1 1 0 0 1-1 1h-4\"/>',\n plus: '<path d=\"M12 5v14M5 12h14\"/>',\n minus: '<path d=\"M5 12h14\"/>',\n bolt: '<path d=\"M13 3 5 13.5h6L10 21l9-11h-6z\"/>',\n open: '<path d=\"M14 4h6v6M20 4l-8.5 8.5M18 14v4.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 4 18.5v-11A1.5 1.5 0 0 1 5.5 6H10\"/>',\n} as const;\n\n/** The name of an icon. */\nexport type IconName = keyof typeof ICONS;\n\n/** An icon by its name, for a button or a tab. */\nexport function icon(name: IconName, size = 14): SVGElement {\n const node = svg('svg', {\n class: 'icon',\n viewBox: '0 0 24 24',\n width: size,\n height: size,\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': 1.8,\n 'stroke-linecap': 'round',\n 'stroke-linejoin': 'round',\n 'aria-hidden': 'true',\n });\n node.innerHTML = trustedHTML(ICONS[name]);\n return node;\n}\n\n/** A button with an icon, and its text or, for an icon alone, its label for screen readers. */\nexport function iconButton(\n name: IconName,\n text: string,\n attributes: Record<string, string> = {},\n iconOnly = false,\n): HTMLButtonElement {\n const button = element(\n 'button',\n { class: `tool${iconOnly ? ' only' : ''}`, ...attributes },\n icon(name),\n );\n if (iconOnly) {\n button.setAttribute('aria-label', text);\n button.title ||= text;\n } else {\n button.append(text);\n }\n return button;\n}\n\nexport function pill(text: string, color = ''): HTMLElement {\n return element('span', { class: `pill ${color}` }, text);\n}\n\n/** A row of cells, as a table row. */\nexport function row(cells: (Node | string)[], tag: 'td' | 'th' = 'td'): HTMLElement {\n const items: HTMLElement[] = [];\n for (const cell of cells) {\n items.push(element(tag, {}, cell));\n }\n return element('tr', {}, ...items);\n}\n\n/** A card of a number, with a label above and a note below. */\nexport function card(label: string, value: string, note: string): HTMLElement {\n return element(\n 'div',\n { class: 'card' },\n element('div', { class: 'label' }, label),\n element('div', { class: 'value' }, value),\n element('div', { class: 'note' }, note),\n );\n}\n\n/** A square of colour and its meaning, for a legend. */\nexport function key(color: string, text: string): HTMLElement {\n return element('span', {}, element('i', { style: `background: ${color}` }), text);\n}\n","// Numbers and values as text.\n\n/** The type of a value, for the column next to it. */\nexport function readType(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (Array.isArray(value)) {\n return 'array';\n }\n if (value instanceof Element) {\n return 'element';\n }\n if (typeof value === 'object') {\n const name = value.constructor?.name;\n return name && name !== 'Object' ? name : 'object';\n }\n return typeof value;\n}\n\nexport function ms(time: number): string {\n return `${Math.round(time)} ms`;\n}\nexport function seconds(time: number): string {\n return `${(time / 1000).toFixed(2)} s`;\n}\nexport function kilobytes(bytes: number): string {\n return `${(bytes / 1024).toFixed(1)} kB`;\n}\n\n/** The keys and values of an object, a map or a set, or the items of an array, in a row. */\nfunction listEntries(value: object): unknown[] {\n if (value instanceof Map) {\n return [...value].flat();\n }\n if (value instanceof Set || Array.isArray(value)) {\n return [...value];\n }\n return Object.entries(value).flat();\n}\n\n/**\n * About how many bytes a value takes in the page state. The state is code\n * that seroval writes, which this follows closely enough to compare values.\n */\nexport function measureSize(value: unknown, seen: Set<object> = new Set()): number {\n if (value === null || value === undefined) {\n return 6;\n }\n switch (typeof value) {\n case 'string':\n return value.length + 2;\n case 'number':\n case 'boolean':\n case 'bigint':\n return String(value).length;\n case 'function':\n // A reference to client code: its ID and its scope.\n return 24;\n case 'object': {\n if (seen.has(value)) {\n // A reference to a value that is in the state already.\n return 6;\n }\n seen.add(value);\n if (value instanceof Date) {\n return 30;\n }\n const entries = listEntries(value);\n let bytes = 2;\n for (const entry of entries) {\n bytes += measureSize(entry, seen) + 1;\n }\n return bytes;\n }\n default:\n return 8;\n }\n}\n\n/** The bytes of the state records of the page. */\nexport function stateBytes(): number {\n let bytes = 0;\n for (const script of document.querySelectorAll('script[b-state]')) {\n bytes += script.textContent?.length ?? 0;\n }\n return bytes;\n}\n\n/** A label cut to the width of a node of the graph. */\nexport function clip(text: string): string {\n return text.length > 34 ? `${text.slice(0, 33)}…` : text;\n}\n","// What the dev server says about the components, and helpers that read the scopes of the page.\n\nimport type { Scope } from '../client.ts';\nimport { findRootScope, preview } from '../devtools.ts';\nimport type { BlockEntry, DevtoolsState } from '../devtools.ts';\nimport { element, icon } from './dom.ts';\n\n/** What the dev server tells about a component: see the inspect endpoint of the plugin. */\nexport interface ComponentInfo {\n name: string;\n file: string;\n /** Each scope of the component, by its number in the compiled component. */\n scopes: Record<number, { label: string; slots: string[]; readers?: string[][] }>;\n graph?: {\n nodes: GraphNode[];\n /** Pairs of node indexes: the first is read by the second. */\n edges: [number, number][];\n };\n /** The inspect report as text. */\n text: string;\n /** The absolute path of the file, for the editor. */\n path?: string;\n /** The URL that the browser loads the client code of the component from. */\n url?: string;\n /** Each anchor of each scope: what it is, its place in the file and what its updates read. */\n anchors?: Record<number, Record<number, { label: string; at?: string; reads: string[] }>>;\n}\n\n/** A node of the graph of a component. */\nexport interface GraphNode {\n kind: string;\n label: string;\n scope: number;\n slot?: number;\n /** Its place in the file, or in the file of the module that gave the code to the component. */\n at?: { line: number; column: number; file?: string };\n}\n\nconst components = new Map<string, Promise<ComponentInfo | undefined>>();\nexport const known: Map<string, ComponentInfo> = new Map();\n\n/** Asks the dev server about a component, once. */\nexport function componentInfo(\n state: DevtoolsState,\n id: string,\n): Promise<ComponentInfo | undefined> {\n let info = components.get(id);\n if (!info) {\n info = fetch(`${state.endpoint}/${encodeURIComponent(id)}`)\n .then((response) => (response.ok ? (response.json() as Promise<ComponentInfo>) : undefined))\n .then((value) => {\n if (value) {\n known.set(id, value);\n }\n return value;\n })\n .catch(() => undefined);\n components.set(id, info);\n }\n return info;\n}\n\n/** The IDs of the components that instances in a list belong to. */\nexport function collectModules(instances: Scope[]): Set<string> {\n const ids = new Set<string>();\n for (const scope of instances) {\n ids.add(scope.m!);\n }\n return ids;\n}\n\n/** How many blocks of the page are in a state. */\nexport function countBlocks(blocks: Iterable<BlockEntry>, blockState: BlockEntry['state']): number {\n let count = 0;\n for (const block of blocks) {\n if (block.state === blockState) {\n count++;\n }\n }\n return count;\n}\n\n/** The infos of many components, in the order of their IDs. */\nexport function loadComponents(\n state: DevtoolsState,\n ids: Iterable<string>,\n): Promise<(ComponentInfo | undefined)[]> {\n const pending: Promise<ComponentInfo | undefined>[] = [];\n for (const id of ids) {\n pending.push(componentInfo(state, id));\n }\n return Promise.all(pending);\n}\n\n/** The value of a name that a scope or one of the scopes around it holds. */\nexport function readValue(scope: Scope, name: string): string | undefined {\n for (let current: Scope | undefined = scope; current; current = current.p) {\n const slots = known.get(findRootScope(current).m ?? '')?.scopes[current.k]?.slots;\n const slot = slots?.indexOf(name) ?? -1;\n if (slot !== -1) {\n return preview(current.s[slot]);\n }\n if (current.m !== undefined) {\n break;\n }\n }\n return undefined;\n}\n\n/** A button that opens a place of a file in the editor, through the dev server. */\nexport function source(info: ComponentInfo | undefined, at = '1:1'): Node | string {\n if (!info) {\n return '';\n }\n const label = at === '1:1' ? info.file : `${info.file}:${at}`;\n if (!info.path) {\n return element('span', { class: 'mono sub' }, label);\n }\n const open = element(\n 'button',\n { class: 'link', title: 'Open in the editor' },\n label,\n icon('open', 12),\n );\n open.addEventListener('click', () => {\n void fetch(`/__open-in-editor?file=${encodeURIComponent(`${info.path}:${at}`)}`);\n });\n return open;\n}\n\n/** A button that opens the place of a graph node in the editor. */\nexport function place(info: ComponentInfo, at: NonNullable<GraphNode['at']>): Node | string {\n const label = `line ${at.line}`;\n const file = at.file ?? info.path;\n if (!file) {\n return element('span', { class: 'mono sub' }, label);\n }\n const open = element(\n 'button',\n { class: 'link', title: `Open ${at.file ?? info.file}:${at.line}:${at.column}` },\n label,\n icon('open', 12),\n );\n open.addEventListener('click', () => {\n void fetch(`/__open-in-editor?file=${encodeURIComponent(`${file}:${at.line}:${at.column}`)}`);\n });\n return open;\n}\n\n/** The scopes of a component instance, without the components inside it. */\nexport function countScopes(scope: Scope): number {\n let count = 1;\n for (const child of scope.children ?? []) {\n if (child.m === undefined) {\n count += countScopes(child);\n }\n }\n return count;\n}\n\n/** The scopes of component instances. */\nexport function roots(state: DevtoolsState): Scope[] {\n const result: Scope[] = [];\n for (const scope of state.scopes?.values() ?? []) {\n if (scope.m !== undefined) {\n result.push(scope);\n }\n }\n return result;\n}\n\n/** The scope with an ID, or nothing when the browser does not have it. */\nexport function findScope(state: DevtoolsState, id: string): Scope | undefined {\n return state.scopes?.get(/^-?\\d+$/.test(id) ? Number(id) : id);\n}\n\n/** What the dev server says about an anchor of a scope, with the component that has it. */\n/** An anchor of a scope: what it is, its place in the file and what its updates read. */\nexport type Anchor = NonNullable<NonNullable<ComponentInfo['anchors']>[number]>[number];\n\nexport async function findAnchor(\n state: DevtoolsState,\n scope: Scope,\n anchor: number,\n): Promise<{ info: ComponentInfo | undefined; component: Scope; place: Anchor | undefined }> {\n const component = findRootScope(scope);\n const info = component.m ? await componentInfo(state, component.m) : undefined;\n return { info, component, place: info?.anchors?.[scope.k]?.[anchor] };\n}\n\n/** The names that an anchor reads, with their values in the scope. */\nexport function drawReads(scope: Scope, reads: string[]): Node[] {\n const pills: Node[] = [];\n for (const name of reads) {\n const value = readValue(scope, name);\n pills.push(\n element(\n 'span',\n { class: 'pill', style: 'margin: 0 4px 2px 0' },\n element('span', { class: 'name' }, name),\n value === undefined ? '' : ` = ${value}`,\n ),\n );\n }\n return pills;\n}\n","// What the dock copies for an agent: an error, a component, a handler run and a server call, as\n// Markdown. Values are cut at a length, and nothing from cookies or headers is in a copy.\n\nimport type { Scope } from '../client.ts';\nimport type { CallTiming, DevtoolsMeta, ErrorEntry, Interaction } from '../devtools.ts';\nimport { element, svg } from './dom.ts';\nimport { ms } from './format.ts';\nimport { known } from './info.ts';\nimport type { ComponentInfo } from './info.ts';\nimport { trustedHTML } from '../trusted.ts';\n\n/** The longest text of a value on screen, as the record cuts them. */\nconst TEXT_LIMIT = 1000;\n/** The longest value on one line of a list. */\nconst INLINE_LIMIT = 300;\n/** The lines of source on each side of the line of an error. */\nconst SOURCE_AROUND = 6;\nconst LEFT_OUT = '[left out]';\n/** Keys that hold cookies, headers or credentials, by a word anywhere in the name. */\nconst SECRET_KEY = /(cookie|authorization|headers?|x-auth|api[-_]?key|csrf|token|secret|password)/i;\n/** A name with a credential word in it, then `:` or `=`, such as `Cookie: a=1` or `sessionCookie = x`. */\nconst SECRET_LINE =\n /([\\w-]*(?:cookie|authorization|token|api[-_]?key|secret|password|x-auth)[\\w-]*)([\"'\\\\\\s]*[:=]\\s*)[^\\n]*/gi;\nconst BEARER = /\\bBearer\\s+[\\w.~+/=-]+/gi;\n\n/** The text without what a cookie, an authorization or a token holds. */\nexport function scrub(text: string): string {\n return text.replace(SECRET_LINE, `$1$2${LEFT_OUT}`).replace(BEARER, `Bearer ${LEFT_OUT}`);\n}\n\n/** Cuts a text at a length, and marks the cut. */\nexport function cutLong(text: string, limit: number = TEXT_LIMIT): string {\n return text.length > limit ? `${text.slice(0, limit)}… (${text.length - limit} more)` : text;\n}\n\n/** A copy of a value that JSON can write: long texts cut, maps and sets as plain values, cycles marked. */\nfunction toPlain(value: unknown, ancestors: Set<object>): unknown {\n if (typeof value === 'bigint') {\n return `${value}n`;\n }\n if (typeof value === 'string') {\n // Scrubbed before the cut and before JSON escapes the quotes, so the word cannot hide.\n return cutLong(scrub(value));\n }\n if (typeof value === 'function') {\n return `[Function ${value.name || 'anonymous'}]`;\n }\n if (value instanceof Error) {\n return { name: value.name, message: cutLong(scrub(value.message)) };\n }\n if (typeof Headers !== 'undefined' && value instanceof Headers) {\n return '[headers]';\n }\n if (typeof value === 'object' && value !== null && 'tagName' in value) {\n return `<${String((value as { tagName: unknown }).tagName).toLowerCase()}>`;\n }\n if (typeof value !== 'object' || value === null || value instanceof Date) {\n return value;\n }\n // Only an object that is its own ancestor is a cycle; the same object twice is fine.\n if (ancestors.has(value)) {\n return '[Circular]';\n }\n ancestors.add(value);\n let result: unknown;\n if (Array.isArray(value) || value instanceof Set) {\n const items: unknown[] = [];\n for (const item of value) {\n // A pair such as `['cookie', 'a=1']`, as `headers.entries()` gives them.\n if (\n Array.isArray(item) &&\n item.length === 2 &&\n typeof item[0] === 'string' &&\n SECRET_KEY.test(item[0])\n ) {\n items.push([item[0], LEFT_OUT]);\n } else {\n items.push(toPlain(item, ancestors));\n }\n }\n result = items;\n } else {\n const copy: Record<string, unknown> = {};\n const entries = value instanceof Map ? value.entries() : Object.entries(value);\n for (const [key, item] of entries) {\n // Whatever a record carries of cookies or headers stays out of every copy.\n copy[String(key)] = SECRET_KEY.test(String(key)) ? LEFT_OUT : toPlain(item, ancestors);\n }\n result = copy;\n }\n ancestors.delete(value);\n return result;\n}\n\n/** The text of a value for a person or an agent, with long texts cut and cycles left out. */\nexport function printValue(value: unknown): string {\n return JSON.stringify(toPlain(value, new Set()), undefined, 2) ?? 'undefined';\n}\n\n/** A value on one line, cut at a length: for a list of values. */\nfunction printInline(value: unknown): string {\n return cutLong(JSON.stringify(toPlain(value, new Set())) ?? 'undefined', INLINE_LIMIT);\n}\n\n/** A block of code in a fence that its content cannot close. */\nfunction fence(text: string, language = ''): string {\n const mark = text.includes('```') ? '````' : '```';\n return `${mark}${language}\\n${text}\\n${mark}`;\n}\n\n/** The lines around a line of a source, numbered, with the line itself marked. */\nexport function cutSource(text: string, line: number): string {\n const lines = text.split('\\n');\n const start = Math.max(1, line - SOURCE_AROUND);\n const end = Math.min(lines.length, line + SOURCE_AROUND);\n const width = String(end).length;\n const out: string[] = [];\n for (let number = start; number <= end; number++) {\n out.push(\n `${number === line ? '>' : ' '} ${String(number).padStart(width)} | ${cutLong(lines[number - 1]!, 200)}`,\n );\n }\n return out.join('\\n');\n}\n\n/** The first lines of the text that tells the versions that the app runs on. */\nfunction writeVersions(meta: DevtoolsMeta): string | undefined {\n const parts: string[] = [];\n if (meta.version) {\n parts.push(`brumate ${meta.version}`);\n }\n if (meta.vite) {\n parts.push(`Vite ${meta.vite}`);\n }\n return parts.length > 0 ? `Versions: ${parts.join(', ')}` : undefined;\n}\n\n/** The text of an error: the message, the place, the code around it, the stack and the versions. */\nexport function writeIssue(\n entry: ErrorEntry,\n label: string,\n meta: DevtoolsMeta = {},\n code?: { file: string; line: number; text: string },\n): string {\n const lines = [\n `An error in the dev server of a brumate app: ${label}`,\n '',\n 'Message:',\n fence(cutLong(entry.message)),\n ];\n const place = code ?? entry.loc;\n if (place) {\n lines.push(\n '',\n `Place: ${place.file}:${place.line}${'column' in place ? `:${place.column}` : ''}`,\n );\n const name = /([^/\\\\]+)\\.brm$/.exec(place.file)?.[1];\n if (name) {\n lines.push(`Component: ${name}`);\n }\n }\n if (entry.plugin) {\n lines.push(`Plugin: ${entry.plugin}`);\n }\n if (code) {\n lines.push('', 'Source around the line:', fence(cutSource(code.text, code.line)));\n } else if (entry.frame) {\n lines.push('', 'Source around the line:', fence(cutLong(entry.frame, 2000)));\n }\n if (entry.stack) {\n lines.push('', 'Stack:', fence(cutLong(entry.stack, 2000)));\n }\n const versions = writeVersions(meta);\n if (versions) {\n lines.push('', versions);\n }\n return scrub(lines.join('\\n'));\n}\n\n/** The scopes of a component instance, without the components inside it. */\nfunction listScopes(scope: Scope, into: Scope[] = []): Scope[] {\n into.push(scope);\n for (const child of scope.children ?? []) {\n if (child.m === undefined) {\n listScopes(child, into);\n }\n }\n return into;\n}\n\n/** The components that an instance renders directly, by name. */\nfunction listInner(scope: Scope, into: string[] = []): string[] {\n for (const child of scope.children ?? []) {\n if (child.m === undefined) {\n listInner(child, into);\n } else {\n into.push(known.get(child.m)?.name ?? child.m);\n }\n }\n return into;\n}\n\n/** The text of a component: its file, the value of each slot by name, its contexts and its report. */\nexport function writeComponent(\n component: Scope,\n info: ComponentInfo | undefined,\n meta: DevtoolsMeta = {},\n): string {\n const name = info?.name ?? component.m ?? 'component';\n const lines = [`A component in the dev server of a brumate app: ${name}`];\n if (info?.file) {\n lines.push(`File: ${info.file}`);\n }\n for (const scope of listScopes(component)) {\n const plan = info?.scopes[scope.k];\n if (scope.s.length === 0) {\n continue;\n }\n lines.push(\n '',\n `Values of ${scope === component ? 'the component' : (plan?.label ?? 'a scope')}:`,\n );\n for (const [slot, value] of scope.s.entries()) {\n lines.push(`- ${plan?.slots[slot] ?? `slot ${slot}`}: ${printInline(value)}`);\n }\n }\n const inner = listInner(component);\n if (inner.length > 0) {\n lines.push('', `Components inside: ${inner.join(', ')}`);\n }\n // The contexts that any scope of the component provides or reads.\n const contexts: string[] = [];\n for (const scope of listScopes(component)) {\n for (const [key, value] of Object.entries(scope.v ?? {})) {\n contexts.push(`- provides ${key}: ${printInline(value)}`);\n }\n for (const key of Object.keys(scope.x ?? {})) {\n contexts.push(`- reads ${key}`);\n }\n }\n if (contexts.length > 0) {\n lines.push('', 'Contexts:', ...contexts);\n }\n if (info?.text) {\n lines.push('', 'Report of brumate inspect:', fence(cutLong(info.text, 4000)));\n }\n const versions = writeVersions(meta);\n if (versions) {\n lines.push('', versions);\n }\n return scrub(lines.join('\\n'));\n}\n\n/** The text of a handler run: the event, the writes, the updates and the server calls with times. */\nexport function writeRun(run: Interaction, name: string, writes: string[]): string {\n const lines = [`A handler run in the dev server of a brumate app: ${name}`];\n lines.push(`Event: ${run.label}`, `Handler: ${run.ref}`);\n lines.push(\n `Times: ready after ${ms(run.ready - run.begun)}, code ran ${ms(run.end - run.ready)}` +\n (run.settled === undefined ? '' : `, settled after ${ms(run.settled - run.begun)}`),\n );\n if (run.failed) {\n lines.push('The handler failed.');\n }\n if (writes.length > 0) {\n lines.push('', 'Writes:');\n for (const text of writes) {\n lines.push(`- ${cutLong(text)}`);\n }\n }\n if (run.updates.length > 0) {\n lines.push('', 'Updates:');\n for (const update of run.updates) {\n lines.push(\n `- ${update.count} ${update.count === 1 ? 'update' : 'updates'} in ${ms(update.end - update.start)}`,\n );\n }\n }\n if (run.calls.length > 0) {\n lines.push('', 'Server calls:');\n for (const call of run.calls) {\n const took = call.end === undefined ? 'pending' : ms(call.end - call.start);\n lines.push(`- ${call.name}(): ${call.status ?? 'pending'}, ${took}`);\n }\n }\n return scrub(lines.join('\\n'));\n}\n\n/** The text for a coding agent: what was called, with what, what came back and what ran on the server. */\nexport function writeForAgent(call: CallTiming, from?: string, writes: string[] = []): string {\n const record = call.record;\n const lines = [`A server function call in the dev server of a brumate app: ${call.name}()`];\n lines.push(`Status: ${call.status ?? 'pending'}`);\n if (from) {\n lines.push(`Called by: ${from}`);\n }\n if (record) {\n lines.push('', 'Arguments:', printValue(record.args));\n if (record.error) {\n lines.push('', 'Error on the server:', cutLong(record.error.message));\n if (record.error.stack) {\n lines.push(cutLong(record.error.stack, 2000));\n }\n } else if ('result' in record) {\n lines.push('', 'Result:', printValue(record.result));\n }\n const { module, network, server, decode } = record.timing;\n lines.push(\n '',\n `Timing: module ${module} ms, network ${network} ms, server ${server} ms, decode ${decode} ms`,\n );\n const ran = record.server;\n if (ran) {\n if (ran.reads.length > 0) {\n lines.push(`Reloads: ${ran.reads.join(', ')}`);\n }\n if (ran.calls.length > 0) {\n lines.push(`Called on the server: ${ran.calls.join(', ')}`);\n }\n for (const log of ran.logs) {\n lines.push(`console.${log.level}: ${cutLong(log.text)}`);\n }\n if (ran.truncated) {\n lines.push('Some console output was left out.');\n }\n }\n }\n if (writes.length > 0) {\n lines.push('', 'The result changed:', ...writes);\n }\n return scrub(lines.join('\\n'));\n}\n\n/** Writes with a hidden text area, for a page where the clipboard API is missing or refuses. */\nfunction copyByArea(value: string): boolean {\n // The focus goes back to where it was, which may be inside the shadow root of the dock.\n let active: Element | null = document.activeElement;\n while (active?.shadowRoot?.activeElement) {\n active = active.shadowRoot.activeElement;\n }\n const area = document.createElement('textarea');\n area.value = value;\n area.setAttribute('readonly', '');\n area.style.cssText = 'position:fixed;top:0;left:0;opacity:0;pointer-events:none';\n document.body.append(area);\n area.select();\n let done = false;\n try {\n done = document.execCommand('copy');\n } catch {\n done = false;\n }\n area.remove();\n if (active instanceof HTMLElement) {\n active.focus({ preventScroll: true });\n }\n return done;\n}\n\n/** Puts a text on the clipboard without a promise of it. It tells whether the text arrived. */\nasync function writeClipboard(value: string): Promise<boolean> {\n try {\n if (navigator.clipboard) {\n await navigator.clipboard.writeText(value);\n return true;\n }\n } catch {\n // The fallback below tries once more.\n }\n return copyByArea(value);\n}\n\n/**\n * Starts the write inside the click with a promise of the text, which Safari needs. It gives\n * nothing when the browser has no `ClipboardItem`.\n */\nfunction startWrite(pending: Promise<string | undefined>): Promise<void> | undefined {\n if (typeof ClipboardItem === 'undefined' || !navigator.clipboard?.write) {\n return undefined;\n }\n const blob = pending.then((value) => {\n if (value === undefined) {\n throw new Error('Nothing to copy');\n }\n return new Blob([value], { type: 'text/plain' });\n });\n return navigator.clipboard.write([new ClipboardItem({ 'text/plain': blob })]);\n}\n\n/**\n * Puts a text on the clipboard from a button. The button answers at once with \"Copying\", then shows\n * \"Copied\", or \"Copy failed\" when the text did not arrive, and goes back after a moment. The text\n * may be read later, such as a source that is fetched when the button is pressed.\n */\nexport function copyText(\n button: HTMLButtonElement,\n text: () => string | undefined | Promise<string | undefined>,\n): void {\n // What the button holds when it is set up, which it gets back after the feedback.\n const original = [...button.childNodes];\n let timer: ReturnType<typeof setTimeout> | undefined;\n // The newest click: a run that another click passed does nothing when it ends.\n let latest = 0;\n button.addEventListener('click', (event) => {\n event.stopPropagation();\n const run = ++latest;\n button.replaceChildren('Copying');\n clearTimeout(timer);\n let pending: Promise<string | undefined>;\n try {\n pending = Promise.resolve(text());\n } catch (error) {\n pending = Promise.reject(error);\n }\n let started: Promise<void> | undefined;\n try {\n started = startWrite(pending);\n } catch {\n started = undefined;\n }\n void (async () => {\n let done = false;\n let nothing = false;\n try {\n const value = await pending;\n if (value === undefined) {\n nothing = true;\n } else {\n try {\n await started;\n done = started !== undefined;\n } catch {\n done = false;\n }\n done ||= await writeClipboard(value);\n }\n } catch {\n done = false;\n }\n if (run !== latest) {\n return;\n }\n if (nothing) {\n button.replaceChildren(...original);\n return;\n }\n button.replaceChildren(done ? 'Copied' : 'Copy failed');\n timer = setTimeout(() => {\n button.replaceChildren(...original);\n }, 1200);\n })();\n });\n}\n\n/** The icon of the copy button: two sheets. */\nfunction drawCopyIcon(): SVGElement {\n const node = svg('svg', {\n class: 'icon',\n viewBox: '0 0 24 24',\n width: 14,\n height: 14,\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': 1.8,\n 'stroke-linecap': 'round',\n 'stroke-linejoin': 'round',\n 'aria-hidden': 'true',\n });\n node.innerHTML = trustedHTML(\n '<rect x=\"8.5\" y=\"8.5\" width=\"11\" height=\"11\" rx=\"2\"/><path d=\"M15.5 8.5V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7.5a2 2 0 0 0 2 2h2.5\"/>',\n );\n return node;\n}\n\n/** The Copy for an agent button of a detail header, in the style of the other tools. */\nexport function drawCopyTool(text: () => string | undefined): HTMLButtonElement {\n const button = element('button', { class: 'tool dock-copy', 'data-focus': 'copy' });\n button.append(drawCopyIcon(), 'Copy for an agent');\n copyText(button, text);\n return button;\n}\n\n/** The same, as an icon alone, for a row. */\nexport function drawCopyRowTool(text: () => string | undefined): HTMLButtonElement {\n const button = element('button', {\n class: 'tool only dock-copy dock-copy-row',\n 'aria-label': 'Copy for an agent',\n title: 'Copy for an agent',\n });\n button.append(drawCopyIcon());\n copyText(button, text);\n return button;\n}\n","// The Activity workspace: one log of what the page did (navigations, blocks, handlers, writes,\n// effects and server calls) with filters, a ruler of when it happened, and a pane for the detail of\n// a server call.\n\nimport type { CallTiming, DevtoolsEntry, DevtoolsState, Interaction } from '../devtools.ts';\nimport { drawCopyRowTool, writeRun } from './copy.ts';\nimport { element, svg } from './dom.ts';\nimport { ms, seconds } from './format.ts';\nimport { known, loadComponents } from './info.ts';\nimport type { DockContext, Shell, Workspace } from './workspace.ts';\nimport { trustedHTML } from '../trusted.ts';\n\n/** The kinds of rows, in the order of the filters. */\ntype RowKind = 'nav' | 'block' | 'handler' | 'write' | 'effect' | 'server';\n\nconst KIND_ORDER: RowKind[] = ['nav', 'block', 'handler', 'write', 'effect', 'server'];\nconst LABELS: Record<RowKind, string> = {\n nav: 'Navigation',\n block: 'Block',\n handler: 'Handler',\n write: 'Write',\n effect: 'Effect',\n server: 'Server',\n};\nconst COLORS: Record<RowKind, string> = {\n nav: 'var(--blue)',\n block: 'var(--purple)',\n handler: 'var(--accent)',\n write: 'var(--yellow)',\n effect: 'var(--green)',\n server: 'var(--pink)',\n};\n/** The most rows the log draws, newest last. */\nconst MAX_ROWS = 400;\n\n/** One line of the log. */\ninterface Row {\n time: number;\n kind: RowKind;\n text: string;\n /** A second, dimmer part of the text, such as the status of a call. */\n sub?: string;\n /** The time it took. */\n d?: string;\n bad?: boolean;\n /** Set for a row that a handler caused, so it hangs under the handler. */\n child?: boolean;\n /** The entry of a server call, which the detail pane opens. */\n call?: DevtoolsEntry;\n /** The run of a handler, which the copy button writes. */\n run?: Interaction;\n}\n\n/** What the workspace remembers in `shell.work.activity`. */\ninterface ActivityWork {\n shown: Set<RowKind>;\n /** The time Pause was pressed, while it holds. */\n pausedAt: number | undefined;\n /** Rows older than this are cleared. */\n cleared: number;\n selected: DevtoolsEntry | undefined;\n /** The time of the newest row that an earlier draw showed. */\n drawn: number;\n /** True while the log is scrolled to its end, so new rows keep it there. */\n atEnd: boolean;\n /** Where the log was scrolled to, to restore it after a draw. */\n scrollTop: number;\n /** The drawn detail, kept while the selection and its record are the same objects. */\n detail:\n | { entry: DevtoolsEntry; timing: CallTiming | undefined; record: unknown; node: HTMLElement }\n | undefined;\n}\n\nfunction readWork(shell: Shell): ActivityWork {\n let work = shell.work.activity as ActivityWork | undefined;\n if (!work) {\n work = {\n shown: new Set(KIND_ORDER),\n pausedAt: undefined,\n cleared: -1,\n selected: undefined,\n drawn: -1,\n atEnd: true,\n scrollTop: 0,\n detail: undefined,\n };\n shell.work.activity = work;\n }\n return work;\n}\n\n/** A write with the name of its slot, once the dev server has said what it is. */\nexport function describe(entry: DevtoolsEntry): string {\n const write = entry.write;\n const info = write && known.get(write.component);\n const name = info?.scopes[write!.k]?.slots[write!.slot];\n return name\n ? `${info!.name} ${name} = ${entry.text.split(' = ').slice(1).join(' = ')}`\n : entry.text;\n}\n\n/** The name of a handler, such as `Index h16`, once the dev server said the component. */\nexport function handlerName(ref: string): string {\n const [component, name = ''] = ref.split('#') as [string, string];\n return `${known.get(component)?.name ?? component} ${name}`;\n}\n\n/** A round step for the ticks of a ruler: 1, 2 or 5 times a power of ten, at least `rough`. */\nexport function tickStep(rough: number): number {\n const power = 10 ** Math.floor(Math.log10(rough));\n for (const factor of [1, 2, 5]) {\n if (factor * power >= rough) {\n return factor * power;\n }\n }\n return 10 * power;\n}\n\n/** The IDs of the components that the rows name, to ask the dev server for their names. */\nfunction listComponents(state: DevtoolsState): Set<string> {\n const ids = new Set<string>();\n for (const entry of state.log) {\n if (entry.write) {\n ids.add(entry.write.component);\n } else if (entry.kind === 'handler') {\n ids.add(readHandler(entry).split('#')[0]!);\n } else {\n ids.add(entry.text.split(':')[0]!.split('#')[0]!);\n }\n }\n for (const run of state.timeline) {\n ids.add(run.ref.split('#')[0]!);\n for (const call of run.calls) {\n ids.add(call.name.split('#')[0]!);\n }\n }\n for (const effect of state.effects.values()) {\n ids.add(effect.component);\n }\n return ids;\n}\n\n/** The reference of a handler entry: `click on <button>: Cart_1#h2` is `Cart_1#h2`. */\nfunction readHandler(entry: DevtoolsEntry): string {\n return entry.text.slice(entry.text.lastIndexOf(': ') + 2);\n}\n\nfunction addHandler(\n state: DevtoolsState,\n entry: DevtoolsEntry,\n rows: Row[],\n matched: Set<Interaction>,\n): void {\n const ref = readHandler(entry);\n const label = entry.text.slice(0, Math.max(0, entry.text.lastIndexOf(': ')));\n // The run in the timeline that this entry stands for gives the time of its own code.\n let own: string | undefined;\n let bad = false;\n let found: Interaction | undefined;\n for (const run of state.timeline) {\n if (run.ref === ref && Math.abs(run.begun - entry.time) < 100) {\n own = ms(run.end - run.ready);\n bad = run.failed === true;\n matched.add(run);\n found = run;\n }\n }\n rows.push({\n time: entry.time,\n kind: 'handler',\n text: handlerName(ref),\n sub: label,\n d: own,\n bad,\n run: found,\n });\n}\n\nfunction addCall(entry: DevtoolsEntry, rows: Row[]): void {\n const timing = entry.call;\n if (timing) {\n let status = String(timing.status ?? '…');\n if (timing.status === 'redirect') {\n // The log text holds the target: `name: redirect to /done in 3 ms`.\n const target = /redirect to (.*) in \\d+ ms$/.exec(entry.text)?.[1];\n status = target ? `redirect → ${target}` : status;\n }\n rows.push({\n time: entry.time,\n kind: 'server',\n text: `${handlerName(timing.name)}()`,\n sub: status,\n d: timing.end === undefined ? '…' : ms(timing.end - timing.start),\n bad:\n timing.status === 'failed' || (typeof timing.status === 'number' && timing.status >= 400),\n call: entry,\n });\n return;\n }\n // A call that no handler made has its name and answer in the text only.\n const cut = entry.text.indexOf(': ');\n const name = cut === -1 ? entry.text : entry.text.slice(0, cut);\n rows.push({\n time: entry.time,\n kind: 'server',\n text: `${handlerName(name)}()`,\n sub: cut === -1 ? undefined : entry.text.slice(cut + 2),\n bad: entry.text.includes(': failed'),\n call: entry,\n });\n}\n\n/** Every row of the page, oldest first, before the filters. */\nfunction collectRows(state: DevtoolsState): Row[] {\n const rows: Row[] = [];\n const matched = new Set<Interaction>();\n for (const entry of state.log) {\n if (entry.kind === 'handler') {\n addHandler(state, entry, rows, matched);\n } else if (entry.kind === 'write') {\n rows.push({ time: entry.time, kind: 'write', text: describe(entry) });\n } else {\n addCall(entry, rows);\n }\n }\n // A run that the log has no entry for, such as when the log was trimmed, still shows.\n for (const run of state.timeline) {\n if (!matched.has(run)) {\n rows.push({\n time: run.begun,\n kind: 'handler',\n text: handlerName(run.ref),\n sub: run.label,\n d: ms(run.end - run.ready),\n bad: run.failed === true,\n run,\n });\n }\n }\n const now = performance.now();\n for (const effect of state.effects.values()) {\n const info = known.get(effect.component);\n const name = `${info?.name ?? effect.component} ${effect.name}`;\n const sub = effect.name.startsWith('c') ? '$client' : '$effect';\n let lastSecond = 0;\n for (const at of effect.recent) {\n if (now - at < 1000) {\n lastSecond++;\n }\n }\n for (const [index, at] of effect.recent.entries()) {\n const newest = index === effect.recent.length - 1;\n rows.push({\n time: at,\n kind: 'effect',\n text: name,\n sub,\n d: newest ? `${effect.runs} runs` : undefined,\n bad: newest && lastSecond >= 10,\n });\n }\n }\n for (const navigation of state.navigations) {\n const url = new URL(navigation.url);\n rows.push({\n time: navigation.start,\n kind: 'nav',\n text: url.pathname + url.search,\n sub: navigation.kind,\n d: ms(navigation.time),\n });\n const at = navigation.start;\n if (navigation.full) {\n rows.push({ time: at, kind: 'nav', text: 'the whole page was replaced', child: true });\n }\n for (const route of navigation.kept) {\n rows.push({ time: at, kind: 'nav', text: `kept ${route}`, child: true });\n }\n for (const change of navigation.replaced) {\n rows.push({\n time: at,\n kind: 'nav',\n text: `replaced ${change.slot}: ${change.from} → ${change.to}`,\n child: true,\n });\n }\n }\n for (const block of state.blocks.values()) {\n rows.push({\n time: block.rendered ?? block.fired ?? block.seen,\n kind: 'block',\n text: `${block.kind} ${block.id}`,\n sub: block.state,\n bad: block.state === 'failed',\n });\n }\n // Array#sort is stable, so rows with the same time keep the order above.\n return rows.toSorted((a, b) => a.time - b.time);\n}\n\n/** Marks the writes, effects and calls that a handler caused, so they hang under it. */\nfunction nestRows(state: DevtoolsState, rows: Row[]): void {\n for (const row of rows) {\n if (row.kind !== 'write' && row.kind !== 'effect' && row.kind !== 'server') {\n continue;\n }\n for (const run of state.timeline) {\n if (run.begun <= row.time && row.time <= (run.settled ?? run.end) + 32) {\n row.child = true;\n break;\n }\n }\n }\n}\n\n/** The ruler above the log: a tick for each row and a mark for each round step. */\nfunction drawStrip(rows: Row[]): HTMLElement {\n const strip = element('div', { class: 'strip' });\n if (rows.length === 0) {\n return strip;\n }\n const first = rows[0]!.time;\n const span = Math.max(rows.at(-1)!.time - first, 1000);\n const step = tickStep(span / 5);\n for (let at = 0; at <= span; at += step) {\n const left = `left:${(at / span) * 100}%`;\n strip.append(\n element('span', { class: 'rule', style: left }),\n element('span', { class: 'rl', style: left }, `${+(at / 1000).toFixed(1)}s`),\n );\n }\n for (const row of rows) {\n strip.append(\n element('span', {\n class: 'tick',\n style: `left:${((row.time - first) / span) * 100}%;height:${row.child ? 10 : 16}px;background:${COLORS[row.kind]}`,\n }),\n );\n }\n return strip;\n}\n\nfunction drawFilters(ctx: DockContext, work: ActivityWork): HTMLElement {\n const { shell, state } = ctx;\n const tools = element('div', { class: 'tools' });\n for (const kind of KIND_ORDER) {\n const chip = element(\n 'button',\n { class: 'chip', 'aria-pressed': String(work.shown.has(kind)) },\n element('i', { style: `background:${COLORS[kind]}` }),\n LABELS[kind],\n );\n chip.addEventListener('click', () => {\n if (work.shown.has(kind)) {\n work.shown.delete(kind);\n } else {\n work.shown.add(kind);\n }\n ctx.draw();\n });\n tools.append(chip);\n }\n const pause = element(\n 'button',\n { class: 'chip', 'aria-pressed': String(shell.paused) },\n shell.paused ? 'Resume' : 'Pause',\n );\n pause.addEventListener('click', () => {\n shell.paused = !shell.paused;\n // devtools-panel.ts skips redraws while paused on the log tab, so pausedAt matters on the others.\n work.pausedAt = shell.paused ? performance.now() : undefined;\n ctx.draw();\n });\n const clear = element('button', { class: 'chip' }, 'Clear');\n clear.addEventListener('click', () => {\n work.cleared = performance.now();\n state.log.length = 0;\n state.timeline.length = 0;\n work.selected = undefined;\n ctx.draw();\n });\n tools.append(element('span', { class: 'grow' }), pause, clear);\n return tools;\n}\n\nfunction toggleCall(ctx: DockContext, work: ActivityWork, entry: DevtoolsEntry): void {\n work.selected = work.selected === entry ? undefined : entry;\n ctx.draw();\n}\n\nfunction drawRow(ctx: DockContext, work: ActivityWork, row: Row): HTMLElement {\n const classes = ['ent'];\n if (row.child) {\n classes.push('child');\n }\n if (row.time > work.drawn && work.drawn >= 0) {\n classes.push('new');\n }\n const text = element(\n 'span',\n { class: 'x' },\n ...(row.child ? [element('span', { class: 'faint' }, '└ ')] : []),\n element('span', { class: row.bad ? 'bad' : '' }, row.text),\n );\n if (row.sub) {\n text.append(' ', element('span', { class: `sub${row.bad ? ' bad' : ''}` }, row.sub));\n }\n const line = element(\n 'div',\n {},\n element('span', { class: 't' }, seconds(row.time)),\n element(\n 'span',\n { class: 'k' },\n element('i', { style: `background:${COLORS[row.kind]}` }),\n LABELS[row.kind],\n ),\n text,\n element('span', { class: 'd' }, row.d ?? ''),\n );\n const run = row.run;\n if (run) {\n // The writes of the run, from the log, as they are named when the button is pressed.\n line.lastElementChild!.append(\n drawCopyRowTool(() => {\n const writes: string[] = [];\n for (const item of ctx.state.log) {\n if (\n item.kind === 'write' &&\n item.time >= run.begun &&\n item.time <= (run.settled ?? run.end) + 32\n ) {\n writes.push(describe(item));\n }\n }\n return writeRun(run, handlerName(run.ref), writes);\n }),\n );\n }\n const entry = row.call;\n if (entry) {\n classes.push('call');\n line.setAttribute('tabindex', '0');\n line.setAttribute('role', 'button');\n line.setAttribute('aria-current', String(entry === work.selected));\n line.addEventListener('click', () => toggleCall(ctx, work, entry));\n line.addEventListener('keydown', (event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n toggleCall(ctx, work, entry);\n }\n });\n }\n line.className = classes.join(' ');\n return line;\n}\n\nfunction drawLogColumn(ctx: DockContext, work: ActivityWork, rows: Row[]): HTMLElement {\n const log = element('div', { class: 'log' });\n if (rows.length === 0) {\n log.append(element('div', { class: 'empty' }, 'Nothing yet. Use the page.'));\n }\n for (const row of rows) {\n log.append(drawRow(ctx, work, row));\n }\n log.addEventListener('scroll', () => {\n work.atEnd = log.scrollHeight - log.scrollTop - log.clientHeight < 8;\n work.scrollTop = log.scrollTop;\n });\n // Keeps the log at its end while it was there, as a console does, and else where it was.\n queueMicrotask(() => {\n log.scrollTop = work.atEnd ? log.scrollHeight : work.scrollTop;\n });\n return element('div', { class: 'act' }, drawFilters(ctx, work), drawStrip(rows), log);\n}\n\nfunction drawCloseIcon(): SVGElement {\n const node = svg('svg', {\n class: 'icon',\n viewBox: '0 0 24 24',\n width: 14,\n height: 14,\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': 1.8,\n 'stroke-linecap': 'round',\n 'aria-hidden': 'true',\n });\n node.innerHTML = trustedHTML('<path d=\"m6 6 12 12M18 6 6 18\"/>');\n return node;\n}\n\n/** The detail pane: the module of the call detail for the selected call. */\nfunction drawDetail(\n ctx: DockContext,\n work: ActivityWork,\n entry: DevtoolsEntry,\n into: HTMLElement,\n): void {\n const close = element('button', { class: 'act-close', 'aria-label': 'Close' }, drawCloseIcon());\n close.title = 'Close';\n close.addEventListener('click', () => {\n work.selected = undefined;\n ctx.draw();\n });\n // The detail keeps its own state (an armed button, an open section), so it draws again only when\n // the selection changes or the record of the call arrives.\n const timing = entry.call;\n const kept = work.detail;\n if (!kept || kept.entry !== entry || kept.timing !== timing || kept.record !== timing?.record) {\n const node = ctx.drawCallDetail(entry);\n node.classList.add('call-detail');\n work.detail = { entry, timing, record: timing?.record, node };\n }\n into.replaceChildren(close, work.detail!.node);\n}\n\nconst ACTIVITY_STYLE = `\n.act, .act-detail { --line2: #36333a; --pink: #ff9ecf; --sel: #ee7a3e14; --ring: #ee7a3e47; }\n.split.activity > .list { padding: 0; gap: 0; }\n.split.activity > .detail { position: relative; padding: 0; }\n.act-detail .calld { width: auto; }\n.act { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; }\n.act .tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 38px; padding: 7px 10px; border-bottom: 1px solid var(--line); flex: none; }\n.act .grow { flex: 1; }\n.act .chip { height: 24px; padding: 0 9px; border-radius: 7px; background: none; color: var(--faint); font: inherit; font-size: 11.5px; display: inline-flex; gap: 6px; align-items: center; }\n.act .chip:hover { background: var(--hover); color: var(--dim); }\n.act .chip[aria-pressed=\"true\"] { color: var(--text); }\n.act .chip i { width: 7px; height: 7px; border-radius: 2px; opacity: .35; }\n.act .chip[aria-pressed=\"true\"] i { opacity: 1; }\n.strip { position: relative; height: 34px; margin: 0 14px; border-bottom: 1px solid var(--line); flex: none; }\n.strip .tick { position: absolute; bottom: 8px; width: 2px; border-radius: 1px; }\n.strip .rule { position: absolute; bottom: 0; height: 4px; width: 1px; background: var(--line2); }\n.strip .rl { position: absolute; top: 2px; font: 10px var(--mono); color: var(--faint); transform: translateX(-50%); }\n.act .log { flex: 1; overflow: auto; padding: 4px 6px; }\n.ent { display: grid; grid-template-columns: 56px 82px minmax(0, 1fr) auto; gap: 10px; align-items: center; height: 28px; padding: 0 8px; border-radius: 7px; font: 11.5px var(--mono); }\n.ent:hover { background: var(--hover); }\n.ent .t { color: var(--faint); }\n.ent .k { display: flex; align-items: center; gap: 6px; color: var(--dim); font-family: system-ui, sans-serif; font-size: 11.5px; }\n.ent .k i { width: 7px; height: 7px; border-radius: 2px; }\n.ent .x { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.ent .x .sub { color: var(--faint); margin-right: 6px; }\n.ent .d { color: var(--faint); display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }\n.ent .dock-copy-row { height: 20px; padding: 0 5px; font: 10.5px system-ui, sans-serif; color: var(--dim); opacity: 0; transition: opacity .12s; }\n.ent:hover .dock-copy-row, .ent .dock-copy-row:focus-visible, .ent[aria-current=\"true\"] .dock-copy-row { opacity: 1; }\n.ent.child .k { visibility: hidden; }\n.ent.call { cursor: pointer; }\n.ent.call .x::after { content: \" details ›\"; color: var(--faint); opacity: 0; transition: opacity .12s; }\n.ent.call:hover .x::after, .ent.call:focus-visible .x::after { opacity: 1; }\n.ent[aria-current=\"true\"] { background: var(--sel); box-shadow: inset 0 0 0 1px var(--ring); }\n.ent .bad { color: var(--red); }\n.ent.new { animation: act-fresh .9s ease-out; }\n@keyframes act-fresh { from { background: #ee7a3e1f; } to { background: transparent; } }\n.act-close { position: absolute; top: 10px; right: 12px; width: 26px; height: 26px; padding: 0; display: grid; place-items: center; color: var(--dim); border-radius: 7px; }\n`;\n\nfunction drawActivity(ctx: DockContext, into: HTMLElement): Promise<void> {\n const { state, shell } = ctx;\n const work = readWork(shell);\n return loadComponents(state, listComponents(state)).then(() => {\n // The selected call may have left the log, such as when it was cleared.\n if (work.selected && !state.log.includes(work.selected)) {\n work.selected = undefined;\n }\n const rows: Row[] = [];\n for (const row of collectRows(state)) {\n if (\n row.time > work.cleared &&\n (work.pausedAt === undefined || row.time <= work.pausedAt) &&\n work.shown.has(row.kind)\n ) {\n rows.push(row);\n }\n }\n nestRows(state, rows);\n const shown = rows.slice(-MAX_ROWS);\n const log = drawLogColumn(ctx, work, shown);\n let box: HTMLElement;\n if (work.selected) {\n // A selected call opens its detail beside the log.\n const columns = ctx.split({ key: 'activity', min: [320, 280], start: 560 });\n box = columns.box;\n box.classList.add('activity');\n columns.second.classList.add('act-detail');\n columns.first.append(log);\n drawDetail(ctx, work, work.selected, columns.second);\n } else {\n // Without a call the log takes the whole width.\n work.detail = undefined;\n box = element('div', { class: 'split activity solo' }, log);\n }\n // The styles go in the shadow root once, so they are not part of the text of the body.\n if (!ctx.root.querySelector('style[data-activity]')) {\n ctx.root.append(element('style', { 'data-activity': '' }, ACTIVITY_STYLE));\n }\n into.replaceChildren(box);\n work.drawn = shown.at(-1)?.time ?? work.drawn;\n });\n}\n\nexport const activity: Workspace = {\n id: 'activity',\n label: 'Activity',\n icon: 'log',\n // The old tab bar has one key per tab until dock-shell lands, and they all show the one log.\n tabs: {\n log: drawActivity,\n timeline: drawActivity,\n effects: drawActivity,\n navigation: drawActivity,\n server: drawActivity,\n },\n draw: drawActivity,\n};\n","// Stacks: the frames of an error, their sources and the highlighted code around a place.\n\nimport type * as Highlight from '../../highlight.ts';\nimport { element } from './dom.ts';\nimport { trustedHTML } from '../trusted.ts';\n\n/** A place in a file that a stack names. */\nexport interface Frame {\n fn: string;\n file: string;\n line: number;\n column: number;\n /** True for code of a dependency, of the runtime of brumate, or of Node. */\n library: boolean;\n /** True for code that the browser ran, whose lines are of the compiled code. */\n compiled: boolean;\n /** The URL of the module that the browser ran, for a frame that no source map maps. */\n url?: string;\n}\n\n/** The places of a stack, with their files as the dev server can read them. */\nexport function parseFrames(stack: string | undefined): Frame[] {\n const frames: Frame[] = [];\n for (const line of (stack ?? '').split('\\n')) {\n const match = /^\\s*at (?:(.*?) \\()?(.+?):(\\d+):(\\d+)\\)?\\s*$/.exec(line);\n if (!match) {\n continue;\n }\n let file = match[2]!;\n let compiled = false;\n // Code of a browser extension, or code without a file, is not code of the app.\n if (/^[a-z-]+-extension:/.test(file) || file.startsWith('<')) {\n continue;\n }\n if (/^https?:/.test(file)) {\n const url = new URL(file);\n if (url.origin !== location.origin) {\n continue;\n }\n compiled = true;\n file = url.pathname.startsWith('/@fs/') ? url.pathname.slice(4) : url.pathname;\n } else if (file.startsWith('file://')) {\n file = decodeURIComponent(new URL(file).pathname);\n }\n frames.push({\n fn: match[1] ?? '(anonymous)',\n file,\n line: Number(match[3]),\n column: Number(match[4]),\n library:\n file.startsWith('node:') ||\n file.includes('/node_modules/') ||\n /\\/brumate\\/(?:src|dist)\\/runtime\\//.test(file) ||\n file.includes('/@vite/'),\n compiled,\n });\n }\n return frames;\n}\n\n/** The places in the sources of frames that the browser ran, by their compiled place. */\nconst mapped = new Map<string, Promise<Frame>>();\n\n/**\n * Maps the frames that the browser ran to their sources, by the source maps\n * of the dev server, so a frame of a component or a module function names\n * its own file and line. A frame that the dev server cannot map stays as it is.\n */\nexport function mapFrames(frames: Frame[], urls: string[]): Promise<Frame[]> {\n const results: (Frame | Promise<Frame>)[] = [];\n for (const [index, frame] of frames.entries()) {\n const url = urls[index];\n if (!frame.compiled || frame.library || !url) {\n results.push(frame);\n continue;\n }\n // A frame that the source map does not map shows the code that the browser ran.\n const unmapped = { ...frame, url };\n const key = `${url}:${frame.line}:${frame.column}`;\n let result = mapped.get(key);\n if (!result) {\n const query = new URLSearchParams({\n url,\n line: String(frame.line),\n column: String(frame.column),\n });\n result = fetch(`/__brumate/position?${query}`)\n .then((response) => (response.ok ? response.json() : null))\n .then((place: { file: string; line: number; column: number } | null) =>\n place ? { ...frame, ...place, compiled: false } : unmapped,\n )\n .catch(() => unmapped);\n mapped.set(key, result);\n }\n results.push(result);\n }\n return Promise.all(results);\n}\n\n/** The URLs that the frames of a stack name, as the dev server knows the modules. */\nexport function frameUrls(stack: string | undefined): string[] {\n const urls: string[] = [];\n for (const line of (stack ?? '').split('\\n')) {\n const match = /^\\s*at (?:(.*?) \\()?(.+?):(\\d+):(\\d+)\\)?\\s*$/.exec(line);\n const file = match?.[2];\n if (!file || /^[a-z-]+-extension:/.test(file) || file.startsWith('<')) {\n continue;\n }\n if (/^https?:/.test(file)) {\n const url = new URL(file);\n urls.push(url.origin === location.origin ? url.pathname + url.search : '');\n if (url.origin !== location.origin) {\n urls.pop();\n }\n } else {\n urls.push('');\n }\n }\n return urls;\n}\n\n/** The highlighter, which loads with the first code that the Errors tab shows. */\nlet highlighter: Promise<typeof Highlight> | undefined;\n/** The sources of files, by path. */\nconst sources = new Map<string, Promise<string | undefined>>();\n\n/** The code of a module as the dev server sent it to the browser. */\nexport function fetchCompiled(url: string): Promise<string | undefined> {\n let text = sources.get(url);\n if (!text) {\n text = fetch(url)\n .then((response) => (response.ok ? response.text() : undefined))\n .catch(() => undefined);\n sources.set(url, text);\n }\n return text;\n}\n\nexport function fetchSource(file: string): Promise<string | undefined> {\n let text = sources.get(file);\n if (!text) {\n text = fetch(`/__brumate/source?file=${encodeURIComponent(file)}`)\n .then((response) => (response.ok ? response.text() : undefined))\n .catch(() => undefined);\n sources.set(file, text);\n }\n return text;\n}\n\n/**\n * The lines around a place of a file, highlighted by twinkleplop, with the\n * line of the place and the word at its column marked. Without the source,\n * the frame of the error is shown as it is.\n */\nexport async function codeView(\n place: { file: string; line: number; column: number; url?: string },\n fallback?: string,\n): Promise<HTMLElement> {\n const box = element('div', { class: 'code' });\n const [text, module] = await Promise.all([\n place.url ? fetchCompiled(place.url) : fetchSource(place.file),\n (highlighter ??= import('../../highlight.ts')),\n ]);\n if (text === undefined) {\n box.append(\n element('pre', { class: 'plain' }, fallback ?? 'The dev server cannot read this file.'),\n );\n return box;\n }\n const lines = text.split('\\n');\n const start = Math.max(1, place.line - 6);\n const end = Math.min(lines.length, place.line + 6);\n const target = place.line;\n const word = /^[\\w$.]*/.exec(lines[place.line - 1]?.slice(place.column - 1) ?? '')?.[0] ?? '';\n // The colours of the theme, in the box, since the styles of the page do not reach the panel.\n box.append(element('style', {}, module.themeCSS('dark')));\n // The whole file is highlighted, so lines inside a script or a comment have their context. Then\n // only the lines around the place stay, each line one `.l` element.\n box.insertAdjacentHTML(\n 'beforeend',\n trustedHTML(\n module.highlightFile(place.url ? 'compiled.ts' : place.file, text, {\n line_numbers: { start: 1 },\n line: (index) => (index === target ? { class: 'error-line' } : undefined),\n overlays:\n word.length > 0\n ? [\n {\n start: { line: target, character: place.column - 1 },\n end: { line: target, character: place.column - 1 + word.length },\n class: 'error-mark',\n },\n ]\n : [],\n }),\n ),\n );\n const shown = [...box.querySelectorAll('code > .l')];\n for (const [index, line] of shown.entries()) {\n if (index + 1 < start || index + 1 > end) {\n // The line break after a line goes with it.\n if (line.nextSibling?.nodeType === Node.TEXT_NODE) {\n line.nextSibling.remove();\n }\n line.remove();\n }\n }\n return box;\n}\n","// The detail of a server call, for the Log of the Activity workspace.\n\nimport type { Scope } from '../client.ts';\nimport type {\n CallRecord,\n CallTiming,\n DevtoolsEntry,\n DevtoolsState,\n Interaction,\n} from '../devtools.ts';\nimport { element, icon } from './dom.ts';\nimport { copyText, cutLong, writeForAgent } from './copy.ts';\nimport { ms } from './format.ts';\nimport { codeView, frameUrls, mapFrames, parseFrames } from './stack.ts';\nimport type { Frame } from './stack.ts';\nimport type { DockContext } from './workspace.ts';\n\n/** The longest wait for the writes that the result made, after the answer. */\nconst AFTER_MS = 300;\nconst DEPTH_LIMIT = 8;\nconst PHASES = [\n ['module', 'var(--faint)'],\n ['network', 'var(--blue)'],\n ['server', 'var(--pink)'],\n ['decode', 'var(--green)'],\n] as const;\n\n// Copied from the prototype. The variables are local to `.calld`, since `style.ts` is dock-shell's;\n// they are the prototype's values for the ones the panel does not define yet.\nconst STYLE = `\n.calld { --bg2: #161517; --line2: #36333a; --pink: #ff8fc8; width: 440px; flex: none; padding: 16px 20px 20px; min-width: 0; }\n.calld .title { display: flex; align-items: center; gap: 10px; }\n.calld .title h3 { margin: 0; font: 600 14px var(--mono); color: var(--text); text-transform: none; letter-spacing: 0; }\n.calld .sec { margin: 22px 0 8px; display: flex; align-items: baseline; gap: 8px; font-size: 11px; font-weight: 600; color: var(--faint); }\n.calld .sec .n { font: 10.5px var(--mono); font-weight: 400; }\n.calld .from { color: var(--dim); margin-top: 6px; }\n.calld .from .link-button { color: var(--text); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; padding: 0; border: 0; background: none; font: inherit; }\n.calld .from .link-button:hover { text-decoration-color: var(--accent); }\n.calld .val { font: 11.5px/1.8 var(--mono); background: var(--bg2); border-radius: 8px; padding: 8px 12px; box-shadow: inset 0 0 0 1px var(--line); overflow: auto; }\n.calld .val details > div, .calld .val details > details { margin-left: 16px; }\n.calld .val summary { cursor: pointer; list-style: none; }\n.calld .val summary::-webkit-details-marker { display: none; }\n.calld .val summary::before { content: '›'; display: inline-block; width: 12px; color: var(--faint); transition: transform 0.15s; }\n.calld .val details[open] > summary::before { transform: rotate(90deg); }\n.calld .kk { color: #ffc28f; }\n.calld .str { color: var(--green); } .calld .num { color: var(--blue); } .calld .bool { color: var(--purple); } .calld .nil { color: var(--faint); }\n.calld .tbar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; gap: 2px; margin: 4px 0 10px; }\n.calld .leg { display: flex; gap: 14px; flex-wrap: wrap; color: var(--dim); font: 11px var(--mono); }\n.calld .leg i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 6px; }\n.calld .lines { font: 11.5px/1.95 var(--mono); }\n.calld .lines .faint { display: inline-block; width: 56px; color: var(--faint); }\n.calld .lines .warn { color: var(--yellow); }\n.calld .errline { color: var(--red); }\n.calld .acts { margin-top: 20px; display: flex; gap: 8px; flex-wrap: wrap; }\n.calld .btn { height: 28px; padding: 0 12px; border-radius: 8px; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line2); display: inline-flex; gap: 7px; align-items: center; font-weight: 500; transition: background 0.12s, box-shadow 0.12s; }\n.calld .btn:hover { background: var(--hover); box-shadow: inset 0 0 0 1px #4a464f; }\n.calld .btn.pri { background: var(--text); color: #121113; box-shadow: none; }\n.calld .btn.pri:hover { background: #fff; }\n.calld .btn.warn { background: #ffd1661a; color: var(--yellow); box-shadow: inset 0 0 0 1px #ffd16655; }\n.calld .note { color: var(--yellow); font-size: 11.5px; margin-top: 8px; }\n.calld .dim { color: var(--dim); }\n.calld .frames { margin: 6px 0; }\n`;\n\n/** The call of an entry, with the interaction that made it. */\nexport function findOwner(state: DevtoolsState, call: CallTiming): Interaction | undefined {\n for (const run of state.timeline) {\n if (run.calls.includes(call)) {\n return run;\n }\n }\n return undefined;\n}\n\n/** The root scope of the component whose handler made the call, if the page still has it. */\nfunction findCaller(state: DevtoolsState, run: Interaction): Scope | undefined {\n const component = run.ref.split('#')[0];\n for (const scope of state.scopes?.values() ?? []) {\n if (scope.m === component && !scope.p) {\n return scope;\n }\n }\n return undefined;\n}\n\n/** The writes that the result of a call made, from the log: the lines of the first moments after the answer. */\nexport function findWrites(state: DevtoolsState, call: CallTiming): string[] {\n const writes: string[] = [];\n if (call.end === undefined) {\n return writes;\n }\n for (const entry of state.log) {\n if (entry.kind === 'write' && entry.time >= call.end && entry.time <= call.end + AFTER_MS) {\n writes.push(entry.text);\n }\n }\n return writes;\n}\n\n/** The phases of the timing, with the total. */\nfunction readPhases(record: CallRecord): { name: string; color: string; time: number }[] {\n const phases: { name: string; color: string; time: number }[] = [];\n for (const [name, color] of PHASES) {\n phases.push({ name, color, time: record.timing[name] });\n }\n return phases;\n}\n\n/** The `fetch` call that repeats a call, without cookies and without headers that are not the protocol's. */\nexport function writeFetch(call: CallTiming): string | undefined {\n const request = call.request;\n if (!request) {\n return undefined;\n }\n const url = JSON.stringify(request.url);\n const body = request.body;\n if (body instanceof FormData) {\n const lines = ['const body = new FormData();'];\n for (const [name, value] of body) {\n if (typeof value === 'string') {\n lines.push(`body.set(${JSON.stringify(name)}, ${JSON.stringify(value)});`);\n } else {\n lines.push(\n `// ${JSON.stringify(name)}: the file ${JSON.stringify(value.name)} (${value.size} bytes), attach it here`,\n );\n }\n }\n const header = request.headers['x-brumate-args'];\n lines.push(\n `await fetch(${url}, { method: 'POST', ${header ? `headers: { 'x-brumate-args': ${JSON.stringify(header)} }, ` : ''}body });`,\n );\n return lines.join('\\n');\n }\n // A blob sends the JSON type by itself, so no header is written.\n const json = typeof body === 'string' ? JSON.stringify(body) : undefined;\n return `await fetch(${url}, {\\n method: 'POST',\\n${json ? ` body: new Blob([${json}], { type: 'application/json' }),\\n` : ''}});`;\n}\n\n/** A value in the tree: texts, numbers and the like in a colour, lists and objects that fold. */\nfunction drawValue(value: unknown, depth = 0): HTMLElement {\n if (typeof value === 'string') {\n return element('span', { class: 'str' }, JSON.stringify(cutLong(value)));\n }\n if (typeof value === 'number' || typeof value === 'bigint') {\n return element('span', { class: 'num' }, String(value));\n }\n if (typeof value === 'boolean') {\n return element('span', { class: 'bool' }, String(value));\n }\n if (value === null || value === undefined) {\n return element('span', { class: 'nil' }, String(value));\n }\n if (value instanceof Date) {\n return element('span', { class: 'str' }, value.toISOString());\n }\n let entries: [string, unknown][];\n let label: string;\n if (Array.isArray(value) || value instanceof Set) {\n entries = [];\n for (const [index, item] of [...value].entries()) {\n entries.push([String(index), item]);\n }\n label = `${value instanceof Set ? 'Set' : 'Array'}(${entries.length})`;\n } else if (value instanceof Map) {\n entries = [];\n for (const [key, item] of value) {\n entries.push([String(key), item]);\n }\n label = `Map(${value.size})`;\n } else if (typeof value === 'object') {\n entries = Object.entries(value);\n label = `{${entries.length}}`;\n } else {\n return element('span', { class: 'nil' }, String(value));\n }\n if (entries.length === 0 || depth >= DEPTH_LIMIT) {\n return element('span', { class: 'nil' }, entries.length === 0 ? label : '…');\n }\n const details = element('details', {}, element('summary', {}, label));\n details.open = depth < 2;\n for (const [key, item] of entries) {\n details.append(\n element('div', {}, element('span', { class: 'kk' }, `${key}: `), drawValue(item, depth + 1)),\n );\n }\n return details;\n}\n\n/** A button that opens a place of a file in the editor. */\nfunction openInEditor(frame: Frame): HTMLElement {\n const button = element(\n 'button',\n { class: 'link', title: 'Open in the editor' },\n `${frame.file.replace(/^.*\\/(src|test|routes)\\//, '$1/')}:${frame.line}:${frame.column}`,\n icon('open', 12),\n );\n button.addEventListener('click', () => {\n void fetch(\n `/__open-in-editor?file=${encodeURIComponent(`${frame.file}:${frame.line}:${frame.column}`)}`,\n );\n });\n return button;\n}\n\n/** Marks a frame of the list as the chosen one, and shows its code. */\nasync function showFrame(\n list: HTMLElement,\n code: HTMLElement,\n frame: Frame,\n button: Element,\n): Promise<void> {\n for (const other of list.children) {\n other.setAttribute('aria-current', String(other === button));\n }\n code.replaceChildren(await codeView(frame));\n}\n\n/** Fills the box with the frames of the app, a count of the others, and the code of the chosen frame. */\nasync function fillStack(box: HTMLElement, stack: string): Promise<void> {\n const frames = await mapFrames(parseFrames(stack), frameUrls(stack));\n const own: Frame[] = [];\n for (const frame of frames) {\n if (!frame.library) {\n own.push(frame);\n }\n }\n const list = element('div', { class: 'frames lines' });\n const code = element('div');\n for (const frame of own) {\n const button = element(\n 'button',\n { class: 'frame dim', 'aria-current': 'false', title: 'Show this code' },\n element('span', { class: 'fn' }, frame.fn),\n element('span', { class: 'where' }, `${frame.file}:${frame.line}:${frame.column}`),\n );\n button.addEventListener('click', () => void showFrame(list, code, frame, button));\n list.append(button);\n }\n box.replaceChildren(list);\n if (own.length < frames.length) {\n box.append(\n element('div', { class: 'dim' }, `${frames.length - own.length} frames of libraries hidden`),\n );\n }\n if (own[0]) {\n box.append(openInEditor(own[0]), code);\n await showFrame(list, code, own[0], list.children[0]!);\n }\n}\n\n/** The stack of the server error, which fills in once the frames are mapped. */\nfunction drawStack(stack: string | undefined): HTMLElement {\n const box = element('div');\n if (stack) {\n fillStack(box, stack).catch(() => {\n box.replaceChildren(element('div', { class: 'dim' }, 'Could not read the code.'));\n });\n }\n return box;\n}\n\n/** A section with a heading, hidden by its caller when it has no data. */\nfunction drawSection(title: string, note: string | undefined, ...children: Node[]): HTMLElement {\n const heading = element('div', { class: 'sec' }, title);\n if (note) {\n heading.append(element('span', { class: 'n' }, note));\n }\n const section = element('div', {}, heading);\n section.append(...children);\n return section;\n}\n\n/** Switches Run again between asking and ready: the warning note and Cancel show while it asks. */\nfunction armRun(run: HTMLElement, cancel: HTMLElement, note: HTMLElement, on: boolean): void {\n run.textContent = on ? 'Run it again' : 'Run again';\n run.className = `btn ${on ? 'warn' : 'pri'}`;\n note.hidden = !on;\n cancel.hidden = !on;\n}\n\n/** Draws the detail of a server call, from the record of its entry. */\nexport function drawCallDetail(ctx: DockContext, entry: DevtoolsEntry): HTMLElement {\n const call = entry.call;\n const root = element('div', { class: 'calld' }, element('style', {}, STYLE));\n if (!call) {\n root.append(element('div', { class: 'empty' }, 'No details for this call.'));\n return root;\n }\n const { state } = ctx;\n const record = call.record;\n const owner = findOwner(state, call);\n const from = owner?.label;\n const writes = findWrites(state, call);\n let total = call.end === undefined ? 0 : Math.round(call.end - call.start);\n if (record) {\n total = 0;\n for (const phase of readPhases(record)) {\n total += phase.time;\n }\n }\n\n // The title: the function, how it answered and how long it took.\n const failed =\n call.status === 'failed' || (typeof call.status === 'number' && call.status >= 400);\n root.append(\n element(\n 'div',\n { class: 'title' },\n element('h3', {}, `${call.name}()`),\n element(\n 'span',\n { class: `pill ${failed ? 'red' : 'green'}` },\n String(call.status ?? 'pending'),\n ),\n element('span', { class: 'dim' }, ms(total)),\n ),\n );\n if (owner) {\n // A link to the component of the handler when the page still has it.\n const caller = findCaller(state, owner);\n const line = element('div', { class: 'from' }, 'Called by ');\n if (caller) {\n const link = element('button', { class: 'link-button' }, owner.label);\n link.addEventListener('click', () => {\n ctx.shell.selectedScope = caller.id;\n ctx.select('inspect');\n });\n line.append(link);\n } else {\n line.append(owner.label);\n }\n root.append(line);\n }\n\n if (record) {\n // The arguments and the result, or the error of the server.\n if (record.args.length > 0) {\n const values = element('div', { class: 'val' });\n for (const [index, arg] of record.args.entries()) {\n values.append(\n element('div', {}, element('span', { class: 'kk' }, `${index}: `), drawValue(arg)),\n );\n }\n root.append(drawSection('Arguments', undefined, values));\n }\n if (record.error) {\n root.append(\n drawSection(\n 'Error on the server',\n undefined,\n element(\n 'div',\n { class: 'lines' },\n element('div', { class: 'errline' }, cutLong(record.error.message)),\n drawStack(record.error.stack),\n ),\n ),\n );\n } else if ('result' in record) {\n root.append(\n drawSection(\n 'Result',\n undefined,\n element('div', { class: 'val' }, drawValue(record.result)),\n ),\n );\n }\n\n // The timing as a bar of its four phases.\n const bar = element('div', { class: 'tbar' });\n const legend = element('div', { class: 'leg' });\n for (const phase of readPhases(record)) {\n bar.append(\n element('span', { style: `flex: ${phase.time || 0.2}; background: ${phase.color}` }),\n );\n legend.append(\n element(\n 'span',\n {},\n element('i', { style: `background: ${phase.color}` }),\n `${phase.name} ${ms(phase.time)}`,\n ),\n );\n }\n root.append(drawSection('Timing', ms(total), bar, legend));\n\n // What ran on the server. The dev server sends it, so a call without it shows nothing.\n const ran = record.server;\n if (ran && (ran.reads.length > 0 || ran.calls.length > 0 || ran.logs.length > 0)) {\n const lines = element('div', { class: 'lines' });\n for (const id of ran.reads) {\n lines.append(element('div', {}, element('span', { class: 'faint' }, 'read'), id));\n }\n for (const id of ran.calls) {\n lines.append(element('div', {}, element('span', { class: 'faint' }, 'called'), id));\n }\n for (const log of ran.logs) {\n lines.append(\n element(\n 'div',\n {},\n element('span', { class: 'faint' }, log.level),\n element('span', { class: log.level }, cutLong(log.text)),\n ),\n );\n }\n if (ran.truncated) {\n lines.append(element('div', { class: 'dim' }, 'Some output was left out to fit.'));\n }\n root.append(drawSection('On the server', undefined, lines));\n }\n }\n\n // What the result changed on the page.\n if (writes.length > 0) {\n const lines = element('div', { class: 'lines' });\n for (const text of writes) {\n lines.append(element('div', {}, text));\n }\n root.append(drawSection('After the call', undefined, lines));\n }\n\n // The actions. Run again asks first, since the function may have side effects.\n const run = element('button', { class: 'btn pri' }, 'Run again');\n const cancel = element('button', { class: 'btn', hidden: '' }, 'Cancel');\n const fetchButton = element('button', { class: 'btn' }, 'Copy as fetch');\n const agentButton = element('button', { class: 'btn' }, 'Copy for an agent');\n const note = element(\n 'div',\n { class: 'note', hidden: '' },\n `Runs ${call.name}() on the server with the same arguments. Its side effects happen again.`,\n );\n if (!call.request) {\n run.disabled = true;\n run.title = 'The request was not kept';\n }\n run.addEventListener('click', () => {\n if (note.hidden) {\n armRun(run, cancel, note, true);\n return;\n }\n armRun(run, cancel, note, false);\n const request = call.request;\n if (request) {\n // The page's own fetch records it as a new call in the log.\n void fetch(request.url, {\n method: 'POST',\n headers: request.headers,\n ...(request.body === undefined ? {} : { body: request.body }),\n }).catch(() => {});\n run.textContent = 'Ran';\n setTimeout(() => {\n run.textContent = 'Run again';\n }, 1200);\n }\n });\n cancel.addEventListener('click', () => armRun(run, cancel, note, false));\n copyText(fetchButton, () => writeFetch(call));\n copyText(agentButton, () => writeForAgent(call, from, writes));\n root.append(element('div', { class: 'acts' }, run, cancel, fetchButton, agentButton), note);\n return root;\n}\n","// The contract of the workspaces of the dock (docs/roadmaps/brumate/contracts/dock-workspace-api.md).\n// A workspace module exports one `Workspace`. The shell gives it a `DockContext` and an element to\n// draw into, and draws again when something changes.\n\nimport type { Scope } from '../client.ts';\nimport type { DevtoolsEntry, DevtoolsState, ErrorEntry } from '../devtools.ts';\nimport type { ScopeId } from '../shared.ts';\nimport { element } from './dom.ts';\nimport type { IconName } from './dom.ts';\nimport { collectModules, known, roots } from './info.ts';\nimport type { ComponentInfo } from './info.ts';\n\n/** The ID of a workspace. */\nexport type WorkspaceId = 'inspect' | 'activity' | 'issues' | 'page';\n\n/** The tabs of the tab bar that the workspaces replace. Dock-shell removes them. */\nexport type Tab =\n | 'overview'\n | 'errors'\n | 'scopes'\n | 'elements'\n | 'graph'\n | 'log'\n | 'timeline'\n | 'state'\n | 'effects'\n | 'navigation'\n | 'server'\n | 'blocks';\n\n/** Draws one tab into an element. A tab that waits for the dev server returns a promise. */\nexport type TabDraw = (ctx: DockContext, into: HTMLElement) => void | Promise<void>;\n\nexport interface Workspace {\n id: WorkspaceId;\n label: string;\n icon: IconName;\n /** A count for the navigation, or nothing. */\n badge?(ctx: DockContext): number | undefined;\n /** Draws the workspace into the element. It returns a promise when it waits for the dev server. */\n draw: TabDraw;\n /** The old tabs that the workspace holds. The tab bar draws the one in `shell.tab`. */\n tabs: Partial<Record<Tab, TabDraw>>;\n}\n\n/** The two columns that `split` returns, in a box. */\nexport interface Columns {\n box: HTMLElement;\n first: HTMLElement;\n second: HTMLElement;\n}\n\nexport interface SplitOptions {\n /** Names the split, to keep its size. */\n key: string;\n /** The least size of each side, in pixels. */\n min: [number, number];\n /** The size of the first side at first, in pixels. */\n start: number;\n}\n\nexport interface DockContext {\n root: ShadowRoot;\n state: DevtoolsState;\n /** What the dock remembers between draws. */\n shell: Shell;\n /** Draws the open workspace again. */\n draw(): void;\n /** Opens a workspace. The target names a tab of the old tab bar, until the shell replaces it. */\n select(workspace: WorkspaceId, target?: Tab): void;\n /** Two columns in a box. */\n split(options: SplitOptions): Columns;\n /** Outlines the elements of a scope on the page, or none without a scope. */\n outline(scope?: ScopeId): void;\n /** Starts or stops Pick. */\n pick(): void;\n /** The graph of a component, drawn from one of its instances. */\n drawGraph(scope: Scope, info: ComponentInfo | undefined): HTMLElement;\n /** The detail of a server function call. */\n drawCallDetail(call: DevtoolsEntry): HTMLElement;\n}\n\n/** What the dock remembers: one object that the context carries. */\nexport interface Shell {\n panel: HTMLElement | undefined;\n /** Switches the tab of the open panel. */\n showTab: ((tab: Tab) => void) | undefined;\n /** Stops picking, with its outline and card, when the panel closes. */\n endPick: (() => void) | undefined;\n tab: Tab;\n /** The error and the place of its stack that the Errors tab shows. */\n selectedError: ErrorEntry | undefined;\n selectedFrame: number;\n /** The ID of the component that Graph shows. */\n selected: string | undefined;\n selectedScope: ScopeId | undefined;\n editing: { scope: ScopeId; slot: number } | undefined;\n paused: boolean;\n filter: string;\n logSearch: string;\n shown: Set<DevtoolsEntry['kind']>;\n /** The log as it was when Pause was pressed. */\n frozen: DevtoolsEntry[] | undefined;\n /** The element that Pick found, for the Elements tab. */\n picked: Element | undefined;\n /** The node of the graph that was clicked, and the pan and zoom of the graph. */\n graphNode: number | undefined;\n view: { x: number; y: number; scale: number; fitted: string };\n /** The timer that draws the graph again when the marks of a write expire. */\n cooling: ReturnType<typeof setTimeout> | undefined;\n /** The state of a workspace that is not part of the shell, by workspace. A child adds its own. */\n work: Partial<Record<WorkspaceId, object>>;\n}\n\n/** The kinds of entries that the log shows. */\nexport const KINDS: DevtoolsEntry['kind'][] = ['handler', 'write', 'call'];\n\n/** A shell in its first state. */\nexport function createShell(tab: Tab): Shell {\n return {\n panel: undefined,\n showTab: undefined,\n endPick: undefined,\n tab,\n selectedError: undefined,\n selectedFrame: -1,\n selected: undefined,\n selectedScope: undefined,\n editing: undefined,\n paused: false,\n filter: '',\n logSearch: '',\n shown: new Set(KINDS),\n frozen: undefined,\n picked: undefined,\n graphNode: undefined,\n view: { x: 0, y: 0, scale: 1, fitted: '' },\n cooling: undefined,\n work: {},\n };\n}\n\n/** Draws the tab of the shell, when the workspace holds it. */\nexport function drawTabOf(\n tabs: Workspace['tabs'],\n ctx: DockContext,\n into: HTMLElement,\n): void | Promise<void> {\n return tabs[ctx.shell.tab]?.(ctx, into);\n}\n\n/** A select of the components on the page, for Graph. */\nexport function chooser(ctx: DockContext, current: string | undefined): HTMLElement {\n const { state, shell } = ctx;\n const select = element('select', { 'aria-label': 'Component' });\n for (const id of collectModules(roots(state))) {\n const info = known.get(id);\n const option = element('option', { value: id }, info ? `${info.name} · ${info.file}` : id);\n option.selected = id === current;\n select.append(option);\n }\n select.addEventListener('change', () => {\n shell.selected = select.value;\n shell.graphNode = undefined;\n ctx.draw();\n });\n return select;\n}\n","// The graph of a component: its layout and its drawing.\n\nimport type { Scope } from '../client.ts';\nimport { findRootScope, preview } from '../devtools.ts';\nimport { element, iconButton, svg } from './dom.ts';\nimport { clip } from './format.ts';\nimport { componentInfo, place, roots } from './info.ts';\nimport type { ComponentInfo } from './info.ts';\nimport { chooser } from './workspace.ts';\nimport type { DockContext } from './workspace.ts';\n\n/** How long a write marks the nodes of the graph. */\nexport const HOT_MS = 1500;\n\n/** How long a mark waits at each node it passes, so a write shows its order. */\nconst STEP_MS = 140;\n\n/** The height of a node, the distance between rows, the space between columns and the margin. */\nconst NODE_HEIGHT = 42;\nconst ROW = 54;\nconst GAP = 56;\nconst PAD = 24;\n\n/** The colour of a node in the graph: signals and props peach, memos purple, effects green, markup blue. */\nexport function pickNodeColor(kind: string, slot: number | undefined): string {\n if (kind === 'memo') {\n return 'var(--purple)';\n }\n if (kind === 'effect') {\n return 'var(--green)';\n }\n return slot === undefined ? 'var(--blue)' : '#ffc28f';\n}\n\n/** What the tooltip of a node calls its kind. */\nfunction nameKind(kind: string): string {\n if (kind === 'memo' || kind === 'effect') {\n return `$${kind}`;\n }\n return kind === 'binding' ? 'markup' : kind;\n}\n\ninterface Spot {\n x: number;\n y: number;\n width: number;\n}\n\n/**\n * Places the nodes of a graph in columns, left to right. A node's column is\n * its depth, the longest path from a value that nothing feeds, so a memo of\n * a memo sits one column further. An edge that skips columns passes through\n * a placeholder in each column it crosses, so no line goes through a node.\n * Within a column, rows are ordered by the average place of the neighbours,\n * a few times in each direction, so edges cross less. Each column is as wide\n * as its widest node and is centred against the tallest one.\n *\n * `routes` has, for each edge, the placeholders it passes through.\n */\nexport function arrangeGraph(\n nodes: unknown[],\n edges: [number, number][],\n getWidth: (index: number) => number,\n): { position: Spot[]; routes: Spot[][] } {\n const count = nodes.length;\n // Depth of each node: the longest path from a value that nothing feeds, in topological order.\n // A node in a cycle never reaches zero inputs, so it keeps the depth its other inputs gave it.\n const depth: number[] = [];\n const waiting: number[] = [];\n const nextOf: number[][] = [];\n for (let index = 0; index < count; index++) {\n depth.push(0);\n waiting.push(0);\n nextOf.push([]);\n }\n for (const [from, to] of edges) {\n nextOf[from]!.push(to);\n waiting[to]!++;\n }\n const ready: number[] = [];\n for (let index = 0; index < count; index++) {\n if (waiting[index] === 0) {\n ready.push(index);\n }\n }\n for (let next = ready.pop(); next !== undefined; next = ready.pop()) {\n for (const to of nextOf[next]!) {\n depth[to] = Math.max(depth[to]!, depth[next]! + 1);\n if (--waiting[to]! === 0) {\n ready.push(to);\n }\n }\n }\n // A placeholder for each column that an edge crosses, shared by the edges of one source, so\n // there are at most as many as nodes times columns. Items after `count` are placeholders.\n const level = depth.slice();\n const links: [number, number][] = [];\n const through: number[][] = [];\n const placeholders = new Map<number, number>();\n for (const [from, to] of edges) {\n const via: number[] = [];\n let last = from;\n for (let column = depth[from]! + 1; column < depth[to]!; column++) {\n const key = from * (count + 1) + column;\n let item = placeholders.get(key);\n if (item === undefined) {\n item = level.length;\n level.push(column);\n placeholders.set(key, item);\n links.push([last, item]);\n }\n via.push(item);\n last = item;\n }\n links.push([last, to]);\n through.push(via);\n }\n // Group the items in columns by depth, and keep the columns that hold an item.\n const columns: number[][] = [];\n for (let index = 0; index < level.length; index++) {\n (columns[level[index]!] ??= []).push(index);\n }\n const filled: number[][] = [];\n for (const column of columns) {\n if (column) {\n filled.push(column);\n }\n }\n const order = new Map<number, number>();\n for (const column of filled) {\n for (const [index, item] of column.entries()) {\n order.set(item, index);\n }\n }\n const before: number[][] = [];\n const after: number[][] = [];\n for (let index = 0; index < level.length; index++) {\n before.push([]);\n after.push([]);\n }\n for (const [from, to] of links) {\n after[from]!.push(to);\n before[to]!.push(from);\n }\n function average(list: number[], fallback: number): number {\n if (list.length === 0) {\n return fallback;\n }\n let sum = 0;\n for (const item of list) {\n sum += order.get(item)!;\n }\n return sum / list.length;\n }\n // Sweep back and forth, ordering each column by the average place of its neighbours.\n for (let sweep = 0; sweep < 8; sweep++) {\n const forward = sweep % 2 === 0;\n const sequence = forward ? filled.slice(1) : filled.slice(0, -1).toReversed();\n for (const column of sequence) {\n const weight = new Map<number, number>();\n for (const item of column) {\n weight.set(item, average(forward ? before[item]! : after[item]!, order.get(item)!));\n }\n column.sort((a, b) => weight.get(a)! - weight.get(b)!);\n for (const [index, item] of column.entries()) {\n order.set(item, index);\n }\n }\n }\n let tallest = 1;\n for (const column of filled) {\n tallest = Math.max(tallest, column.length);\n }\n const spots: Spot[] = [];\n let x = PAD;\n for (const column of filled) {\n let width = 0;\n for (const item of column) {\n if (item < count) {\n width = Math.max(width, getWidth(item));\n }\n }\n // Each column is centred against the tallest one.\n const top = PAD + ((tallest - column.length) * ROW) / 2;\n for (const [index, item] of column.entries()) {\n spots[item] = { x, y: top + index * ROW, width };\n }\n x += width + GAP;\n }\n const routes: Spot[][] = [];\n for (const via of through) {\n const route: Spot[] = [];\n for (const item of via) {\n route.push(spots[item]!);\n }\n routes.push(route);\n }\n return { position: spots.slice(0, count), routes };\n}\n\n/** The place of each node, as `arrangeGraph` puts it. */\nexport function layoutGraph(\n nodes: unknown[],\n edges: [number, number][],\n getWidth: (index: number) => number,\n): Spot[] {\n return arrangeGraph(nodes, edges, getWidth).position;\n}\n\n/** The path of an edge: from the right side of its source, through its placeholders, to its target. */\nfunction drawEdge(from: Spot, via: Spot[], to: Spot): string {\n const half = NODE_HEIGHT / 2;\n let x = from.x + from.width;\n let y = from.y + half;\n let d = `M${x},${y}`;\n for (const spot of via) {\n const middle = (x + spot.x) / 2;\n d += ` C${middle},${y} ${middle},${spot.y + half} ${spot.x},${spot.y + half} L${spot.x + spot.width},${spot.y + half}`;\n x = spot.x + spot.width;\n y = spot.y + half;\n }\n const end = to.x - 7;\n const middle = (x + end) / 2;\n return `${d} C${middle},${y} ${middle},${to.y + half} ${end},${to.y + half}`;\n}\n\n/** The colour class of a value in its text. */\nfunction classifyValue(value: string): string {\n if (value.startsWith('\"')) {\n return 'str';\n }\n if (value === 'true' || value === 'false') {\n return 'bool';\n }\n return /^-?\\d/.test(value) ? 'num' : 'dim';\n}\n\nconst GRAPH_STYLE = `\n.gwrap { position: relative; height: calc(100% - 42px); min-height: 180px; margin-top: 8px; border-top: 1px solid var(--line); overflow: hidden; cursor: grab; touch-action: none; background: radial-gradient(circle, #ffffff0d 1px, transparent 1.2px) 0 0 / 18px 18px; }\n.gwrap.dragging { cursor: grabbing; }\n.gwrap > svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }\n.gwrap .node { cursor: pointer; outline: none; }\n.gwrap .node rect.box { fill: var(--raised); stroke: #36333a; stroke-width: 1; transition: fill 0.2s, stroke 0.2s; }\n.gwrap .node:hover rect.box { stroke: #4a464f; }\n.gwrap .node:focus-visible rect.box { stroke: var(--accent); }\n.gwrap .node .name { fill: var(--text); font: 500 12px var(--mono); }\n.gwrap .node .meta { fill: var(--dim); font: 11px var(--mono); }\n.gwrap .node .meta.str { fill: var(--green); }\n.gwrap .node .meta.num { fill: var(--blue); }\n.gwrap .node .meta.bool { fill: var(--purple); }\n.gwrap .node.selected rect.box { fill: #ee7a3e14; stroke: #ee7a3e80; }\n.gwrap .node.hot rect.box { animation: graph-mark 0.2s both; }\n.gwrap path.gedge.hot-edge { animation: graph-mark-edge 0.2s both; }\n@keyframes graph-mark { to { fill: #ffd16624; stroke: #ffd166; } }\n@keyframes graph-mark-edge { to { stroke: #ffd166; stroke-width: 1.6; } }\n.gwrap .node.faded { opacity: 0.35; }\n.gwrap path.gedge { fill: none; stroke: #4a464f; stroke-width: 1.2; transition: stroke 0.2s, opacity 0.2s; }\n.gwrap path.gedge.lit { stroke: var(--accent); stroke-width: 1.6; }\n.gwrap path.gedge.faded { opacity: 0.25; }\n.gtools { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--bg); box-shadow: 0 0 0 1px #36333a, 0 8px 20px #0007; }\n.gtools button { width: 26px; height: 26px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; }\n.graph-side { position: absolute; top: 10px; right: 10px; bottom: 10px; width: 250px; overflow: auto; padding: 14px 16px; border: 0; border-radius: 10px; background: var(--bg); box-shadow: 0 0 0 1px #36333a, 0 12px 32px #0009; cursor: default; }\n.graph-side h4 { margin: 0; display: flex; align-items: center; gap: 8px; font: 600 13px var(--mono); }\n.graph-side h4 i { flex: none; width: 8px; height: 8px; border-radius: 2px; }\n.graph-side h4 button { margin-left: auto; width: 24px; height: 24px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; }\n.graph-side .kind { margin-top: 4px; display: flex; align-items: center; gap: 8px; color: var(--dim); font: 11.5px var(--mono); }\n.graph-side .gv { margin-top: 10px; font: 12px var(--mono); overflow-wrap: anywhere; }\n.graph-side .sec { margin: 16px 0 6px; color: var(--faint); font-size: 11px; }\n.graph-side .lk { display: flex; align-items: center; gap: 7px; width: calc(100% + 16px); height: 26px; margin: 0 -8px; padding: 0 8px; border: 0; border-radius: 6px; font: 11.5px var(--mono); text-align: left; }\n.graph-side .lk i { flex: none; width: 7px; height: 7px; border-radius: 2px; }\n.graph-side .lk span { margin-left: auto; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.graph-side .str { color: var(--green); }\n.graph-side .num { color: var(--blue); }\n.graph-side .bool { color: var(--purple); }\n.graph-side .dim { color: var(--dim); }\n`;\n\n/** A cross, to close the side. */\nfunction drawCross(): SVGElement {\n return svg(\n 'svg',\n {\n width: 14,\n height: 14,\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': 2,\n 'stroke-linecap': 'round',\n 'aria-hidden': 'true',\n },\n svg('path', { d: 'M6 6l12 12M18 6 6 18' }),\n );\n}\n\n/** The arrowhead of an edge, in the colour of its stroke, so it follows the stroke when that changes. */\nfunction drawArrow(name: string): SVGElement {\n return svg(\n 'marker',\n {\n id: name,\n viewBox: '0 0 8 8',\n refX: 1,\n refY: 4,\n markerWidth: 8,\n markerHeight: 8,\n orient: 'auto',\n },\n svg('path', { d: 'M0,0.5 L7,4 L0,7.5 z', fill: 'context-stroke' }),\n );\n}\n\n/** What a node reaches by the edges of an adjacency list, at any depth, with the steps it took. */\nfunction follow(start: number, adjacent: number[][]): Map<number, number> {\n const found = new Map([[start, 0]]);\n const queue = [start];\n for (let at = 0; at < queue.length; at++) {\n const next = queue[at]!;\n for (const far of adjacent[next]!) {\n if (!found.has(far)) {\n found.set(far, found.get(next)! + 1);\n queue.push(far);\n }\n }\n }\n return found;\n}\n\n/**\n * The graph of a component as a panel, from any scope of one of its instances.\n * Without the dev server's graph, or without nodes, it shows an empty state.\n */\nexport function drawGraph(\n ctx: DockContext,\n scope: Scope,\n info: ComponentInfo | undefined,\n): HTMLElement {\n if (!info?.graph) {\n return element('div', { class: 'empty' }, 'No graph for this component.');\n }\n const instance = findRootScope(scope);\n return drawNodes(ctx, instance.m ?? '', instance, info);\n}\n\nfunction drawNodes(\n ctx: DockContext,\n id: string,\n instance: Scope | undefined,\n info: ComponentInfo,\n): HTMLElement {\n const { state, shell } = ctx;\n const { nodes, edges } = info.graph!;\n if (nodes.length === 0) {\n return element('div', { class: 'empty' }, 'Nothing in this component changes in the browser.');\n }\n // The styles go in the shadow root once, so they are not part of the text of the body.\n if (!ctx.root.querySelector('style[data-graph]')) {\n ctx.root.append(element('style', { 'data-graph': '' }, GRAPH_STYLE));\n }\n // The current value of each value node, from the instance of the component.\n const scopeByNode = new Map<number, Scope>();\n function visit(scope: Scope): void {\n if (!scopeByNode.has(scope.k)) {\n scopeByNode.set(scope.k, scope);\n }\n for (const child of scope.children ?? []) {\n if (child.m === undefined) {\n visit(child);\n }\n }\n }\n if (instance) {\n visit(instance);\n }\n // What each node reads and what reads it.\n const readsOf: number[][] = [];\n const readersOf: number[][] = [];\n for (let index = 0; index < nodes.length; index++) {\n readsOf.push([]);\n readersOf.push([]);\n }\n for (const [from, to] of edges) {\n readersOf[from]!.push(to);\n readsOf[to]!.push(from);\n }\n // Nodes that a recent write reached: the written value, then every node after it, each one\n // STEP_MS after the one before. A node lights at its delay and stays until `end`.\n const now = performance.now();\n const hot = new Map<number, { delay: number; end: number }>();\n // The nodes of each written slot, and what each one reaches (once for each draw).\n const written = new Map<string, number[]>();\n for (const [index, node] of nodes.entries()) {\n if (node.slot !== undefined) {\n const key = `${node.scope}:${node.slot}`;\n const list = written.get(key);\n if (list) {\n list.push(index);\n } else {\n written.set(key, [index]);\n }\n }\n }\n const reached = new Map<number, { steps: Map<number, number>; deepest: number }>();\n for (const entry of state.log) {\n if (entry.write?.component !== id) {\n continue;\n }\n const elapsed = now - entry.time;\n for (const start of written.get(`${entry.write.k}:${entry.write.slot}`) ?? []) {\n let found = reached.get(start);\n if (!found) {\n const steps = follow(start, readersOf);\n found = { steps, deepest: Math.max(...steps.values()) };\n reached.set(start, found);\n }\n // The mark has ended once the deepest node has been lit for HOT_MS.\n if (elapsed >= found.deepest * STEP_MS + HOT_MS) {\n continue;\n }\n for (const [index, steps] of found.steps) {\n const end = entry.time + steps * STEP_MS + HOT_MS;\n if (end > now && end > (hot.get(index)?.end ?? 0)) {\n hot.set(index, { delay: steps * STEP_MS - elapsed, end });\n }\n }\n }\n }\n // Markup nodes share a name, so the box shows the place in the file, such as `9:42`.\n const parts: {\n name: string;\n meta: string;\n value: string | undefined;\n at: string | undefined;\n }[] = [];\n for (const node of nodes) {\n const at = node.at ? `${node.at.line}:${node.at.column}` : undefined;\n const owner = node.slot === undefined ? undefined : scopeByNode.get(node.scope);\n const value = owner && node.slot !== undefined ? preview(owner.s[node.slot]) : undefined;\n let meta = at ? `${nameKind(node.kind)} · ${at}` : nameKind(node.kind);\n if (value !== undefined) {\n meta = value;\n }\n parts.push({ name: node.label, meta, value, at });\n }\n function getNodeWidth(index: number): number {\n return Math.min(\n 262,\n Math.max(\n 120,\n 36 + 7 * Math.max(clip(parts[index]!.name).length, clip(parts[index]!.meta).length),\n ),\n );\n }\n const { position, routes } = arrangeGraph(nodes, edges, getNodeWidth);\n // The lineage of the clicked node: what it reads and what reads it, at any depth.\n const selected =\n shell.graphNode !== undefined && shell.graphNode < nodes.length ? shell.graphNode : undefined;\n const upstream = selected === undefined ? undefined : follow(selected, readsOf);\n const downstream = selected === undefined ? undefined : follow(selected, readersOf);\n const lineage = new Set<number>([...(upstream?.keys() ?? []), ...(downstream?.keys() ?? [])]);\n let graphWidth = 0;\n let graphHeight = 0;\n for (const spot of position) {\n graphWidth = Math.max(graphWidth, spot.x + spot.width);\n graphHeight = Math.max(graphHeight, spot.y + NODE_HEIGHT);\n }\n graphWidth += PAD;\n graphHeight += PAD;\n const layer = svg('g', { class: 'layer' });\n // Faded edges first, then the rest, then lit and hot ones, so a shared run shows the lit colour.\n const behind: SVGElement[] = [];\n const plain: SVGElement[] = [];\n const front: SVGElement[] = [];\n for (const [index, [from, to]] of edges.entries()) {\n const classes = ['gedge'];\n let style = '';\n let pile = plain;\n if (hot.has(from) && hot.has(to)) {\n classes.push('hot-edge');\n style = `animation-delay: ${hot.get(to)!.delay}ms`;\n pile = front;\n } else if (selected !== undefined) {\n // An edge is lit only on a path through the clicked node: both ends before it, or both after it.\n const through =\n (upstream!.has(from) && upstream!.has(to)) ||\n (downstream!.has(from) && downstream!.has(to));\n classes.push(through ? 'lit' : 'faded');\n pile = through ? front : behind;\n }\n pile.push(\n svg('path', {\n class: classes.join(' '),\n 'data-edge': index,\n d: drawEdge(position[from]!, routes[index]!, position[to]!),\n 'marker-end': 'url(#arrow)',\n ...(style ? { style } : {}),\n }),\n );\n }\n layer.append(...behind, ...plain, ...front);\n for (const [index, node] of nodes.entries()) {\n const { x, y, width: nodeWidth } = position[index]!;\n const part = parts[index]!;\n const classes = ['node'];\n if (hot.has(index)) {\n classes.push('hot');\n }\n if (selected === index) {\n classes.push('selected');\n }\n if (selected !== undefined && !lineage.has(index)) {\n classes.push('faded');\n }\n const name = svg('text', { class: 'name', x: x + 24, y: y + 19 });\n name.textContent = clip(part.name);\n const meta = svg('text', {\n class: part.value === undefined ? 'meta' : `meta ${classifyValue(part.value)}`,\n x: x + 24,\n y: y + 33,\n });\n meta.textContent = clip(part.meta);\n // The tooltip names the kind, since the graph has no legend.\n const title = svg('title', {});\n title.textContent = `${nameKind(node.kind)} ${node.label}${part.value === undefined ? '' : ` = ${part.value}`}${part.at ? `, line ${node.at!.line}` : ''}`;\n const group = svg(\n 'g',\n {\n class: classes.join(' '),\n 'data-node': index,\n tabindex: 0,\n role: 'button',\n 'aria-label': `${nameKind(node.kind)} ${node.label}`,\n },\n svg('rect', {\n class: 'box',\n x,\n y,\n width: nodeWidth,\n height: NODE_HEIGHT,\n rx: 8,\n ...(hot.has(index) ? { style: `animation-delay: ${hot.get(index)!.delay}ms` } : {}),\n }),\n svg('circle', {\n class: 'kind',\n cx: x + 14,\n cy: y + 15,\n r: 3.5,\n fill: pickNodeColor(node.kind, node.slot),\n }),\n name,\n meta,\n title,\n );\n function choose(): void {\n select(shell.graphNode === index ? undefined : index, index);\n }\n group.addEventListener('click', (event) => {\n event.stopPropagation();\n choose();\n });\n group.addEventListener('keydown', (event) => {\n if ((event as KeyboardEvent).key === 'Enter' || (event as KeyboardEvent).key === ' ') {\n event.preventDefault();\n choose();\n }\n });\n layer.append(group);\n }\n const canvas = svg(\n 'svg',\n { role: 'img', 'aria-label': `Graph of ${info.name}` },\n svg('defs', {}, drawArrow('arrow')),\n layer,\n );\n const frame = element('div', { class: 'gwrap' }, canvas);\n // Selects a node without the dock drawing again, which would drop the focus: this graph is\n // built anew in place of the old one, with the same pan and zoom, and the focus goes to `focus`.\n function select(index: number | undefined, focus?: number): void {\n shell.graphNode = index;\n const next = drawNodes(ctx, id, instance, info);\n frame.replaceWith(next);\n if (focus !== undefined) {\n next.querySelector<SVGElement>(`[data-node=\"${focus}\"]`)?.focus();\n }\n }\n function apply(): void {\n layer.setAttribute(\n 'transform',\n `translate(${shell.view.x},${shell.view.y}) scale(${shell.view.scale})`,\n );\n }\n function fit(): void {\n const box = frame.getBoundingClientRect();\n if (box.width === 0) {\n // The dock is not shown yet: leave the view unfitted so the next draw fits it.\n return;\n }\n shell.view.fitted = id;\n // The side covers the right of the view, so the graph fits in what is left.\n const room = box.width - (shell.graphNode === undefined ? 0 : 270);\n shell.view.scale = Math.min(\n 1.1,\n Math.max(0.4, Math.min(room / graphWidth, box.height / graphHeight)),\n );\n shell.view.x = Math.max(0, (room - graphWidth * shell.view.scale) / 2);\n shell.view.y = Math.max(0, (box.height - graphHeight * shell.view.scale) / 2);\n apply();\n }\n function zoomAt(factor: number, px: number, py: number): void {\n const next = Math.min(2, Math.max(0.4, shell.view.scale * factor));\n shell.view.x = px - ((px - shell.view.x) * next) / shell.view.scale;\n shell.view.y = py - ((py - shell.view.y) * next) / shell.view.scale;\n shell.view.scale = next;\n apply();\n }\n // Drag to pan, and scroll to zoom around the pointer.\n frame.addEventListener(\n 'wheel',\n (event) => {\n event.preventDefault();\n const box = frame.getBoundingClientRect();\n zoomAt(Math.exp(-event.deltaY * 0.0015), event.clientX - box.left, event.clientY - box.top);\n },\n { passive: false },\n );\n frame.addEventListener('pointerdown', (event) => {\n if ((event.target as Element).closest('.node, .gtools, .graph-side')) {\n return;\n }\n const start = { x: event.clientX - shell.view.x, y: event.clientY - shell.view.y };\n let moved = false;\n frame.classList.add('dragging');\n function move(next: PointerEvent): void {\n moved = true;\n shell.view.x = next.clientX - start.x;\n shell.view.y = next.clientY - start.y;\n apply();\n }\n function up(): void {\n frame.classList.remove('dragging');\n window.removeEventListener('pointermove', move);\n window.removeEventListener('pointerup', up);\n // A click on the empty graph lets go of the node.\n if (!moved && shell.graphNode !== undefined) {\n select(undefined);\n }\n }\n window.addEventListener('pointermove', move);\n window.addEventListener('pointerup', up);\n });\n function zoomButton(name: 'plus' | 'minus', title: string, factor: number): HTMLElement {\n const button = iconButton(name, title, {}, true);\n button.addEventListener('click', () => {\n const box = frame.getBoundingClientRect();\n zoomAt(factor, box.width / 2, box.height / 2);\n });\n return button;\n }\n const fitButton = iconButton('fit', 'Fit the graph in view', {}, true);\n fitButton.addEventListener('click', fit);\n frame.append(\n element(\n 'div',\n { class: 'gtools' },\n zoomButton('minus', 'Zoom out', 1 / 1.2),\n zoomButton('plus', 'Zoom in', 1.2),\n fitButton,\n ),\n );\n\n // The side: the node that was clicked, with what it reads and what reads it.\n if (selected !== undefined) {\n const node = nodes[selected]!;\n const part = parts[selected]!;\n function list(title: string, indexes: number[]): Node[] {\n if (indexes.length === 0) {\n return [];\n }\n const links: HTMLElement[] = [];\n for (const index of indexes) {\n // Markup nodes share a label, so the list names them with their place, such as `insert 9:42`.\n const { label } = nodes[index]!;\n const at = parts[index]!.at;\n let shared = false;\n for (const [i, other] of nodes.entries()) {\n if (i !== index && other.label === label) {\n shared = true;\n break;\n }\n }\n const link = element(\n 'button',\n { class: 'lk' },\n element('i', {\n style: `background: ${pickNodeColor(nodes[index]!.kind, nodes[index]!.slot)}`,\n }),\n shared && at ? `${label} ${at}` : label,\n );\n const value = parts[index]!.value;\n if (value !== undefined) {\n link.append(element('span', {}, clip(value)));\n }\n link.addEventListener('click', () => {\n select(index, index);\n });\n links.push(link);\n }\n return [element('div', { class: 'sec' }, title), ...links];\n }\n // The nodes that this node reads, and the nodes that read it.\n const reads: number[] = [];\n const readBy: number[] = [];\n for (const [from, to] of edges) {\n if (to === selected) {\n reads.push(from);\n }\n if (from === selected) {\n readBy.push(to);\n }\n }\n const close = element('button', { title: 'Close', 'aria-label': 'Close' }, drawCross());\n close.addEventListener('click', () => {\n select(undefined, selected);\n });\n const side = element(\n 'aside',\n { class: 'graph-side' },\n element(\n 'h4',\n {},\n element('i', { style: `background: ${pickNodeColor(node.kind, node.slot)}` }),\n part.name,\n close,\n ),\n element('div', { class: 'kind' }, nameKind(node.kind), node.at ? place(info, node.at) : ''),\n ...(part.value === undefined\n ? []\n : [element('div', { class: `gv ${classifyValue(part.value)}` }, part.value)]),\n ...list('Reads', reads),\n ...list('Read by', readBy),\n );\n frame.append(side);\n }\n // A new component fits the view. Otherwise the pan and zoom stay.\n if (shell.view.fitted === id) {\n apply();\n } else {\n shell.view = { x: 0, y: 0, scale: 1, fitted: '' };\n apply();\n requestAnimationFrame(fit);\n }\n // Draws again when the last mark expires.\n if (hot.size > 0) {\n let last = 0;\n for (const { end } of hot.values()) {\n last = Math.max(last, end);\n }\n clearTimeout(shell.cooling);\n shell.cooling = setTimeout(() => state.changed?.(), last - now);\n }\n return frame;\n}\n\n/** The Graph tab: the chooser and the graph of a component. */\nexport async function drawGraphTab(ctx: DockContext, into: HTMLElement): Promise<void> {\n const { state, shell } = ctx;\n const id = shell.selected ?? roots(state)[0]?.m;\n const info = id ? await componentInfo(state, id) : undefined;\n if (!id || !info) {\n into.replaceChildren(element('div', { class: 'empty' }, 'No component yet.'));\n return;\n }\n if (!info.graph) {\n into.replaceChildren(\n element('div', { class: 'toolbar' }, chooser(ctx, id)),\n element(\n 'div',\n { class: 'empty' },\n 'The dev server sent no graph. It runs an older brumate than this panel: restart it.',\n ),\n );\n return;\n }\n const { nodes, edges } = info.graph;\n // The current value of each value node, from the first instance of the component.\n let instance: Scope | undefined;\n for (const scope of roots(state)) {\n if (scope.m === id) {\n instance = scope;\n break;\n }\n }\n into.replaceChildren(\n element(\n 'div',\n { class: 'toolbar' },\n chooser(ctx, id),\n element('span', { class: 'sub' }, `${nodes.length} nodes · ${edges.length} edges`),\n ),\n drawNodes(ctx, id, instance, info),\n );\n}\n","// The Inspect workspace: the components of the page as a tree, and the detail of the selected one\n// with a Values | Graph switch.\n\nimport type { Scope } from '../client.ts';\nimport { findRootScope, preview } from '../devtools.ts';\nimport type { ScopeId } from '../shared.ts';\nimport { drawCopyTool, writeComponent } from './copy.ts';\nimport { element, icon } from './dom.ts';\nimport { readType } from './format.ts';\nimport { known, loadComponents, roots, source } from './info.ts';\nimport type { ComponentInfo } from './info.ts';\nimport { drawTabOf } from './workspace.ts';\nimport type { DockContext, Workspace } from './workspace.ts';\n\n/** What Inspect remembers, in `shell.work.inspect`. */\ninterface InspectWork {\n /** The view of the detail. */\n mode: 'values' | 'graph';\n /** The scopes whose children the tree hides. */\n closed: Set<ScopeId>;\n /** The control that takes the focus after the next draw. */\n focus: string | undefined;\n /** The scope and the module that the last draw showed, to tell which of the two the shell changed. */\n seenScope: ScopeId | undefined;\n seenModule: string | undefined;\n}\n\nconst INSPECT_STYLE = `\n.ins { --bg2: #161517; --line2: #36333a; --sel: #ee7a3e14; --ring: #ee7a3e47; --accent-text: #ffb48a; }\n.ins > .list { padding: 8px; gap: 1px; }\n.ins .filter { display: block; flex: none; margin: 0 0 6px; }\n.ins .filter input { width: 100%; box-sizing: border-box; height: 30px; padding: 0 10px; border-radius: 7px; background: var(--bg2); border: 0; box-shadow: inset 0 0 0 1px var(--line); outline: none; }\n.ins .filter input:focus-visible { box-shadow: inset 0 0 0 1px var(--ring); outline: none; }\n.ins .tree-row { box-sizing: border-box; flex: none; display: flex; align-items: center; justify-content: flex-start; gap: 7px; width: 100%; height: 28px; margin: 0; padding: 0 8px; border: 0; border-radius: 7px; text-align: left; white-space: nowrap; font-weight: 400; transition: background 0.12s; }\n.ins .tree-row:hover { background: var(--hover); }\n.ins .tree-row:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--ring); }\n.ins .tree-row[aria-current=\"true\"] { background: var(--sel); box-shadow: inset 0 0 0 1px var(--ring); }\n.ins .tree-row[aria-current=\"true\"] .name { color: var(--accent-text); }\n.ins .tree-row .ind { flex: none; align-self: stretch; background: linear-gradient(90deg, transparent 5px, var(--line) 5px, var(--line) 6px, transparent 6px) 0 0 / 14px 100% repeat-x; }\n.ins .tree-row .tw { flex: none; width: 12px; height: 12px; display: grid; place-items: center; color: var(--faint); border-radius: 3px; }\n.ins .tree-row .tw svg { transition: transform 0.12s; }\n.ins .tree-row .tw.shut svg { transform: rotate(-90deg); }\n.ins .tree-row .tw:hover { color: var(--text); }\n.ins .tree-row .name, .ins .tree-row .blk { min-width: 0; overflow: hidden; text-overflow: ellipsis; }\n.ins .tree-row .name { font-weight: 500; }\n.ins .tree-row.off { opacity: .45; }\n.ins .tree-row .blk { font: 11.5px var(--mono); color: var(--purple); }\n.ins .tree-row .meta { flex: none; margin-left: auto; font: 10.5px var(--mono); color: var(--faint); }\n.ins .heat { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); opacity: 0; }\n.ins .heat.on { animation: ins-heat 1.1s ease-out; }\n@keyframes ins-heat { 0% { opacity: 1; transform: scale(1.7); } 100% { opacity: 0; } }\n.ins > .detail.gmode { display: flex; flex-direction: column; padding-bottom: 0; }\n.ins .title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }\n.ins .title { min-width: 0; }\n.ins .title h3 { margin: 0; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 600; letter-spacing: -0.015em; text-transform: none; color: var(--text); }\n.ins .path { min-width: 0; max-width: 100%; display: inline-flex; align-items: center; gap: 4px; font: 11.5px var(--mono); color: var(--dim); }\n.ins .path .link { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; }\n.ins .path:hover, .ins .path .link:hover { color: var(--blue); }\n.ins .views { display: inline-flex; flex: none; gap: 2px; padding: 2px; margin-left: auto; border-radius: 8px; background: var(--bg2); box-shadow: inset 0 0 0 1px var(--line); }\n.ins .views button { height: 24px; padding: 0 10px; border: 0; border-radius: 6px; color: var(--dim); font-size: 11.5px; font-weight: 500; transition: background 0.12s, color 0.12s; }\n.ins .views button:hover { color: var(--text); }\n.ins .views button[aria-pressed=\"true\"] { background: var(--hover); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }\n.ins .views button:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--ring); }\n.ins .tags { display: flex; gap: 6px; margin: 10px 0 0; flex-wrap: wrap; }\n.ins .tag { font: 11px/20px var(--mono); padding: 0 7px; border-radius: 6px; background: var(--hover); color: var(--dim); }\n.ins .tag.y { color: var(--yellow); background: #ffd16618; }\n.ins .sec { font-size: 11px; font-weight: 600; color: var(--faint); margin: 22px 0 8px; display: flex; align-items: baseline; gap: 8px; }\n.ins .sec .n { font: 10.5px var(--mono); font-weight: 400; }\n.ins .vals { display: grid; grid-template-columns: max-content max-content minmax(0, 1fr) max-content; column-gap: 16px; align-items: center; }\n.ins .slot { display: contents; }\n.ins .vals > *, .ins .slot > * { padding: 5px 0; border-top: 1px solid var(--line); min-width: 0; }\n.ins .vals > :first-child > *, .ins .vals > .rd:nth-child(2) { border-top: 0; }\n.ins .slot .k { font: 11.5px var(--mono); color: #ffc28f; }\n.ins .slot .ty { font: 11px var(--mono); color: var(--faint); }\n.ins .vals > .rd { max-width: 34ch; font: 11px var(--mono); color: var(--faint); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.ins .slot .value { color: var(--text); display: block; width: 100%; box-sizing: border-box; margin-left: -6px; padding: 3px 6px; border: 0; border-radius: 5px; text-align: left; font: 11.5px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; transition: background 0.12s, box-shadow 0.12s; }\n.ins .slot .value:hover { background: var(--bg2); }\n.ins .slot .value:focus-visible { background: var(--bg2); outline: none; box-shadow: inset 0 0 0 1px var(--ring); }\n.ins .slot .value.fixed { cursor: default; }\n.ins .slot .value.fixed:hover { background: none; }\n.ins .slot .value.fixed { color: var(--dim); }\n.ins .slot .value.str { color: var(--green); }\n.ins .slot .value.num { color: var(--blue); }\n.ins .slot .value.bool { color: var(--purple); }\n.ins .slot input.value { background: transparent; outline: none; }\n.ins .slot input.value:focus { background: var(--bg2); box-shadow: inset 0 0 0 1px var(--ring); }\n.ins .graph { flex: 1; min-height: 120px; margin: 14px -14px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; position: relative; overflow: hidden; }\n.ins .graph > * { flex: 1; min-height: 0; }\n.ins .graph > .gwrap { height: auto; margin-top: 0; border-top: 0; }\n`;\n\n/** A value that can be edited as text: what JSON can hold. */\nfunction editable(value: unknown): boolean {\n if (value === null || ['string', 'number', 'boolean'].includes(typeof value)) {\n return true;\n }\n if (typeof value !== 'object' || value instanceof Element) {\n return false;\n }\n try {\n JSON.stringify(value);\n return true;\n } catch {\n return false;\n }\n}\n\n/** Reads what a person typed: JSON, or else the text as a string. */\nfunction parseValue(text: string): unknown {\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n}\n\nfunction findWork(ctx: Pick<DockContext, 'shell'>): InspectWork {\n const { work } = ctx.shell;\n let mine = work.inspect as InspectWork | undefined;\n if (!mine) {\n mine = {\n mode: 'values',\n closed: new Set(),\n focus: undefined,\n seenScope: undefined,\n seenModule: undefined,\n };\n work.inspect = mine;\n }\n return mine;\n}\n\n/** A slot as a row of the values: name, type, value and what reads it. The reads sit outside the slot. */\nfunction drawSlot(\n ctx: DockContext,\n scope: Scope,\n slot: number,\n name: string,\n readers: string[],\n): HTMLElement[] {\n const { state } = ctx;\n const work = findWork(ctx);\n const value = scope.s[slot];\n const cell = element('div', { class: 'v' });\n const line = element(\n 'div',\n { class: 'slot' },\n element('div', { class: 'k' }, name),\n element('div', { class: 'ty' }, readType(value)),\n cell,\n );\n const reads = element('div', { class: 'rd', title: readers.join(', ') }, readers.join(', '));\n const canEdit = editable(value) && state.set !== undefined;\n const kinds: Record<string, string> = { string: 'str', number: 'num', boolean: 'bool' };\n const classes = ['value'];\n if ((typeof value) in kinds) {\n classes.push(kinds[typeof value]!);\n }\n if (!canEdit) {\n cell.append(element('span', { class: `${classes.join(' ')} fixed` }, preview(value)));\n return [line, reads];\n }\n // The input is always there and commits on change, which also fires when the focus leaves.\n const input = element('input', {\n class: classes.join(' '),\n 'aria-label': `Value of ${name}`,\n title: 'Enter JSON, or text for a string.',\n spellcheck: 'false',\n 'data-focus': `value-${slot}`,\n });\n input.value = JSON.stringify(value) ?? '';\n // The draw waits while the text differs from this, so a person can type.\n input.defaultValue = input.value;\n // Writes the text once: a second call with the same text does nothing.\n function commit(): void {\n if (input.value === input.defaultValue) {\n return;\n }\n input.defaultValue = input.value;\n state.set?.(scope, slot, parseValue(input.value));\n ctx.draw();\n }\n // Change also fires when the focus leaves, so the draw keeps the focus where it went.\n input.addEventListener('change', commit);\n input.addEventListener('keydown', (event) => {\n if (event.key === 'Enter') {\n work.focus = `value-${slot}`;\n commit();\n work.focus = undefined;\n } else if (event.key === 'Escape') {\n input.value = input.defaultValue;\n }\n });\n cell.append(input);\n return [line, reads];\n}\n\n/**\n * The scope to show. Whichever of `shell.selectedScope` (Pick, the call detail) and `shell.selected`\n * (Page, a component chosen by its module) changed since the last draw wins, the scope first.\n */\nexport function findCurrent(ctx: Pick<DockContext, 'state' | 'shell'>, list: Scope[]): Scope {\n const { state, shell } = ctx;\n const work = findWork(ctx);\n const named =\n shell.selectedScope === undefined ? undefined : state.scopes?.get(shell.selectedScope);\n let current = named;\n if (shell.selectedScope === work.seenScope && shell.selected !== work.seenModule) {\n for (const scope of list) {\n if (scope.m === shell.selected) {\n current = scope;\n break;\n }\n }\n }\n current ??= list[0]!;\n shell.selectedScope = current.id;\n work.seenScope = current.id;\n work.seenModule = findRootScope(current).m;\n shell.selected = work.seenModule;\n return current;\n}\n\n/** The scopes of a component instance, itself included, without the components inside it. */\nfunction countOwn(scope: Scope): number {\n let count = 1;\n for (const child of scope.children ?? []) {\n if (child.m === undefined) {\n count += countOwn(child);\n }\n }\n return count;\n}\n\nfunction hasOwnChildren(group: Scope[]): boolean {\n for (const scope of group) {\n for (const child of scope.children ?? []) {\n if (child.m === undefined) {\n return true;\n }\n }\n }\n return false;\n}\n\n/** The name of a block from the label of its scope: `body of #for (95:3)` is `#for`. */\nfunction readBlock(label: string | undefined): string {\n const body = /^body of (#\\w+)/.exec(label ?? '');\n return body ? body[1]! : (label ?? 'scope');\n}\n\n/** The name of the control that has the focus inside the body, and the caret of a text field. */\nfunction findFocus(\n ctx: DockContext,\n into: HTMLElement,\n): { key: string; from: number | null; to: number | null } | undefined {\n const active = ctx.root.activeElement as HTMLElement | null;\n const key = active && into.contains(active) ? active.dataset.focus : undefined;\n if (key === undefined) {\n return undefined;\n }\n const field = active as HTMLInputElement;\n return { key, from: field.selectionStart ?? null, to: field.selectionEnd ?? null };\n}\n\nasync function drawInspect(ctx: DockContext, into: HTMLElement): Promise<void> {\n const { state, shell } = ctx;\n const work = findWork(ctx);\n const list = roots(state);\n const listed: string[] = [];\n for (const scope of list) {\n listed.push(scope.m!);\n }\n const infos = await loadComponents(state, listed);\n if (!ctx.root.querySelector('style[data-inspect]')) {\n ctx.root.append(element('style', { 'data-inspect': '' }, INSPECT_STYLE));\n }\n if (list.length === 0) {\n into.replaceChildren(\n element('div', { class: 'empty' }, 'No scopes yet. The first event loads them.'),\n );\n return;\n }\n const current = findCurrent(ctx, list);\n const component = findRootScope(current);\n\n // The ancestors of the current scope stay open, so the selected row shows.\n const trail = new Set<ScopeId>();\n for (let scope = current.p; scope; scope = scope.p) {\n trail.add(scope.id);\n }\n\n const search = element('input', {\n type: 'search',\n placeholder: 'Filter components and values',\n 'aria-label': 'Filter components',\n 'data-focus': 'filter',\n });\n search.value = shell.filter;\n search.addEventListener('input', () => {\n shell.filter = search.value;\n void drawInspect(ctx, into);\n });\n const {\n box,\n first: tree,\n second: detail,\n } = ctx.split({\n key: 'scopes',\n min: [200, 300],\n start: 280,\n });\n box.classList.add('ins');\n tree.append(element('label', { class: 'filter' }, search));\n\n // A row is a component or a block. The scopes of one block (the items of a `#for`) share a row.\n const rows: [HTMLElement, Scope[]][] = [];\n function select(group: Scope[], focus?: boolean): void {\n // A second click on a row with many scopes moves to the next one.\n const at = group.indexOf(current);\n const scope = group[at === -1 ? 0 : (at + 1) % group.length]!;\n shell.selectedScope = scope.id;\n shell.selected = findRootScope(scope).m;\n if (focus) {\n work.focus = `row-${group[0]!.id}`;\n }\n ctx.draw();\n }\n function visit(\n group: Scope[],\n info: ComponentInfo | undefined,\n depth: number,\n layout: ComponentInfo['scopes'][number] | undefined,\n ): void {\n const first = group[0]!;\n const isComponent = first.m !== undefined;\n const nested = hasOwnChildren(group);\n let onTrail = false;\n for (const scope of group) {\n onTrail ||= trail.has(scope.id);\n }\n const shut = work.closed.has(first.id) && !onTrail;\n const chevron = element('span', { class: shut ? 'tw shut' : 'tw' });\n if (nested) {\n chevron.append(icon('close', 12));\n chevron.addEventListener('click', (event) => {\n event.stopPropagation();\n if (work.closed.has(first.id)) {\n work.closed.delete(first.id);\n } else {\n // Folding selects the row, so the selection never hides inside it.\n work.closed.add(first.id);\n shell.selectedScope = first.id;\n shell.selected = findRootScope(first).m;\n }\n work.focus = `row-${first.id}`;\n ctx.draw();\n });\n }\n let label: string;\n let meta: string;\n if (isComponent) {\n label = info?.name ?? first.m!;\n meta = `${countOwn(first)} ${countOwn(first) === 1 ? 'scope' : 'scopes'}`;\n } else {\n label = readBlock(layout?.label);\n meta =\n label === '#for'\n ? `${group.length} ${group.length === 1 ? 'item' : 'items'}`\n : `#${first.id}`;\n }\n const classes = ['tree-row'];\n if (isComponent) {\n classes.push('component');\n } else if (first.h) {\n classes.push('off');\n }\n const button = element(\n 'button',\n {\n class: classes.join(' '),\n 'aria-current': String(group.includes(current)),\n 'data-focus': `row-${first.id}`,\n title: group.length > 1 ? 'Click again for the next scope of this block.' : label,\n },\n element('span', { class: 'ind', style: `width: ${depth * 14}px` }),\n chevron,\n element('span', { class: isComponent ? 'name' : 'blk' }, label),\n element('span', {\n class: group.some((scope) => state.written.has(scope.id)) ? 'heat on' : 'heat',\n }),\n element('span', { class: 'meta' }, meta),\n );\n button.addEventListener('click', () => select(group));\n button.addEventListener('mouseenter', () => ctx.outline(first.id));\n button.addEventListener('mouseleave', () => ctx.outline());\n rows.push([button, group]);\n tree.append(button);\n if (shut) {\n return;\n }\n // The blocks inside, grouped by their place in the component, in the order they first appear.\n const blocks = new Map<number, Scope[]>();\n for (const scope of group) {\n for (const child of scope.children ?? []) {\n if (child.m === undefined) {\n const same = blocks.get(child.k);\n if (same) {\n same.push(child);\n } else {\n blocks.set(child.k, [child]);\n }\n }\n }\n }\n for (const [k, inside] of blocks) {\n visit(inside, info, depth + 1, info?.scopes[k]);\n }\n }\n const needle = shell.filter.trim().toLowerCase();\n for (const [index, scope] of list.entries()) {\n const info = infos[index];\n if (needle && !`${info?.name ?? scope.m} ${info?.file ?? ''}`.toLowerCase().includes(needle)) {\n // The name does not match, so look for a value that does.\n let matched = false;\n for (const value of scope.s) {\n if (preview(value).toLowerCase().includes(needle)) {\n matched = true;\n break;\n }\n }\n if (!matched) {\n continue;\n }\n }\n visit([scope], info, 0, undefined);\n }\n // The arrow keys move the selection through the rows that show, and the side arrows fold.\n tree.addEventListener('keydown', (event) => {\n // The filter keeps its own keys.\n if (event.target instanceof HTMLInputElement) {\n return;\n }\n let at = -1;\n for (const [index, [button]] of rows.entries()) {\n if (button === event.target) {\n at = index;\n break;\n }\n }\n if (at < 0) {\n return;\n }\n const focused = rows[at]![1];\n const firstId = focused[0]!.id;\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n const next = rows[at + (event.key === 'ArrowDown' ? 1 : -1)];\n if (next) {\n event.preventDefault();\n select(next[1], true);\n }\n } else if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {\n const shutNow = event.key === 'ArrowLeft';\n if (hasOwnChildren(focused) && work.closed.has(firstId) !== shutNow) {\n event.preventDefault();\n if (shutNow) {\n work.closed.add(firstId);\n } else {\n work.closed.delete(firstId);\n }\n work.focus = `row-${firstId}`;\n ctx.draw();\n }\n }\n });\n\n // The detail of the selected scope.\n const info = known.get(component.m ?? '');\n const plan = info?.scopes[current.k];\n const graphing = work.mode === 'graph';\n if (graphing) {\n detail.classList.add('gmode');\n }\n const views = element('span', { class: 'views', role: 'group', 'aria-label': 'View' });\n for (const mode of ['values', 'graph'] as const) {\n const button = element(\n 'button',\n { 'aria-pressed': String(work.mode === mode), 'data-focus': `mode-${mode}` },\n mode === 'values' ? 'Values' : 'Graph',\n );\n button.addEventListener('click', () => {\n work.mode = mode;\n work.focus = `mode-${mode}`;\n // The old tab bar draws the Graph tab in the graph view; leave it for the one that holds both.\n if (shell.tab === 'graph' || shell.tab === 'elements') {\n shell.tab = 'scopes';\n }\n ctx.draw();\n });\n views.append(button);\n }\n const tags = element(\n 'div',\n { class: 'tags' },\n element('span', { class: 'tag' }, `scope ${current.id}`),\n current === component ? '' : element('span', { class: 'tag' }, readBlock(plan?.label)),\n element(\n 'span',\n { class: 'tag' },\n `${countOwn(component)} ${countOwn(component) === 1 ? 'scope' : 'scopes'}`,\n ),\n current.h ? element('span', { class: 'tag y' }, 'hidden') : '',\n );\n detail.append(\n element(\n 'div',\n { class: 'title' },\n element('h3', { title: info?.name ?? component.m ?? '' }, info?.name ?? component.m ?? ''),\n element('span', { class: 'path' }, source(info)),\n drawCopyTool(() => writeComponent(component, info, state.meta)),\n views,\n ),\n tags,\n );\n if (graphing) {\n detail.append(element('div', { class: 'graph' }, ctx.drawGraph(component, info)));\n } else if (current.s.length === 0) {\n detail.append(\n element('div', { class: 'sec' }, 'Values', element('span', { class: 'n' }, '0')),\n element('div', { class: 'empty' }, 'This scope holds no values.'),\n );\n } else {\n const grid = element('div', { class: 'vals' });\n for (let slot = 0; slot < current.s.length; slot++) {\n grid.append(\n ...drawSlot(\n ctx,\n current,\n slot,\n plan?.slots[slot] ?? `slot ${slot}`,\n plan?.readers?.[slot] ?? [],\n ),\n );\n }\n detail.append(\n element(\n 'div',\n { class: 'sec' },\n 'Values',\n element('span', { class: 'n' }, String(current.s.length)),\n ),\n grid,\n );\n }\n\n // A value that a person is typing stays until it is committed or cancelled.\n const typing = ctx.root.activeElement;\n if (\n typing instanceof HTMLInputElement &&\n into.contains(typing) &&\n typing.dataset.focus?.startsWith('value-') &&\n typing.value !== typing.defaultValue\n ) {\n return;\n }\n const focused = findFocus(ctx, into);\n into.replaceChildren(box);\n // The control that had the focus gets it back, or the one that an action asked for.\n const wanted = work.focus ?? focused?.key;\n work.focus = undefined;\n if (wanted !== undefined) {\n const target = into.querySelector<HTMLElement>(`[data-focus=\"${wanted}\"]`);\n target?.focus({ preventScroll: true });\n if (\n target &&\n focused?.key === wanted &&\n focused.from !== null &&\n 'setSelectionRange' in target\n ) {\n (target as HTMLInputElement).setSelectionRange(focused.from, focused.to);\n }\n }\n into.querySelector('[aria-current=\"true\"]')?.scrollIntoView({ block: 'nearest' });\n}\n\nexport const inspect: Workspace = {\n id: 'inspect',\n label: 'Inspect',\n icon: 'scopes',\n // The old tab bar has one key per tab until dock-shell lands. They all show the one workspace; the\n // Graph tab opens it in the graph view.\n tabs: {\n scopes: drawInspect,\n elements: drawInspect,\n graph: (ctx, into) => {\n findWork(ctx).mode = 'graph';\n return drawInspect(ctx, into);\n },\n },\n draw: (ctx, into) => drawTabOf(inspect.tabs, ctx, into),\n};\n","// The Issues workspace: the errors of the page, as the prototype draws them. The list is on one\n// side, the code, the stack and the actions of the selected issue on the other.\n\nimport type * as ErrorCatalog from '../../error-catalog.ts';\nimport type { ErrorEntry } from '../devtools.ts';\nimport { copyText, writeIssue } from './copy.ts';\nimport { icon, element } from './dom.ts';\nimport { seconds } from './format.ts';\nimport {\n codeView,\n fetchCompiled,\n fetchSource,\n frameUrls,\n mapFrames,\n parseFrames,\n} from './stack.ts';\nimport { drawTabOf } from './workspace.ts';\nimport type { DockContext, Workspace } from './workspace.ts';\n\nconst ISSUES_STYLE = `\n.issues { --sel: #ee7a3e14; --ring: #ee7a3e47; }\n.issues > .list { padding: 8px; gap: 2px; }\n.issues .iss { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; transition: background .12s; }\n.issues .iss:hover { background: var(--hover); }\n.issues .iss[aria-current=\"true\"] { background: var(--sel); box-shadow: inset 0 0 0 1px var(--ring); }\n.issues .iss .src { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--faint); }\n.issues .iss .src i { width: 7px; height: 7px; border-radius: 50%; flex: none; }\n.issues .iss .msg { display: block; margin-top: 3px; font-weight: 500; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.issues .iss .at { display: block; margin-top: 2px; font: 11px var(--mono); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.issues > .detail { padding: 14px; overflow: auto; }\n.issues .title { margin: 0 0 4px; font: 600 14px/1.4 var(--mono); color: var(--text); white-space: pre-wrap; }\n.issues .code { margin: 14px 0 0; border: 0; border-radius: 10px; background: #0d0c0e; box-shadow: inset 0 0 0 1px var(--line); }\n.issues .sec { margin: 16px 0 6px; color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }\n.issues .frame[aria-current=\"true\"] { background: var(--sel); box-shadow: inset 0 0 0 1px var(--ring); }\n.issues .frame[aria-current=\"true\"] .fn { color: var(--text); }\n.issues .acts { margin-top: 20px; display: flex; gap: 8px; flex-wrap: wrap; }\n.issues .btn { height: 28px; padding: 0 12px; border-radius: 8px; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; }\n.issues .btn:hover { background: var(--hover); }\n.issues .btn.pri { background: var(--text); color: #121113; box-shadow: none; }\n.issues .btn.pri:hover { background: #fff; }\n.issues .hint { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: #161517; color: var(--dim); }\n.issues .hint b { color: var(--text); font-weight: 500; }\n.issues .hint a { color: var(--accent); margin-left: 6px; }\n.issues .iss .src .mono { font-family: var(--mono); }\n`;\n\nfunction openInEditor(place: { file: string; line: number; column: number }): void {\n void fetch(\n `/__open-in-editor?file=${encodeURIComponent(`${place.file}:${place.line}:${place.column}`)}`,\n );\n}\n\n/** A button that opens a place of a file in the editor. */\nfunction open(place: { file: string; line: number; column: number }): HTMLElement {\n const button = element(\n 'button',\n { class: 'link', title: 'Open in the editor' },\n `${place.file.replace(/^.*\\/(src|test|routes)\\//, '$1/')}:${place.line}:${place.column}`,\n icon('open', 12),\n );\n button.addEventListener('click', () => openInEditor(place));\n return button;\n}\n\ntype Catalog = typeof ErrorCatalog;\n\n// The catalog of compile errors is large, so it loads with the first issue, as the highlighter does.\nlet catalog: Promise<Catalog> | undefined;\n\n/** The code of an issue, such as BRM012, from its message or from the catalog. */\nfunction readCode(entry: ErrorEntry, found: Catalog | undefined): string | undefined {\n return /\\[(BRM\\d+)\\]$/.exec(entry.message)?.[1] ?? found?.findError(entry.message)?.code;\n}\n\n/** The key of an issue that stays the same when a newer one arrives. */\nfunction makeIssueKey(entry: ErrorEntry, entries: ErrorEntry[]): string {\n let same = 0;\n for (const other of entries) {\n if (other === entry) {\n break;\n }\n if (other.time === entry.time) {\n same++;\n }\n }\n return `issue:${entry.time}:${same}`;\n}\n\n/** The label, dot colour and kind of an issue, as the prototype names them. */\nfunction describe(source: ErrorEntry['source']): { label: string; color: string } {\n if (source === 'browser') {\n return { label: 'Browser error', color: 'var(--red)' };\n }\n if (source === 'compile') {\n return { label: 'Compiler check', color: 'var(--yellow)' };\n }\n return { label: 'Server error', color: 'var(--red)' };\n}\n\n/** Where an issue happened, short enough for a row. */\nfunction locate(entry: ErrorEntry): string {\n if (entry.loc) {\n return `${entry.loc.file.replace(/^.*\\/(src|test|routes)\\//, '$1/')}:${entry.loc.line}:${entry.loc.column}`;\n }\n return seconds(entry.time);\n}\n\n/** Keeps the keyboard focus on the same row after the workspace draws again. */\nfunction focusAgain(into: HTMLElement, key: string | undefined): void {\n if (key === undefined) {\n return;\n }\n for (const item of into.querySelectorAll<HTMLElement>('[data-key]')) {\n if (item.dataset.key === key) {\n item.focus();\n return;\n }\n }\n}\n\nexport async function drawErrors(ctx: DockContext, into: HTMLElement): Promise<void> {\n const { state, shell } = ctx;\n // The styles go in the shadow root once, so they are not part of the text of the body.\n if (!ctx.root.querySelector('style[data-issues]')) {\n ctx.root.append(element('style', { 'data-issues': '' }, ISSUES_STYLE));\n }\n const active = ctx.root.activeElement;\n const focused = active instanceof HTMLElement && into.contains(active) ? active : undefined;\n if (state.errors.length === 0) {\n into.replaceChildren(\n element('h2', {}, 'Issues'),\n element(\n 'p',\n { class: 'sub' },\n 'No issues. Errors of a render on the server, of Vite, such as a compile error after an edit, and of code in the browser show here.',\n ),\n );\n return;\n }\n if (!shell.selectedError || !state.errors.includes(shell.selectedError)) {\n shell.selectedError = state.errors.at(-1);\n shell.selectedFrame = -1;\n }\n const error = shell.selectedError!;\n const {\n box,\n first: list,\n second: detail,\n } = ctx.split({\n key: 'errors',\n min: [200, 300],\n start: 280,\n });\n box.classList.add('issues');\n // Without the catalog the code and the hint are left out.\n let found: Catalog | undefined;\n try {\n found = await (catalog ??= import('../../error-catalog.ts'));\n } catch {\n catalog = undefined;\n }\n const entries = state.errors.toReversed();\n for (const entry of entries) {\n const { label, color } = describe(entry.source);\n const code = readCode(entry, found);\n const button = element(\n 'button',\n {\n class: 'iss',\n 'data-key': makeIssueKey(entry, entries),\n 'aria-current': String(entry === error),\n },\n element(\n 'span',\n { class: 'src' },\n element('i', { style: `background: ${color}` }),\n label,\n code ? ' · ' : '',\n code ? element('span', { class: 'mono' }, code) : '',\n ),\n element('span', { class: 'msg' }, entry.message.split('\\n')[0]!),\n element('span', { class: 'at' }, locate(entry)),\n );\n button.addEventListener('click', () => {\n shell.selectedError = entry;\n shell.selectedFrame = -1;\n ctx.draw();\n });\n list.append(button);\n }\n // The arrow keys move the selection, and the row keeps the focus when it is drawn again.\n list.addEventListener('keydown', (event) => {\n if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') {\n return;\n }\n const at = entries.indexOf(shell.selectedError!);\n event.preventDefault();\n if (at === -1) {\n return;\n }\n const next = entries[at + (event.key === 'ArrowDown' ? 1 : -1)];\n if (next) {\n shell.selectedError = next;\n shell.selectedFrame = -1;\n // The draw is async; the focus moves once the new rows are in.\n shell.work.issues = { focus: makeIssueKey(next, entries) };\n ctx.draw();\n }\n });\n\n // The place to show: a frame that was clicked, the place of a compile error, or the first\n // frame of the app's code.\n const frames = await mapFrames(parseFrames(error.stack), frameUrls(error.stack));\n if (shell.selectedFrame === -1) {\n shell.selectedFrame = -2;\n if (!error.loc) {\n // The first frame of the app's code, or -1 when there is none.\n shell.selectedFrame = -1;\n for (const [index, item] of frames.entries()) {\n if (!item.library && !item.compiled) {\n shell.selectedFrame = index;\n break;\n }\n }\n }\n }\n const frame = shell.selectedFrame >= 0 ? frames[shell.selectedFrame] : undefined;\n const place = shell.selectedFrame === -2 ? error.loc : frame;\n const editable = place && !('url' in place && place.url) ? place : undefined;\n detail.append(element('h3', { class: 'title' }, error.message));\n if (editable) {\n detail.append(open(editable));\n }\n if (place) {\n detail.append(await codeView(place, error.frame));\n } else if (error.frame) {\n detail.append(\n element('div', { class: 'code' }, element('pre', { class: 'plain' }, error.frame)),\n );\n }\n if (frames.length > 0) {\n const stack = element('div', { class: 'frames' });\n for (const [index, item] of frames.entries()) {\n const button = element(\n 'button',\n {\n class: `frame${item.library ? ' library' : ''}`,\n 'data-key': `frame:${index}`,\n 'aria-current': String(index === shell.selectedFrame),\n title: item.compiled ? 'The lines of code that the browser ran' : 'Show this code',\n },\n element('span', { class: 'fn' }, item.fn),\n element('span', { class: 'where' }, `${item.file}:${item.line}:${item.column}`),\n );\n button.addEventListener('click', () => {\n shell.selectedFrame = index;\n ctx.draw();\n });\n stack.append(button);\n }\n detail.append(element('div', { class: 'sec' }, 'Stack'), stack);\n }\n\n const hint = found?.findError(error.message);\n if (hint) {\n const note = element('div', { class: 'hint' }, element('b', {}, hint.cause));\n if (hint.link) {\n note.append(element('a', { href: hint.link, target: '_blank', rel: 'noopener' }, 'Docs'));\n }\n detail.append(note);\n }\n\n const actions = element('div', { class: 'acts' });\n if (editable) {\n const edit = element('button', { class: 'btn pri' }, 'Open in editor');\n edit.addEventListener('click', () => openInEditor(editable));\n actions.append(edit);\n }\n const copy = element('button', { class: 'btn', 'data-key': 'copy' }, 'Copy for an agent');\n // The source around the place is read when the button is pressed, and the copy goes without it\n // when the dev server cannot read it.\n copyText(copy, async () => {\n let around: { file: string; line: number; text: string } | undefined;\n if (place) {\n try {\n const url = 'url' in place && typeof place.url === 'string' ? place.url : undefined;\n const text = await (url ? fetchCompiled(url) : fetchSource(place.file));\n around = text === undefined ? undefined : { file: place.file, line: place.line, text };\n } catch {\n around = undefined;\n }\n }\n return writeIssue(error, describe(error.source).label, state.meta, around);\n });\n actions.append(copy);\n if (error.source === 'browser') {\n const show = element('button', { class: 'btn' }, 'Show in Activity');\n show.addEventListener('click', () => ctx.select('activity', 'log'));\n actions.append(show);\n }\n detail.append(actions);\n\n into.replaceChildren(box);\n const wanted = shell.work.issues as { focus?: string } | undefined;\n focusAgain(into, wanted?.focus ?? focused?.dataset.key);\n shell.work.issues = {};\n}\n\nexport const issues: Workspace = {\n id: 'issues',\n label: 'Issues',\n icon: 'errors',\n tabs: { errors: drawErrors },\n draw: (ctx, into) => drawTabOf(issues.tabs, ctx, into),\n};\n","// The Page workspace, as the prototype draws it: four numbers, the state that the page sent, the\n// blocks that render later, and the environment. Every number is read from the running page.\n\nimport { findRootScope } from '../devtools.ts';\nimport type { BlockEntry, DevtoolsState } from '../devtools.ts';\nimport { element, iconButton, key, pill, row } from './dom.ts';\nimport { kilobytes, measureSize, seconds, ms, stateBytes } from './format.ts';\nimport { collectModules, countScopes, known, loadComponents, roots } from './info.ts';\nimport type { DockContext, Workspace } from './workspace.ts';\n\nconst STATE_COLORS: Record<BlockEntry['state'], string> = {\n waiting: '',\n loading: 'blue',\n streaming: 'blue',\n rendered: 'green',\n failed: 'red',\n};\n\nfunction blockLabel(block: BlockEntry): string {\n return block.kind === '$client' ? '$client' : `#${block.kind}`;\n}\n\nconst PAGE_STYLE = `\n.pg { min-width: 0; }\n.pg .metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; margin: -12px -14px 0; background: var(--line); border-bottom: 1px solid var(--line); }\n.panel.right .pg .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }\n.pg .metric { min-width: 0; padding: 14px 18px; background: var(--bg); }\n.pg .metric .l, .pg .metric .s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.pg .metric .l { color: var(--dim); }\n.pg .metric .big { margin-top: 6px; font: 500 24px/1.15 var(--mono); letter-spacing: -.03em; white-space: nowrap; }\n.pg .metric .big small { margin-left: 3px; font-size: 12px; color: var(--faint); letter-spacing: 0; }\n.pg .metric .s { margin-top: 2px; font: 11px var(--mono); color: var(--faint); }\n.pg .cols { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); margin: 0 -14px; }\n.panel.right .pg .cols { grid-template-columns: minmax(0, 1fr); }\n.pg .cols > section { padding: 4px 18px 18px; min-width: 0; }\n.pg .cols > section + section { border-left: 1px solid var(--line); }\n.panel.right .pg .cols > section + section { border-left: 0; border-top: 1px solid var(--line); }\n.pg .sec { display: flex; align-items: baseline; gap: 8px; margin: 18px 0 8px; color: var(--faint); font-size: 11px; font-weight: 600; }\n.pg .sec .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 10.5px var(--mono); font-weight: 400; }\n.pg .sizes { display: flex; height: 8px; margin: 4px 0 10px; gap: 2px; border-radius: 4px; overflow: hidden; }\n.pg .sizes span { min-width: 3px; }\n.pg .legend { margin-bottom: 4px; gap: 6px 14px; font: 11px var(--mono); }\n.pg .block-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 36px; border-top: 1px solid var(--line); }\n.pg .blocks > .block-row:first-child { border-top: 0; }\n.pg .block-row > * { min-width: 0; }\n.pg .block-row .what { display: flex; align-items: center; gap: 8px; overflow: hidden; white-space: nowrap; font-family: var(--mono); }\n.pg .block-row .what .mono, .pg .block-row .what .sub { overflow: hidden; text-overflow: ellipsis; }\n.pg .block-row .state { display: flex; align-items: center; gap: 8px; white-space: nowrap; font: 11px var(--mono); color: var(--faint); }\n.pg .block-row .go { display: flex; gap: 6px; }\n.pg .scroll-x { overflow-x: auto; }\n.pg .values { width: 100%; table-layout: fixed; border-collapse: collapse; }\n.pg .values th, .pg .values td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.pg .values th:nth-child(4), .pg .values th:nth-child(5) { width: 54px; }\n.pg .env { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 20px; font: 11.5px var(--mono); }\n.pg .env > :nth-child(odd) { color: var(--faint); }\n.pg .env > :nth-child(even) { min-width: 0; overflow-wrap: anywhere; }\n.pg .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }\n.pg .btn { height: 28px; padding: 0 12px; border-radius: 8px; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; }\n.pg .btn:hover { background: var(--hover); }\n`;\n\nconst SEGMENTS = ['var(--accent)', 'var(--blue)', 'var(--purple)', 'var(--green)', 'var(--yellow)'];\n\ninterface Slot {\n component: string;\n k: number;\n slot: number;\n bytes: number;\n count: number;\n}\n\n/** The slots of the scopes that the server sent. The slots of every instance add up. */\nfunction readSlots(state: DevtoolsState): { slots: Slot[]; scopes: number } {\n const found = new Map<string, Slot>();\n let scopes = 0;\n for (const scope of state.scopes?.values() ?? []) {\n // The scopes that the browser made are not in the state that the server sent.\n if (typeof scope.id === 'number' && scope.id < 0) {\n continue;\n }\n scopes++;\n const component = findRootScope(scope).m ?? '';\n for (const [slot, value] of scope.s.entries()) {\n const id = `${component}:${scope.k}:${slot}`;\n const entry = found.get(id) ?? { component, k: scope.k, slot, bytes: 0, count: 0 };\n entry.bytes += measureSize(value);\n entry.count++;\n found.set(id, entry);\n }\n }\n return { slots: [...found.values()].toSorted((a, b) => b.bytes - a.bytes), scopes };\n}\n\n/** How long the page took to get ready, from the navigation timing, when the browser has it. */\nfunction readReady(): { total: number; server: number } | undefined {\n const [timing] = performance.getEntriesByType('navigation') as PerformanceNavigationTiming[];\n if (!timing || timing.domContentLoadedEventEnd <= 0) {\n return undefined;\n }\n return { total: timing.domContentLoadedEventEnd, server: timing.responseStart };\n}\n\nfunction makeMetric(label: string, big: string, small: string, note: string): HTMLElement {\n return element(\n 'div',\n { class: 'metric' },\n element('div', { class: 'l' }, label),\n element('div', { class: 'big' }, big, small ? element('small', {}, small) : ''),\n element('div', { class: 's' }, note),\n );\n}\n\nfunction drawMetrics(state: DevtoolsState, components: number, scopes: number): HTMLElement {\n let handlers = 0;\n let calls = 0;\n for (const entry of state.log) {\n if (entry.kind === 'handler') {\n handlers++;\n } else if (entry.kind === 'call') {\n calls++;\n }\n }\n const bytes = (stateBytes() / 1024).toFixed(1);\n const ready = readReady();\n return element(\n 'div',\n { class: 'metrics' },\n makeMetric('Components', String(components), '', `${scopes} scopes in the browser`),\n makeMetric('Page state', bytes, 'kB', 'records from the server'),\n makeMetric('Handlers run', String(handlers), '', `${calls} server calls`),\n ready\n ? makeMetric(\n 'Ready in',\n String(Math.round(ready.total)),\n 'ms',\n `server ${Math.round(ready.server)} · browser ${Math.round(ready.total - ready.server)}`,\n )\n : makeMetric('Open for', seconds(performance.now()), '', 'since the page started'),\n );\n}\n\n/** The state of the page by component, as one bar with a legend, and its largest values. */\nfunction drawState(state: DevtoolsState): {\n summary: (HTMLElement | string)[];\n values: (HTMLElement | string)[];\n} {\n const { slots } = readSlots(state);\n const first = document.querySelector('script[b-state][b-scopes]')?.textContent?.length ?? 0;\n const total = stateBytes();\n const byComponent = new Map<string, number>();\n for (const slot of slots) {\n byComponent.set(slot.component, (byComponent.get(slot.component) ?? 0) + slot.bytes);\n }\n const parts = [...byComponent].toSorted((a, b) => b[1] - a[1]);\n const stack = element('div', { class: 'sizes' });\n const legend = element('div', { class: 'legend' });\n for (const [index, [component, bytes]] of parts.entries()) {\n const color = SEGMENTS[index] ?? 'var(--faint)';\n if (index < SEGMENTS.length) {\n stack.append(element('span', { style: `flex: ${bytes}; background: ${color}` }));\n legend.append(key(color, `${known.get(component)?.name ?? component} ${kilobytes(bytes)}`));\n }\n }\n const table = element(\n 'table',\n { class: 'rows values' },\n row(['component', 'scope', 'value', 'copies', 'size', 'read by'], 'th'),\n );\n for (const entry of slots.slice(0, 200)) {\n const info = known.get(entry.component);\n const layout = info?.scopes[entry.k];\n const readers = layout?.readers?.[entry.slot] ?? [];\n const tr = element(\n 'tr',\n {},\n element('td', {}, info?.name ?? entry.component),\n element('td', { class: 'mono' }, layout?.label ?? String(entry.k)),\n element('td', { class: 'mono' }, layout?.slots[entry.slot] ?? `slot ${entry.slot}`),\n element('td', { class: 'mono' }, String(entry.count)),\n element('td', { class: 'mono', style: 'white-space: nowrap' }, kilobytes(entry.bytes)),\n element('td', { class: 'mono' }, readers.join(', ') || '—'),\n );\n for (const cell of tr.children) {\n cell.setAttribute('title', cell.textContent ?? '');\n }\n // A large value is worth a look: does the browser need all of it?\n if (entry.bytes > 1024) {\n tr.className = 'large';\n tr.title = 'More than 1 kB. Send only the fields that the browser reads.';\n }\n table.append(tr);\n }\n return {\n summary: [\n element(\n 'div',\n { class: 'sec' },\n 'Page state',\n element(\n 'span',\n { class: 'n' },\n `${kilobytes(total)}, the first record ${kilobytes(first)}`,\n ),\n ),\n slots.length > 0 ? stack : '',\n slots.length > 0 ? legend : '',\n slots.length > 0 ? '' : element('div', { class: 'empty' }, 'The page sent no state.'),\n ],\n values:\n slots.length > 0\n ? [\n element(\n 'div',\n { class: 'sec' },\n 'Values',\n element('span', { class: 'n' }, 'largest first'),\n ),\n element('div', { class: 'scroll-x' }, table),\n ]\n : [],\n };\n}\n\nfunction drawBlocks(ctx: DockContext): HTMLElement[] {\n const { state } = ctx;\n const blocks = [...state.blocks.values()];\n const list = element('div', { class: 'blocks' });\n for (const block of blocks) {\n const action = element('span', { class: 'go' });\n if (block.state === 'waiting' && (block.kind === 'defer' || block.kind === 'client')) {\n const fire = iconButton('bolt', 'Trigger now', { title: 'Fire the trigger now' });\n fire.addEventListener('click', () => {\n state.fire?.(block);\n ctx.draw();\n });\n action.append(fire);\n }\n // A body that the page swapped in, whose fallback it kept, can show its fallback again.\n const kept = (globalThis as { $bD?: Record<string, unknown> }).$bD?.[block.id];\n if (\n block.state === 'rendered' &&\n kept &&\n (block.kind === 'loading' || block.kind === 'defer')\n ) {\n const toggle = iconButton(\n block.fallback ? 'play' : 'pause',\n block.fallback ? 'Body' : 'Fallback',\n {\n title: block.fallback ? 'Show the body again' : 'Show the fallback in place of the body',\n 'aria-pressed': String(block.fallback === true),\n },\n );\n toggle.addEventListener('click', () => {\n state.showFallback?.(block, !block.fallback);\n ctx.draw();\n });\n action.append(toggle);\n }\n let took = '';\n if (block.rendered !== undefined) {\n took =\n block.fired === undefined\n ? seconds(block.rendered)\n : `+${ms(block.rendered - block.fired)}`;\n }\n const times: string[] = [];\n if (block.fired !== undefined) {\n times.push(seconds(block.fired));\n }\n if (took) {\n times.push(took);\n }\n list.append(\n element(\n 'div',\n { class: 'block-row' },\n element(\n 'span',\n { class: 'what' },\n pill(blockLabel(block), block.kind === '$client' ? 'blue' : 'accent'),\n element('span', { class: 'mono' }, block.id),\n element('span', { class: 'sub' }, block.trigger ?? ''),\n ),\n element(\n 'span',\n { class: 'state' },\n pill(block.state, STATE_COLORS[block.state]),\n times.join(' '),\n ),\n action,\n ),\n );\n }\n return [\n element(\n 'div',\n { class: 'sec' },\n 'Blocks',\n element('span', { class: 'n' }, String(blocks.length)),\n ),\n blocks.length > 0\n ? list\n : element('div', { class: 'empty' }, 'No blocks that render later on this page.'),\n ];\n}\n\nfunction drawEnvironment(ctx: DockContext): HTMLElement[] {\n const { state } = ctx;\n const issues = element('button', { class: 'btn' }, plural(state.errors.length, 'issue'));\n issues.addEventListener('click', () => ctx.select('issues', 'errors'));\n const activity = element('button', { class: 'btn' }, 'Activity');\n activity.addEventListener('click', () => ctx.select('activity', 'log'));\n return [\n element('div', { class: 'sec' }, 'Environment'),\n element(\n 'div',\n { class: 'env' },\n element('span', {}, 'brumate'),\n element('span', {}, state.meta.version ?? 'unknown'),\n element('span', {}, 'vite'),\n element('span', {}, state.meta.vite ?? 'unknown'),\n element('span', {}, 'route'),\n element('span', {}, location.pathname + location.search),\n element('span', {}, 'open for'),\n element('span', {}, seconds(performance.now())),\n ),\n element('div', { class: 'acts' }, issues, activity),\n ];\n}\n\nfunction plural(count: number, word: string): string {\n return `${count} ${word}${count === 1 ? '' : 's'}`;\n}\n\n/** Draws the whole workspace. The old tabs of the tab bar draw the same page. */\nexport function drawPage(ctx: DockContext, into: HTMLElement): void | Promise<void> {\n const { state } = ctx;\n // The styles go in the shadow root once, so they are not part of the text of the body.\n if (!ctx.root.querySelector('style[data-page]')) {\n ctx.root.append(element('style', { 'data-page': '' }, PAGE_STYLE));\n }\n const ids = [...collectModules(roots(state))];\n function render(): void {\n let scopes = 0;\n for (const scope of roots(state)) {\n scopes += countScopes(scope);\n }\n const shown = drawState(state);\n into.replaceChildren(\n element(\n 'div',\n { class: 'pg' },\n drawMetrics(state, ids.length, state.scopes?.size ?? scopes),\n element(\n 'div',\n { class: 'cols' },\n element('section', {}, ...shown.summary, ...drawBlocks(ctx), ...shown.values),\n element('section', {}, ...drawEnvironment(ctx)),\n ),\n ),\n );\n }\n render();\n // Names and the layout of the scopes come from the dev server, so the page draws again with them.\n let missing = false;\n for (const id of ids) {\n if (!known.has(id)) {\n missing = true;\n }\n }\n if (missing) {\n return loadComponents(state, ids).then(render);\n }\n}\n\nexport const page: Workspace = {\n id: 'page',\n label: 'Page',\n icon: 'overview',\n tabs: { overview: drawPage, state: drawPage, blocks: drawPage },\n draw: drawPage,\n};\n","// The search of the dock (Cmd+K): components, issues and actions in one list.\n\nimport type { Scope } from '../client.ts';\nimport { element, svg } from './dom.ts';\nimport { collectModules, known, loadComponents, roots } from './info.ts';\nimport type { DockContext } from './workspace.ts';\nimport { trustedHTML } from '../trusted.ts';\n\n/** One line of the list. */\nexport interface SearchItem {\n group: string;\n label: string;\n hint: string;\n run(): void;\n}\n\n/** The most lines of one group. */\nconst PER_GROUP = 6;\n\nexport interface Search {\n open(): void;\n close(): void;\n isOpen(): boolean;\n}\n\n/** The ID of the first instance of a component. */\nfunction firstScope(list: Scope[], id: string): Scope['id'] | undefined {\n for (const scope of list) {\n if (scope.m === id) {\n return scope.id;\n }\n }\n return undefined;\n}\n\n/** The lines for components and issues. The entry adds the actions. */\nexport function collectItems(ctx: DockContext): SearchItem[] {\n const { state, shell } = ctx;\n const items: SearchItem[] = [];\n const list = roots(state);\n for (const id of collectModules(list)) {\n const info = known.get(id);\n items.push({\n group: 'Components',\n label: info?.name ?? id,\n hint: info?.file ?? '',\n run() {\n shell.selected = id;\n shell.selectedScope = firstScope(list, id);\n shell.graphNode = undefined;\n ctx.select('inspect');\n },\n });\n }\n for (const entry of state.errors.toReversed()) {\n items.push({\n group: 'Issues',\n label: entry.message.split('\\n')[0]!,\n hint: entry.source,\n run() {\n shell.selectedError = entry;\n shell.selectedFrame = -1;\n ctx.select('issues');\n },\n });\n }\n return items;\n}\n\n/** Filters the lines by the query, at most a few of each group. */\nexport function filterItems(items: SearchItem[], query: string): SearchItem[] {\n const text = query.trim().toLowerCase();\n const counts = new Map<string, number>();\n const found: SearchItem[] = [];\n for (const item of items) {\n if (\n text &&\n !item.label.toLowerCase().includes(text) &&\n !item.hint.toLowerCase().includes(text)\n ) {\n continue;\n }\n const count = counts.get(item.group) ?? 0;\n if (count < PER_GROUP) {\n counts.set(item.group, count + 1);\n found.push(item);\n }\n }\n return found;\n}\n\n/** The search of a dock. `actions` gives the lines for what the dock can do. */\nexport function createSearch(ctx: DockContext, actions: () => SearchItem[]): Search {\n const { root } = ctx;\n let scrim: HTMLElement | undefined;\n let before: Element | null = null;\n\n function open(): void {\n if (scrim) {\n return;\n }\n before = root.activeElement;\n const magnifier = svg('svg', {\n viewBox: '0 0 24 24',\n width: 16,\n height: 16,\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': 2,\n 'stroke-linecap': 'round',\n 'aria-hidden': 'true',\n });\n magnifier.innerHTML = trustedHTML('<circle cx=\"11\" cy=\"11\" r=\"7\"/><path d=\"m20 20-3.5-3.5\"/>');\n const input = element('input', {\n type: 'text',\n role: 'combobox',\n 'aria-expanded': 'true',\n 'aria-controls': 'dock-search-list',\n 'aria-label': 'Search the dock',\n placeholder: 'Components, issues, actions',\n autocomplete: 'off',\n spellcheck: 'false',\n });\n const results = element('div', { class: 'res', role: 'listbox', id: 'dock-search-list' });\n const pal = element(\n 'div',\n { class: 'pal', role: 'dialog', 'aria-modal': 'true', 'aria-label': 'Search the dock' },\n element('div', { class: 'in' }, magnifier, input, element('kbd', {}, 'esc')),\n results,\n element(\n 'div',\n { class: 'end' },\n element('span', {}, element('kbd', {}, '↑'), element('kbd', {}, '↓'), ' move'),\n element('span', {}, element('kbd', {}, '↵'), ' open'),\n element('span', { class: 'grow' }),\n element('span', {}, `brumate ${ctx.state.meta.version ?? ''}`.trim()),\n ),\n );\n const layer = element('div', { class: 'scrim' }, pal);\n scrim = layer;\n\n let items = [...collectItems(ctx), ...actions()];\n let found: SearchItem[] = [];\n let hit = 0;\n\n function draw(): void {\n found = filterItems(items, input.value);\n hit = Math.max(0, Math.min(hit, found.length - 1));\n results.replaceChildren();\n if (found.length === 0) {\n results.append(element('div', { class: 'none' }, 'No match.'));\n input.removeAttribute('aria-activedescendant');\n return;\n }\n let group = '';\n for (const [index, item] of found.entries()) {\n if (item.group !== group) {\n group = item.group;\n results.append(element('div', { class: 'grp' }, group));\n }\n const line = element(\n 'div',\n {\n class: 'it',\n role: 'option',\n id: `dock-search-${index}`,\n 'aria-selected': String(index === hit),\n },\n element('span', {}, item.label),\n element('span', { class: 'h' }, item.hint),\n );\n line.addEventListener('click', () => choose(index));\n line.addEventListener('pointermove', () => {\n if (hit !== index) {\n hit = index;\n draw();\n }\n });\n results.append(line);\n }\n input.setAttribute('aria-activedescendant', `dock-search-${hit}`);\n results.querySelector('[aria-selected=\"true\"]')?.scrollIntoView?.({ block: 'nearest' });\n }\n function choose(index: number): void {\n const item = found[index];\n close(false);\n item?.run();\n }\n input.addEventListener('input', () => {\n hit = 0;\n draw();\n });\n input.addEventListener('keydown', (event) => {\n // The dock handles Escape too, and must not close with the search.\n if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n close(true);\n } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n hit = Math.max(0, Math.min(hit + (event.key === 'ArrowDown' ? 1 : -1), found.length - 1));\n draw();\n } else if (event.key === 'Enter') {\n event.preventDefault();\n choose(hit);\n }\n });\n // The search holds the focus: Tab stays in the field, as in a modal dialog.\n layer.addEventListener('keydown', (event) => {\n if (event.key === 'Tab') {\n event.preventDefault();\n input.focus();\n }\n });\n layer.addEventListener('pointerdown', (event) => {\n if (event.target === layer) {\n close(true);\n }\n });\n root.append(layer);\n draw();\n input.focus();\n // The names of components come from the dev server. The lines show again when they arrive.\n void loadComponents(ctx.state, collectModules(roots(ctx.state))).then(() => {\n if (scrim === layer) {\n items = [...collectItems(ctx), ...actions()];\n draw();\n }\n });\n }\n\n /** Closes the search. Focus goes back to where it was, unless a line moved it on. */\n function close(restore = true): void {\n scrim?.remove();\n scrim = undefined;\n if (restore && before instanceof HTMLElement && before.isConnected) {\n before.focus();\n }\n before = null;\n }\n\n return { open, close: () => close(true), isOpen: () => scrim !== undefined };\n}\n","// The chrome of the dock: the header with the version, the workspace nav and the tool buttons, the\n// edge that resizes the dock, and the footer. The entry draws the workspaces into `body`.\n\nimport { LOGO } from '../devtools.ts';\nimport type { DevtoolsState } from '../devtools.ts';\nimport { element, svg } from './dom.ts';\nimport { kilobytes, stateBytes } from './format.ts';\nimport { collectModules, countBlocks, roots } from './info.ts';\nimport type { Workspace, WorkspaceId } from './workspace.ts';\nimport { trustedHTML } from '../trusted.ts';\n\n/** The edge that the dock is attached to. */\nexport type Side = 'bottom' | 'right';\n\n/** The names of what the dock keeps for the next open. */\ntype Pref = 'height' | 'width' | 'side' | 'workspace';\n\nconst PREFS: Record<Pref, string> = {\n height: 'brumate:devtools:height',\n width: 'brumate:devtools:width',\n side: 'brumate:devtools:side',\n workspace: 'brumate:devtools:workspace',\n};\n\n/** The least and the greatest size of the dock, in pixels or as a share of the window. */\nexport const LIMITS = {\n height: { min: 160, share: 0.9 },\n width: { min: 340, share: 0.7 },\n};\n\n/** Reads what the dock kept, or nothing. */\nexport function readPref(name: Pref): string | undefined {\n try {\n return localStorage.getItem(PREFS[name]) ?? undefined;\n } catch {\n // Storage can be off. The default stays.\n return undefined;\n }\n}\n\n/** Keeps a choice for the next open. */\nexport function writePref(name: Pref, value: string): void {\n try {\n localStorage.setItem(PREFS[name], value);\n } catch {\n // Storage can be off.\n }\n}\n\n/** The strokes of the icons of the header, on a grid of 24. */\nconst GLYPHS = {\n inspect: '<path d=\"M4 6h16M4 12h10M4 18h6\"/>',\n activity: '<path d=\"M3 12h4l3-8 4 16 3-8h4\"/>',\n issues: '<circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M12 7v6M12 17h.01\"/>',\n page: '<rect x=\"4\" y=\"3\" width=\"16\" height=\"18\" rx=\"2\"/><path d=\"M8 8h8M8 12h8M8 16h5\"/>',\n search: '<circle cx=\"11\" cy=\"11\" r=\"7\"/><path d=\"m20 20-3.5-3.5\"/>',\n pick: '<path d=\"M4 4l7 17 2.5-7.5L21 11z\"/>',\n updates: '<rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"3\" stroke-dasharray=\"3 3\"/>',\n side: '<rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"M15 4v16\"/>',\n close: '<path d=\"M6 6l12 12M18 6 6 18\"/>',\n} as const;\n\nfunction glyph(name: keyof typeof GLYPHS, size: number): SVGElement {\n const node = svg('svg', {\n viewBox: '0 0 24 24',\n width: size,\n height: size,\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': 2,\n 'stroke-linecap': 'round',\n 'stroke-linejoin': 'round',\n 'aria-hidden': 'true',\n });\n node.innerHTML = trustedHTML(GLYPHS[name]);\n return node;\n}\n\nfunction toolButton(name: keyof typeof GLYPHS, label: string): HTMLButtonElement {\n return element('button', { class: 'tbtn', title: label, 'aria-label': label }, glyph(name, 15));\n}\n\n/** The parts of the chrome that the entry reads and draws into. */\nexport interface Chrome {\n panel: HTMLElement;\n edge: HTMLElement;\n /** Where the open workspace draws. */\n body: HTMLElement;\n tabs: Map<WorkspaceId, HTMLButtonElement>;\n counts: Map<WorkspaceId, HTMLElement>;\n indicator: HTMLElement;\n search: HTMLButtonElement;\n pick: HTMLButtonElement;\n updates: HTMLButtonElement;\n side: HTMLButtonElement;\n close: HTMLButtonElement;\n /** The parts of the footer that change. */\n live: HTMLElement;\n facts: { route: HTMLElement; components: HTMLElement; scopes: HTMLElement; size: HTMLElement };\n up: HTMLElement;\n}\n\n/** The chrome of a closed dock, with the nav of the workspaces. */\nexport function createChrome(state: DevtoolsState, workspaces: Workspace[]): Chrome {\n const tabs = new Map<WorkspaceId, HTMLButtonElement>();\n const counts = new Map<WorkspaceId, HTMLElement>();\n const indicator = element('span', { class: 'ind' });\n const nav = element(\n 'nav',\n { class: 'ws', role: 'tablist', 'aria-label': 'Workspaces' },\n indicator,\n );\n for (const workspace of workspaces) {\n const count = element('span', { class: workspace.id === 'issues' ? 'c red' : 'c' });\n const button = element(\n 'button',\n { role: 'tab', 'data-ws': workspace.id, title: workspace.label },\n glyph(workspace.id, 14),\n element('span', { class: 'l' }, workspace.label),\n count,\n );\n tabs.set(workspace.id, button);\n counts.set(workspace.id, count);\n nav.append(button);\n }\n\n const mark = element('i');\n mark.innerHTML = trustedHTML(LOGO);\n const vite = state.meta.vite ? ` · Vite ${state.meta.vite}` : '';\n const brand = element(\n 'div',\n { class: 'brand' },\n mark,\n element('b', {}, 'brumate'),\n element(\n 'span',\n { class: 'ver', title: `brumate ${state.meta.version ?? '?'}${vite}` },\n state.meta.version ?? '?',\n ),\n );\n\n const search = element(\n 'button',\n { class: 'cmd', 'aria-label': 'Search', title: 'Search (Cmd+K)' },\n glyph('search', 14),\n element('span', { class: 't' }, 'Search'),\n element('kbd', {}, '⌘K'),\n );\n const pick = toolButton('pick', 'Pick an element');\n pick.setAttribute('aria-pressed', 'false');\n pick.title = 'Click an element of the page to see its scope, handlers and code';\n const updates = toolButton('updates', 'Outline updates');\n updates.setAttribute('aria-pressed', String(state.flash));\n updates.title = 'Outline the elements that change: green now and then, red often';\n const side = toolButton('side', 'Dock to the right');\n side.setAttribute('aria-pressed', 'false');\n const close = toolButton('close', 'Close (Esc)');\n\n const live = element('span', { class: 'live' }, element('i'), 'live');\n const facts = {\n route: element('b'),\n components: element('b'),\n scopes: element('b'),\n size: element('b'),\n };\n const up = element('b');\n const viteFact = element('span', {});\n if (state.meta.vite) {\n viteFact.append('Vite ', element('b', {}, state.meta.vite));\n }\n const edge = element('div', {\n class: 'edge',\n role: 'separator',\n tabindex: '0',\n 'aria-label': 'Resize the dock',\n title: 'Drag, or use the arrow keys',\n });\n const body = element('div', { class: 'body' });\n const panel = element(\n 'section',\n { class: 'panel bottom', 'aria-label': 'brumate dev dock' },\n edge,\n element(\n 'header',\n { class: 'head' },\n brand,\n nav,\n element('span', { class: 'grow' }),\n search,\n pick,\n updates,\n side,\n close,\n ),\n body,\n element(\n 'footer',\n { class: 'foot' },\n live,\n element('span', {}, facts.route),\n element('span', {}, facts.components, ' components'),\n element('span', {}, facts.scopes, ' scopes'),\n element('span', {}, facts.size, ' page state'),\n element('span', { class: 'grow' }),\n viteFact,\n element('span', {}, 'up ', up),\n ),\n );\n return {\n panel,\n edge,\n body,\n tabs,\n counts,\n indicator,\n search,\n pick,\n updates,\n side,\n close,\n live,\n facts,\n up,\n };\n}\n\n/** Moves the highlight of the nav under the selected workspace. */\nexport function placeIndicator(chrome: Chrome, current: WorkspaceId): void {\n const button = chrome.tabs.get(current)!;\n chrome.indicator.style.left = `${button.offsetLeft}px`;\n chrome.indicator.style.width = `${button.offsetWidth}px`;\n}\n\n/** Sets the side of the dock, with the label of the button that switches it. */\nexport function applySide(chrome: Chrome, side: Side): void {\n chrome.panel.classList.toggle('bottom', side === 'bottom');\n chrome.panel.classList.toggle('right', side === 'right');\n chrome.side.setAttribute('aria-pressed', String(side === 'right'));\n const label = side === 'right' ? 'Dock to the bottom' : 'Dock to the right';\n chrome.side.title = label;\n chrome.side.setAttribute('aria-label', label);\n}\n\n/** The selected workspace, the counts of the nav and the footer. */\nexport function drawChrome(\n chrome: Chrome,\n state: DevtoolsState,\n current: WorkspaceId,\n paused: boolean,\n): void {\n for (const [id, button] of chrome.tabs) {\n button.setAttribute('aria-selected', String(id === current));\n button.tabIndex = id === current ? 0 : -1;\n }\n placeIndicator(chrome, current);\n const errors = state.errors.length;\n const entries = state.log.length;\n chrome.counts.get('activity')!.textContent = entries > 0 ? String(entries) : '';\n chrome.counts.get('issues')!.textContent = errors > 0 ? String(errors) : '';\n chrome.tabs\n .get('issues')!\n .setAttribute('aria-label', errors > 0 ? `Issues, ${errors}` : 'Issues');\n\n const list = roots(state);\n chrome.live.classList.toggle('paused', paused);\n chrome.live.lastChild!.textContent = paused ? 'paused' : 'live';\n chrome.facts.route.textContent = location.pathname + location.search;\n chrome.facts.components.textContent = String(collectModules(list).size);\n chrome.facts.scopes.textContent = String(state.scopes?.size ?? 0);\n chrome.facts.size.textContent = kilobytes(stateBytes());\n // Blocks that wait for their trigger show on the title of the page entry of the nav.\n const waiting = countBlocks(state.blocks.values(), 'waiting');\n chrome.tabs.get('page')!.title =\n waiting > 0 ? `Page · ${waiting} blocks wait for their trigger` : 'Page';\n chrome.up.textContent = `${Math.round(performance.now() / 1000)} s`;\n}\n","// The styles of the dock, inside its shadow root.\n\nexport const STYLE = `\n:host { all: initial; }\n.panel {\n --bg: #121113; --bg2: #161517; --surface: #161517; --raised: #1d1c1f; --hover: #232125;\n --line: #29272b; --line2: #36333a;\n --text: #ece8e4; --dim: #a39a92; --faint: #6f6862;\n --accent: #ee7a3e; --accent-text: #ffb48a; --sel: #ee7a3e14; --ring: #ee7a3e47;\n --blue: #7cb7ff; --purple: #c49bff; --green: #7fd99a; --yellow: #ffd166; --red: #ff6b6b; --pink: #ff8fc8;\n --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, monospace;\n --ease: cubic-bezier(.2, .8, .2, 1);\n position: fixed; z-index: 2147483647; display: flex; flex-direction: column;\n background: var(--bg); color: var(--text); transition: transform 0.26s var(--ease);\n font: 12.5px/1.5 system-ui, -apple-system, sans-serif; font-variant-numeric: tabular-nums;\n -webkit-font-smoothing: antialiased; color-scheme: dark;\n}\n.panel.bottom { left: 0; right: 0; bottom: 0; height: var(--h, 340px); min-height: 160px; max-height: 90vh; box-shadow: 0 -1px 0 var(--line2), 0 -24px 48px -24px #0009; }\n.panel.right { top: 0; right: 0; bottom: 0; width: var(--w, 480px); min-width: 340px; max-width: 70vw; box-shadow: -1px 0 0 var(--line2), -24px 0 48px -24px #0009; }\n.panel.closed { transform: translateY(100%); pointer-events: none; }\n.panel.right.closed { transform: translateX(100%); }\n.panel.dragging { transition: none; }\n.edge { position: absolute; z-index: 2; touch-action: none; }\n.panel.bottom .edge { left: 0; right: 0; top: -3px; height: 7px; cursor: ns-resize; }\n.panel.right .edge { top: 0; bottom: 0; left: -3px; width: 7px; cursor: ew-resize; }\n.edge::after { content: \"\"; position: absolute; inset: 3px 0; background: var(--accent); opacity: 0; transition: opacity 0.15s; }\n.panel.right .edge::after { inset: 0 3px; }\n.edge:hover::after, .panel.dragging .edge::after { opacity: 0.7; }\n.edge:focus-visible { outline: none; }\n.edge:focus-visible::after { opacity: 1; }\n.head { display: flex; align-items: center; gap: 4px; height: 42px; padding: 0 8px 0 12px; border-bottom: 1px solid var(--line); flex: none; }\n.brand { display: flex; align-items: center; gap: 8px; padding-right: 12px; margin-right: 4px; height: 20px; border-right: 1px solid var(--line); }\n.brand i { display: inline-block; width: 16px; height: 16px; }\n.brand b { font-weight: 600; letter-spacing: -0.01em; }\n.ver { font: 11px/18px var(--mono); padding: 0 6px; border-radius: 5px; background: var(--hover); color: var(--dim); }\n.ws { position: relative; display: flex; gap: 2px; }\n.ws button { position: relative; z-index: 1; display: flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 7px; border: 0; color: var(--dim); font-weight: 500; transition: color 0.15s; }\n.ws button:hover { background: none; color: var(--text); }\n.ws button[aria-selected=\"true\"] { color: var(--text); }\n.ws .ind { position: absolute; top: 0; left: 0; width: 0; height: 28px; border-radius: 7px; background: var(--hover); box-shadow: inset 0 0 0 1px var(--line2); transition: left 0.25s var(--ease), width 0.25s var(--ease); }\n.ws .c { font: 10.5px/16px var(--mono); color: var(--faint); }\n.ws .c:empty { display: none; }\n.ws .c.red { color: var(--red); }\n.grow { flex: 1; }\n.head button.cmd { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 5px 0 10px; width: 220px; border: 0; border-radius: 8px; background: var(--bg2); box-shadow: inset 0 0 0 1px var(--line); color: var(--faint); margin-right: 4px; transition: box-shadow 0.15s, color 0.15s; }\n.head button.cmd:hover { box-shadow: inset 0 0 0 1px var(--line2); color: var(--dim); }\n.cmd .t { flex: 1; text-align: left; }\nkbd { font: 10.5px/18px var(--mono); min-width: 18px; text-align: center; padding: 0 4px; border-radius: 5px; background: var(--hover); color: var(--dim); }\n.head button.tbtn { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px; color: var(--dim); transition: background 0.15s, color 0.15s; }\n.head button.tbtn:hover { background: var(--hover); color: var(--text); }\n.head button.tbtn[aria-pressed=\"true\"] { background: var(--sel); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--ring); }\n.panel.right .cmd { width: 28px; padding: 0; justify-content: center; }\n.panel.right .cmd .t, .panel.right .cmd kbd, .panel.right .ws .l, .panel.right .brand b { display: none; }\n.foot { display: flex; align-items: center; gap: 16px; height: 26px; padding: 0 14px; border-top: 1px solid var(--line); color: var(--faint); font: 11px var(--mono); flex: none; overflow: hidden; white-space: nowrap; }\n.foot b { color: var(--dim); font-weight: 400; }\n.panel.right .foot span:nth-child(n+4):not(:last-child) { display: none; }\n.live { display: inline-flex; align-items: center; gap: 6px; }\n.live i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }\n.live.paused i { background: var(--faint); }\n.scrim { position: fixed; inset: 0; z-index: 2147483647; display: grid; place-items: start center; padding-top: 14vh; background: #0a090b99; backdrop-filter: blur(2px); animation: fade 0.15s ease-out; }\n@keyframes fade { from { opacity: 0; } }\n@keyframes rise { from { transform: translateY(8px) scale(0.985); opacity: 0; } }\n.pal { --bg: #121113; --raised: #1d1c1f; --hover: #232125; --line: #29272b; --line2: #36333a; --text: #ece8e4; --dim: #a39a92; --faint: #6f6862; --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, monospace; width: min(580px, calc(100vw - 32px)); background: var(--bg); color: var(--text); border-radius: 14px; box-shadow: 0 0 0 1px var(--line2), 0 30px 80px #000c; overflow: hidden; font: 12.5px/1.5 system-ui, -apple-system, sans-serif; color-scheme: dark; animation: rise 0.2s var(--ease, ease-out); }\n.pal .in { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 50px; border-bottom: 1px solid var(--line); color: var(--faint); }\n.pal input { flex: 1; min-width: 0; background: none; border: 0; font: 15px system-ui, -apple-system, sans-serif; color: var(--text); outline: none; }\n.pal .res { max-height: 340px; overflow: auto; padding: 6px; }\n.pal .grp { padding: 10px 10px 4px; font-size: 11px; font-weight: 600; color: var(--faint); }\n.pal .it { display: flex; gap: 10px; align-items: center; height: 36px; padding: 0 10px; border-radius: 8px; cursor: pointer; }\n.pal .it[aria-selected=\"true\"] { background: var(--hover); }\n.pal .it .h { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 11px var(--mono); color: var(--faint); }\n.pal .none { padding: 14px 10px; color: var(--faint); }\n.pal .end { display: flex; gap: 16px; align-items: center; padding: 0 14px; height: 36px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11px; }\n.pal .end span { display: inline-flex; gap: 6px; align-items: center; }\n.pal .end .grow { flex: 1; }\n@media (prefers-reduced-motion: reduce) { .panel, .ws .ind, .scrim, .pal { transition: none; animation: none; } }\n.spacer { flex: 1; }\nbutton, select, input { font: inherit; color: inherit; }\nbutton { background: none; border: 1px solid transparent; border-radius: 6px; padding: 2px 8px; cursor: pointer; }\nbutton:hover { background: var(--hover); }\nbutton:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }\n.pal input:focus-visible { outline: none; }\nbutton.tool { display: inline-flex; align-items: center; gap: 6px; border-color: var(--line); background: var(--surface); }\nbutton.tool .icon { color: var(--dim); flex: none; }\nbutton.tool:hover .icon { color: var(--text); }\nbutton.tool.only { padding: 3px 5px; }\n.link { display: inline-flex; align-items: center; gap: 4px; }\n.link .icon { opacity: 0.7; }\nbutton.tool[aria-pressed=\"true\"] { border-color: var(--accent); background: #ee7a3e22; color: #ffb48a; }\nselect, input[type=\"search\"] { background: var(--raised); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }\n.icon { flex: none; }\n.code { margin: 6px 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #0d1117; overflow: auto; }\n.code .twinkleplop { margin: 0; padding: 8px 0; font: 12px/1.6 var(--mono); background: none; white-space: normal; }\n.code .l { display: block; padding: 0 12px 0 0; white-space: pre; min-height: 1.6em; }\n.code .ln { display: inline-block; width: 44px; padding-right: 12px; text-align: right; color: var(--faint); user-select: none; }\n.code .l.error-line { background: #e5484d24; }\n.code .l.error-line .ln { color: var(--red); }\n.code .error-mark { text-decoration: wavy underline #e5484d; text-underline-offset: 3px; }\n.code pre.plain { margin: 0; padding: 8px 12px; font: 12px/1.6 var(--mono); white-space: pre; }\n.frames { display: flex; flex-direction: column; gap: 1px; }\n.frame { display: flex; gap: 10px; width: 100%; text-align: left; padding: 3px 8px; border-radius: 5px; font: 11.5px var(--mono); }\n.frame .fn { color: var(--text); white-space: nowrap; }\n.frame .where { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.frame.library .fn, .frame.library .where { color: var(--faint); }\n.frame[aria-current=\"true\"] { background: #ee7a3e14; box-shadow: 0 0 0 1px #ee7a3e40; }\n.frame[aria-current=\"true\"] .fn { color: #ffb48a; }\n.body { flex: 1; overflow: auto; padding: 12px 14px; min-width: 0; min-height: 0; }\n.split { display: flex; height: calc(100% + 24px); margin: -12px -14px; }\n.split > .list { width: 280px; flex: none; overflow: auto; border-right: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 1px; }\n.split > .list input { margin-bottom: 6px; }\n.split > .detail { flex: 1; overflow: auto; padding: 12px 14px; min-width: 0; }\nh2 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }\nh3 { margin: 14px 0 6px; font-size: 11px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; }\n.sub { color: var(--dim); font-weight: 400; }\n.mono { font-family: var(--mono); }\n.empty { color: var(--faint); padding: 16px 0; }\n.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }\n.card { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }\n.card .label { color: var(--dim); font-size: 11px; }\n.card .value { font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }\n.card .note { color: var(--faint); font-size: 11px; }\n.rows { width: 100%; border-collapse: collapse; }\n.rows th { text-align: left; color: var(--faint); font-weight: 500; font-size: 11px; }\n.rows td, .rows th { padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }\n.rows tr:hover td { background: #ffffff05; }\ntr.large td { color: var(--yellow); }\n.pill { display: inline-block; padding: 0 7px; border-radius: 999px; font: 11px/18px var(--mono); background: var(--raised); color: var(--dim); white-space: nowrap; }\n.pill.blue { background: #7cb7ff1f; color: var(--blue); } .pill.purple { background: #c49bff1f; color: var(--purple); }\n.pill.green { background: #7fd99a1f; color: var(--green); } .pill.yellow { background: #ffd1661f; color: var(--yellow); }\n.pill.red { background: #ff7a7a1f; color: var(--red); } .pill.accent { background: #ee7a3e22; color: #ffb48a; }\n.pill .name { color: #ffc28f; }\n.link { color: var(--blue); padding: 0; border: 0; font-family: var(--mono); text-align: left; }\n.link:hover { background: none; text-decoration: underline; }\n.legend { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; color: var(--dim); }\n.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }\n.inspect-card { position: fixed; z-index: 2147483647; display: flex; flex-direction: column; gap: 5px; max-width: 340px; padding: 9px 11px; border: 1px solid var(--line, #2f2c31); border-radius: 10px; background: #19181aee; color: #ece8e4; font: 12px/1.4 system-ui, -apple-system, sans-serif; box-shadow: 0 10px 28px #0008; pointer-events: none; backdrop-filter: blur(6px); }\n.inspect-card .card-head { display: flex; justify-content: space-between; gap: 12px; color: #ffb48a; }\n.inspect-card .card-component { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }\n.inspect-card .card-pills { display: flex; flex-wrap: wrap; gap: 4px; }\n.inspect-card .card-hint { margin-top: 2px; padding-top: 6px; border-top: 1px solid #2f2c31; color: #6f6862; font-size: 11px; }\n.outline { position: fixed; pointer-events: none; border: 2px solid #ee7a3e; background: #ee7a3e22; border-radius: 3px; z-index: 2147483646; }\n`;\n","// The split of a workspace: two panes with a handle between them. The first column keeps the size\n// that the handle sets and the second takes the rest. The size is kept per split and dock side.\n\nimport { element } from './dom.ts';\nimport type { Columns, DockContext, SplitOptions } from './workspace.ts';\n\nconst STYLE = `\n.split > .handle { position: relative; flex: none; width: 0; z-index: 3; touch-action: none; outline: none; cursor: col-resize; }\n.split > .handle::before { content: \"\"; position: absolute; top: 0; bottom: 0; left: -4px; width: 9px; }\n.split > .handle::after { content: \"\"; position: absolute; top: 0; bottom: 0; left: -0.5px; width: 1px; background: var(--accent); opacity: 0; transition: opacity .15s, width .15s; border-radius: 2px; }\n.split > .handle i { position: absolute; top: 50%; left: 0; width: 4px; height: 28px; border-radius: 3px; background: var(--accent); opacity: 0; transform: translate(-50%, -50%); transition: opacity .15s; }\n.split > .handle:hover::after, .split > .handle.on::after { opacity: .7; }\n.split > .handle:hover i, .split > .handle.on i { opacity: 1; }\n.split > .handle:focus-visible::after { opacity: 1; width: 2px; left: -1px; }\n.split > .handle:focus-visible i { opacity: 1; }\n.split.stack { flex-direction: column; }\n.split.stack > .list { width: auto; border-right: 0; border-bottom: 1px solid var(--line); }\n.split.stack > .handle { width: auto; height: 0; cursor: row-resize; }\n.split.stack > .handle::before { top: -4px; bottom: auto; left: 0; right: 0; width: auto; height: 9px; }\n.split.stack > .handle::after { top: -0.5px; bottom: auto; left: 0; right: 0; width: auto; height: 1px; }\n.split.stack > .handle i { top: 0; left: 50%; width: 28px; height: 4px; transform: translate(-50%, -50%); }\n.split.stack > .handle:focus-visible::after { width: auto; height: 2px; top: -1px; left: 0; }\n@media (prefers-reduced-motion: reduce) { .split > .handle::after, .split > .handle i { transition: none; } }\n`;\n\n/** The step of an arrow key, and of an arrow key with Shift, in pixels. */\nconst STEP = 16;\nconst BIG_STEP = 64;\n\nfunction storeName(key: string, side: string): string {\n return `brumate:devtools:split:${key}:${side}`;\n}\n\nfunction readSize(name: string): number | undefined {\n try {\n const value = Number(localStorage.getItem(name));\n return Number.isFinite(value) && value > 0 ? value : undefined;\n } catch {\n // Storage can be off. The start size stays.\n return undefined;\n }\n}\n\nfunction writeSize(name: string, size: number | undefined): void {\n try {\n if (size === undefined) {\n localStorage.removeItem(name);\n } else {\n localStorage.setItem(name, String(size));\n }\n } catch {\n // Storage can be off.\n }\n}\n\n/** Makes the `split` of a dock context. The sizes are kept for the side the dock has when it is drawn. */\nexport function createSplit(root: ShadowRoot): DockContext['split'] {\n return function split({ key, min, start }: SplitOptions): Columns {\n // The styles go in the shadow root once.\n if (!root.querySelector('style[data-split]')) {\n root.append(element('style', { 'data-split': '' }, STYLE));\n }\n const side = root.querySelector('.panel.right') ? 'right' : 'bottom';\n // A dock on the right is narrow, so the panes stack and the handle is horizontal.\n const stacked = side === 'right';\n const name = storeName(key, side);\n\n const first = element('div', { class: 'list' });\n const second = element('div', { class: 'detail' });\n const grab = element('i');\n const handle = element(\n 'div',\n {\n class: 'handle',\n role: 'separator',\n tabindex: '0',\n 'aria-orientation': stacked ? 'horizontal' : 'vertical',\n 'aria-label': 'Resize the panels',\n title: 'Drag, or use the arrow keys. Double-click to reset.',\n },\n grab,\n );\n const box = element('div', { class: stacked ? 'split stack' : 'split' }, first, handle, second);\n // The browser holds the minimums at any width. The size below follows them.\n const [low, high] = stacked\n ? (['minHeight', 'maxHeight'] as const)\n : (['minWidth', 'maxWidth'] as const);\n first.style[low] = `${min[0]}px`;\n first.style[high] = `calc(100% - ${min[1]}px)`;\n second.style[low] = `${min[1]}px`;\n if (stacked) {\n first.style.width = 'auto';\n }\n\n // The greatest size of the first side. Before the box has a width there is no limit.\n function most(): number {\n const total = stacked ? box.clientHeight : box.clientWidth;\n return total > 0 ? Math.max(min[0], total - min[1]) : Infinity;\n }\n function clamp(size: number): number {\n return Math.round(Math.min(most(), Math.max(min[0], size)));\n }\n\n let size = clamp(readSize(name) ?? start);\n function apply(next: number): void {\n size = clamp(next);\n first.style[stacked ? 'height' : 'width'] = `${size}px`;\n handle.setAttribute('aria-valuenow', String(size));\n handle.setAttribute('aria-valuemin', String(min[0]));\n if (most() !== Infinity) {\n handle.setAttribute('aria-valuemax', String(most()));\n }\n }\n apply(size);\n\n // A resized dock moves the greatest size.\n if (typeof ResizeObserver === 'function') {\n new ResizeObserver(() => apply(size)).observe(box);\n }\n\n let from: { x: number; size: number } | undefined;\n function end(event: PointerEvent): void {\n if (!from) {\n return;\n }\n from = undefined;\n handle.classList.remove('on');\n if (handle.hasPointerCapture(event.pointerId)) {\n handle.releasePointerCapture(event.pointerId);\n }\n writeSize(name, size);\n }\n handle.addEventListener('pointerdown', (event) => {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n // The capture sends every move and the release here, also outside the dock.\n handle.setPointerCapture(event.pointerId);\n handle.focus();\n handle.classList.add('on');\n // The box may have had no width when the size was set.\n size = clamp(size);\n from = { x: stacked ? event.clientY : event.clientX, size };\n });\n handle.addEventListener('pointermove', (event) => {\n if (from) {\n apply(from.size + (stacked ? event.clientY : event.clientX) - from.x);\n }\n });\n handle.addEventListener('pointerup', end);\n handle.addEventListener('pointercancel', end);\n handle.addEventListener('dblclick', () => {\n apply(start);\n writeSize(name, undefined);\n });\n handle.addEventListener('keydown', (event) => {\n const step = event.shiftKey ? BIG_STEP : STEP;\n size = clamp(size);\n let next: number;\n if (event.key === (stacked ? 'ArrowDown' : 'ArrowRight')) {\n next = size + step;\n } else if (event.key === (stacked ? 'ArrowUp' : 'ArrowLeft')) {\n next = size - step;\n } else if (event.key === 'Home') {\n next = min[0];\n } else if (event.key === 'End') {\n next = most();\n } else {\n return;\n }\n event.preventDefault();\n apply(next === Infinity ? size : next);\n writeSize(name, size);\n });\n\n return { box, first, second };\n };\n}\n","// The dock of the devtools overlay. It reads the core through the hooks in `devtools.ts`, and asks\n// the dev server about each component. It attaches to the bottom or the right edge of the page.\n//\n// This file is the entry: it opens and closes the dock, keeps its side and size, and holds Pick,\n// the keys and the draw loop. The chrome is in `devtools-panel/shell.ts`, the search in\n// `devtools-panel/search.ts`, and each workspace draws itself:\n//\n// - Inspect (`inspect.ts`): the components, their values and their graph.\n// - Activity (`activity.ts`): the log, the timeline and the server calls.\n// - Issues (`issues.ts`): the errors.\n// - Page (`page.ts`): the page, its state and its blocks.\n\nimport type { ScopeId } from './shared.ts';\nimport { findRootScope } from './devtools.ts';\nimport type { DevtoolsState } from './devtools.ts';\nimport { activity } from './devtools-panel/activity.ts';\nimport { drawCallDetail } from './devtools-panel/call-detail.ts';\nimport { element, pill } from './devtools-panel/dom.ts';\nimport { drawGraph } from './devtools-panel/graph.ts';\nimport { drawReads, findAnchor, findScope } from './devtools-panel/info.ts';\nimport { inspect } from './devtools-panel/inspect.ts';\nimport { issues } from './devtools-panel/issues.ts';\nimport { page } from './devtools-panel/page.ts';\nimport { createSearch } from './devtools-panel/search.ts';\nimport type { SearchItem } from './devtools-panel/search.ts';\nimport {\n LIMITS,\n applySide,\n createChrome,\n drawChrome,\n placeIndicator,\n readPref,\n writePref,\n} from './devtools-panel/shell.ts';\nimport type { Side } from './devtools-panel/shell.ts';\nimport { STYLE } from './devtools-panel/style.ts';\nimport { createSplit } from './devtools-panel/split.ts';\nimport { createShell } from './devtools-panel/workspace.ts';\nimport type { DockContext, Shell, Tab, Workspace } from './devtools-panel/workspace.ts';\n\nexport { layoutGraph } from './devtools-panel/graph.ts';\n\n/** The workspaces, in the order of the nav. */\nconst WORKSPACES: Workspace[] = [inspect, activity, issues, page];\n\n/** The workspace with an ID. */\nfunction findWorkspaceById(id: string | undefined): Workspace | undefined {\n for (const workspace of WORKSPACES) {\n if (workspace.id === id) {\n return workspace;\n }\n }\n return undefined;\n}\n\n/** The workspace that holds a tab. */\nfunction findWorkspace(tab: Tab): Workspace {\n for (const workspace of WORKSPACES) {\n if (tab in workspace.tabs) {\n return workspace;\n }\n }\n return WORKSPACES[0]!;\n}\n\n/** The state of the open panel, or nothing when it is closed. */\nlet docked: Shell | undefined;\n/** What closes the open dock, or reopens it while it slides out. */\nlet leave: { close(): void; reopen(): void } | undefined;\n/** True while the dock slides out. */\nlet closing = false;\n\n/** Opens the dock on a tab, or switches to it when the dock is open. Without a tab, it opens on the last workspace. */\nexport function openPanel(root: ShadowRoot, state: DevtoolsState, tab?: string): void {\n if (docked?.panel) {\n if (closing) {\n leave?.reopen();\n }\n if (tab) {\n docked.showTab?.(tab as Tab);\n }\n } else {\n togglePanel(root, state, tab as Tab | undefined);\n }\n}\n\n/** The first tab of a workspace, which the nav opens it on. */\nfunction defaultTab(workspace: Workspace): Tab {\n return Object.keys(workspace.tabs)[0] as Tab;\n}\n\n/** True on macOS, where Ctrl+K is not the key of the search. */\nfunction isMac(): boolean {\n return /Mac|iPhone|iPad/.test(navigator.platform);\n}\n\n/** Keeps a size between its least and its greatest. */\nfunction clamp(size: number, min: number, max: number): number {\n return Math.min(Math.max(size, min), max);\n}\n\n/** Opens the dock, or closes it when it is open. */\nexport function togglePanel(root: ShadowRoot, state: DevtoolsState, initial?: Tab): void {\n const opener = root.querySelector<HTMLElement>('button.open');\n if (docked?.panel) {\n // The dock slides out, and a second toggle while it does slides it back in.\n if (closing) {\n leave?.reopen();\n } else {\n leave?.close();\n }\n return;\n }\n const remembered = findWorkspaceById(readPref('workspace')) ?? WORKSPACES[0]!;\n const shell = createShell(initial ?? defaultTab(remembered));\n const chrome = createChrome(state, WORKSPACES);\n const { panel, body, pick } = chrome;\n shell.panel = panel;\n panel.prepend(element('style', {}, STYLE));\n\n let side: Side = readPref('side') === 'right' ? 'right' : 'bottom';\n let height = Number(readPref('height')) || 340;\n let width = Number(readPref('width')) || 480;\n // The page of an error of the server has nothing else to show.\n const errorPage = document.getElementById('brumate-error') !== null;\n if (errorPage) {\n side = 'bottom';\n height = window.innerHeight;\n }\n\n const ctx: DockContext = {\n root,\n state,\n shell,\n draw,\n select,\n split: createSplit(root),\n outline,\n pick: () => pick.click(),\n drawGraph: (scope, info) => drawGraph(ctx, scope, info),\n drawCallDetail: (entry) => drawCallDetail(ctx, entry),\n };\n\n // The page can scroll past the dock.\n function applySize(): void {\n panel.style.setProperty('--h', `${height}px`);\n panel.style.setProperty('--w', `${width}px`);\n if (errorPage) {\n panel.style.maxHeight = 'none';\n }\n document.documentElement.style.paddingBottom = side === 'bottom' ? `${height}px` : '';\n document.documentElement.style.paddingRight = side === 'right' ? `${width}px` : '';\n }\n function keepSize(): void {\n if (!errorPage) {\n writePref('height', String(Math.round(height)));\n }\n writePref('width', String(Math.round(width)));\n }\n function moveEdge(clientX: number, clientY: number): void {\n if (side === 'bottom') {\n height = clamp(\n window.innerHeight - clientY,\n LIMITS.height.min,\n window.innerHeight * LIMITS.height.share,\n );\n } else {\n width = clamp(\n window.innerWidth - clientX,\n LIMITS.width.min,\n window.innerWidth * LIMITS.width.share,\n );\n }\n applySize();\n }\n docked = shell;\n applySide(chrome, side);\n applySize();\n drawEdge();\n // The dock slides in from its edge.\n panel.classList.add('closed');\n root.append(panel);\n void panel.offsetHeight;\n panel.classList.remove('closed');\n // The grip hides while the dock is open. Close, Escape or Alt+Shift+D closes it.\n if (opener) {\n opener.hidden = true;\n }\n // The grip of the closed dock drags the dock open under the pointer.\n state.resize = (clientY) => {\n if (side === 'bottom') {\n moveEdge(0, clientY);\n }\n };\n state.resized = () => {\n keepSize();\n ctx.draw();\n };\n // The listeners of a drag that is under way, so closing mid-drag leaves none.\n let endDrag: (() => void) | undefined;\n chrome.edge.addEventListener('pointerdown', (event) => {\n event.preventDefault();\n endDrag?.();\n panel.classList.add('dragging');\n // oxlint-disable-next-line unicorn/consistent-function-scoping -- It resizes this dock.\n function move(next: PointerEvent): void {\n moveEdge(next.clientX, next.clientY);\n }\n function up(): void {\n endDrag?.();\n state.resized?.();\n }\n endDrag = (): void => {\n window.removeEventListener('pointermove', move);\n window.removeEventListener('pointerup', up);\n panel.classList.remove('dragging');\n endDrag = undefined;\n };\n window.addEventListener('pointermove', move);\n window.addEventListener('pointerup', up);\n });\n // The arrow keys move the edge, 16 pixels at a time, or 64 with Shift.\n chrome.edge.addEventListener('keydown', (event) => {\n const grow = side === 'bottom' ? 'ArrowUp' : 'ArrowLeft';\n const shrink = side === 'bottom' ? 'ArrowDown' : 'ArrowRight';\n if (event.key !== grow && event.key !== shrink) {\n return;\n }\n event.preventDefault();\n const step = (event.shiftKey ? 64 : 16) * (event.key === grow ? 1 : -1);\n if (side === 'bottom') {\n moveEdge(0, window.innerHeight - (height + step));\n } else {\n moveEdge(window.innerWidth - (width + step), 0);\n }\n drawEdge();\n // Keeps the size and draws the workspaces again, as the end of a drag does.\n state.resized?.();\n });\n function drawEdge(): void {\n chrome.edge.setAttribute('aria-orientation', side === 'bottom' ? 'horizontal' : 'vertical');\n chrome.edge.setAttribute(\n 'aria-valuenow',\n String(Math.round(side === 'bottom' ? height : width)),\n );\n }\n chrome.side.addEventListener('click', () => {\n side = side === 'bottom' ? 'right' : 'bottom';\n writePref('side', side);\n applySide(chrome, side);\n applySize();\n drawEdge();\n ctx.draw();\n });\n chrome.close.addEventListener('click', () => togglePanel(root, state));\n chrome.updates.addEventListener('click', () => {\n state.setFlash?.(!state.flash);\n chrome.updates.setAttribute('aria-pressed', String(state.flash));\n });\n for (const [id, button] of chrome.tabs) {\n button.addEventListener('click', () => {\n if (findWorkspace(shell.tab).id !== id) {\n select(id);\n }\n });\n }\n // The arrow keys move along the nav, as a tab list does.\n chrome.tabs.get(WORKSPACES[0]!.id)!.parentElement!.addEventListener('keydown', (event) => {\n const step = { ArrowRight: 1, ArrowLeft: -1 }[(event as KeyboardEvent).key];\n if (!step) {\n return;\n }\n event.preventDefault();\n let at = 0;\n for (const [index, item] of WORKSPACES.entries()) {\n if (item === findWorkspace(shell.tab)) {\n at = index;\n }\n }\n const next = WORKSPACES[(at + step + WORKSPACES.length) % WORKSPACES.length]!;\n select(next.id);\n chrome.tabs.get(next.id)!.focus();\n });\n window.addEventListener('resize', placeNav);\n function placeNav(): void {\n placeIndicator(chrome, findWorkspace(shell.tab).id);\n }\n\n // Search (Cmd+K) lists the components, the issues and what the dock can do.\n const search = createSearch(ctx, listActions);\n chrome.search.addEventListener('click', () => search.open());\n function listActions(): SearchItem[] {\n const items: SearchItem[] = [\n { group: 'Actions', label: 'Pick an element', hint: '', run: () => ctx.pick() },\n {\n group: 'Actions',\n label: side === 'right' ? 'Dock to the bottom' : 'Dock to the right',\n hint: '',\n run: () => chrome.side.click(),\n },\n {\n group: 'Actions',\n label: state.flash ? 'Stop outlining updates' : 'Outline updates',\n hint: '',\n run: () => chrome.updates.click(),\n },\n ];\n for (const item of WORKSPACES) {\n items.push({\n group: 'Actions',\n label: `Open ${item.label}`,\n hint: '',\n run: () => select(item.id),\n });\n }\n return items;\n }\n // Cmd+K opens the search and Escape closes the dock, unless Pick, the search, or a field\n // that is being typed in, takes the key first.\n function onKey(event: KeyboardEvent): void {\n const target = event.composedPath()[0];\n const typing =\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement ||\n (target instanceof HTMLElement && target.isContentEditable);\n if (event.key.toLowerCase() === 'k' && !event.altKey) {\n // Cmd+K always. Ctrl+K is the search off macOS only, and not in a field of the page.\n const ctrl = event.ctrlKey && !isMac() && !(typing && !root.contains(target as Node));\n if (event.metaKey || ctrl) {\n event.preventDefault();\n search.open();\n return;\n }\n }\n if (event.key !== 'Escape' || event.defaultPrevented || search.isOpen() || typing) {\n return;\n }\n if (closing) {\n return;\n }\n togglePanel(root, state);\n }\n window.addEventListener('keydown', onKey);\n const clock = setInterval(() => {\n chrome.up.textContent = `${Math.round(performance.now() / 1000)} s`;\n }, 1000);\n let timer: ReturnType<typeof setTimeout> | undefined;\n // The dock leaves for good: the window, the page and the hooks of the core are as before.\n function finishClose(): void {\n clearTimeout(timer);\n panel.removeEventListener('transitionend', onSlid);\n window.removeEventListener('keydown', onKey);\n window.removeEventListener('resize', placeNav);\n clearInterval(clock);\n endDrag?.();\n search.close();\n // Pick may have been armed while the dock slid out.\n shell.endPick?.();\n shell.endPick = undefined;\n panel.remove();\n shell.panel = undefined;\n shell.showTab = undefined;\n docked = undefined;\n leave = undefined;\n closing = false;\n state.changed = undefined;\n document.documentElement.style.removeProperty('padding-bottom');\n document.documentElement.style.removeProperty('padding-right');\n state.resize = undefined;\n state.resized = undefined;\n }\n function onSlid(event: TransitionEvent): void {\n if (event.target === panel && event.propertyName === 'transform') {\n finishClose();\n }\n }\n leave = {\n close(): void {\n // Pick has no button, nor the styles of its card, without the dock.\n shell.endPick?.();\n search.close();\n endDrag?.();\n closing = true;\n if (opener) {\n opener.hidden = false;\n // Focus goes back to the grip, so the keyboard picks up where it left.\n opener.focus();\n }\n // Without a transition (reduced motion, or none) the dock leaves at once.\n if (!(Number.parseFloat(getComputedStyle(panel).transitionDuration) > 0)) {\n finishClose();\n return;\n }\n panel.classList.add('closed');\n panel.addEventListener('transitionend', onSlid);\n timer = setTimeout(finishClose, 400);\n },\n reopen(): void {\n closing = false;\n clearTimeout(timer);\n panel.removeEventListener('transitionend', onSlid);\n panel.classList.remove('closed');\n if (opener) {\n // The grip hides, so focus on it moves to the open workspace in the nav.\n const lost = root.activeElement === opener;\n opener.hidden = true;\n if (lost) {\n chrome.tabs.get(findWorkspace(shell.tab).id)?.focus();\n }\n }\n },\n };\n // Without an event, the core has not loaded yet, and nothing knows the components of the page.\n if (!state.scopes) {\n document.dispatchEvent(new Event('brumate:core'));\n }\n\n // Outlines the elements of a scope on the page.\n const outlines: HTMLElement[] = [];\n function outline(scope?: ScopeId): void {\n for (const box of outlines.splice(0)) {\n box.remove();\n }\n if (scope === undefined) {\n return;\n }\n for (const target of document.querySelectorAll(`[b-b^=\"${scope}:\"]`)) {\n const rect = target.getBoundingClientRect();\n const box = element('div', {\n class: 'outline',\n style: `left:${rect.left}px;top:${rect.top}px;width:${rect.width}px;height:${rect.height}px`,\n });\n root.append(box);\n outlines.push(box);\n }\n }\n\n // Pick: the next click on the page selects the row of its component in Inspect.\n function onPick(event: MouseEvent): void {\n const clicked = event.target as Element | null;\n if (!clicked?.closest || event.composedPath().includes(shell.panel!)) {\n return;\n }\n event.preventDefault();\n event.stopImmediatePropagation();\n stopPicking();\n shell.picked = clicked;\n const id = clicked.closest('[b-b]')?.getAttribute('b-b')!.split(':')[0];\n if (id !== undefined) {\n shell.selectedScope = /^-?\\d+$/.test(id) ? Number(id) : id;\n const scope = state.scopes?.get(shell.selectedScope);\n shell.selected = scope ? findRootScope(scope).m : shell.selected;\n }\n shell.tab = 'elements';\n ctx.draw();\n }\n // While picking, the element under the pointer is outlined, with a card of what brumate knows\n // about it: its component, its place in the file, its scope, its handlers and what it reads.\n const inspectCard = element('div', { class: 'inspect-card', role: 'tooltip' });\n const hoverBox = element('div', { class: 'outline' });\n let hovered: Element | undefined;\n let hoverToken = 0;\n function onHover(event: PointerEvent): void {\n const target = event.target as Element | null;\n if (!target?.closest || event.composedPath().includes(shell.panel!) || target === hovered) {\n return;\n }\n hovered = target;\n void showCard(target);\n }\n async function showCard(target: Element): Promise<void> {\n const token = ++hoverToken;\n const rect = target.getBoundingClientRect();\n hoverBox.style.cssText = `left:${rect.left}px;top:${rect.top}px;width:${rect.width}px;height:${rect.height}px`;\n root.append(hoverBox, inspectCard);\n const tag = target.tagName.toLowerCase();\n let classes = '';\n for (const name of [...target.classList].slice(0, 2)) {\n classes += `.${name}`;\n }\n const rows: (Node | string)[] = [\n element(\n 'div',\n { class: 'card-head' },\n element('span', { class: 'mono' }, `${tag}${classes}`),\n element('span', { class: 'sub' }, `${Math.round(rect.width)} × ${Math.round(rect.height)}`),\n ),\n ];\n const anchored = target.closest('[b-b]');\n const [id = '', anchorText = '0'] = anchored?.getAttribute('b-b')!.split(':') ?? [];\n const scope = anchored ? findScope(state, id) : undefined;\n if (scope) {\n const { info, component: owner, place } = await findAnchor(state, scope, Number(anchorText));\n if (token !== hoverToken) {\n return;\n }\n rows.push(\n element(\n 'div',\n { class: 'card-component' },\n element('strong', {}, info?.name ?? owner.m ?? 'component'),\n element(\n 'span',\n { class: 'mono sub' },\n place?.at ? `${info?.file}:${place.at}` : (info?.file ?? ''),\n ),\n ),\n element(\n 'div',\n { class: 'sub' },\n `scope ${scope.id} · ${info?.scopes[scope.k]?.label ?? 'scope'}${anchored === target ? '' : ` · in ${place?.label ?? 'an element'}`}`,\n ),\n );\n const handled = target.closest('[b-on]');\n if (handled && anchored!.contains(handled)) {\n const handlers = element('div', { class: 'card-pills' });\n for (const raw of (handled.getAttribute('b-on') ?? '').split(/\\s+/)) {\n if (!raw) {\n continue;\n }\n const [head] = raw.split('=') as [string];\n handlers.append(pill(head));\n }\n rows.push(handlers);\n }\n if (place && place.reads.length > 0) {\n rows.push(\n element('div', { class: 'card-pills' }, ...drawReads(scope, place.reads.slice(0, 4))),\n );\n }\n } else {\n rows.push(element('div', { class: 'sub' }, 'Nothing in the browser updates this element.'));\n }\n rows.push(element('div', { class: 'card-hint' }, 'Click to see it in Inspect · Esc to stop'));\n inspectCard.replaceChildren(...rows);\n // Below the element, or above it when there is no room, and inside the window.\n const cardHeight = inspectCard.offsetHeight;\n const top =\n rect.bottom + 8 + cardHeight < window.innerHeight\n ? rect.bottom + 8\n : Math.max(8, rect.top - 8 - cardHeight);\n const left = Math.min(Math.max(8, rect.left), window.innerWidth - inspectCard.offsetWidth - 8);\n inspectCard.style.cssText = `top:${top}px;left:${left}px`;\n }\n function onEscape(event: KeyboardEvent): void {\n if (event.key === 'Escape') {\n // The dock closes on Escape too, but not on the key that ends Pick, so the key stops here.\n event.preventDefault();\n event.stopPropagation();\n stopPicking();\n }\n }\n shell.endPick = (): void => stopPicking();\n function stopPicking(): void {\n pick.setAttribute('aria-pressed', 'false');\n window.removeEventListener('click', onPick, true);\n window.removeEventListener('pointermove', onHover, true);\n window.removeEventListener('keydown', onEscape, true);\n document.documentElement.style.cursor = '';\n hovered = undefined;\n hoverToken++;\n hoverBox.remove();\n inspectCard.remove();\n }\n pick.addEventListener('click', () => {\n if (pick.getAttribute('aria-pressed') === 'true') {\n stopPicking();\n return;\n }\n pick.setAttribute('aria-pressed', 'true');\n document.documentElement.style.cursor = 'crosshair';\n // On the window, so it runs before the listeners of the loader on the document.\n window.addEventListener('click', onPick, true);\n window.addEventListener('pointermove', onHover, true);\n window.addEventListener('keydown', onEscape, true);\n });\n\n /** Opens a workspace. The target is a tab of the workspace, for the one that has several. */\n function select(id: Workspace['id'], target?: Tab): void {\n const workspace = WORKSPACES.find((item) => item.id === id)!;\n shell.tab = target ?? defaultTab(workspace);\n draw();\n }\n let shown: Workspace['id'] | undefined;\n /** The header and the counts of the nav. */\n function drawHeader(): void {\n const current = findWorkspace(shell.tab).id;\n drawChrome(chrome, state, current, shell.paused);\n // The next open starts on the workspace that was last open.\n if (current !== shown) {\n shown = current;\n writePref('workspace', current);\n }\n }\n\n let queued = false;\n function draw(): void {\n drawHeader();\n const drawing = shell.tab;\n const drawn = findWorkspace(drawing).draw(ctx, body);\n // Marks of writes show once, on the next draw of Inspect.\n function settle(): void {\n if (findWorkspace(shell.tab).id === 'inspect') {\n state.written.clear();\n }\n }\n // Log and Blocks draw at once.\n if (!drawn) {\n settle();\n return;\n }\n void drawn.then(() => {\n // A tab that waited for the dev server, and that the user left meanwhile, drew over the\n // tab that is open now, so that one draws again.\n if (shell.tab !== drawing) {\n draw();\n return;\n }\n drawHeader();\n settle();\n });\n }\n // Changes come in bursts, so the dock draws once per frame. It waits while a value is edited\n // or a search is typed.\n state.changed = () => {\n const typing = root.activeElement?.matches?.('input[type=\"search\"]');\n if (!queued && !shell.editing && !typing && !(shell.paused && shell.tab === 'log')) {\n queued = true;\n requestAnimationFrame(() => {\n queued = false;\n if (shell.panel) {\n draw();\n }\n });\n }\n };\n shell.showTab = (next) => {\n shell.tab = next;\n draw();\n };\n draw();\n}\n"],"mappings":";;;;AAIA,SAAgB,QACd,KACA,aAAqC,CAAC,GACtC,GAAG,UACuB;CAC1B,MAAM,OAAO,SAAS,cAAc,GAAG;CACvC,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,UAAU,GACnD,KAAK,aAAa,MAAM,KAAK;CAE/B,KAAK,OAAO,GAAG,QAAQ;CACvB,OAAO;AACT;AAEA,SAAgB,IACd,KACA,Y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