@burdenoff/microfe-cosmicintersection 2026.1101.3 → 2026.1107.1
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/dist/cosmicintersection/api/cosmicApi.d.ts +33 -0
- package/dist/cosmicintersection/api/cosmicApi.d.ts.map +1 -1
- package/dist/cosmicintersection/api/cosmicApi.js +118 -71
- package/dist/cosmicintersection/api/cosmicApi.js.map +1 -1
- package/dist/cosmicintersection/components/ScienceCanvas.d.ts.map +1 -1
- package/dist/cosmicintersection/components/ScienceCanvas.js +9 -2
- package/dist/cosmicintersection/components/ScienceCanvas.js.map +1 -1
- package/dist/cosmicintersection/lib/useTrackRecentItem.d.ts +22 -0
- package/dist/cosmicintersection/lib/useTrackRecentItem.d.ts.map +1 -0
- package/dist/cosmicintersection/lib/useTrackRecentItem.js +28 -0
- package/dist/cosmicintersection/lib/useTrackRecentItem.js.map +1 -0
- package/dist/cosmicintersection/pages/analyses/AnalysesPage.d.ts.map +1 -1
- package/dist/cosmicintersection/pages/analyses/AnalysesPage.js +321 -285
- package/dist/cosmicintersection/pages/analyses/AnalysesPage.js.map +1 -1
- package/dist/cosmicintersection/pages/collections/CollectionDetailPage.d.ts.map +1 -1
- package/dist/cosmicintersection/pages/collections/CollectionDetailPage.js +101 -93
- package/dist/cosmicintersection/pages/collections/CollectionDetailPage.js.map +1 -1
- package/dist/cosmicintersection/pages/datasets/DatasetDetailPage.d.ts.map +1 -1
- package/dist/cosmicintersection/pages/datasets/DatasetDetailPage.js +82 -74
- package/dist/cosmicintersection/pages/datasets/DatasetDetailPage.js.map +1 -1
- package/dist/cosmicintersection/pages/notebooks/NotebookDetailPage.d.ts.map +1 -1
- package/dist/cosmicintersection/pages/notebooks/NotebookDetailPage.js +66 -58
- package/dist/cosmicintersection/pages/notebooks/NotebookDetailPage.js.map +1 -1
- package/dist/cosmicintersection/pages/pipelines/PipelineDetailPage.d.ts.map +1 -1
- package/dist/cosmicintersection/pages/pipelines/PipelineDetailPage.js +126 -118
- package/dist/cosmicintersection/pages/pipelines/PipelineDetailPage.js.map +1 -1
- package/dist/cosmicintersection/pages/releases/ReleasesPage.d.ts.map +1 -1
- package/dist/cosmicintersection/pages/releases/ReleasesPage.js +211 -203
- package/dist/cosmicintersection/pages/releases/ReleasesPage.js.map +1 -1
- package/dist/cosmicintersection/pages/runs/RunDetailPage.d.ts.map +1 -1
- package/dist/cosmicintersection/pages/runs/RunDetailPage.js +92 -84
- package/dist/cosmicintersection/pages/runs/RunDetailPage.js.map +1 -1
- package/dist/cosmicintersection/pages/sources/SourceDetailPage.d.ts.map +1 -1
- package/dist/cosmicintersection/pages/sources/SourceDetailPage.js +101 -93
- package/dist/cosmicintersection/pages/sources/SourceDetailPage.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/services/recentItems.d.ts +40 -0
- package/dist/services/recentItems.d.ts.map +1 -0
- package/dist/services/recentItems.js +128 -0
- package/dist/services/recentItems.js.map +1 -0
- package/package.json +5 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmicApi.js","names":[],"sources":["../../../src/cosmicintersection/api/cosmicApi.ts"],"sourcesContent":["/**\n * cosmicApi — hand-written typed data layer for the CosmicIntersection MFE.\n *\n * Mirrors the pattern in microfe-eventfullymanaged's eventApi.ts: inline `gql`\n * documents + `@apollo/client/react` hooks, with hand-written response/variables\n * types that track the wspace-cosmicintersection-svc subgraph SDL exactly. The\n * Apollo client is provided by the HOST app shell via React context (integrated\n * mode) — this module never constructs a client. Every `cos*` operation runs on\n * the workspace gateway (the default client in context).\n *\n * Scalar mapping: BigInt -> string, JSON -> Record<string, unknown>,\n * DateTime -> string (ISO).\n */\nimport { gql, type ErrorLike } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\n\nimport { notify } from '../lib/toast';\n\n/**\n * Shared mutation error sink. The gateway client runs with `errorPolicy: 'all'`,\n * so in-band GraphQL errors also invoke `onError`; wiring this on every write\n * mutation guarantees a failure is always surfaced to the user even if a caller\n * forgets to inspect the resolved result.\n */\nconst onMutationError = (error: ErrorLike): void => {\n notify.error('Something went wrong', error.message || 'Please try again.');\n};\n\n// ============================================================================\n// ENUMS (string-literal unions — exact SDL values)\n// ============================================================================\n\nexport type CosDatasetStatus = 'DRAFT' | 'INGESTING' | 'AVAILABLE' | 'DEPRECATED' | 'ARCHIVED';\nexport type CosAccessLevel = 'PUBLIC' | 'WORKSPACE' | 'RESTRICTED' | 'EMBARGOED';\nexport type CosSourceType =\n | 'TELESCOPE'\n | 'SATELLITE'\n | 'GROUND_SENSOR'\n | 'ARCHIVE'\n | 'API'\n | 'STREAM'\n | 'FILE_DROP'\n | 'SIMULATION';\nexport type CosSourceStatus =\n 'CONFIGURING' | 'CONNECTED' | 'SYNCING' | 'DEGRADED' | 'ERROR' | 'DISABLED';\nexport type CosFieldType =\n | 'STRING'\n | 'INTEGER'\n | 'FLOAT'\n | 'BOOLEAN'\n | 'TIMESTAMP'\n | 'COORDINATE'\n | 'SPECTRUM'\n | 'GEOMETRY'\n | 'IMAGE_REF'\n | 'JSON';\nexport type CosPipelineStatus = 'DRAFT' | 'ACTIVE' | 'PAUSED' | 'ARCHIVED';\nexport type CosPipelineTrigger = 'MANUAL' | 'SCHEDULED' | 'ON_INGEST' | 'WEBHOOK';\nexport type CosRunStatus = 'QUEUED' | 'RUNNING' | 'SUCCEEDED' | 'FAILED' | 'CANCELLED';\n/**\n * Full SDL vocabulary. The four geospatial kinds are recognised values a step\n * can already carry (BOFF-4355) — only RASTER_CALC has an execution backend, so\n * they are readable/renderable but are deliberately not offered as authoring\n * options in the add-step form.\n */\nexport type CosStepKind =\n | 'INGEST'\n | 'CALIBRATE'\n | 'TRANSFORM'\n | 'ANALYZE'\n | 'EXPORT'\n | 'NOTIFY'\n | 'RASTER_CALC'\n | 'REPROJECT'\n | 'TILE'\n | 'ZONAL_STATS';\nexport type CosNotebookStatus = 'DRAFT' | 'RUNNING' | 'PUBLISHED' | 'ARCHIVED';\nexport type CosAnalysisStatus = 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED';\nexport type CosReleaseStatus = 'DRAFT' | 'UNDER_REVIEW' | 'PUBLISHED' | 'RETRACTED';\nexport type CosGrantStatus = 'PENDING' | 'ACTIVE' | 'EXPIRED' | 'REVOKED';\n\n// ============================================================================\n// ENTITY TYPES\n// ============================================================================\n\n/** Federated wspace-files File stub — only `{ id }` is resolvable in this subgraph. */\nexport interface CosFileRef {\n id: string;\n}\n\n/** An entity selected id-only, where the operation needs its existence, not its body. */\nexport interface CosIdRef {\n id: string;\n}\n\n/**\n * Per-parent cap the subgraph applies to every relation field\n * (`capPerGroup(rows, key, DEFAULT_LIMIT)` in wspace-cosmicintersection-svc's\n * dataloaders — DEFAULT_LIMIT is 50).\n *\n * A relation array of exactly this length means \"at least this many\", NOT an\n * exact total: render it as `50+`, never as a precise count.\n */\nexport const COS_RELATION_PAGE_SIZE = 50;\n\nexport interface CosSchemaField {\n id: string;\n workspaceId: string;\n datasetId: string;\n name: string;\n fieldType: CosFieldType;\n unit?: string | null;\n description?: string | null;\n nullable: boolean;\n position: number;\n provenance?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosDataset {\n id: string;\n workspaceId: string;\n name: string;\n description?: string | null;\n status: CosDatasetStatus;\n accessLevel: CosAccessLevel;\n format?: string | null;\n sourceId?: string | null;\n collectionId?: string | null;\n /** BigInt returned as a numeric string. */\n rowCount: string;\n /** BigInt returned as a numeric string. */\n sizeBytes: string;\n version: number;\n lineageCaptured: boolean;\n coverage?: Record<string, unknown> | null;\n ingestedAt?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relations — only present when the operation selects them (detail queries).\n source?: CosSource | null;\n collection?: CosCollection | null;\n file?: CosFileRef | null;\n schemaFields?: CosSchemaField[];\n}\n\nexport interface CosSource {\n id: string;\n workspaceId: string;\n name: string;\n description?: string | null;\n type: CosSourceType;\n status: CosSourceStatus;\n endpoint?: string | null;\n config?: Record<string, unknown> | null;\n lastSyncedAt?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relation — present only on detail queries.\n datasets?: CosDataset[];\n}\n\nexport interface CosCollection {\n id: string;\n workspaceId: string;\n name: string;\n slug?: string | null;\n description?: string | null;\n isPublic: boolean;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relation — present only on detail queries.\n datasets?: CosDataset[];\n}\n\nexport interface CosPipeline {\n id: string;\n workspaceId: string;\n name: string;\n description?: string | null;\n status: CosPipelineStatus;\n trigger: CosPipelineTrigger;\n schedule?: string | null;\n definition?: Record<string, unknown> | null;\n version: number;\n lastRunAt?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relation — present only on detail queries.\n runs?: CosPipelineRun[];\n}\n\nexport interface CosPipelineRun {\n id: string;\n workspaceId: string;\n pipelineId: string;\n runNumber: number;\n status: CosRunStatus;\n datasetId?: string | null;\n params?: Record<string, unknown> | null;\n metrics?: Record<string, unknown> | null;\n triggeredBy?: string | null;\n startedAt?: string | null;\n finishedAt?: string | null;\n durationMs?: number | null;\n errorMessage?: string | null;\n createdAt: string;\n updatedAt: string;\n // Relations — present only on detail queries.\n pipeline?: CosPipeline | null;\n steps?: CosPipelineStep[];\n}\n\nexport interface CosPipelineStep {\n id: string;\n workspaceId: string;\n runId: string;\n name: string;\n kind: CosStepKind;\n position: number;\n status: CosRunStatus;\n inputs?: Record<string, unknown> | null;\n outputs?: Record<string, unknown> | null;\n logsRef?: string | null;\n startedAt?: string | null;\n finishedAt?: string | null;\n durationMs?: number | null;\n errorMessage?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosNotebook {\n id: string;\n workspaceId: string;\n title: string;\n description?: string | null;\n status: CosNotebookStatus;\n runtime?: string | null;\n environment?: Record<string, unknown> | null;\n datasetIds: string[];\n isShared: boolean;\n shareSlug?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relations — present only on detail queries.\n file?: CosFileRef | null;\n analyses?: CosAnalysis[];\n releases?: CosRelease[];\n}\n\nexport interface CosAnalysis {\n id: string;\n workspaceId: string;\n title: string;\n status: CosAnalysisStatus;\n method?: string | null;\n aiAssisted: boolean;\n notebookId?: string | null;\n datasetId?: string | null;\n results?: Record<string, unknown> | null;\n outputFile?: CosFileRef | null;\n startedAt?: string | null;\n finishedAt?: string | null;\n errorMessage?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosRelease {\n id: string;\n workspaceId: string;\n title: string;\n version: string;\n status: CosReleaseStatus;\n abstract?: string | null;\n authors: string[];\n datasetIds: string[];\n notebookId?: string | null;\n doi?: string | null;\n license?: string | null;\n publishedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosDataAccessGrant {\n id: string;\n workspaceId: string;\n datasetId: string;\n granteeId: string;\n status: CosGrantStatus;\n scopes: string[];\n reason?: string | null;\n grantedAt?: string | null;\n expiresAt?: string | null;\n revokedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n// ============================================================================\n// PAGINATION / CONNECTIONS\n// ============================================================================\n\nexport interface CosPageInfo {\n hasMore: boolean;\n cursor?: string | null;\n}\n\nexport interface CosConnection<T> {\n items: T[];\n pageInfo: CosPageInfo;\n}\n\n/** Offset-based pagination input (PaginationInput in the SDL; limit defaults to 50). */\nexport interface CosPaginationInput {\n limit?: number;\n offset?: number;\n cursor?: string;\n}\n\n// ============================================================================\n// INPUT TYPES\n// ============================================================================\n\nexport interface CosCreateDatasetInput {\n name: string;\n description?: string;\n status?: CosDatasetStatus;\n accessLevel?: CosAccessLevel;\n format?: string;\n sourceId?: string;\n collectionId?: string;\n fileId?: string;\n coverage?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosUpdateDatasetInput {\n name?: string;\n description?: string;\n accessLevel?: CosAccessLevel;\n format?: string;\n collectionId?: string;\n coverage?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosAddSchemaFieldInput {\n datasetId: string;\n name: string;\n fieldType?: CosFieldType;\n unit?: string;\n description?: string;\n nullable?: boolean;\n position?: number;\n provenance?: string;\n}\n\nexport interface CosCreateSourceInput {\n name: string;\n type?: CosSourceType;\n status?: CosSourceStatus;\n description?: string;\n endpoint?: string;\n credentialRef?: string;\n config?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosUpdateSourceInput {\n name?: string;\n type?: CosSourceType;\n status?: CosSourceStatus;\n description?: string;\n endpoint?: string;\n credentialRef?: string;\n config?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosCreateCollectionInput {\n name: string;\n slug?: string;\n description?: string;\n isPublic?: boolean;\n tags?: string[];\n}\n\n/** All fields optional — only the provided keys are updated (CosUpdateCollectionInput in the SDL). */\nexport interface CosUpdateCollectionInput {\n name?: string;\n slug?: string;\n description?: string;\n isPublic?: boolean;\n tags?: string[];\n}\n\nexport interface CosCreatePipelineInput {\n name: string;\n description?: string;\n trigger?: CosPipelineTrigger;\n schedule?: string;\n definition?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosUpdatePipelineInput {\n name?: string;\n description?: string;\n status?: CosPipelineStatus;\n trigger?: CosPipelineTrigger;\n schedule?: string;\n definition?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosStartRunInput {\n pipelineId: string;\n datasetId?: string;\n params?: Record<string, unknown>;\n}\n\nexport interface CosAddRunStepInput {\n runId: string;\n name: string;\n kind?: CosStepKind;\n inputs?: Record<string, unknown>;\n position?: number;\n}\n\nexport interface CosCreateNotebookInput {\n title: string;\n description?: string;\n runtime?: string;\n environment?: Record<string, unknown>;\n datasetIds?: string[];\n fileId?: string;\n tags?: string[];\n}\n\nexport interface CosUpdateNotebookInput {\n title?: string;\n description?: string;\n status?: CosNotebookStatus;\n runtime?: string;\n environment?: Record<string, unknown>;\n datasetIds?: string[];\n isShared?: boolean;\n shareSlug?: string;\n tags?: string[];\n}\n\nexport interface CosRunAnalysisInput {\n title: string;\n method?: string;\n aiAssisted?: boolean;\n notebookId?: string;\n datasetId?: string;\n}\n\nexport interface CosCreateReleaseInput {\n title: string;\n version?: string;\n abstract?: string;\n authors?: string[];\n datasetIds?: string[];\n notebookId?: string;\n license?: string;\n}\n\nexport interface CosGrantAccessInput {\n datasetId: string;\n granteeId: string;\n scopes?: string[];\n reason?: string;\n expiresAt?: string;\n}\n\n// ============================================================================\n// GQL DOCUMENTS — QUERIES\n// ============================================================================\n\nexport const COS_HEALTH_QUERY = gql`\n query CosHealth {\n cosHealth\n }\n`;\n\nexport const COS_DATASETS_QUERY = gql`\n query CosListDatasets(\n $q: String\n $accessLevel: CosAccessLevel\n $format: String\n $collectionId: ID\n $sourceId: ID\n $status: CosDatasetStatus\n $pagination: PaginationInput\n ) {\n cosListDatasets(\n q: $q\n accessLevel: $accessLevel\n format: $format\n collectionId: $collectionId\n sourceId: $sourceId\n status: $status\n pagination: $pagination\n ) {\n items {\n id\n workspaceId\n name\n description\n status\n accessLevel\n format\n sourceId\n collectionId\n rowCount\n sizeBytes\n version\n lineageCaptured\n ingestedAt\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_DATASET_QUERY = gql`\n query CosDataset($id: ID!) {\n cosDataset(id: $id) {\n id\n workspaceId\n name\n description\n status\n accessLevel\n format\n sourceId\n collectionId\n rowCount\n sizeBytes\n version\n lineageCaptured\n coverage\n ingestedAt\n tags\n createdAt\n updatedAt\n file {\n id\n }\n source {\n id\n name\n type\n status\n }\n collection {\n id\n name\n slug\n }\n schemaFields {\n id\n datasetId\n name\n fieldType\n unit\n description\n nullable\n position\n provenance\n createdAt\n updatedAt\n }\n }\n }\n`;\n\nexport const COS_SOURCES_QUERY = gql`\n query CosListSources(\n $type: CosSourceType\n $status: CosSourceStatus\n $pagination: PaginationInput\n ) {\n cosListSources(type: $type, status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n name\n description\n type\n status\n endpoint\n config\n lastSyncedAt\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_SOURCE_QUERY = gql`\n query CosSource($id: ID!) {\n cosSource(id: $id) {\n id\n workspaceId\n name\n description\n type\n status\n endpoint\n config\n lastSyncedAt\n tags\n createdAt\n updatedAt\n datasets {\n id\n name\n status\n accessLevel\n rowCount\n updatedAt\n }\n }\n }\n`;\n\n/**\n * `datasets` is selected id-only so each card can show how many datasets the\n * collection holds. The subgraph resolves it through `collectionDatasetsLoader`\n * (one batched query for the whole page) and filters to the datasets THIS actor\n * may read, so the length is the caller's visible count — capped at\n * `COS_RELATION_PAGE_SIZE`.\n */\nexport const COS_COLLECTIONS_QUERY = gql`\n query CosListCollections {\n cosListCollections {\n id\n workspaceId\n name\n slug\n description\n isPublic\n tags\n createdAt\n updatedAt\n datasets {\n id\n }\n }\n }\n`;\n\nexport const COS_COLLECTION_QUERY = gql`\n query CosCollection($id: ID!) {\n cosCollection(id: $id) {\n id\n workspaceId\n name\n slug\n description\n isPublic\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_SCHEMA_FIELDS_QUERY = gql`\n query CosListSchemaFields($datasetId: ID!) {\n cosListSchemaFields(datasetId: $datasetId) {\n id\n workspaceId\n datasetId\n name\n fieldType\n unit\n description\n nullable\n position\n provenance\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_PIPELINES_QUERY = gql`\n query CosListPipelines($status: CosPipelineStatus, $pagination: PaginationInput) {\n cosListPipelines(status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n name\n description\n status\n trigger\n schedule\n version\n lastRunAt\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_PIPELINE_QUERY = gql`\n query CosPipeline($id: ID!) {\n cosPipeline(id: $id) {\n id\n workspaceId\n name\n description\n status\n trigger\n schedule\n definition\n version\n lastRunAt\n tags\n createdAt\n updatedAt\n runs {\n id\n runNumber\n status\n datasetId\n startedAt\n finishedAt\n durationMs\n createdAt\n }\n }\n }\n`;\n\nexport const COS_RUNS_QUERY = gql`\n query CosListRuns($pipelineId: ID, $status: CosRunStatus, $pagination: PaginationInput) {\n cosListRuns(pipelineId: $pipelineId, status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n pipelineId\n runNumber\n status\n datasetId\n triggeredBy\n startedAt\n finishedAt\n durationMs\n errorMessage\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_RUN_QUERY = gql`\n query CosRun($id: ID!) {\n cosRun(id: $id) {\n id\n workspaceId\n pipelineId\n runNumber\n status\n datasetId\n params\n metrics\n triggeredBy\n startedAt\n finishedAt\n durationMs\n errorMessage\n createdAt\n updatedAt\n pipeline {\n id\n name\n status\n trigger\n schedule\n }\n steps {\n id\n runId\n name\n kind\n position\n status\n startedAt\n finishedAt\n durationMs\n errorMessage\n }\n }\n }\n`;\n\n/**\n * Other FAILED runs of the same pipeline, newest first, each with its steps so\n * the caller can name the step that broke. `steps` resolves through\n * `pipelineRunStepsLoader`, so the whole list costs one extra batched query.\n */\nexport const COS_PIPELINE_FAILED_RUNS_QUERY = gql`\n query CosPipelineFailedRuns($pipelineId: ID!, $pagination: PaginationInput) {\n cosListRuns(pipelineId: $pipelineId, status: FAILED, pagination: $pagination) {\n items {\n id\n workspaceId\n pipelineId\n runNumber\n status\n errorMessage\n startedAt\n finishedAt\n createdAt\n updatedAt\n steps {\n id\n runId\n name\n kind\n position\n status\n errorMessage\n }\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\n/**\n * Minimal dataset lookup — resolves an id held on another entity (e.g.\n * `CosPipelineRun.datasetId`, which the SDL exposes as a bare ID with no\n * relation field) to something a human can read. Returns null when the caller\n * has no read access to that dataset, so callers must fall back to the id.\n */\nexport const COS_DATASET_SUMMARY_QUERY = gql`\n query CosDatasetSummary($id: ID!) {\n cosDataset(id: $id) {\n id\n name\n status\n accessLevel\n }\n }\n`;\n\nexport const COS_RUN_STEPS_QUERY = gql`\n query CosListRunSteps($runId: ID!) {\n cosListRunSteps(runId: $runId) {\n id\n workspaceId\n runId\n name\n kind\n position\n status\n inputs\n outputs\n logsRef\n startedAt\n finishedAt\n durationMs\n errorMessage\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_NOTEBOOKS_QUERY = gql`\n query CosListNotebooks($status: CosNotebookStatus, $pagination: PaginationInput) {\n cosListNotebooks(status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n title\n description\n status\n runtime\n datasetIds\n isShared\n shareSlug\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_NOTEBOOK_QUERY = gql`\n query CosNotebook($id: ID!) {\n cosNotebook(id: $id) {\n id\n workspaceId\n title\n description\n status\n runtime\n environment\n datasetIds\n isShared\n shareSlug\n tags\n createdAt\n updatedAt\n file {\n id\n }\n analyses {\n id\n title\n status\n aiAssisted\n method\n createdAt\n }\n releases {\n id\n title\n version\n status\n publishedAt\n }\n }\n }\n`;\n\nexport const COS_ANALYSES_QUERY = gql`\n query CosListAnalyses($datasetId: ID, $notebookId: ID, $status: CosAnalysisStatus) {\n cosListAnalyses(datasetId: $datasetId, notebookId: $notebookId, status: $status) {\n id\n workspaceId\n title\n status\n method\n aiAssisted\n notebookId\n datasetId\n results\n outputFile {\n id\n }\n startedAt\n finishedAt\n errorMessage\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_RELEASES_QUERY = gql`\n query CosListReleases($status: CosReleaseStatus, $pagination: PaginationInput) {\n cosListReleases(status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n title\n version\n status\n abstract\n authors\n datasetIds\n notebookId\n doi\n license\n publishedAt\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_ACCESS_GRANTS_QUERY = gql`\n query CosListAccessGrants($datasetId: ID, $status: CosGrantStatus) {\n cosListAccessGrants(datasetId: $datasetId, status: $status) {\n id\n workspaceId\n datasetId\n granteeId\n status\n scopes\n reason\n grantedAt\n expiresAt\n revokedAt\n createdAt\n updatedAt\n }\n }\n`;\n\n// ============================================================================\n// PLATFORM REUSE — activity feed (wspace-activity-svc, federated on the\n// workspace supergraph). The cos mutation-audit plugin already writes these\n// ActivityLog rows via be-sdk `trackOperation`; this is the read surface,\n// scoped to a single cos entity by `resourceId`. Only scalar fields are\n// selected so no cross-subgraph entity resolution is required.\n// ============================================================================\n\nexport const COS_ACTIVITY_BY_RESOURCE_QUERY = gql`\n query CosResourceActivity($filter: ActivityLogFilter) {\n getActivities(filter: $filter) {\n id\n action\n description\n resourceType\n resourceId\n userId\n timestamp\n }\n }\n`;\n\n// ============================================================================\n// GQL DOCUMENTS — MUTATIONS\n// ============================================================================\n\nexport const COS_CREATE_DATASET_MUTATION = gql`\n mutation CosCreateDataset($input: CosCreateDatasetInput!) {\n cosCreateDataset(input: $input) {\n id\n name\n status\n accessLevel\n sourceId\n collectionId\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_DATASET_MUTATION = gql`\n mutation CosUpdateDataset($id: ID!, $input: CosUpdateDatasetInput!) {\n cosUpdateDataset(id: $id, input: $input) {\n id\n name\n description\n status\n accessLevel\n format\n collectionId\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_PUBLISH_DATASET_MUTATION = gql`\n mutation CosPublishDataset($id: ID!) {\n cosPublishDataset(id: $id) {\n id\n status\n ingestedAt\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_DATASET_MUTATION = gql`\n mutation CosArchiveDataset($id: ID!) {\n cosArchiveDataset(id: $id)\n }\n`;\n\nexport const COS_ADD_SCHEMA_FIELD_MUTATION = gql`\n mutation CosAddSchemaField($input: CosAddSchemaFieldInput!) {\n cosAddSchemaField(input: $input) {\n id\n workspaceId\n datasetId\n name\n fieldType\n unit\n description\n nullable\n position\n provenance\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_CREATE_SOURCE_MUTATION = gql`\n mutation CosCreateSource($input: CosCreateSourceInput!) {\n cosCreateSource(input: $input) {\n id\n name\n type\n status\n endpoint\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_SOURCE_MUTATION = gql`\n mutation CosUpdateSource($id: ID!, $input: CosUpdateSourceInput!) {\n cosUpdateSource(id: $id, input: $input) {\n id\n name\n description\n type\n status\n endpoint\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_MARK_SOURCE_SYNCED_MUTATION = gql`\n mutation CosMarkSourceSynced($id: ID!) {\n cosMarkSourceSynced(id: $id) {\n id\n status\n lastSyncedAt\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_SOURCE_MUTATION = gql`\n mutation CosArchiveSource($id: ID!) {\n cosArchiveSource(id: $id)\n }\n`;\n\nexport const COS_CREATE_COLLECTION_MUTATION = gql`\n mutation CosCreateCollection($input: CosCreateCollectionInput!) {\n cosCreateCollection(input: $input) {\n id\n name\n slug\n description\n isPublic\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_COLLECTION_MUTATION = gql`\n mutation CosUpdateCollection($id: ID!, $input: CosUpdateCollectionInput!) {\n cosUpdateCollection(id: $id, input: $input) {\n id\n name\n slug\n description\n isPublic\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_COLLECTION_MUTATION = gql`\n mutation CosArchiveCollection($id: ID!) {\n cosArchiveCollection(id: $id)\n }\n`;\n\nexport const COS_CREATE_PIPELINE_MUTATION = gql`\n mutation CosCreatePipeline($input: CosCreatePipelineInput!) {\n cosCreatePipeline(input: $input) {\n id\n name\n status\n trigger\n schedule\n version\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_PIPELINE_MUTATION = gql`\n mutation CosUpdatePipeline($id: ID!, $input: CosUpdatePipelineInput!) {\n cosUpdatePipeline(id: $id, input: $input) {\n id\n name\n description\n status\n trigger\n schedule\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_PIPELINE_MUTATION = gql`\n mutation CosArchivePipeline($id: ID!) {\n cosArchivePipeline(id: $id)\n }\n`;\n\nexport const COS_START_RUN_MUTATION = gql`\n mutation CosStartRun($input: CosStartRunInput!) {\n cosStartRun(input: $input) {\n id\n pipelineId\n runNumber\n status\n datasetId\n startedAt\n createdAt\n }\n }\n`;\n\nexport const COS_TRANSITION_RUN_MUTATION = gql`\n mutation CosTransitionRun($id: ID!, $status: CosRunStatus!) {\n cosTransitionRun(id: $id, status: $status) {\n id\n status\n startedAt\n finishedAt\n durationMs\n updatedAt\n }\n }\n`;\n\nexport const COS_ADD_RUN_STEP_MUTATION = gql`\n mutation CosAddRunStep($input: CosAddRunStepInput!) {\n cosAddRunStep(input: $input) {\n id\n runId\n name\n kind\n position\n status\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_CREATE_NOTEBOOK_MUTATION = gql`\n mutation CosCreateNotebook($input: CosCreateNotebookInput!) {\n cosCreateNotebook(input: $input) {\n id\n title\n status\n runtime\n datasetIds\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_NOTEBOOK_MUTATION = gql`\n mutation CosUpdateNotebook($id: ID!, $input: CosUpdateNotebookInput!) {\n cosUpdateNotebook(id: $id, input: $input) {\n id\n title\n description\n status\n runtime\n datasetIds\n isShared\n shareSlug\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_NOTEBOOK_MUTATION = gql`\n mutation CosArchiveNotebook($id: ID!) {\n cosArchiveNotebook(id: $id)\n }\n`;\n\nexport const COS_RUN_ANALYSIS_MUTATION = gql`\n mutation CosRunAnalysis($input: CosRunAnalysisInput!) {\n cosRunAnalysis(input: $input) {\n id\n title\n status\n method\n aiAssisted\n notebookId\n datasetId\n startedAt\n createdAt\n }\n }\n`;\n\nexport const COS_COMPLETE_ANALYSIS_MUTATION = gql`\n mutation CosCompleteAnalysis(\n $id: ID!\n $status: CosAnalysisStatus!\n $results: JSON\n $outputFileId: ID\n ) {\n cosCompleteAnalysis(id: $id, status: $status, results: $results, outputFileId: $outputFileId) {\n id\n status\n results\n finishedAt\n errorMessage\n outputFile {\n id\n }\n updatedAt\n }\n }\n`;\n\nexport const COS_CREATE_RELEASE_MUTATION = gql`\n mutation CosCreateRelease($input: CosCreateReleaseInput!) {\n cosCreateRelease(input: $input) {\n id\n title\n version\n status\n authors\n datasetIds\n notebookId\n license\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_PUBLISH_RELEASE_MUTATION = gql`\n mutation CosPublishRelease($id: ID!, $doi: String) {\n cosPublishRelease(id: $id, doi: $doi) {\n id\n status\n doi\n publishedAt\n updatedAt\n }\n }\n`;\n\nexport const COS_GRANT_ACCESS_MUTATION = gql`\n mutation CosGrantAccess($input: CosGrantAccessInput!) {\n cosGrantAccess(input: $input) {\n id\n datasetId\n granteeId\n status\n scopes\n reason\n grantedAt\n expiresAt\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_REVOKE_ACCESS_MUTATION = gql`\n mutation CosRevokeAccess($id: ID!) {\n cosRevokeAccess(id: $id) {\n id\n status\n revokedAt\n updatedAt\n }\n }\n`;\n\n// ============================================================================\n// RESPONSE / VARIABLES TYPES\n// ============================================================================\n\nexport interface CosHealthQueryData {\n cosHealth: string;\n}\n\nexport interface CosDatasetsQueryData {\n cosListDatasets: CosConnection<CosDataset>;\n}\nexport interface CosDatasetsQueryVars {\n /** Full-text search across dataset name/description/tags (backend `q` arg). */\n q?: string;\n accessLevel?: CosAccessLevel;\n format?: string;\n collectionId?: string;\n sourceId?: string;\n status?: CosDatasetStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosDatasetQueryData {\n cosDataset: CosDataset | null;\n}\n\nexport interface CosSourcesQueryData {\n cosListSources: CosConnection<CosSource>;\n}\nexport interface CosSourcesQueryVars {\n type?: CosSourceType;\n status?: CosSourceStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosSourceQueryData {\n cosSource: CosSource | null;\n}\n\n/**\n * Row shape of `cosListCollections` — same as `CosCollection` except `datasets`\n * is the id-only selection COS_COLLECTIONS_QUERY makes, so the list page can\n * size each collection without over-fetching dataset bodies.\n */\nexport interface CosCollectionListItem extends Omit<CosCollection, 'datasets'> {\n datasets: CosIdRef[];\n}\n\nexport interface CosCollectionsQueryData {\n cosListCollections: CosCollectionListItem[];\n}\n\nexport interface CosCollectionQueryData {\n cosCollection: CosCollection | null;\n}\n\nexport interface CosSchemaFieldsQueryData {\n cosListSchemaFields: CosSchemaField[];\n}\n\nexport interface CosPipelinesQueryData {\n cosListPipelines: CosConnection<CosPipeline>;\n}\nexport interface CosPipelinesQueryVars {\n status?: CosPipelineStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosPipelineQueryData {\n cosPipeline: CosPipeline | null;\n}\n\nexport interface CosRunsQueryData {\n cosListRuns: CosConnection<CosPipelineRun>;\n}\nexport interface CosRunsQueryVars {\n pipelineId?: string;\n status?: CosRunStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosRunQueryData {\n cosRun: CosPipelineRun | null;\n}\n\nexport interface CosRunStepsQueryData {\n cosListRunSteps: CosPipelineStep[];\n}\n\n/** Row of COS_PIPELINE_FAILED_RUNS_QUERY — `steps` is always selected. */\nexport interface CosFailedRunListItem extends Omit<CosPipelineRun, 'steps'> {\n steps: CosPipelineStep[];\n}\n\nexport interface CosPipelineFailedRunsQueryData {\n cosListRuns: CosConnection<CosFailedRunListItem>;\n}\nexport interface CosPipelineFailedRunsQueryVars {\n pipelineId: string;\n pagination?: CosPaginationInput;\n}\n\n/** Just enough of a dataset to render its name in place of a bare id. */\nexport interface CosDatasetSummary {\n id: string;\n name: string;\n status: CosDatasetStatus;\n accessLevel: CosAccessLevel;\n}\n\nexport interface CosDatasetSummaryQueryData {\n cosDataset: CosDatasetSummary | null;\n}\n\nexport interface CosNotebooksQueryData {\n cosListNotebooks: CosConnection<CosNotebook>;\n}\nexport interface CosNotebooksQueryVars {\n status?: CosNotebookStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosNotebookQueryData {\n cosNotebook: CosNotebook | null;\n}\n\nexport interface CosAnalysesQueryData {\n cosListAnalyses: CosAnalysis[];\n}\nexport interface CosAnalysesQueryVars {\n datasetId?: string;\n notebookId?: string;\n status?: CosAnalysisStatus;\n}\n\nexport interface CosReleasesQueryData {\n cosListReleases: CosConnection<CosRelease>;\n}\nexport interface CosReleasesQueryVars {\n status?: CosReleaseStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosAccessGrantsQueryData {\n cosListAccessGrants: CosDataAccessGrant[];\n}\nexport interface CosAccessGrantsQueryVars {\n datasetId?: string;\n status?: CosGrantStatus;\n}\n\n/** A single platform activity record (subset of wspace-activity-svc ActivityLog). */\nexport interface CosActivityEntry {\n id: string;\n action: string;\n description?: string | null;\n resourceType?: string | null;\n resourceId?: string | null;\n userId: string;\n timestamp: string;\n}\n\nexport interface CosActivityQueryData {\n getActivities: CosActivityEntry[];\n}\n\n/** Mirrors ActivityLogFilter — only the fields the cos activity panel needs. */\nexport interface CosActivityFilter {\n workspaceId?: string;\n resourceId?: string;\n resourceType?: string;\n limit?: number;\n offset?: number;\n}\n\nexport interface CosActivityQueryVars {\n filter?: CosActivityFilter;\n}\n\n// ============================================================================\n// QUERY HOOKS\n// ============================================================================\n\nexport const useCosHealthQuery = () => useQuery<CosHealthQueryData>(COS_HEALTH_QUERY);\n\nexport const useCosDatasetsQuery = (variables: CosDatasetsQueryVars = {}) =>\n useQuery<CosDatasetsQueryData, CosDatasetsQueryVars>(COS_DATASETS_QUERY, { variables });\n\nexport const useCosDatasetQuery = (id: string) =>\n useQuery<CosDatasetQueryData, { id: string }>(COS_DATASET_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosSourcesQuery = (variables: CosSourcesQueryVars = {}) =>\n useQuery<CosSourcesQueryData, CosSourcesQueryVars>(COS_SOURCES_QUERY, { variables });\n\nexport const useCosSourceQuery = (id: string) =>\n useQuery<CosSourceQueryData, { id: string }>(COS_SOURCE_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosCollectionsQuery = () =>\n useQuery<CosCollectionsQueryData>(COS_COLLECTIONS_QUERY);\n\nexport const useCosCollectionQuery = (id: string) =>\n useQuery<CosCollectionQueryData, { id: string }>(COS_COLLECTION_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosSchemaFieldsQuery = (datasetId: string) =>\n useQuery<CosSchemaFieldsQueryData, { datasetId: string }>(COS_SCHEMA_FIELDS_QUERY, {\n variables: { datasetId },\n skip: !datasetId,\n });\n\nexport const useCosPipelinesQuery = (variables: CosPipelinesQueryVars = {}) =>\n useQuery<CosPipelinesQueryData, CosPipelinesQueryVars>(COS_PIPELINES_QUERY, { variables });\n\nexport const useCosPipelineQuery = (id: string) =>\n useQuery<CosPipelineQueryData, { id: string }>(COS_PIPELINE_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosRunsQuery = (variables: CosRunsQueryVars = {}) =>\n useQuery<CosRunsQueryData, CosRunsQueryVars>(COS_RUNS_QUERY, { variables });\n\nexport const useCosRunQuery = (id: string) =>\n useQuery<CosRunQueryData, { id: string }>(COS_RUN_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosRunStepsQuery = (runId: string) =>\n useQuery<CosRunStepsQueryData, { runId: string }>(COS_RUN_STEPS_QUERY, {\n variables: { runId },\n skip: !runId,\n });\n\n/**\n * Failed runs of one pipeline. Skipped until a pipelineId is known so the run\n * detail page can call it unconditionally while its own query is still loading.\n */\nexport const useCosPipelineFailedRunsQuery = (\n pipelineId: string | undefined,\n options: { limit?: number; skip?: boolean } = {}\n) =>\n useQuery<CosPipelineFailedRunsQueryData, CosPipelineFailedRunsQueryVars>(\n COS_PIPELINE_FAILED_RUNS_QUERY,\n {\n variables: {\n pipelineId: pipelineId ?? '',\n pagination: { limit: options.limit ?? 20, offset: 0 },\n },\n skip: !pipelineId || options.skip === true,\n }\n );\n\n/** Resolves a dataset id to its name. Returns null data when unreadable. */\nexport const useCosDatasetSummaryQuery = (id: string | null | undefined) =>\n useQuery<CosDatasetSummaryQueryData, { id: string }>(COS_DATASET_SUMMARY_QUERY, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n\nexport const useCosNotebooksQuery = (variables: CosNotebooksQueryVars = {}) =>\n useQuery<CosNotebooksQueryData, CosNotebooksQueryVars>(COS_NOTEBOOKS_QUERY, { variables });\n\nexport const useCosNotebookQuery = (id: string) =>\n useQuery<CosNotebookQueryData, { id: string }>(COS_NOTEBOOK_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosAnalysesQuery = (variables: CosAnalysesQueryVars = {}) =>\n useQuery<CosAnalysesQueryData, CosAnalysesQueryVars>(COS_ANALYSES_QUERY, { variables });\n\nexport const useCosReleasesQuery = (variables: CosReleasesQueryVars = {}) =>\n useQuery<CosReleasesQueryData, CosReleasesQueryVars>(COS_RELEASES_QUERY, { variables });\n\nexport const useCosAccessGrantsQuery = (variables: CosAccessGrantsQueryVars = {}) =>\n useQuery<CosAccessGrantsQueryData, CosAccessGrantsQueryVars>(COS_ACCESS_GRANTS_QUERY, {\n variables,\n });\n\n/**\n * Resource-scoped platform activity for a single cos entity. RBAC on\n * `getActivities` scopes on `filter.workspaceId`, so both a workspaceId and the\n * entity's resourceId are required — the query is skipped until both are known.\n */\nexport const useCosResourceActivityQuery = (params: {\n workspaceId?: string;\n resourceId: string;\n resourceType?: string;\n limit?: number;\n}) => {\n const { workspaceId, resourceId, resourceType, limit = 20 } = params;\n return useQuery<CosActivityQueryData, CosActivityQueryVars>(COS_ACTIVITY_BY_RESOURCE_QUERY, {\n variables: { filter: { workspaceId, resourceId, resourceType, limit } },\n skip: !workspaceId || !resourceId,\n fetchPolicy: 'cache-and-network',\n });\n};\n\n// ============================================================================\n// MUTATION HOOKS\n// ============================================================================\n\nexport const useCosCreateDatasetMutation = () =>\n useMutation<{ cosCreateDataset: CosDataset }, { input: CosCreateDatasetInput }>(\n COS_CREATE_DATASET_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n }\n );\n\nexport const useCosUpdateDatasetMutation = () =>\n useMutation<{ cosUpdateDataset: CosDataset }, { id: string; input: CosUpdateDatasetInput }>(\n COS_UPDATE_DATASET_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n }\n );\n\nexport const useCosPublishDatasetMutation = () =>\n useMutation<{ cosPublishDataset: CosDataset }, { id: string }>(COS_PUBLISH_DATASET_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n });\n\nexport const useCosArchiveDatasetMutation = () =>\n useMutation<{ cosArchiveDataset: boolean }, { id: string }>(COS_ARCHIVE_DATASET_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n });\n\nexport const useCosAddSchemaFieldMutation = () =>\n useMutation<{ cosAddSchemaField: CosSchemaField }, { input: CosAddSchemaFieldInput }>(\n COS_ADD_SCHEMA_FIELD_MUTATION,\n { errorPolicy: 'all', onError: onMutationError }\n );\n\nexport const useCosCreateSourceMutation = () =>\n useMutation<{ cosCreateSource: CosSource }, { input: CosCreateSourceInput }>(\n COS_CREATE_SOURCE_MUTATION,\n { errorPolicy: 'all', onError: onMutationError, refetchQueries: [{ query: COS_SOURCES_QUERY }] }\n );\n\nexport const useCosUpdateSourceMutation = () =>\n useMutation<{ cosUpdateSource: CosSource }, { id: string; input: CosUpdateSourceInput }>(\n COS_UPDATE_SOURCE_MUTATION,\n { errorPolicy: 'all', onError: onMutationError, refetchQueries: [{ query: COS_SOURCES_QUERY }] }\n );\n\nexport const useCosMarkSourceSyncedMutation = () =>\n useMutation<{ cosMarkSourceSynced: CosSource }, { id: string }>(COS_MARK_SOURCE_SYNCED_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_SOURCES_QUERY }],\n });\n\nexport const useCosArchiveSourceMutation = () =>\n useMutation<{ cosArchiveSource: boolean }, { id: string }>(COS_ARCHIVE_SOURCE_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_SOURCES_QUERY }],\n });\n\nexport const useCosCreateCollectionMutation = () =>\n useMutation<{ cosCreateCollection: CosCollection }, { input: CosCreateCollectionInput }>(\n COS_CREATE_COLLECTION_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_COLLECTIONS_QUERY }],\n }\n );\n\nexport const useCosUpdateCollectionMutation = () =>\n useMutation<\n { cosUpdateCollection: CosCollection },\n { id: string; input: CosUpdateCollectionInput }\n >(COS_UPDATE_COLLECTION_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_COLLECTIONS_QUERY }],\n });\n\nexport const useCosArchiveCollectionMutation = () =>\n useMutation<{ cosArchiveCollection: boolean }, { id: string }>(COS_ARCHIVE_COLLECTION_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_COLLECTIONS_QUERY }],\n });\n\nexport const useCosCreatePipelineMutation = () =>\n useMutation<{ cosCreatePipeline: CosPipeline }, { input: CosCreatePipelineInput }>(\n COS_CREATE_PIPELINE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_PIPELINES_QUERY }],\n }\n );\n\nexport const useCosUpdatePipelineMutation = () =>\n useMutation<{ cosUpdatePipeline: CosPipeline }, { id: string; input: CosUpdatePipelineInput }>(\n COS_UPDATE_PIPELINE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_PIPELINES_QUERY }],\n }\n );\n\nexport const useCosArchivePipelineMutation = () =>\n useMutation<{ cosArchivePipeline: boolean }, { id: string }>(COS_ARCHIVE_PIPELINE_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_PIPELINES_QUERY }],\n });\n\nexport const useCosStartRunMutation = () =>\n useMutation<{ cosStartRun: CosPipelineRun }, { input: CosStartRunInput }>(\n COS_START_RUN_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_RUNS_QUERY }],\n }\n );\n\nexport const useCosTransitionRunMutation = () =>\n useMutation<{ cosTransitionRun: CosPipelineRun }, { id: string; status: CosRunStatus }>(\n COS_TRANSITION_RUN_MUTATION,\n { errorPolicy: 'all', onError: onMutationError, refetchQueries: [{ query: COS_RUNS_QUERY }] }\n );\n\nexport const useCosAddRunStepMutation = () =>\n useMutation<{ cosAddRunStep: CosPipelineStep }, { input: CosAddRunStepInput }>(\n COS_ADD_RUN_STEP_MUTATION,\n { errorPolicy: 'all', onError: onMutationError }\n );\n\nexport const useCosCreateNotebookMutation = () =>\n useMutation<{ cosCreateNotebook: CosNotebook }, { input: CosCreateNotebookInput }>(\n COS_CREATE_NOTEBOOK_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_NOTEBOOKS_QUERY }],\n }\n );\n\nexport const useCosUpdateNotebookMutation = () =>\n useMutation<{ cosUpdateNotebook: CosNotebook }, { id: string; input: CosUpdateNotebookInput }>(\n COS_UPDATE_NOTEBOOK_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_NOTEBOOKS_QUERY }],\n }\n );\n\nexport const useCosArchiveNotebookMutation = () =>\n useMutation<{ cosArchiveNotebook: boolean }, { id: string }>(COS_ARCHIVE_NOTEBOOK_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_NOTEBOOKS_QUERY }],\n });\n\nexport const useCosRunAnalysisMutation = () =>\n useMutation<{ cosRunAnalysis: CosAnalysis }, { input: CosRunAnalysisInput }>(\n COS_RUN_ANALYSIS_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ANALYSES_QUERY }],\n }\n );\n\nexport const useCosCompleteAnalysisMutation = () =>\n useMutation<\n { cosCompleteAnalysis: CosAnalysis },\n {\n id: string;\n status: Extract<CosAnalysisStatus, 'COMPLETED' | 'FAILED'>;\n results?: Record<string, unknown>;\n outputFileId?: string;\n }\n >(COS_COMPLETE_ANALYSIS_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ANALYSES_QUERY }],\n });\n\nexport const useCosCreateReleaseMutation = () =>\n useMutation<{ cosCreateRelease: CosRelease }, { input: CosCreateReleaseInput }>(\n COS_CREATE_RELEASE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_RELEASES_QUERY }],\n }\n );\n\nexport const useCosPublishReleaseMutation = () =>\n useMutation<{ cosPublishRelease: CosRelease }, { id: string; doi?: string }>(\n COS_PUBLISH_RELEASE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_RELEASES_QUERY }],\n }\n );\n\nexport const useCosGrantAccessMutation = () =>\n useMutation<{ cosGrantAccess: CosDataAccessGrant }, { input: CosGrantAccessInput }>(\n COS_GRANT_ACCESS_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ACCESS_GRANTS_QUERY }],\n }\n );\n\nexport const useCosRevokeAccessMutation = () =>\n useMutation<{ cosRevokeAccess: CosDataAccessGrant }, { id: string }>(COS_REVOKE_ACCESS_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ACCESS_GRANTS_QUERY }],\n });\n"],"mappings":";;;;AAwBA,IAAM,KAAmB,MAA2B;CAClD,EAAO,MAAM,wBAAwB,EAAM,WAAW,mBAAmB;AAC3E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AqE,GAA4B;CAC/F,aAAa;CACb,SAAS;CACT,gBAAgB,CAAC,EAAE,OAAO,EAAwB,CAAC;AACrD,CAAC"}
|
|
1
|
+
{"version":3,"file":"cosmicApi.js","names":[],"sources":["../../../src/cosmicintersection/api/cosmicApi.ts"],"sourcesContent":["/**\n * cosmicApi — hand-written typed data layer for the CosmicIntersection MFE.\n *\n * Mirrors the pattern in microfe-eventfullymanaged's eventApi.ts: inline `gql`\n * documents + `@apollo/client/react` hooks, with hand-written response/variables\n * types that track the wspace-cosmicintersection-svc subgraph SDL exactly. The\n * Apollo client is provided by the HOST app shell via React context (integrated\n * mode) — this module never constructs a client. Every `cos*` operation runs on\n * the workspace gateway (the default client in context).\n *\n * Scalar mapping: BigInt -> string, JSON -> Record<string, unknown>,\n * DateTime -> string (ISO).\n */\nimport { gql, type ErrorLike } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\n\nimport { notify } from '../lib/toast';\n\n/**\n * Shared mutation error sink. The gateway client runs with `errorPolicy: 'all'`,\n * so in-band GraphQL errors also invoke `onError`; wiring this on every write\n * mutation guarantees a failure is always surfaced to the user even if a caller\n * forgets to inspect the resolved result.\n */\nconst onMutationError = (error: ErrorLike): void => {\n notify.error('Something went wrong', error.message || 'Please try again.');\n};\n\n// ============================================================================\n// ENUMS (string-literal unions — exact SDL values)\n// ============================================================================\n\nexport type CosDatasetStatus = 'DRAFT' | 'INGESTING' | 'AVAILABLE' | 'DEPRECATED' | 'ARCHIVED';\nexport type CosAccessLevel = 'PUBLIC' | 'WORKSPACE' | 'RESTRICTED' | 'EMBARGOED';\nexport type CosSourceType =\n | 'TELESCOPE'\n | 'SATELLITE'\n | 'GROUND_SENSOR'\n | 'ARCHIVE'\n | 'API'\n | 'STREAM'\n | 'FILE_DROP'\n | 'SIMULATION';\nexport type CosSourceStatus =\n 'CONFIGURING' | 'CONNECTED' | 'SYNCING' | 'DEGRADED' | 'ERROR' | 'DISABLED';\nexport type CosFieldType =\n | 'STRING'\n | 'INTEGER'\n | 'FLOAT'\n | 'BOOLEAN'\n | 'TIMESTAMP'\n | 'COORDINATE'\n | 'SPECTRUM'\n | 'GEOMETRY'\n | 'IMAGE_REF'\n | 'JSON';\nexport type CosPipelineStatus = 'DRAFT' | 'ACTIVE' | 'PAUSED' | 'ARCHIVED';\nexport type CosPipelineTrigger = 'MANUAL' | 'SCHEDULED' | 'ON_INGEST' | 'WEBHOOK';\nexport type CosRunStatus = 'QUEUED' | 'RUNNING' | 'SUCCEEDED' | 'FAILED' | 'CANCELLED';\n/**\n * Full SDL vocabulary. The four geospatial kinds are recognised values a step\n * can already carry (BOFF-4355) — only RASTER_CALC has an execution backend, so\n * they are readable/renderable but are deliberately not offered as authoring\n * options in the add-step form.\n */\nexport type CosStepKind =\n | 'INGEST'\n | 'CALIBRATE'\n | 'TRANSFORM'\n | 'ANALYZE'\n | 'EXPORT'\n | 'NOTIFY'\n | 'RASTER_CALC'\n | 'REPROJECT'\n | 'TILE'\n | 'ZONAL_STATS';\nexport type CosNotebookStatus = 'DRAFT' | 'RUNNING' | 'PUBLISHED' | 'ARCHIVED';\nexport type CosAnalysisStatus = 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED';\nexport type CosReleaseStatus = 'DRAFT' | 'UNDER_REVIEW' | 'PUBLISHED' | 'RETRACTED';\nexport type CosGrantStatus = 'PENDING' | 'ACTIVE' | 'EXPIRED' | 'REVOKED';\n\n// ============================================================================\n// ENTITY TYPES\n// ============================================================================\n\n/** Federated wspace-files File stub — only `{ id }` is resolvable in this subgraph. */\nexport interface CosFileRef {\n id: string;\n}\n\n/** An entity selected id-only, where the operation needs its existence, not its body. */\nexport interface CosIdRef {\n id: string;\n}\n\n/**\n * Per-parent cap the subgraph applies to every relation field\n * (`capPerGroup(rows, key, DEFAULT_LIMIT)` in wspace-cosmicintersection-svc's\n * dataloaders — DEFAULT_LIMIT is 50).\n *\n * A relation array of exactly this length means \"at least this many\", NOT an\n * exact total: render it as `50+`, never as a precise count.\n */\nexport const COS_RELATION_PAGE_SIZE = 50;\n\nexport interface CosSchemaField {\n id: string;\n workspaceId: string;\n datasetId: string;\n name: string;\n fieldType: CosFieldType;\n unit?: string | null;\n description?: string | null;\n nullable: boolean;\n position: number;\n provenance?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosDataset {\n id: string;\n workspaceId: string;\n name: string;\n description?: string | null;\n status: CosDatasetStatus;\n accessLevel: CosAccessLevel;\n format?: string | null;\n sourceId?: string | null;\n collectionId?: string | null;\n /** BigInt returned as a numeric string. */\n rowCount: string;\n /** BigInt returned as a numeric string. */\n sizeBytes: string;\n version: number;\n lineageCaptured: boolean;\n coverage?: Record<string, unknown> | null;\n ingestedAt?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relations — only present when the operation selects them (detail queries).\n source?: CosSource | null;\n collection?: CosCollection | null;\n file?: CosFileRef | null;\n schemaFields?: CosSchemaField[];\n}\n\nexport interface CosSource {\n id: string;\n workspaceId: string;\n name: string;\n description?: string | null;\n type: CosSourceType;\n status: CosSourceStatus;\n endpoint?: string | null;\n config?: Record<string, unknown> | null;\n lastSyncedAt?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relation — present only on detail queries.\n datasets?: CosDataset[];\n}\n\nexport interface CosCollection {\n id: string;\n workspaceId: string;\n name: string;\n slug?: string | null;\n description?: string | null;\n isPublic: boolean;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relation — present only on detail queries.\n datasets?: CosDataset[];\n}\n\nexport interface CosPipeline {\n id: string;\n workspaceId: string;\n name: string;\n description?: string | null;\n status: CosPipelineStatus;\n trigger: CosPipelineTrigger;\n schedule?: string | null;\n definition?: Record<string, unknown> | null;\n version: number;\n lastRunAt?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relation — present only on detail queries.\n runs?: CosPipelineRun[];\n}\n\nexport interface CosPipelineRun {\n id: string;\n workspaceId: string;\n pipelineId: string;\n runNumber: number;\n status: CosRunStatus;\n datasetId?: string | null;\n params?: Record<string, unknown> | null;\n metrics?: Record<string, unknown> | null;\n triggeredBy?: string | null;\n startedAt?: string | null;\n finishedAt?: string | null;\n durationMs?: number | null;\n errorMessage?: string | null;\n createdAt: string;\n updatedAt: string;\n // Relations — present only on detail queries.\n pipeline?: CosPipeline | null;\n steps?: CosPipelineStep[];\n}\n\nexport interface CosPipelineStep {\n id: string;\n workspaceId: string;\n runId: string;\n name: string;\n kind: CosStepKind;\n position: number;\n status: CosRunStatus;\n inputs?: Record<string, unknown> | null;\n outputs?: Record<string, unknown> | null;\n logsRef?: string | null;\n startedAt?: string | null;\n finishedAt?: string | null;\n durationMs?: number | null;\n errorMessage?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosNotebook {\n id: string;\n workspaceId: string;\n title: string;\n description?: string | null;\n status: CosNotebookStatus;\n runtime?: string | null;\n environment?: Record<string, unknown> | null;\n datasetIds: string[];\n isShared: boolean;\n shareSlug?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relations — present only on detail queries.\n file?: CosFileRef | null;\n analyses?: CosAnalysis[];\n releases?: CosRelease[];\n}\n\nexport interface CosAnalysis {\n id: string;\n workspaceId: string;\n title: string;\n status: CosAnalysisStatus;\n method?: string | null;\n aiAssisted: boolean;\n notebookId?: string | null;\n datasetId?: string | null;\n results?: Record<string, unknown> | null;\n outputFile?: CosFileRef | null;\n startedAt?: string | null;\n finishedAt?: string | null;\n errorMessage?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosRelease {\n id: string;\n workspaceId: string;\n title: string;\n version: string;\n status: CosReleaseStatus;\n abstract?: string | null;\n authors: string[];\n datasetIds: string[];\n notebookId?: string | null;\n doi?: string | null;\n license?: string | null;\n publishedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosDataAccessGrant {\n id: string;\n workspaceId: string;\n datasetId: string;\n granteeId: string;\n status: CosGrantStatus;\n scopes: string[];\n reason?: string | null;\n grantedAt?: string | null;\n expiresAt?: string | null;\n revokedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n// ============================================================================\n// PAGINATION / CONNECTIONS\n// ============================================================================\n\nexport interface CosPageInfo {\n hasMore: boolean;\n cursor?: string | null;\n}\n\nexport interface CosConnection<T> {\n items: T[];\n pageInfo: CosPageInfo;\n}\n\n/** Offset-based pagination input (PaginationInput in the SDL; limit defaults to 50). */\nexport interface CosPaginationInput {\n limit?: number;\n offset?: number;\n cursor?: string;\n}\n\n// ============================================================================\n// INPUT TYPES\n// ============================================================================\n\nexport interface CosCreateDatasetInput {\n name: string;\n description?: string;\n status?: CosDatasetStatus;\n accessLevel?: CosAccessLevel;\n format?: string;\n sourceId?: string;\n collectionId?: string;\n fileId?: string;\n coverage?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosUpdateDatasetInput {\n name?: string;\n description?: string;\n accessLevel?: CosAccessLevel;\n format?: string;\n collectionId?: string;\n coverage?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosAddSchemaFieldInput {\n datasetId: string;\n name: string;\n fieldType?: CosFieldType;\n unit?: string;\n description?: string;\n nullable?: boolean;\n position?: number;\n provenance?: string;\n}\n\nexport interface CosCreateSourceInput {\n name: string;\n type?: CosSourceType;\n status?: CosSourceStatus;\n description?: string;\n endpoint?: string;\n credentialRef?: string;\n config?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosUpdateSourceInput {\n name?: string;\n type?: CosSourceType;\n status?: CosSourceStatus;\n description?: string;\n endpoint?: string;\n credentialRef?: string;\n config?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosCreateCollectionInput {\n name: string;\n slug?: string;\n description?: string;\n isPublic?: boolean;\n tags?: string[];\n}\n\n/** All fields optional — only the provided keys are updated (CosUpdateCollectionInput in the SDL). */\nexport interface CosUpdateCollectionInput {\n name?: string;\n slug?: string;\n description?: string;\n isPublic?: boolean;\n tags?: string[];\n}\n\nexport interface CosCreatePipelineInput {\n name: string;\n description?: string;\n trigger?: CosPipelineTrigger;\n schedule?: string;\n definition?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosUpdatePipelineInput {\n name?: string;\n description?: string;\n status?: CosPipelineStatus;\n trigger?: CosPipelineTrigger;\n schedule?: string;\n definition?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosStartRunInput {\n pipelineId: string;\n datasetId?: string;\n params?: Record<string, unknown>;\n}\n\nexport interface CosAddRunStepInput {\n runId: string;\n name: string;\n kind?: CosStepKind;\n inputs?: Record<string, unknown>;\n position?: number;\n}\n\nexport interface CosCreateNotebookInput {\n title: string;\n description?: string;\n runtime?: string;\n environment?: Record<string, unknown>;\n datasetIds?: string[];\n fileId?: string;\n tags?: string[];\n}\n\nexport interface CosUpdateNotebookInput {\n title?: string;\n description?: string;\n status?: CosNotebookStatus;\n runtime?: string;\n environment?: Record<string, unknown>;\n datasetIds?: string[];\n isShared?: boolean;\n shareSlug?: string;\n tags?: string[];\n}\n\nexport interface CosRunAnalysisInput {\n title: string;\n method?: string;\n aiAssisted?: boolean;\n notebookId?: string;\n datasetId?: string;\n}\n\nexport interface CosCreateReleaseInput {\n title: string;\n version?: string;\n abstract?: string;\n authors?: string[];\n datasetIds?: string[];\n notebookId?: string;\n license?: string;\n}\n\nexport interface CosGrantAccessInput {\n datasetId: string;\n granteeId: string;\n scopes?: string[];\n reason?: string;\n expiresAt?: string;\n}\n\n// ============================================================================\n// GQL DOCUMENTS — QUERIES\n// ============================================================================\n\nexport const COS_HEALTH_QUERY = gql`\n query CosHealth {\n cosHealth\n }\n`;\n\nexport const COS_DATASETS_QUERY = gql`\n query CosListDatasets(\n $q: String\n $accessLevel: CosAccessLevel\n $format: String\n $collectionId: ID\n $sourceId: ID\n $status: CosDatasetStatus\n $pagination: PaginationInput\n ) {\n cosListDatasets(\n q: $q\n accessLevel: $accessLevel\n format: $format\n collectionId: $collectionId\n sourceId: $sourceId\n status: $status\n pagination: $pagination\n ) {\n items {\n id\n workspaceId\n name\n description\n status\n accessLevel\n format\n sourceId\n collectionId\n rowCount\n sizeBytes\n version\n lineageCaptured\n ingestedAt\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_DATASET_QUERY = gql`\n query CosDataset($id: ID!) {\n cosDataset(id: $id) {\n id\n workspaceId\n name\n description\n status\n accessLevel\n format\n sourceId\n collectionId\n rowCount\n sizeBytes\n version\n lineageCaptured\n coverage\n ingestedAt\n tags\n createdAt\n updatedAt\n file {\n id\n }\n source {\n id\n name\n type\n status\n }\n collection {\n id\n name\n slug\n }\n schemaFields {\n id\n datasetId\n name\n fieldType\n unit\n description\n nullable\n position\n provenance\n createdAt\n updatedAt\n }\n }\n }\n`;\n\nexport const COS_SOURCES_QUERY = gql`\n query CosListSources(\n $type: CosSourceType\n $status: CosSourceStatus\n $pagination: PaginationInput\n ) {\n cosListSources(type: $type, status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n name\n description\n type\n status\n endpoint\n config\n lastSyncedAt\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_SOURCE_QUERY = gql`\n query CosSource($id: ID!) {\n cosSource(id: $id) {\n id\n workspaceId\n name\n description\n type\n status\n endpoint\n config\n lastSyncedAt\n tags\n createdAt\n updatedAt\n datasets {\n id\n name\n status\n accessLevel\n rowCount\n updatedAt\n }\n }\n }\n`;\n\n/**\n * `datasets` is selected id-only so each card can show how many datasets the\n * collection holds. The subgraph resolves it through `collectionDatasetsLoader`\n * (one batched query for the whole page) and filters to the datasets THIS actor\n * may read, so the length is the caller's visible count — capped at\n * `COS_RELATION_PAGE_SIZE`.\n */\nexport const COS_COLLECTIONS_QUERY = gql`\n query CosListCollections {\n cosListCollections {\n id\n workspaceId\n name\n slug\n description\n isPublic\n tags\n createdAt\n updatedAt\n datasets {\n id\n }\n }\n }\n`;\n\nexport const COS_COLLECTION_QUERY = gql`\n query CosCollection($id: ID!) {\n cosCollection(id: $id) {\n id\n workspaceId\n name\n slug\n description\n isPublic\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_SCHEMA_FIELDS_QUERY = gql`\n query CosListSchemaFields($datasetId: ID!) {\n cosListSchemaFields(datasetId: $datasetId) {\n id\n workspaceId\n datasetId\n name\n fieldType\n unit\n description\n nullable\n position\n provenance\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_PIPELINES_QUERY = gql`\n query CosListPipelines($status: CosPipelineStatus, $pagination: PaginationInput) {\n cosListPipelines(status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n name\n description\n status\n trigger\n schedule\n version\n lastRunAt\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_PIPELINE_QUERY = gql`\n query CosPipeline($id: ID!) {\n cosPipeline(id: $id) {\n id\n workspaceId\n name\n description\n status\n trigger\n schedule\n definition\n version\n lastRunAt\n tags\n createdAt\n updatedAt\n runs {\n id\n runNumber\n status\n datasetId\n startedAt\n finishedAt\n durationMs\n createdAt\n }\n }\n }\n`;\n\nexport const COS_RUNS_QUERY = gql`\n query CosListRuns($pipelineId: ID, $status: CosRunStatus, $pagination: PaginationInput) {\n cosListRuns(pipelineId: $pipelineId, status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n pipelineId\n runNumber\n status\n datasetId\n triggeredBy\n startedAt\n finishedAt\n durationMs\n errorMessage\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_RUN_QUERY = gql`\n query CosRun($id: ID!) {\n cosRun(id: $id) {\n id\n workspaceId\n pipelineId\n runNumber\n status\n datasetId\n params\n metrics\n triggeredBy\n startedAt\n finishedAt\n durationMs\n errorMessage\n createdAt\n updatedAt\n pipeline {\n id\n name\n status\n trigger\n schedule\n }\n steps {\n id\n runId\n name\n kind\n position\n status\n startedAt\n finishedAt\n durationMs\n errorMessage\n }\n }\n }\n`;\n\n/**\n * Other FAILED runs of the same pipeline, newest first, each with its steps so\n * the caller can name the step that broke. `steps` resolves through\n * `pipelineRunStepsLoader`, so the whole list costs one extra batched query.\n */\nexport const COS_PIPELINE_FAILED_RUNS_QUERY = gql`\n query CosPipelineFailedRuns($pipelineId: ID!, $pagination: PaginationInput) {\n cosListRuns(pipelineId: $pipelineId, status: FAILED, pagination: $pagination) {\n items {\n id\n workspaceId\n pipelineId\n runNumber\n status\n errorMessage\n startedAt\n finishedAt\n createdAt\n updatedAt\n steps {\n id\n runId\n name\n kind\n position\n status\n errorMessage\n }\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\n/**\n * Minimal dataset lookup — resolves an id held on another entity (e.g.\n * `CosPipelineRun.datasetId`, which the SDL exposes as a bare ID with no\n * relation field) to something a human can read. Returns null when the caller\n * has no read access to that dataset, so callers must fall back to the id.\n */\nexport const COS_DATASET_SUMMARY_QUERY = gql`\n query CosDatasetSummary($id: ID!) {\n cosDataset(id: $id) {\n id\n name\n status\n accessLevel\n }\n }\n`;\n\nexport const COS_RUN_STEPS_QUERY = gql`\n query CosListRunSteps($runId: ID!) {\n cosListRunSteps(runId: $runId) {\n id\n workspaceId\n runId\n name\n kind\n position\n status\n inputs\n outputs\n logsRef\n startedAt\n finishedAt\n durationMs\n errorMessage\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_NOTEBOOKS_QUERY = gql`\n query CosListNotebooks($status: CosNotebookStatus, $pagination: PaginationInput) {\n cosListNotebooks(status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n title\n description\n status\n runtime\n datasetIds\n isShared\n shareSlug\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_NOTEBOOK_QUERY = gql`\n query CosNotebook($id: ID!) {\n cosNotebook(id: $id) {\n id\n workspaceId\n title\n description\n status\n runtime\n environment\n datasetIds\n isShared\n shareSlug\n tags\n createdAt\n updatedAt\n file {\n id\n }\n analyses {\n id\n title\n status\n aiAssisted\n method\n createdAt\n }\n releases {\n id\n title\n version\n status\n publishedAt\n }\n }\n }\n`;\n\nexport const COS_ANALYSES_QUERY = gql`\n query CosListAnalyses($datasetId: ID, $notebookId: ID, $status: CosAnalysisStatus) {\n cosListAnalyses(datasetId: $datasetId, notebookId: $notebookId, status: $status) {\n id\n workspaceId\n title\n status\n method\n aiAssisted\n notebookId\n datasetId\n results\n outputFile {\n id\n }\n startedAt\n finishedAt\n errorMessage\n createdAt\n updatedAt\n }\n }\n`;\n\n/**\n * One analysis by id, independent of list paging and filters; the analyses\n * page falls back to it when the `?id=` analysis is not in the loaded list.\n */\nexport const COS_ANALYSIS_QUERY = gql`\n query CosAnalysis($id: ID!) {\n cosAnalysis(id: $id) {\n id\n workspaceId\n title\n status\n method\n aiAssisted\n notebookId\n datasetId\n results\n outputFile {\n id\n }\n startedAt\n finishedAt\n errorMessage\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_RELEASES_QUERY = gql`\n query CosListReleases($status: CosReleaseStatus, $pagination: PaginationInput) {\n cosListReleases(status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n title\n version\n status\n abstract\n authors\n datasetIds\n notebookId\n doi\n license\n publishedAt\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\n/**\n * One release by id, independent of list paging and filters. The releases page\n * falls back to it when the `?id=` release is not on the loaded list page, so a\n * deep link or a command-palette Recent entry always reopens the release.\n */\nexport const COS_RELEASE_QUERY = gql`\n query CosRelease($id: ID!) {\n cosRelease(id: $id) {\n id\n workspaceId\n title\n version\n status\n abstract\n authors\n datasetIds\n notebookId\n doi\n license\n publishedAt\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_ACCESS_GRANTS_QUERY = gql`\n query CosListAccessGrants($datasetId: ID, $status: CosGrantStatus) {\n cosListAccessGrants(datasetId: $datasetId, status: $status) {\n id\n workspaceId\n datasetId\n granteeId\n status\n scopes\n reason\n grantedAt\n expiresAt\n revokedAt\n createdAt\n updatedAt\n }\n }\n`;\n\n// ============================================================================\n// PLATFORM REUSE — activity feed (wspace-activity-svc, federated on the\n// workspace supergraph). The cos mutation-audit plugin already writes these\n// ActivityLog rows via be-sdk `trackOperation`; this is the read surface,\n// scoped to a single cos entity by `resourceId`. Only scalar fields are\n// selected so no cross-subgraph entity resolution is required.\n// ============================================================================\n\nexport const COS_ACTIVITY_BY_RESOURCE_QUERY = gql`\n query CosResourceActivity($filter: ActivityLogFilter) {\n getActivities(filter: $filter) {\n id\n action\n description\n resourceType\n resourceId\n userId\n timestamp\n }\n }\n`;\n\n// ============================================================================\n// GQL DOCUMENTS — MUTATIONS\n// ============================================================================\n\nexport const COS_CREATE_DATASET_MUTATION = gql`\n mutation CosCreateDataset($input: CosCreateDatasetInput!) {\n cosCreateDataset(input: $input) {\n id\n name\n status\n accessLevel\n sourceId\n collectionId\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_DATASET_MUTATION = gql`\n mutation CosUpdateDataset($id: ID!, $input: CosUpdateDatasetInput!) {\n cosUpdateDataset(id: $id, input: $input) {\n id\n name\n description\n status\n accessLevel\n format\n collectionId\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_PUBLISH_DATASET_MUTATION = gql`\n mutation CosPublishDataset($id: ID!) {\n cosPublishDataset(id: $id) {\n id\n status\n ingestedAt\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_DATASET_MUTATION = gql`\n mutation CosArchiveDataset($id: ID!) {\n cosArchiveDataset(id: $id)\n }\n`;\n\nexport const COS_ADD_SCHEMA_FIELD_MUTATION = gql`\n mutation CosAddSchemaField($input: CosAddSchemaFieldInput!) {\n cosAddSchemaField(input: $input) {\n id\n workspaceId\n datasetId\n name\n fieldType\n unit\n description\n nullable\n position\n provenance\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_CREATE_SOURCE_MUTATION = gql`\n mutation CosCreateSource($input: CosCreateSourceInput!) {\n cosCreateSource(input: $input) {\n id\n name\n type\n status\n endpoint\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_SOURCE_MUTATION = gql`\n mutation CosUpdateSource($id: ID!, $input: CosUpdateSourceInput!) {\n cosUpdateSource(id: $id, input: $input) {\n id\n name\n description\n type\n status\n endpoint\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_MARK_SOURCE_SYNCED_MUTATION = gql`\n mutation CosMarkSourceSynced($id: ID!) {\n cosMarkSourceSynced(id: $id) {\n id\n status\n lastSyncedAt\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_SOURCE_MUTATION = gql`\n mutation CosArchiveSource($id: ID!) {\n cosArchiveSource(id: $id)\n }\n`;\n\nexport const COS_CREATE_COLLECTION_MUTATION = gql`\n mutation CosCreateCollection($input: CosCreateCollectionInput!) {\n cosCreateCollection(input: $input) {\n id\n name\n slug\n description\n isPublic\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_COLLECTION_MUTATION = gql`\n mutation CosUpdateCollection($id: ID!, $input: CosUpdateCollectionInput!) {\n cosUpdateCollection(id: $id, input: $input) {\n id\n name\n slug\n description\n isPublic\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_COLLECTION_MUTATION = gql`\n mutation CosArchiveCollection($id: ID!) {\n cosArchiveCollection(id: $id)\n }\n`;\n\nexport const COS_CREATE_PIPELINE_MUTATION = gql`\n mutation CosCreatePipeline($input: CosCreatePipelineInput!) {\n cosCreatePipeline(input: $input) {\n id\n name\n status\n trigger\n schedule\n version\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_PIPELINE_MUTATION = gql`\n mutation CosUpdatePipeline($id: ID!, $input: CosUpdatePipelineInput!) {\n cosUpdatePipeline(id: $id, input: $input) {\n id\n name\n description\n status\n trigger\n schedule\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_PIPELINE_MUTATION = gql`\n mutation CosArchivePipeline($id: ID!) {\n cosArchivePipeline(id: $id)\n }\n`;\n\nexport const COS_START_RUN_MUTATION = gql`\n mutation CosStartRun($input: CosStartRunInput!) {\n cosStartRun(input: $input) {\n id\n pipelineId\n runNumber\n status\n datasetId\n startedAt\n createdAt\n }\n }\n`;\n\nexport const COS_TRANSITION_RUN_MUTATION = gql`\n mutation CosTransitionRun($id: ID!, $status: CosRunStatus!) {\n cosTransitionRun(id: $id, status: $status) {\n id\n status\n startedAt\n finishedAt\n durationMs\n updatedAt\n }\n }\n`;\n\nexport const COS_ADD_RUN_STEP_MUTATION = gql`\n mutation CosAddRunStep($input: CosAddRunStepInput!) {\n cosAddRunStep(input: $input) {\n id\n runId\n name\n kind\n position\n status\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_CREATE_NOTEBOOK_MUTATION = gql`\n mutation CosCreateNotebook($input: CosCreateNotebookInput!) {\n cosCreateNotebook(input: $input) {\n id\n title\n status\n runtime\n datasetIds\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_NOTEBOOK_MUTATION = gql`\n mutation CosUpdateNotebook($id: ID!, $input: CosUpdateNotebookInput!) {\n cosUpdateNotebook(id: $id, input: $input) {\n id\n title\n description\n status\n runtime\n datasetIds\n isShared\n shareSlug\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_NOTEBOOK_MUTATION = gql`\n mutation CosArchiveNotebook($id: ID!) {\n cosArchiveNotebook(id: $id)\n }\n`;\n\nexport const COS_RUN_ANALYSIS_MUTATION = gql`\n mutation CosRunAnalysis($input: CosRunAnalysisInput!) {\n cosRunAnalysis(input: $input) {\n id\n title\n status\n method\n aiAssisted\n notebookId\n datasetId\n startedAt\n createdAt\n }\n }\n`;\n\nexport const COS_COMPLETE_ANALYSIS_MUTATION = gql`\n mutation CosCompleteAnalysis(\n $id: ID!\n $status: CosAnalysisStatus!\n $results: JSON\n $outputFileId: ID\n ) {\n cosCompleteAnalysis(id: $id, status: $status, results: $results, outputFileId: $outputFileId) {\n id\n status\n results\n finishedAt\n errorMessage\n outputFile {\n id\n }\n updatedAt\n }\n }\n`;\n\nexport const COS_CREATE_RELEASE_MUTATION = gql`\n mutation CosCreateRelease($input: CosCreateReleaseInput!) {\n cosCreateRelease(input: $input) {\n id\n title\n version\n status\n authors\n datasetIds\n notebookId\n license\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_PUBLISH_RELEASE_MUTATION = gql`\n mutation CosPublishRelease($id: ID!, $doi: String) {\n cosPublishRelease(id: $id, doi: $doi) {\n id\n status\n doi\n publishedAt\n updatedAt\n }\n }\n`;\n\nexport const COS_GRANT_ACCESS_MUTATION = gql`\n mutation CosGrantAccess($input: CosGrantAccessInput!) {\n cosGrantAccess(input: $input) {\n id\n datasetId\n granteeId\n status\n scopes\n reason\n grantedAt\n expiresAt\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_REVOKE_ACCESS_MUTATION = gql`\n mutation CosRevokeAccess($id: ID!) {\n cosRevokeAccess(id: $id) {\n id\n status\n revokedAt\n updatedAt\n }\n }\n`;\n\n// ============================================================================\n// RESPONSE / VARIABLES TYPES\n// ============================================================================\n\nexport interface CosHealthQueryData {\n cosHealth: string;\n}\n\nexport interface CosDatasetsQueryData {\n cosListDatasets: CosConnection<CosDataset>;\n}\nexport interface CosDatasetsQueryVars {\n /** Full-text search across dataset name/description/tags (backend `q` arg). */\n q?: string;\n accessLevel?: CosAccessLevel;\n format?: string;\n collectionId?: string;\n sourceId?: string;\n status?: CosDatasetStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosDatasetQueryData {\n cosDataset: CosDataset | null;\n}\n\nexport interface CosSourcesQueryData {\n cosListSources: CosConnection<CosSource>;\n}\nexport interface CosSourcesQueryVars {\n type?: CosSourceType;\n status?: CosSourceStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosSourceQueryData {\n cosSource: CosSource | null;\n}\n\n/**\n * Row shape of `cosListCollections` — same as `CosCollection` except `datasets`\n * is the id-only selection COS_COLLECTIONS_QUERY makes, so the list page can\n * size each collection without over-fetching dataset bodies.\n */\nexport interface CosCollectionListItem extends Omit<CosCollection, 'datasets'> {\n datasets: CosIdRef[];\n}\n\nexport interface CosCollectionsQueryData {\n cosListCollections: CosCollectionListItem[];\n}\n\nexport interface CosCollectionQueryData {\n cosCollection: CosCollection | null;\n}\n\nexport interface CosSchemaFieldsQueryData {\n cosListSchemaFields: CosSchemaField[];\n}\n\nexport interface CosPipelinesQueryData {\n cosListPipelines: CosConnection<CosPipeline>;\n}\nexport interface CosPipelinesQueryVars {\n status?: CosPipelineStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosPipelineQueryData {\n cosPipeline: CosPipeline | null;\n}\n\nexport interface CosRunsQueryData {\n cosListRuns: CosConnection<CosPipelineRun>;\n}\nexport interface CosRunsQueryVars {\n pipelineId?: string;\n status?: CosRunStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosRunQueryData {\n cosRun: CosPipelineRun | null;\n}\n\nexport interface CosRunStepsQueryData {\n cosListRunSteps: CosPipelineStep[];\n}\n\n/** Row of COS_PIPELINE_FAILED_RUNS_QUERY — `steps` is always selected. */\nexport interface CosFailedRunListItem extends Omit<CosPipelineRun, 'steps'> {\n steps: CosPipelineStep[];\n}\n\nexport interface CosPipelineFailedRunsQueryData {\n cosListRuns: CosConnection<CosFailedRunListItem>;\n}\nexport interface CosPipelineFailedRunsQueryVars {\n pipelineId: string;\n pagination?: CosPaginationInput;\n}\n\n/** Just enough of a dataset to render its name in place of a bare id. */\nexport interface CosDatasetSummary {\n id: string;\n name: string;\n status: CosDatasetStatus;\n accessLevel: CosAccessLevel;\n}\n\nexport interface CosDatasetSummaryQueryData {\n cosDataset: CosDatasetSummary | null;\n}\n\nexport interface CosNotebooksQueryData {\n cosListNotebooks: CosConnection<CosNotebook>;\n}\nexport interface CosNotebooksQueryVars {\n status?: CosNotebookStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosNotebookQueryData {\n cosNotebook: CosNotebook | null;\n}\n\nexport interface CosAnalysesQueryData {\n cosListAnalyses: CosAnalysis[];\n}\nexport interface CosAnalysesQueryVars {\n datasetId?: string;\n notebookId?: string;\n status?: CosAnalysisStatus;\n}\n\nexport interface CosAnalysisQueryData {\n cosAnalysis: CosAnalysis | null;\n}\nexport interface CosReleaseQueryData {\n cosRelease: CosRelease | null;\n}\nexport interface CosReleasesQueryData {\n cosListReleases: CosConnection<CosRelease>;\n}\nexport interface CosReleasesQueryVars {\n status?: CosReleaseStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosAccessGrantsQueryData {\n cosListAccessGrants: CosDataAccessGrant[];\n}\nexport interface CosAccessGrantsQueryVars {\n datasetId?: string;\n status?: CosGrantStatus;\n}\n\n/** A single platform activity record (subset of wspace-activity-svc ActivityLog). */\nexport interface CosActivityEntry {\n id: string;\n action: string;\n description?: string | null;\n resourceType?: string | null;\n resourceId?: string | null;\n userId: string;\n timestamp: string;\n}\n\nexport interface CosActivityQueryData {\n getActivities: CosActivityEntry[];\n}\n\n/** Mirrors ActivityLogFilter — only the fields the cos activity panel needs. */\nexport interface CosActivityFilter {\n workspaceId?: string;\n resourceId?: string;\n resourceType?: string;\n limit?: number;\n offset?: number;\n}\n\nexport interface CosActivityQueryVars {\n filter?: CosActivityFilter;\n}\n\n// ============================================================================\n// QUERY HOOKS\n// ============================================================================\n\nexport const useCosHealthQuery = () => useQuery<CosHealthQueryData>(COS_HEALTH_QUERY);\n\nexport const useCosDatasetsQuery = (variables: CosDatasetsQueryVars = {}) =>\n useQuery<CosDatasetsQueryData, CosDatasetsQueryVars>(COS_DATASETS_QUERY, { variables });\n\nexport const useCosDatasetQuery = (id: string) =>\n useQuery<CosDatasetQueryData, { id: string }>(COS_DATASET_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosSourcesQuery = (variables: CosSourcesQueryVars = {}) =>\n useQuery<CosSourcesQueryData, CosSourcesQueryVars>(COS_SOURCES_QUERY, { variables });\n\nexport const useCosSourceQuery = (id: string) =>\n useQuery<CosSourceQueryData, { id: string }>(COS_SOURCE_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosCollectionsQuery = () =>\n useQuery<CosCollectionsQueryData>(COS_COLLECTIONS_QUERY);\n\nexport const useCosCollectionQuery = (id: string) =>\n useQuery<CosCollectionQueryData, { id: string }>(COS_COLLECTION_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosSchemaFieldsQuery = (datasetId: string) =>\n useQuery<CosSchemaFieldsQueryData, { datasetId: string }>(COS_SCHEMA_FIELDS_QUERY, {\n variables: { datasetId },\n skip: !datasetId,\n });\n\nexport const useCosPipelinesQuery = (variables: CosPipelinesQueryVars = {}) =>\n useQuery<CosPipelinesQueryData, CosPipelinesQueryVars>(COS_PIPELINES_QUERY, { variables });\n\nexport const useCosPipelineQuery = (id: string) =>\n useQuery<CosPipelineQueryData, { id: string }>(COS_PIPELINE_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosRunsQuery = (variables: CosRunsQueryVars = {}) =>\n useQuery<CosRunsQueryData, CosRunsQueryVars>(COS_RUNS_QUERY, { variables });\n\nexport const useCosRunQuery = (id: string) =>\n useQuery<CosRunQueryData, { id: string }>(COS_RUN_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosRunStepsQuery = (runId: string) =>\n useQuery<CosRunStepsQueryData, { runId: string }>(COS_RUN_STEPS_QUERY, {\n variables: { runId },\n skip: !runId,\n });\n\n/**\n * Failed runs of one pipeline. Skipped until a pipelineId is known so the run\n * detail page can call it unconditionally while its own query is still loading.\n */\nexport const useCosPipelineFailedRunsQuery = (\n pipelineId: string | undefined,\n options: { limit?: number; skip?: boolean } = {}\n) =>\n useQuery<CosPipelineFailedRunsQueryData, CosPipelineFailedRunsQueryVars>(\n COS_PIPELINE_FAILED_RUNS_QUERY,\n {\n variables: {\n pipelineId: pipelineId ?? '',\n pagination: { limit: options.limit ?? 20, offset: 0 },\n },\n skip: !pipelineId || options.skip === true,\n }\n );\n\n/** Resolves a dataset id to its name. Returns null data when unreadable. */\nexport const useCosDatasetSummaryQuery = (id: string | null | undefined) =>\n useQuery<CosDatasetSummaryQueryData, { id: string }>(COS_DATASET_SUMMARY_QUERY, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n\nexport const useCosNotebooksQuery = (variables: CosNotebooksQueryVars = {}) =>\n useQuery<CosNotebooksQueryData, CosNotebooksQueryVars>(COS_NOTEBOOKS_QUERY, { variables });\n\nexport const useCosNotebookQuery = (id: string) =>\n useQuery<CosNotebookQueryData, { id: string }>(COS_NOTEBOOK_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosAnalysesQuery = (variables: CosAnalysesQueryVars = {}) =>\n useQuery<CosAnalysesQueryData, CosAnalysesQueryVars>(COS_ANALYSES_QUERY, { variables });\n\nexport const useCosReleasesQuery = (variables: CosReleasesQueryVars = {}) =>\n useQuery<CosReleasesQueryData, CosReleasesQueryVars>(COS_RELEASES_QUERY, { variables });\n\n/** One analysis by id; skipped while `id` is empty or `skip` is set. */\nexport const useCosAnalysisQuery = (\n id: string | null | undefined,\n options: { skip?: boolean } = {}\n) =>\n useQuery<CosAnalysisQueryData, { id: string }>(COS_ANALYSIS_QUERY, {\n variables: { id: id ?? '' },\n skip: !id || options.skip === true,\n });\n\n/** One release by id; skipped while `id` is empty or `skip` is set. */\nexport const useCosReleaseQuery = (\n id: string | null | undefined,\n options: { skip?: boolean } = {}\n) =>\n useQuery<CosReleaseQueryData, { id: string }>(COS_RELEASE_QUERY, {\n variables: { id: id ?? '' },\n skip: !id || options.skip === true,\n });\n\nexport const useCosAccessGrantsQuery = (variables: CosAccessGrantsQueryVars = {}) =>\n useQuery<CosAccessGrantsQueryData, CosAccessGrantsQueryVars>(COS_ACCESS_GRANTS_QUERY, {\n variables,\n });\n\n/**\n * Resource-scoped platform activity for a single cos entity. RBAC on\n * `getActivities` scopes on `filter.workspaceId`, so both a workspaceId and the\n * entity's resourceId are required — the query is skipped until both are known.\n */\nexport const useCosResourceActivityQuery = (params: {\n workspaceId?: string;\n resourceId: string;\n resourceType?: string;\n limit?: number;\n}) => {\n const { workspaceId, resourceId, resourceType, limit = 20 } = params;\n return useQuery<CosActivityQueryData, CosActivityQueryVars>(COS_ACTIVITY_BY_RESOURCE_QUERY, {\n variables: { filter: { workspaceId, resourceId, resourceType, limit } },\n skip: !workspaceId || !resourceId,\n fetchPolicy: 'cache-and-network',\n });\n};\n\n// ============================================================================\n// MUTATION HOOKS\n// ============================================================================\n\nexport const useCosCreateDatasetMutation = () =>\n useMutation<{ cosCreateDataset: CosDataset }, { input: CosCreateDatasetInput }>(\n COS_CREATE_DATASET_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n }\n );\n\nexport const useCosUpdateDatasetMutation = () =>\n useMutation<{ cosUpdateDataset: CosDataset }, { id: string; input: CosUpdateDatasetInput }>(\n COS_UPDATE_DATASET_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n }\n );\n\nexport const useCosPublishDatasetMutation = () =>\n useMutation<{ cosPublishDataset: CosDataset }, { id: string }>(COS_PUBLISH_DATASET_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n });\n\nexport const useCosArchiveDatasetMutation = () =>\n useMutation<{ cosArchiveDataset: boolean }, { id: string }>(COS_ARCHIVE_DATASET_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n });\n\nexport const useCosAddSchemaFieldMutation = () =>\n useMutation<{ cosAddSchemaField: CosSchemaField }, { input: CosAddSchemaFieldInput }>(\n COS_ADD_SCHEMA_FIELD_MUTATION,\n { errorPolicy: 'all', onError: onMutationError }\n );\n\nexport const useCosCreateSourceMutation = () =>\n useMutation<{ cosCreateSource: CosSource }, { input: CosCreateSourceInput }>(\n COS_CREATE_SOURCE_MUTATION,\n { errorPolicy: 'all', onError: onMutationError, refetchQueries: [{ query: COS_SOURCES_QUERY }] }\n );\n\nexport const useCosUpdateSourceMutation = () =>\n useMutation<{ cosUpdateSource: CosSource }, { id: string; input: CosUpdateSourceInput }>(\n COS_UPDATE_SOURCE_MUTATION,\n { errorPolicy: 'all', onError: onMutationError, refetchQueries: [{ query: COS_SOURCES_QUERY }] }\n );\n\nexport const useCosMarkSourceSyncedMutation = () =>\n useMutation<{ cosMarkSourceSynced: CosSource }, { id: string }>(COS_MARK_SOURCE_SYNCED_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_SOURCES_QUERY }],\n });\n\nexport const useCosArchiveSourceMutation = () =>\n useMutation<{ cosArchiveSource: boolean }, { id: string }>(COS_ARCHIVE_SOURCE_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_SOURCES_QUERY }],\n });\n\nexport const useCosCreateCollectionMutation = () =>\n useMutation<{ cosCreateCollection: CosCollection }, { input: CosCreateCollectionInput }>(\n COS_CREATE_COLLECTION_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_COLLECTIONS_QUERY }],\n }\n );\n\nexport const useCosUpdateCollectionMutation = () =>\n useMutation<\n { cosUpdateCollection: CosCollection },\n { id: string; input: CosUpdateCollectionInput }\n >(COS_UPDATE_COLLECTION_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_COLLECTIONS_QUERY }],\n });\n\nexport const useCosArchiveCollectionMutation = () =>\n useMutation<{ cosArchiveCollection: boolean }, { id: string }>(COS_ARCHIVE_COLLECTION_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_COLLECTIONS_QUERY }],\n });\n\nexport const useCosCreatePipelineMutation = () =>\n useMutation<{ cosCreatePipeline: CosPipeline }, { input: CosCreatePipelineInput }>(\n COS_CREATE_PIPELINE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_PIPELINES_QUERY }],\n }\n );\n\nexport const useCosUpdatePipelineMutation = () =>\n useMutation<{ cosUpdatePipeline: CosPipeline }, { id: string; input: CosUpdatePipelineInput }>(\n COS_UPDATE_PIPELINE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_PIPELINES_QUERY }],\n }\n );\n\nexport const useCosArchivePipelineMutation = () =>\n useMutation<{ cosArchivePipeline: boolean }, { id: string }>(COS_ARCHIVE_PIPELINE_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_PIPELINES_QUERY }],\n });\n\nexport const useCosStartRunMutation = () =>\n useMutation<{ cosStartRun: CosPipelineRun }, { input: CosStartRunInput }>(\n COS_START_RUN_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_RUNS_QUERY }],\n }\n );\n\nexport const useCosTransitionRunMutation = () =>\n useMutation<{ cosTransitionRun: CosPipelineRun }, { id: string; status: CosRunStatus }>(\n COS_TRANSITION_RUN_MUTATION,\n { errorPolicy: 'all', onError: onMutationError, refetchQueries: [{ query: COS_RUNS_QUERY }] }\n );\n\nexport const useCosAddRunStepMutation = () =>\n useMutation<{ cosAddRunStep: CosPipelineStep }, { input: CosAddRunStepInput }>(\n COS_ADD_RUN_STEP_MUTATION,\n { errorPolicy: 'all', onError: onMutationError }\n );\n\nexport const useCosCreateNotebookMutation = () =>\n useMutation<{ cosCreateNotebook: CosNotebook }, { input: CosCreateNotebookInput }>(\n COS_CREATE_NOTEBOOK_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_NOTEBOOKS_QUERY }],\n }\n );\n\nexport const useCosUpdateNotebookMutation = () =>\n useMutation<{ cosUpdateNotebook: CosNotebook }, { id: string; input: CosUpdateNotebookInput }>(\n COS_UPDATE_NOTEBOOK_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_NOTEBOOKS_QUERY }],\n }\n );\n\nexport const useCosArchiveNotebookMutation = () =>\n useMutation<{ cosArchiveNotebook: boolean }, { id: string }>(COS_ARCHIVE_NOTEBOOK_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_NOTEBOOKS_QUERY }],\n });\n\nexport const useCosRunAnalysisMutation = () =>\n useMutation<{ cosRunAnalysis: CosAnalysis }, { input: CosRunAnalysisInput }>(\n COS_RUN_ANALYSIS_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ANALYSES_QUERY }],\n }\n );\n\nexport const useCosCompleteAnalysisMutation = () =>\n useMutation<\n { cosCompleteAnalysis: CosAnalysis },\n {\n id: string;\n status: Extract<CosAnalysisStatus, 'COMPLETED' | 'FAILED'>;\n results?: Record<string, unknown>;\n outputFileId?: string;\n }\n >(COS_COMPLETE_ANALYSIS_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ANALYSES_QUERY }],\n });\n\nexport const useCosCreateReleaseMutation = () =>\n useMutation<{ cosCreateRelease: CosRelease }, { input: CosCreateReleaseInput }>(\n COS_CREATE_RELEASE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_RELEASES_QUERY }],\n }\n );\n\nexport const useCosPublishReleaseMutation = () =>\n useMutation<{ cosPublishRelease: CosRelease }, { id: string; doi?: string }>(\n COS_PUBLISH_RELEASE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_RELEASES_QUERY }],\n }\n );\n\nexport const useCosGrantAccessMutation = () =>\n useMutation<{ cosGrantAccess: CosDataAccessGrant }, { input: CosGrantAccessInput }>(\n COS_GRANT_ACCESS_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ACCESS_GRANTS_QUERY }],\n }\n );\n\nexport const useCosRevokeAccessMutation = () =>\n useMutation<{ cosRevokeAccess: CosDataAccessGrant }, { id: string }>(COS_REVOKE_ACCESS_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ACCESS_GRANTS_QUERY }],\n });\n"],"mappings":";;;;AAwBA,IAAM,KAAmB,MAA2B;CAClD,EAAO,MAAM,wBAAwB,EAAM,WAAW,mBAAmB;AAC3E;AAgdgC,CAAG;;;;;AAMnC,IAAa,IAAqB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CxB,IAAoB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDvB,IAAoB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BvB,IAAmB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;GAkCtB,IAAwB,CAAG;;;;;;;;;;;;;;;;;GAmB3B,IAAuB,CAAG;;;;;;;;;;;;;;;AAgBA,CAAG;;;;;;;;;;;;;;;;;;AAmB1C,IAAa,IAAsB,CAAG;;;;;;;;;;;;;;;;;;;;;;;GAyBzB,IAAqB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BxB,IAAiB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;GA0BpB,IAAgB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CnB,IAAiC,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCpC,IAA4B,CAAG;;;;;;;;;GAW/B,IAAsB,CAAG;;;;;;;;;;;;;;;;;;;;;GAuBzB,IAAsB,CAAG;;;;;;;;;;;;;;;;;;;;;;;GAyBzB,IAAqB,CAAG;;;;;;;;;;;;;;;;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AgB,CAAC,EAAE,OAAO,EAAoB,CAAC;AACjD,CACF,GAEW,WACX,EACE,GACA;CACE,aAAa;CACb,SAAS;CACT,gBAAgB,CAAC,EAAE,OAAO,EAAoB,CAAC;AACjD,CACF,GAEW,WACX,EAA6D,GAA+B;CAC1F,aAAa;CACb,SAAS;CACT,gBAAgB,CAAC,EAAE,OAAO,EAAoB,CAAC;AACjD,CAAC,GAEU,WACX,EACE,GACA;CACE,aAAa;CACb,SAAS;CACT,gBAAgB,CAAC,EAAE,OAAO,EAAmB,CAAC;AAChD,CACF,GAEW,WACX,EAQE,GAAgC;CAChC,aAAa;CACb,SAAS;CACT,gBAAgB,CAAC,EAAE,OAAO,EAAmB,CAAC;AAChD,CAAC,GAEU,WACX,EACE,GACA;CACE,aAAa;CACb,SAAS;CACT,gBAAgB,CAAC,EAAE,OAAO,EAAmB,CAAC;AAChD,CACF,GAEW,WACX,EACE,GACA;CACE,aAAa;CACb,SAAS;CACT,gBAAgB,CAAC,EAAE,OAAO,EAAmB,CAAC;AAChD,CACF,GAEW,WACX,EACE,GACA;CACE,aAAa;CACb,SAAS;CACT,gBAAgB,CAAC,EAAE,OAAO,EAAwB,CAAC;AACrD,CACF,GAEW,WACX,EAAqE,GAA4B;CAC/F,aAAa;CACb,SAAS;CACT,gBAAgB,CAAC,EAAE,OAAO,EAAwB,CAAC;AACrD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScienceCanvas.d.ts","sourceRoot":"","sources":["../../../src/cosmicintersection/components/ScienceCanvas.tsx"],"names":[],"mappings":"AA2CA,OAAO,EAmBL,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,UAAU,EAGhB,MAAM,sBAAsB,CAAC;AAgL9B,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,+BAiM1D;AAeD,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,+BA6RtD;AASD,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,+BAiQ1D;AA8BD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAmBD,wBAAgB,aAAa,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,kBAAkB,+
|
|
1
|
+
{"version":3,"file":"ScienceCanvas.d.ts","sourceRoot":"","sources":["../../../src/cosmicintersection/components/ScienceCanvas.tsx"],"names":[],"mappings":"AA2CA,OAAO,EAmBL,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,UAAU,EAGhB,MAAM,sBAAsB,CAAC;AAgL9B,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,+BAiM1D;AAeD,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,+BA6RtD;AASD,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,+BAiQ1D;AA8BD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAmBD,wBAAgB,aAAa,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,kBAAkB,+BAuDvE;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -774,10 +774,17 @@ function le({ results: r, className: i }) {
|
|
|
774
774
|
className: t("space-y-3", i),
|
|
775
775
|
"data-testid": "science-canvas",
|
|
776
776
|
children: [/* @__PURE__ */ C(O, {
|
|
777
|
-
className: "flex h-auto
|
|
777
|
+
className: "flex h-auto w-full max-w-full justify-start overflow-x-auto",
|
|
778
|
+
"data-testid": "science-canvas-tabs",
|
|
778
779
|
children: s.map((e, t) => /* @__PURE__ */ C(k, {
|
|
779
780
|
value: `view-${t}`,
|
|
780
|
-
|
|
781
|
+
title: e,
|
|
782
|
+
"aria-label": e,
|
|
783
|
+
className: "min-w-0 max-w-[14rem] flex-none",
|
|
784
|
+
children: /* @__PURE__ */ C("span", {
|
|
785
|
+
className: "truncate",
|
|
786
|
+
children: e
|
|
787
|
+
})
|
|
781
788
|
}, `tab-${t}`))
|
|
782
789
|
}), o.map((e, t) => /* @__PURE__ */ C(D, {
|
|
783
790
|
value: `view-${t}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScienceCanvas.js","names":[],"sources":["../../../src/cosmicintersection/components/ScienceCanvas.tsx"],"sourcesContent":["/**\n * ScienceCanvas — the analyses results canvas (BOFF-3984, mock cosmic-17).\n *\n * Renders the canonical scientific views an analysis can record in\n * `results.visualization` / `results.visualizations` (see\n * `lib/visualization.ts`):\n *\n * - sky map all-sky Mollweide / Aitoff / equirectangular projection with a\n * graticule, east-left convention and value-scaled sources\n * - spectrum wavelength vs flux with error bars, step/line/scatter series and\n * labelled spectral-line markers\n * - light curve time vs flux or magnitude (magnitude axis inverted)\n * - 3-D scene orthographic point cloud / orbit paths, rotatable by pointer\n * drag or the arrow keys\n *\n * Several views are offered as tabs. Payloads without canonical views fall\n * back to the generic numeric-series <ResultsChart>, so legacy analyses render\n * exactly as before.\n *\n * Long series are thinned for rendering only: plots keep every bucket's\n * extremes (`decimateSeries`) and their axes span the full data, and each view\n * says when it shows fewer points than it holds. Every view also offers its\n * values as a data table, and tapping a marker shows its details in a readout,\n * so the data is available without hover tooltips (touch, assistive tech).\n *\n * Everything is hand-drawn SVG with the design system's dataviz tokens\n * (`var(--color-chart-*)`) and text tokens — no raw colours, no chart library.\n * Every SVG uses a viewBox at 100% width, so the canvas scales on phones.\n */\nimport {\n useCallback,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent,\n type MouseEvent,\n type PointerEvent,\n type ReactNode,\n} from 'react';\n\nimport { Button, Tabs, TabsContent, TabsList, TabsTrigger } from '@burdenoff/fe-libs/ui';\n\nimport { useTr } from '../../shared/hooks/useTr';\nimport {\n DEFAULT_CAMERA,\n SKY_PROJECTIONS,\n clampPitch,\n decimateSeries,\n downsample,\n extractVisualizations,\n formatTick,\n formatValue,\n nearestPoint,\n niceTicks,\n tickStep,\n projectPoint,\n projectSky,\n sceneNormalizer,\n tabLabels,\n viewKindLabel,\n type Camera,\n type Point2D,\n type PlotView,\n type Scene3DView,\n type SkyMapView,\n type SkyProjection,\n type VisualizationView,\n} from '../lib/visualization';\nimport { cn } from '../utils/cn';\nimport { ResultsChart } from './ResultsChart';\n\nconst PALETTE = [1, 2, 3, 4, 5, 6].map((n) => `var(--color-chart-${n})`);\nconst MAX_RENDERED_POINTS = 2_000;\n/** Rows listed in a view's data table; the summary states the full count. */\nconst MAX_TABLE_ROWS = 50;\n\n/** Translation keys live under this prefix; English is the built-in fallback. */\nconst K = 'cosmicintersection.scienceCanvas';\n\ntype Tr = ReturnType<typeof useTr>;\n\nconst PROJECTION_LABEL: Record<SkyProjection, string> = {\n mollweide: 'Mollweide',\n aitoff: 'Aitoff',\n equirectangular: 'Equirectangular',\n};\n\nfunction projectionLabel(tr: Tr, projection: SkyProjection): string {\n return tr(`${K}.projection.${projection}`, PROJECTION_LABEL[projection]);\n}\n\nfunction kindLabel(tr: Tr, kind: VisualizationView['kind']): string {\n return tr(`${K}.kind.${kind}`, viewKindLabel(kind));\n}\n\nconst FRAME_LABEL: Record<SkyMapView['frame'], [string, string]> = {\n icrs: ['RA', 'Dec'],\n galactic: ['l', 'b'],\n ecliptic: ['λ', 'β'],\n};\n\nfunction Frame({ children }: { children: ReactNode }) {\n return (\n <div className=\"rounded-card border border-border-default bg-bg-sunken p-3\">{children}</div>\n );\n}\n\nfunction Legend({ items }: { items: Array<{ name: string; color: string; hint?: string }> }) {\n const tr = useTr();\n if (items.length < 2) return null;\n return (\n <ul className=\"flex flex-wrap gap-x-4 gap-y-1.5\" aria-label={tr(`${K}.legend`, 'Legend')}>\n {/* Names come from the payload and may repeat, so the index keeps keys unique. */}\n {items.map((item, i) => (\n <li\n key={`${i}-${item.name}`}\n className=\"flex items-center gap-1.5 text-xs text-text-secondary\"\n >\n <span\n aria-hidden=\"true\"\n className=\"inline-block size-2.5 rounded-full\"\n style={{ backgroundColor: item.color }}\n />\n <span className=\"truncate\">\n {item.name}\n {item.hint ? <span className=\"ml-1 text-text-tertiary\">({item.hint})</span> : null}\n </span>\n </li>\n ))}\n </ul>\n );\n}\n\n/** States that a view renders fewer elements than the payload holds. */\nfunction ThinningNote({\n shown,\n total,\n extremaKept,\n}: {\n shown: number;\n total: number;\n extremaKept?: boolean;\n}) {\n const tr = useTr();\n if (shown >= total) return null;\n const params = { shown: shown.toLocaleString(), total: total.toLocaleString() };\n return (\n <p className=\"text-xs text-text-tertiary\" data-testid=\"thinning-note\">\n {extremaKept\n ? tr(\n `${K}.thinnedExtrema`,\n 'Showing {{shown}} of {{total}} points; each segment keeps its highest and lowest values.',\n params\n )\n : tr(`${K}.thinned`, 'Showing {{shown}} of {{total}} items.', params)}\n </p>\n );\n}\n\n/** Announces the marker the viewer tapped or clicked (touch has no hover). */\nfunction Readout({ text }: { text: string | null }) {\n const tr = useTr();\n return (\n <p\n className=\"min-h-4 text-xs text-text-secondary\"\n aria-live=\"polite\"\n data-testid=\"canvas-readout\"\n >\n {text ?? tr(`${K}.readoutHint`, 'Tap or click a marker to see its values.')}\n </p>\n );\n}\n\n/** The view's values as a table: the text alternative to the drawing. */\nfunction DataTable({\n columns,\n rows,\n total,\n}: {\n columns: string[];\n rows: string[][];\n total: number;\n}) {\n const tr = useTr();\n if (total === 0) return null;\n return (\n <details className=\"text-xs text-text-secondary\" data-testid=\"data-table\">\n <summary className=\"cursor-pointer select-none\">\n {total > rows.length\n ? tr(`${K}.dataTablePartial`, 'Data table (first {{shown}} of {{total}} rows)', {\n shown: rows.length.toLocaleString(),\n total: total.toLocaleString(),\n })\n : tr(`${K}.dataTable`, 'Data table ({{total}} rows)', { total: total.toLocaleString() })}\n </summary>\n <div className=\"mt-2 max-h-64 overflow-auto rounded-card border border-border-default\">\n <table className=\"w-full text-left\">\n <thead className=\"bg-bg-elevated text-text-primary\">\n <tr>\n {columns.map((c, i) => (\n <th key={`h-${i}`} scope=\"col\" className=\"px-2 py-1 font-medium\">\n {c}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, r) => (\n <tr key={`r-${r}`} className=\"border-t border-border-default\">\n {row.map((cell, c) => (\n <td key={`c-${c}`} className=\"px-2 py-1 tabular-nums\">\n {cell}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </details>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Sky map\n// ---------------------------------------------------------------------------\n\nconst SKY_W = 640;\nconst SKY_H = 340;\nconst SKY_PAD = 14;\n\nfunction skyToSvg(lon: number, lat: number, projection: SkyProjection) {\n const { x, y } = projectSky(lon, lat, projection);\n const halfW = SKY_W / 2 - SKY_PAD;\n return { x: SKY_W / 2 + x * halfW, y: SKY_H / 2 - y * halfW };\n}\n\nfunction polyline(points: Array<{ x: number; y: number }>): string {\n return points\n .map((p, i) => `${i === 0 ? 'M' : 'L'} ${p.x.toFixed(2)} ${p.y.toFixed(2)}`)\n .join(' ');\n}\n\nexport function SkyMapCanvas({ view }: { view: SkyMapView }) {\n const tr = useTr();\n const [projection, setProjection] = useState<SkyProjection>(view.projection);\n const [selected, setSelected] = useState<number | null>(null);\n const [lonName, latName] = FRAME_LABEL[view.frame];\n const valueLabel = view.valueLabel ?? tr(`${K}.value`, 'value');\n\n const describe = (s: SkyMapView['sources'][number]) =>\n [\n s.label,\n `${lonName} ${s.ra.toFixed(3)}°`,\n `${latName} ${s.dec >= 0 ? '+' : ''}${s.dec.toFixed(3)}°`,\n s.value !== undefined ? `${valueLabel} ${formatValue(s.value)}` : null,\n ]\n .filter(Boolean)\n .join(' · ');\n\n const geometry = useMemo(() => {\n // The outline runs along lon 359.999° and 0.001° rather than 360° / 0°:\n // both ends of the seam project to the same x at exactly 0° / 360°, so the\n // epsilon keeps the left and right limbs of the ellipse apart.\n const outline: Array<{ x: number; y: number }> = [];\n for (let lat = -90; lat <= 90; lat += 2) outline.push(skyToSvg(359.999, lat, projection));\n for (let lat = 90; lat >= -90; lat -= 2) outline.push(skyToSvg(0.001, lat, projection));\n const meridians = [60, 120, 180, 240, 300].map((lon) => {\n const pts: Array<{ x: number; y: number }> = [];\n for (let lat = -90; lat <= 90; lat += 3) pts.push(skyToSvg(lon, lat, projection));\n return { lon, d: polyline(pts), label: skyToSvg(lon, 0, projection) };\n });\n const parallels = [-60, -30, 0, 30, 60].map((lat) => {\n const pts: Array<{ x: number; y: number }> = [];\n for (let lon = 0.001; lon <= 359.999; lon += 3) pts.push(skyToSvg(lon, lat, projection));\n pts.push(skyToSvg(359.999, lat, projection));\n return { lat, d: polyline(pts), label: skyToSvg(359.999, lat, projection) };\n });\n const values = view.sources.map((s) => s.value).filter((v): v is number => v !== undefined);\n // A single pass instead of Math.min(...values): spreading up to 20,000\n // arguments can exceed the argument limit of some engines and WebViews.\n let vMin = values.length ? Infinity : 0;\n let vMax = values.length ? -Infinity : 0;\n for (const v of values) {\n vMin = Math.min(vMin, v);\n vMax = Math.max(vMax, v);\n }\n const scale = (value: number | undefined) =>\n value === undefined || vMax === vMin ? 0.5 : (value - vMin) / (vMax - vMin);\n const sources = downsample(view.sources, MAX_RENDERED_POINTS).map((s) => ({\n ...s,\n ...skyToSvg(s.ra, s.dec, projection),\n t: scale(s.value),\n }));\n return {\n outline: `${polyline(outline)} Z`,\n meridians,\n parallels,\n sources,\n vMin,\n vMax,\n hasValues: values.length > 0,\n };\n }, [projection, view.sources]);\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <p className=\"text-xs text-text-secondary\">\n {view.sources.length === 1\n ? tr(`${K}.skySummaryOne`, '1 source · {{frame}} frame', {\n frame: view.frame.toUpperCase(),\n })\n : tr(`${K}.skySummary`, '{{count}} sources · {{frame}} frame', {\n count: view.sources.length.toLocaleString(),\n frame: view.frame.toUpperCase(),\n })}\n </p>\n <div\n role=\"group\"\n aria-label={tr(`${K}.projectionGroup`, 'Projection')}\n className=\"flex flex-wrap gap-1\"\n >\n {SKY_PROJECTIONS.map((p) => (\n <Button\n key={p}\n type=\"button\"\n size=\"sm\"\n variant={p === projection ? 'default' : 'outline'}\n aria-pressed={p === projection}\n onClick={() => setProjection(p)}\n >\n {projectionLabel(tr, p)}\n </Button>\n ))}\n </div>\n </div>\n <Frame>\n <svg\n viewBox={`0 0 ${SKY_W} ${SKY_H}`}\n className=\"h-auto w-full\"\n role=\"img\"\n aria-label={tr(`${K}.skyAria`, 'Sky map, {{projection}} projection, {{count}} sources', {\n projection: projectionLabel(tr, projection),\n count: view.sources.length,\n })}\n data-projection={projection}\n >\n <path\n d={geometry.outline}\n fill=\"var(--color-bg-elevated)\"\n stroke=\"var(--color-chart-axis)\"\n />\n {geometry.parallels.map((g) => (\n <g key={`lat-${g.lat}`}>\n <path d={g.d} fill=\"none\" stroke=\"var(--color-chart-grid)\" strokeDasharray=\"2 4\" />\n <text\n x={g.label.x + 4}\n y={g.label.y}\n fontSize={10}\n dominantBaseline=\"central\"\n fill=\"var(--color-text-tertiary)\"\n >\n {g.lat > 0 ? `+${g.lat}°` : `${g.lat}°`}\n </text>\n </g>\n ))}\n {geometry.meridians.map((g) => (\n <g key={`lon-${g.lon}`}>\n <path d={g.d} fill=\"none\" stroke=\"var(--color-chart-grid)\" strokeDasharray=\"2 4\" />\n <text\n x={g.label.x}\n y={g.label.y + 12}\n fontSize={10}\n textAnchor=\"middle\"\n fill=\"var(--color-text-tertiary)\"\n >\n {view.frame === 'icrs' ? `${g.lon / 15}h` : `${g.lon}°`}\n </text>\n </g>\n ))}\n {geometry.sources.map((s, i) => (\n <circle\n key={`src-${i}`}\n cx={s.x}\n cy={s.y}\n r={2 + s.t * 4}\n fill=\"var(--color-chart-1)\"\n fillOpacity={0.45 + s.t * 0.5}\n stroke=\"var(--color-chart-1)\"\n strokeWidth={selected === i ? 2 : 0.6}\n className=\"cursor-pointer\"\n data-testid=\"sky-source\"\n onClick={() => setSelected(i)}\n >\n <title>{describe(s)}</title>\n </circle>\n ))}\n </svg>\n </Frame>\n <Readout\n text={\n selected !== null && geometry.sources[selected]\n ? describe(geometry.sources[selected])\n : null\n }\n />\n {geometry.hasValues ? (\n <p className=\"text-xs text-text-tertiary\">\n {tr(\n `${K}.skyScale`,\n 'Marker size and opacity scale with {{label}} ({{min}} – {{max}}).',\n { label: valueLabel, min: formatTick(geometry.vMin), max: formatTick(geometry.vMax) }\n )}\n </p>\n ) : null}\n <ThinningNote shown={geometry.sources.length} total={view.sources.length} />\n <DataTable\n columns={[\n tr(`${K}.colLabel`, 'Label'),\n lonName,\n latName,\n ...(geometry.hasValues ? [valueLabel] : []),\n ]}\n rows={view.sources\n .slice(0, MAX_TABLE_ROWS)\n .map((s) => [\n s.label ?? '',\n `${s.ra.toFixed(3)}°`,\n `${s.dec.toFixed(3)}°`,\n ...(geometry.hasValues ? [s.value !== undefined ? formatValue(s.value) : ''] : []),\n ])}\n total={view.sources.length}\n />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Spectrum / light curve\n// ---------------------------------------------------------------------------\n\nconst PLOT_W = 640;\nconst PLOT_H = 340;\nconst M = { top: 22, right: 20, bottom: 48, left: 62 };\nconst IW = PLOT_W - M.left - M.right;\nconst IH = PLOT_H - M.top - M.bottom;\n\n/** Hit radius for a tap on a plot, in viewBox units (about a fingertip). */\nconst PLOT_HIT_RADIUS = 14;\n\nexport function PlotCanvas({ view }: { view: PlotView }) {\n const tr = useTr();\n const [selected, setSelected] = useState<{ series: number; point: number } | null>(null);\n const model = useMemo(() => {\n const sorted = view.series.map((s) => [...s.points].sort((a, b) => a.x - b.x));\n const series = view.series.map((s, i) => ({\n ...s,\n color: PALETTE[i % PALETTE.length],\n points: decimateSeries(sorted[i], MAX_RENDERED_POINTS),\n }));\n // The domain comes from the full data, so thinning never clips the axes.\n let minX = Infinity;\n let maxX = -Infinity;\n let minY = Infinity;\n let maxY = -Infinity;\n for (const points of sorted) {\n for (const p of points) {\n const err = p.err ?? 0;\n minX = Math.min(minX, p.x);\n maxX = Math.max(maxX, p.x);\n minY = Math.min(minY, p.y - err);\n maxY = Math.max(maxY, p.y + err);\n }\n }\n if (minX === maxX) {\n minX -= 1;\n maxX += 1;\n }\n if (minY === maxY) {\n minY -= 1;\n maxY += 1;\n }\n const pad = (maxY - minY) * 0.08;\n minY -= pad;\n maxY += pad;\n const lines = view.lines.filter((l) => l.x >= minX && l.x <= maxX);\n const xTicks = niceTicks(minX, maxX, 5);\n const yTicks = niceTicks(minY, maxY, 5);\n let shown = 0;\n let total = 0;\n for (let i = 0; i < series.length; i += 1) {\n shown += series[i].points.length;\n total += sorted[i].length;\n }\n return {\n series,\n shown,\n total,\n lines,\n domainX: [minX, maxX] as const,\n domainY: [minY, maxY] as const,\n xTicks,\n yTicks,\n xStep: tickStep(xTicks),\n yStep: tickStep(yTicks),\n };\n }, [view]);\n\n const { domainX, domainY } = model;\n const sx = (x: number) => M.left + ((x - domainX[0]) / (domainX[1] - domainX[0])) * IW;\n const yFrac = (y: number) => (y - domainY[0]) / (domainY[1] - domainY[0]);\n // Magnitudes: smaller is brighter, so brighter plots higher (axis inverted).\n const sy = (y: number) => (view.invertY ? M.top + yFrac(y) * IH : M.top + IH - yFrac(y) * IH);\n\n const onPlotClick = (e: MouseEvent<SVGSVGElement>) => {\n const rect = e.currentTarget.getBoundingClientRect();\n if (rect.width === 0 || rect.height === 0) return;\n const x = ((e.clientX - rect.left) / rect.width) * PLOT_W;\n const y = ((e.clientY - rect.top) / rect.height) * PLOT_H;\n const targets = model.series.flatMap((s, si) =>\n s.points.map((p, pi) => ({ x: sx(p.x), y: sy(p.y), series: si, point: pi }))\n );\n const hit = nearestPoint(targets, x, y, PLOT_HIT_RADIUS);\n setSelected(hit >= 0 ? { series: targets[hit].series, point: targets[hit].point } : null);\n };\n\n const selectedSeries = selected ? model.series[selected.series] : undefined;\n const selectedPoint = selected ? selectedSeries?.points[selected.point] : undefined;\n const readout =\n selectedSeries && selectedPoint\n ? [\n selectedSeries.name,\n `${view.xLabel} ${formatValue(selectedPoint.x)}`,\n `${view.yLabel} ${formatValue(selectedPoint.y)}${\n selectedPoint.err !== undefined ? ` ± ${formatValue(selectedPoint.err)}` : ''\n }`,\n ].join(' · ')\n : null;\n\n const pathFor = (points: Point2D[], step: boolean) => {\n if (!step) return polyline(points.map((p) => ({ x: sx(p.x), y: sy(p.y) })));\n const out: Array<{ x: number; y: number }> = [];\n points.forEach((p, i) => {\n if (i > 0) out.push({ x: sx(p.x), y: sy(points[i - 1].y) });\n out.push({ x: sx(p.x), y: sy(p.y) });\n });\n return polyline(out);\n };\n\n return (\n <div className=\"space-y-3\">\n <Frame>\n <svg\n viewBox={`0 0 ${PLOT_W} ${PLOT_H}`}\n role=\"img\"\n aria-label={tr(\n view.invertY ? `${K}.plotAriaInverted` : `${K}.plotAria`,\n view.invertY\n ? '{{kind}}: {{series}}; x-axis {{x}}, y-axis {{y}} (inverted)'\n : '{{kind}}: {{series}}; x-axis {{x}}, y-axis {{y}}',\n {\n kind: kindLabel(tr, view.kind),\n series: model.series.map((s) => s.name).join(', '),\n x: view.xLabel,\n y: view.yLabel,\n }\n )}\n data-inverted={view.invertY ? 'true' : 'false'}\n className=\"h-auto w-full cursor-crosshair\"\n onClick={onPlotClick}\n >\n {model.yTicks.map((t) => (\n <g key={`y-${t}`}>\n <line\n x1={M.left}\n x2={M.left + IW}\n y1={sy(t)}\n y2={sy(t)}\n stroke=\"var(--color-chart-grid)\"\n />\n <text\n x={M.left - 8}\n y={sy(t)}\n textAnchor=\"end\"\n dominantBaseline=\"central\"\n fontSize={11}\n fill=\"var(--color-text-tertiary)\"\n >\n {formatTick(t, model.yStep)}\n </text>\n </g>\n ))}\n {model.xTicks.map((t) => (\n <g key={`x-${t}`}>\n <line\n x1={sx(t)}\n x2={sx(t)}\n y1={M.top}\n y2={M.top + IH}\n stroke=\"var(--color-chart-grid)\"\n strokeDasharray=\"2 4\"\n />\n <text\n x={sx(t)}\n y={M.top + IH + 18}\n textAnchor=\"middle\"\n fontSize={11}\n fill=\"var(--color-text-tertiary)\"\n >\n {formatTick(t, model.xStep)}\n </text>\n </g>\n ))}\n <rect\n x={M.left}\n y={M.top}\n width={IW}\n height={IH}\n fill=\"none\"\n stroke=\"var(--color-chart-axis)\"\n />\n\n {model.lines.map((l, i) => (\n <g key={`line-${i}`} data-testid=\"spectral-line\">\n <line\n x1={sx(l.x)}\n x2={sx(l.x)}\n y1={M.top}\n y2={M.top + IH}\n stroke=\"var(--color-chart-negative)\"\n strokeDasharray=\"4 3\"\n />\n {l.label ? (\n <text\n x={sx(l.x) + 3}\n y={M.top - 6}\n fontSize={10}\n fill=\"var(--color-text-secondary)\"\n >\n {l.label}\n </text>\n ) : null}\n </g>\n ))}\n\n {selectedSeries && selectedPoint ? (\n <circle\n cx={sx(selectedPoint.x)}\n cy={sy(selectedPoint.y)}\n r={5}\n fill=\"none\"\n stroke=\"var(--color-text-primary)\"\n strokeWidth={1.5}\n pointerEvents=\"none\"\n data-testid=\"plot-selection\"\n />\n ) : null}\n {model.series.map((s, si) => (\n <g key={`series-${si}`} data-testid=\"plot-series\" data-style={s.style}>\n {s.points.map((p, i) =>\n p.err ? (\n <line\n key={`err-${i}`}\n x1={sx(p.x)}\n x2={sx(p.x)}\n y1={sy(p.y - p.err)}\n y2={sy(p.y + p.err)}\n stroke={s.color}\n strokeOpacity={0.5}\n data-testid=\"error-bar\"\n />\n ) : null\n )}\n {s.style !== 'scatter' ? (\n <path\n d={pathFor(s.points, s.style === 'step')}\n fill=\"none\"\n stroke={s.color}\n strokeWidth={1.8}\n strokeLinejoin=\"round\"\n />\n ) : (\n s.points.map((p, i) => (\n <circle\n key={`pt-${i}`}\n cx={sx(p.x)}\n cy={sy(p.y)}\n r={2.4}\n fill={s.color}\n fillOpacity={0.85}\n />\n ))\n )}\n </g>\n ))}\n\n <text\n x={M.left + IW / 2}\n y={PLOT_H - 6}\n textAnchor=\"middle\"\n fontSize={12}\n fill=\"var(--color-text-secondary)\"\n >\n {view.xLabel}\n </text>\n <text\n x={14}\n y={M.top + IH / 2}\n textAnchor=\"middle\"\n fontSize={12}\n fill=\"var(--color-text-secondary)\"\n transform={`rotate(-90 14 ${M.top + IH / 2})`}\n >\n {view.yLabel}\n </text>\n </svg>\n </Frame>\n <Readout text={readout} />\n <Legend items={model.series.map((s) => ({ name: s.name, color: s.color, hint: s.style }))} />\n <ThinningNote shown={model.shown} total={model.total} extremaKept />\n <DataTable\n columns={[tr(`${K}.colSeries`, 'Series'), view.xLabel, view.yLabel, tr(`${K}.colErr`, '±')]}\n rows={view.series\n .flatMap((s) => s.points.map((p) => ({ name: s.name, p })))\n .slice(0, MAX_TABLE_ROWS)\n .map(({ name, p }) => [\n name,\n formatValue(p.x),\n formatValue(p.y),\n p.err !== undefined ? formatValue(p.err) : '',\n ])}\n total={model.total}\n />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// 3-D scene\n// ---------------------------------------------------------------------------\n\nconst SCENE_SIZE = 360;\nconst SCENE_SCALE = SCENE_SIZE * 0.32;\n\nexport function SceneCanvas({ view }: { view: Scene3DView }) {\n const tr = useTr();\n const [camera, setCamera] = useState<Camera>(DEFAULT_CAMERA);\n const [selected, setSelected] = useState<number | null>(null);\n const drag = useRef<{ x: number; y: number; camera: Camera } | null>(null);\n\n // Everything that does not depend on the camera is computed once per view,\n // so a drag only re-projects and re-sorts, never re-normalises or re-thins.\n const prepared = useMemo(() => {\n const normalize = sceneNormalizer([...view.points, ...view.paths.flatMap((p) => p.points)]);\n const points = downsample(view.points, MAX_RENDERED_POINTS).map((p) => ({\n label: p.label,\n value: p.value,\n data: { x: p.x, y: p.y, z: p.z },\n norm: normalize(p),\n }));\n const paths = view.paths.map((path, i) => ({\n name: path.name,\n // chart-1 is the point cloud, so paths cycle through chart-2..chart-6.\n color: PALETTE[1 + (i % (PALETTE.length - 1))],\n norm: downsample(path.points, MAX_RENDERED_POINTS).map((p) => normalize(p)),\n }));\n let pathPoints = 0;\n let renderedPathPoints = 0;\n for (let i = 0; i < view.paths.length; i += 1) {\n pathPoints += view.paths[i].points.length;\n renderedPathPoints += paths[i].norm.length;\n }\n return {\n points,\n paths,\n shown: points.length + renderedPathPoints,\n total: view.points.length + pathPoints,\n };\n }, [view]);\n\n const toScreen = useCallback(\n (p: { x: number; y: number; z: number }) => {\n const r = projectPoint(p, camera);\n return {\n x: SCENE_SIZE / 2 + r.x * SCENE_SCALE,\n y: SCENE_SIZE / 2 - r.y * SCENE_SCALE,\n depth: r.depth,\n };\n },\n [camera]\n );\n\n const projected = useMemo(() => {\n // Keep the data coordinates (for the tooltip) apart from the projected\n // SVG coordinates, which change as the camera rotates.\n const points = prepared.points\n .map((p, index) => ({\n index,\n label: p.label,\n value: p.value,\n data: p.data,\n ...toScreen(p.norm),\n }))\n .sort((a, b) => a.depth - b.depth);\n const paths = prepared.paths.map((path) => ({\n name: path.name,\n color: path.color,\n d: polyline(path.norm.map((p) => toScreen(p))),\n }));\n const axes = (['x', 'y', 'z'] as const).map((axis) => {\n const end = { x: 0, y: 0, z: 0, [axis]: 1.15 };\n return { axis, from: toScreen({ x: 0, y: 0, z: 0 }), to: toScreen(end) };\n });\n return { points, paths, axes };\n }, [prepared, toScreen]);\n\n const hasValues =\n view.points.some((p) => p.value !== undefined) ||\n view.paths.some((path) => path.points.some((p) => p.value !== undefined));\n const describe = (p: {\n label?: string;\n value?: number;\n data: { x: number; y: number; z: number };\n }) =>\n [\n p.label,\n `(${formatValue(p.data.x)}, ${formatValue(p.data.y)}, ${formatValue(p.data.z)})`,\n p.value !== undefined ? `· ${formatValue(p.value)}` : null,\n ]\n .filter(Boolean)\n .join(' ');\n\n // A drag that happens to end on a point must not also select it.\n const moved = useRef(false);\n const selectPoint = (index: number) => {\n if (moved.current) return;\n setSelected(index);\n };\n\n const onPointerDown = (e: PointerEvent<SVGSVGElement>) => {\n drag.current = { x: e.clientX, y: e.clientY, camera };\n moved.current = false;\n e.currentTarget.setPointerCapture?.(e.pointerId);\n };\n const endDrag = () => {\n drag.current = null;\n };\n const onPointerMove = (e: PointerEvent<SVGSVGElement>) => {\n const start = drag.current;\n if (!start) return;\n // Without pointer capture a mouse released outside the scene never sends\n // pointerup here; a move with no button pressed ends that stale drag.\n if (e.pointerType === 'mouse' && e.buttons === 0) {\n endDrag();\n return;\n }\n if (Math.hypot(e.clientX - start.x, e.clientY - start.y) > 3) moved.current = true;\n setCamera({\n yaw: start.camera.yaw + (e.clientX - start.x) * 0.5,\n pitch: clampPitch(start.camera.pitch + (e.clientY - start.y) * 0.5),\n });\n };\n const onKeyDown = (e: KeyboardEvent<SVGSVGElement>) => {\n const step = 10;\n const next: Partial<Record<string, Camera>> = {\n ArrowLeft: { ...camera, yaw: camera.yaw - step },\n ArrowRight: { ...camera, yaw: camera.yaw + step },\n ArrowUp: { ...camera, pitch: clampPitch(camera.pitch - step) },\n ArrowDown: { ...camera, pitch: clampPitch(camera.pitch + step) },\n };\n const target = next[e.key];\n if (target) {\n e.preventDefault();\n setCamera(target);\n }\n };\n\n const depthRange = projected.points.length\n ? [projected.points[0].depth, projected.points[projected.points.length - 1].depth]\n : [0, 0];\n const depthT = (d: number) =>\n depthRange[1] === depthRange[0] ? 1 : (d - depthRange[0]) / (depthRange[1] - depthRange[0]);\n\n const selectedPoint = selected !== null ? prepared.points[selected] : undefined;\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <p className=\"text-xs text-text-secondary\">\n {tr(\n `${K}.sceneHelp`,\n 'Drag or use the arrow keys to rotate · yaw {{yaw}}°, pitch {{pitch}}°',\n { yaw: Math.round(camera.yaw), pitch: Math.round(camera.pitch) }\n )}\n </p>\n <Button type=\"button\" size=\"sm\" variant=\"outline\" onClick={() => setCamera(DEFAULT_CAMERA)}>\n {tr(`${K}.resetView`, 'Reset view')}\n </Button>\n </div>\n <Frame>\n {/* An interactive widget, not a picture: role=\"img\" would hide the\n point and source titles from assistive technology. */}\n <svg\n viewBox={`0 0 ${SCENE_SIZE} ${SCENE_SIZE}`}\n className=\"mx-auto h-auto w-full max-w-md cursor-grab touch-none select-none focus:outline-none focus-visible:ring-2 focus-visible:ring-border-focus\"\n role=\"application\"\n aria-roledescription={tr(`${K}.sceneRole`, '3-D scene')}\n tabIndex={0}\n aria-label={tr(\n `${K}.sceneAria`,\n '3-D scene with {{points}} points and {{paths}} paths; drag or use arrow keys to rotate',\n { points: view.points.length, paths: view.paths.length }\n )}\n data-yaw={camera.yaw}\n data-pitch={camera.pitch}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={endDrag}\n onPointerCancel={endDrag}\n onKeyDown={onKeyDown}\n >\n {projected.axes.map((a) => (\n <g key={a.axis}>\n <line\n x1={a.from.x}\n y1={a.from.y}\n x2={a.to.x}\n y2={a.to.y}\n stroke=\"var(--color-chart-axis)\"\n />\n <text x={a.to.x} y={a.to.y} fontSize={10} fill=\"var(--color-text-tertiary)\" dy={-3}>\n {view.axes[a.axis]}\n </text>\n </g>\n ))}\n {projected.paths.map((p, i) => (\n <path\n key={`path-${i}`}\n d={p.d}\n fill=\"none\"\n stroke={p.color}\n strokeWidth={1.5}\n data-testid=\"scene-path\"\n />\n ))}\n {projected.points.map((p) => {\n const t = depthT(p.depth);\n return (\n <circle\n key={`p-${p.index}`}\n cx={p.x}\n cy={p.y}\n r={2 + t * 2}\n fill=\"var(--color-chart-1)\"\n fillOpacity={0.35 + t * 0.6}\n stroke={selected === p.index ? 'var(--color-text-primary)' : undefined}\n className=\"cursor-pointer\"\n data-testid=\"scene-point\"\n onClick={() => selectPoint(p.index)}\n >\n <title>{describe(p)}</title>\n </circle>\n );\n })}\n </svg>\n </Frame>\n <Readout text={selectedPoint ? describe(selectedPoint) : null} />\n <Legend\n items={projected.paths.map((p) => ({\n name: p.name,\n color: p.color,\n hint: tr(`${K}.pathHint`, 'path'),\n }))}\n />\n <ThinningNote shown={prepared.shown} total={prepared.total} />\n <DataTable\n columns={[\n tr(`${K}.colLabel`, 'Label'),\n view.axes.x,\n view.axes.y,\n view.axes.z,\n ...(hasValues ? [tr(`${K}.value`, 'value')] : []),\n ]}\n rows={[\n ...view.points.map((p) => ({ p, owner: p.label ?? '' })),\n ...view.paths.flatMap((path) =>\n path.points.map((p) => ({ p, owner: p.label ?? path.name }))\n ),\n ]\n .slice(0, MAX_TABLE_ROWS)\n .map(({ p, owner }) => [\n owner,\n formatValue(p.x),\n formatValue(p.y),\n formatValue(p.z),\n ...(hasValues ? [p.value !== undefined ? formatValue(p.value) : ''] : []),\n ])}\n total={prepared.total}\n />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Canvas\n// ---------------------------------------------------------------------------\n\nfunction ViewBody({ view }: { view: VisualizationView }) {\n return (\n <div className=\"space-y-2\">\n {view.title || view.description ? (\n <div>\n {view.title ? (\n <p className=\"text-sm font-medium text-text-primary\">{view.title}</p>\n ) : null}\n {view.description ? (\n <p className=\"text-xs text-text-secondary\">{view.description}</p>\n ) : null}\n </div>\n ) : null}\n {view.kind === 'skymap' ? (\n <SkyMapCanvas view={view} />\n ) : view.kind === 'scene3d' ? (\n <SceneCanvas view={view} />\n ) : (\n <PlotCanvas view={view} />\n )}\n </div>\n );\n}\n\nexport interface ScienceCanvasProps {\n results: Record<string, unknown>;\n className?: string;\n}\n\n/**\n * A stable number per results object. Views are keyed on it, so when the\n * dialog is reused for another analysis the selection, camera, projection and\n * active tab start fresh instead of pointing into the previous payload.\n */\nconst payloadGenerations = new WeakMap<object, number>();\nlet nextGeneration = 0;\nfunction payloadGeneration(results: object): number {\n let generation = payloadGenerations.get(results);\n if (generation === undefined) {\n nextGeneration += 1;\n generation = nextGeneration;\n payloadGenerations.set(results, generation);\n }\n return generation;\n}\n\nexport function ScienceCanvas({ results, className }: ScienceCanvasProps) {\n const tr = useTr();\n const views = useMemo(() => extractVisualizations(results), [results]);\n const labels = tabLabels(\n views.map((view) => view.title ?? kindLabel(tr, view.kind)),\n (label, n) => tr(`${K}.tabNumbered`, '{{label}} {{n}}', { label, n })\n );\n\n if (views.length === 0) {\n return <ResultsChart results={results} className={className} />;\n }\n\n if (views.length === 1) {\n return (\n <div className={cn('space-y-3', className)} data-testid=\"science-canvas\">\n <ViewBody key={payloadGeneration(results)} view={views[0]} />\n </div>\n );\n }\n\n return (\n <Tabs\n key={payloadGeneration(results)}\n defaultValue=\"view-0\"\n className={cn('space-y-3', className)}\n data-testid=\"science-canvas\"\n >\n <TabsList className=\"flex h-auto flex-wrap justify-start\">\n {labels.map((label, i) => (\n <TabsTrigger key={`tab-${i}`} value={`view-${i}`}>\n {label}\n </TabsTrigger>\n ))}\n </TabsList>\n {views.map((view, i) => (\n <TabsContent key={`panel-${i}`} value={`view-${i}`}>\n <ViewBody view={view} />\n </TabsContent>\n ))}\n </Tabs>\n );\n}\n\nexport default ScienceCanvas;\n"],"mappings":";;;;;;;;AAuEA,IAAM,IAAU;CAAC;CAAG;CAAG;CAAG;CAAG;CAAG;AAAC,CAAC,CAAC,KAAK,MAAM,qBAAqB,EAAE,EAAE,GACjE,IAAsB,KAEtB,IAAiB,IAGjB,IAAI,oCAIJ,IAAkD;CACtD,WAAW;CACX,QAAQ;CACR,iBAAiB;AACnB;AAEA,SAAS,EAAgB,GAAQ,GAAmC;CAClE,OAAO,EAAG,GAAG,EAAE,cAAc,KAAc,EAAiB,EAAW;AACzE;AAEA,SAAS,EAAU,GAAQ,GAAyC;CAClE,OAAO,EAAG,GAAG,EAAE,QAAQ,KAAQ,EAAc,CAAI,CAAC;AACpD;AAEA,IAAM,IAA6D;CACjE,MAAM,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S,gBAAiC;CACxE,IAAM,IAAK,EAAM,GACX,IAAQ,QAAc,EAAsB,CAAO,GAAG,CAAC,CAAO,CAAC,GAC/D,IAAS,EACb,EAAM,KAAK,MAAS,EAAK,SAAS,EAAU,GAAI,EAAK,IAAI,CAAC,IACzD,GAAO,MAAM,EAAG,GAAG,EAAE,eAAe,mBAAmB;EAAE;EAAO;CAAE,CAAC,CACtE;CAcA,OAZI,EAAM,WAAW,IACZ,kBAAC,GAAD;EAAuB;EAAoB;CAAY,CAAA,IAG5D,EAAM,WAAW,IAEjB,kBAAC,OAAD;EAAK,WAAW,EAAG,aAAa,CAAS;EAAG,eAAY;YACtD,kBAAC,IAAD,EAA2C,MAAM,EAAM,GAAK,GAA7C,GAAkB,CAAO,CAAoB;CACzD,CAAA,IAKP,kBAAC,GAAD;EAEE,cAAa;EACb,WAAW,EAAG,aAAa,CAAS;EACpC,eAAY;YAJd,CAME,kBAAC,GAAD;GAAU,WAAU;aACjB,EAAO,KAAK,GAAO,MAClB,kBAAC,GAAD;IAA8B,OAAO,QAAQ;cAC1C;GACU,GAFK,OAAO,GAEZ,CACd;EACO,CAAA,GACT,EAAM,KAAK,GAAM,MAChB,kBAAC,GAAD;GAAgC,OAAO,QAAQ;aAC7C,kBAAC,IAAD,EAAgB,QAAO,CAAA;EACZ,GAFK,SAAS,GAEd,CACd,CACG;IAjBC,GAAkB,CAAO,CAiB1B;AAEV"}
|
|
1
|
+
{"version":3,"file":"ScienceCanvas.js","names":[],"sources":["../../../src/cosmicintersection/components/ScienceCanvas.tsx"],"sourcesContent":["/**\n * ScienceCanvas — the analyses results canvas (BOFF-3984, mock cosmic-17).\n *\n * Renders the canonical scientific views an analysis can record in\n * `results.visualization` / `results.visualizations` (see\n * `lib/visualization.ts`):\n *\n * - sky map all-sky Mollweide / Aitoff / equirectangular projection with a\n * graticule, east-left convention and value-scaled sources\n * - spectrum wavelength vs flux with error bars, step/line/scatter series and\n * labelled spectral-line markers\n * - light curve time vs flux or magnitude (magnitude axis inverted)\n * - 3-D scene orthographic point cloud / orbit paths, rotatable by pointer\n * drag or the arrow keys\n *\n * Several views are offered as tabs. Payloads without canonical views fall\n * back to the generic numeric-series <ResultsChart>, so legacy analyses render\n * exactly as before.\n *\n * Long series are thinned for rendering only: plots keep every bucket's\n * extremes (`decimateSeries`) and their axes span the full data, and each view\n * says when it shows fewer points than it holds. Every view also offers its\n * values as a data table, and tapping a marker shows its details in a readout,\n * so the data is available without hover tooltips (touch, assistive tech).\n *\n * Everything is hand-drawn SVG with the design system's dataviz tokens\n * (`var(--color-chart-*)`) and text tokens — no raw colours, no chart library.\n * Every SVG uses a viewBox at 100% width, so the canvas scales on phones.\n */\nimport {\n useCallback,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent,\n type MouseEvent,\n type PointerEvent,\n type ReactNode,\n} from 'react';\n\nimport { Button, Tabs, TabsContent, TabsList, TabsTrigger } from '@burdenoff/fe-libs/ui';\n\nimport { useTr } from '../../shared/hooks/useTr';\nimport {\n DEFAULT_CAMERA,\n SKY_PROJECTIONS,\n clampPitch,\n decimateSeries,\n downsample,\n extractVisualizations,\n formatTick,\n formatValue,\n nearestPoint,\n niceTicks,\n tickStep,\n projectPoint,\n projectSky,\n sceneNormalizer,\n tabLabels,\n viewKindLabel,\n type Camera,\n type Point2D,\n type PlotView,\n type Scene3DView,\n type SkyMapView,\n type SkyProjection,\n type VisualizationView,\n} from '../lib/visualization';\nimport { cn } from '../utils/cn';\nimport { ResultsChart } from './ResultsChart';\n\nconst PALETTE = [1, 2, 3, 4, 5, 6].map((n) => `var(--color-chart-${n})`);\nconst MAX_RENDERED_POINTS = 2_000;\n/** Rows listed in a view's data table; the summary states the full count. */\nconst MAX_TABLE_ROWS = 50;\n\n/** Translation keys live under this prefix; English is the built-in fallback. */\nconst K = 'cosmicintersection.scienceCanvas';\n\ntype Tr = ReturnType<typeof useTr>;\n\nconst PROJECTION_LABEL: Record<SkyProjection, string> = {\n mollweide: 'Mollweide',\n aitoff: 'Aitoff',\n equirectangular: 'Equirectangular',\n};\n\nfunction projectionLabel(tr: Tr, projection: SkyProjection): string {\n return tr(`${K}.projection.${projection}`, PROJECTION_LABEL[projection]);\n}\n\nfunction kindLabel(tr: Tr, kind: VisualizationView['kind']): string {\n return tr(`${K}.kind.${kind}`, viewKindLabel(kind));\n}\n\nconst FRAME_LABEL: Record<SkyMapView['frame'], [string, string]> = {\n icrs: ['RA', 'Dec'],\n galactic: ['l', 'b'],\n ecliptic: ['λ', 'β'],\n};\n\nfunction Frame({ children }: { children: ReactNode }) {\n return (\n <div className=\"rounded-card border border-border-default bg-bg-sunken p-3\">{children}</div>\n );\n}\n\nfunction Legend({ items }: { items: Array<{ name: string; color: string; hint?: string }> }) {\n const tr = useTr();\n if (items.length < 2) return null;\n return (\n <ul className=\"flex flex-wrap gap-x-4 gap-y-1.5\" aria-label={tr(`${K}.legend`, 'Legend')}>\n {/* Names come from the payload and may repeat, so the index keeps keys unique. */}\n {items.map((item, i) => (\n <li\n key={`${i}-${item.name}`}\n className=\"flex items-center gap-1.5 text-xs text-text-secondary\"\n >\n <span\n aria-hidden=\"true\"\n className=\"inline-block size-2.5 rounded-full\"\n style={{ backgroundColor: item.color }}\n />\n <span className=\"truncate\">\n {item.name}\n {item.hint ? <span className=\"ml-1 text-text-tertiary\">({item.hint})</span> : null}\n </span>\n </li>\n ))}\n </ul>\n );\n}\n\n/** States that a view renders fewer elements than the payload holds. */\nfunction ThinningNote({\n shown,\n total,\n extremaKept,\n}: {\n shown: number;\n total: number;\n extremaKept?: boolean;\n}) {\n const tr = useTr();\n if (shown >= total) return null;\n const params = { shown: shown.toLocaleString(), total: total.toLocaleString() };\n return (\n <p className=\"text-xs text-text-tertiary\" data-testid=\"thinning-note\">\n {extremaKept\n ? tr(\n `${K}.thinnedExtrema`,\n 'Showing {{shown}} of {{total}} points; each segment keeps its highest and lowest values.',\n params\n )\n : tr(`${K}.thinned`, 'Showing {{shown}} of {{total}} items.', params)}\n </p>\n );\n}\n\n/** Announces the marker the viewer tapped or clicked (touch has no hover). */\nfunction Readout({ text }: { text: string | null }) {\n const tr = useTr();\n return (\n <p\n className=\"min-h-4 text-xs text-text-secondary\"\n aria-live=\"polite\"\n data-testid=\"canvas-readout\"\n >\n {text ?? tr(`${K}.readoutHint`, 'Tap or click a marker to see its values.')}\n </p>\n );\n}\n\n/** The view's values as a table: the text alternative to the drawing. */\nfunction DataTable({\n columns,\n rows,\n total,\n}: {\n columns: string[];\n rows: string[][];\n total: number;\n}) {\n const tr = useTr();\n if (total === 0) return null;\n return (\n <details className=\"text-xs text-text-secondary\" data-testid=\"data-table\">\n <summary className=\"cursor-pointer select-none\">\n {total > rows.length\n ? tr(`${K}.dataTablePartial`, 'Data table (first {{shown}} of {{total}} rows)', {\n shown: rows.length.toLocaleString(),\n total: total.toLocaleString(),\n })\n : tr(`${K}.dataTable`, 'Data table ({{total}} rows)', { total: total.toLocaleString() })}\n </summary>\n <div className=\"mt-2 max-h-64 overflow-auto rounded-card border border-border-default\">\n <table className=\"w-full text-left\">\n <thead className=\"bg-bg-elevated text-text-primary\">\n <tr>\n {columns.map((c, i) => (\n <th key={`h-${i}`} scope=\"col\" className=\"px-2 py-1 font-medium\">\n {c}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, r) => (\n <tr key={`r-${r}`} className=\"border-t border-border-default\">\n {row.map((cell, c) => (\n <td key={`c-${c}`} className=\"px-2 py-1 tabular-nums\">\n {cell}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </details>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Sky map\n// ---------------------------------------------------------------------------\n\nconst SKY_W = 640;\nconst SKY_H = 340;\nconst SKY_PAD = 14;\n\nfunction skyToSvg(lon: number, lat: number, projection: SkyProjection) {\n const { x, y } = projectSky(lon, lat, projection);\n const halfW = SKY_W / 2 - SKY_PAD;\n return { x: SKY_W / 2 + x * halfW, y: SKY_H / 2 - y * halfW };\n}\n\nfunction polyline(points: Array<{ x: number; y: number }>): string {\n return points\n .map((p, i) => `${i === 0 ? 'M' : 'L'} ${p.x.toFixed(2)} ${p.y.toFixed(2)}`)\n .join(' ');\n}\n\nexport function SkyMapCanvas({ view }: { view: SkyMapView }) {\n const tr = useTr();\n const [projection, setProjection] = useState<SkyProjection>(view.projection);\n const [selected, setSelected] = useState<number | null>(null);\n const [lonName, latName] = FRAME_LABEL[view.frame];\n const valueLabel = view.valueLabel ?? tr(`${K}.value`, 'value');\n\n const describe = (s: SkyMapView['sources'][number]) =>\n [\n s.label,\n `${lonName} ${s.ra.toFixed(3)}°`,\n `${latName} ${s.dec >= 0 ? '+' : ''}${s.dec.toFixed(3)}°`,\n s.value !== undefined ? `${valueLabel} ${formatValue(s.value)}` : null,\n ]\n .filter(Boolean)\n .join(' · ');\n\n const geometry = useMemo(() => {\n // The outline runs along lon 359.999° and 0.001° rather than 360° / 0°:\n // both ends of the seam project to the same x at exactly 0° / 360°, so the\n // epsilon keeps the left and right limbs of the ellipse apart.\n const outline: Array<{ x: number; y: number }> = [];\n for (let lat = -90; lat <= 90; lat += 2) outline.push(skyToSvg(359.999, lat, projection));\n for (let lat = 90; lat >= -90; lat -= 2) outline.push(skyToSvg(0.001, lat, projection));\n const meridians = [60, 120, 180, 240, 300].map((lon) => {\n const pts: Array<{ x: number; y: number }> = [];\n for (let lat = -90; lat <= 90; lat += 3) pts.push(skyToSvg(lon, lat, projection));\n return { lon, d: polyline(pts), label: skyToSvg(lon, 0, projection) };\n });\n const parallels = [-60, -30, 0, 30, 60].map((lat) => {\n const pts: Array<{ x: number; y: number }> = [];\n for (let lon = 0.001; lon <= 359.999; lon += 3) pts.push(skyToSvg(lon, lat, projection));\n pts.push(skyToSvg(359.999, lat, projection));\n return { lat, d: polyline(pts), label: skyToSvg(359.999, lat, projection) };\n });\n const values = view.sources.map((s) => s.value).filter((v): v is number => v !== undefined);\n // A single pass instead of Math.min(...values): spreading up to 20,000\n // arguments can exceed the argument limit of some engines and WebViews.\n let vMin = values.length ? Infinity : 0;\n let vMax = values.length ? -Infinity : 0;\n for (const v of values) {\n vMin = Math.min(vMin, v);\n vMax = Math.max(vMax, v);\n }\n const scale = (value: number | undefined) =>\n value === undefined || vMax === vMin ? 0.5 : (value - vMin) / (vMax - vMin);\n const sources = downsample(view.sources, MAX_RENDERED_POINTS).map((s) => ({\n ...s,\n ...skyToSvg(s.ra, s.dec, projection),\n t: scale(s.value),\n }));\n return {\n outline: `${polyline(outline)} Z`,\n meridians,\n parallels,\n sources,\n vMin,\n vMax,\n hasValues: values.length > 0,\n };\n }, [projection, view.sources]);\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <p className=\"text-xs text-text-secondary\">\n {view.sources.length === 1\n ? tr(`${K}.skySummaryOne`, '1 source · {{frame}} frame', {\n frame: view.frame.toUpperCase(),\n })\n : tr(`${K}.skySummary`, '{{count}} sources · {{frame}} frame', {\n count: view.sources.length.toLocaleString(),\n frame: view.frame.toUpperCase(),\n })}\n </p>\n <div\n role=\"group\"\n aria-label={tr(`${K}.projectionGroup`, 'Projection')}\n className=\"flex flex-wrap gap-1\"\n >\n {SKY_PROJECTIONS.map((p) => (\n <Button\n key={p}\n type=\"button\"\n size=\"sm\"\n variant={p === projection ? 'default' : 'outline'}\n aria-pressed={p === projection}\n onClick={() => setProjection(p)}\n >\n {projectionLabel(tr, p)}\n </Button>\n ))}\n </div>\n </div>\n <Frame>\n <svg\n viewBox={`0 0 ${SKY_W} ${SKY_H}`}\n className=\"h-auto w-full\"\n role=\"img\"\n aria-label={tr(`${K}.skyAria`, 'Sky map, {{projection}} projection, {{count}} sources', {\n projection: projectionLabel(tr, projection),\n count: view.sources.length,\n })}\n data-projection={projection}\n >\n <path\n d={geometry.outline}\n fill=\"var(--color-bg-elevated)\"\n stroke=\"var(--color-chart-axis)\"\n />\n {geometry.parallels.map((g) => (\n <g key={`lat-${g.lat}`}>\n <path d={g.d} fill=\"none\" stroke=\"var(--color-chart-grid)\" strokeDasharray=\"2 4\" />\n <text\n x={g.label.x + 4}\n y={g.label.y}\n fontSize={10}\n dominantBaseline=\"central\"\n fill=\"var(--color-text-tertiary)\"\n >\n {g.lat > 0 ? `+${g.lat}°` : `${g.lat}°`}\n </text>\n </g>\n ))}\n {geometry.meridians.map((g) => (\n <g key={`lon-${g.lon}`}>\n <path d={g.d} fill=\"none\" stroke=\"var(--color-chart-grid)\" strokeDasharray=\"2 4\" />\n <text\n x={g.label.x}\n y={g.label.y + 12}\n fontSize={10}\n textAnchor=\"middle\"\n fill=\"var(--color-text-tertiary)\"\n >\n {view.frame === 'icrs' ? `${g.lon / 15}h` : `${g.lon}°`}\n </text>\n </g>\n ))}\n {geometry.sources.map((s, i) => (\n <circle\n key={`src-${i}`}\n cx={s.x}\n cy={s.y}\n r={2 + s.t * 4}\n fill=\"var(--color-chart-1)\"\n fillOpacity={0.45 + s.t * 0.5}\n stroke=\"var(--color-chart-1)\"\n strokeWidth={selected === i ? 2 : 0.6}\n className=\"cursor-pointer\"\n data-testid=\"sky-source\"\n onClick={() => setSelected(i)}\n >\n <title>{describe(s)}</title>\n </circle>\n ))}\n </svg>\n </Frame>\n <Readout\n text={\n selected !== null && geometry.sources[selected]\n ? describe(geometry.sources[selected])\n : null\n }\n />\n {geometry.hasValues ? (\n <p className=\"text-xs text-text-tertiary\">\n {tr(\n `${K}.skyScale`,\n 'Marker size and opacity scale with {{label}} ({{min}} – {{max}}).',\n { label: valueLabel, min: formatTick(geometry.vMin), max: formatTick(geometry.vMax) }\n )}\n </p>\n ) : null}\n <ThinningNote shown={geometry.sources.length} total={view.sources.length} />\n <DataTable\n columns={[\n tr(`${K}.colLabel`, 'Label'),\n lonName,\n latName,\n ...(geometry.hasValues ? [valueLabel] : []),\n ]}\n rows={view.sources\n .slice(0, MAX_TABLE_ROWS)\n .map((s) => [\n s.label ?? '',\n `${s.ra.toFixed(3)}°`,\n `${s.dec.toFixed(3)}°`,\n ...(geometry.hasValues ? [s.value !== undefined ? formatValue(s.value) : ''] : []),\n ])}\n total={view.sources.length}\n />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Spectrum / light curve\n// ---------------------------------------------------------------------------\n\nconst PLOT_W = 640;\nconst PLOT_H = 340;\nconst M = { top: 22, right: 20, bottom: 48, left: 62 };\nconst IW = PLOT_W - M.left - M.right;\nconst IH = PLOT_H - M.top - M.bottom;\n\n/** Hit radius for a tap on a plot, in viewBox units (about a fingertip). */\nconst PLOT_HIT_RADIUS = 14;\n\nexport function PlotCanvas({ view }: { view: PlotView }) {\n const tr = useTr();\n const [selected, setSelected] = useState<{ series: number; point: number } | null>(null);\n const model = useMemo(() => {\n const sorted = view.series.map((s) => [...s.points].sort((a, b) => a.x - b.x));\n const series = view.series.map((s, i) => ({\n ...s,\n color: PALETTE[i % PALETTE.length],\n points: decimateSeries(sorted[i], MAX_RENDERED_POINTS),\n }));\n // The domain comes from the full data, so thinning never clips the axes.\n let minX = Infinity;\n let maxX = -Infinity;\n let minY = Infinity;\n let maxY = -Infinity;\n for (const points of sorted) {\n for (const p of points) {\n const err = p.err ?? 0;\n minX = Math.min(minX, p.x);\n maxX = Math.max(maxX, p.x);\n minY = Math.min(minY, p.y - err);\n maxY = Math.max(maxY, p.y + err);\n }\n }\n if (minX === maxX) {\n minX -= 1;\n maxX += 1;\n }\n if (minY === maxY) {\n minY -= 1;\n maxY += 1;\n }\n const pad = (maxY - minY) * 0.08;\n minY -= pad;\n maxY += pad;\n const lines = view.lines.filter((l) => l.x >= minX && l.x <= maxX);\n const xTicks = niceTicks(minX, maxX, 5);\n const yTicks = niceTicks(minY, maxY, 5);\n let shown = 0;\n let total = 0;\n for (let i = 0; i < series.length; i += 1) {\n shown += series[i].points.length;\n total += sorted[i].length;\n }\n return {\n series,\n shown,\n total,\n lines,\n domainX: [minX, maxX] as const,\n domainY: [minY, maxY] as const,\n xTicks,\n yTicks,\n xStep: tickStep(xTicks),\n yStep: tickStep(yTicks),\n };\n }, [view]);\n\n const { domainX, domainY } = model;\n const sx = (x: number) => M.left + ((x - domainX[0]) / (domainX[1] - domainX[0])) * IW;\n const yFrac = (y: number) => (y - domainY[0]) / (domainY[1] - domainY[0]);\n // Magnitudes: smaller is brighter, so brighter plots higher (axis inverted).\n const sy = (y: number) => (view.invertY ? M.top + yFrac(y) * IH : M.top + IH - yFrac(y) * IH);\n\n const onPlotClick = (e: MouseEvent<SVGSVGElement>) => {\n const rect = e.currentTarget.getBoundingClientRect();\n if (rect.width === 0 || rect.height === 0) return;\n const x = ((e.clientX - rect.left) / rect.width) * PLOT_W;\n const y = ((e.clientY - rect.top) / rect.height) * PLOT_H;\n const targets = model.series.flatMap((s, si) =>\n s.points.map((p, pi) => ({ x: sx(p.x), y: sy(p.y), series: si, point: pi }))\n );\n const hit = nearestPoint(targets, x, y, PLOT_HIT_RADIUS);\n setSelected(hit >= 0 ? { series: targets[hit].series, point: targets[hit].point } : null);\n };\n\n const selectedSeries = selected ? model.series[selected.series] : undefined;\n const selectedPoint = selected ? selectedSeries?.points[selected.point] : undefined;\n const readout =\n selectedSeries && selectedPoint\n ? [\n selectedSeries.name,\n `${view.xLabel} ${formatValue(selectedPoint.x)}`,\n `${view.yLabel} ${formatValue(selectedPoint.y)}${\n selectedPoint.err !== undefined ? ` ± ${formatValue(selectedPoint.err)}` : ''\n }`,\n ].join(' · ')\n : null;\n\n const pathFor = (points: Point2D[], step: boolean) => {\n if (!step) return polyline(points.map((p) => ({ x: sx(p.x), y: sy(p.y) })));\n const out: Array<{ x: number; y: number }> = [];\n points.forEach((p, i) => {\n if (i > 0) out.push({ x: sx(p.x), y: sy(points[i - 1].y) });\n out.push({ x: sx(p.x), y: sy(p.y) });\n });\n return polyline(out);\n };\n\n return (\n <div className=\"space-y-3\">\n <Frame>\n <svg\n viewBox={`0 0 ${PLOT_W} ${PLOT_H}`}\n role=\"img\"\n aria-label={tr(\n view.invertY ? `${K}.plotAriaInverted` : `${K}.plotAria`,\n view.invertY\n ? '{{kind}}: {{series}}; x-axis {{x}}, y-axis {{y}} (inverted)'\n : '{{kind}}: {{series}}; x-axis {{x}}, y-axis {{y}}',\n {\n kind: kindLabel(tr, view.kind),\n series: model.series.map((s) => s.name).join(', '),\n x: view.xLabel,\n y: view.yLabel,\n }\n )}\n data-inverted={view.invertY ? 'true' : 'false'}\n className=\"h-auto w-full cursor-crosshair\"\n onClick={onPlotClick}\n >\n {model.yTicks.map((t) => (\n <g key={`y-${t}`}>\n <line\n x1={M.left}\n x2={M.left + IW}\n y1={sy(t)}\n y2={sy(t)}\n stroke=\"var(--color-chart-grid)\"\n />\n <text\n x={M.left - 8}\n y={sy(t)}\n textAnchor=\"end\"\n dominantBaseline=\"central\"\n fontSize={11}\n fill=\"var(--color-text-tertiary)\"\n >\n {formatTick(t, model.yStep)}\n </text>\n </g>\n ))}\n {model.xTicks.map((t) => (\n <g key={`x-${t}`}>\n <line\n x1={sx(t)}\n x2={sx(t)}\n y1={M.top}\n y2={M.top + IH}\n stroke=\"var(--color-chart-grid)\"\n strokeDasharray=\"2 4\"\n />\n <text\n x={sx(t)}\n y={M.top + IH + 18}\n textAnchor=\"middle\"\n fontSize={11}\n fill=\"var(--color-text-tertiary)\"\n >\n {formatTick(t, model.xStep)}\n </text>\n </g>\n ))}\n <rect\n x={M.left}\n y={M.top}\n width={IW}\n height={IH}\n fill=\"none\"\n stroke=\"var(--color-chart-axis)\"\n />\n\n {model.lines.map((l, i) => (\n <g key={`line-${i}`} data-testid=\"spectral-line\">\n <line\n x1={sx(l.x)}\n x2={sx(l.x)}\n y1={M.top}\n y2={M.top + IH}\n stroke=\"var(--color-chart-negative)\"\n strokeDasharray=\"4 3\"\n />\n {l.label ? (\n <text\n x={sx(l.x) + 3}\n y={M.top - 6}\n fontSize={10}\n fill=\"var(--color-text-secondary)\"\n >\n {l.label}\n </text>\n ) : null}\n </g>\n ))}\n\n {selectedSeries && selectedPoint ? (\n <circle\n cx={sx(selectedPoint.x)}\n cy={sy(selectedPoint.y)}\n r={5}\n fill=\"none\"\n stroke=\"var(--color-text-primary)\"\n strokeWidth={1.5}\n pointerEvents=\"none\"\n data-testid=\"plot-selection\"\n />\n ) : null}\n {model.series.map((s, si) => (\n <g key={`series-${si}`} data-testid=\"plot-series\" data-style={s.style}>\n {s.points.map((p, i) =>\n p.err ? (\n <line\n key={`err-${i}`}\n x1={sx(p.x)}\n x2={sx(p.x)}\n y1={sy(p.y - p.err)}\n y2={sy(p.y + p.err)}\n stroke={s.color}\n strokeOpacity={0.5}\n data-testid=\"error-bar\"\n />\n ) : null\n )}\n {s.style !== 'scatter' ? (\n <path\n d={pathFor(s.points, s.style === 'step')}\n fill=\"none\"\n stroke={s.color}\n strokeWidth={1.8}\n strokeLinejoin=\"round\"\n />\n ) : (\n s.points.map((p, i) => (\n <circle\n key={`pt-${i}`}\n cx={sx(p.x)}\n cy={sy(p.y)}\n r={2.4}\n fill={s.color}\n fillOpacity={0.85}\n />\n ))\n )}\n </g>\n ))}\n\n <text\n x={M.left + IW / 2}\n y={PLOT_H - 6}\n textAnchor=\"middle\"\n fontSize={12}\n fill=\"var(--color-text-secondary)\"\n >\n {view.xLabel}\n </text>\n <text\n x={14}\n y={M.top + IH / 2}\n textAnchor=\"middle\"\n fontSize={12}\n fill=\"var(--color-text-secondary)\"\n transform={`rotate(-90 14 ${M.top + IH / 2})`}\n >\n {view.yLabel}\n </text>\n </svg>\n </Frame>\n <Readout text={readout} />\n <Legend items={model.series.map((s) => ({ name: s.name, color: s.color, hint: s.style }))} />\n <ThinningNote shown={model.shown} total={model.total} extremaKept />\n <DataTable\n columns={[tr(`${K}.colSeries`, 'Series'), view.xLabel, view.yLabel, tr(`${K}.colErr`, '±')]}\n rows={view.series\n .flatMap((s) => s.points.map((p) => ({ name: s.name, p })))\n .slice(0, MAX_TABLE_ROWS)\n .map(({ name, p }) => [\n name,\n formatValue(p.x),\n formatValue(p.y),\n p.err !== undefined ? formatValue(p.err) : '',\n ])}\n total={model.total}\n />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// 3-D scene\n// ---------------------------------------------------------------------------\n\nconst SCENE_SIZE = 360;\nconst SCENE_SCALE = SCENE_SIZE * 0.32;\n\nexport function SceneCanvas({ view }: { view: Scene3DView }) {\n const tr = useTr();\n const [camera, setCamera] = useState<Camera>(DEFAULT_CAMERA);\n const [selected, setSelected] = useState<number | null>(null);\n const drag = useRef<{ x: number; y: number; camera: Camera } | null>(null);\n\n // Everything that does not depend on the camera is computed once per view,\n // so a drag only re-projects and re-sorts, never re-normalises or re-thins.\n const prepared = useMemo(() => {\n const normalize = sceneNormalizer([...view.points, ...view.paths.flatMap((p) => p.points)]);\n const points = downsample(view.points, MAX_RENDERED_POINTS).map((p) => ({\n label: p.label,\n value: p.value,\n data: { x: p.x, y: p.y, z: p.z },\n norm: normalize(p),\n }));\n const paths = view.paths.map((path, i) => ({\n name: path.name,\n // chart-1 is the point cloud, so paths cycle through chart-2..chart-6.\n color: PALETTE[1 + (i % (PALETTE.length - 1))],\n norm: downsample(path.points, MAX_RENDERED_POINTS).map((p) => normalize(p)),\n }));\n let pathPoints = 0;\n let renderedPathPoints = 0;\n for (let i = 0; i < view.paths.length; i += 1) {\n pathPoints += view.paths[i].points.length;\n renderedPathPoints += paths[i].norm.length;\n }\n return {\n points,\n paths,\n shown: points.length + renderedPathPoints,\n total: view.points.length + pathPoints,\n };\n }, [view]);\n\n const toScreen = useCallback(\n (p: { x: number; y: number; z: number }) => {\n const r = projectPoint(p, camera);\n return {\n x: SCENE_SIZE / 2 + r.x * SCENE_SCALE,\n y: SCENE_SIZE / 2 - r.y * SCENE_SCALE,\n depth: r.depth,\n };\n },\n [camera]\n );\n\n const projected = useMemo(() => {\n // Keep the data coordinates (for the tooltip) apart from the projected\n // SVG coordinates, which change as the camera rotates.\n const points = prepared.points\n .map((p, index) => ({\n index,\n label: p.label,\n value: p.value,\n data: p.data,\n ...toScreen(p.norm),\n }))\n .sort((a, b) => a.depth - b.depth);\n const paths = prepared.paths.map((path) => ({\n name: path.name,\n color: path.color,\n d: polyline(path.norm.map((p) => toScreen(p))),\n }));\n const axes = (['x', 'y', 'z'] as const).map((axis) => {\n const end = { x: 0, y: 0, z: 0, [axis]: 1.15 };\n return { axis, from: toScreen({ x: 0, y: 0, z: 0 }), to: toScreen(end) };\n });\n return { points, paths, axes };\n }, [prepared, toScreen]);\n\n const hasValues =\n view.points.some((p) => p.value !== undefined) ||\n view.paths.some((path) => path.points.some((p) => p.value !== undefined));\n const describe = (p: {\n label?: string;\n value?: number;\n data: { x: number; y: number; z: number };\n }) =>\n [\n p.label,\n `(${formatValue(p.data.x)}, ${formatValue(p.data.y)}, ${formatValue(p.data.z)})`,\n p.value !== undefined ? `· ${formatValue(p.value)}` : null,\n ]\n .filter(Boolean)\n .join(' ');\n\n // A drag that happens to end on a point must not also select it.\n const moved = useRef(false);\n const selectPoint = (index: number) => {\n if (moved.current) return;\n setSelected(index);\n };\n\n const onPointerDown = (e: PointerEvent<SVGSVGElement>) => {\n drag.current = { x: e.clientX, y: e.clientY, camera };\n moved.current = false;\n e.currentTarget.setPointerCapture?.(e.pointerId);\n };\n const endDrag = () => {\n drag.current = null;\n };\n const onPointerMove = (e: PointerEvent<SVGSVGElement>) => {\n const start = drag.current;\n if (!start) return;\n // Without pointer capture a mouse released outside the scene never sends\n // pointerup here; a move with no button pressed ends that stale drag.\n if (e.pointerType === 'mouse' && e.buttons === 0) {\n endDrag();\n return;\n }\n if (Math.hypot(e.clientX - start.x, e.clientY - start.y) > 3) moved.current = true;\n setCamera({\n yaw: start.camera.yaw + (e.clientX - start.x) * 0.5,\n pitch: clampPitch(start.camera.pitch + (e.clientY - start.y) * 0.5),\n });\n };\n const onKeyDown = (e: KeyboardEvent<SVGSVGElement>) => {\n const step = 10;\n const next: Partial<Record<string, Camera>> = {\n ArrowLeft: { ...camera, yaw: camera.yaw - step },\n ArrowRight: { ...camera, yaw: camera.yaw + step },\n ArrowUp: { ...camera, pitch: clampPitch(camera.pitch - step) },\n ArrowDown: { ...camera, pitch: clampPitch(camera.pitch + step) },\n };\n const target = next[e.key];\n if (target) {\n e.preventDefault();\n setCamera(target);\n }\n };\n\n const depthRange = projected.points.length\n ? [projected.points[0].depth, projected.points[projected.points.length - 1].depth]\n : [0, 0];\n const depthT = (d: number) =>\n depthRange[1] === depthRange[0] ? 1 : (d - depthRange[0]) / (depthRange[1] - depthRange[0]);\n\n const selectedPoint = selected !== null ? prepared.points[selected] : undefined;\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <p className=\"text-xs text-text-secondary\">\n {tr(\n `${K}.sceneHelp`,\n 'Drag or use the arrow keys to rotate · yaw {{yaw}}°, pitch {{pitch}}°',\n { yaw: Math.round(camera.yaw), pitch: Math.round(camera.pitch) }\n )}\n </p>\n <Button type=\"button\" size=\"sm\" variant=\"outline\" onClick={() => setCamera(DEFAULT_CAMERA)}>\n {tr(`${K}.resetView`, 'Reset view')}\n </Button>\n </div>\n <Frame>\n {/* An interactive widget, not a picture: role=\"img\" would hide the\n point and source titles from assistive technology. */}\n <svg\n viewBox={`0 0 ${SCENE_SIZE} ${SCENE_SIZE}`}\n className=\"mx-auto h-auto w-full max-w-md cursor-grab touch-none select-none focus:outline-none focus-visible:ring-2 focus-visible:ring-border-focus\"\n role=\"application\"\n aria-roledescription={tr(`${K}.sceneRole`, '3-D scene')}\n tabIndex={0}\n aria-label={tr(\n `${K}.sceneAria`,\n '3-D scene with {{points}} points and {{paths}} paths; drag or use arrow keys to rotate',\n { points: view.points.length, paths: view.paths.length }\n )}\n data-yaw={camera.yaw}\n data-pitch={camera.pitch}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={endDrag}\n onPointerCancel={endDrag}\n onKeyDown={onKeyDown}\n >\n {projected.axes.map((a) => (\n <g key={a.axis}>\n <line\n x1={a.from.x}\n y1={a.from.y}\n x2={a.to.x}\n y2={a.to.y}\n stroke=\"var(--color-chart-axis)\"\n />\n <text x={a.to.x} y={a.to.y} fontSize={10} fill=\"var(--color-text-tertiary)\" dy={-3}>\n {view.axes[a.axis]}\n </text>\n </g>\n ))}\n {projected.paths.map((p, i) => (\n <path\n key={`path-${i}`}\n d={p.d}\n fill=\"none\"\n stroke={p.color}\n strokeWidth={1.5}\n data-testid=\"scene-path\"\n />\n ))}\n {projected.points.map((p) => {\n const t = depthT(p.depth);\n return (\n <circle\n key={`p-${p.index}`}\n cx={p.x}\n cy={p.y}\n r={2 + t * 2}\n fill=\"var(--color-chart-1)\"\n fillOpacity={0.35 + t * 0.6}\n stroke={selected === p.index ? 'var(--color-text-primary)' : undefined}\n className=\"cursor-pointer\"\n data-testid=\"scene-point\"\n onClick={() => selectPoint(p.index)}\n >\n <title>{describe(p)}</title>\n </circle>\n );\n })}\n </svg>\n </Frame>\n <Readout text={selectedPoint ? describe(selectedPoint) : null} />\n <Legend\n items={projected.paths.map((p) => ({\n name: p.name,\n color: p.color,\n hint: tr(`${K}.pathHint`, 'path'),\n }))}\n />\n <ThinningNote shown={prepared.shown} total={prepared.total} />\n <DataTable\n columns={[\n tr(`${K}.colLabel`, 'Label'),\n view.axes.x,\n view.axes.y,\n view.axes.z,\n ...(hasValues ? [tr(`${K}.value`, 'value')] : []),\n ]}\n rows={[\n ...view.points.map((p) => ({ p, owner: p.label ?? '' })),\n ...view.paths.flatMap((path) =>\n path.points.map((p) => ({ p, owner: p.label ?? path.name }))\n ),\n ]\n .slice(0, MAX_TABLE_ROWS)\n .map(({ p, owner }) => [\n owner,\n formatValue(p.x),\n formatValue(p.y),\n formatValue(p.z),\n ...(hasValues ? [p.value !== undefined ? formatValue(p.value) : ''] : []),\n ])}\n total={prepared.total}\n />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Canvas\n// ---------------------------------------------------------------------------\n\nfunction ViewBody({ view }: { view: VisualizationView }) {\n return (\n <div className=\"space-y-2\">\n {view.title || view.description ? (\n <div>\n {view.title ? (\n <p className=\"text-sm font-medium text-text-primary\">{view.title}</p>\n ) : null}\n {view.description ? (\n <p className=\"text-xs text-text-secondary\">{view.description}</p>\n ) : null}\n </div>\n ) : null}\n {view.kind === 'skymap' ? (\n <SkyMapCanvas view={view} />\n ) : view.kind === 'scene3d' ? (\n <SceneCanvas view={view} />\n ) : (\n <PlotCanvas view={view} />\n )}\n </div>\n );\n}\n\nexport interface ScienceCanvasProps {\n results: Record<string, unknown>;\n className?: string;\n}\n\n/**\n * A stable number per results object. Views are keyed on it, so when the\n * dialog is reused for another analysis the selection, camera, projection and\n * active tab start fresh instead of pointing into the previous payload.\n */\nconst payloadGenerations = new WeakMap<object, number>();\nlet nextGeneration = 0;\nfunction payloadGeneration(results: object): number {\n let generation = payloadGenerations.get(results);\n if (generation === undefined) {\n nextGeneration += 1;\n generation = nextGeneration;\n payloadGenerations.set(results, generation);\n }\n return generation;\n}\n\nexport function ScienceCanvas({ results, className }: ScienceCanvasProps) {\n const tr = useTr();\n const views = useMemo(() => extractVisualizations(results), [results]);\n const labels = tabLabels(\n views.map((view) => view.title ?? kindLabel(tr, view.kind)),\n (label, n) => tr(`${K}.tabNumbered`, '{{label}} {{n}}', { label, n })\n );\n\n if (views.length === 0) {\n return <ResultsChart results={results} className={className} />;\n }\n\n if (views.length === 1) {\n return (\n <div className={cn('space-y-3', className)} data-testid=\"science-canvas\">\n <ViewBody key={payloadGeneration(results)} view={views[0]} />\n </div>\n );\n }\n\n return (\n <Tabs\n key={payloadGeneration(results)}\n defaultValue=\"view-0\"\n className={cn('space-y-3', className)}\n data-testid=\"science-canvas\"\n >\n {/*\n * The list spans the dialog and scrolls sideways when the views do not\n * fit; each label is capped and truncated with an ellipsis, and the\n * full title stays available as the tooltip and accessible name.\n */}\n <TabsList\n className=\"flex h-auto w-full max-w-full justify-start overflow-x-auto\"\n data-testid=\"science-canvas-tabs\"\n >\n {labels.map((label, i) => (\n <TabsTrigger\n key={`tab-${i}`}\n value={`view-${i}`}\n title={label}\n aria-label={label}\n className=\"min-w-0 max-w-[14rem] flex-none\"\n >\n <span className=\"truncate\">{label}</span>\n </TabsTrigger>\n ))}\n </TabsList>\n {views.map((view, i) => (\n <TabsContent key={`panel-${i}`} value={`view-${i}`}>\n <ViewBody view={view} />\n </TabsContent>\n ))}\n </Tabs>\n );\n}\n\nexport default ScienceCanvas;\n"],"mappings":";;;;;;;;AAuEA,IAAM,IAAU;CAAC;CAAG;CAAG;CAAG;CAAG;CAAG;AAAC,CAAC,CAAC,KAAK,MAAM,qBAAqB,EAAE,EAAE,GACjE,IAAsB,KAEtB,IAAiB,IAGjB,IAAI,oCAIJ,IAAkD;CACtD,WAAW;CACX,QAAQ;CACR,iBAAiB;AACnB;AAEA,SAAS,EAAgB,GAAQ,GAAmC;CAClE,OAAO,EAAG,GAAG,EAAE,cAAc,KAAc,EAAiB,EAAW;AACzE;AAEA,SAAS,EAAU,GAAQ,GAAyC;CAClE,OAAO,EAAG,GAAG,EAAE,QAAQ,KAAQ,EAAc,CAAI,CAAC;AACpD;AAEA,IAAM,IAA6D;CACjE,MAAM,CAAC,MAAM,KAAK;CAClB,UAAU,CAAC,KAAK,GAAG;CACnB,UAAU,CAAC,KAAK,GAAG;AACrB;AAEA,SAAS,EAAM,EAAE,eAAqC;CACpD,OACE,kBAAC,OAAD;EAAK,WAAU;EAA8D;CAAc,CAAA;AAE/F;AAEA,SAAS,EAAO,EAAE,YAA2E;CAC3F,IAAM,IAAK,EAAM;CAEjB,OADI,EAAM,SAAS,IAAU,OAE3B,kBAAC,MAAD;EAAI,WAAU;EAAmC,cAAY,EAAG,GAAG,EAAE,UAAU,QAAQ;YAEpF,EAAM,KAAK,GAAM,MAChB,kBAAC,MAAD;GAEE,WAAU;aAFZ,CAIE,kBAAC,QAAD;IACE,eAAY;IACZ,WAAU;IACV,OAAO,EAAE,iBAAiB,EAAK,MAAM;GACtC,CAAA,GACD,kBAAC,QAAD;IAAM,WAAU;cAAhB,CACG,EAAK,MACL,EAAK,OAAO,kBAAC,QAAD;KAAM,WAAU;eAAhB;MAA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