@gmb/bitmark-parser 7.7.0 → 7.9.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 (45) hide show
  1. package/README.md +99 -21
  2. package/config/bitmark.json +532 -209
  3. package/dist/browser/bitmark-parser.min.js +6 -6
  4. package/dist/browser/bitmark-parser.min.js.map +1 -1
  5. package/dist/browser/cjs/index.cjs +533 -275
  6. package/dist/browser/cjs/index.cjs.map +1 -1
  7. package/dist/browser/cjs/index.d.cts +103 -22
  8. package/dist/browser/esm/index.d.ts +103 -22
  9. package/dist/browser/esm/index.js +532 -275
  10. package/dist/browser/esm/index.js.map +1 -1
  11. package/dist/browser/esm/worker-entry.js +494 -264
  12. package/dist/browser/esm/worker-entry.js.map +1 -1
  13. package/dist/browser/wasm/bitmark_browser_full_wasm_bg.wasm +0 -0
  14. package/dist/browser/wasm/bitmark_json_wasm_bg.wasm +0 -0
  15. package/dist/browser/wasm/bitmark_wasm_bg.wasm +0 -0
  16. package/dist/index.cjs +43 -8
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +92 -20
  19. package/dist/index.d.ts +92 -20
  20. package/dist/index.js +42 -8
  21. package/dist/index.js.map +1 -1
  22. package/dist/legacy.cjs +19 -11
  23. package/dist/legacy.cjs.map +1 -1
  24. package/dist/legacy.d.cts +3 -1
  25. package/dist/legacy.d.ts +3 -1
  26. package/dist/legacy.js +19 -11
  27. package/dist/legacy.js.map +1 -1
  28. package/dist/worker-entry.cjs.map +1 -1
  29. package/package.json +7 -7
  30. package/schema/bitmark.schema.json +1 -1
  31. package/wasm/bitmark_wasm.d.ts +52 -30
  32. package/wasm/bitmark_wasm.js +209 -113
  33. package/wasm/bitmark_wasm_bg.wasm +0 -0
  34. package/wasm/bitmark_wasm_bg.wasm.d.ts +5 -2
  35. package/wasm/package.json +1 -1
  36. package/wasm-bitmark-json/bitmark_json_wasm.d.ts +73 -51
  37. package/wasm-bitmark-json/bitmark_json_wasm.js +257 -161
  38. package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
  39. package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +5 -2
  40. package/wasm-bitmark-json/package.json +1 -1
  41. package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +52 -30
  42. package/wasm-browser-full/bitmark_browser_full_wasm.js +209 -113
  43. package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm +0 -0
  44. package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm.d.ts +5 -2
  45. package/wasm-browser-full/package.json +1 -1
@@ -1,7 +1,7 @@
1
- var ke=Object.defineProperty;var Rn=(e,t,n)=>t in e?ke(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n;var Pt=(e,t)=>{for(var n in t)ke(e,n,{get:t[n],enumerable:true});};var M=(e,t,n)=>Rn(e,typeof t!="symbol"?t+"":t,n);var ee={};Pt(ee,{ConvertDetails:()=>Lt,breakscape_text:()=>Bn,canonicalize:()=>Hn,complete:()=>Mn,convert:()=>Xn,convert_text:()=>Yn,convert_with_details:()=>Qn,count_bits:()=>Gn,default:()=>te,diff:()=>Jn,hover:()=>Vn,info:()=>An,info_text_supported:()=>jn,initSync:()=>Zt,is_bitmark:()=>$n,prettify:()=>qn,register:()=>Un,resolve:()=>Nn,resolve_patch_document:()=>Wn,split_bits:()=>zn,split_json_bits:()=>Kn,transform:()=>Dn,unbreakscape_text:()=>Pn});var _,he=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&he.decode();var kt=null;function At(){return (kt===null||kt.byteLength===0)&&(kt=new Uint8Array(_.memory.buffer)),kt}function N(e,t){return e=e>>>0,he.decode(At().subarray(e,e+t))}var rt=new Array(128).fill(void 0);rt.push(void 0,null,true,false);var ht=rt.length;function En(e){ht===rt.length&&rt.push(rt.length+1);let t=ht;return ht=rt[t],rt[t]=e,t}var O=0,jt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Sn=typeof jt.encodeInto=="function"?function(e,t){return jt.encodeInto(e,t)}:function(e,t){let n=jt.encode(e);return t.set(n),{read:e.length,written:n.length}};function E(e,t,n){if(n===void 0){let i=jt.encode(e),d=t(i.length,1)>>>0;return At().subarray(d,d+i.length).set(i),O=i.length,d}let r=e.length,o=t(r,1)>>>0,a=At(),s=0;for(;s<r;s++){let i=e.charCodeAt(s);if(i>127)break;a[o+s]=i;}if(s!==r){s!==0&&(e=e.slice(s)),o=n(o,r,r=s+e.length*3,1)>>>0;let i=At().subarray(o+s,o+r),d=Sn(e,i);s+=d.written,o=n(o,r,s,1)>>>0;}return O=s,o}function Ie(e){return e==null}var ct=null;function h(){return (ct===null||ct.buffer.detached===true||ct.buffer.detached===void 0&&ct.buffer!==_.memory.buffer)&&(ct=new DataView(_.memory.buffer)),ct}function Bn(e,t,n,r){let o,a;try{let g=_.__wbindgen_add_to_stack_pointer(-16),l=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),f=O,x=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),b=O,m=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),w=O;var s=Ie(r)?0:E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),i=O;_.breakscape_text(g,l,f,x,b,m,w,s,i);var d=h().getInt32(g+0,!0),u=h().getInt32(g+4,!0);return o=d,a=u,N(d,u)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(o,a,1);}}function Pn(e,t,n,r){let o,a;try{let g=_.__wbindgen_add_to_stack_pointer(-16),l=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),f=O,x=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),b=O,m=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),w=O;var s=Ie(r)?0:E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),i=O;_.unbreakscape_text(g,l,f,x,b,m,w,s,i);var d=h().getInt32(g+0,!0),u=h().getInt32(g+4,!0);return o=d,a=u,N(d,u)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(o,a,1);}}function An(e,t,n,r,o,a,s,i,d){let u,g;try{let x=_.__wbindgen_add_to_stack_pointer(-16),b=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),m=O,w=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),y=O,k=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),v=O,R=E(d,_.__wbindgen_export_0,_.__wbindgen_export_1),A=O;_.info(x,b,m,w,y,k,v,r,o,a,s,i,R,A);var l=h().getInt32(x+0,!0),f=h().getInt32(x+4,!0);return u=l,g=f,N(l,f)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(u,g,1);}}function jn(){return _.info_text_supported()!==0}function Ln(e){return rt[e]}function Cn(e){e<132||(rt[e]=ht,ht=e);}function Y(e){let t=Ln(e);return Cn(e),t}function Dn(e,t,n,r,o,a,s,i){let d,u;try{let w=_.__wbindgen_add_to_stack_pointer(-16),y=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),k=O,v=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),R=O,A=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),C=O,D=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),W=O,J=E(o,_.__wbindgen_export_0,_.__wbindgen_export_1),K=O;_.transform(w,y,k,v,R,A,C,D,W,J,K,a,s,i);var g=h().getInt32(w+0,!0),l=h().getInt32(w+4,!0),f=h().getInt32(w+8,!0),x=h().getInt32(w+12,!0),b=g,m=l;if(x)throw b=0,m=0,Y(f);return d=b,u=m,N(b,m)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(d,u,1);}}function Wn(e,t,n){let r,o;try{let l=_.__wbindgen_add_to_stack_pointer(-16),f=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),x=O,b=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),m=O,w=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),y=O;_.resolve_patch_document(l,f,x,b,m,w,y);var a=h().getInt32(l+0,!0),s=h().getInt32(l+4,!0),i=h().getInt32(l+8,!0),d=h().getInt32(l+12,!0),u=a,g=s;if(d)throw u=0,g=0,Y(i);return r=u,o=g,N(u,g)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(r,o,1);}}function Jn(e,t,n,r,o,a,s,i,d){let u,g;try{let y=_.__wbindgen_add_to_stack_pointer(-16),k=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),v=O,R=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),A=O,C=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),D=O,W=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),J=O;_.diff(y,k,v,R,A,C,D,W,J,o,a,s,i,d);var l=h().getInt32(y+0,!0),f=h().getInt32(y+4,!0),x=h().getInt32(y+8,!0),b=h().getInt32(y+12,!0),m=l,w=f;if(b)throw m=0,w=0,Y(x);return u=m,g=w,N(m,w)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(u,g,1);}}function Mn(e,t,n,r,o,a){let s,i;try{let b=_.__wbindgen_add_to_stack_pointer(-16),m=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),w=O,y=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),k=O,v=E(a,_.__wbindgen_export_0,_.__wbindgen_export_1),R=O;_.complete(b,m,w,t,n,y,k,o,v,R);var d=h().getInt32(b+0,!0),u=h().getInt32(b+4,!0),g=h().getInt32(b+8,!0),l=h().getInt32(b+12,!0),f=d,x=u;if(l)throw f=0,x=0,Y(g);return s=f,i=x,N(f,x)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(s,i,1);}}function Nn(e,t,n,r,o,a,s){let i,d;try{let m=_.__wbindgen_add_to_stack_pointer(-16),w=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),y=O,k=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),v=O,R=E(a,_.__wbindgen_export_0,_.__wbindgen_export_1),A=O;_.resolve(m,w,y,t,n,k,v,o,R,A,s);var u=h().getInt32(m+0,!0),g=h().getInt32(m+4,!0),l=h().getInt32(m+8,!0),f=h().getInt32(m+12,!0),x=u,b=g;if(f)throw x=0,b=0,Y(l);return i=x,d=b,N(x,b)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(i,d,1);}}function Vn(e,t,n,r){let o,a;try{let f=_.__wbindgen_add_to_stack_pointer(-16),x=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),b=O,m=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),w=O;_.hover(f,x,b,t,n,m,w);var s=h().getInt32(f+0,!0),i=h().getInt32(f+4,!0),d=h().getInt32(f+8,!0),u=h().getInt32(f+12,!0),g=s,l=i;if(u)throw g=0,l=0,Y(d);return o=g,a=l,N(g,l)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(o,a,1);}}function Un(e,t){try{let o=_.__wbindgen_add_to_stack_pointer(-16),a=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),s=O,i=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),d=O;_.register(o,a,s,i,d);var n=h().getInt32(o+0,!0),r=h().getInt32(o+4,!0);if(r)throw Y(n)}finally{_.__wbindgen_add_to_stack_pointer(16);}}function Hn(e,t,n,r,o,a){let s,i;try{let b=_.__wbindgen_add_to_stack_pointer(-16),m=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),w=O,y=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),k=O,v=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),R=O;_.canonicalize(b,m,w,y,k,v,R,r,o,a);var d=h().getInt32(b+0,!0),u=h().getInt32(b+4,!0),g=h().getInt32(b+8,!0),l=h().getInt32(b+12,!0),f=d,x=u;if(l)throw f=0,x=0,Y(g);return s=f,i=x,N(f,x)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(s,i,1);}}function Gn(e){let t,n;try{let u=_.__wbindgen_add_to_stack_pointer(-16),g=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),l=O;_.count_bits(u,g,l);var r=h().getInt32(u+0,!0),o=h().getInt32(u+4,!0),a=h().getInt32(u+8,!0),s=h().getInt32(u+12,!0),i=r,d=o;if(s)throw i=0,d=0,Y(a);return t=i,n=d,N(i,d)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(t,n,1);}}function zn(e,t){let n,r;try{let s=_.__wbindgen_add_to_stack_pointer(-16),i=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),d=O,u=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),g=O;_.split_bits(s,i,d,u,g);var o=h().getInt32(s+0,!0),a=h().getInt32(s+4,!0);return n=o,r=a,N(o,a)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(n,r,1);}}function $n(e){let t=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),n=O;return _.is_bitmark(t,n)!==0}function Kn(e){let t,n;try{let u=_.__wbindgen_add_to_stack_pointer(-16),g=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),l=O;_.split_json_bits(u,g,l);var r=h().getInt32(u+0,!0),o=h().getInt32(u+4,!0),a=h().getInt32(u+8,!0),s=h().getInt32(u+12,!0),i=r,d=o;if(s)throw i=0,d=0,Y(a);return t=i,n=d,N(i,d)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(t,n,1);}}function qn(e,t){let n,r;try{let s=_.__wbindgen_add_to_stack_pointer(-16),i=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),d=O;_.prettify(s,i,d,t);var o=h().getInt32(s+0,!0),a=h().getInt32(s+4,!0);return n=o,r=a,N(o,a)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(n,r,1);}}function Yn(e,t,n,r){let o,a;try{let f=_.__wbindgen_add_to_stack_pointer(-16),x=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),b=O,m=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),w=O,y=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),k=O,v=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),R=O;_.convert_text(f,x,b,m,w,y,k,v,R);var s=h().getInt32(f+0,!0),i=h().getInt32(f+4,!0),d=h().getInt32(f+8,!0),u=h().getInt32(f+12,!0),g=s,l=i;if(u)throw g=0,l=0,Y(d);return o=g,a=l,N(g,l)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(o,a,1);}}function Xn(e,t,n,r,o,a,s,i,d,u,g){let l,f;try{let v=_.__wbindgen_add_to_stack_pointer(-16),R=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),A=O,C=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),D=O,W=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),J=O,K=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),tt=O,mt=E(u,_.__wbindgen_export_0,_.__wbindgen_export_1),wt=O,xt=E(g,_.__wbindgen_export_0,_.__wbindgen_export_1),yt=O;_.convert(v,R,A,C,D,W,J,K,tt,o,a,s,i,d,mt,wt,xt,yt);var x=h().getInt32(v+0,!0),b=h().getInt32(v+4,!0),m=h().getInt32(v+8,!0),w=h().getInt32(v+12,!0),y=x,k=b;if(w)throw y=0,k=0,Y(m);return l=y,f=k,N(y,k)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(l,f,1);}}function Qn(e,t,n,r,o,a,s,i,d,u,g,l){try{let m=_.__wbindgen_add_to_stack_pointer(-16),w=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),y=O,k=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),v=O,R=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),A=O,C=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),D=O,W=E(u,_.__wbindgen_export_0,_.__wbindgen_export_1),J=O,K=E(g,_.__wbindgen_export_0,_.__wbindgen_export_1),tt=O;_.convert_with_details(m,w,y,k,v,R,A,C,D,o,a,s,i,d,W,J,K,tt,l);var f=h().getInt32(m+0,!0),x=h().getInt32(m+4,!0),b=h().getInt32(m+8,!0);if(b)throw Y(x);return Lt.__wrap(f)}finally{_.__wbindgen_add_to_stack_pointer(16);}}var vt=null;function Zn(){return (vt===null||vt.byteLength===0)&&(vt=new Uint32Array(_.memory.buffer)),vt}function tr(e,t){return e=e>>>0,Zn().subarray(e/4,e/4+t)}var ve=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>_.__wbg_convertdetails_free(e>>>0,1)),Lt=class e{static __wrap(t){t=t>>>0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,ve.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,ve.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_convertdetails_free(t,0);}bit_spans_encoding(){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.convertdetails_bit_spans_encoding(r,this.__wbg_ptr);var t=h().getInt32(r+0,!0),n=h().getInt32(r+4,!0);let o;return t!==0&&(o=N(t,n).slice(),_.__wbindgen_export_2(t,n*1,1)),o}finally{_.__wbindgen_add_to_stack_pointer(16);}}bit_spans(){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.convertdetails_bit_spans(r,this.__wbg_ptr);var t=h().getInt32(r+0,!0),n=h().getInt32(r+4,!0);let o;return t!==0&&(o=tr(t,n).slice(),_.__wbindgen_export_2(t,n*4,4)),o}finally{_.__wbindgen_add_to_stack_pointer(16);}}take_data(){let t,n;try{let a=_.__wbindgen_add_to_stack_pointer(-16);_.convertdetails_take_data(a,this.__wbg_ptr);var r=h().getInt32(a+0,!0),o=h().getInt32(a+4,!0);return t=r,n=o,N(r,o)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(t,n,1);}}};async function er(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.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",r);else throw r}let n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else {let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function Oe(){let e={};return e.wbg={},e.wbg.__wbindgen_error_new=function(t,n){let r=new Error(N(t,n));return En(r)},e.wbg.__wbindgen_throw=function(t,n){throw new Error(N(t,n))},e}function Te(e,t){return _=e.exports,Fe.__wbindgen_wasm_module=t,ct=null,vt=null,kt=null,_}function Zt(e){if(_!==void 0)return _;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=Oe();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let n=new WebAssembly.Instance(e,t);return Te(n,e)}async function Fe(e){if(_!==void 0)return _;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("bitmark_wasm_bg.wasm",import.meta.url));let t=Oe();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await er(await e,t);return Te(n,r)}var te=Fe;var oe={};Pt(oe,{ConvertDetails:()=>Wt,breakscape_text:()=>or,canonicalize:()=>mr,complete:()=>gr,convert:()=>Ir,convert_text:()=>hr,convert_with_details:()=>Or,count_bits:()=>wr,default:()=>re,diff:()=>ur,hover:()=>fr,info:()=>sr,info_text_supported:()=>ar,initSync:()=>ne,is_bitmark:()=>yr,prettify:()=>vr,register:()=>br,resolve:()=>lr,resolve_patch_document:()=>dr,split_bits:()=>xr,split_json_bits:()=>kr,transform:()=>cr,unbreakscape_text:()=>ir});var p,Ee=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Ee.decode();var It=null;function Ct(){return (It===null||It.byteLength===0)&&(It=new Uint8Array(p.memory.buffer)),It}function V(e,t){return e=e>>>0,Ee.decode(Ct().subarray(e,e+t))}var ot=new Array(128).fill(void 0);ot.push(void 0,null,true,false);var Tt=ot.length;function nr(e){Tt===ot.length&&ot.push(ot.length+1);let t=Tt;return Tt=ot[t],ot[t]=e,t}var T=0,Dt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},rr=typeof Dt.encodeInto=="function"?function(e,t){return Dt.encodeInto(e,t)}:function(e,t){let n=Dt.encode(e);return t.set(n),{read:e.length,written:n.length}};function S(e,t,n){if(n===void 0){let i=Dt.encode(e),d=t(i.length,1)>>>0;return Ct().subarray(d,d+i.length).set(i),T=i.length,d}let r=e.length,o=t(r,1)>>>0,a=Ct(),s=0;for(;s<r;s++){let i=e.charCodeAt(s);if(i>127)break;a[o+s]=i;}if(s!==r){s!==0&&(e=e.slice(s)),o=n(o,r,r=s+e.length*3,1)>>>0;let i=Ct().subarray(o+s,o+r),d=rr(e,i);s+=d.written,o=n(o,r,s,1)>>>0;}return T=s,o}function Se(e){return e==null}var dt=null;function I(){return (dt===null||dt.buffer.detached===true||dt.buffer.detached===void 0&&dt.buffer!==p.memory.buffer)&&(dt=new DataView(p.memory.buffer)),dt}function or(e,t,n,r){let o,a;try{let g=p.__wbindgen_add_to_stack_pointer(-16),l=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),f=T,x=S(t,p.__wbindgen_export_0,p.__wbindgen_export_1),b=T,m=S(n,p.__wbindgen_export_0,p.__wbindgen_export_1),w=T;var s=Se(r)?0:S(r,p.__wbindgen_export_0,p.__wbindgen_export_1),i=T;p.breakscape_text(g,l,f,x,b,m,w,s,i);var d=I().getInt32(g+0,!0),u=I().getInt32(g+4,!0);return o=d,a=u,V(d,u)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(o,a,1);}}function ir(e,t,n,r){let o,a;try{let g=p.__wbindgen_add_to_stack_pointer(-16),l=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),f=T,x=S(t,p.__wbindgen_export_0,p.__wbindgen_export_1),b=T,m=S(n,p.__wbindgen_export_0,p.__wbindgen_export_1),w=T;var s=Se(r)?0:S(r,p.__wbindgen_export_0,p.__wbindgen_export_1),i=T;p.unbreakscape_text(g,l,f,x,b,m,w,s,i);var d=I().getInt32(g+0,!0),u=I().getInt32(g+4,!0);return o=d,a=u,V(d,u)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(o,a,1);}}function sr(e,t,n,r,o,a,s,i,d){let u,g;try{let x=p.__wbindgen_add_to_stack_pointer(-16),b=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),m=T,w=S(t,p.__wbindgen_export_0,p.__wbindgen_export_1),y=T,k=S(n,p.__wbindgen_export_0,p.__wbindgen_export_1),v=T,R=S(d,p.__wbindgen_export_0,p.__wbindgen_export_1),A=T;p.info(x,b,m,w,y,k,v,r,o,a,s,i,R,A);var l=I().getInt32(x+0,!0),f=I().getInt32(x+4,!0);return u=l,g=f,V(l,f)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(u,g,1);}}function ar(){return p.info_text_supported()!==0}function _r(e){return ot[e]}function pr(e){e<132||(ot[e]=Tt,Tt=e);}function X(e){let t=_r(e);return pr(e),t}function cr(e,t,n,r,o,a,s,i){let d,u;try{let w=p.__wbindgen_add_to_stack_pointer(-16),y=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),k=T,v=S(t,p.__wbindgen_export_0,p.__wbindgen_export_1),R=T,A=S(n,p.__wbindgen_export_0,p.__wbindgen_export_1),C=T,D=S(r,p.__wbindgen_export_0,p.__wbindgen_export_1),W=T,J=S(o,p.__wbindgen_export_0,p.__wbindgen_export_1),K=T;p.transform(w,y,k,v,R,A,C,D,W,J,K,a,s,i);var g=I().getInt32(w+0,!0),l=I().getInt32(w+4,!0),f=I().getInt32(w+8,!0),x=I().getInt32(w+12,!0),b=g,m=l;if(x)throw b=0,m=0,X(f);return d=b,u=m,V(b,m)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(d,u,1);}}function dr(e,t,n){let r,o;try{let l=p.__wbindgen_add_to_stack_pointer(-16),f=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),x=T,b=S(t,p.__wbindgen_export_0,p.__wbindgen_export_1),m=T,w=S(n,p.__wbindgen_export_0,p.__wbindgen_export_1),y=T;p.resolve_patch_document(l,f,x,b,m,w,y);var a=I().getInt32(l+0,!0),s=I().getInt32(l+4,!0),i=I().getInt32(l+8,!0),d=I().getInt32(l+12,!0),u=a,g=s;if(d)throw u=0,g=0,X(i);return r=u,o=g,V(u,g)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(r,o,1);}}function ur(e,t,n,r,o,a,s,i,d){let u,g;try{let y=p.__wbindgen_add_to_stack_pointer(-16),k=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),v=T,R=S(t,p.__wbindgen_export_0,p.__wbindgen_export_1),A=T,C=S(n,p.__wbindgen_export_0,p.__wbindgen_export_1),D=T,W=S(r,p.__wbindgen_export_0,p.__wbindgen_export_1),J=T;p.diff(y,k,v,R,A,C,D,W,J,o,a,s,i,d);var l=I().getInt32(y+0,!0),f=I().getInt32(y+4,!0),x=I().getInt32(y+8,!0),b=I().getInt32(y+12,!0),m=l,w=f;if(b)throw m=0,w=0,X(x);return u=m,g=w,V(m,w)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(u,g,1);}}function gr(e,t,n,r,o,a){let s,i;try{let b=p.__wbindgen_add_to_stack_pointer(-16),m=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),w=T,y=S(r,p.__wbindgen_export_0,p.__wbindgen_export_1),k=T,v=S(a,p.__wbindgen_export_0,p.__wbindgen_export_1),R=T;p.complete(b,m,w,t,n,y,k,o,v,R);var d=I().getInt32(b+0,!0),u=I().getInt32(b+4,!0),g=I().getInt32(b+8,!0),l=I().getInt32(b+12,!0),f=d,x=u;if(l)throw f=0,x=0,X(g);return s=f,i=x,V(f,x)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(s,i,1);}}function lr(e,t,n,r,o,a,s){let i,d;try{let m=p.__wbindgen_add_to_stack_pointer(-16),w=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),y=T,k=S(r,p.__wbindgen_export_0,p.__wbindgen_export_1),v=T,R=S(a,p.__wbindgen_export_0,p.__wbindgen_export_1),A=T;p.resolve(m,w,y,t,n,k,v,o,R,A,s);var u=I().getInt32(m+0,!0),g=I().getInt32(m+4,!0),l=I().getInt32(m+8,!0),f=I().getInt32(m+12,!0),x=u,b=g;if(f)throw x=0,b=0,X(l);return i=x,d=b,V(x,b)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(i,d,1);}}function fr(e,t,n,r){let o,a;try{let f=p.__wbindgen_add_to_stack_pointer(-16),x=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),b=T,m=S(r,p.__wbindgen_export_0,p.__wbindgen_export_1),w=T;p.hover(f,x,b,t,n,m,w);var s=I().getInt32(f+0,!0),i=I().getInt32(f+4,!0),d=I().getInt32(f+8,!0),u=I().getInt32(f+12,!0),g=s,l=i;if(u)throw g=0,l=0,X(d);return o=g,a=l,V(g,l)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(o,a,1);}}function br(e,t){try{let o=p.__wbindgen_add_to_stack_pointer(-16),a=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),s=T,i=S(t,p.__wbindgen_export_0,p.__wbindgen_export_1),d=T;p.register(o,a,s,i,d);var n=I().getInt32(o+0,!0),r=I().getInt32(o+4,!0);if(r)throw X(n)}finally{p.__wbindgen_add_to_stack_pointer(16);}}function mr(e,t,n,r,o,a){let s,i;try{let b=p.__wbindgen_add_to_stack_pointer(-16),m=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),w=T,y=S(t,p.__wbindgen_export_0,p.__wbindgen_export_1),k=T,v=S(n,p.__wbindgen_export_0,p.__wbindgen_export_1),R=T;p.canonicalize(b,m,w,y,k,v,R,r,o,a);var d=I().getInt32(b+0,!0),u=I().getInt32(b+4,!0),g=I().getInt32(b+8,!0),l=I().getInt32(b+12,!0),f=d,x=u;if(l)throw f=0,x=0,X(g);return s=f,i=x,V(f,x)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(s,i,1);}}function wr(e){let t,n;try{let u=p.__wbindgen_add_to_stack_pointer(-16),g=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),l=T;p.count_bits(u,g,l);var r=I().getInt32(u+0,!0),o=I().getInt32(u+4,!0),a=I().getInt32(u+8,!0),s=I().getInt32(u+12,!0),i=r,d=o;if(s)throw i=0,d=0,X(a);return t=i,n=d,V(i,d)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(t,n,1);}}function xr(e,t){let n,r;try{let s=p.__wbindgen_add_to_stack_pointer(-16),i=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),d=T,u=S(t,p.__wbindgen_export_0,p.__wbindgen_export_1),g=T;p.split_bits(s,i,d,u,g);var o=I().getInt32(s+0,!0),a=I().getInt32(s+4,!0);return n=o,r=a,V(o,a)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(n,r,1);}}function yr(e){let t=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),n=T;return p.is_bitmark(t,n)!==0}function kr(e){let t,n;try{let u=p.__wbindgen_add_to_stack_pointer(-16),g=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),l=T;p.split_json_bits(u,g,l);var r=I().getInt32(u+0,!0),o=I().getInt32(u+4,!0),a=I().getInt32(u+8,!0),s=I().getInt32(u+12,!0),i=r,d=o;if(s)throw i=0,d=0,X(a);return t=i,n=d,V(i,d)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(t,n,1);}}function vr(e,t){let n,r;try{let s=p.__wbindgen_add_to_stack_pointer(-16),i=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),d=T;p.prettify(s,i,d,t);var o=I().getInt32(s+0,!0),a=I().getInt32(s+4,!0);return n=o,r=a,V(o,a)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(n,r,1);}}function hr(e,t,n,r){let o,a;try{let f=p.__wbindgen_add_to_stack_pointer(-16),x=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),b=T,m=S(t,p.__wbindgen_export_0,p.__wbindgen_export_1),w=T,y=S(n,p.__wbindgen_export_0,p.__wbindgen_export_1),k=T,v=S(r,p.__wbindgen_export_0,p.__wbindgen_export_1),R=T;p.convert_text(f,x,b,m,w,y,k,v,R);var s=I().getInt32(f+0,!0),i=I().getInt32(f+4,!0),d=I().getInt32(f+8,!0),u=I().getInt32(f+12,!0),g=s,l=i;if(u)throw g=0,l=0,X(d);return o=g,a=l,V(g,l)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(o,a,1);}}function Ir(e,t,n,r,o,a,s,i,d,u,g){let l,f;try{let v=p.__wbindgen_add_to_stack_pointer(-16),R=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),A=T,C=S(t,p.__wbindgen_export_0,p.__wbindgen_export_1),D=T,W=S(n,p.__wbindgen_export_0,p.__wbindgen_export_1),J=T,K=S(r,p.__wbindgen_export_0,p.__wbindgen_export_1),tt=T,mt=S(u,p.__wbindgen_export_0,p.__wbindgen_export_1),wt=T,xt=S(g,p.__wbindgen_export_0,p.__wbindgen_export_1),yt=T;p.convert(v,R,A,C,D,W,J,K,tt,o,a,s,i,d,mt,wt,xt,yt);var x=I().getInt32(v+0,!0),b=I().getInt32(v+4,!0),m=I().getInt32(v+8,!0),w=I().getInt32(v+12,!0),y=x,k=b;if(w)throw y=0,k=0,X(m);return l=y,f=k,V(y,k)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(l,f,1);}}function Or(e,t,n,r,o,a,s,i,d,u,g,l){try{let m=p.__wbindgen_add_to_stack_pointer(-16),w=S(e,p.__wbindgen_export_0,p.__wbindgen_export_1),y=T,k=S(t,p.__wbindgen_export_0,p.__wbindgen_export_1),v=T,R=S(n,p.__wbindgen_export_0,p.__wbindgen_export_1),A=T,C=S(r,p.__wbindgen_export_0,p.__wbindgen_export_1),D=T,W=S(u,p.__wbindgen_export_0,p.__wbindgen_export_1),J=T,K=S(g,p.__wbindgen_export_0,p.__wbindgen_export_1),tt=T;p.convert_with_details(m,w,y,k,v,R,A,C,D,o,a,s,i,d,W,J,K,tt,l);var f=I().getInt32(m+0,!0),x=I().getInt32(m+4,!0),b=I().getInt32(m+8,!0);if(b)throw X(x);return Wt.__wrap(f)}finally{p.__wbindgen_add_to_stack_pointer(16);}}var Ot=null;function Tr(){return (Ot===null||Ot.byteLength===0)&&(Ot=new Uint32Array(p.memory.buffer)),Ot}function Fr(e,t){return e=e>>>0,Tr().subarray(e/4,e/4+t)}var Re=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>p.__wbg_convertdetails_free(e>>>0,1)),Wt=class e{static __wrap(t){t=t>>>0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Re.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Re.unregister(this),t}free(){let t=this.__destroy_into_raw();p.__wbg_convertdetails_free(t,0);}bit_spans_encoding(){try{let r=p.__wbindgen_add_to_stack_pointer(-16);p.convertdetails_bit_spans_encoding(r,this.__wbg_ptr);var t=I().getInt32(r+0,!0),n=I().getInt32(r+4,!0);let o;return t!==0&&(o=V(t,n).slice(),p.__wbindgen_export_2(t,n*1,1)),o}finally{p.__wbindgen_add_to_stack_pointer(16);}}bit_spans(){try{let r=p.__wbindgen_add_to_stack_pointer(-16);p.convertdetails_bit_spans(r,this.__wbg_ptr);var t=I().getInt32(r+0,!0),n=I().getInt32(r+4,!0);let o;return t!==0&&(o=Fr(t,n).slice(),p.__wbindgen_export_2(t,n*4,4)),o}finally{p.__wbindgen_add_to_stack_pointer(16);}}take_data(){let t,n;try{let a=p.__wbindgen_add_to_stack_pointer(-16);p.convertdetails_take_data(a,this.__wbg_ptr);var r=I().getInt32(a+0,!0),o=I().getInt32(a+4,!0);return t=r,n=o,V(r,o)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(t,n,1);}}};async function Rr(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.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",r);else throw r}let n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else {let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function Be(){let e={};return e.wbg={},e.wbg.__wbindgen_error_new=function(t,n){let r=new Error(V(t,n));return nr(r)},e.wbg.__wbindgen_throw=function(t,n){throw new Error(V(t,n))},e}function Pe(e,t){return p=e.exports,Ae.__wbindgen_wasm_module=t,dt=null,Ot=null,It=null,p}function ne(e){if(p!==void 0)return p;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=Be();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let n=new WebAssembly.Instance(e,t);return Pe(n,e)}async function Ae(e){if(p!==void 0)return p;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("bitmark_browser_full_wasm_bg.wasm",import.meta.url));let t=Be();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Rr(await e,t);return Pe(n,r)}var re=Ae;var ae={};Pt(ae,{ConvertDetails:()=>Nt,breakscape_text:()=>Br,canonicalize:()=>Nr,complete:()=>Wr,convert:()=>qr,convert_text:()=>$r,convert_with_details:()=>Yr,count_bits:()=>Vr,default:()=>se,hover:()=>Mr,info:()=>Ar,initSync:()=>ie,is_bitmark:()=>Hr,prettify:()=>zr,register:()=>Cr,resolve:()=>Jr,resolve_patch_document:()=>Dr,split_bits:()=>Ur,split_json_bits:()=>Gr,transform:()=>Kr,unbreakscape_text:()=>Pr});var c,Le=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Le.decode();var Ft=null;function Jt(){return (Ft===null||Ft.byteLength===0)&&(Ft=new Uint8Array(c.memory.buffer)),Ft}function H(e,t){return e=e>>>0,Le.decode(Jt().subarray(e,e+t))}var it=new Array(128).fill(void 0);it.push(void 0,null,true,false);var Et=it.length;function Er(e){Et===it.length&&it.push(it.length+1);let t=Et;return Et=it[t],it[t]=e,t}var B=0,Mt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Sr=typeof Mt.encodeInto=="function"?function(e,t){return Mt.encodeInto(e,t)}:function(e,t){let n=Mt.encode(e);return t.set(n),{read:e.length,written:n.length}};function P(e,t,n){if(n===void 0){let i=Mt.encode(e),d=t(i.length,1)>>>0;return Jt().subarray(d,d+i.length).set(i),B=i.length,d}let r=e.length,o=t(r,1)>>>0,a=Jt(),s=0;for(;s<r;s++){let i=e.charCodeAt(s);if(i>127)break;a[o+s]=i;}if(s!==r){s!==0&&(e=e.slice(s)),o=n(o,r,r=s+e.length*3,1)>>>0;let i=Jt().subarray(o+s,o+r),d=Sr(e,i);s+=d.written,o=n(o,r,s,1)>>>0;}return B=s,o}function Ce(e){return e==null}var ut=null;function F(){return (ut===null||ut.buffer.detached===true||ut.buffer.detached===void 0&&ut.buffer!==c.memory.buffer)&&(ut=new DataView(c.memory.buffer)),ut}function Br(e,t,n,r){let o,a;try{let g=c.__wbindgen_add_to_stack_pointer(-16),l=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),f=B,x=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),b=B,m=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),w=B;var s=Ce(r)?0:P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),i=B;c.breakscape_text(g,l,f,x,b,m,w,s,i);var d=F().getInt32(g+0,!0),u=F().getInt32(g+4,!0);return o=d,a=u,H(d,u)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(o,a,1);}}function Pr(e,t,n,r){let o,a;try{let g=c.__wbindgen_add_to_stack_pointer(-16),l=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),f=B,x=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),b=B,m=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),w=B;var s=Ce(r)?0:P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),i=B;c.unbreakscape_text(g,l,f,x,b,m,w,s,i);var d=F().getInt32(g+0,!0),u=F().getInt32(g+4,!0);return o=d,a=u,H(d,u)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(o,a,1);}}function Ar(e,t,n,r,o,a,s,i,d){let u,g;try{let x=c.__wbindgen_add_to_stack_pointer(-16),b=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),m=B,w=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),y=B,k=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),v=B,R=P(d,c.__wbindgen_export_0,c.__wbindgen_export_1),A=B;c.info(x,b,m,w,y,k,v,r,o,a,s,i,R,A);var l=F().getInt32(x+0,!0),f=F().getInt32(x+4,!0);return u=l,g=f,H(l,f)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(u,g,1);}}function jr(e){return it[e]}function Lr(e){e<132||(it[e]=Et,Et=e);}function Z(e){let t=jr(e);return Lr(e),t}function Cr(e,t){try{let o=c.__wbindgen_add_to_stack_pointer(-16),a=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),s=B,i=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),d=B;c.register(o,a,s,i,d);var n=F().getInt32(o+0,!0),r=F().getInt32(o+4,!0);if(r)throw Z(n)}finally{c.__wbindgen_add_to_stack_pointer(16);}}function Dr(e,t,n){let r,o;try{let l=c.__wbindgen_add_to_stack_pointer(-16),f=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),x=B,b=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),m=B,w=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),y=B;c.resolve_patch_document(l,f,x,b,m,w,y);var a=F().getInt32(l+0,!0),s=F().getInt32(l+4,!0),i=F().getInt32(l+8,!0),d=F().getInt32(l+12,!0),u=a,g=s;if(d)throw u=0,g=0,Z(i);return r=u,o=g,H(u,g)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(r,o,1);}}function Wr(e,t,n,r,o,a){let s,i;try{let b=c.__wbindgen_add_to_stack_pointer(-16),m=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),w=B,y=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),k=B,v=P(a,c.__wbindgen_export_0,c.__wbindgen_export_1),R=B;c.complete(b,m,w,t,n,y,k,o,v,R);var d=F().getInt32(b+0,!0),u=F().getInt32(b+4,!0),g=F().getInt32(b+8,!0),l=F().getInt32(b+12,!0),f=d,x=u;if(l)throw f=0,x=0,Z(g);return s=f,i=x,H(f,x)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(s,i,1);}}function Jr(e,t,n,r,o,a,s){let i,d;try{let m=c.__wbindgen_add_to_stack_pointer(-16),w=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),y=B,k=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),v=B,R=P(a,c.__wbindgen_export_0,c.__wbindgen_export_1),A=B;c.resolve(m,w,y,t,n,k,v,o,R,A,s);var u=F().getInt32(m+0,!0),g=F().getInt32(m+4,!0),l=F().getInt32(m+8,!0),f=F().getInt32(m+12,!0),x=u,b=g;if(f)throw x=0,b=0,Z(l);return i=x,d=b,H(x,b)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(i,d,1);}}function Mr(e,t,n,r){let o,a;try{let f=c.__wbindgen_add_to_stack_pointer(-16),x=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),b=B,m=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),w=B;c.hover(f,x,b,t,n,m,w);var s=F().getInt32(f+0,!0),i=F().getInt32(f+4,!0),d=F().getInt32(f+8,!0),u=F().getInt32(f+12,!0),g=s,l=i;if(u)throw g=0,l=0,Z(d);return o=g,a=l,H(g,l)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(o,a,1);}}function Nr(e,t,n,r,o,a){let s,i;try{let b=c.__wbindgen_add_to_stack_pointer(-16),m=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),w=B,y=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),k=B,v=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),R=B;c.canonicalize(b,m,w,y,k,v,R,r,o,a);var d=F().getInt32(b+0,!0),u=F().getInt32(b+4,!0),g=F().getInt32(b+8,!0),l=F().getInt32(b+12,!0),f=d,x=u;if(l)throw f=0,x=0,Z(g);return s=f,i=x,H(f,x)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(s,i,1);}}function Vr(e){let t,n;try{let u=c.__wbindgen_add_to_stack_pointer(-16),g=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),l=B;c.count_bits(u,g,l);var r=F().getInt32(u+0,!0),o=F().getInt32(u+4,!0),a=F().getInt32(u+8,!0),s=F().getInt32(u+12,!0),i=r,d=o;if(s)throw i=0,d=0,Z(a);return t=i,n=d,H(i,d)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(t,n,1);}}function Ur(e,t){let n,r;try{let s=c.__wbindgen_add_to_stack_pointer(-16),i=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),d=B,u=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),g=B;c.split_bits(s,i,d,u,g);var o=F().getInt32(s+0,!0),a=F().getInt32(s+4,!0);return n=o,r=a,H(o,a)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(n,r,1);}}function Hr(e){let t=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),n=B;return c.is_bitmark(t,n)!==0}function Gr(e){let t,n;try{let u=c.__wbindgen_add_to_stack_pointer(-16),g=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),l=B;c.split_json_bits(u,g,l);var r=F().getInt32(u+0,!0),o=F().getInt32(u+4,!0),a=F().getInt32(u+8,!0),s=F().getInt32(u+12,!0),i=r,d=o;if(s)throw i=0,d=0,Z(a);return t=i,n=d,H(i,d)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(t,n,1);}}function zr(e,t){let n,r;try{let s=c.__wbindgen_add_to_stack_pointer(-16),i=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),d=B;c.prettify(s,i,d,t);var o=F().getInt32(s+0,!0),a=F().getInt32(s+4,!0);return n=o,r=a,H(o,a)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(n,r,1);}}function $r(e,t,n,r){let o,a;try{let f=c.__wbindgen_add_to_stack_pointer(-16),x=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),b=B,m=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),w=B,y=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),k=B,v=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),R=B;c.convert_text(f,x,b,m,w,y,k,v,R);var s=F().getInt32(f+0,!0),i=F().getInt32(f+4,!0),d=F().getInt32(f+8,!0),u=F().getInt32(f+12,!0),g=s,l=i;if(u)throw g=0,l=0,Z(d);return o=g,a=l,H(g,l)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(o,a,1);}}function Kr(e,t,n,r,o,a,s,i){let d,u;try{let w=c.__wbindgen_add_to_stack_pointer(-16),y=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),k=B,v=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),R=B,A=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),C=B,D=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),W=B,J=P(o,c.__wbindgen_export_0,c.__wbindgen_export_1),K=B;c.transform(w,y,k,v,R,A,C,D,W,J,K,a,s,i);var g=F().getInt32(w+0,!0),l=F().getInt32(w+4,!0),f=F().getInt32(w+8,!0),x=F().getInt32(w+12,!0),b=g,m=l;if(x)throw b=0,m=0,Z(f);return d=b,u=m,H(b,m)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(d,u,1);}}function qr(e,t,n,r,o,a,s,i,d,u,g){let l,f;try{let v=c.__wbindgen_add_to_stack_pointer(-16),R=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),A=B,C=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),D=B,W=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),J=B,K=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),tt=B,mt=P(u,c.__wbindgen_export_0,c.__wbindgen_export_1),wt=B,xt=P(g,c.__wbindgen_export_0,c.__wbindgen_export_1),yt=B;c.convert(v,R,A,C,D,W,J,K,tt,o,a,s,i,d,mt,wt,xt,yt);var x=F().getInt32(v+0,!0),b=F().getInt32(v+4,!0),m=F().getInt32(v+8,!0),w=F().getInt32(v+12,!0),y=x,k=b;if(w)throw y=0,k=0,Z(m);return l=y,f=k,H(y,k)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(l,f,1);}}function Yr(e,t,n,r,o,a,s,i,d,u,g,l){try{let m=c.__wbindgen_add_to_stack_pointer(-16),w=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),y=B,k=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),v=B,R=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),A=B,C=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),D=B,W=P(u,c.__wbindgen_export_0,c.__wbindgen_export_1),J=B,K=P(g,c.__wbindgen_export_0,c.__wbindgen_export_1),tt=B;c.convert_with_details(m,w,y,k,v,R,A,C,D,o,a,s,i,d,W,J,K,tt,l);var f=F().getInt32(m+0,!0),x=F().getInt32(m+4,!0),b=F().getInt32(m+8,!0);if(b)throw Z(x);return Nt.__wrap(f)}finally{c.__wbindgen_add_to_stack_pointer(16);}}var Rt=null;function Xr(){return (Rt===null||Rt.byteLength===0)&&(Rt=new Uint32Array(c.memory.buffer)),Rt}function Qr(e,t){return e=e>>>0,Xr().subarray(e/4,e/4+t)}var je=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>c.__wbg_convertdetails_free(e>>>0,1)),Nt=class e{static __wrap(t){t=t>>>0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,je.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,je.unregister(this),t}free(){let t=this.__destroy_into_raw();c.__wbg_convertdetails_free(t,0);}bit_spans_encoding(){try{let r=c.__wbindgen_add_to_stack_pointer(-16);c.convertdetails_bit_spans_encoding(r,this.__wbg_ptr);var t=F().getInt32(r+0,!0),n=F().getInt32(r+4,!0);let o;return t!==0&&(o=H(t,n).slice(),c.__wbindgen_export_2(t,n*1,1)),o}finally{c.__wbindgen_add_to_stack_pointer(16);}}bit_spans(){try{let r=c.__wbindgen_add_to_stack_pointer(-16);c.convertdetails_bit_spans(r,this.__wbg_ptr);var t=F().getInt32(r+0,!0),n=F().getInt32(r+4,!0);let o;return t!==0&&(o=Qr(t,n).slice(),c.__wbindgen_export_2(t,n*4,4)),o}finally{c.__wbindgen_add_to_stack_pointer(16);}}take_data(){let t,n;try{let a=c.__wbindgen_add_to_stack_pointer(-16);c.convertdetails_take_data(a,this.__wbg_ptr);var r=F().getInt32(a+0,!0),o=F().getInt32(a+4,!0);return t=r,n=o,H(r,o)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(t,n,1);}}};async function Zr(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.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",r);else throw r}let n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else {let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function De(){let e={};return e.wbg={},e.wbg.__wbindgen_error_new=function(t,n){let r=new Error(H(t,n));return Er(r)},e.wbg.__wbindgen_throw=function(t,n){throw new Error(H(t,n))},e}function We(e,t){return c=e.exports,Je.__wbindgen_wasm_module=t,ut=null,Rt=null,Ft=null,c}function ie(e){if(c!==void 0)return c;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=De();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let n=new WebAssembly.Instance(e,t);return We(n,e)}async function Je(e){if(c!==void 0)return c;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("bitmark_json_wasm_bg.wasm",import.meta.url));let t=De();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Zr(await e,t);return We(n,r)}var se=Je;var St={version:"7.7.0"};var _e="browser-full",Ut=class extends Error{constructor(){super("wasm not initialised: call init() (or init({ feature: \u2026 })) first"),this.name="NotInitializedError";}},lt=class extends Error{constructor(t){super(t),this.name="RegisterError";}},st=class extends Error{constructor(n){let r=n.map(o=>`${o.kind} at ${o.path}: ${o.message}`);super(`${n.length} patch ${n.length===1?"entry was":"entries were"} skipped:
2
- `+r.join(`
3
- `));M(this,"diagnostics");this.name="PatchError",this.diagnostics=n;}},at=class extends Error{constructor(t,n){super(`${t} is not available in the loaded wasm module${n?` (feature: "${n}")`:""}; init({ feature: "full" }) to load it`),this.name="UnsupportedFeatureError";}},Vt,Ne,Me,Ve=new Map;function U(){if(!Vt&&Me&&Me(),!Vt)throw new Ut;return Vt}function pe(e,t){for(let[n,r]of Ve)try{t.register(n,r);}catch(o){throw new lt(o instanceof Error?o.message:String(o))}Vt=t,Ne=e;}function Ue(e,t){Ve.set(e,t);}function nt(){return Ne}function to(e){let t=e.trim();return t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1):e}function eo(e){return e===void 0?"":typeof e=="string"?e.trim():JSON.stringify(e)}function no(e,t,n){if(n){let o=JSON.parse(e.split_bits(t,"utf-8"));return o.map(a=>({view:{format:"bitmark",index:a.index,total:o.length,source:a.source},source:a.source}))}let r=JSON.parse(e.split_json_bits(t));return r.map((o,a)=>({view:{format:"json",index:a,total:r.length,bit:o.bit??{}},source:JSON.stringify([o])}))}function ce(e,t,n){let r=n.mode??"optimized",o=n.outputFormat??"json",a=n.spacesAroundValues??1,s=n.indent??2,i=n.pretty??false,d=n.inputFormat??"auto",u=d==="bitmark"||d!=="json"&&e.is_bitmark(t),g=u?"bitmark":"json";e.transform("","bitmark",o,r,"",false,s,a);let l=no(e,t,u),f=l.length,x=[];for(let k=0;k<f;k++){let{view:v}=l[k];v.index=k,v.total=f;let R=n.preHook?n.preHook(v)||{}:{};x.push(R.drop?null:{patches:R.patches??[],outputFormat:R.outputFormat??o});}let b=eo(n.patch),m;b===""?m=l.map((k,v)=>({source:v,bit:null,patch:[]})):m=JSON.parse(e.resolve_patch_document(t,g,b));let w=[],y=[];for(let k of m)if(k.source!==null){let v=x[k.source];if(!v)continue;w.push({index:k.source,source:l[k.source].source,inputFormat:g,outputFormat:v.outputFormat,mode:r,patchJson:JSON.stringify([...k.patch,...v.patches]),spacesAroundValues:a}),y.push(l[k.source].view);}else if(typeof k.bit=="string"){let v=w.length;w.push({index:v,source:k.bit,inputFormat:"bitmark",outputFormat:o,mode:r,patchJson:JSON.stringify(k.patch),spacesAroundValues:a}),y.push({format:"bitmark",index:v,total:f,source:k.bit});}else {let v=k.bit??{},R=w.length;w.push({index:R,source:JSON.stringify([{bit:v}]),inputFormat:"json",outputFormat:o,mode:r,patchJson:JSON.stringify(k.patch),spacesAroundValues:a}),y.push({format:"json",index:R,total:f,bit:v});}return {jobs:w,views:y,output:o,pretty:i,indent:s}}function ro(e,t){let{data:n,diagnostics:r}=JSON.parse(e);return {element:t==="json"?to(n):n,diagnostics:r}}function oo(e,t){return ro(e.transform(t.source,t.inputFormat,t.outputFormat,t.mode,t.patchJson,false,2,t.spacesAroundValues),t.outputFormat)}function de(e,t,n,r,o){if(n!=="json")return t.join(`
4
- `);let a=`[${t.join(",")}]`;return r?e.prettify(a,o):a}function He(e,t,n){let r=ce(e,t,n),o=[],a=[];for(let s=0;s<r.jobs.length;s++){let{element:i,diagnostics:d}=oo(e,r.jobs[s]);a.push(...d),n.postHook?.(r.views[s],i),o.push(i);}if(a.length>0)throw new st(a);return de(e,o,r.output,r.pretty,r.indent)}async function Ge(e,t,n,r){let o=ce(e,t,n),a=await r(o.jobs,n.workers??4),s=[],i=[];for(let d=0;d<a.length;d++)s.push(a[d].element),i.push(...a[d].diagnostics),n.postHook?.(o.views[d],a[d].element);if(i.length>0)throw new st(i);return de(e,s,o.output,o.pretty,o.indent)}var ue;function ze(e){ue=e;}function G(){if(!ue)throw new Error("legacy API not initialised: the WASM module has not been provided (browser consumers must call init() first)");return ue()}function $e(e,t,n){if(e.length===0)return Promise.resolve([]);let r=Math.max(1,Math.min(t,e.length));return new Promise((o,a)=>{let s=new Array(e.length),i=0,d=0,u=false,g=[],l=x=>{if(!u){u=true;for(let b of g)b.terminate();x?a(x):o(s);}},f=x=>{if(u||i>=e.length)return;let b=i++;x.post({id:b,job:e[b]});};for(let x=0;x<r;x++){let b=n(m=>{if(!u){if(!m.ok)return l(new Error(m.error??"worker job failed"));s[m.id]={element:m.element,diagnostics:m.diagnostics??[]},++d===e.length?l():f(b);}},l);g.push(b);}for(let x of g)f(x);})}function Ke(e,t,n){let r=new URL("./worker-entry.js",import.meta.url);return $e(e,t,(o,a)=>{let s=new Worker(r,{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:n}),terminate:()=>s.terminate()}})}var vn={};Pt(vn,{Ast:()=>_n,BitType:()=>rn,BitmarkFileGenerator:()=>dn,BitmarkGenerator:()=>pn,BitmarkParser:()=>mn,BitmarkParserGenerator:()=>Yt,BitmarkParserType:()=>bo,BitmarkStringGenerator:()=>cn,BitmarkVersion:()=>lo,BodyTextFormat:()=>xo,BoundingBoxIndex:()=>an,Builder:()=>qt,CardSetVersion:()=>fo,FileWriter:()=>yn,HtmlTableGenerator:()=>fn,HtmlTableParser:()=>bn,InfoFormat:()=>wo,InfoType:()=>mo,Input:()=>co,InputFormat:()=>go,JsonFileGenerator:()=>ln,JsonGenerator:()=>un,JsonParser:()=>wn,JsonStringGenerator:()=>gn,LegacyUnsupportedError:()=>ft,NodeType:()=>sn,Output:()=>uo,ResourceBuilder:()=>Xt,StreamWriter:()=>kn,StringWriter:()=>xn,TextLocation:()=>yo,TextMarkType:()=>en,TextNodeType:()=>nn,bitmarkTextParse:()=>Ze,isPseudoAst:()=>Ye});var ft=class extends Error{constructor(t){super(t),this.name="LegacyUnsupportedError";}};function pt(e,t){throw new ft(`'${e}' is not supported by the @gmb/bitmark-parser legacy API`+(t?`: ${t}`:""))}function et(e,t){throw new ft(`Option '${e}' is not supported by the @gmb/bitmark-parser legacy API`+(t?`: ${t}`:""))}var ge="bitmark v2 output is not supported (this parser is bitmark v3 only)";function le(e){e.bitmarkVersion===2&&et("bitmarkVersion: 2",ge);}function Gt(e){e.explicitTextFormat&&et("bitmarkOptions.explicitTextFormat"),e.cardSetVersion===1&&et("bitmarkOptions.cardSetVersion: 1",ge),e.debugGenerationInline&&et("bitmarkOptions.debugGenerationInline"),e.noBreakscaping&&et("bitmarkOptions.noBreakscaping");}function zt(e){e.textAsPlainText&&et("jsonOptions.textAsPlainText",ge),e.debugGenerationInline&&et("jsonOptions.debugGenerationInline");}function gt(e){return e===true?{pretty:true,indent:2}:typeof e=="number"&&e>0?{pretty:true,indent:e}:{pretty:false,indent:2}}function $t(e){return e===void 0||e===true?1:e===false?0:Math.max(0,Math.min(10,e))}function Kt(e){switch(e){case "text":case "latex":case "json":case "xml":return "plainText";default:return "bitmark++"}}var qe=Symbol.for("@gmb/bitmark-parser/legacy-pseudo-ast");function bt(e){let t={bits:e};return Object.defineProperty(t,qe,{value:true,enumerable:false}),t}function Ye(e){return e!==null&&typeof e=="object"&&(qe in e||Array.isArray(e.bits))}var Xe={"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 fe=Symbol.for("@gmb/bitmark-parser/legacy-built-bit-parser"),so={bitType:"type",textFormat:"format",flashcards:"cards",markConfig:"marks"},ao={"bitmark--":"bitmark++","bitmark+":"bitmark++"},_o={bitmark:"bitmark++",text:"text",json:"json",latex:"latex",xml:"xml"},po=["title","subtitle","item","lead","pageNumber","marginNumber","hint","instruction","caption"],qt=class{buildBitmark(t){let n=bt(t.bits??[]);return t.errors!==void 0&&(n.errors=t.errors),n}buildBit(t,n){let r=G(),o={...t},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 d=o.textFormat;d!==void 0?(i.format=ao[d]??d,delete o.textFormat):i.format=_o[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 g=o.resources;if(g!==void 0&&a!==void 0){let w=Array.isArray(g)?g:[g],y=Xe[a];y?i[y.key]=w.filter(k=>k!==null&&typeof k=="object"&&k.type===y.resourceType):w.length>=1&&(i.resource=w[0]),delete o.resources;}let l=o.parser;delete o.parser;let f=o.extraProperties;delete o.extraProperties;for(let[w,y]of Object.entries(o))y!==void 0&&(i[so[w]??w]=y);if(f)for(let[w,y]of Object.entries(f))w in i||(i[w]=y);this.parseStringTexts(i);let x=r.convert(JSON.stringify([{bit:i}]),"json","json","optimized",false,2,1,false,false,"",""),m=JSON.parse(x)[0]?.bit??i;for(let[w,y]of Object.entries(i))w in m||y===false||y===""||y===null||Array.isArray(y)&&y.length===0||(m[w]=y);return l!==void 0&&Object.defineProperty(m,fe,{value:l,enumerable:false}),m}buildHighlight(t,n){if(!n)return;let r={...n},o=r.attrs;return o&&Object.assign(r,o),{type:"highlight",texts:Array.isArray(r.texts)?r.texts.filter(i=>i!=null).map(i=>({text:i.text??"",isCorrect:i.isCorrect??false,isHighlighted:i.isHighlighted??false,...Qe(i,["text","isCorrect","isHighlighted"])})):[],prefix:r.prefix??"",postfix:r.postfix??"",...Qe(r,["type","texts","prefix","postfix","attrs"]),attrs:{}}}parseStringTexts(t){let n=G(),r=(s,i)=>{if(s==="")return s;let d=n.convert_text(s,"textToAst","bitmark++",i);try{return JSON.parse(d)}catch{return s}},o=t.format,a=o===void 0||o==="bitmark++"||o==="bitmark+";if(typeof t.body=="string")if(o==="json")try{t.body=JSON.parse(t.body);}catch{t.body=null;}else a&&(t.body=r(t.body,"body"));for(let s of po){let i=t[s];typeof i=="string"&&(t[s]=r(i,"tag"));}}getBitConfig(t){let n=G();if(t!==void 0)try{let r=JSON.parse(n.info("bit","json",t,!1,2,!1,!1,!0,""));if(r.error===void 0)return {bodyFormat:r.body?.format}}catch{}throw new Error(`No config found for bit: ${t}`)}};function Qe(e,t){let n={};for(let[r,o]of Object.entries(e))o!==void 0&&!t.includes(r)&&(n[r]=o);return n}var Yt=class{version(){return St.version}convert(t,n){let r=Object.assign({},n),o=Object.assign({},r.jsonOptions),a=Object.assign({},r.bitmarkOptions);le(r),Gt(a),zt(o),this.checkBrowserFileWrite(r.outputFile);let s=G(),{source:i,isBitmark:d}=this.resolveInput(t,r.inputFormat),u=r.outputFormat??(d?"json":"bitmark"),g=u==="ast"?"json":u,{pretty:l,indent:f}=gt(o.prettify),x=g==="bitmark"?gt(a.prettifyJson):{pretty:l,indent:f},b=$t(a.spacesAroundValues),m=!o.excludeUnknownProperties,w=s.convert(i,d?"bitmark":"json",g,"optimized",x.pretty,x.indent,b,m,false,"","");if(u==="bitmark"||u==="text")return this.deliver(w,r.outputFile,r.fileOptions);if(u==="json")return r.outputFile?this.deliver(w,r.outputFile,r.fileOptions):l||o.stringify?w:JSON.parse(w);let y=bt(JSON.parse(w));return r.outputFile?this.deliver(JSON.stringify(y),r.outputFile,r.fileOptions):y}upgrade(t,n){let r=Object.assign({},n),o=Object.assign({},r.jsonOptions),a=Object.assign({},r.bitmarkOptions);le(r),Gt(a),zt(o),this.checkBrowserFileWrite(r.outputFile);let s=G(),{source:i,isBitmark:d}=this.resolveInput(t,r.inputFormat),{pretty:u,indent:g}=gt(d?a.prettifyJson:o.prettify),l=$t(a.spacesAroundValues),f=s.canonicalize(i,d?"bitmark":"json","optimized",u,g,l);return d?this.deliver(f,r.outputFile,r.fileOptions):r.outputFile?this.deliver(f,r.outputFile,r.fileOptions):u||o.stringify?f:JSON.parse(f)}info(t){let n=Object.assign({},t),r=G(),o=n.type??"list",a=n.outputFormat??"text",{pretty:s,indent:i}=gt(n.prettify),d=a==="pojo"?"json":a,u=r.info(o,d,n.bit??"",s,i,false,false,true,"");return a==="pojo"?JSON.parse(u):u}generateConfig(t){pt("BitmarkParserGenerator.generateConfig","bpg-internal development tool");}convertHtmlTable(t,n){let r=Object.assign({},n),o=Object.assign({},r.jsonOptions),a=Object.assign({},r.bitmarkOptions);Gt(a),zt(o),r.keepUnknownTags&&et("keepUnknownTags"),r.noBreakscaping&&et("noBreakscaping"),this.checkBrowserFileWrite(r.outputFile);let s=G(),i=typeof t=="string"?this.maybeReadFile(t,void 0):"";if(!(r.inputFormat==="html"||r.inputFormat===void 0&&typeof t=="string"&&/<table[\s>]/iu.test(i))){let{source:k,isBitmark:v}=this.resolveInput(t,void 0),R=s.convert(k,v?"bitmark":"json","html","optimized",false,2,1,false,false,"","");return this.deliver(be(R).join(`
5
- `),r.outputFile,r.fileOptions)}let u=r.tableFormat==="table"?"table":"table-extended",g=be(i).map(k=>`<bitmark-bit data-type="${u}" data-format="bitmark++">${k}</bitmark-bit>`).join(""),l=r.outputFormat??"bitmark",{pretty:f,indent:x}=gt(o.prettify),b=$t(a.spacesAroundValues);if(l==="html"){let k=s.convert(g,"html","html","optimized",false,2,1,false,false,"","");return this.deliver(be(k).join(`
6
- `),r.outputFile,r.fileOptions)}let m=l==="ast"?"json":l,w=s.convert(g,"html",m,"optimized",f,x,b,false,false,"","");if(l==="bitmark"||l==="text")return this.deliver(w,r.outputFile,r.fileOptions);if(l==="json")return r.outputFile?this.deliver(w,r.outputFile,r.fileOptions):f||o.stringify?w:JSON.parse(w);let y=bt(JSON.parse(w));return r.outputFile?this.deliver(JSON.stringify(y),r.outputFile,r.fileOptions):y}createAst(t,n){let r=Object.assign({},n),o=G(),{source:a,isBitmark:s}=this.resolveInput(t,r.inputFormat),i=o.convert(a,s?"bitmark":"json","json","optimized",false,2,1,true,false,"","");return bt(JSON.parse(i))}breakscapeText(t,n){if(!t)return t;let r=Object.assign({},n);this.checkBrowserFileWrite(r.outputFile);let o=G(),a=this.maybeReadFile(t,r.inputFormat),s=o.breakscape_text(a,Kt(r.textFormat),r.textLocation??"body");return this.deliver(s,r.outputFile,r.fileOptions)}unbreakscapeText(t,n){if(!t)return t;let r=Object.assign({},n);this.checkBrowserFileWrite(r.outputFile);let o=G(),a=this.maybeReadFile(t,r.inputFormat),s=o.unbreakscape_text(a,Kt(r.textFormat),r.textLocation??"body");return this.deliver(s,r.outputFile,r.fileOptions)}convertText(t,n){let r=Object.assign({},n),o=Object.assign({},r.jsonOptions);this.checkBrowserFileWrite(r.outputFile);let a=G(),s=r.textFormat===void 0||Kt(r.textFormat)==="bitmark++",i=r.textLocation??"body",d,u;if(typeof t=="string"?(d=this.maybeReadFile(t,r.inputFormat),u=this.parseTextAstString(d)):(d=JSON.stringify(t),u=Array.isArray(t)?t:void 0),u!==void 0){let b=s?a.convert_text(JSON.stringify(u),"astToText","bitmark++",i):a.convert_text(JSON.stringify(u),"astToPlainText","plainText",i);return this.deliver(b,r.outputFile,r.fileOptions)}let g=a.convert_text(d,"textToAst",s?"bitmark++":"plainText","body"),{pretty:l,indent:f}=gt(o.prettify),x=l?a.prettify(g,f):g;return r.outputFile?this.deliver(x,r.outputFile,r.fileOptions):l?x:JSON.parse(g)}textAstToPlainText(t,n){return G().convert_text(typeof t=="string"?t:JSON.stringify(t),"astToPlainText","bitmark++","body")}extractPlainText(t,n){let r=n?.inputFormat,o=G();if(r==="plainText")return typeof t=="string"?String(t):"";if(r==="bitmarkText"){let d=o.convert_text(String(t),"textToAst","bitmark++","body");return o.convert_text(d,"astToPlainText","bitmark++","body")}if(typeof t=="string"&&this.parseTextAstString(t)===void 0&&!o.is_bitmark(t)&&!(()=>{try{return JSON.parse(t),!0}catch{return false}})())return this.extractPlainText(t,{inputFormat:"bitmarkText"});let{source:a,isBitmark:s}=this.resolveInput(t,void 0);return o.convert(a,s?"bitmark":"json","text","optimized",false,2,1,false,false,"","")}parseTextAstString(t){let n=t.trim();if(n.startsWith("["))try{let r=JSON.parse(n);if(Array.isArray(r)&&r.every(o=>o!==null&&typeof o=="object"&&"type"in o))return r}catch{}}resolveInput(t,n){if(typeof t!="string"){let a=this.jsonEntries(t);return {source:JSON.stringify(a?a.map(s=>this.toWrapperEntry(s)):t),isBitmark:false}}let r=this.maybeReadFile(t,n);if(G().is_bitmark(r))return {source:r,isBitmark:true};try{let a=JSON.parse(r),s=this.jsonEntries(a);if(s)return {source:JSON.stringify(s.map(i=>this.toWrapperEntry(i))),isBitmark:!1}}catch{return {source:r,isBitmark:true}}return {source:r,isBitmark:false}}jsonEntries(t){if(Array.isArray(t))return t;if(t!==null&&typeof t=="object"){let n=t;if(Array.isArray(n.bits))return n.bits;if("bit"in n)return [n];if(typeof n.type=="string")return [{bit:n}]}}toWrapperEntry(t){if(t!==null&&typeof t=="object"&&"bit"in t)return t;let n={bit:t},r=t?.[fe];return r!==void 0&&(n.parser=r),n}maybeReadFile(t,n){if(n==="string")return t;return t;}checkBrowserFileWrite(t){if(t&&true)throw new Error("Cannot write to file in browser environment")}deliver(t,n,r){if(!n)return t;throw new Error("Cannot write to file in browser environment");}};function be(e){let t=[],n=e.toLowerCase(),r=0;for(;;){let o=n.indexOf("<table",r);if(o===-1)break;let a=0,s=o,i=-1;for(;s<e.length;){let d=n.indexOf("<table",s),u=n.indexOf("</table",s);if(u===-1)break;if(d!==-1&&d<u)a++,s=d+6;else {a--;let g=n.indexOf(">",u);if(s=g===-1?e.length:g+1,a===0){i=s;break}}}if(i===-1)break;t.push(e.slice(o,i)),r=i;}return t}function Ze(e){let t=G().convert_text(e,"textToAst","bitmark++","body");return JSON.parse(t)}var $={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 z(e){return (t,n,r)=>{if(!n)return;let{value:o,...a}=n,s={[e.valueField]:o??""};for(let[i,d]of Object.entries(a))d!==void 0&&(s[i]=d);return {type:e.type,[e.key]:s}}}var tn=Object.fromEntries(Object.values($).map(e=>[e.type,e])),Xt=class{constructor(){M(this,"imageResource",z($.imageResource));M(this,"imageLinkResource",z($.imageLinkResource));M(this,"audioResource",z($.audioResource));M(this,"audioEmbedResource",z($.audioEmbedResource));M(this,"audioLinkResource",z($.audioLinkResource));M(this,"videoResource",z($.videoResource));M(this,"videoEmbedResource",z($.videoEmbedResource));M(this,"videoLinkResource",z($.videoLinkResource));M(this,"stillImageFilmEmbedResource",z($.stillImageFilmEmbedResource));M(this,"stillImageFilmLinkResource",z($.stillImageFilmLinkResource));M(this,"articleResource",z($.articleResource));M(this,"documentResource",z($.documentResource));M(this,"documentEmbedResource",z($.documentEmbedResource));M(this,"documentLinkResource",z($.documentLinkResource));M(this,"documentDownloadResource",z($.documentDownloadResource));M(this,"appLinkResource",z($.appLinkResource));M(this,"websiteLinkResource",z($.websiteLinkResource));}resourceFromResourceJson(t,n){if(!n)return;let r=!Array.isArray(n),o=r?[n]:n,a=[];for(let s of o){let i=tn[s.type];if(!i)continue;let d=s[i.key]??{},{[i.valueField]:u,...g}=d,l=z(i)(void 0,{value:u,...g});l&&a.push(l);}if(a.length!==0)return r?a[0]:a}resourceFromResourceDataJson(t,n,r){if(!r)return;let o=tn[n];if(!o)return;let a=typeof r=="string"?r:void 0,s=typeof r=="object"?r:{},{url:i,src:d,body:u,...g}=s,l=i??d??u??a;return z(o)(t,{value:l,...g})}};var co={string:"string",file:"file"},uo={bitmark:"bitmark",json:"json",ast:"ast",text:"text"},go={bitmark:"bitmark",bitmarkText:"bitmarkText",plainText:"plainText",html:"html"},lo={v2:2,v3:3},fo={v1:1,v2:2},bo={peggy:"peggy"},mo={list:"list",deprecated:"deprecated",all:"all",bit:"bit"},wo={text:"text",json:"json",pojo:"pojo"},xo={plainText:"text",latex:"latex",json:"json",xml:"xml",bitmarkPlusPlus:"bitmark++"},yo={tag:"tag",body:"body",cardBody:"cardBody"};var en={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"},nn={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 ko(e){return e.replace(/-([a-z0-9])/gu,(t,n)=>n.toUpperCase())}var me;function Bt(){if(!me){let e=G(),t=JSON.parse(e.info("all","json","",false,2,true,false,false,"")),n={_standard:"_standard"};for(let{name:r}of t)n[ko(r)]=r;me=n;}return me}var rn=new Proxy({},{get:(e,t)=>typeof t=="string"?Bt()[t]:void 0,has:(e,t)=>typeof t=="string"&&t in Bt(),ownKeys:()=>Reflect.ownKeys(Bt()),getOwnPropertyDescriptor:(e,t)=>typeof t=="string"&&t in Bt()?{value:Bt()[t],enumerable:true,configurable:true,writable:false}:void 0});function on(e,t){return new Proxy({},{get:(n,r)=>r===Symbol.toPrimitive||r==="toString"||r===Symbol.toStringTag?()=>`[unsupported ${e}]`:pt(e,t),has:()=>pt(e,t),ownKeys:()=>pt(e,t)})}var sn=on("NodeType","it names bpg's internal AST nodes; the legacy AST is bit JSON (see createAst)"),an=on("BoundingBoxIndex","bpg-internal bounding-box utility");function q(e,t){return class{constructor(){pt(e,t);}}}var vo="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",_n=q("Ast",vo),pn=q("BitmarkGenerator",Q),cn=q("BitmarkStringGenerator",Q),dn=q("BitmarkFileGenerator",Q),un=q("JsonGenerator",Q),gn=q("JsonStringGenerator",Q),ln=q("JsonFileGenerator",Q),fn=q("HtmlTableGenerator",Q),bn=q("HtmlTableParser",Q),mn=q("BitmarkParser",Q),wn=q("JsonParser",Q),xn=q("StringWriter",Q),yn=q("FileWriter",Q),kn=q("StreamWriter",Q);var hn={Error:1,Warning:2,Information:3,Hint:4},In={Class:7,Property:10,Value:12,Keyword:14,Snippet:15,EnumMember:20,TypeParameter:25},On={Deprecated:1};function ho(e,t,n){return n===void 0?{path:e,op:t}:{path:e,op:t,value:n}}var Io="all";function Oo(e,t={}){let n=U().convert(e,"bitmark","json",t.mode??"optimized",false,2,1,t.includeUnknownProperties??false,false,"","");return JSON.parse(n)}function To(e,t={}){let n=e.map(o=>o!==null&&typeof o=="object"&&"bit"in o&&typeof o.bit=="object"?o:{bit:o});return U().convert(JSON.stringify(n),"json","bitmark",t.mode??"optimized",false,2,1,false,false,"","")}function we(e,t={}){return U().convert(e,t.inputFormat??"auto",t.outputFormat??"auto",t.mode??"optimized",t.pretty??false,t.indent??2,t.spacesAroundValues??1,t.includeUnknownProperties??false,t.mappingReport??false,t.positionEncoding??"",t.tokensLayout??"")}function Fo(e,t={}){let n=U().convert_with_details(e,t.inputFormat??"auto",t.outputFormat??"auto",t.mode??"optimized",t.pretty??false,t.indent??2,t.spacesAroundValues??1,t.includeUnknownProperties??false,t.mappingReport??false,t.positionEncoding??"",t.tokensLayout??"",t.bitSpans??false);try{let r={output:n.take_data()},o=n.bit_spans();if(o!==void 0){let a=new Array(o.length/3);for(let s=0,i=0;i<o.length;s++,i+=3)a[s]={index:o[i],start:o[i+1],end:o[i+2]};r.bitSpans={positionEncoding:n.bit_spans_encoding(),spans:a};}return r}finally{n.free();}}function Ro(e,t={}){return JSON.parse(we(e,{inputFormat:"bitmark",outputFormat:"semantic-tokens",positionEncoding:t.positionEncoding,tokensLayout:t.tokensLayout}))}function Eo(e,t={}){return JSON.parse(we(e,{inputFormat:"bitmark",outputFormat:"diagnostics",positionEncoding:t.positionEncoding}))}function So(e,t,n={}){let r=U();if(typeof r.complete!="function")throw new at("complete",nt());return JSON.parse(r.complete(e,t.line,t.character,n.positionEncoding??"",n.includeDeprecated??false,n.triggerCharacter??""))}function Bo(e,t,n,r={}){let o=U();if(typeof o.resolve!="function")throw new at("resolve",nt());return JSON.parse(o.resolve(e,t.line,t.character,r.positionEncoding??"",r.includeDeprecated??false,n.label,n.kind))??n}function Po(e,t,n={}){let r=U();if(typeof r.hover!="function")throw new at("hover",nt());return JSON.parse(r.hover(e,t.line,t.character,n.positionEncoding??""))}function Ao(e,t={}){return U().canonicalize(e,t.inputFormat??"auto",t.mode??"optimized",t.pretty??false,t.indent??2,t.spacesAroundValues??1)}function jo(e){return Number.parseInt(U().count_bits(e),10)}function Lo(e,t={}){return JSON.parse(U().split_bits(e,t.positionEncoding??""))}function Co(e,t={}){let n=U();if(t.preHook||t.postHook)return He(n,e,t);let r=t.patch===void 0?"":typeof t.patch=="string"?t.patch:JSON.stringify(t.patch),{data:o,diagnostics:a}=JSON.parse(n.transform(e,t.inputFormat??"auto",t.outputFormat??"json",t.mode??"optimized",r,t.pretty??false,t.indent??2,t.spacesAroundValues??1));if(a.length>0)throw new st(a);return o}function Tn(e,t,n={}){let r=U();if(typeof r.diff!="function")throw new at("diff",nt());return r.diff(e,t,n.inputFormat??"auto",n.outputFormat??"bitmark",n.context??3,n.locate??false,n.similarity??.6,n.bboxTolerance??8,n.spacesAroundValues??0)}function Do(e,t,n={}){return JSON.parse(Tn(e,t,{...n,outputFormat:"json"}))}function Wo(e,t={}){let n=t.format??"bitmark++",r=t.location??"body",o=t.subLocation??"text";return U().breakscape_text(e,n,r,o)}function Jo(e,t={}){let n=t.format??"bitmark++",r=t.location??"body",o=t.subLocation??"text";return U().unbreakscape_text(e,n,r,o)}function Mo(e={}){let t=e.infoType??"list",n=e.format??"text",r=e.bit??"",o=e.pretty??false,a=e.indent??2,s=e.includeDeprecated??false,i=e.onlyDeprecated??false,d=e.full??false,u=typeof e.language=="string"?e.language:e.language?.join(",")??"",g=U();if(n!=="json"&&typeof g.info_text_supported!="function")throw new at('info (format: "text")',nt());return g.info(t,n,r,o,a,s,i,d,u)}function No(e){try{U().register(e.type,e.data);}catch(t){throw new lt(t instanceof Error?t.message:String(t))}Ue(e.type,e.data);}var Vo="./wasm/",Fn={full:{init:te,initSync:Zt,ns:ee,wasmFile:"bitmark_wasm_bg.wasm"},"browser-full":{init:re,initSync:ne,ns:oe,wasmFile:"bitmark_browser_full_wasm_bg.wasm"},"bitmark-json":{init:se,initSync:ie,ns:ae,wasmFile:"bitmark_json_wasm_bg.wasm"}};ze(()=>U());function xe(e){return e===void 0?_e:"full"}function Uo(e){if(e===null||typeof e!="object")return false;if("feature"in e||"module_or_path"in e)return true;let t=Object.getPrototypeOf(e);return (t===Object.prototype||t===null)&&Object.keys(e).length===0}function Ho(e){if(Uo(e))return {feature:e.feature??xe(e.module_or_path),module_or_path:e.module_or_path};let t=e??void 0;return {feature:xe(t),module_or_path:t}}var ye=0,Qt,_t;async function ks(e){let{feature:t,module_or_path:n}=Ho(e);if(n===void 0){if(!_t&&nt()===t)return Qt;if(_t?.feature===t)return _t.promise}let r=++ye,o=Fn[t],a=n??new URL(`${Vo}${o.wasmFile}?v=${St.version}`,import.meta.url),s=(async()=>{try{let i=await o.init({module_or_path:a});r===ye&&(pe(t,o.ns),Qt=i);}finally{_t?.seq===r&&(_t=void 0);}for(;_t;)await _t.promise.catch(()=>{});return Qt})();return _t={feature:t,seq:r,promise:s},s}function vs(e,t={}){let n=t.feature??xe(e),r=Fn[n],o=r.initSync({module:e});return ++ye,_t=void 0,pe(n,r.ns),Qt=o,o}function hs(){return St.version}function Is(e,t={}){let n=U(),r=nt()??_e;return Ge(n,e,t,(o,a)=>Ke(o,a,r))}export{Io as ALL_LANGUAGES,In as CompletionItemKind,On as CompletionItemTag,hn as DiagnosticSeverity,Ut as NotInitializedError,st as PatchError,lt as RegisterError,at as UnsupportedFeatureError,Oo as bitmarkToObjects,Wo as breakscapeText,Ao as canonicalize,So as complete,we as convert,Fo as convertWithDetails,jo as countBits,Eo as diagnostics,Tn as diff,Do as diffBits,Po as hover,Mo as info,ks as init,vs as initSync,vn as legacy,To as objectsToBitmark,ho as patchEntry,No as register,Bo as resolve,Ro as semanticTokens,Lo as splitBits,Co as transform,Is as transformParallel,Jo as unbreakscapeText,nt as variant,hs as version};//# sourceMappingURL=bitmark-parser.min.js.map
1
+ var Ie=Object.defineProperty;var Bn=(e,t,r)=>t in e?Ie(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r;var At=(e,t)=>{for(var r in t)Ie(e,r,{get:t[r],enumerable:true});};var H=(e,t,r)=>Bn(e,typeof t!="symbol"?t+"":t,r);var re={};At(re,{ConvertDetails:()=>Ct,breakscape_text:()=>jn,canonicalize:()=>Qn,complete:()=>zn,convert:()=>rr,convert_text:()=>Vn,convert_with_details:()=>or,count_bits:()=>Zn,default:()=>ne,diff:()=>Gn,hover:()=>Kn,info:()=>Cn,info_text_supported:()=>Dn,initSync:()=>ee,is_bitmark:()=>nr,prettify:()=>Nn,register:()=>Xn,resolve:()=>$n,resolve_patch_document:()=>Hn,split_bits:()=>tr,split_json_bits:()=>Mn,template:()=>qn,template_all:()=>Yn,transform:()=>Un,unbreakscape_text:()=>Ln,version:()=>er});var _,Te=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Te.decode();var ht=null;function jt(){return (ht===null||ht.byteLength===0)&&(ht=new Uint8Array(_.memory.buffer)),ht}function D(e,t){return e=e>>>0,Te.decode(jt().subarray(e,e+t))}var it=new Array(128).fill(void 0);it.push(void 0,null,true,false);var Ot=it.length;function Pn(e){Ot===it.length&&it.push(it.length+1);let t=Ot;return Ot=it[t],it[t]=e,t}var T=0,Lt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},An=typeof Lt.encodeInto=="function"?function(e,t){return Lt.encodeInto(e,t)}:function(e,t){let r=Lt.encode(e);return t.set(r),{read:e.length,written:r.length}};function E(e,t,r){if(r===void 0){let i=Lt.encode(e),d=t(i.length,1)>>>0;return jt().subarray(d,d+i.length).set(i),T=i.length,d}let n=e.length,o=t(n,1)>>>0,s=jt(),a=0;for(;a<n;a++){let i=e.charCodeAt(a);if(i>127)break;s[o+a]=i;}if(a!==n){a!==0&&(e=e.slice(a)),o=r(o,n,n=a+e.length*3,1)>>>0;let i=jt().subarray(o+a,o+n),d=An(e,i);a+=d.written,o=r(o,n,a,1)>>>0;}return T=a,o}function Fe(e){return e==null}var dt=null;function h(){return (dt===null||dt.buffer.detached===true||dt.buffer.detached===void 0&&dt.buffer!==_.memory.buffer)&&(dt=new DataView(_.memory.buffer)),dt}function jn(e,t,r,n){let o,s;try{let l=_.__wbindgen_add_to_stack_pointer(-16),g=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),f=T,x=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),b=T,w=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),m=T;var a=Fe(n)?0:E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),i=T;_.breakscape_text(l,g,f,x,b,w,m,a,i);var d=h().getInt32(l+0,!0),u=h().getInt32(l+4,!0);return o=d,s=u,D(d,u)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(o,s,1);}}function Ln(e,t,r,n){let o,s;try{let l=_.__wbindgen_add_to_stack_pointer(-16),g=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),f=T,x=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),b=T,w=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),m=T;var a=Fe(n)?0:E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),i=T;_.unbreakscape_text(l,g,f,x,b,w,m,a,i);var d=h().getInt32(l+0,!0),u=h().getInt32(l+4,!0);return o=d,s=u,D(d,u)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(o,s,1);}}function Cn(e,t,r,n,o,s,a,i,d){let u,l;try{let x=_.__wbindgen_add_to_stack_pointer(-16),b=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),w=T,m=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),y=T,k=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),v=T,S=E(d,_.__wbindgen_export_0,_.__wbindgen_export_1),A=T;_.info(x,b,w,m,y,k,v,n,o,s,a,i,S,A);var g=h().getInt32(x+0,!0),f=h().getInt32(x+4,!0);return u=g,l=f,D(g,f)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(u,l,1);}}function Dn(){return _.info_text_supported()!==0}function Wn(e){return it[e]}function Jn(e){e<132||(it[e]=Ot,Ot=e);}function q(e){let t=Wn(e);return Jn(e),t}function Mn(e){let t,r;try{let u=_.__wbindgen_add_to_stack_pointer(-16),l=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),g=T;_.split_json_bits(u,l,g);var n=h().getInt32(u+0,!0),o=h().getInt32(u+4,!0),s=h().getInt32(u+8,!0),a=h().getInt32(u+12,!0),i=n,d=o;if(a)throw i=0,d=0,q(s);return t=i,r=d,D(i,d)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(t,r,1);}}function Nn(e,t){let r,n;try{let a=_.__wbindgen_add_to_stack_pointer(-16),i=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),d=T;_.prettify(a,i,d,t);var o=h().getInt32(a+0,!0),s=h().getInt32(a+4,!0);return r=o,n=s,D(o,s)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(r,n,1);}}function Vn(e,t,r,n){let o,s;try{let f=_.__wbindgen_add_to_stack_pointer(-16),x=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),b=T,w=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),m=T,y=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),k=T,v=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),S=T;_.convert_text(f,x,b,w,m,y,k,v,S);var a=h().getInt32(f+0,!0),i=h().getInt32(f+4,!0),d=h().getInt32(f+8,!0),u=h().getInt32(f+12,!0),l=a,g=i;if(u)throw l=0,g=0,q(d);return o=l,s=g,D(l,g)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(o,s,1);}}function Un(e,t,r,n,o,s,a,i){let d,u;try{let m=_.__wbindgen_add_to_stack_pointer(-16),y=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),k=T,v=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),S=T,A=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),j=T,M=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),N=T,V=E(o,_.__wbindgen_export_0,_.__wbindgen_export_1),K=T;_.transform(m,y,k,v,S,A,j,M,N,V,K,s,a,i);var l=h().getInt32(m+0,!0),g=h().getInt32(m+4,!0),f=h().getInt32(m+8,!0),x=h().getInt32(m+12,!0),b=l,w=g;if(x)throw b=0,w=0,q(f);return d=b,u=w,D(b,w)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(d,u,1);}}function Hn(e,t,r){let n,o;try{let g=_.__wbindgen_add_to_stack_pointer(-16),f=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),x=T,b=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),w=T,m=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),y=T;_.resolve_patch_document(g,f,x,b,w,m,y);var s=h().getInt32(g+0,!0),a=h().getInt32(g+4,!0),i=h().getInt32(g+8,!0),d=h().getInt32(g+12,!0),u=s,l=a;if(d)throw u=0,l=0,q(i);return n=u,o=l,D(u,l)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(n,o,1);}}function Gn(e,t,r,n,o,s,a,i,d){let u,l;try{let y=_.__wbindgen_add_to_stack_pointer(-16),k=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),v=T,S=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),A=T,j=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),M=T,N=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),V=T;_.diff(y,k,v,S,A,j,M,N,V,o,s,a,i,d);var g=h().getInt32(y+0,!0),f=h().getInt32(y+4,!0),x=h().getInt32(y+8,!0),b=h().getInt32(y+12,!0),w=g,m=f;if(b)throw w=0,m=0,q(x);return u=w,l=m,D(w,m)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(u,l,1);}}function zn(e,t,r,n,o,s,a){let i,d;try{let w=_.__wbindgen_add_to_stack_pointer(-16),m=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),y=T,k=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),v=T,S=E(s,_.__wbindgen_export_0,_.__wbindgen_export_1),A=T;_.complete(w,m,y,t,r,k,v,o,S,A,a);var u=h().getInt32(w+0,!0),l=h().getInt32(w+4,!0),g=h().getInt32(w+8,!0),f=h().getInt32(w+12,!0),x=u,b=l;if(f)throw x=0,b=0,q(g);return i=x,d=b,D(x,b)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(i,d,1);}}function $n(e,t,r,n,o,s,a,i){let d,u;try{let m=_.__wbindgen_add_to_stack_pointer(-16),y=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),k=T,v=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),S=T,A=E(a,_.__wbindgen_export_0,_.__wbindgen_export_1),j=T;_.resolve(m,y,k,t,r,v,S,o,s,A,j,i);var l=h().getInt32(m+0,!0),g=h().getInt32(m+4,!0),f=h().getInt32(m+8,!0),x=h().getInt32(m+12,!0),b=l,w=g;if(x)throw b=0,w=0,q(f);return d=b,u=w,D(b,w)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(d,u,1);}}function Kn(e,t,r,n){let o,s;try{let f=_.__wbindgen_add_to_stack_pointer(-16),x=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),b=T,w=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),m=T;_.hover(f,x,b,t,r,w,m);var a=h().getInt32(f+0,!0),i=h().getInt32(f+4,!0),d=h().getInt32(f+8,!0),u=h().getInt32(f+12,!0),l=a,g=i;if(u)throw l=0,g=0,q(d);return o=l,s=g,D(l,g)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(o,s,1);}}function qn(e,t,r,n,o,s){let a,i;try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),m=T,y=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),k=T;_.template(b,w,m,y,k,r,n,o,s);var d=h().getInt32(b+0,!0),u=h().getInt32(b+4,!0),l=h().getInt32(b+8,!0),g=h().getInt32(b+12,!0),f=d,x=u;if(g)throw f=0,x=0,q(l);return a=f,i=x,D(f,x)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(a,i,1);}}function Yn(e,t,r){let n,o;try{let i=_.__wbindgen_add_to_stack_pointer(-16);_.template_all(i,e,t,r);var s=h().getInt32(i+0,!0),a=h().getInt32(i+4,!0);return n=s,o=a,D(s,a)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(n,o,1);}}function Xn(e,t){try{let o=_.__wbindgen_add_to_stack_pointer(-16),s=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),a=T,i=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),d=T;_.register(o,s,a,i,d);var r=h().getInt32(o+0,!0),n=h().getInt32(o+4,!0);if(n)throw q(r)}finally{_.__wbindgen_add_to_stack_pointer(16);}}function Qn(e,t,r,n,o,s){let a,i;try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),m=T,y=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),k=T,v=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),S=T;_.canonicalize(b,w,m,y,k,v,S,n,o,s);var d=h().getInt32(b+0,!0),u=h().getInt32(b+4,!0),l=h().getInt32(b+8,!0),g=h().getInt32(b+12,!0),f=d,x=u;if(g)throw f=0,x=0,q(l);return a=f,i=x,D(f,x)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(a,i,1);}}function Zn(e){let t,r;try{let u=_.__wbindgen_add_to_stack_pointer(-16),l=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),g=T;_.count_bits(u,l,g);var n=h().getInt32(u+0,!0),o=h().getInt32(u+4,!0),s=h().getInt32(u+8,!0),a=h().getInt32(u+12,!0),i=n,d=o;if(a)throw i=0,d=0,q(s);return t=i,r=d,D(i,d)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(t,r,1);}}function tr(e,t){let r,n;try{let a=_.__wbindgen_add_to_stack_pointer(-16),i=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),d=T,u=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),l=T;_.split_bits(a,i,d,u,l);var o=h().getInt32(a+0,!0),s=h().getInt32(a+4,!0);return r=o,n=s,D(o,s)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(r,n,1);}}function er(){let e,t;try{let o=_.__wbindgen_add_to_stack_pointer(-16);_.version(o);var r=h().getInt32(o+0,!0),n=h().getInt32(o+4,!0);return e=r,t=n,D(r,n)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(e,t,1);}}function nr(e){let t=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),r=T;return _.is_bitmark(t,r)!==0}function rr(e,t,r,n,o,s,a,i,d,u,l){let g,f;try{let v=_.__wbindgen_add_to_stack_pointer(-16),S=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),A=T,j=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),M=T,N=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),V=T,K=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),tt=T,xt=E(u,_.__wbindgen_export_0,_.__wbindgen_export_1),yt=T,kt=E(l,_.__wbindgen_export_0,_.__wbindgen_export_1),vt=T;_.convert(v,S,A,j,M,N,V,K,tt,o,s,a,i,d,xt,yt,kt,vt);var x=h().getInt32(v+0,!0),b=h().getInt32(v+4,!0),w=h().getInt32(v+8,!0),m=h().getInt32(v+12,!0),y=x,k=b;if(m)throw y=0,k=0,q(w);return g=y,f=k,D(y,k)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(g,f,1);}}function or(e,t,r,n,o,s,a,i,d,u,l,g){try{let w=_.__wbindgen_add_to_stack_pointer(-16),m=E(e,_.__wbindgen_export_0,_.__wbindgen_export_1),y=T,k=E(t,_.__wbindgen_export_0,_.__wbindgen_export_1),v=T,S=E(r,_.__wbindgen_export_0,_.__wbindgen_export_1),A=T,j=E(n,_.__wbindgen_export_0,_.__wbindgen_export_1),M=T,N=E(u,_.__wbindgen_export_0,_.__wbindgen_export_1),V=T,K=E(l,_.__wbindgen_export_0,_.__wbindgen_export_1),tt=T;_.convert_with_details(w,m,y,k,v,S,A,j,M,o,s,a,i,d,N,V,K,tt,g);var f=h().getInt32(w+0,!0),x=h().getInt32(w+4,!0),b=h().getInt32(w+8,!0);if(b)throw q(x);return Ct.__wrap(f)}finally{_.__wbindgen_add_to_stack_pointer(16);}}var It=null;function ir(){return (It===null||It.byteLength===0)&&(It=new Uint32Array(_.memory.buffer)),It}function sr(e,t){return e=e>>>0,ir().subarray(e/4,e/4+t)}var Oe=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>_.__wbg_convertdetails_free(e>>>0,1)),Ct=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,Oe.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Oe.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_convertdetails_free(t,0);}bit_spans_encoding(){try{let n=_.__wbindgen_add_to_stack_pointer(-16);_.convertdetails_bit_spans_encoding(n,this.__wbg_ptr);var t=h().getInt32(n+0,!0),r=h().getInt32(n+4,!0);let o;return t!==0&&(o=D(t,r).slice(),_.__wbindgen_export_2(t,r*1,1)),o}finally{_.__wbindgen_add_to_stack_pointer(16);}}bit_spans(){try{let n=_.__wbindgen_add_to_stack_pointer(-16);_.convertdetails_bit_spans(n,this.__wbg_ptr);var t=h().getInt32(n+0,!0),r=h().getInt32(n+4,!0);let o;return t!==0&&(o=sr(t,r).slice(),_.__wbindgen_export_2(t,r*4,4)),o}finally{_.__wbindgen_add_to_stack_pointer(16);}}take_data(){let t,r;try{let s=_.__wbindgen_add_to_stack_pointer(-16);_.convertdetails_take_data(s,this.__wbg_ptr);var n=h().getInt32(s+0,!0),o=h().getInt32(s+4,!0);return t=n,r=o,D(n,o)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_2(t,r,1);}}};async function ar(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(n){if(e.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 e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else {let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function Ee(){let e={};return e.wbg={},e.wbg.__wbindgen_error_new=function(t,r){let n=new Error(D(t,r));return Pn(n)},e.wbg.__wbindgen_throw=function(t,r){throw new Error(D(t,r))},e}function Re(e,t){return _=e.exports,Se.__wbindgen_wasm_module=t,dt=null,It=null,ht=null,_}function ee(e){if(_!==void 0)return _;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=Ee();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let r=new WebAssembly.Instance(e,t);return Re(r,e)}async function Se(e){if(_!==void 0)return _;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("bitmark_wasm_bg.wasm",import.meta.url));let t=Ee();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:n}=await ar(await e,t);return Re(r,n)}var ne=Se;var se={};At(se,{ConvertDetails:()=>Jt,breakscape_text:()=>cr,canonicalize:()=>Er,complete:()=>vr,convert:()=>Ar,convert_text:()=>wr,convert_with_details:()=>jr,count_bits:()=>Rr,default:()=>ie,diff:()=>kr,hover:()=>Ir,info:()=>ur,info_text_supported:()=>lr,initSync:()=>oe,is_bitmark:()=>Pr,prettify:()=>mr,register:()=>Fr,resolve:()=>hr,resolve_patch_document:()=>yr,split_bits:()=>Sr,split_json_bits:()=>br,template:()=>Or,template_all:()=>Tr,transform:()=>xr,unbreakscape_text:()=>dr,version:()=>Br});var p,Pe=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Pe.decode();var Tt=null;function Dt(){return (Tt===null||Tt.byteLength===0)&&(Tt=new Uint8Array(p.memory.buffer)),Tt}function W(e,t){return e=e>>>0,Pe.decode(Dt().subarray(e,e+t))}var st=new Array(128).fill(void 0);st.push(void 0,null,true,false);var Et=st.length;function _r(e){Et===st.length&&st.push(st.length+1);let t=Et;return Et=st[t],st[t]=e,t}var F=0,Wt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},pr=typeof Wt.encodeInto=="function"?function(e,t){return Wt.encodeInto(e,t)}:function(e,t){let r=Wt.encode(e);return t.set(r),{read:e.length,written:r.length}};function R(e,t,r){if(r===void 0){let i=Wt.encode(e),d=t(i.length,1)>>>0;return Dt().subarray(d,d+i.length).set(i),F=i.length,d}let n=e.length,o=t(n,1)>>>0,s=Dt(),a=0;for(;a<n;a++){let i=e.charCodeAt(a);if(i>127)break;s[o+a]=i;}if(a!==n){a!==0&&(e=e.slice(a)),o=r(o,n,n=a+e.length*3,1)>>>0;let i=Dt().subarray(o+a,o+n),d=pr(e,i);a+=d.written,o=r(o,n,a,1)>>>0;}return F=a,o}function Ae(e){return e==null}var ut=null;function I(){return (ut===null||ut.buffer.detached===true||ut.buffer.detached===void 0&&ut.buffer!==p.memory.buffer)&&(ut=new DataView(p.memory.buffer)),ut}function cr(e,t,r,n){let o,s;try{let l=p.__wbindgen_add_to_stack_pointer(-16),g=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),f=F,x=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),b=F,w=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),m=F;var a=Ae(n)?0:R(n,p.__wbindgen_export_0,p.__wbindgen_export_1),i=F;p.breakscape_text(l,g,f,x,b,w,m,a,i);var d=I().getInt32(l+0,!0),u=I().getInt32(l+4,!0);return o=d,s=u,W(d,u)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(o,s,1);}}function dr(e,t,r,n){let o,s;try{let l=p.__wbindgen_add_to_stack_pointer(-16),g=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),f=F,x=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),b=F,w=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),m=F;var a=Ae(n)?0:R(n,p.__wbindgen_export_0,p.__wbindgen_export_1),i=F;p.unbreakscape_text(l,g,f,x,b,w,m,a,i);var d=I().getInt32(l+0,!0),u=I().getInt32(l+4,!0);return o=d,s=u,W(d,u)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(o,s,1);}}function ur(e,t,r,n,o,s,a,i,d){let u,l;try{let x=p.__wbindgen_add_to_stack_pointer(-16),b=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),w=F,m=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),y=F,k=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),v=F,S=R(d,p.__wbindgen_export_0,p.__wbindgen_export_1),A=F;p.info(x,b,w,m,y,k,v,n,o,s,a,i,S,A);var g=I().getInt32(x+0,!0),f=I().getInt32(x+4,!0);return u=g,l=f,W(g,f)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(u,l,1);}}function lr(){return p.info_text_supported()!==0}function gr(e){return st[e]}function fr(e){e<132||(st[e]=Et,Et=e);}function Y(e){let t=gr(e);return fr(e),t}function br(e){let t,r;try{let u=p.__wbindgen_add_to_stack_pointer(-16),l=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),g=F;p.split_json_bits(u,l,g);var n=I().getInt32(u+0,!0),o=I().getInt32(u+4,!0),s=I().getInt32(u+8,!0),a=I().getInt32(u+12,!0),i=n,d=o;if(a)throw i=0,d=0,Y(s);return t=i,r=d,W(i,d)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(t,r,1);}}function mr(e,t){let r,n;try{let a=p.__wbindgen_add_to_stack_pointer(-16),i=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),d=F;p.prettify(a,i,d,t);var o=I().getInt32(a+0,!0),s=I().getInt32(a+4,!0);return r=o,n=s,W(o,s)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(r,n,1);}}function wr(e,t,r,n){let o,s;try{let f=p.__wbindgen_add_to_stack_pointer(-16),x=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),b=F,w=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),m=F,y=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),k=F,v=R(n,p.__wbindgen_export_0,p.__wbindgen_export_1),S=F;p.convert_text(f,x,b,w,m,y,k,v,S);var a=I().getInt32(f+0,!0),i=I().getInt32(f+4,!0),d=I().getInt32(f+8,!0),u=I().getInt32(f+12,!0),l=a,g=i;if(u)throw l=0,g=0,Y(d);return o=l,s=g,W(l,g)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(o,s,1);}}function xr(e,t,r,n,o,s,a,i){let d,u;try{let m=p.__wbindgen_add_to_stack_pointer(-16),y=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),k=F,v=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),S=F,A=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),j=F,M=R(n,p.__wbindgen_export_0,p.__wbindgen_export_1),N=F,V=R(o,p.__wbindgen_export_0,p.__wbindgen_export_1),K=F;p.transform(m,y,k,v,S,A,j,M,N,V,K,s,a,i);var l=I().getInt32(m+0,!0),g=I().getInt32(m+4,!0),f=I().getInt32(m+8,!0),x=I().getInt32(m+12,!0),b=l,w=g;if(x)throw b=0,w=0,Y(f);return d=b,u=w,W(b,w)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(d,u,1);}}function yr(e,t,r){let n,o;try{let g=p.__wbindgen_add_to_stack_pointer(-16),f=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),x=F,b=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),w=F,m=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),y=F;p.resolve_patch_document(g,f,x,b,w,m,y);var s=I().getInt32(g+0,!0),a=I().getInt32(g+4,!0),i=I().getInt32(g+8,!0),d=I().getInt32(g+12,!0),u=s,l=a;if(d)throw u=0,l=0,Y(i);return n=u,o=l,W(u,l)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(n,o,1);}}function kr(e,t,r,n,o,s,a,i,d){let u,l;try{let y=p.__wbindgen_add_to_stack_pointer(-16),k=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),v=F,S=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),A=F,j=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),M=F,N=R(n,p.__wbindgen_export_0,p.__wbindgen_export_1),V=F;p.diff(y,k,v,S,A,j,M,N,V,o,s,a,i,d);var g=I().getInt32(y+0,!0),f=I().getInt32(y+4,!0),x=I().getInt32(y+8,!0),b=I().getInt32(y+12,!0),w=g,m=f;if(b)throw w=0,m=0,Y(x);return u=w,l=m,W(w,m)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(u,l,1);}}function vr(e,t,r,n,o,s,a){let i,d;try{let w=p.__wbindgen_add_to_stack_pointer(-16),m=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),y=F,k=R(n,p.__wbindgen_export_0,p.__wbindgen_export_1),v=F,S=R(s,p.__wbindgen_export_0,p.__wbindgen_export_1),A=F;p.complete(w,m,y,t,r,k,v,o,S,A,a);var u=I().getInt32(w+0,!0),l=I().getInt32(w+4,!0),g=I().getInt32(w+8,!0),f=I().getInt32(w+12,!0),x=u,b=l;if(f)throw x=0,b=0,Y(g);return i=x,d=b,W(x,b)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(i,d,1);}}function hr(e,t,r,n,o,s,a,i){let d,u;try{let m=p.__wbindgen_add_to_stack_pointer(-16),y=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),k=F,v=R(n,p.__wbindgen_export_0,p.__wbindgen_export_1),S=F,A=R(a,p.__wbindgen_export_0,p.__wbindgen_export_1),j=F;p.resolve(m,y,k,t,r,v,S,o,s,A,j,i);var l=I().getInt32(m+0,!0),g=I().getInt32(m+4,!0),f=I().getInt32(m+8,!0),x=I().getInt32(m+12,!0),b=l,w=g;if(x)throw b=0,w=0,Y(f);return d=b,u=w,W(b,w)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(d,u,1);}}function Ir(e,t,r,n){let o,s;try{let f=p.__wbindgen_add_to_stack_pointer(-16),x=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),b=F,w=R(n,p.__wbindgen_export_0,p.__wbindgen_export_1),m=F;p.hover(f,x,b,t,r,w,m);var a=I().getInt32(f+0,!0),i=I().getInt32(f+4,!0),d=I().getInt32(f+8,!0),u=I().getInt32(f+12,!0),l=a,g=i;if(u)throw l=0,g=0,Y(d);return o=l,s=g,W(l,g)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(o,s,1);}}function Or(e,t,r,n,o,s){let a,i;try{let b=p.__wbindgen_add_to_stack_pointer(-16),w=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),m=F,y=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),k=F;p.template(b,w,m,y,k,r,n,o,s);var d=I().getInt32(b+0,!0),u=I().getInt32(b+4,!0),l=I().getInt32(b+8,!0),g=I().getInt32(b+12,!0),f=d,x=u;if(g)throw f=0,x=0,Y(l);return a=f,i=x,W(f,x)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(a,i,1);}}function Tr(e,t,r){let n,o;try{let i=p.__wbindgen_add_to_stack_pointer(-16);p.template_all(i,e,t,r);var s=I().getInt32(i+0,!0),a=I().getInt32(i+4,!0);return n=s,o=a,W(s,a)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(n,o,1);}}function Fr(e,t){try{let o=p.__wbindgen_add_to_stack_pointer(-16),s=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),a=F,i=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),d=F;p.register(o,s,a,i,d);var r=I().getInt32(o+0,!0),n=I().getInt32(o+4,!0);if(n)throw Y(r)}finally{p.__wbindgen_add_to_stack_pointer(16);}}function Er(e,t,r,n,o,s){let a,i;try{let b=p.__wbindgen_add_to_stack_pointer(-16),w=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),m=F,y=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),k=F,v=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),S=F;p.canonicalize(b,w,m,y,k,v,S,n,o,s);var d=I().getInt32(b+0,!0),u=I().getInt32(b+4,!0),l=I().getInt32(b+8,!0),g=I().getInt32(b+12,!0),f=d,x=u;if(g)throw f=0,x=0,Y(l);return a=f,i=x,W(f,x)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(a,i,1);}}function Rr(e){let t,r;try{let u=p.__wbindgen_add_to_stack_pointer(-16),l=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),g=F;p.count_bits(u,l,g);var n=I().getInt32(u+0,!0),o=I().getInt32(u+4,!0),s=I().getInt32(u+8,!0),a=I().getInt32(u+12,!0),i=n,d=o;if(a)throw i=0,d=0,Y(s);return t=i,r=d,W(i,d)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(t,r,1);}}function Sr(e,t){let r,n;try{let a=p.__wbindgen_add_to_stack_pointer(-16),i=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),d=F,u=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),l=F;p.split_bits(a,i,d,u,l);var o=I().getInt32(a+0,!0),s=I().getInt32(a+4,!0);return r=o,n=s,W(o,s)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(r,n,1);}}function Br(){let e,t;try{let o=p.__wbindgen_add_to_stack_pointer(-16);p.version(o);var r=I().getInt32(o+0,!0),n=I().getInt32(o+4,!0);return e=r,t=n,W(r,n)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(e,t,1);}}function Pr(e){let t=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),r=F;return p.is_bitmark(t,r)!==0}function Ar(e,t,r,n,o,s,a,i,d,u,l){let g,f;try{let v=p.__wbindgen_add_to_stack_pointer(-16),S=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),A=F,j=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),M=F,N=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),V=F,K=R(n,p.__wbindgen_export_0,p.__wbindgen_export_1),tt=F,xt=R(u,p.__wbindgen_export_0,p.__wbindgen_export_1),yt=F,kt=R(l,p.__wbindgen_export_0,p.__wbindgen_export_1),vt=F;p.convert(v,S,A,j,M,N,V,K,tt,o,s,a,i,d,xt,yt,kt,vt);var x=I().getInt32(v+0,!0),b=I().getInt32(v+4,!0),w=I().getInt32(v+8,!0),m=I().getInt32(v+12,!0),y=x,k=b;if(m)throw y=0,k=0,Y(w);return g=y,f=k,W(y,k)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(g,f,1);}}function jr(e,t,r,n,o,s,a,i,d,u,l,g){try{let w=p.__wbindgen_add_to_stack_pointer(-16),m=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),y=F,k=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),v=F,S=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),A=F,j=R(n,p.__wbindgen_export_0,p.__wbindgen_export_1),M=F,N=R(u,p.__wbindgen_export_0,p.__wbindgen_export_1),V=F,K=R(l,p.__wbindgen_export_0,p.__wbindgen_export_1),tt=F;p.convert_with_details(w,m,y,k,v,S,A,j,M,o,s,a,i,d,N,V,K,tt,g);var f=I().getInt32(w+0,!0),x=I().getInt32(w+4,!0),b=I().getInt32(w+8,!0);if(b)throw Y(x);return Jt.__wrap(f)}finally{p.__wbindgen_add_to_stack_pointer(16);}}var Ft=null;function Lr(){return (Ft===null||Ft.byteLength===0)&&(Ft=new Uint32Array(p.memory.buffer)),Ft}function Cr(e,t){return e=e>>>0,Lr().subarray(e/4,e/4+t)}var Be=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>p.__wbg_convertdetails_free(e>>>0,1)),Jt=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,Be.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Be.unregister(this),t}free(){let t=this.__destroy_into_raw();p.__wbg_convertdetails_free(t,0);}bit_spans_encoding(){try{let n=p.__wbindgen_add_to_stack_pointer(-16);p.convertdetails_bit_spans_encoding(n,this.__wbg_ptr);var t=I().getInt32(n+0,!0),r=I().getInt32(n+4,!0);let o;return t!==0&&(o=W(t,r).slice(),p.__wbindgen_export_2(t,r*1,1)),o}finally{p.__wbindgen_add_to_stack_pointer(16);}}bit_spans(){try{let n=p.__wbindgen_add_to_stack_pointer(-16);p.convertdetails_bit_spans(n,this.__wbg_ptr);var t=I().getInt32(n+0,!0),r=I().getInt32(n+4,!0);let o;return t!==0&&(o=Cr(t,r).slice(),p.__wbindgen_export_2(t,r*4,4)),o}finally{p.__wbindgen_add_to_stack_pointer(16);}}take_data(){let t,r;try{let s=p.__wbindgen_add_to_stack_pointer(-16);p.convertdetails_take_data(s,this.__wbg_ptr);var n=I().getInt32(s+0,!0),o=I().getInt32(s+4,!0);return t=n,r=o,W(n,o)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(t,r,1);}}};async function Dr(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(n){if(e.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 e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else {let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function je(){let e={};return e.wbg={},e.wbg.__wbindgen_error_new=function(t,r){let n=new Error(W(t,r));return _r(n)},e.wbg.__wbindgen_throw=function(t,r){throw new Error(W(t,r))},e}function Le(e,t){return p=e.exports,Ce.__wbindgen_wasm_module=t,ut=null,Ft=null,Tt=null,p}function oe(e){if(p!==void 0)return p;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=je();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let r=new WebAssembly.Instance(e,t);return Le(r,e)}async function Ce(e){if(p!==void 0)return p;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("bitmark_browser_full_wasm_bg.wasm",import.meta.url));let t=je();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:n}=await Dr(await e,t);return Le(r,n)}var ie=Ce;var pe={};At(pe,{ConvertDetails:()=>Vt,breakscape_text:()=>Mr,canonicalize:()=>eo,complete:()=>Yr,convert:()=>ao,convert_text:()=>$r,convert_with_details:()=>_o,count_bits:()=>no,default:()=>_e,hover:()=>Qr,info:()=>Vr,initSync:()=>ae,is_bitmark:()=>io,prettify:()=>zr,register:()=>to,resolve:()=>Xr,resolve_patch_document:()=>qr,split_bits:()=>ro,split_json_bits:()=>so,template:()=>Gr,template_all:()=>Zr,transform:()=>Kr,unbreakscape_text:()=>Nr,version:()=>oo});var c,We=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&We.decode();var Rt=null;function Mt(){return (Rt===null||Rt.byteLength===0)&&(Rt=new Uint8Array(c.memory.buffer)),Rt}function J(e,t){return e=e>>>0,We.decode(Mt().subarray(e,e+t))}var at=new Array(128).fill(void 0);at.push(void 0,null,true,false);var Bt=at.length;function Wr(e){Bt===at.length&&at.push(at.length+1);let t=Bt;return Bt=at[t],at[t]=e,t}var B=0,Nt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Jr=typeof Nt.encodeInto=="function"?function(e,t){return Nt.encodeInto(e,t)}:function(e,t){let r=Nt.encode(e);return t.set(r),{read:e.length,written:r.length}};function P(e,t,r){if(r===void 0){let i=Nt.encode(e),d=t(i.length,1)>>>0;return Mt().subarray(d,d+i.length).set(i),B=i.length,d}let n=e.length,o=t(n,1)>>>0,s=Mt(),a=0;for(;a<n;a++){let i=e.charCodeAt(a);if(i>127)break;s[o+a]=i;}if(a!==n){a!==0&&(e=e.slice(a)),o=r(o,n,n=a+e.length*3,1)>>>0;let i=Mt().subarray(o+a,o+n),d=Jr(e,i);a+=d.written,o=r(o,n,a,1)>>>0;}return B=a,o}function Je(e){return e==null}var lt=null;function O(){return (lt===null||lt.buffer.detached===true||lt.buffer.detached===void 0&&lt.buffer!==c.memory.buffer)&&(lt=new DataView(c.memory.buffer)),lt}function Mr(e,t,r,n){let o,s;try{let l=c.__wbindgen_add_to_stack_pointer(-16),g=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),f=B,x=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),b=B,w=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),m=B;var a=Je(n)?0:P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),i=B;c.breakscape_text(l,g,f,x,b,w,m,a,i);var d=O().getInt32(l+0,!0),u=O().getInt32(l+4,!0);return o=d,s=u,J(d,u)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(o,s,1);}}function Nr(e,t,r,n){let o,s;try{let l=c.__wbindgen_add_to_stack_pointer(-16),g=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),f=B,x=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),b=B,w=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),m=B;var a=Je(n)?0:P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),i=B;c.unbreakscape_text(l,g,f,x,b,w,m,a,i);var d=O().getInt32(l+0,!0),u=O().getInt32(l+4,!0);return o=d,s=u,J(d,u)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(o,s,1);}}function Vr(e,t,r,n,o,s,a,i,d){let u,l;try{let x=c.__wbindgen_add_to_stack_pointer(-16),b=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),w=B,m=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),y=B,k=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),v=B,S=P(d,c.__wbindgen_export_0,c.__wbindgen_export_1),A=B;c.info(x,b,w,m,y,k,v,n,o,s,a,i,S,A);var g=O().getInt32(x+0,!0),f=O().getInt32(x+4,!0);return u=g,l=f,J(g,f)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(u,l,1);}}function Ur(e){return at[e]}function Hr(e){e<132||(at[e]=Bt,Bt=e);}function Q(e){let t=Ur(e);return Hr(e),t}function Gr(e,t,r,n,o,s){let a,i;try{let b=c.__wbindgen_add_to_stack_pointer(-16),w=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),m=B,y=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),k=B;c.template(b,w,m,y,k,r,n,o,s);var d=O().getInt32(b+0,!0),u=O().getInt32(b+4,!0),l=O().getInt32(b+8,!0),g=O().getInt32(b+12,!0),f=d,x=u;if(g)throw f=0,x=0,Q(l);return a=f,i=x,J(f,x)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(a,i,1);}}function zr(e,t){let r,n;try{let a=c.__wbindgen_add_to_stack_pointer(-16),i=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),d=B;c.prettify(a,i,d,t);var o=O().getInt32(a+0,!0),s=O().getInt32(a+4,!0);return r=o,n=s,J(o,s)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(r,n,1);}}function $r(e,t,r,n){let o,s;try{let f=c.__wbindgen_add_to_stack_pointer(-16),x=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),b=B,w=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),m=B,y=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),k=B,v=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),S=B;c.convert_text(f,x,b,w,m,y,k,v,S);var a=O().getInt32(f+0,!0),i=O().getInt32(f+4,!0),d=O().getInt32(f+8,!0),u=O().getInt32(f+12,!0),l=a,g=i;if(u)throw l=0,g=0,Q(d);return o=l,s=g,J(l,g)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(o,s,1);}}function Kr(e,t,r,n,o,s,a,i){let d,u;try{let m=c.__wbindgen_add_to_stack_pointer(-16),y=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),k=B,v=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),S=B,A=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),j=B,M=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),N=B,V=P(o,c.__wbindgen_export_0,c.__wbindgen_export_1),K=B;c.transform(m,y,k,v,S,A,j,M,N,V,K,s,a,i);var l=O().getInt32(m+0,!0),g=O().getInt32(m+4,!0),f=O().getInt32(m+8,!0),x=O().getInt32(m+12,!0),b=l,w=g;if(x)throw b=0,w=0,Q(f);return d=b,u=w,J(b,w)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(d,u,1);}}function qr(e,t,r){let n,o;try{let g=c.__wbindgen_add_to_stack_pointer(-16),f=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),x=B,b=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),w=B,m=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),y=B;c.resolve_patch_document(g,f,x,b,w,m,y);var s=O().getInt32(g+0,!0),a=O().getInt32(g+4,!0),i=O().getInt32(g+8,!0),d=O().getInt32(g+12,!0),u=s,l=a;if(d)throw u=0,l=0,Q(i);return n=u,o=l,J(u,l)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(n,o,1);}}function Yr(e,t,r,n,o,s,a){let i,d;try{let w=c.__wbindgen_add_to_stack_pointer(-16),m=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),y=B,k=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),v=B,S=P(s,c.__wbindgen_export_0,c.__wbindgen_export_1),A=B;c.complete(w,m,y,t,r,k,v,o,S,A,a);var u=O().getInt32(w+0,!0),l=O().getInt32(w+4,!0),g=O().getInt32(w+8,!0),f=O().getInt32(w+12,!0),x=u,b=l;if(f)throw x=0,b=0,Q(g);return i=x,d=b,J(x,b)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(i,d,1);}}function Xr(e,t,r,n,o,s,a,i){let d,u;try{let m=c.__wbindgen_add_to_stack_pointer(-16),y=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),k=B,v=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),S=B,A=P(a,c.__wbindgen_export_0,c.__wbindgen_export_1),j=B;c.resolve(m,y,k,t,r,v,S,o,s,A,j,i);var l=O().getInt32(m+0,!0),g=O().getInt32(m+4,!0),f=O().getInt32(m+8,!0),x=O().getInt32(m+12,!0),b=l,w=g;if(x)throw b=0,w=0,Q(f);return d=b,u=w,J(b,w)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(d,u,1);}}function Qr(e,t,r,n){let o,s;try{let f=c.__wbindgen_add_to_stack_pointer(-16),x=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),b=B,w=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),m=B;c.hover(f,x,b,t,r,w,m);var a=O().getInt32(f+0,!0),i=O().getInt32(f+4,!0),d=O().getInt32(f+8,!0),u=O().getInt32(f+12,!0),l=a,g=i;if(u)throw l=0,g=0,Q(d);return o=l,s=g,J(l,g)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(o,s,1);}}function Zr(e,t,r){let n,o;try{let i=c.__wbindgen_add_to_stack_pointer(-16);c.template_all(i,e,t,r);var s=O().getInt32(i+0,!0),a=O().getInt32(i+4,!0);return n=s,o=a,J(s,a)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(n,o,1);}}function to(e,t){try{let o=c.__wbindgen_add_to_stack_pointer(-16),s=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),a=B,i=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),d=B;c.register(o,s,a,i,d);var r=O().getInt32(o+0,!0),n=O().getInt32(o+4,!0);if(n)throw Q(r)}finally{c.__wbindgen_add_to_stack_pointer(16);}}function eo(e,t,r,n,o,s){let a,i;try{let b=c.__wbindgen_add_to_stack_pointer(-16),w=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),m=B,y=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),k=B,v=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),S=B;c.canonicalize(b,w,m,y,k,v,S,n,o,s);var d=O().getInt32(b+0,!0),u=O().getInt32(b+4,!0),l=O().getInt32(b+8,!0),g=O().getInt32(b+12,!0),f=d,x=u;if(g)throw f=0,x=0,Q(l);return a=f,i=x,J(f,x)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(a,i,1);}}function no(e){let t,r;try{let u=c.__wbindgen_add_to_stack_pointer(-16),l=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),g=B;c.count_bits(u,l,g);var n=O().getInt32(u+0,!0),o=O().getInt32(u+4,!0),s=O().getInt32(u+8,!0),a=O().getInt32(u+12,!0),i=n,d=o;if(a)throw i=0,d=0,Q(s);return t=i,r=d,J(i,d)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(t,r,1);}}function ro(e,t){let r,n;try{let a=c.__wbindgen_add_to_stack_pointer(-16),i=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),d=B,u=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),l=B;c.split_bits(a,i,d,u,l);var o=O().getInt32(a+0,!0),s=O().getInt32(a+4,!0);return r=o,n=s,J(o,s)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(r,n,1);}}function oo(){let e,t;try{let o=c.__wbindgen_add_to_stack_pointer(-16);c.version(o);var r=O().getInt32(o+0,!0),n=O().getInt32(o+4,!0);return e=r,t=n,J(r,n)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(e,t,1);}}function io(e){let t=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),r=B;return c.is_bitmark(t,r)!==0}function so(e){let t,r;try{let u=c.__wbindgen_add_to_stack_pointer(-16),l=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),g=B;c.split_json_bits(u,l,g);var n=O().getInt32(u+0,!0),o=O().getInt32(u+4,!0),s=O().getInt32(u+8,!0),a=O().getInt32(u+12,!0),i=n,d=o;if(a)throw i=0,d=0,Q(s);return t=i,r=d,J(i,d)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(t,r,1);}}function ao(e,t,r,n,o,s,a,i,d,u,l){let g,f;try{let v=c.__wbindgen_add_to_stack_pointer(-16),S=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),A=B,j=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),M=B,N=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),V=B,K=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),tt=B,xt=P(u,c.__wbindgen_export_0,c.__wbindgen_export_1),yt=B,kt=P(l,c.__wbindgen_export_0,c.__wbindgen_export_1),vt=B;c.convert(v,S,A,j,M,N,V,K,tt,o,s,a,i,d,xt,yt,kt,vt);var x=O().getInt32(v+0,!0),b=O().getInt32(v+4,!0),w=O().getInt32(v+8,!0),m=O().getInt32(v+12,!0),y=x,k=b;if(m)throw y=0,k=0,Q(w);return g=y,f=k,J(y,k)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(g,f,1);}}function _o(e,t,r,n,o,s,a,i,d,u,l,g){try{let w=c.__wbindgen_add_to_stack_pointer(-16),m=P(e,c.__wbindgen_export_0,c.__wbindgen_export_1),y=B,k=P(t,c.__wbindgen_export_0,c.__wbindgen_export_1),v=B,S=P(r,c.__wbindgen_export_0,c.__wbindgen_export_1),A=B,j=P(n,c.__wbindgen_export_0,c.__wbindgen_export_1),M=B,N=P(u,c.__wbindgen_export_0,c.__wbindgen_export_1),V=B,K=P(l,c.__wbindgen_export_0,c.__wbindgen_export_1),tt=B;c.convert_with_details(w,m,y,k,v,S,A,j,M,o,s,a,i,d,N,V,K,tt,g);var f=O().getInt32(w+0,!0),x=O().getInt32(w+4,!0),b=O().getInt32(w+8,!0);if(b)throw Q(x);return Vt.__wrap(f)}finally{c.__wbindgen_add_to_stack_pointer(16);}}var St=null;function po(){return (St===null||St.byteLength===0)&&(St=new Uint32Array(c.memory.buffer)),St}function co(e,t){return e=e>>>0,po().subarray(e/4,e/4+t)}var De=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>c.__wbg_convertdetails_free(e>>>0,1)),Vt=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,De.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,De.unregister(this),t}free(){let t=this.__destroy_into_raw();c.__wbg_convertdetails_free(t,0);}bit_spans_encoding(){try{let n=c.__wbindgen_add_to_stack_pointer(-16);c.convertdetails_bit_spans_encoding(n,this.__wbg_ptr);var t=O().getInt32(n+0,!0),r=O().getInt32(n+4,!0);let o;return t!==0&&(o=J(t,r).slice(),c.__wbindgen_export_2(t,r*1,1)),o}finally{c.__wbindgen_add_to_stack_pointer(16);}}bit_spans(){try{let n=c.__wbindgen_add_to_stack_pointer(-16);c.convertdetails_bit_spans(n,this.__wbg_ptr);var t=O().getInt32(n+0,!0),r=O().getInt32(n+4,!0);let o;return t!==0&&(o=co(t,r).slice(),c.__wbindgen_export_2(t,r*4,4)),o}finally{c.__wbindgen_add_to_stack_pointer(16);}}take_data(){let t,r;try{let s=c.__wbindgen_add_to_stack_pointer(-16);c.convertdetails_take_data(s,this.__wbg_ptr);var n=O().getInt32(s+0,!0),o=O().getInt32(s+4,!0);return t=n,r=o,J(n,o)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(t,r,1);}}};async function uo(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(n){if(e.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 e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else {let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function Me(){let e={};return e.wbg={},e.wbg.__wbindgen_error_new=function(t,r){let n=new Error(J(t,r));return Wr(n)},e.wbg.__wbindgen_throw=function(t,r){throw new Error(J(t,r))},e}function Ne(e,t){return c=e.exports,Ve.__wbindgen_wasm_module=t,lt=null,St=null,Rt=null,c}function ae(e){if(c!==void 0)return c;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=Me();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let r=new WebAssembly.Instance(e,t);return Ne(r,e)}async function Ve(e){if(c!==void 0)return c;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("bitmark_json_wasm_bg.wasm",import.meta.url));let t=Me();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:n}=await uo(await e,t);return Ne(r,n)}var _e=Ve;var rt={name:"@gmb/bitmark-parser",version:"7.9.0"};var ce="browser-full",Ut=class extends Error{constructor(){super("wasm not initialised: call init() (or init({ feature: \u2026 })) first"),this.name="NotInitializedError";}},bt=class extends Error{constructor(t){super(t),this.name="RegisterError";}},_t=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
+ `));H(this,"diagnostics");this.name="PatchError",this.diagnostics=r;}},ot=class extends Error{constructor(t,r){super(`${t} is not available in the loaded wasm module${r?` (feature: "${r}")`:""}; init({ feature: "full" }) to load it`),this.name="UnsupportedFeatureError";}},ft,He,Ue,Ge=new Map;function U(){if(!ft&&Ue&&Ue(),!ft)throw new Ut;return ft}function de(e,t){for(let[r,n]of Ge)try{t.register(r,n);}catch(o){throw new bt(o instanceof Error?o.message:String(o))}ft=t,He=e;}function ze(e,t){Ge.set(e,t);}function et(){return He}function Ht(e){return ft?ft.version():e}function lo(e){let t=e.trim();return t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1):e}function go(e){return e===void 0?"":typeof e=="string"?e.trim():JSON.stringify(e)}function fo(e,t,r){if(r){let o=JSON.parse(e.split_bits(t,"utf-8"));return o.map(s=>({view:{format:"bitmark",index:s.index,total:o.length,source:s.source},source:s.source}))}let n=JSON.parse(e.split_json_bits(t));return n.map((o,s)=>({view:{format:"json",index:s,total:n.length,bit:o.bit??{}},source:JSON.stringify([o])}))}function ue(e,t,r){let n=r.mode??"optimized",o=r.outputFormat??"json",s=r.spacesAroundValues??1,a=r.indent??2,i=r.pretty??false,d=r.inputFormat??"auto",u=d==="bitmark"||d!=="json"&&e.is_bitmark(t),l=u?"bitmark":"json";e.transform("","bitmark",o,n,"",false,a,s);let g=fo(e,t,u),f=g.length,x=[];for(let k=0;k<f;k++){let{view:v}=g[k];v.index=k,v.total=f;let S=r.preHook?r.preHook(v)||{}:{};x.push(S.drop?null:{patches:S.patches??[],outputFormat:S.outputFormat??o});}let b=go(r.patch),w;b===""?w=g.map((k,v)=>({source:v,bit:null,patch:[]})):w=JSON.parse(e.resolve_patch_document(t,l,b));let m=[],y=[];for(let k of w)if(k.source!==null){let v=x[k.source];if(!v)continue;m.push({index:k.source,source:g[k.source].source,inputFormat:l,outputFormat:v.outputFormat,mode:n,patchJson:JSON.stringify([...k.patch,...v.patches]),spacesAroundValues:s}),y.push(g[k.source].view);}else if(typeof k.bit=="string"){let v=m.length;m.push({index:v,source:k.bit,inputFormat:"bitmark",outputFormat:o,mode:n,patchJson:JSON.stringify(k.patch),spacesAroundValues:s}),y.push({format:"bitmark",index:v,total:f,source:k.bit});}else {let v=k.bit??{},S=m.length;m.push({index:S,source:JSON.stringify([{bit:v}]),inputFormat:"json",outputFormat:o,mode:n,patchJson:JSON.stringify(k.patch),spacesAroundValues:s}),y.push({format:"json",index:S,total:f,bit:v});}return {jobs:m,views:y,output:o,pretty:i,indent:a}}function bo(e,t){let{data:r,diagnostics:n}=JSON.parse(e);return {element:t==="json"?lo(r):r,diagnostics:n}}function mo(e,t){return bo(e.transform(t.source,t.inputFormat,t.outputFormat,t.mode,t.patchJson,false,2,t.spacesAroundValues),t.outputFormat)}function le(e,t,r,n,o){if(r!=="json")return t.join(`
4
+ `);let s=`[${t.join(",")}]`;return n?e.prettify(s,o):s}function $e(e,t,r){let n=ue(e,t,r),o=[],s=[];for(let a=0;a<n.jobs.length;a++){let{element:i,diagnostics:d}=mo(e,n.jobs[a]);s.push(...d),r.postHook?.(n.views[a],i),o.push(i);}if(s.length>0)throw new _t(s);return le(e,o,n.output,n.pretty,n.indent)}async function Ke(e,t,r,n){let o=ue(e,t,r),s=await n(o.jobs,r.workers??4),a=[],i=[];for(let d=0;d<s.length;d++)a.push(s[d].element),i.push(...s[d].diagnostics),r.postHook?.(o.views[d],s[d].element);if(i.length>0)throw new _t(i);return le(e,a,o.output,o.pretty,o.indent)}var ge;function qe(e){ge=e;}function G(){if(!ge)throw new Error("legacy API not initialised: the WASM module has not been provided (browser consumers must call init() first)");return ge()}function Ye(e,t,r){if(e.length===0)return Promise.resolve([]);let n=Math.max(1,Math.min(t,e.length));return new Promise((o,s)=>{let a=new Array(e.length),i=0,d=0,u=false,l=[],g=x=>{if(!u){u=true;for(let b of l)b.terminate();x?s(x):o(a);}},f=x=>{if(u||i>=e.length)return;let b=i++;x.post({id:b,job:e[b]});};for(let x=0;x<n;x++){let b=r(w=>{if(!u){if(!w.ok)return g(new Error(w.error??"worker job failed"));a[w.id]={element:w.element,diagnostics:w.diagnostics??[]},++d===e.length?g():f(b);}},g);l.push(b);}for(let x of l)f(x);})}function xo(e,t,r){let n=`/${t}@`,o=e.pathname.indexOf(n);if(o===-1)return e;let s=o+n.length,a=e.pathname.indexOf("/",s);if(a===-1)return e;let i=new URL(e.href);return i.pathname=e.pathname.slice(0,s)+r+e.pathname.slice(a),i}function zt(e,t){return xo(new URL(e,t),rt.name,rt.version)}function fe(e){let t;try{t=e.version?.();}catch{t=void 0;}if(t!==rt.version)throw new Error(`version-mismatch: the bitmark-parser wasm is ${t??"an older release"}, but this script is ${rt.version}; load both from the same version`)}function Xe(e,t,r){let n=zt("./worker-entry.js",import.meta.url);return Ye(e,t,(o,s)=>{let a=new Worker(n,{type:"module"});return a.onmessage=i=>o(i.data),a.onerror=i=>s(new Error(i.message||"worker error")),{post:i=>a.postMessage({...i,feature:r}),terminate:()=>a.terminate()}})}var On={};At(On,{Ast:()=>dn,BitType:()=>an,BitmarkFileGenerator:()=>gn,BitmarkGenerator:()=>un,BitmarkParser:()=>yn,BitmarkParserGenerator:()=>Qt,BitmarkParserType:()=>Ro,BitmarkStringGenerator:()=>ln,BitmarkVersion:()=>Fo,BodyTextFormat:()=>Po,BoundingBoxIndex:()=>cn,Builder:()=>Xt,CardSetVersion:()=>Eo,FileWriter:()=>hn,HtmlTableGenerator:()=>wn,HtmlTableParser:()=>xn,InfoFormat:()=>Bo,InfoType:()=>So,Input:()=>Io,InputFormat:()=>To,JsonFileGenerator:()=>mn,JsonGenerator:()=>fn,JsonParser:()=>kn,JsonStringGenerator:()=>bn,LegacyUnsupportedError:()=>mt,NodeType:()=>pn,Output:()=>Oo,ResourceBuilder:()=>Zt,StreamWriter:()=>In,StringWriter:()=>vn,TextLocation:()=>Ao,TextMarkType:()=>on,TextNodeType:()=>sn,bitmarkTextParse:()=>nn,isPseudoAst:()=>Ze});var mt=class extends Error{constructor(t){super(t),this.name="LegacyUnsupportedError";}};function ct(e,t){throw new mt(`'${e}' is not supported by the @gmb/bitmark-parser legacy API`+(t?`: ${t}`:""))}function nt(e,t){throw new mt(`Option '${e}' is not supported by the @gmb/bitmark-parser legacy API`+(t?`: ${t}`:""))}var be="bitmark v2 output is not supported (this parser is bitmark v3 only)";function me(e){e.bitmarkVersion===2&&nt("bitmarkVersion: 2",be);}function $t(e){e.explicitTextFormat&&nt("bitmarkOptions.explicitTextFormat"),e.cardSetVersion===1&&nt("bitmarkOptions.cardSetVersion: 1",be),e.debugGenerationInline&&nt("bitmarkOptions.debugGenerationInline"),e.noBreakscaping&&nt("bitmarkOptions.noBreakscaping");}function Kt(e){e.textAsPlainText&&nt("jsonOptions.textAsPlainText",be),e.debugGenerationInline&&nt("jsonOptions.debugGenerationInline");}function gt(e){return e===true?{pretty:true,indent:2}:typeof e=="number"&&e>0?{pretty:true,indent:e}:{pretty:false,indent:2}}function qt(e){return e===void 0||e===true?1:e===false?0:Math.max(0,Math.min(10,e))}function Yt(e){switch(e){case "text":case "latex":case "json":case "xml":return "plainText";default:return "bitmark++"}}var Qe=Symbol.for("@gmb/bitmark-parser/legacy-pseudo-ast");function wt(e){let t={bits:e};return Object.defineProperty(t,Qe,{value:true,enumerable:false}),t}function Ze(e){return e!==null&&typeof e=="object"&&(Qe in e||Array.isArray(e.bits))}var tn={"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 we=Symbol.for("@gmb/bitmark-parser/legacy-built-bit-parser"),yo={bitType:"type",textFormat:"format",flashcards:"cards",markConfig:"marks"},ko={"bitmark--":"bitmark++","bitmark+":"bitmark++"},vo={bitmark:"bitmark++",text:"text",json:"json",latex:"latex",xml:"xml"},ho=["title","subtitle","item","lead","pageNumber","marginNumber","hint","instruction","caption"],Xt=class{buildBitmark(t){let r=wt(t.bits??[]);return t.errors!==void 0&&(r.errors=t.errors),r}buildBit(t,r){let n=G(),o={...t},s=o.bitType,a=this.getBitConfig(s),i={};i.type=s,o.isCommented&&(i.type="_comment",i.originalType=s),delete o.bitType,delete o.isCommented;let d=o.textFormat;d!==void 0?(i.format=ko[d]??d,delete o.textFormat):i.format=vo[a.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&&s!==void 0){let m=Array.isArray(l)?l:[l],y=tn[s];y?i[y.key]=m.filter(k=>k!==null&&typeof k=="object"&&k.type===y.resourceType):m.length>=1&&(i.resource=m[0]),delete o.resources;}let g=o.parser;delete o.parser;let f=o.extraProperties;delete o.extraProperties;for(let[m,y]of Object.entries(o))y!==void 0&&(i[yo[m]??m]=y);if(f)for(let[m,y]of Object.entries(f))m in i||(i[m]=y);this.parseStringTexts(i);let x=n.convert(JSON.stringify([{bit:i}]),"json","json","optimized",false,2,1,false,false,"",""),w=JSON.parse(x)[0]?.bit??i;for(let[m,y]of Object.entries(i))m in w||y===false||y===""||y===null||Array.isArray(y)&&y.length===0||(w[m]=y);return g!==void 0&&Object.defineProperty(w,we,{value:g,enumerable:false}),w}buildHighlight(t,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,...en(i,["text","isCorrect","isHighlighted"])})):[],prefix:n.prefix??"",postfix:n.postfix??"",...en(n,["type","texts","prefix","postfix","attrs"]),attrs:{}}}parseStringTexts(t){let r=G(),n=(a,i)=>{if(a==="")return a;let d=r.convert_text(a,"textToAst","bitmark++",i);try{return JSON.parse(d)}catch{return a}},o=t.format,s=o===void 0||o==="bitmark++"||o==="bitmark+";if(typeof t.body=="string")if(o==="json")try{t.body=JSON.parse(t.body);}catch{t.body=null;}else s&&(t.body=n(t.body,"body"));for(let a of ho){let i=t[a];typeof i=="string"&&(t[a]=n(i,"tag"));}}getBitConfig(t){let r=G();if(t!==void 0)try{let n=JSON.parse(r.info("bit","json",t,!1,2,!1,!1,!0,""));if(n.error===void 0)return {bodyFormat:n.body?.format}}catch{}throw new Error(`No config found for bit: ${t}`)}};function en(e,t){let r={};for(let[n,o]of Object.entries(e))o!==void 0&&!t.includes(n)&&(r[n]=o);return r}var Qt=class{version(){return Ht(rt.version)}convert(t,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),s=Object.assign({},n.bitmarkOptions);me(n),$t(s),Kt(o),this.checkBrowserFileWrite(n.outputFile);let a=G(),{source:i,isBitmark:d}=this.resolveInput(t,n.inputFormat),u=n.outputFormat??(d?"json":"bitmark"),l=u==="ast"?"json":u,{pretty:g,indent:f}=gt(o.prettify),x=l==="bitmark"?gt(s.prettifyJson):{pretty:g,indent:f},b=qt(s.spacesAroundValues),w=!o.excludeUnknownProperties,m=a.convert(i,d?"bitmark":"json",l,"optimized",x.pretty,x.indent,b,w,false,"","");if(u==="bitmark"||u==="text")return this.deliver(m,n.outputFile,n.fileOptions);if(u==="json")return n.outputFile?this.deliver(m,n.outputFile,n.fileOptions):g||o.stringify?m:JSON.parse(m);let y=wt(JSON.parse(m));return n.outputFile?this.deliver(JSON.stringify(y),n.outputFile,n.fileOptions):y}upgrade(t,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),s=Object.assign({},n.bitmarkOptions);me(n),$t(s),Kt(o),this.checkBrowserFileWrite(n.outputFile);let a=G(),{source:i,isBitmark:d}=this.resolveInput(t,n.inputFormat),{pretty:u,indent:l}=gt(d?s.prettifyJson:o.prettify),g=qt(s.spacesAroundValues),f=a.canonicalize(i,d?"bitmark":"json","optimized",u,l,g);return d?this.deliver(f,n.outputFile,n.fileOptions):n.outputFile?this.deliver(f,n.outputFile,n.fileOptions):u||o.stringify?f:JSON.parse(f)}info(t){let r=Object.assign({},t),n=G(),o=r.type??"list",s=r.outputFormat??"text",{pretty:a,indent:i}=gt(r.prettify),d=s==="pojo"?"json":s,u=n.info(o,d,r.bit??"",a,i,false,false,true,"");return s==="pojo"?JSON.parse(u):u}generateConfig(t){ct("BitmarkParserGenerator.generateConfig","bpg-internal development tool");}convertHtmlTable(t,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),s=Object.assign({},n.bitmarkOptions);$t(s),Kt(o),n.keepUnknownTags&&nt("keepUnknownTags"),n.noBreakscaping&&nt("noBreakscaping"),this.checkBrowserFileWrite(n.outputFile);let a=G(),i=typeof t=="string"?this.maybeReadFile(t,void 0):"";if(!(n.inputFormat==="html"||n.inputFormat===void 0&&typeof t=="string"&&/<table[\s>]/iu.test(i))){let{source:k,isBitmark:v}=this.resolveInput(t,void 0),S=a.convert(k,v?"bitmark":"json","html","optimized",false,2,1,false,false,"","");return this.deliver(xe(S).join(`
5
+ `),n.outputFile,n.fileOptions)}let u=n.tableFormat==="table"?"table":"table-extended",l=xe(i).map(k=>`<bitmark-bit data-type="${u}" data-format="bitmark++">${k}</bitmark-bit>`).join(""),g=n.outputFormat??"bitmark",{pretty:f,indent:x}=gt(o.prettify),b=qt(s.spacesAroundValues);if(g==="html"){let k=a.convert(l,"html","html","optimized",false,2,1,false,false,"","");return this.deliver(xe(k).join(`
6
+ `),n.outputFile,n.fileOptions)}let w=g==="ast"?"json":g,m=a.convert(l,"html",w,"optimized",f,x,b,false,false,"","");if(g==="bitmark"||g==="text")return this.deliver(m,n.outputFile,n.fileOptions);if(g==="json")return n.outputFile?this.deliver(m,n.outputFile,n.fileOptions):f||o.stringify?m:JSON.parse(m);let y=wt(JSON.parse(m));return n.outputFile?this.deliver(JSON.stringify(y),n.outputFile,n.fileOptions):y}createAst(t,r){let n=Object.assign({},r),o=G(),{source:s,isBitmark:a}=this.resolveInput(t,n.inputFormat),i=o.convert(s,a?"bitmark":"json","json","optimized",false,2,1,true,false,"","");return wt(JSON.parse(i))}breakscapeText(t,r){if(!t)return t;let n=Object.assign({},r);this.checkBrowserFileWrite(n.outputFile);let o=G(),s=this.maybeReadFile(t,n.inputFormat),a=o.breakscape_text(s,Yt(n.textFormat),n.textLocation??"body");return this.deliver(a,n.outputFile,n.fileOptions)}unbreakscapeText(t,r){if(!t)return t;let n=Object.assign({},r);this.checkBrowserFileWrite(n.outputFile);let o=G(),s=this.maybeReadFile(t,n.inputFormat),a=o.unbreakscape_text(s,Yt(n.textFormat),n.textLocation??"body");return this.deliver(a,n.outputFile,n.fileOptions)}convertText(t,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions);this.checkBrowserFileWrite(n.outputFile);let s=G(),a=n.textFormat===void 0||Yt(n.textFormat)==="bitmark++",i=n.textLocation??"body",d,u;if(typeof t=="string"?(d=this.maybeReadFile(t,n.inputFormat),u=this.parseTextAstString(d)):(d=JSON.stringify(t),u=Array.isArray(t)?t:void 0),u!==void 0){let b=a?s.convert_text(JSON.stringify(u),"astToText","bitmark++",i):s.convert_text(JSON.stringify(u),"astToPlainText","plainText",i);return this.deliver(b,n.outputFile,n.fileOptions)}let l=s.convert_text(d,"textToAst",a?"bitmark++":"plainText","body"),{pretty:g,indent:f}=gt(o.prettify),x=g?s.prettify(l,f):l;return n.outputFile?this.deliver(x,n.outputFile,n.fileOptions):g?x:JSON.parse(l)}textAstToPlainText(t,r){return G().convert_text(typeof t=="string"?t:JSON.stringify(t),"astToPlainText","bitmark++","body")}extractPlainText(t,r){let n=r?.inputFormat,o=G();if(n==="plainText")return typeof t=="string"?String(t):"";if(n==="bitmarkText"){let d=o.convert_text(String(t),"textToAst","bitmark++","body");return o.convert_text(d,"astToPlainText","bitmark++","body")}if(typeof t=="string"&&this.parseTextAstString(t)===void 0&&!o.is_bitmark(t)&&!(()=>{try{return JSON.parse(t),!0}catch{return false}})())return this.extractPlainText(t,{inputFormat:"bitmarkText"});let{source:s,isBitmark:a}=this.resolveInput(t,void 0);return o.convert(s,a?"bitmark":"json","text","optimized",false,2,1,false,false,"","")}parseTextAstString(t){let r=t.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(t,r){if(typeof t!="string"){let s=this.jsonEntries(t);return {source:JSON.stringify(s?s.map(a=>this.toWrapperEntry(a)):t),isBitmark:false}}let n=this.maybeReadFile(t,r);if(G().is_bitmark(n))return {source:n,isBitmark:true};try{let s=JSON.parse(n),a=this.jsonEntries(s);if(a)return {source:JSON.stringify(a.map(i=>this.toWrapperEntry(i))),isBitmark:!1}}catch{return {source:n,isBitmark:true}}return {source:n,isBitmark:false}}jsonEntries(t){if(Array.isArray(t))return t;if(t!==null&&typeof t=="object"){let r=t;if(Array.isArray(r.bits))return r.bits;if("bit"in r)return [r];if(typeof r.type=="string")return [{bit:r}]}}toWrapperEntry(t){if(t!==null&&typeof t=="object"&&"bit"in t)return t;let r={bit:t},n=t?.[we];return n!==void 0&&(r.parser=n),r}maybeReadFile(t,r){if(r==="string")return t;return t;}checkBrowserFileWrite(t){if(t&&true)throw new Error("Cannot write to file in browser environment")}deliver(t,r,n){if(!r)return t;throw new Error("Cannot write to file in browser environment");}};function xe(e){let t=[],r=e.toLowerCase(),n=0;for(;;){let o=r.indexOf("<table",n);if(o===-1)break;let s=0,a=o,i=-1;for(;a<e.length;){let d=r.indexOf("<table",a),u=r.indexOf("</table",a);if(u===-1)break;if(d!==-1&&d<u)s++,a=d+6;else {s--;let l=r.indexOf(">",u);if(a=l===-1?e.length:l+1,s===0){i=a;break}}}if(i===-1)break;t.push(e.slice(o,i)),n=i;}return t}function nn(e){let t=G().convert_text(e,"textToAst","bitmark++","body");return JSON.parse(t)}var $={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 z(e){return (t,r,n)=>{if(!r)return;let{value:o,...s}=r,a={[e.valueField]:o??""};for(let[i,d]of Object.entries(s))d!==void 0&&(a[i]=d);return {type:e.type,[e.key]:a}}}var rn=Object.fromEntries(Object.values($).map(e=>[e.type,e])),Zt=class{constructor(){H(this,"imageResource",z($.imageResource));H(this,"imageLinkResource",z($.imageLinkResource));H(this,"audioResource",z($.audioResource));H(this,"audioEmbedResource",z($.audioEmbedResource));H(this,"audioLinkResource",z($.audioLinkResource));H(this,"videoResource",z($.videoResource));H(this,"videoEmbedResource",z($.videoEmbedResource));H(this,"videoLinkResource",z($.videoLinkResource));H(this,"stillImageFilmEmbedResource",z($.stillImageFilmEmbedResource));H(this,"stillImageFilmLinkResource",z($.stillImageFilmLinkResource));H(this,"articleResource",z($.articleResource));H(this,"documentResource",z($.documentResource));H(this,"documentEmbedResource",z($.documentEmbedResource));H(this,"documentLinkResource",z($.documentLinkResource));H(this,"documentDownloadResource",z($.documentDownloadResource));H(this,"appLinkResource",z($.appLinkResource));H(this,"websiteLinkResource",z($.websiteLinkResource));}resourceFromResourceJson(t,r){if(!r)return;let n=!Array.isArray(r),o=n?[r]:r,s=[];for(let a of o){let i=rn[a.type];if(!i)continue;let d=a[i.key]??{},{[i.valueField]:u,...l}=d,g=z(i)(void 0,{value:u,...l});g&&s.push(g);}if(s.length!==0)return n?s[0]:s}resourceFromResourceDataJson(t,r,n){if(!n)return;let o=rn[r];if(!o)return;let s=typeof n=="string"?n:void 0,a=typeof n=="object"?n:{},{url:i,src:d,body:u,...l}=a,g=i??d??u??s;return z(o)(t,{value:g,...l})}};var Io={string:"string",file:"file"},Oo={bitmark:"bitmark",json:"json",ast:"ast",text:"text"},To={bitmark:"bitmark",bitmarkText:"bitmarkText",plainText:"plainText",html:"html"},Fo={v2:2,v3:3},Eo={v1:1,v2:2},Ro={peggy:"peggy"},So={list:"list",deprecated:"deprecated",all:"all",bit:"bit"},Bo={text:"text",json:"json",pojo:"pojo"},Po={plainText:"text",latex:"latex",json:"json",xml:"xml",bitmarkPlusPlus:"bitmark++"},Ao={tag:"tag",body:"body",cardBody:"cardBody"};var on={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"},sn={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 jo(e){return e.replace(/-([a-z0-9])/gu,(t,r)=>r.toUpperCase())}var ye;function Pt(){if(!ye){let e=G(),t=JSON.parse(e.info("all","json","",false,2,true,false,false,"")),r={_standard:"_standard"};for(let{name:n}of t)r[jo(n)]=n;ye=r;}return ye}var an=new Proxy({},{get:(e,t)=>typeof t=="string"?Pt()[t]:void 0,has:(e,t)=>typeof t=="string"&&t in Pt(),ownKeys:()=>Reflect.ownKeys(Pt()),getOwnPropertyDescriptor:(e,t)=>typeof t=="string"&&t in Pt()?{value:Pt()[t],enumerable:true,configurable:true,writable:false}:void 0});function _n(e,t){return new Proxy({},{get:(r,n)=>n===Symbol.toPrimitive||n==="toString"||n===Symbol.toStringTag?()=>`[unsupported ${e}]`:ct(e,t),has:()=>ct(e,t),ownKeys:()=>ct(e,t)})}var pn=_n("NodeType","it names bpg's internal AST nodes; the legacy AST is bit JSON (see createAst)"),cn=_n("BoundingBoxIndex","bpg-internal bounding-box utility");function X(e,t){return class{constructor(){ct(e,t);}}}var Lo="the legacy AST is bit JSON, not bpg's internal node model; walking it with bpg NodeType names would silently misbehave",Z="internal class of bpg's TS implementation",dn=X("Ast",Lo),un=X("BitmarkGenerator",Z),ln=X("BitmarkStringGenerator",Z),gn=X("BitmarkFileGenerator",Z),fn=X("JsonGenerator",Z),bn=X("JsonStringGenerator",Z),mn=X("JsonFileGenerator",Z),wn=X("HtmlTableGenerator",Z),xn=X("HtmlTableParser",Z),yn=X("BitmarkParser",Z),kn=X("JsonParser",Z),vn=X("StringWriter",Z),hn=X("FileWriter",Z),In=X("StreamWriter",Z);var Tn={Error:1,Warning:2,Information:3,Hint:4},Fn={Class:7,Property:10,Value:12,Keyword:14,Snippet:15,EnumMember:20,TypeParameter:25},En={Deprecated:1};function Co(e,t,r){return r===void 0?{path:e,op:t}:{path:e,op:t,value:r}}var Do="all";function Wo(e,t={}){let r=U().convert(e,"bitmark","json",t.mode??"optimized",false,2,1,t.includeUnknownProperties??false,false,"","");return JSON.parse(r)}function Jo(e,t={}){let r=e.map(o=>o!==null&&typeof o=="object"&&"bit"in o&&typeof o.bit=="object"?o:{bit:o});return U().convert(JSON.stringify(r),"json","bitmark",t.mode??"optimized",false,2,1,false,false,"","")}function ke(e,t={}){return U().convert(e,t.inputFormat??"auto",t.outputFormat??"auto",t.mode??"optimized",t.pretty??false,t.indent??2,t.spacesAroundValues??1,t.includeUnknownProperties??false,t.mappingReport??false,t.positionEncoding??"",t.tokensLayout??"")}function Mo(e,t={}){let r=U().convert_with_details(e,t.inputFormat??"auto",t.outputFormat??"auto",t.mode??"optimized",t.pretty??false,t.indent??2,t.spacesAroundValues??1,t.includeUnknownProperties??false,t.mappingReport??false,t.positionEncoding??"",t.tokensLayout??"",t.bitSpans??false);try{let n={output:r.take_data()},o=r.bit_spans();if(o!==void 0){let s=new Array(o.length/5);for(let a=0,i=0;i<o.length;a++,i+=5)s[a]={index:o[i],inputStart:o[i+1],inputEnd:o[i+2],outputStart:o[i+3],outputEnd:o[i+4]};n.bitSpans={positionEncoding:r.bit_spans_encoding(),spans:s};}return n}finally{r.free();}}function No(e,t={}){return JSON.parse(ke(e,{inputFormat:"bitmark",outputFormat:"semantic-tokens",positionEncoding:t.positionEncoding,tokensLayout:t.tokensLayout}))}function Vo(e,t={}){return JSON.parse(ke(e,{inputFormat:"bitmark",outputFormat:"diagnostics",positionEncoding:t.positionEncoding}))}function Uo(e,t,r={}){let n=U();if(typeof n.complete!="function")throw new ot("complete",et());return JSON.parse(n.complete(e,t.line,t.character,r.positionEncoding??"",r.includeDeprecated??false,r.triggerCharacter??"",r.bitTemplate??false))}function Ho(e,t,r,n={}){let o=U();if(typeof o.resolve!="function")throw new ot("resolve",et());return JSON.parse(o.resolve(e,t.line,t.character,n.positionEncoding??"",n.includeDeprecated??false,n.bitTemplate??false,r.label,r.kind))??r}function Go(e,t,r={}){let n=U();if(typeof n.hover!="function")throw new ot("hover",et());return JSON.parse(n.hover(e,t.line,t.character,r.positionEncoding??""))}function zo(e,t={}){return U().canonicalize(e,t.inputFormat??"auto",t.mode??"optimized",t.pretty??false,t.indent??2,t.spacesAroundValues??1)}function $o(e){return Number.parseInt(U().count_bits(e),10)}function Ko(e,t={}){return JSON.parse(U().split_bits(e,t.positionEncoding??""))}function qo(e,t={}){let r=U();if(t.preHook||t.postHook)return $e(r,e,t);let n=t.patch===void 0?"":typeof t.patch=="string"?t.patch:JSON.stringify(t.patch),{data:o,diagnostics:s}=JSON.parse(r.transform(e,t.inputFormat??"auto",t.outputFormat??"json",t.mode??"optimized",n,t.pretty??false,t.indent??2,t.spacesAroundValues??1));if(s.length>0)throw new _t(s);return o}function Rn(e,t,r={}){let n=U();if(typeof n.diff!="function")throw new ot("diff",et());return n.diff(e,t,r.inputFormat??"auto",r.outputFormat??"bitmark",r.context??3,r.locate??false,r.similarity??.6,r.bboxTolerance??8,r.spacesAroundValues??0)}function Yo(e,t,r={}){return JSON.parse(Rn(e,t,{...r,outputFormat:"json"}))}function Xo(e,t={}){let r=t.format??"bitmark++",n=t.location??"body",o=t.subLocation??"text";return U().breakscape_text(e,r,n,o)}function Qo(e,t={}){let r=t.format??"bitmark++",n=t.location??"body",o=t.subLocation??"text";return U().unbreakscape_text(e,r,n,o)}function Zo(e={}){let t=e.infoType??"list",r=e.format??"text",n=e.bit??"",o=e.pretty??false,s=e.indent??2,a=e.includeDeprecated??false,i=e.onlyDeprecated??false,d=e.full??false,u=typeof e.language=="string"?e.language:e.language?.join(",")??"",l=U();if(r!=="json"&&typeof l.info_text_supported!="function")throw new ot('info (format: "text")',et());return l.info(t,r,n,o,s,a,i,d,u)}function ti(e){let t=e.format??"text",r=e.pretty??false,n=e.indent??2,o=e.includeDeprecated??false,s=U();if(typeof s.template!="function"||typeof s.template_all!="function")throw new ot("template",et());if(e.all){if(t==="snippet")throw new Error("template({ all: true }) renders every bit as JSON; there is no snippet form");return s.template_all(o,r,n)}if(!e.bit)throw new Error("template() needs a bit name, or all: true");return s.template(e.bit,t,e.full??false,o,r,n)}function ei(e){try{U().register(e.type,e.data);}catch(t){throw new bt(t instanceof Error?t.message:String(t))}ze(e.type,e.data);}var ni="./wasm/",Sn={full:{init:ne,initSync:ee,ns:re,wasmFile:"bitmark_wasm_bg.wasm"},"browser-full":{init:ie,initSync:oe,ns:se,wasmFile:"bitmark_browser_full_wasm_bg.wasm"},"bitmark-json":{init:_e,initSync:ae,ns:pe,wasmFile:"bitmark_json_wasm_bg.wasm"}};qe(()=>U());function ve(e){return e===void 0?ce:"full"}function ri(e){if(e===null||typeof e!="object")return false;if("feature"in e||"module_or_path"in e)return true;let t=Object.getPrototypeOf(e);return (t===Object.prototype||t===null)&&Object.keys(e).length===0}function oi(e){if(ri(e))return {feature:e.feature??ve(e.module_or_path),module_or_path:e.module_or_path};let t=e??void 0;return {feature:ve(t),module_or_path:t}}var he=0,te,pt;async function Ns(e){let{feature:t,module_or_path:r}=oi(e);if(r===void 0){if(!pt&&et()===t)return te;if(pt?.feature===t)return pt.promise}let n=++he,o=Sn[t],s=r??zt(`${ni}${o.wasmFile}?v=${rt.version}`,import.meta.url),a=(async()=>{try{let i=await o.init({module_or_path:s});fe(o.ns),n===he&&(de(t,o.ns),te=i);}finally{pt?.seq===n&&(pt=void 0);}for(;pt;)await pt.promise.catch(()=>{});return te})();return pt={feature:t,seq:n,promise:a},a}function Vs(e,t={}){let r=t.feature??ve(e),n=Sn[r],o=n.initSync({module:e});return fe(n.ns),++he,pt=void 0,de(r,n.ns),te=o,o}function Us(){return Ht(rt.version)}function Hs(e,t={}){let r=U(),n=et()??ce;return Ke(r,e,t,(o,s)=>Xe(o,s,n))}export{Do as ALL_LANGUAGES,Fn as CompletionItemKind,En as CompletionItemTag,Tn as DiagnosticSeverity,Ut as NotInitializedError,_t as PatchError,bt as RegisterError,ot as UnsupportedFeatureError,Wo as bitmarkToObjects,Xo as breakscapeText,zo as canonicalize,Uo as complete,ke as convert,Mo as convertWithDetails,$o as countBits,Vo as diagnostics,Rn as diff,Yo as diffBits,Go as hover,Zo as info,Ns as init,Vs as initSync,On as legacy,Jo as objectsToBitmark,Co as patchEntry,ei as register,Ho as resolve,No as semanticTokens,Ko as splitBits,ti as template,qo as transform,Hs as transformParallel,Qo as unbreakscapeText,et as variant,Us as version};//# sourceMappingURL=bitmark-parser.min.js.map
7
7
  //# sourceMappingURL=bitmark-parser.min.js.map