@gmb/bitmark-parser 6.1.3 → 6.1.4

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../../../node_modules/tsup/assets/cjs_shims.js","../src/generated/package_info.ts","../src/core/hooked-transform.ts","../src/core/parallel.ts","../src/node/pool.ts","../src/node/transform-parallel.ts"],"sourcesContent":["// @zen-component: WASM-TSBindings\n\nimport { createRequire } from \"node:module\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nimport { runHookedTransform, type HookedWasm } from \"./core/hooked-transform.js\";\nimport { runParallelTransform } from \"./node/transform-parallel.js\";\nimport type { LexOptions, ParseOptions, ConvertOptions, BreakscapeOptions, InfoOptions, NormalizeOptions, TransformOptions, BitSlice } from \"./types.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\nexport type { LexOptions, LexStage, ParseOptions, ConvertOptions, OutputMode, BreakscapeOptions, TextFormat, TextLocation, InfoOptions, InfoType, InfoFormat, InputFormat, OutputFormat, NormalizeOptions, TransformOptions, PatchOp, PatchEntry, BitSlice, BitView, PreHook, PostHook, PreHookResult } from \"./types.js\";\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param options - Lex options (e.g. `{ stage: \"lex\" }`).\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, options: LexOptions = {}): string {\n return wasm.lex(input, options.stage ?? \"lex\");\n}\n\n/**\n * Parse bitmark input text and return structured JSON entries.\n *\n * Each entry contains `bit`, `parser`, and `bitmark` fields.\n *\n * @param input - The bitmark source text.\n * @param options - Parse options (e.g. `{ mode: \"full\" }`).\n * @returns JSON string array of structured parsed entries.\n */\nexport function parse(input: string, options: ParseOptions = {}): string {\n return wasm.parse(input, options.mode ?? \"optimized\");\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param options - Convert options (e.g. `{ mode: \"full\", warnings: true }`).\n * @returns Converted output string. For bitmark input, this is a JSON string\n * array of structured parsed entries (`bit`, `parser`, `bitmark`).\n */\nexport function convert(input: string, options: ConvertOptions = {}): string {\n return wasm.convert(\n input,\n options.inputFormat ?? \"auto\",\n options.outputFormat ?? \"auto\",\n options.mode ?? \"optimized\",\n options.pretty ?? false,\n options.indent ?? 2,\n options.spacesAroundValues ?? 1,\n );\n}\n\n/**\n * Re-emit input in its own format at optimized mode.\n *\n * @param input - Input text (bitmark, JSON, or a markup format such as html/xml).\n * @param options - `inputFormat` selects the format (default: `\"auto\"`); the\n * output is re-emitted in that same format.\n * @returns Optimized output in the same format as the input.\n */\nexport function optimize(input: string, options: NormalizeOptions = {}): string {\n return wasm.optimize(input, options.inputFormat ?? \"auto\", options.pretty ?? false, options.indent ?? 2);\n}\n\n/**\n * Re-emit input in its own format at full mode (all keys). Aliased as\n * {@link expand}. `options.inputFormat` selects the format (default: `\"auto\"`).\n */\nexport function fullize(input: string, options: NormalizeOptions = {}): string {\n return wasm.fullize(input, options.inputFormat ?? \"auto\", options.pretty ?? false, options.indent ?? 2);\n}\n\n/** Alias of {@link fullize}. */\nexport const expand = fullize;\n\n/**\n * Re-emit input in its own format in canonical form. `options.inputFormat`\n * selects the format (default: `\"auto\"`).\n */\nexport function canonicalize(input: string, options: NormalizeOptions = {}): string {\n return wasm.canonicalize(\n input,\n options.inputFormat ?? \"auto\",\n options.mode ?? \"optimized\",\n options.pretty ?? false,\n options.indent ?? 2,\n options.spacesAroundValues ?? 1,\n );\n}\n\n/**\n * Count the bits in `input`, auto-detecting bitmark vs JSON.\n *\n * @throws If the input cannot be parsed.\n */\nexport function countBits(input: string): number {\n const out = wasm.count_bits(input);\n if (out.startsWith(\"error:\")) throw new Error(out);\n return Number.parseInt(out, 10);\n}\n\n/**\n * Split a bitmark document into per-bit source slices.\n *\n * @returns Array of `{ index, byteStart, byteEnd, source }`.\n */\nexport function splitBits(input: string): BitSlice[] {\n return JSON.parse(wasm.split_bits(input)) as BitSlice[];\n}\n\n/**\n * Transform a document bit-by-bit: apply an optional static `patch` and/or\n * per-bit `preHook`/`postHook`, then re-emit.\n *\n * With neither hook, the whole document is transformed in a single WASM pass\n * (the fast path). When a `preHook` or `postHook` is supplied, `transform`\n * drives the bits one at a time on the calling thread — the hook inspects each\n * bit, may return patches / an output-format override / `drop`, and only data\n * crosses into WASM. The patch may be an array of entries or a JSON string.\n *\n * @returns The transformed document, or an `error:`-prefixed string on failure.\n */\nexport function transform(input: string, options: TransformOptions = {}): string {\n if (options.preHook || options.postHook) {\n return runHookedTransform(wasm as unknown as HookedWasm, input, options);\n }\n const patchJson =\n options.patch === undefined\n ? \"\"\n : typeof options.patch === \"string\"\n ? options.patch\n : JSON.stringify(options.patch);\n return wasm.transform(\n input,\n options.inputFormat ?? \"auto\",\n options.outputFormat ?? \"json\",\n options.mode ?? \"optimized\",\n patchJson,\n options.pretty ?? false,\n options.indent ?? 2,\n options.spacesAroundValues ?? 1,\n );\n}\n\n/**\n * Parallel counterpart of {@link transform} (Node only). Fans the per-bit WASM\n * compute across a `worker_threads` pool (`options.workers`, default `4`),\n * while `preHook`/`postHook` still run on the calling thread. Output is\n * identical to {@link transform}; this trades startup cost for throughput on\n * large documents.\n *\n * @returns A Promise of the transformed document, or an `error:`-prefixed\n * string on failure.\n */\nexport function transformParallel(input: string, options: TransformOptions = {}): Promise<string> {\n return runParallelTransform(wasm as unknown as HookedWasm, input, options);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param options - Breakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param options - Unbreakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param options - Info options (e.g. `{ infoType: \"bit\", format: \"json\", bit: \"cloze\" }`).\n * @returns Information string.\n */\nexport function info(options: InfoOptions = {}): string {\n const infoType = options.infoType ?? \"list\";\n const format = options.format ?? \"text\";\n const bit = options.bit ?? \"\";\n const pretty = options.pretty ?? false;\n const indent = options.indent ?? 2;\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n\n/**\n * Generate bitmark text from a JSON AST.\n *\n * The reverse pipeline: `JSON → json_to_ast → AST → ast_to_bitmark`.\n *\n * @param input - JSON string of the parsed bit entries (forward output shape).\n * @param options - Generate options (e.g. `{ mode: \"full\" }`).\n * @returns Bitmark text. On failure, an `error:`-prefixed string.\n */\nexport function generate(input: string, options: ParseOptions = {}): string {\n return wasm.convert(input, \"json\", \"bitmark\", options.mode ?? \"optimized\", false, 2, 1);\n}\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"6.1.3\",\n \"author\": \"Get More Brain Ltd <info@getmorebrain.com>\",\n \"license\": \"ISC\",\n \"description\": \"A parser for bitmark text, powered by WebAssembly.\"\n};\n","// @zen-component: TS-HookedTransform\n\nimport type { BitView, OutputFormat, PatchEntry, TransformOptions } from \"../types.js\";\n\n/**\n * The minimal WASM surface the per-bit hook driver needs. Both the Node and\n * browser entry points satisfy this with their loaded module.\n */\nexport interface HookedWasm {\n is_bitmark(input: string): boolean;\n split_bits(input: string): string;\n split_json_bits(input: string): string;\n prettify(json: string, indent: number): string;\n transform(\n input: string,\n inputFormat: string,\n outputFormat: string,\n mode: string,\n patchJson: string,\n pretty: boolean,\n indent: number,\n spacesAroundValues: number,\n ): string;\n}\n\n/** A single bit's compute job: data only, safe to ship to a worker thread. */\nexport interface BitJob {\n index: number;\n source: string;\n inputFormat: \"bitmark\" | \"json\";\n outputFormat: OutputFormat;\n mode: string;\n patchJson: string;\n spacesAroundValues: number;\n}\n\n/**\n * The result of running `preHook` over a document's bits: the compute `jobs`\n * for the bits that survived (in document order) and the matching `views`\n * (so `postHook` can be called per surviving bit), plus the document-level\n * recombination settings.\n */\nexport interface TransformPlan {\n jobs: BitJob[];\n views: BitView[];\n output: OutputFormat;\n pretty: boolean;\n indent: number;\n}\n\nexport function isError(s: string): boolean {\n return s.startsWith(\"error:\");\n}\n\n/**\n * Normalise a thrown value to an `error:`-prefixed string, without\n * double-prefixing a message that already carries the prefix (split helpers\n * surface WASM `error:` strings as thrown `Error`s).\n */\nexport function errorString(e: unknown): string {\n const m = e instanceof Error ? e.message : String(e);\n return m.startsWith(\"error:\") ? m : `error: ${m}`;\n}\n\n/** Strip the outer `[ … ]` of a compact one-element JSON array. */\nexport function stripArray(doc: string): string {\n const t = doc.trim();\n return t.startsWith(\"[\") && t.endsWith(\"]\") ? t.slice(1, -1) : doc;\n}\n\nfunction normalisePatch(patch: TransformOptions[\"patch\"]): PatchEntry[] {\n if (patch === undefined) return [];\n if (typeof patch === \"string\") {\n const trimmed = patch.trim();\n return trimmed === \"\" ? [] : (JSON.parse(trimmed) as PatchEntry[]);\n }\n return patch;\n}\n\nfunction buildUnits(\n wasm: HookedWasm,\n input: string,\n inputIsBitmark: boolean,\n): { view: BitView; source: string }[] {\n if (inputIsBitmark) {\n const out = wasm.split_bits(input);\n if (isError(out)) throw new Error(out);\n const slices = JSON.parse(out) as { index: number; source: string }[];\n return slices.map((s) => ({\n view: { format: \"bitmark\", index: s.index, total: slices.length, source: s.source },\n source: s.source,\n }));\n }\n const out = wasm.split_json_bits(input);\n if (isError(out)) throw new Error(out);\n const envelopes = JSON.parse(out) as { bit?: unknown }[];\n return envelopes.map((env, index) => ({\n view: { format: \"json\", index, total: envelopes.length, bit: env.bit },\n // Per-bit transform consumes a one-bit JSON document.\n source: JSON.stringify([env]),\n }));\n}\n\n/**\n * Split the document and run `preHook` (on the calling thread) for each bit,\n * producing the surviving compute jobs + their views. This is the main-thread\n * half shared by the sync and worker-pool drivers — only the resulting\n * data-only {@link BitJob}s ever cross to a worker.\n */\nexport function planTransform(\n wasm: HookedWasm,\n input: string,\n options: TransformOptions,\n): TransformPlan {\n const mode = options.mode ?? \"optimized\";\n const output: OutputFormat = options.outputFormat ?? \"json\";\n const spacesAroundValues = options.spacesAroundValues ?? 1;\n const indent = options.indent ?? 2;\n const pretty = options.pretty ?? false;\n\n const sel = options.inputFormat ?? \"auto\";\n const inputIsBitmark = sel === \"bitmark\" || (sel !== \"json\" && wasm.is_bitmark(input));\n const inputFormat = inputIsBitmark ? \"bitmark\" : \"json\";\n\n const staticPatch = normalisePatch(options.patch);\n const units = buildUnits(wasm, input, inputIsBitmark);\n const total = units.length;\n\n const jobs: BitJob[] = [];\n const views: BitView[] = [];\n for (let index = 0; index < total; index++) {\n const { view, source } = units[index];\n view.index = index;\n view.total = total;\n\n const result = options.preHook ? options.preHook(view) || {} : {};\n if (result.drop) continue;\n\n const patches = result.patches ? [...staticPatch, ...result.patches] : staticPatch;\n jobs.push({\n index,\n source,\n inputFormat,\n outputFormat: result.outputFormat ?? output,\n mode,\n patchJson: JSON.stringify(patches),\n spacesAroundValues,\n });\n views.push(view);\n }\n return { jobs, views, output, pretty, indent };\n}\n\n/**\n * Compute one bit's rendered element synchronously via WASM. The per-bit\n * element is always compact JSON (the document is prettified once on\n * recombination). Returns an `error:`-prefixed string on failure.\n */\nexport function computeBit(wasm: HookedWasm, job: BitJob): string {\n const out = wasm.transform(\n job.source,\n job.inputFormat,\n job.outputFormat,\n job.mode,\n job.patchJson,\n false,\n 2,\n job.spacesAroundValues,\n );\n if (isError(out)) return out;\n return job.outputFormat === \"json\" ? stripArray(out) : out;\n}\n\n/** Recombine per-bit elements into the final document, in document order. */\nexport function recombine(\n wasm: HookedWasm,\n elements: string[],\n output: OutputFormat,\n pretty: boolean,\n indent: number,\n): string {\n // Bitmark and plain-text bits both join with newlines; only JSON wraps as an\n // array. (`text` is output-only, lossy plain-text extraction.)\n if (output === \"bitmark\" || output === \"text\") return elements.join(\"\\n\");\n const arr = `[${elements.join(\",\")}]`;\n return pretty ? wasm.prettify(arr, indent) : arr;\n}\n\n/**\n * Per-bit transform driver (synchronous, in-process): split the document, run\n * `preHook` for each bit on the calling thread, apply the static patch + any\n * hook patches, re-emit the bit, run `postHook`, then recombine in document\n * order.\n *\n * Hooks run synchronously on the calling thread; only data crosses into WASM.\n * Used when a `preHook`/`postHook` is supplied; the hookless path stays a\n * single `wasm.transform` call. Returns the document, or an `error:`-prefixed\n * string on failure.\n */\nexport function runHookedTransform(\n wasm: HookedWasm,\n input: string,\n options: TransformOptions,\n): string {\n let plan: TransformPlan;\n try {\n plan = planTransform(wasm, input, options);\n } catch (e) {\n return errorString(e);\n }\n\n const rendered: string[] = [];\n for (let i = 0; i < plan.jobs.length; i++) {\n const element = computeBit(wasm, plan.jobs[i]);\n if (isError(element)) return element;\n options.postHook?.(plan.views[i], element);\n rendered.push(element);\n }\n return recombine(wasm, rendered, plan.output, plan.pretty, plan.indent);\n}\n","// @zen-component: TS-ParallelOrchestrator\n\nimport type { TransformOptions } from \"../types.js\";\nimport { type BitJob, errorString, type HookedWasm, isError, planTransform, recombine } from \"./hooked-transform.js\";\n\n/**\n * A platform pool: compute `jobs` across up to `workers` workers, returning the\n * rendered element per job in submission order. Node and browser supply their\n * own (worker_threads / Worker); the orchestration around it is shared.\n */\nexport type RunJobs = (jobs: BitJob[], workers: number) => Promise<string[]>;\n\n/**\n * Shared parallel transform orchestration. The main-thread half — split +\n * `preHook` + recombine + `postHook` — is identical to the sync driver; only\n * the data-only per-bit jobs cross to `runJobs` (the platform pool). Closures\n * (`preHook`/`postHook`) never leave the calling thread.\n *\n * Returns the document, or an `error:`-prefixed string on failure.\n */\nexport async function orchestrateParallel(\n wasm: HookedWasm,\n input: string,\n options: TransformOptions,\n runJobs: RunJobs,\n): Promise<string> {\n let plan;\n try {\n plan = planTransform(wasm, input, options);\n } catch (e) {\n return errorString(e);\n }\n\n let elements: string[];\n try {\n elements = await runJobs(plan.jobs, options.workers ?? 4);\n } catch (e) {\n return errorString(e);\n }\n\n for (let i = 0; i < elements.length; i++) {\n if (isError(elements[i])) return elements[i];\n options.postHook?.(plan.views[i], elements[i]);\n }\n return recombine(wasm, elements, plan.output, plan.pretty, plan.indent);\n}\n","// @zen-component: TS-WorkerPool\n//\n// A fixed-size Node worker_threads pool that computes per-bit transform jobs in\n// parallel. Jobs are dispatched to idle workers; results are matched by id and\n// returned in submission order. The pool is short-lived (created per\n// transformParallel call) and terminated when all jobs settle.\n\nimport { fileURLToPath } from \"node:url\";\nimport { Worker } from \"node:worker_threads\";\nimport type { BitJob } from \"../core/hooked-transform.js\";\n\ninterface JobResult {\n ok: boolean;\n element?: string;\n error?: string;\n}\n\n// The worker entry is emitted as a sibling CJS file in dist/ (see tsup config),\n// so a CJS-format worker runs regardless of how the package itself was loaded.\nfunction workerPath(): string {\n return fileURLToPath(new URL(\"./worker-entry.cjs\", import.meta.url));\n}\n\n/**\n * Run `jobs` across up to `workers` worker threads, returning the rendered\n * element for each job in the **same order** as `jobs`. Rejects on the first\n * worker error or job error.\n */\nexport function runJobsParallel(jobs: BitJob[], workers: number): Promise<string[]> {\n if (jobs.length === 0) return Promise.resolve([]);\n const poolSize = Math.max(1, Math.min(workers, jobs.length));\n const path = workerPath();\n\n return new Promise<string[]>((resolve, reject) => {\n const results = new Array<string>(jobs.length);\n let next = 0;\n let settled = 0;\n let done = false;\n const pool: Worker[] = [];\n\n const shutdown = () => {\n for (const w of pool) void w.terminate();\n };\n const fail = (err: Error) => {\n if (done) return;\n done = true;\n shutdown();\n reject(err);\n };\n\n const dispatch = (w: Worker) => {\n if (done) return;\n if (next >= jobs.length) return; // no more work for this worker\n const id = next++;\n w.postMessage({ id, job: jobs[id] });\n };\n\n for (let i = 0; i < poolSize; i++) {\n const w = new Worker(path);\n pool.push(w);\n w.on(\"message\", (res: JobResult & { id: number }) => {\n if (done) return;\n if (!res.ok) {\n fail(new Error(res.error ?? \"worker job failed\"));\n return;\n }\n results[res.id] = res.element as string;\n settled++;\n if (settled === jobs.length) {\n done = true;\n shutdown();\n resolve(results);\n return;\n }\n dispatch(w);\n });\n w.on(\"error\", fail);\n w.on(\"exit\", (code) => {\n if (!done && code !== 0) fail(new Error(`worker exited with code ${code}`));\n });\n }\n\n // Prime each worker with one job.\n for (const w of pool) dispatch(w);\n });\n}\n","// @zen-component: TS-TransformParallel\n//\n// Node-only parallel transform: the main-thread half (split + preHook +\n// recombine + postHook) is shared with the synchronous driver and the browser\n// pool via orchestrateParallel; only the per-bit WASM compute is fanned out\n// across a worker_threads pool.\n\nimport { orchestrateParallel } from \"../core/parallel.js\";\nimport type { HookedWasm } from \"../core/hooked-transform.js\";\nimport type { TransformOptions } from \"../types.js\";\nimport { runJobsParallel } from \"./pool.js\";\n\n/**\n * Parallel counterpart of `transform` on Node. `preHook`/`postHook` run on the\n * calling thread; only data-only jobs cross to the worker_threads pool.\n */\nexport function runParallelTransform(\n wasm: HookedWasm,\n input: string,\n options: TransformOptions,\n): Promise<string> {\n return orchestrateParallel(wasm, input, options, runJobsParallel);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,cAAc,MACvB,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEtC,IAAM,gBAAgC,iCAAiB;;;ADV9D,yBAA8B;;;AEEvB,IAAM,eAAe;AAAA,EAC1B,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,WAAW;AAAA,EACX,eAAe;AACjB;;;ACwCO,SAAS,QAAQ,GAAoB;AAC1C,SAAO,EAAE,WAAW,QAAQ;AAC9B;AAOO,SAAS,YAAY,GAAoB;AAC9C,QAAM,IAAI,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC;AACnD,SAAO,EAAE,WAAW,QAAQ,IAAI,IAAI,UAAU,CAAC;AACjD;AAGO,SAAS,WAAW,KAAqB;AAC9C,QAAM,IAAI,IAAI,KAAK;AACnB,SAAO,EAAE,WAAW,GAAG,KAAK,EAAE,SAAS,GAAG,IAAI,EAAE,MAAM,GAAG,EAAE,IAAI;AACjE;AAEA,SAAS,eAAe,OAAgD;AACtE,MAAI,UAAU,OAAW,QAAO,CAAC;AACjC,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,UAAU,MAAM,KAAK;AAC3B,WAAO,YAAY,KAAK,CAAC,IAAK,KAAK,MAAM,OAAO;AAAA,EAClD;AACA,SAAO;AACT;AAEA,SAAS,WACPA,OACA,OACA,gBACqC;AACrC,MAAI,gBAAgB;AAClB,UAAMC,OAAMD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","wasm","wasm","require"]}
1
+ {"version":3,"sources":["../src/index.ts","../../../node_modules/tsup/assets/cjs_shims.js","../src/generated/package_info.ts","../src/core/hooked-transform.ts","../src/core/parallel.ts","../src/node/pool.ts","../src/node/transform-parallel.ts","../src/node/legacy-init.ts","../src/legacy/runtime.ts","../src/legacy/index.ts","../src/legacy/errors.ts","../src/legacy/translate.ts","../src/legacy/pseudo-ast.ts","../src/legacy/builder.ts","../src/legacy/bpg-class.ts","../src/legacy/resource-builder.ts","../src/legacy/options.ts","../src/legacy/enums-extra.ts","../src/legacy/stubs.ts"],"sourcesContent":["// @zen-component: WASM-TSBindings\n\nimport { createRequire } from \"node:module\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nimport { runHookedTransform, type HookedWasm } from \"./core/hooked-transform.js\";\nimport { runParallelTransform } from \"./node/transform-parallel.js\";\nimport type { LexOptions, ParseOptions, ConvertOptions, BreakscapeOptions, InfoOptions, NormalizeOptions, TransformOptions, BitSlice } from \"./types.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\n// Legacy (bpg-compatible) API — namespaced, never merged into the root surface\nimport { initLegacyNode } from \"./node/legacy-init.js\";\ninitLegacyNode(wasm);\nexport * as legacy from \"./legacy/index.js\";\n\nexport type { LexOptions, LexStage, ParseOptions, ConvertOptions, OutputMode, BreakscapeOptions, TextFormat, TextLocation, InfoOptions, InfoType, InfoFormat, InputFormat, OutputFormat, NormalizeOptions, TransformOptions, PatchOp, PatchEntry, BitSlice, BitView, PreHook, PostHook, PreHookResult } from \"./types.js\";\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param options - Lex options (e.g. `{ stage: \"lex\" }`).\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, options: LexOptions = {}): string {\n return wasm.lex(input, options.stage ?? \"lex\");\n}\n\n/**\n * Parse bitmark input text and return structured JSON entries.\n *\n * Each entry contains `bit`, `parser`, and `bitmark` fields.\n *\n * @param input - The bitmark source text.\n * @param options - Parse options (e.g. `{ mode: \"full\" }`).\n * @returns JSON string array of structured parsed entries.\n */\nexport function parse(input: string, options: ParseOptions = {}): string {\n return wasm.parse(input, options.mode ?? \"optimized\");\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param options - Convert options (e.g. `{ mode: \"full\", warnings: true }`).\n * @returns Converted output string. For bitmark input, this is a JSON string\n * array of structured parsed entries (`bit`, `parser`, `bitmark`).\n */\nexport function convert(input: string, options: ConvertOptions = {}): string {\n return wasm.convert(\n input,\n options.inputFormat ?? \"auto\",\n options.outputFormat ?? \"auto\",\n options.mode ?? \"optimized\",\n options.pretty ?? false,\n options.indent ?? 2,\n options.spacesAroundValues ?? 1,\n );\n}\n\n/**\n * Re-emit input in its own format at optimized mode.\n *\n * @param input - Input text (bitmark, JSON, or a markup format such as html/xml).\n * @param options - `inputFormat` selects the format (default: `\"auto\"`); the\n * output is re-emitted in that same format.\n * @returns Optimized output in the same format as the input.\n */\nexport function optimize(input: string, options: NormalizeOptions = {}): string {\n return wasm.optimize(input, options.inputFormat ?? \"auto\", options.pretty ?? false, options.indent ?? 2);\n}\n\n/**\n * Re-emit input in its own format at full mode (all keys). Aliased as\n * {@link expand}. `options.inputFormat` selects the format (default: `\"auto\"`).\n */\nexport function fullize(input: string, options: NormalizeOptions = {}): string {\n return wasm.fullize(input, options.inputFormat ?? \"auto\", options.pretty ?? false, options.indent ?? 2);\n}\n\n/** Alias of {@link fullize}. */\nexport const expand = fullize;\n\n/**\n * Re-emit input in its own format in canonical form. `options.inputFormat`\n * selects the format (default: `\"auto\"`).\n */\nexport function canonicalize(input: string, options: NormalizeOptions = {}): string {\n return wasm.canonicalize(\n input,\n options.inputFormat ?? \"auto\",\n options.mode ?? \"optimized\",\n options.pretty ?? false,\n options.indent ?? 2,\n options.spacesAroundValues ?? 1,\n );\n}\n\n/**\n * Count the bits in `input`, auto-detecting bitmark vs JSON.\n *\n * @throws If the input cannot be parsed.\n */\nexport function countBits(input: string): number {\n const out = wasm.count_bits(input);\n if (out.startsWith(\"error:\")) throw new Error(out);\n return Number.parseInt(out, 10);\n}\n\n/**\n * Split a bitmark document into per-bit source slices.\n *\n * @returns Array of `{ index, byteStart, byteEnd, source }`.\n */\nexport function splitBits(input: string): BitSlice[] {\n return JSON.parse(wasm.split_bits(input)) as BitSlice[];\n}\n\n/**\n * Transform a document bit-by-bit: apply an optional static `patch` and/or\n * per-bit `preHook`/`postHook`, then re-emit.\n *\n * With neither hook, the whole document is transformed in a single WASM pass\n * (the fast path). When a `preHook` or `postHook` is supplied, `transform`\n * drives the bits one at a time on the calling thread — the hook inspects each\n * bit, may return patches / an output-format override / `drop`, and only data\n * crosses into WASM. The patch may be an array of entries or a JSON string.\n *\n * @returns The transformed document, or an `error:`-prefixed string on failure.\n */\nexport function transform(input: string, options: TransformOptions = {}): string {\n if (options.preHook || options.postHook) {\n return runHookedTransform(wasm as unknown as HookedWasm, input, options);\n }\n const patchJson =\n options.patch === undefined\n ? \"\"\n : typeof options.patch === \"string\"\n ? options.patch\n : JSON.stringify(options.patch);\n return wasm.transform(\n input,\n options.inputFormat ?? \"auto\",\n options.outputFormat ?? \"json\",\n options.mode ?? \"optimized\",\n patchJson,\n options.pretty ?? false,\n options.indent ?? 2,\n options.spacesAroundValues ?? 1,\n );\n}\n\n/**\n * Parallel counterpart of {@link transform} (Node only). Fans the per-bit WASM\n * compute across a `worker_threads` pool (`options.workers`, default `4`),\n * while `preHook`/`postHook` still run on the calling thread. Output is\n * identical to {@link transform}; this trades startup cost for throughput on\n * large documents.\n *\n * @returns A Promise of the transformed document, or an `error:`-prefixed\n * string on failure.\n */\nexport function transformParallel(input: string, options: TransformOptions = {}): Promise<string> {\n return runParallelTransform(wasm as unknown as HookedWasm, input, options);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param options - Breakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param options - Unbreakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param options - Info options (e.g. `{ infoType: \"bit\", format: \"json\", bit: \"cloze\" }`).\n * @returns Information string.\n */\nexport function info(options: InfoOptions = {}): string {\n const infoType = options.infoType ?? \"list\";\n const format = options.format ?? \"text\";\n const bit = options.bit ?? \"\";\n const pretty = options.pretty ?? false;\n const indent = options.indent ?? 2;\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n\n/**\n * Generate bitmark text from a JSON AST.\n *\n * The reverse pipeline: `JSON → json_to_ast → AST → ast_to_bitmark`.\n *\n * @param input - JSON string of the parsed bit entries (forward output shape).\n * @param options - Generate options (e.g. `{ mode: \"full\" }`).\n * @returns Bitmark text. On failure, an `error:`-prefixed string.\n */\nexport function generate(input: string, options: ParseOptions = {}): string {\n return wasm.convert(input, \"json\", \"bitmark\", options.mode ?? \"optimized\", false, 2, 1);\n}\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"6.1.4\",\n \"author\": \"Get More Brain Ltd <info@getmorebrain.com>\",\n \"license\": \"ISC\",\n \"description\": \"A parser for bitmark text, powered by WebAssembly.\"\n};\n","// @zen-component: TS-HookedTransform\n\nimport type { BitView, OutputFormat, PatchEntry, TransformOptions } from \"../types.js\";\n\n/**\n * The minimal WASM surface the per-bit hook driver needs. Both the Node and\n * browser entry points satisfy this with their loaded module.\n */\nexport interface HookedWasm {\n is_bitmark(input: string): boolean;\n split_bits(input: string): string;\n split_json_bits(input: string): string;\n prettify(json: string, indent: number): string;\n transform(\n input: string,\n inputFormat: string,\n outputFormat: string,\n mode: string,\n patchJson: string,\n pretty: boolean,\n indent: number,\n spacesAroundValues: number,\n ): string;\n}\n\n/** A single bit's compute job: data only, safe to ship to a worker thread. */\nexport interface BitJob {\n index: number;\n source: string;\n inputFormat: \"bitmark\" | \"json\";\n outputFormat: OutputFormat;\n mode: string;\n patchJson: string;\n spacesAroundValues: number;\n}\n\n/**\n * The result of running `preHook` over a document's bits: the compute `jobs`\n * for the bits that survived (in document order) and the matching `views`\n * (so `postHook` can be called per surviving bit), plus the document-level\n * recombination settings.\n */\nexport interface TransformPlan {\n jobs: BitJob[];\n views: BitView[];\n output: OutputFormat;\n pretty: boolean;\n indent: number;\n}\n\nexport function isError(s: string): boolean {\n return s.startsWith(\"error:\");\n}\n\n/**\n * Normalise a thrown value to an `error:`-prefixed string, without\n * double-prefixing a message that already carries the prefix (split helpers\n * surface WASM `error:` strings as thrown `Error`s).\n */\nexport function errorString(e: unknown): string {\n const m = e instanceof Error ? e.message : String(e);\n return m.startsWith(\"error:\") ? m : `error: ${m}`;\n}\n\n/** Strip the outer `[ … ]` of a compact one-element JSON array. */\nexport function stripArray(doc: string): string {\n const t = doc.trim();\n return t.startsWith(\"[\") && t.endsWith(\"]\") ? t.slice(1, -1) : doc;\n}\n\nfunction normalisePatch(patch: TransformOptions[\"patch\"]): PatchEntry[] {\n if (patch === undefined) return [];\n if (typeof patch === \"string\") {\n const trimmed = patch.trim();\n return trimmed === \"\" ? [] : (JSON.parse(trimmed) as PatchEntry[]);\n }\n return patch;\n}\n\nfunction buildUnits(\n wasm: HookedWasm,\n input: string,\n inputIsBitmark: boolean,\n): { view: BitView; source: string }[] {\n if (inputIsBitmark) {\n const out = wasm.split_bits(input);\n if (isError(out)) throw new Error(out);\n const slices = JSON.parse(out) as { index: number; source: string }[];\n return slices.map((s) => ({\n view: { format: \"bitmark\", index: s.index, total: slices.length, source: s.source },\n source: s.source,\n }));\n }\n const out = wasm.split_json_bits(input);\n if (isError(out)) throw new Error(out);\n const envelopes = JSON.parse(out) as { bit?: unknown }[];\n return envelopes.map((env, index) => ({\n view: { format: \"json\", index, total: envelopes.length, bit: env.bit },\n // Per-bit transform consumes a one-bit JSON document.\n source: JSON.stringify([env]),\n }));\n}\n\n/**\n * Split the document and run `preHook` (on the calling thread) for each bit,\n * producing the surviving compute jobs + their views. This is the main-thread\n * half shared by the sync and worker-pool drivers — only the resulting\n * data-only {@link BitJob}s ever cross to a worker.\n */\nexport function planTransform(\n wasm: HookedWasm,\n input: string,\n options: TransformOptions,\n): TransformPlan {\n const mode = options.mode ?? \"optimized\";\n const output: OutputFormat = options.outputFormat ?? \"json\";\n const spacesAroundValues = options.spacesAroundValues ?? 1;\n const indent = options.indent ?? 2;\n const pretty = options.pretty ?? false;\n\n const sel = options.inputFormat ?? \"auto\";\n const inputIsBitmark = sel === \"bitmark\" || (sel !== \"json\" && wasm.is_bitmark(input));\n const inputFormat = inputIsBitmark ? \"bitmark\" : \"json\";\n\n const staticPatch = normalisePatch(options.patch);\n const units = buildUnits(wasm, input, inputIsBitmark);\n const total = units.length;\n\n const jobs: BitJob[] = [];\n const views: BitView[] = [];\n for (let index = 0; index < total; index++) {\n const { view, source } = units[index];\n view.index = index;\n view.total = total;\n\n const result = options.preHook ? options.preHook(view) || {} : {};\n if (result.drop) continue;\n\n const patches = result.patches ? [...staticPatch, ...result.patches] : staticPatch;\n jobs.push({\n index,\n source,\n inputFormat,\n outputFormat: result.outputFormat ?? output,\n mode,\n patchJson: JSON.stringify(patches),\n spacesAroundValues,\n });\n views.push(view);\n }\n return { jobs, views, output, pretty, indent };\n}\n\n/**\n * Compute one bit's rendered element synchronously via WASM. The per-bit\n * element is always compact JSON (the document is prettified once on\n * recombination). Returns an `error:`-prefixed string on failure.\n */\nexport function computeBit(wasm: HookedWasm, job: BitJob): string {\n const out = wasm.transform(\n job.source,\n job.inputFormat,\n job.outputFormat,\n job.mode,\n job.patchJson,\n false,\n 2,\n job.spacesAroundValues,\n );\n if (isError(out)) return out;\n return job.outputFormat === \"json\" ? stripArray(out) : out;\n}\n\n/** Recombine per-bit elements into the final document, in document order. */\nexport function recombine(\n wasm: HookedWasm,\n elements: string[],\n output: OutputFormat,\n pretty: boolean,\n indent: number,\n): string {\n // Bitmark and plain-text bits both join with newlines; only JSON wraps as an\n // array. (`text` is output-only, lossy plain-text extraction.)\n if (output === \"bitmark\" || output === \"text\") return elements.join(\"\\n\");\n const arr = `[${elements.join(\",\")}]`;\n return pretty ? wasm.prettify(arr, indent) : arr;\n}\n\n/**\n * Per-bit transform driver (synchronous, in-process): split the document, run\n * `preHook` for each bit on the calling thread, apply the static patch + any\n * hook patches, re-emit the bit, run `postHook`, then recombine in document\n * order.\n *\n * Hooks run synchronously on the calling thread; only data crosses into WASM.\n * Used when a `preHook`/`postHook` is supplied; the hookless path stays a\n * single `wasm.transform` call. Returns the document, or an `error:`-prefixed\n * string on failure.\n */\nexport function runHookedTransform(\n wasm: HookedWasm,\n input: string,\n options: TransformOptions,\n): string {\n let plan: TransformPlan;\n try {\n plan = planTransform(wasm, input, options);\n } catch (e) {\n return errorString(e);\n }\n\n const rendered: string[] = [];\n for (let i = 0; i < plan.jobs.length; i++) {\n const element = computeBit(wasm, plan.jobs[i]);\n if (isError(element)) return element;\n options.postHook?.(plan.views[i], element);\n rendered.push(element);\n }\n return recombine(wasm, rendered, plan.output, plan.pretty, plan.indent);\n}\n","// @zen-component: TS-ParallelOrchestrator\n\nimport type { TransformOptions } from \"../types.js\";\nimport { type BitJob, errorString, type HookedWasm, isError, planTransform, recombine } from \"./hooked-transform.js\";\n\n/**\n * A platform pool: compute `jobs` across up to `workers` workers, returning the\n * rendered element per job in submission order. Node and browser supply their\n * own (worker_threads / Worker); the orchestration around it is shared.\n */\nexport type RunJobs = (jobs: BitJob[], workers: number) => Promise<string[]>;\n\n/**\n * Shared parallel transform orchestration. The main-thread half — split +\n * `preHook` + recombine + `postHook` — is identical to the sync driver; only\n * the data-only per-bit jobs cross to `runJobs` (the platform pool). Closures\n * (`preHook`/`postHook`) never leave the calling thread.\n *\n * Returns the document, or an `error:`-prefixed string on failure.\n */\nexport async function orchestrateParallel(\n wasm: HookedWasm,\n input: string,\n options: TransformOptions,\n runJobs: RunJobs,\n): Promise<string> {\n let plan;\n try {\n plan = planTransform(wasm, input, options);\n } catch (e) {\n return errorString(e);\n }\n\n let elements: string[];\n try {\n elements = await runJobs(plan.jobs, options.workers ?? 4);\n } catch (e) {\n return errorString(e);\n }\n\n for (let i = 0; i < elements.length; i++) {\n if (isError(elements[i])) return elements[i];\n options.postHook?.(plan.views[i], elements[i]);\n }\n return recombine(wasm, elements, plan.output, plan.pretty, plan.indent);\n}\n","// @zen-component: TS-WorkerPool\n//\n// A fixed-size Node worker_threads pool that computes per-bit transform jobs in\n// parallel. Jobs are dispatched to idle workers; results are matched by id and\n// returned in submission order. The pool is short-lived (created per\n// transformParallel call) and terminated when all jobs settle.\n\nimport { fileURLToPath } from \"node:url\";\nimport { Worker } from \"node:worker_threads\";\nimport type { BitJob } from \"../core/hooked-transform.js\";\n\ninterface JobResult {\n ok: boolean;\n element?: string;\n error?: string;\n}\n\n// The worker entry is emitted as a sibling CJS file in dist/ (see tsup config),\n// so a CJS-format worker runs regardless of how the package itself was loaded.\nfunction workerPath(): string {\n return fileURLToPath(new URL(\"./worker-entry.cjs\", import.meta.url));\n}\n\n/**\n * Run `jobs` across up to `workers` worker threads, returning the rendered\n * element for each job in the **same order** as `jobs`. Rejects on the first\n * worker error or job error.\n */\nexport function runJobsParallel(jobs: BitJob[], workers: number): Promise<string[]> {\n if (jobs.length === 0) return Promise.resolve([]);\n const poolSize = Math.max(1, Math.min(workers, jobs.length));\n const path = workerPath();\n\n return new Promise<string[]>((resolve, reject) => {\n const results = new Array<string>(jobs.length);\n let next = 0;\n let settled = 0;\n let done = false;\n const pool: Worker[] = [];\n\n const shutdown = () => {\n for (const w of pool) void w.terminate();\n };\n const fail = (err: Error) => {\n if (done) return;\n done = true;\n shutdown();\n reject(err);\n };\n\n const dispatch = (w: Worker) => {\n if (done) return;\n if (next >= jobs.length) return; // no more work for this worker\n const id = next++;\n w.postMessage({ id, job: jobs[id] });\n };\n\n for (let i = 0; i < poolSize; i++) {\n const w = new Worker(path);\n pool.push(w);\n w.on(\"message\", (res: JobResult & { id: number }) => {\n if (done) return;\n if (!res.ok) {\n fail(new Error(res.error ?? \"worker job failed\"));\n return;\n }\n results[res.id] = res.element as string;\n settled++;\n if (settled === jobs.length) {\n done = true;\n shutdown();\n resolve(results);\n return;\n }\n dispatch(w);\n });\n w.on(\"error\", fail);\n w.on(\"exit\", (code) => {\n if (!done && code !== 0) fail(new Error(`worker exited with code ${code}`));\n });\n }\n\n // Prime each worker with one job.\n for (const w of pool) dispatch(w);\n });\n}\n","// @zen-component: TS-TransformParallel\n//\n// Node-only parallel transform: the main-thread half (split + preHook +\n// recombine + postHook) is shared with the synchronous driver and the browser\n// pool via orchestrateParallel; only the per-bit WASM compute is fanned out\n// across a worker_threads pool.\n\nimport { orchestrateParallel } from \"../core/parallel.js\";\nimport type { HookedWasm } from \"../core/hooked-transform.js\";\nimport type { TransformOptions } from \"../types.js\";\nimport { runJobsParallel } from \"./pool.js\";\n\n/**\n * Parallel counterpart of `transform` on Node. `preHook`/`postHook` run on the\n * calling thread; only data-only jobs cross to the worker_threads pool.\n */\nexport function runParallelTransform(\n wasm: HookedWasm,\n input: string,\n options: TransformOptions,\n): Promise<string> {\n return orchestrateParallel(wasm, input, options, runJobsParallel);\n}\n","// @zen-component: LEGACY-Facade\n// Node platform wiring for the legacy facade: provides the WASM module and\n// real file I/O (PLAN-126 F-5). The browser entry provides WASM only.\n\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { setLegacyFileIo, setLegacyWasm, type LegacyWasm } from \"../legacy/runtime.js\";\n\nexport function initLegacyNode(wasm: LegacyWasm): void {\n setLegacyWasm(wasm);\n setLegacyFileIo({\n existsSync: (p) => fs.existsSync(p),\n readFileSync: (p, encoding) => fs.readFileSync(p, { encoding: encoding as BufferEncoding }),\n writeFile: (p, data, opts) => {\n fs.mkdirSync(path.dirname(p), { recursive: true });\n fs.writeFileSync(p, data, {\n encoding: (opts.encoding ?? \"utf8\") as BufferEncoding,\n flag: opts.append ? \"a\" : \"w\",\n });\n },\n });\n}\n","// @zen-component: LEGACY-Facade\n// Platform injection for the legacy facade. The Node and browser entries\n// provide the WASM module (and, on Node, file I/O) before exposing the\n// `legacy` namespace — the facade itself stays platform-free.\n\n/** The subset of the WASM surface the legacy facade drives. */\nexport interface LegacyWasm {\n convert(\n input: string,\n inputFormat: string,\n outputFormat: string,\n mode: string,\n pretty: boolean,\n indent: number,\n spacesAroundValues: number,\n ): string;\n canonicalize(\n input: string,\n inputFormat: string,\n mode: string,\n pretty: boolean,\n indent: number,\n spacesAroundValues: number,\n ): string;\n breakscape_text(input: string, format: string, location: string): string;\n unbreakscape_text(input: string, format: string, location: string): string;\n info(infoType: string, format: string, bit: string, pretty: boolean, indent: number): string;\n is_bitmark(input: string): boolean;\n prettify(json: string, indent: number): string;\n convert_text(input: string, direction: string, format: string, location: string): string;\n}\n\nlet wasmModule: LegacyWasm | undefined;\n\nexport function setLegacyWasm(wasm: LegacyWasm): void {\n wasmModule = wasm;\n}\n\nexport function getLegacyWasm(): LegacyWasm {\n if (!wasmModule) {\n throw new Error(\n \"legacy API not initialised: the WASM module has not been provided (browser consumers must call init() first)\",\n );\n }\n return wasmModule;\n}\n\n/** Node file I/O, injected by the Node entry only (PLAN-126 F-5). */\nexport interface LegacyFileIo {\n existsSync(path: string): boolean;\n readFileSync(path: string, encoding: string): string;\n /** Write (or append) `data`, creating parent directories as needed. */\n writeFile(path: string, data: string, opts: { append?: boolean; encoding?: string }): void;\n}\n\nlet fileIo: LegacyFileIo | undefined;\n\nexport function setLegacyFileIo(io: LegacyFileIo): void {\n fileIo = io;\n}\n\n/** Returns undefined in the browser (no file I/O). */\nexport function getLegacyFileIo(): LegacyFileIo | undefined {\n return fileIo;\n}\n","// @zen-component: LEGACY-Facade\n// The `legacy` namespace: a bpg-compatible (bitmark-parser-generator\n// v5.31.1) programmatic interface over the WASM core (PLAN-126).\n//\n// Everything here is exposed ONLY via `legacy.*` / the\n// `@gmb/bitmark-parser/legacy` subpath — nothing is re-exported at the\n// package root (reserved for the modern API and its future generated types).\n\nexport { BitmarkParserGenerator, bitmarkTextParse } from \"./bpg-class.js\";\nexport { Builder, type BuildBitOptions } from \"./builder.js\";\nexport { ResourceBuilder } from \"./resource-builder.js\";\nexport { LegacyUnsupportedError } from \"./errors.js\";\nexport { isPseudoAst, type LegacyPseudoAst } from \"./pseudo-ast.js\";\n\n// Enum objects + option interfaces (vendored shapes)\nexport * from \"./options.js\";\nexport { BitType, BoundingBoxIndex, NodeType, TextMarkType, TextNodeType } from \"./enums-extra.js\";\n\n// Unsupported bpg internals — present but throwing (PLAN-126 F-2)\nexport {\n Ast,\n BitmarkFileGenerator,\n BitmarkGenerator,\n BitmarkParser,\n BitmarkStringGenerator,\n FileWriter,\n HtmlTableGenerator,\n HtmlTableParser,\n JsonFileGenerator,\n JsonGenerator,\n JsonParser,\n JsonStringGenerator,\n StreamWriter,\n StringWriter,\n} from \"./stubs.js\";\n\n// Vendored bpg JSON model / text-node types (type-only)\nexport type * from \"./vendor/BitJson.js\";\nexport type * from \"./vendor/BitWrapperJson.js\";\nexport type * from \"./vendor/BodyBitJson.js\";\nexport type * from \"./vendor/ParserJson.js\";\nexport type * from \"./vendor/ResourceJson.js\";\nexport type * from \"./vendor/TextNodes.js\";\nexport type {\n ParserError,\n ParserInfo,\n ParserLocation,\n BitTypeType,\n TextFormatType,\n ResourceTypeType,\n TextMarkTypeType,\n TextNodeTypeType,\n} from \"./vendor/enums.js\";\n","// @zen-component: LEGACY-Facade\n\n/** Error thrown for bpg API members / options the legacy facade does not support. */\nexport class LegacyUnsupportedError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"LegacyUnsupportedError\";\n }\n}\n\n/** Throw for a bpg API member that is not supported (PLAN-126 F-2). */\nexport function unsupportedMember(member: string, reason?: string): never {\n throw new LegacyUnsupportedError(\n `'${member}' is not supported by the @gmb/bitmark-parser legacy API` + (reason ? `: ${reason}` : \"\"),\n );\n}\n\n/** Throw for an option that cannot be honoured (PLAN-126 F-9: never silently ignore). */\nexport function unsupportedOption(option: string, reason?: string): never {\n throw new LegacyUnsupportedError(\n `Option '${option}' is not supported by the @gmb/bitmark-parser legacy API` +\n (reason ? `: ${reason}` : \"\"),\n );\n}\n","// @zen-component: LEGACY-Facade\n// Central bpg-option → core-parameter translation table (PLAN-126 F-4/F-9).\n// Strict policy: options that map are honoured; options we cannot honour\n// throw a LegacyUnsupportedError naming the option. Sole exception:\n// `bitmarkParserType` is accepted and ignored — bpg v5.31.1 itself hardcodes\n// the peggy parser and ignores the option.\n\nimport { unsupportedOption } from \"./errors.js\";\nimport type { BitmarkOptions, JsonOptions } from \"./options.js\";\n\nconst V3_ONLY = \"bitmark v2 output is not supported (this parser is bitmark v3 only)\";\n\nexport function validateVersionOptions(opts: {\n bitmarkVersion?: number;\n bitmarkParserType?: string;\n}): void {\n if (opts.bitmarkVersion === 2) unsupportedOption(\"bitmarkVersion: 2\", V3_ONLY);\n // bitmarkParserType: accepted + ignored (documented exception).\n}\n\nexport function validateBitmarkOptions(o: BitmarkOptions): void {\n // Booleans error only when set truthy (false === bpg default behaviour).\n if (o.explicitTextFormat) unsupportedOption(\"bitmarkOptions.explicitTextFormat\");\n if (o.prettifyJson !== undefined && o.prettifyJson !== false) {\n unsupportedOption(\"bitmarkOptions.prettifyJson\", \"embedded-JSON body prettification is not supported\");\n }\n if (o.cardSetVersion === 1) unsupportedOption(\"bitmarkOptions.cardSetVersion: 1\", V3_ONLY);\n if (o.debugGenerationInline) unsupportedOption(\"bitmarkOptions.debugGenerationInline\");\n if (o.noBreakscaping) unsupportedOption(\"bitmarkOptions.noBreakscaping\");\n}\n\nexport function validateJsonOptions(o: JsonOptions): void {\n if (o.textAsPlainText) unsupportedOption(\"jsonOptions.textAsPlainText\", V3_ONLY);\n if (o.excludeUnknownProperties) unsupportedOption(\"jsonOptions.excludeUnknownProperties\");\n if (o.debugGenerationInline) unsupportedOption(\"jsonOptions.debugGenerationInline\");\n // enableWarnings: accepted — parser warnings are always carried in the\n // output envelope by this parser, so both values are honoured trivially.\n}\n\n/** bpg `prettify?: boolean | number` → core (pretty, indent). */\nexport function prettyIndent(prettify: boolean | number | undefined): {\n pretty: boolean;\n indent: number;\n} {\n if (prettify === true) return { pretty: true, indent: 2 };\n if (typeof prettify === \"number\" && prettify > 0) return { pretty: true, indent: prettify };\n return { pretty: false, indent: 2 };\n}\n\n/** bpg `spacesAroundValues?: number | boolean` → core spaces count (cap 10, as bpg). */\nexport function spacesAround(v: number | boolean | undefined): number {\n if (v === undefined || v === true) return 1;\n if (v === false) return 0;\n return Math.max(0, Math.min(10, v));\n}\n\n/**\n * bpg text format value → core breakscape format.\n * bpg maps `latex`/`json`/`xml` as aliases of plain text, and defaults\n * anything else (including absent) to bitmark text (`bitmark++`).\n */\nexport function mapTextFormat(f: string | undefined): \"bitmark++\" | \"plainText\" {\n switch (f) {\n case \"text\":\n case \"latex\":\n case \"json\":\n case \"xml\":\n return \"plainText\";\n default:\n return \"bitmark++\";\n }\n}\n","// @zen-component: LEGACY-Facade\n// The legacy \"AST\" is bit JSON (PLAN-126 §3.1): an envelope of the parser's\n// wrapper entries (`{ bit, parser?, bitmark? }`), tagged with a\n// non-enumerable marker so it can be recognised without surviving\n// JSON.stringify. It round-trips through `convert`, but is NOT bpg's\n// internal TS AST node model (no `cardNode` / `BodyPart[]` structure).\n\nexport const PSEUDO_AST_MARKER = Symbol.for(\"@gmb/bitmark-parser/legacy-pseudo-ast\");\n\nexport interface LegacyPseudoAst {\n bits: unknown[];\n}\n\nexport function makePseudoAst(bits: unknown[]): LegacyPseudoAst {\n const ast: LegacyPseudoAst = { bits };\n Object.defineProperty(ast, PSEUDO_AST_MARKER, { value: true, enumerable: false });\n return ast;\n}\n\nexport function isPseudoAst(v: unknown): v is LegacyPseudoAst {\n return (\n v !== null &&\n typeof v === \"object\" &&\n (PSEUDO_AST_MARKER in v || Array.isArray((v as LegacyPseudoAst).bits))\n );\n}\n","// @zen-component: LEGACY-Facade\n// bpg-compatible `Builder` (PLAN-126 §3.1): the legacy AST is bit JSON, so\n// building a bit is a data *mapping* (bpg buildBit data → bit JSON keys)\n// followed by one WASM json→json normalization pass — the config-driven core\n// performs the defaulting/coercion/validation that bpg's ~4.2k-line builder\n// does in TS. No parsing logic lives here.\n\nimport { getLegacyWasm } from \"./runtime.js\";\nimport { makePseudoAst, type LegacyPseudoAst } from \"./pseudo-ast.js\";\nimport type { ParserError, ParserInfo } from \"./vendor/enums.js\";\n\n/** Carries bpg `data.parser` (wrapper-level metadata) invisibly on the built bit. */\nexport const BUILT_BIT_PARSER = Symbol.for(\"@gmb/bitmark-parser/legacy-built-bit-parser\");\n\n/**\n * bpg buildBit data keys whose bit-JSON key differs. Everything else in the\n * flat data object maps by identity (the data fields are already the bpg\n * JSON model types) and unknown keys pass through untouched (PLAN-126 F-6).\n */\nconst DATA_KEY_TO_JSON_KEY: Record<string, string> = {\n bitType: \"type\",\n textFormat: \"format\",\n flashcards: \"cards\",\n markConfig: \"marks\",\n};\n\n/** bpg deprecated text-format value accepted by buildBit. */\nconst DEPRECATED_TEXT_FORMATS: Record<string, string> = {\n \"bitmark--\": \"bitmark++\",\n \"bitmark+\": \"bitmark++\",\n};\n\n/** Top-level bit JSON fields typed JsonText (tag location) in bpg. */\nconst TAG_TEXT_KEYS = [\n \"title\",\n \"subtitle\",\n \"item\",\n \"lead\",\n \"pageNumber\",\n \"marginNumber\",\n \"hint\",\n \"instruction\",\n \"caption\",\n] as const;\n\nexport interface BuildBitOptions {\n cardSet?: {\n sideNo: number;\n variantNo: number;\n };\n}\n\nexport class Builder {\n /**\n * Build bitmark AST envelope (bpg-compatible `buildBitmark`).\n */\n buildBitmark(data: { bits?: unknown[]; errors?: ParserError[] }): LegacyPseudoAst {\n const ast = makePseudoAst(data.bits ?? []);\n if (data.errors !== undefined) {\n (ast as LegacyPseudoAst & { errors?: ParserError[] }).errors = data.errors;\n }\n return ast;\n }\n\n /**\n * Build a bit (bpg-compatible `buildBit`).\n *\n * Accepts the full bpg data shape (flat, ~250 optional fields, values in\n * the JSON model types). Returns the normalized bit JSON. Throws\n * `No config found for bit: X` for unknown bit types, as bpg does.\n *\n * NOTE (documented divergences from bpg):\n * - the return value is bit JSON, not bpg's internal AST node model;\n * - `resourceType` (an inference hint in bpg) is not carried into the\n * JSON — the attached `resource` object is authoritative;\n * - more than one entry in `resources` passes through under a\n * `resources` key (kept visible, not silently dropped) — the canonical\n * single attachment is `resource`.\n */\n buildBit(data: Record<string, unknown>, _options?: BuildBitOptions): Record<string, unknown> {\n const wasm = getLegacyWasm();\n const src = { ...data };\n\n const bitType = src.bitType as string | undefined;\n this.assertKnownBitType(bitType);\n\n // --- divergent keys ---\n const bit: Record<string, unknown> = {};\n bit.type = bitType;\n if (src.isCommented) {\n bit.type = \"_comment\";\n bit.originalType = bitType;\n }\n delete src.bitType;\n delete src.isCommented;\n\n const textFormat = src.textFormat as string | undefined;\n if (textFormat !== undefined) {\n bit.format = DEPRECATED_TEXT_FORMATS[textFormat] ?? textFormat;\n delete src.textFormat;\n }\n\n // resourceType is an inference hint only (see doc comment)\n delete src.resourceType;\n\n // body: accept bpg's Partial<Body> node ({ body: <JsonText> }) or a bare JsonText\n const body = src.body as { body?: unknown } | unknown;\n if (body !== undefined && body !== null && typeof body === \"object\" && \"body\" in (body as object)) {\n bit.body = (body as { body?: unknown }).body;\n delete src.body;\n }\n\n // example / __isDefaultExample → isExample + example (bpg toExample semantics)\n if (src.example !== undefined) {\n bit.isExample = true;\n bit.example = src.example;\n delete src.example;\n delete src.__isDefaultExample;\n } else if (src.__isDefaultExample) {\n bit.isExample = true;\n delete src.__isDefaultExample;\n }\n\n // resources → resource (single canonical attachment)\n const resources = src.resources;\n if (resources !== undefined) {\n if (Array.isArray(resources)) {\n if (resources.length === 1) bit.resource = resources[0];\n else if (resources.length > 1) bit.resources = resources;\n } else {\n bit.resource = resources;\n }\n delete src.resources;\n }\n\n // parser metadata lives on the wrapper, not in the bit JSON\n const parser = src.parser as ParserInfo | undefined;\n delete src.parser;\n\n // extraProperties spread into the bit JSON top level (bpg semantics)\n const extraProperties = src.extraProperties as Record<string, unknown> | undefined;\n delete src.extraProperties;\n\n // --- renamed + identity + unknown keys (pass through, PLAN-126 F-6) ---\n for (const [key, value] of Object.entries(src)) {\n if (value === undefined) continue;\n bit[DATA_KEY_TO_JSON_KEY[key] ?? key] = value;\n }\n if (extraProperties) {\n for (const [key, value] of Object.entries(extraProperties)) {\n if (!(key in bit)) bit[key] = value;\n }\n }\n\n // --- bpg parity: string JsonText values are parsed bitmark text ---\n this.parseStringTexts(bit);\n\n // --- normalization pass: the config-driven core defaults/coerces/validates ---\n const out = wasm.convert(JSON.stringify([{ bit }]), \"json\", \"json\", \"optimized\", false, 2, 1);\n if (out.startsWith(\"error:\")) {\n throw new Error(out.slice(\"error:\".length).trim());\n }\n const entries = JSON.parse(out) as { bit: Record<string, unknown> }[];\n const built = entries[0]?.bit ?? bit;\n\n // F-6: keys the core doesn't know are dropped by the normalize pass —\n // re-attach them so nothing is lost silently. Values matching bpg's own\n // \"unset optional\" strip set (false / \"\" / [] / null) stay stripped,\n // mirroring bpg's removeUnwantedProperties.\n for (const [key, value] of Object.entries(bit)) {\n if (key in built) continue;\n if (\n value === false ||\n value === \"\" ||\n value === null ||\n (Array.isArray(value) && value.length === 0)\n ) {\n continue;\n }\n built[key] = value;\n }\n if (parser !== undefined) {\n Object.defineProperty(built, BUILT_BIT_PARSER, { value: parser, enumerable: false });\n }\n return built;\n }\n\n /**\n * Build a highlight body bit (bpg-compatible `buildHighlight`).\n * Shapes the HighlightJson body-bit; unset optionals are omitted.\n */\n buildHighlight(\n _context: unknown,\n data: Record<string, unknown> | undefined,\n ): Record<string, unknown> | undefined {\n if (!data) return undefined;\n const src = { ...data };\n // bpg: data may arrive nested under 'attrs' (when coming from JSON)\n const attrs = src.attrs as Record<string, unknown> | undefined;\n if (attrs) Object.assign(src, attrs);\n\n const texts = Array.isArray(src.texts)\n ? (src.texts as Record<string, unknown>[]).filter((t) => t != null).map((t) => ({\n text: t.text ?? \"\",\n isCorrect: t.isCorrect ?? false,\n isHighlighted: t.isHighlighted ?? false,\n ...stripUndefined(t, [\"text\", \"isCorrect\", \"isHighlighted\"]),\n }))\n : [];\n\n const node: Record<string, unknown> = {\n type: \"highlight\",\n texts,\n prefix: src.prefix ?? \"\",\n postfix: src.postfix ?? \"\",\n ...stripUndefined(src, [\"type\", \"texts\", \"prefix\", \"postfix\", \"attrs\"]),\n attrs: {},\n };\n return node;\n }\n\n /**\n * bpg's builder parses string-valued JsonText fields as bitmark text\n * (inline marks become TextAst marks); the composer would otherwise treat\n * them as literal text. Converts top-level JsonText fields in place.\n * Nested (card-content) strings are left literal — documented divergence.\n */\n private parseStringTexts(bit: Record<string, unknown>): void {\n const wasm = getLegacyWasm();\n const toAst = (s: string, location: \"body\" | \"tag\"): unknown => {\n if (s === \"\") return s;\n const out = wasm.convert_text(s, \"textToAst\", \"bitmark++\", location);\n try {\n return JSON.parse(out) as unknown;\n } catch {\n return s;\n }\n };\n\n const format = bit.format as string | undefined;\n const bitmarkBody = format === undefined || format === \"bitmark++\" || format === \"bitmark+\";\n if (typeof bit.body === \"string\" && bitmarkBody) {\n bit.body = toAst(bit.body, \"body\");\n }\n for (const key of TAG_TEXT_KEYS) {\n const v = bit[key];\n if (typeof v === \"string\") bit[key] = toAst(v, \"tag\");\n }\n }\n\n /** Throw bpg's exact unknown-bit-type error (`Config.getBitConfig` parity). */\n private assertKnownBitType(bitType: string | undefined): asserts bitType is string {\n const wasm = getLegacyWasm();\n let known = false;\n if (bitType !== undefined) {\n try {\n const info = JSON.parse(wasm.info(\"bit\", \"json\", bitType, false, 2)) as {\n error?: string;\n };\n known = info.error === undefined;\n } catch {\n known = false;\n }\n }\n if (!known) {\n throw new Error(`No config found for bit: ${bitType}`);\n }\n }\n}\n\nfunction stripUndefined(\n src: Record<string, unknown>,\n exclude: string[],\n): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(src)) {\n if (v !== undefined && !exclude.includes(k)) out[k] = v;\n }\n return out;\n}\n","// @zen-component: LEGACY-Facade\n// bpg-compatible `BitmarkParserGenerator` class — a thin synchronous wrapper\n// over the WASM core (PLAN-126). Behavioural parity is at the call boundary:\n// same method names, option keys and return shapes as bpg v5.31.1.\n\nimport { PACKAGE_INFO } from \"../generated/package_info.js\";\nimport { unsupportedMember, unsupportedOption } from \"./errors.js\";\nimport { getLegacyFileIo, getLegacyWasm } from \"./runtime.js\";\nimport {\n mapTextFormat,\n prettyIndent,\n spacesAround,\n validateBitmarkOptions,\n validateJsonOptions,\n validateVersionOptions,\n} from \"./translate.js\";\nimport type {\n BreakscapeOptions,\n ConvertHtmlTableOptions,\n ConvertOptions,\n ConvertTextOptions,\n CreateAstOptions,\n ExtractPlainTextOptions,\n FileOptions,\n InfoOptions,\n UnbreakscapeOptions,\n UpgradeOptions,\n} from \"./options.js\";\nimport { makePseudoAst, type LegacyPseudoAst } from \"./pseudo-ast.js\";\nimport { BUILT_BIT_PARSER } from \"./builder.js\";\n\n/** Classified input for the convert/upgrade pipeline (PLAN-126 F-10). */\ninterface ResolvedInput {\n /** JSON-wrapper-array string (json/ast input) or bitmark source (bitmark input). */\n source: string;\n isBitmark: boolean;\n}\n\nexport class BitmarkParserGenerator {\n /**\n * Get the version of the library.\n *\n * Reports the @gmb/bitmark-parser version (not a bpg version string).\n */\n public version(): string {\n return PACKAGE_INFO.version;\n }\n\n /**\n * Convert bitmark from bitmark to JSON, or JSON to bitmark (bpg-compatible).\n *\n * Input detection order matches bpg: AST → JSON → assume bitmark.\n * Default output: bitmark input → json; json/ast input → bitmark.\n */\n public convert(input: string | unknown, options?: ConvertOptions): string | unknown | void {\n const opts: ConvertOptions = Object.assign({}, options);\n const jsonOptions = Object.assign({}, opts.jsonOptions);\n const bitmarkOptions = Object.assign({}, opts.bitmarkOptions);\n validateVersionOptions(opts);\n validateBitmarkOptions(bitmarkOptions);\n validateJsonOptions(jsonOptions);\n this.checkBrowserFileWrite(opts.outputFile);\n\n const wasm = getLegacyWasm();\n const { source, isBitmark } = this.resolveInput(input, opts.inputFormat);\n\n const outputFormat = opts.outputFormat ?? (isBitmark ? \"json\" : \"bitmark\");\n const coreFormat = outputFormat === \"ast\" ? \"json\" : outputFormat;\n const { pretty, indent } = prettyIndent(jsonOptions.prettify);\n const spaces = spacesAround(bitmarkOptions.spacesAroundValues);\n\n const out = wasm.convert(source, isBitmark ? \"bitmark\" : \"json\", coreFormat, \"optimized\", pretty, indent, spaces);\n this.throwOnError(out);\n\n // Shape the result per output format (bpg-compatible return shapes)\n if (outputFormat === \"bitmark\" || outputFormat === \"text\") {\n return this.deliver(out, opts.outputFile, opts.fileOptions);\n }\n if (outputFormat === \"json\") {\n if (opts.outputFile) return this.deliver(out, opts.outputFile, opts.fileOptions);\n if (pretty || jsonOptions.stringify) return out;\n return JSON.parse(out) as unknown;\n }\n // outputFormat === \"ast\": bit-JSON pseudo-AST (PLAN-126 §3.1)\n const ast = makePseudoAst(JSON.parse(out) as unknown[]);\n if (opts.outputFile) {\n return this.deliver(JSON.stringify(ast), opts.outputFile, opts.fileOptions);\n }\n return ast;\n }\n\n /**\n * Upgrade (prettify / canonicalize) bitmark or JSON to the latest version\n * of itself (bpg-compatible `upgrade`).\n */\n public upgrade(input: string | unknown, options?: UpgradeOptions): string | unknown | void {\n const opts: UpgradeOptions = Object.assign({}, options);\n const jsonOptions = Object.assign({}, opts.jsonOptions);\n const bitmarkOptions = Object.assign({}, opts.bitmarkOptions);\n validateVersionOptions(opts);\n validateBitmarkOptions(bitmarkOptions);\n validateJsonOptions(jsonOptions);\n this.checkBrowserFileWrite(opts.outputFile);\n\n const wasm = getLegacyWasm();\n const { source, isBitmark } = this.resolveInput(input, opts.inputFormat);\n const { pretty, indent } = prettyIndent(jsonOptions.prettify);\n const spaces = spacesAround(bitmarkOptions.spacesAroundValues);\n\n const out = wasm.canonicalize(source, isBitmark ? \"bitmark\" : \"json\", \"optimized\", pretty, indent, spaces);\n this.throwOnError(out);\n\n if (isBitmark) return this.deliver(out, opts.outputFile, opts.fileOptions);\n if (opts.outputFile) return this.deliver(out, opts.outputFile, opts.fileOptions);\n if (pretty || jsonOptions.stringify) return out;\n return JSON.parse(out) as unknown;\n }\n\n /**\n * Get information about the bitmark language (bpg-compatible `info`).\n */\n public info(options?: InfoOptions): unknown {\n const opts: InfoOptions = Object.assign({}, options);\n const wasm = getLegacyWasm();\n const type = opts.type ?? \"list\";\n const format = opts.outputFormat ?? \"text\";\n const { pretty, indent } = prettyIndent(opts.prettify);\n\n const coreFormat = format === \"pojo\" ? \"json\" : format;\n const out = wasm.info(type, coreFormat, opts.bit ?? \"\", pretty, indent);\n this.throwOnError(out);\n if (format === \"pojo\") return JSON.parse(out) as unknown;\n return out;\n }\n\n /** Not supported: bpg-internal development tool. */\n public generateConfig(_options?: unknown): void {\n unsupportedMember(\"BitmarkParserGenerator.generateConfig\", \"bpg-internal development tool\");\n }\n\n /**\n * Convert between HTML tables and bitmark tables (bpg-compatible\n * `convertHtmlTable`).\n *\n * Backed by the core's schema-driven html mapping: HTML input has each\n * `<table>` wrapped in the core's `<bitmark-bit>` envelope and parsed;\n * bits input is emitted as html and the `<table>` fragments extracted\n * (the envelope stripped). The markup *inside* `<table>` follows this\n * parser's html mapping, which may differ from bpg's in detail.\n */\n public convertHtmlTable(\n input: string | unknown,\n options?: ConvertHtmlTableOptions,\n ): string | unknown | void {\n const opts: ConvertHtmlTableOptions = Object.assign({}, options);\n const jsonOptions = Object.assign({}, opts.jsonOptions);\n const bitmarkOptions = Object.assign({}, opts.bitmarkOptions);\n validateBitmarkOptions(bitmarkOptions);\n validateJsonOptions(jsonOptions);\n if (opts.keepUnknownTags) unsupportedOption(\"keepUnknownTags\");\n if (opts.noBreakscaping) unsupportedOption(\"noBreakscaping\");\n this.checkBrowserFileWrite(opts.outputFile);\n const wasm = getLegacyWasm();\n\n const inStr = typeof input === \"string\" ? this.maybeReadFile(input, undefined) : \"\";\n const isHtmlInput =\n opts.inputFormat === \"html\" ||\n (opts.inputFormat === undefined && typeof input === \"string\" && /<table[\\s>]/iu.test(inStr));\n\n if (!isHtmlInput) {\n // bits (bitmark / JSON / AST) → HTML `<table>` fragments\n const { source, isBitmark } = this.resolveInput(input, undefined);\n const out = wasm.convert(source, isBitmark ? \"bitmark\" : \"json\", \"html\", \"optimized\", false, 2, 1);\n this.throwOnError(out);\n return this.deliver(extractHtmlTables(out).join(\"\\n\"), opts.outputFile, opts.fileOptions);\n }\n\n // HTML input: wrap each <table> in the core's bit envelope and parse\n const bitType = opts.tableFormat === \"table\" ? \"table\" : \"table-extended\";\n const wrapped = extractHtmlTables(inStr)\n .map((t) => `<bitmark-bit data-type=\"${bitType}\" data-format=\"bitmark++\">${t}</bitmark-bit>`)\n .join(\"\");\n const outputFormat = opts.outputFormat ?? \"bitmark\";\n const { pretty, indent } = prettyIndent(jsonOptions.prettify);\n const spaces = spacesAround(bitmarkOptions.spacesAroundValues);\n\n if (outputFormat === \"html\") {\n const out = wasm.convert(wrapped, \"html\", \"html\", \"optimized\", false, 2, 1);\n this.throwOnError(out);\n return this.deliver(extractHtmlTables(out).join(\"\\n\"), opts.outputFile, opts.fileOptions);\n }\n const coreFormat = outputFormat === \"ast\" ? \"json\" : outputFormat;\n const out = wasm.convert(wrapped, \"html\", coreFormat, \"optimized\", pretty, indent, spaces);\n this.throwOnError(out);\n if (outputFormat === \"bitmark\" || outputFormat === \"text\") {\n return this.deliver(out, opts.outputFile, opts.fileOptions);\n }\n if (outputFormat === \"json\") {\n if (opts.outputFile) return this.deliver(out, opts.outputFile, opts.fileOptions);\n if (pretty || jsonOptions.stringify) return out;\n return JSON.parse(out) as unknown;\n }\n const ast = makePseudoAst(JSON.parse(out) as unknown[]);\n if (opts.outputFile) return this.deliver(JSON.stringify(ast), opts.outputFile, opts.fileOptions);\n return ast;\n }\n\n /**\n * Create a bit-JSON pseudo-AST from bitmark or JSON input (PLAN-126 §3.1).\n *\n * NOTE: the returned structure is the bit JSON (wrapper entries), not\n * bpg's internal TS AST node model. It round-trips through `convert` but\n * is not walkable with bpg's `Ast`/`NodeType`.\n */\n public createAst(input: unknown, options?: CreateAstOptions): LegacyPseudoAst {\n const opts: CreateAstOptions = Object.assign({}, options);\n const wasm = getLegacyWasm();\n const { source, isBitmark } = this.resolveInput(input, opts.inputFormat);\n const out = wasm.convert(source, isBitmark ? \"bitmark\" : \"json\", \"json\", \"optimized\", false, 2, 1);\n this.throwOnError(out);\n return makePseudoAst(JSON.parse(out) as unknown[]);\n }\n\n /**\n * Breakscape text (bpg-compatible `breakscapeText`).\n */\n public breakscapeText(input: string, options?: BreakscapeOptions): string | void {\n if (!input) return input;\n const opts: BreakscapeOptions = Object.assign({}, options);\n this.checkBrowserFileWrite(opts.outputFile);\n const wasm = getLegacyWasm();\n const inStr = this.maybeReadFile(input, opts.inputFormat);\n const res = wasm.breakscape_text(inStr, mapTextFormat(opts.textFormat), opts.textLocation ?? \"body\");\n return this.deliver(res, opts.outputFile, opts.fileOptions);\n }\n\n /**\n * Unbreakscape text (bpg-compatible `unbreakscapeText`).\n */\n public unbreakscapeText(input: string, options?: UnbreakscapeOptions): string | void {\n if (!input) return input;\n const opts: UnbreakscapeOptions = Object.assign({}, options);\n this.checkBrowserFileWrite(opts.outputFile);\n const wasm = getLegacyWasm();\n const inStr = this.maybeReadFile(input, opts.inputFormat);\n const res = wasm.unbreakscape_text(inStr, mapTextFormat(opts.textFormat), opts.textLocation ?? \"body\");\n return this.deliver(res, opts.outputFile, opts.fileOptions);\n }\n\n /**\n * Convert bitmark text ↔ text AST (bpg-compatible `convertText`).\n *\n * Direction is auto-detected: TextAst (JSON) input generates bitmark\n * text; anything else parses as bitmark text and returns the TextAst\n * (plain JS object; a string when `jsonOptions.prettify` is set).\n */\n public convertText(input: string | unknown, options?: ConvertTextOptions): string | unknown | void {\n const opts: ConvertTextOptions = Object.assign({}, options);\n const jsonOptions = Object.assign({}, opts.jsonOptions);\n this.checkBrowserFileWrite(opts.outputFile);\n const wasm = getLegacyWasm();\n\n const isBitmarkText = opts.textFormat === undefined || mapTextFormat(opts.textFormat) === \"bitmark++\";\n const textLocation = opts.textLocation ?? \"body\";\n\n let inStr: string;\n let ast: unknown[] | undefined;\n if (typeof input === \"string\") {\n inStr = this.maybeReadFile(input, opts.inputFormat);\n ast = this.parseTextAstString(inStr);\n } else {\n inStr = JSON.stringify(input);\n ast = Array.isArray(input) ? input : undefined;\n }\n\n if (ast !== undefined) {\n // TextAst → text (reverse honours the location; a plain-text format\n // generates plain text, i.e. marks are dropped — bpg parity)\n const out = isBitmarkText\n ? wasm.convert_text(JSON.stringify(ast), \"astToText\", \"bitmark++\", textLocation)\n : wasm.convert_text(JSON.stringify(ast), \"astToPlainText\", \"plainText\", textLocation);\n this.throwOnError(out);\n return this.deliver(out, opts.outputFile, opts.fileOptions);\n }\n\n // text → TextAst (bpg parses forward at body location)\n const out = wasm.convert_text(inStr, \"textToAst\", isBitmarkText ? \"bitmark++\" : \"plainText\", \"body\");\n this.throwOnError(out);\n const { pretty, indent } = prettyIndent(jsonOptions.prettify);\n const outStr = pretty ? wasm.prettify(out, indent) : out;\n if (opts.outputFile) return this.deliver(outStr, opts.outputFile, opts.fileOptions);\n if (pretty) return outStr;\n return JSON.parse(out) as unknown;\n }\n\n /**\n * Convert a text AST to plain text (bpg-compatible `textAstToPlainText`).\n */\n public textAstToPlainText(textAst: unknown, _options?: ExtractPlainTextOptions): string {\n const wasm = getLegacyWasm();\n const out = wasm.convert_text(\n typeof textAst === \"string\" ? textAst : JSON.stringify(textAst),\n \"astToPlainText\",\n \"bitmark++\",\n \"body\",\n );\n this.throwOnError(out);\n return out;\n }\n\n /**\n * Extract plain text from bitmark or bitmark JSON (bpg-compatible).\n */\n public extractPlainText(input: string | unknown, options?: ExtractPlainTextOptions): string {\n const inputFormat = options?.inputFormat;\n const wasm = getLegacyWasm();\n if (inputFormat === \"plainText\") {\n return typeof input === \"string\" ? String(input) : \"\";\n }\n if (inputFormat === \"bitmarkText\") {\n const ast = wasm.convert_text(String(input), \"textToAst\", \"bitmark++\", \"body\");\n const out = wasm.convert_text(ast, \"astToPlainText\", \"bitmark++\", \"body\");\n this.throwOnError(out);\n return out;\n }\n if (typeof input === \"string\" && this.parseTextAstString(input) === undefined && !wasm.is_bitmark(input)) {\n // Neither JSON nor bitmark: bpg falls through to bitmark text\n const looksJson = ((): boolean => {\n try {\n JSON.parse(input);\n return true;\n } catch {\n return false;\n }\n })();\n if (!looksJson) {\n return this.extractPlainText(input, { inputFormat: \"bitmarkText\" });\n }\n }\n const { source, isBitmark } = this.resolveInput(input, undefined);\n const out = wasm.convert(source, isBitmark ? \"bitmark\" : \"json\", \"text\", \"optimized\", false, 2, 1);\n this.throwOnError(out);\n return out;\n }\n\n /** If `s` parses as a TextAst JSON array, return it. */\n private parseTextAstString(s: string): unknown[] | undefined {\n const t = s.trim();\n if (!t.startsWith(\"[\")) return undefined;\n try {\n const v = JSON.parse(t) as unknown;\n if (Array.isArray(v) && v.every((n) => n !== null && typeof n === \"object\" && \"type\" in n)) {\n return v;\n }\n } catch {\n // not JSON\n }\n return undefined;\n }\n\n // ------------------------------------------------------------------\n // Internal helpers\n // ------------------------------------------------------------------\n\n /**\n * Resolve bpg input (string | file path | JSON value | pseudo-AST) to a\n * source string for the WASM core, classified per bpg's detection order:\n * AST → JSON → assume bitmark (PLAN-126 F-10).\n */\n protected resolveInput(input: unknown, inputFormat: string | undefined): ResolvedInput {\n if (typeof input !== \"string\") {\n // Parsed JSON / pseudo-AST value.\n const entries = this.jsonEntries(input);\n return {\n source: JSON.stringify(entries ? entries.map((b) => this.toWrapperEntry(b)) : input),\n isBitmark: false,\n };\n }\n const inStr = this.maybeReadFile(input, inputFormat);\n const wasm = getLegacyWasm();\n if (wasm.is_bitmark(inStr)) return { source: inStr, isBitmark: true };\n // JSON-ish: normalise loose shapes (AST envelope, single wrapper, bare bit)\n try {\n const parsed = JSON.parse(inStr) as unknown;\n const entries = this.jsonEntries(parsed);\n if (entries) {\n return {\n source: JSON.stringify(entries.map((b) => this.toWrapperEntry(b))),\n isBitmark: false,\n };\n }\n } catch {\n // is_bitmark said \"not bitmark\" but it is not JSON either —\n // fall through and let the core's own detection handle it (bpg\n // behaviour: assume bitmark).\n return { source: inStr, isBitmark: true };\n }\n return { source: inStr, isBitmark: false };\n }\n\n /**\n * Normalise the JSON shapes bpg accepts to a bits/entries array:\n * wrapper array, `{ bits: [...] }` AST envelope, single `{ bit: ... }`\n * wrapper, or a bare bit object (`{ type: ... }`).\n */\n private jsonEntries(v: unknown): unknown[] | undefined {\n if (Array.isArray(v)) return v;\n if (v !== null && typeof v === \"object\") {\n const o = v as Record<string, unknown>;\n if (Array.isArray(o.bits)) return o.bits;\n if (\"bit\" in o) return [o];\n if (typeof o.type === \"string\") return [{ bit: o }];\n }\n return undefined;\n }\n\n /**\n * Normalise a pseudo-AST bits entry to a `{ bit, parser? }` wrapper.\n * `Builder.buildBit` returns bare bit JSON (with any parser metadata\n * attached under a non-enumerable symbol); parsed forward output is\n * already wrapper-shaped.\n */\n private toWrapperEntry(entry: unknown): unknown {\n if (entry !== null && typeof entry === \"object\" && \"bit\" in (entry as object)) return entry;\n const wrapper: { bit: unknown; parser?: unknown } = { bit: entry };\n const parser = (entry as Record<symbol, unknown> | null)?.[BUILT_BIT_PARSER];\n if (parser !== undefined) wrapper.parser = parser;\n return wrapper;\n }\n\n /** bpg parity: read `input` as a file when it names one (Node only). */\n protected maybeReadFile(input: string, inputFormat: string | undefined): string {\n if (inputFormat === \"string\") return input;\n const io = getLegacyFileIo();\n if (!io) return input;\n try {\n if (io.existsSync(input)) return io.readFileSync(input, \"utf8\");\n } catch {\n // treat as literal input\n }\n return input;\n }\n\n /** bpg parity: writing a file is impossible in the browser. */\n protected checkBrowserFileWrite(outputFile: string | undefined): void {\n if (outputFile && !getLegacyFileIo()) {\n throw new Error(\"Cannot write to file in browser environment\");\n }\n }\n\n /** Return `data`, or write it to `outputFile` (returning void), as bpg does. */\n protected deliver(data: string, outputFile?: string, fileOptions?: FileOptions): string | void {\n if (!outputFile) return data;\n const io = getLegacyFileIo();\n if (!io) throw new Error(\"Cannot write to file in browser environment\");\n io.writeFile(outputFile, data, {\n append: fileOptions?.append,\n encoding: fileOptions?.encoding ?? \"utf8\",\n });\n }\n\n /** The core reports failures as `error:`-prefixed strings; bpg throws. */\n protected throwOnError(out: string): void {\n if (out.startsWith(\"error:\")) {\n throw new Error(out.slice(\"error:\".length).trim());\n }\n }\n}\n\n/**\n * Extract every top-level `<table>…</table>` fragment from `html`\n * (case-insensitive, nesting-safe). Pure string scanning — no HTML parsing.\n */\nfunction extractHtmlTables(html: string): string[] {\n const tables: string[] = [];\n const lower = html.toLowerCase();\n let i = 0;\n for (;;) {\n const start = lower.indexOf(\"<table\", i);\n if (start === -1) break;\n let depth = 0;\n let j = start;\n let end = -1;\n while (j < html.length) {\n const open = lower.indexOf(\"<table\", j);\n const close = lower.indexOf(\"</table\", j);\n if (close === -1) break;\n if (open !== -1 && open < close) {\n depth++;\n j = open + \"<table\".length;\n } else {\n depth--;\n const closeEnd = lower.indexOf(\">\", close);\n j = closeEnd === -1 ? html.length : closeEnd + 1;\n if (depth === 0) {\n end = j;\n break;\n }\n }\n }\n if (end === -1) break;\n tables.push(html.slice(start, end));\n i = end;\n }\n return tables;\n}\n\n/**\n * Direct bitmark text parser (bpg-compatible `bitmarkTextParse`):\n * bitmark text → TextAst array.\n */\nexport function bitmarkTextParse(text: string): unknown[] {\n const out = getLegacyWasm().convert_text(text, \"textToAst\", \"bitmark++\", \"body\");\n if (out.startsWith(\"error:\")) throw new Error(out.slice(\"error:\".length).trim());\n return JSON.parse(out) as unknown[];\n}\n","// @zen-component: LEGACY-Facade\n// bpg-compatible `ResourceBuilder` (PLAN-126 §3.1): each method shapes the\n// `{ type, <family>: { ... } }` ResourceJson wrapper from bpg's flat data.\n// One generic table-driven implementation — per-bit-type defaulting and\n// URL-derived cosmetics are left to the config-driven core, which normalizes\n// the resource when the bit containing it is converted.\n\ninterface ResourceSpec {\n /** ResourceJson discriminator (`type`). */\n type: string;\n /** Family key holding the resource data object. */\n key: string;\n /** JSON field that bpg's `data.value` maps to. */\n valueField: \"src\" | \"url\" | \"body\";\n}\n\nconst RESOURCE_SPECS = {\n imageResource: { type: \"image\", key: \"image\", valueField: \"src\" },\n imageLinkResource: { type: \"image-link\", key: \"imageLink\", valueField: \"url\" },\n audioResource: { type: \"audio\", key: \"audio\", valueField: \"src\" },\n audioEmbedResource: { type: \"audio-embed\", key: \"audioEmbed\", valueField: \"src\" },\n audioLinkResource: { type: \"audio-link\", key: \"audioLink\", valueField: \"url\" },\n videoResource: { type: \"video\", key: \"video\", valueField: \"src\" },\n videoEmbedResource: { type: \"video-embed\", key: \"videoEmbed\", valueField: \"url\" },\n videoLinkResource: { type: \"video-link\", key: \"videoLink\", valueField: \"url\" },\n stillImageFilmEmbedResource: {\n type: \"still-image-film-embed\",\n key: \"stillImageFilmEmbed\",\n valueField: \"url\",\n },\n stillImageFilmLinkResource: {\n type: \"still-image-film-link\",\n key: \"stillImageFilmLink\",\n valueField: \"url\",\n },\n articleResource: { type: \"article\", key: \"article\", valueField: \"body\" },\n documentResource: { type: \"document\", key: \"document\", valueField: \"url\" },\n documentEmbedResource: { type: \"document-embed\", key: \"documentEmbed\", valueField: \"url\" },\n documentLinkResource: { type: \"document-link\", key: \"documentLink\", valueField: \"url\" },\n documentDownloadResource: {\n type: \"document-download\",\n key: \"documentDownload\",\n valueField: \"url\",\n },\n appLinkResource: { type: \"app-link\", key: \"appLink\", valueField: \"url\" },\n websiteLinkResource: { type: \"website-link\", key: \"websiteLink\", valueField: \"url\" },\n} as const satisfies Record<string, ResourceSpec>;\n\ntype ResourceMethod = (\n context: unknown,\n data: Record<string, unknown> | undefined,\n __typeAlias?: string,\n) => Record<string, unknown> | undefined;\n\nfunction buildResource(spec: ResourceSpec): ResourceMethod {\n return (_context, data, _typeAlias) => {\n if (!data) return undefined;\n const { value, ...rest } = data;\n const inner: Record<string, unknown> = { [spec.valueField]: value ?? \"\" };\n for (const [k, v] of Object.entries(rest)) {\n if (v !== undefined) inner[k] = v;\n }\n return { type: spec.type, [spec.key]: inner };\n };\n}\n\n/** Resource `type` string → spec (for the generic wrapper/data entry points). */\nconst SPEC_BY_TYPE: Record<string, ResourceSpec> = Object.fromEntries(\n Object.values(RESOURCE_SPECS).map((s) => [s.type, s]),\n);\n\n/** bpg-compatible ResourceBuilder: 17 `<family>Resource(context, data)` methods\n * plus the generic `resourceFromResourceJson` / `resourceFromResourceDataJson`. */\nexport class ResourceBuilder {\n /**\n * Normalise existing ResourceJson wrapper(s) (bpg-compatible).\n * Unknown resource types are dropped (bpg parity: it skips invalid types).\n */\n resourceFromResourceJson(\n _context: unknown,\n resource?: Record<string, unknown> | Record<string, unknown>[],\n ): unknown {\n if (!resource) return undefined;\n const single = !Array.isArray(resource);\n const list = single ? [resource as Record<string, unknown>] : resource;\n const nodes: Record<string, unknown>[] = [];\n for (const wrapper of list) {\n const spec = SPEC_BY_TYPE[wrapper.type as string];\n if (!spec) continue;\n const inner = (wrapper[spec.key] ?? {}) as Record<string, unknown>;\n const { [spec.valueField]: value, ...rest } = inner;\n const built = buildResource(spec)(undefined, { value, ...rest });\n if (built) nodes.push(built);\n }\n if (nodes.length === 0) return undefined;\n return single ? nodes[0] : nodes;\n }\n\n /**\n * Build a resource wrapper from a bare ResourceDataJson (bpg-compatible).\n * `data` may also be a plain string (used as the url/src/body value).\n */\n resourceFromResourceDataJson(\n context: unknown,\n type: string,\n data?: Record<string, unknown> | string,\n ): Record<string, unknown> | undefined {\n if (!data) return undefined;\n const spec = SPEC_BY_TYPE[type];\n if (!spec) return undefined;\n const asString = typeof data === \"string\" ? data : undefined;\n const obj = typeof data === \"object\" ? data : {};\n const { url, src, body, ...rest } = obj as {\n url?: unknown;\n src?: unknown;\n body?: unknown;\n [k: string]: unknown;\n };\n const value = url ?? src ?? body ?? asString;\n return buildResource(spec)(context, { value, ...rest });\n }\n imageResource: ResourceMethod = buildResource(RESOURCE_SPECS.imageResource);\n imageLinkResource: ResourceMethod = buildResource(RESOURCE_SPECS.imageLinkResource);\n audioResource: ResourceMethod = buildResource(RESOURCE_SPECS.audioResource);\n audioEmbedResource: ResourceMethod = buildResource(RESOURCE_SPECS.audioEmbedResource);\n audioLinkResource: ResourceMethod = buildResource(RESOURCE_SPECS.audioLinkResource);\n videoResource: ResourceMethod = buildResource(RESOURCE_SPECS.videoResource);\n videoEmbedResource: ResourceMethod = buildResource(RESOURCE_SPECS.videoEmbedResource);\n videoLinkResource: ResourceMethod = buildResource(RESOURCE_SPECS.videoLinkResource);\n stillImageFilmEmbedResource: ResourceMethod = buildResource(\n RESOURCE_SPECS.stillImageFilmEmbedResource,\n );\n stillImageFilmLinkResource: ResourceMethod = buildResource(\n RESOURCE_SPECS.stillImageFilmLinkResource,\n );\n articleResource: ResourceMethod = buildResource(RESOURCE_SPECS.articleResource);\n documentResource: ResourceMethod = buildResource(RESOURCE_SPECS.documentResource);\n documentEmbedResource: ResourceMethod = buildResource(RESOURCE_SPECS.documentEmbedResource);\n documentLinkResource: ResourceMethod = buildResource(RESOURCE_SPECS.documentLinkResource);\n documentDownloadResource: ResourceMethod = buildResource(\n RESOURCE_SPECS.documentDownloadResource,\n );\n appLinkResource: ResourceMethod = buildResource(RESOURCE_SPECS.appLinkResource);\n websiteLinkResource: ResourceMethod = buildResource(RESOURCE_SPECS.websiteLinkResource);\n}\n","// @zen-component: LEGACY-Facade\n// bpg-compatible enum objects and option interfaces (vendored from\n// bitmark-parser-generator v5.31.1, superenum EnumType<> replaced with the\n// equivalent value-union derivation). Exposed ONLY via the `legacy`\n// namespace / subpath — never re-exported at the package root.\n\ntype EnumType<T> = T[keyof T];\n\n/** Input type enumeration */\nexport const Input = {\n /** Input is as a string */\n string: \"string\",\n /** Input is as a file path */\n file: \"file\",\n} as const;\nexport type InputType = EnumType<typeof Input>;\n\n/** Output type enumeration */\nexport const Output = {\n /** Output bitmark string */\n bitmark: \"bitmark\",\n /** Output JSON as a plain JS object, or a file */\n json: \"json\",\n /** Output AST as a plain JS object, or a file */\n ast: \"ast\",\n /** Output plain text as a string, or a file */\n text: \"text\",\n} as const;\nexport type OutputType = EnumType<typeof Output>;\n\n/** Input format enumeration */\nexport const InputFormat = {\n bitmark: \"bitmark\",\n bitmarkText: \"bitmarkText\",\n plainText: \"plainText\",\n html: \"html\",\n} as const;\nexport type InputFormatType = EnumType<typeof InputFormat>;\n\nexport const BitmarkVersion = {\n v2: 2,\n v3: 3,\n} as const;\nexport type BitmarkVersionType = EnumType<typeof BitmarkVersion>;\n\nexport const CardSetVersion = {\n v1: 1,\n v2: 2,\n} as const;\nexport type CardSetVersionType = EnumType<typeof CardSetVersion>;\n\nexport const BitmarkParserType = {\n peggy: \"peggy\",\n} as const;\nexport type BitmarkParserTypeType = EnumType<typeof BitmarkParserType>;\n\nexport const InfoType = {\n list: \"list\",\n deprecated: \"deprecated\",\n all: \"all\",\n bit: \"bit\",\n} as const;\nexport type InfoTypeType = EnumType<typeof InfoType>;\n\nexport const InfoFormat = {\n text: \"text\",\n json: \"json\",\n pojo: \"pojo\",\n} as const;\nexport type InfoFormatType = EnumType<typeof InfoFormat>;\n\nexport const BodyTextFormat = {\n plainText: \"text\",\n latex: \"latex\",\n json: \"json\",\n xml: \"xml\",\n bitmarkPlusPlus: \"bitmark++\",\n} as const;\nexport type BodyTextFormatType = EnumType<typeof BodyTextFormat>;\n\nexport const TextLocation = {\n tag: \"tag\",\n body: \"body\",\n} as const;\nexport type TextLocationType = EnumType<typeof TextLocation>;\n\n/** Options for the output file (Node only) */\nexport interface FileOptions {\n /** Append to a file if true, otherwise overwrite */\n append?: boolean;\n /** Character encoding, defaults to 'utf8' */\n encoding?: string;\n}\n\n/** Options for bitmark generation */\nexport interface BitmarkOptions {\n explicitTextFormat?: boolean;\n prettifyJson?: boolean | number;\n cardSetVersion?: CardSetVersionType;\n spacesAroundValues?: number | boolean;\n debugGenerationInline?: boolean;\n noBreakscaping?: boolean;\n}\n\n/** Options for JSON generation */\nexport interface JsonOptions {\n enableWarnings?: boolean | number;\n prettify?: boolean | number;\n stringify?: boolean;\n textAsPlainText?: boolean;\n excludeUnknownProperties?: boolean;\n debugGenerationInline?: boolean;\n}\n\n/** Options for bitmark text JSON generation */\nexport interface TextJsonOptions {\n prettify?: boolean | number;\n}\n\n/** Info options for the parser */\nexport interface InfoOptions {\n type?: InfoTypeType;\n bit?: string;\n outputFormat?: InfoFormatType;\n prettify?: boolean | number;\n}\n\n/** Conversion options for bitmark / JSON conversion */\nexport interface ConvertOptions {\n bitmarkVersion?: BitmarkVersionType;\n bitmarkParserType?: BitmarkParserTypeType;\n inputFormat?: InputType;\n outputFormat?: OutputType;\n outputFile?: string;\n fileOptions?: FileOptions;\n bitmarkOptions?: BitmarkOptions;\n jsonOptions?: JsonOptions;\n}\n\n/** Prettify options for bitmark / JSON prettify / validate */\nexport interface UpgradeOptions {\n bitmarkVersion?: BitmarkVersionType;\n bitmarkParserType?: BitmarkParserTypeType;\n inputFormat?: InputType;\n outputFile?: string;\n fileOptions?: FileOptions;\n bitmarkOptions?: BitmarkOptions;\n jsonOptions?: JsonOptions;\n}\n\n/** Conversion options for bitmark text / JSON conversion */\nexport interface ConvertTextOptions {\n textFormat?: BodyTextFormatType;\n textLocation?: TextLocationType;\n inputFormat?: InputType;\n outputFile?: string;\n fileOptions?: FileOptions;\n jsonOptions?: TextJsonOptions;\n}\n\n/** Create AST options */\nexport interface CreateAstOptions {\n inputFormat?: InputType;\n}\n\nexport interface ExtractPlainTextOptions {\n inputFormat?: InputFormatType;\n}\n\n/** Options for convertHtmlTable */\nexport interface ConvertHtmlTableOptions {\n inputFormat?: InputFormatType;\n outputFormat?: OutputType | \"html\";\n tableFormat?: string;\n keepUnknownTags?: boolean;\n noBreakscaping?: boolean;\n outputFile?: string;\n fileOptions?: FileOptions;\n bitmarkOptions?: BitmarkOptions;\n jsonOptions?: JsonOptions;\n}\n\n/** Breakscape options */\nexport interface BreakscapeOptions {\n inputFormat?: InputType;\n outputFile?: string;\n fileOptions?: FileOptions;\n textFormat?: BodyTextFormatType;\n textLocation?: TextLocationType;\n}\n\n/** Unbreakscape options */\nexport interface UnbreakscapeOptions {\n inputFormat?: InputType;\n outputFile?: string;\n fileOptions?: FileOptions;\n textFormat?: BodyTextFormatType;\n textLocation?: TextLocationType;\n}\n","// @zen-component: LEGACY-Facade\n// Remaining bpg enum exports: TextMarkType / TextNodeType (vendored values),\n// BitType (built lazily from the config-driven core — never a hardcoded bit\n// list), and throwing proxies for enums tied to unsupported internals.\n\nimport { unsupportedMember } from \"./errors.js\";\nimport { getLegacyWasm } from \"./runtime.js\";\n\n/** Vendored from bpg v5.31.1 model/enum/TextMarkType.ts. */\nexport const TextMarkType = {\n bold: \"bold\",\n light: \"light\",\n italic: \"italic\",\n highlight: \"highlight\",\n highlightOrange: \"highlightOrange\",\n highlightYellow: \"highlightYellow\",\n highlightGreen: \"highlightGreen\",\n highlightBlue: \"highlightBlue\",\n highlightPurple: \"highlightPurple\",\n highlightPink: \"highlightPink\",\n highlightBrown: \"highlightBrown\",\n highlightBlack: \"highlightBlack\",\n highlightWhite: \"highlightWhite\",\n highlightGray: \"highlightGray\",\n strike: \"strike\",\n subscript: \"subscript\",\n superscript: \"superscript\",\n ins: \"ins\",\n del: \"del\",\n underline: \"underline\",\n doubleUnderline: \"doubleUnderline\",\n circle: \"circle\",\n languageEmRed: \"languageEmRed\",\n languageEmOrange: \"languageEmOrange\",\n languageEmYellow: \"languageEmYellow\",\n languageEmGreen: \"languageEmGreen\",\n languageEmBlue: \"languageEmBlue\",\n languageEmPurple: \"languageEmPurple\",\n languageEmPink: \"languageEmPink\",\n languageEmBrown: \"languageEmBrown\",\n languageEmBlack: \"languageEmBlack\",\n languageEmWhite: \"languageEmWhite\",\n languageEmGray: \"languageEmGray\",\n languageEm: \"languageEm\",\n userUnderline: \"userUnderline\",\n userDoubleUnderline: \"userDoubleUnderline\",\n userStrike: \"userStrike\",\n userCircle: \"userCircle\",\n userHighlight: \"userHighlight\",\n notranslate: \"notranslate\",\n link: \"link\",\n ref: \"ref\",\n xref: \"xref\",\n extref: \"extref\",\n footnote: \"footnote\",\n footnoteStar: \"footnote*\",\n symbol: \"symbol\",\n var: \"var\",\n code: \"code\",\n timer: \"timer\",\n duration: \"duration\",\n color: \"color\",\n colorPicker: \"colorPicker\",\n comment: \"comment\",\n} as const;\n\n/** Vendored from bpg v5.31.1 model/enum/TextNodeType.ts. */\nexport const TextNodeType = {\n text: \"text\",\n hardBreak: \"hardBreak\",\n paragraph: \"paragraph\",\n heading: \"heading\",\n section: \"section\",\n noBulletList: \"noBulletList\",\n bulletList: \"bulletList\",\n orderedList: \"orderedList\",\n orderedListRoman: \"orderedListRoman\",\n orderedListRomanLower: \"orderedListRomanLower\",\n letteredList: \"letteredList\",\n letteredListLower: \"letteredListLower\",\n taskList: \"taskList\",\n listItem: \"listItem\",\n taskItem: \"taskItem\",\n image: \"image\",\n imageInline: \"imageInline\",\n codeBlock: \"codeBlock\",\n latex: \"latex\",\n gap: \"gap\",\n select: \"select\",\n highlight: \"highlight\",\n mark: \"mark\",\n} as const;\n\n/** bpg key derivation: kebab-case bit name → camelCase enum key. */\nfunction bitNameToKey(name: string): string {\n return name.replace(/-([a-z0-9])/gu, (_, c: string) => c.toUpperCase());\n}\n\nlet bitTypeCache: Record<string, string> | undefined;\n\nfunction loadBitTypes(): Record<string, string> {\n if (!bitTypeCache) {\n const wasm = getLegacyWasm();\n const all = JSON.parse(wasm.info(\"all\", \"json\", \"\", false, 2)) as { name: string }[];\n const map: Record<string, string> = { _standard: \"_standard\" };\n for (const { name } of all) {\n map[bitNameToKey(name)] = name;\n }\n bitTypeCache = map;\n }\n return bitTypeCache;\n}\n\n/**\n * bpg-compatible `BitType` enum object, built lazily from the core's\n * config (`info`) rather than a hardcoded list. Keys are the camelCase of\n * the bit names, exactly as bpg derives them.\n */\nexport const BitType: Record<string, string> = new Proxy(\n {},\n {\n get: (_t, prop) => (typeof prop === \"string\" ? loadBitTypes()[prop] : undefined),\n has: (_t, prop) => typeof prop === \"string\" && prop in loadBitTypes(),\n ownKeys: () => Reflect.ownKeys(loadBitTypes()),\n getOwnPropertyDescriptor: (_t, prop) =>\n typeof prop === \"string\" && prop in loadBitTypes()\n ? { value: loadBitTypes()[prop], enumerable: true, configurable: true, writable: false }\n : undefined,\n },\n);\n\n/** Loud F-2 stand-in for enums tied to unsupported bpg internals. */\nfunction unsupportedEnum(name: string, reason: string): Record<string, string> {\n return new Proxy(\n {},\n {\n get: (_t, prop) => {\n if (prop === Symbol.toPrimitive || prop === \"toString\" || prop === Symbol.toStringTag) {\n return () => `[unsupported ${name}]`;\n }\n return unsupportedMember(name, reason);\n },\n has: () => unsupportedMember(name, reason),\n ownKeys: () => unsupportedMember(name, reason),\n },\n );\n}\n\n/** bpg `NodeType` — names bpg's internal AST nodes; the legacy AST is bit JSON. */\nexport const NodeType = unsupportedEnum(\n \"NodeType\",\n \"it names bpg's internal AST nodes; the legacy AST is bit JSON (see createAst)\",\n);\n\n/** bpg `BoundingBoxIndex` — bpg-internal utility. */\nexport const BoundingBoxIndex = unsupportedEnum(\n \"BoundingBoxIndex\",\n \"bpg-internal bounding-box utility\",\n);\n","// @zen-component: LEGACY-Facade\n// Throwing stubs for bpg exports the legacy facade deliberately does not\n// implement (PLAN-126 F-2: exist, but fail loudly and deterministically —\n// never silent no-ops). These are internals of bpg's TS implementation\n// (its AST walker, generators, parsers, writers), which have no equivalent\n// over the WASM core.\n\nimport { unsupportedMember } from \"./errors.js\";\n\nfunction stubClass(name: string, reason: string): new (...args: unknown[]) => never {\n return class {\n constructor() {\n unsupportedMember(name, reason);\n }\n } as unknown as new (...args: unknown[]) => never;\n}\n\nconst WALKER_REASON =\n \"the legacy AST is bit JSON, not bpg's internal node model; walking it with bpg NodeType names would silently misbehave\";\nconst INTERNAL_REASON = \"internal class of bpg's TS implementation\";\n\n/** bpg `Ast` walker — unsupported (PLAN-126 decision Q-7). */\nexport const Ast = stubClass(\"Ast\", WALKER_REASON);\n\nexport const BitmarkGenerator = stubClass(\"BitmarkGenerator\", INTERNAL_REASON);\nexport const BitmarkStringGenerator = stubClass(\"BitmarkStringGenerator\", INTERNAL_REASON);\nexport const BitmarkFileGenerator = stubClass(\"BitmarkFileGenerator\", INTERNAL_REASON);\nexport const JsonGenerator = stubClass(\"JsonGenerator\", INTERNAL_REASON);\nexport const JsonStringGenerator = stubClass(\"JsonStringGenerator\", INTERNAL_REASON);\nexport const JsonFileGenerator = stubClass(\"JsonFileGenerator\", INTERNAL_REASON);\nexport const HtmlTableGenerator = stubClass(\"HtmlTableGenerator\", INTERNAL_REASON);\nexport const HtmlTableParser = stubClass(\"HtmlTableParser\", INTERNAL_REASON);\nexport const BitmarkParser = stubClass(\"BitmarkParser\", INTERNAL_REASON);\nexport const JsonParser = stubClass(\"JsonParser\", INTERNAL_REASON);\nexport const StringWriter = stubClass(\"StringWriter\", INTERNAL_REASON);\nexport const FileWriter = stubClass(\"FileWriter\", INTERNAL_REASON);\nexport const StreamWriter = stubClass(\"StreamWriter\", INTERNAL_REASON);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,cAAc,MACvB,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEtC,IAAM,gBAAgC,iCAAiB;;;ADV9D,yBAA8B;;;AEEvB,IAAM,eAAe;AAAA,EAC1B,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,WAAW;AAAA,EACX,eAAe;AACjB;;;ACwCO,SAAS,QAAQ,GAAoB;AAC1C,SAAO,EAAE,WAAW,QAAQ;AAC9B;AAOO,SAAS,YAAY,GAAoB;AAC9C,QAAM,IAAI,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC;AACnD,SAAO,EAAE,WAAW,QAAQ,IAAI,IAAI,UAAU,CAAC;AACjD;AAGO,SAAS,WAAW,KAAqB;AAC9C,QAAM,IAAI,IAAI,KAAK;AACnB,SAAO,EAAE,WAAW,GAAG,KAAK,EAAE,SAAS,GAAG,IAAI,EAAE,MAAM,GAAG,EAAE,IAAI;AACjE;AAEA,SAAS,eAAe,OAAgD;AACtE,MAAI,UAAU,OAAW,QAAO,CAAC;AACjC,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM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OAAO,QAAQ,WAAW,QAAQ,QAAQ,aAAa,OAAO,GAAG,CAAC;AACxF;","names":["wasm","out","wasm","path","wasm","wasm","wasm","wasm","info","wasm","out","wasm","require"]}
package/dist/index.d.cts CHANGED
@@ -1,3 +1,5 @@
1
+ import { AppLinkResourceJson, AppLinkResourceWrapperJson, ArticleResourceJson, ArticleResourceWrapperJson, Ast, AudioEmbedResourceJson, AudioEmbedResourceWrapperJson, AudioLinkResourceJson, AudioLinkResourceWrapperJson, AudioResourceJson, AudioResourceWrapperJson, BaseBodyBitJson, BaseResourceJson, BitJson, BitType, BitTypeType, BitWrapperJson, BitmarkFileGenerator, BitmarkGenerator, BitmarkOptions, BitmarkParser, BitmarkParserGenerator, BitmarkParserType, BitmarkParserTypeType, BitmarkStringGenerator, BitmarkVersion, BitmarkVersionType, BodyBitJson, BodyBitsJson, BodyTextFormat, BodyTextFormatType, BookJson, BookReferenceJson, BotResponseJson, BoundingBoxIndex, BreakscapeOptions as BreakscapeOptions$1, BuildBitOptions, Builder, CardSetVersion, CardSetVersionType, ChoiceJson, CodeBlockTextNode, CodeBlockTextNodeAttributes, CommentMark, ConvertHtmlTableOptions, ConvertOptions as ConvertOptions$1, ConvertTextOptions, CreateAstOptions, DefinitionListItemJson, DocumentDownloadResourceJson, DocumentDownloadResourceWrapperJson, DocumentEmbedResourceJson, DocumentEmbedResourceWrapperJson, DocumentLinkResourceJson, DocumentLinkResourceWrapperJson, DocumentResourceJson, DocumentResourceWrapperJson, ExampleJson, ExtRefMark, ExtRefMarkAttibutes, ExtractPlainTextOptions, FeedbackChoiceJson, FeedbackJson, FeedbackReasonJson, FileOptions, FileWriter, FlashcardJson, FootnoteAttibutes, FootnoteMark, GapJson, GroupTagJson, HeadingJson, HeadingTextNode, HeadingTextNodeAttributes, HighlightJson, HighlightTextJson, HtmlTableGenerator, HtmlTableParser, ImageInlineTextNode, ImageLinkResourceJson, ImageLinkResourceWrapperJson, ImageResourceJson, ImageResourceWrapperJson, ImageResponsiveResourceJson, ImageResponsiveResourceWrapperJson, ImageSourceJson, ImageTextNode, ImageTextNodeAttributes, InfoFormat as InfoFormat$1, InfoFormatType, InfoOptions as InfoOptions$1, InfoType as InfoType$1, InfoTypeType, IngredientJson, Input, InputFormat as InputFormat$1, InputFormatType, InputType, JsonFileGenerator, JsonGenerator, JsonOptions, JsonParser, JsonStringGenerator, JsonText, LatexTextNode, LatexTextNodeAttributes, LegacyPseudoAst, LegacyUnsupportedError, LinkMark, LinkMarkAttibutes, ListItemJson, ListTextNode, ListTextNodeAttributes, MarkConfigJson, MarkJson, MatrixCellJson, MatrixJson, MediaAttributes, NodeType, Output, OutputType, PairJson, ParserError, ParserInfo, ParserJson, ParserLocation, PersonJson, PronunciationTableCellJson, PronunciationTableJson, QuestionJson, QuizJson, RatingLevelStartEndJson, RefMark, RefMarkAttibutes, ResourceBuilder, ResourceDataJson, ResourceJson, ResourceTypeType, ResourceWrapperJson, ResponseJson, SectionTextNode, SelectJson, SelectOptionJson, ServingsJson, StatementJson, StillImageFilmEmbedResourceJson, StillImageFilmEmbedResourceWrapperJson, StillImageFilmLinkResourceJson, StillImageFilmLinkResourceWrapperJson, StillImageFilmResourceJson, StillImageFilmResourceWrapperJson, StreamWriter, StringWriter, SymbolMark, SymbolMarkAttibutes, TableCellJson, TableExtendedJson, TableJson, TableRowJson, TableSectionJson, TaskItemTextNode, TaskItemTextNodeAttributes, TechnicalTermJson, TextAndIconJson, TextAst, TextFormatType, TextJsonOptions, TextLocation as TextLocation$1, TextLocationType, TextMark, TextMarkAttibutes, TextMarkType, TextMarkTypeType, TextNode, TextNodeAttibutes, TextNodeType, TextNodeTypeType, UnbreakscapeOptions, UpgradeOptions, VideoEmbedResourceJson, VideoEmbedResourceWrapperJson, VideoLinkResourceJson, VideoLinkResourceWrapperJson, VideoResourceJson, VideoResourceWrapperJson, WebsiteLinkResourceJson, WebsiteLinkResourceWrapperJson, XRefMark, XRefMarkAttibutes, bitmarkTextParse, isPseudoAst } from './legacy.cjs';
2
+
1
3
  /**
2
4
  * Output mode for JSON serialization.
3
5
  *
@@ -183,6 +185,194 @@ interface InfoOptions {
183
185
  indent?: number;
184
186
  }
185
187
 
188
+ declare const index_AppLinkResourceJson: typeof AppLinkResourceJson;
189
+ declare const index_AppLinkResourceWrapperJson: typeof AppLinkResourceWrapperJson;
190
+ declare const index_ArticleResourceJson: typeof ArticleResourceJson;
191
+ declare const index_ArticleResourceWrapperJson: typeof ArticleResourceWrapperJson;
192
+ declare const index_Ast: typeof Ast;
193
+ declare const index_AudioEmbedResourceJson: typeof AudioEmbedResourceJson;
194
+ declare const index_AudioEmbedResourceWrapperJson: typeof AudioEmbedResourceWrapperJson;
195
+ declare const index_AudioLinkResourceJson: typeof AudioLinkResourceJson;
196
+ declare const index_AudioLinkResourceWrapperJson: typeof AudioLinkResourceWrapperJson;
197
+ declare const index_AudioResourceJson: typeof AudioResourceJson;
198
+ declare const index_AudioResourceWrapperJson: typeof AudioResourceWrapperJson;
199
+ declare const index_BaseBodyBitJson: typeof BaseBodyBitJson;
200
+ declare const index_BaseResourceJson: typeof BaseResourceJson;
201
+ declare const index_BitJson: typeof BitJson;
202
+ declare const index_BitType: typeof BitType;
203
+ declare const index_BitTypeType: typeof BitTypeType;
204
+ declare const index_BitWrapperJson: typeof BitWrapperJson;
205
+ declare const index_BitmarkFileGenerator: typeof BitmarkFileGenerator;
206
+ declare const index_BitmarkGenerator: typeof BitmarkGenerator;
207
+ declare const index_BitmarkOptions: typeof BitmarkOptions;
208
+ declare const index_BitmarkParser: typeof BitmarkParser;
209
+ declare const index_BitmarkParserGenerator: typeof BitmarkParserGenerator;
210
+ declare const index_BitmarkParserType: typeof BitmarkParserType;
211
+ declare const index_BitmarkParserTypeType: typeof BitmarkParserTypeType;
212
+ declare const index_BitmarkStringGenerator: typeof BitmarkStringGenerator;
213
+ declare const index_BitmarkVersion: typeof BitmarkVersion;
214
+ declare const index_BitmarkVersionType: typeof BitmarkVersionType;
215
+ declare const index_BodyBitJson: typeof BodyBitJson;
216
+ declare const index_BodyBitsJson: typeof BodyBitsJson;
217
+ declare const index_BodyTextFormat: typeof BodyTextFormat;
218
+ declare const index_BodyTextFormatType: typeof BodyTextFormatType;
219
+ declare const index_BookJson: typeof BookJson;
220
+ declare const index_BookReferenceJson: typeof BookReferenceJson;
221
+ declare const index_BotResponseJson: typeof BotResponseJson;
222
+ declare const index_BoundingBoxIndex: typeof BoundingBoxIndex;
223
+ declare const index_BuildBitOptions: typeof BuildBitOptions;
224
+ declare const index_Builder: typeof Builder;
225
+ declare const index_CardSetVersion: typeof CardSetVersion;
226
+ declare const index_CardSetVersionType: typeof CardSetVersionType;
227
+ declare const index_ChoiceJson: typeof ChoiceJson;
228
+ declare const index_CodeBlockTextNode: typeof CodeBlockTextNode;
229
+ declare const index_CodeBlockTextNodeAttributes: typeof CodeBlockTextNodeAttributes;
230
+ declare const index_CommentMark: typeof CommentMark;
231
+ declare const index_ConvertHtmlTableOptions: typeof ConvertHtmlTableOptions;
232
+ declare const index_ConvertTextOptions: typeof ConvertTextOptions;
233
+ declare const index_CreateAstOptions: typeof CreateAstOptions;
234
+ declare const index_DefinitionListItemJson: typeof DefinitionListItemJson;
235
+ declare const index_DocumentDownloadResourceJson: typeof DocumentDownloadResourceJson;
236
+ declare const index_DocumentDownloadResourceWrapperJson: typeof DocumentDownloadResourceWrapperJson;
237
+ declare const index_DocumentEmbedResourceJson: typeof DocumentEmbedResourceJson;
238
+ declare const index_DocumentEmbedResourceWrapperJson: typeof DocumentEmbedResourceWrapperJson;
239
+ declare const index_DocumentLinkResourceJson: typeof DocumentLinkResourceJson;
240
+ declare const index_DocumentLinkResourceWrapperJson: typeof DocumentLinkResourceWrapperJson;
241
+ declare const index_DocumentResourceJson: typeof DocumentResourceJson;
242
+ declare const index_DocumentResourceWrapperJson: typeof DocumentResourceWrapperJson;
243
+ declare const index_ExampleJson: typeof ExampleJson;
244
+ declare const index_ExtRefMark: typeof ExtRefMark;
245
+ declare const index_ExtRefMarkAttibutes: typeof ExtRefMarkAttibutes;
246
+ declare const index_ExtractPlainTextOptions: typeof ExtractPlainTextOptions;
247
+ declare const index_FeedbackChoiceJson: typeof FeedbackChoiceJson;
248
+ declare const index_FeedbackJson: typeof FeedbackJson;
249
+ declare const index_FeedbackReasonJson: typeof FeedbackReasonJson;
250
+ declare const index_FileOptions: typeof FileOptions;
251
+ declare const index_FileWriter: typeof FileWriter;
252
+ declare const index_FlashcardJson: typeof FlashcardJson;
253
+ declare const index_FootnoteAttibutes: typeof FootnoteAttibutes;
254
+ declare const index_FootnoteMark: typeof FootnoteMark;
255
+ declare const index_GapJson: typeof GapJson;
256
+ declare const index_GroupTagJson: typeof GroupTagJson;
257
+ declare const index_HeadingJson: typeof HeadingJson;
258
+ declare const index_HeadingTextNode: typeof HeadingTextNode;
259
+ declare const index_HeadingTextNodeAttributes: typeof HeadingTextNodeAttributes;
260
+ declare const index_HighlightJson: typeof HighlightJson;
261
+ declare const index_HighlightTextJson: typeof HighlightTextJson;
262
+ declare const index_HtmlTableGenerator: typeof HtmlTableGenerator;
263
+ declare const index_HtmlTableParser: typeof HtmlTableParser;
264
+ declare const index_ImageInlineTextNode: typeof ImageInlineTextNode;
265
+ declare const index_ImageLinkResourceJson: typeof ImageLinkResourceJson;
266
+ declare const index_ImageLinkResourceWrapperJson: typeof ImageLinkResourceWrapperJson;
267
+ declare const index_ImageResourceJson: typeof ImageResourceJson;
268
+ declare const index_ImageResourceWrapperJson: typeof ImageResourceWrapperJson;
269
+ declare const index_ImageResponsiveResourceJson: typeof ImageResponsiveResourceJson;
270
+ declare const index_ImageResponsiveResourceWrapperJson: typeof ImageResponsiveResourceWrapperJson;
271
+ declare const index_ImageSourceJson: typeof ImageSourceJson;
272
+ declare const index_ImageTextNode: typeof ImageTextNode;
273
+ declare const index_ImageTextNodeAttributes: typeof ImageTextNodeAttributes;
274
+ declare const index_InfoFormatType: typeof InfoFormatType;
275
+ declare const index_InfoTypeType: typeof InfoTypeType;
276
+ declare const index_IngredientJson: typeof IngredientJson;
277
+ declare const index_Input: typeof Input;
278
+ declare const index_InputFormatType: typeof InputFormatType;
279
+ declare const index_InputType: typeof InputType;
280
+ declare const index_JsonFileGenerator: typeof JsonFileGenerator;
281
+ declare const index_JsonGenerator: typeof JsonGenerator;
282
+ declare const index_JsonOptions: typeof JsonOptions;
283
+ declare const index_JsonParser: typeof JsonParser;
284
+ declare const index_JsonStringGenerator: typeof JsonStringGenerator;
285
+ declare const index_JsonText: typeof JsonText;
286
+ declare const index_LatexTextNode: typeof LatexTextNode;
287
+ declare const index_LatexTextNodeAttributes: typeof LatexTextNodeAttributes;
288
+ declare const index_LegacyPseudoAst: typeof LegacyPseudoAst;
289
+ declare const index_LegacyUnsupportedError: typeof LegacyUnsupportedError;
290
+ declare const index_LinkMark: typeof LinkMark;
291
+ declare const index_LinkMarkAttibutes: typeof LinkMarkAttibutes;
292
+ declare const index_ListItemJson: typeof ListItemJson;
293
+ declare const index_ListTextNode: typeof ListTextNode;
294
+ declare const index_ListTextNodeAttributes: typeof ListTextNodeAttributes;
295
+ declare const index_MarkConfigJson: typeof MarkConfigJson;
296
+ declare const index_MarkJson: typeof MarkJson;
297
+ declare const index_MatrixCellJson: typeof MatrixCellJson;
298
+ declare const index_MatrixJson: typeof MatrixJson;
299
+ declare const index_MediaAttributes: typeof MediaAttributes;
300
+ declare const index_NodeType: typeof NodeType;
301
+ declare const index_Output: typeof Output;
302
+ declare const index_OutputType: typeof OutputType;
303
+ declare const index_PairJson: typeof PairJson;
304
+ declare const index_ParserError: typeof ParserError;
305
+ declare const index_ParserInfo: typeof ParserInfo;
306
+ declare const index_ParserJson: typeof ParserJson;
307
+ declare const index_ParserLocation: typeof ParserLocation;
308
+ declare const index_PersonJson: typeof PersonJson;
309
+ declare const index_PronunciationTableCellJson: typeof PronunciationTableCellJson;
310
+ declare const index_PronunciationTableJson: typeof PronunciationTableJson;
311
+ declare const index_QuestionJson: typeof QuestionJson;
312
+ declare const index_QuizJson: typeof QuizJson;
313
+ declare const index_RatingLevelStartEndJson: typeof RatingLevelStartEndJson;
314
+ declare const index_RefMark: typeof RefMark;
315
+ declare const index_RefMarkAttibutes: typeof RefMarkAttibutes;
316
+ declare const index_ResourceBuilder: typeof ResourceBuilder;
317
+ declare const index_ResourceDataJson: typeof ResourceDataJson;
318
+ declare const index_ResourceJson: typeof ResourceJson;
319
+ declare const index_ResourceTypeType: typeof ResourceTypeType;
320
+ declare const index_ResourceWrapperJson: typeof ResourceWrapperJson;
321
+ declare const index_ResponseJson: typeof ResponseJson;
322
+ declare const index_SectionTextNode: typeof SectionTextNode;
323
+ declare const index_SelectJson: typeof SelectJson;
324
+ declare const index_SelectOptionJson: typeof SelectOptionJson;
325
+ declare const index_ServingsJson: typeof ServingsJson;
326
+ declare const index_StatementJson: typeof StatementJson;
327
+ declare const index_StillImageFilmEmbedResourceJson: typeof StillImageFilmEmbedResourceJson;
328
+ declare const index_StillImageFilmEmbedResourceWrapperJson: typeof StillImageFilmEmbedResourceWrapperJson;
329
+ declare const index_StillImageFilmLinkResourceJson: typeof StillImageFilmLinkResourceJson;
330
+ declare const index_StillImageFilmLinkResourceWrapperJson: typeof StillImageFilmLinkResourceWrapperJson;
331
+ declare const index_StillImageFilmResourceJson: typeof StillImageFilmResourceJson;
332
+ declare const index_StillImageFilmResourceWrapperJson: typeof StillImageFilmResourceWrapperJson;
333
+ declare const index_StreamWriter: typeof StreamWriter;
334
+ declare const index_StringWriter: typeof StringWriter;
335
+ declare const index_SymbolMark: typeof SymbolMark;
336
+ declare const index_SymbolMarkAttibutes: typeof SymbolMarkAttibutes;
337
+ declare const index_TableCellJson: typeof TableCellJson;
338
+ declare const index_TableExtendedJson: typeof TableExtendedJson;
339
+ declare const index_TableJson: typeof TableJson;
340
+ declare const index_TableRowJson: typeof TableRowJson;
341
+ declare const index_TableSectionJson: typeof TableSectionJson;
342
+ declare const index_TaskItemTextNode: typeof TaskItemTextNode;
343
+ declare const index_TaskItemTextNodeAttributes: typeof TaskItemTextNodeAttributes;
344
+ declare const index_TechnicalTermJson: typeof TechnicalTermJson;
345
+ declare const index_TextAndIconJson: typeof TextAndIconJson;
346
+ declare const index_TextAst: typeof TextAst;
347
+ declare const index_TextFormatType: typeof TextFormatType;
348
+ declare const index_TextJsonOptions: typeof TextJsonOptions;
349
+ declare const index_TextLocationType: typeof TextLocationType;
350
+ declare const index_TextMark: typeof TextMark;
351
+ declare const index_TextMarkAttibutes: typeof TextMarkAttibutes;
352
+ declare const index_TextMarkType: typeof TextMarkType;
353
+ declare const index_TextMarkTypeType: typeof TextMarkTypeType;
354
+ declare const index_TextNode: typeof TextNode;
355
+ declare const index_TextNodeAttibutes: typeof TextNodeAttibutes;
356
+ declare const index_TextNodeType: typeof TextNodeType;
357
+ declare const index_TextNodeTypeType: typeof TextNodeTypeType;
358
+ declare const index_UnbreakscapeOptions: typeof UnbreakscapeOptions;
359
+ declare const index_UpgradeOptions: typeof UpgradeOptions;
360
+ declare const index_VideoEmbedResourceJson: typeof VideoEmbedResourceJson;
361
+ declare const index_VideoEmbedResourceWrapperJson: typeof VideoEmbedResourceWrapperJson;
362
+ declare const index_VideoLinkResourceJson: typeof VideoLinkResourceJson;
363
+ declare const index_VideoLinkResourceWrapperJson: typeof VideoLinkResourceWrapperJson;
364
+ declare const index_VideoResourceJson: typeof VideoResourceJson;
365
+ declare const index_VideoResourceWrapperJson: typeof VideoResourceWrapperJson;
366
+ declare const index_WebsiteLinkResourceJson: typeof WebsiteLinkResourceJson;
367
+ declare const index_WebsiteLinkResourceWrapperJson: typeof WebsiteLinkResourceWrapperJson;
368
+ declare const index_XRefMark: typeof XRefMark;
369
+ declare const index_XRefMarkAttibutes: typeof XRefMarkAttibutes;
370
+ declare const index_bitmarkTextParse: typeof bitmarkTextParse;
371
+ declare const index_isPseudoAst: typeof isPseudoAst;
372
+ declare namespace index {
373
+ export { index_AppLinkResourceJson as AppLinkResourceJson, index_AppLinkResourceWrapperJson as AppLinkResourceWrapperJson, index_ArticleResourceJson as ArticleResourceJson, index_ArticleResourceWrapperJson as ArticleResourceWrapperJson, index_Ast as Ast, index_AudioEmbedResourceJson as AudioEmbedResourceJson, index_AudioEmbedResourceWrapperJson as AudioEmbedResourceWrapperJson, index_AudioLinkResourceJson as AudioLinkResourceJson, index_AudioLinkResourceWrapperJson as AudioLinkResourceWrapperJson, index_AudioResourceJson as AudioResourceJson, index_AudioResourceWrapperJson as AudioResourceWrapperJson, index_BaseBodyBitJson as BaseBodyBitJson, index_BaseResourceJson as BaseResourceJson, index_BitJson as BitJson, index_BitType as BitType, index_BitTypeType as BitTypeType, index_BitWrapperJson as BitWrapperJson, index_BitmarkFileGenerator as BitmarkFileGenerator, index_BitmarkGenerator as BitmarkGenerator, index_BitmarkOptions as BitmarkOptions, index_BitmarkParser as BitmarkParser, index_BitmarkParserGenerator as BitmarkParserGenerator, index_BitmarkParserType as BitmarkParserType, index_BitmarkParserTypeType as BitmarkParserTypeType, index_BitmarkStringGenerator as BitmarkStringGenerator, index_BitmarkVersion as BitmarkVersion, index_BitmarkVersionType as BitmarkVersionType, index_BodyBitJson as BodyBitJson, index_BodyBitsJson as BodyBitsJson, index_BodyTextFormat as BodyTextFormat, index_BodyTextFormatType as BodyTextFormatType, index_BookJson as BookJson, index_BookReferenceJson as BookReferenceJson, index_BotResponseJson as BotResponseJson, index_BoundingBoxIndex as BoundingBoxIndex, BreakscapeOptions$1 as BreakscapeOptions, index_BuildBitOptions as BuildBitOptions, index_Builder as Builder, index_CardSetVersion as CardSetVersion, index_CardSetVersionType as CardSetVersionType, index_ChoiceJson as ChoiceJson, index_CodeBlockTextNode as CodeBlockTextNode, index_CodeBlockTextNodeAttributes as CodeBlockTextNodeAttributes, index_CommentMark as CommentMark, index_ConvertHtmlTableOptions as ConvertHtmlTableOptions, ConvertOptions$1 as ConvertOptions, index_ConvertTextOptions as ConvertTextOptions, index_CreateAstOptions as CreateAstOptions, index_DefinitionListItemJson as DefinitionListItemJson, index_DocumentDownloadResourceJson as DocumentDownloadResourceJson, index_DocumentDownloadResourceWrapperJson as DocumentDownloadResourceWrapperJson, index_DocumentEmbedResourceJson as DocumentEmbedResourceJson, index_DocumentEmbedResourceWrapperJson as DocumentEmbedResourceWrapperJson, index_DocumentLinkResourceJson as DocumentLinkResourceJson, index_DocumentLinkResourceWrapperJson as DocumentLinkResourceWrapperJson, index_DocumentResourceJson as DocumentResourceJson, index_DocumentResourceWrapperJson as DocumentResourceWrapperJson, index_ExampleJson as ExampleJson, index_ExtRefMark as ExtRefMark, index_ExtRefMarkAttibutes as ExtRefMarkAttibutes, index_ExtractPlainTextOptions as ExtractPlainTextOptions, index_FeedbackChoiceJson as FeedbackChoiceJson, index_FeedbackJson as FeedbackJson, index_FeedbackReasonJson as FeedbackReasonJson, index_FileOptions as FileOptions, index_FileWriter as FileWriter, index_FlashcardJson as FlashcardJson, index_FootnoteAttibutes as FootnoteAttibutes, index_FootnoteMark as FootnoteMark, index_GapJson as GapJson, index_GroupTagJson as GroupTagJson, index_HeadingJson as HeadingJson, index_HeadingTextNode as HeadingTextNode, index_HeadingTextNodeAttributes as HeadingTextNodeAttributes, index_HighlightJson as HighlightJson, index_HighlightTextJson as HighlightTextJson, index_HtmlTableGenerator as HtmlTableGenerator, index_HtmlTableParser as HtmlTableParser, index_ImageInlineTextNode as ImageInlineTextNode, index_ImageLinkResourceJson as ImageLinkResourceJson, index_ImageLinkResourceWrapperJson as ImageLinkResourceWrapperJson, index_ImageResourceJson as ImageResourceJson, index_ImageResourceWrapperJson as ImageResourceWrapperJson, index_ImageResponsiveResourceJson as ImageResponsiveResourceJson, index_ImageResponsiveResourceWrapperJson as ImageResponsiveResourceWrapperJson, index_ImageSourceJson as ImageSourceJson, index_ImageTextNode as ImageTextNode, index_ImageTextNodeAttributes as ImageTextNodeAttributes, InfoFormat$1 as InfoFormat, index_InfoFormatType as InfoFormatType, InfoOptions$1 as InfoOptions, InfoType$1 as InfoType, index_InfoTypeType as InfoTypeType, index_IngredientJson as IngredientJson, index_Input as Input, InputFormat$1 as InputFormat, index_InputFormatType as InputFormatType, index_InputType as InputType, index_JsonFileGenerator as JsonFileGenerator, index_JsonGenerator as JsonGenerator, index_JsonOptions as JsonOptions, index_JsonParser as JsonParser, index_JsonStringGenerator as JsonStringGenerator, index_JsonText as JsonText, index_LatexTextNode as LatexTextNode, index_LatexTextNodeAttributes as LatexTextNodeAttributes, index_LegacyPseudoAst as LegacyPseudoAst, index_LegacyUnsupportedError as LegacyUnsupportedError, index_LinkMark as LinkMark, index_LinkMarkAttibutes as LinkMarkAttibutes, index_ListItemJson as ListItemJson, index_ListTextNode as ListTextNode, index_ListTextNodeAttributes as ListTextNodeAttributes, index_MarkConfigJson as MarkConfigJson, index_MarkJson as MarkJson, index_MatrixCellJson as MatrixCellJson, index_MatrixJson as MatrixJson, index_MediaAttributes as MediaAttributes, index_NodeType as NodeType, index_Output as Output, index_OutputType as OutputType, index_PairJson as PairJson, index_ParserError as ParserError, index_ParserInfo as ParserInfo, index_ParserJson as ParserJson, index_ParserLocation as ParserLocation, index_PersonJson as PersonJson, index_PronunciationTableCellJson as PronunciationTableCellJson, index_PronunciationTableJson as PronunciationTableJson, index_QuestionJson as QuestionJson, index_QuizJson as QuizJson, index_RatingLevelStartEndJson as RatingLevelStartEndJson, index_RefMark as RefMark, index_RefMarkAttibutes as RefMarkAttibutes, index_ResourceBuilder as ResourceBuilder, index_ResourceDataJson as ResourceDataJson, index_ResourceJson as ResourceJson, index_ResourceTypeType as ResourceTypeType, index_ResourceWrapperJson as ResourceWrapperJson, index_ResponseJson as ResponseJson, index_SectionTextNode as SectionTextNode, index_SelectJson as SelectJson, index_SelectOptionJson as SelectOptionJson, index_ServingsJson as ServingsJson, index_StatementJson as StatementJson, index_StillImageFilmEmbedResourceJson as StillImageFilmEmbedResourceJson, index_StillImageFilmEmbedResourceWrapperJson as StillImageFilmEmbedResourceWrapperJson, index_StillImageFilmLinkResourceJson as StillImageFilmLinkResourceJson, index_StillImageFilmLinkResourceWrapperJson as StillImageFilmLinkResourceWrapperJson, index_StillImageFilmResourceJson as StillImageFilmResourceJson, index_StillImageFilmResourceWrapperJson as StillImageFilmResourceWrapperJson, index_StreamWriter as StreamWriter, index_StringWriter as StringWriter, index_SymbolMark as SymbolMark, index_SymbolMarkAttibutes as SymbolMarkAttibutes, index_TableCellJson as TableCellJson, index_TableExtendedJson as TableExtendedJson, index_TableJson as TableJson, index_TableRowJson as TableRowJson, index_TableSectionJson as TableSectionJson, index_TaskItemTextNode as TaskItemTextNode, index_TaskItemTextNodeAttributes as TaskItemTextNodeAttributes, index_TechnicalTermJson as TechnicalTermJson, index_TextAndIconJson as TextAndIconJson, index_TextAst as TextAst, index_TextFormatType as TextFormatType, index_TextJsonOptions as TextJsonOptions, TextLocation$1 as TextLocation, index_TextLocationType as TextLocationType, index_TextMark as TextMark, index_TextMarkAttibutes as TextMarkAttibutes, index_TextMarkType as TextMarkType, index_TextMarkTypeType as TextMarkTypeType, index_TextNode as TextNode, index_TextNodeAttibutes as TextNodeAttibutes, index_TextNodeType as TextNodeType, index_TextNodeTypeType as TextNodeTypeType, index_UnbreakscapeOptions as UnbreakscapeOptions, index_UpgradeOptions as UpgradeOptions, index_VideoEmbedResourceJson as VideoEmbedResourceJson, index_VideoEmbedResourceWrapperJson as VideoEmbedResourceWrapperJson, index_VideoLinkResourceJson as VideoLinkResourceJson, index_VideoLinkResourceWrapperJson as VideoLinkResourceWrapperJson, index_VideoResourceJson as VideoResourceJson, index_VideoResourceWrapperJson as VideoResourceWrapperJson, index_WebsiteLinkResourceJson as WebsiteLinkResourceJson, index_WebsiteLinkResourceWrapperJson as WebsiteLinkResourceWrapperJson, index_XRefMark as XRefMark, index_XRefMarkAttibutes as XRefMarkAttibutes, index_bitmarkTextParse as bitmarkTextParse, index_isPseudoAst as isPseudoAst };
374
+ }
375
+
186
376
  /**
187
377
  * Get the version of the @gmb/bitmark-parser library.
188
378
  *
@@ -307,4 +497,4 @@ declare function info(options?: InfoOptions): string;
307
497
  */
308
498
  declare function generate(input: string, options?: ParseOptions): string;
309
499
 
310
- export { type BitSlice, type BitView, type BreakscapeOptions, type ConvertOptions, type InfoFormat, type InfoOptions, type InfoType, type InputFormat, type LexOptions, type LexStage, type NormalizeOptions, type OutputFormat, type OutputMode, type ParseOptions, type PatchEntry, type PatchOp, type PostHook, type PreHook, type PreHookResult, type TextFormat, type TextLocation, type TransformOptions, breakscapeText, canonicalize, convert, countBits, expand, fullize, generate, info, lex, optimize, parse, splitBits, transform, transformParallel, unbreakscapeText, version };
500
+ export { type BitSlice, type BitView, type BreakscapeOptions, type ConvertOptions, type InfoFormat, type InfoOptions, type InfoType, type InputFormat, type LexOptions, type LexStage, type NormalizeOptions, type OutputFormat, type OutputMode, type ParseOptions, type PatchEntry, type PatchOp, type PostHook, type PreHook, type PreHookResult, type TextFormat, type TextLocation, type TransformOptions, breakscapeText, canonicalize, convert, countBits, expand, fullize, generate, info, index as legacy, lex, optimize, parse, splitBits, transform, transformParallel, unbreakscapeText, version };