/** * Serializes enhanced DOM trees to string format for LLM consumption */ import { DOMSelectorMap, EnhancedDOMTreeNode, SerializedDOMState, SimplifiedNode } from '../views'; export declare class DOMTreeSerializer { private static readonly PROPAGATING_ELEMENTS; private static readonly DEFAULT_CONTAINMENT_THRESHOLD; private rootNode; private interactiveCounter; private selectorMap; private previousCachedSelectorMap?; private timingInfo; private clickableCache; private enableBboxFiltering; private containmentThreshold; constructor(rootNode: EnhancedDOMTreeNode, previousCachedState?: SerializedDOMState, enableBboxFiltering?: boolean, containmentThreshold?: number); serializeAccessibleElements(): [SerializedDOMState, Record]; /** * Cached version of clickable element detection to avoid redundant calls. */ private isInteractiveCached; /** * Step 1: Create a simplified tree with enhanced element detection. */ private createSimplifiedTree; /** * Step 2: Optimize tree structure. */ private optimizeTree; /** * Assign interactive indices to clickable elements that are also visible. */ private assignInteractiveIndicesAndMarkNewNodes; /** * Filter children contained within propagating parent bounds. */ private applyBoundingBoxFiltering; /** * Recursively filter tree with bounding box propagation. * Bounds propagate to ALL descendants until overridden. */ private filterTreeRecursive; /** * Determine if child should be excluded based on propagating bounds. */ private shouldExcludeChild; /** * Check if child is contained within parent bounds. */ private isContained; /** * Count how many nodes were excluded (for debugging). */ private countExcludedNodes; /** * Check if an element should propagate bounds based on attributes. * If the element satisfies one of the patterns, it propagates bounds to all its children. */ private isPropagatingElement; /** * Serialize the optimized tree to string format. */ static serializeTree(node: SimplifiedNode | null, includeAttributes: string[], depth?: number): string; /** * Build the attributes string for an element. */ static buildAttributesString(node: EnhancedDOMTreeNode, includeAttributes: string[], text: string): string; } /** * Utility function to create SerializedDOMState with LLM representation */ export declare function createSerializedDOMStateWithLLMRepresentation(root: SimplifiedNode | null, selectorMap: DOMSelectorMap): SerializedDOMState & { llmRepresentation: (includeAttributes?: string[]) => string; }; //# sourceMappingURL=serializer.d.ts.map