import { isPatternReference } from "../../types/pattern-reference.js";
function resolvePatternReferences(blocks, patternCache) {
  const resolved = [];
  for (const block of blocks) {
    if (isPatternReference(block)) {
      const pattern = patternCache.get(block.ref);
      if (pattern) {
        resolved.push(...pattern.blocks);
      } else {
        console.warn(
          `[pattern-resolver] Pattern not found: ${block.ref} (instance: ${block.id})`
        );
      }
    } else {
      resolved.push(block);
    }
  }
  return resolved;
}
function extractPatternIds(blocks) {
  const ids = /* @__PURE__ */ new Set();
  for (const block of blocks) {
    if (isPatternReference(block)) {
      ids.add(block.ref);
    }
  }
  return Array.from(ids);
}
export {
  extractPatternIds,
  resolvePatternReferences
};
