/**
* Shared IPFS image failover — the framework-agnostic version of handle.me's gateway race. Given an
* `ipfs://…` (or already-https) source it builds candidate URLs across the configured gateways and
* resolves to the first that actually loads, by tier: our gateways (raced in parallel) → free public
* gateways (raced) → an optional server proxy. Image load/error events fire regardless of CORS, so
* the parallel `Image()` probe works as a pure client-side check with no server involvement.
*/
import { type IpfsGateway } from "./gateways.js";
/** Pull the CID out of an `ipfs://CID`, `ipfs://ipfs/CID`, or `https://gw/ipfs/CID` source. */
export declare function extractIpfsCid(src: string): string | null;
/** Build the URL for one gateway, applying its per-gateway quirks (access token, resize query). */
export declare function gatewayUrl(gateway: IpfsGateway, cid: string, width: number): string;
/**
* Ordered candidate URLs for a source (our gateways → free gateways → NFTCDN → proxy). A non-IPFS
* https source returns just itself; an unrecognized source returns []. Pass `opts.nftcdnUrl` (a
* server-signed NFTCDN URL) to add the fingerprint-based recovery tier. Useful for SSR (use the
* first) or a sequential `
` fallback.
*/
export declare function ipfsImageUrls(src: string | null | undefined, width?: number, opts?: {
nftcdnUrl?: string | null;
}): string[];
export type ImageProbe = (urls: string[], timeoutMs: number) => Promise;
/** Race the given URLs via parallel `Image()` loads; resolve the first that loads, else null. */
export declare const raceImageLoad: ImageProbe;
/**
* Resolve an IPFS (or direct https) image source to a working URL via the tiered gateway failover:
* our gateways → free public gateways → NFTCDN (if `nftcdnUrl` given) → proxy. Returns null if
* nothing loads. `nftcdnUrl` is a server-signed NFTCDN URL (fingerprint-based) that recovers images
* whose IPFS pins have lapsed — compute it server-side (see `../nftcdn`) and pass it in; never sign
* in the browser. `probe` is injectable for tests. Browser-only (uses `Image()`); on the server use
* `ipfsImageUrls()` and emit the first candidate.
*/
export declare function resolveIpfsImage(src: string | null | undefined, { width, probe, nftcdnUrl, }?: {
width?: number;
probe?: ImageProbe;
nftcdnUrl?: string | null;
}): Promise;
//# sourceMappingURL=resolve.d.ts.map