rusteerio 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/README.md +7 -0
- package/RELEASING.md +22 -46
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/{chunk-DKULX6VO.mjs → chunk-DMRD3FGC.mjs} +1 -1
- package/dist/chunk-DMRD3FGC.mjs.map +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/slim.cjs.map +1 -1
- package/dist/slim.mjs +1 -1
- package/native/src/arena.rs +42 -13
- package/native/src/lib.rs +187 -17
- package/package.json +1 -1
- package/rusteerio.darwin-arm64.node +0 -0
- package/rusteerio.darwin-x64.node +0 -0
- package/rusteerio.linux-arm64-gnu.node +0 -0
- package/rusteerio.linux-arm64-musl.node +0 -0
- package/rusteerio.linux-x64-gnu.node +0 -0
- package/rusteerio.linux-x64-musl.node +0 -0
- package/rusteerio.win32-arm64-msvc.node +0 -0
- package/rusteerio.win32-x64-msvc.node +0 -0
- package/src/router.ts +3 -2
- package/dist/chunk-DKULX6VO.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/native.ts","../src/codec.ts","../src/transport.ts","../src/hooks.ts","../src/router.ts","../src/nodes.ts","../src/dom.ts","../src/extract-plan.ts","../src/attributes.ts","../src/parse.ts","../src/selection.ts","../src/extract.ts","../src/index.ts","../src/workers.ts","../src/io.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { existsSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { wrapNativeBinding } from './transport.js';\n\nexport interface NativeNodeRecord {\n id: number;\n type: 'root' | 'tag' | 'script' | 'style' | 'text' | 'comment' | 'directive' | 'cdata';\n name?: string;\n data?: string;\n attribs?: Record<string, string>;\n children: number[];\n parent?: number;\n namespace?: string;\n prefix?: string;\n attribsNamespace?: Record<string, string>;\n attribsPrefix?: Record<string, string>;\n doctypeName?: string;\n publicId?: string;\n systemId?: string;\n 'x-name'?: string;\n 'x-publicId'?: string;\n 'x-systemId'?: string;\n 'x-mode'?: 'quirks' | 'limited-quirks' | 'no-quirks';\n [key: string]: any;\n}\n\nexport interface NativeDocument {\n readonly nodeSpace?: object;\n retainNode?(id: number): void;\n retainNodeData?(id: number, data: object): void;\n adopt?(source: NativeDocument, ids: number[], detach?: boolean): string;\n op(command: string, argsJson: string): string;\n create?(html: string, contextId?: number, optionsJson?: string): number[];\n select(selector: string, contexts?: number[]): number[];\n text(ids: number[]): string;\n innerHtml(id: number): string;\n outerHtml(ids: number[]): string;\n attr(id: number, name: string): string | undefined | null;\n tagName(id: number): string | undefined | null;\n exportTree(): string;\n rootId(): number;\n parserDiagnostics?(): string;\n}\n\nexport interface NativeStream {\n write(chunk: string): Promise<void>;\n finish(): Promise<NativeDocument>;\n abort(): void;\n}\n\nexport interface NativeWorkerPoolInfo {\n threads: number;\n activeBatches: number;\n activeWorkers: number;\n peakActiveWorkers: number;\n}\n\nexport interface NativeQuery {\n key: string;\n selector: string;\n attr?: string;\n all?: boolean;\n}\n\nexport interface NativeBinding {\n NativeDocument: new (html: string, isDocument?: boolean, optionsJson?: string) => NativeDocument;\n NativeStream?: new (optionsJson: string, isDocument?: boolean, errorBridge?: (request: string) => string) => NativeStream;\n configureWorkerPool?: (threads: number) => void;\n workerPoolInfo?: () => NativeWorkerPoolInfo;\n extractPlanManyAsync?: (html: string[], planJson: string, threads: number, optionsJson?: string) => Promise<string>;\n parseAsync?: (html: string, isDocument?: boolean, optionsJson?: string) => Promise<NativeDocument>;\n parseManyAsync?: (\n html: string[],\n isDocument: boolean,\n threads: number,\n optionsJson?: string,\n ) => Promise<NativeDocument[]>;\n extractManyAsync?: (\n html: string[],\n queries: NativeQuery[],\n threads: number,\n isDocument?: boolean,\n optionsJson?: string,\n ) => Promise<string>;\n}\n\nlet cached: NativeBinding | undefined;\nlet attempted = false;\nlet bindingError: unknown;\n\n/** Resolve the native addon bundled with the npm package. */\nexport function nativeBinding(): NativeBinding | undefined {\n if (attempted) return cached;\n attempted = true;\n\n // This module is bundled into both CommonJS and ESM entry points. A synthetic\n // absolute filename lets createRequire work in both module formats.\n const moduleDirectory = typeof __dirname === 'string' ? __dirname : dirname(fileURLToPath(import.meta.url));\n const require = createRequire(join(moduleDirectory, 'rusteerio-loader.cjs'));\n const directories = [moduleDirectory, dirname(moduleDirectory)];\n const libc = process.platform === 'linux'\n ? ((process.report?.getReport() as { header?: { glibcVersionRuntime?: string } })?.header?.glibcVersionRuntime ? 'gnu' : 'musl')\n : undefined;\n const platform = `${process.platform}-${process.arch}${libc ? `-${libc}` : process.platform === 'win32' ? '-msvc' : ''}`;\n const names = [`rusteerio.${platform}.node`, 'rusteerio.node'];\n const candidates = [...new Set(directories.flatMap((directory) => names.map((name) => join(directory, name))))];\n\n for (const candidate of candidates) {\n if (!existsSync(candidate)) continue;\n try {\n const loaded: NativeBinding = require(candidate);\n if (typeof loaded.NativeDocument === 'function') {\n cached = wrapNativeBinding(loaded);\n return cached;\n }\n } catch (error) {\n bindingError ??= error;\n }\n }\n return undefined;\n}\n\nexport function requireNative(): NativeBinding {\n const binding = nativeBinding();\n if (binding) return binding;\n throw new Error('Rusteerio could not load its Rust native binding. Reinstall rusteerio for this platform or run \"npm run build:native\" from a source checkout.', { cause: bindingError });\n}\n\n/** Useful for installation diagnostics and benchmarks that require native code. */\nexport function nativeStatus(): { available: boolean; error?: string } {\n const available = !!nativeBinding();\n return available ? { available } : { available, error: String(bindingError ?? 'Native binding not found') };\n}\n","/**\n * Node strings use UTF-16, including unpaired surrogates. Rust strings use\n * Unicode scalar values. Reserve a small private-use alphabet on this private\n * boundary so neither representation loses a code unit.\n */\nconst reserved = /[\\ud800-\\ue800]/;\nconst encoded = /[\\ue000-\\ue800]/;\nconst escapeUnit = 0xe800;\nconst isWellFormed = (String.prototype as String & { isWellFormed?(): boolean }).isWellFormed;\n\nexport function encodeString(value: string): string {\n if (!encoded.test(value) && (isWellFormed ? isWellFormed.call(value) : !reserved.test(value))) return value;\n const parts: string[] = [];\n let start = 0;\n for (let index = 0; index < value.length; index++) {\n const unit = value.charCodeAt(index);\n if (unit >= 0xd800 && unit <= 0xdbff) {\n const next = value.charCodeAt(index + 1);\n if (next >= 0xdc00 && next <= 0xdfff) { index++; continue; }\n }\n let replacement: string | undefined;\n if (unit >= 0xd800 && unit <= 0xdfff) replacement = String.fromCharCode(0xe000 + unit - 0xd800);\n else if (unit >= 0xe000 && unit <= escapeUnit) replacement = '\\ue800' + value[index];\n if (replacement !== undefined) {\n parts.push(value.slice(start, index), replacement);\n start = index + 1;\n }\n }\n return start === 0 ? value : parts.join('') + value.slice(start);\n}\n\nexport function decodeString(value: string): string {\n if (!encoded.test(value)) return value;\n const parts: string[] = [];\n let start = 0;\n for (let index = 0; index < value.length; index++) {\n const unit = value.charCodeAt(index);\n if (unit < 0xe000 || unit > escapeUnit) continue;\n const next = value.charCodeAt(index + 1);\n if (unit === escapeUnit) {\n if (next < 0xe000 || next > escapeUnit || Number.isNaN(next)) continue;\n parts.push(value.slice(start, index), value[++index]);\n } else parts.push(value.slice(start, index), String.fromCharCode(0xd800 + unit - 0xe000));\n start = index + 1;\n }\n return start === 0 ? value : parts.join('') + value.slice(start);\n}\n\n// Transform JSON string tokens rather than the whole JSON text: JSON.stringify\n// escapes lone surrogates, while a literal backslash-u sequence is plain data.\nconst stringToken = /\"(?:[^\"\\\\]|\\\\[\\s\\S])*\"/g;\nconst encodeJsonCandidate = /[\\ud800-\\ue800]|\\\\u(?:d[89a-f][\\da-f]{2}|e[0-8][\\da-f]{2})/i;\nconst escapedJsonCandidate = /\\\\u(?:d[89a-f][\\da-f]{2}|e[0-8][\\da-f]{2})/i;\nconst decodeJsonCandidate = /[\\ue000-\\ue800]|\\\\ue[0-8][\\da-f]{2}/i;\n\nexport function encodeJson(value: string): string {\n if (!encodeJsonCandidate.test(value)) return value;\n if (isWellFormed?.call(value) && !encoded.test(value) && !escapedJsonCandidate.test(value)) return value;\n return value.replace(stringToken, (token) => JSON.stringify(encodeString(JSON.parse(token))));\n}\n\nexport function decodeJson(value: string): string {\n return decodeJsonCandidate.test(value) ? value.replace(stringToken, (token) => JSON.stringify(decodeString(JSON.parse(token)))) : value;\n}\n\n/** Private parser protocol flag, appended without deserializing large options. */\nexport function encodeOptions(value?: string): string {\n if (value === undefined) return '{\"__utf16Codec\":true}';\n const json = encodeJson(value);\n if (!json.trimStart().startsWith('{')) return '{\"__utf16Codec\":true}';\n const end = json.lastIndexOf('}');\n const prefix = json.slice(0, end);\n return prefix + (prefix.trimEnd().endsWith('{') ? '' : ',') + '\"__utf16Codec\":true' + json.slice(end);\n}\n","import { decodeJson, decodeString, encodeJson, encodeOptions, encodeString } from './codec.js';\nimport type { NativeBinding, NativeDocument } from './native.js';\n\ninterface TransportRegistry {\n documents: WeakMap<object, NativeDocument>;\n originals: WeakMap<object, NativeDocument>;\n userErrors: WeakSet<object>;\n}\nconst registryKey = Symbol.for('rusteerio.native-transport.v1');\nconst globals = globalThis as typeof globalThis & { [key: symbol]: TransportRegistry | undefined };\nconst registry = globals[registryKey] ??= { documents: new WeakMap(), originals: new WeakMap(), userErrors: new WeakSet() };\n\n/** Keep the codec at the private addon boundary, including callback RPC. */\nexport function wrapNativeBinding(binding: NativeBinding): NativeBinding {\n const raw = binding as NativeBinding & Record<string, any>;\n const { documents, originals, userErrors } = registry;\n const restoreError = (error: unknown): never => {\n if (error instanceof Error && !userErrors.has(error)) {\n const message = decodeString(error.message);\n if (message !== error.message) {\n const stack = error.stack;\n error.message = message;\n if (stack) error.stack = decodeString(stack);\n }\n }\n throw error;\n };\n const invoke = <T>(call: () => T): T => {\n try {\n const result = call();\n return result instanceof Promise ? result.catch(restoreError) as T : result;\n } catch (error) { return restoreError(error); }\n };\n const wrapBridge = (bridge: (request: string) => string) => (request: string): string => {\n try { return encodeJson(bridge(decodeJson(request))); }\n catch (error) {\n if (error !== null && (typeof error === 'object' || typeof error === 'function')) userErrors.add(error);\n throw error;\n }\n };\n const jsonMethods = new Set(['op', 'node', 'exportTree', 'parserDiagnostics', 'adopt']);\n const wrapDocument = (document: NativeDocument): NativeDocument => {\n const cached = documents.get(document);\n if (cached) return cached;\n const methods = new Map<PropertyKey, unknown>();\n const wrapped = new Proxy(document, {\n get(target, property) {\n const value = Reflect.get(target, property, target);\n if (typeof value !== 'function') return value;\n if (property === 'constructor') return value;\n if (methods.has(property)) return methods.get(property);\n const method = (...input: any[]) => invoke(() => {\n const args = input.slice();\n if (property === 'op') args[1] = encodeJson(args[1]);\n else if (property === 'create') { args[0] = encodeString(args[0]); if (typeof args[2] === 'string') args[2] = encodeOptions(args[2]); }\n else if (property === 'select' || property === 'matches') args[0] = encodeString(args[0]);\n else if (property === 'attr') args[1] = encodeString(args[1]);\n else if (property === 'adopt') args[0] = originals.get(args[0]) ?? args[0];\n const result = Reflect.apply(value, target, args);\n if (property === 'op' && args[0] === 'serialize' && typeof result === 'string' && result.startsWith('{')) {\n const error = JSON.parse(result).__nativeError;\n if (error?.name === 'URIError') throw new URIError(error.message);\n }\n return typeof result === 'string' ? jsonMethods.has(String(property)) ? decodeJson(result) : decodeString(result) : result;\n });\n methods.set(property, method);\n return method;\n },\n });\n documents.set(document, wrapped);\n originals.set(wrapped, document);\n return wrapped;\n };\n const wrapStream = (stream: any) => {\n let carry = '';\n return {\n async write(chunk: string) {\n let source = carry + chunk;\n carry = '';\n const last = source.charCodeAt(source.length - 1);\n if (last >= 0xd800 && last <= 0xdbff) { carry = source.slice(-1); source = source.slice(0, -1); }\n if (source) await invoke(() => stream.write(encodeString(source)));\n },\n async finish() {\n if (carry) { const final = carry; carry = ''; await invoke(() => stream.write(encodeString(final))); }\n return wrapDocument(await invoke(() => stream.finish()));\n },\n abort() { carry = ''; return invoke(() => stream.abort()); },\n };\n };\n const wrapConstructor = (Constructor: any, argumentsFor: (args: any[]) => any[], wrap: (value: any) => any) => new Proxy(Constructor, {\n construct(target, args) { return wrap(invoke(() => Reflect.construct(target, argumentsFor(args)))); },\n });\n const wrapped: NativeBinding & Record<string, any> = { ...raw };\n wrapped.NativeDocument = wrapConstructor(raw.NativeDocument, ([html, isDocument, options]) => [encodeString(html), isDocument, encodeOptions(options)], wrapDocument);\n if (raw.NativeStream) wrapped.NativeStream = wrapConstructor(raw.NativeStream, ([options, isDocument, bridge]) => [encodeOptions(options), isDocument, bridge && wrapBridge(bridge)], wrapStream);\n if (raw.NativeHookStream) wrapped.NativeHookStream = wrapConstructor(raw.NativeHookStream, ([isDocument, options, bridge]) => [isDocument, encodeOptions(options), wrapBridge(bridge)], wrapStream);\n if (raw.parseWithTreeAdapter) wrapped.parseWithTreeAdapter = (source: string, isDocument: boolean, options: string, bridge: (request: string) => string) => wrapDocument(invoke(() => raw.parseWithTreeAdapter(encodeString(source), isDocument, encodeOptions(options), wrapBridge(bridge))));\n if (raw.parseAsync) wrapped.parseAsync = async (source, isDocument, options) => wrapDocument(await invoke(() => raw.parseAsync!(encodeString(source), isDocument, encodeOptions(options))));\n if (raw.parseManyAsync) wrapped.parseManyAsync = async (sources, isDocument, threads, options) => (await invoke(() => raw.parseManyAsync!(sources.map(encodeString), isDocument, threads, encodeOptions(options)))).map(wrapDocument);\n if (raw.extractPlanManyAsync) wrapped.extractPlanManyAsync = async (sources, plan, threads, options) => decodeJson(await invoke(() => raw.extractPlanManyAsync!(sources.map(encodeString), encodeJson(plan), threads, encodeOptions(options))));\n if (raw.extractManyAsync) wrapped.extractManyAsync = async (sources, queries, threads, isDocument, options) => decodeJson(await invoke(() => raw.extractManyAsync!(sources.map(encodeString), queries.map((query) => ({ ...query, key: encodeString(query.key), selector: encodeString(query.selector), ...(query.attr === undefined ? {} : { attr: encodeString(query.attr) }) })), threads, isDocument, encodeOptions(options))));\n return wrapped;\n}\n","import { requireNative, type NativeDocument } from './native.js';\nimport { getNode, hydrateLocation } from './nodes.js';\nimport { routeDocument } from './router.js';\nimport type { CheerioOptions } from './types.js';\nimport type { TokenizerCallbacks } from './parser-types.js';\n\nconst tokenCallbacks = ['onattribdata', 'onattribentity', 'onattribend', 'onattribname', 'oncdata', 'onclosetag', 'oncomment', 'ondeclaration', 'onend', 'onopentagend', 'onopentagname', 'onprocessinginstruction', 'onselfclosingtag', 'ontext', 'ontextentity'] as const;\n\nexport function createTokenizerSession(options: CheerioOptions): { write(chunk: string): void; end(): CheerioOptions } {\n const events: unknown[][] = [];\n const callbacks = Object.fromEntries(tokenCallbacks.map((name) => [name, (...args: number[]) => {\n if (name === 'ontextentity' || name === 'onattribentity') {\n const codePoint = +args[0];\n String.fromCodePoint(codePoint);\n args[0] = codePoint;\n }\n events.push([name, ...args]);\n }]));\n const Constructor = options.Tokenizer!;\n const tokenizer = new Constructor(options, callbacks as unknown as TokenizerCallbacks);\n return {\n write(chunk) { if (tokenizer.running) tokenizer.write(chunk); },\n end() { tokenizer.end(); const result = cleanParserOptions(options); result.__tokenEvents = events; return result; },\n };\n}\n\nexport function cleanParserOptions(options: CheerioOptions): CheerioOptions {\n const result = { ...options };\n delete result.Tokenizer; delete result.treeAdapter; delete result.onParseError;\n delete result.__tokenEvents;\n if (!options._useHtmlParser2 && options.onParseError) { result.__collectParseErrors = true; result.sourceCodeLocationInfo = true; }\n return result;\n}\n\n/** User tokenizers run on JavaScript; their actual events are consumed by Rust. */\nexport function parserOptions(source: string, options: CheerioOptions): CheerioOptions {\n if (options._useHtmlParser2 && options.Tokenizer) {\n const session = createTokenizerSession(options);\n session.write(source);\n return session.end();\n }\n return cleanParserOptions(options);\n}\n\nexport function deliverParseErrors(document: NativeDocument, options: CheerioOptions): void {\n if (options._useHtmlParser2 || !options.onParseError) return;\n const diagnostics = (document as NativeDocument & { parserDiagnostics?(): string | unknown[] }).parserDiagnostics?.();\n const errors = typeof diagnostics === 'string' ? JSON.parse(diagnostics) : diagnostics ?? [];\n for (const error of errors) options.onParseError(error);\n}\n\nexport function hasParserHooks(options: CheerioOptions): boolean {\n return !!(options._useHtmlParser2 ? options.Tokenizer : options.treeAdapter || options.onParseError);\n}\n\n/** A live tree adapter bridge. Every tree-builder decision consults the user's adapter. */\nfunction treeAdapterBridge(adapter: any, options: CheerioOptions) {\n const deliveredErrors = new Set<string>();\n const nodes: any[] = [];\n const ids = new WeakMap<object, number>();\n const identify = (node: any): number | null => {\n if (node == null) return null;\n if (typeof node !== 'object') throw new TypeError('treeAdapter methods must return DOM node objects');\n let id = ids.get(node);\n if (id === undefined) { id = nodes.length; ids.set(node, id); nodes.push(node); }\n return id;\n };\n const nodeArgs: Record<string, number[]> = {\n appendChild: [0, 1], insertBefore: [0, 1, 2], setTemplateContent: [0, 1], getTemplateContent: [0],\n setDocumentType: [0], setDocumentMode: [0], getDocumentMode: [0], detachNode: [0], insertText: [0],\n insertTextBefore: [0, 2], adoptAttributes: [0], getFirstChild: [0], getChildNodes: [0], getParentNode: [0],\n getAttrList: [0], getTagName: [0], getNamespaceURI: [0], getTextNodeContent: [0], getCommentNodeContent: [0],\n getDocumentTypeNodeName: [0], getDocumentTypeNodePublicId: [0], getDocumentTypeNodeSystemId: [0],\n isTextNode: [0], isCommentNode: [0], isElementNode: [0], isDocumentTypeNode: [0],\n setNodeSourceCodeLocation: [0], getNodeSourceCodeLocation: [0], updateNodeSourceCodeLocation: [0],\n onItemPop: [0, 1], onItemPush: [0],\n };\n const nodeReturns = new Set(['createDocument', 'createDocumentFragment', 'createElement', 'createCommentNode', 'createTextNode', 'getTemplateContent', 'getFirstChild', 'getParentNode']);\n const invoke = (method: string, args: any[]): any => {\n const fn = adapter[method];\n if (typeof fn !== 'function') {\n if (method === 'onItemPop' || method === 'onItemPush') return undefined;\n throw new TypeError(`treeAdapter.${method} must be a function`);\n }\n return Reflect.apply(fn, adapter, args);\n };\n const snapshot = () => {\n const records: any[] = [];\n for (let id = 0; id < nodes.length; id++) {\n const node = nodes[id];\n const element = invoke('isElementNode', [node]);\n const text = invoke('isTextNode', [node]);\n const comment = invoke('isCommentNode', [node]);\n const doctype = invoke('isDocumentTypeNode', [node]);\n const name = element ? invoke('getTagName', [node]) : doctype ? '!doctype' : node.name;\n const type = element ? name === 'script' || name === 'style' ? name : 'tag' : text ? 'text' : comment ? 'comment' : doctype ? 'directive' : node.type ?? 'root';\n const children = element || type === 'root' || type === 'cdata' ? invoke('getChildNodes', [node]) ?? [] : [];\n const record: any = { id, type, children: Array.from(children, identify), parent: identify(invoke('getParentNode', [node])) };\n if (name !== undefined) record.name = name;\n if (element) {\n record.namespace = invoke('getNamespaceURI', [node]);\n record.attribs = Object.create(null); record.attribsNamespace = Object.create(null); record.attribsPrefix = Object.create(null);\n for (const attr of invoke('getAttrList', [node])) {\n Object.defineProperty(record.attribs, attr.name, { value: attr.value, enumerable: true, configurable: true, writable: true });\n record.attribsNamespace[attr.name] = attr.namespace; record.attribsPrefix[attr.name] = attr.prefix;\n }\n } else if (text || comment) record.data = invoke(text ? 'getTextNodeContent' : 'getCommentNodeContent', [node]);\n else if (doctype) {\n record.data = node.data;\n for (const [field, method] of [['x-name', 'getDocumentTypeNodeName'], ['x-publicId', 'getDocumentTypeNodePublicId'], ['x-systemId', 'getDocumentTypeNodeSystemId']]) record[field] = invoke(method, [node]);\n }\n if (type === 'root' && node['x-mode'] !== undefined) record['x-mode'] = invoke('getDocumentMode', [node]);\n for (const field of ['startIndex', 'endIndex', 'sourceCodeLocation']) if (node[field] !== undefined) record[field] = node[field];\n records.push(record);\n }\n return records;\n };\n const bridge = (request: string): string => {\n const { method, args = [] } = JSON.parse(request);\n if (method === '__parseError') {\n deliveredErrors.add(JSON.stringify(args[0]));\n options.onParseError?.(args[0]);\n return 'null';\n }\n if (method === '__snapshot') return JSON.stringify(snapshot());\n if (method === '__locations') {\n for (const entry of args[0]) invoke('setNodeSourceCodeLocation', [nodes[entry.id], hydrateLocation(entry.location)]);\n return 'null';\n }\n const values = args.slice();\n if (method === 'setNodeSourceCodeLocation' || method === 'updateNodeSourceCodeLocation') hydrateLocation(values[1]);\n for (const index of nodeArgs[method] ?? []) values[index] = values[index] == null ? null : nodes[values[index]];\n const result = invoke(method, values);\n return JSON.stringify(method === 'getChildNodes' ? Array.from(result ?? [], identify) : nodeReturns.has(method) ? identify(result) : result ?? null);\n };\n return { bridge, nodes, deliveredErrors };\n}\n\nfunction bindAdapterDocument(document: NativeDocument, options: CheerioOptions, adapter: ReturnType<typeof treeAdapterBridge>): NativeDocument {\n if (options.onParseError) {\n const errors = (document as NativeDocument & { parserDiagnostics?(): string }).parserDiagnostics?.();\n for (const error of errors ? JSON.parse(errors) : []) if (!adapter.deliveredErrors.has(JSON.stringify(error))) options.onParseError(error);\n }\n const routed = routeDocument(document, options);\n const globalId = (routed as NativeDocument & { localNodeId(id: number): number }).localNodeId.bind(routed);\n for (let id = 0; id < adapter.nodes.length; id++) getNode(routed, globalId(id), adapter.nodes[id]);\n return routed;\n}\n\nexport function createTreeAdapterSession(options: CheerioOptions, isDocument: boolean): { write(chunk: string): Promise<void>; end(): Promise<NativeDocument>; abort(): void } {\n const binding = requireNative() as ReturnType<typeof requireNative> & {\n NativeHookStream?: new (isDocument: boolean, options: string, bridge: (request: string) => string) => { write(chunk: string): Promise<void> | void; finish(): Promise<NativeDocument> | NativeDocument; abort(): void };\n };\n if (!binding.NativeHookStream) throw new Error('This native addon does not support streaming treeAdapter hooks; rebuild the Rust addon.');\n const adapter = treeAdapterBridge(options.treeAdapter, options);\n let hasFailure = false;\n let failure: unknown;\n let aborted = false;\n const bridge = (request: string): string => {\n if (hasFailure || aborted) return '{\"__rusteerioHookError\":true}';\n try { return adapter.bridge(request); }\n catch (error) { hasFailure = true; failure = error; return '{\"__rusteerioHookError\":true}'; }\n };\n const parser = new binding.NativeHookStream(isDocument, JSON.stringify(cleanParserOptions(options)), bridge);\n const restoreFailure = (error: unknown): never => { if (hasFailure) throw failure; throw error; };\n return {\n async write(chunk) {\n try { await parser.write(chunk); if (hasFailure) throw failure; }\n catch (error) { restoreFailure(error); }\n },\n async end() {\n try {\n const document = await parser.finish();\n if (hasFailure) throw failure;\n return bindAdapterDocument(document, options, adapter);\n } catch (error) { return restoreFailure(error); }\n },\n abort() { aborted = true; parser.abort(); },\n };\n}\n\nexport function parseNativeDocument(source: string, options: CheerioOptions, isDocument: boolean): NativeDocument {\n const binding = requireNative();\n const nativeOptions = parserOptions(source, options);\n if (!options._useHtmlParser2 && options.treeAdapter) {\n const parse = (binding as typeof binding & { parseWithTreeAdapter?(source: string, isDocument: boolean, options: string, bridge: (request: string) => string): NativeDocument }).parseWithTreeAdapter;\n if (!parse) throw new Error('This native addon does not support treeAdapter hooks; rebuild the Rust addon.');\n const adapter = treeAdapterBridge(options.treeAdapter, options);\n return bindAdapterDocument(parse(source, isDocument, JSON.stringify(nativeOptions), adapter.bridge), options, adapter);\n }\n const document = new binding.NativeDocument(source, isDocument, JSON.stringify(nativeOptions));\n deliverParseErrors(document, options);\n return routeDocument(document, options);\n}\n\n/** Error-only streams keep the Rust DOM and deliver diagnostics during writes. */\nexport function createDiagnosticSession(options: CheerioOptions, isDocument = true): { write(chunk: string): Promise<void>; end(): Promise<NativeDocument>; abort(): void } {\n const binding = requireNative() as ReturnType<typeof requireNative> & {\n NativeStream?: new (options: string, isDocument: boolean, bridge: (request: string) => string) => { write(chunk: string): Promise<void>; finish(): Promise<NativeDocument>; abort(): void };\n };\n if (!binding.NativeStream) throw new Error('This native addon does not support incremental parser diagnostics; rebuild the Rust addon.');\n let hasFailure = false;\n let failure: unknown;\n let aborted = false;\n const bridge = (request: string): string => {\n if (hasFailure || aborted) return '{\"__rusteerioHookError\":true}';\n try {\n const { method, args } = JSON.parse(request);\n if (method === '__parseError') options.onParseError?.(args[0]);\n return 'null';\n } catch (error) { hasFailure = true; failure = error; return '{\"__rusteerioHookError\":true}'; }\n };\n const parser = new binding.NativeStream(JSON.stringify(cleanParserOptions(options)), isDocument, bridge);\n const restoreFailure = (error: unknown): never => { if (hasFailure) throw failure; throw error; };\n return {\n async write(chunk) { try { await parser.write(chunk); if (hasFailure) throw failure; } catch (error) { restoreFailure(error); } },\n async end() { try { const document = await parser.finish(); if (hasFailure) throw failure; return routeDocument(document, options); } catch (error) { return restoreFailure(error); } },\n abort() { aborted = true; parser.abort(); },\n };\n}\n","import { requireNative, type NativeDocument, type NativeNodeRecord } from './native.js';\nimport { hasParserHooks, parseNativeDocument } from './hooks.js';\nimport type { CheerioOptions } from './types.js';\n\ninterface NativeMemoryStats { live: number; slots: number; retained: number; reclaimed: number; immutableNodes: number; externalBytes: number }\ninterface ManagedNativeDocument extends NativeDocument {\n retain?(ids: number[]): void;\n release?(ids: number[]): void;\n collectGarbage?(): NativeMemoryStats;\n}\ninterface PinRecord { global: number; document: WeakRef<ManagedNativeDocument>; local: number }\ninterface Handle { global: number; document: ManagedNativeDocument; local: number; data?: object; pin: PinRecord }\ninterface HandleEntry { reference: WeakRef<Handle>; pin: PinRecord }\ninterface Registry {\n next: number;\n space: object;\n handles: Map<number, WeakRef<Handle>>;\n byDocument: WeakMap<NativeDocument, Map<number, HandleEntry>>;\n finalizer: FinalizationRegistry<PinRecord>;\n snapshots: WeakMap<NativeDocument, Map<number, NativeNodeRecord | null>>;\n}\nconst registryKey = Symbol.for('rusteerio.native-handles.v2');\nconst globals = globalThis as typeof globalThis & { [key: symbol]: Registry | undefined };\nconst registry: Registry = globals[registryKey] ??= (() => {\n const handles = new Map<number, WeakRef<Handle>>();\n const byDocument = new WeakMap<NativeDocument, Map<number, HandleEntry>>();\n const snapshots = new WeakMap<NativeDocument, Map<number, NativeNodeRecord | null>>();\n const pending: PinRecord[] = [];\n let scheduled = false;\n const flush = () => {\n scheduled = false;\n const batches = new Map<ManagedNativeDocument, number[]>();\n for (const pin of pending.splice(0)) {\n const document = pin.document.deref();\n if (!document) continue;\n const entries = byDocument.get(document);\n if (entries?.get(pin.local)?.pin === pin) entries.delete(pin.local);\n const ids = batches.get(document) ?? [];\n ids.push(pin.local); batches.set(document, ids);\n }\n for (const [document, ids] of batches) {\n snapshots.delete(document);\n document.release?.(ids);\n document.collectGarbage?.();\n }\n };\n return { next: 1, space: {}, handles, byDocument, snapshots, finalizer: new FinalizationRegistry<PinRecord>((pin) => {\n if (!handles.get(pin.global)?.deref()) handles.delete(pin.global);\n pending.push(pin);\n if (!scheduled) { scheduled = true; queueMicrotask(flush); }\n }) };\n})();\n\nfunction rawOperation<T = any>(document: NativeDocument, command: string, args: any): T {\n const result = document.op(command, JSON.stringify(args));\n return result === '' || result === undefined ? undefined as T : JSON.parse(result);\n}\nfunction localMap(document: NativeDocument): Map<number, HandleEntry> {\n let map = registry.byDocument.get(document);\n if (!map) registry.byDocument.set(document, map = new Map());\n return map;\n}\nfunction handleFor(document: ManagedNativeDocument, local: number): Handle {\n const map = localMap(document);\n let handle = map.get(local)?.reference.deref();\n if (!handle || handle.document !== document || handle.local !== local) {\n const pin: PinRecord = { global: registry.next++, document: new WeakRef(document), local };\n handle = { global: pin.global, document, local, pin };\n document.retain?.([local]);\n const reference = new WeakRef(handle);\n map.set(local, { reference, pin }); registry.handles.set(handle.global, reference);\n registry.finalizer.register(handle, pin);\n }\n return handle;\n}\n\n/** Keep numeric native IDs alive for precisely the lifetime of their JS owner. */\nexport function retainNodes(document: NativeDocument, ids: number[]): object {\n return (document as NativeDocument & { retainNodes?(ids: number[]): object }).retainNodes?.(ids) ?? {};\n}\n\n/**\n * Maps stable JS handles to their current native arena. Native adoption moves\n * the DOM; this bridge only translates IDs and routes commands to its owner.\n * Global tables contain weak references. Live APIs and node handles retain the\n * ownership records they use, including records moved to another arena.\n */\nexport class RoutedDocument implements NativeDocument {\n readonly nodeSpace = registry.space;\n readonly options: CheerioOptions;\n private readonly anchor: Handle;\n get raw(): ManagedNativeDocument { return this.anchor.document; }\n\n constructor(document: NativeDocument, options: CheerioOptions = {}, anchor?: Handle) {\n this.options = options;\n this.anchor = anchor ?? handleFor(document, document.rootId());\n }\n private keep(handle: Handle): number { return handle.global; }\n private lookup(id: number): Handle {\n const handle = registry.handles.get(id)?.deref();\n if (!handle) throw new RangeError(`Unknown native node handle ${id}`);\n return handle;\n }\n private global(document: NativeDocument, local: number): number { return this.keep(handleFor(document, local)); }\n private globals(document: NativeDocument, ids: number[]): number[] { return ids.map((id) => this.global(document, id)); }\n retainNode(id: number): void { this.lookup(id); }\n retainNodes(ids: number[]): object { return ids.filter((id) => id !== undefined).map((id) => this.lookup(id)); }\n nodeDocument(id: number): NativeDocument { return new RoutedDocument(this.raw, this.options, this.lookup(id)); }\n collectGarbage(): NativeMemoryStats | undefined { registry.snapshots.delete(this.raw); return this.raw.collectGarbage?.(); }\n retainNodeData(id: number, data: object): void { this.lookup(id).data = data; }\n nodeData(id: number): object | undefined { return this.lookup(id).data; }\n nodeDataOperation(id: number): (command: string, args: any) => any {\n const handle = this.lookup(id);\n const options = this.options;\n return (command, args) => rawOperation(handle.document, command, { ...args, ids: [handle.local], options });\n }\n localNodeId(id: number): number { return this.global(this.raw, id); }\n rootId(): number { return this.global(this.raw, this.raw.rootId()); }\n\n private record(document: NativeDocument, record: NativeNodeRecord | null): NativeNodeRecord | null {\n if (!record) return null;\n const view = { ...record, id: this.global(document, record.id) };\n // Translate links only when read. A text callback must not allocate/pin\n // handles for every unobserved child and sibling in its ancestor records.\n Object.defineProperty(view, 'children', { enumerable: true, get: () => this.globals(document, record.children ?? []) });\n for (const key of ['parent', 'prev', 'next']) Object.defineProperty(view, key, { enumerable: true, get: () => record[key] == null ? null : this.global(document, record[key]) });\n return view;\n }\n private groups(ids: number[]): { document: NativeDocument; ids: number[]; global: number[] }[] {\n const groups: { document: NativeDocument; ids: number[]; global: number[] }[] = [];\n for (const id of ids) {\n const handle = this.lookup(id);\n const last = groups[groups.length - 1];\n if (last?.document === handle.document) { last.ids.push(handle.local); last.global.push(id); }\n else groups.push({ document: handle.document, ids: [handle.local], global: [id] });\n }\n return groups;\n }\n private call<T = any>(document: NativeDocument, command: string, args: any): T {\n if (command === 'extractPlan' && JSON.stringify(args.plan).includes('innerHTML')) registry.snapshots.delete(document);\n if (Object.hasOwn(args, 'value') || ['create', 'createNode', 'setNode', 'import', 'insert', 'clone', 'remove', 'removeAttr', 'removeData', 'addClass', 'removeClass', 'toggleClass'].includes(command)) registry.snapshots.delete(document);\n return rawOperation(document, command, { ...args, options: args.options ?? this.options });\n }\n\n private move(target: NativeDocument, ids: number[], copy = false): number[] {\n if (!copy) {\n const groups = new Map<NativeDocument, Handle[]>();\n for (const id of ids) { const handle = this.lookup(id); const group = groups.get(handle.document) ?? []; group.push(handle); groups.set(handle.document, group); }\n for (const [source, handles] of groups) {\n if (source === target) continue;\n if (!target.adopt) throw new Error('The native addon does not support cross-document adoption. Rebuild the Rust addon.');\n registry.snapshots.delete(source); registry.snapshots.delete(target);\n const adopted: { mapping: [number, number][] } = JSON.parse(target.adopt(source, handles.map((handle) => handle.local), true));\n for (const [oldLocal, newLocal] of adopted.mapping) {\n const entry = localMap(source).get(oldLocal);\n if (!entry) continue;\n const handle = entry.reference.deref();\n if (handle && (handle.document !== source || handle.local !== oldLocal)) continue;\n localMap(source).delete(oldLocal);\n entry.pin.document = new WeakRef(target); entry.pin.local = newLocal;\n if (handle) { handle.document = target; handle.local = newLocal; }\n localMap(target).set(newLocal, entry);\n }\n }\n return ids.map((id) => this.lookup(id).local);\n }\n const result: number[] = [];\n for (const group of this.groups(ids)) {\n if (copy && group.document === target) {\n result.push(...this.call<number[]>(target, 'clone', { ids: group.ids, deep: true }));\n continue;\n }\n if (!target.adopt) throw new Error('The native addon does not support cross-document adoption. Rebuild the Rust addon.');\n registry.snapshots.delete(target);\n const adopted: { roots: number[]; mapping: [number, number][] } = JSON.parse(target.adopt(group.document, group.ids, !copy));\n result.push(...adopted.roots);\n }\n return result;\n }\n\n private scratch(command: string, args: any, ids: number[]): any {\n const documents = [...new Set(ids.map((id) => this.lookup(id).document))];\n const scratch = new (requireNative().NativeDocument)('', false, JSON.stringify(args.options ?? this.options));\n const toScratch = new Map<number, number>();\n const fromScratch = new Map<number, number>();\n for (const document of documents) {\n const records: NativeNodeRecord[] = JSON.parse(document.exportTree());\n const roots = records.filter((record) => record.parent == null).map((record) => record.id);\n if (!scratch.adopt) throw new Error('The native addon does not support native document copies.');\n const copied: { mapping: [number, number][] } = JSON.parse(scratch.adopt(document, roots, false));\n for (const [local, copy] of copied.mapping) {\n const global = this.global(document, local);\n toScratch.set(global, copy); fromScratch.set(copy, global);\n }\n }\n const translated = { ...args };\n for (const key of ['ids', 'contexts']) if (Array.isArray(args[key])) translated[key] = args[key].map((id: number) => toScratch.get(id)).filter((id: number | undefined) => id !== undefined);\n if (args.pseudoMatches) translated.pseudoMatches = Object.fromEntries(Object.entries(args.pseudoMatches).map(([key, values]) => [key, (values as number[]).map((id) => toScratch.get(id)).filter((id) => id !== undefined)]));\n const result = this.call(scratch, command, translated);\n return ['select', 'matches', 'uniqueSort'].includes(command) ? (result as number[]).map((id) => fromScratch.get(id)!).filter((id) => id !== undefined) : result;\n }\n\n select(selector: string, contexts?: number[]): number[] {\n const ids = contexts ?? [this.rootId()];\n if (!ids.length) return this.call(this.raw, 'select', { selector, contexts: [] });\n const groups = this.groups(ids);\n if (new Set(groups.map((group) => group.document)).size > 1) return this.scratch('select', { selector, contexts: ids }, ids);\n const group = groups[0];\n const found = group.document === this.raw ? group.document.select(selector, group.ids) : this.call<number[]>(group.document, 'select', { selector, contexts: group.ids });\n return this.globals(group.document, found);\n }\n text(ids: number[]): string { return this.groups(ids).map((group) => group.document.text(group.ids)).join(''); }\n innerHtml(id: number): string { const handle = this.lookup(id); registry.snapshots.delete(handle.document); return handle.document === this.raw ? handle.document.innerHtml(handle.local) : this.call(handle.document, 'html', { ids: [handle.local] }); }\n outerHtml(ids: number[]): string { return this.groups(ids).map((group) => group.document === this.raw ? group.document.outerHtml(group.ids) : this.call<string>(group.document, 'render', { ids: group.ids })).join(''); }\n attr(id: number, name: string): string | undefined { const handle = this.lookup(id); return this.call(handle.document, 'attr', { ids: [handle.local], name }) ?? undefined; }\n tagName(id: number): string | undefined { const handle = this.lookup(id); return rawOperation<NativeNodeRecord | null>(handle.document, 'node', { id: handle.local })?.name; }\n exportTree(): string { return JSON.stringify((JSON.parse(this.raw.exportTree()) as NativeNodeRecord[]).map((record) => this.record(this.raw, record))); }\n create(html: string, contextId?: number): number[] { return JSON.parse(this.op('create', JSON.stringify({ html, contextId }))); }\n\n op(command: string, json: string): string { return JSON.stringify(this.operate(command, JSON.parse(json)) ?? null); }\n\n operate(command: string, args: any): any {\n const options = args.options ?? this.options;\n let result: any;\n if (command === 'node') {\n const handle = this.lookup(args.id);\n let snapshots = registry.snapshots.get(handle.document);\n if (!snapshots) registry.snapshots.set(handle.document, snapshots = new Map());\n if (!snapshots.has(handle.local)) snapshots.set(handle.local, rawOperation(handle.document, 'node', { id: handle.local }));\n result = this.record(handle.document, snapshots.get(handle.local)!);\n } else if (command === 'createNode') result = this.global(this.raw, this.call<number>(this.raw, command, args));\n else if (command === 'create') {\n const context = args.contextId == null ? undefined : this.lookup(args.contextId);\n const document = context?.document ?? this.raw;\n if (hasParserHooks(options)) {\n const contextRecord = context ? rawOperation<NativeNodeRecord>(context.document, 'node', { id: context.local }) : undefined;\n const parsed = parseNativeDocument(args.html, { ...options, ...(contextRecord ? { __contextName: contextRecord.name, __contextNamespace: contextRecord.namespace } : {}) }, false);\n const children = rawOperation<NativeNodeRecord>(parsed, 'node', { id: parsed.rootId() }).children;\n this.move(document, children);\n result = children;\n } else result = this.globals(document, this.call(document, command, { ...args, contextId: context?.local }));\n } else if (command === 'import') result = this.globals(this.raw, this.call(this.raw, command, args));\n else if (command === 'setNode') {\n let handle = this.lookup(args.id);\n let value = args.value;\n if (args.field === 'children') value = this.move(handle.document, value ?? []);\n else if (['parent', 'parentNode', 'prev', 'previousSibling', 'next', 'nextSibling'].includes(args.field) && value != null) {\n const pointer = this.lookup(value);\n if (pointer.document !== handle.document) { this.move(pointer.document, [args.id]); handle = this.lookup(args.id); }\n value = this.lookup(args.value).local;\n }\n result = this.call(handle.document, command, { ...args, id: handle.local, value });\n } else if (command === 'insert') {\n const targets: number[] = args.targetIds ?? [];\n const nodes: number[] = args.nodeIds ?? [];\n result = [];\n for (let index = 0; index < targets.length; index++) {\n const target = this.lookup(targets[index]);\n const local = this.move(target.document, nodes, index + 1 < targets.length);\n const inserted = this.call<number[]>(target.document, command, { ...args, targetIds: [target.local], nodeIds: local });\n result.push(...this.globals(target.document, inserted));\n }\n } else if (command === 'html' && Object.hasOwn(args, 'value') && hasParserHooks(options)) {\n result = null;\n for (const id of args.ids ?? []) {\n const target = this.lookup(id);\n const record = rawOperation<NativeNodeRecord>(target.document, 'node', { id: target.local });\n if (!['root', 'tag', 'script', 'style', 'cdata'].includes(record.type)) continue;\n const parsed = parseNativeDocument(String(args.value), { ...options, __contextName: record.name, __contextNamespace: record.namespace }, false);\n const children = rawOperation<NativeNodeRecord>(parsed, 'node', { id: parsed.rootId() }).children;\n const local = this.move(target.document, children);\n result = this.call(target.document, 'setNode', { id: target.local, field: 'children', value: local, options });\n }\n } else if (command === 'contains') {\n const parent = this.lookup(args.container ?? args.parent);\n const child = this.lookup(args.contained ?? args.child);\n result = parent.document === child.document && this.call(parent.document, command, { container: parent.local, contained: child.local });\n } else if (command === 'prop' && Object.hasOwn(args, 'value') && ['children', 'childNodes', 'parent', 'parentNode', 'prev', 'previousSibling', 'next', 'nextSibling'].includes(args.name)) {\n result = null;\n for (const id of args.ids ?? []) {\n let handle = this.lookup(id);\n let value = args.value;\n if (args.name === 'children' || args.name === 'childNodes') value = this.move(handle.document, value ?? []);\n else if (value != null) {\n const pointer = this.lookup(value);\n if (pointer.document !== handle.document) { this.move(pointer.document, [id]); handle = this.lookup(id); }\n value = this.lookup(args.value).local;\n }\n result = this.call(handle.document, command, { ...args, ids: [handle.local], value });\n }\n } else {\n const ids: number[] = command === 'select' ? args.contexts ?? [this.rootId()] : args.ids ?? [];\n const groups = this.groups(ids);\n const mixed = new Set(groups.map((group) => group.document)).size > 1;\n if (mixed && ['select', 'matches', 'uniqueSort', 'serializeArray', 'serialize', 'extractPlan'].includes(command)) result = this.scratch(command, { ...args, options }, ids);\n else if (command === 'extractPlan') {\n const group = groups[0];\n result = this.call(group?.document ?? this.raw, command, { ...args, options, ids: group?.ids ?? [] });\n }\n else if (['select', 'matches', 'uniqueSort', 'traverse', 'clone'].includes(command)) {\n result = [];\n if (!groups.length && (command === 'select' || command === 'matches')) result = this.call(this.raw, command, { ...args, options, ids: [], ...(command === 'select' ? { contexts: [] } : {}) });\n for (const group of groups) {\n const values = this.call<number[]>(group.document, command, { ...args, options, ids: group.ids, ...(command === 'select' ? { contexts: group.ids } : {}), ...(args.pseudoMatches ? { pseudoMatches: Object.fromEntries(Object.entries(args.pseudoMatches).map(([key, values]) => [key, (values as number[]).map((id) => this.lookup(id)).filter((handle) => handle.document === group.document).map((handle) => handle.local)])) } : {}) });\n result.push(...this.globals(group.document, values));\n }\n } else if (['render', 'outerHtml', 'text'].includes(command) && !Object.hasOwn(args, 'value')) result = groups.map((group) => this.call<string>(group.document, command, { ...args, options, ids: group.ids })).join('');\n else if (command === 'hasClass') result = groups.some((group) => this.call<boolean>(group.document, command, { ...args, options, ids: group.ids }));\n else if (['serializeArray', 'serialize'].includes(command)) result = groups.length ? this.call(groups[0].document, command, { ...args, options, ids: groups[0].ids }) : command === 'serializeArray' ? [] : '';\n else {\n if (command === 'html') for (const group of groups) registry.snapshots.delete(group.document);\n const writes = Object.hasOwn(args, 'value') || ['remove', 'removeAttr', 'removeData', 'addClass', 'removeClass', 'toggleClass'].includes(command);\n const active = writes ? groups : groups.slice(0, 1);\n result = null;\n for (const group of active) result = this.call(group.document, command, { ...args, options, ids: group.ids });\n }\n }\n return result ?? null;\n }\n}\n\nexport function routeDocument(document: NativeDocument, options: CheerioOptions = {}): NativeDocument {\n return document.nodeSpace === registry.space ? document : new RoutedDocument(document, options);\n}\n\nexport function sameNodeSpace(first: NativeDocument, second: NativeDocument): boolean {\n return first === second || !!first.nodeSpace && first.nodeSpace === second.nodeSpace;\n}\n","import type { NativeDocument, NativeNodeRecord } from './native.js';\nimport type { AnyNode } from './types.js';\nimport { nodePrototype } from './dom.js';\nimport { sameNodeSpace } from './router.js';\n\nexport interface NodeBinding { document: NativeDocument; id: number }\ninterface ViewState { document: NativeDocument; id: number; lease?: object; children?: AnyNode[]; attributes?: Record<string, string>; maps?: Record<string, Record<string, string>> }\ninterface NodeState { views: WeakMap<object, ViewState>; bindings: WeakMap<object, NodeBinding>; caches: WeakMap<object, Map<number, WeakRef<AnyNode>>>; finalizer: FinalizationRegistry<{ cache: Map<number, WeakRef<AnyNode>>; id: number }> }\nconst nodeStateKey = Symbol.for('rusteerio.native-node-views.v2');\nconst nodeGlobals = globalThis as typeof globalThis & { [key: symbol]: NodeState | undefined };\nconst nodeState: NodeState = nodeGlobals[nodeStateKey] ??= { views: new WeakMap(), bindings: new WeakMap(), caches: new WeakMap(), finalizer: new FinalizationRegistry(({ cache, id }) => { if (!cache.get(id)?.deref()) cache.delete(id); }) };\nconst { bindings, caches } = nodeState;\nconst arrayIndex = /^(?:0|[1-9]\\d*)$/;\n\nexport function operation<T = any>(document: NativeDocument, command: string, args: unknown = {}): T {\n const direct = (document as NativeDocument & { operate?(command: string, args: unknown): T }).operate;\n if (direct) return direct.call(document, command, args);\n const value = document.op(command, JSON.stringify(args));\n return (value === undefined || value === '' ? undefined : JSON.parse(value)) as T;\n}\n\nexport function nodeBinding(node: unknown): NodeBinding | undefined {\n return node && typeof node === 'object' ? bindings.get(node) : undefined;\n}\n\nexport function nodeId(node: unknown, document?: NativeDocument): number | undefined {\n const binding = nodeBinding(node);\n return binding && (!document || sameNodeSpace(document, binding.document)) ? binding.id : undefined;\n}\n\n/** Recreate parse5's null-prototype attribute maps and shared start-tag map. */\nexport function hydrateLocation<T>(location: T): T {\n if (!location || typeof location !== 'object') return location;\n const value = location as Record<string, any>;\n if (value.attrs && typeof value.attrs === 'object') Object.setPrototypeOf(value.attrs, null);\n if (value.startTag?.attrs && typeof value.startTag.attrs === 'object') {\n Object.setPrototypeOf(value.startTag.attrs, null);\n if (value.attrs && JSON.stringify(value.attrs) === JSON.stringify(value.startTag.attrs)) value.startTag.attrs = value.attrs;\n }\n return location;\n}\n\nexport function nodeRecord(document: NativeDocument, id: number): NativeNodeRecord {\n return operation(document, 'node', { id });\n}\n\nfunction setField(document: NativeDocument, id: number, field: string, value: unknown): void {\n operation(document, 'setNode', { id, field, value });\n}\n\nfunction attributes(document: NativeDocument, id: number, field = 'attribs', prototype: object | null = (document as NativeDocument & { options?: { _useHtmlParser2?: boolean } }).options?._useHtmlParser2 === false ? null : Object.prototype): Record<string, string> {\n const read = () => (nodeRecord(document, id) as any)?.[field] ?? {};\n const target = Object.create(prototype);\n return new Proxy(target, {\n get(_target, key) { return typeof key === 'symbol' ? Reflect.get(target, key) : Object.hasOwn(read(), key) ? read()[key] : Reflect.get(target, key); },\n set(_target, key, value) { setField(document, id, field, { ...read(), [key]: String(value) }); return true; },\n deleteProperty(_target, key) { const values = { ...read() }; delete values[key]; setField(document, id, field, values); return true; },\n ownKeys() { return Reflect.ownKeys(read()); },\n has(_target, key) { return Object.hasOwn(read(), key) || key in target; },\n getOwnPropertyDescriptor(_target, key) { return Object.hasOwn(read(), key) ? { value: read()[key], writable: true, enumerable: true, configurable: true } : undefined; },\n defineProperty(_target, key, descriptor) { const values = { ...read(), [key]: String(descriptor.value) }; setField(document, id, field, values); return true; },\n });\n}\n\nfunction children(document: NativeDocument, id: number): AnyNode[] {\n const read = (): number[] => nodeRecord(document, id)?.children ?? [];\n const snapshot = () => read().map((child) => getNode(document, child));\n const save = (nodes: unknown[]) => setField(document, id, 'children', importNodes(document, nodes));\n const mutating = new Set(['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse', 'copyWithin', 'fill']);\n const target: AnyNode[] = [];\n return new Proxy(target, {\n get(_target, key, receiver) {\n if (key === 'length') return read().length;\n if (typeof key === 'string' && arrayIndex.test(key)) { const child = read()[Number(key)]; return child === undefined ? undefined : getNode(document, child); }\n if (typeof key === 'string' && mutating.has(key)) return (...args: unknown[]) => {\n const values = snapshot();\n const result = Reflect.apply((Array.prototype as any)[key], values, args);\n save(values);\n return result === values ? receiver : result;\n };\n return Reflect.get(target, key, receiver);\n },\n set(_target, key, value) {\n const values = snapshot();\n if (key === 'length') values.length = value;\n else if (typeof key === 'string' && arrayIndex.test(key)) values[Number(key)] = value;\n else return Reflect.set(target, key, value);\n save(values); return true;\n },\n deleteProperty(_target, key) { if (typeof key === 'string' && arrayIndex.test(key)) { const values = snapshot(); values.splice(Number(key), 1); save(values); return true; } return Reflect.deleteProperty(target, key); },\n has(_target, key) { return typeof key === 'string' && arrayIndex.test(key) ? Number(key) < read().length : Reflect.has(target, key); },\n ownKeys() { return [...read().map((_child, i) => String(i)), 'length']; },\n getOwnPropertyDescriptor(_target, key) {\n if (key === 'length') return { ...Reflect.getOwnPropertyDescriptor(target, 'length')!, value: read().length };\n if (typeof key === 'string' && arrayIndex.test(key) && Number(key) < read().length) return { value: getNode(document, read()[Number(key)]), writable: true, enumerable: true, configurable: true };\n return Reflect.getOwnPropertyDescriptor(target, key);\n },\n });\n}\n\nconst parentAliases: Record<string, string> = { parentNode: 'parent', previousSibling: 'prev', nextSibling: 'next' };\nconst sourceFields = new Set(['type', 'name', 'data', 'namespace', 'prefix', 'startIndex', 'endIndex', 'sourceCodeLocation', 'x-name', 'x-publicId', 'x-systemId', 'x-mode']);\nconst tagTypes = new Set(['tag', 'script', 'style']);\nconst parentTypes = new Set(['root', 'tag', 'script', 'style', 'cdata']);\nconst dataTypes = new Set(['text', 'comment', 'directive']);\nfunction viewKeys(record: NativeNodeRecord): string[] {\n const keys = ['parent', 'prev', 'next', 'startIndex', 'endIndex'];\n if (parentTypes.has(record.type)) keys.push('children');\n if (record.data !== undefined) keys.push('data');\n if (record.name !== undefined) keys.push('name');\n if (tagTypes.has(record.type)) keys.push('attribs');\n keys.push('type');\n for (const field of sourceFields) if (!keys.includes(field) && field in record) keys.push(field);\n if (tagTypes.has(record.type)) {\n if ('attribsNamespace' in record) keys.push('x-attribsNamespace');\n if ('attribsPrefix' in record) keys.push('x-attribsPrefix');\n }\n return keys;\n}\nfunction viewValue(state: ViewState, key: string, receiver: any): any {\n const { document, id } = state;\n const record = nodeRecord(document, id);\n if (key === 'cloneNode') return cloneNode;\n if (key === 'nodeType') return ({ root: 9, text: 3, comment: 8, cdata: 4 } as Record<string, number>)[record.type] ?? 1;\n if (key === 'tagName' && tagTypes.has(record.type)) return record.name;\n if (key === 'nodeValue' && dataTypes.has(record.type)) return record.data;\n const pointer = parentAliases[key] ?? key;\n if (['parent', 'prev', 'next'].includes(pointer)) return record[pointer] == null ? null : getNode(document, record[pointer]);\n if (['children', 'childNodes', 'firstChild', 'lastChild'].includes(key) && parentTypes.has(record.type)) {\n const list = state.children ??= children(document, id);\n return key === 'firstChild' ? list[0] ?? null : key === 'lastChild' ? list[list.length - 1] ?? null : list;\n }\n if (key === 'attribs' && tagTypes.has(record.type)) return state.attributes ??= attributes(document, id);\n if ((key === 'x-attribsNamespace' && 'attribsNamespace' in record || key === 'x-attribsPrefix' && 'attribsPrefix' in record) && tagTypes.has(record.type)) {\n state.maps ??= {};\n return state.maps[key] ??= attributes(document, id, key === 'x-attribsNamespace' ? 'attribsNamespace' : 'attribsPrefix');\n }\n if (key === 'attributes' && tagTypes.has(record.type)) {\n const attrs = state.attributes ??= attributes(document, id);\n return Object.keys(attrs).map((name) => ({ name, value: attrs[name], namespace: record.attribsNamespace?.[name], prefix: record.attribsPrefix?.[name] }));\n }\n if (key === 'sourceCodeLocation') return hydrateLocation(record[key]);\n if (sourceFields.has(key)) return record[key] ?? (key === 'startIndex' || key === 'endIndex' ? null : undefined);\n return undefined;\n}\nfunction writeView(state: ViewState, key: string, value: any): boolean {\n const { document, id } = state;\n const record = nodeRecord(document, id);\n if (key === 'tagName' && tagTypes.has(record.type)) key = 'name';\n else if (key === 'nodeValue' && dataTypes.has(record.type)) key = 'data';\n else if (key === 'childNodes') key = 'children';\n else key = parentAliases[key] ?? key;\n if (sourceFields.has(key) || ['attribs', 'x-attribsNamespace', 'x-attribsPrefix'].includes(key)) { setField(document, id, key, value); return true; }\n if (key === 'children' && parentTypes.has(record.type)) { setField(document, id, key, importNodes(document, value)); return true; }\n if (['parent', 'prev', 'next'].includes(key)) { setField(document, id, key, value == null ? null : importNodes(document, [value])[0]); return true; }\n return false;\n}\nconst nodeHandler: ProxyHandler<object> = {\n get(target, key, receiver) {\n if (Reflect.getOwnPropertyDescriptor(target, key)) return Reflect.get(target, key, receiver);\n if (typeof key === 'string') {\n const state = nodeState.views.get(target)!;\n if (key === 'cloneNode' || key === 'nodeType' || sourceFields.has(key) || ['tagName', 'nodeValue', 'parent', 'prev', 'next', 'parentNode', 'previousSibling', 'nextSibling', 'children', 'childNodes', 'firstChild', 'lastChild', 'attribs', 'attributes', 'x-attribsNamespace', 'x-attribsPrefix'].includes(key)) return viewValue(state, key, receiver);\n }\n return Reflect.get(target, key, receiver);\n },\n set(target, key, value, receiver) {\n if (Reflect.getOwnPropertyDescriptor(target, key)) return Reflect.set(target, key, value, receiver);\n if (typeof key === 'string' && writeView(nodeState.views.get(target)!, key, value)) return true;\n return Reflect.set(target, key, value, receiver);\n },\n has(target, key) { return Reflect.has(target, key) || typeof key === 'string' && (viewKeys(nodeRecord(nodeState.views.get(target)!.document, nodeState.views.get(target)!.id)).includes(key) || ['cloneNode', 'nodeType', 'parentNode', 'previousSibling', 'nextSibling'].includes(key)); },\n ownKeys(target) { const state = nodeState.views.get(target)!; return [...new Set([...viewKeys(nodeRecord(state.document, state.id)), ...Reflect.ownKeys(target)])]; },\n getOwnPropertyDescriptor(target, key) {\n const existing = Reflect.getOwnPropertyDescriptor(target, key);\n if (existing) return existing;\n const state = nodeState.views.get(target)!;\n if (typeof key === 'string' && viewKeys(nodeRecord(state.document, state.id)).includes(key)) return { value: viewValue(state, key, undefined), configurable: true, enumerable: true, writable: true };\n return undefined;\n },\n};\n\n/** Stable DOM node identities; each property reads or updates the Rust arena. */\nexport function getNode(document: NativeDocument, id: number, original?: any): AnyNode {\n const cacheKey = document.nodeSpace ?? document;\n let cache = caches.get(cacheKey);\n if (!cache) caches.set(cacheKey, cache = new Map());\n const existing = cache.get(id)?.deref();\n if (existing) return existing;\n document = (document as NativeDocument & { nodeDocument?(id: number): NativeDocument }).nodeDocument?.(id) ?? document;\n const lease = (document as NativeDocument & { retainNodes?(ids: number[]): object }).retainNodes?.([id]);\n const record = nodeRecord(document, id);\n if (!record) return undefined as unknown as AnyNode;\n if (original === undefined) {\n const target = Object.create(nodePrototype(record.type));\n const node = new Proxy(target, nodeHandler) as AnyNode;\n nodeState.views.set(target, { document, id, lease });\n cache.set(id, new WeakRef(node));\n nodeState.finalizer.register(node, { cache, id });\n bindings.set(node, { document, id });\n return node;\n }\n const node: any = original;\n cache.set(id, new WeakRef(node));\n nodeState.finalizer.register(node, { cache, id });\n bindings.set(node, { document, id });\n const read = (): any => { void lease; return nodeRecord(document, id); };\n const define = (key: string, get: () => unknown, set?: (value: any) => void, enumerable = true) => {\n try { Object.defineProperty(node, key, { configurable: true, enumerable, get, ...(set ? { set } : {}) }); } catch { /* Foreign user properties may be non-configurable. */ }\n };\n for (const field of ['type', 'name', 'data', 'namespace', 'prefix', 'startIndex', 'endIndex', 'sourceCodeLocation', 'x-name', 'x-publicId', 'x-systemId', 'x-mode']) {\n if (field in record || ['type', 'startIndex', 'endIndex'].includes(field)) define(field, () => (field === 'sourceCodeLocation' ? hydrateLocation(read()[field]) : read()[field]) ?? (field === 'startIndex' || field === 'endIndex' ? null : undefined), (value) => setField(document, id, field, value));\n }\n for (const field of ['parent', 'prev', 'next']) define(field, () => { const value = read()[field]; return value === null || value === undefined ? null : getNode(document, value); }, (value) => setField(document, id, field, value == null ? null : importNodes(document, [value])[0]));\n for (const [alias, field] of [['parentNode', 'parent'], ['previousSibling', 'prev'], ['nextSibling', 'next']]) define(alias, () => node[field], (value) => { node[field] = value; }, false);\n if ('children' in record && ['root', 'tag', 'script', 'style', 'cdata'].includes(record.type)) {\n const list = children(document, id);\n define('children', () => list, (value) => setField(document, id, 'children', importNodes(document, value)));\n define('childNodes', () => list, (value) => { node.children = value; }, false);\n define('firstChild', () => list[0] ?? null, undefined, false);\n define('lastChild', () => list[list.length - 1] ?? null, undefined, false);\n }\n if (['tag', 'script', 'style'].includes(record.type)) {\n const attrs = attributes(document, id, 'attribs', Object.getPrototypeOf(original.attribs ?? {}));\n define('attribs', () => attrs, (value) => setField(document, id, 'attribs', value));\n define('tagName', () => node.name, (value) => { node.name = value; }, false);\n for (const field of ['x-attribsNamespace', 'x-attribsPrefix']) {\n if (!((field === 'x-attribsNamespace' ? 'attribsNamespace' : 'attribsPrefix') in record) && !Object.hasOwn(original, field)) continue;\n const values = attributes(document, id, field === 'x-attribsNamespace' ? 'attribsNamespace' : 'attribsPrefix');\n define(field, () => values, (value) => setField(document, id, field, value));\n }\n define('attributes', () => Object.keys(attrs).map((name) => ({ name, value: attrs[name], namespace: read().attribsNamespace?.[name], prefix: read().attribsPrefix?.[name] })), undefined, false);\n }\n if (['text', 'comment', 'directive'].includes(record.type)) define('nodeValue', () => node.data, (value) => { node.data = value; }, false);\n define('nodeType', () => ({ root: 9, text: 3, comment: 8, cdata: 4 } as Record<string, number>)[read().type] ?? 1, undefined, false);\n Object.defineProperty(node, 'cloneNode', { configurable: true, enumerable: false, writable: true, value: cloneNode });\n return node;\n}\n\n/** Clone through the receiver's current native owner, including borrowed calls. */\nexport function cloneNode<T extends AnyNode>(this: T, recursive = false): T {\n const binding = nodeBinding(this);\n if (!binding) throw new TypeError('cloneNode requires a native DOM node receiver');\n return getNode(binding.document, operation<number[]>(binding.document, 'clone', { ids: [binding.id], deep: recursive })[0]) as T;\n}\n\n/** Import external DOM nodes once and keep their object identities as handles. */\nexport function importNodes(document: NativeDocument, input: unknown): number[] {\n if (input == null || input === false) return [];\n const values: any[] = Array.isArray(input) || (typeof input === 'object' && 'length' in input && !('type' in input)) ? Array.from(input as ArrayLike<any>) : [input];\n const result: number[] = [];\n for (const node of values) {\n if (node == null) continue;\n const existing = nodeId(node, document);\n if (existing !== undefined) { document.retainNode?.(existing); result.push(existing); continue; }\n if (typeof node !== 'object' || typeof node.type !== 'string') continue;\n const records: any[] = [];\n const originals = new Map<number, any>();\n const visit = (value: any, parent?: number): number => {\n const id = records.length;\n const record: any = { id, type: value.type, children: [], ...(parent === undefined ? {} : { parent }) };\n records.push(record); originals.set(id, value);\n for (const field of ['name', 'data', 'namespace', 'prefix', 'startIndex', 'endIndex', 'sourceCodeLocation', 'x-name', 'x-publicId', 'x-systemId', 'x-mode']) if (value[field] !== undefined) record[field] = value[field];\n if (value.attribs) record.attribs = { ...value.attribs };\n if (value['x-attribsNamespace']) record.attribsNamespace = { ...value['x-attribsNamespace'] };\n if (value['x-attribsPrefix']) record.attribsPrefix = { ...value['x-attribsPrefix'] };\n record.children = (value.children ?? []).map((child: any) => visit(child, id));\n return id;\n };\n const root = visit(node);\n const imported = operation<number[]>(document, 'import', { nodes: records, roots: [root] });\n if (!imported.length) continue;\n const adopt = (oldId: number, newId: number): void => {\n const source = originals.get(oldId);\n const oldChildren = records[oldId].children;\n const newChildren = nodeRecord(document, newId).children ?? [];\n // A node already belonging to another Rust document must retain its\n // original document handle. Imported clones receive their own handles.\n getNode(document, newId, nodeBinding(source) ? undefined : source);\n for (let i = 0; i < oldChildren.length; i++) if (newChildren[i] !== undefined) adopt(oldChildren[i], newChildren[i]);\n };\n adopt(root, imported[0]);\n result.push(imported[0]);\n }\n return result;\n}\n\nexport const isTag = (node: any): boolean => !!node && ['tag', 'script', 'style'].includes(node.type);\nexport const isDocument = (node: any): boolean => node?.type === 'root';\nexport const hasChildren = (node: any): boolean => !!node && 'children' in node;\n","import { requireNative } from './native.js';\nimport { getNode, importNodes, nodeBinding, operation, cloneNode } from './nodes.js';\nimport { routeDocument } from './router.js';\nimport type * as Shape from './types.js';\n\nexport const ElementType = Object.freeze({ Root: 'root', Text: 'text', Directive: 'directive', Comment: 'comment', Script: 'script', Style: 'style', Tag: 'tag', CDATA: 'cdata', Doctype: 'doctype' } as typeof Shape.ElementType);\n\nfunction initialize<T extends Node>(node: T, type: string, fields: Record<string, unknown>, children: readonly Shape.AnyNode[] = []): T {\n const document = routeDocument(new (requireNative().NativeDocument)('', false));\n const id = operation<number>(document, 'createNode', { type, ...fields });\n if (children.length) operation(document, 'setNode', { id, field: 'children', value: importNodes(document, children) });\n return getNode(document, id, node) as unknown as T;\n}\n\n/** DOM constructors backed by native storage, also shared across ESM/CJS views. */\nexport abstract class Node {\n static [Symbol.hasInstance](value: unknown): boolean {\n const binding = nodeBinding(value);\n if (!binding) return Function.prototype[Symbol.hasInstance].call(this, value);\n const type = (value as Shape.AnyNode).type;\n switch (this.name) {\n case 'Node': return true;\n case 'DataNode': return ['text', 'comment', 'directive'].includes(type);\n case 'NodeWithChildren': return ['root', 'tag', 'script', 'style', 'cdata'].includes(type);\n case 'Element': return ['tag', 'script', 'style'].includes(type);\n case 'Document': return type === 'root';\n case 'CDATA': return type === 'cdata';\n case 'Text': return type === 'text';\n case 'Comment': return type === 'comment';\n case 'ProcessingInstruction': return type === 'directive';\n default: return Function.prototype[Symbol.hasInstance].call(this, value);\n }\n }\n}\nexport interface Node extends Shape.Node {}\nexport abstract class DataNode extends Node {}\nexport interface DataNode extends Shape.DataNode {}\nexport abstract class NodeWithChildren extends Node {}\nexport interface NodeWithChildren extends Shape.NodeWithChildren {}\nexport class Text extends DataNode { declare readonly nodeType: 3; declare type: Shape.Text['type']; constructor(data: string) { super(); return initialize(this, 'text', { data }); } }\nexport interface Text extends Shape.Text {}\nexport class Comment extends DataNode { declare readonly nodeType: 8; declare type: Shape.Comment['type']; constructor(data: string) { super(); return initialize(this, 'comment', { data }); } }\nexport interface Comment extends Shape.Comment {}\nexport class ProcessingInstruction extends DataNode { declare readonly nodeType: 1; declare type: Shape.ProcessingInstruction['type']; constructor(name: string, data: string) { super(); return initialize(this, 'directive', { name, data }); } }\nexport interface ProcessingInstruction extends Shape.ProcessingInstruction {}\nexport class Document extends NodeWithChildren { declare readonly nodeType: 9; declare type: Shape.Document['type']; constructor(children: Shape.ChildNode[]) { super(); return initialize(this, 'root', {}, children); } }\nexport interface Document extends Shape.Document {}\nexport class CDATA extends NodeWithChildren { declare readonly nodeType: 4; declare type: Shape.CDATA['type']; constructor(children: Shape.ChildNode[]) { super(); return initialize(this, 'cdata', {}, children); } }\nexport interface CDATA extends Shape.CDATA {}\nexport class Element extends NodeWithChildren { declare readonly nodeType: 1; declare type: Shape.Element['type']; declare sourceCodeLocation?: Shape.TagSourceCodeLocation | null;\n constructor(name: string, attribs: Record<string, string>, children: Shape.ChildNode[] = [], type?: Shape.Element['type']) {\n super(); return initialize(this, type ?? (name === 'script' || name === 'style' ? name : 'tag'), { name, attribs }, children);\n }\n}\nexport interface Element extends Shape.Element {}\n\n/** @internal */\nexport function nodePrototype(type: string): object {\n return ({ root: Document, text: Text, comment: Comment, directive: ProcessingInstruction, cdata: CDATA, tag: Element, script: Element, style: Element }[type] ?? Node).prototype;\n}\nexport const isTag = (node: Shape.Node): node is Shape.Element => ['tag', 'script', 'style'].includes(node.type);\nexport const isText = (node: Shape.Node): node is Shape.Text => node.type === 'text';\nexport const isComment = (node: Shape.Node): node is Shape.Comment => node.type === 'comment';\nexport const isDirective = (node: Shape.Node): node is Shape.ProcessingInstruction => node.type === 'directive';\nexport const isDocument = (node: Shape.Node): node is Shape.Document => node.type === 'root';\nexport const isCDATA = (node: Shape.Node): node is Shape.CDATA => node.type === 'cdata';\nexport const hasChildren = (node: Shape.Node): node is Shape.NodeWithChildren => 'children' in node;\n\n// DOM aliases live on their class prototypes, as they do in domhandler. Native\n// views intercept the underlying fields; external supplied nodes keep theirs.\nObject.defineProperties(Node.prototype, {\n cloneNode: { configurable: true, writable: true, value: cloneNode },\n parentNode: { configurable: true, get(this: Shape.Node) { return this.parent; }, set(this: Shape.Node, value: Shape.ParentNode | null) { this.parent = value; } },\n previousSibling: { configurable: true, get(this: Shape.Node) { return this.prev; }, set(this: Shape.Node, value: Shape.ChildNode | null) { this.prev = value; } },\n nextSibling: { configurable: true, get(this: Shape.Node) { return this.next; }, set(this: Shape.Node, value: Shape.ChildNode | null) { this.next = value; } },\n nodeType: { configurable: true, get(this: Shape.Node) { return ({ root: 9, text: 3, comment: 8, cdata: 4 } as Record<string, number>)[this.type] ?? 1; } },\n});\nObject.defineProperty(DataNode.prototype, 'nodeValue', { configurable: true, get(this: Shape.DataNode) { return this.data; }, set(this: Shape.DataNode, value: string) { this.data = value; } });\nObject.defineProperties(NodeWithChildren.prototype, {\n childNodes: { configurable: true, get(this: Shape.NodeWithChildren) { return this.children; }, set(this: Shape.NodeWithChildren, value: Shape.ChildNode[]) { this.children = value; } },\n firstChild: { configurable: true, get(this: Shape.NodeWithChildren) { return this.children[0] ?? null; } },\n lastChild: { configurable: true, get(this: Shape.NodeWithChildren) { return this.children[this.children.length - 1] ?? null; } },\n});\nObject.defineProperties(Element.prototype, {\n tagName: { configurable: true, get(this: Shape.Element) { return this.name; }, set(this: Shape.Element, value: string) { this.name = value; } },\n attributes: { configurable: true, get(this: Shape.Element) { return Object.keys(this.attribs).map((name) => ({ name, value: this.attribs[name], namespace: this['x-attribsNamespace']?.[name], prefix: this['x-attribsPrefix']?.[name] })); } },\n});\n","import type { CheerioOptions, ExtractMap } from './types.js';\nimport { types } from 'node:util';\n\nexport interface ExtractPlanEntry {\n key: string;\n selector: string;\n all: boolean;\n value: { kind: 'property'; name: string } | { kind: 'map'; entries: ExtractPlanEntry[] };\n}\n\nexport interface ExtractPlan { version: 1; entries: ExtractPlanEntry[] }\n\n// Properties that can be returned as ordinary values. Properties returning DOM\n// views stay on the regular API so their identities and document leases survive.\nconst scalarProperties = new Set([\n 'textContent', 'innerText', 'innerHTML', 'outerHTML', 'tagName', 'nodeName',\n 'nodeType', 'id', 'class', 'className', 'title', 'href', 'src', 'alt', 'name',\n 'value', 'type', 'checked', 'selected', 'disabled', 'multiple', 'readOnly',\n 'required', 'hidden', 'open', 'autofocus', 'controls', 'loop', 'muted',\n]);\n\nfunction dataValue(object: object, key: string): { value: unknown } | undefined {\n for (let current: object | null = object; current; current = Object.getPrototypeOf(current)) {\n if (types.isProxy(current)) return undefined;\n const descriptor = Object.getOwnPropertyDescriptor(current, key);\n if (descriptor) return 'value' in descriptor ? { value: descriptor.value } : undefined;\n }\n return { value: undefined };\n}\n\n/** Compile pure extraction maps. User callbacks and accessors keep JS semantics. */\nexport function compileExtractPlan(map: ExtractMap, options: CheerioOptions): ExtractPlan | undefined {\n if (options.pseudos || options.treeAdapter || options.Tokenizer || options.xml && typeof options.xml === 'object' && options.xml.Tokenizer) return undefined;\n const ancestors = new Set<object>();\n const compile = (input: unknown): ExtractPlanEntry[] | undefined => {\n if (!input || typeof input !== 'object' || types.isProxy(input) || ancestors.has(input) || ancestors.size >= 64) return undefined;\n for (let current = Object.getPrototypeOf(input); current; current = Object.getPrototypeOf(current)) {\n if (types.isProxy(current)) return undefined;\n }\n ancestors.add(input);\n try {\n const entries: ExtractPlanEntry[] = [];\n for (const key in input) {\n // Cheerio uses an ordinary result object. Its legacy __proto__ setter\n // semantics must execute through the JavaScript path.\n if (key === '__proto__') return undefined;\n const inherited = Object.getOwnPropertyDescriptor(Object.prototype, key);\n if (inherited && (!('value' in inherited) || !inherited.writable)) return undefined;\n const slot = dataValue(input, key);\n if (!slot) return undefined;\n const all = Array.isArray(slot.value);\n if (slot.value && typeof slot.value === 'object' && types.isProxy(slot.value)) return undefined;\n const first = all ? dataValue(slot.value as object, '0') : slot;\n if (!first) return undefined;\n const descriptor = first.value;\n let selector: unknown;\n let value: unknown;\n if (typeof descriptor === 'string') { selector = descriptor; value = 'textContent'; }\n else if (descriptor && typeof descriptor === 'object') {\n if (types.isProxy(descriptor)) return undefined;\n const selectorSlot = dataValue(descriptor, 'selector');\n const valueSlot = dataValue(descriptor, 'value');\n if (!selectorSlot || !valueSlot) return undefined;\n selector = selectorSlot.value;\n value = valueSlot.value ?? 'textContent';\n } else return undefined;\n if (typeof selector !== 'string') return undefined;\n if (typeof value === 'string') {\n if (!scalarProperties.has(value) && !/^(?:data-|aria-).+/.test(value)) return undefined;\n entries.push({ key, selector, all, value: { kind: 'property', name: value } });\n } else {\n const nested = compile(value);\n if (!nested) return undefined;\n entries.push({ key, selector, all, value: { kind: 'map', entries: nested } });\n }\n }\n return entries;\n } finally { ancestors.delete(input); }\n };\n const entries = compile(map);\n return entries && { version: 1, entries };\n}\n\n/** JSON omits undefined fields; restore them recursively without changing order. */\nexport function hydrateExtractResult(result: Record<string, unknown>, entries: ExtractPlanEntry[]): void {\n const values = entries.map((entry) => Object.hasOwn(result, entry.key) ? result[entry.key] : entry.all ? [] : undefined);\n for (const entry of entries) delete result[entry.key];\n for (let index = 0; index < entries.length; index += 1) {\n const entry = entries[index];\n Object.defineProperty(result, entry.key, { value: values[index], enumerable: true, configurable: true, writable: true });\n if (entry.value.kind !== 'map') continue;\n const nested = result[entry.key];\n for (const value of entry.all && Array.isArray(nested) ? nested : [nested]) {\n if (value && typeof value === 'object' && !Array.isArray(value)) hydrateExtractResult(value as Record<string, unknown>, entry.value.entries);\n }\n }\n}\n","import type { AnyNode, Element, SerializedField } from './types.js';\nimport type { Cheerio } from './selection.js';\nimport type { NativeDocument } from './native.js';\nimport { getNode, hydrateLocation, importNodes, nodeRecord } from './nodes.js';\n\nexport interface StyleProp {\n length: number;\n [key: string]: string | number;\n [index: number]: string;\n}\n\nexport interface AttributeMethods<T = AnyNode> {\n attr<U extends AnyNode>(this: Cheerio<U>, name: string): string | undefined;\n attr<U extends AnyNode>(this: Cheerio<U>): Record<string, string> | undefined;\n attr<U extends AnyNode>(this: Cheerio<U>, name: string, value?: string | null | ((this: Element, index: number, value: string) => string | null)): Cheerio<U>;\n attr<U extends AnyNode>(this: Cheerio<U>, values: Record<string, string | null>): Cheerio<U>;\n prop<U extends AnyNode>(this: Cheerio<U>, name: 'tagName' | 'nodeName'): string | undefined;\n prop<U extends AnyNode>(this: Cheerio<U>, name: 'innerHTML' | 'outerHTML' | 'innerText' | 'textContent'): string | null;\n prop<U extends AnyNode>(this: Cheerio<U>, name: 'style'): StyleProp | undefined;\n prop<U extends AnyNode>(this: Cheerio<U>, name: 'href' | 'src'): string | undefined;\n prop<U extends AnyNode, K extends keyof Element>(this: Cheerio<U>, name: K): Element[K];\n prop<U extends AnyNode, K extends keyof Element>(this: Cheerio<U>, name: K, value: Element[K] | ((this: Element, index: number, property: K) => Element[keyof Element])): Cheerio<U>;\n prop<U extends AnyNode>(this: Cheerio<U>, values: Record<string, string | Element[keyof Element] | boolean>): Cheerio<U>;\n prop<U extends AnyNode>(this: Cheerio<U>, name: string, value: string | boolean | null | ((this: Element, index: number, property: string) => string | boolean)): Cheerio<U>;\n prop<U extends AnyNode>(this: Cheerio<U>, name: string): string;\n data<U extends AnyNode>(this: Cheerio<U>, name: string): unknown;\n data<U extends AnyNode>(this: Cheerio<U>): Record<string, unknown>;\n data<U extends AnyNode>(this: Cheerio<U>, name: string, value: unknown): Cheerio<U>;\n data<U extends AnyNode>(this: Cheerio<U>, values: Record<string, unknown>): Cheerio<U>;\n val<U extends AnyNode>(this: Cheerio<U>): string | string[] | undefined;\n val<U extends AnyNode>(this: Cheerio<U>, value: string | string[]): Cheerio<U>;\n removeAttr<U extends AnyNode>(this: Cheerio<U>, name: string): Cheerio<U>;\n hasClass<U extends AnyNode>(this: Cheerio<U>, name: string): boolean;\n addClass<U extends AnyNode, R extends ArrayLike<U>>(this: R, name?: string | ((this: Element, index: number, current: string) => string | undefined)): R;\n removeClass<U extends AnyNode, R extends ArrayLike<U>>(this: R, name?: string | ((this: Element, index: number, current: string) => string | undefined)): R;\n toggleClass<U extends AnyNode, R extends ArrayLike<U>>(this: R, name?: string | ((this: Element, index: number, current: string, state?: boolean) => string), state?: boolean): R;\n css<U extends AnyNode>(this: Cheerio<U>, names?: string[]): Record<string, string> | undefined;\n css<U extends AnyNode>(this: Cheerio<U>, name: string): string | undefined;\n css<U extends AnyNode>(this: Cheerio<U>, name: string, value: string | ((this: Element, index: number, current: string) => string | undefined)): Cheerio<U>;\n css<U extends AnyNode>(this: Cheerio<U>, values: Record<string, string>): Cheerio<U>;\n serializeArray<U extends AnyNode>(this: Cheerio<U>): SerializedField[];\n serialize<U extends AnyNode>(this: Cheerio<U>): string;\n}\n\ntype Selection = Cheerio<AnyNode>;\ntype DataRecord = Record<string, unknown>;\ntype DataCache = Map<number, WeakRef<DataRecord>>;\ntype DataDocument = NativeDocument & {\n nodeSpace?: object;\n retainNodeData?: (id: number, data: DataRecord) => void;\n nodeData?: (id: number) => DataRecord | undefined;\n nodeDataOperation?: (id: number) => (command: string, args: unknown) => unknown;\n};\nconst dataObjects = new WeakMap<object, DataCache>();\nconst dataFinalizer = new FinalizationRegistry<{ cache: WeakRef<DataCache>; id: number; reference: WeakRef<DataRecord> }>(({ cache, id, reference }) => {\n const records = cache.deref();\n if (records?.get(id) === reference) records.delete(id);\n});\n\nfunction isElement(selection: Selection, id: number): boolean {\n return ['tag', 'script', 'style'].includes(nodeRecord(selection._document, id)?.type);\n}\n\nfunction nativeValue(value: unknown): unknown {\n const seen = new WeakSet<object>();\n const json = JSON.stringify(value, (_key, value: unknown) => {\n if (typeof value === 'function' || typeof value === 'symbol' || typeof value === 'bigint' || value === undefined) return { __opaqueJavaScriptValue: true };\n if (typeof value === 'number' && !Number.isFinite(value)) return { __nativeNumber: String(value) };\n if (value && typeof value === 'object') {\n if (seen.has(value)) return { __opaqueJavaScriptValue: true };\n seen.add(value);\n }\n return value;\n });\n return json === undefined ? { __opaqueJavaScriptValue: true } : JSON.parse(json);\n}\n\nfunction hydrateValue(value: any): any {\n if (value && typeof value === 'object') {\n if (Object.keys(value).length === 1 && typeof value.__nativeNumber === 'string') return Number(value.__nativeNumber);\n for (const key of Object.keys(value)) value[key] = hydrateValue(value[key]);\n }\n return value;\n}\n\nfunction dataObject(selection: Selection, id: number): Record<string, unknown> {\n // Routed documents share a stable handle space. Moving a native node between\n // documents therefore preserves data identities and callback references.\n const document = selection._document as DataDocument;\n const cacheKey = document.nodeSpace ?? document;\n let documents = dataObjects.get(cacheKey);\n if (!documents) dataObjects.set(cacheKey, documents = new Map());\n const existingReference = documents.get(id);\n let data = existingReference?.deref() ?? document.nodeData?.(id);\n if (!data) {\n const documentReference = new WeakRef(document);\n const dispatch = document.nodeDataOperation?.(id) ?? ((command: string, args: unknown) => {\n const document = documentReference.deref();\n return document ? JSON.parse(document.op(command, JSON.stringify(args))) : undefined;\n });\n const target: Record<string, unknown> = {};\n data = new Proxy(target, {\n set(object, name, value) {\n Reflect.set(object, name, value);\n if (typeof name === 'string') dispatch('data', { ids: [id], name, value: nativeValue(value) });\n return true;\n },\n defineProperty(object, name, descriptor) {\n Reflect.defineProperty(object, name, descriptor);\n if (typeof name === 'string' && 'value' in descriptor) dispatch('data', { ids: [id], name, value: nativeValue(descriptor.value) });\n return true;\n },\n deleteProperty(object, name) {\n Reflect.deleteProperty(object, name);\n if (typeof name === 'string') dispatch('removeData', { ids: [id], name });\n return true;\n },\n });\n const node = getNode(selection._document, id);\n // JS data can contain callbacks, cycles, and object identities. The DOM and\n // parsed data values live in Rust; this handle preserves those JS values.\n Object.defineProperty(node, 'data', { configurable: true, enumerable: true, get: () => data, set: (value: Record<string, unknown>) => { for (const key of Object.keys(data!)) delete data![key]; for (const key of Object.keys(value ?? {})) data![key] = value[key]; } });\n }\n if (existingReference?.deref() !== data) {\n const reference = new WeakRef(data);\n documents.set(id, reference);\n dataFinalizer.register(data, { cache: new WeakRef(documents), id, reference });\n }\n document.retainNodeData?.(id, data);\n return data;\n}\n\nfunction property(selection: Selection, id: number, name: string, raw = false): any {\n const result = selection.op('prop', { ids: [id], name, ...(raw ? { raw: true } : {}) });\n if (name === 'sourceCodeLocation') return hydrateLocation(result);\n return result?.__nativeNodeProperty ? (getNode(selection._document, id) as any)[result.__nativeNodeProperty] : result === null ? undefined : result;\n}\n\nfunction propertyValue(selection: Selection, name: string, value: any): any {\n if (name === 'children' || name === 'childNodes') return importNodes(selection._document, value);\n if (['parent', 'parentNode', 'prev', 'previousSibling', 'next', 'nextSibling'].includes(name)) return value == null ? null : importNodes(selection._document, [value])[0] ?? null;\n return value;\n}\n\nfunction attr(this: Selection, name?: any, value?: any): any {\n if (typeof name === 'object' || value !== undefined) {\n if (typeof value === 'function') {\n if (typeof name !== 'string') throw new Error('Bad combination of arguments.');\n this.ids.forEach((id, index) => {\n if (!isElement(this, id)) return;\n const node = getNode(this._document, id) as Element;\n const current = node.attribs[name];\n const next = value.call(node, index, current);\n this.op('attr', { ids: [id], name, value: next === null ? null : String(next) });\n });\n } else if (typeof name === 'object') {\n for (const key of Object.keys(name)) this.op('attr', { ids: this.ids, name: key, value: name[key] === null ? null : String(name[key]) });\n } else {\n this.op('attr', { ids: this.ids, name, value: value === null ? null : String(value) });\n }\n return this;\n }\n if (arguments.length > 1) return this;\n const result = this.op('attr', { ids: this.ids, ...(typeof name === 'string' ? { name } : {}) });\n if (result === null) return undefined;\n return !name && this.ids.length ? (getNode(this._document, this.ids[0]) as Element).attribs : result;\n}\n\nfunction prop(this: Selection, name: any, value?: any): any {\n if (typeof name === 'string' && value === undefined) return this.ids.length ? property(this, this.ids[0], name) : undefined;\n if (typeof name === 'object' || value !== undefined) {\n if (typeof value === 'function') {\n if (typeof name === 'object') throw new TypeError('Bad combination of arguments.');\n this.ids.forEach((id, index) => {\n if (!isElement(this, id)) return;\n const next = value.call(getNode(this._document, id), index, property(this, id, name, true));\n this.op('prop', { ids: [id], name, value: propertyValue(this, name, next) });\n });\n } else if (typeof name === 'object') {\n for (const key of Object.keys(name)) this.op('prop', { ids: this.ids, name: key, value: propertyValue(this, key, name[key]) });\n } else {\n this.op('prop', { ids: this.ids, name, value: propertyValue(this, name, value) });\n }\n return this;\n }\n return undefined;\n}\n\nfunction data(this: Selection, name?: any, value?: unknown): any {\n const first = this.ids[0];\n if (first === undefined || !isElement(this, first)) return undefined;\n if (name != null && (typeof name === 'object' || value !== undefined)) {\n for (const id of this.ids) {\n if (!isElement(this, id)) continue;\n const record = dataObject(this, id);\n if (typeof name === 'object') for (const key of Object.keys(name)) record[key] = name[key];\n else if (typeof name === 'string') record[name] = value;\n }\n return this;\n }\n const record = dataObject(this, first);\n if (typeof name === 'string' && Object.hasOwn(record, name)) return record[name];\n const found = this.op<{ found: boolean; value?: any }>('data', { ids: [first], ...(name == null ? {} : { name }) });\n if (!found.found) return undefined;\n if (name == null) {\n for (const key of Object.keys(found.value)) if (!Object.hasOwn(record, key)) record[key] = hydrateValue(found.value[key]);\n return record;\n }\n record[name] = hydrateValue(found.value);\n return record[name];\n}\n\nfunction css(this: Selection, name?: any, value?: any): any {\n if (name != null && value != null || typeof name === 'object' && !Array.isArray(name)) {\n if (typeof name === 'object') {\n for (const [propertyIndex, key] of Object.keys(name).entries()) {\n if (typeof name[key] === 'function') {\n for (const id of this.ids) {\n if (!isElement(this, id)) continue;\n const current = this.op('css', { ids: [id], name: key }) ?? undefined;\n const next = name[key].call(getNode(this._document, id), propertyIndex, current);\n this.op('css', { ids: [id], name: key, value: next == null ? null : String(next) });\n }\n } else this.op('css', { ids: this.ids, name: key, value: name[key] == null ? null : String(name[key]) });\n }\n } else if (typeof name === 'string' && typeof value === 'function') {\n this.ids.forEach((id, index) => {\n if (!isElement(this, id)) return;\n const current = this.op('css', { ids: [id], name }) ?? undefined;\n const next = value.call(getNode(this._document, id), index, current);\n this.op('css', { ids: [id], name, value: next == null ? null : String(next) });\n });\n } else if (typeof name === 'string') this.op('css', { ids: this.ids, name, value: value == null ? null : String(value) });\n return this;\n }\n return this.op('css', { ids: this.ids, ...(name === undefined ? {} : { name }) }) ?? undefined;\n}\n\nfunction classMethod(command: 'addClass' | 'removeClass' | 'toggleClass') {\n return function(this: Selection, name?: any, state?: boolean): Selection {\n if (typeof name === 'function') {\n this.ids.forEach((id, index) => {\n if (!isElement(this, id)) return;\n const node = getNode(this._document, id) as Element;\n const next = command === 'toggleClass'\n ? name.call(node, index, node.attribs.class ?? '', state)\n : name.call(node, index, node.attribs.class ?? '');\n if (typeof next === 'string') this.op(command, { ids: [id], name: next, ...(typeof state === 'boolean' ? { state } : {}) });\n });\n } else if (typeof name === 'string' || command === 'removeClass' && arguments.length === 0) {\n this.op(command, { ids: this.ids, ...(typeof name === 'string' ? { name } : { all: true }), ...(typeof state === 'boolean' ? { state } : {}) });\n }\n return this;\n };\n}\n\nexport function installAttributes(CheerioClass: { prototype: object }): void {\n Object.assign(CheerioClass.prototype, {\n attr, prop, data, css,\n removeAttr(this: Selection, name: string) { this.op('removeAttr', { ids: this.ids, name }); return this; },\n hasClass(this: Selection, name: string) { return this.op<boolean>('hasClass', { ids: this.ids, name }); },\n addClass: classMethod('addClass'), removeClass: classMethod('removeClass'), toggleClass: classMethod('toggleClass'),\n val(this: Selection, value?: unknown) {\n if (arguments.length === 0) return this.op('val', { ids: this.ids }) ?? undefined;\n const result = this.op('val', { ids: this.ids, value: value === undefined ? { __undefinedJavaScriptValue: true } : value });\n return result?.chain === false ? result.returnValue : result === false ? undefined : this;\n },\n serializeArray(this: Selection) { return this.op<SerializedField[]>('serializeArray', { ids: this.ids }); },\n serialize(this: Selection) { return this.op<string>('serialize', { ids: this.ids }); },\n });\n}\n","import { requireNative } from './native.js';\nimport { getNode, importNodes, nodeBinding, operation } from './nodes.js';\nimport { routeDocument } from './router.js';\nimport { parseNativeDocument, cleanParserOptions } from './hooks.js';\nimport type { AnyNode, Document, InternalOptions, ParentNode } from './types.js';\n\ntype ParseContent = string | Buffer | Document | AnyNode | AnyNode[];\ntype Parser = (content: string, options: InternalOptions, isDocument: boolean, context: ParentNode | null) => Document;\n\n/** Parse with the Rust HTML5 or HTML/XML engine, preserving fragment context. */\nfunction parseWithNative(content: string, options: InternalOptions, isDocument: boolean, context: ParentNode | null): Document {\n if (!isDocument && context) {\n const document = nodeBinding(context)?.document\n ?? routeDocument(new (requireNative().NativeDocument)('', false, JSON.stringify(cleanParserOptions(options))), options);\n const contextId = importNodes(document, [context])[0];\n const children = operation<number[]>(document, 'create', { html: content, contextId, options });\n const root = operation<number>(document, 'createNode', { type: 'root', options });\n operation(document, 'setNode', { id: root, field: 'children', value: children, options });\n return getNode(document, root) as Document;\n }\n const document = parseNativeDocument(content, options, isDocument);\n return getNode(document, document.rootId()) as Document;\n}\n\n/** The HTML5 adapter uses Rust's HTML5 tree builder. */\nexport function parseWithParse5(content: string, options: InternalOptions, isDocument: boolean, context: ParentNode | null): Document {\n return parseWithNative(content, { ...options, _useHtmlParser2: false, xml: false, xmlMode: false }, isDocument, context);\n}\n\n/** The htmlparser2-compatible adapter uses the Rust HTML/XML tokenizer. */\nexport function parseWithHtmlparser2(content: string, options: InternalOptions): Document {\n return parseWithNative(content, { ...options, _useHtmlParser2: true }, false, null);\n}\n\nexport { parseWithHtmlparser2 as parseDocument };\n\n/** Normalize parser inputs while keeping every DOM operation in the native arena. */\nexport function getParse(parser: Parser) {\n return function parse(content: ParseContent, options: InternalOptions, isDocument: boolean, context: ParentNode | null): Document {\n if (Buffer.isBuffer(content)) content = content.toString();\n if (typeof content === 'string') return parser(content, options, isDocument, context);\n if (!Array.isArray(content) && content.type === 'root' && nodeBinding(content)) return content;\n const document = routeDocument(new (requireNative().NativeDocument)('', false, JSON.stringify(cleanParserOptions(options))), options);\n const ids = importNodes(document, content);\n if (!Array.isArray(content) && content.type === 'root') return getNode(document, ids[0]) as Document;\n operation(document, 'setNode', { id: document.rootId(), field: 'children', value: ids, options });\n return getNode(document, document.rootId()) as Document;\n };\n}\n\nexport const parse = getParse((content, options, isDocument, context) => options._useHtmlParser2\n ? parseWithHtmlparser2(content, options)\n : parseWithParse5(content, options, isDocument, context));\n","import type { AnyNode, Document, Element, ParentNode, CheerioAPI, CheerioOptions, AcceptedFilters, BasicAcceptedElems, AcceptedElems, ExtractMap, ExtractedMap } from './types.js';\nimport { requireNative, type NativeDocument } from './native.js';\nimport { getNode, importNodes, nodeBinding, nodeId, nodeRecord, operation, isTag } from './nodes.js';\nimport { installAttributes, type AttributeMethods } from './attributes.js';\nimport { extract } from './extract.js';\nimport { sameNodeSpace, retainNodes } from './router.js';\nimport { parse } from './parse.js';\nconst numeric = /^(?:0|[1-9]\\d*)$/;\nconst isMarkup = (value: string) => /<[a-zA-Z!/?]/.test(value);\nfunction* customPseudoArguments(selector: string, name: string): Generator<string | undefined> {\n let attributeDepth = 0;\n let quote = '';\n for (let index = 0; index < selector.length; index++) {\n const character = selector[index];\n if (character === '\\\\') {\n index++;\n continue;\n }\n if (quote) {\n if (character === quote)\n quote = '';\n continue;\n }\n if (character === '\"' || character === \"'\") {\n quote = character;\n continue;\n }\n if (character === '[') {\n attributeDepth++;\n continue;\n }\n if (character === ']') {\n attributeDepth--;\n continue;\n }\n if (attributeDepth || character !== ':' || selector[index - 1] === ':')\n continue;\n const start = index + 1;\n let end = start;\n while (/[\\w-]/.test(selector[end] ?? '') && end < selector.length)\n end++;\n if (selector.slice(start, end).toLowerCase() !== name.toLowerCase())\n continue;\n index = end - 1;\n if (selector[end] !== '(') {\n yield undefined;\n continue;\n }\n const argumentStart = end + 1;\n let depth = 1;\n let argumentQuote = '';\n for (end++; end < selector.length; end++) {\n const next = selector[end];\n if (next === '\\\\') {\n end++;\n continue;\n }\n if (argumentQuote) {\n if (next === argumentQuote)\n argumentQuote = '';\n continue;\n }\n if (next === '\"' || next === \"'\") {\n argumentQuote = next;\n continue;\n }\n if (next === '(')\n depth++;\n else if (next === ')' && --depth === 0)\n break;\n }\n if (depth)\n continue; // The native selector parser reports malformed syntax.\n yield selector.slice(argumentStart, end);\n index = end;\n }\n}\n/** An array-like selection of stable handles into the Rust document arena. */\nexport class Cheerio<T = AnyNode> implements ArrayLike<T>, Iterable<T> {\n [index: number]: T;\n /** @internal */ declare _document: NativeDocument;\n /** @internal */ declare _api: CheerioAPI;\n /** @internal */ declare _ids: number[];\n /** @internal */ declare _values: T[] | undefined;\n /** @internal */ declare _lease: object;\n declare options: CheerioOptions;\n declare _root: Cheerio<Document> | null;\n declare prevObject: Cheerio<any> | undefined;\n declare length: number;\n cheerio = '[cheerio object]' as const;\n constructor(api: CheerioAPI, document: NativeDocument, ids: number[] = [], root: Cheerio<Document> | null = null, options: CheerioOptions = {}, values?: T[]) {\n Object.defineProperties(this, {\n _document: { value: document, writable: true, configurable: true },\n _api: { value: api, writable: true, configurable: true },\n _ids: { value: ids, writable: true, configurable: true },\n _values: { value: values, writable: true, configurable: true },\n _lease: { value: retainNodes(document, ids), writable: true, configurable: true },\n options: { value: options, writable: true, configurable: true, enumerable: true },\n _root: { value: root, writable: true, configurable: true, enumerable: true },\n length: { configurable: true, enumerable: true, get: () => this._values?.length ?? this._ids.length, set: (value: number) => { if (this._values)\n this._values.length = value;\n else\n this._ids.length = value; this._lease = retainNodes(document, this._values ? [] : this._ids); } },\n });\n delete (this as any).cheerio;\n return new Proxy(this, {\n get: (target, property, receiver) => typeof property === 'string' && numeric.test(property)\n ? (target._values ? target._values[Number(property)] : target._ids[Number(property)] === undefined ? undefined : getNode(document, target._ids[Number(property)]))\n : Reflect.get(target, property, receiver),\n set: (target, property, value, receiver) => {\n if (typeof property === 'string' && numeric.test(property)) {\n if (target._values)\n target._values[Number(property)] = value;\n else {\n const id = importNodes(document, [value])[0];\n if (id === undefined) {\n target._values = target._ids.map((existing) => getNode(document, existing)) as T[];\n target._values[Number(property)] = value;\n }\n else\n target._ids[Number(property)] = id;\n }\n target._lease = retainNodes(document, target._values ? [] : target._ids);\n return true;\n }\n return Reflect.set(target, property, value, receiver);\n },\n has: (target, property) => typeof property === 'string' && numeric.test(property) ? Number(property) < target.length : Reflect.has(target, property),\n ownKeys: (target) => [...Array.from({ length: target.length }, (_, i) => String(i)), ...Reflect.ownKeys(target)],\n getOwnPropertyDescriptor: (target, property) => typeof property === 'string' && numeric.test(property) && Number(property) < target.length\n ? { value: target._values ? target._values[Number(property)] : getNode(document, target._ids[Number(property)]), writable: true, configurable: true, enumerable: true }\n : Reflect.getOwnPropertyDescriptor(target, property),\n deleteProperty: (target, property) => {\n if (typeof property === 'string' && numeric.test(property)) {\n if (target._values)\n delete target._values[Number(property)];\n else\n delete target._ids[Number(property)];\n target._lease = retainNodes(document, target._values ? [] : target._ids);\n return true;\n }\n return Reflect.deleteProperty(target, property);\n },\n });\n }\n /** @internal */ get ids(): number[] { return this._values ? importNodes(this._document, this._values) : this._ids; }\n /** @internal */ op<R = any>(command: string, args: unknown = {}): R { const values = args as Record<string, unknown>; return operation<R>(this._document, command, { ...values, options: values.options ?? this.options }); }\n /** @internal */ _query(command: 'select' | 'matches', args: {\n selector: string;\n ids?: number[];\n contexts?: number[];\n options?: CheerioOptions;\n }): number[] {\n const callbacks = Object.entries(this.options.pseudos ?? {}).filter((entry): entry is [\n string,\n (element: Element, argument?: string | null) => boolean\n ] => typeof entry[1] === 'function');\n if (!callbacks.length)\n return command === 'select' && !args.options ? this._document.select(args.selector, args.contexts) : this.op(command, args);\n const pseudoMatches: Record<string, number[]> = {};\n const candidates = [...new Set([...this._document.select('*'), ...(args.ids ?? []), ...(args.contexts ? this._document.select('*', args.contexts) : [])])];\n for (const [name, callback] of callbacks) {\n for (const argument of customPseudoArguments(args.selector, name)) {\n if (argument !== undefined && callback.length < 2)\n throw new Error(`Pseudo-class :${name} doesn't have any arguments`);\n if (argument === undefined && callback.length >= 2)\n throw new Error(`Pseudo-class :${name} requires an argument`);\n pseudoMatches[`${name}(${argument ?? ''})`] = candidates.filter((id) => callback(getNode(this._document, id) as Element, argument ?? null));\n }\n }\n return this.op(command, { ...args, pseudoMatches });\n }\n /** @internal */ _fromIds<R = AnyNode>(ids: number[]): Cheerio<R> {\n const result = new (this._api.fn.constructor as typeof Cheerio)<R>(this._api, this._document, ids, this._root, this.options);\n result.prevObject = this;\n return result;\n }\n /** @internal */ _fromValues<R>(values: R[]): Cheerio<R> {\n const allNodes = values.every((value: any) => value && typeof value === 'object' && typeof value.type === 'string');\n const result = new (this._api.fn.constructor as typeof Cheerio)<R>(this._api, this._document, allNodes ? importNodes(this._document, values) : [], this._root, this.options, allNodes ? undefined : values);\n result.prevObject = this;\n return result;\n }\n _make<R>(value: ArrayLike<R> | R | string, context?: BasicAcceptedElems<AnyNode>): Cheerio<R>;\n _make<R>(value: any, context?: any): Cheerio<R> {\n const result = typeof value === 'string' || value?.cheerio ? this._api(value, context) : this._fromValues<R>(value == null ? [] : typeof value === 'object' && 'length' in value && !value.type ? Array.from(value) : [value]);\n result.prevObject = this;\n return result as Cheerio<R>;\n }\n _parse(content: any, options: CheerioOptions, isDocument: boolean, context: ParentNode | null): Document {\n return parse(content, options, isDocument, context);\n }\n _render(content: any): string { return this._document.outerHtml(importNodes(this._document, content)); }\n /** @internal */ _domIds(content: any, contextId?: number): number[] {\n if (content == null || content === false)\n return [];\n if (typeof content === 'string')\n return this.op('create', { html: content, contextId, options: this.options });\n if (content?.cheerio)\n return content._document && sameNodeSpace(this._document, content._document) ? content.ids : importNodes(this._document, content.toArray());\n if (typeof content === 'object' && 'length' in content && !content.type)\n return Array.from(content as ArrayLike<any>).flatMap((item) => this._domIds(item, contextId));\n return importNodes(this._document, [content]);\n }\n _makeDomArray<T extends AnyNode>(this: Cheerio<T>, elem?: BasicAcceptedElems<AnyNode> | BasicAcceptedElems<AnyNode>[], clone?: boolean): AnyNode[];\n _makeDomArray(this: Cheerio<any>, content: any, clone: any = false): any {\n const ids = this._domIds(content);\n return (clone ? this.op<number[]>('clone', { ids, deep: true }) : ids).map((id) => getNode(this._document, id));\n }\n find<T extends AnyNode>(this: Cheerio<T>, selectorOrHaystack?: string | Cheerio<Element> | Element): Cheerio<Element>;\n find(this: Cheerio<any>, selector?: any): any {\n if (!selector)\n return this._fromIds([]);\n if (typeof selector === 'string')\n return this._findBySelector(selector, Infinity);\n const ids = importNodes(this._document, selector);\n return this._fromIds(ids.filter((id) => this.ids.some((container) => this.op<boolean>('contains', { container, contained: id }))));\n }\n _findBySelector<T extends AnyNode>(this: Cheerio<T>, selector: string, limit: number): Cheerio<Element>;\n _findBySelector(this: Cheerio<any>, selector: any, limit: any): any {\n const ids = this._query('select', { selector, contexts: this.ids });\n return this._fromIds(Number.isFinite(limit) ? ids.slice(0, limit) : ids);\n }\n /** @internal */ _filterIds(ids: number[], selector?: any): number[] {\n if (!selector)\n return ids;\n if (typeof selector === 'string')\n return this._query('matches', { ids, selector, options: this.options });\n return ids.filter((id, index) => this._predicate(selector, getNode(this._document, id), index));\n }\n /** @internal */ _predicate(selector: any, node: any, index: number): boolean {\n if (typeof selector === 'function')\n return !!selector.call(node, index, node);\n if (typeof selector === 'string')\n return this._query('matches', { ids: importNodes(this._document, [node]), selector, options: this.options }).length > 0;\n if (selector?.cheerio)\n return selector.toArray().includes(node);\n return node === selector;\n }\n /** @internal */ _traverse(kind: string, selector?: any): Cheerio<Element> {\n let ids = this.op<number[]>('traverse', { ids: this.ids, kind });\n ids = this._filterIds(ids, selector);\n if (this.length > 1 && ids.length > 1) {\n if (kind === 'parents' || kind === 'siblings')\n ids = this.op('uniqueSort', { ids });\n else if (!['next', 'prev', 'contents'].includes(kind))\n ids = [...new Set(ids)];\n if (kind === 'parents')\n ids.reverse();\n }\n return this._fromIds(ids);\n }\n parent<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;\n parent(this: Cheerio<any>, selector?: any): any { return this._traverse('parent', selector); }\n parents<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;\n parents(this: Cheerio<any>, selector?: any): any { return this._traverse('parents', selector); }\n next<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;\n next(this: Cheerio<any>, selector?: any): any { return this._traverse('next', selector); }\n prev<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;\n prev(this: Cheerio<any>, selector?: any): any { return this._traverse('prev', selector); }\n nextAll<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;\n nextAll(this: Cheerio<any>, selector?: any): any { return this._traverse('nextAll', selector); }\n prevAll<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;\n prevAll(this: Cheerio<any>, selector?: any): any { return this._traverse('prevAll', selector); }\n siblings<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;\n siblings(this: Cheerio<any>, selector?: any): any { return this._traverse('siblings', selector); }\n children<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;\n children(this: Cheerio<any>, selector?: any): any { return this._traverse('children', selector); }\n contents<T extends AnyNode>(this: Cheerio<T>): Cheerio<AnyNode>;\n contents(this: Cheerio<any>): any { return this._traverse('contents') as any; }\n /** @internal */ _until(kind: string, until?: any, filter?: any): Cheerio<Element> {\n let ids: number[] = [];\n for (const id of this.ids)\n for (const candidate of this.op<number[]>('traverse', { ids: [id], kind })) {\n if (until && this._predicate(until, getNode(this._document, candidate), ids.length))\n break;\n ids.push(candidate);\n }\n ids = this._filterIds(ids, filter);\n if (this.length > 1 && ids.length > 1)\n ids = kind === 'parents' ? this.op<number[]>('uniqueSort', { ids }).reverse() : [...new Set(ids)];\n return this._fromIds(ids);\n }\n parentsUntil<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element> | null, filterSelector?: AcceptedFilters<Element>): Cheerio<Element>;\n parentsUntil(this: Cheerio<any>, until?: any, filter?: any): any { return this._until('parents', until, filter); }\n nextUntil<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element> | null, filterSelector?: AcceptedFilters<Element>): Cheerio<Element>;\n nextUntil(this: Cheerio<any>, until?: any, filter?: any): any { return this._until('nextAll', until, filter); }\n prevUntil<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element> | null, filterSelector?: AcceptedFilters<Element>): Cheerio<Element>;\n prevUntil(this: Cheerio<any>, until?: any, filter?: any): any { return this._until('prevAll', until, filter); }\n closest<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<AnyNode>;\n closest(this: Cheerio<any>, selector?: any): any {\n if (!selector)\n return this._fromIds([]);\n const result: number[] = [];\n for (const id of this.ids) {\n const record = nodeRecord(this._document, id);\n const candidates = [...(['tag', 'script', 'style'].includes(record.type) ? [id] : []), ...this.op<number[]>('traverse', { ids: [id], kind: 'parents' })];\n const match = candidates.find((candidate) => this._predicate(selector, getNode(this._document, candidate), 0));\n if (match !== undefined && !result.includes(match))\n result.push(match);\n }\n return this._fromIds(result);\n }\n each<T>(this: Cheerio<T>, fn: (this: T, i: number, el: T) => void | boolean): Cheerio<T>;\n each(this: Cheerio<any>, callback: any): any {\n const length = this.length;\n for (let i = 0; i < length; i++)\n if (callback.call(this[i], i, this[i]) === false)\n break;\n return this;\n }\n map<T, M>(this: Cheerio<T>, fn: (this: T, i: number, el: T) => M[] | M | null | undefined): Cheerio<M>;\n map<R>(this: Cheerio<any>, callback: any): any {\n const result: R[] = [];\n for (let i = 0; i < this.length; i++) {\n const value = callback.call(this[i], i, this[i]);\n if (value != null)\n result.push(...(Array.isArray(value) ? value : [value]));\n }\n return this._fromValues(result);\n }\n filter<T, S extends T>(this: Cheerio<T>, match: (this: T, index: number, value: T) => value is S): Cheerio<S>;\n filter<T, S extends AcceptedFilters<T>>(this: Cheerio<T>, match: S): Cheerio<S extends string ? Element : T>;\n filter<S extends AcceptedFilters<T>>(this: Cheerio<any>, selector: any): any {\n return (typeof selector === 'string' ? this._fromIds(this._query('matches', { ids: this.ids, selector, options: this.options })) : this._fromValues(this.toArray().filter((node, i) => this._predicate(selector, node, i)))) as any;\n }\n filterArray<T>(nodes: T[], match: AcceptedFilters<T>, xmlMode?: boolean, root?: Document): Element[] | T[];\n filterArray<R>(this: Cheerio<any>, nodes: any, match: any, xmlMode?: any, root?: any): any {\n const matcher: any = match;\n if (typeof match !== 'string')\n return nodes.filter((node: any, index: number) => typeof matcher === 'function' ? matcher.call(node, index, node) : matcher?.cheerio ? matcher.toArray().includes(node) : matcher === node);\n const document = this?._document ?? nodeBinding(root)?.document ?? nodeBinding(nodes[0])?.document ?? new (requireNative().NativeDocument)('', false);\n const ids = importNodes(document, nodes);\n const selected = new Set(operation<number[]>(document, 'matches', { ids, selector: match, options: { xmlMode } }));\n return nodes.filter((node: any) => { const id = nodeId(node, document); return id !== undefined && selected.has(id); });\n }\n not<T extends AnyNode>(this: Cheerio<T>, match: AcceptedFilters<T>): Cheerio<T>;\n not(this: Cheerio<any>, selector: any): any {\n if (typeof selector === 'string') {\n const matched = new Set(this._query('matches', { ids: this.ids, selector, options: this.options }));\n return this._fromIds(this.ids.filter((id) => !matched.has(id)));\n }\n return this._fromValues(this.toArray().filter((node, i) => !this._predicate(selector, node, i)));\n }\n is<T>(this: Cheerio<T>, selector?: AcceptedFilters<T>): boolean;\n is(this: Cheerio<any>, selector?: any): any {\n return typeof selector === 'string' ? this._query('matches', { ids: this.ids, selector, options: this.options }).length > 0 : !!selector && this.toArray().some((node, i) => this._predicate(selector, node, i));\n }\n has(this: Cheerio<AnyNode | Element>, selectorOrHaystack: string | Cheerio<Element> | Element): Cheerio<AnyNode | Element>;\n has(this: Cheerio<any>, selector: any): any { return this.filter(((_i: number, node: any) => this._make(node).find(selector).length > 0) as any) as Cheerio<T>; }\n first<T extends AnyNode>(this: Cheerio<T>): Cheerio<T>;\n first(this: Cheerio<any>): any { return this.length > 1 ? this.slice(0, 1) : this; }\n last<T>(this: Cheerio<T>): Cheerio<T>;\n last(this: Cheerio<any>): any { return this.length > 0 ? this.slice(-1) : this; }\n eq<T>(this: Cheerio<T>, i: number): Cheerio<T>;\n eq(this: Cheerio<any>, index: any): any {\n index = +index;\n if (index === 0 && this.length <= 1)\n return this;\n if (index < 0)\n index += this.length;\n return this._fromValues(this[index] === undefined ? [] : [this[index]]);\n }\n get<T>(this: Cheerio<T>, i: number): T | undefined;\n get<T>(this: Cheerio<T>): T[];\n get(this: Cheerio<any>, index?: any): any { return index == null ? this.toArray() : this[index < 0 ? this.length + index : index]; }\n toArray<T>(this: Cheerio<T>): T[];\n toArray(this: Cheerio<any>): any { return Array.from({ length: this.length }, (_unused, i) => this[i]); }\n slice<T>(this: Cheerio<T>, start?: number, end?: number): Cheerio<T>;\n slice(this: Cheerio<any>, start?: any, end?: any): any { return this._values ? this._fromValues(this._values.slice(start, end)) : this._fromIds(this._ids.slice(start, end)); }\n end<T>(this: Cheerio<T>): Cheerio<AnyNode>;\n end(this: Cheerio<any>): any { return this.prevObject ?? this._make([]); }\n add<S extends AnyNode, T extends AnyNode>(this: Cheerio<T>, other: string | Cheerio<S> | S | S[], context?: Cheerio<S> | string): Cheerio<S | T>;\n add<R extends AnyNode>(this: Cheerio<any>, other: any, context?: any): any { return this._fromIds(this.op('uniqueSort', { ids: [...this.ids, ...this._api(other, context).ids] })); }\n addBack<T extends AnyNode>(this: Cheerio<T>, selector?: string): Cheerio<AnyNode>;\n addBack(this: Cheerio<any>, selector?: any): any { return this.prevObject ? this.add(selector ? this.prevObject.filter(selector) : this.prevObject) as any : this as any; }\n index<T extends AnyNode>(this: Cheerio<T>, selectorOrNeedle?: string | Cheerio<AnyNode> | AnyNode): number;\n index(this: Cheerio<any>, selector?: any): any { const haystack = selector == null ? this.parent().children() : typeof selector === 'string' ? this._api(selector) : this; const needle = selector == null || typeof selector === 'string' ? this[0] : selector?.cheerio ? selector[0] : selector; return haystack.toArray().indexOf(needle); }\n splice(start: number, deleteCount?: number): any[];\n splice(start: number, deleteCount: number, ...items: any[]): any[];\n splice(...args: any[]): any[] { return Reflect.apply(Array.prototype.splice, this, args); }\n [Symbol.iterator](): Iterator<T>;\n *[Symbol.iterator](): IterableIterator<T> { for (let i = 0; i < this.length; i++)\n yield this[i]; }\n /** @internal */ _insert(position: string, content: any[]): this {\n const targets = this.ids.filter((id) => ['root', 'tag', 'script', 'style', 'cdata'].includes(nodeRecord(this._document, id).type));\n if (!targets.length)\n return this;\n if (typeof content[0] === 'function')\n return (this as Cheerio<any>).each((index, node: any) => {\n if (!targets.includes(this.ids[index]))\n return;\n if ((position === 'before' || position === 'after') && nodeRecord(this._document, this.ids[index]).parent == null)\n return;\n const value = content[0].call(node, index, this._document.innerHtml(this.ids[index]));\n let nodes = this._domIds(value);\n if (index < this.length - 1)\n nodes = this.op('clone', { ids: nodes, deep: true });\n this.op('insert', { targetIds: [this.ids[index]], nodeIds: nodes, position });\n }) as this;\n let nodes = this._domIds(content);\n if (targets[targets.length - 1] !== this.ids[this.ids.length - 1])\n nodes = this.op('clone', { ids: nodes, deep: true });\n this.op('insert', { targetIds: targets, nodeIds: nodes, position });\n return this;\n }\n append<T extends AnyNode>(this: Cheerio<T>, ...elems: [\n (this: AnyNode, i: number, html: string) => BasicAcceptedElems<AnyNode>\n ] | BasicAcceptedElems<AnyNode>[]): Cheerio<T>;\n append(this: Cheerio<any>, ...content: any[]): any { return this._insert('append', content); }\n prepend<T extends AnyNode>(this: Cheerio<T>, ...elems: [\n (this: AnyNode, i: number, html: string) => BasicAcceptedElems<AnyNode>\n ] | BasicAcceptedElems<AnyNode>[]): Cheerio<T>;\n prepend(this: Cheerio<any>, ...content: any[]): any { return this._insert('prepend', content); }\n before<T extends AnyNode>(this: Cheerio<T>, ...elems: [\n (this: AnyNode, i: number, html: string) => BasicAcceptedElems<AnyNode>\n ] | BasicAcceptedElems<AnyNode>[]): Cheerio<T>;\n before(this: Cheerio<any>, ...content: any[]): any { return this._insert('before', content); }\n after<T extends AnyNode>(this: Cheerio<T>, ...elems: [\n (this: AnyNode, i: number, html: string) => BasicAcceptedElems<AnyNode>\n ] | BasicAcceptedElems<AnyNode>[]): Cheerio<T>;\n after(this: Cheerio<any>, ...content: any[]): any { return this._insert('after', content); }\n appendTo<T extends AnyNode>(this: Cheerio<T>, target: BasicAcceptedElems<AnyNode>): Cheerio<T>;\n appendTo(this: Cheerio<any>, target: any): any { this._api(target).append(this); return this; }\n prependTo<T extends AnyNode>(this: Cheerio<T>, target: BasicAcceptedElems<AnyNode>): Cheerio<T>;\n prependTo(this: Cheerio<any>, target: any): any { this._api(target).prepend(this); return this; }\n /** @internal */ _insertRelative(target: any, position: string): Cheerio<T> {\n const targets = this._api(target).ids;\n (this as Cheerio<any>).remove();\n const inserted: number[] = [];\n for (const id of targets) {\n if (nodeRecord(this._document, id).parent == null)\n continue;\n const clones = this.op<number[]>('clone', { ids: this.ids, deep: true });\n this.op('insert', { targetIds: [id], nodeIds: clones, position });\n inserted.push(...clones);\n }\n return this._fromIds(inserted);\n }\n insertBefore<T extends AnyNode>(this: Cheerio<T>, target: BasicAcceptedElems<AnyNode>): Cheerio<T>;\n insertBefore(this: Cheerio<any>, target: any): any { return this._insertRelative(target, 'before'); }\n insertAfter<T extends AnyNode>(this: Cheerio<T>, target: BasicAcceptedElems<AnyNode>): Cheerio<T>;\n insertAfter(this: Cheerio<any>, target: any): any { return this._insertRelative(target, 'after'); }\n remove<T extends AnyNode>(this: Cheerio<T>, selector?: string): Cheerio<T>;\n remove(this: Cheerio<any>, selector?: any): any { this.op('remove', { ids: selector ? this.filter(selector).ids : this.ids }); return this; }\n replaceWith<T extends AnyNode>(this: Cheerio<T>, content: AcceptedElems<AnyNode>): Cheerio<T>;\n replaceWith(this: Cheerio<any>, content: any): any {\n return this.each((index, node: any) => {\n if (nodeRecord(this._document, this.ids[index]).parent == null)\n return;\n const value = typeof content === 'function' ? content.call(node, index, node) : content;\n this.op('insert', { targetIds: [this.ids[index]], nodeIds: this._domIds(value), position: 'replace' });\n });\n }\n empty<T extends AnyNode>(this: Cheerio<T>): Cheerio<T>;\n empty(this: Cheerio<any>): any {\n for (const id of this.ids)\n this.op('setNode', { id, field: 'children', value: [] });\n return this;\n }\n html<T extends AnyNode>(this: Cheerio<T>): string | null;\n html<T extends AnyNode>(this: Cheerio<T>, str: string | Cheerio<T>): Cheerio<T>;\n html(this: Cheerio<any>, content?: any): any {\n if (content === undefined)\n return this.length && ['root', 'tag', 'script', 'style', 'cdata'].includes(nodeRecord(this._document, this.ids[0]).type) ? this._document.innerHtml(this.ids[0]) : null;\n if (!content?.cheerio) {\n this.op('html', { ids: this.ids, value: String(content) });\n return this;\n }\n for (const id of this.ids) {\n const nodes = content?.cheerio ? importNodes(this._document, content.toArray()) : this._domIds(String(content), id);\n this.op('setNode', { id, field: 'children', value: nodes });\n }\n return this;\n }\n text<T extends AnyNode>(this: Cheerio<T>): string;\n text<T extends AnyNode>(this: Cheerio<T>, str: string | ((this: AnyNode, i: number, text: string) => string)): Cheerio<T>;\n text(this: Cheerio<any>, content?: any): any {\n if (content === undefined)\n return this._document.text(this.ids);\n if (typeof content !== 'function') {\n this.op('text', { ids: this.ids, value: String(content) });\n return this;\n }\n for (let i = 0; i < this.ids.length; i++) {\n const id = this.ids[i];\n const value = typeof content === 'function' ? content.call(getNode(this._document, id), i, this._document.text([id])) : content;\n this.op('text', { ids: [id], value: String(value) });\n }\n return this;\n }\n toString<T extends AnyNode>(this: Cheerio<T>): string;\n toString(this: Cheerio<any>): any { return this._document.outerHtml(this.ids); }\n clone<T extends AnyNode>(this: Cheerio<T>): Cheerio<T>;\n clone(this: Cheerio<any>): any { return this._fromIds(this.op('clone', { ids: this.ids, deep: true })); }\n /** @internal */ _deepest(id: number, tagsOnly = false): number {\n for (;;) {\n const children = this.op<number[]>('traverse', { ids: [id], kind: 'children' });\n const child = tagsOnly ? children.find((candidate) => nodeRecord(this._document, candidate).type === 'tag') : children[0];\n if (child === undefined)\n return id;\n id = child;\n }\n }\n /** @internal */ _wrap(content: any, inner: boolean): this {\n const lastParent = (this as Cheerio<any>).parents().last();\n for (let i = 0; i < this.length; i++) {\n const id = this.ids[i];\n const node = getNode(this._document, id);\n const value = typeof content === 'function' ? content.call(node, i, node) : typeof content === 'string' && !isMarkup(content) ? lastParent.find(content).clone() : content;\n let wrappers = this._domIds(value);\n if (i < this.length - 1)\n wrappers = this.op('clone', { ids: wrappers, deep: true });\n const wrapper = wrappers[0];\n if (wrapper === undefined || !['root', 'tag', 'script', 'style'].includes(nodeRecord(this._document, wrapper).type))\n continue;\n const deepest = this._deepest(wrapper);\n if (inner) {\n if (!['root', 'tag', 'script', 'style', 'cdata'].includes(nodeRecord(this._document, id).type))\n continue;\n const contents = this.op<number[]>('traverse', { ids: [id], kind: 'contents' });\n this.op('setNode', { id: deepest, field: 'children', value: contents });\n this.op('setNode', { id, field: 'children', value: [wrapper] });\n }\n else if (nodeRecord(this._document, id).parent != null) {\n this.op('insert', { targetIds: [id], nodeIds: [wrapper], position: 'before' });\n this.op('setNode', { id: deepest, field: 'children', value: [id] });\n }\n }\n return this;\n }\n wrap<T extends AnyNode>(this: Cheerio<T>, wrapper: AcceptedElems<AnyNode>): Cheerio<T>;\n wrap(this: Cheerio<any>, content: any): any { return this._wrap(content, false); }\n wrapInner<T extends AnyNode>(this: Cheerio<T>, wrapper: AcceptedElems<AnyNode>): Cheerio<T>;\n wrapInner(this: Cheerio<any>, content: any): any { return this._wrap(content, true); }\n unwrap<T extends AnyNode>(this: Cheerio<T>, selector?: string): Cheerio<T>;\n unwrap(this: Cheerio<any>, selector?: any): any { this.op('remove', { ids: this.parent(selector).not('body').ids, keepChildren: true }); return this; }\n wrapAll<T extends AnyNode>(this: Cheerio<T>, wrapper: AcceptedElems<T>): Cheerio<T>;\n wrapAll(this: Cheerio<any>, content: any): any {\n if (!this.length)\n return this;\n const first = this[0];\n const wrappers = this._make(typeof content === 'function' ? content.call(first, 0, first) : content).insertBefore(first);\n const root = [...wrappers.ids].reverse().find((id) => nodeRecord(this._document, id).type === 'tag');\n if (root !== undefined)\n this.op('insert', { targetIds: [this._deepest(root, true)], nodeIds: this.ids, position: 'append' });\n return this;\n }\n extract<M extends ExtractMap, T extends AnyNode>(this: Cheerio<T>, map: M): ExtractedMap<M>;\n // A structurally shared object signature breaks recursive enum comparisons\n // across independent DOM declarations; calls retain the precise overload.\n extract<M extends ExtractMap, T extends AnyNode>(this: Cheerio<T>, map: M): Record<string, unknown>;\n extract<M extends ExtractMap>(this: Cheerio<any>, map: any): any { return extract.call(this as any, map) as ExtractedMap<M>; }\n}\nObject.defineProperty(Cheerio.prototype, 'cheerio', { value: '[cheerio object]', writable: true, configurable: true });\nexport interface Cheerio<T = AnyNode> extends AttributeMethods<T> {\n}\ninstallAttributes(Cheerio);\n\n/** @internal */\nexport const nativeExtractionMethods = Object.freeze({\n make: Cheerio.prototype._make,\n find: Cheerio.prototype._findBySelector,\n prop: Cheerio.prototype.prop,\n extract: Cheerio.prototype.extract,\n});\n","import { Cheerio, nativeExtractionMethods } from './selection.js';\nimport { types } from 'node:util';\nimport { compileExtractPlan, hydrateExtractResult } from './extract-plan.js';\nimport type { AnyNode, Element, ExtractMap, ExtractedMap, ExtractDescriptor } from './types.js';\n\nexport interface ExtractMethods<T = AnyNode> {\n extract<M extends ExtractMap>(map: M): ExtractedMap<M>;\n}\n\nfunction plainKeys(map: ExtractMap): string[] | undefined {\n return !types.isProxy(map) && (Object.getPrototypeOf(map) === Object.prototype || Object.getPrototypeOf(map) === null) ? Object.keys(map) : undefined;\n}\nfunction nativePrefix(scope: Cheerio<AnyNode>, map: ExtractMap, keys: string[] | undefined, key: string): { keys: string[]; values: Record<string, unknown> } | undefined {\n if (!keys || scope._make !== nativeExtractionMethods.make || scope._findBySelector !== nativeExtractionMethods.find || scope.prop !== nativeExtractionMethods.prop || scope.extract !== nativeExtractionMethods.extract) return undefined;\n const prefix: ExtractMap = Object.create(null);\n let count = 0;\n let plan: ReturnType<typeof compileExtractPlan>;\n const index = keys.indexOf(key);\n for (let position = index; position < keys.length; position++) {\n const name = keys[position];\n const slot = Object.getOwnPropertyDescriptor(map, name);\n if (!slot || !slot.enumerable || !('value' in slot)) break;\n Object.defineProperty(prefix, name, { value: slot.value, enumerable: true, configurable: true });\n const compiled = compileExtractPlan(prefix, scope.options);\n if (!compiled) { delete prefix[name]; break; }\n plan = compiled; count++;\n }\n // A single scalar entry costs one selector call and one property call; the\n // native plan also avoids constructing an intermediate selection for each.\n if (!plan || !count) return undefined;\n const values = scope.op<Record<string, unknown>>('extractPlan', { ids: scope.ids, plan });\n hydrateExtractResult(values, plan.entries);\n return { keys: Object.keys(prefix), values };\n}\n\n/** Descriptor callbacks stay in JavaScript; matching and properties use Rust. */\nexport function extract<M extends ExtractMap>(this: Cheerio<AnyNode>, map: M): ExtractedMap<M> {\n const result: Record<string, unknown> = {};\n const keys = plainKeys(map);\n const processed = new Set<string>();\n for (const key in map) {\n if (processed.has(key)) continue;\n const prefix = Object.getPrototypeOf(result) === Object.prototype ? nativePrefix(this, map, keys, key) : undefined;\n if (prefix) {\n for (const name of prefix.keys) { Object.defineProperty(result, name, { value: prefix.values[name], enumerable: true, configurable: true, writable: true }); processed.add(name); }\n continue;\n }\n const entry = map[key];\n const all = Array.isArray(entry);\n const descriptor = (all ? entry[0] : entry) as string | ExtractDescriptor;\n const selector = typeof descriptor === 'string' ? descriptor : descriptor.selector;\n const value = typeof descriptor === 'string' ? 'textContent' : descriptor.value ?? 'textContent';\n const selection = this._findBySelector(selector, all ? Infinity : 1);\n const read = (index: number) => {\n if (typeof value === 'function') return value(selection[index] as Element, key, result);\n const scope = this._make === nativeExtractionMethods.make\n ? this._fromIds([selection.ids[index]])\n : this._make(selection[index]);\n return typeof value === 'string' ? scope.prop(value) : scope.extract(value);\n };\n let extracted: unknown;\n if (all) {\n const values: unknown[] = [];\n for (let index = 0; index < selection.length; index += 1) {\n const value = read(index);\n if (value != null) values.push(...(Array.isArray(value) ? value : [value]));\n }\n extracted = values;\n } else {\n extracted = selection.length ? read(0) : undefined;\n }\n result[key] = extracted;\n }\n return result as ExtractedMap<M>;\n}\n\nexport function installExtract(CheerioClass: { prototype: object }): void {\n Object.assign(CheerioClass.prototype, { extract });\n}\n\n/** Async batch fallback preserves callback values/order while yielding between visits. */\nexport async function extractCooperatively<M extends ExtractMap>(selection: Cheerio<AnyNode>, map: M): Promise<{ value: ExtractedMap<M> }> {\n let deadline = performance.now() + 4;\n let visits = 0;\n const checkpoint = async () => {\n if (++visits % 32 || performance.now() < deadline) return;\n await new Promise<void>((resolve) => setImmediate(resolve));\n deadline = performance.now() + 4;\n };\n const walk = async (scope: Cheerio<AnyNode>, descriptors: ExtractMap): Promise<{ value: Record<string, unknown> }> => {\n const result: Record<string, unknown> = {};\n const keys = plainKeys(descriptors);\n const processed = new Set<string>();\n for (const key in descriptors) {\n if (processed.has(key)) continue;\n const prefix = Object.getPrototypeOf(result) === Object.prototype ? nativePrefix(scope, descriptors, keys, key) : undefined;\n if (prefix) {\n for (const name of prefix.keys) { Object.defineProperty(result, name, { value: prefix.values[name], enumerable: true, configurable: true, writable: true }); processed.add(name); }\n continue;\n }\n const entry = descriptors[key];\n const all = Array.isArray(entry);\n const descriptor = (all ? entry[0] : entry) as string | ExtractDescriptor;\n const selector = typeof descriptor === 'string' ? descriptor : descriptor.selector;\n const value = typeof descriptor === 'string' ? 'textContent' : descriptor.value ?? 'textContent';\n const found = scope._findBySelector(selector, all ? Infinity : 1);\n const output: unknown[] = [];\n let single: unknown;\n const count = all ? found.length : Math.min(found.length, 1);\n for (let index = 0; index < count; index++) {\n await checkpoint();\n // Callback return values, including Promise objects, remain ordinary\n // values just as in synchronous Cheerio.extract().\n let extracted: unknown;\n if (typeof value === 'function') extracted = value(found[index] as Element, key, result);\n else {\n const child = scope._make === nativeExtractionMethods.make\n ? scope._fromIds([found.ids[index]])\n : scope._make(found[index]);\n extracted = typeof value === 'string' ? child.prop(value) : child.extract === nativeExtractionMethods.extract ? (await walk(child, value)).value : child.extract(value);\n }\n if (all) { if (extracted != null) output.push(...(Array.isArray(extracted) ? extracted : [extracted])); }\n else single = extracted;\n }\n result[key] = all ? output : single;\n }\n return { value: result };\n };\n return await walk(selection, map) as { value: ExtractedMap<M> };\n}\n","import * as nativeDOM from './dom.js';\nimport { parseNativeDocument, parserOptions, deliverParseErrors, hasParserHooks, cleanParserOptions, createTreeAdapterSession } from './hooks.js';\nimport { compileExtractPlan, hydrateExtractResult } from './extract-plan.js';\nimport { extractCooperatively } from './extract.js';\nimport { setImmediate as yieldToEventLoop } from 'node:timers/promises';\nimport { availableParallelism } from 'node:os';\nimport { requireNative, nativeStatus, type NativeDocument, type NativeQuery } from './native.js';\nimport { Cheerio } from './selection.js';\nimport { getNode, importNodes, nodeBinding, operation } from './nodes.js';\nimport { isHtml } from './utils.js';\nimport { routeDocument, sameNodeSpace } from './router.js';\nimport type { AnyNode, Document, CheerioAPI, CheerioOptions, LoadContent, ParallelOptions, ExtractMap, ExtractedMap } from './types.js';\n\nexport type * from './types.js';\nexport type { Cheerio } from './selection.js';\nexport { nativeStatus };\nexport const dom = {\n Node: nativeDOM.Node, DataNode: nativeDOM.DataNode, NodeWithChildren: nativeDOM.NodeWithChildren,\n Document: nativeDOM.Document, Element: nativeDOM.Element, Text: nativeDOM.Text,\n Comment: nativeDOM.Comment, ProcessingInstruction: nativeDOM.ProcessingInstruction, CDATA: nativeDOM.CDATA,\n ElementType: nativeDOM.ElementType, isTag: nativeDOM.isTag, isText: nativeDOM.isText,\n isComment: nativeDOM.isComment, isDirective: nativeDOM.isDirective, isDocument: nativeDOM.isDocument,\n isCDATA: nativeDOM.isCDATA, hasChildren: nativeDOM.hasChildren,\n} as const;\nexport { configureWorkers, workerPoolInfo } from './workers.js';\nexport type { WorkerOptions, WorkerPoolInfo } from './workers.js';\nexport { loadBuffer, stringStream, decodeStream, fromURL } from './io.js';\n\nexport function flattenOptions(options?: CheerioOptions | null, base?: CheerioOptions): CheerioOptions {\n const result: CheerioOptions = { _useHtmlParser2: false, ...base, ...options };\n if (options?.xml) { result._useHtmlParser2 = true; result.xmlMode = true; if (options.xml !== true) Object.assign(result, options.xml); }\n else if (options?.xmlMode) result._useHtmlParser2 = true;\n return result;\n}\n\n/** A synchronous, constructable Cheerio factory backed by a mutable Rust DOM. */\nexport function createAPI(document: NativeDocument, options?: CheerioOptions | null, initialRoot = document.rootId()): CheerioAPI {\n const internal = flattenOptions(options);\n class LoadedCheerio<T = AnyNode> extends Cheerio<T> {}\n let api: CheerioAPI;\n const initialize = function<T = AnyNode>(selector?: any, context?: any, root?: any, override?: CheerioOptions): Cheerio<T> {\n if (selector?.cheerio) return selector;\n const opts = flattenOptions(override, internal);\n const rootIds = root === undefined ? [initialRoot]\n : typeof root === 'string' ? [makeRoot(document, operation(document, 'create', { html: root, options: opts }))]\n : root?.cheerio ? importNodes(document, root.toArray()) : importNodes(document, root);\n const rootInstance = new LoadedCheerio<Document>(api, document, rootIds, null, opts);\n rootInstance._root = rootInstance;\n if (!selector) return new LoadedCheerio<T>(api, document, [], rootInstance, opts);\n if (typeof selector === 'string' && isHtml(selector)) return new LoadedCheerio<T>(api, document, operation(document, 'create', { html: selector, options: opts }), rootInstance, opts);\n if (typeof selector === 'object') {\n const values = 'length' in selector && !selector.type ? Array.from(selector as ArrayLike<T>) : [selector];\n const allNodes = values.every((value: any) => value && typeof value === 'object' && typeof value.type === 'string');\n return new LoadedCheerio<T>(api, document, allNodes ? importNodes(document, values) : [], rootInstance, opts, allNodes ? undefined : values);\n }\n if (typeof selector !== 'string') throw new TypeError('Unexpected type of selector');\n let search = selector;\n let searchContext: Cheerio<any> = rootInstance;\n if (context) {\n if (typeof context === 'string') {\n if (isHtml(context)) searchContext = new LoadedCheerio<Document>(api, document, [makeRoot(document, operation(document, 'create', { html: context, options: opts }))], rootInstance, opts);\n else search = `${context} ${search}`;\n } else if (context.cheerio) searchContext = context;\n else searchContext = new LoadedCheerio(api, document, importNodes(document, context), rootInstance, opts);\n }\n return searchContext.find(search) as unknown as Cheerio<T>;\n };\n api = Object.assign(initialize, {\n load,\n _root: getNode(document, initialRoot),\n _options: internal,\n fn: LoadedCheerio.prototype,\n prototype: LoadedCheerio.prototype,\n root(this: CheerioAPI): Cheerio<Document> { return this(this._root) as Cheerio<Document>; },\n html(this: CheerioAPI | undefined, dom?: any, renderOptions?: CheerioOptions): string {\n if (!this) return '';\n if (dom && typeof dom === 'object' && !('length' in dom) && !('type' in dom)) { renderOptions = dom; dom = undefined; }\n const nodes = dom === undefined ? [this._root] : this(dom).toArray();\n const binding = nodeBinding(this._root)!;\n return operation(binding.document, 'render', { ids: importNodes(binding.document, nodes), options: flattenOptions(renderOptions, this._options) });\n },\n xml(this: CheerioAPI, dom?: any): string {\n const binding = nodeBinding(this._root)!;\n return operation(binding.document, 'render', { ids: importNodes(binding.document, dom === undefined ? [this._root] : this(dom).toArray()), options: { ...this._options, xmlMode: true, _useHtmlParser2: true } });\n },\n text(this: CheerioAPI | undefined, elements?: ArrayLike<AnyNode>): string {\n if (!elements && !this) return '';\n const nodes = elements ?? [this!._root];\n const binding = this ? nodeBinding(this._root) : nodeBinding(nodes[0]);\n if (binding) return binding.document.text(importNodes(binding.document, nodes));\n const doc = routeDocument(new (requireNative().NativeDocument)('', false));\n return doc.text(importNodes(doc, nodes));\n },\n parseHTML(this: CheerioAPI, data?: string | null, context?: unknown, keepScripts = typeof context === 'boolean' ? context : false): AnyNode[] | null {\n if (!data || typeof data !== 'string') return null;\n if (typeof context === 'boolean') keepScripts = context;\n const parsed = this.load(data, this._options, false);\n if (!keepScripts) parsed('script').remove();\n return parsed._root.children.slice();\n },\n extract<M extends ExtractMap>(this: CheerioAPI, map: M): ExtractedMap<M> { return this.root().extract(map); },\n contains,\n merge,\n }) as unknown as CheerioAPI;\n return api;\n}\n\nfunction makeRoot(document: NativeDocument, children: number[]): number {\n const id = operation<number>(document, 'createNode', { type: 'root' });\n operation(document, 'setNode', { id, field: 'children', value: children });\n return id;\n}\n\nexport function load(content: LoadContent, options?: CheerioOptions | null, isDocument = true): CheerioAPI {\n if (content == null) throw new Error('cheerio.load() expects a string');\n const opts = flattenOptions(options);\n const binding = requireNative();\n const string = Buffer.isBuffer(content) ? content.toString() : typeof content === 'string' ? content : undefined;\n const document = string === undefined ? routeDocument(new binding.NativeDocument('', false, JSON.stringify(cleanParserOptions(opts))), opts) : parseNativeDocument(string, opts, isDocument);\n if (string !== undefined) return createAPI(document, opts);\n const nodes = importNodes(document, content);\n if (!Array.isArray(content) && (content as AnyNode).type === 'root') return createAPI(document, opts, nodes[0]);\n operation(document, 'setNode', { id: document.rootId(), field: 'children', value: nodes });\n return createAPI(routeDocument(document, opts), opts);\n}\n\nexport async function loadAsync(content: LoadContent, options?: CheerioOptions | null, isDocument = true): Promise<CheerioAPI> {\n if (content == null) throw new Error('cheerio.load() expects a string');\n if (typeof content !== 'string' && !Buffer.isBuffer(content)) return load(content, options, isDocument);\n const binding = requireNative();\n const opts = flattenOptions(options);\n const html = String(content);\n // User parser hooks execute on JavaScript, exactly where their callbacks live.\n if (!opts._useHtmlParser2 && opts.treeAdapter) {\n const session = createTreeAdapterSession(opts, isDocument);\n try { await session.write(html); return createAPI(await session.end(), opts); }\n catch (error) { session.abort(); throw error; }\n }\n if (opts._useHtmlParser2 && opts.Tokenizer) return createAPI(parseNativeDocument(html, opts, isDocument), opts);\n const document = binding.parseAsync ? await binding.parseAsync(html, isDocument, JSON.stringify(parserOptions(html, opts))) : new binding.NativeDocument(html, isDocument, JSON.stringify(parserOptions(html, opts)));\n deliverParseErrors(document, opts);\n return createAPI(routeDocument(document, opts), opts);\n}\n\nexport function contains(container: AnyNode, contained: AnyNode): boolean {\n if (!container || !contained || container === contained) return false;\n let parent = nodeBinding(container);\n if (!parent) {\n const document = routeDocument(new (requireNative().NativeDocument)('', false));\n importNodes(document, [container]); parent = nodeBinding(container);\n }\n const child = nodeBinding(contained);\n return !!parent && !!child && sameNodeSpace(child.document, parent.document) && operation(parent.document, 'contains', { container: parent.id, contained: child.id });\n}\n\nexport function merge<T>(first: ArrayLike<T>, second: ArrayLike<T>): ArrayLike<T> | undefined {\n const arrayLike = (value: any): boolean => Array.isArray(value) || value && typeof value === 'object' && typeof value.length === 'number' && value.length >= 0 && Array.from({ length: value.length }, (_unused, i) => i in value).every(Boolean);\n if (!arrayLike(first) || !arrayLike(second)) return undefined;\n const writable = first as { [key: number]: T; length: number };\n let length = first.length;\n for (let i = 0, count = +second.length; i < count; i++) writable[length++] = second[i];\n writable.length = length;\n return writable;\n}\n\nfunction parallelOptions(options?: ParallelOptions | null): { options: CheerioOptions; threads: number } {\n const { threads = Math.min(availableParallelism(), 256), ...opts } = options ?? {};\n if (!Number.isSafeInteger(threads) || threads < 1 || threads > 256) throw new RangeError('threads must be an integer from 1 to 256');\n return { options: flattenOptions(opts), threads };\n}\n\nexport async function loadAll(content: readonly string[], options?: ParallelOptions | null, isDocument = true): Promise<CheerioAPI[]> {\n const { options: opts, threads } = parallelOptions(options);\n if (!Array.isArray(content) || content.some((item) => typeof item !== 'string')) throw new TypeError('loadAll expects an array of HTML strings');\n if (!content.length) return [];\n const binding = requireNative();\n if (!binding.parseManyAsync || hasParserHooks(opts)) return Promise.all(content.map((html) => loadAsync(html, opts, isDocument)));\n const documents = await binding.parseManyAsync([...content], isDocument, threads, JSON.stringify(opts));\n return documents.map((document) => createAPI(routeDocument(document, opts), opts));\n}\n\nfunction nativeQueries(map: ExtractMap, options: CheerioOptions): NativeQuery[] | undefined {\n const queries: NativeQuery[] = [];\n const plainProperties = /^(?:id|class|title|href|src|alt|name|data-.+|aria-.+)$/;\n for (const key in map) {\n const entry = map[key]; const all = Array.isArray(entry); const descriptor = all ? entry[0] : entry;\n const selector = typeof descriptor === 'string' ? descriptor : descriptor.selector;\n const value = typeof descriptor === 'string' ? 'textContent' : descriptor.value ?? 'textContent';\n if (typeof value !== 'string' || value !== 'textContent' && !plainProperties.test(value) || options.baseURI && (value === 'href' || value === 'src') || options.pseudos) return undefined;\n queries.push({ key, selector, all, ...(value === 'textContent' ? {} : { attr: value }) });\n }\n return queries;\n}\n\nexport async function extractAll<M extends ExtractMap>(content: readonly string[], map: M, options?: ParallelOptions | null): Promise<ExtractedMap<M>[]> {\n const { options: opts, threads } = parallelOptions(options);\n if (!Array.isArray(content) || content.some((item) => typeof item !== 'string')) throw new TypeError('extractAll expects an array of HTML strings');\n if (!content.length) return [];\n const binding = requireNative();\n const plan = hasParserHooks(opts) ? undefined : compileExtractPlan(map, opts);\n if (binding.extractPlanManyAsync && plan) {\n const results: Record<string, unknown>[] = JSON.parse(await binding.extractPlanManyAsync([...content], JSON.stringify(plan), threads, JSON.stringify(opts)));\n for (const result of results) hydrateExtractResult(result, plan.entries);\n return results as ExtractedMap<M>[];\n }\n const queries = binding.extractPlanManyAsync || hasParserHooks(opts) ? undefined : nativeQueries(map, opts);\n if (binding.extractManyAsync && queries) {\n const results: Record<string, unknown>[] = JSON.parse(await binding.extractManyAsync([...content], queries, threads, true, JSON.stringify(opts)));\n for (const result of results) for (const query of queries) {\n if (!Object.hasOwn(result, query.key)) Object.defineProperty(result, query.key, { value: query.all ? [] : undefined, configurable: true, writable: true, enumerable: true });\n if (query.all && Array.isArray(result[query.key])) result[query.key] = (result[query.key] as unknown[]).filter((value) => value != null);\n }\n return results as ExtractedMap<M>[];\n }\n const documents = await loadAll(content, { ...opts, threads });\n const results: ExtractedMap<M>[] = [];\n let yieldedAt = performance.now();\n for (const document of documents) {\n results.push((await extractCooperatively(document.root(), map)).value);\n if (performance.now() - yieldedAt >= 4) { await yieldToEventLoop(); yieldedAt = performance.now(); }\n }\n return results;\n}\n","import { requireNative, type NativeWorkerPoolInfo } from './native.js';\n\nexport interface WorkerOptions { threads: number }\nexport type WorkerPoolInfo = NativeWorkerPoolInfo;\n\n/** Set the process-wide native CPU-worker budget before starting async work. */\nexport function configureWorkers(options: WorkerOptions | number): WorkerPoolInfo {\n const threads = typeof options === 'number' ? options : options?.threads;\n if (!Number.isSafeInteger(threads) || threads < 1 || threads > 256) throw new RangeError('threads must be an integer from 1 to 256');\n const binding = requireNative();\n if (!binding.configureWorkerPool || !binding.workerPoolInfo) throw new Error('This native build does not support a shared worker pool');\n binding.configureWorkerPool(threads);\n return binding.workerPoolInfo();\n}\n\n/** Observe the configured budget and actual concurrent native CPU work. */\nexport function workerPoolInfo(): WorkerPoolInfo {\n const binding = requireNative();\n if (!binding.workerPoolInfo) throw new Error('This native build does not support worker pool diagnostics');\n return binding.workerPoolInfo();\n}\n","import { Readable, Writable } from 'node:stream';\nimport { request as requestHTTP } from 'node:http';\nimport { request as requestHTTPS } from 'node:https';\nimport { stringify as stringifyQuery } from 'node:querystring';\nimport type { EventEmitter } from 'node:events';\nimport { MIMEType } from 'node:util';\nimport { createAPI, flattenOptions, load } from './index.js';\nimport { requireNative, type NativeStream } from './native.js';\nimport { createDiagnosticSession, createTokenizerSession, createTreeAdapterSession, deliverParseErrors, parserOptions } from './hooks.js';\nimport { routeDocument } from './router.js';\nimport type { CheerioAPI, CheerioOptions, CheerioRequestOptions, DecodeStreamOptions, EncodingOptions } from './types.js';\n\nexport type LoadCallback = (error: Error | null | undefined, document: CheerioAPI) => void;\n\nfunction encodingLabel(label: string | null | undefined): string | undefined {\n if (!label) return undefined;\n if (label.trim().toLowerCase() === 'x-user-defined') return 'x-user-defined';\n try { return new TextDecoder(label.trim()).encoding; } catch { return undefined; }\n}\n\n/** WHATWG decoding with BOM, transport headers, and the HTML meta prescan. */\nfunction sniffEncoding(buffer: Uint8Array, options: EncodingOptions = {}): string {\n let label: string | undefined;\n if (buffer[0] === 0xef && buffer[1] === 0xbb && buffer[2] === 0xbf) label = 'utf-8';\n else if (buffer[0] === 0xff && buffer[1] === 0xfe) label = 'utf-16le';\n else if (buffer[0] === 0xfe && buffer[1] === 0xff) label = 'utf-16be';\n label ??= encodingLabel((options as EncodingOptions & { userEncoding?: string }).userEncoding);\n label ??= encodingLabel(options.transportLayerEncodingLabel);\n if (!label && buffer[0] === 0 && buffer[1] === 0x3c && buffer[2] === 0 && buffer[3] === 0x3f && buffer[4] === 0 && buffer[5] === 0x78) label = 'utf-16be';\n if (!label && buffer[0] === 0x3c && buffer[1] === 0 && buffer[2] === 0x3f && buffer[3] === 0 && buffer[4] === 0x78 && buffer[5] === 0) label = 'utf-16le';\n if (!label) {\n const prefix = Buffer.from(buffer.subarray(0, options.maxBytes ?? 1024)).toString('latin1').replace(/<!--[\\s\\S]*?(?:-->|$)/g, '');\n for (const token of prefix.matchAll(/<meta\\b([^>]*)>/gi)) {\n const attributes: Record<string, string> = {};\n for (const attribute of token[1].matchAll(/([^\\s=/'\">]+)(?:\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s\"'>]+)))?/g)) {\n const key = attribute[1].toLowerCase();\n if (!(key in attributes)) attributes[key] = attribute[2] ?? attribute[3] ?? attribute[4] ?? '';\n }\n const declared = attributes.charset ?? (attributes['http-equiv']?.toLowerCase() === 'content-type'\n ? /\\bcharset\\s*=\\s*[\"']?([^\\s;\"']+)/i.exec(attributes.content ?? '')?.[1] : undefined);\n label = encodingLabel(declared);\n if (label) {\n if (label === 'utf-16le' || label === 'utf-16be') label = 'utf-8';\n if (label === 'x-user-defined') label = 'windows-1252';\n break;\n }\n }\n if (!label) {\n const declaration = /<\\?xml\\b[^>]*\\bencoding\\s*=\\s*[\"']([^\"']+)[\"']/i.exec(prefix);\n label = encodingLabel(declaration?.[1]);\n if (label === 'utf-16le' || label === 'utf-16be') label = 'utf-8';\n }\n }\n label ??= encodingLabel(options.defaultEncoding) ?? 'windows-1252';\n return label;\n}\n\nexport function decodeBuffer(buffer: Uint8Array, options: EncodingOptions = {}): string {\n const label = sniffEncoding(buffer, options);\n if (label === 'x-user-defined') {\n let decoded = '';\n for (const byte of buffer) decoded += String.fromCharCode(byte < 0x80 ? byte : 0xf700 + byte);\n return decoded;\n }\n return new TextDecoder(label).decode(buffer);\n}\n\nfunction decodedInput(buffer: Uint8Array, options: DecodeStreamOptions): [string, CheerioOptions] {\n const { encoding, ...parserOptions } = options;\n const xml = !!(options.xmlMode || options.xml);\n return [decodeBuffer(buffer, { defaultEncoding: xml ? 'utf-8' : 'windows-1252', ...encoding }), parserOptions];\n}\n\nexport function loadBuffer(buffer: Buffer | Uint8Array, options: DecodeStreamOptions = {}): CheerioAPI {\n return load(...decodedInput(buffer, options));\n}\n\nfunction completion(callback: LoadCallback): (error?: Error | null, document?: CheerioAPI) => void {\n let completed = false;\n return (error, document) => {\n if (completed) return;\n completed = true;\n callback(error, document as CheerioAPI);\n };\n}\n\nfunction requestHeaders(input: NonNullable<CheerioRequestOptions['requestOptions']>['headers']): Headers {\n if (!input) return new Headers();\n if (input instanceof Headers) return new Headers(input);\n const headers = new Headers();\n if (Array.isArray(input)) {\n if (input.length % 2) throw new TypeError('HTTP header arrays must contain name/value pairs');\n for (let index = 0; index < input.length; index += 2) headers.append(input[index], input[index + 1]);\n } else {\n const entries: Iterable<[string, string | string[] | undefined]> = Symbol.iterator in input\n ? input as Iterable<[string, string | string[] | undefined]> : Object.entries(input);\n for (const [name, value] of entries) {\n if (value == null) continue;\n for (const item of Array.isArray(value) ? value : [value]) headers.append(name, item);\n }\n }\n return headers;\n}\n\ninterface HTTPResponse {\n status: number;\n ok: boolean;\n headers: Headers;\n body: ReadableStream<Uint8Array> | null;\n rawHeaders?: Record<string, string | string[] | undefined>;\n}\n\n/** Node transport exposes informational responses and leaves wire headers alone. */\nasync function requestDocument(url: URL, method: string, headers: Headers, body: NonNullable<CheerioRequestOptions['requestOptions']>['body'], options: NonNullable<CheerioRequestOptions['requestOptions']>, signal: AbortSignal): Promise<HTTPResponse> {\n if (options.typeOfService != null && (!Number.isInteger(options.typeOfService) || options.typeOfService < 0 || options.typeOfService > 255)) {\n throw Object.assign(new Error('typeOfService must be an integer between 0 and 255'), { name: 'InvalidArgumentError', code: 'UND_ERR_INVALID_ARG' });\n }\n let payload: string | Uint8Array | Readable | ReadableStream<Uint8Array> | null | undefined = body as string | Uint8Array | Readable | null | undefined;\n if (body && typeof body === 'object' && !(body instanceof Uint8Array) && !(body instanceof Readable)) {\n // Request supplies Node's built-in multipart encoder for either Node or\n // Undici FormData without requiring the Undici package at runtime.\n let form: FormData;\n if (body instanceof FormData) form = body;\n else {\n form = new FormData();\n for (const [name, value] of body as import('./types.js').FormDataLike) {\n if (typeof value === 'string') form.append(name, value);\n else if ('name' in value && typeof value.name === 'string') form.append(name, value as Blob, value.name);\n else form.append(name, value as Blob);\n }\n }\n const encoded = new Request(url, { method: 'POST', body: form });\n // Node 20's encoder omits the final CRLF used by Undici 7. Keep the\n // request streaming while normalizing that suffix across Node versions.\n payload = Readable.from((async function* () {\n let previous = -1;\n let last = -1;\n for await (const chunk of Readable.fromWeb(encoded.body! as import('node:stream/web').ReadableStream<Uint8Array>)) {\n const bytes = chunk as Buffer;\n if (bytes.length >= 2) previous = bytes[bytes.length - 2];\n else if (bytes.length === 1) previous = last;\n if (bytes.length) last = bytes[bytes.length - 1];\n yield bytes;\n }\n if (previous !== 13 || last !== 10) yield Buffer.from('\\r\\n');\n })());\n if (!requestHeaders(options.headers).has('content-type')) headers.set('content-type', encoded.headers.get('content-type')!);\n }\n if (payload != null && !(payload instanceof Readable) && !(typeof payload === 'object' && 'getReader' in payload) && !headers.has('content-length') && !headers.has('transfer-encoding')) {\n headers.set('content-length', String(typeof payload === 'string' ? Buffer.byteLength(payload) : payload.byteLength));\n }\n const declaredLength = headers.has('content-length') ? Number(headers.get('content-length')) : undefined;\n const lengthError = () => Object.assign(new Error('Request body length does not match content-length header'), { name: 'RequestContentLengthMismatchError', code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' });\n const knownLength = typeof payload === 'string' ? Buffer.byteLength(payload) : payload instanceof Uint8Array ? payload.byteLength : undefined;\n if (declaredLength != null && knownLength != null && declaredLength !== knownLength) throw lengthError();\n if (options.reset === true && !headers.has('connection')) headers.set('connection', 'close');\n return new Promise<HTTPResponse>((resolve, reject) => {\n let informationalError: Error | undefined;\n const request = (url.protocol === 'https:' ? requestHTTPS : requestHTTP)(url, {\n method, headers: Object.fromEntries(headers), signal,\n ...(typeof options.highWaterMark === 'number' ? { highWaterMark: options.highWaterMark } : {}),\n }, response => {\n if (informationalError) { response.destroy(); return; }\n const rawHeaders: Record<string, string | string[]> = {};\n for (let index = 0; index < response.rawHeaders.length; index += 2) {\n const name = response.rawHeaders[index].toLowerCase();\n const value = response.rawHeaders[index + 1];\n if (!Object.hasOwn(rawHeaders, name)) Object.defineProperty(rawHeaders, name, { value, enumerable: true, writable: true, configurable: true });\n else rawHeaders[name] = [...(Array.isArray(rawHeaders[name]) ? rawHeaders[name] : [rawHeaders[name]]) as string[], value];\n }\n const responseHeaders = new Headers();\n for (const [name, value] of Object.entries(rawHeaders)) {\n if (value == null) continue;\n for (const item of Array.isArray(value) ? name === 'content-type' ? value.slice(0, 1) : value : [value]) responseHeaders.append(name, item);\n }\n const status = response.statusCode ?? 0;\n resolve({ status, ok: status >= 200 && status < 300, headers: responseHeaders, rawHeaders, body: Readable.toWeb(response) as ReadableStream<Uint8Array> });\n });\n request.once('error', error => reject(signal.aborted ? signal.reason : error));\n request.on('information', information => {\n try { options.onInfo?.({ statusCode: information.statusCode, headers: information.headers as Record<string, string | string[]> }); }\n catch (error) { informationalError = error as Error; reject(error); request.destroy(error as Error); }\n });\n request.once('socket', socket => {\n const transport = socket as typeof socket & { setTypeOfService?: (value?: number) => void };\n try {\n if (transport.setTypeOfService && options.typeOfService != null) transport.setTypeOfService(options.typeOfService);\n } catch (error) { request.destroy(error as Error); return; }\n if (socket.connecting) {\n const timer = setTimeout(() => request.destroy(Object.assign(new Error('Connect Timeout Error'), { name: 'ConnectTimeoutError', code: 'UND_ERR_CONNECT_TIMEOUT' })), 10000);\n timer.unref();\n socket.once(url.protocol === 'https:' ? 'secureConnect' : 'connect', () => clearTimeout(timer));\n request.once('close', () => clearTimeout(timer));\n }\n });\n if (payload instanceof Readable || payload && typeof payload === 'object' && 'getReader' in payload) {\n const source = payload instanceof Readable ? payload : Readable.fromWeb(payload as unknown as import('node:stream/web').ReadableStream<Uint8Array>);\n if (declaredLength != null) {\n let sent = 0;\n source.on('data', (chunk: Buffer | string) => {\n sent += typeof chunk === 'string' ? Buffer.byteLength(chunk) : chunk.byteLength;\n if (sent > declaredLength) { request.destroy(lengthError()); source.destroy(); }\n });\n source.once('end', () => { if (sent !== declaredLength) request.destroy(lengthError()); });\n }\n source.once('error', error => request.destroy(error));\n request.once('close', () => { if (!source.destroyed) source.destroy(); });\n source.pipe(request);\n } else request.end(payload);\n });\n}\n\n/** A Node writable that feeds the native parser with bounded backpressure. */\nexport function stringStream(options: CheerioOptions, callback: LoadCallback): Writable {\n const complete = completion(callback);\n const opts = flattenOptions(options);\n const xml = !!opts._useHtmlParser2;\n const binding = requireNative();\n let native: NativeStream | undefined;\n let writeNative: (chunk: string) => Promise<void>;\n let finishNative: () => Promise<CheerioAPI>;\n let abortNative: () => void;\n let carry = '';\n if (opts._useHtmlParser2 && opts.Tokenizer) {\n const session = createTokenizerSession(opts);\n // Arbitrary user tokenizers can emit offsets for any earlier input. Retain\n // their source until end rather than changing their callback contract.\n const chunks: string[] = [];\n writeNative = async (chunk) => { chunks.push(chunk); session.write(chunk); };\n finishNative = async () => {\n const document = new binding.NativeDocument(chunks.join(''), true, JSON.stringify(session.end()));\n chunks.length = 0;\n return createAPI(routeDocument(document, opts), opts);\n };\n abortNative = () => { chunks.length = 0; };\n } else if (!opts._useHtmlParser2 && opts.treeAdapter) {\n const session = createTreeAdapterSession(opts, true);\n writeNative = (chunk) => session.write(chunk);\n finishNative = async () => createAPI(await session.end(), opts);\n abortNative = () => session.abort();\n } else if (!opts._useHtmlParser2 && opts.onParseError) {\n const session = createDiagnosticSession(opts, true);\n writeNative = (chunk) => session.write(chunk);\n finishNative = async () => createAPI(await session.end(), opts);\n abortNative = () => session.abort();\n } else {\n if (!binding.NativeStream) throw new Error('This native build does not support incremental parsing');\n native = new binding.NativeStream(JSON.stringify(parserOptions('', opts)), true);\n writeNative = (chunk) => native!.write(chunk);\n finishNative = async () => {\n const document = await native!.finish();\n deliverParseErrors(document, opts);\n return createAPI(routeDocument(document, opts), opts);\n };\n abortNative = () => native!.abort();\n }\n const stream = new Writable({\n decodeStrings: false,\n write(chunk, _encoding, done) {\n if (typeof chunk !== 'string') throw new TypeError(xml ? 'Expected a string' : 'Parser can work only with string streams.');\n if (opts._useHtmlParser2 && opts.Tokenizer) { writeNative(chunk).then(() => done(), (error: Error) => done(error)); return; }\n let text = carry + chunk;\n carry = '';\n const last = text.charCodeAt(text.length - 1);\n if (last >= 0xd800 && last <= 0xdbff) { carry = text.slice(-1); text = text.slice(0, -1); }\n if (!text) { done(); return; }\n writeNative(text).then(() => done(), (error: Error) => done(error));\n },\n final(done) {\n (async () => {\n if (carry) await writeNative(carry);\n return finishNative();\n })().then((document) => {\n complete(null, document);\n done();\n }, (error: Error) => done(error));\n },\n destroy(error, done) { abortNative(); done(error); },\n });\n stream.on('error', (error) => complete(error));\n return stream;\n}\n\n/** Sniff a bounded prefix, then decode and parse each chunk as it arrives. */\nexport function decodeStream(options: DecodeStreamOptions, callback: LoadCallback): Writable {\n const complete = completion(callback);\n const { encoding = {}, ...parserOptions } = options ?? {};\n const opts = flattenOptions(parserOptions);\n const decoderOptions = { defaultEncoding: opts.xmlMode ? 'utf-8' : 'windows-1252', ...encoding };\n const maxBytes = decoderOptions.maxBytes ?? 1024;\n if (!Number.isSafeInteger(maxBytes) || maxBytes < 0) throw new RangeError('encoding.maxBytes must be a non-negative integer');\n const prefixLimit = Math.max(6, maxBytes);\n const prefix: Buffer[] = [];\n let prefixLength = 0;\n let decoder: TextDecoder | undefined;\n let userDefined = false;\n let started = false;\n const parser = stringStream(opts, (error, document) => complete(error, document));\n let downstreamError: Error | undefined;\n parser.on('error', (error) => { downstreamError = error; stream.destroy(error); });\n const writeText = (text: string): Promise<void> => new Promise((resolve, reject) => {\n if (downstreamError) { reject(downstreamError); return; }\n if (!text) { resolve(); return; }\n parser.write(text, (error?: Error | null) => error ? reject(error) : resolve());\n });\n const decode = (bytes: Uint8Array, final = false): string => {\n if (userDefined) {\n let text = '';\n for (const byte of bytes) text += String.fromCharCode(byte < 0x80 ? byte : 0xf700 + byte);\n return text;\n }\n return decoder!.decode(bytes, { stream: !final });\n };\n const start = async (): Promise<void> => {\n const bytes = Buffer.concat(prefix, prefixLength);\n const label = sniffEncoding(bytes, decoderOptions);\n userDefined = label === 'x-user-defined';\n if (!userDefined) decoder = new TextDecoder(label);\n started = true;\n prefix.length = 0;\n await writeText(decode(bytes));\n };\n const accept = async (bytes: Buffer): Promise<void> => {\n if (!started) {\n const count = Math.min(prefixLimit - prefixLength, bytes.length);\n if (count) { prefix.push(Buffer.from(bytes.subarray(0, count))); prefixLength += count; }\n bytes = bytes.subarray(count);\n const declaredEncoding = encodingLabel(decoderOptions.userEncoding) || encodingLabel(decoderOptions.transportLayerEncodingLabel);\n if (prefixLength >= prefixLimit || declaredEncoding && prefixLength >= 3) await start();\n }\n if (started && bytes.length) await writeText(decode(bytes));\n };\n const stream = new Writable({\n write(chunk: Buffer | string, encoding, done) {\n accept(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, encoding)).then(() => done(), (error: Error) => done(error));\n },\n final(done) {\n (async () => {\n if (!started) await start();\n await writeText(decode(new Uint8Array(), true));\n await new Promise<void>((resolve, reject) => {\n parser.once('error', reject);\n parser.end(() => { parser.removeListener('error', reject); resolve(); });\n });\n })().then(() => done(), (error: Error) => done(error));\n },\n destroy(error, done) { parser.destroy(error ?? undefined); done(error); },\n });\n stream.on('error', (error) => complete(error));\n return stream;\n}\n\n/** Load HTML or XML with bounded redirects through Node's built-in transport. */\nexport async function fromURL(url: string | URL, options: CheerioRequestOptions = {}): Promise<CheerioAPI> {\n const signal = options.requestOptions?.signal;\n if (!signal) return loadURL(url, options);\n if (typeof signal !== 'object' && typeof signal !== 'function') throw new TypeError('signal must be an AbortSignal or EventEmitter');\n if ('addEventListener' in signal) return loadURL(url, options);\n if (!('once' in signal) || !('removeListener' in signal)) throw new TypeError('signal must be an AbortSignal or EventEmitter');\n const emitter = signal as EventEmitter;\n const controller = new AbortController();\n const abort = () => controller.abort();\n emitter.once('abort', abort);\n try { return await loadURL(url, { ...options, requestOptions: { ...options.requestOptions, signal: controller.signal } }); }\n finally { emitter.removeListener('abort', abort); }\n}\n\nasync function loadURL(url: string | URL, options: CheerioRequestOptions): Promise<CheerioAPI> {\n const { requestOptions = {}, encoding, ...parserOptions } = options;\n const maxRedirects = requestOptions.maxRedirections ?? 5;\n if (!Number.isInteger(maxRedirects) || maxRedirects < 0) throw new RangeError('maxRedirections must be a non-negative integer');\n const headers = requestHeaders(requestOptions.headers);\n if (!Object.hasOwn(requestOptions, 'headers')) headers.set('accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8');\n let current = new URL(url);\n if (requestOptions.query) {\n if (current.search || current.hash) throw new TypeError('URL must not contain a query or fragment when requestOptions.query is supplied');\n current.search = stringifyQuery(requestOptions.query);\n }\n let method = requestOptions.method ?? 'GET';\n let body = requestOptions.body;\n let response: HTTPResponse;\n const controller = new AbortController();\n const signal = requestOptions.signal ? AbortSignal.any([requestOptions.signal as AbortSignal, controller.signal]) : controller.signal;\n const timeoutError = (kind: 'Headers' | 'Body') => Object.assign(new Error(`${kind} Timeout Error`), {\n name: `${kind}TimeoutError`, code: kind === 'Headers' ? 'UND_ERR_HEADERS_TIMEOUT' : 'UND_ERR_BODY_TIMEOUT',\n });\n for (const timeout of [requestOptions.headersTimeout, requestOptions.bodyTimeout]) {\n if (timeout != null && (!Number.isFinite(timeout) || timeout < 0)) throw new RangeError('HTTP timeouts must be non-negative finite numbers');\n }\n const suppliedDispatcher = requestOptions.dispatcher as { dispatch?: (options: unknown, handler: unknown) => boolean } | undefined;\n if (suppliedDispatcher && typeof suppliedDispatcher.dispatch !== 'function') throw new TypeError('requestOptions.dispatcher must implement dispatch');\n const dispatcher = suppliedDispatcher && {\n dispatch(dispatchOptions: Record<string, unknown>, handler: unknown) {\n // Keep fetch's URL/body/header encoding and forward the remaining Undici\n // transport options to the caller's dispatcher without an npm dependency.\n const { dispatcher: _dispatcher, throwOnError: _throwOnError, maxRedirections: _maxRedirections, query: _query, ...transport } = requestOptions;\n return suppliedDispatcher.dispatch!({ ...transport, ...dispatchOptions }, handler);\n },\n };\n for (let redirects = 0; ; redirects += 1) {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const headersTimeout = requestOptions.headersTimeout ?? 300000;\n if (headersTimeout) { timer = setTimeout(() => controller.abort(timeoutError('Headers')), headersTimeout); timer.unref(); }\n try {\n if (dispatcher) {\n const init: RequestInit & { dispatcher?: unknown; duplex?: 'half' } = { method, headers, body: body as BodyInit | undefined, redirect: 'manual', signal, dispatcher };\n if (body != null && typeof body !== 'string') init.duplex = 'half';\n response = await fetch(current, init);\n } else response = await requestDocument(current, method, headers, body, requestOptions, signal);\n } catch (error) {\n throw signal.aborted ? signal.reason : error;\n } finally { if (timer) clearTimeout(timer); }\n const location = response.headers.get('location');\n if (![300, 301, 302, 303, 307, 308].includes(response.status) || !location) break;\n const rewriteToGet = response.status === 303 && method.toUpperCase() !== 'HEAD' || (response.status === 301 || response.status === 302) && method.toUpperCase() === 'POST';\n if (body instanceof Readable && body.readableDidRead && !rewriteToGet) break;\n await response.body?.cancel();\n if (redirects >= maxRedirects) throw new Error('max redirects reached');\n const next = new URL(location, current);\n headers.delete('host');\n if (response.status === 303) for (const name of [...headers.keys()]) if (name.startsWith('content-')) headers.delete(name);\n if (next.origin !== current.origin) {\n headers.delete('authorization');\n headers.delete('cookie');\n headers.delete('proxy-authorization');\n }\n if (rewriteToGet) {\n method = 'GET';\n body = undefined;\n headers.delete('content-length');\n headers.delete('content-type');\n }\n current = next;\n }\n if (!response.ok) {\n await response.body?.cancel();\n const error = new Error('Response Error') as Error & { statusCode: number; code: string; headers: Record<string, string | string[] | undefined> };\n error.name = 'ResponseError';\n error.statusCode = response.status;\n error.code = 'UND_ERR_RESPONSE';\n error.headers = response.rawHeaders ?? Object.fromEntries(response.headers);\n throw error;\n }\n const contentType = response.headers.get('content-type') ?? 'text/html';\n let parsedType: MIMEType;\n try { parsedType = new MIMEType(contentType); }\n catch {\n await response.body?.cancel();\n throw new Error(`Could not parse MIME type string \"${contentType}\"`);\n }\n const mime = parsedType.essence;\n const xml = (parsedType.type === 'application' || parsedType.type === 'text') && parsedType.subtype === 'xml' || parsedType.subtype.endsWith('+xml');\n if (mime !== 'text/html' && !xml) {\n await response.body?.cancel();\n throw new RangeError(`The content-type \"${mime}\" is neither HTML nor XML.`);\n }\n const charset = parsedType.params.get('charset') ?? undefined;\n if (encoding) encoding.transportLayerEncodingLabel = charset;\n const streamOptions: DecodeStreamOptions = {\n xmlMode: xml,\n baseURI: current,\n ...parserOptions,\n encoding: { ...encoding, transportLayerEncodingLabel: charset },\n };\n return new Promise<CheerioAPI>((resolve, reject) => {\n const parser = decodeStream(streamOptions, (error, document) => error ? reject(error) : resolve(document));\n const reader = response.body?.getReader();\n parser.once('error', (error) => { controller.abort(error); void reader?.cancel(error).catch(() => {}); });\n (async () => {\n let received = 0;\n const maxResponseSize = requestOptions.maxResponseSize;\n if (maxResponseSize != null && (typeof maxResponseSize !== 'number' || !Number.isSafeInteger(maxResponseSize) || maxResponseSize < -1)) throw new RangeError('maxResponseSize must be -1 or a non-negative integer');\n while (reader) {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const bodyTimeout = requestOptions.bodyTimeout ?? 300000;\n if (bodyTimeout) { timer = setTimeout(() => controller.abort(timeoutError('Body')), bodyTimeout); timer.unref(); }\n let chunk: ReadableStreamReadResult<Uint8Array>;\n try { chunk = await reader.read(); }\n catch (error) { throw controller.signal.aborted ? controller.signal.reason : error; }\n finally { if (timer) clearTimeout(timer); }\n if (chunk.done) break;\n received += chunk.value.byteLength;\n if (typeof maxResponseSize === 'number' && maxResponseSize >= 0 && received > maxResponseSize) {\n throw Object.assign(new Error('Response content exceeded maxResponseSize'), { name: 'ResponseExceededMaxSizeError', code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE' });\n }\n await new Promise<void>((resolve, reject) => parser.write(Buffer.from(chunk.value.buffer, chunk.value.byteOffset, chunk.value.byteLength), (error?: Error | null) => error ? reject(error) : resolve()));\n }\n parser.end();\n })().catch((error: Error) => { parser.destroy(error); reject(error); });\n });\n}\n"],"mappings":";;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAC3B,SAAS,SAAS,YAAY;AAC9B,SAAS,qBAAqB;;;ACE9B,IAAM,WAAW;AACjB,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,UAAMA,WAAqC,KAAK,MAAM,MAAM,QAAQ,iBAAiB,CAAC,GAAG,OAAO,GAAG,SAAS,SAAS,MAAM,KAAK,UAAU,IAAI,CAAC,CAAC;AAChJ,eAAW,UAAUA,SAAS,YAAW,SAAS,SAAS;AACzD,UAAI,CAAC,OAAO,OAAO,QAAQ,MAAM,GAAG,EAAG,QAAO,eAAe,QAAQ,MAAM,KAAK,EAAE,OAAO,MAAM,MAAM,CAAC,IAAI,QAAW,cAAc,MAAM,UAAU,MAAM,YAAY,KAAK,CAAC;AAC3K,UAAI,MAAM,OAAO,MAAM,QAAQ,OAAO,MAAM,GAAG,CAAC,EAAG,QAAO,MAAM,GAAG,IAAK,OAAO,MAAM,GAAG,EAAgB,OAAO,CAAC,UAAU,SAAS,IAAI;AAAA,IACzI;AACA,WAAOA;AAAA,EACT;AACA,QAAM,YAAY,MAAM,QAAQ,SAAS,EAAE,GAAG,MAAM,QAAQ,CAAC;AAC7D,QAAM,UAA6B,CAAC;AACpC,MAAI,YAAY,YAAY,IAAI;AAChC,aAAW,YAAY,WAAW;AAChC,YAAQ,MAAM,MAAM,qBAAqB,SAAS,KAAK,GAAG,GAAG,GAAG,KAAK;AACrE,QAAI,YAAY,IAAI,IAAI,aAAa,GAAG;AAAE,YAAM,iBAAiB;AAAG,kBAAY,YAAY,IAAI;AAAA,IAAG;AAAA,EACrG;AACA,SAAO;AACT;","names":["cached","wrapped","property","isDocument","require","children","attr","isDocument","parse","registryKey","globals","registry","data","group","children","values","node","children","data","entries","value","data","document","record","isDocument","document","children","parse","isDocument","property","isDocument","nodes","children","types","types","value","attributes","parserOptions","encoded","encoding","resolve","reject","initialize","dom","data","children","isDocument","results"]}
|