{
  "version": 3,
  "sources": ["../../src/app/ai/agents/evals2/scenarios/layout/dataListColumns.eval.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 type FrameNode from \"document/models/CanvasTree/nodes/FrameNode.ts\"\nimport type { RichTextNode } from \"document/models/CanvasTree/nodes/RichTextNode.ts\"\nimport { isFrameNode, isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { DimensionType } from \"library/index.ts\"\nimport { agentEvalAsset } from \"../../harness/asset.ts\"\nimport { createEvalExportZipFixture } from \"../../harness/fixture.ts\"\nimport { parsePx } from \"../helpers.ts\"\n\nconst dataListContainerId = \"BSIDXieqN\"\nconst contentWidthReferenceId = \"Pdv8wMdXz\"\nconst dataListColumnsRequestId = \"FWvFJBAW8\"\nconst desktopViewportId = \"WQLkyLRf1\"\nconst phoneViewportId = \"tePJDpguE\"\nconst workItemTitles = [\"Interface\", \"Motion\", \"Editorial\"] as const\n\nfunction getViewportContainers(engine: VekterEngine): {\n\tdesktop: FrameNode | undefined\n\tcontentWidthReference: FrameNode | undefined\n\tmobile: FrameNode | undefined\n} {\n\tconst desktopViewport = engine.tree.getNodeWithTrait(desktopViewportId, isFrameNode)\n\tconst phoneViewport = engine.tree.getNodeWithTrait(phoneViewportId, isFrameNode)\n\n\treturn {\n\t\tdesktop: desktopViewport ? findFrameInViewport(desktopViewport, dataListContainerId) : undefined,\n\t\tcontentWidthReference: desktopViewport ? findFrameInViewport(desktopViewport, contentWidthReferenceId) : undefined,\n\t\tmobile: phoneViewport ? findFrameInViewport(phoneViewport, dataListContainerId) : undefined,\n\t}\n}\n\nfunction findFrameInViewport(viewport: CanvasNode, primaryId: string): FrameNode | undefined {\n\treturn viewport.find((node): node is FrameNode => isFrameNode(node) && node.getPrimaryId() === primaryId) ?? undefined\n}\n\nfunction findTextNode(container: FrameNode, text: string): RichTextNode | undefined {\n\treturn container.find((node): node is RichTextNode => isRichTextNode(node) && node.html.includes(text)) ?? undefined\n}\n\nfunction findRowsByTitle(\n\tengine: VekterEngine,\n\tcontainer: FrameNode | undefined,\n): Map<(typeof workItemTitles)[number], FrameNode> | undefined {\n\tif (!container) return undefined\n\n\tconst rows = new Map<(typeof workItemTitles)[number], FrameNode>()\n\tconst rowIds = new Set<string>()\n\tfor (const title of workItemTitles) {\n\t\tconst titleNode = findTextNode(container, title)\n\t\tif (!titleNode) return undefined\n\n\t\tconst row = engine.tree.getNodeWithTrait(titleNode.parentid, isFrameNode)\n\t\tif (!row) return undefined\n\t\tif (rowIds.has(row.id)) return undefined\n\t\trowIds.add(row.id)\n\t\trows.set(title, row)\n\t}\n\treturn rows\n}\n\nevaluation(\n\t\"Data List Uses Filled Left Column With Gaps\",\n\tcreateEvalExportZipFixture(\"replay-data-list-columns\", agentEvalAsset(\"dataListColumns.fixture.zip\"), {\n\t\truntimeTarget: \"cli\",\n\t}),\n\t{\n\t\tid: \"data-list-columns\",\n\t\trequestId: dataListColumnsRequestId,\n\t\tmaxSteps: 6,\n\t},\n\t({ engine, report, tools }) => {\n\t\ttools.reportReplayChecks(report, {\n\t\t\trequestId: dataListColumnsRequestId,\n\t\t})\n\n\t\tconst containers = getViewportContainers(engine)\n\t\tconst desktopRows = findRowsByTitle(engine, containers.desktop)\n\t\tconst mobileRows = findRowsByTitle(engine, containers.mobile)\n\n\t\treport.correctness.required(\"creates horizontal data rows\", () => {\n\t\t\texpect(desktopRows?.size).toBe(workItemTitles.length)\n\t\t\tfor (const row of desktopRows?.values() ?? []) {\n\t\t\t\texpect(row.layout).toBe(\"stack\")\n\t\t\t\texpect(row.stackDirection).toBe(\"horizontal\")\n\t\t\t}\n\t\t})\n\n\t\treport.correctness.required(\"stacks mobile data rows vertically\", () => {\n\t\t\texpect(mobileRows?.size).toBe(workItemTitles.length)\n\t\t\tfor (const row of mobileRows?.values() ?? []) {\n\t\t\t\texpect(row.layout).toBe(\"stack\")\n\t\t\t\texpect(row.stackDirection).toBe(\"vertical\")\n\t\t\t}\n\t\t})\n\n\t\treport.correctness.scored(\"does not change the width of the work section\", () => {\n\t\t\tassert(containers.desktop, `Expected desktop data list container '${dataListContainerId}'.`)\n\t\t\tassert(containers.contentWidthReference, `Expected content width reference '${contentWidthReferenceId}'.`)\n\t\t\tconst dataListWidth = engine.tree.getRect(containers.desktop, false).width\n\t\t\tconst referenceWidth = engine.tree.getRect(containers.contentWidthReference, false).width\n\t\t\texpect(Math.abs(dataListWidth - referenceWidth)).toBeLessThanOrEqual(1)\n\t\t})\n\n\t\treport.correctness.each(\"leaves a visible gap in each desktop data row\", workItemTitles, title => {\n\t\t\tconst row = desktopRows?.get(title)\n\t\t\tassert(row, `Could not find desktop row for \"${title}\".`)\n\t\t\texpect(parsePx(row.gap) ?? 0).toBeGreaterThan(0)\n\t\t})\n\n\t\treport.correctness.each(\"sets each desktop left column to fill or fixed\", workItemTitles, title => {\n\t\t\tconst row = desktopRows?.get(title)\n\t\t\tassert(row, `Could not find desktop row for \"${title}\".`)\n\t\t\tconst leftColumn = row.children?.at(0)\n\t\t\tassert(isRichTextNode(leftColumn), \"Expected the first row child to be the left text column.\")\n\t\t\texpect(leftColumn.html).toContain(title)\n\t\t\texpect([DimensionType.FractionOfFreeSpace, DimensionType.FixedNumber]).toContain(leftColumn.widthType)\n\t\t})\n\n\t\treport.correctness.each(\"gives each desktop title height fit so it can wrap\", workItemTitles, title => {\n\t\t\tassert(containers.desktop, `Expected desktop data list container '${dataListContainerId}'.`)\n\t\t\tconst titleNode = findTextNode(containers.desktop, title)\n\t\t\tassert(titleNode, `Could not find desktop title text for \"${title}\".`)\n\t\t\texpect(titleNode.heightType).toBe(DimensionType.Auto)\n\t\t})\n\n\t\treport.correctness.each(\"gives each mobile title height fit so it can wrap\", workItemTitles, title => {\n\t\t\tassert(containers.mobile, `Expected mobile data list container '${dataListContainerId}'.`)\n\t\t\tconst titleNode = findTextNode(containers.mobile, title)\n\t\t\tassert(titleNode, `Could not find mobile title text for \"${title}\".`)\n\t\t\texpect(titleNode.heightType).toBe(DimensionType.Auto)\n\t\t})\n\t},\n)\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAM,sBAAsB;AAC5B,IAAM,0BAA0B;AAChC,IAAM,2BAA2B;AACjC,IAAM,oBAAoB;AAC1B,IAAM,kBAAkB;AACxB,IAAM,iBAAiB,CAAC,aAAa,UAAU,WAAW;AAE1D,SAAS,sBAAsB,QAI7B;AACD,QAAM,kBAAkB,OAAO,KAAK,iBAAiB,mBAAmB,WAAW;AACnF,QAAM,gBAAgB,OAAO,KAAK,iBAAiB,iBAAiB,WAAW;AAE/E,SAAO;AAAA,IACN,SAAS,kBAAkB,oBAAoB,iBAAiB,mBAAmB,IAAI;AAAA,IACvF,uBAAuB,kBAAkB,oBAAoB,iBAAiB,uBAAuB,IAAI;AAAA,IACzG,QAAQ,gBAAgB,oBAAoB,eAAe,mBAAmB,IAAI;AAAA,EACnF;AACD;AAEA,SAAS,oBAAoB,UAAsB,WAA0C;AAC5F,SAAO,SAAS,KAAK,CAAC,SAA4B,YAAY,IAAI,KAAK,KAAK,aAAa,MAAM,SAAS,KAAK;AAC9G;AAEA,SAAS,aAAa,WAAsB,MAAwC;AACnF,SAAO,UAAU,KAAK,CAAC,SAA+B,eAAe,IAAI,KAAK,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK;AAC5G;AAEA,SAAS,gBACR,QACA,WAC8D;AAC9D,MAAI,CAAC,UAAW,QAAO;AAEvB,QAAM,OAAO,oBAAI,IAAgD;AACjE,QAAM,SAAS,oBAAI,IAAY;AAC/B,aAAW,SAAS,gBAAgB;AACnC,UAAM,YAAY,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