@seanyeh77/ui 0.48.1 → 0.48.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"LayerGraph.js","names":["phLock","phTag"],"sources":["../../../src/components/LayerGraph/LayerGraph.tsx"],"sourcesContent":["import * as React from 'react';\nimport { GraphLegend, type GraphLegendItem } from '../Graph/Graph';\nimport { SegmentedControl } from '../SegmentedControl/SegmentedControl';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Switch } from '../Switch/Switch';\nimport { tr } from '../../i18n';\nimport { format } from '../../format';\nimport { cx, monoNums, resizeObserver } from '../../internal/util';\nimport { ScrollHint, useScrollHint } from '../../internal/scrollHint';\nimport { codeSpans } from '../../internal/codeSpans';\nimport { devWarn } from '../../internal/dev';\nimport { announce } from '../../announce';\nimport { DRAG_MIN, nextPreset } from '../../internal/clickSteps';\nimport { useStored } from '../../internal/stored';\nimport { Icon } from '../../icons/Icon';\nimport { includeIcons } from '../../icons/store';\nimport phLock from '../../icons/ph/lock';\nimport phTag from '../../icons/ph/tag';\n\nincludeIcons(phLock, phTag);\n\nexport interface LayerGraphNode {\n /** Unique id: edges, value and onChange use it. */\n id: string;\n /** Shown on the box. Default: the id. */\n name?: string;\n /** The name is code (a path, a file, a module): Geist Mono. Default: the text font, for names in words (「被追蹤的程式」). */\n code?: boolean;\n /** 0 is the top layer. */\n layer?: number;\n /** How big it is (functions, files, endpoints): drawn as the size bar. */\n size?: number;\n /** Used by most others: not drawn as a layer; shown as a small box under the diagram with how often it is used.\n * Selectable like the other boxes (same selected and onSelect): the boxes that use it show 「使用 N 次」. */\n shared?: boolean;\n /** Outside the repository (a traced program, a library): drawn above every layer with a dashed outline and\n * 「外部」 (externalLabel) under the name. Not in any layer and no size bar; its lines, selection and list entry\n * work like any box's. */\n external?: boolean;\n /** A short tag beside the name (「可修改」「受保護」): on the same line, never cut; the name is cut first. In the list\n * and in what a screen reader says too. Keep it to a few characters. */\n tag?: string;\n /** warning: the tag in the warning colors with a lock, for a box that must not be changed. Default neutral. */\n tagTone?: 'neutral' | 'warning';\n}\n\nexport interface LayerGraphEdge {\n /** The id of the box the line starts at. */\n from: string;\n /** The id of the box the arrow points at. */\n to: string;\n /** How often: sets the line width. */\n count?: number;\n /** Inferred by a rule rather than known: dashed and labelled. */\n inferred?: boolean;\n /** Declared by the project, e.g. in a config file, rather than seen by a compiler: long-short dashes and labelled\n * like an inferred edge, but with a basis. Wins over `inferred`. */\n declared?: boolean;\n /** Label of an inferred edge; `backticks` and numbers are in Geist Mono. */\n label?: string;\n /** Names the edge for selectedEdge and onSelectEdge. Default `${from}->${to}`. */\n id?: string;\n}\n\n/** Every text LayerGraph writes, for your domain's words or another language. Pass only the ones to change. */\nexport interface LayerGraphLabels {\n /** Text under a box's size bar: a string with {n}, or a function of the size for words that change with the number\n * (`(n) => n === 1 ? '1 function' : `${n} functions``). Default 「{n} 個項目」. */\n size: string | ((n: number) => string);\n /** A selected edge's count: a string with {n}, or a function of the count. Default 「{n} 次」 (English 「1 call」). */\n count: string | ((n: number) => string);\n /** Under the name of an external box, and after it in the list. Default 「repo 外」. */\n external: string;\n /** Heading of the shared items under the diagram. Default 「共用項目」. */\n shared: string;\n /** A shared item's line; {a} is how many items use it, {b} the total count. Default 「{a} 個項目使用,共 {b} 次」. */\n sharedMeta: string;\n /** On a box that uses the selected shared item; {n} is how often. Default 「使用 {n} 次」. */\n use: string;\n /** Label of inferred edges without their own, and their legend entry. Default 「推測」 (legend 「推測的關係」). */\n inferred: string;\n /** Explains inferred edges in the legend (a Term). */\n inferredText: string;\n /** The word for declared edges, after a label in the list. Default 「宣告」. */\n declared: string;\n /** The legend entry for declared edges. Default 「專案宣告的關係」. */\n declaredLegend: string;\n /** Explains declared edges in the legend (a Term), e.g. which file declares them. */\n declaredText: string;\n /** Heading of the boxes in the list view. Default 「項目」. */\n listNodes: string;\n /** Heading of the lines in the list view. Default 「關係」. */\n listEdges: string;\n}\n\nexport interface LayerGraphProps {\n /** The boxes. */\n nodes: LayerGraphNode[];\n /** The lines between boxes (by id). */\n edges: LayerGraphEdge[];\n /** The selected box's id (controlled); null for none. */\n value?: string | null;\n /** A box picked (its id) or picked again (null). Selecting a box dims everything unrelated and turns its lines\n * accent; it clears the selected edge. */\n onChange?: (id: string | null) => void;\n /** @deprecated use value. */\n selected?: string | null;\n /** @deprecated use onChange. */\n onSelect?: (id: string | null) => void;\n /** The selected edge's id (controlled, like selected). */\n selectedEdge?: string | null;\n /** Makes edges selectable: a click on a line or its label, Enter or Space. null when it is clicked again, on a click on\n * the empty diagram or on Escape. Clears the selected box. Without it, edges cannot be clicked. */\n onSelectEdge?: (id: string | null) => void;\n /** Labels on lines at first: 'shown' (default) always; 'hover' only while the pointer is on the line or its label, the\n * line has keyboard focus, or it is selected or belongs to the selected box. The diagram keeps the room for every\n * label. People switch with the tag button next to 「圖/清單」; their choice is remembered (localStorage). */\n edgeLabels?: 'shown' | 'hover';\n /** The control that shows or hides line labels, shown when the diagram has labelled lines. Default (true or\n * 'switch'): a Switch with the text 「線上文字」, on while labels show. 'icon': the tag icon button with a fixed name\n * and aria-pressed, for a tight toolbar. false: none. */\n labelToggle?: boolean | 'switch' | 'icon';\n /** Box width in px. Default 200. */\n nodeWidth?: number;\n /** Your words for every text LayerGraph writes: { size: '{n} 個函式', count: '呼叫 {n} 次', … }. */\n labels?: Partial<LayerGraphLabels>;\n /** @deprecated use labels.size. */\n sizeLabel?: string | ((n: number) => string);\n /** @deprecated use labels.count. */\n countLabel?: string | ((n: number) => string);\n /** @deprecated use labels.external. */\n externalLabel?: string;\n /** @deprecated use labels.shared. */\n sharedLabel?: string;\n /** @deprecated use labels.sharedMeta. */\n sharedMeta?: string;\n /** @deprecated use labels.use. */\n useLabel?: string;\n /** @deprecated use labels.inferred. */\n inferredLabel?: string;\n /** @deprecated use labels.inferredText. */\n inferredText?: string;\n /** @deprecated use labels.declared. */\n declaredLabel?: string;\n /** @deprecated use labels.declaredLegend. */\n declaredLegend?: string;\n /** @deprecated use labels.declaredText. */\n declaredText?: string;\n /** false hides the legend. By default it lists only the kinds of line the diagram has. */\n legend?: boolean;\n /** Your own legend entries instead of the kinds of line the diagram has. */\n legendItems?: GraphLegendItem[];\n /** Default 「架構圖」. */\n label?: string;\n /** The 「圖/清單」 switch above the diagram; the list shows every box and line as text, also for screen readers.\n * false hides the switch. */\n listView?: boolean;\n /** HC: a handle under the diagram to drag its height, like SplitPane's divider. Down: the layers move apart (the gaps\n * between them grow), so lines and their labels have more room. Up past the drawn height: the diagram scrolls up and\n * down inside a shorter frame. ↑↓ 16 px, Enter or a double-click goes back. Default false. */\n resizable?: boolean;\n /** Remembers the reader's choices in localStorage under this name: the dragged height (ui-lg-height:<name>) and the\n * line-label switch (ui-lg-labels:<name>); it also names the diagram's sideways scroll, kept while the page lives.\n * Without it nothing is stored. */\n storageKey?: string;\n /** @deprecated use storageKey. */\n heightKey?: string;\n /** Controls of the page on the same row as 「圖/清單」, at its left, such as the page's own 「依元件/依檔案」 Tabs,\n * so two switches do not sit on two rows. */\n toolbar?: React.ReactNode;\n /** @deprecated use labels.listNodes and labels.listEdges. */\n listLabels?: { nodes?: string; edges?: string };\n /** @deprecated use storageKey. */\n scrollKey?: string;\n /** Extra class on the root element. */\n className?: string;\n}\n\n// The props each old name moved to (labels, value, onChange, storageKey): read through one object inside.\nconst OLD_LABELS = {\n sizeLabel: 'size',\n countLabel: 'count',\n externalLabel: 'external',\n sharedLabel: 'shared',\n sharedMeta: 'sharedMeta',\n useLabel: 'use',\n inferredLabel: 'inferred',\n inferredText: 'inferredText',\n declaredLabel: 'declared',\n declaredLegend: 'declaredLegend',\n declaredText: 'declaredText',\n} as const;\n\n/** The props with the new names folded into the ones the drawing reads: labels.* into the text props, value and\n * onChange into selected and onSelect, storageKey into the storage names (nothing stored without one). */\nfunction resolveProps(q: LayerGraphProps): LayerGraphProps {\n const old = (Object.keys(OLD_LABELS) as (keyof typeof OLD_LABELS)[]).filter((k) => q[k] !== undefined);\n devWarn(\n old.length > 0 || q.listLabels !== undefined,\n 'LayerGraph',\n `${[...old, ...(q.listLabels ? ['listLabels'] : [])].join(', ')} moved into labels: pass labels={{ ${old.map((k) => OLD_LABELS[k] + ': …').join(', ')}${q.listLabels ? (old.length ? ', ' : '') + 'listNodes: …, listEdges: …' : ''} }}. The old props work until the next release.`,\n );\n devWarn(q.selected !== undefined || q.onSelect !== undefined, 'LayerGraph', 'selected and onSelect are renamed value and onChange; pass those instead.');\n devWarn(q.heightKey !== undefined || q.scrollKey !== undefined, 'LayerGraph', 'heightKey and scrollKey are one prop now: pass storageKey.');\n const l = q.labels ?? {};\n const key = q.storageKey ?? q.heightKey ?? q.scrollKey;\n return {\n ...q,\n selected: q.value !== undefined ? q.value : q.selected,\n onSelect: q.onChange ?? q.onSelect,\n sizeLabel: l.size ?? q.sizeLabel,\n countLabel: l.count ?? q.countLabel,\n externalLabel: l.external ?? q.externalLabel,\n sharedLabel: l.shared ?? q.sharedLabel,\n sharedMeta: l.sharedMeta ?? q.sharedMeta,\n useLabel: l.use ?? q.useLabel,\n inferredLabel: l.inferred ?? q.inferredLabel,\n inferredText: l.inferredText ?? q.inferredText,\n declaredLabel: l.declared ?? q.declaredLabel,\n declaredLegend: l.declaredLegend ?? q.declaredLegend,\n declaredText: l.declaredText ?? q.declaredText,\n listLabels: { nodes: l.listNodes ?? q.listLabels?.nodes, edges: l.listEdges ?? q.listLabels?.edges },\n heightKey: key,\n scrollKey: key,\n };\n}\n\n// Sideways scroll of each diagram, kept while the page lives: by storageKey, or by a short hash of the box ids. At most\n// MEMORY diagrams, the oldest forgotten first, so a page that draws many diagrams does not keep growing it.\nconst scrollMemory = new Map<string, number>();\nconst MEMORY = 50;\nfunction remember(key: string, x: number) {\n scrollMemory.delete(key);\n scrollMemory.set(key, x);\n if (scrollMemory.size > MEMORY) scrollMemory.delete(scrollMemory.keys().next().value as string);\n}\n/** A short key for a list of ids (FNV-1a, 32 bit, plus the count): the same diagram gets the same key. */\nexport function idsKey(ids: string[]): string {\n let h = 0x811c9dc5;\n for (const id of ids) {\n for (let i = 0; i < id.length; i++) h = Math.imul(h ^ id.charCodeAt(i), 0x01000193);\n h = Math.imul(h ^ 0x7c, 0x01000193);\n }\n return ids.length + ':' + (h >>> 0).toString(36);\n}\n\n// Label width before layout: text in the sans font, `code` and numbers in the mono font, as labelParts draws them.\nlet measure: CanvasRenderingContext2D | null | undefined;\nconst NUM = /(\\d[\\d,.]*)/;\n\n/** A label in pieces: `code` (read the same way as CodeText, by codeSpans) and numbers are mono, the rest sans. */\nfunction labelPieces(text: string): { mono: boolean; text: string }[] {\n return codeSpans(text).flatMap((s) =>\n s.code\n ? [{ mono: true, text: s.text }]\n : s.text\n .split(NUM)\n .map((t, i) => ({ mono: i % 2 === 1, text: t }))\n .filter((p) => p.text !== ''),\n );\n}\n\n/** A label with a number: {n} in a string, or a function of the number; the number comes back as \\u0001 (monoNums). */\nfunction withNum(label: string | ((n: number) => string) | undefined, n: number, fallback: (n: number) => string): string {\n if (typeof label === 'function') {\n const t = label(n);\n for (const s of [format.number(n), String(n)]) if (t.includes(s)) return t.replace(s, '\\u0001');\n return t;\n }\n return (label ?? fallback(n)).replace('{n}', '\\u0001');\n}\n\n/** The default for one (「1 call」) where the language has its own word for it, else the {n} form. */\nfunction byCount(n: number, one: string, many: string): string {\n const t = n === 1 ? tr(one) : '';\n return t && t !== one ? t : tr(many);\n}\n\n/** A box reached with the keyboard while partly scrolled out of the diagram's frame (phones): scroll it fully into view,\n * with its focus outline (scroll-margin in styles.css). The browser scrolls only boxes that are wholly out of view. */\nfunction showWhole(e: React.FocusEvent<HTMLElement>) {\n if (e.currentTarget.matches(':focus-visible')) e.currentTarget.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });\n}\n\n/** A canvas to measure text on, or null where there is none (jsdom without a canvas package): widths are then estimated. */\nfunction canvas2d(): CanvasRenderingContext2D | null {\n return typeof CanvasRenderingContext2D === 'function' ? document.createElement('canvas').getContext('2d') : null;\n}\n\n/** The width of text in a font (`600 13px` and mono or sans), measured on a canvas. */\nfunction textWidth(text: string, size: number, code: boolean): number {\n if (measure === undefined) measure = canvas2d();\n const c = measure;\n if (!c) return text.length * size * 0.6;\n const cs = getComputedStyle(document.documentElement);\n c.font = `600 ${size}px ` + ((code ? cs.getPropertyValue('--font-mono') : cs.getPropertyValue('--font-sans')) || 'sans-serif');\n return c.measureText(text).width;\n}\n\n// T: a tag on the name's line leaves the name at least this many characters; fewer, and every tag of the diagram goes\n// on its own line under the name.\nconst TAG_KEEP = 8;\n\n// HC: the shortest frame a dragged diagram keeps (px), and the most each gap between layers grows (px).\nconst MIN_FRAME = 160;\nconst MAX_EXTRA = 200;\n\n/** HC: the bar under the diagram: drag it, ↑↓ 16 px, Enter or a double-click back to the drawn height. A click without\n * dragging (WCAG 2.5.7) steps through the shortest frame, the drawn height and the widest gaps. */\nfunction HeightHandle(p: {\n value: number;\n min: number;\n max: number;\n start: () => number;\n /** The change from the drawn height (px) that each click step goes to, smallest first. */\n presets: number[];\n /** Sets the change from the drawn height (px) of a click step. */\n onStep: (d: number) => void;\n onDrag: (d: number) => void;\n onKey: (step: number) => void;\n onReset: () => void;\n}) {\n const [dragging, setDragging] = React.useState(false);\n const from = React.useRef<{ y: number; d: number; moved: boolean } | null>(null);\n return (\n <div\n className={cx('ui-lg-resize', dragging && 'is-dragging')}\n aria-description={tr('拖曳或按 ↑ ↓ 調整;按一下切換預設高度,按 Enter 還原')}\n role=\"separator\"\n aria-orientation=\"horizontal\"\n aria-label={tr('調整架構圖高度')}\n aria-valuenow={p.value}\n aria-valuemin={p.min}\n aria-valuemax={p.max}\n aria-valuetext={tr('{n} px', { n: p.value })}\n tabIndex={0}\n onPointerDown={(e) => {\n if (e.button !== 0) return;\n e.preventDefault();\n e.currentTarget.setPointerCapture?.(e.pointerId);\n from.current = { y: e.clientY, d: p.start(), moved: false };\n setDragging(true);\n }}\n onPointerMove={(e) => {\n const f = from.current;\n if (!f || (!f.moved && Math.abs(e.clientY - f.y) < DRAG_MIN)) return;\n f.moved = true;\n p.onDrag(f.d + e.clientY - f.y);\n }}\n onPointerUp={() => {\n const f = from.current;\n from.current = null;\n setDragging(false);\n if (f && !f.moved) p.onStep(nextPreset(f.d, p.presets));\n }}\n onPointerCancel={() => {\n from.current = null;\n setDragging(false);\n }}\n onDoubleClick={p.onReset}\n onKeyDown={(e) => {\n if (e.altKey || e.metaKey || e.ctrlKey) return;\n if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n e.preventDefault();\n p.onKey(e.key === 'ArrowUp' ? -16 : 16);\n } else if (e.key === 'Enter') {\n e.preventDefault();\n p.onReset();\n }\n }}\n >\n <span className=\"ui-lg-resize-grip\" aria-hidden=\"true\">\n <i />\n <i />\n <i />\n </span>\n </div>\n );\n}\n\nfunction labelWidth(text: string): number {\n const parts = labelPieces(text);\n if (measure === undefined) measure = canvas2d();\n const c = measure;\n if (!c) return text.length * 9;\n const cs = getComputedStyle(document.documentElement);\n const sans = cs.getPropertyValue('--font-sans') || 'sans-serif';\n const mono = cs.getPropertyValue('--font-mono') || 'monospace';\n return parts.reduce((w, p) => {\n c.font = '600 12px ' + (p.mono ? mono : sans);\n return w + c.measureText(p.text).width;\n }, 0);\n}\n\n// A label of a line up that does not fit on one line: taller gaps, GROW px at a time, up to GROW_MAX px more.\n// The line-label button keeps its choice in localStorage under this prefix and the diagram's key.\nconst LABELS_KEY = 'ui-lg-labels:';\nconst parseOnOff = (raw: string) => {\n if (raw !== '1' && raw !== '0') throw new Error('not a stored choice');\n return raw === '1';\n};\nconst parseHeight = (raw: string) => {\n const v = Number(raw);\n if (!Number.isFinite(v)) throw new Error('not a stored height');\n return v;\n};\nconst GROW = 24;\nconst GROW_MAX = 144;\n\n/** The label on 1 line, then wrapped onto 2, 3 and 4 lines as evenly as it goes. Breaks between Chinese characters\n * and at spaces; never inside `code`, a word or a number, between a number and the word after it, before a closing\n * mark or after an opening one. */\nfunction wraps(text: string): string[][] {\n const atoms: string[] = [];\n for (const t of text.match(/`[^`]+`|[A-Za-z0-9_./:#@-]+|\\s+|[\\s\\S]/gu) ?? []) {\n const prev = atoms[atoms.length - 1];\n // A number keeps the word after it (「3 次」).\n const unit = /\\d\\s*$/.test(prev ?? '') && !/^[A-Za-z0-9_]/.test(t);\n if (prev != null && (unit || /^[)」』、,。:;!?)\\],;!?]/.test(t) || /[(「『([]$/.test(prev))) atoms[atoms.length - 1] = prev + t;\n else atoms.push(t);\n }\n const fill = (max: number) => {\n const lines: string[] = [];\n let cur = '';\n for (const a of atoms) {\n if (/^\\s+$/.test(a)) {\n if (cur) cur += a;\n continue;\n }\n if (cur && labelWidth(cur.trimEnd() + a) > max) {\n lines.push(cur.trimEnd());\n cur = a;\n } else cur += a;\n }\n if (cur.trim()) lines.push(cur.trimEnd());\n return lines;\n };\n const full = labelWidth(text);\n const out: string[][] = [[text]];\n for (let n = 2; n <= 4; n++) {\n // The narrowest width that still needs no more than n lines.\n let lo = Math.max(...atoms.filter((a) => a.trim()).map(labelWidth)) - 1;\n let hi = full;\n while (hi - lo > 1) {\n const mid = (lo + hi) / 2;\n if (fill(mid).length <= n) hi = mid;\n else lo = mid;\n }\n const lines = fill(hi);\n if (lines.length > out[out.length - 1].length) out.push(lines);\n }\n return out;\n}\n\nfunction labelParts(text: string): React.ReactNode[] {\n return labelPieces(text).map((p, i) =>\n p.mono ? (\n <span key={i} className=\"ui-lg-code\">\n {p.text}\n </span>\n ) : (\n p.text\n ),\n );\n}\n\ntype Pt = [number, number];\n\n/** Rounded orthogonal path through the points. */\nfunction route(pts: Pt[], R: number): string {\n let d = `M${pts[0][0]} ${pts[0][1]}`;\n for (let i = 1; i < pts.length - 1; i++) {\n const [a, b, c] = [pts[i - 1], pts[i], pts[i + 1]];\n const r = Math.min(R, Math.abs(b[0] - a[0] + b[1] - a[1]) / 2, Math.abs(c[0] - b[0] + c[1] - b[1]) / 2);\n const ux = Math.sign(b[0] - a[0]);\n const uy = Math.sign(b[1] - a[1]);\n const vx = Math.sign(c[0] - b[0]);\n const vy = Math.sign(c[1] - b[1]);\n d += ` L${b[0] - ux * r} ${b[1] - uy * r} Q${b[0]} ${b[1]} ${b[0] + vx * r} ${b[1] + vy * r}`;\n }\n const z = pts[pts.length - 1];\n return `${d} L${z[0]} ${z[1]}`;\n}\n\n/** Drops repeated points and points in the middle of a straight run. */\nconst clean = (pts: Pt[]): Pt[] =>\n pts\n .filter((q, i) => {\n const o = pts[i - 1];\n return !o || o[0] !== q[0] || o[1] !== q[1];\n })\n .filter((q, i, arr) => {\n const a = arr[i - 1];\n const c = arr[i + 1];\n return !a || !c || !((a[0] === q[0] && q[0] === c[0]) || (a[1] === q[1] && q[1] === c[1]));\n });\n\n/** Architecture as layers of boxes with arrows. Line width shows how often; inferred relations are dashed and labelled;\n * shared items are listed under the diagram instead of drawn. Wider than its box: the boxes narrow (down to 120 px),\n * then the whole diagram scales down (to 0.75 at least); past that it scrolls sideways at full width (PM, WA). */\nexport function LayerGraph(props: LayerGraphProps) {\n const p = resolveProps(props);\n // PM: the width of the box the diagram sits in, and the fit worked out for that width.\n const [avail, setAvail] = React.useState(0);\n const [fit, setFit] = React.useState<{ at: number; nw: number; col: number; scale: number; full?: boolean } | null>(null);\n const fitted = fit && fit.at === avail ? fit : null;\n const NW = fitted?.nw ?? (p.nodeWidth || 200);\n const GAP = 56;\n // HC: the dragged height, in screen px from the drawn one: above 0 spreads the layers apart, below 0 makes a\n // shorter frame the diagram scrolls in.\n // 0 on the server and the first browser render, then the stored height (heightKey).\n const [dh, setDh] = useStored(p.resizable && p.heightKey ? 'ui-lg-height:' + p.heightKey : undefined, parseHeight, 0, (v) => String(Math.round(v)));\n // Space added between boxes, 24 px at a time (up to 5 times), while a label still has to cover a line.\n // Kept per diagram and per width: other boxes or lines, or a resized box, start again from no added space.\n const spreadKey = avail + '#' + p.nodes.map((n) => n.id).join('|') + '#' + p.edges.map((e) => e.from + '>' + e.to + ':' + (e.label ?? '')).join('|');\n const [spreadAt, setSpread] = React.useState({ key: '', n: 0 });\n const spread = spreadAt.key === spreadKey ? spreadAt.n : 0;\n const COL = (fitted?.col ?? 40) + spread * 24;\n const scale = fitted?.scale ?? 1;\n const PAD = 16;\n const all = p.nodes;\n const sel = p.selected ?? null;\n devWarn(() => all.some((n) => n.external && n.shared), 'LayerGraph', 'a node is both external and shared; it is drawn as shared. Keep one of the two.');\n // External boxes have no size: they are not part of the code being measured.\n const sizeOf = (n: LayerGraphNode) => (n.external && !n.shared ? undefined : n.size);\n const sharedIds = new Set(all.filter((n) => n.shared).map((n) => n.id));\n const main = all.filter((n) => !n.shared);\n // T (option 1): beside the name, a tag would cut some name to fewer than TAG_KEEP characters at this box width: every\n // tag moves to its own line under the name and the boxes grow from 60 to 76 px, so all boxes stay the same height.\n const tagLine = main.some((n) => {\n if (!n.tag) return false;\n const name = n.name || n.id;\n const tagW = textWidth(n.tag, 12, false) + 12 + (n.tagTone === 'warning' ? 15 : 0);\n const room = NW - (n.external ? 24 : 28) - 6 - tagW;\n return room < textWidth(name.slice(0, TAG_KEEP), 13, !!n.code) + (name.length > TAG_KEEP ? 1 : 0);\n });\n const NH = tagLine ? 76 : 60;\n const shared = all.filter((n) => n.shared);\n const edges = p.edges.filter((e) => !sharedIds.has(e.from) && !sharedIds.has(e.to));\n // Lines with a label of their own and no count: inferred, or declared by the project (DC).\n const lab = (e: LayerGraphEdge) => !!(e.inferred || e.declared);\n const byLayer = new Map<number, LayerGraphNode[]>();\n // External boxes form a row of their own above every layer; their lines then route like any other.\n const EXTERNAL = Number.NEGATIVE_INFINITY;\n for (const n of main) {\n const l = n.external ? EXTERNAL : n.layer || 0;\n byLayer.set(l, [...(byLayer.get(l) ?? []), n]);\n }\n const layers = [...byLayer.keys()].sort((a, b) => a - b);\n const cols = Math.max(1, ...layers.map((l) => byLayer.get(l)?.length ?? 0));\n let W = PAD * 2 + cols * NW + (cols - 1) * COL;\n // The gap under each layer: GAP, or more where the label of a line up needs the room (see the placement below).\n // HC: dragged down, the extra height is shared by the gaps between layers (at most 200 px more each).\n const between = Math.max(0, layers.length - 1);\n const extra = p.resizable && dh > 0 && between ? Math.min(MAX_EXTRA, dh / scale / between) : 0;\n const gaps = layers.map((_, k) => GAP + (k < between ? extra : 0));\n let H = 0;\n const pos: Record<string, { x: number; y: number }> = {};\n const layerIndex: Record<string, number> = {};\n layers.forEach((l, k) => {\n const row = byLayer.get(l) ?? [];\n const off = (W - (row.length * NW + (row.length - 1) * COL)) / 2;\n row.forEach((n, i) => {\n pos[n.id] = { x: off + i * (NW + COL), y: 0 };\n layerIndex[n.id] = k;\n });\n });\n const rowTop = (k: number) => PAD + k * NH + gaps.slice(0, k).reduce((a, b) => a + b, 0);\n // An external box alone in its row keeps its full width when the others narrow (PM), centred where it was, so its\n // name is not cut (「被追蹤的程式」).\n const extRow = byLayer.get(EXTERNAL) ?? [];\n const extW = Math.max(NW, Math.min(p.nodeWidth || 200, W - PAD));\n const boxOf = (id: string) => {\n const wide = extRow.length === 1 && extRow[0].id === id ? extW : NW;\n return { x: pos[id].x + (NW - wide) / 2, w: wide };\n };\n const placeRows = () => {\n for (const id in pos) pos[id].y = rowTop(layerIndex[id]);\n H = rowTop(layers.length - 1) + NH + PAD + (flatRow[layers.length - 1]?.length ? FLAT_ROOM : 0);\n };\n const maxSize = Math.max(1, ...main.map((n) => sizeOf(n) || 0));\n const maxCount = Math.max(1, ...edges.map((e) => e.count || 0));\n // A line to a higher layer (a data channel back up): it leaves the source's right side, runs up a lane along the\n // diagram's right edge and enters the target's right side. The diagram widens on the right for the lanes and labels.\n const isUp = (e: LayerGraphEdge) => !!pos[e.from] && !!pos[e.to] && layerIndex[e.to] < layerIndex[e.from];\n // A line between two boxes of one layer: out of the source's bottom, across the gap below the row, up into the\n // target's bottom (it used to be drawn as a line down and climbed through the target box).\n const isFlat = (e: LayerGraphEdge) => !!pos[e.from] && !!pos[e.to] && e.from !== e.to && layerIndex[e.to] === layerIndex[e.from];\n const flatIn: Record<string, LayerGraphEdge[]> = {};\n const flatRow: Record<number, LayerGraphEdge[]> = {};\n const outs: Record<string, LayerGraphEdge[]> = {};\n const ins: Record<string, LayerGraphEdge[]> = {};\n const upOut: Record<string, LayerGraphEdge[]> = {};\n const upIn: Record<string, LayerGraphEdge[]> = {};\n for (const e of edges) {\n if (!pos[e.from] || !pos[e.to]) continue;\n if (isUp(e)) {\n (upOut[e.from] ??= []).push(e);\n (upIn[e.to] ??= []).push(e);\n continue;\n }\n (outs[e.from] ??= []).push(e);\n if (isFlat(e)) {\n (flatIn[e.to] ??= []).push(e);\n (flatRow[layerIndex[e.from]] ??= []).push(e);\n continue;\n }\n (ins[e.to] ??= []).push(e);\n }\n // The last row's flat lines need room under it; others use the gap below their row.\n const FLAT_ROOM = 20 + 10 * Math.max(0, (flatRow[layers.length - 1]?.length ?? 0) - 1);\n const ups = edges.filter(isUp);\n const rowOf = (id: string) => byLayer.get(layers[layerIndex[id]]) ?? [];\n const rightmost = (id: string) => rowOf(id)[rowOf(id).length - 1]?.id === id;\n const leftmost = (id: string) => rowOf(id)[0]?.id === id;\n // The lane is on the side where the target is the outermost box, so the line can enter its side; the right one\n // when both or neither (then it enters from below).\n const onLeft = (e: LayerGraphEdge) => !rightmost(e.to) && leftmost(e.to);\n const upsL = ups.filter(onLeft);\n const upsR = ups.filter((e) => !onLeft(e));\n const LANE = 20;\n const LANE_STEP = 12;\n for (const k in outs) outs[k].sort((a, b) => pos[a.to].x - pos[b.to].x);\n for (const k in ins) ins[k].sort((a, b) => pos[a.from].x - pos[b.from].x);\n const edgeId = (e: LayerGraphEdge) => e.id ?? `${e.from}->${e.to}`;\n const pickEdge = p.onSelectEdge;\n // edgeLabels on the server and the first browser render, then the reader's stored choice. Remembered only with\n // storageKey: without one nothing is read or written.\n const [labelsOn, setLabelsOn] = useStored(p.scrollKey ? LABELS_KEY + p.scrollKey : undefined, parseOnOff, p.edgeLabels !== 'hover', (v) => (v ? '1' : '0'));\n const peek = !labelsOn;\n const switchLabels = () => setLabelsOn(!labelsOn);\n // The hovered line: every part of it (line, label, number) gets is-hl straight in the DOM, so a hover never renders\n // the diagram again or reruns its routing. Put back after a render (React rewrites className).\n const canvasRef = React.useRef<HTMLDivElement>(null);\n const hoverRef = React.useRef<string | null>(null);\n const paintHover = React.useCallback(() => {\n const root = canvasRef.current;\n if (!root) return;\n for (const el of root.querySelectorAll<Element>('[data-hl]')) el.classList.toggle('is-hl', el.getAttribute('data-hl') === hoverRef.current);\n }, []);\n const setHover = React.useCallback(\n (id: string | null) => {\n if (hoverRef.current === id) return;\n hoverRef.current = id;\n paintHover();\n },\n [paintHover],\n );\n React.useLayoutEffect(paintHover);\n // Wider than its box: a fade on the right while more is to the right, and a 「左右滑動」 hint until the first scroll.\n const { ref: scrollRef, more: scrollMore, overflows, scrolled, onScroll } = useScrollHint();\n const uid = React.useId().replace(/:/g, '');\n const [view, setView] = React.useState<'graph' | 'list'>('graph');\n const memKey = p.scrollKey ?? idsKey(all.map((n) => n.id));\n // Back to the same diagram: where it was scrolled to (FB).\n React.useLayoutEffect(() => {\n const el = scrollRef.current;\n const x = scrollMemory.get(memKey);\n if (el && x) el.scrollLeft = x;\n }, [memKey, view, scrollRef]);\n const onScrollKeep = () => {\n const el = scrollRef.current;\n if (el) remember(memKey, el.scrollLeft);\n onScroll();\n };\n const selEdge = (pickEdge && edges.find((e) => edgeId(e) === p.selectedEdge)) || null;\n // The list shows every edge, those into a shared item too (not drawn on the diagram): each can be selected there.\n const selListEdge = (pickEdge && p.edges.find((e) => edgeId(e) === p.selectedEdge)) || null;\n const nodeIdsAll = new Set(all.map((n) => n.id));\n // How often each item uses each shared item (edges into a shared item are not drawn). Other shared items count too,\n // so the shared item's line and the list (which shows every edge) give the same numbers.\n const uses: Record<string, Record<string, number>> = {};\n for (const e of p.edges)\n if (sharedIds.has(e.to) && e.from !== e.to && nodeIdsAll.has(e.from)) (uses[e.to] ??= {})[e.from] = (uses[e.to]?.[e.from] ?? 0) + (e.count || 0);\n const selShared = !selEdge && sel != null && sharedIds.has(sel) ? sel : null;\n // A selected box highlights its edges; a selected edge highlights itself, and both of its boxes stay undimmed;\n // a selected shared item keeps the boxes that use it and dims every line.\n const related = (e: LayerGraphEdge) => (selEdge ? e === selEdge : !!sel && !selShared && (e.from === sel || e.to === sel));\n const focus = !!sel || !!selEdge;\n const near = (id: string) =>\n selEdge\n ? id === selEdge.from || id === selEdge.to\n : selShared\n ? id === selShared || id in (uses[selShared] ?? {})\n : !sel || id === sel || edges.some((e) => related(e) && (e.from === id || e.to === id));\n const pick = (id: string, on: boolean) => {\n if (!on && p.selectedEdge != null) pickEdge?.(null);\n p.onSelect?.(on ? null : id);\n };\n const nameOf = (id: string) => all.find((n) => n.id === id)?.name || id;\n const countText = (e: LayerGraphEdge) => {\n const n = e.count ?? 0;\n return typeof p.countLabel === 'function' ? p.countLabel(n) : (p.countLabel ?? byCount(n, '1 次', '{n} 次')).replace('{n}', format.number(n));\n };\n // The label a line down gets: its own label for an inferred line, else its count (when related to the selection).\n // Two or more lines with the same label (「執行 worker」 from two boxes) cannot be told apart: each gets its source in\n // front, 「來自 src/cli,…」.\n // In a language with capitals, 「Passes data…」 after 「From x, 」 starts lower case (not an acronym like 「SHM」).\n const midSentence = (t: string) => (/^[A-Z][a-z]/.test(t) && !/^zh/i.test(format.locale()) ? t[0].toLowerCase() + t.slice(1) : t);\n // Only labels the app wrote: lines without one all show the same 「推測」, and that needs no source.\n const sameLabel = new Map<string, number>();\n for (const e of edges) if (lab(e) && e.label && pos[e.from] && pos[e.to]) sameLabel.set(e.label, (sameLabel.get(e.label) ?? 0) + 1);\n const kindWord = (e: LayerGraphEdge) => (e.declared ? p.declaredLabel || tr('宣告') : p.inferredLabel || tr('推測'));\n const inferredText = (e: LayerGraphEdge) =>\n e.label && (sameLabel.get(e.label) ?? 0) > 1 ? tr('來自 {from},{label}', { from: nameOf(e.from), label: midSentence(e.label) }) : e.label || kindWord(e);\n const markText = (e: LayerGraphEdge) => (lab(e) ? inferredText(e) : countText(e));\n // Room beside the boxes for the lanes only: the labels sit beside the lane, between the layers (PB), so they do not\n // widen the diagram. The left side shifts every box right, the right side widens it.\n if (upsL.length) {\n const left0 = Math.min(...main.map((n) => pos[n.id].x));\n const shift = Math.max(0, PAD + (upsL.length - 1) * LANE_STEP + LANE - left0);\n for (const id in pos) pos[id] = { x: pos[id].x + shift, y: pos[id].y };\n W += shift;\n }\n // Read from the boxes each time: they move right when a label is written out past the left edge (below), and the\n // lanes must move with them, or a lane up would run behind the boxes it should pass beside.\n const boxesLeft = () => Math.min(...main.map((n) => pos[n.id].x));\n const boxesRight = () => Math.max(0, ...main.map((n) => pos[n.id].x + NW));\n const laneX = (e: LayerGraphEdge) => (onLeft(e) ? boxesLeft() - LANE - upsL.indexOf(e) * LANE_STEP : boxesRight() + LANE + upsR.indexOf(e) * LANE_STEP);\n // A label starts just inside the innermost lane on the left, or ends just inside it on the right.\n const upLabelX = () => boxesLeft() - LANE + 8;\n const upLabelEndL = () => boxesRight() + LANE - 8;\n if (upsR.length) W = Math.max(W, boxesRight() + LANE + (upsR.length - 1) * LANE_STEP + PAD);\n const choose = (e: LayerGraphEdge) => {\n const id = edgeId(e);\n const next = p.selectedEdge === id ? null : id;\n if (next && sel != null) p.onSelect?.(null);\n pickEdge?.(next);\n };\n\n // MA: two or more labelled lines down into one box each make their last turn at a height of their own in the gap\n // above it, LANE_H px apart, the rightmost arrow lowest; each label sits on its own line's height just past its\n // turn, so no other line runs through it. labelled: the lines that get a label (inferred, or related to the\n // selection, which shows the count).\n const LANE_H = 28;\n const txOf = (e: LayerGraphEdge) => Math.round(pos[e.to].x + (NW * (ins[e.to].indexOf(e) + 1)) / (ins[e.to].length + 1));\n const laneGroups: Record<string, LayerGraphEdge[]> = {};\n const laneCount: Record<string, number> = {};\n {\n const into: Record<string, LayerGraphEdge[]> = {};\n for (const e of edges) if (ins[e.to]?.includes(e) && (lab(e) || related(e))) (into[e.to] ??= []).push(e);\n for (const id in into) {\n if (into[id].length < 2) continue;\n // The rightmost arrow first: lane 0 (the lowest) in the default order.\n laneGroups[id] = into[id].sort((a, b) => txOf(b) - txOf(a));\n laneCount[id] = into[id].length;\n }\n }\n // Draws every line and places every label. A label of a line up that finds no spot clear of every line, even\n // wrapped, asks for a taller gap; the diagram is then drawn again with it.\n const draw = () => {\n const paths: React.ReactNode[] = [];\n const labels: React.ReactNode[] = [];\n const need = new Set<number>();\n // Gaps where a label found no spot even covering a line (it would sit on a box or another label).\n const crowd = new Set<number>();\n // Labels that found no spot clear of every line and cover one: the space between boxes then grows (see spread).\n let covered = 0;\n // Where a line down leaves, turns and arrives (no lanes yet): shared by the lane search and the drawing.\n const geomOf = (e: LayerGraphEdge) => {\n const a = pos[e.from];\n const b = pos[e.to];\n const oi = outs[e.from].indexOf(e);\n const on = outs[e.from].length;\n const sx = outX(a.x, oi, on);\n const sy = a.y + NH;\n const tx = txOf(e);\n const ty = b.y;\n const off = (oi - (on - 1) / 2) * 6;\n const skip = layerIndex[e.to] - layerIndex[e.from] > 1;\n const y1 = sy + gaps[layerIndex[e.from]] / 2 + off;\n let chx = sx;\n if (skip) {\n // Skipping a layer: go down a channel between the boxes of the next layer, the one nearest the middle.\n const next = (byLayer.get(layers[layerIndex[e.from] + 1]) ?? []).map((n) => pos[n.id]);\n const mid = (sx + tx) / 2;\n const chans = [next[0].x - COL / 2, ...next.map((q) => q.x + NW + COL / 2)].map((c) => Math.max(PAD / 2, Math.min(W - PAD / 2, c)));\n chx = chans.reduce((best, c) => (Math.abs(c - mid) < Math.abs(best - mid) ? c : best), chans[0]) + off;\n }\n // The last turn starts at from, after a vertical from startY.\n return { sx, sy, tx, ty, off, skip, y1, chx, from: skip ? chx : sx, startY: skip ? y1 : sy };\n };\n // MA: the turn heights of the labelled lines into one box. Every order is tried (up to 6 lines), each label on\n // either side of its own turn, and the order where the most labels miss every vertical line of the group wins;\n // a tie keeps the rightmost arrow lowest. A label still blocked falls back to the search below.\n const lanes = new Map<LayerGraphEdge, { y: number; side: 'right' | 'left' }>();\n // Where the lines leave a box: spread over its whole width, 16 px in from each edge, so the labels of the lines\n // that leave it have room between them; one line leaves from the middle.\n const outX = (x: number, i: number, n: number) => Math.round(n < 2 ? x + NW / 2 : x + 16 + ((NW - 32) * i) / (n - 1));\n // A flat line (same layer): its source x, its run's height in the gap below the row, its target x.\n const flatOf = (e: LayerGraphEdge) => {\n const a = pos[e.from];\n const b = pos[e.to];\n const oi = outs[e.from].indexOf(e);\n const on = outs[e.from].length;\n const sx = outX(a.x, oi, on);\n const j = flatRow[layerIndex[e.from]].indexOf(e);\n const ti = flatIn[e.to].indexOf(e);\n const tx = Math.round(b.x + NW - 24 - ti * 12);\n return { sx, sy: a.y + NH, y: a.y + NH + 14 + j * 10, tx, ty: b.y + NH };\n };\n // The vertical runs of every line, as drawn before lanes are chosen: what a label of the group must also miss\n // (a line skipping a layer down its channel, the lines into other boxes, the lanes of the lines up).\n const vertsOf = (e: LayerGraphEdge) => {\n if (isFlat(e)) {\n const f = flatOf(e);\n return [\n { x: f.sx, y0: f.sy, y1: f.y },\n { x: f.tx, y0: f.ty, y1: f.y },\n ];\n }\n if (isUp(e)) {\n const x = laneX(e);\n return [{ x, y0: pos[e.to].y, y1: pos[e.from].y + NH }];\n }\n const g = geomOf(e);\n if (!g.skip)\n return [\n { x: g.sx, y0: g.sy, y1: g.y1 },\n { x: g.tx, y0: g.y1, y1: g.ty },\n ];\n const y2 = g.ty - gaps[layerIndex[e.to] - 1] / 2 + g.off;\n return [\n { x: g.sx, y0: g.sy, y1: g.y1 },\n { x: g.chx, y0: g.y1, y1: y2 },\n { x: g.tx, y0: y2, y1: g.ty },\n ];\n };\n for (const id in laneGroups) {\n const group = laneGroups[id].map((e) => ({ e, g: geomOf(e), w: Math.ceil(labelWidth(markText(e))) }));\n const others = edges.filter((e) => !laneGroups[id].includes(e) && pos[e.from] && pos[e.to]).flatMap((e) => vertsOf(e).map((v) => ({ k: -1, ...v })));\n const n = group.length;\n const laneY = (j: number) => group[0].g.ty - 8 - 16 - j * LANE_H;\n const perms: number[][] = [];\n const permute = (rest: number[], acc: number[]) => {\n if (!rest.length) perms.push(acc);\n else rest.forEach((x, k) => permute([...rest.slice(0, k), ...rest.slice(k + 1)], [...acc, x]));\n };\n if (n <= 6) permute([...group.keys()], []);\n else perms.push([...group.keys()]);\n let best: { fails: number; ys: number[]; sides: ('right' | 'left')[] } | null = null;\n for (const perm of perms) {\n // perm[j] is the edge on lane j (0 the lowest).\n const ys: number[] = [];\n perm.forEach((k, j) => (ys[k] = laneY(j)));\n const verts = [\n ...group.flatMap((q, k) => [\n { k, x: q.g.from, y0: q.g.startY, y1: ys[k] },\n { k, x: q.g.tx, y0: ys[k], y1: q.g.ty - 8 },\n ]),\n ...others,\n ];\n // Past the left edge is fine: the diagram widens to the left for it.\n const free = (k: number, x0: number, x1: number) =>\n verts.every((v) =>\n v.k === k\n ? !(v.x > x0 - 1 && v.x < x1 + 1 && v.y0 < ys[k] + 7 && v.y1 > ys[k] - 7)\n : !(v.x > x0 - 5 && v.x < x1 + 5 && v.y0 < ys[k] + 10 && v.y1 > ys[k] - 10),\n );\n let fails = 0;\n const sides: ('right' | 'left')[] = [];\n group.forEach((q, k) => {\n const r0 = Math.max(q.g.from, q.g.tx) + 8;\n const l1 = Math.min(q.g.from, q.g.tx) - 8;\n if (free(k, r0, r0 + q.w)) sides[k] = 'right';\n else if (free(k, l1 - q.w, l1)) sides[k] = 'left';\n else {\n sides[k] = 'right';\n fails++;\n }\n });\n if (!best || fails < best.fails) best = { fails, ys, sides };\n if (!fails) break;\n }\n if (best) group.forEach((q, k) => lanes.set(q.e, { y: best.ys[k], side: best.sides[k] }));\n }\n const marks: {\n idx: number;\n e: LayerGraphEdge;\n text: string;\n tx: number;\n ty: number;\n left: boolean;\n r: boolean;\n dim: boolean;\n up?: boolean;\n flat?: boolean;\n lane?: number | null;\n from?: number;\n side?: 'right' | 'left';\n }[] = [];\n // How far right the labels reach: the diagram widens to keep a label whole (MA).\n let wide = 0;\n let least = 0;\n // Lines that labels must not cover: the horizontal runs of the up lines, as [left, right, top, bottom].\n const runs: number[][] = [];\n // Every straight piece of every line, for the labels of up lines.\n const segs: { idx: number; box: number[] }[] = [];\n // Each line's corner points, for the search along its own line.\n const ptsOf: Record<number, Pt[]> = {};\n const arrows: number[][] = [];\n const hitPaths: React.ReactNode[] = [];\n edges.forEach((e, idx) => {\n const a = pos[e.from];\n const b = pos[e.to];\n if (!a || !b) return;\n const r = related(e);\n const dim = focus && !r;\n const picked = e === selEdge;\n const up = isUp(e);\n let pts: Pt[];\n let tx: number;\n let ty: number;\n let arrow: string;\n let inn = 1;\n // MA: the height of the line's last turn and where that turn starts (see laneOf).\n let laneAt: number | null = null;\n let turnFrom = 0;\n let laneSide: 'right' | 'left' = 'right';\n if (up) {\n const lx = laneX(e);\n const L = onLeft(e);\n const si = upOut[e.from].indexOf(e);\n const sn = upOut[e.from].length;\n const ti = upIn[e.to].indexOf(e);\n const tn = upIn[e.to].length;\n const start: Pt[] = [];\n let y0: number;\n if (L ? leftmost(e.from) : rightmost(e.from)) {\n // From the right side, a little apart when several leave the same box.\n y0 = Math.round(a.y + NH / 2 + (si - (sn - 1) / 2) * 10);\n start.push([L ? a.x : a.x + NW, y0], [lx, y0]);\n } else {\n // A box to its right: leave from the top edge, just under the lines of the gap above.\n const px = L ? a.x + 20 + si * 10 : a.x + NW - 20 - si * 10;\n y0 = a.y - 12 - si * 6;\n start.push([px, a.y], [px, y0], [lx, y0]);\n }\n let y1: number;\n if (L || rightmost(e.to)) {\n // Into the side facing the lane, the arrow pointing at the box.\n y1 = Math.round(b.y + NH / 2 + (ti - (tn - 1) / 2) * 10);\n tx = L ? b.x : b.x + NW;\n ty = y1;\n const back = L ? tx - 9 : tx + 9;\n pts = [...start, [lx, y1], [back, y1]];\n arrow = `M${back} ${ty - 5} L${back} ${ty + 5} L${tx} ${ty} Z`;\n arrows.push([Math.min(tx, back), Math.max(tx, back), ty - 5, ty + 5]);\n runs.push([Math.min(tx, lx), Math.max(tx, lx), y1 - 3, y1 + 3]);\n } else {\n // A box to its right: come in from below, into the bottom edge.\n tx = b.x + NW - 20 - ti * 10;\n y1 = b.y + NH + 12 + ti * 6;\n ty = b.y + NH;\n pts = [...start, [lx, y1], [tx, y1], [tx, ty + 9]];\n arrow = `M${tx - 5} ${ty + 9} L${tx + 5} ${ty + 9} L${tx} ${ty} Z`;\n arrows.push([tx - 5, tx + 5, ty, ty + 9]);\n runs.push([tx, lx, y1 - 3, y1 + 3]);\n }\n const sx0 = start[start.length - 2][0];\n runs.push([Math.min(sx0, lx), Math.max(sx0, lx), y0 - 3, y0 + 3]);\n if (lab(e) || r) {\n const text = markText(e);\n marks.push({ idx, e, text, tx: L ? upLabelX() : upLabelEndL(), ty: Math.round((y0 + y1) / 2), left: !L, r, dim, up: true });\n }\n } else if (isFlat(e)) {\n const f = flatOf(e);\n tx = f.tx;\n ty = f.ty;\n pts = [\n [f.sx, f.sy],\n [f.sx, f.y],\n [f.tx, f.y],\n [f.tx, f.ty + 9],\n ];\n arrow = `M${tx - 5} ${ty + 9} L${tx + 5} ${ty + 9} L${tx} ${ty} Z`;\n arrows.push([tx - 5, tx + 5, ty, ty + 9]);\n runs.push([Math.min(f.sx, f.tx), Math.max(f.sx, f.tx), f.y - 3, f.y + 3]);\n if (lab(e) || r) {\n const text = markText(e);\n marks.push({ idx, e, text, tx: Math.round((f.sx + f.tx) / 2), ty: f.y, left: false, r, dim, flat: true });\n }\n } else {\n inn = ins[e.to].length;\n const g = geomOf(e);\n const { sx, sy, skip } = g;\n tx = g.tx;\n ty = g.ty;\n const lane = lanes.get(e);\n const laneY = lane ? lane.y : null;\n const y1 = !skip && laneY != null ? laneY : g.y1;\n if (skip) {\n const y2 = laneY ?? ty - gaps[layerIndex[e.to] - 1] / 2 + g.off;\n pts = [\n [sx, sy],\n [sx, y1],\n [g.chx, y1],\n [g.chx, y2],\n [tx, y2],\n [tx, ty - 8],\n ];\n } else {\n pts = [\n [sx, sy],\n [sx, y1],\n [tx, y1],\n [tx, ty - 8],\n ];\n }\n turnFrom = g.from;\n laneAt = laneY;\n laneSide = lane?.side ?? 'right';\n arrow = `M${tx - 5} ${ty - 9} L${tx + 5} ${ty - 9} L${tx} ${ty} Z`;\n arrows.push([tx - 5, tx + 5, ty - 9, ty]);\n }\n // Hover on a selectable line: darker and 2 px thicker (CSS, from --lg-w).\n const w = (lab(e) ? 1.5 : 1.5 + 5.5 * ((e.count || 0) / maxCount)) + (picked ? 1.5 : 0);\n const cpts = clean(pts);\n ptsOf[idx] = cpts;\n for (let k = 1; k < cpts.length; k++) {\n const [ax, ay] = cpts[k - 1];\n const [bx, by] = cpts[k];\n segs.push({ idx, box: [Math.min(ax, bx) - 3, Math.max(ax, bx) + 3, Math.min(ay, by) - 3, Math.max(ay, by) + 3] });\n }\n const d = route(cpts, 10);\n paths.push(\n <path\n key={'p' + idx}\n className={cx('ui-lg-edge', e.declared ? 'is-declared' : e.inferred && 'is-inferred', r && 'is-related', dim && 'is-dim')}\n data-hl={edgeId(e)}\n d={d}\n strokeWidth={w}\n style={{ '--lg-w': w } as React.CSSProperties}\n />,\n );\n if (!pickEdge && peek) {\n // edgeLabels 'hover' without selectable lines: an invisible path that only shows the label while hovered.\n hitPaths.push(<path key={'h' + idx} className=\"ui-lg-hit is-peek\" d={d} data-hover={edgeId(e)} />);\n }\n if (pickEdge) {\n // An invisible 12 px path over the line: the click and keyboard target.\n hitPaths.push(\n <path\n key={'h' + idx}\n className=\"ui-lg-hit\"\n data-edge={edgeId(e)}\n d={d}\n role=\"button\"\n tabIndex={0}\n aria-label={tr('{from} 到 {to},{what}', {\n from: nameOf(e.from),\n to: nameOf(e.to),\n what: markText(e).replace(/`/g, ''),\n })}\n aria-pressed={picked}\n onClick={(ev) => {\n ev.stopPropagation();\n choose(e);\n }}\n data-hover={edgeId(e)}\n onKeyDown={(ev) => {\n if (ev.key === 'Enter' || ev.key === ' ') {\n ev.preventDefault();\n choose(e);\n } else if (ev.key === 'Escape' && picked) pickEdge(null);\n }}\n />,\n );\n }\n paths.push(<path key={'a' + idx} className={cx('ui-lg-arrow', r && 'is-related', dim && 'is-dim')} d={arrow} />);\n if (!up && !isFlat(e) && (lab(e) || r)) {\n const text = markText(e);\n // Several arrows into one box: an arrow in the left half puts its label on its left.\n marks.push({ idx, e, text, tx, ty, left: inn > 1 && tx < b.x + NW / 2, r, dim, lane: laneAt, from: turnFrom, side: laneSide });\n }\n });\n // Labels sit beside their arrowheads, inside the diagram; one that would touch a placed label or an arrowhead moves up 18 px.\n // Obstacles are [left, right, top, bottom, gap].\n const placed = [...arrows, ...runs];\n // Boxes, which the labels of up lines (placed in the gaps beside the lanes) must not cover.\n const boxRects = main.map((n) => [boxOf(n.id).x, boxOf(n.id).x + boxOf(n.id).w, pos[n.id].y, pos[n.id].y + NH]);\n const hits = (x0: number, x1: number, y0: number, y1: number) =>\n placed.some((q) => x0 < q[1] + (q[4] || 0) && q[0] < x1 + (q[4] || 0) && y0 < q[3] && q[2] < y1);\n // On its own line: the line itself, not the room around it, since the label sits beside its own arrowhead and lane.\n const cross = (q: number[], x0: number, lw: number, y0: number, y1: number) => x0 < q[1] - 1 && q[0] + 1 < x0 + lw && y0 < q[3] - 1 && q[2] + 1 < y1;\n // Along its own line: beside each vertical run (either side) and above or below each horizontal run, every 6 px,\n // on one line or wrapped; clear of every other line, box, arrowhead and placed label. The clear spot nearest the\n // arrowhead wins. Used when the spots beside the arrowhead (or the lane, for a line up) are all blocked.\n // How far a label's box is from a straight piece of line (0 when they touch).\n const gapTo = (b: number[], x0: number, lw: number, y0: number, y1: number) =>\n Math.hypot(Math.max(0, b[0] - (x0 + lw), x0 - b[1]), Math.max(0, b[2] - y1, y0 - b[3]));\n // own: the label must be nearer its own line than any other line, so a reader does not take it for the label of\n // the line beside it.\n // A spot that reads as line idx's: nearer that line than any other (by 4 px), and 8 px clear of every other line\n // (text measured on a canvas can come out a little wider on the page).\n const isMine = (idx: number, x0: number, lw: number, y0: number, y1: number) => {\n let self = Infinity;\n let other = Infinity;\n for (const sg of segs) {\n const d = gapTo(sg.box, x0, lw, y0, y1);\n if (sg.idx === idx) self = Math.min(self, d);\n else other = Math.min(other, d);\n }\n return self + 4 < other && other >= 8;\n };\n const alongLine = (m: { idx: number; text: string; tx: number; ty: number }, own = true) => {\n const pts = ptsOf[m.idx] ?? [];\n const mine = (x0: number, lw: number, y0: number, y1: number) => isMine(m.idx, x0, lw, y0, y1);\n const ok = (x0: number, lw: number, y0: number, y1: number) =>\n (!own || mine(x0, lw, y0, y1)) &&\n x0 >= PAD / 2 &&\n x0 + lw <= W - PAD / 2 &&\n y0 >= 2 &&\n y1 <= H - 2 &&\n !hits(x0 - 2, x0 + lw + 2, y0 - 2, y1 + 2) &&\n !boxRects.some((q) => x0 < q[1] + 4 && q[0] < x0 + lw + 4 && y0 < q[3] + 4 && q[2] < y1 + 4) &&\n !segs.some((sg) =>\n sg.idx === m.idx ? cross(sg.box, x0, lw, y0, y1) : x0 < sg.box[1] + 2 && sg.box[0] < x0 + lw + 2 && y0 < sg.box[3] + 2 && sg.box[2] < y1 + 2,\n );\n for (const lines of wraps(m.text)) {\n const lw = Math.ceil(Math.max(...lines.map(labelWidth)));\n const lh = lines.length * 16;\n let best: { x0: number; top: number; d: number } | null = null;\n for (let k = 1; k < pts.length; k++) {\n const [ax, ay] = pts[k - 1];\n const [bx, by] = pts[k];\n const len = Math.hypot(bx - ax, by - ay);\n for (let t = 0; t <= len; t += 6) {\n const x = ax + ((bx - ax) * t) / len;\n const y = ay + ((by - ay) * t) / len;\n const cands =\n ax === bx\n ? [\n [x + 8, y],\n [x - 8 - lw, y],\n ]\n : [\n [x - lw / 2, y - 6 - lh / 2],\n [x - lw / 2, y + 6 + lh / 2],\n ];\n for (const [x0, top] of cands) {\n // The distance first: a spot no nearer than the best one is not checked against every line.\n const d = Math.hypot(x0 + lw / 2 - m.tx, top - m.ty);\n if (best && d >= best.d) continue;\n if (ok(x0, lw, top - lh / 2, top + lh / 2)) best = { x0, top, d };\n }\n }\n }\n if (best) return { x0: Math.round(best.x0), top: Math.round(best.top), lw, lh, lines };\n }\n return null;\n };\n // NA+B: a label with no spot that reads as its own line's becomes a number on the line; the full text is listed\n // under the diagram, and shows at its old spot (over the lines, on its ground) while the line is hovered or selected.\n const numbered: { n: number; m: (typeof marks)[number]; x: number; y: number }[] = [];\n const numberOn = (m: (typeof marks)[number], near: { x0: number; top: number; lw: number }) => {\n const pts = ptsOf[m.idx] ?? [];\n const cx = near.x0 + near.lw / 2;\n const cy = near.top;\n let best: { x: number; y: number; d: number; clear: boolean } | null = null;\n for (let k = 0; k + 1 < pts.length; k++) {\n const [x1, y1] = pts[k];\n const [x2, y2] = pts[k + 1];\n const len = Math.hypot(x2 - x1, y2 - y1);\n for (let t = 12; t <= len - 12; t += 4) {\n const x = x1 + ((x2 - x1) * t) / len;\n const y = y1 + ((y2 - y1) * t) / len;\n // A 20 px dot, 4 px clear of other lines, boxes, labels and other dots.\n const clear =\n !segs.some((sg) => sg.idx !== m.idx && gapTo(sg.box, x - 14, 28, y - 14, y + 14) === 0) &&\n !boxRects.some((q) => x + 14 > q[0] && x - 14 < q[1] && y + 14 > q[2] && y - 14 < q[3]) &&\n !hits(x - 14, x + 14, y - 14, y + 14) &&\n !numbered.some((o) => Math.hypot(o.x - x, o.y - y) < 28);\n const d = Math.hypot(x - cx, y - cy);\n if (!best || (clear && !best.clear) || (clear === best.clear && d < best.d)) best = { x, y, d, clear };\n }\n }\n const at = best ?? { x: m.tx, y: m.ty - 20 };\n numbered.push({ n: numbered.length + 1, m, x: Math.round(at.x), y: Math.round(at.y) });\n return numbered.length;\n };\n const labelEl = (m: (typeof marks)[number], x0: number, top: number, lines: string[] = [m.text], over = false, num = 0) => (\n // With onSelectEdge the label selects its edge too (a mouse and touch target; keyboard uses the line itself).\n <span\n key={'l' + m.idx}\n // The line's own button carries this text; read once, not again beside it.\n aria-hidden={pickEdge ? true : undefined}\n className={cx(\n 'ui-lg-label',\n // Over a line (no clear spot): a solid ground, so the line stops at the label instead of showing between letters.\n over && 'is-over',\n num > 0 && 'is-numbered',\n num > 0 && m.e === selEdge && 'is-shown',\n pickEdge && 'is-clickable',\n m.r && 'is-related',\n m.dim && 'is-dim',\n // edgeLabels 'hover': hidden until its line is hovered (is-hl), focused or selected; the room stays reserved.\n peek && !m.r && m.e !== selEdge && 'is-quiet',\n )}\n data-hl={edgeId(m.e)}\n style={{ left: x0, top }}\n onClick={\n pickEdge\n ? (ev) => {\n ev.stopPropagation();\n choose(m.e);\n }\n : undefined\n }\n data-hover={pickEdge ? edgeId(m.e) : undefined}\n >\n {lines.map((t, i) => (\n <React.Fragment key={i}>\n {i ? <br /> : null}\n {labelParts(t)}\n </React.Fragment>\n ))}\n </span>\n );\n // A label of a line down with no spot clear of every line waits until every other label has its spot: it then\n // covers a line, and the labels that do have a clear spot keep it.\n const later: (typeof marks)[number][] = [];\n const place = (m: (typeof marks)[number], last: boolean) => {\n const w = Math.ceil(labelWidth(m.text));\n if (m.flat) {\n // Along its own line, nearest the middle of its run; else the gap below the row grows, and as a last resort\n // it sits above the middle of the run.\n let spot = alongLine(m);\n if (!spot) {\n const g = layerIndex[m.e.from];\n if (g < layers.length - 1) need.add(g);\n covered++;\n // Off boxes and labels at least: below the run, moved down 18 px at a time.\n const x0 = Math.max(PAD / 2, Math.min(W - PAD / 2 - w, m.tx - w / 2));\n const taken = (t: number) =>\n hits(x0, x0 + w, t - 10, t + 10) || boxRects.some((q) => x0 < q[1] + 2 && q[0] < x0 + w + 2 && t - 10 < q[3] && q[2] < t + 10);\n let top = m.ty + 14;\n for (let k = 0; k < 8 && taken(top); k++) top += 18;\n spot = { x0, top, lw: w, lh: 16, lines: [m.text] };\n labels.push(labelEl(m, spot.x0, spot.top, spot.lines, true, numberOn(m, spot)));\n return;\n }\n placed.push([spot.x0, spot.x0 + spot.lw, spot.top - spot.lh / 2 - 4, spot.top + spot.lh / 2 + 4, 6]);\n labels.push(labelEl(m, spot.x0, spot.top, spot.lines));\n return;\n }\n if (m.up) {\n // Along its own line, nearest where the line starts, and nearer its own line than any other: a label left\n // between two lines reads as the other line's. Else beside its lane as below.\n const p0 = ptsOf[m.idx]?.[0];\n const near = p0 ? alongLine({ ...m, tx: p0[0], ty: p0[1] }, true) : null;\n if (near) {\n placed.push([near.x0, near.x0 + near.lw, near.top - near.lh / 2 - 4, near.top + near.lh / 2 + 4, 6]);\n labels.push(labelEl(m, near.x0, near.top, near.lines));\n return;\n }\n // Beside its lane, halfway between the two ends (the gap between layers); moved up, then down, off boxes,\n // lines and labels already placed, and kept inside the diagram. On one line when a spot is clear of every\n // line; else wrapped onto 2 to 4 lines, narrower so it fits between the lane and the next line; else the gap\n // grows and it is tried again. Only when the gap cannot grow further may it cover a line, on its white ground.\n const x0Of = (lw: number) => Math.max(PAD / 2, Math.min(W - PAD / 2 - lw, m.left ? m.tx - lw : m.tx));\n const start0 = Math.max(10, Math.min(H - 10, m.ty));\n const find = (x0: number, lw: number, lh: number, withLines: boolean) => {\n const over = (q: number[], y0: number, y1: number) => x0 < q[1] + 4 && q[0] < x0 + lw + 4 && y0 < q[3] + 4 && q[2] < y1 + 4;\n const bad = (y0: number, y1: number) =>\n hits(x0, x0 + lw, y0 - 4, y1 + 4) ||\n boxRects.some((q) => over(q, y0, y1)) ||\n (withLines && segs.some((g) => (g.idx === m.idx ? cross(g.box, x0, lw, y0, y1) : over(g.box, y0, y1)))) ||\n // Beside the lane, but not nearer another line: it would read as that line's.\n (withLines && !isMine(m.idx, x0, lw, y0, y1));\n for (let k = 0; k <= 16; k++)\n for (const dir of k ? [-1, 1] : [0]) {\n const t = start0 + dir * k * 18;\n if (t - lh / 2 >= 2 && t + lh / 2 <= H - 2 && !bad(t - lh / 2, t + lh / 2)) return t;\n }\n return null;\n };\n let spot: { x0: number; top: number; lw: number; lh: number; lines: string[] } | null = null;\n for (const lines of wraps(m.text)) {\n const lw = Math.ceil(Math.max(...lines.map(labelWidth)));\n const lh = lines.length * 16;\n const x0 = x0Of(lw);\n const top = find(x0, lw, lh, true);\n if (top != null) {\n spot = { x0, top, lw, lh, lines };\n break;\n }\n }\n if (!spot) spot = alongLine(m);\n if (!spot) {\n // The gap the label sits in: the one around its middle, else the one just above the line's source.\n const g = Math.max(\n 0,\n Math.min(\n layers.length - 2,\n layers.findIndex((_, k) => k < layers.length - 1 && m.ty < rowTop(k + 1)),\n ),\n );\n need.add(g);\n covered++;\n const x0 = x0Of(w);\n const top = find(x0, w, 16, false);\n if (top == null) crowd.add(g);\n const at = { x0, top: top ?? start0, lw: w, lh: 16, lines: [m.text] };\n labels.push(labelEl(m, at.x0, at.top, at.lines, true, numberOn(m, at)));\n return;\n }\n // 4 px above and below too, so a label placed later does not sit flush against it.\n placed.push([spot.x0, spot.x0 + spot.lw, spot.top - spot.lh / 2 - 4, spot.top + spot.lh / 2 + 4, 6]);\n labels.push(labelEl(m, spot.x0, spot.top, spot.lines));\n return;\n }\n // Beside its arrowhead, on its side (see left), moved up 18 px at a time off labels and arrowheads. Clear of\n // every other line and every box too: else on the other side of the arrowhead, then wrapped onto 2 to 4 lines,\n // then the gap above the arrowhead grows and the diagram is drawn again.\n const g = layerIndex[m.e.to] - 1;\n // It stays in the gap right above its arrowhead: moved past the boxes above, it would sit beside other lines.\n const gapTop = g >= 0 ? rowTop(g) + NH : 0;\n const sideOf = (lw: number) => {\n let left = m.left;\n if (left && m.tx - 8 - lw < 0) left = false;\n else if (!left && m.tx + 8 + lw > W) left = m.tx - 8 - lw >= 0;\n return left;\n };\n const at = (left: boolean, lw: number) => (left ? m.tx - 8 - lw : Math.min(m.tx + 8, W - lw));\n const clear = (x0: number, lw: number, y0: number, y1: number) => {\n const over = (q: number[]) => x0 < q[1] + 2 && q[0] < x0 + lw + 2 && y0 < q[3] + 2 && q[2] < y1 + 2;\n return !hits(x0, x0 + lw, y0, y1) && !boxRects.some(over) && !segs.some((sg) => (sg.idx === m.idx ? cross(sg.box, x0, lw, y0, y1) : over(sg.box)));\n };\n let spot: { x0: number; top: number; lw: number; lh: number; lines: string[] } | null = null;\n // MA: on its own turn's height, just past the turn, on one line; the diagram widens for it.\n // One line first; then 2 to 4 lines, narrower, still centred on its turn's height beside the turn.\n if (m.lane != null) {\n const lane = m.lane;\n for (const lines of wraps(m.text)) {\n if (spot) break;\n const lw = Math.ceil(Math.max(...lines.map(labelWidth)));\n const lh = lines.length * 16;\n const right = Math.max(m.tx, m.from ?? m.tx) + 8;\n const left = Math.min(m.tx, m.from ?? m.tx) - 8 - lw;\n // Past the left edge is allowed: the diagram then widens to the left (see the shift after drawing).\n for (const x0 of m.side === 'left' ? [left, right] : [right, left])\n if (!spot && clear(x0, lw, lane - lh / 2, lane + lh / 2)) spot = { x0, top: lane, lw, lh, lines };\n }\n }\n for (const lines of spot ? [] : wraps(m.text)) {\n const lw = Math.ceil(Math.max(...lines.map(labelWidth)));\n const lh = lines.length * 16;\n const pref = sideOf(lw);\n for (const left of [pref, !pref]) {\n const x0 = at(left, lw);\n if (x0 < 0 || x0 + lw > W) continue;\n for (let k = 0; k < 8 && !spot; k++) {\n const top = m.ty - 8 - lh / 2 - k * 18;\n if (top - lh / 2 < Math.max(2, gapTop + 2)) break;\n if (clear(x0, lw, top - lh / 2, top + lh / 2)) spot = { x0, top, lw, lh, lines };\n }\n if (spot) break;\n }\n if (spot) break;\n }\n if (!spot) spot = alongLine(m);\n if (!spot && !last) {\n later.push(m);\n return;\n }\n const over = !spot;\n if (!spot) {\n // No spot clear of every line: the gap grows while it can. Meanwhile, and once it cannot, the same search lets\n // the label cover a line (on its white ground), never a box or another label; as a last resort, as before\n // this rule: on its side, moved up off labels only.\n if (g >= 0) need.add(g);\n covered++;\n const offBoxes = (x0: number, lw: number, y0: number, y1: number) =>\n !hits(x0, x0 + lw, y0, y1) && !boxRects.some((q) => x0 < q[1] + 2 && q[0] < x0 + lw + 2 && y0 < q[3] + 2 && q[2] < y1 + 2);\n for (const lines of wraps(m.text)) {\n const lw = Math.ceil(Math.max(...lines.map(labelWidth)));\n const lh = lines.length * 16;\n const pref = sideOf(lw);\n for (const left of [pref, !pref]) {\n const x0 = at(left, lw);\n if (x0 < 0 || x0 + lw > W) continue;\n for (let k = 0; k < 8 && !spot; k++) {\n const top = m.ty - 8 - lh / 2 - k * 18;\n if (top - lh / 2 < Math.max(2, gapTop + 2)) break;\n if (offBoxes(x0, lw, top - lh / 2, top + lh / 2)) spot = { x0, top, lw, lh, lines };\n }\n if (spot) break;\n }\n if (spot) break;\n }\n if (!spot) {\n if (g >= 0) crowd.add(g);\n const x0 = at(sideOf(w), w);\n let top = m.ty - 16;\n for (let k = 0; k < 8 && hits(x0, x0 + w, top - 8, top + 8); k++) top -= 18;\n spot = { x0, top, lw: w, lh: 16, lines: [m.text] };\n }\n }\n if (over) {\n // NA+B: a number on its line; the text shows only while the line is hovered or selected, so it takes no room.\n labels.push(labelEl(m, spot.x0, spot.top, spot.lines, true, numberOn(m, spot)));\n return;\n }\n // 4 px above and below: a label placed later keeps a visible gap from this one (2 px read as touching).\n placed.push([spot.x0, spot.x0 + spot.lw, spot.top - spot.lh / 2 - 4, spot.top + spot.lh / 2 + 4, 6]);\n // 4 px for the label's own padding and the canvas measure's rounding.\n wide = Math.max(wide, spot.x0 + spot.lw + PAD / 2 + 4);\n least = Math.min(least, spot.x0 - PAD / 2 - 4);\n labels.push(labelEl(m, spot.x0, spot.top, spot.lines, over));\n };\n marks\n // Labels beside arrowheads first: their spot is fixed; the labels of lines up then look for room around them.\n .sort((m, n) => Number(!!m.up) - Number(!!n.up) || m.ty - n.ty || m.tx - n.tx)\n .forEach((m) => place(m, false));\n later.forEach((m) => place(m, true));\n // The dots go over the lines; each also shows its line's text while hovered.\n for (const o of numbered)\n labels.push(\n <span\n key={'n' + o.m.idx}\n className={cx('ui-lg-num', o.m.dim && 'is-dim', o.m.e === selEdge && 'is-on')}\n data-hl={edgeId(o.m.e)}\n style={{ left: o.x, top: o.y }}\n aria-hidden=\"true\"\n data-hover={pickEdge ? edgeId(o.m.e) : undefined}\n >\n {o.n}\n </span>,\n );\n return { paths, labels, hitPaths, need, crowd, wide, least, covered, numbered };\n };\n // Layout and routing: placing the rows, routing every line and placing every label, with the redraws that widen gaps\n // and the diagram. Worked out again only when what it depends on changes (boxes, lines, the fit, the added space, the\n // dragged height, the labels' switch, the selection and the label texts), never on a hover. A run moves the boxes and\n // sets W, H and the gaps: kept with the result and put back when it is reused.\n const routed = React.useMemo(() => {\n // Room for the lanes: LANE_H px per labelled line into one box, plus the arrow and a margin.\n for (const id in laneCount) {\n const g = layerIndex[id] - 1;\n if (g >= 0) gaps[g] = Math.max(gaps[g], laneCount[id] * LANE_H + 40);\n }\n // The least each gap gets: GAP, or the lanes' room.\n const floor = gaps.slice();\n placeRows();\n let drawn = draw();\n // At most GROW_MAX / GROW redraws: each one widens every gap that a label asked for.\n const grows = () => [...drawn.need].filter((g) => gaps[g] < floor[g] + GROW_MAX);\n for (let k = 0; k < GROW_MAX / GROW && grows().length; k++) {\n for (const g of grows()) gaps[g] = Math.min(floor[g] + GROW_MAX, gaps[g] + GROW);\n placeRows();\n drawn = draw();\n }\n // A gap that grew to the most and still did not help goes back to GAP: the room bought nothing.\n const stuck = [...drawn.need].filter((g) => gaps[g] >= floor[g] + GROW_MAX);\n if (stuck.length) {\n for (const g of stuck) gaps[g] = floor[g];\n placeRows();\n drawn = draw();\n // Then only as much room as the labels need to cover a line rather than a box or each other (several labelled\n // lines into one box, too close together for any label to miss the others' lines).\n const crowded = () => [...drawn.crowd].filter((g) => stuck.includes(g) && gaps[g] < floor[g] + GROW_MAX);\n for (let k = 0; k < GROW_MAX / GROW && crowded().length; k++) {\n for (const g of crowded()) gaps[g] = Math.min(floor[g] + GROW_MAX, gaps[g] + GROW);\n placeRows();\n drawn = draw();\n }\n }\n // A label written out past the left edge: everything moves right and the diagram widens by as much.\n // Moving the boxes also frees the channels beside them, which can move a label again: up to 3 times.\n for (let k = 0; k < 3 && drawn.least < 0; k++) {\n const shift = Math.ceil(-drawn.least);\n for (const id in pos) pos[id].x += shift;\n // eslint-disable-next-line react-hooks/use-memo, react-hooks/exhaustive-deps -- W is returned with the result and set again after the memo\n W += shift;\n drawn = draw();\n }\n // Past the right edge: the diagram widens to keep it whole.\n if (drawn.wide > W) {\n // eslint-disable-next-line react-hooks/use-memo -- as above\n W = Math.ceil(drawn.wide);\n drawn = draw();\n }\n return { drawn, W, H, gaps: gaps.slice(), pos: Object.fromEntries(Object.entries(pos).map(([k, v]) => [k, { ...v }])) };\n }, [p.nodes, p.edges, NW, COL, NH, extra, labelsOn, sel, p.selectedEdge, pickEdge, p.onSelect, p.countLabel, p.inferredLabel, p.declaredLabel, p.nodeWidth]);\n const drawn = routed.drawn;\n W = routed.W;\n H = routed.H;\n gaps.splice(0, gaps.length, ...routed.gaps);\n for (const id in routed.pos) pos[id] = { ...routed.pos[id] };\n const { paths, labels, hitPaths, numbered } = drawn;\n // Where the boxes start, and where the selected one is: the diagram scrolls there (below).\n const firstX = Math.min(...main.filter((n) => pos[n.id]).map((n) => boxOf(n.id).x), W);\n const selBox = sel != null && pos[sel] ? boxOf(sel) : null;\n const sizeText = (n: number) => withNum(p.sizeLabel, n, () => byCount(n, '1 個項目', '{n} 個項目'));\n const externalText = p.externalLabel ?? tr('外部');\n const useText = p.useLabel ?? tr('使用 {n} 次');\n // T: a short tag beside the name; the name is cut first (flex: none here, min-width: 0 on the name).\n const tagOf = (n: LayerGraphNode) =>\n n.tag ? (\n <span className={cx('ui-lg-tag', n.tagTone === 'warning' && 'is-warning')}>\n {n.tagTone === 'warning' ? <Icon name=\"lock\" size={12} /> : null}\n {n.tag}\n </span>\n ) : null;\n const nodes = main.map((n) => {\n const q = pos[n.id];\n const on = n.id === sel;\n const size = sizeOf(n);\n const used = selShared ? uses[selShared]?.[n.id] : undefined;\n return (\n <button\n key={n.id}\n type=\"button\"\n className={cx('ui-lg-node', n.external && 'is-external', on && 'is-selected', !near(n.id) && 'is-dim')}\n onFocus={showWhole}\n style={{ left: boxOf(n.id).x, top: q.y, width: boxOf(n.id).w, height: NH }}\n aria-pressed={p.onSelect ? on : undefined}\n onClick={p.onSelect ? () => pick(n.id, on) : undefined}\n >\n <span className=\"ui-lg-head\">\n <span className={cx('ui-lg-name', n.code && 'is-code')}>{n.name || n.id}</span>\n {tagLine ? null : tagOf(n)}\n {used ? <span className=\"ui-lg-use\">{monoNums(useText.replace('{n}', '\\u0001'), [used])}</span> : null}\n </span>\n {tagLine ? tagOf(n) : null}\n {n.external ? <span className=\"ui-lg-ext\">{externalText}</span> : null}\n {size != null ? (\n <span className=\"ui-lg-size\">\n <span className=\"ui-lg-track\" aria-hidden=\"true\">\n <span style={{ width: Math.round((size / maxSize) * 100) + '%' }} />\n </span>\n <span className=\"ui-lg-count\">{monoNums(sizeText(size), [format.number(size)])}</span>\n </span>\n ) : null}\n </button>\n );\n });\n const sharedMeta = p.sharedMeta ?? tr('{a} 個項目使用,共 {b} 次');\n const sharedBoxes = shared.map((s) => {\n const by = uses[s.id] ?? {};\n const total = Object.values(by).reduce((a, b) => a + b, 0);\n const on = s.id === sel;\n // A selected box dims the shared items it does not use; a selected shared item keeps the shared items it uses or\n // that use it.\n const dim = !!selEdge || (sel != null && !on && (selShared != null ? !(s.id in (uses[selShared] ?? {})) && !(selShared in by) : !(sel in by)));\n return (\n <button\n key={s.id}\n type=\"button\"\n className={cx('ui-lg-node', 'ui-lg-chip', on && 'is-selected', dim && 'is-dim')}\n onFocus={showWhole}\n aria-pressed={p.onSelect ? on : undefined}\n onClick={p.onSelect ? () => pick(s.id, on) : undefined}\n >\n <span className=\"ui-lg-head\">\n <span className={cx('ui-lg-name', s.code && 'is-code')}>{s.name || s.id}</span>\n {tagOf(s)}\n </span>\n <span className=\"ui-lg-shared-meta\">{monoNums(sharedMeta.replace('{a}', '\\u0001').replace('{b}', '\\u0002'), [Object.keys(by).length, total])}</span>\n </button>\n );\n });\n // The list: every box (name, size) and every line (「A → B:label」), selectable like the diagram (XC).\n const edgeText = (e: LayerGraphEdge) =>\n lab(e) ? (e.label ? tr('{label}({inferred})', { label: e.label, inferred: kindWord(e) }) : kindWord(e)) : countText(e);\n const listItem = (key: string, on: boolean, dim: boolean, onClick: (() => void) | undefined, head: React.ReactNode, rest: React.ReactNode) => (\n <li key={key} className={cx('ui-lg-li', dim && 'is-dim')}>\n {onClick ? (\n <button type=\"button\" className={cx('ui-lg-libtn', on && 'is-selected')} aria-pressed={on} onClick={onClick}>\n {head}\n </button>\n ) : (\n <span className=\"ui-lg-lihead\">{head}</span>\n )}\n {rest}\n </li>\n );\n const nodeIds = new Set(all.map((n) => n.id));\n const list = (\n <div className=\"ui-lg-list\">\n <section aria-labelledby={`${uid}-ln`}>\n <h3 id={`${uid}-ln`} className=\"ui-lg-listtitle\">\n {p.listLabels?.nodes ?? tr('項目')}\n </h3>\n <ul>\n {all.map((n) => {\n const size = sizeOf(n);\n return listItem(\n n.id,\n n.id === sel,\n !near(n.id),\n p.onSelect ? () => pick(n.id, n.id === sel) : undefined,\n <>\n <span className={cx('ui-lg-liname', n.code && 'ui-lg-code')}>{n.name || n.id}</span>\n {tagOf(n)}\n </>,\n n.external && !n.shared ? (\n <span className=\"ui-lg-limeta\">\n {tr(',')}\n {externalText}\n </span>\n ) : size != null ? (\n <span className=\"ui-lg-limeta\">\n {tr(',')}\n {monoNums(sizeText(size), [format.number(size)])}\n </span>\n ) : null,\n );\n })}\n </ul>\n </section>\n <section aria-labelledby={`${uid}-le`}>\n <h3 id={`${uid}-le`} className=\"ui-lg-listtitle\">\n {p.listLabels?.edges ?? tr('關係')}\n </h3>\n <ul>\n {p.edges\n .filter((e) => nodeIds.has(e.from) && nodeIds.has(e.to))\n .map((e, i) =>\n listItem(\n edgeId(e) + ':' + i,\n e === selListEdge,\n focus && !related(e) && !(selShared && e.to === selShared),\n // Every relation, also one into a shared item: the same onSelectEdge as a line on the diagram.\n pickEdge ? () => choose(e) : undefined,\n // The whole line is the button, so its name says what the relation is, as on the diagram: three lines\n // between the same two boxes no longer share the name 「A → B」.\n <>\n <span className=\"ui-lg-code\">{nameOf(e.from)}</span> <span aria-hidden=\"true\">→</span>\n <span className=\"ui-visually-hidden\">{tr('到')}</span> <span className=\"ui-lg-code\">{nameOf(e.to)}</span>\n <span className=\"ui-lg-limeta\">\n {tr(':')}\n {labelParts(edgeText(e))}\n </span>\n </>,\n null,\n ),\n )}\n </ul>\n </section>\n </div>\n );\n const showList = p.listView !== false && view === 'list';\n // Wider than its box (phones): it starts at the boxes' left edge, not at a label written out to their left, so the\n // first boxes show whole without a scroll. With a box selected at the start, at that box. Where it was scrolled to\n // before (scrollMemory) wins.\n const started = React.useRef('');\n React.useLayoutEffect(() => {\n const el = scrollRef.current;\n // Only once the fit is final: scrolling, the boxes back at full width (WA).\n if (!el || showList || !fitted?.full || started.current === memKey) return;\n started.current = memKey;\n if (scrollMemory.get(memKey)) return;\n const x = selBox ? selBox.x + selBox.w / 2 - el.clientWidth / (2 * scale) : firstX - 16;\n el.scrollLeft = Math.max(0, x * scale);\n });\n // A box selected later: scrolled into view if it is not (nearest edge), never further.\n const selX = selBox?.x;\n const selW = selBox?.w;\n React.useEffect(() => {\n const el = scrollRef.current;\n if (!el || showList || selX == null || selW == null) return;\n const l = selX * scale;\n const r = (selX + selW) * scale;\n if (l < el.scrollLeft) el.scrollLeft = Math.max(0, l - 16);\n else if (r > el.scrollLeft + el.clientWidth) el.scrollLeft = r - el.clientWidth + 16;\n }, [sel, selX, selW, scale, showList, scrollRef]);\n // The tag button only where there are labels to hide (inferred lines), and only on the diagram.\n const toggleShown = p.labelToggle !== false && !showList && p.edges.some((e) => lab(e));\n // PM: measure the box; narrow the boxes when the diagram is wider, then scale what is still too wide.\n React.useLayoutEffect(() => {\n const el = scrollRef.current;\n if (!el) return;\n const measure = () => setAvail(el.clientWidth);\n measure();\n const ro = resizeObserver(measure);\n ro?.observe(el);\n return () => ro?.disconnect();\n }, [scrollRef, showList]);\n React.useLayoutEffect(() => {\n if (!avail || showList) return;\n if (!fitted) {\n if (W <= avail + 0.5) return;\n const base = p.nodeWidth || 200;\n // The width to lose, over the columns; the space between columns goes from 40 to 24 px first.\n const lose = W - avail - (cols - 1) * (40 - 24);\n const nw = Math.max(Math.min(base, 120), Math.floor(base - Math.max(0, lose) / cols));\n // eslint-disable-next-line react-hooks/set-state-in-effect -- the width is known only after this layout is drawn\n setFit({ at: avail, nw, col: 24, scale: 1 });\n return;\n }\n // Scrolling anyway (WA): the boxes are back at their own width, names whole.\n if (fitted.full) return;\n // W changes after the fit: labels and the space for them widen it. The scale follows every change, so a diagram\n // that grew past its box shrinks again instead of scrolling (PM).\n const s = Math.floor((avail / W) * 1000) / 1000;\n // Smaller than 0.75: the text would be too small to read. It scrolls instead, and since it scrolls anyway the boxes\n // go back to their own width and spacing, so no name is cut (WA).\n if (W > avail + 0.5 && s < 0.75) {\n setFit({ ...fitted, nw: p.nodeWidth || 200, col: 40, scale: 1, full: true });\n return;\n }\n const want = W <= avail + 0.5 ? 1 : s;\n if (want !== fitted.scale) setFit({ ...fitted, scale: want });\n }, [avail, showList, fitted, W, p.nodeWidth, cols]);\n // A label still covering a line: more space between boxes, then drawn again (up to 120 px more).\n const coveredNow = drawn.covered;\n React.useLayoutEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- known only after the labels are placed\n if (coveredNow && spread < 5) setSpread({ key: spreadKey, n: spread + 1 });\n }, [coveredNow, spread, spreadKey]);\n // HC: the drawn height on screen with the gaps the drag added; dragged above it, the frame is shorter and scrolls.\n const drawnH = H * scale;\n const naturalH = drawnH - Math.max(0, dh);\n const frameH = p.resizable && dh < 0 ? Math.max(Math.min(MIN_FRAME, naturalH), naturalH + dh) : null;\n const dragTo = (v: number) => Math.max(Math.min(MIN_FRAME, naturalH) - naturalH, Math.min(v, between ? MAX_EXTRA * between * scale : 0));\n return (\n <div className={cx('ui-graph ui-lg', pickEdge && 'has-pick', p.className)}>\n {p.listView === false && !toggleShown && !p.toolbar ? null : (\n <div className=\"ui-lg-bar\">\n {p.toolbar ? <div className=\"ui-lg-toolbar\">{p.toolbar}</div> : null}\n {toggleShown && p.labelToggle === 'icon' ? (\n // TC: a tag button beside 「圖/清單」; pressed (accent-soft, filled tag) while every label shows.\n <IconButton className=\"ui-lg-labels-btn\" icon=\"tag\" filled={labelsOn} label={tr('顯示線上文字')} aria-pressed={labelsOn} onClick={switchLabels} />\n ) : toggleShown ? (\n // A Switch with its text beside 「圖/清單」: on while every label shows, which reads the same on screen,\n // with no tooltip on a phone, as to a screen reader. The text is the label: a click on it switches too.\n <label className=\"ui-lg-labels-switch\">\n <Switch checked={labelsOn} onChange={switchLabels} label={tr('線上文字')} />\n <span aria-hidden=\"true\">{tr('線上文字')}</span>\n </label>\n ) : null}\n {p.listView === false ? null : (\n // The same content shown two ways: a SegmentedControl, not Tabs.\n <SegmentedControl\n label={tr('顯示方式')}\n value={view}\n onChange={setView}\n options={[\n { value: 'graph', label: tr('圖') },\n { value: 'list', label: tr('清單') },\n ]}\n />\n )}\n </div>\n )}\n {showList ? list : null}\n <div className={cx('ui-lg-scroller', scrollMore && 'has-more', showList && 'is-hidden')}>\n <div\n className={cx('ui-lg-scroll', frameH != null && 'is-framed')}\n ref={scrollRef}\n onScroll={onScrollKeep}\n style={frameH != null ? { height: frameH } : undefined}\n >\n <div\n ref={canvasRef}\n className=\"ui-lg-canvas\"\n style={\n scale === 1\n ? { width: W, height: H }\n : ({\n width: W,\n height: H,\n transform: `scale(${scale})`,\n transformOrigin: '0 0',\n marginRight: W * (scale - 1),\n marginBottom: H * (scale - 1),\n // Touch areas grow back to 48 px on screen (styles.css).\n '--lg-scale': scale,\n } as React.CSSProperties)\n }\n role=\"group\"\n aria-label={p.label || tr('架構圖')}\n // Hover on a line, its label or its number: one listener for all (see setHover), so the parts drawn by the\n // memoised routing carry only data-hover. Keyboard focus on a line shows its hidden label the same way.\n onPointerOver={(e) => setHover((e.target as Element).closest('[data-hover]')?.getAttribute('data-hover') ?? null)}\n onPointerLeave={() => setHover(null)}\n onFocus={(e) => peek && setHover((e.target as Element).closest('[data-hover]')?.getAttribute('data-hover') ?? null)}\n onBlur={() => peek && setHover(null)}\n // A click on the empty diagram clears the selected edge.\n onClick={pickEdge && p.selectedEdge != null ? () => pickEdge(null) : undefined}\n >\n <svg width={W} height={H} viewBox={`0 0 ${W} ${H}`} aria-hidden=\"true\">\n {paths}\n </svg>\n {nodes}\n {labels}\n {hitPaths.length && !pickEdge ? (\n // Hover-only paths (edgeLabels 'hover' without onSelectEdge): nothing to read or reach by keyboard.\n <svg className=\"ui-lg-hits\" width={W} height={H} viewBox={`0 0 ${W} ${H}`} aria-hidden=\"true\">\n {hitPaths}\n </svg>\n ) : hitPaths.length ? (\n // A group, not the default image: screen readers would hide the line buttons inside an image.\n <svg className=\"ui-lg-hits\" width={W} height={H} viewBox={`0 0 ${W} ${H}`} role=\"group\" aria-label={tr('關係')}>\n {hitPaths}\n </svg>\n ) : null}\n </div>\n </div>\n </div>\n {p.resizable && !showList ? (\n <HeightHandle\n value={Math.round(drawnH + Math.min(0, dh))}\n min={Math.round(Math.min(MIN_FRAME, drawnH))}\n max={Math.round(drawnH - Math.max(0, dh) + MAX_EXTRA * between * scale)}\n onDrag={(d) => setDh(dragTo(d))}\n onKey={(step) => setDh(dragTo(dh + step))}\n onReset={() => setDh(0)}\n start={() => dh}\n presets={[dragTo(-Infinity), 0, dragTo(Infinity)]}\n onStep={(d) => {\n const next = dragTo(d);\n setDh(next);\n announce(tr('架構圖高度 {n} px', { n: Math.round(naturalH + next) }));\n }}\n />\n ) : null}\n {showList ? null : <ScrollHint show={overflows} done={scrolled} />}\n {showList || !numbered.length ? null : (\n // NA: the text of each numbered line, in number order, under the diagram.\n <ol className=\"ui-lg-numlist\" aria-label={tr('編號的線')}>\n {numbered.map((o) => (\n <li key={o.n} className={cx(o.m.dim && 'is-dim')}>\n <span className=\"ui-lg-num is-static\" aria-hidden=\"true\">\n {o.n}\n </span>\n <span>{labelParts(o.m.text)}</span>\n </li>\n ))}\n </ol>\n )}\n {shared.length && !showList ? (\n <div className=\"ui-lg-shared\">\n <div className=\"ui-lg-shared-title\">{p.sharedLabel || tr('共用項目')}</div>\n <div className=\"ui-lg-chips\">{sharedBoxes}</div>\n </div>\n ) : null}\n {showList || p.legend === false || (!p.legendItems && !edges.some((e) => pos[e.from] && pos[e.to])) ? null : (\n <GraphLegend\n items={\n p.legendItems || [\n // Only kinds of line the diagram has: a diagram of inferred lines alone gets no 「次數越多線越粗」.\n ...(edges.some((e) => !lab(e) && pos[e.from] && pos[e.to]) ? [{ type: 'weight' as const, label: tr('次數越多線越粗') }] : []),\n ...(edges.some((e) => e.inferred && !e.declared && pos[e.from] && pos[e.to])\n ? [{ type: 'inferred' as const, label: p.inferredLabel || tr('推測的關係'), text: p.inferredText }]\n : []),\n ...(edges.some((e) => e.declared && pos[e.from] && pos[e.to])\n ? [{ type: 'declared' as const, label: p.declaredLegend || tr('專案宣告的關係'), text: p.declaredText }]\n : []),\n ]\n }\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmBA,aAAaA,cAAQC,WAAK;AAgK1B,MAAM,aAAa;CACjB,WAAW;CACX,YAAY;CACZ,eAAe;CACf,aAAa;CACb,YAAY;CACZ,UAAU;CACV,eAAe;CACf,cAAc;CACd,eAAe;CACf,gBAAgB;CAChB,cAAc;AAChB;;;AAIA,SAAS,aAAa,GAAqC;CACzD,MAAM,MAAO,OAAO,KAAK,UAAU,CAAC,CAAiC,QAAQ,MAAM,EAAE,OAAO,KAAA,CAAS;CACrG,QACE,IAAI,SAAS,KAAK,EAAE,eAAe,KAAA,GACnC,cACA,GAAG,CAAC,GAAG,KAAK,GAAI,EAAE,aAAa,CAAC,YAAY,IAAI,CAAC,CAAE,CAAC,CAAC,KAAK,IAAI,EAAE,qCAAqC,IAAI,KAAK,MAAM,WAAW,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,IAAI,EAAE,cAAc,IAAI,SAAS,OAAO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AK,OACpG,oBAAC,aAAD,EACE,OACE,EAAE,eAAe;IAEf,GAAI,MAAM,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,SAAS,IAAI,EAAE,GAAG,IAAI,CAAC;KAAE,MAAM;KAAmB,OAAO,GAAG,SAAS;IAAE,CAAC,IAAI,CAAC;IACpH,GAAI,MAAM,MAAM,MAAM,EAAE,YAAY,CAAC,EAAE,YAAY,IAAI,EAAE,SAAS,IAAI,EAAE,GAAG,IACvE,CAAC;KAAE,MAAM;KAAqB,OAAO,EAAE,iBAAiB,GAAG,OAAO;KAAG,MAAM,EAAE;IAAa,CAAC,IAC3F,CAAC;IACL,GAAI,MAAM,MAAM,MAAM,EAAE,YAAY,IAAI,EAAE,SAAS,IAAI,EAAE,GAAG,IACxD,CAAC;KAAE,MAAM;KAAqB,OAAO,EAAE,kBAAkB,GAAG,SAAS;KAAG,MAAM,EAAE;IAAa,CAAC,IAC9F,CAAC;GACP,EAEH,CAAA;EAEA;;AAET"}
1
+ {"version":3,"file":"LayerGraph.js","names":["phLock","phTag"],"sources":["../../../src/components/LayerGraph/LayerGraph.tsx"],"sourcesContent":["import * as React from 'react';\nimport { GraphLegend, type GraphLegendItem } from '../Graph/Graph';\nimport { SegmentedControl } from '../SegmentedControl/SegmentedControl';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Switch } from '../Switch/Switch';\nimport { tr } from '../../i18n';\nimport { format } from '../../format';\nimport { cx, monoNums, resizeObserver, useFontLoads } from '../../internal/util';\nimport { ScrollHint, useScrollHint } from '../../internal/scrollHint';\nimport { codeSpans } from '../../internal/codeSpans';\nimport { devWarn } from '../../internal/dev';\nimport { announce } from '../../announce';\nimport { DRAG_MIN, nextPreset } from '../../internal/clickSteps';\nimport { useStored } from '../../internal/stored';\nimport { Icon } from '../../icons/Icon';\nimport { includeIcons } from '../../icons/store';\nimport phLock from '../../icons/ph/lock';\nimport phTag from '../../icons/ph/tag';\n\nincludeIcons(phLock, phTag);\n\nexport interface LayerGraphNode {\n /** Unique id: edges, value and onChange use it. */\n id: string;\n /** Shown on the box. Default: the id. */\n name?: string;\n /** The name is code (a path, a file, a module): Geist Mono. Default: the text font, for names in words (「被追蹤的程式」). */\n code?: boolean;\n /** 0 is the top layer. */\n layer?: number;\n /** How big it is (functions, files, endpoints): drawn as the size bar. */\n size?: number;\n /** Used by most others: not drawn as a layer; shown as a small box under the diagram with how often it is used.\n * Selectable like the other boxes (same selected and onSelect): the boxes that use it show 「使用 N 次」. */\n shared?: boolean;\n /** Outside the repository (a traced program, a library): drawn above every layer with a dashed outline and\n * 「外部」 (externalLabel) under the name. Not in any layer and no size bar; its lines, selection and list entry\n * work like any box's. */\n external?: boolean;\n /** A short tag beside the name (「可修改」「受保護」): on the same line, never cut; the name is cut first. In the list\n * and in what a screen reader says too. Keep it to a few characters. */\n tag?: string;\n /** warning: the tag in the warning colors with a lock, for a box that must not be changed. Default neutral. */\n tagTone?: 'neutral' | 'warning';\n}\n\nexport interface LayerGraphEdge {\n /** The id of the box the line starts at. */\n from: string;\n /** The id of the box the arrow points at. */\n to: string;\n /** How often: sets the line width. */\n count?: number;\n /** Inferred by a rule rather than known: dashed and labelled. */\n inferred?: boolean;\n /** Declared by the project, e.g. in a config file, rather than seen by a compiler: long-short dashes and labelled\n * like an inferred edge, but with a basis. Wins over `inferred`. */\n declared?: boolean;\n /** Label of an inferred edge; `backticks` and numbers are in Geist Mono. */\n label?: string;\n /** Names the edge for selectedEdge and onSelectEdge. Default `${from}->${to}`. */\n id?: string;\n}\n\n/** Every text LayerGraph writes, for your domain's words or another language. Pass only the ones to change. */\nexport interface LayerGraphLabels {\n /** Text under a box's size bar: a string with {n}, or a function of the size for words that change with the number\n * (`(n) => n === 1 ? '1 function' : `${n} functions``). Default 「{n} 個項目」. */\n size: string | ((n: number) => string);\n /** A selected edge's count: a string with {n}, or a function of the count. Default 「{n} 次」 (English 「1 call」). */\n count: string | ((n: number) => string);\n /** Under the name of an external box, and after it in the list. Default 「repo 外」. */\n external: string;\n /** Heading of the shared items under the diagram. Default 「共用項目」. */\n shared: string;\n /** A shared item's line; {a} is how many items use it, {b} the total count. Default 「{a} 個項目使用,共 {b} 次」. */\n sharedMeta: string;\n /** On a box that uses the selected shared item; {n} is how often. Default 「使用 {n} 次」. */\n use: string;\n /** Label of inferred edges without their own, and their legend entry. Default 「推測」 (legend 「推測的關係」). */\n inferred: string;\n /** Explains inferred edges in the legend (a Term). */\n inferredText: string;\n /** The word for declared edges, after a label in the list. Default 「宣告」. */\n declared: string;\n /** The legend entry for declared edges. Default 「專案宣告的關係」. */\n declaredLegend: string;\n /** Explains declared edges in the legend (a Term), e.g. which file declares them. */\n declaredText: string;\n /** Heading of the boxes in the list view. Default 「項目」. */\n listNodes: string;\n /** Heading of the lines in the list view. Default 「關係」. */\n listEdges: string;\n}\n\nexport interface LayerGraphProps {\n /** The boxes. */\n nodes: LayerGraphNode[];\n /** The lines between boxes (by id). */\n edges: LayerGraphEdge[];\n /** The selected box's id (controlled); null for none. */\n value?: string | null;\n /** A box picked (its id) or picked again (null). Selecting a box dims everything unrelated and turns its lines\n * accent; it clears the selected edge. */\n onChange?: (id: string | null) => void;\n /** @deprecated use value. */\n selected?: string | null;\n /** @deprecated use onChange. */\n onSelect?: (id: string | null) => void;\n /** The selected edge's id (controlled, like selected). */\n selectedEdge?: string | null;\n /** Makes edges selectable: a click on a line or its label, Enter or Space. null when it is clicked again, on a click on\n * the empty diagram or on Escape. Clears the selected box. Without it, edges cannot be clicked. */\n onSelectEdge?: (id: string | null) => void;\n /** Labels on lines at first: 'shown' (default) always; 'hover' only while the pointer is on the line or its label, the\n * line has keyboard focus, or it is selected or belongs to the selected box. The diagram keeps the room for every\n * label. People switch with the tag button next to 「圖/清單」; their choice is remembered (localStorage). */\n edgeLabels?: 'shown' | 'hover';\n /** The control that shows or hides line labels, shown when the diagram has labelled lines. Default (true or\n * 'switch'): a Switch with the text 「線上文字」, on while labels show. 'icon': the tag icon button with a fixed name\n * and aria-pressed, for a tight toolbar. false: none. */\n labelToggle?: boolean | 'switch' | 'icon';\n /** Box width in px. Default 200. */\n nodeWidth?: number;\n /** Your words for every text LayerGraph writes: { size: '{n} 個函式', count: '呼叫 {n} 次', … }. */\n labels?: Partial<LayerGraphLabels>;\n /** @deprecated use labels.size. */\n sizeLabel?: string | ((n: number) => string);\n /** @deprecated use labels.count. */\n countLabel?: string | ((n: number) => string);\n /** @deprecated use labels.external. */\n externalLabel?: string;\n /** @deprecated use labels.shared. */\n sharedLabel?: string;\n /** @deprecated use labels.sharedMeta. */\n sharedMeta?: string;\n /** @deprecated use labels.use. */\n useLabel?: string;\n /** @deprecated use labels.inferred. */\n inferredLabel?: string;\n /** @deprecated use labels.inferredText. */\n inferredText?: string;\n /** @deprecated use labels.declared. */\n declaredLabel?: string;\n /** @deprecated use labels.declaredLegend. */\n declaredLegend?: string;\n /** @deprecated use labels.declaredText. */\n declaredText?: string;\n /** false hides the legend. By default it lists only the kinds of line the diagram has. */\n legend?: boolean;\n /** Your own legend entries instead of the kinds of line the diagram has. */\n legendItems?: GraphLegendItem[];\n /** Default 「架構圖」. */\n label?: string;\n /** The 「圖/清單」 switch above the diagram; the list shows every box and line as text, also for screen readers.\n * false hides the switch. */\n listView?: boolean;\n /** HC: a handle under the diagram to drag its height, like SplitPane's divider. Down: the layers move apart (the gaps\n * between them grow), so lines and their labels have more room. Up past the drawn height: the diagram scrolls up and\n * down inside a shorter frame. ↑↓ 16 px, Enter or a double-click goes back. Default false. */\n resizable?: boolean;\n /** Remembers the reader's choices in localStorage under this name: the dragged height (ui-lg-height:<name>) and the\n * line-label switch (ui-lg-labels:<name>); it also names the diagram's sideways scroll, kept while the page lives.\n * Without it nothing is stored. */\n storageKey?: string;\n /** @deprecated use storageKey. */\n heightKey?: string;\n /** Controls of the page on the same row as 「圖/清單」, at its left, such as the page's own 「依元件/依檔案」 Tabs,\n * so two switches do not sit on two rows. */\n toolbar?: React.ReactNode;\n /** @deprecated use labels.listNodes and labels.listEdges. */\n listLabels?: { nodes?: string; edges?: string };\n /** @deprecated use storageKey. */\n scrollKey?: string;\n /** Extra class on the root element. */\n className?: string;\n}\n\n// The props each old name moved to (labels, value, onChange, storageKey): read through one object inside.\nconst OLD_LABELS = {\n sizeLabel: 'size',\n countLabel: 'count',\n externalLabel: 'external',\n sharedLabel: 'shared',\n sharedMeta: 'sharedMeta',\n useLabel: 'use',\n inferredLabel: 'inferred',\n inferredText: 'inferredText',\n declaredLabel: 'declared',\n declaredLegend: 'declaredLegend',\n declaredText: 'declaredText',\n} as const;\n\n/** The props with the new names folded into the ones the drawing reads: labels.* into the text props, value and\n * onChange into selected and onSelect, storageKey into the storage names (nothing stored without one). */\nfunction resolveProps(q: LayerGraphProps): LayerGraphProps {\n const old = (Object.keys(OLD_LABELS) as (keyof typeof OLD_LABELS)[]).filter((k) => q[k] !== undefined);\n devWarn(\n old.length > 0 || q.listLabels !== undefined,\n 'LayerGraph',\n `${[...old, ...(q.listLabels ? ['listLabels'] : [])].join(', ')} moved into labels: pass labels={{ ${old.map((k) => OLD_LABELS[k] + ': …').join(', ')}${q.listLabels ? (old.length ? ', ' : '') + 'listNodes: …, listEdges: …' : ''} }}. The old props work until the next release.`,\n );\n devWarn(q.selected !== undefined || q.onSelect !== undefined, 'LayerGraph', 'selected and onSelect are renamed value and onChange; pass those instead.');\n devWarn(q.heightKey !== undefined || q.scrollKey !== undefined, 'LayerGraph', 'heightKey and scrollKey are one prop now: pass storageKey.');\n const l = q.labels ?? {};\n const key = q.storageKey ?? q.heightKey ?? q.scrollKey;\n return {\n ...q,\n selected: q.value !== undefined ? q.value : q.selected,\n onSelect: q.onChange ?? q.onSelect,\n sizeLabel: l.size ?? q.sizeLabel,\n countLabel: l.count ?? q.countLabel,\n externalLabel: l.external ?? q.externalLabel,\n sharedLabel: l.shared ?? q.sharedLabel,\n sharedMeta: l.sharedMeta ?? q.sharedMeta,\n useLabel: l.use ?? q.useLabel,\n inferredLabel: l.inferred ?? q.inferredLabel,\n inferredText: l.inferredText ?? q.inferredText,\n declaredLabel: l.declared ?? q.declaredLabel,\n declaredLegend: l.declaredLegend ?? q.declaredLegend,\n declaredText: l.declaredText ?? q.declaredText,\n listLabels: { nodes: l.listNodes ?? q.listLabels?.nodes, edges: l.listEdges ?? q.listLabels?.edges },\n heightKey: key,\n scrollKey: key,\n };\n}\n\n// Sideways scroll of each diagram, kept while the page lives: by storageKey, or by a short hash of the box ids. At most\n// MEMORY diagrams, the oldest forgotten first, so a page that draws many diagrams does not keep growing it.\nconst scrollMemory = new Map<string, number>();\nconst MEMORY = 50;\nfunction remember(key: string, x: number) {\n scrollMemory.delete(key);\n scrollMemory.set(key, x);\n if (scrollMemory.size > MEMORY) scrollMemory.delete(scrollMemory.keys().next().value as string);\n}\n/** A short key for a list of ids (FNV-1a, 32 bit, plus the count): the same diagram gets the same key. */\nexport function idsKey(ids: string[]): string {\n let h = 0x811c9dc5;\n for (const id of ids) {\n for (let i = 0; i < id.length; i++) h = Math.imul(h ^ id.charCodeAt(i), 0x01000193);\n h = Math.imul(h ^ 0x7c, 0x01000193);\n }\n return ids.length + ':' + (h >>> 0).toString(36);\n}\n\n// Label width before layout: text in the sans font, `code` and numbers in the mono font, as labelParts draws them.\nlet measure: CanvasRenderingContext2D | null | undefined;\nconst NUM = /(\\d[\\d,.]*)/;\n\n/** A label in pieces: `code` (read the same way as CodeText, by codeSpans) and numbers are mono, the rest sans. */\nfunction labelPieces(text: string): { mono: boolean; text: string }[] {\n return codeSpans(text).flatMap((s) =>\n s.code\n ? [{ mono: true, text: s.text }]\n : s.text\n .split(NUM)\n .map((t, i) => ({ mono: i % 2 === 1, text: t }))\n .filter((p) => p.text !== ''),\n );\n}\n\n/** A label with a number: {n} in a string, or a function of the number; the number comes back as \\u0001 (monoNums). */\nfunction withNum(label: string | ((n: number) => string) | undefined, n: number, fallback: (n: number) => string): string {\n if (typeof label === 'function') {\n const t = label(n);\n for (const s of [format.number(n), String(n)]) if (t.includes(s)) return t.replace(s, '\\u0001');\n return t;\n }\n return (label ?? fallback(n)).replace('{n}', '\\u0001');\n}\n\n/** The default for one (「1 call」) where the language has its own word for it, else the {n} form. */\nfunction byCount(n: number, one: string, many: string): string {\n const t = n === 1 ? tr(one) : '';\n return t && t !== one ? t : tr(many);\n}\n\n/** A box reached with the keyboard while partly scrolled out of the diagram's frame (phones): scroll it fully into view,\n * with its focus outline (scroll-margin in styles.css). The browser scrolls only boxes that are wholly out of view. */\nfunction showWhole(e: React.FocusEvent<HTMLElement>) {\n if (e.currentTarget.matches(':focus-visible')) e.currentTarget.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });\n}\n\n/** A canvas to measure text on, or null where there is none (jsdom without a canvas package): widths are then estimated. */\nfunction canvas2d(): CanvasRenderingContext2D | null {\n return typeof CanvasRenderingContext2D === 'function' ? document.createElement('canvas').getContext('2d') : null;\n}\n\n/** The width of text in a font (`600 13px` and mono or sans), measured on a canvas. */\nfunction textWidth(text: string, size: number, code: boolean): number {\n if (measure === undefined) measure = canvas2d();\n const c = measure;\n if (!c) return text.length * size * 0.6;\n const cs = getComputedStyle(document.documentElement);\n c.font = `600 ${size}px ` + ((code ? cs.getPropertyValue('--font-mono') : cs.getPropertyValue('--font-sans')) || 'sans-serif');\n return c.measureText(text).width;\n}\n\n// T: a tag on the name's line leaves the name at least this many characters; fewer, and every tag of the diagram goes\n// on its own line under the name.\nconst TAG_KEEP = 8;\n\n// HC: the shortest frame a dragged diagram keeps (px), and the most each gap between layers grows (px).\nconst MIN_FRAME = 160;\nconst MAX_EXTRA = 200;\n\n/** HC: the bar under the diagram: drag it, ↑↓ 16 px, Enter or a double-click back to the drawn height. A click without\n * dragging (WCAG 2.5.7) steps through the shortest frame, the drawn height and the widest gaps. */\nfunction HeightHandle(p: {\n value: number;\n min: number;\n max: number;\n start: () => number;\n /** The change from the drawn height (px) that each click step goes to, smallest first. */\n presets: number[];\n /** Sets the change from the drawn height (px) of a click step. */\n onStep: (d: number) => void;\n onDrag: (d: number) => void;\n onKey: (step: number) => void;\n onReset: () => void;\n}) {\n const [dragging, setDragging] = React.useState(false);\n const from = React.useRef<{ y: number; d: number; moved: boolean } | null>(null);\n return (\n <div\n className={cx('ui-lg-resize', dragging && 'is-dragging')}\n aria-description={tr('拖曳或按 ↑ ↓ 調整;按一下切換預設高度,按 Enter 還原')}\n role=\"separator\"\n aria-orientation=\"horizontal\"\n aria-label={tr('調整架構圖高度')}\n aria-valuenow={p.value}\n aria-valuemin={p.min}\n aria-valuemax={p.max}\n aria-valuetext={tr('{n} px', { n: p.value })}\n tabIndex={0}\n onPointerDown={(e) => {\n if (e.button !== 0) return;\n e.preventDefault();\n e.currentTarget.setPointerCapture?.(e.pointerId);\n from.current = { y: e.clientY, d: p.start(), moved: false };\n setDragging(true);\n }}\n onPointerMove={(e) => {\n const f = from.current;\n if (!f || (!f.moved && Math.abs(e.clientY - f.y) < DRAG_MIN)) return;\n f.moved = true;\n p.onDrag(f.d + e.clientY - f.y);\n }}\n onPointerUp={() => {\n const f = from.current;\n from.current = null;\n setDragging(false);\n if (f && !f.moved) p.onStep(nextPreset(f.d, p.presets));\n }}\n onPointerCancel={() => {\n from.current = null;\n setDragging(false);\n }}\n onDoubleClick={p.onReset}\n onKeyDown={(e) => {\n if (e.altKey || e.metaKey || e.ctrlKey) return;\n if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n e.preventDefault();\n p.onKey(e.key === 'ArrowUp' ? -16 : 16);\n } else if (e.key === 'Enter') {\n e.preventDefault();\n p.onReset();\n }\n }}\n >\n <span className=\"ui-lg-resize-grip\" aria-hidden=\"true\">\n <i />\n <i />\n <i />\n </span>\n </div>\n );\n}\n\nfunction labelWidth(text: string): number {\n const parts = labelPieces(text);\n if (measure === undefined) measure = canvas2d();\n const c = measure;\n if (!c) return text.length * 9;\n const cs = getComputedStyle(document.documentElement);\n const sans = cs.getPropertyValue('--font-sans') || 'sans-serif';\n const mono = cs.getPropertyValue('--font-mono') || 'monospace';\n return parts.reduce((w, p) => {\n c.font = '600 12px ' + (p.mono ? mono : sans);\n return w + c.measureText(p.text).width;\n }, 0);\n}\n\n// A label of a line up that does not fit on one line: taller gaps, GROW px at a time, up to GROW_MAX px more.\n// The line-label button keeps its choice in localStorage under this prefix and the diagram's key.\nconst LABELS_KEY = 'ui-lg-labels:';\nconst parseOnOff = (raw: string) => {\n if (raw !== '1' && raw !== '0') throw new Error('not a stored choice');\n return raw === '1';\n};\nconst parseHeight = (raw: string) => {\n const v = Number(raw);\n if (!Number.isFinite(v)) throw new Error('not a stored height');\n return v;\n};\nconst GROW = 24;\nconst GROW_MAX = 144;\n\n/** The label on 1 line, then wrapped onto 2, 3 and 4 lines as evenly as it goes. Breaks between Chinese characters\n * and at spaces; never inside `code`, a word or a number, between a number and the word after it, before a closing\n * mark or after an opening one. */\nfunction wraps(text: string): string[][] {\n const atoms: string[] = [];\n for (const t of text.match(/`[^`]+`|[A-Za-z0-9_./:#@-]+|\\s+|[\\s\\S]/gu) ?? []) {\n const prev = atoms[atoms.length - 1];\n // A number keeps the word after it (「3 次」).\n const unit = /\\d\\s*$/.test(prev ?? '') && !/^[A-Za-z0-9_]/.test(t);\n if (prev != null && (unit || /^[)」』、,。:;!?)\\],;!?]/.test(t) || /[(「『([]$/.test(prev))) atoms[atoms.length - 1] = prev + t;\n else atoms.push(t);\n }\n const fill = (max: number) => {\n const lines: string[] = [];\n let cur = '';\n for (const a of atoms) {\n if (/^\\s+$/.test(a)) {\n if (cur) cur += a;\n continue;\n }\n if (cur && labelWidth(cur.trimEnd() + a) > max) {\n lines.push(cur.trimEnd());\n cur = a;\n } else cur += a;\n }\n if (cur.trim()) lines.push(cur.trimEnd());\n return lines;\n };\n const full = labelWidth(text);\n const out: string[][] = [[text]];\n for (let n = 2; n <= 4; n++) {\n // The narrowest width that still needs no more than n lines.\n let lo = Math.max(...atoms.filter((a) => a.trim()).map(labelWidth)) - 1;\n let hi = full;\n while (hi - lo > 1) {\n const mid = (lo + hi) / 2;\n if (fill(mid).length <= n) hi = mid;\n else lo = mid;\n }\n const lines = fill(hi);\n if (lines.length > out[out.length - 1].length) out.push(lines);\n }\n return out;\n}\n\nfunction labelParts(text: string): React.ReactNode[] {\n return labelPieces(text).map((p, i) =>\n p.mono ? (\n <span key={i} className=\"ui-lg-code\">\n {p.text}\n </span>\n ) : (\n p.text\n ),\n );\n}\n\ntype Pt = [number, number];\n\n/** Rounded orthogonal path through the points. */\nfunction route(pts: Pt[], R: number): string {\n let d = `M${pts[0][0]} ${pts[0][1]}`;\n for (let i = 1; i < pts.length - 1; i++) {\n const [a, b, c] = [pts[i - 1], pts[i], pts[i + 1]];\n const r = Math.min(R, Math.abs(b[0] - a[0] + b[1] - a[1]) / 2, Math.abs(c[0] - b[0] + c[1] - b[1]) / 2);\n const ux = Math.sign(b[0] - a[0]);\n const uy = Math.sign(b[1] - a[1]);\n const vx = Math.sign(c[0] - b[0]);\n const vy = Math.sign(c[1] - b[1]);\n d += ` L${b[0] - ux * r} ${b[1] - uy * r} Q${b[0]} ${b[1]} ${b[0] + vx * r} ${b[1] + vy * r}`;\n }\n const z = pts[pts.length - 1];\n return `${d} L${z[0]} ${z[1]}`;\n}\n\n/** Drops repeated points and points in the middle of a straight run. */\nconst clean = (pts: Pt[]): Pt[] =>\n pts\n .filter((q, i) => {\n const o = pts[i - 1];\n return !o || o[0] !== q[0] || o[1] !== q[1];\n })\n .filter((q, i, arr) => {\n const a = arr[i - 1];\n const c = arr[i + 1];\n return !a || !c || !((a[0] === q[0] && q[0] === c[0]) || (a[1] === q[1] && q[1] === c[1]));\n });\n\n/** Architecture as layers of boxes with arrows. Line width shows how often; inferred relations are dashed and labelled;\n * shared items are listed under the diagram instead of drawn. Wider than its box: the boxes narrow (down to 120 px),\n * then the whole diagram scales down (to 0.75 at least); past that it scrolls sideways at full width (PM, WA). */\nexport function LayerGraph(props: LayerGraphProps) {\n const p = resolveProps(props);\n // PM: the width of the box the diagram sits in, and the fit worked out for that width.\n const [avail, setAvail] = React.useState(0);\n // Text is measured on a canvas: until the web fonts load it gets the fallback font's widths. Each finished font load\n // works the fit, the added space and the routing out again, so the result does not depend on when the fonts arrived.\n const fontLoads = useFontLoads();\n const [fit, setFit] = React.useState<{ at: string; nw: number; col: number; scale: number; full?: boolean } | null>(null);\n const fitAt = avail + '@' + fontLoads;\n const fitted = fit && fit.at === fitAt ? fit : null;\n const NW = fitted?.nw ?? (p.nodeWidth || 200);\n const GAP = 56;\n // HC: the dragged height, in screen px from the drawn one: above 0 spreads the layers apart, below 0 makes a\n // shorter frame the diagram scrolls in.\n // 0 on the server and the first browser render, then the stored height (heightKey).\n const [dh, setDh] = useStored(p.resizable && p.heightKey ? 'ui-lg-height:' + p.heightKey : undefined, parseHeight, 0, (v) => String(Math.round(v)));\n // Space added between boxes, 24 px at a time (up to 5 times), while a label still has to cover a line.\n // Kept per diagram and per width: other boxes or lines, or a resized box, start again from no added space.\n const spreadKey = fitAt + '#' + p.nodes.map((n) => n.id).join('|') + '#' + p.edges.map((e) => e.from + '>' + e.to + ':' + (e.label ?? '')).join('|');\n const [spreadAt, setSpread] = React.useState({ key: '', n: 0 });\n const spread = spreadAt.key === spreadKey ? spreadAt.n : 0;\n const COL = (fitted?.col ?? 40) + spread * 24;\n const scale = fitted?.scale ?? 1;\n const PAD = 16;\n const all = p.nodes;\n const sel = p.selected ?? null;\n devWarn(() => all.some((n) => n.external && n.shared), 'LayerGraph', 'a node is both external and shared; it is drawn as shared. Keep one of the two.');\n // External boxes have no size: they are not part of the code being measured.\n const sizeOf = (n: LayerGraphNode) => (n.external && !n.shared ? undefined : n.size);\n const sharedIds = new Set(all.filter((n) => n.shared).map((n) => n.id));\n const main = all.filter((n) => !n.shared);\n // T (option 1): beside the name, a tag would cut some name to fewer than TAG_KEEP characters at this box width: every\n // tag moves to its own line under the name and the boxes grow from 60 to 76 px, so all boxes stay the same height.\n const tagLine = main.some((n) => {\n if (!n.tag) return false;\n const name = n.name || n.id;\n const tagW = textWidth(n.tag, 12, false) + 12 + (n.tagTone === 'warning' ? 15 : 0);\n const room = NW - (n.external ? 24 : 28) - 6 - tagW;\n return room < textWidth(name.slice(0, TAG_KEEP), 13, !!n.code) + (name.length > TAG_KEEP ? 1 : 0);\n });\n const NH = tagLine ? 76 : 60;\n const shared = all.filter((n) => n.shared);\n const edges = p.edges.filter((e) => !sharedIds.has(e.from) && !sharedIds.has(e.to));\n // Lines with a label of their own and no count: inferred, or declared by the project (DC).\n const lab = (e: LayerGraphEdge) => !!(e.inferred || e.declared);\n const byLayer = new Map<number, LayerGraphNode[]>();\n // External boxes form a row of their own above every layer; their lines then route like any other.\n const EXTERNAL = Number.NEGATIVE_INFINITY;\n for (const n of main) {\n const l = n.external ? EXTERNAL : n.layer || 0;\n byLayer.set(l, [...(byLayer.get(l) ?? []), n]);\n }\n const layers = [...byLayer.keys()].sort((a, b) => a - b);\n const cols = Math.max(1, ...layers.map((l) => byLayer.get(l)?.length ?? 0));\n let W = PAD * 2 + cols * NW + (cols - 1) * COL;\n // The gap under each layer: GAP, or more where the label of a line up needs the room (see the placement below).\n // HC: dragged down, the extra height is shared by the gaps between layers (at most 200 px more each).\n const between = Math.max(0, layers.length - 1);\n const extra = p.resizable && dh > 0 && between ? Math.min(MAX_EXTRA, dh / scale / between) : 0;\n const gaps = layers.map((_, k) => GAP + (k < between ? extra : 0));\n let H = 0;\n const pos: Record<string, { x: number; y: number }> = {};\n const layerIndex: Record<string, number> = {};\n layers.forEach((l, k) => {\n const row = byLayer.get(l) ?? [];\n const off = (W - (row.length * NW + (row.length - 1) * COL)) / 2;\n row.forEach((n, i) => {\n pos[n.id] = { x: off + i * (NW + COL), y: 0 };\n layerIndex[n.id] = k;\n });\n });\n const rowTop = (k: number) => PAD + k * NH + gaps.slice(0, k).reduce((a, b) => a + b, 0);\n // An external box alone in its row keeps its full width when the others narrow (PM), centred where it was, so its\n // name is not cut (「被追蹤的程式」).\n const extRow = byLayer.get(EXTERNAL) ?? [];\n const extW = Math.max(NW, Math.min(p.nodeWidth || 200, W - PAD));\n const boxOf = (id: string) => {\n const wide = extRow.length === 1 && extRow[0].id === id ? extW : NW;\n return { x: pos[id].x + (NW - wide) / 2, w: wide };\n };\n const placeRows = () => {\n for (const id in pos) pos[id].y = rowTop(layerIndex[id]);\n H = rowTop(layers.length - 1) + NH + PAD + (flatRow[layers.length - 1]?.length ? FLAT_ROOM : 0);\n };\n const maxSize = Math.max(1, ...main.map((n) => sizeOf(n) || 0));\n const maxCount = Math.max(1, ...edges.map((e) => e.count || 0));\n // A line to a higher layer (a data channel back up): it leaves the source's right side, runs up a lane along the\n // diagram's right edge and enters the target's right side. The diagram widens on the right for the lanes and labels.\n const isUp = (e: LayerGraphEdge) => !!pos[e.from] && !!pos[e.to] && layerIndex[e.to] < layerIndex[e.from];\n // A line between two boxes of one layer: out of the source's bottom, across the gap below the row, up into the\n // target's bottom (it used to be drawn as a line down and climbed through the target box).\n const isFlat = (e: LayerGraphEdge) => !!pos[e.from] && !!pos[e.to] && e.from !== e.to && layerIndex[e.to] === layerIndex[e.from];\n const flatIn: Record<string, LayerGraphEdge[]> = {};\n const flatRow: Record<number, LayerGraphEdge[]> = {};\n const outs: Record<string, LayerGraphEdge[]> = {};\n const ins: Record<string, LayerGraphEdge[]> = {};\n const upOut: Record<string, LayerGraphEdge[]> = {};\n const upIn: Record<string, LayerGraphEdge[]> = {};\n for (const e of edges) {\n if (!pos[e.from] || !pos[e.to]) continue;\n if (isUp(e)) {\n (upOut[e.from] ??= []).push(e);\n (upIn[e.to] ??= []).push(e);\n continue;\n }\n (outs[e.from] ??= []).push(e);\n if (isFlat(e)) {\n (flatIn[e.to] ??= []).push(e);\n (flatRow[layerIndex[e.from]] ??= []).push(e);\n continue;\n }\n (ins[e.to] ??= []).push(e);\n }\n // The last row's flat lines need room under it; others use the gap below their row.\n const FLAT_ROOM = 20 + 10 * Math.max(0, (flatRow[layers.length - 1]?.length ?? 0) - 1);\n const ups = edges.filter(isUp);\n const rowOf = (id: string) => byLayer.get(layers[layerIndex[id]]) ?? [];\n const rightmost = (id: string) => rowOf(id)[rowOf(id).length - 1]?.id === id;\n const leftmost = (id: string) => rowOf(id)[0]?.id === id;\n // The lane is on the side where the target is the outermost box, so the line can enter its side; the right one\n // when both or neither (then it enters from below).\n const onLeft = (e: LayerGraphEdge) => !rightmost(e.to) && leftmost(e.to);\n const upsL = ups.filter(onLeft);\n const upsR = ups.filter((e) => !onLeft(e));\n const LANE = 20;\n const LANE_STEP = 12;\n for (const k in outs) outs[k].sort((a, b) => pos[a.to].x - pos[b.to].x);\n for (const k in ins) ins[k].sort((a, b) => pos[a.from].x - pos[b.from].x);\n const edgeId = (e: LayerGraphEdge) => e.id ?? `${e.from}->${e.to}`;\n const pickEdge = p.onSelectEdge;\n // edgeLabels on the server and the first browser render, then the reader's stored choice. Remembered only with\n // storageKey: without one nothing is read or written.\n const [labelsOn, setLabelsOn] = useStored(p.scrollKey ? LABELS_KEY + p.scrollKey : undefined, parseOnOff, p.edgeLabels !== 'hover', (v) => (v ? '1' : '0'));\n const peek = !labelsOn;\n const switchLabels = () => setLabelsOn(!labelsOn);\n // The hovered line: every part of it (line, label, number) gets is-hl straight in the DOM, so a hover never renders\n // the diagram again or reruns its routing. Put back after a render (React rewrites className).\n const canvasRef = React.useRef<HTMLDivElement>(null);\n const hoverRef = React.useRef<string | null>(null);\n const paintHover = React.useCallback(() => {\n const root = canvasRef.current;\n if (!root) return;\n for (const el of root.querySelectorAll<Element>('[data-hl]')) el.classList.toggle('is-hl', el.getAttribute('data-hl') === hoverRef.current);\n }, []);\n const setHover = React.useCallback(\n (id: string | null) => {\n if (hoverRef.current === id) return;\n hoverRef.current = id;\n paintHover();\n },\n [paintHover],\n );\n React.useLayoutEffect(paintHover);\n // Wider than its box: a fade on the right while more is to the right, and a 「左右滑動」 hint until the first scroll.\n const { ref: scrollRef, more: scrollMore, overflows, scrolled, onScroll, measure: measureHint } = useScrollHint();\n const uid = React.useId().replace(/:/g, '');\n const [view, setView] = React.useState<'graph' | 'list'>('graph');\n const memKey = p.scrollKey ?? idsKey(all.map((n) => n.id));\n // Back to the same diagram: where it was scrolled to (FB).\n React.useLayoutEffect(() => {\n const el = scrollRef.current;\n const x = scrollMemory.get(memKey);\n if (el && x) el.scrollLeft = x;\n }, [memKey, view, scrollRef]);\n const onScrollKeep = () => {\n const el = scrollRef.current;\n if (el) remember(memKey, el.scrollLeft);\n onScroll();\n };\n const selEdge = (pickEdge && edges.find((e) => edgeId(e) === p.selectedEdge)) || null;\n // The list shows every edge, those into a shared item too (not drawn on the diagram): each can be selected there.\n const selListEdge = (pickEdge && p.edges.find((e) => edgeId(e) === p.selectedEdge)) || null;\n const nodeIdsAll = new Set(all.map((n) => n.id));\n // How often each item uses each shared item (edges into a shared item are not drawn). Other shared items count too,\n // so the shared item's line and the list (which shows every edge) give the same numbers.\n const uses: Record<string, Record<string, number>> = {};\n for (const e of p.edges)\n if (sharedIds.has(e.to) && e.from !== e.to && nodeIdsAll.has(e.from)) (uses[e.to] ??= {})[e.from] = (uses[e.to]?.[e.from] ?? 0) + (e.count || 0);\n const selShared = !selEdge && sel != null && sharedIds.has(sel) ? sel : null;\n // A selected box highlights its edges; a selected edge highlights itself, and both of its boxes stay undimmed;\n // a selected shared item keeps the boxes that use it and dims every line.\n const related = (e: LayerGraphEdge) => (selEdge ? e === selEdge : !!sel && !selShared && (e.from === sel || e.to === sel));\n const focus = !!sel || !!selEdge;\n const near = (id: string) =>\n selEdge\n ? id === selEdge.from || id === selEdge.to\n : selShared\n ? id === selShared || id in (uses[selShared] ?? {})\n : !sel || id === sel || edges.some((e) => related(e) && (e.from === id || e.to === id));\n const pick = (id: string, on: boolean) => {\n if (!on && p.selectedEdge != null) pickEdge?.(null);\n p.onSelect?.(on ? null : id);\n };\n const nameOf = (id: string) => all.find((n) => n.id === id)?.name || id;\n const countText = (e: LayerGraphEdge) => {\n const n = e.count ?? 0;\n return typeof p.countLabel === 'function' ? p.countLabel(n) : (p.countLabel ?? byCount(n, '1 次', '{n} 次')).replace('{n}', format.number(n));\n };\n // The label a line down gets: its own label for an inferred line, else its count (when related to the selection).\n // Two or more lines with the same label (「執行 worker」 from two boxes) cannot be told apart: each gets its source in\n // front, 「來自 src/cli,…」.\n // In a language with capitals, 「Passes data…」 after 「From x, 」 starts lower case (not an acronym like 「SHM」).\n const midSentence = (t: string) => (/^[A-Z][a-z]/.test(t) && !/^zh/i.test(format.locale()) ? t[0].toLowerCase() + t.slice(1) : t);\n // Only labels the app wrote: lines without one all show the same 「推測」, and that needs no source.\n const sameLabel = new Map<string, number>();\n for (const e of edges) if (lab(e) && e.label && pos[e.from] && pos[e.to]) sameLabel.set(e.label, (sameLabel.get(e.label) ?? 0) + 1);\n const kindWord = (e: LayerGraphEdge) => (e.declared ? p.declaredLabel || tr('宣告') : p.inferredLabel || tr('推測'));\n const inferredText = (e: LayerGraphEdge) =>\n e.label && (sameLabel.get(e.label) ?? 0) > 1 ? tr('來自 {from},{label}', { from: nameOf(e.from), label: midSentence(e.label) }) : e.label || kindWord(e);\n const markText = (e: LayerGraphEdge) => (lab(e) ? inferredText(e) : countText(e));\n // Room beside the boxes for the lanes only: the labels sit beside the lane, between the layers (PB), so they do not\n // widen the diagram. The left side shifts every box right, the right side widens it.\n if (upsL.length) {\n const left0 = Math.min(...main.map((n) => pos[n.id].x));\n const shift = Math.max(0, PAD + (upsL.length - 1) * LANE_STEP + LANE - left0);\n for (const id in pos) pos[id] = { x: pos[id].x + shift, y: pos[id].y };\n W += shift;\n }\n // Read from the boxes each time: they move right when a label is written out past the left edge (below), and the\n // lanes must move with them, or a lane up would run behind the boxes it should pass beside.\n const boxesLeft = () => Math.min(...main.map((n) => pos[n.id].x));\n const boxesRight = () => Math.max(0, ...main.map((n) => pos[n.id].x + NW));\n const laneX = (e: LayerGraphEdge) => (onLeft(e) ? boxesLeft() - LANE - upsL.indexOf(e) * LANE_STEP : boxesRight() + LANE + upsR.indexOf(e) * LANE_STEP);\n // A label starts just inside the innermost lane on the left, or ends just inside it on the right.\n const upLabelX = () => boxesLeft() - LANE + 8;\n const upLabelEndL = () => boxesRight() + LANE - 8;\n if (upsR.length) W = Math.max(W, boxesRight() + LANE + (upsR.length - 1) * LANE_STEP + PAD);\n const choose = (e: LayerGraphEdge) => {\n const id = edgeId(e);\n const next = p.selectedEdge === id ? null : id;\n if (next && sel != null) p.onSelect?.(null);\n pickEdge?.(next);\n };\n\n // MA: two or more labelled lines down into one box each make their last turn at a height of their own in the gap\n // above it, LANE_H px apart, the rightmost arrow lowest; each label sits on its own line's height just past its\n // turn, so no other line runs through it. labelled: the lines that get a label (inferred, or related to the\n // selection, which shows the count).\n const LANE_H = 28;\n const txOf = (e: LayerGraphEdge) => Math.round(pos[e.to].x + (NW * (ins[e.to].indexOf(e) + 1)) / (ins[e.to].length + 1));\n const laneGroups: Record<string, LayerGraphEdge[]> = {};\n const laneCount: Record<string, number> = {};\n {\n const into: Record<string, LayerGraphEdge[]> = {};\n for (const e of edges) if (ins[e.to]?.includes(e) && (lab(e) || related(e))) (into[e.to] ??= []).push(e);\n for (const id in into) {\n if (into[id].length < 2) continue;\n // The rightmost arrow first: lane 0 (the lowest) in the default order.\n laneGroups[id] = into[id].sort((a, b) => txOf(b) - txOf(a));\n laneCount[id] = into[id].length;\n }\n }\n // Draws every line and places every label. A label of a line up that finds no spot clear of every line, even\n // wrapped, asks for a taller gap; the diagram is then drawn again with it.\n const draw = () => {\n const paths: React.ReactNode[] = [];\n const labels: React.ReactNode[] = [];\n const need = new Set<number>();\n // Gaps where a label found no spot even covering a line (it would sit on a box or another label).\n const crowd = new Set<number>();\n // Labels that found no spot clear of every line and cover one: the space between boxes then grows (see spread).\n let covered = 0;\n // Where a line down leaves, turns and arrives (no lanes yet): shared by the lane search and the drawing.\n const geomOf = (e: LayerGraphEdge) => {\n const a = pos[e.from];\n const b = pos[e.to];\n const oi = outs[e.from].indexOf(e);\n const on = outs[e.from].length;\n const sx = outX(a.x, oi, on);\n const sy = a.y + NH;\n const tx = txOf(e);\n const ty = b.y;\n const off = (oi - (on - 1) / 2) * 6;\n const skip = layerIndex[e.to] - layerIndex[e.from] > 1;\n const y1 = sy + gaps[layerIndex[e.from]] / 2 + off;\n let chx = sx;\n if (skip) {\n // Skipping a layer: go down a channel between the boxes of the next layer, the one nearest the middle.\n const next = (byLayer.get(layers[layerIndex[e.from] + 1]) ?? []).map((n) => pos[n.id]);\n const mid = (sx + tx) / 2;\n const chans = [next[0].x - COL / 2, ...next.map((q) => q.x + NW + COL / 2)].map((c) => Math.max(PAD / 2, Math.min(W - PAD / 2, c)));\n chx = chans.reduce((best, c) => (Math.abs(c - mid) < Math.abs(best - mid) ? c : best), chans[0]) + off;\n }\n // The last turn starts at from, after a vertical from startY.\n return { sx, sy, tx, ty, off, skip, y1, chx, from: skip ? chx : sx, startY: skip ? y1 : sy };\n };\n // MA: the turn heights of the labelled lines into one box. Every order is tried (up to 6 lines), each label on\n // either side of its own turn, and the order where the most labels miss every vertical line of the group wins;\n // a tie keeps the rightmost arrow lowest. A label still blocked falls back to the search below.\n const lanes = new Map<LayerGraphEdge, { y: number; side: 'right' | 'left' }>();\n // Where the lines leave a box: spread over its whole width, 16 px in from each edge, so the labels of the lines\n // that leave it have room between them; one line leaves from the middle.\n const outX = (x: number, i: number, n: number) => Math.round(n < 2 ? x + NW / 2 : x + 16 + ((NW - 32) * i) / (n - 1));\n // A flat line (same layer): its source x, its run's height in the gap below the row, its target x.\n const flatOf = (e: LayerGraphEdge) => {\n const a = pos[e.from];\n const b = pos[e.to];\n const oi = outs[e.from].indexOf(e);\n const on = outs[e.from].length;\n const sx = outX(a.x, oi, on);\n const j = flatRow[layerIndex[e.from]].indexOf(e);\n const ti = flatIn[e.to].indexOf(e);\n const tx = Math.round(b.x + NW - 24 - ti * 12);\n return { sx, sy: a.y + NH, y: a.y + NH + 14 + j * 10, tx, ty: b.y + NH };\n };\n // The vertical runs of every line, as drawn before lanes are chosen: what a label of the group must also miss\n // (a line skipping a layer down its channel, the lines into other boxes, the lanes of the lines up).\n const vertsOf = (e: LayerGraphEdge) => {\n if (isFlat(e)) {\n const f = flatOf(e);\n return [\n { x: f.sx, y0: f.sy, y1: f.y },\n { x: f.tx, y0: f.ty, y1: f.y },\n ];\n }\n if (isUp(e)) {\n const x = laneX(e);\n return [{ x, y0: pos[e.to].y, y1: pos[e.from].y + NH }];\n }\n const g = geomOf(e);\n if (!g.skip)\n return [\n { x: g.sx, y0: g.sy, y1: g.y1 },\n { x: g.tx, y0: g.y1, y1: g.ty },\n ];\n const y2 = g.ty - gaps[layerIndex[e.to] - 1] / 2 + g.off;\n return [\n { x: g.sx, y0: g.sy, y1: g.y1 },\n { x: g.chx, y0: g.y1, y1: y2 },\n { x: g.tx, y0: y2, y1: g.ty },\n ];\n };\n for (const id in laneGroups) {\n const group = laneGroups[id].map((e) => ({ e, g: geomOf(e), w: Math.ceil(labelWidth(markText(e))) }));\n const others = edges.filter((e) => !laneGroups[id].includes(e) && pos[e.from] && pos[e.to]).flatMap((e) => vertsOf(e).map((v) => ({ k: -1, ...v })));\n const n = group.length;\n const laneY = (j: number) => group[0].g.ty - 8 - 16 - j * LANE_H;\n const perms: number[][] = [];\n const permute = (rest: number[], acc: number[]) => {\n if (!rest.length) perms.push(acc);\n else rest.forEach((x, k) => permute([...rest.slice(0, k), ...rest.slice(k + 1)], [...acc, x]));\n };\n if (n <= 6) permute([...group.keys()], []);\n else perms.push([...group.keys()]);\n let best: { fails: number; ys: number[]; sides: ('right' | 'left')[] } | null = null;\n for (const perm of perms) {\n // perm[j] is the edge on lane j (0 the lowest).\n const ys: number[] = [];\n perm.forEach((k, j) => (ys[k] = laneY(j)));\n const verts = [\n ...group.flatMap((q, k) => [\n { k, x: q.g.from, y0: q.g.startY, y1: ys[k] },\n { k, x: q.g.tx, y0: ys[k], y1: q.g.ty - 8 },\n ]),\n ...others,\n ];\n // Past the left edge is fine: the diagram widens to the left for it.\n const free = (k: number, x0: number, x1: number) =>\n verts.every((v) =>\n v.k === k\n ? !(v.x > x0 - 1 && v.x < x1 + 1 && v.y0 < ys[k] + 7 && v.y1 > ys[k] - 7)\n : !(v.x > x0 - 5 && v.x < x1 + 5 && v.y0 < ys[k] + 10 && v.y1 > ys[k] - 10),\n );\n let fails = 0;\n const sides: ('right' | 'left')[] = [];\n group.forEach((q, k) => {\n const r0 = Math.max(q.g.from, q.g.tx) + 8;\n const l1 = Math.min(q.g.from, q.g.tx) - 8;\n if (free(k, r0, r0 + q.w)) sides[k] = 'right';\n else if (free(k, l1 - q.w, l1)) sides[k] = 'left';\n else {\n sides[k] = 'right';\n fails++;\n }\n });\n if (!best || fails < best.fails) best = { fails, ys, sides };\n if (!fails) break;\n }\n if (best) group.forEach((q, k) => lanes.set(q.e, { y: best.ys[k], side: best.sides[k] }));\n }\n const marks: {\n idx: number;\n e: LayerGraphEdge;\n text: string;\n tx: number;\n ty: number;\n left: boolean;\n r: boolean;\n dim: boolean;\n up?: boolean;\n flat?: boolean;\n lane?: number | null;\n from?: number;\n side?: 'right' | 'left';\n }[] = [];\n // How far right the labels reach: the diagram widens to keep a label whole (MA).\n let wide = 0;\n let least = 0;\n // Lines that labels must not cover: the horizontal runs of the up lines, as [left, right, top, bottom].\n const runs: number[][] = [];\n // Every straight piece of every line, for the labels of up lines.\n const segs: { idx: number; box: number[] }[] = [];\n // Each line's corner points, for the search along its own line.\n const ptsOf: Record<number, Pt[]> = {};\n const arrows: number[][] = [];\n const hitPaths: React.ReactNode[] = [];\n edges.forEach((e, idx) => {\n const a = pos[e.from];\n const b = pos[e.to];\n if (!a || !b) return;\n const r = related(e);\n const dim = focus && !r;\n const picked = e === selEdge;\n const up = isUp(e);\n let pts: Pt[];\n let tx: number;\n let ty: number;\n let arrow: string;\n let inn = 1;\n // MA: the height of the line's last turn and where that turn starts (see laneOf).\n let laneAt: number | null = null;\n let turnFrom = 0;\n let laneSide: 'right' | 'left' = 'right';\n if (up) {\n const lx = laneX(e);\n const L = onLeft(e);\n const si = upOut[e.from].indexOf(e);\n const sn = upOut[e.from].length;\n const ti = upIn[e.to].indexOf(e);\n const tn = upIn[e.to].length;\n const start: Pt[] = [];\n let y0: number;\n if (L ? leftmost(e.from) : rightmost(e.from)) {\n // From the right side, a little apart when several leave the same box.\n y0 = Math.round(a.y + NH / 2 + (si - (sn - 1) / 2) * 10);\n start.push([L ? a.x : a.x + NW, y0], [lx, y0]);\n } else {\n // A box to its right: leave from the top edge, just under the lines of the gap above.\n const px = L ? a.x + 20 + si * 10 : a.x + NW - 20 - si * 10;\n y0 = a.y - 12 - si * 6;\n start.push([px, a.y], [px, y0], [lx, y0]);\n }\n let y1: number;\n if (L || rightmost(e.to)) {\n // Into the side facing the lane, the arrow pointing at the box.\n y1 = Math.round(b.y + NH / 2 + (ti - (tn - 1) / 2) * 10);\n tx = L ? b.x : b.x + NW;\n ty = y1;\n const back = L ? tx - 9 : tx + 9;\n pts = [...start, [lx, y1], [back, y1]];\n arrow = `M${back} ${ty - 5} L${back} ${ty + 5} L${tx} ${ty} Z`;\n arrows.push([Math.min(tx, back), Math.max(tx, back), ty - 5, ty + 5]);\n runs.push([Math.min(tx, lx), Math.max(tx, lx), y1 - 3, y1 + 3]);\n } else {\n // A box to its right: come in from below, into the bottom edge.\n tx = b.x + NW - 20 - ti * 10;\n y1 = b.y + NH + 12 + ti * 6;\n ty = b.y + NH;\n pts = [...start, [lx, y1], [tx, y1], [tx, ty + 9]];\n arrow = `M${tx - 5} ${ty + 9} L${tx + 5} ${ty + 9} L${tx} ${ty} Z`;\n arrows.push([tx - 5, tx + 5, ty, ty + 9]);\n runs.push([tx, lx, y1 - 3, y1 + 3]);\n }\n const sx0 = start[start.length - 2][0];\n runs.push([Math.min(sx0, lx), Math.max(sx0, lx), y0 - 3, y0 + 3]);\n if (lab(e) || r) {\n const text = markText(e);\n marks.push({ idx, e, text, tx: L ? upLabelX() : upLabelEndL(), ty: Math.round((y0 + y1) / 2), left: !L, r, dim, up: true });\n }\n } else if (isFlat(e)) {\n const f = flatOf(e);\n tx = f.tx;\n ty = f.ty;\n pts = [\n [f.sx, f.sy],\n [f.sx, f.y],\n [f.tx, f.y],\n [f.tx, f.ty + 9],\n ];\n arrow = `M${tx - 5} ${ty + 9} L${tx + 5} ${ty + 9} L${tx} ${ty} Z`;\n arrows.push([tx - 5, tx + 5, ty, ty + 9]);\n runs.push([Math.min(f.sx, f.tx), Math.max(f.sx, f.tx), f.y - 3, f.y + 3]);\n if (lab(e) || r) {\n const text = markText(e);\n marks.push({ idx, e, text, tx: Math.round((f.sx + f.tx) / 2), ty: f.y, left: false, r, dim, flat: true });\n }\n } else {\n inn = ins[e.to].length;\n const g = geomOf(e);\n const { sx, sy, skip } = g;\n tx = g.tx;\n ty = g.ty;\n const lane = lanes.get(e);\n const laneY = lane ? lane.y : null;\n const y1 = !skip && laneY != null ? laneY : g.y1;\n if (skip) {\n const y2 = laneY ?? ty - gaps[layerIndex[e.to] - 1] / 2 + g.off;\n pts = [\n [sx, sy],\n [sx, y1],\n [g.chx, y1],\n [g.chx, y2],\n [tx, y2],\n [tx, ty - 8],\n ];\n } else {\n pts = [\n [sx, sy],\n [sx, y1],\n [tx, y1],\n [tx, ty - 8],\n ];\n }\n turnFrom = g.from;\n laneAt = laneY;\n laneSide = lane?.side ?? 'right';\n arrow = `M${tx - 5} ${ty - 9} L${tx + 5} ${ty - 9} L${tx} ${ty} Z`;\n arrows.push([tx - 5, tx + 5, ty - 9, ty]);\n }\n // Hover on a selectable line: darker and 2 px thicker (CSS, from --lg-w).\n const w = (lab(e) ? 1.5 : 1.5 + 5.5 * ((e.count || 0) / maxCount)) + (picked ? 1.5 : 0);\n const cpts = clean(pts);\n ptsOf[idx] = cpts;\n for (let k = 1; k < cpts.length; k++) {\n const [ax, ay] = cpts[k - 1];\n const [bx, by] = cpts[k];\n segs.push({ idx, box: [Math.min(ax, bx) - 3, Math.max(ax, bx) + 3, Math.min(ay, by) - 3, Math.max(ay, by) + 3] });\n }\n const d = route(cpts, 10);\n paths.push(\n <path\n key={'p' + idx}\n className={cx('ui-lg-edge', e.declared ? 'is-declared' : e.inferred && 'is-inferred', r && 'is-related', dim && 'is-dim')}\n data-hl={edgeId(e)}\n d={d}\n strokeWidth={w}\n style={{ '--lg-w': w } as React.CSSProperties}\n />,\n );\n if (!pickEdge && peek) {\n // edgeLabels 'hover' without selectable lines: an invisible path that only shows the label while hovered.\n hitPaths.push(<path key={'h' + idx} className=\"ui-lg-hit is-peek\" d={d} data-hover={edgeId(e)} />);\n }\n if (pickEdge) {\n // An invisible 12 px path over the line: the click and keyboard target.\n hitPaths.push(\n <path\n key={'h' + idx}\n className=\"ui-lg-hit\"\n data-edge={edgeId(e)}\n d={d}\n role=\"button\"\n tabIndex={0}\n aria-label={tr('{from} 到 {to},{what}', {\n from: nameOf(e.from),\n to: nameOf(e.to),\n what: markText(e).replace(/`/g, ''),\n })}\n aria-pressed={picked}\n onClick={(ev) => {\n ev.stopPropagation();\n choose(e);\n }}\n data-hover={edgeId(e)}\n onKeyDown={(ev) => {\n if (ev.key === 'Enter' || ev.key === ' ') {\n ev.preventDefault();\n choose(e);\n } else if (ev.key === 'Escape' && picked) pickEdge(null);\n }}\n />,\n );\n }\n paths.push(<path key={'a' + idx} className={cx('ui-lg-arrow', r && 'is-related', dim && 'is-dim')} d={arrow} />);\n if (!up && !isFlat(e) && (lab(e) || r)) {\n const text = markText(e);\n // Several arrows into one box: an arrow in the left half puts its label on its left.\n marks.push({ idx, e, text, tx, ty, left: inn > 1 && tx < b.x + NW / 2, r, dim, lane: laneAt, from: turnFrom, side: laneSide });\n }\n });\n // Labels sit beside their arrowheads, inside the diagram; one that would touch a placed label or an arrowhead moves up 18 px.\n // Obstacles are [left, right, top, bottom, gap].\n const placed = [...arrows, ...runs];\n // Boxes, which the labels of up lines (placed in the gaps beside the lanes) must not cover.\n const boxRects = main.map((n) => [boxOf(n.id).x, boxOf(n.id).x + boxOf(n.id).w, pos[n.id].y, pos[n.id].y + NH]);\n const hits = (x0: number, x1: number, y0: number, y1: number) =>\n placed.some((q) => x0 < q[1] + (q[4] || 0) && q[0] < x1 + (q[4] || 0) && y0 < q[3] && q[2] < y1);\n // On its own line: the line itself, not the room around it, since the label sits beside its own arrowhead and lane.\n const cross = (q: number[], x0: number, lw: number, y0: number, y1: number) => x0 < q[1] - 1 && q[0] + 1 < x0 + lw && y0 < q[3] - 1 && q[2] + 1 < y1;\n // Along its own line: beside each vertical run (either side) and above or below each horizontal run, every 6 px,\n // on one line or wrapped; clear of every other line, box, arrowhead and placed label. The clear spot nearest the\n // arrowhead wins. Used when the spots beside the arrowhead (or the lane, for a line up) are all blocked.\n // How far a label's box is from a straight piece of line (0 when they touch).\n const gapTo = (b: number[], x0: number, lw: number, y0: number, y1: number) =>\n Math.hypot(Math.max(0, b[0] - (x0 + lw), x0 - b[1]), Math.max(0, b[2] - y1, y0 - b[3]));\n // own: the label must be nearer its own line than any other line, so a reader does not take it for the label of\n // the line beside it.\n // A spot that reads as line idx's: nearer that line than any other (by 4 px), and 8 px clear of every other line\n // (text measured on a canvas can come out a little wider on the page).\n const isMine = (idx: number, x0: number, lw: number, y0: number, y1: number) => {\n let self = Infinity;\n let other = Infinity;\n for (const sg of segs) {\n const d = gapTo(sg.box, x0, lw, y0, y1);\n if (sg.idx === idx) self = Math.min(self, d);\n else other = Math.min(other, d);\n }\n return self + 4 < other && other >= 8;\n };\n const alongLine = (m: { idx: number; text: string; tx: number; ty: number }, own = true) => {\n const pts = ptsOf[m.idx] ?? [];\n const mine = (x0: number, lw: number, y0: number, y1: number) => isMine(m.idx, x0, lw, y0, y1);\n const ok = (x0: number, lw: number, y0: number, y1: number) =>\n (!own || mine(x0, lw, y0, y1)) &&\n x0 >= PAD / 2 &&\n x0 + lw <= W - PAD / 2 &&\n y0 >= 2 &&\n y1 <= H - 2 &&\n !hits(x0 - 2, x0 + lw + 2, y0 - 2, y1 + 2) &&\n !boxRects.some((q) => x0 < q[1] + 4 && q[0] < x0 + lw + 4 && y0 < q[3] + 4 && q[2] < y1 + 4) &&\n !segs.some((sg) =>\n sg.idx === m.idx ? cross(sg.box, x0, lw, y0, y1) : x0 < sg.box[1] + 2 && sg.box[0] < x0 + lw + 2 && y0 < sg.box[3] + 2 && sg.box[2] < y1 + 2,\n );\n for (const lines of wraps(m.text)) {\n const lw = Math.ceil(Math.max(...lines.map(labelWidth)));\n const lh = lines.length * 16;\n let best: { x0: number; top: number; d: number } | null = null;\n for (let k = 1; k < pts.length; k++) {\n const [ax, ay] = pts[k - 1];\n const [bx, by] = pts[k];\n const len = Math.hypot(bx - ax, by - ay);\n for (let t = 0; t <= len; t += 6) {\n const x = ax + ((bx - ax) * t) / len;\n const y = ay + ((by - ay) * t) / len;\n const cands =\n ax === bx\n ? [\n [x + 8, y],\n [x - 8 - lw, y],\n ]\n : [\n [x - lw / 2, y - 6 - lh / 2],\n [x - lw / 2, y + 6 + lh / 2],\n ];\n for (const [x0, top] of cands) {\n // The distance first: a spot no nearer than the best one is not checked against every line.\n const d = Math.hypot(x0 + lw / 2 - m.tx, top - m.ty);\n if (best && d >= best.d) continue;\n if (ok(x0, lw, top - lh / 2, top + lh / 2)) best = { x0, top, d };\n }\n }\n }\n if (best) return { x0: Math.round(best.x0), top: Math.round(best.top), lw, lh, lines };\n }\n return null;\n };\n // NA+B: a label with no spot that reads as its own line's becomes a number on the line; the full text is listed\n // under the diagram, and shows at its old spot (over the lines, on its ground) while the line is hovered or selected.\n const numbered: { n: number; m: (typeof marks)[number]; x: number; y: number }[] = [];\n const numberOn = (m: (typeof marks)[number], near: { x0: number; top: number; lw: number }) => {\n const pts = ptsOf[m.idx] ?? [];\n const cx = near.x0 + near.lw / 2;\n const cy = near.top;\n let best: { x: number; y: number; d: number; clear: boolean } | null = null;\n for (let k = 0; k + 1 < pts.length; k++) {\n const [x1, y1] = pts[k];\n const [x2, y2] = pts[k + 1];\n const len = Math.hypot(x2 - x1, y2 - y1);\n for (let t = 12; t <= len - 12; t += 4) {\n const x = x1 + ((x2 - x1) * t) / len;\n const y = y1 + ((y2 - y1) * t) / len;\n // A 20 px dot, 4 px clear of other lines, boxes, labels and other dots.\n const clear =\n !segs.some((sg) => sg.idx !== m.idx && gapTo(sg.box, x - 14, 28, y - 14, y + 14) === 0) &&\n !boxRects.some((q) => x + 14 > q[0] && x - 14 < q[1] && y + 14 > q[2] && y - 14 < q[3]) &&\n !hits(x - 14, x + 14, y - 14, y + 14) &&\n !numbered.some((o) => Math.hypot(o.x - x, o.y - y) < 28);\n const d = Math.hypot(x - cx, y - cy);\n if (!best || (clear && !best.clear) || (clear === best.clear && d < best.d)) best = { x, y, d, clear };\n }\n }\n const at = best ?? { x: m.tx, y: m.ty - 20 };\n numbered.push({ n: numbered.length + 1, m, x: Math.round(at.x), y: Math.round(at.y) });\n return numbered.length;\n };\n const labelEl = (m: (typeof marks)[number], x0: number, top: number, lines: string[] = [m.text], over = false, num = 0) => (\n // With onSelectEdge the label selects its edge too (a mouse and touch target; keyboard uses the line itself).\n <span\n key={'l' + m.idx}\n // The line's own button carries this text; read once, not again beside it.\n aria-hidden={pickEdge ? true : undefined}\n className={cx(\n 'ui-lg-label',\n // Over a line (no clear spot): a solid ground, so the line stops at the label instead of showing between letters.\n over && 'is-over',\n num > 0 && 'is-numbered',\n num > 0 && m.e === selEdge && 'is-shown',\n pickEdge && 'is-clickable',\n m.r && 'is-related',\n m.dim && 'is-dim',\n // edgeLabels 'hover': hidden until its line is hovered (is-hl), focused or selected; the room stays reserved.\n peek && !m.r && m.e !== selEdge && 'is-quiet',\n )}\n data-hl={edgeId(m.e)}\n style={{ left: x0, top }}\n onClick={\n pickEdge\n ? (ev) => {\n ev.stopPropagation();\n choose(m.e);\n }\n : undefined\n }\n data-hover={pickEdge ? edgeId(m.e) : undefined}\n >\n {lines.map((t, i) => (\n <React.Fragment key={i}>\n {i ? <br /> : null}\n {labelParts(t)}\n </React.Fragment>\n ))}\n </span>\n );\n // A label of a line down with no spot clear of every line waits until every other label has its spot: it then\n // covers a line, and the labels that do have a clear spot keep it.\n const later: (typeof marks)[number][] = [];\n const place = (m: (typeof marks)[number], last: boolean) => {\n const w = Math.ceil(labelWidth(m.text));\n if (m.flat) {\n // Along its own line, nearest the middle of its run; else the gap below the row grows, and as a last resort\n // it sits above the middle of the run.\n let spot = alongLine(m);\n if (!spot) {\n const g = layerIndex[m.e.from];\n if (g < layers.length - 1) need.add(g);\n covered++;\n // Off boxes and labels at least: below the run, moved down 18 px at a time.\n const x0 = Math.max(PAD / 2, Math.min(W - PAD / 2 - w, m.tx - w / 2));\n const taken = (t: number) =>\n hits(x0, x0 + w, t - 10, t + 10) || boxRects.some((q) => x0 < q[1] + 2 && q[0] < x0 + w + 2 && t - 10 < q[3] && q[2] < t + 10);\n let top = m.ty + 14;\n for (let k = 0; k < 8 && taken(top); k++) top += 18;\n spot = { x0, top, lw: w, lh: 16, lines: [m.text] };\n labels.push(labelEl(m, spot.x0, spot.top, spot.lines, true, numberOn(m, spot)));\n return;\n }\n placed.push([spot.x0, spot.x0 + spot.lw, spot.top - spot.lh / 2 - 4, spot.top + spot.lh / 2 + 4, 6]);\n labels.push(labelEl(m, spot.x0, spot.top, spot.lines));\n return;\n }\n if (m.up) {\n // Along its own line, nearest where the line starts, and nearer its own line than any other: a label left\n // between two lines reads as the other line's. Else beside its lane as below.\n const p0 = ptsOf[m.idx]?.[0];\n const near = p0 ? alongLine({ ...m, tx: p0[0], ty: p0[1] }, true) : null;\n if (near) {\n placed.push([near.x0, near.x0 + near.lw, near.top - near.lh / 2 - 4, near.top + near.lh / 2 + 4, 6]);\n labels.push(labelEl(m, near.x0, near.top, near.lines));\n return;\n }\n // Beside its lane, halfway between the two ends (the gap between layers); moved up, then down, off boxes,\n // lines and labels already placed, and kept inside the diagram. On one line when a spot is clear of every\n // line; else wrapped onto 2 to 4 lines, narrower so it fits between the lane and the next line; else the gap\n // grows and it is tried again. Only when the gap cannot grow further may it cover a line, on its white ground.\n const x0Of = (lw: number) => Math.max(PAD / 2, Math.min(W - PAD / 2 - lw, m.left ? m.tx - lw : m.tx));\n const start0 = Math.max(10, Math.min(H - 10, m.ty));\n const find = (x0: number, lw: number, lh: number, withLines: boolean) => {\n const over = (q: number[], y0: number, y1: number) => x0 < q[1] + 4 && q[0] < x0 + lw + 4 && y0 < q[3] + 4 && q[2] < y1 + 4;\n const bad = (y0: number, y1: number) =>\n hits(x0, x0 + lw, y0 - 4, y1 + 4) ||\n boxRects.some((q) => over(q, y0, y1)) ||\n (withLines && segs.some((g) => (g.idx === m.idx ? cross(g.box, x0, lw, y0, y1) : over(g.box, y0, y1)))) ||\n // Beside the lane, but not nearer another line: it would read as that line's.\n (withLines && !isMine(m.idx, x0, lw, y0, y1));\n for (let k = 0; k <= 16; k++)\n for (const dir of k ? [-1, 1] : [0]) {\n const t = start0 + dir * k * 18;\n if (t - lh / 2 >= 2 && t + lh / 2 <= H - 2 && !bad(t - lh / 2, t + lh / 2)) return t;\n }\n return null;\n };\n let spot: { x0: number; top: number; lw: number; lh: number; lines: string[] } | null = null;\n for (const lines of wraps(m.text)) {\n const lw = Math.ceil(Math.max(...lines.map(labelWidth)));\n const lh = lines.length * 16;\n const x0 = x0Of(lw);\n const top = find(x0, lw, lh, true);\n if (top != null) {\n spot = { x0, top, lw, lh, lines };\n break;\n }\n }\n if (!spot) spot = alongLine(m);\n if (!spot) {\n // The gap the label sits in: the one around its middle, else the one just above the line's source.\n const g = Math.max(\n 0,\n Math.min(\n layers.length - 2,\n layers.findIndex((_, k) => k < layers.length - 1 && m.ty < rowTop(k + 1)),\n ),\n );\n need.add(g);\n covered++;\n const x0 = x0Of(w);\n const top = find(x0, w, 16, false);\n if (top == null) crowd.add(g);\n const at = { x0, top: top ?? start0, lw: w, lh: 16, lines: [m.text] };\n labels.push(labelEl(m, at.x0, at.top, at.lines, true, numberOn(m, at)));\n return;\n }\n // 4 px above and below too, so a label placed later does not sit flush against it.\n placed.push([spot.x0, spot.x0 + spot.lw, spot.top - spot.lh / 2 - 4, spot.top + spot.lh / 2 + 4, 6]);\n labels.push(labelEl(m, spot.x0, spot.top, spot.lines));\n return;\n }\n // Beside its arrowhead, on its side (see left), moved up 18 px at a time off labels and arrowheads. Clear of\n // every other line and every box too: else on the other side of the arrowhead, then wrapped onto 2 to 4 lines,\n // then the gap above the arrowhead grows and the diagram is drawn again.\n const g = layerIndex[m.e.to] - 1;\n // It stays in the gap right above its arrowhead: moved past the boxes above, it would sit beside other lines.\n const gapTop = g >= 0 ? rowTop(g) + NH : 0;\n const sideOf = (lw: number) => {\n let left = m.left;\n if (left && m.tx - 8 - lw < 0) left = false;\n else if (!left && m.tx + 8 + lw > W) left = m.tx - 8 - lw >= 0;\n return left;\n };\n const at = (left: boolean, lw: number) => (left ? m.tx - 8 - lw : Math.min(m.tx + 8, W - lw));\n const clear = (x0: number, lw: number, y0: number, y1: number) => {\n const over = (q: number[]) => x0 < q[1] + 2 && q[0] < x0 + lw + 2 && y0 < q[3] + 2 && q[2] < y1 + 2;\n return !hits(x0, x0 + lw, y0, y1) && !boxRects.some(over) && !segs.some((sg) => (sg.idx === m.idx ? cross(sg.box, x0, lw, y0, y1) : over(sg.box)));\n };\n let spot: { x0: number; top: number; lw: number; lh: number; lines: string[] } | null = null;\n // MA: on its own turn's height, just past the turn, on one line; the diagram widens for it.\n // One line first; then 2 to 4 lines, narrower, still centred on its turn's height beside the turn.\n if (m.lane != null) {\n const lane = m.lane;\n for (const lines of wraps(m.text)) {\n if (spot) break;\n const lw = Math.ceil(Math.max(...lines.map(labelWidth)));\n const lh = lines.length * 16;\n const right = Math.max(m.tx, m.from ?? m.tx) + 8;\n const left = Math.min(m.tx, m.from ?? m.tx) - 8 - lw;\n // Past the left edge is allowed: the diagram then widens to the left (see the shift after drawing).\n for (const x0 of m.side === 'left' ? [left, right] : [right, left])\n if (!spot && clear(x0, lw, lane - lh / 2, lane + lh / 2)) spot = { x0, top: lane, lw, lh, lines };\n }\n }\n for (const lines of spot ? [] : wraps(m.text)) {\n const lw = Math.ceil(Math.max(...lines.map(labelWidth)));\n const lh = lines.length * 16;\n const pref = sideOf(lw);\n for (const left of [pref, !pref]) {\n const x0 = at(left, lw);\n if (x0 < 0 || x0 + lw > W) continue;\n for (let k = 0; k < 8 && !spot; k++) {\n const top = m.ty - 8 - lh / 2 - k * 18;\n if (top - lh / 2 < Math.max(2, gapTop + 2)) break;\n if (clear(x0, lw, top - lh / 2, top + lh / 2)) spot = { x0, top, lw, lh, lines };\n }\n if (spot) break;\n }\n if (spot) break;\n }\n if (!spot) spot = alongLine(m);\n if (!spot && !last) {\n later.push(m);\n return;\n }\n const over = !spot;\n if (!spot) {\n // No spot clear of every line: the gap grows while it can. Meanwhile, and once it cannot, the same search lets\n // the label cover a line (on its white ground), never a box or another label; as a last resort, as before\n // this rule: on its side, moved up off labels only.\n if (g >= 0) need.add(g);\n covered++;\n const offBoxes = (x0: number, lw: number, y0: number, y1: number) =>\n !hits(x0, x0 + lw, y0, y1) && !boxRects.some((q) => x0 < q[1] + 2 && q[0] < x0 + lw + 2 && y0 < q[3] + 2 && q[2] < y1 + 2);\n for (const lines of wraps(m.text)) {\n const lw = Math.ceil(Math.max(...lines.map(labelWidth)));\n const lh = lines.length * 16;\n const pref = sideOf(lw);\n for (const left of [pref, !pref]) {\n const x0 = at(left, lw);\n if (x0 < 0 || x0 + lw > W) continue;\n for (let k = 0; k < 8 && !spot; k++) {\n const top = m.ty - 8 - lh / 2 - k * 18;\n if (top - lh / 2 < Math.max(2, gapTop + 2)) break;\n if (offBoxes(x0, lw, top - lh / 2, top + lh / 2)) spot = { x0, top, lw, lh, lines };\n }\n if (spot) break;\n }\n if (spot) break;\n }\n if (!spot) {\n if (g >= 0) crowd.add(g);\n const x0 = at(sideOf(w), w);\n let top = m.ty - 16;\n for (let k = 0; k < 8 && hits(x0, x0 + w, top - 8, top + 8); k++) top -= 18;\n spot = { x0, top, lw: w, lh: 16, lines: [m.text] };\n }\n }\n if (over) {\n // NA+B: a number on its line; the text shows only while the line is hovered or selected, so it takes no room.\n labels.push(labelEl(m, spot.x0, spot.top, spot.lines, true, numberOn(m, spot)));\n return;\n }\n // 4 px above and below: a label placed later keeps a visible gap from this one (2 px read as touching).\n placed.push([spot.x0, spot.x0 + spot.lw, spot.top - spot.lh / 2 - 4, spot.top + spot.lh / 2 + 4, 6]);\n // 4 px for the label's own padding and the canvas measure's rounding.\n wide = Math.max(wide, spot.x0 + spot.lw + PAD / 2 + 4);\n least = Math.min(least, spot.x0 - PAD / 2 - 4);\n labels.push(labelEl(m, spot.x0, spot.top, spot.lines, over));\n };\n marks\n // Labels beside arrowheads first: their spot is fixed; the labels of lines up then look for room around them.\n .sort((m, n) => Number(!!m.up) - Number(!!n.up) || m.ty - n.ty || m.tx - n.tx)\n .forEach((m) => place(m, false));\n later.forEach((m) => place(m, true));\n // The dots go over the lines; each also shows its line's text while hovered.\n for (const o of numbered)\n labels.push(\n <span\n key={'n' + o.m.idx}\n className={cx('ui-lg-num', o.m.dim && 'is-dim', o.m.e === selEdge && 'is-on')}\n data-hl={edgeId(o.m.e)}\n style={{ left: o.x, top: o.y }}\n aria-hidden=\"true\"\n data-hover={pickEdge ? edgeId(o.m.e) : undefined}\n >\n {o.n}\n </span>,\n );\n return { paths, labels, hitPaths, need, crowd, wide, least, covered, numbered };\n };\n // Layout and routing: placing the rows, routing every line and placing every label, with the redraws that widen gaps\n // and the diagram. Worked out again only when what it depends on changes (boxes, lines, the fit, the added space, the\n // dragged height, the labels' switch, the selection and the label texts), never on a hover. A run moves the boxes and\n // sets W, H and the gaps: kept with the result and put back when it is reused.\n const routed = React.useMemo(() => {\n // Room for the lanes: LANE_H px per labelled line into one box, plus the arrow and a margin.\n for (const id in laneCount) {\n const g = layerIndex[id] - 1;\n if (g >= 0) gaps[g] = Math.max(gaps[g], laneCount[id] * LANE_H + 40);\n }\n // The least each gap gets: GAP, or the lanes' room.\n const floor = gaps.slice();\n placeRows();\n let drawn = draw();\n // At most GROW_MAX / GROW redraws: each one widens every gap that a label asked for.\n const grows = () => [...drawn.need].filter((g) => gaps[g] < floor[g] + GROW_MAX);\n for (let k = 0; k < GROW_MAX / GROW && grows().length; k++) {\n for (const g of grows()) gaps[g] = Math.min(floor[g] + GROW_MAX, gaps[g] + GROW);\n placeRows();\n drawn = draw();\n }\n // A gap that grew to the most and still did not help goes back to GAP: the room bought nothing.\n const stuck = [...drawn.need].filter((g) => gaps[g] >= floor[g] + GROW_MAX);\n if (stuck.length) {\n for (const g of stuck) gaps[g] = floor[g];\n placeRows();\n drawn = draw();\n // Then only as much room as the labels need to cover a line rather than a box or each other (several labelled\n // lines into one box, too close together for any label to miss the others' lines).\n const crowded = () => [...drawn.crowd].filter((g) => stuck.includes(g) && gaps[g] < floor[g] + GROW_MAX);\n for (let k = 0; k < GROW_MAX / GROW && crowded().length; k++) {\n for (const g of crowded()) gaps[g] = Math.min(floor[g] + GROW_MAX, gaps[g] + GROW);\n placeRows();\n drawn = draw();\n }\n }\n // A label written out past the left edge: everything moves right and the diagram widens by as much.\n // Moving the boxes also frees the channels beside them, which can move a label again: up to 3 times.\n for (let k = 0; k < 3 && drawn.least < 0; k++) {\n const shift = Math.ceil(-drawn.least);\n for (const id in pos) pos[id].x += shift;\n // eslint-disable-next-line react-hooks/use-memo, react-hooks/exhaustive-deps -- W is returned with the result and set again after the memo\n W += shift;\n drawn = draw();\n }\n // Past the right edge: the diagram widens to keep it whole.\n if (drawn.wide > W) {\n // eslint-disable-next-line react-hooks/use-memo -- as above\n W = Math.ceil(drawn.wide);\n drawn = draw();\n }\n return { drawn, W, H, gaps: gaps.slice(), pos: Object.fromEntries(Object.entries(pos).map(([k, v]) => [k, { ...v }])) };\n }, [\n p.nodes,\n p.edges,\n NW,\n COL,\n NH,\n extra,\n labelsOn,\n sel,\n p.selectedEdge,\n pickEdge,\n p.onSelect,\n p.countLabel,\n p.inferredLabel,\n p.declaredLabel,\n p.nodeWidth,\n fontLoads,\n ]);\n const drawn = routed.drawn;\n W = routed.W;\n H = routed.H;\n gaps.splice(0, gaps.length, ...routed.gaps);\n for (const id in routed.pos) pos[id] = { ...routed.pos[id] };\n const { paths, labels, hitPaths, numbered } = drawn;\n // Where the boxes start, and where the selected one is: the diagram scrolls there (below).\n const firstX = Math.min(...main.filter((n) => pos[n.id]).map((n) => boxOf(n.id).x), W);\n const selBox = sel != null && pos[sel] ? boxOf(sel) : null;\n const sizeText = (n: number) => withNum(p.sizeLabel, n, () => byCount(n, '1 個項目', '{n} 個項目'));\n const externalText = p.externalLabel ?? tr('外部');\n const useText = p.useLabel ?? tr('使用 {n} 次');\n // T: a short tag beside the name; the name is cut first (flex: none here, min-width: 0 on the name).\n const tagOf = (n: LayerGraphNode) =>\n n.tag ? (\n <span className={cx('ui-lg-tag', n.tagTone === 'warning' && 'is-warning')}>\n {n.tagTone === 'warning' ? <Icon name=\"lock\" size={12} /> : null}\n {n.tag}\n </span>\n ) : null;\n const nodes = main.map((n) => {\n const q = pos[n.id];\n const on = n.id === sel;\n const size = sizeOf(n);\n const used = selShared ? uses[selShared]?.[n.id] : undefined;\n return (\n <button\n key={n.id}\n type=\"button\"\n className={cx('ui-lg-node', n.external && 'is-external', on && 'is-selected', !near(n.id) && 'is-dim')}\n onFocus={showWhole}\n style={{ left: boxOf(n.id).x, top: q.y, width: boxOf(n.id).w, height: NH }}\n aria-pressed={p.onSelect ? on : undefined}\n onClick={p.onSelect ? () => pick(n.id, on) : undefined}\n >\n <span className=\"ui-lg-head\">\n <span className={cx('ui-lg-name', n.code && 'is-code')}>{n.name || n.id}</span>\n {tagLine ? null : tagOf(n)}\n {used ? <span className=\"ui-lg-use\">{monoNums(useText.replace('{n}', '\\u0001'), [used])}</span> : null}\n </span>\n {tagLine ? tagOf(n) : null}\n {n.external ? <span className=\"ui-lg-ext\">{externalText}</span> : null}\n {size != null ? (\n <span className=\"ui-lg-size\">\n <span className=\"ui-lg-track\" aria-hidden=\"true\">\n <span style={{ width: Math.round((size / maxSize) * 100) + '%' }} />\n </span>\n <span className=\"ui-lg-count\">{monoNums(sizeText(size), [format.number(size)])}</span>\n </span>\n ) : null}\n </button>\n );\n });\n const sharedMeta = p.sharedMeta ?? tr('{a} 個項目使用,共 {b} 次');\n const sharedBoxes = shared.map((s) => {\n const by = uses[s.id] ?? {};\n const total = Object.values(by).reduce((a, b) => a + b, 0);\n const on = s.id === sel;\n // A selected box dims the shared items it does not use; a selected shared item keeps the shared items it uses or\n // that use it.\n const dim = !!selEdge || (sel != null && !on && (selShared != null ? !(s.id in (uses[selShared] ?? {})) && !(selShared in by) : !(sel in by)));\n return (\n <button\n key={s.id}\n type=\"button\"\n className={cx('ui-lg-node', 'ui-lg-chip', on && 'is-selected', dim && 'is-dim')}\n onFocus={showWhole}\n aria-pressed={p.onSelect ? on : undefined}\n onClick={p.onSelect ? () => pick(s.id, on) : undefined}\n >\n <span className=\"ui-lg-head\">\n <span className={cx('ui-lg-name', s.code && 'is-code')}>{s.name || s.id}</span>\n {tagOf(s)}\n </span>\n <span className=\"ui-lg-shared-meta\">{monoNums(sharedMeta.replace('{a}', '\\u0001').replace('{b}', '\\u0002'), [Object.keys(by).length, total])}</span>\n </button>\n );\n });\n // The list: every box (name, size) and every line (「A → B:label」), selectable like the diagram (XC).\n const edgeText = (e: LayerGraphEdge) =>\n lab(e) ? (e.label ? tr('{label}({inferred})', { label: e.label, inferred: kindWord(e) }) : kindWord(e)) : countText(e);\n const listItem = (key: string, on: boolean, dim: boolean, onClick: (() => void) | undefined, head: React.ReactNode, rest: React.ReactNode) => (\n <li key={key} className={cx('ui-lg-li', dim && 'is-dim')}>\n {onClick ? (\n <button type=\"button\" className={cx('ui-lg-libtn', on && 'is-selected')} aria-pressed={on} onClick={onClick}>\n {head}\n </button>\n ) : (\n <span className=\"ui-lg-lihead\">{head}</span>\n )}\n {rest}\n </li>\n );\n const nodeIds = new Set(all.map((n) => n.id));\n const list = (\n <div className=\"ui-lg-list\">\n <section aria-labelledby={`${uid}-ln`}>\n <h3 id={`${uid}-ln`} className=\"ui-lg-listtitle\">\n {p.listLabels?.nodes ?? tr('項目')}\n </h3>\n <ul>\n {all.map((n) => {\n const size = sizeOf(n);\n return listItem(\n n.id,\n n.id === sel,\n !near(n.id),\n p.onSelect ? () => pick(n.id, n.id === sel) : undefined,\n <>\n <span className={cx('ui-lg-liname', n.code && 'ui-lg-code')}>{n.name || n.id}</span>\n {tagOf(n)}\n </>,\n n.external && !n.shared ? (\n <span className=\"ui-lg-limeta\">\n {tr(',')}\n {externalText}\n </span>\n ) : size != null ? (\n <span className=\"ui-lg-limeta\">\n {tr(',')}\n {monoNums(sizeText(size), [format.number(size)])}\n </span>\n ) : null,\n );\n })}\n </ul>\n </section>\n <section aria-labelledby={`${uid}-le`}>\n <h3 id={`${uid}-le`} className=\"ui-lg-listtitle\">\n {p.listLabels?.edges ?? tr('關係')}\n </h3>\n <ul>\n {p.edges\n .filter((e) => nodeIds.has(e.from) && nodeIds.has(e.to))\n .map((e, i) =>\n listItem(\n edgeId(e) + ':' + i,\n e === selListEdge,\n focus && !related(e) && !(selShared && e.to === selShared),\n // Every relation, also one into a shared item: the same onSelectEdge as a line on the diagram.\n pickEdge ? () => choose(e) : undefined,\n // The whole line is the button, so its name says what the relation is, as on the diagram: three lines\n // between the same two boxes no longer share the name 「A → B」.\n <>\n <span className=\"ui-lg-code\">{nameOf(e.from)}</span> <span aria-hidden=\"true\">→</span>\n <span className=\"ui-visually-hidden\">{tr('到')}</span> <span className=\"ui-lg-code\">{nameOf(e.to)}</span>\n <span className=\"ui-lg-limeta\">\n {tr(':')}\n {labelParts(edgeText(e))}\n </span>\n </>,\n null,\n ),\n )}\n </ul>\n </section>\n </div>\n );\n const showList = p.listView !== false && view === 'list';\n // Wider than its box (phones): it starts at the boxes' left edge, not at a label written out to their left, so the\n // first boxes show whole without a scroll. With a box selected at the start, at that box. Where it was scrolled to\n // before (scrollMemory) wins.\n const started = React.useRef('');\n React.useLayoutEffect(() => {\n const el = scrollRef.current;\n // Only once the fit is final: scrolling, the boxes back at full width (WA).\n if (!el || showList || !fitted?.full || started.current === memKey) return;\n started.current = memKey;\n if (scrollMemory.get(memKey)) return;\n const x = selBox ? selBox.x + selBox.w / 2 - el.clientWidth / (2 * scale) : firstX - 16;\n el.scrollLeft = Math.max(0, x * scale);\n });\n // A box selected later: scrolled into view if it is not (nearest edge), never further.\n const selX = selBox?.x;\n const selW = selBox?.w;\n React.useEffect(() => {\n const el = scrollRef.current;\n if (!el || showList || selX == null || selW == null) return;\n const l = selX * scale;\n const r = (selX + selW) * scale;\n if (l < el.scrollLeft) el.scrollLeft = Math.max(0, l - 16);\n else if (r > el.scrollLeft + el.clientWidth) el.scrollLeft = r - el.clientWidth + 16;\n }, [sel, selX, selW, scale, showList, scrollRef]);\n // The tag button only where there are labels to hide (inferred lines), and only on the diagram.\n const toggleShown = p.labelToggle !== false && !showList && p.edges.some((e) => lab(e));\n // PM: measure the box; narrow the boxes when the diagram is wider, then scale what is still too wide.\n React.useLayoutEffect(() => {\n const el = scrollRef.current;\n if (!el) return;\n const measure = () => setAvail(el.clientWidth);\n measure();\n const ro = resizeObserver(measure);\n ro?.observe(el);\n return () => ro?.disconnect();\n }, [scrollRef, showList]);\n React.useLayoutEffect(() => {\n if (!avail || showList) return;\n if (!fitted) {\n if (W <= avail + 0.5) return;\n const base = p.nodeWidth || 200;\n // The width to lose, over the columns; the space between columns goes from 40 to 24 px first.\n const lose = W - avail - (cols - 1) * (40 - 24);\n const nw = Math.max(Math.min(base, 120), Math.floor(base - Math.max(0, lose) / cols));\n // eslint-disable-next-line react-hooks/set-state-in-effect -- the width is known only after this layout is drawn\n setFit({ at: fitAt, nw, col: 24, scale: 1 });\n return;\n }\n // Scrolling anyway (WA): the boxes are back at their own width, names whole.\n if (fitted.full) return;\n // W changes after the fit: labels and the space for them widen it. The scale follows every change, so a diagram\n // that grew past its box shrinks again instead of scrolling (PM).\n const s = Math.floor((avail / W) * 1000) / 1000;\n // Smaller than 0.75: the text would be too small to read. It scrolls instead, and since it scrolls anyway the boxes\n // go back to their own width and spacing, so no name is cut (WA).\n if (W > avail + 0.5 && s < 0.75) {\n setFit({ ...fitted, nw: p.nodeWidth || 200, col: 40, scale: 1, full: true });\n return;\n }\n const want = W <= avail + 0.5 ? 1 : s;\n if (want !== fitted.scale) setFit({ ...fitted, scale: want });\n }, [avail, fitAt, showList, fitted, W, p.nodeWidth, cols]);\n // The fade and 「向右捲動」 follow the fit: a new scale changes only the canvas's transform and margins, which neither\n // its ResizeObserver nor its MutationObserver sees, so the overflow is measured again after each change.\n React.useLayoutEffect(() => {\n if (!showList) measureHint();\n }, [measureHint, showList, W, H, scale]);\n // A label still covering a line: more space between boxes, then drawn again (up to 120 px more).\n const coveredNow = drawn.covered;\n React.useLayoutEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- known only after the labels are placed\n if (coveredNow && spread < 5) setSpread({ key: spreadKey, n: spread + 1 });\n }, [coveredNow, spread, spreadKey]);\n // HC: the drawn height on screen with the gaps the drag added; dragged above it, the frame is shorter and scrolls.\n const drawnH = H * scale;\n const naturalH = drawnH - Math.max(0, dh);\n const frameH = p.resizable && dh < 0 ? Math.max(Math.min(MIN_FRAME, naturalH), naturalH + dh) : null;\n const dragTo = (v: number) => Math.max(Math.min(MIN_FRAME, naturalH) - naturalH, Math.min(v, between ? MAX_EXTRA * between * scale : 0));\n return (\n <div className={cx('ui-graph ui-lg', pickEdge && 'has-pick', p.className)}>\n {p.listView === false && !toggleShown && !p.toolbar ? null : (\n <div className=\"ui-lg-bar\">\n {p.toolbar ? <div className=\"ui-lg-toolbar\">{p.toolbar}</div> : null}\n {toggleShown && p.labelToggle === 'icon' ? (\n // TC: a tag button beside 「圖/清單」; pressed (accent-soft, filled tag) while every label shows.\n <IconButton className=\"ui-lg-labels-btn\" icon=\"tag\" filled={labelsOn} label={tr('顯示線上文字')} aria-pressed={labelsOn} onClick={switchLabels} />\n ) : toggleShown ? (\n // A Switch with its text beside 「圖/清單」: on while every label shows, which reads the same on screen,\n // with no tooltip on a phone, as to a screen reader. The text is the label: a click on it switches too.\n <label className=\"ui-lg-labels-switch\">\n <Switch checked={labelsOn} onChange={switchLabels} label={tr('線上文字')} />\n <span aria-hidden=\"true\">{tr('線上文字')}</span>\n </label>\n ) : null}\n {p.listView === false ? null : (\n // The same content shown two ways: a SegmentedControl, not Tabs.\n <SegmentedControl\n label={tr('顯示方式')}\n value={view}\n onChange={setView}\n options={[\n { value: 'graph', label: tr('圖') },\n { value: 'list', label: tr('清單') },\n ]}\n />\n )}\n </div>\n )}\n {showList ? list : null}\n <div className={cx('ui-lg-scroller', scrollMore && 'has-more', showList && 'is-hidden')}>\n <div\n className={cx('ui-lg-scroll', frameH != null && 'is-framed')}\n ref={scrollRef}\n onScroll={onScrollKeep}\n style={frameH != null ? { height: frameH } : undefined}\n >\n <div\n ref={canvasRef}\n className=\"ui-lg-canvas\"\n style={\n scale === 1\n ? { width: W, height: H }\n : ({\n width: W,\n height: H,\n transform: `scale(${scale})`,\n transformOrigin: '0 0',\n marginRight: W * (scale - 1),\n marginBottom: H * (scale - 1),\n // Touch areas grow back to 48 px on screen (styles.css).\n '--lg-scale': scale,\n } as React.CSSProperties)\n }\n role=\"group\"\n aria-label={p.label || tr('架構圖')}\n // Hover on a line, its label or its number: one listener for all (see setHover), so the parts drawn by the\n // memoised routing carry only data-hover. Keyboard focus on a line shows its hidden label the same way.\n onPointerOver={(e) => setHover((e.target as Element).closest('[data-hover]')?.getAttribute('data-hover') ?? null)}\n onPointerLeave={() => setHover(null)}\n onFocus={(e) => peek && setHover((e.target as Element).closest('[data-hover]')?.getAttribute('data-hover') ?? null)}\n onBlur={() => peek && setHover(null)}\n // A click on the empty diagram clears the selected edge.\n onClick={pickEdge && p.selectedEdge != null ? () => pickEdge(null) : undefined}\n >\n <svg width={W} height={H} viewBox={`0 0 ${W} ${H}`} aria-hidden=\"true\">\n {paths}\n </svg>\n {nodes}\n {labels}\n {hitPaths.length && !pickEdge ? (\n // Hover-only paths (edgeLabels 'hover' without onSelectEdge): nothing to read or reach by keyboard.\n <svg className=\"ui-lg-hits\" width={W} height={H} viewBox={`0 0 ${W} ${H}`} aria-hidden=\"true\">\n {hitPaths}\n </svg>\n ) : hitPaths.length ? (\n // A group, not the default image: screen readers would hide the line buttons inside an image.\n <svg className=\"ui-lg-hits\" width={W} height={H} viewBox={`0 0 ${W} ${H}`} role=\"group\" aria-label={tr('關係')}>\n {hitPaths}\n </svg>\n ) : null}\n </div>\n </div>\n </div>\n {p.resizable && !showList ? (\n <HeightHandle\n value={Math.round(drawnH + Math.min(0, dh))}\n min={Math.round(Math.min(MIN_FRAME, drawnH))}\n max={Math.round(drawnH - Math.max(0, dh) + MAX_EXTRA * between * scale)}\n onDrag={(d) => setDh(dragTo(d))}\n onKey={(step) => setDh(dragTo(dh + step))}\n onReset={() => setDh(0)}\n start={() => dh}\n presets={[dragTo(-Infinity), 0, dragTo(Infinity)]}\n onStep={(d) => {\n const next = dragTo(d);\n setDh(next);\n announce(tr('架構圖高度 {n} px', { n: Math.round(naturalH + next) }));\n }}\n />\n ) : null}\n {showList ? null : <ScrollHint show={overflows} done={scrolled} />}\n {showList || !numbered.length ? null : (\n // NA: the text of each numbered line, in number order, under the diagram.\n <ol className=\"ui-lg-numlist\" aria-label={tr('編號的線')}>\n {numbered.map((o) => (\n <li key={o.n} className={cx(o.m.dim && 'is-dim')}>\n <span className=\"ui-lg-num is-static\" aria-hidden=\"true\">\n {o.n}\n </span>\n <span>{labelParts(o.m.text)}</span>\n </li>\n ))}\n </ol>\n )}\n {shared.length && !showList ? (\n <div className=\"ui-lg-shared\">\n <div className=\"ui-lg-shared-title\">{p.sharedLabel || tr('共用項目')}</div>\n <div className=\"ui-lg-chips\">{sharedBoxes}</div>\n </div>\n ) : null}\n {showList || p.legend === false || (!p.legendItems && !edges.some((e) => pos[e.from] && pos[e.to])) ? null : (\n <GraphLegend\n items={\n p.legendItems || [\n // Only kinds of line the diagram has: a diagram of inferred lines alone gets no 「次數越多線越粗」.\n ...(edges.some((e) => !lab(e) && pos[e.from] && pos[e.to]) ? [{ type: 'weight' as const, label: tr('次數越多線越粗') }] : []),\n ...(edges.some((e) => e.inferred && !e.declared && pos[e.from] && pos[e.to])\n ? [{ type: 'inferred' as const, label: p.inferredLabel || tr('推測的關係'), text: p.inferredText }]\n : []),\n ...(edges.some((e) => e.declared && pos[e.from] && pos[e.to])\n ? [{ type: 'declared' as const, label: p.declaredLegend || tr('專案宣告的關係'), text: p.declaredText }]\n : []),\n ]\n }\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmBA,aAAaA,cAAQC,WAAK;AAgK1B,MAAM,aAAa;CACjB,WAAW;CACX,YAAY;CACZ,eAAe;CACf,aAAa;CACb,YAAY;CACZ,UAAU;CACV,eAAe;CACf,cAAc;CACd,eAAe;CACf,gBAAgB;CAChB,cAAc;AAChB;;;AAIA,SAAS,aAAa,GAAqC;CACzD,MAAM,MAAO,OAAO,KAAK,UAAU,CAAC,CAAiC,QAAQ,MAAM,EAAE,OAAO,KAAA,CAAS;CACrG,QACE,IAAI,SAAS,KAAK,EAAE,eAAe,KAAA,GACnC,cACA,GAAG,CAAC,GAAG,KAAK,GAAI,EAAE,aAAa,CAAC,YAAY,IAAI,CAAC,CAAE,CAAC,CAAC,KAAK,IAAI,EAAE,qCAAqC,IAAI,KAAK,MAAM,WAAW,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,IAAI,EAAE,cAAc,IAAI,SAAS,OAAO,MAAM,+BAA+B,GAAG,gDACtO;CACA,QAAQ,EAAE,aAAa,KAAA,KAAa,EAAE,aAAa,KAAA,GAAW,cAAc,2EAA2E;CACvJ,QAAQ,EAAE,cAAc,KAAA,KAAa,EAAE,cAAc,KAAA,GAAW,cAAc,4DAA4D;CAC1I,MAAM,IAAI,EAAE,UAAU,CAAC;CACvB,MAAM,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE;CAC7C,OAAO;EACL,GAAG;EACH,UAAU,EAAE,UAAU,KAAA,IAAY,EAAE,QAAQ,EAAE;EAC9C,UAAU,EAA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