{
  "version": 3,
  "sources": ["../../src/app/ai/agents/evals2/scenarios/computedValues/helpers.ts"],
  "sourcesContent": ["import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { IMPLEMENTATION_GUIDE_FROM_INDEX_QUERY } from \"../../../tools/readProjectQueryTypes.ts\"\nimport type { AgentEvalToolsHelper } from \"../../harness/helpers.ts\"\n\nexport function findVariableBindings<N extends CanvasNode>(\n\tengine: VekterEngine,\n\tisMatchingNode: (node: CanvasNode) => node is N,\n\tgetAttribute: (node: N) => unknown,\n\tvariableId: string,\n): DynamicValue[] {\n\tconst matches: DynamicValue[] = []\n\tfor (const node of engine.tree.root.walk()) {\n\t\tif (!isMatchingNode(node)) continue\n\t\tconst value = getAttribute(node)\n\t\tif (isComputedValue(value) && isVariableReference(value.startValue) && value.startValue.id === variableId) {\n\t\t\tmatches.push(value)\n\t\t\tcontinue\n\t\t}\n\t\tif (isVariableReference(value) && value.id === variableId) {\n\t\t\tmatches.push(value)\n\t\t}\n\t}\n\treturn matches\n}\n\nexport function findComputedValueBindings<N extends CanvasNode>(\n\tengine: VekterEngine,\n\tisMatchingNode: (node: CanvasNode) => node is N,\n\tgetAttribute: (node: N) => unknown,\n\tvariableId: string,\n): ComputedValue[] {\n\treturn findVariableBindings(engine, isMatchingNode, getAttribute, variableId).filter(isComputedValue)\n}\n\nexport function loadedGuide(tools: AgentEvalToolsHelper, name: string): boolean {\n\treturn tools.hasReadProjectQuery(query => query.type === IMPLEMENTATION_GUIDE_FROM_INDEX_QUERY && query.name === name)\n}\n"],
  "mappings": ";;;;;;;;;AASO,SAAS,qBACf,QACA,gBACA,cACA,YACiB;AACjB,QAAM,UAA0B,CAAC;AACjC,aAAW,QAAQ,OAAO,KAAK,KAAK,KAAK,GAAG;AAC3C,QAAI,CAAC,eAAe,IAAI,EAAG;AAC3B,UAAM,QAAQ,aAAa,IAAI;AAC/B,QAAI,gBAAgB,KAAK,KAAK,oBAAoB,MAAM,UAAU,KAAK,MAAM,WAAW,OAAO,YAAY;AAC1G,cAAQ,KAAK,KAAK;AAClB;AAAA,IACD;AACA,QAAI,oBAAoB,KAAK,KAAK,MAAM,OAAO,YAAY;AAC1D,cAAQ,KAAK,KAAK;AAAA,IACnB;AAAA,EACD;AACA,SAAO;AACR;AAEO,SAAS,0BACf,QACA,gBACA,cACA,YACkB;AAClB,SAAO,qBAAqB,QAAQ,gBAAgB,cAAc,UAAU,EAAE,OAAO,eAAe;AACrG;AAEO,SAAS,YAAY,OAA6B,MAAuB;AAC/E,SAAO,MAAM,oBAAoB,WAAS,MAAM,SAAS,yCAAyC,MAAM,SAAS,IAAI;AACtH;",
  "names": []
}
