/** * GROUP으로 묶인 객체를 함께 선택하기 위한 확장. * 선택 도구가 부르는 자리라 도구 모듈을 import하지 않는다 (순환 참조 방지). */ import { getEntities } from '../state'; export function expandSelectionWithGroups(entityIds: string[]): string[] { const entities = getEntities(); const ids = new Set(entityIds); const selectedGroups = new Set( entities .filter((entity) => ids.has(entity.id) && entity.groupId) .map((entity) => entity.groupId as string) ); if (!selectedGroups.size) return entityIds; const expanded = new Set(entityIds); for (const entity of entities) { if (entity.groupId && selectedGroups.has(entity.groupId)) expanded.add(entity.id); } return [...expanded]; }