@gmb/bitmark-parser 7.2.0 → 7.3.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.
Files changed (47) hide show
  1. package/README.md +155 -23
  2. package/config/bitmark-json.tsp +330 -0
  3. package/config/bitmark.json +83394 -0
  4. package/dist/browser/bitmark-parser.min.js +6 -4
  5. package/dist/browser/bitmark-parser.min.js.map +1 -1
  6. package/dist/browser/cjs/index.cjs +140 -72
  7. package/dist/browser/cjs/index.cjs.map +1 -1
  8. package/dist/browser/cjs/index.d.cts +6286 -6806
  9. package/dist/browser/esm/index.d.ts +6286 -6806
  10. package/dist/browser/esm/index.js +139 -72
  11. package/dist/browser/esm/index.js.map +1 -1
  12. package/dist/browser/esm/worker-entry.js +86 -57
  13. package/dist/browser/esm/worker-entry.js.map +1 -1
  14. package/dist/browser/wasm/bitmark_browser_full_wasm_bg.wasm +0 -0
  15. package/dist/browser/wasm/bitmark_json_wasm_bg.wasm +0 -0
  16. package/dist/browser/wasm/bitmark_wasm_bg.wasm +0 -0
  17. package/dist/index.cjs +76 -29
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +6286 -6806
  20. package/dist/index.d.ts +6286 -6806
  21. package/dist/index.js +75 -29
  22. package/dist/index.js.map +1 -1
  23. package/dist/legacy.cjs +4 -3
  24. package/dist/legacy.cjs.map +1 -1
  25. package/dist/legacy.d.cts +2 -1
  26. package/dist/legacy.d.ts +2 -1
  27. package/dist/legacy.js +4 -3
  28. package/dist/legacy.js.map +1 -1
  29. package/dist/worker-entry.cjs +23 -15
  30. package/dist/worker-entry.cjs.map +1 -1
  31. package/package.json +11 -7
  32. package/schema/bitmark.schema.json +10427 -14051
  33. package/wasm/bitmark_wasm.d.ts +12 -3
  34. package/wasm/bitmark_wasm.js +34 -15
  35. package/wasm/bitmark_wasm_bg.wasm +0 -0
  36. package/wasm/bitmark_wasm_bg.wasm.d.ts +2 -2
  37. package/wasm/package.json +1 -1
  38. package/wasm-bitmark-json/bitmark_json_wasm.d.ts +12 -3
  39. package/wasm-bitmark-json/bitmark_json_wasm.js +34 -15
  40. package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
  41. package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +2 -2
  42. package/wasm-bitmark-json/package.json +1 -1
  43. package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +12 -3
  44. package/wasm-browser-full/bitmark_browser_full_wasm.js +34 -15
  45. package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm +0 -0
  46. package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm.d.ts +2 -2
  47. package/wasm-browser-full/package.json +1 -1
@@ -1,5 +1,7 @@
1
- var ge=Object.defineProperty;var fn=(t,e,r)=>e in t?ge(t,e,{enumerable:true,configurable:true,writable:true,value:r}):t[e]=r;var Rt=(t,e)=>{for(var r in e)ge(t,r,{get:e[r],enumerable:true});};var J=(t,e,r)=>fn(t,typeof e!="symbol"?e+"":e,r);var $t={};Rt($t,{breakscape_text:()=>xn,canonicalize:()=>An,complete:()=>Rn,convert:()=>Pn,convert_text:()=>In,count_bits:()=>jn,default:()=>Kt,diff:()=>Fn,hover:()=>Sn,info:()=>wn,info_text_supported:()=>kn,initSync:()=>zt,is_bitmark:()=>Cn,prettify:()=>Dn,register:()=>Bn,resolve:()=>En,resolve_patch_document:()=>On,split_bits:()=>Ln,split_json_bits:()=>Wn,transform:()=>Tn,unbreakscape_text:()=>yn});var p,fe=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&fe.decode();var wt=null;function Et(){return (wt===null||wt.byteLength===0)&&(wt=new Uint8Array(p.memory.buffer)),wt}function N(t,e){return t=t>>>0,fe.decode(Et().subarray(t,t+e))}var nt=new Array(128).fill(void 0);nt.push(void 0,null,true,false);var kt=nt.length;function mn(t){kt===nt.length&&nt.push(nt.length+1);let e=kt;return kt=nt[e],nt[e]=t,e}var O=0,St=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},bn=typeof St.encodeInto=="function"?function(t,e){return St.encodeInto(t,e)}:function(t,e){let r=St.encode(t);return e.set(r),{read:t.length,written:r.length}};function E(t,e,r){if(r===void 0){let i=St.encode(t),c=e(i.length,1)>>>0;return Et().subarray(c,c+i.length).set(i),O=i.length,c}let n=t.length,o=e(n,1)>>>0,a=Et(),s=0;for(;s<n;s++){let i=t.charCodeAt(s);if(i>127)break;a[o+s]=i;}if(s!==n){s!==0&&(t=t.slice(s)),o=r(o,n,n=s+t.length*3,1)>>>0;let i=Et().subarray(o+s,o+n),c=bn(t,i);s+=c.written,o=r(o,n,s,1)>>>0;}return O=s,o}var pt=null;function h(){return (pt===null||pt.buffer.detached===true||pt.buffer.detached===void 0&&pt.buffer!==p.memory.buffer)&&(pt=new DataView(p.memory.buffer)),pt}function xn(t,e,r){let n,o;try{let i=p.__wbindgen_add_to_stack_pointer(-16),c=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),d=O,g=E(e,p.__wbindgen_export_0,p.__wbindgen_export_1),l=O,f=E(r,p.__wbindgen_export_0,p.__wbindgen_export_1),m=O;p.breakscape_text(i,c,d,g,l,f,m);var a=h().getInt32(i+0,!0),s=h().getInt32(i+4,!0);return n=a,o=s,N(a,s)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(n,o,1);}}function yn(t,e,r){let n,o;try{let i=p.__wbindgen_add_to_stack_pointer(-16),c=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),d=O,g=E(e,p.__wbindgen_export_0,p.__wbindgen_export_1),l=O,f=E(r,p.__wbindgen_export_0,p.__wbindgen_export_1),m=O;p.unbreakscape_text(i,c,d,g,l,f,m);var a=h().getInt32(i+0,!0),s=h().getInt32(i+4,!0);return n=a,o=s,N(a,s)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(n,o,1);}}function wn(t,e,r,n,o,a,s,i,c){let d,g;try{let m=p.__wbindgen_add_to_stack_pointer(-16),b=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),y=O,x=E(e,p.__wbindgen_export_0,p.__wbindgen_export_1),w=O,k=E(r,p.__wbindgen_export_0,p.__wbindgen_export_1),v=O,T=E(c,p.__wbindgen_export_0,p.__wbindgen_export_1),A=O;p.info(m,b,y,x,w,k,v,n,o,a,s,i,T,A);var l=h().getInt32(m+0,!0),f=h().getInt32(m+4,!0);return d=l,g=f,N(l,f)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(d,g,1);}}function kn(){return p.info_text_supported()!==0}function vn(t){return nt[t]}function hn(t){t<132||(nt[t]=kt,kt=t);}function Y(t){let e=vn(t);return hn(t),e}function In(t,e,r,n){let o,a;try{let f=p.__wbindgen_add_to_stack_pointer(-16),m=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),b=O,y=E(e,p.__wbindgen_export_0,p.__wbindgen_export_1),x=O,w=E(r,p.__wbindgen_export_0,p.__wbindgen_export_1),k=O,v=E(n,p.__wbindgen_export_0,p.__wbindgen_export_1),T=O;p.convert_text(f,m,b,y,x,w,k,v,T);var s=h().getInt32(f+0,!0),i=h().getInt32(f+4,!0),c=h().getInt32(f+8,!0),d=h().getInt32(f+12,!0),g=s,l=i;if(d)throw g=0,l=0,Y(c);return o=g,a=l,N(g,l)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(o,a,1);}}function Tn(t,e,r,n,o,a,s,i){let c,d;try{let x=p.__wbindgen_add_to_stack_pointer(-16),w=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),k=O,v=E(e,p.__wbindgen_export_0,p.__wbindgen_export_1),T=O,A=E(r,p.__wbindgen_export_0,p.__wbindgen_export_1),U=O,G=E(n,p.__wbindgen_export_0,p.__wbindgen_export_1),z=O,K=E(o,p.__wbindgen_export_0,p.__wbindgen_export_1),Q=O;p.transform(x,w,k,v,T,A,U,G,z,K,Q,a,s,i);var g=h().getInt32(x+0,!0),l=h().getInt32(x+4,!0),f=h().getInt32(x+8,!0),m=h().getInt32(x+12,!0),b=g,y=l;if(m)throw b=0,y=0,Y(f);return c=b,d=y,N(b,y)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(c,d,1);}}function On(t,e,r){let n,o;try{let l=p.__wbindgen_add_to_stack_pointer(-16),f=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),m=O,b=E(e,p.__wbindgen_export_0,p.__wbindgen_export_1),y=O,x=E(r,p.__wbindgen_export_0,p.__wbindgen_export_1),w=O;p.resolve_patch_document(l,f,m,b,y,x,w);var a=h().getInt32(l+0,!0),s=h().getInt32(l+4,!0),i=h().getInt32(l+8,!0),c=h().getInt32(l+12,!0),d=a,g=s;if(c)throw d=0,g=0,Y(i);return n=d,o=g,N(d,g)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(n,o,1);}}function Fn(t,e,r,n,o,a,s,i,c){let d,g;try{let w=p.__wbindgen_add_to_stack_pointer(-16),k=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),v=O,T=E(e,p.__wbindgen_export_0,p.__wbindgen_export_1),A=O,U=E(r,p.__wbindgen_export_0,p.__wbindgen_export_1),G=O,z=E(n,p.__wbindgen_export_0,p.__wbindgen_export_1),K=O;p.diff(w,k,v,T,A,U,G,z,K,o,a,s,i,c);var l=h().getInt32(w+0,!0),f=h().getInt32(w+4,!0),m=h().getInt32(w+8,!0),b=h().getInt32(w+12,!0),y=l,x=f;if(b)throw y=0,x=0,Y(m);return d=y,g=x,N(y,x)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(d,g,1);}}function Rn(t,e,r,n,o,a){let s,i;try{let b=p.__wbindgen_add_to_stack_pointer(-16),y=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),x=O,w=E(n,p.__wbindgen_export_0,p.__wbindgen_export_1),k=O,v=E(a,p.__wbindgen_export_0,p.__wbindgen_export_1),T=O;p.complete(b,y,x,e,r,w,k,o,v,T);var c=h().getInt32(b+0,!0),d=h().getInt32(b+4,!0),g=h().getInt32(b+8,!0),l=h().getInt32(b+12,!0),f=c,m=d;if(l)throw f=0,m=0,Y(g);return s=f,i=m,N(f,m)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(s,i,1);}}function En(t,e,r,n,o,a,s){let i,c;try{let y=p.__wbindgen_add_to_stack_pointer(-16),x=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),w=O,k=E(n,p.__wbindgen_export_0,p.__wbindgen_export_1),v=O,T=E(a,p.__wbindgen_export_0,p.__wbindgen_export_1),A=O;p.resolve(y,x,w,e,r,k,v,o,T,A,s);var d=h().getInt32(y+0,!0),g=h().getInt32(y+4,!0),l=h().getInt32(y+8,!0),f=h().getInt32(y+12,!0),m=d,b=g;if(f)throw m=0,b=0,Y(l);return i=m,c=b,N(m,b)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(i,c,1);}}function Sn(t,e,r,n){let o,a;try{let f=p.__wbindgen_add_to_stack_pointer(-16),m=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),b=O,y=E(n,p.__wbindgen_export_0,p.__wbindgen_export_1),x=O;p.hover(f,m,b,e,r,y,x);var s=h().getInt32(f+0,!0),i=h().getInt32(f+4,!0),c=h().getInt32(f+8,!0),d=h().getInt32(f+12,!0),g=s,l=i;if(d)throw g=0,l=0,Y(c);return o=g,a=l,N(g,l)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(o,a,1);}}function Bn(t,e){try{let o=p.__wbindgen_add_to_stack_pointer(-16),a=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),s=O,i=E(e,p.__wbindgen_export_0,p.__wbindgen_export_1),c=O;p.register(o,a,s,i,c);var r=h().getInt32(o+0,!0),n=h().getInt32(o+4,!0);if(n)throw Y(r)}finally{p.__wbindgen_add_to_stack_pointer(16);}}function Pn(t,e,r,n,o,a,s,i,c,d,g){let l,f;try{let v=p.__wbindgen_add_to_stack_pointer(-16),T=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),A=O,U=E(e,p.__wbindgen_export_0,p.__wbindgen_export_1),G=O,z=E(r,p.__wbindgen_export_0,p.__wbindgen_export_1),K=O,Q=E(n,p.__wbindgen_export_0,p.__wbindgen_export_1),ft=O,mt=E(d,p.__wbindgen_export_0,p.__wbindgen_export_1),bt=O,xt=E(g,p.__wbindgen_export_0,p.__wbindgen_export_1),yt=O;p.convert(v,T,A,U,G,z,K,Q,ft,o,a,s,i,c,mt,bt,xt,yt);var m=h().getInt32(v+0,!0),b=h().getInt32(v+4,!0),y=h().getInt32(v+8,!0),x=h().getInt32(v+12,!0),w=m,k=b;if(x)throw w=0,k=0,Y(y);return l=w,f=k,N(w,k)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(l,f,1);}}function An(t,e,r,n,o,a){let s,i;try{let b=p.__wbindgen_add_to_stack_pointer(-16),y=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),x=O,w=E(e,p.__wbindgen_export_0,p.__wbindgen_export_1),k=O,v=E(r,p.__wbindgen_export_0,p.__wbindgen_export_1),T=O;p.canonicalize(b,y,x,w,k,v,T,n,o,a);var c=h().getInt32(b+0,!0),d=h().getInt32(b+4,!0),g=h().getInt32(b+8,!0),l=h().getInt32(b+12,!0),f=c,m=d;if(l)throw f=0,m=0,Y(g);return s=f,i=m,N(f,m)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(s,i,1);}}function jn(t){let e,r;try{let d=p.__wbindgen_add_to_stack_pointer(-16),g=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),l=O;p.count_bits(d,g,l);var n=h().getInt32(d+0,!0),o=h().getInt32(d+4,!0),a=h().getInt32(d+8,!0),s=h().getInt32(d+12,!0),i=n,c=o;if(s)throw i=0,c=0,Y(a);return e=i,r=c,N(i,c)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(e,r,1);}}function Ln(t){let e,r;try{let a=p.__wbindgen_add_to_stack_pointer(-16),s=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),i=O;p.split_bits(a,s,i);var n=h().getInt32(a+0,!0),o=h().getInt32(a+4,!0);return e=n,r=o,N(n,o)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(e,r,1);}}function Cn(t){let e=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),r=O;return p.is_bitmark(e,r)!==0}function Wn(t){let e,r;try{let d=p.__wbindgen_add_to_stack_pointer(-16),g=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),l=O;p.split_json_bits(d,g,l);var n=h().getInt32(d+0,!0),o=h().getInt32(d+4,!0),a=h().getInt32(d+8,!0),s=h().getInt32(d+12,!0),i=n,c=o;if(s)throw i=0,c=0,Y(a);return e=i,r=c,N(i,c)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(e,r,1);}}function Dn(t,e){let r,n;try{let s=p.__wbindgen_add_to_stack_pointer(-16),i=E(t,p.__wbindgen_export_0,p.__wbindgen_export_1),c=O;p.prettify(s,i,c,e);var o=h().getInt32(s+0,!0),a=h().getInt32(s+4,!0);return r=o,n=a,N(o,a)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(r,n,1);}}async function Jn(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(n){if(t.headers.get("Content-Type")!="application/wasm")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",n);else throw n}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function me(){let t={};return t.wbg={},t.wbg.__wbindgen_error_new=function(e,r){let n=new Error(N(e,r));return mn(n)},t}function be(t,e){return p=t.exports,xe.__wbindgen_wasm_module=e,pt=null,wt=null,p}function zt(t){if(p!==void 0)return p;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=me();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let r=new WebAssembly.Instance(t,e);return be(r,t)}async function xe(t){if(p!==void 0)return p;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("bitmark_wasm_bg.wasm",import.meta.url));let e=me();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:n}=await Jn(await t,e);return be(r,n)}var Kt=xe;var Xt={};Rt(Xt,{breakscape_text:()=>Vn,canonicalize:()=>rr,complete:()=>Qn,convert:()=>nr,convert_text:()=>$n,count_bits:()=>or,default:()=>Yt,diff:()=>Xn,hover:()=>tr,info:()=>Un,info_text_supported:()=>Gn,initSync:()=>qt,is_bitmark:()=>sr,prettify:()=>pr,register:()=>er,resolve:()=>Zn,resolve_patch_document:()=>Yn,split_bits:()=>ir,split_json_bits:()=>ar,transform:()=>qn,unbreakscape_text:()=>Hn});var _,ye=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&ye.decode();var vt=null;function Bt(){return (vt===null||vt.byteLength===0)&&(vt=new Uint8Array(_.memory.buffer)),vt}function V(t,e){return t=t>>>0,ye.decode(Bt().subarray(t,t+e))}var rt=new Array(128).fill(void 0);rt.push(void 0,null,true,false);var ht=rt.length;function Mn(t){ht===rt.length&&rt.push(rt.length+1);let e=ht;return ht=rt[e],rt[e]=t,e}var F=0,Pt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Nn=typeof Pt.encodeInto=="function"?function(t,e){return Pt.encodeInto(t,e)}:function(t,e){let r=Pt.encode(t);return e.set(r),{read:t.length,written:r.length}};function S(t,e,r){if(r===void 0){let i=Pt.encode(t),c=e(i.length,1)>>>0;return Bt().subarray(c,c+i.length).set(i),F=i.length,c}let n=t.length,o=e(n,1)>>>0,a=Bt(),s=0;for(;s<n;s++){let i=t.charCodeAt(s);if(i>127)break;a[o+s]=i;}if(s!==n){s!==0&&(t=t.slice(s)),o=r(o,n,n=s+t.length*3,1)>>>0;let i=Bt().subarray(o+s,o+n),c=Nn(t,i);s+=c.written,o=r(o,n,s,1)>>>0;}return F=s,o}var _t=null;function I(){return (_t===null||_t.buffer.detached===true||_t.buffer.detached===void 0&&_t.buffer!==_.memory.buffer)&&(_t=new DataView(_.memory.buffer)),_t}function Vn(t,e,r){let n,o;try{let i=_.__wbindgen_add_to_stack_pointer(-16),c=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),d=F,g=S(e,_.__wbindgen_export_0,_.__wbindgen_export_1),l=F,f=S(r,_.__wbindgen_export_0,_.__wbindgen_export_1),m=F;_.breakscape_text(i,c,d,g,l,f,m);var a=I().getInt32(i+0,!0),s=I().getInt32(i+4,!0);return n=a,o=s,V(a,s)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(n,o,1);}}function Hn(t,e,r){let n,o;try{let i=_.__wbindgen_add_to_stack_pointer(-16),c=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),d=F,g=S(e,_.__wbindgen_export_0,_.__wbindgen_export_1),l=F,f=S(r,_.__wbindgen_export_0,_.__wbindgen_export_1),m=F;_.unbreakscape_text(i,c,d,g,l,f,m);var a=I().getInt32(i+0,!0),s=I().getInt32(i+4,!0);return n=a,o=s,V(a,s)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(n,o,1);}}function Un(t,e,r,n,o,a,s,i,c){let d,g;try{let m=_.__wbindgen_add_to_stack_pointer(-16),b=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),y=F,x=S(e,_.__wbindgen_export_0,_.__wbindgen_export_1),w=F,k=S(r,_.__wbindgen_export_0,_.__wbindgen_export_1),v=F,T=S(c,_.__wbindgen_export_0,_.__wbindgen_export_1),A=F;_.info(m,b,y,x,w,k,v,n,o,a,s,i,T,A);var l=I().getInt32(m+0,!0),f=I().getInt32(m+4,!0);return d=l,g=f,V(l,f)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(d,g,1);}}function Gn(){return _.info_text_supported()!==0}function zn(t){return rt[t]}function Kn(t){t<132||(rt[t]=ht,ht=t);}function X(t){let e=zn(t);return Kn(t),e}function $n(t,e,r,n){let o,a;try{let f=_.__wbindgen_add_to_stack_pointer(-16),m=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),b=F,y=S(e,_.__wbindgen_export_0,_.__wbindgen_export_1),x=F,w=S(r,_.__wbindgen_export_0,_.__wbindgen_export_1),k=F,v=S(n,_.__wbindgen_export_0,_.__wbindgen_export_1),T=F;_.convert_text(f,m,b,y,x,w,k,v,T);var s=I().getInt32(f+0,!0),i=I().getInt32(f+4,!0),c=I().getInt32(f+8,!0),d=I().getInt32(f+12,!0),g=s,l=i;if(d)throw g=0,l=0,X(c);return o=g,a=l,V(g,l)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(o,a,1);}}function qn(t,e,r,n,o,a,s,i){let c,d;try{let x=_.__wbindgen_add_to_stack_pointer(-16),w=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),k=F,v=S(e,_.__wbindgen_export_0,_.__wbindgen_export_1),T=F,A=S(r,_.__wbindgen_export_0,_.__wbindgen_export_1),U=F,G=S(n,_.__wbindgen_export_0,_.__wbindgen_export_1),z=F,K=S(o,_.__wbindgen_export_0,_.__wbindgen_export_1),Q=F;_.transform(x,w,k,v,T,A,U,G,z,K,Q,a,s,i);var g=I().getInt32(x+0,!0),l=I().getInt32(x+4,!0),f=I().getInt32(x+8,!0),m=I().getInt32(x+12,!0),b=g,y=l;if(m)throw b=0,y=0,X(f);return c=b,d=y,V(b,y)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(c,d,1);}}function Yn(t,e,r){let n,o;try{let l=_.__wbindgen_add_to_stack_pointer(-16),f=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),m=F,b=S(e,_.__wbindgen_export_0,_.__wbindgen_export_1),y=F,x=S(r,_.__wbindgen_export_0,_.__wbindgen_export_1),w=F;_.resolve_patch_document(l,f,m,b,y,x,w);var a=I().getInt32(l+0,!0),s=I().getInt32(l+4,!0),i=I().getInt32(l+8,!0),c=I().getInt32(l+12,!0),d=a,g=s;if(c)throw d=0,g=0,X(i);return n=d,o=g,V(d,g)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(n,o,1);}}function Xn(t,e,r,n,o,a,s,i,c){let d,g;try{let w=_.__wbindgen_add_to_stack_pointer(-16),k=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),v=F,T=S(e,_.__wbindgen_export_0,_.__wbindgen_export_1),A=F,U=S(r,_.__wbindgen_export_0,_.__wbindgen_export_1),G=F,z=S(n,_.__wbindgen_export_0,_.__wbindgen_export_1),K=F;_.diff(w,k,v,T,A,U,G,z,K,o,a,s,i,c);var l=I().getInt32(w+0,!0),f=I().getInt32(w+4,!0),m=I().getInt32(w+8,!0),b=I().getInt32(w+12,!0),y=l,x=f;if(b)throw y=0,x=0,X(m);return d=y,g=x,V(y,x)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(d,g,1);}}function Qn(t,e,r,n,o,a){let s,i;try{let b=_.__wbindgen_add_to_stack_pointer(-16),y=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),x=F,w=S(n,_.__wbindgen_export_0,_.__wbindgen_export_1),k=F,v=S(a,_.__wbindgen_export_0,_.__wbindgen_export_1),T=F;_.complete(b,y,x,e,r,w,k,o,v,T);var c=I().getInt32(b+0,!0),d=I().getInt32(b+4,!0),g=I().getInt32(b+8,!0),l=I().getInt32(b+12,!0),f=c,m=d;if(l)throw f=0,m=0,X(g);return s=f,i=m,V(f,m)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(s,i,1);}}function Zn(t,e,r,n,o,a,s){let i,c;try{let y=_.__wbindgen_add_to_stack_pointer(-16),x=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),w=F,k=S(n,_.__wbindgen_export_0,_.__wbindgen_export_1),v=F,T=S(a,_.__wbindgen_export_0,_.__wbindgen_export_1),A=F;_.resolve(y,x,w,e,r,k,v,o,T,A,s);var d=I().getInt32(y+0,!0),g=I().getInt32(y+4,!0),l=I().getInt32(y+8,!0),f=I().getInt32(y+12,!0),m=d,b=g;if(f)throw m=0,b=0,X(l);return i=m,c=b,V(m,b)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(i,c,1);}}function tr(t,e,r,n){let o,a;try{let f=_.__wbindgen_add_to_stack_pointer(-16),m=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),b=F,y=S(n,_.__wbindgen_export_0,_.__wbindgen_export_1),x=F;_.hover(f,m,b,e,r,y,x);var s=I().getInt32(f+0,!0),i=I().getInt32(f+4,!0),c=I().getInt32(f+8,!0),d=I().getInt32(f+12,!0),g=s,l=i;if(d)throw g=0,l=0,X(c);return o=g,a=l,V(g,l)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(o,a,1);}}function er(t,e){try{let o=_.__wbindgen_add_to_stack_pointer(-16),a=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),s=F,i=S(e,_.__wbindgen_export_0,_.__wbindgen_export_1),c=F;_.register(o,a,s,i,c);var r=I().getInt32(o+0,!0),n=I().getInt32(o+4,!0);if(n)throw X(r)}finally{_.__wbindgen_add_to_stack_pointer(16);}}function nr(t,e,r,n,o,a,s,i,c,d,g){let l,f;try{let v=_.__wbindgen_add_to_stack_pointer(-16),T=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),A=F,U=S(e,_.__wbindgen_export_0,_.__wbindgen_export_1),G=F,z=S(r,_.__wbindgen_export_0,_.__wbindgen_export_1),K=F,Q=S(n,_.__wbindgen_export_0,_.__wbindgen_export_1),ft=F,mt=S(d,_.__wbindgen_export_0,_.__wbindgen_export_1),bt=F,xt=S(g,_.__wbindgen_export_0,_.__wbindgen_export_1),yt=F;_.convert(v,T,A,U,G,z,K,Q,ft,o,a,s,i,c,mt,bt,xt,yt);var m=I().getInt32(v+0,!0),b=I().getInt32(v+4,!0),y=I().getInt32(v+8,!0),x=I().getInt32(v+12,!0),w=m,k=b;if(x)throw w=0,k=0,X(y);return l=w,f=k,V(w,k)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(l,f,1);}}function rr(t,e,r,n,o,a){let s,i;try{let b=_.__wbindgen_add_to_stack_pointer(-16),y=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),x=F,w=S(e,_.__wbindgen_export_0,_.__wbindgen_export_1),k=F,v=S(r,_.__wbindgen_export_0,_.__wbindgen_export_1),T=F;_.canonicalize(b,y,x,w,k,v,T,n,o,a);var c=I().getInt32(b+0,!0),d=I().getInt32(b+4,!0),g=I().getInt32(b+8,!0),l=I().getInt32(b+12,!0),f=c,m=d;if(l)throw f=0,m=0,X(g);return s=f,i=m,V(f,m)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(s,i,1);}}function or(t){let e,r;try{let d=_.__wbindgen_add_to_stack_pointer(-16),g=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),l=F;_.count_bits(d,g,l);var n=I().getInt32(d+0,!0),o=I().getInt32(d+4,!0),a=I().getInt32(d+8,!0),s=I().getInt32(d+12,!0),i=n,c=o;if(s)throw i=0,c=0,X(a);return e=i,r=c,V(i,c)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(e,r,1);}}function ir(t){let e,r;try{let a=_.__wbindgen_add_to_stack_pointer(-16),s=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),i=F;_.split_bits(a,s,i);var n=I().getInt32(a+0,!0),o=I().getInt32(a+4,!0);return e=n,r=o,V(n,o)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(e,r,1);}}function sr(t){let e=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),r=F;return _.is_bitmark(e,r)!==0}function ar(t){let e,r;try{let d=_.__wbindgen_add_to_stack_pointer(-16),g=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),l=F;_.split_json_bits(d,g,l);var n=I().getInt32(d+0,!0),o=I().getInt32(d+4,!0),a=I().getInt32(d+8,!0),s=I().getInt32(d+12,!0),i=n,c=o;if(s)throw i=0,c=0,X(a);return e=i,r=c,V(i,c)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(e,r,1);}}function pr(t,e){let r,n;try{let s=_.__wbindgen_add_to_stack_pointer(-16),i=S(t,_.__wbindgen_export_0,_.__wbindgen_export_1),c=F;_.prettify(s,i,c,e);var o=I().getInt32(s+0,!0),a=I().getInt32(s+4,!0);return r=o,n=a,V(o,a)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(r,n,1);}}async function _r(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(n){if(t.headers.get("Content-Type")!="application/wasm")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",n);else throw n}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function we(){let t={};return t.wbg={},t.wbg.__wbindgen_error_new=function(e,r){let n=new Error(V(e,r));return Mn(n)},t}function ke(t,e){return _=t.exports,ve.__wbindgen_wasm_module=e,_t=null,vt=null,_}function qt(t){if(_!==void 0)return _;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=we();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let r=new WebAssembly.Instance(t,e);return ke(r,t)}async function ve(t){if(_!==void 0)return _;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("bitmark_browser_full_wasm_bg.wasm",import.meta.url));let e=we();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:n}=await _r(await t,e);return ke(r,n)}var Yt=ve;var te={};Rt(te,{breakscape_text:()=>dr,canonicalize:()=>Ir,complete:()=>wr,convert:()=>hr,convert_text:()=>Sr,count_bits:()=>Tr,default:()=>Zt,hover:()=>vr,info:()=>gr,initSync:()=>Qt,is_bitmark:()=>Fr,prettify:()=>Er,register:()=>br,resolve:()=>kr,resolve_patch_document:()=>yr,split_bits:()=>Or,split_json_bits:()=>Rr,transform:()=>xr,unbreakscape_text:()=>lr});var u,he=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&he.decode();var It=null;function At(){return (It===null||It.byteLength===0)&&(It=new Uint8Array(u.memory.buffer)),It}function H(t,e){return t=t>>>0,he.decode(At().subarray(t,t+e))}var ot=new Array(128).fill(void 0);ot.push(void 0,null,true,false);var Tt=ot.length;function cr(t){Tt===ot.length&&ot.push(ot.length+1);let e=Tt;return Tt=ot[e],ot[e]=t,e}var B=0,jt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},ur=typeof jt.encodeInto=="function"?function(t,e){return jt.encodeInto(t,e)}:function(t,e){let r=jt.encode(t);return e.set(r),{read:t.length,written:r.length}};function P(t,e,r){if(r===void 0){let i=jt.encode(t),c=e(i.length,1)>>>0;return At().subarray(c,c+i.length).set(i),B=i.length,c}let n=t.length,o=e(n,1)>>>0,a=At(),s=0;for(;s<n;s++){let i=t.charCodeAt(s);if(i>127)break;a[o+s]=i;}if(s!==n){s!==0&&(t=t.slice(s)),o=r(o,n,n=s+t.length*3,1)>>>0;let i=At().subarray(o+s,o+n),c=ur(t,i);s+=c.written,o=r(o,n,s,1)>>>0;}return B=s,o}var ct=null;function R(){return (ct===null||ct.buffer.detached===true||ct.buffer.detached===void 0&&ct.buffer!==u.memory.buffer)&&(ct=new DataView(u.memory.buffer)),ct}function dr(t,e,r){let n,o;try{let i=u.__wbindgen_add_to_stack_pointer(-16),c=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),d=B,g=P(e,u.__wbindgen_export_0,u.__wbindgen_export_1),l=B,f=P(r,u.__wbindgen_export_0,u.__wbindgen_export_1),m=B;u.breakscape_text(i,c,d,g,l,f,m);var a=R().getInt32(i+0,!0),s=R().getInt32(i+4,!0);return n=a,o=s,H(a,s)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(n,o,1);}}function lr(t,e,r){let n,o;try{let i=u.__wbindgen_add_to_stack_pointer(-16),c=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),d=B,g=P(e,u.__wbindgen_export_0,u.__wbindgen_export_1),l=B,f=P(r,u.__wbindgen_export_0,u.__wbindgen_export_1),m=B;u.unbreakscape_text(i,c,d,g,l,f,m);var a=R().getInt32(i+0,!0),s=R().getInt32(i+4,!0);return n=a,o=s,H(a,s)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(n,o,1);}}function gr(t,e,r,n,o,a,s,i,c){let d,g;try{let m=u.__wbindgen_add_to_stack_pointer(-16),b=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),y=B,x=P(e,u.__wbindgen_export_0,u.__wbindgen_export_1),w=B,k=P(r,u.__wbindgen_export_0,u.__wbindgen_export_1),v=B,T=P(c,u.__wbindgen_export_0,u.__wbindgen_export_1),A=B;u.info(m,b,y,x,w,k,v,n,o,a,s,i,T,A);var l=R().getInt32(m+0,!0),f=R().getInt32(m+4,!0);return d=l,g=f,H(l,f)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(d,g,1);}}function fr(t){return ot[t]}function mr(t){t<132||(ot[t]=Tt,Tt=t);}function Z(t){let e=fr(t);return mr(t),e}function br(t,e){try{let o=u.__wbindgen_add_to_stack_pointer(-16),a=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),s=B,i=P(e,u.__wbindgen_export_0,u.__wbindgen_export_1),c=B;u.register(o,a,s,i,c);var r=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(n)throw Z(r)}finally{u.__wbindgen_add_to_stack_pointer(16);}}function xr(t,e,r,n,o,a,s,i){let c,d;try{let x=u.__wbindgen_add_to_stack_pointer(-16),w=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),k=B,v=P(e,u.__wbindgen_export_0,u.__wbindgen_export_1),T=B,A=P(r,u.__wbindgen_export_0,u.__wbindgen_export_1),U=B,G=P(n,u.__wbindgen_export_0,u.__wbindgen_export_1),z=B,K=P(o,u.__wbindgen_export_0,u.__wbindgen_export_1),Q=B;u.transform(x,w,k,v,T,A,U,G,z,K,Q,a,s,i);var g=R().getInt32(x+0,!0),l=R().getInt32(x+4,!0),f=R().getInt32(x+8,!0),m=R().getInt32(x+12,!0),b=g,y=l;if(m)throw b=0,y=0,Z(f);return c=b,d=y,H(b,y)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(c,d,1);}}function yr(t,e,r){let n,o;try{let l=u.__wbindgen_add_to_stack_pointer(-16),f=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),m=B,b=P(e,u.__wbindgen_export_0,u.__wbindgen_export_1),y=B,x=P(r,u.__wbindgen_export_0,u.__wbindgen_export_1),w=B;u.resolve_patch_document(l,f,m,b,y,x,w);var a=R().getInt32(l+0,!0),s=R().getInt32(l+4,!0),i=R().getInt32(l+8,!0),c=R().getInt32(l+12,!0),d=a,g=s;if(c)throw d=0,g=0,Z(i);return n=d,o=g,H(d,g)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(n,o,1);}}function wr(t,e,r,n,o,a){let s,i;try{let b=u.__wbindgen_add_to_stack_pointer(-16),y=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),x=B,w=P(n,u.__wbindgen_export_0,u.__wbindgen_export_1),k=B,v=P(a,u.__wbindgen_export_0,u.__wbindgen_export_1),T=B;u.complete(b,y,x,e,r,w,k,o,v,T);var c=R().getInt32(b+0,!0),d=R().getInt32(b+4,!0),g=R().getInt32(b+8,!0),l=R().getInt32(b+12,!0),f=c,m=d;if(l)throw f=0,m=0,Z(g);return s=f,i=m,H(f,m)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(s,i,1);}}function kr(t,e,r,n,o,a,s){let i,c;try{let y=u.__wbindgen_add_to_stack_pointer(-16),x=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),w=B,k=P(n,u.__wbindgen_export_0,u.__wbindgen_export_1),v=B,T=P(a,u.__wbindgen_export_0,u.__wbindgen_export_1),A=B;u.resolve(y,x,w,e,r,k,v,o,T,A,s);var d=R().getInt32(y+0,!0),g=R().getInt32(y+4,!0),l=R().getInt32(y+8,!0),f=R().getInt32(y+12,!0),m=d,b=g;if(f)throw m=0,b=0,Z(l);return i=m,c=b,H(m,b)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(i,c,1);}}function vr(t,e,r,n){let o,a;try{let f=u.__wbindgen_add_to_stack_pointer(-16),m=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),b=B,y=P(n,u.__wbindgen_export_0,u.__wbindgen_export_1),x=B;u.hover(f,m,b,e,r,y,x);var s=R().getInt32(f+0,!0),i=R().getInt32(f+4,!0),c=R().getInt32(f+8,!0),d=R().getInt32(f+12,!0),g=s,l=i;if(d)throw g=0,l=0,Z(c);return o=g,a=l,H(g,l)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(o,a,1);}}function hr(t,e,r,n,o,a,s,i,c,d,g){let l,f;try{let v=u.__wbindgen_add_to_stack_pointer(-16),T=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),A=B,U=P(e,u.__wbindgen_export_0,u.__wbindgen_export_1),G=B,z=P(r,u.__wbindgen_export_0,u.__wbindgen_export_1),K=B,Q=P(n,u.__wbindgen_export_0,u.__wbindgen_export_1),ft=B,mt=P(d,u.__wbindgen_export_0,u.__wbindgen_export_1),bt=B,xt=P(g,u.__wbindgen_export_0,u.__wbindgen_export_1),yt=B;u.convert(v,T,A,U,G,z,K,Q,ft,o,a,s,i,c,mt,bt,xt,yt);var m=R().getInt32(v+0,!0),b=R().getInt32(v+4,!0),y=R().getInt32(v+8,!0),x=R().getInt32(v+12,!0),w=m,k=b;if(x)throw w=0,k=0,Z(y);return l=w,f=k,H(w,k)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(l,f,1);}}function Ir(t,e,r,n,o,a){let s,i;try{let b=u.__wbindgen_add_to_stack_pointer(-16),y=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),x=B,w=P(e,u.__wbindgen_export_0,u.__wbindgen_export_1),k=B,v=P(r,u.__wbindgen_export_0,u.__wbindgen_export_1),T=B;u.canonicalize(b,y,x,w,k,v,T,n,o,a);var c=R().getInt32(b+0,!0),d=R().getInt32(b+4,!0),g=R().getInt32(b+8,!0),l=R().getInt32(b+12,!0),f=c,m=d;if(l)throw f=0,m=0,Z(g);return s=f,i=m,H(f,m)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(s,i,1);}}function Tr(t){let e,r;try{let d=u.__wbindgen_add_to_stack_pointer(-16),g=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),l=B;u.count_bits(d,g,l);var n=R().getInt32(d+0,!0),o=R().getInt32(d+4,!0),a=R().getInt32(d+8,!0),s=R().getInt32(d+12,!0),i=n,c=o;if(s)throw i=0,c=0,Z(a);return e=i,r=c,H(i,c)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(e,r,1);}}function Or(t){let e,r;try{let a=u.__wbindgen_add_to_stack_pointer(-16),s=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),i=B;u.split_bits(a,s,i);var n=R().getInt32(a+0,!0),o=R().getInt32(a+4,!0);return e=n,r=o,H(n,o)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(e,r,1);}}function Fr(t){let e=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),r=B;return u.is_bitmark(e,r)!==0}function Rr(t){let e,r;try{let d=u.__wbindgen_add_to_stack_pointer(-16),g=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),l=B;u.split_json_bits(d,g,l);var n=R().getInt32(d+0,!0),o=R().getInt32(d+4,!0),a=R().getInt32(d+8,!0),s=R().getInt32(d+12,!0),i=n,c=o;if(s)throw i=0,c=0,Z(a);return e=i,r=c,H(i,c)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(e,r,1);}}function Er(t,e){let r,n;try{let s=u.__wbindgen_add_to_stack_pointer(-16),i=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),c=B;u.prettify(s,i,c,e);var o=R().getInt32(s+0,!0),a=R().getInt32(s+4,!0);return r=o,n=a,H(o,a)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(r,n,1);}}function Sr(t,e,r,n){let o,a;try{let f=u.__wbindgen_add_to_stack_pointer(-16),m=P(t,u.__wbindgen_export_0,u.__wbindgen_export_1),b=B,y=P(e,u.__wbindgen_export_0,u.__wbindgen_export_1),x=B,w=P(r,u.__wbindgen_export_0,u.__wbindgen_export_1),k=B,v=P(n,u.__wbindgen_export_0,u.__wbindgen_export_1),T=B;u.convert_text(f,m,b,y,x,w,k,v,T);var s=R().getInt32(f+0,!0),i=R().getInt32(f+4,!0),c=R().getInt32(f+8,!0),d=R().getInt32(f+12,!0),g=s,l=i;if(d)throw g=0,l=0,Z(c);return o=g,a=l,H(g,l)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(o,a,1);}}async function Br(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(n){if(t.headers.get("Content-Type")!="application/wasm")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",n);else throw n}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function Ie(){let t={};return t.wbg={},t.wbg.__wbindgen_error_new=function(e,r){let n=new Error(H(e,r));return cr(n)},t}function Te(t,e){return u=t.exports,Oe.__wbindgen_wasm_module=e,ct=null,It=null,u}function Qt(t){if(u!==void 0)return u;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=Ie();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let r=new WebAssembly.Instance(t,e);return Te(r,t)}async function Oe(t){if(u!==void 0)return u;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("bitmark_json_wasm_bg.wasm",import.meta.url));let e=Ie();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:n}=await Br(await t,e);return Te(r,n)}var Zt=Oe;var Ot={version:"7.2.0"};var ee="browser-full",Ct=class extends Error{constructor(){super("wasm not initialised: call init() (or init({ feature: \u2026 })) first"),this.name="NotInitializedError";}},dt=class extends Error{constructor(e){super(e),this.name="RegisterError";}},it=class extends Error{constructor(e,r){super(`${e} is not available in the loaded wasm module${r?` (feature: "${r}")`:""}; init({ feature: "full" }) to load it`),this.name="UnsupportedFeatureError";}},Lt,Re,Fe,Ee=new Map;function C(){if(!Lt&&Fe&&Fe(),!Lt)throw new Ct;return Lt}function ne(t,e){for(let[r,n]of Ee)try{e.register(r,n);}catch(o){throw new dt(o instanceof Error?o.message:String(o))}Lt=e,Re=t;}function Se(t,e){Ee.set(t,e);}function et(){return Re}function Pr(t){let e=t.trim();return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):t}function Ar(t){return t===void 0?"":typeof t=="string"?t.trim():JSON.stringify(t)}function jr(t,e,r){if(r){let o=JSON.parse(t.split_bits(e));return o.map(a=>({view:{format:"bitmark",index:a.index,total:o.length,source:a.source},source:a.source}))}let n=JSON.parse(t.split_json_bits(e));return n.map((o,a)=>({view:{format:"json",index:a,total:n.length,bit:o.bit??{}},source:JSON.stringify([o])}))}function re(t,e,r){let n=r.mode??"optimized",o=r.outputFormat??"json",a=r.spacesAroundValues??1,s=r.indent??2,i=r.pretty??false,c=r.inputFormat??"auto",d=c==="bitmark"||c!=="json"&&t.is_bitmark(e),g=d?"bitmark":"json";t.transform("","bitmark",o,n,"",false,s,a);let l=jr(t,e,d),f=l.length,m=[];for(let k=0;k<f;k++){let{view:v}=l[k];v.index=k,v.total=f;let T=r.preHook?r.preHook(v)||{}:{};m.push(T.drop?null:{patches:T.patches??[],outputFormat:T.outputFormat??o});}let b=Ar(r.patch),y;b===""?y=l.map((k,v)=>({source:v,bit:null,patch:[]})):y=JSON.parse(t.resolve_patch_document(e,g,b));let x=[],w=[];for(let k of y)if(k.source!==null){let v=m[k.source];if(!v)continue;x.push({index:k.source,source:l[k.source].source,inputFormat:g,outputFormat:v.outputFormat,mode:n,patchJson:JSON.stringify([...k.patch,...v.patches]),spacesAroundValues:a}),w.push(l[k.source].view);}else {let v=k.bit??{},T=x.length;x.push({index:T,source:JSON.stringify([{bit:v}]),inputFormat:"json",outputFormat:o,mode:n,patchJson:JSON.stringify(k.patch),spacesAroundValues:a}),w.push({format:"json",index:T,total:f,bit:v});}return {jobs:x,views:w,output:o,pretty:i,indent:s}}function Lr(t,e){let r=t.transform(e.source,e.inputFormat,e.outputFormat,e.mode,e.patchJson,false,2,e.spacesAroundValues);return e.outputFormat==="json"?Pr(r):r}function oe(t,e,r,n,o){if(r!=="json")return e.join(`
2
- `);let a=`[${e.join(",")}]`;return n?t.prettify(a,o):a}function Be(t,e,r){let n=re(t,e,r),o=[];for(let a=0;a<n.jobs.length;a++){let s=Lr(t,n.jobs[a]);r.postHook?.(n.views[a],s),o.push(s);}return oe(t,o,n.output,n.pretty,n.indent)}async function Pe(t,e,r,n){let o=re(t,e,r),a=await n(o.jobs,r.workers??4);for(let s=0;s<a.length;s++)r.postHook?.(o.views[s],a[s]);return oe(t,a,o.output,o.pretty,o.indent)}var ie;function Ae(t){ie=t;}function W(){if(!ie)throw new Error("legacy API not initialised: the WASM module has not been provided (browser consumers must call init() first)");return ie()}function je(t,e,r){if(t.length===0)return Promise.resolve([]);let n=Math.max(1,Math.min(e,t.length));return new Promise((o,a)=>{let s=new Array(t.length),i=0,c=0,d=false,g=[],l=m=>{if(!d){d=true;for(let b of g)b.terminate();m?a(m):o(s);}},f=m=>{if(d||i>=t.length)return;let b=i++;m.post({id:b,job:t[b]});};for(let m=0;m<n;m++){let b=r(y=>{if(!d){if(!y.ok)return l(new Error(y.error??"worker job failed"));s[y.id]=y.element,++c===t.length?l():f(b);}},l);g.push(b);}for(let m of g)f(m);})}function Le(t,e,r){let n=new URL("./worker-entry.js",import.meta.url);return je(t,e,(o,a)=>{let s=new Worker(n,{type:"module"});return s.onmessage=i=>o(i.data),s.onerror=i=>a(new Error(i.message||"worker error")),{post:i=>s.postMessage({...i,feature:r}),terminate:()=>s.terminate()}})}var _n={};Rt(_n,{Ast:()=>$e,BitType:()=>Ue,BitmarkFileGenerator:()=>Xe,BitmarkGenerator:()=>qe,BitmarkParser:()=>rn,BitmarkParserGenerator:()=>Ht,BitmarkParserType:()=>zr,BitmarkStringGenerator:()=>Ye,BitmarkVersion:()=>Ur,BodyTextFormat:()=>qr,BoundingBoxIndex:()=>Ke,Builder:()=>Vt,CardSetVersion:()=>Gr,FileWriter:()=>an,HtmlTableGenerator:()=>en,HtmlTableParser:()=>nn,InfoFormat:()=>$r,InfoType:()=>Kr,Input:()=>Nr,InputFormat:()=>Hr,JsonFileGenerator:()=>tn,JsonGenerator:()=>Qe,JsonParser:()=>on,JsonStringGenerator:()=>Ze,LegacyUnsupportedError:()=>lt,NodeType:()=>ze,Output:()=>Vr,ResourceBuilder:()=>Ut,StreamWriter:()=>pn,StringWriter:()=>sn,TextLocation:()=>Yr,TextMarkType:()=>Ve,TextNodeType:()=>He,bitmarkTextParse:()=>Me,isPseudoAst:()=>We});var lt=class extends Error{constructor(e){super(e),this.name="LegacyUnsupportedError";}};function at(t,e){throw new lt(`'${t}' is not supported by the @gmb/bitmark-parser legacy API`+(e?`: ${e}`:""))}function tt(t,e){throw new lt(`Option '${t}' is not supported by the @gmb/bitmark-parser legacy API`+(e?`: ${e}`:""))}var se="bitmark v2 output is not supported (this parser is bitmark v3 only)";function ae(t){t.bitmarkVersion===2&&tt("bitmarkVersion: 2",se);}function Dt(t){t.explicitTextFormat&&tt("bitmarkOptions.explicitTextFormat"),t.cardSetVersion===1&&tt("bitmarkOptions.cardSetVersion: 1",se),t.debugGenerationInline&&tt("bitmarkOptions.debugGenerationInline"),t.noBreakscaping&&tt("bitmarkOptions.noBreakscaping");}function Jt(t){t.textAsPlainText&&tt("jsonOptions.textAsPlainText",se),t.debugGenerationInline&&tt("jsonOptions.debugGenerationInline");}function ut(t){return t===true?{pretty:true,indent:2}:typeof t=="number"&&t>0?{pretty:true,indent:t}:{pretty:false,indent:2}}function Mt(t){return t===void 0||t===true?1:t===false?0:Math.max(0,Math.min(10,t))}function Nt(t){switch(t){case "text":case "latex":case "json":case "xml":return "plainText";default:return "bitmark++"}}var Ce=Symbol.for("@gmb/bitmark-parser/legacy-pseudo-ast");function gt(t){let e={bits:t};return Object.defineProperty(e,Ce,{value:true,enumerable:false}),e}function We(t){return t!==null&&typeof t=="object"&&(Ce in t||Array.isArray(t.bits))}var De={"extractor-image":{key:"images",resourceType:"image"},"extractor-image-collapsible":{key:"images",resourceType:"image"},"images-logo-grave":{key:"logos",resourceType:"image"},"prototype-images":{key:"images",resourceType:"image"}};var pe=Symbol.for("@gmb/bitmark-parser/legacy-built-bit-parser"),Wr={bitType:"type",textFormat:"format",flashcards:"cards",markConfig:"marks"},Dr={"bitmark--":"bitmark++","bitmark+":"bitmark++"},Jr={bitmark:"bitmark++",text:"text",json:"json",latex:"latex",xml:"xml"},Mr=["title","subtitle","item","lead","pageNumber","marginNumber","hint","instruction","caption"],Vt=class{buildBitmark(e){let r=gt(e.bits??[]);return e.errors!==void 0&&(r.errors=e.errors),r}buildBit(e,r){let n=W(),o={...e},a=o.bitType,s=this.getBitConfig(a),i={};i.type=a,o.isCommented&&(i.type="_comment",i.originalType=a),delete o.bitType,delete o.isCommented;let c=o.textFormat;c!==void 0?(i.format=Dr[c]??c,delete o.textFormat):i.format=Jr[s.bodyFormat??""]??"bitmark++",delete o.resourceType;let d=o.body;d!=null&&typeof d=="object"&&"body"in d&&(i.body=d.body,delete o.body),o.example!==void 0?(i.isExample=true,i.example=o.example,delete o.example,delete o.__isDefaultExample):o.__isDefaultExample&&(i.isExample=true,delete o.__isDefaultExample);let g=o.resources;if(g!==void 0&&a!==void 0){let x=Array.isArray(g)?g:[g],w=De[a];w?i[w.key]=x.filter(k=>k!==null&&typeof k=="object"&&k.type===w.resourceType):x.length>=1&&(i.resource=x[0]),delete o.resources;}let l=o.parser;delete o.parser;let f=o.extraProperties;delete o.extraProperties;for(let[x,w]of Object.entries(o))w!==void 0&&(i[Wr[x]??x]=w);if(f)for(let[x,w]of Object.entries(f))x in i||(i[x]=w);this.parseStringTexts(i);let m=n.convert(JSON.stringify([{bit:i}]),"json","json","optimized",false,2,1,false,false,"",""),y=JSON.parse(m)[0]?.bit??i;for(let[x,w]of Object.entries(i))x in y||w===false||w===""||w===null||Array.isArray(w)&&w.length===0||(y[x]=w);return l!==void 0&&Object.defineProperty(y,pe,{value:l,enumerable:false}),y}buildHighlight(e,r){if(!r)return;let n={...r},o=n.attrs;return o&&Object.assign(n,o),{type:"highlight",texts:Array.isArray(n.texts)?n.texts.filter(i=>i!=null).map(i=>({text:i.text??"",isCorrect:i.isCorrect??false,isHighlighted:i.isHighlighted??false,...Je(i,["text","isCorrect","isHighlighted"])})):[],prefix:n.prefix??"",postfix:n.postfix??"",...Je(n,["type","texts","prefix","postfix","attrs"]),attrs:{}}}parseStringTexts(e){let r=W(),n=(s,i)=>{if(s==="")return s;let c=r.convert_text(s,"textToAst","bitmark++",i);try{return JSON.parse(c)}catch{return s}},o=e.format,a=o===void 0||o==="bitmark++"||o==="bitmark+";if(typeof e.body=="string")if(o==="json")try{e.body=JSON.parse(e.body);}catch{e.body=null;}else a&&(e.body=n(e.body,"body"));for(let s of Mr){let i=e[s];typeof i=="string"&&(e[s]=n(i,"tag"));}}getBitConfig(e){let r=W();if(e!==void 0)try{let n=JSON.parse(r.info("bit","json",e,!1,2,!1,!1,!0,""));if(n.error===void 0)return {bodyFormat:n.body?.format}}catch{}throw new Error(`No config found for bit: ${e}`)}};function Je(t,e){let r={};for(let[n,o]of Object.entries(t))o!==void 0&&!e.includes(n)&&(r[n]=o);return r}var Ht=class{version(){return Ot.version}convert(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),a=Object.assign({},n.bitmarkOptions);ae(n),Dt(a),Jt(o),this.checkBrowserFileWrite(n.outputFile);let s=W(),{source:i,isBitmark:c}=this.resolveInput(e,n.inputFormat),d=n.outputFormat??(c?"json":"bitmark"),g=d==="ast"?"json":d,{pretty:l,indent:f}=ut(o.prettify),m=g==="bitmark"?ut(a.prettifyJson):{pretty:l,indent:f},b=Mt(a.spacesAroundValues),y=!o.excludeUnknownProperties,x=s.convert(i,c?"bitmark":"json",g,"optimized",m.pretty,m.indent,b,y,false,"","");if(d==="bitmark"||d==="text")return this.deliver(x,n.outputFile,n.fileOptions);if(d==="json")return n.outputFile?this.deliver(x,n.outputFile,n.fileOptions):l||o.stringify?x:JSON.parse(x);let w=gt(JSON.parse(x));return n.outputFile?this.deliver(JSON.stringify(w),n.outputFile,n.fileOptions):w}upgrade(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),a=Object.assign({},n.bitmarkOptions);ae(n),Dt(a),Jt(o),this.checkBrowserFileWrite(n.outputFile);let s=W(),{source:i,isBitmark:c}=this.resolveInput(e,n.inputFormat),{pretty:d,indent:g}=ut(c?a.prettifyJson:o.prettify),l=Mt(a.spacesAroundValues),f=s.canonicalize(i,c?"bitmark":"json","optimized",d,g,l);return c?this.deliver(f,n.outputFile,n.fileOptions):n.outputFile?this.deliver(f,n.outputFile,n.fileOptions):d||o.stringify?f:JSON.parse(f)}info(e){let r=Object.assign({},e),n=W(),o=r.type??"list",a=r.outputFormat??"text",{pretty:s,indent:i}=ut(r.prettify),c=a==="pojo"?"json":a,d=n.info(o,c,r.bit??"",s,i,false,false,true,"");return a==="pojo"?JSON.parse(d):d}generateConfig(e){at("BitmarkParserGenerator.generateConfig","bpg-internal development tool");}convertHtmlTable(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),a=Object.assign({},n.bitmarkOptions);Dt(a),Jt(o),n.keepUnknownTags&&tt("keepUnknownTags"),n.noBreakscaping&&tt("noBreakscaping"),this.checkBrowserFileWrite(n.outputFile);let s=W(),i=typeof e=="string"?this.maybeReadFile(e,void 0):"";if(!(n.inputFormat==="html"||n.inputFormat===void 0&&typeof e=="string"&&/<table[\s>]/iu.test(i))){let{source:k,isBitmark:v}=this.resolveInput(e,void 0),T=s.convert(k,v?"bitmark":"json","html","optimized",false,2,1,false,false,"","");return this.deliver(_e(T).join(`
3
- `),n.outputFile,n.fileOptions)}let d=n.tableFormat==="table"?"table":"table-extended",g=_e(i).map(k=>`<bitmark-bit data-type="${d}" data-format="bitmark++">${k}</bitmark-bit>`).join(""),l=n.outputFormat??"bitmark",{pretty:f,indent:m}=ut(o.prettify),b=Mt(a.spacesAroundValues);if(l==="html"){let k=s.convert(g,"html","html","optimized",false,2,1,false,false,"","");return this.deliver(_e(k).join(`
4
- `),n.outputFile,n.fileOptions)}let y=l==="ast"?"json":l,x=s.convert(g,"html",y,"optimized",f,m,b,false,false,"","");if(l==="bitmark"||l==="text")return this.deliver(x,n.outputFile,n.fileOptions);if(l==="json")return n.outputFile?this.deliver(x,n.outputFile,n.fileOptions):f||o.stringify?x:JSON.parse(x);let w=gt(JSON.parse(x));return n.outputFile?this.deliver(JSON.stringify(w),n.outputFile,n.fileOptions):w}createAst(e,r){let n=Object.assign({},r),o=W(),{source:a,isBitmark:s}=this.resolveInput(e,n.inputFormat),i=o.convert(a,s?"bitmark":"json","json","optimized",false,2,1,true,false,"","");return gt(JSON.parse(i))}breakscapeText(e,r){if(!e)return e;let n=Object.assign({},r);this.checkBrowserFileWrite(n.outputFile);let o=W(),a=this.maybeReadFile(e,n.inputFormat),s=o.breakscape_text(a,Nt(n.textFormat),n.textLocation??"body");return this.deliver(s,n.outputFile,n.fileOptions)}unbreakscapeText(e,r){if(!e)return e;let n=Object.assign({},r);this.checkBrowserFileWrite(n.outputFile);let o=W(),a=this.maybeReadFile(e,n.inputFormat),s=o.unbreakscape_text(a,Nt(n.textFormat),n.textLocation??"body");return this.deliver(s,n.outputFile,n.fileOptions)}convertText(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions);this.checkBrowserFileWrite(n.outputFile);let a=W(),s=n.textFormat===void 0||Nt(n.textFormat)==="bitmark++",i=n.textLocation??"body",c,d;if(typeof e=="string"?(c=this.maybeReadFile(e,n.inputFormat),d=this.parseTextAstString(c)):(c=JSON.stringify(e),d=Array.isArray(e)?e:void 0),d!==void 0){let b=s?a.convert_text(JSON.stringify(d),"astToText","bitmark++",i):a.convert_text(JSON.stringify(d),"astToPlainText","plainText",i);return this.deliver(b,n.outputFile,n.fileOptions)}let g=a.convert_text(c,"textToAst",s?"bitmark++":"plainText","body"),{pretty:l,indent:f}=ut(o.prettify),m=l?a.prettify(g,f):g;return n.outputFile?this.deliver(m,n.outputFile,n.fileOptions):l?m:JSON.parse(g)}textAstToPlainText(e,r){return W().convert_text(typeof e=="string"?e:JSON.stringify(e),"astToPlainText","bitmark++","body")}extractPlainText(e,r){let n=r?.inputFormat,o=W();if(n==="plainText")return typeof e=="string"?String(e):"";if(n==="bitmarkText"){let c=o.convert_text(String(e),"textToAst","bitmark++","body");return o.convert_text(c,"astToPlainText","bitmark++","body")}if(typeof e=="string"&&this.parseTextAstString(e)===void 0&&!o.is_bitmark(e)&&!(()=>{try{return JSON.parse(e),!0}catch{return false}})())return this.extractPlainText(e,{inputFormat:"bitmarkText"});let{source:a,isBitmark:s}=this.resolveInput(e,void 0);return o.convert(a,s?"bitmark":"json","text","optimized",false,2,1,false,false,"","")}parseTextAstString(e){let r=e.trim();if(r.startsWith("["))try{let n=JSON.parse(r);if(Array.isArray(n)&&n.every(o=>o!==null&&typeof o=="object"&&"type"in o))return n}catch{}}resolveInput(e,r){if(typeof e!="string"){let a=this.jsonEntries(e);return {source:JSON.stringify(a?a.map(s=>this.toWrapperEntry(s)):e),isBitmark:false}}let n=this.maybeReadFile(e,r);if(W().is_bitmark(n))return {source:n,isBitmark:true};try{let a=JSON.parse(n),s=this.jsonEntries(a);if(s)return {source:JSON.stringify(s.map(i=>this.toWrapperEntry(i))),isBitmark:!1}}catch{return {source:n,isBitmark:true}}return {source:n,isBitmark:false}}jsonEntries(e){if(Array.isArray(e))return e;if(e!==null&&typeof e=="object"){let r=e;if(Array.isArray(r.bits))return r.bits;if("bit"in r)return [r];if(typeof r.type=="string")return [{bit:r}]}}toWrapperEntry(e){if(e!==null&&typeof e=="object"&&"bit"in e)return e;let r={bit:e},n=e?.[pe];return n!==void 0&&(r.parser=n),r}maybeReadFile(e,r){if(r==="string")return e;return e;}checkBrowserFileWrite(e){if(e&&true)throw new Error("Cannot write to file in browser environment")}deliver(e,r,n){if(!r)return e;throw new Error("Cannot write to file in browser environment");}};function _e(t){let e=[],r=t.toLowerCase(),n=0;for(;;){let o=r.indexOf("<table",n);if(o===-1)break;let a=0,s=o,i=-1;for(;s<t.length;){let c=r.indexOf("<table",s),d=r.indexOf("</table",s);if(d===-1)break;if(c!==-1&&c<d)a++,s=c+6;else {a--;let g=r.indexOf(">",d);if(s=g===-1?t.length:g+1,a===0){i=s;break}}}if(i===-1)break;e.push(t.slice(o,i)),n=i;}return e}function Me(t){let e=W().convert_text(t,"textToAst","bitmark++","body");return JSON.parse(e)}var M={imageResource:{type:"image",key:"image",valueField:"src"},imageLinkResource:{type:"image-link",key:"imageLink",valueField:"url"},audioResource:{type:"audio",key:"audio",valueField:"src"},audioEmbedResource:{type:"audio-embed",key:"audioEmbed",valueField:"src"},audioLinkResource:{type:"audio-link",key:"audioLink",valueField:"url"},videoResource:{type:"video",key:"video",valueField:"src"},videoEmbedResource:{type:"video-embed",key:"videoEmbed",valueField:"url"},videoLinkResource:{type:"video-link",key:"videoLink",valueField:"url"},stillImageFilmEmbedResource:{type:"still-image-film-embed",key:"stillImageFilmEmbed",valueField:"url"},stillImageFilmLinkResource:{type:"still-image-film-link",key:"stillImageFilmLink",valueField:"url"},articleResource:{type:"article",key:"article",valueField:"body"},documentResource:{type:"document",key:"document",valueField:"url"},documentEmbedResource:{type:"document-embed",key:"documentEmbed",valueField:"url"},documentLinkResource:{type:"document-link",key:"documentLink",valueField:"url"},documentDownloadResource:{type:"document-download",key:"documentDownload",valueField:"url"},appLinkResource:{type:"app-link",key:"appLink",valueField:"url"},websiteLinkResource:{type:"website-link",key:"websiteLink",valueField:"url"}};function D(t){return (e,r,n)=>{if(!r)return;let{value:o,...a}=r,s={[t.valueField]:o??""};for(let[i,c]of Object.entries(a))c!==void 0&&(s[i]=c);return {type:t.type,[t.key]:s}}}var Ne=Object.fromEntries(Object.values(M).map(t=>[t.type,t])),Ut=class{constructor(){J(this,"imageResource",D(M.imageResource));J(this,"imageLinkResource",D(M.imageLinkResource));J(this,"audioResource",D(M.audioResource));J(this,"audioEmbedResource",D(M.audioEmbedResource));J(this,"audioLinkResource",D(M.audioLinkResource));J(this,"videoResource",D(M.videoResource));J(this,"videoEmbedResource",D(M.videoEmbedResource));J(this,"videoLinkResource",D(M.videoLinkResource));J(this,"stillImageFilmEmbedResource",D(M.stillImageFilmEmbedResource));J(this,"stillImageFilmLinkResource",D(M.stillImageFilmLinkResource));J(this,"articleResource",D(M.articleResource));J(this,"documentResource",D(M.documentResource));J(this,"documentEmbedResource",D(M.documentEmbedResource));J(this,"documentLinkResource",D(M.documentLinkResource));J(this,"documentDownloadResource",D(M.documentDownloadResource));J(this,"appLinkResource",D(M.appLinkResource));J(this,"websiteLinkResource",D(M.websiteLinkResource));}resourceFromResourceJson(e,r){if(!r)return;let n=!Array.isArray(r),o=n?[r]:r,a=[];for(let s of o){let i=Ne[s.type];if(!i)continue;let c=s[i.key]??{},{[i.valueField]:d,...g}=c,l=D(i)(void 0,{value:d,...g});l&&a.push(l);}if(a.length!==0)return n?a[0]:a}resourceFromResourceDataJson(e,r,n){if(!n)return;let o=Ne[r];if(!o)return;let a=typeof n=="string"?n:void 0,s=typeof n=="object"?n:{},{url:i,src:c,body:d,...g}=s,l=i??c??d??a;return D(o)(e,{value:l,...g})}};var Nr={string:"string",file:"file"},Vr={bitmark:"bitmark",json:"json",ast:"ast",text:"text"},Hr={bitmark:"bitmark",bitmarkText:"bitmarkText",plainText:"plainText",html:"html"},Ur={v2:2,v3:3},Gr={v1:1,v2:2},zr={peggy:"peggy"},Kr={list:"list",deprecated:"deprecated",all:"all",bit:"bit"},$r={text:"text",json:"json",pojo:"pojo"},qr={plainText:"text",latex:"latex",json:"json",xml:"xml",bitmarkPlusPlus:"bitmark++"},Yr={tag:"tag",body:"body"};var Ve={bold:"bold",light:"light",italic:"italic",highlight:"highlight",highlightOrange:"highlightOrange",highlightYellow:"highlightYellow",highlightGreen:"highlightGreen",highlightBlue:"highlightBlue",highlightPurple:"highlightPurple",highlightPink:"highlightPink",highlightBrown:"highlightBrown",highlightBlack:"highlightBlack",highlightWhite:"highlightWhite",highlightGray:"highlightGray",strike:"strike",subscript:"subscript",superscript:"superscript",ins:"ins",del:"del",underline:"underline",doubleUnderline:"doubleUnderline",circle:"circle",languageEmRed:"languageEmRed",languageEmOrange:"languageEmOrange",languageEmYellow:"languageEmYellow",languageEmGreen:"languageEmGreen",languageEmBlue:"languageEmBlue",languageEmPurple:"languageEmPurple",languageEmPink:"languageEmPink",languageEmBrown:"languageEmBrown",languageEmBlack:"languageEmBlack",languageEmWhite:"languageEmWhite",languageEmGray:"languageEmGray",languageEm:"languageEm",userUnderline:"userUnderline",userDoubleUnderline:"userDoubleUnderline",userStrike:"userStrike",userCircle:"userCircle",userHighlight:"userHighlight",notranslate:"notranslate",link:"link",ref:"ref",xref:"xref",extref:"extref",footnote:"footnote",footnoteStar:"footnote*",symbol:"symbol",var:"var",code:"code",timer:"timer",duration:"duration",color:"color",colorPicker:"colorPicker",comment:"comment"},He={text:"text",hardBreak:"hardBreak",paragraph:"paragraph",heading:"heading",section:"section",noBulletList:"noBulletList",bulletList:"bulletList",orderedList:"orderedList",orderedListRoman:"orderedListRoman",orderedListRomanLower:"orderedListRomanLower",letteredList:"letteredList",letteredListLower:"letteredListLower",taskList:"taskList",listItem:"listItem",taskItem:"taskItem",image:"image",imageInline:"imageInline",codeBlock:"codeBlock",latex:"latex",gap:"gap",select:"select",highlight:"highlight",mark:"mark"};function Xr(t){return t.replace(/-([a-z0-9])/gu,(e,r)=>r.toUpperCase())}var ce;function Ft(){if(!ce){let t=W(),e=JSON.parse(t.info("all","json","",false,2,true,false,false,"")),r={_standard:"_standard"};for(let{name:n}of e)r[Xr(n)]=n;ce=r;}return ce}var Ue=new Proxy({},{get:(t,e)=>typeof e=="string"?Ft()[e]:void 0,has:(t,e)=>typeof e=="string"&&e in Ft(),ownKeys:()=>Reflect.ownKeys(Ft()),getOwnPropertyDescriptor:(t,e)=>typeof e=="string"&&e in Ft()?{value:Ft()[e],enumerable:true,configurable:true,writable:false}:void 0});function Ge(t,e){return new Proxy({},{get:(r,n)=>n===Symbol.toPrimitive||n==="toString"||n===Symbol.toStringTag?()=>`[unsupported ${t}]`:at(t,e),has:()=>at(t,e),ownKeys:()=>at(t,e)})}var ze=Ge("NodeType","it names bpg's internal AST nodes; the legacy AST is bit JSON (see createAst)"),Ke=Ge("BoundingBoxIndex","bpg-internal bounding-box utility");function $(t,e){return class{constructor(){at(t,e);}}}var Qr="the legacy AST is bit JSON, not bpg's internal node model; walking it with bpg NodeType names would silently misbehave",q="internal class of bpg's TS implementation",$e=$("Ast",Qr),qe=$("BitmarkGenerator",q),Ye=$("BitmarkStringGenerator",q),Xe=$("BitmarkFileGenerator",q),Qe=$("JsonGenerator",q),Ze=$("JsonStringGenerator",q),tn=$("JsonFileGenerator",q),en=$("HtmlTableGenerator",q),nn=$("HtmlTableParser",q),rn=$("BitmarkParser",q),on=$("JsonParser",q),sn=$("StringWriter",q),an=$("FileWriter",q),pn=$("StreamWriter",q);var cn={Error:1,Warning:2,Information:3,Hint:4},un={Class:7,Property:10,Value:12,Keyword:14,Snippet:15,EnumMember:20,TypeParameter:25},dn={Deprecated:1};function Zr(t,e,r){return r===void 0?{path:t,op:e}:{path:t,op:e,value:r}}var to="all";function eo(t,e={}){let r=C().convert(t,"bitmark","json",e.mode??"optimized",false,2,1,e.includeUnknownProperties??false,false,"","");return JSON.parse(r)}function no(t,e={}){let r=t.map(o=>o!==null&&typeof o=="object"&&"bit"in o&&typeof o.bit=="object"?o:{bit:o});return C().convert(JSON.stringify(r),"json","bitmark",e.mode??"optimized",false,2,1,false,false,"","")}function ue(t,e={}){return C().convert(t,e.inputFormat??"auto",e.outputFormat??"auto",e.mode??"optimized",e.pretty??false,e.indent??2,e.spacesAroundValues??1,e.includeUnknownProperties??false,e.mappingReport??false,e.positionEncoding??"",e.tokensLayout??"")}function ro(t,e={}){return JSON.parse(ue(t,{inputFormat:"bitmark",outputFormat:"semantic-tokens",positionEncoding:e.positionEncoding,tokensLayout:e.tokensLayout}))}function oo(t,e={}){return JSON.parse(ue(t,{inputFormat:"bitmark",outputFormat:"diagnostics",positionEncoding:e.positionEncoding}))}function io(t,e,r={}){let n=C();if(typeof n.complete!="function")throw new it("complete",et());return JSON.parse(n.complete(t,e.line,e.character,r.positionEncoding??"",r.includeDeprecated??false,r.triggerCharacter??""))}function so(t,e,r,n={}){let o=C();if(typeof o.resolve!="function")throw new it("resolve",et());return JSON.parse(o.resolve(t,e.line,e.character,n.positionEncoding??"",n.includeDeprecated??false,r.label,r.kind))??r}function ao(t,e,r={}){let n=C();if(typeof n.hover!="function")throw new it("hover",et());return JSON.parse(n.hover(t,e.line,e.character,r.positionEncoding??""))}function po(t,e={}){return C().canonicalize(t,e.inputFormat??"auto",e.mode??"optimized",e.pretty??false,e.indent??2,e.spacesAroundValues??1)}function _o(t){return Number.parseInt(C().count_bits(t),10)}function co(t){return JSON.parse(C().split_bits(t))}function uo(t,e={}){let r=C();if(e.preHook||e.postHook)return Be(r,t,e);let n=e.patch===void 0?"":typeof e.patch=="string"?e.patch:JSON.stringify(e.patch);return r.transform(t,e.inputFormat??"auto",e.outputFormat??"json",e.mode??"optimized",n,e.pretty??false,e.indent??2,e.spacesAroundValues??1)}function ln(t,e,r={}){let n=C();if(typeof n.diff!="function")throw new it("diff",et());return n.diff(t,e,r.inputFormat??"auto",r.outputFormat??"bitmark",r.context??3,r.locate??false,r.similarity??.6,r.bboxTolerance??8,r.spacesAroundValues??0)}function lo(t,e,r={}){return JSON.parse(ln(t,e,{...r,outputFormat:"json"}))}function go(t,e={}){let r=e.format??"bitmark++",n=e.location??"body";return C().breakscape_text(t,r,n)}function fo(t,e={}){let r=e.format??"bitmark++",n=e.location??"body";return C().unbreakscape_text(t,r,n)}function mo(t={}){let e=t.infoType??"list",r=t.format??"text",n=t.bit??"",o=t.pretty??false,a=t.indent??2,s=t.includeDeprecated??false,i=t.onlyDeprecated??false,c=t.full??false,d=typeof t.language=="string"?t.language:t.language?.join(",")??"",g=C();if(r!=="json"&&typeof g.info_text_supported!="function")throw new it('info (format: "text")',et());return g.info(e,r,n,o,a,s,i,c,d)}function bo(t){try{C().register(t.type,t.data);}catch(e){throw new dt(e instanceof Error?e.message:String(e))}Se(t.type,t.data);}var xo="./wasm/",gn={full:{init:Kt,initSync:zt,ns:$t,wasmFile:"bitmark_wasm_bg.wasm"},"browser-full":{init:Yt,initSync:qt,ns:Xt,wasmFile:"bitmark_browser_full_wasm_bg.wasm"},"bitmark-json":{init:Zt,initSync:Qt,ns:te,wasmFile:"bitmark_json_wasm_bg.wasm"}};Ae(()=>C());function de(t){return t===void 0?ee:"full"}function yo(t){if(t===null||typeof t!="object")return false;if("feature"in t||"module_or_path"in t)return true;let e=Object.getPrototypeOf(t);return (e===Object.prototype||e===null)&&Object.keys(t).length===0}function wo(t){if(yo(t))return {feature:t.feature??de(t.module_or_path),module_or_path:t.module_or_path};let e=t??void 0;return {feature:de(e),module_or_path:e}}var le=0,Gt,st;async function $i(t){let{feature:e,module_or_path:r}=wo(t);if(r===void 0){if(!st&&et()===e)return Gt;if(st?.feature===e)return st.promise}let n=++le,o=gn[e],a=r??new URL(`${xo}${o.wasmFile}?v=${Ot.version}`,import.meta.url),s=(async()=>{try{let i=await o.init({module_or_path:a});n===le&&(ne(e,o.ns),Gt=i);}finally{st?.seq===n&&(st=void 0);}for(;st;)await st.promise.catch(()=>{});return Gt})();return st={feature:e,seq:n,promise:s},s}function qi(t,e={}){let r=e.feature??de(t),n=gn[r],o=n.initSync({module:t});return ++le,st=void 0,ne(r,n.ns),Gt=o,o}function Yi(){return Ot.version}function Xi(t,e={}){let r=C(),n=et()??ee;return Pe(r,t,e,(o,a)=>Le(o,a,n))}export{to as ALL_LANGUAGES,un as CompletionItemKind,dn as CompletionItemTag,cn as DiagnosticSeverity,Ct as NotInitializedError,dt as RegisterError,it as UnsupportedFeatureError,eo as bitmarkToObjects,go as breakscapeText,po as canonicalize,io as complete,ue as convert,_o as countBits,oo as diagnostics,ln as diff,lo as diffBits,ao as hover,mo as info,$i as init,qi as initSync,_n as legacy,no as objectsToBitmark,Zr as patchEntry,bo as register,so as resolve,ro as semanticTokens,co as splitBits,uo as transform,Xi as transformParallel,fo as unbreakscapeText,et as variant,Yi as version};//# sourceMappingURL=bitmark-parser.min.js.map
1
+ var fe=Object.defineProperty;var yn=(t,e,r)=>e in t?fe(t,e,{enumerable:true,configurable:true,writable:true,value:r}):t[e]=r;var Rt=(t,e)=>{for(var r in e)fe(t,r,{get:e[r],enumerable:true});};var C=(t,e,r)=>yn(t,typeof e!="symbol"?e+"":e,r);var qt={};Rt(qt,{breakscape_text:()=>vn,canonicalize:()=>Dn,complete:()=>Pn,convert:()=>Cn,convert_text:()=>En,count_bits:()=>Wn,default:()=>Kt,diff:()=>Bn,hover:()=>jn,info:()=>In,info_text_supported:()=>On,initSync:()=>$t,is_bitmark:()=>Mn,prettify:()=>Vn,register:()=>Ln,resolve:()=>An,resolve_patch_document:()=>Sn,split_bits:()=>Jn,split_json_bits:()=>Nn,transform:()=>Rn,unbreakscape_text:()=>hn});var c,me=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&me.decode();var kt=null;function St(){return (kt===null||kt.byteLength===0)&&(kt=new Uint8Array(c.memory.buffer)),kt}function N(t,e){return t=t>>>0,me.decode(St().subarray(t,t+e))}var nt=new Array(128).fill(void 0);nt.push(void 0,null,true,false);var vt=nt.length;function wn(t){vt===nt.length&&nt.push(nt.length+1);let e=vt;return vt=nt[e],nt[e]=t,e}var T=0,Bt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},kn=typeof Bt.encodeInto=="function"?function(t,e){return Bt.encodeInto(t,e)}:function(t,e){let r=Bt.encode(t);return e.set(r),{read:t.length,written:r.length}};function E(t,e,r){if(r===void 0){let i=Bt.encode(t),p=e(i.length,1)>>>0;return St().subarray(p,p+i.length).set(i),T=i.length,p}let n=t.length,o=e(n,1)>>>0,a=St(),s=0;for(;s<n;s++){let i=t.charCodeAt(s);if(i>127)break;a[o+s]=i;}if(s!==n){s!==0&&(t=t.slice(s)),o=r(o,n,n=s+t.length*3,1)>>>0;let i=St().subarray(o+s,o+n),p=kn(t,i);s+=p.written,o=r(o,n,s,1)>>>0;}return T=s,o}function be(t){return t==null}var ct=null;function h(){return (ct===null||ct.buffer.detached===true||ct.buffer.detached===void 0&&ct.buffer!==c.memory.buffer)&&(ct=new DataView(c.memory.buffer)),ct}function vn(t,e,r,n){let o,a;try{let l=c.__wbindgen_add_to_stack_pointer(-16),g=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),f=T,x=E(e,c.__wbindgen_export_0,c.__wbindgen_export_1),m=T,y=E(r,c.__wbindgen_export_0,c.__wbindgen_export_1),b=T;var s=be(n)?0:E(n,c.__wbindgen_export_0,c.__wbindgen_export_1),i=T;c.breakscape_text(l,g,f,x,m,y,b,s,i);var p=h().getInt32(l+0,!0),u=h().getInt32(l+4,!0);return o=p,a=u,N(p,u)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(o,a,1);}}function hn(t,e,r,n){let o,a;try{let l=c.__wbindgen_add_to_stack_pointer(-16),g=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),f=T,x=E(e,c.__wbindgen_export_0,c.__wbindgen_export_1),m=T,y=E(r,c.__wbindgen_export_0,c.__wbindgen_export_1),b=T;var s=be(n)?0:E(n,c.__wbindgen_export_0,c.__wbindgen_export_1),i=T;c.unbreakscape_text(l,g,f,x,m,y,b,s,i);var p=h().getInt32(l+0,!0),u=h().getInt32(l+4,!0);return o=p,a=u,N(p,u)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(o,a,1);}}function In(t,e,r,n,o,a,s,i,p){let u,l;try{let x=c.__wbindgen_add_to_stack_pointer(-16),m=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),y=T,b=E(e,c.__wbindgen_export_0,c.__wbindgen_export_1),w=T,k=E(r,c.__wbindgen_export_0,c.__wbindgen_export_1),v=T,O=E(p,c.__wbindgen_export_0,c.__wbindgen_export_1),A=T;c.info(x,m,y,b,w,k,v,n,o,a,s,i,O,A);var g=h().getInt32(x+0,!0),f=h().getInt32(x+4,!0);return u=g,l=f,N(g,f)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(u,l,1);}}function On(){return c.info_text_supported()!==0}function Tn(t){return nt[t]}function Fn(t){t<132||(nt[t]=vt,vt=t);}function Y(t){let e=Tn(t);return Fn(t),e}function En(t,e,r,n){let o,a;try{let f=c.__wbindgen_add_to_stack_pointer(-16),x=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),m=T,y=E(e,c.__wbindgen_export_0,c.__wbindgen_export_1),b=T,w=E(r,c.__wbindgen_export_0,c.__wbindgen_export_1),k=T,v=E(n,c.__wbindgen_export_0,c.__wbindgen_export_1),O=T;c.convert_text(f,x,m,y,b,w,k,v,O);var s=h().getInt32(f+0,!0),i=h().getInt32(f+4,!0),p=h().getInt32(f+8,!0),u=h().getInt32(f+12,!0),l=s,g=i;if(u)throw l=0,g=0,Y(p);return o=l,a=g,N(l,g)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(o,a,1);}}function Rn(t,e,r,n,o,a,s,i){let p,u;try{let b=c.__wbindgen_add_to_stack_pointer(-16),w=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),k=T,v=E(e,c.__wbindgen_export_0,c.__wbindgen_export_1),O=T,A=E(r,c.__wbindgen_export_0,c.__wbindgen_export_1),U=T,G=E(n,c.__wbindgen_export_0,c.__wbindgen_export_1),z=T,$=E(o,c.__wbindgen_export_0,c.__wbindgen_export_1),Q=T;c.transform(b,w,k,v,O,A,U,G,z,$,Q,a,s,i);var l=h().getInt32(b+0,!0),g=h().getInt32(b+4,!0),f=h().getInt32(b+8,!0),x=h().getInt32(b+12,!0),m=l,y=g;if(x)throw m=0,y=0,Y(f);return p=m,u=y,N(m,y)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(p,u,1);}}function Sn(t,e,r){let n,o;try{let g=c.__wbindgen_add_to_stack_pointer(-16),f=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),x=T,m=E(e,c.__wbindgen_export_0,c.__wbindgen_export_1),y=T,b=E(r,c.__wbindgen_export_0,c.__wbindgen_export_1),w=T;c.resolve_patch_document(g,f,x,m,y,b,w);var a=h().getInt32(g+0,!0),s=h().getInt32(g+4,!0),i=h().getInt32(g+8,!0),p=h().getInt32(g+12,!0),u=a,l=s;if(p)throw u=0,l=0,Y(i);return n=u,o=l,N(u,l)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(n,o,1);}}function Bn(t,e,r,n,o,a,s,i,p){let u,l;try{let w=c.__wbindgen_add_to_stack_pointer(-16),k=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),v=T,O=E(e,c.__wbindgen_export_0,c.__wbindgen_export_1),A=T,U=E(r,c.__wbindgen_export_0,c.__wbindgen_export_1),G=T,z=E(n,c.__wbindgen_export_0,c.__wbindgen_export_1),$=T;c.diff(w,k,v,O,A,U,G,z,$,o,a,s,i,p);var g=h().getInt32(w+0,!0),f=h().getInt32(w+4,!0),x=h().getInt32(w+8,!0),m=h().getInt32(w+12,!0),y=g,b=f;if(m)throw y=0,b=0,Y(x);return u=y,l=b,N(y,b)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(u,l,1);}}function Pn(t,e,r,n,o,a){let s,i;try{let m=c.__wbindgen_add_to_stack_pointer(-16),y=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),b=T,w=E(n,c.__wbindgen_export_0,c.__wbindgen_export_1),k=T,v=E(a,c.__wbindgen_export_0,c.__wbindgen_export_1),O=T;c.complete(m,y,b,e,r,w,k,o,v,O);var p=h().getInt32(m+0,!0),u=h().getInt32(m+4,!0),l=h().getInt32(m+8,!0),g=h().getInt32(m+12,!0),f=p,x=u;if(g)throw f=0,x=0,Y(l);return s=f,i=x,N(f,x)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(s,i,1);}}function An(t,e,r,n,o,a,s){let i,p;try{let y=c.__wbindgen_add_to_stack_pointer(-16),b=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),w=T,k=E(n,c.__wbindgen_export_0,c.__wbindgen_export_1),v=T,O=E(a,c.__wbindgen_export_0,c.__wbindgen_export_1),A=T;c.resolve(y,b,w,e,r,k,v,o,O,A,s);var u=h().getInt32(y+0,!0),l=h().getInt32(y+4,!0),g=h().getInt32(y+8,!0),f=h().getInt32(y+12,!0),x=u,m=l;if(f)throw x=0,m=0,Y(g);return i=x,p=m,N(x,m)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(i,p,1);}}function jn(t,e,r,n){let o,a;try{let f=c.__wbindgen_add_to_stack_pointer(-16),x=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),m=T,y=E(n,c.__wbindgen_export_0,c.__wbindgen_export_1),b=T;c.hover(f,x,m,e,r,y,b);var s=h().getInt32(f+0,!0),i=h().getInt32(f+4,!0),p=h().getInt32(f+8,!0),u=h().getInt32(f+12,!0),l=s,g=i;if(u)throw l=0,g=0,Y(p);return o=l,a=g,N(l,g)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(o,a,1);}}function Ln(t,e){try{let o=c.__wbindgen_add_to_stack_pointer(-16),a=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),s=T,i=E(e,c.__wbindgen_export_0,c.__wbindgen_export_1),p=T;c.register(o,a,s,i,p);var r=h().getInt32(o+0,!0),n=h().getInt32(o+4,!0);if(n)throw Y(r)}finally{c.__wbindgen_add_to_stack_pointer(16);}}function Cn(t,e,r,n,o,a,s,i,p,u,l){let g,f;try{let v=c.__wbindgen_add_to_stack_pointer(-16),O=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),A=T,U=E(e,c.__wbindgen_export_0,c.__wbindgen_export_1),G=T,z=E(r,c.__wbindgen_export_0,c.__wbindgen_export_1),$=T,Q=E(n,c.__wbindgen_export_0,c.__wbindgen_export_1),mt=T,bt=E(u,c.__wbindgen_export_0,c.__wbindgen_export_1),xt=T,yt=E(l,c.__wbindgen_export_0,c.__wbindgen_export_1),wt=T;c.convert(v,O,A,U,G,z,$,Q,mt,o,a,s,i,p,bt,xt,yt,wt);var x=h().getInt32(v+0,!0),m=h().getInt32(v+4,!0),y=h().getInt32(v+8,!0),b=h().getInt32(v+12,!0),w=x,k=m;if(b)throw w=0,k=0,Y(y);return g=w,f=k,N(w,k)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(g,f,1);}}function Dn(t,e,r,n,o,a){let s,i;try{let m=c.__wbindgen_add_to_stack_pointer(-16),y=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),b=T,w=E(e,c.__wbindgen_export_0,c.__wbindgen_export_1),k=T,v=E(r,c.__wbindgen_export_0,c.__wbindgen_export_1),O=T;c.canonicalize(m,y,b,w,k,v,O,n,o,a);var p=h().getInt32(m+0,!0),u=h().getInt32(m+4,!0),l=h().getInt32(m+8,!0),g=h().getInt32(m+12,!0),f=p,x=u;if(g)throw f=0,x=0,Y(l);return s=f,i=x,N(f,x)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(s,i,1);}}function Wn(t){let e,r;try{let u=c.__wbindgen_add_to_stack_pointer(-16),l=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),g=T;c.count_bits(u,l,g);var n=h().getInt32(u+0,!0),o=h().getInt32(u+4,!0),a=h().getInt32(u+8,!0),s=h().getInt32(u+12,!0),i=n,p=o;if(s)throw i=0,p=0,Y(a);return e=i,r=p,N(i,p)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(e,r,1);}}function Jn(t){let e,r;try{let a=c.__wbindgen_add_to_stack_pointer(-16),s=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),i=T;c.split_bits(a,s,i);var n=h().getInt32(a+0,!0),o=h().getInt32(a+4,!0);return e=n,r=o,N(n,o)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(e,r,1);}}function Mn(t){let e=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),r=T;return c.is_bitmark(e,r)!==0}function Nn(t){let e,r;try{let u=c.__wbindgen_add_to_stack_pointer(-16),l=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),g=T;c.split_json_bits(u,l,g);var n=h().getInt32(u+0,!0),o=h().getInt32(u+4,!0),a=h().getInt32(u+8,!0),s=h().getInt32(u+12,!0),i=n,p=o;if(s)throw i=0,p=0,Y(a);return e=i,r=p,N(i,p)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(e,r,1);}}function Vn(t,e){let r,n;try{let s=c.__wbindgen_add_to_stack_pointer(-16),i=E(t,c.__wbindgen_export_0,c.__wbindgen_export_1),p=T;c.prettify(s,i,p,e);var o=h().getInt32(s+0,!0),a=h().getInt32(s+4,!0);return r=o,n=a,N(o,a)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(r,n,1);}}async function Hn(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(n){if(t.headers.get("Content-Type")!="application/wasm")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",n);else throw n}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function xe(){let t={};return t.wbg={},t.wbg.__wbindgen_error_new=function(e,r){let n=new Error(N(e,r));return wn(n)},t}function ye(t,e){return c=t.exports,we.__wbindgen_wasm_module=e,ct=null,kt=null,c}function $t(t){if(c!==void 0)return c;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=xe();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let r=new WebAssembly.Instance(t,e);return ye(r,t)}async function we(t){if(c!==void 0)return c;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("bitmark_wasm_bg.wasm",import.meta.url));let e=xe();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:n}=await Hn(await t,e);return ye(r,n)}var Kt=we;var Qt={};Rt(Qt,{breakscape_text:()=>zn,canonicalize:()=>ar,complete:()=>nr,convert:()=>sr,convert_text:()=>Qn,count_bits:()=>pr,default:()=>Xt,diff:()=>er,hover:()=>or,info:()=>Kn,info_text_supported:()=>qn,initSync:()=>Yt,is_bitmark:()=>_r,prettify:()=>dr,register:()=>ir,resolve:()=>rr,resolve_patch_document:()=>tr,split_bits:()=>cr,split_json_bits:()=>ur,transform:()=>Zn,unbreakscape_text:()=>$n});var _,ke=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&ke.decode();var ht=null;function Pt(){return (ht===null||ht.byteLength===0)&&(ht=new Uint8Array(_.memory.buffer)),ht}function V(t,e){return t=t>>>0,ke.decode(Pt().subarray(t,t+e))}var rt=new Array(128).fill(void 0);rt.push(void 0,null,true,false);var It=rt.length;function Un(t){It===rt.length&&rt.push(rt.length+1);let e=It;return It=rt[e],rt[e]=t,e}var F=0,At=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Gn=typeof At.encodeInto=="function"?function(t,e){return At.encodeInto(t,e)}:function(t,e){let r=At.encode(t);return e.set(r),{read:t.length,written:r.length}};function R(t,e,r){if(r===void 0){let i=At.encode(t),p=e(i.length,1)>>>0;return Pt().subarray(p,p+i.length).set(i),F=i.length,p}let n=t.length,o=e(n,1)>>>0,a=Pt(),s=0;for(;s<n;s++){let i=t.charCodeAt(s);if(i>127)break;a[o+s]=i;}if(s!==n){s!==0&&(t=t.slice(s)),o=r(o,n,n=s+t.length*3,1)>>>0;let i=Pt().subarray(o+s,o+n),p=Gn(t,i);s+=p.written,o=r(o,n,s,1)>>>0;}return F=s,o}function ve(t){return t==null}var _t=null;function I(){return (_t===null||_t.buffer.detached===true||_t.buffer.detached===void 0&&_t.buffer!==_.memory.buffer)&&(_t=new DataView(_.memory.buffer)),_t}function zn(t,e,r,n){let o,a;try{let l=_.__wbindgen_add_to_stack_pointer(-16),g=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),f=F,x=R(e,_.__wbindgen_export_0,_.__wbindgen_export_1),m=F,y=R(r,_.__wbindgen_export_0,_.__wbindgen_export_1),b=F;var s=ve(n)?0:R(n,_.__wbindgen_export_0,_.__wbindgen_export_1),i=F;_.breakscape_text(l,g,f,x,m,y,b,s,i);var p=I().getInt32(l+0,!0),u=I().getInt32(l+4,!0);return o=p,a=u,V(p,u)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(o,a,1);}}function $n(t,e,r,n){let o,a;try{let l=_.__wbindgen_add_to_stack_pointer(-16),g=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),f=F,x=R(e,_.__wbindgen_export_0,_.__wbindgen_export_1),m=F,y=R(r,_.__wbindgen_export_0,_.__wbindgen_export_1),b=F;var s=ve(n)?0:R(n,_.__wbindgen_export_0,_.__wbindgen_export_1),i=F;_.unbreakscape_text(l,g,f,x,m,y,b,s,i);var p=I().getInt32(l+0,!0),u=I().getInt32(l+4,!0);return o=p,a=u,V(p,u)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(o,a,1);}}function Kn(t,e,r,n,o,a,s,i,p){let u,l;try{let x=_.__wbindgen_add_to_stack_pointer(-16),m=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),y=F,b=R(e,_.__wbindgen_export_0,_.__wbindgen_export_1),w=F,k=R(r,_.__wbindgen_export_0,_.__wbindgen_export_1),v=F,O=R(p,_.__wbindgen_export_0,_.__wbindgen_export_1),A=F;_.info(x,m,y,b,w,k,v,n,o,a,s,i,O,A);var g=I().getInt32(x+0,!0),f=I().getInt32(x+4,!0);return u=g,l=f,V(g,f)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(u,l,1);}}function qn(){return _.info_text_supported()!==0}function Yn(t){return rt[t]}function Xn(t){t<132||(rt[t]=It,It=t);}function X(t){let e=Yn(t);return Xn(t),e}function Qn(t,e,r,n){let o,a;try{let f=_.__wbindgen_add_to_stack_pointer(-16),x=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),m=F,y=R(e,_.__wbindgen_export_0,_.__wbindgen_export_1),b=F,w=R(r,_.__wbindgen_export_0,_.__wbindgen_export_1),k=F,v=R(n,_.__wbindgen_export_0,_.__wbindgen_export_1),O=F;_.convert_text(f,x,m,y,b,w,k,v,O);var s=I().getInt32(f+0,!0),i=I().getInt32(f+4,!0),p=I().getInt32(f+8,!0),u=I().getInt32(f+12,!0),l=s,g=i;if(u)throw l=0,g=0,X(p);return o=l,a=g,V(l,g)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(o,a,1);}}function Zn(t,e,r,n,o,a,s,i){let p,u;try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),k=F,v=R(e,_.__wbindgen_export_0,_.__wbindgen_export_1),O=F,A=R(r,_.__wbindgen_export_0,_.__wbindgen_export_1),U=F,G=R(n,_.__wbindgen_export_0,_.__wbindgen_export_1),z=F,$=R(o,_.__wbindgen_export_0,_.__wbindgen_export_1),Q=F;_.transform(b,w,k,v,O,A,U,G,z,$,Q,a,s,i);var l=I().getInt32(b+0,!0),g=I().getInt32(b+4,!0),f=I().getInt32(b+8,!0),x=I().getInt32(b+12,!0),m=l,y=g;if(x)throw m=0,y=0,X(f);return p=m,u=y,V(m,y)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(p,u,1);}}function tr(t,e,r){let n,o;try{let g=_.__wbindgen_add_to_stack_pointer(-16),f=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),x=F,m=R(e,_.__wbindgen_export_0,_.__wbindgen_export_1),y=F,b=R(r,_.__wbindgen_export_0,_.__wbindgen_export_1),w=F;_.resolve_patch_document(g,f,x,m,y,b,w);var a=I().getInt32(g+0,!0),s=I().getInt32(g+4,!0),i=I().getInt32(g+8,!0),p=I().getInt32(g+12,!0),u=a,l=s;if(p)throw u=0,l=0,X(i);return n=u,o=l,V(u,l)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(n,o,1);}}function er(t,e,r,n,o,a,s,i,p){let u,l;try{let w=_.__wbindgen_add_to_stack_pointer(-16),k=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),v=F,O=R(e,_.__wbindgen_export_0,_.__wbindgen_export_1),A=F,U=R(r,_.__wbindgen_export_0,_.__wbindgen_export_1),G=F,z=R(n,_.__wbindgen_export_0,_.__wbindgen_export_1),$=F;_.diff(w,k,v,O,A,U,G,z,$,o,a,s,i,p);var g=I().getInt32(w+0,!0),f=I().getInt32(w+4,!0),x=I().getInt32(w+8,!0),m=I().getInt32(w+12,!0),y=g,b=f;if(m)throw y=0,b=0,X(x);return u=y,l=b,V(y,b)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(u,l,1);}}function nr(t,e,r,n,o,a){let s,i;try{let m=_.__wbindgen_add_to_stack_pointer(-16),y=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),b=F,w=R(n,_.__wbindgen_export_0,_.__wbindgen_export_1),k=F,v=R(a,_.__wbindgen_export_0,_.__wbindgen_export_1),O=F;_.complete(m,y,b,e,r,w,k,o,v,O);var p=I().getInt32(m+0,!0),u=I().getInt32(m+4,!0),l=I().getInt32(m+8,!0),g=I().getInt32(m+12,!0),f=p,x=u;if(g)throw f=0,x=0,X(l);return s=f,i=x,V(f,x)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(s,i,1);}}function rr(t,e,r,n,o,a,s){let i,p;try{let y=_.__wbindgen_add_to_stack_pointer(-16),b=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),w=F,k=R(n,_.__wbindgen_export_0,_.__wbindgen_export_1),v=F,O=R(a,_.__wbindgen_export_0,_.__wbindgen_export_1),A=F;_.resolve(y,b,w,e,r,k,v,o,O,A,s);var u=I().getInt32(y+0,!0),l=I().getInt32(y+4,!0),g=I().getInt32(y+8,!0),f=I().getInt32(y+12,!0),x=u,m=l;if(f)throw x=0,m=0,X(g);return i=x,p=m,V(x,m)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(i,p,1);}}function or(t,e,r,n){let o,a;try{let f=_.__wbindgen_add_to_stack_pointer(-16),x=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),m=F,y=R(n,_.__wbindgen_export_0,_.__wbindgen_export_1),b=F;_.hover(f,x,m,e,r,y,b);var s=I().getInt32(f+0,!0),i=I().getInt32(f+4,!0),p=I().getInt32(f+8,!0),u=I().getInt32(f+12,!0),l=s,g=i;if(u)throw l=0,g=0,X(p);return o=l,a=g,V(l,g)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(o,a,1);}}function ir(t,e){try{let o=_.__wbindgen_add_to_stack_pointer(-16),a=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),s=F,i=R(e,_.__wbindgen_export_0,_.__wbindgen_export_1),p=F;_.register(o,a,s,i,p);var r=I().getInt32(o+0,!0),n=I().getInt32(o+4,!0);if(n)throw X(r)}finally{_.__wbindgen_add_to_stack_pointer(16);}}function sr(t,e,r,n,o,a,s,i,p,u,l){let g,f;try{let v=_.__wbindgen_add_to_stack_pointer(-16),O=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),A=F,U=R(e,_.__wbindgen_export_0,_.__wbindgen_export_1),G=F,z=R(r,_.__wbindgen_export_0,_.__wbindgen_export_1),$=F,Q=R(n,_.__wbindgen_export_0,_.__wbindgen_export_1),mt=F,bt=R(u,_.__wbindgen_export_0,_.__wbindgen_export_1),xt=F,yt=R(l,_.__wbindgen_export_0,_.__wbindgen_export_1),wt=F;_.convert(v,O,A,U,G,z,$,Q,mt,o,a,s,i,p,bt,xt,yt,wt);var x=I().getInt32(v+0,!0),m=I().getInt32(v+4,!0),y=I().getInt32(v+8,!0),b=I().getInt32(v+12,!0),w=x,k=m;if(b)throw w=0,k=0,X(y);return g=w,f=k,V(w,k)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(g,f,1);}}function ar(t,e,r,n,o,a){let s,i;try{let m=_.__wbindgen_add_to_stack_pointer(-16),y=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),b=F,w=R(e,_.__wbindgen_export_0,_.__wbindgen_export_1),k=F,v=R(r,_.__wbindgen_export_0,_.__wbindgen_export_1),O=F;_.canonicalize(m,y,b,w,k,v,O,n,o,a);var p=I().getInt32(m+0,!0),u=I().getInt32(m+4,!0),l=I().getInt32(m+8,!0),g=I().getInt32(m+12,!0),f=p,x=u;if(g)throw f=0,x=0,X(l);return s=f,i=x,V(f,x)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(s,i,1);}}function pr(t){let e,r;try{let u=_.__wbindgen_add_to_stack_pointer(-16),l=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),g=F;_.count_bits(u,l,g);var n=I().getInt32(u+0,!0),o=I().getInt32(u+4,!0),a=I().getInt32(u+8,!0),s=I().getInt32(u+12,!0),i=n,p=o;if(s)throw i=0,p=0,X(a);return e=i,r=p,V(i,p)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(e,r,1);}}function cr(t){let e,r;try{let a=_.__wbindgen_add_to_stack_pointer(-16),s=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),i=F;_.split_bits(a,s,i);var n=I().getInt32(a+0,!0),o=I().getInt32(a+4,!0);return e=n,r=o,V(n,o)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(e,r,1);}}function _r(t){let e=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),r=F;return _.is_bitmark(e,r)!==0}function ur(t){let e,r;try{let u=_.__wbindgen_add_to_stack_pointer(-16),l=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),g=F;_.split_json_bits(u,l,g);var n=I().getInt32(u+0,!0),o=I().getInt32(u+4,!0),a=I().getInt32(u+8,!0),s=I().getInt32(u+12,!0),i=n,p=o;if(s)throw i=0,p=0,X(a);return e=i,r=p,V(i,p)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(e,r,1);}}function dr(t,e){let r,n;try{let s=_.__wbindgen_add_to_stack_pointer(-16),i=R(t,_.__wbindgen_export_0,_.__wbindgen_export_1),p=F;_.prettify(s,i,p,e);var o=I().getInt32(s+0,!0),a=I().getInt32(s+4,!0);return r=o,n=a,V(o,a)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(r,n,1);}}async function lr(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(n){if(t.headers.get("Content-Type")!="application/wasm")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",n);else throw n}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function he(){let t={};return t.wbg={},t.wbg.__wbindgen_error_new=function(e,r){let n=new Error(V(e,r));return Un(n)},t}function Ie(t,e){return _=t.exports,Oe.__wbindgen_wasm_module=e,_t=null,ht=null,_}function Yt(t){if(_!==void 0)return _;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=he();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let r=new WebAssembly.Instance(t,e);return Ie(r,t)}async function Oe(t){if(_!==void 0)return _;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("bitmark_browser_full_wasm_bg.wasm",import.meta.url));let e=he();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:n}=await lr(await t,e);return Ie(r,n)}var Xt=Oe;var ee={};Rt(ee,{breakscape_text:()=>mr,canonicalize:()=>Er,complete:()=>Ir,convert:()=>Fr,convert_text:()=>jr,count_bits:()=>Rr,default:()=>te,hover:()=>Tr,info:()=>xr,initSync:()=>Zt,is_bitmark:()=>Br,prettify:()=>Ar,register:()=>kr,resolve:()=>Or,resolve_patch_document:()=>hr,split_bits:()=>Sr,split_json_bits:()=>Pr,transform:()=>vr,unbreakscape_text:()=>br});var d,Te=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Te.decode();var Ot=null;function jt(){return (Ot===null||Ot.byteLength===0)&&(Ot=new Uint8Array(d.memory.buffer)),Ot}function H(t,e){return t=t>>>0,Te.decode(jt().subarray(t,t+e))}var ot=new Array(128).fill(void 0);ot.push(void 0,null,true,false);var Tt=ot.length;function gr(t){Tt===ot.length&&ot.push(ot.length+1);let e=Tt;return Tt=ot[e],ot[e]=t,e}var B=0,Lt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},fr=typeof Lt.encodeInto=="function"?function(t,e){return Lt.encodeInto(t,e)}:function(t,e){let r=Lt.encode(t);return e.set(r),{read:t.length,written:r.length}};function P(t,e,r){if(r===void 0){let i=Lt.encode(t),p=e(i.length,1)>>>0;return jt().subarray(p,p+i.length).set(i),B=i.length,p}let n=t.length,o=e(n,1)>>>0,a=jt(),s=0;for(;s<n;s++){let i=t.charCodeAt(s);if(i>127)break;a[o+s]=i;}if(s!==n){s!==0&&(t=t.slice(s)),o=r(o,n,n=s+t.length*3,1)>>>0;let i=jt().subarray(o+s,o+n),p=fr(t,i);s+=p.written,o=r(o,n,s,1)>>>0;}return B=s,o}function Fe(t){return t==null}var ut=null;function S(){return (ut===null||ut.buffer.detached===true||ut.buffer.detached===void 0&&ut.buffer!==d.memory.buffer)&&(ut=new DataView(d.memory.buffer)),ut}function mr(t,e,r,n){let o,a;try{let l=d.__wbindgen_add_to_stack_pointer(-16),g=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),f=B,x=P(e,d.__wbindgen_export_0,d.__wbindgen_export_1),m=B,y=P(r,d.__wbindgen_export_0,d.__wbindgen_export_1),b=B;var s=Fe(n)?0:P(n,d.__wbindgen_export_0,d.__wbindgen_export_1),i=B;d.breakscape_text(l,g,f,x,m,y,b,s,i);var p=S().getInt32(l+0,!0),u=S().getInt32(l+4,!0);return o=p,a=u,H(p,u)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(o,a,1);}}function br(t,e,r,n){let o,a;try{let l=d.__wbindgen_add_to_stack_pointer(-16),g=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),f=B,x=P(e,d.__wbindgen_export_0,d.__wbindgen_export_1),m=B,y=P(r,d.__wbindgen_export_0,d.__wbindgen_export_1),b=B;var s=Fe(n)?0:P(n,d.__wbindgen_export_0,d.__wbindgen_export_1),i=B;d.unbreakscape_text(l,g,f,x,m,y,b,s,i);var p=S().getInt32(l+0,!0),u=S().getInt32(l+4,!0);return o=p,a=u,H(p,u)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(o,a,1);}}function xr(t,e,r,n,o,a,s,i,p){let u,l;try{let x=d.__wbindgen_add_to_stack_pointer(-16),m=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),y=B,b=P(e,d.__wbindgen_export_0,d.__wbindgen_export_1),w=B,k=P(r,d.__wbindgen_export_0,d.__wbindgen_export_1),v=B,O=P(p,d.__wbindgen_export_0,d.__wbindgen_export_1),A=B;d.info(x,m,y,b,w,k,v,n,o,a,s,i,O,A);var g=S().getInt32(x+0,!0),f=S().getInt32(x+4,!0);return u=g,l=f,H(g,f)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(u,l,1);}}function yr(t){return ot[t]}function wr(t){t<132||(ot[t]=Tt,Tt=t);}function Z(t){let e=yr(t);return wr(t),e}function kr(t,e){try{let o=d.__wbindgen_add_to_stack_pointer(-16),a=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),s=B,i=P(e,d.__wbindgen_export_0,d.__wbindgen_export_1),p=B;d.register(o,a,s,i,p);var r=S().getInt32(o+0,!0),n=S().getInt32(o+4,!0);if(n)throw Z(r)}finally{d.__wbindgen_add_to_stack_pointer(16);}}function vr(t,e,r,n,o,a,s,i){let p,u;try{let b=d.__wbindgen_add_to_stack_pointer(-16),w=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),k=B,v=P(e,d.__wbindgen_export_0,d.__wbindgen_export_1),O=B,A=P(r,d.__wbindgen_export_0,d.__wbindgen_export_1),U=B,G=P(n,d.__wbindgen_export_0,d.__wbindgen_export_1),z=B,$=P(o,d.__wbindgen_export_0,d.__wbindgen_export_1),Q=B;d.transform(b,w,k,v,O,A,U,G,z,$,Q,a,s,i);var l=S().getInt32(b+0,!0),g=S().getInt32(b+4,!0),f=S().getInt32(b+8,!0),x=S().getInt32(b+12,!0),m=l,y=g;if(x)throw m=0,y=0,Z(f);return p=m,u=y,H(m,y)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(p,u,1);}}function hr(t,e,r){let n,o;try{let g=d.__wbindgen_add_to_stack_pointer(-16),f=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),x=B,m=P(e,d.__wbindgen_export_0,d.__wbindgen_export_1),y=B,b=P(r,d.__wbindgen_export_0,d.__wbindgen_export_1),w=B;d.resolve_patch_document(g,f,x,m,y,b,w);var a=S().getInt32(g+0,!0),s=S().getInt32(g+4,!0),i=S().getInt32(g+8,!0),p=S().getInt32(g+12,!0),u=a,l=s;if(p)throw u=0,l=0,Z(i);return n=u,o=l,H(u,l)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(n,o,1);}}function Ir(t,e,r,n,o,a){let s,i;try{let m=d.__wbindgen_add_to_stack_pointer(-16),y=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),b=B,w=P(n,d.__wbindgen_export_0,d.__wbindgen_export_1),k=B,v=P(a,d.__wbindgen_export_0,d.__wbindgen_export_1),O=B;d.complete(m,y,b,e,r,w,k,o,v,O);var p=S().getInt32(m+0,!0),u=S().getInt32(m+4,!0),l=S().getInt32(m+8,!0),g=S().getInt32(m+12,!0),f=p,x=u;if(g)throw f=0,x=0,Z(l);return s=f,i=x,H(f,x)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(s,i,1);}}function Or(t,e,r,n,o,a,s){let i,p;try{let y=d.__wbindgen_add_to_stack_pointer(-16),b=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),w=B,k=P(n,d.__wbindgen_export_0,d.__wbindgen_export_1),v=B,O=P(a,d.__wbindgen_export_0,d.__wbindgen_export_1),A=B;d.resolve(y,b,w,e,r,k,v,o,O,A,s);var u=S().getInt32(y+0,!0),l=S().getInt32(y+4,!0),g=S().getInt32(y+8,!0),f=S().getInt32(y+12,!0),x=u,m=l;if(f)throw x=0,m=0,Z(g);return i=x,p=m,H(x,m)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(i,p,1);}}function Tr(t,e,r,n){let o,a;try{let f=d.__wbindgen_add_to_stack_pointer(-16),x=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),m=B,y=P(n,d.__wbindgen_export_0,d.__wbindgen_export_1),b=B;d.hover(f,x,m,e,r,y,b);var s=S().getInt32(f+0,!0),i=S().getInt32(f+4,!0),p=S().getInt32(f+8,!0),u=S().getInt32(f+12,!0),l=s,g=i;if(u)throw l=0,g=0,Z(p);return o=l,a=g,H(l,g)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(o,a,1);}}function Fr(t,e,r,n,o,a,s,i,p,u,l){let g,f;try{let v=d.__wbindgen_add_to_stack_pointer(-16),O=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),A=B,U=P(e,d.__wbindgen_export_0,d.__wbindgen_export_1),G=B,z=P(r,d.__wbindgen_export_0,d.__wbindgen_export_1),$=B,Q=P(n,d.__wbindgen_export_0,d.__wbindgen_export_1),mt=B,bt=P(u,d.__wbindgen_export_0,d.__wbindgen_export_1),xt=B,yt=P(l,d.__wbindgen_export_0,d.__wbindgen_export_1),wt=B;d.convert(v,O,A,U,G,z,$,Q,mt,o,a,s,i,p,bt,xt,yt,wt);var x=S().getInt32(v+0,!0),m=S().getInt32(v+4,!0),y=S().getInt32(v+8,!0),b=S().getInt32(v+12,!0),w=x,k=m;if(b)throw w=0,k=0,Z(y);return g=w,f=k,H(w,k)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(g,f,1);}}function Er(t,e,r,n,o,a){let s,i;try{let m=d.__wbindgen_add_to_stack_pointer(-16),y=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),b=B,w=P(e,d.__wbindgen_export_0,d.__wbindgen_export_1),k=B,v=P(r,d.__wbindgen_export_0,d.__wbindgen_export_1),O=B;d.canonicalize(m,y,b,w,k,v,O,n,o,a);var p=S().getInt32(m+0,!0),u=S().getInt32(m+4,!0),l=S().getInt32(m+8,!0),g=S().getInt32(m+12,!0),f=p,x=u;if(g)throw f=0,x=0,Z(l);return s=f,i=x,H(f,x)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(s,i,1);}}function Rr(t){let e,r;try{let u=d.__wbindgen_add_to_stack_pointer(-16),l=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),g=B;d.count_bits(u,l,g);var n=S().getInt32(u+0,!0),o=S().getInt32(u+4,!0),a=S().getInt32(u+8,!0),s=S().getInt32(u+12,!0),i=n,p=o;if(s)throw i=0,p=0,Z(a);return e=i,r=p,H(i,p)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(e,r,1);}}function Sr(t){let e,r;try{let a=d.__wbindgen_add_to_stack_pointer(-16),s=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),i=B;d.split_bits(a,s,i);var n=S().getInt32(a+0,!0),o=S().getInt32(a+4,!0);return e=n,r=o,H(n,o)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(e,r,1);}}function Br(t){let e=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),r=B;return d.is_bitmark(e,r)!==0}function Pr(t){let e,r;try{let u=d.__wbindgen_add_to_stack_pointer(-16),l=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),g=B;d.split_json_bits(u,l,g);var n=S().getInt32(u+0,!0),o=S().getInt32(u+4,!0),a=S().getInt32(u+8,!0),s=S().getInt32(u+12,!0),i=n,p=o;if(s)throw i=0,p=0,Z(a);return e=i,r=p,H(i,p)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(e,r,1);}}function Ar(t,e){let r,n;try{let s=d.__wbindgen_add_to_stack_pointer(-16),i=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),p=B;d.prettify(s,i,p,e);var o=S().getInt32(s+0,!0),a=S().getInt32(s+4,!0);return r=o,n=a,H(o,a)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(r,n,1);}}function jr(t,e,r,n){let o,a;try{let f=d.__wbindgen_add_to_stack_pointer(-16),x=P(t,d.__wbindgen_export_0,d.__wbindgen_export_1),m=B,y=P(e,d.__wbindgen_export_0,d.__wbindgen_export_1),b=B,w=P(r,d.__wbindgen_export_0,d.__wbindgen_export_1),k=B,v=P(n,d.__wbindgen_export_0,d.__wbindgen_export_1),O=B;d.convert_text(f,x,m,y,b,w,k,v,O);var s=S().getInt32(f+0,!0),i=S().getInt32(f+4,!0),p=S().getInt32(f+8,!0),u=S().getInt32(f+12,!0),l=s,g=i;if(u)throw l=0,g=0,Z(p);return o=l,a=g,H(l,g)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(o,a,1);}}async function Lr(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(n){if(t.headers.get("Content-Type")!="application/wasm")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",n);else throw n}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function Ee(){let t={};return t.wbg={},t.wbg.__wbindgen_error_new=function(e,r){let n=new Error(H(e,r));return gr(n)},t}function Re(t,e){return d=t.exports,Se.__wbindgen_wasm_module=e,ut=null,Ot=null,d}function Zt(t){if(d!==void 0)return d;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=Ee();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let r=new WebAssembly.Instance(t,e);return Re(r,t)}async function Se(t){if(d!==void 0)return d;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("bitmark_json_wasm_bg.wasm",import.meta.url));let e=Ee();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:n}=await Lr(await t,e);return Re(r,n)}var te=Se;var Ft={version:"7.3.0"};var ne="browser-full",Dt=class extends Error{constructor(){super("wasm not initialised: call init() (or init({ feature: \u2026 })) first"),this.name="NotInitializedError";}},lt=class extends Error{constructor(e){super(e),this.name="RegisterError";}},it=class extends Error{constructor(r){let n=r.map(o=>`${o.kind} at ${o.path}: ${o.message}`);super(`${r.length} patch ${r.length===1?"entry was":"entries were"} skipped:
2
+ `+n.join(`
3
+ `));C(this,"diagnostics");this.name="PatchError",this.diagnostics=r;}},st=class extends Error{constructor(e,r){super(`${e} is not available in the loaded wasm module${r?` (feature: "${r}")`:""}; init({ feature: "full" }) to load it`),this.name="UnsupportedFeatureError";}},Ct,Pe,Be,Ae=new Map;function D(){if(!Ct&&Be&&Be(),!Ct)throw new Dt;return Ct}function re(t,e){for(let[r,n]of Ae)try{e.register(r,n);}catch(o){throw new lt(o instanceof Error?o.message:String(o))}Ct=e,Pe=t;}function je(t,e){Ae.set(t,e);}function et(){return Pe}function Cr(t){let e=t.trim();return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):t}function Dr(t){return t===void 0?"":typeof t=="string"?t.trim():JSON.stringify(t)}function Wr(t,e,r){if(r){let o=JSON.parse(t.split_bits(e));return o.map(a=>({view:{format:"bitmark",index:a.index,total:o.length,source:a.source},source:a.source}))}let n=JSON.parse(t.split_json_bits(e));return n.map((o,a)=>({view:{format:"json",index:a,total:n.length,bit:o.bit??{}},source:JSON.stringify([o])}))}function oe(t,e,r){let n=r.mode??"optimized",o=r.outputFormat??"json",a=r.spacesAroundValues??1,s=r.indent??2,i=r.pretty??false,p=r.inputFormat??"auto",u=p==="bitmark"||p!=="json"&&t.is_bitmark(e),l=u?"bitmark":"json";t.transform("","bitmark",o,n,"",false,s,a);let g=Wr(t,e,u),f=g.length,x=[];for(let k=0;k<f;k++){let{view:v}=g[k];v.index=k,v.total=f;let O=r.preHook?r.preHook(v)||{}:{};x.push(O.drop?null:{patches:O.patches??[],outputFormat:O.outputFormat??o});}let m=Dr(r.patch),y;m===""?y=g.map((k,v)=>({source:v,bit:null,patch:[]})):y=JSON.parse(t.resolve_patch_document(e,l,m));let b=[],w=[];for(let k of y)if(k.source!==null){let v=x[k.source];if(!v)continue;b.push({index:k.source,source:g[k.source].source,inputFormat:l,outputFormat:v.outputFormat,mode:n,patchJson:JSON.stringify([...k.patch,...v.patches]),spacesAroundValues:a}),w.push(g[k.source].view);}else if(typeof k.bit=="string"){let v=b.length;b.push({index:v,source:k.bit,inputFormat:"bitmark",outputFormat:o,mode:n,patchJson:JSON.stringify(k.patch),spacesAroundValues:a}),w.push({format:"bitmark",index:v,total:f,source:k.bit});}else {let v=k.bit??{},O=b.length;b.push({index:O,source:JSON.stringify([{bit:v}]),inputFormat:"json",outputFormat:o,mode:n,patchJson:JSON.stringify(k.patch),spacesAroundValues:a}),w.push({format:"json",index:O,total:f,bit:v});}return {jobs:b,views:w,output:o,pretty:i,indent:s}}function Jr(t,e){let{data:r,diagnostics:n}=JSON.parse(t);return {element:e==="json"?Cr(r):r,diagnostics:n}}function Mr(t,e){return Jr(t.transform(e.source,e.inputFormat,e.outputFormat,e.mode,e.patchJson,false,2,e.spacesAroundValues),e.outputFormat)}function ie(t,e,r,n,o){if(r!=="json")return e.join(`
4
+ `);let a=`[${e.join(",")}]`;return n?t.prettify(a,o):a}function Le(t,e,r){let n=oe(t,e,r),o=[],a=[];for(let s=0;s<n.jobs.length;s++){let{element:i,diagnostics:p}=Mr(t,n.jobs[s]);a.push(...p),r.postHook?.(n.views[s],i),o.push(i);}if(a.length>0)throw new it(a);return ie(t,o,n.output,n.pretty,n.indent)}async function Ce(t,e,r,n){let o=oe(t,e,r),a=await n(o.jobs,r.workers??4),s=[],i=[];for(let p=0;p<a.length;p++)s.push(a[p].element),i.push(...a[p].diagnostics),r.postHook?.(o.views[p],a[p].element);if(i.length>0)throw new it(i);return ie(t,s,o.output,o.pretty,o.indent)}var se;function De(t){se=t;}function W(){if(!se)throw new Error("legacy API not initialised: the WASM module has not been provided (browser consumers must call init() first)");return se()}function We(t,e,r){if(t.length===0)return Promise.resolve([]);let n=Math.max(1,Math.min(e,t.length));return new Promise((o,a)=>{let s=new Array(t.length),i=0,p=0,u=false,l=[],g=x=>{if(!u){u=true;for(let m of l)m.terminate();x?a(x):o(s);}},f=x=>{if(u||i>=t.length)return;let m=i++;x.post({id:m,job:t[m]});};for(let x=0;x<n;x++){let m=r(y=>{if(!u){if(!y.ok)return g(new Error(y.error??"worker job failed"));s[y.id]={element:y.element,diagnostics:y.diagnostics??[]},++p===t.length?g():f(m);}},g);l.push(m);}for(let x of l)f(x);})}function Je(t,e,r){let n=new URL("./worker-entry.js",import.meta.url);return We(t,e,(o,a)=>{let s=new Worker(n,{type:"module"});return s.onmessage=i=>o(i.data),s.onerror=i=>a(new Error(i.message||"worker error")),{post:i=>s.postMessage({...i,feature:r}),terminate:()=>s.terminate()}})}var ln={};Rt(ln,{Ast:()=>Qe,BitType:()=>Ke,BitmarkFileGenerator:()=>en,BitmarkGenerator:()=>Ze,BitmarkParser:()=>pn,BitmarkParserGenerator:()=>Ut,BitmarkParserType:()=>Xr,BitmarkStringGenerator:()=>tn,BitmarkVersion:()=>qr,BodyTextFormat:()=>to,BoundingBoxIndex:()=>Xe,Builder:()=>Ht,CardSetVersion:()=>Yr,FileWriter:()=>un,HtmlTableGenerator:()=>sn,HtmlTableParser:()=>an,InfoFormat:()=>Zr,InfoType:()=>Qr,Input:()=>zr,InputFormat:()=>Kr,JsonFileGenerator:()=>on,JsonGenerator:()=>nn,JsonParser:()=>cn,JsonStringGenerator:()=>rn,LegacyUnsupportedError:()=>gt,NodeType:()=>Ye,Output:()=>$r,ResourceBuilder:()=>Gt,StreamWriter:()=>dn,StringWriter:()=>_n,TextLocation:()=>eo,TextMarkType:()=>ze,TextNodeType:()=>$e,bitmarkTextParse:()=>Ue,isPseudoAst:()=>Ne});var gt=class extends Error{constructor(e){super(e),this.name="LegacyUnsupportedError";}};function pt(t,e){throw new gt(`'${t}' is not supported by the @gmb/bitmark-parser legacy API`+(e?`: ${e}`:""))}function tt(t,e){throw new gt(`Option '${t}' is not supported by the @gmb/bitmark-parser legacy API`+(e?`: ${e}`:""))}var ae="bitmark v2 output is not supported (this parser is bitmark v3 only)";function pe(t){t.bitmarkVersion===2&&tt("bitmarkVersion: 2",ae);}function Jt(t){t.explicitTextFormat&&tt("bitmarkOptions.explicitTextFormat"),t.cardSetVersion===1&&tt("bitmarkOptions.cardSetVersion: 1",ae),t.debugGenerationInline&&tt("bitmarkOptions.debugGenerationInline"),t.noBreakscaping&&tt("bitmarkOptions.noBreakscaping");}function Mt(t){t.textAsPlainText&&tt("jsonOptions.textAsPlainText",ae),t.debugGenerationInline&&tt("jsonOptions.debugGenerationInline");}function dt(t){return t===true?{pretty:true,indent:2}:typeof t=="number"&&t>0?{pretty:true,indent:t}:{pretty:false,indent:2}}function Nt(t){return t===void 0||t===true?1:t===false?0:Math.max(0,Math.min(10,t))}function Vt(t){switch(t){case "text":case "latex":case "json":case "xml":return "plainText";default:return "bitmark++"}}var Me=Symbol.for("@gmb/bitmark-parser/legacy-pseudo-ast");function ft(t){let e={bits:t};return Object.defineProperty(e,Me,{value:true,enumerable:false}),e}function Ne(t){return t!==null&&typeof t=="object"&&(Me in t||Array.isArray(t.bits))}var Ve={"extractor-image":{key:"images",resourceType:"image"},"extractor-image-collapsible":{key:"images",resourceType:"image"},"images-logo-grave":{key:"logos",resourceType:"image"},"prototype-images":{key:"images",resourceType:"image"}};var ce=Symbol.for("@gmb/bitmark-parser/legacy-built-bit-parser"),Vr={bitType:"type",textFormat:"format",flashcards:"cards",markConfig:"marks"},Hr={"bitmark--":"bitmark++","bitmark+":"bitmark++"},Ur={bitmark:"bitmark++",text:"text",json:"json",latex:"latex",xml:"xml"},Gr=["title","subtitle","item","lead","pageNumber","marginNumber","hint","instruction","caption"],Ht=class{buildBitmark(e){let r=ft(e.bits??[]);return e.errors!==void 0&&(r.errors=e.errors),r}buildBit(e,r){let n=W(),o={...e},a=o.bitType,s=this.getBitConfig(a),i={};i.type=a,o.isCommented&&(i.type="_comment",i.originalType=a),delete o.bitType,delete o.isCommented;let p=o.textFormat;p!==void 0?(i.format=Hr[p]??p,delete o.textFormat):i.format=Ur[s.bodyFormat??""]??"bitmark++",delete o.resourceType;let u=o.body;u!=null&&typeof u=="object"&&"body"in u&&(i.body=u.body,delete o.body),o.example!==void 0?(i.isExample=true,i.example=o.example,delete o.example,delete o.__isDefaultExample):o.__isDefaultExample&&(i.isExample=true,delete o.__isDefaultExample);let l=o.resources;if(l!==void 0&&a!==void 0){let b=Array.isArray(l)?l:[l],w=Ve[a];w?i[w.key]=b.filter(k=>k!==null&&typeof k=="object"&&k.type===w.resourceType):b.length>=1&&(i.resource=b[0]),delete o.resources;}let g=o.parser;delete o.parser;let f=o.extraProperties;delete o.extraProperties;for(let[b,w]of Object.entries(o))w!==void 0&&(i[Vr[b]??b]=w);if(f)for(let[b,w]of Object.entries(f))b in i||(i[b]=w);this.parseStringTexts(i);let x=n.convert(JSON.stringify([{bit:i}]),"json","json","optimized",false,2,1,false,false,"",""),y=JSON.parse(x)[0]?.bit??i;for(let[b,w]of Object.entries(i))b in y||w===false||w===""||w===null||Array.isArray(w)&&w.length===0||(y[b]=w);return g!==void 0&&Object.defineProperty(y,ce,{value:g,enumerable:false}),y}buildHighlight(e,r){if(!r)return;let n={...r},o=n.attrs;return o&&Object.assign(n,o),{type:"highlight",texts:Array.isArray(n.texts)?n.texts.filter(i=>i!=null).map(i=>({text:i.text??"",isCorrect:i.isCorrect??false,isHighlighted:i.isHighlighted??false,...He(i,["text","isCorrect","isHighlighted"])})):[],prefix:n.prefix??"",postfix:n.postfix??"",...He(n,["type","texts","prefix","postfix","attrs"]),attrs:{}}}parseStringTexts(e){let r=W(),n=(s,i)=>{if(s==="")return s;let p=r.convert_text(s,"textToAst","bitmark++",i);try{return JSON.parse(p)}catch{return s}},o=e.format,a=o===void 0||o==="bitmark++"||o==="bitmark+";if(typeof e.body=="string")if(o==="json")try{e.body=JSON.parse(e.body);}catch{e.body=null;}else a&&(e.body=n(e.body,"body"));for(let s of Gr){let i=e[s];typeof i=="string"&&(e[s]=n(i,"tag"));}}getBitConfig(e){let r=W();if(e!==void 0)try{let n=JSON.parse(r.info("bit","json",e,!1,2,!1,!1,!0,""));if(n.error===void 0)return {bodyFormat:n.body?.format}}catch{}throw new Error(`No config found for bit: ${e}`)}};function He(t,e){let r={};for(let[n,o]of Object.entries(t))o!==void 0&&!e.includes(n)&&(r[n]=o);return r}var Ut=class{version(){return Ft.version}convert(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),a=Object.assign({},n.bitmarkOptions);pe(n),Jt(a),Mt(o),this.checkBrowserFileWrite(n.outputFile);let s=W(),{source:i,isBitmark:p}=this.resolveInput(e,n.inputFormat),u=n.outputFormat??(p?"json":"bitmark"),l=u==="ast"?"json":u,{pretty:g,indent:f}=dt(o.prettify),x=l==="bitmark"?dt(a.prettifyJson):{pretty:g,indent:f},m=Nt(a.spacesAroundValues),y=!o.excludeUnknownProperties,b=s.convert(i,p?"bitmark":"json",l,"optimized",x.pretty,x.indent,m,y,false,"","");if(u==="bitmark"||u==="text")return this.deliver(b,n.outputFile,n.fileOptions);if(u==="json")return n.outputFile?this.deliver(b,n.outputFile,n.fileOptions):g||o.stringify?b:JSON.parse(b);let w=ft(JSON.parse(b));return n.outputFile?this.deliver(JSON.stringify(w),n.outputFile,n.fileOptions):w}upgrade(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),a=Object.assign({},n.bitmarkOptions);pe(n),Jt(a),Mt(o),this.checkBrowserFileWrite(n.outputFile);let s=W(),{source:i,isBitmark:p}=this.resolveInput(e,n.inputFormat),{pretty:u,indent:l}=dt(p?a.prettifyJson:o.prettify),g=Nt(a.spacesAroundValues),f=s.canonicalize(i,p?"bitmark":"json","optimized",u,l,g);return p?this.deliver(f,n.outputFile,n.fileOptions):n.outputFile?this.deliver(f,n.outputFile,n.fileOptions):u||o.stringify?f:JSON.parse(f)}info(e){let r=Object.assign({},e),n=W(),o=r.type??"list",a=r.outputFormat??"text",{pretty:s,indent:i}=dt(r.prettify),p=a==="pojo"?"json":a,u=n.info(o,p,r.bit??"",s,i,false,false,true,"");return a==="pojo"?JSON.parse(u):u}generateConfig(e){pt("BitmarkParserGenerator.generateConfig","bpg-internal development tool");}convertHtmlTable(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),a=Object.assign({},n.bitmarkOptions);Jt(a),Mt(o),n.keepUnknownTags&&tt("keepUnknownTags"),n.noBreakscaping&&tt("noBreakscaping"),this.checkBrowserFileWrite(n.outputFile);let s=W(),i=typeof e=="string"?this.maybeReadFile(e,void 0):"";if(!(n.inputFormat==="html"||n.inputFormat===void 0&&typeof e=="string"&&/<table[\s>]/iu.test(i))){let{source:k,isBitmark:v}=this.resolveInput(e,void 0),O=s.convert(k,v?"bitmark":"json","html","optimized",false,2,1,false,false,"","");return this.deliver(_e(O).join(`
5
+ `),n.outputFile,n.fileOptions)}let u=n.tableFormat==="table"?"table":"table-extended",l=_e(i).map(k=>`<bitmark-bit data-type="${u}" data-format="bitmark++">${k}</bitmark-bit>`).join(""),g=n.outputFormat??"bitmark",{pretty:f,indent:x}=dt(o.prettify),m=Nt(a.spacesAroundValues);if(g==="html"){let k=s.convert(l,"html","html","optimized",false,2,1,false,false,"","");return this.deliver(_e(k).join(`
6
+ `),n.outputFile,n.fileOptions)}let y=g==="ast"?"json":g,b=s.convert(l,"html",y,"optimized",f,x,m,false,false,"","");if(g==="bitmark"||g==="text")return this.deliver(b,n.outputFile,n.fileOptions);if(g==="json")return n.outputFile?this.deliver(b,n.outputFile,n.fileOptions):f||o.stringify?b:JSON.parse(b);let w=ft(JSON.parse(b));return n.outputFile?this.deliver(JSON.stringify(w),n.outputFile,n.fileOptions):w}createAst(e,r){let n=Object.assign({},r),o=W(),{source:a,isBitmark:s}=this.resolveInput(e,n.inputFormat),i=o.convert(a,s?"bitmark":"json","json","optimized",false,2,1,true,false,"","");return ft(JSON.parse(i))}breakscapeText(e,r){if(!e)return e;let n=Object.assign({},r);this.checkBrowserFileWrite(n.outputFile);let o=W(),a=this.maybeReadFile(e,n.inputFormat),s=o.breakscape_text(a,Vt(n.textFormat),n.textLocation??"body");return this.deliver(s,n.outputFile,n.fileOptions)}unbreakscapeText(e,r){if(!e)return e;let n=Object.assign({},r);this.checkBrowserFileWrite(n.outputFile);let o=W(),a=this.maybeReadFile(e,n.inputFormat),s=o.unbreakscape_text(a,Vt(n.textFormat),n.textLocation??"body");return this.deliver(s,n.outputFile,n.fileOptions)}convertText(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions);this.checkBrowserFileWrite(n.outputFile);let a=W(),s=n.textFormat===void 0||Vt(n.textFormat)==="bitmark++",i=n.textLocation??"body",p,u;if(typeof e=="string"?(p=this.maybeReadFile(e,n.inputFormat),u=this.parseTextAstString(p)):(p=JSON.stringify(e),u=Array.isArray(e)?e:void 0),u!==void 0){let m=s?a.convert_text(JSON.stringify(u),"astToText","bitmark++",i):a.convert_text(JSON.stringify(u),"astToPlainText","plainText",i);return this.deliver(m,n.outputFile,n.fileOptions)}let l=a.convert_text(p,"textToAst",s?"bitmark++":"plainText","body"),{pretty:g,indent:f}=dt(o.prettify),x=g?a.prettify(l,f):l;return n.outputFile?this.deliver(x,n.outputFile,n.fileOptions):g?x:JSON.parse(l)}textAstToPlainText(e,r){return W().convert_text(typeof e=="string"?e:JSON.stringify(e),"astToPlainText","bitmark++","body")}extractPlainText(e,r){let n=r?.inputFormat,o=W();if(n==="plainText")return typeof e=="string"?String(e):"";if(n==="bitmarkText"){let p=o.convert_text(String(e),"textToAst","bitmark++","body");return o.convert_text(p,"astToPlainText","bitmark++","body")}if(typeof e=="string"&&this.parseTextAstString(e)===void 0&&!o.is_bitmark(e)&&!(()=>{try{return JSON.parse(e),!0}catch{return false}})())return this.extractPlainText(e,{inputFormat:"bitmarkText"});let{source:a,isBitmark:s}=this.resolveInput(e,void 0);return o.convert(a,s?"bitmark":"json","text","optimized",false,2,1,false,false,"","")}parseTextAstString(e){let r=e.trim();if(r.startsWith("["))try{let n=JSON.parse(r);if(Array.isArray(n)&&n.every(o=>o!==null&&typeof o=="object"&&"type"in o))return n}catch{}}resolveInput(e,r){if(typeof e!="string"){let a=this.jsonEntries(e);return {source:JSON.stringify(a?a.map(s=>this.toWrapperEntry(s)):e),isBitmark:false}}let n=this.maybeReadFile(e,r);if(W().is_bitmark(n))return {source:n,isBitmark:true};try{let a=JSON.parse(n),s=this.jsonEntries(a);if(s)return {source:JSON.stringify(s.map(i=>this.toWrapperEntry(i))),isBitmark:!1}}catch{return {source:n,isBitmark:true}}return {source:n,isBitmark:false}}jsonEntries(e){if(Array.isArray(e))return e;if(e!==null&&typeof e=="object"){let r=e;if(Array.isArray(r.bits))return r.bits;if("bit"in r)return [r];if(typeof r.type=="string")return [{bit:r}]}}toWrapperEntry(e){if(e!==null&&typeof e=="object"&&"bit"in e)return e;let r={bit:e},n=e?.[ce];return n!==void 0&&(r.parser=n),r}maybeReadFile(e,r){if(r==="string")return e;return e;}checkBrowserFileWrite(e){if(e&&true)throw new Error("Cannot write to file in browser environment")}deliver(e,r,n){if(!r)return e;throw new Error("Cannot write to file in browser environment");}};function _e(t){let e=[],r=t.toLowerCase(),n=0;for(;;){let o=r.indexOf("<table",n);if(o===-1)break;let a=0,s=o,i=-1;for(;s<t.length;){let p=r.indexOf("<table",s),u=r.indexOf("</table",s);if(u===-1)break;if(p!==-1&&p<u)a++,s=p+6;else {a--;let l=r.indexOf(">",u);if(s=l===-1?t.length:l+1,a===0){i=s;break}}}if(i===-1)break;e.push(t.slice(o,i)),n=i;}return e}function Ue(t){let e=W().convert_text(t,"textToAst","bitmark++","body");return JSON.parse(e)}var M={imageResource:{type:"image",key:"image",valueField:"src"},imageLinkResource:{type:"image-link",key:"imageLink",valueField:"url"},audioResource:{type:"audio",key:"audio",valueField:"src"},audioEmbedResource:{type:"audio-embed",key:"audioEmbed",valueField:"src"},audioLinkResource:{type:"audio-link",key:"audioLink",valueField:"url"},videoResource:{type:"video",key:"video",valueField:"src"},videoEmbedResource:{type:"video-embed",key:"videoEmbed",valueField:"url"},videoLinkResource:{type:"video-link",key:"videoLink",valueField:"url"},stillImageFilmEmbedResource:{type:"still-image-film-embed",key:"stillImageFilmEmbed",valueField:"url"},stillImageFilmLinkResource:{type:"still-image-film-link",key:"stillImageFilmLink",valueField:"url"},articleResource:{type:"article",key:"article",valueField:"body"},documentResource:{type:"document",key:"document",valueField:"url"},documentEmbedResource:{type:"document-embed",key:"documentEmbed",valueField:"url"},documentLinkResource:{type:"document-link",key:"documentLink",valueField:"url"},documentDownloadResource:{type:"document-download",key:"documentDownload",valueField:"url"},appLinkResource:{type:"app-link",key:"appLink",valueField:"url"},websiteLinkResource:{type:"website-link",key:"websiteLink",valueField:"url"}};function J(t){return (e,r,n)=>{if(!r)return;let{value:o,...a}=r,s={[t.valueField]:o??""};for(let[i,p]of Object.entries(a))p!==void 0&&(s[i]=p);return {type:t.type,[t.key]:s}}}var Ge=Object.fromEntries(Object.values(M).map(t=>[t.type,t])),Gt=class{constructor(){C(this,"imageResource",J(M.imageResource));C(this,"imageLinkResource",J(M.imageLinkResource));C(this,"audioResource",J(M.audioResource));C(this,"audioEmbedResource",J(M.audioEmbedResource));C(this,"audioLinkResource",J(M.audioLinkResource));C(this,"videoResource",J(M.videoResource));C(this,"videoEmbedResource",J(M.videoEmbedResource));C(this,"videoLinkResource",J(M.videoLinkResource));C(this,"stillImageFilmEmbedResource",J(M.stillImageFilmEmbedResource));C(this,"stillImageFilmLinkResource",J(M.stillImageFilmLinkResource));C(this,"articleResource",J(M.articleResource));C(this,"documentResource",J(M.documentResource));C(this,"documentEmbedResource",J(M.documentEmbedResource));C(this,"documentLinkResource",J(M.documentLinkResource));C(this,"documentDownloadResource",J(M.documentDownloadResource));C(this,"appLinkResource",J(M.appLinkResource));C(this,"websiteLinkResource",J(M.websiteLinkResource));}resourceFromResourceJson(e,r){if(!r)return;let n=!Array.isArray(r),o=n?[r]:r,a=[];for(let s of o){let i=Ge[s.type];if(!i)continue;let p=s[i.key]??{},{[i.valueField]:u,...l}=p,g=J(i)(void 0,{value:u,...l});g&&a.push(g);}if(a.length!==0)return n?a[0]:a}resourceFromResourceDataJson(e,r,n){if(!n)return;let o=Ge[r];if(!o)return;let a=typeof n=="string"?n:void 0,s=typeof n=="object"?n:{},{url:i,src:p,body:u,...l}=s,g=i??p??u??a;return J(o)(e,{value:g,...l})}};var zr={string:"string",file:"file"},$r={bitmark:"bitmark",json:"json",ast:"ast",text:"text"},Kr={bitmark:"bitmark",bitmarkText:"bitmarkText",plainText:"plainText",html:"html"},qr={v2:2,v3:3},Yr={v1:1,v2:2},Xr={peggy:"peggy"},Qr={list:"list",deprecated:"deprecated",all:"all",bit:"bit"},Zr={text:"text",json:"json",pojo:"pojo"},to={plainText:"text",latex:"latex",json:"json",xml:"xml",bitmarkPlusPlus:"bitmark++"},eo={tag:"tag",body:"body",cardBody:"cardBody"};var ze={bold:"bold",light:"light",italic:"italic",highlight:"highlight",highlightOrange:"highlightOrange",highlightYellow:"highlightYellow",highlightGreen:"highlightGreen",highlightBlue:"highlightBlue",highlightPurple:"highlightPurple",highlightPink:"highlightPink",highlightBrown:"highlightBrown",highlightBlack:"highlightBlack",highlightWhite:"highlightWhite",highlightGray:"highlightGray",strike:"strike",subscript:"subscript",superscript:"superscript",ins:"ins",del:"del",underline:"underline",doubleUnderline:"doubleUnderline",circle:"circle",languageEmRed:"languageEmRed",languageEmOrange:"languageEmOrange",languageEmYellow:"languageEmYellow",languageEmGreen:"languageEmGreen",languageEmBlue:"languageEmBlue",languageEmPurple:"languageEmPurple",languageEmPink:"languageEmPink",languageEmBrown:"languageEmBrown",languageEmBlack:"languageEmBlack",languageEmWhite:"languageEmWhite",languageEmGray:"languageEmGray",languageEm:"languageEm",userUnderline:"userUnderline",userDoubleUnderline:"userDoubleUnderline",userStrike:"userStrike",userCircle:"userCircle",userHighlight:"userHighlight",notranslate:"notranslate",link:"link",ref:"ref",xref:"xref",extref:"extref",footnote:"footnote",footnoteStar:"footnote*",symbol:"symbol",var:"var",code:"code",timer:"timer",duration:"duration",color:"color",colorPicker:"colorPicker",comment:"comment"},$e={text:"text",hardBreak:"hardBreak",paragraph:"paragraph",heading:"heading",section:"section",noBulletList:"noBulletList",bulletList:"bulletList",orderedList:"orderedList",orderedListRoman:"orderedListRoman",orderedListRomanLower:"orderedListRomanLower",letteredList:"letteredList",letteredListLower:"letteredListLower",taskList:"taskList",listItem:"listItem",taskItem:"taskItem",image:"image",imageInline:"imageInline",codeBlock:"codeBlock",latex:"latex",gap:"gap",select:"select",highlight:"highlight",mark:"mark"};function no(t){return t.replace(/-([a-z0-9])/gu,(e,r)=>r.toUpperCase())}var ue;function Et(){if(!ue){let t=W(),e=JSON.parse(t.info("all","json","",false,2,true,false,false,"")),r={_standard:"_standard"};for(let{name:n}of e)r[no(n)]=n;ue=r;}return ue}var Ke=new Proxy({},{get:(t,e)=>typeof e=="string"?Et()[e]:void 0,has:(t,e)=>typeof e=="string"&&e in Et(),ownKeys:()=>Reflect.ownKeys(Et()),getOwnPropertyDescriptor:(t,e)=>typeof e=="string"&&e in Et()?{value:Et()[e],enumerable:true,configurable:true,writable:false}:void 0});function qe(t,e){return new Proxy({},{get:(r,n)=>n===Symbol.toPrimitive||n==="toString"||n===Symbol.toStringTag?()=>`[unsupported ${t}]`:pt(t,e),has:()=>pt(t,e),ownKeys:()=>pt(t,e)})}var Ye=qe("NodeType","it names bpg's internal AST nodes; the legacy AST is bit JSON (see createAst)"),Xe=qe("BoundingBoxIndex","bpg-internal bounding-box utility");function K(t,e){return class{constructor(){pt(t,e);}}}var ro="the legacy AST is bit JSON, not bpg's internal node model; walking it with bpg NodeType names would silently misbehave",q="internal class of bpg's TS implementation",Qe=K("Ast",ro),Ze=K("BitmarkGenerator",q),tn=K("BitmarkStringGenerator",q),en=K("BitmarkFileGenerator",q),nn=K("JsonGenerator",q),rn=K("JsonStringGenerator",q),on=K("JsonFileGenerator",q),sn=K("HtmlTableGenerator",q),an=K("HtmlTableParser",q),pn=K("BitmarkParser",q),cn=K("JsonParser",q),_n=K("StringWriter",q),un=K("FileWriter",q),dn=K("StreamWriter",q);var gn={Error:1,Warning:2,Information:3,Hint:4},fn={Class:7,Property:10,Value:12,Keyword:14,Snippet:15,EnumMember:20,TypeParameter:25},mn={Deprecated:1};function oo(t,e,r){return r===void 0?{path:t,op:e}:{path:t,op:e,value:r}}var io="all";function so(t,e={}){let r=D().convert(t,"bitmark","json",e.mode??"optimized",false,2,1,e.includeUnknownProperties??false,false,"","");return JSON.parse(r)}function ao(t,e={}){let r=t.map(o=>o!==null&&typeof o=="object"&&"bit"in o&&typeof o.bit=="object"?o:{bit:o});return D().convert(JSON.stringify(r),"json","bitmark",e.mode??"optimized",false,2,1,false,false,"","")}function de(t,e={}){return D().convert(t,e.inputFormat??"auto",e.outputFormat??"auto",e.mode??"optimized",e.pretty??false,e.indent??2,e.spacesAroundValues??1,e.includeUnknownProperties??false,e.mappingReport??false,e.positionEncoding??"",e.tokensLayout??"")}function po(t,e={}){return JSON.parse(de(t,{inputFormat:"bitmark",outputFormat:"semantic-tokens",positionEncoding:e.positionEncoding,tokensLayout:e.tokensLayout}))}function co(t,e={}){return JSON.parse(de(t,{inputFormat:"bitmark",outputFormat:"diagnostics",positionEncoding:e.positionEncoding}))}function _o(t,e,r={}){let n=D();if(typeof n.complete!="function")throw new st("complete",et());return JSON.parse(n.complete(t,e.line,e.character,r.positionEncoding??"",r.includeDeprecated??false,r.triggerCharacter??""))}function uo(t,e,r,n={}){let o=D();if(typeof o.resolve!="function")throw new st("resolve",et());return JSON.parse(o.resolve(t,e.line,e.character,n.positionEncoding??"",n.includeDeprecated??false,r.label,r.kind))??r}function lo(t,e,r={}){let n=D();if(typeof n.hover!="function")throw new st("hover",et());return JSON.parse(n.hover(t,e.line,e.character,r.positionEncoding??""))}function go(t,e={}){return D().canonicalize(t,e.inputFormat??"auto",e.mode??"optimized",e.pretty??false,e.indent??2,e.spacesAroundValues??1)}function fo(t){return Number.parseInt(D().count_bits(t),10)}function mo(t){return JSON.parse(D().split_bits(t))}function bo(t,e={}){let r=D();if(e.preHook||e.postHook)return Le(r,t,e);let n=e.patch===void 0?"":typeof e.patch=="string"?e.patch:JSON.stringify(e.patch),{data:o,diagnostics:a}=JSON.parse(r.transform(t,e.inputFormat??"auto",e.outputFormat??"json",e.mode??"optimized",n,e.pretty??false,e.indent??2,e.spacesAroundValues??1));if(a.length>0)throw new it(a);return o}function bn(t,e,r={}){let n=D();if(typeof n.diff!="function")throw new st("diff",et());return n.diff(t,e,r.inputFormat??"auto",r.outputFormat??"bitmark",r.context??3,r.locate??false,r.similarity??.6,r.bboxTolerance??8,r.spacesAroundValues??0)}function xo(t,e,r={}){return JSON.parse(bn(t,e,{...r,outputFormat:"json"}))}function yo(t,e={}){let r=e.format??"bitmark++",n=e.location??"body",o=e.subLocation??"text";return D().breakscape_text(t,r,n,o)}function wo(t,e={}){let r=e.format??"bitmark++",n=e.location??"body",o=e.subLocation??"text";return D().unbreakscape_text(t,r,n,o)}function ko(t={}){let e=t.infoType??"list",r=t.format??"text",n=t.bit??"",o=t.pretty??false,a=t.indent??2,s=t.includeDeprecated??false,i=t.onlyDeprecated??false,p=t.full??false,u=typeof t.language=="string"?t.language:t.language?.join(",")??"",l=D();if(r!=="json"&&typeof l.info_text_supported!="function")throw new st('info (format: "text")',et());return l.info(e,r,n,o,a,s,i,p,u)}function vo(t){try{D().register(t.type,t.data);}catch(e){throw new lt(e instanceof Error?e.message:String(e))}je(t.type,t.data);}var ho="./wasm/",xn={full:{init:Kt,initSync:$t,ns:qt,wasmFile:"bitmark_wasm_bg.wasm"},"browser-full":{init:Xt,initSync:Yt,ns:Qt,wasmFile:"bitmark_browser_full_wasm_bg.wasm"},"bitmark-json":{init:te,initSync:Zt,ns:ee,wasmFile:"bitmark_json_wasm_bg.wasm"}};De(()=>D());function le(t){return t===void 0?ne:"full"}function Io(t){if(t===null||typeof t!="object")return false;if("feature"in t||"module_or_path"in t)return true;let e=Object.getPrototypeOf(t);return (e===Object.prototype||e===null)&&Object.keys(t).length===0}function Oo(t){if(Io(t))return {feature:t.feature??le(t.module_or_path),module_or_path:t.module_or_path};let e=t??void 0;return {feature:le(e),module_or_path:e}}var ge=0,zt,at;async function ns(t){let{feature:e,module_or_path:r}=Oo(t);if(r===void 0){if(!at&&et()===e)return zt;if(at?.feature===e)return at.promise}let n=++ge,o=xn[e],a=r??new URL(`${ho}${o.wasmFile}?v=${Ft.version}`,import.meta.url),s=(async()=>{try{let i=await o.init({module_or_path:a});n===ge&&(re(e,o.ns),zt=i);}finally{at?.seq===n&&(at=void 0);}for(;at;)await at.promise.catch(()=>{});return zt})();return at={feature:e,seq:n,promise:s},s}function rs(t,e={}){let r=e.feature??le(t),n=xn[r],o=n.initSync({module:t});return ++ge,at=void 0,re(r,n.ns),zt=o,o}function os(){return Ft.version}function is(t,e={}){let r=D(),n=et()??ne;return Ce(r,t,e,(o,a)=>Je(o,a,n))}export{io as ALL_LANGUAGES,fn as CompletionItemKind,mn as CompletionItemTag,gn as DiagnosticSeverity,Dt as NotInitializedError,it as PatchError,lt as RegisterError,st as UnsupportedFeatureError,so as bitmarkToObjects,yo as breakscapeText,go as canonicalize,_o as complete,de as convert,fo as countBits,co as diagnostics,bn as diff,xo as diffBits,lo as hover,ko as info,ns as init,rs as initSync,ln as legacy,ao as objectsToBitmark,oo as patchEntry,vo as register,uo as resolve,po as semanticTokens,mo as splitBits,bo as transform,is as transformParallel,wo as unbreakscapeText,et as variant,os as version};//# sourceMappingURL=bitmark-parser.min.js.map
5
7
  //# sourceMappingURL=bitmark-parser.min.js.map