/** Diagnostic codes emitted while registering or resolving viewers. */ export type ViewerRegistryDiagnosticCode = 'default-not-found' | 'deprecated-details-normalized' | 'explicit-not-found' | 'matcher-error'; /** Structured diagnostic event from viewer registration or resolution. */ export interface ViewerRegistryDiagnostic { code: ViewerRegistryDiagnosticCode; error?: unknown; identity?: string; message: string; viewerId?: string; } /** Registered viewer entry with optional aliases and a payload matcher. */ export interface ViewerRegistryEntry { aliases?: readonly string[]; id: string; matches: (payload: TPayload) => boolean; viewer: TViewer; } /** Error codes raised when registering a viewer fails. */ export type ViewerRegistryRegistrationErrorCode = 'duplicate-alias' | 'duplicate-id' | 'invalid-identity'; /** Error thrown when a viewer cannot be registered in the registry. */ export declare class ViewerRegistryRegistrationError extends Error { readonly code: ViewerRegistryRegistrationErrorCode; readonly identity?: string; constructor(code: ViewerRegistryRegistrationErrorCode, message: string, identity?: string); } /** Result of matching a payload against registered viewers. */ export interface ViewerRegistryMatchResult { diagnostics: ViewerRegistryDiagnostic[]; matches: ViewerRegistryEntry[]; } /** How a resolved viewer was selected from the registry. */ export type ViewerRegistrySelectionSource = 'default' | 'explicit' | 'fallback' | 'none' | 'ordered'; /** Options controlling how {@link ViewerRegistry} resolves a viewer for a payload. */ export interface ViewerRegistryResolveOptions { allowExplicitMismatch?: boolean; defaultId?: string; explicitId?: string; fallback?: TViewer; payload: TPayload; } /** Result of resolving a single viewer for a payload, including source and diagnostics. */ export interface ViewerRegistryResolveResult extends ViewerRegistryMatchResult { entry?: ViewerRegistryEntry; source: ViewerRegistrySelectionSource; viewer?: TViewer; } /** Construction options for {@link ViewerRegistry}. */ export interface ViewerRegistryOptions { onDiagnostic?: (diagnostic: ViewerRegistryDiagnostic) => void; } /** Registry that matches payloads to registered viewers by id, alias, or matcher. */ export declare class ViewerRegistry { private readonly entries; private readonly identities; private readonly onDiagnostic?; constructor({ onDiagnostic }?: ViewerRegistryOptions); get(identity: string): ViewerRegistryEntry | undefined; list(): ViewerRegistryEntry[]; match(payload: TPayload): ViewerRegistryMatchResult; register(entry: ViewerRegistryEntry): this; resolve({ allowExplicitMismatch, defaultId, explicitId, fallback, payload, }: ViewerRegistryResolveOptions): ViewerRegistryResolveResult; private reportMissing; } //# sourceMappingURL=ViewerRegistry.d.ts.map