import type { AttachmentSource, API } from 'zca-js'; import type { IDataObject } from 'n8n-workflow'; import type { ZaloCredentials } from './types'; export type FileDownloadOptions = { userAgent?: string; cookie?: string; referer?: string; }; export declare function cookieHeaderFromZaloCredential(cookieRaw: string): string; export declare function buildDownloadOptionsFromCredentials(credentials: ZaloCredentials): FileDownloadOptions; export declare function isZaloCdnUrl(url: string): boolean; /** URL video-sta / d1md.me cần renewlink trước khi forward CDN. */ export declare function isNonForwardableVideoCdnUrl(url: string): boolean; /** Đọc width/height từ box tkhd trong buffer MP4/MOV. */ export declare function parseMp4Dimensions(buffer: Buffer): { width: number; height: number; } | undefined; /** Đọc width/height ảnh từ URL (dùng cookie Zalo cho zdn.vn). */ export declare function probeImageDimensionsFromUrl(url: string, options?: FileDownloadOptions, maxBytes?: number): Promise<{ width: number; height: number; } | undefined>; /** Tải file video nhỏ và đọc kích thước khung hình (portrait/landscape). */ export declare function probeVideoDimensionsFromUrl(url: string, options?: FileDownloadOptions, maxBytes?: number): Promise<{ width: number; height: number; } | undefined>; /** * Tải ảnh/file từ URL. URL zdn.vn (thumb từ trigger) cần cookie + User-Agent Zalo. */ export declare function saveFileFromUrl(url: string, options?: FileDownloadOptions): Promise; export declare function loadAttachmentsFromUrls(urlsRaw: string, options?: FileDownloadOptions): Promise; /** * Tải video từ URL (video-sta, d1md.me cần cookie Zalo). Fallback zca request khi fetch thất bại. */ export declare function saveVideoFileFromUrl(url: string, options?: FileDownloadOptions, api?: API): Promise; export declare function loadVideoFilesFromUrls(urlsRaw: string, options?: FileDownloadOptions, api?: API): Promise; /** * Tải thumb/ảnh từ URL → AttachmentSource (buffer + size) cho zca-js upload. * Dùng cho thumb zdn.vn từ Message Trigger. */ export declare function loadAttachmentSourcesFromUrls(urlsRaw: string, options?: FileDownloadOptions): Promise<{ sources: AttachmentSource[]; tempFiles: string[]; }>; /** Lấy URL ảnh từ data.content tin trigger (thumb / ảnh). Video dùng videoUrl từ enrichMessagePayload. */ export declare function extractImageUrlFromZaloContent(content: unknown): string | undefined; export declare function removeFile(filePath: string): void; export declare function parseUserIds(value: string): string[]; export declare function parseAttachmentUrls(value: string): string[]; /** Đọc danh sách URL media từ output trigger (`mediaUrls`, `mediaUrl`, `videoUrl`). */ export declare function readMediaUrlsFromJson(json: IDataObject): string[];