/** * `scrape` — zero-dependency string/JSON extraction primitives for * server-rendered pages. * * Consolidates the SSR JSON-store extraction stack the fleet re-implemented at * least five times: musescore's `store.ts` (entity recovery + string-aware * bracket matching), tock's `redux-state.ts` (top-level slice extraction + * JS-literal repair) and `parse.ts` (cycle-guarded deep walkers), zillow's * `page-props.ts` (`findArrayByShape`), etix's `parse.ts` (JSON-LD / OpenGraph * / dataLayer readers), plus the entity-decode/strip-tags helpers duplicated in * alltrails / musescore / signupgenius and the anti-XSSI guard strippers in * workday / canvas / redfin. * * Everything here is pure string/JSON work — NO `node-html-parser`. DOM-level * scraping (tables, link lists) lives in `@chrischall/mcp-utils/html`, which * carries that optional peer dep; this module is safe for the core barrel. */ /** * Decode HTML character references: decimal (`A`) and hex (`A`) * numerics plus the common named entities. `&` is decoded **last** so a * double-escaped entity survives exactly one level (`&lt;` → `<`, not * `<`) — the ordering both alltrails' `stripHtml` and musescore's `decodeText` * depend on when recovering attribute-escaped JSON. Unknown entities pass * through untouched. */ export declare function decodeHtmlEntities(text: string): string; /** * Strip an HTML **fragment** to readable text: tags → spaces, entities decoded * (via {@link decodeHtmlEntities}), whitespace collapsed and trimmed. * * For a full document where inline ``), never a `[^>]*>` regex — the previous * single mega-regex was O(n³) and its `[^>]*>`-per-opener replacement is still * O(n²); string `indexOf` doesn't backtrack, so an unterminated * `