import type { Document } from '@gltf-transform/core';
export declare const SOURCE_IMAGE_ROLE_PREFIX = "source-image.";
export declare const SOURCE_IMAGE_MAX_BYTES: number;
export declare const SOURCE_IMAGE_MAX_EDGE = 8192;
export declare const SOURCE_IMAGE_MIMES: readonly ["image/png", "image/jpeg", "image/webp"];
export type CapturedSourceImage = {
/** Capture order (the tag value). */
key: number;
bytes: Uint8Array;
mime: string;
width: number;
height: number;
sha256: string;
name: string;
};
/** Most web texture indexes one source image may feed (the backend refuses more). */
export declare const SOURCE_IMAGE_MAX_FEEDS = 32;
/** `source-image.` or `source-image.++...` for the ascending glTF image indexes one source image feeds. */
export declare function sourceImageRole(indexes: readonly number[]): string;
/** The indexes a role feeds, or null when the role is malformed (same grammar as the backend). */
export declare function parseSourceImageRole(role: string): number[] | null;
export type SourceImageEntry = {
/** Lowest web texture index fed (kept for sidecars written before multi-index roles). */
textureIndex: number;
/** Every web texture index this one image feeds, ascending. Absent in older sidecars: then `[textureIndex]`. */
textureIndexes?: number[];
role: string;
file: string;
mime: string;
width: number;
height: number;
sha256: string;
bytes: number;
};
export type SourceImageSidecar = {
contract: 'helix/source-images@1';
images: SourceImageEntry[];
};
export type SourceImageCapture = {
images: CapturedSourceImage[];
skipped: string[];
/** Number of textures in the captured document that were tagged. */
tagged: number;
};
/**
* Capture the original bytes of every texture in `doc` and tag the texture. PNG/JPEG/WebP bytes are kept exactly as
* imported; any other raster sharp can decode (an embedded raw buffer, TGA-converted data) is re-encoded LOSSLESSLY to PNG.
* KTX2 or undecodable images cannot be a source and are skipped with a reason.
*/
export declare function captureSourceImages(doc: Document): Promise;
/**
* Map every tagged texture of the FINAL document to its captured image, then strip the tag so the web GLB carries no
* trace of it. Returns one entry per final glTF image index that has a source.
*/
export declare function resolveSourceImages(finalDoc: Document, capture: SourceImageCapture): Array<{
textureIndex: number;
image: CapturedSourceImage;
}>;
/** Write `/source-image..` and `/source-images.json`; returns the sidecar. */
export declare function writeSourceImages(dir: string, resolved: Array<{
textureIndex: number;
image: CapturedSourceImage;
}>): SourceImageSidecar;