import { z } from "zod"; import { FitStyleEnum } from '../../index'; import { EffectData, EffectDataOptions } from "./EffectData"; import { FilterData, FilterDataOptions } from "./FilterData"; import { MediaData } from "./MediaData"; import { Subtitles } from "./Subtitles"; import { TransitionData, TransitionDataOptions } from "./TransitionData"; import { MediaInfo } from "../ffmpeg/types/FFmpeg.types"; /** * Options that control how media replacement should update dependent clips. */ export interface ReplaceMediaOptions { mimeType?: string; imageFitStyle?: FitStyleEnum; toCropImage?: boolean; previousMediaWidth?: number; previousMediaHeight?: number; } /** * Identifies a missing asset required to fully restore a project. */ export interface MissingAssetInfo { id: string; provider: string; } /** * Identifies a missing font required to fully restore a project. */ export interface MissingFontInfo { family: string; weight?: string; } /** * Describes all project assets that must be supplied by the host after deserialization. */ export interface LibrarySetupData { missingEffects: MissingAssetInfo[]; missingFilters: MissingAssetInfo[]; missingTransitions: MissingAssetInfo[]; missingFonts: MissingFontInfo[]; } /** * Zod schema for serialized library state. */ export declare const LibrarySchema: z.ZodObject<{ media: z.ZodArray; filename: z.ZodString; permanentUrl: z.ZodOptional; hash: z.ZodOptional; mimeType: z.ZodOptional; customData: z.ZodOptional, "many">>; placeholderClipIds: z.ZodOptional>; }, "strip", z.ZodTypeAny, { type: string; id: string; filename: string; name?: string | undefined; permanentUrl?: string | undefined; hash?: string | undefined; mimeType?: string | undefined; customData?: [string, unknown][] | undefined; placeholderClipIds?: string[] | undefined; }, { type: string; id: string; filename: string; name?: string | undefined; permanentUrl?: string | undefined; hash?: string | undefined; mimeType?: string | undefined; customData?: [string, unknown][] | undefined; placeholderClipIds?: string[] | undefined; }>, "many">; subtitles: z.ZodArray>; }, "strip", z.ZodTypeAny, { text: string; time: number; duration: number; wordTimings?: number[] | undefined; }, { text: string; time: number; duration: number; wordTimings?: number[] | undefined; }>, "many">; }, "strip", z.ZodTypeAny, { id: string; duration: number; language: string; textBlocks: { text: string; time: number; duration: number; wordTimings?: number[] | undefined; }[]; }, { id: string; duration: number; language: string; textBlocks: { text: string; time: number; duration: number; wordTimings?: number[] | undefined; }[]; }>, "many">; effects: z.ZodArray; label: z.ZodOptional; description: z.ZodOptional; defaultValue: z.ZodType, z.ZodTypeDef, Required>; min: z.ZodOptional]>>; max: z.ZodOptional]>>; step: z.ZodOptional]>>; initOnly: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: import('../../index').PropertyDescriptionTypeEnum; name: string; defaultValue: Required; label?: string | undefined; description?: string | undefined; min?: number | number[] | undefined; max?: number | number[] | undefined; step?: number | number[] | undefined; initOnly?: boolean | undefined; }, { type: import('../../index').PropertyDescriptionTypeEnum; name: string; defaultValue: Required; label?: string | undefined; description?: string | undefined; min?: number | number[] | undefined; max?: number | number[] | undefined; step?: number | number[] | undefined; initOnly?: boolean | undefined; }>, "many">; inputTextures: z.ZodOptional>; scaleMode: z.ZodOptional>; mipmap: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name: string; url: string; wrapMode?: import('../../index').InputTextureWrapMode | undefined; scaleMode?: import('../../index').InputTextureScaleMode | undefined; mipmap?: import('../../index').InputTextureMipmapMode | undefined; }, { name: string; url: string; wrapMode?: import('../../index').InputTextureWrapMode | undefined; scaleMode?: import('../../index').InputTextureScaleMode | undefined; mipmap?: import('../../index').InputTextureMipmapMode | undefined; }>, "many">>; autoFit: z.ZodOptional; noTransform: z.ZodOptional; blendMode: z.ZodOptional>; padding: z.ZodOptional; }, "strip", z.ZodTypeAny, { name: string; properties: { type: import('../../index').PropertyDescriptionTypeEnum; name: string; defaultValue: Required; label?: string | undefined; description?: string | undefined; min?: number | number[] | undefined; max?: number | number[] | undefined; step?: number | number[] | undefined; initOnly?: boolean | undefined; }[]; id: string; provider: string; fragmentSrc: string; inputTextures?: { name: string; url: string; wrapMode?: import('../../index').InputTextureWrapMode | undefined; scaleMode?: import('../../index').InputTextureScaleMode | undefined; mipmap?: import('../../index').InputTextureMipmapMode | undefined; }[] | undefined; autoFit?: boolean | undefined; noTransform?: boolean | undefined; blendMode?: import('../../index').BlendModeEnum | undefined; padding?: number | undefined; }, { name: string; properties: { type: import('../../index').PropertyDescriptionTypeEnum; name: string; defaultValue: Required; label?: string | undefined; description?: string | undefined; min?: number | number[] | undefined; max?: number | number[] | undefined; step?: number | number[] | undefined; initOnly?: boolean | undefined; }[]; id: string; provider: string; fragmentSrc: string; inputTextures?: { name: string; url: string; wrapMode?: import('../../index').InputTextureWrapMode | undefined; scaleMode?: import('../../index').InputTextureScaleMode | undefined; mipmap?: import('../../index').InputTextureMipmapMode | undefined; }[] | undefined; autoFit?: boolean | undefined; noTransform?: boolean | undefined; blendMode?: import('../../index').BlendModeEnum | undefined; padding?: number | undefined; }>, "many">; filters: z.ZodArray, "many">; transitions: z.ZodArray; label: z.ZodOptional; description: z.ZodOptional; defaultValue: z.ZodType, z.ZodTypeDef, Required>; min: z.ZodOptional]>>; max: z.ZodOptional]>>; step: z.ZodOptional]>>; initOnly: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: import('../../index').PropertyDescriptionTypeEnum; name: string; defaultValue: Required; label?: string | undefined; description?: string | undefined; min?: number | number[] | undefined; max?: number | number[] | undefined; step?: number | number[] | undefined; initOnly?: boolean | undefined; }, { type: import('../../index').PropertyDescriptionTypeEnum; name: string; defaultValue: Required; label?: string | undefined; description?: string | undefined; min?: number | number[] | undefined; max?: number | number[] | undefined; step?: number | number[] | undefined; initOnly?: boolean | undefined; }>, "many">; inputTextures: z.ZodOptional>; scaleMode: z.ZodOptional>; mipmap: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name: string; url: string; wrapMode?: import('../../index').InputTextureWrapMode | undefined; scaleMode?: import('../../index').InputTextureScaleMode | undefined; mipmap?: import('../../index').InputTextureMipmapMode | undefined; }, { name: string; url: string; wrapMode?: import('../../index').InputTextureWrapMode | undefined; scaleMode?: import('../../index').InputTextureScaleMode | undefined; mipmap?: import('../../index').InputTextureMipmapMode | undefined; }>, "many">>; }, "strip", z.ZodTypeAny, { name: string; properties: { type: import('../../index').PropertyDescriptionTypeEnum; name: string; defaultValue: Required; label?: string | undefined; description?: string | undefined; min?: number | number[] | undefined; max?: number | number[] | undefined; step?: number | number[] | undefined; initOnly?: boolean | undefined; }[]; id: string; provider: string; transitionSrc: string; inputTextures?: { name: string; url: string; wrapMode?: import('../../index').InputTextureWrapMode | undefined; scaleMode?: import('../../index').InputTextureScaleMode | undefined; mipmap?: import('../../index').InputTextureMipmapMode | undefined; }[] | undefined; }, { name: string; properties: { type: import('../../index').PropertyDescriptionTypeEnum; name: string; defaultValue: Required; label?: string | undefined; description?: string | undefined; min?: number | number[] | undefined; max?: number | number[] | undefined; step?: number | number[] | undefined; initOnly?: boolean | undefined; }[]; id: string; provider: string; transitionSrc: string; inputTextures?: { name: string; url: string; wrapMode?: import('../../index').InputTextureWrapMode | undefined; scaleMode?: import('../../index').InputTextureScaleMode | undefined; mipmap?: import('../../index').InputTextureMipmapMode | undefined; }[] | undefined; }>, "many">; customData: z.ZodOptional, "many">>; }, "strip", z.ZodTypeAny, { subtitles: { id: string; duration: number; language: string; textBlocks: { text: string; time: number; duration: number; wordTimings?: number[] | undefined; }[]; }[]; media: { type: string; id: string; filename: string; name?: string | undefined; permanentUrl?: string | undefined; hash?: string | undefined; mimeType?: string | undefined; customData?: [string, unknown][] | undefined; placeholderClipIds?: string[] | undefined; }[]; transitions: { name: string; properties: { type: import('../../index').PropertyDescriptionTypeEnum; name: string; defaultValue: Required; label?: string | undefined; description?: string | undefined; min?: number | number[] | undefined; max?: number | number[] | undefined; step?: number | number[] | undefined; initOnly?: boolean | undefined; }[]; id: string; provider: string; transitionSrc: string; inputTextures?: { name: string; url: string; wrapMode?: import('../../index').InputTextureWrapMode | undefined; scaleMode?: import('../../index').InputTextureScaleMode | undefined; mipmap?: import('../../index').InputTextureMipmapMode | undefined; }[] | undefined; }[]; filters: { name: string; id: string; provider: string; lutUrl: string; }[]; effects: { name: string; properties: { type: import('../../index').PropertyDescriptionTypeEnum; name: string; defaultValue: Required; label?: string | undefined; description?: string | undefined; min?: number | number[] | undefined; max?: number | number[] | undefined; step?: number | number[] | undefined; initOnly?: boolean | undefined; }[]; id: string; provider: string; fragmentSrc: string; inputTextures?: { name: string; url: string; wrapMode?: import('../../index').InputTextureWrapMode | undefined; scaleMode?: import('../../index').InputTextureScaleMode | undefined; mipmap?: import('../../index').InputTextureMipmapMode | undefined; }[] | undefined; autoFit?: boolean | undefined; noTransform?: boolean | undefined; blendMode?: import('../../index').BlendModeEnum | undefined; padding?: number | undefined; }[]; customData?: [string, unknown][] | undefined; }, { subtitles: { id: string; duration: number; language: string; textBlocks: { text: string; time: number; duration: number; wordTimings?: number[] | undefined; }[]; }[]; media: { type: string; id: string; filename: string; name?: string | undefined; permanentUrl?: string | undefined; hash?: string | undefined; mimeType?: string | undefined; customData?: [string, unknown][] | undefined; placeholderClipIds?: string[] | undefined; }[]; transitions: { name: string; properties: { type: import('../../index').PropertyDescriptionTypeEnum; name: string; defaultValue: Required; label?: string | undefined; description?: string | undefined; min?: number | number[] | undefined; max?: number | number[] | undefined; step?: number | number[] | undefined; initOnly?: boolean | undefined; }[]; id: string; provider: string; transitionSrc: string; inputTextures?: { name: string; url: string; wrapMode?: import('../../index').InputTextureWrapMode | undefined; scaleMode?: import('../../index').InputTextureScaleMode | undefined; mipmap?: import('../../index').InputTextureMipmapMode | undefined; }[] | undefined; }[]; filters: { name: string; id: string; provider: string; lutUrl: string; }[]; effects: { name: string; properties: { type: import('../../index').PropertyDescriptionTypeEnum; name: string; defaultValue: Required; label?: string | undefined; description?: string | undefined; min?: number | number[] | undefined; max?: number | number[] | undefined; step?: number | number[] | undefined; initOnly?: boolean | undefined; }[]; id: string; provider: string; fragmentSrc: string; inputTextures?: { name: string; url: string; wrapMode?: import('../../index').InputTextureWrapMode | undefined; scaleMode?: import('../../index').InputTextureScaleMode | undefined; mipmap?: import('../../index').InputTextureMipmapMode | undefined; }[] | undefined; autoFit?: boolean | undefined; noTransform?: boolean | undefined; blendMode?: import('../../index').BlendModeEnum | undefined; padding?: number | undefined; }[]; customData?: [string, unknown][] | undefined; }>; /** * Owns project media, subtitles, effects, filters, transitions, and related asset-processing workflows. */ export declare class Library { media: Record; subtitles: Record; effects: Record; filters: Record; transitions: Record; protected customData?: Map; builtInEffects: Record; private filmstripWorkers; private filmstripQueue; /** * Creates an empty project library. */ constructor(); /** * Initializes all library assets and built-in effect definitions. * * @returns A promise that resolves after the library is ready for use. */ init(): Promise; /** * Destroys active background workers and releases all media assets. * * @returns A promise that resolves after teardown completes. */ destroy(): Promise; /** * Creates and initializes the built-in effect definitions exposed by the SDK. * * @returns A promise that resolves after all built-in effects have been registered. */ createBuiltInEffects(): Promise; /** * Returns a media asset by its library ID. * * @param id Media asset ID to look up. * @returns The matching media asset, or `undefined` if not found. */ getMediaById(id: string): MediaData | undefined; /** * Imports media into the library from a file, URL, or raw bytes. * * @param source Media source to import. * @param mimeType Optional MIME type override for byte or URL inputs. * @param filename Optional filename override. * @param id Optional ID override. * @returns A promise that resolves to the created media ID, or `null` if creation fails before an ID is available. */ addMedia(source: File | string | Uint8Array, mimeType?: string, filename?: string, id?: string): Promise; /** * Restores a serialized media asset into the library. * * @param data Serialized media payload. * @returns A promise that resolves to the restored media ID. */ addSerializedMedia(data: any): Promise; /** * Deletes a media asset and removes any clips that depend on it. * * @param id Media asset ID to delete. * @returns A promise that resolves after deletion completes. */ deleteMedia(id: string): Promise; /** * @deprecated Use syncAllMedia instead, that will also remove media that are not in the library * Stores all media data in the library using the storage controller. * Initiates a batch operation, attempts to store each media asynchronously, * and ensures that all operations are completed. If any error occurs during * the process, it logs the error. Finally, it ends the batch operation. */ /** * Persists every library media item through the configured storage controller. * * @returns A promise that resolves after all store requests have settled. */ storeAllMedia(): Promise; /** * Syncs all media data in the library with the storage controller. * Stores all media data in the library using the storage controller. * Removes media that are not in the library. * Initiates a batch operation, attempts to store each media asynchronously, * removes media that are not in the library asynchronously, * and ensures that all operations are completed. If any error occurs during * the process, it logs the error. Finally, it ends the batch operation. */ /** * Synchronizes stored media across all configured storage providers. * * @returns A promise that resolves after synchronization completes. */ syncAllMedia(): Promise; /** * Replaces an existing media asset with new source content while preserving the media ID. * * @param id Media asset ID to replace. * @param file Replacement media source. * @param replaceOptions Optional replacement behavior. * @returns A promise that resolves to `true` if replacement succeeds. */ replaceMedia(id: string, file: File | string | Uint8Array, replaceOptions?: ReplaceMediaOptions): Promise; /** * Replaces an existing media asset with serialized media data. * * @param data Serialized replacement media payload. * @returns A promise that resolves to `true` if replacement succeeds. */ replaceSerializedMedia(data: any): Promise; /** * Reads media metadata without adding the media to the library. * * @param file Media source to probe. * @returns A promise that resolves to media metadata, or `null` if probing fails. */ probeMediaData(file: File | string | Uint8Array): Promise; /** * Extracts an audio track from a video media asset and imports it back into the library. * * @param mediaId Video media asset ID. * @param audioTrackIndex Audio stream index to extract. * @returns A promise that resolves to the new audio media ID, or `null` if extraction fails. */ extractAudioFromMedia(mediaId: string, audioTrackIndex?: number): Promise; private onFilmstripFrame; private processNextFilmstrip; /** * Queues filmstrip extraction for a media asset. * * @param mediaId Media asset ID to process. * @returns A promise that resolves after the request has been queued. */ createFilmstripWorker(mediaId: string): Promise; /** * Registers a custom effect definition in the library. * * @param options Effect definition options. * @returns A promise that resolves to the created effect ID. */ addEffect(options: EffectDataOptions): Promise; /** * Removes a custom effect definition from the library. * * @param id Effect definition ID to remove. * @returns Nothing. */ removeEffect(id: string): void; /** * Returns an effect definition by ID, including built-in effects. * * @param id Effect definition ID. * @returns The matching effect definition, or `undefined` if not found. */ getEffectById(id: string): EffectData | undefined; /** * Returns all available effect IDs, including registered custom effects and built-in effects. * * @returns The combined effect ID list. */ getAllEffectIds(): string[]; /** * Returns the IDs of custom effects registered in this library instance. * * @returns The registered custom effect IDs. */ getRegisteredEffectIds(): string[]; /** * Returns the IDs of built-in effects shipped with the SDK. * * @returns The built-in effect IDs. */ getBuiltInEffectIds(): string[]; /** * Registers a filter definition in the library. * * @param options Filter definition options. * @returns A promise that resolves to the created filter ID. */ addFilter(options: FilterDataOptions): Promise; /** * Removes a filter definition from the library. * * @param id Filter definition ID to remove. * @returns Nothing. */ removeFilter(id: string): void; /** * Returns the IDs of all registered filters. * * @returns The registered filter IDs. */ getFilterIds(): string[]; /** * Returns a filter definition by ID. * * @param id Filter definition ID. * @returns The matching filter definition, or `undefined` if not found. */ getFilterById(id: string): FilterData | undefined; /** * Registers a transition definition in the library. * * @param options Transition definition options. * @returns A promise that resolves to the created transition ID. */ addTransition(options: TransitionDataOptions): Promise; /** * Removes a transition definition from the library. * * @param id Transition definition ID to remove. * @returns Nothing. */ removeTransition(id: string): void; /** * Returns the IDs of all registered transitions. * * @returns The registered transition IDs. */ getTransitionIds(): string[]; /** * Returns a transition definition by ID. * * @param id Transition definition ID. * @returns The matching transition definition, or `undefined` if not found. */ getTransitionById(id: string): TransitionData | undefined; /** * Adds a subtitles asset to the library. * * @param subtitles Subtitles asset to add. * @returns The subtitles asset ID. */ addSubtitles(subtitles: Subtitles): string; /** * Removes a subtitles asset from the library and deletes dependent timeline clips. * * @param id Subtitles asset ID to remove. * @returns Nothing. */ removeSubtitles(id: string): void; /** * Returns a subtitles asset by ID. * * @param id Subtitles asset ID. * @returns The matching subtitles asset, or `undefined` if not found. */ getSubtitlesById(id: string): Subtitles | undefined; /** * Returns the IDs of all subtitles assets in the library. * * @returns The subtitles asset IDs. */ getSubtitlesIds(): string[]; /** * Removes subtitles assets that are not referenced by any clip on the timeline. * * @returns Nothing. */ removeUnusedSubtitles(): void; /** * Removes media assets that are not referenced by any clip on the timeline. * * @returns A promise that resolves after all unused media items have been deleted. */ removeUnusedMedia(): Promise; /** * Removes custom effects that are not referenced by any clip on the timeline. * * @returns Nothing. */ removeUnusedEffects(): void; /** * Removes filters that are not referenced by any clip on the timeline. * * @returns Nothing. */ removeUnusedFilters(): void; /** * Removes transitions that are not referenced by any layer on the timeline. * * @returns Nothing. */ removeUnusedTransitions(): void; /** * Removes unused media, subtitles, effects, filters, and transitions from the library. * * @returns A promise that resolves after all removable assets have been processed. */ removeUnusedAssets(): Promise; /** * Stores an arbitrary metadata entry on the library instance. * * @param key Metadata key. * @param value Metadata value. * @param overwrite Whether an existing value for the same key may be replaced. * @returns `true` if the value was stored; otherwise `false` when `overwrite` is disabled and the key already exists. */ setCustomData(key: string, value: unknown, overwrite?: boolean): boolean; /** * Returns a previously stored library metadata value. * * @param key Metadata key to look up. * @returns The stored value, or `undefined` if the key is not present. */ getCustomData(key: string): unknown; /** * Indicates whether the library has a stored metadata value for the provided key. * * @param key Metadata key to test. * @returns `true` if the key exists; otherwise `false`. */ hasCustomData(key: string): boolean; /** * Removes all custom metadata stored on the library. * * @returns Nothing. */ clearAllCustomData(): void; /** * Replaces all custom library metadata with a copy of the provided map. * * @param data Metadata entries to store. * @returns Nothing. */ setAllCustomData(data: Map): void; /** * Returns a copy of all custom metadata stored on the library. * * @returns A copied metadata map, or `undefined` if no custom data has been stored. */ getAllCustomData(): Map | undefined; /** * Indicates whether any media asset is still loading, transcoding, or processing. * * @returns `true` if any media item is still processing; otherwise `false`. */ isProcessing(): boolean; /** * Serializes the library and all serializable assets it owns. * * @returns The serialized library payload. */ serialize(): { subtitles: { id: string; duration: number; language: string; textBlocks: { text: string; time: number; duration: number; wordTimings?: number[] | undefined; }[]; }[]; media: { type: string; id: string; filename: string; name?: string | undefined; permanentUrl?: string | undefined; hash?: string | undefined; mimeType?: string | undefined; customData?: [string, unknown][] | undefined; placeholderClipIds?: string[] | undefined; }[]; transitions: { name: string; properties: { type: import('../../index').PropertyDescriptionTypeEnum; name: string; defaultValue: Required; label?: string | undefined; description?: string | undefined; min?: number | number[] | undefined; max?: number | number[] | undefined; step?: number | number[] | undefined; initOnly?: boolean | undefined; }[]; id: string; provider: string; transitionSrc: string; inputTextures?: { name: string; url: string; wrapMode?: import('../../index').InputTextureWrapMode | undefined; scaleMode?: import('../../index').InputTextureScaleMode | undefined; mipmap?: import('../../index').InputTextureMipmapMode | undefined; }[] | undefined; }[]; filters: { name: string; id: string; provider: string; lutUrl: string; }[]; effects: { name: string; properties: { type: import('../../index').PropertyDescriptionTypeEnum; name: string; defaultValue: Required; label?: string | undefined; description?: string | undefined; min?: number | number[] | undefined; max?: number | number[] | undefined; step?: number | number[] | undefined; initOnly?: boolean | undefined; }[]; id: string; provider: string; fragmentSrc: string; inputTextures?: { name: string; url: string; wrapMode?: import('../../index').InputTextureWrapMode | undefined; scaleMode?: import('../../index').InputTextureScaleMode | undefined; mipmap?: import('../../index').InputTextureMipmapMode | undefined; }[] | undefined; autoFit?: boolean | undefined; noTransform?: boolean | undefined; blendMode?: import('../../index').BlendModeEnum | undefined; padding?: number | undefined; }[]; customData?: [string, unknown][] | undefined; }; /** * Creates a library instance from serialized data. * * @param data Serialized library payload. * @returns The deserialized library. */ static deserialize(data: object): Library; }