@gmb/bitmark-parser 6.11.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +222 -54
- package/dist/browser/bitmark-parser.min.js +4 -4
- package/dist/browser/bitmark-parser.min.js.map +1 -1
- package/dist/browser/cjs/index.cjs +547 -325
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +342 -68
- package/dist/browser/esm/index.d.ts +342 -68
- package/dist/browser/esm/index.js +546 -324
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/esm/worker-entry.js +497 -242
- 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 +51 -88
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +342 -68
- package/dist/index.d.ts +342 -68
- package/dist/index.js +50 -87
- package/dist/index.js.map +1 -1
- package/dist/legacy.cjs +8 -30
- package/dist/legacy.cjs.map +1 -1
- package/dist/legacy.d.cts +0 -2
- package/dist/legacy.d.ts +0 -2
- package/dist/legacy.js +8 -30
- package/dist/legacy.js.map +1 -1
- package/dist/worker-entry.cjs +1 -5
- package/dist/worker-entry.cjs.map +1 -1
- package/package.json +6 -6
- package/schema/bitmark.schema.json +496 -139
- package/wasm/bitmark_wasm.d.ts +27 -23
- package/wasm/bitmark_wasm.js +198 -112
- package/wasm/bitmark_wasm_bg.wasm +0 -0
- package/wasm/bitmark_wasm_bg.wasm.d.ts +2 -2
- package/wasm/package.json +1 -1
- package/wasm-bitmark-json/bitmark_json_wasm.d.ts +18 -12
- package/wasm-bitmark-json/bitmark_json_wasm.js +170 -72
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +1 -1
- package/wasm-bitmark-json/package.json +1 -1
- package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +27 -23
- package/wasm-browser-full/bitmark_browser_full_wasm.js +198 -112
- package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm +0 -0
- package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm.d.ts +2 -2
- package/wasm-browser-full/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../wasm-web/bitmark_wasm.js","../../wasm-web-browser-full/bitmark_browser_full_wasm.js","../../wasm-web-bitmark-json/bitmark_json_wasm.js","../../src/generated/package_info.ts","../../src/core/facade.ts","../../src/core/hooked-transform.ts","../../src/core/parallel.ts","../../src/legacy/runtime.ts","../../src/browser/pool.ts","../../src/legacy/index.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","../../src/types.ts","../../src/core/api.ts","../../src/browser/index.ts"],"names":["bitmark_wasm_exports","__export","breakscape_text","canonicalize","convert","convert_text","count_bits","bitmark_wasm_default","diff","info","initSync","is_bitmark","lex","prettify","register","resolve_patch_document","split_bits","split_json_bits","transform","unbreakscape_text","wasm","WASM_VECTOR_LEN","cachedUint8ArrayMemory0","getUint8ArrayMemory0","cachedTextEncoder","encodeString","arg","view","buf","passStringToWasm0","malloc","realloc","ptr","len","mem","offset","code","ret","cachedDataViewMemory0","getDataViewMemory0","cachedTextDecoder","getStringFromWasm0","input","stage","deferred3_0","deferred3_1","retptr","ptr0","len0","ptr1","len1","r0","r1","format","location","deferred4_0","deferred4_1","ptr2","len2","info_type","bit","pretty","indent","include_deprecated","only_deprecated","full","language","deferred5_0","deferred5_1","ptr3","len3","direction","input_format_sel","output_format_sel","mode","patch_json","spaces_around_values","deferred6_0","deferred6_1","ptr4","len4","a","b","context","locate","similarity","bbox_tolerance","data_type","data","include_unknown_properties","mapping_report","deferred2_0","deferred2_1","json","__wbg_load","module","imports","e","bytes","instance","__wbg_get_imports","__wbg_finalize_init","__wbg_init","module_or_path","bitmark_browser_full_wasm_exports","bitmark_browser_full_wasm_default","bitmark_json_wasm_exports","bitmark_json_wasm_default","PACKAGE_INFO","BROWSER_DEFAULT_FEATURE","NotInitializedError","RegisterError","message","UnsupportedFeatureError","what","active","activeFeature","lazyLoader","registrations","getActive","setActive","feature","type","error","rememberRegistration","variant","isError","s","errorString","m","stripArray","doc","t","patchJsonOf","patch","buildUnits","inputIsBitmark","out","slices","envelopes","env","index","planTransform","options","output","spacesAroundValues","sel","inputFormat","units","total","hooked","result","patchJson","resolved","_","jobs","views","item","hook","computeBit","job","recombine","elements","arr","runHookedTransform","plan","rendered","i","element","orchestrateParallel","runJobs","wasmProvider","setLegacyWasmProvider","provider","getLegacyWasm","runJobsParallel","workers","poolSize","workerUrl","resolve","reject","results","next","settled","done","pool","shutdown","w","fail","err","dispatch","id","ev","res","legacy_exports","Ast","BitType","BitmarkFileGenerator","BitmarkGenerator","BitmarkParser","BitmarkParserGenerator","BitmarkParserType","BitmarkStringGenerator","BitmarkVersion","BodyTextFormat","BoundingBoxIndex","Builder","CardSetVersion","FileWriter","HtmlTableGenerator","HtmlTableParser","InfoFormat","InfoType","Input","InputFormat","JsonFileGenerator","JsonGenerator","JsonParser","JsonStringGenerator","LegacyUnsupportedError","NodeType","Output","ResourceBuilder","StreamWriter","StringWriter","TextLocation","TextMarkType","TextNodeType","bitmarkTextParse","isPseudoAst","unsupportedMember","member","reason","unsupportedOption","option","V3_ONLY","validateVersionOptions","opts","validateBitmarkOptions","o","validateJsonOptions","prettyIndent","spacesAround","v","mapTextFormat","f","PSEUDO_AST_MARKER","makePseudoAst","bits","ast","RESOURCE_COLLECTION_KEYS","BUILT_BIT_PARSER","DATA_KEY_TO_JSON_KEY","DEPRECATED_TEXT_FORMATS","CONFIG_BODY_FORMAT_TO_TEXT_FORMAT","TAG_TEXT_KEYS","_options","src","bitType","bitConfig","textFormat","body","resources","list","collection","r","parser","extraProperties","key","value","built","_context","attrs","stripUndefined","toAst","bitmarkBody","exclude","k","jsonOptions","bitmarkOptions","source","isBitmark","outputFormat","coreFormat","emit","spaces","includeUnknown","inStr","extractHtmlTables","wrapped","isBitmarkText","textLocation","outStr","textAst","n","entries","parsed","entry","wrapper","outputFile","fileOptions","html","tables","lower","start","depth","j","end","open","close","closeEnd","text","RESOURCE_SPECS","buildResource","spec","_typeAlias","rest","inner","SPEC_BY_TYPE","__publicField","resource","single","nodes","asString","obj","url","bitNameToKey","name","c","bitTypeCache","loadBitTypes","all","map","_t","prop","unsupportedEnum","stubClass","WALKER_REASON","INTERNAL_REASON","patchEntry","path","op","ALL_LANGUAGES","bitmarkToObjects","objectsToBitmark","countBits","splitBits","diffBits","breakscapeText","unbreakscapeText","infoType","includeDeprecated","onlyDeprecated","WASM_BASE","VARIANTS","defaultFeatureFor","normalizeInit","initSeq","activeOut","inflight","init","mySeq","promise","version","transformParallel"],"mappings":"iPAAA,IAAAA,EAAAA,CAAA,GAAAC,EAAAA,CAAAD,EAAAA,CAAA,qBAAAE,EAAAA,CAAA,YAAA,CAAA,IAAAC,GAAA,OAAA,CAAA,IAAAC,EAAAA,CAAA,iBAAAC,EAAAA,CAAA,UAAA,CAAA,IAAAC,GAAA,OAAA,CAAA,IAAAC,EAAAA,CAAA,SAAAC,EAAAA,CAAA,IAAA,CAAA,IAAAC,EAAAA,CAAA,QAAA,CAAA,IAAAC,EAAAA,CAAA,UAAA,CAAA,IAAAC,GAAA,GAAA,CAAA,IAAAC,EAAAA,CAAA,aAAAC,EAAAA,CAAA,QAAA,CAAA,IAAAC,GAAA,sBAAA,CAAA,IAAAC,EAAAA,CAAA,UAAA,CAAA,IAAAC,EAAAA,CAAA,eAAA,CAAA,IAAAC,EAAAA,CAAA,cAAAC,EAAAA,C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IAAMtB,CAAAA,CAAUsB,EAAQ,OAAA,EAAWoN,EAAAA,CAAkBpQ,CAAM,CAAA,CACrDoJ,CAAAA,CAAI+G,GAASzO,CAAO,CAAA,CACpBgB,EAAM0G,CAAAA,CAAE,QAAA,CAASpJ,CAAM,CAAA,CAC7B,OAAAyB,EAAAA,CAAUC,CAAAA,CAAS0H,EAAE,EAAE,CAAA,CACvBmH,GAAY7N,CAAAA,CACLA,CACT,CAiGO,SAASkO,EAAAA,EAAkB,CAChC,OAAO/P,EAAAA,CAAa,OACtB,CAqBO,SAASgQ,GACdlU,CAAAA,CACAqG,CAAAA,CAA4B,EAAC,CACZ,CACjB,IAAM3H,CAAAA,CAAOmG,GAAU,CACjBE,CAAAA,CAAmBI,GAAQ,EAAKhB,EAAAA,CACtC,OAAO4D,EAAAA,CAAoBrJ,CAAAA,CAAMsB,EAAOqG,CAAAA,CAAS,CAACY,EAAMqB,CAAAA,GACtDD,EAAAA,CAAgBpB,EAAMqB,CAAAA,CAASvD,CAAO,CACxC,CACF","file":"bitmark-parser.min.js","sourcesContent":["let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Lex bitmark input text, returning one line per token in the same format as\n * the Rust CLI: `{kind:?} {span:?} \"{text}\"`.\n *\n * `stage` selects the lexer pipeline:\n * - `\"lex\"` — combined (default)\n * - `\"lex-json\"` — combined, JSON array output\n * @param {string} input\n * @param {string} stage\n * @returns {string}\n */\nexport function lex(input, stage) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.lex(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, `\"deprecated\"`, `\"bit-groups\"`,\n * or `\"resource-groups\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * `include_deprecated`: include deprecated bits in `list`/`all` (PLAN-149)\n * `only_deprecated`: restrict `list`/`all` to deprecated bits (wins over\n * `include_deprecated`)\n * `full`: complete outline for `bit`/`all` (default is the compact\n * one-line-per-tag view)\n * `language`: BCP-47 tag(s) for display names — \"\" = English, `\"de,fr\"` for\n * several (adds a `titles` map), `\"all\"` for every resolvable language\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @param {boolean} include_deprecated\n * @param {boolean} only_deprecated\n * @param {boolean} full\n * @param {string} language\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent, include_deprecated, only_deprecated, full, language) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(language, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, include_deprecated, only_deprecated, full, ptr3, len3);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred5_0 = r0;\n deferred5_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).\n *\n * `direction`: `\"textToAst\"` | `\"astToText\"` | `\"astToPlainText\"`.\n * `format`: a bitmark text format (`\"bitmark++\"`, `\"bitmark+\"`) parses\n * inline marks; anything else is treated as plain text (textToAst only).\n * `location`: `\"body\"` (default) or `\"tag\"`.\n * Returns the converted fragment, or `error: …`.\n * @param {string} input\n * @param {string} direction\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function convert_text(input, direction, format, location) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred5_0 = r0;\n deferred5_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Apply a patch (a JSON array of patch entries) to every bit and re-emit.\n *\n * `input_format_sel`: `\"auto\"` | `\"bitmark\"` | `\"json\"`.\n * `output_format_sel`: `\"bitmark\"` | `\"json\"` (default json).\n * `patch_json`: the patch entry array (empty string = no patches, i.e. a\n * canonicalizing pass). Parallelism is a JS-side concern (web workers); this\n * runs sequentially. Returns the document text/JSON, or `error: …`.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {string} mode\n * @param {string} patch_json\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function transform(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {\n let deferred6_0;\n let deferred6_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n const ptr4 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len4 = WASM_VECTOR_LEN;\n wasm.transform(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, pretty, indent, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred6_0 = r0;\n deferred6_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);\n }\n}\n\n/**\n * Resolve a patch document against `input` (bitmark or JSON) into the\n * ordered output items, so a JS per-bit planner (hooks, worker pool) can\n * reorder, drop and insert jobs from the one Rust implementation\n * (PLAN-179). Returns a JSON array of\n * `{ \"source\": <original index> | null, \"bit\": <inner bit> | null,\n * \"patch\": [ … ] }`, or `error: …`.\n * @param {string} input\n * @param {string} patch_json\n * @returns {string}\n */\nexport function resolve_patch_document(input, patch_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Semantic diff of two documents (PLAN-179). Flat arguments like every\n * other export:\n * - `input_format`: `\"auto\"` | `\"bitmark\"` | `\"json\"` | a mapping id,\n * applied to both sides;\n * - `output_format`: `\"bitmark\"` (unified-style text) | `\"json\"` |\n * `\"patch\"`;\n * - `context`, `locate`, `similarity`, `bbox_tolerance`,\n * `spaces_around_values` as documented on `DiffOptions`.\n * Returns the diff (empty text / `[]` of unchanged bits / a patch document\n * with no entries when the documents are semantically equal), or\n * `error: …`.\n * @param {string} a\n * @param {string} b\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {number} context\n * @param {boolean} locate\n * @param {number} similarity\n * @param {number} bbox_tolerance\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function diff(a, b, input_format_sel, output_format_sel, context, locate, similarity, bbox_tolerance, spaces_around_values) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(a, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(b, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.diff(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, context, locate, similarity, bbox_tolerance, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred5_0 = r0;\n deferred5_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Register data with the parser process (PLAN-173 P12).\n *\n * `data_type`: `\"translations\"` today. One verb rather than one function per\n * registerable thing — the same discriminated-options idiom as `info`.\n *\n * `data` is the file's own text. Semantics are REPLACE: a second call\n * supersedes the first entirely, and the built-in table (where the variant\n * bakes one) stays underneath. Returns `\"\"` on success, or an\n * `error:`-prefixed message — matching the other string-returning exports.\n *\n * Available in EVERY variant, including those that bake nothing: that is\n * exactly where a consumer must supply the file themselves.\n * @param {string} data_type\n * @param {string} data\n * @returns {string}\n */\nexport function register(data_type, data) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(data_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.register(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Convert between bitmark and JSON with explicit input/output formats + mode.\n *\n * `input_format`: `\"auto\"` (default) | `\"bitmark\"` | `\"json\"`.\n * `output_format`: `\"auto\"` (opposite of input) | `\"bitmark\"` | `\"json\"`.\n * `mode`: `\"optimized\"` (default) | `\"full\"`.\n * `mapping_report`: replace the output with a human-readable report of the\n * input→output mappings, including inputs that are NOT mapped (PLAN-147).\n * Returns the converted text/JSON, or a string prefixed `error:` on failure.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {string} mode\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @param {boolean} include_unknown_properties\n * @param {boolean} mapping_report\n * @returns {string}\n */\nexport function convert(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred5_0 = r0;\n deferred5_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Re-emit input in its own format in canonical form at `mode`.\n *\n * `input_format`: `\"auto\"` (default) | `\"bitmark\"` | `\"json\"` | any config\n * mapping id (`html`, `xml`, …). The output is re-emitted in this same format.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} mode\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function canonicalize(input, input_format_sel, mode, pretty, indent, spaces_around_values) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.canonicalize(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Count the bits in `input` (auto-detecting bitmark vs JSON).\n * Returns the count as a decimal string, or `error: …`.\n * @param {string} input\n * @returns {string}\n */\nexport function count_bits(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.count_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Split a bitmark document into per-bit source slices.\n *\n * Returns a JSON array of `{ index, byteStart, byteEnd, source }`. Lets a JS\n * caller chunk a document at bit boundaries (e.g. to feed a worker pool).\n * @param {string} input\n * @returns {string}\n */\nexport function split_bits(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.split_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection\n * used across the API so a JS caller can resolve `\"auto\"` consistently.\n * @param {string} input\n * @returns {boolean}\n */\nexport function is_bitmark(input) {\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.is_bitmark(ptr0, len0);\n return ret !== 0;\n}\n\n/**\n * Split a JSON document (a top-level array of bit envelopes) into its per-bit\n * envelope objects, returned as a JSON array string. Lets a JS caller iterate\n * JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).\n * Returns `error: …` if the input is not a JSON array of bits.\n * @param {string} input\n * @returns {string}\n */\nexport function split_json_bits(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.split_json_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Pretty-print a compact JSON string with the given indent. Used to format a\n * document recombined on the JS side (the per-bit hook path) so its output\n * matches the in-Rust recombination byte-for-byte.\n * @param {string} json\n * @param {number} indent\n * @returns {string}\n */\nexport function prettify(json, indent) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.prettify(retptr, ptr0, len0, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n","let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Lex bitmark input text, returning one line per token in the same format as\n * the Rust CLI: `{kind:?} {span:?} \"{text}\"`.\n *\n * `stage` selects the lexer pipeline:\n * - `\"lex\"` — combined (default)\n * - `\"lex-json\"` — combined, JSON array output\n * @param {string} input\n * @param {string} stage\n * @returns {string}\n */\nexport function lex(input, stage) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.lex(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, `\"deprecated\"`, `\"bit-groups\"`,\n * or `\"resource-groups\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * `include_deprecated`: include deprecated bits in `list`/`all` (PLAN-149)\n * `only_deprecated`: restrict `list`/`all` to deprecated bits (wins over\n * `include_deprecated`)\n * `full`: complete outline for `bit`/`all` (default is the compact\n * one-line-per-tag view)\n * `language`: BCP-47 tag(s) for display names — \"\" = English, `\"de,fr\"` for\n * several (adds a `titles` map), `\"all\"` for every resolvable language\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @param {boolean} include_deprecated\n * @param {boolean} only_deprecated\n * @param {boolean} full\n * @param {string} language\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent, include_deprecated, only_deprecated, full, language) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(language, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, include_deprecated, only_deprecated, full, ptr3, len3);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred5_0 = r0;\n deferred5_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).\n *\n * `direction`: `\"textToAst\"` | `\"astToText\"` | `\"astToPlainText\"`.\n * `format`: a bitmark text format (`\"bitmark++\"`, `\"bitmark+\"`) parses\n * inline marks; anything else is treated as plain text (textToAst only).\n * `location`: `\"body\"` (default) or `\"tag\"`.\n * Returns the converted fragment, or `error: …`.\n * @param {string} input\n * @param {string} direction\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function convert_text(input, direction, format, location) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred5_0 = r0;\n deferred5_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Apply a patch (a JSON array of patch entries) to every bit and re-emit.\n *\n * `input_format_sel`: `\"auto\"` | `\"bitmark\"` | `\"json\"`.\n * `output_format_sel`: `\"bitmark\"` | `\"json\"` (default json).\n * `patch_json`: the patch entry array (empty string = no patches, i.e. a\n * canonicalizing pass). Parallelism is a JS-side concern (web workers); this\n * runs sequentially. Returns the document text/JSON, or `error: …`.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {string} mode\n * @param {string} patch_json\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function transform(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {\n let deferred6_0;\n let deferred6_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n const ptr4 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len4 = WASM_VECTOR_LEN;\n wasm.transform(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, pretty, indent, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred6_0 = r0;\n deferred6_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);\n }\n}\n\n/**\n * Resolve a patch document against `input` (bitmark or JSON) into the\n * ordered output items, so a JS per-bit planner (hooks, worker pool) can\n * reorder, drop and insert jobs from the one Rust implementation\n * (PLAN-179). Returns a JSON array of\n * `{ \"source\": <original index> | null, \"bit\": <inner bit> | null,\n * \"patch\": [ … ] }`, or `error: …`.\n * @param {string} input\n * @param {string} patch_json\n * @returns {string}\n */\nexport function resolve_patch_document(input, patch_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Semantic diff of two documents (PLAN-179). Flat arguments like every\n * other export:\n * - `input_format`: `\"auto\"` | `\"bitmark\"` | `\"json\"` | a mapping id,\n * applied to both sides;\n * - `output_format`: `\"bitmark\"` (unified-style text) | `\"json\"` |\n * `\"patch\"`;\n * - `context`, `locate`, `similarity`, `bbox_tolerance`,\n * `spaces_around_values` as documented on `DiffOptions`.\n * Returns the diff (empty text / `[]` of unchanged bits / a patch document\n * with no entries when the documents are semantically equal), or\n * `error: …`.\n * @param {string} a\n * @param {string} b\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {number} context\n * @param {boolean} locate\n * @param {number} similarity\n * @param {number} bbox_tolerance\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function diff(a, b, input_format_sel, output_format_sel, context, locate, similarity, bbox_tolerance, spaces_around_values) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(a, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(b, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.diff(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, context, locate, similarity, bbox_tolerance, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred5_0 = r0;\n deferred5_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Register data with the parser process (PLAN-173 P12).\n *\n * `data_type`: `\"translations\"` today. One verb rather than one function per\n * registerable thing — the same discriminated-options idiom as `info`.\n *\n * `data` is the file's own text. Semantics are REPLACE: a second call\n * supersedes the first entirely, and the built-in table (where the variant\n * bakes one) stays underneath. Returns `\"\"` on success, or an\n * `error:`-prefixed message — matching the other string-returning exports.\n *\n * Available in EVERY variant, including those that bake nothing: that is\n * exactly where a consumer must supply the file themselves.\n * @param {string} data_type\n * @param {string} data\n * @returns {string}\n */\nexport function register(data_type, data) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(data_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.register(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Convert between bitmark and JSON with explicit input/output formats + mode.\n *\n * `input_format`: `\"auto\"` (default) | `\"bitmark\"` | `\"json\"`.\n * `output_format`: `\"auto\"` (opposite of input) | `\"bitmark\"` | `\"json\"`.\n * `mode`: `\"optimized\"` (default) | `\"full\"`.\n * `mapping_report`: replace the output with a human-readable report of the\n * input→output mappings, including inputs that are NOT mapped (PLAN-147).\n * Returns the converted text/JSON, or a string prefixed `error:` on failure.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {string} mode\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @param {boolean} include_unknown_properties\n * @param {boolean} mapping_report\n * @returns {string}\n */\nexport function convert(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred5_0 = r0;\n deferred5_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Re-emit input in its own format in canonical form at `mode`.\n *\n * `input_format`: `\"auto\"` (default) | `\"bitmark\"` | `\"json\"` | any config\n * mapping id (`html`, `xml`, …). The output is re-emitted in this same format.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} mode\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function canonicalize(input, input_format_sel, mode, pretty, indent, spaces_around_values) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.canonicalize(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Count the bits in `input` (auto-detecting bitmark vs JSON).\n * Returns the count as a decimal string, or `error: …`.\n * @param {string} input\n * @returns {string}\n */\nexport function count_bits(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.count_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Split a bitmark document into per-bit source slices.\n *\n * Returns a JSON array of `{ index, byteStart, byteEnd, source }`. Lets a JS\n * caller chunk a document at bit boundaries (e.g. to feed a worker pool).\n * @param {string} input\n * @returns {string}\n */\nexport function split_bits(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.split_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection\n * used across the API so a JS caller can resolve `\"auto\"` consistently.\n * @param {string} input\n * @returns {boolean}\n */\nexport function is_bitmark(input) {\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.is_bitmark(ptr0, len0);\n return ret !== 0;\n}\n\n/**\n * Split a JSON document (a top-level array of bit envelopes) into its per-bit\n * envelope objects, returned as a JSON array string. Lets a JS caller iterate\n * JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).\n * Returns `error: …` if the input is not a JSON array of bits.\n * @param {string} input\n * @returns {string}\n */\nexport function split_json_bits(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.split_json_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Pretty-print a compact JSON string with the given indent. Used to format a\n * document recombined on the JS side (the per-bit hook path) so its output\n * matches the in-Rust recombination byte-for-byte.\n * @param {string} json\n * @param {number} indent\n * @returns {string}\n */\nexport function prettify(json, indent) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.prettify(retptr, ptr0, len0, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_browser_full_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n","let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, `\"deprecated\"`, `\"bit-groups\"`,\n * or `\"resource-groups\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * `include_deprecated`: include deprecated bits in `list`/`all` (PLAN-149)\n * `only_deprecated`: restrict `list`/`all` to deprecated bits (wins over\n * `include_deprecated`)\n * `full`: complete outline for `bit`/`all` (default is the compact\n * one-line-per-tag view)\n * `language`: BCP-47 tag(s) for display names — \"\" = English, `\"de,fr\"` for\n * several (adds a `titles` map), `\"all\"` for every resolvable language\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @param {boolean} include_deprecated\n * @param {boolean} only_deprecated\n * @param {boolean} full\n * @param {string} language\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent, include_deprecated, only_deprecated, full, language) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(language, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, include_deprecated, only_deprecated, full, ptr3, len3);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred5_0 = r0;\n deferred5_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Register data with the parser process (PLAN-173 P12).\n *\n * `data_type`: `\"translations\"` today. One verb rather than one function per\n * registerable thing — the same discriminated-options idiom as `info`.\n *\n * `data` is the file's own text. Semantics are REPLACE: a second call\n * supersedes the first entirely, and the built-in table (where the variant\n * bakes one) stays underneath. Returns `\"\"` on success, or an\n * `error:`-prefixed message — matching the other string-returning exports.\n *\n * Available in EVERY variant, including those that bake nothing: that is\n * exactly where a consumer must supply the file themselves.\n * @param {string} data_type\n * @param {string} data\n * @returns {string}\n */\nexport function register(data_type, data) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(data_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.register(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Apply a patch (a JSON array of patch entries) to every bit and re-emit.\n *\n * `input_format_sel`: `\"auto\"` | `\"bitmark\"` | `\"json\"`.\n * `output_format_sel`: `\"bitmark\"` | `\"json\"` (default json).\n * `patch_json`: the patch entry array (empty string = no patches, i.e. a\n * canonicalizing pass). Parallelism is a JS-side concern (web workers); this\n * runs sequentially. Returns the document text/JSON, or `error: …`.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {string} mode\n * @param {string} patch_json\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function transform(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {\n let deferred6_0;\n let deferred6_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n const ptr4 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len4 = WASM_VECTOR_LEN;\n wasm.transform(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, pretty, indent, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred6_0 = r0;\n deferred6_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);\n }\n}\n\n/**\n * Resolve a patch document against `input` (bitmark or JSON) into the\n * ordered output items, so a JS per-bit planner (hooks, worker pool) can\n * reorder, drop and insert jobs from the one Rust implementation\n * (PLAN-179). Returns a JSON array of\n * `{ \"source\": <original index> | null, \"bit\": <inner bit> | null,\n * \"patch\": [ … ] }`, or `error: …`.\n * @param {string} input\n * @param {string} patch_json\n * @returns {string}\n */\nexport function resolve_patch_document(input, patch_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Convert between bitmark and JSON with explicit input/output formats + mode.\n *\n * `input_format`: `\"auto\"` (default) | `\"bitmark\"` | `\"json\"`.\n * `output_format`: `\"auto\"` (opposite of input) | `\"bitmark\"` | `\"json\"`.\n * `mode`: `\"optimized\"` (default) | `\"full\"`.\n * `mapping_report`: replace the output with a human-readable report of the\n * input→output mappings, including inputs that are NOT mapped (PLAN-147).\n * Returns the converted text/JSON, or a string prefixed `error:` on failure.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {string} mode\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @param {boolean} include_unknown_properties\n * @param {boolean} mapping_report\n * @returns {string}\n */\nexport function convert(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred5_0 = r0;\n deferred5_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Re-emit input in its own format in canonical form at `mode`.\n *\n * `input_format`: `\"auto\"` (default) | `\"bitmark\"` | `\"json\"` | any config\n * mapping id (`html`, `xml`, …). The output is re-emitted in this same format.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} mode\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function canonicalize(input, input_format_sel, mode, pretty, indent, spaces_around_values) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.canonicalize(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Count the bits in `input` (auto-detecting bitmark vs JSON).\n * Returns the count as a decimal string, or `error: …`.\n * @param {string} input\n * @returns {string}\n */\nexport function count_bits(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.count_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Split a bitmark document into per-bit source slices.\n *\n * Returns a JSON array of `{ index, byteStart, byteEnd, source }`. Lets a JS\n * caller chunk a document at bit boundaries (e.g. to feed a worker pool).\n * @param {string} input\n * @returns {string}\n */\nexport function split_bits(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.split_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection\n * used across the API so a JS caller can resolve `\"auto\"` consistently.\n * @param {string} input\n * @returns {boolean}\n */\nexport function is_bitmark(input) {\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.is_bitmark(ptr0, len0);\n return ret !== 0;\n}\n\n/**\n * Split a JSON document (a top-level array of bit envelopes) into its per-bit\n * envelope objects, returned as a JSON array string. Lets a JS caller iterate\n * JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).\n * Returns `error: …` if the input is not a JSON array of bits.\n * @param {string} input\n * @returns {string}\n */\nexport function split_json_bits(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.split_json_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Pretty-print a compact JSON string with the given indent. Used to format a\n * document recombined on the JS side (the per-bit hook path) so its output\n * matches the in-Rust recombination byte-for-byte.\n * @param {string} json\n * @param {number} indent\n * @returns {string}\n */\nexport function prettify(json, indent) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.prettify(retptr, ptr0, len0, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).\n *\n * `direction`: `\"textToAst\"` | `\"astToText\"` | `\"astToPlainText\"`.\n * `format`: a bitmark text format (`\"bitmark++\"`, `\"bitmark+\"`) parses\n * inline marks; anything else is treated as plain text (textToAst only).\n * `location`: `\"body\"` (default) or `\"tag\"`.\n * Returns the converted fragment, or `error: …`.\n * @param {string} input\n * @param {string} direction\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function convert_text(input, direction, format, location) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred5_0 = r0;\n deferred5_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_json_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n","// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"6.11.1\",\n \"author\": \"Get More Brain Ltd <info@getmorebrain.com>\",\n \"license\": \"ISC\",\n \"description\": \"A parser for bitmark text, powered by WebAssembly.\"\n};\n","// @zen-component: TS-VariantFacade\n//\n// Runtime variant selection (PLAN-166). The package ships one API surface\n// backed by a mutable reference to the ACTIVE wasm module; `init({ feature })`\n// selects which wasm variant backs it, and a later re-init swaps the module\n// atomically between calls (every wasm call is stateless string → string).\n// Platform entries (Node / browser) own the loading; this module owns the\n// reference, the feature vocabulary, and the error types.\n\n/**\n * A deployable wasm feature set (PLAN-174).\n *\n * - `full` — everything, including the `info` META layer (tag descriptions,\n * group provenance, raw mappingKeys patterns). Native-CLI parity.\n * - `browser-full` — the same conversion capabilities as `full`, minus the\n * meta strings the browser should not pay to download.\n * - `bitmark-json` — bitmark ↔ JSON only.\n *\n * Size gating follows the DELIVERY CHANNEL, not the compilation target: a Node\n * backend loading wasm from disk has native-CLI requirements, while any entry\n * can be bundled for the browser. So every variant is buildable for both\n * targets and richness is always chosen explicitly. The per-entry defaults\n * below are conveniences; the contract is \"you get the variant you selected\".\n */\nexport type Feature = \"full\" | \"browser-full\" | \"bitmark-json\";\n\n/** Default variant for the Node entry — disk-loaded wasm, no download budget. */\nexport const NODE_DEFAULT_FEATURE: Feature = \"full\";\n\n/** Default variant for the browser entry — download latency is the budget. */\nexport const BROWSER_DEFAULT_FEATURE: Feature = \"browser-full\";\n\n/**\n * The wasm surface the shared wrappers drive. `lex` is optional — the\n * `bitmark-json` variant compiles it out (calling it throws\n * {@link UnsupportedFeatureError}).\n */\nexport interface WasmModule {\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 ): string;\n canonicalize(\n input: string,\n inputFormat: string,\n mode: string,\n pretty: boolean,\n indent: number,\n spacesAroundValues: number,\n ): string;\n transform(\n input: string,\n inputFormat: string,\n outputFormat: string,\n mode: string,\n patchJson: string,\n pretty: boolean,\n indent: number,\n spacesAroundValues: number,\n ): string;\n 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 /** Returns `\"\"` on success, or an `error:`-prefixed message. */\n register(dataType: string, data: string): string;\n count_bits(input: string): string;\n split_bits(input: string): string;\n split_json_bits(input: string): 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 breakscape_text(input: string, format: string, location: string): string;\n unbreakscape_text(input: string, format: string, location: string): string;\n /** Resolve a patch document against a document into ordered items (PLAN-179). */\n resolve_patch_document(input: string, patchJson: string): string;\n lex?(input: string, stage: string): string;\n /** Semantic diff (PLAN-179); absent on a variant built without `diff`. */\n diff?(\n a: string,\n b: string,\n inputFormat: string,\n outputFormat: string,\n context: number,\n locate: boolean,\n similarity: number,\n bboxTolerance: number,\n spacesAroundValues: number,\n ): string;\n}\n\n/** Options accepted by `init` / `initSync` on every platform entry. */\nexport interface InitOptions {\n /** Which wasm variant to load. Default: `\"full\"`. */\n feature?: Feature;\n}\n\n/** A call arrived before any wasm module was initialised (browser only). */\nexport class NotInitializedError extends Error {\n constructor() {\n super(\"wasm not initialised: call init() (or init({ feature: … })) first\");\n this.name = \"NotInitializedError\";\n }\n}\n\n/** `register` rejected the supplied data. */\nexport class RegisterError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"RegisterError\";\n }\n}\n\n/** A call needs a capability the ACTIVE wasm variant compiled out. */\nexport class UnsupportedFeatureError extends Error {\n constructor(what: string, active: Feature | undefined) {\n super(\n `${what} is not available in the loaded wasm module` +\n `${active ? ` (feature: \"${active}\")` : \"\"}; init({ feature: \"full\" }) to load it`,\n );\n this.name = \"UnsupportedFeatureError\";\n }\n}\n\nlet active: WasmModule | undefined;\nlet activeFeature: Feature | undefined;\nlet lazyLoader: (() => void) | undefined;\n\n// Data registered through `register`, kept so it can be REPLAYED onto each\n// newly activated module. Each variant is a separate wasm instance with its\n// own memory, so a registration made against one is invisible to the next —\n// and PLAN-166's promise is that swapping variants is invisible to the\n// caller. Keyed by type, because `register` replaces per type.\nconst registrations = new Map<string, string>();\n\n/**\n * The active wasm module. On Node the entry installs a lazy loader, so the\n * first call without an explicit `init` loads the default (`full`) variant\n * synchronously; in the browser an uninitialised call throws\n * {@link NotInitializedError} (wasm instantiation is async there).\n */\nexport function getActive(): WasmModule {\n if (!active && lazyLoader) lazyLoader();\n if (!active) throw new NotInitializedError();\n return active;\n}\n\n/** Swap the active module — the single atomic reference assignment. */\nexport function setActive(feature: Feature, module: WasmModule): void {\n // Replay first: a module that cannot take the registered data must not\n // become active half-configured. The data was accepted once already, so a\n // failure here is a bug worth surfacing rather than swallowing.\n for (const [type, data] of registrations) {\n const error = module.register(type, data);\n if (error) throw new RegisterError(error.replace(/^error:\\s*/, \"\"));\n }\n active = module;\n activeFeature = feature;\n}\n\n/**\n * Remember what `register` accepted, so it survives an `init` swap. Called\n * only after the ACTIVE module has accepted the same data.\n */\nexport function rememberRegistration(type: string, data: string): void {\n registrations.set(type, data);\n}\n\n/**\n * Install the Node lazy default loader (runs on the first call when no\n * explicit `init` happened; must call {@link setActive}).\n */\nexport function setLazyLoader(loader: () => void): void {\n lazyLoader = loader;\n}\n\n/** The active wasm feature, or `undefined` before the first init. */\nexport function variant(): Feature | undefined {\n return activeFeature;\n}\n","// @zen-component: TS-HookedTransform\n\nimport type { BitView, OutputFormat, PatchEntry, TransformOptions } from \"../types.js\";\n\n/**\n * The minimal WASM surface the per-bit hook driver needs. Both the Node and\n * browser entry points satisfy this with their loaded module.\n */\nexport interface HookedWasm {\n is_bitmark(input: string): boolean;\n split_bits(input: string): string;\n split_json_bits(input: string): string;\n prettify(json: string, indent: number): string;\n resolve_patch_document(input: string, patchJson: string): string;\n transform(\n input: string,\n inputFormat: string,\n outputFormat: string,\n mode: string,\n patchJson: string,\n pretty: boolean,\n indent: number,\n spacesAroundValues: number,\n ): string;\n}\n\n/** A single bit's compute job: data only, safe to ship to a worker thread. */\nexport interface BitJob {\n index: number;\n source: string;\n inputFormat: \"bitmark\" | \"json\";\n outputFormat: OutputFormat;\n mode: string;\n patchJson: string;\n spacesAroundValues: number;\n}\n\n/**\n * The result of running `preHook` over a document's bits: the compute `jobs`\n * for the bits that survived (in document order) and the matching `views`\n * (so `postHook` can be called per surviving bit), plus the document-level\n * recombination settings.\n */\nexport interface TransformPlan {\n jobs: BitJob[];\n views: BitView[];\n output: OutputFormat;\n pretty: boolean;\n indent: number;\n}\n\nexport function isError(s: string): boolean {\n return s.startsWith(\"error:\");\n}\n\n/**\n * Normalise a thrown value to an `error:`-prefixed string, without\n * double-prefixing a message that already carries the prefix (split helpers\n * surface WASM `error:` strings as thrown `Error`s).\n */\nexport function errorString(e: unknown): string {\n const m = e instanceof Error ? e.message : String(e);\n return m.startsWith(\"error:\") ? m : `error: ${m}`;\n}\n\n/** Strip the outer `[ … ]` of a compact one-element JSON array. */\nexport function stripArray(doc: string): string {\n const t = doc.trim();\n return t.startsWith(\"[\") && t.endsWith(\"]\") ? t.slice(1, -1) : doc;\n}\n\n/**\n * The `patch` option as the JSON text the WASM resolver takes — a patch\n * document or the bare-array every-bit shorthand — or `\"\"` when absent.\n */\nfunction patchJsonOf(patch: TransformOptions[\"patch\"]): string {\n if (patch === undefined) return \"\";\n if (typeof patch === \"string\") return patch.trim();\n return JSON.stringify(patch);\n}\n\n/** One slot of the resolved patch document (see `resolve_patch_document`). */\ninterface ResolvedItem {\n source: number | null;\n bit: Record<string, unknown> | null;\n patch: PatchEntry[];\n}\n\nfunction buildUnits(\n wasm: HookedWasm,\n input: string,\n inputIsBitmark: boolean,\n): { view: BitView; source: string }[] {\n if (inputIsBitmark) {\n const out = wasm.split_bits(input);\n if (isError(out)) throw new Error(out);\n const slices = JSON.parse(out) as { index: number; source: string }[];\n return slices.map((s) => ({\n view: { format: \"bitmark\", index: s.index, total: slices.length, source: s.source },\n source: s.source,\n }));\n }\n const out = wasm.split_json_bits(input);\n if (isError(out)) throw new Error(out);\n const envelopes = JSON.parse(out) as { bit?: import(\"../generated/bit-types.js\").AnyBit }[];\n return envelopes.map((env, index) => ({\n view: { format: \"json\", index, total: envelopes.length, bit: env.bit ?? {} },\n // Per-bit transform consumes a one-bit JSON document.\n source: JSON.stringify([env]),\n }));\n}\n\n/**\n * Split the document and run `preHook` (on the calling thread) for each bit,\n * producing the surviving compute jobs + their views. This is the main-thread\n * half shared by the sync and worker-pool drivers — only the resulting\n * data-only {@link BitJob}s ever cross to a worker.\n */\nexport function planTransform(\n wasm: HookedWasm,\n input: string,\n options: TransformOptions,\n): TransformPlan {\n const mode = options.mode ?? \"optimized\";\n const output: OutputFormat = options.outputFormat ?? \"json\";\n const spacesAroundValues = options.spacesAroundValues ?? 1;\n const indent = options.indent ?? 2;\n const pretty = options.pretty ?? false;\n\n const sel = options.inputFormat ?? \"auto\";\n const inputIsBitmark = sel === \"bitmark\" || (sel !== \"json\" && wasm.is_bitmark(input));\n const inputFormat = inputIsBitmark ? \"bitmark\" : \"json\";\n\n const units = buildUnits(wasm, input, inputIsBitmark);\n const total = units.length;\n\n // Hooks see the ORIGINAL bits, in order, before the patch document\n // reshapes anything (same as the Rust pipeline's Phase A).\n const hooked: ({ patches: PatchEntry[]; outputFormat: OutputFormat } | null)[] = [];\n for (let index = 0; index < total; index++) {\n const { view } = units[index];\n view.index = index;\n view.total = total;\n const result = options.preHook ? options.preHook(view) || {} : {};\n hooked.push(result.drop ? null : { patches: result.patches ?? [], outputFormat: result.outputFormat ?? output });\n }\n\n // The patch document (or the every-bit shorthand) is resolved by the one\n // Rust implementation into the ordered output slots; without a patch the\n // slots are simply the original bits.\n const patchJson = patchJsonOf(options.patch);\n let resolved: ResolvedItem[];\n if (patchJson === \"\") {\n resolved = units.map((_, index) => ({ source: index, bit: null, patch: [] }));\n } else {\n const out = wasm.resolve_patch_document(input, patchJson);\n if (isError(out)) throw new Error(out);\n resolved = JSON.parse(out) as ResolvedItem[];\n }\n\n const jobs: BitJob[] = [];\n const views: BitView[] = [];\n for (const item of resolved) {\n if (item.source !== null) {\n const hook = hooked[item.source];\n if (!hook) continue; // dropped by the pre-hook\n jobs.push({\n index: item.source,\n source: units[item.source].source,\n inputFormat,\n outputFormat: hook.outputFormat,\n mode,\n // The document's patches first, the hook's after (the hook contract).\n patchJson: JSON.stringify([...item.patch, ...hook.patches]),\n spacesAroundValues,\n });\n views.push(units[item.source].view);\n } else {\n // An inserted bit: a one-bit JSON document, seen by `postHook` only.\n const bit = (item.bit ?? {}) as import(\"../generated/bit-types.js\").AnyBit;\n const index = jobs.length;\n jobs.push({\n index,\n source: JSON.stringify([{ bit }]),\n inputFormat: \"json\",\n outputFormat: output,\n mode,\n patchJson: JSON.stringify(item.patch),\n spacesAroundValues,\n });\n views.push({ format: \"json\", index, total, bit });\n }\n }\n return { jobs, views, output, pretty, indent };\n}\n\n/**\n * Compute one bit's rendered element synchronously via WASM. The per-bit\n * element is always compact JSON (the document is prettified once on\n * recombination). Returns an `error:`-prefixed string on failure.\n */\nexport function computeBit(wasm: HookedWasm, job: BitJob): string {\n const out = wasm.transform(\n job.source,\n job.inputFormat,\n job.outputFormat,\n job.mode,\n job.patchJson,\n false,\n 2,\n job.spacesAroundValues,\n );\n if (isError(out)) return out;\n return job.outputFormat === \"json\" ? stripArray(out) : out;\n}\n\n/** Recombine per-bit elements into the final document, in document order. */\nexport function recombine(\n wasm: HookedWasm,\n elements: string[],\n output: OutputFormat,\n pretty: boolean,\n indent: number,\n): string {\n // Bitmark and plain-text bits both join with newlines; only JSON wraps as an\n // array. (`text` is output-only, lossy plain-text extraction.)\n if (output === \"bitmark\" || output === \"text\") return elements.join(\"\\n\");\n const arr = `[${elements.join(\",\")}]`;\n return pretty ? wasm.prettify(arr, indent) : arr;\n}\n\n/**\n * Per-bit transform driver (synchronous, in-process): split the document, run\n * `preHook` for each bit on the calling thread, apply the static patch + any\n * hook patches, re-emit the bit, run `postHook`, then recombine in document\n * order.\n *\n * Hooks run synchronously on the calling thread; only data crosses into WASM.\n * Used when a `preHook`/`postHook` is supplied; the hookless path stays a\n * single `wasm.transform` call. Returns the document, or an `error:`-prefixed\n * string on failure.\n */\nexport function runHookedTransform(\n wasm: HookedWasm,\n input: string,\n options: TransformOptions,\n): string {\n let plan: TransformPlan;\n try {\n plan = planTransform(wasm, input, options);\n } catch (e) {\n return errorString(e);\n }\n\n const rendered: string[] = [];\n for (let i = 0; i < plan.jobs.length; i++) {\n const element = computeBit(wasm, plan.jobs[i]);\n if (isError(element)) return element;\n options.postHook?.(plan.views[i], element);\n rendered.push(element);\n }\n return recombine(wasm, rendered, plan.output, plan.pretty, plan.indent);\n}\n","// @zen-component: TS-ParallelOrchestrator\n\nimport type { TransformOptions } from \"../types.js\";\nimport { type BitJob, errorString, type HookedWasm, isError, planTransform, recombine } from \"./hooked-transform.js\";\n\n/**\n * A platform pool: compute `jobs` across up to `workers` workers, returning the\n * rendered element per job in submission order. Node and browser supply their\n * own (worker_threads / Worker); the orchestration around it is shared.\n */\nexport type RunJobs = (jobs: BitJob[], workers: number) => Promise<string[]>;\n\n/**\n * Shared parallel transform orchestration. The main-thread half — split +\n * `preHook` + recombine + `postHook` — is identical to the sync driver; only\n * the data-only per-bit jobs cross to `runJobs` (the platform pool). Closures\n * (`preHook`/`postHook`) never leave the calling thread.\n *\n * Returns the document, or an `error:`-prefixed string on failure.\n */\nexport async function orchestrateParallel(\n wasm: HookedWasm,\n input: string,\n options: TransformOptions,\n runJobs: RunJobs,\n): Promise<string> {\n let plan;\n try {\n plan = planTransform(wasm, input, options);\n } catch (e) {\n return errorString(e);\n }\n\n let elements: string[];\n try {\n elements = await runJobs(plan.jobs, options.workers ?? 4);\n } catch (e) {\n return errorString(e);\n }\n\n for (let i = 0; i < elements.length; i++) {\n if (isError(elements[i])) return elements[i];\n options.postHook?.(plan.views[i], elements[i]);\n }\n return recombine(wasm, elements, plan.output, plan.pretty, plan.indent);\n}\n","// @zen-component: 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 ): 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","// @zen-component: TS-BrowserWorkerPool\n//\n// A fixed-size browser Worker pool that computes per-bit transform jobs in\n// parallel. Mirrors the Node worker_threads pool: dispatch-on-idle, results\n// matched by id and returned in submission order, workers terminated when all\n// jobs settle. Each module worker loads its own WASM instance.\n\nimport type { Feature } from \"../core/facade.js\";\nimport type { BitJob } from \"../core/hooked-transform.js\";\n\ninterface JobResult {\n id: number;\n ok: boolean;\n element?: string;\n error?: string;\n}\n\n/**\n * Run `jobs` across up to `workers` module Workers, returning the rendered\n * element per job in submission order. Rejects on the first worker/job error.\n * Each worker loads the given wasm `feature` (PLAN-166) — the variant active\n * on the calling thread.\n */\nexport function runJobsParallel(jobs: BitJob[], workers: number, feature: Feature): Promise<string[]> {\n if (jobs.length === 0) return Promise.resolve([]);\n const poolSize = Math.max(1, Math.min(workers, jobs.length));\n // worker-entry.js is emitted beside this bundle (see tsup config).\n const workerUrl = new URL(\"./worker-entry.js\", import.meta.url);\n\n return new Promise<string[]>((resolve, reject) => {\n const results = new Array<string>(jobs.length);\n let next = 0;\n let settled = 0;\n let done = false;\n const pool: Worker[] = [];\n\n const shutdown = () => {\n for (const w of pool) w.terminate();\n };\n const fail = (err: Error) => {\n if (done) return;\n done = true;\n shutdown();\n reject(err);\n };\n const dispatch = (w: Worker) => {\n if (done || next >= jobs.length) return;\n const id = next++;\n w.postMessage({ id, job: jobs[id], feature });\n };\n\n for (let i = 0; i < poolSize; i++) {\n const w = new Worker(workerUrl, { type: \"module\" });\n pool.push(w);\n w.onmessage = (ev: MessageEvent<JobResult>) => {\n const res = ev.data;\n if (done) return;\n if (!res.ok) {\n fail(new Error(res.error ?? \"worker job failed\"));\n return;\n }\n results[res.id] = res.element as string;\n settled++;\n if (settled === jobs.length) {\n done = true;\n shutdown();\n resolve(results);\n return;\n }\n dispatch(w);\n };\n w.onerror = (e: ErrorEvent) => fail(new Error(e.message || \"worker error\"));\n }\n\n for (const w of pool) dispatch(w);\n });\n}\n","// @zen-component: LEGACY-Facade\n// The `legacy` namespace: a bpg-compatible (bitmark-parser-generator\n// v5.31.1) programmatic interface over the WASM core (PLAN-126).\n//\n// Everything here is exposed ONLY via `legacy.*` / the\n// `@gmb/bitmark-parser/legacy` subpath — nothing is re-exported at the\n// package root (reserved for the modern API and its future generated types).\n\nexport { BitmarkParserGenerator, bitmarkTextParse } from \"./bpg-class.js\";\nexport { Builder, type BuildBitOptions } from \"./builder.js\";\nexport { ResourceBuilder, type ResourceMethod } from \"./resource-builder.js\";\nexport { LegacyUnsupportedError } from \"./errors.js\";\nexport { isPseudoAst, type LegacyPseudoAst } from \"./pseudo-ast.js\";\n\n// Enum objects + option interfaces (vendored shapes)\nexport * from \"./options.js\";\nexport { BitType, BoundingBoxIndex, NodeType, TextMarkType, TextNodeType } from \"./enums-extra.js\";\n\n// Unsupported bpg internals — present but throwing (PLAN-126 F-2)\nexport {\n Ast,\n BitmarkFileGenerator,\n BitmarkGenerator,\n BitmarkParser,\n BitmarkStringGenerator,\n FileWriter,\n HtmlTableGenerator,\n HtmlTableParser,\n JsonFileGenerator,\n JsonGenerator,\n JsonParser,\n JsonStringGenerator,\n StreamWriter,\n StringWriter,\n} from \"./stubs.js\";\n\n// Vendored bpg JSON model / text-node types (type-only)\nexport type * from \"./vendor/BitJson.js\";\nexport type * from \"./vendor/BitWrapperJson.js\";\nexport type * from \"./vendor/BodyBitJson.js\";\nexport type * from \"./vendor/ParserJson.js\";\nexport type * from \"./vendor/ResourceJson.js\";\nexport type * from \"./vendor/TextNodes.js\";\n// bpg parity: bpg additionally exported JsonText under the alias `Text`\n// (bitmark-parser-generator src/index.ts: `JsonText as Text`).\nexport type { JsonText as Text } from \"./vendor/TextNodes.js\";\nexport type {\n ParserError,\n ParserInfo,\n ParserLocation,\n BitTypeType,\n TextFormatType,\n ResourceTypeType,\n TextMarkTypeType,\n TextNodeTypeType,\n} from \"./vendor/enums.js\";\n","// @zen-component: LEGACY-Facade\n\n/** Error thrown for bpg API members / options the legacy facade does not support. */\nexport class LegacyUnsupportedError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"LegacyUnsupportedError\";\n }\n}\n\n/** Throw for a bpg API member that is not supported (PLAN-126 F-2). */\nexport function unsupportedMember(member: string, reason?: string): never {\n throw new LegacyUnsupportedError(\n `'${member}' is not supported by the @gmb/bitmark-parser legacy API` + (reason ? `: ${reason}` : \"\"),\n );\n}\n\n/** Throw for an option that cannot be honoured (PLAN-126 F-9: never silently ignore). */\nexport function unsupportedOption(option: string, reason?: string): never {\n throw new LegacyUnsupportedError(\n `Option '${option}' is not supported by the @gmb/bitmark-parser legacy API` +\n (reason ? `: ${reason}` : \"\"),\n );\n}\n","// @zen-component: LEGACY-Facade\n// Central bpg-option → core-parameter translation table (PLAN-126 F-4/F-9).\n// Strict policy: options that map are honoured; options we cannot honour\n// throw a LegacyUnsupportedError naming the option. Sole exception:\n// `bitmarkParserType` is accepted and ignored — bpg v5.31.1 itself hardcodes\n// the peggy parser and ignores the option.\n\nimport { unsupportedOption } from \"./errors.js\";\nimport type { BitmarkOptions, JsonOptions } from \"./options.js\";\n\nconst V3_ONLY = \"bitmark v2 output is not supported (this parser is bitmark v3 only)\";\n\nexport function validateVersionOptions(opts: {\n bitmarkVersion?: number;\n bitmarkParserType?: string;\n}): void {\n if (opts.bitmarkVersion === 2) unsupportedOption(\"bitmarkVersion: 2\", V3_ONLY);\n // bitmarkParserType: accepted + ignored (documented exception).\n}\n\nexport function validateBitmarkOptions(o: BitmarkOptions): void {\n // 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 if (out.startsWith(\"error:\")) {\n throw new Error(out.slice(\"error:\".length).trim());\n }\n const entries = JSON.parse(out) as { bit: Record<string, unknown> }[];\n const built = entries[0]?.bit ?? bit;\n\n // F-6: keys the core doesn't know are dropped by the normalize pass —\n // re-attach them so nothing is lost silently. Values matching bpg's own\n // \"unset optional\" strip set (false / \"\" / [] / null) stay stripped,\n // mirroring bpg's removeUnwantedProperties.\n for (const [key, value] of Object.entries(bit)) {\n if (key in built) continue;\n if (\n value === false ||\n value === \"\" ||\n value === null ||\n (Array.isArray(value) && value.length === 0)\n ) {\n continue;\n }\n built[key] = value;\n }\n if (parser !== undefined) {\n Object.defineProperty(built, BUILT_BIT_PARSER, { value: parser, enumerable: false });\n }\n return built;\n }\n\n /**\n * Build a highlight body bit (bpg-compatible `buildHighlight`).\n * Shapes the HighlightJson body-bit; unset optionals are omitted.\n */\n buildHighlight(\n _context: unknown,\n data: Record<string, unknown> | undefined,\n ): Record<string, unknown> | undefined {\n if (!data) return undefined;\n const src = { ...data };\n // bpg: data may arrive nested under 'attrs' (when coming from JSON)\n const attrs = src.attrs as Record<string, unknown> | undefined;\n if (attrs) Object.assign(src, attrs);\n\n const texts = Array.isArray(src.texts)\n ? (src.texts as Record<string, unknown>[]).filter((t) => t != null).map((t) => ({\n text: t.text ?? \"\",\n isCorrect: t.isCorrect ?? false,\n isHighlighted: t.isHighlighted ?? false,\n ...stripUndefined(t, [\"text\", \"isCorrect\", \"isHighlighted\"]),\n }))\n : [];\n\n const node: Record<string, unknown> = {\n type: \"highlight\",\n texts,\n prefix: src.prefix ?? \"\",\n postfix: src.postfix ?? \"\",\n ...stripUndefined(src, [\"type\", \"texts\", \"prefix\", \"postfix\", \"attrs\"]),\n attrs: {},\n };\n return node;\n }\n\n /**\n * bpg's builder parses string-valued JsonText fields as bitmark text\n * (inline marks become TextAst marks); the composer would otherwise treat\n * them as literal text. Converts top-level JsonText fields in place.\n * Nested (card-content) strings are left literal — documented divergence.\n *\n * 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 * unknown-bit-type 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 this.throwOnError(out);\n\n // Shape the result per output format (bpg-compatible return shapes)\n if (outputFormat === \"bitmark\" || outputFormat === \"text\") {\n return this.deliver(out, opts.outputFile, opts.fileOptions);\n }\n if (outputFormat === \"json\") {\n if (opts.outputFile) return this.deliver(out, opts.outputFile, opts.fileOptions);\n if (pretty || jsonOptions.stringify) return out;\n return JSON.parse(out) as unknown;\n }\n // outputFormat === \"ast\": bit-JSON pseudo-AST (PLAN-126 §3.1)\n const ast = makePseudoAst(JSON.parse(out) as unknown[]);\n if (opts.outputFile) {\n return this.deliver(JSON.stringify(ast), opts.outputFile, opts.fileOptions);\n }\n return ast;\n }\n\n /**\n * Upgrade (prettify / canonicalize) bitmark or JSON to the latest version\n * of itself (bpg-compatible `upgrade`).\n */\n public upgrade(input: string | unknown, options?: UpgradeOptions): string | unknown | void {\n const opts: UpgradeOptions = Object.assign({}, options);\n const jsonOptions = Object.assign({}, opts.jsonOptions);\n const bitmarkOptions = Object.assign({}, opts.bitmarkOptions);\n validateVersionOptions(opts);\n validateBitmarkOptions(bitmarkOptions);\n validateJsonOptions(jsonOptions);\n this.checkBrowserFileWrite(opts.outputFile);\n\n const wasm = getLegacyWasm();\n const { source, isBitmark } = this.resolveInput(input, opts.inputFormat);\n // 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 this.throwOnError(out);\n\n if (isBitmark) return this.deliver(out, opts.outputFile, opts.fileOptions);\n if (opts.outputFile) return this.deliver(out, opts.outputFile, opts.fileOptions);\n if (pretty || jsonOptions.stringify) return out;\n return JSON.parse(out) as unknown;\n }\n\n /**\n * Get information about the bitmark language (bpg-compatible `info`).\n */\n public info(options?: InfoOptions): unknown {\n const opts: InfoOptions = Object.assign({}, options);\n const wasm = getLegacyWasm();\n const type = opts.type ?? \"list\";\n const format = opts.outputFormat ?? \"text\";\n const { pretty, indent } = prettyIndent(opts.prettify);\n\n const coreFormat = format === \"pojo\" ? \"json\" : format;\n // 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 this.throwOnError(out);\n if (format === \"pojo\") return JSON.parse(out) as unknown;\n return out;\n }\n\n /** Not supported: bpg-internal development tool. */\n public generateConfig(_options?: unknown): void {\n unsupportedMember(\"BitmarkParserGenerator.generateConfig\", \"bpg-internal development tool\");\n }\n\n /**\n * Convert between HTML tables and bitmark tables (bpg-compatible\n * `convertHtmlTable`).\n *\n * Backed by the core's schema-driven html mapping: HTML input has each\n * `<table>` wrapped in the core's `<bitmark-bit>` envelope and parsed;\n * bits input is emitted as html and the `<table>` fragments extracted\n * (the envelope stripped). The markup *inside* `<table>` follows this\n * parser's html mapping, which may differ from bpg's in detail.\n */\n public convertHtmlTable(\n input: string | unknown,\n options?: ConvertHtmlTableOptions,\n ): string | unknown | void {\n const opts: ConvertHtmlTableOptions = Object.assign({}, options);\n const jsonOptions = Object.assign({}, opts.jsonOptions);\n const bitmarkOptions = Object.assign({}, opts.bitmarkOptions);\n validateBitmarkOptions(bitmarkOptions);\n validateJsonOptions(jsonOptions);\n if (opts.keepUnknownTags) unsupportedOption(\"keepUnknownTags\");\n if (opts.noBreakscaping) unsupportedOption(\"noBreakscaping\");\n this.checkBrowserFileWrite(opts.outputFile);\n const wasm = getLegacyWasm();\n\n const inStr = typeof input === \"string\" ? this.maybeReadFile(input, undefined) : \"\";\n const isHtmlInput =\n opts.inputFormat === \"html\" ||\n (opts.inputFormat === undefined && typeof input === \"string\" && /<table[\\s>]/iu.test(inStr));\n\n if (!isHtmlInput) {\n // bits (bitmark / JSON / AST) → HTML `<table>` fragments\n const { source, isBitmark } = this.resolveInput(input, undefined);\n const out = wasm.convert(source, isBitmark ? \"bitmark\" : \"json\", \"html\", \"optimized\", false, 2, 1, false, false);\n this.throwOnError(out);\n return this.deliver(extractHtmlTables(out).join(\"\\n\"), opts.outputFile, opts.fileOptions);\n }\n\n // HTML input: wrap each <table> in the core's bit envelope and parse\n const bitType = opts.tableFormat === \"table\" ? \"table\" : \"table-extended\";\n const wrapped = extractHtmlTables(inStr)\n .map((t) => `<bitmark-bit data-type=\"${bitType}\" data-format=\"bitmark++\">${t}</bitmark-bit>`)\n .join(\"\");\n const outputFormat = opts.outputFormat ?? \"bitmark\";\n const { pretty, indent } = prettyIndent(jsonOptions.prettify);\n const spaces = spacesAround(bitmarkOptions.spacesAroundValues);\n\n if (outputFormat === \"html\") {\n const out = wasm.convert(wrapped, \"html\", \"html\", \"optimized\", false, 2, 1, false, false);\n this.throwOnError(out);\n return this.deliver(extractHtmlTables(out).join(\"\\n\"), opts.outputFile, opts.fileOptions);\n }\n const coreFormat = outputFormat === \"ast\" ? \"json\" : outputFormat;\n const out = wasm.convert(wrapped, \"html\", coreFormat, \"optimized\", pretty, indent, spaces, false, false);\n this.throwOnError(out);\n if (outputFormat === \"bitmark\" || outputFormat === \"text\") {\n return this.deliver(out, opts.outputFile, opts.fileOptions);\n }\n if (outputFormat === \"json\") {\n if (opts.outputFile) return this.deliver(out, opts.outputFile, opts.fileOptions);\n if (pretty || jsonOptions.stringify) return out;\n return JSON.parse(out) as unknown;\n }\n const ast = makePseudoAst(JSON.parse(out) as unknown[]);\n if (opts.outputFile) return this.deliver(JSON.stringify(ast), opts.outputFile, opts.fileOptions);\n return ast;\n }\n\n /**\n * Create a bit-JSON pseudo-AST from bitmark or JSON input (PLAN-126 §3.1).\n *\n * NOTE: the returned structure is the bit JSON (wrapper entries), not\n * bpg's internal TS AST node model. It round-trips through `convert` but\n * is not walkable with bpg's `Ast`/`NodeType`.\n */\n public createAst(input: unknown, options?: CreateAstOptions): LegacyPseudoAst {\n const opts: CreateAstOptions = Object.assign({}, options);\n const wasm = getLegacyWasm();\n const { source, isBitmark } = this.resolveInput(input, opts.inputFormat);\n // 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 this.throwOnError(out);\n return makePseudoAst(JSON.parse(out) as unknown[]);\n }\n\n /**\n * Breakscape text (bpg-compatible `breakscapeText`).\n */\n public breakscapeText(input: string, options?: BreakscapeOptions): string | void {\n if (!input) return input;\n const opts: BreakscapeOptions = Object.assign({}, options);\n this.checkBrowserFileWrite(opts.outputFile);\n const wasm = getLegacyWasm();\n const inStr = this.maybeReadFile(input, opts.inputFormat);\n const res = wasm.breakscape_text(inStr, mapTextFormat(opts.textFormat), opts.textLocation ?? \"body\");\n return this.deliver(res, opts.outputFile, opts.fileOptions);\n }\n\n /**\n * Unbreakscape text (bpg-compatible `unbreakscapeText`).\n */\n public unbreakscapeText(input: string, options?: UnbreakscapeOptions): string | void {\n if (!input) return input;\n const opts: UnbreakscapeOptions = Object.assign({}, options);\n this.checkBrowserFileWrite(opts.outputFile);\n const wasm = getLegacyWasm();\n const inStr = this.maybeReadFile(input, opts.inputFormat);\n const res = wasm.unbreakscape_text(inStr, mapTextFormat(opts.textFormat), opts.textLocation ?? \"body\");\n return this.deliver(res, opts.outputFile, opts.fileOptions);\n }\n\n /**\n * Convert bitmark text ↔ text AST (bpg-compatible `convertText`).\n *\n * Direction is auto-detected: TextAst (JSON) input generates bitmark\n * text; anything else parses as bitmark text and returns the TextAst\n * (plain JS object; a string when `jsonOptions.prettify` is set).\n */\n public convertText(input: string | unknown, options?: ConvertTextOptions): string | unknown | void {\n const opts: ConvertTextOptions = Object.assign({}, options);\n const jsonOptions = Object.assign({}, opts.jsonOptions);\n this.checkBrowserFileWrite(opts.outputFile);\n const wasm = getLegacyWasm();\n\n const isBitmarkText = opts.textFormat === undefined || mapTextFormat(opts.textFormat) === \"bitmark++\";\n const textLocation = opts.textLocation ?? \"body\";\n\n let inStr: string;\n let ast: unknown[] | undefined;\n if (typeof input === \"string\") {\n inStr = this.maybeReadFile(input, opts.inputFormat);\n ast = this.parseTextAstString(inStr);\n } else {\n inStr = JSON.stringify(input);\n ast = Array.isArray(input) ? input : undefined;\n }\n\n if (ast !== undefined) {\n // TextAst → text (reverse honours the location; a plain-text format\n // generates plain text, i.e. marks are dropped — bpg parity)\n const out = isBitmarkText\n ? wasm.convert_text(JSON.stringify(ast), \"astToText\", \"bitmark++\", textLocation)\n : wasm.convert_text(JSON.stringify(ast), \"astToPlainText\", \"plainText\", textLocation);\n this.throwOnError(out);\n return this.deliver(out, opts.outputFile, opts.fileOptions);\n }\n\n // text → TextAst (bpg parses forward at body location)\n const out = wasm.convert_text(inStr, \"textToAst\", isBitmarkText ? \"bitmark++\" : \"plainText\", \"body\");\n this.throwOnError(out);\n const { pretty, indent } = prettyIndent(jsonOptions.prettify);\n const outStr = pretty ? wasm.prettify(out, indent) : out;\n if (opts.outputFile) return this.deliver(outStr, opts.outputFile, opts.fileOptions);\n if (pretty) return outStr;\n return JSON.parse(out) as unknown;\n }\n\n /**\n * Convert a text AST to plain text (bpg-compatible `textAstToPlainText`).\n */\n public textAstToPlainText(textAst: unknown, _options?: ExtractPlainTextOptions): string {\n const wasm = getLegacyWasm();\n const out = wasm.convert_text(\n typeof textAst === \"string\" ? textAst : JSON.stringify(textAst),\n \"astToPlainText\",\n \"bitmark++\",\n \"body\",\n );\n this.throwOnError(out);\n return out;\n }\n\n /**\n * Extract plain text from bitmark or bitmark JSON (bpg-compatible).\n */\n public extractPlainText(input: string | unknown, options?: ExtractPlainTextOptions): string {\n const inputFormat = options?.inputFormat;\n const wasm = getLegacyWasm();\n if (inputFormat === \"plainText\") {\n return typeof input === \"string\" ? String(input) : \"\";\n }\n if (inputFormat === \"bitmarkText\") {\n const ast = wasm.convert_text(String(input), \"textToAst\", \"bitmark++\", \"body\");\n const out = wasm.convert_text(ast, \"astToPlainText\", \"bitmark++\", \"body\");\n this.throwOnError(out);\n return out;\n }\n if (typeof input === \"string\" && this.parseTextAstString(input) === undefined && !wasm.is_bitmark(input)) {\n // Neither JSON nor bitmark: bpg falls through to bitmark text\n const looksJson = ((): boolean => {\n try {\n JSON.parse(input);\n return true;\n } catch {\n return false;\n }\n })();\n if (!looksJson) {\n return this.extractPlainText(input, { inputFormat: \"bitmarkText\" });\n }\n }\n const { source, isBitmark } = this.resolveInput(input, undefined);\n const out = wasm.convert(source, isBitmark ? \"bitmark\" : \"json\", \"text\", \"optimized\", false, 2, 1, false, false);\n this.throwOnError(out);\n return out;\n }\n\n /** If `s` parses as a TextAst JSON array, return it. */\n private parseTextAstString(s: string): unknown[] | undefined {\n const t = s.trim();\n if (!t.startsWith(\"[\")) return undefined;\n try {\n const v = JSON.parse(t) as unknown;\n if (Array.isArray(v) && v.every((n) => n !== null && typeof n === \"object\" && \"type\" in n)) {\n return v;\n }\n } catch {\n // not JSON\n }\n return undefined;\n }\n\n // ------------------------------------------------------------------\n // Internal helpers\n // ------------------------------------------------------------------\n\n /**\n * Resolve bpg input (string | file path | JSON value | pseudo-AST) to a\n * source string for the WASM core, classified per bpg's detection order:\n * AST → JSON → assume bitmark (PLAN-126 F-10).\n */\n protected resolveInput(input: unknown, inputFormat: string | undefined): ResolvedInput {\n if (typeof input !== \"string\") {\n // Parsed JSON / pseudo-AST value.\n const entries = this.jsonEntries(input);\n return {\n source: JSON.stringify(entries ? entries.map((b) => this.toWrapperEntry(b)) : input),\n isBitmark: false,\n };\n }\n const inStr = this.maybeReadFile(input, inputFormat);\n const wasm = getLegacyWasm();\n if (wasm.is_bitmark(inStr)) return { source: inStr, isBitmark: true };\n // JSON-ish: normalise loose shapes (AST envelope, single wrapper, bare bit)\n try {\n const parsed = JSON.parse(inStr) as unknown;\n const entries = this.jsonEntries(parsed);\n if (entries) {\n return {\n source: JSON.stringify(entries.map((b) => this.toWrapperEntry(b))),\n isBitmark: false,\n };\n }\n } catch {\n // is_bitmark said \"not bitmark\" but it is not JSON either —\n // fall through and let the core's own detection handle it (bpg\n // behaviour: assume bitmark).\n return { source: inStr, isBitmark: true };\n }\n return { source: inStr, isBitmark: false };\n }\n\n /**\n * Normalise the JSON shapes bpg accepts to a bits/entries array:\n * wrapper array, `{ bits: [...] }` AST envelope, single `{ bit: ... }`\n * wrapper, or a bare bit object (`{ type: ... }`).\n */\n private jsonEntries(v: unknown): unknown[] | undefined {\n if (Array.isArray(v)) return v;\n if (v !== null && typeof v === \"object\") {\n const o = v as Record<string, unknown>;\n if (Array.isArray(o.bits)) return o.bits;\n if (\"bit\" in o) return [o];\n if (typeof o.type === \"string\") return [{ bit: o }];\n }\n return undefined;\n }\n\n /**\n * Normalise a pseudo-AST bits entry to a `{ bit, parser? }` wrapper.\n * `Builder.buildBit` returns bare bit JSON (with any parser metadata\n * attached under a non-enumerable symbol); parsed forward output is\n * already wrapper-shaped.\n */\n private toWrapperEntry(entry: unknown): unknown {\n if (entry !== null && typeof entry === \"object\" && \"bit\" in (entry as object)) return entry;\n const wrapper: { bit: unknown; parser?: unknown } = { bit: entry };\n const parser = (entry as Record<symbol, unknown> | null)?.[BUILT_BIT_PARSER];\n if (parser !== undefined) wrapper.parser = parser;\n return wrapper;\n }\n\n /** bpg parity: read `input` as a file when it names one (Node only). */\n protected maybeReadFile(input: string, inputFormat: string | undefined): string {\n if (inputFormat === \"string\") return input;\n const io = getLegacyFileIo();\n if (!io) return input;\n try {\n if (io.existsSync(input)) return io.readFileSync(input, \"utf8\");\n } catch {\n // treat as literal input\n }\n return input;\n }\n\n /** bpg parity: writing a file is impossible in the browser. */\n protected checkBrowserFileWrite(outputFile: string | undefined): void {\n if (outputFile && !getLegacyFileIo()) {\n throw new Error(\"Cannot write to file in browser environment\");\n }\n }\n\n /** Return `data`, or write it to `outputFile` (returning void), as bpg does. */\n protected deliver(data: string, outputFile?: string, fileOptions?: FileOptions): string | void {\n if (!outputFile) return data;\n const io = getLegacyFileIo();\n if (!io) throw new Error(\"Cannot write to file in browser environment\");\n io.writeFile(outputFile, data, {\n append: fileOptions?.append,\n encoding: fileOptions?.encoding ?? \"utf8\",\n });\n }\n\n /** The core reports failures as `error:`-prefixed strings; bpg throws. */\n protected throwOnError(out: string): void {\n if (out.startsWith(\"error:\")) {\n throw new Error(out.slice(\"error:\".length).trim());\n }\n }\n}\n\n/**\n * Extract every top-level `<table>…</table>` fragment from `html`\n * (case-insensitive, nesting-safe). Pure string scanning — no HTML parsing.\n */\nfunction extractHtmlTables(html: string): string[] {\n const tables: string[] = [];\n const lower = html.toLowerCase();\n let i = 0;\n for (;;) {\n const start = lower.indexOf(\"<table\", i);\n if (start === -1) break;\n let depth = 0;\n let j = start;\n let end = -1;\n while (j < html.length) {\n const open = lower.indexOf(\"<table\", j);\n const close = lower.indexOf(\"</table\", j);\n if (close === -1) break;\n if (open !== -1 && open < close) {\n depth++;\n j = open + \"<table\".length;\n } else {\n depth--;\n const closeEnd = lower.indexOf(\">\", close);\n j = closeEnd === -1 ? html.length : closeEnd + 1;\n if (depth === 0) {\n end = j;\n break;\n }\n }\n }\n if (end === -1) break;\n tables.push(html.slice(start, end));\n i = end;\n }\n return tables;\n}\n\n/**\n * Direct bitmark text parser (bpg-compatible `bitmarkTextParse`):\n * bitmark text → TextAst array.\n */\nexport function bitmarkTextParse(text: string): unknown[] {\n const out = getLegacyWasm().convert_text(text, \"textToAst\", \"bitmark++\", \"body\");\n if (out.startsWith(\"error:\")) throw new Error(out.slice(\"error:\".length).trim());\n return JSON.parse(out) as unknown[];\n}\n","// @zen-component: LEGACY-Facade\n// bpg-compatible `ResourceBuilder` (PLAN-126 §3.1): each method shapes the\n// `{ type, <family>: { ... } }` ResourceJson wrapper from bpg's flat data.\n// One generic table-driven implementation — per-bit-type defaulting and\n// URL-derived cosmetics are left to the config-driven core, which normalizes\n// the resource when the bit containing it is converted.\n\ninterface ResourceSpec {\n /** ResourceJson discriminator (`type`). */\n type: string;\n /** Family key holding the resource data object. */\n key: string;\n /** JSON field that bpg's `data.value` maps to. */\n valueField: \"src\" | \"url\" | \"body\";\n}\n\nconst RESOURCE_SPECS = {\n imageResource: { type: \"image\", key: \"image\", valueField: \"src\" },\n imageLinkResource: { type: \"image-link\", key: \"imageLink\", valueField: \"url\" },\n audioResource: { type: \"audio\", key: \"audio\", valueField: \"src\" },\n audioEmbedResource: { type: \"audio-embed\", key: \"audioEmbed\", valueField: \"src\" },\n audioLinkResource: { type: \"audio-link\", key: \"audioLink\", valueField: \"url\" },\n videoResource: { type: \"video\", key: \"video\", valueField: \"src\" },\n videoEmbedResource: { type: \"video-embed\", key: \"videoEmbed\", valueField: \"url\" },\n videoLinkResource: { type: \"video-link\", key: \"videoLink\", valueField: \"url\" },\n stillImageFilmEmbedResource: {\n type: \"still-image-film-embed\",\n key: \"stillImageFilmEmbed\",\n valueField: \"url\",\n },\n stillImageFilmLinkResource: {\n type: \"still-image-film-link\",\n key: \"stillImageFilmLink\",\n valueField: \"url\",\n },\n articleResource: { type: \"article\", key: \"article\", valueField: \"body\" },\n documentResource: { type: \"document\", key: \"document\", valueField: \"url\" },\n documentEmbedResource: { type: \"document-embed\", key: \"documentEmbed\", valueField: \"url\" },\n documentLinkResource: { type: \"document-link\", key: \"documentLink\", valueField: \"url\" },\n documentDownloadResource: {\n type: \"document-download\",\n key: \"documentDownload\",\n valueField: \"url\",\n },\n appLinkResource: { type: \"app-link\", key: \"appLink\", valueField: \"url\" },\n websiteLinkResource: { type: \"website-link\", key: \"websiteLink\", valueField: \"url\" },\n} as const satisfies Record<string, ResourceSpec>;\n\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} 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","// @zen-component: WASM-TSBindings\n\nimport type { PatchDocument } from \"./diff-types.js\";\nimport type { AnyBit } from \"./generated/bit-types.js\";\n\n/**\n * Output mode for JSON serialization.\n *\n * - `\"optimized\"` — omit keys whose values match their natural defaults.\n * - `\"full\"` — include all keys enumerated from the bitmark configuration.\n */\nexport type OutputMode = \"optimized\" | \"full\";\n\n/**\n * Lexer stage selector.\n *\n * - `\"lex\"` — combined lexer, text output (default).\n * - `\"lex-json\"` — combined lexer, JSON array output.\n */\nexport type LexStage = \"lex\" | \"lex-json\";\n\n/** Options for the {@link lex} function. */\nexport interface LexOptions {\n /** Selects the lexer pipeline stage (default: `\"lex\"`). */\n stage?: LexStage;\n}\n\n/** Options for the typed conversion pair ({@link bitmarkToObjects} /\n * {@link objectsToBitmark}). */\nexport interface ParseOptions {\n /** JSON output mode (default: `\"optimized\"`). */\n mode?: OutputMode;\n /**\n * Include unknown properties in the bit JSON (default: `false`). Applies\n * to {@link bitmarkToObjects} only (parsing); ignored by\n * {@link objectsToBitmark} — unknown properties are never converted back\n * to bitmark. See {@link ConvertOptions.includeUnknownProperties}.\n */\n includeUnknownProperties?: boolean;\n}\n\n/**\n * Input format selector (adds auto-detection).\n *\n * `\"auto\"` sniffs bitmark-vs-JSON from the content; `\"bitmark\"` / `\"json\"` are\n * explicit; any config mapping id (e.g. `\"html\"`, `\"xml\"`) selects a markup\n * input that is reversed to the AST. The `(string & {})` arm admits those\n * config-driven mapping ids while keeping literal autocompletion.\n */\nexport type InputFormat = \"auto\" | \"bitmark\" | \"json\" | (string & {});\n\n/** Concrete output format. `\"text\"` is lossy plain-text extraction and is\n * output-only (it cannot be used as an input format). */\nexport type OutputFormat = \"bitmark\" | \"json\" | \"text\";\n\n/** Options for the {@link convert} function. */\nexport interface ConvertOptions {\n /** Input format (default: `\"auto\"`). */\n inputFormat?: InputFormat;\n /** Output format (default: `\"auto\"` — the opposite of the input). */\n outputFormat?: OutputFormat | \"auto\";\n /** JSON output mode (default: `\"optimized\"`). */\n mode?: OutputMode;\n /** Include validation warnings in `parser.warnings` output (default: `false`). */\n warnings?: boolean;\n /** Output text as plain text — debug mode (default: `false`). */\n plainText?: boolean;\n /**\n * Prettify the JSON being emitted (default: `false`). For JSON output this\n * is the whole document; for bitmark output it is the embedded JSON bodies\n * of `json`-format bits (cosmetic — they re-parse to the same value).\n */\n pretty?: boolean;\n /** Indent size for pretty-printing (default: `2`). */\n indent?: number;\n /** Spaces around tag values in bitmark output, `0..=10` (default: `1`). */\n spacesAroundValues?: number;\n /**\n * Bitmark → JSON only: include unknown properties in the bit JSON\n * (default: `false`). An unknown property (`[@key:value]` the bit's\n * config cannot resolve, at the bit body/footer — never inside cards or\n * consumed by a chain) is appended after all real keys as an array of\n * strings (`[@u]` with no value → `true`); a key colliding with a\n * configured key is `_`-prefixed. Unknown properties are never converted\n * back to bitmark, and each occurrence still warns.\n */\n includeUnknownProperties?: boolean;\n /**\n * Replace the converted output with a human-readable MAPPING REPORT of\n * what each input construct mapped to — including inputs that are NOT\n * mapped (default: `false`). Composite conversions (e.g. xml → json)\n * report every leg, one section after the other.\n */\n mappingReport?: boolean;\n}\n\n/** Options for the {@link canonicalize} function (the single same-format\n * re-emit surface; `mode` covers what the removed optimize/fullize did). */\nexport interface CanonicalizeOptions {\n /**\n * Input format (default: `\"auto\"`). The output is re-emitted in this same\n * format — e.g. `\"html\"` in, html out. `\"auto\"` sniffs bitmark vs JSON.\n */\n inputFormat?: InputFormat;\n /** Output mode (default: `\"optimized\"`; `\"full\"` emits all keys). */\n mode?: OutputMode;\n /**\n * Prettify the JSON being emitted (default: `false`) — the whole document\n * for JSON input, the embedded JSON bodies of `json`-format bits for\n * bitmark input.\n */\n pretty?: boolean;\n /** Indent size for pretty-printing (default: `2`). */\n indent?: number;\n /** Spaces around tag values in bitmark output, `0..=10` (default: `1`). */\n spacesAroundValues?: number;\n}\n\n/** A patch operation. */\nexport type PatchOp = \"set\" | \"create\" | \"delete\" | \"append\";\n\n/**\n * A patch entry. Either the verbose form `{ path, op, value? }` or the\n * shorthand single-key object `{ \"<path>\": value }` (which means `set`).\n *\n * `path` addresses the bit JSON directly (e.g. `id`,\n * `cards[2].question.instruction`, `id[-1]`). To modify bitmark, convert to\n * JSON, patch, then convert back — `transform` does this when the output\n * format is bitmark.\n */\nexport type PatchEntry =\n { path: string; op: PatchOp; value?: unknown } | Record<string, unknown>;\n\n// ── typed patch values (PLAN-128 §3.7) ──────────────────────────────────\n// The value type is resolved from the caller's literal path against `AnyBit`,\n// segment by segment — no enumeration of the path space, so compile cost is\n// per-call-site and bounded by the literal's length. Unresolvable segments and\n// dynamic (non-literal) paths degrade to `unknown`.\n\n/** @internal Peel `[n]` indexes off the front of `S`, unwrapping one array level each. */\ntype ApplyIndexes<T, S extends string> = S extends `[${string}]${infer Rest}`\n ? ApplyIndexes<T extends readonly (infer E)[] ? E : unknown, Rest>\n : T;\n\n/** @internal Resolve one dot-separated segment (`key`, `key[n]…`, or bare index). */\ntype Seg<T, S extends string> = S extends `${infer K}[${infer Rest}`\n ? ApplyIndexes<\n K extends \"\" ? T : K extends keyof T ? T[K] : unknown,\n `[${Rest}`\n >\n : S extends keyof T\n ? T[S]\n : S extends `${number}` | `-${number}`\n ? T extends readonly (infer E)[]\n ? E\n : unknown\n : unknown;\n\n/**\n * The type at patch path `P` within `T` (paths as in {@link PatchEntry}:\n * dot-separated keys with `[n]` indexes, negative-from-end allowed).\n */\nexport type PathValue<T, P extends string> = string extends P\n ? unknown\n : P extends `${infer S}.${infer Rest}`\n ? PathValue<NonNullable<Seg<T, S>>, Rest>\n : Seg<T, P>;\n\n/**\n * Build a {@link PatchEntry} with the `value` typed from the literal `path`,\n * resolved against {@link AnyBit}.\n *\n * For `append`, the value is typed as an *element* of the array at the path.\n *\n * @example\n * patchEntry(\"instruction\", \"set\", [{ type: \"paragraph\", content: [] }]);\n * patchEntry(\"id\", \"append\", \"1234\");\n * patchEntry(\"cards[0].question\", \"delete\");\n */\nexport type PatchValueFor<\n P extends string,\n O extends PatchOp,\n> = O extends \"append\"\n ? NonNullable<PathValue<AnyBit, P>> extends readonly (infer E)[]\n ? E\n : PathValue<AnyBit, P>\n : PathValue<AnyBit, P>;\n\nexport function patchEntry<const P extends string, const O extends PatchOp>(\n path: P,\n op: O,\n value?: PatchValueFor<P, O>,\n): PatchEntry {\n return value === undefined ? { path, op } : { path, op, value };\n}\n\n// The patch document and diff types (PLAN-179) live in `diff-types.ts`.\nexport type {\n BitSelector,\n PatchDocumentEntry,\n PatchDocument,\n DiffOutputFormat,\n DiffOptions,\n BitDiffRef,\n DiffHunkLine,\n DiffHunk,\n BitDiff,\n} from \"./diff-types.js\";\n\n/** One bit's source slice within a bitmark document (from {@link splitBits}). */\nexport interface BitSlice {\n index: number;\n byteStart: number;\n byteEnd: number;\n source: string;\n}\n\n/**\n * What a {@link PreHook} / {@link PostHook} sees for one bit, in its source\n * format. `index` is the bit's 0-based position; `total` is the bit count.\n */\nexport type BitView =\n | { format: \"bitmark\"; index: number; total: number; source: string }\n | { format: \"json\"; index: number; total: number; bit: AnyBit };\n\n/**\n * What a {@link PreHook} may return for a bit. All fields are optional; an\n * empty result (or `void`) makes the hook a pure observer.\n */\nexport interface PreHookResult {\n /** Patches to apply to this bit, after the patch document's entries for it. */\n patches?: PatchEntry[];\n /** Override the output format for this bit only. */\n outputFormat?: OutputFormat;\n /** Drop the bit from the output entirely. */\n drop?: boolean;\n}\n\n/** Pre-processing hook: inspect a bit, optionally return modifications. */\nexport type PreHook = (view: BitView) => PreHookResult | void;\n\n/** Post-processing hook: observe a bit's input view and rendered output. */\nexport type PostHook = (view: BitView, output: string) => void;\n\n/** Options for the {@link transform} function. */\nexport interface TransformOptions {\n /** Input format (default: `\"auto\"`). */\n inputFormat?: InputFormat;\n /** Output format (default: `\"json\"`). */\n outputFormat?: OutputFormat;\n /** Output mode (default: `\"optimized\"`). */\n mode?: OutputMode;\n /**\n * A patch document (PLAN-179) — per-bit patches by selector, removes,\n * inserts and moves — or the every-bit shorthand: a bare array of entries\n * applied to every bit. Either form may be given as a JSON string.\n */\n patch?: PatchEntry[] | PatchDocument | string;\n /**\n * Per-bit pre-hook, run on the calling thread. Returns patches (applied\n * after the static `patch`), an output-format override, or `drop`. Providing\n * a `preHook` or `postHook` switches `transform` to the per-bit path; with\n * neither, the whole document is transformed in a single pass.\n */\n preHook?: PreHook;\n /** Per-bit post-hook, run on the calling thread after each bit is rendered. */\n postHook?: PostHook;\n /**\n * Worker-thread count for {@link transformParallel} (Node only; default `4`).\n * Ignored by the synchronous {@link transform}.\n */\n workers?: number;\n /** Prettify the emitted JSON (default: `false`) — for bitmark output, the\n * embedded JSON bodies of `json`-format bits. */\n pretty?: boolean;\n /** Indent size for pretty-printing (default: `2`). */\n indent?: number;\n /** Spaces around tag values in bitmark output, `0..=10` (default: `1`). */\n spacesAroundValues?: number;\n}\n\n/** Text format for breakscape / unbreakscape operations. */\nexport type TextFormat = \"bitmark++\" | \"plainText\";\n\n/** Text location for breakscape / unbreakscape operations. */\nexport type TextLocation = \"body\" | \"tag\";\n\n/** Options for the {@link breakscapeText} and {@link unbreakscapeText} functions. */\nexport interface BreakscapeOptions {\n /** Text format (default: `\"bitmark++\"`). */\n format?: TextFormat;\n /** Text location (default: `\"body\"`). */\n location?: TextLocation;\n}\n\n/** Info query type for the {@link info} function. */\nexport type InfoType =\n | \"list\"\n | \"bit\"\n | \"all\"\n | \"deprecated\"\n | \"bit-groups\"\n | \"resource-groups\"\n | \"languages\";\n\n/** Output format for the {@link info} function. */\nexport type InfoFormat = \"text\" | \"json\";\n\n/**\n * The language token selecting every language this build can resolve —\n * `info({ language: ALL_LANGUAGES })`. The same spelling the parser and the\n * CLI (`--language all`) use; exported so a consumer names it instead of\n * retyping the literal.\n */\nexport const ALL_LANGUAGES = \"all\";\n\n/** Options for the {@link info} function. */\nexport interface InfoOptions {\n /** Info query type (default: `\"list\"`). */\n infoType?: InfoType;\n /** Output format (default: `\"text\"`). */\n format?: InfoFormat;\n /** Bit name — required when `infoType` is `\"bit\"`. */\n bit?: string;\n /** Whether to pretty-print JSON output (default: `false`). */\n pretty?: boolean;\n /** Indent size for pretty-printing (default: `2`). */\n indent?: number;\n /** Include deprecated bits in `list`/`all` output (default: `false`). */\n includeDeprecated?: boolean;\n /** Restrict `list`/`all` output to deprecated bits only (default: `false`;\n * wins over `includeDeprecated`). */\n onlyDeprecated?: boolean;\n /** Full detail for `\"bit\"`/`\"all\"`: provenance, keys, card structure\n * (default `false` = compact one-line-per-tag view). */\n full?: boolean;\n /**\n * BCP-47 language tag(s) for DISPLAY NAMES — `title` on bits, bit groups\n * and resource groups. Default (or `\"\"`) is English.\n *\n * Accepts one tag (`\"de\"`), several (`[\"de\", \"fr\"]` or `\"de,fr\"`), or\n * {@link ALL_LANGUAGES} for every language this build can resolve — see\n * `info({ infoType: \"languages\" })`.\n *\n * **More than one language adds a `titles` map** to each result, so a\n * consumer building a multilingual index makes ONE call instead of one per\n * language. A single tag renders exactly as it always did, with no `titles`.\n *\n * Resolution narrows one subtag at a time (`de-CH` → `de`), then falls back\n * to the English title, then to the technical key. A partially translated\n * language is therefore safe: untranslated entries stay English rather than\n * emptying out. Technical identity — `name`, `key` — is never translated.\n *\n * Which translations are available depends on the variant and on\n * {@link register}: the `full` wasm bakes a table in, the lean variants\n * start empty and expect you to register one.\n */\n language?: string | readonly string[];\n}\n\n/** Options for {@link register}. Discriminated on `type`. */\nexport interface RegisterOptions {\n /** What kind of data `data` is. */\n type: \"translations\";\n /**\n * The file's own text — for `\"translations\"`, the JSON published at\n * `@gmb/bitmark-parser/translations`:\n * `{ \"<key>\": { \"<bcp47 tag>\": \"<display name>\" } }`, English excluded.\n */\n data: string;\n}\n\n/*\n * ── info JSON result types ────────────────────────────────────────────\n *\n * {@link info} returns a STRING — it renders a document, and `format:\n * \"text\"` / `pretty` / `indent` only mean anything for one. When you ask for\n * `format: \"json\"`, parse it and assert the matching type below:\n *\n * ```ts\n * const groups = JSON.parse(\n * info({ infoType: \"deprecated\", format: \"json\" }),\n * ) as DeprecatedInfo;\n * ```\n *\n * These shapes are a STABLE CONTRACT: a change to any of them is a\n * semver-major release. The normative definition is\n * `.zen/specs/API-INF-info-output.tsp`, enforced by the parser's\n * `info_contract_test`. TEXT output is explicitly NOT contractual — it is\n * human-readable and may change in any release, so never parse it.\n *\n * Fields marked \"info-meta only\" are absent from the wasm build (they carry\n * descriptions and provenance, kept out of the binary for size). Absence is\n * structural: the key is missing, never `null` or empty.\n *\n * Two invariants hold throughout, both enforced by the parser's test suite:\n *\n * 1. `null` is NEVER used for absence — a key whose fact does not apply is\n * missing. `null` appears only where it means something, and those fields\n * say so: `max: null` (unbounded), `default: null` (OMIT).\n * 2. {@link FullBitInfo} is a strict SUPERSET of {@link CompactBitInfo} —\n * same spelling, same values, full just adds. One parser reads either.\n */\n\n/** A tag's value format. Closed vocabulary. */\nexport type TagFormat =\n \"string\" | \"number\" | \"boolean\" | \"bitmark++\" | \"numberList4\" | \"enum\";\n\n/** A body region's resolved format. Closed vocabulary. */\nexport type BodyFormat = \"bitmark\" | \"text\" | \"json\" | \"latex\" | \"xml\";\n\n/**\n * A bit's resource-attachment rule: a mode keyword, or the explicit list of\n * permitted resource type names.\n */\nexport type ResourceAttachment = \"all\" | \"none\" | string[];\n\n/** A tag in compact (`full: false`) output. */\nexport interface CompactTagInfo {\n /** Tag name including its sigil, e.g. `@id`, `&image`, `#title`. */\n name: string;\n format: TagFormat;\n /** Enum vocabulary — only on `enum`-format tags. */\n values?: string[];\n /** Effective minimum occurrences. */\n min: number;\n /** Effective maximum occurrences; `null` means unbounded. */\n max: number | null;\n /**\n * Default value, wire-encoded. `null` means OMIT: the tag has no default\n * and absence is its canonical state — not \"unknown\".\n */\n default: string | null;\n /** Only present when the tag is always emitted (then always `true`). */\n alwaysEmit?: true;\n /** Chained tags; only present when non-empty. */\n chain?: CompactTagInfo[];\n}\n\n/** A tag in full (`full: true`) output. */\nexport interface FullTagInfo {\n name: string;\n /** info-meta only. */\n description?: string;\n /** Deprecation version — only on a deprecated tag. */\n deprecated?: string;\n format: TagFormat;\n /** Enum vocabulary — only on `enum`-format tags. */\n values?: string[];\n min: number;\n /** `null` means unbounded. */\n max: number | null;\n /** Pre-override minimum — present with `baseMax` when this context overrides. */\n baseMin?: number;\n /** Pre-override maximum; `null` means unbounded. */\n baseMax?: number | null;\n /** Wire-encoded default; `null` means OMIT. */\n default: string | null;\n /**\n * The format's natural default, wire-encoded. ABSENT for an omit tag\n * (`default: null`), which has no natural default.\n */\n naturalDefault?: string;\n alwaysEmit?: true;\n /** Output key per mapping type; `json` is always present. */\n mappingKeys: Record<string, string>;\n /** Only present when this context overrides the tag's key (then `true`). */\n keyOverridden?: true;\n /**\n * Group-inheritance path, outermost first. On info-meta builds this is\n * always present and `[]` is meaningful — the tag is declared DIRECTLY on\n * its owner. Absent means \"not reported\", never \"declared directly\".\n *\n * info-meta only.\n */\n via?: string[];\n chain?: FullTagInfo[];\n}\n\n/** Card-set structures in compact output. */\nexport interface CompactVariantInfo {\n /** 0-based position within the side. */\n position: number;\n tags: CompactTagInfo[];\n}\nexport interface CompactSideInfo {\n name: string;\n variants: CompactVariantInfo[];\n}\nexport interface CompactCardInfo {\n name: string;\n sides: CompactSideInfo[];\n}\nexport interface CompactCardSetInfo {\n key: string;\n cards: CompactCardInfo[];\n}\n\n/** Card-set structures in full output. */\nexport interface FullVariantInfo {\n position: number;\n bodyFormat: BodyFormat;\n bodyRequired: boolean;\n bodyForbidden: boolean;\n repeat: boolean;\n tags: FullTagInfo[];\n}\nexport interface FullSideInfo {\n name: string;\n repeat: boolean;\n variants: FullVariantInfo[];\n}\nexport interface FullCardInfo {\n name: string;\n isDefault: boolean;\n min: number;\n /** `null` means unbounded. */\n max: number | null;\n sides: FullSideInfo[];\n}\nexport interface FullCardSetInfo {\n key: string;\n cards: FullCardInfo[];\n}\n\n/** A bit's body rules (full output). */\nexport interface BodyRulesInfo {\n format: BodyFormat;\n required: boolean;\n forbidden: boolean;\n hasFooter: boolean;\n}\n\n/**\n * One bit in compact output.\n *\n * {@link FullBitInfo} is a strict superset: every key here appears there,\n * spelled identically and with an equal value.\n */\nexport interface CompactBitInfo {\n /** Bit type name, e.g. `cloze`. */\n name: string;\n /** Internal config id — stable only within one config version. */\n id: number;\n /** English display name; only present when authored. */\n title?: string;\n /**\n * Display names by BCP-47 tag, present ONLY when {@link InfoOptions.language}\n * named more than one (or `\"all\"`).\n *\n * Always carries `en` — the English title, which every build has. Otherwise\n * SPARSE: a requested language with no translation is absent rather than\n * filled with English, so a hole is visible instead of silently\n * indistinguishable. Keyed by the tag you ASKED for, not the one that\n * satisfied it: request `de-CH` with only `de` available and you read\n * `titles[\"de-CH\"]`.\n */\n titles?: Record<string, string>;\n /** Description. Present in EVERY build, including the lean wasm variants. */\n description?: string;\n /** Bit-group keys this bit belongs to, sorted. Omitted when it has none. */\n bitGroups?: string[];\n /** Only present when the bit is deprecated. */\n deprecated?: string;\n /**\n * Only present when a migration target exists. Such a bit is re-emitted\n * under its target's name in every parser output, so this name identifies\n * legacy input and already-indexed content — never new parser output.\n */\n migrateTo?: string;\n tags: CompactTagInfo[];\n /** Required resource name — only present when one is required. Name only:\n * its chain is already in `tags`. */\n requiredResource?: string;\n /** Only present when the bit has a card set. */\n cardSet?: CompactCardSetInfo;\n}\n\n/** One bit in full output. */\nexport interface FullBitInfo {\n name: string;\n id: number;\n /** As {@link CompactBitInfo.title}. */\n title?: string;\n /** As {@link CompactBitInfo.titles}. */\n titles?: Record<string, string>;\n /** As {@link CompactBitInfo.description} — present in every build. */\n description?: string;\n /** As {@link CompactBitInfo.bitGroups}. */\n bitGroups?: string[];\n /** Only present when the bit is deprecated. */\n deprecated?: string;\n /** Only present when a migration target exists. */\n migrateTo?: string;\n body: BodyRulesInfo;\n /** This bit's resource-attachment rule. */\n resourceAttachment: ResourceAttachment;\n /** Required resource name — only present when one is required. */\n requiredResource?: string;\n /** Bit-level mapping keys, where the config authors them. info-meta only. */\n mappingKeys?: Record<string, string>;\n tags: FullTagInfo[];\n /** Only present when the bit has a card set. */\n cardSet?: FullCardSetInfo;\n}\n\n/**\n * One member of a bit group. An object rather than a bare string so a\n * deprecated member can carry its facts.\n */\nexport interface BitGroupMemberInfo {\n name: string;\n /**\n * The member's display name, in the requested language — the same terms as\n * {@link BitGroupInfo.title}.\n *\n * This is what makes `bit-groups` a complete answer to \"every bit type,\n * what it is called, and which categories it is in\" in ONE call: without\n * it the only route carrying display names was `infoType: \"all\"`, which is\n * ~50× the payload.\n */\n title?: string;\n /** As {@link CompactBitInfo.titles}. */\n titles?: Record<string, string>;\n /** Only present for a deprecated member. */\n deprecated?: string;\n /**\n * Only present when a migration target exists. Such a bit is re-emitted\n * under its target's name, so this member matches already-indexed legacy\n * content, not new parser output.\n */\n migrateTo?: string;\n}\n\n/** One bit group: a search/filter category over bit types. */\nexport interface BitGroupInfo {\n /** Group key, e.g. `cloze`. Lookups also accept an alias. */\n key: string;\n title: string;\n /** As {@link CompactBitInfo.titles}. */\n titles?: Record<string, string>;\n description: string;\n /** Omitted when there are none. */\n aliases?: string[];\n /**\n * Informational parent group — NEVER implies membership. Intersecting a\n * bit's `bitGroups` with the groups carrying `subgroupOf: \"quizzes\"` is\n * how a consumer derives quiz categories.\n */\n subgroupOf?: string;\n /** Present, and always `true`, for a deliberately memberless group. */\n allowEmpty?: true;\n /**\n * Member bit types, name-sorted. Filtered by `includeDeprecated` /\n * `onlyDeprecated`, so the DEFAULT EXCLUDES deprecated members — a search\n * consumer matching already-indexed content passes `includeDeprecated`.\n */\n bitTypes: BitGroupMemberInfo[];\n}\n\n/** One resource group: a search/filter category over resource types. */\nexport interface ResourceGroupInfo {\n key: string;\n title: string;\n /** As {@link CompactBitInfo.titles}. */\n titles?: Record<string, string>;\n description: string;\n aliases?: string[];\n /**\n * Member resource types (canonical kebab-case), sorted. Consumers\n * normalize legacy camelCase (`imageLink` → `image-link`) before matching.\n */\n resourceTypes: string[];\n}\n\n/**\n * `infoType: \"bit-groups\"` — the bit-group catalog, key-sorted. Available\n * in every build, including the lean wasm variants.\n */\nexport type BitGroupsInfo = BitGroupInfo[];\n\n/** `infoType: \"resource-groups\"` — the resource-group catalog, key-sorted. */\nexport type ResourceGroupsInfo = ResourceGroupInfo[];\n\n/** `infoType: \"list\"` — bit type names in registry order. */\nexport type BitListInfo = string[];\n\n/**\n * `infoType: \"languages\"` — the BCP-47 tags this build can resolve, sorted.\n *\n * Always includes `\"en\"`. This is what `language: \"all\"` expands to, so a\n * consumer can enumerate the set rather than guess it; it grows when\n * {@link register} supplies a file carrying further languages.\n */\nexport type LanguagesInfo = string[];\n\n/** `infoType: \"bit\"` — one bit at the requested detail. */\nexport type BitInfo = CompactBitInfo | FullBitInfo;\n\n/** `infoType: \"all\"` — every bit at the requested detail, in registry order. */\nexport type AllBitsInfo = CompactBitInfo[] | FullBitInfo[];\n\n/** One entry of {@link DeprecatedInfo}. */\nexport interface DeprecatedEntryInfo {\n name: string;\n /** Always set — every entry is deprecated. */\n deprecated: string;\n /** Only present for a bit that migrates. */\n migrateTo?: string;\n}\n\n/** `infoType: \"deprecated\"` — every deprecated bit, in registry order. */\nexport type DeprecatedInfo = DeprecatedEntryInfo[];\n\n/**\n * Returned in place of a result when `infoType` is `\"bit\"` and the name is\n * unknown or missing. Distinguishable from every success shape: those are an\n * array, or an object with `name`.\n *\n * The `error` KEY is contractual; its message text is not.\n */\nexport interface InfoErrorResult {\n error: string;\n}\n","// @zen-component: TS-SharedApi\n//\n// The shared API wrappers (PLAN-166): platform entries re-export these. Every\n// call reads the ACTIVE wasm module through the variant facade at call time,\n// so an `init({ feature })` swap applies to the next call with no interface\n// change.\n\nimport type { AnyBit, Bit, BitEntry } from \"../generated/bit-types.js\";\nimport type {\n BitDiff,\n BitSlice,\n BreakscapeOptions,\n CanonicalizeOptions,\n ConvertOptions,\n DiffOptions,\n InfoOptions,\n RegisterOptions,\n LexOptions,\n ParseOptions,\n TransformOptions,\n} from \"../types.js\";\nimport {\n getActive,\n rememberRegistration,\n RegisterError,\n UnsupportedFeatureError,\n variant,\n} from \"./facade.js\";\nimport { runHookedTransform, type HookedWasm } from \"./hooked-transform.js\";\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * Debug tooling — only the `full` wasm variant carries it; on `bitmark-json`\n * this throws {@link UnsupportedFeatureError}.\n *\n * @param input - The bitmark source text.\n * @param options - Lex options (e.g. `{ stage: \"lex\" }`).\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, options: LexOptions = {}): string {\n const wasm = getActive();\n if (typeof wasm.lex !== \"function\") throw new UnsupportedFeatureError(\"lex\", variant());\n return wasm.lex(input, options.stage ?? \"lex\");\n}\n\n/**\n * Parse bitmark into typed bit entries.\n *\n * The typed (object) counterpart of\n * `convert(input, { inputFormat: \"bitmark\", outputFormat: \"json\" })`:\n * returns the entries as objects instead of a JSON string. **Bitmark input\n * only** — the format is pinned, no auto-detection.\n *\n * @example\n * const entries = bitmarkToObjects(\"[.article]\\nHello **world**\");\n * const bit = entries[0].bit;\n * if (bit.type === \"article\") console.log(bit.body);\n *\n * @throws If the core reports a conversion error.\n */\nexport function bitmarkToObjects(input: string, options: ParseOptions = {}): BitEntry[] {\n const out = getActive().convert(\n input,\n \"bitmark\",\n \"json\",\n options.mode ?? \"optimized\",\n false,\n 2,\n 1,\n options.includeUnknownProperties ?? false,\n false,\n );\n if (out.startsWith(\"error:\")) throw new Error(out.slice(\"error:\".length).trim());\n return JSON.parse(out) as BitEntry[];\n}\n\n/**\n * Compose bitmark text from typed bits or entries.\n *\n * The typed (object) counterpart of\n * `convert(json, { inputFormat: \"json\", outputFormat: \"bitmark\" })` — typed\n * objects are JSON by construction, so the format is pinned, no\n * auto-detection. Bare bits are auto-wrapped into entries; the config-driven\n * composer normalizes, defaults and validates on ingest — construct bits as\n * plain typed literals (no builder needed).\n *\n * @example\n * const bitmark = objectsToBitmark([{ type: \"article\", body: \"Hello\" }]);\n *\n * @throws If the core reports a compose error.\n */\nexport function objectsToBitmark(bits: readonly (Bit | AnyBit | BitEntry)[], options: ParseOptions = {}): string {\n const entries = bits.map((b) =>\n b !== null && typeof b === \"object\" && \"bit\" in b && typeof (b as BitEntry).bit === \"object\"\n ? b\n : { bit: b },\n );\n const out = getActive().convert(\n JSON.stringify(entries),\n \"json\",\n \"bitmark\",\n options.mode ?? \"optimized\",\n false,\n 2,\n 1,\n false,\n false,\n );\n if (out.startsWith(\"error:\")) throw new Error(out.slice(\"error:\".length).trim());\n return out;\n}\n\n/**\n * Convert between bitmark, JSON, and the mapped markup formats (html/xml/…) —\n * the single string-based conversion surface.\n *\n * The markup formats need the `full` wasm variant; on `bitmark-json` they\n * return an `error:`-prefixed Unsupported message.\n *\n * Performance: `inputFormat` defaults to `\"auto\"`, which detects the format\n * by scanning the input for a bitmark bit header — for non-bitmark input\n * that is a full pass over the whole input before parsing starts, and the\n * detection is heuristic (markup formats are never auto-detected). **If you\n * know the input format, set `inputFormat` explicitly.** For typed objects\n * use {@link bitmarkToObjects} / {@link objectsToBitmark}, which pin their\n * formats.\n *\n * @param input - Bitmark, JSON, or mapped-format input text.\n * @param options - Convert options (e.g. `{ inputFormat: \"bitmark\", mode: \"full\" }`).\n * @returns Converted output string. For bitmark input, this is a JSON string\n * array of structured parsed entries (`bit`, `parser`, `bitmark`).\n */\nexport function convert(input: string, options: ConvertOptions = {}): string {\n return getActive().convert(\n input,\n options.inputFormat ?? \"auto\",\n options.outputFormat ?? \"auto\",\n options.mode ?? \"optimized\",\n options.pretty ?? false,\n options.indent ?? 2,\n options.spacesAroundValues ?? 1,\n options.includeUnknownProperties ?? false,\n options.mappingReport ?? false,\n );\n}\n\n/**\n * Re-emit input in its own format in canonical form — the single same-format\n * surface (the former `optimize`/`fullize`/`expand` were pure mode pins of\n * this function and were removed).\n *\n * @param input - Input text (bitmark, JSON, or a markup format such as html/xml).\n * @param options - `mode`: `\"optimized\"` (default — omit natural defaults) or\n * `\"full\"` (emit all keys). `inputFormat` selects the format (default:\n * `\"auto\"`; prefer explicit — see {@link convert}); the output is\n * re-emitted in that same format.\n */\nexport function canonicalize(input: string, options: CanonicalizeOptions = {}): string {\n return getActive().canonicalize(\n input,\n options.inputFormat ?? \"auto\",\n options.mode ?? \"optimized\",\n options.pretty ?? false,\n options.indent ?? 2,\n options.spacesAroundValues ?? 1,\n );\n}\n\n/**\n * Count the bits in `input`, auto-detecting bitmark vs JSON (heuristic —\n * a full input scan when the input is not bitmark; see {@link convert}).\n *\n * @throws If the input cannot be parsed.\n */\nexport function countBits(input: string): number {\n const out = getActive().count_bits(input);\n if (out.startsWith(\"error:\")) throw new Error(out);\n return Number.parseInt(out, 10);\n}\n\n/**\n * Split a bitmark document into per-bit source slices.\n *\n * @returns Array of `{ index, byteStart, byteEnd, source }`.\n */\nexport function splitBits(input: string): BitSlice[] {\n return JSON.parse(getActive().split_bits(input)) as BitSlice[];\n}\n\n/**\n * Transform a document bit-by-bit: apply an optional {@link PatchDocument}\n * and/or per-bit `preHook`/`postHook`, then re-emit.\n *\n * The patch document selects bits by pre-application index and/or id (or\n * `\"all\"`) and patches, removes, moves or inserts them; a bare array of\n * entries is the shorthand for \"patch every bit\". Hooks always see the\n * original bits, in order, before the document reshapes anything, and a\n * hook's patches apply after the document's for that bit. `diff` with\n * `outputFormat: \"patch\"` produces a document that turns one version of a\n * file into another.\n *\n * With neither hook, the whole document is transformed in a single WASM pass\n * (the fast path). When a `preHook` or `postHook` is supplied, `transform`\n * drives the bits one at a time on the calling thread — the hook inspects each\n * bit, may return patches / an output-format override / `drop`, and only data\n * crosses into WASM.\n *\n * `options.inputFormat` defaults to `\"auto\"`; prefer an explicit format when\n * known — see {@link convert}.\n *\n * @returns The transformed document, or an `error:`-prefixed string on failure.\n */\nexport function transform(input: string, options: TransformOptions = {}): string {\n const wasm = getActive();\n if (options.preHook || options.postHook) {\n return runHookedTransform(wasm as unknown as HookedWasm, input, options);\n }\n const patchJson =\n options.patch === undefined\n ? \"\"\n : typeof options.patch === \"string\"\n ? options.patch\n : JSON.stringify(options.patch);\n return wasm.transform(\n input,\n options.inputFormat ?? \"auto\",\n options.outputFormat ?? \"json\",\n options.mode ?? \"optimized\",\n patchJson,\n options.pretty ?? false,\n options.indent ?? 2,\n options.spacesAroundValues ?? 1,\n );\n}\n\n/**\n * Semantic diff of two documents (PLAN-179). Both sides are re-canonicalized\n * and compared as bit JSON; every difference is rendered as the canonical\n * bitmark an author would type. Bits are paired by `id`, then by `sourceBB`\n * on the same `sourceRL`, then by exact content, then by text similarity.\n *\n * @param a - The old document (bitmark or JSON).\n * @param b - The new document (bitmark or JSON; the formats need not match).\n * @param options - Diff options; `outputFormat` selects the unified-style\n * text (default), the per-bit JSON, or an applyable patch document.\n * @returns The diff in the selected format — empty text, an array of\n * `unchanged` bits, or a patch document with no entries when the two are\n * semantically equal.\n * @throws If the active variant was built without `diff`, or on a\n * conversion error.\n */\nexport function diff(a: string, b: string, options: DiffOptions = {}): string {\n const wasm = getActive();\n if (typeof wasm.diff !== \"function\") throw new UnsupportedFeatureError(\"diff\", variant());\n const out = wasm.diff(\n a,\n b,\n options.inputFormat ?? \"auto\",\n options.outputFormat ?? \"bitmark\",\n options.context ?? 3,\n options.locate ?? false,\n options.similarity ?? 0.6,\n options.bboxTolerance ?? 8,\n options.spacesAroundValues ?? 0,\n );\n if (out.startsWith(\"error:\")) throw new Error(out.slice(\"error:\".length).trim());\n return out;\n}\n\n/**\n * Typed form of {@link diff}: one {@link BitDiff} per aligned bit, unchanged\n * bits included (so the alignment is reconstructible). `outputFormat` is\n * ignored.\n */\nexport function diffBits(a: string, b: string, options: DiffOptions = {}): BitDiff[] {\n return JSON.parse(diff(a, b, { ...options, outputFormat: \"json\" })) as BitDiff[];\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param options - Breakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return getActive().breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param options - Unbreakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return getActive().unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param options - Info options (e.g. `{ infoType: \"bit\", format: \"json\", bit: \"cloze\" }`).\n * @returns Information string.\n */\nexport function info(options: InfoOptions = {}): string {\n const infoType = options.infoType ?? \"list\";\n const format = options.format ?? \"text\";\n const bit = options.bit ?? \"\";\n const pretty = options.pretty ?? false;\n const indent = options.indent ?? 2;\n const includeDeprecated = options.includeDeprecated ?? false;\n const onlyDeprecated = options.onlyDeprecated ?? false;\n const full = options.full ?? false;\n // The wasm boundary is flat strings: \"\" = English, a comma list selects\n // several, `all` selects every resolvable one. An array is the idiomatic JS\n // spelling of the list and joins to the same thing.\n const language =\n typeof options.language === \"string\"\n ? options.language\n : (options.language?.join(\",\") ?? \"\");\n return getActive().info(\n infoType,\n format,\n bit,\n pretty,\n indent,\n includeDeprecated,\n onlyDeprecated,\n full,\n language,\n );\n}\n\n/**\n * Register data with the parser (PLAN-173). One verb rather than a function\n * per registerable thing — the same discriminated-options idiom as\n * {@link info}.\n *\n * Today the only type is `\"translations\"`, whose `data` is the text of a\n * translations file — the format published at `@gmb/bitmark-parser/translations`,\n * which is also what the CLI's `--translations` flag reads.\n *\n * Semantics are REPLACE: a second call supersedes the first entirely, and the\n * variant's built-in table (if any) stays underneath, so a key your file omits\n * still resolves. State is process-global, like {@link init} — the per-consumer\n * axis is `language`, which stays a per-call option on {@link info}.\n *\n * Works in every variant, including the lean ones that bake no table at all,\n * and SURVIVES an {@link init} variant swap — the data is replayed onto the\n * newly activated module.\n *\n * @throws RegisterError if the data is not a valid translations document.\n */\nexport function register(options: RegisterOptions): void {\n const result = getActive().register(options.type, options.data);\n if (result) throw new RegisterError(result.replace(/^error:\\s*/, \"\"));\n // Survives an `init` swap: each variant is a separate wasm instance with\n // its own memory, and switching variants must stay invisible to callers.\n rememberRegistration(options.type, options.data);\n}\n","// @zen-component: WASM-TSBindings\n//\n// Browser entry. The wasm variant is selected at runtime (PLAN-166 /\n// PLAN-174): all three glue modules are bundled (small), but only the selected\n// variant's `.wasm` is fetched — `init()` loads `browser-full`,\n// `init({ feature: \"full\" })` the richest one (adds the `info` meta layer),\n// `init({ feature: \"bitmark-json\" })` the minimal bitmark ↔ JSON one. A later\n// re-init loads the new module in the background while every call keeps being\n// served by the active one, then swaps atomically between calls.\n//\n// import { init, convert, ... } from '@gmb/bitmark-parser/browser'\n\nimport wasmFullInit, {\n initSync as wasmFullInitSync,\n} from \"../../wasm-web/bitmark_wasm.js\";\nimport * as wasmFull from \"../../wasm-web/bitmark_wasm.js\";\nimport wasmBrowserFullInit, {\n initSync as wasmBrowserFullInitSync,\n} from \"../../wasm-web-browser-full/bitmark_browser_full_wasm.js\";\nimport * as wasmBrowserFull from \"../../wasm-web-browser-full/bitmark_browser_full_wasm.js\";\nimport wasmJsonInit, {\n initSync as wasmJsonInitSync,\n} from \"../../wasm-web-bitmark-json/bitmark_json_wasm.js\";\nimport * as wasmJson from \"../../wasm-web-bitmark-json/bitmark_json_wasm.js\";\nimport { PACKAGE_INFO } from \"../generated/package_info.js\";\nimport {\n getActive,\n setActive,\n variant,\n BROWSER_DEFAULT_FEATURE,\n type Feature,\n type InitOptions,\n type WasmModule,\n} from \"../core/facade.js\";\nimport type { HookedWasm } from \"../core/hooked-transform.js\";\nimport { orchestrateParallel } from \"../core/parallel.js\";\nimport { setLegacyWasmProvider, type LegacyWasm } from \"../legacy/runtime.js\";\nimport type { TransformOptions } from \"../types.js\";\nimport { runJobsParallel } from \"./pool.js\";\n\n// Path from this bundle to the shared `dist/browser/wasm/` asset dir, injected\n// by tsup `define` (PLAN-174) because the three browser bundles sit at\n// different depths. Only bundled code ever loads a `.wasm`; the `typeof` guard\n// just keeps the module importable unbundled (typedoc, type tests), where no\n// init call is made.\ndeclare const __BITMARK_WASM_BASE__: string;\nconst WASM_BASE =\n typeof __BITMARK_WASM_BASE__ === \"string\" ? __BITMARK_WASM_BASE__ : \"./\";\n\n// Variant map (PLAN-166 / PLAN-174): feature → glue + the `.wasm` filename\n// under that asset dir. A future variant is one entry here plus one\n// build-script table row.\ninterface VariantSpec {\n init: (module_or_path?: unknown) => Promise<unknown>;\n initSync: (module: unknown) => unknown;\n ns: WasmModule;\n wasmFile: string;\n}\nconst VARIANTS: Record<Feature, VariantSpec> = {\n full: {\n init: wasmFullInit as (m?: unknown) => Promise<unknown>,\n initSync: wasmFullInitSync as (m: unknown) => unknown,\n ns: wasmFull as unknown as WasmModule,\n wasmFile: \"bitmark_wasm_bg.wasm\",\n },\n \"browser-full\": {\n init: wasmBrowserFullInit as (m?: unknown) => Promise<unknown>,\n initSync: wasmBrowserFullInitSync as (m: unknown) => unknown,\n ns: wasmBrowserFull as unknown as WasmModule,\n wasmFile: \"bitmark_browser_full_wasm_bg.wasm\",\n },\n \"bitmark-json\": {\n init: wasmJsonInit as (m?: unknown) => Promise<unknown>,\n initSync: wasmJsonInitSync as (m: unknown) => unknown,\n ns: wasmJson as unknown as WasmModule,\n wasmFile: \"bitmark_json_wasm_bg.wasm\",\n },\n};\n\n// Legacy (bpg-compatible) API — namespaced; WASM must be init()ed before use.\n// Reads the ACTIVE wasm per call, so it follows init swaps; on `bitmark-json`\n// only its HTML-dependent members fail (PLAN-166 decision 4). No file I/O is\n// provided in the browser (file options throw, as bpg does).\nsetLegacyWasmProvider(() => getActive() as unknown as LegacyWasm);\nexport * as legacy from \"../legacy/index.js\";\n\n/** `init` options (browser): feature and/or an explicit wasm source. */\nexport interface BrowserInitOptions extends InitOptions {\n /** Explicit `.wasm` source (URL / Request / Response / Module / bytes). */\n module_or_path?: unknown;\n}\n\n/**\n * The variant an init call without an explicit `feature` selects.\n *\n * With no source, that is the browser default (`browser-full`, PLAN-174). With\n * an EXPLICIT source it stays `\"full\"`: those bytes predate this variant split\n * and are `bitmark_wasm_bg.wasm`, and glue must match the bytes it\n * instantiates — pairing them with another variant's glue fails at\n * instantiation. Name the feature alongside the source to load any other one.\n */\nfunction defaultFeatureFor(module_or_path: unknown): Feature {\n return module_or_path === undefined ? BROWSER_DEFAULT_FEATURE : \"full\";\n}\n\nfunction normalizeInit(arg: unknown): {\n feature: Feature;\n module_or_path?: unknown;\n} {\n if (\n arg !== null &&\n typeof arg === \"object\" &&\n !(arg instanceof URL) &&\n (\"feature\" in arg || \"module_or_path\" in arg)\n ) {\n const o = arg as BrowserInitOptions;\n return {\n feature: o.feature ?? defaultFeatureFor(o.module_or_path),\n module_or_path: o.module_or_path,\n };\n }\n // Back-compat: a bare module_or_path initialises `full`; nothing at all\n // initialises the browser default.\n const module_or_path = arg ?? undefined;\n return { feature: defaultFeatureFor(module_or_path), module_or_path };\n}\n\nlet initSeq = 0;\nlet activeOut: unknown;\nlet inflight:\n { feature: Feature; seq: number; promise: Promise<unknown> } | undefined;\n\n/**\n * Initialise the WASM module, selecting the variant (PLAN-166 / PLAN-174):\n * `\"browser-full\"` (the browser default — every conversion capability, without\n * the `info` meta layer), `\"full\"` (adds that meta layer: tag descriptions,\n * group provenance, raw mappingKeys patterns — bigger to download) or\n * `\"bitmark-json\"` (bitmark ↔ JSON only; markup formats, mapping report and\n * `lex` unavailable). All three glue modules are in the bundle; only the\n * selected variant's `.wasm` is fetched.\n *\n * May be called again to switch variants: the new module loads in the\n * background while calls keep being served by the active one, then one\n * atomic swap applies. Overlapping calls: same-feature in-flight inits are\n * coalesced; a different-feature init supersedes an unfinished one (its load\n * is discarded without swapping); every returned promise resolves once the\n * finally-active module is live. Re-init of the already-active feature is a\n * no-op unless an explicit `module_or_path` forces re-instantiation.\n *\n * When no explicit source is given, the default `.wasm` URL is decorated\n * with a cache-busting `?v=<version>` query parameter so CDN caches are\n * invalidated when the package version changes.\n *\n * Back-compat: `init(module_or_path)` (no options object) initialises `full`,\n * because those bytes are `bitmark_wasm_bg.wasm` — see {@link defaultFeatureFor}.\n */\nexport async function init(\n options?: BrowserInitOptions | unknown,\n): Promise<unknown> {\n const { feature, module_or_path } = normalizeInit(options);\n if (module_or_path === undefined) {\n if (!inflight && variant() === feature) return activeOut; // no-op\n if (inflight?.feature === feature) return inflight.promise; // coalesce\n }\n const mySeq = ++initSeq;\n const v = VARIANTS[feature];\n const source =\n module_or_path ??\n new URL(`${WASM_BASE}${v.wasmFile}?v=${PACKAGE_INFO.version}`, import.meta.url);\n const promise: Promise<unknown> = (async () => {\n try {\n const out = await v.init(source);\n if (mySeq === initSeq) {\n // Last call wins: a superseded load never swaps. The previous\n // module's reference is dropped here (its glue retains the instance\n // until that variant is re-initialised — wasm-bindgen keeps\n // module-level state).\n setActive(feature, v.ns);\n activeOut = out;\n }\n } finally {\n if (inflight?.seq === mySeq) inflight = undefined;\n }\n // Resolve to the finally-active state: if a newer init superseded this\n // one, wait for it (and any further successors) to settle.\n while (inflight) await inflight.promise.catch(() => {});\n return activeOut;\n })();\n inflight = { feature, seq: mySeq, promise };\n return promise;\n}\n\n/**\n * Synchronous initialisation from already-loaded wasm bytes / a compiled\n * `WebAssembly.Module` (no fetch). `options.feature` selects the variant the\n * bytes belong to — it must MATCH them, since glue and module are a pair.\n * Default `\"full\"`, for the same back-compat reason as {@link defaultFeatureFor}.\n */\nexport function initSync(module: unknown, options: InitOptions = {}): unknown {\n const feature = options.feature ?? defaultFeatureFor(module);\n const v = VARIANTS[feature];\n const out = v.initSync(module);\n setActive(feature, v.ns);\n activeOut = out;\n return out;\n}\n\nexport {\n variant,\n NotInitializedError,\n RegisterError,\n UnsupportedFeatureError,\n} from \"../core/facade.js\";\nexport type { Feature, InitOptions } from \"../core/facade.js\";\n\nexport type {\n LexOptions,\n LexStage,\n ParseOptions,\n ConvertOptions,\n OutputMode,\n BreakscapeOptions,\n TextFormat,\n TextLocation,\n InfoOptions,\n RegisterOptions,\n InfoType,\n InfoFormat,\n InputFormat,\n OutputFormat,\n CanonicalizeOptions,\n TransformOptions,\n PatchOp,\n PatchEntry,\n PathValue,\n PatchValueFor,\n PatchDocument,\n PatchDocumentEntry,\n BitSelector,\n DiffOptions,\n DiffOutputFormat,\n BitDiff,\n BitDiffRef,\n DiffHunk,\n DiffHunkLine,\n BitSlice,\n BitView,\n PreHook,\n PostHook,\n PreHookResult,\n TagFormat,\n BodyFormat,\n ResourceAttachment,\n CompactTagInfo,\n FullTagInfo,\n CompactVariantInfo,\n CompactSideInfo,\n CompactCardInfo,\n CompactCardSetInfo,\n FullVariantInfo,\n FullSideInfo,\n FullCardInfo,\n FullCardSetInfo,\n BodyRulesInfo,\n CompactBitInfo,\n FullBitInfo,\n BitListInfo,\n LanguagesInfo,\n BitInfo,\n AllBitsInfo,\n DeprecatedEntryInfo,\n DeprecatedInfo,\n InfoErrorResult,\n} from \"../types.js\";\nexport { patchEntry, ALL_LANGUAGES } from \"../types.js\";\n\n// Generated types for the parser's JSON (from bitmark.json via schemagen, PLAN-128)\nexport type * from \"../generated/bit-types.js\";\n\n// The shared wrappers (PLAN-166): every call reads the active wasm module.\nexport {\n lex,\n bitmarkToObjects,\n objectsToBitmark,\n convert,\n canonicalize,\n countBits,\n splitBits,\n transform,\n diff,\n diffBits,\n breakscapeText,\n unbreakscapeText,\n info,\n register,\n} from \"../core/api.js\";\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Parallel counterpart of {@link transform} (browser). Fans the per-bit WASM\n * compute across a pool of module `Worker`s (`options.workers`, default `4`);\n * each worker loads its own WASM instance of the ACTIVE variant.\n * `preHook`/`postHook` run on the calling thread. Call {@link init} before\n * use. Output is identical to {@link transform}; this trades worker startup\n * cost for throughput on large documents.\n *\n * **Requires the ESM build** (`@gmb/bitmark-parser/browser`, i.e.\n * `dist/browser/esm`): the module-`Worker` entry (`worker-entry.js`) and its\n * `.wasm` are emitted only beside that bundle. Module workers are ESM by\n * nature; the CJS / single-file min bundles ship the sync {@link transform}\n * only, and calling this there resolves to an `error:` string (the worker\n * file is absent). For throughput in those targets, use {@link transform} or\n * chunk + your own workers.\n *\n * @returns A Promise of the transformed document, or an `error:`-prefixed\n * string on failure.\n */\nexport function transformParallel(\n input: string,\n options: TransformOptions = {},\n): Promise<string> {\n const wasm = getActive() as unknown as HookedWasm;\n const feature: Feature = variant() ?? BROWSER_DEFAULT_FEATURE;\n return orchestrateParallel(wasm, input, options, (jobs, workers) =>\n runJobsParallel(jobs, workers, feature),\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../wasm-web/bitmark_wasm.js","../../wasm-web-browser-full/bitmark_browser_full_wasm.js","../../wasm-web-bitmark-json/bitmark_json_wasm.js","../../src/generated/package_info.ts","../../src/core/facade.ts","../../src/core/hooked-transform.ts","../../src/core/parallel.ts","../../src/legacy/runtime.ts","../../src/browser/pool.ts","../../src/legacy/index.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","../../src/types.ts","../../src/core/api.ts","../../src/browser/index.ts"],"names":["bitmark_wasm_exports","__export","breakscape_text","canonicalize","convert","convert_text","count_bits","bitmark_wasm_default","diff","info","info_text_supported","initSync","is_bitmark","prettify","register","resolve_patch_document","split_bits","split_json_bits","transform","unbreakscape_text","wasm","cachedTextDecoder","cachedUint8ArrayMemory0","getUint8ArrayMemory0","getStringFromWasm0","ptr","len","heap","heap_next","addHeapObject","obj","idx","WASM_VECTOR_LEN","cachedTextEncoder","encodeString","arg","view","buf","passStringToWasm0","malloc","realloc","mem","offset","code","ret","cachedDataViewMemory0","getDataViewMemory0","input","format","location","deferred4_0","deferred4_1","retptr","ptr0","len0","ptr1","len1","ptr2","len2","r0","r1","info_type","bit","pretty","indent","include_deprecated","only_deprecated","full","language","deferred5_0","deferred5_1","ptr3","len3","getObject","dropObject","takeObject","direction","deferred6_0","deferred6_1","r2","r3","ptr5","len5","input_format_sel","output_format_sel","mode","patch_json","spaces_around_values","deferred7_0","deferred7_1","ptr4","len4","ptr6","len6","a","b","context","locate","similarity","bbox_tolerance","data_type","data","include_unknown_properties","mapping_report","position_encoding","tokens_layout","deferred8_0","deferred8_1","ptr7","len7","deferred3_0","deferred3_1","deferred2_0","deferred2_1","json","__wbg_load","module","imports","e","bytes","instance","__wbg_get_imports","arg0","arg1","__wbg_finalize_init","__wbg_init","module_or_path","bitmark_browser_full_wasm_exports","bitmark_browser_full_wasm_default","bitmark_json_wasm_exports","bitmark_json_wasm_default","PACKAGE_INFO","BROWSER_DEFAULT_FEATURE","NotInitializedError","RegisterError","message","UnsupportedFeatureError","what","active","activeFeature","lazyLoader","registrations","getActive","setActive","feature","type","rememberRegistration","variant","stripArray","doc","t","patchJsonOf","patch","buildUnits","inputIsBitmark","slices","s","envelopes","env","index","planTransform","options","output","spacesAroundValues","sel","inputFormat","units","total","hooked","result","patchJson","resolved","_","jobs","views","item","hook","computeBit","job","out","recombine","elements","arr","runHookedTransform","plan","rendered","i","element","orchestrateParallel","runJobs","wasmProvider","setLegacyWasmProvider","provider","getLegacyWasm","runJobsParallel","workers","poolSize","workerUrl","resolve","reject","results","next","settled","done","pool","shutdown","w","fail","err","dispatch","id","ev","res","legacy_exports","Ast","BitType","BitmarkFileGenerator","BitmarkGenerator","BitmarkParser","BitmarkParserGenerator","BitmarkParserType","BitmarkStringGenerator","BitmarkVersion","BodyTextFormat","BoundingBoxIndex","Builder","CardSetVersion","FileWriter","HtmlTableGenerator","HtmlTableParser","InfoFormat","InfoType","Input","InputFormat","JsonFileGenerator","JsonGenerator","JsonParser","JsonStringGenerator","LegacyUnsupportedError","NodeType","Output","ResourceBuilder","StreamWriter","StringWriter","TextLocation","TextMarkType","TextNodeType","bitmarkTextParse","isPseudoAst","unsupportedMember","member","reason","unsupportedOption","option","V3_ONLY","validateVersionOptions","opts","validateBitmarkOptions","o","validateJsonOptions","prettyIndent","spacesAround","v","mapTextFormat","f","PSEUDO_AST_MARKER","makePseudoAst","bits","ast","RESOURCE_COLLECTION_KEYS","BUILT_BIT_PARSER","DATA_KEY_TO_JSON_KEY","DEPRECATED_TEXT_FORMATS","CONFIG_BODY_FORMAT_TO_TEXT_FORMAT","TAG_TEXT_KEYS","_options","src","bitType","bitConfig","textFormat","body","resources","list","collection","r","parser","extraProperties","key","value","built","_context","attrs","stripUndefined","toAst","bitmarkBody","exclude","k","jsonOptions","bitmarkOptions","source","isBitmark","outputFormat","coreFormat","emit","spaces","includeUnknown","inStr","extractHtmlTables","wrapped","isBitmarkText","textLocation","outStr","textAst","n","entries","parsed","entry","wrapper","outputFile","fileOptions","html","tables","lower","start","depth","j","end","open","close","closeEnd","text","RESOURCE_SPECS","buildResource","spec","_typeAlias","rest","inner","SPEC_BY_TYPE","__publicField","resource","single","nodes","asString","url","bitNameToKey","name","c","bitTypeCache","loadBitTypes","all","map","_t","prop","unsupportedEnum","stubClass","WALKER_REASON","INTERNAL_REASON","patchEntry","path","op","ALL_LANGUAGES","bitmarkToObjects","objectsToBitmark","semanticTokens","countBits","splitBits","diffBits","breakscapeText","unbreakscapeText","infoType","includeDeprecated","onlyDeprecated","WASM_BASE","VARIANTS","defaultFeatureFor","normalizeInit","initSeq","activeOut","inflight","init","mySeq","promise","version","transformParallel"],"mappings":"iPAAA,IAAAA,EAAAA,CAAA,EAAA,CAAAC,EAAAA,CAAAD,EAAAA,CAAA,CAAA,eAAA,CAAA,IAAAE,GAAA,YAAA,CAAA,IAAAC,EAAAA,CAAA,OAAA,CAAA,IAAAC,EAAAA,CAAA,YAAA,CAAA,IAAAC,EAAAA,CAAA,eAAAC,EAAAA,CAAA,OAAA,CAAA,IAAAC,EAAAA,CAAA,IAAA,CAAA,IAAAC,EAAAA,CAAA,IAAA,CAAA,IAAAC,GAAA,mBAAA,CAAA,IAAAC,EAAAA,CAAA,QAAA,CAAA,IAAAC,EAAAA,CAAA,UAAA,CAAA,IAAAC,EAAAA,CAAA,aAAAC,EAAAA,CAAA,QAAA,CAAA,IAAAC,EAAAA,CAAA,sBAAA,CAAA,IAAAC,EAAAA,CAAA,UAAA,CAAA,IAAAC,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A,CAAW,QAC1C,CAGA,KAAOA,IAAU,MAAMA,EAAAA,CAAS,QAAQ,KAAA,CAAM,IAAM,CAAC,CAAC,EACtD,OAAOD,EACT,IAAG,CACH,OAAAC,GAAW,CAAE,OAAA,CAAA1O,CAAAA,CAAS,GAAA,CAAK4O,EAAO,OAAA,CAAAC,CAAQ,EACnCA,CACT,CAQO,SAASlX,EAAAA,CAASyG,CAAAA,CAAiB6C,CAAAA,CAAuB,GAAa,CAC5E,IAAMjB,EAAUiB,CAAAA,CAAQ,OAAA,EAAWqN,GAAkBlQ,CAAM,CAAA,CACrDkJ,CAAAA,CAAI+G,EAAAA,CAASrO,CAAO,CAAA,CACpBmC,CAAAA,CAAMmF,EAAE,QAAA,CAASlJ,CAAM,EAC7B,OAAA2B,EAAAA,CAAUC,CAAAA,CAASsH,CAAAA,CAAE,EAAE,CAAA,CACvBmH,EAAAA,CAAYtM,EACLA,CACT,CA0GO,SAAS2M,EAAAA,EAAkB,CAChC,OAAO3P,EAAAA,CAAa,OACtB,CAqBO,SAAS4P,GACdhV,CAAAA,CACAkH,CAAAA,CAA4B,EAAC,CACZ,CACjB,IAAM7I,CAAAA,CAAO0H,GAAU,CACjBE,CAAAA,CAAmBG,IAAQ,EAAKf,EAAAA,CACtC,OAAOwD,EAAAA,CAAoBxK,CAAAA,CAAM2B,EAAOkH,CAAAA,CAAS,CAACY,EAAMsB,CAAAA,GACtDD,EAAAA,CAAgBrB,EAAMsB,CAAAA,CAASnD,CAAO,CACxC,CACF","file":"bitmark-parser.min.js","sourcesContent":["let wasm;\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst heap = new Array(128).fill(undefined);\n\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, `\"deprecated\"`, `\"bit-groups\"`,\n * or `\"resource-groups\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * `include_deprecated`: include deprecated bits in `list`/`all` (PLAN-149)\n * `only_deprecated`: restrict `list`/`all` to deprecated bits (wins over\n * `include_deprecated`)\n * `full`: complete outline for `bit`/`all` (default is the compact\n * one-line-per-tag view)\n * `language`: BCP-47 tag(s) for display names — \"\" = English, `\"de,fr\"` for\n * several (adds a `titles` map), `\"all\"` for every resolvable language\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @param {boolean} include_deprecated\n * @param {boolean} only_deprecated\n * @param {boolean} full\n * @param {string} language\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent, include_deprecated, only_deprecated, full, language) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(language, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, include_deprecated, only_deprecated, full, ptr3, len3);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred5_0 = r0;\n deferred5_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Whether this build can render `info` as TEXT (PLAN-192 D6). The export is\n * ABSENT when it cannot — the same \"presence is the capability\" signal\n * `diff` uses, so a caller tests for the function rather than for a\n * variant name.\n * @returns {boolean}\n */\nexport function info_text_supported() {\n const ret = wasm.info_text_supported();\n return ret !== 0;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nfunction dropObject(idx) {\n if (idx < 132) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n/**\n * Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).\n *\n * `direction`: `\"textToAst\"` | `\"astToText\"` | `\"astToPlainText\"`.\n * `format`: a bitmark text format (`\"bitmark++\"`, `\"bitmark+\"`) parses\n * inline marks; anything else is treated as plain text (textToAst only).\n * `location`: `\"body\"` (default) or `\"tag\"`.\n * Returns the converted fragment; throws on failure.\n * @param {string} input\n * @param {string} direction\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function convert_text(input, direction, format, location) {\n let deferred6_0;\n let deferred6_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr5 = r0;\n var len5 = r1;\n if (r3) {\n ptr5 = 0; len5 = 0;\n throw takeObject(r2);\n }\n deferred6_0 = ptr5;\n deferred6_1 = len5;\n return getStringFromWasm0(ptr5, len5);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);\n }\n}\n\n/**\n * Apply a patch (a JSON array of patch entries) to every bit and re-emit.\n *\n * `input_format_sel`: `\"auto\"` | `\"bitmark\"` | `\"json\"`.\n * `output_format_sel`: `\"bitmark\"` | `\"json\"` (default json).\n * `patch_json`: the patch entry array (empty string = no patches, i.e. a\n * canonicalizing pass). Parallelism is a JS-side concern (web workers); this\n * runs sequentially. Returns the document text/JSON; throws on failure.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {string} mode\n * @param {string} patch_json\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function transform(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {\n let deferred7_0;\n let deferred7_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n const ptr4 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len4 = WASM_VECTOR_LEN;\n wasm.transform(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, pretty, indent, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr6 = r0;\n var len6 = r1;\n if (r3) {\n ptr6 = 0; len6 = 0;\n throw takeObject(r2);\n }\n deferred7_0 = ptr6;\n deferred7_1 = len6;\n return getStringFromWasm0(ptr6, len6);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred7_0, deferred7_1, 1);\n }\n}\n\n/**\n * Resolve a patch document against `input` (bitmark or JSON) into the\n * ordered output items, so a JS per-bit planner (hooks, worker pool) can\n * reorder, drop and insert jobs from the one Rust implementation\n * (PLAN-179). Returns a JSON array of\n * `{ \"source\": <original index> | null, \"bit\": <inner bit> | null,\n * \"patch\": [ … ] }`; throws on failure.\n * @param {string} input\n * @param {string} patch_json\n * @returns {string}\n */\nexport function resolve_patch_document(input, patch_json) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr3 = r0;\n var len3 = r1;\n if (r3) {\n ptr3 = 0; len3 = 0;\n throw takeObject(r2);\n }\n deferred4_0 = ptr3;\n deferred4_1 = len3;\n return getStringFromWasm0(ptr3, len3);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Semantic diff of two documents (PLAN-179). Flat arguments like every\n * other export:\n * - `input_format`: `\"auto\"` | `\"bitmark\"` | `\"json\"` | a mapping id,\n * applied to both sides;\n * - `output_format`: `\"bitmark\"` (unified-style text) | `\"json\"` |\n * `\"patch\"`;\n * - `context`, `locate`, `similarity`, `bbox_tolerance`,\n * `spaces_around_values` as documented on `DiffOptions`.\n * Returns the diff (empty text / `[]` of unchanged bits / a patch document\n * with no entries when the documents are semantically equal); throws on\n * failure.\n * @param {string} a\n * @param {string} b\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {number} context\n * @param {boolean} locate\n * @param {number} similarity\n * @param {number} bbox_tolerance\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function diff(a, b, input_format_sel, output_format_sel, context, locate, similarity, bbox_tolerance, spaces_around_values) {\n let deferred6_0;\n let deferred6_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(a, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(b, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.diff(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, context, locate, similarity, bbox_tolerance, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr5 = r0;\n var len5 = r1;\n if (r3) {\n ptr5 = 0; len5 = 0;\n throw takeObject(r2);\n }\n deferred6_0 = ptr5;\n deferred6_1 = len5;\n return getStringFromWasm0(ptr5, len5);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);\n }\n}\n\n/**\n * Register data with the parser process (PLAN-173 P12).\n *\n * `data_type`: `\"translations\"` today. One verb rather than one function per\n * registerable thing — the same discriminated-options idiom as `info`.\n *\n * `data` is the file's own text. Semantics are REPLACE: a second call\n * supersedes the first entirely, and the built-in table (where the variant\n * bakes one) stays underneath. Throws on bad data — like every other\n * fallible export (PLAN-192 D1).\n *\n * Available in EVERY variant, including those that bake nothing: that is\n * exactly where a consumer must supply the file themselves.\n * @param {string} data_type\n * @param {string} data\n */\nexport function register(data_type, data) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(data_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.register(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n if (r1) {\n throw takeObject(r0);\n }\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\n/**\n * Convert between bitmark and JSON with explicit input/output formats + mode.\n *\n * `input_format`: `\"auto\"` (default) | `\"bitmark\"` | `\"json\"` | a mapping id.\n * `output_format`: `\"auto\"` (opposite of input) | `\"bitmark\"` | `\"json\"` |\n * `\"text\"` | `\"lex\"` (the token stream as JSON, bitmark input only) | a\n * mapping id.\n * `mode`: `\"optimized\"` (default) | `\"full\"`.\n * `mapping_report`: replace the output with a human-readable report of the\n * input→output mappings, including inputs that are NOT mapped (PLAN-147).\n * `position_encoding`: `\"utf-16\"` (default) | `\"utf-8\"` and `tokens_layout`:\n * `\"lsp\"` (default) | `\"absolute\"` — the `semantic-tokens` output's two\n * options (PLAN-193); `\"\"` means the default, and every other output\n * format ignores them.\n * Returns the converted text/JSON; throws on failure.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {string} mode\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @param {boolean} include_unknown_properties\n * @param {boolean} mapping_report\n * @param {string} position_encoding\n * @param {string} tokens_layout\n * @returns {string}\n */\nexport function convert(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, position_encoding, tokens_layout) {\n let deferred8_0;\n let deferred8_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n const ptr4 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len4 = WASM_VECTOR_LEN;\n const ptr5 = passStringToWasm0(tokens_layout, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len5 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, ptr4, len4, ptr5, len5);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr7 = r0;\n var len7 = r1;\n if (r3) {\n ptr7 = 0; len7 = 0;\n throw takeObject(r2);\n }\n deferred8_0 = ptr7;\n deferred8_1 = len7;\n return getStringFromWasm0(ptr7, len7);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred8_0, deferred8_1, 1);\n }\n}\n\n/**\n * Re-emit input in its own format in canonical form at `mode`.\n *\n * `input_format`: `\"auto\"` (default) | `\"bitmark\"` | `\"json\"` | any config\n * mapping id (`html`, `xml`, …). The output is re-emitted in this same format.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} mode\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function canonicalize(input, input_format_sel, mode, pretty, indent, spaces_around_values) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.canonicalize(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr4 = r0;\n var len4 = r1;\n if (r3) {\n ptr4 = 0; len4 = 0;\n throw takeObject(r2);\n }\n deferred5_0 = ptr4;\n deferred5_1 = len4;\n return getStringFromWasm0(ptr4, len4);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Count the bits in `input` (auto-detecting bitmark vs JSON).\n * Returns the count as a decimal string; throws on failure.\n * @param {string} input\n * @returns {string}\n */\nexport function count_bits(input) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.count_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr2 = r0;\n var len2 = r1;\n if (r3) {\n ptr2 = 0; len2 = 0;\n throw takeObject(r2);\n }\n deferred3_0 = ptr2;\n deferred3_1 = len2;\n return getStringFromWasm0(ptr2, len2);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Split a bitmark document into per-bit source slices.\n *\n * Returns a JSON array of `{ index, byteStart, byteEnd, source }`. Lets a JS\n * caller chunk a document at bit boundaries (e.g. to feed a worker pool).\n * @param {string} input\n * @returns {string}\n */\nexport function split_bits(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.split_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection\n * used across the API so a JS caller can resolve `\"auto\"` consistently.\n * @param {string} input\n * @returns {boolean}\n */\nexport function is_bitmark(input) {\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.is_bitmark(ptr0, len0);\n return ret !== 0;\n}\n\n/**\n * Split a JSON document (a top-level array of bit envelopes) into its per-bit\n * envelope objects, returned as a JSON array string. Lets a JS caller iterate\n * JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).\n * Throws if the input is not a JSON array of bits.\n * @param {string} input\n * @returns {string}\n */\nexport function split_json_bits(input) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.split_json_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr2 = r0;\n var len2 = r1;\n if (r3) {\n ptr2 = 0; len2 = 0;\n throw takeObject(r2);\n }\n deferred3_0 = ptr2;\n deferred3_1 = len2;\n return getStringFromWasm0(ptr2, len2);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Pretty-print a compact JSON string with the given indent. Used to format a\n * document recombined on the JS side (the per-bit hook path) so its output\n * matches the in-Rust recombination byte-for-byte.\n * @param {string} json\n * @param {number} indent\n * @returns {string}\n */\nexport function prettify(json, indent) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.prettify(retptr, ptr0, len0, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbindgen_error_new = function(arg0, arg1) {\n const ret = new Error(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n };\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n","let wasm;\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst heap = new Array(128).fill(undefined);\n\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, `\"deprecated\"`, `\"bit-groups\"`,\n * or `\"resource-groups\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * `include_deprecated`: include deprecated bits in `list`/`all` (PLAN-149)\n * `only_deprecated`: restrict `list`/`all` to deprecated bits (wins over\n * `include_deprecated`)\n * `full`: complete outline for `bit`/`all` (default is the compact\n * one-line-per-tag view)\n * `language`: BCP-47 tag(s) for display names — \"\" = English, `\"de,fr\"` for\n * several (adds a `titles` map), `\"all\"` for every resolvable language\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @param {boolean} include_deprecated\n * @param {boolean} only_deprecated\n * @param {boolean} full\n * @param {string} language\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent, include_deprecated, only_deprecated, full, language) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(language, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, include_deprecated, only_deprecated, full, ptr3, len3);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred5_0 = r0;\n deferred5_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Whether this build can render `info` as TEXT (PLAN-192 D6). The export is\n * ABSENT when it cannot — the same \"presence is the capability\" signal\n * `diff` uses, so a caller tests for the function rather than for a\n * variant name.\n * @returns {boolean}\n */\nexport function info_text_supported() {\n const ret = wasm.info_text_supported();\n return ret !== 0;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nfunction dropObject(idx) {\n if (idx < 132) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n/**\n * Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).\n *\n * `direction`: `\"textToAst\"` | `\"astToText\"` | `\"astToPlainText\"`.\n * `format`: a bitmark text format (`\"bitmark++\"`, `\"bitmark+\"`) parses\n * inline marks; anything else is treated as plain text (textToAst only).\n * `location`: `\"body\"` (default) or `\"tag\"`.\n * Returns the converted fragment; throws on failure.\n * @param {string} input\n * @param {string} direction\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function convert_text(input, direction, format, location) {\n let deferred6_0;\n let deferred6_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr5 = r0;\n var len5 = r1;\n if (r3) {\n ptr5 = 0; len5 = 0;\n throw takeObject(r2);\n }\n deferred6_0 = ptr5;\n deferred6_1 = len5;\n return getStringFromWasm0(ptr5, len5);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);\n }\n}\n\n/**\n * Apply a patch (a JSON array of patch entries) to every bit and re-emit.\n *\n * `input_format_sel`: `\"auto\"` | `\"bitmark\"` | `\"json\"`.\n * `output_format_sel`: `\"bitmark\"` | `\"json\"` (default json).\n * `patch_json`: the patch entry array (empty string = no patches, i.e. a\n * canonicalizing pass). Parallelism is a JS-side concern (web workers); this\n * runs sequentially. Returns the document text/JSON; throws on failure.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {string} mode\n * @param {string} patch_json\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function transform(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {\n let deferred7_0;\n let deferred7_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n const ptr4 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len4 = WASM_VECTOR_LEN;\n wasm.transform(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, pretty, indent, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr6 = r0;\n var len6 = r1;\n if (r3) {\n ptr6 = 0; len6 = 0;\n throw takeObject(r2);\n }\n deferred7_0 = ptr6;\n deferred7_1 = len6;\n return getStringFromWasm0(ptr6, len6);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred7_0, deferred7_1, 1);\n }\n}\n\n/**\n * Resolve a patch document against `input` (bitmark or JSON) into the\n * ordered output items, so a JS per-bit planner (hooks, worker pool) can\n * reorder, drop and insert jobs from the one Rust implementation\n * (PLAN-179). Returns a JSON array of\n * `{ \"source\": <original index> | null, \"bit\": <inner bit> | null,\n * \"patch\": [ … ] }`; throws on failure.\n * @param {string} input\n * @param {string} patch_json\n * @returns {string}\n */\nexport function resolve_patch_document(input, patch_json) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr3 = r0;\n var len3 = r1;\n if (r3) {\n ptr3 = 0; len3 = 0;\n throw takeObject(r2);\n }\n deferred4_0 = ptr3;\n deferred4_1 = len3;\n return getStringFromWasm0(ptr3, len3);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Semantic diff of two documents (PLAN-179). Flat arguments like every\n * other export:\n * - `input_format`: `\"auto\"` | `\"bitmark\"` | `\"json\"` | a mapping id,\n * applied to both sides;\n * - `output_format`: `\"bitmark\"` (unified-style text) | `\"json\"` |\n * `\"patch\"`;\n * - `context`, `locate`, `similarity`, `bbox_tolerance`,\n * `spaces_around_values` as documented on `DiffOptions`.\n * Returns the diff (empty text / `[]` of unchanged bits / a patch document\n * with no entries when the documents are semantically equal); throws on\n * failure.\n * @param {string} a\n * @param {string} b\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {number} context\n * @param {boolean} locate\n * @param {number} similarity\n * @param {number} bbox_tolerance\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function diff(a, b, input_format_sel, output_format_sel, context, locate, similarity, bbox_tolerance, spaces_around_values) {\n let deferred6_0;\n let deferred6_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(a, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(b, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.diff(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, context, locate, similarity, bbox_tolerance, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr5 = r0;\n var len5 = r1;\n if (r3) {\n ptr5 = 0; len5 = 0;\n throw takeObject(r2);\n }\n deferred6_0 = ptr5;\n deferred6_1 = len5;\n return getStringFromWasm0(ptr5, len5);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);\n }\n}\n\n/**\n * Register data with the parser process (PLAN-173 P12).\n *\n * `data_type`: `\"translations\"` today. One verb rather than one function per\n * registerable thing — the same discriminated-options idiom as `info`.\n *\n * `data` is the file's own text. Semantics are REPLACE: a second call\n * supersedes the first entirely, and the built-in table (where the variant\n * bakes one) stays underneath. Throws on bad data — like every other\n * fallible export (PLAN-192 D1).\n *\n * Available in EVERY variant, including those that bake nothing: that is\n * exactly where a consumer must supply the file themselves.\n * @param {string} data_type\n * @param {string} data\n */\nexport function register(data_type, data) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(data_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.register(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n if (r1) {\n throw takeObject(r0);\n }\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\n/**\n * Convert between bitmark and JSON with explicit input/output formats + mode.\n *\n * `input_format`: `\"auto\"` (default) | `\"bitmark\"` | `\"json\"` | a mapping id.\n * `output_format`: `\"auto\"` (opposite of input) | `\"bitmark\"` | `\"json\"` |\n * `\"text\"` | `\"lex\"` (the token stream as JSON, bitmark input only) | a\n * mapping id.\n * `mode`: `\"optimized\"` (default) | `\"full\"`.\n * `mapping_report`: replace the output with a human-readable report of the\n * input→output mappings, including inputs that are NOT mapped (PLAN-147).\n * `position_encoding`: `\"utf-16\"` (default) | `\"utf-8\"` and `tokens_layout`:\n * `\"lsp\"` (default) | `\"absolute\"` — the `semantic-tokens` output's two\n * options (PLAN-193); `\"\"` means the default, and every other output\n * format ignores them.\n * Returns the converted text/JSON; throws on failure.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {string} mode\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @param {boolean} include_unknown_properties\n * @param {boolean} mapping_report\n * @param {string} position_encoding\n * @param {string} tokens_layout\n * @returns {string}\n */\nexport function convert(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, position_encoding, tokens_layout) {\n let deferred8_0;\n let deferred8_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n const ptr4 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len4 = WASM_VECTOR_LEN;\n const ptr5 = passStringToWasm0(tokens_layout, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len5 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, ptr4, len4, ptr5, len5);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr7 = r0;\n var len7 = r1;\n if (r3) {\n ptr7 = 0; len7 = 0;\n throw takeObject(r2);\n }\n deferred8_0 = ptr7;\n deferred8_1 = len7;\n return getStringFromWasm0(ptr7, len7);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred8_0, deferred8_1, 1);\n }\n}\n\n/**\n * Re-emit input in its own format in canonical form at `mode`.\n *\n * `input_format`: `\"auto\"` (default) | `\"bitmark\"` | `\"json\"` | any config\n * mapping id (`html`, `xml`, …). The output is re-emitted in this same format.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} mode\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function canonicalize(input, input_format_sel, mode, pretty, indent, spaces_around_values) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.canonicalize(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr4 = r0;\n var len4 = r1;\n if (r3) {\n ptr4 = 0; len4 = 0;\n throw takeObject(r2);\n }\n deferred5_0 = ptr4;\n deferred5_1 = len4;\n return getStringFromWasm0(ptr4, len4);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Count the bits in `input` (auto-detecting bitmark vs JSON).\n * Returns the count as a decimal string; throws on failure.\n * @param {string} input\n * @returns {string}\n */\nexport function count_bits(input) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.count_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr2 = r0;\n var len2 = r1;\n if (r3) {\n ptr2 = 0; len2 = 0;\n throw takeObject(r2);\n }\n deferred3_0 = ptr2;\n deferred3_1 = len2;\n return getStringFromWasm0(ptr2, len2);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Split a bitmark document into per-bit source slices.\n *\n * Returns a JSON array of `{ index, byteStart, byteEnd, source }`. Lets a JS\n * caller chunk a document at bit boundaries (e.g. to feed a worker pool).\n * @param {string} input\n * @returns {string}\n */\nexport function split_bits(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.split_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection\n * used across the API so a JS caller can resolve `\"auto\"` consistently.\n * @param {string} input\n * @returns {boolean}\n */\nexport function is_bitmark(input) {\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.is_bitmark(ptr0, len0);\n return ret !== 0;\n}\n\n/**\n * Split a JSON document (a top-level array of bit envelopes) into its per-bit\n * envelope objects, returned as a JSON array string. Lets a JS caller iterate\n * JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).\n * Throws if the input is not a JSON array of bits.\n * @param {string} input\n * @returns {string}\n */\nexport function split_json_bits(input) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.split_json_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr2 = r0;\n var len2 = r1;\n if (r3) {\n ptr2 = 0; len2 = 0;\n throw takeObject(r2);\n }\n deferred3_0 = ptr2;\n deferred3_1 = len2;\n return getStringFromWasm0(ptr2, len2);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Pretty-print a compact JSON string with the given indent. Used to format a\n * document recombined on the JS side (the per-bit hook path) so its output\n * matches the in-Rust recombination byte-for-byte.\n * @param {string} json\n * @param {number} indent\n * @returns {string}\n */\nexport function prettify(json, indent) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.prettify(retptr, ptr0, len0, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbindgen_error_new = function(arg0, arg1) {\n const ret = new Error(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n };\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_browser_full_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n","let wasm;\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst heap = new Array(128).fill(undefined);\n\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, `\"deprecated\"`, `\"bit-groups\"`,\n * or `\"resource-groups\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * `include_deprecated`: include deprecated bits in `list`/`all` (PLAN-149)\n * `only_deprecated`: restrict `list`/`all` to deprecated bits (wins over\n * `include_deprecated`)\n * `full`: complete outline for `bit`/`all` (default is the compact\n * one-line-per-tag view)\n * `language`: BCP-47 tag(s) for display names — \"\" = English, `\"de,fr\"` for\n * several (adds a `titles` map), `\"all\"` for every resolvable language\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @param {boolean} include_deprecated\n * @param {boolean} only_deprecated\n * @param {boolean} full\n * @param {string} language\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent, include_deprecated, only_deprecated, full, language) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(language, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, include_deprecated, only_deprecated, full, ptr3, len3);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred5_0 = r0;\n deferred5_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nfunction dropObject(idx) {\n if (idx < 132) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n/**\n * Register data with the parser process (PLAN-173 P12).\n *\n * `data_type`: `\"translations\"` today. One verb rather than one function per\n * registerable thing — the same discriminated-options idiom as `info`.\n *\n * `data` is the file's own text. Semantics are REPLACE: a second call\n * supersedes the first entirely, and the built-in table (where the variant\n * bakes one) stays underneath. Throws on bad data — like every other\n * fallible export (PLAN-192 D1).\n *\n * Available in EVERY variant, including those that bake nothing: that is\n * exactly where a consumer must supply the file themselves.\n * @param {string} data_type\n * @param {string} data\n */\nexport function register(data_type, data) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(data_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.register(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n if (r1) {\n throw takeObject(r0);\n }\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\n/**\n * Apply a patch (a JSON array of patch entries) to every bit and re-emit.\n *\n * `input_format_sel`: `\"auto\"` | `\"bitmark\"` | `\"json\"`.\n * `output_format_sel`: `\"bitmark\"` | `\"json\"` (default json).\n * `patch_json`: the patch entry array (empty string = no patches, i.e. a\n * canonicalizing pass). Parallelism is a JS-side concern (web workers); this\n * runs sequentially. Returns the document text/JSON; throws on failure.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {string} mode\n * @param {string} patch_json\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function transform(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {\n let deferred7_0;\n let deferred7_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n const ptr4 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len4 = WASM_VECTOR_LEN;\n wasm.transform(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, pretty, indent, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr6 = r0;\n var len6 = r1;\n if (r3) {\n ptr6 = 0; len6 = 0;\n throw takeObject(r2);\n }\n deferred7_0 = ptr6;\n deferred7_1 = len6;\n return getStringFromWasm0(ptr6, len6);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred7_0, deferred7_1, 1);\n }\n}\n\n/**\n * Resolve a patch document against `input` (bitmark or JSON) into the\n * ordered output items, so a JS per-bit planner (hooks, worker pool) can\n * reorder, drop and insert jobs from the one Rust implementation\n * (PLAN-179). Returns a JSON array of\n * `{ \"source\": <original index> | null, \"bit\": <inner bit> | null,\n * \"patch\": [ … ] }`; throws on failure.\n * @param {string} input\n * @param {string} patch_json\n * @returns {string}\n */\nexport function resolve_patch_document(input, patch_json) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr3 = r0;\n var len3 = r1;\n if (r3) {\n ptr3 = 0; len3 = 0;\n throw takeObject(r2);\n }\n deferred4_0 = ptr3;\n deferred4_1 = len3;\n return getStringFromWasm0(ptr3, len3);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Convert between bitmark and JSON with explicit input/output formats + mode.\n *\n * `input_format`: `\"auto\"` (default) | `\"bitmark\"` | `\"json\"` | a mapping id.\n * `output_format`: `\"auto\"` (opposite of input) | `\"bitmark\"` | `\"json\"` |\n * `\"text\"` | `\"lex\"` (the token stream as JSON, bitmark input only) | a\n * mapping id.\n * `mode`: `\"optimized\"` (default) | `\"full\"`.\n * `mapping_report`: replace the output with a human-readable report of the\n * input→output mappings, including inputs that are NOT mapped (PLAN-147).\n * `position_encoding`: `\"utf-16\"` (default) | `\"utf-8\"` and `tokens_layout`:\n * `\"lsp\"` (default) | `\"absolute\"` — the `semantic-tokens` output's two\n * options (PLAN-193); `\"\"` means the default, and every other output\n * format ignores them.\n * Returns the converted text/JSON; throws on failure.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} output_format_sel\n * @param {string} mode\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @param {boolean} include_unknown_properties\n * @param {boolean} mapping_report\n * @param {string} position_encoding\n * @param {string} tokens_layout\n * @returns {string}\n */\nexport function convert(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, position_encoding, tokens_layout) {\n let deferred8_0;\n let deferred8_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n const ptr4 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len4 = WASM_VECTOR_LEN;\n const ptr5 = passStringToWasm0(tokens_layout, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len5 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, ptr4, len4, ptr5, len5);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr7 = r0;\n var len7 = r1;\n if (r3) {\n ptr7 = 0; len7 = 0;\n throw takeObject(r2);\n }\n deferred8_0 = ptr7;\n deferred8_1 = len7;\n return getStringFromWasm0(ptr7, len7);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred8_0, deferred8_1, 1);\n }\n}\n\n/**\n * Re-emit input in its own format in canonical form at `mode`.\n *\n * `input_format`: `\"auto\"` (default) | `\"bitmark\"` | `\"json\"` | any config\n * mapping id (`html`, `xml`, …). The output is re-emitted in this same format.\n * @param {string} input\n * @param {string} input_format_sel\n * @param {string} mode\n * @param {boolean} pretty\n * @param {number} indent\n * @param {number} spaces_around_values\n * @returns {string}\n */\nexport function canonicalize(input, input_format_sel, mode, pretty, indent, spaces_around_values) {\n let deferred5_0;\n let deferred5_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.canonicalize(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, spaces_around_values);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr4 = r0;\n var len4 = r1;\n if (r3) {\n ptr4 = 0; len4 = 0;\n throw takeObject(r2);\n }\n deferred5_0 = ptr4;\n deferred5_1 = len4;\n return getStringFromWasm0(ptr4, len4);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);\n }\n}\n\n/**\n * Count the bits in `input` (auto-detecting bitmark vs JSON).\n * Returns the count as a decimal string; throws on failure.\n * @param {string} input\n * @returns {string}\n */\nexport function count_bits(input) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.count_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr2 = r0;\n var len2 = r1;\n if (r3) {\n ptr2 = 0; len2 = 0;\n throw takeObject(r2);\n }\n deferred3_0 = ptr2;\n deferred3_1 = len2;\n return getStringFromWasm0(ptr2, len2);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Split a bitmark document into per-bit source slices.\n *\n * Returns a JSON array of `{ index, byteStart, byteEnd, source }`. Lets a JS\n * caller chunk a document at bit boundaries (e.g. to feed a worker pool).\n * @param {string} input\n * @returns {string}\n */\nexport function split_bits(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.split_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection\n * used across the API so a JS caller can resolve `\"auto\"` consistently.\n * @param {string} input\n * @returns {boolean}\n */\nexport function is_bitmark(input) {\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.is_bitmark(ptr0, len0);\n return ret !== 0;\n}\n\n/**\n * Split a JSON document (a top-level array of bit envelopes) into its per-bit\n * envelope objects, returned as a JSON array string. Lets a JS caller iterate\n * JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).\n * Throws if the input is not a JSON array of bits.\n * @param {string} input\n * @returns {string}\n */\nexport function split_json_bits(input) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.split_json_bits(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr2 = r0;\n var len2 = r1;\n if (r3) {\n ptr2 = 0; len2 = 0;\n throw takeObject(r2);\n }\n deferred3_0 = ptr2;\n deferred3_1 = len2;\n return getStringFromWasm0(ptr2, len2);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Pretty-print a compact JSON string with the given indent. Used to format a\n * document recombined on the JS side (the per-bit hook path) so its output\n * matches the in-Rust recombination byte-for-byte.\n * @param {string} json\n * @param {number} indent\n * @returns {string}\n */\nexport function prettify(json, indent) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.prettify(retptr, ptr0, len0, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).\n *\n * `direction`: `\"textToAst\"` | `\"astToText\"` | `\"astToPlainText\"`.\n * `format`: a bitmark text format (`\"bitmark++\"`, `\"bitmark+\"`) parses\n * inline marks; anything else is treated as plain text (textToAst only).\n * `location`: `\"body\"` (default) or `\"tag\"`.\n * Returns the converted fragment; throws on failure.\n * @param {string} input\n * @param {string} direction\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function convert_text(input, direction, format, location) {\n let deferred6_0;\n let deferred6_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len3 = WASM_VECTOR_LEN;\n wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr5 = r0;\n var len5 = r1;\n if (r3) {\n ptr5 = 0; len5 = 0;\n throw takeObject(r2);\n }\n deferred6_0 = ptr5;\n deferred6_1 = len5;\n return getStringFromWasm0(ptr5, len5);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbindgen_error_new = function(arg0, arg1) {\n const ret = new Error(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n };\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_json_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\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.0.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: TS-VariantFacade\n//\n// Runtime variant selection (PLAN-166). The package ships one API surface\n// backed by a mutable reference to the ACTIVE wasm module; `init({ feature })`\n// selects which wasm variant backs it, and a later re-init swaps the module\n// atomically between calls (every wasm call is stateless string → string).\n// Platform entries (Node / browser) own the loading; this module owns the\n// reference, the feature vocabulary, and the error types.\n\n/**\n * A deployable wasm feature set (PLAN-174).\n *\n * - `full` — everything, including the `info` META layer (tag descriptions,\n * group provenance, raw mappingKeys patterns). Native-CLI parity.\n * - `browser-full` — the same conversion capabilities as `full`, minus the\n * meta strings the browser should not pay to download.\n * - `bitmark-json` — bitmark ↔ JSON only.\n *\n * Size gating follows the DELIVERY CHANNEL, not the compilation target: a Node\n * backend loading wasm from disk has native-CLI requirements, while any entry\n * can be bundled for the browser. So every variant is buildable for both\n * targets and richness is always chosen explicitly. The per-entry defaults\n * below are conveniences; the contract is \"you get the variant you selected\".\n */\nexport type Feature = \"full\" | \"browser-full\" | \"bitmark-json\";\n\n/** Default variant for the Node entry — disk-loaded wasm, no download budget. */\nexport const NODE_DEFAULT_FEATURE: Feature = \"full\";\n\n/** Default variant for the browser entry — download latency is the budget. */\nexport const BROWSER_DEFAULT_FEATURE: Feature = \"browser-full\";\n\n/**\n * The wasm surface the shared wrappers drive. The optional members are the\n * capabilities a lean variant compiles out (calling their wrapper there\n * throws {@link UnsupportedFeatureError}).\n *\n * Every fallible member THROWS a JavaScript `Error` on failure (PLAN-192 D1);\n * its `message` is the core's error contract, `<kind> at <path>: <message>`,\n * with `<kind>` a stable kebab-case identifier. A returned string is always a\n * result — there is no in-band error prefix to test for.\n */\nexport interface WasmModule {\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: `\"utf-16\"` | `\"utf-8\"`, `\"\"` = default (PLAN-193). */\n positionEncoding: string,\n /** `semantic-tokens` output only: `\"lsp\"` | `\"absolute\"`, `\"\"` = default. */\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 transform(\n input: string,\n inputFormat: string,\n outputFormat: string,\n mode: string,\n patchJson: string,\n pretty: boolean,\n indent: number,\n spacesAroundValues: number,\n ): string;\n 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 /** Throws when the data is not valid for `dataType`. */\n register(dataType: string, data: string): void;\n count_bits(input: string): string;\n split_bits(input: string): string;\n split_json_bits(input: string): 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 breakscape_text(input: string, format: string, location: string): string;\n unbreakscape_text(input: string, format: string, location: string): string;\n /** Resolve a patch document against a document into ordered items (PLAN-179). */\n resolve_patch_document(input: string, patchJson: string): string;\n /**\n * Present only where this build can render `info` as TEXT (PLAN-192 D6) —\n * the same \"presence is the capability\" signal as `diff`, so no caller\n * has to test for a variant name. Absent on `bitmark-json`, where `info`\n * serves JSON only.\n */\n info_text_supported?(): boolean;\n /** Semantic diff (PLAN-179); absent on a variant built without `diff`. */\n diff?(\n a: string,\n b: string,\n inputFormat: string,\n outputFormat: string,\n context: number,\n locate: boolean,\n similarity: number,\n bboxTolerance: number,\n spacesAroundValues: number,\n ): string;\n}\n\n/** Options accepted by `init` / `initSync` on every platform entry. */\nexport interface InitOptions {\n /** Which wasm variant to load. Default: `\"full\"`. */\n feature?: Feature;\n}\n\n/** A call arrived before any wasm module was initialised (browser only). */\nexport class NotInitializedError extends Error {\n constructor() {\n super(\"wasm not initialised: call init() (or init({ feature: … })) first\");\n this.name = \"NotInitializedError\";\n }\n}\n\n/** `register` rejected the supplied data. */\nexport class RegisterError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"RegisterError\";\n }\n}\n\n/** A call needs a capability the ACTIVE wasm variant compiled out. */\nexport class UnsupportedFeatureError extends Error {\n constructor(what: string, active: Feature | undefined) {\n super(\n `${what} is not available in the loaded wasm module` +\n `${active ? ` (feature: \"${active}\")` : \"\"}; init({ feature: \"full\" }) to load it`,\n );\n this.name = \"UnsupportedFeatureError\";\n }\n}\n\nlet active: WasmModule | undefined;\nlet activeFeature: Feature | undefined;\nlet lazyLoader: (() => void) | undefined;\n\n// Data registered through `register`, kept so it can be REPLAYED onto each\n// newly activated module. Each variant is a separate wasm instance with its\n// own memory, so a registration made against one is invisible to the next —\n// and PLAN-166's promise is that swapping variants is invisible to the\n// caller. Keyed by type, because `register` replaces per type.\nconst registrations = new Map<string, string>();\n\n/**\n * The active wasm module. On Node the entry installs a lazy loader, so the\n * first call without an explicit `init` loads the default (`full`) variant\n * synchronously; in the browser an uninitialised call throws\n * {@link NotInitializedError} (wasm instantiation is async there).\n */\nexport function getActive(): WasmModule {\n if (!active && lazyLoader) lazyLoader();\n if (!active) throw new NotInitializedError();\n return active;\n}\n\n/** Swap the active module — the single atomic reference assignment. */\nexport function setActive(feature: Feature, module: WasmModule): void {\n // Replay first: a module that cannot take the registered data must not\n // become active half-configured. The data was accepted once already, so a\n // failure here is a bug worth surfacing rather than swallowing.\n for (const [type, data] of registrations) {\n try {\n module.register(type, data);\n } catch (e) {\n throw new RegisterError(e instanceof Error ? e.message : String(e));\n }\n }\n active = module;\n activeFeature = feature;\n}\n\n/**\n * Remember what `register` accepted, so it survives an `init` swap. Called\n * only after the ACTIVE module has accepted the same data.\n */\nexport function rememberRegistration(type: string, data: string): void {\n registrations.set(type, data);\n}\n\n/**\n * Install the Node lazy default loader (runs on the first call when no\n * explicit `init` happened; must call {@link setActive}).\n */\nexport function setLazyLoader(loader: () => void): void {\n lazyLoader = loader;\n}\n\n/** The active wasm feature, or `undefined` before the first init. */\nexport function variant(): Feature | undefined {\n return activeFeature;\n}\n","// @zen-component: TS-HookedTransform\n\nimport type { BitView, OutputFormat, PatchEntry, TransformOptions } from \"../types.js\";\n\n/**\n * The minimal WASM surface the per-bit hook driver needs. Both the Node and\n * browser entry points satisfy this with their loaded module.\n */\nexport interface HookedWasm {\n is_bitmark(input: string): boolean;\n split_bits(input: string): string;\n split_json_bits(input: string): string;\n prettify(json: string, indent: number): string;\n resolve_patch_document(input: string, patchJson: string): string;\n transform(\n input: string,\n inputFormat: string,\n outputFormat: string,\n mode: string,\n patchJson: string,\n pretty: boolean,\n indent: number,\n spacesAroundValues: number,\n ): string;\n}\n\n/** A single bit's compute job: data only, safe to ship to a worker thread. */\nexport interface BitJob {\n index: number;\n source: string;\n inputFormat: \"bitmark\" | \"json\";\n outputFormat: OutputFormat;\n mode: string;\n patchJson: string;\n spacesAroundValues: number;\n}\n\n/**\n * The result of running `preHook` over a document's bits: the compute `jobs`\n * for the bits that survived (in document order) and the matching `views`\n * (so `postHook` can be called per surviving bit), plus the document-level\n * recombination settings.\n */\nexport interface TransformPlan {\n jobs: BitJob[];\n views: BitView[];\n output: OutputFormat;\n pretty: boolean;\n indent: number;\n}\n\n/** Strip the outer `[ … ]` of a compact one-element JSON array. */\nexport function stripArray(doc: string): string {\n const t = doc.trim();\n return t.startsWith(\"[\") && t.endsWith(\"]\") ? t.slice(1, -1) : doc;\n}\n\n/**\n * The `patch` option as the JSON text the WASM resolver takes — a patch\n * document or the bare-array every-bit shorthand — or `\"\"` when absent.\n */\nfunction patchJsonOf(patch: TransformOptions[\"patch\"]): string {\n if (patch === undefined) return \"\";\n if (typeof patch === \"string\") return patch.trim();\n return JSON.stringify(patch);\n}\n\n/** One slot of the resolved patch document (see `resolve_patch_document`). */\ninterface ResolvedItem {\n source: number | null;\n bit: Record<string, unknown> | null;\n patch: PatchEntry[];\n}\n\nfunction buildUnits(\n wasm: HookedWasm,\n input: string,\n inputIsBitmark: boolean,\n): { view: BitView; source: string }[] {\n if (inputIsBitmark) {\n const slices = JSON.parse(wasm.split_bits(input)) as { index: number; source: string }[];\n return slices.map((s) => ({\n view: { format: \"bitmark\", index: s.index, total: slices.length, source: s.source },\n source: s.source,\n }));\n }\n const envelopes = JSON.parse(wasm.split_json_bits(input)) as {\n bit?: import(\"../generated/bit-types.js\").AnyBit;\n }[];\n return envelopes.map((env, index) => ({\n view: { format: \"json\", index, total: envelopes.length, bit: env.bit ?? {} },\n // Per-bit transform consumes a one-bit JSON document.\n source: JSON.stringify([env]),\n }));\n}\n\n/**\n * Split the document and run `preHook` (on the calling thread) for each bit,\n * producing the surviving compute jobs + their views. This is the main-thread\n * half shared by the sync and worker-pool drivers — only the resulting\n * data-only {@link BitJob}s ever cross to a worker.\n */\nexport function planTransform(\n wasm: HookedWasm,\n input: string,\n options: TransformOptions,\n): TransformPlan {\n const mode = options.mode ?? \"optimized\";\n const output: OutputFormat = options.outputFormat ?? \"json\";\n const spacesAroundValues = options.spacesAroundValues ?? 1;\n const indent = options.indent ?? 2;\n const pretty = options.pretty ?? false;\n\n const sel = options.inputFormat ?? \"auto\";\n const inputIsBitmark = sel === \"bitmark\" || (sel !== \"json\" && wasm.is_bitmark(input));\n const inputFormat = inputIsBitmark ? \"bitmark\" : \"json\";\n\n const units = buildUnits(wasm, input, inputIsBitmark);\n const total = units.length;\n\n // Hooks see the ORIGINAL bits, in order, before the patch document\n // reshapes anything (same as the Rust pipeline's Phase A).\n const hooked: ({ patches: PatchEntry[]; outputFormat: OutputFormat } | null)[] = [];\n for (let index = 0; index < total; index++) {\n const { view } = units[index];\n view.index = index;\n view.total = total;\n const result = options.preHook ? options.preHook(view) || {} : {};\n hooked.push(result.drop ? null : { patches: result.patches ?? [], outputFormat: result.outputFormat ?? output });\n }\n\n // The patch document (or the every-bit shorthand) is resolved by the one\n // Rust implementation into the ordered output slots; without a patch the\n // slots are simply the original bits.\n const patchJson = patchJsonOf(options.patch);\n let resolved: ResolvedItem[];\n if (patchJson === \"\") {\n resolved = units.map((_, index) => ({ source: index, bit: null, patch: [] }));\n } else {\n resolved = JSON.parse(wasm.resolve_patch_document(input, patchJson)) as ResolvedItem[];\n }\n\n const jobs: BitJob[] = [];\n const views: BitView[] = [];\n for (const item of resolved) {\n if (item.source !== null) {\n const hook = hooked[item.source];\n if (!hook) continue; // dropped by the pre-hook\n jobs.push({\n index: item.source,\n source: units[item.source].source,\n inputFormat,\n outputFormat: hook.outputFormat,\n mode,\n // The document's patches first, the hook's after (the hook contract).\n patchJson: JSON.stringify([...item.patch, ...hook.patches]),\n spacesAroundValues,\n });\n views.push(units[item.source].view);\n } else {\n // An inserted bit: a one-bit JSON document, seen by `postHook` only.\n const bit = (item.bit ?? {}) as import(\"../generated/bit-types.js\").AnyBit;\n const index = jobs.length;\n jobs.push({\n index,\n source: JSON.stringify([{ bit }]),\n inputFormat: \"json\",\n outputFormat: output,\n mode,\n patchJson: JSON.stringify(item.patch),\n spacesAroundValues,\n });\n views.push({ format: \"json\", index, total, bit });\n }\n }\n return { jobs, views, output, pretty, indent };\n}\n\n/**\n * Compute one bit's rendered element synchronously via WASM. The per-bit\n * element is always compact JSON (the document is prettified once on\n * recombination). Throws on failure.\n */\nexport function computeBit(wasm: HookedWasm, job: BitJob): string {\n const out = wasm.transform(\n job.source,\n job.inputFormat,\n job.outputFormat,\n job.mode,\n job.patchJson,\n false,\n 2,\n job.spacesAroundValues,\n );\n return job.outputFormat === \"json\" ? stripArray(out) : out;\n}\n\n/** Recombine per-bit elements into the final document, in document order. */\nexport function recombine(\n wasm: HookedWasm,\n elements: string[],\n output: OutputFormat,\n pretty: boolean,\n indent: number,\n): string {\n // Bitmark and plain-text bits both join with newlines; only JSON wraps as an\n // array. (`text` is output-only, lossy plain-text extraction.)\n if (output === \"bitmark\" || output === \"text\") return elements.join(\"\\n\");\n const arr = `[${elements.join(\",\")}]`;\n return pretty ? wasm.prettify(arr, indent) : arr;\n}\n\n/**\n * Per-bit transform driver (synchronous, in-process): split the document, run\n * `preHook` for each bit on the calling thread, apply the static patch + any\n * hook patches, re-emit the bit, run `postHook`, then recombine in document\n * order.\n *\n * Hooks run synchronously on the calling thread; only data crosses into WASM.\n * Used when a `preHook`/`postHook` is supplied; the hookless path stays a\n * single `wasm.transform` call. Throws on failure (PLAN-192 D1).\n */\nexport function runHookedTransform(\n wasm: HookedWasm,\n input: string,\n options: TransformOptions,\n): string {\n const plan: TransformPlan = planTransform(wasm, input, options);\n\n const rendered: string[] = [];\n for (let i = 0; i < plan.jobs.length; i++) {\n const element = computeBit(wasm, plan.jobs[i]);\n options.postHook?.(plan.views[i], element);\n rendered.push(element);\n }\n return recombine(wasm, rendered, plan.output, plan.pretty, plan.indent);\n}\n","// @zen-component: TS-ParallelOrchestrator\n\nimport type { TransformOptions } from \"../types.js\";\nimport { type BitJob, type HookedWasm, planTransform, recombine } from \"./hooked-transform.js\";\n\n/**\n * A platform pool: compute `jobs` across up to `workers` workers, returning the\n * rendered element per job in submission order. Node and browser supply their\n * own (worker_threads / Worker); the orchestration around it is shared.\n */\nexport type RunJobs = (jobs: BitJob[], workers: number) => Promise<string[]>;\n\n/**\n * Shared parallel transform orchestration. The main-thread half — split +\n * `preHook` + recombine + `postHook` — is identical to the sync driver; only\n * the data-only per-bit jobs cross to `runJobs` (the platform pool). Closures\n * (`preHook`/`postHook`) never leave the calling thread.\n *\n * Rejects on failure (PLAN-192 D1): the planning error, or the first worker /\n * job error the pool surfaces.\n */\nexport async function orchestrateParallel(\n wasm: HookedWasm,\n input: string,\n options: TransformOptions,\n runJobs: RunJobs,\n): Promise<string> {\n const plan = planTransform(wasm, input, options);\n const elements = await runJobs(plan.jobs, options.workers ?? 4);\n\n for (let i = 0; i < elements.length; i++) {\n options.postHook?.(plan.views[i], elements[i]);\n }\n return recombine(wasm, elements, plan.output, plan.pretty, plan.indent);\n}\n","// @zen-component: 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","// @zen-component: TS-BrowserWorkerPool\n//\n// A fixed-size browser Worker pool that computes per-bit transform jobs in\n// parallel. Mirrors the Node worker_threads pool: dispatch-on-idle, results\n// matched by id and returned in submission order, workers terminated when all\n// jobs settle. Each module worker loads its own WASM instance.\n\nimport type { Feature } from \"../core/facade.js\";\nimport type { BitJob } from \"../core/hooked-transform.js\";\n\ninterface JobResult {\n id: number;\n ok: boolean;\n element?: string;\n error?: string;\n}\n\n/**\n * Run `jobs` across up to `workers` module Workers, returning the rendered\n * element per job in submission order. Rejects on the first worker/job error.\n * Each worker loads the given wasm `feature` (PLAN-166) — the variant active\n * on the calling thread.\n */\nexport function runJobsParallel(jobs: BitJob[], workers: number, feature: Feature): Promise<string[]> {\n if (jobs.length === 0) return Promise.resolve([]);\n const poolSize = Math.max(1, Math.min(workers, jobs.length));\n // worker-entry.js is emitted beside this bundle (see tsup config).\n const workerUrl = new URL(\"./worker-entry.js\", import.meta.url);\n\n return new Promise<string[]>((resolve, reject) => {\n const results = new Array<string>(jobs.length);\n let next = 0;\n let settled = 0;\n let done = false;\n const pool: Worker[] = [];\n\n const shutdown = () => {\n for (const w of pool) w.terminate();\n };\n const fail = (err: Error) => {\n if (done) return;\n done = true;\n shutdown();\n reject(err);\n };\n const dispatch = (w: Worker) => {\n if (done || next >= jobs.length) return;\n const id = next++;\n w.postMessage({ id, job: jobs[id], feature });\n };\n\n for (let i = 0; i < poolSize; i++) {\n const w = new Worker(workerUrl, { type: \"module\" });\n pool.push(w);\n w.onmessage = (ev: MessageEvent<JobResult>) => {\n const res = ev.data;\n if (done) return;\n if (!res.ok) {\n fail(new Error(res.error ?? \"worker job failed\"));\n return;\n }\n results[res.id] = res.element as string;\n settled++;\n if (settled === jobs.length) {\n done = true;\n shutdown();\n resolve(results);\n return;\n }\n dispatch(w);\n };\n w.onerror = (e: ErrorEvent) => fail(new Error(e.message || \"worker error\"));\n }\n\n for (const w of pool) dispatch(w);\n });\n}\n","// @zen-component: LEGACY-Facade\n// The `legacy` namespace: a bpg-compatible (bitmark-parser-generator\n// v5.31.1) programmatic interface over the WASM core (PLAN-126).\n//\n// Everything here is exposed ONLY via `legacy.*` / the\n// `@gmb/bitmark-parser/legacy` subpath — nothing is re-exported at the\n// package root (reserved for the modern API and its future generated types).\n\nexport { BitmarkParserGenerator, bitmarkTextParse } from \"./bpg-class.js\";\nexport { Builder, type BuildBitOptions } from \"./builder.js\";\nexport { ResourceBuilder, type ResourceMethod } from \"./resource-builder.js\";\nexport { LegacyUnsupportedError } from \"./errors.js\";\nexport { isPseudoAst, type LegacyPseudoAst } from \"./pseudo-ast.js\";\n\n// Enum objects + option interfaces (vendored shapes)\nexport * from \"./options.js\";\nexport { BitType, BoundingBoxIndex, NodeType, TextMarkType, TextNodeType } from \"./enums-extra.js\";\n\n// Unsupported bpg internals — present but throwing (PLAN-126 F-2)\nexport {\n Ast,\n BitmarkFileGenerator,\n BitmarkGenerator,\n BitmarkParser,\n BitmarkStringGenerator,\n FileWriter,\n HtmlTableGenerator,\n HtmlTableParser,\n JsonFileGenerator,\n JsonGenerator,\n JsonParser,\n JsonStringGenerator,\n StreamWriter,\n StringWriter,\n} from \"./stubs.js\";\n\n// Vendored bpg JSON model / text-node types (type-only)\nexport type * from \"./vendor/BitJson.js\";\nexport type * from \"./vendor/BitWrapperJson.js\";\nexport type * from \"./vendor/BodyBitJson.js\";\nexport type * from \"./vendor/ParserJson.js\";\nexport type * from \"./vendor/ResourceJson.js\";\nexport type * from \"./vendor/TextNodes.js\";\n// bpg parity: bpg additionally exported JsonText under the alias `Text`\n// (bitmark-parser-generator src/index.ts: `JsonText as Text`).\nexport type { JsonText as Text } from \"./vendor/TextNodes.js\";\nexport type {\n ParserError,\n ParserInfo,\n ParserLocation,\n BitTypeType,\n TextFormatType,\n ResourceTypeType,\n TextMarkTypeType,\n TextNodeTypeType,\n} from \"./vendor/enums.js\";\n","// @zen-component: LEGACY-Facade\n\n/** Error thrown for bpg API members / options the legacy facade does not support. */\nexport class LegacyUnsupportedError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"LegacyUnsupportedError\";\n }\n}\n\n/** Throw for a bpg API member that is not supported (PLAN-126 F-2). */\nexport function unsupportedMember(member: string, reason?: string): never {\n throw new LegacyUnsupportedError(\n `'${member}' is not supported by the @gmb/bitmark-parser legacy API` + (reason ? `: ${reason}` : \"\"),\n );\n}\n\n/** Throw for an option that cannot be honoured (PLAN-126 F-9: never silently ignore). */\nexport function unsupportedOption(option: string, reason?: string): never {\n throw new LegacyUnsupportedError(\n `Option '${option}' is not supported by the @gmb/bitmark-parser legacy API` +\n (reason ? `: ${reason}` : \"\"),\n );\n}\n","// @zen-component: LEGACY-Facade\n// Central bpg-option → core-parameter translation table (PLAN-126 F-4/F-9).\n// Strict policy: options that map are honoured; options we cannot honour\n// throw a LegacyUnsupportedError naming the option. Sole exception:\n// `bitmarkParserType` is accepted and ignored — bpg v5.31.1 itself hardcodes\n// the peggy parser and ignores the option.\n\nimport { unsupportedOption } from \"./errors.js\";\nimport type { BitmarkOptions, JsonOptions } from \"./options.js\";\n\nconst V3_ONLY = \"bitmark v2 output is not supported (this parser is bitmark v3 only)\";\n\nexport function validateVersionOptions(opts: {\n bitmarkVersion?: number;\n bitmarkParserType?: string;\n}): void {\n if (opts.bitmarkVersion === 2) unsupportedOption(\"bitmarkVersion: 2\", V3_ONLY);\n // bitmarkParserType: accepted + ignored (documented exception).\n}\n\nexport function validateBitmarkOptions(o: BitmarkOptions): void {\n // 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 * unknown-bit-type 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} 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","// @zen-component: WASM-TSBindings\n\nimport type { PatchDocument } from \"./diff-types.js\";\nimport type { AnyBit } from \"./generated/bit-types.js\";\nimport type { PositionEncoding, TokensLayout } from \"./semantic-tokens-types.js\";\n\n/**\n * Output mode for JSON serialization.\n *\n * - `\"optimized\"` — omit keys whose values match their natural defaults.\n * - `\"full\"` — include all keys enumerated from the bitmark configuration.\n */\nexport type OutputMode = \"optimized\" | \"full\";\n\n/** Options for the typed conversion pair ({@link bitmarkToObjects} /\n * {@link objectsToBitmark}). */\nexport interface ParseOptions {\n /** JSON output mode (default: `\"optimized\"`). */\n mode?: OutputMode;\n /**\n * Include unknown properties in the bit JSON (default: `false`). Applies\n * to {@link bitmarkToObjects} only (parsing); ignored by\n * {@link objectsToBitmark} — unknown properties are never converted back\n * to bitmark. See {@link ConvertOptions.includeUnknownProperties}.\n */\n includeUnknownProperties?: boolean;\n}\n\n/**\n * Input format selector (adds auto-detection).\n *\n * `\"auto\"` sniffs bitmark-vs-JSON from the content; `\"bitmark\"` / `\"json\"` are\n * explicit; any config mapping id (e.g. `\"html\"`, `\"xml\"`) selects a markup\n * input that is reversed to the AST. The `(string & {})` arm admits those\n * config-driven mapping ids while keeping literal autocompletion.\n */\nexport type InputFormat = \"auto\" | \"bitmark\" | \"json\" | (string & {});\n\n/**\n * Concrete output format. `\"text\"` is lossy plain-text extraction,\n * `\"semantic-tokens\"` is parser-derived highlighting in the LSP shape (see\n * {@link semanticTokens}) and `\"lex\"` is the lexer's token stream as a JSON\n * array (`[{ kind, span, text }]`, byte spans; debug tooling) — all three are\n * output-only (they cannot be used as an input format), and the last two take\n * bitmark input only. Any config mapping id (`\"html\"`, `\"xml\"`, …) is accepted\n * too.\n */\nexport type OutputFormat =\n | \"bitmark\"\n | \"json\"\n | \"text\"\n | \"lex\"\n | \"semantic-tokens\"\n | (string & {});\n\n/** One lexer token of the `\"lex\"` output format. */\nexport interface LexToken {\n /** The token kind — the engine's own name for it (`\"BitStart(1, false)\"`,\n * `\"Text(Body, false)\"`, `\"Bold\"`, …). Not a stable vocabulary. */\n kind: string;\n /** Byte offsets into the source (UTF-8). */\n span: { start: number; end: number };\n /** The source slice. */\n text: string;\n}\n\n/** Options for the {@link convert} function. */\nexport interface ConvertOptions {\n /** Input format (default: `\"auto\"`). */\n inputFormat?: InputFormat;\n /** Output format (default: `\"auto\"` — the opposite of the input). */\n outputFormat?: OutputFormat | \"auto\";\n /** JSON output mode (default: `\"optimized\"`). */\n mode?: OutputMode;\n /** Include validation warnings in `parser.warnings` output (default: `false`). */\n warnings?: boolean;\n /** Output text as plain text — debug mode (default: `false`). */\n plainText?: boolean;\n /**\n * Prettify the JSON being emitted (default: `false`). For JSON output this\n * is the whole document; for bitmark output it is the embedded JSON bodies\n * of `json`-format bits (cosmetic — they re-parse to the same value).\n */\n pretty?: boolean;\n /** Indent size for pretty-printing (default: `2`). */\n indent?: number;\n /** Spaces around tag values in bitmark output, `0..=10` (default: `1`). */\n spacesAroundValues?: number;\n /**\n * Bitmark → JSON only: include unknown properties in the bit JSON\n * (default: `false`). An unknown property (`[@key:value]` the bit's\n * config cannot resolve, at the bit body/footer — never inside cards or\n * consumed by a chain) is appended after all real keys as an array of\n * strings (`[@u]` with no value → `true`); a key colliding with a\n * configured key is `_`-prefixed. Unknown properties are never converted\n * back to bitmark, and each occurrence still warns.\n */\n includeUnknownProperties?: boolean;\n /**\n * Replace the converted output with a human-readable MAPPING REPORT of\n * what each input construct mapped to — including inputs that are NOT\n * mapped (default: `false`). Composite conversions (e.g. xml → json)\n * report every leg, one section after the other.\n */\n mappingReport?: boolean;\n /**\n * `\"semantic-tokens\"` output only: how columns and lengths are counted —\n * `\"utf-16\"` code units (default; the LSP default, what browser editors\n * index by) or `\"utf-8\"` bytes. Echoed in the output; ignored by every\n * other output format.\n */\n positionEncoding?: PositionEncoding;\n /**\n * `\"semantic-tokens\"` output only: `\"lsp\"` (default) writes the relative\n * `data` array, `\"absolute\"` one `{ line, start, length, type, modifiers }`\n * object per token. Ignored by every other output format.\n */\n tokensLayout?: TokensLayout;\n}\n\n/** Options for the {@link canonicalize} function (the single same-format\n * re-emit surface; `mode` covers what the removed optimize/fullize did). */\nexport interface CanonicalizeOptions {\n /**\n * Input format (default: `\"auto\"`). The output is re-emitted in this same\n * format — e.g. `\"html\"` in, html out. `\"auto\"` sniffs bitmark vs JSON.\n */\n inputFormat?: InputFormat;\n /** Output mode (default: `\"optimized\"`; `\"full\"` emits all keys). */\n mode?: OutputMode;\n /**\n * Prettify the JSON being emitted (default: `false`) — the whole document\n * for JSON input, the embedded JSON bodies of `json`-format bits for\n * bitmark input.\n */\n pretty?: boolean;\n /** Indent size for pretty-printing (default: `2`). */\n indent?: number;\n /** Spaces around tag values in bitmark output, `0..=10` (default: `1`). */\n spacesAroundValues?: number;\n}\n\n/** A patch operation. */\nexport type PatchOp = \"set\" | \"create\" | \"delete\" | \"append\";\n\n/**\n * A patch entry. Either the verbose form `{ path, op, value? }` or the\n * shorthand single-key object `{ \"<path>\": value }` (which means `set`).\n *\n * `path` addresses the bit JSON directly (e.g. `id`,\n * `cards[2].question.instruction`, `id[-1]`). To modify bitmark, convert to\n * JSON, patch, then convert back — `transform` does this when the output\n * format is bitmark.\n */\nexport type PatchEntry =\n { path: string; op: PatchOp; value?: unknown } | Record<string, unknown>;\n\n// ── typed patch values (PLAN-128 §3.7) ──────────────────────────────────\n// The value type is resolved from the caller's literal path against `AnyBit`,\n// segment by segment — no enumeration of the path space, so compile cost is\n// per-call-site and bounded by the literal's length. Unresolvable segments and\n// dynamic (non-literal) paths degrade to `unknown`.\n\n/** @internal Peel `[n]` indexes off the front of `S`, unwrapping one array level each. */\ntype ApplyIndexes<T, S extends string> = S extends `[${string}]${infer Rest}`\n ? ApplyIndexes<T extends readonly (infer E)[] ? E : unknown, Rest>\n : T;\n\n/** @internal Resolve one dot-separated segment (`key`, `key[n]…`, or bare index). */\ntype Seg<T, S extends string> = S extends `${infer K}[${infer Rest}`\n ? ApplyIndexes<\n K extends \"\" ? T : K extends keyof T ? T[K] : unknown,\n `[${Rest}`\n >\n : S extends keyof T\n ? T[S]\n : S extends `${number}` | `-${number}`\n ? T extends readonly (infer E)[]\n ? E\n : unknown\n : unknown;\n\n/**\n * The type at patch path `P` within `T` (paths as in {@link PatchEntry}:\n * dot-separated keys with `[n]` indexes, negative-from-end allowed).\n */\nexport type PathValue<T, P extends string> = string extends P\n ? unknown\n : P extends `${infer S}.${infer Rest}`\n ? PathValue<NonNullable<Seg<T, S>>, Rest>\n : Seg<T, P>;\n\n/**\n * Build a {@link PatchEntry} with the `value` typed from the literal `path`,\n * resolved against {@link AnyBit}.\n *\n * For `append`, the value is typed as an *element* of the array at the path.\n *\n * @example\n * patchEntry(\"instruction\", \"set\", [{ type: \"paragraph\", content: [] }]);\n * patchEntry(\"id\", \"append\", \"1234\");\n * patchEntry(\"cards[0].question\", \"delete\");\n */\nexport type PatchValueFor<\n P extends string,\n O extends PatchOp,\n> = O extends \"append\"\n ? NonNullable<PathValue<AnyBit, P>> extends readonly (infer E)[]\n ? E\n : PathValue<AnyBit, P>\n : PathValue<AnyBit, P>;\n\nexport function patchEntry<const P extends string, const O extends PatchOp>(\n path: P,\n op: O,\n value?: PatchValueFor<P, O>,\n): PatchEntry {\n return value === undefined ? { path, op } : { path, op, value };\n}\n\n// The semantic-tokens types (PLAN-193) live in `semantic-tokens-types.ts`.\nexport type {\n PositionEncoding,\n TokensLayout,\n SemanticTokenType,\n SemanticTokenModifier,\n SemanticTokensLegend,\n SemanticToken,\n SemanticTokensLsp,\n SemanticTokensAbsolute,\n SemanticTokens,\n SemanticTokensOptions,\n} from \"./semantic-tokens-types.js\";\n\n// The patch document and diff types (PLAN-179) live in `diff-types.ts`.\nexport type {\n BitSelector,\n PatchDocumentEntry,\n PatchDocument,\n DiffOutputFormat,\n DiffOptions,\n BitDiffRef,\n DiffHunkLine,\n DiffHunk,\n BitDiff,\n} from \"./diff-types.js\";\n\n/** One bit's source slice within a bitmark document (from {@link splitBits}). */\nexport interface BitSlice {\n index: number;\n byteStart: number;\n byteEnd: number;\n source: string;\n}\n\n/**\n * What a {@link PreHook} / {@link PostHook} sees for one bit, in its source\n * format. `index` is the bit's 0-based position; `total` is the bit count.\n */\nexport type BitView =\n | { format: \"bitmark\"; index: number; total: number; source: string }\n | { format: \"json\"; index: number; total: number; bit: AnyBit };\n\n/**\n * What a {@link PreHook} may return for a bit. All fields are optional; an\n * empty result (or `void`) makes the hook a pure observer.\n */\nexport interface PreHookResult {\n /** Patches to apply to this bit, after the patch document's entries for it. */\n patches?: PatchEntry[];\n /** Override the output format for this bit only. */\n outputFormat?: OutputFormat;\n /** Drop the bit from the output entirely. */\n drop?: boolean;\n}\n\n/** Pre-processing hook: inspect a bit, optionally return modifications. */\nexport type PreHook = (view: BitView) => PreHookResult | void;\n\n/** Post-processing hook: observe a bit's input view and rendered output. */\nexport type PostHook = (view: BitView, output: string) => void;\n\n/** Options for the {@link transform} function. */\nexport interface TransformOptions {\n /** Input format (default: `\"auto\"`). */\n inputFormat?: InputFormat;\n /** Output format (default: `\"json\"`). */\n outputFormat?: OutputFormat;\n /** Output mode (default: `\"optimized\"`). */\n mode?: OutputMode;\n /**\n * A patch document (PLAN-179) — per-bit patches by selector, removes,\n * inserts and moves — or the every-bit shorthand: a bare array of entries\n * applied to every bit. Either form may be given as a JSON string.\n */\n patch?: PatchEntry[] | PatchDocument | string;\n /**\n * Per-bit pre-hook, run on the calling thread. Returns patches (applied\n * after the static `patch`), an output-format override, or `drop`. Providing\n * a `preHook` or `postHook` switches `transform` to the per-bit path; with\n * neither, the whole document is transformed in a single pass.\n */\n preHook?: PreHook;\n /** Per-bit post-hook, run on the calling thread after each bit is rendered. */\n postHook?: PostHook;\n /**\n * Worker-thread count for {@link transformParallel} (Node only; default `4`).\n * Ignored by the synchronous {@link transform}.\n */\n workers?: number;\n /** Prettify the emitted JSON (default: `false`) — for bitmark output, the\n * embedded JSON bodies of `json`-format bits. */\n pretty?: boolean;\n /** Indent size for pretty-printing (default: `2`). */\n indent?: number;\n /** Spaces around tag values in bitmark output, `0..=10` (default: `1`). */\n spacesAroundValues?: number;\n}\n\n/** Text format for breakscape / unbreakscape operations. */\nexport type TextFormat = \"bitmark++\" | \"plainText\";\n\n/** Text location for breakscape / unbreakscape operations. */\nexport type TextLocation = \"body\" | \"tag\";\n\n/** Options for the {@link breakscapeText} and {@link unbreakscapeText} functions. */\nexport interface BreakscapeOptions {\n /** Text format (default: `\"bitmark++\"`). */\n format?: TextFormat;\n /** Text location (default: `\"body\"`). */\n location?: TextLocation;\n}\n\n/** Info query type for the {@link info} function. */\nexport type InfoType =\n | \"list\"\n | \"bit\"\n | \"all\"\n | \"deprecated\"\n | \"bit-groups\"\n | \"resource-groups\"\n | \"languages\";\n\n/** Output format for the {@link info} function. */\nexport type InfoFormat = \"text\" | \"json\";\n\n/**\n * The language token selecting every language this build can resolve —\n * `info({ language: ALL_LANGUAGES })`. The same spelling the parser and the\n * CLI (`--language all`) use; exported so a consumer names it instead of\n * retyping the literal.\n */\nexport const ALL_LANGUAGES = \"all\";\n\n/** Options for the {@link info} function. */\nexport interface InfoOptions {\n /** Info query type (default: `\"list\"`). */\n infoType?: InfoType;\n /** Output format (default: `\"text\"`). */\n format?: InfoFormat;\n /** Bit name — required when `infoType` is `\"bit\"`. */\n bit?: string;\n /** Whether to pretty-print JSON output (default: `false`). */\n pretty?: boolean;\n /** Indent size for pretty-printing (default: `2`). */\n indent?: number;\n /** Include deprecated bits in `list`/`all` output (default: `false`). */\n includeDeprecated?: boolean;\n /** Restrict `list`/`all` output to deprecated bits only (default: `false`;\n * wins over `includeDeprecated`). */\n onlyDeprecated?: boolean;\n /** Full detail for `\"bit\"`/`\"all\"`: provenance, keys, card structure\n * (default `false` = compact one-line-per-tag view). */\n full?: boolean;\n /**\n * BCP-47 language tag(s) for DISPLAY NAMES — `title` on bits, bit groups\n * and resource groups. Default (or `\"\"`) is English.\n *\n * Accepts one tag (`\"de\"`), several (`[\"de\", \"fr\"]` or `\"de,fr\"`), or\n * {@link ALL_LANGUAGES} for every language this build can resolve — see\n * `info({ infoType: \"languages\" })`.\n *\n * **More than one language adds a `titles` map** to each result, so a\n * consumer building a multilingual index makes ONE call instead of one per\n * language. A single tag renders exactly as it always did, with no `titles`.\n *\n * Resolution narrows one subtag at a time (`de-CH` → `de`), then falls back\n * to the English title, then to the technical key. A partially translated\n * language is therefore safe: untranslated entries stay English rather than\n * emptying out. Technical identity — `name`, `key` — is never translated.\n *\n * Which translations are available depends on the variant and on\n * {@link register}: the `full` wasm bakes a table in, the lean variants\n * start empty and expect you to register one.\n */\n language?: string | readonly string[];\n}\n\n/** Options for {@link register}. Discriminated on `type`. */\nexport interface RegisterOptions {\n /** What kind of data `data` is. */\n type: \"translations\";\n /**\n * The file's own text — for `\"translations\"`, the JSON published at\n * `@gmb/bitmark-parser/translations`:\n * `{ \"<key>\": { \"<bcp47 tag>\": \"<display name>\" } }`, English excluded.\n */\n data: string;\n}\n\n/*\n * ── info JSON result types ────────────────────────────────────────────\n *\n * {@link info} returns a STRING — it renders a document, and `format:\n * \"text\"` / `pretty` / `indent` only mean anything for one. When you ask for\n * `format: \"json\"`, parse it and assert the matching type below:\n *\n * ```ts\n * const groups = JSON.parse(\n * info({ infoType: \"deprecated\", format: \"json\" }),\n * ) as DeprecatedInfo;\n * ```\n *\n * These shapes are a STABLE CONTRACT: a change to any of them is a\n * semver-major release. The normative definition is\n * `.zen/specs/API-INF-info-output.tsp`, enforced by the parser's\n * `info_contract_test`. TEXT output is explicitly NOT contractual — it is\n * human-readable and may change in any release, so never parse it.\n *\n * Fields marked \"info-meta only\" are absent from the wasm build (they carry\n * descriptions and provenance, kept out of the binary for size). Absence is\n * structural: the key is missing, never `null` or empty.\n *\n * Two invariants hold throughout, both enforced by the parser's test suite:\n *\n * 1. `null` is NEVER used for absence — a key whose fact does not apply is\n * missing. `null` appears only where it means something, and those fields\n * say so: `max: null` (unbounded), `default: null` (OMIT).\n * 2. {@link FullBitInfo} is a strict SUPERSET of {@link CompactBitInfo} —\n * same spelling, same values, full just adds. One parser reads either.\n */\n\n/** A tag's value format. Closed vocabulary. */\nexport type TagFormat =\n \"string\" | \"number\" | \"boolean\" | \"bitmark++\" | \"numberList4\" | \"enum\";\n\n/** A body region's resolved format. Closed vocabulary. */\nexport type BodyFormat = \"bitmark\" | \"text\" | \"json\" | \"latex\" | \"xml\";\n\n/**\n * A bit's resource-attachment rule: a mode keyword, or the explicit list of\n * permitted resource type names.\n */\nexport type ResourceAttachment = \"all\" | \"none\" | string[];\n\n/** A tag in compact (`full: false`) output. */\nexport interface CompactTagInfo {\n /** Tag name including its sigil, e.g. `@id`, `&image`, `#title`. */\n name: string;\n format: TagFormat;\n /** Enum vocabulary — only on `enum`-format tags. */\n values?: string[];\n /** Effective minimum occurrences. */\n min: number;\n /** Effective maximum occurrences; `null` means unbounded. */\n max: number | null;\n /**\n * Default value, wire-encoded. `null` means OMIT: the tag has no default\n * and absence is its canonical state — not \"unknown\".\n */\n default: string | null;\n /** Only present when the tag is always emitted (then always `true`). */\n alwaysEmit?: true;\n /** Chained tags; only present when non-empty. */\n chain?: CompactTagInfo[];\n}\n\n/** A tag in full (`full: true`) output. */\nexport interface FullTagInfo {\n name: string;\n /** info-meta only. */\n description?: string;\n /** Deprecation version — only on a deprecated tag. */\n deprecated?: string;\n format: TagFormat;\n /** Enum vocabulary — only on `enum`-format tags. */\n values?: string[];\n min: number;\n /** `null` means unbounded. */\n max: number | null;\n /** Pre-override minimum — present with `baseMax` when this context overrides. */\n baseMin?: number;\n /** Pre-override maximum; `null` means unbounded. */\n baseMax?: number | null;\n /** Wire-encoded default; `null` means OMIT. */\n default: string | null;\n /**\n * The format's natural default, wire-encoded. ABSENT for an omit tag\n * (`default: null`), which has no natural default.\n */\n naturalDefault?: string;\n alwaysEmit?: true;\n /** Output key per mapping type; `json` is always present. */\n mappingKeys: Record<string, string>;\n /** Only present when this context overrides the tag's key (then `true`). */\n keyOverridden?: true;\n /**\n * Group-inheritance path, outermost first. On info-meta builds this is\n * always present and `[]` is meaningful — the tag is declared DIRECTLY on\n * its owner. Absent means \"not reported\", never \"declared directly\".\n *\n * info-meta only.\n */\n via?: string[];\n chain?: FullTagInfo[];\n}\n\n/** Card-set structures in compact output. */\nexport interface CompactVariantInfo {\n /** 0-based position within the side. */\n position: number;\n tags: CompactTagInfo[];\n}\nexport interface CompactSideInfo {\n name: string;\n variants: CompactVariantInfo[];\n}\nexport interface CompactCardInfo {\n name: string;\n sides: CompactSideInfo[];\n}\nexport interface CompactCardSetInfo {\n key: string;\n cards: CompactCardInfo[];\n}\n\n/** Card-set structures in full output. */\nexport interface FullVariantInfo {\n position: number;\n bodyFormat: BodyFormat;\n bodyRequired: boolean;\n bodyForbidden: boolean;\n repeat: boolean;\n tags: FullTagInfo[];\n}\nexport interface FullSideInfo {\n name: string;\n repeat: boolean;\n variants: FullVariantInfo[];\n}\nexport interface FullCardInfo {\n name: string;\n isDefault: boolean;\n min: number;\n /** `null` means unbounded. */\n max: number | null;\n sides: FullSideInfo[];\n}\nexport interface FullCardSetInfo {\n key: string;\n cards: FullCardInfo[];\n}\n\n/** A bit's body rules (full output). */\nexport interface BodyRulesInfo {\n format: BodyFormat;\n required: boolean;\n forbidden: boolean;\n hasFooter: boolean;\n}\n\n/**\n * One bit in compact output.\n *\n * {@link FullBitInfo} is a strict superset: every key here appears there,\n * spelled identically and with an equal value.\n */\nexport interface CompactBitInfo {\n /** Bit type name, e.g. `cloze`. */\n name: string;\n /** Internal config id — stable only within one config version. */\n id: number;\n /** English display name; only present when authored. */\n title?: string;\n /**\n * Display names by BCP-47 tag, present ONLY when {@link InfoOptions.language}\n * named more than one (or `\"all\"`).\n *\n * Always carries `en` — the English title, which every build has. Otherwise\n * SPARSE: a requested language with no translation is absent rather than\n * filled with English, so a hole is visible instead of silently\n * indistinguishable. Keyed by the tag you ASKED for, not the one that\n * satisfied it: request `de-CH` with only `de` available and you read\n * `titles[\"de-CH\"]`.\n */\n titles?: Record<string, string>;\n /**\n * Description. info-meta only: present on the `full` wasm variant and every\n * native binary, absent on `browser-full` and `bitmark-json`.\n */\n description?: string;\n /** Bit-group keys this bit belongs to, sorted. Omitted when it has none. */\n bitGroups?: string[];\n /** Only present when the bit is deprecated. */\n deprecated?: string;\n /**\n * Only present when a migration target exists. Such a bit is re-emitted\n * under its target's name in every parser output, so this name identifies\n * legacy input and already-indexed content — never new parser output.\n */\n migrateTo?: string;\n tags: CompactTagInfo[];\n /** Required resource name — only present when one is required. Name only:\n * its chain is already in `tags`. */\n requiredResource?: string;\n /** Only present when the bit has a card set. */\n cardSet?: CompactCardSetInfo;\n}\n\n/** One bit in full output. */\nexport interface FullBitInfo {\n name: string;\n id: number;\n /** As {@link CompactBitInfo.title}. */\n title?: string;\n /** As {@link CompactBitInfo.titles}. */\n titles?: Record<string, string>;\n /** As {@link CompactBitInfo.description} — info-meta only. */\n description?: string;\n /** As {@link CompactBitInfo.bitGroups}. */\n bitGroups?: string[];\n /** Only present when the bit is deprecated. */\n deprecated?: string;\n /** Only present when a migration target exists. */\n migrateTo?: string;\n body: BodyRulesInfo;\n /** This bit's resource-attachment rule. */\n resourceAttachment: ResourceAttachment;\n /** Required resource name — only present when one is required. */\n requiredResource?: string;\n /** Bit-level mapping keys, where the config authors them. info-meta only. */\n mappingKeys?: Record<string, string>;\n tags: FullTagInfo[];\n /** Only present when the bit has a card set. */\n cardSet?: FullCardSetInfo;\n}\n\n/**\n * One member of a bit group. An object rather than a bare string so a\n * deprecated member can carry its facts.\n */\nexport interface BitGroupMemberInfo {\n name: string;\n /**\n * The member's display name, in the requested language — the same terms as\n * {@link BitGroupInfo.title}.\n *\n * This is what makes `bit-groups` a complete answer to \"every bit type,\n * what it is called, and which categories it is in\" in ONE call: without\n * it the only route carrying display names was `infoType: \"all\"`, which is\n * ~50× the payload.\n */\n title?: string;\n /** As {@link CompactBitInfo.titles}. */\n titles?: Record<string, string>;\n /** Only present for a deprecated member. */\n deprecated?: string;\n /**\n * Only present when a migration target exists. Such a bit is re-emitted\n * under its target's name, so this member matches already-indexed legacy\n * content, not new parser output.\n */\n migrateTo?: string;\n}\n\n/** One bit group: a search/filter category over bit types. */\nexport interface BitGroupInfo {\n /** Group key, e.g. `cloze`. Lookups also accept an alias. */\n key: string;\n title: string;\n /** As {@link CompactBitInfo.titles}. */\n titles?: Record<string, string>;\n description: string;\n /** Omitted when there are none. */\n aliases?: string[];\n /**\n * Informational parent group — NEVER implies membership. Intersecting a\n * bit's `bitGroups` with the groups carrying `subgroupOf: \"quizzes\"` is\n * how a consumer derives quiz categories.\n */\n subgroupOf?: string;\n /** Present, and always `true`, for a deliberately memberless group. */\n allowEmpty?: true;\n /**\n * Member bit types, name-sorted. Filtered by `includeDeprecated` /\n * `onlyDeprecated`, so the DEFAULT EXCLUDES deprecated members — a search\n * consumer matching already-indexed content passes `includeDeprecated`.\n */\n bitTypes: BitGroupMemberInfo[];\n}\n\n/** One resource group: a search/filter category over resource types. */\nexport interface ResourceGroupInfo {\n key: string;\n title: string;\n /** As {@link CompactBitInfo.titles}. */\n titles?: Record<string, string>;\n description: string;\n aliases?: string[];\n /**\n * Member resource types (canonical kebab-case), sorted. Consumers\n * normalize legacy camelCase (`imageLink` → `image-link`) before matching.\n */\n resourceTypes: string[];\n}\n\n/**\n * `infoType: \"bit-groups\"` — the bit-group catalog, key-sorted. Available\n * in every build, including the lean wasm variants.\n */\nexport type BitGroupsInfo = BitGroupInfo[];\n\n/** `infoType: \"resource-groups\"` — the resource-group catalog, key-sorted. */\nexport type ResourceGroupsInfo = ResourceGroupInfo[];\n\n/** `infoType: \"list\"` — bit type names in registry order. */\nexport type BitListInfo = string[];\n\n/**\n * `infoType: \"languages\"` — the BCP-47 tags this build can resolve, sorted.\n *\n * Always includes `\"en\"`. This is what `language: \"all\"` expands to, so a\n * consumer can enumerate the set rather than guess it; it grows when\n * {@link register} supplies a file carrying further languages.\n */\nexport type LanguagesInfo = string[];\n\n/** `infoType: \"bit\"` — one bit at the requested detail. */\nexport type BitInfo = CompactBitInfo | FullBitInfo;\n\n/** `infoType: \"all\"` — every bit at the requested detail, in registry order. */\nexport type AllBitsInfo = CompactBitInfo[] | FullBitInfo[];\n\n/** One entry of {@link DeprecatedInfo}. */\nexport interface DeprecatedEntryInfo {\n name: string;\n /** Always set — every entry is deprecated. */\n deprecated: string;\n /** Only present for a bit that migrates. */\n migrateTo?: string;\n}\n\n/** `infoType: \"deprecated\"` — every deprecated bit, in registry order. */\nexport type DeprecatedInfo = DeprecatedEntryInfo[];\n\n/**\n * Returned in place of a result when `infoType` is `\"bit\"` and the name is\n * unknown or missing. Distinguishable from every success shape: those are an\n * array, or an object with `name`.\n *\n * The `error` KEY is contractual; its message text is not.\n */\nexport interface InfoErrorResult {\n error: string;\n}\n","// @zen-component: TS-SharedApi\n//\n// The shared API wrappers (PLAN-166): platform entries re-export these. Every\n// call reads the ACTIVE wasm module through the variant facade at call time,\n// so an `init({ feature })` swap applies to the next call with no interface\n// change.\n\nimport type { AnyBit, Bit, BitEntry } from \"../generated/bit-types.js\";\nimport type {\n BitDiff,\n BitSlice,\n BreakscapeOptions,\n CanonicalizeOptions,\n ConvertOptions,\n DiffOptions,\n InfoOptions,\n RegisterOptions,\n ParseOptions,\n SemanticTokens,\n SemanticTokensOptions,\n TransformOptions,\n} from \"../types.js\";\nimport {\n getActive,\n rememberRegistration,\n RegisterError,\n UnsupportedFeatureError,\n variant,\n} from \"./facade.js\";\nimport { runHookedTransform, type HookedWasm } from \"./hooked-transform.js\";\n\n/**\n * Parse bitmark into typed bit entries.\n *\n * The typed (object) counterpart of\n * `convert(input, { inputFormat: \"bitmark\", outputFormat: \"json\" })`:\n * returns the entries as objects instead of a JSON string. **Bitmark input\n * only** — the format is pinned, no auto-detection.\n *\n * @example\n * const entries = bitmarkToObjects(\"[.article]\\nHello **world**\");\n * const bit = entries[0].bit;\n * if (bit.type === \"article\") console.log(bit.body);\n *\n * @throws If the core reports a conversion error.\n */\nexport function bitmarkToObjects(input: string, options: ParseOptions = {}): BitEntry[] {\n const out = getActive().convert(\n input,\n \"bitmark\",\n \"json\",\n options.mode ?? \"optimized\",\n false,\n 2,\n 1,\n options.includeUnknownProperties ?? false,\n false,\n \"\",\n \"\",\n );\n return JSON.parse(out) as BitEntry[];\n}\n\n/**\n * Compose bitmark text from typed bits or entries.\n *\n * The typed (object) counterpart of\n * `convert(json, { inputFormat: \"json\", outputFormat: \"bitmark\" })` — typed\n * objects are JSON by construction, so the format is pinned, no\n * auto-detection. Bare bits are auto-wrapped into entries; the config-driven\n * composer normalizes, defaults and validates on ingest — construct bits as\n * plain typed literals (no builder needed).\n *\n * @example\n * const bitmark = objectsToBitmark([{ type: \"article\", body: \"Hello\" }]);\n *\n * @throws If the core reports a compose error.\n */\nexport function objectsToBitmark(bits: readonly (Bit | AnyBit | BitEntry)[], options: ParseOptions = {}): string {\n const entries = bits.map((b) =>\n b !== null && typeof b === \"object\" && \"bit\" in b && typeof (b as BitEntry).bit === \"object\"\n ? b\n : { bit: b },\n );\n const out = getActive().convert(\n JSON.stringify(entries),\n \"json\",\n \"bitmark\",\n options.mode ?? \"optimized\",\n false,\n 2,\n 1,\n false,\n false,\n \"\",\n \"\",\n );\n return out;\n}\n\n/**\n * Convert between bitmark, JSON, and the mapped markup formats (html/xml/…) —\n * the single string-based conversion surface.\n *\n * The markup formats need a wasm variant built with `markup`; on\n * `bitmark-json` they throw an `unsupported` error.\n *\n * Performance: `inputFormat` defaults to `\"auto\"`, which detects the format\n * by scanning the input for a bitmark bit header — for non-bitmark input\n * that is a full pass over the whole input before parsing starts, and the\n * detection is heuristic (markup formats are never auto-detected). **If you\n * know the input format, set `inputFormat` explicitly.** For typed objects\n * use {@link bitmarkToObjects} / {@link objectsToBitmark}, which pin their\n * formats.\n *\n * @param input - Bitmark, JSON, or mapped-format input text.\n * @param options - Convert options (e.g. `{ inputFormat: \"bitmark\", mode: \"full\" }`).\n * @returns Converted output string. For bitmark input, this is a JSON string\n * array of structured parsed entries (`bit`, `parser`, `bitmark`).\n */\nexport function convert(input: string, options: ConvertOptions = {}): string {\n return getActive().convert(\n input,\n options.inputFormat ?? \"auto\",\n options.outputFormat ?? \"auto\",\n options.mode ?? \"optimized\",\n options.pretty ?? false,\n options.indent ?? 2,\n options.spacesAroundValues ?? 1,\n options.includeUnknownProperties ?? false,\n options.mappingReport ?? false,\n options.positionEncoding ?? \"\",\n options.tokensLayout ?? \"\",\n );\n}\n\n/**\n * Parser-derived highlighting of bitmark source in the LSP semantic-tokens\n * shape (PLAN-193) — the typed form of\n * `convert(input, { inputFormat: \"bitmark\", outputFormat: \"semantic-tokens\" })`.\n *\n * The parser runs (never the validator) and every byte of the source is\n * covered exactly once: unpaired marks are text, an abandoned tag is text\n * and the dividers it would have swallowed keep their meaning, a raw body\n * (`[.code]`, `==== text ====`) is one plain-text run per line. Token types\n * name sigil classes and syntax positions, never a bit or tag name; the tag\n * class, the commented-bit flag and `unclosed` are modifiers. Both layouts\n * carry the legend, so the response is self-describing.\n *\n * @param input - Bitmark source text.\n * @param options - `positionEncoding` (`\"utf-16\"`, the default, or `\"utf-8\"`)\n * and `tokensLayout` (`\"lsp\"`, the default, or `\"absolute\"`).\n * @returns A {@link SemanticTokens} object, discriminated by `layout`.\n * @throws On a variant built without `semantic-tokens` (an `unsupported`\n * error).\n */\nexport function semanticTokens(input: string, options: SemanticTokensOptions = {}): SemanticTokens {\n return JSON.parse(\n convert(input, {\n inputFormat: \"bitmark\",\n outputFormat: \"semantic-tokens\",\n positionEncoding: options.positionEncoding,\n tokensLayout: options.tokensLayout,\n }),\n ) as SemanticTokens;\n}\n\n/**\n * Re-emit input in its own format in canonical form — the single same-format\n * surface (the former `optimize`/`fullize`/`expand` were pure mode pins of\n * this function and were removed).\n *\n * @param input - Input text (bitmark, JSON, or a markup format such as html/xml).\n * @param options - `mode`: `\"optimized\"` (default — omit natural defaults) or\n * `\"full\"` (emit all keys). `inputFormat` selects the format (default:\n * `\"auto\"`; prefer explicit — see {@link convert}); the output is\n * re-emitted in that same format.\n */\nexport function canonicalize(input: string, options: CanonicalizeOptions = {}): string {\n return getActive().canonicalize(\n input,\n options.inputFormat ?? \"auto\",\n options.mode ?? \"optimized\",\n options.pretty ?? false,\n options.indent ?? 2,\n options.spacesAroundValues ?? 1,\n );\n}\n\n/**\n * Count the bits in `input`, auto-detecting bitmark vs JSON (heuristic —\n * a full input scan when the input is not bitmark; see {@link convert}).\n *\n * @throws If the input cannot be parsed.\n */\nexport function countBits(input: string): number {\n return Number.parseInt(getActive().count_bits(input), 10);\n}\n\n/**\n * Split a bitmark document into per-bit source slices.\n *\n * @returns Array of `{ index, byteStart, byteEnd, source }`.\n */\nexport function splitBits(input: string): BitSlice[] {\n return JSON.parse(getActive().split_bits(input)) as BitSlice[];\n}\n\n/**\n * Transform a document bit-by-bit: apply an optional {@link PatchDocument}\n * and/or per-bit `preHook`/`postHook`, then re-emit.\n *\n * The patch document selects bits by pre-application index and/or id (or\n * `\"all\"`) and patches, removes, moves or inserts them; a bare array of\n * entries is the shorthand for \"patch every bit\". Hooks always see the\n * original bits, in order, before the document reshapes anything, and a\n * hook's patches apply after the document's for that bit. `diff` with\n * `outputFormat: \"patch\"` produces a document that turns one version of a\n * file into another.\n *\n * With neither hook, the whole document is transformed in a single WASM pass\n * (the fast path). When a `preHook` or `postHook` is supplied, `transform`\n * drives the bits one at a time on the calling thread — the hook inspects each\n * bit, may return patches / an output-format override / `drop`, and only data\n * crosses into WASM.\n *\n * `options.inputFormat` defaults to `\"auto\"`; prefer an explicit format when\n * known — see {@link convert}.\n *\n * @returns The transformed document.\n * @throws If the core reports a conversion or patch error.\n */\nexport function transform(input: string, options: TransformOptions = {}): string {\n const wasm = getActive();\n if (options.preHook || options.postHook) {\n return runHookedTransform(wasm as unknown as HookedWasm, input, options);\n }\n const patchJson =\n options.patch === undefined\n ? \"\"\n : typeof options.patch === \"string\"\n ? options.patch\n : JSON.stringify(options.patch);\n return wasm.transform(\n input,\n options.inputFormat ?? \"auto\",\n options.outputFormat ?? \"json\",\n options.mode ?? \"optimized\",\n patchJson,\n options.pretty ?? false,\n options.indent ?? 2,\n options.spacesAroundValues ?? 1,\n );\n}\n\n/**\n * Semantic diff of two documents (PLAN-179). Both sides are re-canonicalized\n * and compared as bit JSON; every difference is rendered as the canonical\n * bitmark an author would type. Bits are paired by `id`, then by `sourceBB`\n * on the same `sourceRL`, then by exact content, then by text similarity.\n *\n * @param a - The old document (bitmark or JSON).\n * @param b - The new document (bitmark or JSON; the formats need not match).\n * @param options - Diff options; `outputFormat` selects the unified-style\n * text (default), the per-bit JSON, or an applyable patch document.\n * @returns The diff in the selected format — empty text, an array of\n * `unchanged` bits, or a patch document with no entries when the two are\n * semantically equal.\n * @throws If the active variant was built without `diff`, or on a\n * conversion error.\n */\nexport function diff(a: string, b: string, options: DiffOptions = {}): string {\n const wasm = getActive();\n if (typeof wasm.diff !== \"function\") throw new UnsupportedFeatureError(\"diff\", variant());\n const out = wasm.diff(\n a,\n b,\n options.inputFormat ?? \"auto\",\n options.outputFormat ?? \"bitmark\",\n options.context ?? 3,\n options.locate ?? false,\n options.similarity ?? 0.6,\n options.bboxTolerance ?? 8,\n options.spacesAroundValues ?? 0,\n );\n return out;\n}\n\n/**\n * Typed form of {@link diff}: one {@link BitDiff} per aligned bit, unchanged\n * bits included (so the alignment is reconstructible). `outputFormat` is\n * ignored.\n */\nexport function diffBits(a: string, b: string, options: DiffOptions = {}): BitDiff[] {\n return JSON.parse(diff(a, b, { ...options, outputFormat: \"json\" })) as BitDiff[];\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param options - Breakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return getActive().breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param options - Unbreakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return getActive().unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * `format` defaults to `\"text\"`, the human-readable rendering. That renderer\n * is only in the variants built with `info-text` — on `bitmark-json` it is\n * compiled out and this throws {@link UnsupportedFeatureError}; ask for\n * `format: \"json\"` there (the JSON views are the contractual ones and are in\n * every variant).\n *\n * @param options - Info options (e.g. `{ infoType: \"bit\", format: \"json\", bit: \"cloze\" }`).\n * @returns Information string.\n * @throws UnsupportedFeatureError if `format` is `\"text\"` on a variant built\n * without the text renderer.\n */\nexport function info(options: InfoOptions = {}): string {\n const infoType = options.infoType ?? \"list\";\n const format = options.format ?? \"text\";\n const bit = options.bit ?? \"\";\n const pretty = options.pretty ?? false;\n const indent = options.indent ?? 2;\n const includeDeprecated = options.includeDeprecated ?? false;\n const onlyDeprecated = options.onlyDeprecated ?? false;\n const full = options.full ?? false;\n // The wasm boundary is flat strings: \"\" = English, a comma list selects\n // several, `all` selects every resolvable one. An array is the idiomatic JS\n // spelling of the list and joins to the same thing.\n const language =\n typeof options.language === \"string\"\n ? options.language\n : (options.language?.join(\",\") ?? \"\");\n const wasm = getActive();\n if (format !== \"json\" && typeof wasm.info_text_supported !== \"function\") {\n throw new UnsupportedFeatureError('info (format: \"text\")', variant());\n }\n return wasm.info(\n infoType,\n format,\n bit,\n pretty,\n indent,\n includeDeprecated,\n onlyDeprecated,\n full,\n language,\n );\n}\n\n/**\n * Register data with the parser (PLAN-173). One verb rather than a function\n * per registerable thing — the same discriminated-options idiom as\n * {@link info}.\n *\n * Today the only type is `\"translations\"`, whose `data` is the text of a\n * translations file — the format published at `@gmb/bitmark-parser/translations`,\n * which is also what the CLI's `--translations` flag reads.\n *\n * Semantics are REPLACE: a second call supersedes the first entirely, and the\n * variant's built-in table (if any) stays underneath, so a key your file omits\n * still resolves. State is process-global, like {@link init} — the per-consumer\n * axis is `language`, which stays a per-call option on {@link info}.\n *\n * Works in every variant, including the lean ones that bake no table at all,\n * and SURVIVES an {@link init} variant swap — the data is replayed onto the\n * newly activated module.\n *\n * @throws RegisterError if the data is not a valid translations document.\n */\nexport function register(options: RegisterOptions): void {\n try {\n getActive().register(options.type, options.data);\n } catch (e) {\n throw new RegisterError(e instanceof Error ? e.message : String(e));\n }\n // Survives an `init` swap: each variant is a separate wasm instance with\n // its own memory, and switching variants must stay invisible to callers.\n rememberRegistration(options.type, options.data);\n}\n","// @zen-component: WASM-TSBindings\n//\n// Browser entry. The wasm variant is selected at runtime (PLAN-166 /\n// PLAN-174): all three glue modules are bundled (small), but only the selected\n// variant's `.wasm` is fetched — `init()` loads `browser-full`,\n// `init({ feature: \"full\" })` the richest one (adds the `info` meta layer),\n// `init({ feature: \"bitmark-json\" })` the minimal bitmark ↔ JSON one. A later\n// re-init loads the new module in the background while every call keeps being\n// served by the active one, then swaps atomically between calls.\n//\n// import { init, convert, ... } from '@gmb/bitmark-parser/browser'\n\nimport wasmFullInit, {\n initSync as wasmFullInitSync,\n} from \"../../wasm-web/bitmark_wasm.js\";\nimport * as wasmFull from \"../../wasm-web/bitmark_wasm.js\";\nimport wasmBrowserFullInit, {\n initSync as wasmBrowserFullInitSync,\n} from \"../../wasm-web-browser-full/bitmark_browser_full_wasm.js\";\nimport * as wasmBrowserFull from \"../../wasm-web-browser-full/bitmark_browser_full_wasm.js\";\nimport wasmJsonInit, {\n initSync as wasmJsonInitSync,\n} from \"../../wasm-web-bitmark-json/bitmark_json_wasm.js\";\nimport * as wasmJson from \"../../wasm-web-bitmark-json/bitmark_json_wasm.js\";\nimport { PACKAGE_INFO } from \"../generated/package_info.js\";\nimport {\n getActive,\n setActive,\n variant,\n BROWSER_DEFAULT_FEATURE,\n type Feature,\n type InitOptions,\n type WasmModule,\n} from \"../core/facade.js\";\nimport type { HookedWasm } from \"../core/hooked-transform.js\";\nimport { orchestrateParallel } from \"../core/parallel.js\";\nimport { setLegacyWasmProvider, type LegacyWasm } from \"../legacy/runtime.js\";\nimport type { TransformOptions } from \"../types.js\";\nimport { runJobsParallel } from \"./pool.js\";\n\n// Path from this bundle to the shared `dist/browser/wasm/` asset dir, injected\n// by tsup `define` (PLAN-174) because the three browser bundles sit at\n// different depths. Only bundled code ever loads a `.wasm`; the `typeof` guard\n// just keeps the module importable unbundled (typedoc, type tests), where no\n// init call is made.\ndeclare const __BITMARK_WASM_BASE__: string;\nconst WASM_BASE =\n typeof __BITMARK_WASM_BASE__ === \"string\" ? __BITMARK_WASM_BASE__ : \"./\";\n\n// Variant map (PLAN-166 / PLAN-174): feature → glue + the `.wasm` filename\n// under that asset dir. A future variant is one entry here plus one\n// build-script table row.\ninterface VariantSpec {\n init: (module_or_path?: unknown) => Promise<unknown>;\n initSync: (module: unknown) => unknown;\n ns: WasmModule;\n wasmFile: string;\n}\nconst VARIANTS: Record<Feature, VariantSpec> = {\n full: {\n init: wasmFullInit as (m?: unknown) => Promise<unknown>,\n initSync: wasmFullInitSync as (m: unknown) => unknown,\n ns: wasmFull as unknown as WasmModule,\n wasmFile: \"bitmark_wasm_bg.wasm\",\n },\n \"browser-full\": {\n init: wasmBrowserFullInit as (m?: unknown) => Promise<unknown>,\n initSync: wasmBrowserFullInitSync as (m: unknown) => unknown,\n ns: wasmBrowserFull as unknown as WasmModule,\n wasmFile: \"bitmark_browser_full_wasm_bg.wasm\",\n },\n \"bitmark-json\": {\n init: wasmJsonInit as (m?: unknown) => Promise<unknown>,\n initSync: wasmJsonInitSync as (m: unknown) => unknown,\n ns: wasmJson as unknown as WasmModule,\n wasmFile: \"bitmark_json_wasm_bg.wasm\",\n },\n};\n\n// Legacy (bpg-compatible) API — namespaced; WASM must be init()ed before use.\n// Reads the ACTIVE wasm per call, so it follows init swaps; on `bitmark-json`\n// only its HTML-dependent members fail (PLAN-166 decision 4). No file I/O is\n// provided in the browser (file options throw, as bpg does).\nsetLegacyWasmProvider(() => getActive() as unknown as LegacyWasm);\nexport * as legacy from \"../legacy/index.js\";\n\n/** `init` options (browser): feature and/or an explicit wasm source. */\nexport interface BrowserInitOptions extends InitOptions {\n /** Explicit `.wasm` source (URL / Request / Response / Module / bytes). */\n module_or_path?: unknown;\n}\n\n/**\n * The variant an init call without an explicit `feature` selects.\n *\n * With no source, that is the browser default (`browser-full`, PLAN-174). With\n * an EXPLICIT source it stays `\"full\"`: those bytes predate this variant split\n * and are `bitmark_wasm_bg.wasm`, and glue must match the bytes it\n * instantiates — pairing them with another variant's glue fails at\n * instantiation. Name the feature alongside the source to load any other one.\n */\nfunction defaultFeatureFor(module_or_path: unknown): Feature {\n return module_or_path === undefined ? BROWSER_DEFAULT_FEATURE : \"full\";\n}\n\nfunction normalizeInit(arg: unknown): {\n feature: Feature;\n module_or_path?: unknown;\n} {\n if (\n arg !== null &&\n typeof arg === \"object\" &&\n !(arg instanceof URL) &&\n (\"feature\" in arg || \"module_or_path\" in arg)\n ) {\n const o = arg as BrowserInitOptions;\n return {\n feature: o.feature ?? defaultFeatureFor(o.module_or_path),\n module_or_path: o.module_or_path,\n };\n }\n // Back-compat: a bare module_or_path initialises `full`; nothing at all\n // initialises the browser default.\n const module_or_path = arg ?? undefined;\n return { feature: defaultFeatureFor(module_or_path), module_or_path };\n}\n\nlet initSeq = 0;\nlet activeOut: unknown;\nlet inflight:\n { feature: Feature; seq: number; promise: Promise<unknown> } | undefined;\n\n/**\n * Initialise the WASM module, selecting the variant (PLAN-166 / PLAN-174):\n * `\"browser-full\"` (the browser default — every conversion capability, without\n * the `info` meta layer), `\"full\"` (adds that meta layer: tag descriptions,\n * group provenance, raw mappingKeys patterns — bigger to download) or\n * `\"bitmark-json\"` (bitmark ↔ JSON only; markup formats, mapping report and\n * the `lex` output unavailable). All three glue modules are in the bundle; only the\n * selected variant's `.wasm` is fetched.\n *\n * May be called again to switch variants: the new module loads in the\n * background while calls keep being served by the active one, then one\n * atomic swap applies. Overlapping calls: same-feature in-flight inits are\n * coalesced; a different-feature init supersedes an unfinished one (its load\n * is discarded without swapping); every returned promise resolves once the\n * finally-active module is live. Re-init of the already-active feature is a\n * no-op unless an explicit `module_or_path` forces re-instantiation.\n *\n * When no explicit source is given, the default `.wasm` URL is decorated\n * with a cache-busting `?v=<version>` query parameter so CDN caches are\n * invalidated when the package version changes.\n *\n * Back-compat: `init(module_or_path)` (no options object) initialises `full`,\n * because those bytes are `bitmark_wasm_bg.wasm` — see {@link defaultFeatureFor}.\n */\nexport async function init(\n options?: BrowserInitOptions | unknown,\n): Promise<unknown> {\n const { feature, module_or_path } = normalizeInit(options);\n if (module_or_path === undefined) {\n if (!inflight && variant() === feature) return activeOut; // no-op\n if (inflight?.feature === feature) return inflight.promise; // coalesce\n }\n const mySeq = ++initSeq;\n const v = VARIANTS[feature];\n const source =\n module_or_path ??\n new URL(`${WASM_BASE}${v.wasmFile}?v=${PACKAGE_INFO.version}`, import.meta.url);\n const promise: Promise<unknown> = (async () => {\n try {\n const out = await v.init(source);\n if (mySeq === initSeq) {\n // Last call wins: a superseded load never swaps. The previous\n // module's reference is dropped here (its glue retains the instance\n // until that variant is re-initialised — wasm-bindgen keeps\n // module-level state).\n setActive(feature, v.ns);\n activeOut = out;\n }\n } finally {\n if (inflight?.seq === mySeq) inflight = undefined;\n }\n // Resolve to the finally-active state: if a newer init superseded this\n // one, wait for it (and any further successors) to settle.\n while (inflight) await inflight.promise.catch(() => {});\n return activeOut;\n })();\n inflight = { feature, seq: mySeq, promise };\n return promise;\n}\n\n/**\n * Synchronous initialisation from already-loaded wasm bytes / a compiled\n * `WebAssembly.Module` (no fetch). `options.feature` selects the variant the\n * bytes belong to — it must MATCH them, since glue and module are a pair.\n * Default `\"full\"`, for the same back-compat reason as {@link defaultFeatureFor}.\n */\nexport function initSync(module: unknown, options: InitOptions = {}): unknown {\n const feature = options.feature ?? defaultFeatureFor(module);\n const v = VARIANTS[feature];\n const out = v.initSync(module);\n setActive(feature, v.ns);\n activeOut = out;\n return out;\n}\n\nexport {\n variant,\n NotInitializedError,\n RegisterError,\n UnsupportedFeatureError,\n} from \"../core/facade.js\";\nexport type { Feature, InitOptions } from \"../core/facade.js\";\n\nexport type {\n LexToken,\n PositionEncoding,\n TokensLayout,\n SemanticTokenType,\n SemanticTokenModifier,\n SemanticTokensLegend,\n SemanticToken,\n SemanticTokensLsp,\n SemanticTokensAbsolute,\n SemanticTokens,\n SemanticTokensOptions,\n ParseOptions,\n ConvertOptions,\n OutputMode,\n BreakscapeOptions,\n TextFormat,\n TextLocation,\n InfoOptions,\n RegisterOptions,\n InfoType,\n InfoFormat,\n InputFormat,\n OutputFormat,\n CanonicalizeOptions,\n TransformOptions,\n PatchOp,\n PatchEntry,\n PathValue,\n PatchValueFor,\n PatchDocument,\n PatchDocumentEntry,\n BitSelector,\n DiffOptions,\n DiffOutputFormat,\n BitDiff,\n BitDiffRef,\n DiffHunk,\n DiffHunkLine,\n BitSlice,\n BitView,\n PreHook,\n PostHook,\n PreHookResult,\n TagFormat,\n BodyFormat,\n ResourceAttachment,\n CompactTagInfo,\n FullTagInfo,\n CompactVariantInfo,\n CompactSideInfo,\n CompactCardInfo,\n CompactCardSetInfo,\n FullVariantInfo,\n FullSideInfo,\n FullCardInfo,\n FullCardSetInfo,\n BodyRulesInfo,\n CompactBitInfo,\n FullBitInfo,\n BitListInfo,\n LanguagesInfo,\n BitInfo,\n AllBitsInfo,\n DeprecatedEntryInfo,\n DeprecatedInfo,\n InfoErrorResult,\n} from \"../types.js\";\nexport { patchEntry, ALL_LANGUAGES } from \"../types.js\";\n\n// Generated types for the parser's JSON (from bitmark.json via schemagen, PLAN-128)\nexport type * from \"../generated/bit-types.js\";\n\n// The shared wrappers (PLAN-166): every call reads the active wasm module.\nexport {\n bitmarkToObjects,\n objectsToBitmark,\n convert,\n semanticTokens,\n canonicalize,\n countBits,\n splitBits,\n transform,\n diff,\n diffBits,\n breakscapeText,\n unbreakscapeText,\n info,\n register,\n} from \"../core/api.js\";\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Parallel counterpart of {@link transform} (browser). Fans the per-bit WASM\n * compute across a pool of module `Worker`s (`options.workers`, default `4`);\n * each worker loads its own WASM instance of the ACTIVE variant.\n * `preHook`/`postHook` run on the calling thread. Call {@link init} before\n * use. Output is identical to {@link transform}; this trades worker startup\n * cost for throughput on large documents.\n *\n * **Requires the ESM build** (`@gmb/bitmark-parser/browser`, i.e.\n * `dist/browser/esm`): the module-`Worker` entry (`worker-entry.js`) and its\n * `.wasm` are emitted only beside that bundle. Module workers are ESM by\n * nature; the CJS / single-file min bundles ship the sync {@link transform}\n * only, and calling this there resolves to an `error:` string (the worker\n * file is absent). For throughput in those targets, use {@link transform} or\n * chunk + your own workers.\n *\n * @returns A Promise of the transformed document, or an `error:`-prefixed\n * string on failure.\n */\nexport function transformParallel(\n input: string,\n options: TransformOptions = {},\n): Promise<string> {\n const wasm = getActive() as unknown as HookedWasm;\n const feature: Feature = variant() ?? BROWSER_DEFAULT_FEATURE;\n return orchestrateParallel(wasm, input, options, (jobs, workers) =>\n runJobsParallel(jobs, workers, feature),\n );\n}\n"]}
|