@gmb/bitmark-parser 7.6.0 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -1
- package/config/bitmark.json +2 -2
- package/dist/browser/bitmark-parser.min.js +6 -6
- package/dist/browser/bitmark-parser.min.js.map +1 -1
- package/dist/browser/cjs/index.cjs +669 -241
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +104 -7
- package/dist/browser/esm/index.d.ts +104 -7
- package/dist/browser/esm/index.js +668 -241
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/esm/worker-entry.js +626 -233
- package/dist/browser/esm/worker-entry.js.map +1 -1
- package/dist/browser/wasm/bitmark_browser_full_wasm_bg.wasm +0 -0
- package/dist/browser/wasm/bitmark_json_wasm_bg.wasm +0 -0
- package/dist/browser/wasm/bitmark_wasm_bg.wasm +0 -0
- package/dist/index.cjs +39 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +104 -7
- package/dist/index.d.ts +104 -7
- package/dist/index.js +38 -4
- package/dist/index.js.map +1 -1
- package/dist/legacy.cjs +1 -1
- package/dist/legacy.cjs.map +1 -1
- package/dist/legacy.js +1 -1
- package/dist/legacy.js.map +1 -1
- package/dist/worker-entry.cjs.map +1 -1
- package/package.json +7 -7
- package/schema/bitmark.schema.json +1 -1
- package/wasm/bitmark_wasm.d.ts +65 -31
- package/wasm/bitmark_wasm.js +288 -122
- package/wasm/bitmark_wasm_bg.wasm +0 -0
- package/wasm/bitmark_wasm_bg.wasm.d.ts +6 -1
- package/wasm/package.json +1 -1
- package/wasm-bitmark-json/bitmark_json_wasm.d.ts +72 -38
- package/wasm-bitmark-json/bitmark_json_wasm.js +301 -135
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +6 -1
- package/wasm-bitmark-json/package.json +1 -1
- package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +65 -31
- package/wasm-browser-full/bitmark_browser_full_wasm.js +288 -122
- package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm +0 -0
- package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm.d.ts +6 -1
- package/wasm-browser-full/package.json +1 -1
package/dist/legacy.cjs
CHANGED
|
@@ -119,7 +119,7 @@ function initLegacyNode(provider) {
|
|
|
119
119
|
// src/generated/package_info.ts
|
|
120
120
|
var PACKAGE_INFO = {
|
|
121
121
|
"name": "@gmb/bitmark-parser",
|
|
122
|
-
"version": "7.
|
|
122
|
+
"version": "7.7.0",
|
|
123
123
|
"author": "Get More Brain Ltd <info@getmorebrain.com>",
|
|
124
124
|
"license": "ISC",
|
|
125
125
|
"description": "A parser for bitmark text, powered by WebAssembly."
|
package/dist/legacy.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/legacy-entry.ts","../../../node_modules/tsup/assets/cjs_shims.js","../src/node/legacy-init.ts","../src/legacy/runtime.ts","../src/generated/package_info.ts","../src/legacy/errors.ts","../src/legacy/translate.ts","../src/legacy/pseudo-ast.ts","../src/legacy/generated/resource-collection-keys.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: LEGACY-Facade\n// Subpath entry: `@gmb/bitmark-parser/legacy` (Node). Re-exports the legacy\n// namespace flat, so bpg consumers can migrate with only an import change:\n//\n// import { BitmarkParserGenerator } from \"@gmb/bitmark-parser/legacy\";\n\nimport { createRequire } from \"node:module\";\nimport { initLegacyNode } from \"./node/legacy-init.js\";\n\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\ninitLegacyNode(() => wasm);\n\nexport * from \"./legacy/index.js\";\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","// @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, setLegacyWasmProvider, type LegacyWasm } from \"../legacy/runtime.js\";\n\n/**\n * `provider` is consulted per legacy call (PLAN-166): it can load the wasm\n * lazily and always reflects the active variant after an init swap.\n */\nexport function initLegacyNode(provider: () => LegacyWasm): void {\n setLegacyWasmProvider(provider);\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 includeUnknownProperties: boolean,\n mappingReport: boolean,\n /** `semantic-tokens` output only (PLAN-193); the legacy facade passes `\"\"`. */\n positionEncoding: string,\n tokensLayout: string,\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(\n infoType: string,\n format: string,\n bit: string,\n pretty: boolean,\n indent: number,\n includeDeprecated: boolean,\n onlyDeprecated: boolean,\n full: boolean,\n language: string,\n ): 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 wasmProvider: (() => LegacyWasm) | undefined;\n\nexport function setLegacyWasm(wasm: LegacyWasm): void {\n wasmProvider = () => wasm;\n}\n\n/**\n * Provide the WASM module lazily (PLAN-166): the provider is consulted on\n * every legacy call, so it can defer loading and always reflects the ACTIVE\n * variant after an `init({ feature })` swap.\n */\nexport function setLegacyWasmProvider(provider: () => LegacyWasm): void {\n wasmProvider = provider;\n}\n\nexport function getLegacyWasm(): LegacyWasm {\n if (!wasmProvider) {\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 wasmProvider();\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","// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"7.6.0\",\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: 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 // The option TYPES are narrowed to the supported values (build-time\n // errors for TS consumers), but JS callers can still pass anything —\n // keep validating the runtime values (hence the widening casts).\n // Booleans error only when set truthy (false === bpg default behaviour).\n if (o.explicitTextFormat) unsupportedOption(\"bitmarkOptions.explicitTextFormat\");\n // prettifyJson: honoured — maps to the core's pretty/indent for bitmark\n // output (embedded JSON bodies of json-format bits); see prettyIndent().\n if ((o.cardSetVersion as number | undefined) === 1) {\n unsupportedOption(\"bitmarkOptions.cardSetVersion: 1\", V3_ONLY);\n }\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 // excludeUnknownProperties: honoured — maps to the core's inverse\n // `includeUnknownProperties` flag (bpg default: include; see bpg-class).\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/**\n * bpg `prettify?: boolean | number` → core (pretty, indent).\n *\n * Also used for `bitmarkOptions.prettifyJson` (identical bpg semantics:\n * true → indent 2, positive number → that indent, else off) — for bitmark\n * output the core's pretty/indent prettify the embedded JSON bodies of\n * json-format bits, which is exactly what bpg's prettifyJson did.\n */\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","// GENERATED FILE — do not edit.\n// Emitted by scripts/gen-legacy-resource-keys.mjs from\n// resources/bitmark-configurator/bitmark.json. Regenerate via `npm run init`.\n//\n// Every bit whose config maps a repeatable resource tag group onto a single\n// JSON collection key. The legacy `Builder.buildBit` routes bpg's\n// `resources` input onto this key (bpg's JsonGenerator special-cased the\n// same family by bit type; here it is derived from config).\n\n/** A bit's resource-collection mapping: target JSON key + accepted resource type. */\nexport interface ResourceCollection {\n key: string;\n resourceType: string;\n}\n\nexport const RESOURCE_COLLECTION_KEYS: Readonly<Record<string, ResourceCollection>> = {\n \"extractor-image\": { key: \"images\", resourceType: \"image\" },\n \"extractor-image-collapsible\": { key: \"images\", resourceType: \"image\" },\n \"images-logo-grave\": { key: \"logos\", resourceType: \"image\" },\n \"prototype-images\": { key: \"images\", resourceType: \"image\" },\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 { RESOURCE_COLLECTION_KEYS } from \"./generated/resource-collection-keys.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/**\n * Config `bodyFormat` → bpg TextFormat value. When the caller omits\n * `textFormat`, bpg defaults to the bit config's `textFormatDefault`\n * (bpg Builder.bit), which is derived from the config `bodyFormat` — NOT\n * to bitmark text. E.g. `extractor-information` (bodyFormat: json) built\n * without an explicit `textFormat` must keep its JSON body verbatim.\n */\nconst CONFIG_BODY_FORMAT_TO_TEXT_FORMAT: Record<string, string> = {\n bitmark: \"bitmark++\",\n text: \"text\",\n json: \"json\",\n latex: \"latex\",\n xml: \"xml\",\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 *\n * `resources` follows bpg's JsonGenerator routing: on a bit whose config\n * maps a repeatable resource tag group onto a collection key (e.g.\n * `images` / `logos` — see the generated RESOURCE_COLLECTION_KEYS), the\n * matching-type entries land under that key; on every other bit the first\n * entry becomes the canonical single `resource` (as bpg: \"if there is\n * more than one resource, use the first one\").\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 const bitConfig = this.getBitConfig(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 } else {\n // bpg parity: `textFormat ?? bitConfig.textFormatDefault` — the\n // config-driven default, so e.g. JSON-bodied bits don't get their\n // body mangled by the bitmark text parser (see parseStringTexts).\n bit.format = CONFIG_BODY_FORMAT_TO_TEXT_FORMAT[bitConfig.bodyFormat ?? \"\"] ?? \"bitmark++\";\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 → the bit's resource-collection key (config-derived), else\n // the canonical single `resource` — bpg's JsonGenerator routing.\n const resources = src.resources;\n if (resources !== undefined && bitType !== undefined) {\n const list = Array.isArray(resources) ? resources : [resources];\n const collection = RESOURCE_COLLECTION_KEYS[bitType];\n if (collection) {\n // bpg keeps only the entries of the collection's resource type.\n bit[collection.key] = list.filter(\n (r) =>\n r !== null &&\n typeof r === \"object\" &&\n (r as { type?: unknown }).type === collection.resourceType,\n );\n } else if (list.length >= 1) {\n bit.resource = list[0];\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, false, false, \"\", \"\");\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 * A string body is dispatched on the bit's resolved text format, as bpg's\n * buildBody: bitmark text is parsed to TextAst, `json` is JSON.parsed\n * (unparseable → null), and plain-text formats (text/latex/xml) stay\n * verbatim. Tag texts are always bitmark text, independent of body format\n * (bpg TextParser.toAst ignores format; only location matters).\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\") {\n if (format === \"json\") {\n // bpg handleJsonBody: parse legacy string bodies; null on failure\n try {\n bit.body = JSON.parse(bit.body) as unknown;\n } catch {\n bit.body = null;\n }\n } else if (bitmarkBody) {\n bit.body = toAst(bit.body, \"body\");\n }\n // plain-text formats (text/latex/xml): body stays a verbatim string\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 /**\n * Look up the bit's config (`wasm.info`); throws bpg's exact\n * bit-type-invalid error (`Config.getBitConfig` parity).\n */\n private getBitConfig(bitType: string | undefined): { bodyFormat?: string } {\n const wasm = getLegacyWasm();\n if (bitType !== undefined) {\n try {\n const info = JSON.parse(wasm.info(\"bit\", \"json\", bitType, false, 2, false, false, true, \"\")) as {\n error?: string;\n body?: { format?: string };\n };\n // PLAN-149 restructured the info JSON: bodyFormat now lives at\n // `body.format`; adapt to the legacy flat shape callers expect.\n if (info.error === undefined) return { bodyFormat: info.body?.format };\n } catch {\n // fall through to the not-found error\n }\n }\n throw new Error(`No config found for bit: ${bitType}`);\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 // bpg parity: `jsonOptions.prettify` governs JSON output only;\n // `bitmarkOptions.prettifyJson` governs bitmark output (it prettifies the\n // embedded JSON bodies of json-format bits — same boolean|number shape).\n const { pretty, indent } = prettyIndent(jsonOptions.prettify);\n const emit =\n coreFormat === \"bitmark\" ? prettyIndent(bitmarkOptions.prettifyJson) : { pretty, indent };\n const spaces = spacesAround(bitmarkOptions.spacesAroundValues);\n // bpg parity: unknown properties are included in JSON output unless\n // `jsonOptions.excludeUnknownProperties` is set (the core flag is the\n // inverse and only affects the bitmark → JSON direction).\n const includeUnknown = !jsonOptions.excludeUnknownProperties;\n\n const out = wasm.convert(source, isBitmark ? \"bitmark\" : \"json\", coreFormat, \"optimized\", emit.pretty, emit.indent, spaces, includeUnknown, false, \"\", \"\");\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 // Same routing as convert(): bitmark in → bitmark out, so prettifyJson\n // applies; JSON in → JSON out, so jsonOptions.prettify applies.\n const { pretty, indent } = prettyIndent(\n isBitmark ? bitmarkOptions.prettifyJson : jsonOptions.prettify,\n );\n const spaces = spacesAround(bitmarkOptions.spacesAroundValues);\n\n const out = wasm.canonicalize(source, isBitmark ? \"bitmark\" : \"json\", \"optimized\", pretty, indent, spaces);\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 // full=true: the legacy facade keeps the rich info shape (bpg parity).\n // The legacy (bpg-compatible) surface is English-only by definition.\n const out = wasm.info(type, coreFormat, opts.bit ?? \"\", pretty, indent, false, false, true, \"\");\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, false, false, \"\", \"\");\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, false, false, \"\", \"\");\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, false, false, \"\", \"\");\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 // bpg's AST carries extraProperties unconditionally (createAst has no\n // jsonOptions), so unknown properties are always included here.\n const out = wasm.convert(source, isBitmark ? \"bitmark\" : \"json\", \"json\", \"optimized\", false, 2, 1, true, false, \"\", \"\");\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 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 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 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 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, false, false, \"\", \"\");\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}\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 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\nexport type 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\n/** @internal */\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 cardBody: \"cardBody\",\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// Strict option policy, surfaced at BUILD time (bpg declared these wider):\n// options this facade cannot honour are narrowed to their supported value(s)\n// — truthy-throws booleans to `false`, value-gated enums to the supported\n// literal — so TS consumers get a type error instead of only the runtime\n// LegacyUnsupportedError. The runtime validation stays (JS callers, or TS\n// with the type ignored, still get the loud error).\n\n/** Options for bitmark generation */\nexport interface BitmarkOptions {\n /** Not supported — `true` throws `LegacyUnsupportedError` at runtime. */\n explicitTextFormat?: false;\n prettifyJson?: boolean | number;\n /** bitmark v3 only — card set version `1` throws `LegacyUnsupportedError` at runtime. */\n cardSetVersion?: typeof CardSetVersion.v2;\n spacesAroundValues?: number | boolean;\n /** Not supported — `true` throws `LegacyUnsupportedError` at runtime. */\n debugGenerationInline?: false;\n /** Not supported — `true` throws `LegacyUnsupportedError` at runtime. */\n noBreakscaping?: false;\n}\n\n/** Options for JSON generation */\nexport interface JsonOptions {\n enableWarnings?: boolean | number;\n prettify?: boolean | number;\n stringify?: boolean;\n /** bitmark v3 only — `true` throws `LegacyUnsupportedError` at runtime. */\n textAsPlainText?: false;\n /**\n * Exclude unknown properties from the JSON output (default: `false` —\n * unknown properties are included, as bpg). The parser's warning text\n * references the new API's inverse flag (`includeUnknownProperties`).\n */\n excludeUnknownProperties?: boolean;\n /** Not supported — `true` throws `LegacyUnsupportedError` at runtime. */\n debugGenerationInline?: false;\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 /** bitmark v3 only — version `2` throws `LegacyUnsupportedError` at runtime. */\n bitmarkVersion?: typeof BitmarkVersion.v3;\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 /** bitmark v3 only — version `2` throws `LegacyUnsupportedError` at runtime. */\n bitmarkVersion?: typeof BitmarkVersion.v3;\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 /** Not supported — `true` throws `LegacyUnsupportedError` at runtime. */\n noBreakscaping?: false;\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 // includeDeprecated: bpg's BitType enum carries the deprecated bit\n // types too (PLAN-149 hides them from listings by default).\n const all = JSON.parse(wasm.info(\"all\", \"json\", \"\", false, 2, true, false, false, \"\")) as {\n name: string;\n }[];\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;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;;;ADN9D,yBAA8B;;;AEF9B,SAAoB;AACpB,WAAsB;;;AC0CtB,IAAI;AAWG,SAAS,sBAAsB,UAAkC;AACtE,iBAAe;AACjB;AAEO,SAAS,gBAA4B;AAC1C,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO,aAAa;AACtB;AAUA,IAAI;AAEG,SAAS,gBAAgB,IAAwB;AACtD,WAAS;AACX;A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wasm","wasm","out","wasm","require"]}
|
|
1
|
+
{"version":3,"sources":["../src/legacy-entry.ts","../../../node_modules/tsup/assets/cjs_shims.js","../src/node/legacy-init.ts","../src/legacy/runtime.ts","../src/generated/package_info.ts","../src/legacy/errors.ts","../src/legacy/translate.ts","../src/legacy/pseudo-ast.ts","../src/legacy/generated/resource-collection-keys.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: LEGACY-Facade\n// Subpath entry: `@gmb/bitmark-parser/legacy` (Node). Re-exports the legacy\n// namespace flat, so bpg consumers can migrate with only an import change:\n//\n// import { BitmarkParserGenerator } from \"@gmb/bitmark-parser/legacy\";\n\nimport { createRequire } from \"node:module\";\nimport { initLegacyNode } from \"./node/legacy-init.js\";\n\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\ninitLegacyNode(() => wasm);\n\nexport * from \"./legacy/index.js\";\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","// @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, setLegacyWasmProvider, type LegacyWasm } from \"../legacy/runtime.js\";\n\n/**\n * `provider` is consulted per legacy call (PLAN-166): it can load the wasm\n * lazily and always reflects the active variant after an init swap.\n */\nexport function initLegacyNode(provider: () => LegacyWasm): void {\n setLegacyWasmProvider(provider);\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 includeUnknownProperties: boolean,\n mappingReport: boolean,\n /** `semantic-tokens` output only (PLAN-193); the legacy facade passes `\"\"`. */\n positionEncoding: string,\n tokensLayout: string,\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(\n infoType: string,\n format: string,\n bit: string,\n pretty: boolean,\n indent: number,\n includeDeprecated: boolean,\n onlyDeprecated: boolean,\n full: boolean,\n language: string,\n ): 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 wasmProvider: (() => LegacyWasm) | undefined;\n\nexport function setLegacyWasm(wasm: LegacyWasm): void {\n wasmProvider = () => wasm;\n}\n\n/**\n * Provide the WASM module lazily (PLAN-166): the provider is consulted on\n * every legacy call, so it can defer loading and always reflects the ACTIVE\n * variant after an `init({ feature })` swap.\n */\nexport function setLegacyWasmProvider(provider: () => LegacyWasm): void {\n wasmProvider = provider;\n}\n\nexport function getLegacyWasm(): LegacyWasm {\n if (!wasmProvider) {\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 wasmProvider();\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","// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"7.7.0\",\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: 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 // The option TYPES are narrowed to the supported values (build-time\n // errors for TS consumers), but JS callers can still pass anything —\n // keep validating the runtime values (hence the widening casts).\n // Booleans error only when set truthy (false === bpg default behaviour).\n if (o.explicitTextFormat) unsupportedOption(\"bitmarkOptions.explicitTextFormat\");\n // prettifyJson: honoured — maps to the core's pretty/indent for bitmark\n // output (embedded JSON bodies of json-format bits); see prettyIndent().\n if ((o.cardSetVersion as number | undefined) === 1) {\n unsupportedOption(\"bitmarkOptions.cardSetVersion: 1\", V3_ONLY);\n }\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 // excludeUnknownProperties: honoured — maps to the core's inverse\n // `includeUnknownProperties` flag (bpg default: include; see bpg-class).\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/**\n * bpg `prettify?: boolean | number` → core (pretty, indent).\n *\n * Also used for `bitmarkOptions.prettifyJson` (identical bpg semantics:\n * true → indent 2, positive number → that indent, else off) — for bitmark\n * output the core's pretty/indent prettify the embedded JSON bodies of\n * json-format bits, which is exactly what bpg's prettifyJson did.\n */\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","// GENERATED FILE — do not edit.\n// Emitted by scripts/gen-legacy-resource-keys.mjs from\n// resources/bitmark-configurator/bitmark.json. Regenerate via `npm run init`.\n//\n// Every bit whose config maps a repeatable resource tag group onto a single\n// JSON collection key. The legacy `Builder.buildBit` routes bpg's\n// `resources` input onto this key (bpg's JsonGenerator special-cased the\n// same family by bit type; here it is derived from config).\n\n/** A bit's resource-collection mapping: target JSON key + accepted resource type. */\nexport interface ResourceCollection {\n key: string;\n resourceType: string;\n}\n\nexport const RESOURCE_COLLECTION_KEYS: Readonly<Record<string, ResourceCollection>> = {\n \"extractor-image\": { key: \"images\", resourceType: \"image\" },\n \"extractor-image-collapsible\": { key: \"images\", resourceType: \"image\" },\n \"images-logo-grave\": { key: \"logos\", resourceType: \"image\" },\n \"prototype-images\": { key: \"images\", resourceType: \"image\" },\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 { RESOURCE_COLLECTION_KEYS } from \"./generated/resource-collection-keys.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/**\n * Config `bodyFormat` → bpg TextFormat value. When the caller omits\n * `textFormat`, bpg defaults to the bit config's `textFormatDefault`\n * (bpg Builder.bit), which is derived from the config `bodyFormat` — NOT\n * to bitmark text. E.g. `extractor-information` (bodyFormat: json) built\n * without an explicit `textFormat` must keep its JSON body verbatim.\n */\nconst CONFIG_BODY_FORMAT_TO_TEXT_FORMAT: Record<string, string> = {\n bitmark: \"bitmark++\",\n text: \"text\",\n json: \"json\",\n latex: \"latex\",\n xml: \"xml\",\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 *\n * `resources` follows bpg's JsonGenerator routing: on a bit whose config\n * maps a repeatable resource tag group onto a collection key (e.g.\n * `images` / `logos` — see the generated RESOURCE_COLLECTION_KEYS), the\n * matching-type entries land under that key; on every other bit the first\n * entry becomes the canonical single `resource` (as bpg: \"if there is\n * more than one resource, use the first one\").\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 const bitConfig = this.getBitConfig(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 } else {\n // bpg parity: `textFormat ?? bitConfig.textFormatDefault` — the\n // config-driven default, so e.g. JSON-bodied bits don't get their\n // body mangled by the bitmark text parser (see parseStringTexts).\n bit.format = CONFIG_BODY_FORMAT_TO_TEXT_FORMAT[bitConfig.bodyFormat ?? \"\"] ?? \"bitmark++\";\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 → the bit's resource-collection key (config-derived), else\n // the canonical single `resource` — bpg's JsonGenerator routing.\n const resources = src.resources;\n if (resources !== undefined && bitType !== undefined) {\n const list = Array.isArray(resources) ? resources : [resources];\n const collection = RESOURCE_COLLECTION_KEYS[bitType];\n if (collection) {\n // bpg keeps only the entries of the collection's resource type.\n bit[collection.key] = list.filter(\n (r) =>\n r !== null &&\n typeof r === \"object\" &&\n (r as { type?: unknown }).type === collection.resourceType,\n );\n } else if (list.length >= 1) {\n bit.resource = list[0];\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, false, false, \"\", \"\");\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 * A string body is dispatched on the bit's resolved text format, as bpg's\n * buildBody: bitmark text is parsed to TextAst, `json` is JSON.parsed\n * (unparseable → null), and plain-text formats (text/latex/xml) stay\n * verbatim. Tag texts are always bitmark text, independent of body format\n * (bpg TextParser.toAst ignores format; only location matters).\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\") {\n if (format === \"json\") {\n // bpg handleJsonBody: parse legacy string bodies; null on failure\n try {\n bit.body = JSON.parse(bit.body) as unknown;\n } catch {\n bit.body = null;\n }\n } else if (bitmarkBody) {\n bit.body = toAst(bit.body, \"body\");\n }\n // plain-text formats (text/latex/xml): body stays a verbatim string\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 /**\n * Look up the bit's config (`wasm.info`); throws bpg's exact\n * bit-type-invalid error (`Config.getBitConfig` parity).\n */\n private getBitConfig(bitType: string | undefined): { bodyFormat?: string } {\n const wasm = getLegacyWasm();\n if (bitType !== undefined) {\n try {\n const info = JSON.parse(wasm.info(\"bit\", \"json\", bitType, false, 2, false, false, true, \"\")) as {\n error?: string;\n body?: { format?: string };\n };\n // PLAN-149 restructured the info JSON: bodyFormat now lives at\n // `body.format`; adapt to the legacy flat shape callers expect.\n if (info.error === undefined) return { bodyFormat: info.body?.format };\n } catch {\n // fall through to the not-found error\n }\n }\n throw new Error(`No config found for bit: ${bitType}`);\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 // bpg parity: `jsonOptions.prettify` governs JSON output only;\n // `bitmarkOptions.prettifyJson` governs bitmark output (it prettifies the\n // embedded JSON bodies of json-format bits — same boolean|number shape).\n const { pretty, indent } = prettyIndent(jsonOptions.prettify);\n const emit =\n coreFormat === \"bitmark\" ? prettyIndent(bitmarkOptions.prettifyJson) : { pretty, indent };\n const spaces = spacesAround(bitmarkOptions.spacesAroundValues);\n // bpg parity: unknown properties are included in JSON output unless\n // `jsonOptions.excludeUnknownProperties` is set (the core flag is the\n // inverse and only affects the bitmark → JSON direction).\n const includeUnknown = !jsonOptions.excludeUnknownProperties;\n\n const out = wasm.convert(source, isBitmark ? \"bitmark\" : \"json\", coreFormat, \"optimized\", emit.pretty, emit.indent, spaces, includeUnknown, false, \"\", \"\");\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 // Same routing as convert(): bitmark in → bitmark out, so prettifyJson\n // applies; JSON in → JSON out, so jsonOptions.prettify applies.\n const { pretty, indent } = prettyIndent(\n isBitmark ? bitmarkOptions.prettifyJson : jsonOptions.prettify,\n );\n const spaces = spacesAround(bitmarkOptions.spacesAroundValues);\n\n const out = wasm.canonicalize(source, isBitmark ? \"bitmark\" : \"json\", \"optimized\", pretty, indent, spaces);\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 // full=true: the legacy facade keeps the rich info shape (bpg parity).\n // The legacy (bpg-compatible) surface is English-only by definition.\n const out = wasm.info(type, coreFormat, opts.bit ?? \"\", pretty, indent, false, false, true, \"\");\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, false, false, \"\", \"\");\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, false, false, \"\", \"\");\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, false, false, \"\", \"\");\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 // bpg's AST carries extraProperties unconditionally (createAst has no\n // jsonOptions), so unknown properties are always included here.\n const out = wasm.convert(source, isBitmark ? \"bitmark\" : \"json\", \"json\", \"optimized\", false, 2, 1, true, false, \"\", \"\");\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 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 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 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 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, false, false, \"\", \"\");\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}\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 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\nexport type 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\n/** @internal */\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 cardBody: \"cardBody\",\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// Strict option policy, surfaced at BUILD time (bpg declared these wider):\n// options this facade cannot honour are narrowed to their supported value(s)\n// — truthy-throws booleans to `false`, value-gated enums to the supported\n// literal — so TS consumers get a type error instead of only the runtime\n// LegacyUnsupportedError. The runtime validation stays (JS callers, or TS\n// with the type ignored, still get the loud error).\n\n/** Options for bitmark generation */\nexport interface BitmarkOptions {\n /** Not supported — `true` throws `LegacyUnsupportedError` at runtime. */\n explicitTextFormat?: false;\n prettifyJson?: boolean | number;\n /** bitmark v3 only — card set version `1` throws `LegacyUnsupportedError` at runtime. */\n cardSetVersion?: typeof CardSetVersion.v2;\n spacesAroundValues?: number | boolean;\n /** Not supported — `true` throws `LegacyUnsupportedError` at runtime. */\n debugGenerationInline?: false;\n /** Not supported — `true` throws `LegacyUnsupportedError` at runtime. */\n noBreakscaping?: false;\n}\n\n/** Options for JSON generation */\nexport interface JsonOptions {\n enableWarnings?: boolean | number;\n prettify?: boolean | number;\n stringify?: boolean;\n /** bitmark v3 only — `true` throws `LegacyUnsupportedError` at runtime. */\n textAsPlainText?: false;\n /**\n * Exclude unknown properties from the JSON output (default: `false` —\n * unknown properties are included, as bpg). The parser's warning text\n * references the new API's inverse flag (`includeUnknownProperties`).\n */\n excludeUnknownProperties?: boolean;\n /** Not supported — `true` throws `LegacyUnsupportedError` at runtime. */\n debugGenerationInline?: false;\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 /** bitmark v3 only — version `2` throws `LegacyUnsupportedError` at runtime. */\n bitmarkVersion?: typeof BitmarkVersion.v3;\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 /** bitmark v3 only — version `2` throws `LegacyUnsupportedError` at runtime. */\n bitmarkVersion?: typeof BitmarkVersion.v3;\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 /** Not supported — `true` throws `LegacyUnsupportedError` at runtime. */\n noBreakscaping?: false;\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 // includeDeprecated: bpg's BitType enum carries the deprecated bit\n // types too (PLAN-149 hides them from listings by default).\n const all = JSON.parse(wasm.info(\"all\", \"json\", \"\", false, 2, true, false, false, \"\")) as {\n name: string;\n }[];\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;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EA,IAAM,gBACJ;AACF,IAAM,kBAAkB;AAGjB,IAAM,MAAM,UAAU,OAAO,aAAa;AAE1C,IAAM,mBAAmB,UAAU,oBAAoB,eAAe;AACtE,IAAM,yBAAyB,UAAU,0BAA0B,eAAe;AAClF,IAAM,uBAAuB,UAAU,wBAAwB,eAAe;AAC9E,IAAM,gBAAgB,UAAU,iBAAiB,eAAe;AAChE,IAAM,sBAAsB,UAAU,uBAAuB,eAAe;AAC5E,IAAM,oBAAoB,UAAU,qBAAqB,eAAe;AACxE,IAAM,qBAAqB,UAAU,sBAAsB,eAAe;AAC1E,IAAM,kBAAkB,UAAU,mBAAmB,eAAe;AACpE,IAAM,gBAAgB,UAAU,iBAAiB,eAAe;AAChE,IAAM,aAAa,UAAU,cAAc,eAAe;AAC1D,IAAM,eAAe,UAAU,gBAAgB,eAAe;AAC9D,IAAM,aAAa,UAAU,cAAc,eAAe;AAC1D,IAAM,eAAe,UAAU,gBAAgB,eAAe;;;Ad3BrE,IAAMC,eAAU,kCAAc,aAAe;AAC7C,IAAM,OAAOA,SAAQ,yBAAyB;AAC9C,eAAe,MAAM,IAAI;","names":["wasm","wasm","out","wasm","require"]}
|
package/dist/legacy.js
CHANGED
|
@@ -45,7 +45,7 @@ function initLegacyNode(provider) {
|
|
|
45
45
|
// src/generated/package_info.ts
|
|
46
46
|
var PACKAGE_INFO = {
|
|
47
47
|
"name": "@gmb/bitmark-parser",
|
|
48
|
-
"version": "7.
|
|
48
|
+
"version": "7.7.0",
|
|
49
49
|
"author": "Get More Brain Ltd <info@getmorebrain.com>",
|
|
50
50
|
"license": "ISC",
|
|
51
51
|
"description": "A parser for bitmark text, powered by WebAssembly."
|