{
  "version": 3,
  "sources": ["../../src/app/ai/agents/evals2/scenarios/helpers.ts"],
  "sourcesContent": ["import { assert } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport FrameNode from \"document/models/CanvasTree/nodes/FrameNode.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { RichTextNode } from \"document/models/CanvasTree/nodes/RichTextNode.ts\"\nimport { withRadius } from \"document/models/CanvasTree/traits/WithRadius.ts\"\nimport { parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { convertFrameToCanvas } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { Rect } from \"library/index.ts\"\n\nexport function getNode(engine: VekterEngine, id: NodeID): CanvasNode {\n\tconst node = engine.tree.get(id)\n\tassert(node, `Expected fixture node '${id}' to exist.`)\n\treturn node\n}\n\nexport function getFrame(engine: VekterEngine, id: NodeID): FrameNode {\n\tconst node = getNode(engine, id)\n\tassert(node instanceof FrameNode, `Expected fixture node '${id}' to be a frame.`)\n\treturn node\n}\n\nexport function getRichText(engine: VekterEngine, id: NodeID): RichTextNode {\n\tconst node = getNode(engine, id)\n\tassert(node instanceof RichTextNode, `Expected fixture node '${id}' to be rich text.`)\n\treturn node\n}\n\nexport function getChildFrames(node: CanvasNode): FrameNode[] {\n\tconst { children } = node\n\tif (!children) return []\n\treturn children.filter((child): child is FrameNode => child instanceof FrameNode)\n}\n\nexport function getChildAt(node: CanvasNode, index: number): CanvasNode | undefined {\n\tconst { children } = node\n\tif (!children || index < 0 || index >= children.length) return undefined\n\treturn children.at(index)\n}\n\nexport function getFrameChildAt(node: CanvasNode, index: number): FrameNode | undefined {\n\tconst child = getChildAt(node, index)\n\treturn child instanceof FrameNode ? child : undefined\n}\n\nexport function getDescendantText(node: CanvasNode): string {\n\treturn Array.from(node.walk())\n\t\t.filter((descendant): descendant is RichTextNode => descendant instanceof RichTextNode)\n\t\t.map(descendant => descendant.html)\n\t\t.join(\"\\n\")\n}\n\nexport function getCenterRelativeToCanvas(engine: VekterEngine, node: CanvasNode) {\n\treturn Rect.center(convertFrameToCanvas(engine.tree, node))\n}\n\nexport function parsePx(value: unknown): number | undefined {\n\tif (typeof value === \"number\") return Number.isNaN(value) ? undefined : value\n\tif (typeof value !== \"string\") return undefined\n\n\tconst [number, unit] = parseCSSDimension(value, \"px\")\n\tif (Number.isNaN(number) || unit !== \"px\") return undefined\n\treturn number\n}\n\nexport function getRadius(engine: VekterEngine, id: NodeID): number {\n\tconst node = getNode(engine, id)\n\tassert(withRadius(node), `Expected fixture node '${id}' to support radius.`)\n\tconst radius = parsePx(node.radius)\n\tassert(radius !== undefined, `Expected fixture node '${id}' to have a radius.`)\n\treturn radius\n}\n\nexport function stringifyValue(value: unknown): string {\n\treturn typeof value === \"string\" ? value : (JSON.stringify(value) ?? \"\")\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;AAWO,SAAS,QAAQ,QAAsB,IAAwB;AACrE,QAAM,OAAO,OAAO,KAAK,IAAI,EAAE;AAC/B,SAAO,MAAM,0BAA0B,EAAE,aAAa;AACtD,SAAO;AACR;AAEO,SAAS,SAAS,QAAsB,IAAuB;AACrE,QAAM,OAAO,QAAQ,QAAQ,EAAE;AAC/B,SAAO,gBAAgB,WAAW,0BAA0B,EAAE,kBAAkB;AAChF,SAAO;AACR;AAEO,SAAS,YAAY,QAAsB,IAA0B;AAC3E,QAAM,OAAO,QAAQ,QAAQ,EAAE;AAC/B,SAAO,gBAAgB,cAAc,0BAA0B,EAAE,oBAAoB;AACrF,SAAO;AACR;AAEO,SAAS,eAAe,MAA+B;AAC7D,QAAM,EAAE,SAAS,IAAI;AACrB,MAAI,CAAC,SAAU,QAAO,CAAC;AACvB,SAAO,SAAS,OAAO,CAAC,UAA8B,iBAAiB,SAAS;AACjF;AAEO,SAAS,WAAW,MAAkB,OAAuC;AACnF,QAAM,E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