import { BaseProcessor, ProcessorOptions, ExtractStringsResult, TranslatedString, SourceString } from '../core/baseProcessor'; import { AACTree } from '../core/treeStructure'; import { type ButtonForTranslation, type LLMLTranslationResult } from '../utilities/translation/translationProcessor'; import { ValidationResult } from '../validation/validationTypes'; import { ProcessorInput } from '../utils/io'; declare class GridsetProcessor extends BaseProcessor { readonly capabilities: { wordList: "native"; preservesAssetsOnSave: boolean; newCellCreation: "restricted"; }; constructor(options?: ProcessorOptions); private getGridsetPassword; private ensureAlphaChannel; /** * Calculate appropriate font color (black or white) based on background brightness * Uses WCAG relative luminance formula to determine contrast */ private getContrastFontColor; /** * Extract words from Grid3 WordList structure */ private _extractWordsFromWordList; private generateCommandsFromSemanticAction; private convertGrid3StyleToAACStyle; private getStyleById; private textOf; extractTexts(filePathOrBuffer: ProcessorInput): Promise; loadIntoTree(filePathOrBuffer: ProcessorInput): Promise; processTexts(filePathOrBuffer: ProcessorInput, translations: Map, outputPath: string): Promise; /** * Extract symbol information from a gridset for LLM-based translation. * Returns a structured format showing which buttons have symbols and their context. * * This method uses shared translation utilities that work across all AAC formats. * * @param filePathOrBuffer - Path to gridset file or buffer * @returns Promise resolving to symbol information for LLM processing */ extractSymbolsForLLM(filePathOrBuffer: string | Buffer): Promise; /** * Apply LLM translations with symbol information. * The LLM should provide translations with symbol attachments in the correct positions. * * This method uses shared translation utilities that work across all AAC formats. * * @param filePathOrBuffer - Path to gridset file or buffer * @param llmTranslations - Array of LLM translations with symbol info * @param outputPath - Where to save the translated gridset * @param options - Translation options (e.g., allowPartial for testing) * @returns Promise resolving to a buffer of the translated gridset */ processLLMTranslations(filePathOrBuffer: string | Buffer, llmTranslations: LLMLTranslationResult[], outputPath: string, options?: { allowPartial?: boolean; }): Promise; saveFromTree(tree: AACTree, outputPath: string): Promise; private calculateColumnDefinitions; private calculateRowDefinitions; /** * Save a modified tree while preserving all original files (settings, images, assets) * This method only updates the grid.xml files for pages in the tree, keeping everything else intact. * It preserves the original grid structure and only updates button labels and messages. * * @param originalPath - Path to the original gridset file * @param tree - Modified AACTree with pages to save * @param outputPath - Path where the modified gridset should be saved */ saveModifiedTree(originalPath: string, tree: AACTree, outputPath: string): Promise; /** * Create a basic grid XML for a page when original doesn't exist */ private createBasicGridXml; private findButtonPosition; /** * Extract strings with metadata for aac-tools-platform compatibility * Uses the generic implementation from BaseProcessor */ extractStringsWithMetadata(filePath: string): Promise; /** * Generate translated download for aac-tools-platform compatibility * Uses the generic implementation from BaseProcessor */ generateTranslatedDownload(filePath: string, translatedStrings: TranslatedString[], sourceStrings: SourceString[]): Promise; /** * Validate Gridset file format * @param filePath - Path to the file to validate * @returns Promise with validation result */ validate(filePath: string): Promise; } export { GridsetProcessor };