/** * Shared byte-cap logic for media-upload string fields, used by EVERY path that * can set a media field's value: the file picker, the "paste a value" fallback, * and the pre-submit validation pass. Centralised here so the effective cap and * the decoded byte size are computed IDENTICALLY on all three paths. * * `contentMaxBytes` is a NONSTANDARD JSON-Schema extension keyword — a standard * JSON-Schema validator ignores it. These client-side caps are UX guards that * fail LOUDLY and early on the obvious over-cap input; they are NOT a security * boundary. The SERVER MUST independently validate the decoded size of any * uploaded content. */ /** * Default cap for a media-upload field when neither the schema's `contentMaxBytes` * nor the host's `maxUploadBytes` prop pins one. 10 MiB comfortably fits a typical * image or PDF while still rejecting a runaway upload loudly. */ export declare const DEFAULT_MAX_UPLOAD_BYTES: number; /** * Resolve the effective byte cap for a media field. Precedence: the schema's * per-field `contentMaxBytes` wins (the only channel by which the schema-authoring * party states a per-field cap), else the host's `maxUploadBytes` default, else * {@link DEFAULT_MAX_UPLOAD_BYTES}. */ export declare function effectiveMaxBytes(fieldCap: number | undefined, propCap: number | undefined): number; /** * The DECODED byte size of a media field's string value. The value is either a * raw base64 body or a full `data:;base64,` URL; the cap applies to * the decoded bytes, never the character length. Computed arithmetically from the * base64 length and its `=` padding, so an over-cap value is caught without * allocating the decoded buffer and without throwing on a malformed input. */ export declare function decodedByteSize(value: string): number; /** * The loud, user-visible over-cap message, identical across the picker, the paste * fallback, and validation. `subject` names the rejected input (e.g. a quoted * filename, or `"The pasted value"`). */ export declare function overCapMessage(subject: string, actualBytes: number, maxBytes: number): string; //# sourceMappingURL=media.d.ts.map