@shapesos/clay 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/dist/artifacts.cjs +1420 -245
- package/dist/artifacts.cjs.map +1 -1
- package/dist/artifacts.d.cts +167 -6
- package/dist/artifacts.d.ts +167 -6
- package/dist/artifacts.js +18 -3
- package/dist/blocks.cjs +1696 -532
- package/dist/blocks.cjs.map +1 -1
- package/dist/blocks.css +1 -1
- package/dist/blocks.d.cts +21 -10
- package/dist/blocks.d.ts +21 -10
- package/dist/blocks.js +7 -3
- package/dist/capture.cjs +220 -0
- package/dist/capture.cjs.map +1 -0
- package/dist/capture.d.cts +113 -0
- package/dist/capture.d.ts +113 -0
- package/dist/capture.js +17 -0
- package/dist/chart.cjs +594 -0
- package/dist/chart.cjs.map +1 -0
- package/dist/chart.d.cts +439 -0
- package/dist/chart.d.ts +439 -0
- package/dist/chart.js +32 -0
- package/dist/chart.js.map +1 -0
- package/dist/chat.cjs +1687 -532
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.d.cts +3 -2
- package/dist/chat.d.ts +3 -2
- package/dist/chat.js +8 -4
- package/dist/{chunk-MXOPG747.js → chunk-26XVDY6Z.js} +8 -8
- package/dist/chunk-26XVDY6Z.js.map +1 -0
- package/dist/{chunk-L35M3OD5.js → chunk-4MZZH3WX.js} +5 -11
- package/dist/chunk-4MZZH3WX.js.map +1 -0
- package/dist/chunk-DT44KNCV.js +1004 -0
- package/dist/chunk-DT44KNCV.js.map +1 -0
- package/dist/chunk-JAGNXEWK.js +116 -0
- package/dist/chunk-JAGNXEWK.js.map +1 -0
- package/dist/chunk-LXYCT4YO.js +7 -0
- package/dist/chunk-LXYCT4YO.js.map +1 -0
- package/dist/chunk-P6GUNIAE.js +11 -0
- package/dist/chunk-P6GUNIAE.js.map +1 -0
- package/dist/{chunk-OUW6PUEB.js → chunk-QH2WW2MW.js} +7 -7
- package/dist/chunk-QXGYMDIA.js +477 -0
- package/dist/chunk-QXGYMDIA.js.map +1 -0
- package/dist/chunk-RSRNSWJN.js +1 -0
- package/dist/chunk-RSRNSWJN.js.map +1 -0
- package/dist/dom-to-image-NATF3446.js +21 -0
- package/dist/dom-to-image-NATF3446.js.map +1 -0
- package/dist/index.cjs +1489 -317
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +28 -15
- package/dist/table.js +2 -1
- package/dist/types-B2aYk82c.d.cts +29 -0
- package/dist/types-B2aYk82c.d.ts +29 -0
- package/dist/types-BzXPBy6s.d.cts +330 -0
- package/dist/{types-DuuRI4ll.d.cts → types-CW45GBXl.d.cts} +31 -4
- package/dist/{types-C9XX-Uhk.d.ts → types-D1b8v7EY.d.ts} +31 -4
- package/dist/types-GCkXbyFm.d.ts +330 -0
- package/package.json +24 -2
- package/dist/chunk-BX5TCEPR.js +0 -436
- package/dist/chunk-BX5TCEPR.js.map +0 -1
- package/dist/chunk-L35M3OD5.js.map +0 -1
- package/dist/chunk-MEJESPTZ.js +0 -1
- package/dist/chunk-MXOPG747.js.map +0 -1
- package/dist/types-3Gzk7cRt.d.cts +0 -121
- package/dist/types-3Gzk7cRt.d.ts +0 -121
- /package/dist/{chunk-MEJESPTZ.js.map → capture.js.map} +0 -0
- /package/dist/{chunk-OUW6PUEB.js.map → chunk-QH2WW2MW.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/artifacts/artifact-base.ts","../src/components/artifacts/chart-artifact/types.ts","../src/components/artifacts/table-artifact/types.ts","../node_modules/@tabler/icons-react/src/defaultAttributes.ts","../node_modules/@tabler/icons-react/src/createReactComponent.ts","../node_modules/@tabler/icons-react/src/icons/IconAlertCircle.ts","../node_modules/@tabler/icons-react/src/icons/IconCheck.ts","../node_modules/@tabler/icons-react/src/icons/IconCopy.ts","../node_modules/@tabler/icons-react/src/icons/IconDownload.ts","../node_modules/@tabler/icons-react/src/icons/IconFileSpreadsheet.ts","../node_modules/@tabler/icons-react/src/icons/IconLoader2.ts","../node_modules/@tabler/icons-react/src/icons/IconPhoto.ts","../node_modules/@tabler/icons-react/src/icons/IconThumbDown.ts","../node_modules/@tabler/icons-react/src/icons/IconThumbUp.ts","../src/components/artifacts/artifact-copy-as-image-button/artifact-copy-as-image-button.tsx","../src/components/ui/tooltip.tsx","../src/components/artifacts/artifact-copy-as-image-button/use-copy-as-image.ts","../src/components/artifacts/artifact-download-button/artifact-download-button.tsx","../src/components/artifacts/artifact-download-menu/artifact-download-menu.tsx","../src/components/ui/dropdown-menu.tsx","../src/components/artifacts/chart-artifact/chart-artifact.tsx","../src/components/ai-elements/artifact.tsx","../src/components/artifacts/status-message.tsx","../src/components/artifacts/chart-artifact/chart-variant-services/constants.ts","../src/components/artifacts/chart-artifact/chart-variant-services/bar-chart-variant-component.tsx","../src/components/artifacts/chart-artifact/chart-variant-services/shared-column-keys.ts","../src/components/artifacts/chart-artifact/chart-variant-services/shared-validators.ts","../src/components/artifacts/chart-artifact/chart-variant-services/bar-chart-variant-service.tsx","../src/components/artifacts/chart-artifact/chart-variant-services/line-chart-variant-component.tsx","../src/components/artifacts/chart-artifact/chart-variant-services/line-chart-variant-service.tsx","../src/components/artifacts/chart-artifact/chart-variant-services/pie-chart-variant-component.tsx","../src/components/artifacts/chart-artifact/chart-variant-services/pie-chart-variant-service.tsx","../src/components/artifacts/chart-artifact/chart-variant-services/index.ts","../src/components/artifacts/chart-artifact/chart-artifact-content.tsx","../src/components/artifacts/parse-csv.ts","../src/components/artifacts/use-rows-artifact-data.ts","../src/components/artifacts/chart-artifact/use-chart-artifact-data.ts","../src/components/artifacts/chart-artifact/validate.ts","../src/components/artifacts/table-artifact/table-artifact.tsx","../src/components/artifacts/table-artifact/table-artifact-content.constants.ts","../src/components/artifacts/table-artifact/table-artifact-content.utils.ts","../src/components/artifacts/table-artifact/table-artifact-content.tsx","../src/components/artifacts/table-artifact/use-table-artifact-data.ts","../src/components/artifacts/table-artifact/validate.ts","../src/components/artifacts/chart-artifact/to-clipboard-text.ts","../src/components/artifacts/artifact-services/chart-artifact-service.ts","../src/components/artifacts/table-artifact/to-clipboard-text.ts","../src/components/artifacts/artifact-services/table-artifact-service.ts","../src/components/artifacts/artifact-services/index.ts"],"sourcesContent":["/**\n * Shared artifact primitives — the discriminator constant and the cross-variant `ArtifactBase`\n * shape that every concrete artifact record extends.\n *\n * Pulled into its own file so the per-type `types.ts` files (`table-artifact/types.ts`,\n * `chart-artifact/types.ts`) and the union assembler (`artifacts/types.ts`) can all depend on\n * one canonical source without creating a circular module graph between them.\n */\n\n/**\n * Artifact-type discriminator constants. Uppercase to match the server-side `artifactTypes`\n * constant — io-server stores `artifact.type === \"TABLE\"` (aligned with the GraphQL enum).\n */\nexport const artifactTypes = {\n TABLE: \"TABLE\",\n CHART: \"CHART\",\n} as const;\n\n/** Discriminator for artifact types. Additive — new types extend this union. */\nexport type ArtifactType = (typeof artifactTypes)[keyof typeof artifactTypes];\n\n/** Common shape every artifact record carries. Discriminated by `type`. */\nexport interface ArtifactBase<TType extends ArtifactType, TConfig> {\n /** Artifact-type discriminator. */\n type: TType;\n /** Human-readable label. Nullable when the artifact has no title. */\n title: string | null;\n /** Rendering config — shape varies per artifact type. */\n config: TConfig;\n /** Protected-asset metadata pointing to the underlying data payload. Null while the asset is unavailable. */\n protectedAsset: {\n /** Time-limited URL the renderer fetches the artifact's data from. */\n presignedUrl: string;\n } | null;\n}\n\n/**\n * A row inside an artifact's parsed CSV. Every cell is the raw string from the CSV (or `null`\n * for the empty string). Used by every artifact kind whose data wire is a CSV (`TABLE`, `CHART`).\n * The renderer never coerces — type-aware formatting is a server concern (the CSV's contents\n * are what the user sees).\n */\nexport type ArtifactDataRow = Record<string, string | null>;\n","import type { ChartSeries } from \"@/components/chart/types\";\nimport { artifactTypes, type ArtifactBase } from \"../artifact-base\";\nimport type { ChartConfig } from \"./chart-variant-services\";\n\nexport type { ChartConfig } from \"./chart-variant-services\";\nexport type { LineChartConfig, BarChartConfig, PieChartConfig } from \"./chart-variant-services\";\n\n/**\n * Optional stats embedded in `ChartConfig` so clients can pre-render UI before fetching the\n * actual CSV (e.g. a skeleton sized to the eventual row count). Mirrors `TableStats`.\n */\nexport interface ChartStats {\n /** Total number of rows in the materialised CSV. */\n rowCount: number;\n}\n\n/**\n * Cross-variant base for `ChartConfig`. Carries the fields every variant shares — series\n * descriptors and optional stats. Per-variant config interfaces (in `chart-variant-services/`)\n * extend this with their own required fields.\n *\n * Note: `series` is always present on the wire (matching the GraphQL `[ChartSeries!]!` shape)\n * even for PIE — PIE just receives an empty array. Keeping it on the base mirrors the wire shape\n * exactly and avoids TS object-literal freshness errors for callers that explicitly set\n * `series: []` on a pie config.\n */\nexport interface ChartConfigBase {\n /** Series descriptors in render order. LINE/BAR consume these; PIE ignores in favour of `categoryKey`+`valueKey`. */\n series: ChartSeries[];\n /** Optional metadata describing the underlying data — used for loading-state UI. */\n stats?: ChartStats;\n}\n\n/** Concrete chart artifact record. */\nexport type ChartArtifactRecord = ArtifactBase<typeof artifactTypes.CHART, ChartConfig>;\n\n/**\n * Localized labels for the `CHART` artifact's user-facing strings. Covers action buttons AND\n * status messages — see `TableArtifactLabels` for the same shape philosophy. Extends as the\n * chart artifact grows its action set (e.g. future `copyAsPng`); optional keys document\n * anticipated additions without forcing every consumer to provide them today.\n */\nexport interface ChartArtifactLabels {\n /** Tooltip + aria-label on the Download menu's trigger button (icon-only, opens the format\n * picker). The trigger is action-shaped (just \"Download\"); the menu items spell out the\n * format. */\n download: string;\n /** Label for the \"Download CSV\" item inside the Download menu. */\n downloadCsv: string;\n /** Label for the \"Download PNG\" item inside the Download menu. */\n downloadPng: string;\n /** Tooltip + aria-label on the \"Copy Image\" button in the chart artifact header (idle state).\n * Transient working / success / error tooltips remain in English — they flash for ~1.5s and the\n * cost of translating them is rarely worth it. */\n copyAsImage: string;\n /** Status message shown when no presigned URL is available or the chart config is malformed. */\n unavailable: string;\n /** Status message shown when the fetch / parse fails at runtime. */\n loadError: string;\n /** Status message shown while the CSV is being fetched. */\n loading: string;\n /** Status message shown when the fetched CSV has zero data rows. */\n empty: string;\n /**\n * Category labels treated as the \"Others\" bucket in pie charts (case-insensitive). Matching\n * slices are pinned to the end of the sweep and rendered in neutral grey. The agent writes a\n * translated bucket name in non-English UIs (e.g. \"אחרים\", \"Otros\") — consumer passes the\n * localized list here so clay can detect the bucket regardless of language. English fallback\n * is `[\"Others\", \"Other\"]`. Pass `[]` to disable Others detection (every slice from the palette).\n */\n othersCategoryLabels: readonly string[];\n}\n\n/** English fallback for `ChartArtifactLabels`. Used when the consumer hasn't passed `labels`. */\nexport const DEFAULT_CHART_ARTIFACT_LABELS: ChartArtifactLabels = {\n download: \"Download\",\n downloadCsv: \"Download CSV\",\n downloadPng: \"Download PNG\",\n copyAsImage: \"Copy Image\",\n unavailable: \"Chart data is unavailable.\",\n loadError: \"Couldn't load chart data.\",\n loading: \"Loading chart…\",\n empty: \"No data to chart.\",\n othersCategoryLabels: [\"Others\", \"Other\"],\n};\n\n/**\n * Consumer-supplied side-effect callbacks for actions on the chart artifact. Mirrors\n * `ChartArtifactLabels`'s shape philosophy: one entry per action this artifact exposes\n * (download today; future \"Copy as PNG\" etc.). Every callback is optional — consumers wire\n * only the actions they care about. The artifact passes its own `ChartArtifactRecord` as the\n * only argument so consumers can derive analytics context (title, config.variant, etc.) without\n * a per-block closure at every render site.\n *\n * The callback fires alongside the default browser behaviour (e.g. `onDownload` does not\n * prevent the anchor's download navigation) — it's purely for analytics / observability hooks.\n */\nexport interface ChartArtifactCallbacks {\n /** Fires when the \"Download CSV\" menu item is selected. Browser-native download still happens. */\n onDownload?: (artifact: ChartArtifactRecord) => void;\n /** Fires when the \"Download PNG\" menu item is selected. Runs alongside the rasterise — fires\n * regardless of whether the rasterise ultimately succeeds (failures surface via console.warn). */\n onDownloadPng?: (artifact: ChartArtifactRecord) => void;\n /** Fires when the Copy Image button is clicked. Fires regardless of whether the copy ultimately\n * succeeds (the result is reported via the button's own state flash) — use this only for\n * analytics / observability, not for retrying failed copies. */\n onCopyAsImage?: (artifact: ChartArtifactRecord) => void;\n}\n","import { artifactTypes, type ArtifactBase, type ArtifactDataRow } from \"../artifact-base\";\n\n/**\n * A single column descriptor for a `TableArtifact`. Carries the ORDER and LABEL for the\n * rendered table — `key` selects a column from the CSV header; `label` overrides the rendered\n * header text. The CSV is always the source of truth for the data shape; clay never coerces,\n * reformats, or interprets cell values.\n */\nexport interface TableColumn {\n /** Matches a header in the CSV. Required. Used to project + order the CSV's columns. */\n key: string;\n /** Human-readable header text. Required. */\n label: string;\n /**\n * Accepted in the wire payload but not consulted by the renderer — every cell is rendered as\n * the raw CSV string (or empty for null). Format conversion is a server concern; if a column\n * needs to be \"Yes/No\" instead of \"true/false\", the server should emit it that way in the CSV.\n * Kept in the interface so callers that pass `type` (e.g. io-client) don't get a type error.\n */\n type?: \"string\" | \"number\" | \"date\" | \"boolean\";\n /**\n * Accepted in the wire payload but not consulted by the renderer — every column is left-aligned\n * by design. Kept in the interface for forward-compat; restore per-column alignment by editing\n * `table-artifact-content.tsx` if a future use case justifies it.\n */\n align?: \"left\" | \"center\" | \"right\";\n}\n\n/**\n * Optional stats embedded in `TableConfig` so clients can pre-render UI before fetching the\n * actual data payload (e.g. N loading shimmers sized to the eventual row count).\n *\n * Backward-compat: optional everywhere — older artifacts persisted before this field shipped\n * still validate. The renderer falls back to a single status-message line when `stats` is absent.\n */\nexport interface TableStats {\n /** Total number of rows in the materialised CSV. Lets the loading branch render shimmers. */\n rowCount: number;\n}\n\n/** Rendering config for a table artifact, stored at `artifact.config` (JSONB on the server). */\nexport interface TableConfig {\n /** Column descriptors in render order. */\n columns: TableColumn[];\n /** Optional metadata describing the underlying data — used for loading-state UI. */\n stats?: TableStats;\n}\n\n/** Alias retained for callers typed against the table-specific name. */\nexport type TableRow = ArtifactDataRow;\n\n/** Concrete table artifact record. */\nexport type TableArtifactRecord = ArtifactBase<typeof artifactTypes.TABLE, TableConfig>;\n\n/**\n * Localized labels for the `TABLE` artifact's user-facing strings. Covers both action buttons\n * (download today; future \"Copy as CSV\", etc.) AND status messages (loading / error / empty /\n * unavailable). Consumer passes the bag from their i18n layer; clay falls back to English\n * defaults when omitted (per-key Partial merge).\n */\nexport interface TableArtifactLabels {\n /** Tooltip + aria-label on the Download CSV button in the table artifact header. */\n download: string;\n /**\n * Status message shown when no presigned URL is available (permanent server-side absence) or\n * the artifact config is malformed. Both states reduce to \"the underlying file isn't usable\".\n */\n unavailable: string;\n /** Status message shown when the fetch / parse fails at runtime (transient). */\n loadError: string;\n /** Status message shown while the CSV is being fetched and `stats.rowCount` is not known. */\n loading: string;\n /** Empty-state row inside the table body when the fetched CSV has zero data rows. */\n empty: string;\n}\n\n/** English fallback for `TableArtifactLabels`. Used when the consumer hasn't passed `labels`. */\nexport const DEFAULT_TABLE_ARTIFACT_LABELS: TableArtifactLabels = {\n download: \"Download CSV\",\n unavailable: \"Table data is unavailable.\",\n loadError: \"Couldn't load table data.\",\n loading: \"Loading table…\",\n empty: \"No rows to display.\",\n};\n\n/**\n * Consumer-supplied side-effect callbacks for actions on the table artifact. Mirrors\n * `ChartArtifactCallbacks` — see that interface for the shape philosophy. Every callback is\n * optional; the artifact passes its own `TableArtifactRecord` as the only argument so consumers\n * can derive analytics context without a per-block closure at every render site.\n */\nexport interface TableArtifactCallbacks {\n /** Fires when the Download CSV button is clicked. Browser-native download still happens. */\n onDownload?: (artifact: TableArtifactRecord) => void;\n}\n","export default {\n outline: {\n xmlns: 'http://www.w3.org/2000/svg',\n width: 24,\n height: 24,\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 2,\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n },\n filled: {\n xmlns: 'http://www.w3.org/2000/svg',\n width: 24,\n height: 24,\n viewBox: '0 0 24 24',\n fill: 'currentColor',\n stroke: 'none',\n },\n};\n","import { forwardRef, createElement } from 'react';\nimport defaultAttributes from './defaultAttributes';\nimport type { IconNode, IconProps, Icon } from './types';\n\nconst createReactComponent = (\n type: 'outline' | 'filled',\n iconName: string,\n iconNamePascal: string,\n iconNode: IconNode,\n) => {\n const Component = forwardRef<SVGSVGElement, IconProps>(\n (\n { color = 'currentColor', size = 24, stroke = 2, title, className, children, ...rest }: IconProps,\n ref,\n ) =>\n createElement(\n 'svg',\n {\n ref,\n ...defaultAttributes[type],\n width: size,\n height: size,\n className: [`tabler-icon`, `tabler-icon-${iconName}`, className].join(' '),\n ...(type === 'filled'\n ? {\n fill: color,\n }\n : {\n strokeWidth: stroke,\n stroke: color,\n }),\n ...rest,\n },\n [\n title && createElement('title', { key: 'svg-title' }, title),\n ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),\n ...(Array.isArray(children) ? children : [children]),\n ],\n ),\n );\n\n Component.displayName = `${iconNamePascal}`;\n\n return Component;\n};\n\nexport default createReactComponent;\n","import createReactComponent from '../createReactComponent';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [[\"path\",{\"d\":\"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0\",\"key\":\"svg-0\"}],[\"path\",{\"d\":\"M12 8v4\",\"key\":\"svg-1\"}],[\"path\",{\"d\":\"M12 16h.01\",\"key\":\"svg-2\"}]]\n\nconst IconAlertCircle = createReactComponent('outline', 'alert-circle', 'AlertCircle', __iconNode);\n\nexport default IconAlertCircle;","import createReactComponent from '../createReactComponent';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [[\"path\",{\"d\":\"M5 12l5 5l10 -10\",\"key\":\"svg-0\"}]]\n\nconst IconCheck = createReactComponent('outline', 'check', 'Check', __iconNode);\n\nexport default IconCheck;","import createReactComponent from '../createReactComponent';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [[\"path\",{\"d\":\"M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666\",\"key\":\"svg-0\"}],[\"path\",{\"d\":\"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1\",\"key\":\"svg-1\"}]]\n\nconst IconCopy = createReactComponent('outline', 'copy', 'Copy', __iconNode);\n\nexport default IconCopy;","import createReactComponent from '../createReactComponent';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [[\"path\",{\"d\":\"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2\",\"key\":\"svg-0\"}],[\"path\",{\"d\":\"M7 11l5 5l5 -5\",\"key\":\"svg-1\"}],[\"path\",{\"d\":\"M12 4l0 12\",\"key\":\"svg-2\"}]]\n\nconst IconDownload = createReactComponent('outline', 'download', 'Download', __iconNode);\n\nexport default IconDownload;","import createReactComponent from '../createReactComponent';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [[\"path\",{\"d\":\"M14 3v4a1 1 0 0 0 1 1h4\",\"key\":\"svg-0\"}],[\"path\",{\"d\":\"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2\",\"key\":\"svg-1\"}],[\"path\",{\"d\":\"M8 11h8v7h-8l0 -7\",\"key\":\"svg-2\"}],[\"path\",{\"d\":\"M8 15h8\",\"key\":\"svg-3\"}],[\"path\",{\"d\":\"M11 11v7\",\"key\":\"svg-4\"}]]\n\nconst IconFileSpreadsheet = createReactComponent('outline', 'file-spreadsheet', 'FileSpreadsheet', __iconNode);\n\nexport default IconFileSpreadsheet;","import createReactComponent from '../createReactComponent';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [[\"path\",{\"d\":\"M12 3a9 9 0 1 0 9 9\",\"key\":\"svg-0\"}]]\n\nconst IconLoader2 = createReactComponent('outline', 'loader-2', 'Loader2', __iconNode);\n\nexport default IconLoader2;","import createReactComponent from '../createReactComponent';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [[\"path\",{\"d\":\"M15 8h.01\",\"key\":\"svg-0\"}],[\"path\",{\"d\":\"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12\",\"key\":\"svg-1\"}],[\"path\",{\"d\":\"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5\",\"key\":\"svg-2\"}],[\"path\",{\"d\":\"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3\",\"key\":\"svg-3\"}]]\n\nconst IconPhoto = createReactComponent('outline', 'photo', 'Photo', __iconNode);\n\nexport default IconPhoto;","import createReactComponent from '../createReactComponent';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [[\"path\",{\"d\":\"M7 13v-8a1 1 0 0 0 -1 -1h-2a1 1 0 0 0 -1 1v7a1 1 0 0 0 1 1h3a4 4 0 0 1 4 4v1a2 2 0 0 0 4 0v-5h3a2 2 0 0 0 2 -2l-1 -5a2 3 0 0 0 -2 -2h-7a3 3 0 0 0 -3 3\",\"key\":\"svg-0\"}]]\n\nconst IconThumbDown = createReactComponent('outline', 'thumb-down', 'ThumbDown', __iconNode);\n\nexport default IconThumbDown;","import createReactComponent from '../createReactComponent';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [[\"path\",{\"d\":\"M7 11v8a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-7a1 1 0 0 1 1 -1h3a4 4 0 0 0 4 -4v-1a2 2 0 0 1 4 0v5h3a2 2 0 0 1 2 2l-1 5a2 3 0 0 1 -2 2h-7a3 3 0 0 1 -3 -3\",\"key\":\"svg-0\"}]]\n\nconst IconThumbUp = createReactComponent('outline', 'thumb-up', 'ThumbUp', __iconNode);\n\nexport default IconThumbUp;","import { IconAlertCircle, IconCheck, IconCopy, IconLoader2, type Icon as TablerIcon } from \"@tabler/icons-react\";\nimport { useCallback, type ReactNode } from \"react\";\n\nimport { IconButton } from \"@/components/icon-button/icon-button\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"@/components/ui/tooltip\";\n\nimport type { ArtifactCopyAsImageButtonProps, CopyAsImageStatus } from \"./types\";\nimport { useCopyAsImage } from \"./use-copy-as-image\";\n\n/**\n * Trim error messages surfaced in the failure-state tooltip / aria-label. Long S3 presigned URLs\n * or stringified stack frames from `html-to-image`'s internals can otherwise produce multi-KB\n * strings that blow out tooltips and leak unnecessary detail.\n *\n * Inlined here (rather than re-exported from `@/capture/dom-to-image`) so this lightweight UI\n * component doesn't pull the entire capture module into chat/blocks/artifacts chunks via a\n * static import — the capture module's font data URLs (~100 KB) load lazily on first click via\n * `useCopyAsImage`'s dynamic import.\n */\nconst MAX_ERROR_MESSAGE_CHARS = 120;\nfunction truncateErrorMessage(message: string, max = MAX_ERROR_MESSAGE_CHARS): string {\n return message.length <= max ? message : `${message.slice(0, max - 1)}…`;\n}\n\n/** English fallback label for the idle state. Each per-type artifact orchestrator passes a\n * localized label in via its own `labels` bag; this default keeps the button usable for any\n * consumer rendering it standalone (e.g. in Storybook). Mirrors `ArtifactDownloadButton`. */\nconst DEFAULT_LABEL = \"Copy Image\";\n\nconst ICON_BY_STATUS: Record<CopyAsImageStatus, TablerIcon> = {\n // `IconCopy` reads as the clipboard-copy affordance (action-shaped), distinct from the\n // download menu's format-shaped icons. The button only ever puts bytes on the clipboard, so\n // the visual signal stays consistent across copy-aware artifact types.\n idle: IconCopy,\n working: IconLoader2,\n success: IconCheck,\n error: IconAlertCircle,\n};\n\nconst TRANSIENT_TOOLTIP_BY_STATUS: Partial<Record<CopyAsImageStatus, string>> = {\n working: \"Copying…\",\n success: \"Copied\",\n error: \"Copy failed\",\n};\n\n/**\n * Reusable \"copy artifact as image\" button for artifact headers. Drop it inside\n * `<ArtifactActions>` alongside `ArtifactDownloadButton`.\n *\n * Captures the DOM node referenced by `targetRef`, rasterises it to PNG, and writes the result\n * to the system clipboard. Must be invoked from a user gesture (the button click is enough).\n *\n * The button flashes a check icon on success and an alert icon on failure, reverting to its\n * idle photo icon after ~1.5s. While capturing, it disables itself and shows a spinner.\n *\n * On failure, the rejection is logged via `console.warn` so production errors are visible in\n * observability tooling (any consumer wiring a global console transport — Sentry, Datadog,\n * Logfire — picks them up). The user-visible affordance is the error-state flash + tooltip.\n */\nexport function ArtifactCopyAsImageButton({\n targetRef,\n label = DEFAULT_LABEL,\n disabled = false,\n onClick,\n}: ArtifactCopyAsImageButtonProps): ReactNode {\n const { status, error, copy } = useCopyAsImage(targetRef);\n\n const handleClick = useCallback(() => {\n onClick?.();\n copy().catch((err: unknown) => {\n // Surface to observability tooling. The state machine handles the user-visible flash; this\n // is the channel by which a global console transport (Sentry, Datadog, Logfire) picks the\n // failure up so on-call can correlate clipboard / canvas / permission rejections.\n console.warn(\"[clay] ArtifactCopyAsImageButton: copy failed\", err);\n });\n }, [copy, onClick]);\n\n // Single source of truth for both the tooltip and the aria-label so screen-reader users hear\n // the same context that the tooltip displays — including the truncated error message in the\n // error state. (Without this, the aria-label was \"Copy failed\" while the tooltip surfaced the\n // specific reason; that divergence was flagged in PR #60 review.)\n const statusLabel =\n status === \"idle\"\n ? label\n : status === \"error\" && error\n ? `Copy failed: ${truncateErrorMessage(error.message)}`\n : TRANSIENT_TOOLTIP_BY_STATUS[status] ?? label;\n\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <IconButton\n icon={ICON_BY_STATUS[status]}\n size=\"small\"\n onClick={handleClick}\n disabled={disabled || status === \"working\"}\n aria-label={statusLabel}\n />\n </TooltipTrigger>\n <TooltipContent>{statusLabel}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n","import * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { cn } from \"@/lib/utils\";\n\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\n\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]\",\n className\n )}\n {...props}\n />\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n","import { useCallback, useEffect, useRef, useState, type RefObject } from \"react\";\n\nimport type { UseCopyAsImageOptions, UseCopyAsImageResult, CopyAsImageStatus } from \"./types\";\n\nconst DEFAULT_RESET_AFTER_MS = 1500;\n\n/**\n * Internal hook powering `ArtifactCopyAsImageButton`. Not exported from any clay entry point.\n *\n * Wraps `copyNodeAsPng` with a small state machine so the button can flash a success or error\n * indicator before reverting to its idle icon. Bails out cleanly when the ref is not attached\n * (the call returns rejected; status becomes `error` with a descriptive message).\n *\n * **Generalising for a non-image copy button**: the state machine + auto-reset timer +\n * ref-not-attached guard are all generic to \"trigger an async action, flash success/error,\n * revert to idle\". To reuse this shape for any other copy affordance (copy table CSV, copy\n * link, copy code block), refactor in two moves rather than re-implementing it:\n *\n * 1. Rename to `useAsyncFlash`, replace the `await copyNodeAsPng(...)` line with an\n * injected `action: () => Promise<void>` parameter, drop the `targetRef` argument (the\n * caller's action closure owns whatever target it needs).\n * 2. Move `useAsyncFlash` to `src/hooks/` (a new top-level hooks entry, or somewhere it can\n * be imported by both this button and the new copy-table-csv button).\n *\n * The capture-specific bits living here today (`copyNodeAsPng` dynamic import, target-ref\n * unattached message) become a thin wrapper:\n *\n * const action = useCallback(async () => {\n * const node = targetRef.current; if (!node) throw new Error(\"…\");\n * const { copyNodeAsPng } = await import(\"@/capture/dom-to-image\");\n * await copyNodeAsPng(node, nodeOptions);\n * }, [targetRef, nodeOptions]);\n * return useAsyncFlash(action, { resetAfterMs });\n *\n * Postponed until a second consumer appears — premature abstraction with one call site.\n */\nexport function useCopyAsImage(\n targetRef: RefObject<HTMLElement | null>,\n options: UseCopyAsImageOptions = {}\n): UseCopyAsImageResult {\n const [status, setStatus] = useState<CopyAsImageStatus>(\"idle\");\n const [error, setError] = useState<Error | null>(null);\n const resetTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n return () => {\n if (resetTimerRef.current !== null) clearTimeout(resetTimerRef.current);\n };\n }, []);\n\n // `copy` closes over `options` directly — no `latestOptions` ref + no-deps `useEffect`. The\n // earlier \"latest-ref\" pattern existed to keep `copy` referentially stable across renders,\n // but the only consumer is the button's `onClick`, which doesn't depend on identity. Adding\n // `options` to the dep list means `copy` recreates per render — negligible perf cost for\n // this hook.\n const copy = useCallback(async () => {\n if (resetTimerRef.current !== null) {\n clearTimeout(resetTimerRef.current);\n resetTimerRef.current = null;\n }\n\n const { resetAfterMs = DEFAULT_RESET_AFTER_MS, ...nodeOptions } = options;\n\n const scheduleReset = () => {\n if (resetAfterMs <= 0) return;\n resetTimerRef.current = setTimeout(() => {\n resetTimerRef.current = null;\n setStatus(\"idle\");\n setError(null);\n }, resetAfterMs);\n };\n\n const node = targetRef.current;\n if (!node) {\n const err = new Error(\"ArtifactCopyAsImageButton: target ref is not attached to a DOM node.\");\n setError(err);\n setStatus(\"error\");\n scheduleReset();\n throw err;\n }\n setError(null);\n setStatus(\"working\");\n try {\n // Dynamic import: defers the capture chunk (Geist + Crimson Pro data URLs +\n // html-to-image) until the first copy click. The bundler emits this as a separate\n // chunk that only loads on demand — a consumer who imports `@shapesos/clay/chat`\n // but never triggers a copy never downloads the bytes.\n const { copyNodeAsPng } = await import(\"@/capture/dom-to-image\");\n await copyNodeAsPng(node, nodeOptions);\n setStatus(\"success\");\n scheduleReset();\n } catch (err) {\n const wrapped = err instanceof Error ? err : new Error(String(err));\n setError(wrapped);\n setStatus(\"error\");\n scheduleReset();\n throw wrapped;\n }\n }, [targetRef, options]);\n\n return { status, error, copy };\n}\n","import { IconDownload } from \"@tabler/icons-react\";\nimport type { ReactNode } from \"react\";\n\nimport { IconButton } from \"@/components/icon-button/icon-button\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"@/components/ui/tooltip\";\n\n/** English fallback label. Each per-type artifact passes a localized label in via the\n * `labels` prop; this default keeps the button usable for any consumer rendering it standalone. */\nconst DEFAULT_LABEL = \"Download CSV\";\n\n/** Props for `ArtifactDownloadButton`. */\nexport interface ArtifactDownloadButtonProps {\n /**\n * URL to download the artifact's underlying bytes. The button is an `<a href download>` so the\n * browser uses whatever filename the server supplies via `Content-Disposition`. No client-side\n * filename invention.\n *\n * Renders nothing when the URL is not a safe `http(s):` scheme — guards against `javascript:` or\n * `data:` URIs smuggled into `presignedUrl`.\n */\n href: string;\n /**\n * Tooltip text + `aria-label` for the button. Optional — defaults to `\"Download CSV\"` so direct\n * consumers don't have to pass anything for the common case. Per-type artifact orchestrators\n * (`<ChartArtifact>`, `<TableArtifact>`) pass a translated value via their own `labels` prop so\n * the button reads in the user's language.\n */\n label?: string;\n /**\n * Optional callback fired on click — runs alongside the browser's native download navigation\n * (no `preventDefault`). Used for analytics / observability hooks; per-type artifact\n * orchestrators wire this from their `callbacks` prop.\n */\n onClick?: () => void;\n}\n\n/**\n * Reusable download button for artifact headers. Anchor-based so the browser handles the download\n * natively (respects `Content-Disposition`, falls back to URL basename). `rel=\"noopener noreferrer\"`\n * defends against `window.opener` leakage if the browser opens the URL instead of downloading.\n *\n * Drop this inside `<ArtifactActions>` in any per-type artifact orchestrator.\n */\nexport function ArtifactDownloadButton({\n href,\n label = DEFAULT_LABEL,\n onClick,\n}: ArtifactDownloadButtonProps): ReactNode {\n if (!isSafeDownloadUrl(href)) return null;\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <IconButton\n as=\"a\"\n href={href}\n download\n rel=\"noopener noreferrer\"\n onClick={onClick}\n icon={IconDownload}\n size=\"small\"\n aria-label={label}\n />\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n\n/**\n * Returns `true` only for `http:` and `https:` URLs. Rejects `javascript:`, `data:`, and any\n * other scheme that could execute code on click.\n */\nexport function isSafeDownloadUrl(url: string): boolean {\n try {\n const parsed = new URL(url);\n return parsed.protocol === \"https:\" || parsed.protocol === \"http:\";\n } catch {\n return false;\n }\n}\n","import { IconDownload, IconFileSpreadsheet, IconPhoto } from \"@tabler/icons-react\";\nimport { useCallback, type ReactNode } from \"react\";\n\n// `downloadNodeAsPng` is lazy-loaded inside `handlePngSelect` below — see use-copy-as-image\n// for the bundle-size rationale. The capture chunk (Geist + Crimson Pro data URLs +\n// html-to-image) only loads when the user actually clicks \"Download PNG\".\nimport { isSafeDownloadUrl } from \"@/components/artifacts/artifact-download-button/artifact-download-button\";\nimport { IconButton } from \"@/components/icon-button/icon-button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"@/components/ui/tooltip\";\n\nimport type { ArtifactDownloadMenuProps } from \"./types\";\n\n/** English fallback labels for the trigger button + each menu item. Per-type artifact\n * orchestrators pass localised values via their own `labels` bag. */\nconst DEFAULT_TRIGGER_LABEL = \"Download\";\nconst DEFAULT_CSV_LABEL = \"Download CSV\";\nconst DEFAULT_PNG_LABEL = \"Download PNG\";\nconst DEFAULT_PNG_BASENAME = \"artifact\";\n\n/**\n * Reusable \"Download\" affordance for artifact headers. Renders as a single icon-button trigger;\n * clicking it opens a menu with one item per format the caller passes via `actions`. Today's\n * formats: CSV (presigned URL) + PNG (DOM-to-image rasterise). Future formats (SVG, XLSX, …)\n * slot into the same `actions` bag without touching the call-site prop list.\n *\n * Drop this inside `<ArtifactActions>` in any per-type artifact orchestrator that supports\n * multiple download formats. For single-format artifacts (e.g. a future table artifact that\n * only ships CSV), prefer the simpler `ArtifactDownloadButton` instead.\n *\n * The menu uses Radix's `DropdownMenu` primitive (vendored in `src/components/ui/dropdown-menu.tsx`)\n * with `asChild` on the trigger so clay's `IconButton` is the real button — preserves the\n * design-system look across all action affordances.\n */\nexport function ArtifactDownloadMenu({\n actions,\n triggerLabel = DEFAULT_TRIGGER_LABEL,\n}: ArtifactDownloadMenuProps): ReactNode {\n const { csv, png } = actions;\n // CSV item is hidden when the URL fails the safety check — keeps the safe-URL guard at one\n // layer instead of relying on every caller to filter unsafe URLs upstream. PNG has no\n // equivalent URL surface; it's always rendered when `actions.png` is present (the\n // `disabled` knob is the caller's gate for \"data not ready\").\n const showCsv = csv !== undefined && isSafeDownloadUrl(csv.href);\n const showPng = png !== undefined;\n\n const handlePngSelect = useCallback(async () => {\n if (!png) return;\n png.onSelect?.();\n const node = png.targetRef.current;\n if (!node) return;\n const filename = `${png.filename ?? DEFAULT_PNG_BASENAME}.png`;\n try {\n // Dynamic import: defers the capture chunk (Geist + Crimson Pro data URLs +\n // html-to-image) until the first PNG-download click. See `use-copy-as-image` for the\n // bundle-size rationale.\n const { downloadNodeAsPng } = await import(\"@/capture/dom-to-image\");\n await downloadNodeAsPng(node, filename);\n } catch (err) {\n // Surface to observability tooling. No state flash on the menu item itself — the dropdown\n // closes on select; a failed rasterise produces a console.warn for on-call to correlate.\n console.warn(\"[clay] ArtifactDownloadMenu: PNG download failed\", err);\n }\n }, [png]);\n\n return (\n <DropdownMenu>\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <DropdownMenuTrigger asChild>\n <IconButton icon={IconDownload} size=\"small\" aria-label={triggerLabel} />\n </DropdownMenuTrigger>\n </TooltipTrigger>\n <TooltipContent>{triggerLabel}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n <DropdownMenuContent align=\"end\">\n {showCsv ? (\n // `asChild` lets Radix render the item as our anchor — the browser handles the\n // download natively and respects `Content-Disposition`. The analytics callback rides\n // on the anchor's own `onClick` (rather than Radix's `onSelect`) so the same handler\n // fires whether the user mouse-clicks the item, hits Enter on it, or activates it via\n // touch — `onSelect` is reliable only for keyboard activation when `asChild` is in use.\n <DropdownMenuItem asChild>\n <a href={csv.href} download rel=\"noopener noreferrer\" onClick={csv.onSelect}>\n <IconFileSpreadsheet />\n {csv.label ?? DEFAULT_CSV_LABEL}\n </a>\n </DropdownMenuItem>\n ) : null}\n {showPng ? (\n <DropdownMenuItem onSelect={handlePngSelect} disabled={png.disabled ?? false}>\n <IconPhoto />\n {png.label ?? DEFAULT_PNG_LABEL}\n </DropdownMenuItem>\n ) : null}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n","import * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\n\nimport { cn } from \"@/lib/utils\";\n\n/* ------------------------------------------------------------------------------------------------\n * Vendored shadcn `DropdownMenu` primitive (slim subset: Root / Trigger / Content / Item / Separator\n * / Label). Built on `@radix-ui/react-dropdown-menu`. Mirrors the same shape as the existing\n * `tooltip.tsx` vendor — only the styled leaves (`Content`, `Item`, etc.) carry Tailwind classes\n * that `forwardRef` apply; the plumbing primitives (`Root`, `Trigger`) re-export Radix directly so\n * future shadcn re-scaffolds drop in cleanly.\n *\n * Internal-only by convention (CLAUDE.md): not exported from any clay entry point. The chart\n * artifact is the only consumer today (`ArtifactDownloadMenu`). Promote to a public\n * `@shapesos/clay/dropdown-menu` entry only when something outside `src/components/artifacts/`\n * needs it.\n *\n * Triggers should use `asChild` so clay's `IconButton` slots in as the actual trigger element —\n * the project rule is \"no new vendored shadcn primitives without a need, and route inner buttons\n * through clay's `Button` / `IconButton`\".\n * ------------------------------------------------------------------------------------------------ */\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n // Stacking is consumer-configurable via the `--z-popover` CSS variable (default `99999`,\n // declared in clay's generated `_theme-tokens.css` :root block). Consumers whose chat or\n // modal layer sits even higher override on their own root once:\n // :root { --z-popover: 9999999; }\n // and every clay floating surface picks the new value up via cascade. The fallback in\n // `var(...,99999)` only kicks in if the consumer also strips the clay stylesheet — which\n // they shouldn't, but the safety net costs nothing.\n \"z-[var(--z-popover,99999)] min-w-[10rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & { inset?: boolean }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors\",\n \"focus:bg-accent focus:text-accent-foreground\",\n \"data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n \"[&_svg]:size-4 [&_svg]:shrink-0\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator ref={ref} className={cn(\"-mx-1 my-1 h-px bg-muted\", className)} {...props} />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & { inset?: boolean }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\"px-2 py-1.5 text-sm font-semibold\", inset && \"pl-8\", className)}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuPortal,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuLabel,\n};\n","import { useEffect, useMemo, useRef, type ReactNode } from \"react\";\n\nimport {\n Artifact,\n ArtifactActions,\n ArtifactContent,\n ArtifactHeader,\n ArtifactTitle,\n} from \"@/components/ai-elements/artifact\";\nimport { CAPTURE_EXCLUDE_ATTRIBUTE } from \"@/capture/capture-exclude-attribute\";\nimport { ArtifactCopyAsImageButton } from \"@/components/artifacts/artifact-copy-as-image-button/artifact-copy-as-image-button\";\nimport { isSafeDownloadUrl } from \"@/components/artifacts/artifact-download-button/artifact-download-button\";\nimport { ArtifactDownloadMenu } from \"@/components/artifacts/artifact-download-menu/artifact-download-menu\";\nimport {\n DEFAULT_CHART_ARTIFACT_LABELS,\n type ArtifactServiceProps,\n type ChartArtifactLabels,\n type ChartArtifactRecord,\n} from \"@/components/artifacts/types\";\nimport { StatusMessage } from \"../status-message\";\nimport { ChartArtifactContent } from \"./chart-artifact-content\";\nimport { useChartArtifactData } from \"./use-chart-artifact-data\";\nimport { isValidChartConfig } from \"./validate\";\n\nconst TITLE_CLASSES = \"text-sm font-semibold text-foreground\";\n\n/**\n * Chart height. Picks a single sensible size for all three variants so chat layout stays\n * predictable — mirrors `TableArtifact`'s `TABLE_MAX_BODY_HEIGHT` approach. Width is fluid via\n * recharts' `ResponsiveContainer`.\n */\nconst CHART_HEIGHT = 320;\n\n/**\n * Orchestrator for the `CHART`-typed artifact.\n *\n * Composes the ai-elements chrome primitives (`Artifact`, `ArtifactHeader`, `ArtifactTitle`,\n * `ArtifactActions`, `ArtifactContent`) directly around the chart body (`ChartArtifactContent`),\n * matching `TableArtifact`'s shape. Loading / error / unavailable / empty states render an inline\n * `StatusMessage`; the ready state delegates to per-variant recharts trees inside\n * `ChartArtifactContent`.\n *\n * The renderer is variant-agnostic at this level — it doesn't know about LINE vs BAR vs PIE.\n * Variant dispatch lives inside `ChartArtifactContent` so the orchestrator can focus on the\n * data lifecycle and the chrome.\n *\n * Labels for action buttons (download, copy-as-image) are pulled from the optional `labels`\n * prop with per-key fallback to `DEFAULT_CHART_ARTIFACT_LABELS`. Consumers translate via their\n * own i18n layer and pass the bag; non-i18n consumers omit it and get English defaults.\n *\n * `ArtifactCopyAsImageButton` snapshots the card root to PNG. The ref attaches directly to the\n * `<Artifact>` primitive (which forwards refs as of this PR), so the captured DOM contains the\n * artifact chrome exactly — no extra wrapper div, no layout-contract drift. The action toolbar\n * carries `data-clay-capture-exclude` so its own buttons don't end up in the captured image.\n */\nexport function ChartArtifact({ artifact, labels, callbacks }: ArtifactServiceProps<ChartArtifactRecord>): ReactNode {\n const validConfig = isValidChartConfig(artifact.config);\n const cardRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (validConfig) return;\n console.warn(\"[clay] ChartArtifact: malformed `config` — skipping render.\");\n }, [validConfig]);\n\n const presignedUrl = artifact.protectedAsset?.presignedUrl ?? null;\n\n // Merge consumer-supplied labels over the English defaults. Per-key Partial merge means a\n // consumer can translate `download` and leave future keys to fall back. Memoised so resolved\n // labels are referentially stable across renders.\n const resolvedLabels = useMemo<ChartArtifactLabels>(\n () => ({ ...DEFAULT_CHART_ARTIFACT_LABELS, ...(labels ?? {}) }),\n [labels]\n );\n\n // Hook is always called (Rules of Hooks). Pass null URL when config is invalid so the hook\n // short-circuits at its `if (!presignedUrl) return UNAVAILABLE` path — no network fetch fires\n // for an artifact whose config shape can't be rendered.\n const data = useChartArtifactData(\n validConfig ? presignedUrl : null,\n validConfig ? artifact.config : { variant: \"LINE\", series: [], xKey: \"x\" }\n );\n\n // Bridge the consumer's callbacks into the action buttons. Wrapped to capture `artifact` so\n // each callback receives analytics context. `undefined` (rather than a no-op) when no callback\n // is wired — keeps each item free of a redundant select listener.\n const { onDownload, onDownloadPng, onCopyAsImage } = callbacks ?? {};\n const handleDownloadCsvSelect = onDownload ? () => onDownload(artifact) : undefined;\n const handleDownloadPngSelect = onDownloadPng ? () => onDownloadPng(artifact) : undefined;\n const handleCopyAsImageClick = onCopyAsImage ? () => onCopyAsImage(artifact) : undefined;\n\n // The Copy-as-image action is meaningful only once the chart has actually rendered. Before\n // that, the captured PNG would either be a \"Loading…\" status message or nothing at all —\n // disable the button until the data resolves to a renderable state. Hidden entirely when the\n // chart config is malformed (the artifact would never render a chart, so a permanently-disabled\n // affordance is just noise).\n // Render gates:\n // - Copy button: visible only when the config is valid (a permanently-disabled affordance on\n // a malformed artifact is just noise). Disabled until the chart actually renders so the\n // captured PNG isn't a \"Loading…\" status message.\n // - Download menu: visible when there's *any* format to offer. PNG requires `validConfig`\n // (no chart → nothing to rasterise). CSV requires a *safe* presigned URL — `isSafeDownloadUrl`\n // gates against `javascript:` / `data:` URIs smuggled into the field, matching the guard\n // `ArtifactDownloadButton` applies on the item itself. Without this hoist, an unsafe URL\n // would surface the menu trigger but yield no usable items (Bugbot 1544f88a).\n const canCopyAsImage = data.status === \"ready\" && data.rows.length > 0;\n const canDownloadPng = data.status === \"ready\" && data.rows.length > 0;\n const isCsvDownloadAvailable = presignedUrl !== null && isSafeDownloadUrl(presignedUrl);\n const showDownloadMenu = (validConfig && canDownloadPng) || isCsvDownloadAvailable;\n const showActions = validConfig || showDownloadMenu;\n\n // Derive a friendly PNG filename from the artifact title so the saved file is recognisable.\n // Fallback to \"chart\" when no title is set OR when stripping non-alphanumerics produces an\n // empty string (e.g. title is \"???\" or all-emoji). The menu appends `.png` so we pass the\n // basename.\n //\n // `split → filter → join` (vs. a `.replace(/^-+|-+$/g, \"\")` trim) avoids a polynomial-regex\n // pattern CodeQL flags on user-controlled input. Functionally identical: any run of\n // non-alphanumerics becomes a single `-`, and leading/trailing empty splits are dropped.\n const pngFilename =\n (artifact.title ?? \"\")\n .toLowerCase()\n .split(/[^a-z0-9]+/)\n .filter(Boolean)\n .join(\"-\") || \"chart\";\n\n return (\n <Artifact ref={cardRef} className=\"shadow-none w-full rounded-2xl bg-background/70\">\n <ArtifactHeader className=\"bg-background/70\">\n {artifact.title ? <ArtifactTitle className={TITLE_CLASSES}>{artifact.title}</ArtifactTitle> : <span />}\n {showActions ? (\n <ArtifactActions {...{ [CAPTURE_EXCLUDE_ATTRIBUTE]: \"\" }}>\n {validConfig ? (\n <ArtifactCopyAsImageButton\n targetRef={cardRef}\n label={resolvedLabels.copyAsImage}\n disabled={!canCopyAsImage}\n onClick={handleCopyAsImageClick}\n />\n ) : null}\n {showDownloadMenu ? (\n <ArtifactDownloadMenu\n triggerLabel={resolvedLabels.download}\n actions={{\n csv: isCsvDownloadAvailable\n ? {\n href: presignedUrl ?? \"\",\n label: resolvedLabels.downloadCsv,\n onSelect: handleDownloadCsvSelect,\n }\n : undefined,\n png: validConfig\n ? {\n targetRef: cardRef,\n filename: pngFilename,\n label: resolvedLabels.downloadPng,\n disabled: !canDownloadPng,\n onSelect: handleDownloadPngSelect,\n }\n : undefined,\n }}\n />\n ) : null}\n </ArtifactActions>\n ) : null}\n </ArtifactHeader>\n {/*\n `flex-none` overrides ai-elements' default `flex-1`. In a column flex container\n `flex: 1 1 0%` sets `flex-basis: 0%` which beats the inline `height` per CSS flex spec —\n leaving the chart's `ResponsiveContainer` 0px tall with no visible SVG.\n `flex items-center justify-center` vertically + horizontally centres status messages\n (loading / error / unavailable / empty) in the 320px area; the chart itself fills the\n whole box because its `<ChartContainer>` sets `width:100% height:100%`.\n */}\n <ArtifactContent\n className=\"p-4 overflow-visible flex flex-none items-center justify-center\"\n style={{ height: CHART_HEIGHT }}\n >\n {renderBody(validConfig, artifact, data, resolvedLabels)}\n </ArtifactContent>\n </Artifact>\n );\n}\n\n/** Splits the body branches out so the orchestrator's JSX stays readable. Labels are pre-merged\n * by the caller, so each branch reads a single field on a complete object. */\nfunction renderBody(\n validConfig: boolean,\n artifact: ChartArtifactRecord,\n data: ReturnType<typeof useChartArtifactData>,\n labels: ChartArtifactLabels\n): ReactNode {\n if (!validConfig) {\n return <StatusMessage $tone=\"info\">{labels.unavailable}</StatusMessage>;\n }\n if (data.status === \"error\") {\n // No retry hook today — mirrors `TableArtifact`. Wire `onRetry` into `ArtifactService` when\n // a fresh-presigned-URL mint flow exists.\n return <StatusMessage $tone=\"error\">{labels.loadError}</StatusMessage>;\n }\n if (data.status === \"unavailable\") {\n return <StatusMessage $tone=\"info\">{labels.unavailable}</StatusMessage>;\n }\n if (data.status === \"loading\") {\n return <StatusMessage $tone=\"info\">{labels.loading}</StatusMessage>;\n }\n // data.status === \"ready\"\n if (data.rows.length === 0) {\n return <StatusMessage $tone=\"info\">{labels.empty}</StatusMessage>;\n }\n return <ChartArtifactContent config={artifact.config} rows={data.rows} labels={labels} />;\n}\n","import { forwardRef, type HTMLAttributes } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\n/* ------------------------------------------------------------------------------------------------\n * Originally vendored from `@vercel/ai-elements`'s `artifact` registry entry — see\n * https://elements.ai-sdk.dev/api/registry/artifact.json. Slimmed to the chrome primitives clay\n * actually composes (`Artifact`, `ArtifactHeader`, `ArtifactTitle`, `ArtifactActions`,\n * `ArtifactContent`). The original entry also shipped `ArtifactClose`, `ArtifactDescription`, and\n * `ArtifactAction` — all dependent on the shadcn `Button` primitive, none of which clay consumes.\n * Action buttons inside the artifact header use clay's `IconButton` (see `TableArtifact`'s\n * `ExportCsvButton`) instead of a generic shadcn Button, so the design system stays single-sourced.\n *\n * Local clay-only change: `Artifact` is `forwardRef` so per-type orchestrators (e.g.\n * `ChartArtifact`) can ref the card root for DOM-to-image capture without wrapping it in an\n * extra `<div>` that would otherwise break the layout contract (parents query offsetWidth /\n * apply gap against the wrapper, not the artifact). Matches the `forwardRef` convention used\n * across `src/components/ui/*` and clay's own primitives.\n *\n * If a future ai-elements re-scaffold needs one of the dropped primitives back, re-add only the\n * piece consumers need and route its inner button through clay's `Button` / `IconButton` rather\n * than re-introducing the shadcn Button file.\n * ------------------------------------------------------------------------------------------------ */\n\nexport type ArtifactProps = HTMLAttributes<HTMLDivElement>;\n\nexport const Artifact = forwardRef<HTMLDivElement, ArtifactProps>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm\", className)}\n {...props}\n />\n));\nArtifact.displayName = \"Artifact\";\n\nexport type ArtifactHeaderProps = HTMLAttributes<HTMLDivElement>;\n\nexport const ArtifactHeader = ({ className, ...props }: ArtifactHeaderProps) => (\n <div className={cn(\"flex items-center justify-between border-b bg-muted/50 px-4 py-3\", className)} {...props} />\n);\n\nexport type ArtifactTitleProps = HTMLAttributes<HTMLParagraphElement>;\n\nexport const ArtifactTitle = ({ className, ...props }: ArtifactTitleProps) => (\n <p className={cn(\"font-medium text-foreground text-sm\", className)} {...props} />\n);\n\nexport type ArtifactActionsProps = HTMLAttributes<HTMLDivElement>;\n\nexport const ArtifactActions = ({ className, ...props }: ArtifactActionsProps) => (\n <div className={cn(\"flex items-center gap-1\", className)} {...props} />\n);\n\nexport type ArtifactContentProps = HTMLAttributes<HTMLDivElement>;\n\nexport const ArtifactContent = ({ className, ...props }: ArtifactContentProps) => (\n <div className={cn(\"flex-1 overflow-auto p-4\", className)} {...props} />\n);\n","import type { ReactNode } from \"react\";\n\nimport { createElement } from \"react\";\n\ninterface StatusMessageProps {\n /** Visual tone: \"error\" renders red copy, \"info\" renders muted brown copy. */\n $tone?: \"info\" | \"error\";\n children: ReactNode;\n}\n\n/**\n * Centred status copy rendered inside an artifact when there is nothing to show — loading\n * without a known size, error, or unavailable. Shared across every artifact kind that needs\n * an inline status surface; Tailwind-styled so it stays consistent with the artifact chrome.\n */\nexport function StatusMessage({ $tone, children }: StatusMessageProps): ReactNode {\n return createElement(\n \"div\",\n {\n className: `py-6 px-2 text-center text-sm font-medium leading-5 ${\n $tone === \"error\" ? \"text-red-600\" : \"text-brown-70\"\n }`,\n },\n children\n );\n}\n","/**\n * Shared constants used by every chart variant's render Component.\n *\n * Pulled into one module so a future tweak (e.g. changing the variants to render at a fixed\n * pixel height) is a one-line edit here instead of N matching edits across variant files.\n */\n\n/**\n * Height passed to every variant's chart-library component. `\"100%\"` flexes the chart inside\n * the artifact's content area — the orchestrator (`ChartArtifact`) owns the actual pixel\n * budget (via its own `CHART_HEIGHT`); the variant Components just fill the parent.\n */\nexport const VARIANT_CHART_HEIGHT = \"100%\" as const;\n","import { type ReactNode } from \"react\";\n\nimport { BarChart } from \"@/components/chart/bar-chart/bar-chart\";\nimport type { BarChartConfig } from \"./bar-chart-variant-service\";\nimport { VARIANT_CHART_HEIGHT } from \"./constants\";\nimport type { ChartVariantComponentProps } from \"./types\";\n\n/**\n * Render Component for the `BAR` chart variant. Maps the artifact's wire-shaped\n * `BarChartConfig` onto props for the high-level `<BarChart>` from `@shapesos/clay/chart`.\n *\n * Split out from `bar-chart-variant-service.ts` so the service file stays a pure declarative\n * registration (discriminator + validator + column keys + Component reference) — the React\n * tree lives here.\n */\nexport function BarChartVariantComponent({ config, rows }: ChartVariantComponentProps<BarChartConfig>): ReactNode {\n return (\n <BarChart\n data={rows}\n xKey={config.xKey}\n series={config.series}\n stacked={config.stacked}\n height={VARIANT_CHART_HEIGHT}\n />\n );\n}\n","import type { ChartSeries } from \"@/components/chart/types\";\nimport type { BarChartConfig } from \"./bar-chart-variant-service\";\nimport type { LineChartConfig } from \"./line-chart-variant-service\";\nimport type { PieChartConfig } from \"./pie-chart-variant-service\";\n\n/**\n * CSV-column-projection helpers — one per chart variant. Pulled into this shared module so each\n * variant service file stays focused on the service definition (variant discriminator,\n * isValidConfig, Component) and the column-key extraction lives next to its siblings.\n *\n * Line + Bar share the same shape (`xKey + series.key`) and use the same helper. Pie has its\n * own shape (`categoryKey + valueKey`).\n *\n * Used by each variant service's `columnKeys` field to drive `useChartArtifactData`'s CSV\n * projection (matches the table-artifact projection contract — keep only the columns the chart\n * actually reads, drop the rest).\n */\n\n/** Column keys for LINE / BAR variants: the x-axis column plus every series's data column. */\nexport function seriesBasedColumnKeys(config: LineChartConfig | BarChartConfig): string[] {\n return [config.xKey, ...config.series.map((s: ChartSeries) => s.key)];\n}\n\n/** Column keys for the PIE variant: the slice-label column plus the slice-value column. */\nexport function pieColumnKeys(config: PieChartConfig): string[] {\n return [config.categoryKey, config.valueKey];\n}\n","import type { ChartSeries } from \"@/components/chart/types\";\n\n/**\n * Minimum-viable series shape for LINE / BAR variants: non-empty string `key` + string `label`.\n * Pulled into a shared file so every variant service that consumes `series` reuses one definition.\n */\nexport function isValidChartSeries(series: unknown): series is ChartSeries {\n if (!series || typeof series !== \"object\") return false;\n const candidate = series as Record<string, unknown>;\n if (typeof candidate.key !== \"string\" || candidate.key.length === 0) return false;\n if (typeof candidate.label !== \"string\") return false;\n return true;\n}\n","import type { ChartConfigBase } from \"../types\";\nimport { BarChartVariantComponent } from \"./bar-chart-variant-component\";\nimport { seriesBasedColumnKeys } from \"./shared-column-keys\";\nimport { isValidChartSeries } from \"./shared-validators\";\nimport type { ChartVariantService } from \"./types\";\n\n/**\n * Rendering config for a `BAR` chart. `xKey` selects the categorical axis; each series\n * contributes one `<Bar>`. `stacked` collapses all series onto a single stack-id (so they sum\n * vertically); when false / omitted bars are grouped side-by-side per x-tick.\n */\nexport interface BarChartConfig extends ChartConfigBase {\n variant: \"BAR\";\n /** CSV column key used as the x-axis. */\n xKey: string;\n /** When true, stack all series on one stack-id. When false / omitted, group bars side-by-side. */\n stacked?: boolean;\n}\n\nfunction isValidBarChartConfig(config: unknown): config is BarChartConfig {\n if (!config || typeof config !== \"object\") return false;\n const candidate = config as Record<string, unknown>;\n if (candidate.variant !== \"BAR\") return false;\n if (typeof candidate.xKey !== \"string\" || candidate.xKey.length === 0) return false;\n if (!Array.isArray(candidate.series) || candidate.series.length === 0) return false;\n if (!candidate.series.every(isValidChartSeries)) return false;\n return true;\n}\n\nexport const BarChartVariantService: ChartVariantService<\"BAR\", BarChartConfig> = {\n variant: \"BAR\",\n isValidConfig: isValidBarChartConfig,\n columnKeys: seriesBasedColumnKeys,\n Component: BarChartVariantComponent,\n};\n","import { type ReactNode } from \"react\";\n\nimport { LineChart } from \"@/components/chart/line-chart/line-chart\";\nimport { VARIANT_CHART_HEIGHT } from \"./constants\";\nimport type { LineChartConfig } from \"./line-chart-variant-service\";\nimport type { ChartVariantComponentProps } from \"./types\";\n\n/**\n * Render Component for the `LINE` chart variant. Maps the artifact's wire-shaped\n * `LineChartConfig` onto props for the high-level `<LineChart>` from `@shapesos/clay/chart`.\n *\n * Split out from `line-chart-variant-service.ts` so the service file stays a pure declarative\n * registration — see `bar-chart-variant-component.tsx` for the rationale.\n */\nexport function LineChartVariantComponent({ config, rows }: ChartVariantComponentProps<LineChartConfig>): ReactNode {\n return <LineChart data={rows} xKey={config.xKey} series={config.series} height={VARIANT_CHART_HEIGHT} />;\n}\n","import type { ChartConfigBase } from \"../types\";\nimport { LineChartVariantComponent } from \"./line-chart-variant-component\";\nimport { seriesBasedColumnKeys } from \"./shared-column-keys\";\nimport { isValidChartSeries } from \"./shared-validators\";\nimport type { ChartVariantService } from \"./types\";\n\n/**\n * Rendering config for a `LINE` chart. `xKey` selects the categorical/temporal axis from the\n * CSV; each series contributes one `<Line>` overlaid against that axis.\n */\nexport interface LineChartConfig extends ChartConfigBase {\n variant: \"LINE\";\n /** CSV column key used as the x-axis. */\n xKey: string;\n}\n\nfunction isValidLineChartConfig(config: unknown): config is LineChartConfig {\n if (!config || typeof config !== \"object\") return false;\n const candidate = config as Record<string, unknown>;\n if (candidate.variant !== \"LINE\") return false;\n if (typeof candidate.xKey !== \"string\" || candidate.xKey.length === 0) return false;\n if (!Array.isArray(candidate.series) || candidate.series.length === 0) return false;\n if (!candidate.series.every(isValidChartSeries)) return false;\n return true;\n}\n\nexport const LineChartVariantService: ChartVariantService<\"LINE\", LineChartConfig> = {\n variant: \"LINE\",\n isValidConfig: isValidLineChartConfig,\n columnKeys: seriesBasedColumnKeys,\n Component: LineChartVariantComponent,\n};\n","import { type ReactNode } from \"react\";\n\nimport { PieChart } from \"@/components/chart/pie-chart/pie-chart\";\nimport { VARIANT_CHART_HEIGHT } from \"./constants\";\nimport type { PieChartConfig } from \"./pie-chart-variant-service\";\nimport type { ChartVariantComponentProps } from \"./types\";\n\n/**\n * Render Component for the `PIE` chart variant. Maps the artifact's wire-shaped\n * `PieChartConfig` onto props for the high-level `<PieChart>` from `@shapesos/clay/chart`,\n * threading the localized `othersCategoryLabels` from the resolved labels bag so non-English\n * UIs can auto-pin their translated \"Others\" bucket to the end of the sweep.\n *\n * Split out from `pie-chart-variant-service.ts` so the service file stays a pure declarative\n * registration — see `bar-chart-variant-component.tsx` for the rationale.\n */\nexport function PieChartVariantComponent({\n config,\n rows,\n labels,\n}: ChartVariantComponentProps<PieChartConfig>): ReactNode {\n return (\n <PieChart\n data={rows}\n categoryKey={config.categoryKey}\n valueKey={config.valueKey}\n othersCategoryLabels={labels.othersCategoryLabels}\n height={VARIANT_CHART_HEIGHT}\n />\n );\n}\n","import type { ChartConfigBase } from \"../types\";\nimport { PieChartVariantComponent } from \"./pie-chart-variant-component\";\nimport { pieColumnKeys } from \"./shared-column-keys\";\nimport type { ChartVariantService } from \"./types\";\n\n/**\n * Rendering config for a `PIE` chart. `categoryKey` names the slice; `valueKey` carries the\n * slice's numeric magnitude. One row of CSV becomes one slice. The base's `series` array is\n * always empty for pie — colors are resolved by row index from the palette.\n */\nexport interface PieChartConfig extends ChartConfigBase {\n variant: \"PIE\";\n /** CSV column key used as the slice label. */\n categoryKey: string;\n /** CSV column key used as the slice numeric value. */\n valueKey: string;\n}\n\nfunction isValidPieChartConfig(config: unknown): config is PieChartConfig {\n if (!config || typeof config !== \"object\") return false;\n const candidate = config as Record<string, unknown>;\n if (candidate.variant !== \"PIE\") return false;\n if (typeof candidate.categoryKey !== \"string\" || candidate.categoryKey.length === 0) return false;\n if (typeof candidate.valueKey !== \"string\" || candidate.valueKey.length === 0) return false;\n if (!Array.isArray(candidate.series)) return false;\n return true;\n}\n\nexport const PieChartVariantService: ChartVariantService<\"PIE\", PieChartConfig> = {\n variant: \"PIE\",\n isValidConfig: isValidPieChartConfig,\n columnKeys: pieColumnKeys,\n Component: PieChartVariantComponent,\n};\n","import type { ChartVariant } from \"@/components/chart/types\";\nimport { BarChartVariantService, type BarChartConfig } from \"./bar-chart-variant-service\";\nimport { LineChartVariantService, type LineChartConfig } from \"./line-chart-variant-service\";\nimport { PieChartVariantService, type PieChartConfig } from \"./pie-chart-variant-service\";\nimport type { ChartVariantService } from \"./types\";\n\n/**\n * Discriminated union of all supported chart variant configs. Assembled here (not in the parent\n * `types.ts`) because the union depends on each variant service file as its single source of\n * truth for that variant's config type.\n *\n * Extension pattern: add a new variant by creating one `*-chart-variant-service.ts` file and\n * extending this union + the `ChartVariantServices` map below. No edits to the dispatcher.\n */\nexport type ChartConfig = LineChartConfig | BarChartConfig | PieChartConfig;\n\nexport { type LineChartConfig, type BarChartConfig, type PieChartConfig };\nexport { LineChartVariantService, BarChartVariantService, PieChartVariantService };\nexport type { ChartVariantComponentProps, ChartVariantService } from \"./types\";\n\n/**\n * Map of chart-variant services keyed by `config.variant`. Mirrors the artifact / block service\n * registries. The chart-artifact dispatcher looks up `ChartVariantServices[config.variant]` at\n * runtime to resolve validation, column projection, and the render Component for the variant.\n *\n * `ChartVariantService<TVariant, TConfig>` is invariant in `TConfig` (props on the Component are\n * contravariant). Each concrete service overlaps structurally with the base `ChartVariantService`\n * enough for a direct `as ChartVariantService` cast at registration time — the dispatch only ever\n * pulls the matching variant out by runtime discriminator, so this is sound.\n */\nexport const ChartVariantServices: Record<ChartVariant, ChartVariantService> = {\n LINE: LineChartVariantService as ChartVariantService,\n BAR: BarChartVariantService as ChartVariantService,\n PIE: PieChartVariantService as ChartVariantService,\n};\n","import { type ReactNode } from \"react\";\n\nimport type { ArtifactDataRow } from \"@/components/artifacts/types\";\nimport { StatusMessage } from \"../status-message\";\nimport { ChartVariantServices } from \"./chart-variant-services\";\nimport type { ChartConfig, ChartArtifactLabels } from \"./types\";\n\n/**\n * Props for the chart-artifact variant dispatcher. Internal to the artifact path — the\n * orchestrator (`chart-artifact.tsx`) is the only caller. By the time these props are\n * constructed, `config` has been narrowed by `isValidChartConfig` and `rows` has resolved to\n * the `\"ready\"` state of the data hook.\n */\nexport interface ChartArtifactContentProps {\n /** Validated chart config — narrowed by `variant` for per-variant component selection. */\n config: ChartConfig;\n /** Parsed CSV rows. Caller guards `rows.length > 0` before rendering this. */\n rows: ArtifactDataRow[];\n /** Fully-resolved labels bag — supplies the fallback message when the variant is unsupported. */\n labels: ChartArtifactLabels;\n}\n\n/**\n * Variant dispatcher for `ChartArtifact`. Looks up the matching per-variant service in the\n * `ChartVariantServices` registry and renders its Component. Each variant service owns its own\n * config type, validation, column projection, and renderer — see `chart-variant-services/`.\n *\n * Unknown variants fall back to a status message (rather than throwing) so an older clay client\n * encountering a future variant degrades gracefully instead of crashing the chat.\n */\nexport function ChartArtifactContent({ config, rows, labels }: ChartArtifactContentProps): ReactNode {\n const service = ChartVariantServices[config.variant];\n if (!service) {\n return <StatusMessage $tone=\"info\">{labels.unavailable}</StatusMessage>;\n }\n // Registry guarantees the runtime variant matches the service's TConfig; loose at the type\n // boundary here is sound — see `ChartVariantServices` cast doc.\n const Component = service.Component as React.ComponentType<{\n config: ChartConfig;\n rows: ArtifactDataRow[];\n labels: ChartArtifactLabels;\n }>;\n return <Component config={config} rows={rows} labels={labels} />;\n}\n","import Papa from \"papaparse\";\n\nimport type { ArtifactDataRow } from \"./types\";\nimport type { ArtifactColumnLike } from \"./use-rows-artifact-data\";\n\n/**\n * Parses a CSV text payload fetched from a presigned URL into `ArtifactDataRow[]`.\n *\n * Shared across artifact kinds whose data wire is a CSV (`TABLE`, `CHART`). Uses `Papa.parse`\n * with `header: true` (first row is the header) and `skipEmptyLines: true`. Every cell arrives\n * as a string — the renderer NEVER coerces values to JS numbers / booleans / dates. Format\n * conversion is a server concern: if a column needs to be `\"Yes/No\"` or `\"$1,234\"`, the server\n * emits it that way in the CSV.\n *\n * Column projection rules:\n * - CSV header columns NOT in `columns[].key` are silently dropped.\n * - `columns[].key` values missing from the CSV header are silently omitted from row output —\n * client-side reconciliation warnings would let the client second-guess the server's contract.\n * Trust the CSV.\n *\n * Empty cells (`\"\"`) are returned as `null` so the renderer can distinguish \"missing value\"\n * from \"empty string\" downstream.\n *\n * Generic over the column shape so callers carrying richer column metadata (`TableColumn` with\n * `label` and the deprecated `type`/`align`) get back their own type rather than `unknown`.\n *\n * @param text Raw CSV text (may start with a UTF-8 BOM which Papa strips automatically).\n * @param columns Column descriptors — only `key` is consulted for projection.\n * @returns Rows in source order, projected to the configured columns.\n */\nexport function parseCsv<TColumn extends ArtifactColumnLike>(text: string, columns: TColumn[]): ArtifactDataRow[] {\n const result = Papa.parse<Record<string, string>>(text, {\n header: true,\n skipEmptyLines: true,\n dynamicTyping: false,\n });\n\n const csvHeaders = new Set(result.meta?.fields ?? []);\n const presentColumns = columns.filter((col) => csvHeaders.has(col.key));\n\n // No overlap between requested columns and CSV headers — return [] (treat as \"no data\")\n // rather than `result.data.length` rows of `{}`. The latter has positive length so the chart's\n // empty-state check (`data.rows.length === 0`) would miss it, and the chart would render\n // blank (no plottable fields) instead of the empty status message.\n if (presentColumns.length === 0) return [];\n\n return result.data.map((rawRow) => {\n const row: ArtifactDataRow = {};\n for (const column of presentColumns) {\n const value = rawRow[column.key];\n row[column.key] = value === undefined || value === \"\" ? null : value;\n }\n return row;\n });\n}\n","import { useEffect, useMemo, useState } from \"react\";\n\nimport { isSafeDownloadUrl } from \"./artifact-download-button/artifact-download-button\";\nimport type { ArtifactDataRow } from \"./types\";\n\n/**\n * Discriminator for the result returned by `useRowsArtifactData`.\n *\n * - `loading` — fetch is in flight (or about to be).\n * - `ready` — payload fetched and parsed successfully.\n * - `error` — fetch or parse failed at runtime; user can retry.\n * - `unavailable` — the artifact has no presigned URL at all (permanent server-side state). Distinct\n * from `error` so the renderer can surface \"data is unavailable\" instead of a misleading \"try again\".\n */\nexport type RowsArtifactDataState =\n | { status: \"loading\"; rows: null; error: null }\n | { status: \"ready\"; rows: ArtifactDataRow[]; error: null }\n | { status: \"error\"; rows: null; error: Error }\n | { status: \"unavailable\"; rows: null; error: null };\n\nconst LOADING: RowsArtifactDataState = { status: \"loading\", rows: null, error: null };\nconst UNAVAILABLE: RowsArtifactDataState = { status: \"unavailable\", rows: null, error: null };\n\ninterface InternalState {\n /** The cache key the current `data` was fetched for; used to ignore stale data when inputs change. */\n cacheKey: string | null;\n /** The fetch result for `cacheKey`. */\n data: RowsArtifactDataState;\n}\n\nconst INITIAL_INTERNAL: InternalState = { cacheKey: null, data: LOADING };\n\n/** Minimum shape a column descriptor must carry for CSV projection. `TableColumn` and the\n * shapes derived from `ChartConfig` both satisfy this. */\nexport interface ArtifactColumnLike {\n key: string;\n}\n\n/** Builds a stable fingerprint for a columns array so the effect only re-runs on real changes. */\nfunction columnsFingerprint(columns: ArtifactColumnLike[]): string {\n return columns.map((c) => c.key).join(\"|\");\n}\n\n/**\n * Strips any query parameters from a URL before logging. Presigned URLs carry the AWS signature\n * in the query string, which is a time-limited bearer credential. Logging it to an observability\n * platform (Logfire/Datadog/etc.) is a credential leak.\n */\nfunction scrubUrl(url: string): string {\n const q = url.indexOf(\"?\");\n return q === -1 ? url : `${url.slice(0, q)}?<redacted>`;\n}\n\n/**\n * Fetches an artifact's CSV payload from a presigned URL and parses it via the caller-supplied\n * `parse` function. Shared core for every artifact kind whose data wire is a CSV file\n * (`TABLE`, `CHART`, …). The two type-specific renderers wrap this with a default `parse`.\n *\n * Returns `loading` while the request is in flight, `unavailable` synchronously when no URL is\n * supplied (or the URL fails the safe-scheme guard), `ready` on success, or `error` on a runtime\n * failure (HTTP non-2xx, network, or parse error). Parse errors are surfaced as `error` state —\n * they are never thrown.\n *\n * In-flight requests are cancelled via `AbortController` when the URL or columns change, or the\n * consumer unmounts, so abandoned loads don't keep consuming bandwidth.\n *\n * @param presignedUrl S3 presigned URL for the artifact's CSV file, or `null`/`undefined` when absent.\n * Validated against `isSafeDownloadUrl` before fetch — any non-http(s) scheme\n * (e.g. `file:`, `data:`, `javascript:`) is treated as `unavailable`. The same\n * guard backs `ArtifactDownloadButton`; both code paths share one check.\n * @param columns Column descriptors — used for the cache-key fingerprint AND passed verbatim to `parse`.\n * @param parse CSV-text → rows parser. **MUST be a stable (module-scope or memoised)\n * function reference** — it is intentionally omitted from the effect's dep\n * array. Passing an inline arrow function will silently skip re-parsing on\n * change. Both current call sites (`useTableArtifactData`, `useChartArtifactData`)\n * pass the module-scope `parseCsv`.\n */\nexport function useRowsArtifactData<TColumn extends ArtifactColumnLike>(\n presignedUrl: string | null | undefined,\n columns: TColumn[],\n parse: (text: string, columns: TColumn[]) => ArtifactDataRow[]\n): RowsArtifactDataState {\n // Stable fingerprint so the effect doesn't re-fire on referentially-new but content-equal column arrays.\n const colsKey = useMemo(() => columnsFingerprint(columns), [columns]);\n\n const safeUrl = presignedUrl && isSafeDownloadUrl(presignedUrl) ? presignedUrl : null;\n const cacheKey = safeUrl ? `${safeUrl}::${colsKey}` : null;\n\n const [state, setState] = useState<InternalState>(INITIAL_INTERNAL);\n\n useEffect(() => {\n if (!safeUrl) return;\n\n const controller = new AbortController();\n\n fetch(safeUrl, {\n signal: controller.signal,\n headers: { Accept: \"text/csv\" },\n // Presigned URLs are cross-origin S3 in production and don't need credentials. Explicit\n // omit so a same-origin URL (compromised payload, local dev) can't accidentally receive\n // session cookies or auth headers.\n credentials: \"omit\",\n })\n .then(async (response) => {\n if (!response.ok) throw new Error(`Failed to load artifact data (${response.status})`);\n return response.text();\n })\n .then((text) => {\n if (controller.signal.aborted) return;\n try {\n const rows = parse(text, columns);\n setState({ cacheKey: `${safeUrl}::${colsKey}`, data: { status: \"ready\", rows, error: null } });\n } catch (parseError: unknown) {\n const err = parseError instanceof Error ? parseError : new Error(String(parseError));\n console.error(\"[ArtifactData] CSV parse failed:\", err.message);\n setState({ cacheKey: `${safeUrl}::${colsKey}`, data: { status: \"error\", rows: null, error: err } });\n }\n })\n .catch((error: unknown) => {\n // Per the Fetch spec, `signal.aborted` is set before the promise rejects on abort, so this\n // guard catches every abort case driven by our `controller.abort()` cleanup.\n if (controller.signal.aborted) return;\n const err = error instanceof Error ? error : new Error(String(error));\n // Log only `err.message`, not the full Error — some browsers include the full URL (with\n // AWS signature query params) in `TypeError.message` on network errors. Belt-and-suspenders:\n // scrub query params from the URL when we log the cache key for debugging.\n console.error(`[ArtifactData] Fetch failed [${scrubUrl(safeUrl)}]:`, err.message);\n setState({ cacheKey: `${safeUrl}::${colsKey}`, data: { status: \"error\", rows: null, error: err } });\n });\n\n return () => {\n controller.abort();\n };\n // `columns` and `parse` are intentionally omitted from the dep array: `colsKey` is the stable\n // fingerprint covering every observable column change, and `parse` is required to be a stable\n // module-scope or memoised reference (see JSDoc on the `parse` param). If either becomes\n // dynamic, this assumption breaks and the suppression must be removed.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [safeUrl, colsKey]);\n\n if (!safeUrl) return UNAVAILABLE;\n // While the in-flight URL/columns change, cached data belongs to a stale key — return loading until\n // the new fetch resolves. Avoids a synchronous setState() in the effect body (lint forbids that).\n if (state.cacheKey !== cacheKey) return LOADING;\n return state.data;\n}\n","import type { ChartVariant } from \"@/components/chart/types\";\nimport { parseCsv } from \"../parse-csv\";\nimport { useRowsArtifactData, type RowsArtifactDataState } from \"../use-rows-artifact-data\";\nimport { ChartVariantServices } from \"./chart-variant-services\";\nimport type { ChartConfig } from \"./types\";\n\n/**\n * Fetches a chart artifact's data payload from a presigned URL and parses it as CSV.\n *\n * Thin wrapper over the shared `useRowsArtifactData` core. Derives the column-key list from\n * `config` by delegating to the matching variant service's `columnKeys` method — each variant\n * owns its own CSV-column projection. The keys drive `parseCsv`'s per-row projection (matches\n * the table-artifact projection contract).\n *\n * @param presignedUrl S3 presigned URL for the artifact's CSV file, or `null`/`undefined` when absent.\n * @param config Validated chart config — used to derive the projection columns.\n */\nexport function useChartArtifactData(\n presignedUrl: string | null | undefined,\n config: ChartConfig\n): RowsArtifactDataState {\n const service = ChartVariantServices[config.variant as ChartVariant];\n // `isValidChartConfig` is the caller-side guard — service should always exist here, but\n // fall back to an empty projection rather than crashing if a future invariant slips.\n const keys = service ? service.columnKeys(config) : [];\n const columns = keys.map((key) => ({ key }));\n return useRowsArtifactData(presignedUrl, columns, parseCsv);\n}\n","import type { ChartVariant } from \"@/components/chart/types\";\nimport { ChartVariantServices } from \"./chart-variant-services\";\nimport type { ChartConfig } from \"./types\";\n\n/**\n * Returns true iff `config` carries the minimum-viable shape for rendering its `variant`.\n *\n * Thin dispatcher: validates the variant discriminator is one we know, then delegates to the\n * variant service's own `isValidConfig`. Each variant owns its own validation rules — see\n * `chart-variant-services/<variant>-chart-variant-service.ts`.\n *\n * The server-side `normaliseConfig` is the authoritative validator; this predicate exists so a\n * malformed payload renders the unavailable-state instead of crashing.\n */\nexport function isValidChartConfig(config: unknown): config is ChartConfig {\n if (!config || typeof config !== \"object\") return false;\n const variant = (config as Record<string, unknown>).variant;\n if (typeof variant !== \"string\") return false;\n const service = ChartVariantServices[variant as ChartVariant];\n if (!service) return false;\n return service.isValidConfig(config);\n}\n","import { useEffect, useMemo, type ReactNode } from \"react\";\n\nimport {\n Artifact,\n ArtifactActions,\n ArtifactContent,\n ArtifactHeader,\n ArtifactTitle,\n} from \"@/components/ai-elements/artifact\";\nimport { ArtifactDownloadButton } from \"@/components/artifacts/artifact-download-button/artifact-download-button\";\nimport {\n DEFAULT_TABLE_ARTIFACT_LABELS,\n type ArtifactServiceProps,\n type TableArtifactLabels,\n type TableArtifactRecord,\n} from \"@/components/artifacts/types\";\nimport { TableArtifactContent } from \"./table-artifact-content\";\nimport { StatusMessage } from \"../status-message\";\nimport { useTableArtifactData } from \"./use-table-artifact-data\";\nimport { isValidTableConfig } from \"./validate\";\n\nconst TITLE_CLASSES = \"text-sm font-semibold text-foreground\";\n\n/**\n * Cap the body at ~10 rows × 48px (~480px). Long lists scroll inside the artifact so they\n * don't stretch the chat surface. Each artifact type declares its own sensible cap.\n */\nconst TABLE_MAX_BODY_HEIGHT = 480;\n\n/**\n * Cap on shimmer rows during loading. Approximates the visible viewport (`TABLE_MAX_BODY_HEIGHT`\n * ÷ 48px per row) so we don't render hundreds of placeholder DOM nodes for very large tables.\n */\nconst MAX_SHIMMER_ROWS = 10;\n\n/**\n * Orchestrator for the `table`-typed artifact.\n *\n * Composes the ai-elements chrome primitives (`Artifact`, `ArtifactHeader`, `ArtifactTitle`,\n * `ArtifactActions`, `ArtifactContent`) directly around the table body (`TableArtifactContent`).\n * Download is handled via `ArtifactDownloadButton` — a shared utility component that applies the\n * safe-URL guard and renders nothing for non-http(s) schemes.\n */\nexport function TableArtifact({ artifact, labels, callbacks }: ArtifactServiceProps<TableArtifactRecord>): ReactNode {\n const validConfig = isValidTableConfig(artifact.config);\n const validColumns = validConfig ? artifact.config.columns : null;\n\n useEffect(() => {\n if (validConfig) return;\n console.warn(\"[clay] TableArtifact: malformed `config` — skipping render.\");\n }, [validConfig]);\n\n // Merge consumer-supplied labels over the English defaults. See `ChartArtifact` for rationale.\n const resolvedLabels = useMemo<TableArtifactLabels>(\n () => ({ ...DEFAULT_TABLE_ARTIFACT_LABELS, ...(labels ?? {}) }),\n [labels]\n );\n\n // Hook is always called (Rules of Hooks). Pass null URL when config is invalid so the hook\n // short-circuits at its `if (!presignedUrl) return UNAVAILABLE` path — no network fetch fires\n // for an artifact whose config shape can't be rendered.\n const data = useTableArtifactData(\n validConfig ? artifact.protectedAsset?.presignedUrl ?? null : null,\n validColumns ?? []\n );\n\n const presignedUrl = artifact.protectedAsset?.presignedUrl ?? null;\n\n // Bridge the consumer's `onDownload` callback into the download button. Wrapped to capture\n // `artifact` so the callback receives analytics context without a per-block closure on the\n // consumer side. `undefined` (rather than a no-op) when no callback wired — keeps the button\n // free of a redundant click listener.\n const onDownload = callbacks?.onDownload;\n const handleDownloadClick = onDownload ? () => onDownload(artifact) : undefined;\n\n if (!validConfig || !validColumns) {\n return (\n <Artifact className=\"shadow-none w-full rounded-2xl bg-background/70\">\n <ArtifactHeader className=\"bg-background/70\">\n {artifact.title ? <ArtifactTitle className={TITLE_CLASSES}>{artifact.title}</ArtifactTitle> : <span />}\n {presignedUrl ? (\n <ArtifactActions>\n <ArtifactDownloadButton\n href={presignedUrl}\n label={resolvedLabels.download}\n onClick={handleDownloadClick}\n />\n </ArtifactActions>\n ) : null}\n </ArtifactHeader>\n <ArtifactContent className=\"p-0 overflow-auto\" style={{ maxHeight: TABLE_MAX_BODY_HEIGHT }}>\n <StatusMessage $tone=\"info\">{resolvedLabels.unavailable}</StatusMessage>\n </ArtifactContent>\n </Artifact>\n );\n }\n\n return (\n // The table body owns its own scroll container (`ArtifactTable` inside `TableArtifactContent`).\n // Disable the outer overflow container so only one scroll context exists — this prevents\n // double-scroll nesting and lets `useScrollShadow` find the correct scroll ancestor.\n <Artifact className=\"shadow-none w-full rounded-2xl bg-background/70\">\n <ArtifactHeader className=\"bg-background/70\">\n {artifact.title ? <ArtifactTitle className={TITLE_CLASSES}>{artifact.title}</ArtifactTitle> : <span />}\n <ArtifactActions>\n <ArtifactDownloadButton\n href={presignedUrl ?? \"\"}\n label={resolvedLabels.download}\n onClick={handleDownloadClick}\n />\n </ArtifactActions>\n </ArtifactHeader>\n <ArtifactContent className=\"p-0 overflow-visible\" style={{ maxHeight: \"none\" }}>\n <TableArtifactContent\n columns={validColumns}\n data={data}\n knownRowCount={artifact.config.stats?.rowCount}\n maxShimmerRows={MAX_SHIMMER_ROWS}\n maxBodyHeight={TABLE_MAX_BODY_HEIGHT}\n labels={resolvedLabels}\n />\n </ArtifactContent>\n </Artifact>\n );\n}\n","/**\n * Discriminant constants for `TableArtifactDataState.status`.\n *\n * Use these instead of inline string literals so a typo is a compile-time error rather than a\n * silent wrong-branch at runtime.\n */\nexport const TABLE_STATUS = {\n LOADING: \"loading\",\n READY: \"ready\",\n ERROR: \"error\",\n UNAVAILABLE: \"unavailable\",\n} as const;\n","import type { TableColumn, TableRow as TableRowData } from \"@/components/artifacts/types\";\n\n/**\n * Returns a cell's rendered string. The CSV is the source of truth — clay never coerces or\n * reformats values. `null` / missing keys render as the empty cell. The value comes out as it\n * went in (whatever the server wrote into the CSV).\n */\nexport function formatCell(row: TableRowData, column: TableColumn): string {\n return row[column.key] ?? \"\";\n}\n\n/**\n * Header + body cell class strings. Alignment is uniformly left in chat-embedded artifact tables\n * by design (mixing right-aligned numerics with left-aligned text reads inconsistently); the\n * wire-type `column.align` is preserved for forward-compat but ignored at render time. See\n * `TableColumn.align` doc in `@/components/artifacts/types`.\n */\nexport const HEAD_CLASS = \"h-auto py-2 px-4 text-xs font-medium text-foreground whitespace-nowrap text-left\";\nexport const CELL_CLASS = \"p-4 text-sm font-normal text-foreground align-top min-w-[150px] text-left\";\n\n/**\n * Row tint matches the artifact card's frosted-glass scheme. The custom `border-b-brown-30`\n * overrides shadcn's row-default border (which inherits `--color-border` = brown-40) with the\n * lighter brown-30. Hover lifts to `bg-secondary` (opaque brown-20) for strong feedback against\n * the translucent base.\n */\nexport const ROW_CLASSES = \"border-b-brown-30 bg-background/70 hover:bg-secondary\";\n\n/**\n * Mount-time fade-in for data rows so the shimmer-to-data transition feels smooth (300ms ease-in\n * over `opacity: 0 → 1`). Shimmer rows keep `ROW_CLASSES` (no animate-in) so they remain in their\n * loading stillness while the pulse animation runs. `animate-in fade-in duration-300` is provided\n * by `tw-animate-css`.\n */\nexport const DATA_ROW_CLASSES = `${ROW_CLASSES} animate-in fade-in duration-300`;\n\n/** Layered drop-shadow for the scroll-lift effect on the sticky header. */\nexport const SCROLL_SHADOW = \"0 1px 2px rgb(0 0 0 / 0.01), 0 6px 12px -2px rgb(0 0 0 / 0.03)\";\n","import { type ReactNode } from \"react\";\n\nimport { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, useScrollShadow } from \"@/components/table\";\nimport type { TableColumn, TableRow as TableRowData } from \"@/components/artifacts/types\";\nimport { StatusMessage } from \"../status-message\";\nimport type { ArtifactTableProps, TableArtifactContentProps } from \"./table-artifact-content.types\";\nimport { TABLE_STATUS } from \"./table-artifact-content.constants\";\nimport {\n CELL_CLASS,\n DATA_ROW_CLASSES,\n formatCell,\n HEAD_CLASS,\n ROW_CLASSES,\n SCROLL_SHADOW,\n} from \"./table-artifact-content.utils\";\n\n/**\n * Bridges artifact data-states → shadcn's compound `Table` primitives.\n *\n * The four states render differently:\n *\n * - **loading w/ knownRowCount** → renders a sticky-header table with N shimmer rows so the\n * layout doesn't jump.\n * - **loading w/o knownRowCount** → renders the inline \"Loading table…\" status message.\n * - **error / unavailable** → renders an inline status message.\n * - **ready** → renders the full table with data rows and the scroll-lift\n * shadow on the sticky header.\n *\n * The shadcn primitives are composed directly here — no `Table` wrapper component sits in between.\n * Each row variant (header, data, shimmer, empty) is a small inline component below.\n */\nexport function TableArtifactContent({\n columns,\n data,\n knownRowCount,\n maxShimmerRows,\n maxBodyHeight,\n labels,\n}: TableArtifactContentProps): ReactNode {\n if (data.status === TABLE_STATUS.ERROR) {\n // No retry hook today — copy intentionally drops the \"Please try again.\" that has nowhere\n // to land. Wire an `onRetry` callback into `ArtifactService` to re-mint a fresh\n // presigned URL before re-introducing the retry framing.\n return <StatusMessage $tone=\"error\">{labels.loadError}</StatusMessage>;\n }\n if (data.status === TABLE_STATUS.UNAVAILABLE) {\n return <StatusMessage $tone=\"info\">{labels.unavailable}</StatusMessage>;\n }\n if (data.status === TABLE_STATUS.LOADING) {\n if (typeof knownRowCount === \"number\" && knownRowCount > 0) {\n const shimmerCount = Math.min(knownRowCount, maxShimmerRows);\n return (\n <ArtifactTable columns={columns} maxBodyHeight={maxBodyHeight}>\n {renderShimmerRows(columns, shimmerCount)}\n </ArtifactTable>\n );\n }\n return <StatusMessage $tone=\"info\">{labels.loading}</StatusMessage>;\n }\n // data.status === TABLE_STATUS.READY\n return (\n <ArtifactTable columns={columns} maxBodyHeight={maxBodyHeight}>\n {data.rows.length === 0 ? renderEmptyRow(columns.length, labels.empty) : renderDataRows(columns, data.rows)}\n </ArtifactTable>\n );\n}\n\n/**\n * Compound-table chrome shared between the loading-shimmer branch and the data/empty branch:\n * scroll container, sticky header, and the body slot. Caller passes the body rows.\n */\nfunction ArtifactTable({ columns, maxBodyHeight, children }: ArtifactTableProps): ReactNode {\n const { targetRef, isScrolled } = useScrollShadow();\n return (\n <div ref={targetRef} className=\"overscroll-none\" style={{ maxHeight: maxBodyHeight, overflowY: \"auto\" }}>\n <Table containerClassName=\"overflow-visible\">\n <TableHeader\n data-scrolled={isScrolled ? \"true\" : undefined}\n className=\"sticky top-0 z-10 bg-background/70 backdrop-blur-lg transition-shadow\"\n style={isScrolled ? { boxShadow: SCROLL_SHADOW } : undefined}\n >\n <TableRow className=\"hover:bg-transparent\">\n {columns.map((column) => (\n <TableHead key={column.key} scope=\"col\" className={HEAD_CLASS}>\n {column.label}\n </TableHead>\n ))}\n </TableRow>\n </TableHeader>\n <TableBody>{children}</TableBody>\n </Table>\n </div>\n );\n}\n\nfunction renderShimmerRows(columns: TableColumn[], count: number): ReactNode {\n return Array.from({ length: count }).map((_, index) => (\n <TableRow key={`shimmer-${index}`} className={ROW_CLASSES} aria-hidden=\"true\">\n {columns.map((column) => (\n <TableCell key={column.key} className={CELL_CLASS}>\n <span className=\"block h-3 w-3/4 animate-pulse rounded bg-muted-foreground/20\" />\n </TableCell>\n ))}\n </TableRow>\n ));\n}\n\nfunction renderDataRows(columns: TableColumn[], rows: TableRowData[]): ReactNode {\n // `key={index}` is safe today because `rows` is a static fetch result — no sort, filter, or\n // streaming insertion. The moment row order can change (e.g. client-side sort feature), this\n // must switch to a stable per-row identity or React will reconcile incorrectly (inputs lose\n // focus, animations glitch). The data hook will need to surface a row-id at that point.\n return rows.map((row, index) => (\n <TableRow key={index} className={DATA_ROW_CLASSES}>\n {columns.map((column) => (\n <TableCell key={column.key} className={CELL_CLASS}>\n {formatCell(row, column)}\n </TableCell>\n ))}\n </TableRow>\n ));\n}\n\nfunction renderEmptyRow(colSpan: number, emptyMessage: string): ReactNode {\n return (\n <TableRow className=\"hover:bg-transparent\">\n <TableCell colSpan={colSpan} className=\"py-6 text-center text-sm text-muted-foreground\">\n {emptyMessage}\n </TableCell>\n </TableRow>\n );\n}\n","import type { TableColumn } from \"@/components/artifacts/types\";\nimport { useRowsArtifactData, type RowsArtifactDataState } from \"../use-rows-artifact-data\";\nimport { parseCsv } from \"../parse-csv\";\n\n/**\n * Per-table data state. Re-exported from the shared rows-state union so callers that imported\n * the original `TableArtifactDataState` name still resolve. `TableRow` is itself an alias for\n * `ArtifactDataRow`, so `rows: TableRow[]` and `rows: ArtifactDataRow[]` are the same type.\n */\nexport type TableArtifactDataState = RowsArtifactDataState;\n\n/**\n * Fetches a table artifact's data payload from a presigned URL and parses it as CSV.\n *\n * Thin wrapper over `useRowsArtifactData` — the shared core for every artifact kind whose data\n * wire is a CSV file. Supplies `parseCsv` as the parser (per-column projection from CSV headers,\n * empty cells coerced to `null`).\n *\n * @param presignedUrl S3 presigned URL for the artifact's CSV file, or `null`/`undefined` when absent.\n * @param columns Column definitions from `TableConfig.columns` — used for projection.\n */\nexport function useTableArtifactData(\n presignedUrl: string | null | undefined,\n columns: TableColumn[]\n): RowsArtifactDataState {\n return useRowsArtifactData(presignedUrl, columns, parseCsv);\n}\n","import type { TableColumn, TableConfig } from \"@/components/artifacts/types\";\n\n/**\n * Returns true iff `config` carries the minimum-viable shape for rendering: a non-empty array\n * of columns where each has a non-empty `key` and a string `label`.\n *\n * Anything else is trusted to the server. The deprecated `type` / `align` wire fields are NOT\n * validated — clay doesn't act on them, so rejecting unknown values would punish servers\n * shipping fields clay was about to ignore anyway.\n */\nexport function isValidTableConfig(config: unknown): config is TableConfig {\n if (!config || typeof config !== \"object\") return false;\n const candidate = config as { columns?: unknown };\n if (!Array.isArray(candidate.columns)) return false;\n if (candidate.columns.length === 0) return false;\n return candidate.columns.every(isValidTableColumn);\n}\n\n/** Minimum-viable column shape: non-empty string `key` + string `label`. */\nfunction isValidTableColumn(column: unknown): column is TableColumn {\n if (!column || typeof column !== \"object\") return false;\n const candidate = column as Record<string, unknown>;\n if (typeof candidate.key !== \"string\" || candidate.key.length === 0) return false;\n if (typeof candidate.label !== \"string\") return false;\n return true;\n}\n","import type { ChartArtifactRecord } from \"@/components/artifacts/types\";\n\n/**\n * Produces a plain-text clipboard representation of a chart artifact.\n *\n * Returns the artifact title as plain text so pasting into non-markdown-aware targets\n * (plain-text editors, terminal, spreadsheets) does not expose raw markdown syntax. Mirrors\n * `tableArtifactToClipboardText`'s contract — every block-aggregating consumer\n * (`ArtifactRefBlockService.toClipboardText`) writes the aggregated string verbatim.\n *\n * The presigned URL is intentionally omitted: presigned URLs expire quickly and are not useful\n * when pasted as bare text. The Download button in the artifact chrome is the canonical way\n * to obtain the underlying file.\n */\nexport function chartArtifactToClipboardText(artifact: ChartArtifactRecord): string {\n const trimmedTitle = artifact.title?.trim();\n return trimmedTitle || \"Chart\";\n}\n","import type { ArtifactService, ChartArtifactRecord } from \"../types\";\nimport { artifactTypes } from \"../types\";\nimport { ChartArtifact } from \"../chart-artifact/chart-artifact\";\nimport { chartArtifactToClipboardText } from \"../chart-artifact/to-clipboard-text\";\n\nexport const ChartArtifactService: ArtifactService<ChartArtifactRecord> = {\n type: artifactTypes.CHART,\n Component: ChartArtifact,\n toClipboardText: chartArtifactToClipboardText,\n};\n","import type { TableArtifactRecord } from \"@/components/artifacts/types\";\n\n/**\n * Produces a plain-text clipboard representation of a table artifact.\n *\n * Returns the artifact title as plain text so that pasting into non-markdown-aware targets\n * (plain-text editors, terminal, spreadsheets) does not expose raw markdown syntax. This\n * matches the contract of `TextBlockService.toClipboardText`, which also strips markdown —\n * `useCopyToClipboard` writes the aggregated string verbatim, so every block type must\n * independently normalise to plain text.\n *\n * The presigned URL is intentionally omitted from the clipboard value: presigned URLs expire\n * quickly (typically 15 min–1 h) and are not useful when pasted as bare text. The Download\n * button in the artifact chrome is the canonical way to obtain the file.\n */\nexport function tableArtifactToClipboardText(artifact: TableArtifactRecord): string {\n const trimmedTitle = artifact.title?.trim();\n return trimmedTitle || \"Table\";\n}\n","import type { ArtifactService, TableArtifactRecord } from \"../types\";\nimport { artifactTypes } from \"../types\";\nimport { TableArtifact } from \"../table-artifact/table-artifact\";\nimport { tableArtifactToClipboardText } from \"../table-artifact/to-clipboard-text\";\n\nexport const TableArtifactService: ArtifactService<TableArtifactRecord> = {\n type: artifactTypes.TABLE,\n Component: TableArtifact,\n toClipboardText: tableArtifactToClipboardText,\n};\n","import type { ArtifactRecord, ArtifactService, ArtifactType } from \"../types\";\nimport { artifactTypes } from \"../types\";\nimport { ChartArtifactService } from \"./chart-artifact-service\";\nimport { TableArtifactService } from \"./table-artifact-service\";\n\n// `ArtifactService<TSpecific>` is invariant on `TSpecific` via React's `ComponentType`\n// (props are contravariant). Each service overlaps structurally with the base `ArtifactService`\n// enough for a direct `as ArtifactService` cast. The registry dispatches only by runtime\n// discriminator — `ArtifactServices[artifact.type]` always resolves to the matching concrete service.\n/**\n * Map of artifact services keyed by `artifact.type`.\n *\n * Adding a new artifact type = create a `*-service.ts` file (mirroring `block-services/`), then\n * add one entry here. The block-level dispatcher (`ArtifactRefBlock`) consumes this map to\n * render the concrete component; `artifactToClipboardText` consumes it for the clipboard contract.\n */\nexport const ArtifactServices: Record<ArtifactType, ArtifactService> = {\n [artifactTypes.TABLE]: TableArtifactService as ArtifactService,\n [artifactTypes.CHART]: ChartArtifactService as ArtifactService,\n};\n\n/**\n * Returns a clipboard-friendly string for an artifact, delegating to the registered service's\n * `toClipboardText`. Falls back to `[Artifact: <title>]` when the artifact type has no registered\n * service (unknown type) so copy never silently produces an empty string.\n */\nexport function artifactToClipboardText(artifact: ArtifactRecord): string {\n const entry = ArtifactServices[artifact.type];\n if (!entry) {\n return `[Artifact: ${artifact.title ?? artifact.type}]`;\n }\n return entry.toClipboardText(artifact);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAaO,IAAM,gBAAgB;AAAA,EAC3B,OAAO;AAAA,EACP,OAAO;AACT;;;AC0DO,IAAM,gCAAqD;AAAA,EAChE,UAAU;AAAA,EACV,aAAa;AAAA,EACb,aAAa;AAAA,EACb,aAAa;AAAA,EACb,aAAa;AAAA,EACb,WAAW;AAAA,EACX,SAAS;AAAA,EACT,OAAO;AAAA,EACP,sBAAsB,CAAC,UAAU,OAAO;AAC1C;;;ACPO,IAAM,gCAAqD;AAAA,EAChE,UAAU;AAAA,EACV,aAAa;AAAA,EACb,WAAW;AAAA,EACX,SAAS;AAAA,EACT,OAAO;AACT;A;;;;;ACnFA,IAAA,oBAAe;EACb,SAAS;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,SAAS;IACT,MAAM;IACN,QAAQ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ACF;AAAA,OACF;AAAA;AAEJ;;;AM9GO,SAAS,6BAA6B,UAAuC;AAClF,QAAM,eAAe,SAAS,OAAO,KAAK;AAC1C,SAAO,gBAAgB;AACzB;;;ACZO,IAAM,uBAA6D;AAAA,EACxE,MAAM,cAAc;AAAA,EACpB,WAAW;AAAA,EACX,iBAAiB;AACnB;;;ACMO,SAAS,6BAA6B,UAAuC;AAClF,QAAM,eAAe,SAAS,OAAO,KAAK;AAC1C,SAAO,gBAAgB;AACzB;;;ACbO,IAAM,uBAA6D;AAAA,EACxE,MAAM,cAAc;AAAA,EACpB,WAAW;AAAA,EACX,iBAAiB;AACnB;;;ACOO,IAAM,mBAA0D;AAAA,EACrE,CAAC,cAAc,KAAK,GAAG;AAAA,EACvB,CAAC,cAAc,KAAK,GAAG;AACzB;AAOO,SAAS,wBAAwB,UAAkC;AACxE,QAAM,QAAQ,iBAAiB,SAAS,IAAI;AAC5C,MAAI,CAAC,OAAO;AACV,WAAO,cAAc,SAAS,SAAS,SAAS,IAAI;AAAA,EACtD;AACA,SAAO,MAAM,gBAAgB,QAAQ;AACvC;","names":["__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","useCallback","jsx","useCallback","jsx","jsxs","DEFAULT_LABEL","useCallback","React","jsx","jsx","jsx","jsxs","useCallback","useEffect","useMemo","useRef","forwardRef","jsx","forwardRef","createElement","jsx","jsx","jsx","jsx","useEffect","useState","useState","useEffect","jsx","jsxs","useRef","useEffect","useMemo","useEffect","useMemo","jsx","jsxs","jsx","jsxs","TITLE_CLASSES","useEffect","useMemo"]}
|