import type { Logger } from './types'; export declare const TEXT_LIMIT = 4096; export declare const CAPTION_LIMIT = 4096; export interface ValidationOk { ok: true; } export interface ValidationFail { ok: false; reason: 'too_large' | 'extension_blocked'; detail: string; } export type ValidationResult = ValidationOk | ValidationFail; export type CheckTextLengthResult = { ok: true; } | { ok: false; codePoints: number; limit: number; }; /** * Code-point length check (parity with Python `visible_len`). * `[...text].length` walks the string by Unicode code points, NOT UTF-16 code units — * one astral-plane char (e.g. emoji) counts as 1 here vs 2 with `.length`. */ export declare function checkTextLength(text: string, limit?: number): CheckTextLengthResult; /** * Auto-split for outbound text. Order: * 1. Paragraph boundaries (`\n\n`) * 2. Sentence boundaries (`. `, `! `, `? `, `\n`) * 3. Hard cut on a code-point boundary * * Markdown fenced code blocks (```...```) are kept intact when they fit within `limit`. * * Always returns at least one chunk; for empty input returns `[""]`. */ export declare function splitTextForSending(text: string, limit?: number): string[]; /** * Extracts the lowercased extension from a basename. * * **Pre:** `fileName` MUST be a basename — callers passing a full path must * call `path.basename(...)` (Node `node:path`) first. Slashes are not stripped. * * Examples: * "report.PDF" → "pdf" * "archive.tar.gz" → "gz" * ".dotfile" → "dotfile" * "noext" → "" * "file." → "" */ export declare function normalizeExtension(fileName: string): string; /** * Binary-MB ceiling. Parity with Python's `actual_size / (1024 * 1024)` user-display. */ export declare function bytesToMB(bytes: number): number; /** * Runtime-mutable per-account file upload limits. Server pushes `getFileUploadLimits` * (id matches Python `IncomingUpdateMethod.CHANGED_FILE_UPLOAD_LIMITS`) with payload: * { maxSize: int | null, extensions: { mode: "allow" | "block", list: string[] } | null } * `null` means "limit disabled" (Python parity). * * Static fallback (`staticMaxBytes`) is used only until the first valid server push. * After a server push with `maxSize: null`, the limit is treated as unlimited — we do NOT * fall back to the static cap. */ export declare class FileUploadLimits { private maxSizeFromServer; private hasServerMaxSize; private filterMode; private extensionsSet; private readonly staticMaxBytes; private readonly logger?; constructor(staticMaxBytes: number, logger?: Logger); /** * Validate + apply atomically. Corrupt payload → log warn + no-op (no partial state change). */ updateFromServer(payload: Record): void; /** * Effective max-bytes limit: * - server pushed maxSize=null → Number.MAX_SAFE_INTEGER (limit disabled) * - server pushed integer → that integer * - never pushed → staticMaxBytes */ getMaxBytes(): number; validateFile(fileName: string, sizeBytes: number): ValidationResult; } //# sourceMappingURL=limits.d.ts.map