import { F as Func } from './types-BM3BcWj1.js'; export { W as WebStorageKey, a as WebStorageStub, b as WebStorageStubOptions, s as stubWebStorage } from './web-storage-dwQ9E7Lm.js'; import 'vitest'; /** * A host-runner mock function: a callable spy (Vitest `vi.fn()`, Bun `mock()`, * `node:test` `mock.fn()`). The host's own richer surface (`.mock`, * `mockReturnValue`, …) lives on the concrete object; the core treats it as a * plain callable and reads/resets it only through the adapter. */ type MockFn = Func; /** The readable state of one stubbed media element. */ interface MediaElementState { /** Seconds. Starts at the stub's `duration` option (`0` by default), not at the platform's `NaN`. */ duration: number; currentTime: number; paused: boolean; ended: boolean; /** `HAVE_NOTHING` (0) … `HAVE_ENOUGH_DATA` (4), as the platform numbers them. */ readyState: number; error: MediaError | null; } /** What {@link stubMediaElement} installs beyond the defaults. */ interface MediaElementStubOptions { /** Duration every element reports until a spec sets its own. Default `0`. */ duration?: number; /** Answer for `canPlayType(type)`. Default `() => 'probably'`, the opposite of jsdom's blanket `''`. */ canPlayType?: (type: string) => CanPlayTypeResult; } /** The handle a spec drives the stubbed elements through. */ interface MediaElementStub { /** The `play()` spy — shared by every media element, so `mock.instances[0]` identifies which one played. */ readonly play: MockFn; /** The `pause()` spy. */ readonly pause: MockFn; /** The `load()` spy. */ readonly load: MockFn; /** The `canPlayType()` spy — reconfigure it per test to make one codec unsupported. */ readonly canPlayType: MockFn; /** The current state of one element, as the code under test reads it. */ state(element: HTMLMediaElement): MediaElementState; /** * Move an element to a new state and fire the events the browser fires with it. * * `duration` → `durationchange`, `currentTime` → `timeupdate`, `ended: true` → `ended`, * `error` → `error`, `readyState` ≥ 1 → `loadedmetadata`. Several fields in one call produce * several events, in that order. */ set(element: HTMLMediaElement, state: Partial): void; } /** * Make every `