| 347 | .replace(/'/g, '''); |
| 348 | |
| 349 | const wrapText = (value: string, maxChars: number, maxLines: number) => { |
| 350 | const text = value.trim(); |
| 351 | if (!text) return []; |
| 352 | const segments: string[] = []; |
| 353 | let cursor = 0; |
| 354 | while (cursor < text.length && segments.length < maxLines) { |
| 355 | const next = text.slice(cursor, cursor + maxChars); |
| 356 | segments.push(next); |
| 357 | cursor += maxChars; |
| 358 | } |
| 359 | if (cursor < text.length && segments.length > 0) { |
| 360 | segments[segments.length - 1] = `${segments[segments.length - 1]}…`; |
| 361 | } |
| 362 | return segments; |
| 363 | }; |
| 364 | |
| 365 | const nodeBoxWidth = (isRoot: boolean) => (isRoot ? 280 : SVG_NODE_WIDTH); |
| 366 | const nodeBoxHeight = (isRoot: boolean) => (isRoot ? 104 : SVG_NODE_HEIGHT); |