@visualli/core 0.2.18 → 0.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-EGXQEULM.js → chunk-BLKZE5LK.js} +7 -7
- package/dist/{chunk-6GAKZATW.js → chunk-BZPD3BAU.js} +2 -2
- package/dist/{chunk-3UZU4SK5.js → chunk-CFJOFMIR.js} +2 -2
- package/dist/{chunk-6LHBNFP4.js → chunk-TSI4JXW2.js} +2 -1
- package/dist/{chunk-6LHBNFP4.js.map → chunk-TSI4JXW2.js.map} +1 -1
- package/dist/config/index.cjs.map +1 -1
- package/dist/config/index.d.cts +4 -4
- package/dist/config/index.d.ts +4 -4
- package/dist/config/index.js +2 -2
- package/dist/constants/index.d.cts +2 -2
- package/dist/constants/index.d.ts +2 -2
- package/dist/{designSystem-D1TEwtFB.d.cts → designSystem-8QfXOH7W.d.cts} +1 -0
- package/dist/{designSystem-D1TEwtFB.d.ts → designSystem-8QfXOH7W.d.ts} +1 -0
- package/dist/{ideaSize-D3bwx7nU.d.ts → ideaSize-CjiX1PKT.d.ts} +1 -1
- package/dist/{ideaSize-BNzONHMD.d.cts → ideaSize-q5pcHkXk.d.cts} +1 -1
- package/dist/{index-b1eML2o2.d.ts → index-CT1t9oKv.d.ts} +1 -1
- package/dist/{index-CpNpxxTi.d.cts → index-D0C6wWgJ.d.cts} +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +8 -8
- package/dist/layout/index.d.cts +2 -2
- package/dist/layout/index.d.ts +2 -2
- package/dist/{mindmap-GAjdtx5S.d.ts → mindmap-BX8h8W--.d.ts} +1 -1
- package/dist/{mindmap-BkGXWW3M.d.cts → mindmap-C-ol0EO8.d.cts} +1 -1
- package/dist/parser/index.cjs.map +1 -1
- package/dist/parser/index.d.cts +3 -3
- package/dist/parser/index.d.ts +3 -3
- package/dist/parser/index.js +4 -4
- package/dist/theme/index.cjs +1 -0
- package/dist/theme/index.cjs.map +1 -1
- package/dist/theme/index.d.cts +2 -2
- package/dist/theme/index.d.ts +2 -2
- package/dist/theme/index.js +2 -2
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/viewport/index.d.cts +2 -2
- package/dist/viewport/index.d.ts +2 -2
- package/package.json +2 -2
- package/src/generated/designSystem.ts +1 -0
- /package/dist/{chunk-EGXQEULM.js.map → chunk-BLKZE5LK.js.map} +0 -0
- /package/dist/{chunk-6GAKZATW.js.map → chunk-BZPD3BAU.js.map} +0 -0
- /package/dist/{chunk-3UZU4SK5.js.map → chunk-CFJOFMIR.js.map} +0 -0
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/layout/circularLayout.ts","../src/layout/linearLayout.ts","../src/layout/layoutUtils.ts","../src/parser/visualliParser.ts","../src/generated/designSystem.ts","../src/generated/geometry/color.ts","../src/theme/index.ts","../src/generated/geometry/idea.ts","../src/rendering/ideaSize.ts","../src/generated/geometry/blobShapes.ts","../src/generated/geometry/blob.ts","../src/rendering/nodeGeometry.ts","../src/parser/visualliConverter.ts","../src/parser/mindmapUtils.ts","../src/constants/layout.ts","../src/parser/configUtils.ts","../src/generated/geometry/interaction.ts","../src/constants/performanceConstants.ts","../src/constants/renderConfig.ts","../src/viewport/viewportUtils.ts","../src/performance/performanceMonitor.ts","../src/spatial/spatialIndex.ts","../../../../../node_modules/zustand/esm/vanilla.mjs","../src/stores/index.ts","../src/generated/geometry/container.ts","../src/utils/navigation.ts","../src/rendering/culling.ts","../src/generated/geometry/motion.ts","../src/generated/geometry/detail.ts"],"sourcesContent":["// ─── @visualli/core — Main Barrel Export ────────────────────────────────────\n//\n// Import from sub-paths for tree-shaking (e.g. `@visualli/core/layout`),\n// or use the main barrel for convenience.\n\nexport * from './types/index.js';\nexport * from './layout/index.js';\nexport * from './parser/index.js';\nexport * from './constants/index.js';\nexport * from './viewport/index.js';\nexport * from './performance/index.js';\nexport * from './spatial/index.js';\nexport * from './stores/index.js';\nexport * from './utils/navigation.js';\nexport * from './rendering/culling.js';\nexport * from './config/index.js';\nexport * from './theme/index.js';\n\n// The design system's choreography (layer reveal, step inside, back out, hover, reduced motion), verbatim.\nexport { MOTION, EASE, revealDelay, connectorDelay, revealTotal, bloomOffset, swapDelay, cssEase, ease as easeBezier, motionVars, revealSlot, layerBlooms, layerReveal } from './generated/geometry/motion.js';\nexport type { Bezier } from './generated/geometry/motion.js';\n// Containers: the dashed hull around a group's ideas and where its name goes (a pill on the hull, placed clear of\n// ideas, connectors and other names), verbatim from the design system's geometry/container.ts.\nexport { HULL, HULL_CLEAR, PILL, PILL_CHROME, pillLayout, pillScaled, containerHull, labelCandidates, placeContainerLabel, connectorSamples } from './generated/geometry/container.js';\nexport type { Hull, Box as LabelBox, LabelPlacement, LabelSide, Pt, PillSize } from './generated/geometry/container.js';\n// How terms, the peek, the touch sheet, zoom, fit, the depth trail and going back a layer by gesture behave, and which colour an idea gets: the design\n// system's geometry/interaction.ts and geometry/color.ts, verbatim. (Idea size and label growth, geometry/idea.ts, come\n// through rendering/ideaSize.)\nexport { TERM, PEEK, SHEET, VIEW, GESTURE, BACK, FRAME, PEEK_PLACEMENT, TRAIL, pointerModeFor, hoverOpensTerm, pinchZoom, zoomAround, layerBounds, ideaHighlight, fitView, fitViewInset, FIT_ROOM, peekPosition } from './generated/geometry/interaction.js';\nexport type { FrameBox, FrameInsets, LayerVia } from './generated/geometry/interaction.js';\n// Level of detail: what an idea draws at the size it's seen, and when shadows are skipped (geometry/detail.ts, verbatim).\nexport { DETAIL, ideaDetail, shadowsShown } from './generated/geometry/detail.js';\nexport type { IdeaDetail } from './generated/geometry/detail.js';\nexport { TOPIC_ORDER, CUSTOM, IMMERSION, topicFor } from './generated/geometry/color.js';\n","// ─── Circular Layout Algorithm ────────────────────────────────────────────────\n//\n// Positions nodes in a uniform circle with equal angular spacing.\n// PATTERN : Uniform circular distribution (polar coordinates)\n// SPACING : Equal angular intervals (2π/n)\n// ORIGIN : Configurable center (default 0, 0)\n// RADIUS : Configurable percentage of container (default 13.5%)\n\nimport type { FlatNode } from '../types/mindmap.js';\n\nexport interface CircularLayoutOptions {\n /** Radius as a fraction of the container's minimum dimension (0–1). Default: 0.135 */\n radiusPercentage?: number;\n /** Container width used to calculate absolute radius. Default: 2000 */\n containerWidth?: number;\n /** Container height used to calculate absolute radius. Default: 2000 */\n containerHeight?: number;\n /** World-space X of the circle centre. Default: 0 */\n centerX?: number;\n /** World-space Y of the circle centre. Default: 0 */\n centerY?: number;\n}\n\n/**\n * Apply circular layout to a set of nodes.\n * Mutates the `x` / `y` properties of each node and returns the same array.\n */\nexport function applyCircularLayout(\n nodes: FlatNode[],\n options: CircularLayoutOptions = {},\n): FlatNode[] {\n const {\n radiusPercentage = 0.135,\n containerWidth = 2000,\n containerHeight = 2000,\n centerX = 0,\n centerY = 0,\n } = options;\n\n if (nodes.length === 0) return nodes;\n\n if (nodes.length === 1) {\n nodes[0].x = centerX;\n nodes[0].y = centerY;\n return nodes;\n }\n\n const radius = Math.min(containerWidth, containerHeight) * radiusPercentage;\n\n // n=2 → horizontal; n≥3 → start at 12 o'clock\n const startAngle = nodes.length === 2 ? 0 : -Math.PI / 2;\n const angleStep = (2 * Math.PI) / nodes.length;\n\n for (let i = 0; i < nodes.length; i++) {\n const angle = startAngle + i * angleStep;\n nodes[i].x = centerX + radius * Math.cos(angle);\n nodes[i].y = centerY + radius * Math.sin(angle);\n }\n\n return nodes;\n}\n\n/**\n * Calculate the minimum radius needed to prevent node boxes from overlapping.\n *\n * Uses the chord-length formula: `chord = 2r · sin(θ/2)`, solved for `r`.\n */\nexport function calculateMinimumRadius(\n nodeCount: number,\n nodeWidth = 200,\n nodePadding = 150,\n): number {\n if (nodeCount <= 1) return 0;\n const angleStep = (2 * Math.PI) / nodeCount;\n const minChordLength = nodeWidth + nodePadding;\n return minChordLength / (2 * Math.sin(angleStep / 2));\n}\n\n/**\n * Calculate the optimal radius percentage for a given node count,\n * ensuring sufficient spacing for edge labels.\n *\n * @returns A value in [0.135, 0.45]\n */\nexport function calculateOptimalRadiusPercentage(\n nodeCount: number,\n containerWidth = 2000,\n containerHeight = 2000,\n nodeWidth = 200,\n nodePadding = 120,\n): number {\n const minRadius = calculateMinimumRadius(nodeCount, nodeWidth, nodePadding);\n const minDimension = Math.min(containerWidth, containerHeight);\n return Math.min(0.45, Math.max(0.135, minRadius / minDimension));\n}\n","// ─── Linear Layout Algorithms ─────────────────────────────────────────────────\n//\n// Positions nodes in a straight line without overlap, with enough gap between\n// node edges for edge-label text to render cleanly.\n//\n// linear-horizontal → left-to-right along X-axis\n// linear-vertical → top-to-bottom along Y-axis\n\nimport type { FlatNode } from '../types/mindmap.js';\n\nexport interface LinearLayoutOptions {\n /** Logical node width (px). Default: 200 */\n nodeWidth?: number;\n /** Logical node height (px). Default: 80 */\n nodeHeight?: number;\n /** Gap between node edges for horizontal layout (px). Default: 180 */\n hGap?: number;\n /** Gap between node edges for vertical layout (px). Default: 220 */\n vGap?: number;\n /** World X of the layout midpoint. Default: 0 */\n centerX?: number;\n /** World Y of the layout midpoint. Default: 0 */\n centerY?: number;\n}\n\n/**\n * Arrange nodes in a horizontal row (shared Y, varying X).\n * Row is centred on (`centerX`, `centerY`).\n */\nexport function applyLinearHorizontalLayout(\n nodes: FlatNode[],\n options: LinearLayoutOptions = {},\n): FlatNode[] {\n const { nodeWidth = 200, hGap = 180, centerX = 0, centerY = 0 } = options;\n\n if (nodes.length === 0) return nodes;\n\n if (nodes.length === 1) {\n nodes[0].x = centerX;\n nodes[0].y = centerY;\n return nodes;\n }\n\n const spacing = nodeWidth + hGap;\n const totalWidth = (nodes.length - 1) * spacing;\n const startX = centerX - totalWidth / 2;\n\n for (let i = 0; i < nodes.length; i++) {\n nodes[i].x = startX + i * spacing;\n nodes[i].y = centerY;\n }\n\n return nodes;\n}\n\n/**\n * Arrange nodes in a vertical column (shared X, varying Y).\n * Column is centred on (`centerX`, `centerY`).\n */\nexport function applyLinearVerticalLayout(\n nodes: FlatNode[],\n options: LinearLayoutOptions = {},\n): FlatNode[] {\n const { nodeHeight = 80, vGap = 220, centerX = 0, centerY = 0 } = options;\n\n if (nodes.length === 0) return nodes;\n\n if (nodes.length === 1) {\n nodes[0].x = centerX;\n nodes[0].y = centerY;\n return nodes;\n }\n\n const spacing = nodeHeight + vGap;\n const totalHeight = (nodes.length - 1) * spacing;\n const startY = centerY - totalHeight / 2;\n\n for (let i = 0; i < nodes.length; i++) {\n nodes[i].x = centerX;\n nodes[i].y = startY + i * spacing;\n }\n\n return nodes;\n}\n","// ─── Layout Utilities ─────────────────────────────────────────────────────────\n//\n// Collision detection and force-based positioning for MindMapNode trees.\n\nimport type { MindMapNode } from '../types/mindmap.js';\n\nexport interface CollisionBox {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/** Axis-aligned bounding box for a node, expanded by a fixed padding. */\nexport function getNodeBounds(node: MindMapNode): CollisionBox {\n const baseWidth = Math.max(120, node.title.length * 8 + 40);\n const baseHeight = Math.max(40, 32 + 16);\n const padding = 20;\n return {\n x: node.x - baseWidth / 2 - padding,\n y: node.y - baseHeight / 2 - padding,\n width: baseWidth + padding * 2,\n height: baseHeight + padding * 2,\n };\n}\n\nexport function checkCollision(box1: CollisionBox, box2: CollisionBox): boolean {\n return !(\n box1.x + box1.width < box2.x ||\n box2.x + box2.width < box1.x ||\n box1.y + box1.height < box2.y ||\n box2.y + box2.height < box1.y\n );\n}\n\n/**\n * Iteratively resolve bounding-box collisions within each level.\n * Nodes are pushed apart symmetrically until no overlaps remain\n * or `maxIterations` is reached.\n */\nexport function resolveCollisions(nodes: MindMapNode[], maxIterations = 10): MindMapNode[] {\n const result = [...nodes];\n\n for (let iter = 0; iter < maxIterations; iter++) {\n let hasCollisions = false;\n\n const byLevel = result.reduce<Record<number, MindMapNode[]>>((acc, n) => {\n (acc[n.level] ??= []).push(n);\n return acc;\n }, {});\n\n for (const levelNodes of Object.values(byLevel)) {\n for (let i = 0; i < levelNodes.length; i++) {\n for (let j = i + 1; j < levelNodes.length; j++) {\n const n1 = levelNodes[i];\n const n2 = levelNodes[j];\n if (!checkCollision(getNodeBounds(n1), getNodeBounds(n2))) continue;\n\n hasCollisions = true;\n const dx = n2.x - n1.x;\n const dy = n2.y - n1.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n\n if (dist < 1) {\n n2.x += 100;\n } else {\n const b1 = getNodeBounds(n1);\n const b2 = getNodeBounds(n2);\n const minSep = (b1.width + b2.width) / 2;\n const overlap = minSep - dist + 20;\n if (overlap > 0) {\n const move = overlap / 2;\n n1.x -= (dx / dist) * move;\n n1.y -= (dy / dist) * move;\n n2.x += (dx / dist) * move;\n n2.y += (dy / dist) * move;\n }\n }\n }\n }\n }\n\n if (!hasCollisions) break;\n }\n\n return result;\n}\n\n/**\n * Apply a lightweight repulsive force between same-level nodes that are\n * closer than 300 px, then resolve remaining collisions.\n */\nexport function optimizeLayout(nodes: MindMapNode[]): MindMapNode[] {\n const result = [...nodes];\n const iterations = 5;\n const repulsion = 1000;\n const damp = 0.8;\n\n for (let iter = 0; iter < iterations; iter++) {\n const forces = new Map<string, { x: number; y: number }>();\n result.forEach(n => forces.set(n.id, { x: 0, y: 0 }));\n\n for (let i = 0; i < result.length; i++) {\n for (let j = i + 1; j < result.length; j++) {\n const n1 = result[i];\n const n2 = result[j];\n if (n1.level !== n2.level) continue;\n\n const dx = n2.x - n1.x;\n const dy = n2.y - n1.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n if (dist <= 0 || dist >= 300) continue;\n\n const force = repulsion / (dist * dist);\n const f1 = forces.get(n1.id)!;\n const f2 = forces.get(n2.id)!;\n f1.x -= (dx / dist) * force;\n f1.y -= (dy / dist) * force;\n f2.x += (dx / dist) * force;\n f2.y += (dy / dist) * force;\n }\n }\n\n result.forEach(n => {\n const f = forces.get(n.id)!;\n n.x += f.x * damp;\n n.y += f.y * damp;\n });\n }\n\n return resolveCollisions(result);\n}\n","// ─── .visualli File Parser ────────────────────────────────────────────────────\n//\n// Reads JSONL (JSON Lines) format and parses into a structured VisualliDocument.\n\nimport type { VisualliDocument, SemanticAnchor } from '../types/document.js';\nimport type { VisualliMeta } from '../types/meta.js';\nimport type { VisualliLayer } from '../types/layer.js';\nimport type { Layer } from '../types/schema.js';\n\n/**\n * Convert schema Layer to VisualliLayer by ensuring required arrays exist.\n */\nfunction toVisualliLayer(schemaLayer: Layer): VisualliLayer {\n return {\n type: 'layer',\n id: schemaLayer.id,\n level: schemaLayer.level,\n parentLayerId: schemaLayer.parentLayerId,\n parentNodeId: schemaLayer.parentNodeId,\n layout: schemaLayer.layout,\n nodes: schemaLayer.nodes ?? [],\n connections: schemaLayer.connections ?? [],\n containers: schemaLayer.containers ?? [],\n };\n}\n\nexport class VisualliParseError extends Error {\n constructor(message: string, public readonly lineNumber?: number) {\n super(message);\n this.name = 'VisualliParseError';\n }\n}\n\n/**\n * Parse a .visualli file content (JSONL format) into a VisualliDocument.\n *\n * @throws VisualliParseError on malformed input\n */\nexport function parseVisualliFile(content: string): VisualliDocument {\n const lines = content.trim().split('\\n');\n\n const doc: VisualliDocument = {\n meta: null as unknown as VisualliMeta,\n layers: new Map(),\n layersByLevel: new Map(),\n rootLayer: null,\n };\n\n let lineNumber = 0;\n\n for (const line of lines) {\n lineNumber++;\n if (!line.trim()) continue;\n\n let obj: Record<string, unknown>;\n try {\n obj = JSON.parse(line) as Record<string, unknown>;\n } catch (err) {\n throw new VisualliParseError(\n `Failed to parse JSON at line ${lineNumber}: ${err}`,\n lineNumber,\n );\n }\n\n if (!obj['type']) {\n throw new VisualliParseError(\n `Missing 'type' field at line ${lineNumber}`,\n lineNumber,\n );\n }\n\n switch (obj['type']) {\n case 'meta':\n doc.meta = obj as unknown as VisualliMeta;\n break;\n\n case 'layer': {\n // Convert schema Layer to VisualliLayer\n const schemaLayer = obj as unknown as Layer;\n const layer = toVisualliLayer(schemaLayer);\n \n doc.layers.set(layer.id, layer);\n\n if (!doc.layersByLevel.has(layer.level)) {\n doc.layersByLevel.set(layer.level, []);\n }\n doc.layersByLevel.get(layer.level)!.push(layer);\n\n if (layer.level === 0) {\n doc.rootLayer = layer;\n }\n break;\n }\n\n case 'extension': {\n const id = obj['id'];\n if (typeof id === 'string') {\n (doc.extensions ??= {})[id] = Array.isArray(obj['data']) ? (obj['data'] as unknown[]) : [];\n }\n break;\n }\n\n default:\n // Unknown type — silently skip\n break;\n }\n }\n\n if (!doc.meta) throw new VisualliParseError('Missing required meta section');\n if (!doc.rootLayer) throw new VisualliParseError('Missing root layer (level 0)');\n\n return doc;\n}\n\nexport async function fetchAndParseVisualli(url: string): Promise<VisualliDocument> {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n return parseVisualliFile(await response.text());\n}\n\n/**\n * Parse .visualli JSONL data as returned from the MongoDB `visualli` field.\n *\n * @throws VisualliParseError\n */\nexport function parseVisualliFromMongoDB(visualliJsonl: string): VisualliDocument {\n if (!visualliJsonl || typeof visualliJsonl !== 'string') {\n throw new VisualliParseError('Invalid visualli data: expected a JSONL string');\n }\n const trimmed = visualliJsonl.trim();\n if (!trimmed) throw new VisualliParseError('Empty visualli data from MongoDB');\n return parseVisualliFile(trimmed);\n}\n\n/**\n * Parse a .visualli file from a browser `File` object.\n * (Browser-only – requires `FileReader`.)\n */\nexport function loadVisualliFileFromFile(file: File): Promise<VisualliDocument> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = e => {\n try {\n resolve(parseVisualliFile(e.target?.result as string));\n } catch (err) {\n reject(err);\n }\n };\n reader.onerror = () => reject(new Error('Failed to read file'));\n reader.readAsText(file);\n });\n}\n\n// ── Tree Helpers ──────────────────────────────────────────────────────────────\n\n/** Return all layers whose `parentNodeId` matches the given node ID. */\n/** Terms defined by the document's `semantic-anchors` extension (empty when absent). */\nexport function getSemanticAnchors(doc: VisualliDocument): SemanticAnchor[] {\n const raw = doc.extensions?.['semantic-anchors'];\n if (!Array.isArray(raw)) return [];\n return raw.filter((a): a is SemanticAnchor => !!a && typeof (a as SemanticAnchor).word === 'string' && typeof (a as SemanticAnchor).description === 'string');\n}\n\nexport function getChildLayers(\n doc: VisualliDocument,\n nodeId: string,\n): VisualliLayer[] {\n const result: VisualliLayer[] = [];\n for (const layer of doc.layers.values()) {\n if (layer.parentNodeId === nodeId) result.push(layer);\n }\n return result;\n}\n\n/**\n * Count the maximum depth of layers beneath a node (its \"magnitude\").\n * Returns 0 when the node has no child layers.\n */\nexport function countLayersBeneath(\n doc: VisualliDocument,\n nodeId: string,\n visited = new Set<string>(),\n): number {\n if (visited.has(nodeId)) return 0;\n visited.add(nodeId);\n\n const children = getChildLayers(doc, nodeId);\n if (children.length === 0) return 0;\n\n let maxDepth = 0;\n for (const layer of children) {\n let depth = 1;\n for (const node of layer.nodes) {\n depth = Math.max(depth, 1 + countLayersBeneath(doc, node.id, visited));\n }\n maxDepth = Math.max(maxDepth, depth);\n }\n return maxDepth;\n}\n","// GENERATED by scripts/gen-design-system.mjs from design-system/ (tokens/tokens.json, tokens/tokens.css). Do not edit.\n// Change the design system instead; the next `npm run build` regenerates this file.\n\n/** Version of the design system these modules were generated from. */\nexport const DESIGN_SYSTEM_VERSION = \"0.3.7\" as const;\n\nexport const THEME_NAMES = [\n \"light\",\n \"dark\",\n \"focus-light\",\n \"focus-dark\",\n \"colorsafe-light\",\n \"colorsafe-dark\",\n \"contrast-light\",\n \"contrast-dark\"\n] as const;\nexport type ThemeName = (typeof THEME_NAMES)[number];\n\n/** Every token for every theme (each theme already merged over \"light\"). Keys match the CSS custom properties. */\nexport const TOKENS: Readonly<Record<ThemeName, Readonly<Record<string, string>>>> = {\n \"light\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#f6f3ee\",\n \"surface\": \"#ffffff\",\n \"surface-sunken\": \"#f0ece5\",\n \"surface-overlay\": \"#ffffff\",\n \"line\": \"#e4dfd6\",\n \"line-strong\": \"#7a7f94\",\n \"ink\": \"#182140\",\n \"ink-muted\": \"#4f5671\",\n \"ink-subtle\": \"#5f647c\",\n \"action\": \"#182140\",\n \"on-action\": \"#ffffff\",\n \"focus\": \"#325e8c\",\n \"link\": \"#2f5a87\",\n \"selection\": \"rgba(18, 199, 211, 0.28)\",\n \"node-ink\": \"#182140\",\n \"edge\": \"#2a3048\",\n \"edge-label\": \"#4f5671\",\n \"info\": \"#2f5a87\",\n \"info-soft\": \"#e2edf8\",\n \"topic-teal\": \"#87f2f8\",\n \"topic-teal-ring\": \"#00949c\",\n \"topic-harbor\": \"#bcdbff\",\n \"topic-harbor-ring\": \"#4386c5\",\n \"topic-iris\": \"#e0c8fe\",\n \"topic-iris-ring\": \"#9570c1\",\n \"topic-berry\": \"#ffbdc4\",\n \"topic-berry-ring\": \"#cc5b6d\",\n \"topic-coral\": \"#ffc7b2\",\n \"topic-coral-ring\": \"#c56741\",\n \"topic-amber\": \"#ffcf9d\",\n \"topic-amber-ring\": \"#b97201\",\n \"topic-sun\": \"#ffea94\",\n \"topic-sun-ring\": \"#a18600\",\n \"topic-stone\": \"#e0dacf\",\n \"topic-stone-ring\": \"#8b8272\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"0 1px 2px rgba(24, 33, 64, 0.06), 0 8px 24px rgba(24, 33, 64, 0.08)\",\n \"shadow-pop\": \"0 2px 4px rgba(24, 33, 64, 0.08), 0 16px 40px rgba(24, 33, 64, 0.14)\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n },\n \"dark\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#0f1220\",\n \"surface\": \"#171b2b\",\n \"surface-sunken\": \"#0f1220\",\n \"surface-overlay\": \"#212639\",\n \"line\": \"#2b3148\",\n \"line-strong\": \"#6c7392\",\n \"ink\": \"#eef0f7\",\n \"ink-muted\": \"#b3b8cc\",\n \"ink-subtle\": \"#8f95ae\",\n \"action\": \"#f6f3ee\",\n \"on-action\": \"#182140\",\n \"focus\": \"#12c7d3\",\n \"link\": \"#5fd8e1\",\n \"selection\": \"rgba(18, 199, 211, 0.32)\",\n \"node-ink\": \"#182140\",\n \"edge\": \"#c9cddc\",\n \"edge-label\": \"#b3b8cc\",\n \"info\": \"#7cc8f2\",\n \"info-soft\": \"#13283a\",\n \"topic-teal\": \"#87f2f8\",\n \"topic-teal-ring\": \"#0fc5cd\",\n \"topic-harbor\": \"#bcdbff\",\n \"topic-harbor-ring\": \"#73aceb\",\n \"topic-iris\": \"#e0c8fe\",\n \"topic-iris-ring\": \"#b691e1\",\n \"topic-berry\": \"#ffbdc4\",\n \"topic-berry-ring\": \"#eb798a\",\n \"topic-coral\": \"#ffc7b2\",\n \"topic-coral-ring\": \"#ea8962\",\n \"topic-amber\": \"#ffcf9d\",\n \"topic-amber-ring\": \"#e29737\",\n \"topic-sun\": \"#ffea94\",\n \"topic-sun-ring\": \"#d8b70a\",\n \"topic-stone\": \"#e0dacf\",\n \"topic-stone-ring\": \"#b4a999\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"0 1px 2px rgba(0, 0, 0, 0.40), 0 8px 24px rgba(0, 0, 0, 0.35)\",\n \"shadow-pop\": \"0 2px 4px rgba(0, 0, 0, 0.50), 0 16px 40px rgba(0, 0, 0, 0.50)\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n },\n \"focus-light\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#f4f2ee\",\n \"surface\": \"#ffffff\",\n \"surface-sunken\": \"#f0ece5\",\n \"surface-overlay\": \"#ffffff\",\n \"line\": \"#e4dfd6\",\n \"line-strong\": \"#7a7f94\",\n \"ink\": \"#182140\",\n \"ink-muted\": \"#4f5671\",\n \"ink-subtle\": \"#5f647c\",\n \"action\": \"#182140\",\n \"on-action\": \"#ffffff\",\n \"focus\": \"#325e8c\",\n \"link\": \"#2f5a87\",\n \"selection\": \"rgba(18, 199, 211, 0.28)\",\n \"node-ink\": \"#182140\",\n \"edge\": \"#5a6079\",\n \"edge-label\": \"#5a6079\",\n \"info\": \"#2f5a87\",\n \"info-soft\": \"#e2edf8\",\n \"topic-teal\": \"#bce8ea\",\n \"topic-teal-ring\": \"#2c9298\",\n \"topic-harbor\": \"#c9d9ec\",\n \"topic-harbor-ring\": \"#5d85af\",\n \"topic-iris\": \"#d9cfe8\",\n \"topic-iris-ring\": \"#8e76aa\",\n \"topic-berry\": \"#edc6c9\",\n \"topic-berry-ring\": \"#b26c75\",\n \"topic-coral\": \"#eecec1\",\n \"topic-coral-ring\": \"#ae725b\",\n \"topic-amber\": \"#eed4ba\",\n \"topic-amber-ring\": \"#a67947\",\n \"topic-sun\": \"#f4eac1\",\n \"topic-sun-ring\": \"#98883f\",\n \"topic-stone\": \"#dddad5\",\n \"topic-stone-ring\": \"#8b8272\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"0 1px 2px rgba(24, 33, 64, 0.06), 0 8px 24px rgba(24, 33, 64, 0.08)\",\n \"shadow-pop\": \"0 2px 4px rgba(24, 33, 64, 0.08), 0 16px 40px rgba(24, 33, 64, 0.14)\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n },\n \"focus-dark\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#12141c\",\n \"surface\": \"#171b2b\",\n \"surface-sunken\": \"#0f1220\",\n \"surface-overlay\": \"#212639\",\n \"line\": \"#2b3148\",\n \"line-strong\": \"#6c7392\",\n \"ink\": \"#eef0f7\",\n \"ink-muted\": \"#b3b8cc\",\n \"ink-subtle\": \"#8f95ae\",\n \"action\": \"#f6f3ee\",\n \"on-action\": \"#182140\",\n \"focus\": \"#12c7d3\",\n \"link\": \"#5fd8e1\",\n \"selection\": \"rgba(18, 199, 211, 0.32)\",\n \"node-ink\": \"#182140\",\n \"edge\": \"#a9aec0\",\n \"edge-label\": \"#b3b8cc\",\n \"info\": \"#7cc8f2\",\n \"info-soft\": \"#13283a\",\n \"topic-teal\": \"#bce8ea\",\n \"topic-teal-ring\": \"#71bdc1\",\n \"topic-harbor\": \"#c9d9ec\",\n \"topic-harbor-ring\": \"#8cabce\",\n \"topic-iris\": \"#d9cfe8\",\n \"topic-iris-ring\": \"#ae9bc6\",\n \"topic-berry\": \"#edc6c9\",\n \"topic-berry-ring\": \"#cc8e95\",\n \"topic-coral\": \"#eecec1\",\n \"topic-coral-ring\": \"#cd9884\",\n \"topic-amber\": \"#eed4ba\",\n \"topic-amber-ring\": \"#c9a176\",\n \"topic-sun\": \"#f4eac1\",\n \"topic-sun-ring\": \"#c9b97a\",\n \"topic-stone\": \"#dddad5\",\n \"topic-stone-ring\": \"#b4a999\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"0 1px 2px rgba(24, 33, 64, 0.06), 0 8px 24px rgba(24, 33, 64, 0.08)\",\n \"shadow-pop\": \"0 2px 4px rgba(24, 33, 64, 0.08), 0 16px 40px rgba(24, 33, 64, 0.14)\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n },\n \"colorsafe-light\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#f6f3ee\",\n \"surface\": \"#ffffff\",\n \"surface-sunken\": \"#f0ece5\",\n \"surface-overlay\": \"#ffffff\",\n \"line\": \"#e4dfd6\",\n \"line-strong\": \"#7a7f94\",\n \"ink\": \"#182140\",\n \"ink-muted\": \"#4f5671\",\n \"ink-subtle\": \"#5f647c\",\n \"action\": \"#182140\",\n \"on-action\": \"#ffffff\",\n \"focus\": \"#325e8c\",\n \"link\": \"#2f5a87\",\n \"selection\": \"rgba(18, 199, 211, 0.28)\",\n \"node-ink\": \"#182140\",\n \"edge\": \"#2a3048\",\n \"edge-label\": \"#4f5671\",\n \"info\": \"#603376\",\n \"info-soft\": \"#efe6f6\",\n \"topic-teal\": \"#bbeec1\",\n \"topic-teal-ring\": \"#389754\",\n \"topic-harbor\": \"#9bc9ef\",\n \"topic-harbor-ring\": \"#1d84b9\",\n \"topic-iris\": \"#d7a9c7\",\n \"topic-iris-ring\": \"#ae5d94\",\n \"topic-berry\": \"#e7a692\",\n \"topic-berry-ring\": \"#c05a36\",\n \"topic-coral\": \"#f5c893\",\n \"topic-coral-ring\": \"#b27212\",\n \"topic-amber\": \"#a6edff\",\n \"topic-amber-ring\": \"#1092af\",\n \"topic-sun\": \"#fbf494\",\n \"topic-sun-ring\": \"#938e00\",\n \"topic-stone\": \"#dbdbdb\",\n \"topic-stone-ring\": \"#898284\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"0 1px 2px rgba(24, 33, 64, 0.06), 0 8px 24px rgba(24, 33, 64, 0.08)\",\n \"shadow-pop\": \"0 2px 4px rgba(24, 33, 64, 0.08), 0 16px 40px rgba(24, 33, 64, 0.14)\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n },\n \"colorsafe-dark\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#0f1220\",\n \"surface\": \"#171b2b\",\n \"surface-sunken\": \"#0f1220\",\n \"surface-overlay\": \"#212639\",\n \"line\": \"#2b3148\",\n \"line-strong\": \"#6c7392\",\n \"ink\": \"#eef0f7\",\n \"ink-muted\": \"#b3b8cc\",\n \"ink-subtle\": \"#8f95ae\",\n \"action\": \"#f6f3ee\",\n \"on-action\": \"#182140\",\n \"focus\": \"#12c7d3\",\n \"link\": \"#5fd8e1\",\n \"selection\": \"rgba(18, 199, 211, 0.32)\",\n \"node-ink\": \"#182140\",\n \"edge\": \"#c9cddc\",\n \"edge-label\": \"#b3b8cc\",\n \"info\": \"#daa4f6\",\n \"info-soft\": \"#2a1c33\",\n \"topic-teal\": \"#bbeec1\",\n \"topic-teal-ring\": \"#69c27e\",\n \"topic-harbor\": \"#9bc9ef\",\n \"topic-harbor-ring\": \"#5eade2\",\n \"topic-iris\": \"#d7a9c7\",\n \"topic-iris-ring\": \"#d383b9\",\n \"topic-berry\": \"#e7a692\",\n \"topic-berry-ring\": \"#e37a55\",\n \"topic-coral\": \"#f5c893\",\n \"topic-coral-ring\": \"#db9840\",\n \"topic-amber\": \"#a6edff\",\n \"topic-amber-ring\": \"#5bbdda\",\n \"topic-sun\": \"#fbf494\",\n \"topic-sun-ring\": \"#c9bf37\",\n \"topic-stone\": \"#dbdbdb\",\n \"topic-stone-ring\": \"#b1a8aa\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"0 1px 2px rgba(24, 33, 64, 0.06), 0 8px 24px rgba(24, 33, 64, 0.08)\",\n \"shadow-pop\": \"0 2px 4px rgba(24, 33, 64, 0.08), 0 16px 40px rgba(24, 33, 64, 0.14)\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n },\n \"contrast-light\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#ffffff\",\n \"surface\": \"#ffffff\",\n \"surface-sunken\": \"#f2f2f2\",\n \"surface-overlay\": \"#ffffff\",\n \"line\": \"#5c6178\",\n \"line-strong\": \"#000000\",\n \"ink\": \"#000000\",\n \"ink-muted\": \"#1f2433\",\n \"ink-subtle\": \"#3a3f52\",\n \"action\": \"#000000\",\n \"on-action\": \"#ffffff\",\n \"focus\": \"#0b4a8f\",\n \"link\": \"#0b4a8f\",\n \"selection\": \"rgba(18, 199, 211, 0.28)\",\n \"node-ink\": \"#000000\",\n \"edge\": \"#000000\",\n \"edge-label\": \"#1f2433\",\n \"info\": \"#471f61\",\n \"info-soft\": \"#ffffff\",\n \"topic-teal\": \"#87f2f8\",\n \"topic-teal-ring\": \"#006b70\",\n \"topic-harbor\": \"#bcdbff\",\n \"topic-harbor-ring\": \"#0e599d\",\n \"topic-iris\": \"#e0c8fe\",\n \"topic-iris-ring\": \"#683b92\",\n \"topic-berry\": \"#ffbdc4\",\n \"topic-berry-ring\": \"#96173a\",\n \"topic-coral\": \"#ffc7b2\",\n \"topic-coral-ring\": \"#923400\",\n \"topic-amber\": \"#ffcf9d\",\n \"topic-amber-ring\": \"#7e4d00\",\n \"topic-sun\": \"#ffea94\",\n \"topic-sun-ring\": \"#7a6600\",\n \"topic-stone\": \"#e0dacf\",\n \"topic-stone-ring\": \"#63594b\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"none\",\n \"shadow-pop\": \"none\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n },\n \"contrast-dark\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#000000\",\n \"surface\": \"#000000\",\n \"surface-sunken\": \"#0d0d0d\",\n \"surface-overlay\": \"#0d0d0d\",\n \"line\": \"#9aa0b8\",\n \"line-strong\": \"#ffffff\",\n \"ink\": \"#ffffff\",\n \"ink-muted\": \"#e6e8f0\",\n \"ink-subtle\": \"#c8ccda\",\n \"action\": \"#ffffff\",\n \"on-action\": \"#000000\",\n \"focus\": \"#5fe8f0\",\n \"link\": \"#7ff0f5\",\n \"selection\": \"rgba(18, 199, 211, 0.32)\",\n \"node-ink\": \"#000000\",\n \"edge\": \"#ffffff\",\n \"edge-label\": \"#e6e8f0\",\n \"info\": \"#d5a5d6\",\n \"info-soft\": \"#000000\",\n \"topic-teal\": \"#87f2f8\",\n \"topic-teal-ring\": \"#64eff7\",\n \"topic-harbor\": \"#bcdbff\",\n \"topic-harbor-ring\": \"#b0d5fe\",\n \"topic-iris\": \"#e0c8fe\",\n \"topic-iris-ring\": \"#dcbfff\",\n \"topic-berry\": \"#ffbdc4\",\n \"topic-berry-ring\": \"#feb3bb\",\n \"topic-coral\": \"#ffc7b2\",\n \"topic-coral-ring\": \"#ffbea5\",\n \"topic-amber\": \"#ffcf9d\",\n \"topic-amber-ring\": \"#ffc78a\",\n \"topic-sun\": \"#ffea94\",\n \"topic-sun-ring\": \"#ffe26d\",\n \"topic-stone\": \"#e0dacf\",\n \"topic-stone-ring\": \"#ddd3c2\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"none\",\n \"shadow-pop\": \"none\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n }\n};\n\n/** Topic palette names (token pairs `topic-<name>` / `topic-<name>-ring`). */\nexport const TOPICS = [\n \"teal\",\n \"harbor\",\n \"iris\",\n \"berry\",\n \"coral\",\n \"amber\",\n \"sun\",\n \"stone\"\n] as const;\nexport type TopicName = (typeof TOPICS)[number];\n\n/** Numeric tokens (px / ms stripped), camel-cased: nodeWidth, nodeStroke, edgeWidth, edgeGap, durationBase, zoomMin ... */\nexport const METRICS = {\n \"space1\": 4,\n \"space2\": 8,\n \"space3\": 12,\n \"space4\": 16,\n \"space7\": 48,\n \"radiusSm\": 10,\n \"radiusMd\": 16,\n \"radiusLg\": 24,\n \"radiusPill\": 999,\n \"nodeWidth\": 200,\n \"nodeHeight\": 148,\n \"nodeStroke\": 3,\n \"edgeWidth\": 2.5,\n \"edgeGap\": 15,\n \"edgeArcMax\": 45,\n \"immersionAlpha\": 0.15,\n \"zoomMin\": 0.3,\n \"zoomMax\": 5,\n \"durationInstant\": 100,\n \"durationQuick\": 160,\n \"durationBase\": 240,\n \"durationZoom\": 500,\n \"durationReveal\": 420,\n \"durationAutoplay\": 7000,\n \"staggerReveal\": 70,\n \"zChrome\": 10,\n \"zCard\": 20,\n \"zMenu\": 40\n} as const;\n/** Overrides applied when motion is reduced. */\nexport const METRICS_REDUCED_MOTION = {\n \"durationInstant\": 120,\n \"durationQuick\": 0,\n \"durationBase\": 0,\n \"durationZoom\": 0,\n \"durationReveal\": 0,\n \"durationAutoplay\": 0,\n \"staggerReveal\": 0\n} as const;\n\n/** Canvas type styles (family is a token name: font-hand, font-note, font-ui ...). */\nexport const TYPE_STYLES = {\n \"heading\": {\n \"family\": \"font-ui\",\n \"size\": 17,\n \"lineHeight\": 24,\n \"weight\": 700\n },\n \"body\": {\n \"family\": \"font-ui\",\n \"size\": 15,\n \"lineHeight\": 22,\n \"weight\": 400\n },\n \"body-sm\": {\n \"family\": \"font-ui\",\n \"size\": 13,\n \"lineHeight\": 18,\n \"weight\": 400\n },\n \"label\": {\n \"family\": \"font-ui\",\n \"size\": 13,\n \"lineHeight\": 16,\n \"weight\": 600,\n \"letterSpacing\": 0.01\n },\n \"caption\": {\n \"family\": \"font-ui\",\n \"size\": 12,\n \"lineHeight\": 16,\n \"weight\": 400\n },\n \"node-root\": {\n \"family\": \"font-hand\",\n \"size\": 30,\n \"lineHeight\": 34,\n \"weight\": 700\n },\n \"node-label\": {\n \"family\": \"font-hand\",\n \"size\": 22,\n \"lineHeight\": 26,\n \"weight\": 700\n },\n \"edge-label\": {\n \"family\": \"font-note\",\n \"size\": 18,\n \"lineHeight\": 20,\n \"weight\": 500\n },\n \"annotation\": {\n \"family\": \"font-note\",\n \"size\": 24,\n \"lineHeight\": 26,\n \"weight\": 600\n }\n} as const;\n\n/** Canvas styling extracted from css/spec.css (node labels, hover, shadows, connector dashes, group frames). */\nexport const CANVAS_STYLE = {\n \"node\": {\n \"selectedStrokeWidth\": 4,\n \"hoverRingsRotate\": -2,\n \"hoverRingsScale\": 1.015,\n \"hoverLift\": -2,\n \"dimmedOpacity\": 1,\n \"dimmedOpacityFocus\": 0.4,\n \"dimmedOpacityTouch\": 0.6,\n \"dimmedOpacityFocusTouch\": 0.4,\n \"highlightDimmedOpacity\": 0.35,\n \"shadowLight\": \"0 6px 14px rgba(24, 33, 64, .10)\",\n \"shadowDark\": \"0 0 22px rgba(255, 255, 255, .10)\"\n },\n \"edge\": {\n \"dash\": [\n 7,\n 7\n ],\n \"labelWeight\": 500,\n \"labelSize\": 18,\n \"readableLabelSize\": 14,\n \"readableLabelWeight\": 600,\n \"labelHaloWidth\": 5\n },\n \"group\": {\n \"strokeWidth\": 1.5,\n \"dash\": [\n 10,\n 6\n ],\n \"labelWeight\": 700,\n \"labelLineHeight\": 1.1,\n \"labelSize\": 26,\n \"labelPadding\": {\n \"top\": 6,\n \"x\": 22,\n \"bottom\": 8\n },\n \"labelMaxWidth\": 420,\n \"labelBorderWidth\": 1.5,\n \"labelFill\": \"topic-stone\",\n \"labelBorder\": \"topic-stone-ring\",\n \"labelInk\": \"node-ink\",\n \"contrastLabelBorderWidth\": 2,\n \"contrastLabelBorder\": \"line-strong\"\n }\n} as const;\n","// Generated from visualli.ai design-system/components/src/color.ts — do not edit here.\n/* Which topic an idea is drawn in. A `.visualli` file's `data.color` may name one of the eight topics or be any\n other color, or be missing. Every renderer resolves it with this rule, so a file looks the same everywhere:\n a topic name ('teal', 'Harbor ') → that topic (case and surrounding spaces don't matter);\n no color → the topics in order, by the idea's position among its siblings (so siblings differ);\n anything else (e.g. '#b7e7f3') → null: not a topic — drawn as given (customColor): the color as the fill, and\n the fill darkened (CUSTOM.ringShade) as the ring; a custom color doesn't follow themes.\n No dependencies, so it can travel alone. */\n\n/** The eight topics, in the order missing colors cycle through. */\nexport const TOPIC_ORDER = ['teal', 'harbor', 'iris', 'berry', 'coral', 'amber', 'sun', 'stone'] as const;\nexport type TopicName = (typeof TOPIC_ORDER)[number];\n\n/** The topic a color names, or null. */\nexport function topicFromName(color: string | null | undefined): TopicName | null {\n if (!color) return null;\n const c = color.trim().toLowerCase();\n return (TOPIC_ORDER as readonly string[]).includes(c) ? (c as TopicName) : null;\n}\n\n/** The topic for an idea: its named topic; with no color, the next topic in sibling order; null for any other color. */\nexport function topicFor(color: string | null | undefined, siblingIndex: number): TopicName | null {\n if (!color || !color.trim()) return TOPIC_ORDER[((siblingIndex % TOPIC_ORDER.length) + TOPIC_ORDER.length) % TOPIC_ORDER.length];\n return topicFromName(color);\n}\n\n/** Chromatic immersion: inside a layer, the canvas takes the fill of the idea you stepped into (at the `immersion-alpha`\n * token), so you always know whose inside you are in. Part of the spec, so it is on unless a host turns it off. */\nexport const IMMERSION = { /** Renderers draw it by default. */ defaultOn: true } as const;\n\n/** A custom (non-topic) color: drawn as given, with a darker ring. */\nexport const CUSTOM = { /** The ring is the fill with each RGB channel multiplied by this. */ ringShade: 0.78 } as const;\n\n/** Fill and ring for a custom color. `ring` is null when the color isn't a 6-digit hex (use the `edge` token then). */\nexport function customColor(color: string): { fill: string; ring: string | null } {\n const m = /^#?([0-9a-f]{6})$/i.exec((color || '').trim());\n if (!m) return { fill: color, ring: null };\n const n = parseInt(m[1], 16), f = CUSTOM.ringShade;\n const r = Math.round(((n >> 16) & 255) * f), g = Math.round(((n >> 8) & 255) * f), b = Math.round((n & 255) * f);\n return { fill: color.trim(), ring: '#' + ((1 << 24) | (r << 16) | (g << 8) | b).toString(16).slice(1) };\n}\n","// ─── Theme resolution ────────────────────────────────────────────────────────\n//\n// Everything visual comes from the generated design-system modules. This file\n// only decides WHICH of the 8 themes applies and resolves document colours with\n// the design system's colour rule. No colour literals live here.\n//\n// Dependencies: ../generated/designSystem.ts (generated from design-system/).\n\nimport {\n CANVAS_STYLE,\n DESIGN_SYSTEM_VERSION,\n METRICS,\n METRICS_REDUCED_MOTION,\n THEME_NAMES,\n TOKENS,\n TOPICS,\n TYPE_STYLES,\n type ThemeName,\n type TopicName,\n} from '../generated/designSystem.js';\nimport { TOPIC_ORDER, customColor, topicFor, topicFromName } from '../generated/geometry/color.js';\n\nexport { topicFromName, customColor };\n\nexport { CANVAS_STYLE, DESIGN_SYSTEM_VERSION, METRICS, METRICS_REDUCED_MOTION, THEME_NAMES, TOKENS, TOPICS, TYPE_STYLES };\nexport type { ThemeName, TopicName };\n\n// ── Theme selection ───────────────────────────────────────────────────────────\n\n/** Theme families: each resolves to its light or dark member. */\nexport type ThemeFamily = 'standard' | 'focus' | 'colorsafe' | 'contrast';\n\n/**\n * Anything a consumer may pass as `theme`:\n * - one of the 8 design-system themes ('light', 'dark', 'focus-light', ...)\n * - a family name ('focus' | 'colorsafe' | 'contrast') -> light/dark per the reader's scheme\n * - 'auto' -> light/dark per prefers-color-scheme (contrast under forced-colors)\n *\n * 'light' | 'dark' | 'auto' are the pre-0.2 values, kept as aliases for one release.\n */\nexport type ThemeInput = ThemeName | 'auto' | 'focus' | 'colorsafe' | 'contrast';\n\nexport interface ThemeEnv {\n /** prefers-color-scheme: dark */\n prefersDark?: boolean;\n /** forced-colors: active (Windows high contrast etc.) */\n forcedColors?: boolean;\n}\n\nconst FAMILIES: ReadonlySet<string> = new Set(['focus', 'colorsafe', 'contrast']);\n\nexport function isThemeName(v: unknown): v is ThemeName {\n return typeof v === 'string' && (THEME_NAMES as readonly string[]).includes(v);\n}\n\n/** Resolve any accepted `theme` value to one concrete design-system theme. */\nexport function resolveTheme(input: ThemeInput | undefined, env: ThemeEnv = {}): ThemeName {\n const scheme = env.prefersDark ? 'dark' : 'light';\n if (input === undefined || input === 'auto') return env.forcedColors ? (`contrast-${scheme}` as ThemeName) : scheme;\n if (FAMILIES.has(input)) return `${input}-${scheme}` as ThemeName;\n return isThemeName(input) ? input : 'light';\n}\n\nexport const isDarkTheme = (name: ThemeName): boolean => name.endsWith('dark');\nexport const isContrastTheme = (name: ThemeName): boolean => name.startsWith('contrast');\nexport const isFocusTheme = (name: ThemeName): boolean => name.startsWith('focus');\n\n/** All tokens of a theme (already merged over the light defaults). */\nexport const getTokens = (name: ThemeName): Readonly<Record<string, string>> => TOKENS[name];\n\n/** One token of a theme. Throws on an unknown key so typos fail loudly in tests. */\nexport function token(name: ThemeName, key: string): string {\n const v = TOKENS[name][key];\n if (v === undefined) throw new Error(`Unknown design-system token \"${key}\"`);\n return v;\n}\n\n// ── Comfort settings ──────────────────────────────────────────────────────────\n\nexport interface Comfort {\n /** Atkinson Hyperlegible for map labels instead of the handwritten faces (`data-type=\"readable\"`). */\n readableType?: boolean;\n /** Larger UI and label text (`data-scale=\"lg\"`). */\n largerText?: boolean;\n /** Skip transitions and reveal animations (`data-motion=\"reduced\"`). 'system' follows prefers-reduced-motion. */\n reducedMotion?: boolean | 'system';\n}\n\nexport interface ResolvedComfort { readableType: boolean; largerText: boolean; reducedMotion: boolean }\n\nexport function resolveComfort(c: Comfort | undefined, env: { prefersReducedMotion?: boolean } = {}): ResolvedComfort {\n const rm = c?.reducedMotion;\n return {\n readableType: !!c?.readableType,\n largerText: !!c?.largerText,\n reducedMotion: rm === undefined || rm === 'system' ? !!env.prefersReducedMotion : rm,\n };\n}\n\n/** Numeric design-system tokens (px / ms stripped). */\nexport type Metrics = { readonly [K in keyof typeof METRICS]: number };\n\n/** Numeric tokens with the reduced-motion overrides applied when requested. */\nexport function metricsFor(comfort: ResolvedComfort): Metrics {\n return comfort.reducedMotion ? { ...METRICS, ...METRICS_REDUCED_MOTION } : METRICS;\n}\n\n/** Multiplier the spec applies to label sizes under `data-scale=\"lg\"` (`--vi-label-scale`). */\nexport const labelScale = (c: ResolvedComfort): number => (c.largerText ? 1.15 : 1);\n\n// ── Topic palette ─────────────────────────────────────────────────────────────\n\nexport interface TopicStyle { topic: TopicName; fill: string; ring: string }\n\n/** Fill + ring colour of a topic in a theme. */\nexport function topicStyle(theme: ThemeName, topic: TopicName): TopicStyle {\n const t = TOKENS[theme];\n return { topic, fill: t[`topic-${topic}`]!, ring: t[`topic-${topic}-ring`]! };\n}\n\n/** An idea's colour by the design system's colour rule (geometry/color.ts, verbatim): a topic name → that topic; no\n * colour → the topics in sibling order; any other colour → custom, drawn as given (customColor: the colour as the fill,\n * the fill darkened by CUSTOM.ringShade as the ring). A custom colour doesn't follow themes. */\nexport interface IdeaColor { topic: TopicName | null; custom: { fill: string; ring: string | null } | null }\n\nexport function ideaColor(color: string | null | undefined, siblingIndex: number): IdeaColor {\n const topic = topicFor(color, siblingIndex);\n return topic ? { topic, custom: null } : { topic: null, custom: customColor(color!) };\n}\n\n/** Fill + ring an idea is drawn with in a theme: its topic's, or its custom colour (ring: the `edge` token when the\n * colour has no darker shade, i.e. isn't a 6-digit hex). */\nexport function ideaStyle(theme: ThemeName, c: { topic?: TopicName | null; custom?: IdeaColor['custom'] }): { fill: string; ring: string } {\n if (c.custom) return { fill: c.custom.fill, ring: c.custom.ring ?? TOKENS[theme]['edge']! };\n return topicStyle(theme, c.topic ?? TOPIC_ORDER[0]);\n}\n","// Generated from visualli.ai design-system/components/src/idea.ts — do not edit here.\n/* An idea's size and its label. An idea grows to show its whole label: it starts at its base width and widens in\n steps until the label fits in `labelLines` lines and every line fits the shape; at its widest it grows taller\n instead, so a label is never cut (a single word too long for the widest idea widens it further, up to twice). Labels wrap inside the idea's real outline (a ShapeProfile — blob.ts blobProfile\n for the drawn blob, an ellipse by default): each line may be as wide as the shape is at that line's height.\n Labels (and connector labels) grow a little when the map is zoomed out, so they stay readable. Every renderer sizes\n ideas with these rules, measuring text with its own font engine (`measure`). No dependencies, so it can travel alone. */\n\nexport type IdeaKind = 'root' | 'node' | 'mini';\n\n/** How much labels grow when zoomed out (`scale` = the map's zoom): never smaller than their size, up to these caps.\n * Idea labels and container names use `idea`; connector labels `connector`. Below 100% they grow; above, they don't. */\nexport const LABEL_GROWTH = { idea: 1.3, connector: 1.6, /** Label lines are wrapped at growth steps this size (layoutGrowth). */ layoutStep: 0.02 } as const;\n\nexport const IDEA = {\n /** Width an idea starts at… */ baseWidth: { root: 240, node: 200, mini: 120 },\n /** …and the widest it gets before it grows taller instead. */ maxWidth: { root: 400, node: 360, mini: 200 },\n /** Width grows in steps of this. */ step: 20,\n /** Height = width × aspect (at least `minRy` × 2), more if the label needs it. */ aspect: 0.74, minRy: 64,\n /** The label's box is the idea's width less this (22 each side). */ labelInset: 44,\n /** The idea widens until its label fits in this many lines. */ labelLines: 3,\n /** Label size (before the label scale and zoom growth), weight from the canvas type styles. */ labelSize: { root: 30, node: 22, mini: 15 },\n labelLineHeight: 1.15,\n /** The label may fill at most this share of the idea's height. */ labelFillHeight: 0.7,\n} as const;\n\n/** Greedy word wrap of `text` into lines no wider than `maxWidth` (a single word longer than that gets its own line). */\nexport function wrapLines(text: string, maxWidth: number, measure: (s: string) => number): string[] {\n const words = text.split(/\\s+/).filter(Boolean);\n const lines: string[] = [];\n let cur = '';\n for (const w of words) {\n const next = cur ? `${cur} ${w}` : w;\n if (cur && measure(next) > maxWidth) { lines.push(cur); cur = w; } else cur = next;\n }\n if (cur) lines.push(cur);\n return lines.length ? lines : [''];\n}\n\n/** A line's width as the shape-aware wrap measures it: its words' widths plus the spaces between them, each word\n * measured once. Words repeat across a map, so a renderer measures far fewer strings; kerning across a space (a\n * fraction of a pixel) is ignored, well inside labelInset. */\nfunction wordsMeasure(measure: (s: string) => number): (s: string) => number {\n const seen = new Map<string, number>(), space = measure(' ');\n const word = (w: string) => { let x = seen.get(w); if (x === undefined) { x = measure(w); seen.set(w, x); } return x; };\n return (line) => { const ws = line.split(' '); let x = (ws.length - 1) * space; for (const w of ws) x += word(w); return x; };\n}\n\n/** How wide a shape is at a height: for an idea of half-size rx × ry, `(y) => ` the distance a centered line at height\n * y (from the center) can reach before it meets the outline. blob.ts `blobProfile(shape)` gives the drawn blob's. */\nexport type ShapeProfile = (rx: number, ry: number) => (y: number) => number;\n/** The default profile, an ellipse — for renderers without blob geometry. */\nexport const ELLIPSE: ShapeProfile = (rx, ry) => (y) => rx * Math.sqrt(Math.max(0, 1 - (y / ry) * (y / ry)));\n\n/** Greedy word wrap of `text` where line i may be at most `widthOf(i)` wide (a word wider than its line gets its own). */\nfunction wrapVarying(text: string, widthOf: (i: number) => number, measure: (s: string) => number): string[] {\n const words = text.split(/\\s+/).filter(Boolean);\n const lines: string[] = [];\n let cur = '';\n for (const w of words) {\n const next = cur ? `${cur} ${w}` : w;\n if (cur && measure(next) > widthOf(lines.length)) { lines.push(cur); cur = w; } else cur = next;\n }\n if (cur) lines.push(cur);\n return lines.length ? lines : [''];\n}\n\n/** The widest each line of an n-line label may be, inside the shape: the label is centered vertically, lines are\n * `lineHeight` tall, and line i may reach as far as the shape does at both its top and bottom edge, less labelInset. */\nexport function lineWidthsInShape(n: number, lineHeight: number, halfWidthAt: (y: number) => number): number[] {\n return Array.from({ length: n }, (_, i) => {\n const top = (i - n / 2) * lineHeight, bottom = top + lineHeight;\n return Math.max(0, 2 * Math.min(halfWidthAt(top), halfWidthAt(bottom)) - IDEA.labelInset);\n });\n}\n\n/** Word wrap inside a shape: lines take the width the shape has at their height (lineWidthsInShape). The line count\n * and the lines' heights depend on each other, so it settles in a few passes. */\nexport function wrapInShape(text: string, lineHeight: number, halfWidthAt: (y: number) => number, measure: (s: string) => number): string[] {\n let n = 1, lines = [text];\n for (let pass = 0; pass < 6; pass++) {\n const widths = lineWidthsInShape(n, lineHeight, halfWidthAt);\n lines = wrapVarying(text, (i) => widths[Math.min(i, n - 1)] ?? 0, measure);\n if (lines.length === n) break;\n n = lines.length;\n }\n return lines;\n}\n\n/** Whether `lines` fit the shape: each line no wider than lineWidthsInShape allows (a single word that can't fit counts). */\nfunction fitsShape(lines: string[], lineHeight: number, halfWidthAt: (y: number) => number, measure: (s: string) => number): boolean {\n const widths = lineWidthsInShape(lines.length, lineHeight, halfWidthAt);\n return lines.every((l, i) => measure(l) <= (widths[i] ?? 0) + 0.5);\n}\n\n/** An idea's size for its label: width, half-width / half-height for the blob, and the label's lines. The label is\n * measured at its largest drawn size — its type size × `labelScale` (Comfort: larger text) × LABEL_GROWTH.idea (zoomed\n * out) — so it fits at every zoom and the idea never changes size while zooming. `measure(text, px)` returns the\n * text's width in px in the label's face at `px`. */\nexport function ideaSize(kind: IdeaKind, label: string, measure: (text: string, px: number) => number, labelScale = 1, profile: ShapeProfile = ELLIPSE) {\n const px = IDEA.labelSize[kind] * labelScale * LABEL_GROWTH.idea, lh = px * IDEA.labelLineHeight;\n const m = wordsMeasure((t: string) => measure(t, px));\n // For a width: the base height, the label wrapped in the shape, then taller if the label needs the height.\n const at = (width: number, minRy = 0) => {\n const rx = width / 2;\n let ry = Math.max(IDEA.minRy, rx * IDEA.aspect, minRy);\n let lines = wrapInShape(label, lh, profile(rx, ry), m);\n const needRy = (lines.length * lh) / 2 / IDEA.labelFillHeight;\n if (needRy > ry) { ry = needRy; lines = wrapInShape(label, lh, profile(rx, ry), m); }\n return { rx, ry, lines, fits: lines.length <= IDEA.labelLines && fitsShape(lines, lh, profile(rx, ry), m) };\n };\n const base: number = IDEA.baseWidth[kind], max: number = IDEA.maxWidth[kind];\n let width = base, r = at(width);\n while (!r.fits && width < max) { width = Math.min(max, width + IDEA.step); r = at(width); }\n // A single word too wide for the widest idea (a word is never broken): only then, wider than max, up to twice it.\n const wordTooWide = () => label.split(/\\s+/).some((w) => m(w) > (lineWidthsInShape(1, lh, profile(r.rx, r.ry))[0] ?? 0));\n const longWord = !r.fits && wordTooWide();\n while (!r.fits && width < max * 2 && wordTooWide()) { width += IDEA.step; r = at(width); }\n // At its widest: taller, until every line fits the shape (bounded, so a pathological label still ends).\n let tall = r;\n for (let k = 0; k < 40 && !fitsShape(tall.lines, lh, profile(tall.rx, tall.ry), m); k++) tall = at(width, tall.ry + IDEA.step / 2);\n // A word too long for the widest idea sits on a line near the top or bottom, narrower than the middle one, so\n // widening only until it fits the middle line leaves the idea growing tall and lopsided: for such a word, widen\n // further (up to twice the widest) when that fits the label and is not taller.\n if (longWord && tall.ry * 2 > width) {\n let w = width, q = r;\n while (!q.fits && w < max * 2) { w += IDEA.step; q = at(w); }\n if (q.fits && q.ry < tall.ry) { width = w; tall = q; }\n }\n r = tall;\n return { width, height: r.ry * 2, rx: r.rx, ry: r.ry, lines: r.lines };\n}\n\n/** How an idea's label is drawn at a zoom: its type size × `labelScale` × labelGrowth(zoom).idea, wrapped inside the\n * idea's shape (wrapInShape with the same profile ideaSize used). Grow first, then wrap: a grown label takes more,\n * shorter lines and never crosses the outline (the idea itself never resizes with zoom; ideaSize made it big enough\n * for the largest growth). `px` and `lineHeight` are in map units — draw them inside the map's transform, centered,\n * one line after another. */\nexport function labelLayout(kind: IdeaKind, label: string, size: { rx: number; ry: number }, zoom: number, measure: (text: string, px: number) => number, labelScale = 1, profile: ShapeProfile = ELLIPSE) {\n const base = IDEA.labelSize[kind] * labelScale;\n const px = base * labelGrowth(zoom).idea, lineHeight = px * IDEA.labelLineHeight;\n // Lines are wrapped at layoutGrowth (the growth rounded up to a step), so they hold across a zoom range and can be\n // cached; the label is drawn at `px`, never larger than they were wrapped for, so every line still fits.\n const lpx = base * layoutGrowth(zoom), lh = lpx * IDEA.labelLineHeight;\n return { px, lineHeight, lines: wrapInShape(label, lh, profile(size.rx, size.ry), wordsMeasure((t) => measure(t, lpx))) };\n}\n\n/** The growth a label's lines are wrapped at: labelGrowth(zoom).idea rounded up to the next LABEL_GROWTH.layoutStep\n * (never above LABEL_GROWTH.idea). Renderers key cached layouts by it. */\nexport function layoutGrowth(zoom: number): number {\n const g = labelGrowth(zoom).idea, step = LABEL_GROWTH.layoutStep;\n return Math.min(LABEL_GROWTH.idea, Math.ceil(g / step - 1e-9) * step);\n}\n\nexport function labelGrowth(scale: number): { idea: number; connector: number } {\n const inv = 1 / Math.max(scale, 0.0001);\n return { idea: Math.max(1, Math.min(inv, LABEL_GROWTH.idea)), connector: Math.max(1, Math.min(inv, LABEL_GROWTH.connector)) };\n}\n","// ─── Idea size and label growth ──────────────────────────────────────────────\n//\n// The design system's idea.ts (copied verbatim into generated/geometry): an idea\n// grows to show its whole label, and labels grow a little when zoomed out. The\n// SDK only supplies the text measurement (its font engine) and picks the kind.\n\nimport { ELLIPSE, IDEA, LABEL_GROWTH, ideaSize, labelGrowth, labelLayout, layoutGrowth, lineWidthsInShape, wrapInShape, wrapLines, type IdeaKind, type ShapeProfile } from '../generated/geometry/idea.js';\nimport type { VisualliLayer } from '../types/layer.js';\n\nexport { ELLIPSE, IDEA, LABEL_GROWTH, ideaSize, labelGrowth, labelLayout, layoutGrowth, lineWidthsInShape, wrapInShape, wrapLines };\nexport type { IdeaKind, ShapeProfile };\n\n/** Width in px of `text` in the idea label's face at `px` (the label's weight; readable type adds its tracking). */\nexport type IdeaMeasure = (text: string, px: number) => number;\n\n/** Measurement without a font engine (server, tests): half an em per character. Renderers pass the real face. */\nexport const approximateMeasure: IdeaMeasure = (text, px) => text.length * px * 0.5;\n\n/** The size kind of the `index`-th idea of a layer: the centre of the root radial layer is the root, the rest ideas. */\nexport const ideaKindOf = (layer: Pick<VisualliLayer, 'level' | 'layout'>, index: number): IdeaKind =>\n layer.level === 0 && (layer.layout ?? 'radial') === 'radial' && index === 0 ? 'root' : 'node';\n","// Generated from visualli.ai design-system/components/src/blobShapes.ts — do not edit here.\n// The six hand-authored Visualli node outlines, in normalized units (rx = ry = 1).\n// Copied verbatim from the web app (features/canvas/config/blobShapes.ts). Shape 0 is the root shape.\nexport const BLOB_SHAPES: number[][][] = [[[1.12,0.0],[0.86,0.56],[0.46,0.94],[-0.08,1.06],[-0.68,0.82],[-0.96,0.08],[-0.55,-0.82],[0.04,-1.02],[0.72,-0.8],[1.08,-0.38]],[[-0.489,-0.625],[-0.384,-0.716],[-0.285,-0.792],[-0.189,-0.855],[-0.09,-0.903],[0.014,-0.932],[0.129,-0.94],[0.255,-0.924],[0.412,-0.876],[0.516,-0.832],[0.612,-0.78],[0.695,-0.725],[0.767,-0.666],[0.83,-0.606],[0.885,-0.546],[0.933,-0.486],[0.979,-0.425],[1.006,-0.385],[1.034,-0.334],[1.058,-0.276],[1.078,-0.209],[1.092,-0.133],[1.101,-0.046],[1.102,0.052],[1.094,0.173],[1.083,0.244],[1.063,0.324],[1.034,0.401],[0.996,0.477],[0.948,0.549],[0.889,0.617],[0.82,0.681],[0.735,0.741],[0.658,0.783],[0.569,0.822],[0.474,0.855],[0.372,0.882],[0.265,0.904],[0.156,0.92],[0.046,0.931],[-0.069,0.938],[-0.155,0.935],[-0.25,0.919],[-0.346,0.89],[-0.443,0.851],[-0.539,0.8],[-0.633,0.738],[-0.723,0.667],[-0.808,0.585],[-0.882,0.501],[-0.944,0.421],[-0.994,0.343],[-1.034,0.267],[-1.064,0.192],[-1.085,0.12],[-1.097,0.042],[-1.102,0.001],[-1.09,-0.243],[-1.05,-0.365],[-0.99,-0.441],[-0.911,-0.479],[-0.819,-0.499],[-0.715,-0.517],[-0.605,-0.551]],[[0.003,-0.97],[0.163,-0.984],[0.286,-1.028],[0.389,-1.096],[0.488,-1.174],[0.597,-1.21],[0.728,-1.165],[0.867,-1.036],[0.996,-0.839],[1.098,-0.59],[1.158,-0.304],[1.153,0.012],[1.08,0.336],[0.944,0.639],[0.756,0.889],[0.484,1.072],[0.339,1.079],[0.219,1.051],[0.131,0.994],[0.059,0.939],[0.008,0.915],[-0.105,0.931],[-0.176,0.965],[-0.249,1.005],[-0.345,1.039],[-0.497,1.055],[-0.672,1.032],[-0.817,0.952],[-0.945,0.81],[-1.054,0.6],[-1.16,0.302],[-1.187,-0.011],[-1.165,-0.326],[-1.097,-0.599],[-0.991,-0.838],[-0.852,-0.912],[-0.695,-0.958],[-0.53,-0.988],[-0.357,-0.992],[-0.18,-0.983]],[[-0.734,-1.127],[-0.656,-1.146],[-0.567,-1.142],[-0.468,-1.115],[-0.358,-1.079],[-0.238,-1.034],[-0.107,-0.989],[0.035,-0.953],[0.188,-0.929],[0.325,-0.916],[0.484,-0.896],[0.65,-0.854],[0.811,-0.77],[0.955,-0.631],[1.068,-0.422],[1.138,-0.126],[1.152,0.272],[1.121,0.451],[1.046,0.602],[0.928,0.727],[0.767,0.833],[0.565,0.925],[0.323,1.001],[0.042,1.075],[-0.277,1.142],[-0.368,1.147],[-0.475,1.136],[-0.589,1.104],[-0.704,1.05],[-0.815,0.973],[-0.913,0.871],[-0.993,0.746],[-1.048,0.593],[-1.109,0.298],[-1.145,0.018],[-1.154,-0.243],[-1.135,-0.482],[-1.085,-0.695],[-1.003,-0.874],[-0.886,-1.02]],[[-0.734,1.127],[-0.656,1.146],[-0.567,1.142],[-0.468,1.115],[-0.358,1.079],[-0.238,1.034],[-0.107,0.989],[0.035,0.953],[0.188,0.929],[0.325,0.916],[0.484,0.896],[0.65,0.854],[0.811,0.77],[0.955,0.631],[1.068,0.422],[1.138,0.126],[1.152,-0.272],[1.121,-0.451],[1.046,-0.602],[0.928,-0.727],[0.767,-0.833],[0.565,-0.925],[0.323,-1.001],[0.042,-1.075],[-0.277,-1.142],[-0.368,-1.147],[-0.475,-1.136],[-0.589,-1.104],[-0.704,-1.05],[-0.815,-0.973],[-0.913,-0.871],[-0.993,-0.746],[-1.048,-0.593],[-1.109,-0.298],[-1.145,-0.018],[-1.154,0.243],[-1.135,0.482],[-1.085,0.695],[-1.003,0.874],[-0.886,1.02]],[[0.001,-1.006],[0.134,-1.001],[0.262,-1.024],[0.382,-1.073],[0.498,-1.107],[0.614,-1.105],[0.733,-1.049],[0.85,-0.932],[0.953,-0.755],[1.03,-0.529],[1.067,-0.265],[1.054,0.018],[0.986,0.3],[0.868,0.557],[0.715,0.766],[0.55,0.909],[0.396,0.984],[0.262,1.005],[0.148,1.003],[0.037,1.008],[-0.083,1.04],[-0.22,1.118],[-0.36,1.192],[-0.5,1.234],[-0.65,1.175],[-0.81,1.045],[-0.99,0.855],[-1.14,0.61],[-1.24,0.33],[-1.27,0.04],[-1.275,-0.25],[-1.225,-0.5],[-1.08,-0.72],[-0.89,-0.92],[-0.734,-1.053],[-0.614,-1.112],[-0.498,-1.127],[-0.381,-1.11],[-0.261,-1.095],[-0.133,-1.058],[0.001,-1.01],[0.134,-1.001]]];\n","// Generated from visualli.ai design-system/components/src/blob.ts — do not edit here.\nimport { BLOB_SHAPES } from './blobShapes';\nexport { BLOB_SHAPES };\n\n/** Which outline ideas take. Every idea, at every depth, has the same shape (`idea`, the shape of the map's centre);\n * depth shows through the depth trail, rings, the layer tint and the step-inside motion. The other authored shapes\n * stay in BLOB_SHAPES for explicit use (`Node shape`); `varyByLevel: true` brings back one shape per level. */\nexport const SHAPE: { idea: number; varyByLevel: boolean } = { idea: 0, varyByLevel: false };\n\n/** Shape for a layer level: SHAPE.idea for every level. With SHAPE.varyByLevel, level 0 is SHAPE.idea and consecutive\n * levels never repeat. */\nexport function shapeForLevel(level: number): number {\n if (!SHAPE.varyByLevel) return SHAPE.idea;\n const n = BLOB_SHAPES.length;\n let cur = SHAPE.idea;\n for (let i = 1; i <= level; i++) {\n const r = Math.floor(Math.abs(Math.sin((i + 1) * 12.9898) * 43758.5453));\n cur = (cur + (r % (n - 1)) + 1) % n;\n }\n return cur;\n}\n\n/** SVG path of a node outline centered on (cx, cy): midpoint-quadratic smoothing through the authored points. */\nexport function blobPath(shape: number, rx: number, ry: number, cx = 0, cy = 0): string {\n const pts = BLOB_SHAPES[((shape % BLOB_SHAPES.length) + BLOB_SHAPES.length) % BLOB_SHAPES.length].map(([x, y]) => [cx + x * rx, cy + y * ry]);\n const mid = (a: number[], b: number[]) => [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];\n const f = (n: number) => n.toFixed(2);\n const start = mid(pts[pts.length - 1], pts[0]);\n let d = `M${f(start[0])} ${f(start[1])}`;\n for (let i = 0; i < pts.length; i++) {\n const p = pts[i], m = mid(p, pts[(i + 1) % pts.length]);\n d += `Q${f(p[0])} ${f(p[1])} ${f(m[0])} ${f(m[1])}`;\n }\n return d + 'Z';\n}\n\n/** The path calls drawBlob makes: satisfied by a CanvasRenderingContext2D and by Konva's Context (sceneFunc / hitFunc). */\nexport type PathContext = { beginPath(): void; moveTo(x: number, y: number): void; quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; closePath(): void };\n\n/** Canvas twin of blobPath — call fill()/stroke() after (in Konva: ctx.fillStrokeShape(shape)). */\nexport function drawBlob(ctx: PathContext, shape: number, rx: number, ry: number, cx = 0, cy = 0) {\n const pts = BLOB_SHAPES[((shape % BLOB_SHAPES.length) + BLOB_SHAPES.length) % BLOB_SHAPES.length].map(([x, y]) => [cx + x * rx, cy + y * ry]);\n const mid = (a: number[], b: number[]) => [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];\n const s = mid(pts[pts.length - 1], pts[0]);\n ctx.beginPath();\n ctx.moveTo(s[0], s[1]);\n pts.forEach((p, i) => { const m = mid(p, pts[(i + 1) % pts.length]); ctx.quadraticCurveTo(p[0], p[1], m[0], m[1]); });\n ctx.closePath();\n}\n\n/** Distance from the center to the smoothed outline (blobPath) in direction `angle` (radians, SVG y-down).\n * Connectors use it to start and end just outside the outline an idea actually has, not a stand-in ellipse. */\n/** The outline as a polygon: the midpoint-quadratic curve sampled 8 times per segment. */\nfunction blobPolygon(shape: number, rx: number, ry: number): number[][] {\n const pts = BLOB_SHAPES[((shape % BLOB_SHAPES.length) + BLOB_SHAPES.length) % BLOB_SHAPES.length].map(([x, y]) => [x * rx, y * ry]);\n const mid = (a: number[], b: number[]) => [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];\n const poly: number[][] = [];\n for (let i = 0; i < pts.length; i++) {\n const p0 = mid(pts[(i - 1 + pts.length) % pts.length], pts[i]), c = pts[i], p1 = mid(pts[i], pts[(i + 1) % pts.length]);\n for (let k = 0; k < 8; k++) { const t = k / 8, u = 1 - t; poly.push([u * u * p0[0] + 2 * u * t * c[0] + t * t * p1[0], u * u * p0[1] + 2 * u * t * c[1] + t * t * p1[1]]); }\n }\n return poly;\n}\n\n/** The shape's profile for label wrapping (idea.ts ShapeProfile): for an idea of half-size rx × ry, how far a centered\n * line at height y (from the center) can reach before it meets the outline — the nearer of the outline's left and\n * right edges at that height, 0 outside it. Labels wrap inside the real shape, so a new shape needs no new label rule. */\nconst profiles = new Map<string, (y: number) => number>();\nexport function blobProfile(shape: number): (rx: number, ry: number) => (y: number) => number {\n return (rx, ry) => {\n const key = `${shape}|${rx}|${ry}`, hit = profiles.get(key);\n if (hit) return hit;\n const poly = blobPolygon(shape, rx, ry);\n const at = new Map<number, number>(); // the same heights come up again and again while wrapping\n const fn = (y: number) => {\n const seen = at.get(y);\n if (seen !== undefined) return seen;\n let left = 0, right = 0;\n for (let i = 0; i < poly.length; i++) {\n const [ax, ay] = poly[i], [bx, by] = poly[(i + 1) % poly.length];\n if ((ay <= y && by > y) || (by <= y && ay > y)) { const x = ax + ((y - ay) / (by - ay)) * (bx - ax); if (x < left) left = x; if (x > right) right = x; }\n }\n const half = Math.max(0, Math.min(-left, right));\n if (at.size < 256) at.set(y, half);\n return half;\n };\n if (profiles.size > 2048) profiles.clear();\n profiles.set(key, fn);\n return fn;\n };\n}\n\nexport function blobRadius(shape: number, rx: number, ry: number, angle: number): number {\n // Cast a ray from the center to the sampled outline.\n const poly = blobPolygon(shape, rx, ry);\n const dx = Math.cos(angle), dy = Math.sin(angle);\n let best = 0;\n for (let i = 0; i < poly.length; i++) {\n const [ax, ay] = poly[i], [bx, by] = poly[(i + 1) % poly.length], ex = bx - ax, ey = by - ay;\n const den = dx * ey - dy * ex;\n if (Math.abs(den) < 1e-9) continue;\n const r = (ax * ey - ay * ex) / den, q = (ax * dy - ay * dx) / den;\n if (r > 0 && q >= 0 && q <= 1) best = Math.max(best, r);\n }\n return best || Math.max(rx, ry);\n}\n\n/** Ring recipe: index 0 is the innermost ring. A node shows min(childLayers, 3) rings. `opacity` is the halo (the ring's\n * fill); `strokeOpacity` is its outline, drawn at full strength so the ring — the \"there is more inside\" cue — reads at\n * 3:1 against the canvas and the halos (the `topic-*-ring` tokens are chosen for that in every theme). */\nexport const RINGS = [\n { scale: 1.1, opacity: 0.5, strokeOpacity: 1, rotate: -5, width: 2, dash: '' },\n { scale: 1.2, opacity: 0.4, strokeOpacity: 1, rotate: -10, width: 1, dash: '' },\n { scale: 1.3, opacity: 0.3, strokeOpacity: 1, rotate: -15, width: 3, dash: '6 4' },\n];\n\n/** Connector geometry: a cubic that bows perpendicular to the chord, flatter as distance grows. */\nexport function edgePath(a: { x: number; y: number }, b: { x: number; y: number }, bow = 1) {\n const dx = b.x - a.x, dy = b.y - a.y, d = Math.hypot(dx, dy) || 1;\n const arc = Math.min(45, 45 / (1 + Math.max(0, (d - 200) / 400))) * bow;\n const nx = -dy / d, ny = dx / d;\n const mx = (a.x + b.x) / 2 + nx * arc, my = (a.y + b.y) / 2 + ny * arc;\n const c1 = { x: a.x + (mx - a.x) * 0.66 + 0, y: a.y + (my - a.y) * 0.66 };\n const c2 = { x: b.x + (mx - b.x) * 0.66, y: b.y + (my - b.y) * 0.66 };\n const ang = Math.atan2(b.y - c2.y, b.x - c2.x);\n return { d: `M${a.x.toFixed(1)} ${a.y.toFixed(1)}C${c1.x.toFixed(1)} ${c1.y.toFixed(1)} ${c2.x.toFixed(1)} ${c2.y.toFixed(1)} ${b.x.toFixed(1)} ${b.y.toFixed(1)}`, angle: ang, mid: { x: mx, y: my } };\n}\n\n/** Open V arrowhead at point p, pointing along angle. */\nexport function arrowPath(p: { x: number; y: number }, angle: number, len = 11) {\n const s = Math.PI / 5.5;\n const a1 = { x: p.x - len * Math.cos(angle - s), y: p.y - len * Math.sin(angle - s) };\n const a2 = { x: p.x - len * Math.cos(angle + s), y: p.y - len * Math.sin(angle + s) };\n return `M${a1.x.toFixed(1)} ${a1.y.toFixed(1)}L${p.x.toFixed(1)} ${p.y.toFixed(1)}L${a2.x.toFixed(1)} ${a2.y.toFixed(1)}`;\n}\n","// ─── Node & connector geometry ───────────────────────────────────────────────\n//\n// Thin layer over the design system's geometry (generated/geometry/blob.ts):\n// it chooses the radii, shapes, rings and endpoints for a FlatNode and never\n// re-implements outline or curve math. Pure functions, no DOM.\n\nimport { BLOB_SHAPES, RINGS, SHAPE, arrowPath, blobPath, blobProfile, blobRadius, edgePath, shapeForLevel } from '../generated/geometry/blob.js';\nimport { METRICS } from '../generated/designSystem.js';\nimport type { FlatNode } from '../types/mindmap.js';\n\n// The design system's geometry is part of the public API (single source of truth).\nexport { BLOB_SHAPES, RINGS, SHAPE, arrowPath, blobPath, blobProfile, blobRadius, edgePath, shapeForLevel };\nexport { drawBlob } from '../generated/geometry/blob.js';\n\n/** Minimum a node needs to be drawn / connected. */\nexport type NodeLike = Pick<FlatNode, 'x' | 'y' | 'width' | 'height' | 'level' | 'branchCount'>;\n\nexport const MAX_RINGS = RINGS.length;\nconst DEG = Math.PI / 180;\n\n/** Outline radii of an idea: half its size (sized for its label by the design system's idea.ts). */\nexport function nodeRadii(n: Pick<FlatNode, 'width' | 'height'>): { rx: number; ry: number } {\n return { rx: n.width / 2, ry: n.height / 2 };\n}\n\n/** Rings an idea shows: one per layer beneath it, at most 3. */\nexport const ringCount = (branchCount: number | undefined): number => Math.max(0, Math.min(branchCount ?? 0, MAX_RINGS));\n\n/** The design system's ring recipes an idea shows, innermost first (index 0 = scale 1.1). */\nexport const ringsFor = (branchCount: number | undefined): typeof RINGS => RINGS.slice(0, ringCount(branchCount));\n\nconst shapeCache = new Map<number, number>();\n/** Outline shape for a layer level (memoised: shapeForLevel is O(level)). */\nexport function shapeOfLevel(level: number): number {\n let s = shapeCache.get(level);\n if (s === undefined) { s = shapeForLevel(level); shapeCache.set(level, s); }\n return s;\n}\n\n/** Largest distance from a blob's centre to any control point, in units of max(rx, ry). */\nconst BLOB_MAX_NORM = Math.max(...BLOB_SHAPES.flatMap((s) => s.map(([x, y]) => Math.hypot(x!, y!))));\n\n/** Visual margin around an idea beyond its outline: stroke, hover lift and the node shadow. */\nconst VISUAL_MARGIN = METRICS.nodeStroke * 2 + 24;\n\n/**\n * Conservative world-space bounds of everything drawn for an idea (rings and\n * stroke included). Ideas are drawn CENTRED on (x, y), so bounds are centred\n * too. A circle bound is used so ring rotation can never push ink outside it.\n */\nexport function nodeBounds(n: NodeLike): { minX: number; minY: number; maxX: number; maxY: number } {\n const { rx, ry } = nodeRadii(n);\n const rings = ringCount(n.branchCount);\n const scale = rings > 0 ? RINGS[rings - 1]!.scale : 1;\n const r = BLOB_MAX_NORM * Math.max(rx, ry) * scale + VISUAL_MARGIN;\n return { minX: n.x - r, minY: n.y - r, maxX: n.x + r, maxY: n.y + r };\n}\n\n/**\n * Distance from an idea's centre to the outline connectors must clear, in the\n * world direction `angle` (radians, y down). That is the outermost visible\n * ring (rotated like the ring is drawn), or the body when there are no rings.\n */\nexport function outlineRadius(n: NodeLike, angle: number): number {\n const { rx, ry } = nodeRadii(n);\n const shape = shapeOfLevel(n.level);\n const rings = ringCount(n.branchCount);\n if (rings === 0) return blobRadius(shape, rx, ry, angle);\n const ring = RINGS[rings - 1]!;\n // The ring is the same blob scaled and rotated about the centre, so look up\n // the radius in the ring's own frame.\n return blobRadius(shape, rx * ring.scale, ry * ring.scale, angle - ring.rotate * DEG);\n}\n\nexport interface ConnectorGeometry {\n /** Start / end points: `edge-gap` outside the source / target outline. */\n a: { x: number; y: number };\n b: { x: number; y: number };\n /** Cubic path data (SVG syntax) and the arrowhead direction, from the design system's edgePath. */\n d: string;\n angle: number;\n /** Bow apex returned by edgePath, where the connector label sits. */\n mid: { x: number; y: number };\n /** Open arrowhead path data at b, from the design system's arrowPath. */\n arrow: string;\n}\n\n/** Endpoints and curve of a connector between two ideas. */\nexport function connectorGeometry(from: NodeLike, to: NodeLike, gap: number = METRICS.edgeGap): ConnectorGeometry {\n const theta = Math.atan2(to.y - from.y, to.x - from.x);\n const ra = outlineRadius(from, theta) + gap;\n const rb = outlineRadius(to, theta + Math.PI) + gap;\n const a = { x: from.x + Math.cos(theta) * ra, y: from.y + Math.sin(theta) * ra };\n const b = { x: to.x - Math.cos(theta) * rb, y: to.y - Math.sin(theta) * rb };\n const e = edgePath(a, b);\n return { a, b, d: e.d, angle: e.angle, mid: e.mid, arrow: arrowPath(b, e.angle) };\n}\n","// ─── .visualli → FlatNode Converter ──────────────────────────────────────────\n//\n// Transforms the layer-based .visualli format into the flat Map<id, FlatNode>\n// structure consumed by the canvas renderer.\n\nimport type { VisualliDocument } from '../types/document.js';\nimport type { VisualliLayer } from '../types/layer.js';\nimport type { FlatNode, NodeMap } from '../types/mindmap.js';\nimport { countLayersBeneath } from './visualliParser.js';\nimport { ideaColor } from '../theme/index.js';\nimport { approximateMeasure, ideaKindOf, ideaSize, type IdeaMeasure } from '../rendering/ideaSize.js';\nimport { blobProfile, shapeOfLevel } from '../rendering/nodeGeometry.js';\nimport { applyCircularLayout, calculateOptimalRadiusPercentage } from '../layout/circularLayout.js';\nimport { applyLinearHorizontalLayout, applyLinearVerticalLayout } from '../layout/linearLayout.js';\n\n// ── Overlap Resolution ────────────────────────────────────────────────────────\n\nfunction doNodesOverlap(n1: FlatNode, n2: FlatNode, padding = 20): boolean {\n return !(\n n1.x + n1.width / 2 + padding < n2.x - n2.width / 2 - padding ||\n n1.x - n1.width / 2 - padding > n2.x + n2.width / 2 + padding ||\n n1.y + n1.height / 2 + padding < n2.y - n2.height / 2 - padding ||\n n1.y - n1.height / 2 - padding > n2.y + n2.height / 2 + padding\n );\n}\n\n/** Iteratively push overlapping nodes apart using symmetric force separation. */\nexport function resolveNodeOverlaps(nodes: FlatNode[], maxIterations = 10): void {\n const padding = 150;\n\n for (let iter = 0; iter < maxIterations; iter++) {\n let any = false;\n for (let i = 0; i < nodes.length; i++) {\n for (let j = i + 1; j < nodes.length; j++) {\n const n1 = nodes[i];\n const n2 = nodes[j];\n if (!doNodesOverlap(n1, n2, padding)) continue;\n\n any = true;\n const dx = n2.x - n1.x;\n const dy = n2.y - n1.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n\n if (dist < 1) {\n n2.x += n2.width / 2 + padding;\n continue;\n }\n\n const minDist = (n1.width + n2.width) / 2 + padding;\n if (dist < minDist) {\n const push = (minDist - dist) / 2;\n n1.x -= (dx / dist) * push;\n n1.y -= (dy / dist) * push;\n n2.x += (dx / dist) * push;\n n2.y += (dy / dist) * push;\n }\n }\n }\n if (!any) break;\n }\n}\n\n// ── Options ───────────────────────────────────────────────────────────────────\n\nexport interface ConvertOptions {\n /** Measures label text in the idea face (the renderer's font engine); ideas are sized with the design system's\n * ideaSize. Defaults to an approximation (half an em per character) where no font engine exists. */\n measure?: IdeaMeasure;\n /** Label scale (comfort: larger text is 1.15); ideas grow to fit the larger label. */\n labelScale?: number;\n}\n\n/** Whether a layer's ideas carry their own positions: every idea has one, and (with more than one idea) they aren't\n * all on the same spot (a placeholder). Then the file's positions are used as they are. */\nfunction hasFilePositions(layer: VisualliLayer): boolean {\n const ps = layer.nodes.map((n) => n.position);\n if (!ps.length || !ps.every((p) => p && Number.isFinite(p.x) && Number.isFinite(p.y))) return false;\n return ps.length === 1 || ps.some((p) => p!.x !== ps[0]!.x || p!.y !== ps[0]!.y);\n}\n\n// ── Container-formation Layout ────────────────────────────────────────────────\n\ninterface Proxy { id: string; x: number; y: number; width: number; height: number }\n\nfunction applyFormation(nodes: FlatNode[], formation: string): void {\n if (nodes.length === 0) return;\n if (nodes.length === 1) { nodes[0].x = 0; nodes[0].y = 0; return; }\n if (formation === 'linear-horizontal' || formation === 'linear') {\n applyLinearHorizontalLayout(nodes, { centerX: 0, centerY: 0 });\n } else if (formation === 'linear-vertical') {\n applyLinearVerticalLayout(nodes, { centerX: 0, centerY: 0 });\n } else {\n const r = Math.max(250, nodes.length * 70);\n const step = (2 * Math.PI) / nodes.length;\n for (let i = 0; i < nodes.length; i++) {\n nodes[i].x = r * Math.cos(i * step);\n nodes[i].y = r * Math.sin(i * step);\n }\n }\n}\n\nfunction containerBBox(nodes: FlatNode[], padding: number): { width: number; height: number } {\n let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;\n for (const n of nodes) {\n minX = Math.min(minX, n.x - n.width / 2);\n maxX = Math.max(maxX, n.x + n.width / 2);\n minY = Math.min(minY, n.y - n.height / 2);\n maxY = Math.max(maxY, n.y + n.height / 2);\n }\n return { width: maxX - minX + padding * 2, height: maxY - minY + padding * 2 };\n}\n\nfunction proxyLinearH(proxies: Proxy[], gap = 180): void {\n const total = proxies.reduce((s, p) => s + p.width, 0) + gap * (proxies.length - 1);\n let x = -total / 2;\n for (const p of proxies) { p.x = x + p.width / 2; p.y = 0; x += p.width + gap; }\n}\n\nfunction proxyLinearV(proxies: Proxy[], gap = 180): void {\n const total = proxies.reduce((s, p) => s + p.height, 0) + gap * (proxies.length - 1);\n let y = -total / 2;\n for (const p of proxies) { p.x = 0; p.y = y + p.height / 2; y += p.height + gap; }\n}\n\nfunction proxyRadial(proxies: Proxy[], radius = 500): void {\n if (proxies.length === 1) { proxies[0].x = 0; proxies[0].y = 0; return; }\n // Start at top (12 o'clock) for n>=3, horizontal for n=2 (matches circular layout)\n const startAngle = proxies.length === 2 ? 0 : -Math.PI / 2;\n const step = (2 * Math.PI) / proxies.length;\n for (let i = 0; i < proxies.length; i++) {\n const angle = startAngle + i * step;\n proxies[i].x = radius * Math.cos(angle);\n proxies[i].y = radius * Math.sin(angle);\n }\n}\n\n// ── Layer Conversion ──────────────────────────────────────────────────────────\n\nfunction makeFlatNode(\n node: VisualliLayer['nodes'][number],\n layer: VisualliLayer,\n doc: VisualliDocument,\n /** Position among the layer's ideas (file order): missing colours cycle the topics by it, and the first idea of the root radial layer is the root. */\n siblingIndex: number,\n opts: ConvertOptions,\n): FlatNode {\n const label = Array.isArray(node.data.label) ? (node.data.label as string[]).join(' ') : (node.data.label || 'Untitled');\n const branchCount = countLayersBeneath(doc, node.id);\n const kind = ideaKindOf(layer, siblingIndex);\n // Sized so the label wraps inside the idea's own blob (the design system's blobProfile).\n const size = ideaSize(kind, label, opts.measure ?? approximateMeasure, opts.labelScale ?? 1, blobProfile(shapeOfLevel(layer.level)));\n const { topic, custom } = ideaColor(node.data.color, siblingIndex);\n return {\n id: node.id,\n parentId: layer.parentNodeId ?? null,\n x: node.position?.x ?? 0,\n y: node.position?.y ?? 0,\n level: layer.level,\n title: label,\n description: node.data.summary || '',\n color: node.data.color ?? '',\n ...(topic ? { topic } : {}),\n ...(custom ? { custom } : {}),\n kind,\n width: size.width,\n height: size.height,\n isExpanded: branchCount > 0,\n branchCount,\n createdAt: new Date(),\n updatedAt: new Date(),\n };\n}\n\nfunction layoutLayerWithContainers(layer: VisualliLayer, flatNodes: FlatNode[]): void {\n const PADDING = 80;\n const byId = new Map(flatNodes.map((n: FlatNode) => [n.id, n]));\n const containerNodeIds = new Set<string>();\n const containerGroups = new Map<string, FlatNode[]>();\n\n for (const container of layer.containers) {\n const group = container.nodes.map((id: string) => byId.get(id)).filter((n: FlatNode | undefined): n is FlatNode => !!n);\n if (!group.length) continue;\n container.nodes.forEach((id: string) => containerNodeIds.add(id));\n const formation = ((container.data as unknown as Record<string, unknown> | undefined)?.['formation'] as string | undefined) ?? 'radial';\n applyFormation(group, formation);\n containerGroups.set(container.id, group);\n }\n\n const proxies: Proxy[] = [];\n for (const n of flatNodes) {\n if (!containerNodeIds.has(n.id)) proxies.push({ id: n.id, x: 0, y: 0, width: n.width, height: n.height });\n }\n for (const container of layer.containers) {\n const group = containerGroups.get(container.id);\n if (!group?.length) continue;\n const bbox = containerBBox(group, PADDING);\n proxies.push({ id: `__c__${container.id}`, x: 0, y: 0, width: bbox.width, height: bbox.height });\n }\n\n const layout = layer.layout || 'radial';\n if (layout === 'linear-horizontal') proxyLinearH(proxies, 180);\n else if (layout === 'linear-vertical') proxyLinearV(proxies, 180);\n else proxyRadial(proxies, 500);\n\n for (const proxy of proxies) {\n if (proxy.id.startsWith('__c__')) {\n const group = containerGroups.get(proxy.id.slice(5));\n group?.forEach(n => { n.x += proxy.x; n.y += proxy.y; });\n } else {\n const fn = byId.get(proxy.id);\n if (fn) { fn.x = proxy.x; fn.y = proxy.y; }\n }\n }\n}\n\nfunction layoutLayer(layer: VisualliLayer, flatNodes: FlatNode[]): void {\n const layout = layer.layout || 'radial';\n if (layout === 'linear-horizontal') {\n applyLinearHorizontalLayout(flatNodes, { centerX: 0, centerY: 0 });\n } else if (layout === 'linear-vertical') {\n applyLinearVerticalLayout(flatNodes, { centerX: 0, centerY: 0 });\n } else {\n const pct = calculateOptimalRadiusPercentage(flatNodes.length, 2000, 2000, 200, 30);\n applyCircularLayout(flatNodes, {\n radiusPercentage: pct,\n containerWidth: 2000,\n containerHeight: 2000,\n centerX: 0,\n centerY: 0,\n });\n }\n}\n\n/**\n * Convert a single layer to an array of FlatNode objects, each sized for its label\n * (the design system's idea.ts) and coloured by its colour rule (color.ts).\n * Positions: the file's own when its ideas carry them; otherwise the SDK lays the\n * layer out by `layer.layout` (default radial) and container formations.\n */\nexport function convertLayerToFlatNodes(\n layer: VisualliLayer,\n doc: VisualliDocument,\n opts: ConvertOptions = {},\n): FlatNode[] {\n const flatNodes = layer.nodes.map((node, i) => makeFlatNode(node, layer, doc, i, opts));\n if (flatNodes.length === 0 || hasFilePositions(layer)) return flatNodes;\n for (const n of flatNodes) { n.x = 0; n.y = 0; }\n if ((layer.containers ?? []).length > 0) layoutLayerWithContainers(layer, flatNodes);\n else layoutLayer(layer, flatNodes);\n resolveNodeOverlaps(flatNodes);\n return flatNodes;\n}\n\n/**\n * Convert an entire .visualli document to a flat NodeMap.\n * All layers are converted and a children-index is built for O(1) tree traversal.\n */\nexport function convertVisualliToFlatNodes(doc: VisualliDocument, opts: ConvertOptions = {}): NodeMap {\n const map: NodeMap = new Map();\n\n for (const layer of doc.layers.values()) {\n for (const node of convertLayerToFlatNodes(layer, doc, opts)) {\n map.set(node.id, node);\n }\n }\n\n // Build children index in linear time O(N)\n for (const node of map.values()) {\n node.childrenIds = [];\n }\n for (const node of map.values()) {\n if (node.parentId) {\n const parent = map.get(node.parentId);\n if (parent) {\n (parent.childrenIds ??= []).push(node.id);\n }\n }\n }\n\n return map;\n}\n\n/**\n * Get flat nodes for a specific layer only.\n *\n * @param doc - Parsed .visualli document\n * @param layerId - Layer ID to extract\n * @param opts - Text measurement and label scale for sizing ideas\n * @returns FlatNode array, or empty array if layer not found\n */\nexport function getNodesForLayer(doc: VisualliDocument, layerId: string, opts: ConvertOptions = {}): FlatNode[] {\n const layer = doc.layers.get(layerId);\n return layer ? convertLayerToFlatNodes(layer, doc, opts) : [];\n}\n","// ─── Mindmap Tree Utilities ───────────────────────────────────────────────────\n\nimport type { MindMapNode, TopLevelConnection } from '../types/mindmap.js';\n\n/** Flatten a nested MindMapNode tree into a depth-first array. */\nexport function flattenNodes(nodes: MindMapNode[]): MindMapNode[] {\n const result: MindMapNode[] = [];\n const traverse = (list: MindMapNode[]) => {\n for (const n of list) {\n result.push(n);\n if (n.children) traverse(n.children);\n }\n };\n traverse(nodes);\n return result;\n}\n\n/**\n * Return nodes visible at the given zoom level.\n *\n * At lower zoom values only top-level nodes are shown; each 5% zoom increment\n * reveals one additional hierarchy level.\n */\nexport function getVisibleNodes(\n nodes: MindMapNode[],\n zoom: number,\n focusedNode?: string,\n): MindMapNode[] {\n const flat = flattenNodes(nodes);\n\n if (focusedNode) {\n const focused = flat.find(n => n.id === focusedNode);\n if (focused) {\n return focused.children ? [focused, ...focused.children] : [focused];\n }\n }\n\n // Map zoom to max visible level (level 0 at ≤70%, +1 level per 5% increment)\n if (zoom <= 0.70) return flat.filter(n => n.level === 0);\n const maxLevel = Math.floor((zoom - 0.70) / 0.05);\n return flat.filter(n => n.level <= maxLevel);\n}\n\n/** Build parent→child connection pairs from the node tree. */\nexport function getNodeConnections(\n nodes: MindMapNode[],\n): Array<{ from: MindMapNode; to: MindMapNode; label?: string }> {\n const flat = flattenNodes(nodes);\n const result: Array<{ from: MindMapNode; to: MindMapNode; label?: string }> = [];\n for (const n of flat) {\n if (!n.parent) continue;\n const parent = flat.find(p => p.id === n.parent);\n if (parent) result.push({ from: parent, to: n, label: n.relationshipLabel });\n }\n return result;\n}\n\n/** Resolve top-level cross-connections to node pairs. */\nexport function getTopLevelConnections(\n nodes: MindMapNode[],\n topLevelConnections: TopLevelConnection[],\n): Array<{ from: MindMapNode; to: MindMapNode; label: string }> {\n const flat = flattenNodes(nodes);\n const result: Array<{ from: MindMapNode; to: MindMapNode; label: string }> = [];\n for (const conn of topLevelConnections) {\n const from = flat.find(n => n.id === conn.from);\n const to = flat.find(n => n.id === conn.to);\n if (from && to) result.push({ from, to, label: conn.label ?? '' });\n }\n return result;\n}\n\n/** Euclidean distance between two world-space points. */\nexport function calculateDistance(x1: number, y1: number, x2: number, y2: number): number {\n return Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2);\n}\n","// ─── Layout constants ────────────────────────────────────────────────────────\n//\n// Non-visual layout metrics (world units). Everything visual (colours, fonts,\n// radii, spacing, motion) comes from the design system: see ../theme.\n\nexport const LAYOUT_SPACING = {\n nodeSpacing: 200,\n levelSpacing: 150,\n containerPadding: 20,\n gridSize: 50,\n} as const;\n","// ─── MindMapConfig Utilities ──────────────────────────────────────────────────\n//\n// Helpers for creating and generating MindMapConfig objects (pure data, no UI).\n\nimport type { MindMapNode, MindMapConfig, TopLevelConnection } from '../types/mindmap.js';\nimport { LAYOUT_SPACING } from '../constants/layout.js';\nimport { TOKENS, TOPICS } from '../theme/index.js';\n\n/** Light-theme fill of the topic used for a level (cycles through the design-system topics). */\nconst levelColor = (level: number): string => TOKENS.light[`topic-${TOPICS[level % TOPICS.length]}`]!;\n\ntype LevelColors = { level0: string; level1: string; level2: string; level3: string; [key: `level${number}`]: string };\nconst levelColors = (count: number): LevelColors =>\n Object.fromEntries(Array.from({ length: count }, (_, i) => [`level${i}`, levelColor(i)])) as LevelColors;\n\nexport function createMindMapConfig(\n nodes: MindMapNode[],\n topLevelConnections: TopLevelConnection[],\n title = 'Untitled Mindmap',\n): MindMapConfig {\n const now = new Date().toISOString();\n return {\n metadata: {\n title,\n description: `Interactive mindmap with ${nodes.length} nodes`,\n version: '1.0.0',\n created: now,\n lastModified: now,\n },\n nodes,\n topLevelConnections,\n settings: {\n defaultColors: levelColors(4),\n layout: {\n nodeSpacing: LAYOUT_SPACING.nodeSpacing,\n levelSpacing: LAYOUT_SPACING.levelSpacing,\n },\n },\n };\n}\n\n// ── Sample Data Generator ─────────────────────────────────────────────────────\n\nfunction generateId(prefix: string, level: number, index: number): string {\n return `${prefix}-l${level}-${index}`;\n}\n\nfunction generateLevelNodes(\n parentId: string | null,\n level: number,\n maxLevels: number,\n xOffset = 0,\n yOffset = 0,\n): MindMapNode[] {\n if (level >= maxLevels) return [];\n\n const count = 5;\n const levelSpacing = 200;\n const nodeSpacing = 300;\n const nodes: MindMapNode[] = [];\n\n for (let i = 0; i < count; i++) {\n const nodeId = parentId\n ? generateId(`${parentId}-${i}`, level, i)\n : generateId('root', level, i);\n\n const x = xOffset + (i - (count - 1) / 2) * nodeSpacing;\n const y = yOffset + level * levelSpacing;\n\n const node: MindMapNode = {\n id: nodeId,\n title: `Level ${level} Node ${i + 1}`,\n level,\n x,\n y,\n color: levelColor(level),\n relationshipLabel: level > 0 ? 'child' : undefined,\n parent: parentId ?? undefined,\n };\n\n const children = generateLevelNodes(nodeId, level + 1, maxLevels, x, y + levelSpacing);\n if (children.length > 0) node.children = children;\n\n nodes.push(node);\n }\n\n return nodes;\n}\n\n/**\n * Generate a sample MindMapConfig with `maxLevels` of hierarchy.\n * Useful for testing and demos.\n */\nexport function generateSampleConfig(maxLevels = 9): MindMapConfig {\n const nodes = generateLevelNodes(null, 0, maxLevels, 0, 0);\n\n const topLevelConnections: TopLevelConnection[] = nodes.slice(0, -1).map((n, i) => ({\n from: n.id,\n to: nodes[i + 1].id,\n label: 'related to',\n }));\n\n return {\n metadata: {\n id: `mindmap-${Date.now()}`,\n title: 'Sample Mind Map',\n description: 'A sample mind map',\n version: '1.0.0',\n created: new Date().toISOString(),\n lastModified: new Date().toISOString(),\n },\n nodes,\n topLevelConnections,\n settings: {\n defaultColors: levelColors(9),\n layout: {\n nodeSpacing: LAYOUT_SPACING.nodeSpacing,\n levelSpacing: LAYOUT_SPACING.levelSpacing,\n },\n },\n };\n}\n","// Generated from visualli.ai design-system/components/src/interaction.ts — do not edit here.\n/* How the canvas answers the pointer and the keyboard — the timing and rules behind the peek (an idea's summary)\n and terms (semantic anchors: an underlined word and its definition card). The look and the pop-in animation live\n in the CSS (.vi-fact, .vi-anchor, .vi-anchor-card); these are the behaviours, as data, so every renderer (VisualMap,\n the spec SDK on a canvas) opens and closes them alike. Times in ms. No dependencies, so it can travel alone. */\n\n/** Terms (semantic anchors) in a peek's text. */\nexport const TERM = {\n /** Hovering the term this long opens its definition card… */ hoverOpen: 250,\n /** …which closes this long after the pointer leaves both the term and the card (moving between them keeps it open). */ hoverClose: 300,\n /** Only a mouse opens on hover; touch and pen open on tap. */ hoverPointers: ['mouse'] as readonly string[],\n /** A click, tap, Enter or Space pins the card open (hovering away doesn't close it); pressing again unpins and closes. */ clickPins: true,\n /** Escape closes the card and returns focus to the term; a press anywhere outside the term and its card closes it. */ escapeCloses: true, pressOutsideCloses: true,\n /** Opening by click or keyboard moves focus to the card's first link or button. */ focusCardOnOpen: true,\n /** The card is kept this far inside the viewport's left and right edges. */ viewportMargin: 8,\n /** The card's link to a source about the term. */ learnMoreLabel: 'Learn more',\n} as const;\n\n/** The peek: an idea's summary card on hover (pointer) or tap (touch). */\nexport const PEEK = {\n /** Hovering an idea opens its peek at once; it stays this long after the pointer leaves the idea (and while the\n * pointer is over the peek itself), so the pointer can travel from the idea onto the card. */ hoverClose: 180,\n} as const;\n\n/** The touch peek: a bottom sheet with a grip. */\nexport const SHEET = {\n /** Dragging the grip down this far closes the sheet (or collapses it when expanded); up this far expands it. */ dismissDrag: 80, expandDrag: 40,\n /** Its height: this share of the map, at most `maxHeight` px; the map pans the chosen idea into the space above it. */ heightRatio: 0.42, maxHeight: 300,\n} as const;\n\n/** Zoom, pan and fit. */\nexport const VIEW = {\n /** Each zoom step multiplies or divides the zoom by this. */ zoomStep: 1.2,\n /** Zoom limits (the zoom-min / zoom-max tokens; the build checks they agree). */ zoomMin: 0.3, zoomMax: 5,\n /** Fit to view never enlarges a layer beyond this. */ fitMax: 1.1,\n} as const;\n\n/** Touch gestures on the map (any touch input — phones, tablets and touchscreen laptops alike; it follows the pointer\n * in use, not the device, so a mouse or trackpad on the same laptop isn't affected). */\nexport const GESTURE = {\n /** Two fingers pinch to zoom the map's contents — ideas, connectors, containers and their labels — around the\n * point between the fingers, within VIEW's limits. Controls, the depth trail, the peek, chat and the page never scale. */ pinchZoom: true,\n /** Moving both fingers pans the contents. */ twoFingerPan: true,\n /** One finger on the empty canvas pans the contents too, on every surface (VI-040). A host whose map sits inside a\n * scrolling page can pass `gestures=\"cooperative\"` to give one finger back to the page (two fingers then move the map). */ oneFingerPan: true,\n /** The pointers that pinch (PointerEvent.pointerType). */ pointers: ['touch'] as readonly string[],\n /** The map takes every touch gesture (touch-action: none), so the browser never zooms or scrolls under it. With\n * `gestures=\"cooperative\"` one finger scrolls the page (touch-action: pan-x pan-y); two fingers move the map. */ appTouchAction: 'none', embeddedTouchAction: 'pan-x pan-y',\n /** Press and move on the empty canvas to pan the contents - mouse, pen and one finger. A press that moves less than\n * `panSlop` px is a click or a tap. */ dragPan: true,\n panPointers: ['mouse', 'pen', 'touch'] as readonly string[], panSlop: 6,\n /** Moving an idea starts once the press has moved this far (px), by pointerModeFor: a mouse ('hover') sooner, a finger\n * or pen ('touch') later, so taps still work. */\n ideaDragSlop: { hover: 4, touch: 10 },\n} as const;\n\n/** Going back a layer without the trail (VI-040): double-click empty canvas (not while editing - there it adds an idea)\n * or double-tap it. Never on an idea, a card, the trail or a control. At the top layer the\n * map gives a small bump instead. A double-tap whose first tap closed a peek doesn't also go back. */\nexport const BACK = {\n /** Two taps this close in time (ms) and place (px) are a double-tap. */ doubleTapMs: 300, doubleTapPx: 32,\n /** The bump at the top layer (ms). */ bumpMs: 320,\n} as const;\n\n/** The zoom buttons (− % +) are for screens with a mouse or trackpad. On a touch-only screen (a phone, a tablet\n * without a trackpad) people pinch to zoom, so the buttons stay out of the way: the spec CSS hides `.vi-map__ctrls`\n * under `@media not all and (hover: hover) and (pointer: fine)`, and the design system's VisualMap reads the same query.\n * A screen with any fine pointer (a touchscreen laptop, a tablet with a trackpad) keeps them. Pinch, wheel and keys\n * zoom everywhere. */\nexport const CONTROLS = {\n /** Where the zoom buttons show: a screen whose main pointer is a mouse or trackpad (it hovers and is fine). Not a\n * tablet with a stylus, which also has a fine pointer but is used by touch: there people pinch. */ zoomButtonsMedia: '(hover: hover) and (pointer: fine)',\n} as const;\n\n/** How the map changed layer, reported with onLayerPathChange so a host can keep browser history in step:\n * 'step-in' (an idea's rings or Step inside), 'trail', 'gesture' (double-click, double-tap), 'key' (Escape, Backspace), 'host' (the host set layerPath). */\nexport type LayerVia = 'step-in' | 'trail' | 'gesture' | 'key' | 'host';\n\n/** The zoom after a pinch: the zoom at the start, scaled by how far the fingers spread, within VIEW's limits. */\nexport function pinchZoom(startZoom: number, startDistance: number, distance: number): number {\n const z = startZoom * (distance / Math.max(startDistance, 1));\n return Math.min(VIEW.zoomMax, Math.max(VIEW.zoomMin, z));\n}\n\n/** Keeps the map point that was under `from` under `to` when the scale changes from `s0` to `s1`: the new\n * translation, given the old one (screen = world × s + t). Used to zoom around the fingers. */\nexport function zoomAround(t0: { x: number; y: number }, s0: number, s1: number, from: { x: number; y: number }, to: { x: number; y: number }): { x: number; y: number } {\n const wx = (from.x - t0.x) / s0, wy = (from.y - t0.y) / s0;\n return { x: to.x - wx * s1, y: to.y - wy * s1 };\n}\n\n/** Framing a layer (fit to view): its ideas with room around them, and its container hulls with room for the name pill. */\nexport const FRAME = {\n /** Room beyond each idea's outermost ring (RINGS[2].scale, 1.3 × its half size): its stroke, hover lift and a little air. */ ring: 0.3, clearX: 16, clearY: 16,\n /** Room beyond each container hull for its dashed line and the name pill straddling it: at least `hullX` / `hullY`\n * (a one-line pill), more when the pill reaches further (a 2 - 3 line name): half its largest drawn height plus\n * `pillAir`. A pill on a side edge may reach further sideways; the framing doesn't reserve that. */ hullX: 24, hullY: 40, pillAir: 12,\n} as const;\nexport type FrameBox = { x0: number; y0: number; x1: number; y1: number };\n\n/** The box a layer is framed by: every idea (`rx` / `ry` its half size) and every container hull. A hull's `pillH` is\n * its name pill's height at the largest drawn size (container.ts pillScaled at PILL.maxGrow). */\nexport function layerBounds(ideas: ReadonlyArray<{ x: number; y: number; rx: number; ry: number }>, hulls: ReadonlyArray<FrameBox & { pillH?: number }> = []): FrameBox {\n let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;\n for (const n of ideas) {\n const px = n.rx * (1 + FRAME.ring) + FRAME.clearX, py = n.ry * (1 + FRAME.ring) + FRAME.clearY;\n x0 = Math.min(x0, n.x - px); x1 = Math.max(x1, n.x + px); y0 = Math.min(y0, n.y - py); y1 = Math.max(y1, n.y + py);\n }\n for (const h of hulls) {\n const hy = Math.max(FRAME.hullY, (h.pillH ?? 0) / 2 + FRAME.pillAir);\n x0 = Math.min(x0, h.x0 - FRAME.hullX); x1 = Math.max(x1, h.x1 + FRAME.hullX); y0 = Math.min(y0, h.y0 - hy); y1 = Math.max(y1, h.y1 + hy);\n }\n if (!Number.isFinite(x0)) return { x0: -150, y0: -120, x1: 150, y1: 120 };\n return { x0, y0, x1, y1 };\n}\n\n/** Fit to view: the scale that shows `bounds` in an area of `width` × `height` (never beyond VIEW.fitMax), and the\n * world point to centre. */\nexport function fitView(bounds: FrameBox, width: number, height: number): { scale: number; center: { x: number; y: number } } {\n const scale = Math.min(width / Math.max(1, bounds.x1 - bounds.x0), height / Math.max(1, bounds.y1 - bounds.y0), VIEW.fitMax);\n return { scale, center: { x: (bounds.x0 + bounds.x1) / 2, y: (bounds.y0 + bounds.y1) / 2 } };\n}\n\n/** Insets: room the host's chrome takes at each edge of the map (a docked Vault, a top bar, the Composer). */\nexport type FrameInsets = { top?: number; right?: number; bottom?: number; left?: number };\n/** The smallest free area a map is ever fitted into, however much the insets take. */\nexport const FIT_ROOM = { minWidth: 200, minHeight: 160 } as const;\n\n/** Fit to view inside insets. The map's canvas fills its whole frame - so the canvas itself and its chromatic immersion\n * run behind the host's chrome (a docked Vault floats over the tinted canvas) - while the layer is fitted into the\n * free area (the frame less the insets, never below FIT_ROOM) and centred in it. `screen`: where on the canvas the\n * world `center` goes (screen = world × scale + translation); `room`: the free area's size. With no insets this is\n * fitView, centred on the canvas. */\nexport function fitViewInset(bounds: FrameBox, width: number, height: number, insets: FrameInsets = {}): { scale: number; center: { x: number; y: number }; screen: { x: number; y: number }; room: { width: number; height: number } } {\n const top = insets.top ?? 0, right = insets.right ?? 0, bottom = insets.bottom ?? 0, left = insets.left ?? 0;\n const w = Math.max(FIT_ROOM.minWidth, width - left - right), h = Math.max(FIT_ROOM.minHeight, height - top - bottom);\n const { scale, center } = fitView(bounds, w, h);\n return { scale, center, screen: { x: left + w / 2, y: top + h / 2 }, room: { width: w, height: h } };\n}\n\n/** Where the peek card sits (pointer): beside the idea — right of it if it fits, else left — and level with it. */\nexport const PEEK_PLACEMENT = {\n /** Gap between the idea's outermost ring and the card. */ gap: 16,\n /** The card's width and the height kept clear below it. */ cardWidth: 300, cardHeight: 220,\n /** The card is raised this much above the idea's centre. */ raise: 70,\n /** Kept this far inside the map's edges. */ margin: 12,\n} as const;\n\n/** The peek card's top-left, in map (screen) pixels. `idea`: the idea's centre on screen and its on-screen half\n * width with its outermost ring (`half`); `box`: the map's size. */\nexport function peekPosition(idea: { x: number; y: number; half: number }, box: { w: number; h: number }, card: { w: number; h: number } = { w: PEEK_PLACEMENT.cardWidth, h: PEEK_PLACEMENT.cardHeight }) {\n const P = PEEK_PLACEMENT, half = idea.half + P.gap;\n const right = idea.x + half + card.w < box.w - P.margin;\n return { left: right ? idea.x + half : Math.max(P.margin, idea.x - half - card.w), top: Math.min(Math.max(P.margin, idea.y - P.raise), box.h - card.h), side: right ? 'right' as const : 'left' as const };\n}\n\n/** The depth trail: each entry shows the idea that was stepped into — its title and a dot in its color (the same\n * topic or custom color the idea is drawn in, including the sibling-order topic of an uncolored idea). The first\n * entry is the map itself: a `stone` dot and the home glyph only (`rootLabel: 'icon'`) — no text, since a map's title\n * usually repeats its centre idea's, which the next entry shows; its accessible name and tooltip are the map's title.\n * The dot is the idea shape (shapeForLevel). */\nexport const TRAIL = { rootTopic: 'stone', rootLabel: 'icon', homeIconSize: 12, dotBox: 16, dotRadius: 6.4, stroke: 1.25, currentStroke: 1.75 } as const;\n\n/** How an idea draws while a highlight is on (VisualMap `highlight`, or picking ideas for a group or a connector):\n * `ids` are the highlighted ideas. A non-empty list: those are 'selected' and every other idea 'dimmed'. An empty list:\n * every idea 'dimmed' while `picking` (nothing chosen yet), else no highlight (null). No list: null. */\nexport function ideaHighlight(ids: readonly string[] | null | undefined, picking: boolean, id: string): 'selected' | 'dimmed' | null {\n if (!ids) return null;\n if (ids.length) return ids.includes(id) ? 'selected' : 'dimmed';\n return picking ? 'dimmed' : null;\n}\n\n/** How an input answers: a mouse hovers (peeks and terms open on hover); touch and pen tap. Null for unknown pointers. */\nexport function pointerModeFor(pointerType: string): 'hover' | 'touch' | null {\n return pointerType === 'mouse' ? 'hover' : pointerType === 'touch' || pointerType === 'pen' ? 'touch' : null;\n}\n\n/** Whether a pointer of this type opens a term on hover (PointerEvent.pointerType). */\nexport function hoverOpensTerm(pointerType: string): boolean {\n return TERM.hoverPointers.includes(pointerType);\n}\n","// ─── Performance & Rendering Constants ───────────────────────────────────────\n//\n// Performance budgets and interaction thresholds. Visual values (colours,\n// stroke widths, node size, zoom range) come from the design system tokens.\n\nimport { VIEW } from '../generated/geometry/interaction.js';\n\n// ── FPS ───────────────────────────────────────────────────────────────────────\n\nexport const FPS_TARGET = 60;\nexport const FPS_WARNING_THRESHOLD = 45;\nexport const FPS_CRITICAL_THRESHOLD = 30;\nexport const TARGET_FRAME_TIME = 1000 / FPS_TARGET; // ~16.67 ms\nexport const MAX_FRAME_TIME = 18; // p95 threshold\n\n/** Legacy frame-rate targets kept for backward compatibility. */\nexport const FPS_TARGETS = {\n PAN_MIN: 30,\n ZOOM_TARGET: 60,\n WARNING_THRESHOLD: 20,\n} as const;\n\n// ── Timing Thresholds (ms) ────────────────────────────────────────────────────\n\nexport const TIMING_THRESHOLDS = {\n VIEWPORT_QUERY_MAX: 5,\n SPATIAL_UPDATE_MAX: 10,\n DRAG_RESPONSE_MAX: 16,\n LOAD_5K_TARGET: 2000,\n LOAD_10K_TARGET: 3000,\n VIEWPORT_DEBOUNCE: 100,\n SPATIAL_INDEX_BUILD: 50,\n} as const;\n\n// ── Memory Limits (MB) ────────────────────────────────────────────────────────\n\nexport const MEMORY_TARGET_MB = 500;\nexport const MEMORY_WARNING_MB = 600;\nexport const MEMORY_CRITICAL_MB = 800;\n\nexport const MEMORY_LIMITS = {\n MAX_10K_NODES: 500,\n MAX_GROWTH_PERCENT: 20,\n WARNING_THRESHOLD: 400,\n} as const;\n\n// ── Viewport Culling ──────────────────────────────────────────────────────────\n\nexport const VIEWPORT_MARGIN = 0.1;\nexport const MAX_VISIBLE_NODES = 800;\nexport const CULLING_QUERY_TIME_BUDGET = 5;\n\n// ── Spatial Index ─────────────────────────────────────────────────────────────\n\nexport const RBUSH_MAX_ENTRIES = 16;\nexport const SPATIAL_INDEX_BUILD_BUDGET = 50;\n\n// ── Zoom Constraints ──────────────────────────────────────────────────────────\n\n// Zoom limits: the design system's VIEW (geometry/interaction.ts; equal to the zoom-min / zoom-max tokens).\nexport const ZOOM_MIN = VIEW.zoomMin;\nexport const ZOOM_MAX = VIEW.zoomMax;\nexport const ZOOM_DEFAULT = 1.0;\n\n// ── Quality Level Presets ─────────────────────────────────────────────────────\n\nexport const QUALITY_HIGH = {\n shadows: true,\n bezierCurves: true,\n animations: true,\n textQuality: 'high' as const,\n antialiasing: true,\n};\n\nexport const QUALITY_MEDIUM = {\n shadows: false,\n bezierCurves: true,\n animations: true,\n textQuality: 'medium' as const,\n antialiasing: true,\n};\n\nexport const QUALITY_LOW = {\n shadows: false,\n bezierCurves: false,\n animations: false,\n textQuality: 'low' as const,\n antialiasing: false,\n};\n\n// ── Performance Monitoring ────────────────────────────────────────────────────\n\nexport const FPS_SAMPLE_WINDOW = 60;\nexport const FPS_UPDATE_INTERVAL = 1000;\nexport const MEMORY_CHECK_INTERVAL = 5000;\nexport const PERFORMANCE_TOAST_COOLDOWN = 10000;\n\n// ── Auto-Adjustment ───────────────────────────────────────────────────────────\n\nexport const FPS_DOWNGRADE_THRESHOLD = 45;\nexport const FPS_UPGRADE_THRESHOLD = 58;\nexport const FPS_STABILIZATION_FRAMES = 180;\n\n// ── Canvas Dimensions ─────────────────────────────────────────────────────────\n\nexport const DEFAULT_CANVAS_WIDTH = 1920;\nexport const DEFAULT_CANVAS_HEIGHT = 1080;\n\n// ── Interaction ───────────────────────────────────────────────────────────────\n\nexport const CLICK_THRESHOLD = 5;\nexport const DOUBLE_CLICK_DELAY = 300;\nexport const DRAG_START_DISTANCE = 10;\n\n// ── Data Validation ───────────────────────────────────────────────────────────\n\nexport const MAX_NODES = 20000;\nexport const CIRCULAR_REFERENCE_MAX_DEPTH = 1000;\n\n// ── Debounce / Throttle ───────────────────────────────────────────────────────\n\nexport const RESIZE_DEBOUNCE = 300;\nexport const SCROLL_THROTTLE = 16;\nexport const SEARCH_DEBOUNCE = 500;\n\n/** Node count thresholds that gate optimisation strategies. */\nexport const NODE_COUNT_THRESHOLDS = {\n SPATIAL_INDEX_MIN: 100,\n VIEWPORT_CULLING_MIN: 500,\n CANVAS_RENDERING_MIN: 2000,\n DOM_RENDERING_MAX: 5000,\n} as const;\n\n/** Viewport buffer configuration. */\nexport const VIEWPORT_CONFIG = {\n BUFFER_PERCENT: 0.2,\n MIN_VISIBLE_NODES: 10,\n} as const;\n","// ─── Render Configuration ─────────────────────────────────────────────────────\n\nimport type { RenderConfig } from '../types/mindmap.js';\nimport {\n FPS_TARGET,\n MEMORY_TARGET_MB,\n QUALITY_HIGH,\n QUALITY_MEDIUM,\n QUALITY_LOW,\n NODE_COUNT_THRESHOLDS,\n} from './performanceConstants.js';\n\n// ── Defaults ──────────────────────────────────────────────────────────────────\n\nexport const DEFAULT_RENDER_CONFIG: RenderConfig = {\n renderMode: 'canvas',\n qualityLevel: 'high',\n cullingEnabled: false,\n fpsTarget: FPS_TARGET,\n memoryLimit: MEMORY_TARGET_MB,\n};\n\nexport const SIMPLIFIED_RENDER_CONFIG: RenderConfig = {\n renderMode: 'simplified',\n qualityLevel: 'low',\n cullingEnabled: true,\n fpsTarget: 30,\n memoryLimit: 400,\n};\n\n// ── Quality Map ───────────────────────────────────────────────────────────────\n\nexport const QUALITY_SETTINGS = {\n high: QUALITY_HIGH,\n medium: QUALITY_MEDIUM,\n low: QUALITY_LOW,\n} as const;\n\n// ── Feature Flags ─────────────────────────────────────────────────────────────\n\nexport const FEATURE_FLAGS = {\n viewportCulling: true,\n spatialIndexing: true,\n shadows: true,\n bezierCurves: true,\n animations: true,\n branchBadges: true,\n autoQualityAdjustment: true,\n performanceMonitoring: true,\n performanceToasts: true,\n debugOverlay: false,\n showFPS: false,\n showMemory: false,\n showVisibleCount: false,\n} as const;\n\n// ── Render Modes ──────────────────────────────────────────────────────────────\n\nexport type RenderMode = RenderConfig['renderMode'];\nexport type QualityLevel = RenderConfig['qualityLevel'];\n\nexport const RENDER_MODES = {\n canvas: {\n name: 'Canvas',\n description: 'Full Konva canvas rendering with all features',\n features: { culling: true, shadows: true, bezierCurves: true, animations: true },\n },\n simplified: {\n name: 'Simplified',\n description: 'Reduced feature set for low-end devices',\n features: { culling: true, shadows: false, bezierCurves: false, animations: false },\n },\n} as const;\n\nexport const QUALITY_LEVELS = {\n high: { name: 'High', description: 'All visual features enabled', targetFPS: 60, features: QUALITY_HIGH },\n medium: { name: 'Medium', description: 'Shadows disabled, other features enabled', targetFPS: 60, features: QUALITY_MEDIUM },\n low: { name: 'Low', description: 'Minimal visual features, max performance', targetFPS: 30, features: QUALITY_LOW },\n} as const;\n\n// ── Auto-Adjustment Helpers ───────────────────────────────────────────────────\n\nexport function getOptimalQualityLevel(\n currentFPS: number,\n currentQuality: QualityLevel,\n): QualityLevel {\n if (currentFPS < 45 && currentQuality === 'high') return 'medium';\n if (currentFPS < 30 && currentQuality === 'medium') return 'low';\n if (currentFPS > 58 && currentQuality === 'low') return 'medium';\n if (currentFPS > 58 && currentQuality === 'medium') return 'high';\n return currentQuality;\n}\n\nexport function getRenderConfigForQuality(quality: QualityLevel): Partial<RenderConfig> {\n return { qualityLevel: quality, fpsTarget: QUALITY_LEVELS[quality].targetFPS };\n}\n\nexport function isFeatureEnabled(\n featureName: keyof typeof FEATURE_FLAGS,\n config: RenderConfig,\n): boolean {\n if (!FEATURE_FLAGS[featureName]) return false;\n\n const qs = QUALITY_SETTINGS[config.qualityLevel];\n switch (featureName) {\n case 'shadows': return qs.shadows;\n case 'bezierCurves': return qs.bezierCurves;\n case 'animations': return qs.animations;\n default: return FEATURE_FLAGS[featureName] as boolean;\n }\n}\n\n// ── Device Detection ──────────────────────────────────────────────────────────\n\n/**\n * Recommend a render config based on detected device memory (browser only).\n * Falls back to SIMPLIFIED_RENDER_CONFIG when the Performance Memory API is\n * unavailable or memory is constrained.\n */\nexport function getRecommendedRenderConfig(): RenderConfig {\n if (typeof performance === 'undefined' || !(performance as unknown as Record<string, unknown>)['memory']) {\n return SIMPLIFIED_RENDER_CONFIG;\n }\n\n const memory = (performance as unknown as Record<string, unknown>)['memory'] as Record<string, number>;\n if (memory?.['jsHeapSizeLimit'] && memory['jsHeapSizeLimit'] < 512 * 1024 * 1024) {\n return SIMPLIFIED_RENDER_CONFIG;\n }\n\n return DEFAULT_RENDER_CONFIG;\n}\n\n/** Re-export so consumers need only one import. */\nexport { NODE_COUNT_THRESHOLDS };\n","// ─── Viewport Utilities ───────────────────────────────────────────────────────\n//\n// Pure functions for viewport bounds calculation, coordinate transforms,\n// pan/zoom operations, and node visibility queries.\n\nimport type { ViewportState } from '../types/mindmap.js';\nimport {\n VIEWPORT_MARGIN,\n DEFAULT_CANVAS_WIDTH,\n DEFAULT_CANVAS_HEIGHT,\n ZOOM_MIN,\n ZOOM_MAX,\n} from '../constants/performanceConstants.js';\n\n// ── Viewport Bounds ───────────────────────────────────────────────────────────\n\nexport interface WorldBounds {\n minX: number;\n minY: number;\n maxX: number;\n maxY: number;\n}\n\n/**\n * Calculate the visible world-space bounding box including a margin buffer.\n */\nexport function calculateViewportBounds(\n viewport: ViewportState,\n canvasWidth = DEFAULT_CANVAS_WIDTH,\n canvasHeight = DEFAULT_CANVAS_HEIGHT,\n): WorldBounds {\n const worldW = canvasWidth / viewport.zoomLevel;\n const worldH = canvasHeight / viewport.zoomLevel;\n const mx = worldW * VIEWPORT_MARGIN;\n const my = worldH * VIEWPORT_MARGIN;\n return {\n minX: viewport.centerX - worldW / 2 - mx,\n minY: viewport.centerY - worldH / 2 - my,\n maxX: viewport.centerX + worldW / 2 + mx,\n maxY: viewport.centerY + worldH / 2 + my,\n };\n}\n\n/**\n * Return a new ViewportState with `visibleBounds` recalculated.\n */\nexport function recalculateViewportBounds(\n viewport: ViewportState,\n canvasWidth = DEFAULT_CANVAS_WIDTH,\n canvasHeight = DEFAULT_CANVAS_HEIGHT,\n): ViewportState {\n return {\n ...viewport,\n visibleBounds: calculateViewportBounds(viewport, canvasWidth, canvasHeight),\n };\n}\n\n// ── Coordinate Transforms ─────────────────────────────────────────────────────\n\n/**\n * Convert world-space coordinates to screen-space pixel coordinates.\n */\nexport function worldToScreen(\n worldX: number,\n worldY: number,\n viewport: ViewportState,\n canvasWidth = DEFAULT_CANVAS_WIDTH,\n canvasHeight = DEFAULT_CANVAS_HEIGHT,\n): { x: number; y: number } {\n return {\n x: (worldX - viewport.centerX) * viewport.zoomLevel + canvasWidth / 2,\n y: (worldY - viewport.centerY) * viewport.zoomLevel + canvasHeight / 2,\n };\n}\n\n/**\n * Convert screen-space pixel coordinates to world-space coordinates.\n */\nexport function screenToWorld(\n screenX: number,\n screenY: number,\n viewport: ViewportState,\n canvasWidth = DEFAULT_CANVAS_WIDTH,\n canvasHeight = DEFAULT_CANVAS_HEIGHT,\n): { x: number; y: number } {\n return {\n x: (screenX - canvasWidth / 2) / viewport.zoomLevel + viewport.centerX,\n y: (screenY - canvasHeight / 2) / viewport.zoomLevel + viewport.centerY,\n };\n}\n\n// ── Pan / Zoom ────────────────────────────────────────────────────────────────\n\n/** Clamp zoom to the design system's limits (VIEW: ZOOM_MIN–ZOOM_MAX), which apply to the zoom relative to the\n * layer's fit (`fit`: the fit-to-view scale), as in the design system's map (scale = fit × zoom). */\nexport function clampZoom(zoom: number, fit = 1): number {\n return Math.min(ZOOM_MAX * fit, Math.max(ZOOM_MIN * fit, zoom));\n}\n\n/**\n * Pan the viewport by a screen-space delta (positive = right/down).\n */\nexport function panViewport(\n deltaX: number,\n deltaY: number,\n viewport: ViewportState,\n): ViewportState {\n return {\n ...viewport,\n centerX: viewport.centerX - deltaX / viewport.zoomLevel,\n centerY: viewport.centerY - deltaY / viewport.zoomLevel,\n };\n}\n\n/** Teleport the viewport centre to the given world coordinates. */\nexport function setViewportCenter(\n x: number,\n y: number,\n viewport: ViewportState,\n): ViewportState {\n return { ...viewport, centerX: x, centerY: y };\n}\n\n/**\n * Zoom the viewport by a multiplicative delta, optionally around a pivot point.\n *\n * @param delta - Multiplier delta, e.g. 0.1 for +10% zoom\n * @param pivotX - Optional screen-space X pivot\n * @param pivotY - Optional screen-space Y pivot\n */\nexport function zoomViewport(\n delta: number,\n viewport: ViewportState,\n pivotX?: number,\n pivotY?: number,\n canvasWidth = DEFAULT_CANVAS_WIDTH,\n canvasHeight = DEFAULT_CANVAS_HEIGHT,\n fit = 1,\n): ViewportState {\n const newZoom = clampZoom(viewport.zoomLevel * (1 + delta), fit);\n\n let cx = viewport.centerX;\n let cy = viewport.centerY;\n\n if (pivotX !== undefined && pivotY !== undefined) {\n const worldPivot = screenToWorld(pivotX, pivotY, viewport, canvasWidth, canvasHeight);\n cx = worldPivot.x - (pivotX - canvasWidth / 2) / newZoom;\n cy = worldPivot.y - (pivotY - canvasHeight / 2) / newZoom;\n }\n\n return { ...viewport, centerX: cx, centerY: cy, zoomLevel: newZoom };\n}\n\n/**\n * Create a viewport centred on a node (world coordinates) at the given zoom level.\n */\nexport function focusOnNode(\n nodeX: number,\n nodeY: number,\n zoom: number,\n): ViewportState {\n const clamped = clampZoom(zoom);\n return {\n centerX: nodeX,\n centerY: nodeY,\n zoomLevel: clamped,\n rotation: 0,\n visibleBounds: calculateViewportBounds(\n { centerX: nodeX, centerY: nodeY, zoomLevel: clamped, rotation: 0, visibleBounds: { minX: 0, minY: 0, maxX: 0, maxY: 0 } },\n ),\n };\n}\n\n// ── Visibility ────────────────────────────────────────────────────────────────\n\n/**\n * Test whether a world-space AABB intersects the viewport's visible bounds.\n */\nexport function isNodeInViewport(\n nodeX: number,\n nodeY: number,\n nodeWidth: number,\n nodeHeight: number,\n viewport: ViewportState,\n canvasWidth = DEFAULT_CANVAS_WIDTH,\n canvasHeight = DEFAULT_CANVAS_HEIGHT,\n): boolean {\n const bounds = calculateViewportBounds(viewport, canvasWidth, canvasHeight);\n const hw = nodeWidth / 2;\n const hh = nodeHeight / 2;\n return !(\n nodeX + hw < bounds.minX ||\n nodeX - hw > bounds.maxX ||\n nodeY + hh < bounds.minY ||\n nodeY - hh > bounds.maxY\n );\n}\n","// ─── Performance Monitors ─────────────────────────────────────────────────────\n//\n// FPSMonitor – tracks frame rate via requestAnimationFrame (browser)\n// MemoryMonitor – polls performance.memory (Chrome)\n// PerformanceProfiler – mark / measure utility for arbitrary operations\n\nimport {\n FPS_TARGET,\n FPS_SAMPLE_WINDOW,\n MEMORY_CHECK_INTERVAL,\n} from '../constants/performanceConstants.js';\n\n// ── FPS Monitor ───────────────────────────────────────────────────────────────\n\nexport class FPSMonitor {\n private frameTimes: number[] = [];\n private lastTime = 0;\n private currentFPS = FPS_TARGET;\n private rafId: number | null = null;\n\n start(): void {\n if (this.rafId !== null) return;\n\n const measure = (ts: number) => {\n if (this.lastTime > 0) {\n this.frameTimes.push(ts - this.lastTime);\n if (this.frameTimes.length > FPS_SAMPLE_WINDOW) this.frameTimes.shift();\n this.currentFPS = this.calc();\n }\n this.lastTime = ts;\n this.rafId = requestAnimationFrame(measure);\n };\n\n this.rafId = requestAnimationFrame(measure);\n }\n\n stop(): void {\n if (this.rafId !== null) { cancelAnimationFrame(this.rafId); this.rafId = null; }\n }\n\n private calc(): number {\n if (this.frameTimes.length === 0) return FPS_TARGET;\n const avg = this.frameTimes.reduce((a, b) => a + b, 0) / this.frameTimes.length;\n return Math.round(1000 / avg);\n }\n\n getFPS(): number { return this.currentFPS; }\n getAverageFPS(): number { return this.currentFPS; }\n\n getP95FrameTime(): number {\n if (this.frameTimes.length === 0) return 0;\n const sorted = [...this.frameTimes].sort((a, b) => a - b);\n return sorted[Math.floor(sorted.length * 0.95)];\n }\n\n reset(): void { this.frameTimes = []; this.currentFPS = FPS_TARGET; }\n}\n\n// ── Memory Monitor ────────────────────────────────────────────────────────────\n\nexport interface MemoryStats {\n usedJSHeapSize: number;\n totalJSHeapSize: number;\n jsHeapSizeLimit: number;\n heapUsagePercent: number;\n}\n\nexport class MemoryMonitor {\n private timer: ReturnType<typeof setInterval> | null = null;\n private current = 0;\n\n start(onUpdate?: (mb: number) => void): void {\n if (this.timer !== null) return;\n this.timer = setInterval(() => {\n this.current = this.measure();\n onUpdate?.(this.current);\n }, MEMORY_CHECK_INTERVAL);\n }\n\n stop(): void {\n if (this.timer !== null) { clearInterval(this.timer); this.timer = null; }\n }\n\n private measure(): number {\n const mem = (performance as unknown as Record<string, unknown>)['memory'] as Record<string, number> | undefined;\n return mem ? mem['usedJSHeapSize'] / (1024 * 1024) : 0;\n }\n\n getMemoryMB(): number { return this.current; }\n\n getStats(): MemoryStats | null {\n const mem = (performance as unknown as Record<string, unknown>)['memory'] as Record<string, number> | undefined;\n if (!mem) return null;\n return {\n usedJSHeapSize: mem['usedJSHeapSize'],\n totalJSHeapSize: mem['totalJSHeapSize'],\n jsHeapSizeLimit: mem['jsHeapSizeLimit'],\n heapUsagePercent: (mem['usedJSHeapSize'] / mem['jsHeapSizeLimit']) * 100,\n };\n }\n\n static isSupported(): boolean {\n return !!(performance as unknown as Record<string, unknown>)['memory'];\n }\n}\n\n// ── Performance Profiler ──────────────────────────────────────────────────────\n\nexport class PerformanceProfiler {\n private marks: Map<string, number> = new Map();\n private measures: Map<string, number[]> = new Map();\n\n mark(label: string): void {\n this.marks.set(label, performance.now());\n }\n\n measure(label: string): number {\n const start = this.marks.get(label);\n if (start === undefined) return 0;\n const duration = performance.now() - start;\n const list = this.measures.get(label) ?? [];\n list.push(duration);\n this.measures.set(label, list);\n this.marks.delete(label);\n return duration;\n }\n\n getAverage(label: string): number {\n const list = this.measures.get(label);\n if (!list?.length) return 0;\n return list.reduce((a, b) => a + b, 0) / list.length;\n }\n\n getP95(label: string): number {\n const list = this.measures.get(label);\n if (!list?.length) return 0;\n const sorted = [...list].sort((a, b) => a - b);\n return sorted[Math.floor(sorted.length * 0.95)];\n }\n\n clear(label?: string): void {\n if (label) { this.marks.delete(label); this.measures.delete(label); }\n else { this.marks.clear(); this.measures.clear(); }\n }\n}\n","// ─── Spatial Index ────────────────────────────────────────────────────────────\n//\n// RBush-backed R-tree for O(log n) viewport culling queries.\n// Wraps the `rbush` library with a typed, domain-specific interface.\n\nimport RBush from 'rbush';\n\nexport interface BoundingBox {\n minX: number;\n minY: number;\n maxX: number;\n maxY: number;\n}\n\ninterface SpatialItem extends BoundingBox {\n nodeId: string;\n}\n\nexport interface ISpatialIndex {\n insert(nodeId: string, bounds: BoundingBox): void;\n remove(nodeId: string, bounds: BoundingBox): void;\n update(nodeId: string, oldBounds: BoundingBox, newBounds: BoundingBox): void;\n query(bounds: BoundingBox): string[];\n clear(): void;\n size(): number;\n bulkLoad(items: Array<{ nodeId: string; bounds: BoundingBox }>): void;\n}\n\n/**\n * RBush-based spatial index for efficient viewport culling.\n *\n * - Insert / remove / update: O(log n)\n * - Query: O(log n + k) where k = result count\n * - Bulk load: O(n log n) — use instead of repeated inserts for initial load\n */\nexport class RBushSpatialIndex implements ISpatialIndex {\n private tree: RBush<SpatialItem>;\n private cache: Map<string, BoundingBox>;\n\n constructor() {\n this.tree = new RBush<SpatialItem>();\n this.cache = new Map();\n }\n\n insert(nodeId: string, bounds: BoundingBox): void {\n this.tree.insert({ ...bounds, nodeId });\n this.cache.set(nodeId, bounds);\n }\n\n remove(nodeId: string, bounds: BoundingBox): void {\n this.tree.remove({ ...bounds, nodeId }, (a, b) => a.nodeId === b.nodeId);\n this.cache.delete(nodeId);\n }\n\n update(nodeId: string, oldBounds: BoundingBox, newBounds: BoundingBox): void {\n this.remove(nodeId, oldBounds);\n this.insert(nodeId, newBounds);\n }\n\n query(bounds: BoundingBox): string[] {\n return this.tree.search(bounds).map(item => item.nodeId);\n }\n\n clear(): void {\n this.tree.clear();\n this.cache.clear();\n }\n\n size(): number {\n return this.cache.size;\n }\n\n bulkLoad(items: Array<{ nodeId: string; bounds: BoundingBox }>): void {\n const rbushItems = items.map(({ nodeId, bounds }) => ({ ...bounds, nodeId }));\n this.tree.load(rbushItems);\n for (const { nodeId, bounds } of items) this.cache.set(nodeId, bounds);\n }\n\n /** Return the cached bounding box for a node (undefined if not indexed). */\n getBounds(nodeId: string): BoundingBox | undefined {\n return this.cache.get(nodeId);\n }\n}\n","const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const destroy = () => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n console.warn(\n \"[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected.\"\n );\n }\n listeners.clear();\n };\n const api = { setState, getState, getInitialState, subscribe, destroy };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;\nvar vanilla = (createState) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n console.warn(\n \"[DEPRECATED] Default export is deprecated. Instead use import { createStore } from 'zustand/vanilla'.\"\n );\n }\n return createStore(createState);\n};\n\nexport { createStore, vanilla as default };\n","import { createStore } from 'zustand/vanilla';\nimport type { NodeSelection, RenderConfig } from '../types/index.js';\nimport {\n DEFAULT_RENDER_CONFIG,\n getOptimalQualityLevel,\n getRenderConfigForQuality,\n isFeatureEnabled,\n FEATURE_FLAGS,\n} from '../constants/renderConfig.js';\n\n// ─── Selection Store ──────────────────────────────────────────────────────────\n\nexport interface ISelectionStore extends NodeSelection {\n select: (nodeId: string) => void;\n clear: () => void;\n toggle: (nodeId: string) => void;\n isSelected: (nodeId: string) => boolean;\n}\n\nexport const selectionStore = createStore<ISelectionStore>((set, get) => ({\n selectedId: null,\n select: (nodeId) => set({ selectedId: nodeId }),\n clear: () => set({ selectedId: null }),\n toggle: (nodeId) => set((s) => ({ selectedId: s.selectedId === nodeId ? null : nodeId })),\n isSelected: (nodeId) => get().selectedId === nodeId,\n}));\n\n// ─── Render Config Store ──────────────────────────────────────────────────────\n\nexport interface IRenderConfigStore extends RenderConfig {\n setQualityLevel: (level: RenderConfig['qualityLevel']) => void;\n setRenderMode: (mode: RenderConfig['renderMode']) => void;\n setCullingEnabled: (enabled: boolean) => void;\n autoAdjustQuality: (currentFPS: number) => void;\n autoAdjustQualityByMemory: (memoryMB: number) => void;\n resetToDefaults: () => void;\n isFeatureEnabled: (feature: keyof typeof FEATURE_FLAGS) => boolean;\n}\n\nexport const renderConfigStore = createStore<IRenderConfigStore>((set, get) => ({\n ...DEFAULT_RENDER_CONFIG,\n\n setQualityLevel: (level) => set(getRenderConfigForQuality(level)),\n setRenderMode: (mode) => set({ renderMode: mode }),\n setCullingEnabled: (enabled) => set({ cullingEnabled: enabled }),\n\n autoAdjustQuality: (fps) =>\n set((s) => {\n const q = getOptimalQualityLevel(fps, s.qualityLevel);\n return q !== s.qualityLevel ? getRenderConfigForQuality(q) : s;\n }),\n\n autoAdjustQualityByMemory: (mb) =>\n set((s) => {\n const q = mb > 500 ? 'low' : mb > 400 && s.qualityLevel === 'high' ? 'medium' : s.qualityLevel;\n return q !== s.qualityLevel ? getRenderConfigForQuality(q as RenderConfig['qualityLevel']) : s;\n }),\n\n resetToDefaults: () => set({ ...DEFAULT_RENDER_CONFIG }),\n isFeatureEnabled: (feature) => isFeatureEnabled(feature, get()),\n}));\n","// Generated from visualli.ai design-system/components/src/container.ts — do not edit here.\n/* Containers: the dashed hull around a group of ideas, and where its name goes.\n The name is a pill straddling the hull's boundary. Which point of the boundary depends on what's inside and around\n the container: the spot is chosen by scoring candidates along all four edges against the ideas, the connectors and\n the names already placed — deterministic, so every renderer (VisualMap, the spec SDK on a canvas, PDF export) puts\n it in the same place for the same file. Pure functions, no dependencies. World units (the map's coordinates). */\n\nexport type Pt = { x: number; y: number };\nexport type Box = { x0: number; y0: number; x1: number; y1: number };\nexport type Hull = Box & { radius: number };\nexport type LabelSide = 'bottom' | 'top' | 'left' | 'right';\nexport type LabelPlacement = { x: number; y: number; side: LabelSide; score: number };\n\n/** The hull reaches this far beyond its ideas' centers, and rounds its corners this much. */\nexport const HULL = { padX: 150, padY: 125, radius: 48 };\n/** Penalties: an idea or another name under the pill is never fine; a connector through it is bad; order breaks ties. */\nconst WEIGHT = { idea: 1000, label: 1000, connector: 60, preference: 1 };\n\n/** Room kept between a member's outline and the hull, for ideas larger than the base size. */\nexport const HULL_CLEAR = { x: 50, y: 51 } as const;\n\n/** The name pill (1x, world units = CSS px): the `note` face 26px bold (× the label scale), line-height 1.1, padding\n * and border as the CSS draws them. It grows with the name up to `maxWidth` (padding and border included), then wraps\n * to at most `maxLines` lines (a word wider than a line is split across lines); an ellipsis only past that. Zooming grows the text with the label growth (up to\n * `maxGrow`) but never the padding or border, and never re-wraps. `.vi-map__group-label`'s max-width equals\n * `maxWidth` (the build checks it). */\nexport const PILL = {\n fontPx: 26, lineHeight: 1.1, padX: 22, padTop: 6, padBottom: 8, border: 1.5, maxWidth: 420, maxLines: 3, maxGrow: 1.3,\n} as const;\n\n/** The pill's fixed chrome (padding + border): width and height that don't scale with the text. */\nexport const PILL_CHROME = { w: 2 * PILL.padX + 2 * PILL.border, h: PILL.padTop + PILL.padBottom + 2 * PILL.border } as const;\nexport type PillSize = { lines: string[]; w: number; h: number };\n\n/** A text's user-perceived characters, without Intl.Segmenter (not in every browser the spec supports): code points,\n * with combining marks, variation selectors, emoji modifiers, tag characters, keycaps, zero-width-joiner sequences and\n * pairs of regional indicators (flags) kept with the character they belong to — so a break never falls inside one. */\nfunction graphemes(text: string): string[] {\n const out: string[] = [], joins = /^[\\p{M}\\u200d\\ufe00-\\ufe0f\\u{1f3fb}-\\u{1f3ff}\\u{e0020}-\\u{e007f}]$/u, flag = /^[\\u{1f1e6}-\\u{1f1ff}]$/u;\n for (const c of Array.from(text)) {\n const last = out.length - 1;\n if (last >= 0 && (joins.test(c) || out[last].endsWith('\\u200d') || (flag.test(c) && Array.from(out[last]).every((x) => flag.test(x)) && Array.from(out[last]).length % 2 === 1))) out[last] += c;\n else out.push(c);\n }\n return out;\n}\n\n/** Wraps a container's name into its pill at 1x. `measure(text, px)` is the width of `text` in the note face at `px`\n * (an injected canvas measure, like wrapLines in idea.ts); `scale` is the label scale (1.15 in large type). Lines break\n * at spaces first; a word wider than a whole line (the pill's room: `maxWidth` less the padding and border) is split\n * across lines, each filled with as many characters as fit, never inside a character (an emoji, a combining mark), so\n * every line fits the pill. Past `maxLines` the last line ends in an ellipsis that fits. `w` is the widest line plus\n * the chrome (at most `maxWidth`), `h` the lines plus the chrome. */\nexport function pillLayout(name: string, measure: (text: string, px: number) => number, scale = 1): PillSize {\n const px = PILL.fontPx * scale, room = PILL.maxWidth - PILL_CHROME.w, m = (s: string) => measure(s, px);\n // Each line, and whether it was cut inside a word (then the next line continues it, with no space between).\n const rows: { text: string; mid: boolean }[] = [];\n let cur = '';\n for (const w of name.split(/\\s+/).filter(Boolean)) {\n if (m(w) > room) {\n // Too long for any line: it starts on its own line, then fills line after line; its last piece can take more words.\n if (cur) rows.push({ text: cur, mid: false });\n let part = '';\n for (const g of graphemes(w)) {\n if (part && m(part + g) > room) { rows.push({ text: part, mid: true }); part = g; } else part += g;\n }\n cur = part;\n continue;\n }\n const next = cur ? `${cur} ${w}` : w;\n if (cur && m(next) > room) { rows.push({ text: cur, mid: false }); cur = w; } else cur = next;\n }\n if (cur) rows.push({ text: cur, mid: false });\n let lines = rows.map((r) => r.text);\n if (!lines.length) lines = [''];\n if (rows.length > PILL.maxLines) {\n // Past the limit: keep the first lines, and end the last one in an ellipsis that fits.\n let rest = '';\n rows.slice(PILL.maxLines - 1).forEach((r, i, a) => { rest += r.text + (i < a.length - 1 && !r.mid ? ' ' : ''); });\n const gs = graphemes(rest);\n while (gs.length > 1 && m(gs.join('') + '\\u2026') > room) gs.pop();\n lines = [...lines.slice(0, PILL.maxLines - 1), gs.join('').replace(/\\s+$/, '') + '\\u2026'];\n }\n const widest = Math.max(...lines.map(m));\n return { lines, w: Math.min(PILL.maxWidth, widest + PILL_CHROME.w), h: lines.length * px * PILL.lineHeight + PILL_CHROME.h };\n}\n\n/** The pill as drawn at label growth `k` (1 to PILL.maxGrow): the text grows, the padding and border don't. */\nexport function pillScaled(p: { w: number; h: number }, k: number): { w: number; h: number } {\n return { w: (p.w - PILL_CHROME.w) * k + PILL_CHROME.w, h: (p.h - PILL_CHROME.h) * k + PILL_CHROME.h };\n}\n\n/** The hull around a group's ideas: `padX` / `padY` beyond their centres, or more for an idea that has grown to show\n * its label (`rx` / `ry`, its half size: then its outline plus HULL_CLEAR). With the name's `pill` (its 1x size,\n * from pillLayout) the hull is also widened, symmetrically about its centre, so that the pill at its largest drawn\n * size (PILL.maxGrow) fits on the straight part of an edge: pill width + 2 × the corner radius. Hull and pill then\n * never change while zooming. Without a pill the hull is as before. */\nexport function containerHull(members: ReadonlyArray<Pt & { rx?: number; ry?: number }>, pill?: { w: number; h: number } | null): Hull | null {\n if (!members.length) return null;\n let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;\n for (const m of members) {\n const px = Math.max(HULL.padX, (m.rx ?? 0) + HULL_CLEAR.x), py = Math.max(HULL.padY, (m.ry ?? 0) + HULL_CLEAR.y);\n x0 = Math.min(x0, m.x - px); x1 = Math.max(x1, m.x + px); y0 = Math.min(y0, m.y - py); y1 = Math.max(y1, m.y + py);\n }\n if (pill) {\n const need = pillScaled(pill, PILL.maxGrow).w + 2 * HULL.radius, cx = (x0 + x1) / 2;\n if (x1 - x0 < need) { x0 = cx - need / 2; x1 = cx + need / 2; }\n }\n return { x0, x1, y0, y1, radius: HULL.radius };\n}\n\n/** Candidate spots for a w × h pill, in preference order: bottom center (the default look), top center, the thirds of\n * bottom and top, then the sides. Spots keep the whole pill on the straight part of an edge, clear of the corners. */\nexport function labelCandidates(hull: Hull, w: number, h: number): { x: number; y: number; side: LabelSide }[] {\n const { x0, x1, y0, y1, radius } = hull;\n const cx = (x0 + x1) / 2, cy = (y0 + y1) / 2;\n const minX = x0 + radius + w / 2, maxX = x1 - radius - w / 2; // horizontal room on top / bottom\n const minY = y0 + radius + h / 2, maxY = y1 - radius - h / 2; // vertical room on the sides\n const along = (lo: number, hi: number, f: number) => (lo > hi ? (lo + hi) / 2 : lo + (hi - lo) * f);\n const out: { x: number; y: number; side: LabelSide }[] = [\n { x: cx, y: y1, side: 'bottom' }, { x: cx, y: y0, side: 'top' },\n { x: along(minX, maxX, 0.2), y: y1, side: 'bottom' }, { x: along(minX, maxX, 0.8), y: y1, side: 'bottom' },\n { x: along(minX, maxX, 0.2), y: y0, side: 'top' }, { x: along(minX, maxX, 0.8), y: y0, side: 'top' },\n { x: x1, y: cy, side: 'right' }, { x: x0, y: cy, side: 'left' },\n { x: x1, y: along(minY, maxY, 0.25), side: 'right' }, { x: x1, y: along(minY, maxY, 0.75), side: 'right' },\n { x: x0, y: along(minY, maxY, 0.25), side: 'left' }, { x: x0, y: along(minY, maxY, 0.75), side: 'left' },\n ];\n // The extremes of the top / bottom edges, for wide labels on narrow hulls.\n out.push({ x: along(minX, maxX, 0), y: y1, side: 'bottom' }, { x: along(minX, maxX, 1), y: y1, side: 'bottom' },\n { x: along(minX, maxX, 0), y: y0, side: 'top' }, { x: along(minX, maxX, 1), y: y0, side: 'top' });\n return out;\n}\n\nconst overlap = (a: Box, b: Box) => Math.max(0, Math.min(a.x1, b.x1) - Math.max(a.x0, b.x0)) * Math.max(0, Math.min(a.y1, b.y1) - Math.max(a.y0, b.y0));\n\n/** Where a container's name goes. `ideas`: the boxes of every idea on the layer (outermost ring included);\n * `connectors`: points sampled along every connector; `labels`: the pills already placed on this layer.\n * `gap` keeps a little air between the pill and what it avoids. */\nexport function placeContainerLabel(hull: Hull, size: { w: number; h: number }, obstacles: { ideas: Box[]; connectors?: Pt[][]; labels?: Box[] }, gap = 10): LabelPlacement {\n const { w, h } = size;\n let best: LabelPlacement | null = null;\n labelCandidates(hull, w, h).forEach((c, i) => {\n const box = { x0: c.x - w / 2 - gap, x1: c.x + w / 2 + gap, y0: c.y - h / 2 - gap, y1: c.y + h / 2 + gap };\n const area = w * h;\n let score = i * WEIGHT.preference;\n for (const b of obstacles.ideas) score += (overlap(box, b) / area) * WEIGHT.idea;\n for (const b of obstacles.labels || []) score += (overlap(box, b) / area) * WEIGHT.label;\n for (const line of obstacles.connectors || []) if (line.some((p) => p.x > box.x0 && p.x < box.x1 && p.y > box.y0 && p.y < box.y1)) score += WEIGHT.connector;\n if (!best || score < best.score) best = { x: c.x, y: c.y, side: c.side, score };\n });\n return best!;\n}\n\n/** Points along a connector, for `connectors`: the same cubic edgePath draws (control points two-thirds of the way\n * from each end to the bowed midpoint `mid`, which edgePath returns). */\nexport function connectorSamples(a: Pt, mid: Pt, b: Pt, n = 16): Pt[] {\n const c1 = { x: a.x + (mid.x - a.x) * 0.66, y: a.y + (mid.y - a.y) * 0.66 }, c2 = { x: b.x + (mid.x - b.x) * 0.66, y: b.y + (mid.y - b.y) * 0.66 };\n return Array.from({ length: n + 1 }, (_, k) => {\n const t = k / n, u = 1 - t;\n return { x: u * u * u * a.x + 3 * u * u * t * c1.x + 3 * u * t * t * c2.x + t * t * t * b.x, y: u * u * u * a.y + 3 * u * u * t * c1.y + 3 * u * t * t * c2.y + t * t * t * b.y };\n });\n}\n","import type { VisualliDocument, VisualliLayer, FlatNode, MindMapConnection } from '../types/index.js';\nimport { fitView, fitViewInset, layerBounds, type FrameBox, type FrameInsets } from '../generated/geometry/interaction.js';\nimport { PILL, containerHull, pillScaled } from '../generated/geometry/container.js';\n\n// ── Connection helpers ────────────────────────────────────────────────────────\n\n/**\n * Returns all top-level connections that originate from the given layer.\n * A \"top-level connection\" links two nodes that both live in `layerId`.\n */\nexport function getConnectionsForLayer(\n doc: VisualliDocument,\n layerId: string,\n): MindMapConnection[] {\n const layer = doc.layers.get(layerId);\n if (!layer) return [];\n // Convert schema LayerConnection to simplified mindmap MindMapConnection\n return layer.connections.map(c => ({\n from: c.from,\n to: c.to,\n level: layer.level,\n label: c.data?.label,\n style: c.data?.style === 'dashed' ? 'dashed' : 'solid',\n } satisfies MindMapConnection));\n}\n\n/**\n * Given a node in the current layer, returns the child layer (if any) that the\n * node \"owns\" — i.e. the node is the entry-point into that child layer.\n */\nexport function getChildLayerForNode(\n doc: VisualliDocument,\n nodeId: string,\n currentLayerId: string,\n): VisualliLayer | null {\n // Walk all layers looking for one whose `parentNodeId` matches\n for (const [, layer] of doc.layers) {\n if (layer.parentLayerId === currentLayerId && layer.parentNodeId === nodeId) {\n return layer;\n }\n }\n return null;\n}\n\n/**\n * \n */\nexport function getLayerForNavigation(\n doc: VisualliDocument,\n nodeId: string,\n currentLayerId: string,\n): VisualliLayer | null {\n return getChildLayerForNode(doc, nodeId, currentLayerId);\n}\n\n// ── Fit to view ───────────────────────────────────────────────────────────────\n//\n// The design system's fit (geometry/interaction.ts → layerBounds / fitView): every\n// idea at its real size with room around it, and every container hull with room for\n// its name pill; never enlarging a layer beyond VIEW.fitMax.\n\nexport interface FitResult {\n centerX: number;\n centerY: number;\n zoomLevel: number;\n}\n\n/** A container as the fit sees it: its members and, when it has a name, the name's pill at 1x (`w` × `h`, the design\n * system's pillLayout: the host measures it with the real face). The hull widens for the pill and the framing leaves\n * room for it (containerHull, layerBounds). Without it the container is framed by its hull alone. */\nexport interface FitContainer { nodeIds: string[]; pill?: { w: number; h: number } | null }\n\n/** The box a layer is framed by: its ideas (their real sizes) and the hulls of its `containers`. */\nexport function layerFrame(nodes: ReadonlyArray<FlatNode>, containers: ReadonlyArray<FitContainer> = []): FrameBox {\n const byId = new Map(nodes.map((n) => [n.id, n]));\n const hulls: Array<FrameBox & { pillH?: number }> = [];\n for (const c of containers) {\n const hull = containerHull(c.nodeIds.flatMap((id) => { const n = byId.get(id); return n ? [{ x: n.x, y: n.y, rx: n.width / 2, ry: n.height / 2 }] : []; }), c.pill);\n if (hull) hulls.push(c.pill ? { ...hull, pillH: pillScaled(c.pill, PILL.maxGrow).h } : hull);\n }\n return layerBounds(nodes.map((n) => ({ x: n.x, y: n.y, rx: n.width / 2, ry: n.height / 2 })), hulls);\n}\n\n/** The zoom that fits a layer's ideas (and container hulls) into a canvas of `canvasWidth` × `canvasHeight`. */\nexport function calculateFitZoom(nodes: FlatNode[], canvasWidth: number, canvasHeight: number, containers: ReadonlyArray<FitContainer> = []): number {\n if (nodes.length === 0) return 1;\n return fitView(layerFrame(nodes, containers), canvasWidth, canvasHeight).scale;\n}\n\n/** The world point a fitted layer is centred on: the middle of its frame. */\nexport function calculateFitCenter(nodes: FlatNode[], containers: ReadonlyArray<FitContainer> = []): { x: number; y: number } {\n if (nodes.length === 0) return { x: 0, y: 0 };\n const f = layerFrame(nodes, containers);\n return { x: (f.x0 + f.x1) / 2, y: (f.y0 + f.y1) / 2 };\n}\n\n// ── Container helpers ────────────────────────────────────────────────────────\n\n// Inline the container shape here to avoid a circular import with KonvaContainerLayer.\nexport interface ContainerGroupInfo {\n id: string;\n label?: string;\n nodeIds: string[];\n level: number;\n}\n\n/**\n * Returns the container groups the given layer draws, normalising both the\n * nested-data format `{data:{label,formation}}` and the flat format `{label}`.\n */\nexport function getContainersForLayer(\n doc: VisualliDocument,\n layerId: string,\n): ContainerGroupInfo[] {\n const layer = doc.layers.get(layerId);\n if (!layer) return [];\n \n // Defensive: ensure containers is an array\n const containers = layer.containers ?? [];\n if (!Array.isArray(containers)) return [];\n \n // A container whose style is 'none' groups ideas without a hull or a name (the design system draws nothing for it).\n return containers.filter(c => c.data?.style !== 'none').map(c => {\n // Schema Container has nested data.label structure\n const label = c.data?.label ?? c.id;\n return { id: c.id, label, nodeIds: c.nodes, level: layer.level };\n });\n}\n\n/**\n * Fit to view: centre and zoom for a layer in one call (the design system's fitView). With `insets` (room the host's\n * chrome takes at each edge - a docked panel, a top bar, a composer), the canvas still fills its whole frame but the\n * layer fits the free area and sits centred in it (the design system's fitViewInset); the viewport centre returned is\n * the world point at the middle of the canvas, as the viewport store keeps it.\n */\nexport function calculateFitView(\n nodes: FlatNode[],\n canvasWidth: number,\n canvasHeight: number,\n containers: ReadonlyArray<FitContainer> = [],\n insets?: FrameInsets,\n): FitResult {\n if (nodes.length === 0) return { centerX: 0, centerY: 0, zoomLevel: 1 };\n if (!insets) {\n const { scale, center } = fitView(layerFrame(nodes, containers), canvasWidth, canvasHeight);\n return { centerX: center.x, centerY: center.y, zoomLevel: scale };\n }\n const { scale, center, screen } = fitViewInset(layerFrame(nodes, containers), canvasWidth, canvasHeight, insets);\n // screen = (world − centre) × scale + canvas / 2, so the frame's centre lands on `screen` (the free area's middle).\n return { centerX: center.x - (screen.x - canvasWidth / 2) / scale, centerY: center.y - (screen.y - canvasHeight / 2) / scale, zoomLevel: scale };\n}\n","import type { FlatNode, ViewportState } from '../types/index.js';\nimport { RBushSpatialIndex } from '../spatial/spatialIndex.js';\nimport { calculateViewportBounds } from '../viewport/viewportUtils.js';\nimport { nodeBounds } from './nodeGeometry.js';\n\nexport interface CullingOptions {\n nodes: FlatNode[];\n viewport: ViewportState;\n canvasWidth: number;\n canvasHeight: number;\n levelFilter?: number;\n skipCulling?: boolean;\n isDragging?: boolean;\n spatialIndex?: RBushSpatialIndex | null;\n spatialIndexThreshold?: number;\n}\n\nconst DEFAULT_SPATIAL_INDEX_THRESHOLD = 200;\n\n/**\n * True when anything drawn for the node touches the viewport. Nodes are drawn\n * CENTRED on (x, y) with rings and stroke around them, so the test uses the\n * node's real visual bounds (not a top-left rectangle).\n */\nexport function intersectsViewport(\n n: FlatNode,\n bounds: { minX: number; minY: number; maxX: number; maxY: number },\n): boolean {\n const b = nodeBounds(n);\n return b.maxX >= bounds.minX && b.minX <= bounds.maxX && b.maxY >= bounds.minY && b.minY <= bounds.maxY;\n}\n\n/**\n * Returns the subset of nodes currently visible in the viewport.\n * Framework-agnostic logic for culling and spatial indexing.\n */\nexport function getViewportVisibleNodes(options: CullingOptions): FlatNode[] {\n const {\n nodes,\n viewport,\n canvasWidth,\n canvasHeight,\n levelFilter,\n skipCulling = false,\n isDragging = false,\n spatialIndex,\n spatialIndexThreshold = DEFAULT_SPATIAL_INDEX_THRESHOLD,\n } = options;\n\n const filtered = levelFilter !== undefined\n ? nodes.filter(n => n.level === levelFilter)\n : nodes;\n\n if (filtered.length === 0) return [];\n\n // During transitions or drags show all nodes to avoid partial layer appearance\n if (skipCulling || isDragging) return filtered;\n\n const bounds = calculateViewportBounds(viewport, canvasWidth, canvasHeight);\n\n if (filtered.length < spatialIndexThreshold) {\n return filtered.filter(n => intersectsViewport(n, bounds));\n }\n\n if (spatialIndex) {\n const nodeIds = spatialIndex.query({\n minX: bounds.minX, minY: bounds.minY, maxX: bounds.maxX, maxY: bounds.maxY,\n });\n const idSet = new Set(nodeIds);\n return filtered.filter(n => idSet.has(n.id));\n }\n\n // Fallback to simple filter if no index provided but threshold exceeded\n return filtered.filter(n => intersectsViewport(n, bounds));\n}\n","// Generated from visualli.ai design-system/components/src/motion.ts — do not edit here.\n/* The canvas choreography — how a layer arrives, how you step inside and back out, how an idea answers hover.\n One source for every renderer: VisualMap drives its CSS animations from these values (as CSS variables and\n animation delays), and a canvas renderer (e.g. the spec SDK on Konva) can run the same timeline from its own loop.\n Times in ms, scales as factors, easings as cubic-bezier control points. No dependencies, so it can travel alone.\n The durations and easings equal the motion tokens (duration-*, ease-*, stagger-reveal); the build checks that. */\n\nexport type Bezier = readonly [number, number, number, number];\n\nexport const EASE = {\n /** ease-standard — UI and connector drawing. */ standard: [0.4, 0, 0.2, 1] as Bezier,\n /** ease-zoom — diving into and out of layers. */ zoom: [0.2, 0.8, 0.2, 1] as Bezier,\n /** ease-bloom — ideas arriving, with a little overshoot. */ bloom: [0.34, 1.4, 0.64, 1] as Bezier,\n};\n\nexport const MOTION = {\n /** A layer arrives: ideas bloom one by one in sibling order, center first, then connectors draw. */\n reveal: {\n /** duration-reveal: each idea's bloom. */ duration: 420,\n /** stagger-reveal: delay between consecutive ideas. */ stagger: 70,\n /** An idea starts at this scale… */ fromScale: 0.55,\n /** …and this fraction of the way from its place toward the layer's center. */ fromCenter: 0.5,\n ease: EASE.bloom,\n /** Settle time after the last bloom before the map is idle (interactive again). */ tail: 200,\n },\n /** Connectors of an arriving layer: they start once the ideas are mostly in. */\n connector: {\n /** Lead time before the first connector, on top of the ideas' stagger. */ lead: 240,\n /** Delay between consecutive connectors. */ stagger: 60,\n /** A solid connector draws from source to target; a dashed one fades in instead. */ draw: 500,\n /** The connector group's fade (duration-base). */ fade: 240,\n ease: EASE.standard,\n },\n /** Step inside: the current layer zooms toward the idea and fades; the inner layer then arrives (reveal). */\n dive: {\n /** The old layer's zoom, toward the idea's position. */ scale: 3.2,\n /** duration-zoom. */ duration: 500,\n /** It fades out after this delay, over `fade`. */ fadeDelay: 150, fade: 160,\n /** The layers swap (and the reveal starts) this long after the dive starts. */ swapAfter: 320,\n ease: EASE.zoom,\n },\n /** Back out (depth trail): the current layer shrinks toward the center and fades; the outer layer arrives. */\n surface: {\n scale: 0.6, duration: 220, fade: 200,\n swapAfter: 220,\n ease: EASE.zoom,\n },\n /** The arriving layer as a whole settles from slightly small. */\n settle: { fromScale: 0.94, duration: 260, ease: EASE.standard },\n /** Hover (pointer) or select: the idea lifts; its rings turn and grow a touch — a nudge, not a wobble. */\n hover: {\n lift: 2, ringRotate: -2, ringScale: 1.015,\n /** duration-base, for both the lift (ease-bloom) and the rings (ease-standard). */ duration: 240,\n liftEase: EASE.bloom, ringEase: EASE.standard,\n },\n /** Reduced motion, or Gradual reveal off: everything appears together with a short fade; dives become cross-fades. */\n reduced: { fade: 120 },\n /** Large layers. The stagger is written for a dozen ideas; a layer of hundreds would take minutes to arrive and\n * every frame of a bloom repaints the whole layer. Above `staggerSlots` ideas (and connectors), they share that many\n * slots, so a layer never takes longer to arrive than `staggerSlots` ideas would. Above `bloomMax` ideas the layer\n * fades in together (the reduced fade) and hover lifts snap instead of easing. */\n largeLayer: { staggerSlots: 30, bloomMax: 150 },\n} as const;\n\nexport type Point = { x: number; y: number };\n\n/** Delay before idea `i` (sibling order) starts to bloom. */\nexport function revealDelay(i: number): number { return i * MOTION.reveal.stagger; }\n\n/** Delay before connector `i` starts, in a layer of `nodeCount` ideas. */\nexport function connectorDelay(i: number, nodeCount: number): number {\n return MOTION.connector.lead + nodeCount * MOTION.reveal.stagger + i * MOTION.connector.stagger;\n}\n\n/** How long a layer's arrival takes, until the map is idle again. 0 with reduced motion. */\nexport function revealTotal(nodeCount: number, reduced = false): number {\n return reduced ? 0 : MOTION.reveal.duration + nodeCount * MOTION.reveal.stagger + MOTION.reveal.tail;\n}\n\n/** Where an idea starts its bloom, as an offset from its final position: part of the way toward the layer's center. */\nexport function bloomOffset(node: Point, center: Point): Point {\n const k = MOTION.reveal.fromCenter;\n return { x: (center.x - node.x) * k, y: (center.y - node.y) * k };\n}\n\n/** When the layers swap after Step inside ('in') or Back out ('out'). 0 with reduced motion (a cross-fade). */\nexport function swapDelay(dir: 'in' | 'out', reduced = false): number {\n return reduced ? 0 : dir === 'in' ? MOTION.dive.swapAfter : MOTION.surface.swapAfter;\n}\n\n/** The stagger slot of item `i` of `count` (ideas or connectors): its own index up to `staggerSlots`, then shared. */\nexport function revealSlot(i: number, count: number): number {\n const slots = Math.min(count, MOTION.largeLayer.staggerSlots);\n return count > slots ? Math.floor((i * slots) / count) : i;\n}\n\n/** Whether a layer of `nodeCount` ideas blooms in one by one (else it fades in together and hover lifts snap). */\nexport function layerBlooms(nodeCount: number): boolean { return nodeCount <= MOTION.largeLayer.bloomMax; }\n\n/** A layer's whole arrival, large layers included: when idea `i` and connector `i` start, and when the layer is idle. */\nexport function layerReveal(nodeCount: number, connectorCount: number, reduced = false) {\n const instant = reduced || !layerBlooms(nodeCount);\n const slots = Math.min(nodeCount, MOTION.largeLayer.staggerSlots);\n const edgeSlots = Math.min(connectorCount, MOTION.largeLayer.staggerSlots);\n return {\n /** Fades in together (reduced motion, Gradual reveal off, or a layer past `bloomMax`). */ instant,\n ideaDelay: (i: number) => (instant ? 0 : revealDelay(revealSlot(i, nodeCount))),\n connectorDelay: (i: number) => (instant ? 0 : connectorDelay(revealSlot(i, connectorCount), slots)),\n /** Until the map is idle again. */\n total: instant ? (reduced ? 0 : MOTION.reduced.fade) : Math.max(revealTotal(slots), edgeSlots ? connectorDelay(edgeSlots - 1, slots) + MOTION.connector.draw : 0),\n };\n}\n\n/** CSS form of an easing. */\nexport function cssEase(e: Bezier): string { return `cubic-bezier(${e.join(', ')})`; }\n\n/** Evaluate an easing at progress t (0–1), for renderers that animate in their own loop. */\nexport function ease(e: Bezier, t: number): number {\n const [x1, y1, x2, y2] = e;\n if (t <= 0) return 0; if (t >= 1) return 1;\n const bx = (u: number) => 3 * x1 * u * (1 - u) ** 2 + 3 * x2 * u * u * (1 - u) + u ** 3;\n const by = (u: number) => 3 * y1 * u * (1 - u) ** 2 + 3 * y2 * u * u * (1 - u) + u ** 3;\n let lo = 0, hi = 1, u = t;\n for (let k = 0; k < 24; k++) { u = (lo + hi) / 2; if (bx(u) < t) lo = u; else hi = u; }\n return by(u);\n}\n\n/** The CSS variables VisualMap sets on its root, so its stylesheet animates with exactly these values. */\nexport function motionVars(): Record<string, string> {\n const m = MOTION;\n return {\n '--vi-bloom-from': String(m.reveal.fromScale),\n '--vi-line-draw': `${m.connector.draw}ms`,\n '--vi-dive-scale': String(m.dive.scale), '--vi-dive-fade': `${m.dive.fade}ms`, '--vi-dive-fade-delay': `${m.dive.fadeDelay}ms`,\n '--vi-surface-scale': String(m.surface.scale), '--vi-surface-dur': `${m.surface.duration}ms`, '--vi-surface-fade': `${m.surface.fade}ms`,\n '--vi-settle-from': String(m.settle.fromScale), '--vi-settle-dur': `${m.settle.duration}ms`,\n '--vi-reduced-fade': `${m.reduced.fade}ms`,\n '--vi-lift': `${m.hover.lift}px`, '--vi-ring-turn': `${m.hover.ringRotate}deg`, '--vi-ring-grow': String(m.hover.ringScale),\n };\n}\n","// Generated from visualli.ai design-system/components/src/detail.ts — do not edit here.\n/* Level of detail: what an idea draws at the size it's seen. Far-out views of large maps show ideas as specks; the\n rings, label and shadow of an idea a few pixels wide can't be seen, and drawing them makes large maps slow. Every\n renderer follows the same thresholds, so a map simplifies alike everywhere. Sizes are on-screen CSS pixels of the\n idea's width. No dependencies, so it can travel alone. */\n\nexport const DETAIL = {\n /** Below this on-screen width an idea draws only its body: no rings, label or shadow. */ bodyOnlyBelow: 24,\n /** Below this it may be drawn as a plain filled speck in its topic fill (no outline) — indistinguishable at this size. */ speckBelow: 12,\n /** Above this many ideas in view, idea shadows are skipped (the costliest effect to draw). */ shadowsMaxVisible: 150,\n} as const;\n\nexport type IdeaDetail = 'full' | 'body' | 'speck';\n\n/** What an idea of this on-screen width draws. A selected, focused or hovered idea always draws in full. */\nexport function ideaDetail(screenWidth: number, emphasised = false): IdeaDetail {\n if (emphasised || screenWidth >= DETAIL.bodyOnlyBelow) return 'full';\n return screenWidth < DETAIL.speckBelow ? 'speck' : 'body';\n}\n\n/** Whether idea shadows are drawn with this many ideas in view. */\nexport function shadowsShown(visibleIdeas: number): boolean { return visibleIdeas <= DETAIL.shadowsMaxVisible; }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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I,cAAc,eAAe,OAAO,cAAe,QAAO;AAC9D,SAAO,cAAc,OAAO,aAAa,UAAU;AACrD;AAGO,SAAS,aAAa,cAA+B;AAAE,SAAO,gBAAgB,OAAO;AAAmB;","names":["overlap","labelScale","width","RBush","scale","center","u"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/layout/circularLayout.ts","../src/layout/linearLayout.ts","../src/layout/layoutUtils.ts","../src/parser/visualliParser.ts","../src/generated/designSystem.ts","../src/generated/geometry/color.ts","../src/theme/index.ts","../src/generated/geometry/idea.ts","../src/rendering/ideaSize.ts","../src/generated/geometry/blobShapes.ts","../src/generated/geometry/blob.ts","../src/rendering/nodeGeometry.ts","../src/parser/visualliConverter.ts","../src/parser/mindmapUtils.ts","../src/constants/layout.ts","../src/parser/configUtils.ts","../src/generated/geometry/interaction.ts","../src/constants/performanceConstants.ts","../src/constants/renderConfig.ts","../src/viewport/viewportUtils.ts","../src/performance/performanceMonitor.ts","../src/spatial/spatialIndex.ts","../../../../../node_modules/zustand/esm/vanilla.mjs","../src/stores/index.ts","../src/generated/geometry/container.ts","../src/utils/navigation.ts","../src/rendering/culling.ts","../src/generated/geometry/motion.ts","../src/generated/geometry/detail.ts"],"sourcesContent":["// ─── @visualli/core — Main Barrel Export ────────────────────────────────────\n//\n// Import from sub-paths for tree-shaking (e.g. `@visualli/core/layout`),\n// or use the main barrel for convenience.\n\nexport * from './types/index.js';\nexport * from './layout/index.js';\nexport * from './parser/index.js';\nexport * from './constants/index.js';\nexport * from './viewport/index.js';\nexport * from './performance/index.js';\nexport * from './spatial/index.js';\nexport * from './stores/index.js';\nexport * from './utils/navigation.js';\nexport * from './rendering/culling.js';\nexport * from './config/index.js';\nexport * from './theme/index.js';\n\n// The design system's choreography (layer reveal, step inside, back out, hover, reduced motion), verbatim.\nexport { MOTION, EASE, revealDelay, connectorDelay, revealTotal, bloomOffset, swapDelay, cssEase, ease as easeBezier, motionVars, revealSlot, layerBlooms, layerReveal } from './generated/geometry/motion.js';\nexport type { Bezier } from './generated/geometry/motion.js';\n// Containers: the dashed hull around a group's ideas and where its name goes (a pill on the hull, placed clear of\n// ideas, connectors and other names), verbatim from the design system's geometry/container.ts.\nexport { HULL, HULL_CLEAR, PILL, PILL_CHROME, pillLayout, pillScaled, containerHull, labelCandidates, placeContainerLabel, connectorSamples } from './generated/geometry/container.js';\nexport type { Hull, Box as LabelBox, LabelPlacement, LabelSide, Pt, PillSize } from './generated/geometry/container.js';\n// How terms, the peek, the touch sheet, zoom, fit, the depth trail and going back a layer by gesture behave, and which colour an idea gets: the design\n// system's geometry/interaction.ts and geometry/color.ts, verbatim. (Idea size and label growth, geometry/idea.ts, come\n// through rendering/ideaSize.)\nexport { TERM, PEEK, SHEET, VIEW, GESTURE, BACK, FRAME, PEEK_PLACEMENT, TRAIL, pointerModeFor, hoverOpensTerm, pinchZoom, zoomAround, layerBounds, ideaHighlight, fitView, fitViewInset, FIT_ROOM, peekPosition } from './generated/geometry/interaction.js';\nexport type { FrameBox, FrameInsets, LayerVia } from './generated/geometry/interaction.js';\n// Level of detail: what an idea draws at the size it's seen, and when shadows are skipped (geometry/detail.ts, verbatim).\nexport { DETAIL, ideaDetail, shadowsShown } from './generated/geometry/detail.js';\nexport type { IdeaDetail } from './generated/geometry/detail.js';\nexport { TOPIC_ORDER, CUSTOM, IMMERSION, topicFor } from './generated/geometry/color.js';\n","// ─── Circular Layout Algorithm ────────────────────────────────────────────────\n//\n// Positions nodes in a uniform circle with equal angular spacing.\n// PATTERN : Uniform circular distribution (polar coordinates)\n// SPACING : Equal angular intervals (2π/n)\n// ORIGIN : Configurable center (default 0, 0)\n// RADIUS : Configurable percentage of container (default 13.5%)\n\nimport type { FlatNode } from '../types/mindmap.js';\n\nexport interface CircularLayoutOptions {\n /** Radius as a fraction of the container's minimum dimension (0–1). Default: 0.135 */\n radiusPercentage?: number;\n /** Container width used to calculate absolute radius. Default: 2000 */\n containerWidth?: number;\n /** Container height used to calculate absolute radius. Default: 2000 */\n containerHeight?: number;\n /** World-space X of the circle centre. Default: 0 */\n centerX?: number;\n /** World-space Y of the circle centre. Default: 0 */\n centerY?: number;\n}\n\n/**\n * Apply circular layout to a set of nodes.\n * Mutates the `x` / `y` properties of each node and returns the same array.\n */\nexport function applyCircularLayout(\n nodes: FlatNode[],\n options: CircularLayoutOptions = {},\n): FlatNode[] {\n const {\n radiusPercentage = 0.135,\n containerWidth = 2000,\n containerHeight = 2000,\n centerX = 0,\n centerY = 0,\n } = options;\n\n if (nodes.length === 0) return nodes;\n\n if (nodes.length === 1) {\n nodes[0].x = centerX;\n nodes[0].y = centerY;\n return nodes;\n }\n\n const radius = Math.min(containerWidth, containerHeight) * radiusPercentage;\n\n // n=2 → horizontal; n≥3 → start at 12 o'clock\n const startAngle = nodes.length === 2 ? 0 : -Math.PI / 2;\n const angleStep = (2 * Math.PI) / nodes.length;\n\n for (let i = 0; i < nodes.length; i++) {\n const angle = startAngle + i * angleStep;\n nodes[i].x = centerX + radius * Math.cos(angle);\n nodes[i].y = centerY + radius * Math.sin(angle);\n }\n\n return nodes;\n}\n\n/**\n * Calculate the minimum radius needed to prevent node boxes from overlapping.\n *\n * Uses the chord-length formula: `chord = 2r · sin(θ/2)`, solved for `r`.\n */\nexport function calculateMinimumRadius(\n nodeCount: number,\n nodeWidth = 200,\n nodePadding = 150,\n): number {\n if (nodeCount <= 1) return 0;\n const angleStep = (2 * Math.PI) / nodeCount;\n const minChordLength = nodeWidth + nodePadding;\n return minChordLength / (2 * Math.sin(angleStep / 2));\n}\n\n/**\n * Calculate the optimal radius percentage for a given node count,\n * ensuring sufficient spacing for edge labels.\n *\n * @returns A value in [0.135, 0.45]\n */\nexport function calculateOptimalRadiusPercentage(\n nodeCount: number,\n containerWidth = 2000,\n containerHeight = 2000,\n nodeWidth = 200,\n nodePadding = 120,\n): number {\n const minRadius = calculateMinimumRadius(nodeCount, nodeWidth, nodePadding);\n const minDimension = Math.min(containerWidth, containerHeight);\n return Math.min(0.45, Math.max(0.135, minRadius / minDimension));\n}\n","// ─── Linear Layout Algorithms ─────────────────────────────────────────────────\n//\n// Positions nodes in a straight line without overlap, with enough gap between\n// node edges for edge-label text to render cleanly.\n//\n// linear-horizontal → left-to-right along X-axis\n// linear-vertical → top-to-bottom along Y-axis\n\nimport type { FlatNode } from '../types/mindmap.js';\n\nexport interface LinearLayoutOptions {\n /** Logical node width (px). Default: 200 */\n nodeWidth?: number;\n /** Logical node height (px). Default: 80 */\n nodeHeight?: number;\n /** Gap between node edges for horizontal layout (px). Default: 180 */\n hGap?: number;\n /** Gap between node edges for vertical layout (px). Default: 220 */\n vGap?: number;\n /** World X of the layout midpoint. Default: 0 */\n centerX?: number;\n /** World Y of the layout midpoint. Default: 0 */\n centerY?: number;\n}\n\n/**\n * Arrange nodes in a horizontal row (shared Y, varying X).\n * Row is centred on (`centerX`, `centerY`).\n */\nexport function applyLinearHorizontalLayout(\n nodes: FlatNode[],\n options: LinearLayoutOptions = {},\n): FlatNode[] {\n const { nodeWidth = 200, hGap = 180, centerX = 0, centerY = 0 } = options;\n\n if (nodes.length === 0) return nodes;\n\n if (nodes.length === 1) {\n nodes[0].x = centerX;\n nodes[0].y = centerY;\n return nodes;\n }\n\n const spacing = nodeWidth + hGap;\n const totalWidth = (nodes.length - 1) * spacing;\n const startX = centerX - totalWidth / 2;\n\n for (let i = 0; i < nodes.length; i++) {\n nodes[i].x = startX + i * spacing;\n nodes[i].y = centerY;\n }\n\n return nodes;\n}\n\n/**\n * Arrange nodes in a vertical column (shared X, varying Y).\n * Column is centred on (`centerX`, `centerY`).\n */\nexport function applyLinearVerticalLayout(\n nodes: FlatNode[],\n options: LinearLayoutOptions = {},\n): FlatNode[] {\n const { nodeHeight = 80, vGap = 220, centerX = 0, centerY = 0 } = options;\n\n if (nodes.length === 0) return nodes;\n\n if (nodes.length === 1) {\n nodes[0].x = centerX;\n nodes[0].y = centerY;\n return nodes;\n }\n\n const spacing = nodeHeight + vGap;\n const totalHeight = (nodes.length - 1) * spacing;\n const startY = centerY - totalHeight / 2;\n\n for (let i = 0; i < nodes.length; i++) {\n nodes[i].x = centerX;\n nodes[i].y = startY + i * spacing;\n }\n\n return nodes;\n}\n","// ─── Layout Utilities ─────────────────────────────────────────────────────────\n//\n// Collision detection and force-based positioning for MindMapNode trees.\n\nimport type { MindMapNode } from '../types/mindmap.js';\n\nexport interface CollisionBox {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/** Axis-aligned bounding box for a node, expanded by a fixed padding. */\nexport function getNodeBounds(node: MindMapNode): CollisionBox {\n const baseWidth = Math.max(120, node.title.length * 8 + 40);\n const baseHeight = Math.max(40, 32 + 16);\n const padding = 20;\n return {\n x: node.x - baseWidth / 2 - padding,\n y: node.y - baseHeight / 2 - padding,\n width: baseWidth + padding * 2,\n height: baseHeight + padding * 2,\n };\n}\n\nexport function checkCollision(box1: CollisionBox, box2: CollisionBox): boolean {\n return !(\n box1.x + box1.width < box2.x ||\n box2.x + box2.width < box1.x ||\n box1.y + box1.height < box2.y ||\n box2.y + box2.height < box1.y\n );\n}\n\n/**\n * Iteratively resolve bounding-box collisions within each level.\n * Nodes are pushed apart symmetrically until no overlaps remain\n * or `maxIterations` is reached.\n */\nexport function resolveCollisions(nodes: MindMapNode[], maxIterations = 10): MindMapNode[] {\n const result = [...nodes];\n\n for (let iter = 0; iter < maxIterations; iter++) {\n let hasCollisions = false;\n\n const byLevel = result.reduce<Record<number, MindMapNode[]>>((acc, n) => {\n (acc[n.level] ??= []).push(n);\n return acc;\n }, {});\n\n for (const levelNodes of Object.values(byLevel)) {\n for (let i = 0; i < levelNodes.length; i++) {\n for (let j = i + 1; j < levelNodes.length; j++) {\n const n1 = levelNodes[i];\n const n2 = levelNodes[j];\n if (!checkCollision(getNodeBounds(n1), getNodeBounds(n2))) continue;\n\n hasCollisions = true;\n const dx = n2.x - n1.x;\n const dy = n2.y - n1.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n\n if (dist < 1) {\n n2.x += 100;\n } else {\n const b1 = getNodeBounds(n1);\n const b2 = getNodeBounds(n2);\n const minSep = (b1.width + b2.width) / 2;\n const overlap = minSep - dist + 20;\n if (overlap > 0) {\n const move = overlap / 2;\n n1.x -= (dx / dist) * move;\n n1.y -= (dy / dist) * move;\n n2.x += (dx / dist) * move;\n n2.y += (dy / dist) * move;\n }\n }\n }\n }\n }\n\n if (!hasCollisions) break;\n }\n\n return result;\n}\n\n/**\n * Apply a lightweight repulsive force between same-level nodes that are\n * closer than 300 px, then resolve remaining collisions.\n */\nexport function optimizeLayout(nodes: MindMapNode[]): MindMapNode[] {\n const result = [...nodes];\n const iterations = 5;\n const repulsion = 1000;\n const damp = 0.8;\n\n for (let iter = 0; iter < iterations; iter++) {\n const forces = new Map<string, { x: number; y: number }>();\n result.forEach(n => forces.set(n.id, { x: 0, y: 0 }));\n\n for (let i = 0; i < result.length; i++) {\n for (let j = i + 1; j < result.length; j++) {\n const n1 = result[i];\n const n2 = result[j];\n if (n1.level !== n2.level) continue;\n\n const dx = n2.x - n1.x;\n const dy = n2.y - n1.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n if (dist <= 0 || dist >= 300) continue;\n\n const force = repulsion / (dist * dist);\n const f1 = forces.get(n1.id)!;\n const f2 = forces.get(n2.id)!;\n f1.x -= (dx / dist) * force;\n f1.y -= (dy / dist) * force;\n f2.x += (dx / dist) * force;\n f2.y += (dy / dist) * force;\n }\n }\n\n result.forEach(n => {\n const f = forces.get(n.id)!;\n n.x += f.x * damp;\n n.y += f.y * damp;\n });\n }\n\n return resolveCollisions(result);\n}\n","// ─── .visualli File Parser ────────────────────────────────────────────────────\n//\n// Reads JSONL (JSON Lines) format and parses into a structured VisualliDocument.\n\nimport type { VisualliDocument, SemanticAnchor } from '../types/document.js';\nimport type { VisualliMeta } from '../types/meta.js';\nimport type { VisualliLayer } from '../types/layer.js';\nimport type { Layer } from '../types/schema.js';\n\n/**\n * Convert schema Layer to VisualliLayer by ensuring required arrays exist.\n */\nfunction toVisualliLayer(schemaLayer: Layer): VisualliLayer {\n return {\n type: 'layer',\n id: schemaLayer.id,\n level: schemaLayer.level,\n parentLayerId: schemaLayer.parentLayerId,\n parentNodeId: schemaLayer.parentNodeId,\n layout: schemaLayer.layout,\n nodes: schemaLayer.nodes ?? [],\n connections: schemaLayer.connections ?? [],\n containers: schemaLayer.containers ?? [],\n };\n}\n\nexport class VisualliParseError extends Error {\n constructor(message: string, public readonly lineNumber?: number) {\n super(message);\n this.name = 'VisualliParseError';\n }\n}\n\n/**\n * Parse a .visualli file content (JSONL format) into a VisualliDocument.\n *\n * @throws VisualliParseError on malformed input\n */\nexport function parseVisualliFile(content: string): VisualliDocument {\n const lines = content.trim().split('\\n');\n\n const doc: VisualliDocument = {\n meta: null as unknown as VisualliMeta,\n layers: new Map(),\n layersByLevel: new Map(),\n rootLayer: null,\n };\n\n let lineNumber = 0;\n\n for (const line of lines) {\n lineNumber++;\n if (!line.trim()) continue;\n\n let obj: Record<string, unknown>;\n try {\n obj = JSON.parse(line) as Record<string, unknown>;\n } catch (err) {\n throw new VisualliParseError(\n `Failed to parse JSON at line ${lineNumber}: ${err}`,\n lineNumber,\n );\n }\n\n if (!obj['type']) {\n throw new VisualliParseError(\n `Missing 'type' field at line ${lineNumber}`,\n lineNumber,\n );\n }\n\n switch (obj['type']) {\n case 'meta':\n doc.meta = obj as unknown as VisualliMeta;\n break;\n\n case 'layer': {\n // Convert schema Layer to VisualliLayer\n const schemaLayer = obj as unknown as Layer;\n const layer = toVisualliLayer(schemaLayer);\n \n doc.layers.set(layer.id, layer);\n\n if (!doc.layersByLevel.has(layer.level)) {\n doc.layersByLevel.set(layer.level, []);\n }\n doc.layersByLevel.get(layer.level)!.push(layer);\n\n if (layer.level === 0) {\n doc.rootLayer = layer;\n }\n break;\n }\n\n case 'extension': {\n const id = obj['id'];\n if (typeof id === 'string') {\n (doc.extensions ??= {})[id] = Array.isArray(obj['data']) ? (obj['data'] as unknown[]) : [];\n }\n break;\n }\n\n default:\n // Unknown type — silently skip\n break;\n }\n }\n\n if (!doc.meta) throw new VisualliParseError('Missing required meta section');\n if (!doc.rootLayer) throw new VisualliParseError('Missing root layer (level 0)');\n\n return doc;\n}\n\nexport async function fetchAndParseVisualli(url: string): Promise<VisualliDocument> {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n return parseVisualliFile(await response.text());\n}\n\n/**\n * Parse .visualli JSONL data as returned from the MongoDB `visualli` field.\n *\n * @throws VisualliParseError\n */\nexport function parseVisualliFromMongoDB(visualliJsonl: string): VisualliDocument {\n if (!visualliJsonl || typeof visualliJsonl !== 'string') {\n throw new VisualliParseError('Invalid visualli data: expected a JSONL string');\n }\n const trimmed = visualliJsonl.trim();\n if (!trimmed) throw new VisualliParseError('Empty visualli data from MongoDB');\n return parseVisualliFile(trimmed);\n}\n\n/**\n * Parse a .visualli file from a browser `File` object.\n * (Browser-only – requires `FileReader`.)\n */\nexport function loadVisualliFileFromFile(file: File): Promise<VisualliDocument> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = e => {\n try {\n resolve(parseVisualliFile(e.target?.result as string));\n } catch (err) {\n reject(err);\n }\n };\n reader.onerror = () => reject(new Error('Failed to read file'));\n reader.readAsText(file);\n });\n}\n\n// ── Tree Helpers ──────────────────────────────────────────────────────────────\n\n/** Return all layers whose `parentNodeId` matches the given node ID. */\n/** Terms defined by the document's `semantic-anchors` extension (empty when absent). */\nexport function getSemanticAnchors(doc: VisualliDocument): SemanticAnchor[] {\n const raw = doc.extensions?.['semantic-anchors'];\n if (!Array.isArray(raw)) return [];\n return raw.filter((a): a is SemanticAnchor => !!a && typeof (a as SemanticAnchor).word === 'string' && typeof (a as SemanticAnchor).description === 'string');\n}\n\nexport function getChildLayers(\n doc: VisualliDocument,\n nodeId: string,\n): VisualliLayer[] {\n const result: VisualliLayer[] = [];\n for (const layer of doc.layers.values()) {\n if (layer.parentNodeId === nodeId) result.push(layer);\n }\n return result;\n}\n\n/**\n * Count the maximum depth of layers beneath a node (its \"magnitude\").\n * Returns 0 when the node has no child layers.\n */\nexport function countLayersBeneath(\n doc: VisualliDocument,\n nodeId: string,\n visited = new Set<string>(),\n): number {\n if (visited.has(nodeId)) return 0;\n visited.add(nodeId);\n\n const children = getChildLayers(doc, nodeId);\n if (children.length === 0) return 0;\n\n let maxDepth = 0;\n for (const layer of children) {\n let depth = 1;\n for (const node of layer.nodes) {\n depth = Math.max(depth, 1 + countLayersBeneath(doc, node.id, visited));\n }\n maxDepth = Math.max(maxDepth, depth);\n }\n return maxDepth;\n}\n","// GENERATED by scripts/gen-design-system.mjs from design-system/ (tokens/tokens.json, tokens/tokens.css). Do not edit.\n// Change the design system instead; the next `npm run build` regenerates this file.\n\n/** Version of the design system these modules were generated from. */\nexport const DESIGN_SYSTEM_VERSION = \"0.3.7\" as const;\n\nexport const THEME_NAMES = [\n \"light\",\n \"dark\",\n \"focus-light\",\n \"focus-dark\",\n \"colorsafe-light\",\n \"colorsafe-dark\",\n \"contrast-light\",\n \"contrast-dark\"\n] as const;\nexport type ThemeName = (typeof THEME_NAMES)[number];\n\n/** Every token for every theme (each theme already merged over \"light\"). Keys match the CSS custom properties. */\nexport const TOKENS: Readonly<Record<ThemeName, Readonly<Record<string, string>>>> = {\n \"light\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#f6f3ee\",\n \"surface\": \"#ffffff\",\n \"surface-sunken\": \"#f0ece5\",\n \"surface-overlay\": \"#ffffff\",\n \"line\": \"#e4dfd6\",\n \"line-strong\": \"#7a7f94\",\n \"ink\": \"#182140\",\n \"ink-muted\": \"#4f5671\",\n \"ink-subtle\": \"#5f647c\",\n \"action\": \"#182140\",\n \"on-action\": \"#ffffff\",\n \"focus\": \"#325e8c\",\n \"link\": \"#2f5a87\",\n \"selection\": \"rgba(18, 199, 211, 0.28)\",\n \"node-ink\": \"#182140\",\n \"edge\": \"#2a3048\",\n \"edge-label\": \"#4f5671\",\n \"info\": \"#2f5a87\",\n \"info-soft\": \"#e2edf8\",\n \"topic-teal\": \"#87f2f8\",\n \"topic-teal-ring\": \"#00949c\",\n \"topic-harbor\": \"#bcdbff\",\n \"topic-harbor-ring\": \"#4386c5\",\n \"topic-iris\": \"#e0c8fe\",\n \"topic-iris-ring\": \"#9570c1\",\n \"topic-berry\": \"#ffbdc4\",\n \"topic-berry-ring\": \"#cc5b6d\",\n \"topic-coral\": \"#ffc7b2\",\n \"topic-coral-ring\": \"#c56741\",\n \"topic-amber\": \"#ffcf9d\",\n \"topic-amber-ring\": \"#b97201\",\n \"topic-sun\": \"#ffea94\",\n \"topic-sun-ring\": \"#a18600\",\n \"topic-stone\": \"#e0dacf\",\n \"topic-stone-ring\": \"#8b8272\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"0 1px 2px rgba(24, 33, 64, 0.06), 0 8px 24px rgba(24, 33, 64, 0.08)\",\n \"shadow-pop\": \"0 2px 4px rgba(24, 33, 64, 0.08), 0 16px 40px rgba(24, 33, 64, 0.14)\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n },\n \"dark\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#0f1220\",\n \"surface\": \"#171b2b\",\n \"surface-sunken\": \"#0f1220\",\n \"surface-overlay\": \"#212639\",\n \"line\": \"#2b3148\",\n \"line-strong\": \"#6c7392\",\n \"ink\": \"#eef0f7\",\n \"ink-muted\": \"#b3b8cc\",\n \"ink-subtle\": \"#8f95ae\",\n \"action\": \"#f6f3ee\",\n \"on-action\": \"#182140\",\n \"focus\": \"#12c7d3\",\n \"link\": \"#5fd8e1\",\n \"selection\": \"rgba(18, 199, 211, 0.32)\",\n \"node-ink\": \"#182140\",\n \"edge\": \"#c9cddc\",\n \"edge-label\": \"#b3b8cc\",\n \"info\": \"#7cc8f2\",\n \"info-soft\": \"#13283a\",\n \"topic-teal\": \"#87f2f8\",\n \"topic-teal-ring\": \"#0fc5cd\",\n \"topic-harbor\": \"#bcdbff\",\n \"topic-harbor-ring\": \"#73aceb\",\n \"topic-iris\": \"#e0c8fe\",\n \"topic-iris-ring\": \"#b691e1\",\n \"topic-berry\": \"#ffbdc4\",\n \"topic-berry-ring\": \"#eb798a\",\n \"topic-coral\": \"#ffc7b2\",\n \"topic-coral-ring\": \"#ea8962\",\n \"topic-amber\": \"#ffcf9d\",\n \"topic-amber-ring\": \"#e29737\",\n \"topic-sun\": \"#ffea94\",\n \"topic-sun-ring\": \"#d8b70a\",\n \"topic-stone\": \"#e0dacf\",\n \"topic-stone-ring\": \"#b4a999\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"0 1px 2px rgba(0, 0, 0, 0.40), 0 8px 24px rgba(0, 0, 0, 0.35)\",\n \"shadow-pop\": \"0 2px 4px rgba(0, 0, 0, 0.50), 0 16px 40px rgba(0, 0, 0, 0.50)\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n },\n \"focus-light\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#f4f2ee\",\n \"surface\": \"#ffffff\",\n \"surface-sunken\": \"#f0ece5\",\n \"surface-overlay\": \"#ffffff\",\n \"line\": \"#e4dfd6\",\n \"line-strong\": \"#7a7f94\",\n \"ink\": \"#182140\",\n \"ink-muted\": \"#4f5671\",\n \"ink-subtle\": \"#5f647c\",\n \"action\": \"#182140\",\n \"on-action\": \"#ffffff\",\n \"focus\": \"#325e8c\",\n \"link\": \"#2f5a87\",\n \"selection\": \"rgba(18, 199, 211, 0.28)\",\n \"node-ink\": \"#182140\",\n \"edge\": \"#5a6079\",\n \"edge-label\": \"#5a6079\",\n \"info\": \"#2f5a87\",\n \"info-soft\": \"#e2edf8\",\n \"topic-teal\": \"#bce8ea\",\n \"topic-teal-ring\": \"#2c9298\",\n \"topic-harbor\": \"#c9d9ec\",\n \"topic-harbor-ring\": \"#5d85af\",\n \"topic-iris\": \"#d9cfe8\",\n \"topic-iris-ring\": \"#8e76aa\",\n \"topic-berry\": \"#edc6c9\",\n \"topic-berry-ring\": \"#b26c75\",\n \"topic-coral\": \"#eecec1\",\n \"topic-coral-ring\": \"#ae725b\",\n \"topic-amber\": \"#eed4ba\",\n \"topic-amber-ring\": \"#a67947\",\n \"topic-sun\": \"#f4eac1\",\n \"topic-sun-ring\": \"#98883f\",\n \"topic-stone\": \"#dddad5\",\n \"topic-stone-ring\": \"#8b8272\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"0 1px 2px rgba(24, 33, 64, 0.06), 0 8px 24px rgba(24, 33, 64, 0.08)\",\n \"shadow-pop\": \"0 2px 4px rgba(24, 33, 64, 0.08), 0 16px 40px rgba(24, 33, 64, 0.14)\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n },\n \"focus-dark\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#12141c\",\n \"surface\": \"#171b2b\",\n \"surface-sunken\": \"#0f1220\",\n \"surface-overlay\": \"#212639\",\n \"line\": \"#2b3148\",\n \"line-strong\": \"#6c7392\",\n \"ink\": \"#eef0f7\",\n \"ink-muted\": \"#b3b8cc\",\n \"ink-subtle\": \"#8f95ae\",\n \"action\": \"#f6f3ee\",\n \"on-action\": \"#182140\",\n \"focus\": \"#12c7d3\",\n \"link\": \"#5fd8e1\",\n \"selection\": \"rgba(18, 199, 211, 0.32)\",\n \"node-ink\": \"#182140\",\n \"edge\": \"#a9aec0\",\n \"edge-label\": \"#b3b8cc\",\n \"info\": \"#7cc8f2\",\n \"info-soft\": \"#13283a\",\n \"topic-teal\": \"#bce8ea\",\n \"topic-teal-ring\": \"#71bdc1\",\n \"topic-harbor\": \"#c9d9ec\",\n \"topic-harbor-ring\": \"#8cabce\",\n \"topic-iris\": \"#d9cfe8\",\n \"topic-iris-ring\": \"#ae9bc6\",\n \"topic-berry\": \"#edc6c9\",\n \"topic-berry-ring\": \"#cc8e95\",\n \"topic-coral\": \"#eecec1\",\n \"topic-coral-ring\": \"#cd9884\",\n \"topic-amber\": \"#eed4ba\",\n \"topic-amber-ring\": \"#c9a176\",\n \"topic-sun\": \"#f4eac1\",\n \"topic-sun-ring\": \"#c9b97a\",\n \"topic-stone\": \"#dddad5\",\n \"topic-stone-ring\": \"#b4a999\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"0 1px 2px rgba(24, 33, 64, 0.06), 0 8px 24px rgba(24, 33, 64, 0.08)\",\n \"shadow-pop\": \"0 2px 4px rgba(24, 33, 64, 0.08), 0 16px 40px rgba(24, 33, 64, 0.14)\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n },\n \"colorsafe-light\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#f6f3ee\",\n \"surface\": \"#ffffff\",\n \"surface-sunken\": \"#f0ece5\",\n \"surface-overlay\": \"#ffffff\",\n \"line\": \"#e4dfd6\",\n \"line-strong\": \"#7a7f94\",\n \"ink\": \"#182140\",\n \"ink-muted\": \"#4f5671\",\n \"ink-subtle\": \"#5f647c\",\n \"action\": \"#182140\",\n \"on-action\": \"#ffffff\",\n \"focus\": \"#325e8c\",\n \"link\": \"#2f5a87\",\n \"selection\": \"rgba(18, 199, 211, 0.28)\",\n \"node-ink\": \"#182140\",\n \"edge\": \"#2a3048\",\n \"edge-label\": \"#4f5671\",\n \"info\": \"#603376\",\n \"info-soft\": \"#efe6f6\",\n \"topic-teal\": \"#bbeec1\",\n \"topic-teal-ring\": \"#389754\",\n \"topic-harbor\": \"#9bc9ef\",\n \"topic-harbor-ring\": \"#1d84b9\",\n \"topic-iris\": \"#d7a9c7\",\n \"topic-iris-ring\": \"#ae5d94\",\n \"topic-berry\": \"#e7a692\",\n \"topic-berry-ring\": \"#c05a36\",\n \"topic-coral\": \"#f5c893\",\n \"topic-coral-ring\": \"#b27212\",\n \"topic-amber\": \"#a6edff\",\n \"topic-amber-ring\": \"#1092af\",\n \"topic-sun\": \"#fbf494\",\n \"topic-sun-ring\": \"#938e00\",\n \"topic-stone\": \"#dbdbdb\",\n \"topic-stone-ring\": \"#898284\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"0 1px 2px rgba(24, 33, 64, 0.06), 0 8px 24px rgba(24, 33, 64, 0.08)\",\n \"shadow-pop\": \"0 2px 4px rgba(24, 33, 64, 0.08), 0 16px 40px rgba(24, 33, 64, 0.14)\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n },\n \"colorsafe-dark\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#0f1220\",\n \"surface\": \"#171b2b\",\n \"surface-sunken\": \"#0f1220\",\n \"surface-overlay\": \"#212639\",\n \"line\": \"#2b3148\",\n \"line-strong\": \"#6c7392\",\n \"ink\": \"#eef0f7\",\n \"ink-muted\": \"#b3b8cc\",\n \"ink-subtle\": \"#8f95ae\",\n \"action\": \"#f6f3ee\",\n \"on-action\": \"#182140\",\n \"focus\": \"#12c7d3\",\n \"link\": \"#5fd8e1\",\n \"selection\": \"rgba(18, 199, 211, 0.32)\",\n \"node-ink\": \"#182140\",\n \"edge\": \"#c9cddc\",\n \"edge-label\": \"#b3b8cc\",\n \"info\": \"#daa4f6\",\n \"info-soft\": \"#2a1c33\",\n \"topic-teal\": \"#bbeec1\",\n \"topic-teal-ring\": \"#69c27e\",\n \"topic-harbor\": \"#9bc9ef\",\n \"topic-harbor-ring\": \"#5eade2\",\n \"topic-iris\": \"#d7a9c7\",\n \"topic-iris-ring\": \"#d383b9\",\n \"topic-berry\": \"#e7a692\",\n \"topic-berry-ring\": \"#e37a55\",\n \"topic-coral\": \"#f5c893\",\n \"topic-coral-ring\": \"#db9840\",\n \"topic-amber\": \"#a6edff\",\n \"topic-amber-ring\": \"#5bbdda\",\n \"topic-sun\": \"#fbf494\",\n \"topic-sun-ring\": \"#c9bf37\",\n \"topic-stone\": \"#dbdbdb\",\n \"topic-stone-ring\": \"#b1a8aa\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"0 1px 2px rgba(24, 33, 64, 0.06), 0 8px 24px rgba(24, 33, 64, 0.08)\",\n \"shadow-pop\": \"0 2px 4px rgba(24, 33, 64, 0.08), 0 16px 40px rgba(24, 33, 64, 0.14)\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n },\n \"contrast-light\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#ffffff\",\n \"surface\": \"#ffffff\",\n \"surface-sunken\": \"#f2f2f2\",\n \"surface-overlay\": \"#ffffff\",\n \"line\": \"#5c6178\",\n \"line-strong\": \"#000000\",\n \"ink\": \"#000000\",\n \"ink-muted\": \"#1f2433\",\n \"ink-subtle\": \"#3a3f52\",\n \"action\": \"#000000\",\n \"on-action\": \"#ffffff\",\n \"focus\": \"#0b4a8f\",\n \"link\": \"#0b4a8f\",\n \"selection\": \"rgba(18, 199, 211, 0.28)\",\n \"node-ink\": \"#000000\",\n \"edge\": \"#000000\",\n \"edge-label\": \"#1f2433\",\n \"info\": \"#471f61\",\n \"info-soft\": \"#ffffff\",\n \"topic-teal\": \"#87f2f8\",\n \"topic-teal-ring\": \"#006b70\",\n \"topic-harbor\": \"#bcdbff\",\n \"topic-harbor-ring\": \"#0e599d\",\n \"topic-iris\": \"#e0c8fe\",\n \"topic-iris-ring\": \"#683b92\",\n \"topic-berry\": \"#ffbdc4\",\n \"topic-berry-ring\": \"#96173a\",\n \"topic-coral\": \"#ffc7b2\",\n \"topic-coral-ring\": \"#923400\",\n \"topic-amber\": \"#ffcf9d\",\n \"topic-amber-ring\": \"#7e4d00\",\n \"topic-sun\": \"#ffea94\",\n \"topic-sun-ring\": \"#7a6600\",\n \"topic-stone\": \"#e0dacf\",\n \"topic-stone-ring\": \"#63594b\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"none\",\n \"shadow-pop\": \"none\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n },\n \"contrast-dark\": {\n \"font-display\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, sans-serif\",\n \"font-ui\": \"\\\"Atkinson Hyperlegible Next\\\", system-ui, -apple-system, \\\"Segoe UI\\\", sans-serif\",\n \"font-hand\": \"Kalam, \\\"Atkinson Hyperlegible Next\\\", cursive\",\n \"font-note\": \"Caveat, Kalam, cursive\",\n \"font-mono\": \"\\\"Atkinson Hyperlegible Mono\\\", ui-monospace, \\\"SF Mono\\\", Menlo, monospace\",\n \"canvas\": \"#000000\",\n \"surface\": \"#000000\",\n \"surface-sunken\": \"#0d0d0d\",\n \"surface-overlay\": \"#0d0d0d\",\n \"line\": \"#9aa0b8\",\n \"line-strong\": \"#ffffff\",\n \"ink\": \"#ffffff\",\n \"ink-muted\": \"#e6e8f0\",\n \"ink-subtle\": \"#c8ccda\",\n \"action\": \"#ffffff\",\n \"on-action\": \"#000000\",\n \"focus\": \"#5fe8f0\",\n \"link\": \"#7ff0f5\",\n \"selection\": \"rgba(18, 199, 211, 0.32)\",\n \"node-ink\": \"#000000\",\n \"edge\": \"#ffffff\",\n \"edge-label\": \"#e6e8f0\",\n \"info\": \"#d5a5d6\",\n \"info-soft\": \"#000000\",\n \"topic-teal\": \"#87f2f8\",\n \"topic-teal-ring\": \"#64eff7\",\n \"topic-harbor\": \"#bcdbff\",\n \"topic-harbor-ring\": \"#b0d5fe\",\n \"topic-iris\": \"#e0c8fe\",\n \"topic-iris-ring\": \"#dcbfff\",\n \"topic-berry\": \"#ffbdc4\",\n \"topic-berry-ring\": \"#feb3bb\",\n \"topic-coral\": \"#ffc7b2\",\n \"topic-coral-ring\": \"#ffbea5\",\n \"topic-amber\": \"#ffcf9d\",\n \"topic-amber-ring\": \"#ffc78a\",\n \"topic-sun\": \"#ffea94\",\n \"topic-sun-ring\": \"#ffe26d\",\n \"topic-stone\": \"#e0dacf\",\n \"topic-stone-ring\": \"#ddd3c2\",\n \"space-1\": \"4px\",\n \"space-2\": \"8px\",\n \"space-3\": \"12px\",\n \"space-4\": \"16px\",\n \"space-7\": \"48px\",\n \"radius-sm\": \"10px\",\n \"radius-md\": \"16px\",\n \"radius-lg\": \"24px\",\n \"radius-pill\": \"999px\",\n \"shadow-float\": \"none\",\n \"shadow-pop\": \"none\",\n \"node-width\": \"200px\",\n \"node-height\": \"148px\",\n \"node-stroke\": \"3px\",\n \"edge-width\": \"2.5px\",\n \"edge-gap\": \"15px\",\n \"edge-arc-max\": \"45px\",\n \"immersion-alpha\": \"0.15\",\n \"zoom-min\": \"0.3\",\n \"zoom-max\": \"5\",\n \"duration-instant\": \"100ms\",\n \"duration-quick\": \"160ms\",\n \"duration-base\": \"240ms\",\n \"duration-zoom\": \"500ms\",\n \"duration-reveal\": \"420ms\",\n \"duration-autoplay\": \"7000ms\",\n \"stagger-reveal\": \"70ms\",\n \"ease-zoom\": \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n \"ease-standard\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"ease-bloom\": \"cubic-bezier(0.34, 1.4, 0.64, 1)\",\n \"z-chrome\": \"10\",\n \"z-card\": \"20\",\n \"z-menu\": \"40\"\n }\n};\n\n/** Topic palette names (token pairs `topic-<name>` / `topic-<name>-ring`). */\nexport const TOPICS = [\n \"teal\",\n \"harbor\",\n \"iris\",\n \"berry\",\n \"coral\",\n \"amber\",\n \"sun\",\n \"stone\"\n] as const;\nexport type TopicName = (typeof TOPICS)[number];\n\n/** Numeric tokens (px / ms stripped), camel-cased: nodeWidth, nodeStroke, edgeWidth, edgeGap, durationBase, zoomMin ... */\nexport const METRICS = {\n \"space1\": 4,\n \"space2\": 8,\n \"space3\": 12,\n \"space4\": 16,\n \"space7\": 48,\n \"radiusSm\": 10,\n \"radiusMd\": 16,\n \"radiusLg\": 24,\n \"radiusPill\": 999,\n \"nodeWidth\": 200,\n \"nodeHeight\": 148,\n \"nodeStroke\": 3,\n \"edgeWidth\": 2.5,\n \"edgeGap\": 15,\n \"edgeArcMax\": 45,\n \"immersionAlpha\": 0.15,\n \"zoomMin\": 0.3,\n \"zoomMax\": 5,\n \"durationInstant\": 100,\n \"durationQuick\": 160,\n \"durationBase\": 240,\n \"durationZoom\": 500,\n \"durationReveal\": 420,\n \"durationAutoplay\": 7000,\n \"staggerReveal\": 70,\n \"zChrome\": 10,\n \"zCard\": 20,\n \"zMenu\": 40\n} as const;\n/** Overrides applied when motion is reduced. */\nexport const METRICS_REDUCED_MOTION = {\n \"durationInstant\": 120,\n \"durationQuick\": 0,\n \"durationBase\": 0,\n \"durationZoom\": 0,\n \"durationReveal\": 0,\n \"durationAutoplay\": 0,\n \"staggerReveal\": 0\n} as const;\n\n/** Canvas type styles (family is a token name: font-hand, font-note, font-ui ...). */\nexport const TYPE_STYLES = {\n \"heading\": {\n \"family\": \"font-ui\",\n \"size\": 17,\n \"lineHeight\": 24,\n \"weight\": 700\n },\n \"body\": {\n \"family\": \"font-ui\",\n \"size\": 15,\n \"lineHeight\": 22,\n \"weight\": 400\n },\n \"body-sm\": {\n \"family\": \"font-ui\",\n \"size\": 13,\n \"lineHeight\": 18,\n \"weight\": 400\n },\n \"label\": {\n \"family\": \"font-ui\",\n \"size\": 13,\n \"lineHeight\": 16,\n \"weight\": 600,\n \"letterSpacing\": 0.01\n },\n \"caption\": {\n \"family\": \"font-ui\",\n \"size\": 12,\n \"lineHeight\": 16,\n \"weight\": 400\n },\n \"node-root\": {\n \"family\": \"font-hand\",\n \"size\": 30,\n \"lineHeight\": 34,\n \"weight\": 700\n },\n \"node-label\": {\n \"family\": \"font-hand\",\n \"size\": 22,\n \"lineHeight\": 26,\n \"weight\": 700\n },\n \"edge-label\": {\n \"family\": \"font-note\",\n \"size\": 18,\n \"lineHeight\": 20,\n \"weight\": 500\n },\n \"annotation\": {\n \"family\": \"font-note\",\n \"size\": 24,\n \"lineHeight\": 26,\n \"weight\": 600\n }\n} as const;\n\n/** Canvas styling extracted from css/spec.css (node labels, hover, shadows, connector dashes, group frames). */\nexport const CANVAS_STYLE = {\n \"node\": {\n \"selectedStrokeWidth\": 4,\n \"hoverRingsRotate\": -2,\n \"hoverRingsScale\": 1.015,\n \"hoverLift\": -2,\n \"dimmedOpacity\": 1,\n \"dimmedOpacityFocus\": 0.4,\n \"dimmedOpacityTouch\": 0.6,\n \"dimmedOpacityFocusTouch\": 0.4,\n \"highlightDimmedOpacity\": 0.35,\n \"shadowLight\": \"0 6px 14px rgba(24, 33, 64, .10)\",\n \"shadowDark\": \"0 0 22px rgba(255, 255, 255, .10)\"\n },\n \"edge\": {\n \"dash\": [\n 7,\n 7\n ],\n \"labelWeight\": 500,\n \"labelSize\": 18,\n \"readableLabelSize\": 14,\n \"readableLabelWeight\": 600,\n \"labelHaloWidth\": 5\n },\n \"group\": {\n \"strokeWidth\": 1.5,\n \"dash\": [\n 10,\n 6\n ],\n \"labelWeight\": 700,\n \"labelLineHeight\": 1.1,\n \"labelSize\": 26,\n \"labelPadding\": {\n \"top\": 6,\n \"x\": 22,\n \"bottom\": 8\n },\n \"labelMaxWidth\": 420,\n \"labelBorderWidth\": 1.5,\n \"readableLetterSpacing\": 0.02,\n \"labelFill\": \"topic-stone\",\n \"labelBorder\": \"topic-stone-ring\",\n \"labelInk\": \"node-ink\",\n \"contrastLabelBorderWidth\": 2,\n \"contrastLabelBorder\": \"line-strong\"\n }\n} as const;\n","// Generated from visualli.ai design-system/components/src/color.ts — do not edit here.\n/* Which topic an idea is drawn in. A `.visualli` file's `data.color` may name one of the eight topics or be any\n other color, or be missing. Every renderer resolves it with this rule, so a file looks the same everywhere:\n a topic name ('teal', 'Harbor ') → that topic (case and surrounding spaces don't matter);\n no color → the topics in order, by the idea's position among its siblings (so siblings differ);\n anything else (e.g. '#b7e7f3') → null: not a topic — drawn as given (customColor): the color as the fill, and\n the fill darkened (CUSTOM.ringShade) as the ring; a custom color doesn't follow themes.\n No dependencies, so it can travel alone. */\n\n/** The eight topics, in the order missing colors cycle through. */\nexport const TOPIC_ORDER = ['teal', 'harbor', 'iris', 'berry', 'coral', 'amber', 'sun', 'stone'] as const;\nexport type TopicName = (typeof TOPIC_ORDER)[number];\n\n/** The topic a color names, or null. */\nexport function topicFromName(color: string | null | undefined): TopicName | null {\n if (!color) return null;\n const c = color.trim().toLowerCase();\n return (TOPIC_ORDER as readonly string[]).includes(c) ? (c as TopicName) : null;\n}\n\n/** The topic for an idea: its named topic; with no color, the next topic in sibling order; null for any other color. */\nexport function topicFor(color: string | null | undefined, siblingIndex: number): TopicName | null {\n if (!color || !color.trim()) return TOPIC_ORDER[((siblingIndex % TOPIC_ORDER.length) + TOPIC_ORDER.length) % TOPIC_ORDER.length];\n return topicFromName(color);\n}\n\n/** Chromatic immersion: inside a layer, the canvas takes the fill of the idea you stepped into (at the `immersion-alpha`\n * token), so you always know whose inside you are in. Part of the spec, so it is on unless a host turns it off. */\nexport const IMMERSION = { /** Renderers draw it by default. */ defaultOn: true } as const;\n\n/** A custom (non-topic) color: drawn as given, with a darker ring. */\nexport const CUSTOM = { /** The ring is the fill with each RGB channel multiplied by this. */ ringShade: 0.78 } as const;\n\n/** Fill and ring for a custom color. `ring` is null when the color isn't a 6-digit hex (use the `edge` token then). */\nexport function customColor(color: string): { fill: string; ring: string | null } {\n const m = /^#?([0-9a-f]{6})$/i.exec((color || '').trim());\n if (!m) return { fill: color, ring: null };\n const n = parseInt(m[1], 16), f = CUSTOM.ringShade;\n const r = Math.round(((n >> 16) & 255) * f), g = Math.round(((n >> 8) & 255) * f), b = Math.round((n & 255) * f);\n return { fill: color.trim(), ring: '#' + ((1 << 24) | (r << 16) | (g << 8) | b).toString(16).slice(1) };\n}\n","// ─── Theme resolution ────────────────────────────────────────────────────────\n//\n// Everything visual comes from the generated design-system modules. This file\n// only decides WHICH of the 8 themes applies and resolves document colours with\n// the design system's colour rule. No colour literals live here.\n//\n// Dependencies: ../generated/designSystem.ts (generated from design-system/).\n\nimport {\n CANVAS_STYLE,\n DESIGN_SYSTEM_VERSION,\n METRICS,\n METRICS_REDUCED_MOTION,\n THEME_NAMES,\n TOKENS,\n TOPICS,\n TYPE_STYLES,\n type ThemeName,\n type TopicName,\n} from '../generated/designSystem.js';\nimport { TOPIC_ORDER, customColor, topicFor, topicFromName } from '../generated/geometry/color.js';\n\nexport { topicFromName, customColor };\n\nexport { CANVAS_STYLE, DESIGN_SYSTEM_VERSION, METRICS, METRICS_REDUCED_MOTION, THEME_NAMES, TOKENS, TOPICS, TYPE_STYLES };\nexport type { ThemeName, TopicName };\n\n// ── Theme selection ───────────────────────────────────────────────────────────\n\n/** Theme families: each resolves to its light or dark member. */\nexport type ThemeFamily = 'standard' | 'focus' | 'colorsafe' | 'contrast';\n\n/**\n * Anything a consumer may pass as `theme`:\n * - one of the 8 design-system themes ('light', 'dark', 'focus-light', ...)\n * - a family name ('focus' | 'colorsafe' | 'contrast') -> light/dark per the reader's scheme\n * - 'auto' -> light/dark per prefers-color-scheme (contrast under forced-colors)\n *\n * 'light' | 'dark' | 'auto' are the pre-0.2 values, kept as aliases for one release.\n */\nexport type ThemeInput = ThemeName | 'auto' | 'focus' | 'colorsafe' | 'contrast';\n\nexport interface ThemeEnv {\n /** prefers-color-scheme: dark */\n prefersDark?: boolean;\n /** forced-colors: active (Windows high contrast etc.) */\n forcedColors?: boolean;\n}\n\nconst FAMILIES: ReadonlySet<string> = new Set(['focus', 'colorsafe', 'contrast']);\n\nexport function isThemeName(v: unknown): v is ThemeName {\n return typeof v === 'string' && (THEME_NAMES as readonly string[]).includes(v);\n}\n\n/** Resolve any accepted `theme` value to one concrete design-system theme. */\nexport function resolveTheme(input: ThemeInput | undefined, env: ThemeEnv = {}): ThemeName {\n const scheme = env.prefersDark ? 'dark' : 'light';\n if (input === undefined || input === 'auto') return env.forcedColors ? (`contrast-${scheme}` as ThemeName) : scheme;\n if (FAMILIES.has(input)) return `${input}-${scheme}` as ThemeName;\n return isThemeName(input) ? input : 'light';\n}\n\nexport const isDarkTheme = (name: ThemeName): boolean => name.endsWith('dark');\nexport const isContrastTheme = (name: ThemeName): boolean => name.startsWith('contrast');\nexport const isFocusTheme = (name: ThemeName): boolean => name.startsWith('focus');\n\n/** All tokens of a theme (already merged over the light defaults). */\nexport const getTokens = (name: ThemeName): Readonly<Record<string, string>> => TOKENS[name];\n\n/** One token of a theme. Throws on an unknown key so typos fail loudly in tests. */\nexport function token(name: ThemeName, key: string): string {\n const v = TOKENS[name][key];\n if (v === undefined) throw new Error(`Unknown design-system token \"${key}\"`);\n return v;\n}\n\n// ── Comfort settings ──────────────────────────────────────────────────────────\n\nexport interface Comfort {\n /** Atkinson Hyperlegible for map labels instead of the handwritten faces (`data-type=\"readable\"`). */\n readableType?: boolean;\n /** Larger UI and label text (`data-scale=\"lg\"`). */\n largerText?: boolean;\n /** Skip transitions and reveal animations (`data-motion=\"reduced\"`). 'system' follows prefers-reduced-motion. */\n reducedMotion?: boolean | 'system';\n}\n\nexport interface ResolvedComfort { readableType: boolean; largerText: boolean; reducedMotion: boolean }\n\nexport function resolveComfort(c: Comfort | undefined, env: { prefersReducedMotion?: boolean } = {}): ResolvedComfort {\n const rm = c?.reducedMotion;\n return {\n readableType: !!c?.readableType,\n largerText: !!c?.largerText,\n reducedMotion: rm === undefined || rm === 'system' ? !!env.prefersReducedMotion : rm,\n };\n}\n\n/** Numeric design-system tokens (px / ms stripped). */\nexport type Metrics = { readonly [K in keyof typeof METRICS]: number };\n\n/** Numeric tokens with the reduced-motion overrides applied when requested. */\nexport function metricsFor(comfort: ResolvedComfort): Metrics {\n return comfort.reducedMotion ? { ...METRICS, ...METRICS_REDUCED_MOTION } : METRICS;\n}\n\n/** Multiplier the spec applies to label sizes under `data-scale=\"lg\"` (`--vi-label-scale`). */\nexport const labelScale = (c: ResolvedComfort): number => (c.largerText ? 1.15 : 1);\n\n// ── Topic palette ─────────────────────────────────────────────────────────────\n\nexport interface TopicStyle { topic: TopicName; fill: string; ring: string }\n\n/** Fill + ring colour of a topic in a theme. */\nexport function topicStyle(theme: ThemeName, topic: TopicName): TopicStyle {\n const t = TOKENS[theme];\n return { topic, fill: t[`topic-${topic}`]!, ring: t[`topic-${topic}-ring`]! };\n}\n\n/** An idea's colour by the design system's colour rule (geometry/color.ts, verbatim): a topic name → that topic; no\n * colour → the topics in sibling order; any other colour → custom, drawn as given (customColor: the colour as the fill,\n * the fill darkened by CUSTOM.ringShade as the ring). A custom colour doesn't follow themes. */\nexport interface IdeaColor { topic: TopicName | null; custom: { fill: string; ring: string | null } | null }\n\nexport function ideaColor(color: string | null | undefined, siblingIndex: number): IdeaColor {\n const topic = topicFor(color, siblingIndex);\n return topic ? { topic, custom: null } : { topic: null, custom: customColor(color!) };\n}\n\n/** Fill + ring an idea is drawn with in a theme: its topic's, or its custom colour (ring: the `edge` token when the\n * colour has no darker shade, i.e. isn't a 6-digit hex). */\nexport function ideaStyle(theme: ThemeName, c: { topic?: TopicName | null; custom?: IdeaColor['custom'] }): { fill: string; ring: string } {\n if (c.custom) return { fill: c.custom.fill, ring: c.custom.ring ?? TOKENS[theme]['edge']! };\n return topicStyle(theme, c.topic ?? TOPIC_ORDER[0]);\n}\n","// Generated from visualli.ai design-system/components/src/idea.ts — do not edit here.\n/* An idea's size and its label. An idea grows to show its whole label: it starts at its base width and widens in\n steps until the label fits in `labelLines` lines and every line fits the shape; at its widest it grows taller\n instead, so a label is never cut (a single word too long for the widest idea widens it further, up to twice). Labels wrap inside the idea's real outline (a ShapeProfile — blob.ts blobProfile\n for the drawn blob, an ellipse by default): each line may be as wide as the shape is at that line's height.\n Labels (and connector labels) grow a little when the map is zoomed out, so they stay readable. Every renderer sizes\n ideas with these rules, measuring text with its own font engine (`measure`). No dependencies, so it can travel alone. */\n\nexport type IdeaKind = 'root' | 'node' | 'mini';\n\n/** How much labels grow when zoomed out (`scale` = the map's zoom): never smaller than their size, up to these caps.\n * Idea labels and container names use `idea`; connector labels `connector`. Below 100% they grow; above, they don't. */\nexport const LABEL_GROWTH = { idea: 1.3, connector: 1.6, /** Label lines are wrapped at growth steps this size (layoutGrowth). */ layoutStep: 0.02 } as const;\n\nexport const IDEA = {\n /** Width an idea starts at… */ baseWidth: { root: 240, node: 200, mini: 120 },\n /** …and the widest it gets before it grows taller instead. */ maxWidth: { root: 400, node: 360, mini: 200 },\n /** Width grows in steps of this. */ step: 20,\n /** Height = width × aspect (at least `minRy` × 2), more if the label needs it. */ aspect: 0.74, minRy: 64,\n /** The label's box is the idea's width less this (22 each side). */ labelInset: 44,\n /** The idea widens until its label fits in this many lines. */ labelLines: 3,\n /** Label size (before the label scale and zoom growth), weight from the canvas type styles. */ labelSize: { root: 30, node: 22, mini: 15 },\n labelLineHeight: 1.15,\n /** The label may fill at most this share of the idea's height. */ labelFillHeight: 0.7,\n} as const;\n\n/** Greedy word wrap of `text` into lines no wider than `maxWidth` (a single word longer than that gets its own line). */\nexport function wrapLines(text: string, maxWidth: number, measure: (s: string) => number): string[] {\n const words = text.split(/\\s+/).filter(Boolean);\n const lines: string[] = [];\n let cur = '';\n for (const w of words) {\n const next = cur ? `${cur} ${w}` : w;\n if (cur && measure(next) > maxWidth) { lines.push(cur); cur = w; } else cur = next;\n }\n if (cur) lines.push(cur);\n return lines.length ? lines : [''];\n}\n\n/** A line's width as the shape-aware wrap measures it: its words' widths plus the spaces between them, each word\n * measured once. Words repeat across a map, so a renderer measures far fewer strings; kerning across a space (a\n * fraction of a pixel) is ignored, well inside labelInset. */\nfunction wordsMeasure(measure: (s: string) => number): (s: string) => number {\n const seen = new Map<string, number>(), space = measure(' ');\n const word = (w: string) => { let x = seen.get(w); if (x === undefined) { x = measure(w); seen.set(w, x); } return x; };\n return (line) => { const ws = line.split(' '); let x = (ws.length - 1) * space; for (const w of ws) x += word(w); return x; };\n}\n\n/** How wide a shape is at a height: for an idea of half-size rx × ry, `(y) => ` the distance a centered line at height\n * y (from the center) can reach before it meets the outline. blob.ts `blobProfile(shape)` gives the drawn blob's. */\nexport type ShapeProfile = (rx: number, ry: number) => (y: number) => number;\n/** The default profile, an ellipse — for renderers without blob geometry. */\nexport const ELLIPSE: ShapeProfile = (rx, ry) => (y) => rx * Math.sqrt(Math.max(0, 1 - (y / ry) * (y / ry)));\n\n/** Greedy word wrap of `text` where line i may be at most `widthOf(i)` wide (a word wider than its line gets its own). */\nfunction wrapVarying(text: string, widthOf: (i: number) => number, measure: (s: string) => number): string[] {\n const words = text.split(/\\s+/).filter(Boolean);\n const lines: string[] = [];\n let cur = '';\n for (const w of words) {\n const next = cur ? `${cur} ${w}` : w;\n if (cur && measure(next) > widthOf(lines.length)) { lines.push(cur); cur = w; } else cur = next;\n }\n if (cur) lines.push(cur);\n return lines.length ? lines : [''];\n}\n\n/** The widest each line of an n-line label may be, inside the shape: the label is centered vertically, lines are\n * `lineHeight` tall, and line i may reach as far as the shape does at both its top and bottom edge, less labelInset. */\nexport function lineWidthsInShape(n: number, lineHeight: number, halfWidthAt: (y: number) => number): number[] {\n return Array.from({ length: n }, (_, i) => {\n const top = (i - n / 2) * lineHeight, bottom = top + lineHeight;\n return Math.max(0, 2 * Math.min(halfWidthAt(top), halfWidthAt(bottom)) - IDEA.labelInset);\n });\n}\n\n/** Word wrap inside a shape: lines take the width the shape has at their height (lineWidthsInShape). The line count\n * and the lines' heights depend on each other, so it settles in a few passes. */\nexport function wrapInShape(text: string, lineHeight: number, halfWidthAt: (y: number) => number, measure: (s: string) => number): string[] {\n let n = 1, lines = [text];\n for (let pass = 0; pass < 6; pass++) {\n const widths = lineWidthsInShape(n, lineHeight, halfWidthAt);\n lines = wrapVarying(text, (i) => widths[Math.min(i, n - 1)] ?? 0, measure);\n if (lines.length === n) break;\n n = lines.length;\n }\n return lines;\n}\n\n/** Whether `lines` fit the shape: each line no wider than lineWidthsInShape allows (a single word that can't fit counts). */\nfunction fitsShape(lines: string[], lineHeight: number, halfWidthAt: (y: number) => number, measure: (s: string) => number): boolean {\n const widths = lineWidthsInShape(lines.length, lineHeight, halfWidthAt);\n return lines.every((l, i) => measure(l) <= (widths[i] ?? 0) + 0.5);\n}\n\n/** An idea's size for its label: width, half-width / half-height for the blob, and the label's lines. The label is\n * measured at its largest drawn size — its type size × `labelScale` (Comfort: larger text) × LABEL_GROWTH.idea (zoomed\n * out) — so it fits at every zoom and the idea never changes size while zooming. `measure(text, px)` returns the\n * text's width in px in the label's face at `px`. */\nexport function ideaSize(kind: IdeaKind, label: string, measure: (text: string, px: number) => number, labelScale = 1, profile: ShapeProfile = ELLIPSE) {\n const px = IDEA.labelSize[kind] * labelScale * LABEL_GROWTH.idea, lh = px * IDEA.labelLineHeight;\n const m = wordsMeasure((t: string) => measure(t, px));\n // For a width: the base height, the label wrapped in the shape, then taller if the label needs the height.\n const at = (width: number, minRy = 0) => {\n const rx = width / 2;\n let ry = Math.max(IDEA.minRy, rx * IDEA.aspect, minRy);\n let lines = wrapInShape(label, lh, profile(rx, ry), m);\n const needRy = (lines.length * lh) / 2 / IDEA.labelFillHeight;\n if (needRy > ry) { ry = needRy; lines = wrapInShape(label, lh, profile(rx, ry), m); }\n return { rx, ry, lines, fits: lines.length <= IDEA.labelLines && fitsShape(lines, lh, profile(rx, ry), m) };\n };\n const base: number = IDEA.baseWidth[kind], max: number = IDEA.maxWidth[kind];\n let width = base, r = at(width);\n while (!r.fits && width < max) { width = Math.min(max, width + IDEA.step); r = at(width); }\n // A single word too wide for the widest idea (a word is never broken): only then, wider than max, up to twice it.\n const wordTooWide = () => label.split(/\\s+/).some((w) => m(w) > (lineWidthsInShape(1, lh, profile(r.rx, r.ry))[0] ?? 0));\n const longWord = !r.fits && wordTooWide();\n while (!r.fits && width < max * 2 && wordTooWide()) { width += IDEA.step; r = at(width); }\n // At its widest: taller, until every line fits the shape (bounded, so a pathological label still ends).\n let tall = r;\n for (let k = 0; k < 40 && !fitsShape(tall.lines, lh, profile(tall.rx, tall.ry), m); k++) tall = at(width, tall.ry + IDEA.step / 2);\n // A word too long for the widest idea sits on a line near the top or bottom, narrower than the middle one, so\n // widening only until it fits the middle line leaves the idea growing tall and lopsided: for such a word, widen\n // further (up to twice the widest) when that fits the label and is not taller.\n if (longWord && tall.ry * 2 > width) {\n let w = width, q = r;\n while (!q.fits && w < max * 2) { w += IDEA.step; q = at(w); }\n if (q.fits && q.ry < tall.ry) { width = w; tall = q; }\n }\n r = tall;\n return { width, height: r.ry * 2, rx: r.rx, ry: r.ry, lines: r.lines };\n}\n\n/** How an idea's label is drawn at a zoom: its type size × `labelScale` × labelGrowth(zoom).idea, wrapped inside the\n * idea's shape (wrapInShape with the same profile ideaSize used). Grow first, then wrap: a grown label takes more,\n * shorter lines and never crosses the outline (the idea itself never resizes with zoom; ideaSize made it big enough\n * for the largest growth). `px` and `lineHeight` are in map units — draw them inside the map's transform, centered,\n * one line after another. */\nexport function labelLayout(kind: IdeaKind, label: string, size: { rx: number; ry: number }, zoom: number, measure: (text: string, px: number) => number, labelScale = 1, profile: ShapeProfile = ELLIPSE) {\n const base = IDEA.labelSize[kind] * labelScale;\n const px = base * labelGrowth(zoom).idea, lineHeight = px * IDEA.labelLineHeight;\n // Lines are wrapped at layoutGrowth (the growth rounded up to a step), so they hold across a zoom range and can be\n // cached; the label is drawn at `px`, never larger than they were wrapped for, so every line still fits.\n const lpx = base * layoutGrowth(zoom), lh = lpx * IDEA.labelLineHeight;\n return { px, lineHeight, lines: wrapInShape(label, lh, profile(size.rx, size.ry), wordsMeasure((t) => measure(t, lpx))) };\n}\n\n/** The growth a label's lines are wrapped at: labelGrowth(zoom).idea rounded up to the next LABEL_GROWTH.layoutStep\n * (never above LABEL_GROWTH.idea). Renderers key cached layouts by it. */\nexport function layoutGrowth(zoom: number): number {\n const g = labelGrowth(zoom).idea, step = LABEL_GROWTH.layoutStep;\n return Math.min(LABEL_GROWTH.idea, Math.ceil(g / step - 1e-9) * step);\n}\n\nexport function labelGrowth(scale: number): { idea: number; connector: number } {\n const inv = 1 / Math.max(scale, 0.0001);\n return { idea: Math.max(1, Math.min(inv, LABEL_GROWTH.idea)), connector: Math.max(1, Math.min(inv, LABEL_GROWTH.connector)) };\n}\n","// ─── Idea size and label growth ──────────────────────────────────────────────\n//\n// The design system's idea.ts (copied verbatim into generated/geometry): an idea\n// grows to show its whole label, and labels grow a little when zoomed out. The\n// SDK only supplies the text measurement (its font engine) and picks the kind.\n\nimport { ELLIPSE, IDEA, LABEL_GROWTH, ideaSize, labelGrowth, labelLayout, layoutGrowth, lineWidthsInShape, wrapInShape, wrapLines, type IdeaKind, type ShapeProfile } from '../generated/geometry/idea.js';\nimport type { VisualliLayer } from '../types/layer.js';\n\nexport { ELLIPSE, IDEA, LABEL_GROWTH, ideaSize, labelGrowth, labelLayout, layoutGrowth, lineWidthsInShape, wrapInShape, wrapLines };\nexport type { IdeaKind, ShapeProfile };\n\n/** Width in px of `text` in the idea label's face at `px` (the label's weight; readable type adds its tracking). */\nexport type IdeaMeasure = (text: string, px: number) => number;\n\n/** Measurement without a font engine (server, tests): half an em per character. Renderers pass the real face. */\nexport const approximateMeasure: IdeaMeasure = (text, px) => text.length * px * 0.5;\n\n/** The size kind of the `index`-th idea of a layer: the centre of the root radial layer is the root, the rest ideas. */\nexport const ideaKindOf = (layer: Pick<VisualliLayer, 'level' | 'layout'>, index: number): IdeaKind =>\n layer.level === 0 && (layer.layout ?? 'radial') === 'radial' && index === 0 ? 'root' : 'node';\n","// Generated from visualli.ai design-system/components/src/blobShapes.ts — do not edit here.\n// The six hand-authored Visualli node outlines, in normalized units (rx = ry = 1).\n// Copied verbatim from the web app (features/canvas/config/blobShapes.ts). Shape 0 is the root shape.\nexport const BLOB_SHAPES: number[][][] = [[[1.12,0.0],[0.86,0.56],[0.46,0.94],[-0.08,1.06],[-0.68,0.82],[-0.96,0.08],[-0.55,-0.82],[0.04,-1.02],[0.72,-0.8],[1.08,-0.38]],[[-0.489,-0.625],[-0.384,-0.716],[-0.285,-0.792],[-0.189,-0.855],[-0.09,-0.903],[0.014,-0.932],[0.129,-0.94],[0.255,-0.924],[0.412,-0.876],[0.516,-0.832],[0.612,-0.78],[0.695,-0.725],[0.767,-0.666],[0.83,-0.606],[0.885,-0.546],[0.933,-0.486],[0.979,-0.425],[1.006,-0.385],[1.034,-0.334],[1.058,-0.276],[1.078,-0.209],[1.092,-0.133],[1.101,-0.046],[1.102,0.052],[1.094,0.173],[1.083,0.244],[1.063,0.324],[1.034,0.401],[0.996,0.477],[0.948,0.549],[0.889,0.617],[0.82,0.681],[0.735,0.741],[0.658,0.783],[0.569,0.822],[0.474,0.855],[0.372,0.882],[0.265,0.904],[0.156,0.92],[0.046,0.931],[-0.069,0.938],[-0.155,0.935],[-0.25,0.919],[-0.346,0.89],[-0.443,0.851],[-0.539,0.8],[-0.633,0.738],[-0.723,0.667],[-0.808,0.585],[-0.882,0.501],[-0.944,0.421],[-0.994,0.343],[-1.034,0.267],[-1.064,0.192],[-1.085,0.12],[-1.097,0.042],[-1.102,0.001],[-1.09,-0.243],[-1.05,-0.365],[-0.99,-0.441],[-0.911,-0.479],[-0.819,-0.499],[-0.715,-0.517],[-0.605,-0.551]],[[0.003,-0.97],[0.163,-0.984],[0.286,-1.028],[0.389,-1.096],[0.488,-1.174],[0.597,-1.21],[0.728,-1.165],[0.867,-1.036],[0.996,-0.839],[1.098,-0.59],[1.158,-0.304],[1.153,0.012],[1.08,0.336],[0.944,0.639],[0.756,0.889],[0.484,1.072],[0.339,1.079],[0.219,1.051],[0.131,0.994],[0.059,0.939],[0.008,0.915],[-0.105,0.931],[-0.176,0.965],[-0.249,1.005],[-0.345,1.039],[-0.497,1.055],[-0.672,1.032],[-0.817,0.952],[-0.945,0.81],[-1.054,0.6],[-1.16,0.302],[-1.187,-0.011],[-1.165,-0.326],[-1.097,-0.599],[-0.991,-0.838],[-0.852,-0.912],[-0.695,-0.958],[-0.53,-0.988],[-0.357,-0.992],[-0.18,-0.983]],[[-0.734,-1.127],[-0.656,-1.146],[-0.567,-1.142],[-0.468,-1.115],[-0.358,-1.079],[-0.238,-1.034],[-0.107,-0.989],[0.035,-0.953],[0.188,-0.929],[0.325,-0.916],[0.484,-0.896],[0.65,-0.854],[0.811,-0.77],[0.955,-0.631],[1.068,-0.422],[1.138,-0.126],[1.152,0.272],[1.121,0.451],[1.046,0.602],[0.928,0.727],[0.767,0.833],[0.565,0.925],[0.323,1.001],[0.042,1.075],[-0.277,1.142],[-0.368,1.147],[-0.475,1.136],[-0.589,1.104],[-0.704,1.05],[-0.815,0.973],[-0.913,0.871],[-0.993,0.746],[-1.048,0.593],[-1.109,0.298],[-1.145,0.018],[-1.154,-0.243],[-1.135,-0.482],[-1.085,-0.695],[-1.003,-0.874],[-0.886,-1.02]],[[-0.734,1.127],[-0.656,1.146],[-0.567,1.142],[-0.468,1.115],[-0.358,1.079],[-0.238,1.034],[-0.107,0.989],[0.035,0.953],[0.188,0.929],[0.325,0.916],[0.484,0.896],[0.65,0.854],[0.811,0.77],[0.955,0.631],[1.068,0.422],[1.138,0.126],[1.152,-0.272],[1.121,-0.451],[1.046,-0.602],[0.928,-0.727],[0.767,-0.833],[0.565,-0.925],[0.323,-1.001],[0.042,-1.075],[-0.277,-1.142],[-0.368,-1.147],[-0.475,-1.136],[-0.589,-1.104],[-0.704,-1.05],[-0.815,-0.973],[-0.913,-0.871],[-0.993,-0.746],[-1.048,-0.593],[-1.109,-0.298],[-1.145,-0.018],[-1.154,0.243],[-1.135,0.482],[-1.085,0.695],[-1.003,0.874],[-0.886,1.02]],[[0.001,-1.006],[0.134,-1.001],[0.262,-1.024],[0.382,-1.073],[0.498,-1.107],[0.614,-1.105],[0.733,-1.049],[0.85,-0.932],[0.953,-0.755],[1.03,-0.529],[1.067,-0.265],[1.054,0.018],[0.986,0.3],[0.868,0.557],[0.715,0.766],[0.55,0.909],[0.396,0.984],[0.262,1.005],[0.148,1.003],[0.037,1.008],[-0.083,1.04],[-0.22,1.118],[-0.36,1.192],[-0.5,1.234],[-0.65,1.175],[-0.81,1.045],[-0.99,0.855],[-1.14,0.61],[-1.24,0.33],[-1.27,0.04],[-1.275,-0.25],[-1.225,-0.5],[-1.08,-0.72],[-0.89,-0.92],[-0.734,-1.053],[-0.614,-1.112],[-0.498,-1.127],[-0.381,-1.11],[-0.261,-1.095],[-0.133,-1.058],[0.001,-1.01],[0.134,-1.001]]];\n","// Generated from visualli.ai design-system/components/src/blob.ts — do not edit here.\nimport { BLOB_SHAPES } from './blobShapes';\nexport { BLOB_SHAPES };\n\n/** Which outline ideas take. Every idea, at every depth, has the same shape (`idea`, the shape of the map's centre);\n * depth shows through the depth trail, rings, the layer tint and the step-inside motion. The other authored shapes\n * stay in BLOB_SHAPES for explicit use (`Node shape`); `varyByLevel: true` brings back one shape per level. */\nexport const SHAPE: { idea: number; varyByLevel: boolean } = { idea: 0, varyByLevel: false };\n\n/** Shape for a layer level: SHAPE.idea for every level. With SHAPE.varyByLevel, level 0 is SHAPE.idea and consecutive\n * levels never repeat. */\nexport function shapeForLevel(level: number): number {\n if (!SHAPE.varyByLevel) return SHAPE.idea;\n const n = BLOB_SHAPES.length;\n let cur = SHAPE.idea;\n for (let i = 1; i <= level; i++) {\n const r = Math.floor(Math.abs(Math.sin((i + 1) * 12.9898) * 43758.5453));\n cur = (cur + (r % (n - 1)) + 1) % n;\n }\n return cur;\n}\n\n/** SVG path of a node outline centered on (cx, cy): midpoint-quadratic smoothing through the authored points. */\nexport function blobPath(shape: number, rx: number, ry: number, cx = 0, cy = 0): string {\n const pts = BLOB_SHAPES[((shape % BLOB_SHAPES.length) + BLOB_SHAPES.length) % BLOB_SHAPES.length].map(([x, y]) => [cx + x * rx, cy + y * ry]);\n const mid = (a: number[], b: number[]) => [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];\n const f = (n: number) => n.toFixed(2);\n const start = mid(pts[pts.length - 1], pts[0]);\n let d = `M${f(start[0])} ${f(start[1])}`;\n for (let i = 0; i < pts.length; i++) {\n const p = pts[i], m = mid(p, pts[(i + 1) % pts.length]);\n d += `Q${f(p[0])} ${f(p[1])} ${f(m[0])} ${f(m[1])}`;\n }\n return d + 'Z';\n}\n\n/** The path calls drawBlob makes: satisfied by a CanvasRenderingContext2D and by Konva's Context (sceneFunc / hitFunc). */\nexport type PathContext = { beginPath(): void; moveTo(x: number, y: number): void; quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; closePath(): void };\n\n/** Canvas twin of blobPath — call fill()/stroke() after (in Konva: ctx.fillStrokeShape(shape)). */\nexport function drawBlob(ctx: PathContext, shape: number, rx: number, ry: number, cx = 0, cy = 0) {\n const pts = BLOB_SHAPES[((shape % BLOB_SHAPES.length) + BLOB_SHAPES.length) % BLOB_SHAPES.length].map(([x, y]) => [cx + x * rx, cy + y * ry]);\n const mid = (a: number[], b: number[]) => [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];\n const s = mid(pts[pts.length - 1], pts[0]);\n ctx.beginPath();\n ctx.moveTo(s[0], s[1]);\n pts.forEach((p, i) => { const m = mid(p, pts[(i + 1) % pts.length]); ctx.quadraticCurveTo(p[0], p[1], m[0], m[1]); });\n ctx.closePath();\n}\n\n/** Distance from the center to the smoothed outline (blobPath) in direction `angle` (radians, SVG y-down).\n * Connectors use it to start and end just outside the outline an idea actually has, not a stand-in ellipse. */\n/** The outline as a polygon: the midpoint-quadratic curve sampled 8 times per segment. */\nfunction blobPolygon(shape: number, rx: number, ry: number): number[][] {\n const pts = BLOB_SHAPES[((shape % BLOB_SHAPES.length) + BLOB_SHAPES.length) % BLOB_SHAPES.length].map(([x, y]) => [x * rx, y * ry]);\n const mid = (a: number[], b: number[]) => [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];\n const poly: number[][] = [];\n for (let i = 0; i < pts.length; i++) {\n const p0 = mid(pts[(i - 1 + pts.length) % pts.length], pts[i]), c = pts[i], p1 = mid(pts[i], pts[(i + 1) % pts.length]);\n for (let k = 0; k < 8; k++) { const t = k / 8, u = 1 - t; poly.push([u * u * p0[0] + 2 * u * t * c[0] + t * t * p1[0], u * u * p0[1] + 2 * u * t * c[1] + t * t * p1[1]]); }\n }\n return poly;\n}\n\n/** The shape's profile for label wrapping (idea.ts ShapeProfile): for an idea of half-size rx × ry, how far a centered\n * line at height y (from the center) can reach before it meets the outline — the nearer of the outline's left and\n * right edges at that height, 0 outside it. Labels wrap inside the real shape, so a new shape needs no new label rule. */\nconst profiles = new Map<string, (y: number) => number>();\nexport function blobProfile(shape: number): (rx: number, ry: number) => (y: number) => number {\n return (rx, ry) => {\n const key = `${shape}|${rx}|${ry}`, hit = profiles.get(key);\n if (hit) return hit;\n const poly = blobPolygon(shape, rx, ry);\n const at = new Map<number, number>(); // the same heights come up again and again while wrapping\n const fn = (y: number) => {\n const seen = at.get(y);\n if (seen !== undefined) return seen;\n let left = 0, right = 0;\n for (let i = 0; i < poly.length; i++) {\n const [ax, ay] = poly[i], [bx, by] = poly[(i + 1) % poly.length];\n if ((ay <= y && by > y) || (by <= y && ay > y)) { const x = ax + ((y - ay) / (by - ay)) * (bx - ax); if (x < left) left = x; if (x > right) right = x; }\n }\n const half = Math.max(0, Math.min(-left, right));\n if (at.size < 256) at.set(y, half);\n return half;\n };\n if (profiles.size > 2048) profiles.clear();\n profiles.set(key, fn);\n return fn;\n };\n}\n\nexport function blobRadius(shape: number, rx: number, ry: number, angle: number): number {\n // Cast a ray from the center to the sampled outline.\n const poly = blobPolygon(shape, rx, ry);\n const dx = Math.cos(angle), dy = Math.sin(angle);\n let best = 0;\n for (let i = 0; i < poly.length; i++) {\n const [ax, ay] = poly[i], [bx, by] = poly[(i + 1) % poly.length], ex = bx - ax, ey = by - ay;\n const den = dx * ey - dy * ex;\n if (Math.abs(den) < 1e-9) continue;\n const r = (ax * ey - ay * ex) / den, q = (ax * dy - ay * dx) / den;\n if (r > 0 && q >= 0 && q <= 1) best = Math.max(best, r);\n }\n return best || Math.max(rx, ry);\n}\n\n/** Ring recipe: index 0 is the innermost ring. A node shows min(childLayers, 3) rings. `opacity` is the halo (the ring's\n * fill); `strokeOpacity` is its outline, drawn at full strength so the ring — the \"there is more inside\" cue — reads at\n * 3:1 against the canvas and the halos (the `topic-*-ring` tokens are chosen for that in every theme). */\nexport const RINGS = [\n { scale: 1.1, opacity: 0.5, strokeOpacity: 1, rotate: -5, width: 2, dash: '' },\n { scale: 1.2, opacity: 0.4, strokeOpacity: 1, rotate: -10, width: 1, dash: '' },\n { scale: 1.3, opacity: 0.3, strokeOpacity: 1, rotate: -15, width: 3, dash: '6 4' },\n];\n\n/** Connector geometry: a cubic that bows perpendicular to the chord, flatter as distance grows. */\nexport function edgePath(a: { x: number; y: number }, b: { x: number; y: number }, bow = 1) {\n const dx = b.x - a.x, dy = b.y - a.y, d = Math.hypot(dx, dy) || 1;\n const arc = Math.min(45, 45 / (1 + Math.max(0, (d - 200) / 400))) * bow;\n const nx = -dy / d, ny = dx / d;\n const mx = (a.x + b.x) / 2 + nx * arc, my = (a.y + b.y) / 2 + ny * arc;\n const c1 = { x: a.x + (mx - a.x) * 0.66 + 0, y: a.y + (my - a.y) * 0.66 };\n const c2 = { x: b.x + (mx - b.x) * 0.66, y: b.y + (my - b.y) * 0.66 };\n const ang = Math.atan2(b.y - c2.y, b.x - c2.x);\n return { d: `M${a.x.toFixed(1)} ${a.y.toFixed(1)}C${c1.x.toFixed(1)} ${c1.y.toFixed(1)} ${c2.x.toFixed(1)} ${c2.y.toFixed(1)} ${b.x.toFixed(1)} ${b.y.toFixed(1)}`, angle: ang, mid: { x: mx, y: my } };\n}\n\n/** Open V arrowhead at point p, pointing along angle. */\nexport function arrowPath(p: { x: number; y: number }, angle: number, len = 11) {\n const s = Math.PI / 5.5;\n const a1 = { x: p.x - len * Math.cos(angle - s), y: p.y - len * Math.sin(angle - s) };\n const a2 = { x: p.x - len * Math.cos(angle + s), y: p.y - len * Math.sin(angle + s) };\n return `M${a1.x.toFixed(1)} ${a1.y.toFixed(1)}L${p.x.toFixed(1)} ${p.y.toFixed(1)}L${a2.x.toFixed(1)} ${a2.y.toFixed(1)}`;\n}\n","// ─── Node & connector geometry ───────────────────────────────────────────────\n//\n// Thin layer over the design system's geometry (generated/geometry/blob.ts):\n// it chooses the radii, shapes, rings and endpoints for a FlatNode and never\n// re-implements outline or curve math. Pure functions, no DOM.\n\nimport { BLOB_SHAPES, RINGS, SHAPE, arrowPath, blobPath, blobProfile, blobRadius, edgePath, shapeForLevel } from '../generated/geometry/blob.js';\nimport { METRICS } from '../generated/designSystem.js';\nimport type { FlatNode } from '../types/mindmap.js';\n\n// The design system's geometry is part of the public API (single source of truth).\nexport { BLOB_SHAPES, RINGS, SHAPE, arrowPath, blobPath, blobProfile, blobRadius, edgePath, shapeForLevel };\nexport { drawBlob } from '../generated/geometry/blob.js';\n\n/** Minimum a node needs to be drawn / connected. */\nexport type NodeLike = Pick<FlatNode, 'x' | 'y' | 'width' | 'height' | 'level' | 'branchCount'>;\n\nexport const MAX_RINGS = RINGS.length;\nconst DEG = Math.PI / 180;\n\n/** Outline radii of an idea: half its size (sized for its label by the design system's idea.ts). */\nexport function nodeRadii(n: Pick<FlatNode, 'width' | 'height'>): { rx: number; ry: number } {\n return { rx: n.width / 2, ry: n.height / 2 };\n}\n\n/** Rings an idea shows: one per layer beneath it, at most 3. */\nexport const ringCount = (branchCount: number | undefined): number => Math.max(0, Math.min(branchCount ?? 0, MAX_RINGS));\n\n/** The design system's ring recipes an idea shows, innermost first (index 0 = scale 1.1). */\nexport const ringsFor = (branchCount: number | undefined): typeof RINGS => RINGS.slice(0, ringCount(branchCount));\n\nconst shapeCache = new Map<number, number>();\n/** Outline shape for a layer level (memoised: shapeForLevel is O(level)). */\nexport function shapeOfLevel(level: number): number {\n let s = shapeCache.get(level);\n if (s === undefined) { s = shapeForLevel(level); shapeCache.set(level, s); }\n return s;\n}\n\n/** Largest distance from a blob's centre to any control point, in units of max(rx, ry). */\nconst BLOB_MAX_NORM = Math.max(...BLOB_SHAPES.flatMap((s) => s.map(([x, y]) => Math.hypot(x!, y!))));\n\n/** Visual margin around an idea beyond its outline: stroke, hover lift and the node shadow. */\nconst VISUAL_MARGIN = METRICS.nodeStroke * 2 + 24;\n\n/**\n * Conservative world-space bounds of everything drawn for an idea (rings and\n * stroke included). Ideas are drawn CENTRED on (x, y), so bounds are centred\n * too. A circle bound is used so ring rotation can never push ink outside it.\n */\nexport function nodeBounds(n: NodeLike): { minX: number; minY: number; maxX: number; maxY: number } {\n const { rx, ry } = nodeRadii(n);\n const rings = ringCount(n.branchCount);\n const scale = rings > 0 ? RINGS[rings - 1]!.scale : 1;\n const r = BLOB_MAX_NORM * Math.max(rx, ry) * scale + VISUAL_MARGIN;\n return { minX: n.x - r, minY: n.y - r, maxX: n.x + r, maxY: n.y + r };\n}\n\n/**\n * Distance from an idea's centre to the outline connectors must clear, in the\n * world direction `angle` (radians, y down). That is the outermost visible\n * ring (rotated like the ring is drawn), or the body when there are no rings.\n */\nexport function outlineRadius(n: NodeLike, angle: number): number {\n const { rx, ry } = nodeRadii(n);\n const shape = shapeOfLevel(n.level);\n const rings = ringCount(n.branchCount);\n if (rings === 0) return blobRadius(shape, rx, ry, angle);\n const ring = RINGS[rings - 1]!;\n // The ring is the same blob scaled and rotated about the centre, so look up\n // the radius in the ring's own frame.\n return blobRadius(shape, rx * ring.scale, ry * ring.scale, angle - ring.rotate * DEG);\n}\n\nexport interface ConnectorGeometry {\n /** Start / end points: `edge-gap` outside the source / target outline. */\n a: { x: number; y: number };\n b: { x: number; y: number };\n /** Cubic path data (SVG syntax) and the arrowhead direction, from the design system's edgePath. */\n d: string;\n angle: number;\n /** Bow apex returned by edgePath, where the connector label sits. */\n mid: { x: number; y: number };\n /** Open arrowhead path data at b, from the design system's arrowPath. */\n arrow: string;\n}\n\n/** Endpoints and curve of a connector between two ideas. */\nexport function connectorGeometry(from: NodeLike, to: NodeLike, gap: number = METRICS.edgeGap): ConnectorGeometry {\n const theta = Math.atan2(to.y - from.y, to.x - from.x);\n const ra = outlineRadius(from, theta) + gap;\n const rb = outlineRadius(to, theta + Math.PI) + gap;\n const a = { x: from.x + Math.cos(theta) * ra, y: from.y + Math.sin(theta) * ra };\n const b = { x: to.x - Math.cos(theta) * rb, y: to.y - Math.sin(theta) * rb };\n const e = edgePath(a, b);\n return { a, b, d: e.d, angle: e.angle, mid: e.mid, arrow: arrowPath(b, e.angle) };\n}\n","// ─── .visualli → FlatNode Converter ──────────────────────────────────────────\n//\n// Transforms the layer-based .visualli format into the flat Map<id, FlatNode>\n// structure consumed by the canvas renderer.\n\nimport type { VisualliDocument } from '../types/document.js';\nimport type { VisualliLayer } from '../types/layer.js';\nimport type { FlatNode, NodeMap } from '../types/mindmap.js';\nimport { countLayersBeneath } from './visualliParser.js';\nimport { ideaColor } from '../theme/index.js';\nimport { approximateMeasure, ideaKindOf, ideaSize, type IdeaMeasure } from '../rendering/ideaSize.js';\nimport { blobProfile, shapeOfLevel } from '../rendering/nodeGeometry.js';\nimport { applyCircularLayout, calculateOptimalRadiusPercentage } from '../layout/circularLayout.js';\nimport { applyLinearHorizontalLayout, applyLinearVerticalLayout } from '../layout/linearLayout.js';\n\n// ── Overlap Resolution ────────────────────────────────────────────────────────\n\nfunction doNodesOverlap(n1: FlatNode, n2: FlatNode, padding = 20): boolean {\n return !(\n n1.x + n1.width / 2 + padding < n2.x - n2.width / 2 - padding ||\n n1.x - n1.width / 2 - padding > n2.x + n2.width / 2 + padding ||\n n1.y + n1.height / 2 + padding < n2.y - n2.height / 2 - padding ||\n n1.y - n1.height / 2 - padding > n2.y + n2.height / 2 + padding\n );\n}\n\n/** Iteratively push overlapping nodes apart using symmetric force separation. */\nexport function resolveNodeOverlaps(nodes: FlatNode[], maxIterations = 10): void {\n const padding = 150;\n\n for (let iter = 0; iter < maxIterations; iter++) {\n let any = false;\n for (let i = 0; i < nodes.length; i++) {\n for (let j = i + 1; j < nodes.length; j++) {\n const n1 = nodes[i];\n const n2 = nodes[j];\n if (!doNodesOverlap(n1, n2, padding)) continue;\n\n any = true;\n const dx = n2.x - n1.x;\n const dy = n2.y - n1.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n\n if (dist < 1) {\n n2.x += n2.width / 2 + padding;\n continue;\n }\n\n const minDist = (n1.width + n2.width) / 2 + padding;\n if (dist < minDist) {\n const push = (minDist - dist) / 2;\n n1.x -= (dx / dist) * push;\n n1.y -= (dy / dist) * push;\n n2.x += (dx / dist) * push;\n n2.y += (dy / dist) * push;\n }\n }\n }\n if (!any) break;\n }\n}\n\n// ── Options ───────────────────────────────────────────────────────────────────\n\nexport interface ConvertOptions {\n /** Measures label text in the idea face (the renderer's font engine); ideas are sized with the design system's\n * ideaSize. Defaults to an approximation (half an em per character) where no font engine exists. */\n measure?: IdeaMeasure;\n /** Label scale (comfort: larger text is 1.15); ideas grow to fit the larger label. */\n labelScale?: number;\n}\n\n/** Whether a layer's ideas carry their own positions: every idea has one, and (with more than one idea) they aren't\n * all on the same spot (a placeholder). Then the file's positions are used as they are. */\nfunction hasFilePositions(layer: VisualliLayer): boolean {\n const ps = layer.nodes.map((n) => n.position);\n if (!ps.length || !ps.every((p) => p && Number.isFinite(p.x) && Number.isFinite(p.y))) return false;\n return ps.length === 1 || ps.some((p) => p!.x !== ps[0]!.x || p!.y !== ps[0]!.y);\n}\n\n// ── Container-formation Layout ────────────────────────────────────────────────\n\ninterface Proxy { id: string; x: number; y: number; width: number; height: number }\n\nfunction applyFormation(nodes: FlatNode[], formation: string): void {\n if (nodes.length === 0) return;\n if (nodes.length === 1) { nodes[0].x = 0; nodes[0].y = 0; return; }\n if (formation === 'linear-horizontal' || formation === 'linear') {\n applyLinearHorizontalLayout(nodes, { centerX: 0, centerY: 0 });\n } else if (formation === 'linear-vertical') {\n applyLinearVerticalLayout(nodes, { centerX: 0, centerY: 0 });\n } else {\n const r = Math.max(250, nodes.length * 70);\n const step = (2 * Math.PI) / nodes.length;\n for (let i = 0; i < nodes.length; i++) {\n nodes[i].x = r * Math.cos(i * step);\n nodes[i].y = r * Math.sin(i * step);\n }\n }\n}\n\nfunction containerBBox(nodes: FlatNode[], padding: number): { width: number; height: number } {\n let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;\n for (const n of nodes) {\n minX = Math.min(minX, n.x - n.width / 2);\n maxX = Math.max(maxX, n.x + n.width / 2);\n minY = Math.min(minY, n.y - n.height / 2);\n maxY = Math.max(maxY, n.y + n.height / 2);\n }\n return { width: maxX - minX + padding * 2, height: maxY - minY + padding * 2 };\n}\n\nfunction proxyLinearH(proxies: Proxy[], gap = 180): void {\n const total = proxies.reduce((s, p) => s + p.width, 0) + gap * (proxies.length - 1);\n let x = -total / 2;\n for (const p of proxies) { p.x = x + p.width / 2; p.y = 0; x += p.width + gap; }\n}\n\nfunction proxyLinearV(proxies: Proxy[], gap = 180): void {\n const total = proxies.reduce((s, p) => s + p.height, 0) + gap * (proxies.length - 1);\n let y = -total / 2;\n for (const p of proxies) { p.x = 0; p.y = y + p.height / 2; y += p.height + gap; }\n}\n\nfunction proxyRadial(proxies: Proxy[], radius = 500): void {\n if (proxies.length === 1) { proxies[0].x = 0; proxies[0].y = 0; return; }\n // Start at top (12 o'clock) for n>=3, horizontal for n=2 (matches circular layout)\n const startAngle = proxies.length === 2 ? 0 : -Math.PI / 2;\n const step = (2 * Math.PI) / proxies.length;\n for (let i = 0; i < proxies.length; i++) {\n const angle = startAngle + i * step;\n proxies[i].x = radius * Math.cos(angle);\n proxies[i].y = radius * Math.sin(angle);\n }\n}\n\n// ── Layer Conversion ──────────────────────────────────────────────────────────\n\nfunction makeFlatNode(\n node: VisualliLayer['nodes'][number],\n layer: VisualliLayer,\n doc: VisualliDocument,\n /** Position among the layer's ideas (file order): missing colours cycle the topics by it, and the first idea of the root radial layer is the root. */\n siblingIndex: number,\n opts: ConvertOptions,\n): FlatNode {\n const label = Array.isArray(node.data.label) ? (node.data.label as string[]).join(' ') : (node.data.label || 'Untitled');\n const branchCount = countLayersBeneath(doc, node.id);\n const kind = ideaKindOf(layer, siblingIndex);\n // Sized so the label wraps inside the idea's own blob (the design system's blobProfile).\n const size = ideaSize(kind, label, opts.measure ?? approximateMeasure, opts.labelScale ?? 1, blobProfile(shapeOfLevel(layer.level)));\n const { topic, custom } = ideaColor(node.data.color, siblingIndex);\n return {\n id: node.id,\n parentId: layer.parentNodeId ?? null,\n x: node.position?.x ?? 0,\n y: node.position?.y ?? 0,\n level: layer.level,\n title: label,\n description: node.data.summary || '',\n color: node.data.color ?? '',\n ...(topic ? { topic } : {}),\n ...(custom ? { custom } : {}),\n kind,\n width: size.width,\n height: size.height,\n isExpanded: branchCount > 0,\n branchCount,\n createdAt: new Date(),\n updatedAt: new Date(),\n };\n}\n\nfunction layoutLayerWithContainers(layer: VisualliLayer, flatNodes: FlatNode[]): void {\n const PADDING = 80;\n const byId = new Map(flatNodes.map((n: FlatNode) => [n.id, n]));\n const containerNodeIds = new Set<string>();\n const containerGroups = new Map<string, FlatNode[]>();\n\n for (const container of layer.containers) {\n const group = container.nodes.map((id: string) => byId.get(id)).filter((n: FlatNode | undefined): n is FlatNode => !!n);\n if (!group.length) continue;\n container.nodes.forEach((id: string) => containerNodeIds.add(id));\n const formation = ((container.data as unknown as Record<string, unknown> | undefined)?.['formation'] as string | undefined) ?? 'radial';\n applyFormation(group, formation);\n containerGroups.set(container.id, group);\n }\n\n const proxies: Proxy[] = [];\n for (const n of flatNodes) {\n if (!containerNodeIds.has(n.id)) proxies.push({ id: n.id, x: 0, y: 0, width: n.width, height: n.height });\n }\n for (const container of layer.containers) {\n const group = containerGroups.get(container.id);\n if (!group?.length) continue;\n const bbox = containerBBox(group, PADDING);\n proxies.push({ id: `__c__${container.id}`, x: 0, y: 0, width: bbox.width, height: bbox.height });\n }\n\n const layout = layer.layout || 'radial';\n if (layout === 'linear-horizontal') proxyLinearH(proxies, 180);\n else if (layout === 'linear-vertical') proxyLinearV(proxies, 180);\n else proxyRadial(proxies, 500);\n\n for (const proxy of proxies) {\n if (proxy.id.startsWith('__c__')) {\n const group = containerGroups.get(proxy.id.slice(5));\n group?.forEach(n => { n.x += proxy.x; n.y += proxy.y; });\n } else {\n const fn = byId.get(proxy.id);\n if (fn) { fn.x = proxy.x; fn.y = proxy.y; }\n }\n }\n}\n\nfunction layoutLayer(layer: VisualliLayer, flatNodes: FlatNode[]): void {\n const layout = layer.layout || 'radial';\n if (layout === 'linear-horizontal') {\n applyLinearHorizontalLayout(flatNodes, { centerX: 0, centerY: 0 });\n } else if (layout === 'linear-vertical') {\n applyLinearVerticalLayout(flatNodes, { centerX: 0, centerY: 0 });\n } else {\n const pct = calculateOptimalRadiusPercentage(flatNodes.length, 2000, 2000, 200, 30);\n applyCircularLayout(flatNodes, {\n radiusPercentage: pct,\n containerWidth: 2000,\n containerHeight: 2000,\n centerX: 0,\n centerY: 0,\n });\n }\n}\n\n/**\n * Convert a single layer to an array of FlatNode objects, each sized for its label\n * (the design system's idea.ts) and coloured by its colour rule (color.ts).\n * Positions: the file's own when its ideas carry them; otherwise the SDK lays the\n * layer out by `layer.layout` (default radial) and container formations.\n */\nexport function convertLayerToFlatNodes(\n layer: VisualliLayer,\n doc: VisualliDocument,\n opts: ConvertOptions = {},\n): FlatNode[] {\n const flatNodes = layer.nodes.map((node, i) => makeFlatNode(node, layer, doc, i, opts));\n if (flatNodes.length === 0 || hasFilePositions(layer)) return flatNodes;\n for (const n of flatNodes) { n.x = 0; n.y = 0; }\n if ((layer.containers ?? []).length > 0) layoutLayerWithContainers(layer, flatNodes);\n else layoutLayer(layer, flatNodes);\n resolveNodeOverlaps(flatNodes);\n return flatNodes;\n}\n\n/**\n * Convert an entire .visualli document to a flat NodeMap.\n * All layers are converted and a children-index is built for O(1) tree traversal.\n */\nexport function convertVisualliToFlatNodes(doc: VisualliDocument, opts: ConvertOptions = {}): NodeMap {\n const map: NodeMap = new Map();\n\n for (const layer of doc.layers.values()) {\n for (const node of convertLayerToFlatNodes(layer, doc, opts)) {\n map.set(node.id, node);\n }\n }\n\n // Build children index in linear time O(N)\n for (const node of map.values()) {\n node.childrenIds = [];\n }\n for (const node of map.values()) {\n if (node.parentId) {\n const parent = map.get(node.parentId);\n if (parent) {\n (parent.childrenIds ??= []).push(node.id);\n }\n }\n }\n\n return map;\n}\n\n/**\n * Get flat nodes for a specific layer only.\n *\n * @param doc - Parsed .visualli document\n * @param layerId - Layer ID to extract\n * @param opts - Text measurement and label scale for sizing ideas\n * @returns FlatNode array, or empty array if layer not found\n */\nexport function getNodesForLayer(doc: VisualliDocument, layerId: string, opts: ConvertOptions = {}): FlatNode[] {\n const layer = doc.layers.get(layerId);\n return layer ? convertLayerToFlatNodes(layer, doc, opts) : [];\n}\n","// ─── Mindmap Tree Utilities ───────────────────────────────────────────────────\n\nimport type { MindMapNode, TopLevelConnection } from '../types/mindmap.js';\n\n/** Flatten a nested MindMapNode tree into a depth-first array. */\nexport function flattenNodes(nodes: MindMapNode[]): MindMapNode[] {\n const result: MindMapNode[] = [];\n const traverse = (list: MindMapNode[]) => {\n for (const n of list) {\n result.push(n);\n if (n.children) traverse(n.children);\n }\n };\n traverse(nodes);\n return result;\n}\n\n/**\n * Return nodes visible at the given zoom level.\n *\n * At lower zoom values only top-level nodes are shown; each 5% zoom increment\n * reveals one additional hierarchy level.\n */\nexport function getVisibleNodes(\n nodes: MindMapNode[],\n zoom: number,\n focusedNode?: string,\n): MindMapNode[] {\n const flat = flattenNodes(nodes);\n\n if (focusedNode) {\n const focused = flat.find(n => n.id === focusedNode);\n if (focused) {\n return focused.children ? [focused, ...focused.children] : [focused];\n }\n }\n\n // Map zoom to max visible level (level 0 at ≤70%, +1 level per 5% increment)\n if (zoom <= 0.70) return flat.filter(n => n.level === 0);\n const maxLevel = Math.floor((zoom - 0.70) / 0.05);\n return flat.filter(n => n.level <= maxLevel);\n}\n\n/** Build parent→child connection pairs from the node tree. */\nexport function getNodeConnections(\n nodes: MindMapNode[],\n): Array<{ from: MindMapNode; to: MindMapNode; label?: string }> {\n const flat = flattenNodes(nodes);\n const result: Array<{ from: MindMapNode; to: MindMapNode; label?: string }> = [];\n for (const n of flat) {\n if (!n.parent) continue;\n const parent = flat.find(p => p.id === n.parent);\n if (parent) result.push({ from: parent, to: n, label: n.relationshipLabel });\n }\n return result;\n}\n\n/** Resolve top-level cross-connections to node pairs. */\nexport function getTopLevelConnections(\n nodes: MindMapNode[],\n topLevelConnections: TopLevelConnection[],\n): Array<{ from: MindMapNode; to: MindMapNode; label: string }> {\n const flat = flattenNodes(nodes);\n const result: Array<{ from: MindMapNode; to: MindMapNode; label: string }> = [];\n for (const conn of topLevelConnections) {\n const from = flat.find(n => n.id === conn.from);\n const to = flat.find(n => n.id === conn.to);\n if (from && to) result.push({ from, to, label: conn.label ?? '' });\n }\n return result;\n}\n\n/** Euclidean distance between two world-space points. */\nexport function calculateDistance(x1: number, y1: number, x2: number, y2: number): number {\n return Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2);\n}\n","// ─── Layout constants ────────────────────────────────────────────────────────\n//\n// Non-visual layout metrics (world units). Everything visual (colours, fonts,\n// radii, spacing, motion) comes from the design system: see ../theme.\n\nexport const LAYOUT_SPACING = {\n nodeSpacing: 200,\n levelSpacing: 150,\n containerPadding: 20,\n gridSize: 50,\n} as const;\n","// ─── MindMapConfig Utilities ──────────────────────────────────────────────────\n//\n// Helpers for creating and generating MindMapConfig objects (pure data, no UI).\n\nimport type { MindMapNode, MindMapConfig, TopLevelConnection } from '../types/mindmap.js';\nimport { LAYOUT_SPACING } from '../constants/layout.js';\nimport { TOKENS, TOPICS } from '../theme/index.js';\n\n/** Light-theme fill of the topic used for a level (cycles through the design-system topics). */\nconst levelColor = (level: number): string => TOKENS.light[`topic-${TOPICS[level % TOPICS.length]}`]!;\n\ntype LevelColors = { level0: string; level1: string; level2: string; level3: string; [key: `level${number}`]: string };\nconst levelColors = (count: number): LevelColors =>\n Object.fromEntries(Array.from({ length: count }, (_, i) => [`level${i}`, levelColor(i)])) as LevelColors;\n\nexport function createMindMapConfig(\n nodes: MindMapNode[],\n topLevelConnections: TopLevelConnection[],\n title = 'Untitled Mindmap',\n): MindMapConfig {\n const now = new Date().toISOString();\n return {\n metadata: {\n title,\n description: `Interactive mindmap with ${nodes.length} nodes`,\n version: '1.0.0',\n created: now,\n lastModified: now,\n },\n nodes,\n topLevelConnections,\n settings: {\n defaultColors: levelColors(4),\n layout: {\n nodeSpacing: LAYOUT_SPACING.nodeSpacing,\n levelSpacing: LAYOUT_SPACING.levelSpacing,\n },\n },\n };\n}\n\n// ── Sample Data Generator ─────────────────────────────────────────────────────\n\nfunction generateId(prefix: string, level: number, index: number): string {\n return `${prefix}-l${level}-${index}`;\n}\n\nfunction generateLevelNodes(\n parentId: string | null,\n level: number,\n maxLevels: number,\n xOffset = 0,\n yOffset = 0,\n): MindMapNode[] {\n if (level >= maxLevels) return [];\n\n const count = 5;\n const levelSpacing = 200;\n const nodeSpacing = 300;\n const nodes: MindMapNode[] = [];\n\n for (let i = 0; i < count; i++) {\n const nodeId = parentId\n ? generateId(`${parentId}-${i}`, level, i)\n : generateId('root', level, i);\n\n const x = xOffset + (i - (count - 1) / 2) * nodeSpacing;\n const y = yOffset + level * levelSpacing;\n\n const node: MindMapNode = {\n id: nodeId,\n title: `Level ${level} Node ${i + 1}`,\n level,\n x,\n y,\n color: levelColor(level),\n relationshipLabel: level > 0 ? 'child' : undefined,\n parent: parentId ?? undefined,\n };\n\n const children = generateLevelNodes(nodeId, level + 1, maxLevels, x, y + levelSpacing);\n if (children.length > 0) node.children = children;\n\n nodes.push(node);\n }\n\n return nodes;\n}\n\n/**\n * Generate a sample MindMapConfig with `maxLevels` of hierarchy.\n * Useful for testing and demos.\n */\nexport function generateSampleConfig(maxLevels = 9): MindMapConfig {\n const nodes = generateLevelNodes(null, 0, maxLevels, 0, 0);\n\n const topLevelConnections: TopLevelConnection[] = nodes.slice(0, -1).map((n, i) => ({\n from: n.id,\n to: nodes[i + 1].id,\n label: 'related to',\n }));\n\n return {\n metadata: {\n id: `mindmap-${Date.now()}`,\n title: 'Sample Mind Map',\n description: 'A sample mind map',\n version: '1.0.0',\n created: new Date().toISOString(),\n lastModified: new Date().toISOString(),\n },\n nodes,\n topLevelConnections,\n settings: {\n defaultColors: levelColors(9),\n layout: {\n nodeSpacing: LAYOUT_SPACING.nodeSpacing,\n levelSpacing: LAYOUT_SPACING.levelSpacing,\n },\n },\n };\n}\n","// Generated from visualli.ai design-system/components/src/interaction.ts — do not edit here.\n/* How the canvas answers the pointer and the keyboard — the timing and rules behind the peek (an idea's summary)\n and terms (semantic anchors: an underlined word and its definition card). The look and the pop-in animation live\n in the CSS (.vi-fact, .vi-anchor, .vi-anchor-card); these are the behaviours, as data, so every renderer (VisualMap,\n the spec SDK on a canvas) opens and closes them alike. Times in ms. No dependencies, so it can travel alone. */\n\n/** Terms (semantic anchors) in a peek's text. */\nexport const TERM = {\n /** Hovering the term this long opens its definition card… */ hoverOpen: 250,\n /** …which closes this long after the pointer leaves both the term and the card (moving between them keeps it open). */ hoverClose: 300,\n /** Only a mouse opens on hover; touch and pen open on tap. */ hoverPointers: ['mouse'] as readonly string[],\n /** A click, tap, Enter or Space pins the card open (hovering away doesn't close it); pressing again unpins and closes. */ clickPins: true,\n /** Escape closes the card and returns focus to the term; a press anywhere outside the term and its card closes it. */ escapeCloses: true, pressOutsideCloses: true,\n /** Opening by click or keyboard moves focus to the card's first link or button. */ focusCardOnOpen: true,\n /** The card is kept this far inside the viewport's left and right edges. */ viewportMargin: 8,\n /** The card's link to a source about the term. */ learnMoreLabel: 'Learn more',\n} as const;\n\n/** The peek: an idea's summary card on hover (pointer) or tap (touch). */\nexport const PEEK = {\n /** Hovering an idea opens its peek at once; it stays this long after the pointer leaves the idea (and while the\n * pointer is over the peek itself), so the pointer can travel from the idea onto the card. */ hoverClose: 180,\n} as const;\n\n/** The touch peek: a bottom sheet with a grip. */\nexport const SHEET = {\n /** Dragging the grip down this far closes the sheet (or collapses it when expanded); up this far expands it. */ dismissDrag: 80, expandDrag: 40,\n /** Its height: this share of the map, at most `maxHeight` px; the map pans the chosen idea into the space above it. */ heightRatio: 0.42, maxHeight: 300,\n} as const;\n\n/** Zoom, pan and fit. */\nexport const VIEW = {\n /** Each zoom step multiplies or divides the zoom by this. */ zoomStep: 1.2,\n /** Zoom limits (the zoom-min / zoom-max tokens; the build checks they agree). */ zoomMin: 0.3, zoomMax: 5,\n /** Fit to view never enlarges a layer beyond this. */ fitMax: 1.1,\n} as const;\n\n/** Touch gestures on the map (any touch input — phones, tablets and touchscreen laptops alike; it follows the pointer\n * in use, not the device, so a mouse or trackpad on the same laptop isn't affected). */\nexport const GESTURE = {\n /** Two fingers pinch to zoom the map's contents — ideas, connectors, containers and their labels — around the\n * point between the fingers, within VIEW's limits. Controls, the depth trail, the peek, chat and the page never scale. */ pinchZoom: true,\n /** Moving both fingers pans the contents. */ twoFingerPan: true,\n /** One finger on the empty canvas pans the contents too, on every surface (VI-040). A host whose map sits inside a\n * scrolling page can pass `gestures=\"cooperative\"` to give one finger back to the page (two fingers then move the map). */ oneFingerPan: true,\n /** The pointers that pinch (PointerEvent.pointerType). */ pointers: ['touch'] as readonly string[],\n /** The map takes every touch gesture (touch-action: none), so the browser never zooms or scrolls under it. With\n * `gestures=\"cooperative\"` one finger scrolls the page (touch-action: pan-x pan-y); two fingers move the map. */ appTouchAction: 'none', embeddedTouchAction: 'pan-x pan-y',\n /** Press and move on the empty canvas to pan the contents - mouse, pen and one finger. A press that moves less than\n * `panSlop` px is a click or a tap. */ dragPan: true,\n panPointers: ['mouse', 'pen', 'touch'] as readonly string[], panSlop: 6,\n /** Moving an idea starts once the press has moved this far (px), by pointerModeFor: a mouse ('hover') sooner, a finger\n * or pen ('touch') later, so taps still work. */\n ideaDragSlop: { hover: 4, touch: 10 },\n} as const;\n\n/** Going back a layer without the trail (VI-040): double-click empty canvas (not while editing - there it adds an idea)\n * or double-tap it. Never on an idea, a card, the trail or a control. At the top layer the\n * map gives a small bump instead. A double-tap whose first tap closed a peek doesn't also go back. */\nexport const BACK = {\n /** Two taps this close in time (ms) and place (px) are a double-tap. */ doubleTapMs: 300, doubleTapPx: 32,\n /** The bump at the top layer (ms). */ bumpMs: 320,\n} as const;\n\n/** The zoom buttons (− % +) are for screens with a mouse or trackpad. On a touch-only screen (a phone, a tablet\n * without a trackpad) people pinch to zoom, so the buttons stay out of the way: the spec CSS hides `.vi-map__ctrls`\n * under `@media not all and (hover: hover) and (pointer: fine)`, and the design system's VisualMap reads the same query.\n * A screen with any fine pointer (a touchscreen laptop, a tablet with a trackpad) keeps them. Pinch, wheel and keys\n * zoom everywhere. */\nexport const CONTROLS = {\n /** Where the zoom buttons show: a screen whose main pointer is a mouse or trackpad (it hovers and is fine). Not a\n * tablet with a stylus, which also has a fine pointer but is used by touch: there people pinch. */ zoomButtonsMedia: '(hover: hover) and (pointer: fine)',\n} as const;\n\n/** How the map changed layer, reported with onLayerPathChange so a host can keep browser history in step:\n * 'step-in' (an idea's rings or Step inside), 'trail', 'gesture' (double-click, double-tap), 'key' (Escape, Backspace), 'host' (the host set layerPath). */\nexport type LayerVia = 'step-in' | 'trail' | 'gesture' | 'key' | 'host';\n\n/** The zoom after a pinch: the zoom at the start, scaled by how far the fingers spread, within VIEW's limits. */\nexport function pinchZoom(startZoom: number, startDistance: number, distance: number): number {\n const z = startZoom * (distance / Math.max(startDistance, 1));\n return Math.min(VIEW.zoomMax, Math.max(VIEW.zoomMin, z));\n}\n\n/** Keeps the map point that was under `from` under `to` when the scale changes from `s0` to `s1`: the new\n * translation, given the old one (screen = world × s + t). Used to zoom around the fingers. */\nexport function zoomAround(t0: { x: number; y: number }, s0: number, s1: number, from: { x: number; y: number }, to: { x: number; y: number }): { x: number; y: number } {\n const wx = (from.x - t0.x) / s0, wy = (from.y - t0.y) / s0;\n return { x: to.x - wx * s1, y: to.y - wy * s1 };\n}\n\n/** Framing a layer (fit to view): its ideas with room around them, and its container hulls with room for the name pill. */\nexport const FRAME = {\n /** Room beyond each idea's outermost ring (RINGS[2].scale, 1.3 × its half size): its stroke, hover lift and a little air. */ ring: 0.3, clearX: 16, clearY: 16,\n /** Room beyond each container hull for its dashed line and the name pill straddling it: at least `hullX` / `hullY`\n * (a one-line pill), more when the pill reaches further (a 2 - 3 line name): half its largest drawn height plus\n * `pillAir`. A pill on a side edge may reach further sideways; the framing doesn't reserve that. */ hullX: 24, hullY: 40, pillAir: 12,\n} as const;\nexport type FrameBox = { x0: number; y0: number; x1: number; y1: number };\n\n/** The box a layer is framed by: every idea (`rx` / `ry` its half size) and every container hull. A hull's `pillH` is\n * its name pill's height at the largest drawn size (container.ts pillScaled at PILL.maxGrow). */\nexport function layerBounds(ideas: ReadonlyArray<{ x: number; y: number; rx: number; ry: number }>, hulls: ReadonlyArray<FrameBox & { pillH?: number }> = []): FrameBox {\n let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;\n for (const n of ideas) {\n const px = n.rx * (1 + FRAME.ring) + FRAME.clearX, py = n.ry * (1 + FRAME.ring) + FRAME.clearY;\n x0 = Math.min(x0, n.x - px); x1 = Math.max(x1, n.x + px); y0 = Math.min(y0, n.y - py); y1 = Math.max(y1, n.y + py);\n }\n for (const h of hulls) {\n const hy = Math.max(FRAME.hullY, (h.pillH ?? 0) / 2 + FRAME.pillAir);\n x0 = Math.min(x0, h.x0 - FRAME.hullX); x1 = Math.max(x1, h.x1 + FRAME.hullX); y0 = Math.min(y0, h.y0 - hy); y1 = Math.max(y1, h.y1 + hy);\n }\n if (!Number.isFinite(x0)) return { x0: -150, y0: -120, x1: 150, y1: 120 };\n return { x0, y0, x1, y1 };\n}\n\n/** Fit to view: the scale that shows `bounds` in an area of `width` × `height` (never beyond VIEW.fitMax), and the\n * world point to centre. */\nexport function fitView(bounds: FrameBox, width: number, height: number): { scale: number; center: { x: number; y: number } } {\n const scale = Math.min(width / Math.max(1, bounds.x1 - bounds.x0), height / Math.max(1, bounds.y1 - bounds.y0), VIEW.fitMax);\n return { scale, center: { x: (bounds.x0 + bounds.x1) / 2, y: (bounds.y0 + bounds.y1) / 2 } };\n}\n\n/** Insets: room the host's chrome takes at each edge of the map (a docked Vault, a top bar, the Composer). */\nexport type FrameInsets = { top?: number; right?: number; bottom?: number; left?: number };\n/** The smallest free area a map is ever fitted into, however much the insets take. */\nexport const FIT_ROOM = { minWidth: 200, minHeight: 160 } as const;\n\n/** Fit to view inside insets. The map's canvas fills its whole frame - so the canvas itself and its chromatic immersion\n * run behind the host's chrome (a docked Vault floats over the tinted canvas) - while the layer is fitted into the\n * free area (the frame less the insets, never below FIT_ROOM) and centred in it. `screen`: where on the canvas the\n * world `center` goes (screen = world × scale + translation); `room`: the free area's size. With no insets this is\n * fitView, centred on the canvas. */\nexport function fitViewInset(bounds: FrameBox, width: number, height: number, insets: FrameInsets = {}): { scale: number; center: { x: number; y: number }; screen: { x: number; y: number }; room: { width: number; height: number } } {\n const top = insets.top ?? 0, right = insets.right ?? 0, bottom = insets.bottom ?? 0, left = insets.left ?? 0;\n const w = Math.max(FIT_ROOM.minWidth, width - left - right), h = Math.max(FIT_ROOM.minHeight, height - top - bottom);\n const { scale, center } = fitView(bounds, w, h);\n return { scale, center, screen: { x: left + w / 2, y: top + h / 2 }, room: { width: w, height: h } };\n}\n\n/** Where the peek card sits (pointer): beside the idea — right of it if it fits, else left — and level with it. */\nexport const PEEK_PLACEMENT = {\n /** Gap between the idea's outermost ring and the card. */ gap: 16,\n /** The card's width and the height kept clear below it. */ cardWidth: 300, cardHeight: 220,\n /** The card is raised this much above the idea's centre. */ raise: 70,\n /** Kept this far inside the map's edges. */ margin: 12,\n} as const;\n\n/** The peek card's top-left, in map (screen) pixels. `idea`: the idea's centre on screen and its on-screen half\n * width with its outermost ring (`half`); `box`: the map's size. */\nexport function peekPosition(idea: { x: number; y: number; half: number }, box: { w: number; h: number }, card: { w: number; h: number } = { w: PEEK_PLACEMENT.cardWidth, h: PEEK_PLACEMENT.cardHeight }) {\n const P = PEEK_PLACEMENT, half = idea.half + P.gap;\n const right = idea.x + half + card.w < box.w - P.margin;\n return { left: right ? idea.x + half : Math.max(P.margin, idea.x - half - card.w), top: Math.min(Math.max(P.margin, idea.y - P.raise), box.h - card.h), side: right ? 'right' as const : 'left' as const };\n}\n\n/** The depth trail: each entry shows the idea that was stepped into — its title and a dot in its color (the same\n * topic or custom color the idea is drawn in, including the sibling-order topic of an uncolored idea). The first\n * entry is the map itself: a `stone` dot and the home glyph only (`rootLabel: 'icon'`) — no text, since a map's title\n * usually repeats its centre idea's, which the next entry shows; its accessible name and tooltip are the map's title.\n * The dot is the idea shape (shapeForLevel). */\nexport const TRAIL = { rootTopic: 'stone', rootLabel: 'icon', homeIconSize: 12, dotBox: 16, dotRadius: 6.4, stroke: 1.25, currentStroke: 1.75 } as const;\n\n/** How an idea draws while a highlight is on (VisualMap `highlight`, or picking ideas for a group or a connector):\n * `ids` are the highlighted ideas. A non-empty list: those are 'selected' and every other idea 'dimmed'. An empty list:\n * every idea 'dimmed' while `picking` (nothing chosen yet), else no highlight (null). No list: null. */\nexport function ideaHighlight(ids: readonly string[] | null | undefined, picking: boolean, id: string): 'selected' | 'dimmed' | null {\n if (!ids) return null;\n if (ids.length) return ids.includes(id) ? 'selected' : 'dimmed';\n return picking ? 'dimmed' : null;\n}\n\n/** How an input answers: a mouse hovers (peeks and terms open on hover); touch and pen tap. Null for unknown pointers. */\nexport function pointerModeFor(pointerType: string): 'hover' | 'touch' | null {\n return pointerType === 'mouse' ? 'hover' : pointerType === 'touch' || pointerType === 'pen' ? 'touch' : null;\n}\n\n/** Whether a pointer of this type opens a term on hover (PointerEvent.pointerType). */\nexport function hoverOpensTerm(pointerType: string): boolean {\n return TERM.hoverPointers.includes(pointerType);\n}\n","// ─── Performance & Rendering Constants ───────────────────────────────────────\n//\n// Performance budgets and interaction thresholds. Visual values (colours,\n// stroke widths, node size, zoom range) come from the design system tokens.\n\nimport { VIEW } from '../generated/geometry/interaction.js';\n\n// ── FPS ───────────────────────────────────────────────────────────────────────\n\nexport const FPS_TARGET = 60;\nexport const FPS_WARNING_THRESHOLD = 45;\nexport const FPS_CRITICAL_THRESHOLD = 30;\nexport const TARGET_FRAME_TIME = 1000 / FPS_TARGET; // ~16.67 ms\nexport const MAX_FRAME_TIME = 18; // p95 threshold\n\n/** Legacy frame-rate targets kept for backward compatibility. */\nexport const FPS_TARGETS = {\n PAN_MIN: 30,\n ZOOM_TARGET: 60,\n WARNING_THRESHOLD: 20,\n} as const;\n\n// ── Timing Thresholds (ms) ────────────────────────────────────────────────────\n\nexport const TIMING_THRESHOLDS = {\n VIEWPORT_QUERY_MAX: 5,\n SPATIAL_UPDATE_MAX: 10,\n DRAG_RESPONSE_MAX: 16,\n LOAD_5K_TARGET: 2000,\n LOAD_10K_TARGET: 3000,\n VIEWPORT_DEBOUNCE: 100,\n SPATIAL_INDEX_BUILD: 50,\n} as const;\n\n// ── Memory Limits (MB) ────────────────────────────────────────────────────────\n\nexport const MEMORY_TARGET_MB = 500;\nexport const MEMORY_WARNING_MB = 600;\nexport const MEMORY_CRITICAL_MB = 800;\n\nexport const MEMORY_LIMITS = {\n MAX_10K_NODES: 500,\n MAX_GROWTH_PERCENT: 20,\n WARNING_THRESHOLD: 400,\n} as const;\n\n// ── Viewport Culling ──────────────────────────────────────────────────────────\n\nexport const VIEWPORT_MARGIN = 0.1;\nexport const MAX_VISIBLE_NODES = 800;\nexport const CULLING_QUERY_TIME_BUDGET = 5;\n\n// ── Spatial Index ─────────────────────────────────────────────────────────────\n\nexport const RBUSH_MAX_ENTRIES = 16;\nexport const SPATIAL_INDEX_BUILD_BUDGET = 50;\n\n// ── Zoom Constraints ──────────────────────────────────────────────────────────\n\n// Zoom limits: the design system's VIEW (geometry/interaction.ts; equal to the zoom-min / zoom-max tokens).\nexport const ZOOM_MIN = VIEW.zoomMin;\nexport const ZOOM_MAX = VIEW.zoomMax;\nexport const ZOOM_DEFAULT = 1.0;\n\n// ── Quality Level Presets ─────────────────────────────────────────────────────\n\nexport const QUALITY_HIGH = {\n shadows: true,\n bezierCurves: true,\n animations: true,\n textQuality: 'high' as const,\n antialiasing: true,\n};\n\nexport const QUALITY_MEDIUM = {\n shadows: false,\n bezierCurves: true,\n animations: true,\n textQuality: 'medium' as const,\n antialiasing: true,\n};\n\nexport const QUALITY_LOW = {\n shadows: false,\n bezierCurves: false,\n animations: false,\n textQuality: 'low' as const,\n antialiasing: false,\n};\n\n// ── Performance Monitoring ────────────────────────────────────────────────────\n\nexport const FPS_SAMPLE_WINDOW = 60;\nexport const FPS_UPDATE_INTERVAL = 1000;\nexport const MEMORY_CHECK_INTERVAL = 5000;\nexport const PERFORMANCE_TOAST_COOLDOWN = 10000;\n\n// ── Auto-Adjustment ───────────────────────────────────────────────────────────\n\nexport const FPS_DOWNGRADE_THRESHOLD = 45;\nexport const FPS_UPGRADE_THRESHOLD = 58;\nexport const FPS_STABILIZATION_FRAMES = 180;\n\n// ── Canvas Dimensions ─────────────────────────────────────────────────────────\n\nexport const DEFAULT_CANVAS_WIDTH = 1920;\nexport const DEFAULT_CANVAS_HEIGHT = 1080;\n\n// ── Interaction ───────────────────────────────────────────────────────────────\n\nexport const CLICK_THRESHOLD = 5;\nexport const DOUBLE_CLICK_DELAY = 300;\nexport const DRAG_START_DISTANCE = 10;\n\n// ── Data Validation ───────────────────────────────────────────────────────────\n\nexport const MAX_NODES = 20000;\nexport const CIRCULAR_REFERENCE_MAX_DEPTH = 1000;\n\n// ── Debounce / Throttle ───────────────────────────────────────────────────────\n\nexport const RESIZE_DEBOUNCE = 300;\nexport const SCROLL_THROTTLE = 16;\nexport const SEARCH_DEBOUNCE = 500;\n\n/** Node count thresholds that gate optimisation strategies. */\nexport const NODE_COUNT_THRESHOLDS = {\n SPATIAL_INDEX_MIN: 100,\n VIEWPORT_CULLING_MIN: 500,\n CANVAS_RENDERING_MIN: 2000,\n DOM_RENDERING_MAX: 5000,\n} as const;\n\n/** Viewport buffer configuration. */\nexport const VIEWPORT_CONFIG = {\n BUFFER_PERCENT: 0.2,\n MIN_VISIBLE_NODES: 10,\n} as const;\n","// ─── Render Configuration ─────────────────────────────────────────────────────\n\nimport type { RenderConfig } from '../types/mindmap.js';\nimport {\n FPS_TARGET,\n MEMORY_TARGET_MB,\n QUALITY_HIGH,\n QUALITY_MEDIUM,\n QUALITY_LOW,\n NODE_COUNT_THRESHOLDS,\n} from './performanceConstants.js';\n\n// ── Defaults ──────────────────────────────────────────────────────────────────\n\nexport const DEFAULT_RENDER_CONFIG: RenderConfig = {\n renderMode: 'canvas',\n qualityLevel: 'high',\n cullingEnabled: false,\n fpsTarget: FPS_TARGET,\n memoryLimit: MEMORY_TARGET_MB,\n};\n\nexport const SIMPLIFIED_RENDER_CONFIG: RenderConfig = {\n renderMode: 'simplified',\n qualityLevel: 'low',\n cullingEnabled: true,\n fpsTarget: 30,\n memoryLimit: 400,\n};\n\n// ── Quality Map ───────────────────────────────────────────────────────────────\n\nexport const QUALITY_SETTINGS = {\n high: QUALITY_HIGH,\n medium: QUALITY_MEDIUM,\n low: QUALITY_LOW,\n} as const;\n\n// ── Feature Flags ─────────────────────────────────────────────────────────────\n\nexport const FEATURE_FLAGS = {\n viewportCulling: true,\n spatialIndexing: true,\n shadows: true,\n bezierCurves: true,\n animations: true,\n branchBadges: true,\n autoQualityAdjustment: true,\n performanceMonitoring: true,\n performanceToasts: true,\n debugOverlay: false,\n showFPS: false,\n showMemory: false,\n showVisibleCount: false,\n} as const;\n\n// ── Render Modes ──────────────────────────────────────────────────────────────\n\nexport type RenderMode = RenderConfig['renderMode'];\nexport type QualityLevel = RenderConfig['qualityLevel'];\n\nexport const RENDER_MODES = {\n canvas: {\n name: 'Canvas',\n description: 'Full Konva canvas rendering with all features',\n features: { culling: true, shadows: true, bezierCurves: true, animations: true },\n },\n simplified: {\n name: 'Simplified',\n description: 'Reduced feature set for low-end devices',\n features: { culling: true, shadows: false, bezierCurves: false, animations: false },\n },\n} as const;\n\nexport const QUALITY_LEVELS = {\n high: { name: 'High', description: 'All visual features enabled', targetFPS: 60, features: QUALITY_HIGH },\n medium: { name: 'Medium', description: 'Shadows disabled, other features enabled', targetFPS: 60, features: QUALITY_MEDIUM },\n low: { name: 'Low', description: 'Minimal visual features, max performance', targetFPS: 30, features: QUALITY_LOW },\n} as const;\n\n// ── Auto-Adjustment Helpers ───────────────────────────────────────────────────\n\nexport function getOptimalQualityLevel(\n currentFPS: number,\n currentQuality: QualityLevel,\n): QualityLevel {\n if (currentFPS < 45 && currentQuality === 'high') return 'medium';\n if (currentFPS < 30 && currentQuality === 'medium') return 'low';\n if (currentFPS > 58 && currentQuality === 'low') return 'medium';\n if (currentFPS > 58 && currentQuality === 'medium') return 'high';\n return currentQuality;\n}\n\nexport function getRenderConfigForQuality(quality: QualityLevel): Partial<RenderConfig> {\n return { qualityLevel: quality, fpsTarget: QUALITY_LEVELS[quality].targetFPS };\n}\n\nexport function isFeatureEnabled(\n featureName: keyof typeof FEATURE_FLAGS,\n config: RenderConfig,\n): boolean {\n if (!FEATURE_FLAGS[featureName]) return false;\n\n const qs = QUALITY_SETTINGS[config.qualityLevel];\n switch (featureName) {\n case 'shadows': return qs.shadows;\n case 'bezierCurves': return qs.bezierCurves;\n case 'animations': return qs.animations;\n default: return FEATURE_FLAGS[featureName] as boolean;\n }\n}\n\n// ── Device Detection ──────────────────────────────────────────────────────────\n\n/**\n * Recommend a render config based on detected device memory (browser only).\n * Falls back to SIMPLIFIED_RENDER_CONFIG when the Performance Memory API is\n * unavailable or memory is constrained.\n */\nexport function getRecommendedRenderConfig(): RenderConfig {\n if (typeof performance === 'undefined' || !(performance as unknown as Record<string, unknown>)['memory']) {\n return SIMPLIFIED_RENDER_CONFIG;\n }\n\n const memory = (performance as unknown as Record<string, unknown>)['memory'] as Record<string, number>;\n if (memory?.['jsHeapSizeLimit'] && memory['jsHeapSizeLimit'] < 512 * 1024 * 1024) {\n return SIMPLIFIED_RENDER_CONFIG;\n }\n\n return DEFAULT_RENDER_CONFIG;\n}\n\n/** Re-export so consumers need only one import. */\nexport { NODE_COUNT_THRESHOLDS };\n","// ─── Viewport Utilities ───────────────────────────────────────────────────────\n//\n// Pure functions for viewport bounds calculation, coordinate transforms,\n// pan/zoom operations, and node visibility queries.\n\nimport type { ViewportState } from '../types/mindmap.js';\nimport {\n VIEWPORT_MARGIN,\n DEFAULT_CANVAS_WIDTH,\n DEFAULT_CANVAS_HEIGHT,\n ZOOM_MIN,\n ZOOM_MAX,\n} from '../constants/performanceConstants.js';\n\n// ── Viewport Bounds ───────────────────────────────────────────────────────────\n\nexport interface WorldBounds {\n minX: number;\n minY: number;\n maxX: number;\n maxY: number;\n}\n\n/**\n * Calculate the visible world-space bounding box including a margin buffer.\n */\nexport function calculateViewportBounds(\n viewport: ViewportState,\n canvasWidth = DEFAULT_CANVAS_WIDTH,\n canvasHeight = DEFAULT_CANVAS_HEIGHT,\n): WorldBounds {\n const worldW = canvasWidth / viewport.zoomLevel;\n const worldH = canvasHeight / viewport.zoomLevel;\n const mx = worldW * VIEWPORT_MARGIN;\n const my = worldH * VIEWPORT_MARGIN;\n return {\n minX: viewport.centerX - worldW / 2 - mx,\n minY: viewport.centerY - worldH / 2 - my,\n maxX: viewport.centerX + worldW / 2 + mx,\n maxY: viewport.centerY + worldH / 2 + my,\n };\n}\n\n/**\n * Return a new ViewportState with `visibleBounds` recalculated.\n */\nexport function recalculateViewportBounds(\n viewport: ViewportState,\n canvasWidth = DEFAULT_CANVAS_WIDTH,\n canvasHeight = DEFAULT_CANVAS_HEIGHT,\n): ViewportState {\n return {\n ...viewport,\n visibleBounds: calculateViewportBounds(viewport, canvasWidth, canvasHeight),\n };\n}\n\n// ── Coordinate Transforms ─────────────────────────────────────────────────────\n\n/**\n * Convert world-space coordinates to screen-space pixel coordinates.\n */\nexport function worldToScreen(\n worldX: number,\n worldY: number,\n viewport: ViewportState,\n canvasWidth = DEFAULT_CANVAS_WIDTH,\n canvasHeight = DEFAULT_CANVAS_HEIGHT,\n): { x: number; y: number } {\n return {\n x: (worldX - viewport.centerX) * viewport.zoomLevel + canvasWidth / 2,\n y: (worldY - viewport.centerY) * viewport.zoomLevel + canvasHeight / 2,\n };\n}\n\n/**\n * Convert screen-space pixel coordinates to world-space coordinates.\n */\nexport function screenToWorld(\n screenX: number,\n screenY: number,\n viewport: ViewportState,\n canvasWidth = DEFAULT_CANVAS_WIDTH,\n canvasHeight = DEFAULT_CANVAS_HEIGHT,\n): { x: number; y: number } {\n return {\n x: (screenX - canvasWidth / 2) / viewport.zoomLevel + viewport.centerX,\n y: (screenY - canvasHeight / 2) / viewport.zoomLevel + viewport.centerY,\n };\n}\n\n// ── Pan / Zoom ────────────────────────────────────────────────────────────────\n\n/** Clamp zoom to the design system's limits (VIEW: ZOOM_MIN–ZOOM_MAX), which apply to the zoom relative to the\n * layer's fit (`fit`: the fit-to-view scale), as in the design system's map (scale = fit × zoom). */\nexport function clampZoom(zoom: number, fit = 1): number {\n return Math.min(ZOOM_MAX * fit, Math.max(ZOOM_MIN * fit, zoom));\n}\n\n/**\n * Pan the viewport by a screen-space delta (positive = right/down).\n */\nexport function panViewport(\n deltaX: number,\n deltaY: number,\n viewport: ViewportState,\n): ViewportState {\n return {\n ...viewport,\n centerX: viewport.centerX - deltaX / viewport.zoomLevel,\n centerY: viewport.centerY - deltaY / viewport.zoomLevel,\n };\n}\n\n/** Teleport the viewport centre to the given world coordinates. */\nexport function setViewportCenter(\n x: number,\n y: number,\n viewport: ViewportState,\n): ViewportState {\n return { ...viewport, centerX: x, centerY: y };\n}\n\n/**\n * Zoom the viewport by a multiplicative delta, optionally around a pivot point.\n *\n * @param delta - Multiplier delta, e.g. 0.1 for +10% zoom\n * @param pivotX - Optional screen-space X pivot\n * @param pivotY - Optional screen-space Y pivot\n */\nexport function zoomViewport(\n delta: number,\n viewport: ViewportState,\n pivotX?: number,\n pivotY?: number,\n canvasWidth = DEFAULT_CANVAS_WIDTH,\n canvasHeight = DEFAULT_CANVAS_HEIGHT,\n fit = 1,\n): ViewportState {\n const newZoom = clampZoom(viewport.zoomLevel * (1 + delta), fit);\n\n let cx = viewport.centerX;\n let cy = viewport.centerY;\n\n if (pivotX !== undefined && pivotY !== undefined) {\n const worldPivot = screenToWorld(pivotX, pivotY, viewport, canvasWidth, canvasHeight);\n cx = worldPivot.x - (pivotX - canvasWidth / 2) / newZoom;\n cy = worldPivot.y - (pivotY - canvasHeight / 2) / newZoom;\n }\n\n return { ...viewport, centerX: cx, centerY: cy, zoomLevel: newZoom };\n}\n\n/**\n * Create a viewport centred on a node (world coordinates) at the given zoom level.\n */\nexport function focusOnNode(\n nodeX: number,\n nodeY: number,\n zoom: number,\n): ViewportState {\n const clamped = clampZoom(zoom);\n return {\n centerX: nodeX,\n centerY: nodeY,\n zoomLevel: clamped,\n rotation: 0,\n visibleBounds: calculateViewportBounds(\n { centerX: nodeX, centerY: nodeY, zoomLevel: clamped, rotation: 0, visibleBounds: { minX: 0, minY: 0, maxX: 0, maxY: 0 } },\n ),\n };\n}\n\n// ── Visibility ────────────────────────────────────────────────────────────────\n\n/**\n * Test whether a world-space AABB intersects the viewport's visible bounds.\n */\nexport function isNodeInViewport(\n nodeX: number,\n nodeY: number,\n nodeWidth: number,\n nodeHeight: number,\n viewport: ViewportState,\n canvasWidth = DEFAULT_CANVAS_WIDTH,\n canvasHeight = DEFAULT_CANVAS_HEIGHT,\n): boolean {\n const bounds = calculateViewportBounds(viewport, canvasWidth, canvasHeight);\n const hw = nodeWidth / 2;\n const hh = nodeHeight / 2;\n return !(\n nodeX + hw < bounds.minX ||\n nodeX - hw > bounds.maxX ||\n nodeY + hh < bounds.minY ||\n nodeY - hh > bounds.maxY\n );\n}\n","// ─── Performance Monitors ─────────────────────────────────────────────────────\n//\n// FPSMonitor – tracks frame rate via requestAnimationFrame (browser)\n// MemoryMonitor – polls performance.memory (Chrome)\n// PerformanceProfiler – mark / measure utility for arbitrary operations\n\nimport {\n FPS_TARGET,\n FPS_SAMPLE_WINDOW,\n MEMORY_CHECK_INTERVAL,\n} from '../constants/performanceConstants.js';\n\n// ── FPS Monitor ───────────────────────────────────────────────────────────────\n\nexport class FPSMonitor {\n private frameTimes: number[] = [];\n private lastTime = 0;\n private currentFPS = FPS_TARGET;\n private rafId: number | null = null;\n\n start(): void {\n if (this.rafId !== null) return;\n\n const measure = (ts: number) => {\n if (this.lastTime > 0) {\n this.frameTimes.push(ts - this.lastTime);\n if (this.frameTimes.length > FPS_SAMPLE_WINDOW) this.frameTimes.shift();\n this.currentFPS = this.calc();\n }\n this.lastTime = ts;\n this.rafId = requestAnimationFrame(measure);\n };\n\n this.rafId = requestAnimationFrame(measure);\n }\n\n stop(): void {\n if (this.rafId !== null) { cancelAnimationFrame(this.rafId); this.rafId = null; }\n }\n\n private calc(): number {\n if (this.frameTimes.length === 0) return FPS_TARGET;\n const avg = this.frameTimes.reduce((a, b) => a + b, 0) / this.frameTimes.length;\n return Math.round(1000 / avg);\n }\n\n getFPS(): number { return this.currentFPS; }\n getAverageFPS(): number { return this.currentFPS; }\n\n getP95FrameTime(): number {\n if (this.frameTimes.length === 0) return 0;\n const sorted = [...this.frameTimes].sort((a, b) => a - b);\n return sorted[Math.floor(sorted.length * 0.95)];\n }\n\n reset(): void { this.frameTimes = []; this.currentFPS = FPS_TARGET; }\n}\n\n// ── Memory Monitor ────────────────────────────────────────────────────────────\n\nexport interface MemoryStats {\n usedJSHeapSize: number;\n totalJSHeapSize: number;\n jsHeapSizeLimit: number;\n heapUsagePercent: number;\n}\n\nexport class MemoryMonitor {\n private timer: ReturnType<typeof setInterval> | null = null;\n private current = 0;\n\n start(onUpdate?: (mb: number) => void): void {\n if (this.timer !== null) return;\n this.timer = setInterval(() => {\n this.current = this.measure();\n onUpdate?.(this.current);\n }, MEMORY_CHECK_INTERVAL);\n }\n\n stop(): void {\n if (this.timer !== null) { clearInterval(this.timer); this.timer = null; }\n }\n\n private measure(): number {\n const mem = (performance as unknown as Record<string, unknown>)['memory'] as Record<string, number> | undefined;\n return mem ? mem['usedJSHeapSize'] / (1024 * 1024) : 0;\n }\n\n getMemoryMB(): number { return this.current; }\n\n getStats(): MemoryStats | null {\n const mem = (performance as unknown as Record<string, unknown>)['memory'] as Record<string, number> | undefined;\n if (!mem) return null;\n return {\n usedJSHeapSize: mem['usedJSHeapSize'],\n totalJSHeapSize: mem['totalJSHeapSize'],\n jsHeapSizeLimit: mem['jsHeapSizeLimit'],\n heapUsagePercent: (mem['usedJSHeapSize'] / mem['jsHeapSizeLimit']) * 100,\n };\n }\n\n static isSupported(): boolean {\n return !!(performance as unknown as Record<string, unknown>)['memory'];\n }\n}\n\n// ── Performance Profiler ──────────────────────────────────────────────────────\n\nexport class PerformanceProfiler {\n private marks: Map<string, number> = new Map();\n private measures: Map<string, number[]> = new Map();\n\n mark(label: string): void {\n this.marks.set(label, performance.now());\n }\n\n measure(label: string): number {\n const start = this.marks.get(label);\n if (start === undefined) return 0;\n const duration = performance.now() - start;\n const list = this.measures.get(label) ?? [];\n list.push(duration);\n this.measures.set(label, list);\n this.marks.delete(label);\n return duration;\n }\n\n getAverage(label: string): number {\n const list = this.measures.get(label);\n if (!list?.length) return 0;\n return list.reduce((a, b) => a + b, 0) / list.length;\n }\n\n getP95(label: string): number {\n const list = this.measures.get(label);\n if (!list?.length) return 0;\n const sorted = [...list].sort((a, b) => a - b);\n return sorted[Math.floor(sorted.length * 0.95)];\n }\n\n clear(label?: string): void {\n if (label) { this.marks.delete(label); this.measures.delete(label); }\n else { this.marks.clear(); this.measures.clear(); }\n }\n}\n","// ─── Spatial Index ────────────────────────────────────────────────────────────\n//\n// RBush-backed R-tree for O(log n) viewport culling queries.\n// Wraps the `rbush` library with a typed, domain-specific interface.\n\nimport RBush from 'rbush';\n\nexport interface BoundingBox {\n minX: number;\n minY: number;\n maxX: number;\n maxY: number;\n}\n\ninterface SpatialItem extends BoundingBox {\n nodeId: string;\n}\n\nexport interface ISpatialIndex {\n insert(nodeId: string, bounds: BoundingBox): void;\n remove(nodeId: string, bounds: BoundingBox): void;\n update(nodeId: string, oldBounds: BoundingBox, newBounds: BoundingBox): void;\n query(bounds: BoundingBox): string[];\n clear(): void;\n size(): number;\n bulkLoad(items: Array<{ nodeId: string; bounds: BoundingBox }>): void;\n}\n\n/**\n * RBush-based spatial index for efficient viewport culling.\n *\n * - Insert / remove / update: O(log n)\n * - Query: O(log n + k) where k = result count\n * - Bulk load: O(n log n) — use instead of repeated inserts for initial load\n */\nexport class RBushSpatialIndex implements ISpatialIndex {\n private tree: RBush<SpatialItem>;\n private cache: Map<string, BoundingBox>;\n\n constructor() {\n this.tree = new RBush<SpatialItem>();\n this.cache = new Map();\n }\n\n insert(nodeId: string, bounds: BoundingBox): void {\n this.tree.insert({ ...bounds, nodeId });\n this.cache.set(nodeId, bounds);\n }\n\n remove(nodeId: string, bounds: BoundingBox): void {\n this.tree.remove({ ...bounds, nodeId }, (a, b) => a.nodeId === b.nodeId);\n this.cache.delete(nodeId);\n }\n\n update(nodeId: string, oldBounds: BoundingBox, newBounds: BoundingBox): void {\n this.remove(nodeId, oldBounds);\n this.insert(nodeId, newBounds);\n }\n\n query(bounds: BoundingBox): string[] {\n return this.tree.search(bounds).map(item => item.nodeId);\n }\n\n clear(): void {\n this.tree.clear();\n this.cache.clear();\n }\n\n size(): number {\n return this.cache.size;\n }\n\n bulkLoad(items: Array<{ nodeId: string; bounds: BoundingBox }>): void {\n const rbushItems = items.map(({ nodeId, bounds }) => ({ ...bounds, nodeId }));\n this.tree.load(rbushItems);\n for (const { nodeId, bounds } of items) this.cache.set(nodeId, bounds);\n }\n\n /** Return the cached bounding box for a node (undefined if not indexed). */\n getBounds(nodeId: string): BoundingBox | undefined {\n return this.cache.get(nodeId);\n }\n}\n","const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const destroy = () => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n console.warn(\n \"[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected.\"\n );\n }\n listeners.clear();\n };\n const api = { setState, getState, getInitialState, subscribe, destroy };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;\nvar vanilla = (createState) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n console.warn(\n \"[DEPRECATED] Default export is deprecated. Instead use import { createStore } from 'zustand/vanilla'.\"\n );\n }\n return createStore(createState);\n};\n\nexport { createStore, vanilla as default };\n","import { createStore } from 'zustand/vanilla';\nimport type { NodeSelection, RenderConfig } from '../types/index.js';\nimport {\n DEFAULT_RENDER_CONFIG,\n getOptimalQualityLevel,\n getRenderConfigForQuality,\n isFeatureEnabled,\n FEATURE_FLAGS,\n} from '../constants/renderConfig.js';\n\n// ─── Selection Store ──────────────────────────────────────────────────────────\n\nexport interface ISelectionStore extends NodeSelection {\n select: (nodeId: string) => void;\n clear: () => void;\n toggle: (nodeId: string) => void;\n isSelected: (nodeId: string) => boolean;\n}\n\nexport const selectionStore = createStore<ISelectionStore>((set, get) => ({\n selectedId: null,\n select: (nodeId) => set({ selectedId: nodeId }),\n clear: () => set({ selectedId: null }),\n toggle: (nodeId) => set((s) => ({ selectedId: s.selectedId === nodeId ? null : nodeId })),\n isSelected: (nodeId) => get().selectedId === nodeId,\n}));\n\n// ─── Render Config Store ──────────────────────────────────────────────────────\n\nexport interface IRenderConfigStore extends RenderConfig {\n setQualityLevel: (level: RenderConfig['qualityLevel']) => void;\n setRenderMode: (mode: RenderConfig['renderMode']) => void;\n setCullingEnabled: (enabled: boolean) => void;\n autoAdjustQuality: (currentFPS: number) => void;\n autoAdjustQualityByMemory: (memoryMB: number) => void;\n resetToDefaults: () => void;\n isFeatureEnabled: (feature: keyof typeof FEATURE_FLAGS) => boolean;\n}\n\nexport const renderConfigStore = createStore<IRenderConfigStore>((set, get) => ({\n ...DEFAULT_RENDER_CONFIG,\n\n setQualityLevel: (level) => set(getRenderConfigForQuality(level)),\n setRenderMode: (mode) => set({ renderMode: mode }),\n setCullingEnabled: (enabled) => set({ cullingEnabled: enabled }),\n\n autoAdjustQuality: (fps) =>\n set((s) => {\n const q = getOptimalQualityLevel(fps, s.qualityLevel);\n return q !== s.qualityLevel ? getRenderConfigForQuality(q) : s;\n }),\n\n autoAdjustQualityByMemory: (mb) =>\n set((s) => {\n const q = mb > 500 ? 'low' : mb > 400 && s.qualityLevel === 'high' ? 'medium' : s.qualityLevel;\n return q !== s.qualityLevel ? getRenderConfigForQuality(q as RenderConfig['qualityLevel']) : s;\n }),\n\n resetToDefaults: () => set({ ...DEFAULT_RENDER_CONFIG }),\n isFeatureEnabled: (feature) => isFeatureEnabled(feature, get()),\n}));\n","// Generated from visualli.ai design-system/components/src/container.ts — do not edit here.\n/* Containers: the dashed hull around a group of ideas, and where its name goes.\n The name is a pill straddling the hull's boundary. Which point of the boundary depends on what's inside and around\n the container: the spot is chosen by scoring candidates along all four edges against the ideas, the connectors and\n the names already placed — deterministic, so every renderer (VisualMap, the spec SDK on a canvas, PDF export) puts\n it in the same place for the same file. Pure functions, no dependencies. World units (the map's coordinates). */\n\nexport type Pt = { x: number; y: number };\nexport type Box = { x0: number; y0: number; x1: number; y1: number };\nexport type Hull = Box & { radius: number };\nexport type LabelSide = 'bottom' | 'top' | 'left' | 'right';\nexport type LabelPlacement = { x: number; y: number; side: LabelSide; score: number };\n\n/** The hull reaches this far beyond its ideas' centers, and rounds its corners this much. */\nexport const HULL = { padX: 150, padY: 125, radius: 48 };\n/** Penalties: an idea or another name under the pill is never fine; a connector through it is bad; order breaks ties. */\nconst WEIGHT = { idea: 1000, label: 1000, connector: 60, preference: 1 };\n\n/** Room kept between a member's outline and the hull, for ideas larger than the base size. */\nexport const HULL_CLEAR = { x: 50, y: 51 } as const;\n\n/** The name pill (1x, world units = CSS px): the `note` face 26px bold (× the label scale), line-height 1.1, padding\n * and border as the CSS draws them. It grows with the name up to `maxWidth` (padding and border included), then wraps\n * to at most `maxLines` lines (a word wider than a line is split across lines); an ellipsis only past that. Zooming grows the text with the label growth (up to\n * `maxGrow`) but never the padding or border, and never re-wraps. `.vi-map__group-label`'s max-width equals\n * `maxWidth` (the build checks it). */\nexport const PILL = {\n fontPx: 26, lineHeight: 1.1, padX: 22, padTop: 6, padBottom: 8, border: 1.5, maxWidth: 420, maxLines: 3, maxGrow: 1.3,\n} as const;\n\n/** The pill's fixed chrome (padding + border): width and height that don't scale with the text. */\nexport const PILL_CHROME = { w: 2 * PILL.padX + 2 * PILL.border, h: PILL.padTop + PILL.padBottom + 2 * PILL.border } as const;\nexport type PillSize = { lines: string[]; w: number; h: number };\n\n/** A text's user-perceived characters, without Intl.Segmenter (not in every browser the spec supports): code points,\n * with combining marks, variation selectors, emoji modifiers, tag characters, keycaps, zero-width-joiner sequences and\n * pairs of regional indicators (flags) kept with the character they belong to — so a break never falls inside one. */\nfunction graphemes(text: string): string[] {\n const out: string[] = [], joins = /^[\\p{M}\\u200d\\ufe00-\\ufe0f\\u{1f3fb}-\\u{1f3ff}\\u{e0020}-\\u{e007f}]$/u, flag = /^[\\u{1f1e6}-\\u{1f1ff}]$/u;\n for (const c of Array.from(text)) {\n const last = out.length - 1;\n if (last >= 0 && (joins.test(c) || out[last].endsWith('\\u200d') || (flag.test(c) && Array.from(out[last]).every((x) => flag.test(x)) && Array.from(out[last]).length % 2 === 1))) out[last] += c;\n else out.push(c);\n }\n return out;\n}\n\n/** Wraps a container's name into its pill at 1x. `measure(text, px)` is the width of `text` in the note face at `px`\n * (an injected canvas measure, like wrapLines in idea.ts); `scale` is the label scale (1.15 in large type). Lines break\n * at spaces first; a word wider than a whole line (the pill's room: `maxWidth` less the padding and border) is split\n * across lines, each filled with as many characters as fit, never inside a character (an emoji, a combining mark), so\n * every line fits the pill. Past `maxLines` the last line ends in an ellipsis that fits. `w` is the widest line plus\n * the chrome (at most `maxWidth`), `h` the lines plus the chrome. */\nexport function pillLayout(name: string, measure: (text: string, px: number) => number, scale = 1): PillSize {\n const px = PILL.fontPx * scale, room = PILL.maxWidth - PILL_CHROME.w, m = (s: string) => measure(s, px);\n // Each line, and whether it was cut inside a word (then the next line continues it, with no space between).\n const rows: { text: string; mid: boolean }[] = [];\n let cur = '';\n for (const w of name.split(/\\s+/).filter(Boolean)) {\n if (m(w) > room) {\n // Too long for any line: it starts on its own line, then fills line after line; its last piece can take more words.\n if (cur) rows.push({ text: cur, mid: false });\n let part = '';\n for (const g of graphemes(w)) {\n if (part && m(part + g) > room) { rows.push({ text: part, mid: true }); part = g; } else part += g;\n }\n cur = part;\n continue;\n }\n const next = cur ? `${cur} ${w}` : w;\n if (cur && m(next) > room) { rows.push({ text: cur, mid: false }); cur = w; } else cur = next;\n }\n if (cur) rows.push({ text: cur, mid: false });\n let lines = rows.map((r) => r.text);\n if (!lines.length) lines = [''];\n if (rows.length > PILL.maxLines) {\n // Past the limit: keep the first lines, and end the last one in an ellipsis that fits.\n let rest = '';\n rows.slice(PILL.maxLines - 1).forEach((r, i, a) => { rest += r.text + (i < a.length - 1 && !r.mid ? ' ' : ''); });\n const gs = graphemes(rest);\n while (gs.length > 1 && m(gs.join('') + '\\u2026') > room) gs.pop();\n lines = [...lines.slice(0, PILL.maxLines - 1), gs.join('').replace(/\\s+$/, '') + '\\u2026'];\n }\n const widest = Math.max(...lines.map(m));\n return { lines, w: Math.min(PILL.maxWidth, widest + PILL_CHROME.w), h: lines.length * px * PILL.lineHeight + PILL_CHROME.h };\n}\n\n/** The pill as drawn at label growth `k` (1 to PILL.maxGrow): the text grows, the padding and border don't. */\nexport function pillScaled(p: { w: number; h: number }, k: number): { w: number; h: number } {\n return { w: (p.w - PILL_CHROME.w) * k + PILL_CHROME.w, h: (p.h - PILL_CHROME.h) * k + PILL_CHROME.h };\n}\n\n/** The hull around a group's ideas: `padX` / `padY` beyond their centres, or more for an idea that has grown to show\n * its label (`rx` / `ry`, its half size: then its outline plus HULL_CLEAR). With the name's `pill` (its 1x size,\n * from pillLayout) the hull is also widened, symmetrically about its centre, so that the pill at its largest drawn\n * size (PILL.maxGrow) fits on the straight part of an edge: pill width + 2 × the corner radius. Hull and pill then\n * never change while zooming. Without a pill the hull is as before. */\nexport function containerHull(members: ReadonlyArray<Pt & { rx?: number; ry?: number }>, pill?: { w: number; h: number } | null): Hull | null {\n if (!members.length) return null;\n let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;\n for (const m of members) {\n const px = Math.max(HULL.padX, (m.rx ?? 0) + HULL_CLEAR.x), py = Math.max(HULL.padY, (m.ry ?? 0) + HULL_CLEAR.y);\n x0 = Math.min(x0, m.x - px); x1 = Math.max(x1, m.x + px); y0 = Math.min(y0, m.y - py); y1 = Math.max(y1, m.y + py);\n }\n if (pill) {\n const need = pillScaled(pill, PILL.maxGrow).w + 2 * HULL.radius, cx = (x0 + x1) / 2;\n if (x1 - x0 < need) { x0 = cx - need / 2; x1 = cx + need / 2; }\n }\n return { x0, x1, y0, y1, radius: HULL.radius };\n}\n\n/** Candidate spots for a w × h pill, in preference order: bottom center (the default look), top center, the thirds of\n * bottom and top, then the sides. Spots keep the whole pill on the straight part of an edge, clear of the corners. */\nexport function labelCandidates(hull: Hull, w: number, h: number): { x: number; y: number; side: LabelSide }[] {\n const { x0, x1, y0, y1, radius } = hull;\n const cx = (x0 + x1) / 2, cy = (y0 + y1) / 2;\n const minX = x0 + radius + w / 2, maxX = x1 - radius - w / 2; // horizontal room on top / bottom\n const minY = y0 + radius + h / 2, maxY = y1 - radius - h / 2; // vertical room on the sides\n const along = (lo: number, hi: number, f: number) => (lo > hi ? (lo + hi) / 2 : lo + (hi - lo) * f);\n const out: { x: number; y: number; side: LabelSide }[] = [\n { x: cx, y: y1, side: 'bottom' }, { x: cx, y: y0, side: 'top' },\n { x: along(minX, maxX, 0.2), y: y1, side: 'bottom' }, { x: along(minX, maxX, 0.8), y: y1, side: 'bottom' },\n { x: along(minX, maxX, 0.2), y: y0, side: 'top' }, { x: along(minX, maxX, 0.8), y: y0, side: 'top' },\n { x: x1, y: cy, side: 'right' }, { x: x0, y: cy, side: 'left' },\n { x: x1, y: along(minY, maxY, 0.25), side: 'right' }, { x: x1, y: along(minY, maxY, 0.75), side: 'right' },\n { x: x0, y: along(minY, maxY, 0.25), side: 'left' }, { x: x0, y: along(minY, maxY, 0.75), side: 'left' },\n ];\n // The extremes of the top / bottom edges, for wide labels on narrow hulls.\n out.push({ x: along(minX, maxX, 0), y: y1, side: 'bottom' }, { x: along(minX, maxX, 1), y: y1, side: 'bottom' },\n { x: along(minX, maxX, 0), y: y0, side: 'top' }, { x: along(minX, maxX, 1), y: y0, side: 'top' });\n return out;\n}\n\nconst overlap = (a: Box, b: Box) => Math.max(0, Math.min(a.x1, b.x1) - Math.max(a.x0, b.x0)) * Math.max(0, Math.min(a.y1, b.y1) - Math.max(a.y0, b.y0));\n\n/** Where a container's name goes. `ideas`: the boxes of every idea on the layer (outermost ring included);\n * `connectors`: points sampled along every connector; `labels`: the pills already placed on this layer.\n * `gap` keeps a little air between the pill and what it avoids. */\nexport function placeContainerLabel(hull: Hull, size: { w: number; h: number }, obstacles: { ideas: Box[]; connectors?: Pt[][]; labels?: Box[] }, gap = 10): LabelPlacement {\n const { w, h } = size;\n let best: LabelPlacement | null = null;\n labelCandidates(hull, w, h).forEach((c, i) => {\n const box = { x0: c.x - w / 2 - gap, x1: c.x + w / 2 + gap, y0: c.y - h / 2 - gap, y1: c.y + h / 2 + gap };\n const area = w * h;\n let score = i * WEIGHT.preference;\n for (const b of obstacles.ideas) score += (overlap(box, b) / area) * WEIGHT.idea;\n for (const b of obstacles.labels || []) score += (overlap(box, b) / area) * WEIGHT.label;\n for (const line of obstacles.connectors || []) if (line.some((p) => p.x > box.x0 && p.x < box.x1 && p.y > box.y0 && p.y < box.y1)) score += WEIGHT.connector;\n if (!best || score < best.score) best = { x: c.x, y: c.y, side: c.side, score };\n });\n return best!;\n}\n\n/** Points along a connector, for `connectors`: the same cubic edgePath draws (control points two-thirds of the way\n * from each end to the bowed midpoint `mid`, which edgePath returns). */\nexport function connectorSamples(a: Pt, mid: Pt, b: Pt, n = 16): Pt[] {\n const c1 = { x: a.x + (mid.x - a.x) * 0.66, y: a.y + (mid.y - a.y) * 0.66 }, c2 = { x: b.x + (mid.x - b.x) * 0.66, y: b.y + (mid.y - b.y) * 0.66 };\n return Array.from({ length: n + 1 }, (_, k) => {\n const t = k / n, u = 1 - t;\n return { x: u * u * u * a.x + 3 * u * u * t * c1.x + 3 * u * t * t * c2.x + t * t * t * b.x, y: u * u * u * a.y + 3 * u * u * t * c1.y + 3 * u * t * t * c2.y + t * t * t * b.y };\n });\n}\n","import type { VisualliDocument, VisualliLayer, FlatNode, MindMapConnection } from '../types/index.js';\nimport { fitView, fitViewInset, layerBounds, type FrameBox, type FrameInsets } from '../generated/geometry/interaction.js';\nimport { PILL, containerHull, pillScaled } from '../generated/geometry/container.js';\n\n// ── Connection helpers ────────────────────────────────────────────────────────\n\n/**\n * Returns all top-level connections that originate from the given layer.\n * A \"top-level connection\" links two nodes that both live in `layerId`.\n */\nexport function getConnectionsForLayer(\n doc: VisualliDocument,\n layerId: string,\n): MindMapConnection[] {\n const layer = doc.layers.get(layerId);\n if (!layer) return [];\n // Convert schema LayerConnection to simplified mindmap MindMapConnection\n return layer.connections.map(c => ({\n from: c.from,\n to: c.to,\n level: layer.level,\n label: c.data?.label,\n style: c.data?.style === 'dashed' ? 'dashed' : 'solid',\n } satisfies MindMapConnection));\n}\n\n/**\n * Given a node in the current layer, returns the child layer (if any) that the\n * node \"owns\" — i.e. the node is the entry-point into that child layer.\n */\nexport function getChildLayerForNode(\n doc: VisualliDocument,\n nodeId: string,\n currentLayerId: string,\n): VisualliLayer | null {\n // Walk all layers looking for one whose `parentNodeId` matches\n for (const [, layer] of doc.layers) {\n if (layer.parentLayerId === currentLayerId && layer.parentNodeId === nodeId) {\n return layer;\n }\n }\n return null;\n}\n\n/**\n * \n */\nexport function getLayerForNavigation(\n doc: VisualliDocument,\n nodeId: string,\n currentLayerId: string,\n): VisualliLayer | null {\n return getChildLayerForNode(doc, nodeId, currentLayerId);\n}\n\n// ── Fit to view ───────────────────────────────────────────────────────────────\n//\n// The design system's fit (geometry/interaction.ts → layerBounds / fitView): every\n// idea at its real size with room around it, and every container hull with room for\n// its name pill; never enlarging a layer beyond VIEW.fitMax.\n\nexport interface FitResult {\n centerX: number;\n centerY: number;\n zoomLevel: number;\n}\n\n/** A container as the fit sees it: its members and, when it has a name, the name's pill at 1x (`w` × `h`, the design\n * system's pillLayout: the host measures it with the real face). The hull widens for the pill and the framing leaves\n * room for it (containerHull, layerBounds). Without it the container is framed by its hull alone. */\nexport interface FitContainer { nodeIds: string[]; pill?: { w: number; h: number } | null }\n\n/** The box a layer is framed by: its ideas (their real sizes) and the hulls of its `containers`. */\nexport function layerFrame(nodes: ReadonlyArray<FlatNode>, containers: ReadonlyArray<FitContainer> = []): FrameBox {\n const byId = new Map(nodes.map((n) => [n.id, n]));\n const hulls: Array<FrameBox & { pillH?: number }> = [];\n for (const c of containers) {\n const hull = containerHull(c.nodeIds.flatMap((id) => { const n = byId.get(id); return n ? [{ x: n.x, y: n.y, rx: n.width / 2, ry: n.height / 2 }] : []; }), c.pill);\n if (hull) hulls.push(c.pill ? { ...hull, pillH: pillScaled(c.pill, PILL.maxGrow).h } : hull);\n }\n return layerBounds(nodes.map((n) => ({ x: n.x, y: n.y, rx: n.width / 2, ry: n.height / 2 })), hulls);\n}\n\n/** The zoom that fits a layer's ideas (and container hulls) into a canvas of `canvasWidth` × `canvasHeight`. */\nexport function calculateFitZoom(nodes: FlatNode[], canvasWidth: number, canvasHeight: number, containers: ReadonlyArray<FitContainer> = []): number {\n if (nodes.length === 0) return 1;\n return fitView(layerFrame(nodes, containers), canvasWidth, canvasHeight).scale;\n}\n\n/** The world point a fitted layer is centred on: the middle of its frame. */\nexport function calculateFitCenter(nodes: FlatNode[], containers: ReadonlyArray<FitContainer> = []): { x: number; y: number } {\n if (nodes.length === 0) return { x: 0, y: 0 };\n const f = layerFrame(nodes, containers);\n return { x: (f.x0 + f.x1) / 2, y: (f.y0 + f.y1) / 2 };\n}\n\n// ── Container helpers ────────────────────────────────────────────────────────\n\n// Inline the container shape here to avoid a circular import with KonvaContainerLayer.\nexport interface ContainerGroupInfo {\n id: string;\n label?: string;\n nodeIds: string[];\n level: number;\n}\n\n/**\n * Returns the container groups the given layer draws, normalising both the\n * nested-data format `{data:{label,formation}}` and the flat format `{label}`.\n */\nexport function getContainersForLayer(\n doc: VisualliDocument,\n layerId: string,\n): ContainerGroupInfo[] {\n const layer = doc.layers.get(layerId);\n if (!layer) return [];\n \n // Defensive: ensure containers is an array\n const containers = layer.containers ?? [];\n if (!Array.isArray(containers)) return [];\n \n // A container whose style is 'none' groups ideas without a hull or a name (the design system draws nothing for it).\n return containers.filter(c => c.data?.style !== 'none').map(c => {\n // Schema Container has nested data.label structure\n const label = c.data?.label ?? c.id;\n return { id: c.id, label, nodeIds: c.nodes, level: layer.level };\n });\n}\n\n/**\n * Fit to view: centre and zoom for a layer in one call (the design system's fitView). With `insets` (room the host's\n * chrome takes at each edge - a docked panel, a top bar, a composer), the canvas still fills its whole frame but the\n * layer fits the free area and sits centred in it (the design system's fitViewInset); the viewport centre returned is\n * the world point at the middle of the canvas, as the viewport store keeps it.\n */\nexport function calculateFitView(\n nodes: FlatNode[],\n canvasWidth: number,\n canvasHeight: number,\n containers: ReadonlyArray<FitContainer> = [],\n insets?: FrameInsets,\n): FitResult {\n if (nodes.length === 0) return { centerX: 0, centerY: 0, zoomLevel: 1 };\n if (!insets) {\n const { scale, center } = fitView(layerFrame(nodes, containers), canvasWidth, canvasHeight);\n return { centerX: center.x, centerY: center.y, zoomLevel: scale };\n }\n const { scale, center, screen } = fitViewInset(layerFrame(nodes, containers), canvasWidth, canvasHeight, insets);\n // screen = (world − centre) × scale + canvas / 2, so the frame's centre lands on `screen` (the free area's middle).\n return { centerX: center.x - (screen.x - canvasWidth / 2) / scale, centerY: center.y - (screen.y - canvasHeight / 2) / scale, zoomLevel: scale };\n}\n","import type { FlatNode, ViewportState } from '../types/index.js';\nimport { RBushSpatialIndex } from '../spatial/spatialIndex.js';\nimport { calculateViewportBounds } from '../viewport/viewportUtils.js';\nimport { nodeBounds } from './nodeGeometry.js';\n\nexport interface CullingOptions {\n nodes: FlatNode[];\n viewport: ViewportState;\n canvasWidth: number;\n canvasHeight: number;\n levelFilter?: number;\n skipCulling?: boolean;\n isDragging?: boolean;\n spatialIndex?: RBushSpatialIndex | null;\n spatialIndexThreshold?: number;\n}\n\nconst DEFAULT_SPATIAL_INDEX_THRESHOLD = 200;\n\n/**\n * True when anything drawn for the node touches the viewport. Nodes are drawn\n * CENTRED on (x, y) with rings and stroke around them, so the test uses the\n * node's real visual bounds (not a top-left rectangle).\n */\nexport function intersectsViewport(\n n: FlatNode,\n bounds: { minX: number; minY: number; maxX: number; maxY: number },\n): boolean {\n const b = nodeBounds(n);\n return b.maxX >= bounds.minX && b.minX <= bounds.maxX && b.maxY >= bounds.minY && b.minY <= bounds.maxY;\n}\n\n/**\n * Returns the subset of nodes currently visible in the viewport.\n * Framework-agnostic logic for culling and spatial indexing.\n */\nexport function getViewportVisibleNodes(options: CullingOptions): FlatNode[] {\n const {\n nodes,\n viewport,\n canvasWidth,\n canvasHeight,\n levelFilter,\n skipCulling = false,\n isDragging = false,\n spatialIndex,\n spatialIndexThreshold = DEFAULT_SPATIAL_INDEX_THRESHOLD,\n } = options;\n\n const filtered = levelFilter !== undefined\n ? nodes.filter(n => n.level === levelFilter)\n : nodes;\n\n if (filtered.length === 0) return [];\n\n // During transitions or drags show all nodes to avoid partial layer appearance\n if (skipCulling || isDragging) return filtered;\n\n const bounds = calculateViewportBounds(viewport, canvasWidth, canvasHeight);\n\n if (filtered.length < spatialIndexThreshold) {\n return filtered.filter(n => intersectsViewport(n, bounds));\n }\n\n if (spatialIndex) {\n const nodeIds = spatialIndex.query({\n minX: bounds.minX, minY: bounds.minY, maxX: bounds.maxX, maxY: bounds.maxY,\n });\n const idSet = new Set(nodeIds);\n return filtered.filter(n => idSet.has(n.id));\n }\n\n // Fallback to simple filter if no index provided but threshold exceeded\n return filtered.filter(n => intersectsViewport(n, bounds));\n}\n","// Generated from visualli.ai design-system/components/src/motion.ts — do not edit here.\n/* The canvas choreography — how a layer arrives, how you step inside and back out, how an idea answers hover.\n One source for every renderer: VisualMap drives its CSS animations from these values (as CSS variables and\n animation delays), and a canvas renderer (e.g. the spec SDK on Konva) can run the same timeline from its own loop.\n Times in ms, scales as factors, easings as cubic-bezier control points. No dependencies, so it can travel alone.\n The durations and easings equal the motion tokens (duration-*, ease-*, stagger-reveal); the build checks that. */\n\nexport type Bezier = readonly [number, number, number, number];\n\nexport const EASE = {\n /** ease-standard — UI and connector drawing. */ standard: [0.4, 0, 0.2, 1] as Bezier,\n /** ease-zoom — diving into and out of layers. */ zoom: [0.2, 0.8, 0.2, 1] as Bezier,\n /** ease-bloom — ideas arriving, with a little overshoot. */ bloom: [0.34, 1.4, 0.64, 1] as Bezier,\n};\n\nexport const MOTION = {\n /** A layer arrives: ideas bloom one by one in sibling order, center first, then connectors draw. */\n reveal: {\n /** duration-reveal: each idea's bloom. */ duration: 420,\n /** stagger-reveal: delay between consecutive ideas. */ stagger: 70,\n /** An idea starts at this scale… */ fromScale: 0.55,\n /** …and this fraction of the way from its place toward the layer's center. */ fromCenter: 0.5,\n ease: EASE.bloom,\n /** Settle time after the last bloom before the map is idle (interactive again). */ tail: 200,\n },\n /** Connectors of an arriving layer: they start once the ideas are mostly in. */\n connector: {\n /** Lead time before the first connector, on top of the ideas' stagger. */ lead: 240,\n /** Delay between consecutive connectors. */ stagger: 60,\n /** A solid connector draws from source to target; a dashed one fades in instead. */ draw: 500,\n /** The connector group's fade (duration-base). */ fade: 240,\n ease: EASE.standard,\n },\n /** Step inside: the current layer zooms toward the idea and fades; the inner layer then arrives (reveal). */\n dive: {\n /** The old layer's zoom, toward the idea's position. */ scale: 3.2,\n /** duration-zoom. */ duration: 500,\n /** It fades out after this delay, over `fade`. */ fadeDelay: 150, fade: 160,\n /** The layers swap (and the reveal starts) this long after the dive starts. */ swapAfter: 320,\n ease: EASE.zoom,\n },\n /** Back out (depth trail): the current layer shrinks toward the center and fades; the outer layer arrives. */\n surface: {\n scale: 0.6, duration: 220, fade: 200,\n swapAfter: 220,\n ease: EASE.zoom,\n },\n /** The arriving layer as a whole settles from slightly small. */\n settle: { fromScale: 0.94, duration: 260, ease: EASE.standard },\n /** Hover (pointer) or select: the idea lifts; its rings turn and grow a touch — a nudge, not a wobble. */\n hover: {\n lift: 2, ringRotate: -2, ringScale: 1.015,\n /** duration-base, for both the lift (ease-bloom) and the rings (ease-standard). */ duration: 240,\n liftEase: EASE.bloom, ringEase: EASE.standard,\n },\n /** Reduced motion, or Gradual reveal off: everything appears together with a short fade; dives become cross-fades. */\n reduced: { fade: 120 },\n /** Large layers. The stagger is written for a dozen ideas; a layer of hundreds would take minutes to arrive and\n * every frame of a bloom repaints the whole layer. Above `staggerSlots` ideas (and connectors), they share that many\n * slots, so a layer never takes longer to arrive than `staggerSlots` ideas would. Above `bloomMax` ideas the layer\n * fades in together (the reduced fade) and hover lifts snap instead of easing. */\n largeLayer: { staggerSlots: 30, bloomMax: 150 },\n} as const;\n\nexport type Point = { x: number; y: number };\n\n/** Delay before idea `i` (sibling order) starts to bloom. */\nexport function revealDelay(i: number): number { return i * MOTION.reveal.stagger; }\n\n/** Delay before connector `i` starts, in a layer of `nodeCount` ideas. */\nexport function connectorDelay(i: number, nodeCount: number): number {\n return MOTION.connector.lead + nodeCount * MOTION.reveal.stagger + i * MOTION.connector.stagger;\n}\n\n/** How long a layer's arrival takes, until the map is idle again. 0 with reduced motion. */\nexport function revealTotal(nodeCount: number, reduced = false): number {\n return reduced ? 0 : MOTION.reveal.duration + nodeCount * MOTION.reveal.stagger + MOTION.reveal.tail;\n}\n\n/** Where an idea starts its bloom, as an offset from its final position: part of the way toward the layer's center. */\nexport function bloomOffset(node: Point, center: Point): Point {\n const k = MOTION.reveal.fromCenter;\n return { x: (center.x - node.x) * k, y: (center.y - node.y) * k };\n}\n\n/** When the layers swap after Step inside ('in') or Back out ('out'). 0 with reduced motion (a cross-fade). */\nexport function swapDelay(dir: 'in' | 'out', reduced = false): number {\n return reduced ? 0 : dir === 'in' ? MOTION.dive.swapAfter : MOTION.surface.swapAfter;\n}\n\n/** The stagger slot of item `i` of `count` (ideas or connectors): its own index up to `staggerSlots`, then shared. */\nexport function revealSlot(i: number, count: number): number {\n const slots = Math.min(count, MOTION.largeLayer.staggerSlots);\n return count > slots ? Math.floor((i * slots) / count) : i;\n}\n\n/** Whether a layer of `nodeCount` ideas blooms in one by one (else it fades in together and hover lifts snap). */\nexport function layerBlooms(nodeCount: number): boolean { return nodeCount <= MOTION.largeLayer.bloomMax; }\n\n/** A layer's whole arrival, large layers included: when idea `i` and connector `i` start, and when the layer is idle. */\nexport function layerReveal(nodeCount: number, connectorCount: number, reduced = false) {\n const instant = reduced || !layerBlooms(nodeCount);\n const slots = Math.min(nodeCount, MOTION.largeLayer.staggerSlots);\n const edgeSlots = Math.min(connectorCount, MOTION.largeLayer.staggerSlots);\n return {\n /** Fades in together (reduced motion, Gradual reveal off, or a layer past `bloomMax`). */ instant,\n ideaDelay: (i: number) => (instant ? 0 : revealDelay(revealSlot(i, nodeCount))),\n connectorDelay: (i: number) => (instant ? 0 : connectorDelay(revealSlot(i, connectorCount), slots)),\n /** Until the map is idle again. */\n total: instant ? (reduced ? 0 : MOTION.reduced.fade) : Math.max(revealTotal(slots), edgeSlots ? connectorDelay(edgeSlots - 1, slots) + MOTION.connector.draw : 0),\n };\n}\n\n/** CSS form of an easing. */\nexport function cssEase(e: Bezier): string { return `cubic-bezier(${e.join(', ')})`; }\n\n/** Evaluate an easing at progress t (0–1), for renderers that animate in their own loop. */\nexport function ease(e: Bezier, t: number): number {\n const [x1, y1, x2, y2] = e;\n if (t <= 0) return 0; if (t >= 1) return 1;\n const bx = (u: number) => 3 * x1 * u * (1 - u) ** 2 + 3 * x2 * u * u * (1 - u) + u ** 3;\n const by = (u: number) => 3 * y1 * u * (1 - u) ** 2 + 3 * y2 * u * u * (1 - u) + u ** 3;\n let lo = 0, hi = 1, u = t;\n for (let k = 0; k < 24; k++) { u = (lo + hi) / 2; if (bx(u) < t) lo = u; else hi = u; }\n return by(u);\n}\n\n/** The CSS variables VisualMap sets on its root, so its stylesheet animates with exactly these values. */\nexport function motionVars(): Record<string, string> {\n const m = MOTION;\n return {\n '--vi-bloom-from': String(m.reveal.fromScale),\n '--vi-line-draw': `${m.connector.draw}ms`,\n '--vi-dive-scale': String(m.dive.scale), '--vi-dive-fade': `${m.dive.fade}ms`, '--vi-dive-fade-delay': `${m.dive.fadeDelay}ms`,\n '--vi-surface-scale': String(m.surface.scale), '--vi-surface-dur': `${m.surface.duration}ms`, '--vi-surface-fade': `${m.surface.fade}ms`,\n '--vi-settle-from': String(m.settle.fromScale), '--vi-settle-dur': `${m.settle.duration}ms`,\n '--vi-reduced-fade': `${m.reduced.fade}ms`,\n '--vi-lift': `${m.hover.lift}px`, '--vi-ring-turn': `${m.hover.ringRotate}deg`, '--vi-ring-grow': String(m.hover.ringScale),\n };\n}\n","// Generated from visualli.ai design-system/components/src/detail.ts — do not edit here.\n/* Level of detail: what an idea draws at the size it's seen. Far-out views of large maps show ideas as specks; the\n rings, label and shadow of an idea a few pixels wide can't be seen, and drawing them makes large maps slow. Every\n renderer follows the same thresholds, so a map simplifies alike everywhere. Sizes are on-screen CSS pixels of the\n idea's width. No dependencies, so it can travel alone. */\n\nexport const DETAIL = {\n /** Below this on-screen width an idea draws only its body: no rings, label or shadow. */ bodyOnlyBelow: 24,\n /** Below this it may be drawn as a plain filled speck in its topic fill (no outline) — indistinguishable at this size. */ speckBelow: 12,\n /** Above this many ideas in view, idea shadows are skipped (the costliest effect to draw). */ shadowsMaxVisible: 150,\n} as const;\n\nexport type IdeaDetail = 'full' | 'body' | 'speck';\n\n/** What an idea of this on-screen width draws. A selected, focused or hovered idea always draws in full. */\nexport function ideaDetail(screenWidth: number, emphasised = false): IdeaDetail {\n if (emphasised || screenWidth >= DETAIL.bodyOnlyBelow) return 'full';\n return screenWidth < DETAIL.speckBelow ? 'speck' : 'body';\n}\n\n/** Whether idea shadows are drawn with this many ideas in view. */\nexport function shadowsShown(visibleIdeas: number): boolean { return visibleIdeas <= DETAIL.shadowsMaxVisible; }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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