//#region ../infra/src/media/canvas.d.ts /** * Class representing a canvas element for image capture and manipulation. */ declare class IncodeCanvas { canvas: HTMLCanvasElement; private base64Image; private blobData; /** * Creates an {@link IncodeCanvas} from a raw {@link ImageData} frame. * @param imageData - Frame pixels in RGBA format * @returns An {@link IncodeCanvas} containing the provided pixels */ static fromImageData(imageData: ImageData): IncodeCanvas; /** * Create a new canvas element. * @param canvas_ - The canvas element to clone. */ constructor(canvas_: HTMLCanvasElement); /** * Check if the current canvas is valid. */ private checkCanvas; /** * Disposes of resources, including revoking object URLs to prevent memory leaks. */ dispose(): void; /** * Release the data stored by IncodeCanvas. */ release(): void; /** * Revokes the object URL if one exists, preventing memory leaks. * Use this when you no longer need the preview image URL. */ revokeObjectURL(): void; /** * Get the width of the canvas. */ width(): number | null; /** * Get the height of the canvas. */ height(): number | null; /** * Set the width of the canvas. */ setWidth(width: number): void; /** * Set the height of the canvas. */ setHeight(height: number): void; /** * Clone the current canvas. */ clone(): IncodeCanvas | null; /** * Deep clone the current IncodeCanvas including blob data. */ deepClone(): Promise; /** * Returns the drawing context on the canvas. */ getContext(contextId: '2d', contextAttributes?: CanvasRenderingContext2DSettings): CanvasRenderingContext2D | null; /** * Retrieves the image data from the canvas. */ getImageData(): ImageData | null; /** * Updates the base64 representation of the current canvas image. */ updateBase64Image(jpegQuality?: number): void; /** * Converts the current canvas element to a base64 string. */ getBase64Image(jpegQuality?: number, includeDataURLPrefix?: boolean): string | null; /** * Sets the base64 representation of the current canvas image. */ setBase64Image(base64Image: string | null): void; /** * Updates the Blob representation of the current canvas image. */ updateBlob(jpegQuality?: number, includeDataURLPrefix?: boolean): void; /** * Converts a base64 string to a Blob and creates a URL for it. */ static base64ToBlob(base64: string): { blob: Blob; url: string; } | null; /** * Retrieves the Blob data and its URL from the current canvas. */ getBlobData(jpegQuality?: number, includeDataURLPrefix?: boolean): { blob: Blob; url: string; } | null; /** * Sets the Blob data of the current canvas image. */ setBlobData(blobData: { blob: Blob; url: string; }): Promise; /** * Returns a resized canvas according to video element size. */ getResizedCanvas(videoElementWidth: number, videoElementHeight: number): IncodeCanvas | null; } //#endregion //#region ../infra/src/capabilities/IMLProviderCapability.d.ts /** * Base configuration shared by all ML provider capabilities. */ interface MLProviderConfig { /** Path to the WASM binary */ wasmPath?: string; /** Path to the SIMD-optimized WASM binary (optional) */ wasmSimdPath?: string; /** Path to the WASM glue code (paired with `wasmPath`) */ glueCodePath?: string; /** * Path to the SIMD-optimized WASM glue code (paired with `wasmSimdPath`). * If omitted, defaults to a sibling `.js` derived from `wasmSimdPath`. */ glueCodeSimdPath?: string; /** Whether to use SIMD optimizations (default: true) */ useSimd?: boolean; /** * Base path for ML model files. Models will be loaded from `${modelsBasePath}/${modelFileName}`. * If not provided, models are expected in a 'models' subdirectory relative to the WASM binary. */ modelsBasePath?: string; } /** * Base interface for ML provider capabilities. * Provides common lifecycle and frame processing methods shared by * FaceDetectionCapability and IdCaptureCapability. */ interface IMLProviderCapability { /** * Whether the provider has been initialized and is ready to process frames. */ readonly initialized: boolean; /** * Initializes the provider with the given configuration. * If WASM was already warmed up via `setup()` or `warmupWasm()`, this returns almost instantly. * @param config - Provider configuration including WASM paths */ initialize(config: TConfig): Promise; /** * Processes a frame through the ML pipeline. * Callbacks set via `setCallbacks()` will be invoked based on the analysis results. * @param image - Image data to process * @throws Error if provider is not initialized */ processFrame(image: ImageData): Promise; /** * Resets the pipeline to its initial state. * Safe to call even if not initialized (no-op in that case). */ reset(): void; /** * Disposes of resources and resets initialization state. * Safe to call even if not initialized. */ dispose(): Promise; } //#endregion //#region ../infra/src/capabilities/IRecordingCapability.d.ts type RecordingPublisher = { getStreamId: () => string | undefined; replaceVideoTrack: (track: MediaStreamTrack) => Promise; destroy: () => void; }; type RecordingConnection = { sessionId: string | undefined; publisher: RecordingPublisher; disconnect: () => Promise; }; type RecordingConnectionEvents = { onSessionConnected?: (sessionId: string | undefined) => void; onSessionDisconnected?: (sessionId: string | undefined) => void; onSessionException?: (params: { name?: string; message?: string; sessionId?: string; }) => void; onPublisherCreated?: (params: { streamId?: string; sessionId?: string; }) => void; onPublisherError?: (params: { message?: string; sessionId?: string; streamId?: string; }) => void; }; type ConnectRecordingParams = { sessionToken: string; stream: MediaStream; events?: RecordingConnectionEvents; }; type IRecordingCapability = { /** * Connects to a recording session and publishes the provided media stream. * Returns a connection handle that can be disconnected and used to manage the publisher. */ connect: (params: ConnectRecordingParams) => Promise; }; //#endregion //#region ../infra/src/capabilities/IStorageCapability.d.ts /** * Storage capability interface for abstracting storage operations. * Enables swapping between browser localStorage and future WASM-based storage. */ interface IStorageCapability { /** * Retrieves a value from storage. * @param key - The storage key * @returns The stored value or null if not found */ get(key: string): Promise; /** * Stores a value in storage. * @param key - The storage key * @param value - The value to store (will be serialized) */ set(key: string, value: T): Promise; /** * Removes a value from storage. * @param key - The storage key to remove */ remove(key: string): Promise; /** * Clears all values from storage. */ clear(): Promise; } //#endregion export { MLProviderConfig as a, IMLProviderCapability as i, IRecordingCapability as n, IncodeCanvas as o, RecordingConnection as r, IStorageCapability as t };