{"version":3,"file":"leaf_rebrand.cjs","names":["mapSpecQueryColumns"],"sources":["../../../src/columns/column_recipes/leaf_rebrand.ts"],"sourcesContent":["import {\n  mapSpecQueryColumns,\n  type ColumnUniversalId,\n  type SpecQuery,\n} from \"@milaboratories/pl-model-common\";\n\n/**\n * Replace every column leaf whose id equals `fromId` with `toId`, leaving\n * other column refs (linkers, sub-anchors) intact. Wrapper recipes\n * (Overridden / Filtered) and Discovered use this to lift their own id onto\n * the hit leaf, so per-variant uniqueness propagates to the engine and\n * resolver-emitted ids match leaves in the emitted SpecQuery.\n *\n * Generic over all SpecQuery node shapes — including `linkerJoin`, which\n * occurs when a wrapper sits over a {@link ColumnDiscoveredRecipe}: only\n * the deepest hit leaf carries `fromId`, every linker leaf has a different\n * id and is left untouched.\n */\nexport function rebrandLeafId(\n  node: SpecQuery,\n  fromId: ColumnUniversalId,\n  toId: ColumnUniversalId,\n): SpecQuery {\n  if (fromId === toId) return node;\n  return mapSpecQueryColumns(node, {\n    column: (id) => (id === fromId ? toId : id),\n  });\n}\n"],"mappings":";;;;;;;;;;;;;;AAkBA,SAAgB,cACd,MACA,QACA,MACW;CACX,IAAI,WAAW,MAAM,OAAO;CAC5B,QAAA,GAAOA,gCAAAA,oBAAAA,CAAoB,MAAM,EAC/B,SAAS,OAAQ,OAAO,SAAS,OAAO,GAC1C,CAAC;AACH"}