import { BaseProcessor, ProcessorOptions, ExtractStringsResult, TranslatedString, SourceString } from '../core/baseProcessor'; import { AACTree } from '../core/treeStructure'; import { ValidationResult } from '../validation/validationTypes'; import { ProcessorInput } from '../utils/io'; declare class SnapProcessor extends BaseProcessor { readonly capabilities: { wordList: "none"; preservesAssetsOnSave: boolean; newCellCreation: "allowed"; }; private symbolResolver; private loadAudio; private pageLayoutPreference; constructor(symbolResolver?: unknown | null, options?: ProcessorOptions & { loadAudio?: boolean; pageLayoutPreference?: 'largest' | 'smallest' | 'scanning' | number; }); extractTexts(filePathOrBuffer: ProcessorInput): Promise; loadIntoTree(filePathOrBuffer: ProcessorInput): Promise; processTexts(filePathOrBuffer: ProcessorInput, translations: Map, outputPath: string): Promise; /** * Save a modified tree while preserving the original SQLite schema and data. * * Strategy: copy the original .sps verbatim, then open the copy and replay * `page.pendingMutations` as targeted SQL UPDATE/INSERT statements. Everything * not in the mutation log (PageLayout, ScanGroup, image blobs, ContentTypeData, * ButtonPageLink, etc.) is preserved byte-for-byte from the original. * * This is the asset-preserving counterpart to `saveFromTree` (which builds a * stripped-down DB from scratch and is unsuitable for round-tripping real * TD Snap page sets). * * Supported mutations: * - updateButton(id, patch) → UPDATE Button SET Label/Message WHERE Id = ? * - removeButton(id) → UPDATE ElementPlacement SET Visible = 0 for all * placements pointing at the button's ElementReference * - addButton(button) → INSERT into ElementReference + Button + one * ElementPlacement per existing PageLayout for * the target page (so the button shows in every * layout the user has). Image/audio not yet handled. * * WordList mutations are no-ops on Snap (capabilities.wordList === 'none'). */ saveModifiedTree(originalPath: string, tree: AACTree, outputPath: string): Promise; saveFromTree(tree: AACTree, outputPath: string): Promise; /** * Add audio recording to a button in the database */ addAudioToButton(dbPath: string, buttonId: number, audioData: Uint8Array, metadata?: string): Promise; /** * Create a copy of the pageset with audio recordings added */ createAudioEnhancedPageset(sourceDbPath: string, targetDbPath: string, audioMappings: Map): Promise; /** * Extract buttons from a specific page that need audio recordings */ extractButtonsForAudio(dbPath: string, pageUniqueId: string): Array<{ id: number; label: string; message: string; hasAudio: boolean; }>; /** * 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 Snap file format * @param filePath - Path to the file to validate * @returns Promise with validation result */ validate(filePath: string): Promise; /** * Get available PageLayouts for a Snap file * Useful for UI components that want to let users select layout size * @param filePath - Path to the Snap file * @returns Promise resolving to available PageLayouts with their dimensions */ getAvailablePageLayouts(filePath: string): Promise; } /** * Interface for PageLayout information returned by getAvailablePageLayouts */ export interface PageLayoutInfo { id: number; cols: number; rows: number; size: number; hasScanning: boolean; label: string; } export { SnapProcessor };