import type { BrowserContext, Page } from 'playwright'; import { type PreviewPose, type PreviewRest } from '../../visualQa/avatarPreviewMath'; import type { MaterialAudit } from '../../visualQa/avatarMath'; import type { EngineClip } from './engineClips'; import { type HostRendition, type SwapState } from './host'; import { type PhaseName, type TileRequest } from './plan'; import type { MotionId } from './types'; /** Everything that changes what a tile looks like: part of the control cache key. */ export declare const FRAMING: { readonly fill: 0.95; readonly regionFill: 0.8; readonly viewport: readonly [1800, 1400]; readonly aspectCrop: "center-3:4"; readonly revision: 1; }; export interface PageState { found: boolean; mixers: number; actions: Array<{ clip: string; duration: number; weight: number | null; running: boolean | null; }>; clip: string | null; duration: number; dynamicsChains: number | null; frames: number; } export interface RawPose { t: number; positions: string; bones: number[][]; } export interface MotionRead { motion: MotionId; rest: PreviewRest; poses: PreviewPose[]; /** What was read, as the probe returned it: cached for the control and dumped for calibration. */ raw: { rest: unknown; poses: RawPose[]; }; duration: number; clip: string | null; dynamicsChains: number | null; backswing: { left: number | null; right: number | null; }; materials: MaterialAudit | null; facts: Record; } export interface OpenOptions { webBase: string; apiBase: string; host: HostRendition; motion: MotionId; /** The candidate GLB to draw in the host's place; absent = the host's own model (a control). */ candidate?: Buffer; /** Play this clip instead of the Marketplace's walk (the engine's in-world run / idle); absent = the page's own walk. */ clip?: EngineClip; timeoutMs?: number; } export declare class MotionPage { readonly page: Page; readonly opts: OpenOptions; swap: SwapState | null; clipInfo: { name: string; bytes: number; sha256: string; url: string; packVersion: string; } | null; state: PageState | null; private poses; private rest; private duration; private bounds; private aspect; private regionVerts; private constructor(); static open(ctx: BrowserContext, o: OpenOptions): Promise; /** Read the rest mesh + skeleton and the posed mesh/skeleton at `phases` evenly spaced times of one cycle of the clip. */ read(phases?: number): Promise; /** Install a previously read motion (a cached control) so tiles can be shot without re-reading. */ adopt(read: Pick): void; /** The pelvis's ground position at a pose: a clip with root motion (the run) carries the body away from the origin. */ private anchor; /** Bounds of the figure over the whole cycle with each pose centred on its own pelvis (x, z): a stable framing whether or not the clip travels. */ private stableBounds; private regionBounds; /** Photograph one tile: the clip held at pose `poseIdx`, the camera pinned to the fixed view. Returns false when the region has no geometry. */ shoot(req: TileRequest, poseIdx: number, file: string): Promise; close(): Promise; } export type { PhaseName };