{#each parentLinks.shared as group (group.key)} {@const aCenter = nodeCenter(group.parentA)} {@const bCenter = nodeCenter(group.parentB)} {@const childCenters = group.childIds .map((id) => { const c = nodeCenter(id); return c ? { id, x: c.x, y: c.y } : null; }) .filter((c): c is { id: string; x: number; y: number } => c !== null)} {#if aCenter && bCenter && childCenters.length > 0} {@const midX = (aCenter.x + bCenter.x) / 2} {@const parentBottomY = aCenter.y + NODE_H / 2} {@const childTopY = childCenters[0].y - NODE_H / 2} {@const barY = (parentBottomY + childTopY) / 2} {@const xs = childCenters.map((c) => c.x)} {@const minX = Math.min(midX, ...xs)} {@const maxX = Math.max(midX, ...xs)} {@const pairActive = isConnectorActive(group.parentA, group.parentB)} {#if minX !== maxX} {/if} {#each childCenters as cc (cc.id)} {@const childActive = isConnectorActive(group.parentA, cc.id) && isConnectorActive(group.parentB, cc.id)} {/each} {/if} {/each} {#each parentLinks.single as link (link.key)} {@const parentCenter = nodeCenter(link.parentId)} {@const childCenter = nodeCenter(link.childId)} {#if parentCenter && childCenter} {@const parentBottomY = parentCenter.y + NODE_H / 2} {@const childTopY = childCenter.y - NODE_H / 2} {@const barY = (parentBottomY + childTopY) / 2} {@const active = isConnectorActive(link.parentId, link.childId)} {#if parentCenter.x !== childCenter.x} {/if} {/if} {/each} {#each spouseEdges as e (e.id)} {@const aCenter = nodeCenter(e.personId)} {@const bCenter = nodeCenter(e.relatedPersonId)} {#if aCenter && bCenter} {@const active = isConnectorActive(e.personId, e.relatedPersonId)} {/if} {/each}