{
  "version": 3,
  "sources": ["../../src/renderer/utils/getVariableReferencesFromNode.ts"],
  "sourcesContent": ["import type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { forEachVariableReferenceOfNode } from \"utils/updateDynamicValues.ts\"\n\nconst cache = new WeakMap<CanvasNode, VariableReference[]>()\n\nexport function getVariableReferencesFromNode(tree: CanvasTree, node: CanvasNode): VariableReference[] {\n\tconst cached = cache.get(node)\n\tif (cached) return cached\n\n\tconst nodeVariables: VariableReference[] = []\n\tforEachVariableReferenceOfNode(tree, node, \"includeInherited\", \"readsRawNodeData\", undefined, variable =>\n\t\tnodeVariables.push(variable),\n\t)\n\n\t// We are not using node.walk() here because we want to cache the result of\n\t// each subtree. This way we only have to walk the subtree that has changed.\n\tif (node.children) {\n\t\tfor (const child of node.children) {\n\t\t\tconst childVariables = getVariableReferencesFromNode(tree, child)\n\t\t\tnodeVariables.push(...childVariables)\n\t\t}\n\t}\n\n\tcache.set(node, nodeVariables)\n\treturn nodeVariables\n}\n"],
  "mappings": ";;;;;AAIA,IAAM,QAAQ,oBAAI,QAAyC;AAEpD,SAAS,8BAA8B,MAAkB,MAAuC;AACtG,QAAM,SAAS,MAAM,IAAI,IAAI;AAC7B,MAAI,OAAQ,QAAO;AAEnB,QAAM,gBAAqC,CAAC;AAC5C;AAAA,IAA+B;AAAA,IAAM;AAAA,IAAM;AAAA,IAAoB;AAAA,IAAoB;AAAA,IAAW,cAC7F,cAAc,KAAK,QAAQ;AAAA,EAC5B;AAIA,MAAI,KAAK,UAAU;AAClB,eAAW,SAAS,KAAK,UAAU;AAClC,YAAM,iBAAiB,8BAA8B,MAAM,KAAK;AAChE,oBAAc,KAAK,GAAG,cAAc;AAAA,IACrC;AAAA,EACD;AAEA,QAAM,IAAI,MAAM,aAAa;AAC7B,SAAO;AACR;",
  "names": []
}
