export type Format = 'webm' | 'hevc'; export interface Files { webm?: string; hevc?: string; stacked?: string; } export interface DeliveryEdge { id: string; source: string; target: string; isLoop: boolean; duration: number; videos?: Files & { variants?: Record; }; sound?: { url?: string; volume?: number; loop?: boolean; }; hasAudio?: boolean; movement?: unknown; [key: string]: unknown; } export interface DeliveryNode { id: string; name?: string; transparentThumbnailUrl?: string; [key: string]: unknown; } export interface Delivery { deliverySchemaVersion: number; playerContract?: number; requires?: string[]; release?: { id?: string; [key: string]: unknown; }; deliveryAccess?: { urlMode?: 'signed' | 'public'; signedUrlExpiresAt?: string; lastFetchedAt?: string; }; runtimeGraph: { initialNode: string; autoPlay?: boolean; clickEffect?: 'ripple' | 'none'; nodes: DeliveryNode[]; edges: DeliveryEdge[]; [key: string]: unknown; }; [key: string]: unknown; } /** * What `delivery` accepts: the delivery, its JSON, or the API response around * it (`{ data: { delivery } }` from `GET .../releases/{id}/delivery`). */ export type DeliveryInput = Delivery | string | { delivery: Delivery; } | { data: { delivery: Delivery; }; }; /** One animation's files, played on its own: `webm` and `hevc` on the web. */ export interface ClipFiles { webm?: string; hevc?: string; } /** * The delivery a lone clip plays as (spec/player.md, "One clip"): one pose, * `clip`, whose loop is the file, `seconds` long. Its own voice, if the file * has one, is heard with sound on. */ export declare function clipDelivery(files: ClipFiles, seconds: number): Delivery; /** The delivery object, and its JSON for the engine. Throws on text that is not JSON. */ export declare function readDelivery(input: DeliveryInput): { delivery: Delivery; json: string; }; /** One file to try: a cache key that survives signed-link refreshes, and its URL. */ export interface FileChoice { key: string; url: string; } /** * The files to try for an edge, best first: the preferred format, then the * other one (spec/player.md, "The file and the size"). With size variants, * the smallest at least `pixels` large, else the base file, else the largest. */ export declare function chooseFiles(edge: DeliveryEdge | undefined, formats: Format[], pixels: number): FileChoice[]; /** * HEVC on Safari and on every iPhone and iPad browser, WebM elsewhere. On the * Mac, any WebKit counts as Safari, also an app's web view (WKWebView, as in * Tauri) whose user agent has no `Safari/`; Chrome, Edge, Opera and * Electron say `AppleWebKit/` too but are Blink. */ export declare function preferredFormats(userAgent: string, maxTouchPoints?: number): Format[]; /** When the signed links expire, in wall-clock milliseconds, if they do. */ export declare function expiresAt(delivery: Delivery): number | null; /** When the server made the delivery (`lastFetchedAt`), on the server's clock, if it says. */ export declare function fetchedAt(delivery: Delivery): number | null; /** The release with its links left out: two deliveries with the same shape differ only in URLs. */ export declare function releaseShape(delivery: Delivery): string; /** Whether `fresh` is the same release as `current`, so only its URLs may change. */ export declare function sameRelease(current: Delivery, fresh: Delivery): boolean; export declare function indexDelivery(delivery: Delivery): { edges: Map; nodes: Map; };