import { Page } from 'puppeteer'; import { PDFRef, PDFDocument } from 'pdf-lib'; interface RootOutlineNode { children: (OutlineNode | never)[]; depth: number; parent?: OutlineNode | RootOutlineNode; } interface OutlineNode { title: string; destination: string; children: (OutlineNode | never)[]; depth: number; parent?: OutlineNode | RootOutlineNode; italic?: boolean; bold?: boolean; color?: number[]; } type PDFOutlineItem = OutlineNode; interface OutlineRef { title: string; destination: string; children: (OutlineRef | never)[]; depth: number; ref: PDFRef; parentRef: PDFRef; italic?: boolean; bold?: boolean; color?: number[]; } /** * Parses the outline of a webpage based on specified tags. * @param {Element[]} tagsToProcess - An array of HTML elements to process. * @param {string[]} tags - An array of tag names to use for the outline. * @returns {OutlineNode[]} An array of top-level OutlineNode objects representing the parsed outline. */ /** * Format the outline container selector by removing extra spaces and ensuring trailing space. * * @param {string} outlineContainerSelector - The selector for the outline container. * @returns {string} The formatted selector. */ declare function formatOutlineContainerSelector(outlineContainerSelector: string): string; /** * Gets the outline of a webpage using a headless browser. * @param {Page} page - The page to evaluate. * @param {string[]} tags - An array of tag names to use for the outline. * @param {string} outlineContainerSelector - Outline Container Selector * @returns {Promise} A Promise that resolves to an array of top-level OutlineNode objects representing the parsed outline. */ declare function getOutline(page: Page, tags: string[], outlineContainerSelector?: string): Promise; /** * Sets the outlines of a PDF document from a nested outline tree. * @param {PDFDocument} pdfDoc - The PDF document to set outlines on. * @param {OutlineNode[]} outlines - The nested outline tree to use as outlines. * @param {boolean} [enableWarnings=false] - Whether to generate warnings for missing destinations. * @returns {PDFDocument} The PDF document with outlines set. */ declare function setOutline(pdfDoc: PDFDocument, outlines: OutlineNode[], enableWarnings?: boolean): Promise; export { type OutlineNode, type OutlineRef, type PDFOutlineItem, type RootOutlineNode, formatOutlineContainerSelector, getOutline, setOutline };