@alfadocs/ui-kit-debug 0.99.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/_chunks/{actions-cell-renderer-DaL80uqL.js → actions-cell-renderer-ClGCSQnA.js} +600 -565
- package/dist/_chunks/actions-cell-renderer-ClGCSQnA.js.map +1 -0
- package/dist/_chunks/{ai-consent-banner-BXD7W6FI.js → ai-consent-banner-DKgFfSzc.js} +2 -2
- package/dist/_chunks/{ai-consent-banner-BXD7W6FI.js.map → ai-consent-banner-DKgFfSzc.js.map} +1 -1
- package/dist/_chunks/{alert-Cxaqd-QO.js → alert-DS22ha1n.js} +103 -98
- package/dist/_chunks/alert-DS22ha1n.js.map +1 -0
- package/dist/_chunks/{annotation-marker-qt5R9WZX.js → annotation-marker-CsUJGZjQ.js} +7 -5
- package/dist/_chunks/annotation-marker-CsUJGZjQ.js.map +1 -0
- package/dist/_chunks/{audio-recorder-BjnB7V8n.js → audio-recorder-sRsGS-0V.js} +2 -2
- package/dist/_chunks/{audio-recorder-BjnB7V8n.js.map → audio-recorder-sRsGS-0V.js.map} +1 -1
- package/dist/_chunks/{booking-DSOK-bnR.js → booking-D8fCzcUd.js} +2 -2
- package/dist/_chunks/{booking-DSOK-bnR.js.map → booking-D8fCzcUd.js.map} +1 -1
- package/dist/_chunks/{care-plan-card-BrwhyIJI.js → care-plan-card-DjjVnBYz.js} +2 -2
- package/dist/_chunks/{care-plan-card-BrwhyIJI.js.map → care-plan-card-DjjVnBYz.js.map} +1 -1
- package/dist/_chunks/{care-plan-entry-card-DWEdCQM3.js → care-plan-entry-card-BVhpvd-P.js} +2 -2
- package/dist/_chunks/{care-plan-entry-card-DWEdCQM3.js.map → care-plan-entry-card-BVhpvd-P.js.map} +1 -1
- package/dist/_chunks/{clinical-note-card-C7F_24IC.js → clinical-note-card-D63x_AkK.js} +5 -2
- package/dist/_chunks/clinical-note-card-D63x_AkK.js.map +1 -0
- package/dist/_chunks/{collapsible-BrnRiCC6.js → collapsible-CGL9ontS.js} +65 -61
- package/dist/_chunks/collapsible-CGL9ontS.js.map +1 -0
- package/dist/_chunks/{document-preview-DXsCEj4U.js → document-preview-DAczwybt.js} +2 -2
- package/dist/_chunks/{document-preview-DXsCEj4U.js.map → document-preview-DAczwybt.js.map} +1 -1
- package/dist/_chunks/{document-scanner-cS_ispQs.js → document-scanner-BRYIc3A-.js} +2 -2
- package/dist/_chunks/{document-scanner-cS_ispQs.js.map → document-scanner-BRYIc3A-.js.map} +1 -1
- package/dist/_chunks/{entity-summary-BILN4wEG.js → entity-summary-BS6n7Iah.js} +2 -2
- package/dist/_chunks/{entity-summary-BILN4wEG.js.map → entity-summary-BS6n7Iah.js.map} +1 -1
- package/dist/_chunks/{face-scheme-CjQAHvSP.js → face-scheme-Cou2efl7.js} +2 -2
- package/dist/_chunks/{face-scheme-CjQAHvSP.js.map → face-scheme-Cou2efl7.js.map} +1 -1
- package/dist/_chunks/{file-manager-B9LZzT5E.js → file-manager-CNSLiuLo.js} +2 -2
- package/dist/_chunks/{file-manager-B9LZzT5E.js.map → file-manager-CNSLiuLo.js.map} +1 -1
- package/dist/_chunks/{freemium-paywall-Dr2342_S.js → freemium-paywall-DsT7MaLd.js} +2 -2
- package/dist/_chunks/{freemium-paywall-Dr2342_S.js.map → freemium-paywall-DsT7MaLd.js.map} +1 -1
- package/dist/_chunks/link-cell-renderer-_DlEZHLI.js +772 -0
- package/dist/_chunks/link-cell-renderer-_DlEZHLI.js.map +1 -0
- package/dist/_chunks/{marketplace-app-shell-pCHBp8bo.js → marketplace-app-shell-DQC9Gpm0.js} +2 -2
- package/dist/_chunks/{marketplace-app-shell-pCHBp8bo.js.map → marketplace-app-shell-DQC9Gpm0.js.map} +1 -1
- package/dist/_chunks/{muscle-scheme-kgCX5qfO.js → muscle-scheme-yfzP_xoJ.js} +2 -2
- package/dist/_chunks/{muscle-scheme-kgCX5qfO.js.map → muscle-scheme-yfzP_xoJ.js.map} +1 -1
- package/dist/_chunks/{notes-panel-BKwd-bOV.js → notes-panel-CTcOLLVo.js} +3 -3
- package/dist/_chunks/{notes-panel-BKwd-bOV.js.map → notes-panel-CTcOLLVo.js.map} +1 -1
- package/dist/_chunks/{patient-details-UmNcxL0c.js → patient-details-l7pnsUq9.js} +2 -2
- package/dist/_chunks/{patient-details-UmNcxL0c.js.map → patient-details-l7pnsUq9.js.map} +1 -1
- package/dist/_chunks/{patient-search-vtRTSdf6.js → patient-search-H54Utav2.js} +2 -2
- package/dist/_chunks/{patient-search-vtRTSdf6.js.map → patient-search-H54Utav2.js.map} +1 -1
- package/dist/_chunks/{patient-table-QEVsFvwq.js → patient-table-DXk0wW8Q.js} +243 -239
- package/dist/_chunks/patient-table-DXk0wW8Q.js.map +1 -0
- package/dist/_chunks/payment-automation-upsell-C4LIw1iQ.js +305 -0
- package/dist/_chunks/payment-automation-upsell-C4LIw1iQ.js.map +1 -0
- package/dist/_chunks/{payment-form-BoGxEmGn.js → payment-form-CyKT20xZ.js} +2 -2
- package/dist/_chunks/{payment-form-BoGxEmGn.js.map → payment-form-CyKT20xZ.js.map} +1 -1
- package/dist/_chunks/{payment-request-card-CygO1anM.js → payment-request-card-CN30J6yM.js} +107 -138
- package/dist/_chunks/payment-request-card-CN30J6yM.js.map +1 -0
- package/dist/_chunks/{pdf-viewer-CcOuR2wj.js → pdf-viewer-DHg8SfUI.js} +2 -2
- package/dist/_chunks/{pdf-viewer-CcOuR2wj.js.map → pdf-viewer-DHg8SfUI.js.map} +1 -1
- package/dist/_chunks/{practice-results-yKbwIxqa.js → practice-results-qvJRkvLn.js} +2 -2
- package/dist/_chunks/{practice-results-yKbwIxqa.js.map → practice-results-qvJRkvLn.js.map} +1 -1
- package/dist/_chunks/receipt-euro-C6k4Gzhr.js +36 -0
- package/dist/_chunks/receipt-euro-C6k4Gzhr.js.map +1 -0
- package/dist/_chunks/{reviews-panel-DmOjvmyH.js → reviews-panel-BfUJhx3m.js} +2 -2
- package/dist/_chunks/{reviews-panel-DmOjvmyH.js.map → reviews-panel-BfUJhx3m.js.map} +1 -1
- package/dist/_chunks/{rich-text-editor-DHpV2q6d.js → rich-text-editor-CfeXPPWs.js} +10 -2
- package/dist/_chunks/rich-text-editor-CfeXPPWs.js.map +1 -0
- package/dist/_chunks/{sign-document-cH9CboWB.js → sign-document-D70TEUw9.js} +2 -2
- package/dist/_chunks/{sign-document-cH9CboWB.js.map → sign-document-D70TEUw9.js.map} +1 -1
- package/dist/_chunks/{signature-request-BzXTV_RH.js → signature-request-BlNCXpRN.js} +2 -2
- package/dist/_chunks/{signature-request-BzXTV_RH.js.map → signature-request-BlNCXpRN.js.map} +1 -1
- package/dist/_chunks/sparkline-DLq7xwic.js +394 -0
- package/dist/_chunks/sparkline-DLq7xwic.js.map +1 -0
- package/dist/_chunks/{warning-stack-DKeAfj5M.js → warning-stack-IVf0oxh2.js} +2 -2
- package/dist/_chunks/{warning-stack-DKeAfj5M.js.map → warning-stack-IVf0oxh2.js.map} +1 -1
- package/dist/_chunks/{workflow-map-SIfAhmWz.js → workflow-map-ByyBYj6Y.js} +2 -2
- package/dist/_chunks/{workflow-map-SIfAhmWz.js.map → workflow-map-ByyBYj6Y.js.map} +1 -1
- package/dist/agent-catalog.json +211 -7
- package/dist/agent-i18n/en.json +13 -3
- package/dist/components/ai-consent-banner/index.js +1 -1
- package/dist/components/alert/alert.d.ts +20 -0
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/index.d.ts +1 -1
- package/dist/components/alert/index.d.ts.map +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/annotation-marker/annotation-marker.d.ts.map +1 -1
- package/dist/components/annotation-marker/index.js +1 -1
- package/dist/components/audio-recorder/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/care-plan-card/index.js +1 -1
- package/dist/components/care-plan-entry-card/index.js +1 -1
- package/dist/components/clinical-note-card/clinical-note-card.d.ts.map +1 -1
- package/dist/components/clinical-note-card/index.js +1 -1
- package/dist/components/collapsible/collapsible.d.ts.map +1 -1
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/filters/select-filter.d.ts +6 -0
- package/dist/components/data-table/filters/select-filter.d.ts.map +1 -1
- package/dist/components/data-table/hooks/use-presentational-aria-fix.d.ts +19 -0
- package/dist/components/data-table/hooks/use-presentational-aria-fix.d.ts.map +1 -0
- package/dist/components/data-table/index.js +2 -2
- package/dist/components/document-preview/index.js +1 -1
- package/dist/components/document-scanner/index.js +1 -1
- package/dist/components/entity-summary/index.js +1 -1
- package/dist/components/face-scheme/index.js +1 -1
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/muscle-scheme/index.js +1 -1
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-search/index.js +1 -1
- package/dist/components/patient-table/columns.d.ts.map +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/payment-card/index.js +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/reviews-panel/index.js +1 -1
- package/dist/components/rich-text-editor/help-me-write-overlay.d.ts.map +1 -1
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/skeleton-scheme/index.js +1 -1
- package/dist/components/sparkline/index.d.ts +1 -1
- package/dist/components/sparkline/index.d.ts.map +1 -1
- package/dist/components/sparkline/index.js +1 -1
- package/dist/components/sparkline/sparkline.d.ts +36 -3
- package/dist/components/sparkline/sparkline.d.ts.map +1 -1
- package/dist/components/warning-stack/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/host-compat.css +10 -1
- package/dist/i18n/locales/ar.d.ts +1 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +1 -0
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +1 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +1 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +1 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +1 -0
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +1 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +1 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +1 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +1 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +1 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +1 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +1 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +1 -0
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +1 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +1 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +1 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +1 -0
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +1 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +1 -0
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +1 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +1 -0
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +1 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +1 -0
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +1 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +1 -0
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +1 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +1 -0
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +1 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +1 -0
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +1 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +1 -0
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +1 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +1 -0
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +1 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +1 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +974 -1268
- package/dist/index.js.map +1 -1
- package/dist/locales/ar.json +1 -0
- package/dist/locales/de.json +1 -0
- package/dist/locales/el.json +1 -0
- package/dist/locales/en.json +1 -0
- package/dist/locales/es.json +1 -0
- package/dist/locales/fr.json +1 -0
- package/dist/locales/hi.json +1 -0
- package/dist/locales/it.json +1 -0
- package/dist/locales/ja.json +1 -0
- package/dist/locales/nl.json +1 -0
- package/dist/locales/pl.json +1 -0
- package/dist/locales/pt.json +1 -0
- package/dist/locales/ro.json +1 -0
- package/dist/locales/ru.json +1 -0
- package/dist/locales/sq.json +1 -0
- package/dist/locales/sv.json +1 -0
- package/dist/locales/tr.json +1 -0
- package/dist/locales/zh.json +1 -0
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/payment-automation-upsell/index.js +5 -0
- package/dist/patterns/payment-automation-upsell/index.js.map +1 -0
- package/dist/patterns/signature-request/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +8 -2
- package/dist/_chunks/actions-cell-renderer-DaL80uqL.js.map +0 -1
- package/dist/_chunks/alert-Cxaqd-QO.js.map +0 -1
- package/dist/_chunks/annotation-marker-qt5R9WZX.js.map +0 -1
- package/dist/_chunks/clinical-note-card-C7F_24IC.js.map +0 -1
- package/dist/_chunks/collapsible-BrnRiCC6.js.map +0 -1
- package/dist/_chunks/link-cell-renderer-Bt-mXeQY.js +0 -728
- package/dist/_chunks/link-cell-renderer-Bt-mXeQY.js.map +0 -1
- package/dist/_chunks/patient-table-QEVsFvwq.js.map +0 -1
- package/dist/_chunks/payment-request-card-CygO1anM.js.map +0 -1
- package/dist/_chunks/rich-text-editor-DHpV2q6d.js.map +0 -1
- package/dist/_chunks/sparkline-DcXqRZoq.js +0 -283
- package/dist/_chunks/sparkline-DcXqRZoq.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-scanner-cS_ispQs.js","sources":["../../src/components/document-scanner/document-scanner.agent.ts","../../src/components/document-scanner/document-scanner.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — DocumentScanner. */\n/* */\n/* State exposes only structural lifecycle info — never the captured */\n/* image bytes (PHI). Actions drive the camera + capture flow. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DocumentScannerHandle } from './document-scanner';\n\nexport const documentScannerAgent: AgentAdapter<DocumentScannerHandle> = {\n id: 'document-scanner',\n capabilities: ['capture', 'submit'],\n state: {\n hasCapture: {\n type: 'boolean',\n descriptionKey: 'documentScanner.agent.state.hasCapture',\n description: 'True when a captured or uploaded image is available.',\n read: (handle) => handle.hasCapture(),\n },\n phase: {\n type: 'string',\n descriptionKey: 'documentScanner.agent.state.phase',\n description:\n \"Lifecycle phase: 'idle' | 'requesting' | 'streaming' | 'captured' | 'error'.\",\n read: (handle) => handle.getPhase(),\n },\n },\n actions: {\n start_camera: {\n safety: 'write',\n idempotent: true,\n descriptionKey: 'documentScanner.agent.actions.startCamera',\n description: 'Request camera permission and begin the live viewfinder.',\n errors: [\n 'permission-denied',\n 'no-camera',\n 'not-readable',\n 'insecure-context',\n ],\n invoke: (handle) => handle.startCamera(),\n },\n capture: {\n safety: 'write',\n descriptionKey: 'documentScanner.agent.actions.capture',\n description: 'Freeze the current viewfinder frame as a captured image.',\n errors: ['capture-failed'],\n invoke: (handle) => handle.capture(),\n },\n submit: {\n safety: 'write',\n descriptionKey: 'documentScanner.agent.actions.confirm',\n description: 'Confirm the current capture, emitting it via onConfirm.',\n invoke: (handle) => {\n handle.confirm();\n },\n },\n retake: {\n safety: 'destructive',\n descriptionKey: 'documentScanner.agent.actions.retake',\n description:\n 'Discard the current capture and return to the capture path.',\n invoke: (handle) => {\n handle.retake();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'document-scanner',\n description: 'Marks the DocumentScanner wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* DocumentScanner — patient check-in ID-document capture. */\n/* */\n/* - Native MediaDevices: a live <video autoplay playsinline muted> */\n/* viewfinder via getUserMedia({ video: { facingMode } }), an */\n/* offscreen <canvas> for the freeze-frame / crop draw, and an <img> */\n/* for the captured preview. No third-party dependency for capture. */\n/* - Upload fallback: the existing kit FileUpload (variant='button') */\n/* handles accept / maxSize / reject and is ALWAYS reachable — even */\n/* on a hard camera error it is the recovery path (per HTP-5113). */\n/* - Lifecycle: the camera starts only on an explicit user gesture and */\n/* every MediaStreamTrack is stopped on unmount, on capture, on */\n/* error, on Escape, and on document visibilitychange→hidden so the */\n/* camera LED is released (privacy + battery). Mirrors */\n/* audio-recorder's teardown pattern. */\n/* - Confirm payload: { dataUrl, blob, source, width, height, mimeType, */\n/* byteSize, capturedAt (ISO-8601), sha256 }. sha256 is the */\n/* SubtleCrypto digest of the encoded bytes — tamper-evident for */\n/* audit, matching signature-capture. Document-only: no selfie, no */\n/* liveness, no OCR / MRZ / auto-crop (out of scope, would need a */\n/* separate 08-third-party dependency). */\n/* - Security: no fetch / XHR / localStorage / sessionStorage / globals */\n/* in this file — the captured ID document is PHI and the consumer */\n/* owns persistence + the \"already on file → skip\" decision. */\n/* ------------------------------------------------------------------ */\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Camera, RotateCcw, Check, LoaderCircle } from 'lucide-react';\nimport { Button } from '../button';\nimport { Alert } from '../alert';\nimport { FileUpload, type FileUploadRejection } from '../file-upload';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useAgentRegistration } from '../../agent';\nimport { documentScannerAgent } from './document-scanner.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type DocumentScannerSource = 'camera' | 'upload';\n\nexport interface DocumentCapture {\n /** Data URL of the captured / uploaded image (encoded to `mimeType`). */\n dataUrl: string;\n /** Encoded bytes as a Blob — the consumer persists this. */\n blob: Blob;\n /** Where the image came from. */\n source: DocumentScannerSource;\n /** Intrinsic pixel width of the encoded image. */\n width: number;\n /** Intrinsic pixel height of the encoded image. */\n height: number;\n /** MIME of the encoded image. */\n mimeType: string;\n /** Encoded byte size. */\n byteSize: number;\n /** ISO-8601 UTC timestamp for when the capture was confirmed. */\n capturedAt: string;\n /** Hex-encoded SHA-256 digest of the encoded bytes. */\n sha256: string;\n}\n\nexport type DocumentScannerErrorKind =\n | 'permission-denied'\n | 'no-camera'\n | 'not-readable'\n | 'insecure-context'\n | 'capture-failed'\n | 'file-invalid-type'\n | 'file-too-large';\n\nexport interface DocumentScannerError {\n kind: DocumentScannerErrorKind;\n}\n\nexport type DocumentType = 'tessera-sanitaria' | 'cie' | 'id-card' | 'generic';\n\nexport type DocumentScannerPhase =\n | 'idle'\n | 'requesting'\n | 'streaming'\n | 'captured'\n | 'error';\n\n/** Curated imperative handle for agent / external automation. */\nexport interface DocumentScannerHandle {\n /** True when a captured or uploaded image is held. */\n hasCapture: () => boolean;\n /** Current lifecycle phase. */\n getPhase: () => DocumentScannerPhase;\n /** Request the camera and begin the viewfinder. */\n startCamera: () => Promise<void> | void;\n /** Freeze the current viewfinder frame. */\n capture: () => Promise<void> | void;\n /** Confirm the current capture, firing `onConfirm`. */\n confirm: () => void;\n /** Discard the current capture and return to the capture path. */\n retake: () => void;\n}\n\nexport interface DocumentScannerProps {\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** Controlled captured-image value. When defined the component is controlled. */\n value?: DocumentCapture | null;\n /** Initial captured image for uncontrolled use; seeds the `captured` preview. */\n defaultValue?: DocumentCapture | null;\n /** Fired when the user confirms a captured or uploaded image. */\n onConfirm?: (capture: DocumentCapture) => void;\n /** Fired when the user discards the current capture to retake / re-upload. */\n onRetake?: () => void;\n /** Fired on a permission / hardware / decode failure (telemetry). */\n onError?: (error: DocumentScannerError) => void;\n /** Drives the overlay frame aspect ratio + the translated hint copy. */\n documentType?: DocumentType;\n /** Camera-vs-upload strategy. `auto` falls back to upload on camera failure. */\n captureMode?: 'auto' | 'camera-only' | 'upload-only';\n /** react-dropzone accept map for the upload fallback. */\n accept?: Record<string, string[]>;\n /** Max upload byte size. Defaults to 10MB. */\n maxSize?: number;\n /** Camera to request. Defaults to the rear (`environment`) camera. */\n facingMode?: 'environment' | 'user';\n /** MIME of the encoded capture. */\n outputType?: 'image/jpeg' | 'image/webp' | 'image/png';\n /** 0..1 quality for lossy `outputType`. Ignored for image/png. */\n outputQuality?: number;\n /** Crop the confirmed image to the overlay frame rect. */\n cropToFrame?: boolean;\n /** Disable all controls and skip the camera request. */\n disabled?: boolean;\n /** Accessible label for the component's group region. */\n ariaLabel?: string;\n /** Extra classes merged onto the outermost wrapper. */\n className?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst rootVariants = cva(\n [\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-md)]',\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--card-border)]',\n 'ds:shadow-[var(--shadow-card)] ds:[.theme-accessible_&]:border-2',\n 'ds:bg-[var(--background)] ds:text-[var(--foreground)]',\n 'ds:p-[var(--spacing-md)]',\n 'ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:[max-inline-size:20rem]',\n md: 'ds:[max-inline-size:28rem]',\n lg: 'ds:[max-inline-size:36rem]',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\n// The viewport is a positioned, neutral surface that holds the <video> /\n// <img> and the (absolutely-positioned, aria-hidden) frame overlay. The\n// document aspect ratio drives the box shape so the frame matches the card.\nconst viewportVariants = cva(\n [\n 'ds:relative ds:block ds:inline-size-full ds:overflow-hidden',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:bg-[var(--muted)]',\n ].join(' '),\n {\n variants: {\n // ID-1 cards (Tessera Sanitaria / CIE / id-card) are ~1.586:1; the\n // generic frame is a slightly squarer neutral card.\n frame: {\n 'tessera-sanitaria': 'ds:aspect-[1.586/1]',\n cie: 'ds:aspect-[1.586/1]',\n 'id-card': 'ds:aspect-[1.586/1]',\n generic: 'ds:aspect-[1.4/1]',\n },\n },\n defaultVariants: { frame: 'tessera-sanitaria' },\n },\n);\n\nconst mediaVariants = cva(\n [\n 'ds:absolute ds:inset-0 ds:block',\n 'ds:inline-size-full ds:block-size-full',\n 'ds:object-cover',\n ].join(' '),\n);\n\n// The alignment frame sits over arbitrary live video. It is a\n// high-contrast neutral stroke (var(--background) = white on light /\n// near-black on dark) backed by a tokenised scrim — NEVER the magenta\n// accent (fails AA over an unknown image). Decorative → aria-hidden.\nconst frameOverlayVariants = cva(\n [\n 'ds:pointer-events-none ds:absolute',\n 'ds:inset-[12%]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:border-2 ds:border-[color:var(--background)]',\n 'ds:shadow-[0_0_0_100vmax_color-mix(in_srgb,var(--foreground)_45%,transparent)]',\n ].join(' '),\n);\n\nconst cornerVariants = cva(\n [\n 'ds:pointer-events-none ds:absolute ds:size-6',\n 'ds:border-[color:var(--background)]',\n ].join(' '),\n);\n\nconst controlBarVariants = cva(\n [\n // Phone: actions stack full-width; sm+: a wrapping row.\n 'ds:flex ds:flex-col ds:items-stretch ds:gap-[var(--spacing-sm)]',\n 'ds:sm:flex-row ds:sm:flex-wrap ds:sm:items-center',\n ].join(' '),\n);\n\nconst hintVariants = cva(\n ['type-body-sm ds:text-center', 'ds:text-[var(--muted-foreground)]'].join(\n ' ',\n ),\n);\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction toHex(bytes: Uint8Array): string {\n let out = '';\n for (let i = 0; i < bytes.length; i += 1) {\n out += bytes[i].toString(16).padStart(2, '0');\n }\n return out;\n}\n\nasync function sha256Hex(buffer: ArrayBuffer): Promise<string> {\n const g = globalThis as { crypto?: Crypto };\n if (g.crypto?.subtle) {\n // Copy into a fresh ArrayBuffer so the BufferSource is never a\n // SharedArrayBuffer (SubtleCrypto's narrowing rejects the latter).\n const copy = new Uint8Array(buffer.byteLength);\n copy.set(new Uint8Array(buffer));\n const digest = await g.crypto.subtle.digest('SHA-256', copy.buffer);\n return toHex(new Uint8Array(digest));\n }\n // No subtle crypto (older test env) — return empty so the rest of the\n // payload is still usable. Tests stub crypto.subtle.\n return '';\n}\n\n/** Map a getUserMedia rejection (a DOMException) to our error kind. */\nfunction classifyMediaError(err: unknown): DocumentScannerErrorKind {\n const name = err instanceof Error ? err.name : '';\n if (name === 'NotAllowedError' || name === 'SecurityError') {\n return 'permission-denied';\n }\n if (name === 'NotFoundError' || name === 'OverconstrainedError') {\n return 'no-camera';\n }\n if (name === 'NotReadableError' || name === 'AbortError') {\n return 'not-readable';\n }\n return 'capture-failed';\n}\n\n/** True when getUserMedia is actually reachable (HTTPS / localhost + API). */\nfunction mediaDevicesAvailable(): boolean {\n return (\n typeof navigator !== 'undefined' &&\n typeof navigator.mediaDevices !== 'undefined' &&\n typeof navigator.mediaDevices.getUserMedia === 'function'\n );\n}\n\nconst HINT_KEY: Record<DocumentType, string> = {\n 'tessera-sanitaria': 'documentScanner.hint.tesseraSanitaria',\n cie: 'documentScanner.hint.cie',\n 'id-card': 'documentScanner.hint.idCard',\n generic: 'documentScanner.hint.generic',\n};\n\nconst ERROR_KEY: Record<DocumentScannerErrorKind, string> = {\n 'permission-denied': 'documentScanner.error.permissionDenied',\n 'no-camera': 'documentScanner.error.noCamera',\n 'not-readable': 'documentScanner.error.notReadable',\n 'insecure-context': 'documentScanner.error.insecureContext',\n 'capture-failed': 'documentScanner.error.captureFailed',\n 'file-invalid-type': 'documentScanner.error.fileInvalidType',\n 'file-too-large': 'documentScanner.error.fileTooLarge',\n};\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\ntype SizeVariant = NonNullable<VariantProps<typeof rootVariants>['size']>;\n\ninterface DocumentScannerInternalProps extends DocumentScannerProps {\n /** Visual size variant (exposed via Controls). */\n size?: SizeVariant;\n}\n\nexport const DocumentScanner = forwardRef<\n DocumentScannerHandle,\n DocumentScannerInternalProps\n>(\n (\n {\n id,\n value,\n defaultValue = null,\n onConfirm,\n onRetake,\n onError,\n documentType = 'tessera-sanitaria',\n captureMode = 'auto',\n accept = {\n 'image/jpeg': ['.jpg', '.jpeg'],\n 'image/png': ['.png'],\n 'image/webp': ['.webp'],\n },\n maxSize = 10 * 1024 * 1024,\n facingMode = 'environment',\n outputType = 'image/jpeg',\n outputQuality = 0.92,\n cropToFrame = true,\n disabled = false,\n size = 'md',\n ariaLabel,\n className,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const rawId = useId();\n const hintId = `ds-${rawId.replace(/[^a-zA-Z0-9-_]/g, '')}-hint`;\n\n // Controlled / uncontrolled captured value. `value` defined → controlled.\n const [capture, setCapture] = useControllableState<DocumentCapture | null>({\n value,\n defaultValue,\n });\n\n // Whether the captured value was seeded by `defaultValue` (already on\n // file) — drives the \"Already on file\" badge + Retake-only chrome.\n const seededRef = useRef<boolean>(defaultValue != null || value != null);\n\n const [phase, setPhase] = useState<DocumentScannerPhase>(\n defaultValue != null || value != null ? 'captured' : 'idle',\n );\n const [errorKind, setErrorKind] = useState<DocumentScannerErrorKind | null>(\n null,\n );\n const [streamReady, setStreamReady] = useState(false);\n // True while an uploaded image is being decoded (distinct from the\n // camera-permission `requesting` so the live region announces the right\n // \"Processing image\" copy).\n const [decoding, setDecoding] = useState(false);\n\n const videoRef = useRef<HTMLVideoElement>(null);\n const viewportRef = useRef<HTMLDivElement>(null);\n const streamRef = useRef<MediaStream | null>(null);\n const unmountedRef = useRef(false);\n\n const confirmBtnRef = useRef<HTMLButtonElement>(null);\n const shutterBtnRef = useRef<HTMLButtonElement>(null);\n const useCameraBtnRef = useRef<HTMLButtonElement>(null);\n const recoveryRef = useRef<HTMLButtonElement>(null);\n\n // Latest callbacks via refs so the async media path never closes over\n // a stale prop.\n const onErrorRef = useRef(onError);\n const onConfirmRef = useRef(onConfirm);\n const onRetakeRef = useRef(onRetake);\n useEffect(() => {\n onErrorRef.current = onError;\n onConfirmRef.current = onConfirm;\n onRetakeRef.current = onRetake;\n }, [onError, onConfirm, onRetake]);\n\n const isControlled = value !== undefined;\n const isUploadOnly = captureMode === 'upload-only';\n\n /* ---- Stream teardown — the single most important privacy path ---- */\n const stopStream = useCallback(() => {\n const held = streamRef.current;\n if (held) {\n held.getTracks().forEach((track) => track.stop());\n }\n streamRef.current = null;\n const video = videoRef.current;\n if (video) {\n // Detach so the element releases its reference to the (now-stopped)\n // stream and the browser drops the camera indicator.\n video.srcObject = null;\n }\n setStreamReady(false);\n }, []);\n\n const reportError = useCallback((kind: DocumentScannerErrorKind) => {\n setErrorKind(kind);\n setPhase('error');\n onErrorRef.current?.({ kind });\n }, []);\n\n /* ---- Start the camera — user gesture only, never auto on mount ---- */\n const startCamera = useCallback(async () => {\n if (disabled || isUploadOnly) return;\n if (!mediaDevicesAvailable()) {\n // No mediaDevices → insecure context (non-HTTPS) or unsupported.\n reportError('insecure-context');\n return;\n }\n setErrorKind(null);\n setPhase('requesting');\n try {\n const stream = await navigator.mediaDevices.getUserMedia({\n video: { facingMode },\n audio: false,\n });\n // Guard against an unmount between the permission prompt and\n // resolution — otherwise the freshly-acquired track leaks and the\n // camera LED stays live.\n if (unmountedRef.current) {\n stream.getTracks().forEach((track) => track.stop());\n return;\n }\n streamRef.current = stream;\n const video = videoRef.current;\n if (video) {\n try {\n video.srcObject = stream;\n } catch {\n // Some environments reject a non-native MediaStream on\n // srcObject; the stream is still held + torn down correctly.\n }\n // iOS Safari needs an explicit play() after attaching.\n const playResult = video.play?.();\n if (playResult && typeof playResult.catch === 'function') {\n playResult.catch(() => {\n /* autoplay can reject silently in some browsers; the\n loadedmetadata handler still enables the shutter */\n });\n }\n }\n setPhase('streaming');\n } catch (err: unknown) {\n stopStream();\n reportError(classifyMediaError(err));\n }\n }, [disabled, isUploadOnly, facingMode, stopStream, reportError]);\n\n /* ---- Shutter enablement: gate on the video actually playing ---- */\n const handleVideoReady = useCallback(() => {\n const video = videoRef.current;\n if (!video) return;\n // HAVE_CURRENT_DATA (2) means at least one frame is decodable.\n if (video.readyState >= 2) {\n setStreamReady(true);\n }\n }, []);\n\n /* ---- Poll readiness on entering streaming ---- */\n // The loadedmetadata / canplay events can fire before React attaches the\n // listeners (the metadata may already be decoded by the time the stream\n // is swapped onto the element). A short poll closes that race so the\n // shutter reliably enables.\n useEffect(() => {\n if (phase !== 'streaming') return undefined;\n handleVideoReady();\n const interval = window.setInterval(handleVideoReady, 100);\n const stopAfter = window.setTimeout(\n () => window.clearInterval(interval),\n 4000,\n );\n return () => {\n window.clearInterval(interval);\n window.clearTimeout(stopAfter);\n };\n }, [phase, handleVideoReady]);\n\n /* ---- Capture: freeze the current frame onto a canvas ---- */\n const capturePhoto = useCallback(async () => {\n const video = videoRef.current;\n if (!video || video.readyState < 2) {\n reportError('capture-failed');\n return;\n }\n const vw = video.videoWidth || video.clientWidth;\n const vh = video.videoHeight || video.clientHeight;\n if (vw === 0 || vh === 0) {\n reportError('capture-failed');\n return;\n }\n\n // Crop region in source-video pixel space. The overlay frame is\n // inset 12% on each edge of the viewport; mirror that onto the\n // source so the cropped image is the document, not the whole frame.\n let sx = 0;\n let sy = 0;\n let sw = vw;\n let sh = vh;\n if (cropToFrame) {\n const insetX = vw * 0.12;\n const insetY = vh * 0.12;\n sx = insetX;\n sy = insetY;\n sw = vw - insetX * 2;\n sh = vh - insetY * 2;\n }\n\n const canvas = document.createElement('canvas');\n canvas.width = Math.max(1, Math.round(sw));\n canvas.height = Math.max(1, Math.round(sh));\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n reportError('capture-failed');\n return;\n }\n try {\n ctx.drawImage(video, sx, sy, sw, sh, 0, 0, canvas.width, canvas.height);\n } catch {\n // A video element with no decoded frame throws InvalidStateError in\n // some browsers — surface it as a capture failure rather than crash.\n reportError('capture-failed');\n return;\n }\n\n // Release the camera as soon as the frame is frozen — we no longer\n // need the live stream and the LED should go dark immediately.\n stopStream();\n\n const blob = await new Promise<Blob | null>((resolve) => {\n if (typeof canvas.toBlob === 'function') {\n canvas.toBlob(\n (b) => resolve(b),\n outputType,\n outputType === 'image/png' ? undefined : outputQuality,\n );\n } else {\n resolve(null);\n }\n });\n if (!blob) {\n reportError('capture-failed');\n return;\n }\n const dataUrl = canvas.toDataURL(\n outputType,\n outputType === 'image/png' ? undefined : outputQuality,\n );\n const arrayBuffer = await blob.arrayBuffer();\n const sha256 = await sha256Hex(arrayBuffer);\n\n seededRef.current = false;\n const next: DocumentCapture = {\n dataUrl,\n blob,\n source: 'camera',\n width: canvas.width,\n height: canvas.height,\n mimeType: outputType,\n byteSize: blob.size,\n capturedAt: new Date().toISOString(),\n sha256,\n };\n setCapture(next);\n setPhase('captured');\n }, [\n cropToFrame,\n outputType,\n outputQuality,\n stopStream,\n reportError,\n setCapture,\n ]);\n\n /* ---- Upload fallback → decode an image File into a capture ---- */\n const handleUploadDrop = useCallback(\n async (accepted: File[]) => {\n const file = accepted[0];\n if (!file) return;\n setDecoding(true);\n try {\n const objectUrl = URL.createObjectURL(file);\n const dimensions = await new Promise<{ w: number; h: number }>(\n (resolve, reject) => {\n const img = new Image();\n img.onload = () =>\n resolve({ w: img.naturalWidth, h: img.naturalHeight });\n img.onerror = () => reject(new Error('decode-failed'));\n img.src = objectUrl;\n },\n ).finally(() => {\n // The object URL is only needed to read intrinsic dimensions;\n // the persisted payload carries a data URL instead.\n URL.revokeObjectURL(objectUrl);\n });\n\n const dataUrl = await new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(String(reader.result));\n reader.onerror = () => reject(new Error('read-failed'));\n reader.readAsDataURL(file);\n });\n\n const arrayBuffer = await file.arrayBuffer();\n const sha256 = await sha256Hex(arrayBuffer);\n\n seededRef.current = false;\n setErrorKind(null);\n setCapture({\n dataUrl,\n blob: file,\n source: 'upload',\n width: dimensions.w,\n height: dimensions.h,\n mimeType: file.type || outputType,\n byteSize: file.size,\n capturedAt: new Date().toISOString(),\n sha256,\n });\n setPhase('captured');\n } catch {\n reportError('capture-failed');\n } finally {\n setDecoding(false);\n }\n },\n [outputType, reportError, setCapture],\n );\n\n const handleUploadReject = useCallback(\n (rejections: FileUploadRejection[]) => {\n // FileUpload's reason enum is wider than our two error kinds. The\n // dropzone is locked to a single image (maxFiles:1, multiple:false),\n // so 'too-many-files' / 'file-too-small' are unreachable here; both\n // size/type problems fold into the matching inline message and\n // default to invalid-type for anything else.\n const reason = rejections[0]?.reason;\n const kind: DocumentScannerErrorKind =\n reason === 'file-too-large' ? 'file-too-large' : 'file-invalid-type';\n reportError(kind);\n },\n [reportError],\n );\n\n /* ---- Confirm / Retake ---- */\n const confirm = useCallback(() => {\n if (!capture) return;\n onConfirmRef.current?.(capture);\n }, [capture]);\n\n // Set when a user-initiated transition back to idle should move focus to\n // the Use-camera button (Retake). Distinguishes retake-to-idle from the\n // initial idle mount, so focus is never stolen on first paint.\n const focusUseCameraRef = useRef(false);\n\n const retake = useCallback(() => {\n // Controlled mode: retake is advisory only. The consumer owns `value`,\n // so we must NOT clear the capture, flip seededRef, or force a local\n // phase — doing so would race the controlled-value sync effect (which\n // re-asserts `captured` while value is still set), dropping the\n // \"already on file\" badge and surfacing a stray Confirm for an\n // already-persisted image. Emit onRetake and let the value drive phase.\n if (isControlled) {\n onRetakeRef.current?.();\n return;\n }\n seededRef.current = false;\n focusUseCameraRef.current = true;\n setCapture(null);\n setErrorKind(null);\n setDecoding(false);\n setPhase('idle');\n onRetakeRef.current?.();\n }, [isControlled, setCapture]);\n\n /* ---- Focus management on phase transitions ---- */\n useEffect(() => {\n if (phase === 'captured' && !seededRef.current) {\n // Land the keyboard / SR user on the next logical action.\n confirmBtnRef.current?.focus();\n } else if (phase === 'error') {\n recoveryRef.current?.focus();\n } else if (phase === 'idle' && focusUseCameraRef.current) {\n // After a Retake, return focus to the capture entry point. Never on\n // the initial idle mount (the flag is only set by retake()).\n focusUseCameraRef.current = false;\n useCameraBtnRef.current?.focus();\n }\n }, [phase]);\n\n /* ---- Escape from streaming returns to idle and stops the stream ---- */\n useEffect(() => {\n if (phase !== 'streaming') return undefined;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n stopStream();\n setPhase('idle');\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [phase, stopStream]);\n\n /* ---- Release the camera when the tab is hidden ---- */\n useEffect(() => {\n const onVisibility = () => {\n if (document.visibilityState === 'hidden' && streamRef.current) {\n stopStream();\n setPhase('idle');\n }\n };\n document.addEventListener('visibilitychange', onVisibility);\n return () =>\n document.removeEventListener('visibilitychange', onVisibility);\n }, [stopStream]);\n\n /* ---- Unmount cleanup: release the camera if still held ---- */\n useEffect(() => {\n return () => {\n unmountedRef.current = true;\n const held = streamRef.current;\n if (held) held.getTracks().forEach((track) => track.stop());\n streamRef.current = null;\n };\n }, []);\n\n /* ---- Sync controlled value → phase ---- */\n useEffect(() => {\n if (!isControlled) return;\n if (value != null) {\n setPhase('captured');\n } else if (phase === 'captured') {\n setPhase('idle');\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value, isControlled]);\n\n /* ---- Imperative handle + agent registration ---- */\n const agentHandle = useMemo<DocumentScannerHandle>(\n () => ({\n hasCapture: () => capture != null,\n getPhase: () => phase,\n startCamera: () => startCamera(),\n capture: () => capturePhoto(),\n confirm: () => confirm(),\n retake: () => retake(),\n }),\n [capture, phase, startCamera, capturePhoto, confirm, retake],\n );\n useImperativeHandle(ref, () => agentHandle, [agentHandle]);\n useAgentRegistration(documentScannerAgent, agentHandle, id);\n\n /* ---- Derived strings ---- */\n const regionLabel = ariaLabel ?? t('documentScanner.regionLabel');\n const hintText = t(HINT_KEY[documentType]);\n const maxSizeMb = Math.round(maxSize / (1024 * 1024));\n\n const statusText = (() => {\n if (decoding) return t('documentScanner.state.uploading');\n switch (phase) {\n case 'idle':\n return t('documentScanner.state.idle');\n case 'requesting':\n return t('documentScanner.state.requesting');\n case 'streaming':\n return t('documentScanner.state.streaming');\n case 'captured':\n return t('documentScanner.state.captured');\n case 'error':\n return errorKind\n ? t(ERROR_KEY[errorKind], { maxSizeMb })\n : t('documentScanner.error.captureFailed');\n }\n })();\n\n // A camera retry only makes sense for a hardware/permission failure —\n // not for upload-side rejections or an insecure (non-HTTPS) context.\n const canRetryCamera =\n !isUploadOnly &&\n errorKind !== 'file-invalid-type' &&\n errorKind !== 'file-too-large' &&\n errorKind !== 'insecure-context';\n\n // The upload affordance is always reachable: shown in idle/error for\n // auto + camera-only, primary in upload-only, and the recovery path on\n // any hard camera error.\n const showUploadFallback =\n !disabled &&\n (captureMode === 'auto' ||\n captureMode === 'upload-only' ||\n phase === 'error');\n\n const uploadAffordance = (\n <FileUpload\n variant=\"button\"\n accept={accept}\n maxSize={maxSize}\n multiple={false}\n maxFiles={1}\n disabled={disabled}\n showPreview={false}\n onDrop={(acceptedFiles) => {\n void handleUploadDrop(acceptedFiles);\n }}\n onReject={handleUploadReject}\n />\n );\n\n /* ---- Render ---- */\n const showViewport =\n phase === 'idle' ||\n phase === 'requesting' ||\n phase === 'streaming' ||\n phase === 'error';\n\n return (\n <div\n role=\"group\"\n aria-label={regionLabel}\n aria-disabled={disabled || undefined}\n className={[rootVariants({ size }), className]\n .filter(Boolean)\n .join(' ')}\n data-component=\"document-scanner\"\n data-component-id={id}\n data-phase={phase}\n >\n {/* Polite live region — announces every phase change to SR users. */}\n <span\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"ds:sr-only\"\n data-testid=\"document-scanner-live\"\n >\n {statusText}\n </span>\n\n {phase === 'captured' && capture ? (\n /* ---- Captured preview ---- */\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <div className={viewportVariants({ frame: documentType })}>\n <img\n src={capture.dataUrl}\n alt={t('documentScanner.previewAlt')}\n className={mediaVariants()}\n data-testid=\"document-scanner-preview\"\n />\n {seededRef.current ? (\n <span className=\"ds:absolute ds:top-[var(--spacing-sm)] ds:start-[var(--spacing-sm)] ds:rounded-[var(--radius-full)] ds:border ds:border-[color:color-mix(in_srgb,var(--foreground)_15%,transparent)] ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:py-[var(--spacing-2xs)] type-meta\">\n {t('documentScanner.onFileBadge')}\n </span>\n ) : null}\n </div>\n <div className={controlBarVariants()}>\n <Button\n intent=\"secondary\"\n size=\"md\"\n // Button's md variant is h-10 (40px) with no min-target\n // compensation — pin to --min-target-size (44/48px) to clear\n // WCAG 2.5.5, matching SignatureCapture's action buttons.\n className=\"ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]\"\n startIcon={<RotateCcw aria-hidden=\"true\" />}\n onClick={retake}\n disabled={disabled}\n >\n {t('documentScanner.retake')}\n </Button>\n {/* Seeded \"already on file\" images need no Confirm — they are\n already persisted; the only action is Retake. */}\n {seededRef.current ? null : (\n <Button\n ref={confirmBtnRef}\n intent=\"primary\"\n size=\"md\"\n className=\"ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]\"\n startIcon={<Check aria-hidden=\"true\" />}\n onClick={confirm}\n disabled={disabled || capture == null}\n >\n {t('documentScanner.confirm')}\n </Button>\n )}\n </div>\n </div>\n ) : null}\n\n {showViewport ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {/* Viewport — only meaningful while streaming/requesting; in\n idle/error it is a neutral placeholder behind the controls. */}\n {!isUploadOnly && phase !== 'error' ? (\n <div\n ref={viewportRef}\n className={viewportVariants({ frame: documentType })}\n aria-busy={phase === 'requesting' || undefined}\n >\n <video\n ref={videoRef}\n autoPlay\n playsInline\n muted\n aria-label={t('documentScanner.videoLabel')}\n className={mediaVariants()}\n onLoadedMetadata={handleVideoReady}\n onCanPlay={handleVideoReady}\n data-testid=\"document-scanner-video\"\n />\n {phase === 'requesting' ? (\n <div className=\"ds:absolute ds:inset-0 ds:flex ds:items-center ds:justify-center ds:bg-[color-mix(in_srgb,var(--foreground)_20%,transparent)]\">\n <LoaderCircle\n aria-hidden=\"true\"\n className=\"ds:size-8 ds:animate-spin ds:text-[var(--background)] ds:motion-reduce:animate-none\"\n />\n </div>\n ) : null}\n {/* Decorative alignment frame + corner guides. */}\n <div\n aria-hidden=\"true\"\n className={frameOverlayVariants()}\n data-testid=\"document-scanner-frame\"\n >\n <span\n className={[\n cornerVariants(),\n 'ds:top-0 ds:start-0 ds:border-t-2 ds:border-s-2 ds:rounded-ss-[var(--radius-sm)]',\n ].join(' ')}\n />\n <span\n className={[\n cornerVariants(),\n 'ds:top-0 ds:end-0 ds:border-t-2 ds:border-e-2 ds:rounded-se-[var(--radius-sm)]',\n ].join(' ')}\n />\n <span\n className={[\n cornerVariants(),\n 'ds:bottom-0 ds:start-0 ds:border-b-2 ds:border-s-2 ds:rounded-es-[var(--radius-sm)]',\n ].join(' ')}\n />\n <span\n className={[\n cornerVariants(),\n 'ds:bottom-0 ds:end-0 ds:border-b-2 ds:border-e-2 ds:rounded-ee-[var(--radius-sm)]',\n ].join(' ')}\n />\n </div>\n </div>\n ) : null}\n\n {phase === 'streaming' ? (\n <p id={hintId} className={hintVariants()}>\n {hintText}\n </p>\n ) : null}\n\n {/* Error block — Alert pattern with the upload recovery path. */}\n {phase === 'error' && errorKind ? (\n <Alert variant=\"error\" live=\"assertive\">\n <Alert.Description>\n {t(ERROR_KEY[errorKind], { maxSizeMb })}\n </Alert.Description>\n <Alert.Action>\n {/* The camera-retry button is the focus target on a\n hardware/permission error; for upload-side or\n insecure-context errors there is nothing to retry and\n the upload affordance is the recovery path. */}\n {canRetryCamera ? (\n <Button\n ref={recoveryRef}\n intent=\"secondary\"\n size=\"sm\"\n onClick={() => {\n void startCamera();\n }}\n disabled={disabled}\n >\n {t('documentScanner.retry')}\n </Button>\n ) : null}\n {showUploadFallback ? uploadAffordance : null}\n </Alert.Action>\n </Alert>\n ) : null}\n\n {/* Primary control bar (no hard error). */}\n {phase !== 'error' ? (\n <div className={controlBarVariants()}>\n {phase === 'streaming' ? (\n <Button\n ref={shutterBtnRef}\n intent=\"primary\"\n size=\"lg\"\n startIcon={<Camera aria-hidden=\"true\" />}\n onClick={() => {\n void capturePhoto();\n }}\n disabled={disabled || !streamReady}\n aria-describedby={hintId}\n aria-label={t('documentScanner.capture')}\n >\n {t('documentScanner.capture')}\n </Button>\n ) : null}\n\n {(phase === 'idle' || phase === 'requesting') &&\n !isUploadOnly ? (\n <Button\n ref={useCameraBtnRef}\n intent=\"primary\"\n size=\"md\"\n className=\"ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]\"\n loading={phase === 'requesting'}\n startIcon={<Camera aria-hidden=\"true\" />}\n onClick={() => {\n void startCamera();\n }}\n disabled={disabled}\n >\n {t('documentScanner.useCamera')}\n </Button>\n ) : null}\n\n {decoding ? (\n <span className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-body-sm ds:text-[var(--muted-foreground)]\">\n <LoaderCircle\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:animate-spin ds:motion-reduce:animate-none\"\n />\n {t('documentScanner.state.uploading')}\n </span>\n ) : showUploadFallback && phase !== 'streaming' ? (\n uploadAffordance\n ) : null}\n\n {/* In streaming, upload stays reachable as a low-emphasis\n fallback below the shutter. */}\n {phase === 'streaming' && captureMode !== 'camera-only'\n ? uploadAffordance\n : null}\n </div>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n },\n);\n\nDocumentScanner.displayName = 'DocumentScanner';\n\nexport {\n rootVariants as documentScannerRootVariants,\n viewportVariants as documentScannerViewportVariants,\n};\n"],"names":["documentScannerAgent","handle","rootVariants","cva","viewportVariants","mediaVariants","frameOverlayVariants","cornerVariants","controlBarVariants","hintVariants","toHex","bytes","out","i","sha256Hex","buffer","g","_a","copy","digest","classifyMediaError","err","name","mediaDevicesAvailable","HINT_KEY","ERROR_KEY","DocumentScanner","forwardRef","id","value","defaultValue","onConfirm","onRetake","onError","documentType","captureMode","accept","maxSize","facingMode","outputType","outputQuality","cropToFrame","disabled","size","ariaLabel","className","ref","t","useTranslation","hintId","useId","capture","setCapture","useControllableState","seededRef","useRef","phase","setPhase","useState","errorKind","setErrorKind","streamReady","setStreamReady","decoding","setDecoding","videoRef","viewportRef","streamRef","unmountedRef","confirmBtnRef","shutterBtnRef","useCameraBtnRef","recoveryRef","onErrorRef","onConfirmRef","onRetakeRef","useEffect","isControlled","isUploadOnly","stopStream","useCallback","held","track","video","reportError","kind","startCamera","stream","playResult","handleVideoReady","interval","stopAfter","capturePhoto","vw","vh","sx","sy","sw","sh","insetX","insetY","canvas","ctx","blob","resolve","b","dataUrl","arrayBuffer","sha256","next","handleUploadDrop","accepted","file","objectUrl","dimensions","reject","img","reader","handleUploadReject","rejections","confirm","focusUseCameraRef","retake","_b","_c","onKeyDown","event","onVisibility","agentHandle","useMemo","useImperativeHandle","useAgentRegistration","regionLabel","hintText","maxSizeMb","statusText","canRetryCamera","showUploadFallback","uploadAffordance","jsx","FileUpload","acceptedFiles","showViewport","jsxs","Button","RotateCcw","Check","LoaderCircle","Alert","Camera"],"mappings":";;;;;;;;;;;;AAUO,MAAMA,KAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAC,WAAW,QAAQ;AAAA,EAClC,OAAO;AAAA,IACL,YAAY;AAAA,MACV,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,WAAA;AAAA,IAAW;AAAA,IAEtC,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,EACpC;AAAA,EAEF,SAAS;AAAA,IACP,cAAc;AAAA,MACZ,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,QAAQ;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAEF,QAAQ,CAACA,MAAWA,EAAO,YAAA;AAAA,IAAY;AAAA,IAEzC,SAAS;AAAA,MACP,QAAQ;AAAA,MACR,gBAAgB;AAAA,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A;AAAA,kBACC,KAAKzE;AAAA,kBACL,QAAO;AAAA,kBACP,MAAK;AAAA,kBACL,WAAU;AAAA,kBACV,SAASf,MAAU;AAAA,kBACnB,WAAW,gBAAAmF,EAACU,IAAA,EAAO,eAAY,OAAA,CAAO;AAAA,kBACtC,SAAS,MAAM;AACb,oBAAK/D,EAAA;AAAA,kBACP;AAAA,kBACA,UAAA5C;AAAA,kBAEC,YAAE,2BAA2B;AAAA,gBAAA;AAAA,cAAA,IAE9B;AAAA,cAEHqB,KACC,gBAAAgF,EAAC,QAAA,EAAK,WAAU,4GACd,UAAA;AAAA,gBAAA,gBAAAJ;AAAA,kBAACQ;AAAA,kBAAA;AAAA,oBACC,eAAY;AAAA,oBACZ,WAAU;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAEXpG,EAAE,iCAAiC;AAAA,cAAA,EAAA,CACtC,IACE0F,MAAsBjF,MAAU,cAClCkF,KACE;AAAA,cAIHlF,MAAU,eAAerB,MAAgB,gBACtCuG,KACA;AAAA,YAAA,EAAA,CACN,IACE;AAAA,UAAA,EAAA,CACN,IACE;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AAEAhH,GAAgB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"document-scanner-BRYIc3A-.js","sources":["../../src/components/document-scanner/document-scanner.agent.ts","../../src/components/document-scanner/document-scanner.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — DocumentScanner. */\n/* */\n/* State exposes only structural lifecycle info — never the captured */\n/* image bytes (PHI). Actions drive the camera + capture flow. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DocumentScannerHandle } from './document-scanner';\n\nexport const documentScannerAgent: AgentAdapter<DocumentScannerHandle> = {\n id: 'document-scanner',\n capabilities: ['capture', 'submit'],\n state: {\n hasCapture: {\n type: 'boolean',\n descriptionKey: 'documentScanner.agent.state.hasCapture',\n description: 'True when a captured or uploaded image is available.',\n read: (handle) => handle.hasCapture(),\n },\n phase: {\n type: 'string',\n descriptionKey: 'documentScanner.agent.state.phase',\n description:\n \"Lifecycle phase: 'idle' | 'requesting' | 'streaming' | 'captured' | 'error'.\",\n read: (handle) => handle.getPhase(),\n },\n },\n actions: {\n start_camera: {\n safety: 'write',\n idempotent: true,\n descriptionKey: 'documentScanner.agent.actions.startCamera',\n description: 'Request camera permission and begin the live viewfinder.',\n errors: [\n 'permission-denied',\n 'no-camera',\n 'not-readable',\n 'insecure-context',\n ],\n invoke: (handle) => handle.startCamera(),\n },\n capture: {\n safety: 'write',\n descriptionKey: 'documentScanner.agent.actions.capture',\n description: 'Freeze the current viewfinder frame as a captured image.',\n errors: ['capture-failed'],\n invoke: (handle) => handle.capture(),\n },\n submit: {\n safety: 'write',\n descriptionKey: 'documentScanner.agent.actions.confirm',\n description: 'Confirm the current capture, emitting it via onConfirm.',\n invoke: (handle) => {\n handle.confirm();\n },\n },\n retake: {\n safety: 'destructive',\n descriptionKey: 'documentScanner.agent.actions.retake',\n description:\n 'Discard the current capture and return to the capture path.',\n invoke: (handle) => {\n handle.retake();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'document-scanner',\n description: 'Marks the DocumentScanner wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* DocumentScanner — patient check-in ID-document capture. */\n/* */\n/* - Native MediaDevices: a live <video autoplay playsinline muted> */\n/* viewfinder via getUserMedia({ video: { facingMode } }), an */\n/* offscreen <canvas> for the freeze-frame / crop draw, and an <img> */\n/* for the captured preview. No third-party dependency for capture. */\n/* - Upload fallback: the existing kit FileUpload (variant='button') */\n/* handles accept / maxSize / reject and is ALWAYS reachable — even */\n/* on a hard camera error it is the recovery path (per HTP-5113). */\n/* - Lifecycle: the camera starts only on an explicit user gesture and */\n/* every MediaStreamTrack is stopped on unmount, on capture, on */\n/* error, on Escape, and on document visibilitychange→hidden so the */\n/* camera LED is released (privacy + battery). Mirrors */\n/* audio-recorder's teardown pattern. */\n/* - Confirm payload: { dataUrl, blob, source, width, height, mimeType, */\n/* byteSize, capturedAt (ISO-8601), sha256 }. sha256 is the */\n/* SubtleCrypto digest of the encoded bytes — tamper-evident for */\n/* audit, matching signature-capture. Document-only: no selfie, no */\n/* liveness, no OCR / MRZ / auto-crop (out of scope, would need a */\n/* separate 08-third-party dependency). */\n/* - Security: no fetch / XHR / localStorage / sessionStorage / globals */\n/* in this file — the captured ID document is PHI and the consumer */\n/* owns persistence + the \"already on file → skip\" decision. */\n/* ------------------------------------------------------------------ */\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Camera, RotateCcw, Check, LoaderCircle } from 'lucide-react';\nimport { Button } from '../button';\nimport { Alert } from '../alert';\nimport { FileUpload, type FileUploadRejection } from '../file-upload';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useAgentRegistration } from '../../agent';\nimport { documentScannerAgent } from './document-scanner.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type DocumentScannerSource = 'camera' | 'upload';\n\nexport interface DocumentCapture {\n /** Data URL of the captured / uploaded image (encoded to `mimeType`). */\n dataUrl: string;\n /** Encoded bytes as a Blob — the consumer persists this. */\n blob: Blob;\n /** Where the image came from. */\n source: DocumentScannerSource;\n /** Intrinsic pixel width of the encoded image. */\n width: number;\n /** Intrinsic pixel height of the encoded image. */\n height: number;\n /** MIME of the encoded image. */\n mimeType: string;\n /** Encoded byte size. */\n byteSize: number;\n /** ISO-8601 UTC timestamp for when the capture was confirmed. */\n capturedAt: string;\n /** Hex-encoded SHA-256 digest of the encoded bytes. */\n sha256: string;\n}\n\nexport type DocumentScannerErrorKind =\n | 'permission-denied'\n | 'no-camera'\n | 'not-readable'\n | 'insecure-context'\n | 'capture-failed'\n | 'file-invalid-type'\n | 'file-too-large';\n\nexport interface DocumentScannerError {\n kind: DocumentScannerErrorKind;\n}\n\nexport type DocumentType = 'tessera-sanitaria' | 'cie' | 'id-card' | 'generic';\n\nexport type DocumentScannerPhase =\n | 'idle'\n | 'requesting'\n | 'streaming'\n | 'captured'\n | 'error';\n\n/** Curated imperative handle for agent / external automation. */\nexport interface DocumentScannerHandle {\n /** True when a captured or uploaded image is held. */\n hasCapture: () => boolean;\n /** Current lifecycle phase. */\n getPhase: () => DocumentScannerPhase;\n /** Request the camera and begin the viewfinder. */\n startCamera: () => Promise<void> | void;\n /** Freeze the current viewfinder frame. */\n capture: () => Promise<void> | void;\n /** Confirm the current capture, firing `onConfirm`. */\n confirm: () => void;\n /** Discard the current capture and return to the capture path. */\n retake: () => void;\n}\n\nexport interface DocumentScannerProps {\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** Controlled captured-image value. When defined the component is controlled. */\n value?: DocumentCapture | null;\n /** Initial captured image for uncontrolled use; seeds the `captured` preview. */\n defaultValue?: DocumentCapture | null;\n /** Fired when the user confirms a captured or uploaded image. */\n onConfirm?: (capture: DocumentCapture) => void;\n /** Fired when the user discards the current capture to retake / re-upload. */\n onRetake?: () => void;\n /** Fired on a permission / hardware / decode failure (telemetry). */\n onError?: (error: DocumentScannerError) => void;\n /** Drives the overlay frame aspect ratio + the translated hint copy. */\n documentType?: DocumentType;\n /** Camera-vs-upload strategy. `auto` falls back to upload on camera failure. */\n captureMode?: 'auto' | 'camera-only' | 'upload-only';\n /** react-dropzone accept map for the upload fallback. */\n accept?: Record<string, string[]>;\n /** Max upload byte size. Defaults to 10MB. */\n maxSize?: number;\n /** Camera to request. Defaults to the rear (`environment`) camera. */\n facingMode?: 'environment' | 'user';\n /** MIME of the encoded capture. */\n outputType?: 'image/jpeg' | 'image/webp' | 'image/png';\n /** 0..1 quality for lossy `outputType`. Ignored for image/png. */\n outputQuality?: number;\n /** Crop the confirmed image to the overlay frame rect. */\n cropToFrame?: boolean;\n /** Disable all controls and skip the camera request. */\n disabled?: boolean;\n /** Accessible label for the component's group region. */\n ariaLabel?: string;\n /** Extra classes merged onto the outermost wrapper. */\n className?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst rootVariants = cva(\n [\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-md)]',\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--card-border)]',\n 'ds:shadow-[var(--shadow-card)] ds:[.theme-accessible_&]:border-2',\n 'ds:bg-[var(--background)] ds:text-[var(--foreground)]',\n 'ds:p-[var(--spacing-md)]',\n 'ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:[max-inline-size:20rem]',\n md: 'ds:[max-inline-size:28rem]',\n lg: 'ds:[max-inline-size:36rem]',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\n// The viewport is a positioned, neutral surface that holds the <video> /\n// <img> and the (absolutely-positioned, aria-hidden) frame overlay. The\n// document aspect ratio drives the box shape so the frame matches the card.\nconst viewportVariants = cva(\n [\n 'ds:relative ds:block ds:inline-size-full ds:overflow-hidden',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:bg-[var(--muted)]',\n ].join(' '),\n {\n variants: {\n // ID-1 cards (Tessera Sanitaria / CIE / id-card) are ~1.586:1; the\n // generic frame is a slightly squarer neutral card.\n frame: {\n 'tessera-sanitaria': 'ds:aspect-[1.586/1]',\n cie: 'ds:aspect-[1.586/1]',\n 'id-card': 'ds:aspect-[1.586/1]',\n generic: 'ds:aspect-[1.4/1]',\n },\n },\n defaultVariants: { frame: 'tessera-sanitaria' },\n },\n);\n\nconst mediaVariants = cva(\n [\n 'ds:absolute ds:inset-0 ds:block',\n 'ds:inline-size-full ds:block-size-full',\n 'ds:object-cover',\n ].join(' '),\n);\n\n// The alignment frame sits over arbitrary live video. It is a\n// high-contrast neutral stroke (var(--background) = white on light /\n// near-black on dark) backed by a tokenised scrim — NEVER the magenta\n// accent (fails AA over an unknown image). Decorative → aria-hidden.\nconst frameOverlayVariants = cva(\n [\n 'ds:pointer-events-none ds:absolute',\n 'ds:inset-[12%]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:border-2 ds:border-[color:var(--background)]',\n 'ds:shadow-[0_0_0_100vmax_color-mix(in_srgb,var(--foreground)_45%,transparent)]',\n ].join(' '),\n);\n\nconst cornerVariants = cva(\n [\n 'ds:pointer-events-none ds:absolute ds:size-6',\n 'ds:border-[color:var(--background)]',\n ].join(' '),\n);\n\nconst controlBarVariants = cva(\n [\n // Phone: actions stack full-width; sm+: a wrapping row.\n 'ds:flex ds:flex-col ds:items-stretch ds:gap-[var(--spacing-sm)]',\n 'ds:sm:flex-row ds:sm:flex-wrap ds:sm:items-center',\n ].join(' '),\n);\n\nconst hintVariants = cva(\n ['type-body-sm ds:text-center', 'ds:text-[var(--muted-foreground)]'].join(\n ' ',\n ),\n);\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction toHex(bytes: Uint8Array): string {\n let out = '';\n for (let i = 0; i < bytes.length; i += 1) {\n out += bytes[i].toString(16).padStart(2, '0');\n }\n return out;\n}\n\nasync function sha256Hex(buffer: ArrayBuffer): Promise<string> {\n const g = globalThis as { crypto?: Crypto };\n if (g.crypto?.subtle) {\n // Copy into a fresh ArrayBuffer so the BufferSource is never a\n // SharedArrayBuffer (SubtleCrypto's narrowing rejects the latter).\n const copy = new Uint8Array(buffer.byteLength);\n copy.set(new Uint8Array(buffer));\n const digest = await g.crypto.subtle.digest('SHA-256', copy.buffer);\n return toHex(new Uint8Array(digest));\n }\n // No subtle crypto (older test env) — return empty so the rest of the\n // payload is still usable. Tests stub crypto.subtle.\n return '';\n}\n\n/** Map a getUserMedia rejection (a DOMException) to our error kind. */\nfunction classifyMediaError(err: unknown): DocumentScannerErrorKind {\n const name = err instanceof Error ? err.name : '';\n if (name === 'NotAllowedError' || name === 'SecurityError') {\n return 'permission-denied';\n }\n if (name === 'NotFoundError' || name === 'OverconstrainedError') {\n return 'no-camera';\n }\n if (name === 'NotReadableError' || name === 'AbortError') {\n return 'not-readable';\n }\n return 'capture-failed';\n}\n\n/** True when getUserMedia is actually reachable (HTTPS / localhost + API). */\nfunction mediaDevicesAvailable(): boolean {\n return (\n typeof navigator !== 'undefined' &&\n typeof navigator.mediaDevices !== 'undefined' &&\n typeof navigator.mediaDevices.getUserMedia === 'function'\n );\n}\n\nconst HINT_KEY: Record<DocumentType, string> = {\n 'tessera-sanitaria': 'documentScanner.hint.tesseraSanitaria',\n cie: 'documentScanner.hint.cie',\n 'id-card': 'documentScanner.hint.idCard',\n generic: 'documentScanner.hint.generic',\n};\n\nconst ERROR_KEY: Record<DocumentScannerErrorKind, string> = {\n 'permission-denied': 'documentScanner.error.permissionDenied',\n 'no-camera': 'documentScanner.error.noCamera',\n 'not-readable': 'documentScanner.error.notReadable',\n 'insecure-context': 'documentScanner.error.insecureContext',\n 'capture-failed': 'documentScanner.error.captureFailed',\n 'file-invalid-type': 'documentScanner.error.fileInvalidType',\n 'file-too-large': 'documentScanner.error.fileTooLarge',\n};\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\ntype SizeVariant = NonNullable<VariantProps<typeof rootVariants>['size']>;\n\ninterface DocumentScannerInternalProps extends DocumentScannerProps {\n /** Visual size variant (exposed via Controls). */\n size?: SizeVariant;\n}\n\nexport const DocumentScanner = forwardRef<\n DocumentScannerHandle,\n DocumentScannerInternalProps\n>(\n (\n {\n id,\n value,\n defaultValue = null,\n onConfirm,\n onRetake,\n onError,\n documentType = 'tessera-sanitaria',\n captureMode = 'auto',\n accept = {\n 'image/jpeg': ['.jpg', '.jpeg'],\n 'image/png': ['.png'],\n 'image/webp': ['.webp'],\n },\n maxSize = 10 * 1024 * 1024,\n facingMode = 'environment',\n outputType = 'image/jpeg',\n outputQuality = 0.92,\n cropToFrame = true,\n disabled = false,\n size = 'md',\n ariaLabel,\n className,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const rawId = useId();\n const hintId = `ds-${rawId.replace(/[^a-zA-Z0-9-_]/g, '')}-hint`;\n\n // Controlled / uncontrolled captured value. `value` defined → controlled.\n const [capture, setCapture] = useControllableState<DocumentCapture | null>({\n value,\n defaultValue,\n });\n\n // Whether the captured value was seeded by `defaultValue` (already on\n // file) — drives the \"Already on file\" badge + Retake-only chrome.\n const seededRef = useRef<boolean>(defaultValue != null || value != null);\n\n const [phase, setPhase] = useState<DocumentScannerPhase>(\n defaultValue != null || value != null ? 'captured' : 'idle',\n );\n const [errorKind, setErrorKind] = useState<DocumentScannerErrorKind | null>(\n null,\n );\n const [streamReady, setStreamReady] = useState(false);\n // True while an uploaded image is being decoded (distinct from the\n // camera-permission `requesting` so the live region announces the right\n // \"Processing image\" copy).\n const [decoding, setDecoding] = useState(false);\n\n const videoRef = useRef<HTMLVideoElement>(null);\n const viewportRef = useRef<HTMLDivElement>(null);\n const streamRef = useRef<MediaStream | null>(null);\n const unmountedRef = useRef(false);\n\n const confirmBtnRef = useRef<HTMLButtonElement>(null);\n const shutterBtnRef = useRef<HTMLButtonElement>(null);\n const useCameraBtnRef = useRef<HTMLButtonElement>(null);\n const recoveryRef = useRef<HTMLButtonElement>(null);\n\n // Latest callbacks via refs so the async media path never closes over\n // a stale prop.\n const onErrorRef = useRef(onError);\n const onConfirmRef = useRef(onConfirm);\n const onRetakeRef = useRef(onRetake);\n useEffect(() => {\n onErrorRef.current = onError;\n onConfirmRef.current = onConfirm;\n onRetakeRef.current = onRetake;\n }, [onError, onConfirm, onRetake]);\n\n const isControlled = value !== undefined;\n const isUploadOnly = captureMode === 'upload-only';\n\n /* ---- Stream teardown — the single most important privacy path ---- */\n const stopStream = useCallback(() => {\n const held = streamRef.current;\n if (held) {\n held.getTracks().forEach((track) => track.stop());\n }\n streamRef.current = null;\n const video = videoRef.current;\n if (video) {\n // Detach so the element releases its reference to the (now-stopped)\n // stream and the browser drops the camera indicator.\n video.srcObject = null;\n }\n setStreamReady(false);\n }, []);\n\n const reportError = useCallback((kind: DocumentScannerErrorKind) => {\n setErrorKind(kind);\n setPhase('error');\n onErrorRef.current?.({ kind });\n }, []);\n\n /* ---- Start the camera — user gesture only, never auto on mount ---- */\n const startCamera = useCallback(async () => {\n if (disabled || isUploadOnly) return;\n if (!mediaDevicesAvailable()) {\n // No mediaDevices → insecure context (non-HTTPS) or unsupported.\n reportError('insecure-context');\n return;\n }\n setErrorKind(null);\n setPhase('requesting');\n try {\n const stream = await navigator.mediaDevices.getUserMedia({\n video: { facingMode },\n audio: false,\n });\n // Guard against an unmount between the permission prompt and\n // resolution — otherwise the freshly-acquired track leaks and the\n // camera LED stays live.\n if (unmountedRef.current) {\n stream.getTracks().forEach((track) => track.stop());\n return;\n }\n streamRef.current = stream;\n const video = videoRef.current;\n if (video) {\n try {\n video.srcObject = stream;\n } catch {\n // Some environments reject a non-native MediaStream on\n // srcObject; the stream is still held + torn down correctly.\n }\n // iOS Safari needs an explicit play() after attaching.\n const playResult = video.play?.();\n if (playResult && typeof playResult.catch === 'function') {\n playResult.catch(() => {\n /* autoplay can reject silently in some browsers; the\n loadedmetadata handler still enables the shutter */\n });\n }\n }\n setPhase('streaming');\n } catch (err: unknown) {\n stopStream();\n reportError(classifyMediaError(err));\n }\n }, [disabled, isUploadOnly, facingMode, stopStream, reportError]);\n\n /* ---- Shutter enablement: gate on the video actually playing ---- */\n const handleVideoReady = useCallback(() => {\n const video = videoRef.current;\n if (!video) return;\n // HAVE_CURRENT_DATA (2) means at least one frame is decodable.\n if (video.readyState >= 2) {\n setStreamReady(true);\n }\n }, []);\n\n /* ---- Poll readiness on entering streaming ---- */\n // The loadedmetadata / canplay events can fire before React attaches the\n // listeners (the metadata may already be decoded by the time the stream\n // is swapped onto the element). A short poll closes that race so the\n // shutter reliably enables.\n useEffect(() => {\n if (phase !== 'streaming') return undefined;\n handleVideoReady();\n const interval = window.setInterval(handleVideoReady, 100);\n const stopAfter = window.setTimeout(\n () => window.clearInterval(interval),\n 4000,\n );\n return () => {\n window.clearInterval(interval);\n window.clearTimeout(stopAfter);\n };\n }, [phase, handleVideoReady]);\n\n /* ---- Capture: freeze the current frame onto a canvas ---- */\n const capturePhoto = useCallback(async () => {\n const video = videoRef.current;\n if (!video || video.readyState < 2) {\n reportError('capture-failed');\n return;\n }\n const vw = video.videoWidth || video.clientWidth;\n const vh = video.videoHeight || video.clientHeight;\n if (vw === 0 || vh === 0) {\n reportError('capture-failed');\n return;\n }\n\n // Crop region in source-video pixel space. The overlay frame is\n // inset 12% on each edge of the viewport; mirror that onto the\n // source so the cropped image is the document, not the whole frame.\n let sx = 0;\n let sy = 0;\n let sw = vw;\n let sh = vh;\n if (cropToFrame) {\n const insetX = vw * 0.12;\n const insetY = vh * 0.12;\n sx = insetX;\n sy = insetY;\n sw = vw - insetX * 2;\n sh = vh - insetY * 2;\n }\n\n const canvas = document.createElement('canvas');\n canvas.width = Math.max(1, Math.round(sw));\n canvas.height = Math.max(1, Math.round(sh));\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n reportError('capture-failed');\n return;\n }\n try {\n ctx.drawImage(video, sx, sy, sw, sh, 0, 0, canvas.width, canvas.height);\n } catch {\n // A video element with no decoded frame throws InvalidStateError in\n // some browsers — surface it as a capture failure rather than crash.\n reportError('capture-failed');\n return;\n }\n\n // Release the camera as soon as the frame is frozen — we no longer\n // need the live stream and the LED should go dark immediately.\n stopStream();\n\n const blob = await new Promise<Blob | null>((resolve) => {\n if (typeof canvas.toBlob === 'function') {\n canvas.toBlob(\n (b) => resolve(b),\n outputType,\n outputType === 'image/png' ? undefined : outputQuality,\n );\n } else {\n resolve(null);\n }\n });\n if (!blob) {\n reportError('capture-failed');\n return;\n }\n const dataUrl = canvas.toDataURL(\n outputType,\n outputType === 'image/png' ? undefined : outputQuality,\n );\n const arrayBuffer = await blob.arrayBuffer();\n const sha256 = await sha256Hex(arrayBuffer);\n\n seededRef.current = false;\n const next: DocumentCapture = {\n dataUrl,\n blob,\n source: 'camera',\n width: canvas.width,\n height: canvas.height,\n mimeType: outputType,\n byteSize: blob.size,\n capturedAt: new Date().toISOString(),\n sha256,\n };\n setCapture(next);\n setPhase('captured');\n }, [\n cropToFrame,\n outputType,\n outputQuality,\n stopStream,\n reportError,\n setCapture,\n ]);\n\n /* ---- Upload fallback → decode an image File into a capture ---- */\n const handleUploadDrop = useCallback(\n async (accepted: File[]) => {\n const file = accepted[0];\n if (!file) return;\n setDecoding(true);\n try {\n const objectUrl = URL.createObjectURL(file);\n const dimensions = await new Promise<{ w: number; h: number }>(\n (resolve, reject) => {\n const img = new Image();\n img.onload = () =>\n resolve({ w: img.naturalWidth, h: img.naturalHeight });\n img.onerror = () => reject(new Error('decode-failed'));\n img.src = objectUrl;\n },\n ).finally(() => {\n // The object URL is only needed to read intrinsic dimensions;\n // the persisted payload carries a data URL instead.\n URL.revokeObjectURL(objectUrl);\n });\n\n const dataUrl = await new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(String(reader.result));\n reader.onerror = () => reject(new Error('read-failed'));\n reader.readAsDataURL(file);\n });\n\n const arrayBuffer = await file.arrayBuffer();\n const sha256 = await sha256Hex(arrayBuffer);\n\n seededRef.current = false;\n setErrorKind(null);\n setCapture({\n dataUrl,\n blob: file,\n source: 'upload',\n width: dimensions.w,\n height: dimensions.h,\n mimeType: file.type || outputType,\n byteSize: file.size,\n capturedAt: new Date().toISOString(),\n sha256,\n });\n setPhase('captured');\n } catch {\n reportError('capture-failed');\n } finally {\n setDecoding(false);\n }\n },\n [outputType, reportError, setCapture],\n );\n\n const handleUploadReject = useCallback(\n (rejections: FileUploadRejection[]) => {\n // FileUpload's reason enum is wider than our two error kinds. The\n // dropzone is locked to a single image (maxFiles:1, multiple:false),\n // so 'too-many-files' / 'file-too-small' are unreachable here; both\n // size/type problems fold into the matching inline message and\n // default to invalid-type for anything else.\n const reason = rejections[0]?.reason;\n const kind: DocumentScannerErrorKind =\n reason === 'file-too-large' ? 'file-too-large' : 'file-invalid-type';\n reportError(kind);\n },\n [reportError],\n );\n\n /* ---- Confirm / Retake ---- */\n const confirm = useCallback(() => {\n if (!capture) return;\n onConfirmRef.current?.(capture);\n }, [capture]);\n\n // Set when a user-initiated transition back to idle should move focus to\n // the Use-camera button (Retake). Distinguishes retake-to-idle from the\n // initial idle mount, so focus is never stolen on first paint.\n const focusUseCameraRef = useRef(false);\n\n const retake = useCallback(() => {\n // Controlled mode: retake is advisory only. The consumer owns `value`,\n // so we must NOT clear the capture, flip seededRef, or force a local\n // phase — doing so would race the controlled-value sync effect (which\n // re-asserts `captured` while value is still set), dropping the\n // \"already on file\" badge and surfacing a stray Confirm for an\n // already-persisted image. Emit onRetake and let the value drive phase.\n if (isControlled) {\n onRetakeRef.current?.();\n return;\n }\n seededRef.current = false;\n focusUseCameraRef.current = true;\n setCapture(null);\n setErrorKind(null);\n setDecoding(false);\n setPhase('idle');\n onRetakeRef.current?.();\n }, [isControlled, setCapture]);\n\n /* ---- Focus management on phase transitions ---- */\n useEffect(() => {\n if (phase === 'captured' && !seededRef.current) {\n // Land the keyboard / SR user on the next logical action.\n confirmBtnRef.current?.focus();\n } else if (phase === 'error') {\n recoveryRef.current?.focus();\n } else if (phase === 'idle' && focusUseCameraRef.current) {\n // After a Retake, return focus to the capture entry point. Never on\n // the initial idle mount (the flag is only set by retake()).\n focusUseCameraRef.current = false;\n useCameraBtnRef.current?.focus();\n }\n }, [phase]);\n\n /* ---- Escape from streaming returns to idle and stops the stream ---- */\n useEffect(() => {\n if (phase !== 'streaming') return undefined;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n stopStream();\n setPhase('idle');\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [phase, stopStream]);\n\n /* ---- Release the camera when the tab is hidden ---- */\n useEffect(() => {\n const onVisibility = () => {\n if (document.visibilityState === 'hidden' && streamRef.current) {\n stopStream();\n setPhase('idle');\n }\n };\n document.addEventListener('visibilitychange', onVisibility);\n return () =>\n document.removeEventListener('visibilitychange', onVisibility);\n }, [stopStream]);\n\n /* ---- Unmount cleanup: release the camera if still held ---- */\n useEffect(() => {\n return () => {\n unmountedRef.current = true;\n const held = streamRef.current;\n if (held) held.getTracks().forEach((track) => track.stop());\n streamRef.current = null;\n };\n }, []);\n\n /* ---- Sync controlled value → phase ---- */\n useEffect(() => {\n if (!isControlled) return;\n if (value != null) {\n setPhase('captured');\n } else if (phase === 'captured') {\n setPhase('idle');\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value, isControlled]);\n\n /* ---- Imperative handle + agent registration ---- */\n const agentHandle = useMemo<DocumentScannerHandle>(\n () => ({\n hasCapture: () => capture != null,\n getPhase: () => phase,\n startCamera: () => startCamera(),\n capture: () => capturePhoto(),\n confirm: () => confirm(),\n retake: () => retake(),\n }),\n [capture, phase, startCamera, capturePhoto, confirm, retake],\n );\n useImperativeHandle(ref, () => agentHandle, [agentHandle]);\n useAgentRegistration(documentScannerAgent, agentHandle, id);\n\n /* ---- Derived strings ---- */\n const regionLabel = ariaLabel ?? t('documentScanner.regionLabel');\n const hintText = t(HINT_KEY[documentType]);\n const maxSizeMb = Math.round(maxSize / (1024 * 1024));\n\n const statusText = (() => {\n if (decoding) return t('documentScanner.state.uploading');\n switch (phase) {\n case 'idle':\n return t('documentScanner.state.idle');\n case 'requesting':\n return t('documentScanner.state.requesting');\n case 'streaming':\n return t('documentScanner.state.streaming');\n case 'captured':\n return t('documentScanner.state.captured');\n case 'error':\n return errorKind\n ? t(ERROR_KEY[errorKind], { maxSizeMb })\n : t('documentScanner.error.captureFailed');\n }\n })();\n\n // A camera retry only makes sense for a hardware/permission failure —\n // not for upload-side rejections or an insecure (non-HTTPS) context.\n const canRetryCamera =\n !isUploadOnly &&\n errorKind !== 'file-invalid-type' &&\n errorKind !== 'file-too-large' &&\n errorKind !== 'insecure-context';\n\n // The upload affordance is always reachable: shown in idle/error for\n // auto + camera-only, primary in upload-only, and the recovery path on\n // any hard camera error.\n const showUploadFallback =\n !disabled &&\n (captureMode === 'auto' ||\n captureMode === 'upload-only' ||\n phase === 'error');\n\n const uploadAffordance = (\n <FileUpload\n variant=\"button\"\n accept={accept}\n maxSize={maxSize}\n multiple={false}\n maxFiles={1}\n disabled={disabled}\n showPreview={false}\n onDrop={(acceptedFiles) => {\n void handleUploadDrop(acceptedFiles);\n }}\n onReject={handleUploadReject}\n />\n );\n\n /* ---- Render ---- */\n const showViewport =\n phase === 'idle' ||\n phase === 'requesting' ||\n phase === 'streaming' ||\n phase === 'error';\n\n return (\n <div\n role=\"group\"\n aria-label={regionLabel}\n aria-disabled={disabled || undefined}\n className={[rootVariants({ size }), className]\n .filter(Boolean)\n .join(' ')}\n data-component=\"document-scanner\"\n data-component-id={id}\n data-phase={phase}\n >\n {/* Polite live region — announces every phase change to SR users. */}\n <span\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"ds:sr-only\"\n data-testid=\"document-scanner-live\"\n >\n {statusText}\n </span>\n\n {phase === 'captured' && capture ? (\n /* ---- Captured preview ---- */\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <div className={viewportVariants({ frame: documentType })}>\n <img\n src={capture.dataUrl}\n alt={t('documentScanner.previewAlt')}\n className={mediaVariants()}\n data-testid=\"document-scanner-preview\"\n />\n {seededRef.current ? (\n <span className=\"ds:absolute ds:top-[var(--spacing-sm)] ds:start-[var(--spacing-sm)] ds:rounded-[var(--radius-full)] ds:border ds:border-[color:color-mix(in_srgb,var(--foreground)_15%,transparent)] ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:py-[var(--spacing-2xs)] type-meta\">\n {t('documentScanner.onFileBadge')}\n </span>\n ) : null}\n </div>\n <div className={controlBarVariants()}>\n <Button\n intent=\"secondary\"\n size=\"md\"\n // Button's md variant is h-10 (40px) with no min-target\n // compensation — pin to --min-target-size (44/48px) to clear\n // WCAG 2.5.5, matching SignatureCapture's action buttons.\n className=\"ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]\"\n startIcon={<RotateCcw aria-hidden=\"true\" />}\n onClick={retake}\n disabled={disabled}\n >\n {t('documentScanner.retake')}\n </Button>\n {/* Seeded \"already on file\" images need no Confirm — they are\n already persisted; the only action is Retake. */}\n {seededRef.current ? null : (\n <Button\n ref={confirmBtnRef}\n intent=\"primary\"\n size=\"md\"\n className=\"ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]\"\n startIcon={<Check aria-hidden=\"true\" />}\n onClick={confirm}\n disabled={disabled || capture == null}\n >\n {t('documentScanner.confirm')}\n </Button>\n )}\n </div>\n </div>\n ) : null}\n\n {showViewport ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {/* Viewport — only meaningful while streaming/requesting; in\n idle/error it is a neutral placeholder behind the controls. */}\n {!isUploadOnly && phase !== 'error' ? (\n <div\n ref={viewportRef}\n className={viewportVariants({ frame: documentType })}\n aria-busy={phase === 'requesting' || undefined}\n >\n <video\n ref={videoRef}\n autoPlay\n playsInline\n muted\n aria-label={t('documentScanner.videoLabel')}\n className={mediaVariants()}\n onLoadedMetadata={handleVideoReady}\n onCanPlay={handleVideoReady}\n data-testid=\"document-scanner-video\"\n />\n {phase === 'requesting' ? (\n <div className=\"ds:absolute ds:inset-0 ds:flex ds:items-center ds:justify-center ds:bg-[color-mix(in_srgb,var(--foreground)_20%,transparent)]\">\n <LoaderCircle\n aria-hidden=\"true\"\n className=\"ds:size-8 ds:animate-spin ds:text-[var(--background)] ds:motion-reduce:animate-none\"\n />\n </div>\n ) : null}\n {/* Decorative alignment frame + corner guides. */}\n <div\n aria-hidden=\"true\"\n className={frameOverlayVariants()}\n data-testid=\"document-scanner-frame\"\n >\n <span\n className={[\n cornerVariants(),\n 'ds:top-0 ds:start-0 ds:border-t-2 ds:border-s-2 ds:rounded-ss-[var(--radius-sm)]',\n ].join(' ')}\n />\n <span\n className={[\n cornerVariants(),\n 'ds:top-0 ds:end-0 ds:border-t-2 ds:border-e-2 ds:rounded-se-[var(--radius-sm)]',\n ].join(' ')}\n />\n <span\n className={[\n cornerVariants(),\n 'ds:bottom-0 ds:start-0 ds:border-b-2 ds:border-s-2 ds:rounded-es-[var(--radius-sm)]',\n ].join(' ')}\n />\n <span\n className={[\n cornerVariants(),\n 'ds:bottom-0 ds:end-0 ds:border-b-2 ds:border-e-2 ds:rounded-ee-[var(--radius-sm)]',\n ].join(' ')}\n />\n </div>\n </div>\n ) : null}\n\n {phase === 'streaming' ? (\n <p id={hintId} className={hintVariants()}>\n {hintText}\n </p>\n ) : null}\n\n {/* Error block — Alert pattern with the upload recovery path. */}\n {phase === 'error' && errorKind ? (\n <Alert variant=\"error\" live=\"assertive\">\n <Alert.Description>\n {t(ERROR_KEY[errorKind], { maxSizeMb })}\n </Alert.Description>\n <Alert.Action>\n {/* The camera-retry button is the focus target on a\n hardware/permission error; for upload-side or\n insecure-context errors there is nothing to retry and\n the upload affordance is the recovery path. */}\n {canRetryCamera ? (\n <Button\n ref={recoveryRef}\n intent=\"secondary\"\n size=\"sm\"\n onClick={() => {\n void startCamera();\n }}\n disabled={disabled}\n >\n {t('documentScanner.retry')}\n </Button>\n ) : null}\n {showUploadFallback ? uploadAffordance : null}\n </Alert.Action>\n </Alert>\n ) : null}\n\n {/* Primary control bar (no hard error). */}\n {phase !== 'error' ? (\n <div className={controlBarVariants()}>\n {phase === 'streaming' ? (\n <Button\n ref={shutterBtnRef}\n intent=\"primary\"\n size=\"lg\"\n startIcon={<Camera aria-hidden=\"true\" />}\n onClick={() => {\n void capturePhoto();\n }}\n disabled={disabled || !streamReady}\n aria-describedby={hintId}\n aria-label={t('documentScanner.capture')}\n >\n {t('documentScanner.capture')}\n </Button>\n ) : null}\n\n {(phase === 'idle' || phase === 'requesting') &&\n !isUploadOnly ? (\n <Button\n ref={useCameraBtnRef}\n intent=\"primary\"\n size=\"md\"\n className=\"ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]\"\n loading={phase === 'requesting'}\n startIcon={<Camera aria-hidden=\"true\" />}\n onClick={() => {\n void startCamera();\n }}\n disabled={disabled}\n >\n {t('documentScanner.useCamera')}\n </Button>\n ) : null}\n\n {decoding ? (\n <span className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-body-sm ds:text-[var(--muted-foreground)]\">\n <LoaderCircle\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:animate-spin ds:motion-reduce:animate-none\"\n />\n {t('documentScanner.state.uploading')}\n </span>\n ) : showUploadFallback && phase !== 'streaming' ? (\n uploadAffordance\n ) : null}\n\n {/* In streaming, upload stays reachable as a low-emphasis\n fallback below the shutter. */}\n {phase === 'streaming' && captureMode !== 'camera-only'\n ? uploadAffordance\n : null}\n </div>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n },\n);\n\nDocumentScanner.displayName = 'DocumentScanner';\n\nexport {\n rootVariants as documentScannerRootVariants,\n viewportVariants as documentScannerViewportVariants,\n};\n"],"names":["documentScannerAgent","handle","rootVariants","cva","viewportVariants","mediaVariants","frameOverlayVariants","cornerVariants","controlBarVariants","hintVariants","toHex","bytes","out","i","sha256Hex","buffer","g","_a","copy","digest","classifyMediaError","err","name","mediaDevicesAvailable","HINT_KEY","ERROR_KEY","DocumentScanner","forwardRef","id","value","defaultValue","onConfirm","onRetake","onError","documentType","captureMode","accept","maxSize","facingMode","outputType","outputQuality","cropToFrame","disabled","size","ariaLabel","className","ref","t","useTranslation","hintId","useId","capture","setCapture","useControllableState","seededRef","useRef","phase","setPhase","useState","errorKind","setErrorKind","streamReady","setStreamReady","decoding","setDecoding","videoRef","viewportRef","streamRef","unmountedRef","confirmBtnRef","shutterBtnRef","useCameraBtnRef","recoveryRef","onErrorRef","onConfirmRef","onRetakeRef","useEffect","isControlled","isUploadOnly","stopStream","useCallback","held","track","video","reportError","kind","startCamera","stream","playResult","handleVideoReady","interval","stopAfter","capturePhoto","vw","vh","sx","sy","sw","sh","insetX","insetY","canvas","ctx","blob","resolve","b","dataUrl","arrayBuffer","sha256","next","handleUploadDrop","accepted","file","objectUrl","dimensions","reject","img","reader","handleUploadReject","rejections","confirm","focusUseCameraRef","retake","_b","_c","onKeyDown","event","onVisibility","agentHandle","useMemo","useImperativeHandle","useAgentRegistration","regionLabel","hintText","maxSizeMb","statusText","canRetryCamera","showUploadFallback","uploadAffordance","jsx","FileUpload","acceptedFiles","showViewport","jsxs","Button","RotateCcw","Check","LoaderCircle","Alert","Camera"],"mappings":";;;;;;;;;;;;AAUO,MAAMA,KAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAC,WAAW,QAAQ;AAAA,EAClC,OAAO;AAAA,IACL,YAAY;AAAA,MACV,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,WAAA;AAAA,IAAW;AAAA,IAEtC,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,EACpC;AAAA,EAEF,SAAS;AAAA,IACP,cAAc;AAAA,MACZ,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,QAAQ;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAEF,QAAQ,CAACA,MAAWA,EAAO,YAAA;AAAA,IAAY;AAAA,IAEzC,SAAS;AAAA,MACP,QAAQ;AAAA,MACR,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,QAAQ,CAA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,QAAO;AAAA,kBACP,MAAK;AAAA,kBACL,WAAU;AAAA,kBACV,SAASf,MAAU;AAAA,kBACnB,WAAW,gBAAAmF,EAACU,IAAA,EAAO,eAAY,OAAA,CAAO;AAAA,kBACtC,SAAS,MAAM;AACb,oBAAK/D,EAAA;AAAA,kBACP;AAAA,kBACA,UAAA5C;AAAA,kBAEC,YAAE,2BAA2B;AAAA,gBAAA;AAAA,cAAA,IAE9B;AAAA,cAEHqB,KACC,gBAAAgF,EAAC,QAAA,EAAK,WAAU,4GACd,UAAA;AAAA,gBAAA,gBAAAJ;AAAA,kBAACQ;AAAA,kBAAA;AAAA,oBACC,eAAY;AAAA,oBACZ,WAAU;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAEXpG,EAAE,iCAAiC;AAAA,cAAA,EAAA,CACtC,IACE0F,MAAsBjF,MAAU,cAClCkF,KACE;AAAA,cAIHlF,MAAU,eAAerB,MAAgB,gBACtCuG,KACA;AAAA,YAAA,EAAA,CACN,IACE;AAAA,UAAA,EAAA,CACN,IACE;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AAEAhH,GAAgB,cAAc;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as a, jsx as e, Fragment as _ } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as q, useId as w, useRef as f, useImperativeHandle as K, useMemo as P } from "react";
|
|
3
3
|
import { useTranslation as D } from "react-i18next";
|
|
4
|
-
import { A as I } from "./alert-
|
|
4
|
+
import { A as I } from "./alert-DS22ha1n.js";
|
|
5
5
|
import { A as H } from "./avatar-BNQNhoyL.js";
|
|
6
6
|
import { B as $ } from "./button-CPGiR_bH.js";
|
|
7
7
|
import { I as O } from "./icon-button-C_kbcd7I.js";
|
|
@@ -274,4 +274,4 @@ function ae({ section: t }) {
|
|
|
274
274
|
export {
|
|
275
275
|
be as E
|
|
276
276
|
};
|
|
277
|
-
//# sourceMappingURL=entity-summary-
|
|
277
|
+
//# sourceMappingURL=entity-summary-BS6n7Iah.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-summary-BILN4wEG.js","sources":["../../node_modules/lucide-react/dist/esm/icons/contact-round.mjs","../../src/components/entity-summary/entity-summary.agent.ts","../../src/components/entity-summary/entity-summary.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M16 2v2\", key: \"scm5qe\" }],\n [\"path\", { d: \"M17.915 22a6 6 0 0 0-12 0\", key: \"suqz9p\" }],\n [\"path\", { d: \"M8 2v2\", key: \"pbkmx\" }],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"4\", key: \"4exip2\" }],\n [\"rect\", { x: \"3\", y: \"4\", width: \"18\", height: \"18\", rx: \"2\", key: \"12vinp\" }]\n];\nconst ContactRound = createLucideIcon(\"contact-round\", __iconNode);\n\nexport { __iconNode, ContactRound as default };\n//# sourceMappingURL=contact-round.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — EntitySummary. */\n/* */\n/* The AI narrative brief (\"Sintesi IA\") for an entity. The agent can */\n/* read the brief's STRUCTURE (generated-at + section ids / headings / */\n/* tone / item counts — fixed category labels, never the entity name or */\n/* the bullet items, both PHI) and drive the two affordances: regenerate */\n/* the brief and dismiss the panel. Generation itself is gated upstream */\n/* by AiConsentBanner; this adapter only re-requests an already-consented */\n/* brief. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { EntitySummaryHandle } from './entity-summary';\n\nexport const entitySummaryAgent: AgentAdapter<EntitySummaryHandle> = {\n id: 'entity-summary',\n // 'close' backs close; regenerate is a host-driven refresh with no\n // dedicated capability in the closed vocabulary.\n capabilities: ['close'],\n state: {\n sections: {\n type: 'Array<{ id: string; heading: string; tone: \"default\" | \"attention\"; itemCount: number }>',\n descriptionKey: 'ui.agent.entitySummary.state.sections',\n description:\n 'Structural section list — ids, fixed category headings, tone and item counts. Never the entity name or the bullet items (both PHI).',\n read: (handle) => handle.getState().sections,\n },\n generatedAtIso: {\n type: 'string | undefined',\n descriptionKey: 'ui.agent.entitySummary.state.generatedAtIso',\n description: 'ISO-8601 instant the brief was generated, when known.',\n read: (handle) => handle.getState().generatedAtIso,\n },\n },\n actions: {\n regenerate: {\n // Re-requests a fresh brief from the model — reaches an external system.\n safety: 'write',\n openWorld: true,\n descriptionKey: 'ui.agent.entitySummary.actions.regenerate',\n description:\n 'Request the host to regenerate the AI brief. No-op when the regenerate affordance is not available.',\n invoke: (handle) => {\n if (handle.canRegenerate()) handle.regenerate();\n },\n },\n close: {\n // Ephemeral panel-visibility change — read.\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.entitySummary.actions.close',\n description:\n 'Dismiss the summary panel. No-op when the close affordance is not available (e.g. docked in the rail).',\n invoke: (handle) => {\n if (handle.canClose()) handle.close();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'entity-summary',\n description: 'Marks the EntitySummary panel region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific summary panel from the agent.',\n },\n },\n};\n","import {\n forwardRef,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { ContactRound, Clock, RefreshCw, X } from 'lucide-react';\nimport { Alert } from '../alert';\nimport { Avatar } from '../avatar';\nimport { Button } from '../button';\nimport { Card } from '../card';\nimport { IconButton } from '../button/icon-button';\nimport { Link } from '../link';\nimport { PanelHeader } from '../panel-header';\nimport { Timestamp } from '../timestamp';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { entitySummaryAgent } from './entity-summary.agent';\n\n/* ------------------------------------------------------------------ */\n/* EntitySummary — the AI narrative brief for an entity. */\n/* */\n/* The kit form of platform's \"Sintesi IA\": a generated, sectioned */\n/* brief of a patient / care plan — header (entity · generated-at · */\n/* regenerate · corpus stats), N labelled sections of bullet items */\n/* (with inline entity links), and a BETA disclaimer. The `attention` */\n/* section tone carries the clinically valuable risk flags. */\n/* */\n/* The kit owns the layout, i18n and theming; the consumer passes */\n/* structured `sections` (data-in) so the brief re-themes and */\n/* localises rather than rendering a model HTML blob. Gate generation */\n/* behind `AiConsentBanner` upstream. */\n/* ------------------------------------------------------------------ */\n\n/** A corpus stat shown in the header (e.g. `{ value: 5, label: 'care plans' }`). */\nexport interface EntitySummaryStat {\n value: string | number;\n label: string;\n}\n\n/** One narrative section — a heading over a list of bullet items. */\nexport interface EntitySummarySection {\n id: string;\n heading: string;\n /**\n * Leading glyph for the section. On default sections it's the scannability\n * anchor shown in a `--primary`-tinted medallion beside the heading (e.g. a\n * calendar for \"Scheduled\", a wallet for \"Financial\"); omit it to render no\n * medallion. On `attention` sections it overrides the warning Alert's icon\n * (which defaults to an alert triangle).\n */\n icon?: ReactNode;\n /**\n * `attention` renders the section as the kit's warning `Alert` — the\n * standard risk-flag treatment (border, warning surface, alert glyph,\n * `--warning-foreground` text) — for clinically important callouts.\n */\n tone?: 'default' | 'attention';\n /** Bullet items — `ReactNode` so consumers compose inline entity links. */\n items: ReactNode[];\n}\n\n/**\n * Curated agent handle for EntitySummary. Exposes structural state only —\n * never the entity name or the section items (both PHI). See\n * `entity-summary.agent.ts`.\n */\nexport interface EntitySummaryHandle {\n /** Structural snapshot — generated-at + section ids/headings/tone/count. No PHI. */\n getState: () => {\n generatedAtIso?: string;\n sections: Array<{\n id: string;\n heading: string;\n tone: 'default' | 'attention';\n itemCount: number;\n }>;\n };\n /** Whether the regenerate affordance is available. */\n canRegenerate: () => boolean;\n /** Request the host to regenerate the brief (mirrors onRegenerate). */\n regenerate: () => void;\n /** Whether the close affordance is available. */\n canClose: () => boolean;\n /** Dismiss the panel (mirrors onClose). */\n close: () => void;\n}\n\nexport interface EntitySummaryProps extends Omit<\n HTMLAttributes<HTMLElement>,\n 'title' | 'children'\n> {\n /**\n * Stable instance id. Surfaced on the root as `data-component-id` so an\n * agent / MCP UI bridge can address this specific summary panel.\n */\n id?: string;\n /** Panel title. Defaults to the localised \"AI summary\". */\n title?: string;\n /** Entity name shown beside its avatar in the header (links when `entityHref` is set). */\n entityName?: string;\n /** Entity href for the name link. */\n entityHref?: string;\n /** Avatar image URL for the entity. Falls back to initials derived from `entityName`. */\n entityAvatarSrc?: string;\n /** ISO-8601 instant the brief was generated. */\n generatedAtIso?: string;\n /** Corpus the brief was built from, shown as a compact KPI card. */\n stats?: EntitySummaryStat[];\n /** The narrative sections, in order. */\n sections: EntitySummarySection[];\n /** Regenerate the brief. Omit to hide the affordance. */\n onRegenerate?: () => void;\n /** Regenerate-button label. */\n regenerateLabel?: string;\n /**\n * Dismiss the panel. Renders a close button in the panel header for\n * STANDALONE use (outside the rail). When docked in `ControlRoomRail`, omit\n * this — the rail injects its own close via `PanelHeaderActionsProvider`\n * (passing it while docked would render a duplicate close control).\n */\n onClose?: () => void;\n /** Footer disclaimer. Defaults to the BETA clinical-judgement note. */\n disclaimer?: ReactNode;\n /** BCP-47 locale for the generated-at timestamp. */\n locale?: string;\n /** Accessible name for the panel region (defaults to `title`). */\n 'aria-label'?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* Section presentation. The `attention` tone renders a different */\n/* element tree (the kit's warning Alert) rather than a class variant, */\n/* so the branch lives in `Section`; these constants carry the shared */\n/* class sets for the default (prose) sections. */\n/* ------------------------------------------------------------------ */\n\n// The default section's leading icon chip — a --primary-tinted medallion\n// that anchors the heading. No tone variants: the attention tone is owned\n// by the Alert primitive, so this stays a plain class set.\nconst MEDALLION_CLASSES =\n 'ds:flex ds:size-7 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-[var(--radius-md)] ds:[&_svg]:size-4 ds:bg-primary/10 ds:text-[color:var(--primary)]';\n\n// The bullet list shared by every section — indented disc items.\nconst ITEMS_CLASSES =\n 'ds:m-0 ds:flex ds:list-disc ds:flex-col ds:gap-[var(--spacing-2xs)] ds:ps-[var(--spacing-md)] type-body-sm';\n\nexport const EntitySummary = forwardRef<HTMLElement, EntitySummaryProps>(\n function EntitySummary(\n {\n id,\n title,\n entityName,\n entityHref,\n entityAvatarSrc,\n generatedAtIso,\n stats,\n sections,\n onRegenerate,\n regenerateLabel,\n onClose,\n disclaimer,\n locale,\n className,\n 'aria-label': ariaLabel,\n ...rest\n },\n ref,\n ) {\n const { t } = useTranslation();\n const headingId = useId();\n const heading =\n title ?? t('entitySummary.title', { defaultValue: 'AI summary' });\n\n /* ----- Agent handle (structural state + regenerate / close) ----- */\n const sectionsRef = useRef(sections);\n sectionsRef.current = sections;\n const generatedAtRef = useRef(generatedAtIso);\n generatedAtRef.current = generatedAtIso;\n const onRegenerateRef = useRef(onRegenerate);\n onRegenerateRef.current = onRegenerate;\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n\n const rootRef = useRef<HTMLElement>(null);\n useImperativeHandle(ref, () => rootRef.current as HTMLElement, []);\n\n const handle = useMemo<EntitySummaryHandle>(\n () => ({\n // Structural only — section headings are fixed category labels, never\n // the entity name or the bullet items (both PHI).\n getState: () => ({\n generatedAtIso: generatedAtRef.current,\n sections: sectionsRef.current.map((s) => ({\n id: s.id,\n heading: s.heading,\n tone: s.tone ?? 'default',\n itemCount: s.items.length,\n })),\n }),\n canRegenerate: () => !!onRegenerateRef.current,\n regenerate: () => onRegenerateRef.current?.(),\n canClose: () => !!onCloseRef.current,\n close: () => onCloseRef.current?.(),\n }),\n [],\n );\n useAgentRegistration(entitySummaryAgent, handle, id);\n\n // The generated-at line — the brief's \"subtitle\" under the entity name,\n // or a standalone line when there's no entity. A clock glyph leads it.\n const generatedLine = generatedAtIso ? (\n <span className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)] type-meta ds:text-[color:var(--muted-foreground)]\">\n <Clock aria-hidden=\"true\" className=\"ds:size-3.5 ds:shrink-0\" />\n <span>\n {t('entitySummary.generatedAt', { defaultValue: 'Generated' })}\n </span>\n <Timestamp value={generatedAtIso} format=\"absolute\" locale={locale} />\n </span>\n ) : null;\n\n return (\n <section\n ref={rootRef}\n data-component=\"entity-summary\"\n data-component-id={id}\n aria-labelledby={ariaLabel ? undefined : headingId}\n aria-label={ariaLabel}\n className={['ds:flex ds:flex-col', className].filter(Boolean).join(' ')}\n {...rest}\n >\n {/* Header — the shared rail-panel pattern. Title + Regenerate;\n the close affordance is injected by the rail, not the panel. */}\n <PanelHeader\n title={heading}\n icon={<ContactRound aria-hidden=\"true\" />}\n headingId={ariaLabel ? undefined : headingId}\n sticky\n divider\n actions={\n onRegenerate || onClose ? (\n <>\n {onRegenerate ? (\n <Button\n type=\"button\"\n size=\"sm\"\n intent=\"ghost\"\n startIcon={<RefreshCw aria-hidden=\"true\" />}\n onClick={onRegenerate}\n >\n {regenerateLabel ??\n t('entitySummary.regenerate', {\n defaultValue: 'Regenerate',\n })}\n </Button>\n ) : null}\n {onClose ? (\n <IconButton\n icon={<X aria-hidden=\"true\" />}\n size=\"sm\"\n intent=\"ghost\"\n aria-label={t('common.close', { defaultValue: 'Close' })}\n onClick={onClose}\n />\n ) : null}\n </>\n ) : undefined\n }\n />\n\n {/* Body */}\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]\">\n {entityName || generatedAtIso || (stats && stats.length > 0) ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {/* Identity — the entity's avatar + name, generated-at as the\n subtitle beneath. Without a name, the generated line stands\n alone. */}\n {entityName ? (\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Avatar\n name={entityName}\n src={entityAvatarSrc}\n size=\"sm\"\n className=\"ds:shrink-0\"\n />\n <div className=\"ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n {entityHref ? (\n <Link\n href={entityHref}\n className=\"type-body-sm ds:font-semibold\"\n >\n {entityName}\n </Link>\n ) : (\n <span className=\"type-body-sm ds:font-semibold ds:text-[color:var(--foreground)]\">\n {entityName}\n </span>\n )}\n {generatedLine}\n </div>\n </div>\n ) : (\n generatedLine\n )}\n\n {/* Corpus stats — a compact KPI card: value over label, with a\n hairline divider between cells. */}\n {stats && stats.length > 0 ? (\n <Card variant=\"elevated\">\n {/* eslint-disable-next-line jsx-a11y/no-redundant-roles -- role=\"list\" restores list semantics that ds:list-none strips in Safari/VoiceOver */}\n <ul\n role=\"list\"\n className=\"ds:m-0 ds:flex ds:list-none ds:items-stretch\"\n >\n {stats.map((stat, index) => (\n <li\n key={`${stat.label}-${index}`}\n className={[\n 'ds:flex ds:flex-1 ds:flex-col ds:items-center ds:gap-[var(--spacing-2xs)] ds:p-[var(--spacing-sm)] ds:text-center',\n index > 0\n ? 'ds:border-s ds:border-[color:var(--card-border)]'\n : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <span className=\"type-metric ds:[--type-metric-size:var(--font-size-lg)] ds:text-[color:var(--foreground)]\">\n {stat.value}\n </span>\n <span className=\"type-meta ds:text-[color:var(--muted-foreground)]\">\n {stat.label}\n </span>\n </li>\n ))}\n </ul>\n </Card>\n ) : null}\n </div>\n ) : null}\n\n {/* Sections */}\n {sections.map((section) => (\n <Section key={section.id} section={section} />\n ))}\n\n {/* Disclaimer */}\n <p className=\"ds:m-0 type-meta ds:text-[color:var(--muted-foreground)]\">\n {disclaimer ??\n t('entitySummary.disclaimer', {\n defaultValue:\n 'Does not replace clinical judgement · verify accuracy before clinical use · BETA',\n })}\n </p>\n </div>\n </section>\n );\n },\n);\n\nfunction Section({ section }: { section: EntitySummarySection }): ReactNode {\n const headingId = useId();\n\n // The risk-flag section composes the kit's warning `Alert` primitive rather\n // than re-painting the warning tokens by hand — same border, surface, alert\n // glyph, and `--warning-foreground` treatment as every other warning in the\n // app. `live=\"off\"`: the brief is static content, not a just-occurred event,\n // so the items read in normal flow instead of being announced assertively.\n // A per-section `icon` overrides Alert's default alert triangle.\n if (section.tone === 'attention') {\n // The shared `--shadow-card` lifts the warning callout to the same\n // elevation as the surrounding section cards, so the stack reads as one\n // set of raised panels rather than a flat warning band among cards.\n return (\n <Alert\n variant=\"warning\"\n live=\"off\"\n icon={section.icon}\n className=\"ds:shadow-[var(--shadow-card)]\"\n >\n <Alert.Title as=\"h3\">{section.heading}</Alert.Title>\n <ul className={ITEMS_CLASSES}>\n {section.items.map((item, index) => (\n <li key={index}>{item}</li>\n ))}\n </ul>\n </Alert>\n );\n }\n\n // Default sections are raised cards — the scannable \"panel per topic\" stack,\n // matching platform's Sintesi IA. The card owns its own padding (so we drive\n // it from a single content div rather than Card.Header/Body) and is named by\n // its heading for assistive tech.\n return (\n <Card variant=\"elevated\" aria-labelledby={headingId}>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]\">\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n {section.icon ? (\n <span aria-hidden=\"true\" className={MEDALLION_CLASSES}>\n {section.icon}\n </span>\n ) : null}\n <h3\n id={headingId}\n className=\"ds:m-0 type-eyebrow ds:text-[color:var(--foreground)]\"\n >\n {section.heading}\n </h3>\n </div>\n <ul className={`${ITEMS_CLASSES} ds:text-[color:var(--foreground)]`}>\n {section.items.map((item, index) => (\n <li key={index}>{item}</li>\n ))}\n </ul>\n </div>\n </Card>\n );\n}\n"],"names":["__iconNode","ContactRound","createLucideIcon","entitySummaryAgent","handle","MEDALLION_CLASSES","ITEMS_CLASSES","EntitySummary","forwardRef","id","title","entityName","entityHref","entityAvatarSrc","generatedAtIso","stats","sections","onRegenerate","regenerateLabel","onClose","disclaimer","locale","className","ariaLabel","rest","ref","t","useTranslation","headingId","useId","heading","sectionsRef","useRef","generatedAtRef","onRegenerateRef","onCloseRef","rootRef","useImperativeHandle","useMemo","s","_a","useAgentRegistration","generatedLine","jsxs","jsx","Clock","Timestamp","PanelHeader","Fragment","Button","RefreshCw","IconButton","X","Avatar","Link","Card","stat","index","section","Section","Alert","item"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC,CAAC,QAAQ,EAAE,GAAG,6BAA6B,KAAK,SAAQ,CAAE;AAAA,EAC1D,CAAC,QAAQ,EAAE,GAAG,UAAU,KAAK,QAAO,CAAE;AAAA,EACtC,CAAC,UAAU,EAAE,IAAI,MAAM,IAAI,MAAM,GAAG,KAAK,KAAK,UAAU;AAAA,EACxD,CAAC,QAAQ,EAAE,GAAG,KAAK,GAAG,KAAK,OAAO,MAAM,QAAQ,MAAM,IAAI,KAAK,KAAK,SAAQ,CAAE;AAChF,GACMC,KAAeC,EAAiB,iBAAiBF,CAAU,GCDpDG,KAAwD;AAAA,EACnE,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,OAAO;AAAA,EACtB,OAAO;AAAA,IACL,UAAU;AAAA,MACR,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,WAAW;AAAA,IAAA;AAAA,IAEtC,gBAAgB;AAAA,MACd,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,WAAW;AAAA,IAAA;AAAA,EACtC;AAAA,EAEF,SAAS;AAAA,IACP,YAAY;AAAA;AAAA,MAEV,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,QAAQ,CAACA,MAAW;AAClB,QAAIA,EAAO,mBAAiBA,EAAO,WAAA;AAAA,MACrC;AAAA,IAAA;AAAA,IAEF,OAAO;AAAA;AAAA,MAEL,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,gBA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sources":["../../node_modules/lucide-react/dist/esm/icons/contact-round.mjs","../../src/components/entity-summary/entity-summary.agent.ts","../../src/components/entity-summary/entity-summary.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M16 2v2\", key: \"scm5qe\" }],\n [\"path\", { d: \"M17.915 22a6 6 0 0 0-12 0\", key: \"suqz9p\" }],\n [\"path\", { d: \"M8 2v2\", key: \"pbkmx\" }],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"4\", key: \"4exip2\" }],\n [\"rect\", { x: \"3\", y: \"4\", width: \"18\", height: \"18\", rx: \"2\", key: \"12vinp\" }]\n];\nconst ContactRound = createLucideIcon(\"contact-round\", __iconNode);\n\nexport { __iconNode, ContactRound as default };\n//# sourceMappingURL=contact-round.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — EntitySummary. */\n/* */\n/* The AI narrative brief (\"Sintesi IA\") for an entity. The agent can */\n/* read the brief's STRUCTURE (generated-at + section ids / headings / */\n/* tone / item counts — fixed category labels, never the entity name or */\n/* the bullet items, both PHI) and drive the two affordances: regenerate */\n/* the brief and dismiss the panel. Generation itself is gated upstream */\n/* by AiConsentBanner; this adapter only re-requests an already-consented */\n/* brief. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { EntitySummaryHandle } from './entity-summary';\n\nexport const entitySummaryAgent: AgentAdapter<EntitySummaryHandle> = {\n id: 'entity-summary',\n // 'close' backs close; regenerate is a host-driven refresh with no\n // dedicated capability in the closed vocabulary.\n capabilities: ['close'],\n state: {\n sections: {\n type: 'Array<{ id: string; heading: string; tone: \"default\" | \"attention\"; itemCount: number }>',\n descriptionKey: 'ui.agent.entitySummary.state.sections',\n description:\n 'Structural section list — ids, fixed category headings, tone and item counts. Never the entity name or the bullet items (both PHI).',\n read: (handle) => handle.getState().sections,\n },\n generatedAtIso: {\n type: 'string | undefined',\n descriptionKey: 'ui.agent.entitySummary.state.generatedAtIso',\n description: 'ISO-8601 instant the brief was generated, when known.',\n read: (handle) => handle.getState().generatedAtIso,\n },\n },\n actions: {\n regenerate: {\n // Re-requests a fresh brief from the model — reaches an external system.\n safety: 'write',\n openWorld: true,\n descriptionKey: 'ui.agent.entitySummary.actions.regenerate',\n description:\n 'Request the host to regenerate the AI brief. No-op when the regenerate affordance is not available.',\n invoke: (handle) => {\n if (handle.canRegenerate()) handle.regenerate();\n },\n },\n close: {\n // Ephemeral panel-visibility change — read.\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.entitySummary.actions.close',\n description:\n 'Dismiss the summary panel. No-op when the close affordance is not available (e.g. docked in the rail).',\n invoke: (handle) => {\n if (handle.canClose()) handle.close();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'entity-summary',\n description: 'Marks the EntitySummary panel region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific summary panel from the agent.',\n },\n },\n};\n","import {\n forwardRef,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { ContactRound, Clock, RefreshCw, X } from 'lucide-react';\nimport { Alert } from '../alert';\nimport { Avatar } from '../avatar';\nimport { Button } from '../button';\nimport { Card } from '../card';\nimport { IconButton } from '../button/icon-button';\nimport { Link } from '../link';\nimport { PanelHeader } from '../panel-header';\nimport { Timestamp } from '../timestamp';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { entitySummaryAgent } from './entity-summary.agent';\n\n/* ------------------------------------------------------------------ */\n/* EntitySummary — the AI narrative brief for an entity. */\n/* */\n/* The kit form of platform's \"Sintesi IA\": a generated, sectioned */\n/* brief of a patient / care plan — header (entity · generated-at · */\n/* regenerate · corpus stats), N labelled sections of bullet items */\n/* (with inline entity links), and a BETA disclaimer. The `attention` */\n/* section tone carries the clinically valuable risk flags. */\n/* */\n/* The kit owns the layout, i18n and theming; the consumer passes */\n/* structured `sections` (data-in) so the brief re-themes and */\n/* localises rather than rendering a model HTML blob. Gate generation */\n/* behind `AiConsentBanner` upstream. */\n/* ------------------------------------------------------------------ */\n\n/** A corpus stat shown in the header (e.g. `{ value: 5, label: 'care plans' }`). */\nexport interface EntitySummaryStat {\n value: string | number;\n label: string;\n}\n\n/** One narrative section — a heading over a list of bullet items. */\nexport interface EntitySummarySection {\n id: string;\n heading: string;\n /**\n * Leading glyph for the section. On default sections it's the scannability\n * anchor shown in a `--primary`-tinted medallion beside the heading (e.g. a\n * calendar for \"Scheduled\", a wallet for \"Financial\"); omit it to render no\n * medallion. On `attention` sections it overrides the warning Alert's icon\n * (which defaults to an alert triangle).\n */\n icon?: ReactNode;\n /**\n * `attention` renders the section as the kit's warning `Alert` — the\n * standard risk-flag treatment (border, warning surface, alert glyph,\n * `--warning-foreground` text) — for clinically important callouts.\n */\n tone?: 'default' | 'attention';\n /** Bullet items — `ReactNode` so consumers compose inline entity links. */\n items: ReactNode[];\n}\n\n/**\n * Curated agent handle for EntitySummary. Exposes structural state only —\n * never the entity name or the section items (both PHI). See\n * `entity-summary.agent.ts`.\n */\nexport interface EntitySummaryHandle {\n /** Structural snapshot — generated-at + section ids/headings/tone/count. No PHI. */\n getState: () => {\n generatedAtIso?: string;\n sections: Array<{\n id: string;\n heading: string;\n tone: 'default' | 'attention';\n itemCount: number;\n }>;\n };\n /** Whether the regenerate affordance is available. */\n canRegenerate: () => boolean;\n /** Request the host to regenerate the brief (mirrors onRegenerate). */\n regenerate: () => void;\n /** Whether the close affordance is available. */\n canClose: () => boolean;\n /** Dismiss the panel (mirrors onClose). */\n close: () => void;\n}\n\nexport interface EntitySummaryProps extends Omit<\n HTMLAttributes<HTMLElement>,\n 'title' | 'children'\n> {\n /**\n * Stable instance id. Surfaced on the root as `data-component-id` so an\n * agent / MCP UI bridge can address this specific summary panel.\n */\n id?: string;\n /** Panel title. Defaults to the localised \"AI summary\". */\n title?: string;\n /** Entity name shown beside its avatar in the header (links when `entityHref` is set). */\n entityName?: string;\n /** Entity href for the name link. */\n entityHref?: string;\n /** Avatar image URL for the entity. Falls back to initials derived from `entityName`. */\n entityAvatarSrc?: string;\n /** ISO-8601 instant the brief was generated. */\n generatedAtIso?: string;\n /** Corpus the brief was built from, shown as a compact KPI card. */\n stats?: EntitySummaryStat[];\n /** The narrative sections, in order. */\n sections: EntitySummarySection[];\n /** Regenerate the brief. Omit to hide the affordance. */\n onRegenerate?: () => void;\n /** Regenerate-button label. */\n regenerateLabel?: string;\n /**\n * Dismiss the panel. Renders a close button in the panel header for\n * STANDALONE use (outside the rail). When docked in `ControlRoomRail`, omit\n * this — the rail injects its own close via `PanelHeaderActionsProvider`\n * (passing it while docked would render a duplicate close control).\n */\n onClose?: () => void;\n /** Footer disclaimer. Defaults to the BETA clinical-judgement note. */\n disclaimer?: ReactNode;\n /** BCP-47 locale for the generated-at timestamp. */\n locale?: string;\n /** Accessible name for the panel region (defaults to `title`). */\n 'aria-label'?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* Section presentation. The `attention` tone renders a different */\n/* element tree (the kit's warning Alert) rather than a class variant, */\n/* so the branch lives in `Section`; these constants carry the shared */\n/* class sets for the default (prose) sections. */\n/* ------------------------------------------------------------------ */\n\n// The default section's leading icon chip — a --primary-tinted medallion\n// that anchors the heading. No tone variants: the attention tone is owned\n// by the Alert primitive, so this stays a plain class set.\nconst MEDALLION_CLASSES =\n 'ds:flex ds:size-7 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-[var(--radius-md)] ds:[&_svg]:size-4 ds:bg-primary/10 ds:text-[color:var(--primary)]';\n\n// The bullet list shared by every section — indented disc items.\nconst ITEMS_CLASSES =\n 'ds:m-0 ds:flex ds:list-disc ds:flex-col ds:gap-[var(--spacing-2xs)] ds:ps-[var(--spacing-md)] type-body-sm';\n\nexport const EntitySummary = forwardRef<HTMLElement, EntitySummaryProps>(\n function EntitySummary(\n {\n id,\n title,\n entityName,\n entityHref,\n entityAvatarSrc,\n generatedAtIso,\n stats,\n sections,\n onRegenerate,\n regenerateLabel,\n onClose,\n disclaimer,\n locale,\n className,\n 'aria-label': ariaLabel,\n ...rest\n },\n ref,\n ) {\n const { t } = useTranslation();\n const headingId = useId();\n const heading =\n title ?? t('entitySummary.title', { defaultValue: 'AI summary' });\n\n /* ----- Agent handle (structural state + regenerate / close) ----- */\n const sectionsRef = useRef(sections);\n sectionsRef.current = sections;\n const generatedAtRef = useRef(generatedAtIso);\n generatedAtRef.current = generatedAtIso;\n const onRegenerateRef = useRef(onRegenerate);\n onRegenerateRef.current = onRegenerate;\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n\n const rootRef = useRef<HTMLElement>(null);\n useImperativeHandle(ref, () => rootRef.current as HTMLElement, []);\n\n const handle = useMemo<EntitySummaryHandle>(\n () => ({\n // Structural only — section headings are fixed category labels, never\n // the entity name or the bullet items (both PHI).\n getState: () => ({\n generatedAtIso: generatedAtRef.current,\n sections: sectionsRef.current.map((s) => ({\n id: s.id,\n heading: s.heading,\n tone: s.tone ?? 'default',\n itemCount: s.items.length,\n })),\n }),\n canRegenerate: () => !!onRegenerateRef.current,\n regenerate: () => onRegenerateRef.current?.(),\n canClose: () => !!onCloseRef.current,\n close: () => onCloseRef.current?.(),\n }),\n [],\n );\n useAgentRegistration(entitySummaryAgent, handle, id);\n\n // The generated-at line — the brief's \"subtitle\" under the entity name,\n // or a standalone line when there's no entity. A clock glyph leads it.\n const generatedLine = generatedAtIso ? (\n <span className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)] type-meta ds:text-[color:var(--muted-foreground)]\">\n <Clock aria-hidden=\"true\" className=\"ds:size-3.5 ds:shrink-0\" />\n <span>\n {t('entitySummary.generatedAt', { defaultValue: 'Generated' })}\n </span>\n <Timestamp value={generatedAtIso} format=\"absolute\" locale={locale} />\n </span>\n ) : null;\n\n return (\n <section\n ref={rootRef}\n data-component=\"entity-summary\"\n data-component-id={id}\n aria-labelledby={ariaLabel ? undefined : headingId}\n aria-label={ariaLabel}\n className={['ds:flex ds:flex-col', className].filter(Boolean).join(' ')}\n {...rest}\n >\n {/* Header — the shared rail-panel pattern. Title + Regenerate;\n the close affordance is injected by the rail, not the panel. */}\n <PanelHeader\n title={heading}\n icon={<ContactRound aria-hidden=\"true\" />}\n headingId={ariaLabel ? undefined : headingId}\n sticky\n divider\n actions={\n onRegenerate || onClose ? (\n <>\n {onRegenerate ? (\n <Button\n type=\"button\"\n size=\"sm\"\n intent=\"ghost\"\n startIcon={<RefreshCw aria-hidden=\"true\" />}\n onClick={onRegenerate}\n >\n {regenerateLabel ??\n t('entitySummary.regenerate', {\n defaultValue: 'Regenerate',\n })}\n </Button>\n ) : null}\n {onClose ? (\n <IconButton\n icon={<X aria-hidden=\"true\" />}\n size=\"sm\"\n intent=\"ghost\"\n aria-label={t('common.close', { defaultValue: 'Close' })}\n onClick={onClose}\n />\n ) : null}\n </>\n ) : undefined\n }\n />\n\n {/* Body */}\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]\">\n {entityName || generatedAtIso || (stats && stats.length > 0) ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {/* Identity — the entity's avatar + name, generated-at as the\n subtitle beneath. Without a name, the generated line stands\n alone. */}\n {entityName ? (\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Avatar\n name={entityName}\n src={entityAvatarSrc}\n size=\"sm\"\n className=\"ds:shrink-0\"\n />\n <div className=\"ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n {entityHref ? (\n <Link\n href={entityHref}\n className=\"type-body-sm ds:font-semibold\"\n >\n {entityName}\n </Link>\n ) : (\n <span className=\"type-body-sm ds:font-semibold ds:text-[color:var(--foreground)]\">\n {entityName}\n </span>\n )}\n {generatedLine}\n </div>\n </div>\n ) : (\n generatedLine\n )}\n\n {/* Corpus stats — a compact KPI card: value over label, with a\n hairline divider between cells. */}\n {stats && stats.length > 0 ? (\n <Card variant=\"elevated\">\n {/* eslint-disable-next-line jsx-a11y/no-redundant-roles -- role=\"list\" restores list semantics that ds:list-none strips in Safari/VoiceOver */}\n <ul\n role=\"list\"\n className=\"ds:m-0 ds:flex ds:list-none ds:items-stretch\"\n >\n {stats.map((stat, index) => (\n <li\n key={`${stat.label}-${index}`}\n className={[\n 'ds:flex ds:flex-1 ds:flex-col ds:items-center ds:gap-[var(--spacing-2xs)] ds:p-[var(--spacing-sm)] ds:text-center',\n index > 0\n ? 'ds:border-s ds:border-[color:var(--card-border)]'\n : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <span className=\"type-metric ds:[--type-metric-size:var(--font-size-lg)] ds:text-[color:var(--foreground)]\">\n {stat.value}\n </span>\n <span className=\"type-meta ds:text-[color:var(--muted-foreground)]\">\n {stat.label}\n </span>\n </li>\n ))}\n </ul>\n </Card>\n ) : null}\n </div>\n ) : null}\n\n {/* Sections */}\n {sections.map((section) => (\n <Section key={section.id} section={section} />\n ))}\n\n {/* Disclaimer */}\n <p className=\"ds:m-0 type-meta ds:text-[color:var(--muted-foreground)]\">\n {disclaimer ??\n t('entitySummary.disclaimer', {\n defaultValue:\n 'Does not replace clinical judgement · verify accuracy before clinical use · BETA',\n })}\n </p>\n </div>\n </section>\n );\n },\n);\n\nfunction Section({ section }: { section: EntitySummarySection }): ReactNode {\n const headingId = useId();\n\n // The risk-flag section composes the kit's warning `Alert` primitive rather\n // than re-painting the warning tokens by hand — same border, surface, alert\n // glyph, and `--warning-foreground` treatment as every other warning in the\n // app. `live=\"off\"`: the brief is static content, not a just-occurred event,\n // so the items read in normal flow instead of being announced assertively.\n // A per-section `icon` overrides Alert's default alert triangle.\n if (section.tone === 'attention') {\n // The shared `--shadow-card` lifts the warning callout to the same\n // elevation as the surrounding section cards, so the stack reads as one\n // set of raised panels rather than a flat warning band among cards.\n return (\n <Alert\n variant=\"warning\"\n live=\"off\"\n icon={section.icon}\n className=\"ds:shadow-[var(--shadow-card)]\"\n >\n <Alert.Title as=\"h3\">{section.heading}</Alert.Title>\n <ul className={ITEMS_CLASSES}>\n {section.items.map((item, index) => (\n <li key={index}>{item}</li>\n ))}\n </ul>\n </Alert>\n );\n }\n\n // Default sections are raised cards — the scannable \"panel per topic\" stack,\n // matching platform's Sintesi IA. The card owns its own padding (so we drive\n // it from a single content div rather than Card.Header/Body) and is named by\n // its heading for assistive tech.\n return (\n <Card variant=\"elevated\" aria-labelledby={headingId}>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]\">\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n {section.icon ? (\n <span aria-hidden=\"true\" className={MEDALLION_CLASSES}>\n {section.icon}\n </span>\n ) : null}\n <h3\n id={headingId}\n className=\"ds:m-0 type-eyebrow ds:text-[color:var(--foreground)]\"\n >\n {section.heading}\n </h3>\n </div>\n <ul className={`${ITEMS_CLASSES} ds:text-[color:var(--foreground)]`}>\n {section.items.map((item, index) => (\n <li key={index}>{item}</li>\n ))}\n </ul>\n </div>\n </Card>\n );\n}\n"],"names":["__iconNode","ContactRound","createLucideIcon","entitySummaryAgent","handle","MEDALLION_CLASSES","ITEMS_CLASSES","EntitySummary","forwardRef","id","title","entityName","entityHref","entityAvatarSrc","generatedAtIso","stats","sections","onRegenerate","regenerateLabel","onClose","disclaimer","locale","className","ariaLabel","rest","ref","t","useTranslation","headingId","useId","heading","sectionsRef","useRef","generatedAtRef","onRegenerateRef","onCloseRef","rootRef","useImperativeHandle","useMemo","s","_a","useAgentRegistration","generatedLine","jsxs","jsx","Clock","Timestamp","PanelHeader","Fragment","Button","RefreshCw","IconButton","X","Avatar","Link","Card","stat","index","section","Section","Alert","item"],"mappings":";;;;;;;;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C,EAAA;AAQlB,SAAI6B,EAAQ,SAAS,cAKjB,gBAAAf;AAAA,IAACiB;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,MAAMF,EAAQ;AAAA,MACd,WAAU;AAAA,MAEV,UAAA;AAAA,QAAA,gBAAAd,EAACgB,EAAM,OAAN,EAAY,IAAG,MAAM,YAAQ,SAAQ;AAAA,QACtC,gBAAAhB,EAAC,MAAA,EAAG,WAAWtC,GACZ,YAAQ,MAAM,IAAI,CAACuD,GAAMJ,MACxB,gBAAAb,EAAC,MAAA,EAAgB,UAAAiB,EAAA,GAARJ,CAAa,CACvB,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAUJ,gBAAAb,EAACW,KAAK,SAAQ,YAAW,mBAAiB3B,GACxC,UAAA,gBAAAe,EAAC,OAAA,EAAI,WAAU,2EACb,UAAA;AAAA,IAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,sDACZ,UAAA;AAAA,MAAAe,EAAQ,yBACN,QAAA,EAAK,eAAY,QAAO,WAAWrD,IACjC,UAAAqD,EAAQ,KAAA,CACX,IACE;AAAA,MACJ,gBAAAd;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAIhB;AAAA,UACJ,WAAU;AAAA,UAET,UAAA8B,EAAQ;AAAA,QAAA;AAAA,MAAA;AAAA,IACX,GACF;AAAA,sBACC,MAAA,EAAG,WAAW,GAAGpD,CAAa,sCAC5B,UAAAoD,EAAQ,MAAM,IAAI,CAACG,GAAMJ,MACxB,gBAAAb,EAAC,QAAgB,UAAAiB,EAAA,GAARJ,CAAa,CACvB,EAAA,CACH;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;","x_google_ignoreList":[0]}
|
|
@@ -4,7 +4,7 @@ import * as Ke from "@radix-ui/react-tooltip";
|
|
|
4
4
|
import { c as Xi } from "./index-D2ZczOXr.js";
|
|
5
5
|
import { useTranslation as qi } from "react-i18next";
|
|
6
6
|
import { u as Gi } from "./registry-DvAUVLHh.js";
|
|
7
|
-
import { m as tt, M as Ji, A as Qi } from "./annotation-marker-
|
|
7
|
+
import { m as tt, M as Ji, A as Qi } from "./annotation-marker-CsUJGZjQ.js";
|
|
8
8
|
import { B as P } from "./button-CPGiR_bH.js";
|
|
9
9
|
import { I as Ze } from "./icon-button-C_kbcd7I.js";
|
|
10
10
|
import { B as es } from "./button-group-DzV5wgnx.js";
|
|
@@ -3143,4 +3143,4 @@ export {
|
|
|
3143
3143
|
Nn as t,
|
|
3144
3144
|
Kr as u
|
|
3145
3145
|
};
|
|
3146
|
-
//# sourceMappingURL=face-scheme-
|
|
3146
|
+
//# sourceMappingURL=face-scheme-Cou2efl7.js.map
|