import * as React from 'react'; /** * KindImage parts — the props, the sizing rule and the frame-safe default. * (Split from KindImage.tsx so the kit host can name the default without a cycle.) * * KindImage — THE image a shape shows. Never a bare ``. * * A shape that shows a generated or saved image hands this the saved ref * (`itemState.` after `run_shortcut … expect:"image"`, or any * `{ file_id, src?, width?, height?, mime_type? }`), or a web address (`{ url }` or the bare * string), whose bytes the host fetches through the image door (`fetch_image`). It: * - sizes itself from the image's real width/height and shows the WHOLE image * (`object-contain`) inside `maxHeight` — it never crops; * - renders the host's canonical image component when the host registered one * (the app's image block: expand, share, download, context menu); * - otherwise (the sandbox frame, where no app component can run) shows the * image with Expand and Share, which ask the host — through the component's * own `runAction` — to open the canonical file preview / share window. * * Interface text is layout: labels only, one short line for an error. */ /** * An image a shape shows: a saved file (durable identity) or a web address. `src` is added by the * host when it hands state back. A bare string is a web address. */ interface KindImageRef { file_id?: string | null; /** A web address (https). The host fetches it through the platform image door, size-capped. */ url?: string | null; src?: string | null; src_error?: string | null; width?: number | null; height?: number | null; mime_type?: string | null; organization_id?: string | null; } type RunAction$1 = (key: string, input: unknown) => Promise<{ ok: true; result: unknown; } | { ok: false; error: string; }>; interface KindImageProps { /** The saved image ref or a web address; a missing ref renders nothing, a ref with no `src` yet shows a placeholder. */ image: KindImageRef | string | null | undefined; /** What the image shows (also the file name in the viewer). */ alt?: string; /** The component's `runAction` prop — Expand and Share go through it inside a sandbox frame. */ runAction?: RunAction$1; /** Tallest the image may render, in px. The whole image always shows; it scales down to fit. */ maxHeight?: number; /** While a run is producing the image (no ref yet), show the placeholder anyway. */ pending?: boolean; className?: string; } /** A bare web address is a ref with a url; anything else passes through. */ declare function toKindImageRef(image: KindImageRef | string | null | undefined): KindImageRef | null; type Loaded = { src: string; } | { error: string; }; /** Test seam: forget every loaded image. */ declare function resetKindImageCache(): void; /** * Bytes for an image the host has not handed over yet (a web address, or a saved file shown * outside item state), asked of the host with `fetch_image`; the answer's Blob becomes a local * `blob:` URL. Never throws; a refusal is the host's own sentence. */ declare function loadKindImage(runAction: RunAction$1, source: { url: string; } | { file_id: string; }): Promise; /** * The `src` to draw for a ref: the host-supplied one, else bytes fetched through `fetch_image` * (web addresses always; saved files only when `fetchSaved`). Without `runAction` a web address is * drawn as is (inside the frame the image door routes it). */ declare function useKindImageSource(ref: KindImageRef | null, runAction: RunAction$1 | undefined, fetchSaved?: boolean): { src: string | null; error: string | null; }; /** The box the image lives in: as wide as it can be without exceeding maxHeight, at its own ratio. */ declare function kindImageBoxStyle(image: KindImageRef | null | undefined, maxHeight: number): React.CSSProperties; /** The frame-safe image: whole image, sized box, Expand + Share through the host. */ declare function DefaultKindImage({ image: given, alt, runAction, maxHeight, pending, className }: KindImageProps): React.JSX.Element | null; /** * Shared bits of KindVideo / KindAudio: the ref shape, the actions' answer shape and small pure helpers. */ /** A video or audio a shape shows: a saved file (durable identity) or a web address. */ interface KindMediaRef { /** A saved file's id — preferred. The host fetches the bytes on demand. */ file_id?: string | null; /** A web address, when the media is not a saved file. */ url?: string | null; mime_type?: string | null; width?: number | null; height?: number | null; /** Length in seconds, when known. */ duration?: number | null; organization_id?: string | null; /** A poster image address (web, or a blob: URL the host made). Optional. */ poster?: string | null; /** A playable address the host already made (a blob: URL). When present the media plays at once. */ src?: string | null; } type KindRunAction = (key: string, input: unknown) => Promise<{ ok: true; result: unknown; } | { ok: false; error: string; }>; /** 83 → "1:23", 3725 → "1:02:05"; null when not a usable number. */ declare function formatMediaDuration(seconds: number | null | undefined): string | null; /** The box a video lives in: its real ratio, as wide as it can be without exceeding maxHeight. */ declare function kindVideoBoxStyle(ref: KindMediaRef | null | undefined, maxHeight: number): React.CSSProperties; /** * KindVideo parts — the props and the frame-safe default. * * KindVideo — THE video a shape shows. Never a bare `