import type { ProxiedActions } from "~/common/worker.d.ts"; import type { Track } from "~/definitions/types.d.ts"; import type { DiffuseElement } from "~/common/element.js"; /** * Consultation. * * `consult` can be "undetermined" if only a scheme was given * instead of a full URI. */ export type Consult = | { supported: false; reason: string } | { supported: true; consult: "undetermined" | boolean }; export type ConsultGrouping = | { available: false; reason: string; scheme: string; uris: string[] } | { available: true; scheme: string; uris: string[] }; export type GroupConsult = Record; export type InputActions = { artwork(uri: string): Promise; consult(uriOrScheme: string): Promise; detach(args: { fileUriOrScheme: string; tracks: Track[] }): Promise; groupConsult(uris: string[]): Promise; list(tracks: Track[]): Promise; resolve(args: { method?: string; uri: string }): Promise; }; export type InputElement = & DiffuseElement & InputSchemeProvider & ProxiedActions & { sources: (tracks: Track[]) => Source[] }; export type InputSchemeProvider = { SCHEME: string }; export type ResolvedUri = undefined | ResolveUriAsUrl | ResolveUriAsStream; export type ResolveUriAsUrl = { expiresAt: number; url: string; }; export type ResolveUriAsStream = { expiresAt: number; mimeType: string; stream: ReadableStream; /** Total duration in seconds. */ duration?: number; }; export type Source = { label: string; uri: string };